ts-procedures 5.10.0 → 5.12.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 (252) hide show
  1. package/agent_config/bin/postinstall.mjs +3 -3
  2. package/agent_config/bin/setup.mjs +22 -11
  3. package/agent_config/claude-code/agents/ts-procedures-architect.md +2 -2
  4. package/agent_config/claude-code/skills/{guide → ts-procedures}/SKILL.md +1 -1
  5. package/agent_config/claude-code/skills/{guide → ts-procedures}/api-reference.md +11 -8
  6. package/agent_config/claude-code/skills/{guide → ts-procedures}/patterns.md +8 -2
  7. package/agent_config/claude-code/skills/{review → ts-procedures-review}/SKILL.md +3 -3
  8. package/agent_config/claude-code/skills/{scaffold → ts-procedures-scaffold}/SKILL.md +2 -2
  9. package/agent_config/claude-code/skills/{scaffold → ts-procedures-scaffold}/templates/client.md +4 -4
  10. package/agent_config/copilot/copilot-instructions.md +6 -5
  11. package/agent_config/cursor/cursorrules +6 -5
  12. package/agent_config/lib/install-claude.mjs +35 -87
  13. package/build/codegen/e2e.test.js +21 -14
  14. package/build/codegen/e2e.test.js.map +1 -1
  15. package/build/codegen/emit-index.d.ts +7 -3
  16. package/build/codegen/emit-index.js +33 -20
  17. package/build/codegen/emit-index.js.map +1 -1
  18. package/build/codegen/emit-index.test.js +69 -45
  19. package/build/codegen/emit-index.test.js.map +1 -1
  20. package/build/codegen/pipeline.js +4 -5
  21. package/build/codegen/pipeline.js.map +1 -1
  22. package/build/codegen/pipeline.test.js +4 -4
  23. package/build/codegen/pipeline.test.js.map +1 -1
  24. package/build/src/client/call.d.ts +14 -0
  25. package/build/src/client/call.js +47 -0
  26. package/build/src/client/call.js.map +1 -0
  27. package/build/src/client/call.test.d.ts +1 -0
  28. package/build/src/client/call.test.js +124 -0
  29. package/build/src/client/call.test.js.map +1 -0
  30. package/build/src/client/errors.d.ts +25 -0
  31. package/build/src/client/errors.js +33 -0
  32. package/build/src/client/errors.js.map +1 -0
  33. package/build/src/client/errors.test.d.ts +1 -0
  34. package/build/src/client/errors.test.js +41 -0
  35. package/build/src/client/errors.test.js.map +1 -0
  36. package/build/src/client/fetch-adapter.d.ts +12 -0
  37. package/build/src/client/fetch-adapter.js +156 -0
  38. package/build/src/client/fetch-adapter.js.map +1 -0
  39. package/build/src/client/fetch-adapter.test.d.ts +1 -0
  40. package/build/src/client/fetch-adapter.test.js +271 -0
  41. package/build/src/client/fetch-adapter.test.js.map +1 -0
  42. package/build/src/client/hooks.d.ts +17 -0
  43. package/build/src/client/hooks.js +40 -0
  44. package/build/src/client/hooks.js.map +1 -0
  45. package/build/src/client/hooks.test.d.ts +1 -0
  46. package/build/src/client/hooks.test.js +163 -0
  47. package/build/src/client/hooks.test.js.map +1 -0
  48. package/build/src/client/index.d.ts +22 -0
  49. package/build/src/client/index.js +67 -0
  50. package/build/src/client/index.js.map +1 -0
  51. package/build/src/client/index.test.d.ts +1 -0
  52. package/build/src/client/index.test.js +231 -0
  53. package/build/src/client/index.test.js.map +1 -0
  54. package/build/src/client/request-builder.d.ts +13 -0
  55. package/build/src/client/request-builder.js +53 -0
  56. package/build/src/client/request-builder.js.map +1 -0
  57. package/build/src/client/request-builder.test.d.ts +1 -0
  58. package/build/src/client/request-builder.test.js +160 -0
  59. package/build/src/client/request-builder.test.js.map +1 -0
  60. package/build/src/client/stream.d.ts +27 -0
  61. package/build/src/client/stream.js +118 -0
  62. package/build/src/client/stream.js.map +1 -0
  63. package/build/src/client/stream.test.d.ts +1 -0
  64. package/build/src/client/stream.test.js +228 -0
  65. package/build/src/client/stream.test.js.map +1 -0
  66. package/build/src/client/types.d.ts +78 -0
  67. package/build/src/client/types.js +3 -0
  68. package/build/src/client/types.js.map +1 -0
  69. package/build/src/codegen/bin/cli.d.ts +45 -0
  70. package/build/src/codegen/bin/cli.js +246 -0
  71. package/build/src/codegen/bin/cli.js.map +1 -0
  72. package/build/src/codegen/bin/cli.test.d.ts +1 -0
  73. package/build/src/codegen/bin/cli.test.js +220 -0
  74. package/build/src/codegen/bin/cli.test.js.map +1 -0
  75. package/build/src/codegen/constants.d.ts +1 -0
  76. package/build/src/codegen/constants.js +2 -0
  77. package/build/src/codegen/constants.js.map +1 -0
  78. package/build/src/codegen/e2e.test.d.ts +1 -0
  79. package/build/src/codegen/e2e.test.js +464 -0
  80. package/build/src/codegen/e2e.test.js.map +1 -0
  81. package/build/src/codegen/emit-client-runtime.d.ts +9 -0
  82. package/build/src/codegen/emit-client-runtime.js +99 -0
  83. package/build/src/codegen/emit-client-runtime.js.map +1 -0
  84. package/build/src/codegen/emit-client-runtime.test.d.ts +1 -0
  85. package/build/src/codegen/emit-client-runtime.test.js +78 -0
  86. package/build/src/codegen/emit-client-runtime.test.js.map +1 -0
  87. package/build/src/codegen/emit-client-types.d.ts +8 -0
  88. package/build/src/codegen/emit-client-types.js +25 -0
  89. package/build/src/codegen/emit-client-types.js.map +1 -0
  90. package/build/src/codegen/emit-client-types.test.d.ts +1 -0
  91. package/build/src/codegen/emit-client-types.test.js +33 -0
  92. package/build/src/codegen/emit-client-types.test.js.map +1 -0
  93. package/build/src/codegen/emit-errors.d.ts +19 -0
  94. package/build/src/codegen/emit-errors.js +59 -0
  95. package/build/src/codegen/emit-errors.js.map +1 -0
  96. package/build/src/codegen/emit-errors.test.d.ts +1 -0
  97. package/build/src/codegen/emit-errors.test.js +175 -0
  98. package/build/src/codegen/emit-errors.test.js.map +1 -0
  99. package/build/src/codegen/emit-index.d.ts +12 -0
  100. package/build/src/codegen/emit-index.js +41 -0
  101. package/build/src/codegen/emit-index.js.map +1 -0
  102. package/build/src/codegen/emit-index.test.d.ts +1 -0
  103. package/build/src/codegen/emit-index.test.js +106 -0
  104. package/build/src/codegen/emit-index.test.js.map +1 -0
  105. package/build/src/codegen/emit-scope.d.ts +15 -0
  106. package/build/src/codegen/emit-scope.js +299 -0
  107. package/build/src/codegen/emit-scope.js.map +1 -0
  108. package/build/src/codegen/emit-scope.test.d.ts +1 -0
  109. package/build/src/codegen/emit-scope.test.js +559 -0
  110. package/build/src/codegen/emit-scope.test.js.map +1 -0
  111. package/build/src/codegen/emit-types.d.ts +43 -0
  112. package/build/src/codegen/emit-types.js +111 -0
  113. package/build/src/codegen/emit-types.js.map +1 -0
  114. package/build/src/codegen/emit-types.test.d.ts +1 -0
  115. package/build/src/codegen/emit-types.test.js +184 -0
  116. package/build/src/codegen/emit-types.test.js.map +1 -0
  117. package/build/src/codegen/group-routes.d.ts +23 -0
  118. package/build/src/codegen/group-routes.js +46 -0
  119. package/build/src/codegen/group-routes.js.map +1 -0
  120. package/build/src/codegen/group-routes.test.d.ts +1 -0
  121. package/build/src/codegen/group-routes.test.js +131 -0
  122. package/build/src/codegen/group-routes.test.js.map +1 -0
  123. package/build/src/codegen/index.d.ts +15 -0
  124. package/build/src/codegen/index.js +16 -0
  125. package/build/src/codegen/index.js.map +1 -0
  126. package/build/src/codegen/naming.d.ts +7 -0
  127. package/build/src/codegen/naming.js +21 -0
  128. package/build/src/codegen/naming.js.map +1 -0
  129. package/build/src/codegen/naming.test.d.ts +1 -0
  130. package/build/src/codegen/naming.test.js +40 -0
  131. package/build/src/codegen/naming.test.js.map +1 -0
  132. package/build/src/codegen/pipeline.d.ts +17 -0
  133. package/build/src/codegen/pipeline.js +78 -0
  134. package/build/src/codegen/pipeline.js.map +1 -0
  135. package/build/src/codegen/pipeline.test.d.ts +1 -0
  136. package/build/src/codegen/pipeline.test.js +269 -0
  137. package/build/src/codegen/pipeline.test.js.map +1 -0
  138. package/build/src/codegen/resolve-envelope.d.ts +7 -0
  139. package/build/src/codegen/resolve-envelope.js +46 -0
  140. package/build/src/codegen/resolve-envelope.js.map +1 -0
  141. package/build/src/codegen/resolve-envelope.test.d.ts +1 -0
  142. package/build/src/codegen/resolve-envelope.test.js +69 -0
  143. package/build/src/codegen/resolve-envelope.test.js.map +1 -0
  144. package/build/src/errors.d.ts +33 -0
  145. package/build/src/errors.js +91 -0
  146. package/build/src/errors.js.map +1 -0
  147. package/build/src/errors.test.d.ts +1 -0
  148. package/build/src/errors.test.js +122 -0
  149. package/build/src/errors.test.js.map +1 -0
  150. package/build/src/exports.d.ts +7 -0
  151. package/build/src/exports.js +8 -0
  152. package/build/src/exports.js.map +1 -0
  153. package/build/src/implementations/http/doc-registry.d.ts +12 -0
  154. package/build/src/implementations/http/doc-registry.js +114 -0
  155. package/build/src/implementations/http/doc-registry.js.map +1 -0
  156. package/build/src/implementations/http/doc-registry.test.d.ts +1 -0
  157. package/build/src/implementations/http/doc-registry.test.js +347 -0
  158. package/build/src/implementations/http/doc-registry.test.js.map +1 -0
  159. package/build/src/implementations/http/express-rpc/index.d.ts +94 -0
  160. package/build/src/implementations/http/express-rpc/index.js +185 -0
  161. package/build/src/implementations/http/express-rpc/index.js.map +1 -0
  162. package/build/src/implementations/http/express-rpc/index.test.d.ts +1 -0
  163. package/build/src/implementations/http/express-rpc/index.test.js +684 -0
  164. package/build/src/implementations/http/express-rpc/index.test.js.map +1 -0
  165. package/build/src/implementations/http/express-rpc/types.d.ts +11 -0
  166. package/build/src/implementations/http/express-rpc/types.js +2 -0
  167. package/build/src/implementations/http/express-rpc/types.js.map +1 -0
  168. package/build/src/implementations/http/hono-api/index.d.ts +102 -0
  169. package/build/src/implementations/http/hono-api/index.js +341 -0
  170. package/build/src/implementations/http/hono-api/index.js.map +1 -0
  171. package/build/src/implementations/http/hono-api/index.test.d.ts +1 -0
  172. package/build/src/implementations/http/hono-api/index.test.js +992 -0
  173. package/build/src/implementations/http/hono-api/index.test.js.map +1 -0
  174. package/build/src/implementations/http/hono-api/types.d.ts +13 -0
  175. package/build/src/implementations/http/hono-api/types.js +2 -0
  176. package/build/src/implementations/http/hono-api/types.js.map +1 -0
  177. package/build/src/implementations/http/hono-rpc/index.d.ts +92 -0
  178. package/build/src/implementations/http/hono-rpc/index.js +161 -0
  179. package/build/src/implementations/http/hono-rpc/index.js.map +1 -0
  180. package/build/src/implementations/http/hono-rpc/index.test.d.ts +1 -0
  181. package/build/src/implementations/http/hono-rpc/index.test.js +803 -0
  182. package/build/src/implementations/http/hono-rpc/index.test.js.map +1 -0
  183. package/build/src/implementations/http/hono-rpc/types.d.ts +11 -0
  184. package/build/src/implementations/http/hono-rpc/types.js +2 -0
  185. package/build/src/implementations/http/hono-rpc/types.js.map +1 -0
  186. package/build/src/implementations/http/hono-stream/index.d.ts +120 -0
  187. package/build/src/implementations/http/hono-stream/index.js +309 -0
  188. package/build/src/implementations/http/hono-stream/index.js.map +1 -0
  189. package/build/src/implementations/http/hono-stream/index.test.d.ts +1 -0
  190. package/build/src/implementations/http/hono-stream/index.test.js +1356 -0
  191. package/build/src/implementations/http/hono-stream/index.test.js.map +1 -0
  192. package/build/src/implementations/http/hono-stream/types.d.ts +15 -0
  193. package/build/src/implementations/http/hono-stream/types.js +2 -0
  194. package/build/src/implementations/http/hono-stream/types.js.map +1 -0
  195. package/build/src/implementations/types.d.ts +142 -0
  196. package/build/src/implementations/types.js +2 -0
  197. package/build/src/implementations/types.js.map +1 -0
  198. package/build/src/index.d.ts +165 -0
  199. package/build/src/index.js +253 -0
  200. package/build/src/index.js.map +1 -0
  201. package/build/src/index.test.d.ts +1 -0
  202. package/build/src/index.test.js +890 -0
  203. package/build/src/index.test.js.map +1 -0
  204. package/build/src/schema/compute-schema.d.ts +35 -0
  205. package/build/src/schema/compute-schema.js +41 -0
  206. package/build/src/schema/compute-schema.js.map +1 -0
  207. package/build/src/schema/compute-schema.test.d.ts +1 -0
  208. package/build/src/schema/compute-schema.test.js +107 -0
  209. package/build/src/schema/compute-schema.test.js.map +1 -0
  210. package/build/src/schema/extract-json-schema.d.ts +2 -0
  211. package/build/src/schema/extract-json-schema.js +12 -0
  212. package/build/src/schema/extract-json-schema.js.map +1 -0
  213. package/build/src/schema/extract-json-schema.test.d.ts +1 -0
  214. package/build/src/schema/extract-json-schema.test.js +23 -0
  215. package/build/src/schema/extract-json-schema.test.js.map +1 -0
  216. package/build/src/schema/parser.d.ts +28 -0
  217. package/build/src/schema/parser.js +170 -0
  218. package/build/src/schema/parser.js.map +1 -0
  219. package/build/src/schema/parser.test.d.ts +1 -0
  220. package/build/src/schema/parser.test.js +120 -0
  221. package/build/src/schema/parser.test.js.map +1 -0
  222. package/build/src/schema/resolve-schema-lib.d.ts +12 -0
  223. package/build/src/schema/resolve-schema-lib.js +11 -0
  224. package/build/src/schema/resolve-schema-lib.js.map +1 -0
  225. package/build/src/schema/resolve-schema-lib.test.d.ts +1 -0
  226. package/build/src/schema/resolve-schema-lib.test.js +17 -0
  227. package/build/src/schema/resolve-schema-lib.test.js.map +1 -0
  228. package/build/src/schema/types.d.ts +8 -0
  229. package/build/src/schema/types.js +2 -0
  230. package/build/src/schema/types.js.map +1 -0
  231. package/build/src/stack-utils.d.ts +25 -0
  232. package/build/src/stack-utils.js +95 -0
  233. package/build/src/stack-utils.js.map +1 -0
  234. package/build/src/stack-utils.test.d.ts +1 -0
  235. package/build/src/stack-utils.test.js +80 -0
  236. package/build/src/stack-utils.test.js.map +1 -0
  237. package/docs/ai-agent-setup.md +7 -6
  238. package/docs/client-and-codegen.md +9 -6
  239. package/package.json +1 -1
  240. package/src/codegen/e2e.test.ts +23 -14
  241. package/src/codegen/emit-index.test.ts +72 -45
  242. package/src/codegen/emit-index.ts +43 -20
  243. package/src/codegen/pipeline.test.ts +4 -4
  244. package/src/codegen/pipeline.ts +4 -5
  245. /package/agent_config/claude-code/skills/{guide → ts-procedures}/anti-patterns.md +0 -0
  246. /package/agent_config/claude-code/skills/{review → ts-procedures-review}/checklist.md +0 -0
  247. /package/agent_config/claude-code/skills/{scaffold → ts-procedures-scaffold}/templates/express-rpc.md +0 -0
  248. /package/agent_config/claude-code/skills/{scaffold → ts-procedures-scaffold}/templates/hono-api.md +0 -0
  249. /package/agent_config/claude-code/skills/{scaffold → ts-procedures-scaffold}/templates/hono-rpc.md +0 -0
  250. /package/agent_config/claude-code/skills/{scaffold → ts-procedures-scaffold}/templates/hono-stream.md +0 -0
  251. /package/agent_config/claude-code/skills/{scaffold → ts-procedures-scaffold}/templates/procedure.md +0 -0
  252. /package/agent_config/claude-code/skills/{scaffold → ts-procedures-scaffold}/templates/stream-procedure.md +0 -0
