vouchington-tooling 0.34.0 → 0.36.0
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 +3 -5
- 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/model.d.mts +4 -0
- package/dist/finite-enum-ripple/parser-support.mjs +16 -3
- package/dist/finite-enum-ripple/parsers.mjs +5 -3
- package/dist/finite-enum-ripple/structured-route-check.mjs +5 -5
- 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 +5 -5
- 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.d.mts +1 -3
- package/dist/workflow-policy/index.mjs +4 -6
- 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/workflow-policy/types.d.mts +2 -28
- 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/docs/workflow-and-compiler.md +7 -16
- 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/workflow-policy/concurrency-scope.d.mts +0 -4
- package/dist/workflow-policy/concurrency-scope.mjs +0 -66
- package/dist/workflow-policy/concurrency.d.mts +0 -10
- package/dist/workflow-policy/concurrency.mjs +0 -77
- package/dist/workflow-policy/graph.d.mts +0 -2
- package/dist/workflow-policy/graph.mjs +0 -138
- /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
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import ts from '../contract-schema/typescript-api.mts';
|
|
2
|
-
import { type DiscoverApiResponseContractsOptions } from './response-contract-lenient.mts';
|
|
3
|
-
import { type HandlerBindings } from './response-contract-route-analysis.mts';
|
|
4
|
-
import type { BackendResponseContract } from './response-contract-types.mts';
|
|
5
|
-
export declare function discoverProtocolContracts(sourceFiles: readonly ts.SourceFile[], checker: ts.TypeChecker, bindings: HandlerBindings, contracts: Map<string, BackendResponseContract>, options: DiscoverApiResponseContractsOptions | undefined, requestedKeys?: ReadonlySet<string>): Set<ts.CallExpression>;
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import ts from '../contract-schema/typescript-api.mjs';
|
|
2
|
-
import { nextProtocolKey } from './protocol-contract-keys.mjs';
|
|
3
|
-
import { extractContractSchema } from '../contract-schema/index.mjs';
|
|
4
|
-
import { extractHttpVariants, extractSseEvents } from './protocol-contract-extraction.mjs';
|
|
5
|
-
import { extractHttpBodyKinds } from './protocol-http-body-kinds.mjs';
|
|
6
|
-
import { registerHttpProtocols } from './protocol-http-registration.mjs';
|
|
7
|
-
import { protocolBindingRequested, requestedProtocolKey } from './protocol-requested-keys.mjs';
|
|
8
|
-
import { protocolMarker } from './protocol-marker-analysis.mjs';
|
|
9
|
-
import { registerRouteContract, } from './response-contract-lenient.mjs';
|
|
10
|
-
import { contractError, sourceLocation } from './response-contract-registration.mjs';
|
|
11
|
-
import { enclosingRouteBinding, visit, } from './response-contract-route-analysis.mjs';
|
|
12
|
-
import { rejectRawSseWrites } from './protocol-sse-raw-writes.mjs';
|
|
13
|
-
import { sseEmission } from './protocol-sse-emission.mjs';
|
|
14
|
-
export function discoverProtocolContracts(sourceFiles, checker, bindings, contracts, options, requestedKeys) {
|
|
15
|
-
if (requestedKeys?.size === 0)
|
|
16
|
-
return new Set();
|
|
17
|
-
const calls = [];
|
|
18
|
-
for (const file of sourceFiles)
|
|
19
|
-
visit(file, (node) => {
|
|
20
|
-
if (ts.isCallExpression(node))
|
|
21
|
-
calls.push(node);
|
|
22
|
-
});
|
|
23
|
-
const pending = [];
|
|
24
|
-
const allocated = new Map();
|
|
25
|
-
const framedWrites = new Set();
|
|
26
|
-
const sseBindings = new Map();
|
|
27
|
-
for (const file of sourceFiles)
|
|
28
|
-
visit(file, (node) => {
|
|
29
|
-
if (!ts.isCallExpression(node))
|
|
30
|
-
return;
|
|
31
|
-
const marker = protocolMarker(node.expression, checker);
|
|
32
|
-
if (!marker)
|
|
33
|
-
return;
|
|
34
|
-
const binding = enclosingRouteBinding(node, checker, bindings, false);
|
|
35
|
-
if (!binding)
|
|
36
|
-
throw contractError(file, node, `${marker} must be inside an app.route handler`);
|
|
37
|
-
if (!protocolBindingRequested(binding, requestedKeys))
|
|
38
|
-
return;
|
|
39
|
-
const keyNode = node.arguments[0];
|
|
40
|
-
if (!keyNode || !ts.isStringLiteral(keyNode))
|
|
41
|
-
throw contractError(file, node, `${marker} requires a literal contract key`);
|
|
42
|
-
const prefix = `${binding.method}:${binding.routeTemplate}`;
|
|
43
|
-
if (keyNode.text !== prefix && !keyNode.text.startsWith(`${prefix}#`))
|
|
44
|
-
throw contractError(file, keyNode, `Contract key "${keyNode.text}" does not match enclosing route ${prefix}`);
|
|
45
|
-
const location = sourceLocation(file, node);
|
|
46
|
-
let errorKeys = [];
|
|
47
|
-
try {
|
|
48
|
-
if (marker === 'apiSseFrame') {
|
|
49
|
-
const rowKey = reserveKey(allocated, keyNode.text);
|
|
50
|
-
errorKeys = [rowKey];
|
|
51
|
-
if (!requestedProtocolKey(rowKey, binding, requestedKeys)) {
|
|
52
|
-
if (ts.isCallExpression(node.parent))
|
|
53
|
-
framedWrites.add(node.parent);
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
const body = node.arguments[1];
|
|
57
|
-
if (!body)
|
|
58
|
-
throw new Error(`${marker} requires a protocol body`);
|
|
59
|
-
const { write, receiver, status } = sseEmission(node, checker, calls, binding, bindings);
|
|
60
|
-
const sseEvents = extractSseEvents(checker.getTypeAtLocation(body), checker, location, options);
|
|
61
|
-
contracts.set(rowKey, {
|
|
62
|
-
...extractContractSchema(checker.getStringType(), checker, location, options),
|
|
63
|
-
...binding,
|
|
64
|
-
bodyKind: 'content',
|
|
65
|
-
mediaType: 'text/event-stream',
|
|
66
|
-
mediaTypeKnowledge: 'known',
|
|
67
|
-
...status,
|
|
68
|
-
sseEvents,
|
|
69
|
-
});
|
|
70
|
-
framedWrites.add(write);
|
|
71
|
-
const routeWrites = sseBindings.get(prefix) ?? { receivers: [], keys: [] };
|
|
72
|
-
routeWrites.receivers.push(receiver);
|
|
73
|
-
routeWrites.keys.push(rowKey);
|
|
74
|
-
sseBindings.set(prefix, routeWrites);
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
const declaration = node.parent;
|
|
78
|
-
const symbol = ts.isVariableDeclaration(declaration) &&
|
|
79
|
-
ts.isIdentifier(declaration.name) &&
|
|
80
|
-
ts.isVariableDeclarationList(declaration.parent) &&
|
|
81
|
-
!!(declaration.parent.flags & ts.NodeFlags.Const)
|
|
82
|
-
? checker.getSymbolAtLocation(declaration.name)
|
|
83
|
-
: undefined;
|
|
84
|
-
if (!symbol)
|
|
85
|
-
throw new Error('apiOpenApiHttpResponse must bind a response variable');
|
|
86
|
-
const keys = [];
|
|
87
|
-
errorKeys = keys;
|
|
88
|
-
const variants = extractHttpVariants(checker.getTypeAtLocation(node), checker, location, options, () => {
|
|
89
|
-
const rowKey = reserveKey(allocated, keyNode.text);
|
|
90
|
-
if (!requestedProtocolKey(rowKey, binding, requestedKeys))
|
|
91
|
-
return false;
|
|
92
|
-
keys.push(rowKey);
|
|
93
|
-
return true;
|
|
94
|
-
});
|
|
95
|
-
pending.push({
|
|
96
|
-
call: node,
|
|
97
|
-
symbol,
|
|
98
|
-
binding,
|
|
99
|
-
variants,
|
|
100
|
-
get declaredBodyKinds() {
|
|
101
|
-
return extractHttpBodyKinds(checker.getTypeAtLocation(node), checker);
|
|
102
|
-
},
|
|
103
|
-
keys,
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
catch (error) {
|
|
108
|
-
for (const key of errorKeys.length ? errorKeys : [reserveKey(allocated, keyNode.text)])
|
|
109
|
-
unavailable(contracts, key, binding, location, error, options);
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
const covered = registerHttpProtocols(pending, contracts, checker, (response, error) => {
|
|
113
|
-
for (const key of response.keys)
|
|
114
|
-
unavailable(contracts, key, response.binding, response.variants[0].source, error, options);
|
|
115
|
-
});
|
|
116
|
-
rejectRawSseWrites(sourceFiles, checker, bindings, framedWrites, sseBindings, (node, binding, keys) => {
|
|
117
|
-
for (const key of keys) {
|
|
118
|
-
contracts.delete(key);
|
|
119
|
-
unavailable(contracts, key, binding, sourceLocation(node.getSourceFile(), node), new Error('SSE route writes an unmarked frame'), options);
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
return covered;
|
|
123
|
-
}
|
|
124
|
-
function unavailable(contracts, key, binding, location, error, options) {
|
|
125
|
-
registerRouteContract(contracts, nextProtocolKey(contracts, key), binding, location, { bodyKind: 'content', statusKnowledge: 'unknown', mediaTypeKnowledge: 'unknown' }, () => {
|
|
126
|
-
throw error;
|
|
127
|
-
}, options);
|
|
128
|
-
}
|
|
129
|
-
function reserveKey(allocated, key) {
|
|
130
|
-
const row = nextProtocolKey(allocated, key);
|
|
131
|
-
allocated.set(row, undefined);
|
|
132
|
-
return row;
|
|
133
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import ts from '../contract-schema/typescript-api.mjs';
|
|
2
|
-
import { unwrapExpression } from './protocol-marker-analysis.mjs';
|
|
3
|
-
/** Excludes statically dead branches without claiming that dynamic branches always run. */
|
|
4
|
-
export function potentiallyExecuted(node) {
|
|
5
|
-
let current = node;
|
|
6
|
-
while (current.parent && !ts.isFunctionLike(current.parent)) {
|
|
7
|
-
const parent = current.parent;
|
|
8
|
-
if (ts.isBlock(parent)) {
|
|
9
|
-
const index = parent.statements.indexOf(current);
|
|
10
|
-
if (parent.statements.slice(0, index).some(terminates))
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
if (ts.isIfStatement(parent)) {
|
|
14
|
-
const condition = unwrapExpression(parent.expression).kind;
|
|
15
|
-
if (condition === ts.SyntaxKind.FalseKeyword && parent.thenStatement === current)
|
|
16
|
-
return false;
|
|
17
|
-
if (condition === ts.SyntaxKind.TrueKeyword && parent.elseStatement === current)
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
if ((ts.isWhileStatement(parent) || ts.isForStatement(parent)) &&
|
|
21
|
-
parent.statement === current) {
|
|
22
|
-
const condition = ts.isWhileStatement(parent) ? parent.expression : parent.condition;
|
|
23
|
-
if (condition && unwrapExpression(condition).kind === ts.SyntaxKind.FalseKeyword)
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
if (ts.isConditionalExpression(parent)) {
|
|
27
|
-
const condition = unwrapExpression(parent.condition).kind;
|
|
28
|
-
if (condition === ts.SyntaxKind.FalseKeyword && parent.whenTrue === current)
|
|
29
|
-
return false;
|
|
30
|
-
if (condition === ts.SyntaxKind.TrueKeyword && parent.whenFalse === current)
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
if (ts.isBinaryExpression(parent) && parent.right === current) {
|
|
34
|
-
const left = unwrapExpression(parent.left).kind;
|
|
35
|
-
if (left === ts.SyntaxKind.FalseKeyword &&
|
|
36
|
-
parent.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken)
|
|
37
|
-
return false;
|
|
38
|
-
if (left === ts.SyntaxKind.TrueKeyword &&
|
|
39
|
-
parent.operatorToken.kind === ts.SyntaxKind.BarBarToken)
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
current = parent;
|
|
43
|
-
}
|
|
44
|
-
return true;
|
|
45
|
-
}
|
|
46
|
-
function terminates(statement) {
|
|
47
|
-
if (ts.isReturnStatement(statement) ||
|
|
48
|
-
ts.isThrowStatement(statement) ||
|
|
49
|
-
ts.isBreakStatement(statement) ||
|
|
50
|
-
ts.isContinueStatement(statement))
|
|
51
|
-
return true;
|
|
52
|
-
if (ts.isBlock(statement))
|
|
53
|
-
return statement.statements.some(terminates);
|
|
54
|
-
if (!ts.isIfStatement(statement))
|
|
55
|
-
return false;
|
|
56
|
-
const condition = unwrapExpression(statement.expression).kind;
|
|
57
|
-
if (condition === ts.SyntaxKind.TrueKeyword)
|
|
58
|
-
return terminates(statement.thenStatement);
|
|
59
|
-
if (condition === ts.SyntaxKind.FalseKeyword)
|
|
60
|
-
return !!statement.elseStatement && terminates(statement.elseStatement);
|
|
61
|
-
return (!!statement.elseStatement &&
|
|
62
|
-
terminates(statement.thenStatement) &&
|
|
63
|
-
terminates(statement.elseStatement));
|
|
64
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import ts from '../contract-schema/typescript-api.mts';
|
|
2
|
-
import type { ProtocolCache } from './protocol-analysis-cache.mts';
|
|
3
|
-
/** Proves execution up to an optional handler whose registered binding is already established. */
|
|
4
|
-
export declare function executableProtocolPath(node: ts.Node, checker: ts.TypeChecker, boundHandler?: ts.Node, cache?: ProtocolCache): boolean;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import ts from '../contract-schema/typescript-api.mjs';
|
|
2
|
-
import { isSupportedProtocolCallback } from './protocol-callback-invocation.mjs';
|
|
3
|
-
import { potentiallyExecuted } from './protocol-executable-path.mjs';
|
|
4
|
-
import { enclosingFunction } from './protocol-marker-analysis.mjs';
|
|
5
|
-
/** Proves execution up to an optional handler whose registered binding is already established. */
|
|
6
|
-
export function executableProtocolPath(node, checker, boundHandler, cache) {
|
|
7
|
-
if (!potentiallyExecuted(node))
|
|
8
|
-
return false;
|
|
9
|
-
let fn = enclosingFunction(node);
|
|
10
|
-
while (fn && fn !== boundHandler) {
|
|
11
|
-
if (!potentiallyExecuted(fn) || !isSupportedProtocolCallback(fn, checker, cache))
|
|
12
|
-
return false;
|
|
13
|
-
fn = enclosingFunction(fn);
|
|
14
|
-
}
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import ts from '../contract-schema/typescript-api.mts';
|
|
2
|
-
export declare function associateHttpResponse(call: ts.CallExpression, response: ts.Symbol, checker: ts.TypeChecker, siblings?: ReadonlySet<ts.Symbol>): Map<ts.CallExpression, 'content' | 'none' | 'status'>;
|
|
3
|
-
/** Opaque callbacks may emit through an independently proven handler's context. */
|
|
4
|
-
export declare function opaqueHttpResponse(call: ts.CallExpression, checker: ts.TypeChecker, context?: ts.Symbol): boolean;
|
|
5
|
-
/** Mutable wrappers on supported callback paths cannot establish a complete contract. */
|
|
6
|
-
export declare function unsupportedContextResponse(call: ts.CallExpression, checker: ts.TypeChecker): boolean;
|
|
7
|
-
export declare function supportedResponseContext(call: ts.CallExpression, checker: ts.TypeChecker): ts.Symbol | undefined;
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import ts from '../contract-schema/typescript-api.mjs';
|
|
2
|
-
import { httpHandlerContext, httpContextScopes, indirectHttpResponseMethod, } from './protocol-http-context.mjs';
|
|
3
|
-
import { runtimeParameters } from './registered-route-runtime-parameters.mjs';
|
|
4
|
-
import { httpEmissionKind, contextResponseMethod } from './protocol-http-emission.mjs';
|
|
5
|
-
import { enclosingFunction } from './protocol-marker-analysis.mjs';
|
|
6
|
-
import { executableProtocolPath } from './protocol-execution-path.mjs';
|
|
7
|
-
import { unsupportedContextAlias } from './protocol-context-alias.mjs';
|
|
8
|
-
import { expressionReceiver } from './protocol-write-receiver.mjs';
|
|
9
|
-
import { visit } from './response-contract-route-analysis.mjs';
|
|
10
|
-
import { isSupportedProtocolCallback } from './protocol-callback-invocation.mjs';
|
|
11
|
-
import { mutatesHttpResponseMethod } from './protocol-http-method-mutations.mjs';
|
|
12
|
-
import { opaqueProtocolCallbackPath } from './protocol-opaque-callback.mjs';
|
|
13
|
-
import { opaqueHttpContextArgument } from './protocol-http-context-escapes.mjs';
|
|
14
|
-
import { mutatedHttpResponse } from './protocol-http-response-mutations.mjs';
|
|
15
|
-
const responseMethods = new Set([
|
|
16
|
-
'setStatus',
|
|
17
|
-
'pipeline',
|
|
18
|
-
'json',
|
|
19
|
-
'response.buffer',
|
|
20
|
-
'response.empty',
|
|
21
|
-
]);
|
|
22
|
-
export function associateHttpResponse(call, response, checker, siblings) {
|
|
23
|
-
const handler = enclosingFunction(call);
|
|
24
|
-
const handlerContext = handler && httpHandlerContext(handler, checker);
|
|
25
|
-
if (!handler || !handlerContext)
|
|
26
|
-
throw new Error('HTTP response must bind the handler context');
|
|
27
|
-
if (!executableProtocolPath(call, checker))
|
|
28
|
-
throw new Error('HTTP response must be inside a supported executable handler callback');
|
|
29
|
-
const emissions = new Map();
|
|
30
|
-
for (const [scope, context] of httpContextScopes(handler, checker))
|
|
31
|
-
visit(scope, (node) => {
|
|
32
|
-
if (mutatedHttpResponse(node, response, checker))
|
|
33
|
-
throw new Error('HTTP branded response body or status is mutated');
|
|
34
|
-
if (ts.isCallExpression(node) && opaqueHttpContextArgument(node, checker, context))
|
|
35
|
-
throw new Error('HTTP response context escapes through an opaque argument');
|
|
36
|
-
if (mutatesHttpResponseMethod(node, context, checker))
|
|
37
|
-
throw new Error('HTTP response context method is mutated');
|
|
38
|
-
if (ts.isCallExpression(node) &&
|
|
39
|
-
executableProtocolPath(node, checker) &&
|
|
40
|
-
responseMethods.has(indirectHttpResponseMethod(node, context, checker) ?? ''))
|
|
41
|
-
throw new Error('HTTP response has an unsupported indirect status or body emission');
|
|
42
|
-
if (ts.isCallExpression(node) && opaqueHttpResponse(node, checker, context))
|
|
43
|
-
throw new Error('HTTP response context escapes through an opaque callback');
|
|
44
|
-
if (ts.isBinaryExpression(node) &&
|
|
45
|
-
node.operatorToken.kind === ts.SyntaxKind.EqualsToken &&
|
|
46
|
-
executableProtocolPath(node, checker)) {
|
|
47
|
-
const receiver = expressionReceiver(node.right, checker);
|
|
48
|
-
if (receiver?.root === context &&
|
|
49
|
-
(receiver.path.length === 0 ||
|
|
50
|
-
(receiver.path.length === 1 && receiver.path[0] === 'response')))
|
|
51
|
-
throw new Error('HTTP response context has an unsupported mutable alias');
|
|
52
|
-
}
|
|
53
|
-
if (ts.isVariableDeclaration(node) &&
|
|
54
|
-
enclosingFunction(node) === scope &&
|
|
55
|
-
unsupportedContextAlias(node, context, checker))
|
|
56
|
-
throw new Error('HTTP response context has an unsupported mutable or destructured alias');
|
|
57
|
-
if (!ts.isCallExpression(node) || !executableProtocolPath(node, checker))
|
|
58
|
-
return;
|
|
59
|
-
const kind = enclosingFunction(node) === handler
|
|
60
|
-
? httpEmissionKind(node, response, context, checker)
|
|
61
|
-
: undefined;
|
|
62
|
-
if (kind)
|
|
63
|
-
emissions.set(node, kind);
|
|
64
|
-
else if (responseMethods.has(contextResponseMethod(node.expression, context, checker, true) ?? '') &&
|
|
65
|
-
(enclosingFunction(node) === scope ||
|
|
66
|
-
!!contextResponseMethod(node.expression, context, checker)))
|
|
67
|
-
if (siblings &&
|
|
68
|
-
[...siblings].some((symbol) => symbol !== response && !!httpEmissionKind(node, symbol, context, checker)))
|
|
69
|
-
return;
|
|
70
|
-
else
|
|
71
|
-
throw new Error('HTTP response has an unrelated status or body emission');
|
|
72
|
-
});
|
|
73
|
-
return emissions;
|
|
74
|
-
}
|
|
75
|
-
/** Opaque callbacks may emit through an independently proven handler's context. */
|
|
76
|
-
export function opaqueHttpResponse(call, checker, context) {
|
|
77
|
-
if (opaqueHttpContextArgument(call, checker, context))
|
|
78
|
-
return true;
|
|
79
|
-
if (context)
|
|
80
|
-
return (responseMethods.has(contextResponseMethod(call.expression, context, checker, true) ??
|
|
81
|
-
indirectHttpResponseMethod(call, context, checker) ??
|
|
82
|
-
'') && opaqueProtocolCallbackPath(call, checker));
|
|
83
|
-
return !!supportedResponseContext(call, checker) && opaqueProtocolCallbackPath(call, checker);
|
|
84
|
-
}
|
|
85
|
-
/** Mutable wrappers on supported callback paths cannot establish a complete contract. */
|
|
86
|
-
export function unsupportedContextResponse(call, checker) {
|
|
87
|
-
if (!executableProtocolPath(call, checker))
|
|
88
|
-
return false;
|
|
89
|
-
const context = supportedResponseContext(call, checker);
|
|
90
|
-
return !!context && contextResponseMethod(call.expression, context, checker) === undefined;
|
|
91
|
-
}
|
|
92
|
-
export function supportedResponseContext(call, checker) {
|
|
93
|
-
let handler = enclosingFunction(call);
|
|
94
|
-
while (handler) {
|
|
95
|
-
const name = runtimeParameters(handler)[0]?.name;
|
|
96
|
-
const symbol = name && ts.isIdentifier(name) ? checker.getSymbolAtLocation(name) : undefined;
|
|
97
|
-
if (symbol &&
|
|
98
|
-
responseMethods.has(contextResponseMethod(call.expression, symbol, checker, true) ??
|
|
99
|
-
indirectHttpResponseMethod(call, symbol, checker) ??
|
|
100
|
-
'') &&
|
|
101
|
-
httpHandlerContext(handler, checker) === symbol &&
|
|
102
|
-
isSupportedProtocolCallback(handler, checker) &&
|
|
103
|
-
executableProtocolPath(handler, checker))
|
|
104
|
-
return symbol;
|
|
105
|
-
handler = enclosingFunction(handler);
|
|
106
|
-
}
|
|
107
|
-
return undefined;
|
|
108
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import ts from '../contract-schema/typescript-api.mjs';
|
|
2
|
-
import { propertyType, stringLiterals, typeVariants } from './protocol-marker-analysis.mjs';
|
|
3
|
-
/** Checks complete wire body kinds without extracting unselected payload schemas. */
|
|
4
|
-
export function extractHttpBodyKinds(type, checker) {
|
|
5
|
-
const carrier = propertyType(type, 'apiHttpResponseVariants', checker);
|
|
6
|
-
const kinds = new Set();
|
|
7
|
-
for (const variant of typeVariants(carrier)) {
|
|
8
|
-
if (variant.flags & ts.TypeFlags.Undefined)
|
|
9
|
-
continue;
|
|
10
|
-
const names = stringLiterals(propertyType(variant, 'bodyKind', checker));
|
|
11
|
-
if (names.length !== 1)
|
|
12
|
-
throw new Error('HTTP response requires one concrete body kind per variant');
|
|
13
|
-
const kind = names[0];
|
|
14
|
-
if (kind !== 'content' && kind !== 'none')
|
|
15
|
-
throw new Error('HTTP response body kind is invalid');
|
|
16
|
-
kinds.add(kind);
|
|
17
|
-
}
|
|
18
|
-
return kinds;
|
|
19
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import ts from '../contract-schema/typescript-api.mts';
|
|
2
|
-
import type { ProtocolCache } from './protocol-analysis-cache.mts';
|
|
3
|
-
/** Use the same actual invocation sites for context admission and caller emission coverage. */
|
|
4
|
-
export declare function httpContextInvocations(fn: ts.FunctionLikeDeclaration, checker: ts.TypeChecker, cache?: ProtocolCache): {
|
|
5
|
-
registered: boolean;
|
|
6
|
-
callers: ts.CallExpression[];
|
|
7
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import ts from '../contract-schema/typescript-api.mjs';
|
|
2
|
-
import { createProtocolCallbackValueResolver } from './protocol-callback-values.mjs';
|
|
3
|
-
import { callbackArgumentBindings } from './protocol-callback-argument-bindings.mjs';
|
|
4
|
-
import { registeredHandler } from './protocol-callback-registration.mjs';
|
|
5
|
-
import { executableProtocolPath } from './protocol-execution-path.mjs';
|
|
6
|
-
import { enclosingFunction } from './protocol-marker-analysis.mjs';
|
|
7
|
-
/** Use the same actual invocation sites for context admission and caller emission coverage. */
|
|
8
|
-
export function httpContextInvocations(fn, checker, cache) {
|
|
9
|
-
const resolver = createProtocolCallbackValueResolver(checker);
|
|
10
|
-
const sourceFile = fn.getSourceFile();
|
|
11
|
-
let calls = cache?.calls.get(sourceFile);
|
|
12
|
-
if (!calls) {
|
|
13
|
-
const found = [];
|
|
14
|
-
const visit = (node) => {
|
|
15
|
-
if (ts.isCallExpression(node) && executableProtocolPath(node, checker, undefined, cache))
|
|
16
|
-
found.push(node);
|
|
17
|
-
ts.forEachChild(node, visit);
|
|
18
|
-
};
|
|
19
|
-
visit(sourceFile);
|
|
20
|
-
calls = found;
|
|
21
|
-
cache?.calls.set(sourceFile, calls);
|
|
22
|
-
}
|
|
23
|
-
const registered = calls.some((call) => registeredHandler(call) &&
|
|
24
|
-
call.arguments.some((argument) => resolver.resolve(argument, new Map())?.node === fn));
|
|
25
|
-
const callers = calls.filter((call) => {
|
|
26
|
-
if (resolver.resolve(call.expression, new Map())?.node === fn)
|
|
27
|
-
return true;
|
|
28
|
-
const owner = enclosingFunction(call);
|
|
29
|
-
if (!owner)
|
|
30
|
-
return false;
|
|
31
|
-
return calls.some((invocation) => {
|
|
32
|
-
const target = resolver.resolve(invocation.expression, new Map());
|
|
33
|
-
if (target?.node !== owner)
|
|
34
|
-
return false;
|
|
35
|
-
const env = callbackArgumentBindings(owner, invocation, new Map(), target.env, checker, resolver);
|
|
36
|
-
return !!env && resolver.resolve(call.expression, env)?.node === fn;
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
return { registered, callers };
|
|
40
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import ts from '../contract-schema/typescript-api.mts';
|
|
2
|
-
/** Opaque consumers of the canonical context may emit undocumented status or bodies. */
|
|
3
|
-
export declare function opaqueHttpContextArgument(call: ts.CallExpression, checker: ts.TypeChecker, context?: ts.Symbol, active?: Set<ts.FunctionLikeDeclaration>): boolean;
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import ts from '../contract-schema/typescript-api.mjs';
|
|
2
|
-
import { expressionReceiver } from './protocol-write-receiver.mjs';
|
|
3
|
-
import { httpHandlerContext, contextResponseMethod } from './protocol-http-context.mjs';
|
|
4
|
-
import { httpContextInvocations } from './protocol-http-context-callers.mjs';
|
|
5
|
-
import { callbackArgumentBindings } from './protocol-callback-argument-bindings.mjs';
|
|
6
|
-
import { runtimeParameters } from './registered-route-runtime-parameters.mjs';
|
|
7
|
-
import { enclosingFunction, unwrapExpression } from './protocol-marker-analysis.mjs';
|
|
8
|
-
import { executableProtocolPath } from './protocol-execution-path.mjs';
|
|
9
|
-
import { opaqueProtocolCallbackPath } from './protocol-opaque-callback.mjs';
|
|
10
|
-
import { visit } from './response-contract-route-analysis.mjs';
|
|
11
|
-
import { standardReflectApply } from './protocol-http-reflect.mjs';
|
|
12
|
-
import { createProtocolCallbackValueResolver, isProtocolCallbackFunction, } from './protocol-callback-values.mjs';
|
|
13
|
-
/** Opaque consumers of the canonical context may emit undocumented status or bodies. */
|
|
14
|
-
export function opaqueHttpContextArgument(call, checker, context, active = new Set()) {
|
|
15
|
-
const matches = (symbol) => call.arguments.some((argument) => contextArgument(argument, symbol, checker));
|
|
16
|
-
if (context && !matches(context))
|
|
17
|
-
return false;
|
|
18
|
-
if (!(executableProtocolPath(call, checker) || opaqueProtocolCallbackPath(call, checker)))
|
|
19
|
-
return false;
|
|
20
|
-
if (context)
|
|
21
|
-
return !implementedCallee(call, context, checker, active);
|
|
22
|
-
for (let owner = enclosingFunction(call); owner; owner = enclosingFunction(owner)) {
|
|
23
|
-
const name = runtimeParameters(owner)[0]?.name;
|
|
24
|
-
const symbol = name && ts.isIdentifier(name) ? checker.getSymbolAtLocation(name) : undefined;
|
|
25
|
-
if (symbol && matches(symbol) && httpHandlerContext(owner, checker) === symbol)
|
|
26
|
-
return !implementedCallee(call, symbol, checker, active);
|
|
27
|
-
}
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
function contextArgument(expression, context, checker) {
|
|
31
|
-
const receiver = expressionReceiver(expression, checker);
|
|
32
|
-
return ((receiver?.root === context &&
|
|
33
|
-
(receiver.path.length === 0 ||
|
|
34
|
-
(receiver.path.length === 1 && receiver.path[0] === 'response'))) ||
|
|
35
|
-
contextResponseMethod(unwrapExpression(expression), context, checker, true) === 'response');
|
|
36
|
-
}
|
|
37
|
-
/** Actual caller bindings retain the concrete implementations of consumed callback parameters. */
|
|
38
|
-
function implementedCallee(call, context, checker, active) {
|
|
39
|
-
const resolver = createProtocolCallbackValueResolver(checker);
|
|
40
|
-
if (standardReflectApply(call, checker)) {
|
|
41
|
-
const target = call.arguments[0] && resolver.resolve(call.arguments[0], new Map());
|
|
42
|
-
return !!(target &&
|
|
43
|
-
isProtocolCallbackFunction(target.node) &&
|
|
44
|
-
target.node.body &&
|
|
45
|
-
ts.isBlock(target.node.body) &&
|
|
46
|
-
target.node.body.statements.length === 0);
|
|
47
|
-
}
|
|
48
|
-
const implemented = (env) => {
|
|
49
|
-
const target = resolver.resolve(call.expression, env);
|
|
50
|
-
return !!(target &&
|
|
51
|
-
isProtocolCallbackFunction(target.node) &&
|
|
52
|
-
target.node.body &&
|
|
53
|
-
!calleeEscapes(target.node, call, context, checker, active));
|
|
54
|
-
};
|
|
55
|
-
if (implemented(new Map()))
|
|
56
|
-
return true;
|
|
57
|
-
const expression = unwrapExpression(call.expression);
|
|
58
|
-
const declaration = ts.isIdentifier(expression)
|
|
59
|
-
? checker.getSymbolAtLocation(expression)?.valueDeclaration
|
|
60
|
-
: undefined;
|
|
61
|
-
const owner = declaration && ts.isParameter(declaration) ? enclosingFunction(declaration) : undefined;
|
|
62
|
-
if (!owner || !runtimeParameters(owner).includes(declaration))
|
|
63
|
-
return false;
|
|
64
|
-
const callers = httpContextInvocations(owner, checker).callers;
|
|
65
|
-
return (callers.length > 0 &&
|
|
66
|
-
callers.every((invocation) => {
|
|
67
|
-
const target = resolver.resolve(invocation.expression, new Map());
|
|
68
|
-
if (target?.node !== owner)
|
|
69
|
-
return false;
|
|
70
|
-
const env = callbackArgumentBindings(owner, invocation, new Map(), target.env, checker, resolver);
|
|
71
|
-
return !!env && implemented(env);
|
|
72
|
-
}));
|
|
73
|
-
}
|
|
74
|
-
/** The current proven call binds canonical arguments; other foreign callers do not hide escapes. */
|
|
75
|
-
function calleeEscapes(fn, call, context, checker, active) {
|
|
76
|
-
if (active.has(fn))
|
|
77
|
-
return true;
|
|
78
|
-
const next = new Set(active).add(fn);
|
|
79
|
-
const contexts = [context];
|
|
80
|
-
for (const [index, parameter] of runtimeParameters(fn).entries()) {
|
|
81
|
-
const argument = call.arguments[index];
|
|
82
|
-
if (!argument || !contextArgument(argument, context, checker))
|
|
83
|
-
continue;
|
|
84
|
-
if (!ts.isIdentifier(parameter.name))
|
|
85
|
-
return true;
|
|
86
|
-
contexts.push(checker.getSymbolAtLocation(parameter.name));
|
|
87
|
-
}
|
|
88
|
-
let escaped = false;
|
|
89
|
-
visit(fn.body, (node) => {
|
|
90
|
-
if (ts.isCallExpression(node) &&
|
|
91
|
-
contexts.some((symbol) => opaqueHttpContextArgument(node, checker, symbol, next)))
|
|
92
|
-
escaped = true;
|
|
93
|
-
});
|
|
94
|
-
return escaped;
|
|
95
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import ts from '../contract-schema/typescript-api.mts';
|
|
2
|
-
export { contextResponseMethod } from './protocol-http-method-access.mts';
|
|
3
|
-
/** A helper parameter is a response context only when every executable caller passes one. */
|
|
4
|
-
export declare function httpHandlerContext(fn: ts.FunctionLikeDeclaration, checker: ts.TypeChecker, active?: Set<ts.FunctionLikeDeclaration>): ts.Symbol | undefined;
|
|
5
|
-
/** Follow only caller contexts already admitted by the actual-argument proof. */
|
|
6
|
-
export declare function httpContextScopes(fn: ts.FunctionLikeDeclaration, checker: ts.TypeChecker): Map<ts.FunctionLikeDeclaration, ts.Symbol>;
|
|
7
|
-
/** Indirect methods cannot prove the declared status or body, including borrowed this receivers. */
|
|
8
|
-
export declare function indirectHttpResponseMethod(call: ts.CallExpression, context: ts.Symbol, checker: ts.TypeChecker): string | undefined;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import ts from '../contract-schema/typescript-api.mjs';
|
|
2
|
-
import { httpContextInvocations } from './protocol-http-context-callers.mjs';
|
|
3
|
-
import { enclosingFunction } from './protocol-marker-analysis.mjs';
|
|
4
|
-
import { expressionReceiver } from './protocol-write-receiver.mjs';
|
|
5
|
-
import { hasBindingWrite } from './registered-route-binding-writes.mjs';
|
|
6
|
-
import { runtimeParameters } from './registered-route-runtime-parameters.mjs';
|
|
7
|
-
import { contextResponseMethod, methodAccess } from './protocol-http-method-access.mjs';
|
|
8
|
-
import { reflectHttpResponseMethod } from './protocol-http-reflect.mjs';
|
|
9
|
-
export { contextResponseMethod } from './protocol-http-method-access.mjs';
|
|
10
|
-
/** A helper parameter is a response context only when every executable caller passes one. */
|
|
11
|
-
export function httpHandlerContext(fn, checker, active = new Set()) {
|
|
12
|
-
if (active.has(fn))
|
|
13
|
-
return undefined;
|
|
14
|
-
const parameter = runtimeParameters(fn)[0];
|
|
15
|
-
const context = parameter && ts.isIdentifier(parameter.name)
|
|
16
|
-
? checker.getSymbolAtLocation(parameter.name)
|
|
17
|
-
: undefined;
|
|
18
|
-
if (!context || hasBindingWrite(parameter, checker))
|
|
19
|
-
return undefined;
|
|
20
|
-
const { registered, callers } = httpContextInvocations(fn, checker);
|
|
21
|
-
const next = new Set(active).add(fn);
|
|
22
|
-
const valid = (registered || callers.length > 0) &&
|
|
23
|
-
callers.every((call) => {
|
|
24
|
-
const argument = call.arguments[0];
|
|
25
|
-
const receiver = argument && expressionReceiver(argument, checker);
|
|
26
|
-
const declaration = receiver?.root.valueDeclaration;
|
|
27
|
-
const owner = declaration && ts.isParameter(declaration) ? enclosingFunction(declaration) : undefined;
|
|
28
|
-
return (!!owner &&
|
|
29
|
-
!!receiver &&
|
|
30
|
-
receiver.path.length === 0 &&
|
|
31
|
-
!receiver.mutableAlias &&
|
|
32
|
-
receiver.root === httpHandlerContext(owner, checker, next));
|
|
33
|
-
});
|
|
34
|
-
const result = valid ? context : undefined;
|
|
35
|
-
return result;
|
|
36
|
-
}
|
|
37
|
-
/** Follow only caller contexts already admitted by the actual-argument proof. */
|
|
38
|
-
export function httpContextScopes(fn, checker) {
|
|
39
|
-
const scopes = new Map();
|
|
40
|
-
const pending = [fn];
|
|
41
|
-
const seen = new Set();
|
|
42
|
-
while (pending.length) {
|
|
43
|
-
const current = pending.pop();
|
|
44
|
-
if (seen.has(current))
|
|
45
|
-
continue;
|
|
46
|
-
seen.add(current);
|
|
47
|
-
const context = httpHandlerContext(current, checker);
|
|
48
|
-
if (!context)
|
|
49
|
-
continue;
|
|
50
|
-
scopes.set(current, context);
|
|
51
|
-
for (const call of httpContextInvocations(current, checker).callers) {
|
|
52
|
-
// Admission above proves every caller's parameter-owned context.
|
|
53
|
-
const receiver = expressionReceiver(call.arguments[0], checker);
|
|
54
|
-
pending.push(enclosingFunction(receiver.root.valueDeclaration));
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return scopes;
|
|
58
|
-
}
|
|
59
|
-
/** Indirect methods cannot prove the declared status or body, including borrowed this receivers. */
|
|
60
|
-
export function indirectHttpResponseMethod(call, context, checker) {
|
|
61
|
-
const reflected = reflectHttpResponseMethod(call, context, checker);
|
|
62
|
-
if (reflected)
|
|
63
|
-
return reflected;
|
|
64
|
-
const outer = methodAccess(call.expression);
|
|
65
|
-
if (!outer || !['call', 'apply', 'bind'].includes(outer.name))
|
|
66
|
-
return undefined;
|
|
67
|
-
const direct = contextResponseMethod(outer.receiver, context, checker, true);
|
|
68
|
-
if (direct)
|
|
69
|
-
return direct;
|
|
70
|
-
const method = expressionReceiver(outer.receiver, checker);
|
|
71
|
-
if (method?.root === context)
|
|
72
|
-
return method.path[0] === 'response' ? method.path.slice(0, 2).join('.') : method.path[0];
|
|
73
|
-
const receiver = call.arguments[0] && expressionReceiver(call.arguments[0], checker);
|
|
74
|
-
if (receiver?.root !== context)
|
|
75
|
-
return undefined;
|
|
76
|
-
const target = methodAccess(outer.receiver);
|
|
77
|
-
const name = target?.name ?? method?.path.at(-1);
|
|
78
|
-
if (!name)
|
|
79
|
-
return undefined;
|
|
80
|
-
return receiver.path.length === 0
|
|
81
|
-
? name
|
|
82
|
-
: receiver.path.length === 1 && receiver.path[0] === 'response'
|
|
83
|
-
? `response.${name}`
|
|
84
|
-
: undefined;
|
|
85
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import ts from '../contract-schema/typescript-api.mts';
|
|
2
|
-
export { contextResponseMethod } from './protocol-http-context.mts';
|
|
3
|
-
export declare function httpEmissionKind(call: ts.CallExpression, response: ts.Symbol, context: ts.Symbol, checker: ts.TypeChecker): 'content' | 'none' | 'status' | undefined;
|