@ankhorage/contracts 20.0.0 → 21.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,11 @@
|
|
|
1
1
|
# @ankhorage/contracts
|
|
2
2
|
|
|
3
|
+
## 21.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 94a9eb0: Add a provider-neutral control-plane credential port with optional lookup and explicit persistence, and add an optional service preparation phase for mutating infrastructure lifecycle orchestration.
|
|
8
|
+
|
|
3
9
|
## 20.0.0
|
|
4
10
|
|
|
5
11
|
### Major Changes
|
|
@@ -11,6 +11,15 @@ export type InfraAdapterDescriptor<P extends InfraAdapterId = InfraAdapterId> =
|
|
|
11
11
|
readonly operations?: readonly ('suspend' | 'resume' | 'generate' | 'diagnostics')[];
|
|
12
12
|
};
|
|
13
13
|
}[P];
|
|
14
|
+
/** Trusted execution-only control-plane credential lookup, resolution and persistence. */
|
|
15
|
+
export interface InfraCredentialPort {
|
|
16
|
+
/** Return a credential bundle when present; absence is not an error. */
|
|
17
|
+
findAsync(reference: InfraControlPlaneCredentialRef): Promise<InfraResult<Readonly<Record<string, string>> | null>>;
|
|
18
|
+
/** Resolve a required credential bundle; absence is an error. */
|
|
19
|
+
resolveAsync(reference: InfraControlPlaneCredentialRef): Promise<InfraResult<Readonly<Record<string, string>>>>;
|
|
20
|
+
/** Persist an opaque provider-owned credential bundle without exposing its schema to the host. */
|
|
21
|
+
persistAsync(reference: InfraControlPlaneCredentialRef, values: Readonly<Record<string, string>>): Promise<InfraResult<null>>;
|
|
22
|
+
}
|
|
14
23
|
/** Trusted execution-only ports. Implementations must not serialize resolved credential values. */
|
|
15
24
|
export interface InfraExecutionContext {
|
|
16
25
|
readonly projectId: string;
|
|
@@ -18,9 +27,7 @@ export interface InfraExecutionContext {
|
|
|
18
27
|
readonly desired: InfraEnvironmentSpec;
|
|
19
28
|
readonly previous?: InfraLedger;
|
|
20
29
|
readonly signal?: AbortSignal;
|
|
21
|
-
readonly credentials:
|
|
22
|
-
resolveAsync(reference: InfraControlPlaneCredentialRef): Promise<InfraResult<Readonly<Record<string, string>>>>;
|
|
23
|
-
};
|
|
30
|
+
readonly credentials: InfraCredentialPort;
|
|
24
31
|
readonly secrets: {
|
|
25
32
|
resolveAsync(reference: InfraSecretReference): Promise<InfraResult<string>>;
|
|
26
33
|
};
|
|
@@ -68,6 +75,8 @@ export interface InfraServiceAdapter {
|
|
|
68
75
|
/** Read-only service config, bootstrap credentials and dependency validation. */
|
|
69
76
|
validateAsync(context: InfraExecutionContext): Promise<InfraResult<null>>;
|
|
70
77
|
planAsync(context: InfraExecutionContext): Promise<InfraResult<readonly InfraPlanAction[]>>;
|
|
78
|
+
/** Mutating pre-runtime preparation invoked only by an orchestrated `up` operation. */
|
|
79
|
+
prepareAsync?(context: InfraExecutionContext): Promise<InfraResult<null>>;
|
|
71
80
|
desiredWorkloadsAsync(context: InfraExecutionContext): Promise<InfraResult<readonly InfraWorkloadSpec[]>>;
|
|
72
81
|
reconcileAsync(context: InfraExecutionContext, runtimeOutputs: readonly InfraOutput[]): Promise<InfraResult<InfraReconcileResult>>;
|
|
73
82
|
statusAsync(context: InfraExecutionContext): Promise<InfraResult<readonly InfraResourceStatus[]>>;
|
|
@@ -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,cA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AAC,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:
|
|
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 control-plane credential lookup, resolution and persistence. */\nexport interface InfraCredentialPort {\n /** Return a credential bundle when present; absence is not an error. */\n findAsync(\n reference: InfraControlPlaneCredentialRef,\n ): Promise<InfraResult<Readonly<Record<string, string>> | null>>;\n /** Resolve a required credential bundle; absence is an error. */\n resolveAsync(\n reference: InfraControlPlaneCredentialRef,\n ): Promise<InfraResult<Readonly<Record<string, string>>>>;\n /** Persist an opaque provider-owned credential bundle without exposing its schema to the host. */\n persistAsync(\n reference: InfraControlPlaneCredentialRef,\n values: Readonly<Record<string, string>>,\n ): Promise<InfraResult<null>>;\n}\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: InfraCredentialPort;\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 /** Mutating pre-runtime preparation invoked only by an orchestrated `up` operation. */\n prepareAsync?(context: InfraExecutionContext): Promise<InfraResult<null>>;\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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/contracts",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "21.0.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"ankh": {
|
|
6
6
|
"category": "contracts",
|
|
@@ -97,18 +97,19 @@
|
|
|
97
97
|
},
|
|
98
98
|
"description": "Serializable app, action, theme, auth, and secret-store contracts for Ankhorage.",
|
|
99
99
|
"keywords": [
|
|
100
|
-
"
|
|
100
|
+
"adapter",
|
|
101
|
+
"ankhorage",
|
|
102
|
+
"assets",
|
|
103
|
+
"auth",
|
|
101
104
|
"contracts",
|
|
102
|
-
"schema",
|
|
103
105
|
"manifest",
|
|
104
|
-
"auth",
|
|
105
|
-
"secrets",
|
|
106
|
-
"secret-store",
|
|
107
|
-
"storage",
|
|
108
|
-
"adapter",
|
|
109
106
|
"media",
|
|
110
107
|
"navigator",
|
|
111
|
-
"
|
|
108
|
+
"schema",
|
|
109
|
+
"secret-store",
|
|
110
|
+
"secrets",
|
|
111
|
+
"storage",
|
|
112
|
+
"typescript"
|
|
112
113
|
],
|
|
113
114
|
"files": [
|
|
114
115
|
"dist",
|
package/src/infra-types.test.ts
CHANGED
|
@@ -8,8 +8,10 @@ import type {
|
|
|
8
8
|
InfraComputeAdapter,
|
|
9
9
|
InfraComputeSnapshot,
|
|
10
10
|
InfraControlPlaneCredentialRef,
|
|
11
|
+
InfraCredentialPort,
|
|
11
12
|
InfraDeploymentSpec,
|
|
12
13
|
InfraDestroyRequest,
|
|
14
|
+
InfraExecutionContext,
|
|
13
15
|
InfraManifest,
|
|
14
16
|
InfraObjectStorageSpec,
|
|
15
17
|
InfraOutput,
|
|
@@ -17,6 +19,7 @@ import type {
|
|
|
17
19
|
InfraRuntimeAdapter,
|
|
18
20
|
InfraRuntimeDesiredState,
|
|
19
21
|
InfraRuntimeProviderId,
|
|
22
|
+
InfraServiceAdapter,
|
|
20
23
|
} from './infra';
|
|
21
24
|
import type { AppStateSpec } from './state';
|
|
22
25
|
|
|
@@ -122,3 +125,27 @@ it('requires read-only compute discovery separately from mutating ensure', () =>
|
|
|
122
125
|
|
|
123
126
|
expect(computeBoundary).toEqual([true, true]);
|
|
124
127
|
});
|
|
128
|
+
|
|
129
|
+
it('shares one generic credential port and optional service preparation lifecycle', () => {
|
|
130
|
+
type CredentialBundle = Readonly<Record<string, string>>;
|
|
131
|
+
type Service = InfraServiceAdapter;
|
|
132
|
+
|
|
133
|
+
const boundary: readonly [
|
|
134
|
+
Assignable<InfraExecutionContext['credentials'], InfraCredentialPort>,
|
|
135
|
+
Assignable<
|
|
136
|
+
Awaited<ReturnType<InfraCredentialPort['findAsync']>>,
|
|
137
|
+
InfraResult<CredentialBundle | null>
|
|
138
|
+
>,
|
|
139
|
+
Assignable<
|
|
140
|
+
Awaited<ReturnType<InfraCredentialPort['resolveAsync']>>,
|
|
141
|
+
InfraResult<CredentialBundle>
|
|
142
|
+
>,
|
|
143
|
+
Assignable<Awaited<ReturnType<InfraCredentialPort['persistAsync']>>, InfraResult<null>>,
|
|
144
|
+
Assignable<
|
|
145
|
+
Exclude<Service['prepareAsync'], undefined>,
|
|
146
|
+
(context: InfraExecutionContext) => Promise<InfraResult<null>>
|
|
147
|
+
>,
|
|
148
|
+
] = [true, true, true, true, true];
|
|
149
|
+
|
|
150
|
+
expect(boundary).toEqual([true, true, true, true, true]);
|
|
151
|
+
});
|
|
@@ -29,6 +29,23 @@ export type InfraAdapterDescriptor<P extends InfraAdapterId = InfraAdapterId> =
|
|
|
29
29
|
};
|
|
30
30
|
}[P];
|
|
31
31
|
|
|
32
|
+
/** Trusted execution-only control-plane credential lookup, resolution and persistence. */
|
|
33
|
+
export interface InfraCredentialPort {
|
|
34
|
+
/** Return a credential bundle when present; absence is not an error. */
|
|
35
|
+
findAsync(
|
|
36
|
+
reference: InfraControlPlaneCredentialRef,
|
|
37
|
+
): Promise<InfraResult<Readonly<Record<string, string>> | null>>;
|
|
38
|
+
/** Resolve a required credential bundle; absence is an error. */
|
|
39
|
+
resolveAsync(
|
|
40
|
+
reference: InfraControlPlaneCredentialRef,
|
|
41
|
+
): Promise<InfraResult<Readonly<Record<string, string>>>>;
|
|
42
|
+
/** Persist an opaque provider-owned credential bundle without exposing its schema to the host. */
|
|
43
|
+
persistAsync(
|
|
44
|
+
reference: InfraControlPlaneCredentialRef,
|
|
45
|
+
values: Readonly<Record<string, string>>,
|
|
46
|
+
): Promise<InfraResult<null>>;
|
|
47
|
+
}
|
|
48
|
+
|
|
32
49
|
/** Trusted execution-only ports. Implementations must not serialize resolved credential values. */
|
|
33
50
|
export interface InfraExecutionContext {
|
|
34
51
|
readonly projectId: string;
|
|
@@ -36,11 +53,7 @@ export interface InfraExecutionContext {
|
|
|
36
53
|
readonly desired: InfraEnvironmentSpec;
|
|
37
54
|
readonly previous?: InfraLedger;
|
|
38
55
|
readonly signal?: AbortSignal;
|
|
39
|
-
readonly credentials:
|
|
40
|
-
resolveAsync(
|
|
41
|
-
reference: InfraControlPlaneCredentialRef,
|
|
42
|
-
): Promise<InfraResult<Readonly<Record<string, string>>>>;
|
|
43
|
-
};
|
|
56
|
+
readonly credentials: InfraCredentialPort;
|
|
44
57
|
readonly secrets: {
|
|
45
58
|
resolveAsync(reference: InfraSecretReference): Promise<InfraResult<string>>;
|
|
46
59
|
};
|
|
@@ -133,6 +146,8 @@ export interface InfraServiceAdapter {
|
|
|
133
146
|
/** Read-only service config, bootstrap credentials and dependency validation. */
|
|
134
147
|
validateAsync(context: InfraExecutionContext): Promise<InfraResult<null>>;
|
|
135
148
|
planAsync(context: InfraExecutionContext): Promise<InfraResult<readonly InfraPlanAction[]>>;
|
|
149
|
+
/** Mutating pre-runtime preparation invoked only by an orchestrated `up` operation. */
|
|
150
|
+
prepareAsync?(context: InfraExecutionContext): Promise<InfraResult<null>>;
|
|
136
151
|
desiredWorkloadsAsync(
|
|
137
152
|
context: InfraExecutionContext,
|
|
138
153
|
): Promise<InfraResult<readonly InfraWorkloadSpec[]>>;
|