@junobuild/functions 0.0.4 → 0.0.6

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
@@ -40,113 +40,113 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
40
40
 
41
41
  #### :gear: AssertFnSchema
42
42
 
43
- | Function | Type |
44
- | ---------------- | --------------------------------------------------------------------------------------------------------------------------- |
45
- | `AssertFnSchema` | `<T extends z.ZodTypeAny>(hookConfigSchema: T) => ZodFunction<ZodTuple<[ZodRecord<ZodString, ZodUnknown>], ZodUnknown>, T>` |
43
+ | Function | Type |
44
+ | ---------------- | ----------------------------------------------------------------------------------------------------------------------- |
45
+ | `AssertFnSchema` | `<T extends z.ZodTypeAny>(assertSchema: T) => ZodFunction<ZodTuple<[ZodRecord<ZodString, ZodUnknown>], ZodUnknown>, T>` |
46
46
 
47
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assert.config.ts#L43)
47
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assertions.ts#L43)
48
48
 
49
49
  #### :gear: AssertFnOrObjectSchema
50
50
 
51
- | Function | Type |
52
- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ |
53
- | `AssertFnOrObjectSchema` | `<T extends z.ZodTypeAny>(hookConfigSchema: T) => ZodUnion<[T, ZodFunction<ZodTuple<[ZodRecord<ZodString, ZodUnknown>], ZodUnknown>, T>]>` |
51
+ | Function | Type |
52
+ | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------- |
53
+ | `AssertFnOrObjectSchema` | `<T extends z.ZodTypeAny>(assertSchema: T) => ZodUnion<[T, ZodFunction<ZodTuple<[ZodRecord<ZodString, ZodUnknown>], ZodUnknown>, T>]>` |
54
54
 
55
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assert.config.ts#L49)
55
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assertions.ts#L47)
56
56
 
57
57
  #### :gear: defineAssert
58
58
 
59
- | Function | Type |
60
- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
61
- | `defineAssert` | `{ <T extends AssertConfig>(config: T): T; <T extends AssertConfig>(config: AssertFn<T>): AssertFn<T>; <T extends AssertConfig>(config: AssertFnOrObject<T>): AssertFnOrObject<...>; }` |
59
+ | Function | Type |
60
+ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
61
+ | `defineAssert` | `{ <T extends Assert>(assert: T): T; <T extends Assert>(assert: AssertFn<T>): AssertFn<T>; <T extends Assert>(assert: AssertFnOrObject<T>): AssertFnOrObject<T>; }` |
62
62
 
63
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assert.config.ts#L53)
63
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assertions.ts#L51)
64
64
 
65
65
  #### :gear: defineAssert
66
66
 
67
- | Function | Type |
68
- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
69
- | `defineAssert` | `{ <T extends AssertConfig>(config: T): T; <T extends AssertConfig>(config: AssertFn<T>): AssertFn<T>; <T extends AssertConfig>(config: AssertFnOrObject<T>): AssertFnOrObject<...>; }` |
67
+ | Function | Type |
68
+ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
69
+ | `defineAssert` | `{ <T extends Assert>(assert: T): T; <T extends Assert>(assert: AssertFn<T>): AssertFn<T>; <T extends Assert>(assert: AssertFnOrObject<T>): AssertFnOrObject<T>; }` |
70
70
 
71
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assert.config.ts#L54)
71
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assertions.ts#L52)
72
72
 
73
73
  #### :gear: defineAssert
74
74
 
75
- | Function | Type |
76
- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
77
- | `defineAssert` | `{ <T extends AssertConfig>(config: T): T; <T extends AssertConfig>(config: AssertFn<T>): AssertFn<T>; <T extends AssertConfig>(config: AssertFnOrObject<T>): AssertFnOrObject<...>; }` |
75
+ | Function | Type |
76
+ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
77
+ | `defineAssert` | `{ <T extends Assert>(assert: T): T; <T extends Assert>(assert: AssertFn<T>): AssertFn<T>; <T extends Assert>(assert: AssertFnOrObject<T>): AssertFnOrObject<T>; }` |
78
78
 
79
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assert.config.ts#L55)
79
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assertions.ts#L53)
80
80
 
81
81
  #### :gear: defineAssert
82
82
 
