@ic-reactor/candid 3.0.2-beta.1 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/README.md +33 -1
  2. package/dist/adapter.js +2 -1
  3. package/dist/adapter.js.map +1 -1
  4. package/dist/display-reactor.d.ts +4 -15
  5. package/dist/display-reactor.d.ts.map +1 -1
  6. package/dist/display-reactor.js +22 -8
  7. package/dist/display-reactor.js.map +1 -1
  8. package/dist/index.d.ts +3 -1
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +3 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/metadata-display-reactor.d.ts +108 -0
  13. package/dist/metadata-display-reactor.d.ts.map +1 -0
  14. package/dist/metadata-display-reactor.js +141 -0
  15. package/dist/metadata-display-reactor.js.map +1 -0
  16. package/dist/reactor.d.ts +1 -1
  17. package/dist/reactor.d.ts.map +1 -1
  18. package/dist/reactor.js +10 -6
  19. package/dist/reactor.js.map +1 -1
  20. package/dist/types.d.ts +38 -7
  21. package/dist/types.d.ts.map +1 -1
  22. package/dist/utils.d.ts +4 -4
  23. package/dist/utils.d.ts.map +1 -1
  24. package/dist/utils.js +33 -10
  25. package/dist/utils.js.map +1 -1
  26. package/dist/visitor/arguments/helpers.d.ts +55 -0
  27. package/dist/visitor/arguments/helpers.d.ts.map +1 -0
  28. package/dist/visitor/arguments/helpers.js +123 -0
  29. package/dist/visitor/arguments/helpers.js.map +1 -0
  30. package/dist/visitor/arguments/index.d.ts +101 -0
  31. package/dist/visitor/arguments/index.d.ts.map +1 -0
  32. package/dist/visitor/arguments/index.js +780 -0
  33. package/dist/visitor/arguments/index.js.map +1 -0
  34. package/dist/visitor/arguments/types.d.ts +270 -0
  35. package/dist/visitor/arguments/types.d.ts.map +1 -0
  36. package/dist/visitor/arguments/types.js +26 -0
  37. package/dist/visitor/arguments/types.js.map +1 -0
  38. package/dist/visitor/constants.d.ts +4 -0
  39. package/dist/visitor/constants.d.ts.map +1 -0
  40. package/dist/visitor/constants.js +73 -0
  41. package/dist/visitor/constants.js.map +1 -0
  42. package/dist/visitor/helpers.d.ts +30 -0
  43. package/dist/visitor/helpers.d.ts.map +1 -0
  44. package/dist/visitor/helpers.js +204 -0
  45. package/dist/visitor/helpers.js.map +1 -0
  46. package/dist/visitor/index.d.ts +5 -0
  47. package/dist/visitor/index.d.ts.map +1 -0
  48. package/dist/visitor/index.js +5 -0
  49. package/dist/visitor/index.js.map +1 -0
  50. package/dist/visitor/returns/index.d.ts +38 -0
  51. package/dist/visitor/returns/index.d.ts.map +1 -0
  52. package/dist/visitor/returns/index.js +460 -0
  53. package/dist/visitor/returns/index.js.map +1 -0
  54. package/dist/visitor/returns/types.d.ts +202 -0
  55. package/dist/visitor/returns/types.d.ts.map +1 -0
  56. package/dist/visitor/returns/types.js +2 -0
  57. package/dist/visitor/returns/types.js.map +1 -0
  58. package/dist/visitor/types.d.ts +19 -0
  59. package/dist/visitor/types.d.ts.map +1 -0
  60. package/dist/visitor/types.js +2 -0
  61. package/dist/visitor/types.js.map +1 -0
  62. package/package.json +16 -7
  63. package/src/adapter.ts +446 -0
  64. package/src/constants.ts +11 -0
  65. package/src/display-reactor.ts +337 -0
  66. package/src/index.ts +8 -0
  67. package/src/metadata-display-reactor.ts +230 -0
  68. package/src/reactor.ts +199 -0
  69. package/src/types.ts +127 -0
  70. package/src/utils.ts +60 -0
  71. package/src/visitor/arguments/helpers.ts +153 -0
  72. package/src/visitor/arguments/index.test.ts +1439 -0
  73. package/src/visitor/arguments/index.ts +981 -0
  74. package/src/visitor/arguments/schema.test.ts +324 -0
  75. package/src/visitor/arguments/types.ts +387 -0
  76. package/src/visitor/constants.ts +76 -0
  77. package/src/visitor/helpers.test.ts +274 -0
  78. package/src/visitor/helpers.ts +223 -0
  79. package/src/visitor/index.ts +4 -0
  80. package/src/visitor/returns/index.test.ts +2377 -0
  81. package/src/visitor/returns/index.ts +658 -0
  82. package/src/visitor/returns/types.ts +302 -0
  83. package/src/visitor/types.ts +75 -0
