@junobuild/functions 0.0.12 → 0.0.13-next-2025-04-01

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 CHANGED
@@ -30,7 +30,13 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
30
30
  - [defineHook](#gear-definehook)
31
31
  - [defineHook](#gear-definehook)
32
32
  - [defineHook](#gear-definehook)
33
+ - [normalizeCaller](#gear-normalizecaller)
34
+ - [getAdminControllers](#gear-getadmincontrollers)
35
+ - [getControllers](#gear-getcontrollers)
36
+ - [isAdminController](#gear-isadmincontroller)
37
+ - [isController](#gear-iscontroller)
33
38
  - [setDocStore](#gear-setdocstore)
39
+ - [deleteDocStore](#gear-deletedocstore)
34
40
  - [decodeDocData](#gear-decodedocdata)
35
41
  - [encodeDocData](#gear-encodedocdata)
36
42
  - [call](#gear-call)
@@ -50,7 +56,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
50
56
  | ---------------------- | ----------------------------------------------------------------------------------------------- |
51
57
  | `AssertFunctionSchema` | `<T extends z.ZodTypeAny>(contextSchema: T) => ZodFunction<ZodTuple<[T], ZodUnknown>, ZodVoid>` |
52
58
 
53
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/context.ts#L41)
59
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/context.ts#L44)
54
60
 
55
61
  #### :gear: RunFunctionSchema
56
62
 
@@ -58,7 +64,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
58
64
  | ------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
59
65
  | `RunFunctionSchema` | `<T extends z.ZodTypeAny>(contextSchema: T) => ZodFunction<ZodTuple<[T], ZodUnknown>, ZodUnion<[ZodPromise<ZodVoid>, ZodVoid]>>` |
60
66
 
61
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/context.ts#L56)
67
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/context.ts#L59)
62
68
 
63
69
  #### :gear: DocContextSchema
64
70
 
@@ -66,7 +72,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
66
72
  | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
67
73
  | `DocContextSchema` | `<T extends z.ZodTypeAny>(dataSchema: T) => ZodObject<typeof schemaShape, "strict", ZodTypeAny, baseObjectOutputType<typeof schemaShape>, baseObjectInputType<typeof schemaShape>>` |
68
74
 
69
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L10)
75
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L18)
70
76
 
71
77
  #### :gear: AssertFnSchema
72
78
 
@@ -74,7 +80,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
74
80
  | ---------------- | ----------------------------------------------------------------------------------------------------------------------- |
75
81
  | `AssertFnSchema` | `<T extends z.ZodTypeAny>(assertSchema: T) => ZodFunction<ZodTuple<[ZodRecord<ZodString, ZodUnknown>], ZodUnknown>, T>` |
76
82
 
77
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L44)
83
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L96)
78
84
 
79
85
  #### :gear: AssertFnOrObjectSchema
80
86
 
@@ -82,7 +88,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
82
88
  | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------- |
83
89
  | `AssertFnOrObjectSchema` | `<T extends z.ZodTypeAny>(assertSchema: T) => ZodUnion<[T, ZodFunction<ZodTuple<[ZodRecord<ZodString, ZodUnknown>], ZodUnknown>, T>]>` |
84
90
 
85
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L48)
91
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L100)
86
92
 
87
93
  #### :gear: defineAssert
88
94
 
@@ -90,7 +96,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
90
96
  | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
91
97
  | `defineAssert` | `{ <T extends Assert>(assert: T): T; <T extends Assert>(assert: AssertFn<T>): AssertFn<T>; <T extends Assert>(assert: AssertFnOrObject<T>): AssertFnOrObject<T>; }` |
92
98
 
93
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L52)
99
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L104)
94
100
 
95
101
  #### :gear: defineAssert
96
102
 
@@ -98,7 +104,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
98
104
  | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
99
105
  | `defineAssert` | `{ <T extends Assert>(assert: T): T; <T extends Assert>(assert: AssertFn<T>): AssertFn<T>; <T extends Assert>(assert: AssertFnOrObject<T>): AssertFnOrObject<T>; }` |
100
106
 
101
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L53)
107
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L105)
102
108
 
103
109
  #### :gear: defineAssert
104
110
 
@@ -106,7 +112,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
106
112
  | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
107
113
  | `defineAssert` | `{ <T extends Assert>(assert: T): T; <T extends Assert>(assert: AssertFn<T>): AssertFn<T>; <T extends Assert>(assert: AssertFnOrObject<T>): AssertFnOrObject<T>; }` |
108
114
 
109
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L54)
115
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L106)
110
116
 
111
117
  #### :gear: defineAssert
112
118
 
@@ -114,7 +120,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
114
120
  | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
115
121
  | `defineAssert` | `{ <T extends Assert>(assert: T): T; <T extends Assert>(assert: AssertFn<T>): AssertFn<T>; <T extends Assert>(assert: AssertFnOrObject<T>): AssertFnOrObject<T>; }` |
116
122
 
117
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L55)
123
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L107)
118
124
 
119
125
  #### :gear: HookFnSchema
120
126
 
@@ -122,7 +128,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
122
128
  | -------------- | --------------------------------------------------------------------------------------------------------------------- |
123
129
  | `HookFnSchema` | `<T extends z.ZodTypeAny>(hookSchema: T) => ZodFunction<ZodTuple<[ZodRecord<ZodString, ZodUnknown>], ZodUnknown>, T>` |
124
130
 
125
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L44)
131
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L170)
126
132
 
127
133
  #### :gear: HookFnOrObjectSchema
128
134
 
@@ -130,7 +136,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
130
136
  | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
131
137
  | `HookFnOrObjectSchema` | `<T extends z.ZodTypeAny>(hookSchema: T) => ZodUnion<[T, ZodFunction<ZodTuple<[ZodRecord<ZodString, ZodUnknown>], ZodUnknown>, T>]>` |
132
138
 
133
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L48)
139
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L174)
134
140
 
135
141
  #### :gear: defineHook
136
142
 
@@ -138,7 +144,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
138
144
  | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
139
145
  | `defineHook` | `{ <T extends Hook>(hook: T): T; <T extends Hook>(hook: HookFn<T>): HookFn<T>; <T extends Hook>(hook: HookFnOrObject<T>): HookFnOrObject<T>; }` |
140
146
 
141
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L52)
147
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L178)
142
148
 
143
149
  #### :gear: defineHook
144
150
 
@@ -146,7 +152,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
146
152
  | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
147
153
  | `defineHook` | `{ <T extends Hook>(hook: T): T; <T extends Hook>(hook: HookFn<T>): HookFn<T>; <T extends Hook>(hook: HookFnOrObject<T>): HookFnOrObject<T>; }` |
148
154
 
149
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L53)
155
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L179)
150
156
 
151
157
  #### :gear: defineHook
152
158
 
@@ -154,7 +160,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
154
160
  | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
155
161
  | `defineHook` | `{ <T extends Hook>(hook: T): T; <T extends Hook>(hook: HookFn<T>): HookFn<T>; <T extends Hook>(hook: HookFnOrObject<T>): HookFnOrObject<T>; }` |
156
162
 
157
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L54)
163
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L180)
158
164
 
159
165
  #### :gear: defineHook
160
166
 
@@ -162,7 +168,72 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
162
168
  | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
163
169
  | `defineHook` | `{ <T extends Hook>(hook: T): T; <T extends Hook>(hook: HookFn<T>): HookFn<T>; <T extends Hook>(hook: HookFnOrObject<T>): HookFnOrObject<T>; }` |
164
170
 
165
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L55)
171
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L181)
172
+
173
+ #### :gear: normalizeCaller
174
+
175
+ Normalizes a user ID into a raw `Uint8Array` representation.
176
+
177
+ | Function | Type |
178
+ | ----------------- | ----------------------------------------------------------------------------------- |
179
+ | `normalizeCaller` | `(caller: Uint8Array<ArrayBufferLike> or Principal) => Uint8Array<ArrayBufferLike>` |
180
+
181
+ Parameters:
182
+
183
+ - `caller`: - The caller identity, either a raw `Uint8Array`
184
+ or a `Principal` instance.
185
+
186
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/utils/caller.utils.ts#L12)
187
+
188
+ #### :gear: getAdminControllers
189
+
190
+ Gets the list of admin controllers from the Satellite.
191
+
192
+ | Function | Type |
193
+ | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
194
+ | `getAdminControllers` | `() => [Uint8Array<ArrayBufferLike>, { created_at: bigint; updated_at: bigint; metadata: [string, string][]; scope: "write" or "admin"; expires_at?: bigint or undefined; }][]` |
195
+
196
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/controllers.sdk.ts#L15)
197
+
198
+ #### :gear: getControllers
199
+
200
+ Gets the list of controllers from the Satellite.
201
+
202
+ | Function | Type |
203
+ | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
204
+ | `getControllers` | `() => [Uint8Array<ArrayBufferLike>, { created_at: bigint; updated_at: bigint; metadata: [string, string][]; scope: "write" or "admin"; expires_at?: bigint or undefined; }][]` |
205
+
206
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/controllers.sdk.ts#L25)
207
+
208
+ #### :gear: isAdminController
209
+
210
+ Checks if the given caller is an admin among the provided controllers.
211
+
212
+ | Function | Type |
213
+ | ------------------- | -------------------------------------------- |
214
+ | `isAdminController` | `(params: ControllerCheckParams) => boolean` |
215
+
216
+ Parameters:
217
+
218
+ - `params`: - The parameters including the caller identity
219
+ and the list of controllers to verify against.
220
+
221
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/controllers.sdk.ts#L37)
222
+
223
+ #### :gear: isController
224
+
225
+ Checks if the given caller exists among the provided controllers.
226
+
227
+ | Function | Type |
228
+ | -------------- | -------------------------------------------- |
229
+ | `isController` | `(params: ControllerCheckParams) => boolean` |
230
+
231
+ Parameters:
232
+
233
+ - `params`: - The parameters including the caller identity
234
+ and the list of controllers to verify against.
235
+
236
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/controllers.sdk.ts#L57)
166
237
 
167
238
  #### :gear: setDocStore
168
239
 
@@ -170,16 +241,31 @@ Stores or updates a document in the datastore.
170
241
 
171
242
  The data must have been encoded - using encodeDocData - before calling this function.
