ts-procedures 8.6.0 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +166 -101
- package/agent_config/claude-code/.claude-plugin/plugin.json +1 -1
- package/agent_config/claude-code/agents/ts-procedures-architect.md +11 -10
- package/agent_config/claude-code/skills/ts-procedures/SKILL.md +25 -12
- package/agent_config/claude-code/skills/ts-procedures/anti-patterns.md +10 -12
- package/agent_config/claude-code/skills/ts-procedures/api-reference.md +141 -45
- package/agent_config/claude-code/skills/ts-procedures/checklist.md +7 -6
- package/agent_config/claude-code/skills/ts-procedures/patterns.md +45 -6
- package/agent_config/claude-code/skills/ts-procedures/templates/client.md +1 -1
- package/agent_config/claude-code/skills/ts-procedures/templates/hono.md +1 -1
- package/agent_config/copilot/copilot-instructions.md +50 -33
- package/agent_config/cursor/cursorrules +50 -33
- package/build/adapters/astro/astro-context.js.map +1 -0
- package/build/adapters/astro/create-handler.js.map +1 -0
- package/build/adapters/astro/index.js.map +1 -0
- package/build/{implementations/http → adapters}/astro/index.test.js +1 -1
- package/build/adapters/astro/index.test.js.map +1 -0
- package/build/adapters/astro/rewrite-request.js.map +1 -0
- package/build/adapters/hono/envelope-parity.test.js +98 -0
- package/build/adapters/hono/envelope-parity.test.js.map +1 -0
- package/build/{implementations/http → adapters}/hono/handlers/http-stream.d.ts +1 -1
- package/build/adapters/hono/handlers/http-stream.js +55 -0
- package/build/adapters/hono/handlers/http-stream.js.map +1 -0
- package/build/{implementations/http → adapters}/hono/handlers/http-stream.test.js +1 -1
- package/build/adapters/hono/handlers/http-stream.test.js.map +1 -0
- package/build/{implementations/http → adapters}/hono/handlers/http.d.ts +1 -1
- package/build/adapters/hono/handlers/http.js +50 -0
- package/build/adapters/hono/handlers/http.js.map +1 -0
- package/build/{implementations/http → adapters}/hono/handlers/http.test.js +1 -1
- package/build/adapters/hono/handlers/http.test.js.map +1 -0
- package/build/{implementations/http → adapters}/hono/handlers/rpc.d.ts +2 -2
- package/build/adapters/hono/handlers/rpc.js +23 -0
- package/build/adapters/hono/handlers/rpc.js.map +1 -0
- package/build/{implementations/http → adapters}/hono/handlers/rpc.test.js +1 -1
- package/build/adapters/hono/handlers/rpc.test.js.map +1 -0
- package/build/adapters/hono/handlers/stream.d.ts +12 -0
- package/build/adapters/hono/handlers/stream.js +89 -0
- package/build/adapters/hono/handlers/stream.js.map +1 -0
- package/build/{implementations/http → adapters}/hono/handlers/stream.test.js +3 -2
- package/build/adapters/hono/handlers/stream.test.js.map +1 -0
- package/build/{implementations/http → adapters}/hono/index.d.ts +24 -12
- package/build/{implementations/http → adapters}/hono/index.js +19 -8
- package/build/adapters/hono/index.js.map +1 -0
- package/build/{implementations/http → adapters}/hono/index.test.js +2 -4
- package/build/adapters/hono/index.test.js.map +1 -0
- package/build/{implementations/http → adapters/hono}/on-request-error.test.js +2 -2
- package/build/adapters/hono/on-request-error.test.js.map +1 -0
- package/build/adapters/hono/request.d.ts +7 -0
- package/build/adapters/hono/request.js +22 -0
- package/build/adapters/hono/request.js.map +1 -0
- package/build/{implementations/http → adapters/hono}/route-errors.test.js +4 -4
- package/build/adapters/hono/route-errors.test.js.map +1 -0
- package/build/adapters/hono/types.d.ts +55 -0
- package/build/adapters/hono/types.js +19 -0
- package/build/adapters/hono/types.js.map +1 -0
- package/build/client/freeze.test.js +39 -0
- package/build/client/freeze.test.js.map +1 -0
- package/build/client/typed-error-dispatch.test.js +2 -2
- package/build/client/typed-error-dispatch.test.js.map +1 -1
- package/build/codegen/__fixtures__/make-envelope.d.ts +1 -1
- package/build/codegen/bin/cli.d.ts +5 -0
- package/build/codegen/bin/cli.js +139 -182
- package/build/codegen/bin/cli.js.map +1 -1
- package/build/codegen/bin/cli.test.js +12 -2
- package/build/codegen/bin/cli.test.js.map +1 -1
- package/build/codegen/bin/flag-specs.d.ts +9 -0
- package/build/codegen/bin/flag-specs.js +33 -31
- package/build/codegen/bin/flag-specs.js.map +1 -1
- package/build/codegen/bin/flag-specs.test.js +14 -1
- package/build/codegen/bin/flag-specs.test.js.map +1 -1
- package/build/codegen/collect-models.d.ts +1 -1
- package/build/codegen/emit/api-route.d.ts +8 -0
- package/build/codegen/emit/api-route.js +156 -0
- package/build/codegen/emit/api-route.js.map +1 -0
- package/build/codegen/emit/context.d.ts +30 -0
- package/build/codegen/emit/context.js +2 -0
- package/build/codegen/emit/context.js.map +1 -0
- package/build/codegen/emit/declarations.d.ts +24 -0
- package/build/codegen/emit/declarations.js +48 -0
- package/build/codegen/emit/declarations.js.map +1 -0
- package/build/codegen/emit/format-types.d.ts +61 -0
- package/build/codegen/emit/format-types.js +188 -0
- package/build/codegen/emit/format-types.js.map +1 -0
- package/build/codegen/emit/http-stream-route.d.ts +7 -0
- package/build/codegen/emit/http-stream-route.js +138 -0
- package/build/codegen/emit/http-stream-route.js.map +1 -0
- package/build/codegen/emit/route-shared.d.ts +35 -0
- package/build/codegen/emit/route-shared.js +88 -0
- package/build/codegen/emit/route-shared.js.map +1 -0
- package/build/codegen/emit/rpc-route.d.ts +7 -0
- package/build/codegen/emit/rpc-route.js +37 -0
- package/build/codegen/emit/rpc-route.js.map +1 -0
- package/build/codegen/emit/scope-file.d.ts +39 -0
- package/build/codegen/emit/scope-file.js +166 -0
- package/build/codegen/emit/scope-file.js.map +1 -0
- package/build/codegen/emit/stream-route.d.ts +7 -0
- package/build/codegen/emit/stream-route.js +62 -0
- package/build/codegen/emit/stream-route.js.map +1 -0
- package/build/codegen/emit-errors.d.ts +1 -1
- package/build/codegen/emit-errors.integration.test.js +1 -1
- package/build/codegen/emit-errors.integration.test.js.map +1 -1
- package/build/codegen/emit-scope.d.ts +13 -30
- package/build/codegen/emit-scope.js +15 -844
- package/build/codegen/emit-scope.js.map +1 -1
- package/build/codegen/goldens.test.js +69 -0
- package/build/codegen/goldens.test.js.map +1 -0
- package/build/codegen/group-routes.d.ts +1 -1
- package/build/codegen/pipeline.d.ts +1 -1
- package/build/codegen/resolve-envelope.d.ts +1 -1
- package/build/codegen/targets/_shared/error-schemas.d.ts +1 -1
- package/build/codegen/targets/_shared/route-slots.d.ts +1 -1
- package/build/codegen/targets/_shared/target-run.d.ts +1 -1
- package/build/codegen/targets/kotlin/emit-route-kotlin.d.ts +1 -1
- package/build/codegen/targets/swift/emit-route-swift.d.ts +1 -1
- package/build/core/create-http-stream.d.ts +50 -0
- package/build/core/create-http-stream.js +108 -0
- package/build/core/create-http-stream.js.map +1 -0
- package/build/{create-http-stream.test.js → core/create-http-stream.test.js} +1 -1
- package/build/core/create-http-stream.test.js.map +1 -0
- package/build/core/create-http.d.ts +51 -0
- package/build/core/create-http.js +65 -0
- package/build/core/create-http.js.map +1 -0
- package/build/{create-http.test.js → core/create-http.test.js} +13 -4
- package/build/core/create-http.test.js.map +1 -0
- package/build/core/create-stream.d.ts +26 -0
- package/build/core/create-stream.js +80 -0
- package/build/core/create-stream.js.map +1 -0
- package/build/{create-stream.test.js → core/create-stream.test.js} +23 -28
- package/build/core/create-stream.test.js.map +1 -0
- package/build/core/create.d.ts +22 -0
- package/build/core/create.js +71 -0
- package/build/core/create.js.map +1 -0
- package/build/{create.test.js → core/create.test.js} +25 -46
- package/build/core/create.test.js.map +1 -0
- package/build/core/definition-site.d.ts +24 -0
- package/build/{stack-utils.js → core/definition-site.js} +20 -20
- package/build/core/definition-site.js.map +1 -0
- package/build/{stack-utils.test.js → core/definition-site.test.js} +12 -3
- package/build/core/definition-site.test.js.map +1 -0
- package/build/{errors.d.ts → core/errors.d.ts} +19 -8
- package/build/{errors.js → core/errors.js} +21 -26
- package/build/core/errors.js.map +1 -0
- package/build/core/errors.test.js.map +1 -0
- package/build/core/factory-options.test.js +82 -0
- package/build/core/factory-options.test.js.map +1 -0
- package/build/core/http-route.d.ts +13 -0
- package/build/core/http-route.js +54 -0
- package/build/core/http-route.js.map +1 -0
- package/build/core/internal.d.ts +72 -0
- package/build/core/internal.js +128 -0
- package/build/core/internal.js.map +1 -0
- package/build/{migration.test.js → core/migration.test.js} +17 -1
- package/build/core/migration.test.js.map +1 -0
- package/build/core/procedures.d.ts +143 -0
- package/build/core/procedures.js +64 -0
- package/build/core/procedures.js.map +1 -0
- package/build/{index.test.js → core/procedures.test.js} +14 -11
- package/build/core/procedures.test.js.map +1 -0
- package/build/core/types.d.ts +182 -0
- package/build/{schema → core}/types.js.map +1 -1
- package/build/exports.d.ts +31 -11
- package/build/exports.js +23 -8
- package/build/exports.js.map +1 -1
- package/build/schema/adapter.d.ts +35 -0
- package/build/schema/adapter.js +13 -0
- package/build/schema/adapter.js.map +1 -0
- package/build/schema/adapter.test.js +53 -0
- package/build/schema/adapter.test.js.map +1 -0
- package/build/schema/compile.d.ts +37 -0
- package/build/schema/compile.js +38 -0
- package/build/schema/compile.js.map +1 -0
- package/build/schema/compile.test.js +78 -0
- package/build/schema/compile.test.js.map +1 -0
- package/build/schema/compute-schema.d.ts +47 -37
- package/build/schema/compute-schema.js +86 -29
- package/build/schema/compute-schema.js.map +1 -1
- package/build/schema/compute-schema.test.js +158 -40
- package/build/schema/compute-schema.test.js.map +1 -1
- package/build/schema/json-schema.d.ts +17 -0
- package/build/schema/json-schema.js +2 -0
- package/build/schema/json-schema.js.map +1 -0
- package/build/schema/typebox.d.ts +11 -0
- package/build/schema/typebox.js +24 -0
- package/build/schema/typebox.js.map +1 -0
- package/build/schema/typebox.test.js +34 -0
- package/build/schema/typebox.test.js.map +1 -0
- package/build/server/context.d.ts +8 -0
- package/build/server/context.js +7 -0
- package/build/server/context.js.map +1 -0
- package/build/server/context.test.js +16 -0
- package/build/server/context.test.js.map +1 -0
- package/build/{doc-envelope.d.ts → server/doc-envelope.d.ts} +1 -1
- package/build/server/doc-envelope.js.map +1 -0
- package/build/server/doc-envelope.test.d.ts +1 -0
- package/build/server/doc-envelope.test.js.map +1 -0
- package/build/{implementations/http → server}/doc-registry.d.ts +7 -2
- package/build/{implementations/http → server}/doc-registry.js +9 -5
- package/build/server/doc-registry.js.map +1 -0
- package/build/server/doc-registry.test.d.ts +1 -0
- package/build/{implementations/http → server}/doc-registry.test.js +27 -24
- package/build/server/doc-registry.test.js.map +1 -0
- package/build/server/docs/docs.test.d.ts +1 -0
- package/build/server/docs/docs.test.js +237 -0
- package/build/server/docs/docs.test.js.map +1 -0
- package/build/{implementations/http/hono → server}/docs/http-doc.d.ts +2 -2
- package/build/{implementations/http/hono → server}/docs/http-doc.js +1 -1
- package/build/server/docs/http-doc.js.map +1 -0
- package/build/{implementations/http/hono → server}/docs/http-stream-doc.d.ts +2 -2
- package/build/{implementations/http/hono → server}/docs/http-stream-doc.js +1 -1
- package/build/server/docs/http-stream-doc.js.map +1 -0
- package/build/{implementations/http/hono → server}/docs/rpc-doc.d.ts +2 -2
- package/build/{implementations/http/hono → server}/docs/rpc-doc.js +1 -1
- package/build/server/docs/rpc-doc.js.map +1 -0
- package/build/{implementations/http/hono → server}/docs/stream-doc.d.ts +2 -2
- package/build/{implementations/http/hono → server}/docs/stream-doc.js +1 -1
- package/build/server/docs/stream-doc.js.map +1 -0
- package/build/server/errors/dispatch.d.ts +96 -0
- package/build/{implementations/http/error-dispatch.js → server/errors/dispatch.js} +20 -10
- package/build/server/errors/dispatch.js.map +1 -0
- package/build/server/errors/dispatch.test.d.ts +1 -0
- package/build/server/errors/dispatch.test.js +418 -0
- package/build/server/errors/dispatch.test.js.map +1 -0
- package/build/{implementations/http/error-taxonomy.d.ts → server/errors/taxonomy.d.ts} +8 -17
- package/build/{implementations/http/error-taxonomy.js → server/errors/taxonomy.js} +6 -15
- package/build/server/errors/taxonomy.js.map +1 -0
- package/build/server/errors/taxonomy.test.d.ts +1 -0
- package/build/{implementations/http/error-taxonomy.test.js → server/errors/taxonomy.test.js} +45 -39
- package/build/server/errors/taxonomy.test.js.map +1 -0
- package/build/server/index.d.ts +29 -0
- package/build/server/index.js +27 -0
- package/build/server/index.js.map +1 -0
- package/build/server/no-framework-imports.test.d.ts +1 -0
- package/build/server/no-framework-imports.test.js +40 -0
- package/build/server/no-framework-imports.test.js.map +1 -0
- package/build/{implementations/http/hono/path.d.ts → server/paths.d.ts} +2 -3
- package/build/{implementations/http/hono/path.js → server/paths.js} +1 -1
- package/build/server/paths.js.map +1 -0
- package/build/server/paths.test.d.ts +1 -0
- package/build/server/paths.test.js +111 -0
- package/build/server/paths.test.js.map +1 -0
- package/build/server/request/params.d.ts +29 -0
- package/build/server/request/params.js +43 -0
- package/build/server/request/params.js.map +1 -0
- package/build/server/request/params.test.d.ts +1 -0
- package/build/server/request/params.test.js +91 -0
- package/build/server/request/params.test.js.map +1 -0
- package/build/server/request/query.d.ts +9 -0
- package/build/server/request/query.js +22 -0
- package/build/server/request/query.js.map +1 -0
- package/build/server/request/query.test.d.ts +1 -0
- package/build/server/request/query.test.js +60 -0
- package/build/server/request/query.test.js.map +1 -0
- package/build/server/sse.d.ts +70 -0
- package/build/server/sse.js +94 -0
- package/build/server/sse.js.map +1 -0
- package/build/server/sse.test.d.ts +1 -0
- package/build/server/sse.test.js +98 -0
- package/build/server/sse.test.js.map +1 -0
- package/build/{implementations → server}/types.d.ts +17 -15
- package/build/{implementations → server}/types.js.map +1 -1
- package/docs/astro-adapter.md +8 -9
- package/docs/client-and-codegen.md +4 -4
- package/docs/client-error-handling.md +5 -5
- package/docs/codegen-kotlin.md +2 -3
- package/docs/codegen-swift.md +1 -2
- package/docs/core.md +135 -54
- package/docs/http-integrations.md +58 -6
- package/docs/migration-v8-to-v9.md +192 -0
- package/docs/plans/2026-06-09-v9-rewrite.md +130 -0
- package/docs/specs/2026-06-09-v9-rewrite-design.md +221 -0
- package/docs/streaming.md +12 -0
- package/package.json +23 -47
- package/src/{implementations/http → adapters}/astro/index.test.ts +2 -2
- package/src/adapters/hono/__fixtures__/parity-envelope.json +389 -0
- package/src/adapters/hono/envelope-parity.test.ts +126 -0
- package/src/{implementations/http → adapters}/hono/handlers/http-stream.test.ts +1 -1
- package/src/adapters/hono/handlers/http-stream.ts +73 -0
- package/src/{implementations/http → adapters}/hono/handlers/http.test.ts +1 -1
- package/src/adapters/hono/handlers/http.ts +70 -0
- package/src/{implementations/http → adapters}/hono/handlers/rpc.test.ts +2 -2
- package/src/adapters/hono/handlers/rpc.ts +39 -0
- package/src/{implementations/http → adapters}/hono/handlers/stream.test.ts +4 -3
- package/src/{implementations/http → adapters}/hono/handlers/stream.ts +19 -92
- package/src/{implementations/http → adapters}/hono/index.test.ts +14 -16
- package/src/{implementations/http → adapters}/hono/index.ts +35 -30
- package/src/{implementations/http → adapters/hono}/on-request-error.test.ts +3 -3
- package/src/adapters/hono/request.ts +28 -0
- package/src/{implementations/http → adapters/hono}/route-errors.test.ts +5 -5
- package/src/{implementations/http → adapters}/hono/types.ts +43 -20
- package/src/client/freeze.test.ts +41 -0
- package/src/client/typed-error-dispatch.test.ts +3 -3
- package/src/codegen/__fixtures__/make-envelope.ts +1 -1
- package/src/codegen/__fixtures__/models-envelope.json +310 -0
- package/src/codegen/__goldens__/MANIFEST.json +85 -0
- package/src/codegen/__goldens__/kotlin-default--models/Billing.kt +112 -0
- package/src/codegen/__goldens__/kotlin-default--models/BillingReports.kt +26 -0
- package/src/codegen/__goldens__/kotlin-default--models/Orders.kt +88 -0
- package/src/codegen/__goldens__/kotlin-default--users/Users.kt +189 -0
- package/src/codegen/__goldens__/swift-default--models/Billing.swift +97 -0
- package/src/codegen/__goldens__/swift-default--models/BillingReports.swift +20 -0
- package/src/codegen/__goldens__/swift-default--models/Orders.swift +81 -0
- package/src/codegen/__goldens__/swift-default--users/Users.swift +204 -0
- package/src/codegen/__goldens__/ts-default--models/_client.ts +1319 -0
- package/src/codegen/__goldens__/ts-default--models/_errors.ts +90 -0
- package/src/codegen/__goldens__/ts-default--models/_models.ts +10 -0
- package/src/codegen/__goldens__/ts-default--models/_types.ts +502 -0
- package/src/codegen/__goldens__/ts-default--models/billing-reports.ts +29 -0
- package/src/codegen/__goldens__/ts-default--models/billing.ts +67 -0
- package/src/codegen/__goldens__/ts-default--models/index.ts +48 -0
- package/src/codegen/__goldens__/ts-default--models/orders.ts +80 -0
- package/src/codegen/__goldens__/ts-default--users/_client.ts +1319 -0
- package/src/codegen/__goldens__/ts-default--users/_errors.ts +90 -0
- package/src/codegen/__goldens__/ts-default--users/_types.ts +502 -0
- package/src/codegen/__goldens__/ts-default--users/index.ts +38 -0
- package/src/codegen/__goldens__/ts-default--users/users.ts +169 -0
- package/src/codegen/__goldens__/ts-external-runtime--models/_errors.ts +90 -0
- package/src/codegen/__goldens__/ts-external-runtime--models/_models.ts +10 -0
- package/src/codegen/__goldens__/ts-external-runtime--models/billing-reports.ts +29 -0
- package/src/codegen/__goldens__/ts-external-runtime--models/billing.ts +67 -0
- package/src/codegen/__goldens__/ts-external-runtime--models/index.ts +48 -0
- package/src/codegen/__goldens__/ts-external-runtime--models/orders.ts +80 -0
- package/src/codegen/__goldens__/ts-external-runtime--users/_errors.ts +90 -0
- package/src/codegen/__goldens__/ts-external-runtime--users/index.ts +38 -0
- package/src/codegen/__goldens__/ts-external-runtime--users/users.ts +169 -0
- package/src/codegen/__goldens__/ts-flat--models/_client.ts +1319 -0
- package/src/codegen/__goldens__/ts-flat--models/_errors.ts +87 -0
- package/src/codegen/__goldens__/ts-flat--models/_models.ts +10 -0
- package/src/codegen/__goldens__/ts-flat--models/_types.ts +502 -0
- package/src/codegen/__goldens__/ts-flat--models/billing-reports.ts +28 -0
- package/src/codegen/__goldens__/ts-flat--models/billing.ts +51 -0
- package/src/codegen/__goldens__/ts-flat--models/index.ts +42 -0
- package/src/codegen/__goldens__/ts-flat--models/orders.ts +73 -0
- package/src/codegen/__goldens__/ts-flat--users/_client.ts +1319 -0
- package/src/codegen/__goldens__/ts-flat--users/_errors.ts +87 -0
- package/src/codegen/__goldens__/ts-flat--users/_types.ts +502 -0
- package/src/codegen/__goldens__/ts-flat--users/index.ts +34 -0
- package/src/codegen/__goldens__/ts-flat--users/users.ts +126 -0
- package/src/codegen/__goldens__/ts-no-share-models--models/_client.ts +1319 -0
- package/src/codegen/__goldens__/ts-no-share-models--models/_errors.ts +90 -0
- package/src/codegen/__goldens__/ts-no-share-models--models/_types.ts +502 -0
- package/src/codegen/__goldens__/ts-no-share-models--models/billing-reports.ts +29 -0
- package/src/codegen/__goldens__/ts-no-share-models--models/billing.ts +111 -0
- package/src/codegen/__goldens__/ts-no-share-models--models/index.ts +48 -0
- package/src/codegen/__goldens__/ts-no-share-models--models/orders.ts +112 -0
- package/src/codegen/__goldens__/ts-no-share-models--users/_client.ts +1319 -0
- package/src/codegen/__goldens__/ts-no-share-models--users/_errors.ts +90 -0
- package/src/codegen/__goldens__/ts-no-share-models--users/_types.ts +502 -0
- package/src/codegen/__goldens__/ts-no-share-models--users/index.ts +38 -0
- package/src/codegen/__goldens__/ts-no-share-models--users/users.ts +169 -0
- package/src/codegen/__goldens__/ts-shared-models-module--models/_client.ts +1319 -0
- package/src/codegen/__goldens__/ts-shared-models-module--models/_errors.ts +90 -0
- package/src/codegen/__goldens__/ts-shared-models-module--models/_models.ts +7 -0
- package/src/codegen/__goldens__/ts-shared-models-module--models/_types.ts +502 -0
- package/src/codegen/__goldens__/ts-shared-models-module--models/billing-reports.ts +29 -0
- package/src/codegen/__goldens__/ts-shared-models-module--models/billing.ts +67 -0
- package/src/codegen/__goldens__/ts-shared-models-module--models/index.ts +48 -0
- package/src/codegen/__goldens__/ts-shared-models-module--models/orders.ts +80 -0
- package/src/codegen/bin/cli.test.ts +13 -2
- package/src/codegen/bin/cli.ts +181 -144
- package/src/codegen/bin/flag-specs.test.ts +16 -1
- package/src/codegen/bin/flag-specs.ts +43 -31
- package/src/codegen/bundle-size.test.ts +1 -1
- package/src/codegen/collect-models.ts +1 -1
- package/src/codegen/e2e.test.ts +1 -1
- package/src/codegen/emit/api-route.ts +184 -0
- package/src/codegen/emit/context.ts +32 -0
- package/src/codegen/emit/declarations.ts +49 -0
- package/src/codegen/emit/format-types.ts +232 -0
- package/src/codegen/emit/http-stream-route.ts +162 -0
- package/src/codegen/emit/route-shared.ts +102 -0
- package/src/codegen/emit/rpc-route.ts +49 -0
- package/src/codegen/emit/scope-file.ts +226 -0
- package/src/codegen/emit/stream-route.ts +81 -0
- package/src/codegen/emit-errors.integration.test.ts +2 -2
- package/src/codegen/emit-errors.test.ts +1 -1
- package/src/codegen/emit-errors.ts +1 -1
- package/src/codegen/emit-scope.test.ts +2 -2
- package/src/codegen/emit-scope.ts +15 -1048
- package/src/codegen/goldens.test.ts +89 -0
- package/src/codegen/group-routes.test.ts +1 -1
- package/src/codegen/group-routes.ts +1 -1
- package/src/codegen/pipeline.test.ts +1 -1
- package/src/codegen/pipeline.ts +1 -1
- package/src/codegen/resolve-envelope.test.ts +1 -1
- package/src/codegen/resolve-envelope.ts +1 -1
- package/src/codegen/targets/_shared/error-schemas.test.ts +1 -1
- package/src/codegen/targets/_shared/error-schemas.ts +1 -1
- package/src/codegen/targets/_shared/route-slots.test.ts +1 -1
- package/src/codegen/targets/_shared/route-slots.ts +1 -1
- package/src/codegen/targets/_shared/target-run.ts +1 -1
- package/src/codegen/targets/kotlin/emit-route-kotlin.test.ts +1 -1
- package/src/codegen/targets/kotlin/emit-route-kotlin.ts +1 -1
- package/src/codegen/targets/kotlin/emit-scope-kotlin.test.ts +1 -1
- package/src/codegen/targets/swift/access-level.test.ts +1 -1
- package/src/codegen/targets/swift/emit-route-swift.test.ts +1 -1
- package/src/codegen/targets/swift/emit-route-swift.ts +1 -1
- package/src/codegen/targets/swift/emit-scope-swift.test.ts +1 -1
- package/src/codegen/targets/ts/shared-models.test.ts +1 -1
- package/src/{create-http-stream.test.ts → core/create-http-stream.test.ts} +1 -1
- package/src/core/create-http-stream.ts +207 -0
- package/src/{create-http.test.ts → core/create-http.test.ts} +15 -4
- package/src/core/create-http.ts +126 -0
- package/src/{create-stream.test.ts → core/create-stream.test.ts} +28 -31
- package/src/core/create-stream.ts +142 -0
- package/src/{create.test.ts → core/create.test.ts} +25 -57
- package/src/core/create.ts +121 -0
- package/src/{stack-utils.test.ts → core/definition-site.test.ts} +14 -3
- package/src/{stack-utils.ts → core/definition-site.ts} +20 -23
- package/src/{errors.test.ts → core/errors.test.ts} +1 -1
- package/src/{errors.ts → core/errors.ts} +30 -28
- package/src/core/factory-options.test.ts +112 -0
- package/src/core/http-route.ts +73 -0
- package/src/core/internal.ts +203 -0
- package/src/{migration.test.ts → core/migration.test.ts} +23 -1
- package/src/{index.test.ts → core/procedures.test.ts} +13 -11
- package/src/core/procedures.ts +75 -0
- package/src/core/types.ts +195 -0
- package/src/exports.ts +60 -11
- package/src/schema/adapter.test.ts +58 -0
- package/src/schema/adapter.ts +45 -0
- package/src/schema/compile.test.ts +95 -0
- package/src/schema/compile.ts +64 -0
- package/src/schema/compute-schema.test.ts +222 -41
- package/src/schema/compute-schema.ts +145 -71
- package/src/schema/json-schema.ts +21 -0
- package/src/schema/typebox.test.ts +40 -0
- package/src/schema/typebox.ts +27 -0
- package/src/server/context.test.ts +22 -0
- package/src/server/context.ts +18 -0
- package/src/{doc-envelope.test.ts → server/doc-envelope.test.ts} +2 -2
- package/src/{doc-envelope.ts → server/doc-envelope.ts} +1 -1
- package/src/{implementations/http → server}/doc-registry.test.ts +32 -26
- package/src/{implementations/http → server}/doc-registry.ts +11 -7
- package/src/server/docs/docs.test.ts +287 -0
- package/src/{implementations/http/hono → server}/docs/http-doc.ts +3 -3
- package/src/{implementations/http/hono → server}/docs/http-stream-doc.ts +3 -3
- package/src/{implementations/http/hono → server}/docs/rpc-doc.ts +3 -3
- package/src/{implementations/http/hono → server}/docs/stream-doc.ts +3 -3
- package/src/server/errors/dispatch.test.ts +450 -0
- package/src/server/errors/dispatch.ts +189 -0
- package/src/{implementations/http/error-taxonomy.test.ts → server/errors/taxonomy.test.ts} +45 -39
- package/src/{implementations/http/error-taxonomy.ts → server/errors/taxonomy.ts} +8 -17
- package/src/server/index.ts +29 -0
- package/src/server/no-framework-imports.test.ts +43 -0
- package/src/server/paths.test.ts +141 -0
- package/src/{implementations/http/hono/path.ts → server/paths.ts} +2 -13
- package/src/server/request/params.test.ts +143 -0
- package/src/server/request/params.ts +68 -0
- package/src/server/request/query.test.ts +70 -0
- package/src/server/request/query.ts +24 -0
- package/src/server/sse.test.ts +113 -0
- package/src/server/sse.ts +117 -0
- package/src/{implementations → server}/types.ts +17 -16
- package/build/create-http-stream.d.ts +0 -58
- package/build/create-http-stream.js +0 -122
- package/build/create-http-stream.js.map +0 -1
- package/build/create-http-stream.test.js.map +0 -1
- package/build/create-http.d.ts +0 -49
- package/build/create-http.js +0 -108
- package/build/create-http.js.map +0 -1
- package/build/create-http.test.js.map +0 -1
- package/build/create-stream.d.ts +0 -35
- package/build/create-stream.js +0 -123
- package/build/create-stream.js.map +0 -1
- package/build/create-stream.test.js.map +0 -1
- package/build/create.d.ts +0 -28
- package/build/create.js +0 -82
- package/build/create.js.map +0 -1
- package/build/create.test.js.map +0 -1
- package/build/doc-envelope.js.map +0 -1
- package/build/doc-envelope.test.js.map +0 -1
- package/build/errors.js.map +0 -1
- package/build/errors.test.js.map +0 -1
- package/build/implementations/http/astro/astro-context.js.map +0 -1
- package/build/implementations/http/astro/create-handler.js.map +0 -1
- package/build/implementations/http/astro/index.js.map +0 -1
- package/build/implementations/http/astro/index.test.js.map +0 -1
- package/build/implementations/http/astro/rewrite-request.js.map +0 -1
- package/build/implementations/http/doc-registry.js.map +0 -1
- package/build/implementations/http/doc-registry.test.js.map +0 -1
- package/build/implementations/http/error-dispatch.d.ts +0 -76
- package/build/implementations/http/error-dispatch.js.map +0 -1
- package/build/implementations/http/error-dispatch.test.js +0 -254
- package/build/implementations/http/error-dispatch.test.js.map +0 -1
- package/build/implementations/http/error-taxonomy.js.map +0 -1
- package/build/implementations/http/error-taxonomy.test.js.map +0 -1
- package/build/implementations/http/hono/docs/http-doc.js.map +0 -1
- package/build/implementations/http/hono/docs/http-stream-doc.js.map +0 -1
- package/build/implementations/http/hono/docs/rpc-doc.js.map +0 -1
- package/build/implementations/http/hono/docs/stream-doc.js.map +0 -1
- package/build/implementations/http/hono/handlers/http-stream.js +0 -123
- package/build/implementations/http/hono/handlers/http-stream.js.map +0 -1
- package/build/implementations/http/hono/handlers/http-stream.test.js.map +0 -1
- package/build/implementations/http/hono/handlers/http.js +0 -110
- package/build/implementations/http/hono/handlers/http.js.map +0 -1
- package/build/implementations/http/hono/handlers/http.test.js.map +0 -1
- package/build/implementations/http/hono/handlers/rpc.js +0 -32
- package/build/implementations/http/hono/handlers/rpc.js.map +0 -1
- package/build/implementations/http/hono/handlers/rpc.test.js.map +0 -1
- package/build/implementations/http/hono/handlers/stream.d.ts +0 -23
- package/build/implementations/http/hono/handlers/stream.js +0 -147
- package/build/implementations/http/hono/handlers/stream.js.map +0 -1
- package/build/implementations/http/hono/handlers/stream.test.js.map +0 -1
- package/build/implementations/http/hono/index.js.map +0 -1
- package/build/implementations/http/hono/index.test.js.map +0 -1
- package/build/implementations/http/hono/path.js.map +0 -1
- package/build/implementations/http/hono/path.test.js +0 -83
- package/build/implementations/http/hono/path.test.js.map +0 -1
- package/build/implementations/http/hono/types.d.ts +0 -51
- package/build/implementations/http/hono/types.js.map +0 -1
- package/build/implementations/http/on-request-error.test.js.map +0 -1
- package/build/implementations/http/route-errors.test.js.map +0 -1
- package/build/index.d.ts +0 -175
- package/build/index.js +0 -47
- package/build/index.js.map +0 -1
- package/build/index.test.js.map +0 -1
- package/build/migration.test.js.map +0 -1
- package/build/schema/extract-json-schema.d.ts +0 -2
- package/build/schema/extract-json-schema.js +0 -12
- package/build/schema/extract-json-schema.js.map +0 -1
- package/build/schema/extract-json-schema.test.js +0 -23
- package/build/schema/extract-json-schema.test.js.map +0 -1
- package/build/schema/parser.d.ts +0 -36
- package/build/schema/parser.js +0 -210
- package/build/schema/parser.js.map +0 -1
- package/build/schema/parser.test.js +0 -120
- package/build/schema/parser.test.js.map +0 -1
- package/build/schema/resolve-schema-lib.d.ts +0 -12
- package/build/schema/resolve-schema-lib.js +0 -11
- package/build/schema/resolve-schema-lib.js.map +0 -1
- package/build/schema/resolve-schema-lib.test.js +0 -17
- package/build/schema/resolve-schema-lib.test.js.map +0 -1
- package/build/schema/types.d.ts +0 -8
- package/build/schema/types.js +0 -2
- package/build/stack-utils.d.ts +0 -25
- package/build/stack-utils.js.map +0 -1
- package/build/stack-utils.test.js.map +0 -1
- package/build/types.d.ts +0 -142
- package/build/types.js +0 -2
- package/build/types.js.map +0 -1
- package/docs/decisions/2026-06-02-monorepo-split-evaluation.md +0 -80
- package/docs/handoffs/2026-06-08-dx-round2-declines.md +0 -45
- package/docs/handoffs/ajsc-named-type-collision.md +0 -134
- package/docs/handoffs/ajsc-named-type-support.md +0 -181
- package/docs/handoffs/shared-models-auto-resolve-response.md +0 -181
- package/docs/npm-workspaces-migration-plan.md +0 -611
- package/docs/superpowers/plans/2026-04-24-doc-registry-simplification.md +0 -886
- package/docs/superpowers/plans/2026-04-24-kotlin-codegen-target.md +0 -1265
- package/docs/superpowers/plans/2026-04-25-ajsc-v7-kotlin-polish.md +0 -1993
- package/docs/superpowers/plans/2026-04-29-safe-result-api.md +0 -2293
- package/docs/superpowers/plans/2026-05-07-astro-adapter.md +0 -1391
- package/docs/superpowers/plans/2026-05-08-create-http.md +0 -3355
- package/docs/superpowers/plans/2026-05-08-hono-app-builder-convergence.md +0 -3365
- package/docs/superpowers/plans/2026-06-05-dx-feedback-round.md +0 -1292
- package/docs/superpowers/plans/2026-06-06-shared-models-convention-and-diagnostics.md +0 -659
- package/docs/superpowers/plans/2026-06-08-codegen-dx-surfacing.md +0 -428
- package/docs/superpowers/specs/2026-04-24-kotlin-swift-codegen-design.md +0 -401
- package/docs/superpowers/specs/2026-04-25-ajsc-v7-kotlin-polish-design.md +0 -314
- package/docs/superpowers/specs/2026-04-25-swift-codegen-design.md +0 -264
- package/docs/superpowers/specs/2026-04-29-safe-result-api-design.md +0 -324
- package/docs/superpowers/specs/2026-05-07-astro-adapter-design.md +0 -252
- package/docs/superpowers/specs/2026-05-08-create-http-design.md +0 -409
- package/docs/superpowers/specs/2026-05-08-hono-app-builder-convergence-design.md +0 -411
- package/docs/superpowers/specs/2026-06-05-dx-feedback-round-design.md +0 -285
- package/docs/superpowers/specs/2026-06-08-dx-feedback-round-2-design.md +0 -376
- package/src/create-http-stream.ts +0 -191
- package/src/create-http.ts +0 -210
- package/src/create-stream.ts +0 -228
- package/src/create.ts +0 -172
- package/src/implementations/http/README.md +0 -390
- package/src/implementations/http/error-dispatch.test.ts +0 -283
- package/src/implementations/http/error-dispatch.ts +0 -176
- package/src/implementations/http/hono/handlers/http-stream.ts +0 -152
- package/src/implementations/http/hono/handlers/http.ts +0 -145
- package/src/implementations/http/hono/handlers/rpc.ts +0 -54
- package/src/implementations/http/hono/path.test.ts +0 -96
- package/src/index.ts +0 -101
- package/src/schema/extract-json-schema.test.ts +0 -25
- package/src/schema/extract-json-schema.ts +0 -15
- package/src/schema/parser.test.ts +0 -182
- package/src/schema/parser.ts +0 -265
- package/src/schema/resolve-schema-lib.test.ts +0 -19
- package/src/schema/resolve-schema-lib.ts +0 -29
- package/src/schema/types.ts +0 -20
- package/src/types.ts +0 -133
- /package/build/{implementations/http → adapters}/astro/astro-context.d.ts +0 -0
- /package/build/{implementations/http → adapters}/astro/astro-context.js +0 -0
- /package/build/{implementations/http → adapters}/astro/create-handler.d.ts +0 -0
- /package/build/{implementations/http → adapters}/astro/create-handler.js +0 -0
- /package/build/{implementations/http → adapters}/astro/index.d.ts +0 -0
- /package/build/{implementations/http → adapters}/astro/index.js +0 -0
- /package/build/{implementations/http → adapters}/astro/index.test.d.ts +0 -0
- /package/build/{implementations/http → adapters}/astro/rewrite-request.d.ts +0 -0
- /package/build/{implementations/http → adapters}/astro/rewrite-request.js +0 -0
- /package/build/{create-http-stream.test.d.ts → adapters/hono/envelope-parity.test.d.ts} +0 -0
- /package/build/{implementations/http → adapters}/hono/handlers/http-stream.test.d.ts +0 -0
- /package/build/{implementations/http → adapters}/hono/handlers/http.test.d.ts +0 -0
- /package/build/{implementations/http → adapters}/hono/handlers/rpc.test.d.ts +0 -0
- /package/build/{implementations/http → adapters}/hono/handlers/stream.test.d.ts +0 -0
- /package/build/{implementations/http → adapters}/hono/index.test.d.ts +0 -0
- /package/build/{implementations/http → adapters/hono}/on-request-error.test.d.ts +0 -0
- /package/build/{implementations/http → adapters/hono}/route-errors.test.d.ts +0 -0
- /package/build/{create-http.test.d.ts → client/freeze.test.d.ts} +0 -0
- /package/build/{create-stream.test.d.ts → codegen/goldens.test.d.ts} +0 -0
- /package/build/{create.test.d.ts → core/create-http-stream.test.d.ts} +0 -0
- /package/build/{doc-envelope.test.d.ts → core/create-http.test.d.ts} +0 -0
- /package/build/{errors.test.d.ts → core/create-stream.test.d.ts} +0 -0
- /package/build/{implementations/http/doc-registry.test.d.ts → core/create.test.d.ts} +0 -0
- /package/build/{implementations/http/error-dispatch.test.d.ts → core/definition-site.test.d.ts} +0 -0
- /package/build/{implementations/http/error-taxonomy.test.d.ts → core/errors.test.d.ts} +0 -0
- /package/build/{errors.test.js → core/errors.test.js} +0 -0
- /package/build/{implementations/http/hono/path.test.d.ts → core/factory-options.test.d.ts} +0 -0
- /package/build/{migration.test.d.ts → core/migration.test.d.ts} +0 -0
- /package/build/{index.test.d.ts → core/procedures.test.d.ts} +0 -0
- /package/build/{implementations/http/hono → core}/types.js +0 -0
- /package/build/schema/{extract-json-schema.test.d.ts → adapter.test.d.ts} +0 -0
- /package/build/schema/{parser.test.d.ts → compile.test.d.ts} +0 -0
- /package/build/schema/{resolve-schema-lib.test.d.ts → typebox.test.d.ts} +0 -0
- /package/build/{stack-utils.test.d.ts → server/context.test.d.ts} +0 -0
- /package/build/{doc-envelope.js → server/doc-envelope.js} +0 -0
- /package/build/{doc-envelope.test.js → server/doc-envelope.test.js} +0 -0
- /package/build/{implementations → server}/types.js +0 -0
- /package/src/{implementations/http → adapters}/astro/README.md +0 -0
- /package/src/{implementations/http → adapters}/astro/astro-context.ts +0 -0
- /package/src/{implementations/http → adapters}/astro/create-handler.ts +0 -0
- /package/src/{implementations/http → adapters}/astro/index.ts +0 -0
- /package/src/{implementations/http → adapters}/astro/rewrite-request.ts +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import { resolveFactoryContext } from './context.js'
|
|
3
|
+
|
|
4
|
+
describe('resolveFactoryContext', () => {
|
|
5
|
+
it('returns a plain value as-is', async () => {
|
|
6
|
+
const ctx = { db: 'x' }
|
|
7
|
+
await expect(resolveFactoryContext(ctx, { raw: true })).resolves.toBe(ctx)
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
it('invokes a sync function with the raw request context', async () => {
|
|
11
|
+
const raw = { url: '/a' }
|
|
12
|
+
await expect(
|
|
13
|
+
resolveFactoryContext((r: { url: string }) => ({ from: r.url }), raw),
|
|
14
|
+
).resolves.toEqual({ from: '/a' })
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it('awaits an async function', async () => {
|
|
18
|
+
await expect(
|
|
19
|
+
resolveFactoryContext(async () => ({ ready: true }), null),
|
|
20
|
+
).resolves.toEqual({ ready: true })
|
|
21
|
+
})
|
|
22
|
+
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A factory context as accepted by server adapters' `register()`: either the
|
|
3
|
+
* context value itself, or a function deriving it from the adapter's request
|
|
4
|
+
* context per request (sync or async).
|
|
5
|
+
*/
|
|
6
|
+
export type FactoryContextInit<TContext, TRaw> =
|
|
7
|
+
| TContext
|
|
8
|
+
| ((raw: TRaw) => TContext | Promise<TContext>)
|
|
9
|
+
|
|
10
|
+
/** Resolves a {@link FactoryContextInit} for one request. */
|
|
11
|
+
export async function resolveFactoryContext<TContext, TRaw>(
|
|
12
|
+
init: FactoryContextInit<TContext, TRaw>,
|
|
13
|
+
raw: TRaw,
|
|
14
|
+
): Promise<TContext> {
|
|
15
|
+
return typeof init === 'function'
|
|
16
|
+
? await (init as (raw: TRaw) => TContext | Promise<TContext>)(raw)
|
|
17
|
+
: init
|
|
18
|
+
}
|
|
@@ -3,12 +3,12 @@ import { readFile, rm, mkdtemp } from 'node:fs/promises'
|
|
|
3
3
|
import { tmpdir } from 'node:os'
|
|
4
4
|
import { join } from 'node:path'
|
|
5
5
|
import { writeDocEnvelope } from './doc-envelope.js'
|
|
6
|
-
import type { DocEnvelope } from './
|
|
6
|
+
import type { DocEnvelope } from './types.js'
|
|
7
7
|
|
|
8
8
|
const envelope: DocEnvelope = { basePath: '', headers: [], errors: [], routes: [] }
|
|
9
9
|
|
|
10
10
|
describe('writeDocEnvelope', () => {
|
|
11
|
-
let dir: string
|
|
11
|
+
let dir: string | undefined
|
|
12
12
|
afterEach(async () => { if (dir) await rm(dir, { recursive: true, force: true }) })
|
|
13
13
|
|
|
14
14
|
it('writes a plain DocEnvelope as pretty JSON', async () => {
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { describe, expect, it, test, vi, afterEach } from 'vitest'
|
|
2
|
-
import { v } from 'suretype'
|
|
3
2
|
import { Type } from 'typebox'
|
|
4
|
-
import { Procedures } from '
|
|
5
|
-
import {
|
|
3
|
+
import { Procedures } from '../core/procedures.js'
|
|
4
|
+
import type {
|
|
5
|
+
THttpStreamProcedureRegistration,
|
|
6
|
+
TProcedureRegistration,
|
|
7
|
+
} from '../core/types.js'
|
|
6
8
|
import { DocRegistry } from './doc-registry.js'
|
|
7
|
-
import { defineErrorTaxonomy } from './
|
|
9
|
+
import { defineErrorTaxonomy } from './errors/taxonomy.js'
|
|
10
|
+
import { buildRpcRouteDoc } from './docs/rpc-doc.js'
|
|
11
|
+
import { buildHttpStreamRouteDoc } from './docs/http-stream-doc.js'
|
|
8
12
|
import type {
|
|
9
13
|
AnyHttpRouteDoc,
|
|
10
14
|
RPCHttpRouteDoc,
|
|
@@ -13,9 +17,8 @@ import type {
|
|
|
13
17
|
StreamHttpRouteDoc,
|
|
14
18
|
HttpStreamRouteDoc,
|
|
15
19
|
DocSource,
|
|
16
|
-
DocEnvelope,
|
|
17
20
|
ErrorDoc,
|
|
18
|
-
} from '
|
|
21
|
+
} from './types.js'
|
|
19
22
|
|
|
20
23
|
// ---------------------------------------------------------------------------
|
|
21
24
|
// Helpers — minimal doc fixtures
|
|
@@ -111,17 +114,17 @@ describe('DocRegistry', () => {
|
|
|
111
114
|
expect(result).toBe(registry)
|
|
112
115
|
})
|
|
113
116
|
|
|
114
|
-
test('accepts RPC
|
|
117
|
+
test('accepts RPC doc source', () => {
|
|
115
118
|
const registry = new DocRegistry().from(makeSource([rpcDoc]))
|
|
116
119
|
expect(registry.toJSON().routes).toEqual([rpcDoc])
|
|
117
120
|
})
|
|
118
121
|
|
|
119
|
-
test('accepts API
|
|
122
|
+
test('accepts API doc source', () => {
|
|
120
123
|
const registry = new DocRegistry().from(makeSource([apiDoc]))
|
|
121
124
|
expect(registry.toJSON().routes).toEqual([apiDoc])
|
|
122
125
|
})
|
|
123
126
|
|
|
124
|
-
test('accepts Stream
|
|
127
|
+
test('accepts Stream doc source', () => {
|
|
125
128
|
const registry = new DocRegistry().from(makeSource([streamDoc]))
|
|
126
129
|
expect(registry.toJSON().routes).toEqual([streamDoc])
|
|
127
130
|
})
|
|
@@ -132,13 +135,13 @@ describe('DocRegistry', () => {
|
|
|
132
135
|
expect(registry.toJSON().routes).toHaveLength(2)
|
|
133
136
|
})
|
|
134
137
|
|
|
135
|
-
test('
|
|
138
|
+
test('source with no docs yet returns empty routes', () => {
|
|
136
139
|
const emptySource = makeSource<RPCHttpRouteDoc>([])
|
|
137
140
|
const registry = new DocRegistry().from(emptySource)
|
|
138
141
|
expect(registry.toJSON().routes).toEqual([])
|
|
139
142
|
})
|
|
140
143
|
|
|
141
|
-
test('same
|
|
144
|
+
test('same source twice duplicates routes', () => {
|
|
142
145
|
const source = makeSource([rpcDoc])
|
|
143
146
|
const registry = new DocRegistry().from(source).from(source)
|
|
144
147
|
expect(registry.toJSON().routes).toHaveLength(2)
|
|
@@ -313,7 +316,7 @@ describe('DocRegistry', () => {
|
|
|
313
316
|
})
|
|
314
317
|
|
|
315
318
|
// --------------------------------------------------------------------------
|
|
316
|
-
// taxonomy input + auto-defaults + dedupe
|
|
319
|
+
// taxonomy input + auto-defaults + dedupe
|
|
317
320
|
// --------------------------------------------------------------------------
|
|
318
321
|
describe('errors: ErrorTaxonomy (polymorphic constructor input)', () => {
|
|
319
322
|
test('accepts an ErrorTaxonomy directly and converts to ErrorDoc[]', () => {
|
|
@@ -327,8 +330,8 @@ describe('DocRegistry', () => {
|
|
|
327
330
|
const envelope = new DocRegistry({ errors: taxonomy }).toJSON()
|
|
328
331
|
const auth = envelope.errors.find((e) => e.name === 'AuthError')
|
|
329
332
|
expect(auth).toBeDefined()
|
|
330
|
-
expect(auth
|
|
331
|
-
expect(auth
|
|
333
|
+
expect(auth!.statusCode).toBe(401)
|
|
334
|
+
expect(auth!.description).toBe('unauthenticated')
|
|
332
335
|
})
|
|
333
336
|
|
|
334
337
|
test('auto-includes framework defaults when errors is a taxonomy', () => {
|
|
@@ -495,7 +498,7 @@ describe('DocRegistry', () => {
|
|
|
495
498
|
// Integration
|
|
496
499
|
// --------------------------------------------------------------------------
|
|
497
500
|
describe('integration', () => {
|
|
498
|
-
test('multiple
|
|
501
|
+
test('multiple doc kinds composed', () => {
|
|
499
502
|
const registry = new DocRegistry({
|
|
500
503
|
basePath: '/api',
|
|
501
504
|
headers: [{ name: 'Authorization', description: 'Bearer token', required: false }],
|
|
@@ -597,7 +600,10 @@ describe('DocRegistry', () => {
|
|
|
597
600
|
})
|
|
598
601
|
})
|
|
599
602
|
|
|
600
|
-
|
|
603
|
+
// v8 used a built HonoAppBuilder as the source here; the hono adapter
|
|
604
|
+
// doesn't exist yet in v9 (Phase 3), so a plain DocSource backed by the
|
|
605
|
+
// real doc builders takes its place.
|
|
606
|
+
it('aggregates http-stream routes built from a real procedure registration', () => {
|
|
601
607
|
const procs = Procedures()
|
|
602
608
|
procs.CreateHttpStream('Tail', {
|
|
603
609
|
path: '/streams/logs',
|
|
@@ -608,29 +614,29 @@ describe('DocRegistry', () => {
|
|
|
608
614
|
},
|
|
609
615
|
}, async function* () {})
|
|
610
616
|
|
|
611
|
-
const
|
|
612
|
-
|
|
617
|
+
const reg = procs.getProcedures()[0]! as THttpStreamProcedureRegistration<any>
|
|
618
|
+
const source: DocSource = { docs: [buildHttpStreamRouteDoc(reg, undefined)] }
|
|
613
619
|
|
|
614
|
-
const registry = new DocRegistry().from(
|
|
620
|
+
const registry = new DocRegistry().from(source)
|
|
615
621
|
const envelope = registry.toJSON()
|
|
616
622
|
const route = envelope.routes.find((r) => r.name === 'Tail')
|
|
617
|
-
expect(route
|
|
623
|
+
expect(route).toBeDefined()
|
|
624
|
+
expect(route!.kind).toBe('http-stream')
|
|
618
625
|
})
|
|
619
626
|
|
|
620
|
-
test('accepts a real
|
|
627
|
+
test('accepts a real RPC registration via a plain DocSource', () => {
|
|
621
628
|
const RPC = Procedures<{ userId: string }, RPCConfig>()
|
|
622
629
|
|
|
623
630
|
RPC.Create(
|
|
624
631
|
'Ping',
|
|
625
|
-
{ scope: 'ping', version: 1, schema: { params:
|
|
632
|
+
{ scope: 'ping', version: 1, schema: { params: Type.Object({ msg: Type.String() }) } },
|
|
626
633
|
async (_ctx, params) => params,
|
|
627
634
|
)
|
|
628
635
|
|
|
629
|
-
const
|
|
630
|
-
|
|
631
|
-
builder.build()
|
|
636
|
+
const reg = RPC.getProcedures()[0]! as TProcedureRegistration<any, RPCConfig>
|
|
637
|
+
const source: DocSource = { docs: [buildRpcRouteDoc(reg, undefined)] }
|
|
632
638
|
|
|
633
|
-
const registry = new DocRegistry({ basePath: '/rpc' }).from(
|
|
639
|
+
const registry = new DocRegistry({ basePath: '/rpc' }).from(source)
|
|
634
640
|
const out = registry.toJSON()
|
|
635
641
|
|
|
636
642
|
expect(out.basePath).toBe('/rpc')
|
|
@@ -6,13 +6,13 @@ import type {
|
|
|
6
6
|
DocSource,
|
|
7
7
|
ErrorDoc,
|
|
8
8
|
HeaderDoc,
|
|
9
|
-
} from '
|
|
9
|
+
} from './types.js'
|
|
10
10
|
import {
|
|
11
11
|
PROCEDURE_REGISTRATION_ERROR_DOC,
|
|
12
12
|
defaultErrorTaxonomy,
|
|
13
13
|
taxonomyToErrorDocs,
|
|
14
14
|
type ErrorTaxonomy,
|
|
15
|
-
} from './
|
|
15
|
+
} from './errors/taxonomy.js'
|
|
16
16
|
|
|
17
17
|
export type {
|
|
18
18
|
AnyHttpRouteDoc,
|
|
@@ -22,7 +22,7 @@ export type {
|
|
|
22
22
|
DocSource,
|
|
23
23
|
ErrorDoc,
|
|
24
24
|
HeaderDoc,
|
|
25
|
-
} from '
|
|
25
|
+
} from './types.js'
|
|
26
26
|
|
|
27
27
|
function isTaxonomy(input: ErrorTaxonomy | ErrorDoc[]): input is ErrorTaxonomy {
|
|
28
28
|
return !Array.isArray(input)
|
|
@@ -38,6 +38,11 @@ function dedupeByName(docs: ErrorDoc[]): ErrorDoc[] {
|
|
|
38
38
|
return Array.from(byName.values())
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* Composes route docs from multiple builders into one {@link DocEnvelope}
|
|
43
|
+
* (multi-app aggregation). Single-app users prefer `builder.toDocEnvelope()`,
|
|
44
|
+
* which wraps this class.
|
|
45
|
+
*/
|
|
41
46
|
export class DocRegistry {
|
|
42
47
|
private readonly basePath: string
|
|
43
48
|
private readonly headers: HeaderDoc[]
|
|
@@ -88,10 +93,9 @@ export class DocRegistry {
|
|
|
88
93
|
routes = routes.filter(options.filter)
|
|
89
94
|
}
|
|
90
95
|
|
|
91
|
-
// Surface coverage gaps — when a builder skipped procedures
|
|
92
|
-
//
|
|
93
|
-
//
|
|
94
|
-
// `registry.toJSON()` (e.g. to dump the envelope to disk for codegen)
|
|
96
|
+
// Surface coverage gaps — when a builder skipped procedures, the
|
|
97
|
+
// per-builder warning fires once at `build()` time, but consumers who only
|
|
98
|
+
// call `registry.toJSON()` (e.g. to dump the envelope to disk for codegen)
|
|
95
99
|
// wouldn't see it without this aggregate. Single warning per call,
|
|
96
100
|
// suppressed when the env var is set so CI pipelines stay quiet.
|
|
97
101
|
if (process.env.TS_PROCEDURES_SUPPRESS_COVERAGE_WARNINGS !== '1') {
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Doc-builder tests — ported from the doc-builder parts of v8's
|
|
3
|
+
* route-errors.test.ts (the hono-server parts arrive with the Phase 3
|
|
4
|
+
* adapter). Covers config.errors propagation onto route docs plus the
|
|
5
|
+
* core doc shapes each builder emits.
|
|
6
|
+
*/
|
|
7
|
+
import { describe, expect, test } from 'vitest'
|
|
8
|
+
import { Type } from 'typebox'
|
|
9
|
+
import { Procedures } from '../../core/procedures.js'
|
|
10
|
+
import type {
|
|
11
|
+
THttpProcedureRegistration,
|
|
12
|
+
THttpStreamProcedureRegistration,
|
|
13
|
+
TProcedureRegistration,
|
|
14
|
+
TStreamProcedureRegistration,
|
|
15
|
+
} from '../../core/types.js'
|
|
16
|
+
import type { APIConfig, RPCConfig } from '../types.js'
|
|
17
|
+
import { defineErrorTaxonomy } from '../errors/taxonomy.js'
|
|
18
|
+
import { buildRpcRouteDoc } from './rpc-doc.js'
|
|
19
|
+
import { buildStreamRouteDoc } from './stream-doc.js'
|
|
20
|
+
import { buildHttpRouteDoc } from './http-doc.js'
|
|
21
|
+
import { buildHttpStreamRouteDoc } from './http-stream-doc.js'
|
|
22
|
+
|
|
23
|
+
class UseCaseError extends Error {
|
|
24
|
+
constructor(readonly externalMsg: string) {
|
|
25
|
+
super(externalMsg)
|
|
26
|
+
this.name = 'UseCaseError'
|
|
27
|
+
Object.setPrototypeOf(this, UseCaseError.prototype)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
class AuthError extends Error {}
|
|
32
|
+
|
|
33
|
+
const appErrors = defineErrorTaxonomy({
|
|
34
|
+
UseCaseError: { class: UseCaseError, statusCode: 422 },
|
|
35
|
+
AuthError: { class: AuthError, statusCode: 401 },
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
type AppErrorKey = keyof typeof appErrors & string
|
|
39
|
+
|
|
40
|
+
// ---------------------------------------------------------------------------
|
|
41
|
+
// Fixture helpers — real registrations built through the core factory
|
|
42
|
+
// ---------------------------------------------------------------------------
|
|
43
|
+
|
|
44
|
+
function makeRpcReg(config: RPCConfig<AppErrorKey> & { schema?: { params?: unknown; returnType?: unknown } }) {
|
|
45
|
+
const RPC = Procedures<Record<string, never>, RPCConfig<AppErrorKey>>()
|
|
46
|
+
RPC.Create('DoThing', config as any, async () => ({}))
|
|
47
|
+
return RPC.getProcedures()[0]! as TProcedureRegistration<any, RPCConfig>
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function makeStreamReg(config: RPCConfig<AppErrorKey> & { schema?: { params?: unknown; yieldType?: unknown; returnType?: unknown } }) {
|
|
51
|
+
const Stream = Procedures<Record<string, never>, RPCConfig<AppErrorKey>>()
|
|
52
|
+
Stream.CreateStream('Watch', config as any, async function* () {
|
|
53
|
+
yield { ok: true }
|
|
54
|
+
})
|
|
55
|
+
return Stream.getProcedures()[0]! as TStreamProcedureRegistration<any, RPCConfig>
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// ---------------------------------------------------------------------------
|
|
59
|
+
// buildRpcRouteDoc
|
|
60
|
+
// ---------------------------------------------------------------------------
|
|
61
|
+
|
|
62
|
+
describe('buildRpcRouteDoc', () => {
|
|
63
|
+
test('copies config.errors onto the route doc', () => {
|
|
64
|
+
const reg = makeRpcReg({
|
|
65
|
+
scope: 'things',
|
|
66
|
+
version: 1,
|
|
67
|
+
errors: ['UseCaseError'],
|
|
68
|
+
schema: { params: Type.Object({}) },
|
|
69
|
+
})
|
|
70
|
+
const doc = buildRpcRouteDoc(reg, undefined)
|
|
71
|
+
expect(doc.errors).toEqual(['UseCaseError'])
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
test('omits errors when not declared', () => {
|
|
75
|
+
const reg = makeRpcReg({ scope: 'things', version: 1 })
|
|
76
|
+
const doc = buildRpcRouteDoc(reg, undefined)
|
|
77
|
+
expect(doc.errors).toBeUndefined()
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
test('emits kind, method and the rpc path (with prefix)', () => {
|
|
81
|
+
const reg = makeRpcReg({ scope: 'userThings', version: 2 })
|
|
82
|
+
const doc = buildRpcRouteDoc(reg, '/api')
|
|
83
|
+
expect(doc.kind).toBe('rpc')
|
|
84
|
+
expect(doc.method).toBe('post')
|
|
85
|
+
expect(doc.name).toBe('DoThing')
|
|
86
|
+
expect(doc.path).toBe('/api/user-things/do-thing/2')
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
test('maps schema.params → jsonSchema.body and schema.returnType → jsonSchema.response', () => {
|
|
90
|
+
const reg = makeRpcReg({
|
|
91
|
+
scope: 'things',
|
|
92
|
+
version: 1,
|
|
93
|
+
schema: {
|
|
94
|
+
params: Type.Object({ id: Type.String() }),
|
|
95
|
+
returnType: Type.Object({ ok: Type.Boolean() }),
|
|
96
|
+
},
|
|
97
|
+
})
|
|
98
|
+
const doc = buildRpcRouteDoc(reg, undefined)
|
|
99
|
+
expect(doc.jsonSchema.body).toMatchObject({ type: 'object' })
|
|
100
|
+
expect(doc.jsonSchema.response).toMatchObject({ type: 'object' })
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
test('extend() merges extra fields but base fields win', () => {
|
|
104
|
+
const reg = makeRpcReg({ scope: 'things', version: 1 })
|
|
105
|
+
const doc = buildRpcRouteDoc(reg, undefined, ({ base }) => ({
|
|
106
|
+
custom: 'extra',
|
|
107
|
+
name: `OVERRIDE-${base.name}`,
|
|
108
|
+
}))
|
|
109
|
+
expect((doc as unknown as Record<string, unknown>).custom).toBe('extra')
|
|
110
|
+
expect(doc.name).toBe('DoThing')
|
|
111
|
+
})
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
// ---------------------------------------------------------------------------
|
|
115
|
+
// buildStreamRouteDoc
|
|
116
|
+
// ---------------------------------------------------------------------------
|
|
117
|
+
|
|
118
|
+
describe('buildStreamRouteDoc', () => {
|
|
119
|
+
test('copies config.errors onto the route doc', () => {
|
|
120
|
+
const reg = makeStreamReg({ scope: 'watch', version: 1, errors: ['AuthError'] })
|
|
121
|
+
const doc = buildStreamRouteDoc(reg, 'sse', undefined)
|
|
122
|
+
expect(doc.errors).toEqual(['AuthError'])
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
test('omits errors when not declared', () => {
|
|
126
|
+
const reg = makeStreamReg({ scope: 'watch', version: 1 })
|
|
127
|
+
const doc = buildStreamRouteDoc(reg, 'sse', undefined)
|
|
128
|
+
expect(doc.errors).toBeUndefined()
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
test('emits kind, methods (post first for codegen) and streamMode', () => {
|
|
132
|
+
const reg = makeStreamReg({ scope: 'watch', version: 1 })
|
|
133
|
+
const doc = buildStreamRouteDoc(reg, 'sse', '/api')
|
|
134
|
+
expect(doc.kind).toBe('stream')
|
|
135
|
+
expect(doc.methods).toEqual(['post', 'get'])
|
|
136
|
+
expect(doc.streamMode).toBe('sse')
|
|
137
|
+
expect(doc.path).toBe('/api/watch/watch/1')
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
test('sse mode wraps yieldType in the SSE message envelope', () => {
|
|
141
|
+
const reg = makeStreamReg({
|
|
142
|
+
scope: 'watch',
|
|
143
|
+
version: 1,
|
|
144
|
+
schema: { yieldType: Type.Object({ ok: Type.Boolean() }) },
|
|
145
|
+
})
|
|
146
|
+
const doc = buildStreamRouteDoc(reg, 'sse', undefined)
|
|
147
|
+
const envelope = doc.jsonSchema.yieldType as Record<string, any>
|
|
148
|
+
expect(envelope.required).toEqual(['data', 'event', 'id'])
|
|
149
|
+
expect(envelope.properties.data).toMatchObject({ type: 'object' })
|
|
150
|
+
expect(envelope.properties.event).toEqual({ type: 'string' })
|
|
151
|
+
expect(envelope.properties.id).toEqual({ type: 'string' })
|
|
152
|
+
expect(envelope.properties.retry).toEqual({ type: 'number' })
|
|
153
|
+
})
|
|
154
|
+
|
|
155
|
+
test('text mode passes yieldType through unwrapped', () => {
|
|
156
|
+
const reg = makeStreamReg({
|
|
157
|
+
scope: 'watch',
|
|
158
|
+
version: 1,
|
|
159
|
+
schema: { yieldType: Type.Object({ ok: Type.Boolean() }) },
|
|
160
|
+
})
|
|
161
|
+
const doc = buildStreamRouteDoc(reg, 'text', undefined)
|
|
162
|
+
const yieldType = doc.jsonSchema.yieldType as Record<string, any>
|
|
163
|
+
expect(yieldType.properties.ok).toMatchObject({ type: 'boolean' })
|
|
164
|
+
expect(yieldType.properties.data).toBeUndefined()
|
|
165
|
+
})
|
|
166
|
+
})
|
|
167
|
+
|
|
168
|
+
// ---------------------------------------------------------------------------
|
|
169
|
+
// buildHttpRouteDoc
|
|
170
|
+
// ---------------------------------------------------------------------------
|
|
171
|
+
|
|
172
|
+
describe('buildHttpRouteDoc', () => {
|
|
173
|
+
function makeHttpReg() {
|
|
174
|
+
const HTTP = Procedures()
|
|
175
|
+
HTTP.CreateHttp(
|
|
176
|
+
'GetUser',
|
|
177
|
+
{
|
|
178
|
+
path: '/users/:id',
|
|
179
|
+
method: 'get',
|
|
180
|
+
scope: 'users',
|
|
181
|
+
successStatus: 200,
|
|
182
|
+
errors: ['UseCaseError'],
|
|
183
|
+
schema: {
|
|
184
|
+
req: { pathParams: Type.Object({ id: Type.String() }) },
|
|
185
|
+
res: { body: Type.Object({ id: Type.String() }) },
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
async (_ctx, req) => ({ id: req.pathParams.id }),
|
|
189
|
+
)
|
|
190
|
+
return HTTP.getProcedures()[0]! as THttpProcedureRegistration<any>
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
test('copies config.errors onto the route doc', () => {
|
|
194
|
+
const doc = buildHttpRouteDoc(makeHttpReg(), undefined)
|
|
195
|
+
expect(doc.errors).toEqual(['UseCaseError'])
|
|
196
|
+
})
|
|
197
|
+
|
|
198
|
+
test('route doc omits errors when not declared', () => {
|
|
199
|
+
const HTTP = Procedures()
|
|
200
|
+
HTTP.CreateHttp(
|
|
201
|
+
'Ping',
|
|
202
|
+
{ path: '/ping', method: 'get', schema: {} },
|
|
203
|
+
async () => {},
|
|
204
|
+
)
|
|
205
|
+
const reg = HTTP.getProcedures()[0]! as THttpProcedureRegistration<any>
|
|
206
|
+
const doc = buildHttpRouteDoc(reg, undefined)
|
|
207
|
+
expect(doc.errors).toBeUndefined()
|
|
208
|
+
})
|
|
209
|
+
|
|
210
|
+
test('resolves fullPath from prefix while keeping the registered path', () => {
|
|
211
|
+
const doc = buildHttpRouteDoc(makeHttpReg(), '/api')
|
|
212
|
+
expect(doc.kind).toBe('api')
|
|
213
|
+
expect(doc.path).toBe('/users/:id')
|
|
214
|
+
expect(doc.fullPath).toBe('/api/users/:id')
|
|
215
|
+
expect(doc.method).toBe('get')
|
|
216
|
+
expect(doc.scope).toBe('users')
|
|
217
|
+
})
|
|
218
|
+
|
|
219
|
+
test('copies successStatus and req/res channel schemas', () => {
|
|
220
|
+
const doc = buildHttpRouteDoc(makeHttpReg(), undefined)
|
|
221
|
+
expect(doc.successStatus).toBe(200)
|
|
222
|
+
expect(doc.jsonSchema.req!.pathParams).toMatchObject({ type: 'object' })
|
|
223
|
+
expect(doc.jsonSchema.res!.body).toMatchObject({ type: 'object' })
|
|
224
|
+
})
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
// ---------------------------------------------------------------------------
|
|
228
|
+
// buildHttpStreamRouteDoc
|
|
229
|
+
// ---------------------------------------------------------------------------
|
|
230
|
+
|
|
231
|
+
describe('buildHttpStreamRouteDoc', () => {
|
|
232
|
+
function makeHttpStreamReg(errors?: AppErrorKey[]) {
|
|
233
|
+
const S = Procedures()
|
|
234
|
+
S.CreateHttpStream(
|
|
235
|
+
'Tail',
|
|
236
|
+
{
|
|
237
|
+
path: '/streams/logs',
|
|
238
|
+
method: 'get',
|
|
239
|
+
errors,
|
|
240
|
+
schema: {
|
|
241
|
+
req: { query: Type.Object({ source: Type.String() }) },
|
|
242
|
+
yield: Type.Object({ line: Type.String() }),
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
async function* () {
|
|
246
|
+
yield { line: 'x' }
|
|
247
|
+
},
|
|
248
|
+
)
|
|
249
|
+
return S.getProcedures()[0]! as THttpStreamProcedureRegistration<any>
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
test('copies config.errors onto the route doc', () => {
|
|
253
|
+
const doc = buildHttpStreamRouteDoc(makeHttpStreamReg(['AuthError']), undefined)
|
|
254
|
+
expect(doc.errors).toEqual(['AuthError'])
|
|
255
|
+
})
|
|
256
|
+
|
|
257
|
+
test('omits errors when not declared', () => {
|
|
258
|
+
const doc = buildHttpStreamRouteDoc(makeHttpStreamReg(), undefined)
|
|
259
|
+
expect(doc.errors).toBeUndefined()
|
|
260
|
+
})
|
|
261
|
+
|
|
262
|
+
test('emits kind, streamMode sse, fullPath and yield schema', () => {
|
|
263
|
+
const doc = buildHttpStreamRouteDoc(makeHttpStreamReg(), '/api')
|
|
264
|
+
expect(doc.kind).toBe('http-stream')
|
|
265
|
+
expect(doc.streamMode).toBe('sse')
|
|
266
|
+
expect(doc.path).toBe('/streams/logs')
|
|
267
|
+
expect(doc.fullPath).toBe('/api/streams/logs')
|
|
268
|
+
expect(doc.jsonSchema.req!.query).toMatchObject({ type: 'object' })
|
|
269
|
+
expect(doc.jsonSchema.yield).toMatchObject({ type: 'object' })
|
|
270
|
+
})
|
|
271
|
+
})
|
|
272
|
+
|
|
273
|
+
// ---------------------------------------------------------------------------
|
|
274
|
+
// Compile-time narrowing (ported from route-errors.test.ts)
|
|
275
|
+
// ---------------------------------------------------------------------------
|
|
276
|
+
|
|
277
|
+
describe('per-route errors declaration', () => {
|
|
278
|
+
test('compile-time: errors typed as keyof taxonomy narrows valid keys', () => {
|
|
279
|
+
// TS-only: this test compiles only if the generic narrows correctly.
|
|
280
|
+
type Narrow = APIConfig<AppErrorKey>['errors']
|
|
281
|
+
const _valid: Narrow = ['UseCaseError', 'AuthError']
|
|
282
|
+
// @ts-expect-error - 'NotRegistered' is not in the taxonomy
|
|
283
|
+
const _invalid: Narrow = ['NotRegistered']
|
|
284
|
+
expect(_valid).toBeDefined()
|
|
285
|
+
expect(_invalid).toBeDefined()
|
|
286
|
+
})
|
|
287
|
+
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { THttpProcedureRegistration } from '
|
|
2
|
-
import type { APIHttpRouteDoc } from '
|
|
3
|
-
import { resolveFullPath } from '../
|
|
1
|
+
import type { THttpProcedureRegistration } from '../../core/types.js'
|
|
2
|
+
import type { APIHttpRouteDoc } from '../types.js'
|
|
3
|
+
import { resolveFullPath } from '../paths.js'
|
|
4
4
|
|
|
5
5
|
export function buildHttpRouteDoc(
|
|
6
6
|
procedure: THttpProcedureRegistration<any>,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { THttpStreamProcedureRegistration } from '
|
|
2
|
-
import type { HttpStreamRouteDoc } from '
|
|
3
|
-
import { resolveFullPath } from '../
|
|
1
|
+
import type { THttpStreamProcedureRegistration } from '../../core/types.js'
|
|
2
|
+
import type { HttpStreamRouteDoc } from '../types.js'
|
|
3
|
+
import { resolveFullPath } from '../paths.js'
|
|
4
4
|
|
|
5
5
|
export function buildHttpStreamRouteDoc(
|
|
6
6
|
procedure: THttpStreamProcedureRegistration<any>,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { TProcedureRegistration } from '
|
|
2
|
-
import type { RPCConfig, RPCHttpRouteDoc } from '
|
|
3
|
-
import { makeRoutePath } from '../
|
|
1
|
+
import type { TProcedureRegistration } from '../../core/types.js'
|
|
2
|
+
import type { RPCConfig, RPCHttpRouteDoc } from '../types.js'
|
|
3
|
+
import { makeRoutePath } from '../paths.js'
|
|
4
4
|
|
|
5
5
|
export function buildRpcRouteDoc(
|
|
6
6
|
procedure: TProcedureRegistration<any, RPCConfig>,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { TStreamProcedureRegistration } from '
|
|
2
|
-
import type { RPCConfig, StreamHttpRouteDoc, StreamMode } from '
|
|
3
|
-
import { makeRoutePath } from '../
|
|
1
|
+
import type { TStreamProcedureRegistration } from '../../core/types.js'
|
|
2
|
+
import type { RPCConfig, StreamHttpRouteDoc, StreamMode } from '../types.js'
|
|
3
|
+
import { makeRoutePath } from '../paths.js'
|
|
4
4
|
|
|
5
5
|
export function buildStreamRouteDoc(
|
|
6
6
|
procedure: TStreamProcedureRegistration<any, RPCConfig>,
|