Skip to content

Commit

Permalink
pr fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bdemann committed Oct 3, 2023
1 parent 4e0396a commit 63a6d54
Show file tree
Hide file tree
Showing 53 changed files with 285 additions and 282 deletions.
2 changes: 1 addition & 1 deletion examples/inspect_message/src/index.did
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
service: () -> {
accessible: () -> (bool);
inaccessible: () -> (bool);
alsoInaccessible: () -> (bool);
inaccessible: () -> (bool);
}
2 changes: 1 addition & 1 deletion src/compiler/generate_candid_and_canister_methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
DEFAULT_VISITOR_DATA,
didResultToCandidString,
DidVisitor
} from '../lib/did_visitor';
} from '../lib/candid/did_visitor';

export function generateCandidAndCanisterMethods(mainJs: string): {
candid: string;
Expand Down
File renamed without changes.
77 changes: 28 additions & 49 deletions src/lib/candid/index.ts
Original file line number Diff line number Diff line change
@@ -1,53 +1,32 @@
import { IDL } from '..';
import {
AzleBlob,
blob,
AzleVec,
AzleOpt,
AzleInt,
AzleInt64,
AzleInt32,
AzleInt16,
AzleInt8,
AzleNat,
AzleNat64,
AzleNat32,
AzleNat16,
AzleNat8,
AzleFloat64,
AzleFloat32,
AzleResult,
nat,
nat64,
nat32,
nat16,
nat8,
int,
int64,
int32,
int16,
int8,
float64,
float32,
AzleNull,
Null,
AzleReserved,
reserved,
AzleEmpty,
empty,
AzleBool,
bool,
Principal,
AzleTuple,
AzleText,
AzleVoid,
Opt,
Result
} from './';
import { IDL } from '@dfinity/candid';
import { AzleBlob, blob } from './types/constructed/blob';
import { AzleVec } from './types/constructed/vector';
import { AzleOpt, Opt } from './types/constructed/option';
import { AzleTuple } from './types/constructed/tuple';
import { AzleNull, Null } from './types/primitive/null';
import { AzleReserved, reserved } from './types/primitive/reserved';
import { AzleEmpty, empty } from './types/primitive/empty';
import { AzleBool, bool } from './types/primitive/bool';
import { AzleText } from './types/primitive/text';
import { AzleVoid } from './types/primitive/void';
import { AzleFloat32, float32 } from './types/primitive/floats/float32';
import { AzleFloat64, float64 } from './types/primitive/floats/float64';
import { AzleInt, int } from './types/primitive/ints/int';
import { AzleInt8, int8 } from './types/primitive/ints/int8';
import { AzleInt16, int16 } from './types/primitive/ints/int16';
import { AzleInt32, int32 } from './types/primitive/ints/int32';
import { AzleInt64, int64 } from './types/primitive/ints/int64';
import { AzleNat, nat } from './types/primitive/nats/nat';
import { AzleNat8, nat8 } from './types/primitive/nats/nat8';
import { AzleNat16, nat16 } from './types/primitive/nats/nat16';
import { AzleNat32, nat32 } from './types/primitive/nats/nat32';
import { AzleNat64, nat64 } from './types/primitive/nats/nat64';
import { AzleResult, Result } from '../system_types';
import { Principal } from './types/reference';

export * from './constructed';
export * from './primitive';
export * from './reference';
export * from './types/constructed';
export * from './types/primitive';
export * from './types/reference';

export type TypeMapping<T, RecursionLevel = 0> = RecursionLevel extends 10
? T
Expand Down
24 changes: 0 additions & 24 deletions src/lib/candid/primitive/floating_point_numbers.ts

This file was deleted.

57 changes: 0 additions & 57 deletions src/lib/candid/primitive/integer_numbers.ts

This file was deleted.

57 changes: 0 additions & 57 deletions src/lib/candid/primitive/natural_numbers.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { v4 } from 'uuid';
import { IDL } from '@dfinity/candid';
import { Parent } from '../../to_idl_type';
import { Parent } from './index';

export function Recursive(idlCallback: any): any {
const name = v4();
Expand Down
7 changes: 4 additions & 3 deletions src/lib/candid/serde/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { IDL } from '@dfinity/candid';

import { AzleVec, AzleOpt, AzleTuple } from '..';
import { DecodeVisitor, EncodeVisitor } from './visitors/';
import { CandidType, toIDLType } from '../..';
import { AzleVec, AzleOpt, AzleTuple } from '../types/constructed';
import { DecodeVisitor } from './visitors/decode_visitor';
import { EncodeVisitor } from './visitors/encode_visitor';
import { CandidType, toIDLType } from '../../candid';

/**
* Encodes the provided value as candid blob of the designated type.
Expand Down
4 changes: 2 additions & 2 deletions src/lib/candid/serde/visitors/decode_visitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
visitTuple,
visitVariant,
visitVec
} from '.';
import { Opt } from '../../';
} from './index';
import { Opt } from '../../types/constructed';

/**
* When we decode a Service we are given a principal. We need to use that
Expand Down
2 changes: 1 addition & 1 deletion src/lib/candid/serde/visitors/encode_visitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
visitTuple,
visitVariant,
visitVec
} from '.';
} from './index';

/**
* When we encode a Service we have a service class and we need it to be only
Expand Down
2 changes: 1 addition & 1 deletion src/lib/candid/serde/visitors/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IDL } from '@dfinity/candid';
import { DecodeVisitor } from './decode_visitor';
import { EncodeVisitor } from './encode_visitor';
import { AzleResult, Result } from '../../';
import { AzleResult, Result } from '../../../system_types/result';
export { EncodeVisitor, DecodeVisitor };

/*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IDL } from '../..';
import { IDL } from '@dfinity/candid';

export class AzleBlob {
_kind: 'AzleBlob' = 'AzleBlob';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { CandidType, IDL, Parent, toIDLType } from '../../';
import { CandidType, Parent, toIDLType } from '../../index';
import { IDL } from '@dfinity/candid';

export * from './blob';
export * from './option';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { CandidType, RequireExactlyOne } from '..';
import { IDL, Parent, toIDLType } from '../..';
import { CandidType, Parent, toIDLType } from '../../index';
import { RequireExactlyOne } from '../constructed/variant';
import { IDL } from '@dfinity/candid';

/**
* Represents an optional value: every {@link Opt} is either `Some` and contains
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { CandidType, TypeMapping } from '..';
import { CandidType, TypeMapping, Parent } from '../../index';
import { IDL } from '@dfinity/candid';
import { Parent } from '../../to_idl_type';
import { processMap } from '..';
import { processMap } from '../constructed';
import { v4 } from 'uuid';

export function Record<
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { CandidType } from '..';
import { Parent, toIDLType, IDL } from '../../';
import { CandidType } from '../../index';
import { Parent, toIDLType } from '../../index';
import { IDL } from '@dfinity/candid';

export class AzleTuple<T extends any[]> {
constructor(t: CandidType[]) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { CandidType, TypeMapping } from '../..';
import { processMap } from '../';
import { processMap } from '.';
import { v4 } from 'uuid';
import { IDL } from '../../..';

export * from './result';
export * from './rejection_code';
import { IDL } from '@dfinity/candid';

export function Variant<
T extends {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { CandidType } from '..';
import { IDL, Parent, toIDLType } from '../..';
import { CandidType } from '../../index';
import { Parent, toIDLType } from '../../index';
import { IDL } from '@dfinity/candid';

export class AzleVec<T> {
constructor(t: any) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IDL } from '../..';
import { IDL } from '@dfinity/candid';

export class AzleBool {
_kind: 'AzleBool' = 'AzleBool';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IDL } from '../..';
import { IDL } from '@dfinity/candid';

export class AzleEmpty {
_kind: 'AzleEmpty' = 'AzleEmpty';
Expand Down
13 changes: 13 additions & 0 deletions src/lib/candid/types/primitive/floats/float32.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { IDL } from '@dfinity/candid';

export class AzleFloat32 {
_kind: 'AzleFloat32' = 'AzleFloat32';
_azleCandidType?: '_azleCandidType';

static getIDL() {
return IDL.Float32;
}
}

export const float32: AzleFloat32 = AzleFloat32 as any;
export type float32 = number;
13 changes: 13 additions & 0 deletions src/lib/candid/types/primitive/floats/float64.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { IDL } from '@dfinity/candid';

export class AzleFloat64 {
_kind: 'AzleFloat64' = 'AzleFloat64';
_azleCandidType?: '_azleCandidType';

static getIDL() {
return IDL.Float64;
}
}

export const float64: AzleFloat64 = AzleFloat64 as any;
export type float64 = number;
2 changes: 2 additions & 0 deletions src/lib/candid/types/primitive/floats/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './float32';
export * from './float64';
Loading

0 comments on commit 63a6d54

Please sign in to comment.