ts-procedures 10.1.1 → 10.2.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.
Files changed (244) hide show
  1. package/CHANGELOG.md +26 -65
  2. package/README.md +2 -0
  3. package/agent_config/claude-code/skills/ts-procedures/anti-patterns.md +8 -0
  4. package/agent_config/claude-code/skills/ts-procedures/api-reference.md +25 -22
  5. package/agent_config/claude-code/skills/ts-procedures/patterns.md +24 -13
  6. package/agent_config/copilot/copilot-instructions.md +1 -1
  7. package/agent_config/cursor/cursorrules +1 -1
  8. package/build/adapters/hono/envelope-parity.test.js +6 -17
  9. package/build/adapters/hono/envelope-parity.test.js.map +1 -1
  10. package/build/adapters/hono/handlers/http-stream.d.ts +2 -1
  11. package/build/adapters/hono/handlers/http-stream.js +9 -2
  12. package/build/adapters/hono/handlers/http-stream.js.map +1 -1
  13. package/build/adapters/hono/handlers/http.d.ts +2 -1
  14. package/build/adapters/hono/handlers/http.js +9 -2
  15. package/build/adapters/hono/handlers/http.js.map +1 -1
  16. package/build/adapters/hono/handlers/rpc.d.ts +2 -1
  17. package/build/adapters/hono/handlers/rpc.js +9 -2
  18. package/build/adapters/hono/handlers/rpc.js.map +1 -1
  19. package/build/adapters/hono/handlers/stream.d.ts +2 -1
  20. package/build/adapters/hono/handlers/stream.js +9 -2
  21. package/build/adapters/hono/handlers/stream.js.map +1 -1
  22. package/build/adapters/hono/index.d.ts +14 -7
  23. package/build/adapters/hono/index.js +45 -5
  24. package/build/adapters/hono/index.js.map +1 -1
  25. package/build/adapters/hono/index.test.js +55 -0
  26. package/build/adapters/hono/index.test.js.map +1 -1
  27. package/build/adapters/hono/request.d.ts +7 -0
  28. package/build/adapters/hono/request.js +15 -0
  29. package/build/adapters/hono/request.js.map +1 -1
  30. package/build/adapters/hono/types.d.ts +31 -0
  31. package/build/adapters/hono/types.js.map +1 -1
  32. package/build/codegen/bin/cli.js +1 -1
  33. package/build/codegen/bin/cli.js.map +1 -1
  34. package/build/codegen/constants.js +2 -2
  35. package/build/codegen/constants.js.map +1 -1
  36. package/build/codegen/emit/api-route.js +1 -1
  37. package/build/codegen/emit/api-route.js.map +1 -1
  38. package/build/codegen/emit/scope-file.js +1 -1
  39. package/build/codegen/emit/scope-file.js.map +1 -1
  40. package/build/codegen/emit-errors.integration.test.js +2 -2
  41. package/build/codegen/emit-errors.integration.test.js.map +1 -1
  42. package/build/codegen/resolve-envelope.js +1 -1
  43. package/build/codegen/resolve-envelope.js.map +1 -1
  44. package/build/codegen/test-helpers/run-tsc.js +1 -1
  45. package/build/codegen/test-helpers/run-tsc.js.map +1 -1
  46. package/build/core/create-http-stream.d.ts +3 -14
  47. package/build/core/create-http-stream.js +4 -2
  48. package/build/core/create-http-stream.js.map +1 -1
  49. package/build/core/create-http.d.ts +2 -9
  50. package/build/core/create-http.js +3 -2
  51. package/build/core/create-http.js.map +1 -1
  52. package/build/core/create-http.test-d.d.ts +1 -0
  53. package/build/core/create-http.test-d.js +104 -0
  54. package/build/core/create-http.test-d.js.map +1 -0
  55. package/build/core/create-stream.js +6 -2
  56. package/build/core/create-stream.js.map +1 -1
  57. package/build/core/create.js +5 -4
  58. package/build/core/create.js.map +1 -1
  59. package/build/core/create.test.js +63 -0
  60. package/build/core/create.test.js.map +1 -1
  61. package/build/core/internal.d.ts +16 -0
  62. package/build/core/internal.js +22 -0
  63. package/build/core/internal.js.map +1 -1
  64. package/build/core/procedures.d.ts +9 -16
  65. package/build/core/procedures.js +4 -0
  66. package/build/core/procedures.js.map +1 -1
  67. package/build/core/types.d.ts +85 -4
  68. package/build/errors.d.ts +33 -0
  69. package/build/errors.js +91 -0
  70. package/build/errors.js.map +1 -0
  71. package/build/errors.test.d.ts +1 -0
  72. package/build/errors.test.js +122 -0
  73. package/build/errors.test.js.map +1 -0
  74. package/build/exports.d.ts +1 -2
  75. package/build/exports.js +0 -4
  76. package/build/exports.js.map +1 -1
  77. package/build/implementations/http/doc-registry.d.ts +28 -0
  78. package/build/implementations/http/doc-registry.js +96 -0
  79. package/build/implementations/http/doc-registry.js.map +1 -0
  80. package/build/implementations/http/doc-registry.test.d.ts +1 -0
  81. package/build/implementations/http/doc-registry.test.js +516 -0
  82. package/build/implementations/http/doc-registry.test.js.map +1 -0
  83. package/build/implementations/http/error-taxonomy.d.ts +249 -0
  84. package/build/implementations/http/error-taxonomy.js +252 -0
  85. package/build/implementations/http/error-taxonomy.js.map +1 -0
  86. package/build/implementations/http/error-taxonomy.test.d.ts +1 -0
  87. package/build/implementations/http/error-taxonomy.test.js +399 -0
  88. package/build/implementations/http/error-taxonomy.test.js.map +1 -0
  89. package/build/implementations/http/express-rpc/error-taxonomy.test.d.ts +1 -0
  90. package/build/implementations/http/express-rpc/error-taxonomy.test.js +83 -0
  91. package/build/implementations/http/express-rpc/error-taxonomy.test.js.map +1 -0
  92. package/build/implementations/http/express-rpc/index.d.ts +125 -0
  93. package/build/implementations/http/express-rpc/index.js +216 -0
  94. package/build/implementations/http/express-rpc/index.js.map +1 -0
  95. package/build/implementations/http/express-rpc/index.test.d.ts +1 -0
  96. package/build/implementations/http/express-rpc/index.test.js +684 -0
  97. package/build/implementations/http/express-rpc/index.test.js.map +1 -0
  98. package/build/implementations/http/express-rpc/types.d.ts +11 -0
  99. package/build/implementations/http/express-rpc/types.js +2 -0
  100. package/build/implementations/http/express-rpc/types.js.map +1 -0
  101. package/build/implementations/http/hono-api/error-taxonomy.test.d.ts +1 -0
  102. package/build/implementations/http/hono-api/error-taxonomy.test.js +137 -0
  103. package/build/implementations/http/hono-api/error-taxonomy.test.js.map +1 -0
  104. package/build/implementations/http/hono-api/index.d.ts +151 -0
  105. package/build/implementations/http/hono-api/index.js +344 -0
  106. package/build/implementations/http/hono-api/index.js.map +1 -0
  107. package/build/implementations/http/hono-api/index.test.d.ts +1 -0
  108. package/build/implementations/http/hono-api/index.test.js +992 -0
  109. package/build/implementations/http/hono-api/index.test.js.map +1 -0
  110. package/build/implementations/http/hono-api/types.d.ts +13 -0
  111. package/build/implementations/http/hono-api/types.js +2 -0
  112. package/build/implementations/http/hono-api/types.js.map +1 -0
  113. package/build/implementations/http/hono-rpc/error-taxonomy.test.d.ts +1 -0
  114. package/build/implementations/http/hono-rpc/error-taxonomy.test.js +64 -0
  115. package/build/implementations/http/hono-rpc/error-taxonomy.test.js.map +1 -0
  116. package/build/implementations/http/hono-rpc/index.d.ts +130 -0
  117. package/build/implementations/http/hono-rpc/index.js +209 -0
  118. package/build/implementations/http/hono-rpc/index.js.map +1 -0
  119. package/build/implementations/http/hono-rpc/index.test.d.ts +1 -0
  120. package/build/implementations/http/hono-rpc/index.test.js +828 -0
  121. package/build/implementations/http/hono-rpc/index.test.js.map +1 -0
  122. package/build/implementations/http/hono-rpc/types.d.ts +11 -0
  123. package/build/implementations/http/hono-rpc/types.js +2 -0
  124. package/build/implementations/http/hono-rpc/types.js.map +1 -0
  125. package/build/implementations/http/hono-stream/error-taxonomy.test.d.ts +1 -0
  126. package/build/implementations/http/hono-stream/error-taxonomy.test.js +159 -0
  127. package/build/implementations/http/hono-stream/error-taxonomy.test.js.map +1 -0
  128. package/build/implementations/http/hono-stream/index.d.ts +171 -0
  129. package/build/implementations/http/hono-stream/index.js +415 -0
  130. package/build/implementations/http/hono-stream/index.js.map +1 -0
  131. package/build/implementations/http/hono-stream/index.test.d.ts +1 -0
  132. package/build/implementations/http/hono-stream/index.test.js +1383 -0
  133. package/build/implementations/http/hono-stream/index.test.js.map +1 -0
  134. package/build/implementations/http/hono-stream/types.d.ts +15 -0
  135. package/build/implementations/http/hono-stream/types.js +2 -0
  136. package/build/implementations/http/hono-stream/types.js.map +1 -0
  137. package/build/implementations/http/on-request-error.test.d.ts +1 -0
  138. package/build/implementations/http/on-request-error.test.js +173 -0
  139. package/build/implementations/http/on-request-error.test.js.map +1 -0
  140. package/build/implementations/http/route-errors.test.d.ts +1 -0
  141. package/build/implementations/http/route-errors.test.js +139 -0
  142. package/build/implementations/http/route-errors.test.js.map +1 -0
  143. package/build/implementations/types.d.ts +192 -0
  144. package/build/implementations/types.js +2 -0
  145. package/build/implementations/types.js.map +1 -0
  146. package/build/index.d.ts +165 -0
  147. package/build/index.js +258 -0
  148. package/build/index.js.map +1 -0
  149. package/build/index.test.d.ts +1 -0
  150. package/build/index.test.js +920 -0
  151. package/build/index.test.js.map +1 -0
  152. package/build/schema/extract-json-schema.d.ts +2 -0
  153. package/build/schema/extract-json-schema.js +12 -0
  154. package/build/schema/extract-json-schema.js.map +1 -0
  155. package/build/schema/extract-json-schema.test.d.ts +1 -0
  156. package/build/schema/extract-json-schema.test.js +23 -0
  157. package/build/schema/extract-json-schema.test.js.map +1 -0
  158. package/build/schema/parser.d.ts +28 -0
  159. package/build/schema/parser.js +170 -0
  160. package/build/schema/parser.js.map +1 -0
  161. package/build/schema/parser.test.d.ts +1 -0
  162. package/build/schema/parser.test.js +120 -0
  163. package/build/schema/parser.test.js.map +1 -0
  164. package/build/schema/resolve-schema-lib.d.ts +12 -0
  165. package/build/schema/resolve-schema-lib.js +11 -0
  166. package/build/schema/resolve-schema-lib.js.map +1 -0
  167. package/build/schema/resolve-schema-lib.test.d.ts +1 -0
  168. package/build/schema/resolve-schema-lib.test.js +17 -0
  169. package/build/schema/resolve-schema-lib.test.js.map +1 -0
  170. package/build/schema/typebox.d.ts +1 -1
  171. package/build/schema/typebox.js +2 -20
  172. package/build/schema/typebox.js.map +1 -1
  173. package/build/schema/typebox.test.js +0 -10
  174. package/build/schema/typebox.test.js.map +1 -1
  175. package/build/schema/types.d.ts +8 -0
  176. package/build/schema/types.js +2 -0
  177. package/build/schema/types.js.map +1 -0
  178. package/build/server/context.d.ts +12 -2
  179. package/build/server/context.js +49 -4
  180. package/build/server/context.js.map +1 -1
  181. package/build/server/context.test.js +32 -1
  182. package/build/server/context.test.js.map +1 -1
  183. package/build/server/doc-registry.js +0 -3
  184. package/build/server/doc-registry.js.map +1 -1
  185. package/build/server/doc-registry.test.js +0 -31
  186. package/build/server/doc-registry.test.js.map +1 -1
  187. package/build/server/index.d.ts +0 -1
  188. package/build/server/index.js +0 -1
  189. package/build/server/index.js.map +1 -1
  190. package/build/server/types.d.ts +6 -27
  191. package/build/stack-utils.d.ts +25 -0
  192. package/build/stack-utils.js +95 -0
  193. package/build/stack-utils.js.map +1 -0
  194. package/build/stack-utils.test.d.ts +1 -0
  195. package/build/stack-utils.test.js +80 -0
  196. package/build/stack-utils.test.js.map +1 -0
  197. package/docs/core.md +8 -0
  198. package/docs/http-integrations.md +41 -27
  199. package/package.json +8 -8
  200. package/src/adapters/astro/README.md +2 -0
  201. package/src/adapters/hono/envelope-parity.test.ts +6 -18
  202. package/src/adapters/hono/handlers/http-stream.ts +12 -3
  203. package/src/adapters/hono/handlers/http.ts +12 -3
  204. package/src/adapters/hono/handlers/rpc.ts +12 -3
  205. package/src/adapters/hono/handlers/stream.ts +12 -3
  206. package/src/adapters/hono/index.test.ts +70 -0
  207. package/src/adapters/hono/index.ts +53 -11
  208. package/src/adapters/hono/request.ts +18 -0
  209. package/src/adapters/hono/types.ts +37 -0
  210. package/src/codegen/bin/cli.ts +1 -1
  211. package/src/codegen/constants.ts +2 -2
  212. package/src/codegen/emit/api-route.ts +1 -1
  213. package/src/codegen/emit/scope-file.ts +1 -2
  214. package/src/codegen/emit-errors.integration.test.ts +2 -2
  215. package/src/codegen/resolve-envelope.ts +1 -1
  216. package/src/codegen/test-helpers/run-tsc.ts +0 -1
  217. package/src/core/create-http-stream.ts +20 -13
  218. package/src/core/create-http.test-d.ts +154 -0
  219. package/src/core/create-http.ts +19 -8
  220. package/src/core/create-stream.ts +12 -4
  221. package/src/core/create.test.ts +74 -0
  222. package/src/core/create.ts +10 -5
  223. package/src/core/internal.ts +35 -0
  224. package/src/core/procedures.ts +4 -0
  225. package/src/core/types.ts +99 -4
  226. package/src/exports.ts +6 -4
  227. package/src/schema/typebox.test.ts +0 -12
  228. package/src/schema/typebox.ts +2 -21
  229. package/src/server/context.test.ts +39 -1
  230. package/src/server/context.ts +54 -4
  231. package/src/server/doc-registry.test.ts +0 -34
  232. package/src/server/doc-registry.ts +0 -3
  233. package/src/server/index.ts +0 -1
  234. package/src/server/types.ts +8 -27
  235. package/build/server/spec-version.d.ts +0 -24
  236. package/build/server/spec-version.js +0 -26
  237. package/build/server/spec-version.js.map +0 -1
  238. package/build/version.d.ts +0 -9
  239. package/build/version.js +0 -11
  240. package/build/version.js.map +0 -1
  241. package/docs/doc-envelope-spec-v1.md +0 -296
  242. package/docs/doc-envelope-v1.schema.json +0 -253
  243. package/src/server/spec-version.ts +0 -27
  244. package/src/version.ts +0 -11
