typekro 0.13.0 → 0.14.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/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.map +1 -1
- package/dist/core/deployment/direct-factory.js +0 -7
- package/dist/core/deployment/direct-factory.js.map +1 -1
- package/dist/core/deployment/kro-factory.d.ts +0 -7
- package/dist/core/deployment/kro-factory.d.ts.map +1 -1
- package/dist/core/deployment/kro-factory.js +0 -16
- package/dist/core/deployment/kro-factory.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 +1 -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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brands.d.ts","sourceRoot":"","sources":["../../src/shared/brands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,eAAO,MAAM,oBAAoB,eAAsC,CAAC;AAExE;;GAEG;AACH,eAAO,MAAM,oBAAoB,eAAsC,CAAC;AAExE;;GAEG;AACH,eAAO,MAAM,oBAAoB,eAAsC,CAAC;AAExE;;GAEG;AACH,eAAO,MAAM,wBAAwB,eAA0C,CAAC;AAEhF;;GAEG;AACH,eAAO,MAAM,0BAA0B,eAA4C,CAAC;AAEpF;;GAEG;AACH,eAAO,MAAM,sBAAsB,eAAwC,CAAC;AAE5E
|
|
1
|
+
{"version":3,"file":"brands.d.ts","sourceRoot":"","sources":["../../src/shared/brands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,eAAO,MAAM,oBAAoB,eAAsC,CAAC;AAExE;;GAEG;AACH,eAAO,MAAM,oBAAoB,eAAsC,CAAC;AAExE;;GAEG;AACH,eAAO,MAAM,oBAAoB,eAAsC,CAAC;AAExE;;GAEG;AACH,eAAO,MAAM,wBAAwB,eAA0C,CAAC;AAEhF;;GAEG;AACH,eAAO,MAAM,0BAA0B,eAA4C,CAAC;AAEpF;;GAEG;AACH,eAAO,MAAM,sBAAsB,eAAwC,CAAC;AAE5E;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,wCAAwC,uCAAuC,CAAC;AAC7F,eAAO,MAAM,uCAAuC,mGAC8C,CAAC;AACnG,eAAO,MAAM,4BAA4B,wKAA6H,CAAC;AACvK,eAAO,MAAM,mCAAmC,mIAA+E,CAAC;AAChI,eAAO,MAAM,6BAA6B,QAEzC,CAAC"}
|
package/dist/shared/brands.js
CHANGED
|
@@ -33,15 +33,6 @@ export const CALLABLE_COMPOSITION_BRAND = Symbol.for('TypeKro.CallableCompositio
|
|
|
33
33
|
* Brand symbol for singleton handles.
|
|
34
34
|
*/
|
|
35
35
|
export const SINGLETON_HANDLE_BRAND = Symbol.for('TypeKro.SingletonHandle');
|
|
36
|
-
/**
|
|
37
|
-
* Brand symbol for ContainerImageRef objects — the `.imageUri` of a `container()` utility.
|
|
38
|
-
*
|
|
39
|
-
* Unlike a KubernetesRef (which serializes to a CEL expression Kro resolves from CLUSTER state), a
|
|
40
|
-
* container image ref is resolved CLIENT-SIDE to a literal string (the built + pushed image URI)
|
|
41
|
-
* before apply / RGD serialization. Images have no dependency on cluster resources, so a container is
|
|
42
|
-
* defined OUTSIDE a composition and only referenced within one.
|
|
43
|
-
*/
|
|
44
|
-
export const CONTAINER_IMAGE_REF_BRAND = Symbol.for('TypeKro.ContainerImageRef');
|
|
45
36
|
/**
|
|
46
37
|
* Regex pattern for matching __KUBERNETES_REF__ marker strings in values.
|
|
47
38
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brands.js","sourceRoot":"","sources":["../../src/shared/brands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;AAExE;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;AAExE;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;AAExE;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;AAEhF;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;AAEpF;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;AAE5E
|
|
1
|
+
{"version":3,"file":"brands.js","sourceRoot":"","sources":["../../src/shared/brands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;AAExE;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;AAExE;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;AAExE;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;AAEhF;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;AAEpF;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;AAE5E;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,wCAAwC,GAAG,oCAAoC,CAAC;AAC7F,MAAM,CAAC,MAAM,uCAAuC,GAClD,gGAAgG,CAAC;AACnG,MAAM,CAAC,MAAM,4BAA4B,GAAG,gCAAgC,wCAAwC,MAAM,uCAAuC,KAAK,CAAC;AACvK,MAAM,CAAC,MAAM,mCAAmC,GAAG,gCAAgC,uCAAuC,KAAK,CAAC;AAChI,MAAM,CAAC,MAAM,6BAA6B,GAAG,IAAI,MAAM,CACrD,uCAAuC,wCAAwC,MAAM,uCAAuC,KAAK,CAClI,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type ContainerImageRef } from './image.js';
|
|
2
|
-
/**
|
|
3
|
-
* Build + substitute every container image referenced by `resources`. Returns the resolved
|
|
4
|
-
* `containerId → imageUri` map (also useful for logging/diagnostics). Mutates the resources in place.
|
|
5
|
-
*
|
|
6
|
-
* `build` defaults to the real {@link buildContainer}; it is injectable purely so tests can resolve
|
|
7
|
-
* without a Docker daemon (avoids globally mocking the build module, which would leak across files).
|
|
8
|
-
*/
|
|
9
|
-
export declare function resolveContainerImages(resources: readonly unknown[], build?: (options: ContainerImageRef['buildOptions']) => Promise<{
|
|
10
|
-
imageUri: string;
|
|
11
|
-
}>): Promise<Map<string, string>>;
|
|
12
|
-
/** Whether any resource in the set references a container image (cheap pre-check to skip resolution). */
|
|
13
|
-
export declare function hasContainerImageRefs(resources: readonly unknown[]): boolean;
|
|
14
|
-
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../src/core/containers/resolve.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,KAAK,iBAAiB,EAAuB,MAAM,YAAY,CAAC;AAgCzE;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAC1C,SAAS,EAAE,SAAS,OAAO,EAAE,EAC7B,KAAK,GAAE,CACL,OAAO,EAAE,iBAAiB,CAAC,cAAc,CAAC,KACvC,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAkB,GAClD,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CA+B9B;AAED,yGAAyG;AACzG,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,SAAS,OAAO,EAAE,GAAG,OAAO,CAS5E"}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Container Image Resolution
|
|
3
|
-
*
|
|
4
|
-
* Resolves every {@link ContainerImageRef} reachable from a set of resources to its literal image URI,
|
|
5
|
-
* building each distinct container ONCE by delegating to the existing {@link buildContainer} (this
|
|
6
|
-
* module adds NO build/push logic of its own). The refs are replaced in place with the URI string.
|
|
7
|
-
*
|
|
8
|
-
* Runs CLIENT-SIDE before apply (direct mode) / RGD serialization (kro mode), so a container image is
|
|
9
|
-
* never a CEL expression and Kro only ever sees a literal image string.
|
|
10
|
-
*/
|
|
11
|
-
import { getComponentLogger } from '../logging/index.js';
|
|
12
|
-
import { buildContainer } from './build.js';
|
|
13
|
-
import { isContainerImageRef } from './image.js';
|
|
14
|
-
const logger = getComponentLogger('container-resolve');
|
|
15
|
-
/** Deep-walk a value, invoking `onRef` for every ContainerImageRef found (cycle-safe). */
|
|
16
|
-
function walk(value, seen, onRef, parent, key) {
|
|
17
|
-
if (isContainerImageRef(value)) {
|
|
18
|
-
if (parent !== undefined && key !== undefined)
|
|
19
|
-
onRef(value, parent, key);
|
|
20
|
-
return; // never descend into a ref's internals
|
|
21
|
-
}
|
|
22
|
-
if (value === null || typeof value !== 'object')
|
|
23
|
-
return;
|
|
24
|
-
if (seen.has(value))
|
|
25
|
-
return;
|
|
26
|
-
seen.add(value);
|
|
27
|
-
if (Array.isArray(value)) {
|
|
28
|
-
value.forEach((item, i) => walk(item, seen, onRef, value, i));
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
for (const k of Object.keys(value)) {
|
|
32
|
-
walk(value[k], seen, onRef, value, k);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Build + substitute every container image referenced by `resources`. Returns the resolved
|
|
38
|
-
* `containerId → imageUri` map (also useful for logging/diagnostics). Mutates the resources in place.
|
|
39
|
-
*
|
|
40
|
-
* `build` defaults to the real {@link buildContainer}; it is injectable purely so tests can resolve
|
|
41
|
-
* without a Docker daemon (avoids globally mocking the build module, which would leak across files).
|
|
42
|
-
*/
|
|
43
|
-
export async function resolveContainerImages(resources, build = buildContainer) {
|
|
44
|
-
// 1. Collect the distinct containers referenced anywhere in the resource set.
|
|
45
|
-
const byId = new Map();
|
|
46
|
-
for (const resource of resources) {
|
|
47
|
-
walk(resource, new Set(), (ref) => {
|
|
48
|
-
if (!byId.has(ref.containerId))
|
|
49
|
-
byId.set(ref.containerId, ref);
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
if (byId.size === 0)
|
|
53
|
-
return new Map();
|
|
54
|
-
// 2. Build each distinct container ONCE (delegating to buildContainer — the existing push mechanics).
|
|
55
|
-
const uriByContainer = new Map();
|
|
56
|
-
for (const [containerId, ref] of byId) {
|
|
57
|
-
logger.info('Building container image for reference', {
|
|
58
|
-
containerId,
|
|
59
|
-
imageName: ref.buildOptions.imageName,
|
|
60
|
-
});
|
|
61
|
-
const { imageUri } = await build(ref.buildOptions);
|
|
62
|
-
uriByContainer.set(containerId, imageUri);
|
|
63
|
-
logger.info('Resolved container image', { containerId, imageUri });
|
|
64
|
-
}
|
|
65
|
-
// 3. Substitute every ref with its resolved literal URI, in place.
|
|
66
|
-
for (const resource of resources) {
|
|
67
|
-
walk(resource, new Set(), (ref, parent, key) => {
|
|
68
|
-
const uri = uriByContainer.get(ref.containerId);
|
|
69
|
-
if (uri === undefined)
|
|
70
|
-
return;
|
|
71
|
-
parent[key] = uri;
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
return uriByContainer;
|
|
75
|
-
}
|
|
76
|
-
/** Whether any resource in the set references a container image (cheap pre-check to skip resolution). */
|
|
77
|
-
export function hasContainerImageRefs(resources) {
|
|
78
|
-
let found = false;
|
|
79
|
-
for (const resource of resources) {
|
|
80
|
-
walk(resource, new Set(), () => {
|
|
81
|
-
found = true;
|
|
82
|
-
});
|
|
83
|
-
if (found)
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
return found;
|
|
87
|
-
}
|
|
88
|
-
//# sourceMappingURL=resolve.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../../src/core/containers/resolve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAA0B,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEzE,MAAM,MAAM,GAAG,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;AAEvD,0FAA0F;AAC1F,SAAS,IAAI,CACX,KAAc,EACd,IAAiB,EACjB,KAIS,EACT,MAA4C,EAC5C,GAAqB;IAErB,IAAI,mBAAmB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,IAAI,MAAM,KA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