@junobuild/functions 0.0.7 → 0.0.8-next-2025-03-18
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.
- package/README.md +314 -89
- package/chunk-CCKUQNB5.js +2 -0
- package/chunk-CCKUQNB5.js.map +7 -0
- package/chunk-LVVTFR6B.js +2 -0
- package/chunk-LVVTFR6B.js.map +7 -0
- package/global.d.ts +7 -1
- package/hooks/schemas/context.d.ts +24 -0
- package/ic-cdk/call.ic-cdk.d.ts +15 -0
- package/ic-cdk/schemas/call.d.ts +77 -0
- package/ic-cdk/types/errors.d.ts +3 -0
- package/ic-cdk.d.ts +4 -1
- package/ic-cdk.js +1 -6
- package/ic-cdk.js.map +4 -4
- package/index.d.ts +2 -1
- package/index.js +1 -1
- package/index.js.map +4 -4
- package/package.json +8 -4
- package/schemas/candid.d.ts +14 -3
- package/schemas/db.d.ts +11 -0
- package/schemas/{core.d.ts → satellite.d.ts} +9 -9
- package/sdk/schemas/db.d.ts +3 -3
- package/sdk/serializer.sdk.d.ts +1 -1
- package/sdk.js +1 -1
- package/sdk.js.map +4 -4
- package/src/global.d.ts +7 -1
- package/tests/mocks/ic-cdk.mocks.d.ts +2 -0
- package/chunk-OVO3T2DM.js +0 -2
- package/chunk-OVO3T2DM.js.map +0 -7
- /package/ic-cdk/{id.d.ts → id.ic-cdk.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -15,6 +15,8 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
|
|
|
15
15
|
### :toolbox: Functions
|
|
16
16
|
|
|
17
17
|
- [HookContextSchema](#gear-hookcontextschema)
|
|
18
|
+
- [AssertFunctionSchema](#gear-assertfunctionschema)
|
|
19
|
+
- [RunFunctionSchema](#gear-runfunctionschema)
|
|
18
20
|
- [DocContextSchema](#gear-doccontextschema)
|
|
19
21
|
- [AssertFnSchema](#gear-assertfnschema)
|
|
20
22
|
- [AssertFnOrObjectSchema](#gear-assertfnorobjectschema)
|
|
@@ -31,6 +33,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
|
|
|
31
33
|
- [setDocStore](#gear-setdocstore)
|
|
32
34
|
- [decodeDocData](#gear-decodedocdata)
|
|
33
35
|
- [encodeDocData](#gear-encodedocdata)
|
|
36
|
+
- [call](#gear-call)
|
|
34
37
|
- [id](#gear-id)
|
|
35
38
|
|
|
36
39
|
#### :gear: HookContextSchema
|
|
@@ -41,6 +44,22 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
|
|
|
41
44
|
|
|
42
45
|
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/context.ts#L7)
|
|
43
46
|
|
|
47
|
+
#### :gear: AssertFunctionSchema
|
|
48
|
+
|
|
49
|
+
| Function | Type |
|
|
50
|
+
| ---------------------- | ----------------------------------------------------------------------------------------------- |
|
|
51
|
+
| `AssertFunctionSchema` | `<T extends z.ZodTypeAny>(contextSchema: T) => ZodFunction<ZodTuple<[T], ZodUnknown>, ZodVoid>` |
|
|
52
|
+
|
|
53
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/context.ts#L32)
|
|
54
|
+
|
|
55
|
+
#### :gear: RunFunctionSchema
|
|
56
|
+
|
|
57
|
+
| Function | Type |
|
|
58
|
+
| ------------------- | ----------------------------------------------------------------------------------------------------------- |
|
|
59
|
+
| `RunFunctionSchema` | `<T extends z.ZodTypeAny>(contextSchema: T) => ZodFunction<ZodTuple<[T], ZodUnknown>, ZodPromise<ZodVoid>>` |
|
|
60
|
+
|
|
61
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/context.ts#L47)
|
|
62
|
+
|
|
44
63
|
#### :gear: DocContextSchema
|
|
45
64
|
|
|
46
65
|
| Function | Type |
|
|
@@ -55,7 +74,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
|
|
|
55
74
|
| ---------------- | ----------------------------------------------------------------------------------------------------------------------- |
|
|
56
75
|
| `AssertFnSchema` | `<T extends z.ZodTypeAny>(assertSchema: T) => ZodFunction<ZodTuple<[ZodRecord<ZodString, ZodUnknown>], ZodUnknown>, T>` |
|
|
57
76
|
|
|
58
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#
|
|
77
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L44)
|
|
59
78
|
|
|
60
79
|
#### :gear: AssertFnOrObjectSchema
|
|
61
80
|
|
|
@@ -63,7 +82,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
|
|
|
63
82
|
| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------- |
|
|
64
83
|
| `AssertFnOrObjectSchema` | `<T extends z.ZodTypeAny>(assertSchema: T) => ZodUnion<[T, ZodFunction<ZodTuple<[ZodRecord<ZodString, ZodUnknown>], ZodUnknown>, T>]>` |
|
|
65
84
|
|
|
66
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#
|
|
85
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L48)
|
|
67
86
|
|
|
68
87
|
#### :gear: defineAssert
|
|
69
88
|
|
|
@@ -71,7 +90,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
|
|
|
71
90
|
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
72
91
|
| `defineAssert` | `{ <T extends Assert>(assert: T): T; <T extends Assert>(assert: AssertFn<T>): AssertFn<T>; <T extends Assert>(assert: AssertFnOrObject<T>): AssertFnOrObject<T>; }` |
|
|
73
92
|
|
|
74
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#
|
|
93
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L52)
|
|
75
94
|
|
|
76
95
|
#### :gear: defineAssert
|
|
77
96
|
|
|
@@ -79,7 +98,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
|
|
|
79
98
|
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
80
99
|
| `defineAssert` | `{ <T extends Assert>(assert: T): T; <T extends Assert>(assert: AssertFn<T>): AssertFn<T>; <T extends Assert>(assert: AssertFnOrObject<T>): AssertFnOrObject<T>; }` |
|
|
81
100
|
|
|
82
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#
|
|
101
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L53)
|
|
83
102
|
|
|
84
103
|
#### :gear: defineAssert
|
|
85
104
|
|
|
@@ -87,7 +106,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
|
|
|
87
106
|
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
88
107
|
| `defineAssert` | `{ <T extends Assert>(assert: T): T; <T extends Assert>(assert: AssertFn<T>): AssertFn<T>; <T extends Assert>(assert: AssertFnOrObject<T>): AssertFnOrObject<T>; }` |
|
|
89
108
|
|
|
90
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#
|
|
109
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L54)
|
|
91
110
|
|
|
92
111
|
#### :gear: defineAssert
|
|
93
112
|
|
|
@@ -95,7 +114,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
|
|
|
95
114
|
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
96
115
|
| `defineAssert` | `{ <T extends Assert>(assert: T): T; <T extends Assert>(assert: AssertFn<T>): AssertFn<T>; <T extends Assert>(assert: AssertFnOrObject<T>): AssertFnOrObject<T>; }` |
|
|
97
116
|
|
|
98
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#
|
|
117
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L55)
|
|
99
118
|
|
|
100
119
|
#### :gear: HookFnSchema
|
|
101
120
|
|
|
@@ -103,7 +122,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
|
|
|
103
122
|
| -------------- | --------------------------------------------------------------------------------------------------------------------- |
|
|
104
123
|
| `HookFnSchema` | `<T extends z.ZodTypeAny>(hookSchema: T) => ZodFunction<ZodTuple<[ZodRecord<ZodString, ZodUnknown>], ZodUnknown>, T>` |
|
|
105
124
|
|
|
106
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#
|
|
125
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L44)
|
|
107
126
|
|
|
108
127
|
#### :gear: HookFnOrObjectSchema
|
|
109
128
|
|
|
@@ -111,7 +130,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
|
|
|
111
130
|
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
112
131
|
| `HookFnOrObjectSchema` | `<T extends z.ZodTypeAny>(hookSchema: T) => ZodUnion<[T, ZodFunction<ZodTuple<[ZodRecord<ZodString, ZodUnknown>], ZodUnknown>, T>]>` |
|
|
113
132
|
|
|
114
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#
|
|
133
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L48)
|
|
115
134
|
|
|
116
135
|
#### :gear: defineHook
|
|
117
136
|
|
|
@@ -119,7 +138,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
|
|
|
119
138
|
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
120
139
|
| `defineHook` | `{ <T extends Hook>(hook: T): T; <T extends Hook>(hook: HookFn<T>): HookFn<T>; <T extends Hook>(hook: HookFnOrObject<T>): HookFnOrObject<T>; }` |
|
|
121
140
|
|
|
122
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#
|
|
141
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L52)
|
|
123
142
|
|
|
124
143
|
#### :gear: defineHook
|
|
125
144
|
|
|
@@ -127,7 +146,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
|
|
|
127
146
|
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
128
147
|
| `defineHook` | `{ <T extends Hook>(hook: T): T; <T extends Hook>(hook: HookFn<T>): HookFn<T>; <T extends Hook>(hook: HookFnOrObject<T>): HookFnOrObject<T>; }` |
|
|
129
148
|
|
|
130
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#
|
|
149
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L53)
|
|
131
150
|
|
|
132
151
|
#### :gear: defineHook
|
|
133
152
|
|
|
@@ -135,7 +154,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
|
|
|
135
154
|
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
136
155
|
| `defineHook` | `{ <T extends Hook>(hook: T): T; <T extends Hook>(hook: HookFn<T>): HookFn<T>; <T extends Hook>(hook: HookFnOrObject<T>): HookFnOrObject<T>; }` |
|
|
137
156
|
|
|
138
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#
|
|
157
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L54)
|
|
139
158
|
|
|
140
159
|
#### :gear: defineHook
|
|
141
160
|
|
|
@@ -143,7 +162,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
|
|
|
143
162
|
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
144
163
|
| `defineHook` | `{ <T extends Hook>(hook: T): T; <T extends Hook>(hook: HookFn<T>): HookFn<T>; <T extends Hook>(hook: HookFnOrObject<T>): HookFnOrObject<T>; }` |
|
|
145
164
|
|
|
146
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#
|
|
165
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L55)
|
|
147
166
|
|
|
148
167
|
#### :gear: setDocStore
|
|
149
168
|
|
|
@@ -151,16 +170,16 @@ Stores or updates a document in the datastore.
|
|
|
151
170
|
|
|
152
171
|
The data must have been encoded - using encodeDocData - before calling this function.
|
|
153
172
|
|
|
154
|
-
| Function | Type
|
|
155
|
-
| ------------- |
|
|
156
|
-
| `setDocStore` | `(params: { caller: Uint8Array<ArrayBufferLike
|
|
173
|
+
| Function | Type |
|
|
174
|
+
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
175
|
+
| `setDocStore` | `(params: { caller: Uint8Array<ArrayBufferLike> or Principal; collection: string; doc: { data: Uint8Array<ArrayBufferLike>; key: string; description?: string or undefined; version?: bigint or undefined; }; }) => void` |
|
|
157
176
|
|
|
158
177
|
Parameters:
|
|
159
178
|
|
|
160
179
|
- `params`: - The parameters required to store the document,
|
|
161
180
|
including the caller, collection, key, and document data.
|
|
162
181
|
|
|
163
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/db.sdk.ts#
|
|
182
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/db.sdk.ts#L15)
|
|
164
183
|
|
|
165
184
|
#### :gear: decodeDocData
|
|
166
185
|
|
|
@@ -190,6 +209,23 @@ Parameters:
|
|
|
190
209
|
|
|
191
210
|
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/serializer.sdk.ts#L21)
|
|
192
211
|
|
|
212
|
+
#### :gear: call
|
|
213
|
+
|
|
214
|
+
Makes an asynchronous call to a canister on the Internet Computer.
|
|
215
|
+
|
|
216
|
+
This function encodes the provided arguments using Candid, performs the canister call,
|
|
217
|
+
and decodes the response based on the expected result types.
|
|
218
|
+
|
|
219
|
+
| Function | Type |
|
|
220
|
+
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
221
|
+
| `call` | `<T>(params: { canisterId: Uint8Array<ArrayBufferLike> or Principal; method: string; args: [Type<unknown>, unknown][]; results: Type<unknown>[]; }) => Promise<T>` |
|
|
222
|
+
|
|
223
|
+
Parameters:
|
|
224
|
+
|
|
225
|
+
- `params`: - The parameters required for the canister call
|
|
226
|
+
|
|
227
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/call.ic-cdk.ts#L19)
|
|
228
|
+
|
|
193
229
|
#### :gear: id
|
|
194
230
|
|
|
195
231
|
Retrieves the Satellite's Principal ID.
|
|
@@ -207,14 +243,17 @@ the Principal of the executing canister.
|
|
|
207
243
|
### :wrench: Constants
|
|
208
244
|
|
|
209
245
|
- [CollectionsSchema](#gear-collectionsschema)
|
|
246
|
+
- [RawPrincipalSchema](#gear-rawprincipalschema)
|
|
247
|
+
- [PrincipalSchema](#gear-principalschema)
|
|
248
|
+
- [Uint8ArraySchema](#gear-uint8arrayschema)
|
|
210
249
|
- [TimestampSchema](#gear-timestampschema)
|
|
211
250
|
- [VersionSchema](#gear-versionschema)
|
|
212
|
-
- [RawDataSchema](#gear-rawdataschema)
|
|
213
|
-
- [RawPrincipalSchema](#gear-rawprincipalschema)
|
|
214
251
|
- [RawUserIdSchema](#gear-rawuseridschema)
|
|
252
|
+
- [UserIdSchema](#gear-useridschema)
|
|
215
253
|
- [CollectionSchema](#gear-collectionschema)
|
|
216
254
|
- [KeySchema](#gear-keyschema)
|
|
217
255
|
- [DocDescriptionSchema](#gear-docdescriptionschema)
|
|
256
|
+
- [RawDataSchema](#gear-rawdataschema)
|
|
218
257
|
- [DocSchema](#gear-docschema)
|
|
219
258
|
- [DocUpsertSchema](#gear-docupsertschema)
|
|
220
259
|
- [ProposedDocSchema](#gear-proposeddocschema)
|
|
@@ -228,6 +267,11 @@ the Principal of the executing canister.
|
|
|
228
267
|
- [HookSchema](#gear-hookschema)
|
|
229
268
|
- [SetDocSchema](#gear-setdocschema)
|
|
230
269
|
- [SetDocStoreParamsSchema](#gear-setdocstoreparamsschema)
|
|
270
|
+
- [IDLTypeSchema](#gear-idltypeschema)
|
|
271
|
+
- [CallArgSchema](#gear-callargschema)
|
|
272
|
+
- [CallArgsSchema](#gear-callargsschema)
|
|
273
|
+
- [CallResultsSchema](#gear-callresultsschema)
|
|
274
|
+
- [CallParamsSchema](#gear-callparamsschema)
|
|
231
275
|
|
|
232
276
|
#### :gear: CollectionsSchema
|
|
233
277
|
|
|
@@ -237,13 +281,39 @@ the Principal of the executing canister.
|
|
|
237
281
|
|
|
238
282
|
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/collections.ts#L6)
|
|
239
283
|
|
|
284
|
+
#### :gear: RawPrincipalSchema
|
|
285
|
+
|
|
286
|
+
| Constant | Type |
|
|
287
|
+
| -------------------- | ------------------------------------------------------------------------------- |
|
|
288
|
+
| `RawPrincipalSchema` | `ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>` |
|
|
289
|
+
|
|
290
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/candid.ts#L7)
|
|
291
|
+
|
|
292
|
+
#### :gear: PrincipalSchema
|
|
293
|
+
|
|
294
|
+
| Constant | Type |
|
|
295
|
+
| ----------------- | ------------------------------------------- |
|
|
296
|
+
| `PrincipalSchema` | `ZodType<Principal, ZodTypeDef, Principal>` |
|
|
297
|
+
|
|
298
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/candid.ts#L19)
|
|
299
|
+
|
|
300
|
+
#### :gear: Uint8ArraySchema
|
|
301
|
+
|
|
302
|
+
A schema that validates a value is an Uint8Array.
|
|
303
|
+
|
|
304
|
+
| Constant | Type |
|
|
305
|
+
| ------------------ | ------------------------------------------------------------------------------- |
|
|
306
|
+
| `Uint8ArraySchema` | `ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>` |
|
|
307
|
+
|
|
308
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/candid.ts#L31)
|
|
309
|
+
|
|
240
310
|
#### :gear: TimestampSchema
|
|
241
311
|
|
|
242
312
|
| Constant | Type |
|
|
243
313
|
| ----------------- | ----------- |
|
|
244
314
|
| `TimestampSchema` | `ZodBigInt` |
|
|
245
315
|
|
|
246
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/
|
|
316
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L7)
|
|
247
317
|
|
|
248
318
|
#### :gear: VersionSchema
|
|
249
319
|
|
|
@@ -251,23 +321,7 @@ the Principal of the executing canister.
|
|
|
251
321
|
| --------------- | ----------- |
|
|
252
322
|
| `VersionSchema` | `ZodBigInt` |
|
|
253
323
|
|
|
254
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/
|
|
255
|
-
|
|
256
|
-
#### :gear: RawDataSchema
|
|
257
|
-
|
|
258
|
-
| Constant | Type |
|
|
259
|
-
| --------------- | ------------------------------------------------------------------------------- |
|
|
260
|
-
| `RawDataSchema` | `ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>` |
|
|
261
|
-
|
|
262
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/core.ts#L30)
|
|
263
|
-
|
|
264
|
-
#### :gear: RawPrincipalSchema
|
|
265
|
-
|
|
266
|
-
| Constant | Type |
|
|
267
|
-
| -------------------- | ------------------------------------------------------------------------------- |
|
|
268
|
-
| `RawPrincipalSchema` | `ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>` |
|
|
269
|
-
|
|
270
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/core.ts#L44)
|
|
324
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L19)
|
|
271
325
|
|
|
272
326
|
#### :gear: RawUserIdSchema
|
|
273
327
|
|
|
@@ -275,7 +329,15 @@ the Principal of the executing canister.
|
|
|
275
329
|
| ----------------- | ------------------------------------------------------------------------------- |
|
|
276
330
|
| `RawUserIdSchema` | `ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>` |
|
|
277
331
|
|
|
278
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/
|
|
332
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L31)
|
|
333
|
+
|
|
334
|
+
#### :gear: UserIdSchema
|
|
335
|
+
|
|
336
|
+
| Constant | Type |
|
|
337
|
+
| -------------- | ------------------------------------------- |
|
|
338
|
+
| `UserIdSchema` | `ZodType<Principal, ZodTypeDef, Principal>` |
|
|
339
|
+
|
|
340
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L43)
|
|
279
341
|
|
|
280
342
|
#### :gear: CollectionSchema
|
|
281
343
|
|
|
@@ -283,7 +345,7 @@ the Principal of the executing canister.
|
|
|
283
345
|
| ------------------ | ----------- |
|
|
284
346
|
| `CollectionSchema` | `ZodString` |
|
|
285
347
|
|
|
286
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/
|
|
348
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L55)
|
|
287
349
|
|
|
288
350
|
#### :gear: KeySchema
|
|
289
351
|
|
|
@@ -291,7 +353,7 @@ the Principal of the executing canister.
|
|
|
291
353
|
| ----------- | ----------- |
|
|
292
354
|
| `KeySchema` | `ZodString` |
|
|
293
355
|
|
|
294
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/
|
|
356
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L65)
|
|
295
357
|
|
|
296
358
|
#### :gear: DocDescriptionSchema
|
|
297
359
|
|
|
@@ -299,7 +361,15 @@ the Principal of the executing canister.
|
|
|
299
361
|
| ---------------------- | ----------- |
|
|
300
362
|
| `DocDescriptionSchema` | `ZodString` |
|
|
301
363
|
|
|
302
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#
|
|
364
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L8)
|
|
365
|
+
|
|
366
|
+
#### :gear: RawDataSchema
|
|
367
|
+
|
|
368
|
+
| Constant | Type |
|
|
369
|
+
| --------------- | ------------------------------------------------------------------------------- |
|
|
370
|
+
| `RawDataSchema` | `ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>` |
|
|
371
|
+
|
|
372
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L18)
|
|
303
373
|
|
|
304
374
|
#### :gear: DocSchema
|
|
305
375
|
|
|
@@ -307,7 +377,7 @@ the Principal of the executing canister.
|
|
|
307
377
|
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
308
378
|
| `DocSchema` | `ZodObject<{ owner: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; ... 4 more ...; version: ZodOptional<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>` |
|
|
309
379
|
|
|
310
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#
|
|
380
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L30)
|
|
311
381
|
|
|
312
382
|
#### :gear: DocUpsertSchema
|
|
313
383
|
|
|
@@ -363,7 +433,7 @@ the Principal of the executing canister.
|
|
|
363
433
|
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
364
434
|
| `AssertSetDocSchema` | `ZodObject<extendShape<{ collections: ZodArray<ZodString, "many">; }, { assert: ZodFunction<ZodTuple<[ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; data: ZodObject<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>], ZodUnknown>, ZodVoid>; }>, "strict", ZodTypeAny, { ...; }, {...` |
|
|
365
435
|
|
|
366
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#
|
|
436
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L26)
|
|
367
437
|
|
|
368
438
|
#### :gear: AssertSchema
|
|
369
439
|
|
|
@@ -371,7 +441,7 @@ the Principal of the executing canister.
|
|
|
371
441
|
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
372
442
|
| `AssertSchema` | `ZodObject<extendShape<{ collections: ZodArray<ZodString, "many">; }, { assert: ZodFunction<ZodTuple<[ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; data: ZodObject<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>], ZodUnknown>, ZodVoid>; }>, "strict", ZodTypeAny, { ...; }, {...` |
|
|
373
443
|
|
|
374
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#
|
|
444
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L37)
|
|
375
445
|
|
|
376
446
|
#### :gear: OnSetDocSchema
|
|
377
447
|
|
|
@@ -379,7 +449,7 @@ the Principal of the executing canister.
|
|
|
379
449
|
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
380
450
|
| `OnSetDocSchema` | `ZodObject<extendShape<{ collections: ZodArray<ZodString, "many">; }, { run: ZodFunction<ZodTuple<[ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; data: ZodObject<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>], ZodUnknown>, ZodPromise<...>>; }>, "strict", ZodTypeAny, { ...;...` |
|
|
381
451
|
|
|
382
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#
|
|
452
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L26)
|
|
383
453
|
|
|
384
454
|
#### :gear: HookSchema
|
|
385
455
|
|
|
@@ -387,7 +457,7 @@ the Principal of the executing canister.
|
|
|
387
457
|
| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
388
458
|
| `HookSchema` | `ZodObject<extendShape<{ collections: ZodArray<ZodString, "many">; }, { run: ZodFunction<ZodTuple<[ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; data: ZodObject<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>], ZodUnknown>, ZodPromise<...>>; }>, "strict", ZodTypeAny, { ...;...` |
|
|
389
459
|
|
|
390
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#
|
|
460
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L37)
|
|
391
461
|
|
|
392
462
|
#### :gear: SetDocSchema
|
|
393
463
|
|
|
@@ -399,24 +469,74 @@ the Principal of the executing canister.
|
|
|
399
469
|
|
|
400
470
|
#### :gear: SetDocStoreParamsSchema
|
|
401
471
|
|
|
402
|
-
| Constant | Type
|
|
403
|
-
| ------------------------- |
|
|
404
|
-
| `SetDocStoreParamsSchema` | `ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike
|
|
472
|
+
| Constant | Type |
|
|
473
|
+
| ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
474
|
+
| `SetDocStoreParamsSchema` | `ZodObject<{ caller: ZodUnion<[ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>, ZodType<...>]>; collection: ZodString; doc: ZodObject<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>` |
|
|
405
475
|
|
|
406
476
|
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L49)
|
|
407
477
|
|
|
478
|
+
#### :gear: IDLTypeSchema
|
|
479
|
+
|
|
480
|
+
| Constant | Type |
|
|
481
|
+
| --------------- | --------------------------------------------------- |
|
|
482
|
+
| `IDLTypeSchema` | `ZodType<Type<unknown>, ZodTypeDef, Type<unknown>>` |
|
|
483
|
+
|
|
484
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L8)
|
|
485
|
+
|
|
486
|
+
#### :gear: CallArgSchema
|
|
487
|
+
|
|
488
|
+
| Constant | Type |
|
|
489
|
+
| --------------- | --------------------------------------------------------------------------------- |
|
|
490
|
+
| `CallArgSchema` | `ZodTuple<[ZodType<Type<unknown>, ZodTypeDef, Type<unknown>>, ZodUnknown], null>` |
|
|
491
|
+
|
|
492
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L20)
|
|
493
|
+
|
|
494
|
+
#### :gear: CallArgsSchema
|
|
495
|
+
|
|
496
|
+
Schema for encoding the call arguments.
|
|
497
|
+
|
|
498
|
+
| Constant | Type |
|
|
499
|
+
| ---------------- | --------------------------------------------------------------------------------------------------- |
|
|
500
|
+
| `CallArgsSchema` | `ZodArray<ZodTuple<[ZodType<Type<unknown>, ZodTypeDef, Type<unknown>>, ZodUnknown], null>, "many">` |
|
|
501
|
+
|
|
502
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L32)
|
|
503
|
+
|
|
504
|
+
#### :gear: CallResultsSchema
|
|
505
|
+
|
|
506
|
+
| Constant | Type |
|
|
507
|
+
| ------------------- | --------------------------------------------------------------------- |
|
|
508
|
+
| `CallResultsSchema` | `ZodArray<ZodType<Type<unknown>, ZodTypeDef, Type<unknown>>, "many">` |
|
|
509
|
+
|
|
510
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L48)
|
|
511
|
+
|
|
512
|
+
#### :gear: CallParamsSchema
|
|
513
|
+
|
|
514
|
+
| Constant | Type |
|
|
515
|
+
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
516
|
+
| `CallParamsSchema` | `ZodObject<{ canisterId: ZodUnion<[ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>, ZodType<...>]>; method: ZodString; args: ZodArray<...>; results: ZodArray<...>; }, "strip", ZodTypeAny, { ...; }, { ...; }>` |
|
|
517
|
+
|
|
518
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L58)
|
|
519
|
+
|
|
520
|
+
### :factory: CallResponseLengthError
|
|
521
|
+
|
|
522
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/types/errors.ts#L1)
|
|
523
|
+
|
|
408
524
|
### :cocktail: Types
|
|
409
525
|
|
|
410
526
|
- [Collections](#gear-collections)
|
|
527
|
+
- [RawPrincipal](#gear-rawprincipal)
|
|
528
|
+
- [Principal](#gear-principal)
|
|
411
529
|
- [Timestamp](#gear-timestamp)
|
|
412
530
|
- [Version](#gear-version)
|
|
413
|
-
- [RawData](#gear-rawdata)
|
|
414
|
-
- [RawPrincipal](#gear-rawprincipal)
|
|
415
531
|
- [RawUserId](#gear-rawuserid)
|
|
532
|
+
- [UserId](#gear-userid)
|
|
416
533
|
- [Collection](#gear-collection)
|
|
417
534
|
- [Key](#gear-key)
|
|
418
535
|
- [HookContext](#gear-hookcontext)
|
|
536
|
+
- [AssertFunction](#gear-assertfunction)
|
|
537
|
+
- [RunFunction](#gear-runfunction)
|
|
419
538
|
- [DocDescription](#gear-docdescription)
|
|
539
|
+
- [RawData](#gear-rawdata)
|
|
420
540
|
- [Doc](#gear-doc)
|
|
421
541
|
- [DocUpsert](#gear-docupsert)
|
|
422
542
|
- [ProposedDoc](#gear-proposeddoc)
|
|
@@ -435,6 +555,11 @@ the Principal of the executing canister.
|
|
|
435
555
|
- [HookFnOrObject](#gear-hookfnorobject)
|
|
436
556
|
- [SetDoc](#gear-setdoc)
|
|
437
557
|
- [SetDocStoreParams](#gear-setdocstoreparams)
|
|
558
|
+
- [IDLType](#gear-idltype)
|
|
559
|
+
- [CallArg](#gear-callarg)
|
|
560
|
+
- [CallArgs](#gear-callargs)
|
|
561
|
+
- [CallResults](#gear-callresults)
|
|
562
|
+
- [CallParams](#gear-callparams)
|
|
438
563
|
|
|
439
564
|
#### :gear: Collections
|
|
440
565
|
|
|
@@ -446,6 +571,26 @@ Defines the collections where a hook or assertion should run.
|
|
|
446
571
|
|
|
447
572
|
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/collections.ts#L18)
|
|
448
573
|
|
|
574
|
+
#### :gear: RawPrincipal
|
|
575
|
+
|
|
576
|
+
Represents a raw principal - a Uint8Array representation of a Principal.
|
|
577
|
+
|
|
578
|
+
| Type | Type |
|
|
579
|
+
| -------------- | ------------------------------------ |
|
|
580
|
+
| `RawPrincipal` | `z.infer<typeof RawPrincipalSchema>` |
|
|
581
|
+
|
|
582
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/candid.ts#L14)
|
|
583
|
+
|
|
584
|
+
#### :gear: Principal
|
|
585
|
+
|
|
586
|
+
Represents a principal - i.e. an object instantiated with the class Principal.
|
|
587
|
+
|
|
588
|
+
| Type | Type |
|
|
589
|
+
| ----------- | --------------------------------- |
|
|
590
|
+
| `Principal` | `z.infer<typeof PrincipalSchema>` |
|
|
591
|
+
|
|
592
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/candid.ts#L26)
|
|
593
|
+
|
|
449
594
|
#### :gear: Timestamp
|
|
450
595
|
|
|
451
596
|
Represents a timestamp in nanoseconds since the Unix epoch.
|
|
@@ -456,7 +601,7 @@ Used for tracking when events occur, such as document creation and updates.
|
|
|
456
601
|
| ----------- | --------------------------------- |
|
|
457
602
|
| `Timestamp` | `z.infer<typeof TimestampSchema>` |
|
|
458
603
|
|
|
459
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/
|
|
604
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L14)
|
|
460
605
|
|
|
461
606
|
#### :gear: Version
|
|
462
607
|
|
|
@@ -468,31 +613,7 @@ This is typically incremented with each update to ensure consistency.
|
|
|
468
613
|
| --------- | ------------------------------- |
|
|
469
614
|
| `Version` | `z.infer<typeof VersionSchema>` |
|
|
470
615
|
|
|
471
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/
|
|
472
|
-
|
|
473
|
-
#### :gear: RawData
|
|
474
|
-
|
|
475
|
-
Represents raw binary data.
|
|
476
|
-
|
|
477
|
-
This is used to store unstructured data in a document.
|
|
478
|
-
|
|
479
|
-
| Type | Type |
|
|
480
|
-
| --------- | ------------------------------- |
|
|
481
|
-
| `RawData` | `z.infer<typeof RawDataSchema>` |
|
|
482
|
-
|
|
483
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/core.ts#L39)
|
|
484
|
-
|
|
485
|
-
#### :gear: RawPrincipal
|
|
486
|
-
|
|
487
|
-
Represents a raw principal identifier.
|
|
488
|
-
|
|
489
|
-
Principals are unique identities used in authentication and authorization.
|
|
490
|
-
|
|
491
|
-
| Type | Type |
|
|
492
|
-
| -------------- | ------------------------------------ |
|
|
493
|
-
| `RawPrincipal` | `z.infer<typeof RawPrincipalSchema>` |
|
|
494
|
-
|
|
495
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/core.ts#L53)
|
|
616
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L26)
|
|
496
617
|
|
|
497
618
|
#### :gear: RawUserId
|
|
498
619
|
|
|
@@ -504,7 +625,19 @@ This is a principal associated with a user.
|
|
|
504
625
|
| ----------- | --------------------------------- |
|
|
505
626
|
| `RawUserId` | `z.infer<typeof RawUserIdSchema>` |
|
|
506
627
|
|
|
507
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/
|
|
628
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L38)
|
|
629
|
+
|
|
630
|
+
#### :gear: UserId
|
|
631
|
+
|
|
632
|
+
Represents a user identifier.
|
|
633
|
+
|
|
634
|
+
This is a principal associated with a user.
|
|
635
|
+
|
|
636
|
+
| Type | Type |
|
|
637
|
+
| -------- | ------------------------------ |
|
|
638
|
+
| `UserId` | `z.infer<typeof UserIdSchema>` |
|
|
639
|
+
|
|
640
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L50)
|
|
508
641
|
|
|
509
642
|
#### :gear: Collection
|
|
510
643
|
|
|
@@ -514,7 +647,7 @@ A collection name where data are stored.
|
|
|
514
647
|
| ------------ | ---------------------------------- |
|
|
515
648
|
| `Collection` | `z.infer<typeof CollectionSchema>` |
|
|
516
649
|
|
|
517
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/
|
|
650
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L60)
|
|
518
651
|
|
|
519
652
|
#### :gear: Key
|
|
520
653
|
|
|
@@ -524,7 +657,7 @@ A unique key identifier within a collection.
|
|
|
524
657
|
| ----- | --------------------------- |
|
|
525
658
|
| `Key` | `z.infer<typeof KeySchema>` |
|
|
526
659
|
|
|
527
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/
|
|
660
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L70)
|
|
528
661
|
|
|
529
662
|
#### :gear: HookContext
|
|
530
663
|
|
|
@@ -536,6 +669,30 @@ Represents the context provided to hooks, containing information about the calle
|
|
|
536
669
|
|
|
537
670
|
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/context.ts#L27)
|
|
538
671
|
|
|
672
|
+
#### :gear: AssertFunction
|
|
673
|
+
|
|
674
|
+
Defines the `assert` function schema for assertions.
|
|
675
|
+
|
|
676
|
+
The function takes a context argument and returns `void`.
|
|
677
|
+
|
|
678
|
+
| Type | Type |
|
|
679
|
+
| ---------------- | ---------------------------------------------------------------- |
|
|
680
|
+
| `AssertFunction` | `z.infer<ReturnType<typeof AssertFunctionSchema<z.ZodType<T>>>>` |
|
|
681
|
+
|
|
682
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/context.ts#L42)
|
|
683
|
+
|
|
684
|
+
#### :gear: RunFunction
|
|
685
|
+
|
|
686
|
+
Defines the `run` function schema for hooks.
|
|
687
|
+
|
|
688
|
+
The function takes a context argument and returns a `Promise<void>`.
|
|
689
|
+
|
|
690
|
+
| Type | Type |
|
|
691
|
+
| ------------- | ------------------------------------------------------------- |
|
|
692
|
+
| `RunFunction` | `z.infer<ReturnType<typeof RunFunctionSchema<z.ZodType<T>>>>` |
|
|
693
|
+
|
|
694
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/context.ts#L57)
|
|
695
|
+
|
|
539
696
|
#### :gear: DocDescription
|
|
540
697
|
|
|
541
698
|
Represents a document description with a maximum length of 1024 characters.
|
|
@@ -544,7 +701,19 @@ Represents a document description with a maximum length of 1024 characters.
|
|
|
544
701
|
| ---------------- | -------------------------------------- |
|
|
545
702
|
| `DocDescription` | `z.infer<typeof DocDescriptionSchema>` |
|
|
546
703
|
|
|
547
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#
|
|
704
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L13)
|
|
705
|
+
|
|
706
|
+
#### :gear: RawData
|
|
707
|
+
|
|
708
|
+
Represents raw binary data.
|
|
709
|
+
|
|
710
|
+
This is used to store structured data in a document.
|
|
711
|
+
|
|
712
|
+
| Type | Type |
|
|
713
|
+
| --------- | ---------------------------------- |
|
|
714
|
+
| `RawData` | `z.infer<typeof Uint8ArraySchema>` |
|
|
715
|
+
|
|
716
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L25)
|
|
548
717
|
|
|
549
718
|
#### :gear: Doc
|
|
550
719
|
|
|
@@ -554,7 +723,7 @@ Represents a document stored in a collection.
|
|
|
554
723
|
| ----- | --------------------------- |
|
|
555
724
|
| `Doc` | `z.infer<typeof DocSchema>` |
|
|
556
725
|
|
|
557
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#
|
|
726
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L68)
|
|
558
727
|
|
|
559
728
|
#### :gear: DocUpsert
|
|
560
729
|
|
|
@@ -651,7 +820,7 @@ An assertion that runs when a document is created or updated.
|
|
|
651
820
|
| -------------- | ------------------------------------ |
|
|
652
821
|
| `AssertSetDoc` | `z.infer<typeof AssertSetDocSchema>` |
|
|
653
822
|
|
|
654
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#
|
|
823
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L31)
|
|
655
824
|
|
|
656
825
|
#### :gear: Assert
|
|
657
826
|
|
|
@@ -661,7 +830,7 @@ All assertions definitions.
|
|
|
661
830
|
| -------- | ------------------------------ |
|
|
662
831
|
| `Assert` | `z.infer<typeof AssertSchema>` |
|
|
663
832
|
|
|
664
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#
|
|
833
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L42)
|
|
665
834
|
|
|
666
835
|
#### :gear: AssertFn
|
|
667
836
|
|
|
@@ -669,7 +838,7 @@ All assertions definitions.
|
|
|
669
838
|
| ---------- | --------------------------------------------------- |
|
|
670
839
|
| `AssertFn` | `(assert: z.infer<typeof SatelliteEnvSchema>) => T` |
|
|
671
840
|
|
|
672
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#
|
|
841
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L46)
|
|
673
842
|
|
|
674
843
|
#### :gear: AssertFnOrObject
|
|
675
844
|
|
|
@@ -677,7 +846,7 @@ All assertions definitions.
|
|
|
677
846
|
| ------------------ | ------------------ |
|
|
678
847
|
| `AssertFnOrObject` | `T or AssertFn<T>` |
|
|
679
848
|
|
|
680
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#
|
|
849
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L50)
|
|
681
850
|
|
|
682
851
|
#### :gear: OnSetDoc
|
|
683
852
|
|
|
@@ -687,7 +856,7 @@ A hook that runs when a document is created or updated.
|
|
|
687
856
|
| ---------- | -------------------------------- |
|
|
688
857
|
| `OnSetDoc` | `z.infer<typeof OnSetDocSchema>` |
|
|
689
858
|
|
|
690
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#
|
|
859
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L31)
|
|
691
860
|
|
|
692
861
|
#### :gear: Hook
|
|
693
862
|
|
|
@@ -697,7 +866,7 @@ All hooks definitions.
|
|
|
697
866
|
| ------ | ---------------------------- |
|
|
698
867
|
| `Hook` | `z.infer<typeof HookSchema>` |
|
|
699
868
|
|
|
700
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#
|
|
869
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L42)
|
|
701
870
|
|
|
702
871
|
#### :gear: HookFn
|
|
703
872
|
|
|
@@ -705,7 +874,7 @@ All hooks definitions.
|
|
|
705
874
|
| -------- | ------------------------------------------------- |
|
|
706
875
|
| `HookFn` | `(hook: z.infer<typeof SatelliteEnvSchema>) => T` |
|
|
707
876
|
|
|
708
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#
|
|
877
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L46)
|
|
709
878
|
|
|
710
879
|
#### :gear: HookFnOrObject
|
|
711
880
|
|
|
@@ -713,7 +882,7 @@ All hooks definitions.
|
|
|
713
882
|
| ---------------- | ---------------- |
|
|
714
883
|
| `HookFnOrObject` | `T or HookFn<T>` |
|
|
715
884
|
|
|
716
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#
|
|
885
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L50)
|
|
717
886
|
|
|
718
887
|
#### :gear: SetDoc
|
|
719
888
|
|
|
@@ -740,6 +909,62 @@ collection, and key.
|
|
|
740
909
|
|
|
741
910
|
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L74)
|
|
742
911
|
|
|
912
|
+
#### :gear: IDLType
|
|
913
|
+
|
|
914
|
+
Custom validation function to verify if a value is an instance of `IDL.Type` from `@dfinity/candid`.
|
|
915
|
+
|
|
916
|
+
| Type | Type |
|
|
917
|
+
| --------- | ------------------------------- |
|
|
918
|
+
| `IDLType` | `z.infer<typeof IDLTypeSchema>` |
|
|
919
|
+
|
|
920
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L15)
|
|
921
|
+
|
|
922
|
+
#### :gear: CallArg
|
|
923
|
+
|
|
924
|
+
A call argument consisting of its IDL type and corresponding value.
|
|
925
|
+
|
|
926
|
+
| Type | Type |
|
|
927
|
+
| --------- | ------------------------------- |
|
|
928
|
+
| `CallArg` | `z.infer<typeof CallArgSchema>` |
|
|
929
|
+
|
|
930
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L25)
|
|
931
|
+
|
|
932
|
+
#### :gear: CallArgs
|
|
933
|
+
|
|
934
|
+
Represents the arguments for a canister call on the IC.
|
|
935
|
+
|
|
936
|
+
Requests and responses on the IC are encoded using Candid.
|
|
937
|
+
This schema ensures that each argument is provided with both its type and value
|
|
938
|
+
for proper encoding.
|
|
939
|
+
|
|
940
|
+
The order of arguments is preserved for the function call.
|
|
941
|
+
|
|
942
|
+
| Type | Type |
|
|
943
|
+
| ---------- | -------------------------------- |
|
|
944
|
+
| `CallArgs` | `z.infer<typeof CallArgsSchema>` |
|
|
945
|
+
|
|
946
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L43)
|
|
947
|
+
|
|
948
|
+
#### :gear: CallResults
|
|
949
|
+
|
|
950
|
+
Defines the types used to decode the results of a canister call.
|
|
951
|
+
|
|
952
|
+
| Type | Type |
|
|
953
|
+
| ------------- | ----------------------------------- |
|
|
954
|
+
| `CallResults` | `z.infer<typeof CallResultsSchema>` |
|
|
955
|
+
|
|
956
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L53)
|
|
957
|
+
|
|
958
|
+
#### :gear: CallParams
|
|
959
|
+
|
|
960
|
+
Type representing the parameters required to make a canister call.
|
|
961
|
+
|
|
962
|
+
| Type | Type |
|
|
963
|
+
| ------------ | ---------------------------------- |
|
|
964
|
+
| `CallParams` | `z.infer<typeof CallParamsSchema>` |
|
|
965
|
+
|
|
966
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L83)
|
|
967
|
+
|
|
743
968
|
<!-- TSDOC_END -->
|
|
744
969
|
|
|
745
970
|
## License
|