@ankhorage/contracts 25.1.0 → 26.0.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/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/appManifest/bindings.d.ts +3 -3
- package/dist/appManifest/bindings.d.ts.map +1 -1
- package/dist/appManifest/bindings.js +46 -65
- package/dist/appManifest/bindings.js.map +1 -1
- package/dist/appManifest/screens.js +2 -2
- package/dist/appManifest/screens.js.map +1 -1
- package/dist/bindings.d.ts +39 -64
- package/dist/bindings.d.ts.map +1 -1
- package/dist/bindings.js.map +1 -1
- package/dist/storage.d.ts +611 -0
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +173 -1
- package/dist/storage.js.map +1 -1
- package/dist/structure/generated.d.ts +2 -2
- package/dist/structure/generated.js +2 -2
- package/dist/structure/generated.js.map +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +3 -3
- package/src/appManifest/bindings.ts +46 -72
- package/src/appManifest/screens.ts +2 -2
- package/src/appManifest.test.ts +7 -8
- package/src/bindings.test.ts +86 -516
- package/src/bindings.ts +41 -88
- package/src/contracts.test.ts +10 -20
- package/src/storage-schemas.test.ts +86 -0
- package/src/storage.ts +197 -0
- package/src/structure/generated.ts +2 -2
- package/src/types.ts +2 -2
package/src/bindings.ts
CHANGED
|
@@ -1,123 +1,76 @@
|
|
|
1
|
+
import type { Capability } from './capability';
|
|
1
2
|
import type { EntityRegistry, ValueMap } from './collections';
|
|
2
|
-
import type { ApiId, EndpointId, OperationId } from './data';
|
|
3
3
|
import type { SerializableValue } from './serializable';
|
|
4
4
|
|
|
5
5
|
export type ComponentInstanceId = string;
|
|
6
6
|
export type ComponentTypeId = string;
|
|
7
|
-
|
|
8
7
|
export type BindingValue = SerializableValue;
|
|
9
|
-
|
|
10
8
|
export type BindingDataPath = string;
|
|
11
|
-
|
|
12
9
|
export type BindingValueTransform = 'lowercase' | 'trim' | 'uppercase';
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
readonly
|
|
17
|
-
readonly
|
|
11
|
+
/** A portable reference to a readable capability value or a cached invocation result. */
|
|
12
|
+
export interface BindingCapabilityReference {
|
|
13
|
+
readonly capability: Capability['id'];
|
|
14
|
+
readonly path?: BindingDataPath;
|
|
15
|
+
readonly result?: string;
|
|
18
16
|
}
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
|
30
|
-
|
|
31
|
-
readonly value: BindingValue;
|
|
32
|
-
}
|
|
18
|
+
/** A portable request to invoke a capability and optionally retain its result in a local slot. */
|
|
19
|
+
export interface BindingInvocation {
|
|
20
|
+
readonly capability: Capability['id'];
|
|
21
|
+
readonly input?: BindingInputMap;
|
|
22
|
+
readonly result?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** A recursive, serializable value expression used by bindings and invocation inputs. */
|
|
26
|
+
export type BindingExpression =
|
|
27
|
+
| BindingCapabilityReference
|
|
28
|
+
| { readonly kind: 'array'; readonly items: readonly BindingExpression[] }
|
|
33
29
|
| {
|
|
34
|
-
readonly kind: '
|
|
35
|
-
readonly
|
|
36
|
-
readonly
|
|
30
|
+
readonly kind: 'fallback';
|
|
31
|
+
readonly value: BindingExpression;
|
|
32
|
+
readonly fallback: BindingExpression;
|
|
37
33
|
}
|
|
34
|
+
| { readonly kind: 'literal'; readonly value: BindingValue }
|
|
35
|
+
| { readonly kind: 'object'; readonly fields: ValueMap<string, BindingExpression> }
|
|
38
36
|
| {
|
|
39
|
-
readonly kind: '
|
|
40
|
-
readonly
|
|
37
|
+
readonly kind: 'transform';
|
|
38
|
+
readonly value: BindingExpression;
|
|
39
|
+
readonly transforms: readonly BindingValueTransform[];
|
|
41
40
|
};
|
|
42
41
|
|
|
43
|
-
export
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
42
|
+
export type BindingInputValue = BindingExpression;
|
|
43
|
+
export type BindingInputMap = ValueMap<string, BindingInputValue>;
|
|
44
|
+
export type BindingConditionOperator = 'eq' | 'exists' | 'neq' | 'notExists';
|
|
47
45
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
readonly source
|
|
46
|
+
/** A condition evaluated from portable binding expressions. */
|
|
47
|
+
export interface BindingCondition {
|
|
48
|
+
readonly source: BindingExpression;
|
|
49
|
+
readonly operator: BindingConditionOperator;
|
|
50
|
+
readonly value?: BindingExpression;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
/** A lifecycle-specific expression rendered when a bound value reaches one state. */
|
|
55
54
|
export interface BindingLifecycleBehavior {
|
|
56
55
|
readonly state: BindingLifecycleState;
|
|
57
|
-
readonly
|
|
56
|
+
readonly value?: BindingExpression;
|
|
58
57
|
readonly message?: string;
|
|
59
58
|
}
|
|
60
59
|
|
|
60
|
+
export type BindingLifecycleState = 'empty' | 'error' | 'loading';
|
|
61
|
+
|
|
61
62
|
export interface PropBinding {
|
|
62
|
-
readonly
|
|
63
|
-
readonly fallback?: BindingFallback;
|
|
63
|
+
readonly value: BindingExpression;
|
|
64
64
|
readonly loading?: BindingLifecycleBehavior;
|
|
65
65
|
readonly error?: BindingLifecycleBehavior;
|
|
66
66
|
readonly empty?: BindingLifecycleBehavior;
|
|
67
|
-
readonly transforms?: readonly BindingValueTransform[];
|
|
68
67
|
}
|
|
69
68
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
readonly kind: 'array';
|
|
73
|
-
readonly items: readonly BindingInputValue[];
|
|
74
|
-
}
|
|
75
|
-
| {
|
|
76
|
-
readonly kind: 'literal';
|
|
77
|
-
readonly value: BindingValue;
|
|
78
|
-
}
|
|
79
|
-
| {
|
|
80
|
-
readonly kind: 'object';
|
|
81
|
-
readonly fields: ValueMap<string, BindingInputValue>;
|
|
82
|
-
}
|
|
83
|
-
| {
|
|
84
|
-
readonly kind: 'source';
|
|
85
|
-
readonly source: BindingValueSource;
|
|
86
|
-
readonly transforms?: readonly BindingValueTransform[];
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
export type BindingInputMap = ValueMap<string, BindingInputValue>;
|
|
90
|
-
|
|
91
|
-
export interface OperationScreenDataLoaderDefinition {
|
|
92
|
-
readonly kind: 'operation';
|
|
93
|
-
readonly id?: string;
|
|
94
|
-
readonly operation: BindingOperationRef;
|
|
95
|
-
readonly input?: BindingInputMap;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export type ScreenDataLoaderDefinition = OperationScreenDataLoaderDefinition;
|
|
99
|
-
|
|
100
|
-
export type BindingConditionOperator = 'eq' | 'exists' | 'neq' | 'notExists';
|
|
101
|
-
|
|
102
|
-
export interface BindingCondition {
|
|
103
|
-
readonly source: BindingValueSource;
|
|
104
|
-
readonly operator: BindingConditionOperator;
|
|
105
|
-
readonly value?: BindingValue;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export type EventBindingTarget =
|
|
109
|
-
| {
|
|
110
|
-
readonly kind: 'action';
|
|
111
|
-
readonly type: string;
|
|
112
|
-
}
|
|
113
|
-
| {
|
|
114
|
-
readonly kind: 'operation';
|
|
115
|
-
readonly operation: BindingOperationRef;
|
|
116
|
-
};
|
|
69
|
+
/** A screen loader is one capability invocation, optionally storing its result by slot name. */
|
|
70
|
+
export type ScreenDataLoaderDefinition = BindingInvocation;
|
|
117
71
|
|
|
118
72
|
export interface EventBinding {
|
|
119
|
-
readonly target:
|
|
120
|
-
readonly input?: BindingInputMap;
|
|
73
|
+
readonly target: BindingInvocation;
|
|
121
74
|
readonly when?: BindingCondition;
|
|
122
75
|
}
|
|
123
76
|
|
package/src/contracts.test.ts
CHANGED
|
@@ -219,7 +219,7 @@ describe('contracts', () => {
|
|
|
219
219
|
expect(theme.recipes?.patterns?.Panel?.padding).toBe('xl');
|
|
220
220
|
});
|
|
221
221
|
|
|
222
|
-
it('accepts screens with
|
|
222
|
+
it('accepts screens with capability loaders and repeat empty-state nodes', () => {
|
|
223
223
|
const manifest: Pick<AppManifest, 'screens'> = {
|
|
224
224
|
screens: {
|
|
225
225
|
products: {
|
|
@@ -230,12 +230,8 @@ describe('contracts', () => {
|
|
|
230
230
|
type: 'Grid',
|
|
231
231
|
repeat: {
|
|
232
232
|
source: {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
dataSourceId: 'nutrition-api',
|
|
236
|
-
endpointId: 'products',
|
|
237
|
-
operationId: 'nutrition.products.list',
|
|
238
|
-
},
|
|
233
|
+
capability: 'api.nutrition.productsList',
|
|
234
|
+
result: 'products',
|
|
239
235
|
path: 'products',
|
|
240
236
|
},
|
|
241
237
|
empty: [
|
|
@@ -252,20 +248,12 @@ describe('contracts', () => {
|
|
|
252
248
|
},
|
|
253
249
|
dataLoaders: [
|
|
254
250
|
{
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
operation: {
|
|
258
|
-
dataSourceId: 'nutrition-api',
|
|
259
|
-
endpointId: 'products',
|
|
260
|
-
operationId: 'nutrition.products.getById',
|
|
261
|
-
},
|
|
251
|
+
capability: 'api.nutrition.productsGetById',
|
|
252
|
+
result: 'product',
|
|
262
253
|
input: {
|
|
263
254
|
id: {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
kind: 'context',
|
|
267
|
-
path: 'route.params.id',
|
|
268
|
-
},
|
|
255
|
+
capability: 'context.route',
|
|
256
|
+
path: 'params.id',
|
|
269
257
|
},
|
|
270
258
|
},
|
|
271
259
|
},
|
|
@@ -275,7 +263,9 @@ describe('contracts', () => {
|
|
|
275
263
|
};
|
|
276
264
|
|
|
277
265
|
expect(JSON.parse(JSON.stringify(manifest))).toEqual(manifest);
|
|
278
|
-
expect(manifest.screens.products?.dataLoaders?.[0]?.
|
|
266
|
+
expect(manifest.screens.products?.dataLoaders?.[0]?.capability).toBe(
|
|
267
|
+
'api.nutrition.productsGetById',
|
|
268
|
+
);
|
|
279
269
|
expect(manifest.screens.products?.root.repeat?.empty?.[0]?.type).toBe('Notice');
|
|
280
270
|
});
|
|
281
271
|
|
|
@@ -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:
|
|
5
|
+
export const STRUCTURE_DESCRIPTOR_FINGERPRINT = 'sha256:535fb077e79daec8b09c756ed220bd7cb29bdf62d53559e3032ca246dd3f5bd3';
|
|
6
6
|
|
|
7
7
|
export const STRUCTURE_DESCRIPTOR = {
|
|
8
8
|
"protocolVersion": 1,
|
|
9
9
|
"packageName": "@ankhorage/contracts",
|
|
10
|
-
"packageVersion": "
|
|
10
|
+
"packageVersion": "26.0.0",
|
|
11
11
|
"roots": {
|
|
12
12
|
"auth-flow": "AuthFlowConfig",
|
|
13
13
|
"auth-profile": "AuthProfileSpec",
|
package/src/types.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { ColorHarmony } from '@ankhorage/color-theory';
|
|
|
2
2
|
|
|
3
3
|
import type { AuthIdentifierKind, AuthSignUpField } from './auth';
|
|
4
4
|
import type {
|
|
5
|
-
|
|
5
|
+
BindingExpression,
|
|
6
6
|
ComponentDataBindingRegistry,
|
|
7
7
|
ScreenDataLoaderDefinition,
|
|
8
8
|
} from './bindings';
|
|
@@ -153,7 +153,7 @@ export interface SvgIconSpec extends IconPresentationSpec {
|
|
|
153
153
|
export type IconSpec = NamedIconSpec | SvgIconSpec;
|
|
154
154
|
|
|
155
155
|
export interface UiNodeRepeatSpec {
|
|
156
|
-
source:
|
|
156
|
+
source: BindingExpression;
|
|
157
157
|
itemAlias?: string;
|
|
158
158
|
keyPath?: string;
|
|
159
159
|
empty?: readonly UiNode[];
|