stitchkit 0.136.7 → 0.137.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/CHANGELOG.md +68 -0
- package/dist/agent-runtime/stores/branch-observations.d.ts +19 -19
- package/dist/agent-runtime/stores/schedule-contract.d.ts.map +1 -1
- package/dist/agent-runtime/stores/schedule-records.d.ts.map +1 -1
- package/dist/agent-runtime/stores/schedule-tools.d.ts.map +1 -1
- package/dist/agent-runtime/stores/sql-rows.d.ts +36 -36
- package/dist/agent-runtime/terminal-commit.d.ts +5 -5
- package/dist/agent-runtime/testing/store-conformance-lifecycle.d.ts +52 -52
- package/dist/agent-runtime/testing/store-conformance-support.d.ts +26 -26
- package/dist/browser/client-executors.d.ts +2 -3
- package/dist/browser/client-executors.d.ts.map +1 -1
- package/dist/browser/realtime-client.d.ts +6 -1
- package/dist/browser/realtime-client.d.ts.map +1 -1
- package/dist/browser/socket-io-client.d.ts.map +1 -1
- package/dist/browser/socket-io-contract.d.ts +2 -0
- package/dist/browser/socket-io-contract.d.ts.map +1 -1
- package/dist/contract/define-validation.d.ts +6 -0
- package/dist/contract/define-validation.d.ts.map +1 -1
- package/dist/contract/define.d.ts +1 -1
- package/dist/contract/define.d.ts.map +1 -1
- package/dist/contract/error-mapping.d.ts +71 -0
- package/dist/contract/error-mapping.d.ts.map +1 -0
- package/dist/contract/errors.d.ts +8 -0
- package/dist/contract/errors.d.ts.map +1 -1
- package/dist/contract/factory.d.ts +8 -0
- package/dist/contract/factory.d.ts.map +1 -1
- package/dist/contract/fragments.d.ts +45 -0
- package/dist/contract/fragments.d.ts.map +1 -0
- package/dist/contract/normalize.d.ts +6 -3
- package/dist/contract/normalize.d.ts.map +1 -1
- package/dist/contract/operation-read.d.ts +38 -0
- package/dist/contract/operation-read.d.ts.map +1 -0
- package/dist/contract/stream.d.ts.map +1 -1
- package/dist/contract/time-zone.d.ts +31 -0
- package/dist/contract/time-zone.d.ts.map +1 -0
- package/dist/contract/tool-options.d.ts +1 -1
- package/dist/contract/tool-options.d.ts.map +1 -1
- package/dist/device-relay/hub.d.ts +1 -1
- package/dist/device-relay/hub.d.ts.map +1 -1
- package/dist/entrypoints/agent-executor/acp.js +9 -9
- package/dist/entrypoints/agent-executor/claude-sdk.js +11 -11
- package/dist/entrypoints/agent-executor/claude.js +8 -8
- package/dist/entrypoints/agent-executor/codex.js +15 -15
- package/dist/entrypoints/agent-executor/testing.js +11 -11
- package/dist/entrypoints/agent-executor.js +14 -13
- package/dist/entrypoints/agent-runtime/ai-sdk.js +5 -5
- package/dist/entrypoints/agent-runtime/anthropic.js +1 -1
- package/dist/entrypoints/agent-runtime/browser.js +5 -5
- package/dist/entrypoints/agent-runtime/coding-tools.js +3 -3
- package/dist/entrypoints/agent-runtime/harness.js +14 -15
- package/dist/entrypoints/agent-runtime/openai.js +1 -1
- package/dist/entrypoints/agent-runtime/openrouter.js +7 -7
- package/dist/entrypoints/agent-runtime/postgres.js +5 -5
- package/dist/entrypoints/agent-runtime/realtime.js +8 -8
- package/dist/entrypoints/agent-runtime/sandbox.js +7 -7
- package/dist/entrypoints/agent-runtime/sqlite/bun.js +6 -6
- package/dist/entrypoints/agent-runtime/sqlite/node.js +6 -6
- package/dist/entrypoints/agent-runtime/testing.js +5 -5
- package/dist/entrypoints/agent-runtime.js +33 -29
- package/dist/entrypoints/application/diagnostic-journal.js +3 -3
- package/dist/entrypoints/application/directory-inbox.js +1 -1
- package/dist/entrypoints/application/grammy.js +1 -1
- package/dist/entrypoints/application/opentelemetry.js +2 -2
- package/dist/entrypoints/application.js +10 -10
- package/dist/entrypoints/cli/publish.d.ts +4 -4
- package/dist/entrypoints/cli/publish.d.ts.map +1 -1
- package/dist/entrypoints/cli/publish.js +160 -52
- package/dist/entrypoints/cli.d.ts +3 -1
- package/dist/entrypoints/cli.d.ts.map +1 -1
- package/dist/entrypoints/cli.js +520 -59
- package/dist/entrypoints/contract.d.ts +5 -1
- package/dist/entrypoints/contract.d.ts.map +1 -1
- package/dist/entrypoints/contract.js +25 -7
- package/dist/entrypoints/device-relay.js +20 -10
- package/dist/entrypoints/files/packaging.js +2 -2
- package/dist/entrypoints/files.js +10 -10
- package/dist/entrypoints/handler.d.ts +1 -1
- package/dist/entrypoints/handler.d.ts.map +1 -1
- package/dist/entrypoints/handler.js +12 -12
- package/dist/entrypoints/http.js +13 -12
- package/dist/entrypoints/index.js +36 -18
- package/dist/entrypoints/live.d.ts +2 -1
- package/dist/entrypoints/live.d.ts.map +1 -1
- package/dist/entrypoints/live.js +630 -1
- package/dist/entrypoints/node.d.ts +5 -0
- package/dist/entrypoints/node.d.ts.map +1 -1
- package/dist/entrypoints/node.js +36 -16
- package/dist/entrypoints/observability.js +25 -10
- package/dist/entrypoints/postgres.d.ts +4 -1
- package/dist/entrypoints/postgres.d.ts.map +1 -1
- package/dist/entrypoints/postgres.js +312 -0
- package/dist/entrypoints/primitives.js +11 -4
- package/dist/entrypoints/process.js +7 -7
- package/dist/entrypoints/react.js +1 -1
- package/dist/entrypoints/realtime.js +3 -3
- package/dist/entrypoints/remote.js +6 -29
- package/dist/entrypoints/server.d.ts +6 -1
- package/dist/entrypoints/server.d.ts.map +1 -1
- package/dist/entrypoints/server.js +93 -32
- package/dist/entrypoints/service-host/macos.js +6 -6
- package/dist/entrypoints/service-host/work.js +6 -6
- package/dist/entrypoints/service-host.js +10 -10
- package/dist/entrypoints/spend.js +2 -1
- package/dist/entrypoints/sync.js +5 -5
- package/dist/entrypoints/telegram.js +8 -8
- package/dist/entrypoints/testing.d.ts +1 -0
- package/dist/entrypoints/testing.d.ts.map +1 -1
- package/dist/entrypoints/testing.js +1501 -13
- package/dist/entrypoints/tools/agent.js +6 -7
- package/dist/entrypoints/tools/connections.js +9 -11
- package/dist/entrypoints/tools/contract.js +1 -2
- package/dist/entrypoints/tools/invoker.js +4 -5
- package/dist/entrypoints/tools/mcp.js +10 -11
- package/dist/entrypoints/tools/toolkit.d.ts +1 -1
- package/dist/entrypoints/tools/toolkit.d.ts.map +1 -1
- package/dist/entrypoints/tools/toolkit.js +29 -24
- package/dist/entrypoints/tools.js +28 -30
- package/dist/entrypoints/tracking/contract.js +2 -1
- package/dist/entrypoints/xlsx.js +5 -8
- package/dist/{index-033tyx59.js → index-0zw0hcyg.js} +4 -1
- package/dist/{index-zcq3dby3.js → index-1bjwfnnj.js} +1 -1
- package/dist/{index-f103md2v.js → index-1cfacbe2.js} +88 -23
- package/dist/{index-gj4wdts6.js → index-1ckh9qx1.js} +1 -1
- package/dist/index-1pvwmbxp.js +1435 -0
- package/dist/{index-0s75mjh7.js → index-2e4hdh32.js} +1 -1
- package/dist/{index-3shdhzt6.js → index-2j0pqxkn.js} +12 -6
- package/dist/index-3k8w02se.js +28 -0
- package/dist/{index-7fjbdga8.js → index-3pb4ccj2.js} +8 -0
- package/dist/{index-w7e402wx.js → index-48kb4gqq.js} +46 -7
- package/dist/{index-cv9b7fz2.js → index-6rws2xf5.js} +8 -0
- package/dist/{index-bbpygynk.js → index-77w5vx0g.js} +1 -1
- package/dist/index-7dz1ngaf.js +35 -0
- package/dist/{index-y68gavb5.js → index-7n4atsm4.js} +1 -1
- package/dist/index-8ef1bfea.js +71 -0
- package/dist/{index-0x4mnwg5.js → index-8k3y9nd4.js} +6 -9
- package/dist/{index-ezwsqyad.js → index-8rkdkefj.js} +40 -23
- package/dist/{index-3cwq5byx.js → index-9nax7tkn.js} +2 -2
- package/dist/{index-dz6tstcp.js → index-9r6emjwz.js} +1 -1
- package/dist/{index-32ew02z1.js → index-c4b7d6ej.js} +5 -5
- package/dist/index-ceshyndf.js +284 -0
- package/dist/{index-w161azza.js → index-d13rw31w.js} +6 -6
- package/dist/{index-1h0dtfz3.js → index-dmm7vs3f.js} +1 -1
- package/dist/{index-ypm85xwe.js → index-dp8j2e77.js} +1 -1
- package/dist/{index-qqd979f7.js → index-edycjvrv.js} +9 -9
- package/dist/{index-18qdpbcq.js → index-egpf9dv0.js} +200 -1479
- package/dist/{index-fatke81t.js → index-ezgvsj9w.js} +2 -2
- package/dist/{index-chapre0y.js → index-f3e7tj1g.js} +1 -1
- package/dist/{index-df5xr2f9.js → index-frsd2a94.js} +16 -1
- package/dist/index-fy9mmek1.js +95 -0
- package/dist/{index-2331y2tf.js → index-g0gvfzrx.js} +12 -12
- package/dist/index-gpe8d1ka.js +19 -0
- package/dist/{index-4p2zx593.js → index-gyw4qd0m.js} +1 -1
- package/dist/index-gzqy81tw.js +172 -0
- package/dist/{index-yrhw10ef.js → index-h34c510q.js} +8 -4
- package/dist/{index-rr94xcj6.js → index-h527p1yj.js} +10 -4
- package/dist/{index-qj0sq69b.js → index-hgf1tbgz.js} +76 -16
- package/dist/{index-smvmnz5y.js → index-hvpan32x.js} +1 -1
- package/dist/{index-4gbybjg6.js → index-hxawqrb6.js} +2 -2
- package/dist/{index-0k1ba0ss.js → index-j91jffhv.js} +1 -1
- package/dist/{index-d01akj5n.js → index-jr4kwetx.js} +8 -8
- package/dist/{index-xqppqn97.js → index-ka6z48zc.js} +315 -69
- package/dist/{index-by8w2461.js → index-kw0segzt.js} +104 -3
- package/dist/{index-6f4fjygr.js → index-m5t4dr7h.js} +29 -7
- package/dist/{index-afaq0nc4.js → index-n0egp1ke.js} +1 -1
- package/dist/{index-9fzjgg86.js → index-n74rb1dq.js} +2 -2
- package/dist/{index-dwq6a6sq.js → index-pt25vmhc.js} +33 -16
- package/dist/{index-vwg0n3e6.js → index-pyazb8q4.js} +23 -14
- package/dist/{index-5md04mwc.js → index-qpjjbkc5.js} +4 -4
- package/dist/{index-08a3qfr8.js → index-r1qt6zgj.js} +1 -1
- package/dist/{index-ctaxjpa4.js → index-r709pqed.js} +1 -1
- package/dist/{index-2zrx0nzv.js → index-rzc40z6e.js} +3 -5
- package/dist/{index-gq35s3bm.js → index-s5axtd56.js} +2 -2
- package/dist/{index-edpkm3k7.js → index-scpcps66.js} +669 -16
- package/dist/{index-ry8m2mhg.js → index-sf2mt6wj.js} +1 -1
- package/dist/{index-tjhhsnjv.js → index-t1213r0t.js} +1 -1
- package/dist/{index-gvgtmt7a.js → index-t7efje30.js} +2 -2
- package/dist/{index-w3s79kcb.js → index-tzyk36dy.js} +1 -1
- package/dist/{index-8tn10tp6.js → index-v64bvwjr.js} +1 -1
- package/dist/{index-1fhbe4e4.js → index-vksbsqpb.js} +1 -1
- package/dist/{index-dxft2mnm.js → index-wdg7bswj.js} +1 -1
- package/dist/{index-ppy23bd2.js → index-wjx1zs2r.js} +7 -578
- package/dist/{index-efbzm2se.js → index-x2r0ma9t.js} +1 -1
- package/dist/{index-kd48gk7d.js → index-x8py72a3.js} +1 -1
- package/dist/index-xvydbxmk.js +1404 -0
- package/dist/index-xwaphv0d.js +31 -0
- package/dist/{index-a09r9ff0.js → index-y44j39yk.js} +1 -1
- package/dist/{index-7mjsb7zv.js → index-ybrrxjhb.js} +1 -1
- package/dist/{index-xsrma0jd.js → index-ysthxsa8.js} +6 -6
- package/dist/{index-6p5pshcd.js → index-yyh3ey4b.js} +1 -1
- package/dist/{index-mr3njw67.js → index-z6hq9j8j.js} +1 -1
- package/dist/{index-67mzzkdv.js → index-z72agxdn.js} +2 -2
- package/dist/{index-e4w0sfm1.js → index-z78mtc16.js} +1 -1
- package/dist/{index-7csn6pva.js → index-ze94h4ph.js} +5 -0
- package/dist/internal/json-stringify.d.ts +12 -0
- package/dist/internal/json-stringify.d.ts.map +1 -1
- package/dist/internal/unix-client-error.d.ts +4 -0
- package/dist/internal/unix-client-error.d.ts.map +1 -1
- package/dist/live/watch-contract.d.ts +4 -0
- package/dist/live/watch-contract.d.ts.map +1 -1
- package/dist/live/watch-fanout-frame.d.ts +81 -0
- package/dist/live/watch-fanout-frame.d.ts.map +1 -0
- package/dist/live/watch-fanout.d.ts +57 -0
- package/dist/live/watch-fanout.d.ts.map +1 -0
- package/dist/observability/audit.d.ts.map +1 -1
- package/dist/observability/spool-core.d.ts +1 -0
- package/dist/observability/spool-core.d.ts.map +1 -1
- package/dist/observability/spool-drain.d.ts +48 -0
- package/dist/observability/spool-drain.d.ts.map +1 -0
- package/dist/observability/spool.d.ts +12 -6
- package/dist/observability/spool.d.ts.map +1 -1
- package/dist/postgres/connection-config.d.ts +54 -0
- package/dist/postgres/connection-config.d.ts.map +1 -0
- package/dist/postgres/rollback-transaction.d.ts +61 -0
- package/dist/postgres/rollback-transaction.d.ts.map +1 -0
- package/dist/primitives/deadline.d.ts +4 -4
- package/dist/primitives/deadline.d.ts.map +1 -1
- package/dist/server/error-hook.d.ts +3 -32
- package/dist/server/error-hook.d.ts.map +1 -1
- package/dist/server/local-consent-key.d.ts +104 -0
- package/dist/server/local-consent-key.d.ts.map +1 -0
- package/dist/server/local-control-journal.d.ts +51 -0
- package/dist/server/local-control-journal.d.ts.map +1 -0
- package/dist/server/local-control-reporter.d.ts +32 -0
- package/dist/server/local-control-reporter.d.ts.map +1 -0
- package/dist/server/local-control.d.ts +48 -0
- package/dist/server/local-control.d.ts.map +1 -0
- package/dist/server/local-host-clients.d.ts +105 -0
- package/dist/server/local-host-clients.d.ts.map +1 -0
- package/dist/server/middleware/trust-fence.d.ts +20 -0
- package/dist/server/middleware/trust-fence.d.ts.map +1 -1
- package/dist/spend/receipt-spool.d.ts +9 -4
- package/dist/spend/receipt-spool.d.ts.map +1 -1
- package/dist/testing/tool-surface-checks.d.ts +89 -0
- package/dist/testing/tool-surface-checks.d.ts.map +1 -0
- package/dist/testing/tool-surface-cli-callable.d.ts +63 -0
- package/dist/testing/tool-surface-cli-callable.d.ts.map +1 -0
- package/dist/testing/tool-surface-dead-refs.d.ts +32 -0
- package/dist/testing/tool-surface-dead-refs.d.ts.map +1 -0
- package/dist/testing/tool-surface-gates.d.ts +72 -0
- package/dist/testing/tool-surface-gates.d.ts.map +1 -0
- package/dist/testing/tool-surface-parity-drivers.d.ts +56 -0
- package/dist/testing/tool-surface-parity-drivers.d.ts.map +1 -0
- package/dist/testing/tool-surface-parity.d.ts +28 -0
- package/dist/testing/tool-surface-parity.d.ts.map +1 -0
- package/dist/testing/tool-surface-ratchet.d.ts +71 -0
- package/dist/testing/tool-surface-ratchet.d.ts.map +1 -0
- package/dist/tools/agent-tools.d.ts +3 -0
- package/dist/tools/agent-tools.d.ts.map +1 -1
- package/dist/tools/cli/command.d.ts +3 -0
- package/dist/tools/cli/command.d.ts.map +1 -1
- package/dist/tools/cli/create-cli.d.ts.map +1 -1
- package/dist/tools/cli/distribution-config.d.ts +39 -1
- package/dist/tools/cli/distribution-config.d.ts.map +1 -1
- package/dist/tools/cli/distribution-routes.d.ts +4 -2
- package/dist/tools/cli/distribution-routes.d.ts.map +1 -1
- package/dist/tools/cli/format.d.ts +3 -6
- package/dist/tools/cli/format.d.ts.map +1 -1
- package/dist/tools/cli/invoke.d.ts +4 -0
- package/dist/tools/cli/invoke.d.ts.map +1 -1
- package/dist/tools/cli/local-key-command.d.ts +53 -0
- package/dist/tools/cli/local-key-command.d.ts.map +1 -0
- package/dist/tools/cli/managed-surface.d.ts.map +1 -1
- package/dist/tools/cli/publication-contract.d.ts +9 -2
- package/dist/tools/cli/publication-contract.d.ts.map +1 -1
- package/dist/tools/cli/publication.d.ts.map +1 -1
- package/dist/tools/cli/run-managed.d.ts.map +1 -1
- package/dist/tools/cli/run-stream.d.ts.map +1 -1
- package/dist/tools/cli/runner.d.ts +8 -3
- package/dist/tools/cli/runner.d.ts.map +1 -1
- package/dist/tools/cli/secret.d.ts +55 -0
- package/dist/tools/cli/secret.d.ts.map +1 -0
- package/dist/tools/cli/session.d.ts +2 -2
- package/dist/tools/cli/session.d.ts.map +1 -1
- package/dist/tools/cli/signature.d.ts +23 -9
- package/dist/tools/cli/signature.d.ts.map +1 -1
- package/dist/tools/cli/stream.d.ts.map +1 -1
- package/dist/tools/cli/unix-outcome.d.ts +6 -0
- package/dist/tools/cli/unix-outcome.d.ts.map +1 -1
- package/dist/tools/cli/update.d.ts +6 -1
- package/dist/tools/cli/update.d.ts.map +1 -1
- package/dist/tools/execute-result.d.ts +20 -0
- package/dist/tools/execute-result.d.ts.map +1 -1
- package/dist/tools/execute.d.ts +3 -0
- package/dist/tools/execute.d.ts.map +1 -1
- package/dist/tools/internal/json-projection.d.ts +13 -9
- package/dist/tools/internal/json-projection.d.ts.map +1 -1
- package/dist/tools/internal/remote-error.d.ts +15 -0
- package/dist/tools/internal/remote-error.d.ts.map +1 -0
- package/dist/tools/internal/surface-projector.d.ts +2 -0
- package/dist/tools/internal/surface-projector.d.ts.map +1 -1
- package/dist/tools/invoker.d.ts +3 -0
- package/dist/tools/invoker.d.ts.map +1 -1
- package/dist/tools/mcp/handler.d.ts.map +1 -1
- package/dist/tools/mcp/lazy-discovery.d.ts +2 -0
- package/dist/tools/mcp/lazy-discovery.d.ts.map +1 -1
- package/dist/tools/mcp/mount.d.ts +5 -0
- package/dist/tools/mcp/mount.d.ts.map +1 -1
- package/dist/tools/mcp/register.d.ts +2 -0
- package/dist/tools/mcp/register.d.ts.map +1 -1
- package/dist/tools/mcp/runtime-tools.d.ts +2 -0
- package/dist/tools/mcp/runtime-tools.d.ts.map +1 -1
- package/dist/tools/mcp/stdio.d.ts.map +1 -1
- package/dist/tools/mount.d.ts +3 -0
- package/dist/tools/mount.d.ts.map +1 -1
- package/dist/tools/read-operation.d.ts +2 -6
- package/dist/tools/read-operation.d.ts.map +1 -1
- package/dist/tools/remote.d.ts.map +1 -1
- package/dist/tools/runtime-tool.d.ts.map +1 -1
- package/dist/tools/toolkit.d.ts +10 -3
- package/dist/tools/toolkit.d.ts.map +1 -1
- package/dist/xlsx/schema.d.ts.map +1 -1
- package/llms/cli-publish.txt +4 -1
- package/llms/cli.2.txt +42 -51
- package/llms/cli.3.txt +34 -1
- package/llms/cli.txt +18 -3
- package/llms/contract.txt +47 -5
- package/llms/handler.txt +1 -1
- package/llms/live.txt +82 -0
- package/llms/node.txt +5 -0
- package/llms/observability.2.txt +1 -1
- package/llms/observability.txt +6 -0
- package/llms/postgres.txt +14 -3
- package/llms/server.2.txt +206 -240
- package/llms/server.3.txt +242 -202
- package/llms/server.4.txt +202 -1025
- package/llms/server.5.txt +1053 -255
- package/llms/server.6.txt +274 -0
- package/llms/server.txt +32 -116
- package/llms/spend.txt +8 -7
- package/llms/stitchkit.2.txt +13 -35
- package/llms/stitchkit.3.txt +27 -0
- package/llms/stitchkit.txt +82 -82
- package/llms/testing.txt +40 -0
- package/llms/tools-toolkit.txt +2 -2
- package/llms/tools.2.txt +29 -20
- package/llms/{upgrading-0.128.0-0.129.0.txt → upgrading-0.128.0-0.131.0.txt} +101 -3
- package/llms/{upgrading-0.130.0-0.136.0.txt → upgrading-0.132.0-0.137.0.txt} +62 -101
- package/llms/upgrading.txt +2 -2
- package/llms-full.txt +641 -189
- package/llms.txt +14 -14
- package/package.json +3 -3
- package/dist/index-9118dw8d.js +0 -603
- package/dist/index-9vj869rx.js +0 -19
- package/dist/index-a1rjr381.js +0 -114
- package/dist/index-dacxr7nf.js +0 -17
- package/dist/index-dm50x3by.js +0 -63
- package/dist/index-dmrx8xma.js +0 -163
- package/dist/index-ednf2cxs.js +0 -37
- package/dist/{index-e4zt2x70.js → index-3czppvrr.js} +3 -3
- package/dist/{index-42n9jycn.js → index-3f79t32b.js} +3 -3
- package/dist/{index-mfe9a266.js → index-84n49vam.js} +0 -0
- package/dist/{index-f16b7rze.js → index-er1tp8de.js} +3 -3
- package/dist/{index-k137ezb6.js → index-f5d0fdcf.js} +3 -3
- package/dist/{index-65p8v81y.js → index-psz8qrz0.js} +3 -3
- package/dist/{index-kadgaw1s.js → index-r8cq86h1.js} +0 -0
- package/dist/{index-1yky29qg.js → index-tyyvbarf.js} +0 -0
- package/dist/{index-tjakdpf2.js → index-wq71v08n.js} +3 -3
- package/dist/{index-7an2fs5h.js → index-wswcpbm4.js} +3 -3
package/dist/entrypoints/node.js
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
|
-
import"../index-
|
|
2
|
-
import"../index-
|
|
1
|
+
import"../index-h34c510q.js";
|
|
2
|
+
import"../index-ybrrxjhb.js";
|
|
3
3
|
import"../index-m38ej7e5.js";
|
|
4
4
|
import"../index-yt1gg11x.js";
|
|
5
5
|
import {
|
|
6
6
|
createScopedImplementRegistry2,
|
|
7
7
|
implementRegistry2,
|
|
8
8
|
createImplementRegistry2,
|
|
9
|
+
extractReportedClient2,
|
|
10
|
+
LocalConsentKeyRequestSchema2,
|
|
11
|
+
createLocalConsentKeyIssuance2,
|
|
12
|
+
createLocalControlGuard2,
|
|
13
|
+
LocalControlJournalEntrySchema2,
|
|
14
|
+
createLocalControlJournal2,
|
|
9
15
|
createLocalHostGuard2,
|
|
16
|
+
DEFAULT_LOCAL_HOST_CLIENT_ID_HEADER2,
|
|
17
|
+
createLocalHostClients2,
|
|
10
18
|
bindProcessSignals2,
|
|
11
19
|
defineRequestIngress2,
|
|
12
|
-
createSocketIOServer2
|
|
13
|
-
|
|
14
|
-
} from "../index-ppy23bd2.js";
|
|
20
|
+
createSocketIOServer2
|
|
21
|
+
} from "../index-1pvwmbxp.js";
|
|
15
22
|
import {
|
|
16
23
|
ShutdownStateSchema2,
|
|
17
24
|
ShutdownOptionsSchema2,
|
|
@@ -19,30 +26,35 @@ import {
|
|
|
19
26
|
ShutdownResultSchema2,
|
|
20
27
|
createServerLifecycle
|
|
21
28
|
} from "../index-5xsxvk2x.js";
|
|
22
|
-
import"../index-
|
|
29
|
+
import"../index-j91jffhv.js";
|
|
23
30
|
import"../index-4s0fep5q.js";
|
|
24
31
|
import"../index-6kec3b14.js";
|
|
25
32
|
import"../index-673drwkn.js";
|
|
26
33
|
import"../index-2qnqvq11.js";
|
|
34
|
+
import"../index-kw0segzt.js";
|
|
27
35
|
import"../index-werjqesf.js";
|
|
28
|
-
import"../index-
|
|
29
|
-
import"../index-w7e402wx.js";
|
|
36
|
+
import"../index-48kb4gqq.js";
|
|
30
37
|
import"../index-xqhede6x.js";
|
|
31
|
-
import"../index-
|
|
32
|
-
import"../index-
|
|
38
|
+
import"../index-t7efje30.js";
|
|
39
|
+
import"../index-gpe8d1ka.js";
|
|
33
40
|
import {
|
|
34
41
|
bindRealtimeServer2
|
|
35
|
-
} from "../index-
|
|
42
|
+
} from "../index-7n4atsm4.js";
|
|
36
43
|
import {
|
|
37
44
|
createHandler2
|
|
38
|
-
} from "../index-
|
|
45
|
+
} from "../index-edycjvrv.js";
|
|
39
46
|
import {
|
|
40
47
|
createMultipartStream2,
|
|
41
48
|
implement2,
|
|
42
49
|
createImplement2,
|
|
43
50
|
createScopedImplement2
|
|
44
|
-
} from "../index-
|
|
45
|
-
import"../index-
|
|
51
|
+
} from "../index-s5axtd56.js";
|
|
52
|
+
import"../index-hxawqrb6.js";
|
|
53
|
+
import {
|
|
54
|
+
createUnixClientTransport2
|
|
55
|
+
} from "../index-wjx1zs2r.js";
|
|
56
|
+
import"../index-x8py72a3.js";
|
|
57
|
+
import"../index-8ef1bfea.js";
|
|
46
58
|
import {
|
|
47
59
|
AppError2,
|
|
48
60
|
notFound2,
|
|
@@ -51,10 +63,10 @@ import {
|
|
|
51
63
|
forbidden2,
|
|
52
64
|
conflict2,
|
|
53
65
|
rateLimited2
|
|
54
|
-
} from "../index-
|
|
66
|
+
} from "../index-3pb4ccj2.js";
|
|
55
67
|
import {
|
|
56
68
|
UnixClientTransportError2
|
|
57
|
-
} from "../index-
|
|
69
|
+
} from "../index-6rws2xf5.js";
|
|
58
70
|
// src/server/node.ts
|
|
59
71
|
import { serve } from "srvx/node";
|
|
60
72
|
|
|
@@ -286,6 +298,9 @@ async function createNodeSocketIOServer(config) {
|
|
|
286
298
|
}
|
|
287
299
|
export {
|
|
288
300
|
AppError2 as AppError,
|
|
301
|
+
DEFAULT_LOCAL_HOST_CLIENT_ID_HEADER2 as DEFAULT_LOCAL_HOST_CLIENT_ID_HEADER,
|
|
302
|
+
LocalConsentKeyRequestSchema2 as LocalConsentKeyRequestSchema,
|
|
303
|
+
LocalControlJournalEntrySchema2 as LocalControlJournalEntrySchema,
|
|
289
304
|
ShutdownOptionsSchema2 as ShutdownOptionsSchema,
|
|
290
305
|
ShutdownResultSchema2 as ShutdownResultSchema,
|
|
291
306
|
ShutdownStateSchema2 as ShutdownStateSchema,
|
|
@@ -298,6 +313,10 @@ export {
|
|
|
298
313
|
createHandler2 as createHandler,
|
|
299
314
|
createImplement2 as createImplement,
|
|
300
315
|
createImplementRegistry2 as createImplementRegistry,
|
|
316
|
+
createLocalConsentKeyIssuance2 as createLocalConsentKeyIssuance,
|
|
317
|
+
createLocalControlGuard2 as createLocalControlGuard,
|
|
318
|
+
createLocalControlJournal2 as createLocalControlJournal,
|
|
319
|
+
createLocalHostClients2 as createLocalHostClients,
|
|
301
320
|
createLocalHostGuard2 as createLocalHostGuard,
|
|
302
321
|
createMultipartStream2 as createMultipartStream,
|
|
303
322
|
createScopedImplement2 as createScopedImplement,
|
|
@@ -305,6 +324,7 @@ export {
|
|
|
305
324
|
createNodeSocketIOServer as createSocketIOServer,
|
|
306
325
|
createUnixClientTransport2 as createUnixClientTransport,
|
|
307
326
|
defineRequestIngress2 as defineRequestIngress,
|
|
327
|
+
extractReportedClient2 as extractReportedClient,
|
|
308
328
|
forbidden2 as forbidden,
|
|
309
329
|
implement2 as implement,
|
|
310
330
|
implementRegistry2 as implementRegistry,
|
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
assertDrainBound,
|
|
7
7
|
withinBound,
|
|
8
8
|
createBoundedSinkManager
|
|
9
|
-
} from "../index-
|
|
9
|
+
} from "../index-wswcpbm4.js";
|
|
10
10
|
import {
|
|
11
11
|
SpoolUnspooledError,
|
|
12
12
|
createSpoolCore
|
|
13
|
-
} from "../index-
|
|
13
|
+
} from "../index-ka6z48zc.js";
|
|
14
14
|
import {
|
|
15
15
|
redact2,
|
|
16
16
|
truncatePreview2,
|
|
@@ -20,6 +20,10 @@ import {
|
|
|
20
20
|
import {
|
|
21
21
|
isSecretQueryName
|
|
22
22
|
} from "../index-xrbrvn15.js";
|
|
23
|
+
import {
|
|
24
|
+
canonicalErrorFor,
|
|
25
|
+
canonicalErrorCodeFor
|
|
26
|
+
} from "../index-fy9mmek1.js";
|
|
23
27
|
import {
|
|
24
28
|
runWithRequestContext2,
|
|
25
29
|
getRequestContext2,
|
|
@@ -33,12 +37,12 @@ import {
|
|
|
33
37
|
} from "../index-q4tr9vnf.js";
|
|
34
38
|
import {
|
|
35
39
|
recordedErrorMessage
|
|
36
|
-
} from "../index-
|
|
40
|
+
} from "../index-pt25vmhc.js";
|
|
37
41
|
import {
|
|
38
42
|
DEFAULT_REPEAT_WINDOW_MS2,
|
|
39
43
|
DEFAULT_REPEAT_MAX_KINDS2,
|
|
40
44
|
repeatLimited2
|
|
41
|
-
} from "../index-
|
|
45
|
+
} from "../index-3f79t32b.js";
|
|
42
46
|
import {
|
|
43
47
|
errnoOf
|
|
44
48
|
} from "../index-jj9228tt.js";
|
|
@@ -50,12 +54,12 @@ import {
|
|
|
50
54
|
childSpan2,
|
|
51
55
|
resolvePropagationContext2
|
|
52
56
|
} from "../index-y7sy1xdp.js";
|
|
53
|
-
import {
|
|
54
|
-
assertPositiveSafeInteger
|
|
55
|
-
} from "../index-gr0kxymw.js";
|
|
56
57
|
import {
|
|
57
58
|
assertTimerMs
|
|
58
59
|
} from "../index-e1y74yra.js";
|
|
60
|
+
import {
|
|
61
|
+
assertPositiveSafeInteger
|
|
62
|
+
} from "../index-gr0kxymw.js";
|
|
59
63
|
import {
|
|
60
64
|
isRecord,
|
|
61
65
|
spooledRecord
|
|
@@ -90,14 +94,23 @@ function createDimensionsProjector(config) {
|
|
|
90
94
|
});
|
|
91
95
|
}
|
|
92
96
|
function toolErrorMessage(result) {
|
|
97
|
+
const canonical = canonicalErrorFor(result);
|
|
98
|
+
if (canonical !== undefined)
|
|
99
|
+
return canonical.message;
|
|
93
100
|
const { details, hint } = result;
|
|
94
101
|
if (isRecord(details) && typeof details.message === "string") {
|
|
95
102
|
return details.message;
|
|
96
103
|
}
|
|
97
104
|
return hint;
|
|
98
105
|
}
|
|
106
|
+
function toolErrorDetail(result) {
|
|
107
|
+
const canonical = canonicalErrorFor(result);
|
|
108
|
+
if (canonical !== undefined)
|
|
109
|
+
return canonical.details ?? { message: canonical.message };
|
|
110
|
+
return result.details;
|
|
111
|
+
}
|
|
99
112
|
function auditErrorMessage(result, thrown) {
|
|
100
|
-
return recordedErrorMessage(result.code, toolErrorMessage(result), thrown);
|
|
113
|
+
return recordedErrorMessage(canonicalErrorCodeFor(result, result.code), toolErrorMessage(result), thrown);
|
|
101
114
|
}
|
|
102
115
|
function readString(value) {
|
|
103
116
|
return typeof value === "string" ? value : undefined;
|
|
@@ -216,6 +229,7 @@ function createObservability(config) {
|
|
|
216
229
|
const measure = result.ok ? measureSize2(result.data) : { resultSize: null, responseBytes: 0 };
|
|
217
230
|
const mcp = context.source === "mcp" ? readMcpContext(context.mcp) : undefined;
|
|
218
231
|
const toolPhase = mcp?.outcome === "input_required" ? "input-round" : "operation";
|
|
232
|
+
const rawDetail = result.ok ? undefined : toolErrorDetail(result);
|
|
219
233
|
toolManager?.submit(() => ({
|
|
220
234
|
source: context.source,
|
|
221
235
|
kind: "request",
|
|
@@ -238,8 +252,8 @@ function createObservability(config) {
|
|
|
238
252
|
durationMs,
|
|
239
253
|
errorCode: result.ok ? undefined : result.code,
|
|
240
254
|
errorMessage: result.ok ? undefined : auditErrorMessage(result, error),
|
|
241
|
-
|
|
242
|
-
errorDetail: sanitizePayload2(
|
|
255
|
+
...rawDetail !== undefined && {
|
|
256
|
+
errorDetail: sanitizePayload2(rawDetail, toolConfig.sanitize)
|
|
243
257
|
},
|
|
244
258
|
payload: sanitizePayload2(args, toolConfig.sanitize),
|
|
245
259
|
resultSize: measure.resultSize,
|
|
@@ -647,6 +661,7 @@ function createSpooledSink(config) {
|
|
|
647
661
|
if (result.outcome === "unspooled")
|
|
648
662
|
throw new SpoolUnspooledError(result.storeError);
|
|
649
663
|
},
|
|
664
|
+
flush: () => core.flush(),
|
|
650
665
|
recover: () => core.recover(),
|
|
651
666
|
pending: () => core.pending()
|
|
652
667
|
};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `stitchkit/postgres` — peer-free helpers for PostgreSQL applications,
|
|
3
|
-
* including
|
|
3
|
+
* including safe `pg` / `PrismaPg` startup option merging (`TimeZone=UTC`, `search_path`,
|
|
4
|
+
* and URL `?options=`) and per-transaction serialization for Prisma SQL driver adapters.
|
|
4
5
|
*/
|
|
6
|
+
export { type PostgresConnectionConfig, type PostgresConnectionOptions, postgresConnectionConfig, } from '../postgres/connection-config.js';
|
|
7
|
+
export { type InteractiveTransactionClient, type PlannedRollback, type RollbackTransactionResult, runRollbackTransaction, type TransactionRollback, } from '../postgres/rollback-transaction.js';
|
|
5
8
|
export { type PrismaDriverAdapter, type PrismaDriverAdapterFactory, type PrismaDriverTransaction, withSerializedPrismaTransactions, } from '../postgres/serialize-prisma.js';
|
|
6
9
|
//# sourceMappingURL=postgres.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../../src/entrypoints/postgres.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../../src/entrypoints/postgres.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,wBAAwB,GACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,KAAK,4BAA4B,EACjC,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,sBAAsB,EACtB,KAAK,mBAAmB,GACzB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,gCAAgC,GACjC,MAAM,8BAA8B,CAAC"}
|
|
@@ -1,3 +1,313 @@
|
|
|
1
|
+
// src/postgres/connection-config.ts
|
|
2
|
+
var CONTROL_CHAR_PATTERN = /[\u0000-\u001f\u007f]/;
|
|
3
|
+
var ALLOWED_PROTOCOLS = new Set(["postgres:", "postgresql:", "socket:"]);
|
|
4
|
+
var EMPTY_HOST_WITH_CREDS = /^([a-zA-Z][a-zA-Z0-9+.-]*:\/\/[^/?#]*@)\//;
|
|
5
|
+
var TIME_ZONE_PATTERN = /^[A-Za-z0-9_+-][A-Za-z0-9_./+:,-]{0,127}$/;
|
|
6
|
+
var SEARCH_PATH_ITEM_PATTERN = /^(?:\$user|"\$user"|[A-Za-z_][A-Za-z0-9_$]{0,62}|"(?:[^"\\\s]|""){1,63}")$/;
|
|
7
|
+
var PARAMETER_NAME_PATTERN = /^[A-Za-z_][A-Za-z0-9_]{0,62}(?:\.[A-Za-z_][A-Za-z0-9_]{0,62})?$/;
|
|
8
|
+
var RESERVED_PARAMETERS = new Set(["timezone", "search_path"]);
|
|
9
|
+
function isPlainObject(value) {
|
|
10
|
+
if (typeof value !== "object" || value === null)
|
|
11
|
+
return false;
|
|
12
|
+
const proto = Object.getPrototypeOf(value);
|
|
13
|
+
return proto === Object.prototype || proto === null;
|
|
14
|
+
}
|
|
15
|
+
function parseAndStripConnectionString(raw) {
|
|
16
|
+
if (typeof raw !== "string" || raw.length === 0 || raw !== raw.trim() || CONTROL_CHAR_PATTERN.test(raw)) {
|
|
17
|
+
throw new TypeError("postgresConnectionConfig received an invalid PostgreSQL connectionString");
|
|
18
|
+
}
|
|
19
|
+
if (raw.startsWith("/")) {
|
|
20
|
+
return { connectionString: raw, urlOptions: [] };
|
|
21
|
+
}
|
|
22
|
+
const candidateUrl = EMPTY_HOST_WITH_CREDS.test(raw) ? raw.replace(EMPTY_HOST_WITH_CREDS, "$1___stitchkit_empty_host___/") : raw;
|
|
23
|
+
let parsed;
|
|
24
|
+
try {
|
|
25
|
+
parsed = new URL(candidateUrl);
|
|
26
|
+
} catch {
|
|
27
|
+
throw new TypeError("postgresConnectionConfig received an invalid PostgreSQL connectionString");
|
|
28
|
+
}
|
|
29
|
+
if (!ALLOWED_PROTOCOLS.has(parsed.protocol)) {
|
|
30
|
+
throw new TypeError("postgresConnectionConfig connectionString must use postgres://, postgresql://, or socket:");
|
|
31
|
+
}
|
|
32
|
+
if (parsed.protocol === "socket:") {
|
|
33
|
+
if (parsed.pathname.length === 0) {
|
|
34
|
+
throw new TypeError("postgresConnectionConfig socket: connectionString must include a socket path");
|
|
35
|
+
}
|
|
36
|
+
} else if (!raw.slice(parsed.protocol.length).startsWith("//")) {
|
|
37
|
+
throw new TypeError("postgresConnectionConfig connectionString must use an authority-form postgres:// or postgresql:// URL");
|
|
38
|
+
}
|
|
39
|
+
const hashIndex = raw.indexOf("#");
|
|
40
|
+
const withoutHash = hashIndex === -1 ? raw : raw.slice(0, hashIndex);
|
|
41
|
+
const hashPart = hashIndex === -1 ? "" : raw.slice(hashIndex);
|
|
42
|
+
const queryIndex = withoutHash.indexOf("?");
|
|
43
|
+
if (queryIndex === -1) {
|
|
44
|
+
return { connectionString: raw, urlOptions: [] };
|
|
45
|
+
}
|
|
46
|
+
const beforeQuery = withoutHash.slice(0, queryIndex);
|
|
47
|
+
const rawQuery = withoutHash.slice(queryIndex + 1);
|
|
48
|
+
const segments = rawQuery.split("&");
|
|
49
|
+
const keptSegments = [];
|
|
50
|
+
const urlOptions = [];
|
|
51
|
+
let strippedAny = false;
|
|
52
|
+
for (const segment of segments) {
|
|
53
|
+
const params = new URLSearchParams(`&${segment}`);
|
|
54
|
+
if (params.has("options")) {
|
|
55
|
+
strippedAny = true;
|
|
56
|
+
for (const value of params.getAll("options")) {
|
|
57
|
+
urlOptions.push(value);
|
|
58
|
+
}
|
|
59
|
+
} else {
|
|
60
|
+
keptSegments.push(segment);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (!strippedAny) {
|
|
64
|
+
return { connectionString: raw, urlOptions: [] };
|
|
65
|
+
}
|
|
66
|
+
const remaining = keptSegments.filter((segment) => segment.length > 0);
|
|
67
|
+
const connectionString = remaining.length > 0 ? `${beforeQuery}?${remaining.join("&")}${hashPart}` : `${beforeQuery}${hashPart}`;
|
|
68
|
+
return { connectionString, urlOptions };
|
|
69
|
+
}
|
|
70
|
+
function normalizeRawOptionFragment(raw, source) {
|
|
71
|
+
if (CONTROL_CHAR_PATTERN.test(raw)) {
|
|
72
|
+
throw new TypeError(`postgresConnectionConfig ${source} must not contain control characters`);
|
|
73
|
+
}
|
|
74
|
+
const tokens = [];
|
|
75
|
+
let current = "";
|
|
76
|
+
let inToken = false;
|
|
77
|
+
let escaping = false;
|
|
78
|
+
let start = -1;
|
|
79
|
+
let end = -1;
|
|
80
|
+
for (let i = 0;i < raw.length; i += 1) {
|
|
81
|
+
const ch = raw[i];
|
|
82
|
+
if (ch === undefined)
|
|
83
|
+
break;
|
|
84
|
+
if (escaping) {
|
|
85
|
+
current += ch;
|
|
86
|
+
escaping = false;
|
|
87
|
+
end = i + 1;
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (ch === "\\") {
|
|
91
|
+
if (!inToken) {
|
|
92
|
+
inToken = true;
|
|
93
|
+
if (start === -1)
|
|
94
|
+
start = i;
|
|
95
|
+
}
|
|
96
|
+
escaping = true;
|
|
97
|
+
end = i + 1;
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (ch === " ") {
|
|
101
|
+
if (inToken) {
|
|
102
|
+
tokens.push(current);
|
|
103
|
+
current = "";
|
|
104
|
+
inToken = false;
|
|
105
|
+
}
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
if (/\s/.test(ch)) {
|
|
109
|
+
throw new TypeError(`postgresConnectionConfig ${source} contains unsupported whitespace characters`);
|
|
110
|
+
}
|
|
111
|
+
if (!inToken) {
|
|
112
|
+
inToken = true;
|
|
113
|
+
if (start === -1)
|
|
114
|
+
start = i;
|
|
115
|
+
}
|
|
116
|
+
current += ch;
|
|
117
|
+
end = i + 1;
|
|
118
|
+
}
|
|
119
|
+
if (escaping) {
|
|
120
|
+
throw new TypeError(`postgresConnectionConfig ${source} must not end with an unescaped backslash`);
|
|
121
|
+
}
|
|
122
|
+
if (inToken) {
|
|
123
|
+
tokens.push(current);
|
|
124
|
+
}
|
|
125
|
+
if (tokens.length === 0)
|
|
126
|
+
return;
|
|
127
|
+
if (tokens.includes("--")) {
|
|
128
|
+
throw new TypeError(`postgresConnectionConfig ${source} must not contain a standalone "--" option terminator`);
|
|
129
|
+
}
|
|
130
|
+
if (tokens[tokens.length - 1] === "-c") {
|
|
131
|
+
throw new TypeError(`postgresConnectionConfig ${source} must not end with an incomplete "-c" flag`);
|
|
132
|
+
}
|
|
133
|
+
return raw.slice(start, end);
|
|
134
|
+
}
|
|
135
|
+
function formatTimeZoneFlag(value) {
|
|
136
|
+
if (value === null)
|
|
137
|
+
return;
|
|
138
|
+
const timeZone = value === undefined ? "UTC" : value;
|
|
139
|
+
if (typeof timeZone !== "string" || timeZone.includes("..") || !TIME_ZONE_PATTERN.test(timeZone)) {
|
|
140
|
+
throw new TypeError("postgresConnectionConfig options.timeZone must be a valid PostgreSQL time zone name, UTC offset, or null");
|
|
141
|
+
}
|
|
142
|
+
return `-c TimeZone=${timeZone}`;
|
|
143
|
+
}
|
|
144
|
+
function formatSearchPathFlag(value) {
|
|
145
|
+
if (value === undefined)
|
|
146
|
+
return;
|
|
147
|
+
let items;
|
|
148
|
+
if (typeof value === "string") {
|
|
149
|
+
if (CONTROL_CHAR_PATTERN.test(value)) {
|
|
150
|
+
throw new TypeError("postgresConnectionConfig options.searchPath must not contain control characters");
|
|
151
|
+
}
|
|
152
|
+
items = value.split(",").map((part) => part.trim());
|
|
153
|
+
} else if (Array.isArray(value)) {
|
|
154
|
+
if (value.length === 0) {
|
|
155
|
+
throw new TypeError("postgresConnectionConfig options.searchPath must not be empty");
|
|
156
|
+
}
|
|
157
|
+
items = [];
|
|
158
|
+
for (const entry of value) {
|
|
159
|
+
if (typeof entry !== "string" || entry.length === 0 || entry !== entry.trim() || entry.includes(",") || CONTROL_CHAR_PATTERN.test(entry)) {
|
|
160
|
+
throw new TypeError("postgresConnectionConfig options.searchPath entries must be valid trimmed schema names without commas");
|
|
161
|
+
}
|
|
162
|
+
items.push(entry);
|
|
163
|
+
}
|
|
164
|
+
} else {
|
|
165
|
+
throw new TypeError("postgresConnectionConfig options.searchPath must be a string or an array of schema names");
|
|
166
|
+
}
|
|
167
|
+
for (const item of items) {
|
|
168
|
+
if (item.length === 0 || CONTROL_CHAR_PATTERN.test(item) || !SEARCH_PATH_ITEM_PATTERN.test(item)) {
|
|
169
|
+
throw new TypeError(`postgresConnectionConfig options.searchPath contains an invalid schema identifier: ${item}`);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return `-c search_path=${items.join(",")}`;
|
|
173
|
+
}
|
|
174
|
+
function formatParameterFlags(value) {
|
|
175
|
+
if (value === undefined)
|
|
176
|
+
return [];
|
|
177
|
+
if (!isPlainObject(value)) {
|
|
178
|
+
throw new TypeError("postgresConnectionConfig options.parameters must be a plain object");
|
|
179
|
+
}
|
|
180
|
+
const seen = new Set;
|
|
181
|
+
const flags = [];
|
|
182
|
+
for (const [name, paramValue] of Object.entries(value)) {
|
|
183
|
+
if (!PARAMETER_NAME_PATTERN.test(name)) {
|
|
184
|
+
throw new TypeError(`postgresConnectionConfig options.parameters contains an invalid parameter name: ${name}`);
|
|
185
|
+
}
|
|
186
|
+
const normalized = name.toLowerCase();
|
|
187
|
+
if (RESERVED_PARAMETERS.has(normalized)) {
|
|
188
|
+
throw new TypeError(`postgresConnectionConfig options.parameters forbids "${name}"; use the dedicated timeZone or searchPath option`);
|
|
189
|
+
}
|
|
190
|
+
if (seen.has(normalized)) {
|
|
191
|
+
throw new TypeError(`postgresConnectionConfig options.parameters contains duplicate parameter "${name}"`);
|
|
192
|
+
}
|
|
193
|
+
seen.add(normalized);
|
|
194
|
+
if (typeof paramValue !== "string" || paramValue.length === 0 || CONTROL_CHAR_PATTERN.test(paramValue) || /\s/.test(paramValue) || paramValue.includes("\\")) {
|
|
195
|
+
throw new TypeError(`postgresConnectionConfig options.parameters.${name} must be a non-empty string without whitespace, backslashes, or control characters`);
|
|
196
|
+
}
|
|
197
|
+
flags.push(`-c ${name}=${paramValue}`);
|
|
198
|
+
}
|
|
199
|
+
return flags;
|
|
200
|
+
}
|
|
201
|
+
function resolveConnectionConfig(rest, rawConnectionString, rawConfigOptions, options) {
|
|
202
|
+
if (options !== undefined && !isPlainObject(options)) {
|
|
203
|
+
throw new TypeError("postgresConnectionConfig options must be a plain object");
|
|
204
|
+
}
|
|
205
|
+
const { connectionString, urlOptions } = parseAndStripConnectionString(rawConnectionString);
|
|
206
|
+
const parts = [];
|
|
207
|
+
for (const fragment of urlOptions) {
|
|
208
|
+
const normalized = normalizeRawOptionFragment(fragment, "URL options");
|
|
209
|
+
if (normalized !== undefined)
|
|
210
|
+
parts.push(normalized);
|
|
211
|
+
}
|
|
212
|
+
if (rawConfigOptions !== undefined) {
|
|
213
|
+
if (typeof rawConfigOptions !== "string") {
|
|
214
|
+
throw new TypeError("postgresConnectionConfig config.options must be a string");
|
|
215
|
+
}
|
|
216
|
+
const normalized = normalizeRawOptionFragment(rawConfigOptions, "config.options");
|
|
217
|
+
if (normalized !== undefined)
|
|
218
|
+
parts.push(normalized);
|
|
219
|
+
}
|
|
220
|
+
for (const flag of formatParameterFlags(options?.parameters)) {
|
|
221
|
+
parts.push(flag);
|
|
222
|
+
}
|
|
223
|
+
const searchPathFlag = formatSearchPathFlag(options?.searchPath);
|
|
224
|
+
if (searchPathFlag !== undefined)
|
|
225
|
+
parts.push(searchPathFlag);
|
|
226
|
+
const timeZoneFlag = formatTimeZoneFlag(options?.timeZone);
|
|
227
|
+
if (timeZoneFlag !== undefined)
|
|
228
|
+
parts.push(timeZoneFlag);
|
|
229
|
+
const mergedOptions = parts.length > 0 ? parts.join(" ") : undefined;
|
|
230
|
+
return {
|
|
231
|
+
...rest,
|
|
232
|
+
connectionString,
|
|
233
|
+
...mergedOptions !== undefined && { options: mergedOptions }
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
function postgresConnectionConfig(input, options) {
|
|
237
|
+
if (typeof input === "string") {
|
|
238
|
+
return resolveConnectionConfig(undefined, input, undefined, options);
|
|
239
|
+
}
|
|
240
|
+
if (!isPlainObject(input)) {
|
|
241
|
+
throw new TypeError("postgresConnectionConfig expects a connection string or a plain config object");
|
|
242
|
+
}
|
|
243
|
+
const { connectionString: rawUrl, options: rawConfigOptions, ...rest } = input;
|
|
244
|
+
return resolveConnectionConfig(rest, rawUrl, rawConfigOptions, options);
|
|
245
|
+
}
|
|
246
|
+
// src/postgres/rollback-transaction.ts
|
|
247
|
+
var rollbackTokens = new WeakMap;
|
|
248
|
+
|
|
249
|
+
class PlannedRollbackSignal extends Error {
|
|
250
|
+
token;
|
|
251
|
+
constructor(token) {
|
|
252
|
+
super("Planned transaction rollback");
|
|
253
|
+
this.token = token;
|
|
254
|
+
this.name = "PlannedRollbackSignal";
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
async function runRollbackTransaction(client, work, options) {
|
|
258
|
+
if (typeof client !== "object" || client === null || typeof client.$transaction !== "function") {
|
|
259
|
+
throw new TypeError("[stitchkit] runRollbackTransaction: client must expose a $transaction(fn, options?) method");
|
|
260
|
+
}
|
|
261
|
+
if (typeof work !== "function") {
|
|
262
|
+
throw new TypeError("[stitchkit] runRollbackTransaction: work must be a function");
|
|
263
|
+
}
|
|
264
|
+
const invocationToken = Symbol("stitchkit.plannedRollback");
|
|
265
|
+
let rolledBack;
|
|
266
|
+
const runInsideTransaction = async (tx) => {
|
|
267
|
+
rolledBack = undefined;
|
|
268
|
+
let settled = false;
|
|
269
|
+
let rollbackCalled = false;
|
|
270
|
+
const rollback = (value) => {
|
|
271
|
+
if (settled) {
|
|
272
|
+
throw new Error("[stitchkit] runRollbackTransaction: rollback() cannot be called after the transaction callback has settled");
|
|
273
|
+
}
|
|
274
|
+
rollbackCalled = true;
|
|
275
|
+
const marker = Object.freeze({
|
|
276
|
+
__stitchkitPlannedRollback: true,
|
|
277
|
+
value
|
|
278
|
+
});
|
|
279
|
+
rollbackTokens.set(marker, { token: invocationToken, value });
|
|
280
|
+
return marker;
|
|
281
|
+
};
|
|
282
|
+
let result;
|
|
283
|
+
try {
|
|
284
|
+
result = await work(tx, rollback);
|
|
285
|
+
} finally {
|
|
286
|
+
settled = true;
|
|
287
|
+
}
|
|
288
|
+
const record = typeof result === "object" && result !== null ? rollbackTokens.get(result) : undefined;
|
|
289
|
+
if (record !== undefined && record.token === invocationToken) {
|
|
290
|
+
rolledBack = { value: record.value };
|
|
291
|
+
throw new PlannedRollbackSignal(invocationToken);
|
|
292
|
+
}
|
|
293
|
+
if (rollbackCalled) {
|
|
294
|
+
throw new TypeError("[stitchkit] runRollbackTransaction: rollback() was called without returning its token; transaction rolled back");
|
|
295
|
+
}
|
|
296
|
+
return result;
|
|
297
|
+
};
|
|
298
|
+
try {
|
|
299
|
+
const committedValue = options === undefined ? await client.$transaction(runInsideTransaction) : await client.$transaction(runInsideTransaction, options);
|
|
300
|
+
if (rolledBack !== undefined) {
|
|
301
|
+
throw new Error("[stitchkit] runRollbackTransaction: transaction client swallowed PlannedRollbackSignal instead of rolling back");
|
|
302
|
+
}
|
|
303
|
+
return { committed: true, value: committedValue };
|
|
304
|
+
} catch (error) {
|
|
305
|
+
if (error instanceof PlannedRollbackSignal && error.token === invocationToken && rolledBack !== undefined) {
|
|
306
|
+
return { committed: false, value: rolledBack.value };
|
|
307
|
+
}
|
|
308
|
+
throw error;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
1
311
|
// src/postgres/serialize-prisma.ts
|
|
2
312
|
var CONNECT_FACTORY_METHODS = new Set([
|
|
3
313
|
"connect",
|
|
@@ -130,5 +440,7 @@ function withSerializedPrismaTransactions(adapter) {
|
|
|
130
440
|
return proxy;
|
|
131
441
|
}
|
|
132
442
|
export {
|
|
443
|
+
postgresConnectionConfig,
|
|
444
|
+
runRollbackTransaction,
|
|
133
445
|
withSerializedPrismaTransactions
|
|
134
446
|
};
|
|
@@ -2,6 +2,9 @@ import {
|
|
|
2
2
|
CanonicalJsonError2,
|
|
3
3
|
canonicalJson2
|
|
4
4
|
} from "../index-brhhaygm.js";
|
|
5
|
+
import {
|
|
6
|
+
canonicalizeIanaTimeZone2
|
|
7
|
+
} from "../index-gpe8d1ka.js";
|
|
5
8
|
import {
|
|
6
9
|
parseDecimal,
|
|
7
10
|
formatDecimal,
|
|
@@ -163,19 +166,23 @@ function calendarDayKey(value, timeZone) {
|
|
|
163
166
|
return Date.UTC(parts.year, parts.month - 1, parts.day) / DAY_MS;
|
|
164
167
|
}
|
|
165
168
|
function defineDeadlinePolicy(config) {
|
|
166
|
-
|
|
169
|
+
const canonicalTimeZone = canonicalizeIanaTimeZone2(config.timeZone);
|
|
170
|
+
if (canonicalTimeZone === null) {
|
|
171
|
+
throw new RangeError(`Invalid IANA timeZone: ${config.timeZone}`);
|
|
172
|
+
}
|
|
167
173
|
if (!Number.isSafeInteger(config.warningDays) || config.warningDays < 0) {
|
|
168
174
|
throw new RangeError("warningDays must be a non-negative safe integer");
|
|
169
175
|
}
|
|
170
|
-
const
|
|
176
|
+
const definition = { ...config, timeZone: canonicalTimeZone };
|
|
177
|
+
const addDays = (value, days) => config.boundary === "calendar-day" ? addCalendarDays(value, days, canonicalTimeZone) : new Date(value.getTime() + days * DAY_MS);
|
|
171
178
|
return Object.freeze({
|
|
172
|
-
definition
|
|
179
|
+
definition,
|
|
173
180
|
evaluate(input) {
|
|
174
181
|
if (!Number.isSafeInteger(input.durationDays) || input.durationDays < 0) {
|
|
175
182
|
throw new RangeError("durationDays must be a non-negative safe integer");
|
|
176
183
|
}
|
|
177
184
|
const dueAt = addDays(input.anchorAt, input.durationDays);
|
|
178
|
-
const remainingDays = config.boundary === "calendar-day" ? calendarDayKey(dueAt,
|
|
185
|
+
const remainingDays = config.boundary === "calendar-day" ? calendarDayKey(dueAt, canonicalTimeZone) - calendarDayKey(input.now, canonicalTimeZone) : Math.ceil((dueAt.getTime() - input.now.getTime()) / DAY_MS);
|
|
179
186
|
const category = remainingDays < 0 ? config.categories.overdue : remainingDays <= config.warningDays ? config.categories.warning : config.categories.onTrack;
|
|
180
187
|
return DeadlineResultSchema.parse({
|
|
181
188
|
dueAt: dueAt.toISOString(),
|
|
@@ -7,29 +7,29 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
NativeCommandError2
|
|
9
9
|
} from "../index-tgehj4bp.js";
|
|
10
|
-
import"../index-
|
|
10
|
+
import"../index-wq71v08n.js";
|
|
11
11
|
import {
|
|
12
12
|
ContractStreamErrorSchema
|
|
13
|
-
} from "../index-
|
|
13
|
+
} from "../index-h34c510q.js";
|
|
14
14
|
import {
|
|
15
15
|
streamNativeCommand2
|
|
16
|
-
} from "../index-
|
|
16
|
+
} from "../index-dmm7vs3f.js";
|
|
17
17
|
import {
|
|
18
18
|
runNativeCommand2
|
|
19
|
-
} from "../index-
|
|
19
|
+
} from "../index-n0egp1ke.js";
|
|
20
20
|
import {
|
|
21
21
|
normalizeError2
|
|
22
|
-
} from "../index-
|
|
22
|
+
} from "../index-pt25vmhc.js";
|
|
23
23
|
import {
|
|
24
24
|
StreamLineLimitError2,
|
|
25
25
|
readBoundedUtf8Lines
|
|
26
|
-
} from "../index-
|
|
26
|
+
} from "../index-84n49vam.js";
|
|
27
27
|
import {
|
|
28
28
|
safeJsonParse
|
|
29
29
|
} from "../index-zsarb5xp.js";
|
|
30
30
|
import {
|
|
31
31
|
AppError2
|
|
32
|
-
} from "../index-
|
|
32
|
+
} from "../index-3pb4ccj2.js";
|
|
33
33
|
import {
|
|
34
34
|
assertPositiveSafeInteger
|
|
35
35
|
} from "../index-gr0kxymw.js";
|
|
@@ -14,16 +14,16 @@ import {
|
|
|
14
14
|
RealtimeRequestTimeoutError2,
|
|
15
15
|
RealtimeRequestDisconnectedError2
|
|
16
16
|
} from "../index-4s0fep5q.js";
|
|
17
|
-
import"../index-
|
|
17
|
+
import"../index-j91jffhv.js";
|
|
18
18
|
import {
|
|
19
19
|
createRetainedTopics2,
|
|
20
20
|
TerminalPeerLoadError,
|
|
21
21
|
createRealtimeClientWithPeer,
|
|
22
22
|
createSocketIOClientWithPeer
|
|
23
|
-
} from "../index-
|
|
23
|
+
} from "../index-h527p1yj.js";
|
|
24
24
|
import {
|
|
25
25
|
bindRealtimeClient2
|
|
26
|
-
} from "../index-
|
|
26
|
+
} from "../index-0zw0hcyg.js";
|
|
27
27
|
import {
|
|
28
28
|
assertTimerMs
|
|
29
29
|
} from "../index-e1y74yra.js";
|