ts-procedures 5.14.0 → 5.16.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 (277) hide show
  1. package/agent_config/claude-code/skills/ts-procedures/SKILL.md +1 -1
  2. package/agent_config/claude-code/skills/ts-procedures/api-reference.md +59 -4
  3. package/agent_config/claude-code/skills/ts-procedures/patterns.md +103 -3
  4. package/agent_config/claude-code/skills/ts-procedures-scaffold/templates/client.md +36 -5
  5. package/agent_config/copilot/copilot-instructions.md +56 -7
  6. package/agent_config/cursor/cursorrules +56 -7
  7. package/build/client/call.d.ts +18 -9
  8. package/build/client/call.js +25 -19
  9. package/build/client/call.js.map +1 -1
  10. package/build/client/call.test.js +167 -17
  11. package/build/client/call.test.js.map +1 -1
  12. package/build/client/index.d.ts +1 -1
  13. package/build/client/index.js +18 -3
  14. package/build/client/index.js.map +1 -1
  15. package/build/client/index.test.js +104 -0
  16. package/build/client/index.test.js.map +1 -1
  17. package/build/client/resolve-options.d.ts +45 -0
  18. package/build/client/resolve-options.js +82 -0
  19. package/build/client/resolve-options.js.map +1 -0
  20. package/build/client/resolve-options.test.js +158 -0
  21. package/build/client/resolve-options.test.js.map +1 -0
  22. package/build/client/stream.d.ts +18 -9
  23. package/build/client/stream.js +24 -19
  24. package/build/client/stream.js.map +1 -1
  25. package/build/client/stream.test.js +102 -46
  26. package/build/client/stream.test.js.map +1 -1
  27. package/build/client/types.d.ts +68 -1
  28. package/build/client/types.js +1 -1
  29. package/build/codegen/bin/cli.d.ts +2 -0
  30. package/build/codegen/bin/cli.js +11 -0
  31. package/build/codegen/bin/cli.js.map +1 -1
  32. package/build/codegen/bin/cli.test.js +30 -0
  33. package/build/codegen/bin/cli.test.js.map +1 -1
  34. package/build/codegen/e2e.test.js +141 -0
  35. package/build/codegen/e2e.test.js.map +1 -1
  36. package/build/codegen/emit-client-runtime.js +3 -0
  37. package/build/codegen/emit-client-runtime.js.map +1 -1
  38. package/build/codegen/index.d.ts +1 -0
  39. package/build/codegen/index.js +1 -0
  40. package/build/codegen/index.js.map +1 -1
  41. package/build/codegen/pipeline.d.ts +1 -0
  42. package/build/codegen/pipeline.js +8 -2
  43. package/build/codegen/pipeline.js.map +1 -1
  44. package/build/codegen/pipeline.test.js +34 -1
  45. package/build/codegen/pipeline.test.js.map +1 -1
  46. package/docs/client-and-codegen.md +125 -2
  47. package/package.json +1 -1
  48. package/src/client/call.test.ts +202 -29
  49. package/src/client/call.ts +41 -28
  50. package/src/client/index.test.ts +117 -0
  51. package/src/client/index.ts +25 -8
  52. package/src/client/resolve-options.test.ts +205 -0
  53. package/src/client/resolve-options.ts +113 -0
  54. package/src/client/stream.test.ts +132 -107
  55. package/src/client/stream.ts +40 -25
  56. package/src/client/types.ts +74 -2
  57. package/src/codegen/bin/cli.test.ts +35 -0
  58. package/src/codegen/bin/cli.ts +11 -0
  59. package/src/codegen/e2e.test.ts +151 -0
  60. package/src/codegen/emit-client-runtime.ts +3 -0
  61. package/src/codegen/index.ts +2 -0
  62. package/src/codegen/pipeline.test.ts +46 -1
  63. package/src/codegen/pipeline.ts +9 -2
  64. package/src/implementations/http/README.md +11 -1
  65. package/build/src/client/call.d.ts +0 -14
  66. package/build/src/client/call.js +0 -47
  67. package/build/src/client/call.js.map +0 -1
  68. package/build/src/client/call.test.js +0 -124
  69. package/build/src/client/call.test.js.map +0 -1
  70. package/build/src/client/errors.d.ts +0 -25
  71. package/build/src/client/errors.js +0 -33
  72. package/build/src/client/errors.js.map +0 -1
  73. package/build/src/client/errors.test.d.ts +0 -1
  74. package/build/src/client/errors.test.js +0 -41
  75. package/build/src/client/errors.test.js.map +0 -1
  76. package/build/src/client/fetch-adapter.d.ts +0 -12
  77. package/build/src/client/fetch-adapter.js +0 -156
  78. package/build/src/client/fetch-adapter.js.map +0 -1
  79. package/build/src/client/fetch-adapter.test.d.ts +0 -1
  80. package/build/src/client/fetch-adapter.test.js +0 -271
  81. package/build/src/client/fetch-adapter.test.js.map +0 -1
  82. package/build/src/client/hooks.d.ts +0 -17
  83. package/build/src/client/hooks.js +0 -40
  84. package/build/src/client/hooks.js.map +0 -1
  85. package/build/src/client/hooks.test.d.ts +0 -1
  86. package/build/src/client/hooks.test.js +0 -163
  87. package/build/src/client/hooks.test.js.map +0 -1
  88. package/build/src/client/index.d.ts +0 -22
  89. package/build/src/client/index.js +0 -67
  90. package/build/src/client/index.js.map +0 -1
  91. package/build/src/client/index.test.d.ts +0 -1
  92. package/build/src/client/index.test.js +0 -231
  93. package/build/src/client/index.test.js.map +0 -1
  94. package/build/src/client/request-builder.d.ts +0 -13
  95. package/build/src/client/request-builder.js +0 -53
  96. package/build/src/client/request-builder.js.map +0 -1
  97. package/build/src/client/request-builder.test.d.ts +0 -1
  98. package/build/src/client/request-builder.test.js +0 -160
  99. package/build/src/client/request-builder.test.js.map +0 -1
  100. package/build/src/client/stream.d.ts +0 -27
  101. package/build/src/client/stream.js +0 -118
  102. package/build/src/client/stream.js.map +0 -1
  103. package/build/src/client/stream.test.d.ts +0 -1
  104. package/build/src/client/stream.test.js +0 -228
  105. package/build/src/client/stream.test.js.map +0 -1
  106. package/build/src/client/types.d.ts +0 -78
  107. package/build/src/client/types.js +0 -3
  108. package/build/src/client/types.js.map +0 -1
  109. package/build/src/codegen/bin/cli.d.ts +0 -45
  110. package/build/src/codegen/bin/cli.js +0 -246
  111. package/build/src/codegen/bin/cli.js.map +0 -1
  112. package/build/src/codegen/bin/cli.test.d.ts +0 -1
  113. package/build/src/codegen/bin/cli.test.js +0 -220
  114. package/build/src/codegen/bin/cli.test.js.map +0 -1
  115. package/build/src/codegen/constants.d.ts +0 -1
  116. package/build/src/codegen/constants.js +0 -2
  117. package/build/src/codegen/constants.js.map +0 -1
  118. package/build/src/codegen/e2e.test.d.ts +0 -1
  119. package/build/src/codegen/e2e.test.js +0 -464
  120. package/build/src/codegen/e2e.test.js.map +0 -1
  121. package/build/src/codegen/emit-client-runtime.d.ts +0 -9
  122. package/build/src/codegen/emit-client-runtime.js +0 -99
  123. package/build/src/codegen/emit-client-runtime.js.map +0 -1
  124. package/build/src/codegen/emit-client-runtime.test.d.ts +0 -1
  125. package/build/src/codegen/emit-client-runtime.test.js +0 -78
  126. package/build/src/codegen/emit-client-runtime.test.js.map +0 -1
  127. package/build/src/codegen/emit-client-types.d.ts +0 -8
  128. package/build/src/codegen/emit-client-types.js +0 -25
  129. package/build/src/codegen/emit-client-types.js.map +0 -1
  130. package/build/src/codegen/emit-client-types.test.d.ts +0 -1
  131. package/build/src/codegen/emit-client-types.test.js +0 -33
  132. package/build/src/codegen/emit-client-types.test.js.map +0 -1
  133. package/build/src/codegen/emit-errors.d.ts +0 -19
  134. package/build/src/codegen/emit-errors.js +0 -59
  135. package/build/src/codegen/emit-errors.js.map +0 -1
  136. package/build/src/codegen/emit-errors.test.d.ts +0 -1
  137. package/build/src/codegen/emit-errors.test.js +0 -175
  138. package/build/src/codegen/emit-errors.test.js.map +0 -1
  139. package/build/src/codegen/emit-index.d.ts +0 -12
  140. package/build/src/codegen/emit-index.js +0 -41
  141. package/build/src/codegen/emit-index.js.map +0 -1
  142. package/build/src/codegen/emit-index.test.d.ts +0 -1
  143. package/build/src/codegen/emit-index.test.js +0 -106
  144. package/build/src/codegen/emit-index.test.js.map +0 -1
  145. package/build/src/codegen/emit-scope.d.ts +0 -15
  146. package/build/src/codegen/emit-scope.js +0 -299
  147. package/build/src/codegen/emit-scope.js.map +0 -1
  148. package/build/src/codegen/emit-scope.test.d.ts +0 -1
  149. package/build/src/codegen/emit-scope.test.js +0 -559
  150. package/build/src/codegen/emit-scope.test.js.map +0 -1
  151. package/build/src/codegen/emit-types.d.ts +0 -43
  152. package/build/src/codegen/emit-types.js +0 -111
  153. package/build/src/codegen/emit-types.js.map +0 -1
  154. package/build/src/codegen/emit-types.test.d.ts +0 -1
  155. package/build/src/codegen/emit-types.test.js +0 -184
  156. package/build/src/codegen/emit-types.test.js.map +0 -1
  157. package/build/src/codegen/group-routes.d.ts +0 -23
  158. package/build/src/codegen/group-routes.js +0 -46
  159. package/build/src/codegen/group-routes.js.map +0 -1
  160. package/build/src/codegen/group-routes.test.d.ts +0 -1
  161. package/build/src/codegen/group-routes.test.js +0 -131
  162. package/build/src/codegen/group-routes.test.js.map +0 -1
  163. package/build/src/codegen/index.d.ts +0 -15
  164. package/build/src/codegen/index.js +0 -16
  165. package/build/src/codegen/index.js.map +0 -1
  166. package/build/src/codegen/naming.d.ts +0 -7
  167. package/build/src/codegen/naming.js +0 -21
  168. package/build/src/codegen/naming.js.map +0 -1
  169. package/build/src/codegen/naming.test.d.ts +0 -1
  170. package/build/src/codegen/naming.test.js +0 -40
  171. package/build/src/codegen/naming.test.js.map +0 -1
  172. package/build/src/codegen/pipeline.d.ts +0 -17
  173. package/build/src/codegen/pipeline.js +0 -78
  174. package/build/src/codegen/pipeline.js.map +0 -1
  175. package/build/src/codegen/pipeline.test.d.ts +0 -1
  176. package/build/src/codegen/pipeline.test.js +0 -269
  177. package/build/src/codegen/pipeline.test.js.map +0 -1
  178. package/build/src/codegen/resolve-envelope.d.ts +0 -7
  179. package/build/src/codegen/resolve-envelope.js +0 -46
  180. package/build/src/codegen/resolve-envelope.js.map +0 -1
  181. package/build/src/codegen/resolve-envelope.test.d.ts +0 -1
  182. package/build/src/codegen/resolve-envelope.test.js +0 -69
  183. package/build/src/codegen/resolve-envelope.test.js.map +0 -1
  184. package/build/src/errors.d.ts +0 -33
  185. package/build/src/errors.js +0 -91
  186. package/build/src/errors.js.map +0 -1
  187. package/build/src/errors.test.d.ts +0 -1
  188. package/build/src/errors.test.js +0 -122
  189. package/build/src/errors.test.js.map +0 -1
  190. package/build/src/exports.d.ts +0 -7
  191. package/build/src/exports.js +0 -8
  192. package/build/src/exports.js.map +0 -1
  193. package/build/src/implementations/http/doc-registry.d.ts +0 -12
  194. package/build/src/implementations/http/doc-registry.js +0 -114
  195. package/build/src/implementations/http/doc-registry.js.map +0 -1
  196. package/build/src/implementations/http/doc-registry.test.d.ts +0 -1
  197. package/build/src/implementations/http/doc-registry.test.js +0 -347
  198. package/build/src/implementations/http/doc-registry.test.js.map +0 -1
  199. package/build/src/implementations/http/express-rpc/index.d.ts +0 -94
  200. package/build/src/implementations/http/express-rpc/index.js +0 -185
  201. package/build/src/implementations/http/express-rpc/index.js.map +0 -1
  202. package/build/src/implementations/http/express-rpc/index.test.d.ts +0 -1
  203. package/build/src/implementations/http/express-rpc/index.test.js +0 -684
  204. package/build/src/implementations/http/express-rpc/index.test.js.map +0 -1
  205. package/build/src/implementations/http/express-rpc/types.d.ts +0 -11
  206. package/build/src/implementations/http/express-rpc/types.js +0 -2
  207. package/build/src/implementations/http/express-rpc/types.js.map +0 -1
  208. package/build/src/implementations/http/hono-api/index.d.ts +0 -102
  209. package/build/src/implementations/http/hono-api/index.js +0 -341
  210. package/build/src/implementations/http/hono-api/index.js.map +0 -1
  211. package/build/src/implementations/http/hono-api/index.test.d.ts +0 -1
  212. package/build/src/implementations/http/hono-api/index.test.js +0 -992
  213. package/build/src/implementations/http/hono-api/index.test.js.map +0 -1
  214. package/build/src/implementations/http/hono-api/types.d.ts +0 -13
  215. package/build/src/implementations/http/hono-api/types.js +0 -2
  216. package/build/src/implementations/http/hono-api/types.js.map +0 -1
  217. package/build/src/implementations/http/hono-rpc/index.d.ts +0 -92
  218. package/build/src/implementations/http/hono-rpc/index.js +0 -161
  219. package/build/src/implementations/http/hono-rpc/index.js.map +0 -1
  220. package/build/src/implementations/http/hono-rpc/index.test.d.ts +0 -1
  221. package/build/src/implementations/http/hono-rpc/index.test.js +0 -803
  222. package/build/src/implementations/http/hono-rpc/index.test.js.map +0 -1
  223. package/build/src/implementations/http/hono-rpc/types.d.ts +0 -11
  224. package/build/src/implementations/http/hono-rpc/types.js +0 -2
  225. package/build/src/implementations/http/hono-rpc/types.js.map +0 -1
  226. package/build/src/implementations/http/hono-stream/index.d.ts +0 -120
  227. package/build/src/implementations/http/hono-stream/index.js +0 -309
  228. package/build/src/implementations/http/hono-stream/index.js.map +0 -1
  229. package/build/src/implementations/http/hono-stream/index.test.d.ts +0 -1
  230. package/build/src/implementations/http/hono-stream/index.test.js +0 -1356
  231. package/build/src/implementations/http/hono-stream/index.test.js.map +0 -1
  232. package/build/src/implementations/http/hono-stream/types.d.ts +0 -15
  233. package/build/src/implementations/http/hono-stream/types.js +0 -2
  234. package/build/src/implementations/http/hono-stream/types.js.map +0 -1
  235. package/build/src/implementations/types.d.ts +0 -142
  236. package/build/src/implementations/types.js +0 -2
  237. package/build/src/implementations/types.js.map +0 -1
  238. package/build/src/index.d.ts +0 -165
  239. package/build/src/index.js +0 -253
  240. package/build/src/index.js.map +0 -1
  241. package/build/src/index.test.d.ts +0 -1
  242. package/build/src/index.test.js +0 -890
  243. package/build/src/index.test.js.map +0 -1
  244. package/build/src/schema/compute-schema.d.ts +0 -35
  245. package/build/src/schema/compute-schema.js +0 -41
  246. package/build/src/schema/compute-schema.js.map +0 -1
  247. package/build/src/schema/compute-schema.test.d.ts +0 -1
  248. package/build/src/schema/compute-schema.test.js +0 -107
  249. package/build/src/schema/compute-schema.test.js.map +0 -1
  250. package/build/src/schema/extract-json-schema.d.ts +0 -2
  251. package/build/src/schema/extract-json-schema.js +0 -12
  252. package/build/src/schema/extract-json-schema.js.map +0 -1
  253. package/build/src/schema/extract-json-schema.test.d.ts +0 -1
  254. package/build/src/schema/extract-json-schema.test.js +0 -23
  255. package/build/src/schema/extract-json-schema.test.js.map +0 -1
  256. package/build/src/schema/parser.d.ts +0 -28
  257. package/build/src/schema/parser.js +0 -170
  258. package/build/src/schema/parser.js.map +0 -1
  259. package/build/src/schema/parser.test.d.ts +0 -1
  260. package/build/src/schema/parser.test.js +0 -120
  261. package/build/src/schema/parser.test.js.map +0 -1
  262. package/build/src/schema/resolve-schema-lib.d.ts +0 -12
  263. package/build/src/schema/resolve-schema-lib.js +0 -11
  264. package/build/src/schema/resolve-schema-lib.js.map +0 -1
  265. package/build/src/schema/resolve-schema-lib.test.d.ts +0 -1
  266. package/build/src/schema/resolve-schema-lib.test.js +0 -17
  267. package/build/src/schema/resolve-schema-lib.test.js.map +0 -1
  268. package/build/src/schema/types.d.ts +0 -8
  269. package/build/src/schema/types.js +0 -2
  270. package/build/src/schema/types.js.map +0 -1
  271. package/build/src/stack-utils.d.ts +0 -25
  272. package/build/src/stack-utils.js +0 -95
  273. package/build/src/stack-utils.js.map +0 -1
  274. package/build/src/stack-utils.test.d.ts +0 -1
  275. package/build/src/stack-utils.test.js +0 -80
  276. package/build/src/stack-utils.test.js.map +0 -1
  277. /package/build/{src/client/call.test.d.ts → client/resolve-options.test.d.ts} +0 -0
