create-auto-app 0.2.0 → 0.2.2

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 (289) hide show
  1. package/dist/index.js +7 -7
  2. package/dist/index.js.map +1 -1
  3. package/package.json +1 -1
  4. package/templates/shopping-app/auto.config.ts +6 -6
  5. package/templates/shopping-app/client/auto-configure.ts +1 -1
  6. package/templates/shopping-app/client/package.json +1 -1
  7. package/templates/shopping-app/example-integrations/ai-chat-completion/.turbo/turbo-build.log +4 -0
  8. package/templates/shopping-app/example-integrations/ai-chat-completion/.turbo/turbo-format.log +12 -0
  9. package/templates/shopping-app/example-integrations/ai-chat-completion/.turbo/turbo-lint.log +4 -0
  10. package/templates/shopping-app/example-integrations/ai-chat-completion/.turbo/turbo-test.log +12 -0
  11. package/templates/shopping-app/example-integrations/ai-chat-completion/.turbo/turbo-type-check.log +5 -0
  12. package/templates/shopping-app/example-integrations/ai-chat-completion/CHANGELOG.md +134 -0
  13. package/templates/shopping-app/example-integrations/ai-chat-completion/dist/ai-integration.d.ts +23 -0
  14. package/templates/shopping-app/example-integrations/ai-chat-completion/dist/ai-integration.d.ts.map +1 -0
  15. package/templates/shopping-app/example-integrations/ai-chat-completion/dist/ai-integration.js +41 -0
  16. package/templates/shopping-app/example-integrations/ai-chat-completion/dist/ai-integration.js.map +1 -0
  17. package/templates/shopping-app/example-integrations/ai-chat-completion/dist/index.d.ts +2 -0
  18. package/templates/shopping-app/example-integrations/ai-chat-completion/dist/index.d.ts.map +1 -0
  19. package/templates/shopping-app/example-integrations/ai-chat-completion/dist/index.js +2 -0
  20. package/templates/shopping-app/example-integrations/ai-chat-completion/dist/index.js.map +1 -0
  21. package/templates/shopping-app/example-integrations/ai-chat-completion/eslint.config.ts +12 -0
  22. package/templates/shopping-app/example-integrations/ai-chat-completion/node_modules/.bin/eslint +21 -0
  23. package/templates/shopping-app/example-integrations/ai-chat-completion/node_modules/.bin/jiti +21 -0
  24. package/templates/shopping-app/example-integrations/ai-chat-completion/node_modules/.bin/msw +21 -0
  25. package/templates/shopping-app/example-integrations/ai-chat-completion/node_modules/.bin/tsc +21 -0
  26. package/templates/shopping-app/example-integrations/ai-chat-completion/node_modules/.bin/tsserver +21 -0
  27. package/templates/shopping-app/example-integrations/ai-chat-completion/node_modules/.bin/vite +21 -0
  28. package/templates/shopping-app/example-integrations/ai-chat-completion/node_modules/.bin/vitest +21 -0
  29. package/templates/shopping-app/example-integrations/ai-chat-completion/package.json +29 -0
  30. package/templates/shopping-app/example-integrations/ai-chat-completion/src/ai-integration.ts +76 -0
  31. package/templates/shopping-app/example-integrations/ai-chat-completion/src/index.ts +1 -0
  32. package/templates/shopping-app/example-integrations/ai-chat-completion/tsconfig.json +10 -0
  33. package/templates/shopping-app/example-integrations/ai-chat-completion/tsconfig.test.json +7 -0
  34. package/templates/shopping-app/example-integrations/cart/.turbo/turbo-build.log +4 -0
  35. package/templates/shopping-app/example-integrations/cart/.turbo/turbo-format.log +12 -0
  36. package/templates/shopping-app/example-integrations/cart/.turbo/turbo-lint.log +5 -0
  37. package/templates/shopping-app/example-integrations/cart/.turbo/turbo-test.log +12 -0
  38. package/templates/shopping-app/example-integrations/cart/.turbo/turbo-type-check.log +5 -0
  39. package/templates/shopping-app/example-integrations/cart/CHANGELOG.md +124 -0
  40. package/templates/shopping-app/example-integrations/cart/dist/cart-integration.d.ts +30 -0
  41. package/templates/shopping-app/example-integrations/cart/dist/cart-integration.d.ts.map +1 -0
  42. package/templates/shopping-app/example-integrations/cart/dist/cart-integration.js +134 -0
  43. package/templates/shopping-app/example-integrations/cart/dist/cart-integration.js.map +1 -0
  44. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/client.gen.d.ts +3 -0
  45. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/client.gen.d.ts.map +1 -0
  46. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/client.gen.js +149 -0
  47. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/client.gen.js.map +1 -0
  48. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/index.d.ts +8 -0
  49. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/index.d.ts.map +1 -0
  50. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/index.js +6 -0
  51. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/index.js.map +1 -0
  52. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/types.gen.d.ts +123 -0
  53. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/types.gen.d.ts.map +1 -0
  54. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/types.gen.js +3 -0
  55. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/types.gen.js.map +1 -0
  56. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/utils.gen.d.ts +46 -0
  57. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/utils.gen.d.ts.map +1 -0
  58. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/utils.gen.js +285 -0
  59. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/utils.gen.js.map +1 -0
  60. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client.gen.d.ts +13 -0
  61. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client.gen.d.ts.map +1 -0
  62. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client.gen.js +6 -0
  63. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client.gen.js.map +1 -0
  64. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/auth.gen.d.ts +19 -0
  65. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/auth.gen.d.ts.map +1 -0
  66. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/auth.gen.js +15 -0
  67. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/auth.gen.js.map +1 -0
  68. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/bodySerializer.gen.d.ts +18 -0
  69. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/bodySerializer.gen.d.ts.map +1 -0
  70. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/bodySerializer.gen.js +58 -0
  71. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/bodySerializer.gen.js.map +1 -0
  72. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/params.gen.d.ts +34 -0
  73. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/params.gen.d.ts.map +1 -0
  74. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/params.gen.js +89 -0
  75. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/params.gen.js.map +1 -0
  76. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/pathSerializer.gen.d.ts +34 -0
  77. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/pathSerializer.gen.d.ts.map +1 -0
  78. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/pathSerializer.gen.js +115 -0
  79. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/pathSerializer.gen.js.map +1 -0
  80. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/types.gen.d.ts +79 -0
  81. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/types.gen.d.ts.map +1 -0
  82. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/types.gen.js +3 -0
  83. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/types.gen.js.map +1 -0
  84. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/index.d.ts +2 -0
  85. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/index.d.ts.map +1 -0
  86. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/index.js +3 -0
  87. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/index.js.map +1 -0
  88. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/types.gen.d.ts +158 -0
  89. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/types.gen.d.ts.map +1 -0
  90. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/types.gen.js +3 -0
  91. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/types.gen.js.map +1 -0
  92. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/zod.gen.d.ts +382 -0
  93. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/zod.gen.d.ts.map +1 -0
  94. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/zod.gen.js +68 -0
  95. package/templates/shopping-app/example-integrations/cart/dist/generated/cart/zod.gen.js.map +1 -0
  96. package/templates/shopping-app/example-integrations/cart/dist/index.d.ts +2 -0
  97. package/templates/shopping-app/example-integrations/cart/dist/index.d.ts.map +1 -0
  98. package/templates/shopping-app/example-integrations/cart/dist/index.js +2 -0
  99. package/templates/shopping-app/example-integrations/cart/dist/index.js.map +1 -0
  100. package/templates/shopping-app/example-integrations/cart/eslint.config.ts +12 -0
  101. package/templates/shopping-app/example-integrations/cart/node_modules/.bin/eslint +21 -0
  102. package/templates/shopping-app/example-integrations/cart/node_modules/.bin/jiti +21 -0
  103. package/templates/shopping-app/example-integrations/cart/node_modules/.bin/msw +21 -0
  104. package/templates/shopping-app/example-integrations/cart/node_modules/.bin/tsc +21 -0
  105. package/templates/shopping-app/example-integrations/cart/node_modules/.bin/tsserver +21 -0
  106. package/templates/shopping-app/example-integrations/cart/node_modules/.bin/vitest +21 -0
  107. package/templates/shopping-app/example-integrations/cart/package.json +31 -0
  108. package/templates/shopping-app/example-integrations/cart/src/cart-integration.ts +198 -0
  109. package/templates/shopping-app/example-integrations/cart/src/generated/cart/client/client.gen.ts +199 -0
  110. package/templates/shopping-app/example-integrations/cart/src/generated/cart/client/index.ts +25 -0
  111. package/templates/shopping-app/example-integrations/cart/src/generated/cart/client/types.gen.ts +232 -0
  112. package/templates/shopping-app/example-integrations/cart/src/generated/cart/client/utils.gen.ts +419 -0
  113. package/templates/shopping-app/example-integrations/cart/src/generated/cart/client.gen.ts +18 -0
  114. package/templates/shopping-app/example-integrations/cart/src/generated/cart/core/auth.gen.ts +42 -0
  115. package/templates/shopping-app/example-integrations/cart/src/generated/cart/core/bodySerializer.gen.ts +92 -0
  116. package/templates/shopping-app/example-integrations/cart/src/generated/cart/core/params.gen.ts +153 -0
  117. package/templates/shopping-app/example-integrations/cart/src/generated/cart/core/pathSerializer.gen.ts +181 -0
  118. package/templates/shopping-app/example-integrations/cart/src/generated/cart/core/types.gen.ts +120 -0
  119. package/templates/shopping-app/example-integrations/cart/src/generated/cart/index.ts +2 -0
  120. package/templates/shopping-app/example-integrations/cart/src/generated/cart/types.gen.ts +175 -0
  121. package/templates/shopping-app/example-integrations/cart/src/generated/cart/zod.gen.ts +78 -0
  122. package/templates/shopping-app/example-integrations/cart/src/index.ts +1 -0
  123. package/templates/shopping-app/example-integrations/cart/tsconfig.json +10 -0
  124. package/templates/shopping-app/example-integrations/cart/tsconfig.test.json +7 -0
  125. package/templates/shopping-app/example-integrations/cart-api/.turbo/turbo-build.log +4 -0
  126. package/templates/shopping-app/example-integrations/cart-api/.turbo/turbo-format.log +10 -0
  127. package/templates/shopping-app/example-integrations/cart-api/.turbo/turbo-lint.log +4 -0
  128. package/templates/shopping-app/example-integrations/cart-api/.turbo/turbo-test.log +12 -0
  129. package/templates/shopping-app/example-integrations/cart-api/.turbo/turbo-type-check.log +4 -0
  130. package/templates/shopping-app/example-integrations/cart-api/dist/data/cart.d.ts +18 -0
  131. package/templates/shopping-app/example-integrations/cart-api/dist/data/cart.d.ts.map +1 -0
  132. package/templates/shopping-app/example-integrations/cart-api/dist/data/cart.js +28 -0
  133. package/templates/shopping-app/example-integrations/cart-api/dist/data/cart.js.map +1 -0
  134. package/templates/shopping-app/example-integrations/cart-api/dist/index.d.ts +4 -0
  135. package/templates/shopping-app/example-integrations/cart-api/dist/index.d.ts.map +1 -0
  136. package/templates/shopping-app/example-integrations/cart-api/dist/index.js +49 -0
  137. package/templates/shopping-app/example-integrations/cart-api/dist/index.js.map +1 -0
  138. package/templates/shopping-app/example-integrations/cart-api/dist/routes/cart.d.ts +4 -0
  139. package/templates/shopping-app/example-integrations/cart-api/dist/routes/cart.d.ts.map +1 -0
  140. package/templates/shopping-app/example-integrations/cart-api/dist/routes/cart.js +261 -0
  141. package/templates/shopping-app/example-integrations/cart-api/dist/routes/cart.js.map +1 -0
  142. package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/nodemon +21 -0
  143. package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/swagger-jsdoc +21 -0
  144. package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/ts-node +21 -0
  145. package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/ts-node-cwd +21 -0
  146. package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/ts-node-esm +21 -0
  147. package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/ts-node-script +21 -0
  148. package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/ts-node-transpile-only +21 -0
  149. package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/ts-script +21 -0
  150. package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/tsc +21 -0
  151. package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/tsserver +21 -0
  152. package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/tsx +21 -0
  153. package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/vitest +21 -0
  154. package/templates/shopping-app/example-integrations/cart-api/package.json +49 -0
  155. package/templates/shopping-app/example-integrations/cart-api/src/data/cart.ts +45 -0
  156. package/templates/shopping-app/example-integrations/cart-api/src/index.ts +59 -0
  157. package/templates/shopping-app/example-integrations/cart-api/src/routes/cart.ts +289 -0
  158. package/templates/shopping-app/example-integrations/cart-api/tsconfig.json +9 -0
  159. package/templates/shopping-app/example-integrations/product-catalogue/.turbo/turbo-build.log +4 -0
  160. package/templates/shopping-app/example-integrations/product-catalogue/.turbo/turbo-format.log +12 -0
  161. package/templates/shopping-app/example-integrations/product-catalogue/.turbo/turbo-lint.log +5 -0
  162. package/templates/shopping-app/example-integrations/product-catalogue/.turbo/turbo-test.log +12 -0
  163. package/templates/shopping-app/example-integrations/product-catalogue/.turbo/turbo-type-check.log +5 -0
  164. package/templates/shopping-app/example-integrations/product-catalogue/CHANGELOG.md +124 -0
  165. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/client.gen.d.ts +3 -0
  166. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/client.gen.d.ts.map +1 -0
  167. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/client.gen.js +149 -0
  168. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/client.gen.js.map +1 -0
  169. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/index.d.ts +8 -0
  170. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/index.d.ts.map +1 -0
  171. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/index.js +6 -0
  172. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/index.js.map +1 -0
  173. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/types.gen.d.ts +123 -0
  174. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/types.gen.d.ts.map +1 -0
  175. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/types.gen.js +3 -0
  176. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/types.gen.js.map +1 -0
  177. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/utils.gen.d.ts +46 -0
  178. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/utils.gen.d.ts.map +1 -0
  179. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/utils.gen.js +285 -0
  180. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/utils.gen.js.map +1 -0
  181. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client.gen.d.ts +13 -0
  182. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client.gen.d.ts.map +1 -0
  183. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client.gen.js +6 -0
  184. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client.gen.js.map +1 -0
  185. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/auth.gen.d.ts +19 -0
  186. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/auth.gen.d.ts.map +1 -0
  187. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/auth.gen.js +15 -0
  188. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/auth.gen.js.map +1 -0
  189. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/bodySerializer.gen.d.ts +18 -0
  190. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/bodySerializer.gen.d.ts.map +1 -0
  191. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/bodySerializer.gen.js +58 -0
  192. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/bodySerializer.gen.js.map +1 -0
  193. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/params.gen.d.ts +34 -0
  194. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/params.gen.d.ts.map +1 -0
  195. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/params.gen.js +89 -0
  196. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/params.gen.js.map +1 -0
  197. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/pathSerializer.gen.d.ts +34 -0
  198. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/pathSerializer.gen.d.ts.map +1 -0
  199. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/pathSerializer.gen.js +115 -0
  200. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/pathSerializer.gen.js.map +1 -0
  201. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/types.gen.d.ts +79 -0
  202. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/types.gen.d.ts.map +1 -0
  203. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/types.gen.js +3 -0
  204. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/types.gen.js.map +1 -0
  205. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/index.d.ts +2 -0
  206. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/index.d.ts.map +1 -0
  207. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/index.js +3 -0
  208. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/index.js.map +1 -0
  209. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/types.gen.d.ts +115 -0
  210. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/types.gen.d.ts.map +1 -0
  211. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/types.gen.js +3 -0
  212. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/types.gen.js.map +1 -0
  213. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/zod.gen.d.ts +206 -0
  214. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/zod.gen.d.ts.map +1 -0
  215. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/zod.gen.js +53 -0
  216. package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/zod.gen.js.map +1 -0
  217. package/templates/shopping-app/example-integrations/product-catalogue/dist/index.d.ts +2 -0
  218. package/templates/shopping-app/example-integrations/product-catalogue/dist/index.d.ts.map +1 -0
  219. package/templates/shopping-app/example-integrations/product-catalogue/dist/index.js +2 -0
  220. package/templates/shopping-app/example-integrations/product-catalogue/dist/index.js.map +1 -0
  221. package/templates/shopping-app/example-integrations/product-catalogue/dist/product-catalogue-integration.d.ts +32 -0
  222. package/templates/shopping-app/example-integrations/product-catalogue/dist/product-catalogue-integration.d.ts.map +1 -0
  223. package/templates/shopping-app/example-integrations/product-catalogue/dist/product-catalogue-integration.js +163 -0
  224. package/templates/shopping-app/example-integrations/product-catalogue/dist/product-catalogue-integration.js.map +1 -0
  225. package/templates/shopping-app/example-integrations/product-catalogue/eslint.config.ts +12 -0
  226. package/templates/shopping-app/example-integrations/product-catalogue/node_modules/.bin/eslint +21 -0
  227. package/templates/shopping-app/example-integrations/product-catalogue/node_modules/.bin/jiti +21 -0
  228. package/templates/shopping-app/example-integrations/product-catalogue/node_modules/.bin/msw +21 -0
  229. package/templates/shopping-app/example-integrations/product-catalogue/node_modules/.bin/tsc +21 -0
  230. package/templates/shopping-app/example-integrations/product-catalogue/node_modules/.bin/tsserver +21 -0
  231. package/templates/shopping-app/example-integrations/product-catalogue/node_modules/.bin/vitest +21 -0
  232. package/templates/shopping-app/example-integrations/product-catalogue/package.json +31 -0
  233. package/templates/shopping-app/example-integrations/product-catalogue/src/generated/product-catalog/client/client.gen.ts +199 -0
  234. package/templates/shopping-app/example-integrations/product-catalogue/src/generated/product-catalog/client/index.ts +25 -0
  235. package/templates/shopping-app/example-integrations/product-catalogue/src/generated/product-catalog/client/types.gen.ts +232 -0
  236. package/templates/shopping-app/example-integrations/product-catalogue/src/generated/product-catalog/client/utils.gen.ts +419 -0
  237. package/templates/shopping-app/example-integrations/product-catalogue/src/generated/product-catalog/client.gen.ts +18 -0
  238. package/templates/shopping-app/example-integrations/product-catalogue/src/generated/product-catalog/core/auth.gen.ts +42 -0
  239. package/templates/shopping-app/example-integrations/product-catalogue/src/generated/product-catalog/core/bodySerializer.gen.ts +92 -0
  240. package/templates/shopping-app/example-integrations/product-catalogue/src/generated/product-catalog/core/params.gen.ts +153 -0
  241. package/templates/shopping-app/example-integrations/product-catalogue/src/generated/product-catalog/core/pathSerializer.gen.ts +181 -0
  242. package/templates/shopping-app/example-integrations/product-catalogue/src/generated/product-catalog/core/types.gen.ts +120 -0
  243. package/templates/shopping-app/example-integrations/product-catalogue/src/generated/product-catalog/index.ts +2 -0
  244. package/templates/shopping-app/example-integrations/product-catalogue/src/generated/product-catalog/types.gen.ts +133 -0
  245. package/templates/shopping-app/example-integrations/product-catalogue/src/generated/product-catalog/zod.gen.ts +62 -0
  246. package/templates/shopping-app/example-integrations/product-catalogue/src/index.ts +1 -0
  247. package/templates/shopping-app/example-integrations/product-catalogue/src/product-catalogue-integration.ts +225 -0
  248. package/templates/shopping-app/example-integrations/product-catalogue/tsconfig.json +10 -0
  249. package/templates/shopping-app/example-integrations/product-catalogue/tsconfig.test.json +7 -0
  250. package/templates/shopping-app/example-integrations/product-catalogue-api/.turbo/turbo-build.log +4 -0
  251. package/templates/shopping-app/example-integrations/product-catalogue-api/.turbo/turbo-format.log +10 -0
  252. package/templates/shopping-app/example-integrations/product-catalogue-api/.turbo/turbo-lint.log +5 -0
  253. package/templates/shopping-app/example-integrations/product-catalogue-api/.turbo/turbo-test.log +13 -0
  254. package/templates/shopping-app/example-integrations/product-catalogue-api/.turbo/turbo-type-check.log +5 -0
  255. package/templates/shopping-app/example-integrations/product-catalogue-api/dist/data/products.d.ts +10 -0
  256. package/templates/shopping-app/example-integrations/product-catalogue-api/dist/data/products.d.ts.map +1 -0
  257. package/templates/shopping-app/example-integrations/product-catalogue-api/dist/data/products.js +75 -0
  258. package/templates/shopping-app/example-integrations/product-catalogue-api/dist/data/products.js.map +1 -0
  259. package/templates/shopping-app/example-integrations/product-catalogue-api/dist/index.d.ts +4 -0
  260. package/templates/shopping-app/example-integrations/product-catalogue-api/dist/index.d.ts.map +1 -0
  261. package/templates/shopping-app/example-integrations/product-catalogue-api/dist/index.js +49 -0
  262. package/templates/shopping-app/example-integrations/product-catalogue-api/dist/index.js.map +1 -0
  263. package/templates/shopping-app/example-integrations/product-catalogue-api/dist/routes/products.d.ts +4 -0
  264. package/templates/shopping-app/example-integrations/product-catalogue-api/dist/routes/products.d.ts.map +1 -0
  265. package/templates/shopping-app/example-integrations/product-catalogue-api/dist/routes/products.js +170 -0
  266. package/templates/shopping-app/example-integrations/product-catalogue-api/dist/routes/products.js.map +1 -0
  267. package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/nodemon +21 -0
  268. package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/swagger-jsdoc +21 -0
  269. package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/ts-node +21 -0
  270. package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/ts-node-cwd +21 -0
  271. package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/ts-node-esm +21 -0
  272. package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/ts-node-script +21 -0
  273. package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/ts-node-transpile-only +21 -0
  274. package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/ts-script +21 -0
  275. package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/tsc +21 -0
  276. package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/tsserver +21 -0
  277. package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/tsx +21 -0
  278. package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/vitest +21 -0
  279. package/templates/shopping-app/example-integrations/product-catalogue-api/package.json +51 -0
  280. package/templates/shopping-app/example-integrations/product-catalogue-api/src/data/products.ts +90 -0
  281. package/templates/shopping-app/example-integrations/product-catalogue-api/src/index.ts +59 -0
  282. package/templates/shopping-app/example-integrations/product-catalogue-api/src/routes/products.ts +181 -0
  283. package/templates/shopping-app/example-integrations/product-catalogue-api/tsconfig.json +9 -0
  284. package/templates/shopping-app/flows/shopping-assistant.flow.ts +1 -3
  285. package/templates/shopping-app/package.json +10 -6
  286. package/templates/shopping-app/server/package.json +1 -1
  287. package/templates/shopping-app/server/src/integrations/ai-integration.ts +1 -1
  288. package/templates/shopping-app/server/src/integrations/cart-integration.ts +1 -1
  289. package/templates/shopping-app/server/src/integrations/product-catalogue-integration.ts +1 -1
