typekro 0.14.0 → 0.15.1

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.
Files changed (79) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/alchemy/deployers.d.ts +2 -2
  3. package/dist/alchemy/deployers.d.ts.map +1 -1
  4. package/dist/alchemy/deployers.js +12 -5
  5. package/dist/alchemy/deployers.js.map +1 -1
  6. package/dist/alchemy/index.d.ts +4 -2
  7. package/dist/alchemy/index.d.ts.map +1 -1
  8. package/dist/alchemy/index.js +4 -3
  9. package/dist/alchemy/index.js.map +1 -1
  10. package/dist/alchemy/resource-registration.d.ts +81 -19
  11. package/dist/alchemy/resource-registration.d.ts.map +1 -1
  12. package/dist/alchemy/resource-registration.js +296 -147
  13. package/dist/alchemy/resource-registration.js.map +1 -1
  14. package/dist/alchemy/types.d.ts +76 -8
  15. package/dist/alchemy/types.d.ts.map +1 -1
  16. package/dist/alchemy/wrapper.d.ts +0 -9
  17. package/dist/alchemy/wrapper.d.ts.map +1 -1
  18. package/dist/alchemy/wrapper.js +0 -15
  19. package/dist/alchemy/wrapper.js.map +1 -1
  20. package/dist/core/deployment/direct-factory.d.ts +14 -2
  21. package/dist/core/deployment/direct-factory.d.ts.map +1 -1
  22. package/dist/core/deployment/direct-factory.js +117 -14
  23. package/dist/core/deployment/direct-factory.js.map +1 -1
  24. package/dist/core/deployment/engine.d.ts +8 -5
  25. package/dist/core/deployment/engine.d.ts.map +1 -1
  26. package/dist/core/deployment/engine.js +36 -12
  27. package/dist/core/deployment/engine.js.map +1 -1
  28. package/dist/core/deployment/kro-factory.d.ts +35 -9
  29. package/dist/core/deployment/kro-factory.d.ts.map +1 -1
  30. package/dist/core/deployment/kro-factory.js +143 -151
  31. package/dist/core/deployment/kro-factory.js.map +1 -1
  32. package/dist/core/deployment/shared-utilities.d.ts +15 -4
  33. package/dist/core/deployment/shared-utilities.d.ts.map +1 -1
  34. package/dist/core/deployment/shared-utilities.js +47 -14
  35. package/dist/core/deployment/shared-utilities.js.map +1 -1
  36. package/dist/core/deployment/strategies/direct-strategy.d.ts.map +1 -1
  37. package/dist/core/deployment/strategies/direct-strategy.js +1 -2
  38. package/dist/core/deployment/strategies/direct-strategy.js.map +1 -1
  39. package/dist/core/deployment/strategies/index.d.ts +0 -1
  40. package/dist/core/deployment/strategies/index.d.ts.map +1 -1
  41. package/dist/core/deployment/strategies/index.js +0 -1
  42. package/dist/core/deployment/strategies/index.js.map +1 -1
  43. package/dist/core/expressions/composition/composition-analyzer-helpers.d.ts +0 -13
  44. package/dist/core/expressions/composition/composition-analyzer-helpers.d.ts.map +1 -1
  45. package/dist/core/expressions/composition/composition-analyzer-helpers.js +78 -1
  46. package/dist/core/expressions/composition/composition-analyzer-helpers.js.map +1 -1
  47. package/dist/core/expressions/composition/imperative-analyzer.d.ts.map +1 -1
  48. package/dist/core/expressions/composition/imperative-analyzer.js +34 -1
  49. package/dist/core/expressions/composition/imperative-analyzer.js.map +1 -1
  50. package/dist/core/serialization/cel-references.d.ts +1 -1
  51. package/dist/core/serialization/cel-references.d.ts.map +1 -1
  52. package/dist/core/serialization/cel-references.js +19 -3
  53. package/dist/core/serialization/cel-references.js.map +1 -1
  54. package/dist/core/serialization/core.d.ts.map +1 -1
  55. package/dist/core/serialization/core.js +19 -4
  56. package/dist/core/serialization/core.js.map +1 -1
  57. package/dist/core/types/deployment.d.ts +28 -42
  58. package/dist/core/types/deployment.d.ts.map +1 -1
  59. package/dist/core/types/resource-graph.d.ts +2 -6
  60. package/dist/core/types/resource-graph.d.ts.map +1 -1
  61. package/dist/core/types/schema.d.ts +0 -1
  62. package/dist/core/types/schema.d.ts.map +1 -1
  63. package/dist/core/types/serialization.d.ts +3 -7
  64. package/dist/core/types/serialization.d.ts.map +1 -1
  65. package/dist/factories/kubernetes/yaml/yaml-directory.d.ts.map +1 -1
  66. package/dist/factories/kubernetes/yaml/yaml-directory.js +2 -13
  67. package/dist/factories/kubernetes/yaml/yaml-directory.js.map +1 -1
  68. package/dist/factories/kubernetes/yaml/yaml-file.d.ts.map +1 -1
  69. package/dist/factories/kubernetes/yaml/yaml-file.js +2 -18
  70. package/dist/factories/kubernetes/yaml/yaml-file.js.map +1 -1
  71. package/package.json +6 -3
  72. package/dist/alchemy/deployment.d.ts +0 -12
  73. package/dist/alchemy/deployment.d.ts.map +0 -1
  74. package/dist/alchemy/deployment.js +0 -12
  75. package/dist/alchemy/deployment.js.map +0 -1
  76. package/dist/core/deployment/strategies/alchemy-strategy.d.ts +0 -109
  77. package/dist/core/deployment/strategies/alchemy-strategy.d.ts.map +0 -1
  78. package/dist/core/deployment/strategies/alchemy-strategy.js +0 -556
  79. package/dist/core/deployment/strategies/alchemy-strategy.js.map +0 -1