@@ -21,6 +21,7 @@ export interface CodegenConfig {
21
21
  namespaceTypes?: boolean
22
22
  selfContained?: boolean
23
23
  serviceName?: string
24
+ cleanOutDir?: boolean
24
25
  }
25
26
 
26
27
  export interface ParsedArgs {
@@ -35,6 +36,7 @@ export interface ParsedArgs {
35
36
  namespaceTypes: boolean
36
37
  selfContained: boolean
37
38
  serviceName?: string
39
+ cleanOutDir: boolean
38
40
  }
39
41
 
40
42
  // ---------------------------------------------------------------------------
@@ -85,6 +87,7 @@ export function parseArgs(argv: string[], config?: CodegenConfig): ParsedArgs {
85
87
  let namespaceTypes = config?.namespaceTypes ?? true
86
88
  let selfContained = config?.selfContained ?? true
87
89
  let serviceName: string | undefined = config?.serviceName
90
+ let cleanOutDir = config?.cleanOutDir ?? false
88
91
  let configPath: string | undefined
89
92
 
90
93
  for (let i = 0; i < argv.length; i++) {
@@ -130,6 +133,10 @@ export function parseArgs(argv: string[], config?: CodegenConfig): ParsedArgs {
130
133
  selfContained = false
131
134
  } else if (arg === '--service-name') {
132
135
  serviceName = argv[++i]
136
+ } else if (arg === '--clean-out-dir') {
137
+ cleanOutDir = true
138
+ } else if (arg === '--no-clean-out-dir') {
139
+ cleanOutDir = false
133
140
  } else if (arg === '--config') {
134
141
  configPath = argv[++i]
135
142
  }
@@ -158,6 +165,7 @@ export function parseArgs(argv: string[], config?: CodegenConfig): ParsedArgs {
158
165
  namespaceTypes,
159
166
  selfContained,
160
167
  ...(serviceName !== undefined ? { serviceName } : {}),
168
+ cleanOutDir,
161
169
  }
162
170
  }
163
171
 
@@ -190,6 +198,7 @@ async function runWithWatch(parsed: ParsedArgs): Promise<void> {
190
198
  namespaceTypes: parsed.namespaceTypes,
191
199
  selfContained: parsed.selfContained,
192
200
  serviceName: parsed.serviceName,
201
+ cleanOutDir: parsed.cleanOutDir,
193
202
  }
194
203
 
195
204
  let lastHash: string | undefined
@@ -216,6 +225,7 @@ async function runWithWatch(parsed: ParsedArgs): Promise<void> {
216
225
  namespaceTypes: parsed.namespaceTypes,
217
226
  selfContained: parsed.selfContained,
218
227
  serviceName: parsed.serviceName,
228
+ cleanOutDir: parsed.cleanOutDir,
219
229
  })
220
230
  console.log(`[ts-procedures-codegen] Generated client files → ${parsed.outDir}`)
221
231
  } catch (err) {
@@ -258,6 +268,7 @@ async function main(): Promise<void> {
258
268
  namespaceTypes: parsed.namespaceTypes,
259
269
  selfContained: parsed.selfContained,
260
270
  serviceName: parsed.serviceName,
271
+ cleanOutDir: parsed.cleanOutDir,
261
272
  })
