create-auto-app 0.2.3 → 0.8.4

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 (343) hide show
  1. package/README.md +197 -0
  2. package/dist/index.js +5 -0
  3. package/dist/index.js.map +1 -1
  4. package/package.json +4 -4
  5. package/templates/.gitkeep +0 -0
  6. package/templates/shopping-app/.context/schema.json +389 -218
  7. package/templates/shopping-app/.context/server/.context/auto-ia-scheme.json +79 -0
  8. package/templates/shopping-app/.context/server/server/package.json +26 -0
  9. package/templates/shopping-app/.context/server/server/scripts/generate-schema.ts +34 -0
  10. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/accepts-items-and-adds-to-their-cart/commands.ts +8 -0
  11. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/accepts-items-and-adds-to-their-cart/decide.specs.ts +46 -0
  12. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/accepts-items-and-adds-to-their-cart/decide.ts +33 -0
  13. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/accepts-items-and-adds-to-their-cart/events.ts +10 -0
  14. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/accepts-items-and-adds-to-their-cart/evolve.ts +28 -0
  15. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/accepts-items-and-adds-to-their-cart/handle.ts +24 -0
  16. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/accepts-items-and-adds-to-their-cart/mutation.resolver.ts +25 -0
  17. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/accepts-items-and-adds-to-their-cart/register.ts +7 -0
  18. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/accepts-items-and-adds-to-their-cart/state.ts +47 -0
  19. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/creates-a-chat-session/react.specs.ts +51 -0
  20. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/creates-a-chat-session/react.ts +43 -0
  21. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/creates-a-chat-session/register.ts +24 -0
  22. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/creates-a-chat-session-/react.specs.ts +51 -0
  23. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/creates-a-chat-session-/react.ts +43 -0
  24. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/creates-a-chat-session-/register.ts +24 -0
  25. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/enters-shopping-criteria-into-assistant/commands.ts +8 -0
  26. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/enters-shopping-criteria-into-assistant/decide.specs.ts +38 -0
  27. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/enters-shopping-criteria-into-assistant/decide.ts +33 -0
  28. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/enters-shopping-criteria-into-assistant/events.ts +10 -0
  29. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/enters-shopping-criteria-into-assistant/evolve.ts +28 -0
  30. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/enters-shopping-criteria-into-assistant/handle.ts +24 -0
  31. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/enters-shopping-criteria-into-assistant/mutation.resolver.ts +25 -0
  32. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/enters-shopping-criteria-into-assistant/register.ts +7 -0
  33. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/enters-shopping-criteria-into-assistant/state.ts +47 -0
  34. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria/commands.ts +8 -0
  35. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria/decide.specs.ts +101 -0
  36. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria/decide.ts +42 -0
  37. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria/events.ts +9 -0
  38. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria/evolve.ts +28 -0
  39. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria/handle.ts +52 -0
  40. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria/mutation.resolver.ts +25 -0
  41. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria/register.ts +7 -0
  42. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria/state.ts +47 -0
  43. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria-/commands.ts +8 -0
  44. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria-/decide.specs.ts +101 -0
  45. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria-/decide.ts +43 -0
  46. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria-/events.ts +9 -0
  47. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria-/evolve.ts +28 -0
  48. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria-/handle.ts +52 -0
  49. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria-/mutation.resolver.ts +25 -0
  50. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria-/register.ts +7 -0
  51. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria-/state.ts +47 -0
  52. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/views-suggested-items/projection.specs.ts +56 -0
  53. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/views-suggested-items/projection.ts +24 -0
  54. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/views-suggested-items/query.resolver.ts +56 -0
  55. package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/views-suggested-items/state.ts +4 -0
  56. package/templates/shopping-app/.context/server/server/src/domain/shared/ReadModel.ts +26 -0
  57. package/templates/shopping-app/{server/src/domain/shared/index.d.ts → .context/server/server/src/domain/shared/index.ts} +0 -1
  58. package/templates/shopping-app/{server/src/domain/shared/reactorSpecification.js → .context/server/server/src/domain/shared/reactorSpecification.ts} +116 -22
  59. package/templates/shopping-app/.context/server/server/src/domain/shared/sendCommand.ts +21 -0
  60. package/templates/shopping-app/{server/src/domain/shared/types.d.ts → .context/server/server/src/domain/shared/types.ts} +17 -5
  61. package/templates/shopping-app/.context/server/server/src/server.ts +43 -0
  62. package/templates/shopping-app/{server/src/utils/index.d.ts → .context/server/server/src/utils/index.ts} +0 -1
  63. package/templates/shopping-app/{server/src/utils/loadProjections.js → .context/server/server/src/utils/loadProjections.ts} +11 -6
  64. package/templates/shopping-app/.context/server/server/src/utils/loadRegisterFiles.ts +41 -0
  65. package/templates/shopping-app/{server/src/utils/loadResolvers.js → .context/server/server/src/utils/loadResolvers.ts} +16 -7
  66. package/templates/shopping-app/.context/server/server/tsconfig.json +13 -0
  67. package/templates/shopping-app/.context/server/server/vitest.config.ts +7 -0
  68. package/templates/shopping-app/auto.config.ts +78 -45
  69. package/templates/shopping-app/client/package.json +4 -4
  70. package/templates/shopping-app/client/src/App.tsx +13 -13
  71. package/templates/shopping-app/client/src/components/molecules/QuantitySelector.tsx +4 -4
  72. package/templates/shopping-app/client/src/components/molecules/ShoppingCriteriaForm.tsx +4 -4
  73. package/templates/shopping-app/client/src/components/molecules/SuggestedItemCard.tsx +6 -6
  74. package/templates/shopping-app/client/src/components/organisms/AssistantChatInterface.tsx +3 -3
  75. package/templates/shopping-app/client/src/components/organisms/PageHeader.tsx +2 -3
  76. package/templates/shopping-app/client/src/components/organisms/SuggestedItemsList.tsx +3 -3
  77. package/templates/shopping-app/client/src/index.css +10 -14
  78. package/templates/shopping-app/client/src/pages/AssistantChatPage.tsx +4 -4
  79. package/templates/shopping-app/client/src/pages/SuggestedItemsPage.tsx +4 -4
  80. package/templates/shopping-app/example-integrations/ai-chat-completion/package.json +5 -6
  81. package/templates/shopping-app/example-integrations/ai-chat-completion/src/ai-integration.ts +2 -2
  82. package/templates/shopping-app/example-integrations/cart/package.json +5 -6
  83. package/templates/shopping-app/example-integrations/cart-api/package.json +3 -3
  84. package/templates/shopping-app/example-integrations/product-catalogue/package.json +5 -5
  85. package/templates/shopping-app/example-integrations/product-catalogue/src/product-catalogue-integration.ts +3 -128
  86. package/templates/shopping-app/example-integrations/product-catalogue-api/package.json +3 -3
  87. package/templates/shopping-app/flows/shopping-assistant.flow.ts +195 -196
  88. package/templates/shopping-app/package.json +16 -11
  89. package/templates/shopping-app/server/package.json +4 -4
  90. package/templates/shopping-app/server/src/integrations/ai-integration.ts +2 -2
  91. package/templates/shopping-app/tsconfig.json +2 -2
  92. package/templates/shopping-app/.env +0 -8
  93. package/templates/shopping-app/example-integrations/ai-chat-completion/.turbo/turbo-build.log +0 -4
  94. package/templates/shopping-app/example-integrations/ai-chat-completion/.turbo/turbo-format.log +0 -12
  95. package/templates/shopping-app/example-integrations/ai-chat-completion/.turbo/turbo-lint.log +0 -4
  96. package/templates/shopping-app/example-integrations/ai-chat-completion/.turbo/turbo-test.log +0 -12
  97. package/templates/shopping-app/example-integrations/ai-chat-completion/.turbo/turbo-type-check.log +0 -5
  98. package/templates/shopping-app/example-integrations/ai-chat-completion/dist/ai-integration.d.ts +0 -23
  99. package/templates/shopping-app/example-integrations/ai-chat-completion/dist/ai-integration.d.ts.map +0 -1
  100. package/templates/shopping-app/example-integrations/ai-chat-completion/dist/ai-integration.js +0 -41
  101. package/templates/shopping-app/example-integrations/ai-chat-completion/dist/ai-integration.js.map +0 -1
  102. package/templates/shopping-app/example-integrations/ai-chat-completion/dist/index.d.ts +0 -2
  103. package/templates/shopping-app/example-integrations/ai-chat-completion/dist/index.d.ts.map +0 -1
  104. package/templates/shopping-app/example-integrations/ai-chat-completion/dist/index.js +0 -2
  105. package/templates/shopping-app/example-integrations/ai-chat-completion/dist/index.js.map +0 -1
  106. package/templates/shopping-app/example-integrations/ai-chat-completion/node_modules/.bin/eslint +0 -21
  107. package/templates/shopping-app/example-integrations/ai-chat-completion/node_modules/.bin/jiti +0 -21
  108. package/templates/shopping-app/example-integrations/ai-chat-completion/node_modules/.bin/msw +0 -21
  109. package/templates/shopping-app/example-integrations/ai-chat-completion/node_modules/.bin/tsc +0 -21
  110. package/templates/shopping-app/example-integrations/ai-chat-completion/node_modules/.bin/tsserver +0 -21
  111. package/templates/shopping-app/example-integrations/ai-chat-completion/node_modules/.bin/vite +0 -21
  112. package/templates/shopping-app/example-integrations/ai-chat-completion/node_modules/.bin/vitest +0 -21
  113. package/templates/shopping-app/example-integrations/cart/.turbo/turbo-build.log +0 -4
  114. package/templates/shopping-app/example-integrations/cart/.turbo/turbo-format.log +0 -12
  115. package/templates/shopping-app/example-integrations/cart/.turbo/turbo-lint.log +0 -5
  116. package/templates/shopping-app/example-integrations/cart/.turbo/turbo-test.log +0 -12
  117. package/templates/shopping-app/example-integrations/cart/.turbo/turbo-type-check.log +0 -5
  118. package/templates/shopping-app/example-integrations/cart/dist/cart-integration.d.ts +0 -30
  119. package/templates/shopping-app/example-integrations/cart/dist/cart-integration.d.ts.map +0 -1
  120. package/templates/shopping-app/example-integrations/cart/dist/cart-integration.js +0 -134
  121. package/templates/shopping-app/example-integrations/cart/dist/cart-integration.js.map +0 -1
  122. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/client.gen.d.ts +0 -3
  123. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/client.gen.d.ts.map +0 -1
  124. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/client.gen.js +0 -149
  125. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/client.gen.js.map +0 -1
  126. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/index.d.ts +0 -8
  127. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/index.d.ts.map +0 -1
  128. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/index.js +0 -6
  129. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/index.js.map +0 -1
  130. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/types.gen.d.ts +0 -123
  131. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/types.gen.d.ts.map +0 -1
  132. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/types.gen.js +0 -3
  133. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/types.gen.js.map +0 -1
  134. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/utils.gen.d.ts +0 -46
  135. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/utils.gen.d.ts.map +0 -1
  136. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/utils.gen.js +0 -285
  137. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/utils.gen.js.map +0 -1
  138. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client.gen.d.ts +0 -13
  139. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client.gen.d.ts.map +0 -1
  140. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client.gen.js +0 -6
  141. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client.gen.js.map +0 -1
  142. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/auth.gen.d.ts +0 -19
  143. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/auth.gen.d.ts.map +0 -1
  144. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/auth.gen.js +0 -15
  145. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/auth.gen.js.map +0 -1
  146. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/bodySerializer.gen.d.ts +0 -18
  147. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/bodySerializer.gen.d.ts.map +0 -1
  148. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/bodySerializer.gen.js +0 -58
  149. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/bodySerializer.gen.js.map +0 -1
  150. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/params.gen.d.ts +0 -34
  151. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/params.gen.d.ts.map +0 -1
  152. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/params.gen.js +0 -89
  153. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/params.gen.js.map +0 -1
  154. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/pathSerializer.gen.d.ts +0 -34
  155. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/pathSerializer.gen.d.ts.map +0 -1
  156. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/pathSerializer.gen.js +0 -115
  157. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/pathSerializer.gen.js.map +0 -1
  158. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/types.gen.d.ts +0 -79
  159. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/types.gen.d.ts.map +0 -1
  160. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/types.gen.js +0 -3
  161. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/types.gen.js.map +0 -1
  162. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/index.d.ts +0 -2
  163. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/index.d.ts.map +0 -1
  164. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/index.js +0 -3
  165. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/index.js.map +0 -1
  166. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/types.gen.d.ts +0 -158
  167. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/types.gen.d.ts.map +0 -1
  168. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/types.gen.js +0 -3
  169. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/types.gen.js.map +0 -1
  170. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/zod.gen.d.ts +0 -382
  171. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/zod.gen.d.ts.map +0 -1
  172. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/zod.gen.js +0 -68
  173. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/zod.gen.js.map +0 -1
  174. package/templates/shopping-app/example-integrations/cart/dist/index.d.ts +0 -2
  175. package/templates/shopping-app/example-integrations/cart/dist/index.d.ts.map +0 -1
  176. package/templates/shopping-app/example-integrations/cart/dist/index.js +0 -2
  177. package/templates/shopping-app/example-integrations/cart/dist/index.js.map +0 -1
  178. package/templates/shopping-app/example-integrations/cart/node_modules/.bin/eslint +0 -21
  179. package/templates/shopping-app/example-integrations/cart/node_modules/.bin/jiti +0 -21
  180. package/templates/shopping-app/example-integrations/cart/node_modules/.bin/msw +0 -21
  181. package/templates/shopping-app/example-integrations/cart/node_modules/.bin/tsc +0 -21
  182. package/templates/shopping-app/example-integrations/cart/node_modules/.bin/tsserver +0 -21
  183. package/templates/shopping-app/example-integrations/cart/node_modules/.bin/vitest +0 -21
  184. package/templates/shopping-app/example-integrations/cart-api/.turbo/turbo-build.log +0 -4
  185. package/templates/shopping-app/example-integrations/cart-api/.turbo/turbo-format.log +0 -10
  186. package/templates/shopping-app/example-integrations/cart-api/.turbo/turbo-lint.log +0 -4
  187. package/templates/shopping-app/example-integrations/cart-api/.turbo/turbo-test.log +0 -12
  188. package/templates/shopping-app/example-integrations/cart-api/.turbo/turbo-type-check.log +0 -4
  189. package/templates/shopping-app/example-integrations/cart-api/dist/data/cart.d.ts +0 -18
  190. package/templates/shopping-app/example-integrations/cart-api/dist/data/cart.d.ts.map +0 -1
  191. package/templates/shopping-app/example-integrations/cart-api/dist/data/cart.js +0 -28
  192. package/templates/shopping-app/example-integrations/cart-api/dist/data/cart.js.map +0 -1
  193. package/templates/shopping-app/example-integrations/cart-api/dist/index.d.ts +0 -4
  194. package/templates/shopping-app/example-integrations/cart-api/dist/index.d.ts.map +0 -1
  195. package/templates/shopping-app/example-integrations/cart-api/dist/index.js +0 -49
  196. package/templates/shopping-app/example-integrations/cart-api/dist/index.js.map +0 -1
  197. package/templates/shopping-app/example-integrations/cart-api/dist/routes/cart.d.ts +0 -4
  198. package/templates/shopping-app/example-integrations/cart-api/dist/routes/cart.d.ts.map +0 -1
  199. package/templates/shopping-app/example-integrations/cart-api/dist/routes/cart.js +0 -261
  200. package/templates/shopping-app/example-integrations/cart-api/dist/routes/cart.js.map +0 -1
  201. package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/nodemon +0 -21
  202. package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/swagger-jsdoc +0 -21
  203. package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/ts-node +0 -21
  204. package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/ts-node-cwd +0 -21
  205. package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/ts-node-esm +0 -21
  206. package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/ts-node-script +0 -21
  207. package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/ts-node-transpile-only +0 -21
  208. package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/ts-script +0 -21
  209. package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/tsc +0 -21
  210. package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/tsserver +0 -21
  211. package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/tsx +0 -21
  212. package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/vitest +0 -21
  213. package/templates/shopping-app/example-integrations/product-catalogue/.turbo/turbo-build.log +0 -4
  214. package/templates/shopping-app/example-integrations/product-catalogue/.turbo/turbo-format.log +0 -12
  215. package/templates/shopping-app/example-integrations/product-catalogue/.turbo/turbo-lint.log +0 -5
  216. package/templates/shopping-app/example-integrations/product-catalogue/.turbo/turbo-test.log +0 -12
  217. package/templates/shopping-app/example-integrations/product-catalogue/.turbo/turbo-type-check.log +0 -5
  218. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/client.gen.d.ts +0 -3
  219. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/client.gen.d.ts.map +0 -1
  220. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/client.gen.js +0 -149
  221. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/client.gen.js.map +0 -1
  222. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/index.d.ts +0 -8
  223. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/index.d.ts.map +0 -1
  224. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/index.js +0 -6
  225. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/index.js.map +0 -1
  226. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/types.gen.d.ts +0 -123
  227. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/types.gen.d.ts.map +0 -1
  228. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/types.gen.js +0 -3
  229. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/types.gen.js.map +0 -1
  230. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/utils.gen.d.ts +0 -46
  231. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/utils.gen.d.ts.map +0 -1
  232. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/utils.gen.js +0 -285
  233. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/utils.gen.js.map +0 -1
  234. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client.gen.d.ts +0 -13
  235. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client.gen.d.ts.map +0 -1
  236. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client.gen.js +0 -6
  237. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client.gen.js.map +0 -1
  238. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/auth.gen.d.ts +0 -19
  239. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/auth.gen.d.ts.map +0 -1
  240. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/auth.gen.js +0 -15
  241. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/auth.gen.js.map +0 -1
  242. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/bodySerializer.gen.d.ts +0 -18
  243. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/bodySerializer.gen.d.ts.map +0 -1
  244. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/bodySerializer.gen.js +0 -58
  245. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/bodySerializer.gen.js.map +0 -1
  246. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/params.gen.d.ts +0 -34
  247. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/params.gen.d.ts.map +0 -1
  248. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/params.gen.js +0 -89
  249. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/params.gen.js.map +0 -1
  250. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/pathSerializer.gen.d.ts +0 -34
  251. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/pathSerializer.gen.d.ts.map +0 -1
  252. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/pathSerializer.gen.js +0 -115
  253. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/pathSerializer.gen.js.map +0 -1
  254. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/types.gen.d.ts +0 -79
  255. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/types.gen.d.ts.map +0 -1
  256. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/types.gen.js +0 -3
  257. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/types.gen.js.map +0 -1
  258. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/index.d.ts +0 -2
  259. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/index.d.ts.map +0 -1
  260. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/index.js +0 -3
  261. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/index.js.map +0 -1
  262. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/types.gen.d.ts +0 -115
  263. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/types.gen.d.ts.map +0 -1
  264. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/types.gen.js +0 -3
  265. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/types.gen.js.map +0 -1
  266. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/zod.gen.d.ts +0 -206
  267. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/zod.gen.d.ts.map +0 -1
  268. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/zod.gen.js +0 -53
  269. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/zod.gen.js.map +0 -1
  270. package/templates/shopping-app/example-integrations/product-catalogue/dist/index.d.ts +0 -2
  271. package/templates/shopping-app/example-integrations/product-catalogue/dist/index.d.ts.map +0 -1
  272. package/templates/shopping-app/example-integrations/product-catalogue/dist/index.js +0 -2
  273. package/templates/shopping-app/example-integrations/product-catalogue/dist/index.js.map +0 -1
  274. package/templates/shopping-app/example-integrations/product-catalogue/dist/product-catalogue-integration.d.ts +0 -32
  275. package/templates/shopping-app/example-integrations/product-catalogue/dist/product-catalogue-integration.d.ts.map +0 -1
  276. package/templates/shopping-app/example-integrations/product-catalogue/dist/product-catalogue-integration.js +0 -163
  277. package/templates/shopping-app/example-integrations/product-catalogue/dist/product-catalogue-integration.js.map +0 -1
  278. package/templates/shopping-app/example-integrations/product-catalogue/node_modules/.bin/eslint +0 -21
  279. package/templates/shopping-app/example-integrations/product-catalogue/node_modules/.bin/jiti +0 -21
  280. package/templates/shopping-app/example-integrations/product-catalogue/node_modules/.bin/msw +0 -21
  281. package/templates/shopping-app/example-integrations/product-catalogue/node_modules/.bin/tsc +0 -21
  282. package/templates/shopping-app/example-integrations/product-catalogue/node_modules/.bin/tsserver +0 -21
  283. package/templates/shopping-app/example-integrations/product-catalogue/node_modules/.bin/vitest +0 -21
  284. package/templates/shopping-app/example-integrations/product-catalogue-api/.turbo/turbo-build.log +0 -4
  285. package/templates/shopping-app/example-integrations/product-catalogue-api/.turbo/turbo-format.log +0 -10
  286. package/templates/shopping-app/example-integrations/product-catalogue-api/.turbo/turbo-lint.log +0 -5
  287. package/templates/shopping-app/example-integrations/product-catalogue-api/.turbo/turbo-test.log +0 -13
  288. package/templates/shopping-app/example-integrations/product-catalogue-api/.turbo/turbo-type-check.log +0 -5
  289. package/templates/shopping-app/example-integrations/product-catalogue-api/dist/data/products.d.ts +0 -10
  290. package/templates/shopping-app/example-integrations/product-catalogue-api/dist/data/products.d.ts.map +0 -1
  291. package/templates/shopping-app/example-integrations/product-catalogue-api/dist/data/products.js +0 -75
  292. package/templates/shopping-app/example-integrations/product-catalogue-api/dist/data/products.js.map +0 -1
  293. package/templates/shopping-app/example-integrations/product-catalogue-api/dist/index.d.ts +0 -4
  294. package/templates/shopping-app/example-integrations/product-catalogue-api/dist/index.d.ts.map +0 -1
  295. package/templates/shopping-app/example-integrations/product-catalogue-api/dist/index.js +0 -49
  296. package/templates/shopping-app/example-integrations/product-catalogue-api/dist/index.js.map +0 -1
  297. package/templates/shopping-app/example-integrations/product-catalogue-api/dist/routes/products.d.ts +0 -4
  298. package/templates/shopping-app/example-integrations/product-catalogue-api/dist/routes/products.d.ts.map +0 -1
  299. package/templates/shopping-app/example-integrations/product-catalogue-api/dist/routes/products.js +0 -170
  300. package/templates/shopping-app/example-integrations/product-catalogue-api/dist/routes/products.js.map +0 -1
  301. package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/nodemon +0 -21
  302. package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/swagger-jsdoc +0 -21
  303. package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/ts-node +0 -21
  304. package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/ts-node-cwd +0 -21
  305. package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/ts-node-esm +0 -21
  306. package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/ts-node-script +0 -21
  307. package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/ts-node-transpile-only +0 -21
  308. package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/ts-script +0 -21
  309. package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/tsc +0 -21
  310. package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/tsserver +0 -21
  311. package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/tsx +0 -21
  312. package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/vitest +0 -21
  313. package/templates/shopping-app/pnpm-workspace.yaml +0 -2
  314. package/templates/shopping-app/server/src/domain/shared/ReadModel.d.ts +0 -10
  315. package/templates/shopping-app/server/src/domain/shared/ReadModel.d.ts.map +0 -1
  316. package/templates/shopping-app/server/src/domain/shared/ReadModel.js +0 -19
  317. package/templates/shopping-app/server/src/domain/shared/ReadModel.js.map +0 -1
  318. package/templates/shopping-app/server/src/domain/shared/index.d.ts.map +0 -1
  319. package/templates/shopping-app/server/src/domain/shared/index.js +0 -5
  320. package/templates/shopping-app/server/src/domain/shared/index.js.map +0 -1
  321. package/templates/shopping-app/server/src/domain/shared/reactorSpecification.d.ts +0 -56
  322. package/templates/shopping-app/server/src/domain/shared/reactorSpecification.d.ts.map +0 -1
  323. package/templates/shopping-app/server/src/domain/shared/reactorSpecification.js.map +0 -1
  324. package/templates/shopping-app/server/src/domain/shared/sendCommand.d.ts +0 -7
  325. package/templates/shopping-app/server/src/domain/shared/sendCommand.d.ts.map +0 -1
  326. package/templates/shopping-app/server/src/domain/shared/sendCommand.js +0 -16
  327. package/templates/shopping-app/server/src/domain/shared/sendCommand.js.map +0 -1
  328. package/templates/shopping-app/server/src/domain/shared/types.d.ts.map +0 -1
  329. package/templates/shopping-app/server/src/domain/shared/types.js +0 -40
  330. package/templates/shopping-app/server/src/domain/shared/types.js.map +0 -1
  331. package/templates/shopping-app/server/src/utils/index.d.ts.map +0 -1
  332. package/templates/shopping-app/server/src/utils/index.js +0 -4
  333. package/templates/shopping-app/server/src/utils/index.js.map +0 -1
  334. package/templates/shopping-app/server/src/utils/loadProjections.d.ts +0 -3
  335. package/templates/shopping-app/server/src/utils/loadProjections.d.ts.map +0 -1
  336. package/templates/shopping-app/server/src/utils/loadProjections.js.map +0 -1
  337. package/templates/shopping-app/server/src/utils/loadRegisterFiles.d.ts +0 -6
  338. package/templates/shopping-app/server/src/utils/loadRegisterFiles.d.ts.map +0 -1
  339. package/templates/shopping-app/server/src/utils/loadRegisterFiles.js +0 -26
  340. package/templates/shopping-app/server/src/utils/loadRegisterFiles.js.map +0 -1
  341. package/templates/shopping-app/server/src/utils/loadResolvers.d.ts +0 -5
  342. package/templates/shopping-app/server/src/utils/loadResolvers.d.ts.map +0 -1
  343. package/templates/shopping-app/server/src/utils/loadResolvers.js.map +0 -1
