create-auto-app 0.2.1 → 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 -1
  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,419 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+
3
+ import { getAuthToken } from '../core/auth.gen';
4
+ import type {
5
+ QuerySerializer,
6
+ QuerySerializerOptions,
7
+ } from '../core/bodySerializer.gen';
8
+ import { jsonBodySerializer } from '../core/bodySerializer.gen';
9
+ import {
10
+ serializeArrayParam,
11
+ serializeObjectParam,
12
+ serializePrimitiveParam,
13
+ } from '../core/pathSerializer.gen';
14
+ import type { Client, ClientOptions, Config, RequestOptions } from './types.gen';
15
+
16
+ interface PathSerializer {
17
+ path: Record<string, unknown>;
18
+ url: string;
19
+ }
20
+
21
+ const PATH_PARAM_RE = /\{[^{}]+\}/g;
22
+
23
+ type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited';
24
+ type MatrixStyle = 'label' | 'matrix' | 'simple';
25
+ type ArraySeparatorStyle = ArrayStyle | MatrixStyle;
26
+
27
+ const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => {
28
+ let url = _url;
29
+ const matches = _url.match(PATH_PARAM_RE);
30
+ if (matches) {
31
+ for (const match of matches) {
32
+ let explode = false;
33
+ let name = match.substring(1, match.length - 1);
34
+ let style: ArraySeparatorStyle = 'simple';
35
+
36
+ if (name.endsWith('*')) {
37
+ explode = true;
38
+ name = name.substring(0, name.length - 1);
39
+ }
40
+
41
+ if (name.startsWith('.')) {
42
+ name = name.substring(1);
43
+ style = 'label';
44
+ } else if (name.startsWith(';')) {
45
+ name = name.substring(1);
46
+ style = 'matrix';
47
+ }
48
+
49
+ const value = path[name];
50
+
51
+ if (value === undefined || value === null) {
52
+ continue;
53
+ }
54
+
55
+ if (Array.isArray(value)) {
56
+ url = url.replace(
57
+ match,
58
+ serializeArrayParam({ explode, name, style, value }),
59
+ );
60
+ continue;
61
+ }
62
+
63
+ if (typeof value === 'object') {
64
+ url = url.replace(
65
+ match,
66
+ serializeObjectParam({
67
+ explode,
68
+ name,
69
+ style,
70
+ value: value as Record<string, unknown>,
71
+ valueOnly: true,
72
+ }),
73
+ );
74
+ continue;
75
+ }
76
+
77
+ if (style === 'matrix') {
78
+ url = url.replace(
79
+ match,
80
+ `;${serializePrimitiveParam({
81
+ name,
82
+ value: value as string,
83
+ })}`,
84
+ );
85
+ continue;
86
+ }
87
+
88
+ const replaceValue = encodeURIComponent(
89
+ style === 'label' ? `.${value as string}` : (value as string),
90
+ );
91
+ url = url.replace(match, replaceValue);
92
+ }
93
+ }
94
+ return url;
95
+ };
96
+
97
+ export const createQuerySerializer = <T = unknown>({
98
+ allowReserved,
99
+ array,
100
+ object,
101
+ }: QuerySerializerOptions = {}) => {
102
+ const querySerializer = (queryParams: T) => {
103
+ const search: string[] = [];
104
+ if (queryParams && typeof queryParams === 'object') {
105
+ for (const name in queryParams) {
106
+ const value = queryParams[name];
107
+
108
+ if (value === undefined || value === null) {
109
+ continue;
110
+ }
111
+
112
+ if (Array.isArray(value)) {
113
+ const serializedArray = serializeArrayParam({
114
+ allowReserved,
115
+ explode: true,
116
+ name,
117
+ style: 'form',
118
+ value,
119
+ ...array,
120
+ });
121
+ if (serializedArray) search.push(serializedArray);
122
+ } else if (typeof value === 'object') {
123
+ const serializedObject = serializeObjectParam({
124
+ allowReserved,
125
+ explode: true,
126
+ name,
127
+ style: 'deepObject',
128
+ value: value as Record<string, unknown>,
129
+ ...object,
130
+ });
131
+ if (serializedObject) search.push(serializedObject);
132
+ } else {
133
+ const serializedPrimitive = serializePrimitiveParam({
134
+ allowReserved,
135
+ name,
136
+ value: value as string,
137
+ });
138
+ if (serializedPrimitive) search.push(serializedPrimitive);
139
+ }
140
+ }
141
+ }
142
+ return search.join('&');
143
+ };
144
+ return querySerializer;
145
+ };
146
+
147
+ /**
148
+ * Infers parseAs value from provided Content-Type header.
149
+ */
150
+ export const getParseAs = (
151
+ contentType: string | null,
152
+ ): Exclude<Config['parseAs'], 'auto'> => {
153
+ if (!contentType) {
154
+ // If no Content-Type header is provided, the best we can do is return the raw response body,
155
+ // which is effectively the same as the 'stream' option.
156
+ return 'stream';
157
+ }
158
+
159
+ const cleanContent = contentType.split(';')[0]?.trim();
160
+
161
+ if (!cleanContent) {
162
+ return;
163
+ }
164
+
165
+ if (
166
+ cleanContent.startsWith('application/json') ||
167
+ cleanContent.endsWith('+json')
168
+ ) {
169
+ return 'json';
170
+ }
171
+
172
+ if (cleanContent === 'multipart/form-data') {
173
+ return 'formData';
174
+ }
175
+
176
+ if (
177
+ ['application/', 'audio/', 'image/', 'video/'].some((type) =>
178
+ cleanContent.startsWith(type),
179
+ )
180
+ ) {
181
+ return 'blob';
182
+ }
183
+
184
+ if (cleanContent.startsWith('text/')) {
185
+ return 'text';
186
+ }
187
+
188
+ return;
189
+ };
190
+
191
+ export const setAuthParams = async ({
192
+ security,
193
+ ...options
194
+ }: Pick<Required<RequestOptions>, 'security'> &
195
+ Pick<RequestOptions, 'auth' | 'query'> & {
196
+ headers: Headers;
197
+ }) => {
198
+ for (const auth of security) {
199
+ const token = await getAuthToken(auth, options.auth);
200
+
201
+ if (!token) {
202
+ continue;
203
+ }
204
+
205
+ const name = auth.name ?? 'Authorization';
206
+
207
+ switch (auth.in) {
208
+ case 'query':
209
+ if (!options.query) {
210
+ options.query = {};
211
+ }
212
+ options.query[name] = token;
213
+ break;
214
+ case 'cookie':
215
+ options.headers.append('Cookie', `${name}=${token}`);
216
+ break;
217
+ case 'header':
218
+ default:
219
+ options.headers.set(name, token);
220
+ break;
221
+ }
222
+
223
+ return;
224
+ }
225
+ };
226
+
227
+ export const buildUrl: Client['buildUrl'] = (options) => {
228
+ const url = getUrl({
229
+ baseUrl: options.baseUrl as string,
230
+ path: options.path,
231
+ query: options.query,
232
+ querySerializer:
233
+ typeof options.querySerializer === 'function'
234
+ ? options.querySerializer
235
+ : createQuerySerializer(options.querySerializer),
236
+ url: options.url,
237
+ });
238
+ return url;
239
+ };
240
+
241
+ export const getUrl = ({
242
+ baseUrl,
243
+ path,
244
+ query,
245
+ querySerializer,
246
+ url: _url,
247
+ }: {
248
+ baseUrl?: string;
249
+ path?: Record<string, unknown>;
250
+ query?: Record<string, unknown>;
251
+ querySerializer: QuerySerializer;
252
+ url: string;
253
+ }) => {
254
+ const pathUrl = _url.startsWith('/') ? _url : `/${_url}`;
255
+ let url = (baseUrl ?? '') + pathUrl;
256
+ if (path) {
257
+ url = defaultPathSerializer({ path, url });
258
+ }
259
+ let search = query ? querySerializer(query) : '';
260
+ if (search.startsWith('?')) {
261
+ search = search.substring(1);
262
+ }
263
+ if (search) {
264
+ url += `?${search}`;
265
+ }
266
+ return url;
267
+ };
268
+
269
+ export const mergeConfigs = (a: Config, b: Config): Config => {
270
+ const config = { ...a, ...b };
271
+ if (config.baseUrl?.endsWith('/')) {
272
+ config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
273
+ }
274
+ config.headers = mergeHeaders(a.headers, b.headers);
275
+ return config;
276
+ };
277
+
278
+ export const mergeHeaders = (
279
+ ...headers: Array<Required<Config>['headers'] | undefined>
280
+ ): Headers => {
281
+ const mergedHeaders = new Headers();
282
+ for (const header of headers) {
283
+ if (!header || typeof header !== 'object') {
284
+ continue;
285
+ }
286
+
287
+ const iterator =
288
+ header instanceof Headers ? header.entries() : Object.entries(header);
289
+
290
+ for (const [key, value] of iterator) {
291
+ if (value === null) {
292
+ mergedHeaders.delete(key);
293
+ } else if (Array.isArray(value)) {
294
+ for (const v of value) {
295
+ mergedHeaders.append(key, v as string);
296
+ }
297
+ } else if (value !== undefined) {
298
+ // assume object headers are meant to be JSON stringified, i.e. their
299
+ // content value in OpenAPI specification is 'application/json'
300
+ mergedHeaders.set(
301
+ key,
302
+ typeof value === 'object' ? JSON.stringify(value) : (value as string),
303
+ );
304
+ }
305
+ }
306
+ }
307
+ return mergedHeaders;
308
+ };
309
+
310
+ type ErrInterceptor<Err, Res, Req, Options> = (
311
+ error: Err,
312
+ response: Res,
313
+ request: Req,
314
+ options: Options,
315
+ ) => Err | Promise<Err>;
316
+
317
+ type ReqInterceptor<Req, Options> = (
318
+ request: Req,
319
+ options: Options,
320
+ ) => Req | Promise<Req>;
321
+
322
+ type ResInterceptor<Res, Req, Options> = (
323
+ response: Res,
324
+ request: Req,
325
+ options: Options,
326
+ ) => Res | Promise<Res>;
327
+
328
+ class Interceptors<Interceptor> {
329
+ _fns: (Interceptor | null)[];
330
+
331
+ constructor() {
332
+ this._fns = [];
333
+ }
334
+
335
+ clear() {
336
+ this._fns = [];
337
+ }
338
+
339
+ getInterceptorIndex(id: number | Interceptor): number {
340
+ if (typeof id === 'number') {
341
+ return this._fns[id] ? id : -1;
342
+ } else {
343
+ return this._fns.indexOf(id);
344
+ }
345
+ }
346
+ exists(id: number | Interceptor) {
347
+ const index = this.getInterceptorIndex(id);
348
+ return !!this._fns[index];
349
+ }
350
+
351
+ eject(id: number | Interceptor) {
352
+ const index = this.getInterceptorIndex(id);
353
+ if (this._fns[index]) {
354
+ this._fns[index] = null;
355
+ }
356
+ }
357
+
358
+ update(id: number | Interceptor, fn: Interceptor) {
359
+ const index = this.getInterceptorIndex(id);
360
+ if (this._fns[index]) {
361
+ this._fns[index] = fn;
362
+ return id;
363
+ } else {
364
+ return false;
365
+ }
366
+ }
367
+
368
+ use(fn: Interceptor) {
369
+ this._fns = [...this._fns, fn];
370
+ return this._fns.length - 1;
371
+ }
372
+ }
373
+
374
+ // `createInterceptors()` response, meant for external use as it does not
375
+ // expose internals
376
+ export interface Middleware<Req, Res, Err, Options> {
377
+ error: Pick<
378
+ Interceptors<ErrInterceptor<Err, Res, Req, Options>>,
379
+ 'eject' | 'use'
380
+ >;
381
+ request: Pick<Interceptors<ReqInterceptor<Req, Options>>, 'eject' | 'use'>;
382
+ response: Pick<
383
+ Interceptors<ResInterceptor<Res, Req, Options>>,
384
+ 'eject' | 'use'
385
+ >;
386
+ }
387
+
388
+ // do not add `Middleware` as return type so we can use _fns internally
389
+ export const createInterceptors = <Req, Res, Err, Options>() => ({
390
+ error: new Interceptors<ErrInterceptor<Err, Res, Req, Options>>(),
391
+ request: new Interceptors<ReqInterceptor<Req, Options>>(),
392
+ response: new Interceptors<ResInterceptor<Res, Req, Options>>(),
393
+ });
394
+
395
+ const defaultQuerySerializer = createQuerySerializer({
396
+ allowReserved: false,
397
+ array: {
398
+ explode: true,
399
+ style: 'form',
400
+ },
401
+ object: {
402
+ explode: true,
403
+ style: 'deepObject',
404
+ },
405
+ });
406
+
407
+ const defaultHeaders = {
408
+ 'Content-Type': 'application/json',
409
+ };
410
+
411
+ export const createConfig = <T extends ClientOptions = ClientOptions>(
412
+ override: Config<Omit<ClientOptions, keyof T> & T> = {},
413
+ ): Config<Omit<ClientOptions, keyof T> & T> => ({
414
+ ...jsonBodySerializer,
415
+ headers: defaultHeaders,
416
+ parseAs: 'auto',
417
+ querySerializer: defaultQuerySerializer,
418
+ ...override,
419
+ });
@@ -0,0 +1,18 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+
3
+ import type { ClientOptions } from './types.gen';
4
+ import { type Config, type ClientOptions as DefaultClientOptions, createClient, createConfig } from './client';
5
+
6
+ /**
7
+ * The `createClientConfig()` function will be called on client initialization
8
+ * and the returned object will become the client's initial configuration.
9
+ *
10
+ * You may want to initialize your client this way instead of calling
11
+ * `setConfig()`. This is useful for example if you're using Next.js
12
+ * to ensure your client always has the correct values.
13
+ */
14
+ export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>;
15
+
16
+ export const client = createClient(createConfig<ClientOptions>({
17
+ baseUrl: 'http://localhost:3002'
18
+ }));
@@ -0,0 +1,42 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+
3
+ export type AuthToken = string | undefined;
4
+
5
+ export interface Auth {
6
+ /**
7
+ * Which part of the request do we use to send the auth?
8
+ *
9
+ * @default 'header'
10
+ */
11
+ in?: 'header' | 'query' | 'cookie';
12
+ /**
13
+ * Header or query parameter name.
14
+ *
15
+ * @default 'Authorization'
16
+ */
17
+ name?: string;
18
+ scheme?: 'basic' | 'bearer';
19
+ type: 'apiKey' | 'http';
20
+ }
21
+
22
+ export const getAuthToken = async (
23
+ auth: Auth,
24
+ callback: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken,
25
+ ): Promise<string | undefined> => {
26
+ const token =
27
+ typeof callback === 'function' ? await callback(auth) : callback;
28
+
29
+ if (!token) {
30
+ return;
31
+ }
32
+
33
+ if (auth.scheme === 'bearer') {
34
+ return `Bearer ${token}`;
35
+ }
36
+
37
+ if (auth.scheme === 'basic') {
38
+ return `Basic ${btoa(token)}`;
39
+ }
40
+
41
+ return token;
42
+ };
@@ -0,0 +1,92 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+
3
+ import type {
4
+ ArrayStyle,
5
+ ObjectStyle,
6
+ SerializerOptions,
7
+ } from './pathSerializer.gen';
8
+
9
+ export type QuerySerializer = (query: Record<string, unknown>) => string;
10
+
11
+ export type BodySerializer = (body: any) => any;
12
+
13
+ export interface QuerySerializerOptions {
14
+ allowReserved?: boolean;
15
+ array?: SerializerOptions<ArrayStyle>;
16
+ object?: SerializerOptions<ObjectStyle>;
17
+ }
18
+
19
+ const serializeFormDataPair = (
20
+ data: FormData,
21
+ key: string,
22
+ value: unknown,
23
+ ): void => {
24
+ if (typeof value === 'string' || value instanceof Blob) {
25
+ data.append(key, value);
26
+ } else if (value instanceof Date) {
27
+ data.append(key, value.toISOString());
28
+ } else {
29
+ data.append(key, JSON.stringify(value));
30
+ }
31
+ };
32
+
33
+ const serializeUrlSearchParamsPair = (
34
+ data: URLSearchParams,
35
+ key: string,
36
+ value: unknown,
37
+ ): void => {
38
+ if (typeof value === 'string') {
39
+ data.append(key, value);
40
+ } else {
41
+ data.append(key, JSON.stringify(value));
42
+ }
43
+ };
44
+
45
+ export const formDataBodySerializer = {
46
+ bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(
47
+ body: T,
48
+ ): FormData => {
49
+ const data = new FormData();
50
+
51
+ Object.entries(body).forEach(([key, value]) => {
52
+ if (value === undefined || value === null) {
53
+ return;
54
+ }
55
+ if (Array.isArray(value)) {
56
+ value.forEach((v) => serializeFormDataPair(data, key, v));
57
+ } else {
58
+ serializeFormDataPair(data, key, value);
59
+ }
60
+ });
61
+
62
+ return data;
63
+ },
64
+ };
65
+
66
+ export const jsonBodySerializer = {
67
+ bodySerializer: <T>(body: T): string =>
68
+ JSON.stringify(body, (_key, value) =>
69
+ typeof value === 'bigint' ? value.toString() : value,
70
+ ),
71
+ };
72
+
73
+ export const urlSearchParamsBodySerializer = {
74
+ bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(
75
+ body: T,
76
+ ): string => {
77
+ const data = new URLSearchParams();
78
+
79
+ Object.entries(body).forEach(([key, value]) => {
80
+ if (value === undefined || value === null) {
81
+ return;
82
+ }
83
+ if (Array.isArray(value)) {
84
+ value.forEach((v) => serializeUrlSearchParamsPair(data, key, v));
85
+ } else {
86
+ serializeUrlSearchParamsPair(data, key, value);
87
+ }
88
+ });
89
+
90
+ return data.toString();
91
+ },
92
+ };