@@ -0,0 +1,198 @@
1
+ import type { State, Integration } from '@auto-engineer/flow';
2
+ import { registerTool, z } from '@auto-engineer/ai-gateway';
3
+
4
+ import { createClient as createCartClient } from './generated/cart/client';
5
+ import type {
6
+ CartSession,
7
+ GetApiCartBySessionIdResponses,
8
+ PostApiCartBySessionIdAddResponses,
9
+ PostApiCartBySessionIdAddErrors,
10
+ PostApiCartBySessionIdRemoveResponses,
11
+ PostApiCartBySessionIdRemoveErrors,
12
+ PostApiCartBySessionIdClearResponses,
13
+ } from './generated/cart';
14
+ import {
15
+ zGetApiCartBySessionIdResponse,
16
+ zPostApiCartBySessionIdAddResponse,
17
+ zPostApiCartBySessionIdRemoveResponse,
18
+ zPostApiCartBySessionIdClearResponse,
19
+ } from './generated/cart/zod.gen';
20
+
21
+ // ---------- State ----------
22
+ export type CartState = State<'Cart', { cart: CartSession }>;
23
+
24
+ // ---------- Client ----------
25
+ const cartClient = createCartClient({ baseUrl: 'http://localhost:3002' });
26
+
27
+ // ---------- Integration facade ----------
28
+ type CartQueries = {
29
+ GetCart: (p: { sessionId: string }) => Promise<CartState>;
30
+ };
31
+ type CartCommands = {
32
+ AddItem: (p: {
33
+ sessionId: string;
34
+ productId: string;
35
+ name: string;
36
+ price: number;
37
+ quantity: number;
38
+ }) => Promise<CartState>;
39
+ RemoveItem: (p: { sessionId: string; productId: string; quantity: number }) => Promise<CartState>;
40
+ Clear: (p: { sessionId: string }) => Promise<CartState>;
41
+ };
42
+
43
+ export const Cart: Integration<'cart', CartQueries, CartCommands> = {
44
+ __brand: 'Integration' as const,
45
+ type: 'cart',
46
+ name: 'cart',
47
+
48
+ Queries: {
49
+ // GET /api/cart/{sessionId}
50
+ GetCart: async ({ sessionId }) => {
51
+ const res = await cartClient.get<GetApiCartBySessionIdResponses, unknown, false>({
52
+ url: '/api/cart/{sessionId}',
53
+ path: { sessionId },
54
+ });
55
+ if (res.error !== undefined) {
56
+ console.error(`GetCart error for "${sessionId}":`, res.error);
57
+ const now = new Date().toISOString();
58
+ return { type: 'Cart', data: { cart: { sessionId, items: [], total: 0, createdAt: now, updatedAt: now } } };
59
+ }
60
+ return { type: 'Cart', data: { cart: res.data! } };
61
+ },
62
+ },
63
+
64
+ Commands: {
65
+ // POST /api/cart/{sessionId}/add
66
+ AddItem: async ({ sessionId, productId, name, price, quantity }) => {
67
+ const res = await cartClient.post<PostApiCartBySessionIdAddResponses, PostApiCartBySessionIdAddErrors, false>({
68
+ url: '/api/cart/{sessionId}/add',
69
+ path: { sessionId },
70
+ body: { productId, name, price, quantity },
71
+ });
72
+ if (res.error !== undefined) {
73
+ console.error(`AddItem error for "${sessionId}":`, res.error);
74
+ // fall back to current cart
75
+ const fallback = await cartClient.get<GetApiCartBySessionIdResponses, unknown, false>({
76
+ url: '/api/cart/{sessionId}',
77
+ path: { sessionId },
78
+ });
79
+ return { type: 'Cart', data: { cart: fallback.data! } };
80
+ }
81
+ return { type: 'Cart', data: { cart: res.data! } };
82
+ },
83
+
84
+ // POST /api/cart/{sessionId}/remove
85
+ RemoveItem: async ({ sessionId, productId, quantity }) => {
86
+ const res = await cartClient.post<
87
+ PostApiCartBySessionIdRemoveResponses,
88
+ PostApiCartBySessionIdRemoveErrors,
89
+ false
90
+ >({
91
+ url: '/api/cart/{sessionId}/remove',
92
+ path: { sessionId },
93
+ body: { productId, quantity },
94
+ });
95
+ if (res.error !== undefined) {
96
+ console.error(`RemoveItem error for "${sessionId}":`, res.error);
97
+ const fallback = await cartClient.get<GetApiCartBySessionIdResponses, unknown, false>({
98
+ url: '/api/cart/{sessionId}',
99
+ path: { sessionId },
100
+ });
101
+ return { type: 'Cart', data: { cart: fallback.data! } };
102
+ }
103
+ return { type: 'Cart', data: { cart: res.data! } };
104
+ },
105
+
106
+ // POST /api/cart/{sessionId}/clear
107
+ Clear: async ({ sessionId }) => {
108
+ const res = await cartClient.post<PostApiCartBySessionIdClearResponses, unknown, false>({
109
+ url: '/api/cart/{sessionId}/clear',
110
+ path: { sessionId },
111
+ });
112
+ if (res.error !== undefined) {
113
+ console.error(`Clear error for "${sessionId}":`, res.error);
114
+ const fallback = await cartClient.get<GetApiCartBySessionIdResponses, unknown, false>({
115
+ url: '/api/cart/{sessionId}',
116
+ path: { sessionId },
117
+ });
118
+ return { type: 'Cart', data: { cart: fallback.data! } };
119
+ }
120
+ return { type: 'Cart', data: { cart: res.data! } };
121
+ },
122
+ },
123
+ };
124
+
125
+ // ---------- MCP tools ----------
126
+ registerTool<{ sessionId: string }>(
127
+ 'CART_GET',
128
+ {
129
+ title: 'Get Cart',
130
+ description: 'Fetch a cart session by ID',
131
+ inputSchema: { sessionId: z.string().min(1) },
132
+ schema: zGetApiCartBySessionIdResponse,
133
+ schemaName: 'CartSession',
134
+ schemaDescription: 'Cart session details',
135
+ },
136
+ async ({ sessionId }) => {
137
+ const res = await Cart.Queries!.GetCart({ sessionId });
138
+ return { content: [{ type: 'text' as const, text: JSON.stringify(res.data.cart, null, 2) }] };
139
+ },
140
+ );
141
+
142
+ registerTool<{ sessionId: string; productId: string; name: string; price: number; quantity: number }>(
143
+ 'CART_ADD',
144
+ {
145
+ title: 'Add Item to Cart',
146
+ description: 'Add an item to the cart',
147
+ inputSchema: {
148
+ sessionId: z.string().min(1),
149
+ productId: z.string().min(1),
150
+ name: z.string().min(1),
151
+ price: z.number(),
152
+ quantity: z.number().int().positive(),
153
+ },
154
+ schema: zPostApiCartBySessionIdAddResponse,
155
+ schemaName: 'CartSession',
156
+ schemaDescription: 'Updated cart',
157
+ },
158
+ async (args) => {
159
+ const res = await Cart.Commands!.AddItem(args);
160
+ return { content: [{ type: 'text' as const, text: JSON.stringify(res.data.cart, null, 2) }] };
161
+ },
162
+ );
163
+
164
+ registerTool<{ sessionId: string; productId: string; quantity: number }>(
165
+ 'CART_REMOVE',
166
+ {
167
+ title: 'Remove Item from Cart',
168
+ description: 'Remove or decrement an item in the cart',
169
+ inputSchema: {
170
+ sessionId: z.string().min(1),
171
+ productId: z.string().min(1),
172
+ quantity: z.number().int().positive(),
173
+ },
174
+ schema: zPostApiCartBySessionIdRemoveResponse,
175
+ schemaName: 'CartSession',
176
+ schemaDescription: 'Updated cart',
177
+ },
178
+ async (args) => {
179
+ const res = await Cart.Commands!.RemoveItem(args);
180
+ return { content: [{ type: 'text' as const, text: JSON.stringify(res.data.cart, null, 2) }] };
181
+ },
182
+ );
183
+
184
+ registerTool<{ sessionId: string }>(
185
+ 'CART_CLEAR',
186
+ {
187
+ title: 'Clear Cart',
188
+ description: 'Remove all items from the cart',
189
+ inputSchema: { sessionId: z.string().min(1) },
190
+ schema: zPostApiCartBySessionIdClearResponse,
191
+ schemaName: 'CartSession',
192
+ schemaDescription: 'Updated cart',
193
+ },
194
+ async ({ sessionId }) => {
195
+ const res = await Cart.Commands!.Clear({ sessionId });
196
+ return { content: [{ type: 'text' as const, text: JSON.stringify(res.data.cart, null, 2) }] };
197
+ },
198
+ );
@@ -0,0 +1,199 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+
3
+ import type { Client, Config, ResolvedRequestOptions } from './types.gen';
4
+ import {
5
+ buildUrl,
6
+ createConfig,
7
+ createInterceptors,
8
+ getParseAs,
9
+ mergeConfigs,
10
+ mergeHeaders,
11
+ setAuthParams,
12
+ } from './utils.gen';
13
+
14
+ type ReqInit = Omit<RequestInit, 'body' | 'headers'> & {
15
+ body?: any;
16
+ headers: ReturnType<typeof mergeHeaders>;
17
+ };
18
+
19
+ export const createClient = (config: Config = {}): Client => {
20
+ let _config = mergeConfigs(createConfig(), config);
21
+
22
+ const getConfig = (): Config => ({ ..._config });
23
+
24
+ const setConfig = (config: Config): Config => {
25
+ _config = mergeConfigs(_config, config);
26
+ return getConfig();
27
+ };
28
+
29
+ const interceptors = createInterceptors<
30
+ Request,
31
+ Response,
32
+ unknown,
33
+ ResolvedRequestOptions
34
+ >();
35
+
36
+ const request: Client['request'] = async (options) => {
37
+ const opts = {
38
+ ..._config,
39
+ ...options,
40
+ fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
41
+ headers: mergeHeaders(_config.headers, options.headers),
42
+ serializedBody: undefined,
43
+ };
44
+
45
+ if (opts.security) {
46
+ await setAuthParams({
47
+ ...opts,
48
+ security: opts.security,
49
+ });
50
+ }
51
+
52
+ if (opts.requestValidator) {
53
+ await opts.requestValidator(opts);
54
+ }
55
+
56
+ if (opts.body && opts.bodySerializer) {
57
+ opts.serializedBody = opts.bodySerializer(opts.body);
58
+ }
59
+
60
+ // remove Content-Type header if body is empty to avoid sending invalid requests
61
+ if (opts.serializedBody === undefined || opts.serializedBody === '') {
62
+ opts.headers.delete('Content-Type');
63
+ }
64
+
65
+ const url = buildUrl(opts);
66
+ const requestInit: ReqInit = {
67
+ redirect: 'follow',
68
+ ...opts,
69
+ body: opts.serializedBody,
70
+ };
71
+
72
+ let request = new Request(url, requestInit);
73
+
74
+ for (const fn of interceptors.request._fns) {
75
+ if (fn) {
76
+ request = await fn(request, opts);
77
+ }
78
+ }
79
+
80
+ // fetch must be assigned here, otherwise it would throw the error:
81
+ // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
82
+ const _fetch = opts.fetch!;
83
+ let response = await _fetch(request);
84
+
85
+ for (const fn of interceptors.response._fns) {
86
+ if (fn) {
87
+ response = await fn(response, request, opts);
88
+ }
89
+ }
90
+
91
+ const result = {
92
+ request,
93
+ response,
94
+ };
95
+
96
+ if (response.ok) {
97
+ if (
98
+ response.status === 204 ||
99
+ response.headers.get('Content-Length') === '0'
100
+ ) {
101
+ return opts.responseStyle === 'data'
102
+ ? {}
103
+ : {
104
+ data: {},
105
+ ...result,
106
+ };
107
+ }
108
+
109
+ const parseAs =
110
+ (opts.parseAs === 'auto'
111
+ ? getParseAs(response.headers.get('Content-Type'))
112
+ : opts.parseAs) ?? 'json';
113
+
114
+ let data: any;
115
+ switch (parseAs) {
116
+ case 'arrayBuffer':
117
+ case 'blob':
118
+ case 'formData':
119
+ case 'json':
120
+ case 'text':
121
+ data = await response[parseAs]();
122
+ break;
123
+ case 'stream':
124
+ return opts.responseStyle === 'data'
125
+ ? response.body
126
+ : {
127
+ data: response.body,
128
+ ...result,
129
+ };
130
+ }
131
+
132
+ if (parseAs === 'json') {
133
+ if (opts.responseValidator) {
134
+ await opts.responseValidator(data);
135
+ }
136
+
137
+ if (opts.responseTransformer) {
138
+ data = await opts.responseTransformer(data);
139
+ }
140
+ }
141
+
142
+ return opts.responseStyle === 'data'
143
+ ? data
144
+ : {
145
+ data,
146
+ ...result,
147
+ };
148
+ }
149
+
150
+ const textError = await response.text();
151
+ let jsonError: unknown;
152
+
153
+ try {
154
+ jsonError = JSON.parse(textError);
155
+ } catch {
156
+ // noop
157
+ }
158
+
159
+ const error = jsonError ?? textError;
160
+ let finalError = error;
161
+
162
+ for (const fn of interceptors.error._fns) {
163
+ if (fn) {
164
+ finalError = (await fn(error, response, request, opts)) as string;
165
+ }
166
+ }
167
+
168
+ finalError = finalError || ({} as string);
169
+
170
+ if (opts.throwOnError) {
171
+ throw finalError;
172
+ }
173
+
174
+ // TODO: we probably want to return error and improve types
175
+ return opts.responseStyle === 'data'
176
+ ? undefined
177
+ : {
178
+ error: finalError,
179
+ ...result,
180
+ };
181
+ };
182
+
183
+ return {
184
+ buildUrl,
185
+ connect: (options) => request({ ...options, method: 'CONNECT' }),
186
+ delete: (options) => request({ ...options, method: 'DELETE' }),
187
+ get: (options) => request({ ...options, method: 'GET' }),
188
+ getConfig,
189
+ head: (options) => request({ ...options, method: 'HEAD' }),
190
+ interceptors,
191
+ options: (options) => request({ ...options, method: 'OPTIONS' }),
192
+ patch: (options) => request({ ...options, method: 'PATCH' }),
193
+ post: (options) => request({ ...options, method: 'POST' }),
194
+ put: (options) => request({ ...options, method: 'PUT' }),
195
+ request,
196
+ setConfig,
197
+ trace: (options) => request({ ...options, method: 'TRACE' }),
198
+ };
199
+ };
@@ -0,0 +1,25 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+
3
+ export type { Auth } from '../core/auth.gen';
4
+ export type { QuerySerializerOptions } from '../core/bodySerializer.gen';
5
+ export {
6
+ formDataBodySerializer,
7
+ jsonBodySerializer,
8
+ urlSearchParamsBodySerializer,
9
+ } from '../core/bodySerializer.gen';
10
+ export { buildClientParams } from '../core/params.gen';
11
+ export { createClient } from './client.gen';
12
+ export type {
13
+ Client,
14
+ ClientOptions,
15
+ Config,
16
+ CreateClientConfig,
17
+ Options,
18
+ OptionsLegacyParser,
19
+ RequestOptions,
20
+ RequestResult,
21
+ ResolvedRequestOptions,
22
+ ResponseStyle,
23
+ TDataShape,
24
+ } from './types.gen';
25
+ export { createConfig, mergeHeaders } from './utils.gen';
@@ -0,0 +1,232 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+
3
+ import type { Auth } from '../core/auth.gen';
4
+ import type {
5
+ Client as CoreClient,
6
+ Config as CoreConfig,
7
+ } from '../core/types.gen';
8
+ import type { Middleware } from './utils.gen';
9
+
10
+ export type ResponseStyle = 'data' | 'fields';
11
+
12
+ export interface Config<T extends ClientOptions = ClientOptions>
13
+ extends Omit<RequestInit, 'body' | 'headers' | 'method'>,
14
+ CoreConfig {
15
+ /**
16
+ * Base URL for all requests made by this client.
17
+ */
18
+ baseUrl?: T['baseUrl'];
19
+ /**
20
+ * Fetch API implementation. You can use this option to provide a custom
21
+ * fetch instance.
22
+ *
23
+ * @default globalThis.fetch
24
+ */
25
+ fetch?: (request: Request) => ReturnType<typeof fetch>;
26
+ /**
27
+ * Please don't use the Fetch client for Next.js applications. The `next`
28
+ * options won't have any effect.
29
+ *
30
+ * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead.
31
+ */
32
+ next?: never;
33
+ /**
34
+ * Return the response data parsed in a specified format. By default, `auto`
35
+ * will infer the appropriate method from the `Content-Type` response header.
36
+ * You can override this behavior with any of the {@link Body} methods.
37
+ * Select `stream` if you don't want to parse response data at all.
38
+ *
39
+ * @default 'auto'
40
+ */
41
+ parseAs?:
42
+ | 'arrayBuffer'
43
+ | 'auto'
44
+ | 'blob'
45
+ | 'formData'
46
+ | 'json'
47
+ | 'stream'
48
+ | 'text';
49
+ /**
50
+ * Should we return only data or multiple fields (data, error, response, etc.)?
51
+ *
52
+ * @default 'fields'
53
+ */
54
+ responseStyle?: ResponseStyle;
55
+ /**
56
+ * Throw an error instead of returning it in the response?
57
+ *
58
+ * @default false
59
+ */
60
+ throwOnError?: T['throwOnError'];
61
+ }
62
+
63
+ export interface RequestOptions<
64
+ TResponseStyle extends ResponseStyle = 'fields',
65
+ ThrowOnError extends boolean = boolean,
66
+ Url extends string = string,
67
+ > extends Config<{
68
+ responseStyle: TResponseStyle;
69
+ throwOnError: ThrowOnError;
70
+ }> {
71
+ /**
72
+ * Any body that you want to add to your request.
73
+ *
74
+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
75
+ */
76
+ body?: unknown;
77
+ path?: Record<string, unknown>;
78
+ query?: Record<string, unknown>;
79
+ /**
80
+ * Security mechanism(s) to use for the request.
81
+ */
82
+ security?: ReadonlyArray<Auth>;
83
+ url: Url;
84
+ }
85
+
86
+ export interface ResolvedRequestOptions<
87
+ TResponseStyle extends ResponseStyle = 'fields',
88
+ ThrowOnError extends boolean = boolean,
89
+ Url extends string = string,
90
+ > extends RequestOptions<TResponseStyle, ThrowOnError, Url> {
91
+ serializedBody?: string;
92
+ }
93
+
94
+ export type RequestResult<
95
+ TData = unknown,
96
+ TError = unknown,
97
+ ThrowOnError extends boolean = boolean,
98
+ TResponseStyle extends ResponseStyle = 'fields',
99
+ > = ThrowOnError extends true
100
+ ? Promise<
101
+ TResponseStyle extends 'data'
102
+ ? TData extends Record<string, unknown>
103
+ ? TData[keyof TData]
104
+ : TData
105
+ : {
106
+ data: TData extends Record<string, unknown>
107
+ ? TData[keyof TData]
108
+ : TData;
109
+ request: Request;
110
+ response: Response;
111
+ }
112
+ >
113
+ : Promise<
114
+ TResponseStyle extends 'data'
115
+ ?
116
+ | (TData extends Record<string, unknown>
117
+ ? TData[keyof TData]
118
+ : TData)
119
+ | undefined
120
+ : (
121
+ | {
122
+ data: TData extends Record<string, unknown>
123
+ ? TData[keyof TData]
124
+ : TData;
125
+ error: undefined;
126
+ }
127
+ | {
128
+ data: undefined;
129
+ error: TError extends Record<string, unknown>
130
+ ? TError[keyof TError]
131
+ : TError;
132
+ }
133
+ ) & {
134
+ request: Request;
135
+ response: Response;
136
+ }
137
+ >;
138
+
139
+ export interface ClientOptions {
140
+ baseUrl?: string;
141
+ responseStyle?: ResponseStyle;
142
+ throwOnError?: boolean;
143
+ }
144
+
145
+ type MethodFn = <
146
+ TData = unknown,
147
+ TError = unknown,
148
+ ThrowOnError extends boolean = false,
149
+ TResponseStyle extends ResponseStyle = 'fields',
150
+ >(
151
+ options: Omit<RequestOptions<TResponseStyle, ThrowOnError>, 'method'>,
152
+ ) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
153
+
154
+ type RequestFn = <
155
+ TData = unknown,
156
+ TError = unknown,
157
+ ThrowOnError extends boolean = false,
158
+ TResponseStyle extends ResponseStyle = 'fields',
159
+ >(
160
+ options: Omit<RequestOptions<TResponseStyle, ThrowOnError>, 'method'> &
161
+ Pick<Required<RequestOptions<TResponseStyle, ThrowOnError>>, 'method'>,
162
+ ) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
163
+
164
+ type BuildUrlFn = <
165
+ TData extends {
166
+ body?: unknown;
167
+ path?: Record<string, unknown>;
168
+ query?: Record<string, unknown>;
169
+ url: string;
170
+ },
171
+ >(
172
+ options: Pick<TData, 'url'> & Options<TData>,
173
+ ) => string;
174
+
175
+ export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn> & {
176
+ interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
177
+ };
178
+
179
+ /**
180
+ * The `createClientConfig()` function will be called on client initialization
181
+ * and the returned object will become the client's initial configuration.
182
+ *
183
+ * You may want to initialize your client this way instead of calling
184
+ * `setConfig()`. This is useful for example if you're using Next.js
185
+ * to ensure your client always has the correct values.
186
+ */
187
+ export type CreateClientConfig<T extends ClientOptions = ClientOptions> = (
188
+ override?: Config<ClientOptions & T>,
189
+ ) => Config<Required<ClientOptions> & T>;
190
+
191
+ export interface TDataShape {
192
+ body?: unknown;
193
+ headers?: unknown;
194
+ path?: unknown;
195
+ query?: unknown;
196
+ url: string;
197
+ }
198
+
199
+ type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
200
+
201
+ export type Options<
202
+ TData extends TDataShape = TDataShape,
203
+ ThrowOnError extends boolean = boolean,
204
+ TResponseStyle extends ResponseStyle = 'fields',
205
+ > = OmitKeys<
206
+ RequestOptions<TResponseStyle, ThrowOnError>,
207
+ 'body' | 'path' | 'query' | 'url'
208
+ > &
209
+ Omit<TData, 'url'>;
210
+
211
+ export type OptionsLegacyParser<
212
+ TData = unknown,
213
+ ThrowOnError extends boolean = boolean,
214
+ TResponseStyle extends ResponseStyle = 'fields',
215
+ > = TData extends { body?: any }
216
+ ? TData extends { headers?: any }
217
+ ? OmitKeys<
218
+ RequestOptions<TResponseStyle, ThrowOnError>,
219
+ 'body' | 'headers' | 'url'
220
+ > &
221
+ TData
222
+ : OmitKeys<RequestOptions<TResponseStyle, ThrowOnError>, 'body' | 'url'> &
223
+ TData &
224
+ Pick<RequestOptions<TResponseStyle, ThrowOnError>, 'headers'>
225
+ : TData extends { headers?: any }
226
+ ? OmitKeys<
227
+ RequestOptions<TResponseStyle, ThrowOnError>,
228
+ 'headers' | 'url'
229
+ > &
230
+ TData &
231
+ Pick<RequestOptions<TResponseStyle, ThrowOnError>, 'body'>
232
+ : OmitKeys<RequestOptions<TResponseStyle, ThrowOnError>, 'url'> & TData;