├── .changeset ├── README.md └── config.json ├── .circleci └── config.yml ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ └── config.yml └── workflows │ ├── add_issues_to_project.yml │ ├── create-pr.yml │ ├── docs.yml │ ├── release.yml │ └── semgrep.yml ├── .gitignore ├── .husky ├── commit-msg └── pre-commit ├── .jest └── setEnvVars.js ├── .kodiak.toml ├── .nvmrc ├── .prettierignore ├── .prettierrc ├── .vscode └── settings.json ├── BEST_PRACTICES.md ├── CONTRIBUTING.md ├── GenerateSDK.md ├── LICENSE ├── Makefile ├── README.md ├── babel.config.js ├── changes.md ├── commitlint.config.js ├── esbuild.cjs ├── examples ├── browser │ └── browser.html ├── datadog-express-apm │ ├── container-agent │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── docker-compose.yml │ │ ├── env.sample │ │ ├── package.json │ │ ├── server.js │ │ ├── src │ │ │ ├── app.js │ │ │ ├── datadog.yaml │ │ │ ├── sdk-v3.js │ │ │ └── utils │ │ │ │ ├── request.js │ │ │ │ └── response.js │ │ └── yarn.lock │ └── host-agent │ │ ├── README.md │ │ ├── env.sample │ │ ├── install.sh │ │ ├── package.json │ │ ├── server.js │ │ ├── src │ │ ├── app.js │ │ └── sdk-v3.js │ │ ├── utils │ │ ├── request.js │ │ └── response.js │ │ └── yarn.lock ├── dynatrace-express-apm │ ├── .env.sample │ ├── README.md │ ├── install.sh │ ├── oneagent-metric.js │ ├── oneagent-tracer.js │ ├── package.json │ ├── server.js │ ├── src │ │ ├── app.js │ │ ├── controller │ │ │ ├── CartController.js │ │ │ ├── CartDiscountController.js │ │ │ ├── CustomerController.js │ │ │ ├── ProductController.js │ │ │ ├── ProjectController.js │ │ │ └── index.js │ │ ├── routes │ │ │ ├── cart-discount.js │ │ │ ├── cart.js │ │ │ ├── customer.js │ │ │ ├── index.js │ │ │ ├── product.js │ │ │ └── project.js │ │ ├── sdk-v3 │ │ │ └── sdk.js │ │ ├── service │ │ │ ├── CartDiscountService.js │ │ │ ├── CartService.js │ │ │ ├── CustomerService.js │ │ │ ├── ProductService.js │ │ │ ├── ProjectService.js │ │ │ └── index.js │ │ └── utils │ │ │ └── response.js │ └── yarn.lock ├── fastify │ ├── .env.sample │ ├── .gitignore │ ├── README.md │ ├── package.json │ ├── sdk.js │ └── server.js ├── jest.config.js ├── me │ ├── README.md │ ├── client │ │ ├── .babelrc │ │ ├── .gitignore │ │ ├── assets │ │ │ ├── cart.jpeg │ │ │ ├── profile.jpeg │ │ │ └── profile.png │ │ ├── cart.png │ │ ├── index.css │ │ ├── index.js │ │ ├── package.json │ │ ├── src │ │ │ ├── App.css │ │ │ ├── App.jsx │ │ │ ├── component │ │ │ │ ├── Cart.jsx │ │ │ │ ├── Details.jsx │ │ │ │ ├── Loader.jsx │ │ │ │ ├── Login.jsx │ │ │ │ ├── Merge.jsx │ │ │ │ ├── Modal.jsx │ │ │ │ ├── Nav.jsx │ │ │ │ ├── Product.jsx │ │ │ │ ├── ProductList.jsx │ │ │ │ ├── Search.css │ │ │ │ └── Search.jsx │ │ │ ├── constants │ │ │ │ └── index.js │ │ │ ├── index.html │ │ │ └── utils │ │ │ │ ├── TokenStorage.js │ │ │ │ ├── index.js │ │ │ │ └── sleep.js │ │ ├── store │ │ │ ├── api │ │ │ │ └── index.js │ │ │ ├── auth │ │ │ │ ├── authAction.js │ │ │ │ └── authReducer.js │ │ │ ├── cart │ │ │ │ ├── cartAction.js │ │ │ │ └── cartReducer.js │ │ │ ├── index.js │ │ │ ├── product │ │ │ │ ├── productAction.js │ │ │ │ └── productReducer.js │ │ │ └── rootReducer.js │ │ ├── webpack.config.js │ │ └── yarn.lock │ └── server │ │ ├── .gitignore │ │ ├── index.ts │ │ ├── package.json │ │ ├── src │ │ ├── app.ts │ │ ├── client │ │ │ ├── Client.ts │ │ │ └── index.ts │ │ ├── controller │ │ │ ├── CartController.ts │ │ │ ├── CustomerController.ts │ │ │ ├── ProductController.ts │ │ │ └── index.ts │ │ ├── middleware │ │ │ ├── Validator.ts │ │ │ └── index.ts │ │ ├── repository │ │ │ ├── CartRepository.ts │ │ │ ├── CustomerRepository.ts │ │ │ ├── ProductRepository.ts │ │ │ └── index.ts │ │ ├── routes │ │ │ ├── cart.ts │ │ │ ├── customer.ts │ │ │ ├── index.ts │ │ │ └── product.ts │ │ ├── service │ │ │ ├── CartService.ts │ │ │ ├── CustomerService.ts │ │ │ ├── ProductService.ts │ │ │ └── index.ts │ │ └── utils │ │ │ ├── Response.ts │ │ │ ├── UserInput.ts │ │ │ ├── helper.ts │ │ │ └── options.ts │ │ ├── tsconfig.json │ │ └── yarn.lock ├── newrelic-express-apm │ ├── .env.sample │ ├── README.md │ ├── agent.js │ ├── newrelic.js │ ├── opentelemetry.js │ ├── package.json │ ├── requests.txt │ ├── server.js │ ├── src │ │ ├── app.js │ │ ├── controller │ │ │ ├── CartController.js │ │ │ ├── CartDiscountController.js │ │ │ ├── CustomerController.js │ │ │ ├── ProductController.js │ │ │ ├── ProjectController.js │ │ │ └── index.js │ │ ├── routes │ │ │ ├── cart-discount.js │ │ │ ├── cart.js │ │ │ ├── customer.js │ │ │ ├── index.js │ │ │ ├── product.js │ │ │ └── project.js │ │ ├── sdk-v3 │ │ │ └── sdk.js │ │ ├── service │ │ │ ├── CartDiscountService.js │ │ │ ├── CartService.js │ │ │ ├── CustomerService.js │ │ │ ├── ProductService.js │ │ │ ├── ProjectService.js │ │ │ └── index.js │ │ └── utils │ │ │ ├── request.js │ │ │ └── response.js │ └── yarn.lock ├── node │ └── node.js ├── package.json ├── react-esbuild │ ├── esbuild.config.js │ ├── index.html │ ├── package.json │ ├── src │ │ ├── App.tsx │ │ └── lib │ │ │ ├── ClientBuilder.ts │ │ │ └── index.ts │ └── yarn.lock ├── react-vite │ ├── index.html │ ├── package.json │ ├── public │ │ └── vite.svg │ ├── src │ │ ├── App.css │ │ ├── App.tsx │ │ ├── assets │ │ │ └── react.svg │ │ ├── index.css │ │ ├── lib │ │ │ ├── ClientBuilder.ts │ │ │ └── index.ts │ │ ├── main.tsx │ │ └── vite-env.d.ts │ ├── tsconfig.json │ ├── tsconfig.node.json │ ├── vite.config.ts │ └── yarn.lock ├── react-webpack │ ├── .babelrc │ ├── index.css │ ├── index.js │ ├── package.json │ ├── src │ │ ├── App.css │ │ ├── App.jsx │ │ ├── index.html │ │ └── lib │ │ │ ├── ClientBuilder.js │ │ │ └── index.js │ ├── webpack.config.js │ └── yarn.lock ├── test │ ├── browser.test.js │ ├── fixture.js │ └── node.test.js ├── vue-example-app │ ├── .gitignore │ ├── .vscode │ │ ├── extensions.json │ │ └── settings.json │ ├── README.md │ ├── bun.lock │ ├── env.d.ts │ ├── index.html │ ├── package.json │ ├── public │ │ └── favicon.ico │ ├── screenshot.png │ ├── shim.d.ts │ ├── src │ │ ├── App.vue │ │ ├── assets │ │ │ ├── base.css │ │ │ ├── logo.svg │ │ │ └── main.css │ │ ├── components │ │ │ ├── Button.vue │ │ │ └── DemoProject.vue │ │ ├── main.ts │ │ └── sdk │ │ │ └── index.ts │ ├── tsconfig.app.json │ ├── tsconfig.json │ ├── tsconfig.node.json │ └── vite.config.ts └── yarn.lock ├── global.d.ts ├── jest.config.js ├── lerna.json ├── package.json ├── packages ├── Makefile ├── history-sdk │ ├── CHANGELOG.md │ ├── README.md │ ├── package.json │ ├── src │ │ ├── ctp │ │ │ └── ctp-client.ts │ │ ├── generated │ │ │ ├── client │ │ │ │ ├── api-root.ts │ │ │ │ ├── by-project-key-by-resource-type-by-id-request-builder.ts │ │ │ │ ├── by-project-key-by-resource-type-request-builder.ts │ │ │ │ ├── by-project-key-request-builder.ts │ │ │ │ └── graphql │ │ │ │ │ └── by-project-key-graphql-request-builder.ts │ │ │ ├── index.ts │ │ │ ├── models │ │ │ │ ├── cart-discount.ts │ │ │ │ ├── change-history.ts │ │ │ │ ├── change-value.ts │ │ │ │ ├── change.ts │ │ │ │ ├── common.ts │ │ │ │ ├── graph-ql.ts │ │ │ │ ├── label.ts │ │ │ │ └── scalar-types.ts │ │ │ └── shared │ │ │ │ └── utils │ │ │ │ ├── common-types.ts │ │ │ │ ├── middleware.ts │ │ │ │ ├── requests-utils.ts │ │ │ │ └── uri-utils.ts │ │ └── index.ts │ ├── test │ │ ├── fixtures │ │ │ ├── product_fixtures.ts │ │ │ └── product_type_fixtures.ts │ │ ├── generated │ │ │ └── client │ │ │ │ ├── by-project-key-by-resource-type-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-by-resource-type-request-builder.test.ts │ │ │ │ ├── by-project-key-request-builder.test.ts │ │ │ │ └── graphql │ │ │ │ └── by-project-key-graphql-request-builder.test.ts │ │ ├── helpers │ │ │ ├── api-helpers.ts │ │ │ ├── ctp-api-helper.ts │ │ │ └── test-utils.ts │ │ ├── misc.test.ts │ │ ├── request-with-method.ts │ │ └── utils │ │ │ └── uri-utils.test.ts │ ├── tsconfig-declarations.json │ ├── tsconfig.json │ └── typedoc.json ├── importapi-sdk │ ├── CHANGELOG.md │ ├── README.md │ ├── package.json │ ├── src │ │ ├── ctp │ │ │ └── ctp-client.ts │ │ ├── generated │ │ │ ├── client │ │ │ │ ├── api-root.ts │ │ │ │ ├── by-project-key-request-builder.ts │ │ │ │ ├── categories │ │ │ │ │ └── by-project-key-categories-request-builder.ts │ │ │ │ ├── customers │ │ │ │ │ └── by-project-key-customers-request-builder.ts │ │ │ │ ├── discount-codes │ │ │ │ │ └── by-project-key-discount-codes-request-builder.ts │ │ │ │ ├── import-containers │ │ │ │ │ ├── by-project-key-categories-import-containers-by-import-container-key-request-builder.ts │ │ │ │ │ ├── by-project-key-categories-import-containers-request-builder.ts │ │ │ │ │ ├── by-project-key-customers-import-containers-by-import-container-key-request-builder.ts │ │ │ │ │ ├── by-project-key-customers-import-containers-request-builder.ts │ │ │ │ │ ├── by-project-key-discount-codes-import-containers-by-import-container-key-request-builder.ts │ │ │ │ │ ├── by-project-key-discount-codes-import-containers-request-builder.ts │ │ │ │ │ ├── by-project-key-import-containers-by-import-container-key-request-builder.ts │ │ │ │ │ ├── by-project-key-import-containers-request-builder.ts │ │ │ │ │ ├── by-project-key-inventories-import-containers-by-import-container-key-request-builder.ts │ │ │ │ │ ├── by-project-key-inventories-import-containers-request-builder.ts │ │ │ │ │ ├── by-project-key-order-patches-import-containers-by-import-container-key-request-builder.ts │ │ │ │ │ ├── by-project-key-order-patches-import-containers-request-builder.ts │ │ │ │ │ ├── by-project-key-orders-import-containers-by-import-container-key-request-builder.ts │ │ │ │ │ ├── by-project-key-orders-import-containers-request-builder.ts │ │ │ │ │ ├── by-project-key-prices-import-containers-by-import-container-key-request-builder.ts │ │ │ │ │ ├── by-project-key-prices-import-containers-request-builder.ts │ │ │ │ │ ├── by-project-key-product-drafts-import-containers-by-import-container-key-request-builder.ts │ │ │ │ │ ├── by-project-key-product-drafts-import-containers-request-builder.ts │ │ │ │ │ ├── by-project-key-product-types-import-containers-by-import-container-key-request-builder.ts │ │ │ │ │ ├── by-project-key-product-types-import-containers-request-builder.ts │ │ │ │ │ ├── by-project-key-product-variant-patches-import-containers-by-import-container-key-request-builder.ts │ │ │ │ │ ├── by-project-key-product-variant-patches-import-containers-request-builder.ts │ │ │ │ │ ├── by-project-key-product-variants-import-containers-by-import-container-key-request-builder.ts │ │ │ │ │ ├── by-project-key-product-variants-import-containers-request-builder.ts │ │ │ │ │ ├── by-project-key-products-import-containers-by-import-container-key-request-builder.ts │ │ │ │ │ ├── by-project-key-products-import-containers-request-builder.ts │ │ │ │ │ ├── by-project-key-standalone-prices-import-containers-by-import-container-key-request-builder.ts │ │ │ │ │ ├── by-project-key-standalone-prices-import-containers-request-builder.ts │ │ │ │ │ ├── by-project-key-types-import-containers-by-import-container-key-request-builder.ts │ │ │ │ │ └── by-project-key-types-import-containers-request-builder.ts │ │ │ │ ├── import-operations │ │ │ │ │ ├── by-project-key-import-containers-by-import-container-key-import-operations-request-builder.ts │ │ │ │ │ ├── by-project-key-import-operations-by-id-request-builder.ts │ │ │ │ │ └── by-project-key-import-operations-request-builder.ts │ │ │ │ ├── import-summaries │ │ │ │ │ └── by-project-key-import-containers-by-import-container-key-import-summaries-request-builder.ts │ │ │ │ ├── inventories │ │ │ │ │ └── by-project-key-inventories-request-builder.ts │ │ │ │ ├── order-patches │ │ │ │ │ └── by-project-key-order-patches-request-builder.ts │ │ │ │ ├── orders │ │ │ │ │ └── by-project-key-orders-request-builder.ts │ │ │ │ ├── prices │ │ │ │ │ └── by-project-key-prices-request-builder.ts │ │ │ │ ├── product-drafts │ │ │ │ │ └── by-project-key-product-drafts-request-builder.ts │ │ │ │ ├── product-types │ │ │ │ │ └── by-project-key-product-types-request-builder.ts │ │ │ │ ├── product-variant-patches │ │ │ │ │ └── by-project-key-product-variant-patches-request-builder.ts │ │ │ │ ├── product-variants │ │ │ │ │ └── by-project-key-product-variants-request-builder.ts │ │ │ │ ├── products │ │ │ │ │ └── by-project-key-products-request-builder.ts │ │ │ │ ├── standalone-prices │ │ │ │ │ └── by-project-key-standalone-prices-request-builder.ts │ │ │ │ └── types │ │ │ │ │ └── by-project-key-types-request-builder.ts │ │ │ ├── index.ts │ │ │ ├── models │ │ │ │ ├── categories.ts │ │ │ │ ├── common.ts │ │ │ │ ├── customers.ts │ │ │ │ ├── customfields.ts │ │ │ │ ├── discount-codes.ts │ │ │ │ ├── errors.ts │ │ │ │ ├── importcontainers.ts │ │ │ │ ├── importoperations.ts │ │ │ │ ├── importrequests.ts │ │ │ │ ├── importsummaries.ts │ │ │ │ ├── inventories.ts │ │ │ │ ├── order-patches.ts │ │ │ │ ├── orders.ts │ │ │ │ ├── prices.ts │ │ │ │ ├── productdrafts.ts │ │ │ │ ├── products.ts │ │ │ │ ├── producttypes.ts │ │ │ │ ├── productvariants.ts │ │ │ │ ├── standalone-prices.ts │ │ │ │ └── types.ts │ │ │ └── shared │ │ │ │ └── utils │ │ │ │ ├── common-types.ts │ │ │ │ ├── middleware.ts │ │ │ │ ├── requests-utils.ts │ │ │ │ └── uri-utils.ts │ │ └── index.ts │ ├── test │ │ ├── generated │ │ │ └── client │ │ │ │ ├── by-project-key-request-builder.test.ts │ │ │ │ ├── categories │ │ │ │ └── by-project-key-categories-request-builder.test.ts │ │ │ │ ├── customers │ │ │ │ └── by-project-key-customers-request-builder.test.ts │ │ │ │ ├── discount-codes │ │ │ │ └── by-project-key-discount-codes-request-builder.test.ts │ │ │ │ ├── import-containers │ │ │ │ ├── by-project-key-categories-import-containers-by-import-container-key-request-builder.test.ts │ │ │ │ ├── by-project-key-categories-import-containers-request-builder.test.ts │ │ │ │ ├── by-project-key-customers-import-containers-by-import-container-key-request-builder.test.ts │ │ │ │ ├── by-project-key-customers-import-containers-request-builder.test.ts │ │ │ │ ├── by-project-key-discount-codes-import-containers-by-import-container-key-request-builder.test.ts │ │ │ │ ├── by-project-key-discount-codes-import-containers-request-builder.test.ts │ │ │ │ ├── by-project-key-import-containers-by-import-container-key-request-builder.test.ts │ │ │ │ ├── by-project-key-import-containers-request-builder.test.ts │ │ │ │ ├── by-project-key-inventories-import-containers-by-import-container-key-request-builder.test.ts │ │ │ │ ├── by-project-key-inventories-import-containers-request-builder.test.ts │ │ │ │ ├── by-project-key-order-patches-import-containers-by-import-container-key-request-builder.test.ts │ │ │ │ ├── by-project-key-order-patches-import-containers-request-builder.test.ts │ │ │ │ ├── by-project-key-orders-import-containers-by-import-container-key-request-builder.test.ts │ │ │ │ ├── by-project-key-orders-import-containers-request-builder.test.ts │ │ │ │ ├── by-project-key-prices-import-containers-by-import-container-key-request-builder.test.ts │ │ │ │ ├── by-project-key-prices-import-containers-request-builder.test.ts │ │ │ │ ├── by-project-key-product-drafts-import-containers-by-import-container-key-request-builder.test.ts │ │ │ │ ├── by-project-key-product-drafts-import-containers-request-builder.test.ts │ │ │ │ ├── by-project-key-product-types-import-containers-by-import-container-key-request-builder.test.ts │ │ │ │ ├── by-project-key-product-types-import-containers-request-builder.test.ts │ │ │ │ ├── by-project-key-product-variant-patches-import-containers-by-import-container-key-request-builder.test.ts │ │ │ │ ├── by-project-key-product-variant-patches-import-containers-request-builder.test.ts │ │ │ │ ├── by-project-key-product-variants-import-containers-by-import-container-key-request-builder.test.ts │ │ │ │ ├── by-project-key-product-variants-import-containers-request-builder.test.ts │ │ │ │ ├── by-project-key-products-import-containers-by-import-container-key-request-builder.test.ts │ │ │ │ ├── by-project-key-products-import-containers-request-builder.test.ts │ │ │ │ ├── by-project-key-standalone-prices-import-containers-by-import-container-key-request-builder.test.ts │ │ │ │ ├── by-project-key-standalone-prices-import-containers-request-builder.test.ts │ │ │ │ ├── by-project-key-types-import-containers-by-import-container-key-request-builder.test.ts │ │ │ │ └── by-project-key-types-import-containers-request-builder.test.ts │ │ │ │ ├── import-operations │ │ │ │ ├── by-project-key-import-containers-by-import-container-key-import-operations-request-builder.test.ts │ │ │ │ ├── by-project-key-import-operations-by-id-request-builder.test.ts │ │ │ │ └── by-project-key-import-operations-request-builder.test.ts │ │ │ │ ├── import-summaries │ │ │ │ └── by-project-key-import-containers-by-import-container-key-import-summaries-request-builder.test.ts │ │ │ │ ├── inventories │ │ │ │ └── by-project-key-inventories-request-builder.test.ts │ │ │ │ ├── order-patches │ │ │ │ └── by-project-key-order-patches-request-builder.test.ts │ │ │ │ ├── orders │ │ │ │ └── by-project-key-orders-request-builder.test.ts │ │ │ │ ├── prices │ │ │ │ └── by-project-key-prices-request-builder.test.ts │ │ │ │ ├── product-drafts │ │ │ │ └── by-project-key-product-drafts-request-builder.test.ts │ │ │ │ ├── product-types │ │ │ │ └── by-project-key-product-types-request-builder.test.ts │ │ │ │ ├── product-variant-patches │ │ │ │ └── by-project-key-product-variant-patches-request-builder.test.ts │ │ │ │ ├── product-variants │ │ │ │ └── by-project-key-product-variants-request-builder.test.ts │ │ │ │ ├── products │ │ │ │ └── by-project-key-products-request-builder.test.ts │ │ │ │ ├── standalone-prices │ │ │ │ └── by-project-key-standalone-prices-request-builder.test.ts │ │ │ │ └── types │ │ │ │ └── by-project-key-types-request-builder.test.ts │ │ ├── helpers │ │ │ ├── ctp-api-helper.ts │ │ │ └── test-utils.ts │ │ ├── integration │ │ │ └── import.test.ts │ │ ├── misc.test.ts │ │ ├── request-with-method.ts │ │ └── utils │ │ │ └── uri-utils.test.ts │ ├── tsconfig-declarations.json │ ├── tsconfig.json │ └── typedoc.json ├── platform-sdk │ ├── CHANGELOG.md │ ├── README.md │ ├── package.json │ ├── src │ │ ├── ctp │ │ │ └── ctp-client.ts │ │ ├── generated │ │ │ ├── client │ │ │ │ ├── active-cart │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-me-active-cart-request-builder.ts │ │ │ │ │ └── by-project-key-me-active-cart-request-builder.ts │ │ │ │ ├── api-clients │ │ │ │ │ ├── by-project-key-api-clients-by-id-request-builder.ts │ │ │ │ │ └── by-project-key-api-clients-request-builder.ts │ │ │ │ ├── api-root.ts │ │ │ │ ├── apply │ │ │ │ │ └── by-project-key-orders-edits-by-id-apply-request-builder.ts │ │ │ │ ├── approval-flows │ │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-approval-flows-by-id-request-builder.ts │ │ │ │ │ └── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-approval-flows-request-builder.ts │ │ │ │ ├── approval-rules │ │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-approval-rules-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-approval-rules-key-by-key-request-builder.ts │ │ │ │ │ └── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-approval-rules-request-builder.ts │ │ │ │ ├── as-associate │ │ │ │ │ ├── by-project-key-as-associate-by-associate-id-request-builder.ts │ │ │ │ │ └── by-project-key-as-associate-request-builder.ts │ │ │ │ ├── associate-roles │ │ │ │ │ ├── by-project-key-associate-roles-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-associate-roles-key-by-key-request-builder.ts │ │ │ │ │ └── by-project-key-associate-roles-request-builder.ts │ │ │ │ ├── associates │ │ │ │ │ ├── by-project-key-business-units-by-business-unit-id-associates-by-associate-id-request-builder.ts │ │ │ │ │ ├── by-project-key-business-units-key-by-key-associates-by-associate-id-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-business-units-by-business-unit-id-associates-by-associate-id-request-builder.ts │ │ │ │ │ └── by-project-key-in-store-key-by-store-key-business-units-key-by-key-associates-by-associate-id-request-builder.ts │ │ │ │ ├── attribute-groups │ │ │ │ │ ├── by-project-key-attribute-groups-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-attribute-groups-key-by-key-request-builder.ts │ │ │ │ │ └── by-project-key-attribute-groups-request-builder.ts │ │ │ │ ├── business-units │ │ │ │ │ ├── by-project-key-as-associate-by-associate-id-business-units-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-as-associate-by-associate-id-business-units-key-by-key-request-builder.ts │ │ │ │ │ ├── by-project-key-as-associate-by-associate-id-business-units-request-builder.ts │ │ │ │ │ ├── by-project-key-business-units-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-business-units-key-by-key-request-builder.ts │ │ │ │ │ ├── by-project-key-business-units-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-business-units-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-business-units-key-by-key-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-business-units-request-builder.ts │ │ │ │ │ ├── by-project-key-me-business-units-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-me-business-units-key-by-key-request-builder.ts │ │ │ │ │ └── by-project-key-me-business-units-request-builder.ts │ │ │ │ ├── by-project-key-request-builder.ts │ │ │ │ ├── cart-discounts │ │ │ │ │ ├── by-project-key-cart-discounts-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-cart-discounts-key-by-key-request-builder.ts │ │ │ │ │ ├── by-project-key-cart-discounts-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-cart-discounts-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-cart-discounts-key-by-key-request-builder.ts │ │ │ │ │ └── by-project-key-in-store-key-by-store-key-cart-discounts-request-builder.ts │ │ │ │ ├── carts │ │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-carts-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-carts-key-by-key-request-builder.ts │ │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-carts-request-builder.ts │ │ │ │ │ ├── by-project-key-carts-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-carts-customer-id-by-customer-id-request-builder.ts │ │ │ │ │ ├── by-project-key-carts-key-by-key-request-builder.ts │ │ │ │ │ ├── by-project-key-carts-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-carts-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-carts-customer-id-by-customer-id-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-carts-key-by-key-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-carts-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-me-carts-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-me-carts-request-builder.ts │ │ │ │ │ ├── by-project-key-me-carts-by-id-request-builder.ts │ │ │ │ │ └── by-project-key-me-carts-request-builder.ts │ │ │ │ ├── categories │ │ │ │ │ ├── by-project-key-categories-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-categories-key-by-key-request-builder.ts │ │ │ │ │ └── by-project-key-categories-request-builder.ts │ │ │ │ ├── channels │ │ │ │ │ ├── by-project-key-channels-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-channels-key-by-key-request-builder.ts │ │ │ │ │ └── by-project-key-channels-request-builder.ts │ │ │ │ ├── confirm │ │ │ │ │ ├── by-project-key-customers-email-confirm-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-customers-email-confirm-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-me-email-confirm-request-builder.ts │ │ │ │ │ └── by-project-key-me-email-confirm-request-builder.ts │ │ │ │ ├── custom-objects │ │ │ │ │ ├── by-project-key-custom-objects-by-container-by-key-request-builder.ts │ │ │ │ │ ├── by-project-key-custom-objects-by-container-request-builder.ts │ │ │ │ │ └── by-project-key-custom-objects-request-builder.ts │ │ │ │ ├── customer-groups │ │ │ │ │ ├── by-project-key-customer-groups-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-customer-groups-key-by-key-request-builder.ts │ │ │ │ │ └── by-project-key-customer-groups-request-builder.ts │ │ │ │ ├── customers │ │ │ │ │ ├── by-project-key-customers-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-customers-email-token-by-email-token-request-builder.ts │ │ │ │ │ ├── by-project-key-customers-key-by-key-request-builder.ts │ │ │ │ │ ├── by-project-key-customers-password-token-by-password-token-request-builder.ts │ │ │ │ │ ├── by-project-key-customers-request-builder.ts │ │ │ │ │ ├── by-project-key-in-business-unit-key-by-business-unit-key-me-customers-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-customers-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-customers-email-token-by-email-token-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-customers-key-by-key-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-customers-password-token-by-password-token-request-builder.ts │ │ │ │ │ └── by-project-key-in-store-key-by-store-key-customers-request-builder.ts │ │ │ │ ├── discount-codes │ │ │ │ │ ├── by-project-key-discount-codes-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-discount-codes-key-by-key-request-builder.ts │ │ │ │ │ └── by-project-key-discount-codes-request-builder.ts │ │ │ │ ├── edits │ │ │ │ │ ├── by-project-key-orders-edits-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-orders-edits-key-by-key-request-builder.ts │ │ │ │ │ └── by-project-key-orders-edits-request-builder.ts │ │ │ │ ├── email-token │ │ │ │ │ ├── by-project-key-customers-email-token-request-builder.ts │ │ │ │ │ └── by-project-key-in-store-key-by-store-key-customers-email-token-request-builder.ts │ │ │ │ ├── extensions │ │ │ │ │ ├── by-project-key-extensions-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-extensions-key-by-key-request-builder.ts │ │ │ │ │ └── by-project-key-extensions-request-builder.ts │ │ │ │ ├── graphql │ │ │ │ │ └── by-project-key-graphql-request-builder.ts │ │ │ │ ├── health │ │ │ │ │ └── by-project-key-subscriptions-by-id-health-request-builder.ts │ │ │ │ ├── images │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-products-by-product-id-product-tailoring-images-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-products-key-by-product-key-product-tailoring-images-request-builder.ts │ │ │ │ │ └── by-project-key-products-by-id-images-request-builder.ts │ │ │ │ ├── import │ │ │ │ │ └── by-project-key-orders-import-request-builder.ts │ │ │ │ ├── in-business-unit │ │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-request-builder.ts │ │ │ │ │ └── by-project-key-in-business-unit-key-by-business-unit-key-request-builder.ts │ │ │ │ ├── in-store │ │ │ │ │ └── by-project-key-in-store-key-by-store-key-request-builder.ts │ │ │ │ ├── indexing-status │ │ │ │ │ ├── by-project-key-business-units-search-indexing-status-request-builder.ts │ │ │ │ │ └── by-project-key-customers-search-indexing-status-request-builder.ts │ │ │ │ ├── inventory │ │ │ │ │ ├── by-project-key-inventory-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-inventory-key-by-key-request-builder.ts │ │ │ │ │ └── by-project-key-inventory-request-builder.ts │ │ │ │ ├── login │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-login-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-me-login-request-builder.ts │ │ │ │ │ ├── by-project-key-login-request-builder.ts │ │ │ │ │ └── by-project-key-me-login-request-builder.ts │ │ │ │ ├── matching-cart-location │ │ │ │ │ └── by-project-key-shipping-methods-matching-cart-location-request-builder.ts │ │ │ │ ├── matching-cart │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-shipping-methods-matching-cart-request-builder.ts │ │ │ │ │ └── by-project-key-shipping-methods-matching-cart-request-builder.ts │ │ │ │ ├── matching-location │ │ │ │ │ └── by-project-key-shipping-methods-matching-location-request-builder.ts │ │ │ │ ├── matching-orderedit │ │ │ │ │ └── by-project-key-shipping-methods-matching-orderedit-request-builder.ts │ │ │ │ ├── matching │ │ │ │ │ └── by-project-key-product-discounts-matching-request-builder.ts │ │ │ │ ├── me │ │ │ │ │ ├── by-project-key-in-business-unit-key-by-business-unit-key-me-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-me-request-builder.ts │ │ │ │ │ └── by-project-key-me-request-builder.ts │ │ │ │ ├── messages │ │ │ │ │ ├── by-project-key-messages-by-id-request-builder.ts │ │ │ │ │ └── by-project-key-messages-request-builder.ts │ │ │ │ ├── orders │ │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-orders-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-orders-order-number-by-order-number-request-builder.ts │ │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-orders-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-me-orders-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-me-orders-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-orders-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-orders-order-number-by-order-number-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-orders-request-builder.ts │ │ │ │ │ ├── by-project-key-me-orders-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-me-orders-request-builder.ts │ │ │ │ │ ├── by-project-key-orders-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-orders-order-number-by-order-number-request-builder.ts │ │ │ │ │ └── by-project-key-orders-request-builder.ts │ │ │ │ ├── password-token │ │ │ │ │ ├── by-project-key-customers-password-token-request-builder.ts │ │ │ │ │ └── by-project-key-in-store-key-by-store-key-customers-password-token-request-builder.ts │ │ │ │ ├── password │ │ │ │ │ ├── by-project-key-customers-password-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-customers-password-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-me-password-request-builder.ts │ │ │ │ │ └── by-project-key-me-password-request-builder.ts │ │ │ │ ├── payments │ │ │ │ │ ├── by-project-key-me-payments-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-me-payments-request-builder.ts │ │ │ │ │ ├── by-project-key-payments-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-payments-key-by-key-request-builder.ts │ │ │ │ │ └── by-project-key-payments-request-builder.ts │ │ │ │ ├── product-discounts │ │ │ │ │ ├── by-project-key-product-discounts-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-product-discounts-key-by-key-request-builder.ts │ │ │ │ │ └── by-project-key-product-discounts-request-builder.ts │ │ │ │ ├── product-projections │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-product-projections-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-product-projections-key-by-key-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-product-projections-request-builder.ts │ │ │ │ │ ├── by-project-key-product-projections-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-product-projections-key-by-key-request-builder.ts │ │ │ │ │ └── by-project-key-product-projections-request-builder.ts │ │ │ │ ├── product-selection-assignments │ │ │ │ │ └── by-project-key-in-store-key-by-store-key-product-selection-assignments-request-builder.ts │ │ │ │ ├── product-selections │ │ │ │ │ ├── by-project-key-product-selections-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-product-selections-key-by-key-request-builder.ts │ │ │ │ │ ├── by-project-key-product-selections-request-builder.ts │ │ │ │ │ ├── by-project-key-products-by-id-product-selections-request-builder.ts │ │ │ │ │ └── by-project-key-products-key-by-key-product-selections-request-builder.ts │ │ │ │ ├── product-tailoring │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-product-tailoring-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-products-by-product-id-product-tailoring-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-products-key-by-product-key-product-tailoring-request-builder.ts │ │ │ │ │ ├── by-project-key-product-tailoring-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-product-tailoring-key-by-key-request-builder.ts │ │ │ │ │ └── by-project-key-product-tailoring-request-builder.ts │ │ │ │ ├── product-types │ │ │ │ │ ├── by-project-key-product-types-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-product-types-key-by-key-request-builder.ts │ │ │ │ │ └── by-project-key-product-types-request-builder.ts │ │ │ │ ├── products │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-products-by-product-id-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-products-key-by-product-key-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-products-request-builder.ts │ │ │ │ │ ├── by-project-key-product-selections-by-id-products-request-builder.ts │ │ │ │ │ ├── by-project-key-product-selections-key-by-key-products-request-builder.ts │ │ │ │ │ ├── by-project-key-products-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-products-key-by-key-request-builder.ts │ │ │ │ │ └── by-project-key-products-request-builder.ts │ │ │ │ ├── quote-requests │ │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-quote-requests-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-quote-requests-key-by-key-request-builder.ts │ │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-quote-requests-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-quote-requests-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-quote-requests-key-by-key-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-quote-requests-request-builder.ts │ │ │ │ │ ├── by-project-key-me-quote-requests-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-me-quote-requests-key-by-key-request-builder.ts │ │ │ │ │ ├── by-project-key-me-quote-requests-request-builder.ts │ │ │ │ │ ├── by-project-key-quote-requests-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-quote-requests-key-by-key-request-builder.ts │ │ │ │ │ └── by-project-key-quote-requests-request-builder.ts │ │ │ │ ├── quotes │ │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-orders-quotes-request-builder.ts │ │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-quotes-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-quotes-key-by-key-request-builder.ts │ │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-quotes-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-orders-quotes-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-quotes-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-quotes-key-by-key-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-quotes-request-builder.ts │ │ │ │ │ ├── by-project-key-me-orders-quotes-request-builder.ts │ │ │ │ │ ├── by-project-key-me-quotes-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-me-quotes-key-by-key-request-builder.ts │ │ │ │ │ ├── by-project-key-me-quotes-request-builder.ts │ │ │ │ │ ├── by-project-key-orders-quotes-request-builder.ts │ │ │ │ │ ├── by-project-key-quotes-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-quotes-key-by-key-request-builder.ts │ │ │ │ │ └── by-project-key-quotes-request-builder.ts │ │ │ │ ├── replicate │ │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-carts-replicate-request-builder.ts │ │ │ │ │ ├── by-project-key-carts-replicate-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-carts-replicate-request-builder.ts │ │ │ │ │ └── by-project-key-me-carts-replicate-request-builder.ts │ │ │ │ ├── reset │ │ │ │ │ ├── by-project-key-customers-password-reset-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-customers-password-reset-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-me-password-reset-request-builder.ts │ │ │ │ │ └── by-project-key-me-password-reset-request-builder.ts │ │ │ │ ├── reviews │ │ │ │ │ ├── by-project-key-reviews-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-reviews-key-by-key-request-builder.ts │ │ │ │ │ └── by-project-key-reviews-request-builder.ts │ │ │ │ ├── search │ │ │ │ │ ├── by-project-key-business-units-search-request-builder.ts │ │ │ │ │ ├── by-project-key-customers-search-request-builder.ts │ │ │ │ │ ├── by-project-key-orders-search-request-builder.ts │ │ │ │ │ ├── by-project-key-product-projections-search-request-builder.ts │ │ │ │ │ └── by-project-key-products-search-request-builder.ts │ │ │ │ ├── shipping-methods │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-shipping-methods-request-builder.ts │ │ │ │ │ ├── by-project-key-shipping-methods-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-shipping-methods-key-by-key-request-builder.ts │ │ │ │ │ └── by-project-key-shipping-methods-request-builder.ts │ │ │ │ ├── shopping-lists │ │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-shopping-lists-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-shopping-lists-key-by-key-request-builder.ts │ │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-shopping-lists-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-me-shopping-lists-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-me-shopping-lists-key-by-key-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-me-shopping-lists-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-shopping-lists-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-shopping-lists-key-by-key-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-shopping-lists-request-builder.ts │ │ │ │ │ ├── by-project-key-me-shopping-lists-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-me-shopping-lists-key-by-key-request-builder.ts │ │ │ │ │ ├── by-project-key-me-shopping-lists-request-builder.ts │ │ │ │ │ ├── by-project-key-shopping-lists-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-shopping-lists-key-by-key-request-builder.ts │ │ │ │ │ └── by-project-key-shopping-lists-request-builder.ts │ │ │ │ ├── signup │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-me-signup-request-builder.ts │ │ │ │ │ └── by-project-key-me-signup-request-builder.ts │ │ │ │ ├── staged-quotes │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-staged-quotes-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-staged-quotes-key-by-key-request-builder.ts │ │ │ │ │ ├── by-project-key-in-store-key-by-store-key-staged-quotes-request-builder.ts │ │ │ │ │ ├── by-project-key-staged-quotes-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-staged-quotes-key-by-key-request-builder.ts │ │ │ │ │ └── by-project-key-staged-quotes-request-builder.ts │ │ │ │ ├── standalone-prices │ │ │ │ │ ├── by-project-key-standalone-prices-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-standalone-prices-key-by-key-request-builder.ts │ │ │ │ │ └── by-project-key-standalone-prices-request-builder.ts │ │ │ │ ├── states │ │ │ │ │ ├── by-project-key-states-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-states-key-by-key-request-builder.ts │ │ │ │ │ └── by-project-key-states-request-builder.ts │ │ │ │ ├── stores │ │ │ │ │ ├── by-project-key-stores-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-stores-key-by-key-request-builder.ts │ │ │ │ │ └── by-project-key-stores-request-builder.ts │ │ │ │ ├── subscriptions │ │ │ │ │ ├── by-project-key-subscriptions-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-subscriptions-key-by-key-request-builder.ts │ │ │ │ │ └── by-project-key-subscriptions-request-builder.ts │ │ │ │ ├── suggest │ │ │ │ │ └── by-project-key-product-projections-suggest-request-builder.ts │ │ │ │ ├── tax-categories │ │ │ │ │ ├── by-project-key-tax-categories-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-tax-categories-key-by-key-request-builder.ts │ │ │ │ │ └── by-project-key-tax-categories-request-builder.ts │ │ │ │ ├── types │ │ │ │ │ ├── by-project-key-types-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-types-key-by-key-request-builder.ts │ │ │ │ │ └── by-project-key-types-request-builder.ts │ │ │ │ └── zones │ │ │ │ │ ├── by-project-key-zones-by-id-request-builder.ts │ │ │ │ │ ├── by-project-key-zones-key-by-key-request-builder.ts │ │ │ │ │ └── by-project-key-zones-request-builder.ts │ │ │ ├── index.ts │ │ │ ├── models │ │ │ │ ├── api-client.ts │ │ │ │ ├── approval-flow.ts │ │ │ │ ├── approval-rule.ts │ │ │ │ ├── associate-role.ts │ │ │ │ ├── attribute-group.ts │ │ │ │ ├── business-unit-search.ts │ │ │ │ ├── business-unit.ts │ │ │ │ ├── cart-discount.ts │ │ │ │ ├── cart.ts │ │ │ │ ├── category.ts │ │ │ │ ├── channel.ts │ │ │ │ ├── common.ts │ │ │ │ ├── custom-object.ts │ │ │ │ ├── customer-group.ts │ │ │ │ ├── customer-search.ts │ │ │ │ ├── customer.ts │ │ │ │ ├── discount-code.ts │ │ │ │ ├── error.ts │ │ │ │ ├── event.ts │ │ │ │ ├── extension.ts │ │ │ │ ├── graph-ql.ts │ │ │ │ ├── inventory.ts │ │ │ │ ├── me.ts │ │ │ │ ├── message.ts │ │ │ │ ├── order-edit.ts │ │ │ │ ├── order.ts │ │ │ │ ├── payment.ts │ │ │ │ ├── product-discount.ts │ │ │ │ ├── product-search.ts │ │ │ │ ├── product-selection.ts │ │ │ │ ├── product-tailoring.ts │ │ │ │ ├── product-type.ts │ │ │ │ ├── product.ts │ │ │ │ ├── project.ts │ │ │ │ ├── quote-request.ts │ │ │ │ ├── quote.ts │ │ │ │ ├── review.ts │ │ │ │ ├── scalar-types.ts │ │ │ │ ├── search.ts │ │ │ │ ├── shipping-method.ts │ │ │ │ ├── shopping-list.ts │ │ │ │ ├── staged-quote.ts │ │ │ │ ├── standalone-price.ts │ │ │ │ ├── state.ts │ │ │ │ ├── store-country.ts │ │ │ │ ├── store.ts │ │ │ │ ├── subscription.ts │ │ │ │ ├── tax-category.ts │ │ │ │ ├── type.ts │ │ │ │ ├── warning.ts │ │ │ │ └── zone.ts │ │ │ └── shared │ │ │ │ └── utils │ │ │ │ ├── common-types.ts │ │ │ │ ├── middleware.ts │ │ │ │ ├── requests-utils.ts │ │ │ │ └── uri-utils.ts │ │ └── index.ts │ ├── test │ │ ├── __setup__ │ │ │ └── setup.js │ │ ├── check-project.test.ts │ │ ├── generated │ │ │ └── client │ │ │ │ ├── active-cart │ │ │ │ ├── by-project-key-in-store-key-by-store-key-me-active-cart-request-builder.test.ts │ │ │ │ └── by-project-key-me-active-cart-request-builder.test.ts │ │ │ │ ├── api-clients │ │ │ │ ├── by-project-key-api-clients-by-id-request-builder.test.ts │ │ │ │ └── by-project-key-api-clients-request-builder.test.ts │ │ │ │ ├── apply │ │ │ │ └── by-project-key-orders-edits-by-id-apply-request-builder.test.ts │ │ │ │ ├── approval-flows │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-approval-flows-by-id-request-builder.test.ts │ │ │ │ └── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-approval-flows-request-builder.test.ts │ │ │ │ ├── approval-rules │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-approval-rules-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-approval-rules-key-by-key-request-builder.test.ts │ │ │ │ └── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-approval-rules-request-builder.test.ts │ │ │ │ ├── as-associate │ │ │ │ ├── by-project-key-as-associate-by-associate-id-request-builder.test.ts │ │ │ │ └── by-project-key-as-associate-request-builder.test.ts │ │ │ │ ├── associate-roles │ │ │ │ ├── by-project-key-associate-roles-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-associate-roles-key-by-key-request-builder.test.ts │ │ │ │ └── by-project-key-associate-roles-request-builder.test.ts │ │ │ │ ├── associates │ │ │ │ ├── by-project-key-business-units-by-business-unit-id-associates-by-associate-id-request-builder.test.ts │ │ │ │ ├── by-project-key-business-units-key-by-key-associates-by-associate-id-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-business-units-by-business-unit-id-associates-by-associate-id-request-builder.test.ts │ │ │ │ └── by-project-key-in-store-key-by-store-key-business-units-key-by-key-associates-by-associate-id-request-builder.test.ts │ │ │ │ ├── attribute-groups │ │ │ │ ├── by-project-key-attribute-groups-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-attribute-groups-key-by-key-request-builder.test.ts │ │ │ │ └── by-project-key-attribute-groups-request-builder.test.ts │ │ │ │ ├── business-units │ │ │ │ ├── by-project-key-as-associate-by-associate-id-business-units-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-as-associate-by-associate-id-business-units-key-by-key-request-builder.test.ts │ │ │ │ ├── by-project-key-as-associate-by-associate-id-business-units-request-builder.test.ts │ │ │ │ ├── by-project-key-business-units-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-business-units-key-by-key-request-builder.test.ts │ │ │ │ ├── by-project-key-business-units-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-business-units-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-business-units-key-by-key-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-business-units-request-builder.test.ts │ │ │ │ ├── by-project-key-me-business-units-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-me-business-units-key-by-key-request-builder.test.ts │ │ │ │ └── by-project-key-me-business-units-request-builder.test.ts │ │ │ │ ├── by-project-key-request-builder.test.ts │ │ │ │ ├── cart-discounts │ │ │ │ ├── by-project-key-cart-discounts-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-cart-discounts-key-by-key-request-builder.test.ts │ │ │ │ ├── by-project-key-cart-discounts-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-cart-discounts-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-cart-discounts-key-by-key-request-builder.test.ts │ │ │ │ └── by-project-key-in-store-key-by-store-key-cart-discounts-request-builder.test.ts │ │ │ │ ├── carts │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-carts-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-carts-key-by-key-request-builder.test.ts │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-carts-request-builder.test.ts │ │ │ │ ├── by-project-key-carts-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-carts-customer-id-by-customer-id-request-builder.test.ts │ │ │ │ ├── by-project-key-carts-key-by-key-request-builder.test.ts │ │ │ │ ├── by-project-key-carts-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-carts-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-carts-customer-id-by-customer-id-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-carts-key-by-key-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-carts-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-me-carts-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-me-carts-request-builder.test.ts │ │ │ │ ├── by-project-key-me-carts-by-id-request-builder.test.ts │ │ │ │ └── by-project-key-me-carts-request-builder.test.ts │ │ │ │ ├── categories │ │ │ │ ├── by-project-key-categories-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-categories-key-by-key-request-builder.test.ts │ │ │ │ └── by-project-key-categories-request-builder.test.ts │ │ │ │ ├── channels │ │ │ │ ├── by-project-key-channels-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-channels-key-by-key-request-builder.test.ts │ │ │ │ └── by-project-key-channels-request-builder.test.ts │ │ │ │ ├── confirm │ │ │ │ ├── by-project-key-customers-email-confirm-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-customers-email-confirm-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-me-email-confirm-request-builder.test.ts │ │ │ │ └── by-project-key-me-email-confirm-request-builder.test.ts │ │ │ │ ├── custom-objects │ │ │ │ ├── by-project-key-custom-objects-by-container-by-key-request-builder.test.ts │ │ │ │ ├── by-project-key-custom-objects-by-container-request-builder.test.ts │ │ │ │ └── by-project-key-custom-objects-request-builder.test.ts │ │ │ │ ├── customer-groups │ │ │ │ ├── by-project-key-customer-groups-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-customer-groups-key-by-key-request-builder.test.ts │ │ │ │ └── by-project-key-customer-groups-request-builder.test.ts │ │ │ │ ├── customers │ │ │ │ ├── by-project-key-customers-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-customers-email-token-by-email-token-request-builder.test.ts │ │ │ │ ├── by-project-key-customers-key-by-key-request-builder.test.ts │ │ │ │ ├── by-project-key-customers-password-token-by-password-token-request-builder.test.ts │ │ │ │ ├── by-project-key-customers-request-builder.test.ts │ │ │ │ ├── by-project-key-in-business-unit-key-by-business-unit-key-me-customers-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-customers-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-customers-email-token-by-email-token-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-customers-key-by-key-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-customers-password-token-by-password-token-request-builder.test.ts │ │ │ │ └── by-project-key-in-store-key-by-store-key-customers-request-builder.test.ts │ │ │ │ ├── discount-codes │ │ │ │ ├── by-project-key-discount-codes-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-discount-codes-key-by-key-request-builder.test.ts │ │ │ │ └── by-project-key-discount-codes-request-builder.test.ts │ │ │ │ ├── edits │ │ │ │ ├── by-project-key-orders-edits-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-orders-edits-key-by-key-request-builder.test.ts │ │ │ │ └── by-project-key-orders-edits-request-builder.test.ts │ │ │ │ ├── email-token │ │ │ │ ├── by-project-key-customers-email-token-request-builder.test.ts │ │ │ │ └── by-project-key-in-store-key-by-store-key-customers-email-token-request-builder.test.ts │ │ │ │ ├── extensions │ │ │ │ ├── by-project-key-extensions-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-extensions-key-by-key-request-builder.test.ts │ │ │ │ └── by-project-key-extensions-request-builder.test.ts │ │ │ │ ├── graphql │ │ │ │ └── by-project-key-graphql-request-builder.test.ts │ │ │ │ ├── health │ │ │ │ └── by-project-key-subscriptions-by-id-health-request-builder.test.ts │ │ │ │ ├── images │ │ │ │ ├── by-project-key-in-store-key-by-store-key-products-by-product-id-product-tailoring-images-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-products-key-by-product-key-product-tailoring-images-request-builder.test.ts │ │ │ │ └── by-project-key-products-by-id-images-request-builder.test.ts │ │ │ │ ├── import │ │ │ │ └── by-project-key-orders-import-request-builder.test.ts │ │ │ │ ├── in-business-unit │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-request-builder.test.ts │ │ │ │ └── by-project-key-in-business-unit-key-by-business-unit-key-request-builder.test.ts │ │ │ │ ├── in-store │ │ │ │ └── by-project-key-in-store-key-by-store-key-request-builder.test.ts │ │ │ │ ├── indexing-status │ │ │ │ ├── by-project-key-business-units-search-indexing-status-request-builder.test.ts │ │ │ │ └── by-project-key-customers-search-indexing-status-request-builder.test.ts │ │ │ │ ├── inventory │ │ │ │ ├── by-project-key-inventory-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-inventory-key-by-key-request-builder.test.ts │ │ │ │ └── by-project-key-inventory-request-builder.test.ts │ │ │ │ ├── login │ │ │ │ ├── by-project-key-in-store-key-by-store-key-login-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-me-login-request-builder.test.ts │ │ │ │ ├── by-project-key-login-request-builder.test.ts │ │ │ │ └── by-project-key-me-login-request-builder.test.ts │ │ │ │ ├── matching-cart-location │ │ │ │ └── by-project-key-shipping-methods-matching-cart-location-request-builder.test.ts │ │ │ │ ├── matching-cart │ │ │ │ ├── by-project-key-in-store-key-by-store-key-shipping-methods-matching-cart-request-builder.test.ts │ │ │ │ └── by-project-key-shipping-methods-matching-cart-request-builder.test.ts │ │ │ │ ├── matching-location │ │ │ │ └── by-project-key-shipping-methods-matching-location-request-builder.test.ts │ │ │ │ ├── matching-orderedit │ │ │ │ └── by-project-key-shipping-methods-matching-orderedit-request-builder.test.ts │ │ │ │ ├── matching │ │ │ │ └── by-project-key-product-discounts-matching-request-builder.test.ts │ │ │ │ ├── me │ │ │ │ ├── by-project-key-in-business-unit-key-by-business-unit-key-me-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-me-request-builder.test.ts │ │ │ │ └── by-project-key-me-request-builder.test.ts │ │ │ │ ├── messages │ │ │ │ ├── by-project-key-messages-by-id-request-builder.test.ts │ │ │ │ └── by-project-key-messages-request-builder.test.ts │ │ │ │ ├── orders │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-orders-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-orders-order-number-by-order-number-request-builder.test.ts │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-orders-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-me-orders-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-me-orders-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-orders-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-orders-order-number-by-order-number-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-orders-request-builder.test.ts │ │ │ │ ├── by-project-key-me-orders-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-me-orders-request-builder.test.ts │ │ │ │ ├── by-project-key-orders-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-orders-order-number-by-order-number-request-builder.test.ts │ │ │ │ └── by-project-key-orders-request-builder.test.ts │ │ │ │ ├── password-token │ │ │ │ ├── by-project-key-customers-password-token-request-builder.test.ts │ │ │ │ └── by-project-key-in-store-key-by-store-key-customers-password-token-request-builder.test.ts │ │ │ │ ├── password │ │ │ │ ├── by-project-key-customers-password-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-customers-password-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-me-password-request-builder.test.ts │ │ │ │ └── by-project-key-me-password-request-builder.test.ts │ │ │ │ ├── payments │ │ │ │ ├── by-project-key-me-payments-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-me-payments-request-builder.test.ts │ │ │ │ ├── by-project-key-payments-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-payments-key-by-key-request-builder.test.ts │ │ │ │ └── by-project-key-payments-request-builder.test.ts │ │ │ │ ├── product-discounts │ │ │ │ ├── by-project-key-product-discounts-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-product-discounts-key-by-key-request-builder.test.ts │ │ │ │ └── by-project-key-product-discounts-request-builder.test.ts │ │ │ │ ├── product-projections │ │ │ │ ├── by-project-key-in-store-key-by-store-key-product-projections-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-product-projections-key-by-key-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-product-projections-request-builder.test.ts │ │ │ │ ├── by-project-key-product-projections-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-product-projections-key-by-key-request-builder.test.ts │ │ │ │ └── by-project-key-product-projections-request-builder.test.ts │ │ │ │ ├── product-selection-assignments │ │ │ │ └── by-project-key-in-store-key-by-store-key-product-selection-assignments-request-builder.test.ts │ │ │ │ ├── product-selections │ │ │ │ ├── by-project-key-product-selections-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-product-selections-key-by-key-request-builder.test.ts │ │ │ │ ├── by-project-key-product-selections-request-builder.test.ts │ │ │ │ ├── by-project-key-products-by-id-product-selections-request-builder.test.ts │ │ │ │ └── by-project-key-products-key-by-key-product-selections-request-builder.test.ts │ │ │ │ ├── product-tailoring │ │ │ │ ├── by-project-key-in-store-key-by-store-key-product-tailoring-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-products-by-product-id-product-tailoring-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-products-key-by-product-key-product-tailoring-request-builder.test.ts │ │ │ │ ├── by-project-key-product-tailoring-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-product-tailoring-key-by-key-request-builder.test.ts │ │ │ │ └── by-project-key-product-tailoring-request-builder.test.ts │ │ │ │ ├── product-types │ │ │ │ ├── by-project-key-product-types-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-product-types-key-by-key-request-builder.test.ts │ │ │ │ └── by-project-key-product-types-request-builder.test.ts │ │ │ │ ├── products │ │ │ │ ├── by-project-key-in-store-key-by-store-key-products-by-product-id-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-products-key-by-product-key-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-products-request-builder.test.ts │ │ │ │ ├── by-project-key-product-selections-by-id-products-request-builder.test.ts │ │ │ │ ├── by-project-key-product-selections-key-by-key-products-request-builder.test.ts │ │ │ │ ├── by-project-key-products-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-products-key-by-key-request-builder.test.ts │ │ │ │ └── by-project-key-products-request-builder.test.ts │ │ │ │ ├── quote-requests │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-quote-requests-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-quote-requests-key-by-key-request-builder.test.ts │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-quote-requests-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-quote-requests-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-quote-requests-key-by-key-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-quote-requests-request-builder.test.ts │ │ │ │ ├── by-project-key-me-quote-requests-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-me-quote-requests-key-by-key-request-builder.test.ts │ │ │ │ ├── by-project-key-me-quote-requests-request-builder.test.ts │ │ │ │ ├── by-project-key-quote-requests-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-quote-requests-key-by-key-request-builder.test.ts │ │ │ │ └── by-project-key-quote-requests-request-builder.test.ts │ │ │ │ ├── quotes │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-orders-quotes-request-builder.test.ts │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-quotes-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-quotes-key-by-key-request-builder.test.ts │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-quotes-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-orders-quotes-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-quotes-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-quotes-key-by-key-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-quotes-request-builder.test.ts │ │ │ │ ├── by-project-key-me-orders-quotes-request-builder.test.ts │ │ │ │ ├── by-project-key-me-quotes-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-me-quotes-key-by-key-request-builder.test.ts │ │ │ │ ├── by-project-key-me-quotes-request-builder.test.ts │ │ │ │ ├── by-project-key-orders-quotes-request-builder.test.ts │ │ │ │ ├── by-project-key-quotes-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-quotes-key-by-key-request-builder.test.ts │ │ │ │ └── by-project-key-quotes-request-builder.test.ts │ │ │ │ ├── replicate │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-carts-replicate-request-builder.test.ts │ │ │ │ ├── by-project-key-carts-replicate-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-carts-replicate-request-builder.test.ts │ │ │ │ └── by-project-key-me-carts-replicate-request-builder.test.ts │ │ │ │ ├── reset │ │ │ │ ├── by-project-key-customers-password-reset-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-customers-password-reset-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-me-password-reset-request-builder.test.ts │ │ │ │ └── by-project-key-me-password-reset-request-builder.test.ts │ │ │ │ ├── reviews │ │ │ │ ├── by-project-key-reviews-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-reviews-key-by-key-request-builder.test.ts │ │ │ │ └── by-project-key-reviews-request-builder.test.ts │ │ │ │ ├── search │ │ │ │ ├── by-project-key-business-units-search-request-builder.test.ts │ │ │ │ ├── by-project-key-customers-search-request-builder.test.ts │ │ │ │ ├── by-project-key-orders-search-request-builder.test.ts │ │ │ │ ├── by-project-key-product-projections-search-request-builder.test.ts │ │ │ │ └── by-project-key-products-search-request-builder.test.ts │ │ │ │ ├── shipping-methods │ │ │ │ ├── by-project-key-in-store-key-by-store-key-shipping-methods-request-builder.test.ts │ │ │ │ ├── by-project-key-shipping-methods-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-shipping-methods-key-by-key-request-builder.test.ts │ │ │ │ └── by-project-key-shipping-methods-request-builder.test.ts │ │ │ │ ├── shopping-lists │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-shopping-lists-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-shopping-lists-key-by-key-request-builder.test.ts │ │ │ │ ├── by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-shopping-lists-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-me-shopping-lists-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-me-shopping-lists-key-by-key-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-me-shopping-lists-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-shopping-lists-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-shopping-lists-key-by-key-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-shopping-lists-request-builder.test.ts │ │ │ │ ├── by-project-key-me-shopping-lists-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-me-shopping-lists-key-by-key-request-builder.test.ts │ │ │ │ ├── by-project-key-me-shopping-lists-request-builder.test.ts │ │ │ │ ├── by-project-key-shopping-lists-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-shopping-lists-key-by-key-request-builder.test.ts │ │ │ │ └── by-project-key-shopping-lists-request-builder.test.ts │ │ │ │ ├── signup │ │ │ │ ├── by-project-key-in-store-key-by-store-key-me-signup-request-builder.test.ts │ │ │ │ └── by-project-key-me-signup-request-builder.test.ts │ │ │ │ ├── staged-quotes │ │ │ │ ├── by-project-key-in-store-key-by-store-key-staged-quotes-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-staged-quotes-key-by-key-request-builder.test.ts │ │ │ │ ├── by-project-key-in-store-key-by-store-key-staged-quotes-request-builder.test.ts │ │ │ │ ├── by-project-key-staged-quotes-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-staged-quotes-key-by-key-request-builder.test.ts │ │ │ │ └── by-project-key-staged-quotes-request-builder.test.ts │ │ │ │ ├── standalone-prices │ │ │ │ ├── by-project-key-standalone-prices-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-standalone-prices-key-by-key-request-builder.test.ts │ │ │ │ └── by-project-key-standalone-prices-request-builder.test.ts │ │ │ │ ├── states │ │ │ │ ├── by-project-key-states-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-states-key-by-key-request-builder.test.ts │ │ │ │ └── by-project-key-states-request-builder.test.ts │ │ │ │ ├── stores │ │ │ │ ├── by-project-key-stores-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-stores-key-by-key-request-builder.test.ts │ │ │ │ └── by-project-key-stores-request-builder.test.ts │ │ │ │ ├── subscriptions │ │ │ │ ├── by-project-key-subscriptions-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-subscriptions-key-by-key-request-builder.test.ts │ │ │ │ └── by-project-key-subscriptions-request-builder.test.ts │ │ │ │ ├── suggest │ │ │ │ └── by-project-key-product-projections-suggest-request-builder.test.ts │ │ │ │ ├── tax-categories │ │ │ │ ├── by-project-key-tax-categories-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-tax-categories-key-by-key-request-builder.test.ts │ │ │ │ └── by-project-key-tax-categories-request-builder.test.ts │ │ │ │ ├── types │ │ │ │ ├── by-project-key-types-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-types-key-by-key-request-builder.test.ts │ │ │ │ └── by-project-key-types-request-builder.test.ts │ │ │ │ └── zones │ │ │ │ ├── by-project-key-zones-by-id-request-builder.test.ts │ │ │ │ ├── by-project-key-zones-key-by-key-request-builder.test.ts │ │ │ │ └── by-project-key-zones-request-builder.test.ts │ │ ├── helpers │ │ │ ├── ctp-api-helper.ts │ │ │ └── test-utils.ts │ │ ├── integration-tests │ │ │ ├── cart-discount │ │ │ │ ├── cart-discount-fixture.ts │ │ │ │ └── cart-discount.test.ts │ │ │ ├── cart │ │ │ │ ├── cart-fixture.ts │ │ │ │ ├── cart.me.test.ts │ │ │ │ └── cart.test.ts │ │ │ ├── category │ │ │ │ ├── category-fixture.ts │ │ │ │ └── category.test.ts │ │ │ ├── channel │ │ │ │ ├── channel-fixture.ts │ │ │ │ └── channel.test.ts │ │ │ ├── client │ │ │ │ └── client.test.ts │ │ │ ├── custom-object │ │ │ │ ├── custom-object-fixture.ts │ │ │ │ └── custom-object.test.ts │ │ │ ├── customer-group │ │ │ │ ├── customer-group-fixture.ts │ │ │ │ └── customer-group.test.ts │ │ │ ├── customer │ │ │ │ ├── customer-fixture.ts │ │ │ │ ├── customer.me.test.ts │ │ │ │ └── customer.test.ts │ │ │ ├── discount-code │ │ │ │ ├── discount-code-fixture.ts │ │ │ │ └── discount-code.test.ts │ │ │ ├── extension │ │ │ │ ├── extension-fixture.ts │ │ │ │ └── extension.test.ts │ │ │ ├── graphql │ │ │ │ └── graphql.test.ts │ │ │ ├── inventory │ │ │ │ ├── inventory-fixture.ts │ │ │ │ └── inventory.test.ts │ │ │ ├── message │ │ │ │ └── message.test.ts │ │ │ ├── order │ │ │ │ ├── order-fixture.ts │ │ │ │ └── order.test.ts │ │ │ ├── payment │ │ │ │ ├── payment-fixture.ts │ │ │ │ └── payment.test.ts │ │ │ ├── process │ │ │ │ └── process.test.ts │ │ │ ├── product-discount │ │ │ │ ├── product-discount-fixture.ts │ │ │ │ └── product-discount.test.ts │ │ │ ├── product-projection │ │ │ │ └── product-projection.test.ts │ │ │ ├── product-type │ │ │ │ ├── product-type-fixture.ts │ │ │ │ └── product-type.test.ts │ │ │ ├── product │ │ │ │ ├── product-fixture.ts │ │ │ │ ├── product.test.ts │ │ │ │ └── resources │ │ │ │ │ └── image.jpeg │ │ │ ├── project │ │ │ │ └── project.test.ts │ │ │ ├── review │ │ │ │ ├── review-fixture.ts │ │ │ │ └── review.test.ts │ │ │ ├── sdk-v3 │ │ │ │ ├── concurrent-processing.test.ts │ │ │ │ ├── error-cases.test.ts │ │ │ │ ├── image.test.ts │ │ │ │ ├── middlewares.test.ts │ │ │ │ ├── misc.test.ts │ │ │ │ ├── response-serialization.test.ts │ │ │ │ └── telemetry.test.ts │ │ │ ├── shipping-method │ │ │ │ ├── shipping-method-fixture.ts │ │ │ │ └── shipping-method.test.ts │ │ │ ├── shopping-list │ │ │ │ ├── shopping-list-fixture.ts │ │ │ │ └── shopping-list.test.ts │ │ │ ├── standalone-prices │ │ │ │ ├── standalone-prices-fixtures.ts │ │ │ │ └── standalone-prices.test.ts │ │ │ ├── state │ │ │ │ ├── state-fixture.ts │ │ │ │ └── state.test.ts │ │ │ ├── store │ │ │ │ ├── store-fixture.ts │ │ │ │ └── store.test.ts │ │ │ ├── subscription │ │ │ │ └── subscription-fixture.ts │ │ │ ├── tax-category │ │ │ │ ├── tax-category-fixture.ts │ │ │ │ └── tax-category.test.ts │ │ │ ├── test-utils.ts │ │ │ ├── type │ │ │ │ ├── type-fixture.ts │ │ │ │ └── type.test.ts │ │ │ └── zone │ │ │ │ ├── zone-fixture.ts │ │ │ │ └── zone.test.ts │ │ ├── request-utils.spec.ts │ │ └── request-with-method.ts │ ├── tsconfig-declarations.json │ ├── tsconfig.json │ └── typedoc.json ├── sdk-client-v3 │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src │ │ ├── client │ │ │ ├── builder.ts │ │ │ ├── client.ts │ │ │ └── index.ts │ │ ├── index.ts │ │ ├── middleware │ │ │ ├── auth-middleware │ │ │ │ ├── anonymous-session-flow.ts │ │ │ │ ├── auth-request-builder.ts │ │ │ │ ├── auth-request-executor.ts │ │ │ │ ├── auth-request-processor.ts │ │ │ │ ├── client-credentials-flow.ts │ │ │ │ ├── existing-token-flow.ts │ │ │ │ ├── index.ts │ │ │ │ ├── password-flow.ts │ │ │ │ └── refresh-token-flow.ts │ │ │ ├── create-concurrent-modification-middleware.ts │ │ │ ├── create-correlation-id-middleware.ts │ │ │ ├── create-error-middleware.ts │ │ │ ├── create-http-middleware.ts │ │ │ ├── create-logger-middleware.ts │ │ │ ├── create-queue-middleware.ts │ │ │ ├── create-user-agent-middleware.ts │ │ │ └── index.ts │ │ ├── types │ │ │ └── types.d.ts │ │ └── utils │ │ │ ├── byteLength.ts │ │ │ ├── constants.ts │ │ │ ├── createError.ts │ │ │ ├── errors.ts │ │ │ ├── executor.ts │ │ │ ├── generateID.ts │ │ │ ├── headers.ts │ │ │ ├── index.ts │ │ │ ├── isBuffer.ts │ │ │ ├── logger.ts │ │ │ ├── maskAuthData.ts │ │ │ ├── mergeAuthHeader.ts │ │ │ ├── methods.ts │ │ │ ├── retryDelay.ts │ │ │ ├── sleep.ts │ │ │ ├── tokenCacheKey.ts │ │ │ ├── tokenExpirationTime.ts │ │ │ ├── tokenStore.ts │ │ │ ├── url.ts │ │ │ ├── userAgent.ts │ │ │ └── validate.ts │ ├── tests │ │ ├── auth │ │ │ ├── anonymous-flow.test.ts │ │ │ ├── auth-request-executor.test.ts │ │ │ ├── auth-request-processor.test.ts │ │ │ ├── client-credentials-flow.test.ts │ │ │ ├── existing-token-flow.test.ts │ │ │ ├── password-flow.test.ts │ │ │ └── refresh-token.test.ts │ │ ├── builder.test │ │ │ └── client-builder.test.ts │ │ ├── client.test │ │ │ └── client.test.ts │ │ ├── concurrent-modification.test │ │ │ └── concurrent-modification-middleware.test.ts │ │ ├── correlation-id.test │ │ │ └── correlation-id-middleware.test.ts │ │ ├── error.test │ │ │ └── error-middleware.test.ts │ │ ├── http.test │ │ │ └── http-middleware.test.ts │ │ ├── logger.test │ │ │ ├── fixtures.ts │ │ │ └── logger-middleware.test.ts │ │ ├── queue.test │ │ │ └── queue-middleware.test.ts │ │ ├── user-agent.test │ │ │ ├── user-agent-middleware.test.ts │ │ │ └── user-agent-util.test.ts │ │ └── utils.test │ │ │ ├── byteLength.test.ts │ │ │ ├── createError.test.ts │ │ │ ├── headers.test.ts │ │ │ └── url.test.ts │ ├── tsconfig.json │ ├── typedoc.json │ └── yarn.lock ├── sdk-client │ ├── CHANGELOG.md │ ├── README.md │ ├── package.json │ ├── src │ │ ├── client-builder │ │ │ └── ClientBuilder.ts │ │ ├── http-user-agent │ │ │ ├── create-user-agent.ts │ │ │ └── index.ts │ │ ├── index.ts │ │ ├── sdk-client │ │ │ ├── allowed-methods.ts │ │ │ ├── client.ts │ │ │ ├── errors.ts │ │ │ ├── index.ts │ │ │ └── validate.ts │ │ ├── sdk-middleware-auth │ │ │ ├── anonymous-session-flow.ts │ │ │ ├── base-auth-flow.ts │ │ │ ├── build-requests.ts │ │ │ ├── build-token-cache-key.ts │ │ │ ├── client-credentials-flow.ts │ │ │ ├── existing-token.ts │ │ │ ├── index.ts │ │ │ ├── password-flow.ts │ │ │ ├── refresh-token-flow.ts │ │ │ ├── scopes.ts │ │ │ └── utils.ts │ │ ├── sdk-middleware-correlation-id │ │ │ ├── correlation-id.ts │ │ │ └── index.ts │ │ ├── sdk-middleware-http │ │ │ ├── http.ts │ │ │ ├── index.ts │ │ │ └── parse-headers.ts │ │ ├── sdk-middleware-logger │ │ │ ├── index.ts │ │ │ └── logger.ts │ │ ├── sdk-middleware-queue │ │ │ ├── index.ts │ │ │ └── queue.ts │ │ ├── sdk-middleware-user-agent │ │ │ ├── index.ts │ │ │ └── user-agent.ts │ │ ├── types │ │ │ └── sdk.d.ts │ │ └── utils │ │ │ ├── index.ts │ │ │ └── url.ts │ ├── test │ │ ├── auth.test │ │ │ ├── anonymous-session-flow.test.ts │ │ │ ├── base-auth-flow.test.ts │ │ │ ├── build-requests.test.ts │ │ │ ├── client-crendentials-test.ts │ │ │ ├── existing-token.test.ts │ │ │ ├── password-flow.test.ts │ │ │ └── refresh-token-flow.test.ts │ │ ├── client-builder.test │ │ │ └── client-builder.test.ts │ │ ├── client.test │ │ │ └── sdk-client.test.ts │ │ ├── correlation.test │ │ │ └── correlation-id.test.ts │ │ ├── create-user-agent.test │ │ │ └── user-agent.test.ts │ │ ├── http.test │ │ │ ├── error.test.ts │ │ │ ├── http.test.ts │ │ │ └── parse-headers.test.ts │ │ ├── logger.test │ │ │ └── logger.test.ts │ │ ├── queue.test │ │ │ └── queue.test.ts │ │ ├── user-agent.test │ │ │ └── user-agent.test.ts │ │ └── utils.test │ │ │ └── url.test.ts │ ├── tsconfig.json │ └── typedoc.json └── ts-sdk-apm │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── opentelemetry.js │ ├── package.json │ ├── src │ ├── apm.ts │ ├── helpers │ │ ├── datadogHelper.ts │ │ ├── newRelicHelper.ts │ │ └── performanceHelper.ts │ └── index.ts │ ├── test │ └── apm.test │ │ └── apm.test.ts │ ├── tsconfig.json │ ├── typedoc.json │ └── types │ └── types.d.ts ├── references.txt ├── renovate.json ├── tsconfig.base.json ├── tsconfig.json ├── typedoc.base.json ├── typedoc.cjs └── yarn.lock /.changeset/README.md: -------------------------------------------------------------------------------- 1 | # Changesets 2 | 3 | Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works 4 | with multi-package repos, or single-package repos to help you version and publish your code. You can 5 | find the full documentation for it [in our repository](https://github.com/changesets/changesets) 6 | 7 | We have a quick list of common questions to get you started engaging with this project in 8 | [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) 9 | -------------------------------------------------------------------------------- /.changeset/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://unpkg.com/@changesets/config@1.6.0/schema.json", 3 | "changelog": [ 4 | "@changesets/changelog-github", 5 | { 6 | "repo": "commercetools/commercetools-sdk-typescript" 7 | } 8 | ], 9 | "commit": false, 10 | "access": "restricted", 11 | "baseBranch": "master" 12 | } 13 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @commercetools/developer-tooling 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | # https://help.github.com/en/github/building-a-strong-community/configuring-issue-templates-for-your-repository#configuring-the-template-chooser 2 | blank_issues_enabled: true 3 | contact_links: 4 | - name: commercetools Support 5 | url: https://support.commercetools.com 6 | about: Have an issue or question? Ask our support team! 7 | -------------------------------------------------------------------------------- /.github/workflows/add_issues_to_project.yml: -------------------------------------------------------------------------------- 1 | name: Add Issues to project 2 | on: 3 | issues: 4 | types: 5 | - opened 6 | jobs: 7 | add_issues: 8 | uses: commercetools/clients-automation/.github/workflows/workflow_issues_pr_to_project.yml@v1 9 | with: 10 | node_id: ${{ github.event.issue.node_id }} 11 | org: commercetools 12 | project: 32 13 | repository: ${{ github.event.repository.name }} 14 | login: ${{ github.event.issue.user.login }} 15 | secrets: 16 | token: ${{ secrets.PROJECT_TOKEN }} 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Env files 9 | *.env 10 | # Dependencies 11 | node_modules 12 | .npm 13 | .npmrc 14 | .released-packages 15 | 16 | # Integration tests dependencies cache 17 | *.tgz 18 | package-lock.json 19 | 20 | # Build artifacts 21 | _book 22 | .changelog 23 | dist 24 | # lib 25 | coverage 26 | 27 | # OS clutter 28 | .DS_Store 29 | 30 | # IDE tools 31 | .idea 32 | .rts2_cache_cjs 33 | 34 | setupEnv.sh 35 | 36 | # editor specific 37 | *.swp 38 | 39 | # training files 40 | training-tmp/ 41 | loadtest/ 42 | .npmignore 43 | api.http 44 | vue 45 | poc 46 | docs -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | yarn commitlint --edit $1 2 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | yarn lint-staged 2 | -------------------------------------------------------------------------------- /.jest/setEnvVars.js: -------------------------------------------------------------------------------- 1 | process.env.NEW_RELIC_ENABLED = false 2 | process.env.NEW_RELIC_APP_NAME = 'newrelic-app-name' 3 | process.env.NEW_RELIC_LICENSE_KEY = 'newrelic-license-key' 4 | -------------------------------------------------------------------------------- /.kodiak.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | 3 | [merge] 4 | show_missing_automerge_label_message = false 5 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | 22.15.0 -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | CHANGELOG.md 2 | index.ts 3 | node_modules 4 | *.d.ts 5 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "trailingComma": "es5", 4 | "singleQuote": true, 5 | "parser": "typescript", 6 | "overrides": [ 7 | { 8 | "files": "*.json", 9 | "options": { 10 | "parser": "json" 11 | } 12 | }, 13 | { 14 | "files": "*.md", 15 | "options": { 16 | "parser": "markdown" 17 | } 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "typescript.tsdk": "node_modules/typescript/lib", 3 | "terminal.integrated.tabs.enabled": false 4 | } 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 commercetools 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @type {import('@babel/core').TransformOptions} 3 | */ 4 | module.exports = { 5 | presets: [ 6 | [ 7 | '@babel/env', 8 | { 9 | targets: { 10 | node: 'current', 11 | }, 12 | }, 13 | ], 14 | '@babel/preset-typescript', 15 | ], 16 | plugins: ['@babel/proposal-class-properties'], 17 | } 18 | -------------------------------------------------------------------------------- /commitlint.config.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | module.exports = { 3 | extends: ['@commitlint/config-conventional'], 4 | parserPreset: { 5 | parserOpts: { 6 | // Allow to write a "scope" with slashes 7 | // E.g. `refactor(app/my-component): something` 8 | headerPattern: /^(\w*)(?:\(([\w\$\.\/\-\* ]*)\))?\: (.*)$/, 9 | }, 10 | }, 11 | rules: { 12 | 'header-max-length': [0, 'always', 100], 13 | }, 14 | } 15 | -------------------------------------------------------------------------------- /esbuild.cjs: -------------------------------------------------------------------------------- 1 | const esbuild = require('esbuild'); 2 | 3 | const generalConfig = { minify: true, bundle: true, write: true } 4 | 5 | const sdkClientConfig = esbuild.build( 6 | Object.assign({}, generalConfig, { 7 | entryPoints: ['packages/sdk-client/src/index.ts'], 8 | globalName: 'window["@commercetools/sdk-client-v2"]', 9 | outfile: 'packages/sdk-client/dist/commercetools-sdk-client-v2.umd.js' 10 | }) 11 | ) 12 | 13 | const sdkClientV3Config = esbuild.build( 14 | Object.assign({}, generalConfig, { 15 | entryPoints: ['packages/sdk-client-v3/src/index.ts'], 16 | globalName: 'window["@commercetools/ts-client"]', 17 | outfile: 'packages/sdk-client-v3/dist/commercetools-ts-client.umd.js' 18 | }) 19 | ) 20 | 21 | const platformSdkConfig = esbuild.build( 22 | Object.assign({}, generalConfig, { 23 | entryPoints: ['packages/platform-sdk/src/index.ts'], 24 | globalName: 'window["@commercetools/platform-sdk"]', 25 | outfile: 'packages/platform-sdk/dist/commercetools-platform-sdk.umd.js', 26 | }) 27 | ) 28 | 29 | Promise.all([ 30 | sdkClientConfig, sdkClientV3Config, platformSdkConfig 31 | ]).catch(console.error); 32 | -------------------------------------------------------------------------------- /examples/datadog-express-apm/container-agent/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:20-alpine 2 | 3 | RUN apk add --no-cache tini git 4 | 5 | ENV NODE_ENV=production 6 | 7 | WORKDIR /usr/src/app 8 | 9 | COPY package.json yarn.lock ./ 10 | RUN yarn --pure-lockfile && yarn cache clean 11 | 12 | COPY src ./src/ 13 | COPY server.js ./ 14 | COPY src/datadog.yaml /etc/datadog-agent/datadog.yaml 15 | RUN chmod 644 /etc/datadog-agent/datadog.yaml 16 | 17 | USER node 18 | 19 | EXPOSE 9000 20 | 21 | ENTRYPOINT ["/sbin/tini", "--"] 22 | CMD [ "node", "server.js" ] 23 | -------------------------------------------------------------------------------- /examples/datadog-express-apm/container-agent/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | app: 3 | build: 4 | context: . 5 | env_file: 6 | - .env 7 | environment: 8 | - DD_SITE=${DD_SITE} 9 | - DD_API_KEY=${DD_API_KEY} 10 | - NODE_ENV=production 11 | - DD_ENV 12 | - DD_TRACE_DEBUG 13 | - DD_TRACE_ENABLED 14 | - DD_LOGS_INJECTION=true 15 | - DD_AGENT_HOST=agent 16 | ports: 17 | - "9000:9000" 18 | labels: 19 | com.datadoghq.ad.logs: '[{"source": "docker", "service": "user"}]' 20 | agent: 21 | image: datadog/agent:latest 22 | environment: 23 | - DD_ENV 24 | - DD_TAGS="env:${DD_ENV}" 25 | - DD_PROCESS_AGENT_ENABLED=true 26 | - DD_DOGSTATSD_NON_LOCAL_TRAFFIC=true 27 | - DD_APM_NON_LOCAL_TRAFFIC=true 28 | - DD_APM_ENABLED=true 29 | - DD_APM_ANALYZED_SPANS=api-gateway|express.request=1,auth|express.request=1,user|express.request=1 30 | - DD_BIND_HOST=0.0.0.0 31 | - DD_LOGS_ENABLED=true 32 | - DD_DD_URL 33 | - DD_SITE=${DD_SITE} 34 | - DD_API_KEY=${DD_API_KEY} 35 | volumes: 36 | - /var/run/docker.sock:/var/run/docker.sock:ro 37 | - /proc/:/host/proc/:ro 38 | - /sys/fs/cgroup/:/host/sys/fs/cgroup:ro -------------------------------------------------------------------------------- /examples/datadog-express-apm/container-agent/env.sample: -------------------------------------------------------------------------------- 1 | # commercetools env 2 | CTP_PROJECT_KEY= 3 | CTP_CLIENT_ID= 4 | CTP_CLIENT_SECRET= 5 | CTP_AUTH_URL=https://auth..gcp.commercetools.com 6 | CTP_API_URL=https://api..gcp.commercetools.com 7 | 8 | # datadog envs 9 | DD_ENV=dev 10 | DD_LOGS_INJECTION=true 11 | DD_TAGS="env:${DD_ENV}" 12 | DD_PROCESS_AGENT_ENABLED=true 13 | DD_DOGSTATSD_NON_LOCAL_TRAFFIC=true # if expecting external metrics 14 | DD_APM_NON_LOCAL_TRAFFIC=true 15 | DD_APM_ENABLED=true 16 | DD_APM_ANALYZED_SPANS='api-gateway|express.request=1,auth|express.request=1,user|express.request=1' 17 | DD_BIND_HOST=0.0.0.0 18 | DD_LOGS_ENABLED=true 19 | DD_API_KEY= 20 | 21 | # Datadog SITE and URL 22 | # 23 | # Replace this with the Datadog SITE and APM URL for your region. 24 | # You can find the correct URL in your Datadog account settings. 25 | # For example, for the US region, the URL would be https://app.datadoghq.com 26 | DD_SITE= 27 | DD_APM_DD_URL= 28 | 29 | DD_LOGS_INJECTION=true 30 | DD_TRACE_SAMPLE_RATE="1" 31 | 32 | # custom metric collection 33 | DD_USE_DOGSTATSD=true # default 34 | # DD_DOGSTATSD_PORT=8125 # default 35 | -------------------------------------------------------------------------------- /examples/datadog-express-apm/container-agent/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "container-agent", 3 | "version": "1.0.0", 4 | "main": "server.js", 5 | "license": "MIT", 6 | "private": true, 7 | "dependencies": { 8 | "@commercetools/platform-sdk": "^8.2.0", 9 | "@commercetools/ts-client": "^3.0.4", 10 | "@commercetools/ts-sdk-apm": "^3.2.0", 11 | "cors": "^2.8.5", 12 | "dd-trace": "^5.4.0", 13 | "dotenv": "^16.4.7", 14 | "express": "^4.21.2", 15 | "node-fetch": "^2.7.0" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/datadog-express-apm/container-agent/server.js: -------------------------------------------------------------------------------- 1 | const app = require('./src/app') 2 | 3 | const PORT = 9000 4 | 5 | app.listen(PORT, function () { 6 | console.log(`listening on port ${PORT}`) 7 | }) 8 | -------------------------------------------------------------------------------- /examples/datadog-express-apm/container-agent/src/datadog.yaml: -------------------------------------------------------------------------------- 1 | api_key: ${DD_API_KEY} 2 | 3 | site: ${DD_SITE} 4 | 5 | dogstatsd_metrics_stats_enable: true 6 | -------------------------------------------------------------------------------- /examples/datadog-express-apm/container-agent/src/utils/request.js: -------------------------------------------------------------------------------- 1 | module.exports = function () { 2 | let count = 0 3 | return () => { 4 | return ++count 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /examples/datadog-express-apm/host-agent/env.sample: -------------------------------------------------------------------------------- 1 | # commercetools env 2 | CTP_PROJECT_KEY= 3 | CTP_CLIENT_ID= 4 | CTP_CLIENT_SECRET= 5 | CTP_AUTH_URL=https://auth..gcp.commercetools.com 6 | CTP_API_URL=https://api..gcp.commercetools.com 7 | # datadog envs 8 | DD_ENV=dev 9 | DD_LOGS_INJECTION=true 10 | DD_TAGS="env:${DD_ENV}" 11 | DD_PROCESS_AGENT_ENABLED=true 12 | DD_DOGSTATSD_NON_LOCAL_TRAFFIC=true # if expecting external metrics 13 | DD_APM_NON_LOCAL_TRAFFIC=true 14 | DD_APM_ENABLED=true 15 | DD_APM_ANALYZED_SPANS='api-gateway|express.request=1,auth|express.request=1,user|express.request=1' 16 | DD_BIND_HOST=0.0.0.0 17 | DD_LOGS_ENABLED=true 18 | DD_API_KEY= 19 | 20 | # Datadog SITE and URL 21 | # 22 | # Replace this with the Datadog SITE and APM URL for your region. 23 | # You can find the correct URL in your Datadog account settings. 24 | # For example, for the US region, the URL would be https://app.datadoghq.com 25 | DD_SITE= 26 | DD_URL= 27 | DD_APM_DD_URL= 28 | 29 | DD_LOGS_INJECTION=true 30 | DD_TRACE_SAMPLE_RATE="1" 31 | 32 | # custom metric collection 33 | DD_USE_DOGSTATSD=true # default 34 | # DD_DOGSTATSD_PORT=8125 # default 35 | -------------------------------------------------------------------------------- /examples/datadog-express-apm/host-agent/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | # source .env 6 | set -a; source .env; set +a 7 | # export $(cat .env | xargs) 8 | 9 | DD_AGENT_MAJOR_VERSION=7 \ 10 | DD_API_KEY=${DD_API_KEY} \ 11 | DD_SITE=${DD_URL} \ 12 | bash -c "$(curl -L https://s3.amazonaws.com/dd-agent/scripts/install_mac_os.sh)" 13 | -------------------------------------------------------------------------------- /examples/datadog-express-apm/host-agent/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "host-agent", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "license": "MIT", 6 | "dependencies": { 7 | "cors": "^2.8.5", 8 | "dd-trace": "^5.36.0", 9 | "express": "^4.21.2" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /examples/datadog-express-apm/host-agent/server.js: -------------------------------------------------------------------------------- 1 | const app = require('./src/app') 2 | 3 | const PORT = 9000 4 | 5 | app.listen(PORT, function () { 6 | console.log(`listening on port ${PORT}`) 7 | }) 8 | -------------------------------------------------------------------------------- /examples/datadog-express-apm/host-agent/utils/request.js: -------------------------------------------------------------------------------- 1 | module.exports = function () { 2 | let count = 0 3 | return () => { 4 | return ++count 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /examples/dynatrace-express-apm/.env.sample: -------------------------------------------------------------------------------- 1 | PORT=8085 2 | 3 | CTP_PROJECT_KEY= 4 | CTP_CLIENT_ID= 5 | CTP_CLIENT_SECRET= 6 | CTP_AUTH_URL=https://auth..gcp.commercetools.com 7 | CTP_API_URL=https://api..gcp.commercetools.com 8 | CTP_CLIENT_USERNAME= 9 | CTP_CLIENT_PASSWORD= 10 | DT_ENV_ID= 11 | DT_OPEN_TOKEN= 12 | DT_SERVICE_NAME=dynatrace-js-monitoring-agent 13 | DT_SERVICE_VERSION=0.1.0 14 | -------------------------------------------------------------------------------- /examples/dynatrace-express-apm/install.sh: -------------------------------------------------------------------------------- 1 | yarn add \ 2 | cors \ 3 | dotenv \ 4 | express \ 5 | node-fetch@2.6.7 \ 6 | @opentelemetry/api \ 7 | @opentelemetry/exporter-metrics-otlp-proto \ 8 | @opentelemetry/exporter-trace-otlp-proto \ 9 | @opentelemetry/sdk-trace-base \ 10 | @opentelemetry/instrumentation \ 11 | @opentelemetry/resources \ 12 | @opentelemetry/sdk-metrics \ 13 | @opentelemetry/sdk-trace-node \ 14 | @opentelemetry/semantic-conventions \ 15 | @opentelemetry/auto-instrumentations-node \ 16 | @commercetools/platform-sdk \ 17 | @commercetools/ts-client \ 18 | @commercetools/ts-sdk-apm -------------------------------------------------------------------------------- /examples/dynatrace-express-apm/server.js: -------------------------------------------------------------------------------- 1 | const { config } = require('dotenv') 2 | const server = require('./src/app') 3 | 4 | config() 5 | 6 | // unhandledRejection 7 | process.on('unhandledRejection', function (reason, promise) { 8 | console.error('Unhandled rejection', { reason: reason, promise }) 9 | }) 10 | 11 | process.on('uncaughtException', function (error, origin) { 12 | console.error('Unhandled exception', { error, origin }) 13 | }) 14 | 15 | // start 16 | server.listen(process.env.PORT, () => 17 | console.log(`server listening on port ${process.env.PORT}`) 18 | ) 19 | 20 | module.exports = server 21 | -------------------------------------------------------------------------------- /examples/dynatrace-express-apm/src/app.js: -------------------------------------------------------------------------------- 1 | const { config } = require('dotenv') 2 | const express = require('express') 3 | const cors = require('cors') 4 | 5 | config() 6 | 7 | const routes = require('./routes') 8 | 9 | const app = express() 10 | const { NODE_ENV } = process.env 11 | 12 | // Application-Level Middleware 13 | app.use(cors()) 14 | app.use(express.json()) 15 | app.use(express.urlencoded({ extended: true })) 16 | 17 | // Global error handler 18 | app.use((error, req, res, next) => { 19 | // response to user with 403 error and details 20 | if (error) { 21 | next(error) 22 | } else { 23 | next() 24 | } 25 | }) 26 | 27 | // Routes 28 | app.use('/', routes) 29 | app.get('/home', async function (_, res) { 30 | res.status(200).json({ 31 | status: 'success', 32 | message: 'Welcome to commercetools sdk apm demo app', 33 | }) 34 | }) 35 | app.use('*', async (_, res) => { 36 | return res.status(404).json({ 37 | status: 'error', 38 | data: { 39 | message: 'resource not found on this server', 40 | }, 41 | }) 42 | }) 43 | 44 | module.exports = app 45 | -------------------------------------------------------------------------------- /examples/dynatrace-express-apm/src/controller/CustomerController.js: -------------------------------------------------------------------------------- 1 | const ResponseHandler = require('../utils/response') 2 | 3 | /** 4 | * @description CustomerController 5 | * @function getCustomers 6 | */ 7 | class CustomerController { 8 | constructor({ customerService }) { 9 | this.customerService = customerService 10 | } 11 | 12 | async getCustomers(req, res) { 13 | const data = await this.customerService.getCustomers(req.body) 14 | 15 | if (data.statusCode === 200) { 16 | return ResponseHandler.successResponse( 17 | res, 18 | data.statusCode || data.body.statusCode, 19 | data.message || data.body.message, 20 | data.body 21 | ) 22 | } 23 | return ResponseHandler.errorResponse( 24 | res, 25 | data.statusCode || data.body.statusCode, 26 | data.message || data.body.message, 27 | data.body 28 | ) 29 | } 30 | } 31 | 32 | module.exports = CustomerController 33 | -------------------------------------------------------------------------------- /examples/dynatrace-express-apm/src/controller/ProductController.js: -------------------------------------------------------------------------------- 1 | const ResponseHandler = require('../utils/response') 2 | 3 | /** 4 | * @description ProductController 5 | * @function getProducts 6 | */ 7 | class ProductController { 8 | constructor({ productService }) { 9 | this.productService = productService 10 | } 11 | 12 | async getProducts(req, res) { 13 | const data = await this.productService.getProduct(req.body) 14 | 15 | if (data.statusCode === 200) { 16 | return ResponseHandler.successResponse( 17 | res, 18 | data.statusCode || data.body.statusCode, 19 | data.message || data.body.message, 20 | data.body 21 | ) 22 | } 23 | return ResponseHandler.errorResponse( 24 | res, 25 | data.statusCode || data.body.statusCode, 26 | data.message || data.body.message, 27 | data.body 28 | ) 29 | } 30 | } 31 | 32 | module.exports = ProductController 33 | -------------------------------------------------------------------------------- /examples/dynatrace-express-apm/src/controller/ProjectController.js: -------------------------------------------------------------------------------- 1 | const ResponseHandler = require('../utils/response') 2 | 3 | /** 4 | * @description ProjectController 5 | * @function getProject 6 | */ 7 | class ProjectController { 8 | constructor({ projectService }) { 9 | this.projectService = projectService 10 | } 11 | 12 | async getProject(req, res) { 13 | const data = await this.projectService.getProject(req.body) 14 | 15 | if (data.statusCode === 200) { 16 | return ResponseHandler.successResponse( 17 | res, 18 | data.statusCode || data.body.statusCode, 19 | data.message || data.body.message, 20 | data.body 21 | ) 22 | } 23 | return ResponseHandler.errorResponse( 24 | res, 25 | data.statusCode || data.body.statusCode, 26 | data.message || data.body.message, 27 | data.body 28 | ) 29 | } 30 | } 31 | 32 | module.exports = ProjectController 33 | -------------------------------------------------------------------------------- /examples/dynatrace-express-apm/src/controller/index.js: -------------------------------------------------------------------------------- 1 | const CustomerController = require('./CustomerController') 2 | const ProductController = require('./ProductController') 3 | const ProjectController = require('./ProjectController') 4 | const CartController = require('./CartController') 5 | const CartDiscountController = require('./CartDiscountController') 6 | 7 | module.exports = { 8 | CustomerController, 9 | ProductController, 10 | ProjectController, 11 | CartController, 12 | CartDiscountController, 13 | } 14 | -------------------------------------------------------------------------------- /examples/dynatrace-express-apm/src/routes/cart-discount.js: -------------------------------------------------------------------------------- 1 | const { Router } = require('express') 2 | const { CartDiscountService } = require('../service') 3 | const { CartDiscountController } = require('../controller') 4 | const { apiRoot } = require('../sdk-v3/sdk') 5 | 6 | const cartDiscountService = new CartDiscountService({ apiRoot }) 7 | const cartDiscountController = new CartDiscountController({ 8 | cartDiscountService, 9 | }) 10 | 11 | const router = Router() 12 | const { getCartDiscount, createCartDiscount } = cartDiscountController 13 | 14 | router.get('/cart-discount', getCartDiscount.bind(cartDiscountController)) 15 | router.post('/cart-discount', createCartDiscount.bind(cartDiscountController)) 16 | 17 | module.exports = router 18 | -------------------------------------------------------------------------------- /examples/dynatrace-express-apm/src/routes/cart.js: -------------------------------------------------------------------------------- 1 | const { Router } = require('express') 2 | const { CartService } = require('../service') 3 | const { CartController } = require('../controller') 4 | const { apiRoot } = require('../sdk-v3/sdk') 5 | 6 | const cartService = new CartService({ apiRoot }) 7 | const cartController = new CartController({ cartService }) 8 | 9 | const router = Router() 10 | const { getActiveCart, createCartForCurrentCustomer } = cartController 11 | 12 | router.get('/cart', getActiveCart.bind(cartController)) 13 | router.post('/cart', createCartForCurrentCustomer.bind(cartController)) 14 | 15 | module.exports = router 16 | -------------------------------------------------------------------------------- /examples/dynatrace-express-apm/src/routes/customer.js: -------------------------------------------------------------------------------- 1 | const { Router } = require('express') 2 | const { CustomerService } = require('../service') 3 | const { CustomerController } = require('../controller') 4 | const { apiRoot } = require('../sdk-v3/sdk') 5 | 6 | const customerService = new CustomerService({ apiRoot }) 7 | const customerController = new CustomerController({ customerService }) 8 | 9 | const router = Router() 10 | const { getCustomers } = customerController 11 | 12 | router.get('/customers', getCustomers.bind(customerController)) 13 | 14 | module.exports = router 15 | -------------------------------------------------------------------------------- /examples/dynatrace-express-apm/src/routes/index.js: -------------------------------------------------------------------------------- 1 | const { Router } = require('express') 2 | 3 | const project = require('./project') 4 | const product = require('./product') 5 | const customer = require('./customer') 6 | const cart = require('./cart') 7 | const cartDiscount = require('./cart-discount') 8 | 9 | const router = Router() 10 | 11 | router.use(project) 12 | router.use(product) 13 | router.use(customer) 14 | router.use(cart) 15 | router.use(cartDiscount) 16 | 17 | module.exports = router 18 | -------------------------------------------------------------------------------- /examples/dynatrace-express-apm/src/routes/product.js: -------------------------------------------------------------------------------- 1 | const { Router } = require('express') 2 | const { ProductService } = require('../service') 3 | const { ProductController } = require('../controller') 4 | const { apiRoot } = require('../sdk-v3/sdk') 5 | 6 | const productService = new ProductService({ apiRoot }) 7 | const productController = new ProductController({ productService }) 8 | 9 | const router = Router() 10 | const { getProducts } = productController 11 | 12 | router.get('/products', getProducts.bind(productController)) 13 | 14 | module.exports = router 15 | -------------------------------------------------------------------------------- /examples/dynatrace-express-apm/src/routes/project.js: -------------------------------------------------------------------------------- 1 | const { Router } = require('express') 2 | const { ProjectService } = require('../service') 3 | const { ProjectController } = require('../controller') 4 | const { apiRoot } = require('../sdk-v3/sdk') 5 | 6 | const projectService = new ProjectService({ apiRoot }) 7 | const projectController = new ProjectController({ projectService }) 8 | 9 | const router = Router() 10 | const { getProject } = projectController 11 | 12 | router.get('/project', getProject.bind(projectController)) 13 | 14 | module.exports = router 15 | -------------------------------------------------------------------------------- /examples/dynatrace-express-apm/src/service/CartService.js: -------------------------------------------------------------------------------- 1 | class CartService { 2 | constructor({ apiRoot }) { 3 | this.apiRoot = apiRoot 4 | } 5 | 6 | _createCustomerCartDraft(cartData) { 7 | const { currency, customerEmail } = cartData 8 | 9 | return { 10 | currency, 11 | customerEmail, 12 | } 13 | } 14 | 15 | async createCartForCurrentCustomer(cartDraft) { 16 | const cart = await this.getActiveCart() 17 | if (cart?.statusCode === 200) return cart 18 | return this.apiRoot 19 | .me() 20 | .carts() 21 | .post({ 22 | body: this._createCustomerCartDraft(cartDraft), 23 | }) 24 | .execute() 25 | .catch((err) => err) 26 | } 27 | 28 | async getActiveCart() { 29 | return this.apiRoot 30 | .me() 31 | .activeCart() 32 | .get() 33 | .execute() 34 | .catch((err) => err) 35 | } 36 | } 37 | 38 | module.exports = CartService 39 | -------------------------------------------------------------------------------- /examples/dynatrace-express-apm/src/service/CustomerService.js: -------------------------------------------------------------------------------- 1 | class CustomerService { 2 | constructor({ apiRoot }) { 3 | this.apiRoot = apiRoot 4 | } 5 | 6 | async getCustomers() { 7 | return this.apiRoot.customers().get().execute() 8 | } 9 | } 10 | 11 | module.exports = CustomerService 12 | -------------------------------------------------------------------------------- /examples/dynatrace-express-apm/src/service/ProductService.js: -------------------------------------------------------------------------------- 1 | class ProductService { 2 | constructor({ apiRoot }) { 3 | this.apiRoot = apiRoot 4 | } 5 | 6 | async getProduct() { 7 | return this.apiRoot.products().get().execute() 8 | } 9 | } 10 | 11 | module.exports = ProductService 12 | -------------------------------------------------------------------------------- /examples/dynatrace-express-apm/src/service/ProjectService.js: -------------------------------------------------------------------------------- 1 | class ProjectService { 2 | constructor({ apiRoot }) { 3 | this.apiRoot = apiRoot 4 | } 5 | 6 | async getProject() { 7 | return this.apiRoot.get().execute() 8 | } 9 | } 10 | 11 | module.exports = ProjectService 12 | -------------------------------------------------------------------------------- /examples/dynatrace-express-apm/src/service/index.js: -------------------------------------------------------------------------------- 1 | const CustomerService = require('./CustomerService') 2 | const ProductService = require('./ProductService') 3 | const ProjectService = require('./ProjectService') 4 | const CartService = require('./CartService') 5 | const CartDiscountService = require('./CartDiscountService') 6 | 7 | module.exports = { 8 | CustomerService, 9 | ProductService, 10 | ProjectService, 11 | CartService, 12 | CartDiscountService, 13 | } 14 | -------------------------------------------------------------------------------- /examples/fastify/.env.sample: -------------------------------------------------------------------------------- 1 | CTP_CLIENT_ID= 2 | CTP_PROJECT_KEY= 3 | CTP_CLIENT_SECRET= -------------------------------------------------------------------------------- /examples/fastify/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | node_modules/ 3 | yarn.lock -------------------------------------------------------------------------------- /examples/fastify/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fastify", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "license": "MIT", 6 | "dependencies": { 7 | "@commercetools/ts-client": "latest", 8 | "@commercetools/platform-sdk": "latest", 9 | "dotenv": "^16.4.7", 10 | "fastify": "^5.2.0", 11 | "node-fetch": "^2.6.1" 12 | }, 13 | "scripts": { 14 | "start": "node server" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /examples/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | testEnvironment: 'jsdom', 3 | } 4 | -------------------------------------------------------------------------------- /examples/me/client/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "@babel/preset-env", 4 | "@babel/preset-react" 5 | ] 6 | } -------------------------------------------------------------------------------- /examples/me/client/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .env -------------------------------------------------------------------------------- /examples/me/client/assets/cart.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/commercetools/commercetools-sdk-typescript/be1e9c1a5dd79230818864b70742b517e746f960/examples/me/client/assets/cart.jpeg -------------------------------------------------------------------------------- /examples/me/client/assets/profile.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/commercetools/commercetools-sdk-typescript/be1e9c1a5dd79230818864b70742b517e746f960/examples/me/client/assets/profile.jpeg -------------------------------------------------------------------------------- /examples/me/client/assets/profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/commercetools/commercetools-sdk-typescript/be1e9c1a5dd79230818864b70742b517e746f960/examples/me/client/assets/profile.png -------------------------------------------------------------------------------- /examples/me/client/cart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/commercetools/commercetools-sdk-typescript/be1e9c1a5dd79230818864b70742b517e746f960/examples/me/client/cart.png -------------------------------------------------------------------------------- /examples/me/client/index.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/commercetools/commercetools-sdk-typescript/be1e9c1a5dd79230818864b70742b517e746f960/examples/me/client/index.css -------------------------------------------------------------------------------- /examples/me/client/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import ReactDOM from 'react-dom' 3 | import './index.css' 4 | import { BrowserRouter as Router } from 'react-router-dom' 5 | import 'bootstrap/dist/css/bootstrap.min.css' 6 | 7 | import App from './src/App.jsx' 8 | 9 | ReactDOM.render( 10 | 11 | 12 | 13 | 14 | , 15 | document.getElementById('root') 16 | ) 17 | -------------------------------------------------------------------------------- /examples/me/client/src/App.css: -------------------------------------------------------------------------------- 1 | .qty { 2 | width: 40px; 3 | height: 25px; 4 | text-align: center; 5 | } 6 | input.qtyplus { width: 25px; height: 25px; padding: 5px; border: 2px solid #ccc; margin: 2%} 7 | input.qtyminus { width: 25px; height: 25px; padding: 5px; border: 2px solid #ccc; margin: 2%} 8 | 9 | .cart { 10 | position: relative; 11 | } 12 | 13 | .item-count { 14 | position: absolute; 15 | width: 20px; 16 | height: 20px; 17 | top: 0; 18 | right: 10px; 19 | text-align: center; 20 | font-size: 14px; 21 | color: white; 22 | border-radius: 50px; 23 | background-color: red; 24 | } -------------------------------------------------------------------------------- /examples/me/client/src/component/Loader.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import Loading from 'react-fullscreen-loading' 3 | 4 | const ActivityIndicator = ({ 5 | loading, 6 | background = '#ffffff', 7 | loaderColor = '#3498db', 8 | }) => { 9 | return ( 10 | 15 | ) 16 | } 17 | 18 | export default ActivityIndicator 19 | -------------------------------------------------------------------------------- /examples/me/client/src/constants/index.js: -------------------------------------------------------------------------------- 1 | export const CURRENCY_CODE = { 2 | EUR: '€', 3 | USD: '$', 4 | } 5 | -------------------------------------------------------------------------------- /examples/me/client/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | How to set up React, Webpack, and Babel 6 | 7 | 8 |
9 | 10 | -------------------------------------------------------------------------------- /examples/me/client/src/utils/TokenStorage.js: -------------------------------------------------------------------------------- 1 | export default class TokenStorage { 2 | constructor(storage) { 3 | this.storage = storage 4 | } 5 | 6 | setStorage(storage) { 7 | this.storage = storage 8 | } 9 | 10 | getItem(item) { 11 | return this.storage.getItem(item) 12 | } 13 | 14 | setItem(key, value) { 15 | this.storage.setItem(key, value) 16 | } 17 | 18 | removeItem(item) { 19 | this.storage.removeItem(item) 20 | } 21 | 22 | clearItems() { 23 | this.storage.clear() 24 | } 25 | 26 | static _getItem(storage, item) { 27 | return storage.getItem(item) 28 | } 29 | 30 | static _setItem(storage, key, value) { 31 | storage.setItem(key, value) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /examples/me/client/src/utils/index.js: -------------------------------------------------------------------------------- 1 | export { default as TokenStorage } from './TokenStorage' 2 | export { default as sleep } from './sleep' 3 | -------------------------------------------------------------------------------- /examples/me/client/src/utils/sleep.js: -------------------------------------------------------------------------------- 1 | export default function sleep(ms) { 2 | return new Promise((resolve) => setTimeout(resolve, ms)) 3 | } 4 | -------------------------------------------------------------------------------- /examples/me/client/store/api/index.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios' 2 | 3 | export function request(options = {}) { 4 | const option = { 5 | url: process.env.REACT_APP_API_URL + '/' + options.url, 6 | method: options.method, 7 | headers: { 8 | 'Content-Type': 'application/json', 9 | ...options.headers, 10 | }, 11 | data: { 12 | ...options.data, 13 | }, 14 | } 15 | return axios(option) 16 | } 17 | -------------------------------------------------------------------------------- /examples/me/client/store/index.js: -------------------------------------------------------------------------------- 1 | import { createStore, applyMiddleware } from 'redux' 2 | import thunk from 'redux-thunk' 3 | import logger from 'redux-logger' 4 | import rootReducer from './rootReducer' 5 | 6 | const prodMiddleware = applyMiddleware(thunk) 7 | const devMiddleware = applyMiddleware(thunk, logger) 8 | 9 | const middleware = 10 | process.env.NODE_ENV === 'development' ? devMiddleware : prodMiddleware 11 | 12 | const store = createStore(rootReducer, middleware) 13 | export default store 14 | -------------------------------------------------------------------------------- /examples/me/client/store/product/productAction.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios' 2 | 3 | export const GET_PRODUCT_START = 'GET_PRODUCT_START' 4 | export const GET_PRODUCT_SUCCESS = 'GET_PRODUCT_SUCCESS' 5 | export const GET_PRODUCT_ERROR = 'GET_PRODUCT_ERROR' 6 | 7 | export const getProductStart = () => ({ 8 | type: GET_PRODUCT_START, 9 | }) 10 | 11 | export const getProductSuccess = (product) => ({ 12 | type: GET_PRODUCT_SUCCESS, 13 | payload: { product }, 14 | }) 15 | 16 | export const getProductError = (error) => ({ 17 | type: GET_PRODUCT_ERROR, 18 | payload: { error }, 19 | }) 20 | 21 | export function getProducts() { 22 | return (dispatch) => { 23 | dispatch(getProductStart()) 24 | axios({ 25 | url: 'http://localhost:8085/product', 26 | method: 'GET', 27 | headers: { 28 | Accept: 'application/json', 29 | 'Access-Control-Allow-Origin': '*', 30 | }, 31 | }) 32 | .then((response) => { 33 | if (response.status == 200) { 34 | return dispatch(getProductSuccess(response.data.data)) 35 | } 36 | dispatch(getProductError(response.data)) 37 | }) 38 | .catch((error) => { 39 | dispatch(getProductError(error)) 40 | }) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /examples/me/client/store/product/productReducer.js: -------------------------------------------------------------------------------- 1 | import * as productAction from './productAction' 2 | 3 | const initialState = { 4 | loading: false, 5 | products: [], 6 | error: null, 7 | } 8 | 9 | const productReducer = (state = initialState, action) => { 10 | switch (action.type) { 11 | case productAction.GET_PRODUCT_START: { 12 | return { 13 | ...state, 14 | loading: true, 15 | } 16 | } 17 | case productAction.GET_PRODUCT_SUCCESS: { 18 | return { 19 | ...state, 20 | loading: false, 21 | products: action.payload.product, 22 | } 23 | } 24 | case productAction.GET_PRODUCT_ERROR: { 25 | return { 26 | ...state, 27 | loading: false, 28 | error: action.payload.error, 29 | } 30 | } 31 | default: { 32 | return state 33 | } 34 | } 35 | } 36 | 37 | export default productReducer 38 | -------------------------------------------------------------------------------- /examples/me/client/store/rootReducer.js: -------------------------------------------------------------------------------- 1 | import { combineReducers } from 'redux' 2 | 3 | import productReducer from './product/productReducer' 4 | import authReducer from './auth/authReducer' 5 | import cartReducer from './cart/cartReducer' 6 | 7 | export default combineReducers({ 8 | productReducer, 9 | authReducer, 10 | cartReducer, 11 | }) 12 | -------------------------------------------------------------------------------- /examples/me/server/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | api.http 3 | commercetools-sunrise-data 4 | -------------------------------------------------------------------------------- /examples/me/server/index.ts: -------------------------------------------------------------------------------- 1 | import dotenv from "dotenv" 2 | import server from "./src/app" 3 | 4 | dotenv.config(); 5 | 6 | // unhandledRejection 7 | process.on('unhandledRejection', function (reason, promise) { 8 | console.error('Unhandled rejection', { reason: reason, promise }) 9 | }) 10 | 11 | process.on('uncaughtException', function(error, origin) { 12 | console.error('Unhandled exception', { error, origin }) 13 | }) 14 | 15 | // start 16 | server.listen(process.env.PORT, () => console.log(`server listening on port ${process.env.PORT}`)) 17 | 18 | export default server 19 | -------------------------------------------------------------------------------- /examples/me/server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "me-app", 3 | "version": "0.0.1", 4 | "description": "me endpoint checkout app", 5 | "main": "server.js", 6 | "scripts": { 7 | "start:dev": "npx ts-node index.ts" 8 | }, 9 | "author": "ajimae", 10 | "license": "MIT", 11 | "dependencies": { 12 | "@commercetools/platform-sdk": "^1.19.0", 13 | "@commercetools/ts-client": "^3.0.1", 14 | "cors": "^2.8.5", 15 | "dotenv": "^10.0.0", 16 | "express": "^4.21.2", 17 | "lodash.defaultsdeep": "^4.6.1", 18 | "ncrypt-js": "^2.1.0", 19 | "node-fetch": "2.6.7", 20 | "qss": "^2.0.3" 21 | }, 22 | "devDependencies": { 23 | "@types/express": "^4.17.13", 24 | "@types/node": "^16.11.7", 25 | "ts-node": "^10.4.0", 26 | "typescript": "^4.4.4" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /examples/me/server/src/app.ts: -------------------------------------------------------------------------------- 1 | import express, { 2 | Request, 3 | Response, 4 | NextFunction, 5 | ErrorRequestHandler, 6 | } from 'express' 7 | import cors from 'cors' 8 | 9 | import routes from './routes' 10 | 11 | const app = express() 12 | const { NODE_ENV } = process.env 13 | 14 | // Application-Level Middleware 15 | app.use(cors()) 16 | app.use(express.json()) 17 | app.use(express.urlencoded({ extended: true })) 18 | 19 | // Global error handler 20 | app.use( 21 | ( 22 | error: ErrorRequestHandler, 23 | req: Request, 24 | res: Response, 25 | next: NextFunction 26 | ) => { 27 | // response to user with 403 error and details 28 | if (error) { 29 | next(error) 30 | } else { 31 | next() 32 | } 33 | } 34 | ) 35 | 36 | // Routes 37 | app.use('/', routes) 38 | app.get('/home', async function (_, res) { 39 | res.status(200).json({ 40 | status: 'success', 41 | message: 'Welcome to Composable Commerce ME endpoint demo app', 42 | }) 43 | }) 44 | app.use('*', async (_, res: Response) => { 45 | return res.status(404).json({ 46 | status: 'error', 47 | data: { 48 | message: 'resource not found on this server', 49 | }, 50 | }) 51 | }) 52 | 53 | export default app 54 | -------------------------------------------------------------------------------- /examples/me/server/src/client/index.ts: -------------------------------------------------------------------------------- 1 | import ApiClient from "./Client" 2 | 3 | export { 4 | ApiClient 5 | } -------------------------------------------------------------------------------- /examples/me/server/src/controller/ProductController.ts: -------------------------------------------------------------------------------- 1 | import ResponseHandler from '../utils/Response' 2 | import { Request, Response } from 'express' 3 | import { ProductRepository } from '../repository' 4 | import { getOptions } from '../utils/options' 5 | 6 | /** 7 | * @description ProductController 8 | * 9 | * @function registerUser 10 | */ 11 | class ProductController { 12 | constructor() {} 13 | 14 | async getProducts(req: Request, res: Response) { 15 | const options = getOptions(req.headers) 16 | const data = await new ProductRepository(options).getProducts() 17 | 18 | if (data.statusCode == 200) { 19 | return ResponseHandler.successResponse( 20 | res, 21 | data.statusCode || data.body.statusCode, 22 | data.message || data.body.message, 23 | data.body 24 | ) 25 | } 26 | return ResponseHandler.errorResponse( 27 | res, 28 | data.statusCode || data.body.statusCode, 29 | data.message || data.body.message, 30 | data.body 31 | ) 32 | } 33 | } 34 | 35 | export default ProductController 36 | -------------------------------------------------------------------------------- /examples/me/server/src/controller/index.ts: -------------------------------------------------------------------------------- 1 | import CustomerController from "./CustomerController"; 2 | import ProductController from "./ProductController"; 3 | import CartController from "./CartController"; 4 | 5 | export { 6 | CustomerController, 7 | ProductController, 8 | CartController 9 | } 10 | -------------------------------------------------------------------------------- /examples/me/server/src/middleware/index.ts: -------------------------------------------------------------------------------- 1 | import Validator from "./Validator"; 2 | 3 | export { 4 | Validator, 5 | } 6 | -------------------------------------------------------------------------------- /examples/me/server/src/repository/ProductRepository.ts: -------------------------------------------------------------------------------- 1 | import Client from '../client/Client' 2 | import { ApiRoot } from '@commercetools/platform-sdk' 3 | 4 | interface IProductRepository { 5 | apiRoot: ApiRoot 6 | projectKey: string 7 | getProducts(): any | Error 8 | } 9 | 10 | class Product implements IProductRepository { 11 | apiRoot: ApiRoot 12 | projectKey: string 13 | constructor(options) { 14 | const rootClient = new Client(options) 15 | this.apiRoot = rootClient.getApiRoot( 16 | rootClient.getClientFromOption(options) 17 | ) 18 | this.projectKey = rootClient.getProjectKey() 19 | } 20 | 21 | async getProducts() { 22 | try { 23 | const products = await this.apiRoot 24 | .withProjectKey({ projectKey: this.projectKey }) 25 | .products() 26 | .get() 27 | .execute() 28 | 29 | return products 30 | } catch (error) { 31 | return error 32 | } 33 | } 34 | } 35 | 36 | export default Product 37 | -------------------------------------------------------------------------------- /examples/me/server/src/repository/index.ts: -------------------------------------------------------------------------------- 1 | import CustomerRepository from './CustomerRepository' 2 | import ProductRepository from './ProductRepository' 3 | import CartRepository from './CartRepository' 4 | 5 | export { 6 | CustomerRepository, 7 | ProductRepository, 8 | CartRepository 9 | } 10 | -------------------------------------------------------------------------------- /examples/me/server/src/routes/cart.ts: -------------------------------------------------------------------------------- 1 | import { Router } from 'express' 2 | import { CartController } from '../controller' 3 | 4 | // build the client 5 | const cartController = new CartController() 6 | 7 | const router = Router() 8 | const { 9 | createCartForCurrentCustomer, 10 | getActiveCart, 11 | updateActiveCart, 12 | removeLineItem, 13 | } = cartController 14 | 15 | router.get('/cart', getActiveCart.bind(cartController)) 16 | router.post('/cart', createCartForCurrentCustomer.bind(cartController)) 17 | router.put('/cart', updateActiveCart.bind(cartController)) 18 | router.delete('/cart', removeLineItem.bind(cartController)) 19 | 20 | export default router 21 | -------------------------------------------------------------------------------- /examples/me/server/src/routes/customer.ts: -------------------------------------------------------------------------------- 1 | import { Router } from 'express' 2 | import { CustomerController } from '../controller' 3 | import { Validator } from '../middleware' 4 | 5 | const customerController = new CustomerController() 6 | 7 | const router = Router() 8 | const { validateSignup, validateLogin } = Validator 9 | const { createCustomer, getCustomer, logoutCustomer } = customerController 10 | 11 | function forwardID(req, res, next) { 12 | res.locals.anonymousId = req.headers.token 13 | next() 14 | } 15 | 16 | router.post( 17 | '/login', 18 | validateLogin, 19 | forwardID, 20 | getCustomer.bind(customerController) 21 | ) 22 | router.post( 23 | '/register', 24 | validateSignup, 25 | createCustomer.bind(customerController) 26 | ) 27 | router.post('/logout', logoutCustomer.bind(customerController)) 28 | 29 | export default router 30 | -------------------------------------------------------------------------------- /examples/me/server/src/routes/index.ts: -------------------------------------------------------------------------------- 1 | import { Router } from "express" 2 | import customer from "./customer" 3 | import product from "./product" 4 | import cart from './cart' 5 | 6 | const router = Router(); 7 | 8 | router.use(customer); 9 | router.use(product) 10 | router.use(cart) 11 | 12 | export default router; 13 | -------------------------------------------------------------------------------- /examples/me/server/src/routes/product.ts: -------------------------------------------------------------------------------- 1 | import { Router } from 'express' 2 | import { ProductController } from '../controller' 3 | 4 | const productController = new ProductController() 5 | 6 | const router = Router() 7 | const { getProducts } = productController 8 | 9 | router.get('/product', getProducts.bind(productController)) 10 | 11 | export default router 12 | -------------------------------------------------------------------------------- /examples/me/server/src/service/CartService.ts: -------------------------------------------------------------------------------- 1 | import { CartRepository } from '../repository' 2 | 3 | interface ICartService { 4 | cartRepository: typeof CartRepository 5 | getActiveCart(): any 6 | } 7 | /** 8 | * @description cart service class 9 | */ 10 | class CartService implements ICartService { 11 | cartRepository: any 12 | constructor(CartRepository) { 13 | this.cartRepository = CartRepository 14 | } 15 | 16 | createCartForCurrentCustomer(cartData) { 17 | return this.cartRepository.createCartForCurrentCustomer(cartData) 18 | } 19 | 20 | getActiveCart() { 21 | return this.cartRepository.getActiveCart() 22 | } 23 | 24 | updateActiveCart(productDetails) { 25 | return this.cartRepository.updateActiveCart(productDetails) 26 | } 27 | 28 | removeLineItem(productDetails) { 29 | return this.cartRepository.removeLineItem(productDetails) 30 | } 31 | } 32 | 33 | export default CartService 34 | -------------------------------------------------------------------------------- /examples/me/server/src/service/CustomerService.ts: -------------------------------------------------------------------------------- 1 | import { CustomerRepository } from '../repository' 2 | 3 | interface ICustomerService { 4 | customerRepository: typeof CustomerRepository 5 | createCustomer(customerData): any 6 | getCustomer({ email, password }: { email: string; password: string }): any 7 | } 8 | /** 9 | * @description customer service class 10 | */ 11 | class CustomerService implements ICustomerService { 12 | customerRepository: any 13 | constructor(CustomerRepository) { 14 | this.customerRepository = CustomerRepository 15 | } 16 | 17 | createCustomer(customer) { 18 | return this.customerRepository.createCustomer(customer) 19 | } 20 | 21 | getCustomer(customer) { 22 | return this.customerRepository.getCustomer(customer) 23 | } 24 | } 25 | 26 | export default CustomerService 27 | -------------------------------------------------------------------------------- /examples/me/server/src/service/ProductService.ts: -------------------------------------------------------------------------------- 1 | import { ProductRepository } from '../repository' 2 | 3 | interface IProductService { 4 | productRepository: typeof ProductRepository 5 | getProducts(): any 6 | } 7 | /** 8 | * @description product service class 9 | */ 10 | class ProductService implements IProductService { 11 | productRepository: any 12 | constructor(productRepository) { 13 | this.productRepository = productRepository 14 | } 15 | 16 | getProducts() { 17 | return this.productRepository.getProducts() 18 | } 19 | } 20 | 21 | export default ProductService 22 | -------------------------------------------------------------------------------- /examples/me/server/src/service/index.ts: -------------------------------------------------------------------------------- 1 | import CustomerService from './CustomerService'; 2 | import ProductService from './ProductService'; 3 | import CartService from './CartService'; 4 | 5 | export { 6 | ProductService, 7 | CustomerService, 8 | CartService 9 | } 10 | -------------------------------------------------------------------------------- /examples/me/server/src/utils/helper.ts: -------------------------------------------------------------------------------- 1 | import Ncrypt from 'ncrypt-js' 2 | const { encrypt, decrypt } = new Ncrypt(process.env.CTP_CLIENT_SECRET) 3 | 4 | export { encrypt, decrypt } 5 | -------------------------------------------------------------------------------- /examples/newrelic-express-apm/.env.sample: -------------------------------------------------------------------------------- 1 | PORT=8000 2 | NEW_RELIC_APP_NAME=demo-monitoring-app 3 | NEW_RELIC_LICENSE_KEY= 4 | 5 | CTP_PROJECT_KEY= 6 | CTP_CLIENT_ID= 7 | CTP_CLIENT_SECRET= 8 | CTP_AUTH_URL=https://auth..gcp.commercetools.com 9 | CTP_API_URL=https://api..gcp.commercetools.com 10 | 11 | CTP_CLIENT_USERNAME= 12 | CTP_CLIENT_PASSWORD= 13 | 14 | OTEL_EXPORTER_OTLP_ENDPOINT=https://otlp.eu01.nr-data.net:4317 15 | OTEL_TRACES_EXPORTER=none 16 | OTEL_EXPORTER_OTLP_HEADERS=api-key= 17 | OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT=4095 18 | -------------------------------------------------------------------------------- /examples/newrelic-express-apm/agent.js: -------------------------------------------------------------------------------- 1 | module.exports = require('newrelic') 2 | -------------------------------------------------------------------------------- /examples/newrelic-express-apm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "newrelic-express-apm", 3 | "version": "1.0.0", 4 | "main": "server.js", 5 | "license": "MIT", 6 | "description": "express app to demonstrate the use of newrelic apm with commercetools javascript/typescript sdk", 7 | "author": "chukwuemeka ajima", 8 | "private": false, 9 | "dependencies": { 10 | "@commercetools/platform-sdk": "latest", 11 | "@commercetools/ts-client": "latest", 12 | "@commercetools/ts-sdk-apm": "latest", 13 | "cors": "^2.8.5", 14 | "dotenv": "^16.3.1", 15 | "express": "^4.21.2", 16 | "newrelic": "^11.23.2", 17 | "node-fetch": "2.6.7" 18 | }, 19 | "scripts": { 20 | "start": "node -r ./newrelic server" 21 | }, 22 | "resolutions": { 23 | "axios": "1.8.4", 24 | "import-in-the-middle": "1.4.2", 25 | "@opentelemetry/instrumentation": "0.41.2" 26 | }, 27 | "overrides": { 28 | "axios": "1.8.4", 29 | "import-in-the-middle": "1.4.2", 30 | "@opentelemetry/instrumentation": "0.41.2" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /examples/newrelic-express-apm/server.js: -------------------------------------------------------------------------------- 1 | const { config } = require('dotenv') 2 | const server = require('./src/app') 3 | 4 | config() 5 | 6 | // unhandledRejection 7 | process.on('unhandledRejection', function (reason, promise) { 8 | console.error('Unhandled rejection', { reason: reason, promise }) 9 | }) 10 | 11 | process.on('uncaughtException', function (error, origin) { 12 | console.error('Unhandled exception', { error, origin }) 13 | }) 14 | 15 | // start 16 | server.listen(process.env.PORT, () => 17 | console.log(`server listening on port ${process.env.PORT}`) 18 | ) 19 | 20 | module.exports = server 21 | -------------------------------------------------------------------------------- /examples/newrelic-express-apm/src/controller/CustomerController.js: -------------------------------------------------------------------------------- 1 | const ResponseHandler = require('../utils/response') 2 | 3 | /** 4 | * @description CustomerController 5 | * @function getCustomers 6 | */ 7 | class CustomerController { 8 | constructor({ customerService }) { 9 | this.customerService = customerService 10 | } 11 | 12 | async getCustomers(req, res) { 13 | const data = await this.customerService.getCustomers(req.body) 14 | 15 | if (data.statusCode === 200) { 16 | return ResponseHandler.successResponse( 17 | res, 18 | data.statusCode || data.body.statusCode, 19 | data.message || data.body.message, 20 | data.body 21 | ) 22 | } 23 | return ResponseHandler.errorResponse( 24 | res, 25 | data.statusCode || data.body.statusCode, 26 | data.message || data.body.message, 27 | data.body 28 | ) 29 | } 30 | } 31 | 32 | module.exports = CustomerController 33 | -------------------------------------------------------------------------------- /examples/newrelic-express-apm/src/controller/ProductController.js: -------------------------------------------------------------------------------- 1 | const { newrelic } = require('@commercetools/ts-sdk-apm') 2 | const ResponseHandler = require('../utils/response') 3 | 4 | /** 5 | * @description ProductController 6 | * @function getProducts 7 | */ 8 | class ProductController { 9 | constructor({ productService }) { 10 | this.productService = productService 11 | } 12 | 13 | async getProducts(req, res) { 14 | const start = performance.now() 15 | const data = await this.productService.getProduct(req.body) 16 | 17 | newrelic.recordMetric( 18 | 'GetProductsEndpoint/Response/Time/Total', 19 | performance.now() - start 20 | ) 21 | 22 | if (data.statusCode === 200) { 23 | return ResponseHandler.successResponse( 24 | res, 25 | data.statusCode || data.body.statusCode, 26 | data.message || data.body.message, 27 | data.body 28 | ) 29 | } 30 | 31 | return ResponseHandler.errorResponse( 32 | res, 33 | data.statusCode || data.body.statusCode, 34 | data.message || data.body.message, 35 | data.body 36 | ) 37 | } 38 | } 39 | 40 | module.exports = ProductController 41 | -------------------------------------------------------------------------------- /examples/newrelic-express-apm/src/controller/ProjectController.js: -------------------------------------------------------------------------------- 1 | const ResponseHandler = require('../utils/response') 2 | 3 | /** 4 | * @description ProjectController 5 | * @function getProject 6 | */ 7 | class ProjectController { 8 | constructor({ projectService }) { 9 | this.projectService = projectService 10 | } 11 | 12 | async getProject(req, res) { 13 | const data = await this.projectService.getProject(req.body) 14 | 15 | if (data.statusCode === 200) { 16 | return ResponseHandler.successResponse( 17 | res, 18 | data.statusCode || data.body.statusCode, 19 | data.message || data.body.message, 20 | data.body 21 | ) 22 | } 23 | return ResponseHandler.errorResponse( 24 | res, 25 | data.statusCode || data.body.statusCode, 26 | data.message || data.body.message, 27 | data.body 28 | ) 29 | } 30 | } 31 | 32 | module.exports = ProjectController 33 | -------------------------------------------------------------------------------- /examples/newrelic-express-apm/src/controller/index.js: -------------------------------------------------------------------------------- 1 | const CustomerController = require('./CustomerController') 2 | const ProductController = require('./ProductController') 3 | const ProjectController = require('./ProjectController') 4 | const CartController = require('./CartController') 5 | const CartDiscountController = require('./CartDiscountController') 6 | 7 | module.exports = { 8 | CustomerController, 9 | ProductController, 10 | ProjectController, 11 | CartController, 12 | CartDiscountController, 13 | } 14 | -------------------------------------------------------------------------------- /examples/newrelic-express-apm/src/routes/cart-discount.js: -------------------------------------------------------------------------------- 1 | const { Router } = require('express') 2 | const { CartDiscountService } = require('../service') 3 | const { CartDiscountController } = require('../controller') 4 | const { apiRoot } = require('../sdk-v3/sdk') 5 | 6 | const cartDiscountService = new CartDiscountService({ apiRoot }) 7 | const cartDiscountController = new CartDiscountController({ 8 | cartDiscountService, 9 | }) 10 | 11 | const router = Router() 12 | const { getCartDiscount, createCartDiscount } = cartDiscountController 13 | 14 | router.get('/cart-discount', getCartDiscount.bind(cartDiscountController)) 15 | router.post('/cart-discount', createCartDiscount.bind(cartDiscountController)) 16 | 17 | module.exports = router 18 | -------------------------------------------------------------------------------- /examples/newrelic-express-apm/src/routes/cart.js: -------------------------------------------------------------------------------- 1 | const { Router } = require('express') 2 | const { CartService } = require('../service') 3 | const { CartController } = require('../controller') 4 | const { apiRoot } = require('../sdk-v3/sdk') 5 | 6 | const cartService = new CartService({ apiRoot }) 7 | const cartController = new CartController({ cartService }) 8 | 9 | const router = Router() 10 | const { getActiveCart, createCartForCurrentCustomer } = cartController 11 | 12 | router.get('/cart', getActiveCart.bind(cartController)) 13 | router.post('/cart', createCartForCurrentCustomer.bind(cartController)) 14 | 15 | module.exports = router 16 | -------------------------------------------------------------------------------- /examples/newrelic-express-apm/src/routes/customer.js: -------------------------------------------------------------------------------- 1 | const { Router } = require('express') 2 | const { CustomerService } = require('../service') 3 | const { CustomerController } = require('../controller') 4 | const { apiRoot } = require('../sdk-v3/sdk') 5 | 6 | const customerService = new CustomerService({ apiRoot }) 7 | const customerController = new CustomerController({ customerService }) 8 | 9 | const router = Router() 10 | const { getCustomers } = customerController 11 | 12 | router.get('/customers', getCustomers.bind(customerController)) 13 | 14 | module.exports = router 15 | -------------------------------------------------------------------------------- /examples/newrelic-express-apm/src/routes/index.js: -------------------------------------------------------------------------------- 1 | const { Router } = require('express') 2 | 3 | const project = require('./project') 4 | const product = require('./product') 5 | const customer = require('./customer') 6 | const cart = require('./cart') 7 | const cartDiscount = require('./cart-discount') 8 | 9 | const router = Router() 10 | 11 | router.use(project) 12 | router.use(product) 13 | router.use(customer) 14 | router.use(cart) 15 | router.use(cartDiscount) 16 | 17 | module.exports = router 18 | -------------------------------------------------------------------------------- /examples/newrelic-express-apm/src/routes/product.js: -------------------------------------------------------------------------------- 1 | const { Router } = require('express') 2 | const { ProductService } = require('../service') 3 | const { ProductController } = require('../controller') 4 | const { apiRoot } = require('../sdk-v3/sdk') 5 | 6 | const productService = new ProductService({ apiRoot }) 7 | const productController = new ProductController({ productService }) 8 | 9 | const router = Router() 10 | const { getProducts } = productController 11 | 12 | router.get('/products', getProducts.bind(productController)) 13 | 14 | module.exports = router 15 | -------------------------------------------------------------------------------- /examples/newrelic-express-apm/src/routes/project.js: -------------------------------------------------------------------------------- 1 | const { Router } = require('express') 2 | const { ProjectService } = require('../service') 3 | const { ProjectController } = require('../controller') 4 | const { apiRoot } = require('../sdk-v3/sdk') 5 | 6 | const projectService = new ProjectService({ apiRoot }) 7 | const projectController = new ProjectController({ projectService }) 8 | 9 | const router = Router() 10 | const { getProject } = projectController 11 | 12 | router.get('/project', getProject.bind(projectController)) 13 | 14 | module.exports = router 15 | -------------------------------------------------------------------------------- /examples/newrelic-express-apm/src/service/CartService.js: -------------------------------------------------------------------------------- 1 | class CartService { 2 | constructor({ apiRoot }) { 3 | this.apiRoot = apiRoot 4 | } 5 | 6 | _createCustomerCartDraft(cartData) { 7 | const { currency, customerEmail } = cartData 8 | 9 | return { 10 | currency, 11 | customerEmail, 12 | } 13 | } 14 | 15 | async createCartForCurrentCustomer(cartDraft) { 16 | const cart = await this.getActiveCart() 17 | if (cart?.statusCode === 200) return cart 18 | return this.apiRoot 19 | .me() 20 | .carts() 21 | .post({ 22 | body: this._createCustomerCartDraft(cartDraft), 23 | }) 24 | .execute() 25 | .catch((err) => err) 26 | } 27 | 28 | async getActiveCart() { 29 | return this.apiRoot 30 | .me() 31 | .activeCart() 32 | .get() 33 | .execute() 34 | .catch((err) => err) 35 | } 36 | } 37 | 38 | module.exports = CartService 39 | -------------------------------------------------------------------------------- /examples/newrelic-express-apm/src/service/CustomerService.js: -------------------------------------------------------------------------------- 1 | class CustomerService { 2 | constructor({ apiRoot }) { 3 | this.apiRoot = apiRoot 4 | } 5 | 6 | async getCustomers() { 7 | return this.apiRoot.customers().get().execute() 8 | } 9 | } 10 | 11 | module.exports = CustomerService 12 | -------------------------------------------------------------------------------- /examples/newrelic-express-apm/src/service/ProductService.js: -------------------------------------------------------------------------------- 1 | class ProductService { 2 | constructor({ apiRoot }) { 3 | this.apiRoot = apiRoot 4 | } 5 | 6 | async getProduct() { 7 | return this.apiRoot.products().get().execute() 8 | } 9 | } 10 | 11 | module.exports = ProductService 12 | -------------------------------------------------------------------------------- /examples/newrelic-express-apm/src/service/ProjectService.js: -------------------------------------------------------------------------------- 1 | class ProjectService { 2 | constructor({ apiRoot }) { 3 | this.apiRoot = apiRoot 4 | } 5 | 6 | async getProject() { 7 | return this.apiRoot.get().execute() 8 | } 9 | } 10 | 11 | module.exports = ProjectService 12 | -------------------------------------------------------------------------------- /examples/newrelic-express-apm/src/service/index.js: -------------------------------------------------------------------------------- 1 | const CustomerService = require('./CustomerService') 2 | const ProductService = require('./ProductService') 3 | const ProjectService = require('./ProjectService') 4 | const CartService = require('./CartService') 5 | const CartDiscountService = require('./CartDiscountService') 6 | 7 | module.exports = { 8 | CustomerService, 9 | ProductService, 10 | ProjectService, 11 | CartService, 12 | CartDiscountService, 13 | } 14 | -------------------------------------------------------------------------------- /examples/newrelic-express-apm/src/utils/request.js: -------------------------------------------------------------------------------- 1 | module.exports = function () { 2 | let count = 0 3 | return () => { 4 | return ++count 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /examples/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "examples", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "license": "MIT", 6 | "scripts": { 7 | "test": "jest" 8 | }, 9 | "devDependencies": { 10 | "jest": "^27.2.5" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /examples/react-esbuild/esbuild.config.js: -------------------------------------------------------------------------------- 1 | // esbuild.config.js 2 | const { 3 | NodeGlobalsPolyfillPlugin, 4 | } = require('@esbuild-plugins/node-globals-polyfill') 5 | const { 6 | NodeModulesPolyfillPlugin, 7 | } = require('@esbuild-plugins/node-modules-polyfill') 8 | 9 | const define = {} 10 | for (const k in process.env) { 11 | define[`process.env.${k}`] = JSON.stringify(process.env[k]) 12 | } 13 | 14 | require('esbuild') 15 | .build({ 16 | entryPoints: ['src/App.tsx'], 17 | bundle: true, 18 | minify: true, 19 | format: 'cjs', 20 | sourcemap: true, 21 | outfile: 'dist/output.js', 22 | define, 23 | plugins: [ 24 | NodeModulesPolyfillPlugin(), 25 | NodeGlobalsPolyfillPlugin({ 26 | process: true, 27 | buffer: true, 28 | }), 29 | ], 30 | // external: ['react', 'react-dom'], 31 | }) 32 | .catch(() => process.exit(1)) 33 | -------------------------------------------------------------------------------- /examples/react-esbuild/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

React

5 | 6 |
7 | 8 | -------------------------------------------------------------------------------- /examples/react-esbuild/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "esbuild-react", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "license": "MIT", 6 | "dependencies": { 7 | "@esbuild-plugins/node-globals-polyfill": "^0.2.3", 8 | "@esbuild-plugins/node-modules-polyfill": "^0.2.2", 9 | "dotenv": "^16.0.3", 10 | "esbuild": "^0.25.0", 11 | "react": "^18.2.0", 12 | "react-dom": "^18.2.0" 13 | }, 14 | "scripts": { 15 | "dev": "npx lite-server", 16 | "build": "node esbuild.config.js", 17 | "start": "yarn build;yarn dev" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /examples/react-esbuild/src/App.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import ReactDOM from 'react-dom/client'; 3 | import { useState, useEffect } from 'react'; 4 | import { getApiRoot, projectKey } from './lib' 5 | 6 | function App() { 7 | const [projectDetails, setProjectDetails] = useState({}) 8 | const proc = process.env 9 | 10 | const getProject = async () => { 11 | try { 12 | const project = await getApiRoot() 13 | .withProjectKey({ projectKey }) 14 | // .products() 15 | // .get() 16 | // .execute(); 17 | 18 | .customers() 19 | .get() 20 | .execute() 21 | 22 | setProjectDetails(project.body); 23 | } catch (e) { 24 | console.log(e) 25 | } 26 | } 27 | 28 | useEffect(() => { 29 | getProject() 30 | }, []) 31 | 32 | return ( 33 | <> 34 |
Project Details
35 |
36 |         {JSON.stringify(projectDetails, undefined, 2)}
37 |       
38 | 39 | ) 40 | } 41 | 42 | 43 | // Mount component 44 | const root = ReactDOM.createRoot( 45 | document.getElementById('root') as HTMLElement 46 | ); 47 | 48 | root.render(); 49 | 50 | // export default App; 51 | -------------------------------------------------------------------------------- /examples/react-esbuild/src/lib/ClientBuilder.ts: -------------------------------------------------------------------------------- 1 | import fetch from 'node-fetch' 2 | import { 3 | Client, 4 | ClientBuilder, 5 | AuthMiddlewareOptions, 6 | HttpMiddlewareOptions, 7 | } from '@commercetools/sdk-client-v2' 8 | import { 9 | createApiBuilderFromCtpClient, 10 | ApiRoot, 11 | } from '@commercetools/platform-sdk' 12 | 13 | export const projectKey = process.env.CTP_PROJECT_KEY || '' 14 | const authMiddlewareOptions: AuthMiddlewareOptions = { 15 | host: 'https://auth.europe-west1.gcp.commercetools.com', 16 | projectKey, 17 | credentials: { 18 | clientId: process.env.CTP_CLIENT_ID || '', 19 | clientSecret: process.env.CTP_CLIENT_SECRET || '', 20 | }, 21 | scopes: [`manage_project:${projectKey}`], 22 | fetch, 23 | } 24 | 25 | const httpMiddlewareOptions: HttpMiddlewareOptions = { 26 | host: 'https://api.europe-west1.gcp.commercetools.com', 27 | fetch, 28 | } 29 | 30 | const client: Client = new ClientBuilder() 31 | .withProjectKey(projectKey) 32 | .withClientCredentialsFlow(authMiddlewareOptions) 33 | .withHttpMiddleware(httpMiddlewareOptions) 34 | .withLoggerMiddleware() 35 | .build() 36 | 37 | export const getApiRoot: () => ApiRoot = () => { 38 | return createApiBuilderFromCtpClient(client) 39 | } 40 | -------------------------------------------------------------------------------- /examples/react-esbuild/src/lib/index.ts: -------------------------------------------------------------------------------- 1 | export { getApiRoot, projectKey } from './ClientBuilder' 2 | -------------------------------------------------------------------------------- /examples/react-vite/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite + React + TS 8 | 9 | 10 |

11 |     
12 |   
13 | 
14 | 


--------------------------------------------------------------------------------
/examples/react-vite/package.json:
--------------------------------------------------------------------------------
 1 | {
 2 |   "name": "vite-number-conversion",
 3 |   "private": true,
 4 |   "version": "0.0.0",
 5 |   "type": "module",
 6 |   "scripts": {
 7 |     "dev": "vite",
 8 |     "build": "tsc && vite build",
 9 |     "preview": "vite preview"
10 |   },
11 |   "dependencies": {
12 |     "@commercetools/platform-sdk": "^4.2.0",
13 |     "@commercetools/sdk-client-v2": "^2.1.0",
14 |     "@esbuild-plugins/node-globals-polyfill": "^0.1.1",
15 |     "@esbuild-plugins/node-modules-polyfill": "^0.1.4",
16 |     "react": "^18.2.0",
17 |     "react-dom": "^18.2.0",
18 |     "rollup-plugin-node-polyfills": "^0.2.1"
19 |   },
20 |   "devDependencies": {
21 |     "@types/react": "^18.0.24",
22 |     "@types/react-dom": "^18.0.8",
23 |     "@vitejs/plugin-react": "^2.2.0",
24 |     "typescript": "^4.6.4",
25 |     "vite": "^6.2.6"
26 |   }
27 | }
28 | 


--------------------------------------------------------------------------------
/examples/react-vite/src/App.css:
--------------------------------------------------------------------------------
 1 | * {
 2 |   font-size: 12px;
 3 | }
 4 | 
 5 | /* #root {
 6 |   max-width: 1280px;
 7 |   margin: 0 auto;
 8 |   padding: 2rem;
 9 |   text-align: center;
10 | }
11 | 
12 | .logo {
13 |   height: 6em;
14 |   padding: 1.5em;
15 |   will-change: filter;
16 | }
17 | .logo:hover {
18 |   filter: drop-shadow(0 0 2em #646cffaa);
19 | }
20 | .logo.react:hover {
21 |   filter: drop-shadow(0 0 2em #61dafbaa);
22 | }
23 | 
24 | @keyframes logo-spin {
25 |   from {
26 |     transform: rotate(0deg);
27 |   }
28 |   to {
29 |     transform: rotate(360deg);
30 |   }
31 | }
32 | 
33 | @media (prefers-reduced-motion: no-preference) {
34 |   a:nth-of-type(2) .logo {
35 |     animation: logo-spin infinite 20s linear;
36 |   }
37 | }
38 | 
39 | .card {
40 |   padding: 2em;
41 | }
42 | 
43 | .read-the-docs {
44 |   color: #888;
45 | } */
46 | 


--------------------------------------------------------------------------------
/examples/react-vite/src/App.tsx:
--------------------------------------------------------------------------------
 1 | import React, { useState, useEffect } from 'react';
 2 | import { getApiRoot, projectKey } from './lib'
 3 | 
 4 | import './App.css'
 5 | 
 6 | function App() {
 7 |   const [projectDetails, setProjectDetails] = useState({})
 8 | 
 9 |   const getProject = async () => {
10 |     try {
11 |       const project = await getApiRoot()
12 |         .withProjectKey({ projectKey })
13 |         // .products()
14 |         // .get()
15 |         // .execute();
16 | 
17 |         .customers()
18 |         .get()
19 |         .execute()
20 | 
21 |       setProjectDetails(project.body);
22 |     } catch (e) {
23 |       console.log(e)
24 |     }
25 |   }
26 | 
27 |   useEffect(() => {
28 |     getProject()
29 |   }, [])
30 | 
31 |   return (
32 |     <>
33 |       
Project Details
34 | {JSON.stringify(projectDetails, undefined, 2)} 35 | 36 | ) 37 | } 38 | 39 | export default App 40 | -------------------------------------------------------------------------------- /examples/react-vite/src/lib/index.ts: -------------------------------------------------------------------------------- 1 | export { getApiRoot, projectKey } from './ClientBuilder' 2 | -------------------------------------------------------------------------------- /examples/react-vite/src/main.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import ReactDOM from 'react-dom/client' 3 | import App from './App' 4 | import './index.css' 5 | 6 | ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render( 7 | 8 | 9 | 10 | ) 11 | -------------------------------------------------------------------------------- /examples/react-vite/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /examples/react-vite/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "useDefineForClassFields": true, 5 | "lib": ["DOM", "DOM.Iterable", "ESNext"], 6 | "allowJs": false, 7 | "skipLibCheck": true, 8 | "esModuleInterop": false, 9 | "allowSyntheticDefaultImports": true, 10 | "strict": true, 11 | "forceConsistentCasingInFileNames": true, 12 | "module": "ESNext", 13 | "moduleResolution": "Node", 14 | "resolveJsonModule": true, 15 | "isolatedModules": true, 16 | "noEmit": true, 17 | "jsx": "react-jsx" 18 | }, 19 | "include": ["src"], 20 | "references": [{ "path": "./tsconfig.node.json" }] 21 | } 22 | -------------------------------------------------------------------------------- /examples/react-vite/tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "module": "ESNext", 5 | "moduleResolution": "Node", 6 | "allowSyntheticDefaultImports": true 7 | }, 8 | "include": ["vite.config.ts"] 9 | } 10 | -------------------------------------------------------------------------------- /examples/react-vite/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | import react from '@vitejs/plugin-react' 3 | 4 | import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill' 5 | import { NodeModulesPolyfillPlugin } from '@esbuild-plugins/node-modules-polyfill' 6 | import rollupNodePolyFill from 'rollup-plugin-node-polyfills' 7 | 8 | // https://vitejs.dev/config/ 9 | export default defineConfig({ 10 | plugins: [react()], 11 | resolve: { 12 | alias: { 13 | stream: 'rollup-plugin-node-polyfills/polyfills/stream', 14 | }, 15 | }, 16 | optimizeDeps: { 17 | esbuildOptions: { 18 | define: { 19 | global: 'globalThis', 20 | }, 21 | plugins: [ 22 | NodeGlobalsPolyfillPlugin({ 23 | process: true, 24 | buffer: true, 25 | }), 26 | NodeModulesPolyfillPlugin(), 27 | ], 28 | }, 29 | }, 30 | build: { 31 | rollupOptions: { 32 | plugins: [rollupNodePolyFill()], 33 | }, 34 | }, 35 | }) 36 | -------------------------------------------------------------------------------- /examples/react-webpack/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": ["@babel/plugin-transform-runtime"], 3 | "presets": [ 4 | "@babel/preset-env", 5 | "@babel/preset-react" 6 | ] 7 | } -------------------------------------------------------------------------------- /examples/react-webpack/index.css: -------------------------------------------------------------------------------- 1 | * { 2 | font-size: 12px; 3 | } -------------------------------------------------------------------------------- /examples/react-webpack/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import ReactDOM from 'react-dom' 3 | import './index.css' 4 | import App from './src/App.jsx' 5 | 6 | ReactDOM.render( 7 | 8 | 9 | , 10 | document.getElementById('root') 11 | ) 12 | -------------------------------------------------------------------------------- /examples/react-webpack/src/App.css: -------------------------------------------------------------------------------- 1 | * { 2 | font-size: 12px; 3 | } -------------------------------------------------------------------------------- /examples/react-webpack/src/App.jsx: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from 'react'; 2 | import { getApiRoot, projectKey } from './lib' 3 | 4 | import './App.css' 5 | 6 | function App() { 7 | const [projectDetails, setProjectDetails] = useState({}) 8 | 9 | const getProject = async () => { 10 | try { 11 | const project = await getApiRoot() 12 | .withProjectKey({ projectKey }) 13 | // .products() 14 | .customers() 15 | .get() 16 | .execute() 17 | // .get() 18 | // .execute(); 19 | 20 | setProjectDetails(project.body); 21 | } catch (e) { 22 | console.log(e) 23 | } 24 | } 25 | 26 | useEffect(() => { 27 | getProject() 28 | }, []) 29 | 30 | return ( 31 | <> 32 |
Project Details
33 | {JSON.stringify(projectDetails, undefined, 2)} 34 | 35 | ) 36 | } 37 | 38 | export default App; 39 | -------------------------------------------------------------------------------- /examples/react-webpack/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | React App 7 | 8 | 9 | 10 |

