@junobuild/functions 0.0.15 → 0.1.0
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 +921 -67
- package/chunk-SFZECPH3.js +2 -0
- package/chunk-SFZECPH3.js.map +7 -0
- package/global.d.ts +85 -12
- package/hooks/assertions.d.ts +280 -280
- package/hooks/hooks.d.ts +280 -280
- package/hooks/schemas/storage/context.d.ts +168 -168
- package/hooks/schemas/storage/payload.d.ts +21 -21
- package/ic-cdk/time.ic-cdk.d.ts +10 -0
- package/ic-cdk.d.ts +1 -0
- package/ic-cdk.js +1 -1
- package/ic-cdk.js.map +4 -4
- package/index.d.ts +2 -0
- package/index.js +1 -1
- package/index.js.map +4 -4
- package/package.json +1 -1
- package/polyfills/random.polyfill.d.ts +4 -0
- package/schemas/list.d.ts +428 -0
- package/schemas/storage.d.ts +280 -16
- package/sdk/db.sdk.d.ts +81 -7
- package/sdk/schemas/collections.d.ts +9 -0
- package/sdk/schemas/db.d.ts +872 -28
- package/sdk/schemas/params.d.ts +298 -0
- package/sdk/schemas/storage.d.ts +1011 -0
- package/sdk/storage.sdk.d.ts +100 -0
- package/sdk.d.ts +4 -0
- package/sdk.js +1 -1
- package/sdk.js.map +4 -4
- package/src/global.d.ts +85 -12
- package/chunk-ZUGCGTXG.js +0 -2
- package/chunk-ZUGCGTXG.js.map +0 -7
package/schemas/storage.d.ts
CHANGED
|
@@ -4,6 +4,18 @@ import { type Collection, type Description, type RawUserId, type Timestamp, type
|
|
|
4
4
|
* Represents a single HTTP header as a tuple of name and value.
|
|
5
5
|
*/
|
|
6
6
|
export type HeaderField = [string, string];
|
|
7
|
+
/**
|
|
8
|
+
* @see HeaderFields
|
|
9
|
+
*/
|
|
10
|
+
export declare const HeaderFieldsSchema: z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>, "many">;
|
|
11
|
+
/**
|
|
12
|
+
* Represents a list of HTTP headers.
|
|
13
|
+
*/
|
|
14
|
+
export type HeaderFields = HeaderField[];
|
|
15
|
+
/**
|
|
16
|
+
* @see Blob
|
|
17
|
+
*/
|
|
18
|
+
export declare const BlobSchema: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
|
|
7
19
|
/**
|
|
8
20
|
* Binary content used in asset encoding.
|
|
9
21
|
*/
|
|
@@ -16,6 +28,31 @@ export type BlobOrKey = Uint8Array;
|
|
|
16
28
|
* Represents a SHA-256 hash as a 32-byte binary value.
|
|
17
29
|
*/
|
|
18
30
|
export type Hash = Uint8Array;
|
|
31
|
+
/**
|
|
32
|
+
* @see AssetKey
|
|
33
|
+
*/
|
|
34
|
+
export declare const AssetKeySchema: z.ZodObject<{
|
|
35
|
+
name: z.ZodString;
|
|
36
|
+
full_path: z.ZodString;
|
|
37
|
+
token: z.ZodOptional<z.ZodString>;
|
|
38
|
+
collection: z.ZodString;
|
|
39
|
+
owner: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
|
|
40
|
+
description: z.ZodOptional<z.ZodString>;
|
|
41
|
+
}, "strict", z.ZodTypeAny, {
|
|
42
|
+
owner: Uint8Array<ArrayBufferLike>;
|
|
43
|
+
collection: string;
|
|
44
|
+
name: string;
|
|
45
|
+
full_path: string;
|
|
46
|
+
description?: string | undefined;
|
|
47
|
+
token?: string | undefined;
|
|
48
|
+
}, {
|
|
49
|
+
owner: Uint8Array<ArrayBufferLike>;
|
|
50
|
+
collection: string;
|
|
51
|
+
name: string;
|
|
52
|
+
full_path: string;
|
|
53
|
+
description?: string | undefined;
|
|
54
|
+
token?: string | undefined;
|
|
55
|
+
}>;
|
|
19
56
|
/**
|
|
20
57
|
* Metadata identifying an asset within a collection and the storage system.
|
|
21
58
|
*/
|
|
@@ -46,6 +83,25 @@ export interface AssetKey {
|
|
|
46
83
|
*/
|
|
47
84
|
description?: Description;
|
|
48
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* @see AssetEncoding
|
|
88
|
+
*/
|
|
89
|
+
export declare const AssetEncodingSchema: z.ZodObject<{
|
|
90
|
+
modified: z.ZodBigInt;
|
|
91
|
+
content_chunks: z.ZodArray<z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>, "many">;
|
|
92
|
+
total_length: z.ZodBigInt;
|
|
93
|
+
sha256: z.ZodEffects<z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>, Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
94
|
+
}, "strip", z.ZodTypeAny, {
|
|
95
|
+
modified: bigint;
|
|
96
|
+
content_chunks: Uint8Array<ArrayBufferLike>[];
|
|
97
|
+
total_length: bigint;
|
|
98
|
+
sha256: Uint8Array<ArrayBuffer>;
|
|
99
|
+
}, {
|
|
100
|
+
modified: bigint;
|
|
101
|
+
content_chunks: Uint8Array<ArrayBufferLike>[];
|
|
102
|
+
total_length: bigint;
|
|
103
|
+
sha256: Uint8Array<ArrayBuffer>;
|
|
104
|
+
}>;
|
|
49
105
|
/**
|
|
50
106
|
* Represents a specific encoding of an asset, such as "gzip" or "identity" (no compression).
|
|
51
107
|
*/
|
|
@@ -67,6 +123,14 @@ export interface AssetEncoding {
|
|
|
67
123
|
*/
|
|
68
124
|
sha256: Hash;
|
|
69
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Represents a specific encoding of an asset, such as "gzip" or "identity" (no compression), without the chunks.
|
|
128
|
+
*/
|
|
129
|
+
export type AssetEncodingNoContent = Omit<AssetEncoding, 'content_chunks'>;
|
|
130
|
+
/**
|
|
131
|
+
* A string identifier representing a specific encoding format (e.g., "gzip", "identity").
|
|
132
|
+
*/
|
|
133
|
+
export type EncodingType = 'identity' | 'gzip' | 'compress' | 'deflate' | 'br';
|
|
70
134
|
/**
|
|
71
135
|
* @see Asset
|
|
72
136
|
*/
|
|
@@ -78,7 +142,7 @@ export declare const AssetSchema: z.ZodObject<{
|
|
|
78
142
|
collection: z.ZodString;
|
|
79
143
|
owner: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
|
|
80
144
|
description: z.ZodOptional<z.ZodString>;
|
|
81
|
-
}, "
|
|
145
|
+
}, "strict", z.ZodTypeAny, {
|
|
82
146
|
owner: Uint8Array<ArrayBufferLike>;
|
|
83
147
|
collection: string;
|
|
84
148
|
name: string;
|
|
@@ -94,7 +158,7 @@ export declare const AssetSchema: z.ZodObject<{
|
|
|
94
158
|
token?: string | undefined;
|
|
95
159
|
}>;
|
|
96
160
|
headers: z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>, "many">;
|
|
97
|
-
encodings: z.
|
|
161
|
+
encodings: z.ZodArray<z.ZodTuple<[z.ZodEnum<["identity", "gzip", "compress", "deflate", "br"]>, z.ZodObject<{
|
|
98
162
|
modified: z.ZodBigInt;
|
|
99
163
|
content_chunks: z.ZodArray<z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>, "many">;
|
|
100
164
|
total_length: z.ZodBigInt;
|
|
@@ -109,7 +173,7 @@ export declare const AssetSchema: z.ZodObject<{
|
|
|
109
173
|
content_chunks: Uint8Array<ArrayBufferLike>[];
|
|
110
174
|
total_length: bigint;
|
|
111
175
|
sha256: Uint8Array<ArrayBuffer>;
|
|
112
|
-
}
|
|
176
|
+
}>], null>, "many">;
|
|
113
177
|
created_at: z.ZodBigInt;
|
|
114
178
|
updated_at: z.ZodBigInt;
|
|
115
179
|
version: z.ZodOptional<z.ZodBigInt>;
|
|
@@ -125,12 +189,12 @@ export declare const AssetSchema: z.ZodObject<{
|
|
|
125
189
|
token?: string | undefined;
|
|
126
190
|
};
|
|
127
191
|
headers: [string, string][];
|
|
128
|
-
encodings:
|
|
192
|
+
encodings: ["identity" | "gzip" | "compress" | "deflate" | "br", {
|
|
129
193
|
modified: bigint;
|
|
130
194
|
content_chunks: Uint8Array<ArrayBufferLike>[];
|
|
131
195
|
total_length: bigint;
|
|
132
196
|
sha256: Uint8Array<ArrayBuffer>;
|
|
133
|
-
}
|
|
197
|
+
}][];
|
|
134
198
|
version?: bigint | undefined;
|
|
135
199
|
}, {
|
|
136
200
|
created_at: bigint;
|
|
@@ -144,12 +208,12 @@ export declare const AssetSchema: z.ZodObject<{
|
|
|
144
208
|
token?: string | undefined;
|
|
145
209
|
};
|
|
146
210
|
headers: [string, string][];
|
|
147
|
-
encodings:
|
|
211
|
+
encodings: ["identity" | "gzip" | "compress" | "deflate" | "br", {
|
|
148
212
|
modified: bigint;
|
|
149
213
|
content_chunks: Uint8Array<ArrayBufferLike>[];
|
|
150
214
|
total_length: bigint;
|
|
151
215
|
sha256: Uint8Array<ArrayBuffer>;
|
|
152
|
-
}
|
|
216
|
+
}][];
|
|
153
217
|
version?: bigint | undefined;
|
|
154
218
|
}>;
|
|
155
219
|
/**
|
|
@@ -167,7 +231,7 @@ export interface Asset {
|
|
|
167
231
|
/**
|
|
168
232
|
* A mapping from encoding types (e.g., "identity", "gzip") to the corresponding encoded version.
|
|
169
233
|
*/
|
|
170
|
-
encodings:
|
|
234
|
+
encodings: [EncodingType, AssetEncoding][];
|
|
171
235
|
/**
|
|
172
236
|
* Timestamp when the asset was created.
|
|
173
237
|
*/
|
|
@@ -182,9 +246,109 @@ export interface Asset {
|
|
|
182
246
|
version?: Version;
|
|
183
247
|
}
|
|
184
248
|
/**
|
|
185
|
-
*
|
|
249
|
+
* @see AssetNoContent
|
|
250
|
+
*/
|
|
251
|
+
export declare const AssetNoContentSchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
|
|
252
|
+
key: z.ZodObject<{
|
|
253
|
+
name: z.ZodString;
|
|
254
|
+
full_path: z.ZodString;
|
|
255
|
+
token: z.ZodOptional<z.ZodString>;
|
|
256
|
+
collection: z.ZodString;
|
|
257
|
+
owner: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
|
|
258
|
+
description: z.ZodOptional<z.ZodString>;
|
|
259
|
+
}, "strict", z.ZodTypeAny, {
|
|
260
|
+
owner: Uint8Array<ArrayBufferLike>;
|
|
261
|
+
collection: string;
|
|
262
|
+
name: string;
|
|
263
|
+
full_path: string;
|
|
264
|
+
description?: string | undefined;
|
|
265
|
+
token?: string | undefined;
|
|
266
|
+
}, {
|
|
267
|
+
owner: Uint8Array<ArrayBufferLike>;
|
|
268
|
+
collection: string;
|
|
269
|
+
name: string;
|
|
270
|
+
full_path: string;
|
|
271
|
+
description?: string | undefined;
|
|
272
|
+
token?: string | undefined;
|
|
273
|
+
}>;
|
|
274
|
+
headers: z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>, "many">;
|
|
275
|
+
encodings: z.ZodArray<z.ZodTuple<[z.ZodEnum<["identity", "gzip", "compress", "deflate", "br"]>, z.ZodObject<{
|
|
276
|
+
modified: z.ZodBigInt;
|
|
277
|
+
content_chunks: z.ZodArray<z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>, "many">;
|
|
278
|
+
total_length: z.ZodBigInt;
|
|
279
|
+
sha256: z.ZodEffects<z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>, Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
280
|
+
}, "strip", z.ZodTypeAny, {
|
|
281
|
+
modified: bigint;
|
|
282
|
+
content_chunks: Uint8Array<ArrayBufferLike>[];
|
|
283
|
+
total_length: bigint;
|
|
284
|
+
sha256: Uint8Array<ArrayBuffer>;
|
|
285
|
+
}, {
|
|
286
|
+
modified: bigint;
|
|
287
|
+
content_chunks: Uint8Array<ArrayBufferLike>[];
|
|
288
|
+
total_length: bigint;
|
|
289
|
+
sha256: Uint8Array<ArrayBuffer>;
|
|
290
|
+
}>], null>, "many">;
|
|
291
|
+
created_at: z.ZodBigInt;
|
|
292
|
+
updated_at: z.ZodBigInt;
|
|
293
|
+
version: z.ZodOptional<z.ZodBigInt>;
|
|
294
|
+
}, "encodings">, {
|
|
295
|
+
encodings: z.ZodArray<z.ZodTuple<[z.ZodEnum<["identity", "gzip", "compress", "deflate", "br"]>, z.ZodObject<Omit<{
|
|
296
|
+
modified: z.ZodBigInt;
|
|
297
|
+
content_chunks: z.ZodArray<z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>, "many">;
|
|
298
|
+
total_length: z.ZodBigInt;
|
|
299
|
+
sha256: z.ZodEffects<z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>, Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
300
|
+
}, "content_chunks">, "strict", z.ZodTypeAny, {
|
|
301
|
+
modified: bigint;
|
|
302
|
+
total_length: bigint;
|
|
303
|
+
sha256: Uint8Array<ArrayBuffer>;
|
|
304
|
+
}, {
|
|
305
|
+
modified: bigint;
|
|
306
|
+
total_length: bigint;
|
|
307
|
+
sha256: Uint8Array<ArrayBuffer>;
|
|
308
|
+
}>], null>, "many">;
|
|
309
|
+
}>, "strict", z.ZodTypeAny, {
|
|
310
|
+
created_at: bigint;
|
|
311
|
+
updated_at: bigint;
|
|
312
|
+
key: {
|
|
313
|
+
owner: Uint8Array<ArrayBufferLike>;
|
|
314
|
+
collection: string;
|
|
315
|
+
name: string;
|
|
316
|
+
full_path: string;
|
|
317
|
+
description?: string | undefined;
|
|
318
|
+
token?: string | undefined;
|
|
319
|
+
};
|
|
320
|
+
headers: [string, string][];
|
|
321
|
+
encodings: ["identity" | "gzip" | "compress" | "deflate" | "br", {
|
|
322
|
+
modified: bigint;
|
|
323
|
+
total_length: bigint;
|
|
324
|
+
sha256: Uint8Array<ArrayBuffer>;
|
|
325
|
+
}][];
|
|
326
|
+
version?: bigint | undefined;
|
|
327
|
+
}, {
|
|
328
|
+
created_at: bigint;
|
|
329
|
+
updated_at: bigint;
|
|
330
|
+
key: {
|
|
331
|
+
owner: Uint8Array<ArrayBufferLike>;
|
|
332
|
+
collection: string;
|
|
333
|
+
name: string;
|
|
334
|
+
full_path: string;
|
|
335
|
+
description?: string | undefined;
|
|
336
|
+
token?: string | undefined;
|
|
337
|
+
};
|
|
338
|
+
headers: [string, string][];
|
|
339
|
+
encodings: ["identity" | "gzip" | "compress" | "deflate" | "br", {
|
|
340
|
+
modified: bigint;
|
|
341
|
+
total_length: bigint;
|
|
342
|
+
sha256: Uint8Array<ArrayBuffer>;
|
|
343
|
+
}][];
|
|
344
|
+
version?: bigint | undefined;
|
|
345
|
+
}>;
|
|
346
|
+
/**
|
|
347
|
+
* A stored asset including its metadata, encodings without chunks, and timestamps.
|
|
186
348
|
*/
|
|
187
|
-
export type
|
|
349
|
+
export type AssetNoContent = Omit<Asset, 'encodings'> & {
|
|
350
|
+
encodings: [EncodingType, AssetEncodingNoContent][];
|
|
351
|
+
};
|
|
188
352
|
/**
|
|
189
353
|
* A unique reference identifier for batches.
|
|
190
354
|
*/
|
|
@@ -200,7 +364,7 @@ export declare const BatchSchema: z.ZodObject<{
|
|
|
200
364
|
collection: z.ZodString;
|
|
201
365
|
owner: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
|
|
202
366
|
description: z.ZodOptional<z.ZodString>;
|
|
203
|
-
}, "
|
|
367
|
+
}, "strict", z.ZodTypeAny, {
|
|
204
368
|
owner: Uint8Array<ArrayBufferLike>;
|
|
205
369
|
collection: string;
|
|
206
370
|
name: string;
|
|
@@ -217,9 +381,8 @@ export declare const BatchSchema: z.ZodObject<{
|
|
|
217
381
|
}>;
|
|
218
382
|
reference_id: z.ZodOptional<z.ZodBigInt>;
|
|
219
383
|
expires_at: z.ZodBigInt;
|
|
220
|
-
encoding_type: z.ZodOptional<z.
|
|
384
|
+
encoding_type: z.ZodOptional<z.ZodEnum<["identity", "gzip", "compress", "deflate", "br"]>>;
|
|
221
385
|
}, "strict", z.ZodTypeAny, {
|
|
222
|
-
expires_at: bigint;
|
|
223
386
|
key: {
|
|
224
387
|
owner: Uint8Array<ArrayBufferLike>;
|
|
225
388
|
collection: string;
|
|
@@ -228,10 +391,10 @@ export declare const BatchSchema: z.ZodObject<{
|
|
|
228
391
|
description?: string | undefined;
|
|
229
392
|
token?: string | undefined;
|
|
230
393
|
};
|
|
394
|
+
expires_at: bigint;
|
|
231
395
|
reference_id?: bigint | undefined;
|
|
232
|
-
encoding_type?:
|
|
396
|
+
encoding_type?: "identity" | "gzip" | "compress" | "deflate" | "br" | undefined;
|
|
233
397
|
}, {
|
|
234
|
-
expires_at: bigint;
|
|
235
398
|
key: {
|
|
236
399
|
owner: Uint8Array<ArrayBufferLike>;
|
|
237
400
|
collection: string;
|
|
@@ -240,8 +403,9 @@ export declare const BatchSchema: z.ZodObject<{
|
|
|
240
403
|
description?: string | undefined;
|
|
241
404
|
token?: string | undefined;
|
|
242
405
|
};
|
|
406
|
+
expires_at: bigint;
|
|
243
407
|
reference_id?: bigint | undefined;
|
|
244
|
-
encoding_type?:
|
|
408
|
+
encoding_type?: "identity" | "gzip" | "compress" | "deflate" | "br" | undefined;
|
|
245
409
|
}>;
|
|
246
410
|
/**
|
|
247
411
|
* Represents a batch of chunks to be uploaded and committed to an asset.
|
|
@@ -305,3 +469,103 @@ export interface CommitBatch {
|
|
|
305
469
|
*/
|
|
306
470
|
chunk_ids: ChunkId[];
|
|
307
471
|
}
|
|
472
|
+
/**
|
|
473
|
+
* @see FullPath
|
|
474
|
+
*/
|
|
475
|
+
export declare const FullPathSchema: z.ZodString;
|
|
476
|
+
/**
|
|
477
|
+
* Represents the relative path of an asset in storage.
|
|
478
|
+
* For assets that are not part of the frontend app, the collection must be included at the root of the path.
|
|
479
|
+
*
|
|
480
|
+
* Example: `/images/a-sun-above-the-mountains.png`
|
|
481
|
+
*/
|
|
482
|
+
export type FullPath = string;
|
|
483
|
+
/**
|
|
484
|
+
* @see OptionAsset
|
|
485
|
+
*/
|
|
486
|
+
export declare const OptionAssetSchema: z.ZodOptional<z.ZodObject<{
|
|
487
|
+
key: z.ZodObject<{
|
|
488
|
+
name: z.ZodString;
|
|
489
|
+
full_path: z.ZodString;
|
|
490
|
+
token: z.ZodOptional<z.ZodString>;
|
|
491
|
+
collection: z.ZodString;
|
|
492
|
+
owner: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
|
|
493
|
+
description: z.ZodOptional<z.ZodString>;
|
|
494
|
+
}, "strict", z.ZodTypeAny, {
|
|
495
|
+
owner: Uint8Array<ArrayBufferLike>;
|
|
496
|
+
collection: string;
|
|
497
|
+
name: string;
|
|
498
|
+
full_path: string;
|
|
499
|
+
description?: string | undefined;
|
|
500
|
+
token?: string | undefined;
|
|
501
|
+
}, {
|
|
502
|
+
owner: Uint8Array<ArrayBufferLike>;
|
|
503
|
+
collection: string;
|
|
504
|
+
name: string;
|
|
505
|
+
full_path: string;
|
|
506
|
+
description?: string | undefined;
|
|
507
|
+
token?: string | undefined;
|
|
508
|
+
}>;
|
|
509
|
+
headers: z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>, "many">;
|
|
510
|
+
encodings: z.ZodArray<z.ZodTuple<[z.ZodEnum<["identity", "gzip", "compress", "deflate", "br"]>, z.ZodObject<{
|
|
511
|
+
modified: z.ZodBigInt;
|
|
512
|
+
content_chunks: z.ZodArray<z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>, "many">;
|
|
513
|
+
total_length: z.ZodBigInt;
|
|
514
|
+
sha256: z.ZodEffects<z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>, Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
515
|
+
}, "strip", z.ZodTypeAny, {
|
|
516
|
+
modified: bigint;
|
|
517
|
+
content_chunks: Uint8Array<ArrayBufferLike>[];
|
|
518
|
+
total_length: bigint;
|
|
519
|
+
sha256: Uint8Array<ArrayBuffer>;
|
|
520
|
+
}, {
|
|
521
|
+
modified: bigint;
|
|
522
|
+
content_chunks: Uint8Array<ArrayBufferLike>[];
|
|
523
|
+
total_length: bigint;
|
|
524
|
+
sha256: Uint8Array<ArrayBuffer>;
|
|
525
|
+
}>], null>, "many">;
|
|
526
|
+
created_at: z.ZodBigInt;
|
|
527
|
+
updated_at: z.ZodBigInt;
|
|
528
|
+
version: z.ZodOptional<z.ZodBigInt>;
|
|
529
|
+
}, "strict", z.ZodTypeAny, {
|
|
530
|
+
created_at: bigint;
|
|
531
|
+
updated_at: bigint;
|
|
532
|
+
key: {
|
|
533
|
+
owner: Uint8Array<ArrayBufferLike>;
|
|
534
|
+
collection: string;
|
|
535
|
+
name: string;
|
|
536
|
+
full_path: string;
|
|
537
|
+
description?: string | undefined;
|
|
538
|
+
token?: string | undefined;
|
|
539
|
+
};
|
|
540
|
+
headers: [string, string][];
|
|
541
|
+
encodings: ["identity" | "gzip" | "compress" | "deflate" | "br", {
|
|
542
|
+
modified: bigint;
|
|
543
|
+
content_chunks: Uint8Array<ArrayBufferLike>[];
|
|
544
|
+
total_length: bigint;
|
|
545
|
+
sha256: Uint8Array<ArrayBuffer>;
|
|
546
|
+
}][];
|
|
547
|
+
version?: bigint | undefined;
|
|
548
|
+
}, {
|
|
549
|
+
created_at: bigint;
|
|
550
|
+
updated_at: bigint;
|
|
551
|
+
key: {
|
|
552
|
+
owner: Uint8Array<ArrayBufferLike>;
|
|
553
|
+
collection: string;
|
|
554
|
+
name: string;
|
|
555
|
+
full_path: string;
|
|
556
|
+
description?: string | undefined;
|
|
557
|
+
token?: string | undefined;
|
|
558
|
+
};
|
|
559
|
+
headers: [string, string][];
|
|
560
|
+
encodings: ["identity" | "gzip" | "compress" | "deflate" | "br", {
|
|
561
|
+
modified: bigint;
|
|
562
|
+
content_chunks: Uint8Array<ArrayBufferLike>[];
|
|
563
|
+
total_length: bigint;
|
|
564
|
+
sha256: Uint8Array<ArrayBuffer>;
|
|
565
|
+
}][];
|
|
566
|
+
version?: bigint | undefined;
|
|
567
|
+
}>>;
|
|
568
|
+
/**
|
|
569
|
+
* A shorthand for an asset that might or not be defined.
|
|
570
|
+
*/
|
|
571
|
+
export type OptionAsset = Asset | undefined;
|
package/sdk/db.sdk.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { DocContext } from '../hooks/schemas/db/context';
|
|
2
|
+
import type { DocUpsert } from '../hooks/schemas/db/payload';
|
|
3
|
+
import type { Doc, OptionDoc } from '../schemas/db';
|
|
4
|
+
import type { ListResults } from '../schemas/list';
|
|
5
|
+
import { type CountCollectionDocsStoreParams, type CountDocsStoreParams, type DeleteDocsStoreParams, type DeleteDocStoreParams, type DeleteFilteredDocsStoreParams, type GetDocStoreParams, type ListDocsStoreParams, type SetDocStoreParams } from './schemas/db';
|
|
2
6
|
/**
|
|
3
7
|
* Stores or updates a document in the datastore.
|
|
4
8
|
*
|
|
@@ -7,17 +11,87 @@ import { type DeleteDocStoreParams, type SetDocStoreParams } from './schemas/db'
|
|
|
7
11
|
* @param {SetDocStoreParams} params - The parameters required to store the document,
|
|
8
12
|
* including the caller, collection, key, and document data.
|
|
9
13
|
*
|
|
14
|
+
* @returns {DocContext<DocUpsert>} The context of the stored or updated document,
|
|
15
|
+
* including its key, collection, and both the previous and current versions of the document.
|
|
16
|
+
*
|
|
10
17
|
* @throws {z.ZodError} If the provided parameters do not match the expected schema.
|
|
11
|
-
* @throws {Error} If the Satellite fails
|
|
18
|
+
* @throws {Error} If the Satellite fails to validate or store the document.
|
|
12
19
|
*/
|
|
13
|
-
export declare const setDocStore: (params: SetDocStoreParams) =>
|
|
20
|
+
export declare const setDocStore: (params: SetDocStoreParams) => DocContext<DocUpsert>;
|
|
14
21
|
/**
|
|
15
|
-
*
|
|
22
|
+
* Deletes a document from the datastore.
|
|
16
23
|
*
|
|
17
24
|
* @param {DeleteDocStoreParams} params - The parameters required to delete the document,
|
|
18
|
-
* including the caller, collection, key, and version of the document.
|
|
25
|
+
* including the caller, collection, key, and the expected version of the document.
|
|
26
|
+
*
|
|
27
|
+
* @returns {DocContext<OptionDoc>} The context of the deleted document,
|
|
28
|
+
* including its key, collection, and optionally the previous document data if it existed.
|
|
29
|
+
*
|
|
30
|
+
* @throws {z.ZodError} If the provided parameters do not match the expected schema.
|
|
31
|
+
* @throws {Error} If the Satellite fails to validate the request or the document cannot be deleted.
|
|
32
|
+
*/
|
|
33
|
+
export declare const deleteDocStore: (params: DeleteDocStoreParams) => DocContext<OptionDoc>;
|
|
34
|
+
/**
|
|
35
|
+
* Retrieve a document from the datastore.
|
|
36
|
+
*
|
|
37
|
+
* @param {GetDocStoreParams} params - The parameters required to get the document.
|
|
38
|
+
*
|
|
39
|
+
* @returns {OptionDoc} The document if found, or undefined if not.
|
|
19
40
|
*
|
|
20
41
|
* @throws {z.ZodError} If the provided parameters do not match the expected schema.
|
|
21
|
-
* @throws {Error} If the Satellite fails
|
|
42
|
+
* @throws {Error} If the Satellite fails while retrieving the document.
|
|
43
|
+
*/
|
|
44
|
+
export declare const getDocStore: (params: GetDocStoreParams) => OptionDoc;
|
|
45
|
+
/**
|
|
46
|
+
* Lists documents from the datastore using optional filtering, pagination, and ordering parameters.
|
|
47
|
+
*
|
|
48
|
+
* @param {ListStoreParams} params - The parameters required to perform the list operation.
|
|
49
|
+
*
|
|
50
|
+
* @returns {ListResults<Doc>} A list result containing matching documents and pagination metadata.
|
|
51
|
+
*
|
|
52
|
+
* @throws {z.ZodError} If the input parameters do not conform to the schema.
|
|
53
|
+
* @throws {Error} If the Satellite fails while performing the listing operation.
|
|
54
|
+
*/
|
|
55
|
+
export declare const listDocsStore: (params: ListDocsStoreParams) => ListResults<Doc>;
|
|
56
|
+
/**
|
|
57
|
+
* Counts the number of documents in a specific collection.
|
|
58
|
+
*
|
|
59
|
+
* @param {CountCollectionDocsStoreParams} params - The parameters required to count documents in the collection.
|
|
60
|
+
*
|
|
61
|
+
* @returns {bigint} The total number of documents in the specified collection.
|
|
62
|
+
*
|
|
63
|
+
* @throws {z.ZodError} If the input parameters do not conform to the schema.
|
|
64
|
+
* @throws {Error} If the Satellite fails while performing the count operation.
|
|
65
|
+
*/
|
|
66
|
+
export declare const countCollectionDocsStore: (params: CountCollectionDocsStoreParams) => bigint;
|
|
67
|
+
/**
|
|
68
|
+
* Counts the number of documents in a collection matching specific filters and owned by a specific caller.
|
|
69
|
+
*
|
|
70
|
+
* @param {CountDocsStoreParams} params - The parameters required to perform the filtered count.
|
|
71
|
+
*
|
|
72
|
+
* @returns {bigint} The number of documents that match the provided filters.
|
|
73
|
+
*
|
|
74
|
+
* @throws {z.ZodError} If the input parameters do not conform to the schema.
|
|
75
|
+
* @throws {Error} If the Satellite fails while performing the count operation.
|
|
76
|
+
*/
|
|
77
|
+
export declare const countDocsStore: (params: CountDocsStoreParams) => bigint;
|
|
78
|
+
/**
|
|
79
|
+
* Delete documents in a specific collection of the Datastore.
|
|
80
|
+
*
|
|
81
|
+
* @param {DeleteDocsStoreParams} params - The parameters required to delete documents in the collection.
|
|
82
|
+
*
|
|
83
|
+
* @throws {z.ZodError} If the input parameters do not conform to the schema.
|
|
84
|
+
* @throws {Error} If the Satellite fails while performing the count operation.
|
|
85
|
+
*/
|
|
86
|
+
export declare const deleteDocsStore: (params: DeleteDocsStoreParams) => void;
|
|
87
|
+
/**
|
|
88
|
+
* Delete documents in a collection matching specific filters and owned by a specific caller.
|
|
89
|
+
*
|
|
90
|
+
* @param {DeleteFilteredDocsStoreParams} params - The parameters required to perform the filtered deletion.
|
|
91
|
+
*
|
|
92
|
+
* @returns {DocContext<OptionDoc>[]} The context resulting of the deletion of documents that match the provided filters.
|
|
93
|
+
*
|
|
94
|
+
* @throws {z.ZodError} If the input parameters do not conform to the schema.
|
|
95
|
+
* @throws {Error} If the Satellite fails while performing the count operation.
|
|
22
96
|
*/
|
|
23
|
-
export declare const
|
|
97
|
+
export declare const deleteFilteredDocsStore: (params: DeleteFilteredDocsStoreParams) => DocContext<OptionDoc>[];
|