@ankhorage/contracts 1.18.2 → 1.19.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 +45 -0
- package/dist/bindings.d.ts +14 -0
- package/dist/bindings.d.ts.map +1 -1
- package/dist/bindings.js.map +1 -1
- package/dist/cli.d.ts +23 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +2 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +3 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +5 -1
- package/src/bindings.test.ts +36 -0
- package/src/bindings.ts +19 -0
- package/src/cli.test.ts +88 -0
- package/src/cli.ts +27 -0
- package/src/contracts.test.ts +72 -1
- package/src/index.ts +1 -0
- package/src/types.ts +7 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ankhorage/contracts
|
|
2
2
|
|
|
3
|
+
## 1.19.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b618979: Add `@ankhorage/contracts/cli` metadata contracts for Ankh package discovery.
|
|
8
|
+
|
|
9
|
+
## 1.18.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- eae9dfc: Add typed screen data-loader definitions for generic operation loaders and support repeat empty-state nodes on UI repeats.
|
|
14
|
+
|
|
3
15
|
## 1.18.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -22,6 +22,7 @@ Shared public contracts for Ankhorage packages and standalone provider packages.
|
|
|
22
22
|
```ts
|
|
23
23
|
import type { AppManifest } from '@ankhorage/contracts';
|
|
24
24
|
import type { AuthAdapter } from '@ankhorage/contracts/auth';
|
|
25
|
+
import type { AnkhCommandProviderManifest, AnkhPackageMetadata } from '@ankhorage/contracts/cli';
|
|
25
26
|
import type { DbAdapter } from '@ankhorage/contracts/db';
|
|
26
27
|
import type { StorageAdapter } from '@ankhorage/contracts/storage';
|
|
27
28
|
```
|
|
@@ -71,6 +72,50 @@ export function createSupabaseAuthAdapter(): AuthAdapter {
|
|
|
71
72
|
}
|
|
72
73
|
```
|
|
73
74
|
|
|
75
|
+
## CLI discovery contracts
|
|
76
|
+
|
|
77
|
+
`@ankhorage/contracts/cli` contains metadata-only discovery contracts for Ankh
|
|
78
|
+
packages and command providers.
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
import type { AnkhCommandProviderManifest, AnkhPackageMetadata } from '@ankhorage/contracts/cli';
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Provider packages expose `package.json.ankh` metadata using a package-relative
|
|
85
|
+
provider module path:
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"ankh": {
|
|
90
|
+
"category": "infra",
|
|
91
|
+
"provider": "./dist/ankh.provider.js",
|
|
92
|
+
"capabilities": ["infra.up", "infra.status"]
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Metadata-only packages use `null` for `provider`:
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"ankh": {
|
|
102
|
+
"category": "contracts",
|
|
103
|
+
"provider": null,
|
|
104
|
+
"capabilities": ["contracts.cli"]
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Command descriptor paths are relative to the provider category:
|
|
110
|
+
|
|
111
|
+
- `category: "infra"` with `path: ["up"]` maps to `ankh infra up`
|
|
112
|
+
- `category: "dev"` with `path: ["android", "scan"]` maps to `ankh dev android scan`
|
|
113
|
+
|
|
114
|
+
This subpath contains contracts only. It must not depend on `commander`,
|
|
115
|
+
`@ankhorage/ankh`, provider implementations, or runtime CLI execution logic.
|
|
116
|
+
Concrete `package.json.ankh` adoption for this package is deferred to
|
|
117
|
+
`contracts#84`.
|
|
118
|
+
|
|
74
119
|
## Profile contract
|
|
75
120
|
|
|
76
121
|
Auth providers own identity records. App-facing profile data should be modeled separately, usually in an app table such as `profiles`.
|
package/dist/bindings.d.ts
CHANGED
|
@@ -65,6 +65,20 @@ export type BindingInputValue = {
|
|
|
65
65
|
readonly transforms?: readonly BindingValueTransform[];
|
|
66
66
|
};
|
|
67
67
|
export type BindingInputMap = Readonly<Record<string, BindingInputValue>>;
|
|
68
|
+
export interface ApiScreenDataLoaderDefinition {
|
|
69
|
+
readonly kind: 'api';
|
|
70
|
+
readonly apiId: string;
|
|
71
|
+
readonly mode: 'byId' | 'list' | 'one' | 'random';
|
|
72
|
+
readonly targetPath: string;
|
|
73
|
+
readonly id?: string | number;
|
|
74
|
+
}
|
|
75
|
+
export interface OperationScreenDataLoaderDefinition {
|
|
76
|
+
readonly kind: 'operation';
|
|
77
|
+
readonly id?: string;
|
|
78
|
+
readonly operation: BindingOperationRef;
|
|
79
|
+
readonly input?: BindingInputMap;
|
|
80
|
+
}
|
|
81
|
+
export type ScreenDataLoaderDefinition = ApiScreenDataLoaderDefinition | OperationScreenDataLoaderDefinition;
|
|
68
82
|
export type BindingConditionOperator = 'eq' | 'exists' | 'neq' | 'notExists';
|
|
69
83
|
export interface BindingCondition {
|
|
70
84
|
readonly source: BindingValueSource;
|
package/dist/bindings.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bindings.d.ts","sourceRoot":"","sources":["../src/bindings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAEpE,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC;AACzC,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC;AAErC,MAAM,MAAM,YAAY,GACpB,MAAM,GACN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WAAW,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAC;CACzC,CAAC;AAEN,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;IACpC,QAAQ,CAAC,KAAK,CAAC,EAAE,eAAe,CAAC;IACjC,QAAQ,CAAC,IAAI,CAAC,EAAE,gBAAgB,CAAC;CAClC;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAC;IAC1C,QAAQ,CAAC,aAAa,CAAC,EAAE,eAAe,CAAC;IACzC,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;IACvD,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,CAAC,CAAC,CAAC;CACrE;AAED,MAAM,MAAM,4BAA4B,GAAG,QAAQ,CACjD,MAAM,CAAC,mBAAmB,EAAE,oBAAoB,CAAC,CAClD,CAAC"}
|
package/dist/bindings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bindings.js","sourceRoot":"","sources":["../src/bindings.ts"],"names":[],"mappings":"","sourcesContent":["import type { DataSourceId, EndpointId, OperationId } from './data';\n\nexport type ComponentInstanceId = string;\nexport type ComponentTypeId = string;\n\nexport type BindingValue =\n | string\n | number\n | boolean\n | null\n | readonly BindingValue[]\n | {\n readonly [key: string]: BindingValue;\n };\n\nexport type BindingDataPath = string;\n\nexport type BindingValueTransform = 'lowercase' | 'trim' | 'uppercase';\n\nexport interface BindingOperationRef {\n readonly dataSourceId: DataSourceId;\n readonly operationId: OperationId;\n readonly endpointId?: EndpointId;\n}\n\nexport type BindingValueSource =\n | {\n readonly kind: 'context';\n readonly path: BindingDataPath;\n }\n | {\n readonly kind: 'event';\n readonly path: BindingDataPath;\n }\n | {\n readonly kind: 'literal';\n readonly value: BindingValue;\n }\n | {\n readonly kind: 'operation';\n readonly operation: BindingOperationRef;\n readonly path?: BindingDataPath;\n }\n | {\n readonly kind: 'state';\n readonly path: BindingDataPath;\n };\n\nexport interface BindingValueExpression {\n readonly source: BindingValueSource;\n readonly transforms?: readonly BindingValueTransform[];\n}\n\nexport interface BindingFallback {\n readonly value?: BindingValue;\n readonly source?: BindingValueSource;\n}\n\nexport type BindingLifecycleState = 'empty' | 'error' | 'loading';\n\nexport interface BindingLifecycleBehavior {\n readonly state: BindingLifecycleState;\n readonly fallback?: BindingFallback;\n readonly message?: string;\n}\n\nexport interface PropBinding {\n readonly source: BindingValueSource;\n readonly fallback?: BindingFallback;\n readonly loading?: BindingLifecycleBehavior;\n readonly error?: BindingLifecycleBehavior;\n readonly empty?: BindingLifecycleBehavior;\n readonly transforms?: readonly BindingValueTransform[];\n}\n\nexport type BindingInputValue =\n | {\n readonly kind: 'array';\n readonly items: readonly BindingInputValue[];\n }\n | {\n readonly kind: 'literal';\n readonly value: BindingValue;\n }\n | {\n readonly kind: 'object';\n readonly fields: Readonly<Record<string, BindingInputValue>>;\n }\n | {\n readonly kind: 'source';\n readonly source: BindingValueSource;\n readonly transforms?: readonly BindingValueTransform[];\n };\n\nexport type BindingInputMap = Readonly<Record<string, BindingInputValue>>;\n\nexport type BindingConditionOperator = 'eq' | 'exists' | 'neq' | 'notExists';\n\nexport interface BindingCondition {\n readonly source: BindingValueSource;\n readonly operator: BindingConditionOperator;\n readonly value?: BindingValue;\n}\n\nexport type EventBindingTarget =\n | {\n readonly kind: 'action';\n readonly type: string;\n }\n | {\n readonly kind: 'operation';\n readonly operation: BindingOperationRef;\n };\n\nexport interface EventBinding {\n readonly target: EventBindingTarget;\n readonly input?: BindingInputMap;\n readonly when?: BindingCondition;\n}\n\nexport interface ComponentDataBinding {\n readonly componentId: ComponentInstanceId;\n readonly componentType?: ComponentTypeId;\n readonly props?: Readonly<Record<string, PropBinding>>;\n readonly events?: Readonly<Record<string, readonly EventBinding[]>>;\n}\n\nexport type ComponentDataBindingRegistry = Readonly<\n Record<ComponentInstanceId, ComponentDataBinding>\n>;\n"]}
|
|
1
|
+
{"version":3,"file":"bindings.js","sourceRoot":"","sources":["../src/bindings.ts"],"names":[],"mappings":"","sourcesContent":["import type { DataSourceId, EndpointId, OperationId } from './data';\n\nexport type ComponentInstanceId = string;\nexport type ComponentTypeId = string;\n\nexport type BindingValue =\n | string\n | number\n | boolean\n | null\n | readonly BindingValue[]\n | {\n readonly [key: string]: BindingValue;\n };\n\nexport type BindingDataPath = string;\n\nexport type BindingValueTransform = 'lowercase' | 'trim' | 'uppercase';\n\nexport interface BindingOperationRef {\n readonly dataSourceId: DataSourceId;\n readonly operationId: OperationId;\n readonly endpointId?: EndpointId;\n}\n\nexport type BindingValueSource =\n | {\n readonly kind: 'context';\n readonly path: BindingDataPath;\n }\n | {\n readonly kind: 'event';\n readonly path: BindingDataPath;\n }\n | {\n readonly kind: 'literal';\n readonly value: BindingValue;\n }\n | {\n readonly kind: 'operation';\n readonly operation: BindingOperationRef;\n readonly path?: BindingDataPath;\n }\n | {\n readonly kind: 'state';\n readonly path: BindingDataPath;\n };\n\nexport interface BindingValueExpression {\n readonly source: BindingValueSource;\n readonly transforms?: readonly BindingValueTransform[];\n}\n\nexport interface BindingFallback {\n readonly value?: BindingValue;\n readonly source?: BindingValueSource;\n}\n\nexport type BindingLifecycleState = 'empty' | 'error' | 'loading';\n\nexport interface BindingLifecycleBehavior {\n readonly state: BindingLifecycleState;\n readonly fallback?: BindingFallback;\n readonly message?: string;\n}\n\nexport interface PropBinding {\n readonly source: BindingValueSource;\n readonly fallback?: BindingFallback;\n readonly loading?: BindingLifecycleBehavior;\n readonly error?: BindingLifecycleBehavior;\n readonly empty?: BindingLifecycleBehavior;\n readonly transforms?: readonly BindingValueTransform[];\n}\n\nexport type BindingInputValue =\n | {\n readonly kind: 'array';\n readonly items: readonly BindingInputValue[];\n }\n | {\n readonly kind: 'literal';\n readonly value: BindingValue;\n }\n | {\n readonly kind: 'object';\n readonly fields: Readonly<Record<string, BindingInputValue>>;\n }\n | {\n readonly kind: 'source';\n readonly source: BindingValueSource;\n readonly transforms?: readonly BindingValueTransform[];\n };\n\nexport type BindingInputMap = Readonly<Record<string, BindingInputValue>>;\n\nexport interface ApiScreenDataLoaderDefinition {\n readonly kind: 'api';\n readonly apiId: string;\n readonly mode: 'byId' | 'list' | 'one' | 'random';\n readonly targetPath: string;\n readonly id?: string | number;\n}\n\nexport interface OperationScreenDataLoaderDefinition {\n readonly kind: 'operation';\n readonly id?: string;\n readonly operation: BindingOperationRef;\n readonly input?: BindingInputMap;\n}\n\nexport type ScreenDataLoaderDefinition =\n | ApiScreenDataLoaderDefinition\n | OperationScreenDataLoaderDefinition;\n\nexport type BindingConditionOperator = 'eq' | 'exists' | 'neq' | 'notExists';\n\nexport interface BindingCondition {\n readonly source: BindingValueSource;\n readonly operator: BindingConditionOperator;\n readonly value?: BindingValue;\n}\n\nexport type EventBindingTarget =\n | {\n readonly kind: 'action';\n readonly type: string;\n }\n | {\n readonly kind: 'operation';\n readonly operation: BindingOperationRef;\n };\n\nexport interface EventBinding {\n readonly target: EventBindingTarget;\n readonly input?: BindingInputMap;\n readonly when?: BindingCondition;\n}\n\nexport interface ComponentDataBinding {\n readonly componentId: ComponentInstanceId;\n readonly componentType?: ComponentTypeId;\n readonly props?: Readonly<Record<string, PropBinding>>;\n readonly events?: Readonly<Record<string, readonly EventBinding[]>>;\n}\n\nexport type ComponentDataBindingRegistry = Readonly<\n Record<ComponentInstanceId, ComponentDataBinding>\n>;\n"]}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type AnkhCommandCategory = string;
|
|
2
|
+
export type AnkhProviderReference = `./${string}`;
|
|
3
|
+
export type AnkhCapabilityId = `${string}.${string}`;
|
|
4
|
+
export interface AnkhCommandDescriptor {
|
|
5
|
+
readonly path: readonly [string, ...string[]];
|
|
6
|
+
readonly summary: string;
|
|
7
|
+
readonly capability: AnkhCapabilityId;
|
|
8
|
+
readonly aliases?: readonly string[];
|
|
9
|
+
readonly examples?: readonly string[];
|
|
10
|
+
}
|
|
11
|
+
export interface AnkhCommandProviderManifest {
|
|
12
|
+
readonly id: string;
|
|
13
|
+
readonly category: AnkhCommandCategory;
|
|
14
|
+
readonly version: string;
|
|
15
|
+
readonly capabilities: readonly AnkhCapabilityId[];
|
|
16
|
+
readonly commands: readonly AnkhCommandDescriptor[];
|
|
17
|
+
}
|
|
18
|
+
export interface AnkhPackageMetadata {
|
|
19
|
+
readonly category: AnkhCommandCategory;
|
|
20
|
+
readonly provider: AnkhProviderReference | null;
|
|
21
|
+
readonly capabilities: readonly AnkhCapabilityId[];
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAEzC,MAAM,MAAM,qBAAqB,GAAG,KAAK,MAAM,EAAE,CAAC;AAElD,MAAM,MAAM,gBAAgB,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;AAErD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;IAC9C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;IACtC,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,YAAY,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACnD,QAAQ,CAAC,QAAQ,EAAE,SAAS,qBAAqB,EAAE,CAAC;CACrD;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC;IACvC,QAAQ,CAAC,QAAQ,EAAE,qBAAqB,GAAG,IAAI,CAAC;IAChD,QAAQ,CAAC,YAAY,EAAE,SAAS,gBAAgB,EAAE,CAAC;CACpD"}
|
package/dist/cli.js
ADDED
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"","sourcesContent":["export type AnkhCommandCategory = string;\n\nexport type AnkhProviderReference = `./${string}`;\n\nexport type AnkhCapabilityId = `${string}.${string}`;\n\nexport interface AnkhCommandDescriptor {\n readonly path: readonly [string, ...string[]];\n readonly summary: string;\n readonly capability: AnkhCapabilityId;\n readonly aliases?: readonly string[];\n readonly examples?: readonly string[];\n}\n\nexport interface AnkhCommandProviderManifest {\n readonly id: string;\n readonly category: AnkhCommandCategory;\n readonly version: string;\n readonly capabilities: readonly AnkhCapabilityId[];\n readonly commands: readonly AnkhCommandDescriptor[];\n}\n\nexport interface AnkhPackageMetadata {\n readonly category: AnkhCommandCategory;\n readonly provider: AnkhProviderReference | null;\n readonly capabilities: readonly AnkhCapabilityId[];\n}\n"]}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,MAAM,CAAC;AACrB,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,MAAM,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,MAAM,CAAC;AACrB,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,MAAM,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,MAAM,CAAC;AACrB,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,MAAM,CAAC","sourcesContent":["export * from './auth';\nexport * from './bindings';\nexport * from './data';\nexport * from './db';\nexport * from './nutrition';\nexport * from './requirements';\nexport * from './state';\nexport * from './storage';\nexport * from './types';\nexport * from './ui';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,MAAM,CAAC;AACrB,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,MAAM,CAAC","sourcesContent":["export * from './auth';\nexport * from './bindings';\nexport * from './cli';\nexport * from './data';\nexport * from './db';\nexport * from './nutrition';\nexport * from './requirements';\nexport * from './state';\nexport * from './storage';\nexport * from './types';\nexport * from './ui';\n"]}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ColorHarmony } from '@ankhorage/color-theory';
|
|
2
2
|
import type { AuthFlowConfig, AuthIdentifierKind, AuthOAuthConfig, AuthSignUpField } from './auth';
|
|
3
|
-
import type { BindingValueSource, ComponentDataBindingRegistry } from './bindings';
|
|
3
|
+
import type { BindingValueSource, ComponentDataBindingRegistry, ScreenDataLoaderDefinition } from './bindings';
|
|
4
4
|
import type { AppDataManifest, DataSourceRegistry } from './data';
|
|
5
5
|
import type { ScreenRequirements } from './requirements';
|
|
6
6
|
export interface ThemeModeConfig {
|
|
@@ -128,6 +128,7 @@ export interface UiNodeRepeatSpec {
|
|
|
128
128
|
source: BindingValueSource;
|
|
129
129
|
itemAlias?: string;
|
|
130
130
|
keyPath?: string;
|
|
131
|
+
empty?: readonly UiNode[];
|
|
131
132
|
}
|
|
132
133
|
export interface UiNode {
|
|
133
134
|
id: string;
|
|
@@ -144,6 +145,7 @@ export interface ScreenSpec {
|
|
|
144
145
|
title?: string;
|
|
145
146
|
description?: string;
|
|
146
147
|
root: UiNode;
|
|
148
|
+
dataLoaders?: readonly ScreenDataLoaderDefinition[];
|
|
147
149
|
requires?: ScreenRequirements;
|
|
148
150
|
}
|
|
149
151
|
export interface NavigatorSpec {
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,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AI,EAAE,IAAI,CAAU,CAAC;AAG/D,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAAQ,CAAU,CAAC;AAInD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAU,CAAC;AAGxF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,CAAU,CAAC;AAGrD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAU,CAAC;AAG3D,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAU,CAAC;AAGrE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,UAAU,CAAU,CAAC;AAIpD,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAU,CAAC;AAGhF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,YAAY,EAAE,qBAAqB,CAAU,CAAC;AAGpF,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,GAAG,wBAAwB;IAC3B,WAAW;IACX,UAAU;IACV,aAAa;IACb,WAAW;CACH,CAAC;AAIX,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC,YAAY,CAAU,CAAC;AAG3E,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,KAAK,CAAU,CAAC;AAGjF,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,KAAK,EAAE,KAAK,CAAU,CAAC","sourcesContent":["import type { ColorHarmony } from '@ankhorage/color-theory';\n\nimport type { AuthFlowConfig, AuthIdentifierKind, AuthOAuthConfig, AuthSignUpField } from './auth';\nimport type { BindingValueSource, ComponentDataBindingRegistry } from './bindings';\nimport type { AppDataManifest, DataSourceRegistry } from './data';\nimport type { ScreenRequirements } from './requirements';\n\nexport interface ThemeModeConfig {\n primaryColor: string;\n harmony: ColorHarmony;\n}\n\nexport interface ThemeConfig {\n id: string;\n name: string;\n light: ThemeModeConfig;\n dark: ThemeModeConfig;\n}\n\nexport type ActionType =\n | 'navigate'\n | 'alert'\n | 'console'\n | 'toggleDarkMode'\n | 'setLanguage'\n | 'search'\n | 'filter';\n\nexport interface NavigateAction {\n type: 'navigate';\n payload: {\n route: string;\n params?: Record<string, number | string>;\n };\n}\n\nexport interface AlertAction {\n type: 'alert';\n payload?: {\n message?: string;\n };\n}\n\nexport interface ConsoleAction {\n type: 'console';\n payload?: Record<string, unknown>;\n}\n\nexport interface ToggleDarkModeAction {\n type: 'toggleDarkMode';\n payload?: never;\n}\n\nexport interface SetLanguageAction {\n type: 'setLanguage';\n payload: {\n locale: string;\n };\n}\n\nexport interface SearchAction {\n type: 'search';\n payload: {\n query: string;\n scope?: string;\n };\n}\n\nexport interface FilterAction {\n type: 'filter';\n payload: {\n filterKey: string;\n filterValue: string;\n };\n}\n\nexport type Action =\n | AlertAction\n | ConsoleAction\n | FilterAction\n | NavigateAction\n | SearchAction\n | SetLanguageAction\n | ToggleDarkModeAction;\n\nexport type ManifestValue =\n | string\n | number\n | boolean\n | null\n | readonly ManifestValue[]\n | { readonly [key: string]: ManifestValue };\n\nexport type ComponentEventPayloadValue = ManifestValue;\n\nexport interface ComponentEventDto<\n TType extends string = string,\n TPayload extends object = Record<string, ComponentEventPayloadValue>,\n> {\n readonly type: TType;\n readonly sourceNodeId: string;\n readonly payload: TPayload;\n}\n\nexport type FormSubmitValues = Record<string, ComponentEventPayloadValue>;\n\nexport type FormSubmitEventDto = ComponentEventDto<\n 'form.submit',\n {\n readonly values: FormSubmitValues;\n }\n>;\n\nexport type ButtonPressEventDto = ComponentEventDto<'button.press', Record<string, never>>;\n\nexport interface CollectionItemPressPayload {\n readonly itemId: string | number;\n readonly item: Record<string, ComponentEventPayloadValue>;\n}\n\nexport type CollectionItemPressEventDto = ComponentEventDto<\n 'collection.itemPress',\n CollectionItemPressPayload\n>;\n\nexport type ComponentEventDtoKind =\n | ButtonPressEventDto['type']\n | CollectionItemPressEventDto['type']\n | FormSubmitEventDto['type'];\n\nexport type KnownComponentEventDto =\n | ButtonPressEventDto\n | CollectionItemPressEventDto\n | FormSubmitEventDto;\n\nexport const NAVIGATOR_TYPES = ['stack', 'tabs', 'drawer'] as const;\nexport type NavigatorType = (typeof NAVIGATOR_TYPES)[number];\n\nexport const APP_CATEGORIES = [\n 'books_reading',\n 'business_productivity',\n 'developer_tools',\n 'education_learning',\n 'entertainment_media',\n 'finance_money',\n 'food_drink',\n 'games',\n 'graphics_design',\n 'health_fitness',\n 'kids_family',\n 'lifestyle',\n 'medical',\n 'music_audio',\n 'navigation_travel',\n 'news_magazines',\n 'photo_video',\n 'reference',\n 'shopping_commerce',\n 'social_community',\n 'sports',\n 'utilities_tools',\n 'weather',\n] as const;\nexport type AppCategory = (typeof APP_CATEGORIES)[number];\n\nexport const DEPLOYMENT_TARGETS = ['minikube'] as const;\nexport type KnownDeploymentTarget = (typeof DEPLOYMENT_TARGETS)[number];\nexport type DeploymentTarget = KnownDeploymentTarget | (string & {});\n\nexport const DATABASE_PROVIDERS = ['supabase'] as const;\nexport type KnownDatabaseProvider = (typeof DATABASE_PROVIDERS)[number];\nexport type DatabaseProvider = KnownDatabaseProvider | (string & {});\n\nexport const DATABASE_TIERS = ['dev', 'prod'] as const;\nexport type DatabaseTier = (typeof DATABASE_TIERS)[number];\n\nexport const STORAGE_PROVIDERS = ['auto', 's3', 'r2'] as const;\nexport type StorageProvider = (typeof STORAGE_PROVIDERS)[number];\n\nexport const STATE_PROVIDERS = ['legend'] as const;\nexport type KnownStateProvider = (typeof STATE_PROVIDERS)[number];\nexport type StateProvider = KnownStateProvider | (string & {});\n\nexport const STATE_PERSISTENCE_MODES = ['none', 'local', 'secure', 'database'] as const;\nexport type StatePersistenceMode = (typeof STATE_PERSISTENCE_MODES)[number];\n\nexport const AUTHZ_KINDS = ['RBAC', 'ABAC'] as const;\nexport type AuthzKind = (typeof AUTHZ_KINDS)[number];\n\nexport const AUTHZ_ENGINES = ['cerbos', 'native'] as const;\nexport type AuthzEngine = (typeof AUTHZ_ENGINES)[number];\n\nexport const AUTH_SCOPES = ['global', 'none', 'integrated'] as const;\nexport type AuthScope = (typeof AUTH_SCOPES)[number];\n\nexport const AUTH_PROVIDERS = ['supabase'] as const;\nexport type KnownAuthProvider = (typeof AUTH_PROVIDERS)[number];\nexport type AuthProvider = KnownAuthProvider | (string & {});\n\nexport const AUTH_SIGN_IN_IDENTIFIERS = ['email', 'username', 'phone'] as const;\nexport type AuthSignInIdentifier = AuthIdentifierKind;\n\nexport const AUTH_SIGN_UP_POLICIES = ['autoSignIn', 'requireVerification'] as const;\nexport type AuthSignUpPolicy = (typeof AUTH_SIGN_UP_POLICIES)[number];\n\nexport const AUTH_PROFILE_FIELDS = [\n ...AUTH_SIGN_IN_IDENTIFIERS,\n 'firstName',\n 'lastName',\n 'displayName',\n 'avatarUrl',\n] as const;\nexport type KnownAuthProfileField = (typeof AUTH_PROFILE_FIELDS)[number];\nexport type AuthProfileField = KnownAuthProfileField | (string & {});\n\nexport const AUTH_PROFILE_PRIMARY_KEY_STRATEGIES = ['authUserId'] as const;\nexport type AuthProfilePrimaryKeyStrategy = (typeof AUTH_PROFILE_PRIMARY_KEY_STRATEGIES)[number];\n\nexport const AUTH_PROFILE_CREATE_STRATEGIES = ['trigger', 'api', 'app'] as const;\nexport type AuthProfileCreateStrategy = (typeof AUTH_PROFILE_CREATE_STRATEGIES)[number];\n\nexport const AUTH_PROFILE_UPDATE_STRATEGIES = ['api', 'app'] as const;\nexport type AuthProfileUpdateStrategy = (typeof AUTH_PROFILE_UPDATE_STRATEGIES)[number];\n\nexport interface IconSpec {\n name: string;\n provider?: string;\n size?: number | string;\n color?: string;\n}\n\nexport interface UiNodeRepeatSpec {\n source: BindingValueSource;\n itemAlias?: string;\n keyPath?: string;\n}\n\nexport interface UiNode {\n id: string;\n type: string;\n alias?: string;\n props?: Record<string, unknown>;\n children?: UiNode[];\n style?: Record<string, number | string>;\n repeat?: UiNodeRepeatSpec;\n}\n\nexport interface ScreenSpec {\n id: string;\n name: string;\n title?: string;\n description?: string;\n root: UiNode;\n requires?: ScreenRequirements;\n}\n\nexport interface NavigatorSpec {\n type: NavigatorType;\n initialRouteName?: string;\n routes: RouteDefinition[];\n options?: Record<string, unknown>;\n}\n\nexport interface RouteDefinition {\n name: string;\n path?: string;\n label?: string;\n icon?: IconSpec;\n hideInTabBar?: boolean;\n guards?: string[];\n screenId?: string;\n navigator?: NavigatorSpec;\n}\n\nexport type SplashScreenResizeMode = 'contain' | 'cover' | 'native';\n\nexport interface SplashScreenAssetSpec {\n readonly image?: string;\n readonly imageWidth?: number;\n readonly resizeMode?: SplashScreenResizeMode;\n}\n\nexport interface SplashScreenModeSpec extends SplashScreenAssetSpec {\n readonly backgroundColor?: string;\n}\n\nexport interface SplashScreenSpec extends SplashScreenModeSpec {\n readonly dark?: SplashScreenModeSpec;\n}\n\nexport interface DeploymentSpec {\n target: DeploymentTarget;\n monitoring: boolean;\n}\n\nexport interface DatabaseSpec {\n provider: DatabaseProvider;\n tier: DatabaseTier;\n}\n\nexport interface StorageSpec {\n provider: StorageProvider;\n buckets: string[];\n}\n\nexport interface StateSpec {\n readonly provider: StateProvider;\n readonly persistence?: StatePersistenceMode;\n}\n\nexport interface AuthzSpec {\n kind: AuthzKind;\n engine: AuthzEngine;\n}\n\nexport interface AuthSignInSpec {\n identifiers: AuthSignInIdentifier[];\n}\n\nexport interface AuthSignUpSpec {\n requiredFields: AuthSignUpField[];\n optionalFields?: AuthSignUpField[];\n signUpPolicy?: AuthSignUpPolicy;\n}\n\nexport interface AuthProfileSpec {\n fields: AuthProfileField[];\n table?: string;\n primaryKey?: AuthProfilePrimaryKeyStrategy;\n createStrategy?: AuthProfileCreateStrategy;\n updateStrategy?: AuthProfileUpdateStrategy;\n}\n\nexport interface AuthSpec {\n scope: AuthScope;\n provider: AuthProvider;\n authorization: AuthzSpec;\n flow?: AuthFlowConfig;\n signIn?: AuthSignInSpec;\n signUp?: AuthSignUpSpec;\n oauth?: AuthOAuthConfig;\n profile?: AuthProfileSpec;\n}\n\nexport interface NetworkingSpec {\n domain?: string;\n cdn: boolean;\n}\n\nexport interface InfraManifest {\n deployment?: DeploymentSpec;\n auth?: AuthSpec;\n database?: DatabaseSpec;\n storage?: StorageSpec;\n state?: StateSpec;\n networking?: NetworkingSpec;\n plugins: string[];\n pluginsConfig?: Record<string, unknown>;\n}\n\nexport interface AppManifest {\n metadata: {\n name: string;\n slug: string;\n version: string;\n themeId: string;\n created?: string;\n updated?: string;\n };\n themes: ThemeConfig[];\n activeThemeId: string;\n activeThemeMode?: 'dark' | 'light';\n splashScreen?: SplashScreenSpec;\n infra: InfraManifest;\n navigator: NavigatorSpec;\n screens: Record<string, ScreenSpec>;\n data?: AppDataManifest;\n dataSources?: DataSourceRegistry;\n dataBindings?: ComponentDataBindingRegistry;\n settings: {\n apiBaseUrl?: string;\n localization: {\n defaultLocale: string;\n locales: string[];\n };\n authFlow: AuthFlowConfig;\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA2IA,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAU,CAAC;AAGpE,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,eAAe;IACf,uBAAuB;IACvB,iBAAiB;IACjB,oBAAoB;IACpB,qBAAqB;IACrB,eAAe;IACf,YAAY;IACZ,OAAO;IACP,iBAAiB;IACjB,gBAAgB;IAChB,aAAa;IACb,WAAW;IACX,SAAS;IACT,aAAa;IACb,mBAAmB;IACnB,gBAAgB;IAChB,aAAa;IACb,WAAW;IACX,mBAAmB;IACnB,kBAAkB;IAClB,QAAQ;IACR,iBAAiB;IACjB,SAAS;CACD,CAAC;AAGX,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,UAAU,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ankhorage/color-theory';\n\nimport type { AuthFlowConfig, AuthIdentifierKind, AuthOAuthConfig, AuthSignUpField } from './auth';\nimport type {\n BindingValueSource,\n ComponentDataBindingRegistry,\n ScreenDataLoaderDefinition,\n} from './bindings';\nimport type { AppDataManifest, DataSourceRegistry } from './data';\nimport type { ScreenRequirements } from './requirements';\n\nexport interface ThemeModeConfig {\n primaryColor: string;\n harmony: ColorHarmony;\n}\n\nexport interface ThemeConfig {\n id: string;\n name: string;\n light: ThemeModeConfig;\n dark: ThemeModeConfig;\n}\n\nexport type ActionType =\n | 'navigate'\n | 'alert'\n | 'console'\n | 'toggleDarkMode'\n | 'setLanguage'\n | 'search'\n | 'filter';\n\nexport interface NavigateAction {\n type: 'navigate';\n payload: {\n route: string;\n params?: Record<string, number | string>;\n };\n}\n\nexport interface AlertAction {\n type: 'alert';\n payload?: {\n message?: string;\n };\n}\n\nexport interface ConsoleAction {\n type: 'console';\n payload?: Record<string, unknown>;\n}\n\nexport interface ToggleDarkModeAction {\n type: 'toggleDarkMode';\n payload?: never;\n}\n\nexport interface SetLanguageAction {\n type: 'setLanguage';\n payload: {\n locale: string;\n };\n}\n\nexport interface SearchAction {\n type: 'search';\n payload: {\n query: string;\n scope?: string;\n };\n}\n\nexport interface FilterAction {\n type: 'filter';\n payload: {\n filterKey: string;\n filterValue: string;\n };\n}\n\nexport type Action =\n | AlertAction\n | ConsoleAction\n | FilterAction\n | NavigateAction\n | SearchAction\n | SetLanguageAction\n | ToggleDarkModeAction;\n\nexport type ManifestValue =\n | string\n | number\n | boolean\n | null\n | readonly ManifestValue[]\n | { readonly [key: string]: ManifestValue };\n\nexport type ComponentEventPayloadValue = ManifestValue;\n\nexport interface ComponentEventDto<\n TType extends string = string,\n TPayload extends object = Record<string, ComponentEventPayloadValue>,\n> {\n readonly type: TType;\n readonly sourceNodeId: string;\n readonly payload: TPayload;\n}\n\nexport type FormSubmitValues = Record<string, ComponentEventPayloadValue>;\n\nexport type FormSubmitEventDto = ComponentEventDto<\n 'form.submit',\n {\n readonly values: FormSubmitValues;\n }\n>;\n\nexport type ButtonPressEventDto = ComponentEventDto<'button.press', Record<string, never>>;\n\nexport interface CollectionItemPressPayload {\n readonly itemId: string | number;\n readonly item: Record<string, ComponentEventPayloadValue>;\n}\n\nexport type CollectionItemPressEventDto = ComponentEventDto<\n 'collection.itemPress',\n CollectionItemPressPayload\n>;\n\nexport type ComponentEventDtoKind =\n | ButtonPressEventDto['type']\n | CollectionItemPressEventDto['type']\n | FormSubmitEventDto['type'];\n\nexport type KnownComponentEventDto =\n | ButtonPressEventDto\n | CollectionItemPressEventDto\n | FormSubmitEventDto;\n\nexport const NAVIGATOR_TYPES = ['stack', 'tabs', 'drawer'] as const;\nexport type NavigatorType = (typeof NAVIGATOR_TYPES)[number];\n\nexport const APP_CATEGORIES = [\n 'books_reading',\n 'business_productivity',\n 'developer_tools',\n 'education_learning',\n 'entertainment_media',\n 'finance_money',\n 'food_drink',\n 'games',\n 'graphics_design',\n 'health_fitness',\n 'kids_family',\n 'lifestyle',\n 'medical',\n 'music_audio',\n 'navigation_travel',\n 'news_magazines',\n 'photo_video',\n 'reference',\n 'shopping_commerce',\n 'social_community',\n 'sports',\n 'utilities_tools',\n 'weather',\n] as const;\nexport type AppCategory = (typeof APP_CATEGORIES)[number];\n\nexport const DEPLOYMENT_TARGETS = ['minikube'] as const;\nexport type KnownDeploymentTarget = (typeof DEPLOYMENT_TARGETS)[number];\nexport type DeploymentTarget = KnownDeploymentTarget | (string & {});\n\nexport const DATABASE_PROVIDERS = ['supabase'] as const;\nexport type KnownDatabaseProvider = (typeof DATABASE_PROVIDERS)[number];\nexport type DatabaseProvider = KnownDatabaseProvider | (string & {});\n\nexport const DATABASE_TIERS = ['dev', 'prod'] as const;\nexport type DatabaseTier = (typeof DATABASE_TIERS)[number];\n\nexport const STORAGE_PROVIDERS = ['auto', 's3', 'r2'] as const;\nexport type StorageProvider = (typeof STORAGE_PROVIDERS)[number];\n\nexport const STATE_PROVIDERS = ['legend'] as const;\nexport type KnownStateProvider = (typeof STATE_PROVIDERS)[number];\nexport type StateProvider = KnownStateProvider | (string & {});\n\nexport const STATE_PERSISTENCE_MODES = ['none', 'local', 'secure', 'database'] as const;\nexport type StatePersistenceMode = (typeof STATE_PERSISTENCE_MODES)[number];\n\nexport const AUTHZ_KINDS = ['RBAC', 'ABAC'] as const;\nexport type AuthzKind = (typeof AUTHZ_KINDS)[number];\n\nexport const AUTHZ_ENGINES = ['cerbos', 'native'] as const;\nexport type AuthzEngine = (typeof AUTHZ_ENGINES)[number];\n\nexport const AUTH_SCOPES = ['global', 'none', 'integrated'] as const;\nexport type AuthScope = (typeof AUTH_SCOPES)[number];\n\nexport const AUTH_PROVIDERS = ['supabase'] as const;\nexport type KnownAuthProvider = (typeof AUTH_PROVIDERS)[number];\nexport type AuthProvider = KnownAuthProvider | (string & {});\n\nexport const AUTH_SIGN_IN_IDENTIFIERS = ['email', 'username', 'phone'] as const;\nexport type AuthSignInIdentifier = AuthIdentifierKind;\n\nexport const AUTH_SIGN_UP_POLICIES = ['autoSignIn', 'requireVerification'] as const;\nexport type AuthSignUpPolicy = (typeof AUTH_SIGN_UP_POLICIES)[number];\n\nexport const AUTH_PROFILE_FIELDS = [\n ...AUTH_SIGN_IN_IDENTIFIERS,\n 'firstName',\n 'lastName',\n 'displayName',\n 'avatarUrl',\n] as const;\nexport type KnownAuthProfileField = (typeof AUTH_PROFILE_FIELDS)[number];\nexport type AuthProfileField = KnownAuthProfileField | (string & {});\n\nexport const AUTH_PROFILE_PRIMARY_KEY_STRATEGIES = ['authUserId'] as const;\nexport type AuthProfilePrimaryKeyStrategy = (typeof AUTH_PROFILE_PRIMARY_KEY_STRATEGIES)[number];\n\nexport const AUTH_PROFILE_CREATE_STRATEGIES = ['trigger', 'api', 'app'] as const;\nexport type AuthProfileCreateStrategy = (typeof AUTH_PROFILE_CREATE_STRATEGIES)[number];\n\nexport const AUTH_PROFILE_UPDATE_STRATEGIES = ['api', 'app'] as const;\nexport type AuthProfileUpdateStrategy = (typeof AUTH_PROFILE_UPDATE_STRATEGIES)[number];\n\nexport interface IconSpec {\n name: string;\n provider?: string;\n size?: number | string;\n color?: string;\n}\n\nexport interface UiNodeRepeatSpec {\n source: BindingValueSource;\n itemAlias?: string;\n keyPath?: string;\n empty?: readonly UiNode[];\n}\n\nexport interface UiNode {\n id: string;\n type: string;\n alias?: string;\n props?: Record<string, unknown>;\n children?: UiNode[];\n style?: Record<string, number | string>;\n repeat?: UiNodeRepeatSpec;\n}\n\nexport interface ScreenSpec {\n id: string;\n name: string;\n title?: string;\n description?: string;\n root: UiNode;\n dataLoaders?: readonly ScreenDataLoaderDefinition[];\n requires?: ScreenRequirements;\n}\n\nexport interface NavigatorSpec {\n type: NavigatorType;\n initialRouteName?: string;\n routes: RouteDefinition[];\n options?: Record<string, unknown>;\n}\n\nexport interface RouteDefinition {\n name: string;\n path?: string;\n label?: string;\n icon?: IconSpec;\n hideInTabBar?: boolean;\n guards?: string[];\n screenId?: string;\n navigator?: NavigatorSpec;\n}\n\nexport type SplashScreenResizeMode = 'contain' | 'cover' | 'native';\n\nexport interface SplashScreenAssetSpec {\n readonly image?: string;\n readonly imageWidth?: number;\n readonly resizeMode?: SplashScreenResizeMode;\n}\n\nexport interface SplashScreenModeSpec extends SplashScreenAssetSpec {\n readonly backgroundColor?: string;\n}\n\nexport interface SplashScreenSpec extends SplashScreenModeSpec {\n readonly dark?: SplashScreenModeSpec;\n}\n\nexport interface DeploymentSpec {\n target: DeploymentTarget;\n monitoring: boolean;\n}\n\nexport interface DatabaseSpec {\n provider: DatabaseProvider;\n tier: DatabaseTier;\n}\n\nexport interface StorageSpec {\n provider: StorageProvider;\n buckets: string[];\n}\n\nexport interface StateSpec {\n readonly provider: StateProvider;\n readonly persistence?: StatePersistenceMode;\n}\n\nexport interface AuthzSpec {\n kind: AuthzKind;\n engine: AuthzEngine;\n}\n\nexport interface AuthSignInSpec {\n identifiers: AuthSignInIdentifier[];\n}\n\nexport interface AuthSignUpSpec {\n requiredFields: AuthSignUpField[];\n optionalFields?: AuthSignUpField[];\n signUpPolicy?: AuthSignUpPolicy;\n}\n\nexport interface AuthProfileSpec {\n fields: AuthProfileField[];\n table?: string;\n primaryKey?: AuthProfilePrimaryKeyStrategy;\n createStrategy?: AuthProfileCreateStrategy;\n updateStrategy?: AuthProfileUpdateStrategy;\n}\n\nexport interface AuthSpec {\n scope: AuthScope;\n provider: AuthProvider;\n authorization: AuthzSpec;\n flow?: AuthFlowConfig;\n signIn?: AuthSignInSpec;\n signUp?: AuthSignUpSpec;\n oauth?: AuthOAuthConfig;\n profile?: AuthProfileSpec;\n}\n\nexport interface NetworkingSpec {\n domain?: string;\n cdn: boolean;\n}\n\nexport interface InfraManifest {\n deployment?: DeploymentSpec;\n auth?: AuthSpec;\n database?: DatabaseSpec;\n storage?: StorageSpec;\n state?: StateSpec;\n networking?: NetworkingSpec;\n plugins: string[];\n pluginsConfig?: Record<string, unknown>;\n}\n\nexport interface AppManifest {\n metadata: {\n name: string;\n slug: string;\n version: string;\n themeId: string;\n created?: string;\n updated?: string;\n };\n themes: ThemeConfig[];\n activeThemeId: string;\n activeThemeMode?: 'dark' | 'light';\n splashScreen?: SplashScreenSpec;\n infra: InfraManifest;\n navigator: NavigatorSpec;\n screens: Record<string, ScreenSpec>;\n data?: AppDataManifest;\n dataSources?: DataSourceRegistry;\n dataBindings?: ComponentDataBindingRegistry;\n settings: {\n apiBaseUrl?: string;\n localization: {\n defaultLocale: string;\n locales: string[];\n };\n authFlow: AuthFlowConfig;\n };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/contracts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@ankhorage/color-theory": "^0.0.7"
|
|
@@ -25,6 +25,10 @@
|
|
|
25
25
|
"types": "./dist/bindings.d.ts",
|
|
26
26
|
"default": "./dist/bindings.js"
|
|
27
27
|
},
|
|
28
|
+
"./cli": {
|
|
29
|
+
"types": "./dist/cli.d.ts",
|
|
30
|
+
"default": "./dist/cli.js"
|
|
31
|
+
},
|
|
28
32
|
"./data": {
|
|
29
33
|
"types": "./dist/data/index.d.ts",
|
|
30
34
|
"default": "./dist/data/index.js"
|
package/src/bindings.test.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { describe, expect, it } from 'bun:test';
|
|
2
2
|
|
|
3
3
|
import type {
|
|
4
|
+
ApiScreenDataLoaderDefinition,
|
|
4
5
|
AppManifest,
|
|
5
6
|
BindingInputMap,
|
|
6
7
|
BindingValueSource,
|
|
7
8
|
ComponentDataBinding,
|
|
8
9
|
ComponentDataBindingRegistry,
|
|
9
10
|
EventBinding,
|
|
11
|
+
OperationScreenDataLoaderDefinition,
|
|
10
12
|
PropBinding,
|
|
13
|
+
ScreenDataLoaderDefinition,
|
|
11
14
|
} from './index';
|
|
12
15
|
|
|
13
16
|
function assertSerializable<TValue>(value: TValue): void {
|
|
@@ -158,6 +161,39 @@ describe('component data-binding contracts', () => {
|
|
|
158
161
|
expect(binding.target.kind).toBe('action');
|
|
159
162
|
});
|
|
160
163
|
|
|
164
|
+
it('serializes supported screen data-loader definitions for api and operation loaders', () => {
|
|
165
|
+
const loaders: readonly ScreenDataLoaderDefinition[] = [
|
|
166
|
+
{
|
|
167
|
+
kind: 'api',
|
|
168
|
+
apiId: 'catalog',
|
|
169
|
+
mode: 'byId',
|
|
170
|
+
targetPath: 'apis.catalog.current',
|
|
171
|
+
id: 'product-1',
|
|
172
|
+
} satisfies ApiScreenDataLoaderDefinition,
|
|
173
|
+
{
|
|
174
|
+
kind: 'operation',
|
|
175
|
+
id: 'product-detail',
|
|
176
|
+
operation: {
|
|
177
|
+
dataSourceId: 'nutrition-api',
|
|
178
|
+
endpointId: 'products',
|
|
179
|
+
operationId: 'nutrition.products.getById',
|
|
180
|
+
},
|
|
181
|
+
input: {
|
|
182
|
+
id: {
|
|
183
|
+
kind: 'source',
|
|
184
|
+
source: {
|
|
185
|
+
kind: 'context',
|
|
186
|
+
path: 'route.params.id',
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
} satisfies OperationScreenDataLoaderDefinition,
|
|
191
|
+
];
|
|
192
|
+
|
|
193
|
+
assertSerializable(loaders);
|
|
194
|
+
expect(loaders.map((loader) => loader.kind)).toEqual(['api', 'operation']);
|
|
195
|
+
});
|
|
196
|
+
|
|
161
197
|
it('serializes scanner lookup and conditional navigation intent using existing generic bindings', () => {
|
|
162
198
|
const productLookupOperation = {
|
|
163
199
|
dataSourceId: 'nutrition-api',
|
package/src/bindings.ts
CHANGED
|
@@ -94,6 +94,25 @@ export type BindingInputValue =
|
|
|
94
94
|
|
|
95
95
|
export type BindingInputMap = Readonly<Record<string, BindingInputValue>>;
|
|
96
96
|
|
|
97
|
+
export interface ApiScreenDataLoaderDefinition {
|
|
98
|
+
readonly kind: 'api';
|
|
99
|
+
readonly apiId: string;
|
|
100
|
+
readonly mode: 'byId' | 'list' | 'one' | 'random';
|
|
101
|
+
readonly targetPath: string;
|
|
102
|
+
readonly id?: string | number;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface OperationScreenDataLoaderDefinition {
|
|
106
|
+
readonly kind: 'operation';
|
|
107
|
+
readonly id?: string;
|
|
108
|
+
readonly operation: BindingOperationRef;
|
|
109
|
+
readonly input?: BindingInputMap;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export type ScreenDataLoaderDefinition =
|
|
113
|
+
| ApiScreenDataLoaderDefinition
|
|
114
|
+
| OperationScreenDataLoaderDefinition;
|
|
115
|
+
|
|
97
116
|
export type BindingConditionOperator = 'eq' | 'exists' | 'neq' | 'notExists';
|
|
98
117
|
|
|
99
118
|
export interface BindingCondition {
|
package/src/cli.test.ts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { describe, expect, it } from 'bun:test';
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
AnkhCapabilityId,
|
|
5
|
+
AnkhCommandDescriptor,
|
|
6
|
+
AnkhCommandProviderManifest,
|
|
7
|
+
AnkhPackageMetadata,
|
|
8
|
+
} from './index';
|
|
9
|
+
|
|
10
|
+
describe('cli contracts', () => {
|
|
11
|
+
it('accepts provider package metadata and provider manifests', () => {
|
|
12
|
+
const packageMetadata = {
|
|
13
|
+
category: 'infra',
|
|
14
|
+
provider: './dist/ankh.provider.js',
|
|
15
|
+
capabilities: ['infra.up', 'infra.status'],
|
|
16
|
+
} as const satisfies AnkhPackageMetadata;
|
|
17
|
+
|
|
18
|
+
const upCommand = {
|
|
19
|
+
path: ['up'],
|
|
20
|
+
summary: 'Bring project infrastructure up',
|
|
21
|
+
capability: 'infra.up',
|
|
22
|
+
aliases: ['start'],
|
|
23
|
+
examples: ['ankh infra up shop'],
|
|
24
|
+
} as const satisfies AnkhCommandDescriptor;
|
|
25
|
+
|
|
26
|
+
const manifest = {
|
|
27
|
+
id: '@ankhorage/infra',
|
|
28
|
+
category: 'infra',
|
|
29
|
+
version: '1.0.0',
|
|
30
|
+
capabilities: ['infra.up', 'infra.status'],
|
|
31
|
+
commands: [upCommand],
|
|
32
|
+
} as const satisfies AnkhCommandProviderManifest;
|
|
33
|
+
|
|
34
|
+
expect(JSON.parse(JSON.stringify(packageMetadata))).toEqual(packageMetadata);
|
|
35
|
+
expect(JSON.parse(JSON.stringify(manifest))).toEqual(manifest);
|
|
36
|
+
expect(manifest.id).toBe('@ankhorage/infra');
|
|
37
|
+
expect(manifest.category).toBe('infra');
|
|
38
|
+
expect(manifest.commands[0].path).toEqual(['up']);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('accepts metadata-only packages without a provider module', () => {
|
|
42
|
+
const packageMetadata = {
|
|
43
|
+
category: 'contracts',
|
|
44
|
+
provider: null,
|
|
45
|
+
capabilities: ['contracts.cli'],
|
|
46
|
+
} as const satisfies AnkhPackageMetadata;
|
|
47
|
+
|
|
48
|
+
expect(JSON.parse(JSON.stringify(packageMetadata))).toEqual(packageMetadata);
|
|
49
|
+
expect(packageMetadata.provider).toBeNull();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('keeps command paths relative to the provider category', () => {
|
|
53
|
+
const androidScanCommand = {
|
|
54
|
+
path: ['android', 'scan'],
|
|
55
|
+
summary: 'Scan an Android target',
|
|
56
|
+
capability: 'dev.android.scan',
|
|
57
|
+
examples: ['ankh dev android scan'],
|
|
58
|
+
} as const satisfies AnkhCommandDescriptor;
|
|
59
|
+
|
|
60
|
+
const manifest = {
|
|
61
|
+
id: '@ankhorage/dev',
|
|
62
|
+
category: 'dev',
|
|
63
|
+
version: '1.0.0',
|
|
64
|
+
capabilities: ['dev.android.scan'],
|
|
65
|
+
commands: [androidScanCommand],
|
|
66
|
+
} as const satisfies AnkhCommandProviderManifest;
|
|
67
|
+
|
|
68
|
+
expect(manifest.category).toBe('dev');
|
|
69
|
+
expect(manifest.commands[0].path).toEqual(['android', 'scan']);
|
|
70
|
+
expect(manifest.commands[0].path[0]).not.toBe(manifest.category);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('accepts dot-separated capability ids for discovery metadata', () => {
|
|
74
|
+
const capabilities = [
|
|
75
|
+
'infra.up',
|
|
76
|
+
'templates.list',
|
|
77
|
+
'board.web.import',
|
|
78
|
+
'contracts.cli',
|
|
79
|
+
] as const satisfies readonly AnkhCapabilityId[];
|
|
80
|
+
|
|
81
|
+
expect(capabilities).toEqual([
|
|
82
|
+
'infra.up',
|
|
83
|
+
'templates.list',
|
|
84
|
+
'board.web.import',
|
|
85
|
+
'contracts.cli',
|
|
86
|
+
]);
|
|
87
|
+
});
|
|
88
|
+
});
|
package/src/cli.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type AnkhCommandCategory = string;
|
|
2
|
+
|
|
3
|
+
export type AnkhProviderReference = `./${string}`;
|
|
4
|
+
|
|
5
|
+
export type AnkhCapabilityId = `${string}.${string}`;
|
|
6
|
+
|
|
7
|
+
export interface AnkhCommandDescriptor {
|
|
8
|
+
readonly path: readonly [string, ...string[]];
|
|
9
|
+
readonly summary: string;
|
|
10
|
+
readonly capability: AnkhCapabilityId;
|
|
11
|
+
readonly aliases?: readonly string[];
|
|
12
|
+
readonly examples?: readonly string[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface AnkhCommandProviderManifest {
|
|
16
|
+
readonly id: string;
|
|
17
|
+
readonly category: AnkhCommandCategory;
|
|
18
|
+
readonly version: string;
|
|
19
|
+
readonly capabilities: readonly AnkhCapabilityId[];
|
|
20
|
+
readonly commands: readonly AnkhCommandDescriptor[];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface AnkhPackageMetadata {
|
|
24
|
+
readonly category: AnkhCommandCategory;
|
|
25
|
+
readonly provider: AnkhProviderReference | null;
|
|
26
|
+
readonly capabilities: readonly AnkhCapabilityId[];
|
|
27
|
+
}
|
package/src/contracts.test.ts
CHANGED
|
@@ -56,6 +56,17 @@ async function collectTypeScriptFiles(directory: string): Promise<string[]> {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
describe('contracts', () => {
|
|
59
|
+
it('exports the cli subpath for Ankh discovery contracts', async () => {
|
|
60
|
+
const packageJson = JSON.parse(await readFile(join(process.cwd(), 'package.json'), 'utf8')) as {
|
|
61
|
+
exports?: Record<string, { default?: string; types?: string }>;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
expect(packageJson.exports?.['./cli']).toEqual({
|
|
65
|
+
types: './dist/cli.d.ts',
|
|
66
|
+
default: './dist/cli.js',
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
59
70
|
it('exports stable platform constants', () => {
|
|
60
71
|
expect(NAVIGATOR_TYPES).toEqual(['stack', 'tabs', 'drawer']);
|
|
61
72
|
expect(APP_CATEGORIES).toEqual([
|
|
@@ -131,6 +142,66 @@ describe('contracts', () => {
|
|
|
131
142
|
expect(JSON.parse(JSON.stringify(manifest))).toEqual({ splashScreen });
|
|
132
143
|
});
|
|
133
144
|
|
|
145
|
+
it('accepts screens with operation data loaders and repeat empty-state nodes', () => {
|
|
146
|
+
const manifest: Pick<AppManifest, 'screens'> = {
|
|
147
|
+
screens: {
|
|
148
|
+
products: {
|
|
149
|
+
id: 'products',
|
|
150
|
+
name: 'Products',
|
|
151
|
+
root: {
|
|
152
|
+
id: 'products-grid',
|
|
153
|
+
type: 'Grid',
|
|
154
|
+
repeat: {
|
|
155
|
+
source: {
|
|
156
|
+
kind: 'operation',
|
|
157
|
+
operation: {
|
|
158
|
+
dataSourceId: 'nutrition-api',
|
|
159
|
+
endpointId: 'products',
|
|
160
|
+
operationId: 'nutrition.products.list',
|
|
161
|
+
},
|
|
162
|
+
path: 'products',
|
|
163
|
+
},
|
|
164
|
+
empty: [
|
|
165
|
+
{
|
|
166
|
+
id: 'products-empty',
|
|
167
|
+
type: 'Notice',
|
|
168
|
+
props: {
|
|
169
|
+
title: 'No products found',
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
},
|
|
174
|
+
children: [],
|
|
175
|
+
},
|
|
176
|
+
dataLoaders: [
|
|
177
|
+
{
|
|
178
|
+
kind: 'operation',
|
|
179
|
+
id: 'product-detail',
|
|
180
|
+
operation: {
|
|
181
|
+
dataSourceId: 'nutrition-api',
|
|
182
|
+
endpointId: 'products',
|
|
183
|
+
operationId: 'nutrition.products.getById',
|
|
184
|
+
},
|
|
185
|
+
input: {
|
|
186
|
+
id: {
|
|
187
|
+
kind: 'source',
|
|
188
|
+
source: {
|
|
189
|
+
kind: 'context',
|
|
190
|
+
path: 'route.params.id',
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
],
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
expect(JSON.parse(JSON.stringify(manifest))).toEqual(manifest);
|
|
201
|
+
expect(manifest.screens.products?.dataLoaders?.[0]?.kind).toBe('operation');
|
|
202
|
+
expect(manifest.screens.products?.root.repeat?.empty?.[0]?.type).toBe('Notice');
|
|
203
|
+
});
|
|
204
|
+
|
|
134
205
|
it('accepts provider-neutral state infra selection on app manifests', () => {
|
|
135
206
|
const state: StateSpec = {
|
|
136
207
|
provider: 'legend',
|
|
@@ -153,7 +224,7 @@ describe('contracts', () => {
|
|
|
153
224
|
|
|
154
225
|
it('ThemeModeConfig.harmony accepts all ColorHarmony values', () => {
|
|
155
226
|
for (const harmony of COLOR_HARMONIES) {
|
|
156
|
-
const config
|
|
227
|
+
const config = { primaryColor: '#ff0000', harmony } satisfies ThemeModeConfig;
|
|
157
228
|
expect(config.harmony).toBe(harmony);
|
|
158
229
|
}
|
|
159
230
|
});
|
package/src/index.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { ColorHarmony } from '@ankhorage/color-theory';
|
|
2
2
|
|
|
3
3
|
import type { AuthFlowConfig, AuthIdentifierKind, AuthOAuthConfig, AuthSignUpField } from './auth';
|
|
4
|
-
import type {
|
|
4
|
+
import type {
|
|
5
|
+
BindingValueSource,
|
|
6
|
+
ComponentDataBindingRegistry,
|
|
7
|
+
ScreenDataLoaderDefinition,
|
|
8
|
+
} from './bindings';
|
|
5
9
|
import type { AppDataManifest, DataSourceRegistry } from './data';
|
|
6
10
|
import type { ScreenRequirements } from './requirements';
|
|
7
11
|
|
|
@@ -233,6 +237,7 @@ export interface UiNodeRepeatSpec {
|
|
|
233
237
|
source: BindingValueSource;
|
|
234
238
|
itemAlias?: string;
|
|
235
239
|
keyPath?: string;
|
|
240
|
+
empty?: readonly UiNode[];
|
|
236
241
|
}
|
|
237
242
|
|
|
238
243
|
export interface UiNode {
|
|
@@ -251,6 +256,7 @@ export interface ScreenSpec {
|
|
|
251
256
|
title?: string;
|
|
252
257
|
description?: string;
|
|
253
258
|
root: UiNode;
|
|
259
|
+
dataLoaders?: readonly ScreenDataLoaderDefinition[];
|
|
254
260
|
requires?: ScreenRequirements;
|
|
255
261
|
}
|
|
256
262
|
|