@lovrozagar/honey 0.7.2 → 1.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +36 -1969
- package/bin/honey.js +87 -27
- package/dist/adapters/bun/serve.d.ts +18 -0
- package/dist/adapters/bun/serve.js +89 -0
- package/dist/adapters/fetch-request.d.ts +20 -0
- package/dist/adapters/fetch-request.js +29 -0
- package/dist/adapters/node/headers.d.ts +27 -0
- package/dist/adapters/node/headers.js +86 -0
- package/dist/adapters/node/request.d.ts +16 -0
- package/dist/adapters/node/request.js +214 -0
- package/dist/adapters/node/response.d.ts +11 -0
- package/dist/adapters/node/response.js +126 -0
- package/dist/adapters/node/serve.d.ts +39 -0
- package/dist/adapters/node/serve.js +205 -0
- package/dist/adapters/node/url.d.ts +13 -0
- package/dist/adapters/node/url.js +87 -0
- package/dist/adapters/serve.d.ts +36 -0
- package/dist/adapters/serve.js +52 -0
- package/dist/build/artifacts.d.ts +34 -0
- package/dist/build/artifacts.js +123 -0
- package/dist/build/cli-args.d.ts +30 -0
- package/dist/build/cli-args.js +97 -0
- package/dist/build/cli.d.ts +11 -0
- package/dist/build/cli.js +150 -0
- package/dist/build/config.d.ts +102 -0
- package/dist/build/config.js +89 -0
- package/dist/build/generate.d.ts +19 -0
- package/dist/build/generate.js +80 -0
- package/dist/build/glob.d.ts +8 -0
- package/dist/build/glob.js +97 -0
- package/dist/build/index.d.ts +3 -58
- package/dist/build/index.js +3 -173
- package/dist/build/init.d.ts +3 -0
- package/dist/build/init.js +131 -0
- package/dist/build/loaders.d.ts +33 -0
- package/dist/build/loaders.js +105 -0
- package/dist/build/plugin.d.ts +52 -0
- package/dist/build/plugin.js +146 -0
- package/dist/build/source.d.ts +21 -0
- package/dist/build/source.js +100 -0
- package/dist/build/targets.d.ts +59 -0
- package/dist/build/targets.js +107 -0
- package/dist/context/context.d.ts +111 -0
- package/dist/context/context.js +213 -0
- package/dist/context/cookie-sign.d.ts +38 -0
- package/dist/context/cookie-sign.js +113 -0
- package/dist/context/cookie.d.ts +28 -0
- package/dist/context/cookie.js +142 -0
- package/dist/context/peer.d.ts +34 -0
- package/dist/context/peer.js +190 -0
- package/dist/errors/error.d.ts +60 -0
- package/dist/errors/error.js +84 -0
- package/dist/errors/errors.d.ts +45 -0
- package/dist/errors/errors.js +31 -0
- package/dist/errors/on-error.d.ts +10 -0
- package/dist/errors/on-error.js +204 -0
- package/dist/errors/problem-json.d.ts +14 -0
- package/dist/errors/problem-json.js +58 -0
- package/dist/errors/projector.d.ts +50 -0
- package/dist/errors/projector.js +107 -0
- package/dist/i18n/error-i18n.d.ts +26 -0
- package/dist/i18n/error-i18n.js +77 -0
- package/dist/i18n/i18n.d.ts +21 -0
- package/dist/i18n/i18n.js +40 -0
- package/dist/i18n/icu.d.ts +29 -0
- package/dist/i18n/icu.js +170 -0
- package/dist/i18n/index.d.ts +4 -0
- package/dist/i18n/index.js +3 -0
- package/dist/index.d.ts +30 -744
- package/dist/index.js +12 -2363
- package/dist/input/accepts.d.ts +5 -0
- package/dist/input/accepts.js +105 -0
- package/dist/input/binary.d.ts +20 -0
- package/dist/input/binary.js +40 -0
- package/dist/input/body-kind.d.ts +15 -0
- package/dist/input/body-kind.js +47 -0
- package/dist/input/body-limit.d.ts +21 -0
- package/dist/input/body-limit.js +99 -0
- package/dist/input/cookies.d.ts +7 -0
- package/dist/input/cookies.js +8 -0
- package/dist/input/form.d.ts +10 -0
- package/dist/input/form.js +24 -0
- package/dist/input/headers.d.ts +7 -0
- package/dist/input/headers.js +8 -0
- package/dist/input/input.d.ts +91 -0
- package/dist/input/input.js +88 -0
- package/dist/input/json.d.ts +10 -0
- package/dist/input/json.js +22 -0
- package/dist/input/params.d.ts +7 -0
- package/dist/input/params.js +8 -0
- package/dist/input/query.d.ts +10 -0
- package/dist/input/query.js +17 -0
- package/dist/mcp/mount.d.ts +116 -0
- package/dist/mcp/mount.js +45 -0
- package/dist/mcp/oauth.d.ts +14 -0
- package/dist/mcp/oauth.js +88 -0
- package/dist/mcp/uploads.d.ts +36 -0
- package/dist/mcp/uploads.js +171 -0
- package/dist/mcp/url-files.d.ts +32 -0
- package/dist/mcp/url-files.js +75 -0
- package/dist/meta/meta-spec-apply.d.ts +25 -0
- package/dist/meta/meta-spec-apply.js +83 -0
- package/dist/meta/meta-spec-merge.d.ts +103 -0
- package/dist/meta/meta-spec-merge.js +50 -0
- package/dist/meta/meta-spec-validate.d.ts +61 -0
- package/dist/meta/meta-spec-validate.js +166 -0
- package/dist/meta/meta-spec.d.ts +49 -0
- package/dist/meta/meta-spec.js +197 -0
- package/dist/middleware/compress.d.ts +15 -0
- package/dist/middleware/compress.js +93 -0
- package/dist/middleware/cors.d.ts +18 -0
- package/dist/middleware/cors.js +80 -0
- package/dist/middleware/csrf.d.ts +11 -0
- package/dist/middleware/csrf.js +65 -0
- package/dist/middleware/ip-restrict.d.ts +10 -0
- package/dist/middleware/ip-restrict.js +82 -0
- package/dist/middleware/middleware.d.ts +53 -0
- package/dist/middleware/middleware.js +112 -0
- package/dist/middleware/powered-by.d.ts +6 -0
- package/dist/middleware/powered-by.js +13 -0
- package/dist/middleware/rate-limit.d.ts +40 -0
- package/dist/middleware/rate-limit.js +90 -0
- package/dist/middleware/request-id.d.ts +25 -0
- package/dist/middleware/request-id.js +30 -0
- package/dist/middleware/secure-headers.d.ts +18 -0
- package/dist/middleware/secure-headers.js +36 -0
- package/dist/middleware/server-timing.d.ts +8 -0
- package/dist/middleware/server-timing.js +52 -0
- package/dist/middleware/timeout.d.ts +6 -0
- package/dist/middleware/timeout.js +29 -0
- package/dist/observability/curl-logger.d.ts +46 -0
- package/dist/observability/curl-logger.js +175 -0
- package/dist/observability/request-to-curl.d.ts +17 -0
- package/dist/observability/request-to-curl.js +47 -0
- package/dist/openapi/collect.d.ts +56 -18
- package/dist/openapi/collect.js +109 -23
- package/dist/openapi/components.d.ts +9 -0
- package/dist/openapi/components.js +90 -0
- package/dist/openapi/docs-page.d.ts +20 -18
- package/dist/openapi/docs-page.js +28 -46
- package/dist/openapi/document.d.ts +33 -26
- package/dist/openapi/document.js +21 -776
- package/dist/openapi/extract-schemas.d.ts +11 -0
- package/dist/openapi/extract-schemas.js +31 -0
- package/dist/openapi/generate.d.ts +47 -0
- package/dist/openapi/generate.js +180 -0
- package/dist/openapi/manifest.d.ts +41 -0
- package/dist/openapi/manifest.js +49 -0
- package/dist/openapi/output-keys.d.ts +6 -0
- package/dist/openapi/output-keys.js +24 -0
- package/dist/openapi/paths.d.ts +35 -0
- package/dist/openapi/paths.js +175 -0
- package/dist/openapi/register.d.ts +14 -3
- package/dist/openapi/register.js +13 -20
- package/dist/openapi/responses.d.ts +44 -0
- package/dist/openapi/responses.js +159 -0
- package/dist/openapi/scalar.d.ts +4 -14
- package/dist/openapi/scalar.js +5 -7
- package/dist/openapi/security.d.ts +4 -0
- package/dist/openapi/security.js +25 -0
- package/dist/openapi/serve.d.ts +25 -9
- package/dist/openapi/serve.js +108 -29
- package/dist/openapi/servers.d.ts +19 -0
- package/dist/openapi/servers.js +72 -0
- package/dist/openapi/swagger.d.ts +4 -14
- package/dist/openapi/swagger.js +5 -7
- package/dist/openapi/tags.d.ts +20 -0
- package/dist/openapi/tags.js +20 -0
- package/dist/openapi/webhooks.d.ts +19 -0
- package/dist/openapi/webhooks.js +70 -0
- package/dist/openapi/yaml.d.ts +8 -0
- package/dist/openapi/yaml.js +74 -0
- package/dist/proxy/headers.d.ts +30 -0
- package/dist/proxy/headers.js +86 -0
- package/dist/proxy/proxy.d.ts +39 -0
- package/dist/proxy/proxy.js +103 -0
- package/dist/proxy/upstream.d.ts +30 -0
- package/dist/proxy/upstream.js +116 -0
- package/dist/realtime/bus.d.ts +10 -13
- package/dist/realtime/bus.js +48 -93
- package/dist/realtime/invoke-user.d.ts +36 -0
- package/dist/realtime/invoke-user.js +103 -0
- package/dist/realtime/realtime.d.ts +7 -0
- package/dist/realtime/realtime.js +40 -0
- package/dist/realtime/route.d.ts +33 -27
- package/dist/realtime/route.js +27 -43
- package/dist/realtime/server.d.ts +24 -28
- package/dist/realtime/server.js +202 -225
- package/dist/response/binary.d.ts +18 -0
- package/dist/response/binary.js +10 -0
- package/dist/response/builder.d.ts +73 -0
- package/dist/response/builder.js +214 -0
- package/dist/response/cache-control.d.ts +30 -0
- package/dist/response/cache-control.js +74 -0
- package/dist/response/etag.d.ts +15 -0
- package/dist/response/etag.js +83 -0
- package/dist/response/media-type.d.ts +28 -0
- package/dist/response/media-type.js +97 -0
- package/dist/response/out-headers.d.ts +31 -0
- package/dist/response/out-headers.js +130 -0
- package/dist/response/pretty-json.d.ts +10 -0
- package/dist/response/pretty-json.js +44 -0
- package/dist/response/range.d.ts +19 -0
- package/dist/response/range.js +98 -0
- package/dist/response/response-headers.d.ts +11 -0
- package/dist/response/response-headers.js +21 -0
- package/dist/response/response.d.ts +69 -0
- package/dist/response/response.js +208 -0
- package/dist/response/sse.d.ts +41 -0
- package/dist/response/sse.js +73 -0
- package/dist/response/static.d.ts +20 -0
- package/dist/response/static.js +181 -0
- package/dist/response/status.d.ts +5 -0
- package/dist/response/status.js +68 -0
- package/dist/response/with-headers.d.ts +11 -0
- package/dist/response/with-headers.js +47 -0
- package/dist/routing/app-types.d.ts +181 -0
- package/dist/routing/app-types.js +1 -0
- package/dist/routing/app.d.ts +76 -0
- package/dist/routing/app.js +137 -0
- package/dist/routing/codegen-types.d.ts +17 -0
- package/dist/routing/codegen-types.js +1 -0
- package/dist/routing/delegate.d.ts +9 -0
- package/dist/routing/delegate.js +75 -0
- package/dist/routing/dispatch.d.ts +22 -0
- package/dist/routing/dispatch.js +255 -0
- package/dist/routing/finalize.d.ts +47 -0
- package/dist/routing/finalize.js +169 -0
- package/dist/routing/gateway-tree.d.ts +19 -0
- package/dist/routing/gateway-tree.js +74 -0
- package/dist/routing/invalidate-check.d.ts +58 -0
- package/dist/routing/invalidate-check.js +124 -0
- package/dist/routing/match.d.ts +22 -0
- package/dist/routing/match.js +108 -0
- package/dist/routing/middleware-chain.d.ts +16 -0
- package/dist/routing/middleware-chain.js +41 -0
- package/dist/routing/output-types.d.ts +91 -0
- package/dist/routing/output-types.js +1 -0
- package/dist/routing/pattern.d.ts +55 -0
- package/dist/routing/pattern.js +219 -0
- package/dist/routing/record.d.ts +18 -0
- package/dist/routing/record.js +4 -0
- package/dist/routing/register.d.ts +135 -0
- package/dist/routing/register.js +155 -0
- package/dist/routing/request-path.d.ts +30 -0
- package/dist/routing/request-path.js +173 -0
- package/dist/routing/route-builder.d.ts +160 -0
- package/dist/routing/route-builder.js +86 -0
- package/dist/routing/route-tree.d.ts +18 -0
- package/dist/routing/route-tree.js +91 -0
- package/dist/routing/settings-chain.d.ts +75 -0
- package/dist/routing/settings-chain.js +137 -0
- package/dist/routing/settings.d.ts +90 -0
- package/dist/routing/settings.js +44 -0
- package/dist/routing/tap.d.ts +31 -0
- package/dist/routing/tap.js +77 -0
- package/dist/routing/tree-merge.d.ts +7 -0
- package/dist/routing/tree-merge.js +77 -0
- package/dist/routing/tree.d.ts +85 -0
- package/dist/routing/tree.js +196 -0
- package/dist/routing/types.d.ts +20 -0
- package/dist/routing/types.js +1 -0
- package/dist/routing/ws-builder.d.ts +62 -0
- package/dist/routing/ws-builder.js +109 -0
- package/dist/runtime/detect-runtime.d.ts +16 -0
- package/dist/runtime/detect-runtime.js +11 -0
- package/dist/runtime/optional-peer.d.ts +10 -0
- package/dist/runtime/optional-peer.js +19 -0
- package/dist/schema/arktype.d.ts +7 -0
- package/dist/schema/arktype.js +13 -0
- package/dist/schema/canonicalize.d.ts +8 -0
- package/dist/schema/canonicalize.js +19 -0
- package/dist/schema/effect.d.ts +7 -0
- package/dist/schema/effect.js +4 -0
- package/dist/schema/naming.d.ts +31 -0
- package/dist/schema/naming.js +116 -0
- package/dist/schema/sanitize-spec.d.ts +15 -0
- package/dist/schema/sanitize-spec.js +43 -0
- package/dist/schema/slots.d.ts +15 -0
- package/dist/schema/slots.js +179 -0
- package/dist/schema/to-json-schema.d.ts +34 -0
- package/dist/schema/to-json-schema.js +94 -0
- package/dist/schema/valibot.d.ts +4 -0
- package/dist/schema/valibot.js +153 -0
- package/dist/schema/yup.d.ts +3 -0
- package/dist/schema/yup.js +57 -0
- package/dist/schema/zod.d.ts +6 -0
- package/dist/schema/zod.js +192 -0
- package/dist/security/crypto.d.ts +7 -0
- package/dist/security/crypto.js +30 -0
- package/dist/streaming/producer-stream.d.ts +45 -0
- package/dist/streaming/producer-stream.js +251 -0
- package/dist/telemetry/fields.d.ts +43 -0
- package/dist/telemetry/fields.js +64 -0
- package/dist/telemetry/log-format.d.ts +7 -0
- package/dist/telemetry/log-format.js +43 -0
- package/dist/telemetry/logger.d.ts +44 -0
- package/dist/telemetry/logger.js +122 -0
- package/dist/telemetry/otel-subpath.d.ts +7 -0
- package/dist/telemetry/otel-subpath.js +5 -0
- package/dist/telemetry/otel.d.ts +50 -57
- package/dist/telemetry/otel.js +54 -130
- package/dist/telemetry/request-log.d.ts +22 -0
- package/dist/telemetry/request-log.js +83 -0
- package/dist/telemetry/request-trace.d.ts +123 -0
- package/dist/telemetry/request-trace.js +199 -0
- package/dist/telemetry/span-lifecycle.d.ts +11 -0
- package/dist/telemetry/span-lifecycle.js +114 -0
- package/dist/telemetry/traceparent.d.ts +40 -0
- package/dist/telemetry/traceparent.js +73 -0
- package/dist/testing/testing.d.ts +42 -0
- package/dist/testing/testing.js +101 -0
- package/dist/validation/content-type.d.ts +21 -0
- package/dist/validation/content-type.js +42 -0
- package/dist/validation/standard-schema.d.ts +41 -0
- package/dist/validation/standard-schema.js +5 -0
- package/dist/validation/validate-input.d.ts +45 -0
- package/dist/validation/validate-input.js +174 -0
- package/dist/validation/validate-output.d.ts +34 -0
- package/dist/validation/validate-output.js +107 -0
- package/dist/ws/bun.d.ts +30 -25
- package/dist/ws/bun.js +42 -46
- package/dist/ws/cloudflare.d.ts +6 -75
- package/dist/ws/cloudflare.js +37 -104
- package/dist/ws/contract.d.ts +74 -0
- package/dist/ws/contract.js +83 -0
- package/dist/ws/node.d.ts +12 -21
- package/dist/ws/node.js +103 -151
- package/dist/ws/origin.d.ts +23 -0
- package/dist/ws/origin.js +48 -0
- package/dist/ws/route.d.ts +14 -0
- package/dist/ws/route.js +5 -0
- package/dist/ws/session.d.ts +15 -6
- package/dist/ws/session.js +22 -23
- package/dist/ws/shared.d.ts +23 -33
- package/dist/ws/shared.js +53 -39
- package/package.json +169 -251
- package/dist/accepts.d.ts +0 -12
- package/dist/accepts.d.ts.map +0 -1
- package/dist/accepts.js +0 -126
- package/dist/accepts.js.map +0 -1
- package/dist/body-kind.d.ts +0 -26
- package/dist/body-kind.d.ts.map +0 -1
- package/dist/body-kind.js +0 -70
- package/dist/body-kind.js.map +0 -1
- package/dist/body-limit.d.ts +0 -26
- package/dist/body-limit.d.ts.map +0 -1
- package/dist/body-limit.js +0 -126
- package/dist/body-limit.js.map +0 -1
- package/dist/build/index.d.ts.map +0 -1
- package/dist/build/index.js.map +0 -1
- package/dist/cli-args.d.ts +0 -33
- package/dist/cli-args.d.ts.map +0 -1
- package/dist/cli-args.js +0 -102
- package/dist/cli-args.js.map +0 -1
- package/dist/cli-go/auth.go +0 -26
- package/dist/cli-go/config.go +0 -192
- package/dist/cli-go/errors.go +0 -75
- package/dist/cli-go/multipart.go +0 -79
- package/dist/cli-go/output.go +0 -163
- package/dist/cli-go/root.go +0 -30
- package/dist/cli-go/stream.go +0 -88
- package/dist/cli-go/version.go +0 -5
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -209
- package/dist/cli.js.map +0 -1
- package/dist/client/defaults.d.ts +0 -12
- package/dist/client/defaults.d.ts.map +0 -1
- package/dist/client/defaults.js +0 -48
- package/dist/client/defaults.js.map +0 -1
- package/dist/client/error.d.ts +0 -49
- package/dist/client/error.d.ts.map +0 -1
- package/dist/client/error.js +0 -71
- package/dist/client/error.js.map +0 -1
- package/dist/client/http.d.ts +0 -155
- package/dist/client/http.d.ts.map +0 -1
- package/dist/client/http.js +0 -571
- package/dist/client/http.js.map +0 -1
- package/dist/client/index.d.ts +0 -23
- package/dist/client/index.d.ts.map +0 -1
- package/dist/client/index.js +0 -95
- package/dist/client/index.js.map +0 -1
- package/dist/client/path.d.ts +0 -26
- package/dist/client/path.d.ts.map +0 -1
- package/dist/client/path.js +0 -163
- package/dist/client/path.js.map +0 -1
- package/dist/client/redirect-policy.d.ts +0 -12
- package/dist/client/redirect-policy.d.ts.map +0 -1
- package/dist/client/redirect-policy.js +0 -20
- package/dist/client/redirect-policy.js.map +0 -1
- package/dist/client/sdk.d.ts +0 -70
- package/dist/client/sdk.d.ts.map +0 -1
- package/dist/client/sdk.js +0 -292
- package/dist/client/sdk.js.map +0 -1
- package/dist/client/sse.d.ts +0 -23
- package/dist/client/sse.d.ts.map +0 -1
- package/dist/client/sse.js +0 -129
- package/dist/client/sse.js.map +0 -1
- package/dist/client/types.d.ts +0 -124
- package/dist/client/types.d.ts.map +0 -1
- package/dist/client/types.js +0 -2
- package/dist/client/types.js.map +0 -1
- package/dist/client/ws.d.ts +0 -22
- package/dist/client/ws.d.ts.map +0 -1
- package/dist/client/ws.js +0 -112
- package/dist/client/ws.js.map +0 -1
- package/dist/client-go/errors.go +0 -236
- package/dist/client-go/export.go +0 -44
- package/dist/client-go/invalidation.go +0 -371
- package/dist/client-go/nullable.go +0 -62
- package/dist/client-go/realtime.go +0 -354
- package/dist/client-go/result.go +0 -20
- package/dist/client-go/runtime.go +0 -975
- package/dist/client-go/sse.go +0 -159
- package/dist/client-go/transport.go +0 -495
- package/dist/client-go/ws.go +0 -128
- package/dist/client-info.d.ts +0 -36
- package/dist/client-info.d.ts.map +0 -1
- package/dist/client-info.js +0 -53
- package/dist/client-info.js.map +0 -1
- package/dist/client-mcp/README.md +0 -10
- package/dist/client-mcp/server.ts +0 -221
- package/dist/client-mcp/types.ts +0 -19
- package/dist/client-python/_errors.py +0 -115
- package/dist/client-python/_invalidation.py +0 -494
- package/dist/client-python/_realtime.py +0 -179
- package/dist/client-python/_runtime.py +0 -860
- package/dist/client-python/_sse.py +0 -155
- package/dist/client-python/_transport.py +0 -366
- package/dist/client-python/_ws.py +0 -159
- package/dist/client-python/py.typed +0 -0
- package/dist/client-rust/errors.rs +0 -220
- package/dist/client-rust/invalidation.rs +0 -412
- package/dist/client-rust/invalidation_sync.rs +0 -93
- package/dist/client-rust/nullable.rs +0 -17
- package/dist/client-rust/realtime.rs +0 -702
- package/dist/client-rust/result.rs +0 -22
- package/dist/client-rust/runtime.rs +0 -980
- package/dist/client-rust/runtime_sync.rs +0 -484
- package/dist/client-rust/sse.rs +0 -188
- package/dist/client-rust/ws.rs +0 -167
- package/dist/codegen-go-cli.d.ts +0 -22
- package/dist/codegen-go-cli.d.ts.map +0 -1
- package/dist/codegen-go-cli.js +0 -964
- package/dist/codegen-go-cli.js.map +0 -1
- package/dist/codegen-go.d.ts +0 -41
- package/dist/codegen-go.d.ts.map +0 -1
- package/dist/codegen-go.js +0 -872
- package/dist/codegen-go.js.map +0 -1
- package/dist/codegen-hash.d.ts +0 -3
- package/dist/codegen-hash.d.ts.map +0 -1
- package/dist/codegen-hash.js +0 -9
- package/dist/codegen-hash.js.map +0 -1
- package/dist/codegen-ir.d.ts +0 -190
- package/dist/codegen-ir.d.ts.map +0 -1
- package/dist/codegen-ir.js +0 -661
- package/dist/codegen-ir.js.map +0 -1
- package/dist/codegen-lang.d.ts +0 -65
- package/dist/codegen-lang.d.ts.map +0 -1
- package/dist/codegen-lang.js +0 -526
- package/dist/codegen-lang.js.map +0 -1
- package/dist/codegen-load.d.ts +0 -31
- package/dist/codegen-load.d.ts.map +0 -1
- package/dist/codegen-load.js +0 -138
- package/dist/codegen-load.js.map +0 -1
- package/dist/codegen-loaders.d.ts +0 -12
- package/dist/codegen-loaders.d.ts.map +0 -1
- package/dist/codegen-loaders.js +0 -55
- package/dist/codegen-loaders.js.map +0 -1
- package/dist/codegen-mcp.d.ts +0 -13
- package/dist/codegen-mcp.d.ts.map +0 -1
- package/dist/codegen-mcp.js +0 -368
- package/dist/codegen-mcp.js.map +0 -1
- package/dist/codegen-python.d.ts +0 -33
- package/dist/codegen-python.d.ts.map +0 -1
- package/dist/codegen-python.js +0 -828
- package/dist/codegen-python.js.map +0 -1
- package/dist/codegen-route-tree-intern.d.ts +0 -40
- package/dist/codegen-route-tree-intern.d.ts.map +0 -1
- package/dist/codegen-route-tree-intern.js +0 -221
- package/dist/codegen-route-tree-intern.js.map +0 -1
- package/dist/codegen-rust.d.ts +0 -18
- package/dist/codegen-rust.d.ts.map +0 -1
- package/dist/codegen-rust.js +0 -1293
- package/dist/codegen-rust.js.map +0 -1
- package/dist/codegen-sanitize.d.ts +0 -3
- package/dist/codegen-sanitize.d.ts.map +0 -1
- package/dist/codegen-sanitize.js +0 -56
- package/dist/codegen-sanitize.js.map +0 -1
- package/dist/codegen-schema-naming.d.ts +0 -27
- package/dist/codegen-schema-naming.d.ts.map +0 -1
- package/dist/codegen-schema-naming.js +0 -150
- package/dist/codegen-schema-naming.js.map +0 -1
- package/dist/codegen-sdk-model.d.ts +0 -71
- package/dist/codegen-sdk-model.d.ts.map +0 -1
- package/dist/codegen-sdk-model.js +0 -179
- package/dist/codegen-sdk-model.js.map +0 -1
- package/dist/codegen.d.ts +0 -187
- package/dist/codegen.d.ts.map +0 -1
- package/dist/codegen.js +0 -4619
- package/dist/codegen.js.map +0 -1
- package/dist/context.d.ts +0 -86
- package/dist/context.d.ts.map +0 -1
- package/dist/context.js +0 -242
- package/dist/context.js.map +0 -1
- package/dist/cookie-sign.d.ts +0 -17
- package/dist/cookie-sign.d.ts.map +0 -1
- package/dist/cookie-sign.js +0 -104
- package/dist/cookie-sign.js.map +0 -1
- package/dist/cookie.d.ts +0 -24
- package/dist/cookie.d.ts.map +0 -1
- package/dist/cookie.js +0 -138
- package/dist/cookie.js.map +0 -1
- package/dist/cors.d.ts +0 -14
- package/dist/cors.d.ts.map +0 -1
- package/dist/cors.js +0 -87
- package/dist/cors.js.map +0 -1
- package/dist/crypto.d.ts +0 -7
- package/dist/crypto.d.ts.map +0 -1
- package/dist/crypto.js +0 -38
- package/dist/crypto.js.map +0 -1
- package/dist/csrf.d.ts +0 -28
- package/dist/csrf.d.ts.map +0 -1
- package/dist/csrf.js +0 -79
- package/dist/csrf.js.map +0 -1
- package/dist/curl-logger.d.ts +0 -44
- package/dist/curl-logger.d.ts.map +0 -1
- package/dist/curl-logger.js +0 -199
- package/dist/curl-logger.js.map +0 -1
- package/dist/detect-runtime.d.ts +0 -16
- package/dist/detect-runtime.d.ts.map +0 -1
- package/dist/detect-runtime.js +0 -13
- package/dist/detect-runtime.js.map +0 -1
- package/dist/dict.d.ts +0 -11
- package/dist/dict.d.ts.map +0 -1
- package/dist/dict.js +0 -13
- package/dist/dict.js.map +0 -1
- package/dist/error.d.ts +0 -21
- package/dist/error.d.ts.map +0 -1
- package/dist/error.js +0 -44
- package/dist/error.js.map +0 -1
- package/dist/errors.d.ts +0 -40
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -39
- package/dist/errors.js.map +0 -1
- package/dist/etag.d.ts +0 -11
- package/dist/etag.d.ts.map +0 -1
- package/dist/etag.js +0 -82
- package/dist/etag.js.map +0 -1
- package/dist/feature-detect.d.ts +0 -25
- package/dist/feature-detect.d.ts.map +0 -1
- package/dist/feature-detect.js +0 -144
- package/dist/feature-detect.js.map +0 -1
- package/dist/feature-load.d.ts +0 -3
- package/dist/feature-load.d.ts.map +0 -1
- package/dist/feature-load.js +0 -36
- package/dist/feature-load.js.map +0 -1
- package/dist/feature-slots.d.ts +0 -44
- package/dist/feature-slots.d.ts.map +0 -1
- package/dist/feature-slots.js +0 -48
- package/dist/feature-slots.js.map +0 -1
- package/dist/fetch-request.d.ts +0 -10
- package/dist/fetch-request.d.ts.map +0 -1
- package/dist/fetch-request.js +0 -13
- package/dist/fetch-request.js.map +0 -1
- package/dist/gen-process.d.ts +0 -15
- package/dist/gen-process.d.ts.map +0 -1
- package/dist/gen-process.js +0 -43
- package/dist/gen-process.js.map +0 -1
- package/dist/gen-write.d.ts +0 -19
- package/dist/gen-write.d.ts.map +0 -1
- package/dist/gen-write.js +0 -120
- package/dist/gen-write.js.map +0 -1
- package/dist/glob.d.ts +0 -21
- package/dist/glob.d.ts.map +0 -1
- package/dist/glob.js +0 -115
- package/dist/glob.js.map +0 -1
- package/dist/go-type-emitter.d.ts +0 -47
- package/dist/go-type-emitter.d.ts.map +0 -1
- package/dist/go-type-emitter.js +0 -594
- package/dist/go-type-emitter.js.map +0 -1
- package/dist/honey-response.d.ts +0 -82
- package/dist/honey-response.d.ts.map +0 -1
- package/dist/honey-response.js +0 -338
- package/dist/honey-response.js.map +0 -1
- package/dist/i18n-slot.d.ts +0 -15
- package/dist/i18n-slot.d.ts.map +0 -1
- package/dist/i18n-slot.js +0 -14
- package/dist/i18n-slot.js.map +0 -1
- package/dist/i18n.d.ts +0 -29
- package/dist/i18n.d.ts.map +0 -1
- package/dist/i18n.js +0 -250
- package/dist/i18n.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/init.d.ts +0 -5
- package/dist/init.d.ts.map +0 -1
- package/dist/init.js +0 -140
- package/dist/init.js.map +0 -1
- package/dist/input.d.ts +0 -6
- package/dist/input.d.ts.map +0 -1
- package/dist/input.js +0 -4
- package/dist/input.js.map +0 -1
- package/dist/invalidate-check.d.ts +0 -61
- package/dist/invalidate-check.d.ts.map +0 -1
- package/dist/invalidate-check.js +0 -163
- package/dist/invalidate-check.js.map +0 -1
- package/dist/invoke-user.d.ts +0 -35
- package/dist/invoke-user.d.ts.map +0 -1
- package/dist/invoke-user.js +0 -73
- package/dist/invoke-user.js.map +0 -1
- package/dist/ip-restrict.d.ts +0 -24
- package/dist/ip-restrict.d.ts.map +0 -1
- package/dist/ip-restrict.js +0 -60
- package/dist/ip-restrict.js.map +0 -1
- package/dist/ip.d.ts +0 -39
- package/dist/ip.d.ts.map +0 -1
- package/dist/ip.js +0 -209
- package/dist/ip.js.map +0 -1
- package/dist/logger.d.ts +0 -45
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js +0 -113
- package/dist/logger.js.map +0 -1
- package/dist/media-type.d.ts +0 -30
- package/dist/media-type.d.ts.map +0 -1
- package/dist/media-type.js +0 -97
- package/dist/media-type.js.map +0 -1
- package/dist/meta-spec-merge.d.ts +0 -32
- package/dist/meta-spec-merge.d.ts.map +0 -1
- package/dist/meta-spec-merge.js +0 -68
- package/dist/meta-spec-merge.js.map +0 -1
- package/dist/meta-spec.d.ts +0 -94
- package/dist/meta-spec.d.ts.map +0 -1
- package/dist/meta-spec.js +0 -535
- package/dist/meta-spec.js.map +0 -1
- package/dist/middleware.d.ts +0 -77
- package/dist/middleware.d.ts.map +0 -1
- package/dist/middleware.js +0 -253
- package/dist/middleware.js.map +0 -1
- package/dist/node-request.d.ts +0 -104
- package/dist/node-request.d.ts.map +0 -1
- package/dist/node-request.js +0 -407
- package/dist/node-request.js.map +0 -1
- package/dist/node.d.ts +0 -30
- package/dist/node.d.ts.map +0 -1
- package/dist/node.js +0 -396
- package/dist/node.js.map +0 -1
- package/dist/openapi/collect.d.ts.map +0 -1
- package/dist/openapi/collect.js.map +0 -1
- package/dist/openapi/docs-page.d.ts.map +0 -1
- package/dist/openapi/docs-page.js.map +0 -1
- package/dist/openapi/document.d.ts.map +0 -1
- package/dist/openapi/document.js.map +0 -1
- package/dist/openapi/json-schema-slot.d.ts +0 -12
- package/dist/openapi/json-schema-slot.d.ts.map +0 -1
- package/dist/openapi/json-schema-slot.js +0 -38
- package/dist/openapi/json-schema-slot.js.map +0 -1
- package/dist/openapi/register.d.ts.map +0 -1
- package/dist/openapi/register.js.map +0 -1
- package/dist/openapi/scalar.d.ts.map +0 -1
- package/dist/openapi/scalar.js.map +0 -1
- package/dist/openapi/serve.d.ts.map +0 -1
- package/dist/openapi/serve.js.map +0 -1
- package/dist/openapi/spec-factory.d.ts +0 -65
- package/dist/openapi/spec-factory.d.ts.map +0 -1
- package/dist/openapi/spec-factory.js +0 -52
- package/dist/openapi/spec-factory.js.map +0 -1
- package/dist/openapi/spec.d.ts +0 -29
- package/dist/openapi/spec.d.ts.map +0 -1
- package/dist/openapi/spec.js +0 -50
- package/dist/openapi/spec.js.map +0 -1
- package/dist/openapi/swagger.d.ts.map +0 -1
- package/dist/openapi/swagger.js.map +0 -1
- package/dist/pattern.d.ts +0 -71
- package/dist/pattern.d.ts.map +0 -1
- package/dist/pattern.js +0 -239
- package/dist/pattern.js.map +0 -1
- package/dist/peer.d.ts +0 -17
- package/dist/peer.d.ts.map +0 -1
- package/dist/peer.js +0 -50
- package/dist/peer.js.map +0 -1
- package/dist/plugin.d.ts +0 -228
- package/dist/plugin.d.ts.map +0 -1
- package/dist/plugin.js +0 -666
- package/dist/plugin.js.map +0 -1
- package/dist/powered-by.d.ts +0 -7
- package/dist/powered-by.d.ts.map +0 -1
- package/dist/powered-by.js +0 -11
- package/dist/powered-by.js.map +0 -1
- package/dist/pretty-json.d.ts +0 -10
- package/dist/pretty-json.d.ts.map +0 -1
- package/dist/pretty-json.js +0 -47
- package/dist/pretty-json.js.map +0 -1
- package/dist/producer-stream.d.ts +0 -47
- package/dist/producer-stream.d.ts.map +0 -1
- package/dist/producer-stream.js +0 -267
- package/dist/producer-stream.js.map +0 -1
- package/dist/proxy.d.ts +0 -90
- package/dist/proxy.d.ts.map +0 -1
- package/dist/proxy.js +0 -274
- package/dist/proxy.js.map +0 -1
- package/dist/python-type-emitter.d.ts +0 -24
- package/dist/python-type-emitter.d.ts.map +0 -1
- package/dist/python-type-emitter.js +0 -157
- package/dist/python-type-emitter.js.map +0 -1
- package/dist/realtime/bus.d.ts.map +0 -1
- package/dist/realtime/bus.js.map +0 -1
- package/dist/realtime/register.d.ts +0 -3
- package/dist/realtime/register.d.ts.map +0 -1
- package/dist/realtime/register.js +0 -10
- package/dist/realtime/register.js.map +0 -1
- package/dist/realtime/route.d.ts.map +0 -1
- package/dist/realtime/route.js.map +0 -1
- package/dist/realtime/server.d.ts.map +0 -1
- package/dist/realtime/server.js.map +0 -1
- package/dist/request-id.d.ts +0 -19
- package/dist/request-id.d.ts.map +0 -1
- package/dist/request-id.js +0 -16
- package/dist/request-id.js.map +0 -1
- package/dist/request-limits.d.ts +0 -3
- package/dist/request-limits.d.ts.map +0 -1
- package/dist/request-limits.js +0 -3
- package/dist/request-limits.js.map +0 -1
- package/dist/request-path.d.ts +0 -33
- package/dist/request-path.d.ts.map +0 -1
- package/dist/request-path.js +0 -178
- package/dist/request-path.js.map +0 -1
- package/dist/request-to-curl.d.ts +0 -15
- package/dist/request-to-curl.d.ts.map +0 -1
- package/dist/request-to-curl.js +0 -48
- package/dist/request-to-curl.js.map +0 -1
- package/dist/response.d.ts +0 -86
- package/dist/response.d.ts.map +0 -1
- package/dist/response.js +0 -313
- package/dist/response.js.map +0 -1
- package/dist/rust-type-emitter.d.ts +0 -44
- package/dist/rust-type-emitter.d.ts.map +0 -1
- package/dist/rust-type-emitter.js +0 -463
- package/dist/rust-type-emitter.js.map +0 -1
- package/dist/secure-headers.d.ts +0 -16
- package/dist/secure-headers.d.ts.map +0 -1
- package/dist/secure-headers.js +0 -53
- package/dist/secure-headers.js.map +0 -1
- package/dist/serve-register.d.ts +0 -6
- package/dist/serve-register.d.ts.map +0 -1
- package/dist/serve-register.js +0 -9
- package/dist/serve-register.js.map +0 -1
- package/dist/serve-slot.d.ts +0 -9
- package/dist/serve-slot.d.ts.map +0 -1
- package/dist/serve-slot.js +0 -52
- package/dist/serve-slot.js.map +0 -1
- package/dist/serve.d.ts +0 -38
- package/dist/serve.d.ts.map +0 -1
- package/dist/serve.js +0 -157
- package/dist/serve.js.map +0 -1
- package/dist/server-timing.d.ts +0 -9
- package/dist/server-timing.d.ts.map +0 -1
- package/dist/server-timing.js +0 -51
- package/dist/server-timing.js.map +0 -1
- package/dist/static.d.ts +0 -21
- package/dist/static.d.ts.map +0 -1
- package/dist/static.js +0 -102
- package/dist/static.js.map +0 -1
- package/dist/telemetry/otel.d.ts.map +0 -1
- package/dist/telemetry/otel.js.map +0 -1
- package/dist/testing.d.ts +0 -36
- package/dist/testing.d.ts.map +0 -1
- package/dist/testing.js +0 -124
- package/dist/testing.js.map +0 -1
- package/dist/timeout.d.ts +0 -13
- package/dist/timeout.d.ts.map +0 -1
- package/dist/timeout.js +0 -36
- package/dist/timeout.js.map +0 -1
- package/dist/tree.d.ts +0 -193
- package/dist/tree.d.ts.map +0 -1
- package/dist/tree.js +0 -437
- package/dist/tree.js.map +0 -1
- package/dist/trust.d.ts +0 -21
- package/dist/trust.d.ts.map +0 -1
- package/dist/trust.js +0 -100
- package/dist/trust.js.map +0 -1
- package/dist/ts-type-emitter.d.ts +0 -8
- package/dist/ts-type-emitter.d.ts.map +0 -1
- package/dist/ts-type-emitter.js +0 -150
- package/dist/ts-type-emitter.js.map +0 -1
- package/dist/type-emitter.d.ts +0 -36
- package/dist/type-emitter.d.ts.map +0 -1
- package/dist/type-emitter.js +0 -729
- package/dist/type-emitter.js.map +0 -1
- package/dist/type-extractor.d.ts +0 -43
- package/dist/type-extractor.d.ts.map +0 -1
- package/dist/type-extractor.js +0 -819
- package/dist/type-extractor.js.map +0 -1
- package/dist/types.d.ts +0 -467
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -96
- package/dist/types.js.map +0 -1
- package/dist/validation.d.ts +0 -31
- package/dist/validation.d.ts.map +0 -1
- package/dist/validation.js +0 -335
- package/dist/validation.js.map +0 -1
- package/dist/with-headers.d.ts +0 -15
- package/dist/with-headers.d.ts.map +0 -1
- package/dist/with-headers.js +0 -45
- package/dist/with-headers.js.map +0 -1
- package/dist/ws/bun.d.ts.map +0 -1
- package/dist/ws/bun.js.map +0 -1
- package/dist/ws/cloudflare.d.ts.map +0 -1
- package/dist/ws/cloudflare.js.map +0 -1
- package/dist/ws/deno.d.ts +0 -13
- package/dist/ws/deno.d.ts.map +0 -1
- package/dist/ws/deno.js +0 -133
- package/dist/ws/deno.js.map +0 -1
- package/dist/ws/node.d.ts.map +0 -1
- package/dist/ws/node.js.map +0 -1
- package/dist/ws/session.d.ts.map +0 -1
- package/dist/ws/session.js.map +0 -1
- package/dist/ws/shared.d.ts.map +0 -1
- package/dist/ws/shared.js.map +0 -1
- package/dist/ws-origin.d.ts +0 -20
- package/dist/ws-origin.d.ts.map +0 -1
- package/dist/ws-origin.js +0 -41
- package/dist/ws-origin.js.map +0 -1
- package/dist/yaml.d.ts +0 -18
- package/dist/yaml.d.ts.map +0 -1
- package/dist/yaml.js +0 -101
- package/dist/yaml.js.map +0 -1
- package/docs/api-ref/go.md +0 -399
- package/docs/api-ref/python.md +0 -399
- package/docs/api-ref/rust.md +0 -399
- package/docs/api-ref/typescript.md +0 -399
- package/docs/invalidate-spec.md +0 -333
- package/docs/meta-spec.md +0 -555
- package/docs/packaging.md +0 -104
- package/docs/regression-matrix/README.md +0 -32
- package/docs/regression-matrix/review.md +0 -44
- package/docs/regression-matrix/ws1-3.md +0 -97
- package/docs/regression-matrix/ws4-8.md +0 -107
- package/docs/regression-matrix/ws9-12.md +0 -266
- package/docs/sdk.md +0 -798
- package/src/accepts.ts +0 -136
- package/src/body-kind.ts +0 -67
- package/src/body-limit.ts +0 -152
- package/src/build/index.ts +0 -217
- package/src/cli-args.ts +0 -123
- package/src/cli-go/auth.go +0 -26
- package/src/cli-go/config.go +0 -192
- package/src/cli-go/errors.go +0 -75
- package/src/cli-go/multipart.go +0 -79
- package/src/cli-go/output.go +0 -163
- package/src/cli-go/root.go +0 -30
- package/src/cli-go/stream.go +0 -88
- package/src/cli-go/version.go +0 -5
- package/src/cli.ts +0 -209
- package/src/client/defaults.ts +0 -47
- package/src/client/error.ts +0 -82
- package/src/client/http.ts +0 -737
- package/src/client/index.ts +0 -157
- package/src/client/path.ts +0 -169
- package/src/client/redirect-policy.ts +0 -19
- package/src/client/sdk.ts +0 -351
- package/src/client/sse.ts +0 -128
- package/src/client/types.ts +0 -206
- package/src/client/ws.ts +0 -149
- package/src/client-go/errors.go +0 -236
- package/src/client-go/export.go +0 -44
- package/src/client-go/invalidation.go +0 -371
- package/src/client-go/nullable.go +0 -62
- package/src/client-go/realtime.go +0 -354
- package/src/client-go/result.go +0 -20
- package/src/client-go/runtime.go +0 -975
- package/src/client-go/sse.go +0 -159
- package/src/client-go/transport.go +0 -495
- package/src/client-go/ws.go +0 -128
- package/src/client-info.ts +0 -79
- package/src/client-mcp/README.md +0 -10
- package/src/client-mcp/server.ts +0 -221
- package/src/client-mcp/types.ts +0 -19
- package/src/client-python/_errors.py +0 -115
- package/src/client-python/_invalidation.py +0 -494
- package/src/client-python/_realtime.py +0 -179
- package/src/client-python/_runtime.py +0 -860
- package/src/client-python/_sse.py +0 -155
- package/src/client-python/_transport.py +0 -366
- package/src/client-python/_ws.py +0 -159
- package/src/client-python/py.typed +0 -0
- package/src/client-rust/errors.rs +0 -220
- package/src/client-rust/invalidation.rs +0 -412
- package/src/client-rust/invalidation_sync.rs +0 -93
- package/src/client-rust/nullable.rs +0 -17
- package/src/client-rust/realtime.rs +0 -702
- package/src/client-rust/result.rs +0 -22
- package/src/client-rust/runtime.rs +0 -980
- package/src/client-rust/runtime_sync.rs +0 -484
- package/src/client-rust/sse.rs +0 -188
- package/src/client-rust/ws.rs +0 -167
- package/src/codegen-go-cli.ts +0 -1066
- package/src/codegen-go.ts +0 -970
- package/src/codegen-hash.ts +0 -8
- package/src/codegen-ir.ts +0 -812
- package/src/codegen-lang.ts +0 -517
- package/src/codegen-load.ts +0 -150
- package/src/codegen-loaders.ts +0 -50
- package/src/codegen-mcp.ts +0 -445
- package/src/codegen-python.ts +0 -916
- package/src/codegen-route-tree-intern.ts +0 -198
- package/src/codegen-rust.ts +0 -1402
- package/src/codegen-sanitize.ts +0 -57
- package/src/codegen-schema-naming.ts +0 -165
- package/src/codegen-sdk-model.ts +0 -228
- package/src/codegen.ts +0 -5089
- package/src/context.ts +0 -325
- package/src/cookie-sign.ts +0 -119
- package/src/cookie.ts +0 -143
- package/src/cors.ts +0 -95
- package/src/crypto.ts +0 -38
- package/src/csrf.ts +0 -86
- package/src/curl-logger.ts +0 -258
- package/src/detect-runtime.ts +0 -17
- package/src/dict.ts +0 -12
- package/src/error.ts +0 -55
- package/src/errors.ts +0 -85
- package/src/etag.ts +0 -97
- package/src/feature-detect.ts +0 -147
- package/src/feature-load.ts +0 -23
- package/src/feature-slots.ts +0 -70
- package/src/fetch-request.ts +0 -13
- package/src/gen-process.ts +0 -42
- package/src/gen-write.ts +0 -127
- package/src/glob.ts +0 -109
- package/src/go-type-emitter.ts +0 -660
- package/src/honey-response.ts +0 -379
- package/src/i18n-slot.ts +0 -30
- package/src/i18n.ts +0 -300
- package/src/index.ts +0 -3829
- package/src/init.ts +0 -161
- package/src/input.ts +0 -8
- package/src/invalidate-check.ts +0 -205
- package/src/invoke-user.ts +0 -95
- package/src/ip-restrict.ts +0 -79
- package/src/ip.ts +0 -194
- package/src/logger.ts +0 -178
- package/src/media-type.ts +0 -104
- package/src/meta-spec-merge.ts +0 -80
- package/src/meta-spec.ts +0 -718
- package/src/middleware.ts +0 -331
- package/src/node-request.ts +0 -431
- package/src/node.ts +0 -454
- package/src/openapi/collect.ts +0 -50
- package/src/openapi/docs-page.ts +0 -89
- package/src/openapi/document.ts +0 -893
- package/src/openapi/json-schema-slot.ts +0 -53
- package/src/openapi/register.ts +0 -23
- package/src/openapi/scalar.ts +0 -34
- package/src/openapi/serve.ts +0 -39
- package/src/openapi/spec-factory.ts +0 -100
- package/src/openapi/spec.ts +0 -74
- package/src/openapi/swagger.ts +0 -35
- package/src/pattern.ts +0 -245
- package/src/peer.ts +0 -53
- package/src/plugin.ts +0 -864
- package/src/powered-by.ts +0 -18
- package/src/pretty-json.ts +0 -56
- package/src/producer-stream.ts +0 -296
- package/src/proxy.ts +0 -370
- package/src/python-type-emitter.ts +0 -181
- package/src/realtime/bus.ts +0 -140
- package/src/realtime/register.ts +0 -13
- package/src/realtime/route.ts +0 -153
- package/src/realtime/server.ts +0 -298
- package/src/request-id.ts +0 -32
- package/src/request-limits.ts +0 -2
- package/src/request-path.ts +0 -165
- package/src/request-to-curl.ts +0 -52
- package/src/response.ts +0 -411
- package/src/rust-type-emitter.ts +0 -548
- package/src/secure-headers.ts +0 -74
- package/src/serve-register.ts +0 -12
- package/src/serve-slot.ts +0 -58
- package/src/serve.ts +0 -220
- package/src/server-timing.ts +0 -71
- package/src/static.ts +0 -112
- package/src/telemetry/otel.ts +0 -156
- package/src/testing.ts +0 -167
- package/src/timeout.ts +0 -45
- package/src/tree.ts +0 -554
- package/src/trust.ts +0 -117
- package/src/ts-type-emitter.ts +0 -168
- package/src/type-emitter.ts +0 -760
- package/src/type-extractor.ts +0 -855
- package/src/types.ts +0 -756
- package/src/validation.ts +0 -413
- package/src/with-headers.ts +0 -45
- package/src/ws/bun.ts +0 -120
- package/src/ws/cloudflare.ts +0 -192
- package/src/ws/deno.ts +0 -188
- package/src/ws/node.ts +0 -240
- package/src/ws/session.ts +0 -73
- package/src/ws/shared.ts +0 -140
- package/src/ws-origin.ts +0 -53
- package/src/yaml.ts +0 -103
package/src/client/index.ts
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import type { InferRoutes } from "../types.ts"
|
|
2
|
-
import { isClientError } from "./error.ts"
|
|
3
|
-
import type { ClientConfig } from "./http.ts"
|
|
4
|
-
import { HTTPClient } from "./http.ts"
|
|
5
|
-
import type { HoneyClient } from "./types.ts"
|
|
6
|
-
import type { TypedWebSocket } from "./ws.ts"
|
|
7
|
-
import { createTypedWebSocket } from "./ws.ts"
|
|
8
|
-
|
|
9
|
-
export type { ClientErrorInit } from "./error.ts"
|
|
10
|
-
export {
|
|
11
|
-
BadGatewayError,
|
|
12
|
-
BadRequestError,
|
|
13
|
-
ClientError,
|
|
14
|
-
ConflictError,
|
|
15
|
-
ForbiddenError,
|
|
16
|
-
GatewayTimeoutError,
|
|
17
|
-
InternalServerError,
|
|
18
|
-
isClientError,
|
|
19
|
-
NotFoundError,
|
|
20
|
-
RateLimitError,
|
|
21
|
-
ServiceUnavailableError,
|
|
22
|
-
UnauthorizedError,
|
|
23
|
-
UnprocessableEntityError,
|
|
24
|
-
} from "./error.ts"
|
|
25
|
-
export { PathParamError } from "./path.ts"
|
|
26
|
-
export type { AuthExpiredContext, ClientConfig, RedirectPolicy, RequestOptions } from "./http.ts"
|
|
27
|
-
export { HTTPClient, newClientRequestId } from "./http.ts"
|
|
28
|
-
import type { SSEEvent } from "./sse.ts"
|
|
29
|
-
|
|
30
|
-
export type { SSEEvent } from "./sse.ts"
|
|
31
|
-
export { parseSSEStream } from "./sse.ts"
|
|
32
|
-
export type {
|
|
33
|
-
ClientInput,
|
|
34
|
-
ClientResult,
|
|
35
|
-
ErrorEnvelope,
|
|
36
|
-
ErrorsFor,
|
|
37
|
-
HoneyClient,
|
|
38
|
-
InputFor,
|
|
39
|
-
IsSSE,
|
|
40
|
-
OutputDefFor,
|
|
41
|
-
OutputFor,
|
|
42
|
-
PathsForMethod,
|
|
43
|
-
ReturnFor,
|
|
44
|
-
} from "./types.ts"
|
|
45
|
-
export type { TypedWebSocket } from "./ws.ts"
|
|
46
|
-
export { createTypedWebSocket } from "./ws.ts"
|
|
47
|
-
|
|
48
|
-
const HTTP_METHODS = new Set(["delete", "get", "patch", "post", "put"])
|
|
49
|
-
|
|
50
|
-
function isAsyncIterable(value: unknown): value is AsyncIterable<SSEEvent> {
|
|
51
|
-
return typeof value === "object" && value !== null && Symbol.asyncIterator in value
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export function createClient<T>(config: ClientConfig & { throwOnError: true }): HoneyClient<InferRoutes<T>, true>
|
|
55
|
-
export function createClient<T>(
|
|
56
|
-
config: Omit<ClientConfig, "throwOnError"> & { throwOnError?: false },
|
|
57
|
-
): HoneyClient<InferRoutes<T>, false>
|
|
58
|
-
export function createClient<T, TThrow extends boolean>(
|
|
59
|
-
config: ClientConfig & { throwOnError?: TThrow },
|
|
60
|
-
): HoneyClient<InferRoutes<T>, TThrow>
|
|
61
|
-
export function createClient<T, TThrow extends boolean = false>(
|
|
62
|
-
config: ClientConfig & { throwOnError?: TThrow },
|
|
63
|
-
): HoneyClient<InferRoutes<T>, TThrow> {
|
|
64
|
-
const http = new HTTPClient(config)
|
|
65
|
-
|
|
66
|
-
return new Proxy({} as HoneyClient<InferRoutes<T>, TThrow>, {
|
|
67
|
-
get(_target, prop: string | symbol) {
|
|
68
|
-
/* not a thenable, and printable: `await client` and `String(client)` must not hit the method table */
|
|
69
|
-
if (typeof prop === "symbol" || prop === "then") return undefined
|
|
70
|
-
if (prop === "toString" || prop === "toJSON") return () => "[object HoneyClient]"
|
|
71
|
-
if (prop === "$isClientError") return isClientError
|
|
72
|
-
|
|
73
|
-
if (prop === "$url") {
|
|
74
|
-
return (path: string, input?: { params?: Record<string, string>; search?: Record<string, unknown> }) =>
|
|
75
|
-
http.buildUrl(path, input ?? {})
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (prop === "$path") {
|
|
79
|
-
return (path: string, input?: { params?: Record<string, string>; search?: Record<string, unknown> }) =>
|
|
80
|
-
http.buildPath(path, input ?? {})
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (prop === "ws") {
|
|
84
|
-
return (
|
|
85
|
-
path: string,
|
|
86
|
-
input?: {
|
|
87
|
-
params?: Record<string, string>
|
|
88
|
-
protocols?: string | string[]
|
|
89
|
-
reconnectToken?: string
|
|
90
|
-
search?: Record<string, unknown>
|
|
91
|
-
},
|
|
92
|
-
): TypedWebSocket => {
|
|
93
|
-
const opts = { params: input?.params, search: input?.search }
|
|
94
|
-
let url = http.buildWSUrl(path, opts)
|
|
95
|
-
if (input?.reconnectToken) {
|
|
96
|
-
const sep = url.includes("?") ? "&" : "?"
|
|
97
|
-
url = `${url}${sep}reconnect_token=${encodeURIComponent(input.reconnectToken)}`
|
|
98
|
-
}
|
|
99
|
-
return createTypedWebSocket(url, { protocols: input?.protocols })
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (HTTP_METHODS.has(prop)) {
|
|
104
|
-
return (path: string, input?: Record<string, unknown>) => {
|
|
105
|
-
const method = prop.toUpperCase()
|
|
106
|
-
const opts = input ?? {}
|
|
107
|
-
const shouldThrow = config.throwOnError === true
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* One call, one request, consumed either way:
|
|
111
|
-
* - `await api.get(...)` sends it; an event-stream response resolves to an
|
|
112
|
-
* `AsyncIterable<SSEEvent>` (never buffered), anything else to the parsed body
|
|
113
|
-
* or result tuple. Returning the call from an async function works the same.
|
|
114
|
-
* - `for await (... of api.get(...))` before the call has started sends it as a
|
|
115
|
-
* stream request (`accept: text/event-stream`, no timeout).
|
|
116
|
-
* - iterating after awaiting reuses the same response instead of sending again.
|
|
117
|
-
*/
|
|
118
|
-
let mode: "auto" | "idle" | "sse" = "idle"
|
|
119
|
-
let auto: Promise<unknown> | undefined
|
|
120
|
-
const runAuto = (): Promise<unknown> => {
|
|
121
|
-
auto ??= http.requestAuto(method, path, opts, shouldThrow)
|
|
122
|
-
return auto
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
const lazy = new Promise((resolve, reject) => {
|
|
126
|
-
queueMicrotask(() => {
|
|
127
|
-
if (mode === "sse") return
|
|
128
|
-
mode = "auto"
|
|
129
|
-
runAuto().then(resolve, reject)
|
|
130
|
-
})
|
|
131
|
-
})
|
|
132
|
-
Object.defineProperty(lazy, Symbol.asyncIterator, {
|
|
133
|
-
value() {
|
|
134
|
-
if (mode === "idle") {
|
|
135
|
-
mode = "sse"
|
|
136
|
-
return http.requestStream(method, path, opts)[Symbol.asyncIterator]()
|
|
137
|
-
}
|
|
138
|
-
return (async function* () {
|
|
139
|
-
const result = await runAuto()
|
|
140
|
-
if (isAsyncIterable(result)) {
|
|
141
|
-
yield* result
|
|
142
|
-
return
|
|
143
|
-
}
|
|
144
|
-
const error = (result as { error?: unknown } | null)?.error
|
|
145
|
-
if (error) throw error instanceof Error ? error : new Error("Request failed")
|
|
146
|
-
throw new TypeError(`${method} ${path} did not respond with an event stream`)
|
|
147
|
-
})()
|
|
148
|
-
},
|
|
149
|
-
})
|
|
150
|
-
return lazy
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return undefined
|
|
155
|
-
},
|
|
156
|
-
})
|
|
157
|
-
}
|
package/src/client/path.ts
DELETED
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Client-side path templates. Two spellings are accepted, segment by segment:
|
|
3
|
-
*
|
|
4
|
-
* - Honey route patterns: `:name` (or `:name?`) takes a whole segment, `*name` (or `*`)
|
|
5
|
-
* takes the rest of the path. Names follow the router grammar, so `:user-id` is one
|
|
6
|
-
* parameter.
|
|
7
|
-
* - OpenAPI templates: `{name}` anywhere inside a segment (`/ops/{id}:cancel`).
|
|
8
|
-
*
|
|
9
|
-
* Values are percent-encoded. A value that would change the path's shape once a URL parser
|
|
10
|
-
* normalizes it (`""`, `.`, `..`) is rejected, so `{ id: ".." }` can never retarget a request
|
|
11
|
-
* to the parent resource and `{ org: "" }` can never turn `/:org/:repo` into `//repo`.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
const BRACE_RE = /\{([^{}/]+)\}/g
|
|
15
|
-
|
|
16
|
-
export class PathParamError extends Error {
|
|
17
|
-
constructor(message: string) {
|
|
18
|
-
super(message)
|
|
19
|
-
this.name = "PathParamError"
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function own(params: Record<string, unknown>, key: string): unknown {
|
|
24
|
-
return Object.hasOwn(params, key) ? params[key] : undefined
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function toValue(params: Record<string, unknown>, key: string): string | undefined {
|
|
28
|
-
const raw = own(params, key)
|
|
29
|
-
if (raw === undefined || raw === null) return undefined
|
|
30
|
-
return typeof raw === "string" ? raw : String(raw)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function encodeSegmentValue(key: string, value: string): string {
|
|
34
|
-
if (value === "" || value === "." || value === "..") {
|
|
35
|
-
throw new PathParamError(
|
|
36
|
-
`Invalid path param ${JSON.stringify(key)}: ${JSON.stringify(value)} is not a path segment`,
|
|
37
|
-
)
|
|
38
|
-
}
|
|
39
|
-
return encodeURIComponent(value)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/** A wildcard value may span segments; each one is encoded and validated on its own. */
|
|
43
|
-
function encodeWildcardValue(key: string, value: string): string {
|
|
44
|
-
if (value === "") return ""
|
|
45
|
-
return value
|
|
46
|
-
.split("/")
|
|
47
|
-
.map((part) => encodeSegmentValue(key, part))
|
|
48
|
-
.join("/")
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export function interpolatePath(path: string, params: Record<string, unknown> = {}): string {
|
|
52
|
-
const segments = path.split("/")
|
|
53
|
-
const out: string[] = []
|
|
54
|
-
for (let i = 0; i < segments.length; i++) {
|
|
55
|
-
const seg = segments[i]
|
|
56
|
-
if (seg.length > 1 && seg.charCodeAt(0) === 58 /* : */) {
|
|
57
|
-
const optional = seg.endsWith("?")
|
|
58
|
-
const name = optional ? seg.slice(1, -1) : seg.slice(1)
|
|
59
|
-
const value = toValue(params, name)
|
|
60
|
-
if (value === undefined) {
|
|
61
|
-
if (optional) continue
|
|
62
|
-
throw new PathParamError(`Missing path param: ${name}`)
|
|
63
|
-
}
|
|
64
|
-
out.push(encodeSegmentValue(name, value))
|
|
65
|
-
continue
|
|
66
|
-
}
|
|
67
|
-
if (seg.charCodeAt(0) === 42 /* * */ && i === segments.length - 1) {
|
|
68
|
-
const name = seg.length > 1 ? seg.slice(1) : "*"
|
|
69
|
-
const value = toValue(params, name)
|
|
70
|
-
if (value === undefined) {
|
|
71
|
-
if (seg.length === 1) {
|
|
72
|
-
out.push("")
|
|
73
|
-
continue
|
|
74
|
-
}
|
|
75
|
-
throw new PathParamError(`Missing path param: ${name}`)
|
|
76
|
-
}
|
|
77
|
-
out.push(encodeWildcardValue(name, value))
|
|
78
|
-
continue
|
|
79
|
-
}
|
|
80
|
-
out.push(
|
|
81
|
-
seg.replace(BRACE_RE, (_, name: string) => {
|
|
82
|
-
const value = toValue(params, name)
|
|
83
|
-
if (value === undefined) throw new PathParamError(`Missing path param: ${name}`)
|
|
84
|
-
return encodeSegmentValue(name, value)
|
|
85
|
-
}),
|
|
86
|
-
)
|
|
87
|
-
}
|
|
88
|
-
return out.join("/")
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/** True when the template still has a placeholder in either spelling. */
|
|
92
|
-
export function hasPlaceholder(path: string): boolean {
|
|
93
|
-
for (const seg of path.split("/")) {
|
|
94
|
-
if (seg.length > 1 && seg.charCodeAt(0) === 58) return true
|
|
95
|
-
if (seg.charCodeAt(0) === 42) return true
|
|
96
|
-
BRACE_RE.lastIndex = 0
|
|
97
|
-
if (BRACE_RE.test(seg)) return true
|
|
98
|
-
}
|
|
99
|
-
return false
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Substitute the params that are present and leave the others as placeholders. Used for
|
|
104
|
-
* invalidation targets, where a partially resolved target is still a narrower pattern.
|
|
105
|
-
*/
|
|
106
|
-
export function interpolatePartial(path: string, params: Record<string, unknown>): string {
|
|
107
|
-
return path
|
|
108
|
-
.split("/")
|
|
109
|
-
.map((seg, i, all) => {
|
|
110
|
-
if (seg.length > 1 && seg.charCodeAt(0) === 58) {
|
|
111
|
-
const optional = seg.endsWith("?")
|
|
112
|
-
const name = optional ? seg.slice(1, -1) : seg.slice(1)
|
|
113
|
-
const value = toValue(params, name)
|
|
114
|
-
return value === undefined ? seg : encodeSegmentValue(name, value)
|
|
115
|
-
}
|
|
116
|
-
if (seg.charCodeAt(0) === 42 && i === all.length - 1) {
|
|
117
|
-
const value = toValue(params, seg.length > 1 ? seg.slice(1) : "*")
|
|
118
|
-
return value === undefined ? seg : encodeWildcardValue(seg.slice(1), value)
|
|
119
|
-
}
|
|
120
|
-
return seg.replace(BRACE_RE, (match, name: string) => {
|
|
121
|
-
const value = toValue(params, name)
|
|
122
|
-
return value === undefined ? match : encodeSegmentValue(name, value)
|
|
123
|
-
})
|
|
124
|
-
})
|
|
125
|
-
.join("/")
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function escapeRegExp(text: string): string {
|
|
129
|
-
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
const MAX_CACHED_PATTERNS = 1024
|
|
133
|
-
const patternCache = new Map<string, RegExp>()
|
|
134
|
-
|
|
135
|
-
/** Compile a template to a regex over concrete paths, using the same segment grammar. */
|
|
136
|
-
export function compilePattern(pattern: string): RegExp {
|
|
137
|
-
let re = patternCache.get(pattern)
|
|
138
|
-
if (re !== undefined) return re
|
|
139
|
-
const segments = pattern.split("/")
|
|
140
|
-
let source = ""
|
|
141
|
-
for (let i = 0; i < segments.length; i++) {
|
|
142
|
-
const seg = segments[i]
|
|
143
|
-
const sep = i === 0 ? "" : "/"
|
|
144
|
-
if (seg.length > 1 && seg.charCodeAt(0) === 58) {
|
|
145
|
-
source += seg.endsWith("?") ? `(?:${sep}[^/]+)?` : `${sep}[^/]+`
|
|
146
|
-
continue
|
|
147
|
-
}
|
|
148
|
-
if (seg.charCodeAt(0) === 42 && i === segments.length - 1) {
|
|
149
|
-
source += `(?:${sep}.*)?`
|
|
150
|
-
continue
|
|
151
|
-
}
|
|
152
|
-
let segSource = ""
|
|
153
|
-
let last = 0
|
|
154
|
-
BRACE_RE.lastIndex = 0
|
|
155
|
-
for (let m = BRACE_RE.exec(seg); m !== null; m = BRACE_RE.exec(seg)) {
|
|
156
|
-
segSource += `${escapeRegExp(seg.slice(last, m.index))}[^/]+`
|
|
157
|
-
last = m.index + m[0].length
|
|
158
|
-
}
|
|
159
|
-
segSource += escapeRegExp(seg.slice(last))
|
|
160
|
-
source += sep + segSource
|
|
161
|
-
}
|
|
162
|
-
re = new RegExp(`^${source}$`)
|
|
163
|
-
if (patternCache.size >= MAX_CACHED_PATTERNS) {
|
|
164
|
-
const oldest = patternCache.keys().next().value
|
|
165
|
-
if (oldest !== undefined) patternCache.delete(oldest)
|
|
166
|
-
}
|
|
167
|
-
patternCache.set(pattern, re)
|
|
168
|
-
return re
|
|
169
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Headers a request may carry to another origin when a `redirect: "follow"` client follows a
|
|
3
|
-
* cross-origin redirect. Everything else is dropped on that hop: credentials, the auth header and
|
|
4
|
-
* every header set from config (either form), per call or by an `onRequest` hook, whatever its
|
|
5
|
-
* name. An allowlist, so a header added later never leaks by default.
|
|
6
|
-
*
|
|
7
|
-
* Shared by `createClient` and the generated TypeScript SDK runtime, which embeds this list.
|
|
8
|
-
*/
|
|
9
|
-
export const CROSS_ORIGIN_SAFE_HEADERS: readonly string[] = ["accept", "accept-language", "user-agent"]
|
|
10
|
-
|
|
11
|
-
/** The headers to send on a cross-origin hop: only the allowlisted ones from `headers`. */
|
|
12
|
-
export function crossOriginHeaders(headers: Headers): Headers {
|
|
13
|
-
const out = new Headers()
|
|
14
|
-
for (const name of CROSS_ORIGIN_SAFE_HEADERS) {
|
|
15
|
-
const value = headers.get(name)
|
|
16
|
-
if (value !== null) out.set(name, value)
|
|
17
|
-
}
|
|
18
|
-
return out
|
|
19
|
-
}
|
package/src/client/sdk.ts
DELETED
|
@@ -1,351 +0,0 @@
|
|
|
1
|
-
import type { ClientConfig, RequestMeta } from "./http.ts"
|
|
2
|
-
import { HTTPClient } from "./http.ts"
|
|
3
|
-
import { compilePattern, hasPlaceholder, interpolatePartial, interpolatePath } from "./path.ts"
|
|
4
|
-
import { createTypedWebSocket } from "./ws.ts"
|
|
5
|
-
|
|
6
|
-
type ServiceEntry = {
|
|
7
|
-
invalidate?: readonly string[]
|
|
8
|
-
method: string
|
|
9
|
-
params?: readonly string[]
|
|
10
|
-
path: string
|
|
11
|
-
sse?: boolean
|
|
12
|
-
ws?: boolean
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
type ServiceMapNode = ServiceEntry | { [key: string]: ServiceMapNode }
|
|
16
|
-
type ServiceMap = { [key: string]: ServiceMapNode }
|
|
17
|
-
|
|
18
|
-
export type InvalidationConfig = {
|
|
19
|
-
staleTime: number
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export type SDKConfig = ClientConfig & {
|
|
23
|
-
invalidation?: InvalidationConfig
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/* bridge generic — Proxy target is object, return type is T (erased at runtime) */
|
|
27
|
-
function bridge<T>(value: object): T {
|
|
28
|
-
return value as T
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function own<T>(record: Record<string, T>, key: string): T | undefined {
|
|
32
|
-
return Object.hasOwn(record, key) ? record[key] : undefined
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Resolve invalidation targets by substituting the mutation's params. Params that are absent
|
|
37
|
-
* stay placeholders, so a partially resolved target is a narrower pattern, never dropped:
|
|
38
|
-
* `PUT /orgs/{org}` invalidating `GET /orgs/:org/members/:id` marks `GET /orgs/acme/members/:id`.
|
|
39
|
-
*/
|
|
40
|
-
export function resolveInvalidationTargets(
|
|
41
|
-
targets: readonly string[],
|
|
42
|
-
params: Record<string, string> | undefined,
|
|
43
|
-
): string[] {
|
|
44
|
-
const resolved: string[] = []
|
|
45
|
-
for (const target of targets) {
|
|
46
|
-
const spaceIdx = target.indexOf(" ")
|
|
47
|
-
if (spaceIdx === -1 || !params) {
|
|
48
|
-
resolved.push(target)
|
|
49
|
-
continue
|
|
50
|
-
}
|
|
51
|
-
const targetMethod = target.slice(0, spaceIdx)
|
|
52
|
-
const targetPath = target.slice(spaceIdx + 1)
|
|
53
|
-
try {
|
|
54
|
-
resolved.push(`${targetMethod} ${interpolatePartial(targetPath, params)}`)
|
|
55
|
-
} catch {
|
|
56
|
-
/* a param value that is not a path segment cannot address a resource; keep the pattern */
|
|
57
|
-
resolved.push(target)
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return resolved
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/** Test if a concrete path matches a route pattern (`:name`, `{name}`, `*`); literal text is escaped. */
|
|
64
|
-
export function pathMatchesPattern(concretePath: string, pattern: string): boolean {
|
|
65
|
-
return compilePattern(pattern).test(concretePath)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/* Bound memory: an entry remembers the last N mutations that marked it, and which concrete
|
|
69
|
-
paths have already refreshed against a pattern-level mark. */
|
|
70
|
-
const MAX_INVALIDATED_BY = 32
|
|
71
|
-
const MAX_REFRESHED = 1024
|
|
72
|
-
|
|
73
|
-
type StaleEntry = {
|
|
74
|
-
by: Set<string>
|
|
75
|
-
/** Concrete paths that have read once since this pattern was marked (pattern entries only). */
|
|
76
|
-
refreshed?: Set<string>
|
|
77
|
-
seq: number
|
|
78
|
-
until: number
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Stale marks, split by kind so a concrete key is never re-read as a pattern (a path may
|
|
83
|
-
* contain `:`), and a lookup scans only patterns for its own method.
|
|
84
|
-
*/
|
|
85
|
-
export class StaleIndex {
|
|
86
|
-
readonly exact = new Map<string, StaleEntry>()
|
|
87
|
-
readonly patterns = new Map<string, Map<string, StaleEntry>>()
|
|
88
|
-
|
|
89
|
-
mark(target: string, mutation: string, seq: number, until: number): void {
|
|
90
|
-
const spaceIdx = target.indexOf(" ")
|
|
91
|
-
const method = target.slice(0, spaceIdx)
|
|
92
|
-
const path = target.slice(spaceIdx + 1)
|
|
93
|
-
const isPattern = hasPlaceholder(path)
|
|
94
|
-
let table: Map<string, StaleEntry>
|
|
95
|
-
if (isPattern) {
|
|
96
|
-
table = this.patterns.get(method) ?? new Map()
|
|
97
|
-
this.patterns.set(method, table)
|
|
98
|
-
} else {
|
|
99
|
-
table = this.exact
|
|
100
|
-
}
|
|
101
|
-
const existing = table.get(target)
|
|
102
|
-
if (existing) {
|
|
103
|
-
existing.by.delete(mutation)
|
|
104
|
-
existing.by.add(mutation)
|
|
105
|
-
if (existing.by.size > MAX_INVALIDATED_BY) {
|
|
106
|
-
const oldest = existing.by.values().next().value
|
|
107
|
-
if (oldest !== undefined) existing.by.delete(oldest)
|
|
108
|
-
}
|
|
109
|
-
existing.until = until
|
|
110
|
-
existing.seq = seq
|
|
111
|
-
/* a new mutation re-marks every instance */
|
|
112
|
-
if (existing.refreshed) existing.refreshed.clear()
|
|
113
|
-
} else {
|
|
114
|
-
table.set(target, { by: new Set([mutation]), refreshed: isPattern ? new Set() : undefined, seq, until })
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
lookup(
|
|
119
|
-
concreteSelector: string,
|
|
120
|
-
concretePath: string,
|
|
121
|
-
method: string,
|
|
122
|
-
now: number,
|
|
123
|
-
): { by: string[]; isStale: boolean } {
|
|
124
|
-
const by = new Set<string>()
|
|
125
|
-
const exact = this.exact.get(concreteSelector)
|
|
126
|
-
if (exact) {
|
|
127
|
-
if (exact.until > now) for (const m of exact.by) by.add(m)
|
|
128
|
-
else this.exact.delete(concreteSelector)
|
|
129
|
-
}
|
|
130
|
-
const table = this.patterns.get(method)
|
|
131
|
-
if (table) {
|
|
132
|
-
for (const [key, entry] of table) {
|
|
133
|
-
if (entry.until <= now) {
|
|
134
|
-
table.delete(key)
|
|
135
|
-
continue
|
|
136
|
-
}
|
|
137
|
-
if (entry.refreshed?.has(concretePath)) continue
|
|
138
|
-
if (pathMatchesPattern(concretePath, key.slice(key.indexOf(" ") + 1))) {
|
|
139
|
-
for (const m of entry.by) by.add(m)
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
return { by: [...by], isStale: by.size > 0 }
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* A successful stale read clears the mark for that resource only: the exact entry, and this
|
|
148
|
-
* concrete path's share of any pattern entry. Marks newer than the read's snapshot stay.
|
|
149
|
-
*/
|
|
150
|
-
clear(concreteSelector: string, concretePath: string, method: string, snapshot: number): void {
|
|
151
|
-
const exact = this.exact.get(concreteSelector)
|
|
152
|
-
if (exact && exact.seq <= snapshot) this.exact.delete(concreteSelector)
|
|
153
|
-
const table = this.patterns.get(method)
|
|
154
|
-
if (!table) return
|
|
155
|
-
for (const [key, entry] of table) {
|
|
156
|
-
if (entry.seq > snapshot || !entry.refreshed) continue
|
|
157
|
-
if (!pathMatchesPattern(concretePath, key.slice(key.indexOf(" ") + 1))) continue
|
|
158
|
-
if (entry.refreshed.size >= MAX_REFRESHED) {
|
|
159
|
-
const oldest = entry.refreshed.values().next().value
|
|
160
|
-
if (oldest !== undefined) entry.refreshed.delete(oldest)
|
|
161
|
-
}
|
|
162
|
-
entry.refreshed.add(concretePath)
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Two-tier stale lookup over a flat map (kept for compatibility): exact concrete match, then
|
|
169
|
-
* pattern entries for the same method. Keys are classified by their template placeholders,
|
|
170
|
-
* not by containing `:`. Expired entries are swept.
|
|
171
|
-
*/
|
|
172
|
-
export function lookupStale(
|
|
173
|
-
staleMap: Map<string, { by: string[]; seq: number; until: number }>,
|
|
174
|
-
concreteSelector: string,
|
|
175
|
-
concretePath: string,
|
|
176
|
-
method: string,
|
|
177
|
-
now: number,
|
|
178
|
-
): { by: string[]; isStale: boolean } {
|
|
179
|
-
const allBy = new Set<string>()
|
|
180
|
-
for (const [key, entry] of staleMap) {
|
|
181
|
-
if (entry.until <= now) {
|
|
182
|
-
staleMap.delete(key)
|
|
183
|
-
continue
|
|
184
|
-
}
|
|
185
|
-
if (key === concreteSelector) {
|
|
186
|
-
for (const m of entry.by) allBy.add(m)
|
|
187
|
-
continue
|
|
188
|
-
}
|
|
189
|
-
const spaceIdx = key.indexOf(" ")
|
|
190
|
-
if (key.slice(0, spaceIdx) !== method) continue
|
|
191
|
-
const keyPattern = key.slice(spaceIdx + 1)
|
|
192
|
-
if (hasPlaceholder(keyPattern) && pathMatchesPattern(concretePath, keyPattern)) {
|
|
193
|
-
for (const m of entry.by) allBy.add(m)
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
return { by: [...allBy], isStale: allBy.size > 0 }
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
function isServiceEntry(node: unknown): node is ServiceEntry {
|
|
200
|
-
return (
|
|
201
|
-
typeof node === "object" &&
|
|
202
|
-
node !== null &&
|
|
203
|
-
typeof (node as Record<string, unknown>)["method"] === "string" &&
|
|
204
|
-
typeof (node as Record<string, unknown>)["path"] === "string"
|
|
205
|
-
)
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
export function createSDK<T = Record<string, Record<string, (...args: unknown[]) => unknown>>>(
|
|
209
|
-
serviceMap: ServiceMap,
|
|
210
|
-
config: SDKConfig,
|
|
211
|
-
): T {
|
|
212
|
-
const http = new HTTPClient(config)
|
|
213
|
-
const staleTime = config.invalidation?.staleTime ?? 0
|
|
214
|
-
const stale = staleTime > 0 ? new StaleIndex() : null
|
|
215
|
-
|
|
216
|
-
let invalidationSeq = 0
|
|
217
|
-
|
|
218
|
-
const rootCache = new Map<string, object>()
|
|
219
|
-
|
|
220
|
-
function buildLeafFn(entry: ServiceEntry, namePath: string[]): Function {
|
|
221
|
-
/* Paths keep their template; HTTPClient interpolates `{name}` and `:name` alike. */
|
|
222
|
-
const path = entry.path
|
|
223
|
-
const method = entry.method
|
|
224
|
-
let fn: Function
|
|
225
|
-
|
|
226
|
-
if (entry.ws) {
|
|
227
|
-
fn = (input?: Record<string, unknown>) => {
|
|
228
|
-
const opts = {
|
|
229
|
-
params: input?.["params"] as Record<string, string> | undefined,
|
|
230
|
-
search: input?.["search"] as Record<string, unknown> | undefined,
|
|
231
|
-
}
|
|
232
|
-
let url = http.buildWSUrl(path, opts)
|
|
233
|
-
const reconnectToken = input?.["reconnectToken"] as string | undefined
|
|
234
|
-
if (reconnectToken) {
|
|
235
|
-
const sep = url.includes("?") ? "&" : "?"
|
|
236
|
-
url = `${url}${sep}reconnect_token=${encodeURIComponent(reconnectToken)}`
|
|
237
|
-
}
|
|
238
|
-
return createTypedWebSocket(url, {
|
|
239
|
-
protocols: input?.["protocols"] as string | string[] | undefined,
|
|
240
|
-
})
|
|
241
|
-
}
|
|
242
|
-
} else if (entry.sse) {
|
|
243
|
-
fn = (input?: Record<string, unknown>) => http.requestStream(method, path, input ?? {})
|
|
244
|
-
} else {
|
|
245
|
-
fn = async (input?: Record<string, unknown>) => {
|
|
246
|
-
const opts = input ?? {}
|
|
247
|
-
const params = opts["params"] as Record<string, string> | undefined
|
|
248
|
-
const concretePath = interpolatePath(path, params ?? {})
|
|
249
|
-
const concreteSelector = `${method} ${concretePath}`
|
|
250
|
-
let requestMeta: RequestMeta | undefined
|
|
251
|
-
|
|
252
|
-
if (stale) {
|
|
253
|
-
const { by, isStale } = stale.lookup(concreteSelector, concretePath, method, Date.now())
|
|
254
|
-
requestMeta = { invalidatedBy: by, isStale, selector: concreteSelector, seqSnapshot: invalidationSeq }
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
const result =
|
|
258
|
-
config.throwOnError === true
|
|
259
|
-
? await http.request(method, path, opts, requestMeta)
|
|
260
|
-
: await http.requestSafe(method, path, opts, requestMeta)
|
|
261
|
-
|
|
262
|
-
if (stale) {
|
|
263
|
-
const isSuccess =
|
|
264
|
-
config.throwOnError === true
|
|
265
|
-
? true
|
|
266
|
-
: (result as { status: number }).status >= 200 && (result as { status: number }).status < 300
|
|
267
|
-
|
|
268
|
-
if (isSuccess) {
|
|
269
|
-
if (entry.invalidate && entry.invalidate.length > 0) {
|
|
270
|
-
const seq = ++invalidationSeq
|
|
271
|
-
const until = Date.now() + staleTime
|
|
272
|
-
for (const target of resolveInvalidationTargets(entry.invalidate, params)) {
|
|
273
|
-
stale.mark(target, concreteSelector, seq, until)
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
if (requestMeta?.isStale) {
|
|
278
|
-
stale.clear(concreteSelector, concretePath, method, requestMeta.seqSnapshot)
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
return result
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
Object.defineProperty(fn, "name", { value: namePath.join(".") })
|
|
288
|
-
return fn
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
/** Own keys only: names like `toString` or `constructor` must not resolve through the prototype. */
|
|
292
|
-
function resolveChild(node: Record<string, unknown>, key: string | symbol, namePath: string[]): unknown {
|
|
293
|
-
if (typeof key === "symbol" || key === "then") return undefined
|
|
294
|
-
const child = own(node, key)
|
|
295
|
-
if (child === undefined) {
|
|
296
|
-
if (key === "toString" || key === "toJSON")
|
|
297
|
-
return () => `[object HoneySDK${namePath.length ? ` ${namePath.join(".")}` : ""}]`
|
|
298
|
-
return undefined
|
|
299
|
-
}
|
|
300
|
-
return child
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
function makeNodeProxy(node: ServiceMapNode, namePath: string[]): object {
|
|
304
|
-
const actionCache = new Map<string, Function>()
|
|
305
|
-
const childCache = new Map<string, object>()
|
|
306
|
-
return new Proxy({} as Record<string, unknown>, {
|
|
307
|
-
get(_, key: string | symbol) {
|
|
308
|
-
const child = resolveChild(node as Record<string, unknown>, key, namePath)
|
|
309
|
-
if (child === undefined || typeof child === "function") return child
|
|
310
|
-
const name = key as string
|
|
311
|
-
|
|
312
|
-
if (isServiceEntry(child)) {
|
|
313
|
-
const cached = actionCache.get(name)
|
|
314
|
-
if (cached) return cached
|
|
315
|
-
const fn = buildLeafFn(child, [...namePath, name])
|
|
316
|
-
actionCache.set(name, fn)
|
|
317
|
-
return fn
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
const cached = childCache.get(name)
|
|
321
|
-
if (cached) return cached
|
|
322
|
-
const childProxy = makeNodeProxy(child as ServiceMapNode, [...namePath, name])
|
|
323
|
-
childCache.set(name, childProxy)
|
|
324
|
-
return childProxy
|
|
325
|
-
},
|
|
326
|
-
})
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
return bridge<T>(
|
|
330
|
-
new Proxy(
|
|
331
|
-
{},
|
|
332
|
-
{
|
|
333
|
-
get(_target, key: string | symbol) {
|
|
334
|
-
const node = resolveChild(serviceMap as Record<string, unknown>, key, [])
|
|
335
|
-
if (node === undefined || typeof node === "function") return node
|
|
336
|
-
const name = key as string
|
|
337
|
-
|
|
338
|
-
const cached = rootCache.get(name)
|
|
339
|
-
if (cached) return cached
|
|
340
|
-
|
|
341
|
-
const result = isServiceEntry(node)
|
|
342
|
-
? (buildLeafFn(node, [name]) as unknown as object)
|
|
343
|
-
: makeNodeProxy(node as ServiceMapNode, [name])
|
|
344
|
-
|
|
345
|
-
rootCache.set(name, result)
|
|
346
|
-
return result
|
|
347
|
-
},
|
|
348
|
-
},
|
|
349
|
-
),
|
|
350
|
-
)
|
|
351
|
-
}
|