vouchington-tooling 0.35.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.
Files changed (532) hide show
  1. package/README.md +24 -221
  2. package/dist/agent-blackboard/feedback-audit-source.mjs +2 -2
  3. package/dist/agent-blackboard/feedback-canonical.mjs +1 -1
  4. package/dist/agent-blackboard/feedback-codec.mjs +3 -3
  5. package/dist/agent-blackboard/feedback-compose.mjs +5 -5
  6. package/dist/agent-blackboard/feedback-deadline.mjs +1 -1
  7. package/dist/agent-blackboard/feedback-delivery.mjs +6 -6
  8. package/dist/agent-blackboard/feedback-fields.mjs +1 -1
  9. package/dist/agent-blackboard/feedback-identity.mjs +3 -3
  10. package/dist/agent-blackboard/feedback-journal-audit.mjs +4 -4
  11. package/dist/agent-blackboard/feedback-journal-sandbox.mjs +1 -1
  12. package/dist/agent-blackboard/feedback-online-error.mjs +1 -1
  13. package/dist/agent-blackboard/feedback-online.mjs +7 -7
  14. package/dist/agent-blackboard/feedback-outbox-counts.mjs +2 -2
  15. package/dist/agent-blackboard/feedback-outbox.mjs +7 -7
  16. package/dist/agent-blackboard/index.mjs +13 -13
  17. package/dist/agent-blackboard/journal.mjs +3 -3
  18. package/dist/agent-blackboard/session-tools.mjs +4 -4
  19. package/dist/agent-blackboard/snapshot-cleanup-directory.mjs +3 -3
  20. package/dist/agent-blackboard/snapshot-cleanup-receipt.mjs +1 -1
  21. package/dist/agent-blackboard/snapshot-cleanup-resume.mjs +2 -2
  22. package/dist/agent-blackboard/snapshot-partition-cleanup.mjs +3 -3
  23. package/dist/agent-blackboard/snapshot-partition-format.mjs +3 -3
  24. package/dist/agent-blackboard/snapshot-partition-predicates.mjs +2 -2
  25. package/dist/agent-blackboard/snapshot-partition-read.mjs +2 -2
  26. package/dist/agent-blackboard/snapshot-partition-validate.mjs +2 -2
  27. package/dist/agent-blackboard/snapshot-partition-write.mjs +2 -2
  28. package/dist/agent-blackboard/snapshot-partitions.mjs +4 -4
  29. package/dist/agent-blackboard/snapshot.mjs +2 -2
  30. package/dist/agent-harness-identity/index.d.mts +1 -1
  31. package/dist/api-fixtures/fixture-contract-validation.mjs +1 -1
  32. package/dist/api-fixtures/index.mjs +3 -3
  33. package/dist/ast-grep-examples/companion-parity.mjs +1 -1
  34. package/dist/ast-grep-examples/index.mjs +1 -1
  35. package/dist/basic-auth-doc-sync/index.mjs +2 -2
  36. package/dist/basic-auth-doc-sync/runbook.mjs +4 -4
  37. package/dist/basic-auth-doc-sync/source.mjs +2 -2
  38. package/dist/browser-session-runner/attempt.mjs +5 -5
  39. package/dist/browser-session-runner/index.mjs +4 -4
  40. package/dist/browser-session-runner/output.mjs +1 -1
  41. package/dist/ci-local/index.mjs +2 -2
  42. package/dist/cli/commands/agent-blackboard-flags.mjs +1 -1
  43. package/dist/cli/commands/agent-blackboard.mjs +3 -3
  44. package/dist/cli/commands/ast-grep-examples.mjs +1 -1
  45. package/dist/cli/commands/ast-grep-pack.mjs +1 -1
  46. package/dist/cli/commands/gha-artifacts-cleanup.mjs +1 -1
  47. package/dist/cli/commands/gha-runtime-audit.mjs +1 -1
  48. package/dist/cli/commands/gha-workspace-policy.mjs +2 -2
  49. package/dist/cli/commands/http-origin.mjs +1 -1
  50. package/dist/cli/commands/link-skill.mjs +1 -1
  51. package/dist/cli/commands/mcp.mjs +2 -2
  52. package/dist/cli/commands/nuget-central-version.mjs +1 -1
  53. package/dist/cli/commands/pnpm-install.mjs +1 -1
  54. package/dist/cli/commands/prepare-vitest-reports.mjs +1 -1
  55. package/dist/cli/commands/require-up-to-date.mjs +1 -1
  56. package/dist/cli/commands/retrospective-facts.mjs +1 -1
  57. package/dist/cli/commands/retrospective-transcript.mjs +1 -1
  58. package/dist/cli/commands/runner-port-policy.mjs +1 -1
  59. package/dist/cli/commands/vitest-blob-manifest.mjs +1 -1
  60. package/dist/cli/commands/vitest-report-attempt.mjs +1 -1
  61. package/dist/cli/index.mjs +27 -27
  62. package/dist/cli/installed-version.mjs +1 -1
  63. package/dist/cli/parse-gha-runtime-audit.mjs +1 -1
  64. package/dist/cli/parse-options.mjs +2 -2
  65. package/dist/cli/parse.mjs +5 -5
  66. package/dist/compiler-build/index.mjs +3 -3
  67. package/dist/compiler-build/program.mjs +3 -3
  68. package/dist/config-inventory/collect.mjs +5 -5
  69. package/dist/config-inventory/dynamic-configs.mjs +1 -1
  70. package/dist/config-inventory/env-expression-readers.mjs +1 -1
  71. package/dist/config-inventory/env-prefix-readers.mjs +2 -2
  72. package/dist/config-inventory/env-var-accumulator.mjs +1 -1
  73. package/dist/config-inventory/env-vars.mjs +5 -5
  74. package/dist/config-inventory/index.mjs +2 -2
  75. package/dist/contract-schema/contract-schema-bounded-array.mjs +2 -2
  76. package/dist/contract-schema/contract-schema-extractor.mjs +3 -3
  77. package/dist/contract-schema/contract-schema-object-tuple.mjs +2 -2
  78. package/dist/contract-schema/contract-schema-type-extractor.mjs +5 -5
  79. package/dist/contract-schema/contract-schema-type-utils.mjs +2 -2
  80. package/dist/contract-schema/contract-schema-validator.mjs +1 -1
  81. package/dist/contract-schema/index.mjs +7 -7
  82. package/dist/contract-schema/type-query-call.mjs +3 -3
  83. package/dist/contract-schema/type-query.mjs +2 -2
  84. package/dist/contract-schema/virtual-program.mjs +1 -1
  85. package/dist/coverage-transport/control-v2-parse-object.mjs +2 -2
  86. package/dist/coverage-transport/control-v2.mjs +4 -4
  87. package/dist/coverage-transport/control.mjs +2 -2
  88. package/dist/coverage-transport/discovery.mjs +4 -4
  89. package/dist/coverage-transport/http.mjs +1 -1
  90. package/dist/coverage-transport/index.mjs +10 -10
  91. package/dist/coverage-transport/keys.mjs +1 -1
  92. package/dist/coverage-transport/lib.mjs +6 -6
  93. package/dist/coverage-transport/prefix-transfer.mjs +4 -4
  94. package/dist/coverage-transport/prefix.mjs +3 -3
  95. package/dist/coverage-transport/presign.mjs +1 -1
  96. package/dist/coverage-transport/vitest-blob-transport.mjs +2 -2
  97. package/dist/dependency-license-policy/collect.mjs +5 -5
  98. package/dist/dependency-license-policy/index.mjs +3 -3
  99. package/dist/dependency-license-policy/policy.mjs +1 -1
  100. package/dist/dependency-license-policy/workspace.mjs +1 -1
  101. package/dist/dockerfile-parse/index.mjs +2 -2
  102. package/dist/dockerfile-parse/prewarm-ports.mjs +1 -1
  103. package/dist/dockerfile-parse/runtime-cmd.mjs +2 -2
  104. package/dist/finite-enum-ripple/check.mjs +3 -3
  105. package/dist/finite-enum-ripple/compare.mjs +2 -2
  106. package/dist/finite-enum-ripple/component-paths.mjs +2 -2
  107. package/dist/finite-enum-ripple/configured-object-mutations.mjs +1 -1
  108. package/dist/finite-enum-ripple/create-page-jsx.mjs +1 -1
  109. package/dist/finite-enum-ripple/create-page-literals.mjs +4 -4
  110. package/dist/finite-enum-ripple/create-page-object-visitor.mjs +2 -2
  111. package/dist/finite-enum-ripple/create-page-properties.mjs +1 -1
  112. package/dist/finite-enum-ripple/index.mjs +1 -1
  113. package/dist/finite-enum-ripple/parser-support.mjs +2 -2
  114. package/dist/finite-enum-ripple/parsers.mjs +3 -3
  115. package/dist/finite-enum-ripple/structured-route-check.mjs +4 -4
  116. package/dist/finite-enum-ripple/types.mjs +3 -3
  117. package/dist/finite-enum-ripple/union-factory-check.mjs +2 -2
  118. package/dist/finite-enum-ripple/union-types.mjs +4 -4
  119. package/dist/gh-api-shell-quoting/index.mjs +2 -2
  120. package/dist/gh-api-shell-quoting/logical-line.mjs +1 -1
  121. package/dist/gh-api-shell-quoting/scan.mjs +1 -1
  122. package/dist/gh-api-shell-quoting/yaml.mjs +1 -1
  123. package/dist/gh-cli/index.mjs +4 -4
  124. package/dist/gha-artifacts-cleanup/commands.mjs +2 -2
  125. package/dist/gha-artifacts-cleanup/index.mjs +4 -4
  126. package/dist/gha-check-run/cli.mjs +2 -2
  127. package/dist/gha-check-run/index.mjs +2 -2
  128. package/dist/gha-claude-post-review/index.mjs +2 -2
  129. package/dist/gha-post-review/claude-token.d.mts +2 -2
  130. package/dist/gha-post-review/claude-token.mjs +1 -1
  131. package/dist/gha-post-review/cli.mjs +1 -1
  132. package/dist/gha-post-review/github.mjs +7 -7
  133. package/dist/gha-post-review/index.mjs +6 -6
  134. package/dist/gha-post-review/post.mjs +2 -2
  135. package/dist/gha-post-review/pull-io.mjs +1 -1
  136. package/dist/gha-post-review/token.mjs +1 -1
  137. package/dist/gha-pr-checkpoint/index.mjs +3 -3
  138. package/dist/gha-pr-checkpoint/resume.mjs +1 -1
  139. package/dist/gha-pr-checkpoint/update.mjs +1 -1
  140. package/dist/gha-review-payload/cli.mjs +2 -2
  141. package/dist/gha-review-payload/file.mjs +1 -1
  142. package/dist/gha-review-payload/index.mjs +4 -4
  143. package/dist/gha-review-payload/remap.mjs +1 -1
  144. package/dist/gha-runtime-audit/audit.mjs +4 -4
  145. package/dist/gha-runtime-audit/index.mjs +3 -3
  146. package/dist/gha-workspace-policy/docker-options.mjs +1 -1
  147. package/dist/gha-workspace-policy/docker-workspace-user.mjs +2 -2
  148. package/dist/gha-workspace-policy/index.mjs +3 -3
  149. package/dist/gha-workspace-policy/shell-tokens.mjs +1 -1
  150. package/dist/gha-workspace-policy/sparse-checkout.mjs +1 -1
  151. package/dist/github-projects/index.mjs +2 -2
  152. package/dist/github-projects/project-audit.mjs +1 -1
  153. package/dist/index.mjs +55 -55
  154. package/dist/markdown/content-facts.mjs +1 -1
  155. package/dist/markdown/document-sections.mjs +2 -2
  156. package/dist/markdown/html-blocks.mjs +1 -1
  157. package/dist/markdown/index.mjs +10 -10
  158. package/dist/markdown/sections.mjs +2 -2
  159. package/dist/markdown/tables.mjs +2 -2
  160. package/dist/markdown/tasks.mjs +1 -1
  161. package/dist/mcp-server/context.mjs +2 -2
  162. package/dist/mcp-server/dispatch.mjs +8 -8
  163. package/dist/mcp-server/git-fixture.test-helpers.mjs +1 -1
  164. package/dist/mcp-server/handlers-journal.mjs +4 -4
  165. package/dist/mcp-server/handlers-outbox.mjs +2 -2
  166. package/dist/mcp-server/handlers-session.mjs +3 -3
  167. package/dist/mcp-server/harness.test-helpers.mjs +4 -4
  168. package/dist/mcp-server/main.mjs +1 -1
  169. package/dist/mcp-server/run.mjs +3 -3
  170. package/dist/mcp-server/sdk.mjs +1 -1
  171. package/dist/mcp-server/server.mjs +2 -2
  172. package/dist/mcp-server/worktree.mjs +2 -2
  173. package/dist/nuget-central-version/cli.mjs +1 -1
  174. package/dist/openapi-document/build-openapi-catalog-sse.mjs +1 -1
  175. package/dist/openapi-document/build-openapi-document.mjs +8 -8
  176. package/dist/openapi-document/build-openapi-request.mjs +1 -1
  177. package/dist/openapi-document/build-openapi-response.mjs +3 -3
  178. package/dist/openapi-document/build-openapi-sse-events.mjs +1 -1
  179. package/dist/openapi-document/component-registry.mjs +1 -1
  180. package/dist/openapi-document/contract-schema-intersection-merge.mjs +1 -1
  181. package/dist/openapi-document/contract-schema-to-openapi.mjs +1 -1
  182. package/dist/openapi-document/index.mjs +12 -12
  183. package/dist/openapi-document/openapi-route-helpers.mjs +1 -1
  184. package/dist/pg-schema-snapshot/build-snapshot.mjs +3 -3
  185. package/dist/pg-schema-snapshot/catalog-objects.mjs +1 -1
  186. package/dist/pg-schema-snapshot/catalog-queries.mjs +4 -4
  187. package/dist/pg-schema-snapshot/catalog-table-constraints.mjs +1 -1
  188. package/dist/pg-schema-snapshot/catalog-table-indexes.mjs +1 -1
  189. package/dist/pg-schema-snapshot/catalog-tables.mjs +1 -1
  190. package/dist/pg-schema-snapshot/generate.mjs +5 -5
  191. package/dist/pg-schema-snapshot/index.mjs +6 -6
  192. package/dist/pg-schema-snapshot/markdown-files.mjs +1 -1
  193. package/dist/pg-schema-snapshot/render-markdown.mjs +1 -1
  194. package/dist/pg-schema-snapshot/table-snapshot-constraints.mjs +1 -1
  195. package/dist/pg-schema-snapshot/table-snapshot.mjs +3 -3
  196. package/dist/pnpm-deploy/index.mjs +3 -3
  197. package/dist/pnpm-deploy/restore.mjs +1 -1
  198. package/dist/pnpm-install/exec.mjs +1 -1
  199. package/dist/pnpm-install/index.mjs +8 -8
  200. package/dist/pnpm-install/install-operations.mjs +6 -6
  201. package/dist/pnpm-install/metadata-legacy.mjs +1 -1
  202. package/dist/pnpm-install/metadata.d.mts +1 -1
  203. package/dist/pnpm-install/metadata.mjs +2 -2
  204. package/dist/pnpm-install/native-health.mjs +2 -2
  205. package/dist/pnpm-install/pnpm-install-fixture.test-helpers.mjs +2 -2
  206. package/dist/pnpm-install/runner.mjs +7 -7
  207. package/dist/post-publication-inventory/index.d.mts +6 -0
  208. package/dist/post-publication-inventory/index.mjs +6 -2
  209. package/dist/post-publication-inventory/readers/compose-appends.d.mts +7 -0
  210. package/dist/post-publication-inventory/readers/compose-appends.mjs +38 -0
  211. package/dist/post-publication-inventory/readers/composes.d.mts +2 -0
  212. package/dist/post-publication-inventory/readers/composes.mjs +79 -0
  213. package/dist/post-publication-inventory/readers/composition.d.mts +2 -0
  214. package/dist/post-publication-inventory/readers/composition.mjs +62 -0
  215. package/dist/post-publication-inventory/readers/public-boundary-ast.d.mts +5 -0
  216. package/dist/post-publication-inventory/readers/public-boundary-ast.mjs +33 -0
  217. package/dist/post-publication-inventory/readers/public-boundary-consumed.d.mts +3 -0
  218. package/dist/post-publication-inventory/readers/public-boundary-consumed.mjs +39 -0
  219. package/dist/post-publication-inventory/readers/public-boundary-dataflow.d.mts +3 -0
  220. package/dist/post-publication-inventory/readers/public-boundary-dataflow.mjs +61 -0
  221. package/dist/post-publication-inventory/readers/public-boundary-then.d.mts +9 -0
  222. package/dist/post-publication-inventory/readers/public-boundary-then.mjs +31 -0
  223. package/dist/post-publication-inventory/readers/public-boundary.d.mts +3 -0
  224. package/dist/post-publication-inventory/readers/public-boundary.mjs +71 -0
  225. package/dist/post-publication-inventory/readers/public-view-ast.d.mts +6 -0
  226. package/dist/post-publication-inventory/readers/public-view-ast.mjs +67 -0
  227. package/dist/post-publication-inventory/readers/public-view-options.d.mts +8 -0
  228. package/dist/post-publication-inventory/readers/public-view-protection.d.mts +2 -0
  229. package/dist/post-publication-inventory/readers/public-view-protection.mjs +83 -0
  230. package/dist/post-publication-inventory/readers/public-view.d.mts +2 -0
  231. package/dist/post-publication-inventory/readers/public-view.mjs +117 -0
  232. package/dist/post-publication-inventory/readers/source-ast.d.mts +30 -0
  233. package/dist/post-publication-inventory/readers/source-ast.mjs +52 -0
  234. package/dist/post-publication-inventory/readers/source-executors.d.mts +4 -0
  235. package/dist/post-publication-inventory/readers/source-executors.mjs +38 -0
  236. package/dist/post-publication-inventory/readers/source-helpers.d.mts +16 -0
  237. package/dist/post-publication-inventory/readers/source-helpers.mjs +72 -0
  238. package/dist/post-publication-inventory/readers/source-options.d.mts +8 -0
  239. package/dist/post-publication-inventory/readers/source-sql.d.mts +3 -0
  240. package/dist/post-publication-inventory/readers/source-sql.mjs +17 -0
  241. package/dist/post-publication-inventory/readers/sql-executors.mjs +2 -2
  242. package/dist/post-publication-inventory/readers/sql-source.mjs +3 -3
  243. package/dist/post-publication-inventory/readers/sql-template.mjs +1 -1
  244. package/dist/post-publication-inventory/writers/source.mjs +1 -1
  245. package/dist/retrospective-facts/coverage.mjs +1 -1
  246. package/dist/retrospective-facts/foreign.mjs +3 -3
  247. package/dist/retrospective-facts/index.mjs +4 -4
  248. package/dist/retrospective-facts/local.mjs +4 -4
  249. package/dist/retrospective-transcript/claude-blocks.mjs +1 -1
  250. package/dist/retrospective-transcript/claude.mjs +2 -2
  251. package/dist/retrospective-transcript/codex-messages.mjs +1 -1
  252. package/dist/retrospective-transcript/codex-payload.mjs +2 -2
  253. package/dist/retrospective-transcript/codex-records.mjs +3 -3
  254. package/dist/retrospective-transcript/codex-segment.mjs +1 -1
  255. package/dist/retrospective-transcript/codex.mjs +2 -2
  256. package/dist/retrospective-transcript/index.mjs +9 -9
  257. package/dist/retrospective-transcript/resolve-transcript-file.mjs +2 -2
  258. package/dist/scc-complexity/baseline.mjs +2 -2
  259. package/dist/scc-complexity/index.mjs +8 -8
  260. package/dist/scc-complexity/parser.mjs +1 -1
  261. package/dist/scc-complexity/scope-config.mjs +1 -1
  262. package/dist/session-friction/audit-block.mjs +1 -1
  263. package/dist/session-friction/ci-failures.mjs +2 -2
  264. package/dist/session-friction/classify.mjs +2 -2
  265. package/dist/session-friction/coverage-ledger.mjs +1 -1
  266. package/dist/session-friction/index.mjs +5 -5
  267. package/dist/session-friction/log-file.mjs +2 -2
  268. package/dist/session-friction/log.mjs +7 -7
  269. package/dist/session-friction/normalize.mjs +1 -1
  270. package/dist/session-friction/report.mjs +5 -5
  271. package/dist/session-friction/sandbox.mjs +1 -1
  272. package/dist/session-friction/session-id.mjs +1 -1
  273. package/dist/shared-context/index.mjs +1 -1
  274. package/dist/skill-discovery/index.mjs +3 -3
  275. package/dist/sql-ast/add-column.mjs +1 -1
  276. package/dist/sql-ast/constraint-do-block.mjs +2 -2
  277. package/dist/sql-ast/constraint-shared.mjs +1 -1
  278. package/dist/sql-ast/constraint.mjs +4 -4
  279. package/dist/sql-ast/create-table.mjs +2 -2
  280. package/dist/sql-ast/drop-index.mjs +2 -2
  281. package/dist/sql-ast/implicit-indexes.mjs +1 -1
  282. package/dist/sql-ast/index-metadata.mjs +3 -3
  283. package/dist/sql-ast/index.mjs +8 -8
  284. package/dist/sql-scanner/comments.mjs +1 -1
  285. package/dist/sql-scanner/index.mjs +3 -3
  286. package/dist/sql-scanner/literals.mjs +1 -1
  287. package/dist/swift-semantic-equal/cli.mjs +1 -1
  288. package/dist/swift-semantic-equal/index.mjs +1 -1
  289. package/dist/transient-retry/index.mjs +2 -2
  290. package/dist/vitest-blob-manifest/cli.mjs +2 -2
  291. package/dist/vitest-blob-manifest/index.mjs +4 -4
  292. package/dist/vitest-blob-manifest/report-attempt-cli.mjs +2 -2
  293. package/dist/vitest-blob-manifest/report-attempt.mjs +1 -1
  294. package/dist/vitest-blob-manifest/reports-cli.mjs +3 -3
  295. package/dist/vitest-blob-manifest/reports-source.mjs +2 -2
  296. package/dist/vitest-blob-manifest/reports.mjs +2 -2
  297. package/dist/vitest-diagnostics/index.mjs +8 -8
  298. package/dist/vitest-diagnostics/vitest-fork-exit-records.mjs +1 -1
  299. package/dist/vitest-diagnostics/vitest-fork-exit-sentinel.mjs +2 -2
  300. package/dist/vitest-diagnostics/vitest-fork-leak-detection.mjs +2 -2
  301. package/dist/vitest-diagnostics/vitest-worker-exit-diagnostics-reporter.mjs +2 -2
  302. package/dist/workflow-policy/condition-entailment.mjs +1 -1
  303. package/dist/workflow-policy/index.mjs +4 -4
  304. package/dist/workflow-policy/permission-inheritance.mjs +1 -1
  305. package/dist/workflow-policy/permission-mismatches.mjs +2 -2
  306. package/dist/workflow-policy/secret-readiness.mjs +2 -2
  307. package/dist/workspace-gates/first-party-graph.mjs +2 -2
  308. package/dist/workspace-gates/index.mjs +1 -1
  309. package/dist/workspace-gates/manifest-version-assertions.mjs +2 -2
  310. package/dist/workspace-gates/manifest-version-parser.mjs +1 -1
  311. package/dist/workspace-gates/options.mjs +1 -1
  312. package/dist/workspace-gates/policy.mjs +7 -7
  313. package/dist/workspace-gates/test-helpers.d.mts +2 -2
  314. package/package.json +3 -6
  315. package/dist/api-contract-discovery/header-contract-parser.d.mts +0 -3
  316. package/dist/api-contract-discovery/header-contract-parser.mjs +0 -93
  317. package/dist/api-contract-discovery/header-contract-registry.d.mts +0 -3
  318. package/dist/api-contract-discovery/header-contract-registry.mjs +0 -40
  319. package/dist/api-contract-discovery/header-contract-types.d.mts +0 -19
  320. package/dist/api-contract-discovery/index.d.mts +0 -34
  321. package/dist/api-contract-discovery/index.mjs +0 -27
  322. package/dist/api-contract-discovery/protocol-analysis-cache.d.mts +0 -21
  323. package/dist/api-contract-discovery/protocol-analysis-cache.mjs +0 -7
  324. package/dist/api-contract-discovery/protocol-body-status.d.mts +0 -2
  325. package/dist/api-contract-discovery/protocol-body-status.mjs +0 -4
  326. package/dist/api-contract-discovery/protocol-callback-argument-bindings.d.mts +0 -7
  327. package/dist/api-contract-discovery/protocol-callback-argument-bindings.mjs +0 -33
  328. package/dist/api-contract-discovery/protocol-callback-invocation.d.mts +0 -6
  329. package/dist/api-contract-discovery/protocol-callback-invocation.mjs +0 -111
  330. package/dist/api-contract-discovery/protocol-callback-mutations.d.mts +0 -5
  331. package/dist/api-contract-discovery/protocol-callback-mutations.mjs +0 -42
  332. package/dist/api-contract-discovery/protocol-callback-registration.d.mts +0 -3
  333. package/dist/api-contract-discovery/protocol-callback-registration.mjs +0 -27
  334. package/dist/api-contract-discovery/protocol-callback-values.d.mts +0 -18
  335. package/dist/api-contract-discovery/protocol-callback-values.mjs +0 -114
  336. package/dist/api-contract-discovery/protocol-context-alias.d.mts +0 -3
  337. package/dist/api-contract-discovery/protocol-context-alias.mjs +0 -20
  338. package/dist/api-contract-discovery/protocol-contract-extraction.d.mts +0 -9
  339. package/dist/api-contract-discovery/protocol-contract-extraction.mjs +0 -87
  340. package/dist/api-contract-discovery/protocol-contract-keys.d.mts +0 -1
  341. package/dist/api-contract-discovery/protocol-contract-keys.mjs +0 -8
  342. package/dist/api-contract-discovery/protocol-contract-registry.d.mts +0 -5
  343. package/dist/api-contract-discovery/protocol-contract-registry.mjs +0 -133
  344. package/dist/api-contract-discovery/protocol-executable-path.d.mts +0 -3
  345. package/dist/api-contract-discovery/protocol-executable-path.mjs +0 -64
  346. package/dist/api-contract-discovery/protocol-execution-path.d.mts +0 -4
  347. package/dist/api-contract-discovery/protocol-execution-path.mjs +0 -16
  348. package/dist/api-contract-discovery/protocol-http-association.d.mts +0 -7
  349. package/dist/api-contract-discovery/protocol-http-association.mjs +0 -108
  350. package/dist/api-contract-discovery/protocol-http-body-kinds.d.mts +0 -3
  351. package/dist/api-contract-discovery/protocol-http-body-kinds.mjs +0 -19
  352. package/dist/api-contract-discovery/protocol-http-context-callers.d.mts +0 -7
  353. package/dist/api-contract-discovery/protocol-http-context-callers.mjs +0 -40
  354. package/dist/api-contract-discovery/protocol-http-context-escapes.d.mts +0 -3
  355. package/dist/api-contract-discovery/protocol-http-context-escapes.mjs +0 -95
  356. package/dist/api-contract-discovery/protocol-http-context.d.mts +0 -8
  357. package/dist/api-contract-discovery/protocol-http-context.mjs +0 -85
  358. package/dist/api-contract-discovery/protocol-http-emission.d.mts +0 -3
  359. package/dist/api-contract-discovery/protocol-http-emission.mjs +0 -76
  360. package/dist/api-contract-discovery/protocol-http-implicit-taint.d.mts +0 -7
  361. package/dist/api-contract-discovery/protocol-http-implicit-taint.mjs +0 -26
  362. package/dist/api-contract-discovery/protocol-http-method-access.d.mts +0 -9
  363. package/dist/api-contract-discovery/protocol-http-method-access.mjs +0 -34
  364. package/dist/api-contract-discovery/protocol-http-method-mutations.d.mts +0 -3
  365. package/dist/api-contract-discovery/protocol-http-method-mutations.mjs +0 -31
  366. package/dist/api-contract-discovery/protocol-http-reflect.d.mts +0 -5
  367. package/dist/api-contract-discovery/protocol-http-reflect.mjs +0 -45
  368. package/dist/api-contract-discovery/protocol-http-registration.d.mts +0 -12
  369. package/dist/api-contract-discovery/protocol-http-registration.mjs +0 -53
  370. package/dist/api-contract-discovery/protocol-http-response-mutations.d.mts +0 -3
  371. package/dist/api-contract-discovery/protocol-http-response-mutations.mjs +0 -31
  372. package/dist/api-contract-discovery/protocol-marker-analysis.d.mts +0 -7
  373. package/dist/api-contract-discovery/protocol-marker-analysis.mjs +0 -50
  374. package/dist/api-contract-discovery/protocol-opaque-callback.d.mts +0 -3
  375. package/dist/api-contract-discovery/protocol-opaque-callback.mjs +0 -107
  376. package/dist/api-contract-discovery/protocol-platform-callbacks.d.mts +0 -7
  377. package/dist/api-contract-discovery/protocol-platform-callbacks.mjs +0 -76
  378. package/dist/api-contract-discovery/protocol-platform-mutation-targets.d.mts +0 -5
  379. package/dist/api-contract-discovery/protocol-platform-mutation-targets.mjs +0 -89
  380. package/dist/api-contract-discovery/protocol-platform-writes.d.mts +0 -3
  381. package/dist/api-contract-discovery/protocol-platform-writes.mjs +0 -92
  382. package/dist/api-contract-discovery/protocol-requested-keys.d.mts +0 -5
  383. package/dist/api-contract-discovery/protocol-requested-keys.mjs +0 -45
  384. package/dist/api-contract-discovery/protocol-sse-callers.d.mts +0 -7
  385. package/dist/api-contract-discovery/protocol-sse-callers.mjs +0 -67
  386. package/dist/api-contract-discovery/protocol-sse-emission.d.mts +0 -11
  387. package/dist/api-contract-discovery/protocol-sse-emission.mjs +0 -61
  388. package/dist/api-contract-discovery/protocol-sse-feasible-status.d.mts +0 -3
  389. package/dist/api-contract-discovery/protocol-sse-feasible-status.mjs +0 -24
  390. package/dist/api-contract-discovery/protocol-sse-raw-writes.d.mts +0 -9
  391. package/dist/api-contract-discovery/protocol-sse-raw-writes.mjs +0 -99
  392. package/dist/api-contract-discovery/protocol-sse-status.d.mts +0 -3
  393. package/dist/api-contract-discovery/protocol-sse-status.mjs +0 -84
  394. package/dist/api-contract-discovery/protocol-sse-write-access.d.mts +0 -9
  395. package/dist/api-contract-discovery/protocol-sse-write-access.mjs +0 -42
  396. package/dist/api-contract-discovery/protocol-sse-write-helpers.d.mts +0 -7
  397. package/dist/api-contract-discovery/protocol-sse-write-helpers.mjs +0 -82
  398. package/dist/api-contract-discovery/protocol-sse-write-mutations.d.mts +0 -9
  399. package/dist/api-contract-discovery/protocol-sse-write-mutations.mjs +0 -42
  400. package/dist/api-contract-discovery/protocol-sse-write-resolution.d.mts +0 -14
  401. package/dist/api-contract-discovery/protocol-sse-write-resolution.mjs +0 -79
  402. package/dist/api-contract-discovery/protocol-status-dominance.d.mts +0 -5
  403. package/dist/api-contract-discovery/protocol-status-dominance.mjs +0 -35
  404. package/dist/api-contract-discovery/protocol-write-receiver.d.mts +0 -9
  405. package/dist/api-contract-discovery/protocol-write-receiver.mjs +0 -79
  406. package/dist/api-contract-discovery/query-contract-extraction.d.mts +0 -3
  407. package/dist/api-contract-discovery/query-contract-extraction.mjs +0 -82
  408. package/dist/api-contract-discovery/query-contract-literals.d.mts +0 -13
  409. package/dist/api-contract-discovery/query-contract-literals.mjs +0 -83
  410. package/dist/api-contract-discovery/query-contract-registry.d.mts +0 -3
  411. package/dist/api-contract-discovery/query-contract-registry.mjs +0 -70
  412. package/dist/api-contract-discovery/query-contract-types.d.mts +0 -8
  413. package/dist/api-contract-discovery/registered-route-binding-writes.d.mts +0 -4
  414. package/dist/api-contract-discovery/registered-route-binding-writes.mjs +0 -47
  415. package/dist/api-contract-discovery/registered-route-catalog.d.mts +0 -10
  416. package/dist/api-contract-discovery/registered-route-catalog.mjs +0 -85
  417. package/dist/api-contract-discovery/registered-route-factory-returns.d.mts +0 -3
  418. package/dist/api-contract-discovery/registered-route-factory-returns.mjs +0 -29
  419. package/dist/api-contract-discovery/registered-route-handler-analysis.d.mts +0 -12
  420. package/dist/api-contract-discovery/registered-route-handler-analysis.mjs +0 -119
  421. package/dist/api-contract-discovery/registered-route-handler-helpers.d.mts +0 -3
  422. package/dist/api-contract-discovery/registered-route-handler-helpers.mjs +0 -16
  423. package/dist/api-contract-discovery/registered-route-runtime-parameters.d.mts +0 -3
  424. package/dist/api-contract-discovery/registered-route-runtime-parameters.mjs +0 -5
  425. package/dist/api-contract-discovery/registered-route-terminal-error.d.mts +0 -3
  426. package/dist/api-contract-discovery/registered-route-terminal-error.mjs +0 -98
  427. package/dist/api-contract-discovery/request-contract-implicit.d.mts +0 -17
  428. package/dist/api-contract-discovery/request-contract-implicit.mjs +0 -73
  429. package/dist/api-contract-discovery/request-contract-lenient.d.mts +0 -28
  430. package/dist/api-contract-discovery/request-contract-lenient.mjs +0 -59
  431. package/dist/api-contract-discovery/request-contract-registry.d.mts +0 -14
  432. package/dist/api-contract-discovery/request-contract-registry.mjs +0 -63
  433. package/dist/api-contract-discovery/request-contract-route-analysis.d.mts +0 -25
  434. package/dist/api-contract-discovery/request-contract-route-analysis.mjs +0 -68
  435. package/dist/api-contract-discovery/request-contract-types.d.mts +0 -12
  436. package/dist/api-contract-discovery/request-contract-types.mjs +0 -1
  437. package/dist/api-contract-discovery/request-validation-callbacks.d.mts +0 -9
  438. package/dist/api-contract-discovery/request-validation-callbacks.mjs +0 -27
  439. package/dist/api-contract-discovery/request-validation-checker.d.mts +0 -7
  440. package/dist/api-contract-discovery/request-validation-checker.mjs +0 -25
  441. package/dist/api-contract-discovery/request-validation-conditional.d.mts +0 -6
  442. package/dist/api-contract-discovery/request-validation-conditional.mjs +0 -31
  443. package/dist/api-contract-discovery/request-validation-factory-calls.d.mts +0 -11
  444. package/dist/api-contract-discovery/request-validation-factory-calls.mjs +0 -23
  445. package/dist/api-contract-discovery/request-validation-facts.d.mts +0 -16
  446. package/dist/api-contract-discovery/request-validation-facts.mjs +0 -64
  447. package/dist/api-contract-discovery/request-validation-follow.d.mts +0 -24
  448. package/dist/api-contract-discovery/request-validation-follow.mjs +0 -38
  449. package/dist/api-contract-discovery/request-validation-handler-state.d.mts +0 -8
  450. package/dist/api-contract-discovery/request-validation-handler-state.mjs +0 -35
  451. package/dist/api-contract-discovery/request-validation-input.d.mts +0 -12
  452. package/dist/api-contract-discovery/request-validation-input.mjs +0 -43
  453. package/dist/api-contract-discovery/request-validation-keys.d.mts +0 -25
  454. package/dist/api-contract-discovery/request-validation-keys.mjs +0 -119
  455. package/dist/api-contract-discovery/request-validation-match.d.mts +0 -11
  456. package/dist/api-contract-discovery/request-validation-match.mjs +0 -47
  457. package/dist/api-contract-discovery/request-validation-mutation.d.mts +0 -7
  458. package/dist/api-contract-discovery/request-validation-mutation.mjs +0 -80
  459. package/dist/api-contract-discovery/request-validation-origin.d.mts +0 -20
  460. package/dist/api-contract-discovery/request-validation-origin.mjs +0 -71
  461. package/dist/api-contract-discovery/request-validation-reads.d.mts +0 -13
  462. package/dist/api-contract-discovery/request-validation-reads.mjs +0 -88
  463. package/dist/api-contract-discovery/request-validation-registration.d.mts +0 -9
  464. package/dist/api-contract-discovery/request-validation-registration.mjs +0 -32
  465. package/dist/api-contract-discovery/request-validation-report.d.mts +0 -3
  466. package/dist/api-contract-discovery/request-validation-report.mjs +0 -21
  467. package/dist/api-contract-discovery/request-validation-request-origin.d.mts +0 -5
  468. package/dist/api-contract-discovery/request-validation-request-origin.mjs +0 -13
  469. package/dist/api-contract-discovery/request-validation-select.d.mts +0 -9
  470. package/dist/api-contract-discovery/request-validation-select.mjs +0 -36
  471. package/dist/api-contract-discovery/request-validation-sites.d.mts +0 -9
  472. package/dist/api-contract-discovery/request-validation-sites.mjs +0 -77
  473. package/dist/api-contract-discovery/request-validation-state-key.d.mts +0 -13
  474. package/dist/api-contract-discovery/request-validation-state-key.mjs +0 -30
  475. package/dist/api-contract-discovery/request-validation-trace-helpers.d.mts +0 -14
  476. package/dist/api-contract-discovery/request-validation-trace-helpers.mjs +0 -80
  477. package/dist/api-contract-discovery/request-validation-trace-select.d.mts +0 -23
  478. package/dist/api-contract-discovery/request-validation-trace-select.mjs +0 -45
  479. package/dist/api-contract-discovery/request-validation-trace.d.mts +0 -8
  480. package/dist/api-contract-discovery/request-validation-trace.mjs +0 -130
  481. package/dist/api-contract-discovery/request-validation-types.d.mts +0 -84
  482. package/dist/api-contract-discovery/request-validation-types.mjs +0 -1
  483. package/dist/api-contract-discovery/request-validation-walker.d.mts +0 -26
  484. package/dist/api-contract-discovery/request-validation-walker.mjs +0 -143
  485. package/dist/api-contract-discovery/request-validation.test-helpers.d.mts +0 -39
  486. package/dist/api-contract-discovery/request-validation.test-helpers.mjs +0 -108
  487. package/dist/api-contract-discovery/response-contract-attribution-facts.d.mts +0 -2
  488. package/dist/api-contract-discovery/response-contract-attribution-facts.mjs +0 -18
  489. package/dist/api-contract-discovery/response-contract-attribution.d.mts +0 -3
  490. package/dist/api-contract-discovery/response-contract-attribution.mjs +0 -23
  491. package/dist/api-contract-discovery/response-contract-call-classification.d.mts +0 -3
  492. package/dist/api-contract-discovery/response-contract-call-classification.mjs +0 -37
  493. package/dist/api-contract-discovery/response-contract-ctx-analysis.d.mts +0 -7
  494. package/dist/api-contract-discovery/response-contract-ctx-analysis.mjs +0 -28
  495. package/dist/api-contract-discovery/response-contract-error-branch.d.mts +0 -15
  496. package/dist/api-contract-discovery/response-contract-error-branch.mjs +0 -150
  497. package/dist/api-contract-discovery/response-contract-handler-bindings.d.mts +0 -3
  498. package/dist/api-contract-discovery/response-contract-handler-bindings.mjs +0 -126
  499. package/dist/api-contract-discovery/response-contract-handler-calls.d.mts +0 -3
  500. package/dist/api-contract-discovery/response-contract-handler-calls.mjs +0 -81
  501. package/dist/api-contract-discovery/response-contract-implicit-sources.test-helpers.d.mts +0 -145
  502. package/dist/api-contract-discovery/response-contract-implicit-sources.test-helpers.mjs +0 -145
  503. package/dist/api-contract-discovery/response-contract-implicit-variants.d.mts +0 -2
  504. package/dist/api-contract-discovery/response-contract-implicit-variants.mjs +0 -6
  505. package/dist/api-contract-discovery/response-contract-implicit.d.mts +0 -6
  506. package/dist/api-contract-discovery/response-contract-implicit.mjs +0 -120
  507. package/dist/api-contract-discovery/response-contract-lenient.d.mts +0 -41
  508. package/dist/api-contract-discovery/response-contract-lenient.mjs +0 -52
  509. package/dist/api-contract-discovery/response-contract-media.d.mts +0 -3
  510. package/dist/api-contract-discovery/response-contract-media.mjs +0 -46
  511. package/dist/api-contract-discovery/response-contract-object-symbols.d.mts +0 -3
  512. package/dist/api-contract-discovery/response-contract-object-symbols.mjs +0 -80
  513. package/dist/api-contract-discovery/response-contract-property-mutations.d.mts +0 -5
  514. package/dist/api-contract-discovery/response-contract-property-mutations.mjs +0 -84
  515. package/dist/api-contract-discovery/response-contract-registration.d.mts +0 -11
  516. package/dist/api-contract-discovery/response-contract-registration.mjs +0 -65
  517. package/dist/api-contract-discovery/response-contract-registry.d.mts +0 -7
  518. package/dist/api-contract-discovery/response-contract-registry.mjs +0 -124
  519. package/dist/api-contract-discovery/response-contract-route-analysis.d.mts +0 -12
  520. package/dist/api-contract-discovery/response-contract-route-analysis.mjs +0 -65
  521. package/dist/api-contract-discovery/response-contract-route-syntax.d.mts +0 -7
  522. package/dist/api-contract-discovery/response-contract-route-syntax.mjs +0 -41
  523. package/dist/api-contract-discovery/response-contract-status.d.mts +0 -27
  524. package/dist/api-contract-discovery/response-contract-status.mjs +0 -82
  525. package/dist/api-contract-discovery/response-contract-symbols.d.mts +0 -5
  526. package/dist/api-contract-discovery/response-contract-symbols.mjs +0 -82
  527. package/dist/api-contract-discovery/response-contract-types.d.mts +0 -23
  528. package/dist/api-contract-discovery/response-contract-types.mjs +0 -1
  529. package/dist/api-contract-discovery/test-setup.test-helpers.d.mts +0 -3
  530. package/dist/api-contract-discovery/test-setup.test-helpers.mjs +0 -2
  531. /package/dist/{api-contract-discovery/header-contract-types.mjs → post-publication-inventory/readers/public-view-options.mjs} +0 -0
  532. /package/dist/{api-contract-discovery/query-contract-types.mjs → post-publication-inventory/readers/source-options.mjs} +0 -0
