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,232 @@
|
|
|
1
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
|
|
3
|
+
import type { Auth } from '../core/auth.gen';
|
|
4
|
+
import type {
|
|
5
|
+
Client as CoreClient,
|
|
6
|
+
Config as CoreConfig,
|
|
7
|
+
} from '../core/types.gen';
|
|
8
|
+
import type { Middleware } from './utils.gen';
|
|
9
|
+
|
|
10
|
+
export type ResponseStyle = 'data' | 'fields';
|
|
11
|
+
|
|
12
|
+
export interface Config<T extends ClientOptions = ClientOptions>
|
|
13
|
+
extends Omit<RequestInit, 'body' | 'headers' | 'method'>,
|
|
14
|
+
CoreConfig {
|
|
15
|
+
/**
|
|
16
|
+
* Base URL for all requests made by this client.
|
|
17
|
+
*/
|
|
18
|
+
baseUrl?: T['baseUrl'];
|
|
19
|
+
/**
|
|
20
|
+
* Fetch API implementation. You can use this option to provide a custom
|
|
21
|
+
* fetch instance.
|
|
22
|
+
*
|
|
23
|
+
* @default globalThis.fetch
|
|
24
|
+
*/
|
|
25
|
+
fetch?: (request: Request) => ReturnType<typeof fetch>;
|
|
26
|
+
/**
|
|
27
|
+
* Please don't use the Fetch client for Next.js applications. The `next`
|
|
28
|
+
* options won't have any effect.
|
|
29
|
+
*
|
|
30
|
+
* Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead.
|
|
31
|
+
*/
|
|
32
|
+
next?: never;
|
|
33
|
+
/**
|
|
34
|
+
* Return the response data parsed in a specified format. By default, `auto`
|
|
35
|
+
* will infer the appropriate method from the `Content-Type` response header.
|
|
36
|
+
* You can override this behavior with any of the {@link Body} methods.
|
|
37
|
+
* Select `stream` if you don't want to parse response data at all.
|
|
38
|
+
*
|
|
39
|
+
* @default 'auto'
|
|
40
|
+
*/
|
|
41
|
+
parseAs?:
|
|
42
|
+
| 'arrayBuffer'
|
|
43
|
+
| 'auto'
|
|
44
|
+
| 'blob'
|
|
45
|
+
| 'formData'
|
|
46
|
+
| 'json'
|
|
47
|
+
| 'stream'
|
|
48
|
+
| 'text';
|
|
49
|
+
/**
|
|
50
|
+
* Should we return only data or multiple fields (data, error, response, etc.)?
|
|
51
|
+
*
|
|
52
|
+
* @default 'fields'
|
|
53
|
+
*/
|
|
54
|
+
responseStyle?: ResponseStyle;
|
|
55
|
+
/**
|
|
56
|
+
* Throw an error instead of returning it in the response?
|
|
57
|
+
*
|
|
58
|
+
* @default false
|
|
59
|
+
*/
|
|
60
|
+
throwOnError?: T['throwOnError'];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface RequestOptions<
|
|
64
|
+
TResponseStyle extends ResponseStyle = 'fields',
|
|
65
|
+
ThrowOnError extends boolean = boolean,
|
|
66
|
+
Url extends string = string,
|
|
67
|
+
> extends Config<{
|
|
68
|
+
responseStyle: TResponseStyle;
|
|
69
|
+
throwOnError: ThrowOnError;
|
|
70
|
+
}> {
|
|
71
|
+
/**
|
|
72
|
+
* Any body that you want to add to your request.
|
|
73
|
+
*
|
|
74
|
+
* {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
|
|
75
|
+
*/
|
|
76
|
+
body?: unknown;
|
|
77
|
+
path?: Record<string, unknown>;
|
|
78
|
+
query?: Record<string, unknown>;
|
|
79
|
+
/**
|
|
80
|
+
* Security mechanism(s) to use for the request.
|
|
81
|
+
*/
|
|
82
|
+
security?: ReadonlyArray<Auth>;
|
|
83
|
+
url: Url;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface ResolvedRequestOptions<
|
|
87
|
+
TResponseStyle extends ResponseStyle = 'fields',
|
|
88
|
+
ThrowOnError extends boolean = boolean,
|
|
89
|
+
Url extends string = string,
|
|
90
|
+
> extends RequestOptions<TResponseStyle, ThrowOnError, Url> {
|
|
91
|
+
serializedBody?: string;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export type RequestResult<
|
|
95
|
+
TData = unknown,
|
|
96
|
+
TError = unknown,
|
|
97
|
+
ThrowOnError extends boolean = boolean,
|
|
98
|
+
TResponseStyle extends ResponseStyle = 'fields',
|
|
99
|
+
> = ThrowOnError extends true
|
|
100
|
+
? Promise<
|
|
101
|
+
TResponseStyle extends 'data'
|
|
102
|
+
? TData extends Record<string, unknown>
|
|
103
|
+
? TData[keyof TData]
|
|
104
|
+
: TData
|
|
105
|
+
: {
|
|
106
|
+
data: TData extends Record<string, unknown>
|
|
107
|
+
? TData[keyof TData]
|
|
108
|
+
: TData;
|
|
109
|
+
request: Request;
|
|
110
|
+
response: Response;
|
|
111
|
+
}
|
|
112
|
+
>
|
|
113
|
+
: Promise<
|
|
114
|
+
TResponseStyle extends 'data'
|
|
115
|
+
?
|
|
116
|
+
| (TData extends Record<string, unknown>
|
|
117
|
+
? TData[keyof TData]
|
|
118
|
+
: TData)
|
|
119
|
+
| undefined
|
|
120
|
+
: (
|
|
121
|
+
| {
|
|
122
|
+
data: TData extends Record<string, unknown>
|
|
123
|
+
? TData[keyof TData]
|
|
124
|
+
: TData;
|
|
125
|
+
error: undefined;
|
|
126
|
+
}
|
|
127
|
+
| {
|
|
128
|
+
data: undefined;
|
|
129
|
+
error: TError extends Record<string, unknown>
|
|
130
|
+
? TError[keyof TError]
|
|
131
|
+
: TError;
|
|
132
|
+
}
|
|
133
|
+
) & {
|
|
134
|
+
request: Request;
|
|
135
|
+
response: Response;
|
|
136
|
+
}
|
|
137
|
+
>;
|
|
138
|
+
|
|
139
|
+
export interface ClientOptions {
|
|
140
|
+
baseUrl?: string;
|
|
141
|
+
responseStyle?: ResponseStyle;
|
|
142
|
+
throwOnError?: boolean;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
type MethodFn = <
|
|
146
|
+
TData = unknown,
|
|
147
|
+
TError = unknown,
|
|
148
|
+
ThrowOnError extends boolean = false,
|
|
149
|
+
TResponseStyle extends ResponseStyle = 'fields',
|
|
150
|
+
>(
|
|
151
|
+
options: Omit<RequestOptions<TResponseStyle, ThrowOnError>, 'method'>,
|
|
152
|
+
) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
|
|
153
|
+
|
|
154
|
+
type RequestFn = <
|
|
155
|
+
TData = unknown,
|
|
156
|
+
TError = unknown,
|
|
157
|
+
ThrowOnError extends boolean = false,
|
|
158
|
+
TResponseStyle extends ResponseStyle = 'fields',
|
|
159
|
+
>(
|
|
160
|
+
options: Omit<RequestOptions<TResponseStyle, ThrowOnError>, 'method'> &
|
|
161
|
+
Pick<Required<RequestOptions<TResponseStyle, ThrowOnError>>, 'method'>,
|
|
162
|
+
) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
|
|
163
|
+
|
|
164
|
+
type BuildUrlFn = <
|
|
165
|
+
TData extends {
|
|
166
|
+
body?: unknown;
|
|
167
|
+
path?: Record<string, unknown>;
|
|
168
|
+
query?: Record<string, unknown>;
|
|
169
|
+
url: string;
|
|
170
|
+
},
|
|
171
|
+
>(
|
|
172
|
+
options: Pick<TData, 'url'> & Options<TData>,
|
|
173
|
+
) => string;
|
|
174
|
+
|
|
175
|
+
export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn> & {
|
|
176
|
+
interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* The `createClientConfig()` function will be called on client initialization
|
|
181
|
+
* and the returned object will become the client's initial configuration.
|
|
182
|
+
*
|
|
183
|
+
* You may want to initialize your client this way instead of calling
|
|
184
|
+
* `setConfig()`. This is useful for example if you're using Next.js
|
|
185
|
+
* to ensure your client always has the correct values.
|
|
186
|
+
*/
|
|
187
|
+
export type CreateClientConfig<T extends ClientOptions = ClientOptions> = (
|
|
188
|
+
override?: Config<ClientOptions & T>,
|
|
189
|
+
) => Config<Required<ClientOptions> & T>;
|
|
190
|
+
|
|
191
|
+
export interface TDataShape {
|
|
192
|
+
body?: unknown;
|
|
193
|
+
headers?: unknown;
|
|
194
|
+
path?: unknown;
|
|
195
|
+
query?: unknown;
|
|
196
|
+
url: string;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
|
|
200
|
+
|
|
201
|
+
export type Options<
|
|
202
|
+
TData extends TDataShape = TDataShape,
|
|
203
|
+
ThrowOnError extends boolean = boolean,
|
|
204
|
+
TResponseStyle extends ResponseStyle = 'fields',
|
|
205
|
+
> = OmitKeys<
|
|
206
|
+
RequestOptions<TResponseStyle, ThrowOnError>,
|
|
207
|
+
'body' | 'path' | 'query' | 'url'
|
|
208
|
+
> &
|
|
209
|
+
Omit<TData, 'url'>;
|
|
210
|
+
|
|
211
|
+
export type OptionsLegacyParser<
|
|
212
|
+
TData = unknown,
|
|
213
|
+
ThrowOnError extends boolean = boolean,
|
|
214
|
+
TResponseStyle extends ResponseStyle = 'fields',
|
|
215
|
+
> = TData extends { body?: any }
|
|
216
|
+
? TData extends { headers?: any }
|
|
217
|
+
? OmitKeys<
|
|
218
|
+
RequestOptions<TResponseStyle, ThrowOnError>,
|
|
219
|
+
'body' | 'headers' | 'url'
|
|
220
|
+
> &
|
|
221
|
+
TData
|
|
222
|
+
: OmitKeys<RequestOptions<TResponseStyle, ThrowOnError>, 'body' | 'url'> &
|
|
223
|
+
TData &
|
|
224
|
+
Pick<RequestOptions<TResponseStyle, ThrowOnError>, 'headers'>
|
|
225
|
+
: TData extends { headers?: any }
|
|
226
|
+
? OmitKeys<
|
|
227
|
+
RequestOptions<TResponseStyle, ThrowOnError>,
|
|
228
|
+
'headers' | 'url'
|
|
229
|
+
> &
|
|
230
|
+
TData &
|
|
231
|
+
Pick<RequestOptions<TResponseStyle, ThrowOnError>, 'body'>
|
|
232
|
+
: OmitKeys<RequestOptions<TResponseStyle, ThrowOnError>, 'url'> & TData;
|
|
@@ -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:3001'
|
|
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
|
+
};
|