@ankhorage/contracts 25.0.1 → 25.2.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/src/auth.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { ValueMap } from './collections';
2
+ import type { DataSchema } from './data/schemas';
2
3
  import type { AppDeployTargetId } from './deploy';
3
4
  import type { AppEnvironmentId } from './environments';
4
5
  import type { SecretRef } from './secrets';
@@ -237,6 +238,171 @@ export interface VerifyOtpInput {
237
238
  metadata?: Record<string, unknown>;
238
239
  }
239
240
 
241
+ /**
242
+ * Portable schema sources for the provider-neutral auth/session values and operation payloads.
243
+ *
244
+ * They describe the existing serializable contracts only. Auth execution, capability catalogs,
245
+ * adapter ports, and provider-specific configuration remain outside Contracts.
246
+ */
247
+ export const AUTH_IDENTIFIER_SCHEMA = {
248
+ type: 'object',
249
+ required: ['kind', 'value'],
250
+ properties: {
251
+ kind: { type: 'string', enum: AUTH_IDENTIFIER_KINDS },
252
+ value: { type: 'string' },
253
+ },
254
+ } as const satisfies DataSchema;
255
+
256
+ export const AUTH_USER_SCHEMA = {
257
+ type: 'object',
258
+ required: ['id'],
259
+ properties: {
260
+ id: { type: 'string' },
261
+ email: { type: 'string' },
262
+ phone: { type: 'string' },
263
+ username: { type: 'string' },
264
+ displayName: { type: 'string' },
265
+ avatarUrl: { type: 'string' },
266
+ metadata: { type: 'object', additionalProperties: {} },
267
+ },
268
+ } as const satisfies DataSchema;
269
+
270
+ export const AUTH_SESSION_SCHEMA = {
271
+ type: 'object',
272
+ required: ['accessToken', 'user'],
273
+ properties: {
274
+ accessToken: { type: 'string' },
275
+ refreshToken: { type: 'string' },
276
+ expiresAt: { type: 'number' },
277
+ tokenType: { type: 'string' },
278
+ user: AUTH_USER_SCHEMA,
279
+ },
280
+ } as const satisfies DataSchema;
281
+
282
+ export const AUTH_ADAPTER_ERROR_SCHEMA = {
283
+ type: 'object',
284
+ required: ['code', 'message'],
285
+ properties: {
286
+ code: { type: 'string' },
287
+ message: { type: 'string' },
288
+ cause: {},
289
+ },
290
+ } as const satisfies DataSchema;
291
+
292
+ export const SIGN_IN_INPUT_SCHEMA = {
293
+ type: 'object',
294
+ required: ['identifier'],
295
+ properties: {
296
+ identifier: AUTH_IDENTIFIER_SCHEMA,
297
+ password: { type: 'string' },
298
+ otp: { type: 'string' },
299
+ redirectTo: { type: 'string' },
300
+ metadata: { type: 'object', additionalProperties: {} },
301
+ },
302
+ } as const satisfies DataSchema;
303
+
304
+ export const SIGN_UP_INPUT_SCHEMA = {
305
+ type: 'object',
306
+ required: ['identifier'],
307
+ properties: {
308
+ identifier: AUTH_IDENTIFIER_SCHEMA,
309
+ password: { type: 'string' },
310
+ profile: { type: 'object', additionalProperties: {} },
311
+ redirectTo: { type: 'string' },
312
+ metadata: { type: 'object', additionalProperties: {} },
313
+ },
314
+ } as const satisfies DataSchema;
315
+
316
+ export const SIGN_OUT_INPUT_SCHEMA = {
317
+ type: 'object',
318
+ properties: { allDevices: { type: 'boolean' } },
319
+ } as const satisfies DataSchema;
320
+
321
+ export const PASSWORD_RESET_INPUT_SCHEMA = {
322
+ type: 'object',
323
+ required: ['identifier'],
324
+ properties: {
325
+ identifier: AUTH_IDENTIFIER_SCHEMA,
326
+ redirectTo: { type: 'string' },
327
+ },
328
+ } as const satisfies DataSchema;
329
+
330
+ export const VERIFY_OTP_INPUT_SCHEMA = {
331
+ type: 'object',
332
+ required: ['identifier', 'token'],
333
+ properties: {
334
+ identifier: AUTH_IDENTIFIER_SCHEMA,
335
+ token: { type: 'string' },
336
+ redirectTo: { type: 'string' },
337
+ metadata: { type: 'object', additionalProperties: {} },
338
+ },
339
+ } as const satisfies DataSchema;
340
+
341
+ export const AUTH_SUCCESS_SCHEMA = {
342
+ type: 'object',
343
+ required: ['ok'],
344
+ properties: { ok: { const: true } },
345
+ } as const satisfies DataSchema;
346
+
347
+ export const AUTH_ERROR_RESULT_SCHEMA = {
348
+ type: 'object',
349
+ required: ['ok', 'error'],
350
+ properties: {
351
+ ok: { const: false },
352
+ error: AUTH_ADAPTER_ERROR_SCHEMA,
353
+ },
354
+ } as const satisfies DataSchema;
355
+
356
+ export const SIGN_IN_RESULT_SCHEMA = {
357
+ oneOf: [
358
+ {
359
+ ...AUTH_SUCCESS_SCHEMA,
360
+ properties: { ...AUTH_SUCCESS_SCHEMA.properties, data: AUTH_SESSION_SCHEMA },
361
+ },
362
+ AUTH_ERROR_RESULT_SCHEMA,
363
+ ],
364
+ } as const satisfies DataSchema;
365
+
366
+ export const SIGN_UP_RESULT_SCHEMA = {
367
+ oneOf: [
368
+ {
369
+ ...AUTH_SUCCESS_SCHEMA,
370
+ properties: {
371
+ ...AUTH_SUCCESS_SCHEMA.properties,
372
+ data: { oneOf: [AUTH_SESSION_SCHEMA, AUTH_USER_SCHEMA] },
373
+ },
374
+ },
375
+ AUTH_ERROR_RESULT_SCHEMA,
376
+ ],
377
+ } as const satisfies DataSchema;
378
+
379
+ export const AUTH_VOID_RESULT_SCHEMA = {
380
+ oneOf: [AUTH_SUCCESS_SCHEMA, AUTH_ERROR_RESULT_SCHEMA],
381
+ } as const satisfies DataSchema;
382
+
383
+ export const AUTH_SESSION_RESULT_SCHEMA = {
384
+ oneOf: [
385
+ {
386
+ ...AUTH_SUCCESS_SCHEMA,
387
+ properties: { ...AUTH_SUCCESS_SCHEMA.properties, data: AUTH_SESSION_SCHEMA },
388
+ },
389
+ AUTH_ERROR_RESULT_SCHEMA,
390
+ ],
391
+ } as const satisfies DataSchema;
392
+
393
+ export const AUTH_NULLABLE_SESSION_RESULT_SCHEMA = {
394
+ oneOf: [
395
+ {
396
+ ...AUTH_SUCCESS_SCHEMA,
397
+ properties: {
398
+ ...AUTH_SUCCESS_SCHEMA.properties,
399
+ data: { oneOf: [AUTH_SESSION_SCHEMA, { type: 'null' }] },
400
+ },
401
+ },
402
+ AUTH_ERROR_RESULT_SCHEMA,
403
+ ],
404
+ } as const satisfies DataSchema;
405
+
240
406
  export const AUTH_OAUTH_ERROR_STAGES = [
241
407
  'start',
242
408
  'transport',
@@ -341,6 +507,143 @@ export interface CompleteOAuthAuthorizationInput {
341
507
  response: AuthOAuthAuthorizationResponse;
342
508
  }
343
509
 
510
+ export const AUTH_EMPTY_INPUT_SCHEMA = {
511
+ type: 'object',
512
+ } as const satisfies DataSchema;
513
+
514
+ export const START_OAUTH_AUTHORIZATION_INPUT_SCHEMA = {
515
+ type: 'object',
516
+ required: ['provider', 'redirectUri'],
517
+ properties: {
518
+ provider: { type: 'string' },
519
+ redirectUri: { type: 'string' },
520
+ scopes: { type: 'array', items: { type: 'string' } },
521
+ queryParams: { type: 'object', additionalProperties: { type: 'string' } },
522
+ },
523
+ } as const satisfies DataSchema;
524
+
525
+ export const AUTH_OAUTH_AUTHORIZATION_REQUEST_SCHEMA = {
526
+ type: 'object',
527
+ required: ['attemptId', 'provider', 'authorizationUrl', 'redirectUri'],
528
+ properties: {
529
+ attemptId: { type: 'string' },
530
+ provider: { type: 'string' },
531
+ authorizationUrl: { type: 'string' },
532
+ redirectUri: { type: 'string' },
533
+ },
534
+ } as const satisfies DataSchema;
535
+
536
+ export const AUTH_OAUTH_ERROR_SCHEMA = {
537
+ type: 'object',
538
+ required: ['code', 'message', 'stage', 'recoverable'],
539
+ properties: {
540
+ code: { type: 'string', enum: AUTH_OAUTH_ERROR_CODES },
541
+ message: { type: 'string' },
542
+ cause: {},
543
+ stage: { type: 'string', enum: AUTH_OAUTH_ERROR_STAGES },
544
+ provider: { type: 'string' },
545
+ recoverable: { type: 'boolean' },
546
+ },
547
+ } as const satisfies DataSchema;
548
+
549
+ export const AUTH_OAUTH_START_RESULT_SCHEMA = {
550
+ oneOf: [
551
+ {
552
+ type: 'object',
553
+ required: ['ok', 'data'],
554
+ properties: {
555
+ ok: { const: true },
556
+ data: AUTH_OAUTH_AUTHORIZATION_REQUEST_SCHEMA,
557
+ },
558
+ },
559
+ {
560
+ type: 'object',
561
+ required: ['ok', 'error'],
562
+ properties: {
563
+ ok: { const: false },
564
+ error: AUTH_OAUTH_ERROR_SCHEMA,
565
+ },
566
+ },
567
+ ],
568
+ } as const satisfies DataSchema;
569
+
570
+ export const AUTH_OAUTH_AUTHORIZATION_RESPONSE_SCHEMA = {
571
+ oneOf: [
572
+ {
573
+ type: 'object',
574
+ required: ['type', 'url'],
575
+ properties: { type: { const: 'callback' }, url: { type: 'string' } },
576
+ },
577
+ {
578
+ type: 'object',
579
+ required: ['type', 'reason'],
580
+ properties: {
581
+ type: { const: 'cancelled' },
582
+ reason: { type: 'string', enum: AUTH_OAUTH_TRANSPORT_CANCELLATION_REASONS },
583
+ },
584
+ },
585
+ {
586
+ type: 'object',
587
+ required: ['type', 'error'],
588
+ properties: {
589
+ type: { const: 'error' },
590
+ error: {
591
+ type: 'object',
592
+ required: ['code', 'message'],
593
+ properties: {
594
+ code: { type: 'string', enum: AUTH_OAUTH_TRANSPORT_ERROR_CODES },
595
+ message: { type: 'string' },
596
+ cause: {},
597
+ },
598
+ },
599
+ },
600
+ },
601
+ ],
602
+ } as const satisfies DataSchema;
603
+
604
+ export const COMPLETE_OAUTH_AUTHORIZATION_INPUT_SCHEMA = {
605
+ type: 'object',
606
+ required: ['attemptId', 'response'],
607
+ properties: {
608
+ attemptId: { type: 'string' },
609
+ response: AUTH_OAUTH_AUTHORIZATION_RESPONSE_SCHEMA,
610
+ },
611
+ } as const satisfies DataSchema;
612
+
613
+ export const AUTH_OAUTH_COMPLETION_RESULT_SCHEMA = {
614
+ oneOf: [
615
+ {
616
+ type: 'object',
617
+ required: ['ok', 'status', 'provider', 'session'],
618
+ properties: {
619
+ ok: { const: true },
620
+ status: { const: 'authenticated' },
621
+ provider: { type: 'string' },
622
+ session: AUTH_SESSION_SCHEMA,
623
+ },
624
+ },
625
+ {
626
+ type: 'object',
627
+ required: ['ok', 'status', 'provider', 'reason'],
628
+ properties: {
629
+ ok: { const: false },
630
+ status: { const: 'cancelled' },
631
+ provider: { type: 'string' },
632
+ reason: { type: 'string', enum: AUTH_OAUTH_CANCELLATION_REASONS },
633
+ },
634
+ },
635
+ {
636
+ type: 'object',
637
+ required: ['ok', 'status', 'error'],
638
+ properties: {
639
+ ok: { const: false },
640
+ status: { const: 'error' },
641
+ error: AUTH_OAUTH_ERROR_SCHEMA,
642
+ },
643
+ },
644
+ ],
645
+ } as const satisfies DataSchema;
646
+
344
647
  export type AuthOAuthCompletionResult =
345
648
  | {
346
649
  ok: true;
@@ -0,0 +1,86 @@
1
+ import { describe, expect, it } from 'bun:test';
2
+
3
+ import { isDataSchema } from './data';
4
+ import {
5
+ STORAGE_ADAPTER_ERROR_SCHEMA,
6
+ STORAGE_ASSET_REFERENCE_SCHEMA,
7
+ STORAGE_BYTES_SCHEMA,
8
+ STORAGE_ERROR_RESULT_SCHEMA,
9
+ STORAGE_IDENTITY_SCHEMA,
10
+ STORAGE_LIST_INPUT_SCHEMA,
11
+ STORAGE_LIST_OPERATION_RESULT_SCHEMA,
12
+ STORAGE_LIST_RESULT_SCHEMA,
13
+ STORAGE_OBJECT_METADATA_SCHEMA,
14
+ STORAGE_PUBLIC_URL_INPUT_SCHEMA,
15
+ STORAGE_PUBLIC_URL_OPERATION_RESULT_SCHEMA,
16
+ STORAGE_PUBLIC_URL_RESULT_SCHEMA,
17
+ STORAGE_REMOVE_INPUT_SCHEMA,
18
+ STORAGE_RESOLVE_INPUT_SCHEMA,
19
+ STORAGE_RESOLVE_OPERATION_RESULT_SCHEMA,
20
+ STORAGE_RESOLVE_RESULT_SCHEMA,
21
+ STORAGE_RESOLVED_ASSET_SCHEMA,
22
+ STORAGE_SUCCESS_SCHEMA,
23
+ STORAGE_UPLOAD_INPUT_SCHEMA,
24
+ STORAGE_UPLOAD_OPERATION_RESULT_SCHEMA,
25
+ STORAGE_UPLOAD_RESULT_SCHEMA,
26
+ STORAGE_VOID_RESULT_SCHEMA,
27
+ } from './storage';
28
+
29
+ const STORAGE_SCHEMAS = [
30
+ STORAGE_BYTES_SCHEMA,
31
+ STORAGE_IDENTITY_SCHEMA,
32
+ STORAGE_ASSET_REFERENCE_SCHEMA,
33
+ STORAGE_OBJECT_METADATA_SCHEMA,
34
+ STORAGE_UPLOAD_INPUT_SCHEMA,
35
+ STORAGE_UPLOAD_RESULT_SCHEMA,
36
+ STORAGE_REMOVE_INPUT_SCHEMA,
37
+ STORAGE_PUBLIC_URL_INPUT_SCHEMA,
38
+ STORAGE_PUBLIC_URL_RESULT_SCHEMA,
39
+ STORAGE_LIST_INPUT_SCHEMA,
40
+ STORAGE_LIST_RESULT_SCHEMA,
41
+ STORAGE_RESOLVE_INPUT_SCHEMA,
42
+ STORAGE_RESOLVED_ASSET_SCHEMA,
43
+ STORAGE_RESOLVE_RESULT_SCHEMA,
44
+ STORAGE_ADAPTER_ERROR_SCHEMA,
45
+ STORAGE_SUCCESS_SCHEMA,
46
+ STORAGE_ERROR_RESULT_SCHEMA,
47
+ STORAGE_VOID_RESULT_SCHEMA,
48
+ STORAGE_UPLOAD_OPERATION_RESULT_SCHEMA,
49
+ STORAGE_PUBLIC_URL_OPERATION_RESULT_SCHEMA,
50
+ STORAGE_LIST_OPERATION_RESULT_SCHEMA,
51
+ STORAGE_RESOLVE_OPERATION_RESULT_SCHEMA,
52
+ ] as const;
53
+
54
+ describe('storage capability schemas', () => {
55
+ it('publishes valid, serializable schema sources for every storage operation and value', () => {
56
+ expect(STORAGE_SCHEMAS.every(isDataSchema)).toBe(true);
57
+ expect(JSON.parse(JSON.stringify(STORAGE_SCHEMAS))).toEqual(STORAGE_SCHEMAS);
58
+ });
59
+
60
+ it('serializes upload bytes as standard Base64 without changing the adapter input contract', () => {
61
+ expect(STORAGE_UPLOAD_INPUT_SCHEMA.required).toEqual(['bucket', 'path', 'body']);
62
+ expect(STORAGE_UPLOAD_INPUT_SCHEMA.properties.body).toEqual({
63
+ type: 'string',
64
+ format: 'base64',
65
+ });
66
+ });
67
+
68
+ it('keeps public and signed resolution under the existing access selection', () => {
69
+ expect(STORAGE_RESOLVE_INPUT_SCHEMA.properties.access).toEqual({
70
+ type: 'string',
71
+ enum: ['public', 'signed'],
72
+ });
73
+ expect(STORAGE_RESOLVED_ASSET_SCHEMA.properties.access).toEqual({
74
+ type: 'string',
75
+ enum: ['public', 'signed'],
76
+ });
77
+ });
78
+
79
+ it('requires result data for non-void operations and keeps errors portable', () => {
80
+ expect(STORAGE_UPLOAD_OPERATION_RESULT_SCHEMA.oneOf[0].required).toEqual(['ok', 'data']);
81
+ expect(STORAGE_PUBLIC_URL_OPERATION_RESULT_SCHEMA.oneOf[0].required).toEqual(['ok', 'data']);
82
+ expect(STORAGE_LIST_OPERATION_RESULT_SCHEMA.oneOf[0].required).toEqual(['ok', 'data']);
83
+ expect(STORAGE_RESOLVE_OPERATION_RESULT_SCHEMA.oneOf[0].required).toEqual(['ok', 'data']);
84
+ expect(STORAGE_ADAPTER_ERROR_SCHEMA.properties).not.toHaveProperty('cause');
85
+ });
86
+ });
package/src/storage.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import type { DataSchema } from './data/schemas.js';
2
+
1
3
  export interface StorageAdapterError {
2
4
  code: string;
3
5
  message: string;
@@ -154,3 +156,198 @@ export interface StorageResolveAdapter {
154
156
  */
155
157
  export interface MediaStorageAdapter
156
158
  extends StorageAdapter, StorageListAdapter, StorageResolveAdapter {}
159
+
160
+ /**
161
+ * Portable schema sources for provider-neutral storage values and operations.
162
+ *
163
+ * Upload bytes use a standard Base64 string. The source `StorageUploadInput` remains a
164
+ * `Uint8Array` at the adapter boundary; catalogs serialize its `body` with this schema and
165
+ * reconstruct the bytes before invoking an adapter.
166
+ */
167
+ export const STORAGE_BYTES_SCHEMA = {
168
+ type: 'string',
169
+ format: 'base64',
170
+ } as const satisfies DataSchema;
171
+
172
+ export const STORAGE_IDENTITY_SCHEMA = {
173
+ type: 'object',
174
+ required: ['bucket', 'path'],
175
+ properties: {
176
+ storageId: { type: 'string' },
177
+ bucket: { type: 'string' },
178
+ path: { type: 'string' },
179
+ },
180
+ } as const satisfies DataSchema;
181
+
182
+ export const STORAGE_ASSET_REFERENCE_SCHEMA = {
183
+ ...STORAGE_IDENTITY_SCHEMA,
184
+ properties: {
185
+ ...STORAGE_IDENTITY_SCHEMA.properties,
186
+ publicUrl: { type: 'string' },
187
+ },
188
+ } as const satisfies DataSchema;
189
+
190
+ export const STORAGE_OBJECT_METADATA_SCHEMA = {
191
+ ...STORAGE_IDENTITY_SCHEMA,
192
+ properties: {
193
+ ...STORAGE_IDENTITY_SCHEMA.properties,
194
+ contentType: { type: 'string' },
195
+ sizeBytes: { type: 'integer' },
196
+ createdAt: { type: 'string' },
197
+ updatedAt: { type: 'string' },
198
+ etag: { type: 'string' },
199
+ },
200
+ } as const satisfies DataSchema;
201
+
202
+ export const STORAGE_UPLOAD_INPUT_SCHEMA = {
203
+ ...STORAGE_IDENTITY_SCHEMA,
204
+ required: ['bucket', 'path', 'body'],
205
+ properties: {
206
+ ...STORAGE_IDENTITY_SCHEMA.properties,
207
+ body: STORAGE_BYTES_SCHEMA,
208
+ contentType: { type: 'string' },
209
+ cacheControl: { type: 'string' },
210
+ upsert: { type: 'boolean' },
211
+ },
212
+ } as const satisfies DataSchema;
213
+
214
+ export const STORAGE_UPLOAD_RESULT_SCHEMA = {
215
+ type: 'object',
216
+ required: ['asset'],
217
+ properties: { asset: STORAGE_ASSET_REFERENCE_SCHEMA },
218
+ } as const satisfies DataSchema;
219
+
220
+ export const STORAGE_REMOVE_INPUT_SCHEMA = {
221
+ ...STORAGE_IDENTITY_SCHEMA,
222
+ description: 'Identifies the stored object to remove.',
223
+ } as const satisfies DataSchema;
224
+
225
+ export const STORAGE_PUBLIC_URL_INPUT_SCHEMA = {
226
+ ...STORAGE_IDENTITY_SCHEMA,
227
+ description: 'Identifies the stored object whose public URL is requested.',
228
+ } as const satisfies DataSchema;
229
+
230
+ export const STORAGE_PUBLIC_URL_RESULT_SCHEMA = {
231
+ type: 'object',
232
+ required: ['publicUrl'],
233
+ properties: { publicUrl: { type: 'string' } },
234
+ } as const satisfies DataSchema;
235
+
236
+ export const STORAGE_LIST_INPUT_SCHEMA = {
237
+ type: 'object',
238
+ required: ['bucket'],
239
+ properties: {
240
+ storageId: { type: 'string' },
241
+ bucket: { type: 'string' },
242
+ prefix: { type: 'string' },
243
+ cursor: { type: 'string' },
244
+ limit: { type: 'integer' },
245
+ },
246
+ } as const satisfies DataSchema;
247
+
248
+ export const STORAGE_LIST_RESULT_SCHEMA = {
249
+ type: 'object',
250
+ required: ['objects'],
251
+ properties: {
252
+ objects: { type: 'array', items: STORAGE_OBJECT_METADATA_SCHEMA },
253
+ nextCursor: { type: 'string' },
254
+ },
255
+ } as const satisfies DataSchema;
256
+
257
+ export const STORAGE_RESOLVE_INPUT_SCHEMA = {
258
+ ...STORAGE_IDENTITY_SCHEMA,
259
+ properties: {
260
+ ...STORAGE_IDENTITY_SCHEMA.properties,
261
+ access: { type: 'string', enum: ['public', 'signed'] },
262
+ expiresInSeconds: { type: 'integer' },
263
+ },
264
+ } as const satisfies DataSchema;
265
+
266
+ export const STORAGE_RESOLVED_ASSET_SCHEMA = {
267
+ ...STORAGE_IDENTITY_SCHEMA,
268
+ required: ['bucket', 'path', 'url', 'access'],
269
+ properties: {
270
+ ...STORAGE_IDENTITY_SCHEMA.properties,
271
+ url: { type: 'string' },
272
+ access: { type: 'string', enum: ['public', 'signed'] },
273
+ expiresAt: { type: 'string' },
274
+ },
275
+ } as const satisfies DataSchema;
276
+
277
+ export const STORAGE_RESOLVE_RESULT_SCHEMA = {
278
+ type: 'object',
279
+ required: ['asset'],
280
+ properties: { asset: STORAGE_RESOLVED_ASSET_SCHEMA },
281
+ } as const satisfies DataSchema;
282
+
283
+ export const STORAGE_ADAPTER_ERROR_SCHEMA = {
284
+ type: 'object',
285
+ required: ['code', 'message'],
286
+ properties: {
287
+ code: { type: 'string' },
288
+ message: { type: 'string' },
289
+ },
290
+ } as const satisfies DataSchema;
291
+
292
+ export const STORAGE_SUCCESS_SCHEMA = {
293
+ type: 'object',
294
+ required: ['ok'],
295
+ properties: { ok: { const: true } },
296
+ } as const satisfies DataSchema;
297
+
298
+ export const STORAGE_ERROR_RESULT_SCHEMA = {
299
+ type: 'object',
300
+ required: ['ok', 'error'],
301
+ properties: {
302
+ ok: { const: false },
303
+ error: STORAGE_ADAPTER_ERROR_SCHEMA,
304
+ },
305
+ } as const satisfies DataSchema;
306
+
307
+ export const STORAGE_VOID_RESULT_SCHEMA = {
308
+ oneOf: [STORAGE_SUCCESS_SCHEMA, STORAGE_ERROR_RESULT_SCHEMA],
309
+ } as const satisfies DataSchema;
310
+
311
+ export const STORAGE_UPLOAD_OPERATION_RESULT_SCHEMA = {
312
+ oneOf: [
313
+ {
314
+ ...STORAGE_SUCCESS_SCHEMA,
315
+ required: ['ok', 'data'],
316
+ properties: { ...STORAGE_SUCCESS_SCHEMA.properties, data: STORAGE_UPLOAD_RESULT_SCHEMA },
317
+ },
318
+ STORAGE_ERROR_RESULT_SCHEMA,
319
+ ],
320
+ } as const satisfies DataSchema;
321
+
322
+ export const STORAGE_PUBLIC_URL_OPERATION_RESULT_SCHEMA = {
323
+ oneOf: [
324
+ {
325
+ ...STORAGE_SUCCESS_SCHEMA,
326
+ required: ['ok', 'data'],
327
+ properties: { ...STORAGE_SUCCESS_SCHEMA.properties, data: STORAGE_PUBLIC_URL_RESULT_SCHEMA },
328
+ },
329
+ STORAGE_ERROR_RESULT_SCHEMA,
330
+ ],
331
+ } as const satisfies DataSchema;
332
+
333
+ export const STORAGE_LIST_OPERATION_RESULT_SCHEMA = {
334
+ oneOf: [
335
+ {
336
+ ...STORAGE_SUCCESS_SCHEMA,
337
+ required: ['ok', 'data'],
338
+ properties: { ...STORAGE_SUCCESS_SCHEMA.properties, data: STORAGE_LIST_RESULT_SCHEMA },
339
+ },
340
+ STORAGE_ERROR_RESULT_SCHEMA,
341
+ ],
342
+ } as const satisfies DataSchema;
343
+
344
+ export const STORAGE_RESOLVE_OPERATION_RESULT_SCHEMA = {
345
+ oneOf: [
346
+ {
347
+ ...STORAGE_SUCCESS_SCHEMA,
348
+ required: ['ok', 'data'],
349
+ properties: { ...STORAGE_SUCCESS_SCHEMA.properties, data: STORAGE_RESOLVE_RESULT_SCHEMA },
350
+ },
351
+ STORAGE_ERROR_RESULT_SCHEMA,
352
+ ],
353
+ } as const satisfies DataSchema;
@@ -2,12 +2,12 @@
2
2
  import type { StructureDescriptorDocument } from '@ankhorage/contracts/structure';
3
3
 
4
4
  export const STRUCTURE_DESCRIPTOR_COMPILER_VERSION = '6.0.3';
5
- export const STRUCTURE_DESCRIPTOR_FINGERPRINT = 'sha256:d500087154a2536754e4dd4946fb40b6e84be31bebfc0ed5df114a5aad2f70f3';
5
+ export const STRUCTURE_DESCRIPTOR_FINGERPRINT = 'sha256:e6117f029e0a0fde13ed1d08fe1a39d7e06a9f83a0d32198865446501875e27d';
6
6
 
7
7
  export const STRUCTURE_DESCRIPTOR = {
8
8
  "protocolVersion": 1,
9
9
  "packageName": "@ankhorage/contracts",
10
- "packageVersion": "25.0.1",
10
+ "packageVersion": "25.2.0",
11
11
  "roots": {
12
12
  "auth-flow": "AuthFlowConfig",
13
13
  "auth-profile": "AuthProfileSpec",