@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.
@@ -0,0 +1,428 @@
1
+ import * as z from 'zod';
2
+ import { type Description, type Key, type RawUserId, type Timestamp } from './satellite';
3
+ /**
4
+ * @see TimestampMatcher
5
+ */
6
+ export declare const TimestampMatcherSchema: z.ZodUnion<[z.ZodObject<{
7
+ equal: z.ZodBigInt;
8
+ }, "strip", z.ZodTypeAny, {
9
+ equal: bigint;
10
+ }, {
11
+ equal: bigint;
12
+ }>, z.ZodObject<{
13
+ greater_than: z.ZodBigInt;
14
+ }, "strip", z.ZodTypeAny, {
15
+ greater_than: bigint;
16
+ }, {
17
+ greater_than: bigint;
18
+ }>, z.ZodObject<{
19
+ less_than: z.ZodBigInt;
20
+ }, "strip", z.ZodTypeAny, {
21
+ less_than: bigint;
22
+ }, {
23
+ less_than: bigint;
24
+ }>, z.ZodObject<{
25
+ between: z.ZodTuple<[z.ZodBigInt, z.ZodBigInt], null>;
26
+ }, "strip", z.ZodTypeAny, {
27
+ between: [bigint, bigint];
28
+ }, {
29
+ between: [bigint, bigint];
30
+ }>]>;
31
+ /**
32
+ * TimestampMatcher matches a timestamp field using a specific strategy.
33
+ */
34
+ export type TimestampMatcher = {
35
+ equal: Timestamp;
36
+ } | {
37
+ greater_than: Timestamp;
38
+ } | {
39
+ less_than: Timestamp;
40
+ } | {
41
+ between: [Timestamp, Timestamp];
42
+ };
43
+ /**
44
+ * @see ListMatcher
45
+ */
46
+ export declare const ListMatcherSchema: z.ZodObject<{
47
+ key: z.ZodOptional<z.ZodString>;
48
+ description: z.ZodOptional<z.ZodString>;
49
+ created_at: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
50
+ equal: z.ZodBigInt;
51
+ }, "strip", z.ZodTypeAny, {
52
+ equal: bigint;
53
+ }, {
54
+ equal: bigint;
55
+ }>, z.ZodObject<{
56
+ greater_than: z.ZodBigInt;
57
+ }, "strip", z.ZodTypeAny, {
58
+ greater_than: bigint;
59
+ }, {
60
+ greater_than: bigint;
61
+ }>, z.ZodObject<{
62
+ less_than: z.ZodBigInt;
63
+ }, "strip", z.ZodTypeAny, {
64
+ less_than: bigint;
65
+ }, {
66
+ less_than: bigint;
67
+ }>, z.ZodObject<{
68
+ between: z.ZodTuple<[z.ZodBigInt, z.ZodBigInt], null>;
69
+ }, "strip", z.ZodTypeAny, {
70
+ between: [bigint, bigint];
71
+ }, {
72
+ between: [bigint, bigint];
73
+ }>]>>;
74
+ updated_at: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
75
+ equal: z.ZodBigInt;
76
+ }, "strip", z.ZodTypeAny, {
77
+ equal: bigint;
78
+ }, {
79
+ equal: bigint;
80
+ }>, z.ZodObject<{
81
+ greater_than: z.ZodBigInt;
82
+ }, "strip", z.ZodTypeAny, {
83
+ greater_than: bigint;
84
+ }, {
85
+ greater_than: bigint;
86
+ }>, z.ZodObject<{
87
+ less_than: z.ZodBigInt;
88
+ }, "strip", z.ZodTypeAny, {
89
+ less_than: bigint;
90
+ }, {
91
+ less_than: bigint;
92
+ }>, z.ZodObject<{
93
+ between: z.ZodTuple<[z.ZodBigInt, z.ZodBigInt], null>;
94
+ }, "strip", z.ZodTypeAny, {
95
+ between: [bigint, bigint];
96
+ }, {
97
+ between: [bigint, bigint];
98
+ }>]>>;
99
+ }, "strict", z.ZodTypeAny, {
100
+ description?: string | undefined;
101
+ created_at?: {
102
+ equal: bigint;
103
+ } | {
104
+ greater_than: bigint;
105
+ } | {
106
+ less_than: bigint;
107
+ } | {
108
+ between: [bigint, bigint];
109
+ } | undefined;
110
+ updated_at?: {
111
+ equal: bigint;
112
+ } | {
113
+ greater_than: bigint;
114
+ } | {
115
+ less_than: bigint;
116
+ } | {
117
+ between: [bigint, bigint];
118
+ } | undefined;
119
+ key?: string | undefined;
120
+ }, {
121
+ description?: string | undefined;
122
+ created_at?: {
123
+ equal: bigint;
124
+ } | {
125
+ greater_than: bigint;
126
+ } | {
127
+ less_than: bigint;
128
+ } | {
129
+ between: [bigint, bigint];
130
+ } | undefined;
131
+ updated_at?: {
132
+ equal: bigint;
133
+ } | {
134
+ greater_than: bigint;
135
+ } | {
136
+ less_than: bigint;
137
+ } | {
138
+ between: [bigint, bigint];
139
+ } | undefined;
140
+ key?: string | undefined;
141
+ }>;
142
+ /**
143
+ * Matcher used to filter list results.
144
+ */
145
+ export interface ListMatcher {
146
+ key?: Key;
147
+ description?: Description;
148
+ created_at?: TimestampMatcher;
149
+ updated_at?: TimestampMatcher;
150
+ }
151
+ /**
152
+ * @see ListPaginate
153
+ */
154
+ export declare const ListPaginateSchema: z.ZodObject<{
155
+ start_after: z.ZodOptional<z.ZodString>;
156
+ limit: z.ZodOptional<z.ZodBigInt>;
157
+ }, "strict", z.ZodTypeAny, {
158
+ start_after?: string | undefined;
159
+ limit?: bigint | undefined;
160
+ }, {
161
+ start_after?: string | undefined;
162
+ limit?: bigint | undefined;
163
+ }>;
164
+ /**
165
+ * Optional pagination controls for listing.
166
+ */
167
+ export interface ListPaginate {
168
+ start_after?: Key;
169
+ limit?: bigint;
170
+ }
171
+ /**
172
+ * @see ListOrderField
173
+ */
174
+ export declare const ListOrderFieldSchema: z.ZodEnum<["keys", "created_at", "updated_at"]>;
175
+ /**
176
+ * Enum representing possible fields to order by.
177
+ */
178
+ export type ListOrderField = 'keys' | 'updated_at' | 'created_at';
179
+ /**
180
+ * @see ListOrder
181
+ */
182
+ export declare const ListOrderSchema: z.ZodObject<{
183
+ desc: z.ZodBoolean;
184
+ field: z.ZodEnum<["keys", "created_at", "updated_at"]>;
185
+ }, "strict", z.ZodTypeAny, {
186
+ desc: boolean;
187
+ field: "keys" | "created_at" | "updated_at";
188
+ }, {
189
+ desc: boolean;
190
+ field: "keys" | "created_at" | "updated_at";
191
+ }>;
192
+ /**
193
+ * Ordering strategy for listing documents.
194
+ */
195
+ export interface ListOrder {
196
+ desc: boolean;
197
+ field: ListOrderField;
198
+ }
199
+ /**
200
+ * @see ListParams
201
+ */
202
+ export declare const ListParamsSchema: z.ZodObject<{
203
+ matcher: z.ZodOptional<z.ZodObject<{
204
+ key: z.ZodOptional<z.ZodString>;
205
+ description: z.ZodOptional<z.ZodString>;
206
+ created_at: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
207
+ equal: z.ZodBigInt;
208
+ }, "strip", z.ZodTypeAny, {
209
+ equal: bigint;
210
+ }, {
211
+ equal: bigint;
212
+ }>, z.ZodObject<{
213
+ greater_than: z.ZodBigInt;
214
+ }, "strip", z.ZodTypeAny, {
215
+ greater_than: bigint;
216
+ }, {
217
+ greater_than: bigint;
218
+ }>, z.ZodObject<{
219
+ less_than: z.ZodBigInt;
220
+ }, "strip", z.ZodTypeAny, {
221
+ less_than: bigint;
222
+ }, {
223
+ less_than: bigint;
224
+ }>, z.ZodObject<{
225
+ between: z.ZodTuple<[z.ZodBigInt, z.ZodBigInt], null>;
226
+ }, "strip", z.ZodTypeAny, {
227
+ between: [bigint, bigint];
228
+ }, {
229
+ between: [bigint, bigint];
230
+ }>]>>;
231
+ updated_at: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
232
+ equal: z.ZodBigInt;
233
+ }, "strip", z.ZodTypeAny, {
234
+ equal: bigint;
235
+ }, {
236
+ equal: bigint;
237
+ }>, z.ZodObject<{
238
+ greater_than: z.ZodBigInt;
239
+ }, "strip", z.ZodTypeAny, {
240
+ greater_than: bigint;
241
+ }, {
242
+ greater_than: bigint;
243
+ }>, z.ZodObject<{
244
+ less_than: z.ZodBigInt;
245
+ }, "strip", z.ZodTypeAny, {
246
+ less_than: bigint;
247
+ }, {
248
+ less_than: bigint;
249
+ }>, z.ZodObject<{
250
+ between: z.ZodTuple<[z.ZodBigInt, z.ZodBigInt], null>;
251
+ }, "strip", z.ZodTypeAny, {
252
+ between: [bigint, bigint];
253
+ }, {
254
+ between: [bigint, bigint];
255
+ }>]>>;
256
+ }, "strict", z.ZodTypeAny, {
257
+ description?: string | undefined;
258
+ created_at?: {
259
+ equal: bigint;
260
+ } | {
261
+ greater_than: bigint;
262
+ } | {
263
+ less_than: bigint;
264
+ } | {
265
+ between: [bigint, bigint];
266
+ } | undefined;
267
+ updated_at?: {
268
+ equal: bigint;
269
+ } | {
270
+ greater_than: bigint;
271
+ } | {
272
+ less_than: bigint;
273
+ } | {
274
+ between: [bigint, bigint];
275
+ } | undefined;
276
+ key?: string | undefined;
277
+ }, {
278
+ description?: string | undefined;
279
+ created_at?: {
280
+ equal: bigint;
281
+ } | {
282
+ greater_than: bigint;
283
+ } | {
284
+ less_than: bigint;
285
+ } | {
286
+ between: [bigint, bigint];
287
+ } | undefined;
288
+ updated_at?: {
289
+ equal: bigint;
290
+ } | {
291
+ greater_than: bigint;
292
+ } | {
293
+ less_than: bigint;
294
+ } | {
295
+ between: [bigint, bigint];
296
+ } | undefined;
297
+ key?: string | undefined;
298
+ }>>;
299
+ paginate: z.ZodOptional<z.ZodObject<{
300
+ start_after: z.ZodOptional<z.ZodString>;
301
+ limit: z.ZodOptional<z.ZodBigInt>;
302
+ }, "strict", z.ZodTypeAny, {
303
+ start_after?: string | undefined;
304
+ limit?: bigint | undefined;
305
+ }, {
306
+ start_after?: string | undefined;
307
+ limit?: bigint | undefined;
308
+ }>>;
309
+ order: z.ZodOptional<z.ZodObject<{
310
+ desc: z.ZodBoolean;
311
+ field: z.ZodEnum<["keys", "created_at", "updated_at"]>;
312
+ }, "strict", z.ZodTypeAny, {
313
+ desc: boolean;
314
+ field: "keys" | "created_at" | "updated_at";
315
+ }, {
316
+ desc: boolean;
317
+ field: "keys" | "created_at" | "updated_at";
318
+ }>>;
319
+ owner: z.ZodOptional<z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>>;
320
+ }, "strict", z.ZodTypeAny, {
321
+ owner?: Uint8Array<ArrayBufferLike> | undefined;
322
+ matcher?: {
323
+ description?: string | undefined;
324
+ created_at?: {
325
+ equal: bigint;
326
+ } | {
327
+ greater_than: bigint;
328
+ } | {
329
+ less_than: bigint;
330
+ } | {
331
+ between: [bigint, bigint];
332
+ } | undefined;
333
+ updated_at?: {
334
+ equal: bigint;
335
+ } | {
336
+ greater_than: bigint;
337
+ } | {
338
+ less_than: bigint;
339
+ } | {
340
+ between: [bigint, bigint];
341
+ } | undefined;
342
+ key?: string | undefined;
343
+ } | undefined;
344
+ paginate?: {
345
+ start_after?: string | undefined;
346
+ limit?: bigint | undefined;
347
+ } | undefined;
348
+ order?: {
349
+ desc: boolean;
350
+ field: "keys" | "created_at" | "updated_at";
351
+ } | undefined;
352
+ }, {
353
+ owner?: Uint8Array<ArrayBufferLike> | undefined;
354
+ matcher?: {
355
+ description?: string | undefined;
356
+ created_at?: {
357
+ equal: bigint;
358
+ } | {
359
+ greater_than: bigint;
360
+ } | {
361
+ less_than: bigint;
362
+ } | {
363
+ between: [bigint, bigint];
364
+ } | undefined;
365
+ updated_at?: {
366
+ equal: bigint;
367
+ } | {
368
+ greater_than: bigint;
369
+ } | {
370
+ less_than: bigint;
371
+ } | {
372
+ between: [bigint, bigint];
373
+ } | undefined;
374
+ key?: string | undefined;
375
+ } | undefined;
376
+ paginate?: {
377
+ start_after?: string | undefined;
378
+ limit?: bigint | undefined;
379
+ } | undefined;
380
+ order?: {
381
+ desc: boolean;
382
+ field: "keys" | "created_at" | "updated_at";
383
+ } | undefined;
384
+ }>;
385
+ /**
386
+ * Full set of listing parameters.
387
+ */
388
+ export interface ListParams {
389
+ matcher?: ListMatcher;
390
+ paginate?: ListPaginate;
391
+ order?: ListOrder;
392
+ owner?: RawUserId;
393
+ }
394
+ /**
395
+ * Represents a list result.
396
+ *
397
+ * @template T - The type of the data returned per item.
398
+ * @see JsListResults
399
+ */
400
+ export declare const createListResultsSchema: <T extends z.ZodTypeAny>(itemData: T) => z.ZodObject<{
401
+ items: z.ZodArray<z.ZodTuple<[z.ZodString, T], null>, "many">;
402
+ items_length: z.ZodBigInt;
403
+ items_page: z.ZodOptional<z.ZodBigInt>;
404
+ matches_length: z.ZodBigInt;
405
+ matches_pages: z.ZodOptional<z.ZodBigInt>;
406
+ }, "strict", z.ZodTypeAny, {
407
+ items: [string, T extends z.ZodType<any, any, any> ? T["_output"] : never][];
408
+ items_length: bigint;
409
+ matches_length: bigint;
410
+ items_page?: bigint | undefined;
411
+ matches_pages?: bigint | undefined;
412
+ }, {
413
+ items: [string, T extends z.ZodType<any, any, any> ? T["_input"] : never][];
414
+ items_length: bigint;
415
+ matches_length: bigint;
416
+ items_page?: bigint | undefined;
417
+ matches_pages?: bigint | undefined;
418
+ }>;
419
+ /**
420
+ * List results, parameterized by type of returned item.
421
+ */
422
+ export interface ListResults<T> {
423
+ items: [Key, T][];
424
+ items_length: bigint;
425
+ items_page?: bigint;
426
+ matches_length: bigint;
427
+ matches_pages?: bigint;
428
+ }