@junobuild/functions 0.0.12 → 0.0.13

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
@@ -31,6 +31,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
31
31
  - [defineHook](#gear-definehook)
32
32
  - [defineHook](#gear-definehook)
33
33
  - [setDocStore](#gear-setdocstore)
34
+ - [deleteDocStore](#gear-deletedocstore)
34
35
  - [decodeDocData](#gear-decodedocdata)
35
36
  - [encodeDocData](#gear-encodedocdata)
36
37
  - [call](#gear-call)
@@ -50,7 +51,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
50
51
  | ---------------------- | ----------------------------------------------------------------------------------------------- |
51
52
  | `AssertFunctionSchema` | `<T extends z.ZodTypeAny>(contextSchema: T) => ZodFunction<ZodTuple<[T], ZodUnknown>, ZodVoid>` |
52
53
 
53
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/context.ts#L41)
54
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/context.ts#L44)
54
55
 
55
56
  #### :gear: RunFunctionSchema
56
57
 
@@ -58,7 +59,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
58
59
  | ------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
59
60
  | `RunFunctionSchema` | `<T extends z.ZodTypeAny>(contextSchema: T) => ZodFunction<ZodTuple<[T], ZodUnknown>, ZodUnion<[ZodPromise<ZodVoid>, ZodVoid]>>` |
60
61
 
61
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/context.ts#L56)
62
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/context.ts#L59)
62
63
 
63
64
  #### :gear: DocContextSchema
64
65
 
@@ -66,7 +67,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
66
67
  | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
67
68
  | `DocContextSchema` | `<T extends z.ZodTypeAny>(dataSchema: T) => ZodObject<typeof schemaShape, "strict", ZodTypeAny, baseObjectOutputType<typeof schemaShape>, baseObjectInputType<typeof schemaShape>>` |
68
69
 
69
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L10)
70
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L18)
70
71
 
71
72
  #### :gear: AssertFnSchema
72
73
 
@@ -74,7 +75,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
74
75
  | ---------------- | ----------------------------------------------------------------------------------------------------------------------- |
75
76
  | `AssertFnSchema` | `<T extends z.ZodTypeAny>(assertSchema: T) => ZodFunction<ZodTuple<[ZodRecord<ZodString, ZodUnknown>], ZodUnknown>, T>` |
76
77
 
77
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L44)
78
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L96)
78
79
 
79
80
  #### :gear: AssertFnOrObjectSchema
80
81
 
@@ -82,7 +83,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
82
83
  | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------- |
83
84
  | `AssertFnOrObjectSchema` | `<T extends z.ZodTypeAny>(assertSchema: T) => ZodUnion<[T, ZodFunction<ZodTuple<[ZodRecord<ZodString, ZodUnknown>], ZodUnknown>, T>]>` |
84
85
 
85
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L48)
86
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L100)
86
87
 
87
88
  #### :gear: defineAssert
88
89
 
@@ -90,7 +91,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
90
91
  | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
91
92
  | `defineAssert` | `{ <T extends Assert>(assert: T): T; <T extends Assert>(assert: AssertFn<T>): AssertFn<T>; <T extends Assert>(assert: AssertFnOrObject<T>): AssertFnOrObject<T>; }` |
92
93
 
93
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L52)
94
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L104)
94
95
 
95
96
  #### :gear: defineAssert
96
97
 
@@ -98,7 +99,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
98
99
  | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
99
100
  | `defineAssert` | `{ <T extends Assert>(assert: T): T; <T extends Assert>(assert: AssertFn<T>): AssertFn<T>; <T extends Assert>(assert: AssertFnOrObject<T>): AssertFnOrObject<T>; }` |
100
101
 
101
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L53)
102
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L105)
102
103
 
103
104
  #### :gear: defineAssert
104
105
 
@@ -106,7 +107,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
106
107
  | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
107
108
  | `defineAssert` | `{ <T extends Assert>(assert: T): T; <T extends Assert>(assert: AssertFn<T>): AssertFn<T>; <T extends Assert>(assert: AssertFnOrObject<T>): AssertFnOrObject<T>; }` |
108
109
 
109
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L54)
110
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L106)
110
111
 
111
112
  #### :gear: defineAssert
112
113
 
@@ -114,7 +115,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
114
115
  | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
115
116
  | `defineAssert` | `{ <T extends Assert>(assert: T): T; <T extends Assert>(assert: AssertFn<T>): AssertFn<T>; <T extends Assert>(assert: AssertFnOrObject<T>): AssertFnOrObject<T>; }` |
116
117
 
117
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L55)
118
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L107)
118
119
 
119
120
  #### :gear: HookFnSchema
120
121
 
@@ -122,7 +123,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
122
123
  | -------------- | --------------------------------------------------------------------------------------------------------------------- |
123
124
  | `HookFnSchema` | `<T extends z.ZodTypeAny>(hookSchema: T) => ZodFunction<ZodTuple<[ZodRecord<ZodString, ZodUnknown>], ZodUnknown>, T>` |
124
125
 
125
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L44)
126
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L161)
126
127
 
127
128
  #### :gear: HookFnOrObjectSchema
128
129
 
@@ -130,7 +131,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
130
131
  | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
131
132
  | `HookFnOrObjectSchema` | `<T extends z.ZodTypeAny>(hookSchema: T) => ZodUnion<[T, ZodFunction<ZodTuple<[ZodRecord<ZodString, ZodUnknown>], ZodUnknown>, T>]>` |
132
133
 
133
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L48)
134
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L165)
134
135
 
135
136
  #### :gear: defineHook
136
137
 
@@ -138,7 +139,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
138
139
  | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
139
140
  | `defineHook` | `{ <T extends Hook>(hook: T): T; <T extends Hook>(hook: HookFn<T>): HookFn<T>; <T extends Hook>(hook: HookFnOrObject<T>): HookFnOrObject<T>; }` |
140
141
 
141
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L52)
142
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L169)
142
143
 
143
144
  #### :gear: defineHook
144
145
 
@@ -146,7 +147,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
146
147
  | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
147
148
  | `defineHook` | `{ <T extends Hook>(hook: T): T; <T extends Hook>(hook: HookFn<T>): HookFn<T>; <T extends Hook>(hook: HookFnOrObject<T>): HookFnOrObject<T>; }` |
148
149
 
149
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L53)
150
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L170)
150
151
 
151
152
  #### :gear: defineHook
152
153
 
@@ -154,7 +155,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
154
155
  | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
155
156
  | `defineHook` | `{ <T extends Hook>(hook: T): T; <T extends Hook>(hook: HookFn<T>): HookFn<T>; <T extends Hook>(hook: HookFnOrObject<T>): HookFnOrObject<T>; }` |
156
157
 
157
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L54)
158
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L171)
158
159
 
159
160
  #### :gear: defineHook
160
161
 
@@ -162,7 +163,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
162
163
  | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
163
164
  | `defineHook` | `{ <T extends Hook>(hook: T): T; <T extends Hook>(hook: HookFn<T>): HookFn<T>; <T extends Hook>(hook: HookFnOrObject<T>): HookFnOrObject<T>; }` |
164
165
 
165
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L55)
166
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L172)
166
167
 
167
168
  #### :gear: setDocStore
168
169
 
@@ -170,16 +171,31 @@ Stores or updates a document in the datastore.
170
171
 
171
172
  The data must have been encoded - using encodeDocData - before calling this function.
172
173
 
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` |
174
+ | Function | Type |
175
+ | ------------- | ------------------------------------- |
176
+ | `setDocStore` | `(params: SetDocStoreParams) => void` |
176
177
 
177
178
  Parameters:
178
179
 
179
180
  - `params`: - The parameters required to store the document,
180
181
  including the caller, collection, key, and document data.
181
182
 
182
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/db.sdk.ts#L15)
183
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/db.sdk.ts#L20)
184
+
185
+ #### :gear: deleteDocStore
186
+
187
+ Delete a document in the datastore.
188
+
189
+ | Function | Type |
190
+ | ---------------- | ---------------------------------------- |
191
+ | `deleteDocStore` | `(params: DeleteDocStoreParams) => void` |
192
+
193
+ Parameters:
194
+
195
+ - `params`: - The parameters required to delete the document,
196
+ including the caller, collection, key, and version of the document.
197
+
198
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/db.sdk.ts#L40)
183
199
 
184
200
  #### :gear: decodeDocData
185
201
 
@@ -216,9 +232,9 @@ Makes an asynchronous call to a canister on the Internet Computer.
216
232
  This function encodes the provided arguments using Candid, performs the canister call,
217
233
  and decodes the response based on the expected result types.
218
234
 
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<...>` |
235
+ | Function | Type |
236
+ | -------- | --------------------------------------- |
237
+ | `call` | `<T>(params: CallParams) => Promise<T>` |
222
238
 