11 | 
12 | 
13 | 


--------------------------------------------------------------------------------
/examples/react-webpack/src/lib/ClientBuilder.js:
--------------------------------------------------------------------------------
 1 | import fetch from 'node-fetch'
 2 | import { ClientBuilder } from '@commercetools/sdk-client-v2'
 3 | import { createApiBuilderFromCtpClient } from '@commercetools/platform-sdk'
 4 | 
 5 | export const projectKey = process.env.CTP_PROJECT_KEY
 6 | const authMiddlewareOptions = {
 7 |   host: 'https://auth.europe-west1.gcp.commercetools.com',
 8 |   projectKey,
 9 |   credentials: {
10 |     clientId: process.env.CTP_CLIENT_ID,
11 |     clientSecret: process.env.CTP_CLIENT_SECRET,
12 |   },
13 |   scopes: [`manage_project:${projectKey}`],
14 |   fetch,
15 | }
16 | 
17 | const httpMiddlewareOptions = {
18 |   host: 'https://api.europe-west1.gcp.commercetools.com',
19 |   fetch,
20 | }
21 | 
22 | const client = new ClientBuilder()
23 |   .withProjectKey(projectKey)
24 |   .withClientCredentialsFlow(authMiddlewareOptions)
25 |   .withHttpMiddleware(httpMiddlewareOptions)
26 |   .withLoggerMiddleware()
27 |   .build()
28 | 
29 | export const getApiRoot = () => {
30 |   return createApiBuilderFromCtpClient(client)
31 | }
32 | 