@@ -0,0 +1,202 @@
1
+ import type { BaseActor, FunctionName, FunctionType, ActorMethodReturnType } from "@ic-reactor/core";
2
+ import type { IDL } from "@icp-sdk/core/candid";
3
+ import type { VisitorDataType, TextFormat, NumberFormat } from "../types";
4
+ export type { VisitorDataType, TextFormat, NumberFormat };
5
+ /**
6
+ * The display type category after transformation.
7
+ * Maps Candid types to JavaScript-friendly display types.
8
+ */
9
+ export type DisplayType = "string" | "number" | "boolean" | "null" | "object" | "array" | "variant" | "variant-null" | "result" | "nullable" | "recursive" | "blob" | "func" | "func-record" | "unknown";
10
+ /**
11
+ * Base properties shared by all result nodes.
12
+ */
13
+ interface ResultNodeBase<T extends VisitorDataType = VisitorDataType> {
14
+ /** The Candid type category */
15
+ type: T;
16
+ /** Raw label from Candid definition */
17
+ label: string;
18
+ /** Human-readable formatted label for display */
19
+ displayLabel: string;
20
+ /** Original Candid type name */
21
+ candidType: string;
22
+ /** What it becomes after display transformation */
23
+ displayType: DisplayType;
24
+ /** Original raw value before transformation (present after resolution) */
25
+ raw?: unknown;
26
+ /** Value after display transformation (present after resolution) */
27
+ value?: unknown;
28
+ /** Resolve this node with a value, returning a new resolved node */
29
+ resolve(data: unknown): ResolvedNode<T>;
30
+ }
31
+ interface RecordNodeExtras {
32
+ /** Child fields of the record */
33
+ fields: Record<string, ResultNode>;
34
+ }
35
+ interface VariantNodeExtras {
36
+ /** All variant options as schema */
37
+ options: Record<string, ResultNode>;
38
+ /** The resolved selected option value */
39
+ selectedValue: ResultNode;
40
+ /** The selected option key (populated after resolution) */
41
+ selected?: string;
42
+ }
43
+ interface TupleNodeExtras {
44
+ /** Tuple element fields */
45
+ items: ResultNode[];
46
+ }
47
+ interface VectorNodeExtras {
48
+ /** Vector element fields */
49
+ items: ResultNode[];
50
+ }
51
+ interface OptionalNodeExtras {
52
+ /** The inner value, or null if not enabled */
53
+ value: ResultNode | null;
54
+ }
55
+ interface RecursiveNodeExtras {
56
+ /** The resolved recursive inner type */
57
+ inner: ResultNode;
58
+ }
59
+ interface BlobNodeExtras {
60
+ /** The blob value as hex/base64 or Uint8Array */
61
+ value: string | Uint8Array;
62
+ /** Hash of the blob content */
63
+ hash: string;
64
+ /** Length in bytes */
65
+ length: number;
66
+ }
67
+ interface NumberNodeExtras {
68
+ /** Detected number format */
69
+ format: NumberFormat;
70
+ /** The numeric value */
71
+ value: string | number;
72
+ }
73
+ interface TextNodeExtras {
74
+ /** Detected text format */
75
+ format: TextFormat;
76
+ /** The text value */
77
+ value: string;
78
+ }
79
+ interface PrincipalNodeExtras {
80
+ /** Detected text format */
81
+ format: TextFormat;
82
+ /** The principal value as string */
83
+ value: string;
84
+ }
85
+ interface BooleanNodeExtras {
86
+ /** The boolean value */
87
+ value: boolean;
88
+ }
89
+ interface NullNodeExtras {
90
+ /** The null value */
91
+ value: null;
92
+ }
93
+ interface UnknownNodeExtras {
94
+ /** The unknown value */
95
+ value: unknown;
96
+ }
97
+ interface FuncNodeExtras {
98
+ /** The canister principal of the function reference */
99
+ canisterId: string;
100
+ /** The method name of the function reference */
101
+ methodName: string;
102
+ }
103
+ interface FuncRecordNodeExtras {
104
+ /** The canister principal extracted from the func reference */
105
+ canisterId: string;
106
+ /** The method name extracted from the func reference */
107
+ methodName: string;
108
+ /** Whether the referenced function is "query" or "update" */
109
+ funcType: "query" | "update";
110
+ /** The raw IDL.FuncClass for encoding/decoding calls */
111
+ funcClass: IDL.FuncClass;
112
+ /** The key of the func field in the record */
113
+ funcFieldKey: string;
114
+ /** The func field node */
115
+ funcField: ResultNode<"func">;
116
+ /** Non-func fields — the default arguments for invoking the callback */
117
+ argFields: Record<string, ResultNode>;
118
+ /** All fields including the func field (superset of argFields + funcField) */
119
+ fields: Record<string, ResultNode>;
120
+ /**
121
+ * The display-type argument values extracted from argFields, ready to pass
122
+ * to `callMethod({ args: defaultArgs })`. Populated after `resolve()`.
123
+ *
124
+ * For a func that takes `(record { start: nat; length: nat })`, this would
125
+ * be `[{ start: "100", length: "50" }]` (display strings for BigInt fields).
126
+ *
127
+ * `undefined` before resolve.
128
+ */
129
+ defaultArgs?: unknown[];
130
+ }
131
+ type NodeTypeExtras<T extends VisitorDataType> = T extends "record" ? RecordNodeExtras : T extends "funcRecord" ? FuncRecordNodeExtras : T extends "variant" ? VariantNodeExtras : T extends "tuple" ? TupleNodeExtras : T extends "vector" ? VectorNodeExtras : T extends "optional" ? OptionalNodeExtras : T extends "recursive" ? RecursiveNodeExtras : T extends "blob" ? BlobNodeExtras : T extends "number" ? NumberNodeExtras : T extends "text" ? TextNodeExtras : T extends "principal" ? PrincipalNodeExtras : T extends "boolean" ? BooleanNodeExtras : T extends "null" ? NullNodeExtras : T extends "func" ? FuncNodeExtras : T extends "unknown" ? UnknownNodeExtras : {};
132
+ /**
133
+ * A unified result node that contains both schema and resolved value.
134
+ * When used as schema only, `raw` is undefined.
135
+ * When resolved, `raw` contains the original data.
136
+ *
137
+ * Compound types (record, variant, tuple, optional, vector) store
138
+ * resolved children directly in their structure fields.
139
+ * Primitive types store the display value in `value`.
140
+ */
141
+ export type ResultNode<T extends VisitorDataType = VisitorDataType> = T extends any ? ResultNodeBase<T> & NodeTypeExtras<T> : never;
142
+ /**
143
+ * A resolved node has `raw` populated and children resolved.
144
+ */
145
+ export type ResolvedNode<T extends VisitorDataType = VisitorDataType> = ResultNode<T> & {
146
+ raw: unknown;
147
+ };
148
+ export type RecordNode = ResultNode<"record">;
149
+ export type FuncRecordNode = ResultNode<"funcRecord">;
150
+ export type VariantNode = ResultNode<"variant">;
151
+ export type TupleNode = ResultNode<"tuple">;
152
+ export type OptionalNode = ResultNode<"optional">;
153
+ export type VectorNode = ResultNode<"vector">;
154
+ export type BlobNode = ResultNode<"blob">;
155
+ export type RecursiveNode = ResultNode<"recursive">;
156
+ export type PrincipalNode = ResultNode<"principal">;
157
+ export type NumberNode = ResultNode<"number">;
158
+ export type TextNode = ResultNode<"text">;
159
+ export type BooleanNode = ResultNode<"boolean">;
160
+ export type NullNode = ResultNode<"null">;
161
+ export type FuncNode = ResultNode<"func">;
162
+ export type UnknownNode = ResultNode<"unknown">;
163
+ /**
164
+ * Metadata for a single method's return values.
165
+ * Use this to render method results.
166
+ */
167
+ export interface MethodMeta<A = BaseActor, Name extends FunctionName<A> = FunctionName<A>> {
168
+ /** Whether this is a "query" or "update" call */
169
+ functionType: FunctionType;
170
+ /** The method name as defined in the Candid interface */
171
+ functionName: Name;
172
+ /** Array of result node descriptors, one per return value */
173
+ returns: ResultNode[];
174
+ /** Number of return values */
175
+ returnCount: number;
176
+ /**
177
+ * Resolve the method result schema with actual return data.
178
+ * @param data The raw return data from the canister
179
+ * @returns A resolved result with display-friendly values
180
+ */
181
+ resolve(data: ActorMethodReturnType<A[Name]>): MethodResult<A>;
182
+ }
183
+ /**
184
+ * A resolved method result with display-friendly values.
185
+ */
186
+ export interface MethodResult<A = BaseActor> {
187
+ /** Whether this is a "query" or "update" call */
188
+ functionType: FunctionType;
189
+ /** The method name */
190
+ functionName: FunctionName<A>;
191
+ /** Resolved return values */
192
+ results: ResolvedNode[];
193
+ /** Original raw data from the canister */
194
+ raw: ActorMethodReturnType<A[FunctionName<A>]>;
195
+ }
196
+ /**
197
+ * Service-level metadata mapping method names to their return metadata.
198
+ */
199
+ export type ServiceMeta<A = BaseActor> = {
200
+ [K in FunctionName<A>]: MethodMeta<A, K>;
201
+ };
202
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/visitor/returns/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,qBAAqB,EACtB,MAAM,kBAAkB,CAAA;AACzB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEzE,YA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M,CAAA;IACnB;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAA;CAC/D;AAED;;GAEG;AACH,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,SAAS;IACzC,iDAAiD;IACjD,YAAY,EAAE,YAAY,CAAA;IAC1B,sBAAsB;IACtB,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;IAC7B,6BAA6B;IAC7B,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,0CAA0C;IAC1C,GAAG,EAAE,qBAAqB,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;CAC/C;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,SAAS,IAAI;KACtC,CAAC,IAAI,YAAY,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC;CACzC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/visitor/returns/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ export type FieldType = "functionRecord" | "function" | "record" | "variant" | "tuple" | "optional" | "vector" | "table" | "blob" | "blob-large" | "recursive" | "unknown" | "text" | "number" | "principal" | "boolean" | "null";
2
+ export type { Principal } from "@icp-sdk/core/principal";
3
+ import type { IDL } from "@icp-sdk/core/candid";
4
+ export type AllNumberTypes = IDL.NatClass | IDL.IntClass | IDL.FixedNatClass | IDL.FixedIntClass | IDL.FloatClass;
5
+ /**
6
+ * The core Candid type category used across visitors.
7
+ */
8
+ export type VisitorDataType = "record" | "funcRecord" | "variant" | "tuple" | "optional" | "vector" | "blob" | "recursive" | "principal" | "number" | "text" | "boolean" | "null" | "func" | "unknown";
9
+ /**
10
+ * Detected format for text fields based on label heuristics.
11
+ * Used to provide format-specific validation and display.
12
+ */
13
+ export type TextFormat = "plain" | "timestamp" | "uuid" | "url" | "email" | "phone" | "btc" | "eth" | "account-id" | "principal" | "cycle";
14
+ /**
15
+ * Detected format for number fields based on label heuristics.
16
+ * Used to provide format-specific validation and display.
17
+ */
18
+ export type NumberFormat = "timestamp" | "cycle" | "value" | "token" | "normal";
19
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/visitor/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GACjB,gBAAgB,GAChB,UAAU,GACV,QAAQ,GACR,SAAS,GACT,OAAO,GACP,UAAU,GACV,QAAQ,GACR,OAAO,GACP,MAAM,GACN,YAAY,GACZ,WAAW,GACX,SAAS,GACT,MAAM,GACN,QAAQ,GACR,WAAW,GACX,SAAS,GACT,MAAM,CAAA;AAEV,YAAY,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAC/C,MAAM,MAAM,cAAc,GACtB,GAAG,CAAC,QAAQ,GACZ,GAAG,CAAC,QAAQ,GACZ,GAAG,CAAC,aAAa,GACjB,GAAG,CAAC,aAAa,GACjB,GAAG,CAAC,UAAU,CAAA;AAMlB;;GAEG;AACH,MAAM,MAAM,eAAe,GACvB,QAAQ,GACR,YAAY,GACZ,SAAS,GACT,OAAO,GACP,UAAU,GACV,QAAQ,GACR,MAAM,GACN,WAAW,GACX,WAAW,GACX,QAAQ,GACR,MAAM,GACN,SAAS,GACT,MAAM,GACN,MAAM,GACN,SAAS,CAAA;AAEb;;;GAGG;AACH,MAAM,MAAM,UAAU,GAClB,OAAO,GACP,WAAW,GACX,MAAM,GACN,KAAK,GACL,OAAO,GACP,OAAO,GACP,KAAK,GACL,KAAK,GACL,YAAY,GACZ,WAAW,GACX,OAAO,CAAA;AAEX;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/visitor/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ic-reactor/candid",
3
- "version": "3.0.2-beta.1",
3
+ "version": "3.0.2",
4
4
  "description": "IC Reactor Candid Adapter - Fetch and parse Candid definitions from Internet Computer canisters",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -16,6 +16,7 @@
