@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,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { issuer } from '../../../platform/auth/index.js';
|
|
2
2
|
import { bindSession } from '../../../platform/client/session/index.js';
|
|
3
3
|
import { NodeId } from '../../../platform/graph/node/index.js';
|
|
4
4
|
import { protocolError } from '../result/index.js';
|
|
@@ -9,7 +9,7 @@ const ANONYMOUS = Object.freeze({
|
|
|
9
9
|
graph: null,
|
|
10
10
|
close() { },
|
|
11
11
|
});
|
|
12
|
-
export async function authentication(callable, request,
|
|
12
|
+
export async function authentication(callable, request, domain, authority) {
|
|
13
13
|
const credential = request.credential;
|
|
14
14
|
if (callable.auth === 'anonymous' && credential === undefined)
|
|
15
15
|
return ANONYMOUS;
|
|
@@ -21,7 +21,6 @@ export async function authentication(callable, request, release, domain, authori
|
|
|
21
21
|
const authenticated = await authority.authenticate({
|
|
22
22
|
credential,
|
|
23
23
|
via: requireVia(request),
|
|
24
|
-
publication: release.publication,
|
|
25
24
|
domain,
|
|
26
25
|
context: request.context,
|
|
27
26
|
});
|
|
@@ -40,7 +39,6 @@ export async function authentication(callable, request, release, domain, authori
|
|
|
40
39
|
const graph = Object.freeze({
|
|
41
40
|
caller: bindSession(graphInput.caller),
|
|
42
41
|
self: bindSession(graphInput.self),
|
|
43
|
-
union: bindSession(graphInput.union),
|
|
44
42
|
});
|
|
45
43
|
return Object.freeze({ caller, graph, close });
|
|
46
44
|
}
|
|
@@ -62,8 +60,7 @@ function admitGraph(input) {
|
|
|
62
60
|
Array.isArray(input) ||
|
|
63
61
|
!Object.hasOwn(input, 'caller') ||
|
|
64
62
|
!Object.hasOwn(input, 'self') ||
|
|
65
|
-
|
|
66
|
-
Reflect.ownKeys(input).some((key) => key !== 'caller' && key !== 'self' && key !== 'union')) {
|
|
63
|
+
Reflect.ownKeys(input).some((key) => key !== 'caller' && key !== 'self')) {
|
|
67
64
|
invalid();
|
|
68
65
|
}
|
|
69
66
|
return input;
|
|
@@ -79,29 +76,18 @@ function admitCaller(input) {
|
|
|
79
76
|
invalid();
|
|
80
77
|
if (!Object.hasOwn(input, 'kind') ||
|
|
81
78
|
!Object.hasOwn(input, 'principal') ||
|
|
82
|
-
!Object.hasOwn(input, '
|
|
79
|
+
!Object.hasOwn(input, 'identity') ||
|
|
83
80
|
!Object.hasOwn(input, 'authentication') ||
|
|
84
|
-
Reflect.ownKeys(input).some((key) => key !== 'kind' && key !== 'principal' && key !== '
|
|
81
|
+
Reflect.ownKeys(input).some((key) => key !== 'kind' && key !== 'principal' && key !== 'identity' && key !== 'authentication') ||
|
|
85
82
|
Reflect.get(input, 'kind') !== 'authenticated') {
|
|
86
83
|
invalid();
|
|
87
84
|
}
|
|
88
|
-
|
|
89
|
-
const authority = grant.accept(Reflect.get(input, 'authority'));
|
|
90
|
-
const authentication = admitEvidence(Reflect.get(input, 'authentication'));
|
|
91
|
-
const caller = {
|
|
85
|
+
return Object.freeze({
|
|
92
86
|
kind: 'authenticated',
|
|
93
|
-
get identity
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
return authority.expr.id;
|
|
98
|
-
},
|
|
99
|
-
principal,
|
|
100
|
-
authority,
|
|
101
|
-
authentication,
|
|
102
|
-
};
|
|
103
|
-
Object.defineProperty(caller, 'identity', { enumerable: false });
|
|
104
|
-
return Object.freeze(caller);
|
|
87
|
+
identity: NodeId(Reflect.get(input, 'identity')),
|
|
88
|
+
principal: NodeId(Reflect.get(input, 'principal')),
|
|
89
|
+
authentication: admitEvidence(Reflect.get(input, 'authentication')),
|
|
90
|
+
});
|
|
105
91
|
}
|
|
106
92
|
function admitEvidence(input) {
|
|
107
93
|
if (input === null || typeof input !== 'object' || Array.isArray(input))
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type * as invocation from '@astrale-os/kernel-protocol/invocation';
|
|
2
|
-
import type * as publication from '@astrale-os/kernel-protocol/publication';
|
|
3
2
|
import type { HandlerRequest, InvocationContext } from '@astrale-os/kernel-server';
|
|
4
3
|
import type { AuthenticatedCaller } from '../../../application/action/index.js';
|
|
5
4
|
import type { BoundClientSession } from '../../../platform/client/session/index.js';
|
|
@@ -7,28 +6,36 @@ import type { Domain } from '../../../platform/schema/index.js';
|
|
|
7
6
|
export interface InvocationAdmissionInput {
|
|
8
7
|
readonly call: invocation.Call;
|
|
9
8
|
readonly credential?: string;
|
|
10
|
-
readonly via: invocation.Via;
|
|
11
|
-
readonly publication: publication.Publication;
|
|
9
|
+
readonly via: invocation.Via | invocation.PublicationVia;
|
|
12
10
|
readonly domain: Domain;
|
|
13
11
|
readonly context: InvocationContext;
|
|
14
12
|
}
|
|
15
13
|
export interface InvocationAuthenticationInput {
|
|
16
14
|
readonly credential: string;
|
|
17
|
-
readonly via: invocation.Via;
|
|
18
|
-
readonly publication: publication.Publication;
|
|
15
|
+
readonly via: invocation.Via | invocation.PublicationVia;
|
|
19
16
|
readonly domain: Domain;
|
|
20
17
|
readonly context: InvocationContext;
|
|
21
18
|
}
|
|
22
19
|
/** Authenticated capabilities before the SDK admits and derives application caller context. */
|
|
23
20
|
export interface AuthenticatedInvocation {
|
|
24
|
-
readonly caller:
|
|
25
|
-
readonly graph: Readonly<Record<'caller' | 'self'
|
|
21
|
+
readonly caller: AuthenticatedCaller;
|
|
22
|
+
readonly graph: Readonly<Record<'caller' | 'self', BoundClientSession>>;
|
|
26
23
|
close(): void;
|
|
27
24
|
}
|
|
28
25
|
export interface InvocationAuthority {
|
|
26
|
+
/**
|
|
27
|
+
* The source Kernel's `Function.admit` of a remote call: resolves to the admitted target, or
|
|
28
|
+
* rejects with the public refusal. A refusal whose reason is `FUNCTION_MISS` (the Kernel no longer
|
|
29
|
+
* places the call on this deployment) is answered as the reserved miss, never as an error.
|
|
30
|
+
*/
|
|
29
31
|
admit(input: InvocationAdmissionInput): Promise<unknown>;
|
|
30
32
|
authenticate(input: InvocationAuthenticationInput): Promise<AuthenticatedInvocation>;
|
|
31
33
|
}
|
|
32
34
|
/** Capture the execution Identity capability and receiver-bind both privileged operations. */
|
|
33
35
|
export declare function authority(input: InvocationAuthority): InvocationAuthority;
|
|
34
|
-
|
|
36
|
+
/**
|
|
37
|
+
* The routed witness of a remote call, already admitted by the Kernel Server against the served
|
|
38
|
+
* snapshot: the exact `ReleaseRef` of an immutable deployment, or the `PublicationRef` of a v3 pin
|
|
39
|
+
* (a release's exact projection, or a stable target's Publication).
|
|
40
|
+
*/
|
|
41
|
+
export declare function requireVia(request: HandlerRequest): invocation.Via | invocation.PublicationVia;
|
|
@@ -12,6 +12,11 @@ export function authority(input) {
|
|
|
12
12
|
authenticate: receiver.authenticate.bind(receiver),
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* The routed witness of a remote call, already admitted by the Kernel Server against the served
|
|
17
|
+
* snapshot: the exact `ReleaseRef` of an immutable deployment, or the `PublicationRef` of a v3 pin
|
|
18
|
+
* (a release's exact projection, or a stable target's Publication).
|
|
19
|
+
*/
|
|
15
20
|
export function requireVia(request) {
|
|
16
21
|
if (request.via === undefined) {
|
|
17
22
|
throw protocolError('VALIDATION_ERROR', 'Remote invocation requires Via.');
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { ResolvedCallable } from '../../../application/action/index.js';
|
|
2
|
-
export declare function input(callable: ResolvedCallable, value: unknown): void;
|
|
1
|
+
import type { ResolvedCallable, ActionBinaryInput } from '../../../application/action/index.js';
|
|
2
|
+
export declare function input(callable: ResolvedCallable, value: unknown, binary?: ActionBinaryInput): void;
|
|
@@ -1,4 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { isBinaryInput } from '@astrale-os/kernel-dsl/v1/language';
|
|
2
|
+
import { validateInput, protocolError } from '../result/index.js';
|
|
3
|
+
export function input(callable, value, binary) {
|
|
4
|
+
if (isBinaryInput(callable.input)) {
|
|
5
|
+
if (binary === undefined) {
|
|
6
|
+
throw protocolError('VALIDATION_ERROR', 'Binary Function request body is required.');
|
|
7
|
+
}
|
|
8
|
+
if (!Number.isSafeInteger(binary.length) ||
|
|
9
|
+
binary.length < 0 ||
|
|
10
|
+
binary.length > callable.input.maximumBytes) {
|
|
11
|
+
throw protocolError('LIMIT_EXCEEDED', 'Binary Function request body exceeds its limit.');
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
else if (binary !== undefined) {
|
|
15
|
+
throw protocolError('VALIDATION_ERROR', 'Callable does not accept a binary request body.');
|
|
16
|
+
}
|
|
3
17
|
validateInput(callable, value);
|
|
4
18
|
}
|
|
@@ -2,4 +2,4 @@ import type { HandlerDependencies } from '../../../application/dependency/index.
|
|
|
2
2
|
import type { BoundClientSession } from '../../../platform/client/session/index.js';
|
|
3
3
|
import type { Domain } from '../../../platform/schema/index.js';
|
|
4
4
|
/** Bind each explicit authority to its admitted session; metadata remains inert. */
|
|
5
|
-
export declare function bindDependencies<D extends Domain>(domain: D, sessions: Readonly<Record<'caller' | 'self'
|
|
5
|
+
export declare function bindDependencies<D extends Domain>(domain: D, sessions: Readonly<Record<'caller' | 'self', BoundClientSession>>): HandlerDependencies<D>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Key } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
2
|
+
import { isBinaryInput } from '@astrale-os/kernel-dsl/v1/language';
|
|
2
3
|
import { reference } from '../../../platform/client/session/index.js';
|
|
3
4
|
import { NodeId } from '../../../platform/graph/node/index.js';
|
|
4
5
|
import { Path } from '../../../platform/graph/path/index.js';
|
|
@@ -11,7 +12,6 @@ export function bindDependencies(domain, sessions) {
|
|
|
11
12
|
dependencies[alias] = Object.freeze({
|
|
12
13
|
caller: bindDependency(dependency, sessions.caller),
|
|
13
14
|
self: bindDependency(dependency, sessions.self),
|
|
14
|
-
union: bindDependency(dependency, sessions.union),
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
return Object.freeze(dependencies);
|
|
@@ -20,19 +20,14 @@ function bindDependency(dependency, session) {
|
|
|
20
20
|
const invoke = session.invoke.bind(session);
|
|
21
21
|
return Object.freeze({
|
|
22
22
|
async invoke(select, ...args) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const callable = dependency.callable(selected.key);
|
|
32
|
-
if (callable !== selected || Key.origin(callable.key) !== dependency.origin)
|
|
33
|
-
invalid();
|
|
34
|
-
if ('owner' in callable && (!callable.executable || !ownMethod(dependency, callable)))
|
|
35
|
-
invalid();
|
|
23
|
+
const callable = selectedCallable(dependency, select);
|
|
24
|
+
if (isBinaryInput(callable.input)) {
|
|
25
|
+
if ('owner' in callable || args.length !== 2)
|
|
26
|
+
invalid();
|
|
27
|
+
// Runtime selection is wider than the authored Function; mode was checked above.
|
|
28
|
+
const binaryReference = reference(dependency, callable);
|
|
29
|
+
return invoke(binaryReference, args[0], binaryOptions(args[1]));
|
|
30
|
+
}
|
|
36
31
|
if ('owner' in callable && !callable.static) {
|
|
37
32
|
if (args.length < 2 || args.length > 3 || typeof args[0] !== 'string')
|
|
38
33
|
invalid();
|
|
@@ -45,6 +40,22 @@ function bindDependency(dependency, session) {
|
|
|
45
40
|
},
|
|
46
41
|
});
|
|
47
42
|
}
|
|
43
|
+
function selectedCallable(domain, select) {
|
|
44
|
+
if (typeof select !== 'function')
|
|
45
|
+
invalid();
|
|
46
|
+
const selected = select(domain);
|
|
47
|
+
if (selected === null ||
|
|
48
|
+
typeof selected !== 'object' ||
|
|
49
|
+
!('key' in selected) ||
|
|
50
|
+
typeof selected.key !== 'string')
|
|
51
|
+
invalid();
|
|
52
|
+
const callable = domain.callable(selected.key);
|
|
53
|
+
if (callable !== selected || Key.origin(callable.key) !== domain.origin)
|
|
54
|
+
invalid();
|
|
55
|
+
if ('owner' in callable && (!callable.executable || !ownMethod(domain, callable)))
|
|
56
|
+
invalid();
|
|
57
|
+
return callable;
|
|
58
|
+
}
|
|
48
59
|
function ownMethod(domain, callable) {
|
|
49
60
|
const owner = Object.values(domain.classes).find((value) => value === callable.owner);
|
|
50
61
|
if (owner === undefined)
|
|
@@ -63,6 +74,16 @@ function options(value) {
|
|
|
63
74
|
// Canonical ClientSession admits option values and clamps them to the parent lifetime.
|
|
64
75
|
return value;
|
|
65
76
|
}
|
|
77
|
+
function binaryOptions(value) {
|
|
78
|
+
if (value === null ||
|
|
79
|
+
typeof value !== 'object' ||
|
|
80
|
+
Array.isArray(value) ||
|
|
81
|
+
!Object.hasOwn(value, 'body') ||
|
|
82
|
+
!(value.body instanceof Blob) ||
|
|
83
|
+
Reflect.ownKeys(value).some((key) => key !== 'body' && key !== 'timeoutMs'))
|
|
84
|
+
invalid();
|
|
85
|
+
return value;
|
|
86
|
+
}
|
|
66
87
|
function invalid() {
|
|
67
88
|
throw new TypeError('Dependency invocation requires one owned executable callable, its input, and valid instance/options.');
|
|
68
89
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HandlerRequest } from '@astrale-os/kernel-server';
|
|
2
|
-
import type { ActionExecution, Caller, DomainGraphExecutors, DomainKernelSessions } from '../../../application/action/index.js';
|
|
2
|
+
import type { ActionExecution, ActionBinaryInput, Caller, DomainGraphExecutors, DomainKernelSessions } from '../../../application/action/index.js';
|
|
3
3
|
import type { HandlerDependencies } from '../../../application/dependency/index.js';
|
|
4
4
|
import type { MutationExecutor } from '../../../application/mutation/index.js';
|
|
5
5
|
import type { QueryExecutor } from '../../../application/query/index.js';
|
|
@@ -10,6 +10,7 @@ import type { InvocationAuthentication } from '../admission/index.js';
|
|
|
10
10
|
export interface DispatchContext {
|
|
11
11
|
readonly domain: Domain;
|
|
12
12
|
readonly input: unknown;
|
|
13
|
+
readonly body?: ActionBinaryInput;
|
|
13
14
|
readonly caller: Caller;
|
|
14
15
|
readonly dependencies: HandlerDependencies<Domain> | null;
|
|
15
16
|
readonly kernel: DomainKernelSessions | null;
|
|
@@ -17,6 +17,7 @@ export function context(request, runtime, authentication, self) {
|
|
|
17
17
|
return Object.freeze({
|
|
18
18
|
domain: runtime.loaded.domain,
|
|
19
19
|
input: request.call.input,
|
|
20
|
+
...(request.context.binary === undefined ? {} : { body: request.context.binary }),
|
|
20
21
|
caller: authentication.caller,
|
|
21
22
|
kernel: authentication.graph === null
|
|
22
23
|
? null
|
|
@@ -59,6 +60,5 @@ function bindGraph(clients, domain) {
|
|
|
59
60
|
...self,
|
|
60
61
|
caller: bind(clients.caller),
|
|
61
62
|
self,
|
|
62
|
-
union: bind(clients.union),
|
|
63
63
|
});
|
|
64
64
|
}
|
|
@@ -1,36 +1,42 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as errors from '@astrale-os/kernel-protocol/errors';
|
|
2
|
+
import * as release from '@astrale-os/kernel-protocol/release';
|
|
2
3
|
import { authentication, input, requireVia, target } from './admission/index.js';
|
|
3
4
|
import { action, context, select, workflow } from './dispatch/index.js';
|
|
4
5
|
import { active, settle } from './lifecycle/index.js';
|
|
5
6
|
import { project, protocolError } from './result/index.js';
|
|
7
|
+
/** The reserved answer of a deployment that does not serve the call: its caller re-routes. */
|
|
8
|
+
const MISS = Object.freeze({ kind: 'miss' });
|
|
9
|
+
const FUNCTION_MISS = 'FUNCTION_MISS';
|
|
6
10
|
export async function invoke(request, inputConfig) {
|
|
7
11
|
active(request.context);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (snapshot === undefined ||
|
|
11
|
-
!publication.matchesReference(snapshot.publication, publication.reference(release.publication))) {
|
|
12
|
-
throw protocolError('CONFLICT', 'Invocation Publication differs from the running Release.');
|
|
12
|
+
if (!pinsRunningRelease(request, inputConfig.runtime.loaded.release)) {
|
|
13
|
+
throw protocolError('CONFLICT', 'Invocation release differs from the running Release.');
|
|
13
14
|
}
|
|
14
15
|
if (request.credential !== undefined && typeof request.credential !== 'string') {
|
|
15
16
|
throw protocolError('AUTH_INVALID', 'Credential is invalid.');
|
|
16
17
|
}
|
|
17
|
-
const
|
|
18
|
-
const selectedTarget = target(await inputConfig.authority.admit({
|
|
18
|
+
const admitted = await admit(inputConfig.authority, {
|
|
19
19
|
call: request.call,
|
|
20
20
|
...(request.credential === undefined ? {} : { credential: request.credential }),
|
|
21
|
-
via,
|
|
22
|
-
publication: release.publication,
|
|
21
|
+
via: requireVia(request),
|
|
23
22
|
domain: inputConfig.runtime.loaded.domain,
|
|
24
23
|
context: request.context,
|
|
25
|
-
})
|
|
26
|
-
|
|
24
|
+
});
|
|
25
|
+
if (admitted === undefined)
|
|
26
|
+
return MISS;
|
|
27
|
+
const selected = select(inputConfig.runtime.loaded.registry, admitted);
|
|
27
28
|
if (selected === undefined)
|
|
28
|
-
return
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
return MISS;
|
|
30
|
+
if (selected.implementation.kind === 'workflow' && selected.implementation.durable) {
|
|
31
|
+
// The Kernel records a durable call as an Execution and runs it on the engine; running it
|
|
32
|
+
// inline here would silently drop durability.
|
|
33
|
+
throw protocolError('UNSUPPORTED', 'A durable Workflow runs only as a Kernel Execution.');
|
|
34
|
+
}
|
|
35
|
+
input(selected.implementation.callable, request.call.input, request.context.binary);
|
|
36
|
+
const admittedAuthentication = await authentication(selected.implementation.callable, request, inputConfig.runtime.loaded.domain, inputConfig.authority);
|
|
31
37
|
const close = once(admittedAuthentication.close);
|
|
32
|
-
active(request.context);
|
|
33
38
|
try {
|
|
39
|
+
active(request.context);
|
|
34
40
|
const dispatchContext = context(request, inputConfig.runtime, admittedAuthentication, selected.self);
|
|
35
41
|
const output = selected.implementation.kind === 'action'
|
|
36
42
|
? await action(selected.implementation, dispatchContext)
|
|
@@ -42,6 +48,42 @@ export async function invoke(request, inputConfig) {
|
|
|
42
48
|
throw cause;
|
|
43
49
|
}
|
|
44
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* The source Kernel's `Function.admit` refuses `FUNCTION_MISS` when it no longer places the call on
|
|
53
|
+
* this deployment, as for a client whose learned route still names a deployment replaced by a
|
|
54
|
+
* consented install. That refusal is answered as the reserved miss, never as a public error, so
|
|
55
|
+
* the client re-routes through its source Kernel (AM-85). Every other refusal is unchanged.
|
|
56
|
+
*/
|
|
57
|
+
async function admit(authority, admission) {
|
|
58
|
+
let admitted;
|
|
59
|
+
try {
|
|
60
|
+
admitted = await authority.admit(admission);
|
|
61
|
+
}
|
|
62
|
+
catch (cause) {
|
|
63
|
+
if (refusedAsMiss(cause))
|
|
64
|
+
return undefined;
|
|
65
|
+
throw cause;
|
|
66
|
+
}
|
|
67
|
+
return target(admitted);
|
|
68
|
+
}
|
|
69
|
+
function refusedAsMiss(cause) {
|
|
70
|
+
return (cause instanceof errors.ProtocolError &&
|
|
71
|
+
errors.reasonOf(cause.payload.data)?.code === FUNCTION_MISS);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The Kernel Server pins every request to the one snapshot it serves: the release of an immutable
|
|
75
|
+
* deployment, or a stable target's Publication. Execution answers only for that exact document.
|
|
76
|
+
*/
|
|
77
|
+
function pinsRunningRelease(request, running) {
|
|
78
|
+
if (running.kind === 'release') {
|
|
79
|
+
return (request.publication === undefined &&
|
|
80
|
+
request.release !== undefined &&
|
|
81
|
+
release.matchesReference(request.release.release, release.reference(running.document)));
|
|
82
|
+
}
|
|
83
|
+
return (request.release === undefined &&
|
|
84
|
+
request.publication !== undefined &&
|
|
85
|
+
release.legacy.matchesReference(request.publication.publication, release.legacy.reference(running.publication)));
|
|
86
|
+
}
|
|
45
87
|
function once(operation) {
|
|
46
88
|
let called = false;
|
|
47
89
|
return () => {
|
|
@@ -2,6 +2,10 @@ import { InvocationDefect } from './errors.js';
|
|
|
2
2
|
import { validateOutput } from './validate.js';
|
|
3
3
|
const MEDIA_TYPE = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/u;
|
|
4
4
|
const HEADER_NAME = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/u;
|
|
5
|
+
const BUFFERED_FIELDS = new Set(['body', 'mediaType', 'status', 'headers']);
|
|
6
|
+
const STREAMING_FIELDS = new Set([...BUFFERED_FIELDS, 'length', 'delivery']);
|
|
7
|
+
/** Largest delay a host timer accepts; the Server rejects a longer delivery budget. */
|
|
8
|
+
const MAXIMUM_TIMER_MS = 2_147_483_647;
|
|
5
9
|
export function project(callable, output) {
|
|
6
10
|
switch (callable.output.mode) {
|
|
7
11
|
case 'value':
|
|
@@ -72,7 +76,8 @@ function binary(input) {
|
|
|
72
76
|
if (input === null || typeof input !== 'object' || Array.isArray(input))
|
|
73
77
|
invalidBinary();
|
|
74
78
|
const value = input;
|
|
75
|
-
|
|
79
|
+
const fields = isBytes(value.body) ? BUFFERED_FIELDS : STREAMING_FIELDS;
|
|
80
|
+
if (Reflect.ownKeys(input).some((key) => typeof key !== 'string' || !fields.has(key)) ||
|
|
76
81
|
(!isBytes(value.body) && !isAsyncBytes(value.body)) ||
|
|
77
82
|
typeof value.mediaType !== 'string' ||
|
|
78
83
|
!MEDIA_TYPE.test(value.mediaType) ||
|
|
@@ -89,13 +94,48 @@ function binary(input) {
|
|
|
89
94
|
...(headers === undefined ? {} : { headers }),
|
|
90
95
|
});
|
|
91
96
|
}
|
|
97
|
+
const length = streamingLength(value.length);
|
|
98
|
+
const delivery = deliveryBudget(value.delivery);
|
|
92
99
|
return Object.freeze({
|
|
93
100
|
body: new InvocationByteStream(value.body),
|
|
94
101
|
mediaType: value.mediaType,
|
|
102
|
+
// The declared length is the only count a Client verifies a streaming delivery against.
|
|
103
|
+
...(length === undefined ? {} : { length }),
|
|
104
|
+
...(delivery === undefined ? {} : { delivery }),
|
|
95
105
|
...(value.status === undefined ? {} : { status: value.status }),
|
|
96
106
|
...(headers === undefined ? {} : { headers }),
|
|
97
107
|
});
|
|
98
108
|
}
|
|
109
|
+
function streamingLength(input) {
|
|
110
|
+
if (input === undefined)
|
|
111
|
+
return undefined;
|
|
112
|
+
if (typeof input !== 'number' || !Number.isSafeInteger(input) || input < 0)
|
|
113
|
+
invalidBinary();
|
|
114
|
+
return input;
|
|
115
|
+
}
|
|
116
|
+
function deliveryBudget(input) {
|
|
117
|
+
if (input === undefined)
|
|
118
|
+
return undefined;
|
|
119
|
+
if (input === null || typeof input !== 'object' || Array.isArray(input))
|
|
120
|
+
invalidBinary();
|
|
121
|
+
const value = input;
|
|
122
|
+
if (Reflect.ownKeys(input).some((key) => key !== 'maximumDurationMs' && key !== 'idleTimeoutMs') ||
|
|
123
|
+
!isTimerDuration(value.maximumDurationMs) ||
|
|
124
|
+
!isTimerDuration(value.idleTimeoutMs) ||
|
|
125
|
+
value.idleTimeoutMs > value.maximumDurationMs) {
|
|
126
|
+
invalidBinary();
|
|
127
|
+
}
|
|
128
|
+
return Object.freeze({
|
|
129
|
+
maximumDurationMs: value.maximumDurationMs,
|
|
130
|
+
idleTimeoutMs: value.idleTimeoutMs,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
function isTimerDuration(input) {
|
|
134
|
+
return (typeof input === 'number' &&
|
|
135
|
+
Number.isSafeInteger(input) &&
|
|
136
|
+
input > 0 &&
|
|
137
|
+
input <= MAXIMUM_TIMER_MS);
|
|
138
|
+
}
|
|
99
139
|
class InvocationByteStream {
|
|
100
140
|
source;
|
|
101
141
|
consumed = false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ServedDomain } from '../serve.js';
|
|
2
2
|
import type { NodeListener } from './listener.js';
|
|
3
3
|
export interface NodeOptions<Environment> {
|
|
4
4
|
readonly environment: Environment;
|
|
@@ -6,4 +6,4 @@ export interface NodeOptions<Environment> {
|
|
|
6
6
|
readonly hostname?: string;
|
|
7
7
|
}
|
|
8
8
|
/** Listen on Node around one already composed provider-neutral served application. */
|
|
9
|
-
export declare function listen<Environment>(application:
|
|
9
|
+
export declare function listen<Environment>(application: ServedDomain<Environment>, options: NodeOptions<Environment>): Promise<NodeListener>;
|
|
@@ -7,7 +7,7 @@ export async function listen(application, options) {
|
|
|
7
7
|
typeof application.fetch !== 'function' ||
|
|
8
8
|
typeof application.drain !== 'function' ||
|
|
9
9
|
typeof application.close !== 'function') {
|
|
10
|
-
throw new TypeError('Node listener requires a served
|
|
10
|
+
throw new TypeError('Node listener requires a served Domain.');
|
|
11
11
|
}
|
|
12
12
|
const config = admit(options);
|
|
13
13
|
let server;
|
|
@@ -3,3 +3,4 @@ export { initialize, type InitializedRuntime } from './initialize.js';
|
|
|
3
3
|
export { integrations } from './integrations.js';
|
|
4
4
|
export { load, type LoadedRuntime } from './load.js';
|
|
5
5
|
export { providers } from './providers.js';
|
|
6
|
+
export { isServedRelease, serving, type ServedRelease, type Serving } from './release.js';
|
|
@@ -2,13 +2,13 @@ import type { Domain } from '@astrale-os/kernel-dsl/v1/domain';
|
|
|
2
2
|
import type { DomainSchema, DomainOf } from '@astrale-os/kernel-dsl/v1/schema';
|
|
3
3
|
import type { RuntimeRegistry } from '../../application/runtime/index.js';
|
|
4
4
|
import type { Build } from '../../deployment/build/build.js';
|
|
5
|
-
import type {
|
|
5
|
+
import type { ServedRelease } from './release.js';
|
|
6
6
|
type DomainOfBuild<BuildValue extends Build> = BuildValue extends Build<infer Schema extends DomainSchema, object> ? Extract<DomainOf<Schema>, Domain> : Domain;
|
|
7
7
|
export interface LoadedRuntime<BuildValue extends Build = Build> {
|
|
8
|
-
readonly release:
|
|
8
|
+
readonly release: ServedRelease<BuildValue>;
|
|
9
9
|
readonly domain: DomainOfBuild<BuildValue>;
|
|
10
10
|
readonly registry: RuntimeRegistry;
|
|
11
11
|
}
|
|
12
12
|
/** Load one execution Runtime from the exact evidence retained by its admitted Build. */
|
|
13
|
-
export declare function load<const BuildValue extends Build>(release:
|
|
13
|
+
export declare function load<const BuildValue extends Build>(release: ServedRelease<BuildValue>): LoadedRuntime<BuildValue>;
|
|
14
14
|
export {};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { evidenceOf } from '../../deployment/build/admission.js';
|
|
2
|
-
import { isRelease } from '../../deployment/release/admission.js';
|
|
3
2
|
import { capture } from './admission.js';
|
|
3
|
+
import { isServedRelease } from './release.js';
|
|
4
4
|
/** Load one execution Runtime from the exact evidence retained by its admitted Build. */
|
|
5
5
|
export function load(release) {
|
|
6
|
-
if (!
|
|
6
|
+
if (!isServedRelease(release)) {
|
|
7
7
|
throw new TypeError('Runtime loading requires an admitted Release.');
|
|
8
|
+
}
|
|
8
9
|
const evidence = evidenceOf(release.build);
|
|
9
10
|
const domain = evidence.domain;
|
|
10
11
|
const { registry } = evidence;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type * as release from '@astrale-os/kernel-protocol/release';
|
|
2
|
+
import type { Build } from '../../deployment/build/build.js';
|
|
3
|
+
import type * as legacy from '../../deployment/release/legacy/index.js';
|
|
4
|
+
import type { Release } from '../../deployment/release/release.js';
|
|
5
|
+
import type { IssuerId } from '../../platform/auth/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* What one Service serves: the `DomainRelease` v4 Release of an immutable deployment, or the
|
|
8
|
+
* deprecated v3 Release of a stable target (`legacy`, its consumers and removal in
|
|
9
|
+
* `deployment/release/legacy/index.ts`, D10).
|
|
10
|
+
*/
|
|
11
|
+
export type ServedRelease<BuildValue extends Build = Build> = Release<BuildValue> | legacy.Release<BuildValue>;
|
|
12
|
+
/** Where and as whom one served Release answers, and the document it serves. */
|
|
13
|
+
export interface Serving {
|
|
14
|
+
/** Domain identity issuer: a deployment's URL, or a stable target's configured issuer. */
|
|
15
|
+
readonly issuer: IssuerId;
|
|
16
|
+
/** Public origin the Server answers at: a deployment's URL, or a stable target's route. */
|
|
17
|
+
readonly publicUrl: IssuerId;
|
|
18
|
+
/** The document served at `release.json`, or a stable target's v3 Publication at `domain.json`. */
|
|
19
|
+
readonly document: release.DomainRelease | release.legacy.Publication;
|
|
20
|
+
}
|
|
21
|
+
export declare function isServedRelease(input: unknown): input is ServedRelease;
|
|
22
|
+
export declare function serving(served: ServedRelease): Serving;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { isRelease } from '../../deployment/release/admission.js';
|
|
2
|
+
import { isRelease as isLegacyRelease } from '../../deployment/release/legacy/admission.js';
|
|
3
|
+
export function isServedRelease(input) {
|
|
4
|
+
return isRelease(input) || isLegacyRelease(input);
|
|
5
|
+
}
|
|
6
|
+
export function serving(served) {
|
|
7
|
+
return served.kind === 'release'
|
|
8
|
+
? Object.freeze({ issuer: served.url, publicUrl: served.url, document: served.document })
|
|
9
|
+
: Object.freeze({
|
|
10
|
+
issuer: served.addressing.issuer,
|
|
11
|
+
publicUrl: served.addressing.publicUrl,
|
|
12
|
+
document: served.publication,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { ServerCloseOptions } from '@astrale-os/kernel-server';
|
|
2
|
-
import type {
|
|
2
|
+
import type { release } from '@astrale-os/kernel-server';
|
|
3
3
|
import type { Runtime } from '../application/runtime/index.js';
|
|
4
4
|
import type { WorkflowRunner } from '../application/workflow/runner/index.js';
|
|
5
5
|
import type { Identity } from './identity/index.js';
|
|
6
6
|
import type { ReleaseLoader } from './service/index.js';
|
|
7
7
|
import type { ServiceServerOptions } from './service/index.js';
|
|
8
|
+
import type { DurableServingProvider } from './workflows/index.js';
|
|
8
9
|
export interface ExecutionContext {
|
|
9
10
|
waitUntil(promise: Promise<unknown>): void;
|
|
10
11
|
readonly sleep?: (durationMs: number) => Promise<void>;
|
|
@@ -15,13 +16,18 @@ export interface ServeInput<Environment, RuntimeValue extends Runtime, RuntimeEn
|
|
|
15
16
|
identity(environment: Environment): Identity;
|
|
16
17
|
readonly initialize?: (environment: Environment) => RuntimeEnvironment;
|
|
17
18
|
readonly server: ServiceServerOptions;
|
|
18
|
-
readonly delivery?: (environment: Environment) =>
|
|
19
|
+
readonly delivery?: (environment: Environment) => release.delivery.Provider | undefined;
|
|
19
20
|
readonly workflows?: WorkflowRunner;
|
|
21
|
+
/**
|
|
22
|
+
* Serve durable Workflows to the workflow engine; required when the Release declares any.
|
|
23
|
+
* Undefined for an environment that names no engine: engine requests are then refused.
|
|
24
|
+
*/
|
|
25
|
+
readonly durable?: (environment: Environment, request: Request) => ReturnType<DurableServingProvider>;
|
|
20
26
|
}
|
|
21
|
-
export interface
|
|
27
|
+
export interface ServedDomain<Environment> {
|
|
22
28
|
fetch(request: Request, environment: Environment, context?: ExecutionContext): Promise<Response>;
|
|
23
29
|
drain(): void;
|
|
24
30
|
close(options: ServerCloseOptions): Promise<void>;
|
|
25
31
|
}
|
|
26
32
|
/** Create one provider-neutral Fetch entrypoint around a lazily initialized current Service. */
|
|
27
|
-
export declare function serve<Environment, RuntimeValue extends Runtime, RuntimeEnvironment = Environment>(input: ServeInput<Environment, RuntimeValue, RuntimeEnvironment>):
|
|
33
|
+
export declare function serve<Environment, RuntimeValue extends Runtime, RuntimeEnvironment = Environment>(input: ServeInput<Environment, RuntimeValue, RuntimeEnvironment>): ServedDomain<Environment>;
|
package/dist/execution/serve.js
CHANGED
|
@@ -22,6 +22,9 @@ export function serve(input) {
|
|
|
22
22
|
server: input.server,
|
|
23
23
|
...(input.delivery === undefined ? {} : { delivery: input.delivery(environment) }),
|
|
24
24
|
...(input.workflows === undefined ? {} : { workflows: input.workflows }),
|
|
25
|
+
...(input.durable === undefined
|
|
26
|
+
? {}
|
|
27
|
+
: { durable: (request) => input.durable(environment, request) }),
|
|
25
28
|
});
|
|
26
29
|
if (drained)
|
|
27
30
|
service.drain();
|