@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,150 @@
|
|
|
1
|
+
import { RelationRead, RootRead } from '../../query/handles/plan.js';
|
|
2
|
+
import { rangeRead } from '../../query/handles/reads.js';
|
|
3
|
+
import { QUERY } from '../../query/language/query.js';
|
|
4
|
+
/** The fields of a root its range keeps, and those its ordered list keeps, in grammar order. */
|
|
5
|
+
const RANGE = ['nodes', 'edges', 'as', 'where'];
|
|
6
|
+
const ORDERED = [...RANGE, 'orderBy'];
|
|
7
|
+
/** The fields of a root by family: a list's, and a range's (`exists`, `count`). */
|
|
8
|
+
const LIST_FIELDS = new Set([...ORDERED, 'select', 'with', 'limit']);
|
|
9
|
+
const RANGE_FIELDS = new Set(RANGE);
|
|
10
|
+
const FAMILIES = ['list', 'exists', 'count'];
|
|
11
|
+
/** `none` and `exists`: whether the range has a root. */
|
|
12
|
+
export function existsGuard(range, expected) {
|
|
13
|
+
return guard({ kind: 'exists', document: { query: QUERY, exists: root(range, RANGE) }, expected });
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* `count`: the number of the range's roots lies in the bounds. The document counts up to the
|
|
17
|
+
* largest bound, and at least one, so the Kernel tells every bound from the count it reads.
|
|
18
|
+
*/
|
|
19
|
+
export function countGuard(range, bounds) {
|
|
20
|
+
const { atLeast, atMost } = countBounds(bounds);
|
|
21
|
+
const upTo = Math.max(1, atLeast ?? 0, atMost ?? 0);
|
|
22
|
+
return guard({
|
|
23
|
+
kind: 'count',
|
|
24
|
+
document: { query: QUERY, count: root(range, RANGE), upTo },
|
|
25
|
+
...(atLeast === undefined ? {} : { atLeast }),
|
|
26
|
+
...(atMost === undefined ? {} : { atMost }),
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/** `unchanged`: the range's root list is exactly these identities, in its order. */
|
|
30
|
+
export function sequenceGuard(range, ids) {
|
|
31
|
+
if (!Array.isArray(ids)) {
|
|
32
|
+
throw new TypeError('An unchanged guard names the identities of the list, in its order: an array.');
|
|
33
|
+
}
|
|
34
|
+
const list = root(range, ORDERED);
|
|
35
|
+
const edges = list.edges !== undefined;
|
|
36
|
+
for (const id of ids)
|
|
37
|
+
if (edges ? !isEdgeKey(id) : typeof id !== 'string') {
|
|
38
|
+
throw new TypeError(`An unchanged guard names each root by its identity, as its read returned it: ${edges ? 'an EdgeKey ({ source, target, class }) per Edge' : 'a NodeId per Node'}, \`rows.map((row) => row.id)\`.`);
|
|
39
|
+
}
|
|
40
|
+
return guard({
|
|
41
|
+
kind: 'sequence',
|
|
42
|
+
document: { query: QUERY, list },
|
|
43
|
+
equals: Object.freeze([...ids]),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The fields of the range's root among `keep`, in grammar order, frozen. A field the grammar does
|
|
48
|
+
* not name is refused, never dropped: dropping a misspelled `where` would widen the guard.
|
|
49
|
+
*/
|
|
50
|
+
function root(range, keep) {
|
|
51
|
+
const document = documentOf(range, keep === ORDERED);
|
|
52
|
+
const families = FAMILIES.filter((family) => document[family] !== undefined);
|
|
53
|
+
if (families.length !== 1)
|
|
54
|
+
invalidRange();
|
|
55
|
+
const family = families[0];
|
|
56
|
+
const extra = Object.keys(document).find((key) => key !== 'query' && key !== family && !(family === 'count' && key === 'upTo'));
|
|
57
|
+
if (extra !== undefined)
|
|
58
|
+
unknownField(extra);
|
|
59
|
+
const read = document[family];
|
|
60
|
+
if (read === null || typeof read !== 'object' || Array.isArray(read))
|
|
61
|
+
invalidRange();
|
|
62
|
+
const fields = read;
|
|
63
|
+
const known = family === 'list' ? LIST_FIELDS : RANGE_FIELDS;
|
|
64
|
+
const unknown = Object.keys(fields).find((key) => !known.has(key));
|
|
65
|
+
if (unknown !== undefined)
|
|
66
|
+
unknownField(`${family}.${unknown}`);
|
|
67
|
+
if ((fields.nodes === undefined) === (fields.edges === undefined)) {
|
|
68
|
+
throw new TypeError("A guard's range starts from `nodes` or from `edges`, exactly one.");
|
|
69
|
+
}
|
|
70
|
+
if (fields.with !== undefined && !Array.isArray(fields.with))
|
|
71
|
+
unknownField(`${family}.with`);
|
|
72
|
+
if (Array.isArray(fields.with) && fields.with.some(isRequired)) {
|
|
73
|
+
throw new TypeError("A guard reads its range's roots without their relations, and a required one narrows the " +
|
|
74
|
+
'roots: write it as a condition, `.where((t) => t.via(edge).exists())`.');
|
|
75
|
+
}
|
|
76
|
+
const out = {};
|
|
77
|
+
for (const name of keep)
|
|
78
|
+
if (fields[name] !== undefined)
|
|
79
|
+
out[name] = fields[name];
|
|
80
|
+
return Object.freeze(out);
|
|
81
|
+
}
|
|
82
|
+
/** The canonical document of a range, `ordered` or not, or the canonical v7 Query itself. */
|
|
83
|
+
function documentOf(range, ordered) {
|
|
84
|
+
const read = rangeRead(range, ordered);
|
|
85
|
+
if (read !== undefined) {
|
|
86
|
+
if (read.plan.empty || read.plan.document === undefined) {
|
|
87
|
+
throw new TypeError('A guard on a range whose condition matches nothing (`in([])`, `id.in([])`) has no ' +
|
|
88
|
+
'document to send: decide that guard in build, from the input.');
|
|
89
|
+
}
|
|
90
|
+
return read.plan.document;
|
|
91
|
+
}
|
|
92
|
+
if (range instanceof RelationRead) {
|
|
93
|
+
throw new TypeError("A guard reads a root, and a relation is read per parent: start the guard's range from a " +
|
|
94
|
+
'Class handle, `d.<Class>`.');
|
|
95
|
+
}
|
|
96
|
+
if (range instanceof RootRead) {
|
|
97
|
+
throw new TypeError(range.plan.verb === 'document'
|
|
98
|
+
? `A guard takes a canonical ${QUERY} Query itself, not \`d.document\` of it.`
|
|
99
|
+
: "A guard takes a range, not a read: the Class handle after `where`, `union` and `orderBy`, `d.<Class>.where(…)`, with no verb. A verb's bound would not reach the guard.");
|
|
100
|
+
}
|
|
101
|
+
const document = range;
|
|
102
|
+
if (document === null || typeof document !== 'object' || document.query !== QUERY)
|
|
103
|
+
invalidRange();
|
|
104
|
+
return document;
|
|
105
|
+
}
|
|
106
|
+
function invalidRange() {
|
|
107
|
+
throw new TypeError(`A guard takes a range built from the handles, \`d.<Class>.where(…)\`, or a canonical ${QUERY} Query.`);
|
|
108
|
+
}
|
|
109
|
+
function unknownField(path) {
|
|
110
|
+
throw new TypeError(`A guard's Query holds ${path}, which the ${QUERY} grammar does not name there: a guard is never wider than its Query, so it is refused rather than dropped.`);
|
|
111
|
+
}
|
|
112
|
+
function isEdgeKey(id) {
|
|
113
|
+
const key = id;
|
|
114
|
+
return (key !== null &&
|
|
115
|
+
typeof key === 'object' &&
|
|
116
|
+
typeof key.source === 'string' &&
|
|
117
|
+
typeof key.target === 'string' &&
|
|
118
|
+
typeof key.class === 'string');
|
|
119
|
+
}
|
|
120
|
+
function isRequired(branch) {
|
|
121
|
+
return branch?.mode === 'required';
|
|
122
|
+
}
|
|
123
|
+
function countBounds(bounds) {
|
|
124
|
+
if (bounds === null || typeof bounds !== 'object') {
|
|
125
|
+
const exactly = bound(bounds, 'count');
|
|
126
|
+
return { atLeast: exactly, atMost: exactly };
|
|
127
|
+
}
|
|
128
|
+
const fields = (bounds ?? {});
|
|
129
|
+
const atLeast = fields.atLeast === undefined ? undefined : bound(fields.atLeast, 'atLeast');
|
|
130
|
+
const atMost = fields.atMost === undefined ? undefined : bound(fields.atMost, 'atMost');
|
|
131
|
+
if (atLeast === undefined && atMost === undefined) {
|
|
132
|
+
throw new TypeError('A count guard is bounded at least once: `atLeast`, `atMost` or both.');
|
|
133
|
+
}
|
|
134
|
+
if (atLeast !== undefined && atMost !== undefined && atLeast > atMost) {
|
|
135
|
+
throw new TypeError(`A count guard's atLeast (${atLeast}) exceeds its atMost (${atMost}).`);
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
...(atLeast === undefined ? {} : { atLeast }),
|
|
139
|
+
...(atMost === undefined ? {} : { atMost }),
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function bound(value, name) {
|
|
143
|
+
if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < 0) {
|
|
144
|
+
throw new TypeError(`A count guard's ${name} is a non-negative integer.`);
|
|
145
|
+
}
|
|
146
|
+
return value;
|
|
147
|
+
}
|
|
148
|
+
function guard(input) {
|
|
149
|
+
return Object.freeze(input);
|
|
150
|
+
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export { richMutationBuilder, type
|
|
1
|
+
export { richMutationBuilder, type BuilderForm, type DefinedMutationBuilder, type RichMutationBuilder, } from './builder.js';
|
|
2
2
|
export type { CreatedNode, ExistingEndpoint, MutationEndpoint } from './endpoint.js';
|
|
3
3
|
export type { RichPropertyConditions, RichPropertyDelta, RichPropertyInput, RichPropertyName, } from './properties.js';
|
|
4
|
-
export type {
|
|
4
|
+
export type { CountBounds, GuardIdentity, GuardRange, PreconditionOptions } from './guard.js';
|
|
5
|
+
export { preconditionNames, type PreconditionNames } from './names.js';
|
|
6
|
+
export type { ClosureMutationBuilder, EdgeSelector } from '../legacy/v6/builder.js';
|
|
7
|
+
export type { QueryPrecondition } from '../legacy/v6/precondition.js';
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { richMutationBuilder } from './builder.js';
|
|
1
|
+
export { richMutationBuilder, } from './builder.js';
|
|
2
|
+
export { preconditionNames } from './names.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The names a Mutation gives its preconditions, and the name of the one a refusal points at.
|
|
3
|
+
*
|
|
4
|
+
* The Kernel points at a failed precondition by its index in the Mutation's `preconditions`, which
|
|
5
|
+
* the Mutation document orders by canonical JSON, not as written. So a name is not kept by
|
|
6
|
+
* position: each named precondition is built again on its own, with the Mutation's writes, and
|
|
7
|
+
* its entry is matched by value against the entry the refusal points at.
|
|
8
|
+
*/
|
|
9
|
+
import type { MutationBuilder } from '@astrale-os/kernel-core/graph/mutate';
|
|
10
|
+
import { MutationAST } from '@astrale-os/kernel-core/graph/mutate';
|
|
11
|
+
export interface PreconditionNames {
|
|
12
|
+
/** `core`, its every call kept so that a named precondition can be built again on its own. */
|
|
13
|
+
track(core: MutationBuilder): MutationBuilder;
|
|
14
|
+
/** Gives `name` to the one precondition `write` adds; a name is unique in its Mutation. */
|
|
15
|
+
name(name: string | undefined, write: () => void): void;
|
|
16
|
+
/** The name of the precondition at `index` of the built Mutation, when it has one. */
|
|
17
|
+
at(ast: MutationAST, index: number): string | undefined;
|
|
18
|
+
}
|
|
19
|
+
export declare function preconditionNames(): PreconditionNames;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { MutationAST } from '@astrale-os/kernel-core/graph/mutate';
|
|
2
|
+
import { equal } from '@astrale-os/kernel-dsl/value';
|
|
3
|
+
export function preconditionNames() {
|
|
4
|
+
const steps = [];
|
|
5
|
+
const used = new Set();
|
|
6
|
+
let pending;
|
|
7
|
+
const precondition = (core, call) => {
|
|
8
|
+
const name = pending;
|
|
9
|
+
pending = undefined;
|
|
10
|
+
call(core);
|
|
11
|
+
steps.push({ call, precondition: name === undefined ? {} : { name } });
|
|
12
|
+
};
|
|
13
|
+
const write = (core, call) => {
|
|
14
|
+
const result = call(core);
|
|
15
|
+
steps.push({ call });
|
|
16
|
+
return result;
|
|
17
|
+
};
|
|
18
|
+
return Object.freeze({
|
|
19
|
+
track(core) {
|
|
20
|
+
const tracked = Object.freeze({
|
|
21
|
+
expect: Object.freeze({
|
|
22
|
+
node: (input) => (precondition(core, (to) => to.expect.node(input)), tracked),
|
|
23
|
+
edge: (input) => (precondition(core, (to) => to.expect.edge(input)), tracked),
|
|
24
|
+
query: (input) => (precondition(core, (to) => to.expect.query(input)), tracked),
|
|
25
|
+
}),
|
|
26
|
+
createNode: (input) => write(core, (to) => to.createNode(input)),
|
|
27
|
+
updateNode: (input) => (write(core, (to) => to.updateNode(input)), tracked),
|
|
28
|
+
deleteNode: (input) => (write(core, (to) => to.deleteNode(input)), tracked),
|
|
29
|
+
createEdge: (input) => (write(core, (to) => to.createEdge(input)), tracked),
|
|
30
|
+
updateEdge: (input) => (write(core, (to) => to.updateEdge(input)), tracked),
|
|
31
|
+
deleteEdge: (input) => (write(core, (to) => to.deleteEdge(input)), tracked),
|
|
32
|
+
});
|
|
33
|
+
return tracked;
|
|
34
|
+
},
|
|
35
|
+
name(name, add) {
|
|
36
|
+
if (name === undefined)
|
|
37
|
+
return add();
|
|
38
|
+
if (typeof name !== 'string' || name.length === 0) {
|
|
39
|
+
throw new TypeError("A precondition's name is a non-empty string.");
|
|
40
|
+
}
|
|
41
|
+
if (used.has(name)) {
|
|
42
|
+
throw new TypeError(`Two preconditions of one Mutation are named "${name}".`);
|
|
43
|
+
}
|
|
44
|
+
used.add(name);
|
|
45
|
+
pending = name;
|
|
46
|
+
try {
|
|
47
|
+
add();
|
|
48
|
+
}
|
|
49
|
+
finally {
|
|
50
|
+
pending = undefined;
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
at(ast, index) {
|
|
54
|
+
const failed = ast.preconditions[index];
|
|
55
|
+
if (failed === undefined)
|
|
56
|
+
return undefined;
|
|
57
|
+
const writes = steps.filter((step) => step.precondition === undefined);
|
|
58
|
+
for (const step of steps) {
|
|
59
|
+
const name = step.precondition?.name;
|
|
60
|
+
if (name === undefined)
|
|
61
|
+
continue;
|
|
62
|
+
const alone = entryAlone(step, writes);
|
|
63
|
+
if (alone !== undefined && equal(alone, failed))
|
|
64
|
+
return name;
|
|
65
|
+
}
|
|
66
|
+
return undefined;
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/** The entry `step`'s precondition has in a Mutation of the writes and it alone. */
|
|
71
|
+
function entryAlone(step, writes) {
|
|
72
|
+
try {
|
|
73
|
+
const ast = MutationAST.build((core) => {
|
|
74
|
+
step.call(core);
|
|
75
|
+
for (const write of writes)
|
|
76
|
+
write.call(core);
|
|
77
|
+
});
|
|
78
|
+
return ast.preconditions[0];
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
import type { MutationPropsInput } from '@astrale-os/kernel-core/graph/mutate';
|
|
2
2
|
import type { PropertyInputOf, ResolvedClass, ResolvedProperty } from '@astrale-os/kernel-dsl/v1';
|
|
3
|
-
|
|
3
|
+
import { PropertyValues } from '@astrale-os/kernel-dsl/v1/language';
|
|
4
|
+
import type { schema } from '../../../platform/schema/index.js';
|
|
5
|
+
import type { StoredPropertyInputOf } from '../../../platform/schema/property-input.js';
|
|
6
|
+
import type { ReceivedFile } from '../../file/index.js';
|
|
7
|
+
/**
|
|
8
|
+
* The values a Mutation writes. A blob Property takes an upload receipt, or a file object a
|
|
9
|
+
* handler received, which writes its receipt.
|
|
10
|
+
*/
|
|
11
|
+
export type RichPropertyInput<Class> = {
|
|
12
|
+
[Name in keyof PropertyInputOf<Class>]: AttachableBlob<PropertyInputOf<Class>[Name]>;
|
|
13
|
+
};
|
|
14
|
+
/** A blob write also takes a received file object, as its receipt. */
|
|
15
|
+
type AttachableBlob<Value> = [Extract<Value, schema.values.BlobReceipt>] extends [never] ? Value : Value | ReceivedFile;
|
|
4
16
|
export type RichPropertyName<Class> = Extract<keyof PropertyInputOf<Class>, string>;
|
|
5
17
|
export interface RichPropertyConditions<Class> {
|
|
6
|
-
readonly equals?:
|
|
18
|
+
readonly equals?: StoredPropertyInputOf<Class>;
|
|
7
19
|
readonly absent?: readonly RichPropertyName<Class>[];
|
|
8
20
|
}
|
|
9
21
|
export interface RichPropertyDelta<Class> {
|
|
@@ -12,11 +24,12 @@ export interface RichPropertyDelta<Class> {
|
|
|
12
24
|
}
|
|
13
25
|
export declare function properties<Class extends ResolvedClass>(selected: Class, input: RichPropertyInput<Class>): MutationPropsInput;
|
|
14
26
|
export declare function conditions<Class extends ResolvedClass>(selected: Class, input: RichPropertyConditions<Class>): Readonly<{
|
|
15
|
-
equals?:
|
|
27
|
+
equals?: PropertyValues | undefined;
|
|
16
28
|
absent?: readonly `${string}:class.${string}.property.${string}`[] | undefined;
|
|
17
29
|
}>;
|
|
18
30
|
export declare function delta<Class extends ResolvedClass>(selected: Class, input: RichPropertyDelta<Class>): Readonly<{
|
|
19
|
-
set: Readonly<Record<`${string}:class.${string}.property.${string}`, import("@astrale-os/kernel-dsl/
|
|
31
|
+
set: Readonly<Record<`${string}:class.${string}.property.${string}`, import("@astrale-os/kernel-dsl/v1/language").PropertyValue>>;
|
|
20
32
|
unset: readonly `${string}:class.${string}.property.${string}`[];
|
|
21
33
|
}>;
|
|
22
34
|
export declare function resolvedProperty<Class extends ResolvedClass>(selected: Class, name: RichPropertyName<Class>): ResolvedProperty;
|
|
35
|
+
export {};
|
|
@@ -1,10 +1,42 @@
|
|
|
1
1
|
import { PropertyKey } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
2
|
+
import { PropertyValues } from '@astrale-os/kernel-dsl/v1/language';
|
|
3
|
+
import { isReceivedFile } from '../../file/index.js';
|
|
2
4
|
export function properties(selected, input) {
|
|
3
|
-
|
|
5
|
+
const ordinary = Object.create(null);
|
|
6
|
+
const receipts = [];
|
|
7
|
+
const sources = new Map();
|
|
8
|
+
for (const [name, value] of Object.entries(input)) {
|
|
9
|
+
const property = resolvedProperty(selected, name);
|
|
10
|
+
const previous = sources.get(property.key);
|
|
11
|
+
if (previous !== undefined) {
|
|
12
|
+
throw new TypeError(`Property ${property.key} is supplied through both ${JSON.stringify(previous)} and ${JSON.stringify(name)}.`);
|
|
13
|
+
}
|
|
14
|
+
sources.set(property.key, name);
|
|
15
|
+
if (isBlobProperty(property)) {
|
|
16
|
+
// A received file attaches as its upload receipt.
|
|
17
|
+
const receipt = isReceivedFile(value) ? value.receipt : value;
|
|
18
|
+
if (typeof receipt !== 'string') {
|
|
19
|
+
throw new TypeError(`Blob Property ${property.key} requires an upload receipt or a received file.`);
|
|
20
|
+
}
|
|
21
|
+
receipts.push([property.key, receipt]);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
ordinary[name] = value;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
// Blob receipts are admitted by the Kernel executor. A property's ordinary validator expects
|
|
28
|
+
// the stored Ref, so run it only for ordinary write values before combining the two sets.
|
|
29
|
+
const admitted = selected.properties.from(ordinary);
|
|
30
|
+
return receipts.length === 0
|
|
31
|
+
? admitted
|
|
32
|
+
: PropertyValues.create([
|
|
33
|
+
...Object.entries(admitted).map(([key, value]) => [PropertyKey(key), value]),
|
|
34
|
+
...receipts,
|
|
35
|
+
]);
|
|
4
36
|
}
|
|
5
37
|
export function conditions(selected, input) {
|
|
6
38
|
return Object.freeze({
|
|
7
|
-
...(input.equals === undefined ? {} : { equals: properties(
|
|
39
|
+
...(input.equals === undefined ? {} : { equals: selected.properties.from(input.equals) }),
|
|
8
40
|
...(input.absent === undefined
|
|
9
41
|
? {}
|
|
10
42
|
: {
|
|
@@ -12,6 +44,10 @@ export function conditions(selected, input) {
|
|
|
12
44
|
}),
|
|
13
45
|
});
|
|
14
46
|
}
|
|
47
|
+
function isBlobProperty(property) {
|
|
48
|
+
const contract = property.definition.schema;
|
|
49
|
+
return (contract !== null && typeof contract === 'object' && contract['x-astrale-value-kind'] === 'blob');
|
|
50
|
+
}
|
|
15
51
|
export function delta(selected, input) {
|
|
16
52
|
return Object.freeze({
|
|
17
53
|
set: properties(selected, input.set ?? {}),
|
|
@@ -12,9 +12,10 @@ export type StatePropertyTopology<Class extends ResolvedClass<'node'>, Property
|
|
|
12
12
|
}>>;
|
|
13
13
|
export type StateOfTopology<Topology extends StateTopology> = Extract<keyof Topology['transitions'], string>;
|
|
14
14
|
export type EventOfTopology<Topology extends StateTopology, State extends StateOfTopology<Topology>> = State extends StateOfTopology<Topology> ? Extract<keyof Topology['transitions'][State], string> : never;
|
|
15
|
-
|
|
15
|
+
/** `Selected` is how the input names `Class`: the resolved Class, or its handle (`d.<Class>`). */
|
|
16
|
+
export interface StateTransitionInput<Class extends ResolvedClass<'node'>, Property extends StatePropertyName<Class>, From extends StateOfTopology<StatePropertyTopology<Class, Property>>, Event extends EventOfTopology<StatePropertyTopology<Class, Property>, From>, Selected = Class> {
|
|
16
17
|
readonly node: ExistingEndpoint;
|
|
17
|
-
readonly class:
|
|
18
|
+
readonly class: Selected;
|
|
18
19
|
readonly property: Property;
|
|
19
20
|
readonly from: From;
|
|
20
21
|
readonly event: Event;
|
|
@@ -49,7 +49,10 @@ export function authorStateTransition(core, input) {
|
|
|
49
49
|
class: selectedClassKey,
|
|
50
50
|
props: conditions(selectedClass, {
|
|
51
51
|
...(suppliedAbsent === undefined ? {} : { absent: suppliedAbsent }),
|
|
52
|
-
equals: {
|
|
52
|
+
equals: {
|
|
53
|
+
...suppliedEquals,
|
|
54
|
+
...from,
|
|
55
|
+
},
|
|
53
56
|
}),
|
|
54
57
|
});
|
|
55
58
|
core.updateNode({
|
|
@@ -1,12 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
/**
|
|
2
|
+
* `defineMutation<Schema>()`: one name for both forms. A string id first defines a Mutation
|
|
3
|
+
* (D31); a function first defines a Mutation of the closure form, deprecated, which stays in
|
|
4
|
+
* `legacy/v6`. A defined Mutation is inert: its id and the errors it declares are public, and what it
|
|
5
|
+
* writes is kept for the runtime.
|
|
6
|
+
*/
|
|
7
|
+
import type { schema } from '../../platform/schema/index.js';
|
|
8
|
+
import type { MutationProjector } from './legacy/v6/define.js';
|
|
9
|
+
import type { DefinedMutationFactory } from './mutation.js';
|
|
10
|
+
type Callback = (...parameters: never[]) => unknown;
|
|
11
|
+
/** What a defined Mutation writes and answers: its `build`, `output` and `reject`. */
|
|
12
|
+
export interface MutationSpec {
|
|
13
|
+
/** Receives `(input, d, mutation)`. */
|
|
14
|
+
readonly build: Callback;
|
|
15
|
+
readonly output?: Callback;
|
|
16
|
+
readonly reject?: Callback;
|
|
8
17
|
}
|
|
9
|
-
/**
|
|
10
|
-
export declare function
|
|
11
|
-
|
|
18
|
+
/** The `build`, `output` and `reject` of a defined Mutation; `undefined` for anything else. */
|
|
19
|
+
export declare function mutationSpecOf(mutation: unknown): MutationSpec | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Define a Mutation: `defineMutation<Schema>()('issues.issue.open', { build, output?, reject?,
|
|
22
|
+
* errors? })`. The closure form, `defineMutation<Schema>()((domain) => ({ id, build, project? }))`,
|
|
23
|
+
* stays, deprecated.
|
|
24
|
+
*/
|
|
25
|
+
export declare function defineMutation<Schema extends schema.DomainSchema>(): DefinedMutationFactory<Schema> & MutationProjector<Schema>;
|
|
12
26
|
export {};
|
|
@@ -1,56 +1,52 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const mutation = Object.freeze({ kind: 'mutation' });
|
|
10
|
-
projectors.set(mutation, project);
|
|
11
|
-
return mutation;
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
export function realizeMutation(mutation, domain) {
|
|
15
|
-
const project = projectors.get(mutation);
|
|
16
|
-
if (project === undefined)
|
|
17
|
-
throw new TypeError('Mutation must be produced by defineMutation.');
|
|
18
|
-
if (!isDomain(domain))
|
|
19
|
-
throw new TypeError('Mutation projection requires an admitted Domain.');
|
|
20
|
-
let byDomain = realized.get(mutation);
|
|
21
|
-
const cached = byDomain?.get(domain);
|
|
22
|
-
if (cached !== undefined)
|
|
23
|
-
return cached;
|
|
24
|
-
const authored = project(domain);
|
|
25
|
-
if (isPromiseLike(authored))
|
|
26
|
-
throw new TypeError('Mutation projection must be synchronous.');
|
|
27
|
-
const admitted = admitMutation(authored);
|
|
28
|
-
if (byDomain === undefined) {
|
|
29
|
-
byDomain = new WeakMap();
|
|
30
|
-
realized.set(mutation, byDomain);
|
|
31
|
-
}
|
|
32
|
-
byDomain.set(domain, admitted);
|
|
33
|
-
return admitted;
|
|
1
|
+
import { collectDefinition, MAXIMUM_DEFINITION_ID, DEFINITION_ID } from '../query/defined/define.js';
|
|
2
|
+
import { describe } from '../query/handles/terms.js';
|
|
3
|
+
import { defineMutation as defineClosureMutation } from './legacy/v6/define.js';
|
|
4
|
+
const FIELDS = new Set(['build', 'output', 'reject', 'errors']);
|
|
5
|
+
const specs = new WeakMap();
|
|
6
|
+
/** The `build`, `output` and `reject` of a defined Mutation; `undefined` for anything else. */
|
|
7
|
+
export function mutationSpecOf(mutation) {
|
|
8
|
+
return typeof mutation === 'object' && mutation !== null ? specs.get(mutation) : undefined;
|
|
34
9
|
}
|
|
35
|
-
function
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
-
if (typeof
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
10
|
+
function defineV7Mutation(id, spec) {
|
|
11
|
+
if (typeof id !== 'string' || id.length > MAXIMUM_DEFINITION_ID || !DEFINITION_ID.test(id))
|
|
12
|
+
throw new TypeError(`A Mutation id is lowercase segments of letters, digits and hyphens joined by dots, at most ${MAXIMUM_DEFINITION_ID} characters ('issues.issue.open'); got ${describe(id)}.`);
|
|
13
|
+
if (typeof spec !== 'object' || spec === null || Array.isArray(spec))
|
|
14
|
+
throw new TypeError(`Mutation ${id} takes { build, output?, reject?, errors? }; got ${describe(spec)}.`);
|
|
15
|
+
const fields = spec;
|
|
16
|
+
const unknown = Reflect.ownKeys(fields).filter((key) => typeof key !== 'string' || !FIELDS.has(key));
|
|
17
|
+
if (unknown.length > 0)
|
|
18
|
+
throw new TypeError(`Mutation ${id} takes build, output, reject and errors only; got ${unknown.map(String).join(', ')}.`);
|
|
19
|
+
const { build, output, reject } = fields;
|
|
20
|
+
if (typeof build !== 'function')
|
|
21
|
+
throw new TypeError(`Mutation ${id}'s build is a function of (input, d, mutation); got ${describe(build)}.`);
|
|
22
|
+
if (output !== undefined && typeof output !== 'function')
|
|
23
|
+
throw new TypeError(`Mutation ${id}'s output is a function of (result, input); got ${describe(output)}.`);
|
|
24
|
+
if (reject !== undefined && typeof reject !== 'function')
|
|
25
|
+
throw new TypeError(`Mutation ${id}'s reject is a function of (failure, input, context); got ${describe(reject)}.`);
|
|
26
|
+
const errors = fields.errors ?? {};
|
|
27
|
+
if (typeof errors !== 'object' || errors === null || Array.isArray(errors))
|
|
28
|
+
throw new TypeError(`Mutation ${id}'s errors is a record of declared errors by UPPER_SNAKE code; got ${describe(errors)}.`);
|
|
29
|
+
const mutation = Object.freeze({
|
|
30
|
+
kind: 'mutation',
|
|
31
|
+
id,
|
|
32
|
+
errors: Object.freeze({ ...errors }),
|
|
33
|
+
});
|
|
34
|
+
collectDefinition(mutation);
|
|
35
|
+
specs.set(mutation, Object.freeze({
|
|
36
|
+
build: build,
|
|
37
|
+
...(output === undefined ? {} : { output: output }),
|
|
38
|
+
...(reject === undefined ? {} : { reject: reject }),
|
|
39
|
+
}));
|
|
40
|
+
return mutation;
|
|
51
41
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Define a Mutation: `defineMutation<Schema>()('issues.issue.open', { build, output?, reject?,
|
|
44
|
+
* errors? })`. The closure form, `defineMutation<Schema>()((domain) => ({ id, build, project? }))`,
|
|
45
|
+
* stays, deprecated.
|
|
46
|
+
*/
|
|
47
|
+
export function defineMutation() {
|
|
48
|
+
const closure = defineClosureMutation();
|
|
49
|
+
return ((first, spec) => typeof first === 'string'
|
|
50
|
+
? defineV7Mutation(first, spec)
|
|
51
|
+
: closure(first));
|
|
56
52
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type MutationAST as MutationASTValue, type MutationResult } from '@astrale-os/kernel-core/graph/mutate';
|
|
2
2
|
import type { GraphMutationOptions } from '../../../platform/client/index.js';
|
|
3
3
|
import type { Domain } from '../../../platform/schema/index.js';
|
|
4
|
-
import type { Mutation } from '../mutation.js';
|
|
4
|
+
import type { Mutation, DefinedMutation } from '../mutation.js';
|
|
5
5
|
/** Exact caller-scoped canonical document capability required by Mutation execution. */
|
|
6
6
|
export type MutationClient = Readonly<{
|
|
7
7
|
mutate(ast: MutationASTValue, options?: GraphMutationOptions): Promise<MutationResult>;
|
|
8
8
|
}>;
|
|
9
|
-
export declare function executeMutation<DomainValue extends Domain, Input, Output>(client: MutationClient, domain: DomainValue, definition: Mutation<DomainValue, Input, Output>, input: Input): Promise<Output>;
|
|
9
|
+
export declare function executeMutation<DomainValue extends Domain, Input, Output>(client: MutationClient, domain: DomainValue, definition: Mutation<DomainValue, Input, Output> | DefinedMutation<string, Input, Output>, input: Input): Promise<Output>;
|