@astrale-os/sdk 0.6.0-beta.4 → 0.6.0-beta.41
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 +191 -58
- 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 +47 -31
- package/dist/application/action/define.d.ts +3 -3
- package/dist/application/action/index.d.ts +1 -1
- package/dist/application/define.d.ts +8 -6
- package/dist/application/define.js +28 -14
- package/dist/application/dependency/index.d.ts +1 -1
- package/dist/application/dependency/invoker.d.ts +21 -10
- package/dist/application/domain.d.ts +30 -0
- package/dist/application/index.d.ts +4 -4
- package/dist/application/index.js +1 -1
- package/dist/application/integration/define.d.ts +8 -1
- package/dist/application/integration/index.d.ts +2 -2
- package/dist/application/integration/integration.d.ts +13 -1
- package/dist/application/integration/operation.d.ts +16 -3
- 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/mutation/execution/execute.js +1 -1
- package/dist/application/mutation/failure.d.ts +6 -0
- package/dist/application/mutation/failure.js +24 -18
- package/dist/application/mutation/index.d.ts +1 -1
- package/dist/application/query/collection/union.js +11 -4
- package/dist/application/query/composite/plan.d.ts +0 -4
- package/dist/application/query/composite/plan.js +0 -2
- package/dist/application/query/conformance.d.ts +15 -0
- package/dist/application/query/conformance.js +46 -0
- package/dist/application/query/define.js +4 -3
- package/dist/application/query/execution/execute.d.ts +0 -1
- package/dist/application/query/execution/execute.js +7 -1
- package/dist/application/query/failure.d.ts +8 -0
- package/dist/application/query/failure.js +8 -0
- package/dist/application/query/index.d.ts +1 -1
- package/dist/application/query/index.js +1 -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 +3 -1
- package/dist/application/runtime/workflows.js +3 -4
- package/dist/application/view/define.js +4 -6
- package/dist/application/view/frontend.d.ts +2 -2
- package/dist/application/view/index.d.ts +1 -1
- package/dist/application/view/route.d.ts +0 -14
- package/dist/application/view/route.js +1 -64
- 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 +4 -4
- package/dist/application/workflow/define.js +14 -9
- package/dist/application/workflow/durable.d.ts +197 -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 +5 -3
- package/dist/deployment/adapter/adapter.d.ts +55 -13
- 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 +4 -3
- package/dist/deployment/adapter/define.js +107 -23
- package/dist/deployment/adapter/index.d.ts +4 -3
- package/dist/deployment/adapter/index.js +1 -0
- package/dist/deployment/adapter/release/command.d.ts +33 -0
- package/dist/deployment/adapter/release/context.d.ts +94 -0
- package/dist/deployment/adapter/release/index.d.ts +4 -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 +96 -0
- package/dist/deployment/address/configuration.js +274 -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 +4 -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 +73 -0
- package/dist/deployment/address/record.js +138 -0
- package/dist/deployment/address/summary.d.ts +30 -0
- package/dist/deployment/address/summary.js +1 -0
- package/dist/deployment/address/vectors.d.ts +60 -0
- package/dist/deployment/address/vectors.js +517 -0
- package/dist/deployment/authoring.d.ts +0 -2
- package/dist/deployment/authoring.js +0 -1
- package/dist/deployment/build/build.d.ts +8 -2
- package/dist/deployment/build/compile.d.ts +4 -4
- package/dist/deployment/build/compile.js +19 -17
- package/dist/deployment/build/frontend/compilation.d.ts +2 -4
- package/dist/deployment/build/frontend/compilation.js +0 -5
- package/dist/deployment/build/frontend/digest.js +1 -5
- 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.d.ts +2 -2
- package/dist/deployment/build/material.js +28 -13
- package/dist/deployment/build/schema.d.ts +2 -2
- package/dist/deployment/deployment.d.ts +3 -2
- package/dist/deployment/environment.d.ts +6 -0
- package/dist/deployment/environment.js +6 -0
- package/dist/deployment/index.d.ts +4 -6
- package/dist/deployment/index.js +1 -2
- package/dist/deployment/release/addressing.d.ts +6 -5
- package/dist/deployment/release/addressing.js +2 -3
- package/dist/deployment/release/assemble.d.ts +6 -3
- package/dist/deployment/release/assemble.js +12 -10
- package/dist/deployment/release/release.d.ts +16 -5
- 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 +11 -0
- package/dist/deployment/release/served/index.js +26 -0
- package/dist/deployment/release/{publication → served}/views.d.ts +2 -2
- package/dist/deployment/release/{publication → served}/views.js +0 -1
- package/dist/deployment/runtime/admission.d.ts +2 -2
- package/dist/deployment/runtime/admission.js +5 -5
- package/dist/deployment/verify/index.d.ts +3 -4
- package/dist/deployment/verify/index.js +2 -3
- 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 +1 -12
- package/dist/deployment/verify/preflight/index.js +1 -12
- 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 +15 -8
- package/dist/deployment/verify/readiness/index.js +25 -6
- package/dist/deployment/verify/readiness/release.d.ts +8 -0
- package/dist/deployment/verify/readiness/release.js +22 -0
- package/dist/deployment/worker/address.d.ts +26 -0
- package/dist/deployment/worker/address.js +43 -0
- package/dist/deployment/worker/build.d.ts +60 -0
- package/dist/deployment/worker/build.js +172 -0
- package/dist/deployment/worker/configuration.d.ts +73 -0
- package/dist/deployment/worker/configuration.js +165 -0
- package/dist/deployment/worker/content.d.ts +38 -0
- package/dist/deployment/worker/content.js +169 -0
- package/dist/deployment/worker/index.d.ts +29 -0
- package/dist/deployment/worker/index.js +29 -0
- package/dist/deployment/worker/limits.d.ts +30 -0
- package/dist/deployment/worker/limits.js +30 -0
- package/dist/deployment/worker/record.d.ts +29 -0
- package/dist/deployment/worker/record.js +69 -0
- package/dist/deployment/worker/request.d.ts +118 -0
- package/dist/deployment/worker/request.js +280 -0
- package/dist/deployment/worker/response.d.ts +101 -0
- package/dist/deployment/worker/response.js +207 -0
- package/dist/execution/cache/cache.d.ts +17 -0
- package/dist/execution/cache/cache.js +11 -0
- package/dist/execution/cache/index.d.ts +2 -0
- package/dist/execution/cache/index.js +2 -0
- package/dist/execution/cache/memory.d.ts +13 -0
- package/dist/execution/cache/memory.js +48 -0
- package/dist/execution/identity/authentication.d.ts +33 -3
- package/dist/execution/identity/authentication.js +90 -36
- package/dist/execution/identity/callback.d.ts +20 -20
- package/dist/execution/identity/callback.js +34 -26
- package/dist/execution/identity/delivery.d.ts +6 -4
- package/dist/execution/identity/delivery.js +25 -20
- package/dist/execution/identity/identity.d.ts +17 -3
- package/dist/execution/identity/identity.js +12 -4
- package/dist/execution/identity/jwks.d.ts +5 -0
- package/dist/execution/identity/jwks.js +92 -102
- package/dist/execution/index.d.ts +6 -4
- package/dist/execution/index.js +4 -2
- package/dist/execution/invocation/admission/age.d.ts +57 -0
- package/dist/execution/invocation/admission/age.js +208 -0
- package/dist/execution/invocation/admission/authentication.d.ts +13 -13
- package/dist/execution/invocation/admission/authentication.js +52 -44
- package/dist/execution/invocation/admission/authority.d.ts +28 -6
- package/dist/execution/invocation/admission/authority.js +9 -2
- package/dist/execution/invocation/admission/index.d.ts +4 -3
- package/dist/execution/invocation/admission/index.js +3 -2
- package/dist/execution/invocation/admission/input.d.ts +2 -2
- package/dist/execution/invocation/admission/input.js +16 -2
- package/dist/execution/invocation/admission/target.d.ts +11 -0
- package/dist/execution/invocation/admission/target.js +22 -3
- package/dist/execution/invocation/capabilities/bind.d.ts +11 -0
- package/dist/execution/invocation/capabilities/bind.js +25 -0
- package/dist/execution/invocation/capabilities/index.d.ts +1 -0
- package/dist/execution/invocation/capabilities/index.js +1 -0
- package/dist/execution/invocation/dependency/bind.d.ts +3 -1
- package/dist/execution/invocation/dependency/bind.js +36 -16
- package/dist/execution/invocation/dispatch/context.d.ts +7 -6
- package/dist/execution/invocation/dispatch/context.js +11 -44
- package/dist/execution/invocation/dispatch/workflow.js +0 -4
- package/dist/execution/invocation/handler.js +8 -2
- package/dist/execution/invocation/index.d.ts +2 -2
- package/dist/execution/invocation/index.js +1 -1
- package/dist/execution/invocation/integration/authentication.d.ts +3 -3
- package/dist/execution/invocation/integration/authentication.js +7 -7
- package/dist/execution/invocation/integration/call.d.ts +2 -1
- package/dist/execution/invocation/integration/call.js +3 -3
- package/dist/execution/invocation/integration/clients.d.ts +1 -1
- package/dist/execution/invocation/integration/index.d.ts +1 -0
- package/dist/execution/invocation/integration/index.js +1 -0
- package/dist/execution/invocation/invocation.d.ts +6 -0
- package/dist/execution/invocation/invocation.js +129 -21
- package/dist/execution/invocation/lifecycle/active.d.ts +8 -2
- package/dist/execution/invocation/lifecycle/active.js +3 -3
- package/dist/execution/invocation/lifecycle/index.d.ts +1 -1
- package/dist/execution/invocation/result/errors.d.ts +0 -10
- package/dist/execution/invocation/result/errors.js +0 -17
- package/dist/execution/invocation/result/index.d.ts +2 -2
- package/dist/execution/invocation/result/index.js +1 -1
- 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 +17 -0
- package/dist/execution/runtime/release.js +7 -0
- package/dist/execution/serve.d.ts +18 -4
- package/dist/execution/serve.js +10 -0
- package/dist/execution/service/create.js +43 -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 +20 -5
- package/dist/execution/service/serving/delivery.d.ts +5 -0
- package/dist/execution/service/{publication → serving}/delivery.js +4 -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/source.d.ts +11 -0
- package/dist/execution/service/serving/source.js +15 -0
- package/dist/execution/workflows/attempts.d.ts +87 -0
- package/dist/execution/workflows/attempts.js +205 -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 +83 -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 +39 -0
- package/dist/execution/workflows/failure.js +143 -0
- package/dist/execution/workflows/index.d.ts +4 -0
- package/dist/execution/workflows/index.js +3 -0
- package/dist/execution/workflows/integrations.d.ts +13 -0
- package/dist/execution/workflows/integrations.js +25 -0
- package/dist/execution/workflows/options.d.ts +81 -0
- package/dist/execution/workflows/options.js +158 -0
- package/dist/execution/workflows/receiver.d.ts +24 -0
- package/dist/execution/workflows/receiver.js +99 -0
- package/dist/execution/workflows/route.d.ts +12 -0
- package/dist/execution/workflows/route.js +35 -0
- package/dist/execution/workflows/run.d.ts +23 -0
- package/dist/execution/workflows/run.js +365 -0
- package/dist/execution/workflows/steps.d.ts +48 -0
- package/dist/execution/workflows/steps.js +93 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/platform/graph/alias.d.ts +1 -5
- package/dist/platform/graph/alias.js +1 -5
- package/dist/platform/graph/document/index.d.ts +1 -1
- package/dist/platform/graph/document/index.js +1 -1
- package/dist/platform/graph/index.d.ts +1 -1
- package/dist/platform/graph/index.js +1 -1
- package/dist/platform/release/index.d.ts +2 -0
- package/dist/platform/release/index.js +2 -0
- package/dist/platform/schema/callable-authoring.d.ts +21 -0
- package/dist/platform/schema/callable-authoring.js +27 -0
- package/dist/platform/schema/class-authoring.d.ts +61 -11
- package/dist/platform/schema/class-authoring.js +37 -4
- package/dist/platform/schema/class-icon-svg.d.ts +9 -0
- package/dist/platform/schema/class-icon-svg.js +29 -0
- package/dist/platform/schema/class-icon.d.ts +3 -8
- package/dist/platform/schema/class-icon.js +2 -29
- package/dist/platform/schema/index.d.ts +6 -4
- package/dist/platform/schema/index.js +2 -1
- package/dist/platform/schema/property.d.ts +5 -0
- package/dist/platform/schema/schema-authoring.d.ts +14 -7
- package/dist/platform/schema/schema-authoring.js +5 -1
- 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 +1 -5
- 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 +6 -0
- package/dist/project/install-command.js +9 -0
- package/dist/project/project.d.ts +10 -8
- package/dist/testing/dataset/define.d.ts +1 -1
- package/dist/testing/durable/engine.d.ts +128 -0
- package/dist/testing/durable/engine.js +619 -0
- package/dist/testing/durable/index.d.ts +3 -0
- package/dist/testing/durable/index.js +1 -0
- package/dist/testing/durable/steps.d.ts +30 -0
- package/dist/testing/durable/steps.js +45 -0
- package/dist/testing/index.d.ts +6 -1
- package/dist/testing/index.js +5 -1
- package/dist/testing/load.js +1 -1
- package/dist/tooling/cli/adapter-command.d.ts +35 -0
- package/dist/tooling/cli/adapter-command.js +66 -0
- package/dist/tooling/cli/arguments.d.ts +17 -6
- package/dist/tooling/cli/arguments.js +175 -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 +26 -0
- package/dist/tooling/cli/deploy-mode.js +59 -0
- package/dist/tooling/cli/deploy-result.d.ts +80 -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 +5 -5
- package/dist/tooling/cli/dotenv.js +6 -36
- package/dist/tooling/cli/help.js +173 -60
- 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 +12 -4
- package/dist/tooling/cli/index.js +6 -3
- package/dist/tooling/cli/installed-on.d.ts +83 -0
- package/dist/tooling/cli/installed-on.js +156 -0
- package/dist/tooling/cli/list.d.ts +152 -0
- package/dist/tooling/cli/list.js +331 -0
- package/dist/tooling/cli/log.d.ts +5 -2
- package/dist/tooling/cli/log.js +9 -2
- package/dist/tooling/cli/orchestrate.d.ts +0 -6
- package/dist/tooling/cli/orchestrate.js +246 -90
- package/dist/tooling/cli/project.d.ts +3 -3
- package/dist/tooling/cli/publish/index.d.ts +81 -0
- package/dist/tooling/cli/publish/index.js +383 -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 +121 -0
- package/dist/tooling/cli/registry/client.js +354 -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 +35 -0
- package/dist/tooling/cli/registry/executable.js +96 -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/adapters/typescript/imports.d.ts +0 -1
- package/dist/tooling/linter/adapters/typescript/imports.js +1 -5
- package/dist/tooling/linter/adapters/typescript/index.d.ts +1 -1
- package/dist/tooling/linter/adapters/typescript/index.js +1 -1
- package/dist/tooling/linter/adapters/typescript/syntax.d.ts +3 -3
- package/dist/tooling/linter/adapters/typescript/syntax.js +13 -25
- package/dist/tooling/linter/implementations/source/callable-requirements.d.ts +1 -2
- package/dist/tooling/linter/implementations/source/callable-requirements.js +11 -16
- package/dist/tooling/linter/implementations/source/dependencies.js +13 -72
- package/dist/tooling/linter/implementations/source/global.js +1 -2
- package/dist/tooling/linter/implementations/source/mutations.js +18 -29
- package/dist/tooling/linter/implementations/source/providers.js +5 -5
- package/dist/tooling/linter/implementations/source/queries.js +1 -17
- package/dist/tooling/linter/implementations/source/shared.d.ts +12 -4
- package/dist/tooling/linter/implementations/source/shared.js +101 -46
- package/dist/tooling/linter/implementations/source/verifiers.js +0 -2
- package/dist/tooling/linter/implementations/source/views.js +2 -2
- package/dist/tooling/linter/implementations/source/workflows.js +499 -17
- package/dist/tooling/linter/policy/generated.js +14 -63
- package/dist/tooling/linter/requirements/registry.js +6 -8
- 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/docs/admission-age.md +88 -0
- package/docs/auth-api-migration.md +55 -0
- package/docs/business-errors.md +42 -0
- package/docs/domain-definition-migration.md +44 -0
- package/docs/domain-schema-migration.md +36 -0
- package/docs/durable-workflows.md +445 -0
- package/docs/handler-dependencies.md +213 -0
- package/docs/release.md +155 -0
- package/docs/schema-cost.md +124 -0
- package/package.json +45 -16
- package/dist/application/application.d.ts +0 -28
- package/dist/application/query/execution/projection.d.ts +0 -3
- package/dist/application/query/execution/projection.js +0 -3
- package/dist/deployment/adapter/deploy/context.d.ts +0 -15
- 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/deploy.d.ts +0 -20
- package/dist/deployment/deploy.js +0 -31
- 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.d.ts +0 -10
- package/dist/deployment/release/publication/seal.js +0 -39
- package/dist/deployment/verify/preflight/artifact.d.ts +0 -6
- package/dist/deployment/verify/preflight/artifact.js +0 -122
- package/dist/deployment/verify/preflight/publication.d.ts +0 -4
- package/dist/deployment/verify/preflight/publication.js +0 -14
- package/dist/deployment/verify/readiness/deployment.d.ts +0 -3
- package/dist/deployment/verify/readiness/deployment.js +0 -151
- package/dist/deployment/verify/readiness/publication.d.ts +0 -11
- package/dist/deployment/verify/readiness/publication.js +0 -41
- package/dist/execution/service/errors.d.ts +0 -3
- package/dist/execution/service/errors.js +0 -3
- 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/deprecations.d.ts +0 -9
- package/dist/tooling/cli/deprecations.js +0 -15
- 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/tooling/linter/implementations/source/migrations.d.ts +0 -2
- package/dist/tooling/linter/implementations/source/migrations.js +0 -113
- package/dist/tooling/linter/qualification/index.d.ts +0 -10
- package/dist/tooling/linter/qualification/index.js +0 -2
- package/dist/tooling/linter/qualification/query-fixtures.d.ts +0 -2
- package/dist/tooling/linter/qualification/query-fixtures.js +0 -68
- package/dist/tooling/linter/qualification/runner.d.ts +0 -3
- package/dist/tooling/linter/qualification/runner.js +0 -6
- /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 → release/command.js} +0 -0
- /package/dist/deployment/adapter/{prepare → release}/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/execution/service/{publication → serving}/index.js +0 -0
|
@@ -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
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/** Own process signals for exactly one foreground development command. */
|
|
2
|
-
export class DevelopmentLifecycle {
|
|
3
|
-
#controller = new AbortController();
|
|
4
|
-
#stopped;
|
|
5
|
-
#resolveStopped;
|
|
6
|
-
#disposed = false;
|
|
7
|
-
constructor() {
|
|
8
|
-
let resolveStopped;
|
|
9
|
-
this.#stopped = new Promise((resolve) => {
|
|
10
|
-
resolveStopped = resolve;
|
|
11
|
-
});
|
|
12
|
-
this.#resolveStopped = resolveStopped;
|
|
13
|
-
// Keep handlers installed throughout cleanup. This covers direct Bun
|
|
14
|
-
// invocation and any duplicate signal forwarding by an older launcher:
|
|
15
|
-
// repeated interrupts remain idempotent stop requests instead of reverting
|
|
16
|
-
// to the runtime's immediate default termination.
|
|
17
|
-
process.on('SIGINT', this.#interrupt);
|
|
18
|
-
process.on('SIGTERM', this.#interrupt);
|
|
19
|
-
// The terminal's session leader can exit before asynchronous cleanup finishes.
|
|
20
|
-
// Its hangup must request the same stop, not terminate the remaining View owner.
|
|
21
|
-
process.on('SIGHUP', this.#interrupt);
|
|
22
|
-
}
|
|
23
|
-
get signal() {
|
|
24
|
-
return this.#controller.signal;
|
|
25
|
-
}
|
|
26
|
-
get stopped() {
|
|
27
|
-
return this.#stopped;
|
|
28
|
-
}
|
|
29
|
-
stop(reason = new Error('Development interrupted.')) {
|
|
30
|
-
if (!this.#controller.signal.aborted)
|
|
31
|
-
this.#controller.abort(reason);
|
|
32
|
-
this.#resolveStopped();
|
|
33
|
-
}
|
|
34
|
-
dispose() {
|
|
35
|
-
if (this.#disposed)
|
|
36
|
-
return;
|
|
37
|
-
this.#disposed = true;
|
|
38
|
-
process.off('SIGINT', this.#interrupt);
|
|
39
|
-
process.off('SIGTERM', this.#interrupt);
|
|
40
|
-
process.off('SIGHUP', this.#interrupt);
|
|
41
|
-
}
|
|
42
|
-
#interrupt = () => this.stop();
|
|
43
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
interface ProjectImportResolver {
|
|
2
|
-
resolveSync(specifier: string, importer: string): string;
|
|
3
|
-
}
|
|
4
|
-
interface ProjectImportResolution {
|
|
5
|
-
readonly path: string;
|
|
6
|
-
readonly external?: boolean;
|
|
7
|
-
}
|
|
8
|
-
interface ProjectImportBuilder {
|
|
9
|
-
onResolve(options: {
|
|
10
|
-
readonly filter: RegExp;
|
|
11
|
-
}, resolve: (input: {
|
|
12
|
-
readonly path: string;
|
|
13
|
-
readonly importer: string;
|
|
14
|
-
}) => ProjectImportResolution | undefined): void;
|
|
15
|
-
}
|
|
16
|
-
export interface ProjectImportPlugin {
|
|
17
|
-
readonly name: string;
|
|
18
|
-
setup(builder: ProjectImportBuilder): void;
|
|
19
|
-
}
|
|
20
|
-
/** Bundle project-local bare imports while leaving actual dependencies external. */
|
|
21
|
-
export declare function projectImportPlugin(projectDir: string, resolver: ProjectImportResolver): ProjectImportPlugin;
|
|
22
|
-
export {};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { realpathSync } from 'node:fs';
|
|
2
|
-
import { isAbsolute, relative, resolve, sep } from 'node:path';
|
|
3
|
-
/** Bundle project-local bare imports while leaving actual dependencies external. */
|
|
4
|
-
export function projectImportPlugin(projectDir, resolver) {
|
|
5
|
-
return Object.freeze({
|
|
6
|
-
name: 'astrale-project-imports',
|
|
7
|
-
setup(builder) {
|
|
8
|
-
builder.onResolve({ filter: /^[^./]/u }, (input) => {
|
|
9
|
-
let path;
|
|
10
|
-
try {
|
|
11
|
-
path = resolver.resolveSync(input.path, input.importer);
|
|
12
|
-
}
|
|
13
|
-
catch {
|
|
14
|
-
return Object.freeze({ path: input.path, external: true });
|
|
15
|
-
}
|
|
16
|
-
return projectLocal(projectDir, path)
|
|
17
|
-
? Object.freeze({ path })
|
|
18
|
-
: Object.freeze({ path: input.path, external: true });
|
|
19
|
-
});
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
function projectLocal(projectDir, path) {
|
|
24
|
-
if (!isAbsolute(path))
|
|
25
|
-
return false;
|
|
26
|
-
const local = relative(canonical(projectDir), canonical(path));
|
|
27
|
-
return (local !== '..' &&
|
|
28
|
-
!local.startsWith(`..${sep}`) &&
|
|
29
|
-
!isAbsolute(local) &&
|
|
30
|
-
!local.split(sep).includes('node_modules'));
|
|
31
|
-
}
|
|
32
|
-
function canonical(path) {
|
|
33
|
-
try {
|
|
34
|
-
return realpathSync.native(path);
|
|
35
|
-
}
|
|
36
|
-
catch {
|
|
37
|
-
return resolve(path);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { DevelopmentLease } from './lease.js';
|
|
2
|
-
export declare class ProjectLockError extends Error {
|
|
3
|
-
readonly code: 'INVALID_ENVIRONMENT' | 'PROJECT_ENVIRONMENT_LOCKED';
|
|
4
|
-
readonly name = "ProjectLockError";
|
|
5
|
-
constructor(code: 'INVALID_ENVIRONMENT' | 'PROJECT_ENVIRONMENT_LOCKED', message: string, options?: ErrorOptions);
|
|
6
|
-
}
|
|
7
|
-
export interface ProjectLock extends DevelopmentLease {
|
|
8
|
-
}
|
|
9
|
-
/** Exclude concurrent writers of one checkout's generated Environment state. */
|
|
10
|
-
export declare function acquireProjectLock(input: {
|
|
11
|
-
readonly projectRoot: string;
|
|
12
|
-
readonly environment: string;
|
|
13
|
-
readonly pid?: number;
|
|
14
|
-
readonly sessionId?: string;
|
|
15
|
-
readonly processAlive?: (pid: number) => boolean;
|
|
16
|
-
}): Promise<ProjectLock>;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { realpath } from 'node:fs/promises';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import { acquireDevelopmentLease, DevelopmentLeaseError } from './lease.js';
|
|
4
|
-
export class ProjectLockError extends Error {
|
|
5
|
-
code;
|
|
6
|
-
name = 'ProjectLockError';
|
|
7
|
-
constructor(code, message, options) {
|
|
8
|
-
super(message, options);
|
|
9
|
-
this.code = code;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
/** Exclude concurrent writers of one checkout's generated Environment state. */
|
|
13
|
-
export async function acquireProjectLock(input) {
|
|
14
|
-
const root = await realpath(input.projectRoot);
|
|
15
|
-
const environment = admitEnvironment(input.environment);
|
|
16
|
-
const coordinate = `${root}#${environment}`;
|
|
17
|
-
try {
|
|
18
|
-
return await acquireDevelopmentLease({
|
|
19
|
-
directory: join(root, '.astrale', 'development', environment),
|
|
20
|
-
coordinate,
|
|
21
|
-
...(input.pid === undefined ? {} : { pid: input.pid }),
|
|
22
|
-
...(input.sessionId === undefined ? {} : { sessionId: input.sessionId }),
|
|
23
|
-
...(input.processAlive === undefined ? {} : { processAlive: input.processAlive }),
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
catch (cause) {
|
|
27
|
-
if (cause instanceof DevelopmentLeaseError) {
|
|
28
|
-
throw new ProjectLockError('PROJECT_ENVIRONMENT_LOCKED', cause.message, { cause });
|
|
29
|
-
}
|
|
30
|
-
throw cause;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
function admitEnvironment(input) {
|
|
34
|
-
if (typeof input !== 'string' ||
|
|
35
|
-
input === '.' ||
|
|
36
|
-
input === '..' ||
|
|
37
|
-
!/^[A-Za-z0-9][A-Za-z0-9._-]*$/u.test(input)) {
|
|
38
|
-
throw new ProjectLockError('INVALID_ENVIRONMENT', 'Development environment must be one non-traversing path segment.');
|
|
39
|
-
}
|
|
40
|
-
return input;
|
|
41
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export interface RebuildOperations<Input, Candidate> {
|
|
2
|
-
prepare(input: Input, signal: AbortSignal): Promise<Candidate>;
|
|
3
|
-
commit(candidate: Candidate, signal: AbortSignal): Promise<void>;
|
|
4
|
-
failed(cause: unknown): void | Promise<void>;
|
|
5
|
-
}
|
|
6
|
-
/** Serialize rebuilds while retaining only the newest pending invalidation. */
|
|
7
|
-
export declare class LatestRebuild<Input, Candidate> {
|
|
8
|
-
#private;
|
|
9
|
-
constructor(operations: RebuildOperations<Input, Candidate>);
|
|
10
|
-
invalidate(input: Input): void;
|
|
11
|
-
idle(): Promise<void>;
|
|
12
|
-
stop(reason?: unknown): Promise<void>;
|
|
13
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/** Serialize rebuilds while retaining only the newest pending invalidation. */
|
|
2
|
-
export class LatestRebuild {
|
|
3
|
-
#operations;
|
|
4
|
-
#generation = 0;
|
|
5
|
-
#pending;
|
|
6
|
-
#running;
|
|
7
|
-
#current;
|
|
8
|
-
#stopped = false;
|
|
9
|
-
constructor(operations) {
|
|
10
|
-
this.#operations = operations;
|
|
11
|
-
}
|
|
12
|
-
invalidate(input) {
|
|
13
|
-
if (this.#stopped)
|
|
14
|
-
return;
|
|
15
|
-
this.#pending = { generation: ++this.#generation, input };
|
|
16
|
-
this.#running ??= this.#drain();
|
|
17
|
-
}
|
|
18
|
-
async idle() {
|
|
19
|
-
await this.#running;
|
|
20
|
-
}
|
|
21
|
-
async stop(reason = new Error('Development rebuild stopped.')) {
|
|
22
|
-
if (this.#stopped)
|
|
23
|
-
return this.idle();
|
|
24
|
-
this.#stopped = true;
|
|
25
|
-
this.#pending = undefined;
|
|
26
|
-
this.#current?.abort(reason);
|
|
27
|
-
await this.idle();
|
|
28
|
-
}
|
|
29
|
-
async #drain() {
|
|
30
|
-
try {
|
|
31
|
-
while (!this.#stopped && this.#pending !== undefined) {
|
|
32
|
-
const work = this.#pending;
|
|
33
|
-
this.#pending = undefined;
|
|
34
|
-
const controller = new AbortController();
|
|
35
|
-
this.#current = controller;
|
|
36
|
-
try {
|
|
37
|
-
const candidate = await this.#operations.prepare(work.input, controller.signal);
|
|
38
|
-
if (this.#stopped || work.generation !== this.#generation)
|
|
39
|
-
continue;
|
|
40
|
-
await this.#operations.commit(candidate, controller.signal);
|
|
41
|
-
}
|
|
42
|
-
catch (cause) {
|
|
43
|
-
if (!controller.signal.aborted)
|
|
44
|
-
await this.#operations.failed(cause);
|
|
45
|
-
}
|
|
46
|
-
finally {
|
|
47
|
-
if (this.#current === controller)
|
|
48
|
-
this.#current = undefined;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
finally {
|
|
53
|
-
this.#running = undefined;
|
|
54
|
-
if (!this.#stopped && this.#pending !== undefined)
|
|
55
|
-
this.#running = this.#drain();
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { InstallationEvidence } from '../installation/index.js';
|
|
2
|
-
import type { DevelopmentSessionReleaseEvidenceV1 } from './session-file.js';
|
|
3
|
-
/** Project installed evidence projected into the stable development-session representation. */
|
|
4
|
-
export declare function developmentReleaseEvidence(installation: InstallationEvidence): DevelopmentSessionReleaseEvidenceV1;
|