@intentius/chant-lexicon-docker 0.1.14 → 0.1.16

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/README.md CHANGED
@@ -17,7 +17,6 @@ npm install --save-dev @intentius/chant @intentius/chant-lexicon-docker
17
17
  | [@intentius/chant](https://www.npmjs.com/package/@intentius/chant) | Core type system, CLI, build pipeline |
18
18
  | [@intentius/chant-lexicon-k8s](https://www.npmjs.com/package/@intentius/chant-lexicon-k8s) | Kubernetes lexicon |
19
19
  | [@intentius/chant-lexicon-aws](https://www.npmjs.com/package/@intentius/chant-lexicon-aws) | AWS CloudFormation lexicon |
20
- | [@intentius/chant-lexicon-flyway](https://www.npmjs.com/package/@intentius/chant-lexicon-flyway) | Flyway database migrations lexicon |
21
20
 
22
21
  ## License
23
22
 
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "algorithm": "sha256",
3
3
  "artifacts": {
4
- "manifest.json": "8c602050e7d1a6f1c34321062f42c2fb341682b46ec3c4b762ae6d76c70075e0",
5
- "meta.json": "e39b7b9e67e980b070486b5cc6908b1b1bc16e3360c3356dd0923cf4db80133e",
6
- "types/index.d.ts": "f0bb7df2a41a10f7cdb14869dd3b23d3a3f944f2b58ee953bf252f430e0cbbd9",
4
+ "manifest.json": "d81222dfd86918b4e519cc184f8f428644e93794d77514d256037cd665d3e6a0",
5
+ "meta.json": "ae27dc809e705d37a645ee83b9789c50051282f7891d21d6b9e6ce8d111624ff",
6
+ "types/index.d.ts": "758f989ff86af54284d7f841a2db2259038d51ce1f3ed839a5d8e83fa20d95b8",
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": "e852d11f0258d245e67d2d484b92773b4c8917a42f0c7a33260a4e1bfebddf14"
18
+ "composite": "757567a708d9c4ebdb3f94dc741dd44e4a9e190f32d37ea5dd1b3d21af80c6ee"
19
19
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docker",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "chantVersion": ">=0.1.0",
5
5
  "namespace": "Docker",
6
6
  "intrinsics": [
package/dist/meta.json CHANGED
@@ -37,8 +37,8 @@
37
37
  "description": "Networks to attach"
38
38
  },
39
39
  "depends_on": {
40
- "type": "string[]",
41
- "description": "Service dependencies"
40
+ "type": "string[] | Record<string, { condition: \"service_started\" | \"service_healthy\" | \"service_completed_successfully\"; restart?: boolean; required?: boolean }>",
41
+ "description": "Service dependencies (short list-form, or long form with a wait condition)"
42
42
  },
43
43
  "restart": {
44
44
  "type": "string",
@@ -10,7 +10,7 @@ export interface ServiceProps {
10
10
  ports?: string[];
11
11
  volumes?: string[];
12
12
  networks?: string[];
13
- depends_on?: string[];
13
+ depends_on?: string[] | Record<string, { condition: "service_started" | "service_healthy" | "service_completed_successfully"; restart?: boolean; required?: boolean }>;
14
14
  restart?: string;
15
15
  labels?: Record<string, string>;
16
16
  healthcheck?: object;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentius/chant-lexicon-docker",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "description": "Docker lexicon for chant — declarative IaC in TypeScript",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://intentius.io/chant",
@@ -10,7 +10,7 @@ export interface ServiceProps {
10
10
  ports?: string[];
11
11
  volumes?: string[];
12
12
  networks?: string[];
13
- depends_on?: string[];
13
+ depends_on?: string[] | Record<string, { condition: "service_started" | "service_healthy" | "service_completed_successfully"; restart?: boolean; required?: boolean }>;
14
14
  restart?: string;
15
15
  labels?: Record<string, string>;
16
16
  healthcheck?: object;
@@ -37,8 +37,8 @@
37
37
  "description": "Networks to attach"
38
38
  },
39
39
  "depends_on": {
40
- "type": "string[]",
41
- "description": "Service dependencies"
40
+ "type": "string[] | Record<string, { condition: \"service_started\" | \"service_healthy\" | \"service_completed_successfully\"; restart?: boolean; required?: boolean }>",
41
+ "description": "Service dependencies (short list-form, or long form with a wait condition)"
42
42
  },
43
43
  "restart": {
44
44
  "type": "string",
@@ -119,6 +119,31 @@ describe("dockerSerializer.serialize — single service", () => {
119
119
  const output = dockerSerializer.serialize(entities) as string;
120
120
  expect(output).not.toContain("restart:");
121
121
  });
122
+
123
+ test("emits short-form depends_on (list)", () => {
124
+ const entities = new Map<string, Declarable>();
125
+ entities.set("api", new MockService({ image: "nginx", depends_on: ["db"] }));
126
+
127
+ const output = dockerSerializer.serialize(entities) as string;
128
+ expect(output).toContain("depends_on:");
129
+ expect(output).toContain("- db");
130
+ });
131
+
132
+ test("emits long-form depends_on with a wait condition", () => {
133
+ const entities = new Map<string, Declarable>();
134
+ entities.set(
135
+ "api",
136
+ new MockService({
137
+ image: "nginx",
138
+ depends_on: { db: { condition: "service_healthy" } },
139
+ }),
140
+ );
141
+
142
+ const output = dockerSerializer.serialize(entities) as string;
143
+ expect(output).toContain("depends_on:");
144
+ expect(output).toContain("db:");
145
+ expect(output).toContain("condition: service_healthy");
146
+ });
122
147
  });
123
148
 
124
149
  // ── Multi-resource ────────────────────────────────────────────────
@@ -46,7 +46,13 @@ export function parseComposeSpec(_data: Buffer): ComposeParseResult[] {
46
46
  { name: "ports", type: "string[]", description: "Published ports" },
47
47
  { name: "volumes", type: "string[]", description: "Volume mounts" },
48
48
  { name: "networks", type: "string[]", description: "Networks to attach" },
49
- { name: "depends_on", type: "string[]", description: "Service dependencies" },
49
+ {
50
+ name: "depends_on",
51
+ // Compose `depends_on` is a oneOf: short list-form, or long form with a
52
+ // wait condition (service_started/healthy/completed_successfully).
53
+ type: 'string[] | Record<string, { condition: "service_started" | "service_healthy" | "service_completed_successfully"; restart?: boolean; required?: boolean }>',
54
+ description: "Service dependencies (short list-form, or long form with a wait condition)",
55
+ },
50
56
  { name: "restart", type: "string", description: "Restart policy" },
51
57
  { name: "labels", type: "Record<string, string>", description: "Container labels" },
52
58
  { name: "healthcheck", type: "object", description: "Health check configuration" },