ts-procedures 7.2.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 +139 -53
- package/agent_config/claude-code/skills/ts-procedures/api-reference.md +208 -231
- 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 +36 -48
- package/agent_config/cursor/cursorrules +36 -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 +125 -115
- package/build/index.js +10 -222
- package/build/index.js.map +1 -1
- package/build/index.test.js +30 -822
- 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 +34 -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 +35 -1091
- package/src/index.ts +50 -474
- 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
package/src/codegen/e2e.test.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { generateClient } from './index.js'
|
|
|
3
3
|
import { mkdirSync, rmSync, readFileSync, writeFileSync, existsSync } from 'node:fs'
|
|
4
4
|
import { join } from 'node:path'
|
|
5
5
|
import { tmpdir } from 'node:os'
|
|
6
|
-
import type { DocEnvelope, RPCHttpRouteDoc, APIHttpRouteDoc, StreamHttpRouteDoc, ErrorDoc } from '../implementations/types.js'
|
|
6
|
+
import type { DocEnvelope, RPCHttpRouteDoc, APIHttpRouteDoc, StreamHttpRouteDoc, HttpStreamRouteDoc, ErrorDoc } from '../implementations/types.js'
|
|
7
7
|
import { runTsc } from './test-helpers/run-tsc.js'
|
|
8
8
|
|
|
9
9
|
// ---------------------------------------------------------------------------
|
|
@@ -39,20 +39,24 @@ const apiRoute: APIHttpRouteDoc = {
|
|
|
39
39
|
method: 'put',
|
|
40
40
|
scope: 'users',
|
|
41
41
|
jsonSchema: {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
42
|
+
req: {
|
|
43
|
+
pathParams: {
|
|
44
|
+
type: 'object',
|
|
45
|
+
properties: { id: { type: 'string' } },
|
|
46
|
+
required: ['id'],
|
|
47
|
+
},
|
|
48
|
+
body: {
|
|
49
|
+
type: 'object',
|
|
50
|
+
properties: { name: { type: 'string' } },
|
|
51
|
+
required: ['name'],
|
|
52
|
+
},
|
|
51
53
|
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
res: {
|
|
55
|
+
body: {
|
|
56
|
+
type: 'object',
|
|
57
|
+
properties: { id: { type: 'string' }, name: { type: 'string' } },
|
|
58
|
+
required: ['id', 'name'],
|
|
59
|
+
},
|
|
56
60
|
},
|
|
57
61
|
},
|
|
58
62
|
}
|
|
@@ -94,6 +98,34 @@ const streamRoute: StreamHttpRouteDoc = {
|
|
|
94
98
|
},
|
|
95
99
|
}
|
|
96
100
|
|
|
101
|
+
const httpStreamRoute: HttpStreamRouteDoc = {
|
|
102
|
+
kind: 'http-stream',
|
|
103
|
+
name: 'WatchUsers',
|
|
104
|
+
scope: 'users',
|
|
105
|
+
method: 'get',
|
|
106
|
+
path: '/users/watch',
|
|
107
|
+
fullPath: '/api/users/watch',
|
|
108
|
+
streamMode: 'sse',
|
|
109
|
+
jsonSchema: {
|
|
110
|
+
req: {
|
|
111
|
+
query: {
|
|
112
|
+
type: 'object',
|
|
113
|
+
properties: { status: { type: 'string' } },
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
yield: {
|
|
117
|
+
type: 'object',
|
|
118
|
+
properties: { id: { type: 'string' }, event: { type: 'string' } },
|
|
119
|
+
required: ['id', 'event'],
|
|
120
|
+
},
|
|
121
|
+
returnType: {
|
|
122
|
+
type: 'object',
|
|
123
|
+
properties: { count: { type: 'number' } },
|
|
124
|
+
required: ['count'],
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
}
|
|
128
|
+
|
|
97
129
|
const procedureErrorDoc: ErrorDoc = {
|
|
98
130
|
name: 'ProcedureError',
|
|
99
131
|
statusCode: 500,
|
|
@@ -129,7 +161,7 @@ const envelope: DocEnvelope = {
|
|
|
129
161
|
basePath: '/api',
|
|
130
162
|
headers: [],
|
|
131
163
|
errors: [procedureErrorDoc, validationErrorDoc],
|
|
132
|
-
routes: [rpcRoute, apiRoute, streamRoute],
|
|
164
|
+
routes: [rpcRoute, apiRoute, streamRoute, httpStreamRoute],
|
|
133
165
|
}
|
|
134
166
|
|
|
135
167
|
// ---------------------------------------------------------------------------
|
|
@@ -189,20 +221,20 @@ describe('E2E: generateClient full pipeline', () => {
|
|
|
189
221
|
|
|
190
222
|
// ── users.ts — API route ───────────────────────────────────────────────────
|
|
191
223
|
|
|
192
|
-
it('users.ts contains
|
|
224
|
+
it('users.ts contains UpdateUserReq type (structured request type)', async () => {
|
|
193
225
|
tmpDir = makeTmpDir()
|
|
194
226
|
await generateClient({ envelope, outDir: tmpDir })
|
|
195
227
|
|
|
196
228
|
const content = readFileSync(join(tmpDir, 'users.ts'), 'utf-8')
|
|
197
|
-
expect(content).toContain('
|
|
229
|
+
expect(content).toContain('UpdateUserReq')
|
|
198
230
|
})
|
|
199
231
|
|
|
200
|
-
it('users.ts contains
|
|
232
|
+
it('users.ts contains UpdateUserResponseBody type', async () => {
|
|
201
233
|
tmpDir = makeTmpDir()
|
|
202
234
|
await generateClient({ envelope, outDir: tmpDir })
|
|
203
235
|
|
|
204
236
|
const content = readFileSync(join(tmpDir, 'users.ts'), 'utf-8')
|
|
205
|
-
expect(content).toContain('
|
|
237
|
+
expect(content).toContain('UpdateUserResponseBody')
|
|
206
238
|
})
|
|
207
239
|
|
|
208
240
|
it('users.ts API callable uses fullPath in the path field', async () => {
|
|
@@ -289,6 +321,44 @@ describe('E2E: generateClient full pipeline', () => {
|
|
|
289
321
|
expect(yieldTypeBody).not.toContain('retry')
|
|
290
322
|
})
|
|
291
323
|
|
|
324
|
+
// ── users.ts — http-stream route ──────────────────────────────────────────
|
|
325
|
+
|
|
326
|
+
it('users.ts contains WatchUsers callable using client.stream with kind http-stream', async () => {
|
|
327
|
+
tmpDir = makeTmpDir()
|
|
328
|
+
await generateClient({ envelope, outDir: tmpDir })
|
|
329
|
+
|
|
330
|
+
const content = readFileSync(join(tmpDir, 'users.ts'), 'utf-8')
|
|
331
|
+
expect(content).toContain('client.stream')
|
|
332
|
+
expect(content).toContain("kind: 'http-stream'")
|
|
333
|
+
})
|
|
334
|
+
|
|
335
|
+
it('users.ts http-stream callable passes params: req (not bare req shorthand)', async () => {
|
|
336
|
+
tmpDir = makeTmpDir()
|
|
337
|
+
await generateClient({ envelope, outDir: tmpDir })
|
|
338
|
+
|
|
339
|
+
const content = readFileSync(join(tmpDir, 'users.ts'), 'utf-8')
|
|
340
|
+
// Must be 'params: req,' not just 'req,' — the shorthand drops channel info
|
|
341
|
+
expect(content).toContain('params: req,')
|
|
342
|
+
expect(content).not.toMatch(/^\s+req,\s*$/m)
|
|
343
|
+
})
|
|
344
|
+
|
|
345
|
+
it('users.ts http-stream callable uses fullPath', async () => {
|
|
346
|
+
tmpDir = makeTmpDir()
|
|
347
|
+
await generateClient({ envelope, outDir: tmpDir })
|
|
348
|
+
|
|
349
|
+
const content = readFileSync(join(tmpDir, 'users.ts'), 'utf-8')
|
|
350
|
+
expect(content).toContain("path: '/api/users/watch'")
|
|
351
|
+
})
|
|
352
|
+
|
|
353
|
+
it('users.ts http-stream callable returns TypedStream', async () => {
|
|
354
|
+
tmpDir = makeTmpDir()
|
|
355
|
+
await generateClient({ envelope, outDir: tmpDir })
|
|
356
|
+
|
|
357
|
+
const content = readFileSync(join(tmpDir, 'users.ts'), 'utf-8')
|
|
358
|
+
expect(content).toContain('TypedStream<')
|
|
359
|
+
expect(content).toContain("streamMode: 'sse'")
|
|
360
|
+
})
|
|
361
|
+
|
|
292
362
|
// ── index.ts ───────────────────────────────────────────────────────────────
|
|
293
363
|
|
|
294
364
|
it('index.ts contains the default Api bindings factory', async () => {
|
|
@@ -520,7 +590,7 @@ const typedAdapter: ClientAdapter = {
|
|
|
520
590
|
async stream(req) {
|
|
521
591
|
const trace: string | undefined = req.meta?.traceId
|
|
522
592
|
void trace
|
|
523
|
-
return { status: 200, headers:
|
|
593
|
+
return { status: 200, headers: new Headers(), body: (async function*() {})() }
|
|
524
594
|
},
|
|
525
595
|
}
|
|
526
596
|
|
|
@@ -735,7 +805,9 @@ void run
|
|
|
735
805
|
const content = readFileSync(join(tmpDir, 'users.ts'), 'utf-8')
|
|
736
806
|
expect(content).toContain('export namespace Users {')
|
|
737
807
|
expect(content).toContain('export namespace GetUser {')
|
|
738
|
-
|
|
808
|
+
// API routes now emit Req/Response sub-namespaces instead of a bare UpdateUser namespace
|
|
809
|
+
expect(content).toContain('export namespace Req {')
|
|
810
|
+
expect(content).toContain('export namespace Response {')
|
|
739
811
|
})
|
|
740
812
|
|
|
741
813
|
it('users.ts uses qualified type references in callables', async () => {
|
|
@@ -743,9 +815,10 @@ void run
|
|
|
743
815
|
await generateClient({ envelope, outDir: tmpDir, namespaceTypes: true })
|
|
744
816
|
|
|
745
817
|
const content = readFileSync(join(tmpDir, 'users.ts'), 'utf-8')
|
|
746
|
-
//
|
|
818
|
+
// RPC route still uses Params/Response naming
|
|
747
819
|
expect(content).toContain('client.bindCallable<Users.GetUser.Params, Users.GetUser.Response>')
|
|
748
|
-
|
|
820
|
+
// API route uses Req sub-namespace for params and Response.Body for return
|
|
821
|
+
expect(content).toContain('client.bindCallable<Users.UpdateUser.Req, Users.UpdateUser.Response.Body>')
|
|
749
822
|
})
|
|
750
823
|
|
|
751
824
|
it('events.ts wraps stream types in namespace', async () => {
|
|
@@ -765,7 +838,8 @@ void run
|
|
|
765
838
|
const content = readFileSync(join(tmpDir, 'users.ts'), 'utf-8')
|
|
766
839
|
expect(content).not.toContain('export type GetUserParams')
|
|
767
840
|
expect(content).not.toContain('export type GetUserResponse')
|
|
768
|
-
expect(content).not.toContain('export type
|
|
841
|
+
expect(content).not.toContain('export type UpdateUserReqPathParams')
|
|
842
|
+
expect(content).not.toContain('export type UpdateUserResponseBody')
|
|
769
843
|
})
|
|
770
844
|
|
|
771
845
|
it('enumStyle: enum produces named enums inside namespace', async () => {
|
|
@@ -52,7 +52,7 @@ describe('generated _errors.ts — runtime behavior', () => {
|
|
|
52
52
|
path: '/ping',
|
|
53
53
|
fullPath: '/api/ping',
|
|
54
54
|
method: 'get',
|
|
55
|
-
jsonSchema: { response: { type: 'object', properties: {} } },
|
|
55
|
+
jsonSchema: { response: { type: 'object', properties: {} } } as any, // TODO(Phase 8): migrate to new req/res envelope shape
|
|
56
56
|
},
|
|
57
57
|
],
|
|
58
58
|
}
|