@ankhorage/contracts 24.0.0 → 24.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/CHANGELOG.md +12 -0
- package/README.md +3 -1
- package/dist/capabilities.d.ts +18 -3
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/capabilities.js +115 -1
- package/dist/capabilities.js.map +1 -1
- package/dist/data/dataValidation.d.ts +5 -0
- package/dist/data/dataValidation.d.ts.map +1 -1
- package/dist/data/dataValidation.js +5 -4
- package/dist/data/dataValidation.js.map +1 -1
- package/dist/data/index.d.ts +1 -0
- package/dist/data/index.d.ts.map +1 -1
- package/dist/data/index.js +1 -0
- package/dist/data/index.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/package.json +3 -3
- package/src/capabilities.test.ts +151 -1
- package/src/capabilities.ts +163 -4
- package/src/data/dataValidation.ts +5 -3
- package/src/data/index.ts +1 -0
- package/src/structure/generated.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ankhorage/contracts
|
|
2
2
|
|
|
3
|
+
## 24.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 9fd3cb7: Add the portable `storage` capability binding family for trusted-only storage descriptors.
|
|
8
|
+
|
|
9
|
+
## 24.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- c71a377: Add canonical Capability runtime literals, validation, normalization, equality, and reusable DataSchema validation exports.
|
|
14
|
+
|
|
3
15
|
## 24.0.0
|
|
4
16
|
|
|
5
17
|
### Major Changes
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
# @ankhorage/contracts
|
|
5
5
|
|
|
6
|
-
         