262
273
  if (parsed.dryRun) {
263
274
  console.log(`[ts-procedures-codegen] Dry run complete — ${result.length} files would be generated`)
@@ -481,6 +481,157 @@ describe('E2E: generateClient full pipeline', () => {
481
481
  execSync(`${tscPath} --noEmit --project ${join(tmpDir, 'tsconfig.json')}`, { stdio: 'pipe' })
482
482
  }).not.toThrow()
483
483
  })
484
+
485
+ it('_types.ts exports RequestMeta (empty interface ready for augmentation)', async () => {
486
+ tmpDir = makeTmpDir()
487
+ await generateClient({ envelope, outDir: tmpDir, selfContained: true })
488
+
489
+ const content = readFileSync(join(tmpDir, '_types.ts'), 'utf-8')
490
+ expect(content).toContain('export interface RequestMeta')
491
+ // meta on AdapterRequest and ProcedureCallDefaults should be typed as RequestMeta
492
+ expect(content).toContain('meta?: RequestMeta')
493
+ })
494
+
495
+ it('developers can augment RequestMeta for typed per-call meta + typed hook/adapter access', async () => {
496
+ tmpDir = makeTmpDir()
497
+ await generateClient({ envelope, outDir: tmpDir, selfContained: true })
498
+
499
+ // Write a consumer file that augments RequestMeta, then uses typed meta
500
+ // end-to-end: per-call options, createClient defaults, onBeforeRequest, and adapter.
501
+ const consumer = `
502
+ import { createClient } from './_client'
503
+ import type { ClientAdapter } from './_types'
504
+ import { createApiBindings } from './index'
505
+
506
+ declare module './_types' {
507
+ interface RequestMeta {
508
+ traceId: string
509
+ priority?: 'high' | 'low'
510
+ }
511
+ }
512
+
513
+ const typedAdapter: ClientAdapter = {
514
+ async request(req) {
515
+ // req.meta is now typed
516
+ const trace: string | undefined = req.meta?.traceId
517
+ const pri: 'high' | 'low' | undefined = req.meta?.priority
518
+ void trace; void pri
519
+ return { status: 200, headers: {}, body: {} }
520
+ },
521
+ async stream(req) {
522
+ const trace: string | undefined = req.meta?.traceId
523
+ void trace
524
+ return { status: 200, headers: {}, body: (async function*() {})() }
525
+ },
526
+ }
527
+
528
+ const client = createClient({
529
+ adapter: typedAdapter,
530
+ basePath: 'https://api.example.com',
531
+ scopes: createApiBindings,
532
+ defaults: {
533
+ meta: { traceId: 'default-trace' }, // typed
534
+ },
535
+ hooks: {
536
+ onBeforeRequest(ctx) {
537
+ // ctx.request.meta is typed via declaration merging
538
+ const trace: string | undefined = ctx.request.meta?.traceId
539
+ void trace
540
+ return ctx
541
+ },
542
+ },
543
+ })
544
+
545
+ async function run(): Promise<void> {
546
+ // Per-call meta is typed — traceId is required, priority is optional
547
+ await client.users.GetUser(
548
+ { id: '1' },
549
+ { meta: { traceId: 'per-call-trace', priority: 'high' } },
550
+ )
551
+ // Timeout + signal + headers typecheck
552
+ await client.users.GetUser(
553
+ { id: '2' },
554
+ { timeout: 5000, headers: { 'X-Request-Id': 'abc' }, basePath: 'https://other' },
555
+ )
556
+ }
557
+ void run
558
+ `
559
+ const { writeFileSync } = await import('node:fs')
560
+ writeFileSync(join(tmpDir, 'consumer.ts'), consumer)
561
+
562
+ const tsconfig = {
563
+ compilerOptions: {
564
+ strict: true,
565
+ target: 'ES2022',
566
+ module: 'ES2022',
567
+ moduleResolution: 'bundler',
568
+ noEmit: true,
569
+ skipLibCheck: true,
570
+ },
571
+ include: ['_types.ts', '_client.ts', 'index.ts', 'users.ts', 'events.ts', '_errors.ts', 'consumer.ts'],
572
+ }
573
+ writeFileSync(join(tmpDir, 'tsconfig.json'), JSON.stringify(tsconfig))
574
+
575
+ const { execSync } = await import('node:child_process')
576
+ const tscPath = join(process.cwd(), 'node_modules', '.bin', 'tsc')
577
+ expect(() => {
578
+ execSync(`${tscPath} --noEmit --project ${join(tmpDir, 'tsconfig.json')}`, { stdio: 'pipe' })
579
+ }).not.toThrow()
580
+ })
581
+
582
+ it('augmented RequestMeta rejects wrong types (compile error)', async () => {
583
+ tmpDir = makeTmpDir()
584
+ await generateClient({ envelope, outDir: tmpDir, selfContained: true })
585
+
586
+ // Passing a number for `traceId` (declared as string) should fail tsc
587
+ const consumer = `
588
+ import { createClient, createFetchAdapter } from './_client'
589
+ import { createApiBindings } from './index'
590
+ // RequestMeta is imported only for augmentation below
591
+ import type {} from './_types'
592
+
593
+ declare module './_types' {
594
+ interface RequestMeta {
595
+ traceId: string
596
+ }
597
+ }
598
+
599
+ const client = createClient({
600
+ adapter: createFetchAdapter(),
601
+ basePath: 'https://api.example.com',
602
+ scopes: createApiBindings,
603
+ })
604
+
605
+ async function run(): Promise<void> {
606
+ // @ts-expect-error traceId must be string, not number
607
+ await client.users.GetUser({ id: '1' }, { meta: { traceId: 42 } })
608
+ }
609
+ void run
610
+ `
611
+ const { writeFileSync } = await import('node:fs')
612
+ writeFileSync(join(tmpDir, 'consumer.ts'), consumer)
613
+
614
+ const tsconfig = {
615
+ compilerOptions: {
616
+ strict: true,
617
+ target: 'ES2022',
618
+ module: 'ES2022',
619
+ moduleResolution: 'bundler',
620
+ noEmit: true,
621
+ skipLibCheck: true,
622
+ },
623
+ include: ['_types.ts', '_client.ts', 'index.ts', 'users.ts', 'events.ts', '_errors.ts', 'consumer.ts'],
624
+ }
625
+ writeFileSync(join(tmpDir, 'tsconfig.json'), JSON.stringify(tsconfig))
626
+
627
+ const { execSync } = await import('node:child_process')
628
+ const tscPath = join(process.cwd(), 'node_modules', '.bin', 'tsc')
629
+ // With @ts-expect-error in place, tsc should pass; if RequestMeta wasn't
630
+ // enforcing the type, @ts-expect-error would fail because there'd be no error.
631
+ expect(() => {
632
+ execSync(`${tscPath} --noEmit --project ${join(tmpDir, 'tsconfig.json')}`, { stdio: 'pipe' })
633
+ }).not.toThrow()
634
+ })
484
635
  })