172
243
 
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` |
244
+ | Function | Type |
245
+ | ------------- | ------------------------------------- |
246
+ | `setDocStore` | `(params: SetDocStoreParams) => void` |
176
247
 
177
248
  Parameters:
178
249
 
179
250
  - `params`: - The parameters required to store the document,
180
251
  including the caller, collection, key, and document data.
181
252
 
182
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/db.sdk.ts#L15)
253
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/db.sdk.ts#L20)
254
+
255
+ #### :gear: deleteDocStore
256
+
257
+ Delete a document in the datastore.
258
+
259
+ | Function | Type |
260
+ | ---------------- | ---------------------------------------- |
261
+ | `deleteDocStore` | `(params: DeleteDocStoreParams) => void` |
262
+
263
+ Parameters:
264
+
265
+ - `params`: - The parameters required to delete the document,
266
+ including the caller, collection, key, and version of the document.
267
+
268
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/db.sdk.ts#L39)
183
269
 
184
270
  #### :gear: decodeDocData
185
271
 
@@ -216,9 +302,9 @@ Makes an asynchronous call to a canister on the Internet Computer.
216
302
  This function encodes the provided arguments using Candid, performs the canister call,
217
303
  and decodes the response based on the expected result types.
218
304
 
219
- | Function | Type |
220
- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
221
- | `call` | `<T>(params: { canisterId: Uint8Array<ArrayBufferLike> or Principal; method: string; args?: [Type<unknown>, unknown][] or undefined; result?: Type<unknown> or undefined; }) => Promise<...>` |
305
+ | Function | Type |
306
+ | -------- | --------------------------------------- |
307
+ | `call` | `<T>(params: CallParams) => Promise<T>` |
222
308
 
223
309
  Parameters:
224
310
 
@@ -242,7 +328,6 @@ the Principal of the executing canister.
242
328
 
243
329
  ### :wrench: Constants
244
330
 
245
- - [CollectionsSchema](#gear-collectionsschema)
246
331
  - [Uint8ArraySchema](#gear-uint8arrayschema)
247
332
  - [RawPrincipalSchema](#gear-rawprincipalschema)
248
333
  - [PrincipalSchema](#gear-principalschema)
@@ -252,35 +337,63 @@ the Principal of the executing canister.
252
337
  - [UserIdSchema](#gear-useridschema)
253
338
  - [CollectionSchema](#gear-collectionschema)
254
339
  - [KeySchema](#gear-keyschema)
255
- - [DocDescriptionSchema](#gear-docdescriptionschema)
340
+ - [DescriptionSchema](#gear-descriptionschema)
341
+ - [CollectionsSchema](#gear-collectionsschema)
256
342
  - [RawDataSchema](#gear-rawdataschema)
257
343
  - [DocSchema](#gear-docschema)
344
+ - [OptionDocSchema](#gear-optiondocschema)
345
+ - [SetDocSchema](#gear-setdocschema)
346
+ - [DelDocSchema](#gear-deldocschema)
258
347
  - [DocUpsertSchema](#gear-docupsertschema)
259
- - [ProposedDocSchema](#gear-proposeddocschema)
260
348
  - [DocAssertSetSchema](#gear-docassertsetschema)
349
+ - [DocAssertDeleteSchema](#gear-docassertdeleteschema)
261
350
  - [OnSetDocContextSchema](#gear-onsetdoccontextschema)
351
+ - [OnSetManyDocsContextSchema](#gear-onsetmanydocscontextschema)
352
+ - [OnDeleteDocContextSchema](#gear-ondeletedoccontextschema)
353
+ - [OnDeleteManyDocsContextSchema](#gear-ondeletemanydocscontextschema)
354
+ - [OnDeleteFilteredDocsContextSchema](#gear-ondeletefiltereddocscontextschema)
262
355
  - [AssertSetDocContextSchema](#gear-assertsetdoccontextschema)
356
+ - [AssertDeleteDocContextSchema](#gear-assertdeletedoccontextschema)
263
357
  - [SatelliteEnvSchema](#gear-satelliteenvschema)
358
+ - [AssetSchema](#gear-assetschema)
359
+ - [BatchSchema](#gear-batchschema)
360
+ - [CommitBatchSchema](#gear-commitbatchschema)
361
+ - [AssetAssertUploadSchema](#gear-assetassertuploadschema)
362
+ - [OnUploadAssetContextSchema](#gear-onuploadassetcontextschema)
363
+ - [OnDeleteAssetContextSchema](#gear-ondeleteassetcontextschema)
364
+ - [OnDeleteManyAssetsContextSchema](#gear-ondeletemanyassetscontextschema)
365
+ - [OnDeleteFilteredAssetsContextSchema](#gear-ondeletefilteredassetscontextschema)
366
+ - [AssertUploadAssetContextSchema](#gear-assertuploadassetcontextschema)
367
+ - [AssertDeleteAssetContextSchema](#gear-assertdeleteassetcontextschema)
264
368
  - [AssertSetDocSchema](#gear-assertsetdocschema)
369
+ - [AssertDeleteDocSchema](#gear-assertdeletedocschema)
370
+ - [AssertUploadAssetSchema](#gear-assertuploadassetschema)
371
+ - [AssertDeleteAssetSchema](#gear-assertdeleteassetschema)
265
372
  - [AssertSchema](#gear-assertschema)
266
373
  - [OnSetDocSchema](#gear-onsetdocschema)
374
+ - [OnSetManyDocsSchema](#gear-onsetmanydocsschema)
375
+ - [OnDeleteDocSchema](#gear-ondeletedocschema)
376
+ - [OnDeleteManyDocsSchema](#gear-ondeletemanydocsschema)
377
+ - [OnDeleteFilteredDocsSchema](#gear-ondeletefiltereddocsschema)
378
+ - [OnUploadAssetSchema](#gear-onuploadassetschema)
379
+ - [OnDeleteAssetSchema](#gear-ondeleteassetschema)
380
+ - [OnDeleteManyAssetsSchema](#gear-ondeletemanyassetsschema)
381
+ - [OnDeleteFilteredAssetsSchema](#gear-ondeletefilteredassetsschema)
267
382
  - [HookSchema](#gear-hookschema)
268
- - [SetDocSchema](#gear-setdocschema)
383
+ - [ControllerScopeSchema](#gear-controllerscopeschema)
384
+ - [MetadataSchema](#gear-metadataschema)
385
+ - [ControllerSchema](#gear-controllerschema)
386
+ - [ControllerRecordSchema](#gear-controllerrecordschema)
387
+ - [ControllersSchema](#gear-controllersschema)
388
+ - [ControllerCheckParamsSchema](#gear-controllercheckparamsschema)
269
389
  - [SetDocStoreParamsSchema](#gear-setdocstoreparamsschema)
390
+ - [DeleteDocStoreParamsSchema](#gear-deletedocstoreparamsschema)
270
391
  - [IDLTypeSchema](#gear-idltypeschema)
271
392
  - [CallArgSchema](#gear-callargschema)
272
393
  - [CallArgsSchema](#gear-callargsschema)
273
394
  - [CallResultSchema](#gear-callresultschema)
274
395
  - [CallParamsSchema](#gear-callparamsschema)
275
396
 
276
- #### :gear: CollectionsSchema
277
-
278
- | Constant | Type |
279
- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
280
- | `CollectionsSchema` | `ZodObject<{ collections: ZodReadonly<ZodArray<ZodString, "many">>; }, "strict", ZodTypeAny, { collections: readonly string[]; }, { collections: readonly string[]; }>` |
281
-
282
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/collections.ts#L6)
283
-
284
397
  #### :gear: Uint8ArraySchema
285
398
 
286
399
  A schema that validates a value is an Uint8Array.
@@ -355,13 +468,21 @@ A schema that validates a value is an Uint8Array.
355
468
 
356
469
  [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L65)
357
470
 
358
- #### :gear: DocDescriptionSchema
471
+ #### :gear: DescriptionSchema
472
+
473
+ | Constant | Type |
474
+ | ------------------- | ----------- |
475
+ | `DescriptionSchema` | `ZodString` |
476
+
477
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L75)
359
478
 
360
- | Constant | Type |
361
- | ---------------------- | ----------- |
362
- | `DocDescriptionSchema` | `ZodString` |
479
+ #### :gear: CollectionsSchema
363
480
 
364
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L8)
481
+ | Constant | Type |
482
+ | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
483
+ | `CollectionsSchema` | `ZodObject<{ collections: ZodReadonly<ZodArray<ZodString, "many">>; }, "strict", ZodTypeAny, { collections: readonly string[]; }, { collections: readonly string[]; }>` |
484
+
485
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/collections.ts#L7)
365
486
 
366
487
  #### :gear: RawDataSchema
367
488
 
@@ -369,7 +490,7 @@ A schema that validates a value is an Uint8Array.
369
490
  | --------------- | ------------------------------------------------------------------------------- |
370
491
  | `RawDataSchema` | `ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>` |
371
492
 
372
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L18)
493
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L17)
373
494
 
374
495
  #### :gear: DocSchema
375
496
 
@@ -377,7 +498,31 @@ A schema that validates a value is an Uint8Array.
377
498
  | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
378
499
  | `DocSchema` | `ZodObject<{ owner: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; ... 4 more ...; version: ZodOptional<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>` |
379
500
 
380
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L30)
501
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L29)
502
+
503
+ #### :gear: OptionDocSchema
504
+
505
+ | Constant | Type |
506
+ | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
507
+ | `OptionDocSchema` | `ZodOptional<ZodObject<{ owner: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; ... 4 more ...; version: ZodOptional<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>>` |
508
+
509
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L79)
510
+
511
+ #### :gear: SetDocSchema
512
+
513
+ | Constant | Type |
514
+ | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
515
+ | `SetDocSchema` | `ZodObject<{ data: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; description: ZodOptional<...>; version: ZodOptional<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>` |
516
+
517
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L89)
518
+
519
+ #### :gear: DelDocSchema
520
+
521
+ | Constant | Type |
522
+ | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
523
+ | `DelDocSchema` | `ZodObject<{ version: ZodOptional<ZodBigInt>; }, "strict", ZodTypeAny, { version?: bigint or undefined; }, { version?: bigint or undefined; }>` |
524
+
525
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L121)
381
526
 
382
527
  #### :gear: DocUpsertSchema
383
528
 
@@ -385,15 +530,7 @@ A schema that validates a value is an Uint8Array.
385
530
  | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
386
531
  | `DocUpsertSchema` | `ZodObject<{ before: ZodOptional<ZodObject<{ owner: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; ... 4 more ...; version: ZodOptional<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>>; after: ZodObject<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>` |
387
532
 
388
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/payload.ts#L8)
389
-
390
- #### :gear: ProposedDocSchema
391
-
392
- | Constant | Type |
393
- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
394
- | `ProposedDocSchema` | `ZodObject<{ data: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; description: ZodOptional<...>; version: ZodOptional<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>` |
395
-
396
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/payload.ts#L33)
533
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/payload.ts#L14)
397
534
 
398
535
  #### :gear: DocAssertSetSchema
399
536
 
@@ -401,7 +538,15 @@ A schema that validates a value is an Uint8Array.
401
538
  | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
402
539
  | `DocAssertSetSchema` | `ZodObject<{ current: ZodOptional<ZodObject<{ owner: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; ... 4 more ...; version: ZodOptional<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>>; proposed: ZodObject<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>` |
403
540
 
404
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/payload.ts#L61)
541
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/payload.ts#L41)
542
+
543
+ #### :gear: DocAssertDeleteSchema
544
+
545
+ | Constant | Type |
546
+ | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
547
+ | `DocAssertDeleteSchema` | `ZodObject<{ current: ZodOptional<ZodObject<{ owner: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; ... 4 more ...; version: ZodOptional<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>>; proposed: ZodObject<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>` |
548
+
549
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/payload.ts#L71)
405
550
 
406
551
  #### :gear: OnSetDocContextSchema
407
552
 
@@ -409,7 +554,39 @@ A schema that validates a value is an Uint8Array.
409
554
  | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
410
555
  | `OnSetDocContextSchema` | `ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; data: ZodObject<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>` |
411
556
 
412
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L48)
557
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L60)
558
+
559
+ #### :gear: OnSetManyDocsContextSchema
560
+
561
+ | Constant | Type |
562
+ | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
563
+ | `OnSetManyDocsContextSchema` | `ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; data: ZodArray<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>` |
564
+
565
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L73)
566
+
567
+ #### :gear: OnDeleteDocContextSchema
568
+
569
+ | Constant | Type |
570
+ | -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
571
+ | `OnDeleteDocContextSchema` | `ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; data: ZodObject<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>` |
572
+
573
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L88)
574
+
575
+ #### :gear: OnDeleteManyDocsContextSchema
576
+
577
+ | Constant | Type |
578
+ | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
579
+ | `OnDeleteManyDocsContextSchema` | `ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; data: ZodArray<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>` |
580
+
581
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L101)
582
+
583
+ #### :gear: OnDeleteFilteredDocsContextSchema
584
+
585
+ | Constant | Type |
586
+ | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
587
+ | `OnDeleteFilteredDocsContextSchema` | `ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; data: ZodArray<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>` |
588
+
589
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L116)
413
590
 
414
591
  #### :gear: AssertSetDocContextSchema
415
592
 
@@ -417,7 +594,15 @@ A schema that validates a value is an Uint8Array.
417
594
  | --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
418
595
  | `AssertSetDocContextSchema` | `ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; data: ZodObject<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>` |
419
596
 
420
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L61)
597
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L131)
598
+
599
+ #### :gear: AssertDeleteDocContextSchema
600
+
601
+ | Constant | Type |
602
+ | ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
603
+ | `AssertDeleteDocContextSchema` | `ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; data: ZodObject<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>` |
604
+
605
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L144)
421
606
 
422
607
  #### :gear: SatelliteEnvSchema
423
608
 
@@ -427,21 +612,125 @@ A schema that validates a value is an Uint8Array.
427
612
 
428
613
  [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/satellite.env.ts#L6)
429
614
 
615
+ #### :gear: AssetSchema
616
+
617
+ | Constant | Type |
618
+ | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
619
+ | `AssetSchema` | `ZodObject<{ key: ZodObject<{ name: ZodString; full_path: ZodString; token: ZodOptional<ZodString>; collection: ZodString; owner: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; description: ZodOptional<...>; }, "strip", ZodTypeAny, { ...; }, { ...; }>; ... 4 more ...; version: ZodOptional<...>; },...` |
620
+
621
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L144)
622
+
623
+ #### :gear: BatchSchema
624
+
625
+ | Constant | Type |
626
+ | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
627
+ | `BatchSchema` | `ZodObject<{ key: ZodObject<{ name: ZodString; full_path: ZodString; token: ZodOptional<ZodString>; collection: ZodString; owner: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; description: ZodOptional<...>; }, "strip", ZodTypeAny, { ...; }, { ...; }>; reference_id: ZodOptional<...>; expires_at: Z...` |
628
+
629
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L213)
630
+
631
+ #### :gear: CommitBatchSchema
632
+
633
+ | Constant | Type |
634
+ | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
635
+ | `CommitBatchSchema` | `ZodObject<{ batch_id: ZodBigInt; headers: ZodArray<ZodTuple<[ZodString, ZodString], null>, "many">; chunk_ids: ZodArray<ZodBigInt, "many">; }, "strict", ZodTypeAny, { ...; }, { ...; }>` |
636
+
637
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L270)
638
+
639
+ #### :gear: AssetAssertUploadSchema
640
+
641
+ | Constant | Type |
642
+ | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
643
+ | `AssetAssertUploadSchema` | `ZodObject<{ current: ZodOptional<ZodObject<{ key: ZodObject<{ name: ZodString; full_path: ZodString; token: ZodOptional<ZodString>; collection: ZodString; owner: ZodType<...>; description: ZodOptional<...>; }, "strip", ZodTypeAny, { ...; }, { ...; }>; ... 4 more ...; version: ZodOptional<...>; }, "strict", ZodTypeAn...` |
644
+
645
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/payload.ts#L14)
646
+
647
+ #### :gear: OnUploadAssetContextSchema
648
+
649
+ | Constant | Type |
650
+ | ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
651
+ | `OnUploadAssetContextSchema` | `ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; data: ZodObject<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>` |
652
+
653
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L9)
654
+
655
+ #### :gear: OnDeleteAssetContextSchema
656
+
657
+ | Constant | Type |
658
+ | ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
659
+ | `OnDeleteAssetContextSchema` | `ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; data: ZodOptional<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>` |
660
+
661
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L21)
662
+
663
+ #### :gear: OnDeleteManyAssetsContextSchema
664
+
665
+ | Constant | Type |
666
+ | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
667
+ | `OnDeleteManyAssetsContextSchema` | `ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; data: ZodArray<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>` |
668
+
669
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L35)
670
+
671
+ #### :gear: OnDeleteFilteredAssetsContextSchema
672
+
673
+ | Constant | Type |
674
+ | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
675
+ | `OnDeleteFilteredAssetsContextSchema` | `ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; data: ZodArray<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>` |
676
+
677
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L47)
678
+
679
+ #### :gear: AssertUploadAssetContextSchema
680
+
681
+ | Constant | Type |
682
+ | -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
683
+ | `AssertUploadAssetContextSchema` | `ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; data: ZodObject<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>` |
684
+
685
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L61)
686
+
687
+ #### :gear: AssertDeleteAssetContextSchema
688
+
689
+ | Constant | Type |
690
+ | -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
691
+ | `AssertDeleteAssetContextSchema` | `ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; data: ZodObject<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>` |
692
+
693
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L73)
694
+
430
695
  #### :gear: AssertSetDocSchema
431
696
 
432
697
  | Constant | Type |
433
698
  | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
434
699
  | `AssertSetDocSchema` | `ZodObject<extendShape<{ collections: ZodReadonly<ZodArray<ZodString, "many">>; }, { assert: ZodFunction<ZodTuple<[ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; data: ZodObject<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>], ZodUnknown>, Z...` |
435
700
 
436
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L26)
701
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L44)
702
+
703
+ #### :gear: AssertDeleteDocSchema
704
+
705
+ | Constant | Type |
706
+ | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
707
+ | `AssertDeleteDocSchema` | `ZodObject<extendShape<{ collections: ZodReadonly<ZodArray<ZodString, "many">>; }, { assert: ZodFunction<ZodTuple<[ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; data: ZodObject<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>], ZodUnknown>, Z...` |
708
+
709
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L54)
710
+
711
+ #### :gear: AssertUploadAssetSchema
712
+
713
+ | Constant | Type |
714
+ | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
715
+ | `AssertUploadAssetSchema` | `ZodObject<extendShape<{ collections: ZodReadonly<ZodArray<ZodString, "many">>; }, { assert: ZodFunction<ZodTuple<[ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; data: ZodObject<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>], ZodUnknown>, Z...` |
716
+
717
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L64)
718
+
719
+ #### :gear: AssertDeleteAssetSchema
720
+
721
+ | Constant | Type |
722
+ | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
723
+ | `AssertDeleteAssetSchema` | `ZodObject<extendShape<{ collections: ZodReadonly<ZodArray<ZodString, "many">>; }, { assert: ZodFunction<ZodTuple<[ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; data: ZodObject<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>], ZodUnknown>, Z...` |
724
+
725
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L74)
437
726
 
438
727
  #### :gear: AssertSchema
439
728
 
440
729
  | Constant | Type |
441
730
  | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
442
- | `AssertSchema` | `ZodObject<extendShape<{ collections: ZodReadonly<ZodArray<ZodString, "many">>; }, { assert: ZodFunction<ZodTuple<[ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; data: ZodObject<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>], ZodUnknown>, Z...` |
731
+ | `AssertSchema` | `ZodUnion<[ZodObject<extendShape<{ collections: ZodReadonly<ZodArray<ZodString, "many">>; }, { assert: ZodFunction<ZodTuple<[ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; data: ZodObject<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>], ZodU...` |
443
732
 
444
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L37)
733
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L84)
445
734
 
446
735
  #### :gear: OnSetDocSchema
447
736
 
@@ -449,31 +738,143 @@ A schema that validates a value is an Uint8Array.
449
738
  | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
450
739
  | `OnSetDocSchema` | `ZodObject<extendShape<{ collections: ZodReadonly<ZodArray<ZodString, "many">>; }, { run: ZodFunction<ZodTuple<[ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; data: ZodObject<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>], ZodUnknown>, ZodU...` |
451
740
 
452
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L26)
741
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L54)
742
+
743
+ #### :gear: OnSetManyDocsSchema
744
+
745
+ | Constant | Type |
746
+ | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
747
+ | `OnSetManyDocsSchema` | `ZodObject<extendShape<{ collections: ZodReadonly<ZodArray<ZodString, "many">>; }, { run: ZodFunction<ZodTuple<[ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; data: ZodArray<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>], ZodUnknown>, ZodUn...` |
748
+
749
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L64)
750
+
751
+ #### :gear: OnDeleteDocSchema
752
+
753
+ | Constant | Type |
754
+ | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
755
+ | `OnDeleteDocSchema` | `ZodObject<extendShape<{ collections: ZodReadonly<ZodArray<ZodString, "many">>; }, { run: ZodFunction<ZodTuple<[ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; data: ZodObject<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>], ZodUnknown>, ZodU...` |
756
+
757
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L74)
758
+
759
+ #### :gear: OnDeleteManyDocsSchema
760
+
761
+ | Constant | Type |
762
+ | ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
763
+ | `OnDeleteManyDocsSchema` | `ZodObject<extendShape<{ collections: ZodReadonly<ZodArray<ZodString, "many">>; }, { run: ZodFunction<ZodTuple<[ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; data: ZodArray<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>], ZodUnknown>, ZodUn...` |
764
+
765
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L84)
766
+
767
+ #### :gear: OnDeleteFilteredDocsSchema
768
+
769
+ | Constant | Type |
770
+ | ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
771
+ | `OnDeleteFilteredDocsSchema` | `ZodObject<extendShape<{ collections: ZodReadonly<ZodArray<ZodString, "many">>; }, { run: ZodFunction<ZodTuple<[ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; data: ZodArray<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>], ZodUnknown>, ZodUn...` |
772
+
773
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L94)
774
+
775
+ #### :gear: OnUploadAssetSchema
776
+
777
+ | Constant | Type |
778
+ | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
779
+ | `OnUploadAssetSchema` | `ZodObject<extendShape<{ collections: ZodReadonly<ZodArray<ZodString, "many">>; }, { run: ZodFunction<ZodTuple<[ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; data: ZodObject<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>], ZodUnknown>, ZodU...` |
780
+
781
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L104)
782
+
783
+ #### :gear: OnDeleteAssetSchema
784
+
785
+ | Constant | Type |
786
+ | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
787
+ | `OnDeleteAssetSchema` | `ZodObject<extendShape<{ collections: ZodReadonly<ZodArray<ZodString, "many">>; }, { run: ZodFunction<ZodTuple<[ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; data: ZodOptional<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>], ZodUnknown>, Zo...` |
788
+
789
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L114)
790
+
791
+ #### :gear: OnDeleteManyAssetsSchema
792
+
793
+ | Constant | Type |
794
+ | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
795
+ | `OnDeleteManyAssetsSchema` | `ZodObject<extendShape<{ collections: ZodReadonly<ZodArray<ZodString, "many">>; }, { run: ZodFunction<ZodTuple<[ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; data: ZodArray<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>], ZodUnknown>, ZodUn...` |
796
+
797
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L124)
798
+
799
+ #### :gear: OnDeleteFilteredAssetsSchema
800
+
801
+ | Constant | Type |
802
+ | ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
803
+ | `OnDeleteFilteredAssetsSchema` | `ZodObject<extendShape<{ collections: ZodReadonly<ZodArray<ZodString, "many">>; }, { run: ZodFunction<ZodTuple<[ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; data: ZodArray<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>], ZodUnknown>, ZodUn...` |
804
+
805
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L134)
453
806
 
454
807
  #### :gear: HookSchema
455
808
 
456
809
  | Constant | Type |
457
810
  | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
458
- | `HookSchema` | `ZodObject<extendShape<{ collections: ZodReadonly<ZodArray<ZodString, "many">>; }, { run: ZodFunction<ZodTuple<[ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; data: ZodObject<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>], ZodUnknown>, ZodU...` |
811
+ | `HookSchema` | `ZodUnion<[ZodObject<extendShape<{ collections: ZodReadonly<ZodArray<ZodString, "many">>; }, { run: ZodFunction<ZodTuple<[ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; data: ZodObject<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>], ZodUnkn...` |
459
812
 
460
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L37)
813
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L144)
461
814
 
462
- #### :gear: SetDocSchema
815
+ #### :gear: ControllerScopeSchema
816
+
817
+ | Constant | Type |
818
+ | ----------------------- | ----------------------------- |
819
+ | `ControllerScopeSchema` | `ZodEnum<["write", "admin"]>` |
463
820
 
464
- | Constant | Type |
465
- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
466
- | `SetDocSchema` | `ZodObject<{ key: ZodString; description: ZodOptional<ZodString>; data: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; version: ZodOptional<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>` |
821
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L15)
467
822
 
468
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L14)
823
+ #### :gear: MetadataSchema
824
+
825
+ | Constant | Type |
826
+ | ---------------- | ---------------------------------------- |
827
+ | `MetadataSchema` | `ZodTuple<[ZodString, ZodString], null>` |
828
+
829
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L25)
830
+
831
+ #### :gear: ControllerSchema
832
+
833
+ | Constant | Type |
834
+ | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
835
+ | `ControllerSchema` | `ZodObject<{ metadata: ZodArray<ZodTuple<[ZodString, ZodString], null>, "many">; created_at: ZodBigInt; updated_at: ZodBigInt; expires_at: ZodOptional<...>; scope: ZodEnum<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>` |
836
+
837
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L35)
838
+
839
+ #### :gear: ControllerRecordSchema
840
+
841
+ | Constant | Type |
842
+ | ------------------------ | ----------------------------------------------------------------------------------------------------------------- |
843
+ | `ControllerRecordSchema` | `ZodTuple<[ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>, ZodObject<...>], null>` |
844
+
845
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L79)
846
+
847
+ #### :gear: ControllersSchema
848
+
849
+ | Constant | Type |
850
+ | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
851
+ | `ControllersSchema` | `ZodArray<ZodTuple<[ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>, ZodObject<...>], null>, "many">` |
852
+
853
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L89)
854
+
855
+ #### :gear: ControllerCheckParamsSchema
856
+
857
+ | Constant | Type |
858
+ | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
859
+ | `ControllerCheckParamsSchema` | `ZodObject<{ caller: ZodUnion<[ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>, ZodType<...>]>; controllers: ZodArray<...>; }, "strip", ZodTypeAny, { ...; }, { ...; }>` |
860
+
861
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L99)
469
862
 
470
863
  #### :gear: SetDocStoreParamsSchema
471
864
 
472
- | Constant | Type |
473
- | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
474
- | `SetDocStoreParamsSchema` | `ZodObject<{ caller: ZodUnion<[ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>, ZodType<...>]>; collection: ZodString; doc: ZodObject<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>` |
865
+ | Constant | Type |
866
+ | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
867
+ | `SetDocStoreParamsSchema` | `ZodObject<extendShape<{ caller: ZodUnion<[ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>, ZodType<...>]>; collection: ZodString; key: ZodString; }, { ...; }>, "strict", ZodTypeAny, { ...; }, { ...; }>` |
868
+
869
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L46)
475
870
 
476
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L49)
871
+ #### :gear: DeleteDocStoreParamsSchema
872
+
873
+ | Constant | Type |
874
+ | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
875
+ | `DeleteDocStoreParamsSchema` | `ZodObject<extendShape<{ caller: ZodUnion<[ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>, ZodType<...>]>; collection: ZodString; key: ZodString; }, { ...; }>, "strict", ZodTypeAny, { ...; }, { ...; }>` |
876
+
877
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L66)
477
878
 
478
879
  #### :gear: IDLTypeSchema
479
880
 
@@ -481,7 +882,7 @@ A schema that validates a value is an Uint8Array.
481
882
  | --------------- | --------------------------------------------------- |
482
883
  | `IDLTypeSchema` | `ZodType<Type<unknown>, ZodTypeDef, Type<unknown>>` |
483
884
 
484
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L8)
885
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L9)
485
886
 
486
887
  #### :gear: CallArgSchema
487
888
 
@@ -489,7 +890,7 @@ A schema that validates a value is an Uint8Array.
489
890
  | --------------- | --------------------------------------------------------------------------------- |
490
891
  | `CallArgSchema` | `ZodTuple<[ZodType<Type<unknown>, ZodTypeDef, Type<unknown>>, ZodUnknown], null>` |
491
892
 
492
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L20)
893
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L21)
493
894
 
494
895
  #### :gear: CallArgsSchema
495
896
 
@@ -499,7 +900,7 @@ Schema for encoding the call arguments.
499
900
  | ---------------- | --------------------------------------------------------------------------------------------------- |
500
901
  | `CallArgsSchema` | `ZodArray<ZodTuple<[ZodType<Type<unknown>, ZodTypeDef, Type<unknown>>, ZodUnknown], null>, "many">` |
501
902
 
502
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L32)
903
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L33)
503
904
 
504
905
  #### :gear: CallResultSchema
505
906
 
@@ -507,7 +908,7 @@ Schema for encoding the call arguments.
507
908
  | ------------------ | --------------------------------------------------- |
508
909
  | `CallResultSchema` | `ZodType<Type<unknown>, ZodTypeDef, Type<unknown>>` |
509
910
 
510
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L48)
911
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L49)
511
912
 
512
913
  #### :gear: CallParamsSchema
513
914
 
@@ -515,15 +916,241 @@ Schema for encoding the call arguments.
515
916
  | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
516
917
  | `CallParamsSchema` | `ZodObject<{ canisterId: ZodUnion<[ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>, ZodType<...>]>; method: ZodString; args: ZodOptional<...>; result: ZodOptional<...>; }, "strip", ZodTypeAny, { ...; }, { ...; }>` |
517
918
 
518
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L58)
919
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L59)
519
920
 
520
921
  ### :factory: CallResponseLengthError
521
922
 
522
923
  [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/types/errors.ts#L1)
523
924
 
524
- ### :cocktail: Types
925
+ ### :tropical_drink: Interfaces
525
926
 
526
927
  - [Collections](#gear-collections)
928
+ - [HookContext](#gear-hookcontext)
929
+ - [Doc](#gear-doc)
930
+ - [SetDoc](#gear-setdoc)
931
+ - [DelDoc](#gear-deldoc)
932
+ - [DocUpsert](#gear-docupsert)
933
+ - [DocAssertSet](#gear-docassertset)
934
+ - [DocAssertDelete](#gear-docassertdelete)
935
+ - [DocContext](#gear-doccontext)
936
+ - [AssetKey](#gear-assetkey)
937
+ - [AssetEncoding](#gear-assetencoding)
938
+ - [Asset](#gear-asset)
939
+ - [Batch](#gear-batch)
940
+ - [CommitBatch](#gear-commitbatch)
941
+ - [AssetAssertUpload](#gear-assetassertupload)
942
+ - [Controller](#gear-controller)
943
+ - [ControllerCheckParams](#gear-controllercheckparams)
944
+ - [DocStoreParams](#gear-docstoreparams)
945
+ - [CallParams](#gear-callparams)
946
+
947
+ #### :gear: Collections
948
+
949
+ Defines the collections where a hook or assertion should run.
950
+
951
+ | Property | Type | Description |
952
+ | ------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------ |
953
+ | `collections` | `readonly string[]` | An array of collection names where the hook or assertion will run. If empty, no hooks or assertions are triggered. |
954
+
955
+ #### :gear: HookContext
956
+
957
+ Represents the context provided to hooks, containing information about the caller and related data.
958
+
959
+ | Property | Type | Description |
960
+ | -------- | ----------------------------- | ------------------------------------------------------------------------------- |
961
+ | `caller` | `Uint8Array<ArrayBufferLike>` | The user who originally triggered the function that in turn triggered the hook. |
962
+ | `data` | `T` | The data associated with the hook execution. |
963
+
964
+ #### :gear: Doc
965
+
966
+ Represents a document stored in a collection.
967
+
968
+ | Property | Type | Description |
969
+ | ------------- | ----------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
970
+ | `owner` | `Uint8Array<ArrayBufferLike>` | The user who owns this document. |
971
+ | `data` | `Uint8Array<ArrayBufferLike>` | The raw data of the document. |
972
+ | `description` | `string or undefined` | An optional description of the document. |
973
+ | `created_at` | `bigint` | The timestamp when the document was first created. |
974
+ | `updated_at` | `bigint` | The timestamp when the document was last updated. |
975
+ | `version` | `bigint or undefined` | The version number of the document, used for consistency checks. If not provided, it's assumed to be the first version. |
976
+
977
+ #### :gear: SetDoc
978
+
979
+ Represents the proposed version of a document to be created or updated.
980
+ This can be validated before allowing the operation.
981
+
982
+ | Property | Type | Description |
983
+ | ------------- | ----------------------------- | -------------------------------------------------- |
984
+ | `data` | `Uint8Array<ArrayBufferLike>` | The raw data of the document. |
985
+ | `description` | `string or undefined` | An optional description of the document. |
986
+ | `version` | `bigint or undefined` | The expected version number to ensure consistency. |
987
+
988
+ #### :gear: DelDoc
989
+
990
+ Represents the proposed version of a document to be deleted.
991
+ This can be validated before allowing the operation.
992
+
993
+ | Property | Type | Description |
994
+ | --------- | --------------------- | -------------------------------------------------- |
995
+ | `version` | `bigint or undefined` | The expected version number to ensure consistency. |
996
+
997
+ #### :gear: DocUpsert
998
+
999
+ Represents a document update operation.
1000
+
1001
+ This is used in hooks where a document is either being created or updated.
1002
+
1003
+ | Property | Type | Description |
1004
+ | -------- | ------------------ | -------------------------------------------------------------------------------------------- |
1005
+ | `before` | `Doc or undefined` | The previous version of the document before the update. Undefined if this is a new document. |
1006
+ | `after` | `Doc` | The new version of the document after the update. |
1007
+
1008
+ #### :gear: DocAssertSet
1009
+
1010
+ Represents a validation check before setting a document.
1011
+
1012
+ The developer can compare the `current` and `proposed` versions and
1013
+ throw an error if their validation fails.
1014
+
1015
+ | Property | Type | Description |
1016
+ | ---------- | ------------------ | ---------------------------------------------------------------------------------------------- |
1017
+ | `current` | `Doc or undefined` | The current version of the document before the operation. Undefined if this is a new document. |
1018
+ | `proposed` | `SetDoc` | The proposed version of the document. This can be validated before allowing the operation. |
1019
+
1020
+ #### :gear: DocAssertDelete
1021
+
1022
+ Represents a validation check before deleting a document.
1023
+
1024
+ The developer can compare the `current` and `proposed` versions and
1025
+ throw an error if their validation fails.
1026
+
1027
+ | Property | Type | Description |
1028
+ | ---------- | ------------------ | --------------------------------------------------------------------------------------------------- |
1029
+ | `current` | `Doc or undefined` | The current version of the document before the operation. Undefined if the document does not exist. |
1030
+ | `proposed` | `DelDoc` | The proposed version of the document. This can be validated before allowing the operation. |
1031
+
1032
+ #### :gear: DocContext
1033
+
1034
+ Represents the context of a document operation within a collection.
1035
+
1036
+ | Property | Type | Description |
1037
+ | ------------ | -------- | -------------------------------------------------------------- |
1038
+ | `collection` | `string` | The name of the collection where the document is stored. |
1039
+ | `key` | `string` | The unique key identifying the document within the collection. |
1040
+ | `data` | `T` | The data associated with the document operation. |
1041
+
1042
+ #### :gear: AssetKey
1043
+
1044
+ Metadata identifying an asset within a collection and the storage system.
1045
+
1046
+ | Property | Type | Description |
1047
+ | ------------- | ----------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
1048
+ | `name` | `string` | The name of the asset (e.g., "logo.png"). |
1049
+ | `full_path` | `string` | The full relative path of the asset (e.g., "/images/logo.png"). |
1050
+ | `token` | `string or undefined` | Optional access token for the asset. If set, can be used using a query parameter e.g. /full_path/?token=1223-3345-5564-3333 |
1051
+ | `collection` | `string` | The collection to which this asset belongs. |
1052
+ | `owner` | `Uint8Array<ArrayBufferLike>` | The owner of the asset. |
1053
+ | `description` | `string or undefined` | Optional description of the asset for indexing/search. |
1054
+
1055
+ #### :gear: AssetEncoding
1056
+
1057
+ Represents a specific encoding of an asset, such as "gzip" or "identity" (no compression).
1058
+
1059
+ | Property | Type | Description |
1060
+ | ---------------- | ------------- | ----------------------------------------------- |
1061
+ | `modified` | `bigint` | Timestamp when the encoding was last modified. |
1062
+ | `content_chunks` | `BlobOrKey[]` | Chunks of binary content or references to them. |
1063
+ | `total_length` | `bigint` | Total byte size of the encoded content. |
1064
+ | `sha256` | `Hash` | SHA-256 hash of the encoded content. |
1065
+
1066
+ #### :gear: Asset
1067
+
1068
+ A stored asset including its metadata, encodings, and timestamps.
1069
+
1070
+ | Property | Type | Description |
1071
+ | ------------ | ------------------------------- | ---------------------------------------------------------------------------------------------- |
1072
+ | `key` | `AssetKey` | Metadata about the asset's identity and ownership. |
1073
+ | `headers` | `HeaderField[]` | Optional HTTP headers associated with the asset. |
1074
+ | `encodings` | `Record<string, AssetEncoding>` | A mapping from encoding types (e.g., "identity", "gzip") to the corresponding encoded version. |
1075
+ | `created_at` | `bigint` | Timestamp when the asset was created. |
1076
+ | `updated_at` | `bigint` | Timestamp when the asset was last updated. |
1077
+ | `version` | `bigint or undefined` | Optional version number of the asset. |
1078
+
1079
+ #### :gear: Batch
1080
+
1081
+ Represents a batch of chunks to be uploaded and committed to an asset.
1082
+
1083
+ | Property | Type | Description |
1084
+ | --------------- | --------------------- | ------------------------------------------------- |
1085
+ | `key` | `AssetKey` | The metadata key for the asset being uploaded. |
1086
+ | `reference_id` | `bigint or undefined` | Optional reference ID for tracking or validation. |
1087
+ | `expires_at` | `bigint` | Timestamp when this batch expires. |
1088
+ | `encoding_type` | `string or undefined` | Optional encoding format (e.g., "gzip"). |
1089
+
1090
+ #### :gear: CommitBatch
1091
+
1092
+ Represents the final step in uploading an asset, committing the batch to storage.
1093
+
1094
+ | Property | Type | Description |
1095
+ | ----------- | --------------- | ------------------------------------------------- |
1096
+ | `batch_id` | `bigint` | The ID of the batch being committed. |
1097
+ | `headers` | `HeaderField[]` | HTTP headers associated with this asset. |
1098
+ | `chunk_ids` | `bigint[]` | List of chunk IDs that make up the asset content. |
1099
+
1100
+ #### :gear: AssetAssertUpload
1101
+
1102
+ Represents a validation context before uploading an asset.
1103
+
1104
+ | Property | Type | Description |
1105
+ | -------------- | -------------------- | ------------------------------------------------- |
1106
+ | `current` | `Asset or undefined` | The current asset already stored (if any). |
1107
+ | `batch` | `Batch` | The batch metadata being uploaded. |
1108
+ | `commit_batch` | `CommitBatch` | The commit data describing headers and chunk ids. |
1109
+
1110
+ #### :gear: Controller
1111
+
1112
+ Represents a controller with access scope and associated metadata.
1113
+
1114
+ | Property | Type | Description |
1115
+ | ------------ | --------------------- | -------------------------------------------------------------------------------------------------- |
1116
+ | `metadata` | `[string, string][]` | A list of key-value metadata pairs associated with the controller. |
1117
+ | `created_at` | `bigint` | The timestamp when the controller was created. |
1118
+ | `updated_at` | `bigint` | The timestamp when the controller was last updated. |
1119
+ | `expires_at` | `bigint or undefined` | Optional expiration timestamp for the controller. 👉 It's a placeholder for future implementation. |
1120
+ | `scope` | `"write" or "admin"` | The scope assigned to the controller. |
1121
+
1122
+ #### :gear: ControllerCheckParams
1123
+
1124
+ Represents the parameters required to perform controller checks.
1125
+
1126
+ | Property | Type | Description |
1127
+ | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
1128
+ | `caller` | `Uint8Array<ArrayBufferLike> or Principal` | The identity of the caller to verify against the controller list. |
1129
+ | `controllers` | `[Uint8Array<ArrayBufferLike>, { created_at: bigint; updated_at: bigint; metadata: [string, string][]; scope: "write" or "admin"; expires_at?: bigint or undefined; }][]` | The list of controllers to check against. |
1130
+
1131
+ #### :gear: DocStoreParams
1132
+
1133
+ Represents the base parameters required to access the datastore and modify a document.
1134
+
1135
+ | Property | Type | Description |
1136
+ | ------------ | ------------------------------------------ | -------------------------------------------------------------- |
1137
+ | `caller` | `Uint8Array<ArrayBufferLike> or Principal` | The caller who initiate the document operation. |
1138
+ | `collection` | `string` | The name of the collection where the document is stored. |
1139
+ | `key` | `string` | The unique key identifying the document within the collection. |
1140
+
1141
+ #### :gear: CallParams
1142
+
1143
+ Type representing the parameters required to make a canister call.
1144
+
1145
+ | Property | Type | Description |
1146
+ | ------------ | ------------------------------------------ | ----------------------------------------------------------------- |
1147
+ | `canisterId` | `Uint8Array<ArrayBufferLike> or Principal` | The target canister's ID. |
1148
+ | `method` | `string` | The name of the method to call. Minimum one character. |
1149
+ | `args` | `[Type<unknown>, unknown][] or undefined` | The arguments, including types and values, for the canister call. |
1150
+ | `result` | `Type<unknown> or undefined` | The expected result type used for decoding the response. |
1151
+
1152
+ ### :cocktail: Types
1153
+
527
1154
  - [RawPrincipal](#gear-rawprincipal)
528
1155
  - [Principal](#gear-principal)
529
1156
  - [Timestamp](#gear-timestamp)
@@ -532,44 +1159,64 @@ Schema for encoding the call arguments.
532
1159
  - [UserId](#gear-userid)
533
1160
  - [Collection](#gear-collection)
534
1161
  - [Key](#gear-key)
535
- - [HookContext](#gear-hookcontext)
1162
+ - [Description](#gear-description)
536
1163
  - [AssertFunction](#gear-assertfunction)
537
1164
  - [RunFunction](#gear-runfunction)
538
- - [DocDescription](#gear-docdescription)
539
1165
  - [RawData](#gear-rawdata)
540
- - [Doc](#gear-doc)
541
- - [DocUpsert](#gear-docupsert)
542
- - [ProposedDoc](#gear-proposeddoc)
543
- - [DocAssertSet](#gear-docassertset)
544
- - [DocContext](#gear-doccontext)
1166
+ - [OptionDoc](#gear-optiondoc)
545
1167
  - [OnSetDocContext](#gear-onsetdoccontext)
1168
+ - [OnSetManyDocsContext](#gear-onsetmanydocscontext)
1169
+ - [OnDeleteDocContext](#gear-ondeletedoccontext)
1170
+ - [OnDeleteManyDocsContext](#gear-ondeletemanydocscontext)
1171
+ - [OnDeleteFilteredDocsContext](#gear-ondeletefiltereddocscontext)
546
1172
  - [AssertSetDocContext](#gear-assertsetdoccontext)
1173
+ - [AssertDeleteDocContext](#gear-assertdeletedoccontext)
547
1174
  - [SatelliteEnv](#gear-satelliteenv)
1175
+ - [HeaderField](#gear-headerfield)
1176
+ - [Blob](#gear-blob)
1177
+ - [BlobOrKey](#gear-bloborkey)
1178
+ - [Hash](#gear-hash)
1179
+ - [EncodingType](#gear-encodingtype)
1180
+ - [ReferenceId](#gear-referenceid)
1181
+ - [ChunkId](#gear-chunkid)
1182
+ - [BatchId](#gear-batchid)
1183
+ - [OnUploadAssetContext](#gear-onuploadassetcontext)
1184
+ - [OnDeleteAssetContext](#gear-ondeleteassetcontext)
1185
+ - [OnDeleteManyAssetsContext](#gear-ondeletemanyassetscontext)
1186
+ - [OnDeleteFilteredAssetsContext](#gear-ondeletefilteredassetscontext)
1187
+ - [AssertUploadAssetContext](#gear-assertuploadassetcontext)
1188
+ - [AssertDeleteAssetContext](#gear-assertdeleteassetcontext)
1189
+ - [OnAssert](#gear-onassert)
548
1190
  - [AssertSetDoc](#gear-assertsetdoc)
1191
+ - [AssertDeleteDoc](#gear-assertdeletedoc)
1192
+ - [AssertUploadAsset](#gear-assertuploadasset)
1193
+ - [AssertDeleteAsset](#gear-assertdeleteasset)
549
1194
  - [Assert](#gear-assert)
550
1195
  - [AssertFn](#gear-assertfn)
551
1196
  - [AssertFnOrObject](#gear-assertfnorobject)
1197
+ - [OnHook](#gear-onhook)
552
1198
  - [OnSetDoc](#gear-onsetdoc)
1199
+ - [OnSetManyDocs](#gear-onsetmanydocs)
1200
+ - [OnDeleteDoc](#gear-ondeletedoc)
1201
+ - [OnDeleteManyDocs](#gear-ondeletemanydocs)
1202
+ - [OnDeleteFilteredDocs](#gear-ondeletefiltereddocs)
1203
+ - [OnUploadAsset](#gear-onuploadasset)
1204
+ - [OnDeleteAsset](#gear-ondeleteasset)
1205
+ - [OnDeleteManyAssets](#gear-ondeletemanyassets)
1206
+ - [OnDeleteFilteredAssets](#gear-ondeletefilteredassets)
553
1207
  - [Hook](#gear-hook)
554
1208
  - [HookFn](#gear-hookfn)
555
1209
  - [HookFnOrObject](#gear-hookfnorobject)
556
- - [SetDoc](#gear-setdoc)
1210
+ - [ControllerScope](#gear-controllerscope)
1211
+ - [Metadata](#gear-metadata)
1212
+ - [ControllerRecord](#gear-controllerrecord)
1213
+ - [Controllers](#gear-controllers)
557
1214
  - [SetDocStoreParams](#gear-setdocstoreparams)
1215
+ - [DeleteDocStoreParams](#gear-deletedocstoreparams)
558
1216
  - [IDLType](#gear-idltype)
559
1217
  - [CallArg](#gear-callarg)
560
1218
  - [CallArgs](#gear-callargs)
561
1219
  - [CallResult](#gear-callresult)
562
- - [CallParams](#gear-callparams)
563
-
564
- #### :gear: Collections
565
-
566
- Defines the collections where a hook or assertion should run.
567
-
568
- | Type | Type |
569
- | ------------- | ----------------------------------- |
570
- | `Collections` | `z.infer<typeof CollectionsSchema>` |
571
-
572
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/collections.ts#L19)
573
1220
 
574
1221
  #### :gear: RawPrincipal
575
1222
 
@@ -659,15 +1306,16 @@ A unique key identifier within a collection.
659
1306
 
660
1307
  [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L70)
661
1308
 
662
- #### :gear: HookContext
1309
+ #### :gear: Description
663
1310
 
664
- Represents the context provided to hooks, containing information about the caller and related data.
1311
+ Represents a description with a maximum length of 1024 characters.
1312
+ Used for document and asset fields which can be useful for search purpose.
665
1313
 
666
- | Type | Type |
667
- | ------------- | -------------------------------------------------- |
668
- | `HookContext` | `z.infer<ReturnType<typeof HookContextSchema<T>>>` |
1314
+ | Type | Type |
1315
+ | ------------- | ----------------------------------- |
1316
+ | `Description` | `z.infer<typeof DescriptionSchema>` |
669
1317
 
670
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/context.ts#L36)
1318
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L81)
671
1319
 
672
1320
  #### :gear: AssertFunction
673
1321
 
@@ -675,11 +1323,11 @@ Defines the `assert` function schema for assertions.
675
1323
 
676
1324
  The function takes a context argument and returns `void`.
677
1325
 
678
- | Type | Type |
679
- | ---------------- | ---------------------------------------------------------------- |
680
- | `AssertFunction` | `z.infer<ReturnType<typeof AssertFunctionSchema<z.ZodType<T>>>>` |
1326
+ | Type | Type |
1327
+ | ---------------- | ---------------------- |
1328
+ | `AssertFunction` | `(context: T) => void` |
681
1329
 
682
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/context.ts#L51)
1330
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/context.ts#L54)
683
1331
 
684
1332
  #### :gear: RunFunction
685
1333
 
@@ -687,21 +1335,11 @@ Defines the `run` function schema for hooks.
687
1335
 
688
1336
  The function takes a context argument and returns either a `Promise<void>` or `void`.
689
1337
 
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#L66)
695
-
696
- #### :gear: DocDescription
1338
+ | Type | Type |
1339
+ | ------------- | --------------------------------------- |
1340
+ | `RunFunction` | `(context: T) => void or Promise<void>` |
697
1341
 
698
- Represents a document description with a maximum length of 1024 characters.
699
-
700
- | Type | Type |
701
- | ---------------- | -------------------------------------- |
702
- | `DocDescription` | `z.infer<typeof DocDescriptionSchema>` |
703
-
704
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L13)
1342
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/context.ts#L69)
705
1343
 
706
1344
  #### :gear: RawData
707
1345
 
@@ -713,89 +1351,108 @@ This is used to store structured data in a document.
713
1351
  | --------- | ---------------------------------- |
714
1352
  | `RawData` | `z.infer<typeof Uint8ArraySchema>` |
715
1353
 
716
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L25)
1354
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L24)
717
1355
 
718
- #### :gear: Doc
1356
+ #### :gear: OptionDoc
719
1357
 
720
- Represents a document stored in a collection.
1358
+ A shorthand for a document that might or not be defined.
721
1359
 
722
- | Type | Type |
723
- | ----- | --------------------------- |
724
- | `Doc` | `z.infer<typeof DocSchema>` |
1360
+ | Type | Type |
1361
+ | ----------- | ------------------ |
1362
+ | `OptionDoc` | `Doc or undefined` |
725
1363
 
726
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L68)
1364
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L84)
727
1365
 
728
- #### :gear: DocUpsert
1366
+ #### :gear: OnSetDocContext
729
1367
 
730
- Represents a document update operation.
1368
+ The context provided to the `onSetDoc` hook.
731
1369
 
732
- This is used in hooks where a document is either being created or updated.
1370
+ This context contains information about the document being created or updated,
1371
+ along with details about the user who triggered the operation.
733
1372
 
734
- | Type | Type |
735
- | ----------- | --------------------------------- |
736
- | `DocUpsert` | `z.infer<typeof DocUpsertSchema>` |
1373
+ | Type | Type |
1374
+ | ----------------- | ------------------------------------ |
1375
+ | `OnSetDocContext` | `HookContext<DocContext<DocUpsert>>` |
737
1376
 
738
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/payload.ts#L28)
1377
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L68)
739
1378
 
740
- #### :gear: ProposedDoc
1379
+ #### :gear: OnSetManyDocsContext
741
1380
 
742
- Represents the proposed version of a document.
743
- This can be validated before allowing the operation.
1381
+ The context provided to the `onSetManyDocs` hook.
744
1382
 
745
- | Type | Type |
746
- | ------------- | ----------------------------------- |
747
- | `ProposedDoc` | `z.infer<typeof ProposedDocSchema>` |
1383
+ This context contains information about multiple documents being created or updated
1384
+ in a single operation, along with details about the user who triggered it.
748
1385
 
749
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/payload.ts#L56)
1386
+ | Type | Type |
1387
+ | ---------------------- | -------------------------------------- |
1388
+ | `OnSetManyDocsContext` | `HookContext<DocContext<DocUpsert>[]>` |
750
1389
 
751
- #### :gear: DocAssertSet
1390
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L83)
752
1391
 
753
- Represents a validation check before setting a document.
1392
+ #### :gear: OnDeleteDocContext
754
1393
 
755
- The developer can compare the `current` and `proposed` versions and
756
- throw an error if their validation fails.
1394
+ The context provided to the `onDeleteDoc` hook.
757
1395
 
758
- | Type | Type |
759
- | -------------- | ------------------------------------ |
760
- | `DocAssertSet` | `z.infer<typeof DocAssertSetSchema>` |
1396
+ This context contains information about a single document being deleted,
1397
+ along with details about the user who triggered the operation.
761
1398
 
762
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/payload.ts#L83)
1399
+ | Type | Type |
1400
+ | -------------------- | ------------------------------------ |
1401
+ | `OnDeleteDocContext` | `HookContext<DocContext<OptionDoc>>` |
763
1402
 
764
- #### :gear: DocContext
1403
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L96)
765
1404
 
766
- Represents the context of a document operation within a collection.
1405
+ #### :gear: OnDeleteManyDocsContext
767
1406
 
768
- | Type | Type |
769
- | ------------ | ------------------------------------------------- |
770
- | `DocContext` | `z.infer<ReturnType<typeof DocContextSchema<T>>>` |
1407
+ The context provided to the `onDeleteManyDocs` hook.
771
1408
 
772
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L43)
1409
+ This context contains information about multiple documents being deleted,
1410
+ along with details about the user who triggered the operation.
773
1411
 
774
- #### :gear: OnSetDocContext
1412
+ | Type | Type |
1413
+ | ------------------------- | -------------------------------------- |
1414
+ | `OnDeleteManyDocsContext` | `HookContext<DocContext<OptionDoc>[]>` |
775
1415
 
776
- The context provided to the `onSetDoc` hook.
1416
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L111)
777
1417
 
778
- This context contains information about the document being created or updated,
1418
+ #### :gear: OnDeleteFilteredDocsContext
1419
+
1420
+ The context provided to the `onDeleteFilteredDocs` hook.
1421
+
1422
+ This context contains information about documents deleted as a result of a filter,
779
1423
  along with details about the user who triggered the operation.
780
1424
 
781
- | Type | Type |
782
- | ----------------- | --------------------------------------- |
783
- | `OnSetDocContext` | `z.infer<typeof OnSetDocContextSchema>` |
1425
+ | Type | Type |
1426
+ | ----------------------------- | -------------------------------------- |
1427
+ | `OnDeleteFilteredDocsContext` | `HookContext<DocContext<OptionDoc>[]>` |
784
1428
 
785
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L56)
1429
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L126)
786
1430
 
787
1431
  #### :gear: AssertSetDocContext
788
1432
 
789
- The context provided to the `assertSetDoc` hook.
1433
+ The context provided to the `assertDeleteDoc` hook.
790
1434
 
791
1435
  This context contains information about the document being validated before
792
1436
  it is created or updated. If validation fails, the developer should throw an error.
793
1437
 
794
- | Type | Type |
795
- | --------------------- | ------------------------------------------- |
796
- | `AssertSetDocContext` | `z.infer<typeof AssertSetDocContextSchema>` |
1438
+ | Type | Type |
1439
+ | --------------------- | --------------------------------------- |
1440
+ | `AssertSetDocContext` | `HookContext<DocContext<DocAssertSet>>` |
1441
+
1442
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L139)
1443
+
1444
+ #### :gear: AssertDeleteDocContext
1445
+
1446
+ The context provided to the `assertDeleteDoc` hook.
1447
+
1448
+ This context contains information about the document being validated before
1449
+ it is deleted. If validation fails, the developer should throw an error.
1450
+
1451
+ | Type | Type |
1452
+ | ------------------------ | ------------------------------------------ |
1453
+ | `AssertDeleteDocContext` | `HookContext<DocContext<DocAssertDelete>>` |
797
1454
 
798
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L69)
1455
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L154)
799
1456
 
800
1457
  #### :gear: SatelliteEnv
801
1458
 
@@ -812,25 +1469,219 @@ Currently unused, but it may support features such as:
812
1469
 
813
1470
  [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/satellite.env.ts#L15)
814
1471
 
1472
+ #### :gear: HeaderField
1473
+
1474
+ Represents a single HTTP header as a tuple of name and value.
1475
+
1476
+ | Type | Type |
1477
+ | ------------- | ------------------ |
1478
+ | `HeaderField` | `[string, string]` |
1479
+
1480
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L24)
1481
+
1482
+ #### :gear: Blob
1483
+
1484
+ Binary content used in asset encoding.
1485
+
1486
+ | Type | Type |
1487
+ | ------ | ------------ |
1488
+ | `Blob` | `Uint8Array` |
1489
+
1490
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L34)
1491
+
1492
+ #### :gear: BlobOrKey
1493
+
1494
+ When stable memory is used, chunks are saved within a StableBTreeMap and their keys - StableEncodingChunkKey - are saved for reference as serialized values
1495
+
1496
+ | Type | Type |
1497
+ | ----------- | ------------ |
1498
+ | `BlobOrKey` | `Uint8Array` |
1499
+
1500
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L44)
1501
+
1502
+ #### :gear: Hash
1503
+
1504
+ Represents a SHA-256 hash as a 32-byte binary value.
1505
+
1506
+ | Type | Type |
1507
+ | ------ | ------------ |
1508
+ | `Hash` | `Uint8Array` |
1509
+
1510
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L56)
1511
+
1512
+ #### :gear: EncodingType
1513
+
1514
+ A string identifier representing a specific encoding format (e.g., "gzip", "identity").
1515
+
1516
+ | Type | Type |
1517
+ | -------------- | ---- |
1518
+ | `EncodingType` | |
1519
+
1520
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L198)
1521
+
1522
+ #### :gear: ReferenceId
1523
+
1524
+ A unique reference identifier for batches.
1525
+
1526
+ | Type | Type |
1527
+ | ------------- | ---- |
1528
+ | `ReferenceId` | |
1529
+
1530
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L208)
1531
+
1532
+ #### :gear: ChunkId
1533
+
1534
+ A unique identifier representing a single chunk of data.
1535
+
1536
+ | Type | Type |
1537
+ | --------- | ---- |
1538
+ | `ChunkId` | |
1539
+
1540
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L255)
1541
+
1542
+ #### :gear: BatchId
1543
+
1544
+ A unique identifier representing a batch of upload.
1545
+
1546
+ | Type | Type |
1547
+ | --------- | ---- |
1548
+ | `BatchId` | |
1549
+
1550
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L265)
1551
+
1552
+ #### :gear: OnUploadAssetContext
1553
+
1554
+ Context for the `onUploadAsset` hook.
1555
+
1556
+ This context contains information about the asset that was uploaded.
1557
+
1558
+ | Type | Type |
1559
+ | ---------------------- | -------------------- |
1560
+ | `OnUploadAssetContext` | `HookContext<Asset>` |
1561
+
1562
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L16)
1563
+
1564
+ #### :gear: OnDeleteAssetContext
1565
+
1566
+ Context for the `onDeleteAsset` hook.
1567
+
1568
+ This context contains information about a single asset being deleted, along with details about the user who triggered the operation.
1569
+
1570
+ If undefined, the asset did not exist.
1571
+
1572
+ | Type | Type |
1573
+ | ---------------------- | --------------------------------- |
1574
+ | `OnDeleteAssetContext` | `HookContext<Asset or undefined>` |
1575
+
1576
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L30)
1577
+
1578
+ #### :gear: OnDeleteManyAssetsContext
1579
+
1580
+ Context for the `onDeleteManyAssets` hook.
1581
+
1582
+ This context contains information about multiple assets being potentially deleted, along with details about the user who triggered the operation.
1583
+
1584
+ | Type | Type |
1585
+ | --------------------------- | ---------------------------------------- |
1586
+ | `OnDeleteManyAssetsContext` | `HookContext<Array<Asset or undefined>>` |
1587
+
1588
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L42)
1589
+
1590
+ #### :gear: OnDeleteFilteredAssetsContext
1591
+
1592
+ Context for the `onDeleteFilteredAssets` hook.
1593
+
1594
+ This context contains information about documents deleted as a result of a filter, along with details about the user who triggered the operation.
1595
+
1596
+ | Type | Type |
1597
+ | ------------------------------- | ---------------------------------------- |
1598
+ | `OnDeleteFilteredAssetsContext` | `HookContext<Array<Asset or undefined>>` |
1599
+
1600
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L56)
1601
+
1602
+ #### :gear: AssertUploadAssetContext
1603
+
1604
+ Context for the `assertUploadAsset` hook.
1605
+
1606
+ This context contains information about the asset being validated before it is uploaded. If validation fails, the developer should throw an error.
1607
+
1608
+ | Type | Type |
1609
+ | -------------------------- | -------------------------------- |
1610
+ | `AssertUploadAssetContext` | `HookContext<AssetAssertUpload>` |
1611
+
1612
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L68)
1613
+
1614
+ #### :gear: AssertDeleteAssetContext
1615
+
1616
+ Context for the `assertDeleteAsset` hook.
1617
+
1618
+ This context contains information about the asset being validated before it is deleted. If validation fails, the developer should throw an error.
1619
+
1620
+ | Type | Type |
1621
+ | -------------------------- | -------------------- |
1622
+ | `AssertDeleteAssetContext` | `HookContext<Asset>` |
1623
+
1624
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L80)
1625
+
1626
+ #### :gear: OnAssert
1627
+
1628
+ A generic schema for defining assertions related to collections.
1629
+
1630
+ | Type | Type |
1631
+ | ---------- | ------------------------------------------------ |
1632
+ | `OnAssert` | `Collections and { assert: AssertFunction<T>; }` |
1633
+
1634
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L37)
1635
+
815
1636
  #### :gear: AssertSetDoc
816
1637
 
817
1638
  An assertion that runs when a document is created or updated.
818
1639
 
819
- | Type | Type |
820
- | -------------- | ------------------------------------ |
821
- | `AssertSetDoc` | `z.infer<typeof AssertSetDocSchema>` |
1640
+ | Type | Type |
1641
+ | -------------- | ------------------------------- |
1642
+ | `AssertSetDoc` | `OnAssert<AssertSetDocContext>` |
1643
+
1644
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L49)
1645
+
1646
+ #### :gear: AssertDeleteDoc
1647
+
1648
+ An assertion that runs when a document is deleted.
1649
+
1650
+ | Type | Type |
1651
+ | ----------------- | ---------------------------------- |
1652
+ | `AssertDeleteDoc` | `OnAssert<AssertDeleteDocContext>` |
1653
+
1654
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L59)
1655
+
1656
+ #### :gear: AssertUploadAsset
1657
+
1658
+ An assertion that runs before an asset is uploaded.
1659
+
1660
+ | Type | Type |
1661
+ | ------------------- | ------------------------------------ |
1662
+ | `AssertUploadAsset` | `OnAssert<AssertUploadAssetContext>` |
1663
+
1664
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L69)
1665
+
1666
+ #### :gear: AssertDeleteAsset
1667
+
1668
+ An assertion that runs before an asset is deleted.
1669
+
1670
+ | Type | Type |
1671
+ | ------------------- | ------------------------------------ |
1672
+ | `AssertDeleteAsset` | `OnAssert<AssertDeleteAssetContext>` |
822
1673
 
823
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L31)
1674
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L79)
824
1675
 
825
1676
  #### :gear: Assert
826
1677
 
827
1678
  All assertions definitions.
828
1679
 
829
- | Type | Type |
830
- | -------- | ------------------------------ |
831
- | `Assert` | `z.infer<typeof AssertSchema>` |
1680
+ | Type | Type |
1681
+ | -------- | --------------------------------------------------------------------------- |
1682
+ | `Assert` | `AssertSetDoc or AssertDeleteDoc or AssertUploadAsset or AssertDeleteAsset` |
832
1683
 
833
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L42)
1684
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L94)
834
1685
 
835
1686
  #### :gear: AssertFn
836
1687
 
@@ -838,7 +1689,7 @@ All assertions definitions.
838
1689
  | ---------- | --------------------------------------------------- |
839
1690
  | `AssertFn` | `(assert: z.infer<typeof SatelliteEnvSchema>) => T` |
840
1691
 
841
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L46)
1692
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L98)
842
1693
 
843
1694
  #### :gear: AssertFnOrObject
844
1695
 
@@ -846,27 +1697,117 @@ All assertions definitions.
846
1697
  | ------------------ | ------------------ |
847
1698
  | `AssertFnOrObject` | `T or AssertFn<T>` |
848
1699
 
849
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L50)
1700
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L102)
1701
+
1702
+ #### :gear: OnHook
1703
+
1704
+ A generic schema for defining hooks related to collections.
1705
+
1706
+ | Type | Type |
1707
+ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1708
+ | `OnHook` | `Collections and { /** * A function that runs when the hook is triggered for the specified collections. * * @param {T} context - Contains information about the affected document(s). * @returns {Promise<void>} Resolves when the operation completes. */ run: RunFunction<T>; }` |
1709
+
1710
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L41)
850
1711
 
851
1712
  #### :gear: OnSetDoc
852
1713
 
853
1714
  A hook that runs when a document is created or updated.
854
1715
 
855
- | Type | Type |
856
- | ---------- | -------------------------------- |
857
- | `OnSetDoc` | `z.infer<typeof OnSetDocSchema>` |
1716
+ | Type | Type |
1717
+ | ---------- | ------------------------- |
1718
+ | `OnSetDoc` | `OnHook<OnSetDocContext>` |
1719
+
1720
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L59)
1721
+
1722
+ #### :gear: OnSetManyDocs
1723
+
1724
+ A hook that runs when multiple documents are created or updated.
1725
+
1726
+ | Type | Type |
1727
+ | --------------- | ------------------------------ |
1728
+ | `OnSetManyDocs` | `OnHook<OnSetManyDocsContext>` |
1729
+
1730
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L69)
1731
+
1732
+ #### :gear: OnDeleteDoc
1733
+
1734
+ A hook that runs when a single document is deleted.
858
1735
 
859
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L31)
1736
+ | Type | Type |
1737
+ | ------------- | ---------------------------- |
1738
+ | `OnDeleteDoc` | `OnHook<OnDeleteDocContext>` |
1739
+
1740
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L79)
1741
+
1742
+ #### :gear: OnDeleteManyDocs
1743
+
1744
+ A hook that runs when multiple documents are deleted.
1745
+
1746
+ | Type | Type |
1747
+ | ------------------ | --------------------------------- |
1748
+ | `OnDeleteManyDocs` | `OnHook<OnDeleteManyDocsContext>` |
1749
+
1750
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L89)
1751
+
1752
+ #### :gear: OnDeleteFilteredDocs
1753
+
1754
+ A hook that runs when a filtered set of documents is deleted based on query conditions.
1755
+
1756
+ | Type | Type |
1757
+ | ---------------------- | ------------------------------------- |
1758
+ | `OnDeleteFilteredDocs` | `OnHook<OnDeleteFilteredDocsContext>` |
1759
+
1760
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L99)
1761
+
1762
+ #### :gear: OnUploadAsset
1763
+
1764
+ A hook that runs when a single asset is uploaded.
1765
+
1766
+ | Type | Type |
1767
+ | --------------- | ------------------------------ |
1768
+ | `OnUploadAsset` | `OnHook<OnUploadAssetContext>` |
1769
+
1770
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L109)
1771
+
1772
+ #### :gear: OnDeleteAsset
1773
+
1774
+ A hook that runs when a single asset is potentially deleted.
1775
+
1776
+ | Type | Type |
1777
+ | --------------- | ------------------------------ |
1778
+ | `OnDeleteAsset` | `OnHook<OnDeleteAssetContext>` |
1779
+
1780
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L119)
1781
+
1782
+ #### :gear: OnDeleteManyAssets
1783
+
1784
+ A hook that runs when multiple assets are potentially deleted.
1785
+
1786
+ | Type | Type |
1787
+ | -------------------- | ----------------------------------- |
1788
+ | `OnDeleteManyAssets` | `OnHook<OnDeleteManyAssetsContext>` |
1789
+
1790
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L129)
1791
+
1792
+ #### :gear: OnDeleteFilteredAssets
1793
+
1794
+ A hook that runs when a filtered set of assets is deleted based on query conditions.
1795
+
1796
+ | Type | Type |
1797
+ | ------------------------ | --------------------------------------- |
1798
+ | `OnDeleteFilteredAssets` | `OnHook<OnDeleteFilteredAssetsContext>` |
1799
+
1800
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L139)
860
1801
 
861
1802
  #### :gear: Hook
862
1803
 
863
1804
  All hooks definitions.
864
1805
 
865
- | Type | Type |
866
- | ------ | ---------------------------- |
867
- | `Hook` | `z.infer<typeof HookSchema>` |
1806
+ | Type | Type |
1807
+ | ------ | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1808
+ | `Hook` | ` | OnSetDoc or OnSetManyDocs or OnDeleteDoc or OnDeleteManyDocs or OnDeleteFilteredDocs or OnUploadAsset or OnDeleteAsset or OnDeleteManyAssets or OnDeleteFilteredAssets` |
868
1809
 
869
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L42)
1810
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L159)
870
1811
 
871
1812
  #### :gear: HookFn
872
1813
 
@@ -874,7 +1815,7 @@ All hooks definitions.
874
1815
  | -------- | ------------------------------------------------- |
875
1816
  | `HookFn` | `(hook: z.infer<typeof SatelliteEnvSchema>) => T` |
876
1817
 
877
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L46)
1818
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L172)
878
1819
 
879
1820
  #### :gear: HookFnOrObject
880
1821
 
@@ -882,19 +1823,47 @@ All hooks definitions.
882
1823
  | ---------------- | ---------------- |
883
1824
  | `HookFnOrObject` | `T or HookFn<T>` |
884
1825
 
885
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L50)
1826
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L176)
886
1827
 
887
- #### :gear: SetDoc
1828
+ #### :gear: ControllerScope
888
1829
 
889
- Represents a request to set or update a document.
1830
+ Represents the permission scope of a controller.
890
1831
 
891
- This is used when submitting new document data.
1832
+ | Type | Type |
1833
+ | ----------------- | --------------------------------------- |
1834
+ | `ControllerScope` | `z.infer<typeof ControllerScopeSchema>` |
892
1835
 
893
- | Type | Type |
894
- | -------- | ------------------------------ |
895
- | `SetDoc` | `z.infer<typeof SetDocSchema>` |
1836
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L20)
896
1837
 
897
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L44)
1838
+ #### :gear: Metadata
1839
+
1840
+ Represents a single metadata entry as a key-value tuple.
1841
+
1842
+ | Type | Type |
1843
+ | ---------- | -------------------------------- |
1844
+ | `Metadata` | `z.infer<typeof MetadataSchema>` |
1845
+
1846
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L30)
1847
+
1848
+ #### :gear: ControllerRecord
1849
+
1850
+ Represents a tuple containing the principal ID and associated controller data.
1851
+
1852
+ | Type | Type |
1853
+ | ------------------ | ---------------------------------------- |
1854
+ | `ControllerRecord` | `z.infer<typeof ControllerRecordSchema>` |
1855
+
1856
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L84)
1857
+
1858
+ #### :gear: Controllers
1859
+
1860
+ Represents a list of controllers.
1861
+
1862
+ | Type | Type |
1863
+ | ------------- | ----------------------------------- |
1864
+ | `Controllers` | `z.infer<typeof ControllersSchema>` |
1865
+
1866
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L94)
898
1867
 
899
1868
  #### :gear: SetDocStoreParams
900
1869
 
@@ -903,11 +1872,24 @@ Represents the parameters required to store or update a document.
903
1872
  This includes the document data along with metadata such as the caller,
904
1873
  collection, and key.
905
1874
 
906
- | Type | Type |
907
- | ------------------- | ----------------------------------------- |
908
- | `SetDocStoreParams` | `z.infer<typeof SetDocStoreParamsSchema>` |
1875
+ | Type | Type |
1876
+ | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
1877
+ | `SetDocStoreParams` | `DocStoreParams and { /** * The data, optional description and version required to create or update a document. */ doc: SetDoc; }` |
909
1878
 
910
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L74)
1879
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L56)
1880
+
1881
+ #### :gear: DeleteDocStoreParams
1882
+
1883
+ Represents the parameters required to delete a document.
1884
+
1885
+ This includes the document version along with metadata such as the caller,
1886
+ collection, and key.
1887
+
1888
+ | Type | Type |
1889
+ | ---------------------- | ----------------------------------------------------------------------------------------- |
1890
+ | `DeleteDocStoreParams` | `DocStoreParams and { /** * The version required to delete a document. */ doc: DelDoc; }` |
1891
+
1892
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L76)
911
1893
 
912
1894
  #### :gear: IDLType
913
1895
 
@@ -917,7 +1899,7 @@ Custom validation function to verify if a value is an instance of `IDL.Type` fro
917
1899
  | --------- | ------------------------------- |
918
1900
  | `IDLType` | `z.infer<typeof IDLTypeSchema>` |
919
1901
 
920
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L15)
1902
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L16)
921
1903
 
922
1904
  #### :gear: CallArg
923
1905
 
@@ -927,7 +1909,7 @@ A call argument consisting of its IDL type and corresponding value.
927
1909
  | --------- | ------------------------------- |
928
1910
  | `CallArg` | `z.infer<typeof CallArgSchema>` |
929
1911
 
930
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L25)
1912
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L26)
931
1913
 
932
1914
  #### :gear: CallArgs
933
1915
 
@@ -943,7 +1925,7 @@ The order of arguments is preserved for the function call.
943
1925
  | ---------- | -------------------------------- |
944
1926
  | `CallArgs` | `z.infer<typeof CallArgsSchema>` |
945
1927
 
946
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L43)
1928
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L44)
947
1929
 
948
1930
  #### :gear: CallResult
949
1931
 
@@ -953,17 +1935,7 @@ Defines the type used to decode the result of a canister call.
953
1935
  | ------------ | ---------------------------------- |
954
1936
  | `CallResult` | `z.infer<typeof CallResultSchema>` |
955
1937
 
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)
1938
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L54)
967
1939
 
968
1940
  <!-- TSDOC_END -->
969
1941