@intentius/chant-lexicon-docker 0.80.0 → 0.81.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.
@@ -0,0 +1,54 @@
1
+ /**
2
+ * DockerOtelCollector composite: an OpenTelemetry Collector as a Compose
3
+ * service.
4
+ *
5
+ * The collector config is declared with the otel lexicon
6
+ * (`@intentius/chant-lexicon-otel`), rendered with `collectorYaml`, and
7
+ * carried inline in a top-level Compose config that the service mounts. The
8
+ * published ports are read back from the config, so they follow whatever
9
+ * config is passed in.
10
+ */
11
+ import type { Declarable } from "@intentius/chant/declarable";
12
+ import { type OTelComponent, type Signal } from "@intentius/chant-lexicon-otel";
13
+ export interface DockerOtelCollectorProps {
14
+ /** Collector image (default: the contrib image at the otel lexicon's pinned collector version). */
15
+ image?: string;
16
+ /**
17
+ * The collector config, as otel lexicon entities (components and
18
+ * pipelines). Replaces the default config, and `exporters` and `signals`
19
+ * are then ignored.
20
+ */
21
+ config?: Iterable<Declarable>;
22
+ /** Exporters for the default config (default: one `debug` exporter). */
23
+ exporters?: OTelComponent<"exporter", string, any>[];
24
+ /** Signals the default config has pipelines for (default: traces, metrics and logs). */
25
+ signals?: Signal[];
26
+ /** Publish the receiver ports on the host (default: true). Other services on the network reach the collector either way. */
27
+ publishPorts?: boolean;
28
+ /** Restart policy (default: "unless-stopped"). */
29
+ restart?: string;
30
+ /** Per-member defaults for fine-grained overrides. */
31
+ defaults?: {
32
+ service?: Partial<Record<string, unknown>>;
33
+ config?: Partial<Record<string, unknown>>;
34
+ };
35
+ }
36
+ /**
37
+ * Create a DockerOtelCollector composite. Returns a Compose service and the
38
+ * config it mounts. The service key is the export name plus `Service`.
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * import { DockerOtelCollector } from "@intentius/chant-lexicon-docker";
43
+ * import { OtlpExporter } from "@intentius/chant-lexicon-otel";
44
+ *
45
+ * export const otel = DockerOtelCollector({
46
+ * exporters: [new OtlpExporter({ endpoint: "tempo:4317", tls: { insecure: true } })],
47
+ * });
48
+ * ```
49
+ */
50
+ export declare const DockerOtelCollector: import("@intentius/chant").CompositeDefinition<DockerOtelCollectorProps, {
51
+ service: Declarable & Record<string, string>;
52
+ config: Declarable & Record<string, string>;
53
+ }>;
54
+ //# sourceMappingURL=docker-otel-collector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docker-otel-collector.d.ts","sourceRoot":"","sources":["../../src/composites/docker-otel-collector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAOL,KAAK,aAAa,EAClB,KAAK,MAAM,EACZ,MAAM,+BAA+B,CAAC;AAGvC,MAAM,WAAW,wBAAwB;IACvC,mGAAmG;IACnG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,MAAM,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;IAC9B,wEAAwE;IACxE,SAAS,CAAC,EAAE,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;IACrD,wFAAwF;IACxF,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,4HAA4H;IAC5H,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,kDAAkD;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sDAAsD;IACtD,QAAQ,CAAC,EAAE;QACT,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;QAC3C,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;KAC3C,CAAC;CACH;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB;;;EAmBP,CAAC"}
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Docker lexicon composites.
3
- *
4
- * Composites are factory functions that return pre-configured
5
- * multi-resource bundles. Docker composites will be added here.
2
+ * Docker lexicon composites: factory functions that return pre-configured
3
+ * multi-resource bundles.
6
4
  */
