typekro 0.13.0 → 0.15.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/dist/.tsbuildinfo +1 -1
- package/dist/alchemy/deployers.d.ts +2 -2
- package/dist/alchemy/deployers.d.ts.map +1 -1
- package/dist/alchemy/deployers.js +12 -5
- package/dist/alchemy/deployers.js.map +1 -1
- package/dist/alchemy/index.d.ts +4 -2
- package/dist/alchemy/index.d.ts.map +1 -1
- package/dist/alchemy/index.js +4 -3
- package/dist/alchemy/index.js.map +1 -1
- package/dist/alchemy/resource-registration.d.ts +81 -19
- package/dist/alchemy/resource-registration.d.ts.map +1 -1
- package/dist/alchemy/resource-registration.js +296 -147
- package/dist/alchemy/resource-registration.js.map +1 -1
- package/dist/alchemy/types.d.ts +76 -8
- package/dist/alchemy/types.d.ts.map +1 -1
- package/dist/alchemy/wrapper.d.ts +0 -9
- package/dist/alchemy/wrapper.d.ts.map +1 -1
- package/dist/alchemy/wrapper.js +0 -15
- package/dist/alchemy/wrapper.js.map +1 -1
- package/dist/core/constants/brands.d.ts +1 -1
- package/dist/core/constants/brands.d.ts.map +1 -1
- package/dist/core/constants/brands.js +1 -1
- package/dist/core/constants/brands.js.map +1 -1
- package/dist/core/containers/image.d.ts +40 -43
- package/dist/core/containers/image.d.ts.map +1 -1
- package/dist/core/containers/image.js +52 -34
- package/dist/core/containers/image.js.map +1 -1
- package/dist/core/containers/index.d.ts +8 -12
- package/dist/core/containers/index.d.ts.map +1 -1
- package/dist/core/containers/index.js +8 -12
- package/dist/core/containers/index.js.map +1 -1
- package/dist/core/deployment/direct-factory.d.ts +14 -2
- package/dist/core/deployment/direct-factory.d.ts.map +1 -1
- package/dist/core/deployment/direct-factory.js +117 -21
- package/dist/core/deployment/direct-factory.js.map +1 -1
- package/dist/core/deployment/engine.d.ts +8 -5
- package/dist/core/deployment/engine.d.ts.map +1 -1
- package/dist/core/deployment/engine.js +36 -12
- package/dist/core/deployment/engine.js.map +1 -1
- package/dist/core/deployment/kro-factory.d.ts +33 -14
- package/dist/core/deployment/kro-factory.d.ts.map +1 -1
- package/dist/core/deployment/kro-factory.js +130 -164
- package/dist/core/deployment/kro-factory.js.map +1 -1
- package/dist/core/deployment/shared-utilities.d.ts +15 -4
- package/dist/core/deployment/shared-utilities.d.ts.map +1 -1
- package/dist/core/deployment/shared-utilities.js +47 -14
- package/dist/core/deployment/shared-utilities.js.map +1 -1
- package/dist/core/deployment/strategies/direct-strategy.d.ts.map +1 -1
- package/dist/core/deployment/strategies/direct-strategy.js +1 -2
- package/dist/core/deployment/strategies/direct-strategy.js.map +1 -1
- package/dist/core/deployment/strategies/index.d.ts +0 -1
- package/dist/core/deployment/strategies/index.d.ts.map +1 -1
- package/dist/core/deployment/strategies/index.js +0 -1
- package/dist/core/deployment/strategies/index.js.map +1 -1
- package/dist/core/types/deployment.d.ts +28 -42
- package/dist/core/types/deployment.d.ts.map +1 -1
- package/dist/core/types/resource-graph.d.ts +2 -6
- package/dist/core/types/resource-graph.d.ts.map +1 -1
- package/dist/core/types/schema.d.ts +0 -1
- package/dist/core/types/schema.d.ts.map +1 -1
- package/dist/core/types/serialization.d.ts +3 -7
- package/dist/core/types/serialization.d.ts.map +1 -1
- package/dist/factories/kubernetes/yaml/yaml-directory.d.ts.map +1 -1
- package/dist/factories/kubernetes/yaml/yaml-directory.js +2 -13
- package/dist/factories/kubernetes/yaml/yaml-directory.js.map +1 -1
- package/dist/factories/kubernetes/yaml/yaml-file.d.ts.map +1 -1
- package/dist/factories/kubernetes/yaml/yaml-file.js +2 -18
- package/dist/factories/kubernetes/yaml/yaml-file.js.map +1 -1
- package/dist/shared/brands.d.ts +0 -9
- package/dist/shared/brands.d.ts.map +1 -1
- package/dist/shared/brands.js +0 -9
- package/dist/shared/brands.js.map +1 -1
- package/package.json +6 -3
- package/dist/alchemy/deployment.d.ts +0 -12
- package/dist/alchemy/deployment.d.ts.map +0 -1
- package/dist/alchemy/deployment.js +0 -12
- package/dist/alchemy/deployment.js.map +0 -1
- package/dist/core/containers/resolve.d.ts +0 -14
- package/dist/core/containers/resolve.d.ts.map +0 -1
- package/dist/core/containers/resolve.js +0 -88
- package/dist/core/containers/resolve.js.map +0 -1
- package/dist/core/deployment/strategies/alchemy-strategy.d.ts +0 -109
- package/dist/core/deployment/strategies/alchemy-strategy.d.ts.map +0 -1
- package/dist/core/deployment/strategies/alchemy-strategy.js +0 -556
- package/dist/core/deployment/strategies/alchemy-strategy.js.map +0 -1
package/dist/alchemy/types.d.ts
CHANGED
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
* This module provides type definitions for alchemy integration
|
|
5
5
|
* with TypeKro resources.
|
|
6
6
|
*/
|
|
7
|
-
import type { Resource as AlchemyResource } from 'alchemy';
|
|
8
7
|
import type { KubernetesClientConfig } from '../core/kubernetes/client-provider.js';
|
|
9
|
-
import type { DeploymentOptions } from '../core/types/deployment.js';
|
|
8
|
+
import type { DeployedResource, DeploymentOptions } from '../core/types/deployment.js';
|
|
10
9
|
import type { Enhanced } from '../core/types/kubernetes.js';
|
|
11
10
|
import type { KroDeletionOptions } from './kro-delete.js';
|
|
12
11
|
/**
|
|
@@ -14,9 +13,11 @@ import type { KroDeletionOptions } from './kro-delete.js';
|
|
|
14
13
|
*/
|
|
15
14
|
export interface TypeKroDeployer {
|
|
16
15
|
/**
|
|
17
|
-
* Deploy a TypeKro resource to Kubernetes
|
|
16
|
+
* Deploy a TypeKro resource to Kubernetes. `seedResources` (direct mode) supplies the live state
|
|
17
|
+
* of resources deployed elsewhere (e.g. sibling alchemy resources) so this resource's
|
|
18
|
+
* cross-resource references/CEL resolve without redeploying them.
|
|
18
19
|
*/
|
|
19
|
-
deploy<T extends Enhanced<any, any>>(resource: T, options: DeploymentOptions): Promise<T>;
|
|
20
|
+
deploy<T extends Enhanced<any, any>>(resource: T, options: DeploymentOptions, seedResources?: DeployedResource[]): Promise<T>;
|
|
20
21
|
/**
|
|
21
22
|
* Delete a TypeKro resource from Kubernetes
|
|
22
23
|
*/
|
|
@@ -46,18 +47,67 @@ export interface TypeKroResourceProps<T extends Enhanced<any, any>> {
|
|
|
46
47
|
*/
|
|
47
48
|
deploymentStrategy: 'direct' | 'kro';
|
|
48
49
|
/**
|
|
49
|
-
*
|
|
50
|
+
* The resource's logical id within its composition graph (e.g. `webappDeployment`) — the id
|
|
51
|
+
* sibling resources' `KubernetesRef`s point at. Surfaced on the output so dependents can seed
|
|
52
|
+
* reference resolution against this resource's live state. Set by `toAlchemyResources`.
|
|
53
|
+
*/
|
|
54
|
+
resourceId?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Serializable kubeConfig options used to reach the cluster (and to reconnect on a rehydrated
|
|
57
|
+
* delete). Echoed onto the output so a state-driven delete works.
|
|
58
|
+
*
|
|
59
|
+
* ⚠️ SECURITY: alchemy persists props + output to its state store, so these options are written
|
|
60
|
+
* to state. If they carry static secrets — `user.token` / `user.certData` / `user.keyData` — those
|
|
61
|
+
* land in state (e.g. plaintext for the local/HTTP stores). Prefer re-derived auth (`user.exec`
|
|
62
|
+
* such as `aws eks get-token`, or `authProvider`), which is a command spec rather than a secret,
|
|
63
|
+
* and use a secured state backend. See {@link extractSerializableKubeConfigOptions}.
|
|
50
64
|
*/
|
|
51
65
|
kubeConfigOptions?: SerializableKubeConfigOptions;
|
|
52
66
|
/** Optional preconfigured deployer. Runtime-only; do not rely on this surviving Alchemy rehydration. */
|
|
53
67
|
deployer?: TypeKroDeployer;
|
|
54
68
|
/** Serializable metadata used to preserve finalizer-safe KRO teardown after Alchemy rehydration. */
|
|
55
69
|
kroDeletion?: KroDeletionOptions;
|
|
70
|
+
/**
|
|
71
|
+
* Resolved outputs of the resources this one depends on. Two jobs:
|
|
72
|
+
*
|
|
73
|
+
* 1. **Ordering** — because each entry traces back (via an alchemy `Output`) to another
|
|
74
|
+
* resource, alchemy deploys those first. KRO uses this so the CR instance waits for its
|
|
75
|
+
* RGD's CRD; direct mode uses it to honor the composition's dependency graph.
|
|
76
|
+
* 2. **Reference resolution (direct mode)** — each entry's `deployedResource` is the live
|
|
77
|
+
* dependency, so the reconcile can resolve this resource's cross-resource `KubernetesRef`s
|
|
78
|
+
* against already-deployed siblings before applying the (now concrete) single manifest.
|
|
79
|
+
*
|
|
80
|
+
* Populated by {@link AlchemyResourceDeclaration} + the `materializeAlchemyResources` helper,
|
|
81
|
+
* not by hand. By the time `reconcile` runs, alchemy has resolved these to concrete values.
|
|
82
|
+
*/
|
|
83
|
+
dependencies?: TypeKroResource<Enhanced<unknown, unknown>>[];
|
|
56
84
|
/**
|
|
57
85
|
* Optional deployment options
|
|
58
86
|
*/
|
|
59
87
|
options?: Partial<Omit<DeploymentOptions, 'mode' | 'namespace'>>;
|
|
60
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* A single declarative alchemy v2 resource to instantiate: a stable `id` plus the
|
|
91
|
+
* `props` to pass to `KroResource`. Produced by a factory's `toAlchemyResources(spec)`
|
|
92
|
+
* (the v2 analog of the removed imperative `deployWithAlchemy`) so callers can fan a
|
|
93
|
+
* KRO factory out into its independent state entries (the RGD + each CR instance):
|
|
94
|
+
*
|
|
95
|
+
* ```ts
|
|
96
|
+
* for (const { id, props } of await factory.toAlchemyResources(spec)) {
|
|
97
|
+
* yield* KroResource(id, props);
|
|
98
|
+
* }
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
export interface AlchemyResourceDeclaration {
|
|
102
|
+
readonly id: string;
|
|
103
|
+
readonly props: TypeKroResourceProps<Enhanced<unknown, unknown>>;
|
|
104
|
+
/**
|
|
105
|
+
* Ids of the other declarations (in the same array) this one must deploy after. The
|
|
106
|
+
* declarations are returned topologically sorted, and `materializeAlchemyResources` turns
|
|
107
|
+
* these into alchemy `Output` dependencies (ordering + direct-mode reference resolution).
|
|
108
|
+
*/
|
|
109
|
+
readonly dependsOn: readonly string[];
|
|
110
|
+
}
|
|
61
111
|
/**
|
|
62
112
|
* Alchemy resource state structure
|
|
63
113
|
*/
|
|
@@ -68,18 +118,36 @@ export interface AlchemyResourceState {
|
|
|
68
118
|
[key: string]: unknown;
|
|
69
119
|
}
|
|
70
120
|
/**
|
|
71
|
-
* Output returned after TypeKro resource deployment through alchemy
|
|
72
|
-
*
|
|
121
|
+
* Output returned after TypeKro resource deployment through alchemy.
|
|
122
|
+
*
|
|
123
|
+
* Under alchemy v2 a resource's output is a plain, serializable shape (the value
|
|
124
|
+
* `reconcile` returns and alchemy persists to state) — not an extension of a
|
|
125
|
+
* framework `Resource` type as it was under v1.
|
|
73
126
|
*/
|
|
74
|
-
export interface TypeKroResource<T extends Enhanced<any, any>>
|
|
127
|
+
export interface TypeKroResource<T extends Enhanced<any, any>> {
|
|
75
128
|
/**
|
|
76
129
|
* The original TypeKro resource
|
|
77
130
|
*/
|
|
78
131
|
resource: T;
|
|
132
|
+
/**
|
|
133
|
+
* The resource's logical composition-graph id (mirrors {@link TypeKroResourceProps.resourceId}).
|
|
134
|
+
* Lets a dependent reconcile match this resource against its `KubernetesRef`s when seeding
|
|
135
|
+
* direct-mode reference resolution. Undefined for resources not produced via `toAlchemyResources`.
|
|
136
|
+
*/
|
|
137
|
+
resourceId?: string;
|
|
79
138
|
/**
|
|
80
139
|
* The namespace the resource was deployed to
|
|
81
140
|
*/
|
|
82
141
|
namespace: string;
|
|
142
|
+
/**
|
|
143
|
+
* Persisted delete-time metadata: how the resource was deployed + how to reach/tear it down.
|
|
144
|
+
* Echoed from the props so a state-driven `delete` (no live `news`) can reconstruct them.
|
|
145
|
+
* ⚠️ SECURITY: `kubeConfigOptions` is persisted to alchemy state — see the note on
|
|
146
|
+
* {@link TypeKroResourceProps.kubeConfigOptions}.
|
|
147
|
+
*/
|
|
148
|
+
deploymentStrategy?: 'direct' | 'kro';
|
|
149
|
+
kubeConfigOptions?: SerializableKubeConfigOptions;
|
|
150
|
+
kroDeletion?: KroDeletionOptions;
|
|
83
151
|
/**
|
|
84
152
|
* The deployed resource with live status from the cluster
|
|
85
153
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/alchemy/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/alchemy/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Alchemy Integration Utilities
|
|
3
|
-
*
|
|
4
|
-
* This file contains utility functions that align with the dynamic registration approach.
|
|
5
|
-
* Static resource registration functions have been removed to avoid conflicts.
|
|
6
3
|
*/
|
|
7
4
|
import { generateDeterministicResourceId as _generateDeterministicResourceId } from '../core/resources/id.js';
|
|
8
|
-
/**
|
|
9
|
-
* Utility to check if a factory is alchemy-managed
|
|
10
|
-
*/
|
|
11
|
-
export declare function isAlchemyWrapped(factory: unknown): factory is {
|
|
12
|
-
isAlchemyManaged: true;
|
|
13
|
-
};
|
|
14
5
|
/**
|
|
15
6
|
* Re-export utility function for deterministic resource ID generation
|
|
16
7
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapper.d.ts","sourceRoot":"","sources":["../../src/alchemy/wrapper.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"wrapper.d.ts","sourceRoot":"","sources":["../../src/alchemy/wrapper.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,+BAA+B,IAAI,gCAAgC,EAAE,MAAM,yBAAyB,CAAC;AAE9G;;GAEG;AACH,eAAO,MAAM,+BAA+B,yCAAmC,CAAC"}
|
package/dist/alchemy/wrapper.js
CHANGED
|
@@ -1,24 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Alchemy Integration Utilities
|
|
3
|
-
*
|
|
4
|
-
* This file contains utility functions that align with the dynamic registration approach.
|
|
5
|
-
* Static resource registration functions have been removed to avoid conflicts.
|
|
6
3
|
*/
|
|
7
4
|
import { generateDeterministicResourceId as _generateDeterministicResourceId } from '../core/resources/id.js';
|
|
8
|
-
/**
|
|
9
|
-
* Utility to check if a factory is alchemy-managed
|
|
10
|
-
*/
|
|
11
|
-
export function isAlchemyWrapped(factory) {
|
|
12
|
-
return (factory !== null &&
|
|
13
|
-
factory !== undefined &&
|
|
14
|
-
typeof factory === 'object' &&
|
|
15
|
-
'isAlchemyManaged' in factory &&
|
|
16
|
-
factory.isAlchemyManaged === true);
|
|
17
|
-
}
|
|
18
5
|
/**
|
|
19
6
|
* Re-export utility function for deterministic resource ID generation
|
|
20
7
|
*/
|
|
21
8
|
export const generateDeterministicResourceId = _generateDeterministicResourceId;
|
|
22
|
-
// All static resource registration functions have been removed to align with
|
|
23
|
-
// the dynamic registration approach using ensureResourceTypeRegistered()
|
|
24
9
|
//# sourceMappingURL=wrapper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapper.js","sourceRoot":"","sources":["../../src/alchemy/wrapper.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"wrapper.js","sourceRoot":"","sources":["../../src/alchemy/wrapper.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,+BAA+B,IAAI,gCAAgC,EAAE,MAAM,yBAAyB,CAAC;AAE9G;;GAEG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,gCAAgC,CAAC"}
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* New code within `src/utils/` should import directly from `../../shared/brands.js`
|
|
6
6
|
* to maintain the clean dependency direction: `shared/ <-- utils/ <-- core/`.
|
|
7
7
|
*/
|
|
8
|
-
export { CALLABLE_COMPOSITION_BRAND, CEL_EXPRESSION_BRAND,
|
|
8
|
+
export { CALLABLE_COMPOSITION_BRAND, CEL_EXPRESSION_BRAND, KUBERNETES_REF_BRAND, KUBERNETES_REF_MARKER_FIELD_PATH_SOURCE, KUBERNETES_REF_MARKER_PATTERN, KUBERNETES_REF_MARKER_RESOURCE_ID_SOURCE, KUBERNETES_REF_MARKER_SOURCE, KUBERNETES_REF_SCHEMA_MARKER_SOURCE, MIXED_TEMPLATE_BRAND, NESTED_COMPOSITION_BRAND, SINGLETON_HANDLE_BRAND, } from '../../shared/brands.js';
|
|
9
9
|
//# sourceMappingURL=brands.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brands.d.ts","sourceRoot":"","sources":["../../../src/core/constants/brands.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,
|
|
1
|
+
{"version":3,"file":"brands.d.ts","sourceRoot":"","sources":["../../../src/core/constants/brands.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,oBAAoB,EACpB,uCAAuC,EACvC,6BAA6B,EAC7B,wCAAwC,EACxC,4BAA4B,EAC5B,mCAAmC,EACnC,oBAAoB,EACpB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,wBAAwB,CAAC"}
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* New code within `src/utils/` should import directly from `../../shared/brands.js`
|
|
6
6
|
* to maintain the clean dependency direction: `shared/ <-- utils/ <-- core/`.
|
|
7
7
|
*/
|
|
8
|
-
export { CALLABLE_COMPOSITION_BRAND, CEL_EXPRESSION_BRAND,
|
|
8
|
+
export { CALLABLE_COMPOSITION_BRAND, CEL_EXPRESSION_BRAND, KUBERNETES_REF_BRAND, KUBERNETES_REF_MARKER_FIELD_PATH_SOURCE, KUBERNETES_REF_MARKER_PATTERN, KUBERNETES_REF_MARKER_RESOURCE_ID_SOURCE, KUBERNETES_REF_MARKER_SOURCE, KUBERNETES_REF_SCHEMA_MARKER_SOURCE, MIXED_TEMPLATE_BRAND, NESTED_COMPOSITION_BRAND, SINGLETON_HANDLE_BRAND, } from '../../shared/brands.js';
|
|
9
9
|
//# sourceMappingURL=brands.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brands.js","sourceRoot":"","sources":["../../../src/core/constants/brands.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,
|
|
1
|
+
{"version":3,"file":"brands.js","sourceRoot":"","sources":["../../../src/core/constants/brands.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,oBAAoB,EACpB,uCAAuC,EACvC,6BAA6B,EAC7B,wCAAwC,EACxC,4BAA4B,EAC5B,mCAAmC,EACnC,oBAAoB,EACpB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,wBAAwB,CAAC"}
|
|
@@ -1,65 +1,62 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Container Image Utility
|
|
3
3
|
*
|
|
4
|
-
* `container()` declares a container image built from source and pushed to a registry
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* `container()` declares a container image built from source and pushed to a registry. It is the
|
|
5
|
+
* high-level front door over {@link buildContainer}: a memoized async builder that resolves to a
|
|
6
|
+
* SHAPED result (`{ imageUri, repository, tag }`) so callers can use the full URI for a resource's
|
|
7
|
+
* image field OR the split `repository`/`tag` for a Helm chart's image values — without re-splitting.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* An image build is an async, client-side, pre-deploy side effect, so `container()` is honest about
|
|
10
|
+
* that: you `await` it. It is NOT a deferred reference — resolve images in (async) setup code before
|
|
11
|
+
* composing, then feed the resulting literals into resources or chart values.
|
|
12
|
+
*
|
|
13
|
+
* Memoization: the build is keyed by container identity (`id ?? imageName`) and cached, so awaiting
|
|
14
|
+
* the same container many times (e.g. several deployments sharing one image) builds it exactly ONCE.
|
|
13
15
|
*
|
|
14
16
|
* @example
|
|
15
17
|
* ```typescript
|
|
16
18
|
* import { container } from 'typekro/containers';
|
|
17
19
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
+
* const img = await container({ context: './app', imageName: 'app', registry: { type: 'ecr' } });
|
|
21
|
+
* // img.imageUri → '123.dkr.ecr.us-east-1.amazonaws.com/app:sha-abc'
|
|
22
|
+
* // img.repository → '123.dkr.ecr.us-east-1.amazonaws.com/app' img.tag → 'sha-abc'
|
|
20
23
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* Deployment({ name: 'app', image: appImage.imageUri, ports: [{ containerPort: 3000 }] });
|
|
24
|
-
* });
|
|
24
|
+
* Deployment({ name: 'app', image: img.imageUri, ports: [{ containerPort: 3000 }] });
|
|
25
|
+
* // or for a Helm chart's split image values: { repository: img.repository, tag: img.tag }
|
|
25
26
|
* ```
|
|
26
27
|
*/
|
|
27
|
-
import {
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* A reference to a container image's URI. Resolved client-side to a literal string (the built +
|
|
31
|
-
* pushed image URI) before apply / RGD serialization — distinct from a `KubernetesRef`, which is a
|
|
32
|
-
* cluster-state reference serialized to CEL.
|
|
33
|
-
*/
|
|
34
|
-
export interface ContainerImageRef<T extends string = string> {
|
|
35
|
-
readonly [CONTAINER_IMAGE_REF_BRAND]: true;
|
|
36
|
-
/** Stable identity — multiple references to the same container build the image only ONCE. */
|
|
37
|
-
readonly containerId: string;
|
|
38
|
-
/** The build spec, carried inline so the resolver is self-contained (delegates to `buildContainer`). */
|
|
39
|
-
readonly buildOptions: ContainerBuildOptions;
|
|
40
|
-
readonly _type?: T;
|
|
41
|
-
}
|
|
42
|
-
/** A first-class container image: defined outside a composition, referenced within one. */
|
|
28
|
+
import type { ContainerBuildOptions, ContainerBuildResult } from './registries/types.js';
|
|
29
|
+
/** A built container image, resolved to a literal — both the full URI and its split parts. */
|
|
43
30
|
export interface ContainerImage {
|
|
44
|
-
/**
|
|
45
|
-
* The image-URI reference — assign to any resource image field (e.g. a container's `image`). Typed
|
|
46
|
-
* as `string` so it's assignable to plain string fields, exactly like typekro's schema/resource
|
|
47
|
-
* refs; at RUNTIME it is a branded {@link ContainerImageRef} that the resolver substitutes with the
|
|
48
|
-
* built image URI at deploy time. Use {@link isContainerImageRef} to detect it.
|
|
49
|
-
*/
|
|
31
|
+
/** Full image URI, e.g. `123.dkr.ecr.us-east-1.amazonaws.com/app:sha-abc`. */
|
|
50
32
|
readonly imageUri: string;
|
|
33
|
+
/** The URI without the tag, e.g. `123.dkr.ecr.us-east-1.amazonaws.com/app`. */
|
|
34
|
+
readonly repository: string;
|
|
35
|
+
/** The tag, e.g. `sha-abc`. */
|
|
36
|
+
readonly tag: string;
|
|
51
37
|
}
|
|
52
38
|
/** Options for {@link container}: the {@link ContainerBuildOptions} plus an optional stable identity. */
|
|
53
39
|
export interface ContainerOptions extends ContainerBuildOptions {
|
|
54
|
-
/** Stable identity for
|
|
40
|
+
/** Stable identity for build memoization; defaults to `imageName`. Set when two containers share one. */
|
|
55
41
|
id?: string;
|
|
56
42
|
}
|
|
57
43
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
|
|
44
|
+
* Split a full image URI into `{ repository, tag }`. Handles digest form (`repo@sha256:…`) and tag
|
|
45
|
+
* form (`repo:tag`), registry-port-colon aware (a colon in `host:port/...` is not the tag separator).
|
|
46
|
+
*/
|
|
47
|
+
export declare function splitImageUri(uri: string): {
|
|
48
|
+
repository: string;
|
|
49
|
+
tag: string;
|
|
50
|
+
};
|
|
51
|
+
/** Test seam: the builder `container()` delegates to (defaults to the real {@link buildContainer}). */
|
|
52
|
+
type Builder = (options: ContainerBuildOptions) => Promise<ContainerBuildResult>;
|
|
53
|
+
/**
|
|
54
|
+
* Build a container image (delegating to {@link buildContainer}) and resolve to its shaped result.
|
|
55
|
+
* Memoized by identity — see the module doc. `build` is an injectable test seam; production callers
|
|
56
|
+
* pass only `options`.
|
|
61
57
|
*/
|
|
62
|
-
export declare function container(options: ContainerOptions): ContainerImage
|
|
63
|
-
/**
|
|
64
|
-
export declare function
|
|
58
|
+
export declare function container(options: ContainerOptions, build?: Builder): Promise<ContainerImage>;
|
|
59
|
+
/** Clear the build memoization cache. Intended for tests/long-lived processes that need a rebuild. */
|
|
60
|
+
export declare function clearContainerCache(): void;
|
|
61
|
+
export {};
|
|
65
62
|
//# sourceMappingURL=image.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/core/containers/image.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/core/containers/image.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAGH,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAEzF,8FAA8F;AAC9F,MAAM,WAAW,cAAc;IAC7B,8EAA8E;IAC9E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,+EAA+E;IAC/E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,+BAA+B;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,yGAAyG;AACzG,MAAM,WAAW,gBAAiB,SAAQ,qBAAqB;IAC7D,yGAAyG;IACzG,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAQ9E;AAKD,uGAAuG;AACvG,KAAK,OAAO,GAAG,CAAC,OAAO,EAAE,qBAAqB,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;AASjF;;;;GAIG;AACH,wBAAgB,SAAS,CACvB,OAAO,EAAE,gBAAgB,EACzB,KAAK,GAAE,OAAwB,GAC9B,OAAO,CAAC,cAAc,CAAC,CAQzB;AAED,sGAAsG;AACtG,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C"}
|
|
@@ -1,51 +1,69 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Container Image Utility
|
|
3
3
|
*
|
|
4
|
-
* `container()` declares a container image built from source and pushed to a registry
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* `container()` declares a container image built from source and pushed to a registry. It is the
|
|
5
|
+
* high-level front door over {@link buildContainer}: a memoized async builder that resolves to a
|
|
6
|
+
* SHAPED result (`{ imageUri, repository, tag }`) so callers can use the full URI for a resource's
|
|
7
|
+
* image field OR the split `repository`/`tag` for a Helm chart's image values — without re-splitting.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* An image build is an async, client-side, pre-deploy side effect, so `container()` is honest about
|
|
10
|
+
* that: you `await` it. It is NOT a deferred reference — resolve images in (async) setup code before
|
|
11
|
+
* composing, then feed the resulting literals into resources or chart values.
|
|
12
|
+
*
|
|
13
|
+
* Memoization: the build is keyed by container identity (`id ?? imageName`) and cached, so awaiting
|
|
14
|
+
* the same container many times (e.g. several deployments sharing one image) builds it exactly ONCE.
|
|
13
15
|
*
|
|
14
16
|
* @example
|
|
15
17
|
* ```typescript
|
|
16
18
|
* import { container } from 'typekro/containers';
|
|
17
19
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
+
* const img = await container({ context: './app', imageName: 'app', registry: { type: 'ecr' } });
|
|
21
|
+
* // img.imageUri → '123.dkr.ecr.us-east-1.amazonaws.com/app:sha-abc'
|
|
22
|
+
* // img.repository → '123.dkr.ecr.us-east-1.amazonaws.com/app' img.tag → 'sha-abc'
|
|
20
23
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* Deployment({ name: 'app', image: appImage.imageUri, ports: [{ containerPort: 3000 }] });
|
|
24
|
-
* });
|
|
24
|
+
* Deployment({ name: 'app', image: img.imageUri, ports: [{ containerPort: 3000 }] });
|
|
25
|
+
* // or for a Helm chart's split image values: { repository: img.repository, tag: img.tag }
|
|
25
26
|
* ```
|
|
26
27
|
*/
|
|
27
|
-
import {
|
|
28
|
+
import { buildContainer } from './build.js';
|
|
29
|
+
/**
|
|
30
|
+
* Split a full image URI into `{ repository, tag }`. Handles digest form (`repo@sha256:…`) and tag
|
|
31
|
+
* form (`repo:tag`), registry-port-colon aware (a colon in `host:port/...` is not the tag separator).
|
|
32
|
+
*/
|
|
33
|
+
export function splitImageUri(uri) {
|
|
34
|
+
const at = uri.lastIndexOf('@');
|
|
35
|
+
if (at !== -1)
|
|
36
|
+
return { repository: uri.slice(0, at), tag: uri.slice(at + 1) };
|
|
37
|
+
const colon = uri.lastIndexOf(':');
|
|
38
|
+
const slash = uri.lastIndexOf('/');
|
|
39
|
+
return colon > slash
|
|
40
|
+
? { repository: uri.slice(0, colon), tag: uri.slice(colon + 1) }
|
|
41
|
+
: { repository: uri, tag: 'latest' };
|
|
42
|
+
}
|
|
43
|
+
/** Build memoization, keyed by container identity (`id ?? imageName`) — builds each image once. */
|
|
44
|
+
const buildCache = new Map();
|
|
45
|
+
async function buildAndShape(options, build) {
|
|
46
|
+
const { id: _id, ...buildOptions } = options;
|
|
47
|
+
const result = await build({ ...buildOptions, tag: buildOptions.tag ?? 'content-hash' });
|
|
48
|
+
const { repository, tag } = splitImageUri(result.imageUri);
|
|
49
|
+
return { imageUri: result.imageUri, repository, tag };
|
|
50
|
+
}
|
|
28
51
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
52
|
+
* Build a container image (delegating to {@link buildContainer}) and resolve to its shaped result.
|
|
53
|
+
* Memoized by identity — see the module doc. `build` is an injectable test seam; production callers
|
|
54
|
+
* pass only `options`.
|
|
32
55
|
*/
|
|
33
|
-
export function container(options) {
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
// Typed as `string` (assignable to any image field) but a branded ref at runtime — mirrors how
|
|
42
|
-
// typekro's schema/resource refs present as their underlying type while carrying runtime markers.
|
|
43
|
-
return { imageUri: ref };
|
|
56
|
+
export function container(options, build = buildContainer) {
|
|
57
|
+
const key = options.id ?? options.imageName;
|
|
58
|
+
let pending = buildCache.get(key);
|
|
59
|
+
if (!pending) {
|
|
60
|
+
pending = buildAndShape(options, build);
|
|
61
|
+
buildCache.set(key, pending);
|
|
62
|
+
}
|
|
63
|
+
return pending;
|
|
44
64
|
}
|
|
45
|
-
/**
|
|
46
|
-
export function
|
|
47
|
-
|
|
48
|
-
value !== null &&
|
|
49
|
-
value[CONTAINER_IMAGE_REF_BRAND] === true);
|
|
65
|
+
/** Clear the build memoization cache. Intended for tests/long-lived processes that need a rebuild. */
|
|
66
|
+
export function clearContainerCache() {
|
|
67
|
+
buildCache.clear();
|
|
50
68
|
}
|
|
51
69
|
//# sourceMappingURL=image.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.js","sourceRoot":"","sources":["../../../src/core/containers/image.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"image.js","sourceRoot":"","sources":["../../../src/core/containers/image.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAmB5C;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,MAAM,EAAE,GAAG,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAChC,IAAI,EAAE,KAAK,CAAC,CAAC;QAAE,OAAO,EAAE,UAAU,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;IAC/E,MAAM,KAAK,GAAG,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACnC,MAAM,KAAK,GAAG,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACnC,OAAO,KAAK,GAAG,KAAK;QAClB,CAAC,CAAC,EAAE,UAAU,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE;QAChE,CAAC,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC;AACzC,CAAC;AAED,mGAAmG;AACnG,MAAM,UAAU,GAAG,IAAI,GAAG,EAAmC,CAAC;AAK9D,KAAK,UAAU,aAAa,CAAC,OAAyB,EAAE,KAAc;IACpE,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,YAAY,EAAE,GAAG,OAAO,CAAC;IAC7C,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,EAAE,GAAG,YAAY,EAAE,GAAG,EAAE,YAAY,CAAC,GAAG,IAAI,cAAc,EAAE,CAAC,CAAC;IACzF,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC;AACxD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CACvB,OAAyB,EACzB,QAAiB,cAAc;IAE/B,MAAM,GAAG,GAAG,OAAO,CAAC,EAAE,IAAI,OAAO,CAAC,SAAS,CAAC;IAC5C,IAAI,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,GAAG,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACxC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,sGAAsG;AACtG,MAAM,UAAU,mBAAmB;IACjC,UAAU,CAAC,KAAK,EAAE,CAAC;AACrB,CAAC"}
|
|
@@ -5,25 +5,21 @@
|
|
|
5
5
|
* Returns image URIs for use in TypeKro compositions.
|
|
6
6
|
*
|
|
7
7
|
* The low-level `buildContainer` builds + pushes imperatively and returns a URI. The higher-level
|
|
8
|
-
* `container()`
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* `container()` is a memoized async builder that resolves to a SHAPED result (`{ imageUri,
|
|
9
|
+
* repository, tag }`) — `await` it in setup code, then feed the full URI to a resource's image field
|
|
10
|
+
* or the split `repository`/`tag` to a Helm chart's image values.
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
13
13
|
* ```typescript
|
|
14
|
-
* import {
|
|
14
|
+
* import { container } from 'typekro/containers';
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* // Declarative (defined outside a composition, referenced within):
|
|
20
|
-
* const appImage = container({ context: './app', imageName: 'app', registry: { type: 'ecr' } });
|
|
21
|
-
* // … later, inside a composition: Deployment({ image: appImage.imageUri, … })
|
|
16
|
+
* const img = await container({ context: './app', imageName: 'app', registry: { type: 'ecr' } });
|
|
17
|
+
* Deployment({ image: img.imageUri, … }); // full URI
|
|
18
|
+
* // or chart values: { repository: img.repository, tag: img.tag }
|
|
22
19
|
* ```
|
|
23
20
|
*/
|
|
24
21
|
export { buildContainer } from './build.js';
|
|
25
22
|
export { ContainerBuildError } from './errors.js';
|
|
26
|
-
export {
|
|
27
|
-
export { hasContainerImageRefs, resolveContainerImages } from './resolve.js';
|
|
23
|
+
export { type ContainerImage, type ContainerOptions, clearContainerCache, container, splitImageUri, } from './image.js';
|
|
28
24
|
export type { ContainerBuildOptions, ContainerBuildResult, EcrRegistryConfig, OrbstackRegistryConfig, RegistryConfig, } from './registries/types.js';
|
|
29
25
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/containers/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/containers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,mBAAmB,EACnB,SAAS,EACT,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,sBAAsB,EACtB,cAAc,GACf,MAAM,uBAAuB,CAAC"}
|
|
@@ -5,24 +5,20 @@
|
|
|
5
5
|
* Returns image URIs for use in TypeKro compositions.
|
|
6
6
|
*
|
|
7
7
|
* The low-level `buildContainer` builds + pushes imperatively and returns a URI. The higher-level
|
|
8
|
-
* `container()`
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* `container()` is a memoized async builder that resolves to a SHAPED result (`{ imageUri,
|
|
9
|
+
* repository, tag }`) — `await` it in setup code, then feed the full URI to a resource's image field
|
|
10
|
+
* or the split `repository`/`tag` to a Helm chart's image values.
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
13
13
|
* ```typescript
|
|
14
|
-
* import {
|
|
14
|
+
* import { container } from 'typekro/containers';
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* // Declarative (defined outside a composition, referenced within):
|
|
20
|
-
* const appImage = container({ context: './app', imageName: 'app', registry: { type: 'ecr' } });
|
|
21
|
-
* // … later, inside a composition: Deployment({ image: appImage.imageUri, … })
|
|
16
|
+
* const img = await container({ context: './app', imageName: 'app', registry: { type: 'ecr' } });
|
|
17
|
+
* Deployment({ image: img.imageUri, … }); // full URI
|
|
18
|
+
* // or chart values: { repository: img.repository, tag: img.tag }
|
|
22
19
|
* ```
|
|
23
20
|
*/
|
|
24
21
|
export { buildContainer } from './build.js';
|
|
25
22
|
export { ContainerBuildError } from './errors.js';
|
|
26
|
-
export { container,
|
|
27
|
-
export { hasContainerImageRefs, resolveContainerImages } from './resolve.js';
|
|
23
|
+
export { clearContainerCache, container, splitImageUri, } from './image.js';
|
|
28
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/containers/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/containers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAGL,mBAAmB,EACnB,SAAS,EACT,aAAa,GACd,MAAM,YAAY,CAAC"}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import type { DeploymentClosure, DeploymentError, DeploymentResourceGraph, DeploymentResult, DirectResourceFactory, FactoryOptions, FactoryStatus, RollbackResult } from '../types/deployment.js';
|
|
8
8
|
import type { Enhanced, KubernetesResource } from '../types/kubernetes.js';
|
|
9
9
|
import type { KroCompatibleType, SchemaDefinition, StatusBuilder } from '../types/serialization.js';
|
|
10
|
+
import type { AlchemyResourceDeclaration } from '../../alchemy/types.js';
|
|
10
11
|
/**
|
|
11
12
|
* DirectResourceFactory implementation
|
|
12
13
|
*
|
|
@@ -17,13 +18,11 @@ export declare class DirectResourceFactoryImpl<TSpec extends KroCompatibleType,
|
|
|
17
18
|
readonly mode: "direct";
|
|
18
19
|
readonly name: string;
|
|
19
20
|
readonly namespace: string;
|
|
20
|
-
readonly isAlchemyManaged: boolean;
|
|
21
21
|
private readonly resources;
|
|
22
22
|
private readonly closures;
|
|
23
23
|
private readonly schemaDefinition;
|
|
24
24
|
private readonly statusBuilder;
|
|
25
25
|
private deploymentEngine;
|
|
26
|
-
private readonly alchemyScope;
|
|
27
26
|
private readonly factoryOptions;
|
|
28
27
|
private readonly singletonDefinitions;
|
|
29
28
|
private readonly singletonOwnerStatuses;
|
|
@@ -156,6 +155,19 @@ export declare class DirectResourceFactoryImpl<TSpec extends KroCompatibleType,
|
|
|
156
155
|
* Create a resource graph for a specific instance
|
|
157
156
|
*/
|
|
158
157
|
createResourceGraphForInstance(spec: TSpec, instanceNameOverride?: string): DeploymentResourceGraph;
|
|
158
|
+
/**
|
|
159
|
+
* Emit this composition's resolved resources as declarative alchemy **v2** resources — one
|
|
160
|
+
* {@link AlchemyResourceDeclaration} per Kubernetes resource (matching the v1 integration's
|
|
161
|
+
* per-resource state granularity), topologically ordered with `dependsOn` wired from the
|
|
162
|
+
* composition's dependency graph. The v2 analog of the removed imperative direct-mode alchemy
|
|
163
|
+
* deploy. Instantiate them with `materializeAlchemyResources(KroResource, …)`, which turns
|
|
164
|
+
* `dependsOn` into alchemy `Output` edges so (a) each resource deploys only after the resources
|
|
165
|
+
* it references and (b) each reconcile resolves its cross-resource `KubernetesRef`s against those
|
|
166
|
+
* dependencies' live state before applying.
|
|
167
|
+
*/
|
|
168
|
+
toAlchemyResources(spec: TSpec, opts?: {
|
|
169
|
+
instanceNameOverride?: string;
|
|
170
|
+
}): Promise<AlchemyResourceDeclaration[]>;
|
|
159
171
|
/**
|
|
160
172
|
* Resolve resources for a specific spec
|
|
161
173
|
* This uses composition re-execution when available, or falls back to reference resolution
|