Skip to content

Commit

Permalink
uniformize capitalization of IDL in function names
Browse files Browse the repository at this point in the history
  • Loading branch information
bdemann committed Oct 17, 2023
1 parent 2b6bdd9 commit a96cd1a
Show file tree
Hide file tree
Showing 31 changed files with 39 additions and 39 deletions.
4 changes: 2 additions & 2 deletions src/compiler/generate_candid_and_canister_methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ export function generateCandidAndCanisterMethods(mainJs: string): {

const canisterMethods = (sandbox.exports as any).canisterMethods;

const candidInfo = canisterMethods.getIDL([]).accept(new DidVisitor(), {
const candidInfo = canisterMethods.getIdl([]).accept(new DidVisitor(), {
...getDefaultVisitorData(),
isFirstService: true,
systemFuncs: canisterMethods.getSystemFunctionIDLs()
systemFuncs: canisterMethods.getSystemFunctionIdls()
});

return {
Expand Down
6 changes: 3 additions & 3 deletions src/lib/candid/recursive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export type _AzleRecursiveFunction = {
(...args: any[]): CandidType;
_azleName?: string;
_azleIsRecursive?: boolean;
getIDL?: (parents: Parent[]) => IDL.Type<any>;
getIdl?: (parents: Parent[]) => IDL.Type<any>;
};

export function Recursive(candidTypeCallback: any): any {
Expand All @@ -22,13 +22,13 @@ export function Recursive(candidTypeCallback: any): any {

result._azleName = name;
result._azleIsRecursive = true;
result.getIDL = (parents: Parent[]) => {
result.getIdl = (parents: Parent[]) => {
const idl = IDL.Rec();
let filler = candidTypeCallback();
if (filler._azleIsCanister) {
filler = filler(result);
}
idl.fill(filler.getIDL([...parents, { idl: idl, name }]));
idl.fill(filler.getIdl([...parents, { idl: idl, name }]));
return idl;
};

Expand Down
6 changes: 3 additions & 3 deletions src/lib/candid/to_Idl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ export function toIdl(
);
// If the parent isn't undefined (ie we found one with the same name)
// this is a recursive type and we should return the parent rec idl
// instead of calling getIDL
// instead of calling getIdl
if (parent !== undefined) {
return parent.idl;
}
}
if ('_azleIsCanister' in candidType && candidType._azleIsCanister) {
return toIdl((candidType as any)(), parents);
}
// All CandidTypes ought to have a getIDL function defined for them
return (candidType as any).getIDL(parents);
// All CandidTypes ought to have a getIdl function defined for them
return (candidType as any).getIdl(parents);
}

export function toParamIdls(
Expand Down
2 changes: 1 addition & 1 deletion src/lib/candid/types/constructed/blob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export class AzleBlob {
_kind: 'AzleBlob' = 'AzleBlob';
_azleCandidType?: '_azleCandidType';

static getIDL() {
static getIdl() {
return IDL.Vec(IDL.Nat8);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/candid/types/constructed/opt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class AzleOpt<T> {
_azleCandidType?: '_azleCandidType';
_kind: 'AzleOpt' = 'AzleOpt';

getIDL(parents: Parent[]) {
getIdl(parents: Parent[]) {
return IDL.Opt(toIdl(this._azleType, parents));
}
}
2 changes: 1 addition & 1 deletion src/lib/candid/types/constructed/record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function Record<
} & { _azleCandidType?: '_azleCandidType' } {
return {
...obj,
getIDL(parents: Parent[]) {
getIdl(parents: Parent[]) {
return IDL.Record(toIdlMap(obj as CandidMap, parents));
}
} as any;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/candid/types/constructed/tuple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class AzleTuple<T extends any[]> {
_azleTypes: CandidType[];
_azleCandidType?: '_azleCandidType';

getIDL(parents: Parent[]) {
getIdl(parents: Parent[]) {
const idls = this._azleTypes.map((value) => {
return toIdl(value, parents);
});
Expand Down
2 changes: 1 addition & 1 deletion src/lib/candid/types/constructed/variant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function Variant<
}> & { _azleCandidType?: '_azleCandidType' } {
return {
...obj,
getIDL(parents: any) {
getIdl(parents: any) {
return IDL.Variant(toIdlMap(obj as CandidMap, parents));
}
} as any;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/candid/types/constructed/vec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class AzleVec<T> {
_azleType: CandidType;
_azleCandidType?: '_azleCandidType';

getIDL(parents: Parent[]) {
getIdl(parents: Parent[]) {
return IDL.Vec(toIdl(this._azleType, parents));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/candid/types/primitive/bool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export class AzleBool {
_kind: 'AzleBool' = 'AzleBool';
_azleCandidType?: '_azleCandidType';

static getIDL() {
static getIdl() {
return IDL.Bool;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/candid/types/primitive/empty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export class AzleEmpty {
_kind: 'AzleEmpty' = 'AzleEmpty';
_azleCandidType?: '_azleCandidType';

static getIDL() {
static getIdl() {
return IDL.Empty;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/candid/types/primitive/floats/float32.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export class AzleFloat32 {
_kind: 'AzleFloat32' = 'AzleFloat32';
_azleCandidType?: '_azleCandidType';

static getIDL() {
static getIdl() {
return IDL.Float32;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/candid/types/primitive/floats/float64.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export class AzleFloat64 {
_kind: 'AzleFloat64' = 'AzleFloat64';
_azleCandidType?: '_azleCandidType';

static getIDL() {
static getIdl() {
return IDL.Float64;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/candid/types/primitive/ints/int.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export class AzleInt {
_kind: 'AzleInt' = 'AzleInt';
_azleCandidType?: '_azleCandidType';

static getIDL() {
static getIdl() {
return IDL.Int;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/candid/types/primitive/ints/int16.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export class AzleInt16 {
_kind: 'AzleInt16' = 'AzleInt16';
_azleCandidType?: '_azleCandidType';

static getIDL() {
static getIdl() {
return IDL.Int16;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/candid/types/primitive/ints/int32.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export class AzleInt32 {
_kind: 'AzleInt32' = 'AzleInt32';
_azleCandidType?: '_azleCandidType';

static getIDL() {
static getIdl() {
return IDL.Int32;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/candid/types/primitive/ints/int64.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export class AzleInt64 {
_kind: 'AzleInt64' = 'AzleInt64';
_azleCandidType?: '_azleCandidType';

static getIDL() {
static getIdl() {
return IDL.Int64;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/candid/types/primitive/ints/int8.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export class AzleInt8 {
_kind: 'AzleInt8' = 'AzleInt8';
_azleCandidType?: '_azleCandidType';

static getIDL() {
static getIdl() {
return IDL.Int8;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/candid/types/primitive/nats/nat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export class AzleNat {
_kind: 'AzleNat' = 'AzleNat';
_azleCandidType?: '_azleCandidType';

static getIDL() {
static getIdl() {
return IDL.Nat;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/candid/types/primitive/nats/nat16.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export class AzleNat16 {
_kind: 'AzleNat16' = 'AzleNat16';
_azleCandidType?: '_azleCandidType';

static getIDL() {
static getIdl() {
return IDL.Nat16;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/candid/types/primitive/nats/nat32.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export class AzleNat32 {
_kind: 'AzleNat32' = 'AzleNat32';
_azleCandidType?: '_azleCandidType';

static getIDL() {
static getIdl() {
return IDL.Nat32;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/candid/types/primitive/nats/nat64.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export class AzleNat64 {
_kind: 'AzleNat64' = 'AzleNat64';
_azleCandidType?: '_azleCandidType';

static getIDL() {
static getIdl() {
return IDL.Nat64;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/candid/types/primitive/nats/nat8.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export class AzleNat8 {
_kind: 'AzleNat8' = 'AzleNat8';
_azleCandidType?: '_azleCandidType';

static getIDL() {
static getIdl() {
return IDL.Nat8;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/candid/types/primitive/null.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export class AzleNull {
_kind: 'AzleNull' = 'AzleNull';
_azleCandidType?: '_azleCandidType';

static getIDL() {
static getIdl() {
return IDL.Null;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/candid/types/primitive/reserved.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export class AzleReserved {
_kind: 'AzleReserved' = 'AzleReserved';
_azleCandidType?: '_azleCandidType';

static getIDL() {
static getIdl() {
return IDL.Reserved;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/candid/types/primitive/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export class AzleText {
_kind: 'AzleText' = 'AzleText';
_azleCandidType?: '_azleCandidType';

static getIDL() {
static getIdl() {
return IDL.Text;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/candid/types/primitive/void.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export class AzleVoid {
_kind: 'AzleVoid' = 'AzleVoid';
_azleCandidType?: '_azleCandidType';

static getIDL() {
static getIdl() {
return [];
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/candid/types/reference/func.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function Func(
mode: Mode
): [Principal, string] & { _azleCandidType?: '_azleCandidType' } {
return {
getIDL(parents: Parent[]) {
getIdl(parents: Parent[]) {
return IDL.Func(
toParamIdls(paramCandidTypes, parents),
toReturnIdl(returnCandidTypes, parents),
Expand Down
2 changes: 1 addition & 1 deletion src/lib/candid/types/reference/principal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Principal as DfinityPrincipal } from '@dfinity/principal';
export class Principal extends DfinityPrincipal {
static _azleCandidType?: '_azleCandidType';

static getIDL?() {
static getIdl?() {
return IDL.Principal;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ type _AzleFunctionReturnType = {
queries?: any[];
updates?: any[];
callbacks?: any;
getSystemFunctionIDLs?: (parents: Parent[]) => IDL.FuncClass[];
getIDL?: (parents: Parent[]) => IDL.Type<any>;
getSystemFunctionIdls?: (parents: Parent[]) => IDL.FuncClass[];
getIdl?: (parents: Parent[]) => IDL.Type<any>;
};

type CallRawFunction = typeof ic.callRaw | typeof ic.callRaw128;
Expand Down Expand Up @@ -60,8 +60,8 @@ export function createCanisterFunction(canisterOptions: CanisterOptions) {
canister.queries = createQueryMethods(canisterOptions);
canister.updates = createUpdateMethods(canisterOptions);
canister.callbacks = createCallbacks(canisterOptions);
canister.getIDL = createGetIdlFunction(canisterOptions);
canister.getSystemFunctionIDLs =
canister.getIdl = createGetIdlFunction(canisterOptions);
canister.getSystemFunctionIdls =
createGetSystemFunctionIdlFunction(canisterOptions);

return canister;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/system_types/result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class AzleResult<T, K> {

_azleCandidType?: '_azleCandidType';

getIDL(parents: Parent[]) {
getIdl(parents: Parent[]) {
return IDL.Variant({
Ok: toIdl(this._azleOk, parents),
Err: toIdl(this._azleErr, parents)
Expand Down

0 comments on commit a96cd1a

Please sign in to comment.