485
636
 
486
637
  // ── namespaceTypes mode ───────────────────────────────────────────────────
@@ -16,8 +16,10 @@ const TYPES_IMPORT = `import type {
16
16
  StreamDescriptor,
17
17
  TypedStream,
18
18
  ClientInstance,
19
+ ProcedureCallDefaults,
19
20
  ProcedureCallOptions,
20
21
  CreateClientConfig,
22
+ RequestMeta,
21
23
  } from './_types'`
22
24
 
23
25
  /**
@@ -27,6 +29,7 @@ const TYPES_IMPORT = `import type {
27
29
  const SOURCE_FILES = [
28
30
  'errors.ts',
29
31
  'request-builder.ts',
32
+ 'resolve-options.ts',
30
33
  'hooks.ts',
31
34
  'call.ts',
32
35
  'stream.ts',
@@ -10,6 +10,7 @@ export interface GenerateClientOptions extends ResolveInput {
10
10
  namespaceTypes?: boolean
11
11
  selfContained?: boolean
12
12
  serviceName?: string
13
+ cleanOutDir?: boolean
13
14
  }
14
15
 
15
16
  export async function generateClient(options: GenerateClientOptions): Promise<GeneratedFile[]> {
@@ -23,6 +24,7 @@ export async function generateClient(options: GenerateClientOptions): Promise<Ge
23
24
  namespaceTypes: options.namespaceTypes,
24
25
  selfContained: options.selfContained,
25
26
  serviceName: options.serviceName,
27
+ cleanOutDir: options.cleanOutDir,
26
28
  })
27
29
  }
28
30
 
@@ -1,7 +1,7 @@
1
1
  import { describe, it, expect, afterEach, vi } from 'vitest'
2
2
  import { generateClient } from './index.js'
3
3
  import { runPipeline } from './pipeline.js'
4
- import { mkdirSync, rmSync, readFileSync, existsSync } from 'node:fs'
4
+ import { mkdirSync, rmSync, readFileSync, existsSync, writeFileSync } from 'node:fs'
5
5
  import { join } from 'node:path'
6
6
  import { tmpdir } from 'node:os'
7
7
  import type { DocEnvelope } from '../implementations/types.js'
@@ -288,6 +288,51 @@ describe('generateClient pipeline', () => {
288
288
  expect(content).not.toContain('createScopeBindings')
289
289
  })
290
290
 
291
+ it('cleanOutDir: true removes stale files before writing', async () => {
292
+ tmpDir = makeTmpDir()
293
+ const stale = join(tmpDir, 'stale.ts')
294
+ writeFileSync(stale, '// stale', 'utf-8')
295
+ expect(existsSync(stale)).toBe(true)
296
+
297
+ await generateClient({ envelope, outDir: tmpDir, cleanOutDir: true })
298
+
299
+ expect(existsSync(stale)).toBe(false)
300
+ expect(existsSync(join(tmpDir, 'index.ts'))).toBe(true)
301
+ expect(existsSync(join(tmpDir, 'users.ts'))).toBe(true)
302
+ })
303
+
304
+ it('cleanOutDir: false (default) leaves unrelated files in place', async () => {
305
+ tmpDir = makeTmpDir()
306
+ const keep = join(tmpDir, 'keep.ts')
307
+ writeFileSync(keep, '// keep', 'utf-8')
308
+
309
+ await generateClient({ envelope, outDir: tmpDir })
310
+
311
+ expect(existsSync(keep)).toBe(true)
312
+ expect(existsSync(join(tmpDir, 'index.ts'))).toBe(true)
313
+ })
314
+
315
+ it('cleanOutDir works when outDir does not exist', async () => {
316
+ tmpDir = makeTmpDir()
317
+ const nested = join(tmpDir, 'nested', 'missing')
318
+ expect(existsSync(nested)).toBe(false)
319
+
320
+ await generateClient({ envelope, outDir: nested, cleanOutDir: true })
321
+
322
+ expect(existsSync(join(nested, 'index.ts'))).toBe(true)
323
+ })
324
+
325
+ it('cleanOutDir is a no-op in dryRun mode', async () => {
326
+ tmpDir = makeTmpDir()
327
+ const keep = join(tmpDir, 'keep.ts')
328
+ writeFileSync(keep, '// keep', 'utf-8')
329
+
330
+ await runPipeline({ envelope, outDir: tmpDir, cleanOutDir: true, dryRun: true })
331
+
332
+ expect(existsSync(keep)).toBe(true)
333
+ expect(existsSync(join(tmpDir, 'index.ts'))).toBe(false)
334
+ })
335
+
291
336
  it('throws when a scope key collides with _types in selfContained mode', async () => {
292
337
  tmpDir = makeTmpDir()
293
338
  const collisionEnvelope: DocEnvelope = {
@@ -1,4 +1,4 @@
1
- import { mkdir, writeFile } from 'node:fs/promises'
1
+ import { mkdir, rm, writeFile } from 'node:fs/promises'
2
2
  import { join } from 'node:path'
3
3
  import { createHash } from 'node:crypto'
4
4
  import type { DocEnvelope } from '../implementations/types.js'
@@ -20,6 +20,7 @@ export interface PipelineOptions {
20
20
  namespaceTypes?: boolean
21
21
  selfContained?: boolean
22
22
  serviceName?: string
23
+ cleanOutDir?: boolean
23
24
  }
24
25
 
25
26
  export interface GeneratedFile {
@@ -28,7 +29,7 @@ export interface GeneratedFile {
28
29
  }
29
30
 
30
31
  export async function runPipeline(options: PipelineOptions): Promise<GeneratedFile[]> {
31
- const { envelope, outDir, ajsc: ajscOpts, dryRun = false, namespaceTypes = false, selfContained = false } = options
32
+ const { envelope, outDir, ajsc: ajscOpts, dryRun = false, namespaceTypes = false, selfContained = false, cleanOutDir = false } = options
32
33
  const serviceName = options.serviceName ?? 'Api'
33
34
  validateServiceName(serviceName)
34
35
  const clientImportPath = selfContained ? './_types' : options.clientImportPath
@@ -92,11 +93,17 @@ export async function runPipeline(options: PipelineOptions): Promise<GeneratedFi
92
93
  }
93
94
 
94
95
  if (dryRun) {
96
+ if (cleanOutDir) {
97
+ console.log(`[dry-run] Would clean outDir: ${outDir}`)
98
+ }
95
99
  for (const file of files) {
96
100
  const bytes = Buffer.byteLength(file.code, 'utf-8')
97
101
  console.log(`[dry-run] Would write: ${file.path} (${bytes} bytes)`)
98
102
  }
99
103
  } else {
104
+ if (cleanOutDir) {
105
+ await rm(outDir, { recursive: true, force: true })
106
+ }
100
107
  await mkdir(outDir, { recursive: true })
101
108
  for (const file of files) {
102
109
  await writeFile(file.path, file.code, 'utf-8')
@@ -298,6 +298,8 @@ apiBuilder.register(factory, (c) => ctx, {
298
298
 
299
299
  **Self-contained mode:** Use `--self-contained` to emit `_types.ts` (all client type definitions) and `_client.ts` (runtime: `createClient`, `createFetchAdapter`, hooks, errors) into the output directory. All scope files and `index.ts` will import from `./_types` instead of `ts-procedures/client`, so consumers have no runtime dependency on `ts-procedures`. With this flag, `ts-procedures` can be a devDependency only.
300
300
 
301
+ **Clean output directory:** Use `--clean-out-dir` (or `cleanOutDir: true` in the programmatic API) to recursively remove the output directory before writing, so scope files left over from deleted or renamed scopes are pruned. Skipped under `--dry-run`.
302
+
301
303
  ## Framework Comparison
302
304
 
303
305
  | Aspect | Express | Hono |
@@ -317,7 +319,15 @@ import type { APIConfig, APIHttpRouteDoc, APIInput, HttpMethod } from 'ts-proced
317
319
 
318
320
  // Client Runtime
319
321
  import { createClient, createFetchAdapter } from 'ts-procedures/client'
320
- import type { ClientAdapter, ClientHooks, TypedStream, ClientInstance } from 'ts-procedures/client'
322
+ import type {
323
+ ClientAdapter,
324
+ ClientHooks,
325
+ TypedStream,
326
+ ClientInstance,
327
+ ProcedureCallDefaults,
328
+ ProcedureCallOptions,
329
+ RequestMeta,
330
+ } from 'ts-procedures/client'
321
331
 
322
332
  // Code Generation (build-time only)
323
333
  import { generateClient } from 'ts-procedures/codegen'
@@ -1,14 +0,0 @@
1
- import type { ClientAdapter, ClientHooks, CallDescriptor } from './types.js';
2
- /**
3
- * Executes a single procedure call through the adapter.
4
- *
5
- * Flow:
6
- * 1. Build AdapterRequest from descriptor
7
- * 2. Run onBeforeRequest hooks (global then local)
8
- * 3. Call adapter.request()
9
- * 4. On adapter error: run onError hooks, re-throw
10
- * 5. Run onAfterResponse hooks (hooks may mutate response.status)
11
- * 6. If response status is non-2xx: throw ClientRequestError
12
- * 7. Return response.body as TResponse
13
- */
14
- export declare function executeCall<TResponse>(descriptor: CallDescriptor, basePath: string, adapter: ClientAdapter, globalHooks: ClientHooks, localHooks: ClientHooks | undefined): Promise<TResponse>;
@@ -1,47 +0,0 @@
1
- import { buildAdapterRequest } from './request-builder.js';
2
- import { runBeforeRequest, runAfterResponse, runOnError } from './hooks.js';
3
- import { ClientRequestError } from './errors.js';
4
- /**
5
- * Executes a single procedure call through the adapter.
6
- *
7
- * Flow:
8
- * 1. Build AdapterRequest from descriptor
9
- * 2. Run onBeforeRequest hooks (global then local)
10
- * 3. Call adapter.request()
11
- * 4. On adapter error: run onError hooks, re-throw
12
- * 5. Run onAfterResponse hooks (hooks may mutate response.status)
13
- * 6. If response status is non-2xx: throw ClientRequestError
14
- * 7. Return response.body as TResponse
15
- */
16
- export async function executeCall(descriptor, basePath, adapter, globalHooks, localHooks) {
17
- // 1. Build the initial request
18
- let request = buildAdapterRequest(descriptor, basePath);
19
- // 2. Run before-request hooks — they may mutate the request
20
- const beforeCtx = await runBeforeRequest({ procedureName: descriptor.name, scope: descriptor.scope, request }, globalHooks, localHooks);
21
- request = beforeCtx.request;
22
- // 3. Call the adapter
23
- let response;
24
- try {
25
- response = await adapter.request(request);
26
- }
27
- catch (err) {
28
- // 4. On adapter error: run error hooks, re-throw
29
- await runOnError({ procedureName: descriptor.name, scope: descriptor.scope, request, error: err }, globalHooks, localHooks);
30
- throw err;
31
- }
32
- // 5. Run after-response hooks — they may mutate response.status to swallow errors
33
- await runAfterResponse({ procedureName: descriptor.name, scope: descriptor.scope, request, response }, globalHooks, localHooks);
34
- // 6. Check status AFTER hooks (hooks may have swallowed the error by mutating status)
35
- if (response.status < 200 || response.status >= 300) {
36
- throw new ClientRequestError({
37
- status: response.status,
38
- headers: response.headers,
39
- body: response.body,
40
- procedureName: descriptor.name,
41
- scope: descriptor.scope,
42
- });
43
- }
44
- // 7. Return the body
45
- return response.body;
46
- }
47
- //# sourceMappingURL=call.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"call.js","sourceRoot":"","sources":["../../../src/client/call.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,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MAAM,IAAI,GAAG,EAAE,CAAC;QACpD,MAAM,IAAI,kBAAkB,CAAC;YAC3B,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,OAAO,EAAE,QAAQ,CAAC,OAAO;YACzB,IAAI,EAAE,QAAQ,CAAC,IAAI;YACnB,aAAa,EAAE,UAAU,CAAC,IAAI;YAC9B,KAAK,EAAE,UAAU,CAAC,KAAK;SACxB,CAAC,CAAA;IACJ,CAAC;IAED,qBAAqB;IACrB,OAAO,QAAQ,CAAC,IAAiB,CAAA;AACnC,CAAC"}
@@ -1,124 +0,0 @@
1
- import { describe, it, expect, vi } from 'vitest';
2
- import { executeCall } from './call.js';
3
- import { ClientRequestError } from './errors.js';
4
- // ── helpers ───────────────────────────────────────────────
5
- function makeDescriptor(overrides) {
6
- return {
7
- name: 'GetUser',
8
- scope: 'users',
9
- path: '/users',
10
- method: 'GET',
11
- kind: 'rpc',
12
- params: { id: '42' },
13
- ...overrides,
14
- };
15
- }
16
- function makeAdapter(response) {
17
- return {
18
- request: vi.fn(async (_req) => ({
19
- status: 200,
20
- headers: {},
21
- body: { id: '42', name: 'Alice' },
22
- ...response,
23
- })),
24
- stream: vi.fn(async () => {
25
- throw new Error('stream not expected in call tests');
26
- }),
27
- };
28
- }
29
- // ── executeCall ───────────────────────────────────────────
30
- describe('executeCall', () => {
31
- it('calls adapter.request and returns body', async () => {
32
- const adapter = makeAdapter({ body: { id: '1', name: 'Bob' } });
33
- const result = await executeCall(makeDescriptor(), 'https://api.example.com', adapter, {}, undefined);
34
- expect(adapter.request).toHaveBeenCalledOnce();
35
- expect(result).toEqual({ id: '1', name: 'Bob' });
36
- });
37
- it('throws ClientRequestError on 4xx response', async () => {
38
- const adapter = makeAdapter({ status: 404, body: { message: 'Not Found' } });
39
- await expect(executeCall(makeDescriptor(), 'https://api.example.com', adapter, {}, undefined)).rejects.toThrow(ClientRequestError);
40
- });
41
- it('throws ClientRequestError on 5xx response', async () => {
42
- const adapter = makeAdapter({ status: 500, body: { message: 'Server Error' } });
43
- await expect(executeCall(makeDescriptor(), 'https://api.example.com', adapter, {}, undefined)).rejects.toThrow(ClientRequestError);
44
- });
45
- it('throws ClientRequestError on 199 response (below 200)', async () => {
46
- const adapter = makeAdapter({ status: 199, body: null });
47
- await expect(executeCall(makeDescriptor(), 'https://api.example.com', adapter, {}, undefined)).rejects.toThrow(ClientRequestError);
48
- });
49
- it('does not throw on 2xx boundary responses (200, 201, 299)', async () => {
50
- for (const status of [200, 201, 204, 299]) {
51
- const adapter = makeAdapter({ status, body: null });
52
- await expect(executeCall(makeDescriptor(), 'https://api.example.com', adapter, {}, undefined)).resolves.not.toThrow();
53
- }
54
- });
55
- it('runs onBeforeRequest before calling adapter (headers are modified)', async () => {
56
- const capturedHeaders = [];
57
- const adapter = {
58
- request: vi.fn(async (req) => {
59
- capturedHeaders.push(req.headers ?? {});
60
- return { status: 200, headers: {}, body: {} };
61
- }),
62
- stream: vi.fn(async () => { throw new Error('not expected'); }),
63
- };
64
- const globalHooks = {
65
- onBeforeRequest: (ctx) => ({
66
- ...ctx,
67
- request: {
68
- ...ctx.request,
69
- headers: { ...ctx.request.headers, 'x-auth': 'token-123' },
70
- },
71
- }),
72
- };
73
- await executeCall(makeDescriptor(), 'https://api.example.com', adapter, globalHooks, undefined);
74
- expect(capturedHeaders[0]?.['x-auth']).toBe('token-123');
75
- });
76
- it('runs onAfterResponse after adapter returns', async () => {
77
- const order = [];
78
- const adapter = {
79
- request: vi.fn(async () => {
80
- order.push('adapter');
81
- return { status: 200, headers: {}, body: {} };
82
- }),
83
- stream: vi.fn(async () => { throw new Error('not expected'); }),
84
- };
85
- const globalHooks = {
86
- onAfterResponse: () => { order.push('afterResponse'); },
87
- };
88
- await executeCall(makeDescriptor(), 'https://api.example.com', adapter, globalHooks, undefined);
89
- expect(order).toEqual(['adapter', 'afterResponse']);
90
- });
91
- it('does not throw when onAfterResponse swallows non-2xx by mutating status', async () => {
92
- const adapter = makeAdapter({ status: 401, body: { message: 'Unauthorized' } });
93
- const globalHooks = {
94
- onAfterResponse: (ctx) => {
95
- // Swallow the error by setting status to 200
96
- ctx.response.status = 200;
97
- },
98
- };
99
- await expect(executeCall(makeDescriptor(), 'https://api.example.com', adapter, globalHooks, undefined)).resolves.not.toThrow();
100
- });
101
- it('runs onError on adapter failure and re-throws', async () => {
102
- const adapterError = new Error('Network failure');
103
- const adapter = {
104
- request: vi.fn(async () => { throw adapterError; }),
105
- stream: vi.fn(async () => { throw new Error('not expected'); }),
106
- };
107
- const receivedErrors = [];
108
- const globalHooks = {
109
- onError: (ctx) => { receivedErrors.push(ctx.error); },
110
- };
111
- await expect(executeCall(makeDescriptor(), 'https://api.example.com', adapter, globalHooks, undefined)).rejects.toThrow('Network failure');
112
- expect(receivedErrors[0]).toBe(adapterError);
113
- });
114
- it('passes per-procedure hooks as local hooks', async () => {
115
- const adapter = makeAdapter();
116
- const localOrder = [];
117
- const localHooks = {
118
- onBeforeRequest: (ctx) => { localOrder.push('local-before'); return ctx; },
119
- };
120
- await executeCall(makeDescriptor(), 'https://api.example.com', adapter, {}, localHooks);
121
- expect(localOrder).toContain('local-before');
122
- });
123
- });
124
- //# sourceMappingURL=call.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"call.test.js","sourceRoot":"","sources":["../../../src/client/call.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAShD,6DAA6D;AAE7D,SAAS,cAAc,CAAC,SAAmC;IACzD,OAAO;QACL,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAA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AC,CAAC,SAAS,CAAC,cAAc,CAAC,CAAA;IAC9C,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1,25 +0,0 @@
1
- export declare class ClientRequestError extends Error {
2
- readonly name = "ClientRequestError";
3
- readonly status: number;
4
- readonly headers: Record<string, string>;
5
- readonly body: unknown;
6
- readonly procedureName: string;
7
- readonly scope: string;
8
- constructor(opts: {
9
- status: number;
10
- headers: Record<string, string>;
11
- body: unknown;
12
- procedureName: string;
13
- scope: string;
14
- });
15
- }
16
- export declare class ClientPathParamError extends Error {
17
- readonly name = "ClientPathParamError";
18
- constructor(param: string, path: string, procedureName: string);
19
- }
20
- export declare class ClientStreamError extends Error {
21
- readonly name = "ClientStreamError";
22
- readonly procedureName: string;
23
- readonly scope: string;
24
- constructor(message: string, procedureName: string, scope: string);
25
- }
@@ -1,33 +0,0 @@
1
- export class ClientRequestError extends Error {
2
- name = 'ClientRequestError';
3
- status;
4
- headers;
5
- body;
6
- procedureName;
7
- scope;
8
- constructor(opts) {
9
- super(`${opts.procedureName} (${opts.scope}) failed with status ${opts.status}`);
10
- this.status = opts.status;
11
- this.headers = opts.headers;
12
- this.body = opts.body;
13
- this.procedureName = opts.procedureName;
14
- this.scope = opts.scope;
15
- }
16
- }
17
- export class ClientPathParamError extends Error {
18
- name = 'ClientPathParamError';
19
- constructor(param, path, procedureName) {
20
- super(`Missing path parameter "${param}" in "${path}" for procedure ${procedureName}`);
21
- }
22
- }
23
- export class ClientStreamError extends Error {
24
- name = 'ClientStreamError';
25
- procedureName;
26
- scope;
27
- constructor(message, procedureName, scope) {
28
- super(message);
29
- this.procedureName = procedureName;
30
- this.scope = scope;
31
- }
32
- }
33
- //# sourceMappingURL=errors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/client/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAClC,IAAI,GAAG,oBAAoB,CAAA;IAC3B,MAAM,CAAQ;IACd,OAAO,CAAwB;IAC/B,IAAI,CAAS;IACb,aAAa,CAAQ;IACrB,KAAK,CAAQ;IAEtB,YAAY,IAMX;QACC,KAAK,CAAC,GAAG,IAAI,CAAC,aAAa,KAAK,IAAI,CAAC,KAAK,wBAAwB,IAAI,CAAC,MAAM,EAAE,CAAC,CAAA;QAChF,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;QACzB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAA;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;QACrB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAA;QACvC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;IACzB,CAAC;CACF;AAED,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IACpC,IAAI,GAAG,sBAAsB,CAAA;IAEtC,YAAY,KAAa,EAAE,IAAY,EAAE,aAAqB;QAC5D,KAAK,CAAC,2BAA2B,KAAK,SAAS,IAAI,mBAAmB,aAAa,EAAE,CAAC,CAAA;IACxF,CAAC;CACF;AAED,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IACjC,IAAI,GAAG,mBAAmB,CAAA;IAC1B,aAAa,CAAQ;IACrB,KAAK,CAAQ;IAEtB,YAAY,OAAe,EAAE,aAAqB,EAAE,KAAa;QAC/D,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAClC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;CACF"}
@@ -1 +0,0 @@
1
- export {};