5
+ export { DockerOtelCollector } from "./docker-otel-collector.js";
6
+ export type { DockerOtelCollectorProps } from "./docker-otel-collector.js";
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/composites/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/composites/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,YAAY,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@ export { defaultLabels, defaultAnnotations, isDefaultLabels, isDefaultAnnotation
8
8
  export { DEFAULT_LABELS_MARKER, DEFAULT_ANNOTATIONS_MARKER } from "./default-labels.js";
9
9
  export type { DefaultLabels, DefaultAnnotations } from "./default-labels.js";
10
10
  export * from "./generated/index.js";
11
+ export * from "./composites/index.js";
11
12
  export { generate, writeGeneratedFiles } from "./codegen/generate.js";
12
13
  export { packageLexicon } from "./codegen/package.js";
13
14
  export type { PackageOptions, PackageResult } from "./codegen/package.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGhE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACxD,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzD,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC5G,OAAO,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AACrF,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAG1E,cAAc,mBAAmB,CAAC;AAMlC,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGhE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACxD,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzD,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC5G,OAAO,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AACrF,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAG1E,cAAc,mBAAmB,CAAC;AAGlC,cAAc,oBAAoB,CAAC;AAGnC,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "algorithm": "sha256",
3
3
  "artifacts": {
4
- "manifest.json": "c749201dbc6b60bc987a79678550b3b20ad6f9a6d94c2e2c4941eabfd11c50a4",
5
- "meta.json": "ae27dc809e705d37a645ee83b9789c50051282f7891d21d6b9e6ce8d111624ff",
6
- "types/index.d.ts": "758f989ff86af54284d7f841a2db2259038d51ce1f3ed839a5d8e83fa20d95b8",
4
+ "manifest.json": "fdb02928f96f231bce6adbe34bdca09d35b295c6ac80724826afcec87de74fd0",
5
+ "meta.json": "2996be8fdb14f3f935e1e1441fed8f69af7b6aeeefb14dac96301cc41eba8046",
6
+ "types/index.d.ts": "7b2e6f784b7dbecbbe7924fa1aec7e2520ac0547069311253a006bc2267a5646",
7
7
  "rules/no-latest-tag.ts": "efd060453d8ca3d5b85c3972906c6650b6f63eb5f67cb6cdb0f16a41cad91228",
8
8
  "rules/apt-no-recommends.ts": "579ea54435b1cbd59088994aaaf7b249a42064facd74b62163b302fe31e769e0",
9
9
  "rules/docker-helpers.ts": "c76ea1294b630df086a23b24c0435c9daac8cdf21dd371a8aabf74e9984e6b13",
@@ -15,5 +15,5 @@
15
15
  "skills/chant-docker.md": "3ff0708e3c76e245f202948949c768464563af2b60cc9aa2ca52f494ef8357f1",
16
16
  "skills/chant-docker-patterns.md": "ad1b0196d8150b2df579a699ff107f604340c799c04f3460ebf65003e287b12a"
17
17
  },
18
- "composite": "6ea22af8b21d3a7958255e4d987a2b59691bde4909e621a89472831a237d57c8"
18
+ "composite": "cf83d51788108a8195d1ec69ac4c64f413aa790c7cc9067c037162dc319e2cc0"
19
19
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docker",
3
- "version": "0.80.0",
3
+ "version": "0.81.0",
4
4
  "chantVersion": ">=0.1.0",
5
5
  "namespace": "Docker",
6
6
  "intrinsics": [
package/dist/meta.json CHANGED
@@ -61,8 +61,8 @@
61
61
  "description": "Secrets to expose"
62
62
  },
63
63
  "configs": {
64
- "type": "string[]",
65
- "description": "Configs to expose"
64
+ "type": "Array<string | { source: string | Declarable; target?: string; uid?: string; gid?: string; mode?: number }>",
65
+ "description": "Configs to expose (short form, or long form with a mount target)"
66
66
  }
67
67
  }
68
68
  },
@@ -133,6 +133,10 @@
133
133
  "type": "string",
134
134
  "description": "Path to the config file"
135
135
  },
