@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
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs';
|
|
2
|
-
import { mkdir, rm, writeFile } from 'node:fs/promises';
|
|
3
|
-
import { dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
4
|
-
import { pathToFileURL } from 'node:url';
|
|
5
|
-
import { admitRuntime, compile, resolveRuntime, runtime, verifyPreflight, } from '../../../deployment/index.js';
|
|
6
|
-
import { admitProjectModule } from '../../../project/index.js';
|
|
7
|
-
import { loadDeclaredSecrets } from '../dotenv.js';
|
|
8
|
-
import { selectEnvironment } from '../project.js';
|
|
9
|
-
import { projectImportPlugin } from './project-imports.js';
|
|
10
|
-
import { DevelopmentSources } from './sources.js';
|
|
11
|
-
/** Rebuild one complete, isolated Environment candidate from authored sources. */
|
|
12
|
-
export class DevelopmentCandidateBuilder {
|
|
13
|
-
#configPath;
|
|
14
|
-
#projectDir;
|
|
15
|
-
#environment;
|
|
16
|
-
#runtimePath;
|
|
17
|
-
#overrideSecrets;
|
|
18
|
-
#generation = 0;
|
|
19
|
-
constructor(input) {
|
|
20
|
-
this.#configPath = input.configPath;
|
|
21
|
-
this.#projectDir = input.projectDir;
|
|
22
|
-
this.#environment = input.environment;
|
|
23
|
-
this.#runtimePath = input.runtimePath;
|
|
24
|
-
this.#overrideSecrets = input.overrideSecrets;
|
|
25
|
-
}
|
|
26
|
-
async prepare(signal) {
|
|
27
|
-
throwIfAborted(signal);
|
|
28
|
-
const directory = join(this.#projectDir, '.astrale', 'development', this.#environment, 'source', String(++this.#generation));
|
|
29
|
-
await mkdir(directory, { recursive: true });
|
|
30
|
-
const bridge = join(directory, 'bridge.ts');
|
|
31
|
-
const sources = new DevelopmentSources(this.#projectDir);
|
|
32
|
-
sources.record(join(this.#projectDir, 'package.json'));
|
|
33
|
-
const configImport = moduleSpecifier(dirname(bridge), this.#configPath);
|
|
34
|
-
const runtimeImport = moduleSpecifier(dirname(bridge), resolve(dirname(this.#configPath), this.#runtimePath));
|
|
35
|
-
await writeFile(bridge, `export { default as project } from ${JSON.stringify(configImport)}\n` +
|
|
36
|
-
`export { default as runtime } from ${JSON.stringify(runtimeImport)}\n`);
|
|
37
|
-
try {
|
|
38
|
-
const bunRuntime = bun();
|
|
39
|
-
const built = await bunRuntime.build({
|
|
40
|
-
entrypoints: [bridge],
|
|
41
|
-
outdir: directory,
|
|
42
|
-
naming: 'application.mjs',
|
|
43
|
-
target: 'bun',
|
|
44
|
-
format: 'esm',
|
|
45
|
-
packages: 'bundle',
|
|
46
|
-
plugins: [projectImportPlugin(this.#projectDir, bunRuntime)],
|
|
47
|
-
splitting: false,
|
|
48
|
-
sourcemap: 'inline',
|
|
49
|
-
metafile: true,
|
|
50
|
-
throw: false,
|
|
51
|
-
});
|
|
52
|
-
throwIfAborted(signal);
|
|
53
|
-
if (!built.success) {
|
|
54
|
-
const diagnostics = built.logs.map(({ message, position }) => position === undefined || position === null
|
|
55
|
-
? message
|
|
56
|
-
: `${relative(this.#projectDir, position.file)}:${position.line}:${position.column}: ${message}`);
|
|
57
|
-
throw new Error(['Authored Application rebuild failed.', ...diagnostics].join('\n'));
|
|
58
|
-
}
|
|
59
|
-
const output = built.outputs.find((candidate) => candidate.path.endsWith('application.mjs'));
|
|
60
|
-
if (output === undefined)
|
|
61
|
-
throw new Error('Authored Application rebuild produced no module.');
|
|
62
|
-
const loaded = (await import(`${pathToFileURL(output.path).href}?development=${this.#generation}`));
|
|
63
|
-
if (Object.keys(loaded).some((key) => key !== 'project' && key !== 'runtime')) {
|
|
64
|
-
throw new TypeError('Development bridge produced unexpected exports.');
|
|
65
|
-
}
|
|
66
|
-
const project = admitProjectModule({ default: loaded.project });
|
|
67
|
-
if ((project.entrypoints?.runtime ?? './runtime.ts') !== this.#runtimePath) {
|
|
68
|
-
throw new Error('Runtime entrypoint changed; restart pnpm dev to apply it.');
|
|
69
|
-
}
|
|
70
|
-
const environment = selectEnvironment(project, this.#environment);
|
|
71
|
-
const resolved = await resolveRuntime(runtime(this.#runtimePath), async (path) => {
|
|
72
|
-
if (path !== this.#runtimePath) {
|
|
73
|
-
throw new Error('Runtime entrypoint changed; restart pnpm dev to apply it.');
|
|
74
|
-
}
|
|
75
|
-
return Object.freeze({ default: loaded.runtime });
|
|
76
|
-
});
|
|
77
|
-
const build = compile(project.application);
|
|
78
|
-
admitRuntime({ runtime: build.runtime }, resolved);
|
|
79
|
-
const adapter = environment.deployment.adapter;
|
|
80
|
-
const parameters = environment.deployment.parameters;
|
|
81
|
-
for (const path of Object.keys(built.metafile?.inputs ?? {}))
|
|
82
|
-
sources.record(path);
|
|
83
|
-
const source = await adapter.prepare(parameters, {
|
|
84
|
-
projectDir: this.#projectDir,
|
|
85
|
-
environment: this.#environment,
|
|
86
|
-
...(environment.installation === undefined
|
|
87
|
-
? {}
|
|
88
|
-
: { installation: environment.installation }),
|
|
89
|
-
mode: 'release',
|
|
90
|
-
recordSource: sources.record,
|
|
91
|
-
signal,
|
|
92
|
-
build,
|
|
93
|
-
runtime: resolved,
|
|
94
|
-
});
|
|
95
|
-
const artifact = verifyPreflight({ build, runtime: resolved, source });
|
|
96
|
-
const declared = this.#overrideSecrets === undefined
|
|
97
|
-
? secretsFor(adapter, parameters, this.#projectDir, resolved.runtime)
|
|
98
|
-
: { values: this.#overrideSecrets };
|
|
99
|
-
if (declared.path !== undefined)
|
|
100
|
-
sources.record(declared.path);
|
|
101
|
-
return Object.freeze({
|
|
102
|
-
adapter,
|
|
103
|
-
parameters,
|
|
104
|
-
...(environment.installation === undefined
|
|
105
|
-
? {}
|
|
106
|
-
: { installation: environment.installation }),
|
|
107
|
-
artifact,
|
|
108
|
-
secrets: declared.values,
|
|
109
|
-
sources: sources.snapshot(),
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
finally {
|
|
113
|
-
await rm(directory, { recursive: true, force: true });
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
export async function discoverRuntimePath(configPath) {
|
|
118
|
-
const loaded = (await import(`${pathToFileURL(configPath).href}?discover=${Date.now()}`));
|
|
119
|
-
const project = admitProjectModule(loaded);
|
|
120
|
-
return project.entrypoints?.runtime ?? './runtime.ts';
|
|
121
|
-
}
|
|
122
|
-
export function sameEnvironment(current, candidate) {
|
|
123
|
-
return (candidate.adapter.name === current.adapter.name &&
|
|
124
|
-
candidate.adapter.version === current.adapter.version &&
|
|
125
|
-
candidate.artifact.build.schema.compiled.root.origin ===
|
|
126
|
-
current.artifact.build.schema.compiled.root.origin &&
|
|
127
|
-
stable(candidate.parameters) === stable(current.parameters) &&
|
|
128
|
-
stable(candidate.installation) === stable(current.installation));
|
|
129
|
-
}
|
|
130
|
-
/** Identify a rebuilt candidate that cannot change provider or installation state. */
|
|
131
|
-
export function sameDeploymentCandidate(current, candidate) {
|
|
132
|
-
return (sameEnvironment(current, candidate) &&
|
|
133
|
-
candidate.artifact.build.schema.compiled.root.revision ===
|
|
134
|
-
current.artifact.build.schema.compiled.root.revision &&
|
|
135
|
-
candidate.artifact.digest === current.artifact.digest &&
|
|
136
|
-
stable(candidate.secrets) === stable(current.secrets));
|
|
137
|
-
}
|
|
138
|
-
function secretsFor(adapter, parameters, projectDir, selectedRuntime) {
|
|
139
|
-
const file = adapter.secretsFile?.(parameters);
|
|
140
|
-
if (file === undefined)
|
|
141
|
-
return { values: Object.freeze({}) };
|
|
142
|
-
const path = isAbsolute(file) ? file : join(projectDir, file);
|
|
143
|
-
if (Object.keys(selectedRuntime.integrations).length === 0 && !existsSync(path)) {
|
|
144
|
-
return { values: Object.freeze({}) };
|
|
145
|
-
}
|
|
146
|
-
return { values: Object.freeze(loadDeclaredSecrets(path, file)), path };
|
|
147
|
-
}
|
|
148
|
-
function bun() {
|
|
149
|
-
const value = Reflect.get(globalThis, 'Bun');
|
|
150
|
-
if (value === undefined || typeof value.build !== 'function') {
|
|
151
|
-
throw new TypeError('Domain development requires the Bun runtime.');
|
|
152
|
-
}
|
|
153
|
-
return value;
|
|
154
|
-
}
|
|
155
|
-
function moduleSpecifier(from, target) {
|
|
156
|
-
const path = relative(from, target).split(sep).join('/');
|
|
157
|
-
return path.startsWith('.') ? path : `./${path}`;
|
|
158
|
-
}
|
|
159
|
-
function stable(input) {
|
|
160
|
-
if (input === undefined)
|
|
161
|
-
return 'undefined';
|
|
162
|
-
if (input === null || typeof input !== 'object')
|
|
163
|
-
return JSON.stringify(input);
|
|
164
|
-
if (Array.isArray(input))
|
|
165
|
-
return `[${input.map(stable).join(',')}]`;
|
|
166
|
-
const record = input;
|
|
167
|
-
return `{${Object.keys(record)
|
|
168
|
-
.sort()
|
|
169
|
-
.map((key) => `${JSON.stringify(key)}:${stable(record[key])}`)
|
|
170
|
-
.join(',')}}`;
|
|
171
|
-
}
|
|
172
|
-
function throwIfAborted(signal) {
|
|
173
|
-
if (signal.aborted) {
|
|
174
|
-
throw signal.reason instanceof Error ? signal.reason : new Error('Development interrupted.');
|
|
175
|
-
}
|
|
176
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ReadyDeployResult } from '../../../deployment/adapter/index.js';
|
|
2
|
-
import type { InstallationEvidence } from '../installation/index.js';
|
|
3
|
-
import type { DevelopmentCandidate } from './candidate.js';
|
|
4
|
-
export interface DevelopmentDeploymentInput {
|
|
5
|
-
readonly projectDir: string;
|
|
6
|
-
readonly environment: string;
|
|
7
|
-
readonly deployOnly: boolean;
|
|
8
|
-
readonly identity?: string;
|
|
9
|
-
readonly credential?: string;
|
|
10
|
-
readonly installationExecutable?: string;
|
|
11
|
-
}
|
|
12
|
-
/** Commit and verify one complete remote candidate, then reconcile its optional installation. */
|
|
13
|
-
export declare function deployDevelopmentCandidate(candidate: DevelopmentCandidate, input: DevelopmentDeploymentInput, signal: AbortSignal): Promise<{
|
|
14
|
-
readonly deployment: ReadyDeployResult;
|
|
15
|
-
readonly installation?: InstallationEvidence;
|
|
16
|
-
}>;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { verifyDeployment } from '../../../deployment/index.js';
|
|
2
|
-
import { reconcileEnvironmentRelease } from '../environment-release.js';
|
|
3
|
-
/** Commit and verify one complete remote candidate, then reconcile its optional installation. */
|
|
4
|
-
export async function deployDevelopmentCandidate(candidate, input, signal) {
|
|
5
|
-
const deployed = await candidate.adapter.deploy(candidate.parameters, {
|
|
6
|
-
projectDir: input.projectDir,
|
|
7
|
-
environment: input.environment,
|
|
8
|
-
...(candidate.installation === undefined ? {} : { installation: candidate.installation }),
|
|
9
|
-
...(input.identity === undefined ? {} : { identity: input.identity }),
|
|
10
|
-
...(input.credential === undefined ? {} : { credential: input.credential }),
|
|
11
|
-
secrets: candidate.secrets,
|
|
12
|
-
artifact: candidate.artifact,
|
|
13
|
-
signal,
|
|
14
|
-
});
|
|
15
|
-
const verified = verifyDeployment(candidate.artifact, deployed);
|
|
16
|
-
if (verified.status === 'failed') {
|
|
17
|
-
throw new Error(`Deployment failed during ${verified.phase}: ${verified.error.message}`, {
|
|
18
|
-
cause: verified.error,
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
const installation = await reconcileEnvironmentRelease({
|
|
22
|
-
projectDir: input.projectDir,
|
|
23
|
-
environment: input.environment,
|
|
24
|
-
adapter: candidate.adapter,
|
|
25
|
-
deployment: verified,
|
|
26
|
-
...(candidate.installation === undefined ? {} : { installation: candidate.installation }),
|
|
27
|
-
deployOnly: input.deployOnly,
|
|
28
|
-
...(input.installationExecutable === undefined
|
|
29
|
-
? {}
|
|
30
|
-
: { installationExecutable: input.installationExecutable }),
|
|
31
|
-
...(input.identity === undefined ? {} : { identity: input.identity }),
|
|
32
|
-
...(input.credential === undefined ? {} : { credential: input.credential }),
|
|
33
|
-
signal,
|
|
34
|
-
});
|
|
35
|
-
return Object.freeze({
|
|
36
|
-
deployment: verified,
|
|
37
|
-
...(installation === undefined ? {} : { installation }),
|
|
38
|
-
});
|
|
39
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/** Watch one Project Environment and serialize complete remote deployment generations. */
|
|
2
|
-
export declare function develop(input: {
|
|
3
|
-
readonly configPath: string;
|
|
4
|
-
readonly projectDir: string;
|
|
5
|
-
readonly environment: string;
|
|
6
|
-
readonly deployOnly: boolean;
|
|
7
|
-
readonly identity?: string;
|
|
8
|
-
readonly credentialFile?: string;
|
|
9
|
-
readonly sessionFile?: string;
|
|
10
|
-
readonly secretsFile?: string;
|
|
11
|
-
}): Promise<number>;
|
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
import { rm, rmdir } from 'node:fs/promises';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import { resolveAstraleInstanceIssuer } from '../astrale/instance.js';
|
|
4
|
-
import { resolveCompatibleAstrale } from '../astrale/version.js';
|
|
5
|
-
import { loadPrivateCredentialFile } from '../credential.js';
|
|
6
|
-
import { deprecationWarnings } from '../deprecations.js';
|
|
7
|
-
import { loadPrivateSecretsFile } from '../dotenv.js';
|
|
8
|
-
import { error, info, warn } from '../log.js';
|
|
9
|
-
import { DevelopmentCandidateBuilder, discoverRuntimePath, sameDeploymentCandidate, sameEnvironment, } from './candidate.js';
|
|
10
|
-
import { deployDevelopmentCandidate } from './deployment.js';
|
|
11
|
-
import { DevelopmentLifecycle } from './lifecycle.js';
|
|
12
|
-
import { acquireProjectLock } from './project-lock.js';
|
|
13
|
-
import { LatestRebuild } from './rebuild.js';
|
|
14
|
-
import { developmentReleaseEvidence } from './release-evidence.js';
|
|
15
|
-
import { reportDevelopmentDeployment } from './report.js';
|
|
16
|
-
import { DevelopmentSessionFileWriter } from './session-file.js';
|
|
17
|
-
import { watchSources } from './source-watch.js';
|
|
18
|
-
import { acquireDevelopmentTargetLock } from './target-lock.js';
|
|
19
|
-
import { DevelopmentView } from './view.js';
|
|
20
|
-
/** Watch one Project Environment and serialize complete remote deployment generations. */
|
|
21
|
-
export async function develop(input) {
|
|
22
|
-
const lifecycle = new DevelopmentLifecycle();
|
|
23
|
-
let sessionFile;
|
|
24
|
-
let lock;
|
|
25
|
-
let targetLock;
|
|
26
|
-
let view;
|
|
27
|
-
let installationExecutable;
|
|
28
|
-
let installationIssuer;
|
|
29
|
-
let sourceWatch;
|
|
30
|
-
let rebuild;
|
|
31
|
-
let current;
|
|
32
|
-
let lastEvidence;
|
|
33
|
-
let failure;
|
|
34
|
-
const cleanup = [];
|
|
35
|
-
try {
|
|
36
|
-
if (input.sessionFile !== undefined) {
|
|
37
|
-
sessionFile = await DevelopmentSessionFileWriter.create(input.sessionFile);
|
|
38
|
-
}
|
|
39
|
-
lock = await acquireProjectLock({
|
|
40
|
-
projectRoot: input.projectDir,
|
|
41
|
-
environment: input.environment,
|
|
42
|
-
});
|
|
43
|
-
const overrideSecrets = input.secretsFile === undefined
|
|
44
|
-
? undefined
|
|
45
|
-
: Object.freeze(loadPrivateSecretsFile(input.secretsFile));
|
|
46
|
-
const credential = input.credentialFile === undefined
|
|
47
|
-
? undefined
|
|
48
|
-
: loadPrivateCredentialFile(input.credentialFile);
|
|
49
|
-
const runtimePath = await discoverRuntimePath(input.configPath);
|
|
50
|
-
const builder = new DevelopmentCandidateBuilder({
|
|
51
|
-
...input,
|
|
52
|
-
runtimePath,
|
|
53
|
-
overrideSecrets,
|
|
54
|
-
});
|
|
55
|
-
current = await builder.prepare(lifecycle.signal);
|
|
56
|
-
if (credential !== undefined && current.installation?.identity !== undefined) {
|
|
57
|
-
throw new TypeError('--credential-file cannot be combined with the Environment installation identity.');
|
|
58
|
-
}
|
|
59
|
-
if (sessionFile !== undefined && (current.installation === undefined || input.deployOnly)) {
|
|
60
|
-
throw new TypeError('--session-file requires an Environment installation that is active for this development session.');
|
|
61
|
-
}
|
|
62
|
-
info(`Domain: ${current.artifact.build.schema.compiled.root.origin}`);
|
|
63
|
-
for (const warning of deprecationWarnings(current.artifact.build))
|
|
64
|
-
warn(warning);
|
|
65
|
-
if (current.installation !== undefined && !input.deployOnly) {
|
|
66
|
-
installationExecutable = await resolveCompatibleAstrale({
|
|
67
|
-
projectDir: input.projectDir,
|
|
68
|
-
signal: lifecycle.signal,
|
|
69
|
-
});
|
|
70
|
-
installationIssuer = await resolveAstraleInstanceIssuer({
|
|
71
|
-
executable: installationExecutable,
|
|
72
|
-
projectDir: input.projectDir,
|
|
73
|
-
instance: current.installation.instance,
|
|
74
|
-
signal: lifecycle.signal,
|
|
75
|
-
});
|
|
76
|
-
targetLock = await acquireDevelopmentTargetLock({
|
|
77
|
-
issuer: installationIssuer,
|
|
78
|
-
origin: current.artifact.build.schema.compiled.root.origin,
|
|
79
|
-
});
|
|
80
|
-
view = new DevelopmentView({
|
|
81
|
-
executable: installationExecutable,
|
|
82
|
-
projectDir: input.projectDir,
|
|
83
|
-
instance: current.installation.instance,
|
|
84
|
-
...(credential === undefined
|
|
85
|
-
? { identity: input.identity ?? current.installation.identity }
|
|
86
|
-
: { credential }),
|
|
87
|
-
});
|
|
88
|
-
if (current.artifact.build.frontend !== undefined)
|
|
89
|
-
await view.prepare(lifecycle.signal);
|
|
90
|
-
}
|
|
91
|
-
const first = await deployDevelopmentCandidate(current, { ...input, credential, installationExecutable }, lifecycle.signal);
|
|
92
|
-
lastEvidence =
|
|
93
|
-
first.installation === undefined ? undefined : developmentReleaseEvidence(first.installation);
|
|
94
|
-
await sessionFile?.transition('ready', lastEvidence);
|
|
95
|
-
reportDevelopmentDeployment(first.deployment, first.installation, current.adapter, input);
|
|
96
|
-
await refreshView(view, first.deployment.release, lifecycle.signal);
|
|
97
|
-
let restartReported = false;
|
|
98
|
-
rebuild = new LatestRebuild({
|
|
99
|
-
async prepare(_ignored, signal) {
|
|
100
|
-
info(`Rebuilding: ${input.environment}`);
|
|
101
|
-
if (lastEvidence !== undefined)
|
|
102
|
-
await sessionFile?.transition('updating', lastEvidence);
|
|
103
|
-
return builder.prepare(signal);
|
|
104
|
-
},
|
|
105
|
-
async commit(candidate, signal) {
|
|
106
|
-
if (!sameEnvironment(current, candidate)) {
|
|
107
|
-
restartReported = true;
|
|
108
|
-
throw new Error('Project Environment configuration changed; restart pnpm dev to apply it.');
|
|
109
|
-
}
|
|
110
|
-
if (sameDeploymentCandidate(current, candidate)) {
|
|
111
|
-
current = candidate;
|
|
112
|
-
await sessionFile?.transition('ready', lastEvidence);
|
|
113
|
-
sourceWatch?.update(candidate.sources);
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
if (installationIssuer !== undefined && candidate.installation !== undefined) {
|
|
117
|
-
await resolveAstraleInstanceIssuer({
|
|
118
|
-
executable: installationExecutable,
|
|
119
|
-
projectDir: input.projectDir,
|
|
120
|
-
instance: candidate.installation.instance,
|
|
121
|
-
expectedIssuer: installationIssuer,
|
|
122
|
-
signal,
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
if (candidate.artifact.build.frontend !== undefined)
|
|
126
|
-
await view?.prepare(signal);
|
|
127
|
-
const deployed = await deployDevelopmentCandidate(candidate, { ...input, credential, installationExecutable }, signal);
|
|
128
|
-
current = candidate;
|
|
129
|
-
lastEvidence =
|
|
130
|
-
deployed.installation === undefined
|
|
131
|
-
? undefined
|
|
132
|
-
: developmentReleaseEvidence(deployed.installation);
|
|
133
|
-
await sessionFile?.transition('ready', lastEvidence);
|
|
134
|
-
sourceWatch?.update(candidate.sources);
|
|
135
|
-
info(`Updated: ${candidate.artifact.build.schema.compiled.root.revision}`);
|
|
136
|
-
reportDevelopmentDeployment(deployed.deployment, deployed.installation, candidate.adapter, input);
|
|
137
|
-
await refreshView(view, deployed.deployment.release, signal);
|
|
138
|
-
},
|
|
139
|
-
async failed(cause) {
|
|
140
|
-
error(cause instanceof Error ? cause.message : String(cause));
|
|
141
|
-
if (lastEvidence === undefined)
|
|
142
|
-
return;
|
|
143
|
-
try {
|
|
144
|
-
await sessionFile?.transition('recovering', lastEvidence);
|
|
145
|
-
}
|
|
146
|
-
catch (sessionCause) {
|
|
147
|
-
const terminal = new AggregateError([cause, sessionCause], 'Development rebuild failed and session evidence could not be recovered.');
|
|
148
|
-
failure ??= terminal;
|
|
149
|
-
lifecycle.stop(terminal);
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
});
|
|
153
|
-
sourceWatch = watchSources({
|
|
154
|
-
projectDir: input.projectDir,
|
|
155
|
-
configPath: input.configPath,
|
|
156
|
-
sources: current.sources,
|
|
157
|
-
onInvalidate: () => rebuild.invalidate(),
|
|
158
|
-
onRestartRequired: () => {
|
|
159
|
-
if (restartReported)
|
|
160
|
-
return;
|
|
161
|
-
restartReported = true;
|
|
162
|
-
error('Project Environment configuration changed; restart pnpm dev to apply it.');
|
|
163
|
-
},
|
|
164
|
-
onError: (cause) => {
|
|
165
|
-
failure = cause;
|
|
166
|
-
lifecycle.stop(cause);
|
|
167
|
-
},
|
|
168
|
-
});
|
|
169
|
-
info('Ready: watching for remote deployments');
|
|
170
|
-
// Edits made while the first build/deployment was in flight predate this watcher.
|
|
171
|
-
// Catch up once; artifact deduplication prevents an unchanged second deployment.
|
|
172
|
-
rebuild.invalidate();
|
|
173
|
-
await lifecycle.stopped;
|
|
174
|
-
}
|
|
175
|
-
catch (cause) {
|
|
176
|
-
failure = cause;
|
|
177
|
-
}
|
|
178
|
-
lifecycle.stop(failure);
|
|
179
|
-
try {
|
|
180
|
-
await sessionFile?.transition('stopping', lastEvidence);
|
|
181
|
-
}
|
|
182
|
-
catch (cause) {
|
|
183
|
-
failure ??= cause;
|
|
184
|
-
}
|
|
185
|
-
for (const operation of [
|
|
186
|
-
() => sourceWatch?.stop(),
|
|
187
|
-
() => rebuild?.stop(failure),
|
|
188
|
-
() => view?.close(AbortSignal.timeout(30_000)),
|
|
189
|
-
() => rm(join(input.projectDir, '.astrale', 'development', input.environment, 'source'), {
|
|
190
|
-
recursive: true,
|
|
191
|
-
force: true,
|
|
192
|
-
}),
|
|
193
|
-
() => targetLock?.release(),
|
|
194
|
-
() => lock?.release(),
|
|
195
|
-
]) {
|
|
196
|
-
try {
|
|
197
|
-
await operation();
|
|
198
|
-
}
|
|
199
|
-
catch (cause) {
|
|
200
|
-
cleanup.push(cause);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
for (const directory of [
|
|
204
|
-
join(input.projectDir, '.astrale', 'development', input.environment),
|
|
205
|
-
join(input.projectDir, '.astrale', 'development'),
|
|
206
|
-
]) {
|
|
207
|
-
try {
|
|
208
|
-
await rmdir(directory);
|
|
209
|
-
}
|
|
210
|
-
catch (cause) {
|
|
211
|
-
const code = cause.code;
|
|
212
|
-
if (code !== 'ENOENT' && code !== 'ENOTEMPTY' && code !== 'EEXIST')
|
|
213
|
-
cleanup.push(cause);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
try {
|
|
217
|
-
await sessionFile?.transition(failure === undefined && cleanup.length === 0 ? 'stopped' : 'failed');
|
|
218
|
-
}
|
|
219
|
-
catch (cause) {
|
|
220
|
-
cleanup.push(cause);
|
|
221
|
-
}
|
|
222
|
-
lifecycle.dispose();
|
|
223
|
-
if (failure !== undefined) {
|
|
224
|
-
if (cleanup.length > 0)
|
|
225
|
-
error(new AggregateError(cleanup, 'Development cleanup failed.').message);
|
|
226
|
-
throw failure;
|
|
227
|
-
}
|
|
228
|
-
if (cleanup.length > 0)
|
|
229
|
-
throw new AggregateError(cleanup, 'Development cleanup failed.');
|
|
230
|
-
return 0;
|
|
231
|
-
}
|
|
232
|
-
async function refreshView(view, release, signal) {
|
|
233
|
-
if (view === undefined)
|
|
234
|
-
return;
|
|
235
|
-
try {
|
|
236
|
-
const pageUrl = await view.refresh(release, signal);
|
|
237
|
-
if (pageUrl !== undefined)
|
|
238
|
-
info(`View: ${pageUrl}`);
|
|
239
|
-
}
|
|
240
|
-
catch (cause) {
|
|
241
|
-
error(`View unavailable: ${cause instanceof Error ? cause.message : String(cause)}`);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export declare class DevelopmentLeaseError extends Error {
|
|
2
|
-
readonly code: 'DEVELOPMENT_LEASE_LOCKED' | 'DEVELOPMENT_LEASE_LOST';
|
|
3
|
-
readonly name = "DevelopmentLeaseError";
|
|
4
|
-
constructor(code: 'DEVELOPMENT_LEASE_LOCKED' | 'DEVELOPMENT_LEASE_LOST', message: string, options?: ErrorOptions);
|
|
5
|
-
}
|
|
6
|
-
export interface DevelopmentLease {
|
|
7
|
-
readonly path: string;
|
|
8
|
-
readonly recovered: boolean;
|
|
9
|
-
release(): Promise<void>;
|
|
10
|
-
}
|
|
11
|
-
/** One fail-closed filesystem lease engine for every local development coordinate. */
|
|
12
|
-
export declare function acquireDevelopmentLease(input: {
|
|
13
|
-
readonly directory: string;
|
|
14
|
-
readonly coordinate: string;
|
|
15
|
-
readonly pid?: number;
|
|
16
|
-
readonly sessionId?: string;
|
|
17
|
-
readonly processAlive?: (pid: number) => boolean;
|
|
18
|
-
}): Promise<DevelopmentLease>;
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from 'node:crypto';
|
|
2
|
-
import { mkdir, open, readFile, unlink } from 'node:fs/promises';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
const LOCK_VERSION = 1;
|
|
5
|
-
export class DevelopmentLeaseError extends Error {
|
|
6
|
-
code;
|
|
7
|
-
name = 'DevelopmentLeaseError';
|
|
8
|
-
constructor(code, message, options) {
|
|
9
|
-
super(message, options);
|
|
10
|
-
this.code = code;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
/** One fail-closed filesystem lease engine for every local development coordinate. */
|
|
14
|
-
export async function acquireDevelopmentLease(input) {
|
|
15
|
-
const path = join(input.directory, 'session.lock');
|
|
16
|
-
const recovery = `${path}.reclaim`;
|
|
17
|
-
const sessionId = input.sessionId ?? randomUUID();
|
|
18
|
-
const alive = input.processAlive ?? processAlive;
|
|
19
|
-
const owner = Object.freeze({
|
|
20
|
-
version: LOCK_VERSION,
|
|
21
|
-
pid: input.pid ?? process.pid,
|
|
22
|
-
sessionId,
|
|
23
|
-
coordinate: input.coordinate,
|
|
24
|
-
acquiredAt: new Date().toISOString(),
|
|
25
|
-
});
|
|
26
|
-
await mkdir(input.directory, { recursive: true, mode: 0o700 });
|
|
27
|
-
try {
|
|
28
|
-
await create(path, owner);
|
|
29
|
-
return handle(path, input.coordinate, owner, false);
|
|
30
|
-
}
|
|
31
|
-
catch (cause) {
|
|
32
|
-
if (errorCode(cause) !== 'EEXIST')
|
|
33
|
-
throw cause;
|
|
34
|
-
}
|
|
35
|
-
let recoveryHandle;
|
|
36
|
-
try {
|
|
37
|
-
recoveryHandle = await open(recovery, 'wx', 0o600);
|
|
38
|
-
await recoveryHandle.writeFile(`${sessionId}\n`, 'utf8');
|
|
39
|
-
await recoveryHandle.sync();
|
|
40
|
-
}
|
|
41
|
-
catch (cause) {
|
|
42
|
-
if (errorCode(cause) === 'EEXIST')
|
|
43
|
-
throw locked(input.coordinate);
|
|
44
|
-
throw cause;
|
|
45
|
-
}
|
|
46
|
-
finally {
|
|
47
|
-
await recoveryHandle?.close();
|
|
48
|
-
}
|
|
49
|
-
try {
|
|
50
|
-
const observed = await readOwner(path, input.coordinate);
|
|
51
|
-
if (observed === undefined || alive(observed.pid))
|
|
52
|
-
throw locked(input.coordinate, observed);
|
|
53
|
-
const current = await readOwner(path, input.coordinate);
|
|
54
|
-
if (!sameOwner(current, observed) || alive(observed.pid)) {
|
|
55
|
-
throw locked(input.coordinate, current);
|
|
56
|
-
}
|
|
57
|
-
await unlink(path);
|
|
58
|
-
try {
|
|
59
|
-
await create(path, owner);
|
|
60
|
-
}
|
|
61
|
-
catch (cause) {
|
|
62
|
-
if (errorCode(cause) === 'EEXIST')
|
|
63
|
-
throw locked(input.coordinate);
|
|
64
|
-
throw cause;
|
|
65
|
-
}
|
|
66
|
-
return handle(path, input.coordinate, owner, true);
|
|
67
|
-
}
|
|
68
|
-
finally {
|
|
69
|
-
await unlink(recovery).catch((cause) => {
|
|
70
|
-
if (errorCode(cause) !== 'ENOENT')
|
|
71
|
-
throw cause;
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
function handle(path, coordinate, owner, recovered) {
|
|
76
|
-
let released = false;
|
|
77
|
-
return Object.freeze({
|
|
78
|
-
path,
|
|
79
|
-
recovered,
|
|
80
|
-
async release() {
|
|
81
|
-
if (released)
|
|
82
|
-
return;
|
|
83
|
-
const current = await readOwner(path, coordinate);
|
|
84
|
-
if (!sameOwner(current, owner)) {
|
|
85
|
-
throw new DevelopmentLeaseError('DEVELOPMENT_LEASE_LOST', `Development lease ownership changed for ${coordinate}; refusing to remove it.`);
|
|
86
|
-
}
|
|
87
|
-
await unlink(path);
|
|
88
|
-
released = true;
|
|
89
|
-
},
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
async function create(path, owner) {
|
|
93
|
-
const file = await open(path, 'wx', 0o600);
|
|
94
|
-
try {
|
|
95
|
-
await file.writeFile(`${JSON.stringify(owner)}\n`, 'utf8');
|
|
96
|
-
await file.sync();
|
|
97
|
-
}
|
|
98
|
-
catch (cause) {
|
|
99
|
-
await file.close();
|
|
100
|
-
await unlink(path).catch(() => undefined);
|
|
101
|
-
throw cause;
|
|
102
|
-
}
|
|
103
|
-
await file.close();
|
|
104
|
-
}
|
|
105
|
-
async function readOwner(path, coordinate) {
|
|
106
|
-
let text;
|
|
107
|
-
try {
|
|
108
|
-
text = await readFile(path, 'utf8');
|
|
109
|
-
}
|
|
110
|
-
catch (cause) {
|
|
111
|
-
if (errorCode(cause) === 'ENOENT')
|
|
112
|
-
return undefined;
|
|
113
|
-
throw cause;
|
|
114
|
-
}
|
|
115
|
-
let value;
|
|
116
|
-
try {
|
|
117
|
-
value = JSON.parse(text);
|
|
118
|
-
}
|
|
119
|
-
catch (cause) {
|
|
120
|
-
throw locked(coordinate, undefined, cause);
|
|
121
|
-
}
|
|
122
|
-
if (!isOwner(value) || value.coordinate !== coordinate)
|
|
123
|
-
throw locked(coordinate);
|
|
124
|
-
return value;
|
|
125
|
-
}
|
|
126
|
-
function isOwner(input) {
|
|
127
|
-
if (input === null || typeof input !== 'object' || Array.isArray(input))
|
|
128
|
-
return false;
|
|
129
|
-
const owner = input;
|
|
130
|
-
return (Reflect.ownKeys(owner).every((key) => ['version', 'pid', 'sessionId', 'coordinate', 'acquiredAt'].includes(String(key))) &&
|
|
131
|
-
owner.version === LOCK_VERSION &&
|
|
132
|
-
Number.isSafeInteger(owner.pid) &&
|
|
133
|
-
(owner.pid ?? 0) > 0 &&
|
|
134
|
-
typeof owner.sessionId === 'string' &&
|
|
135
|
-
owner.sessionId.length > 0 &&
|
|
136
|
-
typeof owner.coordinate === 'string' &&
|
|
137
|
-
owner.coordinate.length > 0 &&
|
|
138
|
-
typeof owner.acquiredAt === 'string');
|
|
139
|
-
}
|
|
140
|
-
function sameOwner(left, right) {
|
|
141
|
-
return (left?.version === right.version &&
|
|
142
|
-
left.pid === right.pid &&
|
|
143
|
-
left.sessionId === right.sessionId &&
|
|
144
|
-
left.coordinate === right.coordinate);
|
|
145
|
-
}
|
|
146
|
-
function locked(coordinate, owner, cause) {
|
|
147
|
-
const detail = owner === undefined ? '' : ` by PID ${owner.pid} (session ${owner.sessionId})`;
|
|
148
|
-
return new DevelopmentLeaseError('DEVELOPMENT_LEASE_LOCKED', `Development coordinate ${coordinate} is already locked${detail}.`, cause === undefined ? undefined : { cause });
|
|
149
|
-
}
|
|
150
|
-
function processAlive(pid) {
|
|
151
|
-
try {
|
|
152
|
-
process.kill(pid, 0);
|
|
153
|
-
return true;
|
|
154
|
-
}
|
|
155
|
-
catch (cause) {
|
|
156
|
-
return errorCode(cause) !== 'ESRCH';
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
function errorCode(input) {
|
|
160
|
-
return input !== null && typeof input === 'object' && 'code' in input
|
|
161
|
-
? String(Reflect.get(input, 'code'))
|
|
162
|
-
: undefined;
|
|
163
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/** Own process signals for exactly one foreground development command. */
|
|
2
|
-
export declare class DevelopmentLifecycle {
|
|
3
|
-
#private;
|
|
4
|
-
constructor();
|
|
5
|
-
get signal(): AbortSignal;
|
|
6
|
-
get stopped(): Promise<void>;
|
|
7
|
-
stop(reason?: unknown): void;
|
|
8
|
-
dispose(): void;
|
|
9
|
-
}
|