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
|
@@ -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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K,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"direct-factory.d.ts","sourceRoot":"","sources":["../../../src/core/deployment/direct-factory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"direct-factory.d.ts","sourceRoot":"","sources":["../../../src/core/deployment/direct-factory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA8BH,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,uBAAuB,EACvB,gBAAgB,EAChB,qBAAqB,EACrB,cAAc,EACd,aAAa,EAEb,cAAc,EAEf,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAyB,QA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iCvD,OAAO,CAAC,kCAAkC;IAkC1C,OAAO,CAAC,yBAAyB;IA8CjC,OAAO,CAAC,8BAA8B;IAsBtC,OAAO,CAAC,kBAAkB;CAI3B;AAwED;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,SAAS,iBAAiB,EAC/B,OAAO,SAAS,iBAAiB,EAEjC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAC7C,gBAAgB,EAAE,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,EAElD,aAAa,CAAC,EAAE,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,EAClD,OAAO,GAAE,cAAmB,GAC3B,qBAAqB,CAAC,KAAK,EAAE,OAAO,CAAC,CAQvC"}
|
|
@@ -10,7 +10,6 @@ import { isCelExpression, isKubernetesRef } from '../../utils/type-guards.js';
|
|
|
10
10
|
import { applyAspects } from '../aspects/apply.js';
|
|
11
11
|
import { createCompositionContext, runWithCompositionContext } from '../composition/context.js';
|
|
12
12
|
import { buildNestedCompositionAliasTargets } from '../composition/nested-status-cel.js';
|
|
13
|
-
import { hasContainerImageRefs, resolveContainerImages } from '../containers/index.js';
|
|
14
13
|
import { DEFAULT_DELETE_TIMEOUT, DEFAULT_FAST_POLL_INTERVAL, DEFAULT_MAX_RECURSION_DEPTH, } from '../config/defaults.js';
|
|
15
14
|
import { KUBERNETES_REF_SCHEMA_MARKER_SOURCE } from '../constants/brands.js';
|
|
16
15
|
import { DependencyResolver } from '../dependencies/index.js';
|
|
@@ -128,12 +127,6 @@ export class DirectResourceFactoryImpl {
|
|
|
128
127
|
kind: this.schemaDefinition.kind,
|
|
129
128
|
name: this.name,
|
|
130
129
|
});
|
|
131
|
-
// Build + substitute any container() image refs to literal URIs (via buildContainer) before any
|
|
132
|
-
// resource is applied — images are client-side artifacts, never cluster references.
|
|
133
|
-
const resourceList = Object.values(this.resources);
|
|
134
|
-
if (hasContainerImageRefs(resourceList)) {
|
|
135
|
-
await resolveContainerImages(resourceList);
|
|
136
|
-
}
|
|
137
130
|
// Use the consolidated deployment strategy
|
|
138
131
|
const strategy = this.getDeploymentStrategy();
|
|
139
132
|
this.logger.debug('Got deployment strategy', {
|