83
- | Function | Type |
84
- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
85
- | `defineAssert` | `{ <T extends AssertConfig>(config: T): T; <T extends AssertConfig>(config: AssertFn<T>): AssertFn<T>; <T extends AssertConfig>(config: AssertFnOrObject<T>): AssertFnOrObject<...>; }` |
83
+ | Function | Type |
84
+ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
85
+ | `defineAssert` | `{ <T extends Assert>(assert: T): T; <T extends Assert>(assert: AssertFn<T>): AssertFn<T>; <T extends Assert>(assert: AssertFnOrObject<T>): AssertFnOrObject<T>; }` |
86
86
 
87
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assert.config.ts#L58)
87
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assertions.ts#L54)
88
88
 
89
89
  #### :gear: HookFnSchema
90
90
 
91
- | Function | Type |
92
- | -------------- | --------------------------------------------------------------------------------------------------------------------------- |
93
- | `HookFnSchema` | `<T extends z.ZodTypeAny>(hookConfigSchema: T) => ZodFunction<ZodTuple<[ZodRecord<ZodString, ZodUnknown>], ZodUnknown>, T>` |
91
+ | Function | Type |
92
+ | -------------- | --------------------------------------------------------------------------------------------------------------------- |
93
+ | `HookFnSchema` | `<T extends z.ZodTypeAny>(hookSchema: T) => ZodFunction<ZodTuple<[ZodRecord<ZodString, ZodUnknown>], ZodUnknown>, T>` |
94
94
 
95
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hook.config.ts#L43)
95
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hooks.ts#L43)
96
96
 
97
97
  #### :gear: HookFnOrObjectSchema
98
98
 
99
- | Function | Type |
100
- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
101
- | `HookFnOrObjectSchema` | `<T extends z.ZodTypeAny>(hookConfigSchema: T) => ZodUnion<[T, ZodFunction<ZodTuple<[ZodRecord<ZodString, ZodUnknown>], ZodUnknown>, T>]>` |
99
+ | Function | Type |
100
+ | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
101
+ | `HookFnOrObjectSchema` | `<T extends z.ZodTypeAny>(hookSchema: T) => ZodUnion<[T, ZodFunction<ZodTuple<[ZodRecord<ZodString, ZodUnknown>], ZodUnknown>, T>]>` |
102
102
 
103
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hook.config.ts#L47)
103
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hooks.ts#L47)
104
104
 
105
105
  #### :gear: defineHook
106
106
 
107
- | Function | Type |
108
- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
109
- | `defineHook` | `{ <T extends HookConfig>(config: T): T; <T extends HookConfig>(config: HookFn<T>): HookFn<T>; <T extends HookConfig>(config: HookFnOrObject<T>): HookFnOrObject<T>; }` |
107
+ | Function | Type |
108
+ | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
109
+ | `defineHook` | `{ <T extends Hook>(hook: T): T; <T extends Hook>(hook: HookFn<T>): HookFn<T>; <T extends Hook>(hook: HookFnOrObject<T>): HookFnOrObject<T>; }` |
110
110
 
111
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hook.config.ts#L51)
111
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hooks.ts#L51)
112
112
 
113
113
  #### :gear: defineHook
114
114
 
115
- | Function | Type |
116
- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
117
- | `defineHook` | `{ <T extends HookConfig>(config: T): T; <T extends HookConfig>(config: HookFn<T>): HookFn<T>; <T extends HookConfig>(config: HookFnOrObject<T>): HookFnOrObject<T>; }` |
115
+ | Function | Type |
116
+ | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
117
+ | `defineHook` | `{ <T extends Hook>(hook: T): T; <T extends Hook>(hook: HookFn<T>): HookFn<T>; <T extends Hook>(hook: HookFnOrObject<T>): HookFnOrObject<T>; }` |
118
118
 
119
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hook.config.ts#L52)
119
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hooks.ts#L52)
120
120
 
121
121
  #### :gear: defineHook
122
122
 
123
- | Function | Type |
124
- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
125
- | `defineHook` | `{ <T extends HookConfig>(config: T): T; <T extends HookConfig>(config: HookFn<T>): HookFn<T>; <T extends HookConfig>(config: HookFnOrObject<T>): HookFnOrObject<T>; }` |
123
+ | Function | Type |
124
+ | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
125
+ | `defineHook` | `{ <T extends Hook>(hook: T): T; <T extends Hook>(hook: HookFn<T>): HookFn<T>; <T extends Hook>(hook: HookFnOrObject<T>): HookFnOrObject<T>; }` |
126
126
 