@@ -0,0 +1,464 @@
1
+ import { describe, it, expect, afterEach } from 'vitest';
2
+ import { generateClient } from './index.js';
3
+ import { mkdirSync, rmSync, readFileSync, existsSync } from 'node:fs';
4
+ import { join } from 'node:path';
5
+ import { tmpdir } from 'node:os';
6
+ // ---------------------------------------------------------------------------
7
+ // Fixtures
8
+ // ---------------------------------------------------------------------------
9
+ const rpcRoute = {
10
+ kind: 'rpc',
11
+ name: 'GetUser',
12
+ path: '/users/1',
13
+ method: 'post',
14
+ scope: 'users',
15
+ version: 1,
16
+ jsonSchema: {
17
+ body: {
18
+ type: 'object',
19
+ properties: { id: { type: 'string' } },
20
+ required: ['id'],
21
+ },
22
+ response: {
23
+ type: 'object',
24
+ properties: { name: { type: 'string' }, email: { type: 'string' } },
25
+ required: ['name', 'email'],
26
+ },
27
+ },
28
+ };
29
+ const apiRoute = {
30
+ kind: 'api',
31
+ name: 'UpdateUser',
32
+ path: '/users/:id',
33
+ fullPath: '/api/users/:id',
34
+ method: 'put',
35
+ scope: 'users',
36
+ jsonSchema: {
37
+ pathParams: {
38
+ type: 'object',
39
+ properties: { id: { type: 'string' } },
40
+ required: ['id'],
41
+ },
42
+ body: {
43
+ type: 'object',
44
+ properties: { name: { type: 'string' } },
45
+ required: ['name'],
46
+ },
47
+ response: {
48
+ type: 'object',
49
+ properties: { id: { type: 'string' }, name: { type: 'string' } },
50
+ required: ['id', 'name'],
51
+ },
52
+ },
53
+ };
54
+ const streamRoute = {
55
+ kind: 'stream',
56
+ name: 'WatchEvents',
57
+ path: '/events/stream',
58
+ methods: ['get'],
59
+ streamMode: 'sse',
60
+ scope: 'events',
61
+ version: 1,
62
+ jsonSchema: {
63
+ params: {
64
+ type: 'object',
65
+ properties: { filter: { type: 'string' } },
66
+ required: [],
67
+ },
68
+ // SSE envelope wrapping the actual yield payload
69
+ yieldType: {
70
+ type: 'object',
71
+ properties: {
72
+ data: {
73
+ type: 'object',
74
+ properties: { type: { type: 'string' }, payload: { type: 'string' } },
75
+ required: ['type'],
76
+ },
77
+ event: { type: 'string' },
78
+ id: { type: 'string' },
79
+ retry: { type: 'number' },
80
+ },
81
+ required: ['data'],
82
+ },
83
+ returnType: {
84
+ type: 'object',
85
+ properties: { count: { type: 'number' } },
86
+ required: ['count'],
87
+ },
88
+ },
89
+ };
90
+ const procedureErrorDoc = {
91
+ name: 'ProcedureError',
92
+ statusCode: 500,
93
+ description: 'An error thrown from within a procedure handler via ctx.error().',
94
+ schema: {
95
+ type: 'object',
96
+ properties: {
97
+ name: { type: 'string', const: 'ProcedureError' },
98
+ procedureName: { type: 'string' },
99
+ message: { type: 'string' },
100
+ meta: { type: 'object' },
101
+ },
102
+ required: ['name', 'procedureName', 'message'],
103
+ },
104
+ };
105
+ const validationErrorDoc = {
106
+ name: 'ProcedureValidationError',
107
+ statusCode: 400,
108
+ description: 'Schema validation failed for the procedure input parameters.',
109
+ schema: {
110
+ type: 'object',
111
+ properties: {
112
+ name: { type: 'string', const: 'ProcedureValidationError' },
113
+ procedureName: { type: 'string' },
114
+ message: { type: 'string' },
115
+ },
116
+ required: ['name', 'procedureName', 'message'],
117
+ },
118
+ };
119
+ const envelope = {
120
+ basePath: '/api',
121
+ headers: [],
122
+ errors: [procedureErrorDoc, validationErrorDoc],
123
+ routes: [rpcRoute, apiRoute, streamRoute],
124
+ };
125
+ // ---------------------------------------------------------------------------
126
+ // Helpers
127
+ // ---------------------------------------------------------------------------
128
+ function makeTmpDir() {
129
+ const dir = join(tmpdir(), `ts-proc-e2e-test-${Date.now()}-${Math.random().toString(36).slice(2)}`);
130
+ mkdirSync(dir, { recursive: true });
131
+ return dir;
132
+ }
133
+ // ---------------------------------------------------------------------------
134
+ // Tests
135
+ // ---------------------------------------------------------------------------
136
+ describe('E2E: generateClient full pipeline', () => {
137
+ let tmpDir;
138
+ afterEach(() => {
139
+ if (tmpDir && existsSync(tmpDir)) {
140
+ rmSync(tmpDir, { recursive: true, force: true });
141
+ }
142
+ });
143
+ // ── File existence ─────────────────────────────────────────────────────────
144
+ it('creates users.ts, events.ts, and index.ts', async () => {
145
+ tmpDir = makeTmpDir();
146
+ await generateClient({ envelope, outDir: tmpDir });
147
+ expect(existsSync(join(tmpDir, 'users.ts'))).toBe(true);
148
+ expect(existsSync(join(tmpDir, 'events.ts'))).toBe(true);
149
+ expect(existsSync(join(tmpDir, 'index.ts'))).toBe(true);
150
+ });
151
+ // ── users.ts — RPC route ───────────────────────────────────────────────────
152
+ it('users.ts contains GetUserParams type', async () => {
153
+ tmpDir = makeTmpDir();
154
+ await generateClient({ envelope, outDir: tmpDir });
155
+ const content = readFileSync(join(tmpDir, 'users.ts'), 'utf-8');
156
+ expect(content).toContain('GetUserParams');
157
+ });
158
+ it('users.ts contains GetUserResponse type', async () => {
159
+ tmpDir = makeTmpDir();
160
+ await generateClient({ envelope, outDir: tmpDir });
161
+ const content = readFileSync(join(tmpDir, 'users.ts'), 'utf-8');
162
+ expect(content).toContain('GetUserResponse');
163
+ });
164
+ // ── users.ts — API route ───────────────────────────────────────────────────
165
+ it('users.ts contains UpdateUserParams type', async () => {
166
+ tmpDir = makeTmpDir();
167
+ await generateClient({ envelope, outDir: tmpDir });
168
+ const content = readFileSync(join(tmpDir, 'users.ts'), 'utf-8');
169
+ expect(content).toContain('UpdateUserParams');
170
+ });
171
+ it('users.ts contains UpdateUserResponse type', async () => {
172
+ tmpDir = makeTmpDir();
173
+ await generateClient({ envelope, outDir: tmpDir });
174
+ const content = readFileSync(join(tmpDir, 'users.ts'), 'utf-8');
175
+ expect(content).toContain('UpdateUserResponse');
176
+ });
177
+ it('users.ts API callable uses fullPath in the path field', async () => {
178
+ tmpDir = makeTmpDir();
179
+ await generateClient({ envelope, outDir: tmpDir });
180
+ const content = readFileSync(join(tmpDir, 'users.ts'), 'utf-8');
181
+ // fullPath ('/api/users/:id') should appear in the callable body
182
+ expect(content).toContain("path: '/api/users/:id'");
183
+ // bare path without prefix should NOT appear as path: value for the api route
184
+ expect(content).not.toContain("path: '/users/:id'");
185
+ });
186
+ it('users.ts exports bindUsersScope function', async () => {
187
+ tmpDir = makeTmpDir();
188
+ await generateClient({ envelope, outDir: tmpDir });
189
+ const content = readFileSync(join(tmpDir, 'users.ts'), 'utf-8');
190
+ expect(content).toContain('bindUsersScope');
191
+ });
192
+ it('users.ts uses client.call for RPC route', async () => {
193
+ tmpDir = makeTmpDir();
194
+ await generateClient({ envelope, outDir: tmpDir });
195
+ const content = readFileSync(join(tmpDir, 'users.ts'), 'utf-8');
196
+ expect(content).toContain('client.call');
197
+ });
198
+ // ── events.ts — Stream route ───────────────────────────────────────────────
199
+ it('events.ts contains WatchEventsYield type', async () => {
200
+ tmpDir = makeTmpDir();
201
+ await generateClient({ envelope, outDir: tmpDir });
202
+ const content = readFileSync(join(tmpDir, 'events.ts'), 'utf-8');
203
+ expect(content).toContain('WatchEventsYield');
204
+ });
205
+ it('events.ts contains WatchEventsReturn type', async () => {
206
+ tmpDir = makeTmpDir();
207
+ await generateClient({ envelope, outDir: tmpDir });
208
+ const content = readFileSync(join(tmpDir, 'events.ts'), 'utf-8');
209
+ expect(content).toContain('WatchEventsReturn');
210
+ });
211
+ it('events.ts imports TypedStream', async () => {
212
+ tmpDir = makeTmpDir();
213
+ await generateClient({ envelope, outDir: tmpDir });
214
+ const content = readFileSync(join(tmpDir, 'events.ts'), 'utf-8');
215
+ expect(content).toContain('TypedStream');
216
+ });
217
+ it('events.ts uses client.stream', async () => {
218
+ tmpDir = makeTmpDir();
219
+ await generateClient({ envelope, outDir: tmpDir });
220
+ const content = readFileSync(join(tmpDir, 'events.ts'), 'utf-8');
221
+ expect(content).toContain('client.stream');
222
+ });
223
+ it("events.ts callable has streamMode: 'sse'", async () => {
224
+ tmpDir = makeTmpDir();
225
+ await generateClient({ envelope, outDir: tmpDir });
226
+ const content = readFileSync(join(tmpDir, 'events.ts'), 'utf-8');
227
+ expect(content).toContain("streamMode: 'sse'");
228
+ });
229
+ it('events.ts SSE envelope is unwrapped — yield type does NOT contain event/id/retry fields', async () => {
230
+ tmpDir = makeTmpDir();
231
+ await generateClient({ envelope, outDir: tmpDir });
232
+ const content = readFileSync(join(tmpDir, 'events.ts'), 'utf-8');
233
+ // Extract the WatchEventsYield type declaration line
234
+ const yieldMatch = content.match(/export type WatchEventsYield = (.+)/);
235
+ expect(yieldMatch).not.toBeNull();
236
+ const yieldTypeBody = yieldMatch[1];
237
+ // The SSE envelope properties should not appear in the resolved yield type
238
+ expect(yieldTypeBody).not.toContain('event');
239
+ expect(yieldTypeBody).not.toContain('retry');
240
+ });
241
+ // ── index.ts ───────────────────────────────────────────────────────────────
242
+ it('index.ts contains createScopeBindings', async () => {
243
+ tmpDir = makeTmpDir();
244
+ await generateClient({ envelope, outDir: tmpDir });
245
+ const content = readFileSync(join(tmpDir, 'index.ts'), 'utf-8');
246
+ expect(content).toContain('createScopeBindings');
247
+ });
248
+ it('index.ts re-exports from users scope', async () => {
249
+ tmpDir = makeTmpDir();
250
+ await generateClient({ envelope, outDir: tmpDir });
251
+ const content = readFileSync(join(tmpDir, 'index.ts'), 'utf-8');
252
+ expect(content).toContain("from './users'");
253
+ });
254
+ it('index.ts re-exports from events scope', async () => {
255
+ tmpDir = makeTmpDir();
256
+ await generateClient({ envelope, outDir: tmpDir });
257
+ const content = readFileSync(join(tmpDir, 'index.ts'), 'utf-8');
258
+ expect(content).toContain("from './events'");
259
+ });
260
+ it('index.ts imports and uses bindUsersScope', async () => {
261
+ tmpDir = makeTmpDir();
262
+ await generateClient({ envelope, outDir: tmpDir });
263
+ const content = readFileSync(join(tmpDir, 'index.ts'), 'utf-8');
264
+ expect(content).toContain('bindUsersScope');
265
+ });
266
+ it('index.ts imports and uses bindEventsScope', async () => {
267
+ tmpDir = makeTmpDir();
268
+ await generateClient({ envelope, outDir: tmpDir });
269
+ const content = readFileSync(join(tmpDir, 'index.ts'), 'utf-8');
270
+ expect(content).toContain('bindEventsScope');
271
+ });
272
+ // ── _errors.ts ─────────────────────────────────────────────────────────────
273
+ it('_errors.ts file exists when envelope has errors with schemas', async () => {
274
+ tmpDir = makeTmpDir();
275
+ await generateClient({ envelope, outDir: tmpDir });
276
+ expect(existsSync(join(tmpDir, '_errors.ts'))).toBe(true);
277
+ });
278
+ it('_errors.ts contains ProcedureError type', async () => {
279
+ tmpDir = makeTmpDir();
280
+ await generateClient({ envelope, outDir: tmpDir });
281
+ const content = readFileSync(join(tmpDir, '_errors.ts'), 'utf-8');
282
+ expect(content).toContain('export type ProcedureError =');
283
+ });
284
+ it('_errors.ts contains ProcedureErrorUnion', async () => {
285
+ tmpDir = makeTmpDir();
286
+ await generateClient({ envelope, outDir: tmpDir });
287
+ const content = readFileSync(join(tmpDir, '_errors.ts'), 'utf-8');
288
+ expect(content).toContain('export type ProcedureErrorUnion =');
289
+ expect(content).toContain('ProcedureError');
290
+ expect(content).toContain('ProcedureValidationError');
291
+ });
292
+ it('index.ts re-exports from _errors when errors are present', async () => {
293
+ tmpDir = makeTmpDir();
294
+ await generateClient({ envelope, outDir: tmpDir });
295
+ const content = readFileSync(join(tmpDir, 'index.ts'), 'utf-8');
296
+ expect(content).toContain("export * from './_errors'");
297
+ });
298
+ it('_errors.ts is not generated when no errors have schemas', async () => {
299
+ tmpDir = makeTmpDir();
300
+ const envelopeNoErrors = { ...envelope, errors: [] };
301
+ await generateClient({ envelope: envelopeNoErrors, outDir: tmpDir });
302
+ expect(existsSync(join(tmpDir, '_errors.ts'))).toBe(false);
303
+ });
304
+ it('index.ts does not re-export _errors when no errors are present', async () => {
305
+ tmpDir = makeTmpDir();
306
+ const envelopeNoErrors = { ...envelope, errors: [] };
307
+ await generateClient({ envelope: envelopeNoErrors, outDir: tmpDir });
308
+ const content = readFileSync(join(tmpDir, 'index.ts'), 'utf-8');
309
+ expect(content).not.toContain("_errors");
310
+ });
311
+ // ── Auto-generated headers ─────────────────────────────────────────────────
312
+ it('all generated files have the auto-generated header comment', async () => {
313
+ tmpDir = makeTmpDir();
314
+ await generateClient({ envelope, outDir: tmpDir });
315
+ for (const file of ['users.ts', 'events.ts', 'index.ts', '_errors.ts']) {
316
+ const content = readFileSync(join(tmpDir, file), 'utf-8');
317
+ expect(content).toContain('// Auto-generated by ts-procedures-codegen — do not edit');
318
+ }
319
+ });
320
+ // ── selfContained mode ────────────────────────────────────────────────────
321
+ describe('selfContained: true', () => {
322
+ it('_types.ts is generated and contains ClientInstance, TypedStream, ProcedureCallOptions', async () => {
323
+ tmpDir = makeTmpDir();
324
+ await generateClient({ envelope, outDir: tmpDir, selfContained: true });
325
+ expect(existsSync(join(tmpDir, '_types.ts'))).toBe(true);
326
+ const content = readFileSync(join(tmpDir, '_types.ts'), 'utf-8');
327
+ expect(content).toContain('ClientInstance');
328
+ expect(content).toContain('TypedStream');
329
+ expect(content).toContain('ProcedureCallOptions');
330
+ });
331
+ it('_client.ts is generated and contains createClient, createFetchAdapter, ClientRequestError', async () => {
332
+ tmpDir = makeTmpDir();
333
+ await generateClient({ envelope, outDir: tmpDir, selfContained: true });
334
+ expect(existsSync(join(tmpDir, '_client.ts'))).toBe(true);
335
+ const content = readFileSync(join(tmpDir, '_client.ts'), 'utf-8');
336
+ expect(content).toContain('createClient');
337
+ expect(content).toContain('createFetchAdapter');
338
+ expect(content).toContain('ClientRequestError');
339
+ });
340
+ it('_client.ts imports from ./_types and NOT from ts-procedures/client', async () => {
341
+ tmpDir = makeTmpDir();
342
+ await generateClient({ envelope, outDir: tmpDir, selfContained: true });
343
+ const content = readFileSync(join(tmpDir, '_client.ts'), 'utf-8');
344
+ expect(content).toContain("from './_types'");
345
+ expect(content).not.toContain("from 'ts-procedures/client'");
346
+ });
347
+ it('scope files import from ./_types and NOT from ts-procedures/client', async () => {
348
+ tmpDir = makeTmpDir();
349
+ await generateClient({ envelope, outDir: tmpDir, selfContained: true });
350
+ const content = readFileSync(join(tmpDir, 'users.ts'), 'utf-8');
351
+ expect(content).toContain("from './_types'");
352
+ expect(content).not.toContain("from 'ts-procedures/client'");
353
+ });
354
+ it('index.ts imports from ./_types', async () => {
355
+ tmpDir = makeTmpDir();
356
+ await generateClient({ envelope, outDir: tmpDir, selfContained: true });
357
+ const content = readFileSync(join(tmpDir, 'index.ts'), 'utf-8');
358
+ expect(content).toContain("from './_types'");
359
+ });
360
+ it('_types.ts + _client.ts compile together as valid TypeScript', async () => {
361
+ tmpDir = makeTmpDir();
362
+ await generateClient({ envelope, outDir: tmpDir, selfContained: true });
363
+ // Write a minimal tsconfig for the generated files
364
+ const tsconfig = {
365
+ compilerOptions: {
366
+ strict: true,
367
+ target: 'ES2022',
368
+ module: 'ES2022',
369
+ moduleResolution: 'bundler',
370
+ noEmit: true,
371
+ skipLibCheck: true,
372
+ },
373
+ include: ['_types.ts', '_client.ts'],
374
+ };
375
+ const { writeFileSync } = await import('node:fs');
376
+ writeFileSync(join(tmpDir, 'tsconfig.json'), JSON.stringify(tsconfig));
377
+ const { execSync } = await import('node:child_process');
378
+ // Use the project's tsc binary directly (temp dir has no node_modules)
379
+ const tscPath = join(process.cwd(), 'node_modules', '.bin', 'tsc');
380
+ // tsc --noEmit --project tsconfig.json should succeed with exit code 0
381
+ expect(() => {
382
+ execSync(`${tscPath} --noEmit --project ${join(tmpDir, 'tsconfig.json')}`, { stdio: 'pipe' });
383
+ }).not.toThrow();
384
+ });
385
+ });
386
+ // ── namespaceTypes mode ───────────────────────────────────────────────────
387
+ describe('namespaceTypes: true', () => {
388
+ it('users.ts wraps types in namespace Users with inner route namespaces', async () => {
389
+ tmpDir = makeTmpDir();
390
+ await generateClient({ envelope, outDir: tmpDir, namespaceTypes: true });
391
+ const content = readFileSync(join(tmpDir, 'users.ts'), 'utf-8');
392
+ expect(content).toContain('export namespace Users {');
393
+ expect(content).toContain('export namespace GetUser {');
394
+ expect(content).toContain('export namespace UpdateUser {');
395
+ });
396
+ it('users.ts uses qualified type references in callables', async () => {
397
+ tmpDir = makeTmpDir();
398
+ await generateClient({ envelope, outDir: tmpDir, namespaceTypes: true });
399
+ const content = readFileSync(join(tmpDir, 'users.ts'), 'utf-8');
400
+ expect(content).toContain('params: Users.GetUser.Params');
401
+ expect(content).toContain('Promise<Users.GetUser.Response>');
402
+ expect(content).toContain('params: Users.UpdateUser.Params');
403
+ expect(content).toContain('Promise<Users.UpdateUser.Response>');
404
+ });
405
+ it('events.ts wraps stream types in namespace', async () => {
406
+ tmpDir = makeTmpDir();
407
+ await generateClient({ envelope, outDir: tmpDir, namespaceTypes: true });
408
+ const content = readFileSync(join(tmpDir, 'events.ts'), 'utf-8');
409
+ expect(content).toContain('export namespace Events {');
410
+ expect(content).toContain('export namespace WatchEvents {');
411
+ expect(content).toContain('TypedStream<Events.WatchEvents.Yield, Events.WatchEvents.Return>');
412
+ });
413
+ it('does not contain flat-style prefixed types', async () => {
414
+ tmpDir = makeTmpDir();
415
+ await generateClient({ envelope, outDir: tmpDir, namespaceTypes: true });
416
+ const content = readFileSync(join(tmpDir, 'users.ts'), 'utf-8');
417
+ expect(content).not.toContain('export type GetUserParams');
418
+ expect(content).not.toContain('export type GetUserResponse');
419
+ expect(content).not.toContain('export type UpdateUserPathParams');
420
+ });
421
+ it('enumStyle: enum produces named enums inside namespace', async () => {
422
+ // Create envelope with an enum field
423
+ const enumRoute = {
424
+ kind: 'rpc',
425
+ name: 'SetStatus',
426
+ path: '/status',
427
+ method: 'post',
428
+ scope: 'admin',
429
+ version: 1,
430
+ jsonSchema: {
431
+ body: {
432
+ type: 'object',
433
+ properties: {
434
+ status: { type: 'string', enum: ['active', 'pending', 'disabled'] },
435
+ },
436
+ required: ['status'],
437
+ },
438
+ response: {
439
+ type: 'object',
440
+ properties: { ok: { type: 'boolean' } },
441
+ required: ['ok'],
442
+ },
443
+ },
444
+ };
445
+ const enumEnvelope = {
446
+ basePath: '/api',
447
+ headers: [],
448
+ errors: [],
449
+ routes: [enumRoute],
450
+ };
451
+ tmpDir = makeTmpDir();
452
+ await generateClient({
453
+ envelope: enumEnvelope,
454
+ outDir: tmpDir,
455
+ namespaceTypes: true,
456
+ ajsc: { enumStyle: 'enum' },
457
+ });
458
+ const content = readFileSync(join(tmpDir, 'admin.ts'), 'utf-8');
459
+ expect(content).toContain('export namespace Admin {');
460
+ expect(content).toContain('export enum Status');
461
+ });
462
+ });
463
+ });
464
+ //# sourceMappingURL=e2e.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"e2e.test.js","sourceRoot":"","sources":["../../../src/codegen/e2e.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAGhC,8EAA8E;AAC9E,WAAW;AACX,8EAA8E;AAE9E,MAAM,QAAQ,GAAoB;IAChC,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,CAAC;IACV,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;YACtC,QAAQ,EAAE,CAAC,IAAI,CAAC;SACjB;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;YACnE,QAAQ,EAAE,CAAC,MAA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AAM,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,OAAO,CAAC,CAAA;YAC/D,MAAM,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,0BAA0B,CAAC,CAAA;YACrD,MAAM,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAA;QACjD,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Reads all client runtime source files from `src/client/`, strips inter-file
3
+ * imports and barrel re-exports, and returns a single bundled `_client.ts`
4
+ * file content.
5
+ *
6
+ * The output is self-contained and only imports types from the sibling
7
+ * `_types.ts` file.
8
+ */
9
+ export declare function emitClientRuntimeFile(): Promise<string>;
@@ -0,0 +1,99 @@
1
+ import { fileURLToPath } from 'node:url';
2
+ import { dirname, resolve } from 'node:path';
3
+ import { readFile, access } from 'node:fs/promises';
4
+ import { CODEGEN_HEADER } from './constants.js';
5
+ const TYPES_IMPORT = `import type {
6
+ ClientAdapter,
7
+ AdapterRequest,
8
+ AdapterResponse,
9
+ AdapterStreamResponse,
10
+ ClientHooks,
11
+ BeforeRequestContext,
12
+ AfterResponseContext,
13
+ ErrorContext,
14
+ CallDescriptor,
15
+ StreamDescriptor,
16
+ TypedStream,
17
+ ClientInstance,
18
+ ProcedureCallOptions,
19
+ CreateClientConfig,
20
+ } from './_types'`;
21
+ /**
22
+ * Source files to bundle, in dependency order.
23
+ * Each will be read from `src/client/` relative to the package root.
24
+ */
25
+ const SOURCE_FILES = [
26
+ 'errors.ts',
27
+ 'request-builder.ts',
28
+ 'hooks.ts',
29
+ 'call.ts',
30
+ 'stream.ts',
31
+ 'fetch-adapter.ts',
32
+ 'index.ts',
33
+ ];
34
+ /**
35
+ * Strips all `import` statements from source content.
36
+ * These are inter-file imports that become unnecessary in a single bundled file.
37
+ *
38
+ * Note: the regex requires a `from` clause, so side-effect imports like
39
+ * `import './polyfill.js'` are NOT stripped. This is intentional — src/client/
40
+ * has no side-effect imports.
41
+ */
42
+ function stripImports(content) {
43
+ // Handle both single-line and multi-line import statements
44
+ return content.replace(/^import\s[\s\S]*?from\s+['"][^'"]+['"]\s*;?\s*$/gm, '');
45
+ }
46
+ /**
47
+ * Strips barrel re-export lines from index.ts content:
48
+ * - `export type { ... } from '...'`
49
+ * - `export { ... } from '...'`
50
+ */
51
+ function stripReExports(content) {
52
+ // `[^}]*` matches across newlines intentionally, handling multi-line export blocks
53
+ return content.replace(/^export\s+(type\s+)?{[^}]*}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm, '');
54
+ }
55
+ /**
56
+ * Reads all client runtime source files from `src/client/`, strips inter-file
57
+ * imports and barrel re-exports, and returns a single bundled `_client.ts`
58
+ * file content.
59
+ *
60
+ * The output is self-contained and only imports types from the sibling
61
+ * `_types.ts` file.
62
+ */
63
+ export async function emitClientRuntimeFile() {
64
+ const __filename = fileURLToPath(import.meta.url);
65
+ const __dirname = dirname(__filename);
66
+ // Works from both src/codegen/ (source) and build/codegen/ (compiled)
67
+ const packageRoot = resolve(__dirname, '../..');
68
+ const clientDir = resolve(packageRoot, 'src/client');
69
+ // Verify all source files exist
70
+ for (const file of SOURCE_FILES) {
71
+ const filePath = resolve(clientDir, file);
72
+ await access(filePath).catch(() => {
73
+ throw new Error(`[ts-procedures-codegen] Cannot locate src/client/${file} at expected path: ${filePath}. ` +
74
+ `Ensure ts-procedures is installed correctly.`);
75
+ });
76
+ }
77
+ const sections = [];
78
+ for (const file of SOURCE_FILES) {
79
+ const filePath = resolve(clientDir, file);
80
+ let content = await readFile(filePath, 'utf-8');
81
+ // Strip all import statements (inter-file imports)
82
+ content = stripImports(content);
83
+ // For index.ts, also strip barrel re-export lines
84
+ if (file === 'index.ts') {
85
+ content = stripReExports(content);
86
+ // Strip trailing comment-only blocks (e.g., "// ── Barrel exports ─────")
87
+ content = content.replace(/(?:\n\/\/[^\n]*)+\s*$/, '');
88
+ }
89
+ // Collapse runs of 3+ blank lines into 2
90
+ content = content.replace(/\n{3,}/g, '\n\n');
91
+ // Trim leading/trailing whitespace
92
+ content = content.trim();
93
+ if (content.length > 0) {
94
+ sections.push(content);
95
+ }
96
+ }
97
+ return [CODEGEN_HEADER, '', TYPES_IMPORT, '', ...sections, ''].join('\n');
98
+ }
99
+ //# sourceMappingURL=emit-client-runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emit-client-runtime.js","sourceRoot":"","sources":["../../../src/codegen/emit-client-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;kBAeH,CAAA;AAElB;;;GAGG;AACH,MAAM,YAAY,GAAG;IACnB,WAAW;IACX,oBAAoB;IACpB,UAAU;IACV,SAAS;IACT,WAAW;IACX,kBAAkB;IAClB,UAAU;CACF,CAAA;AAEV;;;;;;;GAOG;AACH,SAAS,YAAY,CAAC,OAAe;IACnC,2DAA2D;IAC3D,OAAO,OAAO,CAAC,OAAO,CAAC,mDAAmD,EAAE,EAAE,CAAC,CAAA;AACjF,CAAC;AAED;;;;GAIG;AACH,SAAS,cAAc,CAAC,OAAe;IACrC,mFAAmF;IACnF,OAAO,OAAO,CAAC,OAAO,CAAC,gEAAgE,EAAE,EAAE,CAAC,CAAA;AAC9F,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB;IACzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACjD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,C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