@@ -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,3 +0,0 @@
1
- import ts from '../contract-schema/typescript-api.mts';
2
- /** Excludes a sibling branch or a statement that cannot precede this anchor. */
3
- export declare function statusCanPrecede(setter: ts.Node, anchor: ts.Node): boolean;
@@ -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 {};
@@ -1,42 +0,0 @@
1
- import ts from '../contract-schema/typescript-api.mjs';
2
- import { hasRawBytes, indirectPayload, reflectApplyInvocation, writeAccess, } from './protocol-sse-write-resolution.mjs';
3
- /** Resolves direct and indirect SSE writes without losing their actual receiver. */
4
- export function sseWriteInvocation(call, checker) {
5
- const reflected = reflectApplyInvocation(call, checker);
6
- if (reflected)
7
- return reflected;
8
- const access = writeAccess(call.expression);
9
- if (!access)
10
- return undefined;
11
- if (access.method === 'pipe')
12
- return call.arguments[0]
13
- ? { receiver: call.arguments[0], method: 'write', rawBytes: true }
14
- : undefined;
15
- if (access.method === 'bind') {
16
- const target = writeAccess(access.receiver);
17
- if (target?.method !== 'write' && target?.method !== 'end')
18
- return undefined;
19
- return { receiver: call.arguments[0], method: target.method, rawBytes: true };
20
- }
21
- if (access.method !== 'call' && access.method !== 'apply')
22
- return { ...access, rawBytes: hasRawBytes(access.method, call.arguments, checker, false) };
23
- const target = writeAccess(access.receiver);
24
- const receiver = call.arguments[0];
25
- if (!receiver)
26
- return undefined;
27
- const payload = indirectPayload(access.method, call, checker);
28
- if (target?.method === 'pipe') {
29
- const destination = payload?.[0];
30
- return {
31
- receiver: destination,
32
- method: 'write',
33
- rawBytes: payload === undefined || destination !== undefined,
34
- };
35
- }
36
- const method = target?.method === 'write' || target?.method === 'end' ? target.method : undefined;
37
- return {
38
- receiver,
39
- method,
40
- rawBytes: payload === undefined || hasRawBytes(method, payload, checker, true),
41
- };
42
- }
@@ -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
- import { type WriteReceiver } from './protocol-write-receiver.mts';
4
- export declare function routeKey(binding: RouteBinding): string;
5
- export declare function opaqueCallReceivesSelectedStream(call: ts.CallExpression, selectedReceivers: readonly WriteReceiver[], binding: RouteBinding, calls: readonly ts.CallExpression[], checker: ts.TypeChecker, bindings: HandlerBindings): boolean;
6
- export declare function helperBindings(node: ts.Node, calls: readonly ts.CallExpression[], checker: ts.TypeChecker, bindings: HandlerBindings): RouteBinding[];
7
- export declare function actualReceivers(receiver: WriteReceiver, binding: RouteBinding, calls: readonly ts.CallExpression[], checker: ts.TypeChecker, bindings: HandlerBindings, active?: Set<ts.Symbol>): (WriteReceiver | undefined)[];
@@ -1,82 +0,0 @@
1
- import ts from '../contract-schema/typescript-api.mjs';
2
- import { hasBindingWrite } from './registered-route-binding-writes.mjs';
3
- import { createProtocolCallbackValueResolver } from './protocol-callback-values.mjs';
4
- import { runtimeParameters } from './registered-route-runtime-parameters.mjs';
5
- import { enclosingFunction } from './protocol-marker-analysis.mjs';
6
- import { executableProtocolPath } from './protocol-execution-path.mjs';
7
- import { enclosingRouteBinding, } from './response-contract-route-analysis.mjs';
8
- import { expressionReceiver, sameWriteReceiver, } from './protocol-write-receiver.mjs';
9
- export function routeKey(binding) {
10
- return `${binding.method}:${binding.routeTemplate}`;
11
- }
12
- function implementationDeclaration(declaration, checker) {
13
- if (!declaration)
14
- return undefined;
15
- if (ts.isArrowFunction(declaration) || ts.isFunctionExpression(declaration))
16
- return declaration;
17
- if (ts.isFunctionDeclaration(declaration) || ts.isMethodDeclaration(declaration)) {
18
- if (declaration.body)
19
- return declaration;
20
- const symbol = declaration.name && checker.getSymbolAtLocation(declaration.name);
21
- return symbol?.declarations?.find((candidate) => (ts.isFunctionDeclaration(candidate) || ts.isMethodDeclaration(candidate)) &&
22
- !!candidate.body);
23
- }
24
- return undefined;
25
- }
26
- function implementationCall(call, checker) {
27
- return (implementationDeclaration(checker.getResolvedSignature(call)?.declaration, checker) ??
28
- createProtocolCallbackValueResolver(checker).resolve(call.expression, new Map())?.node);
29
- }
30
- export function opaqueCallReceivesSelectedStream(call, selectedReceivers, binding, calls, checker, bindings) {
31
- const implementation = implementationCall(call, checker);
32
- if (implementation && ts.isFunctionLike(implementation) && 'body' in implementation)
33
- return false;
34
- const framed = selectedReceivers.flatMap((receiver) => actualReceivers(receiver, binding, calls, checker, bindings));
35
- return call.arguments.some((argument) => {
36
- const receiver = expressionReceiver(argument, checker);
37
- if (!receiver)
38
- return false;
39
- return actualReceivers(receiver, binding, calls, checker, bindings).some((value) => value === undefined ||
40
- framed.some((frame) => frame === undefined || sameWriteReceiver(frame, value)));
41
- });
42
- }
43
- export function helperBindings(node, calls, checker, bindings) {
44
- const fn = enclosingFunction(node);
45
- if (!fn || fn.asteriskToken)
46
- return [];
47
- return calls.flatMap((call) => {
48
- if (implementationCall(call, checker) !== fn || !executableProtocolPath(call, checker))
49
- return [];
50
- const binding = enclosingRouteBinding(call, checker, bindings, false);
51
- return binding ? [binding] : [];
52
- });
53
- }
54
- export function actualReceivers(receiver, binding, calls, checker, bindings, active = new Set()) {
55
- const declaration = receiver.root.valueDeclaration;
56
- if (receiver.mutableAlias ||
57
- (declaration &&
58
- (ts.isBindingElement(declaration) ||
59
- (ts.isVariableDeclaration(declaration) &&
60
- !(declaration.parent.flags & ts.NodeFlags.Const)) ||
61
- (ts.isParameter(declaration) && hasBindingWrite(declaration, checker)))))
62
- return [undefined];
63
- const fn = declaration && enclosingFunction(declaration);
64
- if (!declaration || !ts.isParameter(declaration) || !fn)
65
- return [receiver];
66
- if (active.has(receiver.root))
67
- return [undefined];
68
- const index = runtimeParameters(fn).indexOf(declaration);
69
- const actuals = calls.flatMap((call) => {
70
- if (implementationCall(call, checker) !== fn || !executableProtocolPath(call, checker))
71
- return [];
72
- const callBinding = enclosingRouteBinding(call, checker, bindings, false);
73
- if (!callBinding || routeKey(callBinding) !== routeKey(binding))
74
- return [];
75
- const argument = call.arguments[index] ?? declaration.initializer;
76
- const actual = argument && expressionReceiver(argument, checker);
77
- if (!actual || receiver.path.length)
78
- return [undefined];
79
- return actualReceivers(actual, binding, calls, checker, bindings, new Set(active).add(receiver.root));
80
- });
81
- return actuals.length ? actuals : [receiver];
82
- }
@@ -1,9 +0,0 @@
1
- import ts from '../contract-schema/typescript-api.mts';
2
- import { type WriteReceiver } from './protocol-write-receiver.mts';
3
- export type SseWriteMutation = {
4
- node: ts.Node;
5
- receiver: ts.Expression;
6
- };
7
- export declare function sseWriteMutation(node: ts.Node): SseWriteMutation | undefined;
8
- export declare function mutationAffectsSelectedStream(mutations: readonly SseWriteMutation[], frameReceivers: readonly WriteReceiver[], checker: ts.TypeChecker, isSameRoute: (node: ts.Node) => boolean, isInvokedHelper: (node: ts.Node) => boolean, resolveActual: (expression: ts.Expression) => readonly (WriteReceiver | undefined)[] | undefined, resolveFrame: (receiver: WriteReceiver) => readonly (WriteReceiver | undefined)[]): boolean;
9
- export declare function isSourceLevelMutation(node: ts.Node): boolean;
@@ -1,42 +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 { sameWriteReceiver } from './protocol-write-receiver.mjs';
6
- import { writeAccess } from './protocol-sse-write-resolution.mjs';
7
- export function sseWriteMutation(node) {
8
- if (ts.isBinaryExpression(node) && isAssignment(node.operatorToken.kind)) {
9
- const access = writeAccess(node.left);
10
- if (access && (access.method === 'write' || access.method === 'end'))
11
- return { node, receiver: access.receiver };
12
- }
13
- if (ts.isDeleteExpression(node)) {
14
- const access = writeAccess(node.expression);
15
- if (access && (access.method === 'write' || access.method === 'end'))
16
- return { node, receiver: access.receiver };
17
- }
18
- return undefined;
19
- }
20
- function isAssignment(kind) {
21
- return kind >= ts.SyntaxKind.FirstAssignment && kind <= ts.SyntaxKind.LastAssignment;
22
- }
23
- export function mutationAffectsSelectedStream(mutations, frameReceivers, checker, isSameRoute, isInvokedHelper, resolveActual, resolveFrame) {
24
- const framed = frameReceivers.flatMap(resolveFrame);
25
- return mutations.some(({ node, receiver }) => {
26
- if (!potentiallyExecuted(node) ||
27
- (!isSourceLevelMutation(node) &&
28
- !executableProtocolPath(node, checker) &&
29
- !opaqueProtocolCallbackPath(node, checker) &&
30
- !isInvokedHelper(node)) ||
31
- !isSameRoute(node))
32
- return false;
33
- const actual = resolveActual(receiver);
34
- if (!actual)
35
- return true;
36
- return actual.some((value) => value === undefined ||
37
- framed.some((frame) => frame === undefined || sameWriteReceiver(frame, value)));
38
- });
39
- }
40
- export function isSourceLevelMutation(node) {
41
- return ts.isExpressionStatement(node.parent) && ts.isSourceFile(node.parent.parent);
42
- }
@@ -1,14 +0,0 @@
1
- import ts from '../contract-schema/typescript-api.mts';
2
- export type WriteAccess = {
3
- receiver: ts.Expression;
4
- method: string | undefined;
5
- };
6
- export type WriteInvocation = {
7
- receiver: ts.Expression | undefined;
8
- method: string | undefined;
9
- rawBytes: boolean;
10
- };
11
- export declare function writeAccess(expression: ts.Expression): WriteAccess | undefined;
12
- export declare function reflectApplyInvocation(call: ts.CallExpression, checker: ts.TypeChecker): WriteInvocation | undefined;
13
- export declare function indirectPayload(method: 'call' | 'apply', call: ts.CallExpression, checker: ts.TypeChecker): readonly ts.Expression[] | undefined;
14
- export declare function hasRawBytes(method: string | undefined, payload: readonly ts.Expression[] | undefined, checker: ts.TypeChecker, indirect: boolean): boolean;