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,89 +0,0 @@
|
|
|
1
|
-
import { basename, dirname, resolve as resolvePath } from 'node:path';
|
|
2
|
-
import ts from '../contract-schema/typescript-api.mjs';
|
|
3
|
-
import { unwrapExpression } from './protocol-marker-analysis.mjs';
|
|
4
|
-
const standardLibrary = dirname(resolvePath(ts.getDefaultLibFilePath({})));
|
|
5
|
-
function isStandardDeclaration(declaration, libraries) {
|
|
6
|
-
const source = declaration.getSourceFile();
|
|
7
|
-
const file = resolvePath(source.fileName);
|
|
8
|
-
return libraries
|
|
9
|
-
? libraries.has(source)
|
|
10
|
-
: source.isDeclarationFile &&
|
|
11
|
-
dirname(file) === standardLibrary &&
|
|
12
|
-
/^lib(?:\.[\w.-]+)?\.d\.ts$/.test(basename(file));
|
|
13
|
-
}
|
|
14
|
-
export function literalStrings(expression, checker) {
|
|
15
|
-
if (!expression)
|
|
16
|
-
return undefined;
|
|
17
|
-
const strings = new Set();
|
|
18
|
-
function visit(type) {
|
|
19
|
-
if (type.isUnion())
|
|
20
|
-
return type.types.every(visit);
|
|
21
|
-
if (type.flags & ts.TypeFlags.StringLiteral) {
|
|
22
|
-
strings.add(type.value);
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
if (type.flags &
|
|
26
|
-
(ts.TypeFlags.String | ts.TypeFlags.Any | ts.TypeFlags.Unknown | ts.TypeFlags.TypeParameter))
|
|
27
|
-
return false;
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
return visit(checker.getTypeAtLocation(expression)) ? [...strings] : undefined;
|
|
31
|
-
}
|
|
32
|
-
export function globalTarget(expression, checker, seen = new Set()) {
|
|
33
|
-
const value = unwrapExpression(expression);
|
|
34
|
-
if (!ts.isIdentifier(value))
|
|
35
|
-
return undefined;
|
|
36
|
-
const symbol = checker.getSymbolAtLocation(value);
|
|
37
|
-
if (!symbol || seen.has(symbol))
|
|
38
|
-
return undefined;
|
|
39
|
-
seen.add(symbol);
|
|
40
|
-
if (value.text === 'globalThis')
|
|
41
|
-
return symbol.declarations?.length ? undefined : value;
|
|
42
|
-
if (symbol.name === 'global' &&
|
|
43
|
-
symbol.declarations?.some((declaration) => {
|
|
44
|
-
const source = declaration.getSourceFile();
|
|
45
|
-
return (ts.isVariableDeclaration(declaration) &&
|
|
46
|
-
source.isDeclarationFile &&
|
|
47
|
-
resolvePath(source.fileName)
|
|
48
|
-
.replaceAll('\\', '/')
|
|
49
|
-
.endsWith('/node_modules/@types/node/globals.d.ts'));
|
|
50
|
-
}))
|
|
51
|
-
return value;
|
|
52
|
-
const declaration = symbol.valueDeclaration;
|
|
53
|
-
return declaration && ts.isVariableDeclaration(declaration) && declaration.initializer
|
|
54
|
-
? globalTarget(declaration.initializer, checker, seen)
|
|
55
|
-
: undefined;
|
|
56
|
-
}
|
|
57
|
-
export function mutatorKind(call, checker, libraries) {
|
|
58
|
-
const callee = call.expression;
|
|
59
|
-
if (!ts.isPropertyAccessExpression(callee) || !ts.isIdentifier(callee.expression))
|
|
60
|
-
return undefined;
|
|
61
|
-
const owner = callee.expression.text;
|
|
62
|
-
const method = callee.name.text;
|
|
63
|
-
if (!((owner === 'Object' && ['defineProperty', 'assign'].includes(method)) ||
|
|
64
|
-
(owner === 'Reflect' && method === 'set')))
|
|
65
|
-
return undefined;
|
|
66
|
-
const ownerSymbol = checker.getSymbolAtLocation(callee.expression);
|
|
67
|
-
const methodSymbol = checker.getSymbolAtLocation(callee.name);
|
|
68
|
-
if (!ownerSymbol?.declarations?.length ||
|
|
69
|
-
!methodSymbol?.declarations?.length ||
|
|
70
|
-
!ownerSymbol.declarations.every((declaration) => isStandardDeclaration(declaration, libraries)) ||
|
|
71
|
-
!methodSymbol.declarations.every((declaration) => isStandardDeclaration(declaration, libraries)))
|
|
72
|
-
return undefined;
|
|
73
|
-
return method;
|
|
74
|
-
}
|
|
75
|
-
export function sourceKeys(source, checker) {
|
|
76
|
-
const keys = new Set();
|
|
77
|
-
function visit(type) {
|
|
78
|
-
if (type.flags & (ts.TypeFlags.Any | ts.TypeFlags.Unknown | ts.TypeFlags.TypeParameter))
|
|
79
|
-
return false;
|
|
80
|
-
if (type.isUnion())
|
|
81
|
-
return type.types.every(visit);
|
|
82
|
-
if (type.getStringIndexType())
|
|
83
|
-
return false;
|
|
84
|
-
for (const property of type.getProperties())
|
|
85
|
-
keys.add(property.name);
|
|
86
|
-
return true;
|
|
87
|
-
}
|
|
88
|
-
return visit(checker.getTypeAtLocation(unwrapExpression(source))) ? [...keys] : undefined;
|
|
89
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import ts from '../contract-schema/typescript-api.mts';
|
|
2
|
-
/** Records global timer and Promise writes, including calls to standard property mutators. */
|
|
3
|
-
export declare function writtenPlatformSymbols(files: readonly ts.SourceFile[], checker: ts.TypeChecker, libraries?: ReadonlySet<ts.SourceFile>): Set<ts.Symbol>;
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import ts from '../contract-schema/typescript-api.mjs';
|
|
2
|
-
import { unwrapExpression } from './protocol-marker-analysis.mjs';
|
|
3
|
-
import { globalTarget, literalStrings, mutatorKind, sourceKeys, } from './protocol-platform-mutation-targets.mjs';
|
|
4
|
-
const platformNames = ['setTimeout', 'setInterval', 'Promise'];
|
|
5
|
-
/** Records global timer and Promise writes, including calls to standard property mutators. */
|
|
6
|
-
export function writtenPlatformSymbols(files, checker, libraries) {
|
|
7
|
-
const written = new Set();
|
|
8
|
-
function mark(target, keys) {
|
|
9
|
-
const root = globalTarget(target, checker);
|
|
10
|
-
if (!root)
|
|
11
|
-
return;
|
|
12
|
-
const members = keys
|
|
13
|
-
? keys.map((key) => checker.getPropertyOfType(checker.getTypeAtLocation(root), key))
|
|
14
|
-
: platformNames.map((name) => checker.getPropertyOfType(checker.getTypeAtLocation(root), name));
|
|
15
|
-
for (const member of members)
|
|
16
|
-
if (member && platformNames.includes(member.name))
|
|
17
|
-
written.add(member);
|
|
18
|
-
}
|
|
19
|
-
function target(node) {
|
|
20
|
-
if (ts.isElementAccessExpression(node)) {
|
|
21
|
-
const keys = literalStrings(node.argumentExpression, checker);
|
|
22
|
-
mark(node.expression, keys);
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
if (ts.isPropertyAccessExpression(node)) {
|
|
26
|
-
const symbol = checker.getSymbolAtLocation(node.name);
|
|
27
|
-
if (globalTarget(node.expression, checker) && symbol && platformNames.includes(symbol.name))
|
|
28
|
-
written.add(symbol);
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
const symbol = checker.getSymbolAtLocation(node);
|
|
32
|
-
if (symbol && platformNames.includes(symbol.name))
|
|
33
|
-
written.add(symbol);
|
|
34
|
-
if (ts.isObjectLiteralExpression(node) ||
|
|
35
|
-
ts.isArrayLiteralExpression(node) ||
|
|
36
|
-
ts.isPropertyAssignment(node) ||
|
|
37
|
-
ts.isSpreadAssignment(node) ||
|
|
38
|
-
ts.isSpreadElement(node))
|
|
39
|
-
ts.forEachChild(node, target);
|
|
40
|
-
}
|
|
41
|
-
function visit(node) {
|
|
42
|
-
if (ts.isBinaryExpression(node) &&
|
|
43
|
-
node.operatorToken.kind >= ts.SyntaxKind.FirstAssignment &&
|
|
44
|
-
node.operatorToken.kind <= ts.SyntaxKind.LastAssignment)
|
|
45
|
-
target(node.left);
|
|
46
|
-
if (ts.isDeleteExpression(node))
|
|
47
|
-
target(node.expression);
|
|
48
|
-
if (ts.isCallExpression(node)) {
|
|
49
|
-
const kind = mutatorKind(node, checker, libraries);
|
|
50
|
-
if (kind && node.arguments[0] && ts.isSpreadElement(node.arguments[0]))
|
|
51
|
-
for (const file of files)
|
|
52
|
-
for (const binding of checker.getSymbolsInScope(file, ts.SymbolFlags.Value | ts.SymbolFlags.Alias)) {
|
|
53
|
-
const symbol = binding.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(binding) : binding;
|
|
54
|
-
if (platformNames.includes(symbol.name))
|
|
55
|
-
written.add(symbol);
|
|
56
|
-
}
|
|
57
|
-
if (kind === 'defineProperty' || kind === 'set') {
|
|
58
|
-
const receiver = node.arguments[0];
|
|
59
|
-
if (receiver && !ts.isSpreadElement(receiver))
|
|
60
|
-
mark(receiver, literalStrings(node.arguments[1] && !ts.isSpreadElement(node.arguments[1])
|
|
61
|
-
? node.arguments[1]
|
|
62
|
-
: undefined, checker));
|
|
63
|
-
}
|
|
64
|
-
else if (kind === 'assign') {
|
|
65
|
-
const receiver = node.arguments[0];
|
|
66
|
-
if (receiver && !ts.isSpreadElement(receiver) && globalTarget(receiver, checker)) {
|
|
67
|
-
for (const source of node.arguments.slice(1)) {
|
|
68
|
-
if (ts.isSpreadElement(source)) {
|
|
69
|
-
const values = unwrapExpression(source.expression);
|
|
70
|
-
if (ts.isArrayLiteralExpression(values)) {
|
|
71
|
-
for (const value of values.elements)
|
|
72
|
-
if (ts.isSpreadElement(value))
|
|
73
|
-
mark(receiver, undefined);
|
|
74
|
-
else
|
|
75
|
-
mark(receiver, sourceKeys(value, checker));
|
|
76
|
-
}
|
|
77
|
-
else
|
|
78
|
-
mark(receiver, undefined);
|
|
79
|
-
}
|
|
80
|
-
else
|
|
81
|
-
mark(receiver, sourceKeys(source, checker));
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
ts.forEachChild(node, visit);
|
|
87
|
-
}
|
|
88
|
-
for (const file of files)
|
|
89
|
-
if (!file.isDeclarationFile)
|
|
90
|
-
visit(file);
|
|
91
|
-
return written;
|
|
92
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { RouteBinding } from './response-contract-route-analysis.mts';
|
|
2
|
-
/** Whether requested protocol keys include a route binding, independent of its protocol variants. */
|
|
3
|
-
export declare function protocolBindingRequested(binding: RouteBinding, requestedKeys?: ReadonlySet<string>): boolean;
|
|
4
|
-
/** Maps one generated protocol key to its requested route spelling and exact variant suffix. */
|
|
5
|
-
export declare function requestedProtocolKey(key: string, binding: RouteBinding, requestedKeys?: ReadonlySet<string>): string | undefined;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { routeShape } from './registered-route-catalog.mjs';
|
|
2
|
-
/** Whether requested protocol keys include a route binding, independent of its protocol variants. */
|
|
3
|
-
export function protocolBindingRequested(binding, requestedKeys) {
|
|
4
|
-
if (!requestedKeys)
|
|
5
|
-
return true;
|
|
6
|
-
return [...requestedKeys].some((key) => {
|
|
7
|
-
const requested = parseProtocolKey(key);
|
|
8
|
-
return requested && sameRoute(requested, binding);
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
/** Maps one generated protocol key to its requested route spelling and exact variant suffix. */
|
|
12
|
-
export function requestedProtocolKey(key, binding, requestedKeys) {
|
|
13
|
-
if (!requestedKeys)
|
|
14
|
-
return key;
|
|
15
|
-
if (requestedKeys.size === 0)
|
|
16
|
-
return undefined;
|
|
17
|
-
const generated = parseProtocolKey(key);
|
|
18
|
-
if (!generated || !sameRoute(generated, binding))
|
|
19
|
-
return undefined;
|
|
20
|
-
const candidates = [];
|
|
21
|
-
for (const requestedKey of requestedKeys) {
|
|
22
|
-
const parsed = parseProtocolKey(requestedKey);
|
|
23
|
-
if (parsed?.suffix === generated.suffix && sameRoute(parsed, binding))
|
|
24
|
-
candidates.push({ key: requestedKey, parsed });
|
|
25
|
-
}
|
|
26
|
-
const exact = candidates.find((candidate) => candidate.parsed.base === generated.base);
|
|
27
|
-
return (exact ?? candidates.toSorted((left, right) => left.key.localeCompare(right.key))[0])?.key;
|
|
28
|
-
}
|
|
29
|
-
function parseProtocolKey(key) {
|
|
30
|
-
const suffixStart = key.indexOf('#');
|
|
31
|
-
const base = suffixStart < 0 ? key : key.slice(0, suffixStart);
|
|
32
|
-
const separator = base.indexOf(':');
|
|
33
|
-
if (separator <= 0)
|
|
34
|
-
return undefined;
|
|
35
|
-
return {
|
|
36
|
-
method: base.slice(0, separator),
|
|
37
|
-
routeTemplate: base.slice(separator + 1),
|
|
38
|
-
suffix: suffixStart < 0 ? '' : key.slice(suffixStart),
|
|
39
|
-
base,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
function sameRoute(key, binding) {
|
|
43
|
-
return (key.method === binding.method &&
|
|
44
|
-
routeShape(key.routeTemplate) === routeShape(binding.routeTemplate));
|
|
45
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import ts from '../contract-schema/typescript-api.mts';
|
|
2
|
-
import { type HandlerBindings, type RouteBinding } from './response-contract-route-analysis.mts';
|
|
3
|
-
export declare function sseCallerScope(functions: readonly ts.FunctionLikeDeclaration[], calls: readonly ts.CallExpression[], binding: RouteBinding, bindings: HandlerBindings, checker: ts.TypeChecker): {
|
|
4
|
-
paths: (ts.CallExpression | ts.NewExpression)[][];
|
|
5
|
-
contexts: Set<ts.Symbol>;
|
|
6
|
-
functions: ts.FunctionLikeDeclaration[];
|
|
7
|
-
} | undefined;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import ts from '../contract-schema/typescript-api.mjs';
|
|
2
|
-
import { createProtocolCallbackValueResolver } from './protocol-callback-values.mjs';
|
|
3
|
-
import { registeredHandler } from './protocol-callback-registration.mjs';
|
|
4
|
-
import { executableProtocolPath } from './protocol-execution-path.mjs';
|
|
5
|
-
import { enclosingFunction } from './protocol-marker-analysis.mjs';
|
|
6
|
-
import { runtimeParameters } from './registered-route-runtime-parameters.mjs';
|
|
7
|
-
import { expressionReceiver } from './protocol-write-receiver.mjs';
|
|
8
|
-
import { enclosingRouteBinding, } from './response-contract-route-analysis.mjs';
|
|
9
|
-
export function sseCallerScope(functions, calls, binding, bindings, checker) {
|
|
10
|
-
const resolver = createProtocolCallbackValueResolver(checker);
|
|
11
|
-
const matches = calls.flatMap((call) => {
|
|
12
|
-
const fn = resolver.resolve(call.expression, new Map())?.node;
|
|
13
|
-
if (!fn ||
|
|
14
|
-
!functions.includes(fn) ||
|
|
15
|
-
!executableProtocolPath(call, checker))
|
|
16
|
-
return [];
|
|
17
|
-
const route = enclosingRouteBinding(call, checker, bindings, false);
|
|
18
|
-
return route?.method === binding.method && route.routeTemplate === binding.routeTemplate
|
|
19
|
-
? [{ call, fn: fn }]
|
|
20
|
-
: [];
|
|
21
|
-
});
|
|
22
|
-
if (!matches.length)
|
|
23
|
-
return undefined;
|
|
24
|
-
const contexts = new Set();
|
|
25
|
-
const callerFunctions = new Set();
|
|
26
|
-
const paths = matches.map(({ call }) => {
|
|
27
|
-
const anchors = [call];
|
|
28
|
-
let fn = enclosingFunction(call);
|
|
29
|
-
let outer = fn;
|
|
30
|
-
while (fn) {
|
|
31
|
-
callerFunctions.add(fn);
|
|
32
|
-
let value = fn;
|
|
33
|
-
while (ts.isPropertyAssignment(value.parent) || ts.isObjectLiteralExpression(value.parent))
|
|
34
|
-
value = value.parent;
|
|
35
|
-
if (ts.isCallExpression(value.parent) || ts.isNewExpression(value.parent))
|
|
36
|
-
anchors.push(value.parent);
|
|
37
|
-
outer = fn;
|
|
38
|
-
fn = enclosingFunction(fn);
|
|
39
|
-
}
|
|
40
|
-
const name = outer && runtimeParameters(outer)[0]?.name;
|
|
41
|
-
const context = name && ts.isIdentifier(name) ? checker.getSymbolAtLocation(name) : undefined;
|
|
42
|
-
if (!outer ||
|
|
43
|
-
(name && !context) ||
|
|
44
|
-
!calls.some((node) => registeredHandler(node) &&
|
|
45
|
-
node.arguments.some((argument) => resolver.resolve(argument, new Map())?.node === outer)))
|
|
46
|
-
throw new Error('SSE helper must bind a registered caller context');
|
|
47
|
-
if (context)
|
|
48
|
-
contexts.add(context);
|
|
49
|
-
return anchors;
|
|
50
|
-
});
|
|
51
|
-
if (contexts.size > 1)
|
|
52
|
-
throw new Error('SSE helper has ambiguous caller contexts');
|
|
53
|
-
const context = [...contexts][0];
|
|
54
|
-
for (const { call, fn } of matches)
|
|
55
|
-
runtimeParameters(fn).forEach((parameter, index) => {
|
|
56
|
-
const argument = call.arguments[index];
|
|
57
|
-
const receiver = argument && expressionReceiver(argument, checker);
|
|
58
|
-
if (context &&
|
|
59
|
-
receiver?.root === context &&
|
|
60
|
-
receiver.path.length === 0 &&
|
|
61
|
-
!receiver.mutableAlias &&
|
|
62
|
-
ts.isIdentifier(parameter.name)) {
|
|
63
|
-
contexts.add(checker.getSymbolAtLocation(parameter.name));
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
return { paths, contexts, functions: [...callerFunctions] };
|
|
67
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import ts from '../contract-schema/typescript-api.mts';
|
|
2
|
-
import type { HandlerBindings, RouteBinding } from './response-contract-route-analysis.mts';
|
|
3
|
-
export declare function sseEmission(call: ts.CallExpression, checker: ts.TypeChecker, calls: readonly ts.CallExpression[], binding: RouteBinding, bindings: HandlerBindings): {
|
|
4
|
-
write: ts.CallExpression;
|
|
5
|
-
receiver: import("./protocol-write-receiver.mts").WriteReceiver;
|
|
6
|
-
status: {
|
|
7
|
-
statusCodes?: readonly [number, ...number[]];
|
|
8
|
-
statusKnowledge: 'default' | 'explicit' | 'unknown';
|
|
9
|
-
unavailableReason?: string;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import ts from '../contract-schema/typescript-api.mjs';
|
|
2
|
-
import { runtimeParameters } from './registered-route-runtime-parameters.mjs';
|
|
3
|
-
import { isSupportedProtocolCallback } from './protocol-callback-invocation.mjs';
|
|
4
|
-
import { potentiallyExecuted } from './protocol-executable-path.mjs';
|
|
5
|
-
import { enclosingFunction } from './protocol-marker-analysis.mjs';
|
|
6
|
-
import { sseCallerScope } from './protocol-sse-callers.mjs';
|
|
7
|
-
import { resolveSseStatus } from './protocol-sse-status.mjs';
|
|
8
|
-
import { writeReceiver } from './protocol-write-receiver.mjs';
|
|
9
|
-
export function sseEmission(call, checker, calls, binding, bindings) {
|
|
10
|
-
const write = call.parent;
|
|
11
|
-
if (!ts.isCallExpression(write) ||
|
|
12
|
-
!ts.isPropertyAccessExpression(write.expression) ||
|
|
13
|
-
write.expression.name.text !== 'write' ||
|
|
14
|
-
write.arguments[0] !== call)
|
|
15
|
-
throw new Error('apiSseFrame must be the frame written by its route');
|
|
16
|
-
const receiver = writeReceiver(write, checker);
|
|
17
|
-
if (!receiver)
|
|
18
|
-
throw new Error('SSE frame requires a bound stream receiver');
|
|
19
|
-
if (receiver.mutableAlias)
|
|
20
|
-
throw new Error('SSE frame uses a mutable stream alias');
|
|
21
|
-
let fn = enclosingFunction(call);
|
|
22
|
-
let context;
|
|
23
|
-
const callbacks = [];
|
|
24
|
-
const functions = [];
|
|
25
|
-
while (fn) {
|
|
26
|
-
functions.push(fn);
|
|
27
|
-
if (!potentiallyExecuted(fn) || !potentiallyExecuted(call))
|
|
28
|
-
throw new Error('SSE frame is not on an executable callback path');
|
|
29
|
-
if (fn.asteriskToken)
|
|
30
|
-
throw new Error('SSE frame is in a deferred generator');
|
|
31
|
-
if (!isSupportedProtocolCallback(fn, checker))
|
|
32
|
-
throw new Error('SSE frame is in an uninvoked callback');
|
|
33
|
-
if (ts.isFunctionDeclaration(fn)) {
|
|
34
|
-
const name = runtimeParameters(fn)[0]?.name;
|
|
35
|
-
if (name && ts.isIdentifier(name))
|
|
36
|
-
context = checker.getSymbolAtLocation(name);
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
let value = fn;
|
|
40
|
-
while (ts.isPropertyAssignment(value.parent) || ts.isObjectLiteralExpression(value.parent))
|
|
41
|
-
value = value.parent;
|
|
42
|
-
if (ts.isCallExpression(value.parent) || ts.isNewExpression(value.parent))
|
|
43
|
-
callbacks.push(value.parent);
|
|
44
|
-
if ((ts.isCallExpression(value.parent) &&
|
|
45
|
-
ts.isPropertyAccessExpression(value.parent.expression) &&
|
|
46
|
-
['get', 'post', 'put', 'patch', 'delete'].includes(value.parent.expression.name.text)) ||
|
|
47
|
-
(ts.isVariableDeclaration(fn.parent) && !enclosingFunction(fn))) {
|
|
48
|
-
const name = runtimeParameters(fn)[0]?.name;
|
|
49
|
-
if (name && ts.isIdentifier(name))
|
|
50
|
-
context = checker.getSymbolAtLocation(name);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
fn = enclosingFunction(fn);
|
|
54
|
-
}
|
|
55
|
-
const caller = sseCallerScope(functions, calls, binding, bindings, checker);
|
|
56
|
-
const anchors = [write, ...callbacks];
|
|
57
|
-
const paths = caller ? caller.paths.map((path) => [...anchors, ...path]) : [anchors];
|
|
58
|
-
const contexts = caller?.contexts ?? new Set(context ? [context] : []);
|
|
59
|
-
const status = resolveSseStatus(paths, [...new Set([...functions, ...(caller?.functions ?? [])])], contexts, checker);
|
|
60
|
-
return { write, receiver, status };
|
|
61
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import ts from '../contract-schema/typescript-api.mjs';
|
|
2
|
-
/** Excludes a sibling branch or a statement that cannot precede this anchor. */
|
|
3
|
-
export function statusCanPrecede(setter, anchor) {
|
|
4
|
-
const ancestors = new Set();
|
|
5
|
-
for (let node = anchor; node; node = node.parent)
|
|
6
|
-
ancestors.add(node);
|
|
7
|
-
for (let node = setter; node.parent; node = node.parent) {
|
|
8
|
-
const parent = node.parent;
|
|
9
|
-
if (ts.isIfStatement(parent) && parent.elseStatement) {
|
|
10
|
-
const opposite = parent.thenStatement === node ? parent.elseStatement : parent.thenStatement;
|
|
11
|
-
if (ancestors.has(opposite))
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
if (ts.isBlock(parent) && ancestors.has(parent)) {
|
|
15
|
-
let statement = anchor;
|
|
16
|
-
while (statement.parent !== parent)
|
|
17
|
-
statement = statement.parent;
|
|
18
|
-
if (parent.statements.indexOf(node) >
|
|
19
|
-
parent.statements.indexOf(statement))
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import ts from '../contract-schema/typescript-api.mts';
|
|
2
|
-
import { type HandlerBindings, type RouteBinding } from './response-contract-route-analysis.mts';
|
|
3
|
-
import { type WriteReceiver } from './protocol-write-receiver.mts';
|
|
4
|
-
export type SseRouteWrites = {
|
|
5
|
-
receivers: WriteReceiver[];
|
|
6
|
-
keys: string[];
|
|
7
|
-
};
|
|
8
|
-
/** Reports unmarked writes on executable or opaque escaping paths to a selected frame's stream. */
|
|
9
|
-
export declare function rejectRawSseWrites(files: readonly ts.SourceFile[], checker: ts.TypeChecker, bindings: HandlerBindings, framedWrites: ReadonlySet<ts.CallExpression>, routes: ReadonlyMap<string, SseRouteWrites>, reject: (node: ts.CallExpression, binding: RouteBinding, keys: readonly string[]) => void): void;
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import ts from '../contract-schema/typescript-api.mjs';
|
|
2
|
-
import { potentiallyExecuted } from './protocol-executable-path.mjs';
|
|
3
|
-
import { executableProtocolPath } from './protocol-execution-path.mjs';
|
|
4
|
-
import { opaqueProtocolCallbackPath } from './protocol-opaque-callback.mjs';
|
|
5
|
-
import { enclosingRouteBinding, visit, } from './response-contract-route-analysis.mjs';
|
|
6
|
-
import { expressionReceiver, sameWriteReceiver, } from './protocol-write-receiver.mjs';
|
|
7
|
-
import { sseWriteInvocation } from './protocol-sse-write-access.mjs';
|
|
8
|
-
import { isSourceLevelMutation, mutationAffectsSelectedStream, sseWriteMutation, } from './protocol-sse-write-mutations.mjs';
|
|
9
|
-
import { actualReceivers, helperBindings, opaqueCallReceivesSelectedStream, routeKey, } from './protocol-sse-write-helpers.mjs';
|
|
10
|
-
import { writeAccess } from './protocol-sse-write-resolution.mjs';
|
|
11
|
-
/** Reports unmarked writes on executable or opaque escaping paths to a selected frame's stream. */
|
|
12
|
-
export function rejectRawSseWrites(files, checker, bindings, framedWrites, routes, reject) {
|
|
13
|
-
const calls = [];
|
|
14
|
-
const mutations = [];
|
|
15
|
-
for (const file of files)
|
|
16
|
-
visit(file, (node) => {
|
|
17
|
-
if (ts.isCallExpression(node))
|
|
18
|
-
calls.push(node);
|
|
19
|
-
const mutation = sseWriteMutation(node);
|
|
20
|
-
if (mutation)
|
|
21
|
-
mutations.push(mutation);
|
|
22
|
-
});
|
|
23
|
-
for (const node of calls) {
|
|
24
|
-
if (framedWrites.has(node)) {
|
|
25
|
-
const binding = enclosingRouteBinding(node, checker, bindings, false);
|
|
26
|
-
const route = binding && routes.get(routeKey(binding));
|
|
27
|
-
const source = node.getSourceFile();
|
|
28
|
-
if (binding &&
|
|
29
|
-
route &&
|
|
30
|
-
mutationAffectsSelectedStream(mutations, route.receivers, checker, (mutationNode) => {
|
|
31
|
-
if (mutationNode.getSourceFile() === source && isSourceLevelMutation(mutationNode))
|
|
32
|
-
return true;
|
|
33
|
-
const candidate = enclosingRouteBinding(mutationNode, checker, bindings, false);
|
|
34
|
-
if (candidate && routeKey(candidate) === routeKey(binding))
|
|
35
|
-
return true;
|
|
36
|
-
if (!candidate &&
|
|
37
|
-
mutationNode.getSourceFile() === source &&
|
|
38
|
-
opaqueProtocolCallbackPath(mutationNode, checker))
|
|
39
|
-
return true;
|
|
40
|
-
return helperBindings(mutationNode, calls, checker, bindings).some((helper) => routeKey(helper) === routeKey(binding));
|
|
41
|
-
}, (mutationNode) => helperBindings(mutationNode, calls, checker, bindings).length > 0, (expression) => {
|
|
42
|
-
const receiver = expressionReceiver(expression, checker);
|
|
43
|
-
return receiver && actualReceivers(receiver, binding, calls, checker, bindings);
|
|
44
|
-
}, (receiver) => actualReceivers(receiver, binding, calls, checker, bindings)))
|
|
45
|
-
reject(node, binding, route.keys);
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
const access = sseWriteInvocation(node, checker);
|
|
49
|
-
if (!potentiallyExecuted(node))
|
|
50
|
-
continue;
|
|
51
|
-
const proven = executableProtocolPath(node, checker) || opaqueProtocolCallbackPath(node, checker);
|
|
52
|
-
const helpers = helperBindings(node, calls, checker, bindings);
|
|
53
|
-
if (!proven && !helpers.length)
|
|
54
|
-
continue;
|
|
55
|
-
const binding = proven ? enclosingRouteBinding(node, checker, bindings, false) : undefined;
|
|
56
|
-
const candidates = binding ? [binding] : helpers;
|
|
57
|
-
for (const candidate of candidates) {
|
|
58
|
-
const route = routes.get(routeKey(candidate));
|
|
59
|
-
if (!route)
|
|
60
|
-
continue;
|
|
61
|
-
const receiver = access?.receiver && expressionReceiver(access.receiver, checker);
|
|
62
|
-
const actual = receiver ? actualReceivers(receiver, candidate, calls, checker, bindings) : [];
|
|
63
|
-
const framed = route.receivers.flatMap((value) => actualReceivers(value, candidate, calls, checker, bindings));
|
|
64
|
-
const bound = writeAccess(node.expression);
|
|
65
|
-
const boundReceiver = bound?.method === 'bind' && expressionReceiver(bound.receiver, checker);
|
|
66
|
-
const boundActual = boundReceiver
|
|
67
|
-
? actualReceivers(boundReceiver, candidate, calls, checker, bindings)
|
|
68
|
-
: [];
|
|
69
|
-
const accessTargetsSelected = (access?.method === 'write' || access?.method === 'end') &&
|
|
70
|
-
actual.some((value) => value !== undefined &&
|
|
71
|
-
framed.some((frame) => frame !== undefined && sameWriteReceiver(frame, value)));
|
|
72
|
-
const bindsSelectedMember = bound?.method === 'bind' &&
|
|
73
|
-
boundActual.some((value) => value !== undefined &&
|
|
74
|
-
framed.some((frame) => frame !== undefined &&
|
|
75
|
-
frame.root === value.root &&
|
|
76
|
-
value.path.length > frame.path.length &&
|
|
77
|
-
value.path.slice(0, frame.path.length).join('.') === frame.path.join('.')));
|
|
78
|
-
if (!accessTargetsSelected &&
|
|
79
|
-
!bindsSelectedMember &&
|
|
80
|
-
opaqueCallReceivesSelectedStream(node, route.receivers, candidate, calls, checker, bindings)) {
|
|
81
|
-
reject(node, candidate, route.keys);
|
|
82
|
-
continue;
|
|
83
|
-
}
|
|
84
|
-
if (!access || !access.rawBytes)
|
|
85
|
-
continue;
|
|
86
|
-
if (!access.receiver) {
|
|
87
|
-
reject(node, candidate, route.keys);
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
if (!receiver) {
|
|
91
|
-
reject(node, candidate, route.keys);
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
if (actual.some((value) => value === undefined ||
|
|
95
|
-
framed.some((frame) => frame === undefined || sameWriteReceiver(frame, value))))
|
|
96
|
-
reject(node, candidate, route.keys);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import ts from '../contract-schema/typescript-api.mts';
|
|
2
|
-
import { resolveEmissionStatus } from './response-contract-status.mts';
|
|
3
|
-
export declare function resolveSseStatus(paths: readonly (readonly (ts.CallExpression | ts.NewExpression)[])[], functions: readonly ts.FunctionLikeDeclaration[], contexts: ReadonlySet<ts.Symbol>, checker: ts.TypeChecker): ReturnType<typeof resolveEmissionStatus>;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import ts from '../contract-schema/typescript-api.mjs';
|
|
2
|
-
import { executableProtocolPath } from './protocol-execution-path.mjs';
|
|
3
|
-
import { unsupportedContextAlias, unsupportedContextAssignment } from './protocol-context-alias.mjs';
|
|
4
|
-
import { contextResponseMethod } from './protocol-http-emission.mjs';
|
|
5
|
-
import { enclosingFunction, unwrapExpression } from './protocol-marker-analysis.mjs';
|
|
6
|
-
import { expressionReceiver } from './protocol-write-receiver.mjs';
|
|
7
|
-
import { statusCanPrecede } from './protocol-sse-feasible-status.mjs';
|
|
8
|
-
import { statusDominatesEmission, unconditionalStatusSetter } from './protocol-status-dominance.mjs';
|
|
9
|
-
import { visit } from './response-contract-route-analysis.mjs';
|
|
10
|
-
import { resolveEmissionStatus } from './response-contract-status.mjs';
|
|
11
|
-
import { statusForbidsBody } from './protocol-body-status.mjs';
|
|
12
|
-
export function resolveSseStatus(paths, functions, contexts, checker) {
|
|
13
|
-
const matches = (expression) => [...contexts].some((context) => contextResponseMethod(expression, context, checker) === 'setStatus');
|
|
14
|
-
const setters = new Set();
|
|
15
|
-
for (const fn of functions)
|
|
16
|
-
visit(fn, (node) => {
|
|
17
|
-
if (!executableProtocolPath(node, checker))
|
|
18
|
-
return;
|
|
19
|
-
if ([...contexts].some((context) => (ts.isVariableDeclaration(node) && unsupportedContextAlias(node, context, checker)) ||
|
|
20
|
-
unsupportedContextAssignment(node, context, checker)))
|
|
21
|
-
throw new Error('SSE context has an unsupported mutable or destructured alias');
|
|
22
|
-
if (ts.isCallExpression(node) && indirectSetter(node.expression, contexts, checker))
|
|
23
|
-
throw new Error('SSE context uses an unsupported indirect status setter');
|
|
24
|
-
if (ts.isCallExpression(node) && matches(node.expression))
|
|
25
|
-
setters.add(node);
|
|
26
|
-
});
|
|
27
|
-
const statuses = paths.map((path) => {
|
|
28
|
-
for (const setter of setters) {
|
|
29
|
-
const anchors = path.filter((anchor) => enclosingFunction(anchor) === enclosingFunction(setter));
|
|
30
|
-
if ((!anchors.length || anchors.some((anchor) => statusCanPrecede(setter, anchor))) &&
|
|
31
|
-
!anchors.some((anchor) => statusDominatesEmission(anchor, new Set([setter]))))
|
|
32
|
-
throw new Error('SSE status does not dominate its frame emission');
|
|
33
|
-
}
|
|
34
|
-
for (const anchor of path) {
|
|
35
|
-
const setter = nearestSetter(anchor, setters);
|
|
36
|
-
if (setter) {
|
|
37
|
-
const status = resolveEmissionStatus(setter, matches);
|
|
38
|
-
if (status.unavailableReason)
|
|
39
|
-
throw new Error(status.unavailableReason);
|
|
40
|
-
return status;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return { statusKnowledge: 'default' };
|
|
44
|
-
});
|
|
45
|
-
if (statuses.every((status) => status.statusKnowledge === 'default'))
|
|
46
|
-
return { statusKnowledge: 'default' };
|
|
47
|
-
const codes = [...new Set(statuses.flatMap((status) => status.statusCodes ?? [200]))].toSorted((a, b) => a - b);
|
|
48
|
-
if (codes.some((code) => !Number.isInteger(code) || code < 100 || code > 599))
|
|
49
|
-
throw new Error('SSE status must be an integer from 100 through 599');
|
|
50
|
-
if (codes.some(statusForbidsBody))
|
|
51
|
-
throw new Error('SSE HTTP status forbids response content');
|
|
52
|
-
return { statusKnowledge: 'explicit', statusCodes: codes };
|
|
53
|
-
}
|
|
54
|
-
function indirectSetter(expression, contexts, checker) {
|
|
55
|
-
const access = unwrapExpression(expression);
|
|
56
|
-
const name = ts.isPropertyAccessExpression(access)
|
|
57
|
-
? access.name.text
|
|
58
|
-
: ts.isElementAccessExpression(access) && ts.isStringLiteral(access.argumentExpression)
|
|
59
|
-
? access.argumentExpression.text
|
|
60
|
-
: undefined;
|
|
61
|
-
if (!name || !['call', 'apply', 'bind'].includes(name))
|
|
62
|
-
return false;
|
|
63
|
-
const target = access.expression;
|
|
64
|
-
if ([...contexts].some((context) => contextResponseMethod(target, context, checker) === 'setStatus'))
|
|
65
|
-
return true;
|
|
66
|
-
const receiver = expressionReceiver(target, checker);
|
|
67
|
-
return !!receiver && contexts.has(receiver.root) && receiver.path[0] === 'setStatus';
|
|
68
|
-
}
|
|
69
|
-
function nearestSetter(anchor, setters) {
|
|
70
|
-
let current = anchor;
|
|
71
|
-
while (current.parent && !ts.isFunctionLike(current.parent)) {
|
|
72
|
-
const parent = current.parent;
|
|
73
|
-
if (ts.isBlock(parent)) {
|
|
74
|
-
const index = parent.statements.indexOf(current);
|
|
75
|
-
for (const statement of parent.statements.slice(0, index).toReversed()) {
|
|
76
|
-
const setter = unconditionalStatusSetter(statement, setters);
|
|
77
|
-
if (setter)
|
|
78
|
-
return setter;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
current = parent;
|
|
82
|
-
}
|
|
83
|
-
return undefined;
|
|
84
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import ts from '../contract-schema/typescript-api.mts';
|
|
2
|
-
type WriteInvocation = {
|
|
3
|
-
receiver: ts.Expression | undefined;
|
|
4
|
-
method: string | undefined;
|
|
5
|
-
rawBytes: boolean;
|
|
6
|
-
};
|
|
7
|
-
/** Resolves direct and indirect SSE writes without losing their actual receiver. */
|
|
8
|
-
export declare function sseWriteInvocation(call: ts.CallExpression, checker: ts.TypeChecker): WriteInvocation | undefined;
|
|
9
|
-
export {};
|