--------------------------------------------------------------------------------
/examples/react-webpack/src/lib/index.js:
--------------------------------------------------------------------------------
1 | export { getApiRoot, projectKey } from './ClientBuilder'
2 | 


--------------------------------------------------------------------------------
/examples/test/fixture.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/commercetools/commercetools-sdk-typescript/be1e9c1a5dd79230818864b70742b517e746f960/examples/test/fixture.js


--------------------------------------------------------------------------------
/examples/test/node.test.js:
--------------------------------------------------------------------------------
 1 | const { getProjectDetails } = require('../node/node')
 2 | 
 3 | describe('Dependency test', function () {
 4 |   test('should get project details', function (done) {
 5 |     getProjectDetails().then(function ({ body }) {
 6 |       expect(body.key).toBe(`${process.env.CTP_PROJECT_KEY}`)
 7 |       done()
 8 |     })
 9 |   })
10 | })
11 | 


--------------------------------------------------------------------------------
/examples/vue-example-app/.gitignore:
--------------------------------------------------------------------------------
 1 | # Logs
 2 | logs
 3 | *.log
 4 | npm-debug.log*
 5 | yarn-debug.log*
 6 | yarn-error.log*
 7 | pnpm-debug.log*
 8 | lerna-debug.log*
 9 | 
