@intentius/chant-lexicon-cpln 0.53.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/README.md +85 -0
- package/dist/api.d.ts +77 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/codegen/docs-cli.d.ts +3 -0
- package/dist/codegen/docs-cli.d.ts.map +1 -0
- package/dist/codegen/docs.d.ts +17 -0
- package/dist/codegen/docs.d.ts.map +1 -0
- package/dist/codegen/generate-cli.d.ts +6 -0
- package/dist/codegen/generate-cli.d.ts.map +1 -0
- package/dist/codegen/generate-lexicon.d.ts +36 -0
- package/dist/codegen/generate-lexicon.d.ts.map +1 -0
- package/dist/codegen/generate-typescript.d.ts +11 -0
- package/dist/codegen/generate-typescript.d.ts.map +1 -0
- package/dist/codegen/generate.d.ts +15 -0
- package/dist/codegen/generate.d.ts.map +1 -0
- package/dist/codegen/naming.d.ts +30 -0
- package/dist/codegen/naming.d.ts.map +1 -0
- package/dist/codegen/package.d.ts +17 -0
- package/dist/codegen/package.d.ts.map +1 -0
- package/dist/composites/cron-job.d.ts +60 -0
- package/dist/composites/cron-job.d.ts.map +1 -0
- package/dist/composites/gvc-environment.d.ts +47 -0
- package/dist/composites/gvc-environment.d.ts.map +1 -0
- package/dist/composites/index.d.ts +13 -0
- package/dist/composites/index.d.ts.map +1 -0
- package/dist/composites/public-domain.d.ts +68 -0
- package/dist/composites/public-domain.d.ts.map +1 -0
- package/dist/composites/secret-access.d.ts +78 -0
- package/dist/composites/secret-access.d.ts.map +1 -0
- package/dist/composites/serverless-service.d.ts +78 -0
- package/dist/composites/serverless-service.d.ts.map +1 -0
- package/dist/composites/stateful-service.d.ts +79 -0
- package/dist/composites/stateful-service.d.ts.map +1 -0
- package/dist/coverage.d.ts +59 -0
- package/dist/coverage.d.ts.map +1 -0
- package/dist/describe-resources.d.ts +71 -0
- package/dist/describe-resources.d.ts.map +1 -0
- package/dist/detect.d.ts +14 -0
- package/dist/detect.d.ts.map +1 -0
- package/dist/entity-props.d.ts +34 -0
- package/dist/entity-props.d.ts.map +1 -0
- package/dist/generated/index.d.ts +151 -0
- package/dist/generated/index.d.ts.map +1 -0
- package/dist/generated/runtime.d.ts +5 -0
- package/dist/generated/runtime.d.ts.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/init-templates.d.ts +16 -0
- package/dist/init-templates.d.ts.map +1 -0
- package/dist/integrity.json +35 -0
- package/dist/kinds.d.ts +70 -0
- package/dist/kinds.d.ts.map +1 -0
- package/dist/lint/audit-catalog.d.ts +19 -0
- package/dist/lint/audit-catalog.d.ts.map +1 -0
- package/dist/lint/post-synth/cpl010-unrestricted-outbound.d.ts +12 -0
- package/dist/lint/post-synth/cpl010-unrestricted-outbound.d.ts.map +1 -0
- package/dist/lint/post-synth/cpl011-internal-firewall-scope.d.ts +11 -0
- package/dist/lint/post-synth/cpl011-internal-firewall-scope.d.ts.map +1 -0
- package/dist/lint/post-synth/cpl012-no-literal-credential-env.d.ts +11 -0
- package/dist/lint/post-synth/cpl012-no-literal-credential-env.d.ts.map +1 -0
- package/dist/lint/post-synth/cpl013-qualified-identity-principal.d.ts +11 -0
- package/dist/lint/post-synth/cpl013-qualified-identity-principal.d.ts.map +1 -0
- package/dist/lint/post-synth/cpl014-qualified-secret-ref.d.ts +14 -0
- package/dist/lint/post-synth/cpl014-qualified-secret-ref.d.ts.map +1 -0
- package/dist/lint/post-synth/cpl020-serverless-single-port.d.ts +10 -0
- package/dist/lint/post-synth/cpl020-serverless-single-port.d.ts.map +1 -0
- package/dist/lint/post-synth/cpl021-cron-job-shape.d.ts +11 -0
- package/dist/lint/post-synth/cpl021-cron-job-shape.d.ts.map +1 -0
- package/dist/lint/post-synth/cpl022-container-ports.d.ts +10 -0
- package/dist/lint/post-synth/cpl022-container-ports.d.ts.map +1 -0
- package/dist/lint/post-synth/cpl023-container-resources.d.ts +12 -0
- package/dist/lint/post-synth/cpl023-container-resources.d.ts.map +1 -0
- package/dist/lint/post-synth/cpl024-probe-handler.d.ts +10 -0
- package/dist/lint/post-synth/cpl024-probe-handler.d.ts.map +1 -0
- package/dist/lint/post-synth/cpl025-autoscaling-shape.d.ts +11 -0
- package/dist/lint/post-synth/cpl025-autoscaling-shape.d.ts.map +1 -0
- package/dist/lint/post-synth/cpl026-scale-to-zero.d.ts +11 -0
- package/dist/lint/post-synth/cpl026-scale-to-zero.d.ts.map +1 -0
- package/dist/lint/post-synth/cpl027-capacity-ai-conflict.d.ts +13 -0
- package/dist/lint/post-synth/cpl027-capacity-ai-conflict.d.ts.map +1 -0
- package/dist/lint/post-synth/cpl028-volume-set.d.ts +3 -0
- package/dist/lint/post-synth/cpl028-volume-set.d.ts.map +1 -0
- package/dist/lint/post-synth/cpl029-link-targets.d.ts +3 -0
- package/dist/lint/post-synth/cpl029-link-targets.d.ts.map +1 -0
- package/dist/lint/post-synth/cpl030-domain-routing.d.ts +3 -0
- package/dist/lint/post-synth/cpl030-domain-routing.d.ts.map +1 -0
- package/dist/lint/post-synth/cpl040-pinned-image.d.ts +11 -0
- package/dist/lint/post-synth/cpl040-pinned-image.d.ts.map +1 -0
- package/dist/lint/post-synth/cpl041-image-reference-form.d.ts +12 -0
- package/dist/lint/post-synth/cpl041-image-reference-form.d.ts.map +1 -0
- package/dist/lint/post-synth/cpl042-gvc-placement.d.ts +10 -0
- package/dist/lint/post-synth/cpl042-gvc-placement.d.ts.map +1 -0
- package/dist/lint/post-synth/cpl043-policy-scope.d.ts +16 -0
- package/dist/lint/post-synth/cpl043-policy-scope.d.ts.map +1 -0
- package/dist/lint/post-synth/helpers.d.ts +45 -0
- package/dist/lint/post-synth/helpers.d.ts.map +1 -0
- package/dist/lint/post-synth/index.d.ts +3 -0
- package/dist/lint/post-synth/index.d.ts.map +1 -0
- package/dist/lint/rules/cpl001-no-secret-literals.d.ts +3 -0
- package/dist/lint/rules/cpl001-no-secret-literals.d.ts.map +1 -0
- package/dist/lint/rules/cpl002-prefer-resource-reference.d.ts +3 -0
- package/dist/lint/rules/cpl002-prefer-resource-reference.d.ts.map +1 -0
- package/dist/lint/rules/index.d.ts +6 -0
- package/dist/lint/rules/index.d.ts.map +1 -0
- package/dist/lsp/completions.d.ts +7 -0
- package/dist/lsp/completions.d.ts.map +1 -0
- package/dist/lsp/hover.d.ts +4 -0
- package/dist/lsp/hover.d.ts.map +1 -0
- package/dist/manifest.json +6 -0
- package/dist/meta.json +2110 -0
- package/dist/okf/index.md +39 -0
- package/dist/okf/rules/CPL001.md +22 -0
- package/dist/okf/rules/CPL002.md +22 -0
- package/dist/okf/rules/CPL010.md +15 -0
- package/dist/okf/rules/CPL011.md +15 -0
- package/dist/okf/rules/CPL012.md +15 -0
- package/dist/okf/rules/CPL013.md +15 -0
- package/dist/okf/rules/CPL014.md +16 -0
- package/dist/okf/rules/CPL020.md +11 -0
- package/dist/okf/rules/CPL021.md +15 -0
- package/dist/okf/rules/CPL022.md +15 -0
- package/dist/okf/rules/CPL023.md +15 -0
- package/dist/okf/rules/CPL024.md +15 -0
- package/dist/okf/rules/CPL025.md +15 -0
- package/dist/okf/rules/CPL026.md +15 -0
- package/dist/okf/rules/CPL027.md +15 -0
- package/dist/okf/rules/CPL028.md +15 -0
- package/dist/okf/rules/CPL029.md +15 -0
- package/dist/okf/rules/CPL030.md +16 -0
- package/dist/okf/rules/CPL040.md +15 -0
- package/dist/okf/rules/CPL041.md +15 -0
- package/dist/okf/rules/CPL042.md +11 -0
- package/dist/okf/rules/CPL043.md +15 -0
- package/dist/okf/types/Domain.md +22 -0
- package/dist/okf/types/Gvc.md +21 -0
- package/dist/okf/types/Identity.md +29 -0
- package/dist/okf/types/IpSet.md +21 -0
- package/dist/okf/types/Policy.md +28 -0
- package/dist/okf/types/Secret.md +23 -0
- package/dist/okf/types/VolumeSet.md +22 -0
- package/dist/okf/types/Workload.md +38 -0
- package/dist/ownership.d.ts +23 -0
- package/dist/ownership.d.ts.map +1 -0
- package/dist/package-cli.d.ts +3 -0
- package/dist/package-cli.d.ts.map +1 -0
- package/dist/plugin.d.ts +3 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/reference-catalog.d.ts +24 -0
- package/dist/reference-catalog.d.ts.map +1 -0
- package/dist/rules/cpl001-no-secret-literals.ts +83 -0
- package/dist/rules/cpl002-prefer-resource-reference.ts +71 -0
- package/dist/rules/cpl010-unrestricted-outbound.ts +41 -0
- package/dist/rules/cpl011-internal-firewall-scope.ts +38 -0
- package/dist/rules/cpl012-no-literal-credential-env.ts +58 -0
- package/dist/rules/cpl013-qualified-identity-principal.ts +45 -0
- package/dist/rules/cpl014-qualified-secret-ref.ts +54 -0
- package/dist/rules/cpl020-serverless-single-port.ts +58 -0
- package/dist/rules/cpl021-cron-job-shape.ts +64 -0
- package/dist/rules/cpl022-container-ports.ts +64 -0
- package/dist/rules/cpl023-container-resources.ts +87 -0
- package/dist/rules/cpl024-probe-handler.ts +51 -0
- package/dist/rules/cpl025-autoscaling-shape.ts +100 -0
- package/dist/rules/cpl026-scale-to-zero.ts +67 -0
- package/dist/rules/cpl027-capacity-ai-conflict.ts +78 -0
- package/dist/rules/cpl028-volume-set.ts +183 -0
- package/dist/rules/cpl029-link-targets.ts +155 -0
- package/dist/rules/cpl030-domain-routing.ts +137 -0
- package/dist/rules/cpl040-pinned-image.ts +48 -0
- package/dist/rules/cpl041-image-reference-form.ts +60 -0
- package/dist/rules/cpl042-gvc-placement.ts +57 -0
- package/dist/rules/cpl043-policy-scope.ts +0 -0
- package/dist/rules/helpers.ts +114 -0
- package/dist/serializer.d.ts +69 -0
- package/dist/serializer.d.ts.map +1 -0
- package/dist/skills/chant-cpln-secrets.md +110 -0
- package/dist/skills/chant-cpln-workloads.md +78 -0
- package/dist/skills/chant-cpln.md +103 -0
- package/dist/spec/fetch.d.ts +43 -0
- package/dist/spec/fetch.d.ts.map +1 -0
- package/dist/spec/parse.d.ts +79 -0
- package/dist/spec/parse.d.ts.map +1 -0
- package/dist/spec/snapshot-cli.d.ts +18 -0
- package/dist/spec/snapshot-cli.d.ts.map +1 -0
- package/dist/types/index.d.ts +1649 -0
- package/dist/validate-cli.d.ts +3 -0
- package/dist/validate-cli.d.ts.map +1 -0
- package/dist/validate.d.ts +26 -0
- package/dist/validate.d.ts.map +1 -0
- package/package.json +74 -0
- package/src/api.ts +134 -0
- package/src/codegen/docs-cli.ts +7 -0
- package/src/codegen/docs.ts +94 -0
- package/src/codegen/generate-cli.ts +34 -0
- package/src/codegen/generate-lexicon.ts +88 -0
- package/src/codegen/generate-typescript.ts +71 -0
- package/src/codegen/generate.ts +110 -0
- package/src/codegen/naming.ts +61 -0
- package/src/codegen/package.ts +35 -0
- package/src/composites/composites.test.ts +252 -0
- package/src/composites/cron-job.ts +124 -0
- package/src/composites/gvc-environment.ts +104 -0
- package/src/composites/index.ts +17 -0
- package/src/composites/public-domain.ts +144 -0
- package/src/composites/secret-access.ts +136 -0
- package/src/composites/serverless-service.ts +143 -0
- package/src/composites/stateful-service.ts +179 -0
- package/src/coverage.ts +149 -0
- package/src/describe-resources.test.ts +252 -0
- package/src/describe-resources.ts +310 -0
- package/src/detect.ts +58 -0
- package/src/entity-props.ts +98 -0
- package/src/generated/index.d.ts +1649 -0
- package/src/generated/index.ts +156 -0
- package/src/generated/lexicon-cpln.json +2110 -0
- package/src/generated/runtime.ts +4 -0
- package/src/index.ts +31 -0
- package/src/init-templates.ts +131 -0
- package/src/kinds.ts +173 -0
- package/src/lint/audit-catalog.ts +230 -0
- package/src/lint/post-synth/cpl010-unrestricted-outbound.ts +41 -0
- package/src/lint/post-synth/cpl011-internal-firewall-scope.ts +38 -0
- package/src/lint/post-synth/cpl012-no-literal-credential-env.ts +58 -0
- package/src/lint/post-synth/cpl013-qualified-identity-principal.ts +45 -0
- package/src/lint/post-synth/cpl014-qualified-secret-ref.ts +54 -0
- package/src/lint/post-synth/cpl020-serverless-single-port.ts +58 -0
- package/src/lint/post-synth/cpl021-cron-job-shape.ts +64 -0
- package/src/lint/post-synth/cpl022-container-ports.ts +64 -0
- package/src/lint/post-synth/cpl023-container-resources.ts +87 -0
- package/src/lint/post-synth/cpl024-probe-handler.ts +51 -0
- package/src/lint/post-synth/cpl025-autoscaling-shape.ts +100 -0
- package/src/lint/post-synth/cpl026-scale-to-zero.ts +67 -0
- package/src/lint/post-synth/cpl027-capacity-ai-conflict.ts +78 -0
- package/src/lint/post-synth/cpl028-volume-set.ts +183 -0
- package/src/lint/post-synth/cpl029-link-targets.ts +155 -0
- package/src/lint/post-synth/cpl030-domain-routing.ts +137 -0
- package/src/lint/post-synth/cpl040-pinned-image.ts +48 -0
- package/src/lint/post-synth/cpl041-image-reference-form.ts +60 -0
- package/src/lint/post-synth/cpl042-gvc-placement.ts +57 -0
- package/src/lint/post-synth/cpl043-policy-scope.ts +0 -0
- package/src/lint/post-synth/helpers.ts +114 -0
- package/src/lint/post-synth/index.ts +45 -0
- package/src/lint/post-synth/post-synth.test.ts +737 -0
- package/src/lint/rules/cpl001-no-secret-literals.ts +83 -0
- package/src/lint/rules/cpl002-prefer-resource-reference.ts +71 -0
- package/src/lint/rules/index.ts +9 -0
- package/src/lint/rules/rules.test.ts +108 -0
- package/src/lsp/completions.test.ts +44 -0
- package/src/lsp/completions.ts +27 -0
- package/src/lsp/hover.test.ts +53 -0
- package/src/lsp/hover.ts +130 -0
- package/src/ownership.ts +28 -0
- package/src/package-cli.ts +25 -0
- package/src/plugin.test.ts +131 -0
- package/src/plugin.ts +187 -0
- package/src/reference-catalog.ts +110 -0
- package/src/serializer.test.ts +233 -0
- package/src/serializer.ts +253 -0
- package/src/skills/chant-cpln-secrets.md +110 -0
- package/src/skills/chant-cpln-workloads.md +78 -0
- package/src/skills/chant-cpln.md +103 -0
- package/src/spec/cpln-openapi.snapshot.json +10651 -0
- package/src/spec/fetch.ts +77 -0
- package/src/spec/parse.ts +451 -0
- package/src/spec/snapshot-cli.ts +71 -0
- package/src/validate-cli.ts +8 -0
- package/src/validate.ts +102 -0
package/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# @intentius/chant-lexicon-cpln
|
|
2
|
+
|
|
3
|
+
[Control Plane](https://controlplane.com) (cpln) lexicon for [chant](https://github.com/intentius/chant) — GVCs, workloads, identities and secrets as typed TypeScript.
|
|
4
|
+
|
|
5
|
+
Types are generated from Control Plane's served OpenAPI document, so they track the real API.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install --save-dev @intentius/chant-lexicon-cpln
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## What it looks like
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { GvcEnvironment, ServerlessService } from "@intentius/chant-lexicon-cpln";
|
|
15
|
+
|
|
16
|
+
export const { gvc } = GvcEnvironment({
|
|
17
|
+
name: "prod",
|
|
18
|
+
org: "acme",
|
|
19
|
+
locations: ["aws-us-east-1"], // placement is GVC-level
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const { workload } = ServerlessService({
|
|
23
|
+
name: "web",
|
|
24
|
+
gvc: "prod",
|
|
25
|
+
image: "nginx:1.27",
|
|
26
|
+
port: 8080,
|
|
27
|
+
inboundAllowCidr: ["0.0.0.0/0"], // the firewall starts closed
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
`chant build` emits multi-document YAML for `cpln apply --file`. Each document carries its own `gvc:` key, so the file is self-contained rather than depending on a `--gvc` flag.
|
|
32
|
+
|
|
33
|
+
## The kinds
|
|
34
|
+
|
|
35
|
+
Org-scoped: `Gvc`, `Secret`, `Policy`, `Domain`, `IpSet`.
|
|
36
|
+
GVC-scoped (each takes a required `gvc`): `Workload`, `Identity`, `VolumeSet`.
|
|
37
|
+
|
|
38
|
+
Org-administration kinds (`group`, `serviceaccount`, `cloudaccount`, `auditctx`, `agent`, `user`) and `mk8s` are not modelled yet — each is a row in `src/kinds.ts` away, and `chant cpln coverage` reports the gap rather than hiding it.
|
|
39
|
+
|
|
40
|
+
## What the checks are for
|
|
41
|
+
|
|
42
|
+
Control Plane accepts several plausible-looking configurations and then quietly does nothing with them. The 22 CPL rules are weighted toward exactly those:
|
|
43
|
+
|
|
44
|
+
| | |
|
|
45
|
+
|---|---|
|
|
46
|
+
| `CPL013` | A policy binding against `//identity/NAME` is accepted and **silently ignored** — only `//gvc/GVC/identity/NAME` grants anything |
|
|
47
|
+
| `CPL014` | `cpln://secret/db` with no `.field` resolves to nothing at runtime |
|
|
48
|
+
| `CPL026` | `minScale: 0` on a strategy that cannot scale to zero holds at one replica, with no error |
|
|
49
|
+
| `CPL027` | Capacity AI is on by default and conflicts with CPU autoscaling, multi-metric autoscaling, and GPUs |
|
|
50
|
+
| `CPL023` | `memory(MiB) / cpu(millicores)` must be ≤ 8 — a memory-heavy, CPU-light workload is rejected |
|
|
51
|
+
|
|
52
|
+
Passing a declared resource where a link belongs sidesteps the first of these entirely: the serializer emits the correct link for its kind, GVC qualifier included.
|
|
53
|
+
|
|
54
|
+
## Live state
|
|
55
|
+
|
|
56
|
+
Every kind carries a free-form `tags` map, which is where chant stamps its ownership marker. That is what makes `chant plan` precise without a state file.
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
CPLN_ORG=acme CPLN_TOKEN=$(cat sa-key) chant plan
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Use the env var rather than `--token`; the flag leaks into process listings and logs.
|
|
63
|
+
|
|
64
|
+
## Development
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
just generate # regenerate types from the upstream spec
|
|
68
|
+
just validate # check the generated artifacts
|
|
69
|
+
just snapshot # refresh the committed offline spec snapshot
|
|
70
|
+
just docs # build and serve the docs site
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Project structure
|
|
74
|
+
|
|
75
|
+
- `src/kinds.ts` — the kind table every subsystem agrees on
|
|
76
|
+
- `src/plugin.ts` — the `LexiconPlugin` entry point
|
|
77
|
+
- `src/serializer.ts` — `cpln apply` manifest output
|
|
78
|
+
- `src/spec/` — OpenAPI fetch, offline snapshot, and parser
|
|
79
|
+
- `src/codegen/` — generation pipeline, naming, packaging, docs
|
|
80
|
+
- `src/lint/` — source-level rules, post-synth checks, audit catalog
|
|
81
|
+
- `src/composites/` — `GvcEnvironment`, `ServerlessService`, `CronJob`, `StatefulService`, `SecretAccess`, `PublicDomain`
|
|
82
|
+
- `src/describe-resources.ts` — live observation
|
|
83
|
+
- `src/generated/` — generated artifacts (do not edit)
|
|
84
|
+
|
|
85
|
+
[Full documentation →](https://intentius.io/chant/lexicons/cpln/)
|
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal Control Plane REST client.
|
|
3
|
+
*
|
|
4
|
+
* Deliberately small: observation needs list-and-index, nothing more. The API
|
|
5
|
+
* is uniform enough that one `get` covers every kind — `/org/{org}/{kind}` for
|
|
6
|
+
* org-scoped, `/org/{org}/{kind}` again for the GVC-scoped rollup, which is why
|
|
7
|
+
* `collectionPath` in `kinds.ts` returns the org-wide form when no GVC is given.
|
|
8
|
+
* That rollup is what makes observation one request per kind instead of one per
|
|
9
|
+
* GVC.
|
|
10
|
+
*
|
|
11
|
+
* Credentials follow the CLI's own conventions so `chant plan` reads the org a
|
|
12
|
+
* `cpln` command in the same shell would write to. Nothing here reads a secret
|
|
13
|
+
* value: `-reveal` is never called.
|
|
14
|
+
*/
|
|
15
|
+
import { type CplnKind } from "./kinds.js";
|
|
16
|
+
/** Default API root. `CPLN_ENDPOINT` overrides it for a private deployment. */
|
|
17
|
+
export declare const DEFAULT_ENDPOINT = "https://api.cpln.io";
|
|
18
|
+
/** A resource as the API returns it. Only the envelope is typed. */
|
|
19
|
+
export interface CplnResource {
|
|
20
|
+
id?: string;
|
|
21
|
+
name?: string;
|
|
22
|
+
kind?: string;
|
|
23
|
+
version?: number;
|
|
24
|
+
description?: string;
|
|
25
|
+
tags?: Record<string, unknown>;
|
|
26
|
+
created?: string;
|
|
27
|
+
lastModified?: string;
|
|
28
|
+
links?: Array<{
|
|
29
|
+
rel?: string;
|
|
30
|
+
href?: string;
|
|
31
|
+
}>;
|
|
32
|
+
spec?: Record<string, unknown>;
|
|
33
|
+
status?: Record<string, unknown>;
|
|
34
|
+
[key: string]: unknown;
|
|
35
|
+
}
|
|
36
|
+
export interface CplnConfig {
|
|
37
|
+
endpoint: string;
|
|
38
|
+
org: string;
|
|
39
|
+
token: string;
|
|
40
|
+
}
|
|
41
|
+
/** Thrown when there is no org or no token to read with. */
|
|
42
|
+
export declare class CplnCredentialsError extends Error {
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Resolve endpoint, org and token from the environment.
|
|
46
|
+
*
|
|
47
|
+
* `CPLN_TOKEN` is the documented CI variable and the one Control Plane's own
|
|
48
|
+
* guidance prefers over `--token`, which leaks into process listings and logs.
|
|
49
|
+
* A service account key works in the same header.
|
|
50
|
+
*/
|
|
51
|
+
export declare function resolveConfig(overrides?: Partial<CplnConfig>): CplnConfig;
|
|
52
|
+
/**
|
|
53
|
+
* Build the `Authorization` header value.
|
|
54
|
+
*
|
|
55
|
+
* The spec declares two schemes on the same header: `serviceAccountKey` is an
|
|
56
|
+
* apiKey sent bare, `jwt` is an HTTP bearer token. They are distinguishable by
|
|
57
|
+
* shape — a JWT is three base64url segments and always starts `eyJ` — so a
|
|
58
|
+
* caller does not have to say which kind of credential they have. An
|
|
59
|
+
* already-prefixed value is passed through so an explicit `Bearer …` works too.
|
|
60
|
+
*/
|
|
61
|
+
export declare function authorization(token: string): string;
|
|
62
|
+
/** The transport, injectable so tests need no network. */
|
|
63
|
+
export interface CplnHttp {
|
|
64
|
+
get(path: string): Promise<unknown>;
|
|
65
|
+
}
|
|
66
|
+
/** The default transport — `fetch` with the documented auth header. */
|
|
67
|
+
export declare function defaultCplnHttp(config: CplnConfig): CplnHttp;
|
|
68
|
+
/**
|
|
69
|
+
* List every resource of one kind in the org, keyed by name.
|
|
70
|
+
*
|
|
71
|
+
* Returns an empty map for a 404, which the API uses for a kind the org has
|
|
72
|
+
* none of as well as for one the token cannot see — the distinction is not
|
|
73
|
+
* available here, and the observer treats an absent resource as absent either
|
|
74
|
+
* way.
|
|
75
|
+
*/
|
|
76
|
+
export declare function listKind(http: CplnHttp, config: CplnConfig, kind: CplnKind): Promise<Map<string, CplnResource>>;
|
|
77
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExD,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB,wBAAwB,CAAC;AAEtD,oEAAoE;AACpE,MAAM,WAAW,YAAY;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAOD,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED,4DAA4D;AAC5D,qBAAa,oBAAqB,SAAQ,KAAK;CAAG;AAElD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,SAAS,GAAE,OAAO,CAAC,UAAU,CAAM,GAAG,UAAU,CAmB7E;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGnD;AAED,0DAA0D;AAC1D,MAAM,WAAW,QAAQ;IACvB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACrC;AAED,uEAAuE;AACvE,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,GAAG,QAAQ,CAc5D;AAED;;;;;;;GAOG;AACH,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,QAAQ,GACb,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAOpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs-cli.d.ts","sourceRoot":"","sources":["../../src/codegen/docs-cli.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cpln documentation generator.
|
|
3
|
+
*
|
|
4
|
+
* Calls the core `docsPipeline` with cpln-specific config. The prose pages live
|
|
5
|
+
* as authored `.mdx` under `docs/pages/`, each naming its Diátaxis quadrant in
|
|
6
|
+
* frontmatter (chant #1731 / #1733); the pipeline reads them, expands markers
|
|
7
|
+
* and builds the sidebar from the quadrant. Only the overview and the output
|
|
8
|
+
* format description stay here, because they are interpolated into generated
|
|
9
|
+
* pages rather than being pages of their own.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Generate the documentation site for the cpln lexicon.
|
|
13
|
+
*/
|
|
14
|
+
export declare function generateDocs(options?: {
|
|
15
|
+
verbose?: boolean;
|
|
16
|
+
}): Promise<void>;
|
|
17
|
+
//# sourceMappingURL=docs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/codegen/docs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AA0DH;;GAEG;AACH,wBAAsB,YAAY,CAAC,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuBjF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-cli.d.ts","sourceRoot":"","sources":["../../src/codegen/generate-cli.ts"],"names":[],"mappings":";AACA;;GAEG"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lexicon registry generator — produces `lexicon-cpln.json`, the metadata the
|
|
3
|
+
* evaluator and lint engine read for each cpln resource and property type.
|
|
4
|
+
*/
|
|
5
|
+
import type { PropertyConstraints } from "@intentius/chant/codegen/json-schema";
|
|
6
|
+
import type { CplnParseResult } from "../spec/parse.js";
|
|
7
|
+
import type { NamingStrategy } from "./naming.js";
|
|
8
|
+
export interface CplnLexiconEntry {
|
|
9
|
+
resourceType: string;
|
|
10
|
+
kind: "resource" | "property";
|
|
11
|
+
lexicon: "cpln";
|
|
12
|
+
/** The `kind` discriminator a manifest carries. Resources only. */
|
|
13
|
+
cplnKind?: string;
|
|
14
|
+
/** Whether the resource is addressed under a GVC. Resources only. */
|
|
15
|
+
gvcScoped?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Per-property constraints.
|
|
18
|
+
*
|
|
19
|
+
* Named to match core's `LexiconEntry` contract rather than the bare
|
|
20
|
+
* `constraints` it would be natural to call it. The name is load-bearing
|
|
21
|
+
* twice over: `LexiconIndex.getPropertyNames` derives the LSP's property
|
|
22
|
+
* completions from *the keys of this object*, and hover reads the enums out
|
|
23
|
+
* of its values. Under any other key both features return nothing, with no
|
|
24
|
+
* error — the index simply finds no properties.
|
|
25
|
+
*
|
|
26
|
+
* Every writable property gets an entry for the same reason, even when it
|
|
27
|
+
* carries no constraints at all. A property omitted here is a property that
|
|
28
|
+
* does not complete.
|
|
29
|
+
*/
|
|
30
|
+
propertyConstraints?: Record<string, PropertyConstraints>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Generate the `lexicon-cpln.json` content.
|
|
34
|
+
*/
|
|
35
|
+
export declare function generateLexiconJSON(results: CplnParseResult[], naming: NamingStrategy): string;
|
|
36
|
+
//# sourceMappingURL=generate-lexicon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-lexicon.d.ts","sourceRoot":"","sources":["../../src/codegen/generate-lexicon.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAOhF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,UAAU,GAAG,UAAU,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;;;;;;;;;OAaG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;CAC3D;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,MAAM,EAAE,cAAc,GAAG,MAAM,CA4C9F"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript declaration generator — produces `index.d.ts` with the eight cpln
|
|
3
|
+
* resource classes and the property-type classes their specs reach.
|
|
4
|
+
*/
|
|
5
|
+
import type { CplnParseResult } from "../spec/parse.js";
|
|
6
|
+
import type { NamingStrategy } from "./naming.js";
|
|
7
|
+
/**
|
|
8
|
+
* Generate the complete `.d.ts` content.
|
|
9
|
+
*/
|
|
10
|
+
export declare function generateTypeScriptDeclarations(results: CplnParseResult[], naming: NamingStrategy): string;
|
|
11
|
+
//# sourceMappingURL=generate-typescript.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-typescript.d.ts","sourceRoot":"","sources":["../../src/codegen/generate-typescript.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAS/C;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,MAAM,EAAE,cAAc,GAAG,MAAM,CA8CzG"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cpln generation pipeline — core `generatePipeline` with cpln's fetch, parse,
|
|
3
|
+
* naming and emit callbacks.
|
|
4
|
+
*/
|
|
5
|
+
import { type GenerateOptions, type GenerateResult } from "@intentius/chant/codegen/generate";
|
|
6
|
+
export type { GenerateResult };
|
|
7
|
+
/**
|
|
8
|
+
* Run the full cpln generation pipeline.
|
|
9
|
+
*/
|
|
10
|
+
export declare function generate(opts?: GenerateOptions): Promise<GenerateResult>;
|
|
11
|
+
/**
|
|
12
|
+
* Write generated artifacts under `src/generated/`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function writeGeneratedFiles(result: GenerateResult, baseDir: string): void;
|
|
15
|
+
//# sourceMappingURL=generate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/codegen/generate.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,cAAc,EAEpB,MAAM,mCAAmC,CAAC;AAY3C,YAAY,EAAE,cAAc,EAAE,CAAC;AAqB/B;;GAEG;AACH,wBAAsB,QAAQ,CAAC,IAAI,GAAE,eAAoB,GAAG,OAAO,CAAC,cAAc,CAAC,CAmBlF;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAUjF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cpln naming strategy.
|
|
3
|
+
*
|
|
4
|
+
* Every generated type is `Cpln::Core::{Name}` with a `{Name}` the parser has
|
|
5
|
+
* already made unique — `$ref`'d schemas take their upstream name and inline
|
|
6
|
+
* shapes take their path — so the core strategy's collision phases never fire
|
|
7
|
+
* and `resolve` returns the last segment unchanged. The value of going through
|
|
8
|
+
* the core strategy anyway is phase 1a: once this lexicon publishes a surface
|
|
9
|
+
* snapshot, a name that has shipped stays attached to the type that shipped it
|
|
10
|
+
* even if an upstream reshuffle would otherwise hand it to a newcomer.
|
|
11
|
+
*/
|
|
12
|
+
import { NamingStrategy as CoreNamingStrategy } from "@intentius/chant/codegen/naming";
|
|
13
|
+
import type { CplnParseResult } from "../spec/parse.js";
|
|
14
|
+
export { propertyTypeName, extractDefName } from "@intentius/chant/codegen/naming";
|
|
15
|
+
export interface CplnNamingOptions {
|
|
16
|
+
/** A committed `surface.snapshot.json`, when one exists. */
|
|
17
|
+
snapshot?: {
|
|
18
|
+
entries?: Record<string, {
|
|
19
|
+
kind?: string;
|
|
20
|
+
resourceType?: string;
|
|
21
|
+
}>;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* cpln-specific naming strategy.
|
|
26
|
+
*/
|
|
27
|
+
export declare class NamingStrategy extends CoreNamingStrategy {
|
|
28
|
+
constructor(results: CplnParseResult[], options?: CplnNamingOptions);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=naming.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"naming.d.ts","sourceRoot":"","sources":["../../src/codegen/naming.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,cAAc,IAAI,kBAAkB,EAIrC,MAAM,iCAAiC,CAAC;AAEzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAoBnF,MAAM,WAAW,iBAAiB;IAChC,4DAA4D;IAC5D,QAAQ,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,YAAY,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC;CACnF;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,kBAAkB;gBACxC,OAAO,EAAE,eAAe,EAAE,EAAE,OAAO,GAAE,iBAAsB;CAUxE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package the cpln lexicon into the distributable bundle under `dist/`.
|
|
3
|
+
*/
|
|
4
|
+
export declare function packageLexicon(options?: {
|
|
5
|
+
verbose?: boolean;
|
|
6
|
+
force?: boolean;
|
|
7
|
+
}): Promise<{
|
|
8
|
+
spec: import("packages/core/src").BundleSpec;
|
|
9
|
+
stats: {
|
|
10
|
+
resources: number;
|
|
11
|
+
properties: number;
|
|
12
|
+
enums: number;
|
|
13
|
+
ruleCount: number;
|
|
14
|
+
skillCount: number;
|
|
15
|
+
};
|
|
16
|
+
}>;
|
|
17
|
+
//# sourceMappingURL=package.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package.d.ts","sourceRoot":"","sources":["../../src/codegen/package.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,wBAAsB,cAAc,CAAC,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE;;;;;;;;;GAuBpF"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CronJob — a scheduled workload, with the constraints cron carries.
|
|
3
|
+
*
|
|
4
|
+
* Cron is the workload type with the most *silent* rules: it must not expose
|
|
5
|
+
* any port, its container has to exit on completion, and probes, autoscaling,
|
|
6
|
+
* `timeoutSeconds` and `debug` are all accepted and then ignored. Rather than
|
|
7
|
+
* let a caller set those and wonder why nothing happens, this composite has no
|
|
8
|
+
* knobs for them.
|
|
9
|
+
*
|
|
10
|
+
* A cron workload also deploys to every location in its GVC with no
|
|
11
|
+
* per-location override, so placement is a property of the GVC, not of this.
|
|
12
|
+
*/
|
|
13
|
+
import { Workload } from "../generated/index.js";
|
|
14
|
+
export interface CronJobProps {
|
|
15
|
+
/** Workload name. Max 49 characters. */
|
|
16
|
+
name: string;
|
|
17
|
+
/** GVC this job is deployed into. */
|
|
18
|
+
gvc: string;
|
|
19
|
+
/** Container image. */
|
|
20
|
+
image: string;
|
|
21
|
+
/** Cron schedule, standard five-field syntax (e.g. `"0 * * * *"`). */
|
|
22
|
+
schedule: string;
|
|
23
|
+
/** Container name (default `main`). */
|
|
24
|
+
containerName?: string;
|
|
25
|
+
/** Entrypoint override. */
|
|
26
|
+
command?: string;
|
|
27
|
+
/** Arguments passed to the entrypoint. */
|
|
28
|
+
args?: string[];
|
|
29
|
+
/** CPU in millicores (default `50m`). */
|
|
30
|
+
cpu?: string;
|
|
31
|
+
/** Memory (default `128Mi`). */
|
|
32
|
+
memory?: string;
|
|
33
|
+
/** Environment variables, as a plain map. */
|
|
34
|
+
env?: Record<string, string>;
|
|
35
|
+
/**
|
|
36
|
+
* What to do when a run is still going at the next scheduled time
|
|
37
|
+
* (default `Forbid` — skip the new run rather than overlap).
|
|
38
|
+
*/
|
|
39
|
+
concurrencyPolicy?: "Allow" | "Forbid" | "Replace";
|
|
40
|
+
/** Restart behaviour for a failed run (default `Never`). */
|
|
41
|
+
restartPolicy?: "Never" | "OnFailure";
|
|
42
|
+
/** Seconds a run may take before it is killed. */
|
|
43
|
+
activeDeadlineSeconds?: number;
|
|
44
|
+
/** How many finished runs to retain. */
|
|
45
|
+
historyLimit?: number;
|
|
46
|
+
/** Hostnames or CIDRs the job may call out to. Defaults to closed. */
|
|
47
|
+
outboundAllowCidr?: string[];
|
|
48
|
+
/** Identity to run as, as a link (`//gvc/GVC/identity/NAME`). */
|
|
49
|
+
identityLink?: string;
|
|
50
|
+
/** Tags applied to the workload. */
|
|
51
|
+
tags?: Record<string, string>;
|
|
52
|
+
/** Per-member defaults for customizing the underlying resource. */
|
|
53
|
+
defaults?: {
|
|
54
|
+
workload?: Partial<ConstructorParameters<typeof Workload>[0]>;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export declare const CronJob: import("@intentius/chant").CompositeDefinition<CronJobProps, {
|
|
58
|
+
workload: import("@intentius/chant").Declarable & Record<string, string>;
|
|
59
|
+
}>;
|
|
60
|
+
//# sourceMappingURL=cron-job.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cron-job.d.ts","sourceRoot":"","sources":["../../src/composites/cron-job.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,MAAM,WAAW,YAAY;IAC3B,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,uBAAuB;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,QAAQ,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2BAA2B;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,yCAAyC;IACzC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;IACnD,4DAA4D;IAC5D,aAAa,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;IACtC,kDAAkD;IAClD,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,wCAAwC;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sEAAsE;IACtE,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,iEAAiE;IACjE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,mEAAmE;IACnE,QAAQ,CAAC,EAAE;QACT,QAAQ,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAC/D,CAAC;CACH;AAED,eAAO,MAAM,OAAO;;EA+DP,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GvcEnvironment — a GVC placed in named locations, with its pull secrets.
|
|
3
|
+
*
|
|
4
|
+
* Two things belong here rather than at the workload:
|
|
5
|
+
*
|
|
6
|
+
* - **Pull secrets are GVC-level** (`spec.pullSecretLinks`), not per-workload.
|
|
7
|
+
* Looking for them on a workload is a common wrong turn, and only the
|
|
8
|
+
* `docker`, `ecr` and `gcp` secret types are valid as pull secrets.
|
|
9
|
+
* - **Placement is GVC-level.** Location links use the full org-qualified path
|
|
10
|
+
* (`/org/ORG/location/aws-us-east-1`), which is why this takes an `org`.
|
|
11
|
+
*
|
|
12
|
+
* The location id format is `<provider>-<region>`: `aws-us-east-1`,
|
|
13
|
+
* `gcp-us-central1`, `azure-eastus`.
|
|
14
|
+
*/
|
|
15
|
+
import { Gvc } from "../generated/index.js";
|
|
16
|
+
export interface GvcEnvironmentProps {
|
|
17
|
+
/** GVC name. */
|
|
18
|
+
name: string;
|
|
19
|
+
/** Org the GVC belongs to. Needed to build location links. */
|
|
20
|
+
org: string;
|
|
21
|
+
/** Location ids to place workloads in, e.g. `["aws-us-east-1"]`. */
|
|
22
|
+
locations: string[];
|
|
23
|
+
/**
|
|
24
|
+
* Names of secrets used to pull private images. Only `docker`, `ecr` and
|
|
25
|
+
* `gcp` secret types are valid here.
|
|
26
|
+
*/
|
|
27
|
+
pullSecrets?: string[];
|
|
28
|
+
/**
|
|
29
|
+
* Public endpoint naming scheme (default `org`, the default for new GVCs):
|
|
30
|
+
* `{workload}-{gvcAlias}.{orgPrefix}.cpln.app`.
|
|
31
|
+
*/
|
|
32
|
+
endpointNamingFormat?: "default" | "legacy" | "org";
|
|
33
|
+
/** Environment variables inherited by every workload in the GVC. */
|
|
34
|
+
env?: Record<string, string>;
|
|
35
|
+
/** Enable KEDA autoscaling for standard and stateful workloads in this GVC. */
|
|
36
|
+
keda?: boolean;
|
|
37
|
+
/** Tags applied to the GVC. */
|
|
38
|
+
tags?: Record<string, string>;
|
|
39
|
+
/** Per-member defaults for customizing the underlying resource. */
|
|
40
|
+
defaults?: {
|
|
41
|
+
gvc?: Partial<ConstructorParameters<typeof Gvc>[0]>;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export declare const GvcEnvironment: import("@intentius/chant").CompositeDefinition<GvcEnvironmentProps, {
|
|
45
|
+
gvc: import("@intentius/chant").Declarable & Record<string, string>;
|
|
46
|
+
}>;
|
|
47
|
+
//# sourceMappingURL=gvc-environment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gvc-environment.d.ts","sourceRoot":"","sources":["../../src/composites/gvc-environment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAKnC,MAAM,WAAW,mBAAmB;IAClC,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,8DAA8D;IAC9D,GAAG,EAAE,MAAM,CAAC;IACZ,oEAAoE;IACpE,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;IACpD,oEAAoE;IACpE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,+EAA+E;IAC/E,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,+BAA+B;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,mEAAmE;IACnE,QAAQ,CAAC,EAAE;QACT,GAAG,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KACrD,CAAC;CACH;AAED,eAAO,MAAM,cAAc;;EAqDP,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { GvcEnvironment } from "./gvc-environment.js";
|
|
2
|
+
export type { GvcEnvironmentProps } from "./gvc-environment.js";
|
|
3
|
+
export { ServerlessService } from "./serverless-service.js";
|
|
4
|
+
export type { ServerlessServiceProps } from "./serverless-service.js";
|
|
5
|
+
export { CronJob } from "./cron-job.js";
|
|
6
|
+
export type { CronJobProps } from "./cron-job.js";
|
|
7
|
+
export { StatefulService } from "./stateful-service.js";
|
|
8
|
+
export type { StatefulServiceProps } from "./stateful-service.js";
|
|
9
|
+
export { SecretAccess, identityLink, secretRef } from "./secret-access.js";
|
|
10
|
+
export type { SecretAccessProps } from "./secret-access.js";
|
|
11
|
+
export { PublicDomain, isApexDomain } from "./public-domain.js";
|
|
12
|
+
export type { PublicDomainProps, DomainRoute } from "./public-domain.js";
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/composites/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,YAAY,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,YAAY,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,YAAY,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACxE,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC7D,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PublicDomain — a custom domain routed to workloads in one GVC.
|
|
3
|
+
*
|
|
4
|
+
* Domains carry several rules that are easy to violate by picking the
|
|
5
|
+
* combination that reads best rather than the one that works:
|
|
6
|
+
*
|
|
7
|
+
* - An **apex domain must use `cname` mode**. NS mode does not support apex,
|
|
8
|
+
* and there is no partial-credit failure — the domain simply will not
|
|
9
|
+
* validate.
|
|
10
|
+
* - **NS mode requires the `dns01` certificate challenge**; `http01` is
|
|
11
|
+
* rejected outright.
|
|
12
|
+
* - `gvcLink`, `workloadLink` and `ports[].routes` are **mutually exclusive**
|
|
13
|
+
* ways of saying where traffic goes; exactly one may be set.
|
|
14
|
+
* - Every route in a domain must target workloads in the **same GVC**.
|
|
15
|
+
*
|
|
16
|
+
* This composite takes a GVC and a route table, derives the mode when it can,
|
|
17
|
+
* and refuses the combinations above at build time.
|
|
18
|
+
*/
|
|
19
|
+
import { Domain } from "../generated/index.js";
|
|
20
|
+
export interface DomainRoute {
|
|
21
|
+
/** Path prefix to match (e.g. `/api`). One of `prefix` or `regex`. */
|
|
22
|
+
prefix?: string;
|
|
23
|
+
/** RE2 path regex to match. One of `prefix` or `regex`. */
|
|
24
|
+
regex?: string;
|
|
25
|
+
/** Name of the workload in `gvc` to route to. */
|
|
26
|
+
workload: string;
|
|
27
|
+
/** Port on the workload (default 8080). */
|
|
28
|
+
port?: number;
|
|
29
|
+
/** Rewrite the matched prefix to this before forwarding. */
|
|
30
|
+
replacePrefix?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface PublicDomainProps {
|
|
33
|
+
/** The domain name, e.g. `api.example.com` or the apex `example.com`. */
|
|
34
|
+
name: string;
|
|
35
|
+
/** The GVC every route targets. */
|
|
36
|
+
gvc: string;
|
|
37
|
+
/**
|
|
38
|
+
* Routes for the domain. Omit to send all traffic to the GVC's default
|
|
39
|
+
* routing (a `gvcLink` domain) instead.
|
|
40
|
+
*/
|
|
41
|
+
routes?: DomainRoute[];
|
|
42
|
+
/**
|
|
43
|
+
* DNS mode. Defaults to `cname`, which is also the only mode valid for an
|
|
44
|
+
* apex domain.
|
|
45
|
+
*/
|
|
46
|
+
dnsMode?: "cname" | "ns";
|
|
47
|
+
/**
|
|
48
|
+
* Certificate challenge type. Defaults to `dns01` under `ns` (the only
|
|
49
|
+
* option there) and `http01` under `cname`.
|
|
50
|
+
*/
|
|
51
|
+
certChallengeType?: "dns01" | "http01";
|
|
52
|
+
/** Public port (default 443). */
|
|
53
|
+
port?: number;
|
|
54
|
+
/** Protocol (default `http2`). `tcp` requires a dedicated load balancer. */
|
|
55
|
+
protocol?: "http" | "http2" | "tcp";
|
|
56
|
+
/** Tags applied to the domain. */
|
|
57
|
+
tags?: Record<string, string>;
|
|
58
|
+
/** Per-member defaults for customizing the underlying resource. */
|
|
59
|
+
defaults?: {
|
|
60
|
+
domain?: Partial<ConstructorParameters<typeof Domain>[0]>;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/** An apex domain has exactly one dot: `example.com`, not `api.example.com`. */
|
|
64
|
+
export declare function isApexDomain(name: string): boolean;
|
|
65
|
+
export declare const PublicDomain: import("@intentius/chant").CompositeDefinition<PublicDomainProps, {
|
|
66
|
+
domain: import("@intentius/chant").Declarable & Record<string, string>;
|
|
67
|
+
}>;
|
|
68
|
+
//# sourceMappingURL=public-domain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-domain.d.ts","sourceRoot":"","sources":["../../src/composites/public-domain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,MAAM,WAAW,WAAW;IAC1B,sEAAsE;IACtE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2DAA2D;IAC3D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4DAA4D;IAC5D,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB;IAChC,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;IACvB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACzB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IACvC,iCAAiC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;IACpC,kCAAkC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,mEAAmE;IACnE,QAAQ,CAAC,EAAE;QACT,MAAM,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAC3D,CAAC;CACH;AAED,gFAAgF;AAChF,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAElD;AAED,eAAO,MAAM,YAAY;;EAuEP,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SecretAccess — the identity and policy a workload needs to read a secret.
|
|
3
|
+
*
|
|
4
|
+
* Control Plane's own documentation calls a partial version of this its number
|
|
5
|
+
* one support issue: reading a secret at runtime takes three separate steps,
|
|
6
|
+
* and **missing any one of them fails silently at runtime** rather than at
|
|
7
|
+
* apply time.
|
|
8
|
+
*
|
|
9
|
+
* 1. An identity exists, and the workload's `spec.identityLink` points at it.
|
|
10
|
+
* 2. A policy grants that identity `reveal` on the secret, with the identity
|
|
11
|
+
* named as a principal in a binding.
|
|
12
|
+
* 3. The workload references the secret in the field-qualified form —
|
|
13
|
+
* `cpln://secret/NAME.payload`, not `cpln://secret/NAME`.
|
|
14
|
+
*
|
|
15
|
+
* This composite owns steps 1 and 2, and {@link secretRef} exists for step 3 so
|
|
16
|
+
* the field qualifier is hard to forget.
|
|
17
|
+
*
|
|
18
|
+
* The principal link is the part most worth automating. A binding written
|
|
19
|
+
* against `//identity/NAME` — which reads perfectly naturally, and is what
|
|
20
|
+
* you would guess — is accepted by the API and then **silently ignored**. Only
|
|
21
|
+
* the GVC-qualified `//gvc/GVC/identity/NAME` form works. This composite only
|
|
22
|
+
* emits the qualified form.
|
|
23
|
+
*/
|
|
24
|
+
import { Identity, Policy } from "../generated/index.js";
|
|
25
|
+
export interface SecretAccessProps {
|
|
26
|
+
/** Identity name. The policy is named `<name>-secret-access` unless overridden. */
|
|
27
|
+
name: string;
|
|
28
|
+
/** GVC the identity lives in. Identities cannot be shared across GVCs. */
|
|
29
|
+
gvc: string;
|
|
30
|
+
/**
|
|
31
|
+
* Names of the org-scoped secrets this identity may read. Each becomes a
|
|
32
|
+
* `//secret/NAME` target link on the policy.
|
|
33
|
+
*/
|
|
34
|
+
secrets: string[];
|
|
35
|
+
/** Policy name (default `<name>-secret-access`). */
|
|
36
|
+
policyName?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Permissions granted on the target secrets (default `["reveal"]`).
|
|
39
|
+
* Control Plane requires the list to be sorted and unique, which this does.
|
|
40
|
+
*/
|
|
41
|
+
permissions?: string[];
|
|
42
|
+
/** Tags applied to both resources. */
|
|
43
|
+
tags?: Record<string, string>;
|
|
44
|
+
/** Per-member defaults for customizing individual resources. */
|
|
45
|
+
defaults?: {
|
|
46
|
+
identity?: Partial<ConstructorParameters<typeof Identity>[0]>;
|
|
47
|
+
policy?: Partial<ConstructorParameters<typeof Policy>[0]>;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export declare const SecretAccess: import("@intentius/chant").CompositeDefinition<SecretAccessProps, {
|
|
51
|
+
identity: import("@intentius/chant").Declarable & Record<string, string>;
|
|
52
|
+
policy: import("@intentius/chant").Declarable & Record<string, string>;
|
|
53
|
+
}>;
|
|
54
|
+
/**
|
|
55
|
+
* The GVC-qualified principal link for an identity.
|
|
56
|
+
*
|
|
57
|
+
* Exported because this is the form policies must use, and the unqualified one
|
|
58
|
+
* fails silently.
|
|
59
|
+
*/
|
|
60
|
+
export declare function identityLink(gvc: string, name: string): string;
|
|
61
|
+
/**
|
|
62
|
+
* A field-qualified secret reference for use in a container's env or volumes.
|
|
63
|
+
*
|
|
64
|
+
* The field name is required. `cpln://secret/db.password` resolves; the
|
|
65
|
+
* unqualified `cpln://secret/db` does not, except for `gcp` secrets mounted as
|
|
66
|
+
* a file. The field differs by secret type:
|
|
67
|
+
*
|
|
68
|
+
* | Type | Field |
|
|
69
|
+
* |---|---|
|
|
70
|
+
* | `opaque` | `payload` |
|
|
71
|
+
* | `dictionary` | any key |
|
|
72
|
+
* | `userpass` | `username`, `password` |
|
|
73
|
+
* | `tls` | `cert`, `key` |
|
|
74
|
+
* | `keypair` | `publicKey`, `privateKey` |
|
|
75
|
+
* | `aws` | `accessKey`, `secretKey`, `roleArn` |
|
|
76
|
+
*/
|
|
77
|
+
export declare function secretRef(name: string, field: string): string;
|
|
78
|
+
//# sourceMappingURL=secret-access.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret-access.d.ts","sourceRoot":"","sources":["../../src/composites/secret-access.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,WAAW,iBAAiB;IAChC,mFAAmF;IACnF,IAAI,EAAE,MAAM,CAAC;IACb,0EAA0E;IAC1E,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,oDAAoD;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,sCAAsC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,gEAAgE;IAChE,QAAQ,CAAC,EAAE;QACT,QAAQ,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9D,MAAM,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAC3D,CAAC;CACH;AAED,eAAO,MAAM,YAAY;;;EAoDP,CAAC;AAEnB;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAE7D"}
|