136
+ "content": {
137
+ "type": "string",
138
+ "description": "Inline config content"
139
+ },
136
140
  "external": {
137
141
  "type": "boolean",
138
142
  "description": "Whether the config is external"
@@ -11,6 +11,7 @@ A config definition in Docker Compose
11
11
  ## Properties
12
12
 
13
13
  - `file` (`string`): Path to the config file
14
+ - `content` (`string`): Inline config content
14
15
  - `external` (`boolean`): Whether the config is external
15
16
  - `labels` (`Record<string, string>`): Config labels
16
17
  - `name` (`string`): Custom config name
@@ -24,7 +24,7 @@ A containerized service definition in Docker Compose
24
24
  - `healthcheck` (`object`): Health check configuration
25
25
  - `deploy` (`object`): Swarm deployment configuration
26
26
  - `secrets` (`string[]`): Secrets to expose
27
- - `configs` (`string[]`): Configs to expose
27
+ - `configs` (`Array<string | { source: string | Declarable; target?: string; uid?: string; gid?: string; mode?: number }>`): Configs to expose (short form, or long form with a mount target)
28
28
 
29
29
  ## Governed by
30
30
 
@@ -1 +1 @@
1
- {"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../src/serializer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAoB,MAAM,6BAA6B,CAAC;AAgPhF,eAAO,MAAM,gBAAgB,EAAE,UAoE9B,CAAC"}
1
+ {"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../src/serializer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAoB,MAAM,6BAA6B,CAAC;AAqPhF,eAAO,MAAM,gBAAgB,EAAE,UAoE9B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"parse-compose.d.ts","sourceRoot":"","sources":["../../src/spec/parse-compose.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,eAAe,EAAE,CAAC;IAC9B,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,kBAAkB,EAAE,CAuFpE"}
1
+ {"version":3,"file":"parse-compose.d.ts","sourceRoot":"","sources":["../../src/spec/parse-compose.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,eAAe,EAAE,CAAC;IAC9B,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,kBAAkB,EAAE,CA8FpE"}
@@ -16,7 +16,7 @@ export interface ServiceProps {
16
16
  healthcheck?: object;
17
17
  deploy?: object;
18
18
  secrets?: string[];
19
- configs?: string[];
19
+ configs?: Array<string | { source: string | Declarable; target?: string; uid?: string; gid?: string; mode?: number }>;
20
20
  }
21
21
  export declare const Service: new (props?: ServiceProps) => Declarable;
22
22
 
@@ -41,6 +41,7 @@ export declare const Network: new (props?: NetworkProps) => Declarable;
41
41
 
42
42
  export interface DockerConfigProps {
43
43
  file?: string;
44
+ content?: string;
44
45
  external?: boolean;
45
46
  labels?: Record<string, string>;
46
47
  name?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentius/chant-lexicon-docker",
3
- "version": "0.80.0",
3
+ "version": "0.81.0",
4
4
  "description": "Docker lexicon for chant — declarative IaC in TypeScript",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://intentius.io/chant",
@@ -62,12 +62,15 @@
62
62
  "prepack": "npm run generate && npm run bundle && npm run validate && npm run build",
63
63
  "build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && find dist -type f \\( -name \"*.js\" -o -name \"*.js.map\" \\) -delete"
64
64
  },
65
+ "dependencies": {
66
+ "@intentius/chant-lexicon-otel": "*"
67
+ },
65
68
  "devDependencies": {
66
69
  "@intentius/chant": "*",
67
70
  "typescript": "^5.9.3"
68
71
  },
69
72
  "peerDependencies": {
70
- "@intentius/chant": "^0.80.0",
73
+ "@intentius/chant": "^0.81.0",
71
74
  "typescript": "^5.9.3"
72
75
  }
73
76
  }
@@ -167,6 +167,7 @@ A config definition in Docker Compose
167
167
  ## Properties
168
168
 
169
169
  - \`file\` (\`string\`): Path to the config file
170
+ - \`content\` (\`string\`): Inline config content
170
171
  - \`external\` (\`boolean\`): Whether the config is external
171
172
  - \`labels\` (\`Record<string, string>\`): Config labels
172
173
  - \`name\` (\`string\`): Custom config name
@@ -276,7 +277,7 @@ A containerized service definition in Docker Compose
276
277
  - \`healthcheck\` (\`object\`): Health check configuration
277
278
  - \`deploy\` (\`object\`): Swarm deployment configuration
278
279
  - \`secrets\` (\`string[]\`): Secrets to expose
279
- - \`configs\` (\`string[]\`): Configs to expose
280
+ - \`configs\` (\`Array<string | { source: string | Declarable; target?: string; uid?: string; gid?: string; mode?: number }>\`): Configs to expose (short form, or long form with a mount target)
280
281
 
281
282
  ## Governed by
282
283
 
@@ -0,0 +1,83 @@
1
+ /**
2
+ * DockerOtelCollector composite: an OpenTelemetry Collector as a Compose
3
+ * service.
4
+ *
5
+ * The collector config is declared with the otel lexicon
6
+ * (`@intentius/chant-lexicon-otel`), rendered with `collectorYaml`, and
7
+ * carried inline in a top-level Compose config that the service mounts. The
8
+ * published ports are read back from the config, so they follow whatever
9
+ * config is passed in.
10
+ */
11
+
12
+ import { Composite, mergeDefaults } from "@intentius/chant";
13
+ import type { Declarable } from "@intentius/chant/declarable";
14
+ import {
15
+ buildCollectorConfig,
16
+ collectorEndpoints,
17
+ collectorYaml,
18
+ otlpCollector,
19
+ COLLECTOR_CONFIG_PATH,
20
+ COLLECTOR_IMAGE,
21
+ type OTelComponent,
22
+ type Signal,
23
+ } from "@intentius/chant-lexicon-otel";
24
+ import { Service, DockerConfig } from "../generated/index";
25
+
26
+ export interface DockerOtelCollectorProps {
27
+ /** Collector image (default: the contrib image at the otel lexicon's pinned collector version). */
28
+ image?: string;
29
+ /**
30
+ * The collector config, as otel lexicon entities (components and
31
+ * pipelines). Replaces the default config, and `exporters` and `signals`
32
+ * are then ignored.
33
+ */
34
+ config?: Iterable<Declarable>;
35
+ /** Exporters for the default config (default: one `debug` exporter). */
36
+ exporters?: OTelComponent<"exporter", string, any>[];
37
+ /** Signals the default config has pipelines for (default: traces, metrics and logs). */
38
+ signals?: Signal[];
39
+ /** Publish the receiver ports on the host (default: true). Other services on the network reach the collector either way. */
40
+ publishPorts?: boolean;
41
+ /** Restart policy (default: "unless-stopped"). */
42
+ restart?: string;
43
+ /** Per-member defaults for fine-grained overrides. */
44
+ defaults?: {
45
+ service?: Partial<Record<string, unknown>>;
46
+ config?: Partial<Record<string, unknown>>;
47
+ };
48
+ }
49
+
50
+ /**
51
+ * Create a DockerOtelCollector composite. Returns a Compose service and the
52
+ * config it mounts. The service key is the export name plus `Service`.
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * import { DockerOtelCollector } from "@intentius/chant-lexicon-docker";
57
+ * import { OtlpExporter } from "@intentius/chant-lexicon-otel";
58
+ *
59
+ * export const otel = DockerOtelCollector({
60
+ * exporters: [new OtlpExporter({ endpoint: "tempo:4317", tls: { insecure: true } })],
61
+ * });
62
+ * ```
63
+ */
64
+ export const DockerOtelCollector = Composite((props: DockerOtelCollectorProps) => {
65
+ const { image = COLLECTOR_IMAGE, publishPorts = true, restart = "unless-stopped", defaults: defs } = props;
66
+
67
+ const entities = props.config ? [...props.config] : otlpCollector({ exporters: props.exporters, signals: props.signals });
68
+ const { ports } = collectorEndpoints(buildCollectorConfig(entities).config);
69
+
70
+ const config = new DockerConfig(mergeDefaults({
71
+ content: collectorYaml(entities),
72
+ }, defs?.config));
73
+
74
+ const service = new Service(mergeDefaults({
75
+ image,
76
+ command: [`--config=${COLLECTOR_CONFIG_PATH}`],
77
+ configs: [{ source: config, target: COLLECTOR_CONFIG_PATH }],
78
+ ...(publishPorts && ports.length > 0 ? { ports: ports.map((p) => `${p.port}:${p.port}`) } : {}),
79
+ restart,
80
+ }, defs?.service));
81
+
82
+ return { service, config };
83
+ }, "DockerOtelCollector");
@@ -1,12 +1,7 @@
1
1
  /**
2
- * Docker lexicon composites.
3
- *
4
- * Composites are factory functions that return pre-configured
5
- * multi-resource bundles. Docker composites will be added here.
2
+ * Docker lexicon composites: factory functions that return pre-configured
3
+ * multi-resource bundles.
6
4
  */
7
5
 
8
- // Composites deferred — see plan for Tier 2 implementation.
9
- // Example future composites:
10
- // - PostgresService({ version, database, user, password }) → Service + Volume
11
- // - RedisService({ version, persistence }) → Service + Volume
12
- // - NginxService({ port, config }) → Service
6
+ export { DockerOtelCollector } from "./docker-otel-collector";
7
+ export type { DockerOtelCollectorProps } from "./docker-otel-collector";
@@ -16,7 +16,7 @@ export interface ServiceProps {
16
16
  healthcheck?: object;
17
17
  deploy?: object;
18
18
  secrets?: string[];
19
- configs?: string[];
19
+ configs?: Array<string | { source: string | Declarable; target?: string; uid?: string; gid?: string; mode?: number }>;
20
20
  }
21
21
  export declare const Service: new (props?: ServiceProps) => Declarable;
22
22
 
@@ -41,6 +41,7 @@ export declare const Network: new (props?: NetworkProps) => Declarable;
41
41
 
42
42
  export interface DockerConfigProps {
43
43
  file?: string;
44
+ content?: string;
44
45
  external?: boolean;
45
46
  labels?: Record<string, string>;
46
47
  name?: string;
@@ -61,8 +61,8 @@
61
61
  "description": "Secrets to expose"
62
62
  },
63
63
  "configs": {
64
- "type": "string[]",
65
- "description": "Configs to expose"
64
+ "type": "Array<string | { source: string | Declarable; target?: string; uid?: string; gid?: string; mode?: number }>",
65
+ "description": "Configs to expose (short form, or long form with a mount target)"
66
66
  }
67
67
  }
68
68
  },
