ts-procedures 7.3.0 → 8.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 +65 -3
- package/agent_config/claude-code/agents/ts-procedures-architect.md +6 -8
- package/agent_config/claude-code/skills/ts-procedures/SKILL.md +30 -33
- package/agent_config/claude-code/skills/ts-procedures/anti-patterns.md +104 -53
- package/agent_config/claude-code/skills/ts-procedures/api-reference.md +205 -232
- package/agent_config/claude-code/skills/ts-procedures/patterns.md +80 -153
- package/agent_config/claude-code/skills/ts-procedures-review/SKILL.md +1 -1
- package/agent_config/claude-code/skills/ts-procedures-review/checklist.md +4 -5
- package/agent_config/claude-code/skills/ts-procedures-scaffold/SKILL.md +4 -7
- package/agent_config/claude-code/skills/ts-procedures-scaffold/templates/hono.md +223 -0
- package/agent_config/copilot/copilot-instructions.md +34 -48
- package/agent_config/cursor/cursorrules +34 -48
- package/build/client/call.js +4 -1
- package/build/client/call.js.map +1 -1
- package/build/client/call.test.js +23 -0
- package/build/client/call.test.js.map +1 -1
- package/build/client/fetch-adapter.js +3 -1
- package/build/client/fetch-adapter.js.map +1 -1
- package/build/client/fetch-adapter.test.js +11 -1
- package/build/client/fetch-adapter.test.js.map +1 -1
- package/build/client/index.test.js +7 -7
- package/build/client/index.test.js.map +1 -1
- package/build/client/request-builder.d.ts +1 -1
- package/build/client/request-builder.js +2 -2
- package/build/client/request-builder.js.map +1 -1
- package/build/client/stream.js +13 -2
- package/build/client/stream.js.map +1 -1
- package/build/client/stream.test.js +32 -7
- package/build/client/stream.test.js.map +1 -1
- package/build/client/typed-error-dispatch.test.js +8 -92
- package/build/client/typed-error-dispatch.test.js.map +1 -1
- package/build/client/types.d.ts +21 -3
- package/build/codegen/bin/cli.js +0 -0
- package/build/codegen/e2e.test.js +87 -23
- package/build/codegen/e2e.test.js.map +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.js +308 -47
- package/build/codegen/emit-scope.js.map +1 -1
- package/build/codegen/emit-scope.test.js +363 -110
- package/build/codegen/emit-scope.test.js.map +1 -1
- package/build/codegen/pipeline.test.js +7 -7
- package/build/codegen/pipeline.test.js.map +1 -1
- package/build/codegen/resolve-envelope.js +1 -1
- package/build/codegen/resolve-envelope.js.map +1 -1
- package/build/codegen/resolve-envelope.test.js +5 -5
- package/build/codegen/resolve-envelope.test.js.map +1 -1
- package/build/codegen/targets/_shared/route-slots.d.ts +8 -3
- package/build/codegen/targets/_shared/route-slots.js +49 -8
- package/build/codegen/targets/_shared/route-slots.js.map +1 -1
- package/build/codegen/targets/_shared/route-slots.test.js +99 -26
- package/build/codegen/targets/_shared/route-slots.test.js.map +1 -1
- package/build/codegen/targets/kotlin/emit-route-kotlin.test.js +88 -17
- package/build/codegen/targets/kotlin/emit-route-kotlin.test.js.map +1 -1
- package/build/codegen/targets/kotlin/emit-scope-kotlin.test.js +9 -6
- package/build/codegen/targets/kotlin/emit-scope-kotlin.test.js.map +1 -1
- package/build/codegen/targets/kotlin/integration.test.js +6 -0
- package/build/codegen/targets/kotlin/integration.test.js.map +1 -1
- package/build/codegen/targets/swift/access-level.test.js +8 -11
- package/build/codegen/targets/swift/access-level.test.js.map +1 -1
- package/build/codegen/targets/swift/emit-route-swift.test.js +91 -20
- package/build/codegen/targets/swift/emit-route-swift.test.js.map +1 -1
- package/build/codegen/targets/swift/emit-scope-swift.test.js +12 -9
- package/build/codegen/targets/swift/emit-scope-swift.test.js.map +1 -1
- package/build/codegen/targets/swift/integration.test.js +6 -0
- package/build/codegen/targets/swift/integration.test.js.map +1 -1
- package/build/create-http-stream.d.ts +58 -0
- package/build/create-http-stream.js +122 -0
- package/build/create-http-stream.js.map +1 -0
- package/build/create-http-stream.test.js +88 -0
- package/build/create-http-stream.test.js.map +1 -0
- package/build/create-http.d.ts +49 -0
- package/build/create-http.js +108 -0
- package/build/create-http.js.map +1 -0
- package/build/create-http.test.js +137 -0
- package/build/create-http.test.js.map +1 -0
- package/build/create-stream.d.ts +35 -0
- package/build/create-stream.js +123 -0
- package/build/create-stream.js.map +1 -0
- package/build/create-stream.test.js +428 -0
- package/build/create-stream.test.js.map +1 -0
- package/build/create.d.ts +28 -0
- package/build/create.js +82 -0
- package/build/create.js.map +1 -0
- package/build/create.test.js +483 -0
- package/build/create.test.js.map +1 -0
- package/build/exports.d.ts +2 -0
- package/build/implementations/http/astro/index.test.js +20 -12
- package/build/implementations/http/astro/index.test.js.map +1 -1
- package/build/implementations/http/doc-registry.js +1 -1
- package/build/implementations/http/doc-registry.js.map +1 -1
- package/build/implementations/http/doc-registry.test.js +36 -5
- package/build/implementations/http/doc-registry.test.js.map +1 -1
- package/build/implementations/http/error-dispatch.d.ts +76 -0
- package/build/implementations/http/error-dispatch.js +77 -0
- package/build/implementations/http/error-dispatch.js.map +1 -0
- package/build/implementations/http/error-dispatch.test.js +254 -0
- package/build/implementations/http/error-dispatch.test.js.map +1 -0
- package/build/implementations/http/error-taxonomy.d.ts +5 -5
- package/build/implementations/http/hono/docs/http-doc.d.ts +6 -0
- package/build/implementations/http/hono/docs/http-doc.js +42 -0
- package/build/implementations/http/hono/docs/http-doc.js.map +1 -0
- package/build/implementations/http/hono/docs/http-stream-doc.d.ts +6 -0
- package/build/implementations/http/hono/docs/http-stream-doc.js +40 -0
- package/build/implementations/http/hono/docs/http-stream-doc.js.map +1 -0
- package/build/implementations/http/hono/docs/rpc-doc.d.ts +6 -0
- package/build/implementations/http/hono/docs/rpc-doc.js +24 -0
- package/build/implementations/http/hono/docs/rpc-doc.js.map +1 -0
- package/build/implementations/http/hono/docs/stream-doc.d.ts +6 -0
- package/build/implementations/http/hono/docs/stream-doc.js +42 -0
- package/build/implementations/http/hono/docs/stream-doc.js.map +1 -0
- package/build/implementations/http/hono/handlers/http-stream.d.ts +10 -0
- package/build/implementations/http/hono/handlers/http-stream.js +123 -0
- package/build/implementations/http/hono/handlers/http-stream.js.map +1 -0
- package/build/implementations/http/hono/handlers/http-stream.test.js +128 -0
- package/build/implementations/http/hono/handlers/http-stream.test.js.map +1 -0
- package/build/implementations/http/hono/handlers/http.d.ts +10 -0
- package/build/implementations/http/hono/handlers/http.js +115 -0
- package/build/implementations/http/hono/handlers/http.js.map +1 -0
- package/build/implementations/http/hono/handlers/http.test.js +118 -0
- package/build/implementations/http/hono/handlers/http.test.js.map +1 -0
- package/build/implementations/http/hono/handlers/rpc.d.ts +11 -0
- package/build/implementations/http/hono/handlers/rpc.js +32 -0
- package/build/implementations/http/hono/handlers/rpc.js.map +1 -0
- package/build/implementations/http/hono/handlers/rpc.test.js +73 -0
- package/build/implementations/http/hono/handlers/rpc.test.js.map +1 -0
- package/build/implementations/http/hono/handlers/stream.d.ts +23 -0
- package/build/implementations/http/hono/handlers/stream.js +147 -0
- package/build/implementations/http/hono/handlers/stream.js.map +1 -0
- package/build/implementations/http/hono/handlers/stream.test.d.ts +1 -0
- package/build/implementations/http/hono/handlers/stream.test.js +177 -0
- package/build/implementations/http/hono/handlers/stream.test.js.map +1 -0
- package/build/implementations/http/hono/index.d.ts +57 -0
- package/build/implementations/http/hono/index.js +149 -0
- package/build/implementations/http/hono/index.js.map +1 -0
- package/build/implementations/http/hono/index.test.d.ts +1 -0
- package/build/implementations/http/hono/index.test.js +274 -0
- package/build/implementations/http/hono/index.test.js.map +1 -0
- package/build/implementations/http/hono/path.d.ts +17 -0
- package/build/implementations/http/hono/path.js +39 -0
- package/build/implementations/http/hono/path.js.map +1 -0
- package/build/implementations/http/hono/path.test.d.ts +1 -0
- package/build/implementations/http/hono/path.test.js +83 -0
- package/build/implementations/http/hono/path.test.js.map +1 -0
- package/build/implementations/http/hono/types.d.ts +51 -0
- package/build/implementations/http/hono/types.js.map +1 -0
- package/build/implementations/http/on-request-error.test.js +6 -96
- package/build/implementations/http/on-request-error.test.js.map +1 -1
- package/build/implementations/http/route-errors.test.js +11 -59
- package/build/implementations/http/route-errors.test.js.map +1 -1
- package/build/implementations/types.d.ts +43 -9
- package/build/index.d.ts +124 -124
- package/build/index.js +10 -221
- package/build/index.js.map +1 -1
- package/build/index.test.js +20 -919
- package/build/index.test.js.map +1 -1
- package/build/migration.test.d.ts +1 -0
- package/build/migration.test.js +34 -0
- package/build/migration.test.js.map +1 -0
- package/build/schema/compute-schema.d.ts +11 -3
- package/build/schema/compute-schema.js +13 -7
- package/build/schema/compute-schema.js.map +1 -1
- package/build/schema/parser.d.ts +11 -3
- package/build/schema/parser.js +49 -9
- package/build/schema/parser.js.map +1 -1
- package/build/stack-utils.js +8 -0
- package/build/stack-utils.js.map +1 -1
- package/build/types.d.ts +142 -0
- package/build/types.js.map +1 -0
- package/docs/astro-adapter.md +5 -5
- package/docs/core.md +15 -17
- package/docs/http-integrations.md +83 -170
- package/docs/streaming.md +3 -60
- package/docs/superpowers/plans/2026-05-07-astro-adapter.md +2 -7
- package/docs/superpowers/plans/2026-05-08-create-http.md +3355 -0
- package/docs/superpowers/plans/2026-05-08-hono-app-builder-convergence.md +3365 -0
- package/docs/superpowers/specs/2026-05-07-astro-adapter-design.md +1 -3
- package/docs/superpowers/specs/2026-05-08-create-http-design.md +409 -0
- package/docs/superpowers/specs/2026-05-08-hono-app-builder-convergence-design.md +411 -0
- package/package.json +4 -22
- package/src/client/call.test.ts +26 -0
- package/src/client/call.ts +4 -1
- package/src/client/fetch-adapter.test.ts +14 -1
- package/src/client/fetch-adapter.ts +3 -1
- package/src/client/index.test.ts +7 -7
- package/src/client/request-builder.ts +2 -2
- package/src/client/stream.test.ts +39 -7
- package/src/client/stream.ts +16 -2
- package/src/client/typed-error-dispatch.test.ts +7 -97
- package/src/client/types.ts +21 -3
- package/src/codegen/__fixtures__/users-envelope.json +119 -38
- package/src/codegen/e2e.test.ts +98 -24
- package/src/codegen/emit-errors.integration.test.ts +1 -1
- package/src/codegen/emit-scope.test.ts +395 -110
- package/src/codegen/emit-scope.ts +350 -55
- package/src/codegen/pipeline.test.ts +7 -7
- package/src/codegen/resolve-envelope.test.ts +5 -5
- package/src/codegen/resolve-envelope.ts +1 -1
- package/src/codegen/targets/_shared/route-slots.test.ts +109 -26
- package/src/codegen/targets/_shared/route-slots.ts +48 -11
- package/src/codegen/targets/kotlin/__fixtures__/users-golden.kt +73 -0
- package/src/codegen/targets/kotlin/emit-route-kotlin.test.ts +100 -17
- package/src/codegen/targets/kotlin/emit-scope-kotlin.test.ts +9 -6
- package/src/codegen/targets/kotlin/integration.test.ts +19 -0
- package/src/codegen/targets/swift/__fixtures__/users-golden.swift +79 -0
- package/src/codegen/targets/swift/access-level.test.ts +8 -11
- package/src/codegen/targets/swift/emit-route-swift.test.ts +103 -20
- package/src/codegen/targets/swift/emit-scope-swift.test.ts +12 -9
- package/src/codegen/targets/swift/integration.test.ts +17 -0
- package/src/create-http-stream.test.ts +97 -0
- package/src/create-http-stream.ts +191 -0
- package/src/create-http.test.ts +163 -0
- package/src/create-http.ts +211 -0
- package/src/create-stream.test.ts +565 -0
- package/src/create-stream.ts +228 -0
- package/src/create.test.ts +658 -0
- package/src/create.ts +172 -0
- package/src/exports.ts +2 -0
- package/src/implementations/http/README.md +135 -95
- package/src/implementations/http/astro/README.md +4 -5
- package/src/implementations/http/astro/index.test.ts +25 -18
- package/src/implementations/http/doc-registry.test.ts +42 -5
- package/src/implementations/http/doc-registry.ts +1 -1
- package/src/implementations/http/error-dispatch.test.ts +283 -0
- package/src/implementations/http/error-dispatch.ts +176 -0
- package/src/implementations/http/error-taxonomy.ts +5 -5
- package/src/implementations/http/hono/docs/http-doc.ts +43 -0
- package/src/implementations/http/hono/docs/http-stream-doc.ts +44 -0
- package/src/implementations/http/hono/docs/rpc-doc.ts +34 -0
- package/src/implementations/http/hono/docs/stream-doc.ts +53 -0
- package/src/implementations/http/hono/handlers/http-stream.test.ts +150 -0
- package/src/implementations/http/hono/handlers/http-stream.ts +152 -0
- package/src/implementations/http/hono/handlers/http.test.ts +130 -0
- package/src/implementations/http/hono/handlers/http.ts +147 -0
- package/src/implementations/http/hono/handlers/rpc.test.ts +81 -0
- package/src/implementations/http/hono/handlers/rpc.ts +54 -0
- package/src/implementations/http/hono/handlers/stream.test.ts +198 -0
- package/src/implementations/http/hono/handlers/stream.ts +208 -0
- package/src/implementations/http/hono/index.test.ts +329 -0
- package/src/implementations/http/hono/index.ts +204 -0
- package/src/implementations/http/hono/path.test.ts +96 -0
- package/src/implementations/http/hono/path.ts +59 -0
- package/src/implementations/http/hono/types.ts +93 -0
- package/src/implementations/http/on-request-error.test.ts +10 -116
- package/src/implementations/http/route-errors.test.ts +11 -77
- package/src/implementations/types.ts +44 -9
- package/src/index.test.ts +22 -1249
- package/src/index.ts +49 -485
- package/src/migration.test.ts +48 -0
- package/src/schema/compute-schema.ts +26 -12
- package/src/schema/parser.ts +62 -12
- package/src/stack-utils.ts +8 -0
- package/src/types.ts +133 -0
- package/agent_config/claude-code/skills/ts-procedures-scaffold/templates/express-rpc.md +0 -137
- package/agent_config/claude-code/skills/ts-procedures-scaffold/templates/hono-api.md +0 -173
- package/agent_config/claude-code/skills/ts-procedures-scaffold/templates/hono-rpc.md +0 -142
- package/agent_config/claude-code/skills/ts-procedures-scaffold/templates/hono-stream.md +0 -147
- package/build/implementations/http/express-rpc/error-taxonomy.test.js +0 -83
- package/build/implementations/http/express-rpc/error-taxonomy.test.js.map +0 -1
- package/build/implementations/http/express-rpc/index.d.ts +0 -125
- package/build/implementations/http/express-rpc/index.js +0 -216
- package/build/implementations/http/express-rpc/index.js.map +0 -1
- package/build/implementations/http/express-rpc/index.test.js +0 -684
- package/build/implementations/http/express-rpc/index.test.js.map +0 -1
- package/build/implementations/http/express-rpc/types.d.ts +0 -11
- package/build/implementations/http/express-rpc/types.js.map +0 -1
- package/build/implementations/http/hono-api/error-taxonomy.test.js +0 -137
- package/build/implementations/http/hono-api/error-taxonomy.test.js.map +0 -1
- package/build/implementations/http/hono-api/index.d.ts +0 -151
- package/build/implementations/http/hono-api/index.js +0 -344
- package/build/implementations/http/hono-api/index.js.map +0 -1
- package/build/implementations/http/hono-api/index.test.js +0 -992
- package/build/implementations/http/hono-api/index.test.js.map +0 -1
- package/build/implementations/http/hono-api/types.d.ts +0 -13
- package/build/implementations/http/hono-api/types.js.map +0 -1
- package/build/implementations/http/hono-rpc/error-taxonomy.test.js +0 -64
- package/build/implementations/http/hono-rpc/error-taxonomy.test.js.map +0 -1
- package/build/implementations/http/hono-rpc/index.d.ts +0 -130
- package/build/implementations/http/hono-rpc/index.js +0 -209
- package/build/implementations/http/hono-rpc/index.js.map +0 -1
- package/build/implementations/http/hono-rpc/index.test.js +0 -828
- package/build/implementations/http/hono-rpc/index.test.js.map +0 -1
- package/build/implementations/http/hono-rpc/types.d.ts +0 -11
- package/build/implementations/http/hono-rpc/types.js +0 -2
- package/build/implementations/http/hono-rpc/types.js.map +0 -1
- package/build/implementations/http/hono-stream/error-taxonomy.test.js +0 -159
- package/build/implementations/http/hono-stream/error-taxonomy.test.js.map +0 -1
- package/build/implementations/http/hono-stream/index.d.ts +0 -171
- package/build/implementations/http/hono-stream/index.js +0 -415
- package/build/implementations/http/hono-stream/index.js.map +0 -1
- package/build/implementations/http/hono-stream/index.test.js +0 -1383
- package/build/implementations/http/hono-stream/index.test.js.map +0 -1
- package/build/implementations/http/hono-stream/types.d.ts +0 -15
- package/build/implementations/http/hono-stream/types.js +0 -2
- package/build/implementations/http/hono-stream/types.js.map +0 -1
- package/src/implementations/http/express-rpc/README.md +0 -280
- package/src/implementations/http/express-rpc/error-taxonomy.test.ts +0 -103
- package/src/implementations/http/express-rpc/index.test.ts +0 -957
- package/src/implementations/http/express-rpc/index.ts +0 -327
- package/src/implementations/http/express-rpc/types.ts +0 -16
- package/src/implementations/http/hono-api/README.md +0 -284
- package/src/implementations/http/hono-api/error-taxonomy.test.ts +0 -179
- package/src/implementations/http/hono-api/index.test.ts +0 -1341
- package/src/implementations/http/hono-api/index.ts +0 -519
- package/src/implementations/http/hono-api/types.ts +0 -16
- package/src/implementations/http/hono-rpc/README.md +0 -357
- package/src/implementations/http/hono-rpc/error-taxonomy.test.ts +0 -82
- package/src/implementations/http/hono-rpc/index.test.ts +0 -1107
- package/src/implementations/http/hono-rpc/index.ts +0 -320
- package/src/implementations/http/hono-rpc/types.ts +0 -16
- package/src/implementations/http/hono-stream/README.md +0 -559
- package/src/implementations/http/hono-stream/error-taxonomy.test.ts +0 -178
- package/src/implementations/http/hono-stream/index.test.ts +0 -1804
- package/src/implementations/http/hono-stream/index.ts +0 -622
- package/src/implementations/http/hono-stream/types.ts +0 -20
- /package/build/{implementations/http/express-rpc/error-taxonomy.test.d.ts → create-http-stream.test.d.ts} +0 -0
- /package/build/{implementations/http/express-rpc/index.test.d.ts → create-http.test.d.ts} +0 -0
- /package/build/{implementations/http/hono-api/error-taxonomy.test.d.ts → create-stream.test.d.ts} +0 -0
- /package/build/{implementations/http/hono-api/index.test.d.ts → create.test.d.ts} +0 -0
- /package/build/implementations/http/{hono-rpc/error-taxonomy.test.d.ts → error-dispatch.test.d.ts} +0 -0
- /package/build/implementations/http/{hono-rpc/index.test.d.ts → hono/handlers/http-stream.test.d.ts} +0 -0
- /package/build/implementations/http/{hono-stream/error-taxonomy.test.d.ts → hono/handlers/http.test.d.ts} +0 -0
- /package/build/implementations/http/{hono-stream/index.test.d.ts → hono/handlers/rpc.test.d.ts} +0 -0
- /package/build/implementations/http/{express-rpc → hono}/types.js +0 -0
- /package/build/{implementations/http/hono-api/types.js → types.js} +0 -0
|
@@ -1,344 +0,0 @@
|
|
|
1
|
-
import { Hono } from 'hono';
|
|
2
|
-
import { defineErrorTaxonomy, resolveErrorResponse, } from '../error-taxonomy.js';
|
|
3
|
-
export { defineErrorTaxonomy };
|
|
4
|
-
/** Default query parser using native URLSearchParams. */
|
|
5
|
-
function parseQueryNative(queryString) {
|
|
6
|
-
const searchParams = new URLSearchParams(queryString);
|
|
7
|
-
const result = {};
|
|
8
|
-
for (const key of new Set(searchParams.keys())) {
|
|
9
|
-
const values = searchParams.getAll(key);
|
|
10
|
-
result[key] = values.length > 1 ? values : values[0];
|
|
11
|
-
}
|
|
12
|
-
return result;
|
|
13
|
-
}
|
|
14
|
-
/** Extract path parameter names from a route pattern (e.g., '/users/:id' → ['id']) */
|
|
15
|
-
function extractPathParamNames(path) {
|
|
16
|
-
const matches = path.match(/:([a-zA-Z_][a-zA-Z0-9_]*)/g);
|
|
17
|
-
return matches ? matches.map((m) => m.slice(1)) : [];
|
|
18
|
-
}
|
|
19
|
-
/** Default success status codes by HTTP method */
|
|
20
|
-
function defaultSuccessStatus(method) {
|
|
21
|
-
switch (method) {
|
|
22
|
-
case 'post':
|
|
23
|
-
return 201;
|
|
24
|
-
case 'delete':
|
|
25
|
-
return 204;
|
|
26
|
-
default:
|
|
27
|
-
return 200;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
/** HTTP methods that typically carry a request body */
|
|
31
|
-
const BODY_METHODS = ['post', 'put', 'patch'];
|
|
32
|
-
/** Extracts the raw query string from a URL and runs it through the resolved parser. */
|
|
33
|
-
function extractQuery(url, queryParser) {
|
|
34
|
-
const questionMark = url.indexOf('?');
|
|
35
|
-
if (questionMark === -1)
|
|
36
|
-
return {};
|
|
37
|
-
const rawQuery = url.slice(questionMark + 1);
|
|
38
|
-
if (!rawQuery)
|
|
39
|
-
return {};
|
|
40
|
-
return queryParser(rawQuery);
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Builder class for creating a Hono application with REST-style API routes.
|
|
44
|
-
*
|
|
45
|
-
* Uses `schema.input` for per-channel type safety:
|
|
46
|
-
* - `input.pathParams` → validated path parameters
|
|
47
|
-
* - `input.query` → validated query string parameters
|
|
48
|
-
* - `input.body` → validated request body
|
|
49
|
-
* - `input.headers` → validated request headers
|
|
50
|
-
*
|
|
51
|
-
* Usage:
|
|
52
|
-
* const API = Procedures<MyContext, APIConfig>()
|
|
53
|
-
*
|
|
54
|
-
* API.Create('GetUser', {
|
|
55
|
-
* path: '/users/:id',
|
|
56
|
-
* method: 'get',
|
|
57
|
-
* schema: {
|
|
58
|
-
* input: {
|
|
59
|
-
* pathParams: Type.Object({ id: Type.String() }),
|
|
60
|
-
* query: Type.Object({ include: Type.Optional(Type.String()) }),
|
|
61
|
-
* },
|
|
62
|
-
* returnType: Type.Object({ id: Type.String(), name: Type.String() }),
|
|
63
|
-
* }
|
|
64
|
-
* }, async (ctx, { pathParams, query }) => {
|
|
65
|
-
* return { id: pathParams.id, name: 'John' }
|
|
66
|
-
* })
|
|
67
|
-
*
|
|
68
|
-
* const apiApp = new HonoAPIAppBuilder()
|
|
69
|
-
* .register(API, (c) => ({ ... }))
|
|
70
|
-
* .build()
|
|
71
|
-
*/
|
|
72
|
-
export class HonoAPIAppBuilder {
|
|
73
|
-
config;
|
|
74
|
-
constructor(config) {
|
|
75
|
-
this.config = config;
|
|
76
|
-
if (config?.app) {
|
|
77
|
-
this._app = config.app;
|
|
78
|
-
}
|
|
79
|
-
if (config?.onRequestStart) {
|
|
80
|
-
this._app.use('*', async (c, next) => {
|
|
81
|
-
config.onRequestStart(c);
|
|
82
|
-
await next();
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
if (config?.onRequestEnd) {
|
|
86
|
-
this._app.use('*', async (c, next) => {
|
|
87
|
-
await next();
|
|
88
|
-
config.onRequestEnd(c);
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
factories = [];
|
|
93
|
-
_app = new Hono();
|
|
94
|
-
_docs = [];
|
|
95
|
-
get app() {
|
|
96
|
-
return this._app;
|
|
97
|
-
}
|
|
98
|
-
get docs() {
|
|
99
|
-
return this._docs;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Registers a procedure factory with its context.
|
|
103
|
-
* @param factory - The procedure factory created by Procedures<Context, APIConfig>()
|
|
104
|
-
* @param factoryContext - Context for handlers. Direct value, sync function, or async function.
|
|
105
|
-
* @param extendProcedureDoc - Custom function to extend the generated route documentation.
|
|
106
|
-
*/
|
|
107
|
-
register(factory, factoryContext, extendProcedureDoc) {
|
|
108
|
-
this.factories.push({ factory, factoryContext, extendProcedureDoc });
|
|
109
|
-
return this;
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Resolves the full path for a route, combining pathPrefix and the procedure's path.
|
|
113
|
-
*/
|
|
114
|
-
resolveFullPath(procedurePath) {
|
|
115
|
-
const prefix = this.config?.pathPrefix;
|
|
116
|
-
const normalizedPrefix = prefix ? (prefix.startsWith('/') ? prefix : `/${prefix}`) : '';
|
|
117
|
-
const normalizedPath = procedurePath.startsWith('/') ? procedurePath : `/${procedurePath}`;
|
|
118
|
-
return `${normalizedPrefix}${normalizedPath}`;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Builds and returns the Hono application with registered API routes.
|
|
122
|
-
*/
|
|
123
|
-
build() {
|
|
124
|
-
const queryParser = this.config?.queryParser ?? parseQueryNative;
|
|
125
|
-
this.factories.forEach(({ factory, factoryContext, extendProcedureDoc }) => {
|
|
126
|
-
factory.getProcedures().map((procedure) => {
|
|
127
|
-
const { config } = procedure;
|
|
128
|
-
const fullPath = this.resolveFullPath(config.path);
|
|
129
|
-
const inputSchema = procedure.config.schema?.input;
|
|
130
|
-
// Validate consistency: path params in path template must match schema.input.pathParams
|
|
131
|
-
this.validatePathParamConsistency(procedure.name, config.path, inputSchema);
|
|
132
|
-
const route = this.buildApiHttpRouteDoc(procedure, fullPath, extendProcedureDoc);
|
|
133
|
-
this._docs.push(route);
|
|
134
|
-
const method = config.method;
|
|
135
|
-
const handler = this.createRouteHandler(procedure, factoryContext, config, inputSchema, queryParser);
|
|
136
|
-
this._app.on(method.toUpperCase(), fullPath, handler);
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
return this._app;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Validates that path parameter names in the path template match the schema.input.pathParams declaration.
|
|
143
|
-
*/
|
|
144
|
-
validatePathParamConsistency(procedureName, path, inputSchema) {
|
|
145
|
-
// Only validate when schema.input is used; schema.params (flat mode) skips this check
|
|
146
|
-
if (!inputSchema)
|
|
147
|
-
return;
|
|
148
|
-
const pathParamNames = extractPathParamNames(path);
|
|
149
|
-
if (pathParamNames.length > 0 && !inputSchema.pathParams) {
|
|
150
|
-
throw new Error(`Path "${path}" has path parameters [${pathParamNames.join(', ')}] but schema.input.pathParams is not defined for procedure "${procedureName}". ` +
|
|
151
|
-
`Define schema.input.pathParams to validate path parameters.`);
|
|
152
|
-
}
|
|
153
|
-
if (inputSchema.pathParams && pathParamNames.length === 0) {
|
|
154
|
-
throw new Error(`schema.input.pathParams is defined for procedure "${procedureName}" but path "${path}" has no path parameters. ` +
|
|
155
|
-
`Remove schema.input.pathParams or add path parameters to the path.`);
|
|
156
|
-
}
|
|
157
|
-
// Deep validation: verify schema property names match the :param names in the path
|
|
158
|
-
if (inputSchema.pathParams && pathParamNames.length > 0) {
|
|
159
|
-
const pathParamsJsonSchema = inputSchema.pathParams;
|
|
160
|
-
const schemaProperties = pathParamsJsonSchema.properties;
|
|
161
|
-
if (schemaProperties) {
|
|
162
|
-
const schemaKeys = Object.keys(schemaProperties);
|
|
163
|
-
const missingInSchema = pathParamNames.filter((p) => !schemaKeys.includes(p));
|
|
164
|
-
const extraInSchema = schemaKeys.filter((k) => !pathParamNames.includes(k));
|
|
165
|
-
if (missingInSchema.length > 0 || extraInSchema.length > 0) {
|
|
166
|
-
const parts = [];
|
|
167
|
-
if (missingInSchema.length > 0) {
|
|
168
|
-
parts.push(`path has [${missingInSchema.join(', ')}] but they are missing from schema`);
|
|
169
|
-
}
|
|
170
|
-
if (extraInSchema.length > 0) {
|
|
171
|
-
parts.push(`schema has [${extraInSchema.join(', ')}] but they are not in the path`);
|
|
172
|
-
}
|
|
173
|
-
throw new Error(`Path param mismatch for procedure "${procedureName}": ${parts.join('; ')}. ` +
|
|
174
|
-
`Path "${path}" expects [${pathParamNames.join(', ')}], schema defines [${schemaKeys.join(', ')}].`);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Creates the async route handler for a procedure.
|
|
181
|
-
*/
|
|
182
|
-
createRouteHandler(procedure, factoryContext, config, inputSchema, queryParser) {
|
|
183
|
-
const successStatus = config.successStatus ?? defaultSuccessStatus(config.method);
|
|
184
|
-
return async (c) => {
|
|
185
|
-
try {
|
|
186
|
-
const context = typeof factoryContext === 'function'
|
|
187
|
-
? await factoryContext(c)
|
|
188
|
-
: factoryContext;
|
|
189
|
-
let params;
|
|
190
|
-
if (inputSchema) {
|
|
191
|
-
// schema.input mode: build structured params from HTTP sources
|
|
192
|
-
params = await this.extractInputParams(c, config.method, inputSchema, queryParser);
|
|
193
|
-
}
|
|
194
|
-
else if (procedure.config.schema?.params) {
|
|
195
|
-
// schema.params mode: extract from body or query based on method
|
|
196
|
-
if (BODY_METHODS.includes(config.method)) {
|
|
197
|
-
params = await c.req.json().catch(() => ({}));
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
params = extractQuery(c.req.url, queryParser);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
else {
|
|
204
|
-
params = await c.req.json().catch(() => undefined);
|
|
205
|
-
}
|
|
206
|
-
const result = await procedure.handler({ ...context, signal: c.req.raw.signal }, params);
|
|
207
|
-
if (this.config?.onSuccess) {
|
|
208
|
-
this.config.onSuccess(procedure, c);
|
|
209
|
-
}
|
|
210
|
-
// 204 No Content returns no body
|
|
211
|
-
if (successStatus === 204) {
|
|
212
|
-
return c.body(null, 204);
|
|
213
|
-
}
|
|
214
|
-
return c.json(result, successStatus);
|
|
215
|
-
}
|
|
216
|
-
catch (error) {
|
|
217
|
-
// Observer fires first — cross-cutting, cannot alter dispatch or the
|
|
218
|
-
// response. Swallow any throw from the observer so instrumentation
|
|
219
|
-
// bugs never break the primary error-response flow.
|
|
220
|
-
if (this.config?.onRequestError) {
|
|
221
|
-
try {
|
|
222
|
-
await this.config.onRequestError({ err: error, procedure, raw: c });
|
|
223
|
-
}
|
|
224
|
-
catch (observerErr) {
|
|
225
|
-
console.error('[ts-procedures hono-api] onRequestError threw — swallowed:', observerErr);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
// Dispatch: taxonomy → onError → hard default. The two modes are
|
|
229
|
-
// peers; apps configure whichever fits (or both, in which case the
|
|
230
|
-
// taxonomy handles what it covers and `onError` handles the tail).
|
|
231
|
-
if (this.config?.errors || this.config?.unknownError) {
|
|
232
|
-
const resolved = resolveErrorResponse({
|
|
233
|
-
err: error,
|
|
234
|
-
userTaxonomy: this.config.errors,
|
|
235
|
-
unknownError: this.config.unknownError,
|
|
236
|
-
procedure,
|
|
237
|
-
raw: c,
|
|
238
|
-
});
|
|
239
|
-
if (resolved) {
|
|
240
|
-
await resolved.runOnCatch();
|
|
241
|
-
return c.json(resolved.body, resolved.statusCode);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
if (this.config?.onError) {
|
|
245
|
-
return this.config.onError(procedure, c, error);
|
|
246
|
-
}
|
|
247
|
-
return c.json({ error: error.message }, 500);
|
|
248
|
-
}
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Extracts and assembles structured input params from HTTP request sources.
|
|
253
|
-
* Each channel (pathParams, query, body, headers) is extracted from its HTTP source.
|
|
254
|
-
* The core validates each channel independently via schema.input validators.
|
|
255
|
-
*/
|
|
256
|
-
async extractInputParams(c, method, inputSchema, queryParser) {
|
|
257
|
-
const params = {};
|
|
258
|
-
const channelNames = Object.keys(inputSchema);
|
|
259
|
-
for (const channel of channelNames) {
|
|
260
|
-
switch (channel) {
|
|
261
|
-
case 'pathParams':
|
|
262
|
-
params.pathParams = c.req.param();
|
|
263
|
-
break;
|
|
264
|
-
case 'query':
|
|
265
|
-
params.query = extractQuery(c.req.url, queryParser);
|
|
266
|
-
break;
|
|
267
|
-
case 'body':
|
|
268
|
-
if (BODY_METHODS.includes(method)) {
|
|
269
|
-
params.body = await c.req.json().catch(() => ({}));
|
|
270
|
-
}
|
|
271
|
-
break;
|
|
272
|
-
case 'headers': {
|
|
273
|
-
// Pass all request headers; AJV's removeAdditional strips non-declared keys
|
|
274
|
-
const headersObj = {};
|
|
275
|
-
c.req.raw.headers.forEach((value, key) => {
|
|
276
|
-
headersObj[key] = value;
|
|
277
|
-
});
|
|
278
|
-
params.headers = headersObj;
|
|
279
|
-
break;
|
|
280
|
-
}
|
|
281
|
-
default:
|
|
282
|
-
// Unknown channel — pass through empty. Core validation will catch mismatches.
|
|
283
|
-
params[channel] = undefined;
|
|
284
|
-
break;
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
return params;
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Generates the API HTTP route documentation for the given procedure.
|
|
291
|
-
*/
|
|
292
|
-
buildApiHttpRouteDoc(procedure, fullPath, extendProcedureDoc) {
|
|
293
|
-
const { config } = procedure;
|
|
294
|
-
const inputSchema = config.schema?.input;
|
|
295
|
-
const jsonSchema = {};
|
|
296
|
-
// Populate per-channel JSON schemas from schema.input
|
|
297
|
-
if (inputSchema) {
|
|
298
|
-
if (inputSchema.pathParams)
|
|
299
|
-
jsonSchema.pathParams = inputSchema.pathParams;
|
|
300
|
-
if (inputSchema.query)
|
|
301
|
-
jsonSchema.query = inputSchema.query;
|
|
302
|
-
if (inputSchema.body)
|
|
303
|
-
jsonSchema.body = inputSchema.body;
|
|
304
|
-
if (inputSchema.headers)
|
|
305
|
-
jsonSchema.headers = inputSchema.headers;
|
|
306
|
-
}
|
|
307
|
-
else if (config.schema?.params) {
|
|
308
|
-
// Fallback: schema.params treated as body/query depending on method
|
|
309
|
-
if (BODY_METHODS.includes(config.method)) {
|
|
310
|
-
jsonSchema.body = config.schema.params;
|
|
311
|
-
}
|
|
312
|
-
else {
|
|
313
|
-
jsonSchema.query = config.schema.params;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
if (config.schema?.returnType) {
|
|
317
|
-
jsonSchema.response = config.schema.returnType;
|
|
318
|
-
}
|
|
319
|
-
const base = {
|
|
320
|
-
kind: 'api',
|
|
321
|
-
name: procedure.name,
|
|
322
|
-
scope: config.scope,
|
|
323
|
-
path: config.path,
|
|
324
|
-
method: config.method,
|
|
325
|
-
fullPath,
|
|
326
|
-
jsonSchema,
|
|
327
|
-
};
|
|
328
|
-
if (config.successStatus) {
|
|
329
|
-
base.successStatus = config.successStatus;
|
|
330
|
-
}
|
|
331
|
-
if (config.errors && config.errors.length > 0) {
|
|
332
|
-
base.errors = [...config.errors];
|
|
333
|
-
}
|
|
334
|
-
let extendedDoc = {};
|
|
335
|
-
if (extendProcedureDoc) {
|
|
336
|
-
extendedDoc = extendProcedureDoc({ base, procedure });
|
|
337
|
-
}
|
|
338
|
-
return {
|
|
339
|
-
...extendedDoc,
|
|
340
|
-
...base,
|
|
341
|
-
};
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/implementations/http/hono-api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAW,MAAM,MAAM,CAAA;AAWpC,OAAO,EAIL,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,sBAAsB,CAAA;AAI7B,OAAO,EAAE,mBAAmB,EAAE,CAAA;AAS9B,yDAAyD;AACzD,SAAS,gBAAgB,CAAC,WAAmB;IAC3C,MAAM,YAAY,GAAG,IAAI,eAAe,CAAC,WAAW,CAAC,CAAA;IACrD,MAAM,MAAM,GAA4B,EAAE,CAAA;IAC1C,KAAK,MAAM,GAAG,IAAI,IAAI,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;QAC/C,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QACvC,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,G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