10 | node_modules
11 | .DS_Store
12 | dist
13 | dist-ssr
14 | coverage
15 | *.local
16 | 
17 | /cypress/videos/
18 | /cypress/screenshots/
19 | 
20 | # Editor directories and files
21 | .vscode
22 | !.vscode/extensions.json
23 | .idea
24 | *.suo
25 | *.ntvs*
26 | *.njsproj
27 | *.sln
28 | *.sw?
29 | 
30 | *.tsbuildinfo
31 | 


--------------------------------------------------------------------------------
/examples/vue-example-app/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 |   "recommendations": ["Vue.volar"]
3 | }
4 | 


--------------------------------------------------------------------------------
/examples/vue-example-app/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 |   "explorer.fileNesting.enabled": true,
3 |   "explorer.fileNesting.patterns": {
4 |     "tsconfig.json": "tsconfig.*.json, env.d.ts",
5 |     "vite.config.*": "jsconfig*, vitest.config.*, cypress.config.*, playwright.config.*",
6 |     "package.json": "package-lock.json, pnpm*, .yarnrc*, yarn*, .eslint*, eslint*, .prettier*, prettier*, .editorconfig"
7 |   }
8 | }
9 | 


--------------------------------------------------------------------------------
/examples/vue-example-app/README.md:
--------------------------------------------------------------------------------
 1 | # vue-example-app
 2 | 
 3 | This template should help get you started try out our SDK in Vue 3 using Vite.
 4 | 
 5 | ## Recommended IDE Setup
 6 | 
 7 | [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur). Feel free to use whichever IDE you prefer.
 8 | 
 9 | ## Type Support for `.vue` Imports in TS
