@astrale-os/sdk 0.6.0-beta.6 → 0.6.0-beta.60
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 +220 -66
- package/dist/application/action/action.d.ts +6 -0
- package/dist/application/action/authoring.d.ts +3 -1
- package/dist/application/action/authoring.js +1 -0
- package/dist/application/action/context.d.ts +95 -34
- package/dist/application/action/define.d.ts +3 -3
- package/dist/application/action/index.d.ts +3 -1
- package/dist/application/action/index.js +1 -0
- 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/error/error.d.ts +16 -1
- package/dist/application/error/error.js +39 -5
- package/dist/application/error/index.d.ts +1 -1
- package/dist/application/error/index.js +1 -1
- package/dist/application/file/binary.d.ts +11 -0
- package/dist/application/file/binary.js +45 -0
- package/dist/application/file/file.d.ts +77 -0
- package/dist/application/file/file.js +111 -0
- package/dist/application/file/index.d.ts +4 -0
- package/dist/application/file/index.js +2 -0
- package/dist/application/file/input.d.ts +13 -0
- package/dist/application/file/input.js +57 -0
- package/dist/application/index.d.ts +6 -5
- 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/builder.d.ts +81 -33
- package/dist/application/mutation/authoring/builder.js +100 -30
- package/dist/application/mutation/authoring/guard.d.ts +37 -0
- package/dist/application/mutation/authoring/guard.js +150 -0
- package/dist/application/mutation/authoring/index.d.ts +5 -2
- package/dist/application/mutation/authoring/index.js +2 -1
- package/dist/application/mutation/authoring/names.d.ts +19 -0
- package/dist/application/mutation/authoring/names.js +83 -0
- package/dist/application/mutation/authoring/properties.d.ts +17 -4
- package/dist/application/mutation/authoring/properties.js +38 -2
- package/dist/application/mutation/authoring/transition.d.ts +3 -2
- package/dist/application/mutation/authoring/transition.js +4 -1
- package/dist/application/mutation/define.d.ts +24 -10
- package/dist/application/mutation/define.js +49 -53
- package/dist/application/mutation/execution/execute.d.ts +2 -2
- package/dist/application/mutation/execution/execute.js +78 -7
- package/dist/application/mutation/execution/executor.d.ts +4 -1
- package/dist/application/mutation/execution/executor.js +6 -1
- package/dist/application/mutation/failure.d.ts +17 -1
- package/dist/application/mutation/failure.js +40 -19
- package/dist/application/mutation/index.d.ts +9 -5
- package/dist/application/mutation/index.js +5 -2
- package/dist/application/mutation/legacy/v6/builder.d.ts +84 -0
- package/dist/application/mutation/legacy/v6/define.d.ts +18 -0
- package/dist/application/mutation/legacy/v6/define.js +56 -0
- package/dist/application/mutation/legacy/v6/mutation.d.ts +28 -0
- package/dist/application/mutation/{authoring → legacy/v6}/precondition.d.ts +4 -0
- package/dist/application/mutation/mutation.d.ts +47 -19
- package/dist/application/query/answer/answer.d.ts +117 -0
- package/dist/application/query/answer/conformance.d.ts +4 -0
- package/dist/application/query/answer/conformance.js +27 -0
- package/dist/application/query/answer/facts.d.ts +17 -0
- package/dist/application/query/answer/facts.js +57 -0
- package/dist/application/query/composite/builder.d.ts +1 -1
- package/dist/application/query/composite/builder.js +2 -2
- package/dist/application/query/composite/plan.d.ts +1 -5
- package/dist/application/query/composite/plan.js +1 -3
- package/dist/application/query/composite/query.d.ts +1 -2
- package/dist/application/query/define.d.ts +3 -34
- package/dist/application/query/define.js +5 -131
- package/dist/application/query/defined/define.d.ts +45 -0
- package/dist/application/query/defined/define.js +96 -0
- package/dist/application/query/defined/query.d.ts +139 -0
- package/dist/application/query/definition.d.ts +12 -0
- package/dist/application/query/definition.js +47 -0
- package/dist/application/query/execution/bounds.d.ts +22 -0
- package/dist/application/query/execution/bounds.js +88 -0
- package/dist/application/query/execution/client.d.ts +21 -0
- package/dist/application/query/execution/crossings.d.ts +30 -0
- package/dist/application/query/execution/crossings.js +232 -0
- package/dist/application/query/execution/error.d.ts +71 -0
- package/dist/application/query/execution/error.js +50 -0
- package/dist/application/query/execution/execute.d.ts +4 -10
- package/dist/application/query/execution/execute.js +3 -45
- package/dist/application/query/execution/executor.d.ts +2 -2
- package/dist/application/query/execution/legacy/declared-classes.d.ts +10 -0
- package/dist/application/query/execution/legacy/declared-classes.js +9 -0
- package/dist/application/query/execution/refusal.d.ts +37 -0
- package/dist/application/query/execution/refusal.js +80 -0
- package/dist/application/query/execution/rows.d.ts +42 -0
- package/dist/application/query/execution/rows.js +326 -0
- package/dist/application/query/execution/run.d.ts +85 -0
- package/dist/application/query/execution/run.js +372 -0
- package/dist/application/query/execution/split.d.ts +24 -0
- package/dist/application/query/execution/split.js +190 -0
- package/dist/application/query/failure.d.ts +8 -0
- package/dist/application/query/failure.js +8 -0
- package/dist/application/query/handles/build.d.ts +10 -0
- package/dist/application/query/handles/build.js +53 -0
- package/dist/application/query/handles/conditions.d.ts +94 -0
- package/dist/application/query/handles/domain.d.ts +157 -0
- package/dist/application/query/handles/handles.d.ts +285 -0
- package/dist/application/query/handles/handles.js +1 -0
- package/dist/application/query/handles/model.d.ts +106 -0
- package/dist/application/query/handles/model.js +261 -0
- package/dist/application/query/handles/plan.d.ts +100 -0
- package/dist/application/query/handles/plan.js +37 -0
- package/dist/application/query/handles/reads.d.ts +106 -0
- package/dist/application/query/handles/reads.js +978 -0
- package/dist/application/query/handles/relations.d.ts +106 -0
- package/dist/application/query/handles/relations.js +1 -0
- package/dist/application/query/handles/rows.d.ts +94 -0
- package/dist/application/query/handles/rows.js +4 -0
- package/dist/application/query/handles/terms.d.ts +103 -0
- package/dist/application/query/handles/terms.js +282 -0
- package/dist/application/query/index.d.ts +14 -8
- package/dist/application/query/index.js +10 -5
- package/dist/application/query/language/index.d.ts +2 -0
- package/dist/application/query/language/index.js +2 -0
- package/dist/application/query/language/query.d.ts +323 -0
- package/dist/application/query/language/query.js +2 -0
- package/dist/application/query/{collection → legacy/v6/collection}/identity.d.ts +2 -2
- package/dist/application/query/{collection → legacy/v6/collection}/metadata.d.ts +1 -1
- package/dist/application/query/{collection → legacy/v6/collection}/union.d.ts +4 -4
- package/dist/application/query/{collection → legacy/v6/collection}/union.js +15 -8
- package/dist/application/query/legacy/v6/conformance.d.ts +15 -0
- package/dist/application/query/legacy/v6/conformance.js +46 -0
- package/dist/application/query/legacy/v6/define.d.ts +37 -0
- package/dist/application/query/legacy/v6/define.js +90 -0
- package/dist/application/query/legacy/v6/execution/execute.d.ts +18 -0
- package/dist/application/query/legacy/v6/execution/execute.js +50 -0
- package/dist/application/query/legacy/v6/index.d.ts +7 -0
- package/dist/application/query/legacy/v6/index.js +3 -0
- package/dist/application/query/legacy/v6/kernel.d.ts +6 -0
- package/dist/application/query/legacy/v6/kernel.js +5 -0
- package/dist/application/query/{single → legacy/v6/single}/pagination.js +1 -1
- package/dist/application/query/{single → legacy/v6/single}/query.d.ts +2 -14
- package/dist/application/query/legacy/v6/single/query.js +1 -0
- package/dist/application/query/query.d.ts +19 -4
- package/dist/application/requirements/canonical.d.ts +7 -0
- package/dist/application/requirements/canonical.js +16 -0
- package/dist/application/requirements/classes.d.ts +9 -7
- package/dist/application/requirements/classes.js +35 -42
- package/dist/application/requirements/functions.d.ts +3 -1
- package/dist/application/requirements/functions.js +12 -27
- package/dist/application/requirements/index.d.ts +34 -16
- package/dist/application/requirements/index.js +17 -20
- package/dist/application/requirements/legacy/authority.d.ts +21 -0
- package/dist/application/requirements/{authority.js → legacy/authority.js} +5 -2
- package/dist/application/requirements/legacy/classes.d.ts +22 -0
- package/dist/application/requirements/legacy/classes.js +24 -0
- package/dist/application/requirements/legacy/core.d.ts +30 -0
- package/dist/application/requirements/{core.js → legacy/core.js} +15 -13
- package/dist/application/requirements/legacy/functions.d.ts +7 -0
- package/dist/application/requirements/legacy/functions.js +15 -0
- package/dist/application/requirements/legacy/index.d.ts +43 -0
- package/dist/application/requirements/legacy/index.js +1 -0
- package/dist/application/requirements/legacy/requirements.d.ts +31 -0
- package/dist/application/requirements/legacy/requirements.js +31 -0
- package/dist/application/requirements/requirement.d.ts +30 -19
- package/dist/application/requirements/roles.d.ts +17 -0
- package/dist/application/requirements/roles.js +62 -0
- package/dist/application/requirements/scopes.d.ts +16 -0
- package/dist/application/requirements/scopes.js +34 -0
- package/dist/application/routes/admission.d.ts +3 -3
- package/dist/application/routes/admission.js +3 -3
- package/dist/application/routes/index.d.ts +3 -2
- package/dist/application/routes/route.d.ts +3 -3
- package/dist/application/runtime/actions.js +3 -0
- package/dist/application/runtime/declarations.d.ts +6 -6
- package/dist/application/runtime/define.d.ts +5 -5
- package/dist/application/runtime/runtime.js +12 -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 +211 -0
- package/dist/application/workflow/durable.js +1 -0
- package/dist/application/workflow/index.d.ts +3 -2
- package/dist/application/workflow/runner/inline.js +1 -0
- package/dist/application/workflow/runner/runner.d.ts +2 -2
- 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/bundle.js +1 -0
- package/dist/deployment/adapter/bundle/file.d.ts +10 -0
- package/dist/deployment/adapter/bundle/file.js +1 -0
- package/dist/deployment/adapter/bundle/index.d.ts +2 -0
- package/dist/deployment/adapter/bundle/index.js +1 -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/command.js +1 -0
- package/dist/deployment/adapter/release/context.d.ts +94 -0
- package/dist/deployment/adapter/release/context.js +1 -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 +13 -2
- package/dist/deployment/build/compile.d.ts +4 -4
- package/dist/deployment/build/compile.js +31 -81
- 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/legacy/requirements.d.ts +11 -0
- package/dist/deployment/build/legacy/requirements.js +79 -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 +95 -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/exchange.js +11 -1
- 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 +14 -0
- package/dist/execution/invocation/capabilities/bind.js +74 -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/action.js +4 -2
- package/dist/execution/invocation/dispatch/context.d.ts +8 -7
- package/dist/execution/invocation/dispatch/context.js +34 -45
- package/dist/execution/invocation/dispatch/workflow.js +4 -6
- 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 +130 -22
- 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 +12 -16
- package/dist/execution/invocation/result/index.d.ts +3 -2
- package/dist/execution/invocation/result/index.js +2 -1
- package/dist/execution/invocation/result/project.js +41 -1
- package/dist/execution/invocation/result/undeclared.d.ts +7 -0
- package/dist/execution/invocation/result/undeclared.js +18 -0
- 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 +56 -0
- package/dist/execution/workflows/failure.js +204 -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 +369 -0
- package/dist/execution/workflows/steps.d.ts +48 -0
- package/dist/execution/workflows/steps.js +93 -0
- package/dist/index.d.ts +5 -5
- 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 +58 -12
- package/dist/platform/schema/class-authoring.js +38 -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 +11 -4
- package/dist/platform/schema/index.js +2 -1
- package/dist/platform/schema/kernel-compiled.d.ts +2 -0
- package/dist/platform/schema/kernel-compiled.js +2 -0
- package/dist/platform/schema/kernel.d.ts +4 -2
- package/dist/platform/schema/property.d.ts +5 -0
- package/dist/platform/schema/references/index.d.ts +6 -0
- package/dist/platform/schema/references/index.js +1 -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/file.d.ts +20 -0
- package/dist/testing/file.js +49 -0
- package/dist/testing/index.d.ts +10 -1
- package/dist/testing/index.js +7 -1
- package/dist/testing/load.js +1 -1
- package/dist/testing/query.d.ts +22 -0
- package/dist/testing/query.js +36 -0
- 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 +252 -91
- 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/definition-calls.d.ts +34 -0
- package/dist/tooling/linter/adapters/typescript/definition-calls.js +88 -0
- package/dist/tooling/linter/adapters/typescript/discover.js +8 -2
- 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 +9 -2
- package/dist/tooling/linter/adapters/typescript/index.js +4 -2
- package/dist/tooling/linter/adapters/typescript/legacy.d.ts +20 -0
- package/dist/tooling/linter/adapters/typescript/legacy.js +28 -0
- package/dist/tooling/linter/adapters/typescript/query-observation.js +37 -12
- 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/adapters/typescript/type-analysis.d.ts +2 -0
- package/dist/tooling/linter/adapters/typescript/type-analysis.js +10 -0
- package/dist/tooling/linter/implementations/source/callable-requirements.d.ts +2 -4
- package/dist/tooling/linter/implementations/source/callable-requirements.js +16 -58
- package/dist/tooling/linter/implementations/source/const-initializer.d.ts +3 -0
- package/dist/tooling/linter/implementations/source/const-initializer.js +31 -0
- package/dist/tooling/linter/implementations/source/definitions.d.ts +2 -0
- package/dist/tooling/linter/implementations/source/definitions.js +425 -0
- package/dist/tooling/linter/implementations/source/dependencies.js +13 -72
- package/dist/tooling/linter/implementations/source/domain-requirements.d.ts +8 -0
- package/dist/tooling/linter/implementations/source/domain-requirements.js +35 -0
- package/dist/tooling/linter/implementations/source/global.js +39 -19
- package/dist/tooling/linter/implementations/source/legacy/requirements.d.ts +10 -0
- package/dist/tooling/linter/implementations/source/legacy/requirements.js +40 -0
- package/dist/tooling/linter/implementations/source/legacy-folders.d.ts +3 -0
- package/dist/tooling/linter/implementations/source/legacy-folders.js +126 -0
- package/dist/tooling/linter/implementations/source/mutations.js +153 -70
- package/dist/tooling/linter/implementations/source/policy-edges.d.ts +2 -0
- package/dist/tooling/linter/implementations/source/policy-edges.js +113 -0
- 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/requirement-entries.d.ts +24 -0
- package/dist/tooling/linter/implementations/source/requirement-entries.js +52 -0
- package/dist/tooling/linter/implementations/source/runtime-imports.d.ts +2 -0
- package/dist/tooling/linter/implementations/source/runtime-imports.js +119 -0
- package/dist/tooling/linter/implementations/source/schema.d.ts +3 -0
- package/dist/tooling/linter/implementations/source/schema.js +9 -5
- package/dist/tooling/linter/implementations/source/shared.d.ts +19 -5
- package/dist/tooling/linter/implementations/source/shared.js +131 -55
- package/dist/tooling/linter/implementations/source/tests.js +1 -1
- package/dist/tooling/linter/implementations/source/verifiers.js +8 -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 +18 -67
- package/dist/tooling/linter/requirements/registry.js +14 -9
- 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/accounts/scenarios.tsv +12 -0
- package/docs/admission-age.md +88 -0
- package/docs/auth-api-migration.md +57 -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 +530 -0
- package/docs/handler-dependencies.md +381 -0
- package/docs/legacy/query-v6.md +62 -0
- package/docs/legacy.md +113 -0
- package/docs/queries.md +493 -0
- package/docs/release.md +155 -0
- package/docs/requirements.md +143 -0
- package/docs/schema-cost.md +124 -0
- package/package.json +62 -26
- 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/application/requirements/authority.d.ts +0 -7
- package/dist/application/requirements/core.d.ts +0 -14
- 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/application/{query/single/query.js → mutation/legacy/v6/builder.js} +0 -0
- /package/dist/{deployment/adapter/deploy/context.js → application/mutation/legacy/v6/mutation.js} +0 -0
- /package/dist/application/mutation/{authoring → legacy/v6}/precondition.js +0 -0
- /package/dist/{deployment/adapter/deploy/index.js → application/query/answer/answer.js} +0 -0
- /package/dist/{deployment/adapter/deploy/result.js → application/query/defined/query.js} +0 -0
- /package/dist/{deployment/adapter/prepare/artifact.js → application/query/execution/client.js} +0 -0
- /package/dist/{deployment/adapter/prepare/context.js → application/query/handles/conditions.js} +0 -0
- /package/dist/{deployment/adapter/prepare/index.js → application/query/handles/domain.js} +0 -0
- /package/dist/application/query/{collection → legacy/v6/collection}/identity.js +0 -0
- /package/dist/application/query/{collection → legacy/v6/collection}/limits.d.ts +0 -0
- /package/dist/application/query/{collection → legacy/v6/collection}/limits.js +0 -0
- /package/dist/application/query/{collection → legacy/v6/collection}/metadata.js +0 -0
- /package/dist/application/query/{execution → legacy/v6/execution}/pages.d.ts +0 -0
- /package/dist/application/query/{execution → legacy/v6/execution}/pages.js +0 -0
- /package/dist/application/query/{single → legacy/v6/single}/index.d.ts +0 -0
- /package/dist/application/query/{single → legacy/v6/single}/index.js +0 -0
- /package/dist/application/query/{single → legacy/v6/single}/node.d.ts +0 -0
- /package/dist/application/query/{single → legacy/v6/single}/node.js +0 -0
- /package/dist/application/query/{single → legacy/v6/single}/pagination.d.ts +0 -0
- /package/dist/application/query/{single → legacy/v6/single}/selection.d.ts +0 -0
- /package/dist/application/query/{single → legacy/v6/single}/selection.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
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Declared business errors
|
|
2
|
+
|
|
3
|
+
Actions and Workflows can declare safe expected failures beside their implementation. The handler
|
|
4
|
+
receives a context-bound `error` factory, which may be destructured and thrown directly:
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
export const createWorker = defineWorkflow<EmployeesSchema>()(
|
|
8
|
+
'Worker.create',
|
|
9
|
+
{
|
|
10
|
+
errors: {
|
|
11
|
+
AGENCY_NOT_ACTIVE: {
|
|
12
|
+
family: 'CONFLICT',
|
|
13
|
+
message: 'The Agency must be active.',
|
|
14
|
+
details: z.strictObject({
|
|
15
|
+
agencyId: z.string(),
|
|
16
|
+
actualStatus: agencyStatus,
|
|
17
|
+
}),
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
async ({ error, input }) => {
|
|
22
|
+
throw error('AGENCY_NOT_ACTIVE', {
|
|
23
|
+
agencyId: input.agency,
|
|
24
|
+
actualStatus: 'DRAFT',
|
|
25
|
+
})
|
|
26
|
+
},
|
|
27
|
+
)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The SDK validates and detaches the details, then exposes the declared static message and an existing
|
|
31
|
+
Protocol numeric family with `{ code, details }` reason data. An ordinary exception, a forged error,
|
|
32
|
+
or a handler-created Protocol error remains an internal defect and is not exposed.
|
|
33
|
+
|
|
34
|
+
Declare expected refusals through the handler's context factory. Infrastructure failures remain
|
|
35
|
+
ordinary exceptions: the Server redacts them, and a durable engine can retry them. The business
|
|
36
|
+
families are `VALIDATION_ERROR`, `NOT_FOUND`, `CONFLICT`, and `UNSUPPORTED`; declaring a failure
|
|
37
|
+
also makes it terminal for a durable Workflow. Transport failures from the Kernel Client retain
|
|
38
|
+
their separate admitted protocol contract.
|
|
39
|
+
|
|
40
|
+
These declarations belong to the implementation. They are not part of the Domain Schema,
|
|
41
|
+
introspection, generated clients, schema revisions, or schema compatibility checks. Consumers
|
|
42
|
+
should continue handling the generic `ResponseError` contract and inspect its admitted `reason`.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Domain definition migration
|
|
2
|
+
|
|
3
|
+
The authored composition of a Domain (its Schema, Runtime, frontend, routes, and requirements) is
|
|
4
|
+
now called a Domain definition. It was previously called an Application. Only names change; the
|
|
5
|
+
composition, its admission rules, its Build, and its Release are identical.
|
|
6
|
+
|
|
7
|
+
| Before | After |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| `import { … } from '@astrale-os/sdk/application'` | `import { … } from '@astrale-os/sdk/domain'` |
|
|
10
|
+
| `defineApplication({ schema, runtime, … })` | `defineDomain({ schema, runtime, … })` |
|
|
11
|
+
| `isApplication(value)` | `isDomainDefinition(value)` |
|
|
12
|
+
| `Application<…>` | `DomainDefinition<…>` |
|
|
13
|
+
| `ApplicationInput<…>` | `DomainDefinitionInput<…>` |
|
|
14
|
+
| `ApplicationIdentity` | `DomainDefinitionIdentity` |
|
|
15
|
+
| `SchemaOfApplication<…>` / `RuntimeOfApplication<…>` | `SchemaOfDomainDefinition<…>` / `RuntimeOfDomainDefinition<…>` |
|
|
16
|
+
| `ApplicationOfProject<…>` | `DomainDefinitionOfProject<…>` |
|
|
17
|
+
| `ServedApplication<…>` | `ServedDomain<…>` |
|
|
18
|
+
| `defineProject({ application, environments })` | `defineProject({ domain, environments })` |
|
|
19
|
+
| Root module `application.ts` | Root module `domain.ts` |
|
|
20
|
+
|
|
21
|
+
`DomainDefinition` is distinct from the existing `Domain` type of `@astrale-os/sdk/schema`, which
|
|
22
|
+
is the resolved Schema value a Domain definition composes.
|
|
23
|
+
|
|
24
|
+
## Steps
|
|
25
|
+
|
|
26
|
+
1. Rename the root module `application.ts` to `domain.ts`; the linter layout now requires
|
|
27
|
+
`domain.ts`.
|
|
28
|
+
2. In it, import `defineDomain` from `@astrale-os/sdk/domain` and export the result as `domain`:
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { defineDomain } from '@astrale-os/sdk/domain'
|
|
32
|
+
|
|
33
|
+
export const domain = defineDomain({ schema, runtime })
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
3. In `astrale.config.ts`, import `domain` from `./domain.js` and pass it as `domain`:
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
export default defineProject({ domain, environments: { development: { deployment } } })
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
A Project that still passes `application` is rejected with this instruction.
|
|
43
|
+
4. Update the package facade (`index.ts`) and any test that imported `application`.
|
|
44
|
+
5. Run the project's typecheck, lint, and tests.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Domain name and entrypoint in the root Schema
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
const Schema = defineSchema('tasks.example.dev', {
|
|
5
|
+
name: 'Tasks',
|
|
6
|
+
views: { application: view({}) },
|
|
7
|
+
entrypoint: 'application',
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
const frontend = defineFrontend({
|
|
11
|
+
schema: Schema,
|
|
12
|
+
source: vite(),
|
|
13
|
+
routes: { application: '/' },
|
|
14
|
+
})
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The root owns the display name and its optional own View entrypoint. A frontend supplies source
|
|
18
|
+
and route placement; it does not select the Domain's entrypoint. A release authors neither field.
|
|
19
|
+
Schemas without a frontend can still declare a name. Removing an entrypoint is an explicit Schema
|
|
20
|
+
revision, rather than an accidental change to frontend placement. A dependency View cannot become
|
|
21
|
+
the root's entrypoint.
|
|
22
|
+
|
|
23
|
+
Migration changes:
|
|
24
|
+
|
|
25
|
+
- Add `name` to every newly authored root Schema. The canonical Kernel builder owns validation;
|
|
26
|
+
the SDK must not emulate it with a structurally compatible wrapper.
|
|
27
|
+
- Move `defineFrontend({ entrypoint })` to `defineSchema(origin, { entrypoint })`. A single View
|
|
28
|
+
no longer implicitly selects a frontend entrypoint. Omitting the root field means no entrypoint.
|
|
29
|
+
- Scaffold variants stamp the package's own final name into the root Schema and declare an
|
|
30
|
+
entrypoint only for variants with an authored View.
|
|
31
|
+
- Frontend routes and files remain deployment material. The Schema revision carries the Domain
|
|
32
|
+
name / entrypoint; the frontend digest and release manifest do not duplicate those fields.
|
|
33
|
+
A coherent SDK and Kernel package cohort owns this contract end to end. Authoring, portable
|
|
34
|
+
declarations, compiled Schema restoration, Release4 serving and installed Domain inspection must
|
|
35
|
+
agree on the same name and entrypoint. There is no compatibility path for unnamed Schema documents
|
|
36
|
+
or legacy Release projections.
|
|
@@ -0,0 +1,530 @@
|
|
|
1
|
+
# Durable Workflows
|
|
2
|
+
|
|
3
|
+
A callable whose Schema declares `execution: { durable: true }` runs on the Kernel's workflow
|
|
4
|
+
engine. A call returns at once with the `K.Execution` it recorded; the engine journals the run,
|
|
5
|
+
keeps its timers and promises, retries it and survives restarts of the Domain, the Kernel and the
|
|
6
|
+
engine itself.
|
|
7
|
+
|
|
8
|
+
```ts
|
|
9
|
+
// schema/schema.ts, in the Invoice Class
|
|
10
|
+
remind: method({
|
|
11
|
+
auth: 'authenticated',
|
|
12
|
+
input: z.object({ note: z.string() }),
|
|
13
|
+
output: z.object({ reminder: z.string() }),
|
|
14
|
+
execution: { durable: true },
|
|
15
|
+
})
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
A durable callable needs `authenticated` or `authorized` auth, a value input and output, and a
|
|
19
|
+
remote binding. Implement it with `defineWorkflow`; `defineAction` refuses a durable callable.
|
|
20
|
+
|
|
21
|
+
A durable Workflow receives each `file()` input field as the caller sent it: an upload receipt, a
|
|
22
|
+
string, not a file object. The Kernel checks each receipt and the field's `maxBytes` and
|
|
23
|
+
`mediaTypes` when it admits the call. A receipt lasts one hour from its upload, while the run may
|
|
24
|
+
last much longer: **attach each file the run keeps to a Node in its first Steps**, then read it from
|
|
25
|
+
that Node. See [Files in a durable Workflow](#files-in-a-durable-workflow).
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
export const remind = defineWorkflow<typeof schema>()(
|
|
29
|
+
'Invoice.remind',
|
|
30
|
+
async ({ input, self, execution, step, sleep, awaitSignal }) => {
|
|
31
|
+
const sent = await step.query(
|
|
32
|
+
'count-reminders',
|
|
33
|
+
remindersOf,
|
|
34
|
+
{ invoice: self },
|
|
35
|
+
{ as: 'executor' },
|
|
36
|
+
)
|
|
37
|
+
const reminder = await step.mutate(
|
|
38
|
+
'record',
|
|
39
|
+
recordReminder,
|
|
40
|
+
{ invoice: self, rank: sent.length + 1, note: input.note, execution: execution.id },
|
|
41
|
+
{ as: 'executor' },
|
|
42
|
+
)
|
|
43
|
+
await sleep(24 * 60 * 60_000)
|
|
44
|
+
const approval = await awaitSignal<{ readonly by: string }>('approval')
|
|
45
|
+
return { reminder: `${reminder}:${approval.by}` }
|
|
46
|
+
},
|
|
47
|
+
)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Context
|
|
51
|
+
|
|
52
|
+
| Member | Meaning |
|
|
53
|
+
| --- | --- |
|
|
54
|
+
| `input`, `self`, `domain` | As for any Workflow; `self` is the receiver of an instance Method. |
|
|
55
|
+
| `execution` | Attested facts: `id`, `function {id, version}`, `kernel`, `initiator {principal, caller}`, `receiver`. Data, never authority. |
|
|
56
|
+
| `step.run(step, execute)` | Runs `execute` once and journals its portable output; a replay returns the journaled output. `execute` receives the capabilities of an Action, acting as the executor alone: `kernel`, `graph`, `query`, `mutate`, `dependencies` and `integrations`. `step` is the Step's id, or `{ id, retry, timeoutMs }` (see [Retry budgets and timeouts](#retry-budgets-and-timeouts)). |
|
|
57
|
+
| `step.query(step, query, input, { as: 'executor' })` | One journaled [Query](queries.md), read as the executor; a replay returns the result of its first run. A Query V6 definition takes `step.query(step, query, input?)`. |
|
|
58
|
+
| `step.mutate(step, mutation, input, { as: 'executor' })` | One journaled [defined Mutation](queries.md#defining-a-mutation), written as the executor; a replay returns the result of its first commit. A Mutation of the closure form takes `step.mutate(step, mutation, input)`. |
|
|
59
|
+
| `step.parallel(declare)` | Runs the Steps `declare` declares together, in one round trip to the engine; see [Parallel Steps](#parallel-steps). |
|
|
60
|
+
| `sleep(ms)` | Durable timer, kept by the engine even while the Domain is down. |
|
|
61
|
+
| `awaitSignal(name)` | Waits for the value `Execution.signal({ name, value })` delivers once under `name`, sent before or during the wait. |
|
|
62
|
+
| `awaitSignal(name, { timeoutMs })` | Waits at most `timeoutMs`: `{ kind: 'signal', value }` or `{ kind: 'timeout' }`. |
|
|
63
|
+
| `cancelled(error)` | Whether `error` is the engine's cooperative cancellation; catch it to compensate. |
|
|
64
|
+
| `exhausted(error)` | Whether `error` is a Step that spent its retry budget, or that the Kernel refused for good; catch it to take another path. |
|
|
65
|
+
| `retryAfter(ms, cause?)` | The failure to throw inside a Step whose next attempt must wait `ms` (at most one hour), as an HTTP `Retry-After` asks. It spends an attempt. |
|
|
66
|
+
| `error(code, details)` | Declared business errors, as for any Workflow; they become the `failed` outcome. |
|
|
67
|
+
|
|
68
|
+
A durable run acts as its Domain, never as its caller: the Workflow and its Steps have no `caller`,
|
|
69
|
+
and `kernel`, `graph` and `dependencies` offer only `self`. The Kernel is reachable only inside a
|
|
70
|
+
Step, so every Kernel call is journaled and a replay never repeats it. A Step whose outcome was not
|
|
71
|
+
journaled runs again. What a retried Step repeats depends on the call:
|
|
72
|
+
|
|
73
|
+
| Call inside a Step | On a retry of the Step |
|
|
74
|
+
| --- | --- |
|
|
75
|
+
| Mutation (`step.mutate`, `mutate`, `graph.self.mutate`, `kernel.mutate`) | Carries a key derived from the Execution, the Step and its position. The Kernel commits a receipt with the write and answers with the first result, without writing again. |
|
|
76
|
+
| `kernel.invoke` or `dependencies.<alias>.self.invoke` of a durable callable | Carries such a key too, so it reaches the same child Execution. The call answers with that Execution's `ExecutionRef`. |
|
|
77
|
+
| `kernel.invoke` or `dependencies.<alias>.self.invoke` of any other callable | Carries no key, because the Kernel accepts one only for a durable Function. The call runs again, so its effects must be idempotent: declare the callee durable, or give it an identity in its input. |
|
|
78
|
+
| Integration operation, `keyed` with source `execution` | Its call id is the next key of the same sequence, and the Provider receives it as `idempotencyKey`: every attempt sends the same key. |
|
|
79
|
+
| Integration operation, `keyed` with source `input` | The Provider receives the key the decision takes from the input. |
|
|
80
|
+
| Integration operation, `safe` | Runs again. |
|
|
81
|
+
| Integration operation that may be `unsafe` | Absent from `integrations`: a retry would repeat it. An operation whose decision turns out `unsafe` is refused before its Provider runs. |
|
|
82
|
+
|
|
83
|
+
A Provider called from a Step receives no `invoke`, since no caller exists, and its `auth.mint` and
|
|
84
|
+
deadline are bounded by the Step's deadline. An operation whose replay is a function counts as
|
|
85
|
+
replayable only when that function never answers `unsafe`.
|
|
86
|
+
|
|
87
|
+
The Host keeps receipts longer than the engine keeps a run, so a Step is never retried after its
|
|
88
|
+
receipt is gone. A callable is known durable from the Schema closure of the Domain: an untyped Path,
|
|
89
|
+
or a callable outside that closure, is keyed only when the call passes its own `idempotencyKey`.
|
|
90
|
+
|
|
91
|
+
This requires a Kernel that keeps Mutation receipts. An older Kernel refuses the Mutation key.
|
|
92
|
+
|
|
93
|
+
Step ids are unique within a run. Steps and waits run one after another: the engine follows one
|
|
94
|
+
awaited operation at a time, and loses track of a run that awaits several together through
|
|
95
|
+
`Promise.all`, `allSettled`, `race` or `any`. A Step, `sleep` or `awaitSignal` started while
|
|
96
|
+
another runs is therefore refused with a `TypeError`, which pauses the run as any error between
|
|
97
|
+
Steps does. Independent reads may share one Step, whose Kernel calls are ordinary calls that
|
|
98
|
+
`Promise.all` may combine:
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
const [invoice, reminders] = await step.run('read-invoice', ({ query }) =>
|
|
102
|
+
Promise.all([
|
|
103
|
+
query(invoiceOf, { invoice: self }, { as: 'executor' }),
|
|
104
|
+
query(remindersOf, { invoice: self }, { as: 'executor' }),
|
|
105
|
+
]),
|
|
106
|
+
)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Code between Steps must be deterministic.
|
|
110
|
+
|
|
111
|
+
### Parallel Steps
|
|
112
|
+
|
|
113
|
+
Each Step awaited alone costs one round trip to the engine. `step.parallel` is the one way to run
|
|
114
|
+
several Steps together: the engine follows them as one operation, through its own combinator, and
|
|
115
|
+
they cost one round trip together.
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
const [invoice, sent, receipt] = await step.parallel((s) => [
|
|
119
|
+
s.query('read-invoice', invoiceOf, { invoice: self }, { as: 'executor' }),
|
|
120
|
+
s.query(
|
|
121
|
+
{ id: 'count-reminders', retry: { maxAttempts: 5 } },
|
|
122
|
+
remindersOf,
|
|
123
|
+
{ invoice: self },
|
|
124
|
+
{ as: 'executor' },
|
|
125
|
+
),
|
|
126
|
+
s.run('charge', ({ integrations }) => integrations.ledger.charge({ amount: 12 })),
|
|
127
|
+
])
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
`s` declares Steps with the arguments of `step.run`, `step.query` and `step.mutate`, and starts
|
|
131
|
+
nothing; `declare` returns exactly the Steps it declares, as an array. Each Step keeps its id,
|
|
132
|
+
retry budget, timeout and keys, as if it ran alone. Once every Step has settled, `step.parallel`
|
|
133
|
+
resolves with their outputs in declaration order, or throws the failure of the first failed Step in
|
|
134
|
+
that order, as that Step alone would throw it: a declared error, a `STEP_EXHAUSTED` that `exhausted`
|
|
135
|
+
recognizes, or a cancellation. The other Steps have run by then, and their effects stand. An empty
|
|
136
|
+
list resolves with `[]`. Parallel Steps do not nest, and a Step that depends on another's output
|
|
137
|
+
runs after it.
|
|
138
|
+
|
|
139
|
+
Run reads and independent effects together. Keep in sequence the effects a failure would make you
|
|
140
|
+
compensate, so the Workflow knows which ones committed.
|
|
141
|
+
|
|
142
|
+
## From an inline Workflow
|
|
143
|
+
|
|
144
|
+
The same `defineWorkflow` implements an inline and a durable Workflow; the Schema decides which.
|
|
145
|
+
Declaring `execution: { durable: true }` on a callable changes the context its Workflow receives:
|
|
146
|
+
|
|
147
|
+
| Inline Workflow | Durable Workflow |
|
|
148
|
+
| --- | --- |
|
|
149
|
+
| `query` and `mutate` in the context, under the authority `as` names (a V6 Query, and a Mutation without `as`, as the executor); `kernel`, `graph` and `dependencies`, as the executor or the caller | Only inside a Step, as the executor alone: `step.query`, `step.mutate`, or `step.run(id, ({ query, mutate, kernel, graph, dependencies }) => …)` |
|
|
150
|
+
| `integrations` in the context, with every operation | Inside `step.run` only, without the operations that may be `unsafe` |
|
|
151
|
+
| `caller` | Absent; `execution.initiator` records who started the run, as data |
|
|
152
|
+
| `execution`: `signal`, `deadline`, `idempotencyKey`, `background`, `sleep`, `request` | `execution`: `id`, `function`, `kernel`, `initiator`, `receiver`; `sleep` is a member of the context |
|
|
153
|
+
| `step.run(id, () => …)`, not journaled | `step.run`, `step.query`, `step.mutate` and `step.parallel`, journaled, each Step under its retry budget |
|
|
154
|
+
| A failing Step throws into the Workflow at once | A failing Step is attempted again within its budget, then throws `STEP_EXHAUSTED` into the Workflow |
|
|
155
|
+
| Callers receive the output | Callers receive `ExecutionRef<Output>`; the Workflow still returns the output |
|
|
156
|
+
|
|
157
|
+
The type checker reports every use of a member the durable context lacks, and every caller that
|
|
158
|
+
reads the output. Three changes it cannot see:
|
|
159
|
+
|
|
160
|
+
- A business refusal a Step throws as anything but `error(...)` is attempted again until the Step
|
|
161
|
+
spends its budget, and the Execution ends `STEP_EXHAUSTED` instead of the refusal. Turn a refusal
|
|
162
|
+
into its declared error inside the Step that detects it, not around the Step.
|
|
163
|
+
- Code between Steps runs again on every replay. A value it reads from the clock or randomness
|
|
164
|
+
differs on the next attempt; read it in a Step. `FNC-REPLAY-VALUES` warns on such a read.
|
|
165
|
+
- A caller that ignores the output, such as a View that refreshes after the call, compiles unchanged
|
|
166
|
+
but refreshes before the Execution ends. Follow the Execution, and refresh when it ends.
|
|
167
|
+
|
|
168
|
+
`createTestWorkflowEngine` (see [Testing](#testing)) shows the first two: a refusal path ends
|
|
169
|
+
`STEP_EXHAUSTED`, with what the last attempt threw in `failure`, and code whose path differs on
|
|
170
|
+
replay fails with `JournalMismatch`.
|
|
171
|
+
|
|
172
|
+
## Reads and effects
|
|
173
|
+
|
|
174
|
+
The engine retries a Step as a whole, so running it again must be safe. A Step may make several
|
|
175
|
+
reads, and the keys of the table above make its effects safe to repeat. What a Step must not do is
|
|
176
|
+
read before its effect: an effect Step builds its request only from the Workflow input and the
|
|
177
|
+
results of earlier Steps, so it reads what it needs with `step.query` first:
|
|
178
|
+
|
|
179
|
+
```ts
|
|
180
|
+
const sent = await step.query('count-reminders', remindersOf, { invoice: self }, { as: 'executor' })
|
|
181
|
+
await step.mutate('record', recordReminder, { invoice: self, rank: sent.length + 1 }, { as: 'executor' })
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
A Step can commit its effect and lose its journal entry; the engine then runs it again with the same
|
|
185
|
+
keys. The Kernel answers a Mutation from its receipt only when the request is the same. Rebuilt from a
|
|
186
|
+
read made earlier in the same Step, the request can differ, since that read now sees the Step's own
|
|
187
|
+
write: the Kernel refuses it with `MUTATION_IDEMPOTENCY_CONFLICT` on every attempt until the Step
|
|
188
|
+
spends its budget and the Execution fails, or a guard on the read takes the other branch and the
|
|
189
|
+
Execution fails although its effect committed. A read from an earlier Step replays unchanged, so the retried request is
|
|
190
|
+
identical. A read after the effect sees the same write on every attempt.
|
|
191
|
+
|
|
192
|
+
Two effects in one Step replay safely, each under its own key, but when the second fails after the
|
|
193
|
+
first committed, the Step reports only its failure and the Workflow cannot tell what to compensate.
|
|
194
|
+
Give each effect its own Step; two Mutations that can commit together are one Mutation.
|
|
195
|
+
|
|
196
|
+
The Domain linter checks these rules in a durable Workflow. `FNC-STEP-READS` reports a Step
|
|
197
|
+
that reads before its effect, unless the two take exclusive branches. `FNC-EFFECT-STEP` warns on a
|
|
198
|
+
Step where one run can make two effects, or repeat one in a loop. `FNC-STEP-RETRY` warns on a call a retried
|
|
199
|
+
Step repeats with no key: a callable the types prove not durable, an untyped Path, or `fetch`. A call
|
|
200
|
+
whose kind the source does not prove is not reported. `FNC-REPLAY-VALUES` warns on a read of the clock
|
|
201
|
+
or randomness (`Date.now()`, `new Date()`, `Math.random()`, `crypto.randomUUID()`) in the code a replay
|
|
202
|
+
runs again: the Workflow's body outside its Steps, the arguments of a Step call included.
|
|
203
|
+
|
|
204
|
+
A journaled read is the value at the moment its Step ran; a Step that runs later, after retries or a
|
|
205
|
+
pause, does not read it again. A fact that must still hold when the effect commits is a precondition
|
|
206
|
+
of the Mutation (`mutation.expect`). Map `MUTATION_PRECONDITION_FAILED` in the Mutation's `reject` to
|
|
207
|
+
a result the Workflow handles, such as a declared error; unmapped, the engine retries it until the
|
|
208
|
+
Step spends its budget. A retried Step whose Mutation already committed still receives that commit's
|
|
209
|
+
receipt, even though its precondition no longer holds.
|
|
210
|
+
|
|
211
|
+
## Files in a durable Workflow
|
|
212
|
+
|
|
213
|
+
A `file()` field of a durable callable reaches the Workflow as the upload receipt the caller sent.
|
|
214
|
+
The Kernel checked the receipt and the file against the field's `maxBytes` and `mediaTypes` when it
|
|
215
|
+
admitted the call: a refused field refuses the call with `FUNCTION_INPUT_INVALID`, the refusal's
|
|
216
|
+
code as its reason and the field's JSON Pointer as `path`, and no Execution is recorded. A replay of
|
|
217
|
+
the same idempotency key compares each file field by its content, so the same file under a fresh
|
|
218
|
+
receipt is the same call.
|
|
219
|
+
|
|
220
|
+
**Use the file fast.** A receipt serves whoever presents it, the Domain's Steps included, for one
|
|
221
|
+
hour from the upload, and no longer. Attach each file the run keeps to a Node in its first Steps,
|
|
222
|
+
before anything that may wait (a `sleep`, an `awaitSignal`, a slow call). Afterwards read it from
|
|
223
|
+
that Node, for as long as the run lasts:
|
|
224
|
+
|
|
225
|
+
```ts
|
|
226
|
+
export const importBalance = defineWorkflow<typeof schema>()(
|
|
227
|
+
'importBalance',
|
|
228
|
+
async ({ input, step }) => {
|
|
229
|
+
// First: attach the file, as the Domain, while the receipt lasts.
|
|
230
|
+
await step.mutate(
|
|
231
|
+
'attach',
|
|
232
|
+
recordBalance, // writes input.balance as the TrialBalance `source` blob Property
|
|
233
|
+
{ fiscalYear: input.fiscalYear, balance: input.balance },
|
|
234
|
+
{ as: 'executor' },
|
|
235
|
+
)
|
|
236
|
+
// Then process it. Within the hour the receipt still reads it; later, read the attached Node
|
|
237
|
+
// (`kernel.content.download({ node, property })`).
|
|
238
|
+
const lines = await step.run('count-lines', async ({ kernel }) => {
|
|
239
|
+
const { body } = await kernel.content.download({ receipt: input.balance })
|
|
240
|
+
// A Uint8Array, or chunks as they arrive.
|
|
241
|
+
const chunks = body instanceof Uint8Array ? [body] : await Array.fromAsync(body)
|
|
242
|
+
return new TextDecoder().decode(await new Blob(chunks).bytes()).split('\n').length
|
|
243
|
+
})
|
|
244
|
+
return { lines }
|
|
245
|
+
},
|
|
246
|
+
)
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
- **One hour, then refused.** A Step that presents the receipt after it expired, a retry after a
|
|
250
|
+
long engine outage included, is refused `BLOB_RECEIPT_INVALID`. The run cannot recover the file:
|
|
251
|
+
the user uploads it again.
|
|
252
|
+
- **Attach to keep the file.** The Execution keeps no file. Only the Nodes a Step attached it to
|
|
253
|
+
keep it; a file nothing attached is removed by the Host's collection some days later.
|
|
254
|
+
- **Passing it on.** A Step may pass the receipt to a child call, durable or not, while it lasts;
|
|
255
|
+
past it, attach the file and pass the Node.
|
|
256
|
+
- **No file object yet.** The Workflow receives the receipt string, not the file object an Action
|
|
257
|
+
receives (`stream()`, `text()`, `bytes()`), so the field's `maxBytes` and `mediaTypes` are checked
|
|
258
|
+
by the Kernel at the call and by the Property when a Step attaches the file, not on each read.
|
|
259
|
+
- **Keep it private.** The receipt is in the run's input, which the engine and the Execution record
|
|
260
|
+
hold. Never log it, and never return it as output.
|
|
261
|
+
|
|
262
|
+
## Testing
|
|
263
|
+
|
|
264
|
+
`createTestWorkflowEngine` from `@astrale-os/sdk/testing` runs a durable Workflow in memory with
|
|
265
|
+
the receiver a Host serves; only the engine is simulated. Each Step journals its result, every
|
|
266
|
+
attempt replays the journal, timers follow a virtual clock, signals are buffered, a failing Step is
|
|
267
|
+
retried within its budget and then fails into the Workflow, a run failing outside any Step is
|
|
268
|
+
retried until it pauses, and cancellation is cooperative.
|
|
269
|
+
|
|
270
|
+
```ts
|
|
271
|
+
import { createTestWorkflowEngine } from '@astrale-os/sdk/testing'
|
|
272
|
+
|
|
273
|
+
const engine = createTestWorkflowEngine()
|
|
274
|
+
const execution = await engine.start(remind, {
|
|
275
|
+
schema: Billing, // the resolved Schema
|
|
276
|
+
input: { note: 'soon' },
|
|
277
|
+
self: invoice, // receiver of an instance Method
|
|
278
|
+
capabilities: {
|
|
279
|
+
query: (query, input) => 2,
|
|
280
|
+
mutate: (mutation, input, { idempotencyKey }) => 'reminder-3',
|
|
281
|
+
kernel: { invoke: async (reference, input, options) => ({ id: 'execution-child' }) },
|
|
282
|
+
},
|
|
283
|
+
providers: { ledger: testLedger }, // Providers of the Workflow's Integrations
|
|
284
|
+
})
|
|
285
|
+
await engine.advance(24 * 60 * 60_000) // wake the sleeping run
|
|
286
|
+
await execution.signal('approval', { by: 'alice' })
|
|
287
|
+
expect(execution.outcome).toEqual({ kind: 'completed', value: { reminder: 'reminder-3' } })
|
|
288
|
+
await execution.replay() // the journal alone reaches the same outcome
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
| Member | Meaning |
|
|
292
|
+
| --- | --- |
|
|
293
|
+
| `capabilities` | What a Step reaches instead of a Kernel. `query` and `mutate` answer the Step's Queries and Mutations; `mutate` receives the key a Host sends. `kernel` is the Step's Session: `kernel.invoke` and every `dependencies` call reach its `invoke`, keyed for a durable callee. |
|
|
294
|
+
| `providers` | Providers bound through the Steps' key sequence, as on a Host. |
|
|
295
|
+
| `retry` option | The deployment's `durable.retry`: the budget of every Step that declares none, and with `maxAttempts` the attempts of a run failing outside any Step. |
|
|
296
|
+
| `state`, `outcome`, `failure` | `running`, `waiting`, `paused`, `completed`, `failed` or `cancelled`; the outcome as `Execution.result` answers it; what the last failed attempt threw, which a `STEP_EXHAUSTED` outcome does not carry. |
|
|
297
|
+
| `signal`, `cancel`, `resume` | As the `K.Execution` Methods; each settles the run again. |
|
|
298
|
+
| `advance(ms)` | Moves the virtual clock and settles every waiting run. |
|
|
299
|
+
| `replay()` | Runs the Workflow from its journal alone and fails if it runs a Step again, diverges or ends differently. |
|
|
300
|
+
| `interruptAfter(id)`, or the `interruptAfter` option | Loses Step `id`'s first result before the journal records it, as a crash after its effect: the engine retries the Step, which presents the same keys. |
|
|
301
|
+
| `journal`, `attempts` | The recorded entries, each Step with the times it ran, and the attempts of the run. |
|
|
302
|
+
|
|
303
|
+
A Workflow whose code between Steps is not deterministic fails its next attempt with
|
|
304
|
+
`JournalMismatch` and pauses. A retry after an attempt that spent the Step's budget does not wait
|
|
305
|
+
out its backoff, but the backoff it skips, or the delay its `retryAfter` asks for, counts toward the
|
|
306
|
+
Step's `maxDurationMs`. A wait for the platform, after a Kernel refusal that prescribes a delay or an
|
|
307
|
+
unreachable Kernel, is a timer: the run is `waiting` until `advance` reaches it. Code should await only
|
|
308
|
+
Steps and the context's own operations; the engine counts a run as waiting once it waits on a timer or
|
|
309
|
+
a signal and nothing else runs.
|
|
310
|
+
|
|
311
|
+
## Signals
|
|
312
|
+
|
|
313
|
+
A signal is delivered once per name: `Execution.signal` resolves it, a second signal of the same name
|
|
314
|
+
is refused, and a signal sent before the wait is kept for it. A bounded wait races the signal against
|
|
315
|
+
a durable timer:
|
|
316
|
+
|
|
317
|
+
```ts
|
|
318
|
+
const consent = await awaitSignal<{ readonly code: string }>('consent', { timeoutMs: 15 * 60_000 })
|
|
319
|
+
if (consent.kind === 'timeout') throw error('CONSENT_EXPIRED', {})
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
The engine journals which came first, so a replay answers the same even when the signal arrived
|
|
323
|
+
after the timeout; such a signal is kept for a later wait under the same name. Race durable waits
|
|
324
|
+
only through `awaitSignal`: `Promise.race` over `sleep` and `awaitSignal` is not journaled and does
|
|
325
|
+
not settle on the engine.
|
|
326
|
+
|
|
327
|
+
## Retry budgets and timeouts
|
|
328
|
+
|
|
329
|
+
A declared business error ends the Execution as `failed { family, code, message, details }`, with no
|
|
330
|
+
retry. Any other error a Step throws fails that attempt. What follows depends on what the attempt
|
|
331
|
+
failed on, read from the Kernel answer or the transport failure the error is, or carries as a `cause`:
|
|
332
|
+
|
|
333
|
+
| The attempt failed on | The Step |
|
|
334
|
+
| --- | --- |
|
|
335
|
+
| The platform: a Kernel refusal that prescribes a delay (`CAPACITY_EXHAUSTED`, `SERVER_DRAINING`, `INSTANCE_MAINTENANCE`) or a stale snapshot; a Kernel or Release discovery that does not answer (a network failure, HTTP `429`, `502` or `503`) to a request that did not leave, or to a Query or a keyed call; `OUTCOME_UNKNOWN` to a Query or a keyed call | Waits, and is attempted again without spending its budget, for as long as the platform stays unavailable within its `maxDurationMs`. |
|
|
336
|
+
| A request the Kernel never accepts as sent: `PARSE_ERROR`, `INVALID_REQUEST`, `METHOD_NOT_ALLOWED`, `UNSUPPORTED`, an expectation or a callable fingerprint that no longer matches, a stale maintenance session | Fails at once. |
|
|
337
|
+
| Anything else: the Step's code, a Provider, `retryAfter`, a deadline, any other Kernel refusal, an unkeyed call whose outcome is unknown | Spends an attempt, and is attempted again within its budget. |
|
|
338
|
+
|
|
339
|
+
A Query, a Mutation and an `invoke` of a durable callable repeat no effect when sent again, the last
|
|
340
|
+
two by their key, so the Step waits out their unavailability. An unkeyed `invoke` that may have
|
|
341
|
+
reached the Kernel may have run: sending it again is the Step's own risk, and spends an attempt. So
|
|
342
|
+
does any failure of an attempt that sent one, since the next attempt sends it again: an outage never
|
|
343
|
+
repeats an unkeyed `invoke` beyond the Step's budget.
|
|
344
|
+
|
|
345
|
+
A Step that spends its budget, or fails at once, throws into the Workflow; uncaught, the Execution
|
|
346
|
+
ends `failed` with code `STEP_EXHAUSTED`:
|
|
347
|
+
|
|
348
|
+
```ts
|
|
349
|
+
{ kind: 'failed', error: { code: 'STEP_EXHAUSTED', message: 'Workflow Step notify exhausted its retries.', details: { step: 'notify' } } }
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
The outcome never carries what the last attempt threw. When the Kernel refused that attempt, the
|
|
353
|
+
outcome names the refusal by its codes alone, never its message:
|
|
354
|
+
|
|
355
|
+
```ts
|
|
356
|
+
details: { step: 'archive', refusal: { code: 2002, reason: 'AUTH_INVALID' } }
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
`code` is the Kernel error code; `reason`, when the Kernel gave one, its reason code. A refusal
|
|
360
|
+
behind another error, as its `cause`, counts as well; any other failure leaves `refusal` out.
|
|
361
|
+
|
|
362
|
+
A Query read that fails in `step.query` throws its `QueryError` into the Workflow at once, from the
|
|
363
|
+
journal on a replay: what it met will not change on a retry. A read the Kernel refused is the
|
|
364
|
+
exception, a failed attempt like any refusal. Uncaught, the outcome names the `QueryError`'s code
|
|
365
|
+
and the Query's id, never its details:
|
|
366
|
+
|
|
367
|
+
```ts
|
|
368
|
+
details: { step: 'invoice', query: { code: 'NOT_FOUND', id: 'billing.invoice.find' } }
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
A Query whose relation crosses a dependency's Class the Domain does not require fails its Step
|
|
372
|
+
the same way, with the `TypeError` that names the requirement it needs. Uncaught, the outcome's
|
|
373
|
+
message carries that requirement, and `query` names the Query's id alone.
|
|
374
|
+
|
|
375
|
+
A failed Execution is never resumed: a new attempt is a new Execution, under a new key, so its Steps
|
|
376
|
+
run their effects again under new keys.
|
|
377
|
+
|
|
378
|
+
Each Step runs under the deployment's budget and timeout, or under the ones it declares:
|
|
379
|
+
|
|
380
|
+
```ts
|
|
381
|
+
await step.mutate('record', recordReminder, input, { as: 'executor' }) // the deployment's budget and timeout
|
|
382
|
+
|
|
383
|
+
try {
|
|
384
|
+
await step.run({ id: 'notify', retry: { maxAttempts: 5 }, timeoutMs: 120_000 }, ({ integrations }) =>
|
|
385
|
+
integrations.mailer.send(reminder),
|
|
386
|
+
)
|
|
387
|
+
} catch (cause) {
|
|
388
|
+
if (!exhausted(cause)) throw cause
|
|
389
|
+
await step.mutate('follow-up', recordManualFollowUp, { invoice: self }, { as: 'executor' })
|
|
390
|
+
}
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
| `retry` field | Meaning | Bounds |
|
|
394
|
+
| --- | --- | --- |
|
|
395
|
+
| `maxAttempts` | Attempts that may fail on the Step's own account, the first one included. A wait for the platform spends none. | 1 to 1,000 |
|
|
396
|
+
| `maxDurationMs` | Time from the first attempt after which a failed attempt is not retried, whatever it failed on; an attempt already scheduled still runs. The only bound on waiting for the platform. | 1 ms to 365 days |
|
|
397
|
+
| `initialIntervalMs` | Delay before the first retry, doubled on each failure. | 1 ms to one hour |
|
|
398
|
+
| `maxIntervalMs` | Longest backoff between two attempts. | `initialIntervalMs` to one day |
|
|
399
|
+
|
|
400
|
+
The limits, `maxAttempts` and `maxDurationMs`, go together: a Step that declares either replaces both
|
|
401
|
+
limits of the deployment, and the one it omits does not bound it. The budget is spent at the first
|
|
402
|
+
limit reached; a Step without `maxDurationMs` waits for the platform until it answers or the run is
|
|
403
|
+
cancelled. An interval the Step leaves out is the deployment's. `timeoutMs` bounds one attempt, its
|
|
404
|
+
Kernel calls included, from one second to ten minutes: past it, the attempt fails, what it holds is
|
|
405
|
+
aborted, and the failure spends an attempt. Each Workflow service declares to the engine an abort
|
|
406
|
+
timeout of fifteen minutes, so a Step's own timeout always ends its attempt before the engine would
|
|
407
|
+
cut it.
|
|
408
|
+
|
|
409
|
+
An attempt after a failure of the Step's own waits its backoff, which doubles with each such
|
|
410
|
+
failure. An attempt after a platform failure waits the longer of the delay the Kernel prescribes and a
|
|
411
|
+
backoff that doubles with each platform failure since the Step's last own failure. Under the default
|
|
412
|
+
intervals, a Step reaches an unavailable Kernel at most once a minute after its first minute: an hour
|
|
413
|
+
of outage costs about 65 attempts and 260 journal entries, and none of its budget. Throw
|
|
414
|
+
`retryAfter(ms, cause)` inside a Step to wait exactly `ms`, for instance on an HTTP `429` with
|
|
415
|
+
`Retry-After`; that attempt spends the budget, since only the Step knows whether its cause clears.
|
|
416
|
+
|
|
417
|
+
A run that fails outside any Step keeps the engine's pause. An input or receiver the code cannot
|
|
418
|
+
read, an output the Schema refuses, a journal whose Steps the code no longer takes, or an error
|
|
419
|
+
thrown between two Steps fails every attempt; after the deployment's `maxAttempts` the Execution is
|
|
420
|
+
`paused` until `Execution.resume()` or `Execution.cancel()`. A deployment the engine cannot reach
|
|
421
|
+
counts the same way, inside a Step or not, since its attempt of the run fails before any Workflow code
|
|
422
|
+
runs: with the default intervals, the run pauses after about fourteen minutes. `resume` attempts the
|
|
423
|
+
run again with the code served at its URL: it helps only once that code answers and can replay the
|
|
424
|
+
journal. A cooperative `cancel` attempts the run again, under the same `maxAttempts`: a run that
|
|
425
|
+
reaches an await sees the cancellation and may compensate (`cancelled(error)`); a run that fails again
|
|
426
|
+
before it awaits anything pauses again, and the Kernel then ends it `cancelled`, without compensation.
|
|
427
|
+
`cancel({ force: true })`, which the owner Domain holds, ends a run at once, without compensation.
|
|
428
|
+
|
|
429
|
+
## Redeployments
|
|
430
|
+
|
|
431
|
+
A new Release gives new calls a new engine service; running Executions keep theirs, with its URL,
|
|
432
|
+
and every attempt of a run is served by the code at that URL. A run started on one Release ends on
|
|
433
|
+
it, under the following rules.
|
|
434
|
+
|
|
435
|
+
**Serve each Release at its own URL.** `adapter-cloudflare` and `adapter-astrale` deploy each
|
|
436
|
+
Release at an immutable URL, so a run keeps the code that started it, whatever is deployed after.
|
|
437
|
+
Code redeployed in place at the same URL replays the journals of the runs in flight: the engine
|
|
438
|
+
refuses a journal whose Steps no longer match, in order and by id, and pauses the run; code with the
|
|
439
|
+
same Steps continues the run. Renaming, reordering or removing a Step that runs have journaled is
|
|
440
|
+
therefore an incompatible change in place, and no option of the Workflow declares it.
|
|
441
|
+
|
|
442
|
+
**Keep the Schema additive while runs are in flight.** A Step calls the Kernel as installed when it
|
|
443
|
+
calls, not when its run started: a Class, Function or Edge the run uses and a later install removed or
|
|
444
|
+
narrowed refuses its calls, and the Step ends `STEP_EXHAUSTED`, at once when the Kernel can never
|
|
445
|
+
accept the request, such as a callable whose fingerprint changed, otherwise once it spends its budget.
|
|
446
|
+
The install itself only delays the Step, which waits out its maintenance without spending its budget.
|
|
447
|
+
Remove them once the runs that use them have ended.
|
|
448
|
+
|
|
449
|
+
**Do not retire a Release, or remove a durable callable, while runs are in flight.** A retired
|
|
450
|
+
Release no longer answers its URL: its runs no longer progress, a signal to them times out, and a
|
|
451
|
+
cooperative `cancel` ends them `cancelled`, without compensation, once the engine has spent their
|
|
452
|
+
attempts; `cancel({ force: true })` ends them at once. A durable
|
|
453
|
+
callable a new install no longer declares has its runs cancelled by the Kernel, without
|
|
454
|
+
compensation, within minutes.
|
|
455
|
+
|
|
456
|
+
**Keep runs that call the Kernel shorter than the drain bound.** After an issuer change, the
|
|
457
|
+
replaced issuer remains accepted for the runs in flight at the change for at most the Host drain
|
|
458
|
+
bound (7 days by default), described below; a Step of such a run calling the Kernel later is
|
|
459
|
+
refused until it spends its budget, with `STEP_EXHAUSTED`. A run that only waits and journals is
|
|
460
|
+
not bounded.
|
|
461
|
+
|
|
462
|
+
A Step's credential names its Execution (the `execution` claim, `EXECUTION_CLAIM` of
|
|
463
|
+
`@astrale-os/kernel-protocol/issuer/claims`). After a consented issuer change, the Kernel keeps
|
|
464
|
+
accepting the replaced issuer for any call during the Host window (300 s by default), then only for
|
|
465
|
+
the Steps of runs that were in flight at the change and that the engine still holds, for at most
|
|
466
|
+
the Host drain bound (7 days by default). While the engine is unreachable those Steps are refused
|
|
467
|
+
as unavailable and retried. A run started after the change is never accepted on the replaced
|
|
468
|
+
issuer. The replaced deployment signs this claim itself, so it can keep calling for its in-flight
|
|
469
|
+
runs until they end or the drain bound passes; consent with `previous: 'revoke'` to cut it at once.
|
|
470
|
+
|
|
471
|
+
## Serving
|
|
472
|
+
|
|
473
|
+
`serve({ durable })` serves the engine at
|
|
474
|
+
`<public URL>/invoke/restate/<encoded Kernel issuer>/<declaration>/<service>`. Retained engine
|
|
475
|
+
services registered before issuer-prefixed paths keep their `<declaration>/<service>` callbacks.
|
|
476
|
+
Canonical requests discover their engine's signing keys at
|
|
477
|
+
`<Kernel issuer>/.well-known/astrale/workflow-engine.json` over HTTPS. The discovered document must
|
|
478
|
+
name that issuer, and the signed run must name the same Kernel before any Workflow code runs.
|
|
479
|
+
Discovery follows no redirects, has a ten-second deadline and a 16 KiB document limit, and retains
|
|
480
|
+
at most 64 issuer documents for one minute. An authentication refusal expires its cached authority
|
|
481
|
+
for the next request, at most once per minute; the receiver never replays a consumed request.
|
|
482
|
+
Invalid or unavailable discovery fails the canonical request without falling back to static keys.
|
|
483
|
+
Provide the Restate SDK Fetch build of the platform; every engine request requires its signature.
|
|
484
|
+
|
|
485
|
+
```ts
|
|
486
|
+
serve({
|
|
487
|
+
// runtime, load, identity, server…
|
|
488
|
+
durable: async () => ({
|
|
489
|
+
engine: await import('@restatedev/restate-sdk/fetch'),
|
|
490
|
+
}),
|
|
491
|
+
})
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
The provider runs only on the first engine request. Concurrent requests share initialization;
|
|
495
|
+
a successful receiver is reused, and a failed or unconfigured provider can be retried by a later
|
|
496
|
+
request. Health, release and ordinary invocation requests do not load the engine. An already
|
|
497
|
+
loaded engine can still be supplied synchronously.
|
|
498
|
+
|
|
499
|
+
| Option | Default |
|
|
500
|
+
| --- | --- |
|
|
501
|
+
| `retentionMs` | 7 days; at least the Host minimum (one day by default). |
|
|
502
|
+
| `retry` | The budget of every Step that declares none: 10 attempts from 1 s to 60 s, and no duration limit. `maxAttempts` also bounds a run failing outside any Step, which then pauses: 20 attempts when `retry` declares none. The Host caps them. |
|
|
503
|
+
| `stepTimeoutMs` | 60 s per Step attempt that declares no `timeoutMs`, including its Kernel calls; ten minutes at most. |
|
|
504
|
+
|
|
505
|
+
The provider receives the durable `Request`. Its route identifies the HTTPS Kernel whose
|
|
506
|
+
workflow-engine discovery document supplies signing authority. `DurableServing.fetch` supplies
|
|
507
|
+
that discovery capability and is captured when the receiver initializes. Static signing keys and
|
|
508
|
+
routes without a Kernel issuer are refused; they do not initialize the engine.
|
|
509
|
+
|
|
510
|
+
Without `durable`, the Domain refuses the engine and only durable calls fail. An ordinary
|
|
511
|
+
invocation of a durable callable is refused: it never runs inline.
|
|
512
|
+
|
|
513
|
+
### Cloudflare Workers
|
|
514
|
+
|
|
515
|
+
The Cloudflare adapter serves the engine itself when the Schema declares a durable callable: it
|
|
516
|
+
retains the Restate Workers build and its WebAssembly core in a separate deployed module. The
|
|
517
|
+
module is imported only on the first engine request, so frontend, health, release and ordinary
|
|
518
|
+
invocations do not initialize Restate. Callbacks discover signing authority from their Kernel issuer. Cloudflare owns
|
|
519
|
+
compilation of declared WebAssembly modules; this separation defers their instantiation and the
|
|
520
|
+
JavaScript engine's evaluation. The options above go in the adapter's `durable` parameter.
|
|
521
|
+
|
|
522
|
+
```ts
|
|
523
|
+
cloudflare({
|
|
524
|
+
namespace: { name: 'deployments', routingDomain: 'deployments.example.com' },
|
|
525
|
+
durable: { retry: { maxAttempts: 10 } },
|
|
526
|
+
})
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
Each Release is an immutable deployment with its own URL: a new Release gives new calls a new engine
|
|
530
|
+
service, and running Executions keep being served by the deployment that started them.
|