@auto-engineer/server-generator-apollo-emmett 0.1.1

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 (272) hide show
  1. package/.tmp/server-test-output/server/package.json +26 -0
  2. package/.tmp/server-test-output/server/scripts/generate-schema.ts +31 -0
  3. package/.tmp/server-test-output/server/src/domain/flows/add-item/create-item/commands.ts +8 -0
  4. package/.tmp/server-test-output/server/src/domain/flows/add-item/create-item/decide.specs.ts +36 -0
  5. package/.tmp/server-test-output/server/src/domain/flows/add-item/create-item/decide.ts +33 -0
  6. package/.tmp/server-test-output/server/src/domain/flows/add-item/create-item/events.ts +10 -0
  7. package/.tmp/server-test-output/server/src/domain/flows/add-item/create-item/evolve.ts +28 -0
  8. package/.tmp/server-test-output/server/src/domain/flows/add-item/create-item/handle.ts +24 -0
  9. package/.tmp/server-test-output/server/src/domain/flows/add-item/create-item/mutation.resolver.ts +25 -0
  10. package/.tmp/server-test-output/server/src/domain/flows/add-item/create-item/register.ts +7 -0
  11. package/.tmp/server-test-output/server/src/domain/flows/add-item/create-item/state.ts +47 -0
  12. package/.tmp/server-test-output/server/src/domain/flows/add-item/get-available-items/projection.specs.ts +46 -0
  13. package/.tmp/server-test-output/server/src/domain/flows/add-item/get-available-items/projection.ts +38 -0
  14. package/.tmp/server-test-output/server/src/domain/flows/add-item/get-available-items/query.resolver.ts +39 -0
  15. package/.tmp/server-test-output/server/src/domain/flows/add-item/get-available-items/state.ts +5 -0
  16. package/.tmp/server-test-output/server/src/domain/flows/add-item/notify-new-item/commands.ts +8 -0
  17. package/.tmp/server-test-output/server/src/domain/flows/add-item/notify-new-item/decide.specs.ts +36 -0
  18. package/.tmp/server-test-output/server/src/domain/flows/add-item/notify-new-item/decide.ts +33 -0
  19. package/.tmp/server-test-output/server/src/domain/flows/add-item/notify-new-item/events.ts +3 -0
  20. package/.tmp/server-test-output/server/src/domain/flows/add-item/notify-new-item/evolve.ts +28 -0
  21. package/.tmp/server-test-output/server/src/domain/flows/add-item/notify-new-item/handle.ts +24 -0
  22. package/.tmp/server-test-output/server/src/domain/flows/add-item/notify-new-item/mutation.resolver.ts +25 -0
  23. package/.tmp/server-test-output/server/src/domain/flows/add-item/notify-new-item/register.ts +7 -0
  24. package/.tmp/server-test-output/server/src/domain/flows/add-item/notify-new-item/state.ts +47 -0
  25. package/.tmp/server-test-output/server/src/domain/flows/add-item/notify-on-new-item/react.specs.ts +49 -0
  26. package/.tmp/server-test-output/server/src/domain/flows/add-item/notify-on-new-item/react.ts +43 -0
  27. package/.tmp/server-test-output/server/src/domain/flows/add-item/notify-on-new-item/register.ts +24 -0
  28. package/.tmp/server-test-output/server/src/domain/shared/ReadModel.ts +26 -0
  29. package/.tmp/server-test-output/server/src/domain/shared/index.ts +4 -0
  30. package/.tmp/server-test-output/server/src/domain/shared/reactorSpecification.ts +257 -0
  31. package/.tmp/server-test-output/server/src/domain/shared/sendCommand.ts +21 -0
  32. package/.tmp/server-test-output/server/src/domain/shared/types.ts +31 -0
  33. package/.tmp/server-test-output/server/src/server.ts +43 -0
  34. package/.tmp/server-test-output/server/src/utils/index.ts +3 -0
  35. package/.tmp/server-test-output/server/src/utils/loadProjections.ts +30 -0
  36. package/.tmp/server-test-output/server/src/utils/loadRegisterFiles.ts +41 -0
  37. package/.tmp/server-test-output/server/src/utils/loadResolvers.ts +36 -0
  38. package/.tmp/server-test-output/server/tsconfig.json +19 -0
  39. package/.tmp/server-test-output/server/vitest.config.ts +7 -0
  40. package/.turbo/turbo-build.log +5 -0
  41. package/.turbo/turbo-format.log +57 -0
  42. package/.turbo/turbo-lint.log +5 -0
  43. package/.turbo/turbo-test.log +113 -0
  44. package/.turbo/turbo-type-check.log +4 -0
  45. package/CHANGELOG.md +141 -0
  46. package/DEBUG.md +177 -0
  47. package/LICENSE +10 -0
  48. package/README.md +185 -0
  49. package/dist/cli-manifest.d.ts +3 -0
  50. package/dist/cli-manifest.d.ts.map +1 -0
  51. package/dist/cli-manifest.js +8 -0
  52. package/dist/cli-manifest.js.map +1 -0
  53. package/dist/codegen/extract/commands.d.ts +19 -0
  54. package/dist/codegen/extract/commands.d.ts.map +1 -0
  55. package/dist/codegen/extract/commands.js +52 -0
  56. package/dist/codegen/extract/commands.js.map +1 -0
  57. package/dist/codegen/extract/data-sink.d.ts +6 -0
  58. package/dist/codegen/extract/data-sink.d.ts.map +1 -0
  59. package/dist/codegen/extract/data-sink.js +39 -0
  60. package/dist/codegen/extract/data-sink.js.map +1 -0
  61. package/dist/codegen/extract/events.d.ts +10 -0
  62. package/dist/codegen/extract/events.d.ts.map +1 -0
  63. package/dist/codegen/extract/events.js +32 -0
  64. package/dist/codegen/extract/events.js.map +1 -0
  65. package/dist/codegen/extract/fields.d.ts +3 -0
  66. package/dist/codegen/extract/fields.d.ts.map +1 -0
  67. package/dist/codegen/extract/fields.js +9 -0
  68. package/dist/codegen/extract/fields.js.map +1 -0
  69. package/dist/codegen/extract/graphql.d.ts +14 -0
  70. package/dist/codegen/extract/graphql.d.ts.map +1 -0
  71. package/dist/codegen/extract/graphql.js +81 -0
  72. package/dist/codegen/extract/graphql.js.map +1 -0
  73. package/dist/codegen/extract/gwt.d.ts +6 -0
  74. package/dist/codegen/extract/gwt.d.ts.map +1 -0
  75. package/dist/codegen/extract/gwt.js +61 -0
  76. package/dist/codegen/extract/gwt.js.map +1 -0
  77. package/dist/codegen/extract/index.d.ts +8 -0
  78. package/dist/codegen/extract/index.d.ts.map +1 -0
  79. package/dist/codegen/extract/index.js +8 -0
  80. package/dist/codegen/extract/index.js.map +1 -0
  81. package/dist/codegen/extract/messages.d.ts +24 -0
  82. package/dist/codegen/extract/messages.d.ts.map +1 -0
  83. package/dist/codegen/extract/messages.js +131 -0
  84. package/dist/codegen/extract/messages.js.map +1 -0
  85. package/dist/codegen/extract/projection.d.ts +4 -0
  86. package/dist/codegen/extract/projection.d.ts.map +1 -0
  87. package/dist/codegen/extract/projection.js +30 -0
  88. package/dist/codegen/extract/projection.js.map +1 -0
  89. package/dist/codegen/extract/query.d.ts +11 -0
  90. package/dist/codegen/extract/query.d.ts.map +1 -0
  91. package/dist/codegen/extract/query.js +11 -0
  92. package/dist/codegen/extract/query.js.map +1 -0
  93. package/dist/codegen/extract/states.d.ts +5 -0
  94. package/dist/codegen/extract/states.d.ts.map +1 -0
  95. package/dist/codegen/extract/states.js +35 -0
  96. package/dist/codegen/extract/states.js.map +1 -0
  97. package/dist/codegen/scaffoldFromSchema.d.ts +9 -0
  98. package/dist/codegen/scaffoldFromSchema.d.ts.map +1 -0
  99. package/dist/codegen/scaffoldFromSchema.integration.specs.d.ts +2 -0
  100. package/dist/codegen/scaffoldFromSchema.integration.specs.d.ts.map +1 -0
  101. package/dist/codegen/scaffoldFromSchema.integration.specs.js +59 -0
  102. package/dist/codegen/scaffoldFromSchema.integration.specs.js.map +1 -0
  103. package/dist/codegen/scaffoldFromSchema.js +326 -0
  104. package/dist/codegen/scaffoldFromSchema.js.map +1 -0
  105. package/dist/codegen/templates/command/commands.specs.ts +90 -0
  106. package/dist/codegen/templates/command/commands.ts.ejs +11 -0
  107. package/dist/codegen/templates/command/decide.specs.specs.ts +265 -0
  108. package/dist/codegen/templates/command/decide.specs.ts +542 -0
  109. package/dist/codegen/templates/command/decide.specs.ts.ejs +51 -0
  110. package/dist/codegen/templates/command/decide.ts.ejs +107 -0
  111. package/dist/codegen/templates/command/events.specs.ts +106 -0
  112. package/dist/codegen/templates/command/events.ts.ejs +14 -0
  113. package/dist/codegen/templates/command/evolve.specs.ts +102 -0
  114. package/dist/codegen/templates/command/evolve.ts.ejs +39 -0
  115. package/dist/codegen/templates/command/handle.specs.ts +313 -0
  116. package/dist/codegen/templates/command/handle.ts.ejs +111 -0
  117. package/dist/codegen/templates/command/mutation.resolver.specs.ts +115 -0
  118. package/dist/codegen/templates/command/mutation.resolver.ts.ejs +25 -0
  119. package/dist/codegen/templates/command/register.specs.ts +107 -0
  120. package/dist/codegen/templates/command/register.ts.ejs +12 -0
  121. package/dist/codegen/templates/command/state.specs.ts +127 -0
  122. package/dist/codegen/templates/command/state.ts.ejs +47 -0
  123. package/dist/codegen/templates/query/projection.specs.specs..ts +276 -0
  124. package/dist/codegen/templates/query/projection.specs.ts +348 -0
  125. package/dist/codegen/templates/query/projection.specs.ts.ejs +71 -0
  126. package/dist/codegen/templates/query/projection.ts.ejs +121 -0
  127. package/dist/codegen/templates/query/query.resolver.specs.ts +254 -0
  128. package/dist/codegen/templates/query/query.resolver.ts.ejs +98 -0
  129. package/dist/codegen/templates/query/state.specs.ts +70 -0
  130. package/dist/codegen/templates/query/state.ts.ejs +7 -0
  131. package/dist/codegen/templates/react/react.specs.specs.ts +214 -0
  132. package/dist/codegen/templates/react/react.specs.ts +241 -0
  133. package/dist/codegen/templates/react/react.specs.ts.ejs +80 -0
  134. package/dist/codegen/templates/react/react.ts.ejs +56 -0
  135. package/dist/codegen/templates/react/register.specs.ts +222 -0
  136. package/dist/codegen/templates/react/register.ts.ejs +39 -0
  137. package/dist/codegen/test-data/specVariant1.d.ts +4 -0
  138. package/dist/codegen/test-data/specVariant1.d.ts.map +1 -0
  139. package/dist/codegen/test-data/specVariant1.js +185 -0
  140. package/dist/codegen/test-data/specVariant1.js.map +1 -0
  141. package/dist/codegen/types.d.ts +35 -0
  142. package/dist/codegen/types.d.ts.map +1 -0
  143. package/dist/codegen/types.js +2 -0
  144. package/dist/codegen/types.js.map +1 -0
  145. package/dist/codegen/utils/path.d.ts +4 -0
  146. package/dist/codegen/utils/path.d.ts.map +1 -0
  147. package/dist/codegen/utils/path.js +18 -0
  148. package/dist/codegen/utils/path.js.map +1 -0
  149. package/dist/commands/generate-server.d.ts +81 -0
  150. package/dist/commands/generate-server.d.ts.map +1 -0
  151. package/dist/commands/generate-server.js +383 -0
  152. package/dist/commands/generate-server.js.map +1 -0
  153. package/dist/domain/shared/ReadModel.d.ts +10 -0
  154. package/dist/domain/shared/ReadModel.d.ts.map +1 -0
  155. package/dist/domain/shared/ReadModel.js +19 -0
  156. package/dist/domain/shared/ReadModel.js.map +1 -0
  157. package/dist/domain/shared/ReadModel.ts +26 -0
  158. package/dist/domain/shared/index.d.ts +5 -0
  159. package/dist/domain/shared/index.d.ts.map +1 -0
  160. package/dist/domain/shared/index.js +5 -0
  161. package/dist/domain/shared/index.js.map +1 -0
  162. package/dist/domain/shared/index.ts +4 -0
  163. package/dist/domain/shared/reactorSpecification.d.ts +35 -0
  164. package/dist/domain/shared/reactorSpecification.d.ts.map +1 -0
  165. package/dist/domain/shared/reactorSpecification.js +155 -0
  166. package/dist/domain/shared/reactorSpecification.js.map +1 -0
  167. package/dist/domain/shared/reactorSpecification.ts +257 -0
  168. package/dist/domain/shared/sendCommand.d.ts +4 -0
  169. package/dist/domain/shared/sendCommand.d.ts.map +1 -0
  170. package/dist/domain/shared/sendCommand.js +17 -0
  171. package/dist/domain/shared/sendCommand.js.map +1 -0
  172. package/dist/domain/shared/sendCommand.ts +21 -0
  173. package/dist/domain/shared/types.d.ts +19 -0
  174. package/dist/domain/shared/types.d.ts.map +1 -0
  175. package/dist/domain/shared/types.js +39 -0
  176. package/dist/domain/shared/types.js.map +1 -0
  177. package/dist/domain/shared/types.ts +31 -0
  178. package/dist/index.d.ts +3 -0
  179. package/dist/index.d.ts.map +1 -0
  180. package/dist/index.js +3 -0
  181. package/dist/index.js.map +1 -0
  182. package/dist/server.d.ts +2 -0
  183. package/dist/server.d.ts.map +1 -0
  184. package/dist/server.js +33 -0
  185. package/dist/server.js.map +1 -0
  186. package/dist/server.ts +43 -0
  187. package/dist/utils/index.d.ts +4 -0
  188. package/dist/utils/index.d.ts.map +1 -0
  189. package/dist/utils/index.js +4 -0
  190. package/dist/utils/index.js.map +1 -0
  191. package/dist/utils/index.ts +3 -0
  192. package/dist/utils/loadProjections.d.ts +3 -0
  193. package/dist/utils/loadProjections.d.ts.map +1 -0
  194. package/dist/utils/loadProjections.js +23 -0
  195. package/dist/utils/loadProjections.js.map +1 -0
  196. package/dist/utils/loadProjections.ts +30 -0
  197. package/dist/utils/loadRegisterFiles.d.ts +6 -0
  198. package/dist/utils/loadRegisterFiles.d.ts.map +1 -0
  199. package/dist/utils/loadRegisterFiles.js +28 -0
  200. package/dist/utils/loadRegisterFiles.js.map +1 -0
  201. package/dist/utils/loadRegisterFiles.ts +41 -0
  202. package/dist/utils/loadResolvers.d.ts +5 -0
  203. package/dist/utils/loadResolvers.d.ts.map +1 -0
  204. package/dist/utils/loadResolvers.js +27 -0
  205. package/dist/utils/loadResolvers.js.map +1 -0
  206. package/dist/utils/loadResolvers.ts +36 -0
  207. package/package.json +55 -0
  208. package/src/cli-manifest.ts +9 -0
  209. package/src/codegen/extract/commands.ts +79 -0
  210. package/src/codegen/extract/data-sink.ts +45 -0
  211. package/src/codegen/extract/events.ts +46 -0
  212. package/src/codegen/extract/fields.ts +17 -0
  213. package/src/codegen/extract/graphql.ts +103 -0
  214. package/src/codegen/extract/gwt.ts +75 -0
  215. package/src/codegen/extract/index.ts +7 -0
  216. package/src/codegen/extract/messages.ts +196 -0
  217. package/src/codegen/extract/projection.ts +47 -0
  218. package/src/codegen/extract/query.ts +18 -0
  219. package/src/codegen/extract/states.ts +45 -0
  220. package/src/codegen/scaffoldFromSchema.integration.specs.ts +71 -0
  221. package/src/codegen/scaffoldFromSchema.ts +440 -0
  222. package/src/codegen/templates/command/commands.specs.ts +90 -0
  223. package/src/codegen/templates/command/commands.ts.ejs +11 -0
  224. package/src/codegen/templates/command/decide.specs.specs.ts +265 -0
  225. package/src/codegen/templates/command/decide.specs.ts +542 -0
  226. package/src/codegen/templates/command/decide.specs.ts.ejs +51 -0
  227. package/src/codegen/templates/command/decide.ts.ejs +107 -0
  228. package/src/codegen/templates/command/events.specs.ts +106 -0
  229. package/src/codegen/templates/command/events.ts.ejs +14 -0
  230. package/src/codegen/templates/command/evolve.specs.ts +102 -0
  231. package/src/codegen/templates/command/evolve.ts.ejs +39 -0
  232. package/src/codegen/templates/command/handle.specs.ts +313 -0
  233. package/src/codegen/templates/command/handle.ts.ejs +111 -0
  234. package/src/codegen/templates/command/mutation.resolver.specs.ts +115 -0
  235. package/src/codegen/templates/command/mutation.resolver.ts.ejs +25 -0
  236. package/src/codegen/templates/command/register.specs.ts +107 -0
  237. package/src/codegen/templates/command/register.ts.ejs +12 -0
  238. package/src/codegen/templates/command/state.specs.ts +127 -0
  239. package/src/codegen/templates/command/state.ts.ejs +47 -0
  240. package/src/codegen/templates/query/projection.specs.specs..ts +276 -0
  241. package/src/codegen/templates/query/projection.specs.ts +348 -0
  242. package/src/codegen/templates/query/projection.specs.ts.ejs +71 -0
  243. package/src/codegen/templates/query/projection.ts.ejs +121 -0
  244. package/src/codegen/templates/query/query.resolver.specs.ts +254 -0
  245. package/src/codegen/templates/query/query.resolver.ts.ejs +98 -0
  246. package/src/codegen/templates/query/state.specs.ts +70 -0
  247. package/src/codegen/templates/query/state.ts.ejs +7 -0
  248. package/src/codegen/templates/react/react.specs.specs.ts +214 -0
  249. package/src/codegen/templates/react/react.specs.ts +241 -0
  250. package/src/codegen/templates/react/react.specs.ts.ejs +80 -0
  251. package/src/codegen/templates/react/react.ts.ejs +56 -0
  252. package/src/codegen/templates/react/register.specs.ts +222 -0
  253. package/src/codegen/templates/react/register.ts.ejs +39 -0
  254. package/src/codegen/test-data/specVariant1.json +212 -0
  255. package/src/codegen/test-data/specVariant1.ts +188 -0
  256. package/src/codegen/test-data/specVariant2.json +396 -0
  257. package/src/codegen/types.ts +35 -0
  258. package/src/codegen/utils/path.ts +20 -0
  259. package/src/commands/generate-server.ts +517 -0
  260. package/src/domain/shared/ReadModel.ts +26 -0
  261. package/src/domain/shared/index.ts +4 -0
  262. package/src/domain/shared/reactorSpecification.ts +257 -0
  263. package/src/domain/shared/sendCommand.ts +21 -0
  264. package/src/domain/shared/types.ts +31 -0
  265. package/src/index.ts +2 -0
  266. package/src/server.ts +43 -0
  267. package/src/utils/index.ts +3 -0
  268. package/src/utils/loadProjections.ts +30 -0
  269. package/src/utils/loadRegisterFiles.ts +41 -0
  270. package/src/utils/loadResolvers.ts +36 -0
  271. package/tsconfig.json +12 -0
  272. package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,222 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { SpecsSchemaType as SpecsSchema } from '@auto-engineer/flow';