10 | 
11 | TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types.
12 | 
13 | ## Customize configuration
14 | 
15 | See [Vite Configuration Reference](https://vite.dev/config/).
16 | 
17 | ## Project Setup
18 | 
19 | This project is using bun as the package manager and task/script runner.
20 | 
21 | ```sh
22 | bun install
23 | ```
24 | 
25 | ### Compile and Hot-Reload for Development
26 | 
27 | ```sh
28 | bun dev
29 | ```
30 | 
31 | ### Type-Check, Compile and Minify for Production
32 | 
33 | ```sh
34 | bun run build
35 | ```
36 | 
37 | ### Screenshot
38 | 
39 | ![Screenshot](./screenshot.png)
40 | 


--------------------------------------------------------------------------------
/examples/vue-example-app/env.d.ts:
--------------------------------------------------------------------------------
1 | /// 
2 | /// 


--------------------------------------------------------------------------------
/examples/vue-example-app/index.html:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 |   
 4 |     
 5 |     
 6 |     
 7 |     Vite App
 8 |   
 9 |   
10 |     
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/vue-example-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-example-app", 3 | "version": "0.0.0", 4 | "private": true, 5 | "type": "module", 6 | "scripts": { 7 | "dev": "vite", 8 | "build": "run-p type-check \"build-only {@}\" --", 9 | "preview": "vite preview", 10 | "build-only": "vite build", 11 | "type-check": "vue-tsc --build" 12 | }, 13 | "dependencies": { 14 | "@commercetools/platform-sdk": "^8.5.0", 15 | "@commercetools/ts-client": "^3.2.0", 16 | "vue": "^3.5.13" 17 | }, 18 | "devDependencies": { 19 | "@tsconfig/node22": "^22.0.0", 20 | "@types/node": "^22.13.10", 21 | "@vitejs/plugin-vue": "^5.2.1", 22 | "@vue/tsconfig": "^0.7.0", 23 | "npm-run-all2": "^7.0.2", 24 | "typescript": "~5.8.0", 25 | "vite": "^6.2.1", 26 | "vite-plugin-vue-devtools": "^7.7.2", 27 | "vue-tsc": "^2.2.8" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /examples/vue-example-app/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/commercetools/commercetools-sdk-typescript/be1e9c1a5dd79230818864b70742b517e746f960/examples/vue-example-app/public/favicon.ico -------------------------------------------------------------------------------- /examples/vue-example-app/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/commercetools/commercetools-sdk-typescript/be1e9c1a5dd79230818864b70742b517e746f960/examples/vue-example-app/screenshot.png -------------------------------------------------------------------------------- /examples/vue-example-app/shim.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.vue' { 2 | import type { DefineComponent } from 'vue' 3 | const component: DefineComponent<{}, {}, any> 4 | export default component 5 | } -------------------------------------------------------------------------------- /examples/vue-example-app/src/App.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 15 | 16 | 44 | -------------------------------------------------------------------------------- /examples/vue-example-app/src/assets/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /examples/vue-example-app/src/assets/main.css: -------------------------------------------------------------------------------- 1 | @import './base.css'; 2 | 3 | #app { 4 | max-width: 1280px; 5 | margin: 0 auto; 6 | padding: 2rem; 7 | font-weight: normal; 8 | } 9 | 10 | a, 11 | .green { 12 | text-decoration: none; 13 | color: hsla(160, 100%, 37%, 1); 14 | transition: 0.4s; 15 | padding: 3px; 16 | } 17 | 18 | @media (hover: hover) { 19 | a:hover { 20 | background-color: hsla(160, 100%, 37%, 0.2); 21 | } 22 | } 23 | 24 | @media (min-width: 1024px) { 25 | body { 26 | display: flex; 27 | place-items: center; 28 | } 29 | 30 | #app { 31 | display: grid; 32 | grid-template-columns: 1fr 1fr; 33 | padding: 0 2rem; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /examples/vue-example-app/src/components/Button.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | -------------------------------------------------------------------------------- /examples/vue-example-app/src/main.ts: -------------------------------------------------------------------------------- 1 | import './assets/main.css' 2 | 3 | import { createApp } from 'vue' 4 | import App from './App.vue' 5 | 6 | createApp(App).mount('#app') 7 | -------------------------------------------------------------------------------- /examples/vue-example-app/src/sdk/index.ts: -------------------------------------------------------------------------------- 1 | import { ClientBuilder } from '@commercetools/ts-client' 2 | import { createApiBuilderFromCtpClient } from '@commercetools/platform-sdk' 3 | 4 | export const projectKey = import.meta.env.VITE_CTP_PROJECT_KEY 5 | const authMiddlewareOptions = { 6 | host: import.meta.env.VITE_AUTH_URL, 7 | projectKey, 8 | credentials: { 9 | clientId: import.meta.env.VITE_CTP_CLIENT_ID, 10 | clientSecret: import.meta.env.VITE_CTP_CLIENT_SECRET, 11 | }, 12 | scopes: [`manage_project:${projectKey}`], 13 | httpClient: fetch, 14 | } 15 | 16 | const httpMiddlewareOptions = { 17 | host: import.meta.env.VITE_API_URL, 18 | httpClient: fetch, 19 | } 20 | 21 | const client = new ClientBuilder() 22 | .withClientCredentialsFlow(authMiddlewareOptions) 23 | .withHttpMiddleware(httpMiddlewareOptions) 24 | .withLoggerMiddleware() 25 | .build() 26 | 27 | export const getApiRoot = () => { 28 | return createApiBuilderFromCtpClient(client) 29 | } 30 | -------------------------------------------------------------------------------- /examples/vue-example-app/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@vue/tsconfig/tsconfig.dom.json", 3 | "include": ["env.d.ts", "src/**/*", "src/**/*.vue"], 4 | "exclude": ["src/**/__tests__/*"], 5 | "compilerOptions": { 6 | "allowJs": true, 7 | "noImplicitAny": false, 8 | "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", 9 | "types": ["vite/client"], 10 | "paths": { 11 | "@/*": ["./src/*"] 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /examples/vue-example-app/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": [], 3 | "references": [ 4 | { 5 | "path": "./tsconfig.node.json" 6 | }, 7 | { 8 | "path": "./tsconfig.app.json" 9 | } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /examples/vue-example-app/tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@tsconfig/node22/tsconfig.json", 3 | "include": [ 4 | "vite.config.*", 5 | "vitest.config.*", 6 | "cypress.config.*", 7 | "nightwatch.conf.*", 8 | "playwright.config.*", 9 | "eslint.config.*" 10 | ], 11 | "compilerOptions": { 12 | "noEmit": true, 13 | "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", 14 | 15 | "module": "ESNext", 16 | "moduleResolution": "Bundler", 17 | "types": ["node"] 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /examples/vue-example-app/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { fileURLToPath, URL } from 'node:url' 2 | 3 | import { defineConfig } from 'vite' 4 | import vue from '@vitejs/plugin-vue' 5 | import vueDevTools from 'vite-plugin-vue-devtools' 6 | 7 | // https://vite.dev/config/ 8 | export default defineConfig({ 9 | base: './', 10 | plugins: [vue(), vueDevTools()], 11 | resolve: { 12 | alias: { 13 | '@': fileURLToPath(new URL('./src', import.meta.url)), 14 | }, 15 | }, 16 | }) 17 | -------------------------------------------------------------------------------- /global.d.ts: -------------------------------------------------------------------------------- 1 | import 'jest-extended'; 2 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @type {import('@jest/types').Config.ProjectConfig} 3 | */ 4 | module.exports = { 5 | preset: 'ts-jest', 6 | testTimeout: 15000, 7 | testEnvironment: 'node', 8 | transform: { 9 | '^.+\\.js$': 'babel-jest', 10 | '^.+\\.tsx?$': 'ts-jest', 11 | }, 12 | testRegex: '\\.(test|spec)\\.[t]sx?$', 13 | testPathIgnorePatterns: ['/sdk-client/'], 14 | moduleFileExtensions: ['ts', 'js', 'json'], 15 | coverageDirectory: 'coverage', 16 | coveragePathIgnorePatterns: [ 17 | '/sdk-client/', 18 | '/node_modules/', 19 | '/dist/', 20 | '/generated/', 21 | ], 22 | watchPlugins: ['jest-watch-typeahead/filename'], 23 | reporters: [ 24 | 'default', 25 | process.env.CI === 'true' 26 | ? [ 27 | 'jest-junit', 28 | { outputName: 'results.xml', outputDirectory: 'test-results' }, 29 | ] 30 | : null, 31 | ].filter(Boolean), 32 | setupFiles: ['/.jest/setEnvVars.js'], 33 | setupFilesAfterEnv: ['jest-extended/all'], 34 | } 35 | -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "packages": ["packages/**"], 3 | "useWorkspaces": true, 4 | "npmclient": "yarn", 5 | "version": "independent" 6 | } 7 | -------------------------------------------------------------------------------- /packages/Makefile: -------------------------------------------------------------------------------- 1 | SHELL := /bin/bash 2 | PACKAGE_DIR ?= $(LIB_NAME) 3 | 4 | generate_sdk: generate_sdk_main generate_sdk_test 5 | 6 | generate_sdk_main: 7 | rmf-codegen generate -o "$(LIB_NAME)-sdk/src/generated" -t TYPESCRIPT_CLIENT $(GEN_RAML_FILE) 8 | 9 | generate_sdk_test: 10 | rmf-codegen generate -o "$(LIB_NAME)-sdk/test/generated" -t TYPESCRIPT_TEST $(GEN_RAML_FILE) 11 | -------------------------------------------------------------------------------- /packages/history-sdk/src/ctp/ctp-client.ts: -------------------------------------------------------------------------------- 1 | import { ApiRoot } from '../generated/index' 2 | 3 | export function createApiBuilderFromCtpClient( 4 | ctpClient: any, 5 | baseUri?: string 6 | ): ApiRoot { 7 | return new ApiRoot({ 8 | executeRequest: ctpClient.execute, 9 | baseUri: baseUri, 10 | }) 11 | } 12 | -------------------------------------------------------------------------------- /packages/history-sdk/src/generated/client/api-root.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | import { executeRequest } from '../shared/utils/common-types' 7 | import { ByProjectKeyRequestBuilder } from './by-project-key-request-builder' 8 | 9 | export class ApiRoot { 10 | private executeRequest: executeRequest 11 | private baseUri: string 12 | 13 | constructor(args: { executeRequest: executeRequest; baseUri?: string }) { 14 | this.executeRequest = args.executeRequest 15 | this.baseUri = 16 | args.baseUri || 'https://history.europe-west1.gcp.commercetools.com' 17 | } 18 | 19 | public withProjectKeyValue(childPathArgs: { 20 | projectKey: string 21 | }): ByProjectKeyRequestBuilder { 22 | return new ByProjectKeyRequestBuilder({ 23 | pathArgs: { 24 | ...childPathArgs, 25 | }, 26 | executeRequest: this.executeRequest, 27 | baseUri: this.baseUri, 28 | }) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /packages/history-sdk/src/generated/models/cart-discount.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | export interface PatternComponent { 8 | /** 9 | * 10 | */ 11 | readonly type: string 12 | } 13 | -------------------------------------------------------------------------------- /packages/history-sdk/src/generated/models/scalar-types.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | export type Locale = string 8 | -------------------------------------------------------------------------------- /packages/history-sdk/src/generated/shared/utils/requests-utils.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate -o -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { ClientRequest, ClientResponse, executeRequest } from './common-types' 8 | import { buildRelativeUri } from './uri-utils' 9 | 10 | export class ApiRequest { 11 | private request: ClientRequest 12 | constructor( 13 | request: ClientRequest, 14 | private readonly requestExecutor: executeRequest 15 | ) { 16 | this.request = { 17 | ...request, 18 | uri: buildRelativeUri(request), 19 | } 20 | } 21 | 22 | public clientRequest(): ClientRequest { 23 | return this.request 24 | } 25 | 26 | public execute(): Promise> { 27 | return this.requestExecutor(this.request) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /packages/history-sdk/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './ctp/ctp-client' 2 | export * from './generated/index' 3 | -------------------------------------------------------------------------------- /packages/history-sdk/test/helpers/api-helpers.ts: -------------------------------------------------------------------------------- 1 | import { ClientBuilder } from '@commercetools/ts-client' 2 | import { createApiBuilderFromCtpClient } from '../../src' 3 | import { requireEnvVar } from './test-utils' 4 | 5 | const projectKey = requireEnvVar('CTP_PROJECT_KEY') 6 | const clientId = requireEnvVar('CTP_CLIENT_ID') 7 | const clientSecret = requireEnvVar('CTP_CLIENT_SECRET') 8 | const authURL = requireEnvVar('CTP_AUTH_URL') 9 | const ctp_host = requireEnvVar('CTP_HISTORY_URL') 10 | 11 | const authMiddleware = { 12 | host: authURL, 13 | projectKey, 14 | credentials: { 15 | clientId, 16 | clientSecret, 17 | }, 18 | httpClient: fetch, 19 | } 20 | 21 | const httpMiddleware = { 22 | host: ctp_host, 23 | httpClient: fetch, 24 | } 25 | 26 | const ctpClient = new ClientBuilder() 27 | .withClientCredentialsFlow(authMiddleware) 28 | .withHttpMiddleware(httpMiddleware) 29 | .build() 30 | 31 | export const ctpApiBuilder = createApiBuilderFromCtpClient( 32 | ctpClient 33 | ).withProjectKeyValue({ projectKey }) 34 | -------------------------------------------------------------------------------- /packages/history-sdk/test/helpers/test-utils.ts: -------------------------------------------------------------------------------- 1 | export function requireEnvVar(varName: string): string { 2 | const value = process.env[varName] 3 | if (value === null || value === undefined) { 4 | throw new Error(`environment variable ${varName} not defined`) 5 | } 6 | return value 7 | } 8 | 9 | export const scopes = [ 10 | 'view_audit_log:demo-1', 11 | 'manage_api_clients:demo-1', 12 | 'view_api_clients:demo-1', 13 | ] 14 | -------------------------------------------------------------------------------- /packages/history-sdk/test/misc.test.ts: -------------------------------------------------------------------------------- 1 | import { ctpApiBuilder } from './helpers/api-helpers' 2 | import { requireEnvVar } from './helpers/test-utils' 3 | 4 | describe('::misc', () => { 5 | const _var = (env: string) => `environment variable ${env} not defined` 6 | test('should throw error if `env` is falsy', () => { 7 | const env1 = 'UNKNOWN_ENV', 8 | env2 = 'UNDEFINED_ENV' 9 | expect(() => requireEnvVar(env1)).toThrow(_var(env1)) 10 | expect(() => requireEnvVar(env2)).toThrow(_var(env2)) 11 | }) 12 | 13 | test.skip('check can get project info', async () => { 14 | const res = await ctpApiBuilder 15 | .get({ queryArgs: { limit: 1, offset: 0 } }) 16 | .execute() 17 | expect(res.statusCode).toEqual(200) 18 | }) 19 | }) 20 | -------------------------------------------------------------------------------- /packages/history-sdk/test/request-with-method.ts: -------------------------------------------------------------------------------- 1 | import { ApiRequest } from '../src/generated/shared/utils/requests-utils' 2 | 3 | export interface RequestWithMethod { 4 | method: string 5 | uri: string 6 | request: ApiRequest 7 | } 8 | -------------------------------------------------------------------------------- /packages/history-sdk/tsconfig-declarations.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": ".", 4 | "module": "commonjs", 5 | "declaration": true, 6 | "declarationMap": false, 7 | "isolatedModules": false, 8 | "noEmit": false, 9 | "allowJs": false, 10 | "emitDeclarationOnly": true, 11 | "paths": { 12 | "~/*": ["./src/*"], 13 | "*": ["./src/generated/*"], 14 | "models/*": ["./src/generated/models/*"], 15 | "client/*": ["./src/generated/client/*"], 16 | "shared/*": ["./src/generated/shared/*"] 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/history-sdk/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "rootDir": "src", 5 | "outDir": "dist" 6 | }, 7 | "include": ["src"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/history-sdk/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "History API SDK", 3 | "extends": ["../../typedoc.base.json"], 4 | "entryPoints": ["src/index.ts"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/importapi-sdk/src/ctp/ctp-client.ts: -------------------------------------------------------------------------------- 1 | import { ApiRoot } from './../generated/index' 2 | 3 | export function createApiBuilderFromCtpClient( 4 | ctpClient: any, 5 | baseUri?: string 6 | ): ApiRoot { 7 | return new ApiRoot({ 8 | executeRequest: ctpClient.execute, 9 | baseUri: baseUri, 10 | }) 11 | } 12 | -------------------------------------------------------------------------------- /packages/importapi-sdk/src/generated/client/api-root.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | import { executeRequest } from '../shared/utils/common-types' 7 | import { ByProjectKeyRequestBuilder } from './by-project-key-request-builder' 8 | 9 | export class ApiRoot { 10 | private executeRequest: executeRequest 11 | private baseUri: string 12 | 13 | constructor(args: { executeRequest: executeRequest; baseUri?: string }) { 14 | this.executeRequest = args.executeRequest 15 | this.baseUri = 16 | args.baseUri || 'https://import.europe-west1.gcp.commercetools.com' 17 | } 18 | 19 | public withProjectKeyValue(childPathArgs: { 20 | projectKey: string 21 | }): ByProjectKeyRequestBuilder { 22 | return new ByProjectKeyRequestBuilder({ 23 | pathArgs: { 24 | ...childPathArgs, 25 | }, 26 | executeRequest: this.executeRequest, 27 | baseUri: this.baseUri, 28 | }) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /packages/importapi-sdk/src/generated/client/orders/by-project-key-orders-request-builder.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | import { executeRequest } from '../../shared/utils/common-types' 7 | import { ByProjectKeyOrdersImportContainersRequestBuilder } from '../import-containers/by-project-key-orders-import-containers-request-builder' 8 | /** 9 | **/ 10 | export class ByProjectKeyOrdersRequestBuilder { 11 | constructor( 12 | protected readonly args: { 13 | pathArgs: { 14 | projectKey: string 15 | } 16 | executeRequest: executeRequest 17 | baseUri?: string 18 | } 19 | ) {} 20 | public importContainers(): ByProjectKeyOrdersImportContainersRequestBuilder { 21 | return new ByProjectKeyOrdersImportContainersRequestBuilder({ 22 | pathArgs: { 23 | ...this.args.pathArgs, 24 | }, 25 | executeRequest: this.args.executeRequest, 26 | baseUri: this.args.baseUri, 27 | }) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /packages/importapi-sdk/src/generated/client/prices/by-project-key-prices-request-builder.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | import { executeRequest } from '../../shared/utils/common-types' 7 | import { ByProjectKeyPricesImportContainersRequestBuilder } from '../import-containers/by-project-key-prices-import-containers-request-builder' 8 | /** 9 | **/ 10 | export class ByProjectKeyPricesRequestBuilder { 11 | constructor( 12 | protected readonly args: { 13 | pathArgs: { 14 | projectKey: string 15 | } 16 | executeRequest: executeRequest 17 | baseUri?: string 18 | } 19 | ) {} 20 | public importContainers(): ByProjectKeyPricesImportContainersRequestBuilder { 21 | return new ByProjectKeyPricesImportContainersRequestBuilder({ 22 | pathArgs: { 23 | ...this.args.pathArgs, 24 | }, 25 | executeRequest: this.args.executeRequest, 26 | baseUri: this.args.baseUri, 27 | }) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /packages/importapi-sdk/src/generated/client/types/by-project-key-types-request-builder.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | import { executeRequest } from '../../shared/utils/common-types' 7 | import { ByProjectKeyTypesImportContainersRequestBuilder } from '../import-containers/by-project-key-types-import-containers-request-builder' 8 | /** 9 | **/ 10 | export class ByProjectKeyTypesRequestBuilder { 11 | constructor( 12 | protected readonly args: { 13 | pathArgs: { 14 | projectKey: string 15 | } 16 | executeRequest: executeRequest 17 | baseUri?: string 18 | } 19 | ) {} 20 | public importContainers(): ByProjectKeyTypesImportContainersRequestBuilder { 21 | return new ByProjectKeyTypesImportContainersRequestBuilder({ 22 | pathArgs: { 23 | ...this.args.pathArgs, 24 | }, 25 | executeRequest: this.args.executeRequest, 26 | baseUri: this.args.baseUri, 27 | }) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /packages/importapi-sdk/src/generated/shared/utils/requests-utils.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate -o -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { ClientRequest, ClientResponse, executeRequest } from './common-types' 8 | import { buildRelativeUri } from './uri-utils' 9 | 10 | export class ApiRequest { 11 | private request: ClientRequest 12 | constructor( 13 | request: ClientRequest, 14 | private readonly requestExecutor: executeRequest 15 | ) { 16 | this.request = { 17 | ...request, 18 | uri: buildRelativeUri(request), 19 | } 20 | } 21 | 22 | public clientRequest(): ClientRequest { 23 | return this.request 24 | } 25 | 26 | public execute(): Promise> { 27 | return this.requestExecutor(this.request) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /packages/importapi-sdk/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './ctp/ctp-client' 2 | export * from './generated/index' 3 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/generated/client/by-project-key-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../request-with-method' 8 | import { ApiRoot } from '../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/generated/client/categories/by-project-key-categories-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/generated/client/customers/by-project-key-customers-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/generated/client/discount-codes/by-project-key-discount-codes-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/generated/client/import-containers/by-project-key-categories-import-containers-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/generated/client/import-containers/by-project-key-customers-import-containers-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/generated/client/import-containers/by-project-key-discount-codes-import-containers-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/generated/client/import-containers/by-project-key-inventories-import-containers-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/generated/client/import-containers/by-project-key-order-patches-import-containers-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/generated/client/import-containers/by-project-key-orders-import-containers-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/generated/client/import-containers/by-project-key-prices-import-containers-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/generated/client/import-containers/by-project-key-product-drafts-import-containers-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/generated/client/import-containers/by-project-key-product-types-import-containers-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/generated/client/import-containers/by-project-key-product-variant-patches-import-containers-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/generated/client/import-containers/by-project-key-product-variants-import-containers-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/generated/client/import-containers/by-project-key-products-import-containers-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/generated/client/import-containers/by-project-key-standalone-prices-import-containers-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/generated/client/import-containers/by-project-key-types-import-containers-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/generated/client/import-operations/by-project-key-import-operations-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/generated/client/inventories/by-project-key-inventories-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/generated/client/order-patches/by-project-key-order-patches-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/generated/client/orders/by-project-key-orders-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/generated/client/prices/by-project-key-prices-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/generated/client/product-drafts/by-project-key-product-drafts-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/generated/client/product-types/by-project-key-product-types-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/generated/client/product-variant-patches/by-project-key-product-variant-patches-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/generated/client/product-variants/by-project-key-product-variants-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/generated/client/products/by-project-key-products-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/generated/client/standalone-prices/by-project-key-standalone-prices-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/generated/client/types/by-project-key-types-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/helpers/ctp-api-helper.ts: -------------------------------------------------------------------------------- 1 | import { ClientBuilder } from '@commercetools/ts-client' 2 | import { createApiBuilderFromCtpClient } from '../../src' 3 | import { requireEnvVar } from './test-utils' 4 | 5 | const projectKey = requireEnvVar('CTP_PROJECT_KEY') 6 | const clientId = requireEnvVar('CTP_CLIENT_ID') 7 | const clientSecret = requireEnvVar('CTP_CLIENT_SECRET') 8 | const authURL = requireEnvVar('CTP_AUTH_URL') 9 | const ctp_host = requireEnvVar('CTP_IMPORT_URL') 10 | 11 | const authMiddleware = { 12 | host: authURL, 13 | projectKey, 14 | credentials: { 15 | clientId, 16 | clientSecret, 17 | }, 18 | httpClient: fetch, 19 | } 20 | 21 | const httpMiddleware = { 22 | host: ctp_host, 23 | httpClient: fetch, 24 | } 25 | 26 | const ctpClient = new ClientBuilder() 27 | .withClientCredentialsFlow(authMiddleware) 28 | .withHttpMiddleware(httpMiddleware) 29 | .build() 30 | 31 | export const ctpApiBuilder = createApiBuilderFromCtpClient( 32 | ctpClient 33 | ).withProjectKeyValue({ projectKey }) 34 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/helpers/test-utils.ts: -------------------------------------------------------------------------------- 1 | export function requireEnvVar(varName: string): string { 2 | const value = process.env[varName] 3 | if (value === null || value === undefined) { 4 | throw new Error(`environment variable ${varName} not defined`) 5 | } 6 | return value 7 | } 8 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/misc.test.ts: -------------------------------------------------------------------------------- 1 | import { ctpApiBuilder } from './helpers/ctp-api-helper' 2 | import { requireEnvVar } from './helpers/test-utils' 3 | 4 | describe('::misc', () => { 5 | const _var = (env: string) => `environment variable ${env} not defined` 6 | test('should throw error if `env` is falsy', () => { 7 | const env1 = 'UNKNOWN_ENV', 8 | env2 = 'UNDEFINED_ENV' 9 | expect(() => requireEnvVar(env1)).toThrow(_var(env1)) 10 | expect(() => requireEnvVar(env2)).toThrow(_var(env2)) 11 | }) 12 | 13 | test.skip('check can get project info', async () => { 14 | const res = await ctpApiBuilder 15 | .importContainers() 16 | .get({ queryArgs: { limit: 1, offset: 0 } }) 17 | .execute() 18 | expect(res.statusCode).toEqual(200) 19 | }) 20 | }) 21 | -------------------------------------------------------------------------------- /packages/importapi-sdk/test/request-with-method.ts: -------------------------------------------------------------------------------- 1 | import { ApiRequest } from '../src/generated/shared/utils/requests-utils' 2 | 3 | export interface RequestWithMethod { 4 | method: string 5 | uri: string 6 | request: ApiRequest 7 | } 8 | -------------------------------------------------------------------------------- /packages/importapi-sdk/tsconfig-declarations.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": ".", 4 | "module": "commonjs", 5 | "declaration": true, 6 | "declarationMap": false, 7 | "isolatedModules": false, 8 | "noEmit": false, 9 | "allowJs": false, 10 | "emitDeclarationOnly": true, 11 | "paths": { 12 | "~/*": ["./src/*"], 13 | "*": ["./src/generated/*"], 14 | "models/*": ["./src/generated/models/*"], 15 | "client/*": ["./src/generated/client/*"], 16 | "shared/*": ["./src/generated/shared/*"] 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/importapi-sdk/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "rootDir": "src", 5 | "outDir": "dist" 6 | }, 7 | "include": ["src"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/importapi-sdk/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Import API SDK", 3 | "extends": ["../../typedoc.base.json"], 4 | "entryPoints": ["src/index.ts"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/platform-sdk/src/ctp/ctp-client.ts: -------------------------------------------------------------------------------- 1 | import { ApiRoot } from './../generated/index' 2 | 3 | export function createApiBuilderFromCtpClient( 4 | ctpClient: any, 5 | baseUri?: string 6 | ): ApiRoot { 7 | return new ApiRoot({ 8 | executeRequest: ctpClient.execute, 9 | baseUri: baseUri, 10 | }) 11 | } 12 | -------------------------------------------------------------------------------- /packages/platform-sdk/src/generated/models/scalar-types.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | export type Expansion = string 8 | export type Locale = string 9 | export type QueryPredicate = string 10 | export type Sort = string 11 | -------------------------------------------------------------------------------- /packages/platform-sdk/src/generated/models/store-country.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | export interface StoreCountry { 8 | /** 9 | * Two-digit country code as per [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). 10 | * 11 | * 12 | */ 13 | readonly code: string 14 | } 15 | -------------------------------------------------------------------------------- /packages/platform-sdk/src/generated/shared/utils/requests-utils.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate -o -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { ClientRequest, ClientResponse, executeRequest } from './common-types' 8 | import { buildRelativeUri } from './uri-utils' 9 | 10 | export class ApiRequest { 11 | private request: ClientRequest 12 | constructor( 13 | request: ClientRequest, 14 | private readonly requestExecutor: executeRequest 15 | ) { 16 | this.request = { 17 | ...request, 18 | uri: buildRelativeUri(request), 19 | } 20 | } 21 | 22 | public clientRequest(): ClientRequest { 23 | return this.request 24 | } 25 | 26 | public execute(): Promise> { 27 | return this.requestExecutor(this.request) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /packages/platform-sdk/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './ctp/ctp-client' 2 | export * from './generated/index' 3 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/__setup__/setup.js: -------------------------------------------------------------------------------- 1 | // add all jest-extended matchers 2 | import * as matchers from 'jest-extended' 3 | expect.extend(matchers) 4 | 5 | // or just add specific matchers 6 | import { toBeArray, toBeSealed } from 'jest-extended' 7 | expect.extend({ toBeArray, toBeSealed }) 8 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/check-project.test.ts: -------------------------------------------------------------------------------- 1 | import { ctpApiBuilder } from './helpers/ctp-api-helper' 2 | 3 | test.skip('check can get project info', async () => { 4 | const res = await ctpApiBuilder.get().execute() 5 | expect(res.statusCode).toEqual(200) 6 | expect(res.body.key).toBeDefined() 7 | }) 8 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/generated/client/as-associate/by-project-key-as-associate-by-associate-id-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/generated/client/as-associate/by-project-key-as-associate-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/generated/client/in-business-unit/by-project-key-as-associate-by-associate-id-in-business-unit-key-by-business-unit-key-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/generated/client/in-business-unit/by-project-key-in-business-unit-key-by-business-unit-key-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/generated/client/in-store/by-project-key-in-store-key-by-store-key-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/generated/client/me/by-project-key-in-business-unit-key-by-business-unit-key-me-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/generated/client/product-projections/by-project-key-in-store-key-by-store-key-product-projections-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/generated/client/products/by-project-key-in-store-key-by-store-key-products-by-product-id-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/generated/client/products/by-project-key-in-store-key-by-store-key-products-key-by-product-key-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/generated/client/products/by-project-key-in-store-key-by-store-key-products-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/generated/client/shipping-methods/by-project-key-in-store-key-by-store-key-shipping-methods-request-builder.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. 3 | * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. 4 | * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. 5 | */ 6 | 7 | import { RequestWithMethod } from '../../../request-with-method' 8 | import { ApiRoot } from '../../../../src' 9 | 10 | const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) 11 | 12 | test('test', () => { 13 | expect(apiRoot).toBeInstanceOf(ApiRoot) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/helpers/ctp-api-helper.ts: -------------------------------------------------------------------------------- 1 | import { ClientBuilder } from '@commercetools/ts-client' 2 | import { createApiBuilderFromCtpClient } from '../../src' 3 | import { requireEnvVar } from './test-utils' 4 | 5 | const projectKey = requireEnvVar('CTP_PROJECT_KEY') 6 | const clientId = requireEnvVar('CTP_CLIENT_ID') 7 | const clientSecret = requireEnvVar('CTP_CLIENT_SECRET') 8 | const authURL = requireEnvVar('CTP_AUTH_URL') 9 | const ctp_host = requireEnvVar('CTP_API_URL') 10 | 11 | const authMiddleware = { 12 | host: authURL, 13 | projectKey, 14 | credentials: { 15 | clientId, 16 | clientSecret, 17 | }, 18 | httpClient: fetch, 19 | } 20 | 21 | const httpMiddleware = { 22 | host: ctp_host, 23 | httpClient: fetch, 24 | } 25 | 26 | const ctpClient = new ClientBuilder() 27 | .withClientCredentialsFlow(authMiddleware) 28 | .withHttpMiddleware(httpMiddleware) 29 | .build() 30 | 31 | export const ctpApiBuilder = createApiBuilderFromCtpClient( 32 | ctpClient 33 | ).withProjectKey({ projectKey }) 34 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/integration-tests/cart/cart-fixture.ts: -------------------------------------------------------------------------------- 1 | import { randomUUID } from 'crypto' 2 | import { apiRoot } from '../test-utils' 3 | import { CartDraft } from '../../../src' 4 | 5 | const cartDraft: CartDraft = { 6 | key: 'test-cart-key-' + randomUUID(), 7 | currency: 'EUR', 8 | country: 'DE', 9 | shippingAddress: { 10 | country: 'DE', 11 | state: 'Berlin', 12 | }, 13 | } 14 | export const createCartDraftWithCustomer = (customer) => { 15 | const cartDraft: CartDraft = { 16 | key: 'test-cart-key-' + randomUUID(), 17 | currency: 'EUR', 18 | country: 'DE', 19 | customerId: customer.body.customer.id, 20 | } 21 | 22 | return cartDraft 23 | } 24 | 25 | export const createCart = async (cartDraftBody?) => 26 | apiRoot 27 | .carts() 28 | .post({ body: cartDraftBody || cartDraft }) 29 | .execute() 30 | 31 | export const deleteCart = async (cart) => { 32 | // get latest cart 33 | const _cart = await apiRoot 34 | .carts() 35 | .withId({ ID: cart.body.id }) 36 | .get() 37 | .execute() 38 | 39 | // delete cart 40 | await apiRoot 41 | .carts() 42 | .withId({ ID: cart.body.id }) 43 | .delete({ 44 | queryArgs: { version: _cart.body.version }, 45 | }) 46 | .execute() 47 | } 48 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/integration-tests/category/category-fixture.ts: -------------------------------------------------------------------------------- 1 | import { apiRoot } from '../test-utils' 2 | import { CategoryDraft } from '../../../src' 3 | import { randomUUID } from 'crypto' 4 | 5 | export const createCategory = async () => { 6 | const categoryDraft: CategoryDraft = { 7 | key: 'test-key-category-' + randomUUID(), 8 | name: { en: 'test-name-category-' + randomUUID() }, 9 | slug: { en: 'test-slug-category-' + randomUUID() }, 10 | } 11 | return apiRoot.categories().post({ body: categoryDraft }).execute() 12 | } 13 | 14 | export const deleteCategory = async (category) => 15 | apiRoot 16 | .categories() 17 | .withId({ ID: category.body.id }) 18 | .delete({ queryArgs: { version: category.body.version } }) 19 | .execute() 20 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/integration-tests/channel/channel-fixture.ts: -------------------------------------------------------------------------------- 1 | import { randomUUID } from 'crypto' 2 | import { apiRoot } from '../test-utils' 3 | import { ChannelDraft, GeoJson } from '../../../src' 4 | 5 | const geolocation: GeoJson = { 6 | type: 'Point', 7 | coordinates: [13.0, 51.0], 8 | } 9 | const channelDraft: ChannelDraft = { 10 | key: randomUUID(), 11 | roles: ['InventorySupply'], 12 | geoLocation: geolocation, 13 | } 14 | 15 | export const createChannel = async () => 16 | apiRoot.channels().post({ body: channelDraft }).execute() 17 | 18 | export const deleteChannel = async (responseCreatedChannel) => 19 | apiRoot 20 | .channels() 21 | .withId({ ID: responseCreatedChannel.body.id }) 22 | .delete({ queryArgs: { version: responseCreatedChannel.body.version } }) 23 | .execute() 24 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/integration-tests/custom-object/custom-object-fixture.ts: -------------------------------------------------------------------------------- 1 | import { apiRoot } from '../test-utils' 2 | 3 | export const deleteCustomObject = async (customObject) => 4 | apiRoot 5 | .customObjects() 6 | .withContainerAndKey({ 7 | container: customObject.body.container, 8 | key: customObject.body.key, 9 | }) 10 | .delete({ queryArgs: { version: customObject.body.version } }) 11 | .execute() 12 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/integration-tests/customer-group/customer-group-fixture.ts: -------------------------------------------------------------------------------- 1 | import { randomUUID } from 'crypto' 2 | import { apiRoot } from '../test-utils' 3 | import { CustomerGroupDraft } from '../../../src' 4 | 5 | const customerGroupDraft: CustomerGroupDraft = { 6 | key: 'test-key-customer-group-' + randomUUID(), 7 | groupName: 'test-name-customerGroup' + randomUUID(), 8 | } 9 | 10 | export const createCustomerGroup = async ( 11 | customerGroupDraftBody?: CustomerGroupDraft 12 | ) => 13 | apiRoot 14 | .customerGroups() 15 | .post({ body: customerGroupDraftBody || customerGroupDraft }) 16 | .execute() 17 | 18 | export const deleteCustomerGroup = async (customerGroup) => 19 | apiRoot 20 | .customerGroups() 21 | .withId({ ID: customerGroup.body.id }) 22 | .delete({ 23 | queryArgs: { version: customerGroup.body.version }, 24 | }) 25 | .execute() 26 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/integration-tests/customer/customer.me.test.ts: -------------------------------------------------------------------------------- 1 | import { apiRoot } from '../test-utils' 2 | import { ClientResponse, CustomerSignInResult } from '../../../src' 3 | import { createCustomer, createCustomerDraft } from './customer-fixture' 4 | import { createCustomerGroup } from '../customer-group/customer-group-fixture' 5 | 6 | describe('testing me endpoint customer', () => { 7 | it('should sign in using me endpoint', async () => { 8 | const customerGroup = await createCustomerGroup() 9 | const customerDraft = await createCustomerDraft(customerGroup) 10 | const customer = await createCustomer(customerDraft) 11 | 12 | const responseLoginMe: ClientResponse = await apiRoot 13 | .me() 14 | .login() 15 | .post({ 16 | body: { 17 | email: customer.body.customer.email, 18 | password: customerDraft.password, 19 | }, 20 | }) 21 | .execute() 22 | expect(responseLoginMe.statusCode).toBe(200) 23 | expect(responseLoginMe.body).toBeDefined() 24 | }) 25 | }) 26 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/integration-tests/discount-code/discount-code-fixture.ts: -------------------------------------------------------------------------------- 1 | import { apiRoot } from '../test-utils' 2 | 3 | export const createDiscountCode = async (discountCodeDraft) => 4 | apiRoot.discountCodes().post({ body: discountCodeDraft }).execute() 5 | 6 | export const deleteDiscountCode = async (discountCode) => 7 | apiRoot 8 | .discountCodes() 9 | .withId({ ID: discountCode.body.id }) 10 | .delete({ queryArgs: { version: discountCode.body.version } }) 11 | .execute() 12 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/integration-tests/extension/extension-fixture.ts: -------------------------------------------------------------------------------- 1 | import { apiRoot } from '../test-utils' 2 | 3 | export const deleteExtension = async (extension) => 4 | apiRoot 5 | .extensions() 6 | .withId({ ID: extension.body.id }) 7 | .delete({ 8 | queryArgs: { version: extension.body.version }, 9 | }) 10 | .execute() 11 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/integration-tests/extension/extension.test.ts: -------------------------------------------------------------------------------- 1 | import { randomUUID } from 'crypto' 2 | import { apiRoot } from '../test-utils' 3 | import { ExtensionDraft, HttpDestination } from '../../../src' 4 | import { deleteExtension } from './extension-fixture' 5 | 6 | describe('testing extension API calls', () => { 7 | let extension 8 | it('should create an extension', async () => { 9 | const httpDestination: HttpDestination = { 10 | type: 'HTTP', 11 | url: 'http://www.commercetools.com', 12 | } 13 | 14 | const extensionDraft: ExtensionDraft = { 15 | key: randomUUID(), 16 | destination: httpDestination, 17 | triggers: [ 18 | { 19 | resourceTypeId: 'cart', 20 | actions: ['Create'], 21 | }, 22 | ], 23 | } 24 | 25 | extension = await apiRoot 26 | .extensions() 27 | .post({ body: extensionDraft }) 28 | .execute() 29 | 30 | expect(extension.body).toBeDefined() 31 | expect(extension.statusCode).toEqual(201) 32 | }) 33 | 34 | afterAll(async () => { 35 | await deleteExtension(extension) 36 | }) 37 | }) 38 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/integration-tests/inventory/inventory-fixture.ts: -------------------------------------------------------------------------------- 1 | import { apiRoot } from '../test-utils' 2 | 3 | export const deleteInventory = async (inventory) => 4 | apiRoot 5 | .inventory() 6 | .withId({ ID: inventory.body.id }) 7 | .delete({ 8 | queryArgs: { version: inventory.body.version }, 9 | }) 10 | .execute() 11 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/integration-tests/order/order-fixture.ts: -------------------------------------------------------------------------------- 1 | import { randomUUID } from 'crypto' 2 | import { apiRoot } from '../test-utils' 3 | import { CartResourceIdentifier, OrderFromCartDraft } from '../../../src' 4 | 5 | export const createOrder = async (cart) => { 6 | const cartResourceIdentifier: CartResourceIdentifier = { 7 | typeId: 'cart', 8 | id: cart.body.id, 9 | } 10 | 11 | const orderFromCartDraft: OrderFromCartDraft = { 12 | cart: cartResourceIdentifier, 13 | version: cart.body.version, 14 | orderNumber: randomUUID(), 15 | } 16 | 17 | return apiRoot.orders().post({ body: orderFromCartDraft }).execute() 18 | } 19 | 20 | export const deleteOrder = async (order) => 21 | apiRoot 22 | .orders() 23 | .withId({ ID: order.body.id }) 24 | .delete({ 25 | queryArgs: { version: order.body.version }, 26 | }) 27 | .execute() 28 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/integration-tests/payment/payment-fixture.ts: -------------------------------------------------------------------------------- 1 | import { apiRoot } from '../test-utils' 2 | import { randomUUID } from 'crypto' 3 | import { _Money, PaymentDraft, PaymentMethodInfo } from '../../../src' 4 | 5 | const money: _Money = { 6 | centAmount: 1000, 7 | currencyCode: 'EUR', 8 | } 9 | 10 | const paymentMethodInfo: PaymentMethodInfo = { 11 | paymentInterface: 'testInterface', 12 | name: { en: 'test-name-paymentMethodInfo' + randomUUID() }, 13 | } 14 | 15 | const paymentDraft: PaymentDraft = { 16 | key: 'payment-test' + randomUUID(), 17 | amountPlanned: money, 18 | interfaceId: 'interfaceid-test' + randomUUID(), 19 | paymentMethodInfo, 20 | } 21 | 22 | export const createPayment = async () => 23 | apiRoot.payments().post({ body: paymentDraft }).execute() 24 | 25 | export const deletePayment = async (payment) => 26 | apiRoot 27 | .payments() 28 | .withId({ ID: payment.body.id }) 29 | .delete({ 30 | queryArgs: { version: payment.body.version }, 31 | }) 32 | .execute() 33 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/integration-tests/product/resources/image.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/commercetools/commercetools-sdk-typescript/be1e9c1a5dd79230818864b70742b517e746f960/packages/platform-sdk/test/integration-tests/product/resources/image.jpeg -------------------------------------------------------------------------------- /packages/platform-sdk/test/integration-tests/project/project.test.ts: -------------------------------------------------------------------------------- 1 | import { ctpApiBuilder } from '../../helpers/ctp-api-helper' 2 | 3 | describe('testing project API calls', () => { 4 | it('should get by Key and update a project', async () => { 5 | const countries = ['DE'] 6 | 7 | const project = await ctpApiBuilder.get().execute() 8 | 9 | const updateProject = await ctpApiBuilder 10 | .post({ 11 | body: { 12 | version: project.body.version, 13 | actions: [ 14 | { 15 | action: 'changeCountries', 16 | countries, 17 | }, 18 | ], 19 | }, 20 | }) 21 | .execute() 22 | 23 | expect(updateProject.body.version).toBeDefined() 24 | expect(updateProject.statusCode).toEqual(200) 25 | }) 26 | }) 27 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/integration-tests/review/review-fixture.ts: -------------------------------------------------------------------------------- 1 | import { apiRoot } from '../test-utils' 2 | 3 | export const deleteReview = async (responseCreatedReview) => 4 | apiRoot 5 | .reviews() 6 | .withId({ ID: responseCreatedReview.body.id }) 7 | .delete({ 8 | queryArgs: { version: responseCreatedReview.body.version }, 9 | }) 10 | .execute() 11 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/integration-tests/sdk-v3/concurrent-processing.test.ts: -------------------------------------------------------------------------------- 1 | import { createCategory, deleteCategory } from '../category/category-fixture' 2 | import { apiRoot, createTokenCache } from '../test-utils' 3 | 4 | describe('Concurrent processing in sdk v3', () => { 5 | let category1, category2 6 | it(`should fetch 2 categories concurrently`, async () => { 7 | category1 = await createCategory() 8 | category2 = await createCategory() 9 | 10 | const [response1, response2] = await Promise.all([ 11 | apiRoot.categories().withKey({ key: category1.body.key }).get().execute(), 12 | apiRoot.categories().withKey({ key: category2.body.key }).get().execute(), 13 | ]) 14 | 15 | expect(response1.statusCode).toBe(200) 16 | expect(response2.statusCode).toBe(200) 17 | }) 18 | 19 | afterAll(async () => { 20 | await deleteCategory(category1) 21 | await deleteCategory(category2) 22 | }) 23 | }) 24 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/integration-tests/sdk-v3/misc.test.ts: -------------------------------------------------------------------------------- 1 | import { ctpApiBuilder } from '../../helpers/ctp-api-helper' 2 | import { requireEnvVar, waitForIndexing } from '../../helpers/test-utils' 3 | 4 | describe('::misc', () => { 5 | const _var = (env: string) => `environment variable ${env} not defined` 6 | test('should throw error if `env` is falsy', () => { 7 | const env1 = 'UNKNOWN_ENV', 8 | env2 = 'UNDEFINED_ENV' 9 | expect(() => requireEnvVar(env1)).toThrow(_var(env1)) 10 | expect(() => requireEnvVar(env2)).toThrow(_var(env2)) 11 | }) 12 | 13 | test('check can get project info', async () => { 14 | const res = await ctpApiBuilder.get().execute() 15 | expect(res.statusCode).toEqual(200) 16 | }) 17 | 18 | test('should throw if function did not resolve to a truthy value', async () => { 19 | const getResource = async () => Promise.resolve(false) 20 | expect( 21 | async () => await waitForIndexing(getResource, 0, 0) 22 | ).rejects.toThrow('Resource did not indexed within timeout') 23 | }) 24 | }) 25 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/integration-tests/shipping-method/shipping-method-fixture.ts: -------------------------------------------------------------------------------- 1 | import { apiRoot } from '../test-utils' 2 | import { _Money } from '../../../src' 3 | 4 | export const deleteShippingMethod = async (shippingMethod) => 5 | apiRoot 6 | .shippingMethods() 7 | .withId({ ID: shippingMethod.body.id }) 8 | .delete({ queryArgs: { version: shippingMethod.body.version } }) 9 | .execute() 10 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/integration-tests/state/state-fixture.ts: -------------------------------------------------------------------------------- 1 | import { apiRoot } from '../test-utils' 2 | 3 | export const deleteState = async (responseCreatedState) => 4 | apiRoot 5 | .states() 6 | .withId({ ID: responseCreatedState.body.id }) 7 | .delete({ 8 | queryArgs: { version: responseCreatedState.body.version }, 9 | }) 10 | .execute() 11 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/integration-tests/store/store-fixture.ts: -------------------------------------------------------------------------------- 1 | import { randomUUID } from 'crypto' 2 | import { apiRoot } from '../test-utils' 3 | import { StoreDraft } from '../../../src' 4 | 5 | const storeDraft: StoreDraft = { 6 | key: randomUUID(), 7 | } 8 | 9 | export const createStore = async () => 10 | apiRoot.stores().post({ body: storeDraft }).execute() 11 | 12 | export const deleteStore = async (store) => 13 | apiRoot 14 | .stores() 15 | .withId({ ID: store.body.id }) 16 | .delete({ 17 | queryArgs: { version: store.body.version }, 18 | }) 19 | .execute() 20 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/integration-tests/subscription/subscription-fixture.ts: -------------------------------------------------------------------------------- 1 | import { randomUUID } from 'crypto' 2 | import { apiRoot } from '../test-utils' 3 | import { 4 | AzureServiceBusDestination, 5 | ChangeSubscription, 6 | SubscriptionDraft, 7 | } from '../../../src' 8 | 9 | const azureServiceBusDestination: AzureServiceBusDestination = { 10 | type: 'AzureServiceBus', 11 | connectionString: '', 12 | } 13 | 14 | const changeSubscription: ChangeSubscription = { 15 | resourceTypeId: 'product', 16 | } 17 | const subscriptionDraft: SubscriptionDraft = { 18 | key: randomUUID(), 19 | destination: azureServiceBusDestination, 20 | changes: [changeSubscription], 21 | } 22 | 23 | export const createSubscription = async () => 24 | apiRoot.subscriptions().post({ body: subscriptionDraft }).execute() 25 | 26 | export const deleteSubscription = async (responseCreatedSubscription) => 27 | apiRoot 28 | .subscriptions() 29 | .withId({ ID: responseCreatedSubscription.body.id }) 30 | .delete({ 31 | queryArgs: { version: responseCreatedSubscription.body.version }, 32 | }) 33 | .execute() 34 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/integration-tests/zone/zone-fixture.ts: -------------------------------------------------------------------------------- 1 | import { apiRoot } from '../test-utils' 2 | import { randomUUID } from 'crypto' 3 | import { ZoneDraft } from '../../../src' 4 | 5 | const zoneDraft: ZoneDraft = { 6 | key: 'test-key-zone' + randomUUID(), 7 | name: 'test-name-zone' + randomUUID(), 8 | description: 'test-description-zone' + randomUUID(), 9 | } 10 | 11 | export const createZone = async (zoneDraftBody?: ZoneDraft) => 12 | apiRoot 13 | .zones() 14 | .post({ body: zoneDraftBody || zoneDraft }) 15 | .execute() 16 | 17 | export const deleteZone = async (responseCreatedZone) => 18 | apiRoot 19 | .zones() 20 | .withId({ ID: responseCreatedZone.body.id }) 21 | .delete({ queryArgs: { version: responseCreatedZone.body.version } }) 22 | .execute() 23 | -------------------------------------------------------------------------------- /packages/platform-sdk/test/request-with-method.ts: -------------------------------------------------------------------------------- 1 | import { ApiRequest } from '../src/generated/shared/utils/requests-utils' 2 | 3 | export interface RequestWithMethod { 4 | method: string 5 | uri: string 6 | request: ApiRequest 7 | } 8 | -------------------------------------------------------------------------------- /packages/platform-sdk/tsconfig-declarations.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": ".", 4 | "module": "commonjs", 5 | "declaration": true, 6 | "declarationMap": false, 7 | "isolatedModules": false, 8 | "noEmit": false, 9 | "allowJs": false, 10 | "emitDeclarationOnly": true, 11 | "paths": { 12 | "~/*": ["./src/*"], 13 | "*": ["./src/generated/*"], 14 | "models/*": ["./src/generated/models/*"], 15 | "client/*": ["./src/generated/client/*"], 16 | "shared/*": ["./src/generated/shared/*"] 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/platform-sdk/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "rootDir": "src", 5 | "outDir": "dist" 6 | }, 7 | "include": ["src"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/platform-sdk/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Platform SDK", 3 | "extends": ["../../typedoc.base.json"], 4 | "entryPoints": ["src/index.ts"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/sdk-client-v3/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 commercetools 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/sdk-client-v3/src/client/index.ts: -------------------------------------------------------------------------------- 1 | export { default as ClientBuilder } from './builder' 2 | export { default as createClient, process as Process } from './client' 3 | -------------------------------------------------------------------------------- /packages/sdk-client-v3/src/index.ts: -------------------------------------------------------------------------------- 1 | export { ClientBuilder, createClient, Process } from './client' 2 | export { 3 | createAuthMiddlewareForAnonymousSessionFlow, 4 | createAuthMiddlewareForClientCredentialsFlow, 5 | createAuthMiddlewareForExistingTokenFlow, 6 | createAuthMiddlewareForPasswordFlow, 7 | createAuthMiddlewareForRefreshTokenFlow, 8 | createConcurrentModificationMiddleware, 9 | createCorrelationIdMiddleware, createErrorMiddleware, createHttpMiddleware, 10 | createLoggerMiddleware, 11 | createQueueMiddleware, 12 | createUserAgentMiddleware 13 | } from './middleware' 14 | export * from './types/types.d' 15 | 16 | -------------------------------------------------------------------------------- /packages/sdk-client-v3/src/middleware/auth-middleware/index.ts: -------------------------------------------------------------------------------- 1 | import createAuthMiddlewareForAnonymousSessionFlow from './anonymous-session-flow' 2 | import createAuthMiddlewareForClientCredentialsFlow from './client-credentials-flow' 3 | import createAuthMiddlewareForExistingTokenFlow from './existing-token-flow' 4 | import createAuthMiddlewareForPasswordFlow from './password-flow' 5 | import createAuthMiddlewareForRefreshTokenFlow from './refresh-token-flow' 6 | 7 | export { 8 | createAuthMiddlewareForPasswordFlow, 9 | createAuthMiddlewareForAnonymousSessionFlow, 10 | createAuthMiddlewareForClientCredentialsFlow, 11 | createAuthMiddlewareForRefreshTokenFlow, 12 | createAuthMiddlewareForExistingTokenFlow 13 | } 14 | -------------------------------------------------------------------------------- /packages/sdk-client-v3/src/middleware/auth-middleware/password-flow.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Middleware, 3 | MiddlewareRequest, 4 | MiddlewareResponse, 5 | Next, 6 | PasswordAuthMiddlewareOptions, 7 | TokenStore, 8 | } from '../../types/types' 9 | import { buildTokenCacheKey, store } from '../../utils' 10 | import { buildRequestForPasswordFlow } from './auth-request-builder' 11 | import { authProcessor } from './auth-request-processor' 12 | 13 | export default function createAuthMiddlewareForPasswordFlow( 14 | options: PasswordAuthMiddlewareOptions 15 | ): Middleware { 16 | const tokenCache = 17 | options.tokenCache || 18 | store({ 19 | token: '', 20 | expirationTime: -1, 21 | }) 22 | 23 | let tokenCacheObject: TokenStore 24 | let tokenFetchPromise: Promise | null = null 25 | const tokenCacheKey = buildTokenCacheKey(options) 26 | 27 | return (next: Next) => { 28 | return async (request: MiddlewareRequest): Promise => { 29 | return authProcessor( 30 | request, 31 | tokenFetchPromise, 32 | tokenCacheObject, 33 | tokenCacheKey, 34 | tokenCache, 35 | buildRequestForPasswordFlow, 36 | options, 37 | next 38 | ) 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /packages/sdk-client-v3/src/middleware/create-correlation-id-middleware.ts: -------------------------------------------------------------------------------- 1 | import { 2 | CorrelationIdMiddlewareOptions, 3 | Middleware, 4 | MiddlewareRequest, 5 | Next, 6 | } from '../types/types' 7 | import { generate } from '../utils' 8 | 9 | export default function createCorrelationIdMiddleware( 10 | options?: CorrelationIdMiddlewareOptions 11 | ): Middleware { 12 | return (next: Next) => (request: MiddlewareRequest) => { 13 | const nextRequest = { 14 | ...request, 15 | headers: { 16 | ...request.headers, 17 | 'X-Correlation-ID': 18 | options?.generate && typeof options.generate == 'function' 19 | ? options.generate() 20 | : generate(), 21 | }, 22 | } 23 | 24 | return next(nextRequest) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /packages/sdk-client-v3/src/middleware/create-error-middleware.ts: -------------------------------------------------------------------------------- 1 | import { 2 | ErrorMiddlewareOptions, 3 | Middleware, 4 | MiddlewareRequest, 5 | MiddlewareResponse, 6 | Next, 7 | } from '../types/types' 8 | import { getHeaders } from '../utils' 9 | 10 | export default function createErrorMiddleware( 11 | options: ErrorMiddlewareOptions = {} 12 | ): Middleware { 13 | return (next: Next): Next => 14 | async (request: MiddlewareRequest): Promise => { 15 | const response = await next(request) 16 | if (response.error) { 17 | const { error } = response 18 | 19 | if (options.handler && typeof options.handler == 'function') { 20 | return options.handler({ error, request, response, next }) 21 | } 22 | 23 | return { 24 | ...response, 25 | statusCode: error.statusCode || 0, 26 | headers: error.headers || getHeaders({}), 27 | body: error, 28 | error, 29 | } 30 | } 31 | 32 | return response 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /packages/sdk-client-v3/src/middleware/create-logger-middleware.ts: -------------------------------------------------------------------------------- 1 | import { 2 | LoggerMiddlewareOptions, 3 | Middleware, 4 | MiddlewareRequest, 5 | MiddlewareResponse, 6 | Next, 7 | } from '../types/types' 8 | 9 | export default function createLoggerMiddleware( 10 | options?: LoggerMiddlewareOptions 11 | ): Middleware { 12 | return (next: Next) => { 13 | return async (request: MiddlewareRequest): Promise => { 14 | let response = await next(request) 15 | const originalResponse = Object.assign({}, response) 16 | 17 | const { loggerFn = console.log } = options || {} 18 | 19 | if (loggerFn && typeof loggerFn == 'function') { 20 | loggerFn(response) 21 | } 22 | 23 | return originalResponse 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /packages/sdk-client-v3/src/middleware/create-user-agent-middleware.ts: -------------------------------------------------------------------------------- 1 | import packageJson from '../../package.json' 2 | import { 3 | HttpUserAgentOptions, 4 | Middleware, 5 | MiddlewareRequest, 6 | MiddlewareResponse, 7 | Next, 8 | } from '../types/types' 9 | import { default as createUserAgent } from '../utils/userAgent' 10 | 11 | export default function createUserAgentMiddleware( 12 | options?: HttpUserAgentOptions 13 | ): Middleware { 14 | return (next: Next): Next => 15 | async (request: MiddlewareRequest): Promise => { 16 | const userAgent = createUserAgent({ 17 | ...options, 18 | name: `${options.name ? options.name + '/' : ''}commercetools-sdk-javascript-v3/${packageJson.version}`, 19 | }) 20 | 21 | const requestWithUserAgent = { 22 | ...request, 23 | headers: { 24 | ...request.headers, 25 | 'User-Agent': userAgent, 26 | }, 27 | } 28 | 29 | return next(requestWithUserAgent) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /packages/sdk-client-v3/src/middleware/index.ts: -------------------------------------------------------------------------------- 1 | export { 2 | createAuthMiddlewareForAnonymousSessionFlow, createAuthMiddlewareForClientCredentialsFlow, createAuthMiddlewareForExistingTokenFlow, createAuthMiddlewareForPasswordFlow, createAuthMiddlewareForRefreshTokenFlow 3 | } from './auth-middleware' 4 | export { default as createConcurrentModificationMiddleware } from './create-concurrent-modification-middleware' 5 | export { default as createCorrelationIdMiddleware } from './create-correlation-id-middleware' 6 | export { default as createErrorMiddleware } from './create-error-middleware' 7 | export { default as createHttpMiddleware } from './create-http-middleware' 8 | export { default as createLoggerMiddleware } from './create-logger-middleware' 9 | export { default as createQueueMiddleware } from './create-queue-middleware' 10 | export { default as createUserAgentMiddleware } from './create-user-agent-middleware' 11 | 12 | -------------------------------------------------------------------------------- /packages/sdk-client-v3/src/utils/byteLength.ts: -------------------------------------------------------------------------------- 1 | export default function byteLength(body: T): string { 2 | if (body && typeof body === 'string') { 3 | return new TextEncoder().encode(body).length.toString() 4 | } 5 | 6 | if (body && body instanceof Uint8Array) { 7 | return body.byteLength.toString() 8 | } 9 | 10 | if (body && typeof body === 'object') { 11 | return new TextEncoder().encode(JSON.stringify(body)).length.toString() 12 | } 13 | 14 | return '0' 15 | } 16 | -------------------------------------------------------------------------------- /packages/sdk-client-v3/src/utils/constants.ts: -------------------------------------------------------------------------------- 1 | export const HEADERS_CONTENT_TYPES = ['application/json', 'application/graphql'] 2 | export const CONCURRENCT_REQUEST = 20 3 | export const CTP_API_URL = 'https://api.europe-west1.gcp.commercetools.com' 4 | export const CTP_AUTH_URL = 'https://auth.europe-west1.gcp.commercetools.com' 5 | export const DEFAULT_HEADERS = [ 6 | 'content-type', 7 | 'access-control-allow-origin', 8 | 'access-control-allow-headers', 9 | 'access-control-allow-methods', 10 | 'access-control-expose-headers', 11 | 'access-control-max-ag', 12 | 'x-correlation-id', 13 | 'server-timing', 14 | 'date', 15 | 'server', 16 | 'transfer-encoding', 17 | 'access-control-max-age', 18 | 'content-encoding', 19 | 'x-envoy-upstream-service-time', 20 | 'via', 21 | 'alt-svc', 22 | 'connection', 23 | ] 24 | -------------------------------------------------------------------------------- /packages/sdk-client-v3/src/utils/createError.ts: -------------------------------------------------------------------------------- 1 | import { HttpErrorType } from '../types/types' 2 | import getErrorByCode, { HttpError } from './errors' 3 | 4 | type ErrorType = ErrorArgs & Partial 5 | 6 | type ErrorArgs = { 7 | statusCode: number 8 | message: string 9 | } 10 | 11 | function createError({ 12 | statusCode, 13 | message, 14 | ...rest 15 | }: ErrorType): HttpErrorType { 16 | let errorMessage = message || 'Unexpected non-JSON error response' 17 | if (statusCode === 404) 18 | errorMessage = `URI not found: ${rest.originalRequest?.uri || rest.uri}` 19 | 20 | const ResponseError = getErrorByCode(statusCode) 21 | if (ResponseError) return new ResponseError(errorMessage, rest) 22 | return new HttpError(statusCode, errorMessage, rest) 23 | } 24 | 25 | export default createError 26 | -------------------------------------------------------------------------------- /packages/sdk-client-v3/src/utils/generateID.ts: -------------------------------------------------------------------------------- 1 | export default function generateID() { 2 | // @ts-ignore 3 | return ([1e6] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, (c: string) => 4 | ( 5 | parseInt(c) ^ 6 | (Math.floor(Math.random() * 256) & (15 >> (parseInt(c) / 4))) 7 | ).toString(16) 8 | ) 9 | } 10 | -------------------------------------------------------------------------------- /packages/sdk-client-v3/src/utils/headers.ts: -------------------------------------------------------------------------------- 1 | import { JsonObject } from '../types/types' 2 | import { DEFAULT_HEADERS } from './constants' 3 | 4 | function parse(headers: JsonObject) { 5 | return DEFAULT_HEADERS.reduce((result: object, key: string): object => { 6 | let val = headers[key] 7 | ? headers[key] 8 | : typeof headers.get == 'function' 9 | ? headers.get(key) 10 | : null 11 | 12 | if (val) result[key] = val 13 | 14 | return result 15 | }, {}) 16 | } 17 | 18 | export default function getHeaders( 19 | headers: JsonObject 20 | ): JsonObject { 21 | if (!headers) return null 22 | 23 | // node-fetch 24 | if (headers.raw && typeof headers.raw == 'function') return headers.raw() 25 | 26 | // Tmp fix for Firefox until it supports iterables 27 | if (!headers.forEach) return parse(headers) 28 | 29 | // whatwg-fetch 30 | const map: JsonObject = {} 31 | headers.forEach((value: any, name: string | number) => { 32 | return (map[name] = value) 33 | }) 34 | return map 35 | } 36 | -------------------------------------------------------------------------------- /packages/sdk-client-v3/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | // export { default as logger } from './logger' 2 | export { default as byteLength } from './byteLength' 3 | export * as constants from './constants' 4 | export { default as createError } from './createError' 5 | export { NetworkError } from './errors' 6 | export { default as executor } from './executor' 7 | export { default as generate } from './generateID' 8 | export { default as getHeaders } from './headers' 9 | export { default as isBuffer } from './isBuffer' 10 | export { default as maskAuthData } from './maskAuthData' 11 | export { default as mergeAuthHeader } from './mergeAuthHeader' 12 | export { default as METHODS } from './methods' 13 | export { default as calculateRetryDelay } from './retryDelay' 14 | export { default as sleep } from './sleep' 15 | export { default as buildTokenCacheKey } from './tokenCacheKey' 16 | export { default as calculateExpirationTime } from './tokenExpirationTime' 17 | export { default as store } from './tokenStore' 18 | export { parseURLString, stringifyURLString } from './url' 19 | export { default as userAgent } from './userAgent' 20 | export { 21 | validate, 22 | // validateUserAgentOptions, 23 | validateClient, validateHttpClientOptions, validateRetryCodes 24 | } from './validate' 25 | -------------------------------------------------------------------------------- /packages/sdk-client-v3/src/utils/isBuffer.ts: -------------------------------------------------------------------------------- 1 | export default function isBuffer(obj: any): boolean { 2 | return ( 3 | obj != null && 4 | obj.constructor != null && 5 | typeof obj.constructor.isBuffer === 'function' && 6 | obj.constructor.isBuffer(obj) 7 | ) 8 | } 9 | -------------------------------------------------------------------------------- /packages/sdk-client-v3/src/utils/logger.ts: -------------------------------------------------------------------------------- 1 | import { ClientResponse } from '../types/types' 2 | 3 | const { log } = console 4 | export default function logger(res: ClientResponse): void { 5 | log( 6 | ':::::::::::::::::::::: Start of log ::::::::::::::::::::::::::\n\r', 7 | res, 8 | '\n:::::::::::::::::::::: End of log ::::::::::::::::::::::::::::\n' 9 | ) 10 | } 11 | -------------------------------------------------------------------------------- /packages/sdk-client-v3/src/utils/maskAuthData.ts: -------------------------------------------------------------------------------- 1 | import { MiddlewareRequest } from '../types/types' 2 | 3 | export default function maskAuthData(request: MiddlewareRequest) { 4 | const _request = JSON.parse(JSON.stringify(request)) 5 | if (_request?.headers) { 6 | if (_request.headers.Authorization) { 7 | _request.headers['Authorization'] = 'Bearer ********' 8 | } 9 | 10 | if (_request.headers.authorization) { 11 | _request.headers['authorization'] = 'Bearer ********' 12 | } 13 | } 14 | 15 | return _request 16 | } 17 | -------------------------------------------------------------------------------- /packages/sdk-client-v3/src/utils/mergeAuthHeader.ts: -------------------------------------------------------------------------------- 1 | import { MiddlewareRequest } from '../types/types' 2 | 3 | export default function mergeAuthHeader( 4 | token: string, 5 | req: MiddlewareRequest 6 | ): MiddlewareRequest { 7 | return { 8 | ...req, 9 | headers: { 10 | ...req.headers, 11 | Authorization: `Bearer ${token}`, 12 | }, 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/sdk-client-v3/src/utils/methods.ts: -------------------------------------------------------------------------------- 1 | export default [ 2 | 'ACL', 3 | 'BIND', 4 | 'CHECKOUT', 5 | 'CONNECT', 6 | 'COPY', 7 | 'DELETE', 8 | 'GET', 9 | 'HEAD', 10 | 'LINK', 11 | 'LOCK', 12 | 'M-SEARCH', 13 | 'MERGE', 14 | 'MKACTIVITY', 15 | 'MKCALENDAR', 16 | 'MKCOL', 17 | 'MOVE', 18 | 'NOTIFY', 19 | 'OPTIONS', 20 | 'PATCH', 21 | 'POST', 22 | 'PROPFIND', 23 | 'PROPPATCH', 24 | 'PURGE', 25 | 'PUT', 26 | 'REBIND', 27 | 'REPORT', 28 | 'SEARCH', 29 | 'SOURCE', 30 | 'SUBSCRIBE', 31 | 'TRACE', 32 | 'UNBIND', 33 | 'UNLINK', 34 | 'UNLOCK', 35 | 'UNSUBSCRIBE', 36 | ] 37 | -------------------------------------------------------------------------------- /packages/sdk-client-v3/src/utils/retryDelay.ts: -------------------------------------------------------------------------------- 1 | export type TRetryPolicy = { 2 | retryCount: number 3 | retryDelay: number 4 | maxRetries: number 5 | backoff: boolean 6 | maxDelay: number 7 | } 8 | 9 | export default function calculateRetryDelay({ 10 | retryCount, 11 | retryDelay, 12 | backoff, 13 | maxDelay, 14 | }: TRetryPolicy): number { 15 | if (backoff) { 16 | return retryCount !== 0 // do not increase if it's the first retry 17 | ? Math.min( 18 | Math.round((Math.random() + 1) * retryDelay * 2 ** retryCount), 19 | maxDelay 20 | ) 21 | : retryDelay 22 | } 23 | 24 | return retryDelay 25 | } 26 | 27 | Math.min(Math.round((Math.random() + 1) * 200 * 2 ** 10), Infinity) 28 | -------------------------------------------------------------------------------- /packages/sdk-client-v3/src/utils/sleep.ts: -------------------------------------------------------------------------------- 1 | export default function sleep(ms: number): Promise { 2 | return new Promise((resolve) => { 3 | setTimeout(resolve, ms) 4 | }) 5 | } 6 | -------------------------------------------------------------------------------- /packages/sdk-client-v3/src/utils/tokenCacheKey.ts: -------------------------------------------------------------------------------- 1 | import { AuthMiddlewareOptions, TokenCacheOptions } from '../types/types' 2 | 3 | export default function buildTokenCacheKey( 4 | options: AuthMiddlewareOptions 5 | ): TokenCacheOptions { 6 | if (!options?.credentials?.clientId || !options.projectKey || !options.host) 7 | throw new Error('Missing required options.') 8 | 9 | return { 10 | clientId: options.credentials.clientId, 11 | host: options.host, 12 | projectKey: options.projectKey, 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/sdk-client-v3/src/utils/tokenExpirationTime.ts: -------------------------------------------------------------------------------- 1 | export default function calculateExpirationTime(expiresIn: number): number { 2 | return ( 3 | Date.now() + 4 | // Add a gap of 5 minutes before expiration time. 5 | expiresIn * 1000 - 6 | 5 * 60 * 1000 7 | ) 8 | } 9 | -------------------------------------------------------------------------------- /packages/sdk-client-v3/src/utils/tokenStore.ts: -------------------------------------------------------------------------------- 1 | import { TokenCacheOptions } from '../types/types' 2 | 3 | export default function store(initVal: T): V { 4 | let value: T = initVal 5 | return { 6 | get: (TokenCacheOption?: S) => value, 7 | set: (val: T, TokenCacheOption?: S) => { 8 | value = val 9 | }, 10 | } as V 11 | } 12 | -------------------------------------------------------------------------------- /packages/sdk-client-v3/tests/logger.test/fixtures.ts: -------------------------------------------------------------------------------- 1 | export function createTestResponse(options) { 2 | return { 3 | body: {}, 4 | statusCode: 200, 5 | originalRequest: { 6 | url: 'http://demo-url/1235', 7 | headers: { 8 | Authorization: 'token-12345', 9 | }, 10 | }, 11 | headers: {}, 12 | error: null, 13 | ...options, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/sdk-client-v3/tests/utils.test/headers.test.ts: -------------------------------------------------------------------------------- 1 | import { getHeaders } from '../../src/utils' 2 | 3 | describe('header parser', () => { 4 | test('should return `null` if header is not provided', () => { 5 | expect(getHeaders(null)).toEqual(null) 6 | }) 7 | 8 | test('should parse raw header', () => { 9 | const headers = { 10 | raw: jest.fn(() => ({ 11 | 'Content-Type': 'application/json', 12 | })), 13 | } 14 | 15 | expect(getHeaders(headers)).toEqual({ 'Content-Type': 'application/json' }) 16 | }) 17 | 18 | test('should parse header with header parser function', () => { 19 | const headers = { 20 | 'content-type': 'application/json', 21 | } 22 | 23 | expect(getHeaders(headers)).toEqual({ 'content-type': 'application/json' }) 24 | }) 25 | 26 | test('should parse headers without header parser functions', () => { 27 | const headers = { 28 | forEach: jest.fn((consumer) => 29 | consumer('application/json', 'Content-Type') 30 | ), 31 | } 32 | 33 | expect(getHeaders(headers)).toEqual({ 'Content-Type': 'application/json' }) 34 | expect(headers.forEach).toHaveBeenCalled() 35 | expect(headers.forEach).toHaveBeenCalledTimes(1) 36 | }) 37 | }) 38 | -------------------------------------------------------------------------------- /packages/sdk-client-v3/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "rootDir": "src", 5 | "outDir": "dist" 6 | }, 7 | "include": ["src"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/sdk-client-v3/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Client v3", 3 | "extends": ["../../typedoc.base.json"], 4 | "entryPoints": ["src/index.ts"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/sdk-client-v3/yarn.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/commercetools/commercetools-sdk-typescript/be1e9c1a5dd79230818864b70742b517e746f960/packages/sdk-client-v3/yarn.lock -------------------------------------------------------------------------------- /packages/sdk-client/src/http-user-agent/index.ts: -------------------------------------------------------------------------------- 1 | export { default as createUserAgent } from './create-user-agent'; 2 | -------------------------------------------------------------------------------- /packages/sdk-client/src/index.ts: -------------------------------------------------------------------------------- 1 | export { default as ClientBuilder } from './client-builder/ClientBuilder' 2 | export { 3 | default as createClient, 4 | process as Process 5 | } from './sdk-client/client' 6 | export { default as getErrorByCode } from './sdk-client/errors' 7 | export { default as createAuthForAnonymousSessionFlow } from './sdk-middleware-auth/anonymous-session-flow' 8 | export { default as createAuthForClientCredentialsFlow } from './sdk-middleware-auth/client-credentials-flow' 9 | export { default as createAuthWithExistingToken } from './sdk-middleware-auth/existing-token' 10 | export { default as createAuthForPasswordFlow } from './sdk-middleware-auth/password-flow' 11 | export { default as createAuthForRefreshTokenFlow } from './sdk-middleware-auth/refresh-token-flow' 12 | export { default as createCorrelationIdMiddleware } from './sdk-middleware-correlation-id/correlation-id' 13 | export { default as createHttpClient } from './sdk-middleware-http/http' 14 | export { default as createLoggerMiddleware } from './sdk-middleware-logger/logger' 15 | export { default as createQueueMiddleware } from './sdk-middleware-queue/queue' 16 | export { default as createUserAgentMiddleware } from './sdk-middleware-user-agent/user-agent' 17 | export * from './types/sdk.d' 18 | -------------------------------------------------------------------------------- /packages/sdk-client/src/sdk-client/allowed-methods.ts: -------------------------------------------------------------------------------- 1 | export default [ 2 | 'ACL', 3 | 'BIND', 4 | 'CHECKOUT', 5 | 'CONNECT', 6 | 'COPY', 7 | 'DELETE', 8 | 'GET', 9 | 'HEAD', 10 | 'LINK', 11 | 'LOCK', 12 | 'M-SEARCH', 13 | 'MERGE', 14 | 'MKACTIVITY', 15 | 'MKCALENDAR', 16 | 'MKCOL', 17 | 'MOVE', 18 | 'NOTIFY', 19 | 'OPTIONS', 20 | 'PATCH', 21 | 'POST', 22 | 'PROPFIND', 23 | 'PROPPATCH', 24 | 'PURGE', 25 | 'PUT', 26 | 'REBIND', 27 | 'REPORT', 28 | 'SEARCH', 29 | 'SOURCE', 30 | 'SUBSCRIBE', 31 | 'TRACE', 32 | 'UNBIND', 33 | 'UNLINK', 34 | 'UNLOCK', 35 | 'UNSUBSCRIBE', 36 | ] 37 | -------------------------------------------------------------------------------- /packages/sdk-client/src/sdk-client/index.ts: -------------------------------------------------------------------------------- 1 | export { default as createClient, process } from './client' 2 | export { default as getErrorByCode } from './errors' 3 | -------------------------------------------------------------------------------- /packages/sdk-client/src/sdk-client/validate.ts: -------------------------------------------------------------------------------- 1 | import { ClientRequest } from '../types/sdk.d' 2 | import METHODS from './allowed-methods' 3 | 4 | /** 5 | * @throws {Error} 6 | */ 7 | export default function validate( 8 | funcName: string, 9 | request: ClientRequest, 10 | options: { allowedMethods: Array } = { allowedMethods: METHODS } 11 | ): void { 12 | if (!request) 13 | throw new Error( 14 | `The "${funcName}" function requires a "Request" object as an argument. See https://commercetools.github.io/nodejs/sdk/Glossary.html#clientrequest` 15 | ) 16 | 17 | if (typeof request.uri !== 'string') 18 | throw new Error( 19 | `The "${funcName}" Request object requires a valid uri. See https://commercetools.github.io/nodejs/sdk/Glossary.html#clientrequest` 20 | ) 21 | 22 | if (!options.allowedMethods.includes(request.method)) 23 | throw new Error( 24 | `The "${funcName}" Request object requires a valid method. See https://commercetools.github.io/nodejs/sdk/Glossary.html#clientrequest` 25 | ) 26 | } 27 | -------------------------------------------------------------------------------- /packages/sdk-client/src/sdk-middleware-auth/build-token-cache-key.ts: -------------------------------------------------------------------------------- 1 | import { AuthMiddlewareOptions, TokenCacheOptions } from '../types/sdk.d' 2 | 3 | export default function buildTokenCacheKey( 4 | options: AuthMiddlewareOptions 5 | ): TokenCacheOptions { 6 | return { 7 | clientId: options.credentials.clientId, 8 | host: options.host, 9 | projectKey: options.projectKey, 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/sdk-client/src/sdk-middleware-auth/index.ts: -------------------------------------------------------------------------------- 1 | export { default as createAuthMiddlewareForAnonymousSessionFlow } from './anonymous-session-flow' 2 | export { default as createAuthMiddlewareForClientCredentialsFlow } from './client-credentials-flow' 3 | export { default as createAuthMiddlewareWithExistingToken } from './existing-token' 4 | export { default as createAuthMiddlewareForPasswordFlow } from './password-flow' 5 | export { default as createAuthMiddlewareForRefreshTokenFlow } from './refresh-token-flow' 6 | -------------------------------------------------------------------------------- /packages/sdk-client/src/sdk-middleware-auth/scopes.ts: -------------------------------------------------------------------------------- 1 | export const MANAGE_PROJECT = 'manage_project' 2 | export const MANAGE_PRODUCTS = 'manage_products' 3 | export const VIEW_PRODUCTS = 'view_products' 4 | export const MANAGE_ORDERS = 'manage_orders' 5 | export const VIEW_ORDERS = 'view_orders' 6 | export const MANAGE_MY_ORDERS = 'manage_my_orders' 7 | export const MANAGE_CUSTOMERS = 'manage_customers' 8 | export const VIEW_CUSTOMERS = 'view_customers' 9 | export const MANAGE_MY_PROFILE = 'manage_my_profile' 10 | export const MANAGE_TYPES = 'manage_types' 11 | export const VIEW_TYPES = 'view_types' 12 | export const MANAGE_PAYMENTS = 'manage_payments' 13 | export const VIEW_PAYMENTS = 'view_payments' 14 | export const CREATE_ANONYMOUS_TOKEN = 'create_anonymous_token' 15 | export const MANAGE_SUBSCRIPTIONS = 'manage_subscriptions' 16 | -------------------------------------------------------------------------------- /packages/sdk-client/src/sdk-middleware-auth/utils.ts: -------------------------------------------------------------------------------- 1 | import { TokenCacheOptions } from '../types/sdk' 2 | 3 | export default function store(initVal: T): V { 4 | let value: T = initVal 5 | return { 6 | get: (TokenCacheOption?: S) => value, 7 | set: (val: T, TokenCacheOption?: S) => { 8 | value = val 9 | }, 10 | } as V 11 | } 12 | -------------------------------------------------------------------------------- /packages/sdk-client/src/sdk-middleware-correlation-id/correlation-id.ts: -------------------------------------------------------------------------------- 1 | import type { 2 | CorrelationIdMiddlewareOptions, 3 | Middleware, 4 | MiddlewareRequest, 5 | MiddlewareResponse, 6 | Next, 7 | } from '../types/sdk.d' 8 | 9 | export default function createCorrelationIdMiddleware( 10 | options: CorrelationIdMiddlewareOptions 11 | ): Middleware { 12 | return (next: Next): Next => 13 | (request: MiddlewareRequest, response: MiddlewareResponse) => { 14 | const nextRequest = { 15 | ...request, 16 | headers: { 17 | ...request.headers, 18 | 'X-Correlation-ID': options.generate(), 19 | }, 20 | } 21 | next(nextRequest, response) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/sdk-client/src/sdk-middleware-correlation-id/index.ts: -------------------------------------------------------------------------------- 1 | export { default as createCorrelationIdMiddleware } from './correlation-id'; 2 | -------------------------------------------------------------------------------- /packages/sdk-client/src/sdk-middleware-http/index.ts: -------------------------------------------------------------------------------- 1 | export { default as createHttpMiddleware } from './http'; 2 | -------------------------------------------------------------------------------- /packages/sdk-client/src/sdk-middleware-http/parse-headers.ts: -------------------------------------------------------------------------------- 1 | import { JsonObject } from '../types/sdk.d' 2 | 3 | export default function parseHeaders( 4 | headers: JsonObject 5 | ): JsonObject { 6 | if (headers.raw) 7 | // node-fetch 8 | return headers.raw() 9 | 10 | // Tmp fix for Firefox until it supports iterables 11 | if (!headers.forEach) return {} 12 | 13 | // whatwg-fetch 14 | const map: JsonObject = {} 15 | headers.forEach((value: any, name: string | number) => { 16 | map[name] = value 17 | }) 18 | return map 19 | } 20 | -------------------------------------------------------------------------------- /packages/sdk-client/src/sdk-middleware-logger/index.ts: -------------------------------------------------------------------------------- 1 | export { default as createLoggerMiddleware } from './logger'; 2 | -------------------------------------------------------------------------------- /packages/sdk-client/src/sdk-middleware-logger/logger.ts: -------------------------------------------------------------------------------- 1 | import type { 2 | Middleware, 3 | MiddlewareRequest, 4 | MiddlewareResponse, 5 | Next, 6 | } from '../types/sdk.d' 7 | 8 | export default function createLoggerMiddleware(): Middleware { 9 | return (next: Next): Next => 10 | (request: MiddlewareRequest, response: MiddlewareResponse) => { 11 | const { error, body, statusCode } = response 12 | console.log('Request: ', request) 13 | console.log('Response: ', { error, body, statusCode }) 14 | next(request, response) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/sdk-client/src/sdk-middleware-queue/index.ts: -------------------------------------------------------------------------------- 1 | export { default as createQueueMiddleware } from './queue'; 2 | -------------------------------------------------------------------------------- /packages/sdk-client/src/sdk-middleware-user-agent/index.ts: -------------------------------------------------------------------------------- 1 | export { default as createUserAgentMiddleware } from './user-agent'; 2 | -------------------------------------------------------------------------------- /packages/sdk-client/src/sdk-middleware-user-agent/user-agent.ts: -------------------------------------------------------------------------------- 1 | import packageJson from '../../package.json' 2 | import { default as createHttpUserAgent } from '../http-user-agent/create-user-agent' 3 | import { 4 | Dispatch, 5 | HttpUserAgentOptions, 6 | Middleware, 7 | MiddlewareRequest, 8 | MiddlewareResponse, 9 | } from '../types/sdk' 10 | 11 | export default function createUserAgentMiddleware( 12 | options?: HttpUserAgentOptions 13 | ): Middleware { 14 | const userAgent = createHttpUserAgent({ 15 | ...options, 16 | name: `commercetools-sdk-javascript-v2/${packageJson.version}`, 17 | }) 18 | 19 | return (next: Dispatch): Dispatch => 20 | (request: MiddlewareRequest, response: MiddlewareResponse) => { 21 | const requestWithUserAgent = { 22 | ...request, 23 | headers: { 24 | ...request.headers, 25 | 'User-Agent': userAgent, 26 | }, 27 | } 28 | next(requestWithUserAgent, response) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /packages/sdk-client/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | export { parseURLString, stringifyURLString } from './url'; 2 | -------------------------------------------------------------------------------- /packages/sdk-client/test/http.test/parse-headers.test.ts: -------------------------------------------------------------------------------- 1 | import parseHeaders from '../../src/sdk-middleware-http/parse-headers' 2 | 3 | describe('Parse headers', () => { 4 | test('return headers for polyfill (node-fetch)', () => { 5 | const spy = jest.fn() 6 | parseHeaders({ raw: spy }) 7 | expect(spy).toHaveBeenCalledTimes(1) 8 | }) 9 | 10 | test('return headers for polyfill (whatwg-fetch)', () => { 11 | const spy = jest 12 | .fn() 13 | .mockImplementation((cb) => cb(['application/json'], 'content-type')) 14 | expect(parseHeaders({ forEach: spy })).toEqual({ 15 | 'content-type': ['application/json'], 16 | }) 17 | }) 18 | 19 | test('patch fix for firefox', () => { 20 | expect(parseHeaders({})).toEqual({}) 21 | }) 22 | }) 23 | -------------------------------------------------------------------------------- /packages/sdk-client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "rootDir": "src", 5 | "outDir": "dist" 6 | }, 7 | "include": ["src"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/sdk-client/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Client v2", 3 | "extends": ["../../typedoc.base.json"], 4 | "entryPoints": ["src/index.ts"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/ts-sdk-apm/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 commercetools 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/ts-sdk-apm/src/helpers/datadogHelper.ts: -------------------------------------------------------------------------------- 1 | import datadog from 'dd-trace' 2 | 3 | // Initialize datadog once 4 | datadog.init() 5 | 6 | // Record metrics for datadog 7 | export const recordDatadog = ( 8 | metric: number, 9 | tags?: { [tag: string]: string | number } 10 | ): void => { 11 | datadog.dogstatsd.gauge(`client_response_time`, metric, tags) 12 | } 13 | -------------------------------------------------------------------------------- /packages/ts-sdk-apm/src/helpers/newRelicHelper.ts: -------------------------------------------------------------------------------- 1 | import newrelic from 'newrelic' 2 | 3 | // record for newrelic 4 | export const recordNewRelic = (metric: number | newrelic.Metric): void => { 5 | newrelic.recordMetric(`Client/Response/Time`, metric) 6 | } 7 | -------------------------------------------------------------------------------- /packages/ts-sdk-apm/src/helpers/performanceHelper.ts: -------------------------------------------------------------------------------- 1 | export const time = () => performance.now() 2 | -------------------------------------------------------------------------------- /packages/ts-sdk-apm/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from '../types/types.d' 2 | export { default as createTelemetryMiddleware } from './apm' 3 | -------------------------------------------------------------------------------- /packages/ts-sdk-apm/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "rootDir": "src", 5 | "outDir": "dist", 6 | "moduleResolution": "node16" 7 | }, 8 | "include": ["src"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/ts-sdk-apm/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "APM", 3 | "extends": ["../../typedoc.base.json"], 4 | "entryPoints": ["src/index.ts"] 5 | } 6 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "config:base", 4 | ":pinOnlyDevDependencies", 5 | ":enableVulnerabilityAlerts", 6 | "schedule:weekly" 7 | ], 8 | "separateMajorMinor": true, 9 | "packageRules": [ 10 | { 11 | "packagePatterns": ["*"], 12 | "updateTypes": ["minor", "patch"], 13 | "groupName": "all dependencies", 14 | "groupSlug": "all" 15 | } 16 | ], 17 | "lockFileMaintenance": { 18 | "enabled": true 19 | }, 20 | "labels": ["Type: Maintenance"], 21 | "ignoreDeps": [] 22 | } 23 | -------------------------------------------------------------------------------- /tsconfig.base.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "Node16", 4 | "strict": false, 5 | "composite": true, 6 | "resolveJsonModule": true, 7 | 8 | "declaration": true, 9 | "declarationMap": true 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "esModuleInterop": true, 4 | // See https://devblogs.microsoft.com/typescript/typescript-and-babel-7/ 5 | "isolatedModules": true, 6 | "lib": ["ESNext", "DOM"], 7 | "module": "ESNext", 8 | "moduleResolution": "Node", 9 | "removeComments": false, 10 | "resolveJsonModule": true, 11 | "downlevelIteration": true 12 | }, 13 | "include": ["packages"] 14 | } 15 | -------------------------------------------------------------------------------- /typedoc.base.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://typedoc.org/schema.json", 3 | "kindSortOrder": [ 4 | "Project", 5 | "Module", 6 | "Class", 7 | "Function", 8 | "Interface", 9 | "TypeAlias" 10 | ], 11 | "includeVersion": false, 12 | "compilerOptions": { 13 | "skipLibCheck": true 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /typedoc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | entryPoints: ['packages/*'], 3 | name: 'Typescript SDK Type Docs', 4 | entryPointStrategy: 'packages', 5 | includeVersion: false, 6 | visibilityFilters: { 7 | protected: true, 8 | private: true, 9 | inherited: true, 10 | external: true 11 | } 12 | } --------------------------------------------------------------------------------