223
239
  Parameters:
224
240
 
@@ -242,7 +258,6 @@ the Principal of the executing canister.
242
258
 
243
259
  ### :wrench: Constants
244
260
 
245
- - [CollectionsSchema](#gear-collectionsschema)
246
261
  - [Uint8ArraySchema](#gear-uint8arrayschema)
247
262
  - [RawPrincipalSchema](#gear-rawprincipalschema)
248
263
  - [PrincipalSchema](#gear-principalschema)
@@ -252,35 +267,57 @@ the Principal of the executing canister.
252
267
  - [UserIdSchema](#gear-useridschema)
253
268
  - [CollectionSchema](#gear-collectionschema)
254
269
  - [KeySchema](#gear-keyschema)
255
- - [DocDescriptionSchema](#gear-docdescriptionschema)
270
+ - [DescriptionSchema](#gear-descriptionschema)
271
+ - [CollectionsSchema](#gear-collectionsschema)
256
272
  - [RawDataSchema](#gear-rawdataschema)
257
273
  - [DocSchema](#gear-docschema)
274
+ - [OptionDocSchema](#gear-optiondocschema)
275
+ - [SetDocSchema](#gear-setdocschema)
276
+ - [DelDocSchema](#gear-deldocschema)
258
277
  - [DocUpsertSchema](#gear-docupsertschema)
259
- - [ProposedDocSchema](#gear-proposeddocschema)
260
278
  - [DocAssertSetSchema](#gear-docassertsetschema)
279
+ - [DocAssertDeleteSchema](#gear-docassertdeleteschema)
261
280
  - [OnSetDocContextSchema](#gear-onsetdoccontextschema)
281
+ - [OnSetManyDocsContextSchema](#gear-onsetmanydocscontextschema)
282
+ - [OnDeleteDocContextSchema](#gear-ondeletedoccontextschema)
283
+ - [OnDeleteManyDocsContextSchema](#gear-ondeletemanydocscontextschema)
284
+ - [OnDeleteFilteredDocsContextSchema](#gear-ondeletefiltereddocscontextschema)
262
285
  - [AssertSetDocContextSchema](#gear-assertsetdoccontextschema)
286
+ - [AssertDeleteDocContextSchema](#gear-assertdeletedoccontextschema)
263
287
  - [SatelliteEnvSchema](#gear-satelliteenvschema)
288
+ - [AssetSchema](#gear-assetschema)
289
+ - [BatchSchema](#gear-batchschema)
290
+ - [CommitBatchSchema](#gear-commitbatchschema)
291
+ - [AssetAssertUploadSchema](#gear-assetassertuploadschema)
292
+ - [OnUploadAssetContextSchema](#gear-onuploadassetcontextschema)
293
+ - [OnDeleteAssetContextSchema](#gear-ondeleteassetcontextschema)
294
+ - [OnDeleteManyAssetsContextSchema](#gear-ondeletemanyassetscontextschema)
295
+ - [OnDeleteFilteredAssetsContextSchema](#gear-ondeletefilteredassetscontextschema)
296
+ - [AssertUploadAssetContextSchema](#gear-assertuploadassetcontextschema)
297
+ - [AssertDeleteAssetContextSchema](#gear-assertdeleteassetcontextschema)
264
298
  - [AssertSetDocSchema](#gear-assertsetdocschema)
299
+ - [AssertDeleteDocSchema](#gear-assertdeletedocschema)
300
+ - [AssertUploadAssetSchema](#gear-assertuploadassetschema)
301
+ - [AssertDeleteAssetSchema](#gear-assertdeleteassetschema)
265
302
  - [AssertSchema](#gear-assertschema)
266
303
  - [OnSetDocSchema](#gear-onsetdocschema)
304
+ - [OnSetManyDocsSchema](#gear-onsetmanydocsschema)
305
+ - [OnDeleteDocSchema](#gear-ondeletedocschema)
306
+ - [OnDeleteManyDocsSchema](#gear-ondeletemanydocsschema)
307
+ - [OnDeleteFilteredDocsSchema](#gear-ondeletefiltereddocsschema)
308
+ - [OnUploadAssetSchema](#gear-onuploadassetschema)
309
+ - [OnDeleteAssetSchema](#gear-ondeleteassetschema)
310
+ - [OnDeleteManyAssetsSchema](#gear-ondeletemanyassetsschema)
311
+ - [OnDeleteFilteredAssetsSchema](#gear-ondeletefilteredassetsschema)
267
312
  - [HookSchema](#gear-hookschema)
268
- - [SetDocSchema](#gear-setdocschema)
269
313
  - [SetDocStoreParamsSchema](#gear-setdocstoreparamsschema)
314
+ - [DeleteDocStoreParamsSchema](#gear-deletedocstoreparamsschema)
270
315
  - [IDLTypeSchema](#gear-idltypeschema)
271
316
  - [CallArgSchema](#gear-callargschema)
272
317
  - [CallArgsSchema](#gear-callargsschema)
273
318
  - [CallResultSchema](#gear-callresultschema)
274
319
  - [CallParamsSchema](#gear-callparamsschema)
275
320
 
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
321
  #### :gear: Uint8ArraySchema
285
322
 
286
323
  A schema that validates a value is an Uint8Array.
@@ -355,13 +392,21 @@ A schema that validates a value is an Uint8Array.
355
392
 
356
393
  [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L65)
357
394
 
358
- #### :gear: DocDescriptionSchema
395
+ #### :gear: DescriptionSchema
396
+
397
+ | Constant | Type |
398
+ | ------------------- | ----------- |
399
+ | `DescriptionSchema` | `ZodString` |
359
400
 
360
- | Constant | Type |
361
- | ---------------------- | ----------- |
362
- | `DocDescriptionSchema` | `ZodString` |
401
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L75)
363
402
 
364
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L8)
403
+ #### :gear: CollectionsSchema
404
+
405
+ | Constant | Type |
406
+ | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
407
+ | `CollectionsSchema` | `ZodObject<{ collections: ZodReadonly<ZodArray<ZodString, "many">>; }, "strict", ZodTypeAny, { collections: readonly string[]; }, { collections: readonly string[]; }>` |
408
+
409
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/collections.ts#L7)
365
410
 
366
411
  #### :gear: RawDataSchema
367
412
 
@@ -369,7 +414,7 @@ A schema that validates a value is an Uint8Array.
369
414
  | --------------- | ------------------------------------------------------------------------------- |
370
415
  | `RawDataSchema` | `ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>` |
371
416
 
372
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L18)
417
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L17)
373
418
 
374
419
  #### :gear: DocSchema
375
420
 
@@ -377,7 +422,31 @@ A schema that validates a value is an Uint8Array.
377
422
  | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
378
423
  | `DocSchema` | `ZodObject<{ owner: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; ... 4 more ...; version: ZodOptional<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>` |
379
424
 
380
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L30)
425
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L29)
426
+
427
+ #### :gear: OptionDocSchema
428
+
429
+ | Constant | Type |
430
+ | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
431
+ | `OptionDocSchema` | `ZodOptional<ZodObject<{ owner: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; ... 4 more ...; version: ZodOptional<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>>` |
432
+
433
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L79)
434
+
435
+ #### :gear: SetDocSchema
436
+
437
+ | Constant | Type |
438
+ | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
439
+ | `SetDocSchema` | `ZodObject<{ data: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; description: ZodOptional<...>; version: ZodOptional<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>` |
440
+
441
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L89)
442
+
443
+ #### :gear: DelDocSchema
444
+
445
+ | Constant | Type |
446
+ | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
447
+ | `DelDocSchema` | `ZodObject<{ version: ZodOptional<ZodBigInt>; }, "strict", ZodTypeAny, { version?: bigint or undefined; }, { version?: bigint or undefined; }>` |
448
+
449
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L121)
381
450
 
382
451
  #### :gear: DocUpsertSchema
383
452
 
@@ -385,15 +454,7 @@ A schema that validates a value is an Uint8Array.
385
454
  | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
386
455
  | `DocUpsertSchema` | `ZodObject<{ before: ZodOptional<ZodObject<{ owner: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; ... 4 more ...; version: ZodOptional<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>>; after: ZodObject<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>` |
387
456
 
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)
457
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/payload.ts#L14)
397
458
 
398
459
  #### :gear: DocAssertSetSchema
399
460
 
@@ -401,7 +462,15 @@ A schema that validates a value is an Uint8Array.
401
462
  | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
402
463
  | `DocAssertSetSchema` | `ZodObject<{ current: ZodOptional<ZodObject<{ owner: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; ... 4 more ...; version: ZodOptional<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>>; proposed: ZodObject<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>` |
403
464
 
404
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/payload.ts#L61)
465
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/payload.ts#L41)
466
+
467
+ #### :gear: DocAssertDeleteSchema
468
+
469
+ | Constant | Type |
470
+ | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
471
+ | `DocAssertDeleteSchema` | `ZodObject<{ current: ZodOptional<ZodObject<{ owner: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; ... 4 more ...; version: ZodOptional<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>>; proposed: ZodObject<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>` |
472
+
473
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/payload.ts#L71)
405
474
 
406
475
  #### :gear: OnSetDocContextSchema
407
476
 
@@ -409,7 +478,39 @@ A schema that validates a value is an Uint8Array.
409
478
  | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
410
479
  | `OnSetDocContextSchema` | `ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; data: ZodObject<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>` |
411
480
 
412
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L48)
481
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L60)
482
+
483
+ #### :gear: OnSetManyDocsContextSchema
484
+
485
+ | Constant | Type |
486
+ | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
487
+ | `OnSetManyDocsContextSchema` | `ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; data: ZodArray<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>` |
488
+
489
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L73)
490
+
491
+ #### :gear: OnDeleteDocContextSchema
492
+
493
+ | Constant | Type |
494
+ | -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
495
+ | `OnDeleteDocContextSchema` | `ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; data: ZodObject<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>` |
496
+
497
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L88)
498
+
499
+ #### :gear: OnDeleteManyDocsContextSchema
500
+
501
+ | Constant | Type |
502
+ | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
503
+ | `OnDeleteManyDocsContextSchema` | `ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; data: ZodArray<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>` |
504
+
505
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L101)
506
+
507
+ #### :gear: OnDeleteFilteredDocsContextSchema
508
+
509
+ | Constant | Type |
510
+ | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
511
+ | `OnDeleteFilteredDocsContextSchema` | `ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; data: ZodArray<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>` |
512
+
513
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L116)
413
514
 
414
515
  #### :gear: AssertSetDocContextSchema
415
516
 
@@ -417,7 +518,15 @@ A schema that validates a value is an Uint8Array.
417
518
  | --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
418
519
  | `AssertSetDocContextSchema` | `ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; data: ZodObject<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>` |
419
520
 
420
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L61)
521
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L131)
522
+
523
+ #### :gear: AssertDeleteDocContextSchema
524
+
525
+ | Constant | Type |
526
+ | ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
527
+ | `AssertDeleteDocContextSchema` | `ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; data: ZodObject<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>` |
528
+
529
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L144)
421
530
 
422
531
  #### :gear: SatelliteEnvSchema
423
532
 
@@ -427,21 +536,125 @@ A schema that validates a value is an Uint8Array.
427
536
 
428
537
  [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/satellite.env.ts#L6)
429
538
 
539
+ #### :gear: AssetSchema
540
+
541
+ | Constant | Type |
542
+ | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
543
+ | `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<...>; },...` |
544
+
545
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L144)
546
+
547
+ #### :gear: BatchSchema
548
+
549
+ | Constant | Type |
550
+ | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
551
+ | `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...` |
552
+
553
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L213)
554
+
555
+ #### :gear: CommitBatchSchema
556
+
557
+ | Constant | Type |
558
+ | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
559
+ | `CommitBatchSchema` | `ZodObject<{ batch_id: ZodBigInt; headers: ZodArray<ZodTuple<[ZodString, ZodString], null>, "many">; chunk_ids: ZodArray<ZodBigInt, "many">; }, "strict", ZodTypeAny, { ...; }, { ...; }>` |
560
+
561
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L270)
562
+
563
+ #### :gear: AssetAssertUploadSchema
564
+
565
+ | Constant | Type |
566
+ | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
567
+ | `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...` |
568
+
569
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/payload.ts#L14)
570
+
571
+ #### :gear: OnUploadAssetContextSchema
572
+
573
+ | Constant | Type |
574
+ | ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
575
+ | `OnUploadAssetContextSchema` | `ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; data: ZodObject<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>` |
576
+
577
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L9)
578
+
579
+ #### :gear: OnDeleteAssetContextSchema
580
+
581
+ | Constant | Type |
582
+ | ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
583
+ | `OnDeleteAssetContextSchema` | `ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; data: ZodOptional<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>` |
584
+
585
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L21)
586
+
587
+ #### :gear: OnDeleteManyAssetsContextSchema
588
+
589
+ | Constant | Type |
590
+ | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
591
+ | `OnDeleteManyAssetsContextSchema` | `ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; data: ZodArray<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>` |
592
+
593
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L35)
594
+
595
+ #### :gear: OnDeleteFilteredAssetsContextSchema
596
+
597
+ | Constant | Type |
598
+ | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
599
+ | `OnDeleteFilteredAssetsContextSchema` | `ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; data: ZodArray<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>` |
600
+
601
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L47)
602
+
603
+ #### :gear: AssertUploadAssetContextSchema
604
+
605
+ | Constant | Type |
606
+ | -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
607
+ | `AssertUploadAssetContextSchema` | `ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; data: ZodObject<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>` |
608
+
609
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L61)
610
+
611
+ #### :gear: AssertDeleteAssetContextSchema
612
+
613
+ | Constant | Type |
614
+ | -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
615
+ | `AssertDeleteAssetContextSchema` | `ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; data: ZodObject<...>; }, "strict", ZodTypeAny, baseObjectOutputType<...>, baseObjectInputType<...>>` |
616
+
617
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L73)
618
+
430
619
  #### :gear: AssertSetDocSchema
431
620
 
432
621
  | Constant | Type |
433
622
  | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
434
623
  | `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
624
 
436
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L26)
625
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L44)
626
+
627
+ #### :gear: AssertDeleteDocSchema
628
+
629
+ | Constant | Type |
630
+ | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
631
+ | `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...` |
632
+
633
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L54)
634
+
635
+ #### :gear: AssertUploadAssetSchema
636
+
637
+ | Constant | Type |
638
+ | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
639
+ | `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...` |
640
+
641
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L64)
642
+
643
+ #### :gear: AssertDeleteAssetSchema
644
+
645
+ | Constant | Type |
646
+ | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
647
+ | `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...` |
648
+
649
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L74)
437
650
 
438
651
  #### :gear: AssertSchema
439
652
 
440
653
  | Constant | Type |
441
654
  | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
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...` |
655
+ | `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
656
 
444
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L37)
657
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L84)
445
658
 
446
659
  #### :gear: OnSetDocSchema
447
660
 
@@ -449,31 +662,95 @@ A schema that validates a value is an Uint8Array.
449
662
  | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
450
663
  | `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
664
 
452
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L26)
665
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L54)
666
+
667
+ #### :gear: OnSetManyDocsSchema
668
+
669
+ | Constant | Type |
670
+ | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
671
+ | `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...` |
672
+
673
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L64)
674
+
675
+ #### :gear: OnDeleteDocSchema
676
+
677
+ | Constant | Type |
678
+ | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
679
+ | `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...` |
680
+
681
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L74)
682
+
683
+ #### :gear: OnDeleteManyDocsSchema
684
+
685
+ | Constant | Type |
686
+ | ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
687
+ | `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...` |
688
+
689
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L84)
690
+
691
+ #### :gear: OnDeleteFilteredDocsSchema
692
+
693
+ | Constant | Type |
694
+ | ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
695
+ | `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...` |
696
+
697
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L94)
698
+
699
+ #### :gear: OnUploadAssetSchema
700
+
701
+ | Constant | Type |
702
+ | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
703
+ | `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...` |
704
+
705
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L104)
706
+
707
+ #### :gear: OnDeleteAssetSchema
708
+
709
+ | Constant | Type |
710
+ | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
711
+ | `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...` |
712
+
713
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L114)
714
+
715
+ #### :gear: OnDeleteManyAssetsSchema
716
+
717
+ | Constant | Type |
718
+ | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
719
+ | `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...` |
720
+
721
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L124)
722
+
723
+ #### :gear: OnDeleteFilteredAssetsSchema
724
+
725
+ | Constant | Type |
726
+ | ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
727
+ | `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...` |
728
+
729
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L134)
453
730
 
454
731
  #### :gear: HookSchema
455
732
 
456
733
  | Constant | Type |
457
734
  | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
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...` |
735
+ | `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
736
 
460
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L37)
737
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L144)
461
738
 
462
- #### :gear: SetDocSchema
739
+ #### :gear: SetDocStoreParamsSchema
463
740
 
464
- | Constant | Type |
465
- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
466
- | `SetDocSchema` | `ZodObject<{ key: ZodString; description: ZodOptional<ZodString>; data: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; version: ZodOptional<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>` |
741
+ | Constant | Type |
742
+ | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
743
+ | `SetDocStoreParamsSchema` | `ZodObject<extendShape<{ caller: ZodUnion<[ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>, ZodType<...>]>; collection: ZodString; key: ZodString; }, { ...; }>, "strict", ZodTypeAny, { ...; }, { ...; }>` |
467
744
 
468
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L14)
745
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L46)
469
746
 
470
- #### :gear: SetDocStoreParamsSchema
747
+ #### :gear: DeleteDocStoreParamsSchema
471
748
 
472
- | Constant | Type |
473
- | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
474
- | `SetDocStoreParamsSchema` | `ZodObject<{ caller: ZodUnion<[ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>, ZodType<...>]>; collection: ZodString; doc: ZodObject<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>` |
749
+ | Constant | Type |
750
+ | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
751
+ | `DeleteDocStoreParamsSchema` | `ZodObject<extendShape<{ caller: ZodUnion<[ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>, ZodType<...>]>; collection: ZodString; key: ZodString; }, { ...; }>, "strict", ZodTypeAny, { ...; }, { ...; }>` |
475
752
 
476
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L49)
753
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L66)
477
754
 
478
755
  #### :gear: IDLTypeSchema
479
756
 
@@ -481,7 +758,7 @@ A schema that validates a value is an Uint8Array.
481
758
  | --------------- | --------------------------------------------------- |
482
759
  | `IDLTypeSchema` | `ZodType<Type<unknown>, ZodTypeDef, Type<unknown>>` |
483
760
 
484
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L8)
761
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L9)
485
762
 
486
763
  #### :gear: CallArgSchema
487
764
 
@@ -489,7 +766,7 @@ A schema that validates a value is an Uint8Array.
489
766
  | --------------- | --------------------------------------------------------------------------------- |
490
767
  | `CallArgSchema` | `ZodTuple<[ZodType<Type<unknown>, ZodTypeDef, Type<unknown>>, ZodUnknown], null>` |
491
768
 
492
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L20)
769
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L21)
493
770
 
494
771
  #### :gear: CallArgsSchema
495
772
 
@@ -499,7 +776,7 @@ Schema for encoding the call arguments.
499
776
  | ---------------- | --------------------------------------------------------------------------------------------------- |
500
777
  | `CallArgsSchema` | `ZodArray<ZodTuple<[ZodType<Type<unknown>, ZodTypeDef, Type<unknown>>, ZodUnknown], null>, "many">` |
501
778
 
502
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L32)
779
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L33)
503
780
 
504
781
  #### :gear: CallResultSchema
505
782
 
@@ -507,7 +784,7 @@ Schema for encoding the call arguments.
507
784
  | ------------------ | --------------------------------------------------- |
508
785
  | `CallResultSchema` | `ZodType<Type<unknown>, ZodTypeDef, Type<unknown>>` |
509
786
 
510
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L48)
787
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L49)
511
788
 
512
789
  #### :gear: CallParamsSchema
513
790
 
@@ -515,15 +792,218 @@ Schema for encoding the call arguments.
515
792
  | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
516
793
  | `CallParamsSchema` | `ZodObject<{ canisterId: ZodUnion<[ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>, ZodType<...>]>; method: ZodString; args: ZodOptional<...>; result: ZodOptional<...>; }, "strip", ZodTypeAny, { ...; }, { ...; }>` |
517
794
 
518
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L58)
795
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L59)
519
796
 
520
797
  ### :factory: CallResponseLengthError
521
798
 
522
799
  [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/types/errors.ts#L1)
523
800
 
524
- ### :cocktail: Types
801
+ ### :tropical_drink: Interfaces
525
802
 
526
803
  - [Collections](#gear-collections)
804
+ - [HookContext](#gear-hookcontext)
805
+ - [Doc](#gear-doc)
806
+ - [SetDoc](#gear-setdoc)
807
+ - [DelDoc](#gear-deldoc)
808
+ - [DocUpsert](#gear-docupsert)
809
+ - [DocAssertSet](#gear-docassertset)
810
+ - [DocAssertDelete](#gear-docassertdelete)
811
+ - [DocContext](#gear-doccontext)
812
+ - [AssetKey](#gear-assetkey)
813
+ - [AssetEncoding](#gear-assetencoding)
814
+ - [Asset](#gear-asset)
815
+ - [Batch](#gear-batch)
816
+ - [CommitBatch](#gear-commitbatch)
817
+ - [AssetAssertUpload](#gear-assetassertupload)
818
+ - [DocStoreParams](#gear-docstoreparams)
819
+ - [CallParams](#gear-callparams)
820
+
821
+ #### :gear: Collections
822
+
823
+ Defines the collections where a hook or assertion should run.
824
+
825
+ | Property | Type | Description |
826
+ | ------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------ |
827
+ | `collections` | `readonly string[]` | An array of collection names where the hook or assertion will run. If empty, no hooks or assertions are triggered. |
828
+
829
+ #### :gear: HookContext
830
+
831
+ Represents the context provided to hooks, containing information about the caller and related data.
832
+
833
+ | Property | Type | Description |
834
+ | -------- | ----------------------------- | ------------------------------------------------------------------------------- |
835
+ | `caller` | `Uint8Array<ArrayBufferLike>` | The user who originally triggered the function that in turn triggered the hook. |
836
+ | `data` | `T` | The data associated with the hook execution. |
837
+
838
+ #### :gear: Doc
839
+
840
+ Represents a document stored in a collection.
841
+
842
+ | Property | Type | Description |
843
+ | ------------- | ----------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
844
+ | `owner` | `Uint8Array<ArrayBufferLike>` | The user who owns this document. |
845
+ | `data` | `Uint8Array<ArrayBufferLike>` | The raw data of the document. |
846
+ | `description` | `string or undefined` | An optional description of the document. |
847
+ | `created_at` | `bigint` | The timestamp when the document was first created. |
848
+ | `updated_at` | `bigint` | The timestamp when the document was last updated. |
849
+ | `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. |
850
+
851
+ #### :gear: SetDoc
852
+
853
+ Represents the proposed version of a document to be created or updated.
854
+ This can be validated before allowing the operation.
855
+
856
+ | Property | Type | Description |
857
+ | ------------- | ----------------------------- | -------------------------------------------------- |
858
+ | `data` | `Uint8Array<ArrayBufferLike>` | The raw data of the document. |
859
+ | `description` | `string or undefined` | An optional description of the document. |
860
+ | `version` | `bigint or undefined` | The expected version number to ensure consistency. |
861
+
862
+ #### :gear: DelDoc
863
+
864
+ Represents the proposed version of a document to be deleted.
865
+ This can be validated before allowing the operation.
866
+
867
+ | Property | Type | Description |
868
+ | --------- | --------------------- | -------------------------------------------------- |
869
+ | `version` | `bigint or undefined` | The expected version number to ensure consistency. |
870
+
871
+ #### :gear: DocUpsert
872
+
873
+ Represents a document update operation.
874
+
875
+ This is used in hooks where a document is either being created or updated.
876
+
877
+ | Property | Type | Description |
878
+ | -------- | ------------------ | -------------------------------------------------------------------------------------------- |
879
+ | `before` | `Doc or undefined` | The previous version of the document before the update. Undefined if this is a new document. |
880
+ | `after` | `Doc` | The new version of the document after the update. |
881
+
882
+ #### :gear: DocAssertSet
883
+
884
+ Represents a validation check before setting a document.
885
+
886
+ The developer can compare the `current` and `proposed` versions and
887
+ throw an error if their validation fails.
888
+
889
+ | Property | Type | Description |
890
+ | ---------- | ------------------ | ---------------------------------------------------------------------------------------------- |
891
+ | `current` | `Doc or undefined` | The current version of the document before the operation. Undefined if this is a new document. |
892
+ | `proposed` | `SetDoc` | The proposed version of the document. This can be validated before allowing the operation. |
893
+
894
+ #### :gear: DocAssertDelete
895
+
896
+ Represents a validation check before deleting a document.
897
+
898
+ The developer can compare the `current` and `proposed` versions and
899
+ throw an error if their validation fails.
900
+
901
+ | Property | Type | Description |
902
+ | ---------- | ------------------ | --------------------------------------------------------------------------------------------------- |
903
+ | `current` | `Doc or undefined` | The current version of the document before the operation. Undefined if the document does not exist. |
904
+ | `proposed` | `DelDoc` | The proposed version of the document. This can be validated before allowing the operation. |
905
+
906
+ #### :gear: DocContext
907
+
908
+ Represents the context of a document operation within a collection.
909
+
910
+ | Property | Type | Description |
911
+ | ------------ | -------- | -------------------------------------------------------------- |
912
+ | `collection` | `string` | The name of the collection where the document is stored. |
913
+ | `key` | `string` | The unique key identifying the document within the collection. |
914
+ | `data` | `T` | The data associated with the document operation. |
915
+
916
+ #### :gear: AssetKey
917
+
918
+ Metadata identifying an asset within a collection and the storage system.
919
+
920
+ | Property | Type | Description |
921
+ | ------------- | ----------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
922
+ | `name` | `string` | The name of the asset (e.g., "logo.png"). |
923
+ | `full_path` | `string` | The full relative path of the asset (e.g., "/images/logo.png"). |
924
+ | `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 |
925
+ | `collection` | `string` | The collection to which this asset belongs. |
926
+ | `owner` | `Uint8Array<ArrayBufferLike>` | The owner of the asset. |
927
+ | `description` | `string or undefined` | Optional description of the asset for indexing/search. |
928
+
929
+ #### :gear: AssetEncoding
930
+
931
+ Represents a specific encoding of an asset, such as "gzip" or "identity" (no compression).
932
+
933
+ | Property | Type | Description |
934
+ | ---------------- | ------------- | ----------------------------------------------- |
935
+ | `modified` | `bigint` | Timestamp when the encoding was last modified. |
936
+ | `content_chunks` | `BlobOrKey[]` | Chunks of binary content or references to them. |
937
+ | `total_length` | `bigint` | Total byte size of the encoded content. |
938
+ | `sha256` | `Hash` | SHA-256 hash of the encoded content. |
939
+
940
+ #### :gear: Asset
941
+
942
+ A stored asset including its metadata, encodings, and timestamps.
943
+
944
+ | Property | Type | Description |
945
+ | ------------ | ------------------------------- | ---------------------------------------------------------------------------------------------- |
946
+ | `key` | `AssetKey` | Metadata about the asset's identity and ownership. |
947
+ | `headers` | `HeaderField[]` | Optional HTTP headers associated with the asset. |
948
+ | `encodings` | `Record<string, AssetEncoding>` | A mapping from encoding types (e.g., "identity", "gzip") to the corresponding encoded version. |
949
+ | `created_at` | `bigint` | Timestamp when the asset was created. |
950
+ | `updated_at` | `bigint` | Timestamp when the asset was last updated. |
951
+ | `version` | `bigint or undefined` | Optional version number of the asset. |
952
+
953
+ #### :gear: Batch
954
+
955
+ Represents a batch of chunks to be uploaded and committed to an asset.
956
+
957
+ | Property | Type | Description |
958
+ | --------------- | --------------------- | ------------------------------------------------- |
959
+ | `key` | `AssetKey` | The metadata key for the asset being uploaded. |
960
+ | `reference_id` | `bigint or undefined` | Optional reference ID for tracking or validation. |
961
+ | `expires_at` | `bigint` | Timestamp when this batch expires. |
962
+ | `encoding_type` | `string or undefined` | Optional encoding format (e.g., "gzip"). |
963
+
964
+ #### :gear: CommitBatch
965
+
966
+ Represents the final step in uploading an asset, committing the batch to storage.
967
+
968
+ | Property | Type | Description |
969
+ | ----------- | --------------- | ------------------------------------------------- |
970
+ | `batch_id` | `bigint` | The ID of the batch being committed. |
971
+ | `headers` | `HeaderField[]` | HTTP headers associated with this asset. |
972
+ | `chunk_ids` | `bigint[]` | List of chunk IDs that make up the asset content. |
973
+
974
+ #### :gear: AssetAssertUpload
975
+
976
+ Represents a validation context before uploading an asset.
977
+
978
+ | Property | Type | Description |
979
+ | -------------- | -------------------- | ------------------------------------------------- |
980
+ | `current` | `Asset or undefined` | The current asset already stored (if any). |
981
+ | `batch` | `Batch` | The batch metadata being uploaded. |
982
+ | `commit_batch` | `CommitBatch` | The commit data describing headers and chunk ids. |
983
+
984
+ #### :gear: DocStoreParams
985
+
986
+ Represents the base parameters required to access the datastore and modify a document.
987
+
988
+ | Property | Type | Description |
989
+ | ------------ | ------------------------------------------ | -------------------------------------------------------------- |
990
+ | `caller` | `Uint8Array<ArrayBufferLike> or Principal` | The caller who initiate the document operation. |
991
+ | `collection` | `string` | The name of the collection where the document is stored. |
992
+ | `key` | `string` | The unique key identifying the document within the collection. |
993
+
994
+ #### :gear: CallParams
995
+
996
+ Type representing the parameters required to make a canister call.
997
+
998
+ | Property | Type | Description |
999
+ | ------------ | ------------------------------------------ | ----------------------------------------------------------------- |
1000
+ | `canisterId` | `Uint8Array<ArrayBufferLike> or Principal` | The target canister's ID. |
1001
+ | `method` | `string` | The name of the method to call. Minimum one character. |
1002
+ | `args` | `[Type<unknown>, unknown][] or undefined` | The arguments, including types and values, for the canister call. |
1003
+ | `result` | `Type<unknown> or undefined` | The expected result type used for decoding the response. |
1004
+
1005
+ ### :cocktail: Types
1006
+
527
1007
  - [RawPrincipal](#gear-rawprincipal)
528
1008
  - [Principal](#gear-principal)
529
1009
  - [Timestamp](#gear-timestamp)
@@ -532,44 +1012,60 @@ Schema for encoding the call arguments.
532
1012
  - [UserId](#gear-userid)
533
1013
  - [Collection](#gear-collection)
534
1014
  - [Key](#gear-key)
535
- - [HookContext](#gear-hookcontext)
1015
+ - [Description](#gear-description)
536
1016
  - [AssertFunction](#gear-assertfunction)
537
1017
  - [RunFunction](#gear-runfunction)
538
- - [DocDescription](#gear-docdescription)
539
1018
  - [RawData](#gear-rawdata)
540
- - [Doc](#gear-doc)
541
- - [DocUpsert](#gear-docupsert)
542
- - [ProposedDoc](#gear-proposeddoc)
543
- - [DocAssertSet](#gear-docassertset)
544
- - [DocContext](#gear-doccontext)
1019
+ - [OptionDoc](#gear-optiondoc)
545
1020
  - [OnSetDocContext](#gear-onsetdoccontext)
1021
+ - [OnSetManyDocsContext](#gear-onsetmanydocscontext)
1022
+ - [OnDeleteDocContext](#gear-ondeletedoccontext)
1023
+ - [OnDeleteManyDocsContext](#gear-ondeletemanydocscontext)
1024
+ - [OnDeleteFilteredDocsContext](#gear-ondeletefiltereddocscontext)
546
1025
  - [AssertSetDocContext](#gear-assertsetdoccontext)
1026
+ - [AssertDeleteDocContext](#gear-assertdeletedoccontext)
547
1027
  - [SatelliteEnv](#gear-satelliteenv)
1028
+ - [HeaderField](#gear-headerfield)
1029
+ - [Blob](#gear-blob)
1030
+ - [BlobOrKey](#gear-bloborkey)
1031
+ - [Hash](#gear-hash)
1032
+ - [EncodingType](#gear-encodingtype)
1033
+ - [ReferenceId](#gear-referenceid)
1034
+ - [ChunkId](#gear-chunkid)
1035
+ - [BatchId](#gear-batchid)
1036
+ - [OnUploadAssetContext](#gear-onuploadassetcontext)
1037
+ - [OnDeleteAssetContext](#gear-ondeleteassetcontext)
1038
+ - [OnDeleteManyAssetsContext](#gear-ondeletemanyassetscontext)
1039
+ - [OnDeleteFilteredAssetsContext](#gear-ondeletefilteredassetscontext)
1040
+ - [AssertUploadAssetContext](#gear-assertuploadassetcontext)
1041
+ - [AssertDeleteAssetContext](#gear-assertdeleteassetcontext)
1042
+ - [OnAssert](#gear-onassert)
548
1043
  - [AssertSetDoc](#gear-assertsetdoc)
1044
+ - [AssertDeleteDoc](#gear-assertdeletedoc)
1045
+ - [AssertUploadAsset](#gear-assertuploadasset)
1046
+ - [AssertDeleteAsset](#gear-assertdeleteasset)
549
1047
  - [Assert](#gear-assert)
550
1048
  - [AssertFn](#gear-assertfn)
551
1049
  - [AssertFnOrObject](#gear-assertfnorobject)
1050
+ - [OnHook](#gear-onhook)
552
1051
  - [OnSetDoc](#gear-onsetdoc)
1052
+ - [OnSetManyDocs](#gear-onsetmanydocs)
1053
+ - [OnDeleteDoc](#gear-ondeletedoc)
1054
+ - [OnDeleteManyDocs](#gear-ondeletemanydocs)
1055
+ - [OnDeleteFilteredDocs](#gear-ondeletefiltereddocs)
1056
+ - [OnUploadAsset](#gear-onuploadasset)
1057
+ - [OnDeleteAsset](#gear-ondeleteasset)
1058
+ - [OnDeleteManyAssets](#gear-ondeletemanyassets)
1059
+ - [OnDeleteFilteredAssets](#gear-ondeletefilteredassets)
553
1060
  - [Hook](#gear-hook)
554
1061
  - [HookFn](#gear-hookfn)
555
1062
  - [HookFnOrObject](#gear-hookfnorobject)
556
- - [SetDoc](#gear-setdoc)
557
1063
  - [SetDocStoreParams](#gear-setdocstoreparams)
1064
+ - [DeleteDocStoreParams](#gear-deletedocstoreparams)
558
1065
  - [IDLType](#gear-idltype)
559
1066
  - [CallArg](#gear-callarg)
560
1067
  - [CallArgs](#gear-callargs)
561
1068
  - [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
1069
 
574
1070
  #### :gear: RawPrincipal
575
1071
 
@@ -659,15 +1155,16 @@ A unique key identifier within a collection.
659
1155
 
660
1156
  [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L70)
661
1157
 
662
- #### :gear: HookContext
1158
+ #### :gear: Description
663
1159
 
664
- Represents the context provided to hooks, containing information about the caller and related data.
1160
+ Represents a description with a maximum length of 1024 characters.
1161
+ Used for document and asset fields which can be useful for search purpose.
665
1162
 
666
- | Type | Type |
667
- | ------------- | -------------------------------------------------- |
668
- | `HookContext` | `z.infer<ReturnType<typeof HookContextSchema<T>>>` |
1163
+ | Type | Type |
1164
+ | ------------- | ----------------------------------- |
1165
+ | `Description` | `z.infer<typeof DescriptionSchema>` |
669
1166
 
670
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/context.ts#L36)
1167
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L81)
671
1168
 
672
1169
  #### :gear: AssertFunction
673
1170
 
@@ -675,11 +1172,11 @@ Defines the `assert` function schema for assertions.
675
1172
 
676
1173
  The function takes a context argument and returns `void`.
677
1174
 
678
- | Type | Type |
679
- | ---------------- | ---------------------------------------------------------------- |
680
- | `AssertFunction` | `z.infer<ReturnType<typeof AssertFunctionSchema<z.ZodType<T>>>>` |
1175
+ | Type | Type |
1176
+ | ---------------- | ---------------------- |
1177
+ | `AssertFunction` | `(context: T) => void` |
681
1178
 
682
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/context.ts#L51)
1179
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/context.ts#L54)
683
1180
 
684
1181
  #### :gear: RunFunction
685
1182
 
@@ -687,21 +1184,11 @@ Defines the `run` function schema for hooks.
687
1184
 
688
1185
  The function takes a context argument and returns either a `Promise<void>` or `void`.
689
1186
 
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
1187
+ | Type | Type |
1188
+ | ------------- | --------------------------------------- |
1189
+ | `RunFunction` | `(context: T) => void or Promise<void>` |
697
1190
 
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)
1191
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/context.ts#L69)
705
1192
 
706
1193
  #### :gear: RawData
707
1194
 
@@ -713,89 +1200,108 @@ This is used to store structured data in a document.
713
1200
  | --------- | ---------------------------------- |
714
1201
  | `RawData` | `z.infer<typeof Uint8ArraySchema>` |
715
1202
 
716
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L25)
1203
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L24)
717
1204
 
718
- #### :gear: Doc
1205
+ #### :gear: OptionDoc
719
1206
 
720
- Represents a document stored in a collection.
1207
+ A shorthand for a document that might or not be defined.
721
1208
 
722
- | Type | Type |
723
- | ----- | --------------------------- |
724
- | `Doc` | `z.infer<typeof DocSchema>` |
1209
+ | Type | Type |
1210
+ | ----------- | ------------------ |
1211
+ | `OptionDoc` | `Doc or undefined` |
725
1212
 
726
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L68)
1213
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L84)
727
1214
 
728
- #### :gear: DocUpsert
1215
+ #### :gear: OnSetDocContext
729
1216
 
730
- Represents a document update operation.
1217
+ The context provided to the `onSetDoc` hook.
731
1218
 
732
- This is used in hooks where a document is either being created or updated.
1219
+ This context contains information about the document being created or updated,
1220
+ along with details about the user who triggered the operation.
733
1221
 
734
- | Type | Type |
735
- | ----------- | --------------------------------- |
736
- | `DocUpsert` | `z.infer<typeof DocUpsertSchema>` |
1222
+ | Type | Type |
1223
+ | ----------------- | ------------------------------------ |
1224
+ | `OnSetDocContext` | `HookContext<DocContext<DocUpsert>>` |
737
1225
 
738
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/payload.ts#L28)
1226
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L68)
739
1227
 
740
- #### :gear: ProposedDoc
1228
+ #### :gear: OnSetManyDocsContext
741
1229
 
742
- Represents the proposed version of a document.
743
- This can be validated before allowing the operation.
1230
+ The context provided to the `onSetManyDocs` hook.
744
1231
 
745
- | Type | Type |
746
- | ------------- | ----------------------------------- |
747
- | `ProposedDoc` | `z.infer<typeof ProposedDocSchema>` |
1232
+ This context contains information about multiple documents being created or updated
1233
+ in a single operation, along with details about the user who triggered it.
748
1234
 
749
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/payload.ts#L56)
1235
+ | Type | Type |
1236
+ | ---------------------- | -------------------------------------- |
1237
+ | `OnSetManyDocsContext` | `HookContext<DocContext<DocUpsert>[]>` |
750
1238
 
751
- #### :gear: DocAssertSet
1239
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L83)
752
1240
 
753
- Represents a validation check before setting a document.
1241
+ #### :gear: OnDeleteDocContext
754
1242
 
755
- The developer can compare the `current` and `proposed` versions and
756
- throw an error if their validation fails.
1243
+ The context provided to the `onDeleteDoc` hook.
757
1244
 
758
- | Type | Type |
759
- | -------------- | ------------------------------------ |
760
- | `DocAssertSet` | `z.infer<typeof DocAssertSetSchema>` |
1245
+ This context contains information about a single document being deleted,
1246
+ along with details about the user who triggered the operation.
761
1247
 
762
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/payload.ts#L83)
1248
+ | Type | Type |
1249
+ | -------------------- | ------------------------------------ |
1250
+ | `OnDeleteDocContext` | `HookContext<DocContext<OptionDoc>>` |
763
1251
 
764
- #### :gear: DocContext
1252
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L96)
765
1253
 
766
- Represents the context of a document operation within a collection.
1254
+ #### :gear: OnDeleteManyDocsContext
767
1255
 
768
- | Type | Type |
769
- | ------------ | ------------------------------------------------- |
770
- | `DocContext` | `z.infer<ReturnType<typeof DocContextSchema<T>>>` |
1256
+ The context provided to the `onDeleteManyDocs` hook.
771
1257
 
772
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L43)
1258
+ This context contains information about multiple documents being deleted,
1259
+ along with details about the user who triggered the operation.
773
1260
 
774
- #### :gear: OnSetDocContext
1261
+ | Type | Type |
1262
+ | ------------------------- | -------------------------------------- |
1263
+ | `OnDeleteManyDocsContext` | `HookContext<DocContext<OptionDoc>[]>` |
775
1264
 
776
- The context provided to the `onSetDoc` hook.
1265
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L111)
777
1266
 
778
- This context contains information about the document being created or updated,
1267
+ #### :gear: OnDeleteFilteredDocsContext
1268
+
1269
+ The context provided to the `onDeleteFilteredDocs` hook.
1270
+
1271
+ This context contains information about documents deleted as a result of a filter,
779
1272
  along with details about the user who triggered the operation.
780
1273
 
781
- | Type | Type |
782
- | ----------------- | --------------------------------------- |
783
- | `OnSetDocContext` | `z.infer<typeof OnSetDocContextSchema>` |
1274
+ | Type | Type |
1275
+ | ----------------------------- | -------------------------------------- |
1276
+ | `OnDeleteFilteredDocsContext` | `HookContext<DocContext<OptionDoc>[]>` |
784
1277
 
785
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L56)
1278
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L126)
786
1279
 
787
1280
  #### :gear: AssertSetDocContext
788
1281
 
789
- The context provided to the `assertSetDoc` hook.
1282
+ The context provided to the `assertDeleteDoc` hook.
790
1283
 
791
1284
  This context contains information about the document being validated before
792
1285
  it is created or updated. If validation fails, the developer should throw an error.
793
1286
 
794
- | Type | Type |
795
- | --------------------- | ------------------------------------------- |
796
- | `AssertSetDocContext` | `z.infer<typeof AssertSetDocContextSchema>` |
1287
+ | Type | Type |
1288
+ | --------------------- | --------------------------------------- |
1289
+ | `AssertSetDocContext` | `HookContext<DocContext<DocAssertSet>>` |
1290
+
1291
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L139)
1292
+
1293
+ #### :gear: AssertDeleteDocContext
1294
+
1295
+ The context provided to the `assertDeleteDoc` hook.
1296
+
1297
+ This context contains information about the document being validated before
1298
+ it is deleted. If validation fails, the developer should throw an error.
1299
+
1300
+ | Type | Type |
1301
+ | ------------------------ | ------------------------------------------ |
1302
+ | `AssertDeleteDocContext` | `HookContext<DocContext<DocAssertDelete>>` |
797
1303
 
798
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L69)
1304
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L154)
799
1305
 
800
1306
  #### :gear: SatelliteEnv
801
1307
 
@@ -812,25 +1318,219 @@ Currently unused, but it may support features such as:
812
1318
 
813
1319
  [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/satellite.env.ts#L15)
814
1320
 
1321
+ #### :gear: HeaderField
1322
+
1323
+ Represents a single HTTP header as a tuple of name and value.
1324
+
1325
+ | Type | Type |
1326
+ | ------------- | ------------------ |
1327
+ | `HeaderField` | `[string, string]` |
1328
+
1329
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L24)
1330
+
1331
+ #### :gear: Blob
1332
+
1333
+ Binary content used in asset encoding.
1334
+
1335
+ | Type | Type |
1336
+ | ------ | ------------ |
1337
+ | `Blob` | `Uint8Array` |
1338
+
1339
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L34)
1340
+
1341
+ #### :gear: BlobOrKey
1342
+
1343
+ When stable memory is used, chunks are saved within a StableBTreeMap and their keys - StableEncodingChunkKey - are saved for reference as serialized values
1344
+
1345
+ | Type | Type |
1346
+ | ----------- | ------------ |
1347
+ | `BlobOrKey` | `Uint8Array` |
1348
+
1349
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L44)
1350
+
1351
+ #### :gear: Hash
1352
+
1353
+ Represents a SHA-256 hash as a 32-byte binary value.
1354
+
1355
+ | Type | Type |
1356
+ | ------ | ------------ |
1357
+ | `Hash` | `Uint8Array` |
1358
+
1359
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L56)
1360
+
1361
+ #### :gear: EncodingType
1362
+
1363
+ A string identifier representing a specific encoding format (e.g., "gzip", "identity").
1364
+
1365
+ | Type | Type |
1366
+ | -------------- | ---- |
1367
+ | `EncodingType` | |
1368
+
1369
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L198)
1370
+
1371
+ #### :gear: ReferenceId
1372
+
1373
+ A unique reference identifier for batches.
1374
+
1375
+ | Type | Type |
1376
+ | ------------- | ---- |
1377
+ | `ReferenceId` | |
1378
+
1379
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L208)
1380
+
1381
+ #### :gear: ChunkId
1382
+
1383
+ A unique identifier representing a single chunk of data.
1384
+
1385
+ | Type | Type |
1386
+ | --------- | ---- |
1387
+ | `ChunkId` | |
1388
+
1389
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L255)
1390
+
1391
+ #### :gear: BatchId
1392
+
1393
+ A unique identifier representing a batch of upload.
1394
+
1395
+ | Type | Type |
1396
+ | --------- | ---- |
1397
+ | `BatchId` | |
1398
+
1399
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L265)
1400
+
1401
+ #### :gear: OnUploadAssetContext
1402
+
1403
+ Context for the `onUploadAsset` hook.
1404
+
1405
+ This context contains information about the asset that was uploaded.
1406
+
1407
+ | Type | Type |
1408
+ | ---------------------- | -------------------- |
1409
+ | `OnUploadAssetContext` | `HookContext<Asset>` |
1410
+
1411
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L16)
1412
+
1413
+ #### :gear: OnDeleteAssetContext
1414
+
1415
+ Context for the `onDeleteAsset` hook.
1416
+
1417
+ This context contains information about a single asset being deleted, along with details about the user who triggered the operation.
1418
+
1419
+ If undefined, the asset did not exist.
1420
+
1421
+ | Type | Type |
1422
+ | ---------------------- | --------------------------------- |
1423
+ | `OnDeleteAssetContext` | `HookContext<Asset or undefined>` |
1424
+
1425
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L30)
1426
+
1427
+ #### :gear: OnDeleteManyAssetsContext
1428
+
1429
+ Context for the `onDeleteManyAssets` hook.
1430
+
1431
+ This context contains information about multiple assets being potentially deleted, along with details about the user who triggered the operation.
1432
+
1433
+ | Type | Type |
1434
+ | --------------------------- | ---------------------------------------- |
1435
+ | `OnDeleteManyAssetsContext` | `HookContext<Array<Asset or undefined>>` |
1436
+
1437
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L42)
1438
+
1439
+ #### :gear: OnDeleteFilteredAssetsContext
1440
+
1441
+ Context for the `onDeleteFilteredAssets` hook.
1442
+
1443
+ This context contains information about documents deleted as a result of a filter, along with details about the user who triggered the operation.
1444
+
1445
+ | Type | Type |
1446
+ | ------------------------------- | ---------------------------------------- |
1447
+ | `OnDeleteFilteredAssetsContext` | `HookContext<Array<Asset or undefined>>` |
1448
+
1449
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L56)
1450
+
1451
+ #### :gear: AssertUploadAssetContext
1452
+
1453
+ Context for the `assertUploadAsset` hook.
1454
+
1455
+ This context contains information about the asset being validated before it is uploaded. If validation fails, the developer should throw an error.
1456
+
1457
+ | Type | Type |
1458
+ | -------------------------- | -------------------------------- |
1459
+ | `AssertUploadAssetContext` | `HookContext<AssetAssertUpload>` |
1460
+
1461
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L68)
1462
+
1463
+ #### :gear: AssertDeleteAssetContext
1464
+
1465
+ Context for the `assertDeleteAsset` hook.
1466
+
1467
+ This context contains information about the asset being validated before it is deleted. If validation fails, the developer should throw an error.
1468
+
1469
+ | Type | Type |
1470
+ | -------------------------- | -------------------- |
1471
+ | `AssertDeleteAssetContext` | `HookContext<Asset>` |
1472
+
1473
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L80)
1474
+
1475
+ #### :gear: OnAssert
1476
+
1477
+ A generic schema for defining assertions related to collections.
1478
+
1479
+ | Type | Type |
1480
+ | ---------- | ------------------------------------------------ |
1481
+ | `OnAssert` | `Collections and { assert: AssertFunction<T>; }` |
1482
+
1483
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L37)
1484
+
815
1485
  #### :gear: AssertSetDoc
816
1486
 
817
1487
  An assertion that runs when a document is created or updated.
818
1488
 
819
- | Type | Type |
820
- | -------------- | ------------------------------------ |
821
- | `AssertSetDoc` | `z.infer<typeof AssertSetDocSchema>` |
1489
+ | Type | Type |
1490
+ | -------------- | ------------------------------- |
1491
+ | `AssertSetDoc` | `OnAssert<AssertSetDocContext>` |
1492
+
1493
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L49)
1494
+
1495
+ #### :gear: AssertDeleteDoc
1496
+
1497
+ An assertion that runs when a document is deleted.
1498
+
1499
+ | Type | Type |
1500
+ | ----------------- | ---------------------------------- |
1501
+ | `AssertDeleteDoc` | `OnAssert<AssertDeleteDocContext>` |
1502
+
1503
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L59)
1504
+
1505
+ #### :gear: AssertUploadAsset
1506
+
1507
+ An assertion that runs before an asset is uploaded.
822
1508
 
823
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L31)
1509
+ | Type | Type |
1510
+ | ------------------- | ------------------------------------ |
1511
+ | `AssertUploadAsset` | `OnAssert<AssertUploadAssetContext>` |
1512
+
1513
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L69)
1514
+
1515
+ #### :gear: AssertDeleteAsset
1516
+
1517
+ An assertion that runs before an asset is deleted.
1518
+
1519
+ | Type | Type |
1520
+ | ------------------- | ------------------------------------ |
1521
+ | `AssertDeleteAsset` | `OnAssert<AssertDeleteAssetContext>` |
1522
+
1523
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L79)
824
1524
 
825
1525
  #### :gear: Assert
826
1526
 
827
1527
  All assertions definitions.
828
1528
 
829
- | Type | Type |
830
- | -------- | ------------------------------ |
831
- | `Assert` | `z.infer<typeof AssertSchema>` |
1529
+ | Type | Type |
1530
+ | -------- | --------------------------------- |
1531
+ | `Assert` | `AssertSetDoc or AssertDeleteDoc` |
832
1532
 
833
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L42)
1533
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L94)
834
1534
 
835
1535
  #### :gear: AssertFn
836
1536
 
@@ -838,7 +1538,7 @@ All assertions definitions.
838
1538
  | ---------- | --------------------------------------------------- |
839
1539
  | `AssertFn` | `(assert: z.infer<typeof SatelliteEnvSchema>) => T` |
840
1540
 
841
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L46)
1541
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L98)
842
1542
 
843
1543
  #### :gear: AssertFnOrObject
844
1544
 
@@ -846,27 +1546,117 @@ All assertions definitions.
846
1546
  | ------------------ | ------------------ |
847
1547
  | `AssertFnOrObject` | `T or AssertFn<T>` |
848
1548
 
849
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/assertions.ts#L50)
1549
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L102)
1550
+
1551
+ #### :gear: OnHook
1552
+
1553
+ A generic schema for defining hooks related to collections.
1554
+
1555
+ | Type | Type |
1556
+ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1557
+ | `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>; }` |
1558
+
1559
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L41)
850
1560
 
851
1561
  #### :gear: OnSetDoc
852
1562
 
853
1563
  A hook that runs when a document is created or updated.
854
1564
 
855
- | Type | Type |
856
- | ---------- | -------------------------------- |
857
- | `OnSetDoc` | `z.infer<typeof OnSetDocSchema>` |
1565
+ | Type | Type |
1566
+ | ---------- | ------------------------- |
1567
+ | `OnSetDoc` | `OnHook<OnSetDocContext>` |
1568
+
1569
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L59)
1570
+
1571
+ #### :gear: OnSetManyDocs
1572
+
1573
+ A hook that runs when multiple documents are created or updated.
1574
+
1575
+ | Type | Type |
1576
+ | --------------- | ------------------------------ |
1577
+ | `OnSetManyDocs` | `OnHook<OnSetManyDocsContext>` |
1578
+
1579
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L69)
1580
+
1581
+ #### :gear: OnDeleteDoc
1582
+
1583
+ A hook that runs when a single document is deleted.
1584
+
1585
+ | Type | Type |
1586
+ | ------------- | ---------------------------- |
1587
+ | `OnDeleteDoc` | `OnHook<OnDeleteDocContext>` |
1588
+
1589
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L79)
1590
+
1591
+ #### :gear: OnDeleteManyDocs
1592
+
1593
+ A hook that runs when multiple documents are deleted.
1594
+
1595
+ | Type | Type |
1596
+ | ------------------ | --------------------------------- |
1597
+ | `OnDeleteManyDocs` | `OnHook<OnDeleteManyDocsContext>` |
1598
+
1599
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L89)
1600
+
1601
+ #### :gear: OnDeleteFilteredDocs
1602
+
1603
+ A hook that runs when a filtered set of documents is deleted based on query conditions.
1604
+
1605
+ | Type | Type |
1606
+ | ---------------------- | ------------------------------------- |
1607
+ | `OnDeleteFilteredDocs` | `OnHook<OnDeleteFilteredDocsContext>` |
1608
+
1609
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L99)
1610
+
1611
+ #### :gear: OnUploadAsset
1612
+
1613
+ A hook that runs when a single asset is uploaded.
1614
+
1615
+ | Type | Type |
1616
+ | --------------- | ------------------------------ |
1617
+ | `OnUploadAsset` | `OnHook<OnUploadAssetContext>` |
1618
+
1619
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L109)
1620
+
1621
+ #### :gear: OnDeleteAsset
1622
+
1623
+ A hook that runs when a single asset is potentially deleted.
1624
+
1625
+ | Type | Type |
1626
+ | --------------- | ------------------------------ |
1627
+ | `OnDeleteAsset` | `OnHook<OnDeleteAssetContext>` |
1628
+
1629
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L119)
858
1630
 
859
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L31)
1631
+ #### :gear: OnDeleteManyAssets
1632
+
1633
+ A hook that runs when multiple assets are potentially deleted.
1634
+
1635
+ | Type | Type |
1636
+ | -------------------- | ----------------------------------- |
1637
+ | `OnDeleteManyAssets` | `OnHook<OnDeleteManyAssetsContext>` |
1638
+
1639
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L129)
1640
+
1641
+ #### :gear: OnDeleteFilteredAssets
1642
+
1643
+ A hook that runs when a filtered set of assets is deleted based on query conditions.
1644
+
1645
+ | Type | Type |
1646
+ | ------------------------ | --------------------------------------- |
1647
+ | `OnDeleteFilteredAssets` | `OnHook<OnDeleteFilteredAssetsContext>` |
1648
+
1649
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L139)
860
1650
 
861
1651
  #### :gear: Hook
862
1652
 
863
1653
  All hooks definitions.
864
1654
 
865
- | Type | Type |
866
- | ------ | ---------------------------- |
867
- | `Hook` | `z.infer<typeof HookSchema>` |
1655
+ | Type | Type |
1656
+ | ------ | -------------------------------------------------------------------------------------- |
1657
+ | `Hook` | `OnSetDoc or OnSetManyDocs or OnDeleteDoc or OnDeleteManyDocs or OnDeleteFilteredDocs` |
868
1658
 
869
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L42)
1659
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L159)
870
1660
 
871
1661
  #### :gear: HookFn
872
1662
 
@@ -874,7 +1664,7 @@ All hooks definitions.
874
1664
  | -------- | ------------------------------------------------- |
875
1665
  | `HookFn` | `(hook: z.infer<typeof SatelliteEnvSchema>) => T` |
876
1666
 
877
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L46)
1667
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L163)
878
1668
 
879
1669
  #### :gear: HookFnOrObject
880
1670
 
@@ -882,32 +1672,33 @@ All hooks definitions.
882
1672
  | ---------------- | ---------------- |
883
1673
  | `HookFnOrObject` | `T or HookFn<T>` |
884
1674
 
885
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/db/hooks.ts#L50)
1675
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L167)
886
1676
 
887
- #### :gear: SetDoc
1677
+ #### :gear: SetDocStoreParams
888
1678
 
889
- Represents a request to set or update a document.
1679
+ Represents the parameters required to store or update a document.
890
1680
 
891
- This is used when submitting new document data.
1681
+ This includes the document data along with metadata such as the caller,
1682
+ collection, and key.
892
1683
 
893
- | Type | Type |
894
- | -------- | ------------------------------ |
895
- | `SetDoc` | `z.infer<typeof SetDocSchema>` |
1684
+ | Type | Type |
1685
+ | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
1686
+ | `SetDocStoreParams` | `DocStoreParams and { /** * The data, optional description and version required to create or update a document. */ doc: SetDoc; }` |
896
1687
 
897
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L44)
1688
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L56)
898
1689
 
899
- #### :gear: SetDocStoreParams
1690
+ #### :gear: DeleteDocStoreParams
900
1691
 
901
- Represents the parameters required to store or update a document.
1692
+ Represents the parameters required to delete a document.
902
1693
 
903
- This includes the document data along with metadata such as the caller,
1694
+ This includes the document version along with metadata such as the caller,
904
1695
  collection, and key.
905
1696
 
906
- | Type | Type |
907
- | ------------------- | ----------------------------------------- |
908
- | `SetDocStoreParams` | `z.infer<typeof SetDocStoreParamsSchema>` |
1697
+ | Type | Type |
1698
+ | ---------------------- | ----------------------------------------------------------------------------------------- |
1699
+ | `DeleteDocStoreParams` | `DocStoreParams and { /** * The version required to delete a document. */ doc: DelDoc; }` |
909
1700
 
910
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L74)
1701
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L76)
911
1702
 
912
1703
  #### :gear: IDLType
913
1704
 
@@ -917,7 +1708,7 @@ Custom validation function to verify if a value is an instance of `IDL.Type` fro
917
1708
  | --------- | ------------------------------- |
918
1709
  | `IDLType` | `z.infer<typeof IDLTypeSchema>` |
919
1710
 
920
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L15)
1711
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L16)
921
1712
 
922
1713
  #### :gear: CallArg
923
1714
 
@@ -927,7 +1718,7 @@ A call argument consisting of its IDL type and corresponding value.
927
1718
  | --------- | ------------------------------- |
928
1719
  | `CallArg` | `z.infer<typeof CallArgSchema>` |
929
1720
 
930
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L25)
1721
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L26)
931
1722
 
932
1723
  #### :gear: CallArgs
933
1724
 
@@ -943,7 +1734,7 @@ The order of arguments is preserved for the function call.
943
1734
  | ---------- | -------------------------------- |
944
1735
  | `CallArgs` | `z.infer<typeof CallArgsSchema>` |
945
1736
 
946
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L43)
1737
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L44)
947
1738
 
948
1739
  #### :gear: CallResult
949
1740
 
@@ -953,17 +1744,7 @@ Defines the type used to decode the result of a canister call.
953
1744
  | ------------ | ---------------------------------- |
954
1745
  | `CallResult` | `z.infer<typeof CallResultSchema>` |
955
1746
 
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)
1747
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L54)
967
1748
 
968
1749
  <!-- TSDOC_END -->
969
1750