ts-procedures 8.5.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-index.js +13 -0
- package/build/codegen/emit-index.js.map +1 -1
- package/build/codegen/emit-index.test.js +25 -0
- package/build/codegen/emit-index.test.js.map +1 -1
- package/build/codegen/emit-scope.d.ts +13 -30
- package/build/codegen/emit-scope.js +15 -807
- package/build/codegen/emit-scope.js.map +1 -1
- package/build/codegen/emit-scope.test.js +86 -4
- package/build/codegen/emit-scope.test.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 +92 -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 +83 -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/__fixtures__/users-envelope.json +9 -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-index.test.ts +34 -0
- package/src/codegen/emit-index.ts +19 -0
- package/src/codegen/emit-scope.test.ts +96 -6
- package/src/codegen/emit-scope.ts +15 -1003
- 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/__fixtures__/users-golden.kt +6 -0
- 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/__fixtures__/users-golden.swift +6 -0
- 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/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/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/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,169 @@
|
|
|
1
|
+
// Auto-generated by ts-procedures-codegen (v8.6.0) — do not edit
|
|
2
|
+
// Source hash: 7b621d913616819f78563ff671bffa03
|
|
3
|
+
import type { ClientInstance, ProcedureCallOptions, TypedStream } from './_types'
|
|
4
|
+
import type { ApiErrors } from './_errors'
|
|
5
|
+
|
|
6
|
+
export namespace Users {
|
|
7
|
+
export namespace GetUser {
|
|
8
|
+
export namespace Req {
|
|
9
|
+
export type PathParams = { id: string; }
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type Req = { pathParams: Req.PathParams }
|
|
13
|
+
|
|
14
|
+
export namespace Response {
|
|
15
|
+
export type Address = { street: string; city: string; }
|
|
16
|
+
export type Body = { id: string; name: string; "created-at": string; address: Address; }
|
|
17
|
+
}
|
|
18
|
+
export type Errors = ApiErrors.NotFound
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export namespace CreateUser {
|
|
22
|
+
export namespace Req {
|
|
23
|
+
export type Body = { kind: "guest"; displayName: string; } | { kind: "registered"; email: string; name: string; }
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type Req = { body: Req.Body }
|
|
27
|
+
|
|
28
|
+
export namespace Response {
|
|
29
|
+
export type Body = { id: string; }
|
|
30
|
+
}
|
|
31
|
+
export type Errors = ApiErrors.ValidationError
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export namespace ListUsers {
|
|
35
|
+
export namespace Req {
|
|
36
|
+
export type Query = { status?: "active" | "inactive"; limit?: number; }
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type Req = { query: Req.Query }
|
|
40
|
+
|
|
41
|
+
export namespace Response {
|
|
42
|
+
export type Item = { id: string; name: string; }
|
|
43
|
+
export type Body = { items: Array<Item>; }
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export namespace DownloadUser {
|
|
48
|
+
export namespace Req {
|
|
49
|
+
export type PathParams = { id: string; }
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type Req = { pathParams: Req.PathParams }
|
|
53
|
+
|
|
54
|
+
export namespace Response {
|
|
55
|
+
export type Body = { url: string; }
|
|
56
|
+
export type Headers = { "x-download-token": string; "content-disposition"?: string; }
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export namespace WatchUsers {
|
|
61
|
+
export namespace Req {
|
|
62
|
+
export type Query = { status?: "active" | "inactive"; }
|
|
63
|
+
}
|
|
64
|
+
export type Req = { query: Req.Query }
|
|
65
|
+
export namespace Response {
|
|
66
|
+
export type Headers = { "x-stream-id": string; }
|
|
67
|
+
}
|
|
68
|
+
export type Yield = { id: string; event: "created" | "updated" | "deleted"; }
|
|
69
|
+
export type ReturnType = { count: number; }
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Binds every callable in this scope to a configured client. */
|
|
73
|
+
export function bindScope(client: ClientInstance) {
|
|
74
|
+
return {
|
|
75
|
+
/**
|
|
76
|
+
* GET /users/:id
|
|
77
|
+
*
|
|
78
|
+
* @param options Optional per-call {@link ProcedureCallOptions} —
|
|
79
|
+
* `signal` (cancel on dispose), `timeout`, `headers`, `basePath`.
|
|
80
|
+
* @throws Declared typed errors: {@link Users.GetUser.Errors}. Narrow with
|
|
81
|
+
* `instanceof` on the throwing path, or call `.safe()` for a `Result`.
|
|
82
|
+
*/
|
|
83
|
+
GetUser: client.bindCallableTyped<Users.GetUser.Req, Users.GetUser.Response.Body, Users.GetUser.Errors>({
|
|
84
|
+
name: 'GetUser',
|
|
85
|
+
scope: 'users',
|
|
86
|
+
path: '/users/:id',
|
|
87
|
+
method: 'GET',
|
|
88
|
+
kind: 'api',
|
|
89
|
+
}),
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* POST /users
|
|
93
|
+
*
|
|
94
|
+
* @param options Optional per-call {@link ProcedureCallOptions} —
|
|
95
|
+
* `signal` (cancel on dispose), `timeout`, `headers`, `basePath`.
|
|
96
|
+
* @throws Declared typed errors: {@link Users.CreateUser.Errors}. Narrow with
|
|
97
|
+
* `instanceof` on the throwing path, or call `.safe()` for a `Result`.
|
|
98
|
+
*/
|
|
99
|
+
CreateUser: client.bindCallableTyped<Users.CreateUser.Req, Users.CreateUser.Response.Body, Users.CreateUser.Errors>({
|
|
100
|
+
name: 'CreateUser',
|
|
101
|
+
scope: 'users',
|
|
102
|
+
path: '/users',
|
|
103
|
+
method: 'POST',
|
|
104
|
+
kind: 'api',
|
|
105
|
+
}),
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* GET /users
|
|
109
|
+
*
|
|
110
|
+
* @param options Optional per-call {@link ProcedureCallOptions} —
|
|
111
|
+
* `signal` (cancel on dispose), `timeout`, `headers`, `basePath`.
|
|
112
|
+
*/
|
|
113
|
+
ListUsers: client.bindCallable<Users.ListUsers.Req, Users.ListUsers.Response.Body>({
|
|
114
|
+
name: 'ListUsers',
|
|
115
|
+
scope: 'users',
|
|
116
|
+
path: '/users',
|
|
117
|
+
method: 'GET',
|
|
118
|
+
kind: 'api',
|
|
119
|
+
}),
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* GET /users/:id/download
|
|
123
|
+
*
|
|
124
|
+
* @param options Optional per-call {@link ProcedureCallOptions} —
|
|
125
|
+
* `signal` (cancel on dispose), `timeout`, `headers`, `basePath`.
|
|
126
|
+
*/
|
|
127
|
+
DownloadUser: client.bindCallable<Users.DownloadUser.Req, { body: Users.DownloadUser.Response.Body; headers: Users.DownloadUser.Response.Headers }>({
|
|
128
|
+
name: 'DownloadUser',
|
|
129
|
+
scope: 'users',
|
|
130
|
+
path: '/users/:id/download',
|
|
131
|
+
method: 'GET',
|
|
132
|
+
kind: 'api',
|
|
133
|
+
responseHeadersDeclared: true,
|
|
134
|
+
}),
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* GET /users/watch
|
|
138
|
+
*
|
|
139
|
+
* @param options Optional per-call {@link ProcedureCallOptions} —
|
|
140
|
+
* `signal` (cancel on dispose), `timeout`, `headers`, `basePath`.
|
|
141
|
+
*/
|
|
142
|
+
WatchUsers(req: Users.WatchUsers.Req, options?: ProcedureCallOptions): TypedStream<Users.WatchUsers.Yield, Users.WatchUsers.ReturnType> {
|
|
143
|
+
return client.stream<Users.WatchUsers.Yield, Users.WatchUsers.ReturnType>({
|
|
144
|
+
name: 'WatchUsers',
|
|
145
|
+
scope: 'users',
|
|
146
|
+
path: '/users/watch',
|
|
147
|
+
method: 'GET',
|
|
148
|
+
kind: 'http-stream',
|
|
149
|
+
streamMode: 'sse',
|
|
150
|
+
params: req,
|
|
151
|
+
}, options)
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* GET /users/heartbeat
|
|
156
|
+
*
|
|
157
|
+
* @param options Optional per-call {@link ProcedureCallOptions} —
|
|
158
|
+
* `signal` (cancel on dispose), `timeout`, `headers`, `basePath`.
|
|
159
|
+
*/
|
|
160
|
+
Heartbeat: client.bindCallable<void, void>({
|
|
161
|
+
name: 'Heartbeat',
|
|
162
|
+
scope: 'users',
|
|
163
|
+
path: '/users/heartbeat',
|
|
164
|
+
method: 'GET',
|
|
165
|
+
kind: 'api',
|
|
166
|
+
}),
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// Auto-generated by ts-procedures-codegen (v8.6.0) — do not edit
|
|
2
|
+
// Source hash: cb5f789247045d83e6eb2611821116bb
|
|
3
|
+
|
|
4
|
+
export namespace ApiErrors {
|
|
5
|
+
/** Base class for every generated error in this service. Catch with `instanceof`. */
|
|
6
|
+
export class ApiProcedureError<TBody = unknown> extends Error {
|
|
7
|
+
readonly status: number
|
|
8
|
+
readonly procedureName: string
|
|
9
|
+
readonly scope: string
|
|
10
|
+
readonly body: TBody
|
|
11
|
+
constructor(args: {
|
|
12
|
+
name: string
|
|
13
|
+
message: string
|
|
14
|
+
status: number
|
|
15
|
+
procedureName: string
|
|
16
|
+
scope: string
|
|
17
|
+
body: TBody
|
|
18
|
+
}) {
|
|
19
|
+
super(args.message)
|
|
20
|
+
this.name = args.name
|
|
21
|
+
this.status = args.status
|
|
22
|
+
this.procedureName = args.procedureName
|
|
23
|
+
this.scope = args.scope
|
|
24
|
+
this.body = args.body
|
|
25
|
+
Object.setPrototypeOf(this, new.target.prototype)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Response body for NotFound. */
|
|
30
|
+
export type NotFoundBody = { name: "NotFound"; message: string; }
|
|
31
|
+
|
|
32
|
+
/** Resource not found (HTTP 404) */
|
|
33
|
+
export class NotFound extends ApiProcedureError<NotFoundBody> {
|
|
34
|
+
static readonly errorName = 'NotFound' as const
|
|
35
|
+
static readonly statusCode = 404
|
|
36
|
+
static fromResponse(
|
|
37
|
+
body: NotFoundBody,
|
|
38
|
+
meta: { status: number; procedureName: string; scope: string }
|
|
39
|
+
): NotFound {
|
|
40
|
+
const message =
|
|
41
|
+
body && typeof (body as { message?: unknown }).message === 'string'
|
|
42
|
+
? (body as { message: string }).message
|
|
43
|
+
: 'NotFound'
|
|
44
|
+
return new NotFound({
|
|
45
|
+
name: 'NotFound',
|
|
46
|
+
message,
|
|
47
|
+
status: meta.status,
|
|
48
|
+
procedureName: meta.procedureName,
|
|
49
|
+
scope: meta.scope,
|
|
50
|
+
body,
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Response body for OrderRejected. */
|
|
56
|
+
export type OrderRejectedBody = { name: "OrderRejected"; message: string; reason: "out-of-stock" | "fraud" | "limit"; }
|
|
57
|
+
|
|
58
|
+
/** The order could not be accepted (HTTP 422) */
|
|
59
|
+
export class OrderRejected extends ApiProcedureError<OrderRejectedBody> {
|
|
60
|
+
static readonly errorName = 'OrderRejected' as const
|
|
61
|
+
static readonly statusCode = 422
|
|
62
|
+
static fromResponse(
|
|
63
|
+
body: OrderRejectedBody,
|
|
64
|
+
meta: { status: number; procedureName: string; scope: string }
|
|
65
|
+
): OrderRejected {
|
|
66
|
+
const message =
|
|
67
|
+
body && typeof (body as { message?: unknown }).message === 'string'
|
|
68
|
+
? (body as { message: string }).message
|
|
69
|
+
: 'OrderRejected'
|
|
70
|
+
return new OrderRejected({
|
|
71
|
+
name: 'OrderRejected',
|
|
72
|
+
message,
|
|
73
|
+
status: meta.status,
|
|
74
|
+
procedureName: meta.procedureName,
|
|
75
|
+
scope: meta.scope,
|
|
76
|
+
body,
|
|
77
|
+
})
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Union of every generated error in this service. */
|
|
82
|
+
export type ApiProcedureErrorUnion = NotFound | OrderRejected
|
|
83
|
+
|
|
84
|
+
/** Runtime registry consumed by the client to dispatch by `body.name`. */
|
|
85
|
+
export const ApiErrorRegistry = {
|
|
86
|
+
NotFound,
|
|
87
|
+
OrderRejected,
|
|
88
|
+
} as const
|
|
89
|
+
|
|
90
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Auto-generated by ts-procedures-codegen (v8.6.0) — do not edit
|
|
2
|
+
// Source hash: cb5f789247045d83e6eb2611821116bb
|
|
3
|
+
|
|
4
|
+
export type Customer = { id: string; name: string; balance: Money; }
|
|
5
|
+
|
|
6
|
+
export type Money = { amount: number; currency: string; }
|
|
7
|
+
|
|
8
|
+
export type OrderEvent = { orderId: string; status: "created" | "paid" | "shipped"; total: Money; }
|
|
9
|
+
|
|
10
|
+
export type Invoice = { id: string; total: Money; customer: Customer; }
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Auto-generated by ts-procedures-codegen (v8.6.0) — do not edit
|
|
2
|
+
// Source hash: cb5f789247045d83e6eb2611821116bb
|
|
3
|
+
import type { ClientInstance, ProcedureCallOptions } from 'ts-procedures/client'
|
|
4
|
+
|
|
5
|
+
export namespace BillingReports {
|
|
6
|
+
export namespace GenerateReport {
|
|
7
|
+
export type Params = { month: string; }
|
|
8
|
+
export type Response = { url: string; }
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** Binds every callable in this scope to a configured client. */
|
|
12
|
+
export function bindScope(client: ClientInstance) {
|
|
13
|
+
return {
|
|
14
|
+
/**
|
|
15
|
+
* POST /billing-reports/generate-report/1
|
|
16
|
+
*
|
|
17
|
+
* @param options Optional per-call {@link ProcedureCallOptions} —
|
|
18
|
+
* `signal` (cancel on dispose), `timeout`, `headers`, `basePath`.
|
|
19
|
+
*/
|
|
20
|
+
GenerateReport: client.bindCallable<BillingReports.GenerateReport.Params, BillingReports.GenerateReport.Response>({
|
|
21
|
+
name: 'GenerateReport',
|
|
22
|
+
scope: 'billing-reports',
|
|
23
|
+
path: '/billing-reports/generate-report/1',
|
|
24
|
+
method: 'post',
|
|
25
|
+
kind: 'rpc',
|
|
26
|
+
}),
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Auto-generated by ts-procedures-codegen (v8.6.0) — do not edit
|
|
2
|
+
// Source hash: cb5f789247045d83e6eb2611821116bb
|
|
3
|
+
import type { ClientInstance, ProcedureCallOptions } from 'ts-procedures/client'
|
|
4
|
+
import type { ApiErrors } from './_errors'
|
|
5
|
+
import type { Invoice } from './_models'
|
|
6
|
+
|
|
7
|
+
export namespace Billing {
|
|
8
|
+
export namespace GetInvoice {
|
|
9
|
+
export namespace Req {
|
|
10
|
+
export type PathParams = { id: string; }
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type Req = { pathParams: Req.PathParams }
|
|
14
|
+
|
|
15
|
+
export namespace Response {
|
|
16
|
+
export type Body = Invoice
|
|
17
|
+
}
|
|
18
|
+
export type Errors = ApiErrors.NotFound
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export namespace ListInvoices {
|
|
22
|
+
export namespace Req {
|
|
23
|
+
export type Query = { status?: "open" | "paid"; limit?: number; }
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type Req = { query: Req.Query }
|
|
27
|
+
|
|
28
|
+
export namespace Response {
|
|
29
|
+
export type Body = { items: Array<Invoice>; }
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Binds every callable in this scope to a configured client. */
|
|
34
|
+
export function bindScope(client: ClientInstance) {
|
|
35
|
+
return {
|
|
36
|
+
/**
|
|
37
|
+
* GET /billing/invoices/:id
|
|
38
|
+
*
|
|
39
|
+
* @param options Optional per-call {@link ProcedureCallOptions} —
|
|
40
|
+
* `signal` (cancel on dispose), `timeout`, `headers`, `basePath`.
|
|
41
|
+
* @throws Declared typed errors: {@link Billing.GetInvoice.Errors}. Narrow with
|
|
42
|
+
* `instanceof` on the throwing path, or call `.safe()` for a `Result`.
|
|
43
|
+
*/
|
|
44
|
+
GetInvoice: client.bindCallableTyped<Billing.GetInvoice.Req, Billing.GetInvoice.Response.Body, Billing.GetInvoice.Errors>({
|
|
45
|
+
name: 'GetInvoice',
|
|
46
|
+
scope: 'billing',
|
|
47
|
+
path: '/billing/invoices/:id',
|
|
48
|
+
method: 'GET',
|
|
49
|
+
kind: 'api',
|
|
50
|
+
}),
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* GET /billing/invoices
|
|
54
|
+
*
|
|
55
|
+
* @param options Optional per-call {@link ProcedureCallOptions} —
|
|
56
|
+
* `signal` (cancel on dispose), `timeout`, `headers`, `basePath`.
|
|
57
|
+
*/
|
|
58
|
+
ListInvoices: client.bindCallable<Billing.ListInvoices.Req, Billing.ListInvoices.Response.Body>({
|
|
59
|
+
name: 'ListInvoices',
|
|
60
|
+
scope: 'billing',
|
|
61
|
+
path: '/billing/invoices',
|
|
62
|
+
method: 'GET',
|
|
63
|
+
kind: 'api',
|
|
64
|
+
}),
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Auto-generated by ts-procedures-codegen (v8.6.0) — do not edit
|
|
2
|
+
// Source hash: cb5f789247045d83e6eb2611821116bb
|
|
3
|
+
import { createClient } from 'ts-procedures/client'
|
|
4
|
+
import type { ClientInstance, CreateClientConfig } from 'ts-procedures/client'
|
|
5
|
+
import * as _orders from './orders'
|
|
6
|
+
import * as _billing from './billing'
|
|
7
|
+
import * as _billingReports from './billing-reports'
|
|
8
|
+
import * as _errorsModule from './_errors'
|
|
9
|
+
|
|
10
|
+
export namespace Api {
|
|
11
|
+
export import Orders = _orders.Orders
|
|
12
|
+
export import Billing = _billing.Billing
|
|
13
|
+
export import BillingReports = _billingReports.BillingReports
|
|
14
|
+
export import Errors = _errorsModule.ApiErrors
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function createApiBindings(client: ClientInstance) {
|
|
18
|
+
return {
|
|
19
|
+
orders: _orders.Orders.bindScope(client),
|
|
20
|
+
billing: _billing.Billing.bindScope(client),
|
|
21
|
+
billingReports: _billingReports.BillingReports.bindScope(client),
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Full typed client surface — every scope of `Api`. */
|
|
26
|
+
export type ApiClient = ReturnType<typeof createApiBindings>
|
|
27
|
+
/** Narrow port for the `orders` scope — inject as a DI seam without casting the aggregate client. */
|
|
28
|
+
export type OrdersClient = ApiClient['orders']
|
|
29
|
+
/** Narrow port for the `billing` scope — inject as a DI seam without casting the aggregate client. */
|
|
30
|
+
export type BillingClient = ApiClient['billing']
|
|
31
|
+
/** Narrow port for the `billingReports` scope — inject as a DI seam without casting the aggregate client. */
|
|
32
|
+
export type BillingReportsClient = ApiClient['billingReports']
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Creates a typed client for this service with the generated error
|
|
36
|
+
* registry pre-configured. Non-2xx responses whose body `name` matches
|
|
37
|
+
* a registered error are thrown as typed class instances instead of
|
|
38
|
+
* generic `ClientHttpError`s.
|
|
39
|
+
*/
|
|
40
|
+
export function createApiClient(
|
|
41
|
+
config: Omit<CreateClientConfig<ReturnType<typeof createApiBindings>>, 'scopes' | 'errorRegistry'>
|
|
42
|
+
) {
|
|
43
|
+
return createClient({
|
|
44
|
+
...config,
|
|
45
|
+
errorRegistry: _errorsModule.ApiErrors.ApiErrorRegistry,
|
|
46
|
+
scopes: (client) => createApiBindings(client),
|
|
47
|
+
})
|
|
48
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// Auto-generated by ts-procedures-codegen (v8.6.0) — do not edit
|
|
2
|
+
// Source hash: cb5f789247045d83e6eb2611821116bb
|
|
3
|
+
import type { ClientInstance, ProcedureCallOptions, TypedStream } from 'ts-procedures/client'
|
|
4
|
+
import type { ApiErrors } from './_errors'
|
|
5
|
+
import type { Customer, Money, OrderEvent } from './_models'
|
|
6
|
+
|
|
7
|
+
export namespace Orders {
|
|
8
|
+
export namespace GetOrder {
|
|
9
|
+
export type Params = { orderId: string; }
|
|
10
|
+
export type Response = Customer
|
|
11
|
+
export type Errors = ApiErrors.OrderRejected
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export namespace SubmitOrder {
|
|
15
|
+
export type Params = { orderId: string; total: Money; }
|
|
16
|
+
export type Response = { ok: boolean; }
|
|
17
|
+
export type Errors = ApiErrors.OrderRejected
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export namespace WatchOrders {
|
|
21
|
+
export type Params = { orderId: string; }
|
|
22
|
+
export type Yield = OrderEvent
|
|
23
|
+
export type Return = { total: number; }
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Binds every callable in this scope to a configured client. */
|
|
27
|
+
export function bindScope(client: ClientInstance) {
|
|
28
|
+
return {
|
|
29
|
+
/**
|
|
30
|
+
* POST /orders/get-order/1
|
|
31
|
+
*
|
|
32
|
+
* @param options Optional per-call {@link ProcedureCallOptions} —
|
|
33
|
+
* `signal` (cancel on dispose), `timeout`, `headers`, `basePath`.
|
|
34
|
+
* @throws Declared typed errors: {@link Orders.GetOrder.Errors}. Narrow with
|
|
35
|
+
* `instanceof` on the throwing path, or call `.safe()` for a `Result`.
|
|
36
|
+
*/
|
|
37
|
+
GetOrder: client.bindCallableTyped<Orders.GetOrder.Params, Orders.GetOrder.Response, Orders.GetOrder.Errors>({
|
|
38
|
+
name: 'GetOrder',
|
|
39
|
+
scope: 'orders',
|
|
40
|
+
path: '/orders/get-order/1',
|
|
41
|
+
method: 'post',
|
|
42
|
+
kind: 'rpc',
|
|
43
|
+
}),
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* POST /orders/submit-order/1
|
|
47
|
+
*
|
|
48
|
+
* @param options Optional per-call {@link ProcedureCallOptions} —
|
|
49
|
+
* `signal` (cancel on dispose), `timeout`, `headers`, `basePath`.
|
|
50
|
+
* @throws Declared typed errors: {@link Orders.SubmitOrder.Errors}. Narrow with
|
|
51
|
+
* `instanceof` on the throwing path, or call `.safe()` for a `Result`.
|
|
52
|
+
*/
|
|
53
|
+
SubmitOrder: client.bindCallableTyped<Orders.SubmitOrder.Params, Orders.SubmitOrder.Response, Orders.SubmitOrder.Errors>({
|
|
54
|
+
name: 'SubmitOrder',
|
|
55
|
+
scope: 'orders',
|
|
56
|
+
path: '/orders/submit-order/1',
|
|
57
|
+
method: 'post',
|
|
58
|
+
kind: 'rpc',
|
|
59
|
+
}),
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* POST|GET /orders/watch-orders/1
|
|
63
|
+
*
|
|
64
|
+
* @param options Optional per-call {@link ProcedureCallOptions} —
|
|
65
|
+
* `signal` (cancel on dispose), `timeout`, `headers`, `basePath`.
|
|
66
|
+
*/
|
|
67
|
+
WatchOrders(params: Orders.WatchOrders.Params, options?: ProcedureCallOptions): TypedStream<Orders.WatchOrders.Yield, Orders.WatchOrders.Return> {
|
|
68
|
+
return client.stream<Orders.WatchOrders.Yield, Orders.WatchOrders.Return>({
|
|
69
|
+
name: 'WatchOrders',
|
|
70
|
+
scope: 'orders',
|
|
71
|
+
path: '/orders/watch-orders/1',
|
|
72
|
+
method: 'post',
|
|
73
|
+
kind: 'stream',
|
|
74
|
+
streamMode: 'sse',
|
|
75
|
+
params,
|
|
76
|
+
}, options)
|
|
77
|
+
},
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// Auto-generated by ts-procedures-codegen (v8.6.0) — do not edit
|
|
2
|
+
// Source hash: 7b621d913616819f78563ff671bffa03
|
|
3
|
+
|
|
4
|
+
export namespace ApiErrors {
|
|
5
|
+
/** Base class for every generated error in this service. Catch with `instanceof`. */
|
|
6
|
+
export class ApiProcedureError<TBody = unknown> extends Error {
|
|
7
|
+
readonly status: number
|
|
8
|
+
readonly procedureName: string
|
|
9
|
+
readonly scope: string
|
|
10
|
+
readonly body: TBody
|
|
11
|
+
constructor(args: {
|
|
12
|
+
name: string
|
|
13
|
+
message: string
|
|
14
|
+
status: number
|
|
15
|
+
procedureName: string
|
|
16
|
+
scope: string
|
|
17
|
+
body: TBody
|
|
18
|
+
}) {
|
|
19
|
+
super(args.message)
|
|
20
|
+
this.name = args.name
|
|
21
|
+
this.status = args.status
|
|
22
|
+
this.procedureName = args.procedureName
|
|
23
|
+
this.scope = args.scope
|
|
24
|
+
this.body = args.body
|
|
25
|
+
Object.setPrototypeOf(this, new.target.prototype)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Response body for NotFound. */
|
|
30
|
+
export type NotFoundBody = { name: "NotFound"; message: string; }
|
|
31
|
+
|
|
32
|
+
/** Resource not found (HTTP 404) */
|
|
33
|
+
export class NotFound extends ApiProcedureError<NotFoundBody> {
|
|
34
|
+
static readonly errorName = 'NotFound' as const
|
|
35
|
+
static readonly statusCode = 404
|
|
36
|
+
static fromResponse(
|
|
37
|
+
body: NotFoundBody,
|
|
38
|
+
meta: { status: number; procedureName: string; scope: string }
|
|
39
|
+
): NotFound {
|
|
40
|
+
const message =
|
|
41
|
+
body && typeof (body as { message?: unknown }).message === 'string'
|
|
42
|
+
? (body as { message: string }).message
|
|
43
|
+
: 'NotFound'
|
|
44
|
+
return new NotFound({
|
|
45
|
+
name: 'NotFound',
|
|
46
|
+
message,
|
|
47
|
+
status: meta.status,
|
|
48
|
+
procedureName: meta.procedureName,
|
|
49
|
+
scope: meta.scope,
|
|
50
|
+
body,
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Response body for ValidationError. */
|
|
56
|
+
export type ValidationErrorBody = { name: "ValidationError"; message: string; field?: string; }
|
|
57
|
+
|
|
58
|
+
/** Input failed validation (HTTP 400) */
|
|
59
|
+
export class ValidationError extends ApiProcedureError<ValidationErrorBody> {
|
|
60
|
+
static readonly errorName = 'ValidationError' as const
|
|
61
|
+
static readonly statusCode = 400
|
|
62
|
+
static fromResponse(
|
|
63
|
+
body: ValidationErrorBody,
|
|
64
|
+
meta: { status: number; procedureName: string; scope: string }
|
|
65
|
+
): ValidationError {
|
|
66
|
+
const message =
|
|
67
|
+
body && typeof (body as { message?: unknown }).message === 'string'
|
|
68
|
+
? (body as { message: string }).message
|
|
69
|
+
: 'ValidationError'
|
|
70
|
+
return new ValidationError({
|
|
71
|
+
name: 'ValidationError',
|
|
72
|
+
message,
|
|
73
|
+
status: meta.status,
|
|
74
|
+
procedureName: meta.procedureName,
|
|
75
|
+
scope: meta.scope,
|
|
76
|
+
body,
|
|
77
|
+
})
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Union of every generated error in this service. */
|
|
82
|
+
export type ApiProcedureErrorUnion = NotFound | ValidationError
|
|
83
|
+
|
|
84
|
+
/** Runtime registry consumed by the client to dispatch by `body.name`. */
|
|
85
|
+
export const ApiErrorRegistry = {
|
|
86
|
+
NotFound,
|
|
87
|
+
ValidationError,
|
|
88
|
+
} as const
|
|
89
|
+
|
|
90
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Auto-generated by ts-procedures-codegen (v8.6.0) — do not edit
|
|
2
|
+
// Source hash: 7b621d913616819f78563ff671bffa03
|
|
3
|
+
import { createClient } from 'ts-procedures/client'
|
|
4
|
+
import type { ClientInstance, CreateClientConfig } from 'ts-procedures/client'
|
|
5
|
+
import * as _users from './users'
|
|
6
|
+
import * as _errorsModule from './_errors'
|
|
7
|
+
|
|
8
|
+
export namespace Api {
|
|
9
|
+
export import Users = _users.Users
|
|
10
|
+
export import Errors = _errorsModule.ApiErrors
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function createApiBindings(client: ClientInstance) {
|
|
14
|
+
return {
|
|
15
|
+
users: _users.Users.bindScope(client),
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Full typed client surface — every scope of `Api`. */
|
|
20
|
+
export type ApiClient = ReturnType<typeof createApiBindings>
|
|
21
|
+
/** Narrow port for the `users` scope — inject as a DI seam without casting the aggregate client. */
|
|
22
|
+
export type UsersClient = ApiClient['users']
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Creates a typed client for this service with the generated error
|
|
26
|
+
* registry pre-configured. Non-2xx responses whose body `name` matches
|
|
27
|
+
* a registered error are thrown as typed class instances instead of
|
|
28
|
+
* generic `ClientHttpError`s.
|
|
29
|
+
*/
|
|
30
|
+
export function createApiClient(
|
|
31
|
+
config: Omit<CreateClientConfig<ReturnType<typeof createApiBindings>>, 'scopes' | 'errorRegistry'>
|
|
32
|
+
) {
|
|
33
|
+
return createClient({
|
|
34
|
+
...config,
|
|
35
|
+
errorRegistry: _errorsModule.ApiErrors.ApiErrorRegistry,
|
|
36
|
+
scopes: (client) => createApiBindings(client),
|
|
37
|
+
})
|
|
38
|
+
}
|