127
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hook.config.ts#L53)
127
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hooks.ts#L53)
128
128
 
129
129
  #### :gear: defineHook
130
130
 
131
- | Function | Type |
132
- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
133
- | `defineHook` | `{ <T extends HookConfig>(config: T): T; <T extends HookConfig>(config: HookFn<T>): HookFn<T>; <T extends HookConfig>(config: HookFnOrObject<T>): HookFnOrObject<T>; }` |
131
+ | Function | Type |
132
+ | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
133
+ | `defineHook` | `{ <T extends Hook>(hook: T): T; <T extends Hook>(hook: HookFn<T>): HookFn<T>; <T extends Hook>(hook: HookFnOrObject<T>): HookFnOrObject<T>; }` |
134
134
 
135
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hook.config.ts#L54)
135
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hooks.ts#L54)
136
136
 
137
137
  #### :gear: decodeDocData
138
138
 
139
- | Function | Type |
140
- | --------------- | ----------------------------------------- |
141
- | `decodeDocData` | `<T>(data: Uint8Array<ArrayBuffer>) => T` |
139
+ | Function | Type |
140
+ | --------------- | --------------------------------------------- |
141
+ | `decodeDocData` | `<T>(data: Uint8Array<ArrayBufferLike>) => T` |
142
142
 
