@astrale-os/sdk 0.6.0-beta.5 → 0.6.0-beta.51
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 +213 -60
- 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 +89 -33
- 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/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/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/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 +5 -3
- package/dist/application/mutation/authoring/properties.js +35 -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 +25 -0
- package/dist/application/query/execution/crossings.js +218 -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/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/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/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 +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/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 +15 -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 +31 -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 +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 +7 -6
- package/dist/execution/invocation/dispatch/context.js +11 -44
- 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 +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 +4 -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 +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 +56 -12
- 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/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/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 +8 -1
- package/dist/testing/index.js +6 -1
- package/dist/testing/load.js +1 -1
- package/dist/testing/query.d.ts +22 -0
- package/dist/testing/query.js +35 -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/imports.d.ts +0 -1
- package/dist/tooling/linter/adapters/typescript/imports.js +1 -5
- package/dist/tooling/linter/adapters/typescript/index.d.ts +3 -2
- package/dist/tooling/linter/adapters/typescript/index.js +3 -2
- 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 +1 -2
- package/dist/tooling/linter/implementations/source/callable-requirements.js +11 -16
- 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/global.js +18 -11
- package/dist/tooling/linter/implementations/source/mutations.js +146 -48
- 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/shared.d.ts +19 -5
- package/dist/tooling/linter/implementations/source/shared.js +131 -55
- package/dist/tooling/linter/implementations/source/verifiers.js +4 -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 +15 -64
- package/dist/tooling/linter/requirements/registry.js +11 -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/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 +473 -0
- package/docs/handler-dependencies.md +285 -0
- package/docs/legacy/query-v6.md +62 -0
- package/docs/queries.md +492 -0
- package/docs/release.md +155 -0
- package/docs/schema-cost.md +124 -0
- package/package.json +53 -21
- 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/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
|
@@ -1,36 +1,117 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
1
|
+
import * as errors from '@astrale-os/kernel-protocol/errors';
|
|
2
|
+
import * as release from '@astrale-os/kernel-protocol/release';
|
|
3
|
+
import { admission as acceptAdmission, admissionKey, admissionScope, authentication, credentialAuthentication, input, keepAdmission, recallAdmission, requireVia, } from './admission/index.js';
|
|
3
4
|
import { action, context, select, workflow } from './dispatch/index.js';
|
|
4
5
|
import { active, settle } from './lifecycle/index.js';
|
|
5
6
|
import { project, protocolError } from './result/index.js';
|
|
7
|
+
/** The reserved answer of a deployment that does not serve the call: its caller re-routes. */
|
|
8
|
+
const MISS = Object.freeze({ kind: 'miss' });
|
|
9
|
+
const FUNCTION_MISS = 'FUNCTION_MISS';
|
|
6
10
|
export async function invoke(request, inputConfig) {
|
|
7
|
-
active(request.context);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (snapshot === undefined ||
|
|
11
|
-
!publication.matchesReference(snapshot.publication, publication.reference(release.publication))) {
|
|
12
|
-
throw protocolError('CONFLICT', 'Invocation Publication differs from the running Release.');
|
|
11
|
+
active(request.context.execution);
|
|
12
|
+
if (!pinsRunningRelease(request, inputConfig.runtime.loaded.release)) {
|
|
13
|
+
throw protocolError('CONFLICT', 'Invocation release differs from the running Release.');
|
|
13
14
|
}
|
|
14
15
|
if (request.credential !== undefined && typeof request.credential !== 'string') {
|
|
15
16
|
throw protocolError('AUTH_INVALID', 'Credential is invalid.');
|
|
16
17
|
}
|
|
17
|
-
const
|
|
18
|
-
const selectedTarget = target(await inputConfig.authority.admit({
|
|
18
|
+
const admission = {
|
|
19
19
|
call: request.call,
|
|
20
20
|
...(request.credential === undefined ? {} : { credential: request.credential }),
|
|
21
|
-
via,
|
|
22
|
-
publication: release.publication,
|
|
21
|
+
via: requireVia(request),
|
|
23
22
|
domain: inputConfig.runtime.loaded.domain,
|
|
24
23
|
context: request.context,
|
|
25
|
-
}
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
};
|
|
25
|
+
const { cache } = inputConfig;
|
|
26
|
+
const scope = cache === undefined
|
|
27
|
+
? undefined
|
|
28
|
+
: admissionScope(inputConfig.runtime.loaded.registry, request.call);
|
|
29
|
+
if (cache === undefined || scope === undefined) {
|
|
30
|
+
return dispatchAdmitted(request, inputConfig, await admittedTarget(inputConfig, admission));
|
|
31
|
+
}
|
|
32
|
+
// The caller is verified before any kept admission is read: an unproven credential never learns
|
|
33
|
+
// whether another caller's admission is kept. A credential this verification refuses is decided
|
|
34
|
+
// as without a cache, the Kernel's admission first.
|
|
35
|
+
let established;
|
|
36
|
+
if (request.credential !== undefined) {
|
|
37
|
+
try {
|
|
38
|
+
established = await credentialAuthentication(request, inputConfig.runtime.loaded.domain, inputConfig.authority);
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return dispatchAdmitted(request, inputConfig, await admittedTarget(inputConfig, admission));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
let admitted;
|
|
45
|
+
try {
|
|
46
|
+
admitted = await recallOrAdmit(cache, scope, admission, inputConfig, established);
|
|
47
|
+
}
|
|
48
|
+
catch (cause) {
|
|
49
|
+
established?.close();
|
|
50
|
+
throw cause;
|
|
51
|
+
}
|
|
52
|
+
return dispatchAdmitted(request, inputConfig, admitted, established);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The admission of a call whose callable declares an admission age: one this deployment kept while
|
|
56
|
+
* it is younger than the age it carried, else the source Kernel's, kept for the calls that follow.
|
|
57
|
+
*/
|
|
58
|
+
async function recallOrAdmit(cache, scope, admission, inputConfig, established) {
|
|
59
|
+
let key;
|
|
60
|
+
try {
|
|
61
|
+
key = await admissionKey(scope, {
|
|
62
|
+
kernel: admission.via.issuer,
|
|
63
|
+
release: inputConfig.runtime.loaded.release.document.digest,
|
|
64
|
+
...(established === undefined
|
|
65
|
+
? {}
|
|
66
|
+
: {
|
|
67
|
+
caller: {
|
|
68
|
+
principal: established.caller.principal,
|
|
69
|
+
identity: established.caller.identity,
|
|
70
|
+
},
|
|
71
|
+
}),
|
|
72
|
+
}, admission.call);
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
// Without a key nothing is kept or read: the Kernel admits this call.
|
|
76
|
+
return admittedTarget(inputConfig, admission);
|
|
77
|
+
}
|
|
78
|
+
const kept = await recallAdmission(cache, key, scope);
|
|
79
|
+
if (kept !== undefined)
|
|
80
|
+
return kept;
|
|
81
|
+
const sentAt = Date.now();
|
|
82
|
+
const admitted = await admit(inputConfig.authority, admission);
|
|
83
|
+
if (admitted === undefined)
|
|
84
|
+
return undefined;
|
|
85
|
+
keepAdmission(cache, key, scope, admitted, sentAt, admission.context.background);
|
|
86
|
+
return admitted.target;
|
|
87
|
+
}
|
|
88
|
+
/** The target the source Kernel admits, or undefined when it no longer places the call here. */
|
|
89
|
+
async function admittedTarget(inputConfig, admission) {
|
|
90
|
+
return (await admit(inputConfig.authority, admission))?.target;
|
|
91
|
+
}
|
|
92
|
+
/** Run the admitted target: everything after admission, identical however it was admitted. */
|
|
93
|
+
async function dispatchAdmitted(request, inputConfig, admitted, established) {
|
|
94
|
+
let admittedAuthentication = established;
|
|
95
|
+
let close = established === undefined ? undefined : once(established.close);
|
|
33
96
|
try {
|
|
97
|
+
if (admitted === undefined) {
|
|
98
|
+
close?.();
|
|
99
|
+
return MISS;
|
|
100
|
+
}
|
|
101
|
+
const selected = select(inputConfig.runtime.loaded.registry, admitted);
|
|
102
|
+
if (selected === undefined) {
|
|
103
|
+
close?.();
|
|
104
|
+
return MISS;
|
|
105
|
+
}
|
|
106
|
+
if (selected.implementation.kind === 'workflow' && selected.implementation.durable) {
|
|
107
|
+
// The Kernel records a durable call as an Execution and runs it on the engine; running it
|
|
108
|
+
// inline here would silently drop durability.
|
|
109
|
+
throw protocolError('UNSUPPORTED', 'A durable Workflow runs only as a Kernel Execution.');
|
|
110
|
+
}
|
|
111
|
+
input(selected.implementation.callable, request.call.input, request.context.binary);
|
|
112
|
+
admittedAuthentication ??= await authentication(selected.implementation.callable, request, inputConfig.runtime.loaded.domain, inputConfig.authority);
|
|
113
|
+
close ??= once(admittedAuthentication.close);
|
|
114
|
+
active(request.context.execution);
|
|
34
115
|
const dispatchContext = context(request, inputConfig.runtime, admittedAuthentication, selected.self);
|
|
35
116
|
const output = selected.implementation.kind === 'action'
|
|
36
117
|
? await action(selected.implementation, dispatchContext)
|
|
@@ -38,10 +119,37 @@ export async function invoke(request, inputConfig) {
|
|
|
38
119
|
return settle(project(selected.implementation.callable, output), close);
|
|
39
120
|
}
|
|
40
121
|
catch (cause) {
|
|
41
|
-
close();
|
|
122
|
+
close?.();
|
|
42
123
|
throw cause;
|
|
43
124
|
}
|
|
44
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* The source Kernel's `Function.admit` refuses `FUNCTION_MISS` when it no longer places the call on
|
|
128
|
+
* this deployment, as for a client whose learned route still names a deployment replaced by a
|
|
129
|
+
* consented install. That refusal is answered as the reserved miss, never as a public error, so
|
|
130
|
+
* the client re-routes through its source Kernel (AM-85). Every other refusal is unchanged.
|
|
131
|
+
*/
|
|
132
|
+
async function admit(authority, admission) {
|
|
133
|
+
let admitted;
|
|
134
|
+
try {
|
|
135
|
+
admitted = await authority.admit(admission);
|
|
136
|
+
}
|
|
137
|
+
catch (cause) {
|
|
138
|
+
if (refusedAsMiss(cause))
|
|
139
|
+
return undefined;
|
|
140
|
+
throw cause;
|
|
141
|
+
}
|
|
142
|
+
return acceptAdmission(admitted);
|
|
143
|
+
}
|
|
144
|
+
function refusedAsMiss(cause) {
|
|
145
|
+
return (cause instanceof errors.ProtocolError &&
|
|
146
|
+
errors.reasonOf(cause.payload.data)?.code === FUNCTION_MISS);
|
|
147
|
+
}
|
|
148
|
+
/** Execution answers only for the exact release pinned by the Kernel Server snapshot. */
|
|
149
|
+
function pinsRunningRelease(request, running) {
|
|
150
|
+
return (request.release !== undefined &&
|
|
151
|
+
release.matchesReference(request.release.release, release.reference(running.document)));
|
|
152
|
+
}
|
|
45
153
|
function once(operation) {
|
|
46
154
|
let called = false;
|
|
47
155
|
return () => {
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import type { HandlerResult
|
|
2
|
-
|
|
1
|
+
import type { HandlerResult } from '@astrale-os/kernel-server';
|
|
2
|
+
/** The bounds of one unit of work: an invocation, or one attempt of a durable Step. */
|
|
3
|
+
export interface Lifetime {
|
|
4
|
+
readonly signal: AbortSignal;
|
|
5
|
+
/** Absolute Unix time in milliseconds. */
|
|
6
|
+
readonly deadline: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function active(lifetime: Lifetime): void;
|
|
3
9
|
/** Close authenticated resources after finite results or stream settlement. */
|
|
4
10
|
export declare function settle(result: HandlerResult, close: () => void): HandlerResult;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { protocolError } from '../result/index.js';
|
|
2
|
-
export function active(
|
|
3
|
-
if (
|
|
2
|
+
export function active(lifetime) {
|
|
3
|
+
if (lifetime.signal.aborted) {
|
|
4
4
|
throw protocolError('CANCELLED', 'Invocation was cancelled.');
|
|
5
5
|
}
|
|
6
|
-
if (Date.now() >=
|
|
6
|
+
if (Date.now() >= lifetime.deadline) {
|
|
7
7
|
throw protocolError('DEADLINE_EXCEEDED', 'Invocation deadline was exceeded.');
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { active, settle } from './active.js';
|
|
1
|
+
export { active, settle, type Lifetime } from './active.js';
|
|
@@ -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;
|
|
@@ -1,24 +1,11 @@
|
|
|
1
1
|
import * as errors from '@astrale-os/kernel-protocol/errors';
|
|
2
|
+
import { QueryError } from '../../../application/query/execution/error.js';
|
|
2
3
|
import { ClientError, MissError, ProtocolError as ClientProtocolError, ResponseError, SessionError, StaleRouteError, TransportError, } from '../../../platform/client/index.js';
|
|
3
4
|
const PUBLIC_DIAGNOSTICS = new Set(['VALUE_SCHEMA_INSTANCE_INVALID', 'VS_NUMBER_DOMAIN']);
|
|
4
5
|
const PUBLIC_ERROR_CODES = new Set(Object.values(errors.CODES));
|
|
5
6
|
const PUBLIC_ERROR_NAMES = new Map(Object.entries(errors.CODES).map(([name, code]) => [code, name]));
|
|
6
7
|
const MAXIMUM_DIAGNOSTICS = 32;
|
|
7
8
|
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
9
|
export class InvocationDefect extends Error {
|
|
23
10
|
code;
|
|
24
11
|
name = 'InvocationDefect';
|
|
@@ -62,8 +49,9 @@ export function projectError(input) {
|
|
|
62
49
|
? input
|
|
63
50
|
: protocolError('INTERNAL_ERROR', 'Internal application error.');
|
|
64
51
|
}
|
|
65
|
-
|
|
66
|
-
|
|
52
|
+
// A v7 read the Kernel refused reaches the caller as that refusal, as a V6 read's did.
|
|
53
|
+
if (input instanceof QueryError && input.cause instanceof ResponseError) {
|
|
54
|
+
return projectError(input.cause);
|
|
67
55
|
}
|
|
68
56
|
if (input instanceof ResponseError) {
|
|
69
57
|
if (!PUBLIC_ERROR_CODES.has(input.code)) {
|
|
@@ -1,4 +1,5 @@
|
|
|
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
|
+
export { reportUndeclaredDefinedError } from './undeclared.js';
|
|
4
5
|
export { validateInput, validateOutput } from './validate.js';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { inputError, InvocationDefect,
|
|
1
|
+
export { inputError, InvocationDefect, projectError, protocolError } from './errors.js';
|
|
2
2
|
export { project } from './project.js';
|
|
3
|
+
export { reportUndeclaredDefinedError } from './undeclared.js';
|
|
3
4
|
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;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Log a Query or Mutation's declared error that reaches a Function which does not re-declare it,
|
|
3
|
+
* before the Server redacts it as an internal error: its code, the id of the Query or Mutation and
|
|
4
|
+
* the Function, never its details, which a read as the executor may fill with what the caller may
|
|
5
|
+
* not read.
|
|
6
|
+
*/
|
|
7
|
+
export declare function reportUndeclaredDefinedError(cause: unknown, address: string): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { definedErrorOf } from '../../../application/error/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Log a Query or Mutation's declared error that reaches a Function which does not re-declare it,
|
|
4
|
+
* before the Server redacts it as an internal error: its code, the id of the Query or Mutation and
|
|
5
|
+
* the Function, never its details, which a read as the executor may fill with what the caller may
|
|
6
|
+
* not read.
|
|
7
|
+
*/
|
|
8
|
+
export function reportUndeclaredDefinedError(cause, address) {
|
|
9
|
+
const raised = definedErrorOf(cause);
|
|
10
|
+
if (raised === undefined)
|
|
11
|
+
return;
|
|
12
|
+
// oxlint-disable-next-line no-console
|
|
13
|
+
console.error('[sdk] Query or Mutation error not re-declared by its Function', {
|
|
14
|
+
code: raised.code,
|
|
15
|
+
id: raised.id,
|
|
16
|
+
function: address,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
@@ -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();
|