@intentius/chant-lexicon-k3d 0.46.0 → 0.50.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/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export { k3dUp, k3dDown } from "./op/builders.js";
1
2
  export { k3dPlugin } from "./plugin.js";
2
3
  export { k3dSerializer } from "./serializer.js";
3
4
  export * from "./generated/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGrC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAG/C,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGrC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Typed step-builder wrappers for this lexicon's activities (chant #1288
3
+ * Stage 2). See `lexicons/k8s/src/op/builders.ts`'s module doc for why these
4
+ * live beside their `*Args` interfaces rather than in core or the temporal
5
+ * barrel. `opts`'s type in each wrapper below IS the activity's own `*Args`
6
+ * interface (via `Omit`/`WithStepRefs`) — never restated. `core`'s own
7
+ * `k3dUp`/`k3dDown` are unchanged and produce byte-identical `ActivityStep`
8
+ * output; these are purely additive.
9
+ */
10
+ import { type ActivityStep, type NamedActivityStep, type WithStepRefs } from "@intentius/chant/op";
11
+ import type { K3dUpArgs, K3dDownArgs } from "./activities/k3d.js";
12
+ /** Extra opts every wrapper below accepts alongside its activity's own fields. */
13
+ type StepOpts = {
14
+ profile?: ActivityStep["profile"];
15
+ id?: string;
16
+ };
17
+ /**
18
+ * Create a local k3d cluster — the fully typed twin of core's `k3dUp`.
19
+ * `opts` is {@link K3dUpArgs} itself, minus the positional `name`. Defaults
20
+ * to the `longInfra` profile.
21
+ */
22
+ export declare const k3dUp: (name: string, opts?: WithStepRefs<Omit<K3dUpArgs, "name">> & StepOpts) => NamedActivityStep;
23
+ /**
24
+ * Delete a local k3d cluster — the fully typed twin of core's `k3dDown`.
25
+ * `opts` is {@link K3dDownArgs} itself, minus the positional `name`.
26
+ * Defaults to the `fastIdempotent` profile.
27
+ */
28
+ export declare const k3dDown: (name: string, opts?: WithStepRefs<Omit<K3dDownArgs, "name">> & StepOpts) => NamedActivityStep;
29
+ export {};
30
+ //# sourceMappingURL=builders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../../src/op/builders.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/D,kFAAkF;AAClF,KAAK,QAAQ,GAAG;IAAE,OAAO,CAAC,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnE;;;;GAIG;AACH,eAAO,MAAM,KAAK,GAChB,MAAM,MAAM,EACZ,OAAO,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,GAAG,QAAQ,KACtD,iBAGF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAClB,MAAM,MAAM,EACZ,OAAO,YAAY,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,GAAG,QAAQ,KACxD,iBAGF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentius/chant-lexicon-k3d",
3
- "version": "0.46.0",
3
+ "version": "0.50.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/",
@@ -46,13 +46,13 @@
46
46
  "@types/js-yaml": "^4.0.9"
47
47
  },
48
48
  "dependencies": {
49
- "js-yaml": "^4.1.0"
49
+ "js-yaml": "^4.3.1"
50
50
  },
51
51
  "publishConfig": {
52
52
  "access": "public"
53
53
  },
54
54
  "peerDependencies": {
55
- "@intentius/chant": "^0.46.0",
55
+ "@intentius/chant": "^0.50.0",
56
56
  "typescript": "^5.9.3"
57
57
  },
58
58
  "description": "k3d lexicon for chant — a local Kubernetes cluster as declarable data",
package/src/index.ts CHANGED
@@ -1,3 +1,9 @@
1
+ // Typed Op step-builder wrappers (chant #1288 Stage 2) — k3dUp/k3dDown with
2
+ // authoring-time types derived from this lexicon's own *Args interfaces (see
3
+ // ./op/builders.ts's module doc). Opt-in: `@intentius/chant-lexicon-temporal`'s
4
+ // same-named exports are core's original untyped builders, unchanged.
5
+ export { k3dUp, k3dDown } from "./op/builders";
6
+
1
7
  // Plugin
2
8
  export { k3dPlugin } from "./plugin";