143
143
  [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/datastore.sdk.ts#L4)
144
144
 
145
145
  #### :gear: encodeDocData
146
146
 
147
- | Function | Type |
148
- | --------------- | ----------------------------------------- |
149
- | `encodeDocData` | `<T>(data: T) => Uint8Array<ArrayBuffer>` |
147
+ | Function | Type |
148
+ | --------------- | --------------------------------------------- |
149
+ | `encodeDocData` | `<T>(data: T) => Uint8Array<ArrayBufferLike>` |
150
150
 
151
151
  [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/datastore.sdk.ts#L7)
152
152
 
@@ -166,11 +166,11 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
166
166
  - [OnSetDocContextSchema](#gear-onsetdoccontextschema)
167
167
  - [AssertSetDocContextSchema](#gear-assertsetdoccontextschema)
168
168
  - [CollectionsConfigSchema](#gear-collectionsconfigschema)
169
- - [SatelliteConfigEnvSchema](#gear-satelliteconfigenvschema)
170
- - [AssertSetDocConfigSchema](#gear-assertsetdocconfigschema)
171
- - [AssertConfigSchema](#gear-assertconfigschema)
172
- - [OnSetDocConfigSchema](#gear-onsetdocconfigschema)
173
- - [HookConfigSchema](#gear-hookconfigschema)
169
+ - [SatelliteEnvSchema](#gear-satelliteenvschema)
170
+ - [AssertSetDocSchema](#gear-assertsetdocschema)
171
+ - [AssertSchema](#gear-assertschema)
172
+ - [OnSetDocSchema](#gear-onsetdocschema)
173
+ - [HookSchema](#gear-hookschema)
174
174
 
175
175
  #### :gear: TimestampSchema
176
176
 
@@ -190,9 +190,9 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
190
190
 
191
191
  #### :gear: RawDataSchema
192
192
 
193
- | Constant | Type |
194
- | --------------- | ----------------------------------------------------------------------- |
195
- | `RawDataSchema` | `ZodType<Uint8Array<ArrayBuffer>, ZodTypeDef, Uint8Array<ArrayBuffer>>` |
193
+ | Constant | Type |
194
+ | --------------- | ------------------------------------------------------------------------------- |
195
+ | `RawDataSchema` | `ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>` |
196
196
 
197
197
  [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/core.ts#L30)
198
198
 
@@ -202,7 +202,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
202
202
  | -------------------- | ------------------------------------------------------------------------------- |
203
203
  | `RawPrincipalSchema` | `ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>` |
204
204
 
205
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/core.ts#L42)
205
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/core.ts#L44)
206
206
 
207
207
  #### :gear: RawUserIdSchema
208
208
 
@@ -210,7 +210,7 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
210
210
  | ----------------- | ------------------------------------------------------------------------------- |
211
211
  | `RawUserIdSchema` | `ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>` |
212
212
 
213
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/core.ts#L56)
213
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/core.ts#L58)
214
214
 
215
215
  #### :gear: DocDescriptionSchema
216
216
 
@@ -238,9 +238,9 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
238
238
 
239
239
  #### :gear: ProposedDocSchema
240
240
 
241
- | Constant | Type |
242
- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
243
- | `ProposedDocSchema` | `ZodObject<{ data: ZodType<Uint8Array<ArrayBuffer>, ZodTypeDef, Uint8Array<ArrayBuffer>>; description: ZodOptional<ZodString>; version: ZodOptional<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>` |
241
+ | Constant | Type |
242
+ | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
243
+ | `ProposedDocSchema` | `ZodObject<{ data: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; description: ZodOptional<...>; version: ZodOptional<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>` |
244
244
 
245
245
  [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/datastore.ts#L85)
246
246
 
@@ -254,9 +254,9 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
254
254
 
255
255
  #### :gear: SetDocSchema
256
256
 
257
- | Constant | Type |
258
- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
259
- | `SetDocSchema` | `ZodObject<{ data: ZodType<Uint8Array<ArrayBuffer>, ZodTypeDef, Uint8Array<ArrayBuffer>>; description: ZodOptional<ZodString>; version: ZodOptional<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>` |
257
+ | Constant | Type |
258
+ | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
259
+ | `SetDocSchema` | `ZodObject<{ data: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; description: ZodOptional<...>; version: ZodOptional<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>` |
260
260
 
261
261
  [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/datastore.ts#L140)
262
262
 
@@ -278,60 +278,51 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
278
278
 
279
279
  #### :gear: CollectionsConfigSchema
280
280
 
281
- Defines the collections where a hook or assertion should run.
282
-
283
281
  | Constant | Type |
284
282
  | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
285
283
  | `CollectionsConfigSchema` | `ZodObject<{ collections: ZodArray<ZodString, "many">; }, "strict", ZodTypeAny, { collections: string[]; }, { collections: string[]; }>` |
286
284
 
287
285
  [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/collections.config.ts#L6)
288
286
 
289
- #### :gear: SatelliteConfigEnvSchema
290
-
291
- Placeholder for future environment-specific configurations.
292
-
293
- Currently unused, but it may support features such as:
294
-
295
- - Defining the execution mode (e.g., staging or production).
296
- - Providing environment-specific values like `ckBtcLedgerId` for test or production.
287
+ #### :gear: SatelliteEnvSchema
297
288
 
298
- | Constant | Type |
299
- | -------------------------- | ---------------------------------- |
300
- | `SatelliteConfigEnvSchema` | `ZodRecord<ZodString, ZodUnknown>` |
289
+ | Constant | Type |
290
+ | -------------------- | ---------------------------------- |
291
+ | `SatelliteEnvSchema` | `ZodRecord<ZodString, ZodUnknown>` |
301
292
 
302
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/satellite.config.ts#L10)
293
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/satellite.env.ts#L6)
303
294
 
304
- #### :gear: AssertSetDocConfigSchema
295
+ #### :gear: AssertSetDocSchema
305
296
 
306
- | Constant | Type |
307
- | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
308
- | `AssertSetDocConfigSchema` | `ZodObject<extendShape<{ collections: ZodArray<ZodString, "many">; }, { assert: ZodFunction<ZodTuple<[ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; data: ZodObject<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>], ZodUnknown>, ZodPromise<...>>; }>, "strict", ZodTypeAny, { ....` |
297
+ | Constant | Type |
298
+ | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
299
+ | `AssertSetDocSchema` | `ZodObject<extendShape<{ collections: ZodArray<ZodString, "many">; }, { assert: ZodFunction<ZodTuple<[ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; data: ZodObject<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>], ZodUnknown>, ZodVoid>; }>, "strict", ZodTypeAny, { ...; }, {...` |
309
300
 
310
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assert.config.ts#L25)
301
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assertions.ts#L25)
311
302
 
312
- #### :gear: AssertConfigSchema
303
+ #### :gear: AssertSchema
313
304
 
314
- | Constant | Type |
315
- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
316
- | `AssertConfigSchema` | `ZodObject<extendShape<{ collections: ZodArray<ZodString, "many">; }, { assert: ZodFunction<ZodTuple<[ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; data: ZodObject<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>], ZodUnknown>, ZodPromise<...>>; }>, "strict", ZodTypeAny, { ....` |
305
+ | Constant | Type |
306
+ | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
307
+ | `AssertSchema` | `ZodObject<extendShape<{ collections: ZodArray<ZodString, "many">; }, { assert: ZodFunction<ZodTuple<[ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; data: ZodObject<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>], ZodUnknown>, ZodVoid>; }>, "strict", ZodTypeAny, { ...; }, {...` |
317
308
 
318
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assert.config.ts#L36)
309
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assertions.ts#L36)
319
310
 
320
- #### :gear: OnSetDocConfigSchema
311
+ #### :gear: OnSetDocSchema
321
312
 
322
- | Constant | Type |
323
- | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
324
- | `OnSetDocConfigSchema` | `ZodObject<extendShape<{ collections: ZodArray<ZodString, "many">; }, { run: ZodFunction<ZodTuple<[ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; data: ZodObject<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>], ZodUnknown>, ZodPromise<...>>; }>, "strict", ZodTypeAny, { ...;...` |
313
+ | Constant | Type |
314
+ | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
315
+ | `OnSetDocSchema` | `ZodObject<extendShape<{ collections: ZodArray<ZodString, "many">; }, { run: ZodFunction<ZodTuple<[ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; data: ZodObject<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>], ZodUnknown>, ZodPromise<...>>; }>, "strict", ZodTypeAny, { ...;...` |
325
316
 
326
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hook.config.ts#L25)
317
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hooks.ts#L25)
327
318
 
328
- #### :gear: HookConfigSchema
319
+ #### :gear: HookSchema
329
320
 
330
- | Constant | Type |
331
- | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
332
- | `HookConfigSchema` | `ZodObject<extendShape<{ collections: ZodArray<ZodString, "many">; }, { run: ZodFunction<ZodTuple<[ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; data: ZodObject<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>], ZodUnknown>, ZodPromise<...>>; }>, "strict", ZodTypeAny, { ...;...` |
321
+ | Constant | Type |
322
+ | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
323
+ | `HookSchema` | `ZodObject<extendShape<{ collections: ZodArray<ZodString, "many">; }, { run: ZodFunction<ZodTuple<[ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<...>>; data: ZodObject<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>], ZodUnknown>, ZodPromise<...>>; }>, "strict", ZodTypeAny, { ...;...` |
333
324
 
334
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hook.config.ts#L36)
325
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hooks.ts#L36)
335
326
 
336
327
  ### :cocktail: Types
337
328
 
@@ -351,13 +342,13 @@ Currently unused, but it may support features such as:
351
342
  - [OnSetDocContext](#gear-onsetdoccontext)
352
343
  - [AssertSetDocContext](#gear-assertsetdoccontext)
353
344
  - [CollectionsConfig](#gear-collectionsconfig)
354
- - [SatelliteConfigEnv](#gear-satelliteconfigenv)
355
- - [AssertSetDocConfig](#gear-assertsetdocconfig)
356
- - [AssertConfig](#gear-assertconfig)
345
+ - [SatelliteEnv](#gear-satelliteenv)
346
+ - [AssertSetDoc](#gear-assertsetdoc)
347
+ - [Assert](#gear-assert)
357
348
  - [AssertFn](#gear-assertfn)
358
349
  - [AssertFnOrObject](#gear-assertfnorobject)
359
- - [OnSetDocConfig](#gear-onsetdocconfig)
360
- - [HookConfig](#gear-hookconfig)
350
+ - [OnSetDoc](#gear-onsetdoc)
351
+ - [Hook](#gear-hook)
361
352
  - [HookFn](#gear-hookfn)
362
353
  - [HookFnOrObject](#gear-hookfnorobject)
363
354
 
@@ -395,7 +386,7 @@ This is used to store unstructured data in a document.
395
386
  | --------- | ------------------------------- |
396
387
  | `RawData` | `z.infer<typeof RawDataSchema>` |
397
388
 
398
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/core.ts#L37)
389
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/core.ts#L39)
399
390
 
400
391
  #### :gear: RawPrincipal
401
392
 
@@ -407,7 +398,7 @@ Principals are unique identities used in authentication and authorization.
407
398
  | -------------- | ------------------------------------ |
408
399
  | `RawPrincipal` | `z.infer<typeof RawPrincipalSchema>` |
409
400
 
410
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/core.ts#L51)
401
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/core.ts#L53)
411
402
 
412
403
  #### :gear: RawUserId
413
404
 
@@ -419,7 +410,7 @@ This is a principal associated with a user.
419
410
  | ----------- | --------------------------------- |
420
411
  | `RawUserId` | `z.infer<typeof RawUserIdSchema>` |
421
412
 
422
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/core.ts#L63)
413
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/core.ts#L65)
423
414
 
424
415
  #### :gear: DocDescription
425
416
 
@@ -537,47 +528,56 @@ it is created or updated. If validation fails, the developer should throw an err
537
528
 
538
529
  #### :gear: CollectionsConfig
539
530
 
531
+ Defines the collections where a hook or assertion should run.
532
+
540
533
  | Type | Type |
541
534
  | ------------------- | ----------------------------------------- |
542
535
  | `CollectionsConfig` | `z.infer<typeof CollectionsConfigSchema>` |
543
536
 
544
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/collections.config.ts#L16)
537
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/collections.config.ts#L18)
545
538
 
546
- #### :gear: SatelliteConfigEnv
539
+ #### :gear: SatelliteEnv
547
540
 
548
- | Type | Type |
549
- | -------------------- | ------------------------------------------ |
550
- | `SatelliteConfigEnv` | `z.infer<typeof SatelliteConfigEnvSchema>` |
551
-
552
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/satellite.config.ts#L13)
541
+ Placeholder for future environment-specific configurations.
553
542
 
554
- #### :gear: AssertSetDocConfig
543
+ Currently unused, but it may support features such as:
555
544
 
556
- Configuration schema for an assertion that runs when a document is created or updated.
545
+ - Defining the execution mode (e.g., staging or production).
546
+ - Providing environment-specific values like `ckBtcLedgerId` for test or production.
557
547
 
558
- | Type | Type |
559
- | -------------------- | ------------------------------------------ |
560
- | `AssertSetDocConfig` | `z.infer<typeof AssertSetDocConfigSchema>` |
548
+ | Type | Type |
549
+ | -------------- | ------------------------------------ |
550
+ | `SatelliteEnv` | `z.infer<typeof SatelliteEnvSchema>` |
561
551
 
562
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assert.config.ts#L30)
552
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/satellite.env.ts#L15)
563
553
 
564
- #### :gear: AssertConfig
554
+ #### :gear: AssertSetDoc
565
555
 
566
- All possible config for assertions.
556
+ An assertion that runs when a document is created or updated.
567
557
 
568
558
  | Type | Type |
569
559
  | -------------- | ------------------------------------ |
570
- | `AssertConfig` | `z.infer<typeof AssertConfigSchema>` |
560
+ | `AssertSetDoc` | `z.infer<typeof AssertSetDocSchema>` |
561
+
562
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assertions.ts#L30)
571
563
 
572
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assert.config.ts#L41)
564
+ #### :gear: Assert
565
+
566
+ All assertions definitions.
567
+
568
+ | Type | Type |
569
+ | -------- | ------------------------------ |
570
+ | `Assert` | `z.infer<typeof AssertSchema>` |
571
+
572
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assertions.ts#L41)
573
573
 
574
574
  #### :gear: AssertFn
575
575
 
576
- | Type | Type |
577
- | ---------- | ----------------------------------------------------------- |
578
- | `AssertFn` | `( config: z.infer<typeof SatelliteConfigEnvSchema> ) => T` |
576
+ | Type | Type |
577
+ | ---------- | --------------------------------------------------- |
578
+ | `AssertFn` | `(assert: z.infer<typeof SatelliteEnvSchema>) => T` |
579
579
 
580
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assert.config.ts#L45)
580
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assertions.ts#L45)
581
581
 
582
582
  #### :gear: AssertFnOrObject
583
583
 
@@ -585,35 +585,35 @@ All possible config for assertions.
585
585
  | ------------------ | ------------------ |
586
586
  | `AssertFnOrObject` | `T or AssertFn<T>` |
587
587
 
588
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assert.config.ts#L51)
588
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assertions.ts#L49)
589
589
 
590
- #### :gear: OnSetDocConfig
590
+ #### :gear: OnSetDoc
591
591
 
592
- Configuration for a hook that runs when a document is created or updated.
592
+ A hook that runs when a document is created or updated.
593
593
 
594
- | Type | Type |
595
- | ---------------- | -------------------------------------- |
596
- | `OnSetDocConfig` | `z.infer<typeof OnSetDocConfigSchema>` |
594
+ | Type | Type |
595
+ | ---------- | -------------------------------- |
596
+ | `OnSetDoc` | `z.infer<typeof OnSetDocSchema>` |
597
597
 
598
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hook.config.ts#L30)
598
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hooks.ts#L30)
599
599
 
600
- #### :gear: HookConfig
600
+ #### :gear: Hook
601
601
 
602
- All possible config for assertions.
602
+ All hooks definitions.
603
603
 
604
- | Type | Type |
605
- | ------------ | ---------------------------------- |
606
- | `HookConfig` | `z.infer<typeof HookConfigSchema>` |
604
+ | Type | Type |
605
+ | ------ | ---------------------------- |
606
+ | `Hook` | `z.infer<typeof HookSchema>` |
607
607
 
608
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hook.config.ts#L41)
608
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hooks.ts#L41)
609
609
 
610
610
  #### :gear: HookFn
611
611
 
612
- | Type | Type |
613
- | -------- | --------------------------------------------------------- |
614
- | `HookFn` | `(config: z.infer<typeof SatelliteConfigEnvSchema>) => T` |
612
+ | Type | Type |
613
+ | -------- | ------------------------------------------------- |
614
+ | `HookFn` | `(hook: z.infer<typeof SatelliteEnvSchema>) => T` |
615
615
 
616
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hook.config.ts#L45)
616
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hooks.ts#L45)
617
617
 
618
618
  #### :gear: HookFnOrObject
619
619
 
@@ -621,7 +621,7 @@ All possible config for assertions.
621
621
  | ---------------- | ---------------- |
622
622
  | `HookFnOrObject` | `T or HookFn<T>` |
623
623
 
624
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hook.config.ts#L49)
624
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hooks.ts#L49)
625
625
 
626
626
  <!-- TSDOC_END -->
627
627
 
@@ -1,2 +1,2 @@
1
- import*as o from"zod";import*as c from"zod";import*as r from"zod";var T=r.bigint(),i=r.bigint(),p=r.instanceof(Uint8Array),k=r.custom(e=>e instanceof Uint8Array,{message:"Expected Uint8Array"}),a=k;import*as n from"zod";var z=n.string().max(1024),d=n.object({owner:a,data:p,description:z.optional(),created_at:T,updated_at:T,version:i.optional()}).strict(),h=n.object({before:d.optional(),after:d}).strict(),u=n.object({data:p,description:z.optional(),version:i.optional()}).strict(),g=n.object({current:d.optional(),proposed:u}).strict(),P=n.object({data:p,description:z.optional(),version:i.optional()}).strict();var l=e=>c.object({caller:a,data:e}).strict(),C=e=>c.object({collection:c.string(),key:c.string(),data:e}).strict(),D=l(C(h)),A=l(C(g));import*as s from"zod";var f=s.object({collections:s.array(s.string()).min(1)}).strict();import*as m from"zod";var x=m.record(m.unknown());var j=e=>f.extend({assert:o.function().args(e).returns(o.promise(o.void()))}).strict(),H=j(A),M=H,_=e=>o.function().args(x).returns(e),Q=e=>o.union([e,_(e)]);function W(e){return e}import*as t from"zod";var b=e=>f.extend({run:t.function().args(e).returns(t.promise(t.void()))}).strict(),F=b(D),oe=F,w=e=>t.function().args(x).returns(e),te=e=>t.union([e,w(e)]);function ne(e){return e}import{jsonReplacer as R,jsonReviver as v}from"@dfinity/utils";var se=e=>JSON.parse(__juno_satellite_datastore_raw_data_to_text(e),v),ie=e=>__juno_satellite_datastore_raw_data_from_text(JSON.stringify(e,R));import{jsonReplacer as U}from"@dfinity/utils";var S=e=>{let O=e.map(y=>typeof y=="object"?JSON.stringify(y,U):y).join(" ");globalThis.__ic_cdk_print(O)};globalThis.console={info(...e){S(e)},log(...e){S(e)},warn(...e){S(e)},error(...e){S(e)}};export{M as AssertConfigSchema,Q as AssertFnOrObjectSchema,_ as AssertFnSchema,H as AssertSetDocConfigSchema,A as AssertSetDocContextSchema,f as CollectionsConfigSchema,g as DocAssertSetSchema,C as DocContextSchema,z as DocDescriptionSchema,d as DocSchema,h as DocUpsertSchema,oe as HookConfigSchema,te as HookFnOrObjectSchema,w as HookFnSchema,F as OnSetDocConfigSchema,D as OnSetDocContextSchema,u as ProposedDocSchema,p as RawDataSchema,k as RawPrincipalSchema,a as RawUserIdSchema,x as SatelliteConfigEnvSchema,P as SetDocSchema,T as TimestampSchema,i as VersionSchema,se as decodeDocData,W as defineAssert,ne as defineHook,ie as encodeDocData};
1
+ import*as r from"zod";import*as s from"zod";import*as n from"zod";var T=n.bigint(),p=n.bigint(),a=n.custom(e=>e instanceof Uint8Array,{message:"Expected Uint8Array"}),j=n.custom(e=>e instanceof Uint8Array,{message:"Expected Uint8Array"}),i=j;import*as o from"zod";var z=o.string().max(1024),d=o.object({owner:i,data:a,description:z.optional(),created_at:T,updated_at:T,version:p.optional()}).strict(),h=o.object({before:d.optional(),after:d}).strict(),H=o.object({data:a,description:z.optional(),version:p.optional()}).strict(),l=o.object({current:d.optional(),proposed:H}).strict(),P=o.object({data:a,description:z.optional(),version:p.optional()}).strict();var A=e=>s.object({caller:i,data:e}).strict(),D=e=>s.object({collection:s.string(),key:s.string(),data:e}).strict(),O=A(D(h)),k=A(D(l));import*as c from"zod";var m=c.object({collections:c.array(c.string()).min(1)}).strict();import*as x from"zod";var f=x.record(x.unknown());var _=e=>m.extend({assert:r.function().args(e).returns(r.void())}).strict(),b=_(k),M=b,C=e=>r.function().args(f).returns(e),Q=e=>r.union([e,C(e)]);function W(e){return e}import*as t from"zod";var g=e=>m.extend({run:t.function().args(e).returns(t.promise(t.void()))}).strict(),F=g(O),te=F,w=e=>t.function().args(f).returns(e),oe=e=>t.union([e,w(e)]);function re(e){return e}import{jsonReplacer as R,jsonReviver as U}from"@dfinity/utils";var ce=e=>JSON.parse(__juno_satellite_datastore_raw_data_to_text(e),U),pe=e=>__juno_satellite_datastore_raw_data_from_text(JSON.stringify(e,R));import{jsonReplacer as v}from"@dfinity/utils";var S=e=>{let u=e.map(y=>typeof y=="object"?JSON.stringify(y,v):y).join(" ");globalThis.__ic_cdk_print(u)};globalThis.console={info(...e){S(e)},log(...e){S(e)},warn(...e){S(e)},error(...e){S(e)}};export{Q as AssertFnOrObjectSchema,C as AssertFnSchema,M as AssertSchema,k as AssertSetDocContextSchema,b as AssertSetDocSchema,m as CollectionsConfigSchema,l as DocAssertSetSchema,D as DocContextSchema,z as DocDescriptionSchema,d as DocSchema,h as DocUpsertSchema,oe as HookFnOrObjectSchema,w as HookFnSchema,te as HookSchema,O as OnSetDocContextSchema,F as OnSetDocSchema,H as ProposedDocSchema,a as RawDataSchema,j as RawPrincipalSchema,i as RawUserIdSchema,f as SatelliteEnvSchema,P as SetDocSchema,T as TimestampSchema,p as VersionSchema,ce as decodeDocData,W as defineAssert,re as defineHook,pe as encodeDocData};
2
2
  //# sourceMappingURL=index.js.map