@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
|
@@ -2,16 +2,6 @@ import * as errors from '@astrale-os/kernel-protocol/errors';
|
|
|
2
2
|
import type { ResolvedCallable } from '../../../application/action/index.js';
|
|
3
3
|
import type { Key } from '../../../platform/schema/index.js';
|
|
4
4
|
import type { Value } from '../../../platform/value/index.js';
|
|
5
|
-
export type InvocationErrorCode = Extract<keyof typeof errors.CODES, 'VALIDATION_ERROR' | 'ACCESS_DENIED' | 'NOT_FOUND' | 'CONFLICT' | 'UNSUPPORTED' | 'LIMIT_EXCEEDED' | 'BACKEND_UNAVAILABLE'>;
|
|
6
|
-
/** @deprecated Declare expected failures on defineAction or defineWorkflow instead. */
|
|
7
|
-
export declare class InvocationError extends Error {
|
|
8
|
-
readonly code: InvocationErrorCode;
|
|
9
|
-
readonly name = "InvocationError";
|
|
10
|
-
readonly reason?: errors.ErrorReason;
|
|
11
|
-
constructor(code: InvocationErrorCode, message: string, options?: ErrorOptions & {
|
|
12
|
-
readonly reason?: errors.ErrorReason;
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
5
|
export type InvocationDefectCode = 'INVOCATION_TARGET_INVALID' | 'INVOCATION_HANDLER_INVALID' | 'INVOCATION_OUTPUT_INVALID' | 'INVOCATION_RESULT_CONTRACT_VIOLATION';
|
|
16
6
|
export declare class InvocationDefect extends Error {
|
|
17
7
|
readonly code: InvocationDefectCode;
|
|
@@ -5,20 +5,6 @@ const PUBLIC_ERROR_CODES = new Set(Object.values(errors.CODES));
|
|
|
5
5
|
const PUBLIC_ERROR_NAMES = new Map(Object.entries(errors.CODES).map(([name, code]) => [code, name]));
|
|
6
6
|
const MAXIMUM_DIAGNOSTICS = 32;
|
|
7
7
|
const admittedProtocolErrors = new WeakSet();
|
|
8
|
-
/** @deprecated Declare expected failures on defineAction or defineWorkflow instead. */
|
|
9
|
-
export class InvocationError extends Error {
|
|
10
|
-
code;
|
|
11
|
-
name = 'InvocationError';
|
|
12
|
-
reason;
|
|
13
|
-
constructor(code, message, options = {}) {
|
|
14
|
-
super(message, options);
|
|
15
|
-
this.code = code;
|
|
16
|
-
this.reason =
|
|
17
|
-
options.reason === undefined
|
|
18
|
-
? undefined
|
|
19
|
-
: errors.acceptReason(options.reason, 'InvocationError reason');
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
8
|
export class InvocationDefect extends Error {
|
|
23
9
|
code;
|
|
24
10
|
name = 'InvocationDefect';
|
|
@@ -62,9 +48,6 @@ export function projectError(input) {
|
|
|
62
48
|
? input
|
|
63
49
|
: protocolError('INTERNAL_ERROR', 'Internal application error.');
|
|
64
50
|
}
|
|
65
|
-
if (input instanceof InvocationError) {
|
|
66
|
-
return protocolError('INTERNAL_ERROR', 'Internal application error.');
|
|
67
|
-
}
|
|
68
51
|
if (input instanceof ResponseError) {
|
|
69
52
|
if (!PUBLIC_ERROR_CODES.has(input.code)) {
|
|
70
53
|
return protocolError('BACKEND_UNAVAILABLE', 'Dependency Kernel returned invalid error evidence.');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { inputError, InvocationDefect,
|
|
2
|
-
export type { InvocationDefectCode
|
|
1
|
+
export { inputError, InvocationDefect, projectError, protocolError } from './errors.js';
|
|
2
|
+
export type { InvocationDefectCode } from './errors.js';
|
|
3
3
|
export { project } from './project.js';
|
|
4
4
|
export { validateInput, validateOutput } from './validate.js';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { inputError, InvocationDefect,
|
|
1
|
+
export { inputError, InvocationDefect, projectError, protocolError } from './errors.js';
|
|
2
2
|
export { project } from './project.js';
|
|
3
3
|
export { validateInput, validateOutput } from './validate.js';
|
|
@@ -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,17 @@
|
|
|
1
|
+
import type * as release from '@astrale-os/kernel-protocol/release';
|
|
2
|
+
import type { Build } from '../../deployment/build/build.js';
|
|
3
|
+
import type { Release } from '../../deployment/release/release.js';
|
|
4
|
+
import type { IssuerId } from '../../platform/auth/index.js';
|
|
5
|
+
/** The DomainRelease v4 served by one immutable deployment. */
|
|
6
|
+
export type ServedRelease<BuildValue extends Build = Build> = Release<BuildValue>;
|
|
7
|
+
/** Where and as whom one served Release answers, and the document it serves. */
|
|
8
|
+
export interface Serving {
|
|
9
|
+
/** Domain identity issuer: this deployment's URL. */
|
|
10
|
+
readonly issuer: IssuerId;
|
|
11
|
+
/** Public origin the Server answers at: this deployment's URL. */
|
|
12
|
+
readonly publicUrl: IssuerId;
|
|
13
|
+
/** The document served at release.json. */
|
|
14
|
+
readonly document: release.DomainRelease;
|
|
15
|
+
}
|
|
16
|
+
export declare function isServedRelease(input: unknown): input is ServedRelease;
|
|
17
|
+
export declare function serving(served: ServedRelease): Serving;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { isRelease } from '../../deployment/release/admission.js';
|
|
2
|
+
export function isServedRelease(input) {
|
|
3
|
+
return isRelease(input);
|
|
4
|
+
}
|
|
5
|
+
export function serving(served) {
|
|
6
|
+
return Object.freeze({ issuer: served.url, publicUrl: served.url, document: served.document });
|
|
7
|
+
}
|
|
@@ -1,10 +1,12 @@
|
|
|
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
|
+
import type { DeploymentCache } from './cache/index.js';
|
|
5
6
|
import type { Identity } from './identity/index.js';
|
|
6
7
|
import type { ReleaseLoader } from './service/index.js';
|
|
7
8
|
import type { ServiceServerOptions } from './service/index.js';
|
|
9
|
+
import type { DurableServingProvider } from './workflows/index.js';
|
|
8
10
|
export interface ExecutionContext {
|
|
9
11
|
waitUntil(promise: Promise<unknown>): void;
|
|
10
12
|
readonly sleep?: (durationMs: number) => Promise<void>;
|
|
@@ -15,13 +17,25 @@ export interface ServeInput<Environment, RuntimeValue extends Runtime, RuntimeEn
|
|
|
15
17
|
identity(environment: Environment): Identity;
|
|
16
18
|
readonly initialize?: (environment: Environment) => RuntimeEnvironment;
|
|
17
19
|
readonly server: ServiceServerOptions;
|
|
18
|
-
readonly delivery?: (environment: Environment) =>
|
|
20
|
+
readonly delivery?: (environment: Environment) => release.delivery.Provider | undefined;
|
|
19
21
|
readonly workflows?: WorkflowRunner;
|
|
22
|
+
/**
|
|
23
|
+
* The deployment's cache of disposable entries, created once with the Service. It keeps the
|
|
24
|
+
* admissions of callables whose Schema declares an admission age, so that a call within that age
|
|
25
|
+
* skips its `Function.admit` round trip. Defaults to a bounded memory cache of this process or
|
|
26
|
+
* isolate; `false` keeps nothing, and every call is admitted by its source Kernel.
|
|
27
|
+
*/
|
|
28
|
+
readonly cache?: ((environment: Environment) => DeploymentCache) | false;
|
|
29
|
+
/**
|
|
30
|
+
* Serve durable Workflows to the workflow engine; required when the Release declares any.
|
|
31
|
+
* Undefined for an environment that names no engine: engine requests are then refused.
|
|
32
|
+
*/
|
|
33
|
+
readonly durable?: (environment: Environment, request: Request) => ReturnType<DurableServingProvider>;
|
|
20
34
|
}
|
|
21
|
-
export interface
|
|
35
|
+
export interface ServedDomain<Environment> {
|
|
22
36
|
fetch(request: Request, environment: Environment, context?: ExecutionContext): Promise<Response>;
|
|
23
37
|
drain(): void;
|
|
24
38
|
close(options: ServerCloseOptions): Promise<void>;
|
|
25
39
|
}
|
|
26
40
|
/** 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>):
|
|
41
|
+
export declare function serve<Environment, RuntimeValue extends Runtime, RuntimeEnvironment = Environment>(input: ServeInput<Environment, RuntimeValue, RuntimeEnvironment>): ServedDomain<Environment>;
|
package/dist/execution/serve.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { memoryCache } from './cache/index.js';
|
|
1
2
|
import { createService } from './service/index.js';
|
|
2
3
|
/** Create one provider-neutral Fetch entrypoint around a lazily initialized current Service. */
|
|
3
4
|
export function serve(input) {
|
|
@@ -11,6 +12,9 @@ export function serve(input) {
|
|
|
11
12
|
return service;
|
|
12
13
|
if (typeof input.identity !== 'function')
|
|
13
14
|
invalid();
|
|
15
|
+
if (input.cache !== undefined && input.cache !== false && typeof input.cache !== 'function') {
|
|
16
|
+
invalid();
|
|
17
|
+
}
|
|
14
18
|
const runtimeEnvironment = input.initialize === undefined
|
|
15
19
|
? environment
|
|
16
20
|
: input.initialize(environment);
|
|
@@ -22,6 +26,12 @@ export function serve(input) {
|
|
|
22
26
|
server: input.server,
|
|
23
27
|
...(input.delivery === undefined ? {} : { delivery: input.delivery(environment) }),
|
|
24
28
|
...(input.workflows === undefined ? {} : { workflows: input.workflows }),
|
|
29
|
+
...(input.cache === false
|
|
30
|
+
? {}
|
|
31
|
+
: { cache: input.cache === undefined ? memoryCache() : input.cache(environment) }),
|
|
32
|
+
...(input.durable === undefined
|
|
33
|
+
? {}
|
|
34
|
+
: { durable: (request) => input.durable(environment, request) }),
|
|
25
35
|
});
|
|
26
36
|
if (drained)
|
|
27
37
|
service.drain();
|
|
@@ -3,11 +3,12 @@ import { isRuntime } from '../../application/runtime/index.js';
|
|
|
3
3
|
import { invocationPath } from '../../deployment/release/invocation.js';
|
|
4
4
|
import { identity as captureIdentity } from '../identity/index.js';
|
|
5
5
|
import { createHandler } from '../invocation/index.js';
|
|
6
|
-
import { initialize, load } from '../runtime/index.js';
|
|
6
|
+
import { initialize, load, serving as servedRelease } from '../runtime/index.js';
|
|
7
|
+
import { createDurableReceiver, durableServing, isCanonicalDurableRequest, isDurableRequest, } from '../workflows/index.js';
|
|
7
8
|
import { initialization } from './initialization.js';
|
|
8
9
|
import { lifecycle } from './lifecycle.js';
|
|
9
|
-
import { delivery, installation, source } from './publication/index.js';
|
|
10
10
|
import { loadRelease } from './release.js';
|
|
11
|
+
import { delivery, installation, source } from './serving/index.js';
|
|
11
12
|
/** Create one lazy running Service around the exact current Release. */
|
|
12
13
|
export function createService(input) {
|
|
13
14
|
if (input === null || typeof input !== 'object' || Array.isArray(input))
|
|
@@ -16,24 +17,28 @@ export function createService(input) {
|
|
|
16
17
|
throw new TypeError('Service Runtime is not admitted.');
|
|
17
18
|
const selectedIdentity = captureIdentity(input.identity);
|
|
18
19
|
const providedDelivery = delivery(input.delivery);
|
|
20
|
+
const durable = input.durable;
|
|
21
|
+
// Preserve eager admission for an already loaded engine; providers stay outside ordinary startup.
|
|
22
|
+
const serving = durable === undefined || typeof durable === 'function' ? undefined : durableServing(durable);
|
|
19
23
|
let running;
|
|
20
24
|
const state = lifecycle(() => running?.server.drain());
|
|
21
25
|
const realized = initialization(async () => {
|
|
22
26
|
const release = await loadRelease(input.load, input.environment, input.runtime);
|
|
23
|
-
|
|
27
|
+
const served = servedRelease(release);
|
|
28
|
+
if (served.issuer !== selectedIdentity.issuer) {
|
|
24
29
|
throw new TypeError('Service Identity differs from Release Addressing.');
|
|
25
30
|
}
|
|
26
31
|
if (selectedIdentity.subject !== release.build.schema.compiled.root.origin) {
|
|
27
32
|
throw new TypeError('Service Identity subject differs from the Release Domain origin.');
|
|
28
33
|
}
|
|
29
|
-
const selectedDelivery = providedDelivery ?? selectedIdentity.delivery(
|
|
30
|
-
installation(
|
|
34
|
+
const selectedDelivery = providedDelivery ?? selectedIdentity.delivery(served.document);
|
|
35
|
+
installation(served.document, selectedDelivery);
|
|
31
36
|
const loaded = load(release);
|
|
32
37
|
const runtime = await initialize(loaded, input.environment);
|
|
33
38
|
const prepared = prepareServer({
|
|
34
39
|
...serverOptions(input.server),
|
|
35
40
|
path: invocationPath(),
|
|
36
|
-
publicOrigin:
|
|
41
|
+
publicOrigin: served.publicUrl,
|
|
37
42
|
invocation: {
|
|
38
43
|
source: selectedIdentity.issuer,
|
|
39
44
|
next: () => crypto.randomUUID(),
|
|
@@ -42,19 +47,34 @@ export function createService(input) {
|
|
|
42
47
|
...(selectedIdentity.tokenExchange === undefined
|
|
43
48
|
? {}
|
|
44
49
|
: { tokenExchange: selectedIdentity.tokenExchange }),
|
|
45
|
-
|
|
50
|
+
...source(loaded),
|
|
46
51
|
...(selectedDelivery === undefined ? {} : { delivery: selectedDelivery }),
|
|
47
52
|
});
|
|
48
53
|
const server = prepared.create(createHandler({
|
|
49
54
|
runtime,
|
|
50
55
|
authority: selectedIdentity,
|
|
51
56
|
...(input.workflows === undefined ? {} : { workflows: input.workflows }),
|
|
57
|
+
...(input.cache === undefined ? {} : { cache: input.cache }),
|
|
52
58
|
}));
|
|
53
59
|
running = Object.freeze({ release, runtime, server });
|
|
54
60
|
if (!state.accepting)
|
|
55
61
|
server.drain();
|
|
56
62
|
return running;
|
|
57
63
|
});
|
|
64
|
+
const receiver = initialization(async (request) => {
|
|
65
|
+
const selected = typeof durable === 'function' ? await durable(request) : undefined;
|
|
66
|
+
const configuration = serving ?? (selected === undefined ? undefined : durableServing(selected));
|
|
67
|
+
if (configuration === undefined)
|
|
68
|
+
return undefined;
|
|
69
|
+
const { runtime } = await realized.get();
|
|
70
|
+
return createDurableReceiver({
|
|
71
|
+
workflows: runtime.loaded.registry.workflows,
|
|
72
|
+
domain: runtime.loaded.domain,
|
|
73
|
+
identity: selectedIdentity,
|
|
74
|
+
serving: configuration,
|
|
75
|
+
integrations: runtime.clients,
|
|
76
|
+
});
|
|
77
|
+
});
|
|
58
78
|
let closing;
|
|
59
79
|
const service = Object.freeze({
|
|
60
80
|
async fetch(request, host) {
|
|
@@ -63,6 +83,15 @@ export function createService(input) {
|
|
|
63
83
|
const ready = await realized.get();
|
|
64
84
|
if (!state.accepting)
|
|
65
85
|
return unavailable();
|
|
86
|
+
// Without engine configuration only durable calls fail: the engine's discovery is refused.
|
|
87
|
+
if (isDurableRequest(request)) {
|
|
88
|
+
if (!isCanonicalDurableRequest(request))
|
|
89
|
+
return notServed();
|
|
90
|
+
const selected = await receiver.get(request);
|
|
91
|
+
if (!state.accepting)
|
|
92
|
+
return unavailable();
|
|
93
|
+
return selected?.fetch(request) ?? notServed();
|
|
94
|
+
}
|
|
66
95
|
return ready.server.app.fetch(request, host);
|
|
67
96
|
},
|
|
68
97
|
async release() {
|
|
@@ -95,6 +124,7 @@ function serverOptions(input) {
|
|
|
95
124
|
'issuer',
|
|
96
125
|
'publicOrigin',
|
|
97
126
|
'tokenExchange',
|
|
127
|
+
'release',
|
|
98
128
|
'publication',
|
|
99
129
|
'delivery',
|
|
100
130
|
'handler',
|
|
@@ -104,6 +134,12 @@ function serverOptions(input) {
|
|
|
104
134
|
}
|
|
105
135
|
return input;
|
|
106
136
|
}
|
|
137
|
+
function notServed() {
|
|
138
|
+
return new Response('{"error":"This deployment serves no durable Workflows."}', {
|
|
139
|
+
status: 404,
|
|
140
|
+
headers: { 'content-type': 'application/json', 'cache-control': 'no-store' },
|
|
141
|
+
});
|
|
142
|
+
}
|
|
107
143
|
function unavailable() {
|
|
108
144
|
return new Response('{"error":"Service is draining."}', {
|
|
109
145
|
status: 503,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export interface Initialization<Value> {
|
|
2
|
-
get(): Promise<Value>;
|
|
1
|
+
export interface Initialization<Value, Arguments extends readonly unknown[] = []> {
|
|
2
|
+
get(...args: Arguments): Promise<Value>;
|
|
3
3
|
current(): Promise<Value> | undefined;
|
|
4
4
|
}
|
|
5
|
-
/** Share
|
|
6
|
-
export declare function initialization<Value>(create: () => Promise<Value>): Initialization<Value>;
|
|
5
|
+
/** Share an initialized value; absence and failure leave initialization retryable. */
|
|
6
|
+
export declare function initialization<Value, Arguments extends readonly unknown[] = []>(create: (...args: Arguments) => Promise<Value>): Initialization<Value, Arguments>;
|
|
@@ -1,18 +1,27 @@
|
|
|
1
|
-
/** Share
|
|
1
|
+
/** Share an initialized value; absence and failure leave initialization retryable. */
|
|
2
2
|
export function initialization(create) {
|
|
3
|
-
let
|
|
3
|
+
let state;
|
|
4
|
+
const get = (...args) => {
|
|
5
|
+
if (state?.phase === 'ready')
|
|
6
|
+
return state.promise;
|
|
7
|
+
if (state !== undefined) {
|
|
8
|
+
// Absence can depend on the initializing request. A waiter gets its own eligibility check.
|
|
9
|
+
return state.promise.then((value) => (value === undefined ? get(...args) : value));
|
|
10
|
+
}
|
|
11
|
+
const pending = create(...args).then((value) => {
|
|
12
|
+
if (state?.promise === pending)
|
|
13
|
+
state = value === undefined ? undefined : { phase: 'ready', promise: pending };
|
|
14
|
+
return value;
|
|
15
|
+
}, (cause) => {
|
|
16
|
+
if (state?.promise === pending)
|
|
17
|
+
state = undefined;
|
|
18
|
+
throw cause;
|
|
19
|
+
});
|
|
20
|
+
state = { phase: 'pending', promise: pending };
|
|
21
|
+
return pending;
|
|
22
|
+
};
|
|
4
23
|
return Object.freeze({
|
|
5
|
-
get
|
|
6
|
-
|
|
7
|
-
return current;
|
|
8
|
-
const pending = create().catch((cause) => {
|
|
9
|
-
if (current === pending)
|
|
10
|
-
current = undefined;
|
|
11
|
-
throw cause;
|
|
12
|
-
});
|
|
13
|
-
current = pending;
|
|
14
|
-
return pending;
|
|
15
|
-
},
|
|
16
|
-
current: () => current,
|
|
24
|
+
get,
|
|
25
|
+
current: () => state?.promise,
|
|
17
26
|
});
|
|
18
27
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Runtime } from '../../application/runtime/index.js';
|
|
2
2
|
import type { Build } from '../../deployment/build/build.js';
|
|
3
|
-
import type { Release } from '../../deployment/release/release.js';
|
|
4
3
|
import type { schema } from '../../platform/schema/index.js';
|
|
5
|
-
|
|
4
|
+
import type { ServedRelease } from '../runtime/index.js';
|
|
5
|
+
export type ReleaseForRuntime<RuntimeValue extends Runtime> = ServedRelease<Build<schema.DomainSchema, RuntimeValue>>;
|
|
6
6
|
export type ReleaseLoader<Environment, RuntimeValue extends Runtime = Runtime> = (environment: Environment) => ReleaseForRuntime<RuntimeValue> | Promise<ReleaseForRuntime<RuntimeValue>>;
|
|
7
7
|
export declare function loadRelease<Environment, RuntimeValue extends Runtime>(load: ReleaseLoader<Environment, RuntimeValue>, environment: Environment, runtime: RuntimeValue): Promise<ReleaseForRuntime<RuntimeValue>>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isServedRelease } from '../runtime/index.js';
|
|
2
2
|
export async function loadRelease(load, environment, runtime) {
|
|
3
3
|
if (typeof load !== 'function')
|
|
4
4
|
throw new TypeError('Service Release loader is invalid.');
|
|
5
5
|
const release = await load(environment);
|
|
6
|
-
if (!
|
|
6
|
+
if (!isServedRelease(release)) {
|
|
7
7
|
throw new TypeError('Service loader returned an unadmitted Release.');
|
|
8
|
+
}
|
|
8
9
|
if (release.build.runtime !== runtime) {
|
|
9
10
|
throw new TypeError('Service Release Runtime differs from the generated entrypoint Runtime.');
|
|
10
11
|
}
|
|
@@ -1,23 +1,38 @@
|
|
|
1
1
|
import type { ApplicationHost, ServerCloseOptions, ServerOptions } 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
|
-
import type {
|
|
5
|
+
import type { DeploymentCache } from '../cache/index.js';
|
|
6
6
|
import type { Identity } from '../identity/index.js';
|
|
7
|
+
import type { ServedRelease } from '../runtime/index.js';
|
|
8
|
+
import type { DurableServing, DurableServingProvider } from '../workflows/index.js';
|
|
7
9
|
import type { ReleaseLoader } from './release.js';
|
|
8
|
-
export type ServiceServerOptions = Omit<ServerOptions, 'path' | 'invocation' | 'issuer' | 'publicOrigin' | 'tokenExchange' | '
|
|
10
|
+
export type ServiceServerOptions = Omit<ServerOptions, 'path' | 'invocation' | 'issuer' | 'publicOrigin' | 'tokenExchange' | 'release' | 'delivery'>;
|
|
9
11
|
export interface ServiceInput<Environment, RuntimeValue extends Runtime = Runtime> {
|
|
10
12
|
readonly runtime: RuntimeValue;
|
|
11
13
|
readonly environment: Environment;
|
|
12
14
|
readonly load: ReleaseLoader<Environment, RuntimeValue>;
|
|
13
15
|
readonly identity: Identity;
|
|
14
16
|
readonly server: ServiceServerOptions;
|
|
15
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Answers Delivery v2 over an immutable deployment's Release. Defaults to the Identity's own.
|
|
19
|
+
*/
|
|
20
|
+
readonly delivery?: release.delivery.Provider;
|
|
16
21
|
readonly workflows?: WorkflowRunner;
|
|
22
|
+
/**
|
|
23
|
+
* Where admissions of callables that declare an admission age are kept for the next calls.
|
|
24
|
+
* Absent: every call is admitted by its source Kernel.
|
|
25
|
+
*/
|
|
26
|
+
readonly cache?: DeploymentCache;
|
|
27
|
+
/**
|
|
28
|
+
* Serve the Release's durable Workflows. A provider is resolved on the first engine request,
|
|
29
|
+
* shared by concurrent requests, and retried after initialization fails.
|
|
30
|
+
*/
|
|
31
|
+
readonly durable?: DurableServing | DurableServingProvider;
|
|
17
32
|
}
|
|
18
33
|
export interface Service {
|
|
19
34
|
fetch(request: Request, host?: ApplicationHost): Promise<Response>;
|
|
20
|
-
release(): Promise<
|
|
35
|
+
release(): Promise<ServedRelease>;
|
|
21
36
|
drain(): void;
|
|
22
37
|
close(options: ServerCloseOptions): Promise<void>;
|
|
23
38
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { release } from '@astrale-os/kernel-server';
|
|
2
|
+
/**
|
|
3
|
+
* Capture an explicit Delivery v2 Provider over an immutable deployment's Release.
|
|
4
|
+
*/
|
|
5
|
+
export declare function delivery(input: release.delivery.Provider | undefined): release.delivery.Provider | undefined;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capture an explicit Delivery v2 Provider over an immutable deployment's Release.
|
|
3
|
+
*/
|
|
1
4
|
export function delivery(input) {
|
|
2
5
|
if (input === undefined)
|
|
3
6
|
return undefined;
|
|
4
7
|
if (input === null || typeof input !== 'object' || typeof input.create !== 'function') {
|
|
5
|
-
throw new TypeError('
|
|
8
|
+
throw new TypeError('Delivery Provider is invalid.');
|
|
6
9
|
}
|
|
7
10
|
const create = input.create.bind(input);
|
|
8
11
|
return Object.freeze({ create });
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { release } from '@astrale-os/kernel-server';
|
|
2
|
+
import type { Serving } from '../../runtime/index.js';
|
|
3
|
+
/** A served document advertises Delivery exactly when the Service has a Provider for it. */
|
|
4
|
+
export declare function installation(served: Serving['document'], provider: release.delivery.Provider | undefined): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** A served document advertises Delivery exactly when the Service has a Provider for it. */
|
|
2
|
+
export function installation(served, provider) {
|
|
3
|
+
const advertised = served.delivery !== undefined;
|
|
4
|
+
if (advertised !== (provider !== undefined)) {
|
|
5
|
+
throw new TypeError(advertised
|
|
6
|
+
? 'Release advertises delivery without a Provider.'
|
|
7
|
+
: 'Delivery Provider has no Release endpoint.');
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReleaseSource } from '@astrale-os/kernel-server';
|
|
2
|
+
import type { LoadedRuntime } from '../../runtime/index.js';
|
|
3
|
+
/** The one source a Kernel Server serves, as `ServerOptions` takes it. */
|
|
4
|
+
export type ServingSource = {
|
|
5
|
+
readonly release: ReleaseSource;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Prepare, once, the exact snapshot the loaded Release serves: an immutable deployment serves its
|
|
9
|
+
* DomainRelease through prepareReleaseSnapshot, which admits routing naming that exact release.
|
|
10
|
+
*/
|
|
11
|
+
export declare function source(runtime: LoadedRuntime): ServingSource;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { prepareReleaseSnapshot } from '@astrale-os/kernel-server';
|
|
2
|
+
/**
|
|
3
|
+
* Prepare, once, the exact snapshot the loaded Release serves: an immutable deployment serves its
|
|
4
|
+
* DomainRelease through prepareReleaseSnapshot, which admits routing naming that exact release.
|
|
5
|
+
*/
|
|
6
|
+
export function source(runtime) {
|
|
7
|
+
const served = runtime.release;
|
|
8
|
+
const snapshot = prepareReleaseSnapshot({
|
|
9
|
+
release: served.document,
|
|
10
|
+
bundle: served.build.schema.bundle.bytes(),
|
|
11
|
+
table: served.routes,
|
|
12
|
+
domain: runtime.domain,
|
|
13
|
+
});
|
|
14
|
+
return Object.freeze({ release: Object.freeze({ current: () => snapshot }) });
|
|
15
|
+
}
|