3
9
 
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Typed step-builder wrappers (chant #1288 Stage 2) — see
3
+ * `lexicons/k8s/src/op/builders.test.ts`'s module doc for what's asserted
4
+ * and why.
5
+ */
6
+
7
+ import { describe, test, expect } from "vitest";
8
+ import { k3dUp as k3dUpOld, k3dDown as k3dDownOld, stepOutput, type StepOutputRef } from "@intentius/chant/op";
9
+ import { k3dUp, k3dDown } from "./builders";
10
+
11
+ describe("k3d typed step builders (#1288 Stage 2)", () => {
12
+ test("k3dUp: identical ActivityStep to core's original", () => {
13
+ expect(k3dUp("dev")).toEqual(k3dUpOld("dev"));
14
+ const opts = { servers: 1, agents: 2, ports: ["8080:80@loadbalancer"] };
15
+ expect(k3dUp("dev", opts)).toEqual(k3dUpOld("dev", opts));
16
+ });
17
+
18
+ test("k3dDown: identical ActivityStep to core's original", () => {
19
+ expect(k3dDown("dev")).toEqual(k3dDownOld("dev"));
20
+ });
21
+
22
+ test("k3dUp: accepts a StepOutputRef in a typed slot", () => {
23
+ const ref = stepOutput("resolve-config", "path");
24
+ const step = k3dUp("dev", { configFile: ref });
25
+ expect(step.args?.configFile).toBe(ref);
26
+ });
27
+
28
+ test("k3dUp: .out is reachable when an id is given", () => {
29
+ const step = k3dUp("dev", { id: "cluster" });
30
+ const ref: StepOutputRef = step.out.context;
31
+ expect(ref.step).toBe("cluster");
32
+ expect(ref.path).toBe("context");
33
+ });
34
+ });
35
+
36
+ // ── Compile-time-only: authoring-time type errors (never executed) ──────────
37
+ function _typeChecksOnly(): void {
38
+ // @ts-expect-error — "server" (missing the s) is not a key of K3dUpArgs.
39
+ k3dUp("dev", { server: 1 });
40
+
41
+ // @ts-expect-error — servers must be a number.
42
+ k3dUp("dev", { servers: "1" });
43
+
44
+ // @ts-expect-error — ports must be string[], not a single string.
45
+ k3dUp("dev", { ports: "8080:80@loadbalancer" });
46
+ }
47
+ void _typeChecksOnly;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Typed step-builder wrappers for this lexicon's activities (chant #1288
3
+ * Stage 2). See `lexicons/k8s/src/op/builders.ts`'s module doc for why these
4
+ * live beside their `*Args` interfaces rather than in core or the temporal
5
+ * barrel. `opts`'s type in each wrapper below IS the activity's own `*Args`
6
+ * interface (via `Omit`/`WithStepRefs`) — never restated. `core`'s own
7
+ * `k3dUp`/`k3dDown` are unchanged and produce byte-identical `ActivityStep`
8
+ * output; these are purely additive.
9
+ */
10
+
11
+ import {
12
+ activity,
13
+ takeProfileAndId,
14
+ type ActivityStep,
15
+ type NamedActivityStep,
16
+ type WithStepRefs,
17
+ } from "@intentius/chant/op";
18
+ import type { K3dUpArgs, K3dDownArgs } from "./activities/k3d";
19
+
20
+ /** Extra opts every wrapper below accepts alongside its activity's own fields. */
21
+ type StepOpts = { profile?: ActivityStep["profile"]; id?: string };
22
+
23
+ /**
24
+ * Create a local k3d cluster — the fully typed twin of core's `k3dUp`.
25
+ * `opts` is {@link K3dUpArgs} itself, minus the positional `name`. Defaults
26
+ * to the `longInfra` profile.
27
+ */
28
+ export const k3dUp = (
29
+ name: string,
30
+ opts?: WithStepRefs<Omit<K3dUpArgs, "name">> & StepOpts,
31
+ ): NamedActivityStep => {
32
+ const { args, profile, id } = takeProfileAndId(opts as Record<string, unknown> | undefined);
33
+ return activity("k3dUp", { name, ...args }, { profile: profile ?? "longInfra", ...(id ? { id } : {}) });
34
+ };
35
+
36
+ /**
37
+ * Delete a local k3d cluster — the fully typed twin of core's `k3dDown`.
38
+ * `opts` is {@link K3dDownArgs} itself, minus the positional `name`.
39
+ * Defaults to the `fastIdempotent` profile.
40
+ */
41
+ export const k3dDown = (
42
+ name: string,
43
+ opts?: WithStepRefs<Omit<K3dDownArgs, "name">> & StepOpts,
44
+ ): NamedActivityStep => {
45
+ const { args, profile, id } = takeProfileAndId(opts as Record<string, unknown> | undefined);
46
+ return activity("k3dDown", { name, ...args }, { profile: profile ?? "fastIdempotent", ...(id ? { id } : {}) });
47
+ };