@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,425 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { declarationOf, expressionType, isLocallyDeclared, definitionCalls, unwrap, visit, } from '../../adapters/typescript/index.js';
|
|
3
|
+
import { production, propertyExpression, returnedExpressions, violation } from './shared.js';
|
|
4
|
+
/** Rows of bound product past which a Query is flagged: a tenth of what one call may read. */
|
|
5
|
+
const ROWS = 10_000;
|
|
6
|
+
export const definitionRules = [
|
|
7
|
+
{
|
|
8
|
+
id: 'QRY-CLOCK',
|
|
9
|
+
ruleRevision: '776cea7dd21460547625a1e6b7a74fcd80956bd7f4cfbdc6641e6458661095ee',
|
|
10
|
+
evaluate(project) {
|
|
11
|
+
return definitionsOf(project).flatMap(({ file, definition }) => clockEvidence(file, definition));
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
id: 'QRY-ROWS',
|
|
16
|
+
ruleRevision: '2b470871ff394e42f19b7fc1ddcfcd4e853ced9e65412e3dfe0d0c66e9caf4a2',
|
|
17
|
+
evaluate(project) {
|
|
18
|
+
return definitionsOf(project).flatMap(({ file, definition }) => rowsEvidence(project, file, definition));
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: 'QRY-FALSY',
|
|
23
|
+
ruleRevision: '3041a35ba8209331f3c64d8aada93f6b7a8194802a23927f29d919a1e7354719',
|
|
24
|
+
evaluate(project) {
|
|
25
|
+
return definitionsOf(project).flatMap(({ file, definition }) => falsyFilterEvidence(project, file, definition));
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
function definitionsOf(project) {
|
|
30
|
+
return production(project, 'queries').flatMap((file) => definitionCalls(file)
|
|
31
|
+
.filter(({ origin }) => origin === 'resolved')
|
|
32
|
+
.map((definition) => ({ file, definition })));
|
|
33
|
+
}
|
|
34
|
+
/** A Query's spec as written: its id, and its `build` and `output` written inline. */
|
|
35
|
+
function specOf(file, { call }) {
|
|
36
|
+
const id = unwrap(call.arguments[0]);
|
|
37
|
+
const spec = unwrap(call.arguments[1]);
|
|
38
|
+
const object = ts.isObjectLiteralExpression(spec) ? spec : undefined;
|
|
39
|
+
const build = propertyExpression(object, 'build');
|
|
40
|
+
const output = propertyExpression(object, 'output');
|
|
41
|
+
return {
|
|
42
|
+
name: ts.isStringLiteralLike(id) ? id.text : id.getText(file.source),
|
|
43
|
+
build: build !== undefined && isFunction(build) ? build : undefined,
|
|
44
|
+
output: output !== undefined && isFunction(output) ? output : undefined,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function isFunction(node) {
|
|
48
|
+
return ts.isArrowFunction(node) || ts.isFunctionExpression(node);
|
|
49
|
+
}
|
|
50
|
+
/** The clocks a global names, as the property paths that read them. */
|
|
51
|
+
const CLOCKS = [
|
|
52
|
+
['Date', 'now'],
|
|
53
|
+
['Date'],
|
|
54
|
+
['performance', 'now'],
|
|
55
|
+
['process', 'hrtime'],
|
|
56
|
+
['process', 'hrtime', 'bigint'],
|
|
57
|
+
['process', 'uptime'],
|
|
58
|
+
];
|
|
59
|
+
/** Each clock read in `build` and `output`, their callbacks included: they all run in the call. */
|
|
60
|
+
function clockEvidence(file, definition) {
|
|
61
|
+
const { name, build, output } = specOf(file, definition);
|
|
62
|
+
const evidence = [];
|
|
63
|
+
const fields = [
|
|
64
|
+
...(build === undefined ? [] : [{ field: 'build', fn: build }]),
|
|
65
|
+
...(output === undefined ? [] : [{ field: 'output', fn: output }]),
|
|
66
|
+
];
|
|
67
|
+
for (const { field, fn } of fields) {
|
|
68
|
+
visit(fn, (node) => {
|
|
69
|
+
const read = clockRead(node);
|
|
70
|
+
if (read === undefined)
|
|
71
|
+
return;
|
|
72
|
+
evidence.push(violation(file, node, `Query ${name}'s ${field} reads the clock (${read}): no write moves time, so nothing would refresh the read. Take now in the Query's input.`));
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return evidence;
|
|
76
|
+
}
|
|
77
|
+
/** The clock a node reads: a call of a clock, `new Date()`, or `Temporal.Now`. */
|
|
78
|
+
function clockRead(node) {
|
|
79
|
+
if (ts.isNewExpression(node))
|
|
80
|
+
return (node.arguments?.length ?? 0) === 0 && isGlobal(node.expression, ['Date'])
|
|
81
|
+
? 'new Date()'
|
|
82
|
+
: undefined;
|
|
83
|
+
if (ts.isCallExpression(node)) {
|
|
84
|
+
const clock = CLOCKS.find((path) => isGlobal(node.expression, path));
|
|
85
|
+
return clock && `${clock.join('.')}()`;
|
|
86
|
+
}
|
|
87
|
+
if (ts.isPropertyAccessExpression(node) && isGlobal(node, ['Temporal', 'Now']))
|
|
88
|
+
return 'Temporal.Now';
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
/** Whether an expression is the global at a path, read directly or through `globalThis`. */
|
|
92
|
+
function isGlobal(expression, path) {
|
|
93
|
+
let current = unwrap(expression);
|
|
94
|
+
for (const name of [...path].reverse().slice(0, -1)) {
|
|
95
|
+
if (!ts.isPropertyAccessExpression(current) || current.name.text !== name)
|
|
96
|
+
return false;
|
|
97
|
+
current = unwrap(current.expression);
|
|
98
|
+
}
|
|
99
|
+
if (ts.isPropertyAccessExpression(current)) {
|
|
100
|
+
const root = unwrap(current.expression);
|
|
101
|
+
if (current.name.text !== path[0] || !ts.isIdentifier(root) || root.text !== 'globalThis')
|
|
102
|
+
return false;
|
|
103
|
+
return !isLocallyDeclared(root);
|
|
104
|
+
}
|
|
105
|
+
return ts.isIdentifier(current) && current.text === path[0] && !isLocallyDeclared(current);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* A Query whose bounds multiply past `ROWS`, counted as a call counts them (S11): each verb's
|
|
109
|
+
* rows, `find` 2, `first(n)` n, `all` and `page` max + 1, times one plus what each row carries.
|
|
110
|
+
* A bound that is not a constant counts nothing, so the count is the least the Query may read.
|
|
111
|
+
*/
|
|
112
|
+
function rowsEvidence(project, file, definition) {
|
|
113
|
+
const { name, build } = specOf(file, definition);
|
|
114
|
+
const handles = boundNames(build?.parameters[1]?.name);
|
|
115
|
+
if (build === undefined || handles.size === 0)
|
|
116
|
+
return [];
|
|
117
|
+
const steps = build.parameters[2]?.name;
|
|
118
|
+
const count = (value) => facets(value).reduce((sum, read) => sum + readRows(project, file, read, handles), 0);
|
|
119
|
+
const counts = returnedExpressions(build).map((value) => {
|
|
120
|
+
const each = stepsOf(value, steps !== undefined && ts.isIdentifier(steps) ? steps : undefined);
|
|
121
|
+
if (each === undefined)
|
|
122
|
+
return count(value);
|
|
123
|
+
return each.reduce((total, returned) => total + Math.max(0, ...returned.map(count)), 0);
|
|
124
|
+
});
|
|
125
|
+
const rows = Math.max(0, ...counts);
|
|
126
|
+
if (rows <= ROWS)
|
|
127
|
+
return [];
|
|
128
|
+
return [
|
|
129
|
+
violation(file, definition.call, `Query ${name} reads up to ${rows.toLocaleString('en-US')} rows, the product of its bounds, past ${ROWS.toLocaleString('en-US')}: lower a bound, or split the read.`),
|
|
130
|
+
];
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* The steps of a `steps(first, (earlier) => next, …)` call that `build` returns, each as the
|
|
134
|
+
* expressions it may return; `undefined` for anything else. Each step reads on `build`'s handles.
|
|
135
|
+
*/
|
|
136
|
+
function stepsOf(value, steps) {
|
|
137
|
+
const call = unwrap(value);
|
|
138
|
+
if (steps === undefined || !ts.isCallExpression(call))
|
|
139
|
+
return undefined;
|
|
140
|
+
const callee = unwrap(call.expression);
|
|
141
|
+
if (!ts.isIdentifier(callee) || callee.text !== steps.text)
|
|
142
|
+
return undefined;
|
|
143
|
+
return call.arguments.map((argument) => {
|
|
144
|
+
const step = unwrap(argument);
|
|
145
|
+
return isFunction(step) ? returnedExpressions(step) : [step];
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
/** The reads a step returns: one read, or a record of them. */
|
|
149
|
+
function facets(value) {
|
|
150
|
+
if (!ts.isObjectLiteralExpression(value))
|
|
151
|
+
return [value];
|
|
152
|
+
return value.properties.flatMap((property) => ts.isPropertyAssignment(property) ? [unwrap(property.initializer)] : []);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* The names a parameter binds: the handles or the row itself, or what its destructuring binds,
|
|
156
|
+
* at any depth (`{ Task }`, `{ work: { Task } }`).
|
|
157
|
+
*/
|
|
158
|
+
function boundNames(name) {
|
|
159
|
+
const names = new Set();
|
|
160
|
+
const bind = (node) => {
|
|
161
|
+
if (ts.isIdentifier(node))
|
|
162
|
+
names.add(node.text);
|
|
163
|
+
else
|
|
164
|
+
for (const element of node.elements)
|
|
165
|
+
if (ts.isBindingElement(element))
|
|
166
|
+
bind(element.name);
|
|
167
|
+
};
|
|
168
|
+
if (name !== undefined)
|
|
169
|
+
bind(name);
|
|
170
|
+
return names;
|
|
171
|
+
}
|
|
172
|
+
/** The rows a read chain may answer, from a root on the handles or a relation on a row. */
|
|
173
|
+
function readRows(project, file, read, roots) {
|
|
174
|
+
const verb = verbCall(read);
|
|
175
|
+
if (verb === undefined)
|
|
176
|
+
return 0;
|
|
177
|
+
const receiver = unwrap(verb.expression.expression);
|
|
178
|
+
const root = rootOf(receiver);
|
|
179
|
+
if (root === undefined || !roots.has(root))
|
|
180
|
+
return 0;
|
|
181
|
+
return verbRows(project, file, verb) * (1 + carried(project, file, receiver));
|
|
182
|
+
}
|
|
183
|
+
/** The rows each parent row carries: its `.with` relations, at any depth. */
|
|
184
|
+
function carried(project, file, chain) {
|
|
185
|
+
let total = 0;
|
|
186
|
+
for (let current = unwrap(chain); ts.isCallExpression(current);) {
|
|
187
|
+
const callee = unwrap(current.expression);
|
|
188
|
+
if (!ts.isPropertyAccessExpression(callee))
|
|
189
|
+
break;
|
|
190
|
+
const relations = current.arguments[0] && unwrap(current.arguments[0]);
|
|
191
|
+
if (callee.name.text === 'with' && relations && isFunction(relations)) {
|
|
192
|
+
const row = boundNames(relations.parameters[0]?.name);
|
|
193
|
+
for (const value of returnedExpressions(relations))
|
|
194
|
+
for (const relation of facets(value))
|
|
195
|
+
total += readRows(project, file, relation, row);
|
|
196
|
+
}
|
|
197
|
+
current = unwrap(callee.expression);
|
|
198
|
+
}
|
|
199
|
+
return total;
|
|
200
|
+
}
|
|
201
|
+
const VERBS = new Set([
|
|
202
|
+
'get',
|
|
203
|
+
'find',
|
|
204
|
+
'first',
|
|
205
|
+
'page',
|
|
206
|
+
'all',
|
|
207
|
+
'count',
|
|
208
|
+
'exists',
|
|
209
|
+
]);
|
|
210
|
+
function verbCall(read) {
|
|
211
|
+
const call = unwrap(read);
|
|
212
|
+
if (!ts.isCallExpression(call))
|
|
213
|
+
return undefined;
|
|
214
|
+
const callee = unwrap(call.expression);
|
|
215
|
+
return ts.isPropertyAccessExpression(callee) && VERBS.has(callee.name.text) ? call : undefined;
|
|
216
|
+
}
|
|
217
|
+
/** The identifier a chain starts from. */
|
|
218
|
+
function rootOf(chain) {
|
|
219
|
+
let current = unwrap(chain);
|
|
220
|
+
while (ts.isCallExpression(current) || ts.isPropertyAccessExpression(current))
|
|
221
|
+
current = unwrap(current.expression);
|
|
222
|
+
return ts.isIdentifier(current) ? current.text : undefined;
|
|
223
|
+
}
|
|
224
|
+
/** The rows one verb reads, as a call counts them; a bound that is not a constant reads 0. */
|
|
225
|
+
function verbRows(project, file, call) {
|
|
226
|
+
const verb = unwrap(call.expression).name.text;
|
|
227
|
+
const [first, second] = call.arguments;
|
|
228
|
+
switch (verb) {
|
|
229
|
+
case 'get':
|
|
230
|
+
case 'find':
|
|
231
|
+
return 2;
|
|
232
|
+
case 'first': {
|
|
233
|
+
if (first === undefined)
|
|
234
|
+
return 1;
|
|
235
|
+
const n = constant(project, file, first) ?? 0;
|
|
236
|
+
return second === undefined ? n : n + 1;
|
|
237
|
+
}
|
|
238
|
+
case 'page':
|
|
239
|
+
case 'all': {
|
|
240
|
+
const options = first && unwrap(first);
|
|
241
|
+
const max = options && ts.isObjectLiteralExpression(options)
|
|
242
|
+
? propertyExpression(options, 'max')
|
|
243
|
+
: undefined;
|
|
244
|
+
const bound = max && constant(project, file, max);
|
|
245
|
+
return bound === undefined ? 0 : bound + 1;
|
|
246
|
+
}
|
|
247
|
+
default:
|
|
248
|
+
return 0;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
/** A number the source fixes: a literal, or a constant the checker knows. */
|
|
252
|
+
function constant(project, file, value) {
|
|
253
|
+
const expression = unwrap(value);
|
|
254
|
+
if (ts.isNumericLiteral(expression))
|
|
255
|
+
return Number(expression.text);
|
|
256
|
+
const type = expressionType(project, file, expression)?.type;
|
|
257
|
+
return type?.isNumberLiteral() ? type.value : undefined;
|
|
258
|
+
}
|
|
259
|
+
/** The condition calls that compare a Property with a value. */
|
|
260
|
+
const COMPARISONS = new Set([
|
|
261
|
+
'eq',
|
|
262
|
+
'in',
|
|
263
|
+
'gt',
|
|
264
|
+
'gte',
|
|
265
|
+
'lt',
|
|
266
|
+
'lte',
|
|
267
|
+
'between',
|
|
268
|
+
'startsWith',
|
|
269
|
+
'atMost',
|
|
270
|
+
'exactly',
|
|
271
|
+
]);
|
|
272
|
+
/** The calls whose callbacks return conditions, by the argument that takes the callback. */
|
|
273
|
+
const CALLBACKS = new Map([
|
|
274
|
+
['where', 0],
|
|
275
|
+
['is', 1],
|
|
276
|
+
['some', 0],
|
|
277
|
+
['none', 0],
|
|
278
|
+
['every', 0],
|
|
279
|
+
['atLeast', 1],
|
|
280
|
+
['atMost', 1],
|
|
281
|
+
['exactly', 1],
|
|
282
|
+
]);
|
|
283
|
+
/** The calls whose arguments are conditions. */
|
|
284
|
+
const COMBINATIONS = new Set(['and', 'or']);
|
|
285
|
+
/**
|
|
286
|
+
* Each condition entry, wherever falsy entries are skipped, that gates a comparison with a value
|
|
287
|
+
* on that value itself (`A && B`, or `A ? B : undefined`), when the value may be `false` or a
|
|
288
|
+
* number: the entry is then `false`, `0` or `undefined`, which is skipped, so the comparison is
|
|
289
|
+
* dropped.
|
|
290
|
+
*/
|
|
291
|
+
function falsyFilterEvidence(project, file, definition) {
|
|
292
|
+
const { name, build } = specOf(file, definition);
|
|
293
|
+
const evidence = [];
|
|
294
|
+
if (build !== undefined)
|
|
295
|
+
visit(build, (node) => {
|
|
296
|
+
const skipped = conditionEntries(node);
|
|
297
|
+
if (skipped === undefined)
|
|
298
|
+
return;
|
|
299
|
+
for (const entry of skipped.entries)
|
|
300
|
+
for (const { guard, gated } of guardsOf(entry)) {
|
|
301
|
+
const compared = gated.some((condition) => comparesWith(project, file, condition, guard));
|
|
302
|
+
const admitted = compared ? falsyOf(project, file, guard) : undefined;
|
|
303
|
+
if (admitted === undefined)
|
|
304
|
+
continue;
|
|
305
|
+
const value = guard.getText(file.source);
|
|
306
|
+
const explicit = admitted === 'number'
|
|
307
|
+
? `${value} !== undefined && ${value} !== 0 && …`
|
|
308
|
+
: `${value} ? ….eq(true) : undefined`;
|
|
309
|
+
evidence.push(violation(file, entry, `Query ${name} drops the condition on ${value} when ${value} is false or 0: the ${skipped.call} entry is then falsy, and ${skipped.call} skips it. To compare whenever ${value} is set, write ${value} !== undefined && …; if false or 0 means no filter, write that explicitly: ${explicit}.`));
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
return evidence;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* The condition entries of a call that skips falsy ones: what a `where`, `is`, `some`, `none`,
|
|
316
|
+
* `every`, `atLeast`, `atMost` or `exactly` callback returns, a list or one condition, and the
|
|
317
|
+
* arguments of `and` and `or`.
|
|
318
|
+
*/
|
|
319
|
+
function conditionEntries(node) {
|
|
320
|
+
if (!ts.isCallExpression(node))
|
|
321
|
+
return undefined;
|
|
322
|
+
const callee = unwrap(node.expression);
|
|
323
|
+
if (!ts.isPropertyAccessExpression(callee))
|
|
324
|
+
return undefined;
|
|
325
|
+
const call = callee.name.text;
|
|
326
|
+
const listed = (values) => values.flatMap((value) => ts.isArrayLiteralExpression(value) ? value.elements.map(unwrap) : [value]);
|
|
327
|
+
if (COMBINATIONS.has(call))
|
|
328
|
+
return { call, entries: listed(node.arguments.map(unwrap)) };
|
|
329
|
+
const position = CALLBACKS.get(call);
|
|
330
|
+
const conditions = position === undefined ? undefined : node.arguments[position];
|
|
331
|
+
const callback = conditions && unwrap(conditions);
|
|
332
|
+
if (callback === undefined || !isFunction(callback))
|
|
333
|
+
return undefined;
|
|
334
|
+
return { call, entries: listed(returnedExpressions(callback)) };
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* The guards of an entry, each with the conditions it gates: in `A && B && C`, `A` gates `B` and
|
|
338
|
+
* `C`; in `A ? B : undefined` (or another falsy branch), `A`'s operands gate `B`.
|
|
339
|
+
*/
|
|
340
|
+
function guardsOf(entry) {
|
|
341
|
+
const value = unwrap(entry);
|
|
342
|
+
if (ts.isConditionalExpression(value) && isFalsyLiteral(value.whenFalse)) {
|
|
343
|
+
const tests = conjuncts(value.condition);
|
|
344
|
+
return [
|
|
345
|
+
...tests.map((guard, index) => ({
|
|
346
|
+
guard,
|
|
347
|
+
gated: [...tests.slice(index + 1), value.whenTrue],
|
|
348
|
+
})),
|
|
349
|
+
...guardsOf(value.whenTrue),
|
|
350
|
+
];
|
|
351
|
+
}
|
|
352
|
+
const operands = conjuncts(value);
|
|
353
|
+
if (operands.length === 1)
|
|
354
|
+
return [];
|
|
355
|
+
return [
|
|
356
|
+
...operands.map((guard, index) => ({ guard, gated: operands.slice(index + 1) })),
|
|
357
|
+
...guardsOf(operands[operands.length - 1]),
|
|
358
|
+
];
|
|
359
|
+
}
|
|
360
|
+
/** `undefined`, `null`, `false`, `0`, `''` or a `void` expression. */
|
|
361
|
+
function isFalsyLiteral(expression) {
|
|
362
|
+
const value = unwrap(expression);
|
|
363
|
+
return ((ts.isIdentifier(value) && value.text === 'undefined') ||
|
|
364
|
+
value.kind === ts.SyntaxKind.NullKeyword ||
|
|
365
|
+
value.kind === ts.SyntaxKind.FalseKeyword ||
|
|
366
|
+
(ts.isNumericLiteral(value) && Number(value.text) === 0) ||
|
|
367
|
+
(ts.isStringLiteralLike(value) && value.text === '') ||
|
|
368
|
+
ts.isVoidExpression(value));
|
|
369
|
+
}
|
|
370
|
+
/** The operands of `A && B && …`; any other expression is its one operand. */
|
|
371
|
+
function conjuncts(expression) {
|
|
372
|
+
const value = unwrap(expression);
|
|
373
|
+
return ts.isBinaryExpression(value) &&
|
|
374
|
+
value.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken
|
|
375
|
+
? [...conjuncts(value.left), ...conjuncts(value.right)]
|
|
376
|
+
: [value];
|
|
377
|
+
}
|
|
378
|
+
/** Whether a condition, its callbacks included, passes `value` to a comparison. */
|
|
379
|
+
function comparesWith(project, file, condition, value) {
|
|
380
|
+
let found = false;
|
|
381
|
+
visit(condition, (node) => {
|
|
382
|
+
if (found || !ts.isCallExpression(node))
|
|
383
|
+
return;
|
|
384
|
+
const callee = unwrap(node.expression);
|
|
385
|
+
found =
|
|
386
|
+
ts.isPropertyAccessExpression(callee) &&
|
|
387
|
+
COMPARISONS.has(callee.name.text) &&
|
|
388
|
+
node.arguments.some((argument) => sameRead(project, file, argument, value));
|
|
389
|
+
});
|
|
390
|
+
return found;
|
|
391
|
+
}
|
|
392
|
+
/** Whether two expressions read one value: the same binding, through the same properties. */
|
|
393
|
+
function sameRead(project, file, left, right) {
|
|
394
|
+
const a = unwrap(left);
|
|
395
|
+
const b = unwrap(right);
|
|
396
|
+
if (ts.isPropertyAccessExpression(a) && ts.isPropertyAccessExpression(b))
|
|
397
|
+
return a.name.text === b.name.text && sameRead(project, file, a.expression, b.expression);
|
|
398
|
+
if (!ts.isIdentifier(a) || !ts.isIdentifier(b) || a.text !== b.text)
|
|
399
|
+
return false;
|
|
400
|
+
const declaration = declarationOf(project, file, a);
|
|
401
|
+
return declaration !== undefined && declaration === declarationOf(project, file, b);
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Which falsy value a value's type admits: a number, `0` among them, or else `false`. An
|
|
405
|
+
* unresolved type admits none.
|
|
406
|
+
*/
|
|
407
|
+
function falsyOf(project, file, value) {
|
|
408
|
+
const resolved = expressionType(project, file, value);
|
|
409
|
+
if (resolved === undefined)
|
|
410
|
+
return undefined;
|
|
411
|
+
if (admits(resolved.type, isZero))
|
|
412
|
+
return 'number';
|
|
413
|
+
return admits(resolved.type, (type) => isFalse(resolved.checker, type)) ? 'false' : undefined;
|
|
414
|
+
}
|
|
415
|
+
function admits(type, member) {
|
|
416
|
+
return type.isUnion() || type.isIntersection()
|
|
417
|
+
? type.types.some((each) => admits(each, member))
|
|
418
|
+
: member(type);
|
|
419
|
+
}
|
|
420
|
+
function isZero(type) {
|
|
421
|
+
return (type.flags & ts.TypeFlags.Number) !== 0 || (type.isNumberLiteral() && type.value === 0);
|
|
422
|
+
}
|
|
423
|
+
function isFalse(checker, type) {
|
|
424
|
+
return (type.flags & ts.TypeFlags.BooleanLiteral) !== 0 && checker.typeToString(type) === 'false';
|
|
425
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
2
|
import { propertyChain, resolveImportedSymbol, unwrap, visit, } from '../../adapters/typescript/index.js';
|
|
3
|
-
import {
|
|
4
|
-
import { ambiguity, calls, isForeignDomain, production, violation } from './shared.js';
|
|
3
|
+
import { domainFunctionRequirements, callableReference, callableSelector, declaredDomainDependencies, remoteCallableKey, } from './callable-requirements.js';
|
|
4
|
+
import { ambiguity, calls, contextPath, isForeignDomain, production, violation } from './shared.js';
|
|
5
5
|
export const dependencyRules = [
|
|
6
6
|
{
|
|
7
7
|
id: 'FNC-XDOM-DECLARED',
|
|
8
|
-
ruleRevision: '
|
|
8
|
+
ruleRevision: '72f960f87ac682695ea495925e31d15b9bd640b25d90ac1dcc6a1329a0be51b0',
|
|
9
9
|
evaluate(project) {
|
|
10
10
|
const evidence = [];
|
|
11
11
|
for (const file of production(project, 'functions')) {
|
|
@@ -19,15 +19,15 @@ export const dependencyRules = [
|
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
id: 'FNC-XDOM-REQ',
|
|
22
|
-
ruleRevision: '
|
|
22
|
+
ruleRevision: 'a4666ebb09b2027983edc2ffc6411692ade9877ee9c4f23c4b0a8d157a0cf385',
|
|
23
23
|
evaluate(project) {
|
|
24
24
|
const { targets, evidence } = observeInvocations(project);
|
|
25
|
-
const declared =
|
|
25
|
+
const declared = domainFunctionRequirements(project);
|
|
26
26
|
const results = evidence.filter(({ kind }) => kind === 'ambiguity');
|
|
27
27
|
for (const target of targets) {
|
|
28
28
|
if (declared.keys.has(remoteCallableKey(target)))
|
|
29
29
|
continue;
|
|
30
|
-
results.push((declared.indeterminate ? ambiguity : violation)(target.file, target.node, `Remote Domain callable ${target.module} ${target.selector.join('.')} lacks one provable exact
|
|
30
|
+
results.push((declared.indeterminate ? ambiguity : violation)(target.file, target.node, `Remote Domain callable ${target.module} ${target.selector.join('.')} lacks one provable exact Domain Function requirement.`));
|
|
31
31
|
}
|
|
32
32
|
return results;
|
|
33
33
|
},
|
|
@@ -70,16 +70,18 @@ function observeInvocations(project) {
|
|
|
70
70
|
let alias;
|
|
71
71
|
let selector;
|
|
72
72
|
if (path[0] === 'dependencies') {
|
|
73
|
-
if (path.length !== 4 || !['caller', 'self'
|
|
74
|
-
evidence.push(violation(file, node, 'Dependency invocation requires one direct alias and one explicit caller
|
|
73
|
+
if (path.length !== 4 || !['caller', 'self'].includes(path[2])) {
|
|
74
|
+
evidence.push(violation(file, node, 'Dependency invocation requires one direct alias and one explicit caller or self authority.'));
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
77
|
alias = path[1];
|
|
78
78
|
selector = selectedCallable(node.arguments[0]);
|
|
79
79
|
}
|
|
80
|
-
else if (path[0] === 'kernel'
|
|
81
|
-
(path.length
|
|
82
|
-
(
|
|
80
|
+
else if (path[0] === 'kernel') {
|
|
81
|
+
if (path.length !== 2 && (path.length !== 3 || !['caller', 'self'].includes(path[1]))) {
|
|
82
|
+
evidence.push(violation(file, node, 'Kernel invocation requires the default, caller, or self authority.'));
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
83
85
|
const argument = node.arguments[0];
|
|
84
86
|
if (!argument) {
|
|
85
87
|
evidence.push(violation(file, node, 'Kernel invocation requires one canonical typed reference.'));
|
|
@@ -156,64 +158,3 @@ function selectedCallable(input) {
|
|
|
156
158
|
const chain = expression && propertyChain(expression);
|
|
157
159
|
return chain && chain[0] === parameter.text ? chain.slice(1) : undefined;
|
|
158
160
|
}
|
|
159
|
-
/** Resolve handler context bindings and one immutable local alias without following arbitrary helpers. */
|
|
160
|
-
function contextPath(input, run, aliases = 1) {
|
|
161
|
-
const expression = unwrap(input);
|
|
162
|
-
if (ts.isPropertyAccessExpression(expression)) {
|
|
163
|
-
const base = contextPath(expression.expression, run, aliases);
|
|
164
|
-
return base && [...base, expression.name.text];
|
|
165
|
-
}
|
|
166
|
-
if (ts.isElementAccessExpression(expression)) {
|
|
167
|
-
const base = contextPath(expression.expression, run, aliases);
|
|
168
|
-
return base && [...base, '[computed]'];
|
|
169
|
-
}
|
|
170
|
-
if (!ts.isIdentifier(expression))
|
|
171
|
-
return undefined;
|
|
172
|
-
let current = expression.parent;
|
|
173
|
-
while (current) {
|
|
174
|
-
if (ts.isFunctionLike(current)) {
|
|
175
|
-
for (const parameter of current.parameters) {
|
|
176
|
-
const path = bindingPath(parameter.name, expression.text);
|
|
177
|
-
if (path)
|
|
178
|
-
return current === run && parameter === run.parameters[0] ? path : undefined;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
if (ts.isBlock(current) || ts.isSourceFile(current)) {
|
|
182
|
-
for (const statement of current.statements) {
|
|
183
|
-
if (ts.isFunctionDeclaration(statement) && statement.name?.text === expression.text)
|
|
184
|
-
return undefined;
|
|
185
|
-
if (!ts.isVariableStatement(statement))
|
|
186
|
-
continue;
|
|
187
|
-
for (const declaration of statement.declarationList.declarations) {
|
|
188
|
-
const path = bindingPath(declaration.name, expression.text);
|
|
189
|
-
if (!path)
|
|
190
|
-
continue;
|
|
191
|
-
if (aliases === 0 ||
|
|
192
|
-
!declaration.initializer ||
|
|
193
|
-
declaration.end > expression.pos ||
|
|
194
|
-
!(statement.declarationList.flags & ts.NodeFlags.Const))
|
|
195
|
-
return undefined;
|
|
196
|
-
const base = contextPath(declaration.initializer, run, aliases - 1);
|
|
197
|
-
return base && [...base, ...path];
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
current = current.parent;
|
|
202
|
-
}
|
|
203
|
-
return undefined;
|
|
204
|
-
}
|
|
205
|
-
function bindingPath(name, identifier) {
|
|
206
|
-
if (ts.isIdentifier(name))
|
|
207
|
-
return name.text === identifier ? [] : undefined;
|
|
208
|
-
if (!ts.isObjectBindingPattern(name))
|
|
209
|
-
return undefined;
|
|
210
|
-
for (const element of name.elements) {
|
|
211
|
-
if (element.dotDotDotToken)
|
|
212
|
-
continue;
|
|
213
|
-
const nested = bindingPath(element.name, identifier);
|
|
214
|
-
const property = element.propertyName ?? (ts.isIdentifier(element.name) ? element.name : undefined);
|
|
215
|
-
if (nested && property && (ts.isIdentifier(property) || ts.isStringLiteral(property)))
|
|
216
|
-
return [property.text, ...nested];
|
|
217
|
-
}
|
|
218
|
-
return undefined;
|
|
219
|
-
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type ts from 'typescript';
|
|
2
|
+
import type { RequirementEntries } from './requirement-entries.js';
|
|
3
|
+
/**
|
|
4
|
+
* Read a static `requirements({ roles, scopes })` object: a scope with `call` lets the Domain call
|
|
5
|
+
* its target; any other scope holds Class operations. Roles grant no callable or Class by name, so
|
|
6
|
+
* no rule reads them.
|
|
7
|
+
*/
|
|
8
|
+
export declare function requirementEntries(definition: ts.ObjectLiteralExpression): RequirementEntries;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { legacyRequirementEntries } from './legacy/requirements.js';
|
|
2
|
+
import { arrayElements, assigned, entryObject, operationNames } from './requirement-entries.js';
|
|
3
|
+
/**
|
|
4
|
+
* Read a static `requirements({ roles, scopes })` object: a scope with `call` lets the Domain call
|
|
5
|
+
* its target; any other scope holds Class operations. Roles grant no callable or Class by name, so
|
|
6
|
+
* no rule reads them.
|
|
7
|
+
*/
|
|
8
|
+
export function requirementEntries(definition) {
|
|
9
|
+
// The one seam to the legacy shape: it answers only when a key only that shape declares is set.
|
|
10
|
+
const legacy = legacyRequirementEntries(definition);
|
|
11
|
+
if (legacy !== undefined)
|
|
12
|
+
return legacy;
|
|
13
|
+
const scopes = arrayElements(definition, 'scopes');
|
|
14
|
+
if (scopes === 'opaque')
|
|
15
|
+
return { callables: [], classes: [], indeterminate: true };
|
|
16
|
+
const callables = [];
|
|
17
|
+
const classes = [];
|
|
18
|
+
let indeterminate = false;
|
|
19
|
+
for (const element of scopes ?? []) {
|
|
20
|
+
const scope = entryObject(element);
|
|
21
|
+
const on = scope && assigned(scope, 'on');
|
|
22
|
+
const operations = scope && assigned(scope, 'operations');
|
|
23
|
+
const names = operations && operationNames(operations);
|
|
24
|
+
if (on === undefined || operations === undefined || names === undefined) {
|
|
25
|
+
indeterminate = true;
|
|
26
|
+
}
|
|
27
|
+
else if (names.includes('call')) {
|
|
28
|
+
callables.push(on);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
classes.push({ target: on, operations });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return { callables, classes, indeterminate };
|
|
35
|
+
}
|