16
16
  },
17
17
  "files": [
18
18
  "dist",
19
+ "src",
19
20
  "README.md"
20
21
  ],
21
22
  "repository": {
@@ -26,7 +27,7 @@
26
27
  "bugs": {
27
28
  "url": "https://github.com/B3Pay/ic-reactor/issues"
28
29
  },
29
- "homepage": "https://ic-reactor.dev",
30
+ "homepage": "https://ic-reactor.b3pay.net/v3/packages/candid/",
30
31
  "keywords": [
31
32
  "internet-computer",
32
33
  "icp",
@@ -41,25 +42,33 @@
41
42
  "author": "Behrad Deylami",
42
43
  "license": "MIT",
43
44
  "dependencies": {
44
- "@ic-reactor/core": "^3.0.2-beta.1"
45
+ "@noble/hashes": "^2.0.1",
46
+ "zod": "^4.3.5",
47
+ "@ic-reactor/core": "^3.0.2"
45
48
  },
46
49
  "peerDependencies": {
50
+ "zod": "^4.3.5",
51
+ "@noble/hashes": "^2.0.0",
47
52
  "@icp-sdk/core": "^5.0.0"
48
53
  },
49
54
  "peerDependenciesMeta": {},
50
55
  "devDependencies": {
51
56
  "@icp-sdk/core": "^5.0.0",
52
57
  "@size-limit/preset-small-lib": "^12.0.0",
53
- "@types/node": "^24.10.1",
58
+ "@types/node": "^25.2.3",
54
59
  "size-limit": "^12.0.0",
55
- "vitest": "^4.0.16"
60
+ "vitest": "^4.0.18",
61
+ "@ic-reactor/parser": "^0.4.6"
56
62
  },
57
63
  "size-limit": [
58
64
  {
59
65
  "name": "Candid Package",
60
66
  "path": "dist/index.js",
61
67
  "limit": "30 KB",
62
- "gzip": true
68
+ "gzip": true,
69
+ "ignore": [
70
+ "@ic-reactor/parser"
71
+ ]
63
72
  }
64
73
  ],
65
74
  "scripts": {
@@ -67,6 +76,6 @@
67
76
  "test": "vitest run",
68
77
  "version:sync": "node -e \"const pkg = require('./package.json'); const fs = require('fs'); fs.writeFileSync('./src/version.ts', '/**\\n * Library version - automatically synced from package.json.\\n */\\nexport const VERSION = \\\"' + pkg.version + '\\\"\\n');\"",
69
78
  "size": "size-limit",
70
- "analyze": "size-limit --why"
79
+ "analyze": "size-limit"
71
80
  }
72
81
  }