3
+ import { generateScaffoldFilePlans } from '../../scaffoldFromSchema';
4
+
5
+ describe('register.ts.ejs (react slice)', () => {
6
+ it('should generate correct register.ts', async () => {
7
+ const spec: SpecsSchema = {
8
+ variant: 'specs',
9
+ flows: [
10
+ {
11
+ name: 'manage bookings',
12
+ slices: [
13
+ {
14
+ type: 'command',
15
+ name: 'guest submits booking request',
16
+ client: { description: '', specs: [] },
17
+ server: {
18
+ description: '',
19
+ gwt: [
20
+ {
21
+ when: {
22
+ commandRef: 'RequestBooking',
23
+ exampleData: {
24
+ propertyId: 'listing_123',
25
+ hostId: 'host_123',
26
+ guestId: 'guest_456',
27
+ checkIn: '2025-07-15',
28
+ checkOut: '2025-07-18',
29
+ guests: 2,
30
+ message: 'Looking forward to my stay!',
31
+ metadata: { now: 'bar', bookingId: '123' },
32
+ },
33
+ },
34
+ then: [
35
+ {
36
+ eventRef: 'BookingRequested',
37
+ exampleData: {
38
+ bookingId: 'book_xyz789',
39
+ hostId: 'host_123',
40
+ propertyId: 'prop_789',
41
+ guestId: 'guest_456',
42
+ checkIn: '2025-07-15',
43
+ checkOut: '2025-07-18',
44
+ guests: 2,
45
+ message: 'Hey',
46
+ status: 'pending_host_approval',
47
+ requestedAt: '2025-06-10T16:30:00.000Z',
48
+ expiresAt: '2025-06-11T16:30:00.000Z',
49
+ },
50
+ },
51
+ ],
52
+ },
53
+ ],
54
+ },
55
+ },
56
+ {
57
+ type: 'react',
58
+ name: 'Send notification to host',
59
+ server: {
60
+ description: 'Sends a host notification command in response to BookingRequested',
61
+ gwt: [
62
+ {
63
+ when: [
64
+ {
65
+ eventRef: 'BookingRequested',
66
+ exampleData: {
67
+ bookingId: 'book_xyz789',
68
+ hostId: 'host_123',
69
+ propertyId: 'prop_789',
70
+ guestId: 'guest_456',
71
+ checkIn: '2025-07-15',
72
+ checkOut: '2025-07-18',
73
+ guests: 2,
74
+ message: 'Hey',
75
+ status: 'pending_host_approval',
76
+ requestedAt: '2025-06-10T16:30:00.000Z',
77
+ expiresAt: '2025-06-11T16:30:00.000Z',
78
+ },
79
+ },
80
+ ],
81
+ then: [
82
+ {
83
+ commandRef: 'NotifyHost',
84
+ exampleData: {
85
+ hostId: 'host_123',
86
+ notificationType: 'booking_request',
87
+ priority: 'high',
88
+ channels: ['email', 'push'],
89
+ message: 'A guest has requested to book your place.',
90
+ actionRequired: true,
91
+ },
92
+ },
93
+ ],
94
+ },
95
+ ],
96
+ },
97
+ },
98
+ {
99
+ type: 'command',
100
+ name: 'notify host',
101
+ client: { description: '', specs: [] },
102
+ server: {
103
+ description: '',
104
+ gwt: [
105
+ {
106
+ when: {
107
+ commandRef: 'NotifyHost',
108
+ exampleData: {
109
+ hostId: 'host_123',
110
+ notificationType: 'booking_request',
111
+ priority: 'high',
112
+ channels: ['email', 'push'],
113
+ message: 'A guest has requested to book your place.',
114
+ actionRequired: true,
115
+ },
116
+ },
117
+ then: [
118
+ {
119
+ eventRef: 'HostNotified',
120
+ exampleData: {
121
+ bookingId: 'book_xyz789',
122
+ hostId: 'host_123',
123
+ notificationType: 'booking_request',
124
+ channels: ['email', 'push'],
125
+ message: 'hi.',
126
+ notifiedAt: '2025-06-10T16:30:00.000Z',
127
+ actionRequired: true,
128
+ },
129
+ },
130
+ ],
131
+ },
132
+ ],
133
+ },
134
+ },
135
+ ],
136
+ },
137
+ ],
138
+ messages: [
139
+ {
140
+ type: 'command',
141
+ name: 'RequestBooking',
142
+ fields: [
143
+ { name: 'propertyId', type: 'string', required: true },
144
+ { name: 'hostId', type: 'string', required: true },
145
+ { name: 'guestId', type: 'string', required: true },
146
+ { name: 'checkIn', type: 'date', required: true },
147
+ { name: 'checkOut', type: 'date', required: true },
148
+ { name: 'guests', type: 'number', required: true },
149
+ { name: 'message', type: 'string', required: false },
150
+ ],
151
+ },
152
+ {
153
+ type: 'command',
154
+ name: 'NotifyHost',
155
+ fields: [
156
+ { name: 'hostId', type: 'string', required: true },
157
+ { name: 'notificationType', type: 'string', required: true },
158
+ { name: 'priority', type: 'string', required: true },
159
+ { name: 'channels', type: 'string[]', required: true },
160
+ { name: 'message', type: 'string', required: true },
161
+ { name: 'actionRequired', type: 'boolean', required: true },
162
+ ],
163
+ },
164
+ {
165
+ type: 'event',
166
+ name: 'BookingRequested',
167
+ source: 'internal',
168
+ fields: [
169
+ { name: 'bookingId', type: 'string', required: true },
170
+ { name: 'hostId', type: 'string', required: true },
171
+ { name: 'message', type: 'string', required: true },
172
+ ],
173
+ },
174
+ {
175
+ type: 'event',
176
+ name: 'HostNotified',
177
+ source: 'internal',
178
+ fields: [
179
+ { name: 'bookingId', type: 'string', required: true },
180
+ { name: 'hostId', type: 'string', required: true },
181
+ { name: 'notificationType', type: 'string', required: true },
182
+ { name: 'channels', type: 'string[]', required: true },
183
+ { name: 'notifiedAt', type: 'date', required: true },
184
+ { name: 'actionRequired', type: 'boolean', required: true },
185
+ { name: 'message', type: 'string', required: true },
186
+ ],
187
+ },
188
+ ],
189
+ };
190
+
191
+ const plans = await generateScaffoldFilePlans(spec.flows, spec.messages, undefined, 'src/domain/flows');
192
+ const registerFile = plans.find((p) => p.outputPath.endsWith('send-notification-to-host/register.ts'));
193
+
194
+ expect(registerFile?.contents).toMatchInlineSnapshot(`
195
+ "import { type CommandSender, type EventSubscription, type InMemoryEventStore } from '@event-driven-io/emmett';
196
+ import type { BookingRequested } from '../guest-submits-booking-request/events';
197
+
198
+ export async function register(messageBus: CommandSender & EventSubscription, eventStore: InMemoryEventStore) {
199
+ messageBus.subscribe(async (event: BookingRequested) => {
200
+ /**
201
+ * ## IMPLEMENTATION INSTRUCTIONS ##
202
+ *
203
+ * - Replace the placeholder logic with the real implementation.
204
+ * - Send one or more commands via: messageBus.send({...})
205
+ */
206
+
207
+ // await messageBus.send({
208
+ // type: 'NotifyHost',
209
+ // kind: 'Command',
210
+ // data: {
211
+ // // Map event fields to command fields here
212
+ // // e.g., userId: event.data.userId,
213
+ // },
214
+ // });
215
+
216
+ return;
217
+ }, 'BookingRequested');
218
+ }
219
+ "
220
+ `);
221
+ });
222
+ });
@@ -0,0 +1,39 @@
1
+ <%
2
+ const gwt = slice.server?.gwt?.[0];
3
+ const when = Array.isArray(gwt?.when) ? gwt.when[0] : gwt?.when;
4
+ const then = Array.isArray(gwt?.then) ? gwt.then[0] : gwt?.then;
5
+
6
+ const eventType = when?.eventRef;
7
+ const commandType = then?.commandRef;
8
+ const event = events.find(e => e.type === eventType);
9
+ %>
10
+ import { type CommandSender, type EventSubscription, type InMemoryEventStore } from '@event-driven-io/emmett';
11
+ import type { <%= pascalCase(eventType) %> } from '../<%= toKebabCase(event?.sourceSliceName ?? 'unknown') %>/events';
12
+
13
+ export async function register(
14
+ messageBus: CommandSender & EventSubscription,
15
+ eventStore: InMemoryEventStore
16
+ ) {
17
+ messageBus.subscribe(
18
+ async (event: <%= pascalCase(eventType) %>) => {
19
+ /**
20
+ * ## IMPLEMENTATION INSTRUCTIONS ##
21
+ *
22
+ * - Replace the placeholder logic with the real implementation.
23
+ * - Send one or more commands via: messageBus.send({...})
24
+ */
25
+
26
+ // await messageBus.send({
27
+ // type: '<%= commandType %>',
28
+ // kind: 'Command',
29
+ // data: {
30
+ // // Map event fields to command fields here
31
+ // // e.g., userId: event.data.userId,
32
+ // },
33
+ // });
34
+
35
+ return;
36
+ },
37
+ '<%= eventType %>'
38
+ );
39
+ }
@@ -0,0 +1,4 @@
1
+ import { SpecsSchemaType as SpecsSchema } from '@auto-engineer/flow';
2
+ declare const specVariant1: SpecsSchema;
3
+ export default specVariant1;
4
+ //# sourceMappingURL=specVariant1.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"specVariant1.d.ts","sourceRoot":"","sources":["../../../src/codegen/test-data/specVariant1.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,IAAI,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAErE,QAAA,MAAM,YAAY,EAAE,WAuLnB,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -0,0 +1,185 @@
1
+ const specVariant1 = {
2
+ variant: 'specs',
3
+ flows: [
4
+ {
5
+ name: 'Add item',
6
+ description: 'Flow to add items to a system',
7
+ slices: [
8
+ {
9
+ type: 'command',
10
+ stream: 'item-${itemId}',
11
+ name: 'Create item',
12
+ description: 'Handles item creation',
13
+ client: {
14
+ description: 'A form that allows users to add items',
15
+ specs: ['have fields for id and description'],
16
+ },
17
+ server: {
18
+ description: 'Handles creation logic',
19
+ gwt: [
20
+ {
21
+ when: {
22
+ commandRef: 'CreateItem',
23
+ exampleData: {
24
+ itemId: 'item_123',
25
+ description: 'A new item',
26
+ },
27
+ },
28
+ then: [
29
+ {
30
+ eventRef: 'ItemCreated',
31
+ exampleData: {
32
+ id: 'item_123',
33
+ description: 'A new item',
34
+ addedAt: '2024-01-15T10:00:00.000Z',
35
+ },
36
+ },
37
+ ],
38
+ },
39
+ ],
40
+ },
41
+ },
42
+ {
43
+ type: 'query',
44
+ name: 'Get available items',
45
+ description: 'Projection of available items',
46
+ client: {
47
+ description: 'Show available items',
48
+ specs: [],
49
+ },
50
+ server: {
51
+ description: 'Project items based on ItemCreated',
52
+ data: [
53
+ {
54
+ origin: {
55
+ type: 'projection',
56
+ name: 'ItemCreated',
57
+ idField: 'id',
58
+ },
59
+ target: {
60
+ type: 'State',
61
+ name: 'AvailableItems',
62
+ fields: {
63
+ id: { type: 'string' },
64
+ description: { type: 'string' },
65
+ addedAt: { type: 'Date' },
66
+ },
67
+ },
68
+ },
69
+ ],
70
+ gwt: [
71
+ {
72
+ given: [
73
+ {
74
+ eventRef: 'ItemCreated',
75
+ exampleData: {
76
+ id: 'item_123',
77
+ description: 'A new item',
78
+ addedAt: '2024-01-15T10:00:00.000Z',
79
+ },
80
+ },
81
+ ],
82
+ then: [
83
+ {
84
+ stateRef: 'AvailableItems',
85
+ exampleData: {
86
+ id: 'item_123',
87
+ description: 'A new item',
88
+ addedAt: '2024-01-15T10:00:00.000Z',
89
+ },
90
+ },
91
+ ],
92
+ },
93
+ ],
94
+ },
95
+ },
96
+ {
97
+ type: 'react',
98
+ name: 'Notify on new item',
99
+ description: 'Sends a notification command when a new item is created',
100
+ server: {
101
+ description: 'Triggers NotifyNewItem command in response to ItemCreated',
102
+ gwt: [
103
+ {
104
+ when: [
105
+ {
106
+ eventRef: 'ItemCreated',
107
+ exampleData: {
108
+ id: 'item_123',
109
+ description: 'A new item',
110
+ addedAt: '2024-01-15T10:00:00.000Z',
111
+ },
112
+ },
113
+ ],
114
+ then: [
115
+ {
116
+ commandRef: 'NotifyNewItem',
117
+ exampleData: {
118
+ itemId: 'item_123',
119
+ message: 'A new item was added to the system.',
120
+ },
121
+ },
122
+ ],
123
+ },
124
+ ],
125
+ },
126
+ },
127
+ ],
128
+ },
129
+ ],
130
+ messages: [
131
+ {
132
+ type: 'command',
133
+ name: 'CreateItem',
134
+ description: 'Command to create a new item',
135
+ fields: [
136
+ { name: 'itemId', type: 'string', required: true },
137
+ { name: 'description', type: 'string', required: true },
138
+ ],
139
+ metadata: {
140
+ version: 1,
141
+ },
142
+ },
143
+ {
144
+ type: 'command',
145
+ name: 'NotifyNewItem',
146
+ description: 'Command to notify other systems when a new item is created',
147
+ fields: [
148
+ { name: 'itemId', type: 'string', required: true },
149
+ { name: 'message', type: 'string', required: true },
150
+ ],
151
+ metadata: {
152
+ version: 1,
153
+ },
154
+ },
155
+ {
156
+ type: 'event',
157
+ name: 'ItemCreated',
158
+ description: 'Event emitted when an item is created',
159
+ source: 'internal',
160
+ fields: [
161
+ { name: 'id', type: 'string', required: true },
162
+ { name: 'description', type: 'string', required: true },
163
+ { name: 'addedAt', type: 'Date', required: true },
164
+ ],
165
+ metadata: {
166
+ version: 1,
167
+ },
168
+ },
169
+ {
170
+ type: 'state',
171
+ name: 'AvailableItems',
172
+ description: 'State representing available items in the system',
173
+ fields: [
174
+ { name: 'id', type: 'string', required: true },
175
+ { name: 'description', type: 'string', required: true },
176
+ { name: 'addedAt', type: 'Date', required: true },
177
+ ],
178
+ metadata: {
179
+ version: 1,
180
+ },
181
+ },
182
+ ],
183
+ };
184
+ export default specVariant1;
185
+ //# sourceMappingURL=specVariant1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"specVariant1.js","sourceRoot":"","sources":["../../../src/codegen/test-data/specVariant1.ts"],"names":[],"mappings":"AAEA,MAAM,YAAY,GAAgB;IAChC,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE;QACL;YACE,IAAI,EAAE,UAAU;YAChB,WAAW,EAAE,+BAA+B;YAC5C,MAAM,EAAE;gBACN;oBACE,IAAI,EAAE,SAAS;oBACf,MAAM,EAAE,gBAAgB;oBACxB,IAAI,EAAE,aAAa;oBACnB,WAAW,EAAE,uBAAuB;oBACpC,MAAM,EAAE;wBACN,WAAW,EAAE,uCAAuC;wBACpD,KAAK,EAAE,CAAC,oCAAoC,CAAC;qBAC9C;oBAED,MAAM,EAAE;wBACN,WAAW,EAAE,wBAAwB;wBACrC,GAAG,EAAE;4BACH;gCACE,IAAI,EAAE;oCACJ,UAAU,EAAE,YAAY;oCACxB,WAAW,EAAE;wCACX,MAAM,EAAE,UAAU;wCAClB,WAAW,EAAE,YAAY;qCAC1B;iCACF;gCACD,IAAI,EAAE;oCACJ;wCACE,QAAQ,EAAE,aAAa;wCACvB,WAAW,EAAE;4CACX,EAAE,EAAE,UAAU;4CACd,WAAW,EAAE,YAAY;4CACzB,OAAO,EAAE,0BAA0B;yCACpC;qCACF;iCACF;6BACF;yBACF;qBACF;iBACF;gBACD;oBACE,IAAI,EAAE,OAAO;oBACb,IAAI,EAAE,qBAAqB;oBAC3B,WAAW,EAAE,+BAA+B;oBAC5C,MAAM,EAAE;wBACN,WAAW,EAAE,sBAAsB;wBACnC,KAAK,EAAE,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,OAAO;YACb,IAAI,EAAE,gBAAgB;YACtB,WAAW,EAAE,kDAAkD;YAC/D,MAAM,EAAE;gBACN,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC9C,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;gBACvD,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;aAClD;YACD,QAAQ,EAAE;gBACR,OAAO,EAAE,CAAC;aACX;SACF;KACF;CACF,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { CommandExample, EventExample } from '@auto-engineer/flow';
2
+ export interface Message {
3
+ type: string;
4
+ fields: Field[];
5
+ source?: 'when' | 'given' | 'then';
6
+ sourceFlowName?: string;
7
+ sourceSliceName?: string;
8
+ }
9
+ export interface Field {
10
+ name: string;
11
+ tsType: string;
12
+ required: boolean;
13
+ }
14
+ export interface MessageDefinition {
15
+ type: 'command' | 'event' | 'state';
16
+ name: string;
17
+ fields?: Array<{
18
+ name: string;
19
+ type: string;
20
+ required?: boolean;
21
+ description?: string;
22
+ defaultValue?: unknown;
23
+ }>;
24
+ metadata?: unknown;
25
+ description?: string;
26
+ }
27
+ export interface GwtCondition {
28
+ given?: EventExample[];
29
+ when: CommandExample;
30
+ then: Array<EventExample | {
31
+ errorType: string;
32
+ message?: string;
33
+ }>;
34
+ }
35
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/codegen/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnE,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IACnC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,KAAK,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,YAAY,CAAC,EAAE,OAAO,CAAC;KACxB,CAAC,CAAC;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IACvB,IAAI,EAAE,cAAc,CAAC;IACrB,IAAI,EAAE,KAAK,CAAC,YAAY,GAAG;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACrE"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/codegen/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export declare function toKebabCase(str: string): string;
2
+ export declare function ensureDirPath(...segments: string[]): string;
3
+ export declare function ensureDirExists(dirPath: string): Promise<void>;
4
+ //# sourceMappingURL=path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../src/codegen/utils/path.ts"],"names":[],"mappings":"AAIA,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK/C;AAED,wBAAgB,aAAa,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAE3D;AAED,wBAAsB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAIpE"}
@@ -0,0 +1,18 @@
1
+ import path from 'path';
2
+ import { mkdir } from 'fs/promises';
3
+ import { existsSync } from 'fs';
4
+ export function toKebabCase(str) {
5
+ return str
6
+ .replace(/([a-z])([A-Z])/g, '$1-$2')
7
+ .replace(/\s+/g, '-')
8
+ .toLowerCase();
9
+ }
10
+ export function ensureDirPath(...segments) {
11
+ return path.join(...segments);
12
+ }
13
+ export async function ensureDirExists(dirPath) {
14
+ if (!existsSync(dirPath)) {
15
+ await mkdir(dirPath, { recursive: true });
16
+ }
17
+ }
18
+ //# sourceMappingURL=path.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path.js","sourceRoot":"","sources":["../../../src/codegen/utils/path.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAEhC,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,OAAO,GAAG;SACP,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC;SACnC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,WAAW,EAAE,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,GAAG,QAAkB;IACjD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,OAAe;IACnD,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACzB,MAAM,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC"}
@@ -0,0 +1,81 @@
1
+ import 'reflect-metadata';
2
+ export declare const generateServerManifest: {
3
+ handler: () => Promise<{
4
+ default: CommandHandler<Readonly<{
5
+ type: "GenerateServer";
6
+ data: Readonly<{
7
+ schemaPath: string;
8
+ destination: string;
9
+ }>;
10
+ timestamp?: Date;
11
+ requestId?: string;
12
+ correlationId?: string;
13
+ }>, Readonly<{
14
+ type: "ServerGenerated";
15
+ data: Readonly<{
16
+ schemaPath: string;
17
+ destination: string;
18
+ serverDir: string;
19
+ contextSchemaGraphQL?: string;
20
+ }>;
21
+ timestamp?: Date;
22
+ requestId?: string;
23
+ correlationId?: string;
24
+ }> | Readonly<{
25
+ type: "ServerGenerationFailed";
26
+ data: Readonly<{
27
+ schemaPath: string;
28
+ destination: string;
29
+ error: string;
30
+ }>;
31
+ timestamp?: Date;
32
+ requestId?: string;
33
+ correlationId?: string;
34
+ }>>;
35
+ }>;
36
+ description: string;
37
+ usage: string;
38
+ examples: string[];
39
+ args: {
40
+ name: string;
41
+ description: string;
42
+ required: boolean;
43
+ }[];
44
+ };
45
+ type DefaultRecord = Record<string, unknown>;
46
+ export type Command<CommandType extends string = string, CommandData extends DefaultRecord = DefaultRecord> = Readonly<{
47
+ type: CommandType;
48
+ data: Readonly<CommandData>;
49
+ timestamp?: Date;
50
+ requestId?: string;
51
+ correlationId?: string;
52
+ }>;
53
+ export type Event<EventType extends string = string, EventData extends DefaultRecord = DefaultRecord> = Readonly<{
54
+ type: EventType;
55
+ data: Readonly<EventData>;
56
+ timestamp?: Date;
57
+ requestId?: string;
58
+ correlationId?: string;
59
+ }>;
60
+ export type CommandHandler<TCommand extends Command = Command, TResult = unknown> = {
61
+ name: string;
62
+ handle: (command: TCommand) => Promise<TResult>;
63
+ };
64
+ export type GenerateServerCommand = Command<'GenerateServer', {
65
+ schemaPath: string;
66
+ destination: string;
67
+ }>;
68
+ export type ServerGeneratedEvent = Event<'ServerGenerated', {
69
+ schemaPath: string;
70
+ destination: string;
71
+ serverDir: string;
72
+ contextSchemaGraphQL?: string;
73
+ }>;
74
+ export type ServerGenerationFailedEvent = Event<'ServerGenerationFailed', {
75
+ schemaPath: string;
76
+ destination: string;
77
+ error: string;
78
+ }>;
79
+ export declare const generateServerCommandHandler: CommandHandler<GenerateServerCommand, ServerGeneratedEvent | ServerGenerationFailedEvent>;
80
+ export default generateServerCommandHandler;
81
+ //# sourceMappingURL=generate-server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-server.d.ts","sourceRoot":"","sources":["../../src/commands/generate-server.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAoB1B,eAAO,MAAM,sBAAsB;;;;;4BAqCnB,MAAM;6BACL,MAAM;;wBAvBT,IAAI;wBACJ,MAAM;4BACF,MAAM;;;;4BA4BR,MAAM;6BACL,MAAM;2BACR,MAAM;uCACM,MAAM;;wBA1BnB,IAAI;wBACJ,MAAM;4BACF,MAAM;;;;4BA+BR,MAAM;6BACL,MAAM;uBACZ,MAAM;;wBAnCH,IAAI;wBACJ,MAAM;4BACF,MAAM;;;;;;;;;;;CAfvB,CAAC;AAEF,KAAK,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC7C,MAAM,MAAM,OAAO,CAAC,WAAW,SAAS,MAAM,GAAG,MAAM,EAAE,WAAW,SAAS,aAAa,GAAG,aAAa,IAAI,QAAQ,CAAC;IACrH,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC;IAC5B,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC,CAAC;AACH,MAAM,MAAM,KAAK,CAAC,SAAS,SAAS,MAA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