@tinycloud/sdk-services 1.7.0 → 2.0.2-beta.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.
Files changed (135) hide show
  1. package/dist/{types.d.ts → BaseService-D9BFm_rV.d.cts} +179 -27
  2. package/dist/BaseService-D9BFm_rV.d.ts +440 -0
  3. package/dist/index.cjs +3221 -0
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.d.cts +1843 -0
  6. package/dist/index.d.ts +1826 -41
  7. package/dist/index.js +3136 -58
  8. package/dist/index.js.map +1 -1
  9. package/dist/kv/index.cjs +909 -0
  10. package/dist/kv/index.cjs.map +1 -0
  11. package/dist/kv/index.d.cts +748 -0
  12. package/dist/kv/index.d.ts +745 -7
  13. package/dist/kv/index.js +877 -9
  14. package/dist/kv/index.js.map +1 -1
  15. package/dist/sql/index.cjs +596 -0
  16. package/dist/sql/index.cjs.map +1 -0
  17. package/dist/sql/index.d.cts +228 -0
  18. package/dist/sql/index.d.ts +225 -7
  19. package/dist/sql/index.js +566 -8
  20. package/dist/sql/index.js.map +1 -1
  21. package/package.json +7 -6
  22. package/dist/base/BaseService.d.ts +0 -151
  23. package/dist/base/BaseService.d.ts.map +0 -1
  24. package/dist/base/BaseService.js +0 -221
  25. package/dist/base/BaseService.js.map +0 -1
  26. package/dist/base/index.d.ts +0 -6
  27. package/dist/base/index.d.ts.map +0 -1
  28. package/dist/base/index.js +0 -6
  29. package/dist/base/index.js.map +0 -1
  30. package/dist/base/types.d.ts +0 -36
  31. package/dist/base/types.d.ts.map +0 -1
  32. package/dist/base/types.js +0 -7
  33. package/dist/base/types.js.map +0 -1
  34. package/dist/context.d.ts +0 -142
  35. package/dist/context.d.ts.map +0 -1
  36. package/dist/context.js +0 -218
  37. package/dist/context.js.map +0 -1
  38. package/dist/duckdb/DuckDbDatabaseHandle.d.ts +0 -23
  39. package/dist/duckdb/DuckDbDatabaseHandle.d.ts.map +0 -1
  40. package/dist/duckdb/DuckDbDatabaseHandle.js +0 -36
  41. package/dist/duckdb/DuckDbDatabaseHandle.js.map +0 -1
  42. package/dist/duckdb/DuckDbService.d.ts +0 -50
  43. package/dist/duckdb/DuckDbService.d.ts.map +0 -1
  44. package/dist/duckdb/DuckDbService.js +0 -285
  45. package/dist/duckdb/DuckDbService.js.map +0 -1
  46. package/dist/duckdb/IDuckDbService.d.ts +0 -84
  47. package/dist/duckdb/IDuckDbService.d.ts.map +0 -1
  48. package/dist/duckdb/IDuckDbService.js +0 -7
  49. package/dist/duckdb/IDuckDbService.js.map +0 -1
  50. package/dist/duckdb/index.d.ts +0 -10
  51. package/dist/duckdb/index.d.ts.map +0 -1
  52. package/dist/duckdb/index.js +0 -9
  53. package/dist/duckdb/index.js.map +0 -1
  54. package/dist/duckdb/types.d.ts +0 -148
  55. package/dist/duckdb/types.d.ts.map +0 -1
  56. package/dist/duckdb/types.js +0 -19
  57. package/dist/duckdb/types.js.map +0 -1
  58. package/dist/errors.d.ts +0 -62
  59. package/dist/errors.d.ts.map +0 -1
  60. package/dist/errors.js +0 -149
  61. package/dist/errors.js.map +0 -1
  62. package/dist/index.d.ts.map +0 -1
  63. package/dist/kv/IKVService.d.ts +0 -148
  64. package/dist/kv/IKVService.d.ts.map +0 -1
  65. package/dist/kv/IKVService.js +0 -8
  66. package/dist/kv/IKVService.js.map +0 -1
  67. package/dist/kv/KVService.d.ts +0 -155
  68. package/dist/kv/KVService.d.ts.map +0 -1
  69. package/dist/kv/KVService.js +0 -419
  70. package/dist/kv/KVService.js.map +0 -1
  71. package/dist/kv/PrefixedKVService.d.ts +0 -246
  72. package/dist/kv/PrefixedKVService.d.ts.map +0 -1
  73. package/dist/kv/PrefixedKVService.js +0 -145
  74. package/dist/kv/PrefixedKVService.js.map +0 -1
  75. package/dist/kv/index.d.ts.map +0 -1
  76. package/dist/kv/types.d.ts +0 -204
  77. package/dist/kv/types.d.ts.map +0 -1
  78. package/dist/kv/types.js +0 -16
  79. package/dist/kv/types.js.map +0 -1
  80. package/dist/quota/TinyCloudQuota.d.ts +0 -27
  81. package/dist/quota/TinyCloudQuota.d.ts.map +0 -1
  82. package/dist/quota/TinyCloudQuota.js +0 -31
  83. package/dist/quota/TinyCloudQuota.js.map +0 -1
  84. package/dist/quota/index.d.ts +0 -3
  85. package/dist/quota/index.d.ts.map +0 -1
  86. package/dist/quota/index.js +0 -2
  87. package/dist/quota/index.js.map +0 -1
  88. package/dist/sql/DatabaseHandle.d.ts +0 -20
  89. package/dist/sql/DatabaseHandle.d.ts.map +0 -1
  90. package/dist/sql/DatabaseHandle.js +0 -27
  91. package/dist/sql/DatabaseHandle.js.map +0 -1
  92. package/dist/sql/ISQLService.d.ts +0 -67
  93. package/dist/sql/ISQLService.d.ts.map +0 -1
  94. package/dist/sql/ISQLService.js +0 -7
  95. package/dist/sql/ISQLService.js.map +0 -1
  96. package/dist/sql/SQLService.d.ts +0 -44
  97. package/dist/sql/SQLService.d.ts.map +0 -1
  98. package/dist/sql/SQLService.js +0 -216
  99. package/dist/sql/SQLService.js.map +0 -1
  100. package/dist/sql/index.d.ts.map +0 -1
  101. package/dist/sql/types.d.ts +0 -102
  102. package/dist/sql/types.d.ts.map +0 -1
  103. package/dist/sql/types.js +0 -21
  104. package/dist/sql/types.js.map +0 -1
  105. package/dist/types.d.ts.map +0 -1
  106. package/dist/types.js +0 -94
  107. package/dist/types.js.map +0 -1
  108. package/dist/types.schema.d.ts +0 -712
  109. package/dist/types.schema.d.ts.map +0 -1
  110. package/dist/types.schema.js +0 -342
  111. package/dist/types.schema.js.map +0 -1
  112. package/dist/types.schema.test.d.ts +0 -5
  113. package/dist/types.schema.test.d.ts.map +0 -1
  114. package/dist/types.schema.test.js +0 -677
  115. package/dist/types.schema.test.js.map +0 -1
  116. package/dist/vault/DataVaultService.d.ts +0 -258
  117. package/dist/vault/DataVaultService.d.ts.map +0 -1
  118. package/dist/vault/DataVaultService.js +0 -977
  119. package/dist/vault/DataVaultService.js.map +0 -1
  120. package/dist/vault/IDataVaultService.d.ts +0 -150
  121. package/dist/vault/IDataVaultService.d.ts.map +0 -1
  122. package/dist/vault/IDataVaultService.js +0 -8
  123. package/dist/vault/IDataVaultService.js.map +0 -1
  124. package/dist/vault/createVaultCrypto.d.ts +0 -16
  125. package/dist/vault/createVaultCrypto.d.ts.map +0 -1
  126. package/dist/vault/createVaultCrypto.js +0 -12
  127. package/dist/vault/createVaultCrypto.js.map +0 -1
  128. package/dist/vault/index.d.ts +0 -10
  129. package/dist/vault/index.d.ts.map +0 -1
  130. package/dist/vault/index.js +0 -11
  131. package/dist/vault/index.js.map +0 -1
  132. package/dist/vault/types.d.ts +0 -133
  133. package/dist/vault/types.d.ts.map +0 -1
  134. package/dist/vault/types.js +0 -23
  135. package/dist/vault/types.js.map +0 -1
