@junobuild/functions 0.0.3 → 0.0.4

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
@@ -14,10 +14,15 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
14
14
 
15
15
  ### :toolbox: Functions
16
16
 
17
+ - [DocContextSchema](#gear-doccontextschema)
18
+ - [AssertFnSchema](#gear-assertfnschema)
19
+ - [AssertFnOrObjectSchema](#gear-assertfnorobjectschema)
17
20
  - [defineAssert](#gear-defineassert)
18
21
  - [defineAssert](#gear-defineassert)
19
22
  - [defineAssert](#gear-defineassert)
20
23
  - [defineAssert](#gear-defineassert)
24
+ - [HookFnSchema](#gear-hookfnschema)
25
+ - [HookFnOrObjectSchema](#gear-hookfnorobjectschema)
21
26
  - [defineHook](#gear-definehook)
22
27
  - [defineHook](#gear-definehook)
23
28
  - [defineHook](#gear-definehook)
@@ -25,252 +30,348 @@ JavaScript and TypeScript utilities for [Juno] Serverless Functions.
25
30
  - [decodeDocData](#gear-decodedocdata)
26
31
  - [encodeDocData](#gear-encodedocdata)
27
32
 
33
+ #### :gear: DocContextSchema
34
+
35
+ | Function | Type |
36
+ | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
37
+ | `DocContextSchema` | `<T extends z.ZodTypeAny>(dataSchema: T) => ZodObject<{ collection: ZodString; key: ZodString; data: T; }, "strict", ZodTypeAny, { [k in keyof addQuestionMarks<baseObjectOutputType<{ collection: ZodString; key: ZodString; data: T; }>, any>]: addQuestionMarks<...>[k]; }, { [k in keyof baseObjectInputType<...>]: baseOb...` |
38
+
39
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/context.ts#L33)
40
+
41
+ #### :gear: AssertFnSchema
42
+
43
+ | Function | Type |
44
+ | ---------------- | --------------------------------------------------------------------------------------------------------------------------- |
45
+ | `AssertFnSchema` | `<T extends z.ZodTypeAny>(hookConfigSchema: T) => ZodFunction<ZodTuple<[ZodRecord<ZodString, ZodUnknown>], ZodUnknown>, T>` |
46
+
47
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assert.config.ts#L43)
48
+
49
+ #### :gear: AssertFnOrObjectSchema
50
+
51
+ | Function | Type |
52
+ | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ |
53
+ | `AssertFnOrObjectSchema` | `<T extends z.ZodTypeAny>(hookConfigSchema: T) => ZodUnion<[T, ZodFunction<ZodTuple<[ZodRecord<ZodString, ZodUnknown>], ZodUnknown>, T>]>` |
54
+
55
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assert.config.ts#L49)
56
+
28
57
  #### :gear: defineAssert
29
58
 
30
- | Function | Type |
31
- | -------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
32
- | `defineAssert` | `{ (config: AssertSetDocConfig): AssertSetDocConfig; (config: AssertFn): AssertFn; (config: AssertFnOrObject): AssertFnOrObject; }` |
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<...>; }` |
33
62
 
34
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assert.config.ts#L34)
63
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assert.config.ts#L53)
35
64
 
36
65
  #### :gear: defineAssert
37
66
 
38
- | Function | Type |
39
- | -------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
40
- | `defineAssert` | `{ (config: AssertSetDocConfig): AssertSetDocConfig; (config: AssertFn): AssertFn; (config: AssertFnOrObject): AssertFnOrObject; }` |
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<...>; }` |
41
70
 
42
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assert.config.ts#L35)
71
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assert.config.ts#L54)
43
72
 
44
73
  #### :gear: defineAssert
45
74
 
46
- | Function | Type |
47
- | -------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
48
- | `defineAssert` | `{ (config: AssertSetDocConfig): AssertSetDocConfig; (config: AssertFn): AssertFn; (config: AssertFnOrObject): AssertFnOrObject; }` |
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<...>; }` |
49
78
 
50
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assert.config.ts#L36)
79
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assert.config.ts#L55)
51
80
 
52
81
  #### :gear: defineAssert
53
82
 
54
- | Function | Type |
55
- | -------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
56
- | `defineAssert` | `{ (config: AssertSetDocConfig): AssertSetDocConfig; (config: AssertFn): AssertFn; (config: AssertFnOrObject): AssertFnOrObject; }` |
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<...>; }` |
86
+
87
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assert.config.ts#L58)
57
88
 
58
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assert.config.ts#L37)
89
+ #### :gear: HookFnSchema
90
+
91
+ | Function | Type |
92
+ | -------------- | --------------------------------------------------------------------------------------------------------------------------- |
93
+ | `HookFnSchema` | `<T extends z.ZodTypeAny>(hookConfigSchema: T) => ZodFunction<ZodTuple<[ZodRecord<ZodString, ZodUnknown>], ZodUnknown>, T>` |
94
+
95
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hook.config.ts#L43)
96
+
97
+ #### :gear: HookFnOrObjectSchema
98
+
99
+ | Function | Type |
100
+ | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
101
+ | `HookFnOrObjectSchema` | `<T extends z.ZodTypeAny>(hookConfigSchema: T) => ZodUnion<[T, ZodFunction<ZodTuple<[ZodRecord<ZodString, ZodUnknown>], ZodUnknown>, T>]>` |
102
+
103
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hook.config.ts#L47)
59
104
 
60
105
  #### :gear: defineHook
61
106
 
62
- | Function | Type |
63
- | ------------ | ------------------------------------------------------------------------------------------------------------------- |
64
- | `defineHook` | `{ (config: OnSetDocConfig): OnSetDocConfig; (config: HookFn): HookFn; (config: HookFnOrObject): HookFnOrObject; }` |
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>; }` |
65
110
 
66
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hook.config.ts#L32)
111
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hook.config.ts#L51)
67
112
 
68
113
  #### :gear: defineHook
69
114
 
70
- | Function | Type |
71
- | ------------ | ------------------------------------------------------------------------------------------------------------------- |
72
- | `defineHook` | `{ (config: OnSetDocConfig): OnSetDocConfig; (config: HookFn): HookFn; (config: HookFnOrObject): HookFnOrObject; }` |
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>; }` |
73
118
 
74
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hook.config.ts#L33)
119
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hook.config.ts#L52)
75
120
 
76
121
  #### :gear: defineHook
77
122
 
78
- | Function | Type |
79
- | ------------ | ------------------------------------------------------------------------------------------------------------------- |
80
- | `defineHook` | `{ (config: OnSetDocConfig): OnSetDocConfig; (config: HookFn): HookFn; (config: HookFnOrObject): HookFnOrObject; }` |
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>; }` |
81
126
 
82
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hook.config.ts#L34)
127
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hook.config.ts#L53)
83
128
 
84
129
  #### :gear: defineHook
85
130
 
86
- | Function | Type |
87
- | ------------ | ------------------------------------------------------------------------------------------------------------------- |
88
- | `defineHook` | `{ (config: OnSetDocConfig): OnSetDocConfig; (config: HookFn): HookFn; (config: HookFnOrObject): HookFnOrObject; }` |
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>; }` |
89
134
 
90
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hook.config.ts#L35)
135
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hook.config.ts#L54)
91
136
 
92
137
  #### :gear: decodeDocData
93
138
 
94
- | Function | Type |
95
- | --------------- | ------------------------- |
96
- | `decodeDocData` | `<T>(data: RawData) => T` |
139
+ | Function | Type |
140
+ | --------------- | ----------------------------------------- |
141
+ | `decodeDocData` | `<T>(data: Uint8Array<ArrayBuffer>) => T` |
97
142
 
98
143
  [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/datastore.sdk.ts#L4)
99
144
 
100
145
  #### :gear: encodeDocData
101
146
 
102
- | Function | Type |
103
- | --------------- | ------------------------- |
104
- | `encodeDocData` | `<T>(data: T) => RawData` |
147
+ | Function | Type |
148
+ | --------------- | ----------------------------------------- |
149
+ | `encodeDocData` | `<T>(data: T) => Uint8Array<ArrayBuffer>` |
105
150
 
106
151
  [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/datastore.sdk.ts#L7)
107
152
 
108
- ### :tropical_drink: Interfaces
153
+ ### :wrench: Constants
154
+
155
+ - [TimestampSchema](#gear-timestampschema)
156
+ - [VersionSchema](#gear-versionschema)
157
+ - [RawDataSchema](#gear-rawdataschema)
158
+ - [RawPrincipalSchema](#gear-rawprincipalschema)
159
+ - [RawUserIdSchema](#gear-rawuseridschema)
160
+ - [DocDescriptionSchema](#gear-docdescriptionschema)
161
+ - [DocSchema](#gear-docschema)
162
+ - [DocUpsertSchema](#gear-docupsertschema)
163
+ - [ProposedDocSchema](#gear-proposeddocschema)
164
+ - [DocAssertSetSchema](#gear-docassertsetschema)
165
+ - [SetDocSchema](#gear-setdocschema)
166
+ - [OnSetDocContextSchema](#gear-onsetdoccontextschema)
167
+ - [AssertSetDocContextSchema](#gear-assertsetdoccontextschema)
168
+ - [CollectionsConfigSchema](#gear-collectionsconfigschema)
169
+ - [SatelliteConfigEnvSchema](#gear-satelliteconfigenvschema)
170
+ - [AssertSetDocConfigSchema](#gear-assertsetdocconfigschema)
171
+ - [AssertConfigSchema](#gear-assertconfigschema)
172
+ - [OnSetDocConfigSchema](#gear-onsetdocconfigschema)
173
+ - [HookConfigSchema](#gear-hookconfigschema)
174
+
175
+ #### :gear: TimestampSchema
176
+
177
+ | Constant | Type |
178
+ | ----------------- | ----------- |
179
+ | `TimestampSchema` | `ZodBigInt` |
109
180
 
110
- - [CollectionsConfig](#gear-collectionsconfig)
111
- - [DocUpsert](#gear-docupsert)
112
- - [DocAssertSet](#gear-docassertset)
113
- - [Doc](#gear-doc)
114
- - [SetDoc](#gear-setdoc)
115
- - [HookContext](#gear-hookcontext)
116
- - [DocContext](#gear-doccontext)
117
- - [AssertAssertConfig](#gear-assertassertconfig)
118
- - [AssertSetDocConfig](#gear-assertsetdocconfig)
119
- - [OnHookConfig](#gear-onhookconfig)
120
- - [OnSetDocConfig](#gear-onsetdocconfig)
181
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/core.ts#L6)
121
182
 
122
- #### :gear: CollectionsConfig
183
+ #### :gear: VersionSchema
123
184
 
124
- Defines the collections where a hook or assertion should run.
185
+ | Constant | Type |
186
+ | --------------- | ----------- |
187
+ | `VersionSchema` | `ZodBigInt` |
125
188
 
126
- | Property | Type | Description |
127
- | ------------- | ---------- | ------------------------------------------------------------------------ |
128
- | `collections` | `string[]` | A list of collection names where the hook or assertion will be executed. |
189
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/core.ts#L18)
129
190
 
130
- #### :gear: DocUpsert
191
+ #### :gear: RawDataSchema
131
192
 
132
- Represents a document update operation.
193
+ | Constant | Type |
194
+ | --------------- | ----------------------------------------------------------------------- |
195
+ | `RawDataSchema` | `ZodType<Uint8Array<ArrayBuffer>, ZodTypeDef, Uint8Array<ArrayBuffer>>` |
133
196
 
134
- This is used in hooks where a document is either being created or updated.
197
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/core.ts#L30)
135
198
 
136
- | Property | Type | Description |
137
- | -------- | ------------------ | -------------------------------------------------------------------------------------------- |
138
- | `before` | `Doc or undefined` | The previous version of the document before the update. Undefined if this is a new document. |
139
- | `after` | `Doc` | The new version of the document after the update. |
199
+ #### :gear: RawPrincipalSchema
140
200
 
141
- #### :gear: DocAssertSet
201
+ | Constant | Type |
202
+ | -------------------- | ------------------------------------------------------------------------------- |
203
+ | `RawPrincipalSchema` | `ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>` |
142
204
 
143
- Represents a validation check before setting a document.
205
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/core.ts#L42)
144
206
 
145
- The developer can compare the `current` and `proposed` versions and
146
- throw an error if their validation fails.
207
+ #### :gear: RawUserIdSchema
147
208
 
148
- | Property | Type | Description |
149
- | ---------- | ------------------ | ---------------------------------------------------------------------------------------------- |
150
- | `current` | `Doc or undefined` | The current version of the document before the operation. Undefined if this is a new document. |
151
- | `proposed` | `SetDoc` | The proposed version of the document. This can be validated before allowing the operation. |
209
+ | Constant | Type |
210
+ | ----------------- | ------------------------------------------------------------------------------- |
211
+ | `RawUserIdSchema` | `ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>` |
152
212
 
153
- #### :gear: Doc
213
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/core.ts#L56)
154
214
 
155
- Represents a document stored in a collection.
215
+ #### :gear: DocDescriptionSchema
156
216
 
157
- | Property | Type | Description |
158
- | ------------- | --------------------- | ----------------------------------------------------------------------------------------------------------------------- |
159
- | `owner` | `RawPrincipal` | The user who owns this document. |
160
- | `data` | `RawData` | The raw data of the document. |
161
- | `description` | `string or undefined` | An optional description of the document. |
162
- | `created_at` | `bigint` | The timestamp when the document was first created. |
163
- | `updated_at` | `bigint` | The timestamp when the document was last updated. |
164
- | `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. |
217
+ | Constant | Type |
218
+ | ---------------------- | ----------- |
219
+ | `DocDescriptionSchema` | `ZodString` |
165
220
 
166
- #### :gear: SetDoc
221
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/datastore.ts#L7)
167
222
 
168
- Represents a request to set or update a document.
223
+ #### :gear: DocSchema
169
224
 
170
- This is used when submitting new document data.
225
+ | Constant | Type |
226
+ | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
227
+ | `DocSchema` | `ZodObject<{ owner: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; ... 4 more ...; version: ZodOptional<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>` |
171
228
 
172
- | Property | Type | Description |
173
- | ------------- | --------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
174
- | `data` | `RawData` | The raw data of the document. |
175
- | `description` | `string or undefined` | An optional description of the document. |
176
- | `version` | `bigint or undefined` | The expected version number to ensure consistency. If provided, the operation will fail if the stored version does not match. |
229
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/datastore.ts#L17)
177
230
 
178
- #### :gear: HookContext
231
+ #### :gear: DocUpsertSchema
179
232
 
180
- Represents the context provided to hooks, containing information about the caller and related data.
233
+ | Constant | Type |
234
+ | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
235
+ | `DocUpsertSchema` | `ZodObject<{ before: ZodOptional<ZodObject<{ owner: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; ... 4 more ...; version: ZodOptional<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>>; after: ZodObject<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>` |
181
236
 
182
- | Property | Type | Description |
183
- | -------- | -------------- | ------------------------------------------------------------------------------- |
184
- | `caller` | `RawPrincipal` | The user who originally triggered the function that in turn triggered the hook. |
185
- | `data` | `T` | The data associated with the hook execution. |
237
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/datastore.ts#L60)
186
238
 
187
- #### :gear: DocContext
239
+ #### :gear: ProposedDocSchema
188
240
 
189
- Represents the context of a document operation within a collection.
241
+ | Constant | Type |
242
+ | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
243
+ | `ProposedDocSchema` | `ZodObject<{ data: ZodType<Uint8Array<ArrayBuffer>, ZodTypeDef, Uint8Array<ArrayBuffer>>; description: ZodOptional<ZodString>; version: ZodOptional<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>` |
190
244
 
191
- | Property | Type | Description |
192
- | ------------ | -------- | -------------------------------------------------------------- |
193
- | `collection` | `string` | The name of the collection where the document is stored. |
194
- | `key` | `string` | The unique key identifying the document within the collection. |
195
- | `data` | `T` | The data associated with the document operation. |
245
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/datastore.ts#L85)
196
246
 
197
- #### :gear: AssertAssertConfig
247
+ #### :gear: DocAssertSetSchema
198
248
 
199
- The generic configuration for assertion hooks that manage collections.
249
+ | Constant | Type |
250
+ | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
251
+ | `DocAssertSetSchema` | `ZodObject<{ current: ZodOptional<ZodObject<{ owner: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; ... 4 more ...; version: ZodOptional<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>>; proposed: ZodObject<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>` |
200
252
 
201
- | Property | Type | Description |
202
- | -------------- | ------- | ----------- |
203
- | `assertSetDoc` | `never` | |
253
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/datastore.ts#L113)
204
254
 
205
- #### :gear: AssertSetDocConfig
255
+ #### :gear: SetDocSchema
206
256
 
207
- A configuration object that includes the `assertSetDoc` function.
208
- This function is called to validate a document before it is created or updated.
257
+ | Constant | Type |
258
+ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
259
+ | `SetDocSchema` | `ZodObject<{ data: ZodType<Uint8Array<ArrayBuffer>, ZodTypeDef, Uint8Array<ArrayBuffer>>; description: ZodOptional<ZodString>; version: ZodOptional<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>` |
209
260
 
210
- | Property | Type | Description |
211
- | -------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
212
- | `assertSetDoc` | `(context: AssertSetDocContext) => void` | A function that runs synchronously before a document is set in the Datastore. This can be used to enforce your validation rules. param: context - Provides details about the document being validated.throws: {Error} If your validation fails, throw an exception to prevent the document from being saved. |
261
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/datastore.ts#L140)
213
262
 
214
- #### :gear: OnHookConfig
263
+ #### :gear: OnSetDocContextSchema
215
264
 
216
- The generic configuration for hooks that manage collections.
265
+ | Constant | Type |
266
+ | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
267
+ | `OnSetDocContextSchema` | `ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; data: ZodObject<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>` |
217
268
 
218
- | Property | Type | Description |
219
- | ---------- | ------- | ----------- |
220
- | `onSetDoc` | `never` | |
269
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/context.ts#L63)
221
270
 
222
- #### :gear: OnSetDocConfig
271
+ #### :gear: AssertSetDocContextSchema
272
+
273
+ | Constant | Type |
274
+ | --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
275
+ | `AssertSetDocContextSchema` | `ZodObject<{ caller: ZodType<Uint8Array<ArrayBufferLike>, ZodTypeDef, Uint8Array<ArrayBufferLike>>; data: ZodObject<...>; }, "strict", ZodTypeAny, { ...; }, { ...; }>` |
276
+
277
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/context.ts#L76)
278
+
279
+ #### :gear: CollectionsConfigSchema
280
+
281
+ Defines the collections where a hook or assertion should run.
282
+
283
+ | Constant | Type |
284
+ | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
285
+ | `CollectionsConfigSchema` | `ZodObject<{ collections: ZodArray<ZodString, "many">; }, "strict", ZodTypeAny, { collections: string[]; }, { collections: string[]; }>` |
286
+
287
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/collections.config.ts#L6)
288
+
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.
297
+
298
+ | Constant | Type |
299
+ | -------------------------- | ---------------------------------- |
300
+ | `SatelliteConfigEnvSchema` | `ZodRecord<ZodString, ZodUnknown>` |
301
+
302
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/satellite.config.ts#L10)
303
+
304
+ #### :gear: AssertSetDocConfigSchema
305
+
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, { ....` |
309
+
310
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assert.config.ts#L25)
223
311
 
224
- A configuration object that includes the `onSetDoc` function.
225
- This function is called when a document is created or updated.
312
+ #### :gear: AssertConfigSchema
226
313
 
227
- | Property | Type | Description |
228
- | ---------- | --------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
229
- | `onSetDoc` | `(context: OnSetDocContext) => Promise<void>` | A function that runs when a document is set in the Datastore. param: context - Provides details about the document being saved.returns: Resolves when your operation is complete. |
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, { ....` |
317
+
318
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assert.config.ts#L36)
319
+
320
+ #### :gear: OnSetDocConfigSchema
321
+
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, { ...;...` |
325
+
326
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hook.config.ts#L25)
327
+
328
+ #### :gear: HookConfigSchema
329
+
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, { ...;...` |
333
+
334
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hook.config.ts#L36)
230
335
 
231
336
  ### :cocktail: Types
232
337
 
233
- - [SatelliteConfigEnv](#gear-satelliteconfigenv)
234
338
  - [Timestamp](#gear-timestamp)
235
339
  - [Version](#gear-version)
236
340
  - [RawData](#gear-rawdata)
237
341
  - [RawPrincipal](#gear-rawprincipal)
238
342
  - [RawUserId](#gear-rawuserid)
343
+ - [DocDescription](#gear-docdescription)
344
+ - [Doc](#gear-doc)
345
+ - [DocUpsert](#gear-docupsert)
346
+ - [ProposedDoc](#gear-proposeddoc)
347
+ - [DocAssertSet](#gear-docassertset)
348
+ - [SetDoc](#gear-setdoc)
349
+ - [HookContext](#gear-hookcontext)
350
+ - [DocContext](#gear-doccontext)
239
351
  - [OnSetDocContext](#gear-onsetdoccontext)
240
352
  - [AssertSetDocContext](#gear-assertsetdoccontext)
353
+ - [CollectionsConfig](#gear-collectionsconfig)
354
+ - [SatelliteConfigEnv](#gear-satelliteconfigenv)
355
+ - [AssertSetDocConfig](#gear-assertsetdocconfig)
241
356
  - [AssertConfig](#gear-assertconfig)
242
357
  - [AssertFn](#gear-assertfn)
243
358
  - [AssertFnOrObject](#gear-assertfnorobject)
359
+ - [OnSetDocConfig](#gear-onsetdocconfig)
244
360
  - [HookConfig](#gear-hookconfig)
245
361
  - [HookFn](#gear-hookfn)
246
362
  - [HookFnOrObject](#gear-hookfnorobject)
247
363
 
248
- #### :gear: SatelliteConfigEnv
249
-
250
- Placeholder for future environment-specific configurations.
251
-
252
- Currently unused, but it may support features such as:
253
-
254
- - Defining the execution mode (e.g., staging or production).
255
- - Providing environment-specific values like `ckBtcLedgerId` for test or production.
256
-
257
- | Type | Type |
258
- | -------------------- | ---- |
259
- | `SatelliteConfigEnv` | |
260
-
261
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/satellite.config.ts#L8)
262
-
263
364
  #### :gear: Timestamp
264
365
 
265
366
  Represents a timestamp in nanoseconds since the Unix epoch.
266
367
 
267
368
  Used for tracking when events occur, such as document creation and updates.
268
369
 
269
- | Type | Type |
270
- | ----------- | ---- |
271
- | `Timestamp` | |
370
+ | Type | Type |
371
+ | ----------- | --------------------------------- |
372
+ | `Timestamp` | `z.infer<typeof TimestampSchema>` |
272
373
 
273
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/core.ts#L6)
374
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/core.ts#L13)
274
375
 
275
376
  #### :gear: Version
276
377
 
@@ -278,11 +379,11 @@ Represents a version number for tracking changes.
278
379
 
279
380
  This is typically incremented with each update to ensure consistency.
280
381
 
281
- | Type | Type |
282
- | --------- | ---- |
283
- | `Version` | |
382
+ | Type | Type |
383
+ | --------- | ------------------------------- |
384
+ | `Version` | `z.infer<typeof VersionSchema>` |
284
385
 
285
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/core.ts#L13)
386
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/core.ts#L25)
286
387
 
287
388
  #### :gear: RawData
288
389
 
@@ -290,11 +391,11 @@ Represents raw binary data.
290
391
 
291
392
  This is used to store unstructured data in a document.
292
393
 
293
- | Type | Type |
294
- | --------- | ------------ |
295
- | `RawData` | `Uint8Array` |
394
+ | Type | Type |
395
+ | --------- | ------------------------------- |
396
+ | `RawData` | `z.infer<typeof RawDataSchema>` |
296
397
 
297
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/core.ts#L20)
398
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/core.ts#L37)
298
399
 
299
400
  #### :gear: RawPrincipal
300
401
 
@@ -302,11 +403,11 @@ Represents a raw principal identifier.
302
403
 
303
404
  Principals are unique identities used in authentication and authorization.
304
405
 
305
- | Type | Type |
306
- | -------------- | ------------ |
307
- | `RawPrincipal` | `Uint8Array` |
406
+ | Type | Type |
407
+ | -------------- | ------------------------------------ |
408
+ | `RawPrincipal` | `z.infer<typeof RawPrincipalSchema>` |
308
409
 
309
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/core.ts#L27)
410
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/core.ts#L51)
310
411
 
311
412
  #### :gear: RawUserId
312
413
 
@@ -314,11 +415,99 @@ Represents a raw user identifier.
314
415
 
315
416
  This is a principal associated with a user.
316
417
 
317
- | Type | Type |
318
- | ----------- | -------------- |
319
- | `RawUserId` | `RawPrincipal` |
418
+ | Type | Type |
419
+ | ----------- | --------------------------------- |
420
+ | `RawUserId` | `z.infer<typeof RawUserIdSchema>` |
421
+
422
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/core.ts#L63)
423
+
424
+ #### :gear: DocDescription
425
+
426
+ Represents a document description with a maximum length of 1024 characters.
427
+
428
+ | Type | Type |
429
+ | ---------------- | -------------------------------------- |
430
+ | `DocDescription` | `z.infer<typeof DocDescriptionSchema>` |
431
+
432
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/datastore.ts#L12)
433
+
434
+ #### :gear: Doc
435
+
436
+ Represents a document stored in a collection.
437
+
438
+ | Type | Type |
439
+ | ----- | --------------------------- |
440
+ | `Doc` | `z.infer<typeof DocSchema>` |
320
441
 
321
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/core.ts#L34)
442
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/datastore.ts#L55)
443
+
444
+ #### :gear: DocUpsert
445
+
446
+ Represents a document update operation.
447
+
448
+ This is used in hooks where a document is either being created or updated.
449
+
450
+ | Type | Type |
451
+ | ----------- | --------------------------------- |
452
+ | `DocUpsert` | `z.infer<typeof DocUpsertSchema>` |
453
+
454
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/datastore.ts#L80)
455
+
456
+ #### :gear: ProposedDoc
457
+
458
+ Represents the proposed version of a document.
459
+ This can be validated before allowing the operation.
460
+
461
+ | Type | Type |
462
+ | ------------- | ----------------------------------- |
463
+ | `ProposedDoc` | `z.infer<typeof ProposedDocSchema>` |
464
+
465
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/datastore.ts#L108)
466
+
467
+ #### :gear: DocAssertSet
468
+
469
+ Represents a validation check before setting a document.
470
+
471
+ The developer can compare the `current` and `proposed` versions and
472
+ throw an error if their validation fails.
473
+
474
+ | Type | Type |
475
+ | -------------- | ------------------------------------ |
476
+ | `DocAssertSet` | `z.infer<typeof DocAssertSetSchema>` |
477
+
478
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/datastore.ts#L135)
479
+
480
+ #### :gear: SetDoc
481
+
482
+ Represents a request to set or update a document.
483
+
484
+ This is used when submitting new document data.
485
+
486
+ | Type | Type |
487
+ | -------- | ------------------------------ |
488
+ | `SetDoc` | `z.infer<typeof SetDocSchema>` |
489
+
490
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/datastore.ts#L165)
491
+
492
+ #### :gear: HookContext
493
+
494
+ Represents the context provided to hooks, containing information about the caller and related data.
495
+
496
+ | Type | Type |
497
+ | ------------- | -------------------------------------------------- |
498
+ | `HookContext` | `z.infer<ReturnType<typeof HookContextSchema<T>>>` |
499
+
500
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/context.ts#L28)
501
+
502
+ #### :gear: DocContext
503
+
504
+ Represents the context of a document operation within a collection.
505
+
506
+ | Type | Type |
507
+ | ------------ | ------------------------------------------------- |
508
+ | `DocContext` | `z.infer<ReturnType<typeof DocContextSchema<T>>>` |
509
+
510
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/context.ts#L58)
322
511
 
323
512
  #### :gear: OnSetDocContext
324
513
 
@@ -327,11 +516,11 @@ The context provided to the `onSetDoc` hook.
327
516
  This context contains information about the document being created or updated,
328
517
  along with details about the user who triggered the operation.
329
518
 
330
- | Type | Type |
331
- | ----------------- | ------------------------------------ |
332
- | `OnSetDocContext` | `HookContext<DocContext<DocUpsert>>` |
519
+ | Type | Type |
520
+ | ----------------- | --------------------------------------- |
521
+ | `OnSetDocContext` | `z.infer<typeof OnSetDocContextSchema>` |
333
522
 
334
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/context.ts#L49)
523
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/context.ts#L71)
335
524
 
336
525
  #### :gear: AssertSetDocContext
337
526
 
@@ -340,59 +529,99 @@ The context provided to the `assertSetDoc` hook.
340
529
  This context contains information about the document being validated before
341
530
  it is created or updated. If validation fails, the developer should throw an error.
342
531
 
343
- | Type | Type |
344
- | --------------------- | --------------------------------------- |
345
- | `AssertSetDocContext` | `HookContext<DocContext<DocAssertSet>>` |
532
+ | Type | Type |
533
+ | --------------------- | ------------------------------------------- |
534
+ | `AssertSetDocContext` | `z.infer<typeof AssertSetDocContextSchema>` |
535
+
536
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/context.ts#L84)
537
+
538
+ #### :gear: CollectionsConfig
346
539
 
347
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/context.ts#L57)
540
+ | Type | Type |
541
+ | ------------------- | ----------------------------------------- |
542
+ | `CollectionsConfig` | `z.infer<typeof CollectionsConfigSchema>` |
543
+
544
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/collections.config.ts#L16)
545
+
546
+ #### :gear: SatelliteConfigEnv
547
+
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)
553
+
554
+ #### :gear: AssertSetDocConfig
555
+
556
+ Configuration schema for an assertion that runs when a document is created or updated.
557
+
558
+ | Type | Type |
559
+ | -------------------- | ------------------------------------------ |
560
+ | `AssertSetDocConfig` | `z.infer<typeof AssertSetDocConfigSchema>` |
561
+
562
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assert.config.ts#L30)
348
563
 
349
564
  #### :gear: AssertConfig
350
565
 
351
- | Type | Type |
352
- | -------------- | -------------------- |
353
- | `AssertConfig` | `AssertSetDocConfig` |
566
+ All possible config for assertions.
354
567
 
355
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assert.config.ts#L28)
568
+ | Type | Type |
569
+ | -------------- | ------------------------------------ |
570
+ | `AssertConfig` | `z.infer<typeof AssertConfigSchema>` |
571
+
572
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assert.config.ts#L41)
356
573
 
357
574
  #### :gear: AssertFn
358
575
 
359
- | Type | Type |
360
- | ---------- | ---------------------------------------------- |
361
- | `AssertFn` | `(config: SatelliteConfigEnv) => AssertConfig` |
576
+ | Type | Type |
577
+ | ---------- | ----------------------------------------------------------- |
578
+ | `AssertFn` | `( config: z.infer<typeof SatelliteConfigEnvSchema> ) => T` |
362
579
 
363
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assert.config.ts#L30)
580
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assert.config.ts#L45)
364
581
 
365
582
  #### :gear: AssertFnOrObject
366
583
 
367
- | Type | Type |
368
- | ------------------ | -------------------------- |
369
- | `AssertFnOrObject` | `AssertConfig or AssertFn` |
584
+ | Type | Type |
585
+ | ------------------ | ------------------ |
586
+ | `AssertFnOrObject` | `T or AssertFn<T>` |
587
+
588
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assert.config.ts#L51)
589
+
590
+ #### :gear: OnSetDocConfig
591
+
592
+ Configuration for a hook that runs when a document is created or updated.
593
+
594
+ | Type | Type |
595
+ | ---------------- | -------------------------------------- |
596
+ | `OnSetDocConfig` | `z.infer<typeof OnSetDocConfigSchema>` |
370
597
 
371
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/assert.config.ts#L32)
598
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hook.config.ts#L30)
372
599
 
373
600
  #### :gear: HookConfig
374
601
 
375
- | Type | Type |
376
- | ------------ | ---------------- |
377
- | `HookConfig` | `OnSetDocConfig` |
602
+ All possible config for assertions.
378
603
 
379
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hook.config.ts#L26)
604
+ | Type | Type |
605
+ | ------------ | ---------------------------------- |
606
+ | `HookConfig` | `z.infer<typeof HookConfigSchema>` |
607
+
608
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hook.config.ts#L41)
380
609
 
381
610
  #### :gear: HookFn
382
611
 
383
- | Type | Type |
384
- | -------- | -------------------------------------------- |
385
- | `HookFn` | `(config: SatelliteConfigEnv) => HookConfig` |
612
+ | Type | Type |
613
+ | -------- | --------------------------------------------------------- |
614
+ | `HookFn` | `(config: z.infer<typeof SatelliteConfigEnvSchema>) => T` |
386
615
 
387
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hook.config.ts#L28)
616
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hook.config.ts#L45)
388
617
 
389
618
  #### :gear: HookFnOrObject
390
619
 
391
- | Type | Type |
392
- | ---------------- | ---------------------- |
393
- | `HookFnOrObject` | `HookConfig or HookFn` |
620
+ | Type | Type |
621
+ | ---------------- | ---------------- |
622
+ | `HookFnOrObject` | `T or HookFn<T>` |
394
623
 
395
- [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hook.config.ts#L30)
624
+ [:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/configs/hook.config.ts#L49)
396
625
 
397
626
  <!-- TSDOC_END -->
398
627