@@ -0,0 +1,192 @@
1
+ import { Procedures } from '../index.js';
2
+ import type { ErrorTaxonomy } from './http/error-taxonomy.js';
3
+ /**
4
+ * @typeParam TErrorKey - Union of valid taxonomy keys. Defaults to `string`
5
+ * (unconstrained). Narrow it by passing `keyof typeof yourTaxonomy & string`
6
+ * to get compile-time typo protection on `errors`.
7
+ */
8
+ export interface RPCConfig<TErrorKey extends string = string> {
9
+ scope: string | string[];
10
+ version: number;
11
+ /**
12
+ * Taxonomy keys for errors this procedure may emit. Purely informational at
13
+ * runtime (nothing is rejected), but populates the DocEnvelope per-route
14
+ * error list so generated clients can narrow their catch types.
15
+ */
16
+ errors?: TErrorKey[];
17
+ }
18
+ export type FactoryItem<C> = {
19
+ factory: ReturnType<typeof Procedures<C, RPCConfig>>;
20
+ factoryContext: (req: Request) => C;
21
+ };
22
+ export interface RPCHttpRouteDoc extends RPCConfig {
23
+ kind: 'rpc';
24
+ name: string;
25
+ path: string;
26
+ method: 'post';
27
+ jsonSchema: {
28
+ body?: Record<string, unknown>;
29
+ response?: Record<string, unknown>;
30
+ };
31
+ /** Taxonomy keys for errors this route may emit. */
32
+ errors?: string[];
33
+ }
34
+ export type StreamMode = 'sse' | 'text';
35
+ export type HttpMethod = 'get' | 'post' | 'put' | 'delete' | 'patch' | 'head';
36
+ /**
37
+ * @typeParam TErrorKey - Union of valid taxonomy keys. Defaults to `string`.
38
+ * Narrow it by passing `keyof typeof yourTaxonomy & string` for compile-time
39
+ * typo protection on `errors`.
40
+ */
41
+ export interface APIConfig<TErrorKey extends string = string> {
42
+ /** HTTP route path (supports Hono path params, e.g., '/users/:id') */
43
+ path: string;
44
+ /** HTTP method for this endpoint */
45
+ method: HttpMethod;
46
+ /** HTTP status code on success. Defaults: POST→201, DELETE→204, others→200 */
47
+ successStatus?: number;
48
+ /** Optional scope for grouping API routes in generated client files */
49
+ scope?: string;
50
+ /**
51
+ * Taxonomy keys for errors this procedure may emit. Purely informational at
52
+ * runtime (nothing is rejected), but populates the DocEnvelope per-route
53
+ * error list so generated clients can narrow their catch types.
54
+ */
55
+ errors?: TErrorKey[];
56
+ }
57
+ export interface APIHttpRouteDoc extends APIConfig {
58
+ kind: 'api';
59
+ name: string;
60
+ /** Full resolved path including pathPrefix */
61
+ fullPath: string;
62
+ jsonSchema: {
63
+ pathParams?: Record<string, unknown>;
64
+ query?: Record<string, unknown>;
65
+ body?: Record<string, unknown>;
66
+ headers?: Record<string, unknown>;
67
+ response?: Record<string, unknown>;
68
+ };
69
+ /** Taxonomy keys for errors this route may emit. */
70
+ errors?: string[];
71
+ }
72
+ /**
73
+ * Constrains schema.input channel names to valid HTTP input sources.
74
+ * Use with `satisfies` or as a type annotation to catch typos at compile time:
75
+ *
76
+ * @example
77
+ * schema: {
78
+ * input: {
79
+ * pathParams: Type.Object({ id: Type.String() }),
80
+ * qurey: Type.Object({ ... }), // TS error: 'qurey' not in APIInput
81
+ * } satisfies APIInput
82
+ * }
83
+ */
84
+ export type APIInput<T extends {
85
+ pathParams?: unknown;
86
+ query?: unknown;
87
+ body?: unknown;
88
+ headers?: unknown;
89
+ } = {
90
+ pathParams?: unknown;
91
+ query?: unknown;
92
+ body?: unknown;
93
+ headers?: unknown;
94
+ }> = T;
95
+ export interface StreamHttpRouteDoc extends RPCConfig {
96
+ kind: 'stream';
97
+ name: string;
98
+ path: string;
99
+ methods: ('get' | 'post')[];
100
+ streamMode: StreamMode;
101
+ jsonSchema: {
102
+ params?: Record<string, unknown>;
103
+ yieldType?: Record<string, unknown>;
104
+ returnType?: Record<string, unknown>;
105
+ };
106
+ /** Taxonomy keys for errors this route may emit (pre-stream only). */
107
+ errors?: string[];
108
+ }
109
+ /**
110
+ * Extracts the TContext type from a Procedures factory return type.
111
+ * Uses the first parameter of the handler function to infer the context type.
112
+ */
113
+ export type ExtractContext<TFactory> = TFactory extends {
114
+ getProcedures: () => Array<{
115
+ handler: (ctx: infer TContext, ...args: any[]) => any;
116
+ }>;
117
+ } ? TContext : never;
118
+ /**
119
+ * Extracts the TConfig type from a Procedures factory return type.
120
+ * Uses the config property of the procedure registration to infer the config type.
121
+ */
122
+ export type ExtractConfig<TFactory> = TFactory extends {
123
+ getProcedures: () => Array<{
124
+ config: infer TConfig;
125
+ }>;
126
+ } ? TConfig : never;
127
+ /**
128
+ * Minimal structural type for a Procedures factory.
129
+ * Uses explicit `any` types to avoid variance issues with generic constraints.
130
+ */
131
+ export type ProceduresFactory = {
132
+ getProcedures: () => Array<{
133
+ name: string;
134
+ isStream?: boolean;
135
+ config: any;
136
+ handler: (ctx: any, params?: any) => Promise<any> | AsyncGenerator<any, any, unknown>;
137
+ }>;
138
+ Create: (...args: any[]) => any;
139
+ CreateStream?: (...args: any[]) => any;
140
+ };
141
+ export type AnyHttpRouteDoc = RPCHttpRouteDoc | APIHttpRouteDoc | StreamHttpRouteDoc;
142
+ export interface DocSource<T = AnyHttpRouteDoc> {
143
+ readonly docs: T[];
144
+ /**
145
+ * Optional list of procedures that were registered with this builder but
146
+ * couldn't be served by it (e.g. a streaming procedure registered with an
147
+ * RPC builder). DocRegistry aggregates these across sources and warns at
148
+ * `toJSON()` time so silently-dropped procedures don't slip through.
149
+ */
150
+ readonly skippedProcedures?: {
151
+ name: string;
152
+ reason: string;
153
+ }[];
154
+ }
155
+ export interface HeaderDoc {
156
+ name: string;
157
+ description?: string;
158
+ required?: boolean;
159
+ example?: string;
160
+ }
161
+ export interface ErrorDoc {
162
+ name: string;
163
+ statusCode: number;
164
+ description: string;
165
+ schema?: Record<string, unknown>;
166
+ }
167
+ export interface DocRegistryConfig {
168
+ basePath?: string;
169
+ headers?: HeaderDoc[];
170
+ /**
171
+ * Errors to document in the envelope. Accepts either your runtime
172
+ * {@link ErrorTaxonomy} (from `defineErrorTaxonomy`) — the common case — or
173
+ * a raw `ErrorDoc[]` for consumers who aren't using a taxonomy.
174
+ *
175
+ * Framework defaults (`ProcedureError`, `ProcedureValidationError`,
176
+ * `ProcedureYieldValidationError`, `ProcedureRegistrationError`) are merged
177
+ * in automatically and deduped. Opt out via `includeDefaults: false`.
178
+ */
179
+ errors?: ErrorTaxonomy | ErrorDoc[];
180
+ /** Whether to auto-merge framework error defaults. Defaults to `true`. */
181
+ includeDefaults?: boolean;
182
+ }
183
+ export interface DocRegistryOutputOptions<TEnvelope = DocEnvelope> {
184
+ filter?: (route: AnyHttpRouteDoc) => boolean;
185
+ transform?: (envelope: DocEnvelope) => TEnvelope;
186
+ }
187
+ export interface DocEnvelope {
188
+ basePath: string;
189
+ headers: HeaderDoc[];
190
+ errors: ErrorDoc[];
191
+ routes: AnyHttpRouteDoc[];
192
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/implementations/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,165 @@
1
+ import { ProcedureError } from './errors.js';
2
+ import { Prettify, TJSONSchema, TSchemaLib } from './schema/types.js';
3
+ export type TNoContextProvided = unknown;
4
+ export type TLocalContext = {
5
+ error: (message: string, meta?: object) => ProcedureError;
6
+ signal?: AbortSignal;
7
+ };
8
+ export type TStreamContext = TLocalContext & {
9
+ signal: AbortSignal;
10
+ };
11
+ export type TProcedureRegistration<TContext = unknown, TExtendedConfig = unknown> = {
12
+ name: string;
13
+ isStream?: false;
14
+ config: {
15
+ description?: string;
16
+ schema?: {
17
+ params?: TJSONSchema;
18
+ returnType?: TJSONSchema;
19
+ input?: Record<string, TJSONSchema>;
20
+ };
21
+ validation?: {
22
+ params?: (params: any) => {
23
+ errors?: any[];
24
+ };
25
+ input?: Record<string, (value: any) => {
26
+ errors?: any[];
27
+ }>;
28
+ };
29
+ } & TExtendedConfig;
30
+ handler: (ctx: TContext, params?: any) => Promise<any>;
31
+ };
32
+ export type TStreamProcedureRegistration<TContext = unknown, TExtendedConfig = unknown> = {
33
+ name: string;
34
+ isStream: true;
35
+ config: {
36
+ description?: string;
37
+ schema?: {
38
+ params?: TJSONSchema;
39
+ yieldType?: TJSONSchema;
40
+ returnType?: TJSONSchema;
41
+ input?: Record<string, TJSONSchema>;
42
+ };
43
+ validation?: {
44
+ params?: (params: any) => {
45
+ errors?: any[];
46
+ };
47
+ yield?: (value: any) => {
48
+ errors?: any[];
49
+ };
50
+ input?: Record<string, (value: any) => {
51
+ errors?: any[];
52
+ }>;
53
+ };
54
+ } & TExtendedConfig;
55
+ handler: (ctx: TContext, params?: any) => AsyncGenerator<any, any, unknown>;
56
+ };
57
+ export declare function Procedures<TContext = TNoContextProvided, TExtendedConfig = unknown>(
58
+ /**
59
+ * Optionally provided builder to register Procedures
60
+ */
61
+ builder?: {
62
+ onCreate?: (procedure: Prettify<{
63
+ name: string;
64
+ isStream?: boolean;
65
+ handler: ((ctx: Prettify<TContext>, params?: any) => Promise<any>) | ((ctx: Prettify<TContext>, params?: any) => AsyncGenerator<any, any, unknown>);
66
+ config: Prettify<{
67
+ description?: string;
68
+ schema?: {
69
+ params?: TJSONSchema;
70
+ yieldType?: TJSONSchema;
71
+ returnType?: TJSONSchema;
72
+ input?: Record<string, TJSONSchema>;
73
+ };
74
+ validation?: {
75
+ params?: (params: any) => {
76
+ errors?: any[];
77
+ };
78
+ yield?: (value: any) => {
79
+ errors?: any[];
80
+ };
81
+ input?: Record<string, (value: any) => {
82
+ errors?: any[];
83
+ }>;
84
+ };
85
+ } & TExtendedConfig>;
86
+ }>) => void;
87
+ }): {
88
+ /**
89
+ * Get all registered procedures
90
+ */
91
+ getProcedures: () => (TProcedureRegistration<TContext, TExtendedConfig> | TStreamProcedureRegistration<TContext, TExtendedConfig>)[];
92
+ /**
93
+ * Get a specific procedure by name
94
+ */
95
+ getProcedure: (name: string) => TProcedureRegistration<TContext, TExtendedConfig> | TStreamProcedureRegistration<TContext, TExtendedConfig> | undefined;
96
+ /**
97
+ * Remove a procedure by name
98
+ */
99
+ removeProcedure: (name: string) => boolean;
100
+ /**
101
+ * Clear all registered procedures
102
+ */
103
+ clear: () => void;
104
+ Create: <TName extends string, TParams, TReturnType, TInput extends Record<string, unknown> | undefined = undefined>(name: TName, config: {
105
+ description?: string;
106
+ schema?: {
107
+ params?: TParams;
108
+ returnType?: TReturnType;
109
+ input?: TInput;
110
+ };
111
+ } & TExtendedConfig, handler: (ctx: Prettify<TContext & TLocalContext>, params: TInput extends Record<string, unknown> ? Prettify<{ [K in keyof TInput]: TSchemaLib<TInput[K]>; }> : TSchemaLib<TParams>) => Promise<TSchemaLib<TReturnType>>) => { [K in TName]: (ctx: Prettify<TContext>, params: TInput extends Record<string, unknown> ? Prettify<{ [K_1 in keyof TInput]: TSchemaLib<TInput[K_1]>; }> : TSchemaLib<TParams>) => Promise<TSchemaLib<TReturnType>>; } & {
112
+ procedure: (ctx: Prettify<TContext>, params: TInput extends Record<string, unknown> ? Prettify<{ [K in keyof TInput]: TSchemaLib<TInput[K]>; }> : TSchemaLib<TParams>) => Promise<TSchemaLib<TReturnType>>;
113
+ info: {
114
+ name: TName;
115
+ description?: string;
116
+ schema: {
117
+ params?: TParams;
118
+ returnType?: TReturnType;
119
+ input?: TInput;
120
+ };
121
+ validation?: {
122
+ params?: (params: any) => {
123
+ errors?: any[];
124
+ };
125
+ input?: Record<string, (value: any) => {
126
+ errors?: any[];
127
+ }>;
128
+ };
129
+ } & TExtendedConfig;
130
+ };
131
+ CreateStream: <TName extends string, TParams, TYieldType, TReturnType = void, TInput extends Record<string, unknown> | undefined = undefined>(name: TName, config: {
132
+ description?: string;
133
+ schema?: {
134
+ params?: TParams;
135
+ yieldType?: TYieldType;
136
+ returnType?: TReturnType;
137
+ input?: TInput;
138
+ };
139
+ validateYields?: boolean;
140
+ } & TExtendedConfig, handler: (ctx: Prettify<TContext & TStreamContext>, params: TInput extends Record<string, unknown> ? Prettify<{ [K in keyof TInput]: TSchemaLib<TInput[K]>; }> : TSchemaLib<TParams>) => AsyncGenerator<TSchemaLib<TYieldType>, TSchemaLib<TReturnType> | void, unknown>) => { [K in TName]: (ctx: Prettify<TContext>, params: TInput extends Record<string, unknown> ? Prettify<{ [K_1 in keyof TInput]: TSchemaLib<TInput[K_1]>; }> : TSchemaLib<TParams>) => AsyncGenerator<TSchemaLib<TYieldType>, TSchemaLib<TReturnType> | void, unknown>; } & {
141
+ procedure: (ctx: Prettify<TContext>, params: TInput extends Record<string, unknown> ? Prettify<{ [K in keyof TInput]: TSchemaLib<TInput[K]>; }> : TSchemaLib<TParams>) => AsyncGenerator<TSchemaLib<TYieldType>, TSchemaLib<TReturnType> | void, unknown>;
142
+ info: {
143
+ name: TName;
144
+ isStream: true;
145
+ description?: string;
146
+ schema: {
147
+ params?: TParams;
148
+ yieldType?: TYieldType;
149
+ returnType?: TReturnType;
150
+ input?: TInput;
151
+ };
152
+ validation?: {
153
+ params?: (params: any) => {
154
+ errors?: any[];
155
+ };
156
+ yield?: (value: any) => {
157
+ errors?: any[];
158
+ };
159
+ input?: Record<string, (value: any) => {
160
+ errors?: any[];
161
+ }>;
162
+ };
163
+ } & TExtendedConfig;
164
+ };
165
+ };
package/build/index.js ADDED
@@ -0,0 +1,258 @@
1
+ import { ProcedureError, ProcedureValidationError, ProcedureYieldValidationError, } from './errors.js';
2
+ import { computeSchema } from './schema/compute-schema.js';
3
+ import { captureDefinitionInfo } from './stack-utils.js';
4
+ export function Procedures(
5
+ /**
6
+ * Optionally provided builder to register Procedures
7
+ */
8
+ builder) {
9
+ const procedures = new Map();
10
+ function Create(name, config, handler) {
11
+ // Capture definition location as first action
12
+ const definitionInfo = captureDefinitionInfo();
13
+ // BEFORE computeSchema - fail fast on duplicate
14
+ if (procedures.has(name)) {
15
+ throw new Error(`Procedure with name ${name} is already registered`);
16
+ }
17
+ const { jsonSchema, validations } = computeSchema(name, config.schema, definitionInfo);
18
+ // Create error factory once at registration time (outside handler)
19
+ const errorFactory = (message, meta) => {
20
+ return new ProcedureError(name, message, meta, definitionInfo);
21
+ };
22
+ const registeredProcedure = {
23
+ name,
24
+ config: {
25
+ // ctx: config.hook, ??? why was this here
26
+ ...config,
27
+ description: config.description,
28
+ schema: jsonSchema,
29
+ validation: {
30
+ params: validations.params,
31
+ ...(validations.input && { input: validations.input }),
32
+ },
33
+ },
34
+ handler: async (ctx, params) => {
35
+ try {
36
+ // Skip validation if caller has already validated (e.g., HonoStreamAppBuilder)
37
+ const isPrevalidated = ctx.isPrevalidated;
38
+ if (validations?.params && !isPrevalidated) {
39
+ const { errors } = validations.params(params);
40
+ if (errors) {
41
+ throw new ProcedureValidationError(name, `Validation error for ${name}`, errors, definitionInfo);
42
+ }
43
+ }
44
+ // Validate each input channel independently for better error messages.
45
+ // Double validation (per-channel + merged) is intentional for developer experience;
46
+ // the cost is negligible — revisit if validation becomes a performance bottleneck.
47
+ if (validations?.input && !isPrevalidated) {
48
+ for (const [channel, validator] of Object.entries(validations.input)) {
49
+ const channelValue = params?.[channel];
50
+ const { errors } = validator(channelValue);
51
+ if (errors) {
52
+ throw new ProcedureValidationError(name, `Validation error for ${name} in input.${channel}`, errors, definitionInfo);
53
+ }
54
+ }
55
+ }
56
+ const localCtx = {
57
+ error: errorFactory, // Reuse pre-created factory
58
+ };
59
+ // params is correctly typed at the public API boundary via conditional type;
60
+ // cast here because TS cannot narrow conditional generics inside implementations
61
+ return await handler({
62
+ ...ctx,
63
+ ...localCtx,
64
+ }, params);
65
+ }
66
+ catch (error) {
67
+ if (error instanceof ProcedureError) {
68
+ throw error;
69
+ }
70
+ else {
71
+ const err = new ProcedureError(name, `Error in handler for ${name} - ${error?.message}`, undefined, definitionInfo);
72
+ err.cause = error; // Preserve original error
73
+ // Preserve original stack but append definition info
74
+ if (error.stack && definitionInfo.definedAt) {
75
+ const { file, line, column } = definitionInfo.definedAt;
76
+ err.stack =
77
+ error.stack +
78
+ `\n--- Procedure "${name}" defined at ---\n at ${file}:${line}:${column}`;
79
+ }
80
+ else if (error.stack) {
81
+ err.stack = error.stack;
82
+ }
83
+ throw err;
84
+ }
85
+ }
86
+ },
87
+ };
88
+ procedures.set(name, registeredProcedure);
89
+ if (builder?.onCreate) {
90
+ builder.onCreate(registeredProcedure);
91
+ }
92
+ const info = {
93
+ name,
94
+ ...registeredProcedure.config,
95
+ };
96
+ // return so can be called directly (ie: int/unit tests)
97
+ return {
98
+ [name]: registeredProcedure.handler,
99
+ procedure: registeredProcedure.handler,
100
+ info,
101
+ };
102
+ }
103
+ function CreateStream(name, config, handler) {
104
+ // Capture definition location as first action
105
+ const definitionInfo = captureDefinitionInfo();
106
+ // BEFORE computeSchema - fail fast on duplicate
107
+ if (procedures.has(name)) {
108
+ throw new Error(`Procedure with name ${name} is already registered`);
109
+ }
110
+ const { jsonSchema, validations } = computeSchema(name, config.schema, definitionInfo);
111
+ // Create error factory once at registration time (outside handler)
112
+ const errorFactory = (message, meta) => {
113
+ return new ProcedureError(name, message, meta, definitionInfo);
114
+ };
115
+ const validateYields = config.validateYields ?? false;
116
+ const registeredProcedure = {
117
+ name,
118
+ isStream: true,
119
+ config: {
120
+ ...config,
121
+ description: config.description,
122
+ schema: jsonSchema,
123
+ validation: {
124
+ params: validations.params,
125
+ yield: validations.yield,
126
+ ...(validations.input && { input: validations.input }),
127
+ },
128
+ },
129
+ handler: async function* wrappedHandler(ctx, params) {
130
+ // Create abort controller for this stream
131
+ const abortController = new AbortController();
132
+ // Skip validation if caller has already validated (e.g., HonoStreamAppBuilder)
133
+ const isPrevalidated = ctx.isPrevalidated;
134
+ if (validations?.params && !isPrevalidated) {
135
+ const { errors } = validations.params(params);
136
+ if (errors) {
137
+ throw new ProcedureValidationError(name, `Validation error for ${name}`, errors, definitionInfo);
138
+ }
139
+ }
140
+ // Validate each input channel independently (see Create for rationale)
141
+ if (validations?.input && !isPrevalidated) {
142
+ for (const [channel, validator] of Object.entries(validations.input)) {
143
+ const channelValue = params?.[channel];
144
+ const { errors } = validator(channelValue);
145
+ if (errors) {
146
+ throw new ProcedureValidationError(name, `Validation error for ${name} in input.${channel}`, errors, definitionInfo);
147
+ }
148
+ }
149
+ }
150
+ // Combine with external signal (e.g., from HTTP request) if provided
151
+ const incomingSignal = ctx.signal;
152
+ const signal = incomingSignal
153
+ ? AbortSignal.any([incomingSignal, abortController.signal])
154
+ : abortController.signal;
155
+ const streamCtx = {
156
+ error: errorFactory,
157
+ signal,
158
+ };
159
+ // params is correctly typed at the public API boundary via conditional type;
160
+ // cast here because TS cannot narrow conditional generics inside implementations
161
+ const userGenerator = handler({
162
+ ...ctx,
163
+ ...streamCtx,
164
+ }, params);
165
+ const userIterator = userGenerator[Symbol.asyncIterator]();
166
+ try {
167
+ let userIterResult = await userIterator.next();
168
+ while (!userIterResult.done) {
169
+ const value = userIterResult.value;
170
+ // Only validate if explicitly enabled via validateYields: true
171
+ if (validateYields && validations.yield) {
172
+ const { errors } = validations.yield(value);
173
+ if (errors) {
174
+ throw new ProcedureYieldValidationError(name, `Yield validation error for ${name}`, errors, definitionInfo);
175
+ }
176
+ }
177
+ yield value;
178
+ userIterResult = await userIterator.next();
179
+ }
180
+ // Propagate the generator's return value so consumers (e.g. HonoStreamAppBuilder)
181
+ // can send it as a special 'return' SSE event
182
+ return userIterResult.value;
183
+ }
184
+ catch (error) {
185
+ // Preserve the original error class so HTTP builders' taxonomies and
186
+ // `onMidStreamError` callbacks see the actual thrown type — boxing
187
+ // user-defined errors inside ProcedureError defeats route-declared
188
+ // typed-error dispatch on the client. Augment the stack trace in
189
+ // place with the procedure's definition site when available.
190
+ if (definitionInfo.definedAt &&
191
+ error &&
192
+ typeof error.stack === 'string') {
193
+ const { file, line, column } = definitionInfo.definedAt;
194
+ error.stack =
195
+ `${error.stack}\n--- Procedure "${name}" defined at ---\n at ${file}:${line}:${column}`;
196
+ }
197
+ throw error;
198
+ }
199
+ finally {
200
+ // Propagate `.return()` to the user generator so its `finally`
201
+ // blocks (and any `signal`-driven cleanup) run when the consumer
202
+ // closes the stream early. No-op when iteration already completed.
203
+ try {
204
+ await userIterator.return?.(undefined);
205
+ }
206
+ catch {
207
+ // Swallow — cleanup must not mask the primary error path
208
+ }
209
+ abortController.abort('stream-completed');
210
+ }
211
+ },
212
+ };
213
+ procedures.set(name, registeredProcedure);
214
+ if (builder?.onCreate) {
215
+ builder.onCreate(registeredProcedure);
216
+ }
217
+ const info = {
218
+ name,
219
+ isStream: true,
220
+ ...registeredProcedure.config,
221
+ };
222
+ // return so can be called directly (ie: int/unit tests)
223
+ return {
224
+ [name]: registeredProcedure.handler,
225
+ procedure: registeredProcedure.handler,
226
+ info,
227
+ };
228
+ }
229
+ return {
230
+ /**
231
+ * Get all registered procedures
232
+ */
233
+ getProcedures: () => {
234
+ return Array.from(procedures.values());
235
+ },
236
+ /**
237
+ * Get a specific procedure by name
238
+ */
239
+ getProcedure: (name) => {
240
+ return procedures.get(name);
241
+ },
242
+ /**
243
+ * Remove a procedure by name
244
+ */
245
+ removeProcedure: (name) => {
246
+ return procedures.delete(name);
247
+ },
248
+ /**
249
+ * Clear all registered procedures
250
+ */
251
+ clear: () => {
252
+ procedures.clear();
253
+ },
254
+ Create,
255
+ CreateStream,
256
+ };
257
+ }
258
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,wBAAwB,EACxB,6BAA6B,GAC9B,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAE1D,OAAO,EAAE,qB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