@@ -133,6 +133,10 @@
133
133
  "type": "string",
134
134
  "description": "Path to the config file"
135
135
  },
136
+ "content": {
137
+ "type": "string",
138
+ "description": "Inline config content"
139
+ },
136
140
  "external": {
137
141
  "type": "boolean",
138
142
  "description": "Whether the config is external"
package/src/index.ts CHANGED
@@ -20,8 +20,8 @@ export type { DefaultLabels, DefaultAnnotations } from "./default-labels";
20
20
  // Generated entities — populated by `npm run generate`
21
21
  export * from "./generated/index";
22
22
 
23
- // Composites (to be added in Tier 2)
24
- // export * from "./composites/index";
23
+ // Composites
24
+ export * from "./composites/index";
25
25
 
26
26
  // Codegen pipeline (for external tooling)
27
27
  export { generate, writeGeneratedFiles } from "./codegen/generate";
package/src/serializer.ts CHANGED
@@ -70,10 +70,15 @@ function preprocessIntrinsics(value: unknown): unknown {
70
70
  // ── Visitor ───────────────────────────────────────────────────────
71
71
 
72
72
  function dockerVisitor(entityNames: Map<Declarable, string>): SerializerVisitor {
73
+ const dockerfiles = new Set<string>();
74
+ for (const [entity, name] of entityNames) {
75
+ if ((entity as unknown as Record<string, unknown>).entityType === "Docker::Dockerfile") dockerfiles.add(name);
76
+ }
73
77
  return {
74
78
  attrRef: (name, _attr) => name,
75
- // For Dockerfile references, emit the filename
76
- resourceRef: (name) => `Dockerfile.${name}`,
79
+ // A Dockerfile reference is its filename. Any other entity (a config, a
80
+ // secret, a volume) is referenced by its key in the compose file.
81
+ resourceRef: (name) => (dockerfiles.has(name) ? `Dockerfile.${name}` : name),
77
82
  propertyDeclarable: (entity, walk) => {
78
83
  const props = getProps(entity);
79
84
  const result: Record<string, unknown> = {};
@@ -58,7 +58,13 @@ export function parseComposeSpec(_data: Buffer): ComposeParseResult[] {
58
58
  { name: "healthcheck", type: "object", description: "Health check configuration" },
59
59
  { name: "deploy", type: "object", description: "Swarm deployment configuration" },
60
60
  { name: "secrets", type: "string[]", description: "Secrets to expose" },
61
- { name: "configs", type: "string[]", description: "Configs to expose" },
61
+ {
62
+ name: "configs",
63
+ // Short form names a top-level config; long form also sets where it
64
+ // is mounted. `source` may be the DockerConfig entity itself.
65
+ type: "Array<string | { source: string | Declarable; target?: string; uid?: string; gid?: string; mode?: number }>",
66
+ description: "Configs to expose (short form, or long form with a mount target)",
67
+ },
62
68
  ],
63
69
  },
64
70
  {
@@ -95,6 +101,7 @@ export function parseComposeSpec(_data: Buffer): ComposeParseResult[] {
95
101
  isResource: true,
96
102
  properties: [
97
103
  { name: "file", type: "string", description: "Path to the config file" },
104
+ { name: "content", type: "string", description: "Inline config content" },
98
105
  { name: "external", type: "boolean", description: "Whether the config is external" },
99
106
  { name: "labels", type: "Record<string, string>", description: "Config labels" },
100
107
  { name: "name", type: "string", description: "Custom config name" },