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.
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/shopping-app/auto.config.ts +6 -6
- package/templates/shopping-app/client/auto-configure.ts +1 -1
- package/templates/shopping-app/client/package.json +1 -1
- package/templates/shopping-app/example-integrations/ai-chat-completion/.turbo/turbo-build.log +4 -0
- package/templates/shopping-app/example-integrations/ai-chat-completion/.turbo/turbo-format.log +12 -0
- package/templates/shopping-app/example-integrations/ai-chat-completion/.turbo/turbo-lint.log +4 -0
- package/templates/shopping-app/example-integrations/ai-chat-completion/.turbo/turbo-test.log +12 -0
- package/templates/shopping-app/example-integrations/ai-chat-completion/.turbo/turbo-type-check.log +5 -0
- package/templates/shopping-app/example-integrations/ai-chat-completion/CHANGELOG.md +134 -0
- package/templates/shopping-app/example-integrations/ai-chat-completion/dist/ai-integration.d.ts +23 -0
- package/templates/shopping-app/example-integrations/ai-chat-completion/dist/ai-integration.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/ai-chat-completion/dist/ai-integration.js +41 -0
- package/templates/shopping-app/example-integrations/ai-chat-completion/dist/ai-integration.js.map +1 -0
- package/templates/shopping-app/example-integrations/ai-chat-completion/dist/index.d.ts +2 -0
- package/templates/shopping-app/example-integrations/ai-chat-completion/dist/index.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/ai-chat-completion/dist/index.js +2 -0
- package/templates/shopping-app/example-integrations/ai-chat-completion/dist/index.js.map +1 -0
- package/templates/shopping-app/example-integrations/ai-chat-completion/eslint.config.ts +12 -0
- package/templates/shopping-app/example-integrations/ai-chat-completion/node_modules/.bin/eslint +21 -0
- package/templates/shopping-app/example-integrations/ai-chat-completion/node_modules/.bin/jiti +21 -0
- package/templates/shopping-app/example-integrations/ai-chat-completion/node_modules/.bin/msw +21 -0
- package/templates/shopping-app/example-integrations/ai-chat-completion/node_modules/.bin/tsc +21 -0
- package/templates/shopping-app/example-integrations/ai-chat-completion/node_modules/.bin/tsserver +21 -0
- package/templates/shopping-app/example-integrations/ai-chat-completion/node_modules/.bin/vite +21 -0
- package/templates/shopping-app/example-integrations/ai-chat-completion/node_modules/.bin/vitest +21 -0
- package/templates/shopping-app/example-integrations/ai-chat-completion/package.json +29 -0
- package/templates/shopping-app/example-integrations/ai-chat-completion/src/ai-integration.ts +76 -0
- package/templates/shopping-app/example-integrations/ai-chat-completion/src/index.ts +1 -0
- package/templates/shopping-app/example-integrations/ai-chat-completion/tsconfig.json +10 -0
- package/templates/shopping-app/example-integrations/ai-chat-completion/tsconfig.test.json +7 -0
- package/templates/shopping-app/example-integrations/cart/.turbo/turbo-build.log +4 -0
- package/templates/shopping-app/example-integrations/cart/.turbo/turbo-format.log +12 -0
- package/templates/shopping-app/example-integrations/cart/.turbo/turbo-lint.log +5 -0
- package/templates/shopping-app/example-integrations/cart/.turbo/turbo-test.log +12 -0
- package/templates/shopping-app/example-integrations/cart/.turbo/turbo-type-check.log +5 -0
- package/templates/shopping-app/example-integrations/cart/CHANGELOG.md +124 -0
- package/templates/shopping-app/example-integrations/cart/dist/cart-integration.d.ts +30 -0
- package/templates/shopping-app/example-integrations/cart/dist/cart-integration.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/cart/dist/cart-integration.js +134 -0
- package/templates/shopping-app/example-integrations/cart/dist/cart-integration.js.map +1 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/client.gen.d.ts +3 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/client.gen.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/client.gen.js +149 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/client.gen.js.map +1 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/index.d.ts +8 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/index.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/index.js +6 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/index.js.map +1 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/types.gen.d.ts +123 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/types.gen.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/types.gen.js +3 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/types.gen.js.map +1 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/utils.gen.d.ts +46 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/utils.gen.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/utils.gen.js +285 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client/utils.gen.js.map +1 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client.gen.d.ts +13 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client.gen.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client.gen.js +6 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/client.gen.js.map +1 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/auth.gen.d.ts +19 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/auth.gen.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/auth.gen.js +15 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/auth.gen.js.map +1 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/bodySerializer.gen.d.ts +18 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/bodySerializer.gen.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/bodySerializer.gen.js +58 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/bodySerializer.gen.js.map +1 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/params.gen.d.ts +34 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/params.gen.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/params.gen.js +89 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/params.gen.js.map +1 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/pathSerializer.gen.d.ts +34 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/pathSerializer.gen.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/pathSerializer.gen.js +115 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/pathSerializer.gen.js.map +1 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/types.gen.d.ts +79 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/types.gen.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/types.gen.js +3 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/core/types.gen.js.map +1 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/index.d.ts +2 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/index.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/index.js +3 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/index.js.map +1 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/types.gen.d.ts +158 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/types.gen.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/types.gen.js +3 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/types.gen.js.map +1 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/zod.gen.d.ts +382 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/zod.gen.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/zod.gen.js +68 -0
- package/templates/shopping-app/example-integrations/cart/dist/generated/cart/zod.gen.js.map +1 -0
- package/templates/shopping-app/example-integrations/cart/dist/index.d.ts +2 -0
- package/templates/shopping-app/example-integrations/cart/dist/index.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/cart/dist/index.js +2 -0
- package/templates/shopping-app/example-integrations/cart/dist/index.js.map +1 -0
- package/templates/shopping-app/example-integrations/cart/eslint.config.ts +12 -0
- package/templates/shopping-app/example-integrations/cart/node_modules/.bin/eslint +21 -0
- package/templates/shopping-app/example-integrations/cart/node_modules/.bin/jiti +21 -0
- package/templates/shopping-app/example-integrations/cart/node_modules/.bin/msw +21 -0
- package/templates/shopping-app/example-integrations/cart/node_modules/.bin/tsc +21 -0
- package/templates/shopping-app/example-integrations/cart/node_modules/.bin/tsserver +21 -0
- package/templates/shopping-app/example-integrations/cart/node_modules/.bin/vitest +21 -0
- package/templates/shopping-app/example-integrations/cart/package.json +31 -0
- package/templates/shopping-app/example-integrations/cart/src/cart-integration.ts +198 -0
- package/templates/shopping-app/example-integrations/cart/src/generated/cart/client/client.gen.ts +199 -0
- package/templates/shopping-app/example-integrations/cart/src/generated/cart/client/index.ts +25 -0
- package/templates/shopping-app/example-integrations/cart/src/generated/cart/client/types.gen.ts +232 -0
- package/templates/shopping-app/example-integrations/cart/src/generated/cart/client/utils.gen.ts +419 -0
- package/templates/shopping-app/example-integrations/cart/src/generated/cart/client.gen.ts +18 -0
- package/templates/shopping-app/example-integrations/cart/src/generated/cart/core/auth.gen.ts +42 -0
- package/templates/shopping-app/example-integrations/cart/src/generated/cart/core/bodySerializer.gen.ts +92 -0
- package/templates/shopping-app/example-integrations/cart/src/generated/cart/core/params.gen.ts +153 -0
- package/templates/shopping-app/example-integrations/cart/src/generated/cart/core/pathSerializer.gen.ts +181 -0
- package/templates/shopping-app/example-integrations/cart/src/generated/cart/core/types.gen.ts +120 -0
- package/templates/shopping-app/example-integrations/cart/src/generated/cart/index.ts +2 -0
- package/templates/shopping-app/example-integrations/cart/src/generated/cart/types.gen.ts +175 -0
- package/templates/shopping-app/example-integrations/cart/src/generated/cart/zod.gen.ts +78 -0
- package/templates/shopping-app/example-integrations/cart/src/index.ts +1 -0
- package/templates/shopping-app/example-integrations/cart/tsconfig.json +10 -0
- package/templates/shopping-app/example-integrations/cart/tsconfig.test.json +7 -0
- package/templates/shopping-app/example-integrations/cart-api/.turbo/turbo-build.log +4 -0
- package/templates/shopping-app/example-integrations/cart-api/.turbo/turbo-format.log +10 -0
- package/templates/shopping-app/example-integrations/cart-api/.turbo/turbo-lint.log +4 -0
- package/templates/shopping-app/example-integrations/cart-api/.turbo/turbo-test.log +12 -0
- package/templates/shopping-app/example-integrations/cart-api/.turbo/turbo-type-check.log +4 -0
- package/templates/shopping-app/example-integrations/cart-api/dist/data/cart.d.ts +18 -0
- package/templates/shopping-app/example-integrations/cart-api/dist/data/cart.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/cart-api/dist/data/cart.js +28 -0
- package/templates/shopping-app/example-integrations/cart-api/dist/data/cart.js.map +1 -0
- package/templates/shopping-app/example-integrations/cart-api/dist/index.d.ts +4 -0
- package/templates/shopping-app/example-integrations/cart-api/dist/index.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/cart-api/dist/index.js +49 -0
- package/templates/shopping-app/example-integrations/cart-api/dist/index.js.map +1 -0
- package/templates/shopping-app/example-integrations/cart-api/dist/routes/cart.d.ts +4 -0
- package/templates/shopping-app/example-integrations/cart-api/dist/routes/cart.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/cart-api/dist/routes/cart.js +261 -0
- package/templates/shopping-app/example-integrations/cart-api/dist/routes/cart.js.map +1 -0
- package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/nodemon +21 -0
- package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/swagger-jsdoc +21 -0
- package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/ts-node +21 -0
- package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/ts-node-cwd +21 -0
- package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/ts-node-esm +21 -0
- package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/ts-node-script +21 -0
- package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/ts-node-transpile-only +21 -0
- package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/ts-script +21 -0
- package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/tsc +21 -0
- package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/tsserver +21 -0
- package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/tsx +21 -0
- package/templates/shopping-app/example-integrations/cart-api/node_modules/.bin/vitest +21 -0
- package/templates/shopping-app/example-integrations/cart-api/package.json +49 -0
- package/templates/shopping-app/example-integrations/cart-api/src/data/cart.ts +45 -0
- package/templates/shopping-app/example-integrations/cart-api/src/index.ts +59 -0
- package/templates/shopping-app/example-integrations/cart-api/src/routes/cart.ts +289 -0
- package/templates/shopping-app/example-integrations/cart-api/tsconfig.json +9 -0
- package/templates/shopping-app/example-integrations/product-catalogue/.turbo/turbo-build.log +4 -0
- package/templates/shopping-app/example-integrations/product-catalogue/.turbo/turbo-format.log +12 -0
- package/templates/shopping-app/example-integrations/product-catalogue/.turbo/turbo-lint.log +5 -0
- package/templates/shopping-app/example-integrations/product-catalogue/.turbo/turbo-test.log +12 -0
- package/templates/shopping-app/example-integrations/product-catalogue/.turbo/turbo-type-check.log +5 -0
- package/templates/shopping-app/example-integrations/product-catalogue/CHANGELOG.md +124 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/client.gen.d.ts +3 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/client.gen.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/client.gen.js +149 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/client.gen.js.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/index.d.ts +8 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/index.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/index.js +6 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/index.js.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/types.gen.d.ts +123 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/types.gen.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/types.gen.js +3 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/types.gen.js.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/utils.gen.d.ts +46 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/utils.gen.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/utils.gen.js +285 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client/utils.gen.js.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client.gen.d.ts +13 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client.gen.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client.gen.js +6 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/client.gen.js.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/auth.gen.d.ts +19 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/auth.gen.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/auth.gen.js +15 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/auth.gen.js.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/bodySerializer.gen.d.ts +18 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/bodySerializer.gen.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/bodySerializer.gen.js +58 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/bodySerializer.gen.js.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/params.gen.d.ts +34 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/params.gen.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/params.gen.js +89 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/params.gen.js.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/pathSerializer.gen.d.ts +34 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/pathSerializer.gen.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/pathSerializer.gen.js +115 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/pathSerializer.gen.js.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/types.gen.d.ts +79 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/types.gen.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/types.gen.js +3 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/core/types.gen.js.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/index.d.ts +2 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/index.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/index.js +3 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/index.js.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/types.gen.d.ts +115 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/types.gen.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/types.gen.js +3 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/types.gen.js.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/zod.gen.d.ts +206 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/zod.gen.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/zod.gen.js +53 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/generated/product-catalog/zod.gen.js.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/index.d.ts +2 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/index.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/index.js +2 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/index.js.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/product-catalogue-integration.d.ts +32 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/product-catalogue-integration.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/product-catalogue-integration.js +163 -0
- package/templates/shopping-app/example-integrations/product-catalogue/dist/product-catalogue-integration.js.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue/eslint.config.ts +12 -0
- package/templates/shopping-app/example-integrations/product-catalogue/node_modules/.bin/eslint +21 -0
- package/templates/shopping-app/example-integrations/product-catalogue/node_modules/.bin/jiti +21 -0
- package/templates/shopping-app/example-integrations/product-catalogue/node_modules/.bin/msw +21 -0
- package/templates/shopping-app/example-integrations/product-catalogue/node_modules/.bin/tsc +21 -0
- package/templates/shopping-app/example-integrations/product-catalogue/node_modules/.bin/tsserver +21 -0
- package/templates/shopping-app/example-integrations/product-catalogue/node_modules/.bin/vitest +21 -0
- package/templates/shopping-app/example-integrations/product-catalogue/package.json +31 -0
- package/templates/shopping-app/example-integrations/product-catalogue/src/generated/product-catalog/client/client.gen.ts +199 -0
- package/templates/shopping-app/example-integrations/product-catalogue/src/generated/product-catalog/client/index.ts +25 -0
- package/templates/shopping-app/example-integrations/product-catalogue/src/generated/product-catalog/client/types.gen.ts +232 -0
- package/templates/shopping-app/example-integrations/product-catalogue/src/generated/product-catalog/client/utils.gen.ts +419 -0
- package/templates/shopping-app/example-integrations/product-catalogue/src/generated/product-catalog/client.gen.ts +18 -0
- package/templates/shopping-app/example-integrations/product-catalogue/src/generated/product-catalog/core/auth.gen.ts +42 -0
- package/templates/shopping-app/example-integrations/product-catalogue/src/generated/product-catalog/core/bodySerializer.gen.ts +92 -0
- package/templates/shopping-app/example-integrations/product-catalogue/src/generated/product-catalog/core/params.gen.ts +153 -0
- package/templates/shopping-app/example-integrations/product-catalogue/src/generated/product-catalog/core/pathSerializer.gen.ts +181 -0
- package/templates/shopping-app/example-integrations/product-catalogue/src/generated/product-catalog/core/types.gen.ts +120 -0
- package/templates/shopping-app/example-integrations/product-catalogue/src/generated/product-catalog/index.ts +2 -0
- package/templates/shopping-app/example-integrations/product-catalogue/src/generated/product-catalog/types.gen.ts +133 -0
- package/templates/shopping-app/example-integrations/product-catalogue/src/generated/product-catalog/zod.gen.ts +62 -0
- package/templates/shopping-app/example-integrations/product-catalogue/src/index.ts +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue/src/product-catalogue-integration.ts +225 -0
- package/templates/shopping-app/example-integrations/product-catalogue/tsconfig.json +10 -0
- package/templates/shopping-app/example-integrations/product-catalogue/tsconfig.test.json +7 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/.turbo/turbo-build.log +4 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/.turbo/turbo-format.log +10 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/.turbo/turbo-lint.log +5 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/.turbo/turbo-test.log +13 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/.turbo/turbo-type-check.log +5 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/dist/data/products.d.ts +10 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/dist/data/products.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/dist/data/products.js +75 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/dist/data/products.js.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/dist/index.d.ts +4 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/dist/index.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/dist/index.js +49 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/dist/index.js.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/dist/routes/products.d.ts +4 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/dist/routes/products.d.ts.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/dist/routes/products.js +170 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/dist/routes/products.js.map +1 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/nodemon +21 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/swagger-jsdoc +21 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/ts-node +21 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/ts-node-cwd +21 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/ts-node-esm +21 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/ts-node-script +21 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/ts-node-transpile-only +21 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/ts-script +21 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/tsc +21 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/tsserver +21 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/tsx +21 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/node_modules/.bin/vitest +21 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/package.json +51 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/src/data/products.ts +90 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/src/index.ts +59 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/src/routes/products.ts +181 -0
- package/templates/shopping-app/example-integrations/product-catalogue-api/tsconfig.json +9 -0
- package/templates/shopping-app/flows/shopping-assistant.flow.ts +1 -1
- package/templates/shopping-app/package.json +10 -6
- package/templates/shopping-app/server/package.json +1 -1
- package/templates/shopping-app/server/src/integrations/ai-integration.ts +1 -1
- package/templates/shopping-app/server/src/integrations/cart-integration.ts +1 -1
- package/templates/shopping-app/server/src/integrations/product-catalogue-integration.ts +1 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
+
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
+
basedir=`cygpath -w "$basedir"`
|
|
8
|
+
fi
|
|
9
|
+
;;
|
|
10
|
+
esac
|
|
11
|
+
|
|
12
|
+
if [ -z "$NODE_PATH" ]; then
|
|
13
|
+
export NODE_PATH="/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/ts-node@10.9.2_@types+node@20.19.11_typescript@5.9.2/node_modules/ts-node/dist/node_modules:/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/ts-node@10.9.2_@types+node@20.19.11_typescript@5.9.2/node_modules/ts-node/node_modules:/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/ts-node@10.9.2_@types+node@20.19.11_typescript@5.9.2/node_modules:/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/node_modules"
|
|
14
|
+
else
|
|
15
|
+
export NODE_PATH="/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/ts-node@10.9.2_@types+node@20.19.11_typescript@5.9.2/node_modules/ts-node/dist/node_modules:/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/ts-node@10.9.2_@types+node@20.19.11_typescript@5.9.2/node_modules/ts-node/node_modules:/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/ts-node@10.9.2_@types+node@20.19.11_typescript@5.9.2/node_modules:/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
|
+
fi
|
|
17
|
+
if [ -x "$basedir/node" ]; then
|
|
18
|
+
exec "$basedir/node" "$basedir/../ts-node/dist/bin-script-deprecated.js" "$@"
|
|
19
|
+
else
|
|
20
|
+
exec node "$basedir/../ts-node/dist/bin-script-deprecated.js" "$@"
|
|
21
|
+
fi
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
+
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
+
basedir=`cygpath -w "$basedir"`
|
|
8
|
+
fi
|
|
9
|
+
;;
|
|
10
|
+
esac
|
|
11
|
+
|
|
12
|
+
if [ -z "$NODE_PATH" ]; then
|
|
13
|
+
export NODE_PATH="/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/bin/node_modules:/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/node_modules:/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/typescript@5.9.2/node_modules:/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/node_modules"
|
|
14
|
+
else
|
|
15
|
+
export NODE_PATH="/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/bin/node_modules:/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/node_modules:/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/typescript@5.9.2/node_modules:/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
|
+
fi
|
|
17
|
+
if [ -x "$basedir/node" ]; then
|
|
18
|
+
exec "$basedir/node" "$basedir/../typescript/bin/tsc" "$@"
|
|
19
|
+
else
|
|
20
|
+
exec node "$basedir/../typescript/bin/tsc" "$@"
|
|
21
|
+
fi
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
+
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
+
basedir=`cygpath -w "$basedir"`
|
|
8
|
+
fi
|
|
9
|
+
;;
|
|
10
|
+
esac
|
|
11
|
+
|
|
12
|
+
if [ -z "$NODE_PATH" ]; then
|
|
13
|
+
export NODE_PATH="/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/bin/node_modules:/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/node_modules:/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/typescript@5.9.2/node_modules:/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/node_modules"
|
|
14
|
+
else
|
|
15
|
+
export NODE_PATH="/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/bin/node_modules:/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/typescript@5.9.2/node_modules/typescript/node_modules:/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/typescript@5.9.2/node_modules:/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
|
+
fi
|
|
17
|
+
if [ -x "$basedir/node" ]; then
|
|
18
|
+
exec "$basedir/node" "$basedir/../typescript/bin/tsserver" "$@"
|
|
19
|
+
else
|
|
20
|
+
exec node "$basedir/../typescript/bin/tsserver" "$@"
|
|
21
|
+
fi
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
+
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
+
basedir=`cygpath -w "$basedir"`
|
|
8
|
+
fi
|
|
9
|
+
;;
|
|
10
|
+
esac
|
|
11
|
+
|
|
12
|
+
if [ -z "$NODE_PATH" ]; then
|
|
13
|
+
export NODE_PATH="/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/tsx@4.20.5/node_modules/tsx/dist/node_modules:/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/tsx@4.20.5/node_modules/tsx/node_modules:/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/tsx@4.20.5/node_modules:/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/node_modules"
|
|
14
|
+
else
|
|
15
|
+
export NODE_PATH="/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/tsx@4.20.5/node_modules/tsx/dist/node_modules:/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/tsx@4.20.5/node_modules/tsx/node_modules:/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/tsx@4.20.5/node_modules:/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
|
+
fi
|
|
17
|
+
if [ -x "$basedir/node" ]; then
|
|
18
|
+
exec "$basedir/node" "$basedir/../tsx/dist/cli.mjs" "$@"
|
|
19
|
+
else
|
|
20
|
+
exec node "$basedir/../tsx/dist/cli.mjs" "$@"
|
|
21
|
+
fi
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
+
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
+
basedir=`cygpath -w "$basedir"`
|
|
8
|
+
fi
|
|
9
|
+
;;
|
|
10
|
+
esac
|
|
11
|
+
|
|
12
|
+
if [ -z "$NODE_PATH" ]; then
|
|
13
|
+
export NODE_PATH="/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/vitest@1.6.1_@types+node@20.19.11_jsdom@26.1.0/node_modules/vitest/node_modules:/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/vitest@1.6.1_@types+node@20.19.11_jsdom@26.1.0/node_modules:/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/node_modules"
|
|
14
|
+
else
|
|
15
|
+
export NODE_PATH="/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/vitest@1.6.1_@types+node@20.19.11_jsdom@26.1.0/node_modules/vitest/node_modules:/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/vitest@1.6.1_@types+node@20.19.11_jsdom@26.1.0/node_modules:/Users/sam/WebstormProjects/top/auto-engineer/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
|
+
fi
|
|
17
|
+
if [ -x "$basedir/node" ]; then
|
|
18
|
+
exec "$basedir/node" "$basedir/../vitest/vitest.mjs" "$@"
|
|
19
|
+
else
|
|
20
|
+
exec node "$basedir/../vitest/vitest.mjs" "$@"
|
|
21
|
+
fi
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@examples/cart-service",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "Example cart service with REST API",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"clean": "rm -rf dist",
|
|
11
|
+
"dev": "tsx watch src/index.ts",
|
|
12
|
+
"start": "tsx src/index.ts",
|
|
13
|
+
"test": "vitest run",
|
|
14
|
+
"test:watch": "vitest",
|
|
15
|
+
"lint": "eslint 'src/**/*.ts' --max-warnings 0 --config ../../eslint.config.ts",
|
|
16
|
+
"type-check": "tsc --noEmit",
|
|
17
|
+
"format": "prettier --write \"**/*.{js,ts,json,md,yml,yaml}\" --ignore-path ../../.prettierignore",
|
|
18
|
+
"lint:fix": "eslint 'src/**/*.ts' --fix --config ../../eslint.config.ts",
|
|
19
|
+
"format:fix": "prettier --write \"**/*.{js,ts,json,md,yml,yaml}\" --ignore-path ../../.prettierignore"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"cors": "^2.8.5",
|
|
23
|
+
"express": "^4.18.2",
|
|
24
|
+
"swagger-jsdoc": "^6.2.8",
|
|
25
|
+
"swagger-ui-express": "^5.0.1"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/cors": "^2.8.17",
|
|
29
|
+
"@types/express": "^4.17.21",
|
|
30
|
+
"@types/node": "^20.11.19",
|
|
31
|
+
"@types/supertest": "^2.0.16",
|
|
32
|
+
"@types/swagger-jsdoc": "^6.0.4",
|
|
33
|
+
"@types/swagger-ui-express": "^4.1.8",
|
|
34
|
+
"nodemon": "^3.0.2",
|
|
35
|
+
"supertest": "^6.3.3",
|
|
36
|
+
"ts-node": "^10.9.1",
|
|
37
|
+
"tsx": "^4.20.3",
|
|
38
|
+
"typescript": "^5.3.3",
|
|
39
|
+
"vitest": "^1.0.0"
|
|
40
|
+
},
|
|
41
|
+
"keywords": [
|
|
42
|
+
"cart",
|
|
43
|
+
"service",
|
|
44
|
+
"example",
|
|
45
|
+
"rest",
|
|
46
|
+
"api"
|
|
47
|
+
],
|
|
48
|
+
"author": ""
|
|
49
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export interface CartItem {
|
|
2
|
+
productId: string;
|
|
3
|
+
name: string;
|
|
4
|
+
price: number;
|
|
5
|
+
quantity: number;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface CartSession {
|
|
9
|
+
sessionId: string;
|
|
10
|
+
items: CartItem[];
|
|
11
|
+
total: number;
|
|
12
|
+
createdAt: string;
|
|
13
|
+
updatedAt: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// In-memory storage for cart sessions
|
|
17
|
+
export const cartSessions: Map<string, CartSession> = new Map();
|
|
18
|
+
|
|
19
|
+
// Helper function to calculate cart total
|
|
20
|
+
export const calculateCartTotal = (items: CartItem[]): number => {
|
|
21
|
+
return items.reduce((total, item) => total + item.price * item.quantity, 0);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// Helper function to create a new cart session
|
|
25
|
+
export const createCartSession = (sessionId: string): CartSession => {
|
|
26
|
+
const now = new Date().toISOString();
|
|
27
|
+
const cartSession: CartSession = {
|
|
28
|
+
sessionId,
|
|
29
|
+
items: [],
|
|
30
|
+
total: 0,
|
|
31
|
+
createdAt: now,
|
|
32
|
+
updatedAt: now,
|
|
33
|
+
};
|
|
34
|
+
cartSessions.set(sessionId, cartSession);
|
|
35
|
+
return cartSession;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// Helper function to get or create cart session
|
|
39
|
+
export const getOrCreateCartSession = (sessionId: string): CartSession => {
|
|
40
|
+
let cartSession = cartSessions.get(sessionId);
|
|
41
|
+
if (!cartSession) {
|
|
42
|
+
cartSession = createCartSession(sessionId);
|
|
43
|
+
}
|
|
44
|
+
return cartSession;
|
|
45
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import express, { type Express } from 'express';
|
|
2
|
+
import cors from 'cors';
|
|
3
|
+
import swaggerUi from 'swagger-ui-express';
|
|
4
|
+
import swaggerJsdoc from 'swagger-jsdoc';
|
|
5
|
+
import cartRouter from './routes/cart';
|
|
6
|
+
|
|
7
|
+
const app: Express = express();
|
|
8
|
+
const PORT: string = process.env.PORT ?? '3002';
|
|
9
|
+
|
|
10
|
+
// Swagger configuration
|
|
11
|
+
const swaggerOptions = {
|
|
12
|
+
definition: {
|
|
13
|
+
openapi: '3.0.0',
|
|
14
|
+
info: {
|
|
15
|
+
title: 'Cart Service API',
|
|
16
|
+
version: '1.0.0',
|
|
17
|
+
description: 'A cart management service with interactive documentation',
|
|
18
|
+
},
|
|
19
|
+
servers: [
|
|
20
|
+
{
|
|
21
|
+
url: `http://localhost:${PORT}`,
|
|
22
|
+
description: 'Development server',
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
apis: ['./src/routes/cart.ts'],
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const swaggerSpec = swaggerJsdoc(swaggerOptions);
|
|
30
|
+
|
|
31
|
+
// Middleware
|
|
32
|
+
app.use(
|
|
33
|
+
cors({
|
|
34
|
+
origin: '*',
|
|
35
|
+
}),
|
|
36
|
+
);
|
|
37
|
+
app.use(express.json());
|
|
38
|
+
|
|
39
|
+
// Swagger UI
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
|
+
app.use('/docs', ...(swaggerUi.serve as any), swaggerUi.setup(swaggerSpec) as any);
|
|
42
|
+
|
|
43
|
+
// Routes
|
|
44
|
+
app.use('/api/cart', cartRouter);
|
|
45
|
+
|
|
46
|
+
// Health check endpoint
|
|
47
|
+
app.get('/health', (req, res) => {
|
|
48
|
+
res.json({ status: 'OK', timestamp: new Date().toISOString() });
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Only start server if not in test environment
|
|
52
|
+
if (process.env.NODE_ENV !== 'test') {
|
|
53
|
+
app.listen(PORT, () => {
|
|
54
|
+
console.log(`Cart service running on port ${PORT}`);
|
|
55
|
+
console.log(`Swagger UI available at http://localhost:${PORT}/docs`);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export default app;
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import { Router, type Request, type Response } from 'express';
|
|
2
|
+
import type { Router as ExpressRouter } from 'express';
|
|
3
|
+
import { CartItem, cartSessions, calculateCartTotal, getOrCreateCartSession } from '../data/cart';
|
|
4
|
+
|
|
5
|
+
const router: ExpressRouter = Router();
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @swagger
|
|
9
|
+
* components:
|
|
10
|
+
* schemas:
|
|
11
|
+
* CartItem:
|
|
12
|
+
* type: object
|
|
13
|
+
* required:
|
|
14
|
+
* - productId
|
|
15
|
+
* - name
|
|
16
|
+
* - price
|
|
17
|
+
* - quantity
|
|
18
|
+
* properties:
|
|
19
|
+
* productId:
|
|
20
|
+
* type: string
|
|
21
|
+
* description: Unique identifier for the product
|
|
22
|
+
* name:
|
|
23
|
+
* type: string
|
|
24
|
+
* description: Product name
|
|
25
|
+
* price:
|
|
26
|
+
* type: number
|
|
27
|
+
* description: Product price in dollars
|
|
28
|
+
* quantity:
|
|
29
|
+
* type: number
|
|
30
|
+
* description: Quantity of the product in cart
|
|
31
|
+
* CartSession:
|
|
32
|
+
* type: object
|
|
33
|
+
* required:
|
|
34
|
+
* - sessionId
|
|
35
|
+
* - items
|
|
36
|
+
* - total
|
|
37
|
+
* - createdAt
|
|
38
|
+
* - updatedAt
|
|
39
|
+
* properties:
|
|
40
|
+
* sessionId:
|
|
41
|
+
* type: string
|
|
42
|
+
* description: Unique cart session identifier
|
|
43
|
+
* items:
|
|
44
|
+
* type: array
|
|
45
|
+
* items:
|
|
46
|
+
* $ref: '#/components/schemas/CartItem'
|
|
47
|
+
* description: Array of items in the cart
|
|
48
|
+
* total:
|
|
49
|
+
* type: number
|
|
50
|
+
* description: Total cost of all items in cart
|
|
51
|
+
* createdAt:
|
|
52
|
+
* type: string
|
|
53
|
+
* format: date-time
|
|
54
|
+
* description: When the cart session was created
|
|
55
|
+
* updatedAt:
|
|
56
|
+
* type: string
|
|
57
|
+
* format: date-time
|
|
58
|
+
* description: When the cart was last updated
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @swagger
|
|
63
|
+
* /api/cart/{sessionId}:
|
|
64
|
+
* get:
|
|
65
|
+
* summary: Get cart by session ID
|
|
66
|
+
* description: Retrieve the cart contents for a specific session
|
|
67
|
+
* tags: [Cart]
|
|
68
|
+
* parameters:
|
|
69
|
+
* - in: path
|
|
70
|
+
* name: sessionId
|
|
71
|
+
* required: true
|
|
72
|
+
* schema:
|
|
73
|
+
* type: string
|
|
74
|
+
* description: Cart session identifier
|
|
75
|
+
* responses:
|
|
76
|
+
* 200:
|
|
77
|
+
* description: Cart session details
|
|
78
|
+
* content:
|
|
79
|
+
* application/json:
|
|
80
|
+
* schema:
|
|
81
|
+
* $ref: '#/components/schemas/CartSession'
|
|
82
|
+
*/
|
|
83
|
+
router.get('/:sessionId', (req: Request, res: Response) => {
|
|
84
|
+
const { sessionId } = req.params as { sessionId: string };
|
|
85
|
+
const cartSession = getOrCreateCartSession(sessionId);
|
|
86
|
+
res.json(cartSession);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @swagger
|
|
91
|
+
* /api/cart/{sessionId}/add:
|
|
92
|
+
* post:
|
|
93
|
+
* summary: Add item to cart
|
|
94
|
+
* description: Add a product to the cart with specified quantity
|
|
95
|
+
* tags: [Cart]
|
|
96
|
+
* parameters:
|
|
97
|
+
* - in: path
|
|
98
|
+
* name: sessionId
|
|
99
|
+
* required: true
|
|
100
|
+
* schema:
|
|
101
|
+
* type: string
|
|
102
|
+
* description: Cart session identifier
|
|
103
|
+
* requestBody:
|
|
104
|
+
* required: true
|
|
105
|
+
* content:
|
|
106
|
+
* application/json:
|
|
107
|
+
* schema:
|
|
108
|
+
* type: object
|
|
109
|
+
* required:
|
|
110
|
+
* - productId
|
|
111
|
+
* - name
|
|
112
|
+
* - price
|
|
113
|
+
* - quantity
|
|
114
|
+
* properties:
|
|
115
|
+
* productId:
|
|
116
|
+
* type: string
|
|
117
|
+
* description: Product identifier
|
|
118
|
+
* name:
|
|
119
|
+
* type: string
|
|
120
|
+
* description: Product name
|
|
121
|
+
* price:
|
|
122
|
+
* type: number
|
|
123
|
+
* description: Product price
|
|
124
|
+
* quantity:
|
|
125
|
+
* type: number
|
|
126
|
+
* description: Quantity to add
|
|
127
|
+
* responses:
|
|
128
|
+
* 200:
|
|
129
|
+
* description: Item added to cart successfully
|
|
130
|
+
* content:
|
|
131
|
+
* application/json:
|
|
132
|
+
* schema:
|
|
133
|
+
* $ref: '#/components/schemas/CartSession'
|
|
134
|
+
* 400:
|
|
135
|
+
* description: Invalid request data
|
|
136
|
+
*/
|
|
137
|
+
router.post('/:sessionId/add', (req: Request, res: Response) => {
|
|
138
|
+
const { sessionId } = req.params as { sessionId: string };
|
|
139
|
+
const { productId, name, price, quantity } = req.body as {
|
|
140
|
+
productId: string;
|
|
141
|
+
name: string;
|
|
142
|
+
price: number;
|
|
143
|
+
quantity: number;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
if (!productId || !name || price === undefined || !quantity) {
|
|
147
|
+
return res.status(400).json({
|
|
148
|
+
error: 'Missing required fields: productId, name, price, quantity',
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (quantity <= 0) {
|
|
153
|
+
return res.status(400).json({ error: 'Quantity must be greater than 0' });
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const cartSession = getOrCreateCartSession(sessionId);
|
|
157
|
+
const existingItemIndex = cartSession.items.findIndex((item) => item.productId === productId);
|
|
158
|
+
|
|
159
|
+
if (existingItemIndex >= 0) {
|
|
160
|
+
// Update existing item quantity
|
|
161
|
+
cartSession.items[existingItemIndex].quantity += quantity;
|
|
162
|
+
} else {
|
|
163
|
+
// Add new item
|
|
164
|
+
const newItem: CartItem = { productId, name, price, quantity };
|
|
165
|
+
cartSession.items.push(newItem);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Update cart total and timestamp
|
|
169
|
+
cartSession.total = calculateCartTotal(cartSession.items);
|
|
170
|
+
cartSession.updatedAt = new Date().toISOString();
|
|
171
|
+
|
|
172
|
+
cartSessions.set(sessionId, cartSession);
|
|
173
|
+
res.json(cartSession);
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* @swagger
|
|
178
|
+
* /api/cart/{sessionId}/remove:
|
|
179
|
+
* post:
|
|
180
|
+
* summary: Remove item from cart
|
|
181
|
+
* description: Remove a product from the cart or reduce its quantity
|
|
182
|
+
* tags: [Cart]
|
|
183
|
+
* parameters:
|
|
184
|
+
* - in: path
|
|
185
|
+
* name: sessionId
|
|
186
|
+
* required: true
|
|
187
|
+
* schema:
|
|
188
|
+
* type: string
|
|
189
|
+
* description: Cart session identifier
|
|
190
|
+
* requestBody:
|
|
191
|
+
* required: true
|
|
192
|
+
* content:
|
|
193
|
+
* application/json:
|
|
194
|
+
* schema:
|
|
195
|
+
* type: object
|
|
196
|
+
* required:
|
|
197
|
+
* - productId
|
|
198
|
+
* - quantity
|
|
199
|
+
* properties:
|
|
200
|
+
* productId:
|
|
201
|
+
* type: string
|
|
202
|
+
* description: Product identifier to remove
|
|
203
|
+
* quantity:
|
|
204
|
+
* type: number
|
|
205
|
+
* description: Quantity to remove (optional, removes all if not specified)
|
|
206
|
+
* responses:
|
|
207
|
+
* 200:
|
|
208
|
+
* description: Item removed from cart successfully
|
|
209
|
+
* content:
|
|
210
|
+
* application/json:
|
|
211
|
+
* schema:
|
|
212
|
+
* $ref: '#/components/schemas/CartSession'
|
|
213
|
+
* 400:
|
|
214
|
+
* description: Invalid request data
|
|
215
|
+
* 404:
|
|
216
|
+
* description: Product not found in cart
|
|
217
|
+
*/
|
|
218
|
+
router.post('/:sessionId/remove', (req: Request, res: Response) => {
|
|
219
|
+
const { sessionId } = req.params as { sessionId: string };
|
|
220
|
+
const { productId, quantity } = req.body as {
|
|
221
|
+
productId: string;
|
|
222
|
+
quantity?: number;
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
if (!productId) {
|
|
226
|
+
return res.status(400).json({ error: 'productId is required' });
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const cartSession = getOrCreateCartSession(sessionId);
|
|
230
|
+
const itemIndex = cartSession.items.findIndex((item) => item.productId === productId);
|
|
231
|
+
|
|
232
|
+
if (itemIndex === -1) {
|
|
233
|
+
return res.status(404).json({ error: 'Product not found in cart' });
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const item = cartSession.items[itemIndex];
|
|
237
|
+
const removeQuantity = quantity ?? item.quantity;
|
|
238
|
+
|
|
239
|
+
if (removeQuantity >= item.quantity) {
|
|
240
|
+
// Remove entire item
|
|
241
|
+
cartSession.items.splice(itemIndex, 1);
|
|
242
|
+
} else {
|
|
243
|
+
// Reduce quantity
|
|
244
|
+
cartSession.items[itemIndex].quantity -= removeQuantity;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// Update cart total and timestamp
|
|
248
|
+
cartSession.total = calculateCartTotal(cartSession.items);
|
|
249
|
+
cartSession.updatedAt = new Date().toISOString();
|
|
250
|
+
|
|
251
|
+
cartSessions.set(sessionId, cartSession);
|
|
252
|
+
res.json(cartSession);
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* @swagger
|
|
257
|
+
* /api/cart/{sessionId}/clear:
|
|
258
|
+
* post:
|
|
259
|
+
* summary: Clear cart
|
|
260
|
+
* description: Remove all items from the cart
|
|
261
|
+
* tags: [Cart]
|
|
262
|
+
* parameters:
|
|
263
|
+
* - in: path
|
|
264
|
+
* name: sessionId
|
|
265
|
+
* required: true
|
|
266
|
+
* schema:
|
|
267
|
+
* type: string
|
|
268
|
+
* description: Cart session identifier
|
|
269
|
+
* responses:
|
|
270
|
+
* 200:
|
|
271
|
+
* description: Cart cleared successfully
|
|
272
|
+
* content:
|
|
273
|
+
* application/json:
|
|
274
|
+
* schema:
|
|
275
|
+
* $ref: '#/components/schemas/CartSession'
|
|
276
|
+
*/
|
|
277
|
+
router.post('/:sessionId/clear', (req: Request, res: Response) => {
|
|
278
|
+
const { sessionId } = req.params as { sessionId: string };
|
|
279
|
+
const cartSession = getOrCreateCartSession(sessionId);
|
|
280
|
+
|
|
281
|
+
cartSession.items = [];
|
|
282
|
+
cartSession.total = 0;
|
|
283
|
+
cartSession.updatedAt = new Date().toISOString();
|
|
284
|
+
|
|
285
|
+
cartSessions.set(sessionId, cartSession);
|
|
286
|
+
res.json(cartSession);
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
export default router;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> @auto-engineer/product-catalogue-integration@0.6.1 format /Users/sam/WebstormProjects/top/auto-engineer/integrations/product-catalogue
|
|
4
|
+
> prettier --write "**/*.{js,ts,json,md,yml,yaml}" --ignore-path ../../.prettierignore
|
|
5
|
+
|
|
6
|
+
CHANGELOG.md[2K[1G[90mCHANGELOG.md[39m 30ms (unchanged)
|
|
7
|
+
eslint.config.ts[2K[1G[90meslint.config.ts[39m 38ms (unchanged)
|
|
8
|
+
package.json[2K[1G[90mpackage.json[39m 22ms (unchanged)
|
|
9
|
+
src/index.ts[2K[1G[90msrc/index.ts[39m 1ms (unchanged)
|
|
10
|
+
src/product-catalogue-integration.ts[2K[1G[1A[2K[1G[90msrc/product-catalogue-integration.ts[39m 62ms (unchanged)
|
|
11
|
+
tsconfig.json[2K[1G[90mtsconfig.json[39m 1ms (unchanged)
|
|
12
|
+
tsconfig.test.json[2K[1G[90mtsconfig.test.json[39m 4ms (unchanged)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
> @auto-engineer/product-catalogue-integration@0.6.1 test /Users/sam/WebstormProjects/top/auto-engineer/integrations/product-catalogue
|
|
3
|
+
> vitest run
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
RUN v3.2.4 /Users/sam/WebstormProjects/top/auto-engineer/integrations/product-catalogue
|
|
7
|
+
|
|
8
|
+
No test files found, exiting with code 0
|
|
9
|
+
|
|
10
|
+
include: **/*.specs.{js,ts}
|
|
11
|
+
exclude: **/.tmp/**, **/node_modules/**, **/dist/**
|
|
12
|
+
|