@astrale-os/sdk 0.6.0-beta.2 → 0.6.0-beta.21
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 +74 -14
- package/dist/application/action/action.d.ts +6 -0
- package/dist/application/action/authoring.d.ts +1 -1
- package/dist/application/action/context.d.ts +17 -8
- package/dist/application/action/define.d.ts +3 -3
- package/dist/application/action/index.d.ts +1 -1
- package/dist/application/define.d.ts +5 -5
- package/dist/application/define.js +13 -13
- package/dist/application/dependency/index.d.ts +1 -1
- package/dist/application/dependency/invoker.d.ts +11 -6
- package/dist/application/domain.d.ts +28 -0
- package/dist/application/index.d.ts +3 -3
- package/dist/application/index.js +1 -1
- package/dist/application/mutation/authoring/properties.d.ts +5 -3
- package/dist/application/mutation/authoring/properties.js +35 -2
- package/dist/application/mutation/authoring/transition.js +4 -1
- package/dist/application/routes/admission.d.ts +2 -2
- package/dist/application/routes/admission.js +1 -1
- package/dist/application/routes/route.d.ts +2 -2
- package/dist/application/runtime/actions.js +3 -0
- package/dist/application/runtime/workflows.d.ts +2 -0
- package/dist/application/runtime/workflows.js +5 -0
- package/dist/application/workflow/authoring.d.ts +3 -2
- package/dist/application/workflow/context.d.ts +8 -2
- package/dist/application/workflow/define.d.ts +3 -3
- package/dist/application/workflow/define.js +19 -3
- package/dist/application/workflow/durable.d.ts +83 -0
- package/dist/application/workflow/index.d.ts +3 -2
- package/dist/application/workflow/runner/inline.js +3 -4
- package/dist/application/workflow/runner/runner.d.ts +2 -2
- package/dist/application/workflow/step/output.d.ts +2 -0
- package/dist/application/workflow/step/output.js +73 -0
- package/dist/application/workflow/workflow.d.ts +12 -0
- package/dist/deployment/adapter/adapter.d.ts +59 -11
- package/dist/deployment/adapter/bundle/bundle.d.ts +36 -0
- package/dist/deployment/adapter/bundle/file.d.ts +10 -0
- package/dist/deployment/adapter/bundle/index.d.ts +2 -0
- package/dist/deployment/adapter/define.d.ts +25 -3
- package/dist/deployment/adapter/define.js +101 -24
- package/dist/deployment/adapter/index.d.ts +6 -3
- package/dist/deployment/adapter/index.js +1 -0
- package/dist/deployment/adapter/legacy/adapter.d.ts +40 -0
- package/dist/deployment/adapter/{deploy → legacy/deploy}/context.d.ts +6 -2
- package/dist/deployment/adapter/legacy/deploy/index.d.ts +2 -0
- package/dist/deployment/adapter/legacy/deploy/index.js +1 -0
- package/dist/deployment/adapter/legacy/deploy/result.d.ts +89 -0
- package/dist/deployment/adapter/legacy/deploy/result.js +1 -0
- package/dist/deployment/adapter/legacy/index.d.ts +24 -0
- package/dist/deployment/adapter/legacy/index.js +1 -0
- package/dist/deployment/adapter/legacy/prepare/artifact.d.ts +43 -0
- package/dist/deployment/adapter/legacy/prepare/artifact.js +1 -0
- package/dist/deployment/adapter/legacy/prepare/context.d.ts +33 -0
- package/dist/deployment/adapter/legacy/prepare/context.js +1 -0
- package/dist/deployment/adapter/legacy/prepare/index.d.ts +2 -0
- package/dist/deployment/adapter/legacy/prepare/index.js +1 -0
- package/dist/deployment/adapter/release/context.d.ts +95 -0
- package/dist/deployment/adapter/release/context.js +1 -0
- package/dist/deployment/adapter/release/index.d.ts +3 -0
- package/dist/deployment/adapter/release/index.js +1 -0
- package/dist/deployment/adapter/release/list.d.ts +53 -0
- package/dist/deployment/adapter/release/list.js +1 -0
- package/dist/deployment/adapter/release/refusal.d.ts +10 -0
- package/dist/deployment/adapter/release/refusal.js +14 -0
- package/dist/deployment/adapter/release/result.d.ts +56 -0
- package/dist/deployment/adapter/release/result.js +1 -0
- package/dist/deployment/address/configuration.d.ts +83 -0
- package/dist/deployment/address/configuration.js +262 -0
- package/dist/deployment/address/fingerprint.d.ts +5 -0
- package/dist/deployment/address/fingerprint.js +27 -0
- package/dist/deployment/address/index.d.ts +5 -0
- package/dist/deployment/address/index.js +5 -0
- package/dist/deployment/address/label.d.ts +42 -0
- package/dist/deployment/address/label.js +80 -0
- package/dist/deployment/address/line.d.ts +29 -0
- package/dist/deployment/address/line.js +53 -0
- package/dist/deployment/address/record.d.ts +52 -0
- package/dist/deployment/address/record.js +104 -0
- package/dist/deployment/address/summary.d.ts +57 -0
- package/dist/deployment/address/summary.js +117 -0
- package/dist/deployment/address/vectors.d.ts +60 -0
- package/dist/deployment/address/vectors.js +517 -0
- package/dist/deployment/build/build.d.ts +2 -2
- package/dist/deployment/build/compile.d.ts +4 -4
- package/dist/deployment/build/compile.js +17 -17
- package/dist/deployment/build/index.d.ts +1 -0
- package/dist/deployment/build/index.js +1 -0
- package/dist/deployment/build/manifest.d.ts +59 -0
- package/dist/deployment/build/manifest.js +118 -0
- package/dist/deployment/build/material.js +2 -2
- package/dist/deployment/build/schema.d.ts +2 -2
- package/dist/deployment/deploy.d.ts +10 -10
- package/dist/deployment/deploy.js +3 -3
- package/dist/deployment/deployment.d.ts +9 -4
- package/dist/deployment/environment.d.ts +6 -0
- package/dist/deployment/environment.js +6 -0
- package/dist/deployment/index.d.ts +4 -4
- package/dist/deployment/index.js +1 -1
- package/dist/deployment/release/addressing.d.ts +9 -1
- package/dist/deployment/release/assemble.d.ts +6 -3
- package/dist/deployment/release/assemble.js +12 -10
- package/dist/deployment/release/index.d.ts +2 -0
- package/dist/deployment/release/index.js +2 -0
- package/dist/deployment/release/legacy/admission.d.ts +3 -0
- package/dist/deployment/release/legacy/admission.js +8 -0
- package/dist/deployment/release/legacy/assemble.d.ts +5 -0
- package/dist/deployment/release/legacy/assemble.js +20 -0
- package/dist/deployment/release/legacy/index.d.ts +35 -0
- package/dist/deployment/release/legacy/index.js +34 -0
- package/dist/deployment/release/legacy/release.d.ts +12 -0
- package/dist/deployment/release/legacy/release.js +1 -0
- package/dist/deployment/release/{publication → legacy}/seal.d.ts +3 -3
- package/dist/deployment/release/legacy/seal.js +17 -0
- package/dist/deployment/release/release.d.ts +16 -5
- package/dist/deployment/release/runtime.d.ts +2 -0
- package/dist/deployment/release/runtime.js +2 -0
- package/dist/deployment/release/seal.d.ts +14 -0
- package/dist/deployment/release/seal.js +22 -0
- package/dist/deployment/release/{publication → served}/callables.d.ts +2 -2
- package/dist/deployment/release/{publication → served}/callables.js +2 -2
- package/dist/deployment/release/served/index.d.ts +12 -0
- package/dist/deployment/release/served/index.js +22 -0
- package/dist/deployment/release/{publication → served}/views.d.ts +2 -2
- package/dist/deployment/runtime/admission.d.ts +2 -2
- package/dist/deployment/runtime/admission.js +5 -5
- package/dist/deployment/verify/index.d.ts +2 -1
- package/dist/deployment/verify/index.js +1 -0
- package/dist/deployment/verify/preflight/artifact.d.ts +1 -1
- package/dist/deployment/verify/preflight/bundle.d.ts +18 -0
- package/dist/deployment/verify/preflight/bundle.js +71 -0
- package/dist/deployment/verify/preflight/index.d.ts +2 -1
- package/dist/deployment/verify/preflight/index.js +1 -0
- package/dist/deployment/verify/preflight/publication.d.ts +2 -2
- package/dist/deployment/verify/preflight/publication.js +4 -3
- package/dist/deployment/verify/readiness/deployment.js +7 -15
- package/dist/deployment/verify/readiness/fetch.d.ts +13 -0
- package/dist/deployment/verify/readiness/fetch.js +26 -0
- package/dist/deployment/verify/readiness/identity.d.ts +3 -6
- package/dist/deployment/verify/readiness/identity.js +3 -3
- package/dist/deployment/verify/readiness/index.d.ts +11 -7
- package/dist/deployment/verify/readiness/index.js +15 -4
- package/dist/deployment/verify/readiness/legacy/index.d.ts +2 -0
- package/dist/deployment/verify/readiness/legacy/index.js +2 -0
- package/dist/deployment/verify/readiness/legacy/publication.d.ts +12 -0
- package/dist/deployment/verify/readiness/legacy/publication.js +23 -0
- package/dist/deployment/verify/readiness/release.d.ts +8 -0
- package/dist/deployment/verify/readiness/release.js +22 -0
- package/dist/execution/identity/authentication.d.ts +23 -2
- package/dist/execution/identity/authentication.js +64 -40
- package/dist/execution/identity/callback.d.ts +16 -15
- package/dist/execution/identity/callback.js +21 -16
- package/dist/execution/identity/delivery.d.ts +11 -4
- package/dist/execution/identity/delivery.js +47 -20
- package/dist/execution/identity/identity.d.ts +18 -3
- package/dist/execution/identity/identity.js +8 -4
- package/dist/execution/identity/jwks.js +57 -12
- package/dist/execution/index.d.ts +4 -2
- package/dist/execution/index.js +2 -1
- package/dist/execution/invocation/admission/authentication.d.ts +3 -8
- package/dist/execution/invocation/admission/authentication.js +10 -24
- package/dist/execution/invocation/admission/authority.d.ts +15 -8
- package/dist/execution/invocation/admission/authority.js +5 -0
- package/dist/execution/invocation/admission/input.d.ts +2 -2
- package/dist/execution/invocation/admission/input.js +16 -2
- package/dist/execution/invocation/dependency/bind.d.ts +1 -1
- package/dist/execution/invocation/dependency/bind.js +35 -14
- package/dist/execution/invocation/dispatch/context.d.ts +2 -1
- package/dist/execution/invocation/dispatch/context.js +1 -1
- package/dist/execution/invocation/invocation.js +58 -16
- package/dist/execution/invocation/result/project.js +41 -1
- package/dist/execution/node/serve.d.ts +2 -2
- package/dist/execution/node/serve.js +1 -1
- package/dist/execution/runtime/index.d.ts +1 -0
- package/dist/execution/runtime/index.js +1 -0
- package/dist/execution/runtime/load.d.ts +3 -3
- package/dist/execution/runtime/load.js +3 -2
- package/dist/execution/runtime/release.d.ts +22 -0
- package/dist/execution/runtime/release.js +14 -0
- package/dist/execution/serve.d.ts +10 -4
- package/dist/execution/serve.js +3 -0
- package/dist/execution/service/create.js +39 -7
- package/dist/execution/service/initialization.d.ts +4 -4
- package/dist/execution/service/initialization.js +23 -14
- package/dist/execution/service/release.d.ts +2 -2
- package/dist/execution/service/release.js +3 -2
- package/dist/execution/service/service.d.ts +15 -5
- package/dist/execution/service/serving/delivery.d.ts +6 -0
- package/dist/execution/service/{publication → serving}/delivery.js +5 -1
- package/dist/execution/service/{publication → serving}/index.d.ts +1 -1
- package/dist/execution/service/serving/installation.d.ts +4 -0
- package/dist/execution/service/serving/installation.js +9 -0
- package/dist/execution/service/serving/legacy/index.d.ts +15 -0
- package/dist/execution/service/serving/legacy/index.js +19 -0
- package/dist/execution/service/serving/source.d.ts +18 -0
- package/dist/execution/service/serving/source.js +19 -0
- package/dist/execution/workflows/discovery.d.ts +14 -0
- package/dist/execution/workflows/discovery.js +151 -0
- package/dist/execution/workflows/engine.d.ts +52 -0
- package/dist/execution/workflows/engine.js +1 -0
- package/dist/execution/workflows/envelope.d.ts +12 -0
- package/dist/execution/workflows/envelope.js +46 -0
- package/dist/execution/workflows/failure.d.ts +11 -0
- package/dist/execution/workflows/failure.js +43 -0
- package/dist/execution/workflows/index.d.ts +4 -0
- package/dist/execution/workflows/index.js +3 -0
- package/dist/execution/workflows/options.d.ts +40 -0
- package/dist/execution/workflows/options.js +83 -0
- package/dist/execution/workflows/receiver.d.ts +22 -0
- package/dist/execution/workflows/receiver.js +99 -0
- package/dist/execution/workflows/route.d.ts +14 -0
- package/dist/execution/workflows/route.js +40 -0
- package/dist/execution/workflows/run.d.ts +22 -0
- package/dist/execution/workflows/run.js +211 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/platform/release/index.d.ts +27 -0
- package/dist/platform/release/index.js +27 -0
- package/dist/platform/schema/index.d.ts +2 -1
- package/dist/platform/schema/property-input.d.ts +15 -0
- package/dist/platform/schema/property-input.js +1 -0
- package/dist/platform/schema/property.d.ts +5 -0
- package/dist/platform/versioning/dependents.d.ts +18 -0
- package/dist/platform/versioning/dependents.js +15 -0
- package/dist/platform/versioning/index.d.ts +5 -0
- package/dist/platform/versioning/index.js +5 -0
- package/dist/platform/versioning/name.d.ts +38 -0
- package/dist/platform/versioning/name.js +58 -0
- package/dist/platform/versioning/reference.d.ts +48 -0
- package/dist/platform/versioning/reference.js +95 -0
- package/dist/platform/versioning/version.d.ts +72 -0
- package/dist/platform/versioning/version.js +98 -0
- package/dist/project/admit.js +2 -2
- package/dist/project/define.d.ts +4 -4
- package/dist/project/define.js +55 -35
- package/dist/project/index.d.ts +1 -1
- package/dist/project/install-command.d.ts +10 -0
- package/dist/project/install-command.js +13 -0
- package/dist/project/project.d.ts +10 -8
- package/dist/testing/dataset/builder.d.ts +3 -3
- package/dist/testing/dataset/define.d.ts +1 -1
- package/dist/testing/load.js +1 -1
- package/dist/tooling/cli/arguments.d.ts +10 -5
- package/dist/tooling/cli/arguments.js +123 -52
- package/dist/tooling/cli/build.d.ts +55 -0
- package/dist/tooling/cli/build.js +77 -0
- package/dist/tooling/cli/bun.d.ts +0 -1
- package/dist/tooling/cli/bun.js +0 -7
- package/dist/tooling/cli/commit.d.ts +35 -0
- package/dist/tooling/cli/commit.js +235 -0
- package/dist/tooling/cli/deploy-mode.d.ts +82 -0
- package/dist/tooling/cli/deploy-mode.js +135 -0
- package/dist/tooling/cli/deploy-result.d.ts +85 -0
- package/dist/tooling/cli/deploy-result.js +64 -0
- package/dist/tooling/cli/diff/declared.d.ts +7 -0
- package/dist/tooling/cli/diff/declared.js +27 -0
- package/dist/tooling/cli/diff/index.d.ts +30 -0
- package/dist/tooling/cli/diff/index.js +58 -0
- package/dist/tooling/cli/diff/render.d.ts +15 -0
- package/dist/tooling/cli/diff/render.js +131 -0
- package/dist/tooling/cli/diff/report.d.ts +88 -0
- package/dist/tooling/cli/diff/report.js +154 -0
- package/dist/tooling/cli/dotenv.d.ts +2 -2
- package/dist/tooling/cli/dotenv.js +3 -33
- package/dist/tooling/cli/help.js +176 -59
- package/dist/tooling/cli/immutable-deployment.d.ts +83 -0
- package/dist/tooling/cli/immutable-deployment.js +135 -0
- package/dist/tooling/cli/index.d.ts +10 -4
- package/dist/tooling/cli/index.js +5 -3
- package/dist/tooling/cli/installed-on.d.ts +83 -0
- package/dist/tooling/cli/installed-on.js +156 -0
- package/dist/tooling/cli/legacy/deploy-result.d.ts +28 -0
- package/dist/tooling/cli/legacy/deploy-result.js +37 -0
- package/dist/tooling/cli/legacy/stable-target-adapter.d.ts +21 -0
- package/dist/tooling/cli/legacy/stable-target-adapter.js +14 -0
- package/dist/tooling/cli/legacy/stable-target-deploy.d.ts +40 -0
- package/dist/tooling/cli/legacy/stable-target-deploy.js +102 -0
- package/dist/tooling/cli/legacy/uploaded-build.d.ts +11 -0
- package/dist/tooling/cli/legacy/uploaded-build.js +22 -0
- package/dist/tooling/cli/list.d.ts +154 -0
- package/dist/tooling/cli/list.js +381 -0
- package/dist/tooling/cli/log.d.ts +5 -0
- package/dist/tooling/cli/log.js +9 -0
- package/dist/tooling/cli/orchestrate.d.ts +0 -6
- package/dist/tooling/cli/orchestrate.js +236 -88
- package/dist/tooling/cli/project.d.ts +3 -3
- package/dist/tooling/cli/publish/index.d.ts +73 -0
- package/dist/tooling/cli/publish/index.js +346 -0
- package/dist/tooling/cli/publish/report.d.ts +49 -0
- package/dist/tooling/cli/publish/report.js +15 -0
- package/dist/tooling/cli/registry/client.d.ts +114 -0
- package/dist/tooling/cli/registry/client.js +346 -0
- package/dist/tooling/cli/registry/error.d.ts +11 -0
- package/dist/tooling/cli/registry/error.js +17 -0
- package/dist/tooling/cli/registry/executable.d.ts +29 -0
- package/dist/tooling/cli/registry/executable.js +90 -0
- package/dist/tooling/cli/registry/index.d.ts +9 -0
- package/dist/tooling/cli/registry/index.js +8 -0
- package/dist/tooling/cli/registry/installations.d.ts +67 -0
- package/dist/tooling/cli/registry/installations.js +108 -0
- package/dist/tooling/cli/registry/process.d.ts +36 -0
- package/dist/tooling/cli/registry/process.js +119 -0
- package/dist/tooling/cli/secrets.d.ts +9 -0
- package/dist/tooling/cli/secrets.js +19 -0
- package/dist/tooling/cli/yank.d.ts +34 -0
- package/dist/tooling/cli/yank.js +32 -0
- package/dist/tooling/linter/implementations/source/callable-requirements.d.ts +1 -1
- package/dist/tooling/linter/implementations/source/callable-requirements.js +10 -10
- package/dist/tooling/linter/implementations/source/dependencies.js +12 -10
- package/dist/tooling/linter/implementations/source/global.js +1 -1
- package/dist/tooling/linter/implementations/source/mutations.js +17 -17
- package/dist/tooling/linter/implementations/source/providers.js +5 -5
- package/dist/tooling/linter/implementations/source/views.js +2 -2
- package/dist/tooling/linter/policy/generated.js +16 -16
- package/dist/tooling/packaging/declarations/ownership.js +1 -1
- package/dist/tooling/packaging/finalize.d.ts +1 -1
- package/dist/tooling/packaging/finalize.js +1 -1
- package/package.json +32 -11
- package/dist/application/application.d.ts +0 -28
- package/dist/deployment/adapter/deploy/index.d.ts +0 -2
- package/dist/deployment/adapter/deploy/result.d.ts +0 -50
- package/dist/deployment/adapter/prepare/artifact.d.ts +0 -33
- package/dist/deployment/adapter/prepare/context.d.ts +0 -23
- package/dist/deployment/adapter/prepare/index.d.ts +0 -2
- package/dist/deployment/release/publication/index.d.ts +0 -6
- package/dist/deployment/release/publication/index.js +0 -6
- package/dist/deployment/release/publication/manifest.d.ts +0 -3
- package/dist/deployment/release/publication/manifest.js +0 -5
- package/dist/deployment/release/publication/requirements.d.ts +0 -3
- package/dist/deployment/release/publication/requirements.js +0 -3
- package/dist/deployment/release/publication/seal.js +0 -39
- package/dist/deployment/verify/readiness/publication.d.ts +0 -11
- package/dist/deployment/verify/readiness/publication.js +0 -41
- package/dist/execution/service/publication/delivery.d.ts +0 -2
- package/dist/execution/service/publication/installation.d.ts +0 -3
- package/dist/execution/service/publication/installation.js +0 -8
- package/dist/execution/service/publication/source.d.ts +0 -3
- package/dist/execution/service/publication/source.js +0 -11
- package/dist/platform/publication/index.d.ts +0 -2
- package/dist/platform/publication/index.js +0 -2
- package/dist/tooling/cli/astrale/authority.d.ts +0 -5
- package/dist/tooling/cli/astrale/authority.js +0 -11
- package/dist/tooling/cli/astrale/executable.d.ts +0 -2
- package/dist/tooling/cli/astrale/executable.js +0 -47
- package/dist/tooling/cli/astrale/failure.d.ts +0 -6
- package/dist/tooling/cli/astrale/failure.js +0 -48
- package/dist/tooling/cli/astrale/instance.d.ts +0 -11
- package/dist/tooling/cli/astrale/instance.js +0 -52
- package/dist/tooling/cli/astrale/process.d.ts +0 -13
- package/dist/tooling/cli/astrale/process.js +0 -94
- package/dist/tooling/cli/astrale/version.d.ts +0 -18
- package/dist/tooling/cli/astrale/version.js +0 -55
- package/dist/tooling/cli/credential.d.ts +0 -2
- package/dist/tooling/cli/credential.js +0 -57
- package/dist/tooling/cli/development/candidate.d.ts +0 -25
- package/dist/tooling/cli/development/candidate.js +0 -176
- package/dist/tooling/cli/development/deployment.d.ts +0 -16
- package/dist/tooling/cli/development/deployment.js +0 -39
- package/dist/tooling/cli/development/develop.d.ts +0 -11
- package/dist/tooling/cli/development/develop.js +0 -243
- package/dist/tooling/cli/development/lease.d.ts +0 -18
- package/dist/tooling/cli/development/lease.js +0 -163
- package/dist/tooling/cli/development/lifecycle.d.ts +0 -9
- package/dist/tooling/cli/development/lifecycle.js +0 -43
- package/dist/tooling/cli/development/project-imports.d.ts +0 -22
- package/dist/tooling/cli/development/project-imports.js +0 -39
- package/dist/tooling/cli/development/project-lock.d.ts +0 -16
- package/dist/tooling/cli/development/project-lock.js +0 -41
- package/dist/tooling/cli/development/rebuild.d.ts +0 -13
- package/dist/tooling/cli/development/rebuild.js +0 -58
- package/dist/tooling/cli/development/release-evidence.d.ts +0 -4
- package/dist/tooling/cli/development/release-evidence.js +0 -10
- package/dist/tooling/cli/development/report.d.ts +0 -6
- package/dist/tooling/cli/development/report.js +0 -14
- package/dist/tooling/cli/development/session-file.d.ts +0 -53
- package/dist/tooling/cli/development/session-file.js +0 -337
- package/dist/tooling/cli/development/source-watch.d.ts +0 -14
- package/dist/tooling/cli/development/source-watch.js +0 -140
- package/dist/tooling/cli/development/sources.d.ts +0 -7
- package/dist/tooling/cli/development/sources.js +0 -48
- package/dist/tooling/cli/development/target-lock.d.ts +0 -16
- package/dist/tooling/cli/development/target-lock.js +0 -68
- package/dist/tooling/cli/development/view.d.ts +0 -28
- package/dist/tooling/cli/development/view.js +0 -151
- package/dist/tooling/cli/environment-release.d.ts +0 -21
- package/dist/tooling/cli/environment-release.js +0 -46
- package/dist/tooling/cli/evidence.d.ts +0 -11
- package/dist/tooling/cli/evidence.js +0 -53
- package/dist/tooling/cli/installation/index.d.ts +0 -2
- package/dist/tooling/cli/installation/index.js +0 -1
- package/dist/tooling/cli/installation/observation.d.ts +0 -10
- package/dist/tooling/cli/installation/observation.js +0 -44
- package/dist/tooling/cli/installation/reconcile.d.ts +0 -32
- package/dist/tooling/cli/installation/reconcile.js +0 -122
- /package/dist/application/{application.js → domain.js} +0 -0
- /package/dist/{deployment/adapter/deploy/context.js → application/workflow/durable.js} +0 -0
- /package/dist/deployment/adapter/{deploy/index.js → bundle/bundle.js} +0 -0
- /package/dist/deployment/adapter/{deploy/result.js → bundle/file.js} +0 -0
- /package/dist/deployment/adapter/{prepare → bundle}/index.js +0 -0
- /package/dist/deployment/adapter/{prepare/artifact.js → legacy/adapter.js} +0 -0
- /package/dist/deployment/adapter/{prepare → legacy/deploy}/context.js +0 -0
- /package/dist/deployment/release/{publication → served}/routes.d.ts +0 -0
- /package/dist/deployment/release/{publication → served}/routes.js +0 -0
- /package/dist/deployment/release/{publication → served}/views.js +0 -0
- /package/dist/execution/service/{publication → serving}/index.js +0 -0
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
import * as artifact from '@astrale-os/kernel-protocol/artifact';
|
|
2
|
+
import { BUNDLE_MEDIA_TYPE } from '@astrale-os/kernel-protocol/release/bundle';
|
|
3
|
+
import { mkdtemp, readFile, rm } from 'node:fs/promises';
|
|
4
|
+
import { tmpdir } from 'node:os';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import { RegistryCliError } from './error.js';
|
|
7
|
+
import { resolveRegistryExecutable } from './executable.js';
|
|
8
|
+
import { decodeInstanceListing, instanceRefusal, instanceTimeout, instanceUnreadable, } from './installations.js';
|
|
9
|
+
import { RegistryProcessTimeoutError, runRegistryProcess } from './process.js';
|
|
10
|
+
export { RegistryCliError } from './error.js';
|
|
11
|
+
const INDEX_LIMIT = 8 * 1024 * 1024;
|
|
12
|
+
const DOCUMENT_LIMIT = 256 * 1024;
|
|
13
|
+
/** The tail of an instance listing's stderr that is kept: its machine error is printed last. */
|
|
14
|
+
const MACHINE_ERROR_LIMIT = 16 * 1024;
|
|
15
|
+
/** Admin bounds a stored bundle to 16 MiB; the download writes it to a file, not to stdout. */
|
|
16
|
+
const BUNDLE_TIMEOUT_MS = 120_000;
|
|
17
|
+
const INDEX_TIMEOUT_MS = 60_000;
|
|
18
|
+
/** One change is a token exchange and one Admin call, each bounded by the CLI itself. */
|
|
19
|
+
const CHANGE_TIMEOUT_MS = 120_000;
|
|
20
|
+
/** Admin re-reads the release at the deployment and verifies it before it commits. */
|
|
21
|
+
const PUBLISH_TIMEOUT_MS = 180_000;
|
|
22
|
+
/** CT29 bounds the publish request the CLI reads on stdin to 64 KiB. */
|
|
23
|
+
const REQUEST_LIMIT = 64 * 1024;
|
|
24
|
+
/** One instance Kernel, then the registry and the deployment records it names (CT24). */
|
|
25
|
+
const INSTANCE_TIMEOUT_MS = 60_000;
|
|
26
|
+
/**
|
|
27
|
+
* Open the Domain registry through one admitted Astrale CLI (CT29 plumbing); the CLI's configured
|
|
28
|
+
* Admin target answers. Reads and publish run under `--as` when the caller names an identity, a
|
|
29
|
+
* yank under the CLI's default identity.
|
|
30
|
+
*/
|
|
31
|
+
export async function openDomainRegistry(input, dependencies = {
|
|
32
|
+
resolve: resolveRegistryExecutable,
|
|
33
|
+
run: runRegistryProcess,
|
|
34
|
+
}) {
|
|
35
|
+
const executable = await dependencies.resolve({
|
|
36
|
+
projectDir: input.projectDir,
|
|
37
|
+
signal: input.signal,
|
|
38
|
+
...(input.minimum === undefined ? {} : { minimum: input.minimum }),
|
|
39
|
+
});
|
|
40
|
+
const authority = input.identity === undefined ? [] : ['--as', input.identity];
|
|
41
|
+
// A read or a publish runs in machine mode without prompts: a document or a refusal on stdout,
|
|
42
|
+
// never an interactive sign-in.
|
|
43
|
+
const machine = (args) => Object.freeze({
|
|
44
|
+
command: args.slice(0, 2).join(' '),
|
|
45
|
+
args: ['--ci', '--no-prompt', ...args, '--json', ...authority],
|
|
46
|
+
});
|
|
47
|
+
const command = async (invocation, limits) => {
|
|
48
|
+
let result;
|
|
49
|
+
try {
|
|
50
|
+
result = await dependencies.run({
|
|
51
|
+
executable: invocation.executable,
|
|
52
|
+
args: invocation.args,
|
|
53
|
+
projectDir: input.projectDir,
|
|
54
|
+
signal: input.signal,
|
|
55
|
+
timeoutMs: limits.timeoutMs,
|
|
56
|
+
stdoutLimit: limits.stdout,
|
|
57
|
+
...(invocation.stdin === undefined ? {} : { stdin: invocation.stdin }),
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
catch (cause) {
|
|
61
|
+
// An interruption is the caller's own stop, never a registry answer.
|
|
62
|
+
if (input.signal.aborted)
|
|
63
|
+
throw cause;
|
|
64
|
+
throw unfinished(invocation, limits.change, cause);
|
|
65
|
+
}
|
|
66
|
+
const document = parseDocument(result.stdout);
|
|
67
|
+
if (result.code === 0 && document !== undefined)
|
|
68
|
+
return document;
|
|
69
|
+
throw refusal(invocation, result.code, document);
|
|
70
|
+
};
|
|
71
|
+
return Object.freeze({
|
|
72
|
+
async index(origin) {
|
|
73
|
+
try {
|
|
74
|
+
return decodeIndex(await command({ executable, ...machine(['domain', 'versions', origin]) }, { stdout: INDEX_LIMIT, timeoutMs: INDEX_TIMEOUT_MS, change: false }), origin);
|
|
75
|
+
}
|
|
76
|
+
catch (cause) {
|
|
77
|
+
if (cause instanceof RegistryCliError && cause.code === 'REGISTRY_DOMAIN_NOT_FOUND') {
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
throw cause;
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
async bundle(origin, publication) {
|
|
84
|
+
const directory = await mkdtemp(join(tmpdir(), 'astrale-registry-'));
|
|
85
|
+
try {
|
|
86
|
+
const output = join(directory, 'bundle.json');
|
|
87
|
+
const reference = `${origin}@${publication.version}`;
|
|
88
|
+
const downloaded = decodeBundleDocument(await command({
|
|
89
|
+
executable,
|
|
90
|
+
...machine(['__domain-registry', 'bundle', reference, '--output', output]),
|
|
91
|
+
// The private download directory is gone after the run, and the CLI refuses an
|
|
92
|
+
// output it cannot write before any read: a rerun by hand names its own file.
|
|
93
|
+
rerun: machine(['__domain-registry', 'bundle', reference, '--output', 'bundle.json'])
|
|
94
|
+
.args,
|
|
95
|
+
}, { stdout: DOCUMENT_LIMIT, timeoutMs: BUNDLE_TIMEOUT_MS, change: false }), origin, publication);
|
|
96
|
+
const bytes = new Uint8Array(await readFile(output));
|
|
97
|
+
const identified = artifact.identify(bytes, BUNDLE_MEDIA_TYPE);
|
|
98
|
+
if (identified.digest !== downloaded.digest ||
|
|
99
|
+
identified.size !== downloaded.size ||
|
|
100
|
+
identified.mediaType !== downloaded.mediaType) {
|
|
101
|
+
throw protocolError(`The bundle of ${origin}@${publication.version} does not match its digest.`);
|
|
102
|
+
}
|
|
103
|
+
return bytes;
|
|
104
|
+
}
|
|
105
|
+
finally {
|
|
106
|
+
await rm(directory, { recursive: true, force: true });
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
async publish(request) {
|
|
110
|
+
const stdin = JSON.stringify({
|
|
111
|
+
format: 'astrale.registry-publish-request',
|
|
112
|
+
version: 1,
|
|
113
|
+
publication: {
|
|
114
|
+
origin: request.origin,
|
|
115
|
+
version: request.version,
|
|
116
|
+
url: request.url,
|
|
117
|
+
releaseDigest: request.releaseDigest,
|
|
118
|
+
...(request.commit === undefined ? {} : { commit: request.commit }),
|
|
119
|
+
dirty: request.dirty,
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
if (Buffer.byteLength(stdin) > REQUEST_LIMIT) {
|
|
123
|
+
throw new TypeError(`The publish request of ${request.origin}@${request.version} is too large.`);
|
|
124
|
+
}
|
|
125
|
+
const invocation = { executable, ...machine(['__domain-registry', 'publish']), stdin };
|
|
126
|
+
return decodePublishResult(await command(invocation, {
|
|
127
|
+
stdout: DOCUMENT_LIMIT,
|
|
128
|
+
timeoutMs: PUBLISH_TIMEOUT_MS,
|
|
129
|
+
change: true,
|
|
130
|
+
}), request);
|
|
131
|
+
},
|
|
132
|
+
async yank(origin, version, options) {
|
|
133
|
+
const reference = `${origin}@${version}`;
|
|
134
|
+
return decodeYank(await command({
|
|
135
|
+
executable,
|
|
136
|
+
command: '__domain-registry yank',
|
|
137
|
+
args: [
|
|
138
|
+
'__domain-registry',
|
|
139
|
+
'yank',
|
|
140
|
+
reference,
|
|
141
|
+
...(options.undo ? ['--undo'] : []),
|
|
142
|
+
'--json',
|
|
143
|
+
],
|
|
144
|
+
}, { stdout: DOCUMENT_LIMIT, timeoutMs: CHANGE_TIMEOUT_MS, change: true }), { reference, version, undo: options.undo });
|
|
145
|
+
},
|
|
146
|
+
async instance(name) {
|
|
147
|
+
let result;
|
|
148
|
+
try {
|
|
149
|
+
result = await dependencies.run({
|
|
150
|
+
executable,
|
|
151
|
+
// `domain list -i` prints its refusal as a machine error on stderr, not as a document on
|
|
152
|
+
// stdout: only that error's code is read, never relayed.
|
|
153
|
+
args: ['--ci', '--no-prompt', 'domain', 'list', '-i', name, '--json', ...authority],
|
|
154
|
+
projectDir: input.projectDir,
|
|
155
|
+
signal: input.signal,
|
|
156
|
+
timeoutMs: INSTANCE_TIMEOUT_MS,
|
|
157
|
+
stdoutLimit: INDEX_LIMIT,
|
|
158
|
+
stderrLimit: MACHINE_ERROR_LIMIT,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
catch (cause) {
|
|
162
|
+
if (cause instanceof RegistryProcessTimeoutError)
|
|
163
|
+
return instanceTimeout();
|
|
164
|
+
throw cause;
|
|
165
|
+
}
|
|
166
|
+
if (result.code !== 0)
|
|
167
|
+
return instanceRefusal(result.stderr ?? '');
|
|
168
|
+
const document = parseDocument(result.stdout);
|
|
169
|
+
if (document === undefined)
|
|
170
|
+
return instanceUnreadable();
|
|
171
|
+
try {
|
|
172
|
+
return decodeInstanceListing(document);
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
return instanceUnreadable();
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
function parseDocument(stdout) {
|
|
181
|
+
try {
|
|
182
|
+
const value = JSON.parse(stdout);
|
|
183
|
+
return isRecord(value) ? value : undefined;
|
|
184
|
+
}
|
|
185
|
+
catch {
|
|
186
|
+
return undefined;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
function refusal(invocation, code, document) {
|
|
190
|
+
const error = document === undefined ? undefined : document.error;
|
|
191
|
+
if (isRecord(error) && typeof error.code === 'string' && typeof error.message === 'string') {
|
|
192
|
+
const details = isRecord(error.details) ? error.details : undefined;
|
|
193
|
+
return new RegistryCliError(admittedCode(error.code), printable(error.message), details);
|
|
194
|
+
}
|
|
195
|
+
return new RegistryCliError('REGISTRY_CLI_FAILED', `${code === 0
|
|
196
|
+
? `Astrale CLI ${invocation.command} answered no registry document.`
|
|
197
|
+
: `Astrale CLI ${invocation.command} failed (exit ${code}) without a registry document.`} ${diagnosticHint(invocation)}`);
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* The command was stopped or could not run (start failure, time or output bound). A change may
|
|
201
|
+
* still have reached Admin; CT29 changes are idempotent, so the same command is safe to rerun.
|
|
202
|
+
*/
|
|
203
|
+
function unfinished(invocation, change, cause) {
|
|
204
|
+
const reason = cause instanceof Error ? cause.message : 'Astrale CLI command failed.';
|
|
205
|
+
const delivery = change ? ' The change may have applied; rerunning the same command is safe.' : '';
|
|
206
|
+
const error = new RegistryCliError('REGISTRY_CLI_FAILED', `${reason}${delivery} ${diagnosticHint(invocation)}`);
|
|
207
|
+
error.cause = cause;
|
|
208
|
+
return error;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* The CLI's stderr is never relayed (it may name the caller's credential), so a failure names the
|
|
212
|
+
* exact command a person runs by hand to read the CLI's own diagnostic.
|
|
213
|
+
*/
|
|
214
|
+
function diagnosticHint(invocation) {
|
|
215
|
+
return `To read the Astrale CLI's own diagnostic, run: ${commandLine(invocation)}`;
|
|
216
|
+
}
|
|
217
|
+
/** One invocation as a person runs it by hand in a POSIX shell. */
|
|
218
|
+
function commandLine(invocation) {
|
|
219
|
+
const words = [invocation.executable, ...(invocation.rerun ?? invocation.args)].map(shellWord);
|
|
220
|
+
// A command that reads a document on stdin is rerun with that same document.
|
|
221
|
+
const input = invocation.stdin === undefined ? '' : `printf '%s' ${shellWord(invocation.stdin)} | `;
|
|
222
|
+
return `${input}${words.join(' ')}`;
|
|
223
|
+
}
|
|
224
|
+
function shellWord(word) {
|
|
225
|
+
return /^[\w@%+=:,./-]+$/u.test(word) ? word : `'${word.replaceAll("'", `'\\''`)}'`;
|
|
226
|
+
}
|
|
227
|
+
function decodeIndex(document, origin) {
|
|
228
|
+
if (document.format !== 'astrale.registry-index' ||
|
|
229
|
+
document.version !== 1 ||
|
|
230
|
+
document.origin !== origin ||
|
|
231
|
+
!Array.isArray(document.publications)) {
|
|
232
|
+
throw protocolError(`Astrale CLI answered no registry index of ${origin}.`);
|
|
233
|
+
}
|
|
234
|
+
return Object.freeze({
|
|
235
|
+
origin,
|
|
236
|
+
publications: Object.freeze(document.publications.map((entry) => publication(entry, origin))),
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
function publication(input, origin) {
|
|
240
|
+
if (!isRecord(input) ||
|
|
241
|
+
typeof input.version !== 'string' ||
|
|
242
|
+
typeof input.yanked !== 'boolean' ||
|
|
243
|
+
!isDigest(input.releaseDigest) ||
|
|
244
|
+
!isDigest(input.buildDigest) ||
|
|
245
|
+
!isDigest(input.schemaRevision)) {
|
|
246
|
+
throw protocolError(`Astrale CLI answered a malformed Publication of ${origin}.`);
|
|
247
|
+
}
|
|
248
|
+
return Object.freeze({
|
|
249
|
+
version: input.version,
|
|
250
|
+
yanked: input.yanked,
|
|
251
|
+
releaseDigest: input.releaseDigest,
|
|
252
|
+
buildDigest: input.buildDigest,
|
|
253
|
+
schemaRevision: input.schemaRevision,
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Admit the CT29 `PublishResultV1` only as the answer to this request: the same version, URL and
|
|
258
|
+
* release digest, so a CLI that answered for another Publication is never reported as published.
|
|
259
|
+
* Any other key is ignored, such as the `retention` mark an Admin before admin#455 still answers:
|
|
260
|
+
* Admin keeps no Services mark any more, since Services keeps every deployment until it is retired.
|
|
261
|
+
*/
|
|
262
|
+
function decodePublishResult(document, request) {
|
|
263
|
+
const named = document.publication;
|
|
264
|
+
if (document.format !== 'astrale.registry-publish-result' ||
|
|
265
|
+
document.version !== 1 ||
|
|
266
|
+
(document.status !== 'created' && document.status !== 'unchanged') ||
|
|
267
|
+
!isRecord(named) ||
|
|
268
|
+
typeof named.url !== 'string') {
|
|
269
|
+
throw protocolError(`Astrale CLI answered no publish result of ${request.origin}@${request.version}.`);
|
|
270
|
+
}
|
|
271
|
+
const published = publication(named, request.origin);
|
|
272
|
+
if (published.version !== request.version ||
|
|
273
|
+
published.releaseDigest !== request.releaseDigest ||
|
|
274
|
+
named.url !== request.url) {
|
|
275
|
+
throw protocolError(`Astrale CLI answered another Publication than ${request.origin}@${request.version} at ${request.url}.`);
|
|
276
|
+
}
|
|
277
|
+
return Object.freeze({
|
|
278
|
+
status: document.status,
|
|
279
|
+
publication: Object.freeze({ ...published, url: named.url }),
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
function decodeBundleDocument(document, origin, expected) {
|
|
283
|
+
const named = document.publication;
|
|
284
|
+
if (document.format !== 'astrale.registry-bundle' ||
|
|
285
|
+
document.version !== 1 ||
|
|
286
|
+
!isRecord(named) ||
|
|
287
|
+
named.origin !== origin ||
|
|
288
|
+
named.version !== expected.version) {
|
|
289
|
+
throw protocolError(`Astrale CLI answered no bundle of ${origin}@${expected.version}.`);
|
|
290
|
+
}
|
|
291
|
+
return bundle(document.bundle, origin, expected.version);
|
|
292
|
+
}
|
|
293
|
+
function bundle(input, origin, version) {
|
|
294
|
+
if (!isRecord(input) ||
|
|
295
|
+
!isDigest(input.digest) ||
|
|
296
|
+
typeof input.mediaType !== 'string' ||
|
|
297
|
+
!Number.isSafeInteger(input.size) ||
|
|
298
|
+
input.size < 0) {
|
|
299
|
+
throw protocolError(`Astrale CLI answered a malformed bundle of ${origin}@${version}.`);
|
|
300
|
+
}
|
|
301
|
+
return Object.freeze({
|
|
302
|
+
digest: input.digest,
|
|
303
|
+
mediaType: input.mediaType,
|
|
304
|
+
size: input.size,
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* The answered version must be the one named, and its state the one requested: a yank answers
|
|
309
|
+
* `yanked: true` and `--undo` answers `yanked: false`, whether it `changed` or was `unchanged`.
|
|
310
|
+
*/
|
|
311
|
+
function decodeYank(document, expected) {
|
|
312
|
+
const { status, publication } = document;
|
|
313
|
+
if (document.format !== 'astrale.registry-yank-result' ||
|
|
314
|
+
document.version !== 1 ||
|
|
315
|
+
(status !== 'changed' && status !== 'unchanged') ||
|
|
316
|
+
!isRecord(publication) ||
|
|
317
|
+
publication.version !== expected.version ||
|
|
318
|
+
typeof publication.yanked !== 'boolean') {
|
|
319
|
+
throw protocolError(`Astrale CLI answered no yank result of ${expected.reference}.`);
|
|
320
|
+
}
|
|
321
|
+
if (publication.yanked === expected.undo) {
|
|
322
|
+
throw protocolError(`Astrale CLI answered ${expected.reference} ${publication.yanked ? 'still yanked' : 'not yanked'} after ${expected.undo ? 'yank --undo' : 'yank'}.`);
|
|
323
|
+
}
|
|
324
|
+
return Object.freeze({
|
|
325
|
+
status,
|
|
326
|
+
publication: Object.freeze({ version: expected.version, yanked: publication.yanked }),
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
function protocolError(message) {
|
|
330
|
+
return new RegistryCliError('REGISTRY_CLI_PROTOCOL', message);
|
|
331
|
+
}
|
|
332
|
+
function isDigest(input) {
|
|
333
|
+
return typeof input === 'string' && /^sha256:[0-9a-f]{64}$/u.test(input);
|
|
334
|
+
}
|
|
335
|
+
function admittedCode(input) {
|
|
336
|
+
return /^[A-Z][A-Z0-9_]{0,63}$/u.test(input) ? input : 'REGISTRY_CLI_FAILED';
|
|
337
|
+
}
|
|
338
|
+
/** A CLI message enters a terminal and a CI log: control characters are dropped, length bounded. */
|
|
339
|
+
function printable(input) {
|
|
340
|
+
// oxlint-disable-next-line no-control-regex
|
|
341
|
+
const text = input.replace(/[\u0000-\u001f\u007f-\u009f]+/gu, ' ').trim();
|
|
342
|
+
return text.length > 500 ? `${text.slice(0, 499)}…` : text;
|
|
343
|
+
}
|
|
344
|
+
function isRecord(input) {
|
|
345
|
+
return typeof input === 'object' && input !== null && !Array.isArray(input);
|
|
346
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One refusal the Astrale CLI printed as its CT29 `{ error: { code, message, details? } }`, or a
|
|
3
|
+
* registry command this SDK cannot read: `REGISTRY_CLI_FAILED` when the command printed no
|
|
4
|
+
* registry document or did not finish, `REGISTRY_CLI_PROTOCOL` when its document is not the
|
|
5
|
+
* requested answer.
|
|
6
|
+
*/
|
|
7
|
+
export declare class RegistryCliError extends Error {
|
|
8
|
+
readonly code: string;
|
|
9
|
+
readonly details?: Readonly<Record<string, unknown>>;
|
|
10
|
+
constructor(code: string, message: string, details?: Readonly<Record<string, unknown>>);
|
|
11
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One refusal the Astrale CLI printed as its CT29 `{ error: { code, message, details? } }`, or a
|
|
3
|
+
* registry command this SDK cannot read: `REGISTRY_CLI_FAILED` when the command printed no
|
|
4
|
+
* registry document or did not finish, `REGISTRY_CLI_PROTOCOL` when its document is not the
|
|
5
|
+
* requested answer.
|
|
6
|
+
*/
|
|
7
|
+
export class RegistryCliError extends Error {
|
|
8
|
+
code;
|
|
9
|
+
details;
|
|
10
|
+
constructor(code, message, details) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = 'RegistryCliError';
|
|
13
|
+
this.code = code;
|
|
14
|
+
if (details !== undefined)
|
|
15
|
+
this.details = details;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { RegistryProcessInput, RegistryProcessResult } from './process.js';
|
|
2
|
+
/**
|
|
3
|
+
* The first Astrale CLI release that serves the registry plumbing these commands read (CT29):
|
|
4
|
+
* `astrale domain versions --json` and the hidden `astrale __domain-registry` commands.
|
|
5
|
+
* 1.0.0-beta.127 and older were released without them.
|
|
6
|
+
*/
|
|
7
|
+
export declare const MINIMUM_REGISTRY_CLI_VERSION = "1.0.0-beta.128";
|
|
8
|
+
/**
|
|
9
|
+
* The first Astrale CLI release that serves what `astrale-domain list` reads beside the registry
|
|
10
|
+
* index: the instance listing (`astrale domain list -i <instance> --json`, CT24). It shipped after
|
|
11
|
+
* the registry plumbing, so this floor is named on its own and is never below the registry's;
|
|
12
|
+
* 1.0.0-beta.128 and older were released without it.
|
|
13
|
+
*/
|
|
14
|
+
export declare const MINIMUM_INSTALLATIONS_CLI_VERSION = "1.0.0-beta.129";
|
|
15
|
+
export interface RegistryExecutableDependencies {
|
|
16
|
+
readonly candidates: () => Promise<readonly string[]>;
|
|
17
|
+
readonly run: (input: RegistryProcessInput) => Promise<RegistryProcessResult>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Resolve one Astrale CLI for a whole command, the official installation before PATH, and admit
|
|
21
|
+
* it only when it serves the registry plumbing, so an older CLI is refused by name instead of
|
|
22
|
+
* answering an unknown command.
|
|
23
|
+
*/
|
|
24
|
+
export declare function resolveRegistryExecutable(input: {
|
|
25
|
+
readonly projectDir: string;
|
|
26
|
+
readonly signal: AbortSignal;
|
|
27
|
+
/** The first CLI release serving what the command reads, never below the registry floor. */
|
|
28
|
+
readonly minimum?: string;
|
|
29
|
+
}, dependencies?: RegistryExecutableDependencies): Promise<string>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { constants } from 'node:fs';
|
|
2
|
+
import { access, readFile, realpath } from 'node:fs/promises';
|
|
3
|
+
import { homedir } from 'node:os';
|
|
4
|
+
import { delimiter, isAbsolute, join } from 'node:path';
|
|
5
|
+
import semver from 'semver';
|
|
6
|
+
import { runRegistryProcess } from './process.js';
|
|
7
|
+
/**
|
|
8
|
+
* The first Astrale CLI release that serves the registry plumbing these commands read (CT29):
|
|
9
|
+
* `astrale domain versions --json` and the hidden `astrale __domain-registry` commands.
|
|
10
|
+
* 1.0.0-beta.127 and older were released without them.
|
|
11
|
+
*/
|
|
12
|
+
export const MINIMUM_REGISTRY_CLI_VERSION = '1.0.0-beta.128';
|
|
13
|
+
/**
|
|
14
|
+
* The first Astrale CLI release that serves what `astrale-domain list` reads beside the registry
|
|
15
|
+
* index: the instance listing (`astrale domain list -i <instance> --json`, CT24). It shipped after
|
|
16
|
+
* the registry plumbing, so this floor is named on its own and is never below the registry's;
|
|
17
|
+
* 1.0.0-beta.128 and older were released without it.
|
|
18
|
+
*/
|
|
19
|
+
export const MINIMUM_INSTALLATIONS_CLI_VERSION = '1.0.0-beta.129';
|
|
20
|
+
/**
|
|
21
|
+
* Resolve one Astrale CLI for a whole command, the official installation before PATH, and admit
|
|
22
|
+
* it only when it serves the registry plumbing, so an older CLI is refused by name instead of
|
|
23
|
+
* answering an unknown command.
|
|
24
|
+
*/
|
|
25
|
+
export async function resolveRegistryExecutable(input, dependencies = {
|
|
26
|
+
candidates: executableCandidates,
|
|
27
|
+
run: runRegistryProcess,
|
|
28
|
+
}) {
|
|
29
|
+
const executable = await firstExecutable(await dependencies.candidates());
|
|
30
|
+
const result = await dependencies.run({
|
|
31
|
+
executable,
|
|
32
|
+
args: ['--version'],
|
|
33
|
+
projectDir: input.projectDir,
|
|
34
|
+
signal: input.signal,
|
|
35
|
+
timeoutMs: 10_000,
|
|
36
|
+
stdoutLimit: 4 * 1024,
|
|
37
|
+
});
|
|
38
|
+
const version = result.stdout.trim().replace(/^v/u, '');
|
|
39
|
+
// Never below the registry plumbing every caller of this executable reads.
|
|
40
|
+
const minimum = input.minimum === undefined || semver.lt(input.minimum, MINIMUM_REGISTRY_CLI_VERSION)
|
|
41
|
+
? MINIMUM_REGISTRY_CLI_VERSION
|
|
42
|
+
: input.minimum;
|
|
43
|
+
if (result.code !== 0 || semver.valid(version) === null) {
|
|
44
|
+
throw new TypeError(`Astrale CLI did not report its version; ${minimum} or newer is required to read the Domain registry.`);
|
|
45
|
+
}
|
|
46
|
+
if (semver.lt(version, minimum)) {
|
|
47
|
+
throw new TypeError(`Astrale CLI ${version} cannot read the Domain registry; ${minimum} or newer is required (astrale update).`);
|
|
48
|
+
}
|
|
49
|
+
return executable;
|
|
50
|
+
}
|
|
51
|
+
async function firstExecutable(candidates) {
|
|
52
|
+
for (const candidate of candidates) {
|
|
53
|
+
try {
|
|
54
|
+
await access(candidate, constants.X_OK);
|
|
55
|
+
return await realpath(candidate);
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
// Continue through the recorded installation and PATH candidates.
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
throw new TypeError('Astrale CLI is unavailable. Install it with the official Astrale installer.');
|
|
62
|
+
}
|
|
63
|
+
/** The installer's recorded binary (`$ASTRALE_HOME/install.json`), then every `astrale` on PATH. */
|
|
64
|
+
async function executableCandidates() {
|
|
65
|
+
const path = (process.env.PATH ?? '')
|
|
66
|
+
.split(delimiter)
|
|
67
|
+
.filter(Boolean)
|
|
68
|
+
.map((directory) => join(directory, 'astrale'));
|
|
69
|
+
const installed = await recordedInstallation();
|
|
70
|
+
return installed === undefined ? path : [installed, ...path];
|
|
71
|
+
}
|
|
72
|
+
async function recordedInstallation() {
|
|
73
|
+
const home = process.env.ASTRALE_HOME ?? join(homedir(), '.astrale');
|
|
74
|
+
try {
|
|
75
|
+
const decoded = JSON.parse(await readFile(join(home, 'install.json'), 'utf8'));
|
|
76
|
+
if (typeof decoded !== 'object' ||
|
|
77
|
+
decoded === null ||
|
|
78
|
+
!('method' in decoded) ||
|
|
79
|
+
decoded.method !== 'script' ||
|
|
80
|
+
!('bin' in decoded) ||
|
|
81
|
+
typeof decoded.bin !== 'string' ||
|
|
82
|
+
!isAbsolute(decoded.bin)) {
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
return decoded.bin;
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Admin Domain registry as Project commands read and change it: through the Astrale CLI's
|
|
3
|
+
* registry plumbing (CT29), with the caller's own credential and the CLI's configured Admin target.
|
|
4
|
+
*/
|
|
5
|
+
export { RegistryCliError, openDomainRegistry, type DomainRegistry, type DomainRegistryDependencies, type RegistryBundle, type RegistryDigest, type RegistryIndex, type RegistryPublication, type RegistryPublishRequest, type RegistryPublishResult, type RegistryYank, } from './client.js';
|
|
6
|
+
export { MINIMUM_INSTALLATIONS_CLI_VERSION, MINIMUM_REGISTRY_CLI_VERSION, resolveRegistryExecutable, } from './executable.js';
|
|
7
|
+
export { isAdminFailure } from './installations.js';
|
|
8
|
+
export type { InstallationUnknownReason, InstanceInstallation, InstanceListing, } from './installations.js';
|
|
9
|
+
export { RegistryProcessTimeoutError } from './process.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Admin Domain registry as Project commands read and change it: through the Astrale CLI's
|
|
3
|
+
* registry plumbing (CT29), with the caller's own credential and the CLI's configured Admin target.
|
|
4
|
+
*/
|
|
5
|
+
export { RegistryCliError, openDomainRegistry, } from './client.js';
|
|
6
|
+
export { MINIMUM_INSTALLATIONS_CLI_VERSION, MINIMUM_REGISTRY_CLI_VERSION, resolveRegistryExecutable, } from './executable.js';
|
|
7
|
+
export { isAdminFailure } from './installations.js';
|
|
8
|
+
export { RegistryProcessTimeoutError } from './process.js';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why the installations of one instance are unknown, as its listing's refusal says (CT24, AM-225):
|
|
3
|
+
* an unknown instance is a partial answer, never "not installed" (AM-198).
|
|
4
|
+
* - `timeout`: it did not answer in time;
|
|
5
|
+
* - `refused`: its Kernel refused the read;
|
|
6
|
+
* - `unavailable`: it could not be reached, or answered nothing readable;
|
|
7
|
+
* - `unsupported`: its Kernel does not list installed releases (before K14, such as the 1Pact Host
|
|
8
|
+
* on beta.117).
|
|
9
|
+
*/
|
|
10
|
+
export type InstallationUnknownReason = 'timeout' | 'refused' | 'unavailable' | 'unsupported';
|
|
11
|
+
/** One installation the instance Kernel lists, as `astrale domain list -i --json` prints it. */
|
|
12
|
+
export interface InstanceInstallation {
|
|
13
|
+
readonly origin: string;
|
|
14
|
+
/** The deployment URL the Kernel lists the pin under. */
|
|
15
|
+
readonly url: string;
|
|
16
|
+
}
|
|
17
|
+
/** What one instance answered to `astrale domain list -i <instance> --json` (CT24). */
|
|
18
|
+
export type InstanceListing = {
|
|
19
|
+
readonly kind: 'listed';
|
|
20
|
+
/** The instance Kernel URL that answered. */
|
|
21
|
+
readonly kernel: string;
|
|
22
|
+
/**
|
|
23
|
+
* The listing's own `partial`: true when an origin it does not list may still run there. A
|
|
24
|
+
* Kernel lists only the installations the caller reads in its Domain directory and says
|
|
25
|
+
* nothing of the rest (AM-83, AM-84), so C7 always answers true.
|
|
26
|
+
*/
|
|
27
|
+
readonly partial: boolean;
|
|
28
|
+
readonly installations: readonly InstanceInstallation[];
|
|
29
|
+
} | {
|
|
30
|
+
readonly kind: 'unknown';
|
|
31
|
+
readonly reason: InstallationUnknownReason;
|
|
32
|
+
/** The CLI's error code, or the SDK's own when the CLI answered nothing readable. */
|
|
33
|
+
readonly code: string;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Decode one `astrale.installed-list` v1 document: the instance Kernel that answered, whether the
|
|
37
|
+
* listing may omit installations (`partial`, required) and the deployment URL of each
|
|
38
|
+
* installation. Anything else is refused.
|
|
39
|
+
*/
|
|
40
|
+
export declare function decodeInstanceListing(document: Readonly<Record<string, unknown>>): Extract<InstanceListing, {
|
|
41
|
+
readonly kind: 'listed';
|
|
42
|
+
}>;
|
|
43
|
+
/**
|
|
44
|
+
* Why an instance listing failed, from the machine error the CLI printed on stderr (the last line
|
|
45
|
+
* that is a JSON object with an `error` code): only that code is read, never its message, since
|
|
46
|
+
* stderr may name the caller's credential. A Kernel without the listing is `unsupported`; a timeout
|
|
47
|
+
* at any phase is `timeout`; a Kernel refusal is `refused`; anything else, a command that printed
|
|
48
|
+
* no machine error and a failed read of Admin's registry (`isAdminFailure`) included, is
|
|
49
|
+
* `unavailable`.
|
|
50
|
+
*/
|
|
51
|
+
export declare function instanceRefusal(stderr: string): Extract<InstanceListing, {
|
|
52
|
+
readonly kind: 'unknown';
|
|
53
|
+
}>;
|
|
54
|
+
/**
|
|
55
|
+
* Whether an instance listing failed on Admin's side, not the instance's: the listing also reads
|
|
56
|
+
* Admin's registry to name what runs there, and fails as a whole when that read fails (CT24, C7).
|
|
57
|
+
* Its codes are Admin's (`REGISTRY_*`, `ADMIN_*`), never the SDK's own `REGISTRY_CLI_*`.
|
|
58
|
+
*/
|
|
59
|
+
export declare function isAdminFailure(code: string): boolean;
|
|
60
|
+
/** The instance did not answer within the probe's time. */
|
|
61
|
+
export declare function instanceTimeout(): Extract<InstanceListing, {
|
|
62
|
+
readonly kind: 'unknown';
|
|
63
|
+
}>;
|
|
64
|
+
/** The CLI answered the instance listing with something this SDK cannot read. */
|
|
65
|
+
export declare function instanceUnreadable(): Extract<InstanceListing, {
|
|
66
|
+
readonly kind: 'unknown';
|
|
67
|
+
}>;
|