@ankhorage/contracts 1.19.0 → 1.19.2
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 +43 -2
- 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/runtimeCallbacks.d.ts +14 -0
- package/dist/runtimeCallbacks.d.ts.map +1 -0
- package/dist/runtimeCallbacks.js +2 -0
- package/dist/runtimeCallbacks.js.map +1 -0
- package/package.json +12 -1
- package/src/contracts.test.ts +10 -0
- package/src/index.ts +1 -0
- package/src/runtimeCallbacks.ts +19 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ankhorage/contracts
|
|
2
2
|
|
|
3
|
+
## 1.19.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 20bd7b6: Add shared runtime callback contracts for node prop resolvers and callback maps.
|
|
8
|
+
|
|
9
|
+
## 1.19.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 37105b0: Add published ankh package metadata and document capability naming conventions.
|
|
14
|
+
|
|
3
15
|
## 1.19.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -106,6 +106,19 @@ Metadata-only packages use `null` for `provider`:
|
|
|
106
106
|
}
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
+
`@ankhorage/contracts` now publishes this metadata shape directly from its own
|
|
110
|
+
`package.json`:
|
|
111
|
+
|
|
112
|
+
```json
|
|
113
|
+
{
|
|
114
|
+
"ankh": {
|
|
115
|
+
"category": "contracts",
|
|
116
|
+
"provider": null,
|
|
117
|
+
"capabilities": ["contracts.cli"]
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
109
122
|
Command descriptor paths are relative to the provider category:
|
|
110
123
|
|
|
111
124
|
- `category: "infra"` with `path: ["up"]` maps to `ankh infra up`
|
|
@@ -113,8 +126,36 @@ Command descriptor paths are relative to the provider category:
|
|
|
113
126
|
|
|
114
127
|
This subpath contains contracts only. It must not depend on `commander`,
|
|
115
128
|
`@ankhorage/ankh`, provider implementations, or runtime CLI execution logic.
|
|
116
|
-
|
|
117
|
-
|
|
129
|
+
|
|
130
|
+
Capability names are dot-separated package metadata identifiers.
|
|
131
|
+
|
|
132
|
+
Preferred forms:
|
|
133
|
+
|
|
134
|
+
- `<category>.<action>` for simple capabilities
|
|
135
|
+
- `<category>.<resource>.<action>` for nested or domain-specific capabilities
|
|
136
|
+
|
|
137
|
+
Valid examples:
|
|
138
|
+
|
|
139
|
+
- `infra.up`
|
|
140
|
+
- `templates.create`
|
|
141
|
+
- `contracts.cli`
|
|
142
|
+
- `board.web.import`
|
|
143
|
+
- `doctor.repo.validate`
|
|
144
|
+
- `dev.android.rebuild`
|
|
145
|
+
- `expoRuntime.plan`
|
|
146
|
+
|
|
147
|
+
Invalid examples:
|
|
148
|
+
|
|
149
|
+
- `infra`
|
|
150
|
+
- `infra-up`
|
|
151
|
+
- `.status`
|
|
152
|
+
- `infra.`
|
|
153
|
+
- `infra..up`
|
|
154
|
+
|
|
155
|
+
`AnkhCapabilityId` remains intentionally broad at the TypeScript level so
|
|
156
|
+
packages can publish stable serializable metadata without embedding policy
|
|
157
|
+
validation logic here. Stricter validation belongs later in
|
|
158
|
+
`@ankhorage/doctor`.
|
|
118
159
|
|
|
119
160
|
## Profile contract
|
|
120
161
|
|
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,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"}
|
|
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,oBAAoB,CAAC;AACnC,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,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"]}
|
|
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,oBAAoB,CAAC;AACnC,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 './runtimeCallbacks';\nexport * from './state';\nexport * from './storage';\nexport * from './types';\nexport * from './ui';\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { UiNode } from './types';
|
|
2
|
+
export interface RuntimeResolveNodePropsArgs {
|
|
3
|
+
readonly node: UiNode;
|
|
4
|
+
readonly props: Record<string, unknown>;
|
|
5
|
+
}
|
|
6
|
+
export type RuntimeNodePropsResolver = (args: RuntimeResolveNodePropsArgs) => Record<string, unknown>;
|
|
7
|
+
export interface RuntimeCallbackArgs {
|
|
8
|
+
readonly payload: unknown;
|
|
9
|
+
readonly node?: UiNode;
|
|
10
|
+
readonly resolvedPayload?: object;
|
|
11
|
+
}
|
|
12
|
+
export type RuntimeCallback = (args: RuntimeCallbackArgs) => Promise<void> | void;
|
|
13
|
+
export type RuntimeCallbackMap = Readonly<Record<string, RuntimeCallback>>;
|
|
14
|
+
//# sourceMappingURL=runtimeCallbacks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtimeCallbacks.d.ts","sourceRoot":"","sources":["../src/runtimeCallbacks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtC,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACzC;AAED,MAAM,MAAM,wBAAwB,GAAG,CACrC,IAAI,EAAE,2BAA2B,KAC9B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE7B,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CACnC;AAED,MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,mBAAmB,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAClF,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtimeCallbacks.js","sourceRoot":"","sources":["../src/runtimeCallbacks.ts"],"names":[],"mappings":"","sourcesContent":["import type { UiNode } from './types';\n\nexport interface RuntimeResolveNodePropsArgs {\n readonly node: UiNode;\n readonly props: Record<string, unknown>;\n}\n\nexport type RuntimeNodePropsResolver = (\n args: RuntimeResolveNodePropsArgs,\n) => Record<string, unknown>;\n\nexport interface RuntimeCallbackArgs {\n readonly payload: unknown;\n readonly node?: UiNode;\n readonly resolvedPayload?: object;\n}\n\nexport type RuntimeCallback = (args: RuntimeCallbackArgs) => Promise<void> | void;\nexport type RuntimeCallbackMap = Readonly<Record<string, RuntimeCallback>>;\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/contracts",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.2",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
|
+
"ankh": {
|
|
6
|
+
"category": "contracts",
|
|
7
|
+
"provider": null,
|
|
8
|
+
"capabilities": [
|
|
9
|
+
"contracts.cli"
|
|
10
|
+
]
|
|
11
|
+
},
|
|
5
12
|
"dependencies": {
|
|
6
13
|
"@ankhorage/color-theory": "^0.0.7"
|
|
7
14
|
},
|
|
@@ -41,6 +48,10 @@
|
|
|
41
48
|
"types": "./dist/nutrition/index.d.ts",
|
|
42
49
|
"default": "./dist/nutrition/index.js"
|
|
43
50
|
},
|
|
51
|
+
"./runtime": {
|
|
52
|
+
"types": "./dist/runtimeCallbacks.d.ts",
|
|
53
|
+
"default": "./dist/runtimeCallbacks.js"
|
|
54
|
+
},
|
|
44
55
|
"./state": {
|
|
45
56
|
"types": "./dist/state.d.ts",
|
|
46
57
|
"default": "./dist/state.js"
|
package/src/contracts.test.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { COLOR_HARMONIES } from '@ankhorage/color-theory';
|
|
|
5
5
|
import { describe, expect, it } from 'bun:test';
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
|
+
type AnkhPackageMetadata,
|
|
8
9
|
APP_CATEGORIES,
|
|
9
10
|
type AppCategory,
|
|
10
11
|
type AppManifest,
|
|
@@ -57,7 +58,14 @@ async function collectTypeScriptFiles(directory: string): Promise<string[]> {
|
|
|
57
58
|
|
|
58
59
|
describe('contracts', () => {
|
|
59
60
|
it('exports the cli subpath for Ankh discovery contracts', async () => {
|
|
61
|
+
const expectedAnkhMetadata = {
|
|
62
|
+
category: 'contracts',
|
|
63
|
+
provider: null,
|
|
64
|
+
capabilities: ['contracts.cli'],
|
|
65
|
+
} as const satisfies AnkhPackageMetadata;
|
|
66
|
+
|
|
60
67
|
const packageJson = JSON.parse(await readFile(join(process.cwd(), 'package.json'), 'utf8')) as {
|
|
68
|
+
ankh?: unknown;
|
|
61
69
|
exports?: Record<string, { default?: string; types?: string }>;
|
|
62
70
|
};
|
|
63
71
|
|
|
@@ -65,6 +73,8 @@ describe('contracts', () => {
|
|
|
65
73
|
types: './dist/cli.d.ts',
|
|
66
74
|
default: './dist/cli.js',
|
|
67
75
|
});
|
|
76
|
+
expect(packageJson.ankh).toEqual(expectedAnkhMetadata);
|
|
77
|
+
expect(JSON.parse(JSON.stringify(expectedAnkhMetadata))).toEqual(expectedAnkhMetadata);
|
|
68
78
|
});
|
|
69
79
|
|
|
70
80
|
it('exports stable platform constants', () => {
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { UiNode } from './types';
|
|
2
|
+
|
|
3
|
+
export interface RuntimeResolveNodePropsArgs {
|
|
4
|
+
readonly node: UiNode;
|
|
5
|
+
readonly props: Record<string, unknown>;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type RuntimeNodePropsResolver = (
|
|
9
|
+
args: RuntimeResolveNodePropsArgs,
|
|
10
|
+
) => Record<string, unknown>;
|
|
11
|
+
|
|
12
|
+
export interface RuntimeCallbackArgs {
|
|
13
|
+
readonly payload: unknown;
|
|
14
|
+
readonly node?: UiNode;
|
|
15
|
+
readonly resolvedPayload?: object;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type RuntimeCallback = (args: RuntimeCallbackArgs) => Promise<void> | void;
|
|
19
|
+
export type RuntimeCallbackMap = Readonly<Record<string, RuntimeCallback>>;
|