@@ -1,712 +0,0 @@
1
- /**
2
- * Zod schemas for SDK Services API response types.
3
- *
4
- * This is the source of truth for service response types. TypeScript types
5
- * are derived from these schemas using z.infer<>.
6
- *
7
- * @packageDocumentation
8
- */
9
- import { z } from "zod";
10
- /**
11
- * Validation error type for schema validation failures.
12
- */
13
- export interface ValidationError {
14
- code: "VALIDATION_ERROR";
15
- message: string;
16
- service: string;
17
- meta?: {
18
- issues: z.ZodIssue[];
19
- path?: string;
20
- };
21
- }
22
- /**
23
- * Schema for service error with structured information.
24
- */
25
- export declare const ServiceErrorSchema: z.ZodObject<{
26
- /** Error code for programmatic handling (e.g., 'KV_NOT_FOUND', 'AUTH_EXPIRED') */
27
- code: z.ZodString;
28
- /** Human-readable error message */
29
- message: z.ZodString;
30
- /** Service that produced the error (e.g., 'kv', 'sql') */
31
- service: z.ZodString;
32
- /** Original error if this wraps another error - not validated since Error is a class */
33
- cause: z.ZodOptional<z.ZodUnknown>;
34
- /** Additional metadata about the error - passthrough allows any object properties */
35
- meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
36
- }, "strip", z.ZodTypeAny, {
37
- code: string;
38
- message: string;
39
- service: string;
40
- cause?: unknown;
41
- meta?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
42
- }, {
43
- code: string;
44
- message: string;
45
- service: string;
46
- cause?: unknown;
47
- meta?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
48
- }>;
49
- export type ServiceErrorType = z.infer<typeof ServiceErrorSchema>;
50
- /**
51
- * Creates a Result schema for a given data type.
52
- * Result is a discriminated union: { ok: true, data: T } | { ok: false, error: E }
53
- *
54
- * @param dataSchema - Zod schema for the success data type
55
- * @param errorSchema - Zod schema for the error type (defaults to ServiceErrorSchema)
56
- * @returns A Zod schema for Result<T, E>
57
- *
58
- * @example
59
- * ```typescript
60
- * const KVGetResultSchema = createResultSchema(z.string());
61
- * type KVGetResult = z.infer<typeof KVGetResultSchema>;
62
- * ```
63
- */
64
- export declare function createResultSchema<T extends z.ZodTypeAny, E extends z.ZodTypeAny>(dataSchema: T, errorSchema?: E): z.ZodDiscriminatedUnion<"ok", [z.ZodObject<{
65
- ok: z.ZodLiteral<true>;
66
- data: T;
67
- }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
68
- ok: z.ZodLiteral<true>;
69
- data: T;
70
- }>, any> extends infer T_1 ? { [k in keyof T_1]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
71
- ok: z.ZodLiteral<true>;
72
- data: T;
73
- }>, any>[k]; } : never, z.baseObjectInputType<{
74
- ok: z.ZodLiteral<true>;
75
- data: T;
76
- }> extends infer T_2 ? { [k_1 in keyof T_2]: z.baseObjectInputType<{
77
- ok: z.ZodLiteral<true>;
78
- data: T;
79
- }>[k_1]; } : never>, z.ZodObject<{
80
- ok: z.ZodLiteral<false>;
81
- error: E;
82
- }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
83
- ok: z.ZodLiteral<false>;
84
- error: E;
85
- }>, any> extends infer T_3 ? { [k_2 in keyof T_3]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
86
- ok: z.ZodLiteral<false>;
87
- error: E;
88
- }>, any>[k_2]; } : never, z.baseObjectInputType<{
89
- ok: z.ZodLiteral<false>;
90
- error: E;
91
- }> extends infer T_4 ? { [k_3 in keyof T_4]: z.baseObjectInputType<{
92
- ok: z.ZodLiteral<false>;
93
- error: E;
94
- }>[k_3]; } : never>]>;
95
- /**
96
- * Pre-built Result schema with unknown data and ServiceError.
97
- * Useful for generic validation before type narrowing.
98
- */
99
- export declare const GenericResultSchema: z.ZodDiscriminatedUnion<"ok", [z.ZodObject<{
100
- ok: z.ZodLiteral<true>;
101
- data: z.ZodUnknown;
102
- }, "strip", z.ZodTypeAny, {
103
- ok: true;
104
- data?: unknown;
105
- }, {
106
- ok: true;
107
- data?: unknown;
108
- }>, z.ZodObject<{
109
- ok: z.ZodLiteral<false>;
110
- error: z.ZodObject<{
111
- /** Error code for programmatic handling (e.g., 'KV_NOT_FOUND', 'AUTH_EXPIRED') */
112
- code: z.ZodString;
113
- /** Human-readable error message */
114
- message: z.ZodString;
115
- /** Service that produced the error (e.g., 'kv', 'sql') */
116
- service: z.ZodString;
117
- /** Original error if this wraps another error - not validated since Error is a class */
118
- cause: z.ZodOptional<z.ZodUnknown>;
119
- /** Additional metadata about the error - passthrough allows any object properties */
120
- meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
121
- }, "strip", z.ZodTypeAny, {
122
- code: string;
123
- message: string;
124
- service: string;
125
- cause?: unknown;
126
- meta?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
127
- }, {
128
- code: string;
129
- message: string;
130
- service: string;
131
- cause?: unknown;
132
- meta?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
133
- }>;
134
- }, "strip", z.ZodTypeAny, {
135
- error: {
136
- code: string;
137
- message: string;
138
- service: string;
139
- cause?: unknown;
140
- meta?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
141
- };
142
- ok: false;
143
- }, {
144
- error: {
145
- code: string;
146
- message: string;
147
- service: string;
148
- cause?: unknown;
149
- meta?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
150
- };
151
- ok: false;
152
- }>]>;
153
- /**
154
- * Schema for KV response headers metadata.
155
- * Note: The `get` method is a function and cannot be validated with Zod.
156
- * This schema validates the data properties only.
157
- */
158
- export declare const KVResponseHeadersSchema: z.ZodObject<{
159
- /** ETag for conditional requests */
160
- etag: z.ZodOptional<z.ZodString>;
161
- /** Content type of the stored value */
162
- contentType: z.ZodOptional<z.ZodString>;
163
- /** Last modification timestamp */
164
- lastModified: z.ZodOptional<z.ZodString>;
165
- /** Content length in bytes */
166
- contentLength: z.ZodOptional<z.ZodNumber>;
167
- }, "strip", z.ZodTypeAny, {
168
- etag?: string | undefined;
169
- contentType?: string | undefined;
170
- lastModified?: string | undefined;
171
- contentLength?: number | undefined;
172
- }, {
173
- etag?: string | undefined;
174
- contentType?: string | undefined;
175
- lastModified?: string | undefined;
176
- contentLength?: number | undefined;
177
- }>;
178
- export type KVResponseHeadersType = z.infer<typeof KVResponseHeadersSchema>;
179
- /**
180
- * Creates a KVResponse schema for a given data type.
181
- *
182
- * @param dataSchema - Zod schema for the data payload type
183
- * @returns A Zod schema for KVResponse<T>
184
- *
185
- * @example
186
- * ```typescript
187
- * const UserResponseSchema = createKVResponseSchema(UserSchema);
188
- * type UserResponse = z.infer<typeof UserResponseSchema>;
189
- * ```
190
- */
191
- export declare function createKVResponseSchema<T extends z.ZodTypeAny>(dataSchema: T): z.ZodObject<{
192
- /** The data payload */
193
- data: T;
194
- /** Response headers with metadata */
195
- headers: z.ZodObject<{
196
- /** ETag for conditional requests */
197
- etag: z.ZodOptional<z.ZodString>;
198
- /** Content type of the stored value */
199
- contentType: z.ZodOptional<z.ZodString>;
200
- /** Last modification timestamp */
201
- lastModified: z.ZodOptional<z.ZodString>;
202
- /** Content length in bytes */
203
- contentLength: z.ZodOptional<z.ZodNumber>;
204
- }, "strip", z.ZodTypeAny, {
205
- etag?: string | undefined;
206
- contentType?: string | undefined;
207
- lastModified?: string | undefined;
208
- contentLength?: number | undefined;
209
- }, {
210
- etag?: string | undefined;
211
- contentType?: string | undefined;
212
- lastModified?: string | undefined;
213
- contentLength?: number | undefined;
214
- }>;
215
- }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
216
- /** The data payload */
217
- data: T;
218
- /** Response headers with metadata */
219
- headers: z.ZodObject<{
220
- /** ETag for conditional requests */
221
- etag: z.ZodOptional<z.ZodString>;
222
- /** Content type of the stored value */
223
- contentType: z.ZodOptional<z.ZodString>;
224
- /** Last modification timestamp */
225
- lastModified: z.ZodOptional<z.ZodString>;
226
- /** Content length in bytes */
227
- contentLength: z.ZodOptional<z.ZodNumber>;
228
- }, "strip", z.ZodTypeAny, {
229
- etag?: string | undefined;
230
- contentType?: string | undefined;
231
- lastModified?: string | undefined;
232
- contentLength?: number | undefined;
233
- }, {
234
- etag?: string | undefined;
235
- contentType?: string | undefined;
236
- lastModified?: string | undefined;
237
- contentLength?: number | undefined;
238
- }>;
239
- }>, any> extends infer T_1 ? { [k in keyof T_1]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
240
- /** The data payload */
241
- data: T;
242
- /** Response headers with metadata */
243
- headers: z.ZodObject<{
244
- /** ETag for conditional requests */
245
- etag: z.ZodOptional<z.ZodString>;
246
- /** Content type of the stored value */
247
- contentType: z.ZodOptional<z.ZodString>;
248
- /** Last modification timestamp */
249
- lastModified: z.ZodOptional<z.ZodString>;
250
- /** Content length in bytes */
251
- contentLength: z.ZodOptional<z.ZodNumber>;
252
- }, "strip", z.ZodTypeAny, {
253
- etag?: string | undefined;
254
- contentType?: string | undefined;
255
- lastModified?: string | undefined;
256
- contentLength?: number | undefined;
257
- }, {
258
- etag?: string | undefined;
259
- contentType?: string | undefined;
260
- lastModified?: string | undefined;
261
- contentLength?: number | undefined;
262
- }>;
263
- }>, any>[k]; } : never, z.baseObjectInputType<{
264
- /** The data payload */
265
- data: T;
266
- /** Response headers with metadata */
267
- headers: z.ZodObject<{
268
- /** ETag for conditional requests */
269
- etag: z.ZodOptional<z.ZodString>;
270
- /** Content type of the stored value */
271
- contentType: z.ZodOptional<z.ZodString>;
272
- /** Last modification timestamp */
273
- lastModified: z.ZodOptional<z.ZodString>;
274
- /** Content length in bytes */
275
- contentLength: z.ZodOptional<z.ZodNumber>;
276
- }, "strip", z.ZodTypeAny, {
277
- etag?: string | undefined;
278
- contentType?: string | undefined;
279
- lastModified?: string | undefined;
280
- contentLength?: number | undefined;
281
- }, {
282
- etag?: string | undefined;
283
- contentType?: string | undefined;
284
- lastModified?: string | undefined;
285
- contentLength?: number | undefined;
286
- }>;
287
- }> extends infer T_2 ? { [k_1 in keyof T_2]: z.baseObjectInputType<{
288
- /** The data payload */
289
- data: T;
290
- /** Response headers with metadata */
291
- headers: z.ZodObject<{
292
- /** ETag for conditional requests */
293
- etag: z.ZodOptional<z.ZodString>;
294
- /** Content type of the stored value */
295
- contentType: z.ZodOptional<z.ZodString>;
296
- /** Last modification timestamp */
297
- lastModified: z.ZodOptional<z.ZodString>;
298
- /** Content length in bytes */
299
- contentLength: z.ZodOptional<z.ZodNumber>;
300
- }, "strip", z.ZodTypeAny, {
301
- etag?: string | undefined;
302
- contentType?: string | undefined;
303
- lastModified?: string | undefined;
304
- contentLength?: number | undefined;
305
- }, {
306
- etag?: string | undefined;
307
- contentType?: string | undefined;
308
- lastModified?: string | undefined;
309
- contentLength?: number | undefined;
310
- }>;
311
- }>[k_1]; } : never>;
312
- /**
313
- * Generic KVResponse schema with unknown data.
314
- * Useful for generic validation before type narrowing.
315
- */
316
- export declare const GenericKVResponseSchema: z.ZodObject<{
317
- /** The data payload */
318
- data: z.ZodUnknown;
319
- /** Response headers with metadata */
320
- headers: z.ZodObject<{
321
- /** ETag for conditional requests */
322
- etag: z.ZodOptional<z.ZodString>;
323
- /** Content type of the stored value */
324
- contentType: z.ZodOptional<z.ZodString>;
325
- /** Last modification timestamp */
326
- lastModified: z.ZodOptional<z.ZodString>;
327
- /** Content length in bytes */
328
- contentLength: z.ZodOptional<z.ZodNumber>;
329
- }, "strip", z.ZodTypeAny, {
330
- etag?: string | undefined;
331
- contentType?: string | undefined;
332
- lastModified?: string | undefined;
333
- contentLength?: number | undefined;
334
- }, {
335
- etag?: string | undefined;
336
- contentType?: string | undefined;
337
- lastModified?: string | undefined;
338
- contentLength?: number | undefined;
339
- }>;
340
- }, "strip", z.ZodTypeAny, {
341
- headers: {
342
- etag?: string | undefined;
343
- contentType?: string | undefined;
344
- lastModified?: string | undefined;
345
- contentLength?: number | undefined;
346
- };
347
- data?: unknown;
348
- }, {
349
- headers: {
350
- etag?: string | undefined;
351
- contentType?: string | undefined;
352
- lastModified?: string | undefined;
353
- contentLength?: number | undefined;
354
- };
355
- data?: unknown;
356
- }>;
357
- export type GenericKVResponseType = z.infer<typeof GenericKVResponseSchema>;
358
- /**
359
- * Schema for KV list response.
360
- */
361
- export declare const KVListResponseSchema: z.ZodObject<{
362
- /** Array of keys matching the list criteria */
363
- keys: z.ZodArray<z.ZodString, "many">;
364
- }, "strip", z.ZodTypeAny, {
365
- keys: string[];
366
- }, {
367
- keys: string[];
368
- }>;
369
- export type KVListResponseType = z.infer<typeof KVListResponseSchema>;
370
- /**
371
- * Result schema for KV list operations.
372
- */
373
- export declare const KVListResultSchema: z.ZodDiscriminatedUnion<"ok", [z.ZodObject<{
374
- ok: z.ZodLiteral<true>;
375
- data: z.ZodObject<{
376
- /** Array of keys matching the list criteria */
377
- keys: z.ZodArray<z.ZodString, "many">;
378
- }, "strip", z.ZodTypeAny, {
379
- keys: string[];
380
- }, {
381
- keys: string[];
382
- }>;
383
- }, "strip", z.ZodTypeAny, {
384
- data: {
385
- keys: string[];
386
- };
387
- ok: true;
388
- }, {
389
- data: {
390
- keys: string[];
391
- };
392
- ok: true;
393
- }>, z.ZodObject<{
394
- ok: z.ZodLiteral<false>;
395
- error: z.ZodTypeAny;
396
- }, "strip", z.ZodTypeAny, {
397
- ok: false;
398
- error?: any;
399
- }, {
400
- ok: false;
401
- error?: any;
402
- }>]>;
403
- export type KVListResultType = z.infer<typeof KVListResultSchema>;
404
- /**
405
- * Schema for service request event.
406
- */
407
- export declare const ServiceRequestEventSchema: z.ZodObject<{
408
- service: z.ZodString;
409
- action: z.ZodString;
410
- key: z.ZodOptional<z.ZodString>;
411
- timestamp: z.ZodNumber;
412
- }, "strip", z.ZodTypeAny, {
413
- service: string;
414
- action: string;
415
- timestamp: number;
416
- key?: string | undefined;
417
- }, {
418
- service: string;
419
- action: string;
420
- timestamp: number;
421
- key?: string | undefined;
422
- }>;
423
- export type ServiceRequestEventType = z.infer<typeof ServiceRequestEventSchema>;
424
- /**
425
- * Schema for service response event.
426
- */
427
- export declare const ServiceResponseEventSchema: z.ZodObject<{
428
- service: z.ZodString;
429
- action: z.ZodString;
430
- ok: z.ZodBoolean;
431
- duration: z.ZodNumber;
432
- status: z.ZodOptional<z.ZodNumber>;
433
- }, "strip", z.ZodTypeAny, {
434
- service: string;
435
- ok: boolean;
436
- action: string;
437
- duration: number;
438
- status?: number | undefined;
439
- }, {
440
- service: string;
441
- ok: boolean;
442
- action: string;
443
- duration: number;
444
- status?: number | undefined;
445
- }>;
446
- export type ServiceResponseEventType = z.infer<typeof ServiceResponseEventSchema>;
447
- /**
448
- * Schema for service error event.
449
- */
450
- export declare const ServiceErrorEventSchema: z.ZodObject<{
451
- service: z.ZodString;
452
- error: z.ZodObject<{
453
- /** Error code for programmatic handling (e.g., 'KV_NOT_FOUND', 'AUTH_EXPIRED') */
454
- code: z.ZodString;
455
- /** Human-readable error message */
456
- message: z.ZodString;
457
- /** Service that produced the error (e.g., 'kv', 'sql') */
458
- service: z.ZodString;
459
- /** Original error if this wraps another error - not validated since Error is a class */
460
- cause: z.ZodOptional<z.ZodUnknown>;
461
- /** Additional metadata about the error - passthrough allows any object properties */
462
- meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
463
- }, "strip", z.ZodTypeAny, {
464
- code: string;
465
- message: string;
466
- service: string;
467
- cause?: unknown;
468
- meta?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
469
- }, {
470
- code: string;
471
- message: string;
472
- service: string;
473
- cause?: unknown;
474
- meta?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
475
- }>;
476
- }, "strip", z.ZodTypeAny, {
477
- error: {
478
- code: string;
479
- message: string;
480
- service: string;
481
- cause?: unknown;
482
- meta?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
483
- };
484
- service: string;
485
- }, {
486
- error: {
487
- code: string;
488
- message: string;
489
- service: string;
490
- cause?: unknown;
491
- meta?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
492
- };
493
- service: string;
494
- }>;
495
- export type ServiceErrorEventType = z.infer<typeof ServiceErrorEventSchema>;
496
- /**
497
- * Schema for service retry event.
498
- */
499
- export declare const ServiceRetryEventSchema: z.ZodObject<{
500
- service: z.ZodString;
501
- attempt: z.ZodNumber;
502
- maxAttempts: z.ZodNumber;
503
- error: z.ZodObject<{
504
- /** Error code for programmatic handling (e.g., 'KV_NOT_FOUND', 'AUTH_EXPIRED') */
505
- code: z.ZodString;
506
- /** Human-readable error message */
507
- message: z.ZodString;
508
- /** Service that produced the error (e.g., 'kv', 'sql') */
509
- service: z.ZodString;
510
- /** Original error if this wraps another error - not validated since Error is a class */
511
- cause: z.ZodOptional<z.ZodUnknown>;
512
- /** Additional metadata about the error - passthrough allows any object properties */
513
- meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
514
- }, "strip", z.ZodTypeAny, {
515
- code: string;
516
- message: string;
517
- service: string;
518
- cause?: unknown;
519
- meta?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
520
- }, {
521
- code: string;
522
- message: string;
523
- service: string;
524
- cause?: unknown;
525
- meta?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
526
- }>;
527
- }, "strip", z.ZodTypeAny, {
528
- error: {
529
- code: string;
530
- message: string;
531
- service: string;
532
- cause?: unknown;
533
- meta?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
534
- };
535
- maxAttempts: number;
536
- service: string;
537
- attempt: number;
538
- }, {
539
- error: {
540
- code: string;
541
- message: string;
542
- service: string;
543
- cause?: unknown;
544
- meta?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
545
- };
546
- maxAttempts: number;
547
- service: string;
548
- attempt: number;
549
- }>;
550
- export type ServiceRetryEventType = z.infer<typeof ServiceRetryEventSchema>;
551
- /**
552
- * Schema for retry policy configuration.
553
- */
554
- export declare const RetryPolicySchema: z.ZodObject<{
555
- /** Maximum number of attempts (including initial) */
556
- maxAttempts: z.ZodNumber;
557
- /** Backoff strategy between retries */
558
- backoff: z.ZodEnum<["none", "linear", "exponential"]>;
559
- /** Base delay in milliseconds for backoff calculation */
560
- baseDelayMs: z.ZodNumber;
561
- /** Maximum delay in milliseconds between retries */
562
- maxDelayMs: z.ZodNumber;
563
- /** Error codes that should trigger a retry */
564
- retryableErrors: z.ZodArray<z.ZodString, "many">;
565
- }, "strip", z.ZodTypeAny, {
566
- maxAttempts: number;
567
- backoff: "none" | "linear" | "exponential";
568
- baseDelayMs: number;
569
- maxDelayMs: number;
570
- retryableErrors: string[];
571
- }, {
572
- maxAttempts: number;
573
- backoff: "none" | "linear" | "exponential";
574
- baseDelayMs: number;
575
- maxDelayMs: number;
576
- retryableErrors: string[];
577
- }>;
578
- export type RetryPolicyType = z.infer<typeof RetryPolicySchema>;
579
- /**
580
- * Schema for service session data required for authenticated operations.
581
- */
582
- export declare const ServiceSessionSchema: z.ZodObject<{
583
- /** The delegation header containing the UCAN */
584
- delegationHeader: z.ZodObject<{
585
- Authorization: z.ZodString;
586
- }, "strip", z.ZodTypeAny, {
587
- Authorization: string;
588
- }, {
589
- Authorization: string;
590
- }>;
591
- /** The delegation CID */
592
- delegationCid: z.ZodString;
593
- /** The space ID for this session */
594
- spaceId: z.ZodString;
595
- /** The verification method DID */
596
- verificationMethod: z.ZodString;
597
- /** The session key JWK (required for invoke) */
598
- jwk: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
599
- }, "strip", z.ZodTypeAny, {
600
- delegationHeader: {
601
- Authorization: string;
602
- };
603
- delegationCid: string;
604
- spaceId: string;
605
- verificationMethod: string;
606
- jwk: {} & {
607
- [k: string]: unknown;
608
- };
609
- }, {
610
- delegationHeader: {
611
- Authorization: string;
612
- };
613
- delegationCid: string;
614
- spaceId: string;
615
- verificationMethod: string;
616
- jwk: {} & {
617
- [k: string]: unknown;
618
- };
619
- }>;
620
- export type ServiceSessionType = z.infer<typeof ServiceSessionSchema>;
621
- /**
622
- * Validate service error against the schema.
623
- *
624
- * @param data - Unknown data to validate
625
- * @returns Result with validated data or validation error
626
- */
627
- export declare function validateServiceError(data: unknown): {
628
- ok: true;
629
- data: ServiceErrorType;
630
- } | {
631
- ok: false;
632
- error: ValidationError;
633
- };
634
- /**
635
- * Validate KV list response against the schema.
636
- *
637
- * @param data - Unknown data to validate
638
- * @returns Result with validated data or validation error
639
- */
640
- export declare function validateKVListResponse(data: unknown): {
641
- ok: true;
642
- data: KVListResponseType;
643
- } | {
644
- ok: false;
645
- error: ValidationError;
646
- };
647
- /**
648
- * Validate KV response headers against the schema.
649
- *
650
- * @param data - Unknown data to validate
651
- * @returns Result with validated data or validation error
652
- */
653
- export declare function validateKVResponseHeaders(data: unknown): {
654
- ok: true;
655
- data: KVResponseHeadersType;
656
- } | {
657
- ok: false;
658
- error: ValidationError;
659
- };
660
- /**
661
- * Validate service session against the schema.
662
- *
663
- * @param data - Unknown data to validate
664
- * @returns Result with validated data or validation error
665
- */
666
- export declare function validateServiceSession(data: unknown): {
667
- ok: true;
668
- data: ServiceSessionType;
669
- } | {
670
- ok: false;
671
- error: ValidationError;
672
- };
673
- /**
674
- * Validate retry policy against the schema.
675
- *
676
- * @param data - Unknown data to validate
677
- * @returns Result with validated data or validation error
678
- */
679
- export declare function validateRetryPolicy(data: unknown): {
680
- ok: true;
681
- data: RetryPolicyType;
682
- } | {
683
- ok: false;
684
- error: ValidationError;
685
- };
686
- /**
687
- * Validate service request event against the schema.
688
- *
689
- * @param data - Unknown data to validate
690
- * @returns Result with validated data or validation error
691
- */
692
- export declare function validateServiceRequestEvent(data: unknown): {
693
- ok: true;
694
- data: ServiceRequestEventType;
695
- } | {
696
- ok: false;
697
- error: ValidationError;
698
- };
699
- /**
700
- * Validate service response event against the schema.
701
- *
702
- * @param data - Unknown data to validate
703
- * @returns Result with validated data or validation error
704
- */
705
- export declare function validateServiceResponseEvent(data: unknown): {
706
- ok: true;
707
- data: ServiceResponseEventType;
708
- } | {
709
- ok: false;
710
- error: ValidationError;
711
- };
712
- //# sourceMappingURL=types.schema.d.ts.map