@astrale-os/sdk 0.6.0-beta.5 → 0.6.0-beta.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +213 -60
- package/dist/application/action/action.d.ts +6 -0
- package/dist/application/action/authoring.d.ts +1 -1
- package/dist/application/action/context.d.ts +81 -33
- package/dist/application/action/define.d.ts +3 -3
- package/dist/application/action/index.d.ts +1 -1
- package/dist/application/define.d.ts +8 -6
- package/dist/application/define.js +28 -14
- package/dist/application/dependency/index.d.ts +1 -1
- package/dist/application/dependency/invoker.d.ts +21 -10
- package/dist/application/domain.d.ts +30 -0
- package/dist/application/error/error.d.ts +16 -1
- package/dist/application/error/error.js +39 -5
- package/dist/application/error/index.d.ts +1 -1
- package/dist/application/error/index.js +1 -1
- package/dist/application/index.d.ts +4 -4
- package/dist/application/index.js +1 -1
- package/dist/application/integration/define.d.ts +8 -1
- package/dist/application/integration/index.d.ts +2 -2
- package/dist/application/integration/integration.d.ts +13 -1
- package/dist/application/integration/operation.d.ts +16 -3
- package/dist/application/mutation/authoring/builder.d.ts +81 -33
- package/dist/application/mutation/authoring/builder.js +100 -30
- package/dist/application/mutation/authoring/guard.d.ts +37 -0
- package/dist/application/mutation/authoring/guard.js +150 -0
- package/dist/application/mutation/authoring/index.d.ts +5 -2
- package/dist/application/mutation/authoring/index.js +2 -1
- package/dist/application/mutation/authoring/names.d.ts +19 -0
- package/dist/application/mutation/authoring/names.js +83 -0
- package/dist/application/mutation/authoring/properties.d.ts +5 -3
- package/dist/application/mutation/authoring/properties.js +35 -2
- package/dist/application/mutation/authoring/transition.d.ts +3 -2
- package/dist/application/mutation/authoring/transition.js +4 -1
- package/dist/application/mutation/define.d.ts +24 -10
- package/dist/application/mutation/define.js +49 -53
- package/dist/application/mutation/execution/execute.d.ts +2 -2
- package/dist/application/mutation/execution/execute.js +78 -7
- package/dist/application/mutation/execution/executor.d.ts +4 -1
- package/dist/application/mutation/execution/executor.js +6 -1
- package/dist/application/mutation/failure.d.ts +17 -1
- package/dist/application/mutation/failure.js +40 -19
- package/dist/application/mutation/index.d.ts +9 -5
- package/dist/application/mutation/index.js +5 -2
- package/dist/application/mutation/legacy/v6/builder.d.ts +84 -0
- package/dist/application/mutation/legacy/v6/define.d.ts +18 -0
- package/dist/application/mutation/legacy/v6/define.js +56 -0
- package/dist/application/mutation/legacy/v6/mutation.d.ts +28 -0
- package/dist/application/mutation/{authoring → legacy/v6}/precondition.d.ts +4 -0
- package/dist/application/mutation/mutation.d.ts +47 -19
- package/dist/application/query/answer/answer.d.ts +117 -0
- package/dist/application/query/answer/conformance.d.ts +4 -0
- package/dist/application/query/answer/conformance.js +27 -0
- package/dist/application/query/answer/facts.d.ts +17 -0
- package/dist/application/query/answer/facts.js +57 -0
- package/dist/application/query/composite/builder.d.ts +1 -1
- package/dist/application/query/composite/builder.js +2 -2
- package/dist/application/query/composite/plan.d.ts +1 -5
- package/dist/application/query/composite/plan.js +1 -3
- package/dist/application/query/composite/query.d.ts +1 -2
- package/dist/application/query/define.d.ts +3 -34
- package/dist/application/query/define.js +5 -131
- package/dist/application/query/defined/define.d.ts +45 -0
- package/dist/application/query/defined/define.js +96 -0
- package/dist/application/query/defined/query.d.ts +139 -0
- package/dist/application/query/definition.d.ts +12 -0
- package/dist/application/query/definition.js +47 -0
- package/dist/application/query/execution/bounds.d.ts +22 -0
- package/dist/application/query/execution/bounds.js +88 -0
- package/dist/application/query/execution/client.d.ts +21 -0
- package/dist/application/query/execution/crossings.d.ts +25 -0
- package/dist/application/query/execution/crossings.js +192 -0
- package/dist/application/query/execution/error.d.ts +71 -0
- package/dist/application/query/execution/error.js +50 -0
- package/dist/application/query/execution/execute.d.ts +4 -10
- package/dist/application/query/execution/execute.js +3 -45
- package/dist/application/query/execution/executor.d.ts +2 -2
- package/dist/application/query/execution/refusal.d.ts +37 -0
- package/dist/application/query/execution/refusal.js +80 -0
- package/dist/application/query/execution/rows.d.ts +42 -0
- package/dist/application/query/execution/rows.js +320 -0
- package/dist/application/query/execution/run.d.ts +75 -0
- package/dist/application/query/execution/run.js +328 -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 +271 -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 +971 -0
- package/dist/application/query/handles/relations.d.ts +106 -0
- package/dist/application/query/handles/relations.js +1 -0
- package/dist/application/query/handles/rows.d.ts +94 -0
- package/dist/application/query/handles/rows.js +4 -0
- package/dist/application/query/handles/terms.d.ts +103 -0
- package/dist/application/query/handles/terms.js +282 -0
- package/dist/application/query/index.d.ts +14 -8
- package/dist/application/query/index.js +10 -5
- package/dist/application/query/language/index.d.ts +2 -0
- package/dist/application/query/language/index.js +2 -0
- package/dist/application/query/language/query.d.ts +323 -0
- package/dist/application/query/language/query.js +2 -0
- package/dist/application/query/{collection → legacy/v6/collection}/identity.d.ts +2 -2
- package/dist/application/query/{collection → legacy/v6/collection}/metadata.d.ts +1 -1
- package/dist/application/query/{collection → legacy/v6/collection}/union.d.ts +4 -4
- package/dist/application/query/{collection → legacy/v6/collection}/union.js +15 -8
- package/dist/application/query/legacy/v6/conformance.d.ts +15 -0
- package/dist/application/query/legacy/v6/conformance.js +46 -0
- package/dist/application/query/legacy/v6/define.d.ts +37 -0
- package/dist/application/query/legacy/v6/define.js +90 -0
- package/dist/application/query/legacy/v6/execution/execute.d.ts +18 -0
- package/dist/application/query/legacy/v6/execution/execute.js +50 -0
- package/dist/application/query/legacy/v6/index.d.ts +7 -0
- package/dist/application/query/legacy/v6/index.js +3 -0
- package/dist/application/query/legacy/v6/kernel.d.ts +6 -0
- package/dist/application/query/legacy/v6/kernel.js +5 -0
- package/dist/application/query/{single → legacy/v6/single}/pagination.js +1 -1
- package/dist/application/query/{single → legacy/v6/single}/query.d.ts +2 -14
- package/dist/application/query/legacy/v6/single/query.js +1 -0
- package/dist/application/query/query.d.ts +19 -4
- package/dist/application/routes/admission.d.ts +3 -3
- package/dist/application/routes/admission.js +3 -3
- package/dist/application/routes/index.d.ts +3 -2
- package/dist/application/routes/route.d.ts +3 -3
- package/dist/application/runtime/actions.js +3 -0
- package/dist/application/runtime/declarations.d.ts +6 -6
- package/dist/application/runtime/define.d.ts +5 -5
- package/dist/application/runtime/workflows.d.ts +3 -1
- package/dist/application/runtime/workflows.js +3 -4
- package/dist/application/view/define.js +4 -6
- package/dist/application/view/frontend.d.ts +2 -2
- package/dist/application/view/index.d.ts +1 -1
- package/dist/application/view/route.d.ts +0 -14
- package/dist/application/view/route.js +1 -64
- package/dist/application/workflow/authoring.d.ts +3 -2
- package/dist/application/workflow/context.d.ts +8 -2
- package/dist/application/workflow/define.d.ts +4 -4
- package/dist/application/workflow/define.js +14 -9
- package/dist/application/workflow/durable.d.ts +211 -0
- package/dist/application/workflow/durable.js +1 -0
- package/dist/application/workflow/index.d.ts +3 -2
- package/dist/application/workflow/runner/inline.js +3 -4
- package/dist/application/workflow/runner/runner.d.ts +2 -2
- package/dist/application/workflow/step/output.d.ts +2 -0
- package/dist/application/workflow/step/output.js +73 -0
- package/dist/application/workflow/workflow.d.ts +5 -3
- package/dist/deployment/adapter/adapter.d.ts +55 -13
- package/dist/deployment/adapter/bundle/bundle.d.ts +36 -0
- package/dist/deployment/adapter/bundle/bundle.js +1 -0
- package/dist/deployment/adapter/bundle/file.d.ts +10 -0
- package/dist/deployment/adapter/bundle/file.js +1 -0
- package/dist/deployment/adapter/bundle/index.d.ts +2 -0
- package/dist/deployment/adapter/bundle/index.js +1 -0
- package/dist/deployment/adapter/define.d.ts +4 -3
- package/dist/deployment/adapter/define.js +107 -23
- package/dist/deployment/adapter/index.d.ts +4 -3
- package/dist/deployment/adapter/index.js +1 -0
- package/dist/deployment/adapter/release/command.d.ts +33 -0
- package/dist/deployment/adapter/release/command.js +1 -0
- package/dist/deployment/adapter/release/context.d.ts +94 -0
- package/dist/deployment/adapter/release/context.js +1 -0
- package/dist/deployment/adapter/release/index.d.ts +4 -0
- package/dist/deployment/adapter/release/index.js +1 -0
- package/dist/deployment/adapter/release/list.d.ts +53 -0
- package/dist/deployment/adapter/release/list.js +1 -0
- package/dist/deployment/adapter/release/refusal.d.ts +10 -0
- package/dist/deployment/adapter/release/refusal.js +14 -0
- package/dist/deployment/adapter/release/result.d.ts +56 -0
- package/dist/deployment/adapter/release/result.js +1 -0
- package/dist/deployment/address/configuration.d.ts +96 -0
- package/dist/deployment/address/configuration.js +274 -0
- package/dist/deployment/address/fingerprint.d.ts +5 -0
- package/dist/deployment/address/fingerprint.js +27 -0
- package/dist/deployment/address/index.d.ts +5 -0
- package/dist/deployment/address/index.js +4 -0
- package/dist/deployment/address/label.d.ts +42 -0
- package/dist/deployment/address/label.js +80 -0
- package/dist/deployment/address/line.d.ts +29 -0
- package/dist/deployment/address/line.js +53 -0
- package/dist/deployment/address/record.d.ts +73 -0
- package/dist/deployment/address/record.js +138 -0
- package/dist/deployment/address/summary.d.ts +30 -0
- package/dist/deployment/address/summary.js +1 -0
- package/dist/deployment/address/vectors.d.ts +60 -0
- package/dist/deployment/address/vectors.js +517 -0
- package/dist/deployment/authoring.d.ts +0 -2
- package/dist/deployment/authoring.js +0 -1
- package/dist/deployment/build/build.d.ts +15 -2
- package/dist/deployment/build/compile.d.ts +4 -4
- package/dist/deployment/build/compile.js +19 -17
- package/dist/deployment/build/frontend/compilation.d.ts +2 -4
- package/dist/deployment/build/frontend/compilation.js +0 -5
- package/dist/deployment/build/frontend/digest.js +1 -5
- package/dist/deployment/build/index.d.ts +1 -0
- package/dist/deployment/build/index.js +1 -0
- package/dist/deployment/build/manifest.d.ts +59 -0
- package/dist/deployment/build/manifest.js +118 -0
- package/dist/deployment/build/material.d.ts +2 -2
- package/dist/deployment/build/material.js +31 -13
- package/dist/deployment/build/schema.d.ts +2 -2
- package/dist/deployment/deployment.d.ts +3 -2
- package/dist/deployment/environment.d.ts +6 -0
- package/dist/deployment/environment.js +6 -0
- package/dist/deployment/index.d.ts +4 -6
- package/dist/deployment/index.js +1 -2
- package/dist/deployment/release/addressing.d.ts +6 -5
- package/dist/deployment/release/addressing.js +2 -3
- package/dist/deployment/release/assemble.d.ts +6 -3
- package/dist/deployment/release/assemble.js +12 -10
- package/dist/deployment/release/release.d.ts +16 -5
- package/dist/deployment/release/seal.d.ts +14 -0
- package/dist/deployment/release/seal.js +22 -0
- package/dist/deployment/release/{publication → served}/callables.d.ts +2 -2
- package/dist/deployment/release/{publication → served}/callables.js +2 -2
- package/dist/deployment/release/served/index.d.ts +11 -0
- package/dist/deployment/release/served/index.js +26 -0
- package/dist/deployment/release/{publication → served}/views.d.ts +2 -2
- package/dist/deployment/release/{publication → served}/views.js +0 -1
- package/dist/deployment/runtime/admission.d.ts +2 -2
- package/dist/deployment/runtime/admission.js +5 -5
- package/dist/deployment/verify/index.d.ts +3 -4
- package/dist/deployment/verify/index.js +2 -3
- package/dist/deployment/verify/preflight/bundle.d.ts +18 -0
- package/dist/deployment/verify/preflight/bundle.js +71 -0
- package/dist/deployment/verify/preflight/index.d.ts +1 -12
- package/dist/deployment/verify/preflight/index.js +1 -12
- package/dist/deployment/verify/readiness/fetch.d.ts +13 -0
- package/dist/deployment/verify/readiness/fetch.js +26 -0
- package/dist/deployment/verify/readiness/identity.d.ts +3 -6
- package/dist/deployment/verify/readiness/identity.js +3 -3
- package/dist/deployment/verify/readiness/index.d.ts +15 -8
- package/dist/deployment/verify/readiness/index.js +25 -6
- package/dist/deployment/verify/readiness/release.d.ts +8 -0
- package/dist/deployment/verify/readiness/release.js +22 -0
- package/dist/deployment/worker/address.d.ts +26 -0
- package/dist/deployment/worker/address.js +43 -0
- package/dist/deployment/worker/build.d.ts +60 -0
- package/dist/deployment/worker/build.js +172 -0
- package/dist/deployment/worker/configuration.d.ts +73 -0
- package/dist/deployment/worker/configuration.js +165 -0
- package/dist/deployment/worker/content.d.ts +38 -0
- package/dist/deployment/worker/content.js +169 -0
- package/dist/deployment/worker/index.d.ts +29 -0
- package/dist/deployment/worker/index.js +29 -0
- package/dist/deployment/worker/limits.d.ts +30 -0
- package/dist/deployment/worker/limits.js +30 -0
- package/dist/deployment/worker/record.d.ts +29 -0
- package/dist/deployment/worker/record.js +69 -0
- package/dist/deployment/worker/request.d.ts +118 -0
- package/dist/deployment/worker/request.js +280 -0
- package/dist/deployment/worker/response.d.ts +101 -0
- package/dist/deployment/worker/response.js +207 -0
- package/dist/execution/cache/cache.d.ts +17 -0
- package/dist/execution/cache/cache.js +11 -0
- package/dist/execution/cache/index.d.ts +2 -0
- package/dist/execution/cache/index.js +2 -0
- package/dist/execution/cache/memory.d.ts +13 -0
- package/dist/execution/cache/memory.js +48 -0
- package/dist/execution/identity/authentication.d.ts +33 -3
- package/dist/execution/identity/authentication.js +90 -36
- package/dist/execution/identity/callback.d.ts +20 -20
- package/dist/execution/identity/callback.js +34 -26
- package/dist/execution/identity/delivery.d.ts +6 -4
- package/dist/execution/identity/delivery.js +25 -20
- package/dist/execution/identity/identity.d.ts +17 -3
- package/dist/execution/identity/identity.js +12 -4
- package/dist/execution/identity/jwks.d.ts +5 -0
- package/dist/execution/identity/jwks.js +92 -102
- package/dist/execution/index.d.ts +6 -4
- package/dist/execution/index.js +4 -2
- package/dist/execution/invocation/admission/age.d.ts +57 -0
- package/dist/execution/invocation/admission/age.js +208 -0
- package/dist/execution/invocation/admission/authentication.d.ts +13 -13
- package/dist/execution/invocation/admission/authentication.js +52 -44
- package/dist/execution/invocation/admission/authority.d.ts +28 -6
- package/dist/execution/invocation/admission/authority.js +9 -2
- package/dist/execution/invocation/admission/index.d.ts +4 -3
- package/dist/execution/invocation/admission/index.js +3 -2
- package/dist/execution/invocation/admission/input.d.ts +2 -2
- package/dist/execution/invocation/admission/input.js +16 -2
- package/dist/execution/invocation/admission/target.d.ts +11 -0
- package/dist/execution/invocation/admission/target.js +22 -3
- package/dist/execution/invocation/capabilities/bind.d.ts +13 -0
- package/dist/execution/invocation/capabilities/bind.js +61 -0
- package/dist/execution/invocation/capabilities/index.d.ts +1 -0
- package/dist/execution/invocation/capabilities/index.js +1 -0
- package/dist/execution/invocation/dependency/bind.d.ts +3 -1
- package/dist/execution/invocation/dependency/bind.js +36 -16
- package/dist/execution/invocation/dispatch/action.js +4 -2
- package/dist/execution/invocation/dispatch/context.d.ts +7 -6
- package/dist/execution/invocation/dispatch/context.js +11 -44
- package/dist/execution/invocation/dispatch/workflow.js +4 -6
- package/dist/execution/invocation/handler.js +8 -2
- package/dist/execution/invocation/index.d.ts +2 -2
- package/dist/execution/invocation/index.js +1 -1
- package/dist/execution/invocation/integration/authentication.d.ts +3 -3
- package/dist/execution/invocation/integration/authentication.js +7 -7
- package/dist/execution/invocation/integration/call.d.ts +2 -1
- package/dist/execution/invocation/integration/call.js +3 -3
- package/dist/execution/invocation/integration/clients.d.ts +1 -1
- package/dist/execution/invocation/integration/index.d.ts +1 -0
- package/dist/execution/invocation/integration/index.js +1 -0
- package/dist/execution/invocation/invocation.d.ts +6 -0
- package/dist/execution/invocation/invocation.js +129 -21
- package/dist/execution/invocation/lifecycle/active.d.ts +8 -2
- package/dist/execution/invocation/lifecycle/active.js +3 -3
- package/dist/execution/invocation/lifecycle/index.d.ts +1 -1
- package/dist/execution/invocation/result/errors.d.ts +0 -10
- package/dist/execution/invocation/result/errors.js +4 -16
- package/dist/execution/invocation/result/index.d.ts +3 -2
- package/dist/execution/invocation/result/index.js +2 -1
- package/dist/execution/invocation/result/project.js +41 -1
- package/dist/execution/invocation/result/undeclared.d.ts +7 -0
- package/dist/execution/invocation/result/undeclared.js +18 -0
- package/dist/execution/node/serve.d.ts +2 -2
- package/dist/execution/node/serve.js +1 -1
- package/dist/execution/runtime/index.d.ts +1 -0
- package/dist/execution/runtime/index.js +1 -0
- package/dist/execution/runtime/load.d.ts +3 -3
- package/dist/execution/runtime/load.js +3 -2
- package/dist/execution/runtime/release.d.ts +17 -0
- package/dist/execution/runtime/release.js +7 -0
- package/dist/execution/serve.d.ts +18 -4
- package/dist/execution/serve.js +10 -0
- package/dist/execution/service/create.js +44 -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 +27 -0
- package/dist/execution/workflows/receiver.js +100 -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 +51 -0
- package/dist/execution/workflows/steps.js +93 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/platform/graph/alias.d.ts +1 -5
- package/dist/platform/graph/alias.js +1 -5
- package/dist/platform/graph/document/index.d.ts +1 -1
- package/dist/platform/graph/document/index.js +1 -1
- package/dist/platform/graph/index.d.ts +1 -1
- package/dist/platform/graph/index.js +1 -1
- package/dist/platform/release/index.d.ts +2 -0
- package/dist/platform/release/index.js +2 -0
- package/dist/platform/schema/callable-authoring.d.ts +21 -0
- package/dist/platform/schema/callable-authoring.js +27 -0
- package/dist/platform/schema/class-authoring.d.ts +56 -12
- package/dist/platform/schema/class-authoring.js +37 -4
- package/dist/platform/schema/class-icon-svg.d.ts +9 -0
- package/dist/platform/schema/class-icon-svg.js +29 -0
- package/dist/platform/schema/class-icon.d.ts +3 -8
- package/dist/platform/schema/class-icon.js +2 -29
- package/dist/platform/schema/index.d.ts +6 -4
- package/dist/platform/schema/index.js +2 -1
- package/dist/platform/schema/kernel-compiled.d.ts +2 -0
- package/dist/platform/schema/kernel-compiled.js +2 -0
- package/dist/platform/schema/kernel.d.ts +4 -2
- package/dist/platform/schema/property.d.ts +5 -0
- package/dist/platform/schema/schema-authoring.d.ts +14 -7
- package/dist/platform/schema/schema-authoring.js +5 -1
- package/dist/platform/versioning/dependents.d.ts +18 -0
- package/dist/platform/versioning/dependents.js +15 -0
- package/dist/platform/versioning/index.d.ts +5 -0
- package/dist/platform/versioning/index.js +5 -0
- package/dist/platform/versioning/name.d.ts +38 -0
- package/dist/platform/versioning/name.js +58 -0
- package/dist/platform/versioning/reference.d.ts +48 -0
- package/dist/platform/versioning/reference.js +95 -0
- package/dist/platform/versioning/version.d.ts +72 -0
- package/dist/platform/versioning/version.js +98 -0
- package/dist/project/admit.js +1 -5
- package/dist/project/define.d.ts +4 -4
- package/dist/project/define.js +55 -35
- package/dist/project/index.d.ts +1 -1
- package/dist/project/install-command.d.ts +6 -0
- package/dist/project/install-command.js +9 -0
- package/dist/project/project.d.ts +10 -8
- package/dist/testing/dataset/define.d.ts +1 -1
- package/dist/testing/durable/engine.d.ts +128 -0
- package/dist/testing/durable/engine.js +619 -0
- package/dist/testing/durable/index.d.ts +3 -0
- package/dist/testing/durable/index.js +1 -0
- package/dist/testing/durable/steps.d.ts +30 -0
- package/dist/testing/durable/steps.js +45 -0
- package/dist/testing/index.d.ts +8 -1
- package/dist/testing/index.js +6 -1
- package/dist/testing/load.js +1 -1
- package/dist/testing/query.d.ts +17 -0
- package/dist/testing/query.js +34 -0
- package/dist/tooling/cli/adapter-command.d.ts +35 -0
- package/dist/tooling/cli/adapter-command.js +66 -0
- package/dist/tooling/cli/arguments.d.ts +17 -6
- package/dist/tooling/cli/arguments.js +175 -52
- package/dist/tooling/cli/build.d.ts +55 -0
- package/dist/tooling/cli/build.js +77 -0
- package/dist/tooling/cli/bun.d.ts +0 -1
- package/dist/tooling/cli/bun.js +0 -7
- package/dist/tooling/cli/commit.d.ts +35 -0
- package/dist/tooling/cli/commit.js +235 -0
- package/dist/tooling/cli/deploy-mode.d.ts +26 -0
- package/dist/tooling/cli/deploy-mode.js +59 -0
- package/dist/tooling/cli/deploy-result.d.ts +80 -0
- package/dist/tooling/cli/deploy-result.js +64 -0
- package/dist/tooling/cli/diff/declared.d.ts +7 -0
- package/dist/tooling/cli/diff/declared.js +27 -0
- package/dist/tooling/cli/diff/index.d.ts +30 -0
- package/dist/tooling/cli/diff/index.js +58 -0
- package/dist/tooling/cli/diff/render.d.ts +15 -0
- package/dist/tooling/cli/diff/render.js +131 -0
- package/dist/tooling/cli/diff/report.d.ts +88 -0
- package/dist/tooling/cli/diff/report.js +154 -0
- package/dist/tooling/cli/dotenv.d.ts +5 -5
- package/dist/tooling/cli/dotenv.js +6 -36
- package/dist/tooling/cli/help.js +173 -60
- package/dist/tooling/cli/immutable-deployment.d.ts +83 -0
- package/dist/tooling/cli/immutable-deployment.js +135 -0
- package/dist/tooling/cli/index.d.ts +12 -4
- package/dist/tooling/cli/index.js +6 -3
- package/dist/tooling/cli/installed-on.d.ts +83 -0
- package/dist/tooling/cli/installed-on.js +156 -0
- package/dist/tooling/cli/list.d.ts +152 -0
- package/dist/tooling/cli/list.js +331 -0
- package/dist/tooling/cli/log.d.ts +5 -2
- package/dist/tooling/cli/log.js +9 -2
- package/dist/tooling/cli/orchestrate.d.ts +0 -6
- package/dist/tooling/cli/orchestrate.js +252 -91
- package/dist/tooling/cli/project.d.ts +3 -3
- package/dist/tooling/cli/publish/index.d.ts +81 -0
- package/dist/tooling/cli/publish/index.js +383 -0
- package/dist/tooling/cli/publish/report.d.ts +49 -0
- package/dist/tooling/cli/publish/report.js +15 -0
- package/dist/tooling/cli/registry/client.d.ts +121 -0
- package/dist/tooling/cli/registry/client.js +354 -0
- package/dist/tooling/cli/registry/error.d.ts +11 -0
- package/dist/tooling/cli/registry/error.js +17 -0
- package/dist/tooling/cli/registry/executable.d.ts +35 -0
- package/dist/tooling/cli/registry/executable.js +96 -0
- package/dist/tooling/cli/registry/index.d.ts +9 -0
- package/dist/tooling/cli/registry/index.js +8 -0
- package/dist/tooling/cli/registry/installations.d.ts +67 -0
- package/dist/tooling/cli/registry/installations.js +108 -0
- package/dist/tooling/cli/registry/process.d.ts +36 -0
- package/dist/tooling/cli/registry/process.js +119 -0
- package/dist/tooling/cli/secrets.d.ts +9 -0
- package/dist/tooling/cli/secrets.js +19 -0
- package/dist/tooling/cli/yank.d.ts +34 -0
- package/dist/tooling/cli/yank.js +32 -0
- package/dist/tooling/linter/adapters/typescript/definition-calls.d.ts +34 -0
- package/dist/tooling/linter/adapters/typescript/definition-calls.js +88 -0
- package/dist/tooling/linter/adapters/typescript/imports.d.ts +0 -1
- package/dist/tooling/linter/adapters/typescript/imports.js +1 -5
- package/dist/tooling/linter/adapters/typescript/index.d.ts +3 -2
- package/dist/tooling/linter/adapters/typescript/index.js +3 -2
- package/dist/tooling/linter/adapters/typescript/query-observation.js +37 -12
- package/dist/tooling/linter/adapters/typescript/syntax.d.ts +3 -3
- package/dist/tooling/linter/adapters/typescript/syntax.js +13 -25
- package/dist/tooling/linter/adapters/typescript/type-analysis.d.ts +2 -0
- package/dist/tooling/linter/adapters/typescript/type-analysis.js +10 -0
- package/dist/tooling/linter/implementations/source/callable-requirements.d.ts +1 -2
- package/dist/tooling/linter/implementations/source/callable-requirements.js +11 -16
- package/dist/tooling/linter/implementations/source/definitions.d.ts +2 -0
- package/dist/tooling/linter/implementations/source/definitions.js +425 -0
- package/dist/tooling/linter/implementations/source/dependencies.js +13 -72
- package/dist/tooling/linter/implementations/source/global.js +18 -11
- package/dist/tooling/linter/implementations/source/mutations.js +146 -48
- package/dist/tooling/linter/implementations/source/policy-edges.d.ts +2 -0
- package/dist/tooling/linter/implementations/source/policy-edges.js +113 -0
- package/dist/tooling/linter/implementations/source/providers.js +5 -5
- package/dist/tooling/linter/implementations/source/queries.js +1 -17
- package/dist/tooling/linter/implementations/source/shared.d.ts +19 -5
- package/dist/tooling/linter/implementations/source/shared.js +131 -55
- package/dist/tooling/linter/implementations/source/verifiers.js +4 -2
- package/dist/tooling/linter/implementations/source/views.js +2 -2
- package/dist/tooling/linter/implementations/source/workflows.js +499 -17
- package/dist/tooling/linter/policy/generated.js +15 -64
- package/dist/tooling/linter/requirements/registry.js +11 -9
- package/dist/tooling/packaging/declarations/ownership.js +1 -1
- package/dist/tooling/packaging/finalize.d.ts +1 -1
- package/dist/tooling/packaging/finalize.js +1 -1
- package/docs/admission-age.md +88 -0
- package/docs/auth-api-migration.md +55 -0
- package/docs/business-errors.md +42 -0
- package/docs/domain-definition-migration.md +44 -0
- package/docs/domain-schema-migration.md +36 -0
- package/docs/durable-workflows.md +473 -0
- package/docs/handler-dependencies.md +285 -0
- package/docs/legacy/query-v6.md +62 -0
- package/docs/queries.md +475 -0
- package/docs/release.md +155 -0
- package/docs/schema-cost.md +124 -0
- package/package.json +49 -17
- package/dist/application/application.d.ts +0 -28
- package/dist/application/query/execution/projection.d.ts +0 -3
- package/dist/application/query/execution/projection.js +0 -3
- package/dist/deployment/adapter/deploy/context.d.ts +0 -15
- package/dist/deployment/adapter/deploy/index.d.ts +0 -2
- package/dist/deployment/adapter/deploy/result.d.ts +0 -50
- package/dist/deployment/adapter/prepare/artifact.d.ts +0 -33
- package/dist/deployment/adapter/prepare/context.d.ts +0 -23
- package/dist/deployment/adapter/prepare/index.d.ts +0 -2
- package/dist/deployment/deploy.d.ts +0 -20
- package/dist/deployment/deploy.js +0 -31
- package/dist/deployment/release/publication/index.d.ts +0 -6
- package/dist/deployment/release/publication/index.js +0 -6
- package/dist/deployment/release/publication/manifest.d.ts +0 -3
- package/dist/deployment/release/publication/manifest.js +0 -5
- package/dist/deployment/release/publication/requirements.d.ts +0 -3
- package/dist/deployment/release/publication/requirements.js +0 -3
- package/dist/deployment/release/publication/seal.d.ts +0 -10
- package/dist/deployment/release/publication/seal.js +0 -39
- package/dist/deployment/verify/preflight/artifact.d.ts +0 -6
- package/dist/deployment/verify/preflight/artifact.js +0 -122
- package/dist/deployment/verify/preflight/publication.d.ts +0 -4
- package/dist/deployment/verify/preflight/publication.js +0 -14
- package/dist/deployment/verify/readiness/deployment.d.ts +0 -3
- package/dist/deployment/verify/readiness/deployment.js +0 -151
- package/dist/deployment/verify/readiness/publication.d.ts +0 -11
- package/dist/deployment/verify/readiness/publication.js +0 -41
- package/dist/execution/service/errors.d.ts +0 -3
- package/dist/execution/service/errors.js +0 -3
- package/dist/execution/service/publication/delivery.d.ts +0 -2
- package/dist/execution/service/publication/installation.d.ts +0 -3
- package/dist/execution/service/publication/installation.js +0 -8
- package/dist/execution/service/publication/source.d.ts +0 -3
- package/dist/execution/service/publication/source.js +0 -11
- package/dist/platform/publication/index.d.ts +0 -2
- package/dist/platform/publication/index.js +0 -2
- package/dist/tooling/cli/astrale/authority.d.ts +0 -5
- package/dist/tooling/cli/astrale/authority.js +0 -11
- package/dist/tooling/cli/astrale/executable.d.ts +0 -2
- package/dist/tooling/cli/astrale/executable.js +0 -47
- package/dist/tooling/cli/astrale/failure.d.ts +0 -6
- package/dist/tooling/cli/astrale/failure.js +0 -48
- package/dist/tooling/cli/astrale/instance.d.ts +0 -11
- package/dist/tooling/cli/astrale/instance.js +0 -52
- package/dist/tooling/cli/astrale/process.d.ts +0 -13
- package/dist/tooling/cli/astrale/process.js +0 -94
- package/dist/tooling/cli/astrale/version.d.ts +0 -18
- package/dist/tooling/cli/astrale/version.js +0 -55
- package/dist/tooling/cli/credential.d.ts +0 -2
- package/dist/tooling/cli/credential.js +0 -57
- package/dist/tooling/cli/deprecations.d.ts +0 -9
- package/dist/tooling/cli/deprecations.js +0 -15
- package/dist/tooling/cli/development/candidate.d.ts +0 -25
- package/dist/tooling/cli/development/candidate.js +0 -176
- package/dist/tooling/cli/development/deployment.d.ts +0 -16
- package/dist/tooling/cli/development/deployment.js +0 -39
- package/dist/tooling/cli/development/develop.d.ts +0 -11
- package/dist/tooling/cli/development/develop.js +0 -243
- package/dist/tooling/cli/development/lease.d.ts +0 -18
- package/dist/tooling/cli/development/lease.js +0 -163
- package/dist/tooling/cli/development/lifecycle.d.ts +0 -9
- package/dist/tooling/cli/development/lifecycle.js +0 -43
- package/dist/tooling/cli/development/project-imports.d.ts +0 -22
- package/dist/tooling/cli/development/project-imports.js +0 -39
- package/dist/tooling/cli/development/project-lock.d.ts +0 -16
- package/dist/tooling/cli/development/project-lock.js +0 -41
- package/dist/tooling/cli/development/rebuild.d.ts +0 -13
- package/dist/tooling/cli/development/rebuild.js +0 -58
- package/dist/tooling/cli/development/release-evidence.d.ts +0 -4
- package/dist/tooling/cli/development/release-evidence.js +0 -10
- package/dist/tooling/cli/development/report.d.ts +0 -6
- package/dist/tooling/cli/development/report.js +0 -14
- package/dist/tooling/cli/development/session-file.d.ts +0 -53
- package/dist/tooling/cli/development/session-file.js +0 -337
- package/dist/tooling/cli/development/source-watch.d.ts +0 -14
- package/dist/tooling/cli/development/source-watch.js +0 -140
- package/dist/tooling/cli/development/sources.d.ts +0 -7
- package/dist/tooling/cli/development/sources.js +0 -48
- package/dist/tooling/cli/development/target-lock.d.ts +0 -16
- package/dist/tooling/cli/development/target-lock.js +0 -68
- package/dist/tooling/cli/development/view.d.ts +0 -28
- package/dist/tooling/cli/development/view.js +0 -151
- package/dist/tooling/cli/environment-release.d.ts +0 -21
- package/dist/tooling/cli/environment-release.js +0 -46
- package/dist/tooling/cli/evidence.d.ts +0 -11
- package/dist/tooling/cli/evidence.js +0 -53
- package/dist/tooling/cli/installation/index.d.ts +0 -2
- package/dist/tooling/cli/installation/index.js +0 -1
- package/dist/tooling/cli/installation/observation.d.ts +0 -10
- package/dist/tooling/cli/installation/observation.js +0 -44
- package/dist/tooling/cli/installation/reconcile.d.ts +0 -32
- package/dist/tooling/cli/installation/reconcile.js +0 -122
- package/dist/tooling/linter/implementations/source/migrations.d.ts +0 -2
- package/dist/tooling/linter/implementations/source/migrations.js +0 -113
- package/dist/tooling/linter/qualification/index.d.ts +0 -10
- package/dist/tooling/linter/qualification/index.js +0 -2
- package/dist/tooling/linter/qualification/query-fixtures.d.ts +0 -2
- package/dist/tooling/linter/qualification/query-fixtures.js +0 -68
- package/dist/tooling/linter/qualification/runner.d.ts +0 -3
- package/dist/tooling/linter/qualification/runner.js +0 -6
- /package/dist/application/{application.js → domain.js} +0 -0
- /package/dist/application/{query/single/query.js → mutation/legacy/v6/builder.js} +0 -0
- /package/dist/{deployment/adapter/deploy/context.js → application/mutation/legacy/v6/mutation.js} +0 -0
- /package/dist/application/mutation/{authoring → legacy/v6}/precondition.js +0 -0
- /package/dist/{deployment/adapter/deploy/index.js → application/query/answer/answer.js} +0 -0
- /package/dist/{deployment/adapter/deploy/result.js → application/query/defined/query.js} +0 -0
- /package/dist/{deployment/adapter/prepare/artifact.js → application/query/execution/client.js} +0 -0
- /package/dist/{deployment/adapter/prepare/context.js → application/query/handles/conditions.js} +0 -0
- /package/dist/{deployment/adapter/prepare/index.js → application/query/handles/domain.js} +0 -0
- /package/dist/application/query/{collection → legacy/v6/collection}/identity.js +0 -0
- /package/dist/application/query/{collection → legacy/v6/collection}/limits.d.ts +0 -0
- /package/dist/application/query/{collection → legacy/v6/collection}/limits.js +0 -0
- /package/dist/application/query/{collection → legacy/v6/collection}/metadata.js +0 -0
- /package/dist/application/query/{execution → legacy/v6/execution}/pages.d.ts +0 -0
- /package/dist/application/query/{execution → legacy/v6/execution}/pages.js +0 -0
- /package/dist/application/query/{single → legacy/v6/single}/index.d.ts +0 -0
- /package/dist/application/query/{single → legacy/v6/single}/index.js +0 -0
- /package/dist/application/query/{single → legacy/v6/single}/node.d.ts +0 -0
- /package/dist/application/query/{single → legacy/v6/single}/node.js +0 -0
- /package/dist/application/query/{single → legacy/v6/single}/pagination.d.ts +0 -0
- /package/dist/application/query/{single → legacy/v6/single}/selection.d.ts +0 -0
- /package/dist/application/query/{single → legacy/v6/single}/selection.js +0 -0
- /package/dist/deployment/release/{publication → served}/routes.d.ts +0 -0
- /package/dist/deployment/release/{publication → served}/routes.js +0 -0
- /package/dist/execution/service/{publication → serving}/index.js +0 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { RegistryCliError } from './error.js';
|
|
2
|
+
/**
|
|
3
|
+
* Decode one `astrale.installed-list` v1 document: the instance Kernel that answered, whether the
|
|
4
|
+
* listing may omit installations (`partial`, required) and the deployment URL of each
|
|
5
|
+
* installation. Anything else is refused.
|
|
6
|
+
*/
|
|
7
|
+
export function decodeInstanceListing(document) {
|
|
8
|
+
if (document.format !== 'astrale.installed-list' ||
|
|
9
|
+
document.version !== 1 ||
|
|
10
|
+
!httpUrl(document.kernel) ||
|
|
11
|
+
typeof document.partial !== 'boolean' ||
|
|
12
|
+
!Array.isArray(document.domains)) {
|
|
13
|
+
throw protocolError('Astrale CLI answered no installed list of the instance.');
|
|
14
|
+
}
|
|
15
|
+
return Object.freeze({
|
|
16
|
+
kind: 'listed',
|
|
17
|
+
kernel: document.kernel,
|
|
18
|
+
partial: document.partial,
|
|
19
|
+
installations: Object.freeze(document.domains.map((entry) => {
|
|
20
|
+
if (!isRecord(entry) || !text(entry.origin) || !httpUrl(entry.url)) {
|
|
21
|
+
throw protocolError('Astrale CLI answered a malformed installation of the instance.');
|
|
22
|
+
}
|
|
23
|
+
return Object.freeze({ origin: entry.origin, url: entry.url });
|
|
24
|
+
})),
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Why an instance listing failed, from the machine error the CLI printed on stderr (the last line
|
|
29
|
+
* that is a JSON object with an `error` code): only that code is read, never its message, since
|
|
30
|
+
* stderr may name the caller's credential. A Kernel without the listing is `unsupported`; a timeout
|
|
31
|
+
* at any phase is `timeout`; a Kernel refusal is `refused`; anything else, a command that printed
|
|
32
|
+
* no machine error and a failed read of Admin's registry (`isAdminFailure`) included, is
|
|
33
|
+
* `unavailable`.
|
|
34
|
+
*/
|
|
35
|
+
export function instanceRefusal(stderr) {
|
|
36
|
+
const failure = machineError(stderr);
|
|
37
|
+
if (failure === undefined) {
|
|
38
|
+
return unknown('unavailable', 'REGISTRY_CLI_FAILED');
|
|
39
|
+
}
|
|
40
|
+
const code = admittedCode(failure.error);
|
|
41
|
+
if (code === 'KERNEL_RELEASE_UNSUPPORTED')
|
|
42
|
+
return unknown('unsupported', code);
|
|
43
|
+
if (failure.phase === 'timeout')
|
|
44
|
+
return unknown('timeout', code);
|
|
45
|
+
if (code === 'RESPONSE_ERROR')
|
|
46
|
+
return unknown('refused', code);
|
|
47
|
+
return unknown('unavailable', code);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Whether an instance listing failed on Admin's side, not the instance's: the listing also reads
|
|
51
|
+
* Admin's registry to name what runs there, and fails as a whole when that read fails (CT24, C7).
|
|
52
|
+
* Its codes are Admin's (`REGISTRY_*`, `ADMIN_*`), never the SDK's own `REGISTRY_CLI_*`.
|
|
53
|
+
*/
|
|
54
|
+
export function isAdminFailure(code) {
|
|
55
|
+
return ((code.startsWith('REGISTRY_') && !code.startsWith('REGISTRY_CLI_')) || code.startsWith('ADMIN_'));
|
|
56
|
+
}
|
|
57
|
+
/** The instance did not answer within the probe's time. */
|
|
58
|
+
export function instanceTimeout() {
|
|
59
|
+
return unknown('timeout', 'REGISTRY_CLI_TIMEOUT');
|
|
60
|
+
}
|
|
61
|
+
/** The CLI answered the instance listing with something this SDK cannot read. */
|
|
62
|
+
export function instanceUnreadable() {
|
|
63
|
+
return unknown('unavailable', 'REGISTRY_CLI_PROTOCOL');
|
|
64
|
+
}
|
|
65
|
+
function unknown(reason, code) {
|
|
66
|
+
return Object.freeze({ kind: 'unknown', reason, code });
|
|
67
|
+
}
|
|
68
|
+
function machineError(stderr) {
|
|
69
|
+
const lines = stderr.split('\n').map((line) => line.trim());
|
|
70
|
+
for (let index = lines.length - 1; index >= 0; index -= 1) {
|
|
71
|
+
const line = lines[index];
|
|
72
|
+
if (!line.startsWith('{'))
|
|
73
|
+
continue;
|
|
74
|
+
try {
|
|
75
|
+
const value = JSON.parse(line);
|
|
76
|
+
if (isRecord(value) && typeof value.error === 'string') {
|
|
77
|
+
return { error: value.error, phase: value.phase };
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
// A human line that happens to start with a brace: keep looking upwards.
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
function protocolError(message) {
|
|
87
|
+
return new RegistryCliError('REGISTRY_CLI_PROTOCOL', message);
|
|
88
|
+
}
|
|
89
|
+
function admittedCode(input) {
|
|
90
|
+
return /^[A-Z][A-Z0-9_]{0,63}$/u.test(input) ? input : 'REGISTRY_CLI_FAILED';
|
|
91
|
+
}
|
|
92
|
+
function httpUrl(input) {
|
|
93
|
+
if (typeof input !== 'string')
|
|
94
|
+
return false;
|
|
95
|
+
try {
|
|
96
|
+
const url = new URL(input);
|
|
97
|
+
return url.protocol === 'https:' || url.protocol === 'http:';
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function text(input) {
|
|
104
|
+
return typeof input === 'string' && input.length > 0;
|
|
105
|
+
}
|
|
106
|
+
function isRecord(input) {
|
|
107
|
+
return typeof input === 'object' && input !== null && !Array.isArray(input);
|
|
108
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface RegistryProcessInput {
|
|
2
|
+
readonly executable: string;
|
|
3
|
+
readonly args: readonly string[];
|
|
4
|
+
readonly projectDir: string;
|
|
5
|
+
readonly signal: AbortSignal;
|
|
6
|
+
readonly timeoutMs: number;
|
|
7
|
+
/** Bytes of stdout kept before the child is stopped; a registry index can be large. */
|
|
8
|
+
readonly stdoutLimit: number;
|
|
9
|
+
/** One document written to the child's stdin, such as a publish request; none by default. */
|
|
10
|
+
readonly stdin?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Bytes of stderr kept, for a caller that reads the machine error code a command without a
|
|
13
|
+
* stdout refusal document prints there (`astrale domain list -i --json`). The CLI prints that
|
|
14
|
+
* error last, after any human lines, so the last bytes are kept and older ones dropped. Absent,
|
|
15
|
+
* stderr is never kept.
|
|
16
|
+
*/
|
|
17
|
+
readonly stderrLimit?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface RegistryProcessResult {
|
|
20
|
+
readonly code: number;
|
|
21
|
+
readonly stdout: string;
|
|
22
|
+
/** The kept tail of stderr, present exactly when the input set `stderrLimit`. */
|
|
23
|
+
readonly stderr?: string;
|
|
24
|
+
}
|
|
25
|
+
/** The command did not end within its `timeoutMs`; the child was stopped. */
|
|
26
|
+
export declare class RegistryProcessTimeoutError extends Error {
|
|
27
|
+
constructor();
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Run one Astrale CLI registry command with bounded output and time. Stderr is drained and dropped:
|
|
31
|
+
* the CLI prints its human diagnostics there, which may name the caller's credential, and every
|
|
32
|
+
* registry command already answers with one document on stdout, its refusals included (CT29). A
|
|
33
|
+
* caller that sets `stderrLimit` gets the bounded tail back, to read a machine error code from; it
|
|
34
|
+
* never relays it.
|
|
35
|
+
*/
|
|
36
|
+
export declare function runRegistryProcess(input: RegistryProcessInput): Promise<RegistryProcessResult>;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
const TERMINATION_GRACE_MS = 1_000;
|
|
3
|
+
/** The command did not end within its `timeoutMs`; the child was stopped. */
|
|
4
|
+
export class RegistryProcessTimeoutError extends Error {
|
|
5
|
+
constructor() {
|
|
6
|
+
super('Astrale CLI command timed out.');
|
|
7
|
+
this.name = 'RegistryProcessTimeoutError';
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Run one Astrale CLI registry command with bounded output and time. Stderr is drained and dropped:
|
|
12
|
+
* the CLI prints its human diagnostics there, which may name the caller's credential, and every
|
|
13
|
+
* registry command already answers with one document on stdout, its refusals included (CT29). A
|
|
14
|
+
* caller that sets `stderrLimit` gets the bounded tail back, to read a machine error code from; it
|
|
15
|
+
* never relays it.
|
|
16
|
+
*/
|
|
17
|
+
export function runRegistryProcess(input) {
|
|
18
|
+
if (input.signal.aborted)
|
|
19
|
+
return Promise.reject(interruption(input.signal));
|
|
20
|
+
return new Promise((resolve, reject) => {
|
|
21
|
+
let child;
|
|
22
|
+
try {
|
|
23
|
+
child = spawn(input.executable, [...input.args], {
|
|
24
|
+
cwd: input.projectDir,
|
|
25
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
26
|
+
shell: false,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
catch (cause) {
|
|
30
|
+
reject(new Error('Astrale CLI could not be started.', { cause }));
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const chunks = [];
|
|
34
|
+
const errors = [];
|
|
35
|
+
let stdoutBytes = 0;
|
|
36
|
+
let stderrBytes = 0;
|
|
37
|
+
let settled = false;
|
|
38
|
+
let termination;
|
|
39
|
+
let escalation;
|
|
40
|
+
const terminate = (cause) => {
|
|
41
|
+
if (settled || termination !== undefined)
|
|
42
|
+
return;
|
|
43
|
+
termination = cause;
|
|
44
|
+
child.stdin.destroy();
|
|
45
|
+
child.kill('SIGTERM');
|
|
46
|
+
escalation = setTimeout(() => {
|
|
47
|
+
if (child.exitCode === null && child.signalCode === null)
|
|
48
|
+
child.kill('SIGKILL');
|
|
49
|
+
}, TERMINATION_GRACE_MS);
|
|
50
|
+
};
|
|
51
|
+
const abort = () => terminate(interruption(input.signal));
|
|
52
|
+
const timeout = setTimeout(() => terminate(new RegistryProcessTimeoutError()), input.timeoutMs);
|
|
53
|
+
input.signal.addEventListener('abort', abort, { once: true });
|
|
54
|
+
const finish = () => {
|
|
55
|
+
settled = true;
|
|
56
|
+
clearTimeout(timeout);
|
|
57
|
+
if (escalation !== undefined)
|
|
58
|
+
clearTimeout(escalation);
|
|
59
|
+
input.signal.removeEventListener('abort', abort);
|
|
60
|
+
};
|
|
61
|
+
child.stdout.on('data', (chunk) => {
|
|
62
|
+
stdoutBytes += chunk.byteLength;
|
|
63
|
+
if (stdoutBytes > input.stdoutLimit) {
|
|
64
|
+
terminate(new Error('Astrale CLI stdout exceeded the supported limit.'));
|
|
65
|
+
}
|
|
66
|
+
else
|
|
67
|
+
chunks.push(chunk);
|
|
68
|
+
});
|
|
69
|
+
const stderrLimit = input.stderrLimit;
|
|
70
|
+
if (stderrLimit === undefined)
|
|
71
|
+
child.stderr.resume();
|
|
72
|
+
else {
|
|
73
|
+
// Keep the last `stderrLimit` bytes: drop whole chunks from the front once the rest covers it.
|
|
74
|
+
child.stderr.on('data', (chunk) => {
|
|
75
|
+
errors.push(chunk);
|
|
76
|
+
stderrBytes += chunk.byteLength;
|
|
77
|
+
while (errors.length > 1 && stderrBytes - errors[0].byteLength >= stderrLimit) {
|
|
78
|
+
stderrBytes -= errors.shift().byteLength;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
// A child that exits before reading its stdin closes the pipe; its exit code still answers.
|
|
83
|
+
child.stdin.on('error', () => undefined);
|
|
84
|
+
child.once('error', (cause) => {
|
|
85
|
+
if (settled)
|
|
86
|
+
return;
|
|
87
|
+
finish();
|
|
88
|
+
reject(termination ?? new Error('Astrale CLI could not be started.', { cause }));
|
|
89
|
+
});
|
|
90
|
+
child.once('close', (code) => {
|
|
91
|
+
if (settled)
|
|
92
|
+
return;
|
|
93
|
+
finish();
|
|
94
|
+
if (termination !== undefined) {
|
|
95
|
+
reject(termination);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
resolve(Object.freeze({
|
|
99
|
+
code: code ?? 1,
|
|
100
|
+
stdout: Buffer.concat(chunks).toString('utf8'),
|
|
101
|
+
...(stderrLimit === undefined ? {} : { stderr: stderrTail(errors, stderrLimit) }),
|
|
102
|
+
}));
|
|
103
|
+
});
|
|
104
|
+
child.stdin.end(input.stdin);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* The last `limit` bytes of stderr as text. A cut through a multi-byte character only spoils the
|
|
109
|
+
* first kept line, never the machine error the CLI prints last.
|
|
110
|
+
*/
|
|
111
|
+
function stderrTail(chunks, limit) {
|
|
112
|
+
const kept = Buffer.concat(chunks);
|
|
113
|
+
return kept.subarray(Math.max(0, kept.byteLength - limit)).toString('utf8');
|
|
114
|
+
}
|
|
115
|
+
function interruption(signal) {
|
|
116
|
+
return signal.reason instanceof Error
|
|
117
|
+
? signal.reason
|
|
118
|
+
: new Error('Project operation interrupted.');
|
|
119
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Runtime } from '../../application/runtime/index.js';
|
|
2
|
+
import type { Adapter } from '../../deployment/adapter/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* The secrets one Environment's deployment binds: the values of the secrets file its adapter
|
|
5
|
+
* declares. An Integration-free Runtime has no Providers and therefore no author-owned secrets, so
|
|
6
|
+
* its file may be absent; adapter-owned secrets, such as a signing identity, are the adapter's to
|
|
7
|
+
* resolve and never make this file required.
|
|
8
|
+
*/
|
|
9
|
+
export declare function environmentSecrets(adapter: Adapter<object>, parameters: object, projectDir: string, runtime: Runtime): Readonly<Record<string, string>>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { isAbsolute, join } from 'node:path';
|
|
3
|
+
import { loadDeclaredSecrets } from './dotenv.js';
|
|
4
|
+
/**
|
|
5
|
+
* The secrets one Environment's deployment binds: the values of the secrets file its adapter
|
|
6
|
+
* declares. An Integration-free Runtime has no Providers and therefore no author-owned secrets, so
|
|
7
|
+
* its file may be absent; adapter-owned secrets, such as a signing identity, are the adapter's to
|
|
8
|
+
* resolve and never make this file required.
|
|
9
|
+
*/
|
|
10
|
+
export function environmentSecrets(adapter, parameters, projectDir, runtime) {
|
|
11
|
+
const file = adapter.secretsFile?.(parameters);
|
|
12
|
+
if (file === undefined)
|
|
13
|
+
return Object.freeze({});
|
|
14
|
+
const path = isAbsolute(file) ? file : join(projectDir, file);
|
|
15
|
+
if (Object.keys(runtime.integrations).length === 0 && !existsSync(path)) {
|
|
16
|
+
return Object.freeze({});
|
|
17
|
+
}
|
|
18
|
+
return Object.freeze(loadDeclaredSecrets(path, file));
|
|
19
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Version } from '../../platform/versioning/index.js';
|
|
2
|
+
import type { DomainRegistry } from './registry/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* `astrale-domain yank <version> [--undo] --json` on stdout (CT30): the yank state Admin now holds
|
|
5
|
+
* for one published version of the Project's Domain. `changed` when this call yanked or restored
|
|
6
|
+
* it, `unchanged` when it already was in that state.
|
|
7
|
+
*/
|
|
8
|
+
export interface YankReportV1 {
|
|
9
|
+
readonly format: 'astrale.yank-report';
|
|
10
|
+
readonly version: 1;
|
|
11
|
+
readonly origin: string;
|
|
12
|
+
readonly publication: {
|
|
13
|
+
readonly version: string;
|
|
14
|
+
readonly yanked: boolean;
|
|
15
|
+
};
|
|
16
|
+
readonly status: 'changed' | 'unchanged';
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Yank one published version of `origin`, or restore it with `undo`, in the Admin registry. A
|
|
20
|
+
* yank only takes the version out of resolution: its installations keep running and its
|
|
21
|
+
* deployment keeps serving (tech [.72368]). Idempotent: a rerun answers `unchanged`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function yankPublication(input: {
|
|
24
|
+
readonly origin: string;
|
|
25
|
+
readonly version: Version;
|
|
26
|
+
readonly undo: boolean;
|
|
27
|
+
readonly projectDir: string;
|
|
28
|
+
readonly signal: AbortSignal;
|
|
29
|
+
}, open?: (input: {
|
|
30
|
+
readonly projectDir: string;
|
|
31
|
+
readonly signal: AbortSignal;
|
|
32
|
+
}) => Promise<Pick<DomainRegistry, 'yank'>>): Promise<YankReportV1>;
|
|
33
|
+
/** The one line a person reads for a report. */
|
|
34
|
+
export declare function yankSummary(report: YankReportV1): string;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { openDomainRegistry } from './registry/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Yank one published version of `origin`, or restore it with `undo`, in the Admin registry. A
|
|
4
|
+
* yank only takes the version out of resolution: its installations keep running and its
|
|
5
|
+
* deployment keeps serving (tech [.72368]). Idempotent: a rerun answers `unchanged`.
|
|
6
|
+
*/
|
|
7
|
+
export async function yankPublication(input, open = openDomainRegistry) {
|
|
8
|
+
const registry = await open({ projectDir: input.projectDir, signal: input.signal });
|
|
9
|
+
const outcome = await registry.yank(input.origin, input.version, { undo: input.undo });
|
|
10
|
+
return Object.freeze({
|
|
11
|
+
format: 'astrale.yank-report',
|
|
12
|
+
version: 1,
|
|
13
|
+
origin: input.origin,
|
|
14
|
+
publication: Object.freeze({
|
|
15
|
+
version: outcome.publication.version,
|
|
16
|
+
yanked: outcome.publication.yanked,
|
|
17
|
+
}),
|
|
18
|
+
status: outcome.status,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
/** The one line a person reads for a report. */
|
|
22
|
+
export function yankSummary(report) {
|
|
23
|
+
const name = `${report.origin}@${report.publication.version}`;
|
|
24
|
+
if (report.publication.yanked) {
|
|
25
|
+
return report.status === 'changed'
|
|
26
|
+
? `Yanked ${name}: line references no longer choose it; its installations and its deployment keep running.`
|
|
27
|
+
: `${name} was already yanked.`;
|
|
28
|
+
}
|
|
29
|
+
return report.status === 'changed'
|
|
30
|
+
? `Restored ${name}: line references can choose it again.`
|
|
31
|
+
: `${name} was not yanked.`;
|
|
32
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import type { SourceFile } from './index.js';
|
|
3
|
+
/** The modules each definition factory is exported from. */
|
|
4
|
+
declare const FACTORY_MODULES: {
|
|
5
|
+
readonly defineQuery: Set<string>;
|
|
6
|
+
readonly defineMutation: Set<string>;
|
|
7
|
+
};
|
|
8
|
+
/** The factories that define from an id: Queries v7, and Mutations (D31). */
|
|
9
|
+
export type DefinitionFactory = keyof typeof FACTORY_MODULES;
|
|
10
|
+
/**
|
|
11
|
+
* A definition from an id: `defineQuery<Schema>()` applied to an id and a spec `{ build, output? }`, or
|
|
12
|
+
* `defineMutation<Schema>()` applied to an id and a spec `{ build, output?, reject? }`.
|
|
13
|
+
*/
|
|
14
|
+
export interface DefinitionCall {
|
|
15
|
+
/** The application `(id, spec)`. */
|
|
16
|
+
readonly call: ts.CallExpression;
|
|
17
|
+
/** The factory, `defineQuery<Schema>()`, applied directly or through the const it is bound to. */
|
|
18
|
+
readonly factory: ts.CallExpression;
|
|
19
|
+
readonly origin: 'resolved' | 'ambiguous';
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The definitions a file makes with `name` from an id. Each applies `defineQuery<Schema>()` (or
|
|
23
|
+
* `defineMutation<Schema>()`) to two values, its id and its spec, where a V6 Query (or a Mutation
|
|
24
|
+
* of the closure form) applies it to one Domain projector. A const bound to the factory is followed
|
|
25
|
+
* to its applications in the same file.
|
|
26
|
+
*/
|
|
27
|
+
export declare function definitionCalls(file: SourceFile, name?: DefinitionFactory): readonly DefinitionCall[];
|
|
28
|
+
/**
|
|
29
|
+
* Whether a `defineQuery<Schema>()` (or `defineMutation<Schema>()`) call defines from an id: applied to
|
|
30
|
+
* an id and a spec, or bound to a const that no application in the file passes one Domain
|
|
31
|
+
* projector.
|
|
32
|
+
*/
|
|
33
|
+
export declare function isDefinitionFactory(file: SourceFile, factory: ts.CallExpression): boolean;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { resolveImportedSymbol, unwrap, visit } from './syntax.js';
|
|
3
|
+
/** The modules each definition factory is exported from. */
|
|
4
|
+
const FACTORY_MODULES = {
|
|
5
|
+
defineQuery: new Set(['@astrale-os/sdk', '@astrale-os/sdk/query']),
|
|
6
|
+
defineMutation: new Set(['@astrale-os/sdk', '@astrale-os/sdk/mutation']),
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* The definitions a file makes with `name` from an id. Each applies `defineQuery<Schema>()` (or
|
|
10
|
+
* `defineMutation<Schema>()`) to two values, its id and its spec, where a V6 Query (or a Mutation
|
|
11
|
+
* of the closure form) applies it to one Domain projector. A const bound to the factory is followed
|
|
12
|
+
* to its applications in the same file.
|
|
13
|
+
*/
|
|
14
|
+
export function definitionCalls(file, name = 'defineQuery') {
|
|
15
|
+
const definitions = [];
|
|
16
|
+
visit(file.source, (node) => {
|
|
17
|
+
if (!ts.isCallExpression(node) || node.arguments.length !== 2)
|
|
18
|
+
return;
|
|
19
|
+
const callee = unwrap(node.expression);
|
|
20
|
+
const factory = ts.isCallExpression(callee) ? callee : boundFactory(file, callee);
|
|
21
|
+
const origin = factory && factoryOrigin(file, factory, name);
|
|
22
|
+
if (factory && origin)
|
|
23
|
+
definitions.push({ call: node, factory, origin });
|
|
24
|
+
});
|
|
25
|
+
return definitions;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Whether a `defineQuery<Schema>()` (or `defineMutation<Schema>()`) call defines from an id: applied to
|
|
29
|
+
* an id and a spec, or bound to a const that no application in the file passes one Domain
|
|
30
|
+
* projector.
|
|
31
|
+
*/
|
|
32
|
+
export function isDefinitionFactory(file, factory) {
|
|
33
|
+
const parent = factory.parent;
|
|
34
|
+
if (ts.isCallExpression(parent) && unwrap(parent.expression) === factory)
|
|
35
|
+
return parent.arguments.length === 2;
|
|
36
|
+
const name = boundName(factory);
|
|
37
|
+
if (name === undefined)
|
|
38
|
+
return false;
|
|
39
|
+
let projected = false;
|
|
40
|
+
visit(file.source, (node) => {
|
|
41
|
+
if (ts.isCallExpression(node) && isNamed(unwrap(node.expression), name))
|
|
42
|
+
projected ||= node.arguments.length !== 2;
|
|
43
|
+
});
|
|
44
|
+
return !projected;
|
|
45
|
+
}
|
|
46
|
+
function factoryOrigin(file, factory, name) {
|
|
47
|
+
if (factory.arguments.length !== 0)
|
|
48
|
+
return undefined;
|
|
49
|
+
const symbol = resolveImportedSymbol(file, factory.expression);
|
|
50
|
+
if (symbol.kind === 'local' || symbol.name !== name)
|
|
51
|
+
return undefined;
|
|
52
|
+
if (symbol.kind === 'ambiguous')
|
|
53
|
+
return 'ambiguous';
|
|
54
|
+
return FACTORY_MODULES[name].has(symbol.module) ? 'resolved' : undefined;
|
|
55
|
+
}
|
|
56
|
+
/** The factory a top-level const binds, when the callee names one. */
|
|
57
|
+
function boundFactory(file, callee) {
|
|
58
|
+
if (!ts.isIdentifier(callee))
|
|
59
|
+
return undefined;
|
|
60
|
+
for (const statement of file.source.statements) {
|
|
61
|
+
if (!ts.isVariableStatement(statement))
|
|
62
|
+
continue;
|
|
63
|
+
if ((statement.declarationList.flags & ts.NodeFlags.Const) === 0)
|
|
64
|
+
continue;
|
|
65
|
+
for (const declaration of statement.declarationList.declarations) {
|
|
66
|
+
if (!isNamed(declaration.name, callee.text) || !declaration.initializer)
|
|
67
|
+
continue;
|
|
68
|
+
const value = unwrap(declaration.initializer);
|
|
69
|
+
return ts.isCallExpression(value) ? value : undefined;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
/** The name of the top-level const a factory is bound to. */
|
|
75
|
+
function boundName(factory) {
|
|
76
|
+
const declaration = factory.parent;
|
|
77
|
+
if (!ts.isVariableDeclaration(declaration) || !ts.isIdentifier(declaration.name))
|
|
78
|
+
return undefined;
|
|
79
|
+
const list = declaration.parent;
|
|
80
|
+
if (!ts.isVariableDeclarationList(list) || (list.flags & ts.NodeFlags.Const) === 0)
|
|
81
|
+
return undefined;
|
|
82
|
+
return ts.isVariableStatement(list.parent) && ts.isSourceFile(list.parent.parent)
|
|
83
|
+
? declaration.name.text
|
|
84
|
+
: undefined;
|
|
85
|
+
}
|
|
86
|
+
function isNamed(node, name) {
|
|
87
|
+
return ts.isIdentifier(node) && node.text === name;
|
|
88
|
+
}
|
|
@@ -3,4 +3,3 @@ import type { SourceProject, SourceDependencyIssue, SourceFile, SourceImport } f
|
|
|
3
3
|
export declare function collectImports(source: ts.SourceFile): SourceImport[];
|
|
4
4
|
export declare function collectDependencyIssues(source: ts.SourceFile): SourceDependencyIssue[];
|
|
5
5
|
export declare function resolveProjectImport(project: SourceProject, importer: SourceFile, specifier: string): SourceFile | undefined;
|
|
6
|
-
export declare function isWithin(directory: string, path: string): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { dirname, extname,
|
|
1
|
+
import { dirname, extname, join, relative, resolve } from 'node:path';
|
|
2
2
|
import ts from 'typescript';
|
|
3
3
|
import { isLocallyDeclared } from './syntax.js';
|
|
4
4
|
export function collectImports(source) {
|
|
@@ -166,7 +166,3 @@ function visit(node, callback) {
|
|
|
166
166
|
callback(node);
|
|
167
167
|
node.forEachChild((child) => visit(child, callback));
|
|
168
168
|
}
|
|
169
|
-
export function isWithin(directory, path) {
|
|
170
|
-
const child = relative(directory, path);
|
|
171
|
-
return child === '' || (!child.startsWith('..') && !isAbsolute(child));
|
|
172
|
-
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
export { discoverProject } from './discover.js';
|
|
2
2
|
export { sourceEvidenceAdmission } from './evidence-admission.js';
|
|
3
3
|
export { collectDependencyIssues, resolveProjectImport } from './imports.js';
|
|
4
|
-
export { importedSymbol, isLocallyDeclared, resolveImportedSymbol, location, objectProperty, propertyChain, staticText, unwrap, visit, } from './syntax.js';
|
|
4
|
+
export { bindingContains, importedSymbol, isLocallyDeclared, resolveImportedSymbol, location, objectProperty, propertyChain, staticText, unwrap, visit, visitOwnBody, } from './syntax.js';
|
|
5
5
|
export { assertSingleTypeUniverse } from './type-universe.js';
|
|
6
6
|
export { observeQueryDefinitions } from './query-observation.js';
|
|
7
7
|
export { queryCollectionKind } from './query-collection-type.js';
|
|
8
|
-
export {
|
|
8
|
+
export { isDefinitionFactory, definitionCalls, type DefinitionCall, type DefinitionFactory, } from './definition-calls.js';
|
|
9
|
+
export { declarationOf, expressionType, type ExpressionType } from './type-analysis.js';
|
|
9
10
|
export { collectSuppressionDirectives } from './suppression-directives.js';
|
|
10
11
|
import type ts from 'typescript';
|
|
11
12
|
import type { DomainPolicy } from '../../policy/index.js';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export { discoverProject } from './discover.js';
|
|
2
2
|
export { sourceEvidenceAdmission } from './evidence-admission.js';
|
|
3
3
|
export { collectDependencyIssues, resolveProjectImport } from './imports.js';
|
|
4
|
-
export { importedSymbol, isLocallyDeclared, resolveImportedSymbol, location, objectProperty, propertyChain, staticText, unwrap, visit, } from './syntax.js';
|
|
4
|
+
export { bindingContains, importedSymbol, isLocallyDeclared, resolveImportedSymbol, location, objectProperty, propertyChain, staticText, unwrap, visit, visitOwnBody, } from './syntax.js';
|
|
5
5
|
export { assertSingleTypeUniverse } from './type-universe.js';
|
|
6
6
|
export { observeQueryDefinitions } from './query-observation.js';
|
|
7
7
|
export { queryCollectionKind } from './query-collection-type.js';
|
|
8
|
-
export {
|
|
8
|
+
export { isDefinitionFactory, definitionCalls, } from './definition-calls.js';
|
|
9
|
+
export { declarationOf, expressionType } from './type-analysis.js';
|
|
9
10
|
export { collectSuppressionDirectives } from './suppression-directives.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
2
|
import { ambiguous, known, unknown, } from '../../analysis/query/index.js';
|
|
3
|
+
import { definitionCalls } from './definition-calls.js';
|
|
3
4
|
import { location, resolveImportedSymbol, unwrap, visit } from './syntax.js';
|
|
4
5
|
const SDK_MODULES = new Set(['@astrale-os/sdk', '@astrale-os/sdk/query']);
|
|
5
6
|
const QUERY_MODULES = new Set([
|
|
@@ -13,9 +14,11 @@ export function observeQueryDefinitions(project) {
|
|
|
13
14
|
.flatMap(observeFile));
|
|
14
15
|
}
|
|
15
16
|
function observeFile(file) {
|
|
16
|
-
const
|
|
17
|
+
const definitions = definitionCalls(file);
|
|
18
|
+
const applications = new Set(definitions.map(({ call }) => call));
|
|
19
|
+
const observations = definitions.map((definition) => definitionObservation(file, definition));
|
|
17
20
|
visit(file.source, (node) => {
|
|
18
|
-
if (!ts.isCallExpression(node))
|
|
21
|
+
if (!ts.isCallExpression(node) || applications.has(node))
|
|
19
22
|
return;
|
|
20
23
|
const factory = unwrap(node.expression);
|
|
21
24
|
if (!ts.isCallExpression(factory))
|
|
@@ -29,16 +32,7 @@ function observeFile(file) {
|
|
|
29
32
|
const subjectId = `${file.path}#${node.getStart(file.source)}`;
|
|
30
33
|
const sourceLocation = location(file, node);
|
|
31
34
|
if (origin.kind === 'ambiguous') {
|
|
32
|
-
|
|
33
|
-
observations.push(Object.freeze({
|
|
34
|
-
subjectId,
|
|
35
|
-
location: sourceLocation,
|
|
36
|
-
constructorIdentity: ambiguous(reason),
|
|
37
|
-
definitionKind: ambiguous(reason),
|
|
38
|
-
canonicalRequestCount: ambiguous(reason),
|
|
39
|
-
buildCallbackCount: ambiguous(reason),
|
|
40
|
-
projectCallbackCount: ambiguous(reason),
|
|
41
|
-
}));
|
|
35
|
+
observations.push(facadeObservation(subjectId, sourceLocation));
|
|
42
36
|
return;
|
|
43
37
|
}
|
|
44
38
|
if (origin.name === 'defineCollectionQuery') {
|
|
@@ -84,6 +78,37 @@ function observeFile(file) {
|
|
|
84
78
|
});
|
|
85
79
|
return observations;
|
|
86
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* A Query v7 is one single definition: its build returns reads built from the Domain's handles,
|
|
83
|
+
* which lower to canonical Query JSON by construction, and it has no projection callback.
|
|
84
|
+
*/
|
|
85
|
+
function definitionObservation(file, { call, factory, origin }) {
|
|
86
|
+
const subjectId = `${file.path}#${call.getStart(file.source)}`;
|
|
87
|
+
const sourceLocation = location(file, call);
|
|
88
|
+
if (origin === 'ambiguous')
|
|
89
|
+
return facadeObservation(subjectId, sourceLocation);
|
|
90
|
+
return Object.freeze({
|
|
91
|
+
subjectId,
|
|
92
|
+
location: sourceLocation,
|
|
93
|
+
constructorIdentity: known(sdkConstructorIdentity(file, factory.expression)),
|
|
94
|
+
definitionKind: known('single'),
|
|
95
|
+
canonicalRequestCount: known(1),
|
|
96
|
+
buildCallbackCount: known(1),
|
|
97
|
+
projectCallbackCount: known(0),
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function facadeObservation(subjectId, sourceLocation) {
|
|
101
|
+
const reason = 'definition resolves through a local facade whose ultimate public constructor origin is unknown';
|
|
102
|
+
return Object.freeze({
|
|
103
|
+
subjectId,
|
|
104
|
+
location: sourceLocation,
|
|
105
|
+
constructorIdentity: ambiguous(reason),
|
|
106
|
+
definitionKind: ambiguous(reason),
|
|
107
|
+
canonicalRequestCount: ambiguous(reason),
|
|
108
|
+
buildCallbackCount: ambiguous(reason),
|
|
109
|
+
projectCallbackCount: ambiguous(reason),
|
|
110
|
+
});
|
|
111
|
+
}
|
|
87
112
|
function canonicalRequestCount(file, object, builds, build) {
|
|
88
113
|
if (!build) {
|
|
89
114
|
if (builds.length > 0)
|
|
@@ -27,12 +27,12 @@ export type ImportedSymbolResolution = Readonly<{
|
|
|
27
27
|
*/
|
|
28
28
|
export declare function resolveImportedSymbol(file: SourceFile, expression: ts.Expression): ImportedSymbolResolution;
|
|
29
29
|
export declare function isLocallyDeclared(identifier: ts.Identifier): boolean;
|
|
30
|
+
export declare function bindingContains(binding: ts.BindingName, name: string): boolean;
|
|
31
|
+
/** Visit a function body, without descending into the functions nested in it. */
|
|
32
|
+
export declare function visitOwnBody(fn: ts.FunctionLikeDeclaration, callback: (node: ts.Node) => void): void;
|
|
30
33
|
export declare function unwrap(expression: ts.Expression): ts.Expression;
|
|
31
34
|
export declare function staticText(expression: ts.Expression | undefined): string | undefined;
|
|
32
35
|
export declare function objectProperty(object: ts.ObjectLiteralExpression | undefined, name: string): ts.ObjectLiteralElementLike | undefined;
|
|
33
36
|
export declare function propertyName(name: ts.PropertyName): string | undefined;
|
|
34
|
-
export declare function callbackOf(property: ts.ObjectLiteralElementLike | undefined): ts.FunctionLikeDeclaration | undefined;
|
|
35
|
-
export declare function objectArgument(call: ts.CallExpression): ts.ObjectLiteralExpression | undefined;
|
|
36
|
-
export declare function isImportedCall(file: SourceFile, node: ts.Node, modules: ReadonlySet<string>, name: string): node is ts.CallExpression;
|
|
37
37
|
export declare function propertyChain(expression: ts.Expression): readonly string[] | undefined;
|
|
38
38
|
export declare function containingFunction(node: ts.Node): ts.FunctionLikeDeclaration | undefined;
|