@ankhorage/contracts 18.0.0 → 19.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ankhorage/contracts
|
|
2
2
|
|
|
3
|
+
## 19.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- cb4bee3: Require compute adapters to implement `inspectAsync` and return an `InfraComputeSnapshot` without
|
|
8
|
+
creating, updating, or deleting resources. `ensureAsync` now returns the same canonical snapshot
|
|
9
|
+
shape.
|
|
10
|
+
|
|
11
|
+
This separates read-only target discovery from reconciliation so `infra plan`, `infra generate`,
|
|
12
|
+
and validation can resolve existing portable targets without invoking a mutating lifecycle method.
|
|
13
|
+
Compute-adapter consumers must add `inspectAsync(context, selection)` before upgrading.
|
|
14
|
+
|
|
3
15
|
## 18.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, action, theme, auth, and secret-store contracts for Ankhorage.
|
|
9
9
|
|
|
@@ -29,14 +29,18 @@ export interface InfraReconcileResult {
|
|
|
29
29
|
readonly resources: readonly InfraOwnedResource[];
|
|
30
30
|
readonly outputs: readonly InfraOutput[];
|
|
31
31
|
}
|
|
32
|
+
/** Current portable compute state resolved without creating, updating or deleting resources. */
|
|
33
|
+
export interface InfraComputeSnapshot extends InfraReconcileResult {
|
|
34
|
+
readonly targets: readonly InfraComputeTarget[];
|
|
35
|
+
}
|
|
32
36
|
export interface InfraComputeAdapter<P extends InfraComputeProviderId = InfraComputeProviderId> {
|
|
33
37
|
readonly descriptor: InfraAdapterDescriptor<P>;
|
|
34
38
|
/** Read-only prerequisites, config and control-plane credential validation. */
|
|
35
39
|
validateAsync(context: InfraExecutionContext, selection: InfraComputeSelection<P>): Promise<InfraResult<null>>;
|
|
40
|
+
/** Read-only discovery for planning and stateless runtime projection. Missing compute is empty. */
|
|
41
|
+
inspectAsync(context: InfraExecutionContext, selection: InfraComputeSelection<P>): Promise<InfraResult<InfraComputeSnapshot>>;
|
|
36
42
|
planAsync(context: InfraExecutionContext, selection: InfraComputeSelection<P>): Promise<InfraResult<readonly InfraPlanAction[]>>;
|
|
37
|
-
ensureAsync(context: InfraExecutionContext, selection: InfraComputeSelection<P>): Promise<InfraResult<
|
|
38
|
-
readonly targets: readonly InfraComputeTarget[];
|
|
39
|
-
}>>;
|
|
43
|
+
ensureAsync(context: InfraExecutionContext, selection: InfraComputeSelection<P>): Promise<InfraResult<InfraComputeSnapshot>>;
|
|
40
44
|
statusAsync(context: InfraExecutionContext): Promise<InfraResult<readonly InfraResourceStatus[]>>;
|
|
41
45
|
destroyAsync(context: InfraExecutionContext, request: InfraDestroyRequest): Promise<InfraResult<InfraReconcileResult>>;
|
|
42
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"infraAdapters.d.ts","sourceRoot":"","sources":["../../src/types/infraAdapters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,KAAK,EACV,mBAAmB,EACnB,sBAAsB,EACtB,WAAW,EACX,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,8BAA8B,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAA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,CAAC,CAAC;IAC5F,qBAAqB,CACnB,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,WAAW,CAAC,SAAS,iBAAiB,EAAE,CAAC,CAAC,CAAC;IACtD,cAAc,CACZ,OAAO,EAAE,qBAAqB,EAC9B,cAAc,EAAE,SAAS,WAAW,EAAE,GACrC,OAAO,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAC9C,WAAW,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC,SAAS,mBAAmB,EAAE,CAAC,CAAC,CAAC;IAClG,YAAY,CACV,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAC9C,YAAY,CAAC,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC,CAAC;CAC3F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"infraAdapters.js","sourceRoot":"","sources":["../../src/types/infraAdapters.ts"],"names":[],"mappings":"","sourcesContent":["import type { AppEnvironmentId } from '../environments';\nimport type { INFRA_ADAPTER_CATALOG } from '../infra/constants';\nimport type {\n InfraDestroyRequest,\n InfraGeneratedArtifact,\n InfraLedger,\n InfraOutput,\n InfraOwnedResource,\n InfraPlanAction,\n InfraResourceStatus,\n InfraResult,\n} from './infraLifecycle';\nimport type {\n InfraAdapterId,\n InfraComputeProviderId,\n InfraComputeSelection,\n InfraEnvironmentSpec,\n InfraRuntimeProviderId,\n InfraRuntimeSelection,\n} from './infraManifest';\nimport type { InfraControlPlaneCredentialRef, InfraSecretReference } from './infraSecrets';\nimport type { InfraComputeTarget } from './infraTargets';\nimport type { InfraWorkloadSpec } from './infraWorkload';\n\n/** Package exports must match this exact catalog entry; optional operations are advertised explicitly. */\nexport type InfraAdapterDescriptor<P extends InfraAdapterId = InfraAdapterId> = {\n [K in P]: (typeof INFRA_ADAPTER_CATALOG)[K] & {\n readonly operations?: readonly ('suspend' | 'resume' | 'generate' | 'diagnostics')[];\n };\n}[P];\n\n/** Trusted execution-only ports. Implementations must not serialize resolved credential values. */\nexport interface InfraExecutionContext {\n readonly projectId: string;\n readonly environment: AppEnvironmentId;\n readonly desired: InfraEnvironmentSpec;\n readonly previous?: InfraLedger;\n readonly signal?: AbortSignal;\n readonly credentials: {\n resolveAsync(\n reference: InfraControlPlaneCredentialRef,\n ): Promise<InfraResult<Readonly<Record<string, string>>>>;\n };\n readonly secrets: {\n resolveAsync(reference: InfraSecretReference): Promise<InfraResult<string>>;\n };\n}\n\nexport interface InfraReconcileResult {\n readonly resources: readonly InfraOwnedResource[];\n readonly outputs: readonly InfraOutput[];\n}\n\nexport interface InfraComputeAdapter<P extends InfraComputeProviderId = InfraComputeProviderId> {\n readonly descriptor: InfraAdapterDescriptor<P>;\n /** Read-only prerequisites, config and control-plane credential validation. */\n validateAsync(\n context: InfraExecutionContext,\n selection: InfraComputeSelection<P>,\n ): Promise<InfraResult<null>>;\n planAsync(\n context: InfraExecutionContext,\n selection: InfraComputeSelection<P>,\n ): Promise<InfraResult<readonly InfraPlanAction[]>>;\n ensureAsync(\n context: InfraExecutionContext,\n selection: InfraComputeSelection<P>,\n ): Promise
|
|
1
|
+
{"version":3,"file":"infraAdapters.js","sourceRoot":"","sources":["../../src/types/infraAdapters.ts"],"names":[],"mappings":"","sourcesContent":["import type { AppEnvironmentId } from '../environments';\nimport type { INFRA_ADAPTER_CATALOG } from '../infra/constants';\nimport type {\n InfraDestroyRequest,\n InfraGeneratedArtifact,\n InfraLedger,\n InfraOutput,\n InfraOwnedResource,\n InfraPlanAction,\n InfraResourceStatus,\n InfraResult,\n} from './infraLifecycle';\nimport type {\n InfraAdapterId,\n InfraComputeProviderId,\n InfraComputeSelection,\n InfraEnvironmentSpec,\n InfraRuntimeProviderId,\n InfraRuntimeSelection,\n} from './infraManifest';\nimport type { InfraControlPlaneCredentialRef, InfraSecretReference } from './infraSecrets';\nimport type { InfraComputeTarget } from './infraTargets';\nimport type { InfraWorkloadSpec } from './infraWorkload';\n\n/** Package exports must match this exact catalog entry; optional operations are advertised explicitly. */\nexport type InfraAdapterDescriptor<P extends InfraAdapterId = InfraAdapterId> = {\n [K in P]: (typeof INFRA_ADAPTER_CATALOG)[K] & {\n readonly operations?: readonly ('suspend' | 'resume' | 'generate' | 'diagnostics')[];\n };\n}[P];\n\n/** Trusted execution-only ports. Implementations must not serialize resolved credential values. */\nexport interface InfraExecutionContext {\n readonly projectId: string;\n readonly environment: AppEnvironmentId;\n readonly desired: InfraEnvironmentSpec;\n readonly previous?: InfraLedger;\n readonly signal?: AbortSignal;\n readonly credentials: {\n resolveAsync(\n reference: InfraControlPlaneCredentialRef,\n ): Promise<InfraResult<Readonly<Record<string, string>>>>;\n };\n readonly secrets: {\n resolveAsync(reference: InfraSecretReference): Promise<InfraResult<string>>;\n };\n}\n\nexport interface InfraReconcileResult {\n readonly resources: readonly InfraOwnedResource[];\n readonly outputs: readonly InfraOutput[];\n}\n\n/** Current portable compute state resolved without creating, updating or deleting resources. */\nexport interface InfraComputeSnapshot extends InfraReconcileResult {\n readonly targets: readonly InfraComputeTarget[];\n}\n\nexport interface InfraComputeAdapter<P extends InfraComputeProviderId = InfraComputeProviderId> {\n readonly descriptor: InfraAdapterDescriptor<P>;\n /** Read-only prerequisites, config and control-plane credential validation. */\n validateAsync(\n context: InfraExecutionContext,\n selection: InfraComputeSelection<P>,\n ): Promise<InfraResult<null>>;\n /** Read-only discovery for planning and stateless runtime projection. Missing compute is empty. */\n inspectAsync(\n context: InfraExecutionContext,\n selection: InfraComputeSelection<P>,\n ): Promise<InfraResult<InfraComputeSnapshot>>;\n planAsync(\n context: InfraExecutionContext,\n selection: InfraComputeSelection<P>,\n ): Promise<InfraResult<readonly InfraPlanAction[]>>;\n ensureAsync(\n context: InfraExecutionContext,\n selection: InfraComputeSelection<P>,\n ): Promise<InfraResult<InfraComputeSnapshot>>;\n statusAsync(context: InfraExecutionContext): Promise<InfraResult<readonly InfraResourceStatus[]>>;\n destroyAsync(\n context: InfraExecutionContext,\n request: InfraDestroyRequest,\n ): Promise<InfraResult<InfraReconcileResult>>;\n}\n\nexport interface InfraRuntimeDesiredState<\n P extends InfraRuntimeProviderId = InfraRuntimeProviderId,\n> {\n readonly selection: InfraRuntimeSelection<P>;\n readonly targets: readonly InfraComputeTarget[];\n readonly workloads: readonly InfraWorkloadSpec[];\n /** Previously resolved outputs available to portable workload value references. */\n readonly availableOutputs: readonly InfraOutput[];\n}\n\nexport interface InfraRuntimeAdapter<P extends InfraRuntimeProviderId = InfraRuntimeProviderId> {\n readonly descriptor: InfraAdapterDescriptor<P>;\n /** Read-only prerequisites and desired-state validation; no cluster creation. */\n validateAsync(\n context: InfraExecutionContext,\n desired: InfraRuntimeDesiredState<P>,\n ): Promise<InfraResult<null>>;\n planAsync(\n context: InfraExecutionContext,\n desired: InfraRuntimeDesiredState<P>,\n ): Promise<InfraResult<readonly InfraPlanAction[]>>;\n ensureAsync(\n context: InfraExecutionContext,\n desired: InfraRuntimeDesiredState<P>,\n ): Promise<InfraResult<InfraReconcileResult>>;\n statusAsync(\n context: InfraExecutionContext,\n desired: InfraRuntimeDesiredState<P>,\n ): Promise<InfraResult<readonly InfraResourceStatus[]>>;\n suspendAsync(\n context: InfraExecutionContext,\n desired: InfraRuntimeDesiredState<P>,\n ): Promise<InfraResult<InfraReconcileResult>>;\n destroyAsync(\n context: InfraExecutionContext,\n desired: InfraRuntimeDesiredState<P>,\n request: InfraDestroyRequest,\n ): Promise<InfraResult<InfraReconcileResult>>;\n generateAsync?(\n context: InfraExecutionContext,\n desired: InfraRuntimeDesiredState<P>,\n ): Promise<InfraResult<readonly InfraGeneratedArtifact[]>>;\n}\n\n/** A service can own several capabilities but contributes one deduplicated platform instance. */\nexport interface InfraServiceAdapter {\n readonly descriptor: InfraAdapterDescriptor<'supabase' | 'cerbos' | 'r2' | 'supabase-vault'>;\n /** Read-only service config, bootstrap credentials and dependency validation. */\n validateAsync(context: InfraExecutionContext): Promise<InfraResult<null>>;\n planAsync(context: InfraExecutionContext): Promise<InfraResult<readonly InfraPlanAction[]>>;\n desiredWorkloadsAsync(\n context: InfraExecutionContext,\n ): Promise<InfraResult<readonly InfraWorkloadSpec[]>>;\n reconcileAsync(\n context: InfraExecutionContext,\n runtimeOutputs: readonly InfraOutput[],\n ): Promise<InfraResult<InfraReconcileResult>>;\n statusAsync(context: InfraExecutionContext): Promise<InfraResult<readonly InfraResourceStatus[]>>;\n destroyAsync(\n context: InfraExecutionContext,\n request: InfraDestroyRequest,\n ): Promise<InfraResult<InfraReconcileResult>>;\n suspendAsync?(context: InfraExecutionContext): Promise<InfraResult<InfraReconcileResult>>;\n}\n"]}
|
package/package.json
CHANGED
package/src/infra-types.test.ts
CHANGED
|
@@ -5,12 +5,15 @@ import type {
|
|
|
5
5
|
InfraAdapterDescriptor,
|
|
6
6
|
InfraAuthSpec,
|
|
7
7
|
InfraAuthzSpec,
|
|
8
|
+
InfraComputeAdapter,
|
|
9
|
+
InfraComputeSnapshot,
|
|
8
10
|
InfraControlPlaneCredentialRef,
|
|
9
11
|
InfraDeploymentSpec,
|
|
10
12
|
InfraDestroyRequest,
|
|
11
13
|
InfraManifest,
|
|
12
14
|
InfraObjectStorageSpec,
|
|
13
15
|
InfraOutput,
|
|
16
|
+
InfraResult,
|
|
14
17
|
InfraRuntimeAdapter,
|
|
15
18
|
InfraRuntimeDesiredState,
|
|
16
19
|
InfraRuntimeProviderId,
|
|
@@ -108,3 +111,14 @@ it('requires runtime desired state for every target-dependent lifecycle operatio
|
|
|
108
111
|
|
|
109
112
|
expect(lifecycleBoundary).toEqual([true, true, true]);
|
|
110
113
|
});
|
|
114
|
+
|
|
115
|
+
it('requires read-only compute discovery separately from mutating ensure', () => {
|
|
116
|
+
type Adapter = InfraComputeAdapter<'local'>;
|
|
117
|
+
|
|
118
|
+
const computeBoundary: readonly [
|
|
119
|
+
Assignable<Awaited<ReturnType<Adapter['inspectAsync']>>, InfraResult<InfraComputeSnapshot>>,
|
|
120
|
+
Assignable<Awaited<ReturnType<Adapter['ensureAsync']>>, InfraResult<InfraComputeSnapshot>>,
|
|
121
|
+
] = [true, true];
|
|
122
|
+
|
|
123
|
+
expect(computeBoundary).toEqual([true, true]);
|
|
124
|
+
});
|
|
@@ -51,6 +51,11 @@ export interface InfraReconcileResult {
|
|
|
51
51
|
readonly outputs: readonly InfraOutput[];
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
/** Current portable compute state resolved without creating, updating or deleting resources. */
|
|
55
|
+
export interface InfraComputeSnapshot extends InfraReconcileResult {
|
|
56
|
+
readonly targets: readonly InfraComputeTarget[];
|
|
57
|
+
}
|
|
58
|
+
|
|
54
59
|
export interface InfraComputeAdapter<P extends InfraComputeProviderId = InfraComputeProviderId> {
|
|
55
60
|
readonly descriptor: InfraAdapterDescriptor<P>;
|
|
56
61
|
/** Read-only prerequisites, config and control-plane credential validation. */
|
|
@@ -58,6 +63,11 @@ export interface InfraComputeAdapter<P extends InfraComputeProviderId = InfraCom
|
|
|
58
63
|
context: InfraExecutionContext,
|
|
59
64
|
selection: InfraComputeSelection<P>,
|
|
60
65
|
): Promise<InfraResult<null>>;
|
|
66
|
+
/** Read-only discovery for planning and stateless runtime projection. Missing compute is empty. */
|
|
67
|
+
inspectAsync(
|
|
68
|
+
context: InfraExecutionContext,
|
|
69
|
+
selection: InfraComputeSelection<P>,
|
|
70
|
+
): Promise<InfraResult<InfraComputeSnapshot>>;
|
|
61
71
|
planAsync(
|
|
62
72
|
context: InfraExecutionContext,
|
|
63
73
|
selection: InfraComputeSelection<P>,
|
|
@@ -65,9 +75,7 @@ export interface InfraComputeAdapter<P extends InfraComputeProviderId = InfraCom
|
|
|
65
75
|
ensureAsync(
|
|
66
76
|
context: InfraExecutionContext,
|
|
67
77
|
selection: InfraComputeSelection<P>,
|
|
68
|
-
): Promise<
|
|
69
|
-
InfraResult<InfraReconcileResult & { readonly targets: readonly InfraComputeTarget[] }>
|
|
70
|
-
>;
|
|
78
|
+
): Promise<InfraResult<InfraComputeSnapshot>>;
|
|
71
79
|
statusAsync(context: InfraExecutionContext): Promise<InfraResult<readonly InfraResourceStatus[]>>;
|
|
72
80
|
destroyAsync(
|
|
73
81
|
context: InfraExecutionContext,
|