@xemahq/xema 0.13.0 → 0.15.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 +90 -21
- package/dist/assets/appliance-base/distribution.lock.json +5144 -0
- package/dist/assets/appliance-base/images.lock.json +1706 -0
- package/dist/assets/appliance-lean/distribution.lock.json +2888 -0
- package/dist/assets/appliance-lean/images.lock.json +1229 -0
- package/dist/assets/boot-graph.json +380 -28
- package/dist/assets/cloud/distribution.lock.json +5278 -0
- package/dist/assets/cloud/images.lock.json +1713 -0
- package/dist/assets/core/distribution.lock.json +2401 -354
- package/dist/assets/core/images.lock.json +1208 -268
- package/dist/assets/distribution-assets.manifest.json +147 -0
- package/dist/assets/keycloak/realm-xema.json +412 -0
- package/dist/assets/minimal/distribution.lock.json +2710 -0
- package/dist/assets/minimal/images.lock.json +1149 -0
- package/dist/assets/oss/distribution.lock.json +3742 -494
- package/dist/assets/oss/images.lock.json +1591 -472
- package/dist/assets/starter/distribution.lock.json +3422 -0
- package/dist/assets/starter/images.lock.json +1404 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +40 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/apply.d.ts.map +1 -1
- package/dist/commands/apply.js +2 -2
- package/dist/commands/apply.js.map +1 -1
- package/dist/commands/biome-dev.d.ts +3 -0
- package/dist/commands/biome-dev.d.ts.map +1 -0
- package/dist/commands/biome-dev.js +176 -0
- package/dist/commands/biome-dev.js.map +1 -0
- package/dist/commands/biome-validate.d.ts +10 -0
- package/dist/commands/biome-validate.d.ts.map +1 -0
- package/dist/commands/biome-validate.js +49 -0
- package/dist/commands/biome-validate.js.map +1 -0
- package/dist/commands/biome.d.ts.map +1 -1
- package/dist/commands/biome.js +437 -26
- package/dist/commands/biome.js.map +1 -1
- package/dist/commands/canopy.d.ts +3 -0
- package/dist/commands/canopy.d.ts.map +1 -0
- package/dist/commands/canopy.js +214 -0
- package/dist/commands/canopy.js.map +1 -0
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +78 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +92 -20
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/dist.d.ts +13 -0
- package/dist/commands/dist.d.ts.map +1 -1
- package/dist/commands/dist.js +51 -11
- package/dist/commands/dist.js.map +1 -1
- package/dist/commands/doctor.d.ts +25 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +422 -18
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/down.d.ts +10 -0
- package/dist/commands/down.d.ts.map +1 -1
- package/dist/commands/down.js +107 -33
- package/dist/commands/down.js.map +1 -1
- package/dist/commands/export.js +1 -1
- package/dist/commands/export.js.map +1 -1
- package/dist/commands/import.d.ts.map +1 -1
- package/dist/commands/import.js +2 -2
- package/dist/commands/import.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +56 -3
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/installation.d.ts +3 -0
- package/dist/commands/installation.d.ts.map +1 -0
- package/dist/commands/installation.js +258 -0
- package/dist/commands/installation.js.map +1 -0
- package/dist/commands/license.d.ts +3 -0
- package/dist/commands/license.d.ts.map +1 -0
- package/dist/commands/license.js +97 -0
- package/dist/commands/license.js.map +1 -0
- package/dist/commands/login.d.ts +4 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +127 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logs.d.ts +21 -0
- package/dist/commands/logs.d.ts.map +1 -1
- package/dist/commands/logs.js +133 -32
- package/dist/commands/logs.js.map +1 -1
- package/dist/commands/objects.d.ts.map +1 -1
- package/dist/commands/objects.js +85 -6
- package/dist/commands/objects.js.map +1 -1
- package/dist/commands/plan.d.ts.map +1 -1
- package/dist/commands/plan.js +2 -2
- package/dist/commands/plan.js.map +1 -1
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +61 -9
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/serve.d.ts.map +1 -1
- package/dist/commands/serve.js +67 -14
- package/dist/commands/serve.js.map +1 -1
- package/dist/commands/shell.d.ts.map +1 -1
- package/dist/commands/shell.js +190 -6
- package/dist/commands/shell.js.map +1 -1
- package/dist/commands/source.d.ts +3 -0
- package/dist/commands/source.d.ts.map +1 -0
- package/dist/commands/source.js +120 -0
- package/dist/commands/source.js.map +1 -0
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +29 -3
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +70 -5
- package/dist/commands/up.js.map +1 -1
- package/dist/dev/env-defaults.d.ts +1 -0
- package/dist/dev/env-defaults.d.ts.map +1 -1
- package/dist/dev/env-defaults.js +24 -12
- package/dist/dev/env-defaults.js.map +1 -1
- package/dist/dev/forked-worker-bootstrap-protocol.d.ts +17 -0
- package/dist/dev/forked-worker-bootstrap-protocol.d.ts.map +1 -0
- package/dist/dev/forked-worker-bootstrap-protocol.js +35 -0
- package/dist/dev/forked-worker-bootstrap-protocol.js.map +1 -0
- package/dist/dev/forked-worker-bootstrap.d.ts +18 -0
- package/dist/dev/forked-worker-bootstrap.d.ts.map +1 -0
- package/dist/dev/forked-worker-bootstrap.js +84 -0
- package/dist/dev/forked-worker-bootstrap.js.map +1 -0
- package/dist/dev/forked-worker.d.ts +29 -0
- package/dist/dev/forked-worker.d.ts.map +1 -1
- package/dist/dev/forked-worker.js +267 -42
- package/dist/dev/forked-worker.js.map +1 -1
- package/dist/dev/opa-policies.d.ts +3 -0
- package/dist/dev/opa-policies.d.ts.map +1 -0
- package/dist/dev/opa-policies.js +64 -0
- package/dist/dev/opa-policies.js.map +1 -0
- package/dist/lib/cli-errors.d.ts +7 -0
- package/dist/lib/cli-errors.d.ts.map +1 -0
- package/dist/lib/cli-errors.js +30 -0
- package/dist/lib/cli-errors.js.map +1 -0
- package/dist/lib/control-plane.d.ts +5 -1
- package/dist/lib/control-plane.d.ts.map +1 -1
- package/dist/lib/control-plane.js +61 -8
- package/dist/lib/control-plane.js.map +1 -1
- package/dist/lib/exit-codes.d.ts +3 -4
- package/dist/lib/exit-codes.d.ts.map +1 -1
- package/dist/lib/exit-codes.js +3 -4
- package/dist/lib/exit-codes.js.map +1 -1
- package/dist/lib/http-error.d.ts +2 -0
- package/dist/lib/http-error.d.ts.map +1 -0
- package/dist/lib/http-error.js +51 -0
- package/dist/lib/http-error.js.map +1 -0
- package/dist/lib/roster-profile.d.ts +10 -0
- package/dist/lib/roster-profile.d.ts.map +1 -0
- package/dist/lib/roster-profile.js +44 -0
- package/dist/lib/roster-profile.js.map +1 -0
- package/dist/runtime/asset-provenance.d.ts +17 -0
- package/dist/runtime/asset-provenance.d.ts.map +1 -0
- package/dist/runtime/asset-provenance.js +29 -0
- package/dist/runtime/asset-provenance.js.map +1 -0
- package/dist/runtime/auth/client-bootstrap.d.ts +11 -0
- package/dist/runtime/auth/client-bootstrap.d.ts.map +1 -0
- package/dist/runtime/auth/client-bootstrap.js +60 -0
- package/dist/runtime/auth/client-bootstrap.js.map +1 -0
- package/dist/runtime/auth/device-flow.d.ts +43 -0
- package/dist/runtime/auth/device-flow.d.ts.map +1 -0
- package/dist/runtime/auth/device-flow.js +201 -0
- package/dist/runtime/auth/device-flow.js.map +1 -0
- package/dist/runtime/auth/session-auth.d.ts +8 -0
- package/dist/runtime/auth/session-auth.d.ts.map +1 -0
- package/dist/runtime/auth/session-auth.js +43 -0
- package/dist/runtime/auth/session-auth.js.map +1 -0
- package/dist/runtime/auth/session-store.d.ts +19 -0
- package/dist/runtime/auth/session-store.d.ts.map +1 -0
- package/dist/runtime/auth/session-store.js +83 -0
- package/dist/runtime/auth/session-store.js.map +1 -0
- package/dist/runtime/auth/token-claims.d.ts +2 -0
- package/dist/runtime/auth/token-claims.d.ts.map +1 -0
- package/dist/runtime/auth/token-claims.js +45 -0
- package/dist/runtime/auth/token-claims.js.map +1 -0
- package/dist/runtime/biome-dev.d.ts +28 -0
- package/dist/runtime/biome-dev.d.ts.map +1 -0
- package/dist/runtime/biome-dev.js +131 -0
- package/dist/runtime/biome-dev.js.map +1 -0
- package/dist/runtime/biome-local-install.d.ts +29 -0
- package/dist/runtime/biome-local-install.d.ts.map +1 -0
- package/dist/runtime/biome-local-install.js +243 -0
- package/dist/runtime/biome-local-install.js.map +1 -0
- package/dist/runtime/biome-provenance.d.ts +26 -0
- package/dist/runtime/biome-provenance.d.ts.map +1 -0
- package/dist/runtime/biome-provenance.js +70 -0
- package/dist/runtime/biome-provenance.js.map +1 -0
- package/dist/runtime/biome-publish.d.ts +48 -0
- package/dist/runtime/biome-publish.d.ts.map +1 -0
- package/dist/runtime/biome-publish.js +278 -0
- package/dist/runtime/biome-publish.js.map +1 -0
- package/dist/runtime/biome-scaffold.d.ts +35 -0
- package/dist/runtime/biome-scaffold.d.ts.map +1 -0
- package/dist/runtime/biome-scaffold.js +151 -0
- package/dist/runtime/biome-scaffold.js.map +1 -0
- package/dist/runtime/biome-validate.d.ts +28 -0
- package/dist/runtime/biome-validate.d.ts.map +1 -0
- package/dist/runtime/biome-validate.js +452 -0
- package/dist/runtime/biome-validate.js.map +1 -0
- package/dist/runtime/boot-graph-loader.d.ts +1 -0
- package/dist/runtime/boot-graph-loader.d.ts.map +1 -1
- package/dist/runtime/boot-graph-loader.js +99 -7
- package/dist/runtime/boot-graph-loader.js.map +1 -1
- package/dist/runtime/canopy-refs.d.ts +8 -0
- package/dist/runtime/canopy-refs.d.ts.map +1 -0
- package/dist/runtime/canopy-refs.js +51 -0
- package/dist/runtime/canopy-refs.js.map +1 -0
- package/dist/runtime/canopy-replies.d.ts +14 -0
- package/dist/runtime/canopy-replies.d.ts.map +1 -0
- package/dist/runtime/canopy-replies.js +39 -0
- package/dist/runtime/canopy-replies.js.map +1 -0
- package/dist/runtime/capability-invoke.d.ts +35 -0
- package/dist/runtime/capability-invoke.d.ts.map +1 -0
- package/dist/runtime/capability-invoke.js +119 -0
- package/dist/runtime/capability-invoke.js.map +1 -0
- package/dist/runtime/cleanup.d.ts +10 -0
- package/dist/runtime/cleanup.d.ts.map +1 -0
- package/dist/runtime/cleanup.js +35 -0
- package/dist/runtime/cleanup.js.map +1 -0
- package/dist/runtime/config/dev-mode.d.ts +8 -0
- package/dist/runtime/config/dev-mode.d.ts.map +1 -0
- package/dist/runtime/config/dev-mode.js +84 -0
- package/dist/runtime/config/dev-mode.js.map +1 -0
- package/dist/runtime/config/init-presets.d.ts +1 -1
- package/dist/runtime/config/init-presets.d.ts.map +1 -1
- package/dist/runtime/config/init-presets.js +68 -13
- package/dist/runtime/config/init-presets.js.map +1 -1
- package/dist/runtime/config/loader.d.ts +1 -0
- package/dist/runtime/config/loader.d.ts.map +1 -1
- package/dist/runtime/config/loader.js +41 -5
- package/dist/runtime/config/loader.js.map +1 -1
- package/dist/runtime/config/schema.d.ts +27 -12
- package/dist/runtime/config/schema.d.ts.map +1 -1
- package/dist/runtime/config/schema.js +113 -8
- package/dist/runtime/config/schema.js.map +1 -1
- package/dist/runtime/config/sources-config.d.ts +14 -0
- package/dist/runtime/config/sources-config.d.ts.map +1 -0
- package/dist/runtime/config/sources-config.js +79 -0
- package/dist/runtime/config/sources-config.js.map +1 -0
- package/dist/runtime/distribution/available-biome.d.ts.map +1 -1
- package/dist/runtime/distribution/available-biome.js +2 -0
- package/dist/runtime/distribution/available-biome.js.map +1 -1
- package/dist/runtime/distribution/compose.d.ts +2 -1
- package/dist/runtime/distribution/compose.d.ts.map +1 -1
- package/dist/runtime/distribution/compose.js +4 -1
- package/dist/runtime/distribution/compose.js.map +1 -1
- package/dist/runtime/env-seeder.d.ts +5 -0
- package/dist/runtime/env-seeder.d.ts.map +1 -1
- package/dist/runtime/env-seeder.js +152 -19
- package/dist/runtime/env-seeder.js.map +1 -1
- package/dist/runtime/foreground.d.ts +9 -0
- package/dist/runtime/foreground.d.ts.map +1 -1
- package/dist/runtime/foreground.js +37 -3
- package/dist/runtime/foreground.js.map +1 -1
- package/dist/runtime/infra/infra-catalog.d.ts +34 -1
- package/dist/runtime/infra/infra-catalog.d.ts.map +1 -1
- package/dist/runtime/infra/infra-catalog.js +202 -10
- package/dist/runtime/infra/infra-catalog.js.map +1 -1
- package/dist/runtime/infra/infra-environment.d.ts +10 -0
- package/dist/runtime/infra/infra-environment.d.ts.map +1 -0
- package/dist/runtime/infra/infra-environment.js +76 -0
- package/dist/runtime/infra/infra-environment.js.map +1 -0
- package/dist/runtime/infra/infra-plan.d.ts +2 -1
- package/dist/runtime/infra/infra-plan.d.ts.map +1 -1
- package/dist/runtime/infra/infra-plan.js +10 -0
- package/dist/runtime/infra/infra-plan.js.map +1 -1
- package/dist/runtime/infra/infra-runner.d.ts +16 -1
- package/dist/runtime/infra/infra-runner.d.ts.map +1 -1
- package/dist/runtime/infra/infra-runner.js +245 -55
- package/dist/runtime/infra/infra-runner.js.map +1 -1
- package/dist/runtime/infra/keycloak-realm.d.ts +25 -0
- package/dist/runtime/infra/keycloak-realm.d.ts.map +1 -0
- package/dist/runtime/infra/keycloak-realm.js +116 -0
- package/dist/runtime/infra/keycloak-realm.js.map +1 -0
- package/dist/runtime/infra/postgres-endpoint.d.ts +8 -0
- package/dist/runtime/infra/postgres-endpoint.d.ts.map +1 -0
- package/dist/runtime/infra/postgres-endpoint.js +21 -0
- package/dist/runtime/infra/postgres-endpoint.js.map +1 -0
- package/dist/runtime/installation/compiler.d.ts +114 -0
- package/dist/runtime/installation/compiler.d.ts.map +1 -0
- package/dist/runtime/installation/compiler.js +456 -0
- package/dist/runtime/installation/compiler.js.map +1 -0
- package/dist/runtime/installation/contract.d.ts +296 -0
- package/dist/runtime/installation/contract.d.ts.map +1 -0
- package/dist/runtime/installation/contract.js +504 -0
- package/dist/runtime/installation/contract.js.map +1 -0
- package/dist/runtime/installation/current-launcher-renderer.d.ts +12 -0
- package/dist/runtime/installation/current-launcher-renderer.d.ts.map +1 -0
- package/dist/runtime/installation/current-launcher-renderer.js +123 -0
- package/dist/runtime/installation/current-launcher-renderer.js.map +1 -0
- package/dist/runtime/installation/diagnostics.d.ts +16 -0
- package/dist/runtime/installation/diagnostics.d.ts.map +1 -0
- package/dist/runtime/installation/diagnostics.js +21 -0
- package/dist/runtime/installation/diagnostics.js.map +1 -0
- package/dist/runtime/installation/diff.d.ts +32 -0
- package/dist/runtime/installation/diff.d.ts.map +1 -0
- package/dist/runtime/installation/diff.js +136 -0
- package/dist/runtime/installation/diff.js.map +1 -0
- package/dist/runtime/installation/format.d.ts +3 -0
- package/dist/runtime/installation/format.d.ts.map +1 -0
- package/dist/runtime/installation/format.js +22 -0
- package/dist/runtime/installation/format.js.map +1 -0
- package/dist/runtime/installation/from-current-config.d.ts +9 -0
- package/dist/runtime/installation/from-current-config.d.ts.map +1 -0
- package/dist/runtime/installation/from-current-config.js +245 -0
- package/dist/runtime/installation/from-current-config.js.map +1 -0
- package/dist/runtime/installation/helm-release-readiness.d.ts +9 -0
- package/dist/runtime/installation/helm-release-readiness.d.ts.map +1 -0
- package/dist/runtime/installation/helm-release-readiness.js +97 -0
- package/dist/runtime/installation/helm-release-readiness.js.map +1 -0
- package/dist/runtime/installation/helm-release.d.ts +24 -0
- package/dist/runtime/installation/helm-release.d.ts.map +1 -0
- package/dist/runtime/installation/helm-release.js +96 -0
- package/dist/runtime/installation/helm-release.js.map +1 -0
- package/dist/runtime/installation/index.d.ts +22 -0
- package/dist/runtime/installation/index.d.ts.map +1 -0
- package/dist/runtime/installation/index.js +38 -0
- package/dist/runtime/installation/index.js.map +1 -0
- package/dist/runtime/installation/json-schema.d.ts +4 -0
- package/dist/runtime/installation/json-schema.d.ts.map +1 -0
- package/dist/runtime/installation/json-schema.js +16 -0
- package/dist/runtime/installation/json-schema.js.map +1 -0
- package/dist/runtime/installation/kubernetes-readiness.d.ts +60 -0
- package/dist/runtime/installation/kubernetes-readiness.d.ts.map +1 -0
- package/dist/runtime/installation/kubernetes-readiness.js +384 -0
- package/dist/runtime/installation/kubernetes-readiness.js.map +1 -0
- package/dist/runtime/installation/lifecycle.d.ts +25 -0
- package/dist/runtime/installation/lifecycle.d.ts.map +1 -0
- package/dist/runtime/installation/lifecycle.js +157 -0
- package/dist/runtime/installation/lifecycle.js.map +1 -0
- package/dist/runtime/installation/readiness-proof.d.ts +72 -0
- package/dist/runtime/installation/readiness-proof.d.ts.map +1 -0
- package/dist/runtime/installation/readiness-proof.js +142 -0
- package/dist/runtime/installation/readiness-proof.js.map +1 -0
- package/dist/runtime/installation/readiness.d.ts +21 -0
- package/dist/runtime/installation/readiness.d.ts.map +1 -0
- package/dist/runtime/installation/readiness.js +418 -0
- package/dist/runtime/installation/readiness.js.map +1 -0
- package/dist/runtime/installation/serialization.d.ts +3 -0
- package/dist/runtime/installation/serialization.d.ts.map +1 -0
- package/dist/runtime/installation/serialization.js +39 -0
- package/dist/runtime/installation/serialization.js.map +1 -0
- package/dist/runtime/installation/setup-profile.d.ts +8 -0
- package/dist/runtime/installation/setup-profile.d.ts.map +1 -0
- package/dist/runtime/installation/setup-profile.js +41 -0
- package/dist/runtime/installation/setup-profile.js.map +1 -0
- package/dist/runtime/installation/setup-renderer.d.ts +31 -0
- package/dist/runtime/installation/setup-renderer.d.ts.map +1 -0
- package/dist/runtime/installation/setup-renderer.js +238 -0
- package/dist/runtime/installation/setup-renderer.js.map +1 -0
- package/dist/runtime/installation/state-store.d.ts +28 -0
- package/dist/runtime/installation/state-store.d.ts.map +1 -0
- package/dist/runtime/installation/state-store.js +377 -0
- package/dist/runtime/installation/state-store.js.map +1 -0
- package/dist/runtime/installation/status.d.ts +24 -0
- package/dist/runtime/installation/status.d.ts.map +1 -0
- package/dist/runtime/installation/status.js +52 -0
- package/dist/runtime/installation/status.js.map +1 -0
- package/dist/runtime/installation/support-bundle.d.ts +30 -0
- package/dist/runtime/installation/support-bundle.d.ts.map +1 -0
- package/dist/runtime/installation/support-bundle.js +145 -0
- package/dist/runtime/installation/support-bundle.js.map +1 -0
- package/dist/runtime/installation/to-current-config.d.ts +4 -0
- package/dist/runtime/installation/to-current-config.d.ts.map +1 -0
- package/dist/runtime/installation/to-current-config.js +171 -0
- package/dist/runtime/installation/to-current-config.js.map +1 -0
- package/dist/runtime/installation/validation.d.ts +8 -0
- package/dist/runtime/installation/validation.d.ts.map +1 -0
- package/dist/runtime/installation/validation.js +117 -0
- package/dist/runtime/installation/validation.js.map +1 -0
- package/dist/runtime/installation/validators/common.d.ts +4 -0
- package/dist/runtime/installation/validators/common.d.ts.map +1 -0
- package/dist/runtime/installation/validators/common.js +32 -0
- package/dist/runtime/installation/validators/common.js.map +1 -0
- package/dist/runtime/installation/validators/infrastructure.d.ts +4 -0
- package/dist/runtime/installation/validators/infrastructure.d.ts.map +1 -0
- package/dist/runtime/installation/validators/infrastructure.js +96 -0
- package/dist/runtime/installation/validators/infrastructure.js.map +1 -0
- package/dist/runtime/installation/validators/operational.d.ts +4 -0
- package/dist/runtime/installation/validators/operational.d.ts.map +1 -0
- package/dist/runtime/installation/validators/operational.js +68 -0
- package/dist/runtime/installation/validators/operational.js.map +1 -0
- package/dist/runtime/installation/validators/profile.d.ts +4 -0
- package/dist/runtime/installation/validators/profile.d.ts.map +1 -0
- package/dist/runtime/installation/validators/profile.js +80 -0
- package/dist/runtime/installation/validators/profile.js.map +1 -0
- package/dist/runtime/installation/validators/secrets.d.ts +4 -0
- package/dist/runtime/installation/validators/secrets.d.ts.map +1 -0
- package/dist/runtime/installation/validators/secrets.js +85 -0
- package/dist/runtime/installation/validators/secrets.js.map +1 -0
- package/dist/runtime/launch-plan-format.d.ts +3 -0
- package/dist/runtime/launch-plan-format.d.ts.map +1 -0
- package/dist/runtime/launch-plan-format.js +57 -0
- package/dist/runtime/launch-plan-format.js.map +1 -0
- package/dist/runtime/launch.d.ts +35 -3
- package/dist/runtime/launch.d.ts.map +1 -1
- package/dist/runtime/launch.js +382 -37
- package/dist/runtime/launch.js.map +1 -1
- package/dist/runtime/license/license-clock.d.ts +12 -0
- package/dist/runtime/license/license-clock.d.ts.map +1 -0
- package/dist/runtime/license/license-clock.js +57 -0
- package/dist/runtime/license/license-clock.js.map +1 -0
- package/dist/runtime/license/license-report.d.ts +19 -0
- package/dist/runtime/license/license-report.d.ts.map +1 -0
- package/dist/runtime/license/license-report.js +105 -0
- package/dist/runtime/license/license-report.js.map +1 -0
- package/dist/runtime/license/license-store.d.ts +5 -0
- package/dist/runtime/license/license-store.d.ts.map +1 -0
- package/dist/runtime/license/license-store.js +11 -0
- package/dist/runtime/license/license-store.js.map +1 -0
- package/dist/runtime/license/registry-credential.d.ts +26 -0
- package/dist/runtime/license/registry-credential.d.ts.map +1 -0
- package/dist/runtime/license/registry-credential.js +94 -0
- package/dist/runtime/license/registry-credential.js.map +1 -0
- package/dist/runtime/license/resolve-license.d.ts +30 -0
- package/dist/runtime/license/resolve-license.d.ts.map +1 -0
- package/dist/runtime/license/resolve-license.js +73 -0
- package/dist/runtime/license/resolve-license.js.map +1 -0
- package/dist/runtime/license/store-license.d.ts +18 -0
- package/dist/runtime/license/store-license.d.ts.map +1 -0
- package/dist/runtime/license/store-license.js +26 -0
- package/dist/runtime/license/store-license.js.map +1 -0
- package/dist/runtime/lock-loader.d.ts +3 -6
- package/dist/runtime/lock-loader.d.ts.map +1 -1
- package/dist/runtime/lock-loader.js +26 -20
- package/dist/runtime/lock-loader.js.map +1 -1
- package/dist/runtime/native-process-group.d.ts +46 -0
- package/dist/runtime/native-process-group.d.ts.map +1 -0
- package/dist/runtime/native-process-group.js +390 -0
- package/dist/runtime/native-process-group.js.map +1 -0
- package/dist/runtime/object-registry-client.d.ts +31 -0
- package/dist/runtime/object-registry-client.d.ts.map +1 -0
- package/dist/runtime/object-registry-client.js +54 -0
- package/dist/runtime/object-registry-client.js.map +1 -0
- package/dist/runtime/paths.d.ts +2 -0
- package/dist/runtime/paths.d.ts.map +1 -1
- package/dist/runtime/paths.js +3 -0
- package/dist/runtime/paths.js.map +1 -1
- package/dist/runtime/roster.d.ts +12 -5
- package/dist/runtime/roster.d.ts.map +1 -1
- package/dist/runtime/roster.js +89 -11
- package/dist/runtime/roster.js.map +1 -1
- package/dist/runtime/run-manifest.d.ts +52 -0
- package/dist/runtime/run-manifest.d.ts.map +1 -0
- package/dist/runtime/run-manifest.js +587 -0
- package/dist/runtime/run-manifest.js.map +1 -0
- package/dist/runtime/runner/container-preflight.d.ts +77 -0
- package/dist/runtime/runner/container-preflight.d.ts.map +1 -0
- package/dist/runtime/runner/container-preflight.js +360 -0
- package/dist/runtime/runner/container-preflight.js.map +1 -0
- package/dist/runtime/runner/container-runner.d.ts +14 -0
- package/dist/runtime/runner/container-runner.d.ts.map +1 -1
- package/dist/runtime/runner/container-runner.js +110 -14
- package/dist/runtime/runner/container-runner.js.map +1 -1
- package/dist/runtime/runner/docker-cli.d.ts +35 -2
- package/dist/runtime/runner/docker-cli.d.ts.map +1 -1
- package/dist/runtime/runner/docker-cli.js +314 -9
- package/dist/runtime/runner/docker-cli.js.map +1 -1
- package/dist/runtime/runner/health-probe.d.ts +1 -0
- package/dist/runtime/runner/health-probe.d.ts.map +1 -1
- package/dist/runtime/runner/health-probe.js +3 -2
- package/dist/runtime/runner/health-probe.js.map +1 -1
- package/dist/runtime/runner/helm-cli.d.ts +19 -1
- package/dist/runtime/runner/helm-cli.d.ts.map +1 -1
- package/dist/runtime/runner/helm-cli.js +76 -8
- package/dist/runtime/runner/helm-cli.js.map +1 -1
- package/dist/runtime/runner/helm-runner.d.ts +3 -0
- package/dist/runtime/runner/helm-runner.d.ts.map +1 -1
- package/dist/runtime/runner/helm-runner.js +23 -7
- package/dist/runtime/runner/helm-runner.js.map +1 -1
- package/dist/runtime/runner/host-platform.d.ts +39 -0
- package/dist/runtime/runner/host-platform.d.ts.map +1 -0
- package/dist/runtime/runner/host-platform.js +136 -0
- package/dist/runtime/runner/host-platform.js.map +1 -0
- package/dist/runtime/runner/kube-cli.d.ts +23 -0
- package/dist/runtime/runner/kube-cli.d.ts.map +1 -0
- package/dist/runtime/runner/kube-cli.js +112 -0
- package/dist/runtime/runner/kube-cli.js.map +1 -0
- package/dist/runtime/runner/native-runner.d.ts.map +1 -1
- package/dist/runtime/runner/native-runner.js +46 -15
- package/dist/runtime/runner/native-runner.js.map +1 -1
- package/dist/runtime/runner/service-runner.d.ts +5 -0
- package/dist/runtime/runner/service-runner.d.ts.map +1 -1
- package/dist/runtime/runner/service-runner.js.map +1 -1
- package/dist/runtime/runner/stream-outcome.d.ts +7 -0
- package/dist/runtime/runner/stream-outcome.d.ts.map +1 -0
- package/dist/runtime/runner/stream-outcome.js +13 -0
- package/dist/runtime/runner/stream-outcome.js.map +1 -0
- package/dist/runtime/secrets/managed-local-cipher.d.ts +18 -0
- package/dist/runtime/secrets/managed-local-cipher.d.ts.map +1 -0
- package/dist/runtime/secrets/managed-local-cipher.js +110 -0
- package/dist/runtime/secrets/managed-local-cipher.js.map +1 -0
- package/dist/runtime/secrets/managed-local-files.d.ts +4 -0
- package/dist/runtime/secrets/managed-local-files.d.ts.map +1 -0
- package/dist/runtime/secrets/managed-local-files.js +132 -0
- package/dist/runtime/secrets/managed-local-files.js.map +1 -0
- package/dist/runtime/secrets/managed-local-key-provider.d.ts +27 -0
- package/dist/runtime/secrets/managed-local-key-provider.d.ts.map +1 -0
- package/dist/runtime/secrets/managed-local-key-provider.js +144 -0
- package/dist/runtime/secrets/managed-local-key-provider.js.map +1 -0
- package/dist/runtime/secrets/managed-local-secret-store.d.ts +18 -0
- package/dist/runtime/secrets/managed-local-secret-store.d.ts.map +1 -0
- package/dist/runtime/secrets/managed-local-secret-store.js +82 -0
- package/dist/runtime/secrets/managed-local-secret-store.js.map +1 -0
- package/dist/runtime/secrets/managed-local-store.d.ts +33 -0
- package/dist/runtime/secrets/managed-local-store.d.ts.map +1 -0
- package/dist/runtime/secrets/managed-local-store.js +121 -0
- package/dist/runtime/secrets/managed-local-store.js.map +1 -0
- package/dist/runtime/secrets/resolver.d.ts +23 -0
- package/dist/runtime/secrets/resolver.d.ts.map +1 -0
- package/dist/runtime/secrets/resolver.js +265 -0
- package/dist/runtime/secrets/resolver.js.map +1 -0
- package/dist/runtime/secrets/url-security.d.ts +3 -0
- package/dist/runtime/secrets/url-security.d.ts.map +1 -0
- package/dist/runtime/secrets/url-security.js +13 -0
- package/dist/runtime/secrets/url-security.js.map +1 -0
- package/dist/runtime/sources/credentials.d.ts +2 -0
- package/dist/runtime/sources/credentials.d.ts.map +1 -1
- package/dist/runtime/sources/credentials.js +51 -1
- package/dist/runtime/sources/credentials.js.map +1 -1
- package/dist/runtime/sources/kinds/distribution.js +3 -3
- package/dist/runtime/sources/kinds/distribution.js.map +1 -1
- package/dist/runtime/sources/kinds/git.d.ts +6 -3
- package/dist/runtime/sources/kinds/git.d.ts.map +1 -1
- package/dist/runtime/sources/kinds/git.js +99 -22
- package/dist/runtime/sources/kinds/git.js.map +1 -1
- package/dist/runtime/sources/manifest-walk.d.ts +1 -0
- package/dist/runtime/sources/manifest-walk.d.ts.map +1 -1
- package/dist/runtime/sources/manifest-walk.js +16 -11
- package/dist/runtime/sources/manifest-walk.js.map +1 -1
- package/dist/runtime/sources/resolve-context.d.ts +7 -0
- package/dist/runtime/sources/resolve-context.d.ts.map +1 -0
- package/dist/runtime/sources/resolve-context.js +3 -0
- package/dist/runtime/sources/resolve-context.js.map +1 -0
- package/dist/runtime/sources/resolver.d.ts +2 -2
- package/dist/runtime/sources/resolver.d.ts.map +1 -1
- package/dist/runtime/sources/resolver.js +11 -5
- package/dist/runtime/sources/resolver.js.map +1 -1
- package/dist/runtime/sources/schema.d.ts.map +1 -1
- package/dist/runtime/sources/schema.js +51 -3
- package/dist/runtime/sources/schema.js.map +1 -1
- package/dist/runtime/store-client.d.ts +59 -0
- package/dist/runtime/store-client.d.ts.map +1 -0
- package/dist/runtime/store-client.js +72 -0
- package/dist/runtime/store-client.js.map +1 -0
- package/dist/runtime/store-submit.d.ts +31 -0
- package/dist/runtime/store-submit.d.ts.map +1 -0
- package/dist/runtime/store-submit.js +77 -0
- package/dist/runtime/store-submit.js.map +1 -0
- package/dist/runtime/supervisor.d.ts +18 -0
- package/dist/runtime/supervisor.d.ts.map +1 -1
- package/dist/runtime/supervisor.js +162 -15
- package/dist/runtime/supervisor.js.map +1 -1
- package/dist/runtime/waves.d.ts +1 -1
- package/dist/runtime/waves.d.ts.map +1 -1
- package/dist/runtime/waves.js +86 -19
- package/dist/runtime/waves.js.map +1 -1
- package/examples/01-local-native.yaml +4 -1
- package/examples/03-byo-infra.yaml +17 -7
- package/examples/05-appliance-helm.yaml +1 -1
- package/examples/06-biome-sources.yaml +4 -1
- package/package.json +20 -28
- package/xema.config.example.yaml +22 -18
- package/LICENSE +0 -176
- package/dist/lib/command-registry.d.ts +0 -5
- package/dist/lib/command-registry.d.ts.map +0 -1
- package/dist/lib/command-registry.js +0 -17
- package/dist/lib/command-registry.js.map +0 -1
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderInstallationSetup = renderInstallationSetup;
|
|
4
|
+
const contract_1 = require("./contract");
|
|
5
|
+
const diff_1 = require("./diff");
|
|
6
|
+
const serialization_1 = require("./serialization");
|
|
7
|
+
const RENDERER_ID = 'xema-cli-installation-setup/v1';
|
|
8
|
+
const MATERIAL_OBLIGATIONS = [
|
|
9
|
+
diff_1.InstallationRenderObligation.RuntimeReconfigure,
|
|
10
|
+
diff_1.InstallationRenderObligation.WorkloadRollout,
|
|
11
|
+
diff_1.InstallationRenderObligation.InfrastructureReconcile,
|
|
12
|
+
diff_1.InstallationRenderObligation.DataAndRecoveryReconcile,
|
|
13
|
+
];
|
|
14
|
+
function renderInstallationSetup(installation, opts = {}) {
|
|
15
|
+
assertSupportedProfile(installation.spec.profile);
|
|
16
|
+
assertProfilePlacement(installation);
|
|
17
|
+
const providers = assertProvidersReady(installation, opts.providers ?? []);
|
|
18
|
+
const artifacts = artifactModels(installation, providers)
|
|
19
|
+
.map((candidate) => renderArtifact(installation, candidate))
|
|
20
|
+
.sort((left, right) => left.path.localeCompare(right.path));
|
|
21
|
+
const renderedArtifacts = MATERIAL_OBLIGATIONS.map((obligation) => {
|
|
22
|
+
const obligationArtifacts = artifacts.filter((artifact) => artifact.obligation === obligation);
|
|
23
|
+
if (obligationArtifacts.length === 0) {
|
|
24
|
+
throw new Error(`Installation setup renderer left obligation ${obligation} unresolved.`);
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
obligation,
|
|
28
|
+
rendererId: RENDERER_ID,
|
|
29
|
+
effectivePlanHash: installation.effectivePlanHash,
|
|
30
|
+
artifactDigest: `sha256:${(0, serialization_1.hashInstallation)(obligationArtifacts.map(({ path, digest }) => ({ path, digest })))}`,
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
return {
|
|
34
|
+
rendererId: RENDERER_ID,
|
|
35
|
+
profile: installation.spec.profile,
|
|
36
|
+
effectivePlanHash: installation.effectivePlanHash,
|
|
37
|
+
artifacts,
|
|
38
|
+
renderedArtifacts,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function artifactModels(installation, providers) {
|
|
42
|
+
switch (installation.spec.profile) {
|
|
43
|
+
case contract_1.InstallationProfile.Developer:
|
|
44
|
+
case contract_1.InstallationProfile.Starter:
|
|
45
|
+
return localArtifactModels(installation, providers);
|
|
46
|
+
case contract_1.InstallationProfile.SingleNodeProduction:
|
|
47
|
+
return singleNodeArtifactModels(installation, providers);
|
|
48
|
+
case contract_1.InstallationProfile.BusinessHa:
|
|
49
|
+
case contract_1.InstallationProfile.EnterpriseRegulated:
|
|
50
|
+
case contract_1.InstallationProfile.HostedCell:
|
|
51
|
+
return unsupported(installation.spec.profile);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function localArtifactModels(installation, providers) {
|
|
55
|
+
const spec = installation.spec;
|
|
56
|
+
return [
|
|
57
|
+
{
|
|
58
|
+
path: 'runtime/config.json',
|
|
59
|
+
obligation: diff_1.InstallationRenderObligation.RuntimeReconfigure,
|
|
60
|
+
kind: 'LocalRuntimeConfiguration',
|
|
61
|
+
spec: {
|
|
62
|
+
lifecycle: spec.lifecycle,
|
|
63
|
+
security: spec.security,
|
|
64
|
+
observability: spec.observability,
|
|
65
|
+
capacity: spec.capacity,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
path: 'launcher/workloads.json',
|
|
70
|
+
obligation: diff_1.InstallationRenderObligation.WorkloadRollout,
|
|
71
|
+
kind: 'LocalWorkloadPlan',
|
|
72
|
+
spec: {
|
|
73
|
+
distribution: spec.distribution,
|
|
74
|
+
features: spec.features,
|
|
75
|
+
sources: spec.sources,
|
|
76
|
+
domains: spec.domains,
|
|
77
|
+
upgrade: spec.upgrade,
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
path: 'bootstrap/local.json',
|
|
82
|
+
obligation: diff_1.InstallationRenderObligation.InfrastructureReconcile,
|
|
83
|
+
kind: 'LocalBootstrapPlan',
|
|
84
|
+
spec: {
|
|
85
|
+
profile: spec.profile,
|
|
86
|
+
target: spec.target,
|
|
87
|
+
operator: spec.operator,
|
|
88
|
+
infrastructure: spec.infrastructure,
|
|
89
|
+
secrets: renderedSecretBindings(spec.secrets, providers),
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
path: 'storage/policy.json',
|
|
94
|
+
obligation: diff_1.InstallationRenderObligation.DataAndRecoveryReconcile,
|
|
95
|
+
kind: 'LocalDataPolicy',
|
|
96
|
+
spec: {
|
|
97
|
+
tenancy: spec.tenancy,
|
|
98
|
+
storage: spec.storage,
|
|
99
|
+
recovery: spec.recovery,
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
];
|
|
103
|
+
}
|
|
104
|
+
function singleNodeArtifactModels(installation, providers) {
|
|
105
|
+
const spec = installation.spec;
|
|
106
|
+
return [
|
|
107
|
+
{
|
|
108
|
+
path: 'observability/config.json',
|
|
109
|
+
obligation: diff_1.InstallationRenderObligation.RuntimeReconfigure,
|
|
110
|
+
kind: 'SingleNodeObservabilityConfiguration',
|
|
111
|
+
spec: {
|
|
112
|
+
lifecycle: spec.lifecycle,
|
|
113
|
+
security: spec.security,
|
|
114
|
+
observability: spec.observability,
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
path: 'helm/xema.values.json',
|
|
119
|
+
obligation: diff_1.InstallationRenderObligation.WorkloadRollout,
|
|
120
|
+
kind: 'SingleNodeHelmValues',
|
|
121
|
+
spec: {
|
|
122
|
+
distribution: spec.distribution,
|
|
123
|
+
features: spec.features,
|
|
124
|
+
capacity: spec.capacity,
|
|
125
|
+
domains: spec.domains,
|
|
126
|
+
sources: spec.sources,
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
path: 'upgrade/policy.json',
|
|
131
|
+
obligation: diff_1.InstallationRenderObligation.WorkloadRollout,
|
|
132
|
+
kind: 'SingleNodeUpgradePolicy',
|
|
133
|
+
spec: { upgrade: spec.upgrade },
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
path: 'bootstrap/cluster.json',
|
|
137
|
+
obligation: diff_1.InstallationRenderObligation.InfrastructureReconcile,
|
|
138
|
+
kind: 'SingleNodeBootstrapPlan',
|
|
139
|
+
spec: {
|
|
140
|
+
profile: spec.profile,
|
|
141
|
+
target: spec.target,
|
|
142
|
+
operator: spec.operator,
|
|
143
|
+
infrastructure: spec.infrastructure,
|
|
144
|
+
storage: spec.storage,
|
|
145
|
+
secrets: renderedSecretBindings(spec.secrets, providers),
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
path: 'backup/policy.json',
|
|
150
|
+
obligation: diff_1.InstallationRenderObligation.DataAndRecoveryReconcile,
|
|
151
|
+
kind: 'SingleNodeBackupPolicy',
|
|
152
|
+
spec: {
|
|
153
|
+
tenancy: spec.tenancy,
|
|
154
|
+
recovery: spec.recovery,
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
];
|
|
158
|
+
}
|
|
159
|
+
function renderedSecretBindings(bindings, providers) {
|
|
160
|
+
return bindings.map((binding) => ({
|
|
161
|
+
...binding,
|
|
162
|
+
...(binding.provider === contract_1.SecretReferenceProvider.ManagedLocal
|
|
163
|
+
? { keyRef: providers.get(binding.provider)?.keyRef }
|
|
164
|
+
: {}),
|
|
165
|
+
}));
|
|
166
|
+
}
|
|
167
|
+
function renderArtifact(installation, model) {
|
|
168
|
+
const content = `${(0, serialization_1.serializeInstallation)({
|
|
169
|
+
apiVersion: 'setup.xema.dev/v1',
|
|
170
|
+
kind: model.kind,
|
|
171
|
+
effectivePlanHash: installation.effectivePlanHash,
|
|
172
|
+
spec: model.spec,
|
|
173
|
+
})}\n`;
|
|
174
|
+
return {
|
|
175
|
+
path: model.path,
|
|
176
|
+
mediaType: 'application/json',
|
|
177
|
+
obligation: model.obligation,
|
|
178
|
+
effectivePlanHash: installation.effectivePlanHash,
|
|
179
|
+
digest: `sha256:${(0, serialization_1.hashInstallation)({
|
|
180
|
+
path: model.path,
|
|
181
|
+
effectivePlanHash: installation.effectivePlanHash,
|
|
182
|
+
content,
|
|
183
|
+
})}`,
|
|
184
|
+
content,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
function assertProvidersReady(installation, readiness) {
|
|
188
|
+
const providers = new Map();
|
|
189
|
+
for (const item of readiness) {
|
|
190
|
+
if (providers.has(item.provider)) {
|
|
191
|
+
throw new Error(`Secret provider readiness was declared more than once for ${item.provider}.`);
|
|
192
|
+
}
|
|
193
|
+
providers.set(item.provider, item);
|
|
194
|
+
}
|
|
195
|
+
for (const binding of installation.spec.secrets) {
|
|
196
|
+
const provider = providers.get(binding.provider);
|
|
197
|
+
if (provider?.available !== true) {
|
|
198
|
+
throw new Error(`Secret provider ${binding.provider} is unavailable for binding "${binding.name}"; no fallback provider was attempted.`);
|
|
199
|
+
}
|
|
200
|
+
if (binding.provider === contract_1.SecretReferenceProvider.ManagedLocal &&
|
|
201
|
+
(provider.keyRef === undefined || provider.keyRef.length === 0)) {
|
|
202
|
+
throw new Error(`Managed-local binding "${binding.name}" has no custody key reference.`);
|
|
203
|
+
}
|
|
204
|
+
if (binding.provider === contract_1.SecretReferenceProvider.ManagedLocal &&
|
|
205
|
+
!provider.resolvedEntries?.includes(binding.entry)) {
|
|
206
|
+
throw new Error(`Managed-local binding "${binding.name}" has no authenticated immutable entry "${binding.entry}".`);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return providers;
|
|
210
|
+
}
|
|
211
|
+
function assertSupportedProfile(profile) {
|
|
212
|
+
if (profile === contract_1.InstallationProfile.BusinessHa ||
|
|
213
|
+
profile === contract_1.InstallationProfile.EnterpriseRegulated ||
|
|
214
|
+
profile === contract_1.InstallationProfile.HostedCell) {
|
|
215
|
+
unsupported(profile);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
function assertProfilePlacement(installation) {
|
|
219
|
+
const spec = installation.spec;
|
|
220
|
+
if ((spec.profile === contract_1.InstallationProfile.Developer ||
|
|
221
|
+
spec.profile === contract_1.InstallationProfile.Starter) &&
|
|
222
|
+
(spec.lifecycle.environment !== contract_1.LifecycleEnvironment.Development ||
|
|
223
|
+
spec.target.kind !== contract_1.InstallationTargetKind.LocalMachine)) {
|
|
224
|
+
throw new Error(`Installation setup renderer requires ${spec.profile} to use a development lifecycle on a local-machine target.`);
|
|
225
|
+
}
|
|
226
|
+
if (spec.profile === contract_1.InstallationProfile.SingleNodeProduction &&
|
|
227
|
+
(spec.lifecycle.environment !== contract_1.LifecycleEnvironment.Production ||
|
|
228
|
+
spec.target.kind !== contract_1.InstallationTargetKind.SingleNodeKubernetes ||
|
|
229
|
+
spec.capacity.minReplicas !== 1 ||
|
|
230
|
+
spec.capacity.maxReplicas !== 1 ||
|
|
231
|
+
spec.capacity.zones !== 1)) {
|
|
232
|
+
throw new Error('Installation setup renderer requires single-node-production to use one production Kubernetes node in one zone.');
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
function unsupported(profile) {
|
|
236
|
+
throw new Error(`Installation setup renderer does not support profile ${profile}; no artifacts were produced.`);
|
|
237
|
+
}
|
|
238
|
+
//# sourceMappingURL=setup-renderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-renderer.js","sourceRoot":"","sources":["../../../src/runtime/installation/setup-renderer.ts"],"names":[],"mappings":";;AAyDA,0DAmCC;AA5FD,yCAKoB;AACpB,iCAGgB;AAChB,mDAA0E;AAI1E,MAAM,WAAW,GAAG,gCAAgC,CAAC;AACrD,MAAM,oBAAoB,GAAG;IAC3B,mCAA4B,CAAC,kBAAkB;IAC/C,mCAA4B,CAAC,eAAe;IAC5C,mCAA4B,CAAC,uBAAuB;IACpD,mCAA4B,CAAC,wBAAwB;CAC7C,CAAC;AAqCX,SAAgB,uBAAuB,CACrC,YAAsC,EACtC,OAAuC,EAAE;IAEzC,sBAAsB,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAClD,sBAAsB,CAAC,YAAY,CAAC,CAAC;IACrC,MAAM,SAAS,GAAG,oBAAoB,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;IAC3E,MAAM,SAAS,GAAG,cAAc,CAAC,YAAY,EAAE,SAAS,CAAC;SACtD,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,cAAc,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;SAC3D,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9D,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE;QAChE,MAAM,m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,IAAI,KAAK,CACb,wDAAwD,OAAO,+BAA+B,CAC/F,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type CompiledXemaInstallation } from './compiler';
|
|
2
|
+
import { type InstallationRenderAcknowledgement } from './diff';
|
|
3
|
+
export interface AppliedInstallationState {
|
|
4
|
+
readonly schemaVersion: 2;
|
|
5
|
+
readonly appliedAt: string;
|
|
6
|
+
readonly effectivePlanHash: string;
|
|
7
|
+
readonly renderedArtifacts: readonly InstallationRenderAcknowledgement[];
|
|
8
|
+
readonly plan: CompiledXemaInstallation;
|
|
9
|
+
}
|
|
10
|
+
export interface InstallationStateStoreOptions {
|
|
11
|
+
readonly root?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare class InstallationStateStore {
|
|
14
|
+
private readonly root;
|
|
15
|
+
constructor(opts?: InstallationStateStoreOptions);
|
|
16
|
+
read(installationId: string): AppliedInstallationState | undefined;
|
|
17
|
+
write(plan: CompiledXemaInstallation, renderedArtifacts: readonly InstallationRenderAcknowledgement[], appliedAt?: string): AppliedInstallationState;
|
|
18
|
+
acquireApplyLock(installationId: string): () => void;
|
|
19
|
+
acquireLocalRuntimeLock(): () => void;
|
|
20
|
+
claimLocalRuntimeOwner(installationId: string): void;
|
|
21
|
+
assertLocalRuntimeOwner(installationId: string): void;
|
|
22
|
+
releaseLocalRuntimeOwner(installationId: string): void;
|
|
23
|
+
private acquireLock;
|
|
24
|
+
private appliedPath;
|
|
25
|
+
private localRuntimeOwnerPath;
|
|
26
|
+
private installationDirectory;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=state-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-store.d.ts","sourceRoot":"","sources":["../../../src/runtime/installation/state-store.ts"],"names":[],"mappings":"AAkBA,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,YAAY,CAAC;AACpB,OAAO,EAEL,KAAK,iCAAiC,EACvC,MAAM,QAAQ,CAAC;AAGhB,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,iBAAiB,EAAE,SAAS,iCAAiC,EAAE,CAAC;IACzE,QAAQ,CAAC,IAAI,EAAE,wBAAwB,CAAC;CACzC;AAED,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAgBD,qBAAa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;gBAEX,IAAI,GAAE,6BAAkC;IAIpD,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,wBAAwB,GAAG,SAAS;IAclE,KAAK,CACV,IAAI,EAAE,wBAAwB,EAC9B,iBAAiB,EAAE,SAAS,iCAAiC,EAAE,EAC/D,SAAS,SAA2B,GACnC,wBAAwB;IAiBpB,gBAAgB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,IAAI;IAapD,uBAAuB,IAAI,MAAM,IAAI;IAKrC,sBAAsB,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI;IAqBpD,uBAAuB,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI;IAkBrD,wBAAwB,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI;IAiB7D,OAAO,CAAC,WAAW;IA6DnB,OAAO,CAAC,WAAW;IAOnB,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,qBAAqB;CAQ9B"}
|
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InstallationStateStore = void 0;
|
|
4
|
+
const node_crypto_1 = require("node:crypto");
|
|
5
|
+
const node_fs_1 = require("node:fs");
|
|
6
|
+
const node_os_1 = require("node:os");
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
8
|
+
const compiler_1 = require("./compiler");
|
|
9
|
+
const diff_1 = require("./diff");
|
|
10
|
+
const serialization_1 = require("./serialization");
|
|
11
|
+
const PRIVATE_DIRECTORY_MODE = 0o700;
|
|
12
|
+
const PRIVATE_FILE_MODE = 0o600;
|
|
13
|
+
class InstallationStateStore {
|
|
14
|
+
root;
|
|
15
|
+
constructor(opts = {}) {
|
|
16
|
+
this.root = opts.root ?? (0, node_path_1.join)((0, node_os_1.homedir)(), '.xema', 'installations');
|
|
17
|
+
}
|
|
18
|
+
read(installationId) {
|
|
19
|
+
const path = this.appliedPath(installationId);
|
|
20
|
+
const directory = (0, node_path_1.dirname)(path);
|
|
21
|
+
if (!(0, node_fs_1.existsSync)(directory)) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
assertPrivateDirectory(directory);
|
|
25
|
+
if (!(0, node_fs_1.existsSync)(path)) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
const parsed = JSON.parse(readPrivateFile(path));
|
|
29
|
+
return parseAppliedState(parsed, path);
|
|
30
|
+
}
|
|
31
|
+
write(plan, renderedArtifacts, appliedAt = new Date().toISOString()) {
|
|
32
|
+
validateRenderedArtifacts(renderedArtifacts, plan.effectivePlanHash, `new state for ${plan.metadata.name}`);
|
|
33
|
+
const state = {
|
|
34
|
+
schemaVersion: 2,
|
|
35
|
+
appliedAt,
|
|
36
|
+
effectivePlanHash: plan.effectivePlanHash,
|
|
37
|
+
renderedArtifacts,
|
|
38
|
+
plan,
|
|
39
|
+
};
|
|
40
|
+
writeJsonAtomically(this.appliedPath(plan.metadata.name), state);
|
|
41
|
+
return state;
|
|
42
|
+
}
|
|
43
|
+
acquireApplyLock(installationId) {
|
|
44
|
+
const path = (0, node_path_1.join)(this.installationDirectory(installationId), 'apply.lock');
|
|
45
|
+
return this.acquireLock(path, `Installation "${installationId}"`);
|
|
46
|
+
}
|
|
47
|
+
acquireLocalRuntimeLock() {
|
|
48
|
+
const path = (0, node_path_1.join)(this.root, '.local-runtime', 'apply.lock');
|
|
49
|
+
return this.acquireLock(path, 'Local runtime');
|
|
50
|
+
}
|
|
51
|
+
claimLocalRuntimeOwner(installationId) {
|
|
52
|
+
const path = this.localRuntimeOwnerPath();
|
|
53
|
+
ensurePrivateDirectory((0, node_path_1.dirname)(path));
|
|
54
|
+
if ((0, node_fs_1.existsSync)(path)) {
|
|
55
|
+
const owner = parseLocalRuntimeOwner(JSON.parse(readPrivateFile(path)), path);
|
|
56
|
+
if (owner.installationId !== installationId) {
|
|
57
|
+
throw new Error(`Local managed runtime data is owned by installation "${owner.installationId}", not "${installationId}". Purge the owning installation before reusing fixed local volumes and ports.`);
|
|
58
|
+
}
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
writeJsonAtomically(path, {
|
|
62
|
+
installationId,
|
|
63
|
+
claimedAt: new Date().toISOString(),
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
assertLocalRuntimeOwner(installationId) {
|
|
67
|
+
const path = this.localRuntimeOwnerPath();
|
|
68
|
+
if (!(0, node_fs_1.existsSync)(path)) {
|
|
69
|
+
throw new Error(`Local managed runtime has no durable owner record; refusing destructive cleanup for installation "${installationId}".`);
|
|
70
|
+
}
|
|
71
|
+
const owner = parseLocalRuntimeOwner(JSON.parse(readPrivateFile(path)), path);
|
|
72
|
+
if (owner.installationId !== installationId) {
|
|
73
|
+
throw new Error(`Local managed runtime data is owned by installation "${owner.installationId}", not "${installationId}".`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
releaseLocalRuntimeOwner(installationId) {
|
|
77
|
+
const path = this.localRuntimeOwnerPath();
|
|
78
|
+
if (!(0, node_fs_1.existsSync)(path)) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const owner = parseLocalRuntimeOwner(JSON.parse(readPrivateFile(path)), path);
|
|
82
|
+
if (owner.installationId !== installationId) {
|
|
83
|
+
throw new Error(`Refusing to release local runtime data owned by installation "${owner.installationId}".`);
|
|
84
|
+
}
|
|
85
|
+
(0, node_fs_1.rmSync)(path);
|
|
86
|
+
}
|
|
87
|
+
acquireLock(path, subject) {
|
|
88
|
+
const recoveryPath = `${path}.recovery`;
|
|
89
|
+
ensurePrivateDirectory((0, node_path_1.dirname)(path));
|
|
90
|
+
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
91
|
+
const owner = {
|
|
92
|
+
pid: process.pid,
|
|
93
|
+
token: (0, node_crypto_1.randomUUID)(),
|
|
94
|
+
acquiredAt: new Date().toISOString(),
|
|
95
|
+
};
|
|
96
|
+
try {
|
|
97
|
+
writeExclusiveFile(path, owner);
|
|
98
|
+
let released = false;
|
|
99
|
+
return () => {
|
|
100
|
+
if (!released) {
|
|
101
|
+
assertLockOwnership(path, owner.token);
|
|
102
|
+
released = true;
|
|
103
|
+
(0, node_fs_1.rmSync)(path, { force: true });
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
const code = error.code;
|
|
109
|
+
if (code !== 'EEXIST') {
|
|
110
|
+
throw error;
|
|
111
|
+
}
|
|
112
|
+
const existing = readLockOwner(path);
|
|
113
|
+
if (existing === undefined) {
|
|
114
|
+
throw new Error(`${subject} has an unreadable apply lock at ${path}; remove it only after confirming no apply process is running.`);
|
|
115
|
+
}
|
|
116
|
+
if (processIsAlive(existing.pid)) {
|
|
117
|
+
throw new Error(`${subject} is already being applied by process ${String(existing.pid)}.`);
|
|
118
|
+
}
|
|
119
|
+
const releaseRecovery = acquireRecoveryLock(recoveryPath, subject);
|
|
120
|
+
try {
|
|
121
|
+
const rechecked = readLockOwner(path);
|
|
122
|
+
if (rechecked === undefined ||
|
|
123
|
+
rechecked.token !== existing.token ||
|
|
124
|
+
processIsAlive(rechecked.pid)) {
|
|
125
|
+
throw new Error(`${subject} apply-lock ownership changed during stale-lock recovery; retry after the active apply completes.`);
|
|
126
|
+
}
|
|
127
|
+
(0, node_fs_1.rmSync)(path);
|
|
128
|
+
}
|
|
129
|
+
finally {
|
|
130
|
+
releaseRecovery();
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
throw new Error(`Could not acquire the apply lock for ${subject}.`);
|
|
135
|
+
}
|
|
136
|
+
appliedPath(installationId) {
|
|
137
|
+
return (0, node_path_1.join)(this.installationDirectory(installationId), 'last-applied.json');
|
|
138
|
+
}
|
|
139
|
+
localRuntimeOwnerPath() {
|
|
140
|
+
return (0, node_path_1.join)(this.root, '.local-runtime', 'owner.json');
|
|
141
|
+
}
|
|
142
|
+
installationDirectory(installationId) {
|
|
143
|
+
if (!/^[A-Za-z0-9._-]+$/.test(installationId)) {
|
|
144
|
+
throw new Error(`Installation id "${installationId}" is unsafe for local state storage.`);
|
|
145
|
+
}
|
|
146
|
+
return (0, node_path_1.join)(this.root, installationId);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
exports.InstallationStateStore = InstallationStateStore;
|
|
150
|
+
function parseAppliedState(value, path) {
|
|
151
|
+
if (value === null || typeof value !== 'object') {
|
|
152
|
+
throw new Error(`Applied installation state is invalid: ${path}`);
|
|
153
|
+
}
|
|
154
|
+
const schemaVersion = value.schemaVersion;
|
|
155
|
+
if (schemaVersion === 1) {
|
|
156
|
+
throw new Error(`Applied installation state schema v1 is incompatible with effective-plan renderer evidence; re-apply the installation to create schema v2 state: ${path}`);
|
|
157
|
+
}
|
|
158
|
+
if (schemaVersion !== 2) {
|
|
159
|
+
throw new Error(`Applied installation state schema is unsupported: ${path}`);
|
|
160
|
+
}
|
|
161
|
+
const state = value;
|
|
162
|
+
if (typeof state.appliedAt !== 'string' ||
|
|
163
|
+
!Number.isFinite(Date.parse(state.appliedAt)) ||
|
|
164
|
+
typeof state.effectivePlanHash !== 'string' ||
|
|
165
|
+
!/^[a-f0-9]{64}$/.test(state.effectivePlanHash) ||
|
|
166
|
+
!Array.isArray(state.renderedArtifacts) ||
|
|
167
|
+
state.plan === undefined ||
|
|
168
|
+
state.plan.effectivePlanHash !== state.effectivePlanHash) {
|
|
169
|
+
throw new Error(`Applied installation state is corrupt: ${path}`);
|
|
170
|
+
}
|
|
171
|
+
validateRenderedArtifacts(state.renderedArtifacts, state.effectivePlanHash, path);
|
|
172
|
+
const { effectivePlanHash: _effectivePlanHash, ...planPayload } = state.plan;
|
|
173
|
+
if ((0, serialization_1.hashInstallation)((0, compiler_1.effectivePayload)(planPayload)) !== state.effectivePlanHash) {
|
|
174
|
+
throw new Error(`Applied installation state hash is invalid: ${path}`);
|
|
175
|
+
}
|
|
176
|
+
let plan;
|
|
177
|
+
try {
|
|
178
|
+
plan = (0, compiler_1.compileXemaInstallation)(planPayload);
|
|
179
|
+
}
|
|
180
|
+
catch {
|
|
181
|
+
throw new Error(`Applied installation state plan is invalid: ${path}`);
|
|
182
|
+
}
|
|
183
|
+
if (plan.effectivePlanHash !== state.effectivePlanHash) {
|
|
184
|
+
throw new Error(`Applied installation state plan is non-canonical: ${path}`);
|
|
185
|
+
}
|
|
186
|
+
return {
|
|
187
|
+
schemaVersion: 2,
|
|
188
|
+
appliedAt: state.appliedAt,
|
|
189
|
+
effectivePlanHash: state.effectivePlanHash,
|
|
190
|
+
renderedArtifacts: state.renderedArtifacts,
|
|
191
|
+
plan,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
function parseLocalRuntimeOwner(value, path) {
|
|
195
|
+
if (typeof value !== 'object' || value === null) {
|
|
196
|
+
throw new Error(`Local runtime owner record is invalid at ${path}.`);
|
|
197
|
+
}
|
|
198
|
+
const record = value;
|
|
199
|
+
if (typeof record.installationId !== 'string' ||
|
|
200
|
+
record.installationId.length === 0 ||
|
|
201
|
+
typeof record.claimedAt !== 'string' ||
|
|
202
|
+
record.claimedAt.length === 0) {
|
|
203
|
+
throw new Error(`Local runtime owner record is invalid at ${path}.`);
|
|
204
|
+
}
|
|
205
|
+
return {
|
|
206
|
+
installationId: record.installationId,
|
|
207
|
+
claimedAt: record.claimedAt,
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
const RENDER_OBLIGATIONS = new Set(Object.values(diff_1.InstallationRenderObligation));
|
|
211
|
+
function validateRenderedArtifacts(value, effectivePlanHash, path) {
|
|
212
|
+
const seen = new Set();
|
|
213
|
+
for (const entry of value) {
|
|
214
|
+
if (entry === null || typeof entry !== 'object') {
|
|
215
|
+
throw new Error(`Applied installation renderer evidence is corrupt: ${path}`);
|
|
216
|
+
}
|
|
217
|
+
const evidence = entry;
|
|
218
|
+
if (evidence.obligation === undefined ||
|
|
219
|
+
!RENDER_OBLIGATIONS.has(evidence.obligation) ||
|
|
220
|
+
seen.has(evidence.obligation) ||
|
|
221
|
+
typeof evidence.rendererId !== 'string' ||
|
|
222
|
+
evidence.rendererId.length === 0 ||
|
|
223
|
+
evidence.effectivePlanHash !== effectivePlanHash ||
|
|
224
|
+
typeof evidence.artifactDigest !== 'string' ||
|
|
225
|
+
!/^sha256:[a-f0-9]{64}$/.test(evidence.artifactDigest)) {
|
|
226
|
+
throw new Error(`Applied installation renderer evidence is corrupt: ${path}`);
|
|
227
|
+
}
|
|
228
|
+
seen.add(evidence.obligation);
|
|
229
|
+
}
|
|
230
|
+
for (const required of [
|
|
231
|
+
diff_1.InstallationRenderObligation.RuntimeReconfigure,
|
|
232
|
+
diff_1.InstallationRenderObligation.WorkloadRollout,
|
|
233
|
+
diff_1.InstallationRenderObligation.InfrastructureReconcile,
|
|
234
|
+
diff_1.InstallationRenderObligation.DataAndRecoveryReconcile,
|
|
235
|
+
]) {
|
|
236
|
+
if (!seen.has(required)) {
|
|
237
|
+
throw new Error(`Applied installation renderer evidence is incomplete (${required}): ${path}`);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
function readLockOwner(path) {
|
|
242
|
+
try {
|
|
243
|
+
const value = JSON.parse(readPrivateFile(path));
|
|
244
|
+
return typeof value.pid === 'number' &&
|
|
245
|
+
Number.isInteger(value.pid) &&
|
|
246
|
+
typeof value.token === 'string' &&
|
|
247
|
+
value.token.length > 0 &&
|
|
248
|
+
typeof value.acquiredAt === 'string'
|
|
249
|
+
? value
|
|
250
|
+
: undefined;
|
|
251
|
+
}
|
|
252
|
+
catch {
|
|
253
|
+
return undefined;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
function processIsAlive(pid) {
|
|
257
|
+
try {
|
|
258
|
+
process.kill(pid, 0);
|
|
259
|
+
return true;
|
|
260
|
+
}
|
|
261
|
+
catch (error) {
|
|
262
|
+
return error.code === 'EPERM';
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
function writeJsonAtomically(path, value) {
|
|
266
|
+
const directory = (0, node_path_1.dirname)(path);
|
|
267
|
+
ensurePrivateDirectory(directory);
|
|
268
|
+
const temporary = (0, node_path_1.join)(directory, `.last-applied.${String(process.pid)}.${Date.now().toString(36)}.tmp`);
|
|
269
|
+
const fd = (0, node_fs_1.openSync)(temporary, 'wx', PRIVATE_FILE_MODE);
|
|
270
|
+
try {
|
|
271
|
+
(0, node_fs_1.writeFileSync)(fd, `${(0, serialization_1.serializeInstallation)(value)}\n`, 'utf8');
|
|
272
|
+
(0, node_fs_1.fsyncSync)(fd);
|
|
273
|
+
}
|
|
274
|
+
finally {
|
|
275
|
+
(0, node_fs_1.closeSync)(fd);
|
|
276
|
+
}
|
|
277
|
+
try {
|
|
278
|
+
(0, node_fs_1.renameSync)(temporary, path);
|
|
279
|
+
const directoryFd = (0, node_fs_1.openSync)(directory, 'r');
|
|
280
|
+
try {
|
|
281
|
+
(0, node_fs_1.fsyncSync)(directoryFd);
|
|
282
|
+
}
|
|
283
|
+
finally {
|
|
284
|
+
(0, node_fs_1.closeSync)(directoryFd);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
catch (error) {
|
|
288
|
+
(0, node_fs_1.rmSync)(temporary, { force: true });
|
|
289
|
+
throw error;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
function ensurePrivateDirectory(directory) {
|
|
293
|
+
(0, node_fs_1.mkdirSync)(directory, { recursive: true, mode: PRIVATE_DIRECTORY_MODE });
|
|
294
|
+
assertPrivateDirectory(directory);
|
|
295
|
+
}
|
|
296
|
+
function assertPrivateDirectory(directory) {
|
|
297
|
+
const stat = (0, node_fs_1.lstatSync)(directory);
|
|
298
|
+
if (!stat.isDirectory() ||
|
|
299
|
+
!ownedByCurrentUser(stat.uid) ||
|
|
300
|
+
(process.platform !== 'win32' && (stat.mode & 0o077) !== 0)) {
|
|
301
|
+
throw new Error(`Installation state directory is unsafe at ${directory}; expected an installer-owned directory with mode 0700.`);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
function readPrivateFile(path) {
|
|
305
|
+
let fd;
|
|
306
|
+
try {
|
|
307
|
+
fd = (0, node_fs_1.openSync)(path, node_fs_1.constants.O_RDONLY | (node_fs_1.constants.O_NOFOLLOW ?? 0));
|
|
308
|
+
const stat = (0, node_fs_1.fstatSync)(fd);
|
|
309
|
+
if (!stat.isFile() ||
|
|
310
|
+
!ownedByCurrentUser(stat.uid) ||
|
|
311
|
+
(process.platform !== 'win32' && (stat.mode & 0o077) !== 0)) {
|
|
312
|
+
throw new Error(`Installation state file is unsafe at ${path}; expected an installer-owned regular file with mode 0600.`);
|
|
313
|
+
}
|
|
314
|
+
return (0, node_fs_1.readFileSync)(fd, 'utf8');
|
|
315
|
+
}
|
|
316
|
+
finally {
|
|
317
|
+
if (fd !== undefined) {
|
|
318
|
+
(0, node_fs_1.closeSync)(fd);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
function writeExclusiveFile(path, value) {
|
|
323
|
+
const fd = (0, node_fs_1.openSync)(path, 'wx', PRIVATE_FILE_MODE);
|
|
324
|
+
try {
|
|
325
|
+
(0, node_fs_1.writeFileSync)(fd, `${(0, serialization_1.serializeInstallation)(value)}\n`, 'utf8');
|
|
326
|
+
(0, node_fs_1.fsyncSync)(fd);
|
|
327
|
+
}
|
|
328
|
+
finally {
|
|
329
|
+
(0, node_fs_1.closeSync)(fd);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
function acquireRecoveryLock(path, subject) {
|
|
333
|
+
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
334
|
+
const owner = {
|
|
335
|
+
pid: process.pid,
|
|
336
|
+
token: (0, node_crypto_1.randomUUID)(),
|
|
337
|
+
acquiredAt: new Date().toISOString(),
|
|
338
|
+
};
|
|
339
|
+
try {
|
|
340
|
+
writeExclusiveFile(path, owner);
|
|
341
|
+
return () => {
|
|
342
|
+
assertLockOwnership(path, owner.token);
|
|
343
|
+
(0, node_fs_1.rmSync)(path);
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
catch (error) {
|
|
347
|
+
if (error.code !== 'EEXIST') {
|
|
348
|
+
throw error;
|
|
349
|
+
}
|
|
350
|
+
const existing = readLockOwner(path);
|
|
351
|
+
if (existing === undefined) {
|
|
352
|
+
throw new Error(`${subject} has an unreadable stale-lock recovery lease at ${path}; remove it only after confirming no apply process is running.`);
|
|
353
|
+
}
|
|
354
|
+
if (processIsAlive(existing.pid)) {
|
|
355
|
+
throw new Error(`${subject} stale-lock recovery is already in progress by process ${String(existing.pid)}. Retry after it completes.`);
|
|
356
|
+
}
|
|
357
|
+
const rechecked = readLockOwner(path);
|
|
358
|
+
if (rechecked === undefined ||
|
|
359
|
+
rechecked.token !== existing.token ||
|
|
360
|
+
processIsAlive(rechecked.pid)) {
|
|
361
|
+
throw new Error(`${subject} stale-lock recovery ownership changed; retry after the active recovery completes.`);
|
|
362
|
+
}
|
|
363
|
+
(0, node_fs_1.rmSync)(path);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
throw new Error(`Could not acquire stale-lock recovery for ${subject}.`);
|
|
367
|
+
}
|
|
368
|
+
function assertLockOwnership(path, token) {
|
|
369
|
+
const owner = readLockOwner(path);
|
|
370
|
+
if (owner?.token !== token) {
|
|
371
|
+
throw new Error(`Installation apply lock ownership changed unexpectedly at ${path}; refusing to remove another process's lock.`);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
function ownedByCurrentUser(uid) {
|
|
375
|
+
return typeof process.getuid !== 'function' || process.getuid() === uid;
|
|
376
|
+
}
|
|
377
|
+
//# sourceMappingURL=state-store.js.map
|