@@ -1,98 +1,297 @@
1
1
  /**
2
- * Alchemy Resource Type Registration
2
+ * Alchemy v2 KRO Resource Provider
3
3
  *
4
- * This module handles dynamic resource type registration for TypeKro
5
- * resources with alchemy's resource management system.
4
+ * Exposes TypeKro KRO deploys as an alchemy **v2** custom resource. Under v2 a
5
+ * resource is declarative: callers instantiate `KroResource` inside their alchemy
6
+ * Stack and merge `kroProvider` (an Effect `Layer`) into their runtime's providers,
7
+ * so the deployed RGD/instance joins the caller's unified alchemy state (reverse-topo
8
+ * teardown + idempotent reconcile). This replaces the v1 (`alchemy@0.62`) integration,
9
+ * which dynamically registered per-kind providers in a global `PROVIDERS` registry and
10
+ * drove them imperatively via `scope.run(() => Provider(id, props))` — a model alchemy
11
+ * v2 does not have.
6
12
  *
7
- * Uses ensureResourceTypeRegistered() to avoid "Resource already exists" errors
8
- * and provides centralized type registration logic.
13
+ * The Kubernetes machinery (`deployers`, `kro-delete`, client/deployer construction) is
14
+ * alchemy-version-agnostic and reused verbatim; only the registration glue changed.
9
15
  */
10
- import { PROVIDERS, Resource } from 'alchemy';
16
+ import { Effect } from 'effect';
17
+ import * as Output from 'alchemy/Output';
18
+ import * as ProviderMod from 'alchemy/Provider';
19
+ import * as ResourceMod from 'alchemy/Resource';
11
20
  import { DEFAULT_DEPLOYMENT_TIMEOUT } from '../core/config/defaults.js';
12
21
  import { ensureError } from '../core/errors.js';
13
22
  import { createKubernetesClientProvider } from '../core/kubernetes/client-provider.js';
14
23
  import { getComponentLogger } from '../core/logging/index.js';
24
+ import { CEL_EXPRESSION_BRAND } from '../core/constants/brands.js';
25
+ import { createBunCompatibleKubernetesObjectApi } from '../core/kubernetes/index.js';
26
+ import { SINGLETON_SPEC_FINGERPRINT_ANNOTATION } from '../core/deployment/resource-tagging.js';
27
+ import { stableSerialize } from '../core/singleton/singleton.js';
15
28
  import { DirectTypeKroDeployer, KroTypeKroDeployer, ResourceGraphDefinitionDeletionDeferredError, } from './deployers.js';
16
29
  import { deleteKroDefinition, deleteKroInstanceFinalizerSafe, hasKroInstances } from './kro-delete.js';