@@ -0,0 +1,79 @@
1
+ {
2
+ "components": {
3
+ "atoms": {
4
+ "items": {}
5
+ },
6
+ "molecules": {
7
+ "items": {
8
+ "ShoppingCriteriaInput": {
9
+ "description": "Input component for shoppers to describe their shopping criteria.",
10
+ "composition": {
11
+ "atoms": ["TextInput", "Button"],
12
+ "molecules": []
13
+ },
14
+ "specs": [
15
+ "allow shopper to describe their shopping needs in natural language",
16
+ "provide a text input for entering criteria",
17
+ "show examples of what to include (age, interests, budget)",
18
+ "show a button to submit the criteria"
19
+ ]
20
+ },
21
+ "SuggestedItemsList": {
22
+ "description": "Displays a list of suggested shopping items with quantity selectors.",
23
+ "composition": {
24
+ "atoms": ["Text", "QuantitySelector", "Button"],
25
+ "molecules": []
26
+ },
27
+ "specs": [
28
+ "display all suggested items with names and reasons",
29
+ "show quantity selectors for each item",
30
+ "have an 'Add to Cart' button for selected items",
31
+ "allow removing items from the suggestions"
32
+ ]
33
+ }
34
+ }
35
+ },
36
+ "organisms": {
37
+ "items": {
38
+ "ShoppingAssistant": {
39
+ "description": "Main component that manages the shopping criteria input and suggested items display.",
40
+ "composition": {
41
+ "molecules": ["ShoppingCriteriaInput", "SuggestedItemsList"]
42
+ },
43
+ "data_requirements": [
44
+ {
45
+ "type": "query",
46
+ "description": "Fetch suggested items based on shopper's criteria.",
47
+ "trigger": "When shopping criteria is entered.",
48
+ "details": {
49
+ "source": "AI integration",
50
+ "gql": "query GetSuggestedItems($sessionId: ID!) { suggestedItems(sessionId: $sessionId) { items { productId name quantity reason } } }"
51
+ }
52
+ }
53
+ ]
54
+ }
55
+ }
56
+ }
57
+ },
58
+ "pages": {
59
+ "ShoppingAssistantPage": {
60
+ "route": "/shopping-assistant",
61
+ "description": "Page for shoppers to interact with the shopping assistant.",
62
+ "layout": {
63
+ "organisms": ["ShoppingAssistant"]
64
+ },
65
+ "navigation": [],
66
+ "data_requirements": [
67
+ {
68
+ "type": "mutation",
69
+ "description": "Enter shopping criteria.",
70
+ "trigger": "When shopper submits their criteria.",
71
+ "details": {
72
+ "source": "User input",
73
+ "gql": "mutation EnterShoppingCriteria($input: EnterShoppingCriteriaInput!) { enterShoppingCriteria(input: $input) { success error { type message } } }"
74
+ }
75
+ }
76
+ ]
77
+ }
78
+ }
79
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "generated-server",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "start": "tsx --no-deprecation src/server.ts",
8
+ "type-check": "tsc --noEmit",
9
+ "test": "vitest run --reporter=dot",
10
+ "dev": "tsx --no-deprecation src/server.ts"
11
+ },
12
+ "dependencies": {
13
+ "@event-driven-io/emmett": "^0.38.2",
14
+ "type-graphql": "^2.0.0-rc.2",
15
+ "graphql": "^16.11.0",
16
+ "fast-glob": "^3.3.3",
17
+ "reflect-metadata": "^0.2.2",
18
+ "apollo-server": "^3.13.0",
19
+ "uuid": "^10.0.0"
20
+ },
21
+ "devDependencies": {
22
+ "typescript": "~5.8.3",
23
+ "vitest": "^3.2.3",
24
+ "tsx": "^4.7.1"
25
+ }
26
+ }
@@ -0,0 +1,34 @@
1
+ import 'reflect-metadata';
2
+ import { buildSchema } from 'type-graphql';
3
+ import { printSchema } from 'graphql';
4
+ import { writeFile } from 'fs/promises';
5
+ import * as path from 'path';
6
+ import { loadResolvers } from '../src/utils/loadResolvers.js';
7
+
8
+ async function main() {
9
+ try {
10
+ const resolvers = await loadResolvers('src/domain/flows/**/*.resolver.{ts,js}');
11
+ const schema = await buildSchema({
12
+ resolvers: resolvers as any,
13
+ emitSchemaFile: false,
14
+ });
15
+ const printedSchema = printSchema(schema);
16
+
17
+ const contextDir = path.resolve(
18
+ '/Users/ramihatoum/WebstormProjects/xolvio/auto-engineer/examples/shopping-app/.context/server',
19
+ '.context',
20
+ );
21
+ const schemaPath = path.join(contextDir, 'schema.graphql');
22
+ await writeFile(schemaPath, printedSchema, 'utf-8');
23
+
24
+ console.log(`✅ GraphQL schema generated at: ${schemaPath}`);
25
+ } catch (error) {
26
+ console.error(`❌ GraphQL schema generation failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
27
+ process.exit(1);
28
+ }
29
+ }
30
+
31
+ main().catch((err) => {
32
+ console.error(err);
33
+ process.exit(1);
34
+ });
@@ -0,0 +1,8 @@
1
+ import { Command } from '@event-driven-io/emmett';
2
+ export type AddItemsToCart = Command<
3
+ 'AddItemsToCart',
4
+ {
5
+ sessionId: string;
6
+ items: Array<{ productId: string; quantity: number }>;
7
+ }
8
+ >;
@@ -0,0 +1,46 @@
1
+ import { describe, it } from 'vitest';
2
+ import { DeciderSpecification } from '@event-driven-io/emmett';
3
+ import { decide } from './decide';
4
+ import { evolve } from './evolve';
5
+ import { initialState } from './state';
6
+
7
+ describe('Seasonal Assistant | accepts items and adds to their cart', () => {
8
+ const given = DeciderSpecification.for({
9
+ decide,
10
+ evolve,
11
+ initialState,
12
+ });
13
+
14
+ it('should emit ItemsAddedToCart for valid AddItemsToCart', () => {
15
+ given([])
16
+ .when({
17
+ type: 'AddItemsToCart',
18
+ data: {
19
+ sessionId: 'session-abc',
20
+ items: [
21
+ { productId: 'prod-soccer-ball', quantity: 1 },
22
+ { productId: 'prod-craft-kit', quantity: 1 },
23
+ { productId: 'prod-laptop-bag', quantity: 1 },
24
+ { productId: 'prod-mtg-starter', quantity: 1 },
25
+ ],
26
+ },
27
+ metadata: { now: new Date() },
28
+ })
29
+
30
+ .then([
31
+ {
32
+ type: 'ItemsAddedToCart',
33
+ data: {
34
+ sessionId: 'session-abc',
35
+ items: [
36
+ { productId: 'prod-soccer-ball', quantity: 1 },
37
+ { productId: 'prod-craft-kit', quantity: 1 },
38
+ { productId: 'prod-laptop-bag', quantity: 1 },
39
+ { productId: 'prod-mtg-starter', quantity: 1 },
40
+ ],
41
+ timestamp: new Date('2025-09-04T21:20:20.310Z'),
42
+ },
43
+ },
44
+ ]);
45
+ });
46
+ });
@@ -0,0 +1,33 @@
1
+ import { IllegalStateError } from '@event-driven-io/emmett';
2
+ import type { State } from './state';
3
+ import type { AddItemsToCart } from './commands';
4
+ import type { ItemsAddedToCart } from './events';
5
+
6
+ export const decide = (command: AddItemsToCart, state: State): ItemsAddedToCart => {
7
+ switch (command.type) {
8
+ case 'AddItemsToCart': {
9
+ /**
10
+ * ## IMPLEMENTATION INSTRUCTIONS ##
11
+ *
12
+ * This command can directly emit one or more events based on the input.
13
+ *
14
+ * You should:
15
+ * - Validate the command input fields
16
+ * - Inspect the current domain `state` to determine if the command is allowed
17
+ * - If invalid, throw one of the following domain errors: `NotFoundError`, `ValidationError`, or `IllegalStateError`
18
+ * - If valid, return one or more events with the correct structure
19
+ *
20
+ * ⚠️ Only read from inputs — never mutate them. `evolve.ts` handles state updates.
21
+ */
22
+
23
+ // return {
24
+ // type: 'ItemsAddedToCart',
25
+ // data: { ...command.data },
26
+ // } as ItemsAddedToCart;
27
+
28
+ throw new IllegalStateError('Not yet implemented: ' + command.type);
29
+ }
30
+ default:
31
+ throw new IllegalStateError('Unexpected command type: ' + command.type);
32
+ }
33
+ };
@@ -0,0 +1,10 @@
1
+ import type { Event } from '@event-driven-io/emmett';
2
+
3
+ export type ItemsAddedToCart = Event<
4
+ 'ItemsAddedToCart',
5
+ {
6
+ sessionId: string;
7
+ items: Array<{ productId: string; quantity: number }>;
8
+ timestamp: Date;
9
+ }
10
+ >;
@@ -0,0 +1,28 @@
1
+ import type { State } from './state';
2
+ import type { ItemsAddedToCart } from './events';
3
+
4
+ /**
5
+ * ## IMPLEMENTATION INSTRUCTIONS ##
6
+ *
7
+ * This function defines how the domain state evolves in response to events.
8
+ *
9
+ * Guidelines:
10
+ * - Apply only the **minimal** necessary changes for future decisions in `decide.ts`.
11
+ * - Ignore any event fields not required for decision-making logic.
12
+ * - If the event doesn’t change decision-relevant state, return the existing `state`.
13
+ * - Prefer immutability: always return a **new state object**.
14
+ * - Avoid spreading all of `event.data` unless all fields are relevant.
15
+ */
16
+
17
+ export const evolve = (state: State, event: ItemsAddedToCart): State => {
18
+ switch (event.type) {
19
+ case 'ItemsAddedToCart': {
20
+ // TODO: Update state based on ItemsAddedToCart
21
+ return {
22
+ ...state,
23
+ };
24
+ }
25
+ default:
26
+ return state;
27
+ }
28
+ };
@@ -0,0 +1,24 @@
1
+ import { CommandHandler, type EventStore, type MessageHandlerResult } from '@event-driven-io/emmett';
2
+ import { evolve } from './evolve';
3
+ import { initialState } from './state';
4
+ import { decide } from './decide';
5
+ import type { AddItemsToCart } from './commands';
6
+
7
+ const handler = CommandHandler({
8
+ evolve,
9
+ initialState,
10
+ });
11
+
12
+ export const handle = async (eventStore: EventStore, command: AddItemsToCart): Promise<MessageHandlerResult> => {
13
+ const streamId = `shopping-session-${command.data.sessionId}`;
14
+
15
+ try {
16
+ await handler(eventStore, streamId, (state) => decide(command, state));
17
+ return; // success (returns void)
18
+ } catch (error: any) {
19
+ return {
20
+ type: 'SKIP',
21
+ reason: `Command failed: ${error?.message ?? 'Unknown'}`,
22
+ };
23
+ }
24
+ };
@@ -0,0 +1,25 @@
1
+ import { Mutation, Resolver, Arg, Ctx, Field, InputType } from 'type-graphql';
2
+ import { type GraphQLContext, sendCommand, MutationResponse } from '../../../shared';
3
+
4
+ @InputType()
5
+ export class AddItemsToCartInput {
6
+ @Field(() => String)
7
+ sessionId!: string;
8
+ @Field(() => String)
9
+ items!: Array<{ productId: string; quantity: number }>;
10
+ }
11
+
12
+ @Resolver()
13
+ export class AddItemsToCartResolver {
14
+ @Mutation(() => MutationResponse)
15
+ async addItemsToCart(
16
+ @Arg('input', () => AddItemsToCartInput) input: AddItemsToCartInput,
17
+ @Ctx() ctx: GraphQLContext,
18
+ ): Promise<MutationResponse> {
19
+ return await sendCommand(ctx.messageBus, {
20
+ type: 'AddItemsToCart',
21
+ kind: 'Command',
22
+ data: { ...input },
23
+ });
24
+ }
25
+ }
@@ -0,0 +1,7 @@
1
+ import type { CommandProcessor, EventStore } from '@event-driven-io/emmett';
2
+ import { handle } from './handle';
3
+ import type { AddItemsToCart } from './commands';
4
+
5
+ export function register(messageBus: CommandProcessor, eventStore: EventStore) {
6
+ messageBus.handle((command: AddItemsToCart) => handle(eventStore, command), 'AddItemsToCart');
7
+ }
@@ -0,0 +1,47 @@
1
+ /**
2
+ * ## IMPLEMENTATION INSTRUCTIONS ##
3
+ *
4
+ * Define the shape of the domain state for the current slice below. This state is used by `decide.ts`
5
+ * to determine whether a command is valid.
6
+ *
7
+ * The state is evolved over time by applying domain events (in `evolve.ts`).
8
+ * Each event updates the state incrementally based on business rules.
9
+ *
10
+ * Guidelines:
11
+ * - Include only fields that are **read** during command validation.
12
+ * - Use discriminated unions (e.g., `status: 'Pending' | 'Done'`) to model state transitions.
13
+ * - Prefer primitive types: `string`, `boolean`, `number`.
14
+ * - Use objects or maps only when structure is essential for decision logic.
15
+ *
16
+ * Do NOT include:
17
+ * - Redundant data already emitted in events unless required to enforce business rules.
18
+ * - Fields used only for projections, UI, or query purposes.
19
+ *
20
+ * ### Example (for a Task domain):
21
+ *
22
+ * ```ts
23
+ * export type PendingTask = {
24
+ * status: 'Pending';
25
+ * };
26
+ *
27
+ * export type InProgressTask = {
28
+ * status: 'InProgress';
29
+ * startedAt: string;
30
+ * };
31
+ *
32
+ * export type CompletedTask = {
33
+ * status: 'Completed';
34
+ * completedAt: string;
35
+ * };
36
+ *
37
+ * export type State = PendingTask | InProgressTask | CompletedTask;
38
+ * ```
39
+ */
40
+
41
+ // TODO: Replace with a discriminated union of domain states for the current slice
42
+ export type State = {};
43
+
44
+ // TODO: Replace the Return with the initial domain state of the current slice
45
+ export const initialState = (): State => {
46
+ return {};
47
+ };
@@ -0,0 +1,51 @@
1
+ import { describe, it, beforeEach } from 'vitest';
2
+ import 'reflect-metadata';
3
+ import { getInMemoryEventStore, type InMemoryEventStore, type CommandSender } from '@event-driven-io/emmett';
4
+ import { type ReactorContext, ReactorSpecification } from '../../../shared';
5
+ import { react } from './react';
6
+ import type { ShoppingCriteriaEntered } from '../enters-shopping-criteria-into-assistant/events';
7
+ import type { SuggestShoppingItems } from '../selects-items-relevant-to-the-shopping-criteria/commands';
8
+
9
+ describe('SeasonalAssistant | CreatesAChatSession', () => {
10
+ let eventStore: InMemoryEventStore;
11
+ let given: ReactorSpecification<ShoppingCriteriaEntered, SuggestShoppingItems, ReactorContext>;
12
+ let messageBus: CommandSender;
13
+
14
+ beforeEach(() => {
15
+ eventStore = getInMemoryEventStore({});
16
+ given = ReactorSpecification.for<ShoppingCriteriaEntered, SuggestShoppingItems, ReactorContext>(
17
+ () => react({ eventStore, commandSender: messageBus }),
18
+ (commandSender) => {
19
+ messageBus = commandSender;
20
+ return {
21
+ eventStore,
22
+ commandSender,
23
+ database: eventStore.database,
24
+ };
25
+ },
26
+ );
27
+ });
28
+
29
+ it('should send SuggestShoppingItems when ShoppingCriteriaEntered is received', async () => {
30
+ await given([])
31
+ .when({
32
+ type: 'ShoppingCriteriaEntered',
33
+ data: {
34
+ sessionId: 'session-abc',
35
+ criteria:
36
+ 'I need back-to-school items for my 7-year-old daughter who loves soccer and crafts, and my 12-year-old son who is into computers and Magic the Gathering.',
37
+ timestamp: new Date('2025-09-04T21:20:20.309Z'),
38
+ },
39
+ })
40
+
41
+ .then({
42
+ type: 'SuggestShoppingItems',
43
+ kind: 'Command',
44
+ data: {
45
+ sessionId: 'session-abc',
46
+ prompt:
47
+ 'I need back-to-school items for my 7-year-old daughter who loves soccer and crafts, and my 12-year-old son who is into computers and Magic the Gathering.',
48
+ },
49
+ });
50
+ });
51
+ });
@@ -0,0 +1,43 @@
1
+ import { inMemoryReactor, type MessageHandlerResult, IllegalStateError } from '@event-driven-io/emmett';
2
+ import type { ShoppingCriteriaEntered } from '../enters-shopping-criteria-into-assistant/events';
3
+ import type { ReactorContext } from '../../../shared';
4
+
5
+ export const react = ({ eventStore, commandSender }: ReactorContext) =>
6
+ inMemoryReactor<ShoppingCriteriaEntered>({
7
+ processorId: 'seasonal-assistant-creates-a-chat-session',
8
+ canHandle: ['ShoppingCriteriaEntered'],
9
+ connectionOptions: {
10
+ database: eventStore.database,
11
+ },
12
+ eachMessage: async (event, context): Promise<MessageHandlerResult> => {
13
+ /**
14
+ * ## IMPLEMENTATION INSTRUCTIONS ##
15
+ *
16
+ * - Inspect event data to determine if the command should be sent.
17
+ * - Replace the placeholder logic and \`throw\` below with real implementation.
18
+ * - Send one or more commands via: context.commandSender.send({...})
19
+ * - Optionally return a MessageHandlerResult for SKIP or error cases.
20
+ */
21
+
22
+ throw new IllegalStateError('Not yet implemented: react in response to ShoppingCriteriaEntered');
23
+
24
+ // Example:
25
+ // if (event.data.status !== 'expected') {
26
+ // return {
27
+ // type: 'SKIP',
28
+ // reason: 'Condition not met',
29
+ // };
30
+ // }
31
+
32
+ // await context.commandSender.send({
33
+ // type: 'SuggestShoppingItems',
34
+ // kind: 'Command',
35
+ // data: {
36
+ // // Map event fields to command fields here
37
+ // // e.g., userId: event.data.userId,
38
+ // },
39
+ // });
40
+
41
+ // return;
42
+ },
43
+ });
@@ -0,0 +1,24 @@
1
+ import { type CommandSender, type EventSubscription, type InMemoryEventStore } from '@event-driven-io/emmett';
2
+ import type { ShoppingCriteriaEntered } from '../enters-shopping-criteria-into-assistant/events';
3
+
4
+ export async function register(messageBus: CommandSender & EventSubscription, eventStore: InMemoryEventStore) {
5
+ messageBus.subscribe(async (event: ShoppingCriteriaEntered) => {
6
+ /**
7
+ * ## IMPLEMENTATION INSTRUCTIONS ##
8
+ *
9
+ * - Replace the placeholder logic with the real implementation.
10
+ * - Send one or more commands via: messageBus.send({...})
11
+ */
12
+
13
+ // await messageBus.send({
14
+ // type: 'SuggestShoppingItems',
15
+ // kind: 'Command',
16
+ // data: {
17
+ // // Map event fields to command fields here
18
+ // // e.g., userId: event.data.userId,
19
+ // },
20
+ // });
21
+
22
+ return;
23
+ }, 'ShoppingCriteriaEntered');
24
+ }
@@ -0,0 +1,51 @@
1
+ import { describe, it, beforeEach } from 'vitest';
2
+ import 'reflect-metadata';
3
+ import { getInMemoryEventStore, type InMemoryEventStore, type CommandSender } from '@event-driven-io/emmett';
4
+ import { type ReactorContext, ReactorSpecification } from '../../../shared';
5
+ import { react } from './react';
6
+ import type { ShoppingCriteriaEntered } from '../enters-shopping-criteria-into-assistant/events';
7
+ import type { SuggestShoppingItems } from '../selects-items-relevant-to-the-shopping-criteria-/commands';
8
+
9
+ describe('SeasonalAssistant | CreatesAChatSession', () => {
10
+ let eventStore: InMemoryEventStore;
11
+ let given: ReactorSpecification<ShoppingCriteriaEntered, SuggestShoppingItems, ReactorContext>;
12
+ let messageBus: CommandSender;
13
+
14
+ beforeEach(() => {
15
+ eventStore = getInMemoryEventStore({});
16
+ given = ReactorSpecification.for<ShoppingCriteriaEntered, SuggestShoppingItems, ReactorContext>(
17
+ () => react({ eventStore, commandSender: messageBus }),
18
+ (commandSender) => {
19
+ messageBus = commandSender;
20
+ return {
21
+ eventStore,
22
+ commandSender,
23
+ database: eventStore.database,
24
+ };
25
+ },
26
+ );
27
+ });
28
+
29
+ it('should send SuggestShoppingItems when ShoppingCriteriaEntered is received', async () => {
30
+ await given([])
31
+ .when({
32
+ type: 'ShoppingCriteriaEntered',
33
+ data: {
34
+ sessionId: 'session-abc',
35
+ criteria:
36
+ 'I need back-to-school items for my 7-year-old daughter who loves soccer and crafts, and my 12-year-old son who is into computers and Magic the Gathering.',
37
+ timestamp: new Date('2025-09-04T20:53:48.700Z'),
38
+ },
39
+ })
40
+
41
+ .then({
42
+ type: 'SuggestShoppingItems',
43
+ kind: 'Command',
44
+ data: {
45
+ sessionId: 'session-abc',
46
+ prompt:
47
+ 'I need back-to-school items for my 7-year-old daughter who loves soccer and crafts, and my 12-year-old son who is into computers and Magic the Gathering.',
48
+ },
49
+ });
50
+ });
51
+ });
@@ -0,0 +1,43 @@
1
+ import { inMemoryReactor, type MessageHandlerResult, IllegalStateError } from '@event-driven-io/emmett';
2
+ import type { ShoppingCriteriaEntered } from '../enters-shopping-criteria-into-assistant/events';
3
+ import type { ReactorContext } from '../../../shared';
4
+
5
+ export const react = ({ eventStore, commandSender }: ReactorContext) =>
6
+ inMemoryReactor<ShoppingCriteriaEntered>({
7
+ processorId: 'seasonal-assistant-creates-a-chat-session-',
8
+ canHandle: ['ShoppingCriteriaEntered'],
9
+ connectionOptions: {
10
+ database: eventStore.database,
11
+ },
12
+ eachMessage: async (event, context): Promise<MessageHandlerResult> => {
13
+ /**
14
+ * ## IMPLEMENTATION INSTRUCTIONS ##
15
+ *
16
+ * - Inspect event data to determine if the command should be sent.
17
+ * - Replace the placeholder logic and \`throw\` below with real implementation.
18
+ * - Send one or more commands via: context.commandSender.send({...})
19
+ * - Optionally return a MessageHandlerResult for SKIP or error cases.
20
+ */
21
+
22
+ throw new IllegalStateError('Not yet implemented: react in response to ShoppingCriteriaEntered');
23
+
24
+ // Example:
25
+ // if (event.data.status !== 'expected') {
26
+ // return {
27
+ // type: 'SKIP',
28
+ // reason: 'Condition not met',
29
+ // };
30
+ // }
31
+
32
+ // await context.commandSender.send({
33
+ // type: 'SuggestShoppingItems',
34
+ // kind: 'Command',
35
+ // data: {
36
+ // // Map event fields to command fields here
37
+ // // e.g., userId: event.data.userId,
38
+ // },
39
+ // });
40
+
41
+ // return;
42
+ },
43
+ });
@@ -0,0 +1,24 @@
1
+ import { type CommandSender, type EventSubscription, type InMemoryEventStore } from '@event-driven-io/emmett';
2
+ import type { ShoppingCriteriaEntered } from '../enters-shopping-criteria-into-assistant/events';
3
+
4
+ export async function register(messageBus: CommandSender & EventSubscription, eventStore: InMemoryEventStore) {
5
+ messageBus.subscribe(async (event: ShoppingCriteriaEntered) => {
6
+ /**
7
+ * ## IMPLEMENTATION INSTRUCTIONS ##
8
+ *
9
+ * - Replace the placeholder logic with the real implementation.
10
+ * - Send one or more commands via: messageBus.send({...})
11
+ */
12
+
13
+ // await messageBus.send({
14
+ // type: 'SuggestShoppingItems',
15
+ // kind: 'Command',
16
+ // data: {
17
+ // // Map event fields to command fields here
18
+ // // e.g., userId: event.data.userId,
19
+ // },
20
+ // });
21
+
22
+ return;
23
+ }, 'ShoppingCriteriaEntered');
24
+ }
@@ -0,0 +1,8 @@
1
+ import { Command } from '@event-driven-io/emmett';
2
+ export type EnterShoppingCriteria = Command<
3
+ 'EnterShoppingCriteria',
4
+ {
5
+ sessionId: string;
6
+ criteria: string;
7
+ }
8
+ >;