|
|
7
7
|
|
|
8
8
|
Serializable app, capability, binding, theme, auth, and secret-store contracts for Ankhorage.
|
|
9
9
|
|
|
@@ -15,6 +15,7 @@ Serializable app, capability, binding, theme, auth, and secret-store contracts f
|
|
|
15
15
|
- [Architecture overview](././paradox/diagrams/architecture-overview.mmd)
|
|
16
16
|
- [Module relationships](././paradox/diagrams/module-relationships.mmd)
|
|
17
17
|
- [Export graph](././paradox/diagrams/export-graph.mmd)
|
|
18
|
+
- [isCapabilityId sequence](././paradox/diagrams/sequences/is-capability-id.mmd)
|
|
18
19
|
- [isInfraAdapterDescriptor sequence](././paradox/diagrams/sequences/is-infra-adapter-descriptor.mmd)
|
|
19
20
|
- [isInfraAuthSpec sequence](././paradox/diagrams/sequences/is-infra-auth-spec.mmd)
|
|
20
21
|
- [isInfraDeploymentSpec sequence](././paradox/diagrams/sequences/is-infra-deployment-spec.mmd)
|
|
@@ -25,4 +26,5 @@ Serializable app, capability, binding, theme, auth, and secret-store contracts f
|
|
|
25
26
|
- [isSerializableSet sequence](././paradox/diagrams/sequences/is-serializable-set.mmd)
|
|
26
27
|
- [isSerializableValue sequence](././paradox/diagrams/sequences/is-serializable-value.mmd)
|
|
27
28
|
- [isStructureDescriptorDocument sequence](././paradox/diagrams/sequences/is-structure-descriptor-document.mmd)
|
|
29
|
+
- [normalizeCapability sequence](././paradox/diagrams/sequences/normalize-capability.mmd)
|
|
28
30
|
- [parseInfraManifest sequence](././paradox/diagrams/sequences/parse-infra-manifest.mmd)
|
package/dist/capabilities.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import type { DataSchemaSlot } from './data/schemas';
|
|
2
|
-
|
|
3
|
-
export
|
|
2
|
+
/*** Enumerate the operations a capability exposes to other packages. */
|
|
3
|
+
export declare const CAPABILITY_ACCESS: readonly ["emit", "invoke", "read", "subscribe", "write"];
|
|
4
|
+
export type CapabilityAccess = (typeof CAPABILITY_ACCESS)[number];
|
|
5
|
+
/*** Enumerate the portable runtime families supported by capability bindings. */
|
|
6
|
+
export declare const CAPABILITY_BINDING_KINDS: readonly ["action", "api", "auth", "authorization", "context", "event", "permission", "state", "storage"];
|
|
7
|
+
export type CapabilityBindingKind = (typeof CAPABILITY_BINDING_KINDS)[number];
|
|
8
|
+
/*** Enumerate the directions in which a capability can participate in a binding. */
|
|
9
|
+
export declare const CAPABILITY_BINDING_ROLES: readonly ["source", "target"];
|
|
10
|
+
export type CapabilityBindingRole = (typeof CAPABILITY_BINDING_ROLES)[number];
|
|
4
11
|
/**
|
|
5
12
|
* Portable description of one bindable or executable Ankhorage capability.
|
|
6
13
|
*
|
|
@@ -11,7 +18,7 @@ export type CapabilityBindingRole = 'source' | 'target';
|
|
|
11
18
|
export interface Capability {
|
|
12
19
|
readonly id: `${string}.${string}`;
|
|
13
20
|
readonly owner: string;
|
|
14
|
-
readonly access: readonly
|
|
21
|
+
readonly access: readonly CapabilityAccess[];
|
|
15
22
|
readonly binding: {
|
|
16
23
|
readonly kind: CapabilityBindingKind;
|
|
17
24
|
readonly bindableAs: readonly CapabilityBindingRole[];
|
|
@@ -21,4 +28,12 @@ export interface Capability {
|
|
|
21
28
|
readonly input?: DataSchemaSlot;
|
|
22
29
|
readonly output?: DataSchemaSlot;
|
|
23
30
|
}
|
|
31
|
+
/*** Validate a stable dot-separated identifier for one capability. */
|
|
32
|
+
export declare function isCapabilityId(value: unknown): value is Capability['id'];
|
|
33
|
+
/*** Validate an untrusted value as one complete portable capability descriptor. */
|
|
34
|
+
export declare function isCapability(value: unknown): value is Capability;
|
|
35
|
+
/*** Return a capability with access and binding-role collections sorted and deduplicated. */
|
|
36
|
+
export declare function normalizeCapability(capability: Capability): Capability;
|
|
37
|
+
/*** Compare capability descriptors independent of object property and unordered collection ordering. */
|
|
38
|
+
export declare function areCapabilitiesEqual(left: Capability, right: Capability): boolean;
|
|
24
39
|
//# sourceMappingURL=capabilities.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"
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AmF;AACnF,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAYhE;AAED,6FAA6F;AAC7F,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CActE;AAED,wGAAwG;AACxG,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAEjF"}
|
package/dist/capabilities.js
CHANGED
|
@@ -1,2 +1,116 @@
|
|
|
1
|
-
|
|
1
|
+
import { uniqueSortedStrings } from '@ankhorage/utility/array';
|
|
2
|
+
import { isRecord } from '@ankhorage/utility/object';
|
|
3
|
+
import { isNonEmptyString, isOptionalString } from '@ankhorage/utility/string';
|
|
4
|
+
import { isDataSchemaSlot } from './data/dataValidation';
|
|
5
|
+
/*** Enumerate the operations a capability exposes to other packages. */
|
|
6
|
+
export const CAPABILITY_ACCESS = ['emit', 'invoke', 'read', 'subscribe', 'write'];
|
|
7
|
+
/*** Enumerate the portable runtime families supported by capability bindings. */
|
|
8
|
+
export const CAPABILITY_BINDING_KINDS = [
|
|
9
|
+
'action',
|
|
10
|
+
'api',
|
|
11
|
+
'auth',
|
|
12
|
+
'authorization',
|
|
13
|
+
'context',
|
|
14
|
+
'event',
|
|
15
|
+
'permission',
|
|
16
|
+
'state',
|
|
17
|
+
'storage',
|
|
18
|
+
];
|
|
19
|
+
/*** Enumerate the directions in which a capability can participate in a binding. */
|
|
20
|
+
export const CAPABILITY_BINDING_ROLES = ['source', 'target'];
|
|
21
|
+
/*** Validate a stable dot-separated identifier for one capability. */
|
|
22
|
+
export function isCapabilityId(value) {
|
|
23
|
+
return (isNonEmptyString(value) &&
|
|
24
|
+
value.split('.').length >= 2 &&
|
|
25
|
+
value.split('.').every(isNonEmptyString));
|
|
26
|
+
}
|
|
27
|
+
/*** Validate an untrusted value as one complete portable capability descriptor. */
|
|
28
|
+
export function isCapability(value) {
|
|
29
|
+
return (isRecord(value) &&
|
|
30
|
+
isCapabilityId(value.id) &&
|
|
31
|
+
isNonEmptyString(value.owner) &&
|
|
32
|
+
isCapabilityAccessList(value.access) &&
|
|
33
|
+
isCapabilityBinding(value.binding) &&
|
|
34
|
+
isOptionalString(value.label) &&
|
|
35
|
+
isOptionalString(value.description) &&
|
|
36
|
+
(value.input === undefined || isDataSchemaSlot(value.input)) &&
|
|
37
|
+
(value.output === undefined || isDataSchemaSlot(value.output)));
|
|
38
|
+
}
|
|
39
|
+
/*** Return a capability with access and binding-role collections sorted and deduplicated. */
|
|
40
|
+
export function normalizeCapability(capability) {
|
|
41
|
+
return {
|
|
42
|
+
id: capability.id,
|
|
43
|
+
owner: capability.owner,
|
|
44
|
+
access: normalizeCapabilityAccess(capability.access),
|
|
45
|
+
binding: {
|
|
46
|
+
kind: capability.binding.kind,
|
|
47
|
+
bindableAs: normalizeCapabilityBindingRoles(capability.binding.bindableAs),
|
|
48
|
+
},
|
|
49
|
+
...(capability.label === undefined ? {} : { label: capability.label }),
|
|
50
|
+
...(capability.description === undefined ? {} : { description: capability.description }),
|
|
51
|
+
...(capability.input === undefined ? {} : { input: capability.input }),
|
|
52
|
+
...(capability.output === undefined ? {} : { output: capability.output }),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/*** Compare capability descriptors independent of object property and unordered collection ordering. */
|
|
56
|
+
export function areCapabilitiesEqual(left, right) {
|
|
57
|
+
return areCapabilityValuesEqual(normalizeCapability(left), normalizeCapability(right));
|
|
58
|
+
}
|
|
59
|
+
/*** Validate a non-empty collection of supported capability access operations. */
|
|
60
|
+
function isCapabilityAccessList(value) {
|
|
61
|
+
return (Array.isArray(value) && value.length > 0 && value.every((entry) => isCapabilityAccess(entry)));
|
|
62
|
+
}
|
|
63
|
+
/*** Validate a portable capability binding descriptor. */
|
|
64
|
+
function isCapabilityBinding(value) {
|
|
65
|
+
return (isRecord(value) &&
|
|
66
|
+
isCapabilityBindingKind(value.kind) &&
|
|
67
|
+
Array.isArray(value.bindableAs) &&
|
|
68
|
+
value.bindableAs.every((entry) => isCapabilityBindingRole(entry)));
|
|
69
|
+
}
|
|
70
|
+
/*** Validate one supported capability access operation. */
|
|
71
|
+
function isCapabilityAccess(value) {
|
|
72
|
+
return typeof value === 'string' && CAPABILITY_ACCESS.some((access) => access === value);
|
|
73
|
+
}
|
|
74
|
+
/*** Validate one supported capability binding family. */
|
|
75
|
+
function isCapabilityBindingKind(value) {
|
|
76
|
+
return (typeof value === 'string' &&
|
|
77
|
+
CAPABILITY_BINDING_KINDS.some((bindingKind) => bindingKind === value));
|
|
78
|
+
}
|
|
79
|
+
/*** Validate one supported capability binding direction. */
|
|
80
|
+
function isCapabilityBindingRole(value) {
|
|
81
|
+
return (typeof value === 'string' &&
|
|
82
|
+
CAPABILITY_BINDING_ROLES.some((bindingRole) => bindingRole === value));
|
|
83
|
+
}
|
|
84
|
+
/*** Sort and deduplicate supported access operations using the canonical Utility collection helper. */
|
|
85
|
+
function normalizeCapabilityAccess(access) {
|
|
86
|
+
return uniqueSortedStrings(access).filter(isCapabilityAccess);
|
|
87
|
+
}
|
|
88
|
+
/*** Sort and deduplicate supported binding directions using the canonical Utility collection helper. */
|
|
89
|
+
function normalizeCapabilityBindingRoles(bindingRoles) {
|
|
90
|
+
return uniqueSortedStrings(bindingRoles).filter(isCapabilityBindingRole);
|
|
91
|
+
}
|
|
92
|
+
/*** Compare the serializable values contained by two normalized capability descriptors. */
|
|
93
|
+
function areCapabilityValuesEqual(left, right) {
|
|
94
|
+
if (Object.is(left, right))
|
|
95
|
+
return true;
|
|
96
|
+
if (Array.isArray(left) || Array.isArray(right))
|
|
97
|
+
return areCapabilityArraysEqual(left, right);
|
|
98
|
+
if (isRecord(left) && isRecord(right))
|
|
99
|
+
return areCapabilityRecordsEqual(left, right);
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
/*** Compare two serializable arrays in their authored order. */
|
|
103
|
+
function areCapabilityArraysEqual(left, right) {
|
|
104
|
+
return (Array.isArray(left) &&
|
|
105
|
+
Array.isArray(right) &&
|
|
106
|
+
left.length === right.length &&
|
|
107
|
+
left.every((value, index) => areCapabilityValuesEqual(value, right.at(index))));
|
|
108
|
+
}
|
|
109
|
+
/*** Compare two serializable records independent of their authored property order. */
|
|
110
|
+
function areCapabilityRecordsEqual(left, right) {
|
|
111
|
+
const leftEntries = Object.entries(left);
|
|
112
|
+
const rightEntries = Object.entries(right);
|
|
113
|
+
return (leftEntries.length === rightEntries.length &&
|
|
114
|
+
leftEntries.every(([leftKey, leftValue]) => rightEntries.some(([rightKey, rightValue]) => leftKey === rightKey && areCapabilityValuesEqual(leftValue, rightValue))));
|
|
115
|
+
}
|
|
2
116
|
//# sourceMappingURL=capabilities.js.map
|
package/dist/capabilities.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"","sourcesContent":["import type { DataSchemaSlot } from './data/schemas';\n\nexport type CapabilityBindingKind =\n 'action' | 'api' | 'auth' | 'authorization' | 'context' | 'event' | 'permission' | 'state';\n\nexport type CapabilityBindingRole = 'source' | 'target';\n\n/**\n * Portable description of one bindable or executable Ankhorage capability.\n *\n * Packages publish capability catalogs from `src/capabilities/index.ts`. Runtime registries,\n * handlers, adapters, transport details, and framework objects remain package-owned and are not\n * part of this serializable contract.\n */\nexport interface Capability {\n readonly id: `${string}.${string}`;\n readonly owner: string;\n readonly access: readonly ('emit' | 'invoke' | 'read' | 'subscribe' | 'write')[];\n readonly binding: {\n readonly kind: CapabilityBindingKind;\n readonly bindableAs: readonly CapabilityBindingRole[];\n };\n readonly label?: string;\n readonly description?: string;\n readonly input?: DataSchemaSlot;\n readonly output?: DataSchemaSlot;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,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AAC;IAC3C,OAAO,CACL,WAAW,CAAC,MAAM,KAAK,YAAY,CAAC,MAAM;QAC1C,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,EAAE,CACzC,YAAY,CAAC,IAAI,CACf,CAAC,CAAC,QAAQ,EAAE,UAAU,CAAC,EAAE,EAAE,CACzB,OAAO,KAAK,QAAQ,IAAI,wBAAwB,CAAC,SAAS,EAAE,UAAU,CAAC,CAC1E,CACF,CACF,CAAC;AACJ,CAAC","sourcesContent":["import { uniqueSortedStrings } from '@ankhorage/utility/array';\nimport { isRecord } from '@ankhorage/utility/object';\nimport { isNonEmptyString, isOptionalString } from '@ankhorage/utility/string';\n\nimport { isDataSchemaSlot } from './data/dataValidation';\nimport type { DataSchemaSlot } from './data/schemas';\n\n/*** Enumerate the operations a capability exposes to other packages. */\nexport const CAPABILITY_ACCESS = ['emit', 'invoke', 'read', 'subscribe', 'write'] as const;\n\nexport type CapabilityAccess = (typeof CAPABILITY_ACCESS)[number];\n\n/*** Enumerate the portable runtime families supported by capability bindings. */\nexport const CAPABILITY_BINDING_KINDS = [\n 'action',\n 'api',\n 'auth',\n 'authorization',\n 'context',\n 'event',\n 'permission',\n 'state',\n 'storage',\n] as const;\n\nexport type CapabilityBindingKind = (typeof CAPABILITY_BINDING_KINDS)[number];\n\n/*** Enumerate the directions in which a capability can participate in a binding. */\nexport const CAPABILITY_BINDING_ROLES = ['source', 'target'] as const;\n\nexport type CapabilityBindingRole = (typeof CAPABILITY_BINDING_ROLES)[number];\n\n/**\n * Portable description of one bindable or executable Ankhorage capability.\n *\n * Packages publish capability catalogs from `src/capabilities/index.ts`. Runtime registries,\n * handlers, adapters, transport details, and framework objects remain package-owned and are not\n * part of this serializable contract.\n */\nexport interface Capability {\n readonly id: `${string}.${string}`;\n readonly owner: string;\n readonly access: readonly CapabilityAccess[];\n readonly binding: {\n readonly kind: CapabilityBindingKind;\n readonly bindableAs: readonly CapabilityBindingRole[];\n };\n readonly label?: string;\n readonly description?: string;\n readonly input?: DataSchemaSlot;\n readonly output?: DataSchemaSlot;\n}\n\n/*** Validate a stable dot-separated identifier for one capability. */\nexport function isCapabilityId(value: unknown): value is Capability['id'] {\n return (\n isNonEmptyString(value) &&\n value.split('.').length >= 2 &&\n value.split('.').every(isNonEmptyString)\n );\n}\n\n/*** Validate an untrusted value as one complete portable capability descriptor. */\nexport function isCapability(value: unknown): value is Capability {\n return (\n isRecord(value) &&\n isCapabilityId(value.id) &&\n isNonEmptyString(value.owner) &&\n isCapabilityAccessList(value.access) &&\n isCapabilityBinding(value.binding) &&\n isOptionalString(value.label) &&\n isOptionalString(value.description) &&\n (value.input === undefined || isDataSchemaSlot(value.input)) &&\n (value.output === undefined || isDataSchemaSlot(value.output))\n );\n}\n\n/*** Return a capability with access and binding-role collections sorted and deduplicated. */\nexport function normalizeCapability(capability: Capability): Capability {\n return {\n id: capability.id,\n owner: capability.owner,\n access: normalizeCapabilityAccess(capability.access),\n binding: {\n kind: capability.binding.kind,\n bindableAs: normalizeCapabilityBindingRoles(capability.binding.bindableAs),\n },\n ...(capability.label === undefined ? {} : { label: capability.label }),\n ...(capability.description === undefined ? {} : { description: capability.description }),\n ...(capability.input === undefined ? {} : { input: capability.input }),\n ...(capability.output === undefined ? {} : { output: capability.output }),\n };\n}\n\n/*** Compare capability descriptors independent of object property and unordered collection ordering. */\nexport function areCapabilitiesEqual(left: Capability, right: Capability): boolean {\n return areCapabilityValuesEqual(normalizeCapability(left), normalizeCapability(right));\n}\n\n/*** Validate a non-empty collection of supported capability access operations. */\nfunction isCapabilityAccessList(value: unknown): value is readonly CapabilityAccess[] {\n return (\n Array.isArray(value) && value.length > 0 && value.every((entry) => isCapabilityAccess(entry))\n );\n}\n\n/*** Validate a portable capability binding descriptor. */\nfunction isCapabilityBinding(value: unknown): value is Capability['binding'] {\n return (\n isRecord(value) &&\n isCapabilityBindingKind(value.kind) &&\n Array.isArray(value.bindableAs) &&\n value.bindableAs.every((entry) => isCapabilityBindingRole(entry))\n );\n}\n\n/*** Validate one supported capability access operation. */\nfunction isCapabilityAccess(value: unknown): value is CapabilityAccess {\n return typeof value === 'string' && CAPABILITY_ACCESS.some((access) => access === value);\n}\n\n/*** Validate one supported capability binding family. */\nfunction isCapabilityBindingKind(value: unknown): value is CapabilityBindingKind {\n return (\n typeof value === 'string' &&\n CAPABILITY_BINDING_KINDS.some((bindingKind) => bindingKind === value)\n );\n}\n\n/*** Validate one supported capability binding direction. */\nfunction isCapabilityBindingRole(value: unknown): value is CapabilityBindingRole {\n return (\n typeof value === 'string' &&\n CAPABILITY_BINDING_ROLES.some((bindingRole) => bindingRole === value)\n );\n}\n\n/*** Sort and deduplicate supported access operations using the canonical Utility collection helper. */\nfunction normalizeCapabilityAccess(\n access: readonly CapabilityAccess[],\n): readonly CapabilityAccess[] {\n return uniqueSortedStrings(access).filter(isCapabilityAccess);\n}\n\n/*** Sort and deduplicate supported binding directions using the canonical Utility collection helper. */\nfunction normalizeCapabilityBindingRoles(\n bindingRoles: readonly CapabilityBindingRole[],\n): readonly CapabilityBindingRole[] {\n return uniqueSortedStrings(bindingRoles).filter(isCapabilityBindingRole);\n}\n\n/*** Compare the serializable values contained by two normalized capability descriptors. */\nfunction areCapabilityValuesEqual(left: unknown, right: unknown): boolean {\n if (Object.is(left, right)) return true;\n if (Array.isArray(left) || Array.isArray(right)) return areCapabilityArraysEqual(left, right);\n if (isRecord(left) && isRecord(right)) return areCapabilityRecordsEqual(left, right);\n return false;\n}\n\n/*** Compare two serializable arrays in their authored order. */\nfunction areCapabilityArraysEqual(left: unknown, right: unknown): boolean {\n return (\n Array.isArray(left) &&\n Array.isArray(right) &&\n left.length === right.length &&\n left.every((value, index) => areCapabilityValuesEqual(value, right.at(index)))\n );\n}\n\n/*** Compare two serializable records independent of their authored property order. */\nfunction areCapabilityRecordsEqual(\n left: Record<string, unknown>,\n right: Record<string, unknown>,\n): boolean {\n const leftEntries = Object.entries(left);\n const rightEntries = Object.entries(right);\n return (\n leftEntries.length === rightEntries.length &&\n leftEntries.every(([leftKey, leftValue]) =>\n rightEntries.some(\n ([rightKey, rightValue]) =>\n leftKey === rightKey && areCapabilityValuesEqual(leftValue, rightValue),\n ),\n )\n );\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DataSchema, DataSchemaSlot } from './schemas';
|
|
1
2
|
/*** Validate every endpoint in the data endpoint registry. */
|
|
2
3
|
export declare function isDataEndpointRegistry(value: unknown): boolean;
|
|
3
4
|
/*** Validate every schema in the data schema registry. */
|
|
@@ -6,4 +7,8 @@ export declare function isDataSchemaRegistry(value: unknown): boolean;
|
|
|
6
7
|
export declare function isCredentialRef(value: unknown): boolean;
|
|
7
8
|
/*** Validate an adapter reference and its optional authored configuration. */
|
|
8
9
|
export declare function isAdapterRef(value: unknown): boolean;
|
|
10
|
+
/*** Validate an inline schema or named schema-reference slot. */
|
|
11
|
+
export declare function isDataSchemaSlot(value: unknown): value is DataSchemaSlot;
|
|
12
|
+
/*** Validate supported schema types, constraints and compositions. */
|
|
13
|
+
export declare function isDataSchema(value: unknown): value is DataSchema;
|
|
9
14
|
//# sourceMappingURL=dataValidation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataValidation.d.ts","sourceRoot":"","sources":["../../src/data/dataValidation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dataValidation.d.ts","sourceRoot":"","sources":["../../src/data/dataValidation.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAc5D,8DAA8D;AAC9D,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAQ9D;AAED,0DAA0D;AAC1D,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE5D;AAED,uEAAuE;AACvE,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAQvD;AAED,8EAA8E;AAC9E,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CASpD;AA2FD,iEAAiE;AACjE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAMxE;AAED,sEAAsE;AACtE,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAKhE"}
|
|
@@ -106,13 +106,14 @@ function isDataOperationResponse(value) {
|
|
|
106
106
|
isOptionalString(value.contentType) &&
|
|
107
107
|
isOptionalString(value.description));
|
|
108
108
|
}
|
|
109
|
-
/*** Validate inline schema
|
|
110
|
-
function isDataSchemaSlot(value) {
|
|
111
|
-
return ((value
|
|
109
|
+
/*** Validate an inline schema or named schema-reference slot. */
|
|
110
|
+
export function isDataSchemaSlot(value) {
|
|
111
|
+
return (isRecord(value) &&
|
|
112
|
+
(value.schema === undefined || isDataSchema(value.schema)) &&
|
|
112
113
|
(value.schemaRef === undefined || isDataSchemaRef(value.schemaRef)));
|
|
113
114
|
}
|
|
114
115
|
/*** Validate supported schema types, constraints and compositions. */
|
|
115
|
-
function isDataSchema(value) {
|
|
116
|
+
export function isDataSchema(value) {
|
|
116
117
|
if (!isRecord(value) || !isDataSchemaType(value.type))
|
|
117
118
|
return false;
|
|
118
119
|
if (!isOptionalSchemaScalars(value))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataValidation.js","sourceRoot":"","sources":["../../src/data/dataValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;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AM,KAAK,GAAG,eAAe,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAC1C,OAAO,KAAK,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;IACpF,CAAC,CAAC,CAAC;AACL,CAAC;AAED,0CAA0C;AAC1C,SAAS,eAAe,CAAC,KAAc;IACrC,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,EAAE,KAAK,QAAQ,CAAC;AACzD,CAAC","sourcesContent":["import { isStringArray } from '@ankhorage/utility/array';\nimport { isRecord, readOwnProperty } from '@ankhorage/utility/object';\nimport { isOptionalString } from '@ankhorage/utility/string';\n\nimport { isSerializableValue } from '../serializable';\n\nconst DATA_SCHEMA_TYPES = new Set([\n 'array',\n 'boolean',\n 'integer',\n 'null',\n 'number',\n 'object',\n 'string',\n]);\nconst OPERATION_INTENTS = new Set(['action', 'create', 'delete', 'read', 'update']);\nconst PARAMETER_LOCATIONS = new Set(['body', 'cookie', 'header', 'path', 'query']);\n\n/*** Validate every endpoint in the data endpoint registry. */\nexport function isDataEndpointRegistry(value: unknown): boolean {\n return (\n isRecord(value) &&\n Object.entries(value).every(\n ([endpointId, endpoint]) =>\n isDataEndpointConfig(endpoint) && isRecord(endpoint) && endpoint.id === endpointId,\n )\n );\n}\n\n/*** Validate every schema in the data schema registry. */\nexport function isDataSchemaRegistry(value: unknown): boolean {\n return isRecord(value) && Object.values(value).every(isDataSchema);\n}\n\n/*** Validate credential identity and optional descriptive metadata. */\nexport function isCredentialRef(value: unknown): boolean {\n return (\n isRecord(value) &&\n typeof value.id === 'string' &&\n typeof value.kind === 'string' &&\n isOptionalString(value.label) &&\n isOptionalString(value.scope)\n );\n}\n\n/*** Validate an adapter reference and its optional authored configuration. */\nexport function isAdapterRef(value: unknown): boolean {\n return (\n isRecord(value) &&\n typeof value.id === 'string' &&\n typeof value.kind === 'string' &&\n isOptionalString(value.packageName) &&\n isOptionalString(value.exportName) &&\n (value.config === undefined || isSerializableValue(value.config))\n );\n}\n\n/*** Validate endpoint identity, operations and optional connection metadata. */\nfunction isDataEndpointConfig(value: unknown): boolean {\n return (\n isRecord(value) &&\n typeof value.id === 'string' &&\n typeof value.kind === 'string' &&\n isOptionalString(value.name) &&\n isOptionalString(value.description) &&\n isOptionalString(value.baseUrl) &&\n isOptionalString(value.path) &&\n (value.credential === undefined || isCredentialRef(value.credential)) &&\n isRecord(value.operations) &&\n Object.entries(value.operations).every(\n ([operationId, operation]) =>\n isDataOperationConfig(operation) && isRecord(operation) && operation.id === operationId,\n ) &&\n (value.metadata === undefined || isSerializableValue(value.metadata))\n );\n}\n\n/*** Validate operation protocol, intent, request and response configuration. */\nfunction isDataOperationConfig(value: unknown): boolean {\n return isRecord(value) && isDataOperationIdentity(value) && isDataOperationDetails(value);\n}\n\n/*** Validate operation identity, protocol and routing fields. */\nfunction isDataOperationIdentity(value: Record<string, unknown>): boolean {\n return (\n typeof value.id === 'string' &&\n isOptionalString(value.endpointId) &&\n isOptionalString(value.name) &&\n isOptionalString(value.description) &&\n typeof value.protocol === 'string' &&\n typeof value.intent === 'string' &&\n OPERATION_INTENTS.has(value.intent) &&\n isOptionalString(value.method) &&\n isOptionalString(value.path)\n );\n}\n\n/*** Validate operation request, response and authored metadata. */\nfunction isDataOperationDetails(value: Record<string, unknown>): boolean {\n return (\n (value.request === undefined || isDataOperationRequest(value.request)) &&\n (value.response === undefined || isDataOperationResponse(value.response)) &&\n (value.pagination === undefined || isRecord(value.pagination)) &&\n (value.credential === undefined || isCredentialRef(value.credential)) &&\n (value.metadata === undefined || isSerializableValue(value.metadata))\n );\n}\n\n/*** Validate request schema, parameters and optional content type. */\nfunction isDataOperationRequest(value: unknown): boolean {\n return (\n isRecord(value) &&\n isDataSchemaSlot(value) &&\n isOptionalString(value.contentType) &&\n (value.parameters === undefined ||\n (Array.isArray(value.parameters) && value.parameters.every(isDataOperationParameter)))\n );\n}\n\n/*** Validate parameter identity, location, schema and optional default value. */\nfunction isDataOperationParameter(value: unknown): boolean {\n return (\n isRecord(value) &&\n isDataSchemaSlot(value) &&\n typeof value.name === 'string' &&\n typeof value.location === 'string' &&\n PARAMETER_LOCATIONS.has(value.location) &&\n (value.required === undefined || typeof value.required === 'boolean') &&\n isOptionalString(value.description) &&\n (value.default === undefined || isSerializableValue(value.default))\n );\n}\n\n/*** Validate response status, schema and optional descriptive metadata. */\nfunction isDataOperationResponse(value: unknown): boolean {\n return (\n isRecord(value) &&\n isDataSchemaSlot(value) &&\n (value.status === undefined ||\n typeof value.status === 'string' ||\n typeof value.status === 'number') &&\n isOptionalString(value.contentType) &&\n isOptionalString(value.description)\n );\n}\n\n/*** Validate inline schema and schema-reference fields. */\nfunction isDataSchemaSlot(value: Record<string, unknown>): boolean {\n return (\n (value.schema === undefined || isDataSchema(value.schema)) &&\n (value.schemaRef === undefined || isDataSchemaRef(value.schemaRef))\n );\n}\n\n/*** Validate supported schema types, constraints and compositions. */\nfunction isDataSchema(value: unknown): boolean {\n if (!isRecord(value) || !isDataSchemaType(value.type)) return false;\n if (!isOptionalSchemaScalars(value)) return false;\n if (!isOptionalSchemaCollections(value)) return false;\n return isOptionalSchemaComposition(value);\n}\n\n/*** Validate a supported schema type or an array of supported types. */\nfunction isDataSchemaType(value: unknown): boolean {\n if (value === undefined) return true;\n if (typeof value === 'string') return DATA_SCHEMA_TYPES.has(value);\n return (\n Array.isArray(value) &&\n value.every((entry) => typeof entry === 'string' && DATA_SCHEMA_TYPES.has(entry))\n );\n}\n\n/*** Validate optional scalar schema constraints. */\nfunction isOptionalSchemaScalars(value: Record<string, unknown>): boolean {\n return (\n isOptionalString(value.title) &&\n isOptionalString(value.description) &&\n isOptionalString(value.format) &&\n (value.nullable === undefined || typeof value.nullable === 'boolean') &&\n (value.const === undefined || isSerializableValue(value.const)) &&\n (value.default === undefined || isSerializableValue(value.default)) &&\n (value.enum === undefined ||\n (Array.isArray(value.enum) && value.enum.every(isSerializableValue))) &&\n (value.ref === undefined || isDataSchemaRef(value.ref))\n );\n}\n\n/*** Validate optional schema properties, items and required fields. */\nfunction isOptionalSchemaCollections(value: Record<string, unknown>): boolean {\n return (\n (value.required === undefined || isStringArray(value.required)) &&\n (value.properties === undefined ||\n (isRecord(value.properties) && Object.values(value.properties).every(isDataSchema))) &&\n (value.additionalProperties === undefined ||\n typeof value.additionalProperties === 'boolean' ||\n isDataSchema(value.additionalProperties)) &&\n (value.items === undefined || isDataSchema(value.items))\n );\n}\n\n/*** Validate optional schema alternatives and intersections. */\nfunction isOptionalSchemaComposition(value: Record<string, unknown>): boolean {\n return ['allOf', 'anyOf', 'oneOf'].every((key) => {\n const entry = readOwnProperty(value, key);\n return entry === undefined || (Array.isArray(entry) && entry.every(isDataSchema));\n });\n}\n\n/*** Validate a named schema reference. */\nfunction isDataSchemaRef(value: unknown): boolean {\n return isRecord(value) && typeof value.id === 'string';\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dataValidation.js","sourceRoot":"","sources":["../../src/data/dataValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGtD,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IAChC,OAAO;IACP,SAAS;IACT,SAAS;IACT,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,QAAQ;CACT,CAAC,CAAC;AACH,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;AACpF,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,CAA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0CAA0C;AAC1C,SAAS,eAAe,CAAC,KAAc;IACrC,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,EAAE,KAAK,QAAQ,CAAC;AACzD,CAAC","sourcesContent":["import { isStringArray } from '@ankhorage/utility/array';\nimport { isRecord, readOwnProperty } from '@ankhorage/utility/object';\nimport { isOptionalString } from '@ankhorage/utility/string';\n\nimport { isSerializableValue } from '../serializable';\nimport type { DataSchema, DataSchemaSlot } from './schemas';\n\nconst DATA_SCHEMA_TYPES = new Set([\n 'array',\n 'boolean',\n 'integer',\n 'null',\n 'number',\n 'object',\n 'string',\n]);\nconst OPERATION_INTENTS = new Set(['action', 'create', 'delete', 'read', 'update']);\nconst PARAMETER_LOCATIONS = new Set(['body', 'cookie', 'header', 'path', 'query']);\n\n/*** Validate every endpoint in the data endpoint registry. */\nexport function isDataEndpointRegistry(value: unknown): boolean {\n return (\n isRecord(value) &&\n Object.entries(value).every(\n ([endpointId, endpoint]) =>\n isDataEndpointConfig(endpoint) && isRecord(endpoint) && endpoint.id === endpointId,\n )\n );\n}\n\n/*** Validate every schema in the data schema registry. */\nexport function isDataSchemaRegistry(value: unknown): boolean {\n return isRecord(value) && Object.values(value).every(isDataSchema);\n}\n\n/*** Validate credential identity and optional descriptive metadata. */\nexport function isCredentialRef(value: unknown): boolean {\n return (\n isRecord(value) &&\n typeof value.id === 'string' &&\n typeof value.kind === 'string' &&\n isOptionalString(value.label) &&\n isOptionalString(value.scope)\n );\n}\n\n/*** Validate an adapter reference and its optional authored configuration. */\nexport function isAdapterRef(value: unknown): boolean {\n return (\n isRecord(value) &&\n typeof value.id === 'string' &&\n typeof value.kind === 'string' &&\n isOptionalString(value.packageName) &&\n isOptionalString(value.exportName) &&\n (value.config === undefined || isSerializableValue(value.config))\n );\n}\n\n/*** Validate endpoint identity, operations and optional connection metadata. */\nfunction isDataEndpointConfig(value: unknown): boolean {\n return (\n isRecord(value) &&\n typeof value.id === 'string' &&\n typeof value.kind === 'string' &&\n isOptionalString(value.name) &&\n isOptionalString(value.description) &&\n isOptionalString(value.baseUrl) &&\n isOptionalString(value.path) &&\n (value.credential === undefined || isCredentialRef(value.credential)) &&\n isRecord(value.operations) &&\n Object.entries(value.operations).every(\n ([operationId, operation]) =>\n isDataOperationConfig(operation) && isRecord(operation) && operation.id === operationId,\n ) &&\n (value.metadata === undefined || isSerializableValue(value.metadata))\n );\n}\n\n/*** Validate operation protocol, intent, request and response configuration. */\nfunction isDataOperationConfig(value: unknown): boolean {\n return isRecord(value) && isDataOperationIdentity(value) && isDataOperationDetails(value);\n}\n\n/*** Validate operation identity, protocol and routing fields. */\nfunction isDataOperationIdentity(value: Record<string, unknown>): boolean {\n return (\n typeof value.id === 'string' &&\n isOptionalString(value.endpointId) &&\n isOptionalString(value.name) &&\n isOptionalString(value.description) &&\n typeof value.protocol === 'string' &&\n typeof value.intent === 'string' &&\n OPERATION_INTENTS.has(value.intent) &&\n isOptionalString(value.method) &&\n isOptionalString(value.path)\n );\n}\n\n/*** Validate operation request, response and authored metadata. */\nfunction isDataOperationDetails(value: Record<string, unknown>): boolean {\n return (\n (value.request === undefined || isDataOperationRequest(value.request)) &&\n (value.response === undefined || isDataOperationResponse(value.response)) &&\n (value.pagination === undefined || isRecord(value.pagination)) &&\n (value.credential === undefined || isCredentialRef(value.credential)) &&\n (value.metadata === undefined || isSerializableValue(value.metadata))\n );\n}\n\n/*** Validate request schema, parameters and optional content type. */\nfunction isDataOperationRequest(value: unknown): boolean {\n return (\n isRecord(value) &&\n isDataSchemaSlot(value) &&\n isOptionalString(value.contentType) &&\n (value.parameters === undefined ||\n (Array.isArray(value.parameters) && value.parameters.every(isDataOperationParameter)))\n );\n}\n\n/*** Validate parameter identity, location, schema and optional default value. */\nfunction isDataOperationParameter(value: unknown): boolean {\n return (\n isRecord(value) &&\n isDataSchemaSlot(value) &&\n typeof value.name === 'string' &&\n typeof value.location === 'string' &&\n PARAMETER_LOCATIONS.has(value.location) &&\n (value.required === undefined || typeof value.required === 'boolean') &&\n isOptionalString(value.description) &&\n (value.default === undefined || isSerializableValue(value.default))\n );\n}\n\n/*** Validate response status, schema and optional descriptive metadata. */\nfunction isDataOperationResponse(value: unknown): boolean {\n return (\n isRecord(value) &&\n isDataSchemaSlot(value) &&\n (value.status === undefined ||\n typeof value.status === 'string' ||\n typeof value.status === 'number') &&\n isOptionalString(value.contentType) &&\n isOptionalString(value.description)\n );\n}\n\n/*** Validate an inline schema or named schema-reference slot. */\nexport function isDataSchemaSlot(value: unknown): value is DataSchemaSlot {\n return (\n isRecord(value) &&\n (value.schema === undefined || isDataSchema(value.schema)) &&\n (value.schemaRef === undefined || isDataSchemaRef(value.schemaRef))\n );\n}\n\n/*** Validate supported schema types, constraints and compositions. */\nexport function isDataSchema(value: unknown): value is DataSchema {\n if (!isRecord(value) || !isDataSchemaType(value.type)) return false;\n if (!isOptionalSchemaScalars(value)) return false;\n if (!isOptionalSchemaCollections(value)) return false;\n return isOptionalSchemaComposition(value);\n}\n\n/*** Validate a supported schema type or an array of supported types. */\nfunction isDataSchemaType(value: unknown): boolean {\n if (value === undefined) return true;\n if (typeof value === 'string') return DATA_SCHEMA_TYPES.has(value);\n return (\n Array.isArray(value) &&\n value.every((entry) => typeof entry === 'string' && DATA_SCHEMA_TYPES.has(entry))\n );\n}\n\n/*** Validate optional scalar schema constraints. */\nfunction isOptionalSchemaScalars(value: Record<string, unknown>): boolean {\n return (\n isOptionalString(value.title) &&\n isOptionalString(value.description) &&\n isOptionalString(value.format) &&\n (value.nullable === undefined || typeof value.nullable === 'boolean') &&\n (value.const === undefined || isSerializableValue(value.const)) &&\n (value.default === undefined || isSerializableValue(value.default)) &&\n (value.enum === undefined ||\n (Array.isArray(value.enum) && value.enum.every(isSerializableValue))) &&\n (value.ref === undefined || isDataSchemaRef(value.ref))\n );\n}\n\n/*** Validate optional schema properties, items and required fields. */\nfunction isOptionalSchemaCollections(value: Record<string, unknown>): boolean {\n return (\n (value.required === undefined || isStringArray(value.required)) &&\n (value.properties === undefined ||\n (isRecord(value.properties) && Object.values(value.properties).every(isDataSchema))) &&\n (value.additionalProperties === undefined ||\n typeof value.additionalProperties === 'boolean' ||\n isDataSchema(value.additionalProperties)) &&\n (value.items === undefined || isDataSchema(value.items))\n );\n}\n\n/*** Validate optional schema alternatives and intersections. */\nfunction isOptionalSchemaComposition(value: Record<string, unknown>): boolean {\n return ['allOf', 'anyOf', 'oneOf'].every((key) => {\n const entry = readOwnProperty(value, key);\n return entry === undefined || (Array.isArray(entry) && entry.every(isDataSchema));\n });\n}\n\n/*** Validate a named schema reference. */\nfunction isDataSchemaRef(value: unknown): boolean {\n return isRecord(value) && typeof value.id === 'string';\n}\n"]}
|
package/dist/data/index.d.ts
CHANGED
package/dist/data/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/data/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/data/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAClE,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC"}
|
package/dist/data/index.js
CHANGED
package/dist/data/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/data/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC","sourcesContent":["export * from './apis';\nexport * from './diagnostics';\nexport * from './endpoints';\nexport * from './ids';\nexport * from './operations';\nexport * from './refs';\nexport * from './schemas';\nexport * from './sources';\nexport * from './values';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/data/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAClE,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC","sourcesContent":["export * from './apis';\nexport { isDataSchema, isDataSchemaSlot } from './dataValidation';\nexport * from './diagnostics';\nexport * from './endpoints';\nexport * from './ids';\nexport * from './operations';\nexport * from './refs';\nexport * from './schemas';\nexport * from './sources';\nexport * from './values';\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export declare const STRUCTURE_DESCRIPTOR_COMPILER_VERSION = "6.0.3";
|
|
2
|
-
export declare const STRUCTURE_DESCRIPTOR_FINGERPRINT = "sha256:
|
|
2
|
+
export declare const STRUCTURE_DESCRIPTOR_FINGERPRINT = "sha256:b7ca4b8d272def84473d12a613a2f94362ab1bd0c7baa044f24493876c97e2d0";
|
|
3
3
|
export declare const STRUCTURE_DESCRIPTOR: {
|
|
4
4
|
readonly protocolVersion: 1;
|
|
5
5
|
readonly packageName: "@ankhorage/contracts";
|
|
6
|
-
readonly packageVersion: "24.
|
|
6
|
+
readonly packageVersion: "24.2.0";
|
|
7
7
|
readonly roots: {
|
|
8
8
|
readonly "auth-flow": "AuthFlowConfig";
|
|
9
9
|
readonly "auth-profile": "AuthProfileSpec";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export const STRUCTURE_DESCRIPTOR_COMPILER_VERSION = '6.0.3';
|
|
2
|
-
export const STRUCTURE_DESCRIPTOR_FINGERPRINT = 'sha256:
|
|
2
|
+
export const STRUCTURE_DESCRIPTOR_FINGERPRINT = 'sha256:b7ca4b8d272def84473d12a613a2f94362ab1bd0c7baa044f24493876c97e2d0';
|
|
3
3
|
export const STRUCTURE_DESCRIPTOR = {
|
|
4
4
|
"protocolVersion": 1,
|
|
5
5
|
"packageName": "@ankhorage/contracts",
|
|
6
|
-
"packageVersion": "24.
|
|
6
|
+
"packageVersion": "24.2.0",
|
|
7
7
|
"roots": {
|
|
8
8
|
"auth-flow": "AuthFlowConfig",
|
|
9
9
|
"auth-profile": "AuthProfileSpec",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generated.js","sourceRoot":"","sources":["../../src/structure/generated.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,qCAAqC,GAAG,OAAO,CAAC;AAC7D,MAAM,CAAC,MAAM,gCAAgC,GAAG,yEAAyE,CAAC;AAE1H,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,iBAAiB,EAAE,CAAC;IACpB,aAAa,EAAE,sBAAsB;IACrC,gBAAgB,EAAE,QAAQ;IAC1B,OAAO,EAAE;QACP,WAAW,EAAE,gBAAgB;QAC7B,cAAc,EAAE,iBAAiB;QACjC,cAAc,EAAE,gBAAgB;QAChC,cAAc,EAAE,gBAAgB;QAChC,iBAAiB,EAAE,oBAAoB;QACvC,qBAAqB,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Content":["/* This file is generated by @ankhorage/devtools. Do not edit manually. */\nimport type { StructureDescriptorDocument } from '@ankhorage/contracts/structure';\n\nexport const STRUCTURE_DESCRIPTOR_COMPILER_VERSION = '6.0.3';\nexport const STRUCTURE_DESCRIPTOR_FINGERPRINT = 'sha256:4d95249156452f1e72d19f5cf7fd097fbfdcb89b1e11b22b075bd285912502f0';\n\nexport const STRUCTURE_DESCRIPTOR = {\n \"protocolVersion\": 1,\n \"packageName\": \"@ankhorage/contracts\",\n \"packageVersion\": \"24.0.0\",\n \"roots\": {\n \"auth-flow\": \"AuthFlowConfig\",\n \"auth-profile\": \"AuthProfileSpec\",\n \"auth-sign-in\": \"AuthSignInSpec\",\n \"auth-sign-up\": \"AuthSignUpSpec\",\n \"screen-metadata\": \"ScreenMetadataSpec\",\n \"screen-requirements\": \"ScreenRequirements\",\n \"theme-config\": \"ThemeConfig\"\n },\n \"descriptors\": {\n \"AuthFlowConfig\": {\n \"id\": \"AuthFlowConfig\",\n \"descriptor\": {\n \"kind\": \"object\",\n \"fields\": {\n \"forgotPasswordRoute\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"optional\": true\n },\n \"otpRoute\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"optional\": true\n },\n \"postSignInRoute\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n }\n },\n \"signInRoute\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n }\n },\n \"signOutRoute\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"optional\": true\n },\n \"signUpRoute\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"optional\": true\n },\n \"unauthorizedRoute\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"optional\": true\n }\n }\n }\n },\n \"AuthProfileField\": {\n \"id\": \"AuthProfileField\",\n \"descriptor\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n }\n },\n \"AuthProfileSpec\": {\n \"id\": \"AuthProfileSpec\",\n \"descriptor\": {\n \"kind\": \"object\",\n \"fields\": {\n \"createStrategy\": {\n \"value\": {\n \"kind\": \"enum\",\n \"values\": [\n \"api\",\n \"app\",\n \"trigger\"\n ]\n },\n \"optional\": true\n },\n \"fields\": {\n \"value\": {\n \"kind\": \"ordered-list\",\n \"item\": {\n \"kind\": \"ref\",\n \"id\": \"AuthProfileField\"\n }\n }\n },\n \"primaryKey\": {\n \"value\": {\n \"kind\": \"enum\",\n \"values\": [\n \"authUserId\"\n ]\n },\n \"optional\": true\n },\n \"table\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"optional\": true\n },\n \"updateStrategy\": {\n \"value\": {\n \"kind\": \"enum\",\n \"values\": [\n \"api\",\n \"app\"\n ]\n },\n \"optional\": true\n }\n }\n }\n },\n \"AuthSignInSpec\": {\n \"id\": \"AuthSignInSpec\",\n \"descriptor\": {\n \"kind\": \"object\",\n \"fields\": {\n \"identifiers\": {\n \"value\": {\n \"kind\": \"ordered-list\",\n \"item\": {\n \"kind\": \"enum\",\n \"values\": [\n \"email\",\n \"phone\",\n \"username\"\n ]\n }\n }\n }\n }\n }\n },\n \"AuthSignUpField\": {\n \"id\": \"AuthSignUpField\",\n \"descriptor\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n }\n },\n \"AuthSignUpSpec\": {\n \"id\": \"AuthSignUpSpec\",\n \"descriptor\": {\n \"kind\": \"object\",\n \"fields\": {\n \"optionalFields\": {\n \"value\": {\n \"kind\": \"ordered-list\",\n \"item\": {\n \"kind\": \"ref\",\n \"id\": \"AuthSignUpField\"\n }\n },\n \"optional\": true\n },\n \"requiredFields\": {\n \"value\": {\n \"kind\": \"ordered-list\",\n \"item\": {\n \"kind\": \"ref\",\n \"id\": \"AuthSignUpField\"\n }\n }\n },\n \"signUpPolicy\": {\n \"value\": {\n \"kind\": \"enum\",\n \"values\": [\n \"autoSignIn\",\n \"requireVerification\"\n ]\n },\n \"optional\": true\n }\n }\n }\n },\n \"ScreenMetadataSpec\": {\n \"id\": \"ScreenMetadataSpec\",\n \"descriptor\": {\n \"kind\": \"object\",\n \"fields\": {\n \"description\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"optional\": true\n },\n \"id\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n }\n },\n \"name\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n }\n },\n \"title\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"optional\": true\n }\n }\n }\n },\n \"ScreenRequirements\": {\n \"id\": \"ScreenRequirements\",\n \"descriptor\": {\n \"kind\": \"object\",\n \"fields\": {\n \"capabilities\": {\n \"value\": {\n \"kind\": \"set\",\n \"member\": {\n \"kind\": \"enum\",\n \"values\": [\n \"barcodeScanner\",\n \"cameraPreview\",\n \"clipboard\",\n \"ebookReader\",\n \"filePicker\",\n \"location\",\n \"mediaPicker\",\n \"notifications\"\n ]\n }\n },\n \"optional\": true\n },\n \"permissions\": {\n \"value\": {\n \"kind\": \"set\",\n \"member\": {\n \"kind\": \"enum\",\n \"values\": [\n \"camera\",\n \"clipboard\",\n \"locationBackground\",\n \"locationForeground\",\n \"mediaLibrary\",\n \"mediaLibraryWrite\",\n \"microphone\",\n \"notifications\"\n ]\n }\n },\n \"optional\": true\n }\n }\n }\n },\n \"ThemeConfig\": {\n \"id\": \"ThemeConfig\",\n \"descriptor\": {\n \"kind\": \"object\",\n \"fields\": {\n \"dark\": {\n \"value\": {\n \"kind\": \"ref\",\n \"id\": \"ThemeModeConfig\"\n }\n },\n \"id\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n }\n },\n \"light\": {\n \"value\": {\n \"kind\": \"ref\",\n \"id\": \"ThemeModeConfig\"\n }\n },\n \"name\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n }\n },\n \"recipes\": {\n \"value\": {\n \"kind\": \"ref\",\n \"id\": \"ThemeRecipeOverrides\"\n },\n \"optional\": true\n },\n \"tokens\": {\n \"value\": {\n \"kind\": \"ref\",\n \"id\": \"ThemeGlobalTokenOverrides\"\n },\n \"optional\": true\n }\n }\n }\n },\n \"ThemeGlobalTokenOverrides\": {\n \"id\": \"ThemeGlobalTokenOverrides\",\n \"descriptor\": {\n \"kind\": \"object\",\n \"fields\": {\n \"radii\": {\n \"value\": {\n \"kind\": \"value-map\",\n \"key\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"number\"\n }\n },\n \"optional\": true\n },\n \"shadows\": {\n \"value\": {\n \"kind\": \"value-map\",\n \"key\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"number\"\n }\n },\n \"optional\": true\n },\n \"spacing\": {\n \"value\": {\n \"kind\": \"value-map\",\n \"key\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"number\"\n }\n },\n \"optional\": true\n },\n \"typography\": {\n \"value\": {\n \"kind\": \"ref\",\n \"id\": \"ThemeTypographyTokenOverrides\"\n },\n \"optional\": true\n }\n }\n }\n },\n \"ThemeModeConfig\": {\n \"id\": \"ThemeModeConfig\",\n \"descriptor\": {\n \"kind\": \"object\",\n \"fields\": {\n \"harmony\": {\n \"value\": {\n \"kind\": \"enum\",\n \"values\": [\n \"analogous\",\n \"complementary\",\n \"monochromatic\",\n \"splitComplementary\",\n \"square\",\n \"tetradic\",\n \"triadic\"\n ]\n }\n },\n \"primaryColor\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n }\n }\n }\n }\n },\n \"ThemeRecipeOverrides\": {\n \"id\": \"ThemeRecipeOverrides\",\n \"descriptor\": {\n \"kind\": \"object\",\n \"fields\": {\n \"components\": {\n \"value\": {\n \"kind\": \"value-map\",\n \"key\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"value\": {\n \"kind\": \"ref\",\n \"packageName\": \"typescript\",\n \"id\": \"Readonly\"\n }\n },\n \"optional\": true\n },\n \"patterns\": {\n \"value\": {\n \"kind\": \"value-map\",\n \"key\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"value\": {\n \"kind\": \"ref\",\n \"packageName\": \"typescript\",\n \"id\": \"Readonly\"\n }\n },\n \"optional\": true\n }\n }\n }\n },\n \"ThemeTypographyHeadingOverrides\": {\n \"id\": \"ThemeTypographyHeadingOverrides\",\n \"descriptor\": {\n \"kind\": \"object\",\n \"fields\": {\n \"lineHeight\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"number\"\n },\n \"optional\": true\n },\n \"size\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"number\"\n },\n \"optional\": true\n },\n \"weight\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"optional\": true\n }\n }\n }\n },\n \"ThemeTypographyTokenOverrides\": {\n \"id\": \"ThemeTypographyTokenOverrides\",\n \"descriptor\": {\n \"kind\": \"object\",\n \"fields\": {\n \"headings\": {\n \"value\": {\n \"kind\": \"value-map\",\n \"key\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"value\": {\n \"kind\": \"ref\",\n \"id\": \"ThemeTypographyHeadingOverrides\"\n }\n },\n \"optional\": true\n },\n \"sizes\": {\n \"value\": {\n \"kind\": \"value-map\",\n \"key\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"number\"\n }\n },\n \"optional\": true\n },\n \"weights\": {\n \"value\": {\n \"kind\": \"value-map\",\n \"key\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n }\n },\n \"optional\": true\n }\n }\n }\n }\n }\n} as const satisfies StructureDescriptorDocument;\n"]}
|
|
1
|
+
{"version":3,"file":"generated.js","sourceRoot":"","sources":["../../src/structure/generated.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,qCAAqC,GAAG,OAAO,CAAC;AAC7D,MAAM,CAAC,MAAM,gCAAgC,GAAG,yEAAyE,CAAC;AAE1H,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,iBAAiB,EAAE,CAAC;IACpB,aAAa,EAAE,sBAAsB;IACrC,gBAAgB,EAAE,QAAQ;IAC1B,OAAO,EAAE;QACP,WAAW,EAAE,gBAAgB;QAC7B,cAAc,EAAE,iBAAiB;QACjC,cAAc,EAAE,gBAAgB;QAChC,cAAc,EAAE,gBAAgB;QAChC,iBAAiB,EAAE,oBAAoB;QACvC,qBAAqB,EAAE,oBAAoB;QAC3C,cAAc,EAAE,aAAa;KAC9B;IACD,aAAa,EAAE;QACb,gBAAgB,EAAE;YAChB,IAAI,EAAE,gBAAgB;YACtB,YAAY,EAAE;gBACZ,MAAM,EAAE,QAAQ;gBAChB,QAAQ,EAAE;oBACR,qBAAqB,EAAE;wBACrB,OAAO,EAAE;4BACP,MAAM,EAAE,QAAQ;4BAChB,MAAM,EAAE,QAAQ;yBACjB;wBACD,UAAU,EAAE,IAAI;qBACjB;oBACD,UAAU,EAAE;wBACV,OAAO,EAAE;4BACP,MAAM,EAAE,QAAQ;4BAChB,MAAM,EAAE,QAAQ;yBACjB;wBACD,UAAU,EAAE,IAAI;qBACjB;oBACD,iBAAiB,EAAE;wBACjB,OAAO,EAAE;4BACP,MAAM,EAAE,QAAQ;4BAChB,MAAM,EAAE,QAAQ;yBACjB;qBACF;oBACD,aAAa,EAAE;wBACb,OAAO,EAAE;4BACP,MAAM,EAAE,QAAQ;4BAChB,MAAM,EAAE,QAAQ;yBACjB;qBACF;oBACD,cAAc,EAAE;wBACd,OAAO,EAAE;4BACP,MAAM,EAAE,QAAQ;4BAChB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E;wBACP,OAAO,EAAE;4BACP,MAAM,EAAE,WAAW;4BACnB,KAAK,EAAE;gCACL,MAAM,EAAE,QAAQ;gCAChB,MAAM,EAAE,QAAQ;6BACjB;4BACD,OAAO,EAAE;gCACP,MAAM,EAAE,QAAQ;gCAChB,MAAM,EAAE,QAAQ;6BACjB;yBACF;wBACD,UAAU,EAAE,IAAI;qBACjB;oBACD,SAAS,EAAE;wBACT,OAAO,EAAE;4BACP,MAAM,EAAE,WAAW;4BACnB,KAAK,EAAE;gCACL,MAAM,EAAE,QAAQ;gCAChB,MAAM,EAAE,QAAQ;6BACjB;4BACD,OAAO,EAAE;gCACP,MAAM,EAAE,QAAQ;gCAChB,MAAM,EAAE,QAAQ;6BACjB;yBACF;wBACD,UAAU,EAAE,IAAI;qBACjB;iBACF;aACF;SACF;KACF;CAC6C,CAAC","sourcesContent":["/* This file is generated by @ankhorage/devtools. Do not edit manually. */\nimport type { StructureDescriptorDocument } from '@ankhorage/contracts/structure';\n\nexport const STRUCTURE_DESCRIPTOR_COMPILER_VERSION = '6.0.3';\nexport const STRUCTURE_DESCRIPTOR_FINGERPRINT = 'sha256:b7ca4b8d272def84473d12a613a2f94362ab1bd0c7baa044f24493876c97e2d0';\n\nexport const STRUCTURE_DESCRIPTOR = {\n \"protocolVersion\": 1,\n \"packageName\": \"@ankhorage/contracts\",\n \"packageVersion\": \"24.2.0\",\n \"roots\": {\n \"auth-flow\": \"AuthFlowConfig\",\n \"auth-profile\": \"AuthProfileSpec\",\n \"auth-sign-in\": \"AuthSignInSpec\",\n \"auth-sign-up\": \"AuthSignUpSpec\",\n \"screen-metadata\": \"ScreenMetadataSpec\",\n \"screen-requirements\": \"ScreenRequirements\",\n \"theme-config\": \"ThemeConfig\"\n },\n \"descriptors\": {\n \"AuthFlowConfig\": {\n \"id\": \"AuthFlowConfig\",\n \"descriptor\": {\n \"kind\": \"object\",\n \"fields\": {\n \"forgotPasswordRoute\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"optional\": true\n },\n \"otpRoute\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"optional\": true\n },\n \"postSignInRoute\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n }\n },\n \"signInRoute\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n }\n },\n \"signOutRoute\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"optional\": true\n },\n \"signUpRoute\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"optional\": true\n },\n \"unauthorizedRoute\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"optional\": true\n }\n }\n }\n },\n \"AuthProfileField\": {\n \"id\": \"AuthProfileField\",\n \"descriptor\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n }\n },\n \"AuthProfileSpec\": {\n \"id\": \"AuthProfileSpec\",\n \"descriptor\": {\n \"kind\": \"object\",\n \"fields\": {\n \"createStrategy\": {\n \"value\": {\n \"kind\": \"enum\",\n \"values\": [\n \"api\",\n \"app\",\n \"trigger\"\n ]\n },\n \"optional\": true\n },\n \"fields\": {\n \"value\": {\n \"kind\": \"ordered-list\",\n \"item\": {\n \"kind\": \"ref\",\n \"id\": \"AuthProfileField\"\n }\n }\n },\n \"primaryKey\": {\n \"value\": {\n \"kind\": \"enum\",\n \"values\": [\n \"authUserId\"\n ]\n },\n \"optional\": true\n },\n \"table\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"optional\": true\n },\n \"updateStrategy\": {\n \"value\": {\n \"kind\": \"enum\",\n \"values\": [\n \"api\",\n \"app\"\n ]\n },\n \"optional\": true\n }\n }\n }\n },\n \"AuthSignInSpec\": {\n \"id\": \"AuthSignInSpec\",\n \"descriptor\": {\n \"kind\": \"object\",\n \"fields\": {\n \"identifiers\": {\n \"value\": {\n \"kind\": \"ordered-list\",\n \"item\": {\n \"kind\": \"enum\",\n \"values\": [\n \"email\",\n \"phone\",\n \"username\"\n ]\n }\n }\n }\n }\n }\n },\n \"AuthSignUpField\": {\n \"id\": \"AuthSignUpField\",\n \"descriptor\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n }\n },\n \"AuthSignUpSpec\": {\n \"id\": \"AuthSignUpSpec\",\n \"descriptor\": {\n \"kind\": \"object\",\n \"fields\": {\n \"optionalFields\": {\n \"value\": {\n \"kind\": \"ordered-list\",\n \"item\": {\n \"kind\": \"ref\",\n \"id\": \"AuthSignUpField\"\n }\n },\n \"optional\": true\n },\n \"requiredFields\": {\n \"value\": {\n \"kind\": \"ordered-list\",\n \"item\": {\n \"kind\": \"ref\",\n \"id\": \"AuthSignUpField\"\n }\n }\n },\n \"signUpPolicy\": {\n \"value\": {\n \"kind\": \"enum\",\n \"values\": [\n \"autoSignIn\",\n \"requireVerification\"\n ]\n },\n \"optional\": true\n }\n }\n }\n },\n \"ScreenMetadataSpec\": {\n \"id\": \"ScreenMetadataSpec\",\n \"descriptor\": {\n \"kind\": \"object\",\n \"fields\": {\n \"description\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"optional\": true\n },\n \"id\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n }\n },\n \"name\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n }\n },\n \"title\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"optional\": true\n }\n }\n }\n },\n \"ScreenRequirements\": {\n \"id\": \"ScreenRequirements\",\n \"descriptor\": {\n \"kind\": \"object\",\n \"fields\": {\n \"capabilities\": {\n \"value\": {\n \"kind\": \"set\",\n \"member\": {\n \"kind\": \"enum\",\n \"values\": [\n \"barcodeScanner\",\n \"cameraPreview\",\n \"clipboard\",\n \"ebookReader\",\n \"filePicker\",\n \"location\",\n \"mediaPicker\",\n \"notifications\"\n ]\n }\n },\n \"optional\": true\n },\n \"permissions\": {\n \"value\": {\n \"kind\": \"set\",\n \"member\": {\n \"kind\": \"enum\",\n \"values\": [\n \"camera\",\n \"clipboard\",\n \"locationBackground\",\n \"locationForeground\",\n \"mediaLibrary\",\n \"mediaLibraryWrite\",\n \"microphone\",\n \"notifications\"\n ]\n }\n },\n \"optional\": true\n }\n }\n }\n },\n \"ThemeConfig\": {\n \"id\": \"ThemeConfig\",\n \"descriptor\": {\n \"kind\": \"object\",\n \"fields\": {\n \"dark\": {\n \"value\": {\n \"kind\": \"ref\",\n \"id\": \"ThemeModeConfig\"\n }\n },\n \"id\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n }\n },\n \"light\": {\n \"value\": {\n \"kind\": \"ref\",\n \"id\": \"ThemeModeConfig\"\n }\n },\n \"name\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n }\n },\n \"recipes\": {\n \"value\": {\n \"kind\": \"ref\",\n \"id\": \"ThemeRecipeOverrides\"\n },\n \"optional\": true\n },\n \"tokens\": {\n \"value\": {\n \"kind\": \"ref\",\n \"id\": \"ThemeGlobalTokenOverrides\"\n },\n \"optional\": true\n }\n }\n }\n },\n \"ThemeGlobalTokenOverrides\": {\n \"id\": \"ThemeGlobalTokenOverrides\",\n \"descriptor\": {\n \"kind\": \"object\",\n \"fields\": {\n \"radii\": {\n \"value\": {\n \"kind\": \"value-map\",\n \"key\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"number\"\n }\n },\n \"optional\": true\n },\n \"shadows\": {\n \"value\": {\n \"kind\": \"value-map\",\n \"key\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"number\"\n }\n },\n \"optional\": true\n },\n \"spacing\": {\n \"value\": {\n \"kind\": \"value-map\",\n \"key\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"number\"\n }\n },\n \"optional\": true\n },\n \"typography\": {\n \"value\": {\n \"kind\": \"ref\",\n \"id\": \"ThemeTypographyTokenOverrides\"\n },\n \"optional\": true\n }\n }\n }\n },\n \"ThemeModeConfig\": {\n \"id\": \"ThemeModeConfig\",\n \"descriptor\": {\n \"kind\": \"object\",\n \"fields\": {\n \"harmony\": {\n \"value\": {\n \"kind\": \"enum\",\n \"values\": [\n \"analogous\",\n \"complementary\",\n \"monochromatic\",\n \"splitComplementary\",\n \"square\",\n \"tetradic\",\n \"triadic\"\n ]\n }\n },\n \"primaryColor\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n }\n }\n }\n }\n },\n \"ThemeRecipeOverrides\": {\n \"id\": \"ThemeRecipeOverrides\",\n \"descriptor\": {\n \"kind\": \"object\",\n \"fields\": {\n \"components\": {\n \"value\": {\n \"kind\": \"value-map\",\n \"key\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"value\": {\n \"kind\": \"ref\",\n \"packageName\": \"typescript\",\n \"id\": \"Readonly\"\n }\n },\n \"optional\": true\n },\n \"patterns\": {\n \"value\": {\n \"kind\": \"value-map\",\n \"key\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"value\": {\n \"kind\": \"ref\",\n \"packageName\": \"typescript\",\n \"id\": \"Readonly\"\n }\n },\n \"optional\": true\n }\n }\n }\n },\n \"ThemeTypographyHeadingOverrides\": {\n \"id\": \"ThemeTypographyHeadingOverrides\",\n \"descriptor\": {\n \"kind\": \"object\",\n \"fields\": {\n \"lineHeight\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"number\"\n },\n \"optional\": true\n },\n \"size\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"number\"\n },\n \"optional\": true\n },\n \"weight\": {\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"optional\": true\n }\n }\n }\n },\n \"ThemeTypographyTokenOverrides\": {\n \"id\": \"ThemeTypographyTokenOverrides\",\n \"descriptor\": {\n \"kind\": \"object\",\n \"fields\": {\n \"headings\": {\n \"value\": {\n \"kind\": \"value-map\",\n \"key\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"value\": {\n \"kind\": \"ref\",\n \"id\": \"ThemeTypographyHeadingOverrides\"\n }\n },\n \"optional\": true\n },\n \"sizes\": {\n \"value\": {\n \"kind\": \"value-map\",\n \"key\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"number\"\n }\n },\n \"optional\": true\n },\n \"weights\": {\n \"value\": {\n \"kind\": \"value-map\",\n \"key\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n },\n \"value\": {\n \"kind\": \"scalar\",\n \"type\": \"string\"\n }\n },\n \"optional\": true\n }\n }\n }\n }\n }\n} as const satisfies StructureDescriptorDocument;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/contracts",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.2.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"ankh": {
|
|
6
6
|
"category": "contracts",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"@ankhorage/utility": "^1.9.85"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@ankhorage/devtools": "^2.1.
|
|
51
|
-
"@ankhorage/paradox": "^0.
|
|
50
|
+
"@ankhorage/devtools": "^2.1.19",
|
|
51
|
+
"@ankhorage/paradox": "^0.3.1",
|
|
52
52
|
"@types/bun": "^1.4.2",
|
|
53
53
|
"@types/node": "^26.6.4",
|
|
54
54
|
"typescript": "^6.0.3"
|
package/src/capabilities.test.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { describe, expect, it } from 'bun:test';
|
|
2
2
|
|
|
3
3
|
import type { Capability } from './capabilities';
|
|
4
|
+
import {
|
|
5
|
+
areCapabilitiesEqual,
|
|
6
|
+
CAPABILITY_ACCESS,
|
|
7
|
+
CAPABILITY_BINDING_KINDS,
|
|
8
|
+
CAPABILITY_BINDING_ROLES,
|
|
9
|
+
isCapability,
|
|
10
|
+
isCapabilityId,
|
|
11
|
+
normalizeCapability,
|
|
12
|
+
} from './capabilities';
|
|
13
|
+
import { isDataSchema, isDataSchemaSlot } from './data';
|
|
4
14
|
|
|
5
15
|
const CAPABILITIES = [
|
|
6
16
|
{
|
|
@@ -83,10 +93,150 @@ const CAPABILITIES = [
|
|
|
83
93
|
},
|
|
84
94
|
},
|
|
85
95
|
},
|
|
96
|
+
{
|
|
97
|
+
id: 'storage.upload',
|
|
98
|
+
owner: '@ankhorage/storage',
|
|
99
|
+
access: ['invoke'],
|
|
100
|
+
binding: { kind: 'storage', bindableAs: [] },
|
|
101
|
+
label: 'Upload storage object',
|
|
102
|
+
},
|
|
86
103
|
] as const satisfies readonly Capability[];
|
|
87
104
|
|
|
88
|
-
describe('Capability', () => {
|
|
105
|
+
describe('Capability serialization', () => {
|
|
89
106
|
it('serializes bindable and executable package capabilities through one contract', () => {
|
|
90
107
|
expect(JSON.parse(JSON.stringify(CAPABILITIES))).toEqual(CAPABILITIES);
|
|
91
108
|
});
|
|
92
109
|
});
|
|
110
|
+
|
|
111
|
+
describe('Capability runtime API', () => {
|
|
112
|
+
it('exports the canonical runtime literals that derive the public contract unions', () => {
|
|
113
|
+
expect(CAPABILITY_ACCESS).toEqual(['emit', 'invoke', 'read', 'subscribe', 'write']);
|
|
114
|
+
expect(CAPABILITY_BINDING_KINDS).toEqual([
|
|
115
|
+
'action',
|
|
116
|
+
'api',
|
|
117
|
+
'auth',
|
|
118
|
+
'authorization',
|
|
119
|
+
'context',
|
|
120
|
+
'event',
|
|
121
|
+
'permission',
|
|
122
|
+
'state',
|
|
123
|
+
'storage',
|
|
124
|
+
]);
|
|
125
|
+
expect(CAPABILITY_BINDING_ROLES).toEqual(['source', 'target']);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it('validates canonical capability identifiers', () => {
|
|
129
|
+
expect(isCapabilityId('state.profile')).toBeTrue();
|
|
130
|
+
expect(isCapabilityId('api.catalog.product.create')).toBeTrue();
|
|
131
|
+
expect(isCapabilityId('state')).toBeFalse();
|
|
132
|
+
expect(isCapabilityId('state.')).toBeFalse();
|
|
133
|
+
expect(isCapabilityId('.state')).toBeFalse();
|
|
134
|
+
expect(isCapabilityId('state..profile')).toBeFalse();
|
|
135
|
+
expect(isCapabilityId(' .profile')).toBeFalse();
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it('publishes DataSchema and DataSchemaSlot validation for capability input and output', () => {
|
|
139
|
+
expect(isDataSchema({ type: 'object', properties: { id: { type: 'string' } } })).toBeTrue();
|
|
140
|
+
expect(isDataSchemaSlot({ schemaRef: { id: 'customer' } })).toBeTrue();
|
|
141
|
+
expect(isDataSchema({ type: 'date' })).toBeFalse();
|
|
142
|
+
expect(isDataSchemaSlot({ schema: { type: 'date' } })).toBeFalse();
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
it('validates complete capability descriptors through the shared schema validators', () => {
|
|
146
|
+
expect(isCapability(CAPABILITIES[3])).toBeTrue();
|
|
147
|
+
expect(isCapability(CAPABILITIES[6])).toBeTrue();
|
|
148
|
+
expect(
|
|
149
|
+
isCapability({
|
|
150
|
+
...CAPABILITIES[3],
|
|
151
|
+
binding: { kind: 'command', bindableAs: ['target'] },
|
|
152
|
+
}),
|
|
153
|
+
).toBeFalse();
|
|
154
|
+
expect(
|
|
155
|
+
isCapability({
|
|
156
|
+
...CAPABILITIES[3],
|
|
157
|
+
binding: { kind: 'api', bindableAs: ['bidirectional'] },
|
|
158
|
+
}),
|
|
159
|
+
).toBeFalse();
|
|
160
|
+
expect(isCapability({ ...CAPABILITIES[3], access: ['delete'] })).toBeFalse();
|
|
161
|
+
expect(isCapability({ ...CAPABILITIES[3], input: { schema: { type: 'date' } } })).toBeFalse();
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
describe('Capability canonical projection', () => {
|
|
166
|
+
it('projects accepted runtime capabilities to their canonical descriptor', () => {
|
|
167
|
+
const runtimeCapability = {
|
|
168
|
+
...CAPABILITIES[3],
|
|
169
|
+
access: ['invoke', 'invoke'],
|
|
170
|
+
binding: {
|
|
171
|
+
kind: 'api',
|
|
172
|
+
bindableAs: ['target', 'target'],
|
|
173
|
+
runtimeBindingMetadata: { generatedBy: 'runtime' },
|
|
174
|
+
},
|
|
175
|
+
label: undefined,
|
|
176
|
+
description: undefined,
|
|
177
|
+
runtimeMetadata: { transport: 'local' },
|
|
178
|
+
};
|
|
179
|
+
const canonicalCapability: Capability = {
|
|
180
|
+
id: 'api.catalog.product.create',
|
|
181
|
+
owner: '@ankhorage/api',
|
|
182
|
+
access: ['invoke'],
|
|
183
|
+
binding: { kind: 'api', bindableAs: ['target'] },
|
|
184
|
+
input: CAPABILITIES[3].input,
|
|
185
|
+
output: CAPABILITIES[3].output,
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
expect(isCapability(runtimeCapability)).toBeTrue();
|
|
189
|
+
expect(normalizeCapability(runtimeCapability)).toEqual(canonicalCapability);
|
|
190
|
+
expect(areCapabilitiesEqual(runtimeCapability, canonicalCapability)).toBeTrue();
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
describe('Capability canonicalization', () => {
|
|
195
|
+
it('normalizes unordered access and binding roles', () => {
|
|
196
|
+
const normalized = normalizeCapability({
|
|
197
|
+
...CAPABILITIES[0],
|
|
198
|
+
access: ['write', 'read', 'write', 'subscribe'],
|
|
199
|
+
binding: { kind: 'state', bindableAs: ['target', 'source', 'target'] },
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
expect(normalized.access).toEqual(['read', 'subscribe', 'write']);
|
|
203
|
+
expect(normalized.binding.bindableAs).toEqual(['source', 'target']);
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
it('preserves trusted-only storage capabilities without a generic UI binding role', () => {
|
|
207
|
+
const normalized = normalizeCapability({
|
|
208
|
+
...CAPABILITIES[6],
|
|
209
|
+
access: ['invoke', 'invoke'],
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
expect(normalized).toEqual(CAPABILITIES[6]);
|
|
213
|
+
expect(normalized.binding.bindableAs).toEqual([]);
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
it('compares normalized capability descriptors semantically', () => {
|
|
217
|
+
const equivalent: Capability = {
|
|
218
|
+
id: 'state.value',
|
|
219
|
+
owner: '@ankhorage/runtime',
|
|
220
|
+
access: ['read', 'subscribe', 'write'],
|
|
221
|
+
binding: { kind: 'state', bindableAs: ['source', 'target'] },
|
|
222
|
+
label: 'Runtime state value',
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
expect(
|
|
226
|
+
areCapabilitiesEqual(
|
|
227
|
+
normalizeCapability({
|
|
228
|
+
...CAPABILITIES[0],
|
|
229
|
+
access: ['write', 'read', 'write', 'subscribe'],
|
|
230
|
+
binding: { kind: 'state', bindableAs: ['target', 'source', 'target'] },
|
|
231
|
+
}),
|
|
232
|
+
equivalent,
|
|
233
|
+
),
|
|
234
|
+
).toBeTrue();
|
|
235
|
+
expect(
|
|
236
|
+
areCapabilitiesEqual(equivalent, {
|
|
237
|
+
...equivalent,
|
|
238
|
+
binding: { kind: 'event', bindableAs: ['source', 'target'] },
|
|
239
|
+
}),
|
|
240
|
+
).toBeFalse();
|
|
241
|
+
});
|
|
242
|
+
});
|
package/src/capabilities.ts
CHANGED
|
@@ -1,9 +1,34 @@
|
|
|
1
|
+
import { uniqueSortedStrings } from '@ankhorage/utility/array';
|
|
2
|
+
import { isRecord } from '@ankhorage/utility/object';
|
|
3
|
+
import { isNonEmptyString, isOptionalString } from '@ankhorage/utility/string';
|
|
4
|
+
|
|
5
|
+
import { isDataSchemaSlot } from './data/dataValidation';
|
|
1
6
|
import type { DataSchemaSlot } from './data/schemas';
|
|
2
7
|
|
|
3
|
-
|
|
4
|
-
|
|
8
|
+
/*** Enumerate the operations a capability exposes to other packages. */
|
|
9
|
+
export const CAPABILITY_ACCESS = ['emit', 'invoke', 'read', 'subscribe', 'write'] as const;
|
|
10
|
+
|
|
11
|
+
export type CapabilityAccess = (typeof CAPABILITY_ACCESS)[number];
|
|
12
|
+
|
|
13
|
+
/*** Enumerate the portable runtime families supported by capability bindings. */
|
|
14
|
+
export const CAPABILITY_BINDING_KINDS = [
|
|
15
|
+
'action',
|
|
16
|
+
'api',
|
|
17
|
+
'auth',
|
|
18
|
+
'authorization',
|
|
19
|
+
'context',
|
|
20
|
+
'event',
|
|
21
|
+
'permission',
|
|
22
|
+
'state',
|
|
23
|
+
'storage',
|
|
24
|
+
] as const;
|
|
25
|
+
|
|
26
|
+
export type CapabilityBindingKind = (typeof CAPABILITY_BINDING_KINDS)[number];
|
|
27
|
+
|
|
28
|
+
/*** Enumerate the directions in which a capability can participate in a binding. */
|
|
29
|
+
export const CAPABILITY_BINDING_ROLES = ['source', 'target'] as const;
|
|
5
30
|
|
|
6
|
-
export type CapabilityBindingRole =
|
|
31
|
+
export type CapabilityBindingRole = (typeof CAPABILITY_BINDING_ROLES)[number];
|
|
7
32
|
|
|
8
33
|
/**
|
|
9
34
|
* Portable description of one bindable or executable Ankhorage capability.
|
|
@@ -15,7 +40,7 @@ export type CapabilityBindingRole = 'source' | 'target';
|
|
|
15
40
|
export interface Capability {
|
|
16
41
|
readonly id: `${string}.${string}`;
|
|
17
42
|
readonly owner: string;
|
|
18
|
-
readonly access: readonly
|
|
43
|
+
readonly access: readonly CapabilityAccess[];
|
|
19
44
|
readonly binding: {
|
|
20
45
|
readonly kind: CapabilityBindingKind;
|
|
21
46
|
readonly bindableAs: readonly CapabilityBindingRole[];
|
|
@@ -25,3 +50,137 @@ export interface Capability {
|
|
|
25
50
|
readonly input?: DataSchemaSlot;
|
|
26
51
|
readonly output?: DataSchemaSlot;
|
|
27
52
|
}
|
|
53
|
+
|
|
54
|
+
/*** Validate a stable dot-separated identifier for one capability. */
|
|
55
|
+
export function isCapabilityId(value: unknown): value is Capability['id'] {
|
|
56
|
+
return (
|
|
57
|
+
isNonEmptyString(value) &&
|
|
58
|
+
value.split('.').length >= 2 &&
|
|
59
|
+
value.split('.').every(isNonEmptyString)
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/*** Validate an untrusted value as one complete portable capability descriptor. */
|
|
64
|
+
export function isCapability(value: unknown): value is Capability {
|
|
65
|
+
return (
|
|
66
|
+
isRecord(value) &&
|
|
67
|
+
isCapabilityId(value.id) &&
|
|
68
|
+
isNonEmptyString(value.owner) &&
|
|
69
|
+
isCapabilityAccessList(value.access) &&
|
|
70
|
+
isCapabilityBinding(value.binding) &&
|
|
71
|
+
isOptionalString(value.label) &&
|
|
72
|
+
isOptionalString(value.description) &&
|
|
73
|
+
(value.input === undefined || isDataSchemaSlot(value.input)) &&
|
|
74
|
+
(value.output === undefined || isDataSchemaSlot(value.output))
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/*** Return a capability with access and binding-role collections sorted and deduplicated. */
|
|
79
|
+
export function normalizeCapability(capability: Capability): Capability {
|
|
80
|
+
return {
|
|
81
|
+
id: capability.id,
|
|
82
|
+
owner: capability.owner,
|
|
83
|
+
access: normalizeCapabilityAccess(capability.access),
|
|
84
|
+
binding: {
|
|
85
|
+
kind: capability.binding.kind,
|
|
86
|
+
bindableAs: normalizeCapabilityBindingRoles(capability.binding.bindableAs),
|
|
87
|
+
},
|
|
88
|
+
...(capability.label === undefined ? {} : { label: capability.label }),
|
|
89
|
+
...(capability.description === undefined ? {} : { description: capability.description }),
|
|
90
|
+
...(capability.input === undefined ? {} : { input: capability.input }),
|
|
91
|
+
...(capability.output === undefined ? {} : { output: capability.output }),
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/*** Compare capability descriptors independent of object property and unordered collection ordering. */
|
|
96
|
+
export function areCapabilitiesEqual(left: Capability, right: Capability): boolean {
|
|
97
|
+
return areCapabilityValuesEqual(normalizeCapability(left), normalizeCapability(right));
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/*** Validate a non-empty collection of supported capability access operations. */
|
|
101
|
+
function isCapabilityAccessList(value: unknown): value is readonly CapabilityAccess[] {
|
|
102
|
+
return (
|
|
103
|
+
Array.isArray(value) && value.length > 0 && value.every((entry) => isCapabilityAccess(entry))
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/*** Validate a portable capability binding descriptor. */
|
|
108
|
+
function isCapabilityBinding(value: unknown): value is Capability['binding'] {
|
|
109
|
+
return (
|
|
110
|
+
isRecord(value) &&
|
|
111
|
+
isCapabilityBindingKind(value.kind) &&
|
|
112
|
+
Array.isArray(value.bindableAs) &&
|
|
113
|
+
value.bindableAs.every((entry) => isCapabilityBindingRole(entry))
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/*** Validate one supported capability access operation. */
|
|
118
|
+
function isCapabilityAccess(value: unknown): value is CapabilityAccess {
|
|
119
|
+
return typeof value === 'string' && CAPABILITY_ACCESS.some((access) => access === value);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/*** Validate one supported capability binding family. */
|
|
123
|
+
function isCapabilityBindingKind(value: unknown): value is CapabilityBindingKind {
|
|
124
|
+
return (
|
|
125
|
+
typeof value === 'string' &&
|
|
126
|
+
CAPABILITY_BINDING_KINDS.some((bindingKind) => bindingKind === value)
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/*** Validate one supported capability binding direction. */
|
|
131
|
+
function isCapabilityBindingRole(value: unknown): value is CapabilityBindingRole {
|
|
132
|
+
return (
|
|
133
|
+
typeof value === 'string' &&
|
|
134
|
+
CAPABILITY_BINDING_ROLES.some((bindingRole) => bindingRole === value)
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/*** Sort and deduplicate supported access operations using the canonical Utility collection helper. */
|
|
139
|
+
function normalizeCapabilityAccess(
|
|
140
|
+
access: readonly CapabilityAccess[],
|
|
141
|
+
): readonly CapabilityAccess[] {
|
|
142
|
+
return uniqueSortedStrings(access).filter(isCapabilityAccess);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/*** Sort and deduplicate supported binding directions using the canonical Utility collection helper. */
|
|
146
|
+
function normalizeCapabilityBindingRoles(
|
|
147
|
+
bindingRoles: readonly CapabilityBindingRole[],
|
|
148
|
+
): readonly CapabilityBindingRole[] {
|
|
149
|
+
return uniqueSortedStrings(bindingRoles).filter(isCapabilityBindingRole);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/*** Compare the serializable values contained by two normalized capability descriptors. */
|
|
153
|
+
function areCapabilityValuesEqual(left: unknown, right: unknown): boolean {
|
|
154
|
+
if (Object.is(left, right)) return true;
|
|
155
|
+
if (Array.isArray(left) || Array.isArray(right)) return areCapabilityArraysEqual(left, right);
|
|
156
|
+
if (isRecord(left) && isRecord(right)) return areCapabilityRecordsEqual(left, right);
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/*** Compare two serializable arrays in their authored order. */
|
|
161
|
+
function areCapabilityArraysEqual(left: unknown, right: unknown): boolean {
|
|
162
|
+
return (
|
|
163
|
+
Array.isArray(left) &&
|
|
164
|
+
Array.isArray(right) &&
|
|
165
|
+
left.length === right.length &&
|
|
166
|
+
left.every((value, index) => areCapabilityValuesEqual(value, right.at(index)))
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/*** Compare two serializable records independent of their authored property order. */
|
|
171
|
+
function areCapabilityRecordsEqual(
|
|
172
|
+
left: Record<string, unknown>,
|
|
173
|
+
right: Record<string, unknown>,
|
|
174
|
+
): boolean {
|
|
175
|
+
const leftEntries = Object.entries(left);
|
|
176
|
+
const rightEntries = Object.entries(right);
|
|
177
|
+
return (
|
|
178
|
+
leftEntries.length === rightEntries.length &&
|
|
179
|
+
leftEntries.every(([leftKey, leftValue]) =>
|
|
180
|
+
rightEntries.some(
|
|
181
|
+
([rightKey, rightValue]) =>
|
|
182
|
+
leftKey === rightKey && areCapabilityValuesEqual(leftValue, rightValue),
|
|
183
|
+
),
|
|
184
|
+
)
|
|
185
|
+
);
|
|
186
|
+
}
|
|
@@ -3,6 +3,7 @@ import { isRecord, readOwnProperty } from '@ankhorage/utility/object';
|
|
|
3
3
|
import { isOptionalString } from '@ankhorage/utility/string';
|
|
4
4
|
|
|
5
5
|
import { isSerializableValue } from '../serializable';
|
|
6
|
+
import type { DataSchema, DataSchemaSlot } from './schemas';
|
|
6
7
|
|
|
7
8
|
const DATA_SCHEMA_TYPES = new Set([
|
|
8
9
|
'array',
|
|
@@ -144,16 +145,17 @@ function isDataOperationResponse(value: unknown): boolean {
|
|
|
144
145
|
);
|
|
145
146
|
}
|
|
146
147
|
|
|
147
|
-
/*** Validate inline schema
|
|
148
|
-
function isDataSchemaSlot(value:
|
|
148
|
+
/*** Validate an inline schema or named schema-reference slot. */
|
|
149
|
+
export function isDataSchemaSlot(value: unknown): value is DataSchemaSlot {
|
|
149
150
|
return (
|
|
151
|
+
isRecord(value) &&
|
|
150
152
|
(value.schema === undefined || isDataSchema(value.schema)) &&
|
|
151
153
|
(value.schemaRef === undefined || isDataSchemaRef(value.schemaRef))
|
|
152
154
|
);
|
|
153
155
|
}
|
|
154
156
|
|
|
155
157
|
/*** Validate supported schema types, constraints and compositions. */
|
|
156
|
-
function isDataSchema(value: unknown):
|
|
158
|
+
export function isDataSchema(value: unknown): value is DataSchema {
|
|
157
159
|
if (!isRecord(value) || !isDataSchemaType(value.type)) return false;
|
|
158
160
|
if (!isOptionalSchemaScalars(value)) return false;
|
|
159
161
|
if (!isOptionalSchemaCollections(value)) return false;
|
package/src/data/index.ts
CHANGED
|
@@ -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:b7ca4b8d272def84473d12a613a2f94362ab1bd0c7baa044f24493876c97e2d0';
|
|
6
6
|
|
|
7
7
|
export const STRUCTURE_DESCRIPTOR = {
|
|
8
8
|
"protocolVersion": 1,
|
|
9
9
|
"packageName": "@ankhorage/contracts",
|
|
10
|
-
"packageVersion": "24.
|
|
10
|
+
"packageVersion": "24.2.0",
|
|
11
11
|
"roots": {
|
|
12
12
|
"auth-flow": "AuthFlowConfig",
|
|
13
13
|
"auth-profile": "AuthProfileSpec",
|