17
- import { inferAlchemyTypeFromTypeKroResource } from './type-inference.js';
18
- // Process-global registry to track registered resource types. Some test and
19
- // runtime paths can load this module through different specifiers; anchoring the
20
- // cache on globalThis keeps provider identity stable for a given Alchemy type.
21
- const REGISTERED_TYPES_KEY = Symbol.for('typekro.alchemy.registeredTypes');
22
- const globalRegisteredTypes = globalThis;
23
- if (!globalRegisteredTypes[REGISTERED_TYPES_KEY]) {
24
- globalRegisteredTypes[REGISTERED_TYPES_KEY] = new Map();
30
+ /** The single alchemy v2 resource type for any TypeKro KRO resource (RGD or CR instance). */
31
+ export const KRO_RESOURCE_TYPE = 'TypeKro.KroResource';
32
+ /**
33
+ * The declarative v2 resource. Instantiate inside an alchemy Stack one per RGD and one
34
+ * per CR instance — e.g. `yield* KroResource(rgdId, { resource, namespace, deploymentStrategy: 'kro', … })`.
35
+ * Order instances after their RGD (pass the RGD output through) so reverse-topo teardown
36
+ * removes instances before the shared RGD.
37
+ */
38
+ export const KroResource = ResourceMod.Resource(KRO_RESOURCE_TYPE);
39
+ /**
40
+ * The provider `Layer` that backs {@link KroResource}. Merge into the runtime's providers
41
+ * (alongside the cloud providers) so reconcile/delete run. `reconcile` is the single
42
+ * convergent create/update (apply the manifest, wait for readiness); `delete` performs the
43
+ * finalizer-safe, shared-RGD-aware teardown.
44
+ */
45
+ export const kroProvider = ProviderMod.effect(KroResource, Effect.succeed({
46
+ // `namespace` is identity-stable: a namespace change is a replacement, not an in-place update.
47
+ stables: ['namespace'],
48
+ reconcile: Effect.fn(function* ({ news }) {
49
+ return yield* Effect.promise(() => deployKroResource(news));
50
+ }),
51
+ delete: Effect.fn(function* ({ output, news, }) {
52
+ // Prefer the live spec; fall back to reconstructing minimal props from persisted output
53
+ // (a delete after the spec is gone — e.g. resource removed from the stack).
54
+ const props = news ?? propsFromOutput(output);
55
+ if (props) {
56
+ yield* Effect.promise(() => deleteKroResource(props));
57
+ }
58
+ else {
59
+ // Neither a live spec nor a usable output (e.g. a create that failed before persisting a
60
+ // complete output). Warn rather than silently no-op so a possible leaked cluster object is
61
+ // visible — there's nothing reconstructable to tear down here.
62
+ getComponentLogger('alchemy-deployment')
63
+ .child({ alchemyType: KRO_RESOURCE_TYPE })
64
+ .warn('Skipping delete: no live spec and no reconstructable output to tear down', {
65
+ hasOutput: !!output,
66
+ });
67
+ }
68
+ }),
69
+ }));
70
+ /**
71
+ * Instantiate a set of {@link AlchemyResourceDeclaration}s (from a factory's `toAlchemyResources`)
72
+ * as `KroResource`s inside an alchemy Stack, wiring each declaration's `dependsOn` into alchemy
73
+ * `Output` dependencies. This is what gives the fan-out its **ordering** (alchemy deploys a
74
+ * resource only after every resource it `dependsOn` is ready) and, in direct mode, feeds each
75
+ * dependency's resolved live state into the dependent's reconcile for cross-resource reference
76
+ * resolution. Returns the map of declaration id → deployed output.
77
+ *
78
+ * ```ts
79
+ * // inside a Stack/generator:
80
+ * const outputs = yield* materializeAlchemyResources(KroResource, await factory.toAlchemyResources(spec));
81
+ * ```
82
+ *
83
+ * Declarations must be topologically ordered (as `toAlchemyResources` returns them) so each
84
+ * dependency's output exists before its dependents reference it.
85
+ */
86
+ export function materializeAlchemyResources(kroResource, declarations) {
87
+ return Effect.gen(function* () {
88
+ // Keyed by declaration id → the instantiated alchemy resource HANDLE (what `Output.of` consumes
89
+ // and what carries the dependency edge); its resolved attributes are a `TypeKroResource`.
90
+ const handles = {};
91
+ for (const decl of declarations) {
92
+ const deps = decl.dependsOn.map((id) => {
93
+ const handle = handles[id];
94
+ if (!handle) {
95
+ // Declarations must be topologically ordered so every dependency is instantiated first.
96
+ // A missing handle means an out-of-order/unknown id — fail loudly rather than silently
97
+ // dropping the edge (which would cause a deploy-order race or unresolved reference).
98
+ throw new Error(`materializeAlchemyResources: '${decl.id}' dependsOn '${id}', which is not (yet) instantiated. ` +
99
+ `Declarations must be topologically ordered.`);
100
+ }
101
+ return handle;
102
+ });
103
+ // `Output.all([...Output.of(dep)])` both (a) creates the alchemy dependency edges so these
104
+ // deploy first and (b) resolves to the concrete dependency outputs handed to `reconcile`.
105
+ const props = deps.length > 0
106
+ ? { ...decl.props, dependencies: Output.all(...deps.map((d) => Output.of(d))) }
107
+ : decl.props;
108
+ // Cast: `props` carries an `Output` for `dependencies` that the `KroResource` constructor
109
+ // accepts as an `Input<…>` and alchemy resolves before reconcile — the field's static type
110
+ // is the resolved (post-evaluation) shape.
111
+ handles[decl.id] = yield* kroResource(decl.id, props);
112
+ }
113
+ return handles;
114
+ });
25
115
  }
26
- const REGISTERED_TYPES = globalRegisteredTypes[REGISTERED_TYPES_KEY];
27
- const REGISTERED_TYPE_NAMES_KEY = Symbol.for('typekro.alchemy.registeredTypeNames');
28
- if (!globalRegisteredTypes[REGISTERED_TYPE_NAMES_KEY]) {
29
- globalRegisteredTypes[REGISTERED_TYPE_NAMES_KEY] = new Set();
116
+ /**
117
+ * Reconcile: deploy a single KRO resource (RGD or CR instance) and return its persisted state.
118
+ * Convergent — alchemy calls this for both create and update; the deployer is idempotent apply.
119
+ */
120
+ async function deployKroResource(props) {
121
+ const logger = getComponentLogger('alchemy-deployment').child({ alchemyType: KRO_RESOURCE_TYPE });
122
+ // Singleton-owner spec-drift protection (the declarative analog of `assertNoDeployedSingletonSpecDrift`
123
+ // in the imperative deploy path): refuse to clobber a shared singleton that already exists with a
124
+ // different spec. Cluster-checked here since `toAlchemyResources` is intentionally cluster-free.
125
+ await _assertNoSingletonDrift(props, logger);
126
+ const { deployer, dispose } = await _resolveDeployer(props, 'deployment');
127
+ try {
128
+ // Direct mode: hand the deployer the live state of this resource's dependencies so the engine
129
+ // resolves its cross-resource references + CEL expressions against them (the deps deployed
130
+ // first via alchemy ordering). KRO docs are self-contained, so the seed is irrelevant there.
131
+ const seedResources = _seedFromDependencies(props);
132
+ // alchemy serializes props to state, flattening this resource's CEL refs to `${…}` STRINGS.
133
+ // The engine resolver only evaluates CEL OBJECTS, so (direct mode, with dependency state to
134
+ // resolve against) re-hydrate those strings into template CEL objects before deploying — but
135
+ // ONLY strings that reference a known dependency id, so genuine `${…}` literals (e.g. a shell
136
+ // `${HOME}` in an env var) are left untouched.
137
+ const deployProps = seedResources && props.deploymentStrategy === 'direct'
138
+ ? {
139
+ ...props,
140
+ resource: _rehydrateCelStrings(props.resource, new Set(seedResources.map((s) => s.id))),
141
+ }
142
+ : props;
143
+ const { resourceProperties } = await _deployAndCreateResult(deployProps, deployer, seedResources);
144
+ _logDeploymentSuccess(logger, KRO_RESOURCE_TYPE, props, resourceProperties);
145
+ return resourceProperties;
146
+ }
147
+ catch (error) {
148
+ logger.error('Error deploying resource through Alchemy', ensureError(error));
149
+ throw error;
150
+ }
151
+ finally {
152
+ await dispose();
153
+ }
30
154
  }
31
- const REGISTERED_TYPE_NAMES = globalRegisteredTypes[REGISTERED_TYPE_NAMES_KEY];
32
155
  /**
33
- * Dynamic registration function with full type safety
156
+ * Pure drift verdict (no I/O) for a singleton instance being deployed, given:
157
+ * - `expectedFingerprint`: the spec-fingerprint annotation on the resource being deployed,
158
+ * - `deployingSpec`: that resource's spec,
159
+ * - `live`: the existing same-named owner on the cluster (or undefined if none).
34
160
  *
35
- * This function ensures each resource type is registered only once,
36
- * avoiding "Resource already exists" errors while maintaining type safety.
161
+ * Mirrors the imperative `assertNoDeployedSingletonSpecDrift`, INCLUDING its fallback: an existing
162
+ * owner with NO fingerprint annotation (a legacy/unfingerprinted owner) is still verified by
163
+ * comparing serialized specs — so a different-spec legacy owner is NOT silently accepted.
37
164
  */
38
- // Return type is intentionally `any` because alchemy's Provider/Handler types have complex
39
- // `this` context bindings (Context<any, any>) that cannot be cleanly represented without `any`.
40
- // Callers invoke the returned provider as a regular function, but alchemy's internal types
41
- // require `this: Context<...>` which is bound at runtime by the alchemy framework.
42
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
43
- export function ensureResourceTypeRegistered(resource) {
44
- const alchemyType = inferAlchemyTypeFromTypeKroResource(resource);
45
- // Check if already registered in our local cache
46
- if (REGISTERED_TYPES.has(alchemyType)) {
47
- return REGISTERED_TYPES.get(alchemyType);
165
+ export function singletonDriftVerdict(expectedFingerprint, deployingSpec, live) {
166
+ if (!live)
167
+ return { drift: false };
168
+ const actual = live.metadata?.annotations?.[SINGLETON_SPEC_FINGERPRINT_ANNOTATION];
169
+ if (actual === expectedFingerprint)
170
+ return { drift: false };
171
+ if (actual) {
172
+ return { drift: true, reason: `existing fingerprint ${actual} does not match ${expectedFingerprint}` };
48
173
  }
49
- // Check if already registered in alchemy's global registry
50
- if (PROVIDERS.has(alchemyType)) {
51
- const existingProvider = PROVIDERS.get(alchemyType);
52
- REGISTERED_TYPES.set(alchemyType, existingProvider);
53
- REGISTERED_TYPE_NAMES.add(alchemyType);
54
- return existingProvider;
174
+ // Unfingerprinted (legacy) owner fall back to comparing serialized specs.
175
+ if (stableSerialize(live.spec) !== stableSerialize(deployingSpec)) {
176
+ return { drift: true, reason: 'an existing unfingerprinted singleton owner has a different spec' };
55
177
  }
56
- // Register new resource type following alchemy's pseudo-class pattern
57
- const ResourceProvider = Resource(alchemyType, async function (_id, props) {
58
- const alchemyLogger = getComponentLogger('alchemy-deployment').child({ alchemyType });
59
- // Log the context details for debugging
60
- alchemyLogger.debug('Alchemy resource handler called', {
61
- alchemyType,
62
- resourceId: _id,
63
- phase: this.phase,
64
- contextId: this.id,
65
- contextFqn: this.fqn,
66
- resourceKind: props.resource.kind,
67
- resourceName: props.resource.metadata?.name,
68
- });
69
- // Handle deletion phase
70
- if (this.phase === 'delete') {
71
- return await _handleResourceDeletion(this, props, alchemyLogger);
72
- }
73
- try {
74
- const { deployer, dispose } = await _resolveDeployer(props, 'deployment');
75
- try {
76
- // Deploy resource and create result
77
- const { resourceProperties } = await _deployAndCreateResult(props, deployer);
78
- // Log deployment success
79
- _logDeploymentSuccess(alchemyLogger, alchemyType, props, resourceProperties, this);
80
- // Execute Alchemy context function
81
- return _executeAlchemyContext(this, resourceProperties, alchemyLogger, alchemyType);
82
- }
83
- finally {
84
- await dispose();
85
- }
86
- }
87
- catch (error) {
88
- alchemyLogger.error('Error deploying resource through Alchemy', ensureError(error));
89
- throw error;
90
- }
178
+ return { drift: false };
179
+ }
180
+ /**
181
+ * Refuse to deploy a singleton owner whose identity already exists on the cluster with a DIFFERENT
182
+ * spec the declarative-path equivalent of the imperative `assertNoDeployedSingletonSpecDrift`. Only
183
+ * fires for resources carrying the singleton spec-fingerprint annotation (i.e. singleton instances);
184
+ * a missing instance / absent CRD / unreachable cluster is treated as "nothing to drift from".
185
+ */
186
+ async function _assertNoSingletonDrift(props, logger) {
187
+ const resource = props.resource;
188
+ const expected = resource.metadata?.annotations?.[SINGLETON_SPEC_FINGERPRINT_ANNOTATION];
189
+ if (!expected)
190
+ return; // not a fingerprinted singleton instance
191
+ let live;
192
+ try {
193
+ const kc = _createClientProvider(props, 'singleton-drift-check');
194
+ const api = createBunCompatibleKubernetesObjectApi(kc);
195
+ live = (await api.read(props.resource));
196
+ }
197
+ catch {
198
+ return; // not found / CRD not yet created / cluster unreachable → no existing spec to clash with
199
+ }
200
+ const verdict = singletonDriftVerdict(expected, resource.spec, live);
201
+ if (verdict.drift) {
202
+ throw new Error(`Singleton config drift detected for ${resource.metadata?.name ?? '<unknown>'}: ${verdict.reason}. ` +
203
+ 'A singleton identity must not be deployed with multiple specs.');
204
+ }
205
+ logger.debug('Singleton spec verified (no drift)', {
206
+ name: resource.metadata?.name,
207
+ fingerprint: expected,
208
+ });
209
+ }
210
+ /**
211
+ * Build the engine resolution seed (direct mode) from `props.dependencies`: each dependency output
212
+ * carries its live `deployedResource` (apiVersion/kind + status) and its logical `resourceId` — the
213
+ * id this resource's `KubernetesRef`s / CEL expressions (`${resourceId.field}`) point at. The engine
214
+ * resolves against these without redeploying them.
215
+ */
216
+ function _seedFromDependencies(props) {
217
+ const deps = props.dependencies;
218
+ if (props.deploymentStrategy !== 'direct' || !deps || deps.length === 0)
219
+ return undefined;
220
+ const seed = deps
221
+ .filter((d) => !!d?.deployedResource && !!d.resourceId)
222
+ .map((d) => {
223
+ const manifest = d.deployedResource;
224
+ return {
225
+ id: d.resourceId,
226
+ kind: manifest.kind ?? 'Unknown',
227
+ name: manifest.metadata?.name ?? 'unknown',
228
+ namespace: manifest.metadata?.namespace ?? props.namespace,
229
+ manifest,
230
+ status: 'deployed',
231
+ applied: true,
232
+ deployedAt: new Date(0),
233
+ };
91
234
  });
92
- // Cache the registered provider
93
- REGISTERED_TYPES.set(alchemyType, ResourceProvider);
94
- REGISTERED_TYPE_NAMES.add(alchemyType);
95
- return ResourceProvider;
235
+ return seed.length > 0 ? seed : undefined;
236
+ }
237
+ /**
238
+ * Deep-clone `value`, converting strings that contain a `${dependencyId.…}` placeholder into a
239
+ * template {@link CelExpression} object so the engine resolver evaluates them (alchemy's state
240
+ * serialization had flattened the original CEL objects to these strings). Only strings whose
241
+ * placeholder references one of `seedIds` (this resource's dependencies) are converted — genuine
242
+ * `${…}` literals that don't reference a dependency (e.g. a shell `${HOME}`) are left untouched.
243
+ *
244
+ * Template form means placeholders are resolved and string-concatenated; this is correct for the
245
+ * string-valued fields (env/data/annotations) where cross-resource refs survive serialization. A
246
+ * cross-resource ref in a NON-string field would be coerced to a string — an accepted limitation
247
+ * of round-tripping CEL through serialized state.
248
+ */
249
+ function _rehydrateCelStrings(value, seedIds) {
250
+ if (typeof value === 'string') {
251
+ return _referencesSeed(value, seedIds)
252
+ ? { [CEL_EXPRESSION_BRAND]: true, expression: value, __isTemplate: true }
253
+ : value;
254
+ }
255
+ if (Array.isArray(value))
256
+ return value.map((v) => _rehydrateCelStrings(v, seedIds));
257
+ if (value && typeof value === 'object') {
258
+ const out = {};
259
+ for (const [k, v] of Object.entries(value)) {
260
+ out[k] = _rehydrateCelStrings(v, seedIds);
261
+ }
262
+ return out;
263
+ }
264
+ return value;
265
+ }
266
+ /** True if `s` contains a `${<id>.…}` placeholder whose leading identifier is a known dependency. */
267
+ function _referencesSeed(s, seedIds) {
268
+ if (!s.includes('${'))
269
+ return false;
270
+ const re = /\$\{\s*([a-zA-Z_][a-zA-Z0-9_]*)\b/g;
271
+ let m = re.exec(s);
272
+ while (m !== null) {
273
+ if (m[1] && seedIds.has(m[1]))
274
+ return true;
275
+ m = re.exec(s);
276
+ }
277
+ return false;
278
+ }
279
+ /**
280
+ * Rebuild the minimal delete-time props from persisted output. The output carries the deployed
281
+ * resource (with `metadata.labels['typekro.io/rgd']` for instances / `spec.schema` for RGDs),
282
+ * which is all {@link inferKroDeletionOptions} + the deployer need to tear down finalizer-safe.
283
+ */
284
+ function propsFromOutput(output) {
285
+ if (!output?.resource)
286
+ return undefined;
287
+ return {
288
+ resource: output.resource,
289
+ ...(output.resourceId !== undefined && { resourceId: output.resourceId }),
290
+ namespace: output.namespace,
291
+ deploymentStrategy: output.deploymentStrategy ?? 'kro',
292
+ ...(output.kubeConfigOptions !== undefined && { kubeConfigOptions: output.kubeConfigOptions }),
293
+ ...(output.kroDeletion !== undefined && { kroDeletion: output.kroDeletion }),
294
+ };
96
295
  }
97
296
  /**
98
297
  * Create KubernetesClientProvider using centralized configuration management
@@ -199,9 +398,14 @@ async function _resolveDeployer(props, phase) {
199
398
  };
200
399
  }
201
400
  /**
202
- * Handle resource deletion phase
401
+ * Delete: tear down a single KRO resource finalizer-safe. Under v2 reverse-topo teardown,
402
+ * CR instances are deleted before their RGD, so by the time an RGD's delete runs its
403
+ * instances are gone. If the deployer still defers an RGD delete (a shared RGD that other
404
+ * stacks' instances reference), we log and let alchemy drop the state entry — the orphaned
405
+ * RGD is cluster-scoped and dies with the cluster; it must not wedge the destroy.
203
406
  */
204
- async function _handleResourceDeletion(context, props, logger) {
407
+ async function deleteKroResource(props) {
408
+ const logger = getComponentLogger('alchemy-deployment').child({ alchemyType: KRO_RESOURCE_TYPE });
205
409
  const { deployer, dispose } = await _resolveDeployer(props, 'delete');
206
410
  try {
207
411
  await deployer.delete(props.resource, {
@@ -212,18 +416,11 @@ async function _handleResourceDeletion(context, props, logger) {
212
416
  }
213
417
  catch (error) {
214
418
  if (error instanceof ResourceGraphDefinitionDeletionDeferredError) {
215
- logger.debug('Deferring Alchemy state deletion for ResourceGraphDefinition', {
419
+ logger.debug('Deferring ResourceGraphDefinition delete (still referenced); dropping state entry', {
216
420
  resourceName: props.resource.metadata?.name,
217
421
  reason: error.message,
218
422
  });
219
- return {
220
- ...context,
221
- resource: props.resource,
222
- namespace: props.namespace,
223
- deployedResource: props.resource,
224
- ready: false,
225
- deployedAt: Date.now(),
226
- };
423
+ return;
227
424
  }
228
425
  logger.error('Error deleting resource', ensureError(error));
229
426
  throw error;
@@ -231,18 +428,17 @@ async function _handleResourceDeletion(context, props, logger) {
231
428
  finally {
232
429
  await dispose();
233
430
  }
234
- return context.destroy();
235
431
  }
236
432
  /** Internal test hook for deletion semantics. */
237
- export const handleResourceDeletionForTest = _handleResourceDeletion;
433
+ export const deleteKroResourceForTest = deleteKroResource;
238
434
  /**
239
435
  * Deploy resource and create deployment result
240
436
  */
241
- async function _deployAndCreateResult(props, deployer) {
437
+ async function _deployAndCreateResult(props, deployer, seedResources) {
242
438
  const deploymentOptions = buildAlchemyDeploymentOptions(props);
243
- // Deploy using the created deployer - pass the original resource with KubernetesRef objects
244
- // The deployer will handle reference resolution internally
245
- const deployedResource = await deployer.deploy(props.resource, deploymentOptions);
439
+ // Deploy using the created deployer. The deployer/engine resolves references + CEL expressions,
440
+ // seeded (direct mode) with dependencies' live state so cross-resource refs resolve.
441
+ const deployedResource = await deployer.deploy(props.resource, deploymentOptions, seedResources);
246
442
  // Create clean, serializable versions for Alchemy storage.
247
443
  // We use JSON.parse(JSON.stringify()) deliberately instead of structuredClone because:
248
444
  // 1. Enhanced<> resources contain non-cloneable values (Symbols like pino.chindings,
@@ -255,7 +451,11 @@ async function _deployAndCreateResult(props, deployer) {
255
451
  // Create the resource properties for Alchemy
256
452
  const resourceProperties = {
257
453
  resource: cleanResource,
454
+ ...(props.resourceId !== undefined && { resourceId: props.resourceId }),
258
455
  namespace: props.namespace,
456
+ deploymentStrategy: props.deploymentStrategy,
457
+ ...(props.kubeConfigOptions !== undefined && { kubeConfigOptions: props.kubeConfigOptions }),
458
+ ...(props.kroDeletion !== undefined && { kroDeletion: props.kroDeletion }),
259
459
  deployedResource: cleanDeployedResource,
260
460
  ready: true,
261
461
  deployedAt: Date.now(),
@@ -273,10 +473,9 @@ export function buildAlchemyDeploymentOptions(props) {
273
473
  };
274
474
  }
275
475
  /**
276
- * Log deployment success and context details
476
+ * Log deployment success.
277
477
  */
278
- function _logDeploymentSuccess(logger, alchemyType, props, resourceProperties, context) {
279
- // Log successful deployment
478
+ function _logDeploymentSuccess(logger, alchemyType, props, resourceProperties) {
280
479
  logger.debug('Successfully deployed resource through Alchemy', {
281
480
  alchemyType,
282
481
  resourceKind: props.resource.kind,
@@ -290,55 +489,5 @@ function _logDeploymentSuccess(logger, alchemyType, props, resourceProperties, c
290
489
  deployedAt: resourceProperties.deployedAt,
291
490
  },
292
491
  });
293
- // Log the exact data we're about to pass to Alchemy's context function
294
- logger.debug('About to call Alchemy context function', {
295
- alchemyType,
296
- contextPhase: context.phase,
297
- contextId: context.id,
298
- contextFqn: context.fqn,
299
- resourcePropertiesKeys: Object.keys(resourceProperties),
300
- resourcePropertiesStringified: JSON.stringify(resourceProperties, (_key, value) => {
301
- // Handle circular references and complex objects
302
- if (typeof value === 'object' && value !== null) {
303
- if (value.constructor && value.constructor.name !== 'Object') {
304
- return `[${value.constructor.name}]`;
305
- }
306
- }
307
- return value;
308
- }, 2),
309
- });
310
- }
311
- /**
312
- * Execute Alchemy context function with proper error handling
313
- */
314
- function _executeAlchemyContext(context, resourceProperties, logger, alchemyType) {
315
- try {
316
- const result = context(resourceProperties);
317
- logger.debug('Alchemy context function returned successfully', {
318
- alchemyType,
319
- resultType: typeof result,
320
- resultKeys: result ? Object.keys(result) : [],
321
- hasAlchemySymbols: result ? Object.getOwnPropertySymbols(result).length > 0 : false,
322
- });
323
- return result;
324
- }
325
- catch (contextError) {
326
- logger.error('Alchemy context function failed', ensureError(contextError), {
327
- alchemyType,
328
- errorMessage: ensureError(contextError).message,
329
- errorStack: ensureError(contextError).stack,
330
- });
331
- throw contextError;
332
- }
333
- }
334
- /**
335
- * Clear the registered types cache (useful for testing)
336
- */
337
- export function clearRegisteredTypes() {
338
- for (const alchemyType of REGISTERED_TYPE_NAMES) {
339
- PROVIDERS.delete(alchemyType);
340
- }
341
- REGISTERED_TYPES.clear();
342
- REGISTERED_TYPE_NAMES.clear();
343
492
  }
344
493
  //# sourceMappingURL=resource-registration.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resource-registration.js","sourceRoot":"","sources":["../../src/alchemy/resource-registration.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAgB,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,8BAA8B,EAAE,MAAM,uCAAuC,CAAC;AACvF,OAAO,EAAE,kBAAkB,EAAsB,MAAM,0BAA0B,CAAC;AAGlF,OAAO,EACL,qBAAqB,EACrB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ACH,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC,EACD,CAAC,CACF;KACF,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,SAAS,sBAAsB,CAC7B,OAAoC,EACpC,kBAAiD,EACjD,MAAqB,EACrB,WAAmB;IAEnB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAE3C,MAAM,CAAC,KAAK,CAAC,gDAAgD,EAAE;YAC7D,WAAW;YACX,UAAU,EAAE,OAAO,MAAM;YACzB,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE;YAC7C,iBAAiB,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK;SACpF,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,YAAqB,EAAE,CAAC;QAC/B,MAAM,CAAC,KAAK,CAAC,iCAAiC,EAAE,WAAW,CAAC,YAAY,CAAC,EAAE;YACzE,WAAW;YACX,YAAY,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC,OAAO;YAC/C,UAAU,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC,KAAK;SAC5C,CAAC,CAAC;QACH,MAAM,YAAY,CAAC;IACrB,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB;IAClC,KAAK,MAAM,WAAW,IAAI,qBAAqB,EAAE,CAAC;QAChD,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAChC,CAAC;IACD,gBAAgB,CAAC,KAAK,EAAE,CAAC;IACzB,qBAAqB,CAAC,KAAK,EAAE,CAAC;AAChC,CAAC"}
1
+ {"version":3,"file":"resource-registration.js","sourceRoot":"","sources":["../../src/alchemy/resource-registration.ts"],"names":[],"mappings":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