vouchington-tooling 0.35.0 → 0.36.1
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 +24 -221
- package/dist/agent-blackboard/feedback-audit-source.mjs +2 -2
- package/dist/agent-blackboard/feedback-canonical.mjs +1 -1
- package/dist/agent-blackboard/feedback-codec.mjs +3 -3
- package/dist/agent-blackboard/feedback-compose.mjs +5 -5
- package/dist/agent-blackboard/feedback-deadline.mjs +1 -1
- package/dist/agent-blackboard/feedback-delivery.mjs +6 -6
- package/dist/agent-blackboard/feedback-fields.mjs +1 -1
- package/dist/agent-blackboard/feedback-identity.mjs +3 -3
- package/dist/agent-blackboard/feedback-journal-audit.mjs +4 -4
- package/dist/agent-blackboard/feedback-journal-sandbox.mjs +1 -1
- package/dist/agent-blackboard/feedback-online-error.mjs +1 -1
- package/dist/agent-blackboard/feedback-online.mjs +7 -7
- package/dist/agent-blackboard/feedback-outbox-counts.mjs +2 -2
- package/dist/agent-blackboard/feedback-outbox.mjs +7 -7
- package/dist/agent-blackboard/index.mjs +13 -13
- package/dist/agent-blackboard/journal.mjs +3 -3
- package/dist/agent-blackboard/session-tools.mjs +4 -4
- package/dist/agent-blackboard/snapshot-cleanup-directory.mjs +3 -3
- package/dist/agent-blackboard/snapshot-cleanup-receipt.mjs +1 -1
- package/dist/agent-blackboard/snapshot-cleanup-resume.mjs +2 -2
- package/dist/agent-blackboard/snapshot-partition-cleanup.mjs +3 -3
- package/dist/agent-blackboard/snapshot-partition-format.mjs +3 -3
- package/dist/agent-blackboard/snapshot-partition-predicates.mjs +2 -2
- package/dist/agent-blackboard/snapshot-partition-read.mjs +2 -2
- package/dist/agent-blackboard/snapshot-partition-validate.mjs +2 -2
- package/dist/agent-blackboard/snapshot-partition-write.mjs +2 -2
- package/dist/agent-blackboard/snapshot-partitions.mjs +4 -4
- package/dist/agent-blackboard/snapshot.mjs +2 -2
- package/dist/agent-harness-identity/index.d.mts +1 -1
- package/dist/api-fixtures/fixture-contract-validation.mjs +1 -1
- package/dist/api-fixtures/index.mjs +3 -3
- package/dist/ast-grep-examples/companion-parity.mjs +1 -1
- package/dist/ast-grep-examples/index.mjs +1 -1
- package/dist/basic-auth-doc-sync/index.mjs +2 -2
- package/dist/basic-auth-doc-sync/runbook.mjs +4 -4
- package/dist/basic-auth-doc-sync/source.mjs +2 -2
- package/dist/browser-session-runner/attempt.mjs +5 -5
- package/dist/browser-session-runner/index.mjs +4 -4
- package/dist/browser-session-runner/output.mjs +1 -1
- package/dist/ci-local/index.mjs +2 -2
- package/dist/cli/commands/agent-blackboard-flags.mjs +1 -1
- package/dist/cli/commands/agent-blackboard.mjs +3 -3
- package/dist/cli/commands/ast-grep-examples.mjs +1 -1
- package/dist/cli/commands/ast-grep-pack.mjs +1 -1
- package/dist/cli/commands/gha-artifacts-cleanup.mjs +1 -1
- package/dist/cli/commands/gha-runtime-audit.mjs +1 -1
- package/dist/cli/commands/gha-workspace-policy.mjs +2 -2
- package/dist/cli/commands/http-origin.mjs +1 -1
- package/dist/cli/commands/link-skill.mjs +1 -1
- package/dist/cli/commands/mcp.mjs +2 -2
- package/dist/cli/commands/nuget-central-version.mjs +1 -1
- package/dist/cli/commands/pnpm-install.mjs +1 -1
- package/dist/cli/commands/prepare-vitest-reports.mjs +1 -1
- package/dist/cli/commands/require-up-to-date.mjs +1 -1
- package/dist/cli/commands/retrospective-facts.mjs +1 -1
- package/dist/cli/commands/retrospective-transcript.mjs +1 -1
- package/dist/cli/commands/runner-port-policy.mjs +1 -1
- package/dist/cli/commands/vitest-blob-manifest.mjs +1 -1
- package/dist/cli/commands/vitest-report-attempt.mjs +1 -1
- package/dist/cli/index.mjs +27 -27
- package/dist/cli/installed-version.mjs +1 -1
- package/dist/cli/parse-gha-runtime-audit.mjs +1 -1
- package/dist/cli/parse-options.mjs +2 -2
- package/dist/cli/parse.mjs +5 -5
- package/dist/compiler-build/index.mjs +3 -3
- package/dist/compiler-build/program.mjs +3 -3
- package/dist/config-inventory/collect.mjs +5 -5
- package/dist/config-inventory/dynamic-configs.mjs +1 -1
- package/dist/config-inventory/env-expression-readers.mjs +1 -1
- package/dist/config-inventory/env-prefix-readers.mjs +2 -2
- package/dist/config-inventory/env-var-accumulator.mjs +1 -1
- package/dist/config-inventory/env-vars.mjs +5 -5
- package/dist/config-inventory/index.mjs +2 -2
- package/dist/contract-schema/contract-schema-bounded-array.mjs +2 -2
- package/dist/contract-schema/contract-schema-extractor.mjs +3 -3
- package/dist/contract-schema/contract-schema-object-tuple.mjs +2 -2
- package/dist/contract-schema/contract-schema-type-extractor.mjs +5 -5
- package/dist/contract-schema/contract-schema-type-utils.mjs +2 -2
- package/dist/contract-schema/contract-schema-validator.mjs +1 -1
- package/dist/contract-schema/index.mjs +7 -7
- package/dist/contract-schema/type-query-call.mjs +3 -3
- package/dist/contract-schema/type-query.mjs +2 -2
- package/dist/contract-schema/virtual-program.mjs +1 -1
- package/dist/coverage-transport/control-v2-parse-object.mjs +2 -2
- package/dist/coverage-transport/control-v2.mjs +4 -4
- package/dist/coverage-transport/control.mjs +2 -2
- package/dist/coverage-transport/discovery.mjs +4 -4
- package/dist/coverage-transport/http.mjs +1 -1
- package/dist/coverage-transport/index.mjs +10 -10
- package/dist/coverage-transport/keys.mjs +1 -1
- package/dist/coverage-transport/lib.mjs +6 -6
- package/dist/coverage-transport/prefix-transfer.mjs +4 -4
- package/dist/coverage-transport/prefix.mjs +3 -3
- package/dist/coverage-transport/presign.mjs +1 -1
- package/dist/coverage-transport/vitest-blob-transport.mjs +2 -2
- package/dist/dependency-license-policy/collect.mjs +5 -5
- package/dist/dependency-license-policy/index.mjs +3 -3
- package/dist/dependency-license-policy/policy.mjs +1 -1
- package/dist/dependency-license-policy/workspace.mjs +1 -1
- package/dist/dockerfile-parse/index.mjs +2 -2
- package/dist/dockerfile-parse/prewarm-ports.mjs +1 -1
- package/dist/dockerfile-parse/runtime-cmd.mjs +2 -2
- package/dist/finite-enum-ripple/check.mjs +3 -3
- package/dist/finite-enum-ripple/compare.mjs +2 -2
- package/dist/finite-enum-ripple/component-paths.mjs +2 -2
- package/dist/finite-enum-ripple/configured-object-mutations.mjs +1 -1
- package/dist/finite-enum-ripple/create-page-jsx.mjs +1 -1
- package/dist/finite-enum-ripple/create-page-literals.mjs +4 -4
- package/dist/finite-enum-ripple/create-page-object-visitor.mjs +2 -2
- package/dist/finite-enum-ripple/create-page-properties.mjs +1 -1
- package/dist/finite-enum-ripple/index.mjs +1 -1
- package/dist/finite-enum-ripple/parser-support.mjs +2 -2
- package/dist/finite-enum-ripple/parsers.mjs +3 -3
- package/dist/finite-enum-ripple/structured-route-check.mjs +4 -4
- package/dist/finite-enum-ripple/types.mjs +3 -3
- package/dist/finite-enum-ripple/union-factory-check.mjs +2 -2
- package/dist/finite-enum-ripple/union-types.mjs +4 -4
- package/dist/gh-api-shell-quoting/index.mjs +2 -2
- package/dist/gh-api-shell-quoting/logical-line.mjs +1 -1
- package/dist/gh-api-shell-quoting/scan.mjs +1 -1
- package/dist/gh-api-shell-quoting/yaml.mjs +1 -1
- package/dist/gh-cli/index.mjs +4 -4
- package/dist/gha-artifacts-cleanup/commands.mjs +2 -2
- package/dist/gha-artifacts-cleanup/index.mjs +4 -4
- package/dist/gha-check-run/cli.mjs +2 -2
- package/dist/gha-check-run/index.mjs +2 -2
- package/dist/gha-claude-post-review/index.mjs +2 -2
- package/dist/gha-post-review/claude-token.d.mts +2 -2
- package/dist/gha-post-review/claude-token.mjs +1 -1
- package/dist/gha-post-review/cli.mjs +1 -1
- package/dist/gha-post-review/github.mjs +7 -7
- package/dist/gha-post-review/index.mjs +6 -6
- package/dist/gha-post-review/post.mjs +2 -2
- package/dist/gha-post-review/pull-io.mjs +1 -1
- package/dist/gha-post-review/token.mjs +1 -1
- package/dist/gha-pr-checkpoint/index.mjs +3 -3
- package/dist/gha-pr-checkpoint/resume.mjs +1 -1
- package/dist/gha-pr-checkpoint/update.mjs +1 -1
- package/dist/gha-review-payload/cli.mjs +2 -2
- package/dist/gha-review-payload/file.mjs +1 -1
- package/dist/gha-review-payload/index.mjs +4 -4
- package/dist/gha-review-payload/remap.mjs +1 -1
- package/dist/gha-runtime-audit/audit.mjs +4 -4
- package/dist/gha-runtime-audit/index.mjs +3 -3
- package/dist/gha-workspace-policy/docker-options.mjs +1 -1
- package/dist/gha-workspace-policy/docker-workspace-user.mjs +2 -2
- package/dist/gha-workspace-policy/index.mjs +3 -3
- package/dist/gha-workspace-policy/shell-tokens.mjs +1 -1
- package/dist/gha-workspace-policy/sparse-checkout.mjs +1 -1
- package/dist/github-projects/index.mjs +2 -2
- package/dist/github-projects/project-audit.mjs +1 -1
- package/dist/index.mjs +55 -55
- package/dist/markdown/content-facts.mjs +1 -1
- package/dist/markdown/document-sections.mjs +2 -2
- package/dist/markdown/html-blocks.mjs +1 -1
- package/dist/markdown/index.mjs +10 -10
- package/dist/markdown/sections.mjs +2 -2
- package/dist/markdown/tables.mjs +2 -2
- package/dist/markdown/tasks.mjs +1 -1
- package/dist/mcp-server/context.mjs +2 -2
- package/dist/mcp-server/dispatch.mjs +8 -8
- package/dist/mcp-server/git-fixture.test-helpers.mjs +1 -1
- package/dist/mcp-server/handlers-journal.mjs +4 -4
- package/dist/mcp-server/handlers-outbox.mjs +2 -2
- package/dist/mcp-server/handlers-session.mjs +3 -3
- package/dist/mcp-server/harness.test-helpers.mjs +4 -4
- package/dist/mcp-server/main.mjs +1 -1
- package/dist/mcp-server/run.mjs +3 -3
- package/dist/mcp-server/sdk.mjs +1 -1
- package/dist/mcp-server/server.mjs +2 -2
- package/dist/mcp-server/worktree.mjs +2 -2
- package/dist/nuget-central-version/cli.mjs +1 -1
- package/dist/openapi-document/build-openapi-catalog-sse.mjs +1 -1
- package/dist/openapi-document/build-openapi-document.mjs +8 -8
- package/dist/openapi-document/build-openapi-request.mjs +1 -1
- package/dist/openapi-document/build-openapi-response.mjs +3 -3
- package/dist/openapi-document/build-openapi-sse-events.mjs +1 -1
- package/dist/openapi-document/component-registry.mjs +1 -1
- package/dist/openapi-document/contract-schema-intersection-merge.mjs +1 -1
- package/dist/openapi-document/contract-schema-to-openapi.mjs +1 -1
- package/dist/openapi-document/index.mjs +12 -12
- package/dist/openapi-document/openapi-route-helpers.mjs +1 -1
- package/dist/pg-schema-snapshot/build-snapshot.mjs +3 -3
- package/dist/pg-schema-snapshot/catalog-objects.mjs +1 -1
- package/dist/pg-schema-snapshot/catalog-queries.mjs +4 -4
- package/dist/pg-schema-snapshot/catalog-table-constraints.mjs +1 -1
- package/dist/pg-schema-snapshot/catalog-table-indexes.mjs +1 -1
- package/dist/pg-schema-snapshot/catalog-tables.mjs +1 -1
- package/dist/pg-schema-snapshot/generate.mjs +5 -5
- package/dist/pg-schema-snapshot/index.mjs +6 -6
- package/dist/pg-schema-snapshot/markdown-files.mjs +1 -1
- package/dist/pg-schema-snapshot/render-markdown.mjs +1 -1
- package/dist/pg-schema-snapshot/table-snapshot-constraints.mjs +1 -1
- package/dist/pg-schema-snapshot/table-snapshot.mjs +3 -3
- package/dist/pnpm-deploy/index.mjs +3 -3
- package/dist/pnpm-deploy/restore.mjs +1 -1
- package/dist/pnpm-install/exec.mjs +1 -1
- package/dist/pnpm-install/index.mjs +8 -8
- package/dist/pnpm-install/install-operations.mjs +6 -6
- package/dist/pnpm-install/metadata-legacy.mjs +1 -1
- package/dist/pnpm-install/metadata.d.mts +1 -1
- package/dist/pnpm-install/metadata.mjs +2 -2
- package/dist/pnpm-install/native-health.mjs +2 -2
- package/dist/pnpm-install/pnpm-install-fixture.test-helpers.mjs +2 -2
- package/dist/pnpm-install/runner.mjs +7 -7
- package/dist/post-publication-inventory/index.d.mts +6 -0
- package/dist/post-publication-inventory/index.mjs +6 -2
- package/dist/post-publication-inventory/readers/compose-appends.d.mts +7 -0
- package/dist/post-publication-inventory/readers/compose-appends.mjs +38 -0
- package/dist/post-publication-inventory/readers/composes.d.mts +2 -0
- package/dist/post-publication-inventory/readers/composes.mjs +79 -0
- package/dist/post-publication-inventory/readers/composition.d.mts +2 -0
- package/dist/post-publication-inventory/readers/composition.mjs +62 -0
- package/dist/post-publication-inventory/readers/public-boundary-ast.d.mts +5 -0
- package/dist/post-publication-inventory/readers/public-boundary-ast.mjs +33 -0
- package/dist/post-publication-inventory/readers/public-boundary-consumed.d.mts +3 -0
- package/dist/post-publication-inventory/readers/public-boundary-consumed.mjs +39 -0
- package/dist/post-publication-inventory/readers/public-boundary-dataflow.d.mts +3 -0
- package/dist/post-publication-inventory/readers/public-boundary-dataflow.mjs +61 -0
- package/dist/post-publication-inventory/readers/public-boundary-then.d.mts +9 -0
- package/dist/post-publication-inventory/readers/public-boundary-then.mjs +31 -0
- package/dist/post-publication-inventory/readers/public-boundary.d.mts +3 -0
- package/dist/post-publication-inventory/readers/public-boundary.mjs +71 -0
- package/dist/post-publication-inventory/readers/public-view-ast.d.mts +6 -0
- package/dist/post-publication-inventory/readers/public-view-ast.mjs +67 -0
- package/dist/post-publication-inventory/readers/public-view-options.d.mts +8 -0
- package/dist/post-publication-inventory/readers/public-view-protection.d.mts +2 -0
- package/dist/post-publication-inventory/readers/public-view-protection.mjs +83 -0
- package/dist/post-publication-inventory/readers/public-view.d.mts +2 -0
- package/dist/post-publication-inventory/readers/public-view.mjs +117 -0
- package/dist/post-publication-inventory/readers/source-ast.d.mts +30 -0
- package/dist/post-publication-inventory/readers/source-ast.mjs +52 -0
- package/dist/post-publication-inventory/readers/source-executors.d.mts +4 -0
- package/dist/post-publication-inventory/readers/source-executors.mjs +38 -0
- package/dist/post-publication-inventory/readers/source-helpers.d.mts +16 -0
- package/dist/post-publication-inventory/readers/source-helpers.mjs +72 -0
- package/dist/post-publication-inventory/readers/source-options.d.mts +8 -0
- package/dist/post-publication-inventory/readers/source-sql.d.mts +3 -0
- package/dist/post-publication-inventory/readers/source-sql.mjs +17 -0
- package/dist/post-publication-inventory/readers/sql-executors.mjs +2 -2
- package/dist/post-publication-inventory/readers/sql-source.mjs +3 -3
- package/dist/post-publication-inventory/readers/sql-template.mjs +1 -1
- package/dist/post-publication-inventory/writers/source.mjs +1 -1
- package/dist/retrospective-facts/coverage.mjs +1 -1
- package/dist/retrospective-facts/foreign.mjs +3 -3
- package/dist/retrospective-facts/index.mjs +4 -4
- package/dist/retrospective-facts/local.mjs +4 -4
- package/dist/retrospective-transcript/claude-blocks.mjs +1 -1
- package/dist/retrospective-transcript/claude.mjs +2 -2
- package/dist/retrospective-transcript/codex-messages.mjs +1 -1
- package/dist/retrospective-transcript/codex-payload.mjs +2 -2
- package/dist/retrospective-transcript/codex-records.mjs +3 -3
- package/dist/retrospective-transcript/codex-segment.mjs +1 -1
- package/dist/retrospective-transcript/codex.mjs +2 -2
- package/dist/retrospective-transcript/index.mjs +9 -9
- package/dist/retrospective-transcript/resolve-transcript-file.mjs +2 -2
- package/dist/scc-complexity/baseline.mjs +2 -2
- package/dist/scc-complexity/index.mjs +8 -8
- package/dist/scc-complexity/parser.mjs +1 -1
- package/dist/scc-complexity/scope-config.mjs +1 -1
- package/dist/session-friction/audit-block.mjs +1 -1
- package/dist/session-friction/ci-failures.mjs +2 -2
- package/dist/session-friction/classify.mjs +2 -2
- package/dist/session-friction/coverage-ledger.mjs +1 -1
- package/dist/session-friction/index.mjs +5 -5
- package/dist/session-friction/log-file.mjs +2 -2
- package/dist/session-friction/log.mjs +7 -7
- package/dist/session-friction/normalize.mjs +1 -1
- package/dist/session-friction/report.mjs +5 -5
- package/dist/session-friction/sandbox.mjs +1 -1
- package/dist/session-friction/session-id.mjs +1 -1
- package/dist/shared-context/index.mjs +1 -1
- package/dist/skill-discovery/index.mjs +3 -3
- package/dist/sql-ast/add-column.mjs +1 -1
- package/dist/sql-ast/constraint-do-block.mjs +2 -2
- package/dist/sql-ast/constraint-shared.mjs +1 -1
- package/dist/sql-ast/constraint.mjs +4 -4
- package/dist/sql-ast/create-table.mjs +2 -2
- package/dist/sql-ast/drop-index.mjs +2 -2
- package/dist/sql-ast/implicit-indexes.mjs +1 -1
- package/dist/sql-ast/index-metadata.mjs +3 -3
- package/dist/sql-ast/index.mjs +8 -8
- package/dist/sql-scanner/comments.mjs +1 -1
- package/dist/sql-scanner/index.mjs +3 -3
- package/dist/sql-scanner/literals.mjs +1 -1
- package/dist/swift-semantic-equal/cli.mjs +1 -1
- package/dist/swift-semantic-equal/index.mjs +1 -1
- package/dist/transient-retry/index.mjs +2 -2
- package/dist/vitest-blob-manifest/cli.mjs +2 -2
- package/dist/vitest-blob-manifest/index.mjs +4 -4
- package/dist/vitest-blob-manifest/report-attempt-cli.mjs +2 -2
- package/dist/vitest-blob-manifest/report-attempt.mjs +1 -1
- package/dist/vitest-blob-manifest/reports-cli.mjs +3 -3
- package/dist/vitest-blob-manifest/reports-source.mjs +2 -2
- package/dist/vitest-blob-manifest/reports.mjs +2 -2
- package/dist/vitest-diagnostics/index.mjs +8 -8
- package/dist/vitest-diagnostics/vitest-fork-exit-records.mjs +1 -1
- package/dist/vitest-diagnostics/vitest-fork-exit-sentinel.mjs +2 -2
- package/dist/vitest-diagnostics/vitest-fork-leak-detection.mjs +2 -2
- package/dist/vitest-diagnostics/vitest-worker-exit-diagnostics-reporter.mjs +2 -2
- package/dist/workflow-policy/condition-entailment.mjs +1 -1
- package/dist/workflow-policy/index.mjs +4 -4
- package/dist/workflow-policy/permission-inheritance.mjs +1 -1
- package/dist/workflow-policy/permission-mismatches.mjs +2 -2
- package/dist/workflow-policy/secret-readiness.mjs +2 -2
- package/dist/workspace-gates/first-party-graph.mjs +2 -2
- package/dist/workspace-gates/index.mjs +1 -1
- package/dist/workspace-gates/manifest-version-assertions.mjs +2 -2
- package/dist/workspace-gates/manifest-version-parser.mjs +1 -1
- package/dist/workspace-gates/options.mjs +1 -1
- package/dist/workspace-gates/policy.mjs +7 -7
- package/dist/workspace-gates/test-helpers.d.mts +2 -2
- package/package.json +3 -6
- package/dist/api-contract-discovery/header-contract-parser.d.mts +0 -3
- package/dist/api-contract-discovery/header-contract-parser.mjs +0 -93
- package/dist/api-contract-discovery/header-contract-registry.d.mts +0 -3
- package/dist/api-contract-discovery/header-contract-registry.mjs +0 -40
- package/dist/api-contract-discovery/header-contract-types.d.mts +0 -19
- package/dist/api-contract-discovery/index.d.mts +0 -34
- package/dist/api-contract-discovery/index.mjs +0 -27
- package/dist/api-contract-discovery/protocol-analysis-cache.d.mts +0 -21
- package/dist/api-contract-discovery/protocol-analysis-cache.mjs +0 -7
- package/dist/api-contract-discovery/protocol-body-status.d.mts +0 -2
- package/dist/api-contract-discovery/protocol-body-status.mjs +0 -4
- package/dist/api-contract-discovery/protocol-callback-argument-bindings.d.mts +0 -7
- package/dist/api-contract-discovery/protocol-callback-argument-bindings.mjs +0 -33
- package/dist/api-contract-discovery/protocol-callback-invocation.d.mts +0 -6
- package/dist/api-contract-discovery/protocol-callback-invocation.mjs +0 -111
- package/dist/api-contract-discovery/protocol-callback-mutations.d.mts +0 -5
- package/dist/api-contract-discovery/protocol-callback-mutations.mjs +0 -42
- package/dist/api-contract-discovery/protocol-callback-registration.d.mts +0 -3
- package/dist/api-contract-discovery/protocol-callback-registration.mjs +0 -27
- package/dist/api-contract-discovery/protocol-callback-values.d.mts +0 -18
- package/dist/api-contract-discovery/protocol-callback-values.mjs +0 -114
- package/dist/api-contract-discovery/protocol-context-alias.d.mts +0 -3
- package/dist/api-contract-discovery/protocol-context-alias.mjs +0 -20
- package/dist/api-contract-discovery/protocol-contract-extraction.d.mts +0 -9
- package/dist/api-contract-discovery/protocol-contract-extraction.mjs +0 -87
- package/dist/api-contract-discovery/protocol-contract-keys.d.mts +0 -1
- package/dist/api-contract-discovery/protocol-contract-keys.mjs +0 -8
- package/dist/api-contract-discovery/protocol-contract-registry.d.mts +0 -5
- package/dist/api-contract-discovery/protocol-contract-registry.mjs +0 -133
- package/dist/api-contract-discovery/protocol-executable-path.d.mts +0 -3
- package/dist/api-contract-discovery/protocol-executable-path.mjs +0 -64
- package/dist/api-contract-discovery/protocol-execution-path.d.mts +0 -4
- package/dist/api-contract-discovery/protocol-execution-path.mjs +0 -16
- package/dist/api-contract-discovery/protocol-http-association.d.mts +0 -7
- package/dist/api-contract-discovery/protocol-http-association.mjs +0 -108
- package/dist/api-contract-discovery/protocol-http-body-kinds.d.mts +0 -3
- package/dist/api-contract-discovery/protocol-http-body-kinds.mjs +0 -19
- package/dist/api-contract-discovery/protocol-http-context-callers.d.mts +0 -7
- package/dist/api-contract-discovery/protocol-http-context-callers.mjs +0 -40
- package/dist/api-contract-discovery/protocol-http-context-escapes.d.mts +0 -3
- package/dist/api-contract-discovery/protocol-http-context-escapes.mjs +0 -95
- package/dist/api-contract-discovery/protocol-http-context.d.mts +0 -8
- package/dist/api-contract-discovery/protocol-http-context.mjs +0 -85
- package/dist/api-contract-discovery/protocol-http-emission.d.mts +0 -3
- package/dist/api-contract-discovery/protocol-http-emission.mjs +0 -76
- package/dist/api-contract-discovery/protocol-http-implicit-taint.d.mts +0 -7
- package/dist/api-contract-discovery/protocol-http-implicit-taint.mjs +0 -26
- package/dist/api-contract-discovery/protocol-http-method-access.d.mts +0 -9
- package/dist/api-contract-discovery/protocol-http-method-access.mjs +0 -34
- package/dist/api-contract-discovery/protocol-http-method-mutations.d.mts +0 -3
- package/dist/api-contract-discovery/protocol-http-method-mutations.mjs +0 -31
- package/dist/api-contract-discovery/protocol-http-reflect.d.mts +0 -5
- package/dist/api-contract-discovery/protocol-http-reflect.mjs +0 -45
- package/dist/api-contract-discovery/protocol-http-registration.d.mts +0 -12
- package/dist/api-contract-discovery/protocol-http-registration.mjs +0 -53
- package/dist/api-contract-discovery/protocol-http-response-mutations.d.mts +0 -3
- package/dist/api-contract-discovery/protocol-http-response-mutations.mjs +0 -31
- package/dist/api-contract-discovery/protocol-marker-analysis.d.mts +0 -7
- package/dist/api-contract-discovery/protocol-marker-analysis.mjs +0 -50
- package/dist/api-contract-discovery/protocol-opaque-callback.d.mts +0 -3
- package/dist/api-contract-discovery/protocol-opaque-callback.mjs +0 -107
- package/dist/api-contract-discovery/protocol-platform-callbacks.d.mts +0 -7
- package/dist/api-contract-discovery/protocol-platform-callbacks.mjs +0 -76
- package/dist/api-contract-discovery/protocol-platform-mutation-targets.d.mts +0 -5
- package/dist/api-contract-discovery/protocol-platform-mutation-targets.mjs +0 -89
- package/dist/api-contract-discovery/protocol-platform-writes.d.mts +0 -3
- package/dist/api-contract-discovery/protocol-platform-writes.mjs +0 -92
- package/dist/api-contract-discovery/protocol-requested-keys.d.mts +0 -5
- package/dist/api-contract-discovery/protocol-requested-keys.mjs +0 -45
- package/dist/api-contract-discovery/protocol-sse-callers.d.mts +0 -7
- package/dist/api-contract-discovery/protocol-sse-callers.mjs +0 -67
- package/dist/api-contract-discovery/protocol-sse-emission.d.mts +0 -11
- package/dist/api-contract-discovery/protocol-sse-emission.mjs +0 -61
- package/dist/api-contract-discovery/protocol-sse-feasible-status.d.mts +0 -3
- package/dist/api-contract-discovery/protocol-sse-feasible-status.mjs +0 -24
- package/dist/api-contract-discovery/protocol-sse-raw-writes.d.mts +0 -9
- package/dist/api-contract-discovery/protocol-sse-raw-writes.mjs +0 -99
- package/dist/api-contract-discovery/protocol-sse-status.d.mts +0 -3
- package/dist/api-contract-discovery/protocol-sse-status.mjs +0 -84
- package/dist/api-contract-discovery/protocol-sse-write-access.d.mts +0 -9
- package/dist/api-contract-discovery/protocol-sse-write-access.mjs +0 -42
- package/dist/api-contract-discovery/protocol-sse-write-helpers.d.mts +0 -7
- package/dist/api-contract-discovery/protocol-sse-write-helpers.mjs +0 -82
- package/dist/api-contract-discovery/protocol-sse-write-mutations.d.mts +0 -9
- package/dist/api-contract-discovery/protocol-sse-write-mutations.mjs +0 -42
- package/dist/api-contract-discovery/protocol-sse-write-resolution.d.mts +0 -14
- package/dist/api-contract-discovery/protocol-sse-write-resolution.mjs +0 -79
- package/dist/api-contract-discovery/protocol-status-dominance.d.mts +0 -5
- package/dist/api-contract-discovery/protocol-status-dominance.mjs +0 -35
- package/dist/api-contract-discovery/protocol-write-receiver.d.mts +0 -9
- package/dist/api-contract-discovery/protocol-write-receiver.mjs +0 -79
- package/dist/api-contract-discovery/query-contract-extraction.d.mts +0 -3
- package/dist/api-contract-discovery/query-contract-extraction.mjs +0 -82
- package/dist/api-contract-discovery/query-contract-literals.d.mts +0 -13
- package/dist/api-contract-discovery/query-contract-literals.mjs +0 -83
- package/dist/api-contract-discovery/query-contract-registry.d.mts +0 -3
- package/dist/api-contract-discovery/query-contract-registry.mjs +0 -70
- package/dist/api-contract-discovery/query-contract-types.d.mts +0 -8
- package/dist/api-contract-discovery/registered-route-binding-writes.d.mts +0 -4
- package/dist/api-contract-discovery/registered-route-binding-writes.mjs +0 -47
- package/dist/api-contract-discovery/registered-route-catalog.d.mts +0 -10
- package/dist/api-contract-discovery/registered-route-catalog.mjs +0 -85
- package/dist/api-contract-discovery/registered-route-factory-returns.d.mts +0 -3
- package/dist/api-contract-discovery/registered-route-factory-returns.mjs +0 -29
- package/dist/api-contract-discovery/registered-route-handler-analysis.d.mts +0 -12
- package/dist/api-contract-discovery/registered-route-handler-analysis.mjs +0 -119
- package/dist/api-contract-discovery/registered-route-handler-helpers.d.mts +0 -3
- package/dist/api-contract-discovery/registered-route-handler-helpers.mjs +0 -16
- package/dist/api-contract-discovery/registered-route-runtime-parameters.d.mts +0 -3
- package/dist/api-contract-discovery/registered-route-runtime-parameters.mjs +0 -5
- package/dist/api-contract-discovery/registered-route-terminal-error.d.mts +0 -3
- package/dist/api-contract-discovery/registered-route-terminal-error.mjs +0 -98
- package/dist/api-contract-discovery/request-contract-implicit.d.mts +0 -17
- package/dist/api-contract-discovery/request-contract-implicit.mjs +0 -73
- package/dist/api-contract-discovery/request-contract-lenient.d.mts +0 -28
- package/dist/api-contract-discovery/request-contract-lenient.mjs +0 -59
- package/dist/api-contract-discovery/request-contract-registry.d.mts +0 -14
- package/dist/api-contract-discovery/request-contract-registry.mjs +0 -63
- package/dist/api-contract-discovery/request-contract-route-analysis.d.mts +0 -25
- package/dist/api-contract-discovery/request-contract-route-analysis.mjs +0 -68
- package/dist/api-contract-discovery/request-contract-types.d.mts +0 -12
- package/dist/api-contract-discovery/request-contract-types.mjs +0 -1
- package/dist/api-contract-discovery/request-validation-callbacks.d.mts +0 -9
- package/dist/api-contract-discovery/request-validation-callbacks.mjs +0 -27
- package/dist/api-contract-discovery/request-validation-checker.d.mts +0 -7
- package/dist/api-contract-discovery/request-validation-checker.mjs +0 -25
- package/dist/api-contract-discovery/request-validation-conditional.d.mts +0 -6
- package/dist/api-contract-discovery/request-validation-conditional.mjs +0 -31
- package/dist/api-contract-discovery/request-validation-factory-calls.d.mts +0 -11
- package/dist/api-contract-discovery/request-validation-factory-calls.mjs +0 -23
- package/dist/api-contract-discovery/request-validation-facts.d.mts +0 -16
- package/dist/api-contract-discovery/request-validation-facts.mjs +0 -64
- package/dist/api-contract-discovery/request-validation-follow.d.mts +0 -24
- package/dist/api-contract-discovery/request-validation-follow.mjs +0 -38
- package/dist/api-contract-discovery/request-validation-handler-state.d.mts +0 -8
- package/dist/api-contract-discovery/request-validation-handler-state.mjs +0 -35
- package/dist/api-contract-discovery/request-validation-input.d.mts +0 -12
- package/dist/api-contract-discovery/request-validation-input.mjs +0 -43
- package/dist/api-contract-discovery/request-validation-keys.d.mts +0 -25
- package/dist/api-contract-discovery/request-validation-keys.mjs +0 -119
- package/dist/api-contract-discovery/request-validation-match.d.mts +0 -11
- package/dist/api-contract-discovery/request-validation-match.mjs +0 -47
- package/dist/api-contract-discovery/request-validation-mutation.d.mts +0 -7
- package/dist/api-contract-discovery/request-validation-mutation.mjs +0 -80
- package/dist/api-contract-discovery/request-validation-origin.d.mts +0 -20
- package/dist/api-contract-discovery/request-validation-origin.mjs +0 -71
- package/dist/api-contract-discovery/request-validation-reads.d.mts +0 -13
- package/dist/api-contract-discovery/request-validation-reads.mjs +0 -88
- package/dist/api-contract-discovery/request-validation-registration.d.mts +0 -9
- package/dist/api-contract-discovery/request-validation-registration.mjs +0 -32
- package/dist/api-contract-discovery/request-validation-report.d.mts +0 -3
- package/dist/api-contract-discovery/request-validation-report.mjs +0 -21
- package/dist/api-contract-discovery/request-validation-request-origin.d.mts +0 -5
- package/dist/api-contract-discovery/request-validation-request-origin.mjs +0 -13
- package/dist/api-contract-discovery/request-validation-select.d.mts +0 -9
- package/dist/api-contract-discovery/request-validation-select.mjs +0 -36
- package/dist/api-contract-discovery/request-validation-sites.d.mts +0 -9
- package/dist/api-contract-discovery/request-validation-sites.mjs +0 -77
- package/dist/api-contract-discovery/request-validation-state-key.d.mts +0 -13
- package/dist/api-contract-discovery/request-validation-state-key.mjs +0 -30
- package/dist/api-contract-discovery/request-validation-trace-helpers.d.mts +0 -14
- package/dist/api-contract-discovery/request-validation-trace-helpers.mjs +0 -80
- package/dist/api-contract-discovery/request-validation-trace-select.d.mts +0 -23
- package/dist/api-contract-discovery/request-validation-trace-select.mjs +0 -45
- package/dist/api-contract-discovery/request-validation-trace.d.mts +0 -8
- package/dist/api-contract-discovery/request-validation-trace.mjs +0 -130
- package/dist/api-contract-discovery/request-validation-types.d.mts +0 -84
- package/dist/api-contract-discovery/request-validation-types.mjs +0 -1
- package/dist/api-contract-discovery/request-validation-walker.d.mts +0 -26
- package/dist/api-contract-discovery/request-validation-walker.mjs +0 -143
- package/dist/api-contract-discovery/request-validation.test-helpers.d.mts +0 -39
- package/dist/api-contract-discovery/request-validation.test-helpers.mjs +0 -108
- package/dist/api-contract-discovery/response-contract-attribution-facts.d.mts +0 -2
- package/dist/api-contract-discovery/response-contract-attribution-facts.mjs +0 -18
- package/dist/api-contract-discovery/response-contract-attribution.d.mts +0 -3
- package/dist/api-contract-discovery/response-contract-attribution.mjs +0 -23
- package/dist/api-contract-discovery/response-contract-call-classification.d.mts +0 -3
- package/dist/api-contract-discovery/response-contract-call-classification.mjs +0 -37
- package/dist/api-contract-discovery/response-contract-ctx-analysis.d.mts +0 -7
- package/dist/api-contract-discovery/response-contract-ctx-analysis.mjs +0 -28
- package/dist/api-contract-discovery/response-contract-error-branch.d.mts +0 -15
- package/dist/api-contract-discovery/response-contract-error-branch.mjs +0 -150
- package/dist/api-contract-discovery/response-contract-handler-bindings.d.mts +0 -3
- package/dist/api-contract-discovery/response-contract-handler-bindings.mjs +0 -126
- package/dist/api-contract-discovery/response-contract-handler-calls.d.mts +0 -3
- package/dist/api-contract-discovery/response-contract-handler-calls.mjs +0 -81
- package/dist/api-contract-discovery/response-contract-implicit-sources.test-helpers.d.mts +0 -145
- package/dist/api-contract-discovery/response-contract-implicit-sources.test-helpers.mjs +0 -145
- package/dist/api-contract-discovery/response-contract-implicit-variants.d.mts +0 -2
- package/dist/api-contract-discovery/response-contract-implicit-variants.mjs +0 -6
- package/dist/api-contract-discovery/response-contract-implicit.d.mts +0 -6
- package/dist/api-contract-discovery/response-contract-implicit.mjs +0 -120
- package/dist/api-contract-discovery/response-contract-lenient.d.mts +0 -41
- package/dist/api-contract-discovery/response-contract-lenient.mjs +0 -52
- package/dist/api-contract-discovery/response-contract-media.d.mts +0 -3
- package/dist/api-contract-discovery/response-contract-media.mjs +0 -46
- package/dist/api-contract-discovery/response-contract-object-symbols.d.mts +0 -3
- package/dist/api-contract-discovery/response-contract-object-symbols.mjs +0 -80
- package/dist/api-contract-discovery/response-contract-property-mutations.d.mts +0 -5
- package/dist/api-contract-discovery/response-contract-property-mutations.mjs +0 -84
- package/dist/api-contract-discovery/response-contract-registration.d.mts +0 -11
- package/dist/api-contract-discovery/response-contract-registration.mjs +0 -65
- package/dist/api-contract-discovery/response-contract-registry.d.mts +0 -7
- package/dist/api-contract-discovery/response-contract-registry.mjs +0 -124
- package/dist/api-contract-discovery/response-contract-route-analysis.d.mts +0 -12
- package/dist/api-contract-discovery/response-contract-route-analysis.mjs +0 -65
- package/dist/api-contract-discovery/response-contract-route-syntax.d.mts +0 -7
- package/dist/api-contract-discovery/response-contract-route-syntax.mjs +0 -41
- package/dist/api-contract-discovery/response-contract-status.d.mts +0 -27
- package/dist/api-contract-discovery/response-contract-status.mjs +0 -82
- package/dist/api-contract-discovery/response-contract-symbols.d.mts +0 -5
- package/dist/api-contract-discovery/response-contract-symbols.mjs +0 -82
- package/dist/api-contract-discovery/response-contract-types.d.mts +0 -23
- package/dist/api-contract-discovery/response-contract-types.mjs +0 -1
- package/dist/api-contract-discovery/test-setup.test-helpers.d.mts +0 -3
- package/dist/api-contract-discovery/test-setup.test-helpers.mjs +0 -2
- /package/dist/{api-contract-discovery/header-contract-types.mjs → post-publication-inventory/readers/public-view-options.mjs} +0 -0
- /package/dist/{api-contract-discovery/query-contract-types.mjs → post-publication-inventory/readers/source-options.mjs} +0 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { derivedBindingIsConsumed } from "./public-boundary-consumed.mjs";
|
|
2
|
+
import { isFunctionLike, isNode, propertyName } from "./source-ast.mjs";
|
|
3
|
+
import { containsNode } from "./public-boundary-ast.mjs";
|
|
4
|
+
export function constrainingUseReachesConsumer(hasCall, ancestors, ast) {
|
|
5
|
+
let crossedCallback = false;
|
|
6
|
+
for (let index = ancestors.length - 1; index >= 0; index -= 1) {
|
|
7
|
+
const ancestor = ancestors[index];
|
|
8
|
+
if (isFunctionLike(ancestor)) {
|
|
9
|
+
if (crossedCallback)
|
|
10
|
+
return false;
|
|
11
|
+
crossedCallback = true;
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
if (ancestor.type === 'ReturnStatement')
|
|
15
|
+
return true;
|
|
16
|
+
if (ancestor.type !== 'CallExpression' || !isNode(ancestor.callee))
|
|
17
|
+
continue;
|
|
18
|
+
const callName = ancestor.callee.type === 'Identifier'
|
|
19
|
+
? propertyName(ancestor.callee)
|
|
20
|
+
: ancestor.callee.type === 'MemberExpression' && isNode(ancestor.callee.property)
|
|
21
|
+
? propertyName(ancestor.callee.property)
|
|
22
|
+
: null;
|
|
23
|
+
if (callName === 'assert')
|
|
24
|
+
return true;
|
|
25
|
+
if (!['filter', 'flatMap', 'map'].includes(callName ?? '')) {
|
|
26
|
+
if (crossedCallback)
|
|
27
|
+
return false;
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
if (!hasCallDeterminesCallbackResult(hasCall, ancestors.slice(index + 1)))
|
|
31
|
+
return false;
|
|
32
|
+
return derivedCallReachesConsumer(ancestors.slice(0, index), ast);
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
function hasCallDeterminesCallbackResult(hasCall, descendants) {
|
|
37
|
+
const callback = descendants.find(isFunctionLike);
|
|
38
|
+
if (!callback || !isNode(callback.body))
|
|
39
|
+
return false;
|
|
40
|
+
if (callback.body.type !== 'BlockStatement')
|
|
41
|
+
return containsNode(callback.body, hasCall);
|
|
42
|
+
return descendants.some((descendant) => descendant.type === 'ReturnStatement');
|
|
43
|
+
}
|
|
44
|
+
function derivedCallReachesConsumer(ancestors, ast) {
|
|
45
|
+
for (let index = ancestors.length - 1; index >= 0; index -= 1) {
|
|
46
|
+
const ancestor = ancestors[index];
|
|
47
|
+
if (ancestor.type === 'ReturnStatement')
|
|
48
|
+
return true;
|
|
49
|
+
if (ancestor.type === 'AssignmentExpression' && isNode(ancestor.left)) {
|
|
50
|
+
if (ancestor.left.type === 'MemberExpression')
|
|
51
|
+
return true;
|
|
52
|
+
const name = propertyName(ancestor.left);
|
|
53
|
+
return name ? derivedBindingIsConsumed(ast, name, ancestor.range[1]) : false;
|
|
54
|
+
}
|
|
55
|
+
if (ancestor.type === 'VariableDeclarator' && isNode(ancestor.id)) {
|
|
56
|
+
const name = propertyName(ancestor.id);
|
|
57
|
+
return name ? derivedBindingIsConsumed(ast, name, ancestor.range[1]) : false;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type Node = import('./source-ast.mts').UnknownNode;
|
|
2
|
+
type BoundaryBinding = {
|
|
3
|
+
declaredAt: number;
|
|
4
|
+
declaration: Node;
|
|
5
|
+
name: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function isShadowedAtUse(binding: BoundaryBinding, ancestors: Node[]): boolean;
|
|
8
|
+
export declare function isThenBoundaryParameter(receiver: string, ancestors: Node[], imported: Set<string>): boolean;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { isFunctionLike, isNode, propertyName } from "./source-ast.mjs";
|
|
2
|
+
import { canonicalCallNames } from "./source-helpers.mjs";
|
|
3
|
+
export function isShadowedAtUse(binding, ancestors) {
|
|
4
|
+
return ancestors.some((ancestor) => {
|
|
5
|
+
if (!isFunctionLike(ancestor) || !Array.isArray(ancestor.params))
|
|
6
|
+
return false;
|
|
7
|
+
if (binding.declaration.range[0] >= ancestor.range[0] &&
|
|
8
|
+
binding.declaration.range[1] <= ancestor.range[1]) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
return ancestor.params.some((param) => isNode(param) && propertyName(param) === binding.name);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export function isThenBoundaryParameter(receiver, ancestors, imported) {
|
|
15
|
+
return ancestors.some((ancestor) => {
|
|
16
|
+
if (!isFunctionLike(ancestor) || !Array.isArray(ancestor.params))
|
|
17
|
+
return false;
|
|
18
|
+
if (!ancestor.params.some((param) => isNode(param) && propertyName(param) === receiver))
|
|
19
|
+
return false;
|
|
20
|
+
const parent = ancestors[ancestors.indexOf(ancestor) - 1];
|
|
21
|
+
if (!parent || parent.type !== 'CallExpression' || !isNode(parent.callee))
|
|
22
|
+
return false;
|
|
23
|
+
if (parent.callee.type !== 'MemberExpression' ||
|
|
24
|
+
!isNode(parent.callee.object) ||
|
|
25
|
+
!isNode(parent.callee.property) ||
|
|
26
|
+
propertyName(parent.callee.property) !== 'then') {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
return canonicalCallNames(parent.callee.object, imported).length > 0;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ReaderSourceAnalysisOptions } from './source-options.mts';
|
|
2
|
+
/** Proves that public IDs constrain a collection or guard before it can be emitted. */
|
|
3
|
+
export declare function sourceFiltersWithPublicBoundary(content: string, symbols: string[], options: ReaderSourceAnalysisOptions): boolean;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { isShadowedAtUse, isThenBoundaryParameter } from "./public-boundary-then.mjs";
|
|
2
|
+
import { isNode, parseSource, propertyName, walk } from "./source-ast.mjs";
|
|
3
|
+
import { importedCanonicalBindings } from "./source-helpers.mjs";
|
|
4
|
+
import { isSetHasCall, walkWithAncestors } from "./public-boundary-ast.mjs";
|
|
5
|
+
import { constrainingUseReachesConsumer } from "./public-boundary-dataflow.mjs";
|
|
6
|
+
/** Proves that public IDs constrain a collection or guard before it can be emitted. */
|
|
7
|
+
export function sourceFiltersWithPublicBoundary(content, symbols, options) {
|
|
8
|
+
const ast = parseSource(content).ast;
|
|
9
|
+
const imported = importedCanonicalBindings(ast, symbols, options);
|
|
10
|
+
if (imported.size === 0)
|
|
11
|
+
return false;
|
|
12
|
+
const bindings = [];
|
|
13
|
+
walk(ast, (node) => {
|
|
14
|
+
if (node.type !== 'VariableDeclarator' || !isNode(node.id) || !isNode(node.init))
|
|
15
|
+
return;
|
|
16
|
+
const name = propertyName(node.id);
|
|
17
|
+
if (!name || !isDirectCanonicalBoundaryCall(node.init, imported))
|
|
18
|
+
return;
|
|
19
|
+
bindings.push({ declaredAt: node.range[1], declaration: node, name });
|
|
20
|
+
});
|
|
21
|
+
let constrained = false;
|
|
22
|
+
walkWithAncestors(ast, [], (node, ancestors) => {
|
|
23
|
+
if (constrained)
|
|
24
|
+
return;
|
|
25
|
+
if (node.type === 'ReturnStatement' && isNode(node.argument)) {
|
|
26
|
+
if (isDirectCanonicalBoundaryCall(node.argument, imported)) {
|
|
27
|
+
constrained = true;
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const returned = propertyName(node.argument);
|
|
31
|
+
if (returned &&
|
|
32
|
+
bindings.some((binding) => binding.name === returned &&
|
|
33
|
+
node.range[0] > binding.declaredAt &&
|
|
34
|
+
!isShadowedAtUse(binding, ancestors))) {
|
|
35
|
+
constrained = true;
|
|
36
|
+
}
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (!isSetHasCall(node) ||
|
|
40
|
+
!hasCandidateIdArgument(node, options) ||
|
|
41
|
+
!constrainingUseReachesConsumer(node, ancestors, ast)) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const receiver = propertyName(node.callee.object);
|
|
45
|
+
if (receiver &&
|
|
46
|
+
bindings.some((binding) => binding.name === receiver &&
|
|
47
|
+
node.range[0] > binding.declaredAt &&
|
|
48
|
+
!isShadowedAtUse(binding, ancestors))) {
|
|
49
|
+
constrained = true;
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (receiver && isThenBoundaryParameter(receiver, ancestors, imported))
|
|
53
|
+
constrained = true;
|
|
54
|
+
});
|
|
55
|
+
return constrained;
|
|
56
|
+
}
|
|
57
|
+
function isDirectCanonicalBoundaryCall(node, imported) {
|
|
58
|
+
const expression = node.type === 'AwaitExpression' && isNode(node.argument) ? node.argument : node;
|
|
59
|
+
return (expression.type === 'CallExpression' &&
|
|
60
|
+
isNode(expression.callee) &&
|
|
61
|
+
expression.callee.type === 'Identifier' &&
|
|
62
|
+
imported.has(expression.callee.name));
|
|
63
|
+
}
|
|
64
|
+
function hasCandidateIdArgument(node, options) {
|
|
65
|
+
if (!Array.isArray(node.arguments) || !isNode(node.arguments[0]))
|
|
66
|
+
return false;
|
|
67
|
+
const argument = node.arguments[0];
|
|
68
|
+
return (argument.type === 'MemberExpression' &&
|
|
69
|
+
isNode(argument.property) &&
|
|
70
|
+
propertyName(argument.property) === options.candidateIdProperty);
|
|
71
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ReaderPublicViewOptions } from './public-view-options.mts';
|
|
2
|
+
export declare function nestedSelectStatements(value: unknown): Record<string, unknown>[];
|
|
3
|
+
export declare function containsEligibilitySourceEquality(values: unknown[], aliases: {
|
|
4
|
+
eligibility: Set<string>;
|
|
5
|
+
sourceRows: Set<string>;
|
|
6
|
+
}, options: ReaderPublicViewOptions): boolean;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { isRecord } from "../../sql-ast/unknown-record.mjs";
|
|
2
|
+
export function nestedSelectStatements(value) {
|
|
3
|
+
const selects = [];
|
|
4
|
+
function collect(node) {
|
|
5
|
+
if (Array.isArray(node)) {
|
|
6
|
+
for (const item of node)
|
|
7
|
+
collect(item);
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
if (!isRecord(node))
|
|
11
|
+
return;
|
|
12
|
+
if (isRecord(node.SelectStmt)) {
|
|
13
|
+
selects.push(node.SelectStmt);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
for (const child of Object.values(node))
|
|
17
|
+
collect(child);
|
|
18
|
+
}
|
|
19
|
+
collect(value);
|
|
20
|
+
return selects;
|
|
21
|
+
}
|
|
22
|
+
export function containsEligibilitySourceEquality(values, aliases, options) {
|
|
23
|
+
function collect(value) {
|
|
24
|
+
if (Array.isArray(value))
|
|
25
|
+
return value.some(collect);
|
|
26
|
+
if (!isRecord(value))
|
|
27
|
+
return false;
|
|
28
|
+
if (isRecord(value.BoolExpr) &&
|
|
29
|
+
(value.BoolExpr.boolop === 'OR_EXPR' || value.BoolExpr.boolop === 'NOT_EXPR')) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
if (isRecord(value.A_Expr) && value.A_Expr.kind === 'AEXPR_OP' && isEquals(value.A_Expr)) {
|
|
33
|
+
const left = columnReference(value.A_Expr.lexpr);
|
|
34
|
+
const right = columnReference(value.A_Expr.rexpr);
|
|
35
|
+
if ((isEligibilityId(left, aliases.eligibility, options) &&
|
|
36
|
+
isSourceId(right, aliases.sourceRows, options)) ||
|
|
37
|
+
(isEligibilityId(right, aliases.eligibility, options) &&
|
|
38
|
+
isSourceId(left, aliases.sourceRows, options))) {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (isRecord(value.A_Expr) || isRecord(value.BooleanTest) || isRecord(value.CaseExpr)) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
return Object.values(value).some(collect);
|
|
46
|
+
}
|
|
47
|
+
return values.some(collect);
|
|
48
|
+
}
|
|
49
|
+
function isEquals(expression) {
|
|
50
|
+
return (Array.isArray(expression.name) &&
|
|
51
|
+
expression.name.some((value) => isRecord(value.String) && value.String.sval === '='));
|
|
52
|
+
}
|
|
53
|
+
function columnReference(value) {
|
|
54
|
+
if (!isRecord(value) || !isRecord(value.ColumnRef) || !Array.isArray(value.ColumnRef.fields)) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
const fields = value.ColumnRef.fields.flatMap((field) => isRecord(field.String) && typeof field.String.sval === 'string' ? [field.String.sval] : []);
|
|
58
|
+
if (fields.length !== 2)
|
|
59
|
+
return null;
|
|
60
|
+
return { alias: fields[0], column: fields[1] };
|
|
61
|
+
}
|
|
62
|
+
function isEligibilityId(value, aliases, options) {
|
|
63
|
+
return value !== null && value.column === options.eligibilityIdColumn && aliases.has(value.alias);
|
|
64
|
+
}
|
|
65
|
+
function isSourceId(value, aliases, options) {
|
|
66
|
+
return value !== null && value.column === options.sourceIdColumn && aliases.has(value.alias);
|
|
67
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReaderSqlTemplateOptions } from './sql-template.mts';
|
|
2
|
+
export interface ReaderPublicViewOptions {
|
|
3
|
+
readonly sql: ReaderSqlTemplateOptions;
|
|
4
|
+
readonly sourceRelation: string;
|
|
5
|
+
readonly eligibilityRelation: string;
|
|
6
|
+
readonly sourceIdColumn: string;
|
|
7
|
+
readonly eligibilityIdColumn: string;
|
|
8
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { isRecord } from "../../sql-ast/unknown-record.mjs";
|
|
2
|
+
import { containsEligibilitySourceEquality } from "./public-view-ast.mjs";
|
|
3
|
+
export function selectProtectsSourceRows(select, options) {
|
|
4
|
+
const aliases = collectSelectAliases(select.fromClause, options);
|
|
5
|
+
return (aliases.sourceRows.size === 0 ||
|
|
6
|
+
(aliases.eligibility.size > 0 &&
|
|
7
|
+
(containsEligibilitySourceEquality([select.whereClause], aliases, options) ||
|
|
8
|
+
filteringJoinContainsEligibilityEquality(select.fromClause, aliases, options))) ||
|
|
9
|
+
correlatedEligibilitySubqueryComposes(select, aliases.sourceRows, options));
|
|
10
|
+
}
|
|
11
|
+
function correlatedEligibilitySubqueryComposes(select, outerSourceAliases, options) {
|
|
12
|
+
function containsPositiveEligibilityExists(value) {
|
|
13
|
+
if (Array.isArray(value))
|
|
14
|
+
return value.some(containsPositiveEligibilityExists);
|
|
15
|
+
if (!isRecord(value))
|
|
16
|
+
return false;
|
|
17
|
+
if (isRecord(value.BoolExpr) &&
|
|
18
|
+
(value.BoolExpr.boolop === 'OR_EXPR' || value.BoolExpr.boolop === 'NOT_EXPR')) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
if (isRecord(value.A_Expr) || isRecord(value.BooleanTest) || isRecord(value.CaseExpr)) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
if (isRecord(value.SubLink) &&
|
|
25
|
+
value.SubLink.subLinkType === 'EXISTS_SUBLINK' &&
|
|
26
|
+
isRecord(value.SubLink.subselect) &&
|
|
27
|
+
isRecord(value.SubLink.subselect.SelectStmt)) {
|
|
28
|
+
const nested = value.SubLink.subselect.SelectStmt;
|
|
29
|
+
const nestedAliases = collectSelectAliases(nested.fromClause, options);
|
|
30
|
+
return (nestedAliases.eligibility.size > 0 &&
|
|
31
|
+
containsEligibilitySourceEquality([nested.fromClause, nested.whereClause], {
|
|
32
|
+
eligibility: nestedAliases.eligibility,
|
|
33
|
+
sourceRows: outerSourceAliases,
|
|
34
|
+
}, options));
|
|
35
|
+
}
|
|
36
|
+
return Object.values(value).some(containsPositiveEligibilityExists);
|
|
37
|
+
}
|
|
38
|
+
return containsPositiveEligibilityExists(select.whereClause);
|
|
39
|
+
}
|
|
40
|
+
function filteringJoinContainsEligibilityEquality(value, aliases, options) {
|
|
41
|
+
if (Array.isArray(value)) {
|
|
42
|
+
return value.some((item) => filteringJoinContainsEligibilityEquality(item, aliases, options));
|
|
43
|
+
}
|
|
44
|
+
if (isRecord(value.JoinExpr)) {
|
|
45
|
+
if (value.JoinExpr.jointype === 'JOIN_INNER' &&
|
|
46
|
+
containsEligibilitySourceEquality([value.JoinExpr.quals], aliases, options)) {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
return (filteringJoinContainsEligibilityEquality(value.JoinExpr.larg, aliases, options) ||
|
|
50
|
+
filteringJoinContainsEligibilityEquality(value.JoinExpr.rarg, aliases, options));
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
function collectSelectAliases(value, options) {
|
|
55
|
+
const aliases = { eligibility: new Set(), sourceRows: new Set() };
|
|
56
|
+
function collect(fromClause) {
|
|
57
|
+
if (Array.isArray(fromClause)) {
|
|
58
|
+
for (const item of fromClause)
|
|
59
|
+
collect(item);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (!isRecord(fromClause))
|
|
63
|
+
return;
|
|
64
|
+
if (isRecord(fromClause.RangeVar)) {
|
|
65
|
+
const range = fromClause.RangeVar;
|
|
66
|
+
const relationName = range.relname;
|
|
67
|
+
const alias = isRecord(range.alias) && typeof range.alias.aliasname === 'string'
|
|
68
|
+
? range.alias.aliasname
|
|
69
|
+
: relationName;
|
|
70
|
+
if (relationName === options.eligibilityRelation)
|
|
71
|
+
aliases.eligibility.add(alias);
|
|
72
|
+
if (relationName === options.sourceRelation)
|
|
73
|
+
aliases.sourceRows.add(alias);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (isRecord(fromClause.JoinExpr)) {
|
|
77
|
+
collect(fromClause.JoinExpr.larg);
|
|
78
|
+
collect(fromClause.JoinExpr.rarg);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
collect(value);
|
|
82
|
+
return aliases;
|
|
83
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { parseSql } from "../../sql-ast/parser.mjs";
|
|
2
|
+
import { isRecord } from "../../sql-ast/unknown-record.mjs";
|
|
3
|
+
import { extractStaticSqlTemplateQuasis } from "./sql-source.mjs";
|
|
4
|
+
import { nestedSelectStatements } from "./public-view-ast.mjs";
|
|
5
|
+
import { selectProtectsSourceRows } from "./public-view-protection.mjs";
|
|
6
|
+
export function composesPublicEligibilityView(content, options) {
|
|
7
|
+
try {
|
|
8
|
+
let foundSourceReader = false;
|
|
9
|
+
for (const sql of extractStaticSqlTemplateQuasis(content, options.sql)) {
|
|
10
|
+
try {
|
|
11
|
+
const tree = parseSql(sql);
|
|
12
|
+
const readsSource = selectTreeReadsRelation(tree, options.sourceRelation);
|
|
13
|
+
const readsEligibility = selectTreeReadsRelation(tree, options.eligibilityRelation);
|
|
14
|
+
if (!readsSource && !readsEligibility)
|
|
15
|
+
continue;
|
|
16
|
+
foundSourceReader = true;
|
|
17
|
+
if (readsSource && !selectTreeComposesPublicEligibility(tree, options))
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
// A fragment appended to a larger SQLStatement is not independently parseable.
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return foundSourceReader;
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function selectTreeReadsRelation(tree, relation) {
|
|
31
|
+
return tree.stmts.some((statement) => containsRangeVar(statement, relation));
|
|
32
|
+
}
|
|
33
|
+
function containsRangeVar(value, relation) {
|
|
34
|
+
if (Array.isArray(value))
|
|
35
|
+
return value.some((item) => containsRangeVar(item, relation));
|
|
36
|
+
if (!isRecord(value))
|
|
37
|
+
return false;
|
|
38
|
+
if (isRecord(value.RangeVar) && value.RangeVar.relname === relation)
|
|
39
|
+
return true;
|
|
40
|
+
return Object.values(value).some((item) => containsRangeVar(item, relation));
|
|
41
|
+
}
|
|
42
|
+
function selectTreeComposesPublicEligibility(tree, options) {
|
|
43
|
+
const selects = tree.stmts.flatMap((statement) => 'SelectStmt' in statement.stmt
|
|
44
|
+
? [statement.stmt.SelectStmt]
|
|
45
|
+
: []);
|
|
46
|
+
return (selects.length > 0 &&
|
|
47
|
+
selects.every((select) => selectScopesComposePublicEligibility(select, options)));
|
|
48
|
+
}
|
|
49
|
+
function selectScopesComposePublicEligibility(select, options, inheritedCtes = new Map(), visitingCtes = new Set()) {
|
|
50
|
+
const ctes = new Map([...inheritedCtes, ...collectCteSelects(select.withClause)]);
|
|
51
|
+
if (!selectProtectsSourceRows(select, options))
|
|
52
|
+
return false;
|
|
53
|
+
const nestedSelects = nestedSelectStatements([
|
|
54
|
+
select.fromClause,
|
|
55
|
+
select.targetList,
|
|
56
|
+
select.whereClause,
|
|
57
|
+
select.havingClause,
|
|
58
|
+
select.groupClause,
|
|
59
|
+
select.distinctClause,
|
|
60
|
+
select.sortClause,
|
|
61
|
+
select.limitOffset,
|
|
62
|
+
select.limitCount,
|
|
63
|
+
select.windowClause,
|
|
64
|
+
select.valuesLists,
|
|
65
|
+
]);
|
|
66
|
+
for (const branch of [select.larg, select.rarg]) {
|
|
67
|
+
if (isRecord(branch))
|
|
68
|
+
nestedSelects.push(branch);
|
|
69
|
+
}
|
|
70
|
+
if (nestedSelects.some((nested) => !selectScopesComposePublicEligibility(nested, options, ctes, visitingCtes))) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
function cteScopesCompose(name) {
|
|
74
|
+
if (visitingCtes.has(name))
|
|
75
|
+
return false;
|
|
76
|
+
const cte = ctes.get(name);
|
|
77
|
+
if (!cte)
|
|
78
|
+
return true;
|
|
79
|
+
const nextVisiting = new Set(visitingCtes).add(name);
|
|
80
|
+
return selectScopesComposePublicEligibility(cte, options, ctes, nextVisiting);
|
|
81
|
+
}
|
|
82
|
+
return selectRangeRelationNames(select.fromClause).every(cteScopesCompose);
|
|
83
|
+
}
|
|
84
|
+
function collectCteSelects(withClause) {
|
|
85
|
+
const ctes = new Map();
|
|
86
|
+
if (!isRecord(withClause) || !Array.isArray(withClause.ctes))
|
|
87
|
+
return ctes;
|
|
88
|
+
for (const cte of withClause.ctes) {
|
|
89
|
+
const expression = cte.CommonTableExpr;
|
|
90
|
+
if (isRecord(expression.ctequery.SelectStmt)) {
|
|
91
|
+
ctes.set(expression.ctename, expression.ctequery.SelectStmt);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return ctes;
|
|
95
|
+
}
|
|
96
|
+
function selectRangeRelationNames(value) {
|
|
97
|
+
const names = new Set();
|
|
98
|
+
function collect(fromClause) {
|
|
99
|
+
if (Array.isArray(fromClause)) {
|
|
100
|
+
for (const item of fromClause)
|
|
101
|
+
collect(item);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (!isRecord(fromClause))
|
|
105
|
+
return;
|
|
106
|
+
if (isRecord(fromClause.RangeVar) && typeof fromClause.RangeVar.relname === 'string') {
|
|
107
|
+
names.add(fromClause.RangeVar.relname);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (isRecord(fromClause.JoinExpr)) {
|
|
111
|
+
collect(fromClause.JoinExpr.larg);
|
|
112
|
+
collect(fromClause.JoinExpr.rarg);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
collect(value);
|
|
116
|
+
return [...names];
|
|
117
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface UnknownNode {
|
|
2
|
+
type?: string;
|
|
3
|
+
range: [number, number];
|
|
4
|
+
loc?: {
|
|
5
|
+
start: {
|
|
6
|
+
line: number;
|
|
7
|
+
};
|
|
8
|
+
end: {
|
|
9
|
+
line: number;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The root AST node returned by parseSource(): the ESTree Program plus the comments/tokens arrays
|
|
16
|
+
* `@typescript-eslint/parser` attaches alongside it.
|
|
17
|
+
*/
|
|
18
|
+
type ParsedAst = UnknownNode & {
|
|
19
|
+
comments?: UnknownNode[];
|
|
20
|
+
tokens?: UnknownNode[] | undefined;
|
|
21
|
+
};
|
|
22
|
+
interface ParseResult {
|
|
23
|
+
ast: ParsedAst;
|
|
24
|
+
}
|
|
25
|
+
export declare function parseSource(code: string): ParseResult;
|
|
26
|
+
export declare function isNode(value: unknown): value is UnknownNode;
|
|
27
|
+
export declare function walk(node: UnknownNode | undefined, visit: (node: UnknownNode) => void): void;
|
|
28
|
+
export declare function propertyName(node: UnknownNode | undefined): string | null;
|
|
29
|
+
export declare function isFunctionLike(node: UnknownNode): boolean;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { parseForESLint } from '@typescript-eslint/parser';
|
|
2
|
+
export function parseSource(code) {
|
|
3
|
+
const result = parseForESLint(code, {
|
|
4
|
+
comment: true,
|
|
5
|
+
ecmaVersion: 'latest',
|
|
6
|
+
loc: true,
|
|
7
|
+
range: true,
|
|
8
|
+
sourceType: 'module',
|
|
9
|
+
});
|
|
10
|
+
// @typescript-eslint/parser force-enables `tokens: true` regardless of the options above
|
|
11
|
+
// (parser.js hardcodes it), and every token duplicates a slice of the source string
|
|
12
|
+
// (node-utils.js builds each token via `ast.text.slice(start, end)`) — roughly half of a parsed
|
|
13
|
+
// AST's retained size. Nothing in this repo reads `ast.tokens`; drop the reference immediately
|
|
14
|
+
// after parsing (explicit `undefined`, not `delete`, so the field stays traceable in the type)
|
|
15
|
+
// so streaming source-analysis callers do not retain the redundant token array.
|
|
16
|
+
result.ast.tokens = undefined;
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
export function isNode(value) {
|
|
20
|
+
return (typeof value === 'object' && value !== null && typeof value.type === 'string');
|
|
21
|
+
}
|
|
22
|
+
export function walk(node, visit) {
|
|
23
|
+
if (!node)
|
|
24
|
+
return;
|
|
25
|
+
visit(node);
|
|
26
|
+
for (const [key, value] of Object.entries(node)) {
|
|
27
|
+
if (key === 'parent' || key === 'loc' || key === 'range')
|
|
28
|
+
continue;
|
|
29
|
+
if (Array.isArray(value)) {
|
|
30
|
+
for (const child of value)
|
|
31
|
+
if (isNode(child))
|
|
32
|
+
walk(child, visit);
|
|
33
|
+
}
|
|
34
|
+
else if (isNode(value)) {
|
|
35
|
+
walk(value, visit);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export function propertyName(node) {
|
|
40
|
+
if (!node)
|
|
41
|
+
return null;
|
|
42
|
+
if (node.type === 'Identifier')
|
|
43
|
+
return node.name;
|
|
44
|
+
if (node.type === 'Literal')
|
|
45
|
+
return typeof node.value === 'string' ? node.value : null;
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
export function isFunctionLike(node) {
|
|
49
|
+
return (node.type === 'FunctionDeclaration' ||
|
|
50
|
+
node.type === 'FunctionExpression' ||
|
|
51
|
+
node.type === 'ArrowFunctionExpression');
|
|
52
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { isNode, propertyName, walk } from "./source-ast.mjs";
|
|
2
|
+
export function terminalSqlExecutorBindings(ast, options) {
|
|
3
|
+
const bindings = new Set();
|
|
4
|
+
walk(ast, (node) => {
|
|
5
|
+
if (node.type !== 'ImportDeclaration' ||
|
|
6
|
+
!isNode(node.source) ||
|
|
7
|
+
node.source.type !== 'Literal' ||
|
|
8
|
+
typeof node.source.value !== 'string' ||
|
|
9
|
+
!options.sql.executorImports.has(node.source.value) ||
|
|
10
|
+
!Array.isArray(node.specifiers)) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
for (const specifier of node.specifiers) {
|
|
14
|
+
if (!isNode(specifier) || specifier.type !== 'ImportSpecifier')
|
|
15
|
+
continue;
|
|
16
|
+
const importedName = propertyName(specifier.imported);
|
|
17
|
+
const localName = propertyName(specifier.local);
|
|
18
|
+
if (importedName &&
|
|
19
|
+
localName &&
|
|
20
|
+
options.sql.executorImports.get(String(node.source.value))?.has(importedName)) {
|
|
21
|
+
bindings.add(localName);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
walk(ast, (node) => {
|
|
26
|
+
if (node.type !== 'VariableDeclarator' || !isNode(node.id) || !isNode(node.init))
|
|
27
|
+
return;
|
|
28
|
+
const binding = propertyName(node.id);
|
|
29
|
+
if (!binding || node.init.type !== 'ConditionalExpression')
|
|
30
|
+
return;
|
|
31
|
+
const consequent = propertyName(node.init.consequent);
|
|
32
|
+
const alternate = propertyName(node.init.alternate);
|
|
33
|
+
if ((consequent && bindings.has(consequent)) || (alternate && bindings.has(alternate))) {
|
|
34
|
+
bindings.add(binding);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return bindings;
|
|
38
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ReaderSourceAnalysisOptions } from './source-options.mts';
|
|
2
|
+
import { terminalSqlExecutorBindings } from './source-executors.mts';
|
|
3
|
+
export { terminalSqlExecutorBindings };
|
|
4
|
+
type Node = import('./source-ast.mts').UnknownNode;
|
|
5
|
+
export declare function addComposedNames(composed: Set<string>, names: string[]): void;
|
|
6
|
+
export declare function addBindingComposition(composed: Set<string>, declaration: {
|
|
7
|
+
declaredAt: number;
|
|
8
|
+
names: string[];
|
|
9
|
+
} | undefined, reassigned: boolean): void;
|
|
10
|
+
export declare function canonicalCallNames(node: Node | undefined, imported: Set<string>): string[];
|
|
11
|
+
export declare function isAppendCall(node: Node, options: ReaderSourceAnalysisOptions): boolean;
|
|
12
|
+
export declare function isPushCall(node: Node): boolean;
|
|
13
|
+
export declare function appendReceiverName(node: Node): string | null;
|
|
14
|
+
export declare function isSqlStatementInitializer(node: Node | undefined, options: ReaderSourceAnalysisOptions): boolean;
|
|
15
|
+
export declare function importedCanonicalBindings(ast: Node, symbols: string[], options: ReaderSourceAnalysisOptions): Set<string>;
|
|
16
|
+
export declare function isTerminalSqlCall(node: Node, bindings: Set<string>): boolean;
|