@junobuild/functions 0.0.6 → 0.0.7
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 +224 -107
- package/chunk-OVO3T2DM.js +2 -0
- package/chunk-OVO3T2DM.js.map +7 -0
- package/global.d.js +1 -0
- package/global.d.js.map +7 -0
- package/global.d.ts +17 -0
- package/{dist/types/configs → hooks/db}/assertions.d.ts +13 -13
- package/{dist/types/configs → hooks/db}/hooks.d.ts +13 -13
- package/{dist/types/configs/collections.config.d.ts → hooks/schemas/collections.d.ts} +3 -3
- package/hooks/schemas/context.d.ts +56 -0
- package/{dist/types/hooks → hooks/schemas/db}/context.d.ts +8 -76
- package/{dist/types/hooks/datastore.d.ts → hooks/schemas/db/payload.d.ts} +0 -145
- package/ic-cdk/id.d.ts +11 -0
- package/ic-cdk.d.ts +1 -0
- package/ic-cdk.js +7 -0
- package/ic-cdk.js.map +7 -0
- package/index.d.ts +10 -0
- package/index.js +2 -0
- package/index.js.map +7 -0
- package/package.json +22 -13
- package/schemas/candid.d.ts +11 -0
- package/{dist/types/hooks → schemas}/core.d.ts +16 -10
- package/schemas/db.d.ts +57 -0
- package/sdk/db.sdk.d.ts +13 -0
- package/sdk/schemas/db.d.ts +109 -0
- package/sdk/serializer.sdk.d.ts +17 -0
- package/sdk.d.ts +3 -0
- package/sdk.js +2 -0
- package/sdk.js.map +7 -0
- package/src/global.d.ts +17 -0
- package/dist/browser/index.js +0 -2
- package/dist/browser/index.js.map +0 -7
- package/dist/index.js +0 -1
- package/dist/types/global.d.ts +0 -8
- package/dist/types/index.d.ts +0 -9
- package/dist/types/sdk/datastore.sdk.d.ts +0 -3
- /package/{dist/types/configs → hooks/schemas}/satellite.env.d.ts +0 -0
- /package/{dist/types/polyfills → polyfills}/console.polyfill.d.ts +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import*as r from"zod";var i=r.custom(o=>o instanceof Uint8Array,{message:"Expected Uint8Array"});import*as e from"zod";var a=e.bigint(),c=e.bigint(),p=e.custom(o=>o instanceof Uint8Array,{message:"Expected Uint8Array"}),n=i,f=e.string(),h=e.string();import*as t from"zod";var m=t.string().max(1024),z=t.object({owner:n,data:p,description:m.optional(),created_at:a,updated_at:a,version:c.optional()}).strict();export{i as a,a as b,c,p as d,n as e,f,h as g,m as h,z as i};
|
|
2
|
+
//# sourceMappingURL=chunk-OVO3T2DM.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["src/schemas/candid.ts", "src/schemas/core.ts", "src/schemas/db.ts"],
|
|
4
|
+
"sourcesContent": ["import * as z from 'zod';\n\n/**\n * @see RawPrincipal\n */\nexport const RawPrincipalSchema = z.custom<Uint8Array>((val) => val instanceof Uint8Array, {\n message: 'Expected Uint8Array'\n});\n\n/**\n * Represents a raw principal identifier.\n *\n * Principals are unique identities used in authentication and authorization.\n */\nexport type RawPrincipal = z.infer<typeof RawPrincipalSchema>;\n", "import * as z from 'zod';\nimport {RawPrincipalSchema} from './candid';\n\n/**\n * @see Timestamp\n */\nexport const TimestampSchema = z.bigint();\n\n/**\n * Represents a timestamp in nanoseconds since the Unix epoch.\n *\n * Used for tracking when events occur, such as document creation and updates.\n */\nexport type Timestamp = z.infer<typeof TimestampSchema>;\n\n/**\n * @see Version\n */\nexport const VersionSchema = z.bigint();\n\n/**\n * Represents a version number for tracking changes.\n *\n * This is typically incremented with each update to ensure consistency.\n */\nexport type Version = z.infer<typeof VersionSchema>;\n\n/**\n * @see RawData\n */\nexport const RawDataSchema = z.custom<Uint8Array>((val) => val instanceof Uint8Array, {\n message: 'Expected Uint8Array'\n});\n\n/**\n * Represents raw binary data.\n *\n * This is used to store unstructured data in a document.\n */\nexport type RawData = z.infer<typeof RawDataSchema>;\n\n/**\n * @see RawUserId\n */\nexport const RawUserIdSchema = RawPrincipalSchema;\n\n/**\n * Represents a raw user identifier.\n *\n * This is a principal associated with a user.\n */\nexport type RawUserId = z.infer<typeof RawUserIdSchema>;\n\n/**\n * @see Collection\n */\nexport const CollectionSchema = z.string();\n\n/**\n * A collection name where data are stored.\n */\nexport type Collection = z.infer<typeof CollectionSchema>;\n\n/**\n * @see Key\n */\nexport const KeySchema = z.string();\n\n/**\n * A unique key identifier within a collection.\n */\nexport type Key = z.infer<typeof KeySchema>;\n", "import * as z from 'zod';\nimport {RawDataSchema, RawUserIdSchema, TimestampSchema, VersionSchema} from './core';\n\n/**\n * @see DocDescription\n */\nexport const DocDescriptionSchema = z.string().max(1024);\n\n/**\n * Represents a document description with a maximum length of 1024 characters.\n */\nexport type DocDescription = z.infer<typeof DocDescriptionSchema>;\n\n/**\n * @see Doc\n */\nexport const DocSchema = z\n .object({\n /**\n * The user who owns this document.\n */\n owner: RawUserIdSchema,\n\n /**\n * The raw data of the document.\n */\n data: RawDataSchema,\n\n /**\n * An optional description of the document.\n */\n description: DocDescriptionSchema.optional(),\n\n /**\n * The timestamp when the document was first created.\n */\n created_at: TimestampSchema,\n\n /**\n * The timestamp when the document was last updated.\n */\n updated_at: TimestampSchema,\n\n /**\n * The version number of the document, used for consistency checks.\n * If not provided, it's assumed to be the first version.\n */\n version: VersionSchema.optional()\n })\n .strict();\n\n/**\n * Represents a document stored in a collection.\n */\nexport type Doc = z.infer<typeof DocSchema>;\n"],
|
|
5
|
+
"mappings": "AAAA,UAAYA,MAAO,MAKZ,IAAMC,EAAuB,SAAoBC,GAAQA,aAAe,WAAY,CACzF,QAAS,qBACX,CAAC,ECPD,UAAYC,MAAO,MAMZ,IAAMC,EAAoB,SAAO,EAY3BC,EAAkB,SAAO,EAYzBC,EAAkB,SAAoBC,GAAQA,aAAe,WAAY,CACpF,QAAS,qBACX,CAAC,EAYYC,EAAkBC,EAYlBC,EAAqB,SAAO,EAU5BC,EAAc,SAAO,EClElC,UAAYC,MAAO,MAMZ,IAAMC,EAAyB,SAAO,EAAE,IAAI,IAAI,EAU1CC,EACV,SAAO,CAIN,MAAOC,EAKP,KAAMC,EAKN,YAAaH,EAAqB,SAAS,EAK3C,WAAYI,EAKZ,WAAYA,EAMZ,QAASC,EAAc,SAAS,CAClC,CAAC,EACA,OAAO",
|
|
6
|
+
"names": ["z", "RawPrincipalSchema", "val", "z", "TimestampSchema", "VersionSchema", "RawDataSchema", "val", "RawUserIdSchema", "RawPrincipalSchema", "CollectionSchema", "KeySchema", "z", "DocDescriptionSchema", "DocSchema", "RawUserIdSchema", "RawDataSchema", "TimestampSchema", "VersionSchema"]
|
|
7
|
+
}
|
package/global.d.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=global.d.js.map
|
package/global.d.js.map
ADDED
package/global.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type {RawData, RawPrincipal, RawUserId} from './schemas/core';
|
|
2
|
+
import type {SetDoc} from './sdk/schemas/db';
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
function __juno_satellite_datastore_raw_data_to_text(data: RawData): string;
|
|
6
|
+
function __juno_satellite_datastore_raw_data_from_text(data: string): RawData;
|
|
7
|
+
|
|
8
|
+
function __juno_satellite_datastore_set_doc_store(
|
|
9
|
+
caller: RawUserId,
|
|
10
|
+
collection: string,
|
|
11
|
+
key: string,
|
|
12
|
+
value: Omit<SetDoc, 'key'>
|
|
13
|
+
): void;
|
|
14
|
+
|
|
15
|
+
function __ic_cdk_id(): RawPrincipal;
|
|
16
|
+
function __ic_cdk_print(msg: string): void;
|
|
17
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as z from 'zod';
|
|
2
|
-
import { SatelliteEnvSchema } from '
|
|
2
|
+
import { SatelliteEnvSchema } from '../schemas/satellite.env';
|
|
3
3
|
/**
|
|
4
4
|
* @see AssertSetDoc
|
|
5
5
|
*/
|
|
@@ -98,8 +98,8 @@ export declare const AssertSetDocSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
98
98
|
version?: bigint | undefined;
|
|
99
99
|
} | undefined;
|
|
100
100
|
};
|
|
101
|
-
collection: string;
|
|
102
101
|
key: string;
|
|
102
|
+
collection: string;
|
|
103
103
|
}, {
|
|
104
104
|
data: {
|
|
105
105
|
proposed: {
|
|
@@ -116,8 +116,8 @@ export declare const AssertSetDocSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
116
116
|
version?: bigint | undefined;
|
|
117
117
|
} | undefined;
|
|
118
118
|
};
|
|
119
|
-
collection: string;
|
|
120
119
|
key: string;
|
|
120
|
+
collection: string;
|
|
121
121
|
}>;
|
|
122
122
|
}, "strict", z.ZodTypeAny, {
|
|
123
123
|
data: {
|
|
@@ -136,8 +136,8 @@ export declare const AssertSetDocSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
136
136
|
version?: bigint | undefined;
|
|
137
137
|
} | undefined;
|
|
138
138
|
};
|
|
139
|
-
collection: string;
|
|
140
139
|
key: string;
|
|
140
|
+
collection: string;
|
|
141
141
|
};
|
|
142
142
|
caller: Uint8Array<ArrayBufferLike>;
|
|
143
143
|
}, {
|
|
@@ -157,8 +157,8 @@ export declare const AssertSetDocSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
157
157
|
version?: bigint | undefined;
|
|
158
158
|
} | undefined;
|
|
159
159
|
};
|
|
160
|
-
collection: string;
|
|
161
160
|
key: string;
|
|
161
|
+
collection: string;
|
|
162
162
|
};
|
|
163
163
|
caller: Uint8Array<ArrayBufferLike>;
|
|
164
164
|
}>], z.ZodUnknown>, z.ZodVoid>;
|
|
@@ -181,8 +181,8 @@ export declare const AssertSetDocSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
181
181
|
version?: bigint | undefined;
|
|
182
182
|
} | undefined;
|
|
183
183
|
};
|
|
184
|
-
collection: string;
|
|
185
184
|
key: string;
|
|
185
|
+
collection: string;
|
|
186
186
|
};
|
|
187
187
|
caller: Uint8Array<ArrayBufferLike>;
|
|
188
188
|
}, ...args: unknown[]) => void;
|
|
@@ -205,8 +205,8 @@ export declare const AssertSetDocSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
205
205
|
version?: bigint | undefined;
|
|
206
206
|
} | undefined;
|
|
207
207
|
};
|
|
208
|
-
collection: string;
|
|
209
208
|
key: string;
|
|
209
|
+
collection: string;
|
|
210
210
|
};
|
|
211
211
|
caller: Uint8Array<ArrayBufferLike>;
|
|
212
212
|
}, ...args: unknown[]) => void;
|
|
@@ -313,8 +313,8 @@ export declare const AssertSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
313
313
|
version?: bigint | undefined;
|
|
314
314
|
} | undefined;
|
|
315
315
|
};
|
|
316
|
-
collection: string;
|
|
317
316
|
key: string;
|
|
317
|
+
collection: string;
|
|
318
318
|
}, {
|
|
319
319
|
data: {
|
|
320
320
|
proposed: {
|
|
@@ -331,8 +331,8 @@ export declare const AssertSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
331
331
|
version?: bigint | undefined;
|
|
332
332
|
} | undefined;
|
|
333
333
|
};
|
|
334
|
-
collection: string;
|
|
335
334
|
key: string;
|
|
335
|
+
collection: string;
|
|
336
336
|
}>;
|
|
337
337
|
}, "strict", z.ZodTypeAny, {
|
|
338
338
|
data: {
|
|
@@ -351,8 +351,8 @@ export declare const AssertSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
351
351
|
version?: bigint | undefined;
|
|
352
352
|
} | undefined;
|
|
353
353
|
};
|
|
354
|
-
collection: string;
|
|
355
354
|
key: string;
|
|
355
|
+
collection: string;
|
|
356
356
|
};
|
|
357
357
|
caller: Uint8Array<ArrayBufferLike>;
|
|
358
358
|
}, {
|
|
@@ -372,8 +372,8 @@ export declare const AssertSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
372
372
|
version?: bigint | undefined;
|
|
373
373
|
} | undefined;
|
|
374
374
|
};
|
|
375
|
-
collection: string;
|
|
376
375
|
key: string;
|
|
376
|
+
collection: string;
|
|
377
377
|
};
|
|
378
378
|
caller: Uint8Array<ArrayBufferLike>;
|
|
379
379
|
}>], z.ZodUnknown>, z.ZodVoid>;
|
|
@@ -396,8 +396,8 @@ export declare const AssertSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
396
396
|
version?: bigint | undefined;
|
|
397
397
|
} | undefined;
|
|
398
398
|
};
|
|
399
|
-
collection: string;
|
|
400
399
|
key: string;
|
|
400
|
+
collection: string;
|
|
401
401
|
};
|
|
402
402
|
caller: Uint8Array<ArrayBufferLike>;
|
|
403
403
|
}, ...args: unknown[]) => void;
|
|
@@ -420,8 +420,8 @@ export declare const AssertSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
420
420
|
version?: bigint | undefined;
|
|
421
421
|
} | undefined;
|
|
422
422
|
};
|
|
423
|
-
collection: string;
|
|
424
423
|
key: string;
|
|
424
|
+
collection: string;
|
|
425
425
|
};
|
|
426
426
|
caller: Uint8Array<ArrayBufferLike>;
|
|
427
427
|
}, ...args: unknown[]) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as z from 'zod';
|
|
2
|
-
import { SatelliteEnvSchema } from '
|
|
2
|
+
import { SatelliteEnvSchema } from '../schemas/satellite.env';
|
|
3
3
|
/**
|
|
4
4
|
* @see OnSetDoc
|
|
5
5
|
*/
|
|
@@ -116,8 +116,8 @@ export declare const OnSetDocSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
116
116
|
version?: bigint | undefined;
|
|
117
117
|
} | undefined;
|
|
118
118
|
};
|
|
119
|
-
collection: string;
|
|
120
119
|
key: string;
|
|
120
|
+
collection: string;
|
|
121
121
|
}, {
|
|
122
122
|
data: {
|
|
123
123
|
after: {
|
|
@@ -137,8 +137,8 @@ export declare const OnSetDocSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
137
137
|
version?: bigint | undefined;
|
|
138
138
|
} | undefined;
|
|
139
139
|
};
|
|
140
|
-
collection: string;
|
|
141
140
|
key: string;
|
|
141
|
+
collection: string;
|
|
142
142
|
}>;
|
|
143
143
|
}, "strict", z.ZodTypeAny, {
|
|
144
144
|
data: {
|
|
@@ -160,8 +160,8 @@ export declare const OnSetDocSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
160
160
|
version?: bigint | undefined;
|
|
161
161
|
} | undefined;
|
|
162
162
|
};
|
|
163
|
-
collection: string;
|
|
164
163
|
key: string;
|
|
164
|
+
collection: string;
|
|
165
165
|
};
|
|
166
166
|
caller: Uint8Array<ArrayBufferLike>;
|
|
167
167
|
}, {
|
|
@@ -184,8 +184,8 @@ export declare const OnSetDocSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
184
184
|
version?: bigint | undefined;
|
|
185
185
|
} | undefined;
|
|
186
186
|
};
|
|
187
|
-
collection: string;
|
|
188
187
|
key: string;
|
|
188
|
+
collection: string;
|
|
189
189
|
};
|
|
190
190
|
caller: Uint8Array<ArrayBufferLike>;
|
|
191
191
|
}>], z.ZodUnknown>, z.ZodPromise<z.ZodVoid>>;
|
|
@@ -211,8 +211,8 @@ export declare const OnSetDocSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
211
211
|
version?: bigint | undefined;
|
|
212
212
|
} | undefined;
|
|
213
213
|
};
|
|
214
|
-
collection: string;
|
|
215
214
|
key: string;
|
|
215
|
+
collection: string;
|
|
216
216
|
};
|
|
217
217
|
caller: Uint8Array<ArrayBufferLike>;
|
|
218
218
|
}, ...args: unknown[]) => Promise<void>;
|
|
@@ -238,8 +238,8 @@ export declare const OnSetDocSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
238
238
|
version?: bigint | undefined;
|
|
239
239
|
} | undefined;
|
|
240
240
|
};
|
|
241
|
-
collection: string;
|
|
242
241
|
key: string;
|
|
242
|
+
collection: string;
|
|
243
243
|
};
|
|
244
244
|
caller: Uint8Array<ArrayBufferLike>;
|
|
245
245
|
}, ...args: unknown[]) => Promise<void>;
|
|
@@ -364,8 +364,8 @@ export declare const HookSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
364
364
|
version?: bigint | undefined;
|
|
365
365
|
} | undefined;
|
|
366
366
|
};
|
|
367
|
-
collection: string;
|
|
368
367
|
key: string;
|
|
368
|
+
collection: string;
|
|
369
369
|
}, {
|
|
370
370
|
data: {
|
|
371
371
|
after: {
|
|
@@ -385,8 +385,8 @@ export declare const HookSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
385
385
|
version?: bigint | undefined;
|
|
386
386
|
} | undefined;
|
|
387
387
|
};
|
|
388
|
-
collection: string;
|
|
389
388
|
key: string;
|
|
389
|
+
collection: string;
|
|
390
390
|
}>;
|
|
391
391
|
}, "strict", z.ZodTypeAny, {
|
|
392
392
|
data: {
|
|
@@ -408,8 +408,8 @@ export declare const HookSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
408
408
|
version?: bigint | undefined;
|
|
409
409
|
} | undefined;
|
|
410
410
|
};
|
|
411
|
-
collection: string;
|
|
412
411
|
key: string;
|
|
412
|
+
collection: string;
|
|
413
413
|
};
|
|
414
414
|
caller: Uint8Array<ArrayBufferLike>;
|
|
415
415
|
}, {
|
|
@@ -432,8 +432,8 @@ export declare const HookSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
432
432
|
version?: bigint | undefined;
|
|
433
433
|
} | undefined;
|
|
434
434
|
};
|
|
435
|
-
collection: string;
|
|
436
435
|
key: string;
|
|
436
|
+
collection: string;
|
|
437
437
|
};
|
|
438
438
|
caller: Uint8Array<ArrayBufferLike>;
|
|
439
439
|
}>], z.ZodUnknown>, z.ZodPromise<z.ZodVoid>>;
|
|
@@ -459,8 +459,8 @@ export declare const HookSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
459
459
|
version?: bigint | undefined;
|
|
460
460
|
} | undefined;
|
|
461
461
|
};
|
|
462
|
-
collection: string;
|
|
463
462
|
key: string;
|
|
463
|
+
collection: string;
|
|
464
464
|
};
|
|
465
465
|
caller: Uint8Array<ArrayBufferLike>;
|
|
466
466
|
}, ...args: unknown[]) => Promise<void>;
|
|
@@ -486,8 +486,8 @@ export declare const HookSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
486
486
|
version?: bigint | undefined;
|
|
487
487
|
} | undefined;
|
|
488
488
|
};
|
|
489
|
-
collection: string;
|
|
490
489
|
key: string;
|
|
490
|
+
collection: string;
|
|
491
491
|
};
|
|
492
492
|
caller: Uint8Array<ArrayBufferLike>;
|
|
493
493
|
}, ...args: unknown[]) => Promise<void>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as z from 'zod';
|
|
2
2
|
/**
|
|
3
|
-
* @see
|
|
3
|
+
* @see Collections
|
|
4
4
|
*/
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const CollectionsSchema: z.ZodObject<{
|
|
6
6
|
/**
|
|
7
7
|
* An array containing at least one collection name where the hook or assertion will be executed.
|
|
8
8
|
*/
|
|
@@ -15,4 +15,4 @@ export declare const CollectionsConfigSchema: z.ZodObject<{
|
|
|
15
15
|
/**
|
|
16
16
|
* Defines the collections where a hook or assertion should run.
|
|
17
17
|
*/
|
|
18
|
-
export type
|
|
18
|
+
export type Collections = z.infer<typeof CollectionsSchema>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* @see HookContext
|
|
4
|
+
*/
|
|
5
|
+
export declare const HookContextSchema: <T extends z.ZodTypeAny>(dataSchema: T) => z.ZodObject<{
|
|
6
|
+
/**
|
|
7
|
+
* The user who originally triggered the function that in turn triggered the hook.
|
|
8
|
+
*/
|
|
9
|
+
caller: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
|
|
10
|
+
/**
|
|
11
|
+
* The data associated with the hook execution.
|
|
12
|
+
*/
|
|
13
|
+
data: T;
|
|
14
|
+
}, "strict", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
15
|
+
/**
|
|
16
|
+
* The user who originally triggered the function that in turn triggered the hook.
|
|
17
|
+
*/
|
|
18
|
+
caller: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
|
|
19
|
+
/**
|
|
20
|
+
* The data associated with the hook execution.
|
|
21
|
+
*/
|
|
22
|
+
data: T;
|
|
23
|
+
}>, any> extends infer T_1 ? { [k in keyof T_1]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
24
|
+
/**
|
|
25
|
+
* The user who originally triggered the function that in turn triggered the hook.
|
|
26
|
+
*/
|
|
27
|
+
caller: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
|
|
28
|
+
/**
|
|
29
|
+
* The data associated with the hook execution.
|
|
30
|
+
*/
|
|
31
|
+
data: T;
|
|
32
|
+
}>, any>[k]; } : never, z.baseObjectInputType<{
|
|
33
|
+
/**
|
|
34
|
+
* The user who originally triggered the function that in turn triggered the hook.
|
|
35
|
+
*/
|
|
36
|
+
caller: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
|
|
37
|
+
/**
|
|
38
|
+
* The data associated with the hook execution.
|
|
39
|
+
*/
|
|
40
|
+
data: T;
|
|
41
|
+
}> extends infer T_2 ? { [k_1 in keyof T_2]: z.baseObjectInputType<{
|
|
42
|
+
/**
|
|
43
|
+
* The user who originally triggered the function that in turn triggered the hook.
|
|
44
|
+
*/
|
|
45
|
+
caller: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
|
|
46
|
+
/**
|
|
47
|
+
* The data associated with the hook execution.
|
|
48
|
+
*/
|
|
49
|
+
data: T;
|
|
50
|
+
}>[k_1]; } : never>;
|
|
51
|
+
/**
|
|
52
|
+
* Represents the context provided to hooks, containing information about the caller and related data.
|
|
53
|
+
*
|
|
54
|
+
* @template T - The type of data associated with the hook.
|
|
55
|
+
*/
|
|
56
|
+
export type HookContext<T extends z.ZodTypeAny> = z.infer<ReturnType<typeof HookContextSchema<T>>>;
|
|
@@ -1,59 +1,4 @@
|
|
|
1
1
|
import * as z from 'zod';
|
|
2
|
-
/**
|
|
3
|
-
* @see HookContext
|
|
4
|
-
*/
|
|
5
|
-
declare const HookContextSchema: <T extends z.ZodTypeAny>(dataSchema: T) => z.ZodObject<{
|
|
6
|
-
/**
|
|
7
|
-
* The user who originally triggered the function that in turn triggered the hook.
|
|
8
|
-
*/
|
|
9
|
-
caller: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
|
|
10
|
-
/**
|
|
11
|
-
* The data associated with the hook execution.
|
|
12
|
-
*/
|
|
13
|
-
data: T;
|
|
14
|
-
}, "strict", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
15
|
-
/**
|
|
16
|
-
* The user who originally triggered the function that in turn triggered the hook.
|
|
17
|
-
*/
|
|
18
|
-
caller: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
|
|
19
|
-
/**
|
|
20
|
-
* The data associated with the hook execution.
|
|
21
|
-
*/
|
|
22
|
-
data: T;
|
|
23
|
-
}>, any> extends infer T_1 ? { [k in keyof T_1]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
24
|
-
/**
|
|
25
|
-
* The user who originally triggered the function that in turn triggered the hook.
|
|
26
|
-
*/
|
|
27
|
-
caller: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
|
|
28
|
-
/**
|
|
29
|
-
* The data associated with the hook execution.
|
|
30
|
-
*/
|
|
31
|
-
data: T;
|
|
32
|
-
}>, any>[k]; } : never, z.baseObjectInputType<{
|
|
33
|
-
/**
|
|
34
|
-
* The user who originally triggered the function that in turn triggered the hook.
|
|
35
|
-
*/
|
|
36
|
-
caller: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
|
|
37
|
-
/**
|
|
38
|
-
* The data associated with the hook execution.
|
|
39
|
-
*/
|
|
40
|
-
data: T;
|
|
41
|
-
}> extends infer T_2 ? { [k_1 in keyof T_2]: z.baseObjectInputType<{
|
|
42
|
-
/**
|
|
43
|
-
* The user who originally triggered the function that in turn triggered the hook.
|
|
44
|
-
*/
|
|
45
|
-
caller: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
|
|
46
|
-
/**
|
|
47
|
-
* The data associated with the hook execution.
|
|
48
|
-
*/
|
|
49
|
-
data: T;
|
|
50
|
-
}>[k_1]; } : never>;
|
|
51
|
-
/**
|
|
52
|
-
* Represents the context provided to hooks, containing information about the caller and related data.
|
|
53
|
-
*
|
|
54
|
-
* @template T - The type of data associated with the hook.
|
|
55
|
-
*/
|
|
56
|
-
export type HookContext<T extends z.ZodTypeAny> = z.infer<ReturnType<typeof HookContextSchema<T>>>;
|
|
57
2
|
/**
|
|
58
3
|
* @see DocContext
|
|
59
4
|
*/
|
|
@@ -133,13 +78,7 @@ export type DocContext<T extends z.ZodTypeAny> = z.infer<ReturnType<typeof DocCo
|
|
|
133
78
|
* @see OnSetDocContext
|
|
134
79
|
*/
|
|
135
80
|
export declare const OnSetDocContextSchema: z.ZodObject<{
|
|
136
|
-
/**
|
|
137
|
-
* The user who originally triggered the function that in turn triggered the hook.
|
|
138
|
-
*/
|
|
139
81
|
caller: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
|
|
140
|
-
/**
|
|
141
|
-
* The data associated with the hook execution.
|
|
142
|
-
*/
|
|
143
82
|
data: z.ZodObject<{
|
|
144
83
|
/**
|
|
145
84
|
* The name of the collection where the document is stored.
|
|
@@ -251,8 +190,8 @@ export declare const OnSetDocContextSchema: z.ZodObject<{
|
|
|
251
190
|
version?: bigint | undefined;
|
|
252
191
|
} | undefined;
|
|
253
192
|
};
|
|
254
|
-
collection: string;
|
|
255
193
|
key: string;
|
|
194
|
+
collection: string;
|
|
256
195
|
}, {
|
|
257
196
|
data: {
|
|
258
197
|
after: {
|
|
@@ -272,8 +211,8 @@ export declare const OnSetDocContextSchema: z.ZodObject<{
|
|
|
272
211
|
version?: bigint | undefined;
|
|
273
212
|
} | undefined;
|
|
274
213
|
};
|
|
275
|
-
collection: string;
|
|
276
214
|
key: string;
|
|
215
|
+
collection: string;
|
|
277
216
|
}>;
|
|
278
217
|
}, "strict", z.ZodTypeAny, {
|
|
279
218
|
data: {
|
|
@@ -295,8 +234,8 @@ export declare const OnSetDocContextSchema: z.ZodObject<{
|
|
|
295
234
|
version?: bigint | undefined;
|
|
296
235
|
} | undefined;
|
|
297
236
|
};
|
|
298
|
-
collection: string;
|
|
299
237
|
key: string;
|
|
238
|
+
collection: string;
|
|
300
239
|
};
|
|
301
240
|
caller: Uint8Array<ArrayBufferLike>;
|
|
302
241
|
}, {
|
|
@@ -319,8 +258,8 @@ export declare const OnSetDocContextSchema: z.ZodObject<{
|
|
|
319
258
|
version?: bigint | undefined;
|
|
320
259
|
} | undefined;
|
|
321
260
|
};
|
|
322
|
-
collection: string;
|
|
323
261
|
key: string;
|
|
262
|
+
collection: string;
|
|
324
263
|
};
|
|
325
264
|
caller: Uint8Array<ArrayBufferLike>;
|
|
326
265
|
}>;
|
|
@@ -335,13 +274,7 @@ export type OnSetDocContext = z.infer<typeof OnSetDocContextSchema>;
|
|
|
335
274
|
* @see AssertSetDocContext
|
|
336
275
|
*/
|
|
337
276
|
export declare const AssertSetDocContextSchema: z.ZodObject<{
|
|
338
|
-
/**
|
|
339
|
-
* The user who originally triggered the function that in turn triggered the hook.
|
|
340
|
-
*/
|
|
341
277
|
caller: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
|
|
342
|
-
/**
|
|
343
|
-
* The data associated with the hook execution.
|
|
344
|
-
*/
|
|
345
278
|
data: z.ZodObject<{
|
|
346
279
|
/**
|
|
347
280
|
* The name of the collection where the document is stored.
|
|
@@ -435,8 +368,8 @@ export declare const AssertSetDocContextSchema: z.ZodObject<{
|
|
|
435
368
|
version?: bigint | undefined;
|
|
436
369
|
} | undefined;
|
|
437
370
|
};
|
|
438
|
-
collection: string;
|
|
439
371
|
key: string;
|
|
372
|
+
collection: string;
|
|
440
373
|
}, {
|
|
441
374
|
data: {
|
|
442
375
|
proposed: {
|
|
@@ -453,8 +386,8 @@ export declare const AssertSetDocContextSchema: z.ZodObject<{
|
|
|
453
386
|
version?: bigint | undefined;
|
|
454
387
|
} | undefined;
|
|
455
388
|
};
|
|
456
|
-
collection: string;
|
|
457
389
|
key: string;
|
|
390
|
+
collection: string;
|
|
458
391
|
}>;
|
|
459
392
|
}, "strict", z.ZodTypeAny, {
|
|
460
393
|
data: {
|
|
@@ -473,8 +406,8 @@ export declare const AssertSetDocContextSchema: z.ZodObject<{
|
|
|
473
406
|
version?: bigint | undefined;
|
|
474
407
|
} | undefined;
|
|
475
408
|
};
|
|
476
|
-
collection: string;
|
|
477
409
|
key: string;
|
|
410
|
+
collection: string;
|
|
478
411
|
};
|
|
479
412
|
caller: Uint8Array<ArrayBufferLike>;
|
|
480
413
|
}, {
|
|
@@ -494,8 +427,8 @@ export declare const AssertSetDocContextSchema: z.ZodObject<{
|
|
|
494
427
|
version?: bigint | undefined;
|
|
495
428
|
} | undefined;
|
|
496
429
|
};
|
|
497
|
-
collection: string;
|
|
498
430
|
key: string;
|
|
431
|
+
collection: string;
|
|
499
432
|
};
|
|
500
433
|
caller: Uint8Array<ArrayBufferLike>;
|
|
501
434
|
}>;
|
|
@@ -506,4 +439,3 @@ export declare const AssertSetDocContextSchema: z.ZodObject<{
|
|
|
506
439
|
* it is created or updated. If validation fails, the developer should throw an error.
|
|
507
440
|
*/
|
|
508
441
|
export type AssertSetDocContext = z.infer<typeof AssertSetDocContextSchema>;
|
|
509
|
-
export {};
|