From 8b8fdff0f495fef93877dab57d8038fb4ec0ad79 Mon Sep 17 00:00:00 2001 From: Artur <5359825+sethidden@users.noreply.github.com> Date: Thu, 11 Apr 2024 09:07:48 +0000 Subject: [PATCH] refactor: standarize API Client (#1507) * IN-4072 Use proxy-sdk * BREAKING remove MagentoApiMethods from Config * Align test state with current storeconfig state Somebody changed the magento store config and didnt tell anybody * fix wrongly renamed methods * refactor: use function syntax * remove test comment * revert prop removal * fix build issues * update eslint dependencies * fix test issues --------- Co-authored-by: Wojciech Sikora --- .changeset/thirty-socks-sleep.md | 24 ++ package.json | 10 +- packages/api-client/package.json | 2 +- packages/api-client/rollup.config.js | 5 - packages/api-client/src/api-extractor-data.ts | 3 +- .../src/api/addBundleProductsToCart/index.ts | 10 +- .../addConfigurableProductsToCart/index.ts | 2 +- .../addDownloadableProductsToCart/index.ts | 2 +- .../src/api/addProductToWishList/index.ts | 10 +- .../src/api/addProductsToCart/index.ts | 2 +- .../src/api/addSimpleProductsToCart/index.ts | 10 +- .../src/api/addVirtualProductsToCart/index.ts | 2 +- .../src/api/applyCouponToCart/index.ts | 2 +- .../src/api/availableStores/index.ts | 10 +- packages/api-client/src/api/cart/index.ts | 2 +- .../api-client/src/api/cartTotalQty/index.ts | 5 +- .../api-client/src/api/categories/index.ts | 2 +- .../api-client/src/api/categoryList/index.ts | 2 +- .../src/api/categorySearch/index.ts | 2 +- .../src/api/changeCustomerPassword/index.ts | 10 +- .../api-client/src/api/cmsBlocks/index.ts | 6 +- packages/api-client/src/api/cmsPage/index.ts | 6 +- .../api-client/src/api/countries/index.ts | 2 +- packages/api-client/src/api/country/index.ts | 2 +- .../src/api/createCustomer/index.ts | 10 +- .../src/api/createCustomerAddress/index.ts | 2 +- .../src/api/createEmptyCart/index.ts | 9 +- .../src/api/createProductReview/index.ts | 10 +- packages/api-client/src/api/currency/index.ts | 2 +- .../src/api/customMutation/index.ts | 7 +- .../api-client/src/api/customQuery/index.ts | 7 +- packages/api-client/src/api/customer/index.ts | 10 +- .../api-client/src/api/customerCart/index.ts | 2 +- .../src/api/customerOrders/index.ts | 6 +- .../src/api/customerProductReview/index.ts | 10 +- .../src/api/deleteCustomerAddress/index.ts | 2 +- .../src/api/generateCustomerToken/index.ts | 10 +- .../index.ts | 7 +- .../index.ts | 2 +- .../api/getAvailablePaymentMethods/index.ts | 2 +- .../api/getAvailableShippingMethods/index.ts | 6 +- .../src/api/getCustomerAddresses/index.ts | 2 +- packages/api-client/src/api/index.ts | 134 +++--- .../api-client/src/api/mergeCarts/index.ts | 10 +- .../api-client/src/api/placeOrder/index.ts | 2 +- .../src/api/productDetails/index.ts | 2 +- .../api-client/src/api/productReview/index.ts | 10 +- .../api/productReviewRatingsMetadata/index.ts | 10 +- packages/api-client/src/api/products/index.ts | 2 +- .../src/api/relatedProducts/index.ts | 2 +- .../src/api/removeCouponFromCart/index.ts | 2 +- .../src/api/removeItemFromCart/index.ts | 2 +- .../api/removeProductsFromWishlist/index.ts | 10 +- .../api/requestPasswordResetEmail/index.ts | 2 +- .../api-client/src/api/resetPassword/index.ts | 2 +- packages/api-client/src/api/reviews/index.ts | 6 +- .../src/api/revokeCustomerToken/index.ts | 9 +- packages/api-client/src/api/route/index.ts | 2 +- .../src/api/setBillingAddressOnCart/index.ts | 10 +- .../src/api/setGuestEmailOnCart/index.ts | 2 +- .../src/api/setPaymentMethodOnCart/index.ts | 2 +- .../api/setShippingAddressesOnCart/index.ts | 2 +- .../src/api/setShippingMethodsOnCart/index.ts | 2 +- .../api-client/src/api/storeConfig/index.ts | 6 +- .../api/subscribeEmailToNewsletter/index.ts | 2 +- .../src/api/updateCartItems/index.ts | 2 +- .../src/api/updateCustomer/index.ts | 10 +- .../src/api/updateCustomerAddress/index.ts | 2 +- .../src/api/updateCustomerEmail/index.ts | 10 +- .../src/api/upsellProducts/index.ts | 10 +- .../api-client/src/api/urlResolver/index.ts | 2 +- packages/api-client/src/api/wishlist/index.ts | 6 +- .../src/api/wishlistItemsCount/index.ts | 5 +- .../api-client/src/types/api/endpoints.ts | 12 + packages/api-client/src/types/api/index.ts | 1 + packages/api-client/src/types/context.ts | 6 - .../api-client/src/types/context/index.ts | 5 + packages/api-client/src/types/index.ts | 3 + packages/api-client/src/types/setup.ts | 4 +- packages/api-types/src/Api.ts | 387 ----------------- .../load-tests/src/query/storeConfig.gql.js | 3 +- .../tests/magento/addSimpleProductToCart.js | 28 +- .../src/tests/magento/createCustomer.js | 28 +- .../src/tests/magento/createEmptyGuestCart.js | 30 +- .../src/tests/magento/storeConfig.js | 25 +- .../src/tests/magento/utils/getHeaders.js | 2 +- .../src/tests/middleware/createCustomer.js | 36 +- .../tests/middleware/createEmptyGuestCart.js | 28 +- .../src/tests/middleware/storeConfig.js | 20 +- .../tests/middleware/utils/customerData.js | 4 +- .../src/tests/middleware/utils/getHeaders.js | 6 +- .../src/tests/scenarios/browsingProduct.js | 169 ++++---- .../tests/scenarios/buyProductAsAGuestUser.js | 318 +++++--------- .../tests/scenarios/newUserRegistration.js | 118 +++--- .../src/tests/scenarios/searchProduct.js | 170 ++++---- packages/load-tests/src/utils/customerData.js | 4 +- packages/load-tests/src/utils/getCookies.js | 6 +- .../method-bootstrapper/file-operations.js | 106 ++--- packages/method-bootstrapper/index.js | 23 +- packages/method-bootstrapper/utils.js | 4 +- yarn.lock | 388 ++++++++++++++---- 101 files changed, 1072 insertions(+), 1381 deletions(-) create mode 100644 .changeset/thirty-socks-sleep.md create mode 100644 packages/api-client/src/types/api/endpoints.ts create mode 100644 packages/api-client/src/types/api/index.ts delete mode 100644 packages/api-client/src/types/context.ts create mode 100644 packages/api-client/src/types/context/index.ts create mode 100644 packages/api-client/src/types/index.ts diff --git a/.changeset/thirty-socks-sleep.md b/.changeset/thirty-socks-sleep.md new file mode 100644 index 000000000..f6fa50aad --- /dev/null +++ b/.changeset/thirty-socks-sleep.md @@ -0,0 +1,24 @@ +--- +"@vue-storefront/magento-api": major +--- + +- **[CHANGED]** `Endpoints` interface. Previously, each endpoint contained `context` param, which is internal and shouldn't be exposed in the final interface. Now, `Endpoints` interface properties don't contain `context` param. If you need to use `context` param, you should use `ApiMethods` type. + +```diff +- import { Endpoints } from '@vue-storefront/magento-api'; ++ import { ApiMethods } from '@vue-storefront/magento-api'; +``` + +- **[CHANGED]** Removed `ContextualizedEndpoints` type. Use `Endpoints` instead. + +```diff +- import { ContextualizedEndpoints } from '@vue-storefront/magento-api'; ++ import { Endpoints } from '@vue-storefront/magento-api'; +``` + +- **[REMOVED]** `MagentoApiMethods` interface. Use `Endpoints` instead. + +```diff +- import { MagentoApiMethods } from '@vue-storefront/magento-api'; ++ import { Endpoints } from '@vue-storefront/magento-api'; +``` \ No newline at end of file diff --git a/package.json b/package.json index 33df655bd..5e665d20f 100644 --- a/package.json +++ b/package.json @@ -23,11 +23,11 @@ }, "devDependencies": { "@changesets/cli": "^2.26.1", - "@vue-storefront/api-extractor-config": "^0.0.3", - "@vue-storefront/eslint-config-integrations": "^0.0.14", - "@vue-storefront/integrations-tsconfig": "^0.0.2", - "@vue-storefront/jest-config": "^0.0.2", - "@vue-storefront/rollup-config": "^0.0.3", + "@vue-storefront/api-extractor-config": "^0.0.5", + "@vue-storefront/eslint-config-integrations": "^0.0.21", + "@vue-storefront/integrations-tsconfig": "^0.0.4", + "@vue-storefront/jest-config": "^0.0.4", + "@vue-storefront/rollup-config": "^0.0.7", "all-contributors-cli": "^6.20.0", "esbuild": "^0.14.23", "lerna": "^4.0.0", diff --git a/packages/api-client/package.json b/packages/api-client/package.json index 9f28a2b24..16dbef467 100644 --- a/packages/api-client/package.json +++ b/packages/api-client/package.json @@ -24,7 +24,7 @@ "dependencies": { "@apollo/client": "3.8.7", "@nuxtjs/composition-api": "0.31.0", - "@vue-storefront/middleware": "^3.5.0", + "@vue-storefront/middleware": "^3.9.0", "@vue-storefront/magento-types": "1.2.0", "agentkeepalive": "^4.2.1", "consola": "^3.1.0", diff --git a/packages/api-client/rollup.config.js b/packages/api-client/rollup.config.js index cce6f33a1..029049b21 100644 --- a/packages/api-client/rollup.config.js +++ b/packages/api-client/rollup.config.js @@ -1,12 +1,7 @@ -import json from "@rollup/plugin-json"; - import { generateBaseConfig, generateServerConfig } from "@vue-storefront/rollup-config"; import package_ from "./package.json"; const baseConfig = generateBaseConfig(package_); const serverConfig = generateServerConfig(package_); -baseConfig.plugins.push(json()); -serverConfig.plugins.push(json()); - export default [baseConfig, serverConfig]; diff --git a/packages/api-client/src/api-extractor-data.ts b/packages/api-client/src/api-extractor-data.ts index ae687d105..e1dfc4cbd 100644 --- a/packages/api-client/src/api-extractor-data.ts +++ b/packages/api-client/src/api-extractor-data.ts @@ -1,5 +1,5 @@ /** - * Api Client for Magento 2 integration for Vue Storefront 2. + * `api-client` of Magento 2 integration. * * @remarks * The `@vue-storefront/magento-api` library includes Apollo Client, @@ -10,3 +10,4 @@ */ export * from "./api"; +export * from "./types"; diff --git a/packages/api-client/src/api/addBundleProductsToCart/index.ts b/packages/api-client/src/api/addBundleProductsToCart/index.ts index 6cca39524..0b0dd235f 100644 --- a/packages/api-client/src/api/addBundleProductsToCart/index.ts +++ b/packages/api-client/src/api/addBundleProductsToCart/index.ts @@ -7,19 +7,19 @@ import type { CustomHeaders, } from "@vue-storefront/magento-types"; import gql from "graphql-tag"; -import addBundleProductsToCart from "./addBundleProductsToCart"; +import addBundleProductsToCartQuery from "./addBundleProductsToCart"; import { Context } from "../../types/context"; import getHeaders from "../getHeaders"; -export default async ( +export async function addBundleProductsToCart( context: Context, input: AddBundleProductsToCartInput, customQuery: CustomQuery = { addBundleProductsToCart: "addBundleProductsToCart" }, customHeaders: CustomHeaders = {} -): Promise> => { +): Promise> { const { addBundleProductsToCart: addBundleProductsToCartGQL } = context.extendQuery(customQuery, { addBundleProductsToCart: { - query: addBundleProductsToCart, + query: addBundleProductsToCartQuery, variables: { input }, }, }); @@ -33,4 +33,4 @@ export default async ( headers: getHeaders(context, customHeaders), }, }); -}; +} diff --git a/packages/api-client/src/api/addConfigurableProductsToCart/index.ts b/packages/api-client/src/api/addConfigurableProductsToCart/index.ts index 770721baa..d6e883251 100644 --- a/packages/api-client/src/api/addConfigurableProductsToCart/index.ts +++ b/packages/api-client/src/api/addConfigurableProductsToCart/index.ts @@ -18,7 +18,7 @@ import getHeaders from "../getHeaders"; * @param [customQuery] (optional) - custom GraphQL query that extends the default one * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function addConfigurableProductsToCart( +export async function addConfigurableProductsToCart( context: Context, input: AddConfigurableProductsToCartInput, customQuery: CustomQuery = { addConfigurableProductsToCart: "addConfigurableProductsToCart" }, diff --git a/packages/api-client/src/api/addDownloadableProductsToCart/index.ts b/packages/api-client/src/api/addDownloadableProductsToCart/index.ts index 649db2a6f..13ece73a5 100644 --- a/packages/api-client/src/api/addDownloadableProductsToCart/index.ts +++ b/packages/api-client/src/api/addDownloadableProductsToCart/index.ts @@ -17,7 +17,7 @@ import getHeaders from "../getHeaders"; * @param customQuery custom GraphQL query that extends the default one * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function addDownloadableProductsToCart( +export async function addDownloadableProductsToCart( context: Context, input: AddDownloadableProductsToCartInput, customQuery: CustomQuery = { addDownloadableProductsToCart: "addDownloadableProductsToCart" }, diff --git a/packages/api-client/src/api/addProductToWishList/index.ts b/packages/api-client/src/api/addProductToWishList/index.ts index eed0262fb..f210c8e72 100644 --- a/packages/api-client/src/api/addProductToWishList/index.ts +++ b/packages/api-client/src/api/addProductToWishList/index.ts @@ -1,19 +1,19 @@ import { FetchResult, gql } from "@apollo/client/core"; import { CustomQuery, AddProductsToWishlistMutation, AddProductsToWishlistMutationVariables } from "@vue-storefront/magento-types"; import type { CustomHeaders } from "@vue-storefront/magento-types"; -import addProductsToWishlist from "./addProductsToWishlist"; +import addProductsToWishListQuery from "./addProductsToWishlist"; import { Context } from "../../types/context"; import getHeaders from "../getHeaders"; -export default async ( +export async function addProductToWishList( context: Context, input: AddProductsToWishlistMutationVariables, customQuery: CustomQuery = { addProductsToWishlist: "addProductsToWishlist" }, customHeaders: CustomHeaders = {} -): Promise> => { +): Promise> { const { addProductsToWishlist: addProductsToWishlistGQL } = context.extendQuery(customQuery, { addProductsToWishlist: { - query: addProductsToWishlist, + query: addProductsToWishListQuery, variables: { ...input }, }, }); @@ -26,4 +26,4 @@ export default async ( headers: getHeaders(context, customHeaders), }, }); -}; +} diff --git a/packages/api-client/src/api/addProductsToCart/index.ts b/packages/api-client/src/api/addProductsToCart/index.ts index b96459318..211a0eb7e 100644 --- a/packages/api-client/src/api/addProductsToCart/index.ts +++ b/packages/api-client/src/api/addProductsToCart/index.ts @@ -12,7 +12,7 @@ import getHeaders from "../getHeaders"; * @param [customQuery] (optional) - custom GraphQL query that extends the default one * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function addProductsToCart( +export async function addProductsToCart( context: Context, input: AddProductsToCartInput, customQuery: CustomQuery = { addProductsToCart: "addProductsToCart" }, diff --git a/packages/api-client/src/api/addSimpleProductsToCart/index.ts b/packages/api-client/src/api/addSimpleProductsToCart/index.ts index 69ed44843..736842e1f 100644 --- a/packages/api-client/src/api/addSimpleProductsToCart/index.ts +++ b/packages/api-client/src/api/addSimpleProductsToCart/index.ts @@ -6,19 +6,19 @@ import { AddSimpleProductsToCartMutationVariables, } from "@vue-storefront/magento-types"; import type { CustomHeaders } from "@vue-storefront/magento-types"; -import addSimpleProductsToCart from "./addSimpleProductsToCart"; +import addSimpleProductsToCartQuery from "./addSimpleProductsToCart"; import { Context } from "../../types/context"; import getHeaders from "../getHeaders"; -export default async ( +export async function addSimpleProductsToCart( context: Context, input: AddSimpleProductsToCartInput, customQuery: CustomQuery = { addSimpleProductsToCart: "addSimpleProductsToCart" }, customHeaders: CustomHeaders = {} -): Promise> => { +): Promise> { const { addSimpleProductsToCart: addSimpleProductsToCartGQL } = context.extendQuery(customQuery, { addSimpleProductsToCart: { - query: addSimpleProductsToCart, + query: addSimpleProductsToCartQuery, variables: { input }, }, }); @@ -29,4 +29,4 @@ export default async ( headers: getHeaders(context, customHeaders), }, }); -}; +} diff --git a/packages/api-client/src/api/addVirtualProductsToCart/index.ts b/packages/api-client/src/api/addVirtualProductsToCart/index.ts index be9d2ca9b..5b9d13ab0 100644 --- a/packages/api-client/src/api/addVirtualProductsToCart/index.ts +++ b/packages/api-client/src/api/addVirtualProductsToCart/index.ts @@ -17,7 +17,7 @@ import getHeaders from "../getHeaders"; * @param customQuery custom GraphQL query that extends the default one * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function addVirtualProductsToCart( +export async function addVirtualProductsToCart( context: Context, input: AddVirtualProductsToCartInput, customQuery: CustomQuery = { addVirtualProductsToCart: "addVirtualProductsToCart" }, diff --git a/packages/api-client/src/api/applyCouponToCart/index.ts b/packages/api-client/src/api/applyCouponToCart/index.ts index c44799ab8..59086255e 100644 --- a/packages/api-client/src/api/applyCouponToCart/index.ts +++ b/packages/api-client/src/api/applyCouponToCart/index.ts @@ -13,7 +13,7 @@ import getHeaders from "../getHeaders"; * @param customQuery custom GraphQL query that extends the default one * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function applyCouponToCart( +export async function applyCouponToCart( context: Context, input: ApplyCouponToCartInput, customQuery: CustomQuery = { applyCouponToCart: "applyCouponToCart" }, diff --git a/packages/api-client/src/api/availableStores/index.ts b/packages/api-client/src/api/availableStores/index.ts index 586f8cdb6..16d0fe4fd 100644 --- a/packages/api-client/src/api/availableStores/index.ts +++ b/packages/api-client/src/api/availableStores/index.ts @@ -2,21 +2,21 @@ import { ApolloQueryResult } from "@apollo/client/core"; import type { CustomHeaders } from "@vue-storefront/magento-types"; import { AvailableStoresQuery, CustomQuery } from "@vue-storefront/magento-types"; import gql from "graphql-tag"; -import availableStores from "./availableStores"; +import availableStoresQuery from "./availableStores"; import { Context } from "../../types/context"; import getHeaders from "../getHeaders"; /** * Returns list of available stores */ -export default async ( +export async function availableStores( context: Context, customQuery: CustomQuery = { availableStores: "availableStores" }, customHeaders: CustomHeaders = {} -): Promise> => { +): Promise> { const { availableStores: availableStoresGQL } = context.extendQuery(customQuery, { availableStores: { - query: availableStores, + query: availableStoresQuery, }, }); @@ -28,4 +28,4 @@ export default async ( headers: getHeaders(context, customHeaders), }, }); -}; +} diff --git a/packages/api-client/src/api/cart/index.ts b/packages/api-client/src/api/cart/index.ts index 735529f7f..4dc5c907c 100644 --- a/packages/api-client/src/api/cart/index.ts +++ b/packages/api-client/src/api/cart/index.ts @@ -12,7 +12,7 @@ import getHeaders from "../getHeaders"; * @param customQuery custom GraphQL query that extends the default one * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function cart( +export async function cart( context: Context, cartId: string, customQuery: CustomQuery = { cart: "cart" }, diff --git a/packages/api-client/src/api/cartTotalQty/index.ts b/packages/api-client/src/api/cartTotalQty/index.ts index be7fb5450..404b48bce 100644 --- a/packages/api-client/src/api/cartTotalQty/index.ts +++ b/packages/api-client/src/api/cartTotalQty/index.ts @@ -6,8 +6,8 @@ import cartTotalQtyQuery from "./cartTotalQty"; import { Context } from "../../types/context"; import getHeaders from "../getHeaders"; -export default async (context: Context, cartId: string, customHeaders: CustomHeaders = {}): Promise> => - context.client.query({ +export async function cartTotalQty(context: Context, cartId: string, customHeaders: CustomHeaders = {}): Promise> { + return context.client.query({ query: gql` ${cartTotalQtyQuery} `, @@ -16,3 +16,4 @@ export default async (context: Context, cartId: string, customHeaders: CustomHea headers: getHeaders(context, customHeaders), }, }); +} diff --git a/packages/api-client/src/api/categories/index.ts b/packages/api-client/src/api/categories/index.ts index 9c8dbe99f..852d21ac0 100644 --- a/packages/api-client/src/api/categories/index.ts +++ b/packages/api-client/src/api/categories/index.ts @@ -14,7 +14,7 @@ import getHeaders from "../getHeaders"; * @param [customQuery] (optional) - custom GraphQL query that extends the default query * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function categories( +export async function categories( context: Context, params: QueryCategoriesArgs, customQuery: CustomQuery = { categories: "categories" }, diff --git a/packages/api-client/src/api/categoryList/index.ts b/packages/api-client/src/api/categoryList/index.ts index 299b6880d..1642be361 100644 --- a/packages/api-client/src/api/categoryList/index.ts +++ b/packages/api-client/src/api/categoryList/index.ts @@ -15,7 +15,7 @@ import getHeaders from "../getHeaders"; * @param [customQuery] (optional) - custom GraphQL query that extends the default query * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function categoryList( +export async function categoryList( context: Context, params: QueryCategoryListArgs, customQuery: CustomQuery = { categoryList: "categoryList" }, diff --git a/packages/api-client/src/api/categorySearch/index.ts b/packages/api-client/src/api/categorySearch/index.ts index 342d9af69..82f5e31c9 100644 --- a/packages/api-client/src/api/categorySearch/index.ts +++ b/packages/api-client/src/api/categorySearch/index.ts @@ -15,7 +15,7 @@ import getHeaders from "../getHeaders"; * @param [customQuery] (optional) - custom GraphQL query that extends the default query * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function categorySearch( +export async function categorySearch( context: Context, filters: CategorySearchQueryVariables, customQuery: CustomQuery = { categorySearch: "categorySearch" }, diff --git a/packages/api-client/src/api/changeCustomerPassword/index.ts b/packages/api-client/src/api/changeCustomerPassword/index.ts index 61c85f371..03279c5d5 100644 --- a/packages/api-client/src/api/changeCustomerPassword/index.ts +++ b/packages/api-client/src/api/changeCustomerPassword/index.ts @@ -2,23 +2,23 @@ import { FetchResult } from "@apollo/client/core"; import type { CustomHeaders } from "@vue-storefront/magento-types"; import { ChangeCustomerPasswordMutation, ChangeCustomerPasswordMutationVariables, CustomQuery } from "@vue-storefront/magento-types"; import gql from "graphql-tag"; -import changeCustomerPassword from "./changeCustomerPassword"; +import changeCustomerPasswordQuery from "./changeCustomerPassword"; import { Context } from "../../types/context"; import getHeaders from "../getHeaders"; /** * Changes password of the current customer. To override the default query, use the `changeCustomerPassword` query key. */ -export default async ( +export async function changeCustomerPassword( context: Context, params: { currentPassword: string; newPassword: string }, customQuery: CustomQuery = { changeCustomerPassword: "changeCustomerPassword" }, customHeaders: CustomHeaders = {} -): Promise> => { +): Promise> { try { const { changeCustomerPassword: changeCustomerPasswordGQL } = context.extendQuery(customQuery, { changeCustomerPassword: { - query: changeCustomerPassword, + query: changeCustomerPasswordQuery, variables: { ...params }, }, }); @@ -41,4 +41,4 @@ export default async ( } throw error.networkError?.result || error; } -}; +} diff --git a/packages/api-client/src/api/cmsBlocks/index.ts b/packages/api-client/src/api/cmsBlocks/index.ts index f873f4923..49982e7d3 100644 --- a/packages/api-client/src/api/cmsBlocks/index.ts +++ b/packages/api-client/src/api/cmsBlocks/index.ts @@ -2,7 +2,7 @@ import { ApolloQueryResult } from "@apollo/client/core"; import type { CustomHeaders } from "@vue-storefront/magento-types"; import { CmsBlockQuery, CmsBlockQueryVariables, CustomQuery } from "@vue-storefront/magento-types"; import gql from "graphql-tag"; -import cmsBlocks from "./cmsBlocks"; +import cmsBlocksQuery from "./cmsBlocks"; import { Context } from "../../types/context"; import getHeaders from "../getHeaders"; @@ -14,7 +14,7 @@ import getHeaders from "../getHeaders"; * @param [customQuery] - (optional) - custom GraphQL query that extends the default cmsBlocks query * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function getCmsBlocks( +export async function cmsBlocks( context: Context, identifiers: string, customQuery: CustomQuery = { cmsBlocks: "cmsBlocks" }, @@ -22,7 +22,7 @@ export default async function getCmsBlocks( ): Promise> { const { cmsBlocks: cmsBlocksGQL } = context.extendQuery(customQuery, { cmsBlocks: { - query: cmsBlocks, + query: cmsBlocksQuery, variables: { identifiers }, }, }); diff --git a/packages/api-client/src/api/cmsPage/index.ts b/packages/api-client/src/api/cmsPage/index.ts index c44f0cb66..178ff738f 100644 --- a/packages/api-client/src/api/cmsPage/index.ts +++ b/packages/api-client/src/api/cmsPage/index.ts @@ -3,7 +3,7 @@ import consola from "consola"; import type { CustomHeaders } from "@vue-storefront/magento-types"; import { CmsPageQuery, CmsPageQueryVariables, CustomQuery } from "@vue-storefront/magento-types"; import gql from "graphql-tag"; -import cmsPage from "./cmsPage"; +import cmsPageQuery from "./cmsPage"; import { Context } from "../../types/context"; import getHeaders from "../getHeaders"; @@ -14,7 +14,7 @@ import getHeaders from "../getHeaders"; * @param customQuery - (optional) - custom query that extends default cmsPage GraphQL query * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function getCmsPage( +export async function cmsPage( context: Context, identifier: string, customQuery: CustomQuery = { cmsPage: "cmsPage" }, @@ -23,7 +23,7 @@ export default async function getCmsPage( try { const { cmsPage: cmsPageGQL } = context.extendQuery(customQuery, { cmsPage: { - query: cmsPage, + query: cmsPageQuery, variables: { identifier }, }, }); diff --git a/packages/api-client/src/api/countries/index.ts b/packages/api-client/src/api/countries/index.ts index 6e8040e6c..a0705b69c 100644 --- a/packages/api-client/src/api/countries/index.ts +++ b/packages/api-client/src/api/countries/index.ts @@ -12,7 +12,7 @@ import getHeaders from "../getHeaders"; * @param [customQuery] (optional) - custom GraphQL query that extends the default one * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function countries( +export async function countries( context: Context, customQuery: CustomQuery = { countries: "countries" }, customHeaders: CustomHeaders = {} diff --git a/packages/api-client/src/api/country/index.ts b/packages/api-client/src/api/country/index.ts index 48df0f68f..a779f8127 100644 --- a/packages/api-client/src/api/country/index.ts +++ b/packages/api-client/src/api/country/index.ts @@ -12,7 +12,7 @@ import getHeaders from "../getHeaders"; * @param [customQuery] (optional) - custom GraphQL query that extends the default one * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function country( +export async function country( context: Context, id: string, customQuery: CustomQuery = { country: "country" }, diff --git a/packages/api-client/src/api/createCustomer/index.ts b/packages/api-client/src/api/createCustomer/index.ts index 29fdb3174..cc1a7e47e 100644 --- a/packages/api-client/src/api/createCustomer/index.ts +++ b/packages/api-client/src/api/createCustomer/index.ts @@ -4,19 +4,19 @@ import { CreateCustomerMutation, CreateCustomerMutationVariables, CustomerCreate import { GraphQLError } from "graphql"; import gql from "graphql-tag"; import recaptchaValidator from "../../helpers/recaptcha/recaptchaValidator"; -import createCustomer from "./createCustomer"; +import createCustomerQuery from "./createCustomer"; import { Context } from "../../types/context"; import getHeaders from "../getHeaders"; /** * Registers a new customer. To override the default query, use the `createCustomer` query key. */ -export default async ( +export async function createCustomer( context: Context, input: CustomerCreateInput, customQuery: CustomQuery = { createCustomer: "createCustomer" }, customHeaders: CustomHeaders = {} -): Promise> => { +): Promise> { try { const { recaptchaToken, ...variables } = input; @@ -36,7 +36,7 @@ export default async ( const { createCustomer: createCustomerGQL } = context.extendQuery(customQuery, { createCustomer: { - query: createCustomer, + query: createCustomerQuery, variables: { input: variables }, }, }); @@ -60,4 +60,4 @@ export default async ( } throw error.networkError?.result || error; } -}; +} diff --git a/packages/api-client/src/api/createCustomerAddress/index.ts b/packages/api-client/src/api/createCustomerAddress/index.ts index e0337445c..158313601 100644 --- a/packages/api-client/src/api/createCustomerAddress/index.ts +++ b/packages/api-client/src/api/createCustomerAddress/index.ts @@ -19,7 +19,7 @@ import getHeaders from "../getHeaders"; * @param [customQuery] (optional) - custom GraphQL query that extends the default query * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function createCustomerAddress( +export async function createCustomerAddress( context: Context, input: CustomerAddressInput, customQuery: CustomQuery = { createCustomerAddress: "createCustomerAddress" }, diff --git a/packages/api-client/src/api/createEmptyCart/index.ts b/packages/api-client/src/api/createEmptyCart/index.ts index ec83d3800..cbb1bd224 100644 --- a/packages/api-client/src/api/createEmptyCart/index.ts +++ b/packages/api-client/src/api/createEmptyCart/index.ts @@ -2,16 +2,17 @@ import { FetchResult } from "@apollo/client/core"; import type { CustomHeaders } from "@vue-storefront/magento-types"; import { CreateEmptyCartMutation } from "@vue-storefront/magento-types"; import gql from "graphql-tag"; -import createEmptyCart from "./createEmptyCart"; +import createEmptyCartQuery from "./createEmptyCart"; import { Context } from "../../types/context"; import getHeaders from "../getHeaders"; -export default async (context: Context, customHeaders: CustomHeaders = {}): Promise> => - context.client.mutate({ +export async function createEmptyCart(context: Context, customHeaders: CustomHeaders = {}): Promise> { + return context.client.mutate({ mutation: gql` - ${createEmptyCart} + ${createEmptyCartQuery} `, context: { headers: getHeaders(context, customHeaders), }, }); +} diff --git a/packages/api-client/src/api/createProductReview/index.ts b/packages/api-client/src/api/createProductReview/index.ts index 58db8a41f..b288654cf 100644 --- a/packages/api-client/src/api/createProductReview/index.ts +++ b/packages/api-client/src/api/createProductReview/index.ts @@ -3,7 +3,7 @@ import type { CustomHeaders } from "@vue-storefront/magento-types"; import { CreateProductReviewInput, CreateProductReviewMutation } from "@vue-storefront/magento-types"; import { GraphQLError } from "graphql"; import gql from "graphql-tag"; -import createProductReview from "./createProductReview"; +import createProductReviewQuery from "./createProductReview"; import { Context } from "../../types/context"; import recaptchaValidator from "../../helpers/recaptcha/recaptchaValidator"; import getHeaders from "../getHeaders"; @@ -11,11 +11,11 @@ import getHeaders from "../getHeaders"; /** * Creates a new product review */ -export default async ( +export async function createProductReview( context: Context, input: CreateProductReviewInput, customHeaders: CustomHeaders = {} -): Promise> => { +): Promise> { const { recaptchaToken, ...variables } = input; if (context.config.recaptcha.isEnabled) { @@ -34,11 +34,11 @@ export default async ( return context.client.mutate({ mutation: gql` - ${createProductReview} + ${createProductReviewQuery} `, variables: { input: variables }, context: { headers: getHeaders(context, customHeaders), }, }); -}; +} diff --git a/packages/api-client/src/api/currency/index.ts b/packages/api-client/src/api/currency/index.ts index 6ae07b7ea..e794c9dad 100644 --- a/packages/api-client/src/api/currency/index.ts +++ b/packages/api-client/src/api/currency/index.ts @@ -13,7 +13,7 @@ import getHeaders from "../getHeaders"; * @param [customQuery] (optional) - custom GraphQL query that extends the default query * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function currency( +export async function currency( context: Context, customQuery: CustomQuery = { currency: "currency" }, customHeaders: CustomHeaders = {} diff --git a/packages/api-client/src/api/customMutation/index.ts b/packages/api-client/src/api/customMutation/index.ts index 2168e1621..8b27d84a6 100644 --- a/packages/api-client/src/api/customMutation/index.ts +++ b/packages/api-client/src/api/customMutation/index.ts @@ -4,7 +4,7 @@ import type { CustomHeaders } from "@vue-storefront/magento-types"; import { Context } from "../../types/context"; import getHeaders from "../getHeaders"; -export default async ( +export async function customMutation( context: Context, { mutation, @@ -17,8 +17,8 @@ export default async ( fetchPolicy?: Extract; customHeaders?: CustomHeaders; } -): Promise> => - context.client.mutate({ +): Promise> { + return context.client.mutate({ mutation: gql` ${mutation} `, @@ -28,3 +28,4 @@ export default async ( headers: getHeaders(context, customHeaders), }, }); +} diff --git a/packages/api-client/src/api/customQuery/index.ts b/packages/api-client/src/api/customQuery/index.ts index 942f3b57c..c11758ae9 100644 --- a/packages/api-client/src/api/customQuery/index.ts +++ b/packages/api-client/src/api/customQuery/index.ts @@ -4,7 +4,7 @@ import type { CustomHeaders } from "@vue-storefront/magento-types"; import { Context } from "../../types/context"; import getHeaders from "../getHeaders"; -export default async ( +export async function customQuery( context: Context, { query, @@ -17,8 +17,8 @@ export default async ( fetchPolicy?: FetchPolicy; customHeaders?: CustomHeaders; } -): Promise> => - context.client.query({ +): Promise> { + return context.client.query({ query: gql` ${query} `, @@ -28,3 +28,4 @@ export default async ( headers: getHeaders(context, customHeaders), }, }); +} diff --git a/packages/api-client/src/api/customer/index.ts b/packages/api-client/src/api/customer/index.ts index 4dfd8b1d5..7322837a0 100644 --- a/packages/api-client/src/api/customer/index.ts +++ b/packages/api-client/src/api/customer/index.ts @@ -1,21 +1,21 @@ import { ApolloQueryResult, gql } from "@apollo/client/core"; import { CustomQuery, CustomerQuery } from "@vue-storefront/magento-types"; import type { CustomHeaders } from "@vue-storefront/magento-types"; -import customer from "./customer"; +import customerQuery from "./customer"; import { Context } from "../../types/context"; import getHeaders from "../getHeaders"; /** * Returns the information about the current customer. To override the default query, use the `customer` query key. */ -export default async ( +export async function customer( context: Context, customQuery: CustomQuery = { customer: "customer" }, customHeaders: CustomHeaders = {} -): Promise> => { +): Promise> { const { customer: customerGQL } = context.extendQuery(customQuery, { customer: { - query: customer, + query: customerQuery, }, }); @@ -27,4 +27,4 @@ export default async ( headers: getHeaders(context, customHeaders), }, }); -}; +} diff --git a/packages/api-client/src/api/customerCart/index.ts b/packages/api-client/src/api/customerCart/index.ts index 03194099f..57efed71b 100644 --- a/packages/api-client/src/api/customerCart/index.ts +++ b/packages/api-client/src/api/customerCart/index.ts @@ -11,7 +11,7 @@ import getHeaders from "../getHeaders"; * @param customQuery custom GraphQL query that extends the default one * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function customerCart( +export async function customerCart( context: Context, customQuery: CustomQuery = { customerCart: "customerCart" }, customHeaders: CustomHeaders = {} diff --git a/packages/api-client/src/api/customerOrders/index.ts b/packages/api-client/src/api/customerOrders/index.ts index 294d00b89..27a106e9b 100644 --- a/packages/api-client/src/api/customerOrders/index.ts +++ b/packages/api-client/src/api/customerOrders/index.ts @@ -20,12 +20,12 @@ type Variables = { /** * Returns customer orders. To override the default query, use the `customerOrders` query key. */ -export default async ( +export async function customerOrders( context: Context, searchParams: GetOrdersSearchParams, customQuery: CustomQuery = { customerOrders: "customerOrders" }, customHeaders: CustomHeaders = {} -): Promise> => { +): Promise> { const defaultParams = { pageSize: 10, currentPage: 1, @@ -57,4 +57,4 @@ export default async ( } catch (error) { throw error.graphQLErrors?.[0].message || error.networkError?.result || error; } -}; +} diff --git a/packages/api-client/src/api/customerProductReview/index.ts b/packages/api-client/src/api/customerProductReview/index.ts index e9d7fe7cd..c96be6e81 100644 --- a/packages/api-client/src/api/customerProductReview/index.ts +++ b/packages/api-client/src/api/customerProductReview/index.ts @@ -7,7 +7,7 @@ import { CustomQuery, } from "@vue-storefront/magento-types"; import gql from "graphql-tag"; -import customerProductReview from "./customerProductReview"; +import customerProductReviewQuery from "./customerProductReview"; import { Context } from "../../types/context"; import getHeaders from "../getHeaders"; @@ -17,12 +17,12 @@ import getHeaders from "../getHeaders"; * @deprecated Use {@link @vue-storefront/magento-api#reviews} instead. * */ -export default async ( +export async function customerProductReview( context: Context, searchParams?: CustomerProductReviewParams, customQuery: CustomQuery = { reviews: "reviews" }, customHeaders: CustomHeaders = {} -): Promise> => { +): Promise> { const defaultParams = { pageSize: 10, currentPage: 1, @@ -35,7 +35,7 @@ export default async ( const { reviews } = context.extendQuery(customQuery, { reviews: { - query: customerProductReview, + query: customerProductReviewQuery, variables, }, }); @@ -53,4 +53,4 @@ export default async ( } catch (error) { throw error.graphQLErrors?.[0].message || error.networkError?.result || error; } -}; +} diff --git a/packages/api-client/src/api/deleteCustomerAddress/index.ts b/packages/api-client/src/api/deleteCustomerAddress/index.ts index 9bfce968d..89fe2ef3d 100644 --- a/packages/api-client/src/api/deleteCustomerAddress/index.ts +++ b/packages/api-client/src/api/deleteCustomerAddress/index.ts @@ -12,7 +12,7 @@ import getHeaders from "../getHeaders"; * @param addressId ID of the customer address to delete * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function deleteCustomerAddress( +export async function deleteCustomerAddress( context: Context, addressId: number, customHeaders: CustomHeaders = {} diff --git a/packages/api-client/src/api/generateCustomerToken/index.ts b/packages/api-client/src/api/generateCustomerToken/index.ts index c586e30b0..368495eff 100644 --- a/packages/api-client/src/api/generateCustomerToken/index.ts +++ b/packages/api-client/src/api/generateCustomerToken/index.ts @@ -4,14 +4,14 @@ import { GraphQLError } from "graphql"; import type { CustomHeaders } from "@vue-storefront/magento-types"; import gql from "graphql-tag"; import recaptchaValidator from "../../helpers/recaptcha/recaptchaValidator"; -import generateCustomerToken from "./generateCustomerToken"; +import generateCustomerTokenQuery from "./generateCustomerToken"; import { Context } from "../../types/context"; import getHeaders from "../getHeaders"; /** * Logs in the customer based on provided username and password. To override the default query, use the `generateCustomerToken` query key. */ -export default async ( +export async function generateCustomerToken( context: Context, params: { email: string; @@ -20,7 +20,7 @@ export default async ( }, customQuery: CustomQuery = { generateCustomerToken: "generateCustomerToken" }, customHeaders: CustomHeaders = {} -): Promise> => { +): Promise> { try { if (context.config.recaptcha.isEnabled) { /** @@ -38,7 +38,7 @@ export default async ( const { generateCustomerToken: generateCustomerTokenGQL } = context.extendQuery(customQuery, { generateCustomerToken: { - query: generateCustomerToken, + query: generateCustomerTokenQuery, variables: { email: params.email, password: params.password, @@ -65,4 +65,4 @@ export default async ( } throw error.networkError?.result || error; } -}; +} diff --git a/packages/api-client/src/api/getAvailableCustomerPaymentMethods/index.ts b/packages/api-client/src/api/getAvailableCustomerPaymentMethods/index.ts index 72e83c380..50231c910 100644 --- a/packages/api-client/src/api/getAvailableCustomerPaymentMethods/index.ts +++ b/packages/api-client/src/api/getAvailableCustomerPaymentMethods/index.ts @@ -6,7 +6,10 @@ import { Context } from "../../types/context"; import getHeaders from "../getHeaders"; import CustomerAvailablePaymentMethods from "./CustomerPaymentMethods"; -export default async (context: Context, customHeaders: CustomHeaders = {}): Promise> => { +export async function getAvailableCustomerPaymentMethods( + context: Context, + customHeaders: CustomHeaders = {} +): Promise> { try { return await context.client.query({ query: gql` @@ -19,4 +22,4 @@ export default async (context: Context, customHeaders: CustomHeaders = {}): Prom } catch (error) { throw error.graphQLErrors?.[0].message || error.networkError?.result || error; } -}; +} diff --git a/packages/api-client/src/api/getAvailableCustomerShippingMethods/index.ts b/packages/api-client/src/api/getAvailableCustomerShippingMethods/index.ts index 3494efbf3..ad322cc82 100644 --- a/packages/api-client/src/api/getAvailableCustomerShippingMethods/index.ts +++ b/packages/api-client/src/api/getAvailableCustomerShippingMethods/index.ts @@ -12,7 +12,7 @@ import getHeaders from "../getHeaders"; * @param [customQuery] (optional) - custom GraphQL query that extends the default one * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function getAvailableCustomerShippingMethods( +export async function getAvailableCustomerShippingMethods( context: Context, customQuery: CustomQuery = { shippingMethods: "shippingMethods" }, customHeaders: CustomHeaders = {} diff --git a/packages/api-client/src/api/getAvailablePaymentMethods/index.ts b/packages/api-client/src/api/getAvailablePaymentMethods/index.ts index caba9d315..608788cfe 100644 --- a/packages/api-client/src/api/getAvailablePaymentMethods/index.ts +++ b/packages/api-client/src/api/getAvailablePaymentMethods/index.ts @@ -12,7 +12,7 @@ import getHeaders from "../getHeaders"; * @param cartId cart ID * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function getAvailablePaymentMethods( +export async function getAvailablePaymentMethods( context: Context, cartId: string, customHeaders: CustomHeaders = {} diff --git a/packages/api-client/src/api/getAvailableShippingMethods/index.ts b/packages/api-client/src/api/getAvailableShippingMethods/index.ts index 6f38c4c0d..51705f4b1 100644 --- a/packages/api-client/src/api/getAvailableShippingMethods/index.ts +++ b/packages/api-client/src/api/getAvailableShippingMethods/index.ts @@ -5,12 +5,12 @@ import { Context } from "../../types/context"; import GuestAvailableShippingMethods from "./GuestAvailableShippingMethods"; import getHeaders from "../getHeaders"; -export default async ( +export async function getAvailableShippingMethods( context: Context, params: GuestAvailableShippingMethodsQueryVariables, customQuery: CustomQuery = { shippingMethods: "shippingMethods" }, customHeaders: CustomHeaders = {} -): Promise> => { +): Promise> { const { shippingMethods } = context.extendQuery(customQuery, { shippingMethods: { query: GuestAvailableShippingMethods, @@ -31,4 +31,4 @@ export default async ( } catch (error) { throw error.graphQLErrors?.[0].message || error.networkError?.result || error; } -}; +} diff --git a/packages/api-client/src/api/getCustomerAddresses/index.ts b/packages/api-client/src/api/getCustomerAddresses/index.ts index a4d00ab5b..300866e4d 100644 --- a/packages/api-client/src/api/getCustomerAddresses/index.ts +++ b/packages/api-client/src/api/getCustomerAddresses/index.ts @@ -13,7 +13,7 @@ import getHeaders from "../getHeaders"; * @param [customQuery] - (optional) - custom GraphQL query that extends the default query * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function getCustomerAddresses( +export async function getCustomerAddresses( context: Context, customQuery: CustomQuery = { getCustomerAddresses: "getCustomerAddresses" }, customHeaders: CustomHeaders = {} diff --git a/packages/api-client/src/api/index.ts b/packages/api-client/src/api/index.ts index 3800031d9..97afd3e36 100644 --- a/packages/api-client/src/api/index.ts +++ b/packages/api-client/src/api/index.ts @@ -1,67 +1,67 @@ -export { default as addBundleProductsToCart } from "./addBundleProductsToCart"; -export { default as addConfigurableProductsToCart } from "./addConfigurableProductsToCart"; -export { default as addProductsToCart } from "./addProductsToCart"; -export { default as addProductToWishList } from "./addProductToWishList"; -export { default as addSimpleProductsToCart } from "./addSimpleProductsToCart"; -export { default as addDownloadableProductsToCart } from "./addDownloadableProductsToCart"; -export { default as addVirtualProductsToCart } from "./addVirtualProductsToCart"; -export { default as applyCouponToCart } from "./applyCouponToCart"; -export { default as availableStores } from "./availableStores"; -export { default as cart } from "./cart"; -export { default as cartTotalQty } from "./cartTotalQty"; -export { default as categories } from "./categories"; -export { default as categoryList } from "./categoryList"; -export { default as categorySearch } from "./categorySearch"; -export { default as changeCustomerPassword } from "./changeCustomerPassword"; -export { default as cmsBlocks } from "./cmsBlocks"; -export { default as cmsPage } from "./cmsPage"; -export { default as countries } from "./countries"; -export { default as country } from "./country"; -export { default as createCustomer } from "./createCustomer"; -export { default as createCustomerAddress } from "./createCustomerAddress"; -export { default as createEmptyCart } from "./createEmptyCart"; -export { default as createProductReview } from "./createProductReview"; -export { default as currency } from "./currency"; -export { default as customer } from "./customer"; -export { default as customerCart } from "./customerCart"; -export { default as customerOrders } from "./customerOrders"; -export { default as customerProductReview } from "./customerProductReview"; -export { default as customMutation } from "./customMutation"; -export { default as customQuery } from "./customQuery"; -export { default as deleteCustomerAddress } from "./deleteCustomerAddress"; -export { default as generateCustomerToken } from "./generateCustomerToken"; -export { default as getAvailableCustomerPaymentMethods } from "./getAvailableCustomerPaymentMethods"; -export { default as getAvailableCustomerShippingMethods } from "./getAvailableCustomerShippingMethods"; -export { default as getAvailablePaymentMethods } from "./getAvailablePaymentMethods"; -export { default as getAvailableShippingMethods } from "./getAvailableShippingMethods"; -export { default as getCustomerAddresses } from "./getCustomerAddresses"; -export { default as mergeCarts } from "./mergeCarts"; -export { default as placeOrder } from "./placeOrder"; -export { default as productDetails } from "./productDetails"; -export { default as productReview } from "./productReview"; -export { default as productReviewRatingsMetadata } from "./productReviewRatingsMetadata"; -export { default as products } from "./products"; -export { default as relatedProducts } from "./relatedProducts"; -export { default as removeCouponFromCart } from "./removeCouponFromCart"; -export { default as removeItemFromCart } from "./removeItemFromCart"; -export { default as removeProductsFromWishlist } from "./removeProductsFromWishlist"; -export { default as requestPasswordResetEmail } from "./requestPasswordResetEmail"; -export { default as resetPassword } from "./resetPassword"; -export { default as revokeCustomerToken } from "./revokeCustomerToken"; -export { default as setBillingAddressOnCart } from "./setBillingAddressOnCart"; -export { default as setGuestEmailOnCart } from "./setGuestEmailOnCart"; -export { default as setPaymentMethodOnCart } from "./setPaymentMethodOnCart"; -export { default as setShippingAddressesOnCart } from "./setShippingAddressesOnCart"; -export { default as setShippingMethodsOnCart } from "./setShippingMethodsOnCart"; -export { default as storeConfig } from "./storeConfig"; -export { default as subscribeEmailToNewsletter } from "./subscribeEmailToNewsletter"; -export { default as updateCartItems } from "./updateCartItems"; -export { default as updateCustomer } from "./updateCustomer"; -export { default as updateCustomerAddress } from "./updateCustomerAddress"; -export { default as updateCustomerEmail } from "./updateCustomerEmail"; -export { default as upsellProducts } from "./upsellProducts"; -export { default as urlResolver } from "./urlResolver"; -export { default as route } from "./route"; -export { default as reviews } from "./reviews"; -export { default as wishlist } from "./wishlist"; -export { default as wishlistItemsCount } from "./wishlistItemsCount"; +export * from "./addBundleProductsToCart"; +export * from "./addConfigurableProductsToCart"; +export * from "./addProductsToCart"; +export * from "./addProductToWishList"; +export * from "./addSimpleProductsToCart"; +export * from "./addDownloadableProductsToCart"; +export * from "./addVirtualProductsToCart"; +export * from "./applyCouponToCart"; +export * from "./availableStores"; +export * from "./cart"; +export * from "./cartTotalQty"; +export * from "./categories"; +export * from "./categoryList"; +export * from "./categorySearch"; +export * from "./changeCustomerPassword"; +export * from "./cmsBlocks"; +export * from "./cmsPage"; +export * from "./countries"; +export * from "./country"; +export * from "./createCustomer"; +export * from "./createCustomerAddress"; +export * from "./createEmptyCart"; +export * from "./createProductReview"; +export * from "./currency"; +export * from "./customer"; +export * from "./customerCart"; +export * from "./customerOrders"; +export * from "./customerProductReview"; +export * from "./customMutation"; +export * from "./customQuery"; +export * from "./deleteCustomerAddress"; +export * from "./generateCustomerToken"; +export * from "./getAvailableCustomerPaymentMethods"; +export * from "./getAvailableCustomerShippingMethods"; +export * from "./getAvailablePaymentMethods"; +export * from "./getAvailableShippingMethods"; +export * from "./getCustomerAddresses"; +export * from "./mergeCarts"; +export * from "./placeOrder"; +export * from "./productDetails"; +export * from "./productReview"; +export * from "./productReviewRatingsMetadata"; +export * from "./products"; +export * from "./relatedProducts"; +export * from "./removeCouponFromCart"; +export * from "./removeItemFromCart"; +export * from "./removeProductsFromWishlist"; +export * from "./requestPasswordResetEmail"; +export * from "./resetPassword"; +export * from "./revokeCustomerToken"; +export * from "./setBillingAddressOnCart"; +export * from "./setGuestEmailOnCart"; +export * from "./setPaymentMethodOnCart"; +export * from "./setShippingAddressesOnCart"; +export * from "./setShippingMethodsOnCart"; +export * from "./storeConfig"; +export * from "./subscribeEmailToNewsletter"; +export * from "./updateCartItems"; +export * from "./updateCustomer"; +export * from "./updateCustomerAddress"; +export * from "./updateCustomerEmail"; +export * from "./upsellProducts"; +export * from "./urlResolver"; +export * from "./route"; +export * from "./reviews"; +export * from "./wishlist"; +export * from "./wishlistItemsCount"; diff --git a/packages/api-client/src/api/mergeCarts/index.ts b/packages/api-client/src/api/mergeCarts/index.ts index 859336818..c6bc66895 100644 --- a/packages/api-client/src/api/mergeCarts/index.ts +++ b/packages/api-client/src/api/mergeCarts/index.ts @@ -1,11 +1,11 @@ import { FetchResult, gql } from "@apollo/client/core"; import { CustomQuery, MergeCartsMutation, MergeCartsMutationVariables } from "@vue-storefront/magento-types"; import type { CustomHeaders } from "@vue-storefront/magento-types"; -import mergeCarts from "./mergeCarts"; +import mergeCartsQuery from "./mergeCarts"; import { Context } from "../../types/context"; import getHeaders from "../getHeaders"; -export default async ( +export async function mergeCarts( context: Context, params: { sourceCartId: string; @@ -13,10 +13,10 @@ export default async ( }, customQuery: CustomQuery = { mergeCarts: "mergeCarts" }, customHeaders: CustomHeaders = {} -): Promise> => { +): Promise> { const { mergeCarts: mergeCartsGQL } = context.extendQuery(customQuery, { mergeCarts: { - query: mergeCarts, + query: mergeCartsQuery, variables: { sourceCartId: params.sourceCartId, destinationCartId: params.destinationCartId, @@ -33,4 +33,4 @@ export default async ( headers: getHeaders(context, customHeaders), }, }); -}; +} diff --git a/packages/api-client/src/api/placeOrder/index.ts b/packages/api-client/src/api/placeOrder/index.ts index c17fac9c6..a512eda5f 100644 --- a/packages/api-client/src/api/placeOrder/index.ts +++ b/packages/api-client/src/api/placeOrder/index.ts @@ -13,7 +13,7 @@ import getHeaders from "../getHeaders"; * @param input the order's input, containing the cart's ID * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function placeOrder( +export async function placeOrder( context: Context, input: PlaceOrderInput, customHeaders: CustomHeaders = {} diff --git a/packages/api-client/src/api/productDetails/index.ts b/packages/api-client/src/api/productDetails/index.ts index a7f53857a..4e48a7d4a 100644 --- a/packages/api-client/src/api/productDetails/index.ts +++ b/packages/api-client/src/api/productDetails/index.ts @@ -30,7 +30,7 @@ type Variables = { * @param [customQuery] (optional) - custom GraphQL query that extends the default query * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function productDetails( +export async function productDetails( context: Context, searchParams?: GetProductSearchParams, customQuery: CustomQuery = { productDetails: "productDetails" }, diff --git a/packages/api-client/src/api/productReview/index.ts b/packages/api-client/src/api/productReview/index.ts index ae0e7ef6c..129aae401 100644 --- a/packages/api-client/src/api/productReview/index.ts +++ b/packages/api-client/src/api/productReview/index.ts @@ -9,7 +9,7 @@ import { ProductReviewQueryVariables, } from "@vue-storefront/magento-types"; import gql from "graphql-tag"; -import productReview from "./productReview"; +import productReviewQuery from "./productReview"; import { Context } from "../../types/context"; import getHeaders from "../getHeaders"; @@ -24,12 +24,12 @@ type Variables = { /** * Returns reviews of the provided product */ -export default async ( +export async function productReview( context: Context, searchParams?: GetProductSearchParams, customQuery: CustomQuery = { productReview: "productReview" }, customHeaders: CustomHeaders = {} -): Promise> => { +): Promise> { const defaultParams = { pageSize: 10, currentPage: 1, @@ -49,7 +49,7 @@ export default async ( const { productReview: productReviewGQL } = context.extendQuery(customQuery, { productReview: { - query: productReview, + query: productReviewQuery, variables, }, }); @@ -67,4 +67,4 @@ export default async ( } catch (error) { throw error.graphQLErrors?.[0].message || error.networkError?.result || error; } -}; +} diff --git a/packages/api-client/src/api/productReviewRatingsMetadata/index.ts b/packages/api-client/src/api/productReviewRatingsMetadata/index.ts index eefc07e90..d092e9e1f 100644 --- a/packages/api-client/src/api/productReviewRatingsMetadata/index.ts +++ b/packages/api-client/src/api/productReviewRatingsMetadata/index.ts @@ -1,21 +1,21 @@ import { ApolloQueryResult, gql } from "@apollo/client/core"; import { CustomQuery, ProductReviewRatingsMetadataQuery } from "@vue-storefront/magento-types"; import type { CustomHeaders } from "@vue-storefront/magento-types"; -import productReviewRatingsMetadata from "./productReviewRatingsMetadata"; +import productReviewRatingsMetadataQuery from "./productReviewRatingsMetadata"; import { Context } from "../../types/context"; import getHeaders from "../getHeaders"; /** * Returns the active ratings attributes and the values each rating can have. */ -export default async ( +export async function productReviewRatingsMetadata( context: Context, customQuery: CustomQuery = { productReviewRatingsMetadata: "productReviewRatingsMetadata" }, customHeaders: CustomHeaders = {} -): Promise> => { +): Promise> { const { productReviewRatingsMetadata: productReviewRatingsMetadataGQL } = context.extendQuery(customQuery, { productReviewRatingsMetadata: { - query: productReviewRatingsMetadata, + query: productReviewRatingsMetadataQuery, }, }); @@ -27,4 +27,4 @@ export default async ( headers: getHeaders(context, customHeaders), }, }); -}; +} diff --git a/packages/api-client/src/api/products/index.ts b/packages/api-client/src/api/products/index.ts index 3065ecade..1342da789 100644 --- a/packages/api-client/src/api/products/index.ts +++ b/packages/api-client/src/api/products/index.ts @@ -31,7 +31,7 @@ type Variables = { * @param [customQuery] (optional) - custom GraphQL query that extends the default query * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function products( +export async function products( context: Context, searchParams?: GetProductSearchParams, customQuery: CustomQuery = { products: "products" }, diff --git a/packages/api-client/src/api/relatedProducts/index.ts b/packages/api-client/src/api/relatedProducts/index.ts index e8b23bc78..cbcd5bf32 100644 --- a/packages/api-client/src/api/relatedProducts/index.ts +++ b/packages/api-client/src/api/relatedProducts/index.ts @@ -30,7 +30,7 @@ type Variables = { * @param [customQuery] (optional) - custom GraphQL query that extends the default query * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function relatedProducts( +export async function relatedProducts( context: Context, searchParams?: GetProductSearchParams, customQuery: CustomQuery = { relatedProducts: "relatedProducts" }, diff --git a/packages/api-client/src/api/removeCouponFromCart/index.ts b/packages/api-client/src/api/removeCouponFromCart/index.ts index ee6e50f5a..17c788d99 100644 --- a/packages/api-client/src/api/removeCouponFromCart/index.ts +++ b/packages/api-client/src/api/removeCouponFromCart/index.ts @@ -18,7 +18,7 @@ import getHeaders from "../getHeaders"; * @param customQuery custom GraphQL query that extends the default one * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function removeCouponFromCart( +export async function removeCouponFromCart( context: Context, input: RemoveCouponFromCartInput, customQuery: CustomQuery = { removeCouponFromCart: "removeCouponFromCart" }, diff --git a/packages/api-client/src/api/removeItemFromCart/index.ts b/packages/api-client/src/api/removeItemFromCart/index.ts index abec39a10..e382802f2 100644 --- a/packages/api-client/src/api/removeItemFromCart/index.ts +++ b/packages/api-client/src/api/removeItemFromCart/index.ts @@ -13,7 +13,7 @@ import getHeaders from "../getHeaders"; * @param customQuery custom GraphQL query that extends the default one * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function removeItemFromCart( +export async function removeItemFromCart( context: Context, input: RemoveItemFromCartInput, customQuery: CustomQuery = { removeItemFromCart: "removeItemFromCart" }, diff --git a/packages/api-client/src/api/removeProductsFromWishlist/index.ts b/packages/api-client/src/api/removeProductsFromWishlist/index.ts index 1f388a99d..86f66bf22 100644 --- a/packages/api-client/src/api/removeProductsFromWishlist/index.ts +++ b/packages/api-client/src/api/removeProductsFromWishlist/index.ts @@ -2,19 +2,19 @@ import { FetchResult } from "@apollo/client/core"; import type { CustomHeaders } from "@vue-storefront/magento-types"; import { CustomQuery, RemoveProductsFromWishlistMutation, RemoveProductsFromWishlistMutationVariables } from "@vue-storefront/magento-types"; import gql from "graphql-tag"; -import removeProductsFromWishlist from "./removeProductsFromWishlist"; +import removeProductsFromWishlistQuery from "./removeProductsFromWishlist"; import { Context } from "../../types/context"; import getHeaders from "../getHeaders"; -export default async ( +export async function removeProductsFromWishlist( context: Context, input: RemoveProductsFromWishlistMutationVariables, customQuery: CustomQuery = { removeProductsFromWishlist: "removeProductsFromWishlist" }, customHeaders: CustomHeaders = {} -): Promise> => { +): Promise> { const { removeProductsFromWishlist: removeProductsFromWishlistGQL } = context.extendQuery(customQuery, { removeProductsFromWishlist: { - query: removeProductsFromWishlist, + query: removeProductsFromWishlistQuery, variables: { ...input }, }, }); @@ -28,4 +28,4 @@ export default async ( headers: getHeaders(context, customHeaders), }, }); -}; +} diff --git a/packages/api-client/src/api/requestPasswordResetEmail/index.ts b/packages/api-client/src/api/requestPasswordResetEmail/index.ts index 330674888..6ef58a6df 100644 --- a/packages/api-client/src/api/requestPasswordResetEmail/index.ts +++ b/packages/api-client/src/api/requestPasswordResetEmail/index.ts @@ -15,7 +15,7 @@ import getHeaders from "../getHeaders"; * @param input Email for which to request a password reset * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function requestPasswordResetEmail( +export async function requestPasswordResetEmail( context: Context, input: RequestPasswordResetEmailMutationVariables, customHeaders: CustomHeaders = {} diff --git a/packages/api-client/src/api/resetPassword/index.ts b/packages/api-client/src/api/resetPassword/index.ts index f908b34a9..c96bd2339 100644 --- a/packages/api-client/src/api/resetPassword/index.ts +++ b/packages/api-client/src/api/resetPassword/index.ts @@ -15,7 +15,7 @@ import getHeaders from "../getHeaders"; * @param input Params used to reset a user's password * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function resetPassword( +export async function resetPassword( context: Context, input: ResetPasswordMutationVariables, customHeaders: CustomHeaders = {} diff --git a/packages/api-client/src/api/reviews/index.ts b/packages/api-client/src/api/reviews/index.ts index d3cf27dc6..0014ed715 100644 --- a/packages/api-client/src/api/reviews/index.ts +++ b/packages/api-client/src/api/reviews/index.ts @@ -14,12 +14,12 @@ import getHeaders from "../getHeaders"; /** * Returns product reviews created by the current customer */ -export default async ( +export async function reviews( context: Context, searchParams?: CustomerProductReviewParams, customQuery: CustomQuery = { reviews: "reviews" }, customHeaders: CustomHeaders = {} -): Promise> => { +): Promise> { const defaultParams = { pageSize: 10, currentPage: 1, @@ -50,4 +50,4 @@ export default async ( } catch (error) { throw error.graphQLErrors?.[0].message || error.networkError?.result || error; } -}; +} diff --git a/packages/api-client/src/api/revokeCustomerToken/index.ts b/packages/api-client/src/api/revokeCustomerToken/index.ts index b031bd74f..d9d0d3812 100644 --- a/packages/api-client/src/api/revokeCustomerToken/index.ts +++ b/packages/api-client/src/api/revokeCustomerToken/index.ts @@ -2,19 +2,20 @@ import { FetchResult } from "@apollo/client/core"; import type { CustomHeaders } from "@vue-storefront/magento-types"; import { RevokeCustomerTokenMutation } from "@vue-storefront/magento-types"; import gql from "graphql-tag"; -import revokeCustomerToken from "./revokeCustomerToken"; +import revokeCustomerTokenMutation from "./revokeCustomerToken"; import { Context } from "../../types/context"; import getHeaders from "../getHeaders"; /** * Logs out the current customer. To override the default query, use the `revokeCustomerToken` query key. */ -export default async (context: Context, customHeaders: CustomHeaders = {}): Promise> => - context.client.mutate({ +export async function revokeCustomerToken(context: Context, customHeaders: CustomHeaders = {}): Promise> { + return context.client.mutate({ mutation: gql` - ${revokeCustomerToken} + ${revokeCustomerTokenMutation} `, context: { headers: getHeaders(context, customHeaders), }, }); +} diff --git a/packages/api-client/src/api/route/index.ts b/packages/api-client/src/api/route/index.ts index b295c0d9c..6425a932c 100644 --- a/packages/api-client/src/api/route/index.ts +++ b/packages/api-client/src/api/route/index.ts @@ -13,7 +13,7 @@ import getHeaders from "../getHeaders"; * @param [customQuery] (optional) - custom GraphQL query that extends the default one * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function route( +export async function route( context: Context, url: string, customQuery: CustomQuery = { route: "route" }, diff --git a/packages/api-client/src/api/setBillingAddressOnCart/index.ts b/packages/api-client/src/api/setBillingAddressOnCart/index.ts index a5cad4bc4..a63cbbc9d 100644 --- a/packages/api-client/src/api/setBillingAddressOnCart/index.ts +++ b/packages/api-client/src/api/setBillingAddressOnCart/index.ts @@ -7,19 +7,19 @@ import { SetBillingAddressOnCartMutationVariables, } from "@vue-storefront/magento-types"; import gql from "graphql-tag"; -import setBillingAddressOnCart from "./setBillingAddressOnCart"; +import setBillingAddressOnCartQuery from "./setBillingAddressOnCart"; import { Context } from "../../types/context"; import getHeaders from "../getHeaders"; -export default async ( +export async function setBillingAddressOnCart( context: Context, input: SetBillingAddressOnCartInput, customQuery: CustomQuery = { setBillingAddressOnCart: "setBillingAddressOnCart" }, customHeaders: CustomHeaders = {} -): Promise> => { +): Promise> { const { setBillingAddressOnCart: setBillingAddressOnCartGQL } = context.extendQuery(customQuery, { setBillingAddressOnCart: { - query: setBillingAddressOnCart, + query: setBillingAddressOnCartQuery, variables: { input }, }, }); @@ -33,4 +33,4 @@ export default async ( headers: getHeaders(context, customHeaders), }, }); -}; +} diff --git a/packages/api-client/src/api/setGuestEmailOnCart/index.ts b/packages/api-client/src/api/setGuestEmailOnCart/index.ts index d508e5cb6..0ca60726b 100644 --- a/packages/api-client/src/api/setGuestEmailOnCart/index.ts +++ b/packages/api-client/src/api/setGuestEmailOnCart/index.ts @@ -18,7 +18,7 @@ import getHeaders from "../getHeaders"; * @param [customQuery] (optional) - Custom query that will extend default one * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function setGuestEmailOnCart( +export async function setGuestEmailOnCart( context: Context, input: SetGuestEmailOnCartInput, customQuery: CustomQuery = { setGuestEmailOnCart: "setGuestEmailOnCart" }, diff --git a/packages/api-client/src/api/setPaymentMethodOnCart/index.ts b/packages/api-client/src/api/setPaymentMethodOnCart/index.ts index 24cf2b6c5..00304895c 100644 --- a/packages/api-client/src/api/setPaymentMethodOnCart/index.ts +++ b/packages/api-client/src/api/setPaymentMethodOnCart/index.ts @@ -20,7 +20,7 @@ import getHeaders from "../getHeaders"; * @param [customQuery] (optional) - custom GraphQL query that extends the default query * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function setPaymentMethodOnCart( +export async function setPaymentMethodOnCart( context: Context, input: SetPaymentMethodOnCartInputs, customQuery: CustomQuery = { setPaymentMethodOnCart: "setPaymentMethodOnCart" }, diff --git a/packages/api-client/src/api/setShippingAddressesOnCart/index.ts b/packages/api-client/src/api/setShippingAddressesOnCart/index.ts index c91be35ad..5e87c1d8a 100644 --- a/packages/api-client/src/api/setShippingAddressesOnCart/index.ts +++ b/packages/api-client/src/api/setShippingAddressesOnCart/index.ts @@ -19,7 +19,7 @@ import getHeaders from "../getHeaders"; * @param [customQuery] (optional) - custom GraphQL query that extends the default one * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function setShippingAddressesOnCart( +export async function setShippingAddressesOnCart( context: Context, input: SetShippingAddressesOnCartInput, customQuery: CustomQuery = { setShippingAddressesOnCart: "setShippingAddressesOnCart" }, diff --git a/packages/api-client/src/api/setShippingMethodsOnCart/index.ts b/packages/api-client/src/api/setShippingMethodsOnCart/index.ts index 65e9a5a4f..3120d2a43 100644 --- a/packages/api-client/src/api/setShippingMethodsOnCart/index.ts +++ b/packages/api-client/src/api/setShippingMethodsOnCart/index.ts @@ -19,7 +19,7 @@ import getHeaders from "../getHeaders"; * @param [customQuery] (optional) - custom GraphQL query that extends the default one * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function setShippingMethodsOnCart( +export async function setShippingMethodsOnCart( context: Context, input: SetShippingMethodsOnCartInput, customQuery: CustomQuery = { setShippingMethodsOnCart: "setShippingMethodsOnCart" }, diff --git a/packages/api-client/src/api/storeConfig/index.ts b/packages/api-client/src/api/storeConfig/index.ts index cfb8a520d..28370d791 100644 --- a/packages/api-client/src/api/storeConfig/index.ts +++ b/packages/api-client/src/api/storeConfig/index.ts @@ -2,7 +2,7 @@ import { ApolloQueryResult } from "@apollo/client/core"; import type { CustomHeaders } from "@vue-storefront/magento-types"; import { CustomQuery, StoreConfigQuery } from "@vue-storefront/magento-types"; import gql from "graphql-tag"; -import storeConfigMutation from "./storeConfig"; +import storeConfigQuery from "./storeConfig"; import { Context } from "../../types/context"; import getHeaders from "../getHeaders"; @@ -12,14 +12,14 @@ import getHeaders from "../getHeaders"; * @param [customQuery] (optional) - custom GraphQL query that extends the default one * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function storeConfig( +export async function storeConfig( context: Context, customQuery: CustomQuery = { storeConfig: "storeConfig" }, customHeaders: CustomHeaders = {} ): Promise> { const { storeConfig: storeConfigGQL } = context.extendQuery(customQuery, { storeConfig: { - query: storeConfigMutation, + query: storeConfigQuery, }, }); diff --git a/packages/api-client/src/api/subscribeEmailToNewsletter/index.ts b/packages/api-client/src/api/subscribeEmailToNewsletter/index.ts index f13de01f2..e047d0d01 100644 --- a/packages/api-client/src/api/subscribeEmailToNewsletter/index.ts +++ b/packages/api-client/src/api/subscribeEmailToNewsletter/index.ts @@ -11,7 +11,7 @@ import getHeaders from "../getHeaders"; * @param input params with the email to subscribe * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function subscribeEmailToNewsletter( +export async function subscribeEmailToNewsletter( context: Context, { email }: SubscribeEmailToNewsletterMutationVariables, customHeaders: CustomHeaders = {} diff --git a/packages/api-client/src/api/updateCartItems/index.ts b/packages/api-client/src/api/updateCartItems/index.ts index 5b6c287dc..855490f26 100644 --- a/packages/api-client/src/api/updateCartItems/index.ts +++ b/packages/api-client/src/api/updateCartItems/index.ts @@ -13,7 +13,7 @@ import getHeaders from "../getHeaders"; * @param customQuery custom GraphQL query that extends the default one * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function updateCartItems( +export async function updateCartItems( context: Context, input: UpdateCartItemsInput, customQuery: CustomQuery = { updateCartItems: "updateCartItems" }, diff --git a/packages/api-client/src/api/updateCustomer/index.ts b/packages/api-client/src/api/updateCustomer/index.ts index 1687bf6f9..3e586feee 100644 --- a/packages/api-client/src/api/updateCustomer/index.ts +++ b/packages/api-client/src/api/updateCustomer/index.ts @@ -2,22 +2,22 @@ import { FetchResult } from "@apollo/client/core"; import type { CustomHeaders } from "@vue-storefront/magento-types"; import { CustomerUpdateInput, CustomQuery, UpdateCustomerMutation, UpdateCustomerMutationVariables } from "@vue-storefront/magento-types"; import gql from "graphql-tag"; -import updateCustomer from "./updateCustomer"; +import updateCustomerQuery from "./updateCustomer"; import { Context } from "../../types/context"; import getHeaders from "../getHeaders"; /** * Updates the data of the current customer. To override the default query, use the `updateCustomer` query key. */ -export default async ( +export async function updateCustomer( context: Context, input: CustomerUpdateInput, customQuery: CustomQuery = { updateCustomer: "updateCustomer" }, customHeaders: CustomHeaders = {} -): Promise> => { +): Promise> { const { updateCustomer: updateCustomerGQL } = context.extendQuery(customQuery, { updateCustomer: { - query: updateCustomer, + query: updateCustomerQuery, variables: { input }, }, }); @@ -31,4 +31,4 @@ export default async ( headers: getHeaders(context, customHeaders), }, }); -}; +} diff --git a/packages/api-client/src/api/updateCustomerAddress/index.ts b/packages/api-client/src/api/updateCustomerAddress/index.ts index 283116a15..88a3f87cb 100644 --- a/packages/api-client/src/api/updateCustomerAddress/index.ts +++ b/packages/api-client/src/api/updateCustomerAddress/index.ts @@ -13,7 +13,7 @@ import getHeaders from "../getHeaders"; * @param [customQuery] (optional) custom GraphQL query that extends the default query * @param customHeaders (optional) - custom headers that extends the default headers */ -export default async function updateCustomerAddress( +export async function updateCustomerAddress( context: Context, params: UpdateCustomerAddressMutationVariables, customQuery: CustomQuery = { updateCustomerAddress: "updateCustomerAddress" }, diff --git a/packages/api-client/src/api/updateCustomerEmail/index.ts b/packages/api-client/src/api/updateCustomerEmail/index.ts index bb6d47740..c2823f787 100644 --- a/packages/api-client/src/api/updateCustomerEmail/index.ts +++ b/packages/api-client/src/api/updateCustomerEmail/index.ts @@ -1,19 +1,19 @@ import { FetchResult, gql } from "@apollo/client/core"; import { CustomQuery, UpdateCustomerEmailMutation, UpdateCustomerEmailMutationVariables } from "@vue-storefront/magento-types"; import type { CustomHeaders } from "@vue-storefront/magento-types"; -import updateCustomerEmail from "./updateCustomerEmail"; +import updateCustomerEmailQuery from "./updateCustomerEmail"; import { Context } from "../../types/context"; import getHeaders from "../getHeaders"; -export default async ( +export async function updateCustomerEmail( context: Context, input: UpdateCustomerEmailMutationVariables, customQuery: CustomQuery = { updateCustomerEmail: "updateCustomerEmail" }, customHeaders: CustomHeaders = {} -): Promise> => { +): Promise> { const { updateCustomerEmail: updateCustomerEmailGQL } = context.extendQuery(customQuery, { updateCustomerEmail: { - query: updateCustomerEmail, + query: updateCustomerEmailQuery, variables: { ...input }, }, }); @@ -27,4 +27,4 @@ export default async ( headers: getHeaders(context, customHeaders), }, }); -}; +} diff --git a/packages/api-client/src/api/upsellProducts/index.ts b/packages/api-client/src/api/upsellProducts/index.ts index 7dab5ff8e..0fdb4b62d 100644 --- a/packages/api-client/src/api/upsellProducts/index.ts +++ b/packages/api-client/src/api/upsellProducts/index.ts @@ -9,7 +9,7 @@ import type { UpsellProductsQueryVariables, } from "@vue-storefront/magento-types"; import gql from "graphql-tag"; -import upsellProducts from "./upsellProducts"; +import upsellProductsQuery from "./upsellProducts"; import type { Context } from "../../types/context"; import getHeaders from "../getHeaders"; @@ -24,12 +24,12 @@ type Variables = { /** * Returns upsell products matching the provided parameters. To override the default query, use the `upsellProducts` query key. */ -export default async ( +export async function upsellProducts( context: Context, searchParams?: GetProductSearchParams, customQuery: CustomQuery = { upsellProducts: "upsellProducts" }, customHeaders: CustomHeaders = {} -): Promise> => { +): Promise> { const defaultParams = { pageSize: 10, currentPage: 1, @@ -49,7 +49,7 @@ export default async ( const { upsellProducts: upsellProductsGQL } = context.extendQuery(customQuery, { upsellProducts: { - query: upsellProducts, + query: upsellProductsQuery, variables, }, }); @@ -67,4 +67,4 @@ export default async ( } catch (error) { throw error.graphQLErrors?.[0].message || error.networkError?.result || error; } -}; +} diff --git a/packages/api-client/src/api/urlResolver/index.ts b/packages/api-client/src/api/urlResolver/index.ts index 828c307c4..25723435c 100644 --- a/packages/api-client/src/api/urlResolver/index.ts +++ b/packages/api-client/src/api/urlResolver/index.ts @@ -13,7 +13,7 @@ import getHeaders from "../getHeaders"; * @param customHeaders (optional) - custom headers that extends the default headers * @deprecated - use route instead */ -export default async function urlResolver( +export async function urlResolver( context: Context, url: string, customQuery: CustomQuery = { urlResolver: "urlResolver" }, diff --git a/packages/api-client/src/api/wishlist/index.ts b/packages/api-client/src/api/wishlist/index.ts index 8682282ae..f74a729d3 100644 --- a/packages/api-client/src/api/wishlist/index.ts +++ b/packages/api-client/src/api/wishlist/index.ts @@ -10,12 +10,12 @@ type Variables = { currentPage: number; }; -export default async ( +export async function wishlist( context: Context, searchParams: WishlistQueryVariables, customQuery: CustomQuery = { wishlist: "wishlist" }, customHeaders: CustomHeaders = {} -): Promise> => { +): Promise> { const defaultParams = { pageSize: 10, currentPage: 1, @@ -44,4 +44,4 @@ export default async ( } catch (error) { throw error.graphQLErrors?.[0].message || error.networkError?.result || error; } -}; +} diff --git a/packages/api-client/src/api/wishlistItemsCount/index.ts b/packages/api-client/src/api/wishlistItemsCount/index.ts index 4c70558e9..6afa345ff 100644 --- a/packages/api-client/src/api/wishlistItemsCount/index.ts +++ b/packages/api-client/src/api/wishlistItemsCount/index.ts @@ -6,8 +6,8 @@ import wishlistItemsCountQuery from "./wishlistItemsCount"; import { Context } from "../../types/context"; import getHeaders from "../getHeaders"; -export default async (context: Context, customHeaders: CustomHeaders = {}): Promise> => - context.client.query({ +export async function wishlistItemsCount(context: Context, customHeaders: CustomHeaders = {}): Promise> { + return context.client.query({ query: gql` ${wishlistItemsCountQuery} `, @@ -15,3 +15,4 @@ export default async (context: Context, customHeaders: CustomHeaders = {}): Prom headers: getHeaders(context, customHeaders), }, }); +} diff --git a/packages/api-client/src/types/api/endpoints.ts b/packages/api-client/src/types/api/endpoints.ts new file mode 100644 index 000000000..4f732f31b --- /dev/null +++ b/packages/api-client/src/types/api/endpoints.ts @@ -0,0 +1,12 @@ +import { WithoutContext } from "@vue-storefront/middleware"; +import * as apiMethods from "../../api"; + +/** + * Methods of the API client. + */ +export type ApiMethods = typeof apiMethods; + +/** + * Endpoints available in the Magento integration. + */ +export type Endpoints = WithoutContext; diff --git a/packages/api-client/src/types/api/index.ts b/packages/api-client/src/types/api/index.ts new file mode 100644 index 000000000..6615d73b9 --- /dev/null +++ b/packages/api-client/src/types/api/index.ts @@ -0,0 +1 @@ +export * from "./endpoints"; diff --git a/packages/api-client/src/types/context.ts b/packages/api-client/src/types/context.ts deleted file mode 100644 index 5d76e05f8..000000000 --- a/packages/api-client/src/types/context.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { ApiClientMethods, IntegrationContext } from "@vue-storefront/middleware"; -import { MagentoApiMethods } from "@vue-storefront/magento-types"; -import { ClientInstance, Config } from "./setup"; - -// eslint-disable-next-line @typescript-eslint/no-empty-interface -- Allow extending this interface -export interface Context extends IntegrationContext> {} diff --git a/packages/api-client/src/types/context/index.ts b/packages/api-client/src/types/context/index.ts new file mode 100644 index 000000000..bdb37dfda --- /dev/null +++ b/packages/api-client/src/types/context/index.ts @@ -0,0 +1,5 @@ +import { type IntegrationContext } from "@vue-storefront/middleware"; +import { type ClientInstance, type Config } from "../setup"; +import { type Endpoints } from "../api"; + +export interface Context extends IntegrationContext {} diff --git a/packages/api-client/src/types/index.ts b/packages/api-client/src/types/index.ts new file mode 100644 index 000000000..f50a0b45d --- /dev/null +++ b/packages/api-client/src/types/index.ts @@ -0,0 +1,3 @@ +export * from "./api"; +export * from "./context"; +export * from "./setup"; diff --git a/packages/api-client/src/types/setup.ts b/packages/api-client/src/types/setup.ts index a70ece667..29a2b7a54 100644 --- a/packages/api-client/src/types/setup.ts +++ b/packages/api-client/src/types/setup.ts @@ -1,6 +1,6 @@ import { ApolloClient, ApolloClientOptions } from "@apollo/client/core"; import { HttpOptions } from "@apollo/client/link/http/selectHttpOptionsAndBody"; -import { MagentoApiMethods } from "@vue-storefront/magento-types"; +import { Endpoints } from "./api"; export interface Storage { set: (name: string, value: any) => void; @@ -96,7 +96,7 @@ export interface Config extends ClientConfig { customOptions?: ApolloClientOptions; customApolloHttpLinkOptions?: HttpOptions; magentoApiEndpoint: string; - overrides: MagentoApiMethods; + overrides: Endpoints; recaptcha: RecaptchaConfig; imageProvider: string; magentoBaseUrl: string; diff --git a/packages/api-types/src/Api.ts b/packages/api-types/src/Api.ts index e2717c5ef..5bb43cf74 100644 --- a/packages/api-types/src/Api.ts +++ b/packages/api-types/src/Api.ts @@ -156,390 +156,3 @@ export enum MagentoCustomerGender { } export declare type CustomHeaders = Record; - -export interface MagentoApiMethods { - addBundleProductsToCart( - input: AddBundleProductsToCartInput, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - addConfigurableProductsToCart( - input: AddConfigurableProductsToCartInput, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - addProductsToCart( - input: AddProductsToCartInput, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - addProductToWishList( - input: AddProductsToWishlistMutationVariables, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - addSimpleProductsToCart( - input: AddSimpleProductsToCartInput, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - addDownloadableProductsToCart( - input: AddDownloadableProductsToCartInput, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - addVirtualProductsToCart( - input: AddVirtualProductsToCartInput, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - applyCouponToCart( - input: ApplyCouponToCartInput, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - availableStores( - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - cart( - cartId: string, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - cartTotalQty( - cartId: string, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - categories( - currentPage?: InputMaybe, - filters?: InputMaybe, - pageSize?: InputMaybe, - ): Promise>>; - - categoryList( - categoryFilter?: CategoryListQueryVariables, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - categorySearch( - categoryFilter?: CategorySearchQueryVariables, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - changeCustomerPassword( - params: { currentPassword: string; newPassword: string }, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - cmsBlocks( - identifiers: string[], - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - cmsPage( - identifier: string, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - countries( - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - country( - id: string, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - createCustomer( - input: CustomerCreateInput, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - createCustomerAddress( - input: CustomerAddressInput, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - createEmptyCart( - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - createProductReview( - input: CreateProductReviewInput, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - currency( - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - customer( - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - customerCart( - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - customerOrders( - searchParams: GetOrdersSearchParams, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - customQuery(params: { - query: string, - queryVariables?: QUERY_VARIABLES, - fetchPolicy?: FetchPolicy, - customHeaders?: CustomHeaders, - }): Promise>; - - customMutation(params: { - mutation: string, - mutationVariables: MUTATION_VARIABLES, - fetchPolicy?: Extract, - customHeaders?: CustomHeaders, - }): Promise>; - - customerProductReview( - input: CustomerProductReviewParams, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - deleteCustomerAddress( - addressId: number, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - generateCustomerToken( - params: { email: string, password: string, recaptchaToken: string }, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - getAvailableCustomerPaymentMethods( - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - getAvailableCustomerShippingMethods( - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - getAvailablePaymentMethods( - cartId: string, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - getAvailableShippingMethods( - params: { cart_id: string }, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - getCustomerAddresses( - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - mergeCarts( - params: { sourceCartId: string; destinationCartId: string }, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - placeOrder( - input: PlaceOrderInput, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - productDetails( - searchParams: GetProductSearchParams, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - productReview( - searchParams: GetProductSearchParams, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - productReviewRatingsMetadata( - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - products( - searchParams: GetProductSearchParams, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - relatedProducts( - searchParams: GetProductSearchParams, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - removeCouponFromCart( - input: RemoveCouponFromCartInput, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - removeItemFromCart( - input: RemoveItemFromCartInput, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - removeProductsFromWishlist( - input: RemoveProductsFromWishlistMutationVariables, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - revokeCustomerToken( - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - requestPasswordResetEmail( - input: RequestPasswordResetEmailMutationVariables, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - resetPassword( - input: ResetPasswordMutationVariables, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - setBillingAddressOnCart( - input: SetBillingAddressOnCartInput, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - setGuestEmailOnCart( - input: SetGuestEmailOnCartInput, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - setPaymentMethodOnCart( - input: SetPaymentMethodOnCartInputs, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - setShippingAddressesOnCart( - input: SetShippingAddressesOnCartInput, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - setShippingMethodsOnCart( - input: SetShippingMethodsOnCartInput, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - storeConfig( - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - subscribeEmailToNewsletter( - input: SubscribeEmailToNewsletterMutationVariables, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - updateCartItems( - input: UpdateCartItemsInput, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - updateCustomer( - input: CustomerUpdateInput, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - updateCustomerAddress( - input: { id: number; input: CustomerAddressInput; }, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - updateCustomerEmail( - input: UpdateCustomerEmailMutationVariables, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - upsellProducts( - searchParams: GetProductSearchParams, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - urlResolver( - url: string, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - route( - url: string, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>>; - - wishlist( - searchParams: WishlistQueryVariables, - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; - - wishlistItemsCount( - customQuery?: CustomQuery, - customHeaders?: CustomHeaders - ): Promise>; -} diff --git a/packages/load-tests/src/query/storeConfig.gql.js b/packages/load-tests/src/query/storeConfig.gql.js index 367c7886a..fa7399824 100644 --- a/packages/load-tests/src/query/storeConfig.gql.js +++ b/packages/load-tests/src/query/storeConfig.gql.js @@ -14,4 +14,5 @@ export const StoreConfigQuery = ` } `; -export const StoreConfigQueryString = 'query=query%20storeConfig%20%7B%0A%20%20%20%20storeConfig%20%7B%0A%20%20%20%20%20%20%20%20store_code,%0A%20%20%20%20%20%20%20%20default_title,%0A%20%20%20%20%20%20%20%20store_name,%0A%20%20%20%20%20%20%20%20default_display_currency_code,%0A%20%20%20%20%20%20%20%20locale,%0A%20%20%20%20%20%20%20%20header_logo_src,%0A%20%20%20%20%20%20%20%20logo_width,%0A%20%20%20%20%20%20%20%20logo_height,%0A%20%20%20%20%20%20%20%20logo_alt%0A%20%20%20%20%7D%0A%20%20%7D&variables=%7B%7D&operationName=storeConfig'; +export const StoreConfigQueryString = + "query=query%20storeConfig%20%7B%0A%20%20%20%20storeConfig%20%7B%0A%20%20%20%20%20%20%20%20store_code,%0A%20%20%20%20%20%20%20%20default_title,%0A%20%20%20%20%20%20%20%20store_name,%0A%20%20%20%20%20%20%20%20default_display_currency_code,%0A%20%20%20%20%20%20%20%20locale,%0A%20%20%20%20%20%20%20%20header_logo_src,%0A%20%20%20%20%20%20%20%20logo_width,%0A%20%20%20%20%20%20%20%20logo_height,%0A%20%20%20%20%20%20%20%20logo_alt%0A%20%20%20%20%7D%0A%20%20%7D&variables=%7B%7D&operationName=storeConfig"; diff --git a/packages/load-tests/src/tests/magento/addSimpleProductToCart.js b/packages/load-tests/src/tests/magento/addSimpleProductToCart.js index 9f6de3f65..0b24a69d6 100644 --- a/packages/load-tests/src/tests/magento/addSimpleProductToCart.js +++ b/packages/load-tests/src/tests/magento/addSimpleProductToCart.js @@ -1,24 +1,24 @@ // Creator: k6 Browser Recorder 0.6.2 (+ handmade cleanups) -import { group, check } from 'k6'; -import http from 'k6/http'; +import { group, check } from "k6"; +import http from "k6/http"; -import getHeaders from './utils/getHeaders.js'; -import { AddProductsToCart } from '../../mutation/addProductsToCart.js'; -import CreateEmptyGuestCart from './createEmptyGuestCart.js'; +import getHeaders from "./utils/getHeaders.js"; +import { AddProductsToCart } from "../../mutation/addProductsToCart.js"; +import CreateEmptyGuestCart from "./createEmptyGuestCart.js"; /** * @type {import('k6/options').Options} */ export const options = { vus: 150, - duration: '1m', + duration: "1m", }; const { BASE_URL } = __ENV; let response; if (BASE_URL === undefined) { - throw new Error('BASE_URL is not set'); + throw new Error("BASE_URL is not set"); } export default function main() { @@ -26,26 +26,26 @@ export default function main() { headers: getHeaders(), }; - group('[Magento] addSimpleProductToGuestCart', () => { + group("[Magento] addSimpleProductToGuestCart", () => { const { cartId } = CreateEmptyGuestCart(); - group('add a simple product to the cart', () => { + group("add a simple product to the cart", () => { response = http.post( `${BASE_URL}`, JSON.stringify({ query: AddProductsToCart, variables: { cartId, - cartItems: [{ quantity: Math.floor(Math.random() * 10), sku: '24-WG02' }], + cartItems: [{ quantity: Math.floor(Math.random() * 10), sku: "24-WG02" }], }, }), - params, + params ); check(response, { - 'is status 200': (r) => r.status === 200, - 'does not have errors': (r) => !r.json().errors, - 'includes cart data': (r) => r.body.includes('addProductsToCart'), + "is status 200": (r) => r.status === 200, + "does not have errors": (r) => !r.json().errors, + "includes cart data": (r) => r.body.includes("addProductsToCart"), }); }); }); diff --git a/packages/load-tests/src/tests/magento/createCustomer.js b/packages/load-tests/src/tests/magento/createCustomer.js index a382e3ab9..f5b38dd28 100644 --- a/packages/load-tests/src/tests/magento/createCustomer.js +++ b/packages/load-tests/src/tests/magento/createCustomer.js @@ -1,24 +1,24 @@ // Creator: k6 Browser Recorder 0.6.2 (+ handmade cleanups) -import { group, check } from 'k6'; -import http from 'k6/http'; +import { group, check } from "k6"; +import http from "k6/http"; -import getHeaders from './utils/getHeaders.js'; -import { CreateCustomer } from '../../mutation/createCustomer.js'; -import { customerData } from '../../utils/customerData.js'; +import getHeaders from "./utils/getHeaders.js"; +import { CreateCustomer } from "../../mutation/createCustomer.js"; +import { customerData } from "../../utils/customerData.js"; /** * @type {import('k6/options').Options} */ export const options = { vus: 150, - duration: '1m', + duration: "1m", }; const { BASE_URL } = __ENV; let response; if (BASE_URL === undefined) { - throw new Error('BASE_URL is not set'); + throw new Error("BASE_URL is not set"); } export default function main() { @@ -26,7 +26,7 @@ export default function main() { headers: getHeaders(), }; - group('[Magento] create a customer account', () => { + group("[Magento] create a customer account", () => { response = http.post( `${BASE_URL}`, JSON.stringify({ @@ -34,18 +34,18 @@ export default function main() { variables: { input: { email: customerData.getEmail(), - password: 'Abcd123!', - firstname: 'Load', - lastname: 'Test', + password: "Abcd123!", + firstname: "Load", + lastname: "Test", }, }, }), - params, + params ); check(response, { - 'is status 200': (r) => r.status === 200, - 'does not have errors': (r) => !r.json().errors, + "is status 200": (r) => r.status === 200, + "does not have errors": (r) => !r.json().errors, }); }); } diff --git a/packages/load-tests/src/tests/magento/createEmptyGuestCart.js b/packages/load-tests/src/tests/magento/createEmptyGuestCart.js index 64e850e4c..5a1b9d983 100644 --- a/packages/load-tests/src/tests/magento/createEmptyGuestCart.js +++ b/packages/load-tests/src/tests/magento/createEmptyGuestCart.js @@ -1,24 +1,24 @@ // Creator: k6 Browser Recorder 0.6.2 (+ handmade cleanups) -import { sleep, group, check } from 'k6'; -import http from 'k6/http'; +import { sleep, group, check } from "k6"; +import http from "k6/http"; -import jsonpath from 'https://jslib.k6.io/jsonpath/1.0.2/index.js'; -import getHeaders from './utils/getHeaders.js'; -import { CreateEmptyCartMutation } from '../../mutation/createEmptyCart.js'; +import jsonpath from "https://jslib.k6.io/jsonpath/1.0.2/index.js"; +import getHeaders from "./utils/getHeaders.js"; +import { CreateEmptyCartMutation } from "../../mutation/createEmptyCart.js"; /** * @type {import('k6/options').Options} */ export const options = { vus: 150, - duration: '1m', + duration: "1m", }; const { BASE_URL } = __ENV; const vars = {}; let response; if (BASE_URL === undefined) { - throw new Error('BASE_URL is not set'); + throw new Error("BASE_URL is not set"); } export default function main() { @@ -26,19 +26,15 @@ export default function main() { headers: getHeaders(), }; - group('[Magento] create an empty cart', () => { - response = http.post( - `${BASE_URL}`, - JSON.stringify({ query: CreateEmptyCartMutation }), - params, - ); + group("[Magento] create an empty cart", () => { + response = http.post(`${BASE_URL}`, JSON.stringify({ query: CreateEmptyCartMutation }), params); sleep(0.2); - [vars.cartId] = jsonpath.query(response.json(), '$.data.createEmptyCart'); + [vars.cartId] = jsonpath.query(response.json(), "$.data.createEmptyCart"); check(response, { - 'is status 200': (r) => r.status === 200, - 'does not have errors': (r) => !r.json().errors, - 'includes cart id': () => vars.cartId, + "is status 200": (r) => r.status === 200, + "does not have errors": (r) => !r.json().errors, + "includes cart id": () => vars.cartId, }); }); diff --git a/packages/load-tests/src/tests/magento/storeConfig.js b/packages/load-tests/src/tests/magento/storeConfig.js index 1e1285d92..d9da47b8e 100644 --- a/packages/load-tests/src/tests/magento/storeConfig.js +++ b/packages/load-tests/src/tests/magento/storeConfig.js @@ -1,22 +1,22 @@ // Creator: k6 Browser Recorder 0.6.2 (+ handmade cleanups) -import { sleep, check, group } from 'k6'; -import http from 'k6/http'; +import { sleep, check, group } from "k6"; +import http from "k6/http"; -import getHeaders from './utils/getHeaders.js'; -import { StoreConfigQueryString } from '../../query/storeConfig.gql.js'; +import getHeaders from "./utils/getHeaders.js"; +import { StoreConfigQueryString } from "../../query/storeConfig.gql.js"; /** * @type {import('k6/options').Options} */ export const options = { vus: 150, - duration: '1m', + duration: "1m", }; const { BASE_URL } = __ENV; if (BASE_URL === undefined) { - throw new Error('BASE_URL is not set'); + throw new Error("BASE_URL is not set"); } export default function main() { @@ -24,18 +24,15 @@ export default function main() { headers: getHeaders(), }; - group('[Magento] storeConfig', () => { - const response = http.get( - `${BASE_URL}/graphql?${StoreConfigQueryString}`, - params, - ); + group("[Magento] storeConfig", () => { + const response = http.get(`${BASE_URL}/graphql?${StoreConfigQueryString}`, params); sleep(0.5); check(response, { - 'is status 200': (r) => r.status === 200, - 'does not have errors': (r) => !r.json().errors, - 'includes storeConfig data': (r) => r.body.includes('storeConfig'), + "is status 200": (r) => r.status === 200, + "does not have errors": (r) => !r.json().errors, + "includes storeConfig data": (r) => r.body.includes("storeConfig"), }); }); } diff --git a/packages/load-tests/src/tests/magento/utils/getHeaders.js b/packages/load-tests/src/tests/magento/utils/getHeaders.js index 7f21f7703..b3b17c2ab 100644 --- a/packages/load-tests/src/tests/magento/utils/getHeaders.js +++ b/packages/load-tests/src/tests/magento/utils/getHeaders.js @@ -1,5 +1,5 @@ const getHeaders = () => ({ - 'Content-Type': 'application/json', + "Content-Type": "application/json", }); export default getHeaders; diff --git a/packages/load-tests/src/tests/middleware/createCustomer.js b/packages/load-tests/src/tests/middleware/createCustomer.js index c85a174ce..60c1f2939 100644 --- a/packages/load-tests/src/tests/middleware/createCustomer.js +++ b/packages/load-tests/src/tests/middleware/createCustomer.js @@ -1,23 +1,23 @@ // Creator: k6 Browser Recorder 0.6.2 (+ handmade cleanups) -import { sleep, group, check } from 'k6'; -import http from 'k6/http'; +import { sleep, group, check } from "k6"; +import http from "k6/http"; -import getHeaders from './utils/getHeaders.js'; -import { customerData } from './utils/customerData.js'; +import getHeaders from "./utils/getHeaders.js"; +import { customerData } from "./utils/customerData.js"; /** * @type {import('k6/options').Options} */ export const options = { vus: 150, - duration: '1m', + duration: "1m", }; const { BASE_URL } = __ENV; let response; if (BASE_URL === undefined) { - throw new Error('BASE_URL is not set'); + throw new Error("BASE_URL is not set"); } export default function main() { @@ -25,24 +25,26 @@ export default function main() { headers: getHeaders(), }; - group('[Middleware] create a customer account', () => { + group("[Middleware] create a customer account", () => { response = http.post( `${BASE_URL}/magento/createCustomer`, - JSON.stringify([{ - email: customerData.getEmail(), - password: 'Abcd123!', - firstname: 'Load', - lastname: 'Test', - recaptchaToken: '12345', - }]), - params, + JSON.stringify([ + { + email: customerData.getEmail(), + password: "Abcd123!", + firstname: "Load", + lastname: "Test", + recaptchaToken: "12345", + }, + ]), + params ); sleep(2); check(response, { - 'is status 200': (r) => r.status === 200, - 'does not have errors': (r) => !r.json().errors, + "is status 200": (r) => r.status === 200, + "does not have errors": (r) => !r.json().errors, }); }); } diff --git a/packages/load-tests/src/tests/middleware/createEmptyGuestCart.js b/packages/load-tests/src/tests/middleware/createEmptyGuestCart.js index 6eae6a2f0..4c6ab6811 100644 --- a/packages/load-tests/src/tests/middleware/createEmptyGuestCart.js +++ b/packages/load-tests/src/tests/middleware/createEmptyGuestCart.js @@ -1,23 +1,23 @@ // Creator: k6 Browser Recorder 0.6.2 (+ handmade cleanups) -import { sleep, group, check } from 'k6'; -import http from 'k6/http'; +import { sleep, group, check } from "k6"; +import http from "k6/http"; -import jsonpath from 'https://jslib.k6.io/jsonpath/1.0.2/index.js'; -import getHeaders from './utils/getHeaders.js'; +import jsonpath from "https://jslib.k6.io/jsonpath/1.0.2/index.js"; +import getHeaders from "./utils/getHeaders.js"; /** * @type {import('k6/options').Options} */ export const options = { vus: 1, - duration: '1s', + duration: "1s", }; const { BASE_URL } = __ENV; const vars = {}; let response; if (BASE_URL === undefined) { - throw new Error('BASE_URL is not set'); + throw new Error("BASE_URL is not set"); } export default function main() { @@ -25,21 +25,17 @@ export default function main() { headers: getHeaders(), }; - group('[Middleware] create an empty cart', () => { - response = http.post( - `${BASE_URL}/magento/createEmptyCart`, - '[]', - params, - ); + group("[Middleware] create an empty cart", () => { + response = http.post(`${BASE_URL}/magento/createEmptyCart`, "[]", params); sleep(1); - [vars.cartId] = jsonpath.query(response.json(), '$.data.createEmptyCart'); + [vars.cartId] = jsonpath.query(response.json(), "$.data.createEmptyCart"); check(response, { - 'is status 200': (r) => r.status === 200, - 'does not have errors': (r) => !r.json().errors, - 'includes cart id': () => vars.cartId, + "is status 200": (r) => r.status === 200, + "does not have errors": (r) => !r.json().errors, + "includes cart id": () => vars.cartId, }); }); diff --git a/packages/load-tests/src/tests/middleware/storeConfig.js b/packages/load-tests/src/tests/middleware/storeConfig.js index 96a128a89..839359737 100644 --- a/packages/load-tests/src/tests/middleware/storeConfig.js +++ b/packages/load-tests/src/tests/middleware/storeConfig.js @@ -1,20 +1,20 @@ // Creator: k6 Browser Recorder 0.6.2 (+ handmade cleanups) -import { sleep, check, group } from 'k6'; -import http from 'k6/http'; -import getHeaders from './utils/getHeaders.js'; +import { sleep, check, group } from "k6"; +import http from "k6/http"; +import getHeaders from "./utils/getHeaders.js"; /** * @type {import('k6/options').Options} */ export const options = { vus: 150, - duration: '1m', + duration: "1m", }; const { BASE_URL } = __ENV; if (BASE_URL === undefined) { - throw new Error('BASE_URL is not set'); + throw new Error("BASE_URL is not set"); } export default function main() { @@ -22,19 +22,19 @@ export default function main() { headers: getHeaders(), }; - group('[Middleware] storeConfig', () => { + group("[Middleware] storeConfig", () => { const response = http.post( `${BASE_URL}/git magento/customQuery`, '[{"query":"\\n query storeConfig {\\n storeConfig {\\n store_code,\\n default_title,\\n store_name,\\n default_display_currency_code,\\n locale,\\n header_logo_src,\\n logo_width,\\n logo_height,\\n logo_alt\\n }\\n }\\n"}]', - params, + params ); sleep(0.5); check(response, { - 'is status 200': (r) => r.status === 200, - 'does not have errors': (r) => !r.json().errors, - 'includes storeConfig data': (r) => r.body.includes('storeConfig'), + "is status 200": (r) => r.status === 200, + "does not have errors": (r) => !r.json().errors, + "includes storeConfig data": (r) => r.body.includes("storeConfig"), }); }); } diff --git a/packages/load-tests/src/tests/middleware/utils/customerData.js b/packages/load-tests/src/tests/middleware/utils/customerData.js index 59ed2defb..aa8cde37a 100644 --- a/packages/load-tests/src/tests/middleware/utils/customerData.js +++ b/packages/load-tests/src/tests/middleware/utils/customerData.js @@ -1,7 +1,7 @@ -const chars = 'abcdefghijklmnopqrstuvwxyz1234567890'; +const chars = "abcdefghijklmnopqrstuvwxyz1234567890"; export const getEmail = (length = 15) => { - let string = ''; + let string = ""; for (let i = 0; i < length; i++) { string += chars[Math.floor(Math.random() * chars.length)]; } diff --git a/packages/load-tests/src/tests/middleware/utils/getHeaders.js b/packages/load-tests/src/tests/middleware/utils/getHeaders.js index b70f2919c..e5dd566b4 100644 --- a/packages/load-tests/src/tests/middleware/utils/getHeaders.js +++ b/packages/load-tests/src/tests/middleware/utils/getHeaders.js @@ -1,7 +1,7 @@ const getHeaders = () => ({ - 'content-type': 'application/json', - accept: 'application/json, text/plain, */*', - cookie: 'vsf-store=default; vsf-locale=default; vsf-currency=USD', + "content-type": "application/json", + accept: "application/json, text/plain, */*", + cookie: "vsf-store=default; vsf-locale=default; vsf-currency=USD", }); export default getHeaders; diff --git a/packages/load-tests/src/tests/scenarios/browsingProduct.js b/packages/load-tests/src/tests/scenarios/browsingProduct.js index 3be57b28a..f3a07eabc 100644 --- a/packages/load-tests/src/tests/scenarios/browsingProduct.js +++ b/packages/load-tests/src/tests/scenarios/browsingProduct.js @@ -1,39 +1,39 @@ // Creator: k6 Browser Recorder 0.6.2 -import { check, sleep, group } from 'k6'; -import http from 'k6/http'; +import { check, sleep, group } from "k6"; +import http from "k6/http"; -import jsonpath from 'https://jslib.k6.io/jsonpath/1.0.2/index.js'; -import { setDefaultCookies } from './utils/setDefaultCookies.js'; +import jsonpath from "https://jslib.k6.io/jsonpath/1.0.2/index.js"; +import { setDefaultCookies } from "./utils/setDefaultCookies.js"; export const options = { vus: 200, - duration: '5m', + duration: "5m", thresholds: { - http_req_failed: ['rate<0.01'], // http errors should be less than 1% - http_req_duration: ['p(80)<250'], // 80% of requests should be below 250ms + http_req_failed: ["rate<0.01"], // http errors should be less than 1% + http_req_duration: ["p(80)<250"], // 80% of requests should be below 250ms }, }; const { BASE_URL } = __ENV; if (BASE_URL === undefined) { - throw new Error('BASE_URL is not set'); + throw new Error("BASE_URL is not set"); } const headers = { - accept: 'application/json, text/plain, */*', - 'content-type': 'application/json', - 'upgrade-insecure-requests': '1', - 'sec-ch-ua': '".Not/A)Brand";v="99", "Google Chrome";v="103", "Chromium";v="103"', - 'sec-ch-ua-mobile': '?0', - 'sec-ch-ua-platform': '"macOS"', + accept: "application/json, text/plain, */*", + "content-type": "application/json", + "upgrade-insecure-requests": "1", + "sec-ch-ua": '".Not/A)Brand";v="99", "Google Chrome";v="103", "Chromium";v="103"', + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": '"macOS"', }; const executeCommonChecks = (res) => { check(res, { - 'is status 200': (r) => r.status === 200, - 'has no errors': (r) => !r.json().errors, + "is status 200": (r) => r.status === 200, + "has no errors": (r) => !r.json().errors, }); }; @@ -43,16 +43,13 @@ export default function main() { const vars = {}; setDefaultCookies(BASE_URL); group(`Browsing for a product - page ${BASE_URL}`, () => { - group('Visit the homepage', () => { - res = http.get( - `${BASE_URL}/default`, - { - headers, - }, - ); + group("Visit the homepage", () => { + res = http.get(`${BASE_URL}/default`, { + headers, + }); check(res, { - 'is status 200': (r) => r.status === 200, + "is status 200": (r) => r.status === 200, }); sleep(0.9); @@ -62,7 +59,7 @@ export default function main() { '[{"query":"\\n query storeConfig {\\n storeConfig {\\n store_code,\\n default_title,\\n store_name,\\n default_display_currency_code,\\n locale,\\n header_logo_src,\\n logo_width,\\n logo_height,\\n logo_alt\\n }\\n }\\n"}]', { headers, - }, + } ); executeCommonChecks(res); @@ -72,7 +69,7 @@ export default function main() { '[{"query":"\\n query getStoresAndCurrencies {\\n availableStores {\\n store_code\\n }\\n currency {\\n available_currency_codes\\n }\\n }\\n"}]', { headers, - }, + } ); executeCommonChecks(res); @@ -82,7 +79,7 @@ export default function main() { '[{"query":"\\n query getStoresAndCurrencies {\\n availableStores {\\n store_code\\n }\\n currency {\\n available_currency_codes\\n }\\n }\\n"}]', { headers, - }, + } ); executeCommonChecks(res); @@ -94,22 +91,18 @@ export default function main() { '[{"query":"\\n query categoryList {\\n categories {\\n items {\\n ...CategoryFields\\n children {\\n ...CategoryFields\\n children {\\n ...CategoryFields\\n children {\\n ...CategoryFields\\n }\\n }\\n }\\n }\\n }\\n }\\n \\n fragment CategoryFields on CategoryTree {\\n is_anchor\\n name\\n position\\n product_count\\n uid\\n url_path\\n url_suffix\\n include_in_menu\\n }\\n\\n"}]', { headers, - }, + } ); executeCommonChecks(res); }); - group('Go to the Men category page', () => { - res = http.post( - `${BASE_URL}/api/magento/route`, - '["/men.html",null]', - { - headers, - }, - ); + group("Go to the Men category page", () => { + res = http.post(`${BASE_URL}/api/magento/route`, '["/men.html",null]', { + headers, + }); check(res, { - 'is status 200': (r) => r.status === 200, + "is status 200": (r) => r.status === 200, }); res = http.post( @@ -117,7 +110,7 @@ export default function main() { '[{"query":"\\n query categoryList {\\n categories {\\n items {\\n ...CategoryFields\\n children {\\n ...CategoryFields\\n children {\\n ...CategoryFields\\n children {\\n ...CategoryFields\\n }\\n }\\n }\\n }\\n }\\n }\\n \\n fragment CategoryFields on CategoryTree {\\n is_anchor\\n name\\n position\\n product_count\\n uid\\n url_path\\n url_suffix\\n include_in_menu\\n }\\n\\n"}]', { headers, - }, + } ); executeCommonChecks(res); @@ -126,18 +119,18 @@ export default function main() { '[{"query":"\\n query getCategoryContentData($filters: CategoryFilterInput) {\\n categoryList(filters: $filters) {\\n uid\\n display_mode\\n landing_page\\n cms_block {\\n identifier\\n content\\n }\\n }\\n }\\n","queryVariables":{"filters":{"category_uid":{"eq":"MTE="}}}}]', { headers, - }, + } ); executeCommonChecks(res); - [vars.uid1] = jsonpath.query(res.json(), '$.data.categoryList[0].uid'); + [vars.uid1] = jsonpath.query(res.json(), "$.data.categoryList[0].uid"); res = http.post( `${BASE_URL}/api/magento/customQuery`, `[{"query":"\\n query getFacetData($search: String = \\"\\", $filter: ProductAttributeFilterInput, $pageSize: Int = 10, $currentPage: Int = 1, $sort: ProductAttributeSortInput) {\\n products(search: $search, filter: $filter, pageSize: $pageSize, currentPage: $currentPage, sort: $sort) {\\n items {\\n __typename\\n uid\\n sku\\n name\\n stock_status\\n only_x_left_in_stock\\n thumbnail {\\n url\\n position\\n disabled\\n label\\n }\\n url_key\\n url_rewrites {\\n url\\n }\\n price_range {\\n maximum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n minimum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n }\\n }\\n page_info {\\n current_page\\n page_size\\n total_pages\\n }\\n total_count\\n }\\n }\\n","queryVariables":{"pageSize":10,"search":"","filter":{"category_uid":{"in":["${vars.uid1}"]}},"sort":{},"currentPage":1}}]`, { headers, - }, + } ); executeCommonChecks(res); @@ -146,22 +139,18 @@ export default function main() { `[{"query":"\\n query getProductFiltersByCategory($categoryIdFilter: FilterEqualTypeInput!) {\\n products(filter: { category_uid: $categoryIdFilter }) {\\n aggregations {\\n label\\n count\\n attribute_code\\n options {\\n count\\n label\\n value\\n __typename\\n }\\n position\\n __typename\\n }\\n __typename\\n }\\n }\\n","queryVariables":{"categoryIdFilter":{"eq":"${vars.uid1}"}}}]`, { headers, - }, + } ); executeCommonChecks(res); sleep(3); }); - group('Sort by name ASC', () => { - res = http.post( - `${BASE_URL}/api/magento/route`, - '["/men.html",null]', - { - headers, - }, - ); + group("Sort by name ASC", () => { + res = http.post(`${BASE_URL}/api/magento/route`, '["/men.html",null]', { + headers, + }); check(res, { - 'is status 200': (r) => r.status === 200, + "is status 200": (r) => r.status === 200, }); res = http.post( @@ -169,7 +158,7 @@ export default function main() { `[{"query":"\\n query getCategoryContentData($filters: CategoryFilterInput) {\\n categoryList(filters: $filters) {\\n uid\\n display_mode\\n landing_page\\n cms_block {\\n identifier\\n content\\n }\\n }\\n }\\n","queryVariables":{"filters":{"category_uid":{"eq":"${vars.uid1}"}}}}]`, { headers, - }, + } ); executeCommonChecks(res); @@ -178,22 +167,18 @@ export default function main() { `[{"query":"\\n query getFacetData($search: String = \\"\\", $filter: ProductAttributeFilterInput, $pageSize: Int = 10, $currentPage: Int = 1, $sort: ProductAttributeSortInput) {\\n products(search: $search, filter: $filter, pageSize: $pageSize, currentPage: $currentPage, sort: $sort) {\\n items {\\n __typename\\n uid\\n sku\\n name\\n stock_status\\n only_x_left_in_stock\\n thumbnail {\\n url\\n position\\n disabled\\n label\\n }\\n url_key\\n url_rewrites {\\n url\\n }\\n price_range {\\n maximum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n minimum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n }\\n }\\n page_info {\\n current_page\\n page_size\\n total_pages\\n }\\n total_count\\n }\\n }\\n","queryVariables":{"pageSize":10,"search":"","filter":{"category_uid":{"in":["${vars.uid1}"]}},"sort":{"name":"DESC"},"currentPage":1}}]`, { headers, - }, + } ); executeCommonChecks(res); sleep(3); }); - group('Sort by Price ASC', () => { - res = http.post( - `${BASE_URL}/api/magento/route`, - '["/men.html",null]', - { - headers, - }, - ); + group("Sort by Price ASC", () => { + res = http.post(`${BASE_URL}/api/magento/route`, '["/men.html",null]', { + headers, + }); check(res, { - 'is status 200': (r) => r.status === 200, + "is status 200": (r) => r.status === 200, }); res = http.post( @@ -201,32 +186,28 @@ export default function main() { `[{"query":"\\n query getCategoryContentData($filters: CategoryFilterInput) {\\n categoryList(filters: $filters) {\\n uid\\n display_mode\\n landing_page\\n cms_block {\\n identifier\\n content\\n }\\n }\\n }\\n","queryVariables":{"filters":{"category_uid":{"eq":"${vars.uid1}"}}}}]`, { headers, - }, + } ); executeCommonChecks(res); - [vars.uid2] = jsonpath.query(res.json(), '$.data.categoryList[0].uid'); + [vars.uid2] = jsonpath.query(res.json(), "$.data.categoryList[0].uid"); res = http.post( `${BASE_URL}/api/magento/customQuery`, `[{"query":"\\n query getFacetData($search: String = \\"\\", $filter: ProductAttributeFilterInput, $pageSize: Int = 10, $currentPage: Int = 1, $sort: ProductAttributeSortInput) {\\n products(search: $search, filter: $filter, pageSize: $pageSize, currentPage: $currentPage, sort: $sort) {\\n items {\\n __typename\\n uid\\n sku\\n name\\n stock_status\\n only_x_left_in_stock\\n thumbnail {\\n url\\n position\\n disabled\\n label\\n }\\n url_key\\n url_rewrites {\\n url\\n }\\n price_range {\\n maximum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n minimum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n }\\n }\\n page_info {\\n current_page\\n page_size\\n total_pages\\n }\\n total_count\\n }\\n }\\n","queryVariables":{"pageSize":10,"search":"","filter":{"category_uid":{"in":["${vars.uid1}"]}},"sort":{"price":"ASC"},"currentPage":1}}]`, { headers, - }, + } ); executeCommonChecks(res); sleep(3); }); - group('Filter list by the price', () => { - res = http.post( - `${BASE_URL}/api/magento/route`, - '["/men.html",null]', - { - headers, - }, - ); + group("Filter list by the price", () => { + res = http.post(`${BASE_URL}/api/magento/route`, '["/men.html",null]', { + headers, + }); check(res, { - 'is status 200': (r) => r.status === 200, + "is status 200": (r) => r.status === 200, }); res = http.post( @@ -234,7 +215,7 @@ export default function main() { `[{"query":"\\n query getCategoryContentData($filters: CategoryFilterInput) {\\n categoryList(filters: $filters) {\\n uid\\n display_mode\\n landing_page\\n cms_block {\\n identifier\\n content\\n }\\n }\\n }\\n","queryVariables":{"filters":{"category_uid":{"eq":"${vars.uid2}"}}}}]`, { headers, - }, + } ); executeCommonChecks(res); @@ -243,19 +224,19 @@ export default function main() { `[{"query":"\\n query getFacetData($search: String = \\"\\", $filter: ProductAttributeFilterInput, $pageSize: Int = 10, $currentPage: Int = 1, $sort: ProductAttributeSortInput) {\\n products(search: $search, filter: $filter, pageSize: $pageSize, currentPage: $currentPage, sort: $sort) {\\n items {\\n __typename\\n uid\\n sku\\n name\\n stock_status\\n only_x_left_in_stock\\n thumbnail {\\n url\\n position\\n disabled\\n label\\n }\\n url_key\\n url_rewrites {\\n url\\n }\\n price_range {\\n maximum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n minimum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n }\\n }\\n page_info {\\n current_page\\n page_size\\n total_pages\\n }\\n total_count\\n }\\n }\\n","queryVariables":{"pageSize":10,"search":"","filter":{"price":{"from":40,"to":50},"category_uid":{"in":["${vars.uid2}"]}},"sort":{"price":"ASC"},"currentPage":1}}]`, { headers, - }, + } ); executeCommonChecks(res); sleep(1.6); }); - group('Visit selected product', () => { + group("Visit selected product", () => { res = http.post( `${BASE_URL}/api/magento/productDetail`, '[{"filter":{"sku":{"eq":"MH06"}},"configurations":[]},{"productDetail":"productDetail"}]', { headers, - }, + } ); executeCommonChecks(res); @@ -264,34 +245,22 @@ export default function main() { '[{"query":"\\n query getProductPriceBySku(\\n $filter: ProductAttributeFilterInput,\\n $configurations: [ID!]\\n ) {\\n products(filter: $filter) {\\n items {\\n price_range {\\n ...PriceRangeFields\\n }\\n\\n ... on ConfigurableProduct {\\n price_range {\\n maximum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n minimum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n }\\n\\n configurable_product_options_selection(configurableOptionValueUids: $configurations) {\\n options_available_for_selection {\\n attribute_code\\n option_value_uids\\n }\\n media_gallery {\\n disabled\\n label\\n position\\n url\\n }\\n variant {\\n uid\\n sku\\n name\\n price_range {\\n ...PriceRangeFields\\n }\\n }\\n }\\n }\\n\\n ... on BundleProduct {\\n items {\\n position\\n required\\n sku\\n title\\n type\\n uid\\n options {\\n can_change_quantity\\n is_default\\n position\\n uid\\n quantity\\n product {\\n uid\\n sku\\n name\\n price_range {\\n ...PriceRangeFields\\n }\\n }\\n }\\n }\\n }\\n\\n ... on GroupedProduct {\\n items {\\n position\\n qty\\n product {\\n uid\\n sku\\n name\\n stock_status\\n only_x_left_in_stock\\n price_range {\\n maximum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n minimum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n }\\n thumbnail {\\n url\\n position\\n disabled\\n label\\n }\\n }\\n }\\n }\\n\\n }\\n }\\n }\\n \\n fragment PriceRangeFields on PriceRange {\\n maximum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n minimum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n }\\n\\n","queryVariables":{"filter":{"sku":{"eq":"MH06"}},"configurations":[]}}]', { headers, - }, + } ); executeCommonChecks(res); - res = http.post( - `${BASE_URL}/api/magento/upsellProducts`, - '[{"filter":{"sku":{"eq":"MH06"}}},null]', - { - headers, - }, - ); + res = http.post(`${BASE_URL}/api/magento/upsellProducts`, '[{"filter":{"sku":{"eq":"MH06"}}},null]', { + headers, + }); - res = http.post( - `${BASE_URL}/api/magento/relatedProduct`, - '[{"filter":{"sku":{"eq":"MH06"}}},null]', - { - headers, - }, - ); + res = http.post(`${BASE_URL}/api/magento/relatedProduct`, '[{"filter":{"sku":{"eq":"MH06"}}},null]', { + headers, + }); executeCommonChecks(res); - res = http.post( - `${BASE_URL}/api/magento/productReviewRatingsMetadata`, - '[null]', - { - headers, - }, - ); + res = http.post(`${BASE_URL}/api/magento/productReviewRatingsMetadata`, "[null]", { + headers, + }); }); }); } diff --git a/packages/load-tests/src/tests/scenarios/buyProductAsAGuestUser.js b/packages/load-tests/src/tests/scenarios/buyProductAsAGuestUser.js index eb03d6a17..44eebfe9b 100644 --- a/packages/load-tests/src/tests/scenarios/buyProductAsAGuestUser.js +++ b/packages/load-tests/src/tests/scenarios/buyProductAsAGuestUser.js @@ -1,37 +1,37 @@ // Creator: k6 Browser Recorder 0.6.2 -import { check, sleep, group } from 'k6'; -import http from 'k6/http'; -import jsonpath from 'https://jslib.k6.io/jsonpath/1.0.2/index.js'; -import { setDefaultCookies } from './utils/setDefaultCookies.js'; +import { check, sleep, group } from "k6"; +import http from "k6/http"; +import jsonpath from "https://jslib.k6.io/jsonpath/1.0.2/index.js"; +import { setDefaultCookies } from "./utils/setDefaultCookies.js"; export const options = { vus: 200, - duration: '5m', + duration: "5m", thresholds: { - http_req_failed: ['rate<0.01'], // http errors should be less than 1% - http_req_duration: ['p(80)<250'], // 80% of requests should be below 250ms + http_req_failed: ["rate<0.01"], // http errors should be less than 1% + http_req_duration: ["p(80)<250"], // 80% of requests should be below 250ms }, }; const { BASE_URL } = __ENV; if (BASE_URL === undefined) { - throw new Error('BASE_URL is not set'); + throw new Error("BASE_URL is not set"); } const headers = { - accept: 'application/json, text/plain, */*', - 'content-type': 'application/json', - 'upgrade-insecure-requests': '1', - 'sec-ch-ua': '".Not/A)Brand";v="99", "Google Chrome";v="103", "Chromium";v="103"', - 'sec-ch-ua-mobile': '?0', - 'sec-ch-ua-platform': '"macOS"', + accept: "application/json, text/plain, */*", + "content-type": "application/json", + "upgrade-insecure-requests": "1", + "sec-ch-ua": '".Not/A)Brand";v="99", "Google Chrome";v="103", "Chromium";v="103"', + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": '"macOS"', }; const executeCommonChecks = (res) => { check(res, { - 'is status 200': (r) => r.status === 200, - 'has no errors': (r) => !r.json().errors, + "is status 200": (r) => r.status === 200, + "has no errors": (r) => !r.json().errors, }); }; @@ -42,13 +42,10 @@ export default function main() { setDefaultCookies(BASE_URL); group(`Buy product as a guest user - page ${BASE_URL}`, () => { - group('Visit the homepage', () => { - res = http.get( - `${BASE_URL}/default`, - { - headers, - }, - ); + group("Visit the homepage", () => { + res = http.get(`${BASE_URL}/default`, { + headers, + }); sleep(0.8); res = http.post( @@ -56,7 +53,7 @@ export default function main() { '[{"query":"\\n query storeConfig {\\n storeConfig {\\n store_code,\\n default_title,\\n store_name,\\n default_display_currency_code,\\n locale,\\n header_logo_src,\\n logo_width,\\n logo_height,\\n logo_alt\\n }\\n }\\n"}]', { headers, - }, + } ); executeCommonChecks(res); @@ -65,7 +62,7 @@ export default function main() { '[{"query":"\\n query getStoresAndCurrencies {\\n availableStores {\\n store_code\\n }\\n currency {\\n available_currency_codes\\n }\\n }\\n"}]', { headers, - }, + } ); executeCommonChecks(res); @@ -74,7 +71,7 @@ export default function main() { '[{"query":"\\n query getStoresAndCurrencies {\\n availableStores {\\n store_code\\n }\\n currency {\\n available_currency_codes\\n }\\n }\\n"}]', { headers, - }, + } ); executeCommonChecks(res); sleep(2.7); @@ -84,19 +81,15 @@ export default function main() { '[{"query":"\\n query categoryList {\\n categories {\\n items {\\n ...CategoryFields\\n children {\\n ...CategoryFields\\n children {\\n ...CategoryFields\\n children {\\n ...CategoryFields\\n }\\n }\\n }\\n }\\n }\\n }\\n \\n fragment CategoryFields on CategoryTree {\\n is_anchor\\n name\\n position\\n product_count\\n uid\\n url_path\\n url_suffix\\n include_in_menu\\n }\\n\\n"}]', { headers, - }, + } ); executeCommonChecks(res); }); - group('Select the a category', () => { - res = http.post( - `${BASE_URL}/api/magento/route`, - '["/women.html",null]', - { - headers, - }, - ); + group("Select the a category", () => { + res = http.post(`${BASE_URL}/api/magento/route`, '["/women.html",null]', { + headers, + }); executeCommonChecks(res); res = http.post( @@ -104,7 +97,7 @@ export default function main() { '[{"query":"\\n query categoryList {\\n categories {\\n items {\\n ...CategoryFields\\n children {\\n ...CategoryFields\\n children {\\n ...CategoryFields\\n children {\\n ...CategoryFields\\n }\\n }\\n }\\n }\\n }\\n }\\n \\n fragment CategoryFields on CategoryTree {\\n is_anchor\\n name\\n position\\n product_count\\n uid\\n url_path\\n url_suffix\\n include_in_menu\\n }\\n\\n"}]', { headers, - }, + } ); executeCommonChecks(res); @@ -113,17 +106,17 @@ export default function main() { '[{"query":"\\n query getCategoryContentData($filters: CategoryFilterInput) {\\n categoryList(filters: $filters) {\\n uid\\n display_mode\\n landing_page\\n cms_block {\\n identifier\\n content\\n }\\n }\\n }\\n","queryVariables":{"filters":{"category_uid":{"eq":"MjA="}}}}]', { headers, - }, + } ); executeCommonChecks(res); - [vars.uid1] = jsonpath.query(res.json(), '$.data.categoryList[0].uid'); + [vars.uid1] = jsonpath.query(res.json(), "$.data.categoryList[0].uid"); res = http.post( `${BASE_URL}/api/magento/customQuery`, `[{"query":"\\n query getFacetData($search: String = \\"\\", $filter: ProductAttributeFilterInput, $pageSize: Int = 10, $currentPage: Int = 1, $sort: ProductAttributeSortInput) {\\n products(search: $search, filter: $filter, pageSize: $pageSize, currentPage: $currentPage, sort: $sort) {\\n items {\\n __typename\\n uid\\n sku\\n name\\n stock_status\\n only_x_left_in_stock\\n thumbnail {\\n url\\n position\\n disabled\\n label\\n }\\n url_key\\n url_rewrites {\\n url\\n }\\n price_range {\\n maximum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n minimum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n }\\n }\\n page_info {\\n current_page\\n page_size\\n total_pages\\n }\\n total_count\\n }\\n }\\n","queryVariables":{"pageSize":10,"search":"","filter":{"category_uid":{"in":["${vars.uid1}"]}},"sort":{},"currentPage":1}}]`, { headers, - }, + } ); executeCommonChecks(res); sleep(0.5); @@ -133,19 +126,19 @@ export default function main() { `[{"query":"\\n query getProductFiltersByCategory($categoryIdFilter: FilterEqualTypeInput!) {\\n products(filter: { category_uid: $categoryIdFilter }) {\\n aggregations {\\n label\\n count\\n attribute_code\\n options {\\n count\\n label\\n value\\n __typename\\n }\\n position\\n __typename\\n }\\n __typename\\n }\\n }\\n","queryVariables":{"categoryIdFilter":{"eq":"${vars.uid1}"}}}]`, { headers, - }, + } ); executeCommonChecks(res); sleep(2.1); }); - group('configure the product', () => { + group("configure the product", () => { res = http.post( `${BASE_URL}/api/magento/productDetail`, '[{"filter":{"sku":{"eq":"WSH11"}},"configurations":[]},{"productDetail":"productDetail"}]', { headers, - }, + } ); executeCommonChecks(res); @@ -154,35 +147,23 @@ export default function main() { '[{"query":"\\n query getProductPriceBySku(\\n $filter: ProductAttributeFilterInput,\\n $configurations: [ID!]\\n ) {\\n products(filter: $filter) {\\n items {\\n price_range {\\n ...PriceRangeFields\\n }\\n\\n ... on ConfigurableProduct {\\n price_range {\\n maximum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n minimum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n }\\n\\n configurable_product_options_selection(configurableOptionValueUids: $configurations) {\\n options_available_for_selection {\\n attribute_code\\n option_value_uids\\n }\\n media_gallery {\\n disabled\\n label\\n position\\n url\\n }\\n variant {\\n uid\\n sku\\n name\\n price_range {\\n ...PriceRangeFields\\n }\\n }\\n }\\n }\\n\\n ... on BundleProduct {\\n items {\\n position\\n required\\n sku\\n title\\n type\\n uid\\n options {\\n can_change_quantity\\n is_default\\n position\\n uid\\n quantity\\n product {\\n uid\\n sku\\n name\\n price_range {\\n ...PriceRangeFields\\n }\\n }\\n }\\n }\\n }\\n\\n ... on GroupedProduct {\\n items {\\n position\\n qty\\n product {\\n uid\\n sku\\n name\\n stock_status\\n only_x_left_in_stock\\n price_range {\\n maximum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n minimum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n }\\n thumbnail {\\n url\\n position\\n disabled\\n label\\n }\\n }\\n }\\n }\\n\\n }\\n }\\n }\\n \\n fragment PriceRangeFields on PriceRange {\\n maximum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n minimum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n }\\n\\n","queryVariables":{"filter":{"sku":{"eq":"WSH11"}},"configurations":[]}}]', { headers, - }, + } ); executeCommonChecks(res); - res = http.post( - `${BASE_URL}/api/magento/upsellProducts`, - '[{"filter":{"sku":{"eq":"WSH11"}}},null]', - { - headers, - }, - ); + res = http.post(`${BASE_URL}/api/magento/upsellProducts`, '[{"filter":{"sku":{"eq":"WSH11"}}},null]', { + headers, + }); executeCommonChecks(res); - res = http.post( - `${BASE_URL}/api/magento/relatedProduct`, - '[{"filter":{"sku":{"eq":"WSH11"}}},null]', - { - headers, - }, - ); + res = http.post(`${BASE_URL}/api/magento/relatedProduct`, '[{"filter":{"sku":{"eq":"WSH11"}}},null]', { + headers, + }); executeCommonChecks(res); - res = http.post( - `${BASE_URL}/api/magento/productReviewRatingsMetadata`, - '[null]', - { - headers, - }, - ); + res = http.post(`${BASE_URL}/api/magento/productReviewRatingsMetadata`, "[null]", { + headers, + }); executeCommonChecks(res); sleep(1.1); @@ -191,18 +172,18 @@ export default function main() { '[{"query":"\\n query getProductPriceBySku(\\n $filter: ProductAttributeFilterInput,\\n $configurations: [ID!]\\n ) {\\n products(filter: $filter) {\\n items {\\n price_range {\\n ...PriceRangeFields\\n }\\n\\n ... on ConfigurableProduct {\\n price_range {\\n maximum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n minimum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n }\\n\\n configurable_product_options_selection(configurableOptionValueUids: $configurations) {\\n options_available_for_selection {\\n attribute_code\\n option_value_uids\\n }\\n media_gallery {\\n disabled\\n label\\n position\\n url\\n }\\n variant {\\n uid\\n sku\\n name\\n price_range {\\n ...PriceRangeFields\\n }\\n }\\n }\\n }\\n\\n ... on BundleProduct {\\n items {\\n position\\n required\\n sku\\n title\\n type\\n uid\\n options {\\n can_change_quantity\\n is_default\\n position\\n uid\\n quantity\\n product {\\n uid\\n sku\\n name\\n price_range {\\n ...PriceRangeFields\\n }\\n }\\n }\\n }\\n }\\n\\n ... on GroupedProduct {\\n items {\\n position\\n qty\\n product {\\n uid\\n sku\\n name\\n stock_status\\n only_x_left_in_stock\\n price_range {\\n maximum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n minimum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n }\\n thumbnail {\\n url\\n position\\n disabled\\n label\\n }\\n }\\n }\\n }\\n\\n }\\n }\\n }\\n \\n fragment PriceRangeFields on PriceRange {\\n maximum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n minimum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n }\\n\\n","queryVariables":{"filter":{"sku":{"eq":"WSH11"}},"configurations":["Y29uZmlndXJhYmxlLzkzLzU4"]}}]', { headers, - }, + } ); executeCommonChecks(res); [vars.index01] = jsonpath.query( res.json(), - '$.data.products.items[0].configurable_product_options_selection.options_available_for_selection[1].option_value_uids[0]', + "$.data.products.items[0].configurable_product_options_selection.options_available_for_selection[1].option_value_uids[0]" ); [vars.index11] = jsonpath.query( res.json(), - '$.data.products.items[0].configurable_product_options_selection.options_available_for_selection[0].option_value_uids[1]', + "$.data.products.items[0].configurable_product_options_selection.options_available_for_selection[0].option_value_uids[1]" ); sleep(1.6); @@ -212,34 +193,23 @@ export default function main() { `[{"query":"\\n query getProductPriceBySku(\\n $filter: ProductAttributeFilterInput,\\n $configurations: [ID!]\\n ) {\\n products(filter: $filter) {\\n items {\\n price_range {\\n ...PriceRangeFields\\n }\\n\\n ... on ConfigurableProduct {\\n price_range {\\n maximum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n minimum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n }\\n\\n configurable_product_options_selection(configurableOptionValueUids: $configurations) {\\n options_available_for_selection {\\n attribute_code\\n option_value_uids\\n }\\n media_gallery {\\n disabled\\n label\\n position\\n url\\n }\\n variant {\\n uid\\n sku\\n name\\n price_range {\\n ...PriceRangeFields\\n }\\n }\\n }\\n }\\n\\n ... on BundleProduct {\\n items {\\n position\\n required\\n sku\\n title\\n type\\n uid\\n options {\\n can_change_quantity\\n is_default\\n position\\n uid\\n quantity\\n product {\\n uid\\n sku\\n name\\n price_range {\\n ...PriceRangeFields\\n }\\n }\\n }\\n }\\n }\\n\\n ... on GroupedProduct {\\n items {\\n position\\n qty\\n product {\\n uid\\n sku\\n name\\n stock_status\\n only_x_left_in_stock\\n price_range {\\n maximum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n minimum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n }\\n thumbnail {\\n url\\n position\\n disabled\\n label\\n }\\n }\\n }\\n }\\n\\n }\\n }\\n }\\n \\n fragment PriceRangeFields on PriceRange {\\n maximum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n minimum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n }\\n\\n","queryVariables":{"filter":{"sku":{"eq":"WSH11"}},"configurations":["${vars.index01}","${vars.index11}"]}}]`, { headers, - }, + } ); executeCommonChecks(res); sleep(0.5); }); - group('Add product to the cart', () => { - res = http.post( - `${BASE_URL}/api/magento/createEmptyCart`, - '[]', - { - headers, - }, - ); + group("Add product to the cart", () => { + res = http.post(`${BASE_URL}/api/magento/createEmptyCart`, "[]", { + headers, + }); executeCommonChecks(res); - [vars.cart_id] = jsonpath.query( - res.json(), - '$.data.createEmptyCart', - ); + [vars.cart_id] = jsonpath.query(res.json(), "$.data.createEmptyCart"); - res = http.post( - `${BASE_URL}/api/magento/cart`, - `["${vars.cart_id}"]`, - { - headers, - }, - ); + res = http.post(`${BASE_URL}/api/magento/cart`, `["${vars.cart_id}"]`, { + headers, + }); executeCommonChecks(res); res = http.post( @@ -247,67 +217,43 @@ export default function main() { `[{"cartId":"${vars.cart_id}","cartItems":[{"quantity":1,"sku":"WSH11","selected_options":["${vars.index01}","${vars.index11}"]}]},null]`, { headers, - }, + } ); executeCommonChecks(res); sleep(3); }); - group('Go through the checkout', () => { - res = http.post( - `${BASE_URL}/api/magento/cart`, - `["${vars.cart_id}"]`, - { - headers, - }, - ); + group("Go through the checkout", () => { + res = http.post(`${BASE_URL}/api/magento/cart`, `["${vars.cart_id}"]`, { + headers, + }); executeCommonChecks(res); sleep(5.3); - res = http.post( - `${BASE_URL}/api/magento/setGuestEmailOnCart`, - `[{"email":"john.loadtest@gmail.com","cart_id":"${vars.cart_id}"},null]`, - { - headers, - }, - ); + res = http.post(`${BASE_URL}/api/magento/setGuestEmailOnCart`, `[{"email":"john.loadtest@gmail.com","cart_id":"${vars.cart_id}"},null]`, { + headers, + }); executeCommonChecks(res); - res = http.post( - `${BASE_URL}/api/magento/cart`, - `["${vars.cart_id}"]`, - { - headers, - }, - ); + res = http.post(`${BASE_URL}/api/magento/cart`, `["${vars.cart_id}"]`, { + headers, + }); executeCommonChecks(res); - res = http.post( - `${BASE_URL}/api/magento/cart`, - `["${vars.cart_id}"]`, - { - headers, - }, - ); + res = http.post(`${BASE_URL}/api/magento/cart`, `["${vars.cart_id}"]`, { + headers, + }); executeCommonChecks(res); - res = http.post( - `${BASE_URL}/api/magento/countries`, - '[]', - { - headers, - }, - ); + res = http.post(`${BASE_URL}/api/magento/countries`, "[]", { + headers, + }); executeCommonChecks(res); sleep(2.2); - res = http.post( - `${BASE_URL}/api/magento/country`, - '["PL",null]', - { - headers, - }, - ); + res = http.post(`${BASE_URL}/api/magento/country`, '["PL",null]', { + headers, + }); executeCommonChecks(res); sleep(3.9); @@ -316,7 +262,7 @@ export default function main() { `[{"cart_id":"${vars.cart_id}","shipping_addresses":[{"address":{"firstname":"john","lastname":"LoadTest","street":["Load Test 11","11"],"city":"Load Test","region":"PL-10","country_code":"PL","postcode":"11-111","telephone":"123123123","save_in_address_book":false}}]}]`, { headers, - }, + } ); executeCommonChecks(res); sleep(1.6); @@ -326,54 +272,34 @@ export default function main() { `[{"cart_id":"${vars.cart_id}","shipping_methods":[{"carrier_code":"flatrate","method_code":"flatrate"}]},null]`, { headers, - }, + } ); executeCommonChecks(res); sleep(1.3); - res = http.post( - `${BASE_URL}/api/magento/cart`, - `["${vars.cart_id}"]`, - { - headers, - }, - ); + res = http.post(`${BASE_URL}/api/magento/cart`, `["${vars.cart_id}"]`, { + headers, + }); executeCommonChecks(res); - res = http.post( - `${BASE_URL}/api/magento/cart`, - `["${vars.cart_id}"]`, - { - headers, - }, - ); + res = http.post(`${BASE_URL}/api/magento/cart`, `["${vars.cart_id}"]`, { + headers, + }); executeCommonChecks(res); - res = http.post( - `${BASE_URL}/api/magento/countries`, - '[]', - { - headers, - }, - ); + res = http.post(`${BASE_URL}/api/magento/countries`, "[]", { + headers, + }); executeCommonChecks(res); sleep(1.7); - res = http.post( - `${BASE_URL}/api/magento/country`, - '["PL",null]', - { - headers, - }, - ); + res = http.post(`${BASE_URL}/api/magento/country`, '["PL",null]', { + headers, + }); - res = http.post( - `${BASE_URL}/api/magento/country`, - '["PL",null]', - { - headers, - }, - ); + res = http.post(`${BASE_URL}/api/magento/country`, '["PL",null]', { + headers, + }); executeCommonChecks(res); sleep(1.4); @@ -382,7 +308,7 @@ export default function main() { `[{"cart_id":"${vars.cart_id}","billing_address":{"address":{"firstname":"john","lastname":"LoadTest","street":["Load Test 11","11"],"city":"Load Test","region":"PL-10","country_code":"PL","postcode":"11-111","telephone":"123123123","save_in_address_book":false},"same_as_shipping":true}},null]`, { headers, - }, + } ); executeCommonChecks(res); @@ -391,57 +317,37 @@ export default function main() { `[{"cart_id":"${vars.cart_id}","shipping_methods":[{"carrier_code":"flatrate","method_code":"flatrate"}]},null]`, { headers, - }, + } ); executeCommonChecks(res); sleep(0.5); - res = http.post( - `${BASE_URL}/api/magento/cart`, - `["${vars.cart_id}"]`, - { - headers, - }, - ); + res = http.post(`${BASE_URL}/api/magento/cart`, `["${vars.cart_id}"]`, { + headers, + }); - res = http.post( - `${BASE_URL}/api/magento/cart`, - `["${vars.cart_id}"]`, - { - headers, - }, - ); + res = http.post(`${BASE_URL}/api/magento/cart`, `["${vars.cart_id}"]`, { + headers, + }); executeCommonChecks(res); - res = http.post( - `${BASE_URL}/api/magento/getAvailablePaymentMethods`, - `[{"cartId":"${vars.cart_id}"},null]`, - { - headers, - }, - ); + res = http.post(`${BASE_URL}/api/magento/getAvailablePaymentMethods`, `[{"cartId":"${vars.cart_id}"},null]`, { + headers, + }); executeCommonChecks(res); sleep(1.2); - res = http.post( - `${BASE_URL}/api/magento/setPaymentMethodOnCart`, - `[{"cart_id":"${vars.cart_id}","payment_method":{"code":"checkmo"}},null]`, - { - headers, - }, - ); + res = http.post(`${BASE_URL}/api/magento/setPaymentMethodOnCart`, `[{"cart_id":"${vars.cart_id}","payment_method":{"code":"checkmo"}},null]`, { + headers, + }); executeCommonChecks(res); sleep(1.5); }); - group('Place the order', () => { - res = http.post( - `${BASE_URL}/api/magento/placeOrder`, - `[{"cart_id":"${vars.cart_id}"},null]`, - { - headers, - }, - ); + group("Place the order", () => { + res = http.post(`${BASE_URL}/api/magento/placeOrder`, `[{"cart_id":"${vars.cart_id}"},null]`, { + headers, + }); executeCommonChecks(res); }); }); diff --git a/packages/load-tests/src/tests/scenarios/newUserRegistration.js b/packages/load-tests/src/tests/scenarios/newUserRegistration.js index d35bf8c53..1f96e783e 100644 --- a/packages/load-tests/src/tests/scenarios/newUserRegistration.js +++ b/packages/load-tests/src/tests/scenarios/newUserRegistration.js @@ -1,36 +1,36 @@ // Creator: k6 Browser Recorder 0.6.2 -import { check, sleep, group } from 'k6'; -import http from 'k6/http'; -import { setDefaultCookies } from './utils/setDefaultCookies.js'; -import { customerData } from '../../utils/customerData.js'; +import { check, sleep, group } from "k6"; +import http from "k6/http"; +import { setDefaultCookies } from "./utils/setDefaultCookies.js"; +import { customerData } from "../../utils/customerData.js"; export const options = { vus: 200, - duration: '5m', + duration: "5m", thresholds: { - http_req_failed: ['rate<0.01'], // http errors should be less than 1% + http_req_failed: ["rate<0.01"], // http errors should be less than 1% }, }; const { BASE_URL } = __ENV; if (BASE_URL === undefined) { - throw new Error('BASE_URL is not set'); + throw new Error("BASE_URL is not set"); } const headers = { - accept: 'application/json, text/plain, */*', - 'content-type': 'application/json', - 'upgrade-insecure-requests': '1', - 'sec-ch-ua': '".Not/A)Brand";v="99", "Google Chrome";v="103", "Chromium";v="103"', - 'sec-ch-ua-mobile': '?0', - 'sec-ch-ua-platform': '"macOS"', + accept: "application/json, text/plain, */*", + "content-type": "application/json", + "upgrade-insecure-requests": "1", + "sec-ch-ua": '".Not/A)Brand";v="99", "Google Chrome";v="103", "Chromium";v="103"', + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": '"macOS"', }; const executeCommonChecks = (res) => { check(res, { - 'is status 200': (r) => r.status === 200, - 'has no errors': (r) => !r.json().errors, + "is status 200": (r) => r.status === 200, + "has no errors": (r) => !r.json().errors, }); }; @@ -38,58 +38,52 @@ export default function main() { let res; setDefaultCookies(BASE_URL); - group( - `New user registration - page ${BASE_URL}`, - () => { - res = http.get( - `${BASE_URL}/default`, + group(`New user registration - page ${BASE_URL}`, () => { + res = http.get(`${BASE_URL}/default`, { + headers, + }); + sleep(0.6); + + group("Input user data", () => { + res = http.post( + `${BASE_URL}/api/magento/customQuery`, + '[{"query":"\\n query storeConfig {\\n storeConfig {\\n store_code,\\n default_title,\\n store_name,\\n default_display_currency_code,\\n locale,\\n header_logo_src,\\n logo_width,\\n logo_height,\\n logo_alt\\n }\\n }\\n"}]', { headers, - }, + } ); - sleep(0.6); - - group('Input user data', () => { - res = http.post( - `${BASE_URL}/api/magento/customQuery`, - '[{"query":"\\n query storeConfig {\\n storeConfig {\\n store_code,\\n default_title,\\n store_name,\\n default_display_currency_code,\\n locale,\\n header_logo_src,\\n logo_width,\\n logo_height,\\n logo_alt\\n }\\n }\\n"}]', - { - headers, - }, - ); - executeCommonChecks(res); + executeCommonChecks(res); - res = http.post( - `${BASE_URL}/api/magento/customQuery`, - '[{"query":"\\n query getStoresAndCurrencies {\\n availableStores {\\n store_code\\n }\\n currency {\\n available_currency_codes\\n }\\n }\\n"}]', - { - headers, - }, - ); - executeCommonChecks(res); + res = http.post( + `${BASE_URL}/api/magento/customQuery`, + '[{"query":"\\n query getStoresAndCurrencies {\\n availableStores {\\n store_code\\n }\\n currency {\\n available_currency_codes\\n }\\n }\\n"}]', + { + headers, + } + ); + executeCommonChecks(res); - res = http.post( - `${BASE_URL}/api/magento/customQuery`, - '[{"query":"\\n query getStoresAndCurrencies {\\n availableStores {\\n store_code\\n }\\n currency {\\n available_currency_codes\\n }\\n }\\n"}]', - { - headers, - }, - ); - executeCommonChecks(res); - sleep(8); - }); + res = http.post( + `${BASE_URL}/api/magento/customQuery`, + '[{"query":"\\n query getStoresAndCurrencies {\\n availableStores {\\n store_code\\n }\\n currency {\\n available_currency_codes\\n }\\n }\\n"}]', + { + headers, + } + ); + executeCommonChecks(res); + sleep(8); + }); - group('Save new user', () => { - res = http.post( - `${BASE_URL}/api/magento/createCustomer`, - `[{"email":"${customerData.getEmail()}","password":"Admin123!","recaptchaToken":"recaptcha_bypass_code","firstname":"load","lastname":"test","is_subscribed":false},{}]`, - { - headers, - }, - ); - }); + group("Save new user", () => { + res = http.post( + `${BASE_URL}/api/magento/createCustomer`, + `[{"email":"${customerData.getEmail()}","password":"Admin123!","recaptchaToken":"recaptcha_bypass_code","firstname":"load","lastname":"test","is_subscribed":false},{}]`, + { + headers, + } + ); + }); - executeCommonChecks(res); - }, - ); + executeCommonChecks(res); + }); } diff --git a/packages/load-tests/src/tests/scenarios/searchProduct.js b/packages/load-tests/src/tests/scenarios/searchProduct.js index 00137f70a..688cfa1ac 100644 --- a/packages/load-tests/src/tests/scenarios/searchProduct.js +++ b/packages/load-tests/src/tests/scenarios/searchProduct.js @@ -1,37 +1,37 @@ // Creator: k6 Browser Recorder 0.6.2 -import { check, sleep, group } from 'k6'; -import http from 'k6/http'; -import { setDefaultCookies } from './utils/setDefaultCookies.js'; +import { check, sleep, group } from "k6"; +import http from "k6/http"; +import { setDefaultCookies } from "./utils/setDefaultCookies.js"; export const options = { vus: 200, - duration: '5m', + duration: "5m", thresholds: { - http_req_failed: ['rate<0.01'], // http errors should be less than 1% - http_req_duration: ['p(80)<250'], // 80% of requests should be below 250ms + http_req_failed: ["rate<0.01"], // http errors should be less than 1% + http_req_duration: ["p(80)<250"], // 80% of requests should be below 250ms }, }; const { BASE_URL } = __ENV; if (BASE_URL === undefined) { - throw new Error('BASE_URL is not set'); + throw new Error("BASE_URL is not set"); } const headers = { - accept: 'application/json, text/plain, */*', - 'content-type': 'application/json', - 'upgrade-insecure-requests': '1', - 'sec-ch-ua': '".Not/A)Brand";v="99", "Google Chrome";v="103", "Chromium";v="103"', - 'sec-ch-ua-mobile': '?0', - 'sec-ch-ua-platform': '"macOS"', + accept: "application/json, text/plain, */*", + "content-type": "application/json", + "upgrade-insecure-requests": "1", + "sec-ch-ua": '".Not/A)Brand";v="99", "Google Chrome";v="103", "Chromium";v="103"', + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": '"macOS"', }; const executeCommonChecks = (res) => { check(res, { - 'is status 200': (r) => r.status === 200, - 'has no errors': (r) => !r.json().errors, + "is status 200": (r) => r.status === 200, + "has no errors": (r) => !r.json().errors, }); }; @@ -39,87 +39,65 @@ export default function main() { let res; setDefaultCookies(BASE_URL); - group( - `Search Product - page ${BASE_URL}`, - () => { - group('Visit the homepage', () => { - res = http.get( - `${BASE_URL}/default`, - { headers }, - ); - check(res, { - 'is status 200': (r) => r.status === 200, - }); - - res = http.post( - `${BASE_URL}/api/magento/customQuery`, - '[{"query":"\\n query storeConfig {\\n storeConfig {\\n store_code,\\n default_title,\\n store_name,\\n default_display_currency_code,\\n locale,\\n header_logo_src,\\n logo_width,\\n logo_height,\\n logo_alt\\n }\\n }\\n"}]', - { headers }, - ); - executeCommonChecks(res); - - res = http.post( - `${BASE_URL}/api/magento/customQuery`, - '[{"query":"\\n query getStoresAndCurrencies {\\n availableStores {\\n store_code\\n }\\n currency {\\n available_currency_codes\\n }\\n }\\n"}]', - { headers }, - ); - executeCommonChecks(res); - - res = http.post( - `${BASE_URL}/api/magento/customQuery`, - '[{"query":"\\n query getStoresAndCurrencies {\\n availableStores {\\n store_code\\n }\\n currency {\\n available_currency_codes\\n }\\n }\\n"}]', - { headers }, - ); - executeCommonChecks(res); - sleep(4.1); + group(`Search Product - page ${BASE_URL}`, () => { + group("Visit the homepage", () => { + res = http.get(`${BASE_URL}/default`, { headers }); + check(res, { + "is status 200": (r) => r.status === 200, }); - group('Search for a product', () => { - res = http.post( - `${BASE_URL}/api/magento/products`, - '[{"pageSize":12,"search":"erika"},{"products":"products"}]', - { headers }, - ); - executeCommonChecks(res); - sleep(1.9); - }); - - group('Visit the found product', () => { - res = http.post( - `${BASE_URL}/api/magento/productDetail`, - '[{"filter":{"sku":{"eq":"WSH12"}},"configurations":[]},{"productDetail":"productDetail"}]', - { headers }, - ); - executeCommonChecks(res); - - res = http.post( - `${BASE_URL}/api/magento/customQuery`, - '[{"query":"\\n query getProductPriceBySku(\\n $filter: ProductAttributeFilterInput,\\n $configurations: [ID!]\\n ) {\\n products(filter: $filter) {\\n items {\\n price_range {\\n ...PriceRangeFields\\n }\\n\\n ... on ConfigurableProduct {\\n price_range {\\n maximum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n minimum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n }\\n\\n configurable_product_options_selection(configurableOptionValueUids: $configurations) {\\n options_available_for_selection {\\n attribute_code\\n option_value_uids\\n }\\n media_gallery {\\n disabled\\n label\\n position\\n url\\n }\\n variant {\\n uid\\n sku\\n name\\n price_range {\\n ...PriceRangeFields\\n }\\n }\\n }\\n }\\n\\n ... on BundleProduct {\\n items {\\n position\\n required\\n sku\\n title\\n type\\n uid\\n options {\\n can_change_quantity\\n is_default\\n position\\n uid\\n quantity\\n product {\\n uid\\n sku\\n name\\n price_range {\\n ...PriceRangeFields\\n }\\n }\\n }\\n }\\n }\\n\\n ... on GroupedProduct {\\n items {\\n position\\n qty\\n product {\\n uid\\n sku\\n name\\n stock_status\\n only_x_left_in_stock\\n price_range {\\n maximum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n minimum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n }\\n thumbnail {\\n url\\n position\\n disabled\\n label\\n }\\n }\\n }\\n }\\n\\n }\\n }\\n }\\n \\n fragment PriceRangeFields on PriceRange {\\n maximum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n minimum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n }\\n\\n","queryVariables":{"filter":{"sku":{"eq":"WSH12"}},"configurations":[]}}]', - { headers }, - ); - executeCommonChecks(res); - - res = http.post( - `${BASE_URL}/api/magento/relatedProduct`, - '[{"filter":{"sku":{"eq":"WSH12"}}},null]', - { headers }, - ); - executeCommonChecks(res); - - res = http.post( - `${BASE_URL}/api/magento/upsellProducts`, - '[{"filter":{"sku":{"eq":"WSH12"}}},null]', - { headers }, - ); - executeCommonChecks(res); - - res = http.post( - `${BASE_URL}/api/magento/productReviewRatingsMetadata`, - '[null]', - { headers }, - ); - executeCommonChecks(res); - }); - }, - ); + res = http.post( + `${BASE_URL}/api/magento/customQuery`, + '[{"query":"\\n query storeConfig {\\n storeConfig {\\n store_code,\\n default_title,\\n store_name,\\n default_display_currency_code,\\n locale,\\n header_logo_src,\\n logo_width,\\n logo_height,\\n logo_alt\\n }\\n }\\n"}]', + { headers } + ); + executeCommonChecks(res); + + res = http.post( + `${BASE_URL}/api/magento/customQuery`, + '[{"query":"\\n query getStoresAndCurrencies {\\n availableStores {\\n store_code\\n }\\n currency {\\n available_currency_codes\\n }\\n }\\n"}]', + { headers } + ); + executeCommonChecks(res); + + res = http.post( + `${BASE_URL}/api/magento/customQuery`, + '[{"query":"\\n query getStoresAndCurrencies {\\n availableStores {\\n store_code\\n }\\n currency {\\n available_currency_codes\\n }\\n }\\n"}]', + { headers } + ); + executeCommonChecks(res); + sleep(4.1); + }); + + group("Search for a product", () => { + res = http.post(`${BASE_URL}/api/magento/products`, '[{"pageSize":12,"search":"erika"},{"products":"products"}]', { headers }); + executeCommonChecks(res); + sleep(1.9); + }); + + group("Visit the found product", () => { + res = http.post( + `${BASE_URL}/api/magento/productDetail`, + '[{"filter":{"sku":{"eq":"WSH12"}},"configurations":[]},{"productDetail":"productDetail"}]', + { headers } + ); + executeCommonChecks(res); + + res = http.post( + `${BASE_URL}/api/magento/customQuery`, + '[{"query":"\\n query getProductPriceBySku(\\n $filter: ProductAttributeFilterInput,\\n $configurations: [ID!]\\n ) {\\n products(filter: $filter) {\\n items {\\n price_range {\\n ...PriceRangeFields\\n }\\n\\n ... on ConfigurableProduct {\\n price_range {\\n maximum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n minimum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n }\\n\\n configurable_product_options_selection(configurableOptionValueUids: $configurations) {\\n options_available_for_selection {\\n attribute_code\\n option_value_uids\\n }\\n media_gallery {\\n disabled\\n label\\n position\\n url\\n }\\n variant {\\n uid\\n sku\\n name\\n price_range {\\n ...PriceRangeFields\\n }\\n }\\n }\\n }\\n\\n ... on BundleProduct {\\n items {\\n position\\n required\\n sku\\n title\\n type\\n uid\\n options {\\n can_change_quantity\\n is_default\\n position\\n uid\\n quantity\\n product {\\n uid\\n sku\\n name\\n price_range {\\n ...PriceRangeFields\\n }\\n }\\n }\\n }\\n }\\n\\n ... on GroupedProduct {\\n items {\\n position\\n qty\\n product {\\n uid\\n sku\\n name\\n stock_status\\n only_x_left_in_stock\\n price_range {\\n maximum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n minimum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n }\\n thumbnail {\\n url\\n position\\n disabled\\n label\\n }\\n }\\n }\\n }\\n\\n }\\n }\\n }\\n \\n fragment PriceRangeFields on PriceRange {\\n maximum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n minimum_price {\\n final_price {\\n currency\\n value\\n }\\n regular_price {\\n currency\\n value\\n }\\n }\\n }\\n\\n","queryVariables":{"filter":{"sku":{"eq":"WSH12"}},"configurations":[]}}]', + { headers } + ); + executeCommonChecks(res); + + res = http.post(`${BASE_URL}/api/magento/relatedProduct`, '[{"filter":{"sku":{"eq":"WSH12"}}},null]', { headers }); + executeCommonChecks(res); + + res = http.post(`${BASE_URL}/api/magento/upsellProducts`, '[{"filter":{"sku":{"eq":"WSH12"}}},null]', { headers }); + executeCommonChecks(res); + + res = http.post(`${BASE_URL}/api/magento/productReviewRatingsMetadata`, "[null]", { headers }); + executeCommonChecks(res); + }); + }); } diff --git a/packages/load-tests/src/utils/customerData.js b/packages/load-tests/src/utils/customerData.js index 59ed2defb..aa8cde37a 100644 --- a/packages/load-tests/src/utils/customerData.js +++ b/packages/load-tests/src/utils/customerData.js @@ -1,7 +1,7 @@ -const chars = 'abcdefghijklmnopqrstuvwxyz1234567890'; +const chars = "abcdefghijklmnopqrstuvwxyz1234567890"; export const getEmail = (length = 15) => { - let string = ''; + let string = ""; for (let i = 0; i < length; i++) { string += chars[Math.floor(Math.random() * chars.length)]; } diff --git a/packages/load-tests/src/utils/getCookies.js b/packages/load-tests/src/utils/getCookies.js index fefd5d14f..c5be5c758 100644 --- a/packages/load-tests/src/utils/getCookies.js +++ b/packages/load-tests/src/utils/getCookies.js @@ -1,7 +1,7 @@ const getCookies = () => ({ - 'vsf-store': 'default', - 'vsf-locale': 'default', - 'vsf-currency': 'USD', + "vsf-store": "default", + "vsf-locale": "default", + "vsf-currency": "USD", }); export default getCookies; diff --git a/packages/method-bootstrapper/file-operations.js b/packages/method-bootstrapper/file-operations.js index bd0045e1f..61779bb76 100644 --- a/packages/method-bootstrapper/file-operations.js +++ b/packages/method-bootstrapper/file-operations.js @@ -1,9 +1,9 @@ // This file contains functions that modify files in such a way that add a new SDK method -const fsPromises = require('fs/promises'); -const path = require('path'); -const handlebars = require('handlebars'); -const utils = require('./utils'); +const fsPromises = require("fs/promises"); +const path = require("path"); +const handlebars = require("handlebars"); +const utils = require("./utils"); /** * Creates 'src/methods/methodName/index.ts' with partially filled out content @@ -14,22 +14,13 @@ const utils = require('./utils'); * @param {string} methodName Name of the method to create */ module.exports.createMethodImplementationFile = async (methodsDirectoryPath, methodName) => { - console.info('Creating method folder'); + console.info("Creating method folder"); const methodFolderPath = path.join(methodsDirectoryPath, methodName); - await fsPromises.mkdir( - methodFolderPath, - ); + await fsPromises.mkdir(methodFolderPath); const template = handlebars.compile( - await fsPromises.readFile( - path.join( - __dirname, - 'handlebars-templates', - 'method-implementation-file.handlebars', - ), - { encoding: 'utf8' }, - ), + await fsPromises.readFile(path.join(__dirname, "handlebars-templates", "method-implementation-file.handlebars"), { encoding: "utf8" }) ); const contents = template({ @@ -38,11 +29,8 @@ module.exports.createMethodImplementationFile = async (methodsDirectoryPath, met capitalizedMethodName: utils.capitalize(methodName), }); - console.info('Creating method implementation file'); - await fsPromises.writeFile( - path.join(methodFolderPath, 'index.ts'), - contents, - ); + console.info("Creating method implementation file"); + await fsPromises.writeFile(path.join(methodFolderPath, "index.ts"), contents); }; /** @@ -51,11 +39,8 @@ module.exports.createMethodImplementationFile = async (methodsDirectoryPath, met * @param {string} methodName */ module.exports.patchMethodIndexFile = async (methodsDirectoryPath, methodName) => { - console.info('Adding method export to methods index.ts'); - await fsPromises.appendFile( - path.join(methodsDirectoryPath, 'index.ts'), - `export { ${methodName} } from './${methodName}';`, - ); + console.info("Adding method export to methods index.ts"); + await fsPromises.appendFile(path.join(methodsDirectoryPath, "index.ts"), `export { ${methodName} } from './${methodName}';`); }; /** @@ -68,14 +53,7 @@ module.exports.patchMethodIndexFile = async (methodsDirectoryPath, methodName) = */ module.exports.createMethodIntegrationTestFile = async (integrationTestDirectoryPath, methodName) => { const template = handlebars.compile( - await fsPromises.readFile( - path.join( - __dirname, - 'handlebars-templates', - 'method-integration-test-file.handlebars', - ), - { encoding: 'utf8' }, - ), + await fsPromises.readFile(path.join(__dirname, "handlebars-templates", "method-integration-test-file.handlebars"), { encoding: "utf8" }) ); const contents = template({ @@ -84,11 +62,8 @@ module.exports.createMethodIntegrationTestFile = async (integrationTestDirectory capitalizedMethodName: utils.capitalize(methodName), }); - console.info('Creating method integration test file'); - await fsPromises.writeFile( - path.join(integrationTestDirectoryPath, `${methodName}.integration.spec.ts`), - contents, - ); + console.info("Creating method integration test file"); + await fsPromises.writeFile(path.join(integrationTestDirectoryPath, `${methodName}.integration.spec.ts`), contents); }; /** @@ -101,14 +76,7 @@ module.exports.createMethodIntegrationTestFile = async (integrationTestDirectory */ module.exports.createMethodUnitTestFile = async (unitTestDirectoryPath, methodName) => { const template = handlebars.compile( - await fsPromises.readFile( - path.join( - __dirname, - 'handlebars-templates', - 'method-unit-test-file.handlebars', - ), - { encoding: 'utf8' }, - ), + await fsPromises.readFile(path.join(__dirname, "handlebars-templates", "method-unit-test-file.handlebars"), { encoding: "utf8" }) ); const contents = template({ @@ -117,11 +85,8 @@ module.exports.createMethodUnitTestFile = async (unitTestDirectoryPath, methodNa capitalizedMethodName: utils.capitalize(methodName), }); - console.info('Creating method unit test file'); - await fsPromises.writeFile( - path.join(unitTestDirectoryPath, `${methodName}.unit.spec.ts`), - contents, - ); + console.info("Creating method unit test file"); + await fsPromises.writeFile(path.join(unitTestDirectoryPath, `${methodName}.unit.spec.ts`), contents); }; /** @@ -133,22 +98,12 @@ module.exports.createMethodUnitTestFile = async (unitTestDirectoryPath, methodNa * @param {string} methodName */ module.exports.createMethodCustomQueryFile = async (customQueriesDirectoryPath, methodName) => { - const newCustomQueryFolderPath = path.join( - customQueriesDirectoryPath, - methodName, - ); + const newCustomQueryFolderPath = path.join(customQueriesDirectoryPath, methodName); await fsPromises.mkdir(newCustomQueryFolderPath); const template = handlebars.compile( - await fsPromises.readFile( - path.join( - __dirname, - 'handlebars-templates', - 'method-custom-query-file.handlebars', - ), - { encoding: 'utf8' }, - ), + await fsPromises.readFile(path.join(__dirname, "handlebars-templates", "method-custom-query-file.handlebars"), { encoding: "utf8" }) ); const contents = template({ @@ -157,11 +112,8 @@ module.exports.createMethodCustomQueryFile = async (customQueriesDirectoryPath, capitalizedMethodName: utils.capitalize(methodName), }); - console.info('Creating method custom query file'); - await fsPromises.writeFile( - path.join(newCustomQueryFolderPath, 'index.ts'), - contents, - ); + console.info("Creating method custom query file"); + await fsPromises.writeFile(path.join(newCustomQueryFolderPath, "index.ts"), contents); }; /** @@ -175,21 +127,21 @@ module.exports.createMethodCustomQueryFile = async (customQueriesDirectoryPath, * We need to read the file, modify its contents, then write to it again */ module.exports.patchCustomQueriesIndexFile = async (customQueriesDirectoryPath, methodName) => { - console.info('Adding customQuery export to jest.customQueries.ts'); + console.info("Adding customQuery export to jest.customQueries.ts"); - const customQueriesIndexFile = path.join(customQueriesDirectoryPath, 'jest.customQueries.ts'); + const customQueriesIndexFile = path.join(customQueriesDirectoryPath, "jest.customQueries.ts"); - const contents = await fsPromises.readFile(customQueriesIndexFile, { encoding: 'utf8' }); + const contents = await fsPromises.readFile(customQueriesIndexFile, { encoding: "utf8" }); /** * @param {string} fileContents Contents of the `jest.customQueries.ts` file */ const addNewCustomQuery = (fileContents) => { // like findIndex, but starts looking from the end of the array - const customQueriesObjectClosingBraceIndex = fileContents.lastIndexOf('}'); + const customQueriesObjectClosingBraceIndex = fileContents.lastIndexOf("}"); if (customQueriesObjectClosingBraceIndex === -1) { - throw new Error('Couldn\'t find closing brace in jest.customQueries.ts'); + throw new Error("Couldn't find closing brace in jest.customQueries.ts"); } const result = [...fileContents]; @@ -202,9 +154,9 @@ module.exports.patchCustomQueriesIndexFile = async (customQueriesDirectoryPath, // replace 0 array items (append only) ... 0, // add the following contents - ...`,\n '${utils.kebabize(methodName)}-custom-query': ${methodName}`, + ...`,\n '${utils.kebabize(methodName)}-custom-query': ${methodName}` ) - .join(''); + .join(""); result.unshift(`import { ${methodName} } from './${methodName}';\n`); @@ -213,6 +165,6 @@ module.exports.patchCustomQueriesIndexFile = async (customQueriesDirectoryPath, const newContents = addNewCustomQuery(contents); - console.info('Patching jest.customQueries.ts'); + console.info("Patching jest.customQueries.ts"); await fsPromises.writeFile(customQueriesIndexFile, newContents); }; diff --git a/packages/method-bootstrapper/index.js b/packages/method-bootstrapper/index.js index 6c442b7fa..455b7bbc9 100755 --- a/packages/method-bootstrapper/index.js +++ b/packages/method-bootstrapper/index.js @@ -1,7 +1,7 @@ #!/usr/bin/env node -const fsPromises = require('fs/promises'); -const path = require('path'); -const fileOperations = require('./file-operations'); +const fsPromises = require("fs/promises"); +const path = require("path"); +const fileOperations = require("./file-operations"); // Use IIFE for "top level await", because regular top level await is not present in raw node 16 // eslint-disable-next-line unicorn/prefer-top-level-await @@ -9,28 +9,25 @@ const fileOperations = require('./file-operations'); const methodName = process.argv[2]; if (!methodName) { - console.error('\nerror: method name missing\nusage: npx mkmethod [method name]\n'); + console.error("\nerror: method name missing\nusage: npx mkmethod [method name]\n"); return; } const folderWhereTheCommandWasRanIn = process.cwd(); const folders = { - testIntegrations: path.join(folderWhereTheCommandWasRanIn, '__tests__', 'integration'), - testUnit: path.join(folderWhereTheCommandWasRanIn, '__tests__', 'unit'), - methods: path.join(folderWhereTheCommandWasRanIn, 'src', 'methods'), - customQueries: path.join(folderWhereTheCommandWasRanIn, '__tests__', 'integration', '__config__', 'customQueries'), + testIntegrations: path.join(folderWhereTheCommandWasRanIn, "__tests__", "integration"), + testUnit: path.join(folderWhereTheCommandWasRanIn, "__tests__", "unit"), + methods: path.join(folderWhereTheCommandWasRanIn, "src", "methods"), + customQueries: path.join(folderWhereTheCommandWasRanIn, "__tests__", "integration", "__config__", "customQueries"), }; // Checks if all folders required folders are accessible try { - await Promise.all( - Object.values(folders) - .map((folderPath) => fsPromises.access(folderPath)), - ); + await Promise.all(Object.values(folders).map((folderPath) => fsPromises.access(folderPath))); } catch (e) { - throw new Error('The method bootstrapper expects a certain directory structure. One of the folders is inaccessible', { cause: e }); + throw new Error("The method bootstrapper expects a certain directory structure. One of the folders is inaccessible", { cause: e }); } await fileOperations.createMethodImplementationFile(folders.methods, methodName); diff --git a/packages/method-bootstrapper/utils.js b/packages/method-bootstrapper/utils.js index acf7e0fd3..5851b1f30 100644 --- a/packages/method-bootstrapper/utils.js +++ b/packages/method-bootstrapper/utils.js @@ -8,9 +8,9 @@ module.exports.kebabize = (camelCaseString) => .map((letter, index) => { const isUppercase = letter === letter.toUpperCase(); const isFirst = index === 0; - return (isUppercase && !isFirst) ? `-${letter.toLowerCase()}` : letter; + return isUppercase && !isFirst ? `-${letter.toLowerCase()}` : letter; }) - .join(''); + .join(""); /** * @param {string} string diff --git a/yarn.lock b/yarn.lock index 1973291ab..6a457dc57 100644 --- a/yarn.lock +++ b/yarn.lock @@ -875,10 +875,15 @@ resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.5.1.tgz#cdd35dce4fa1a89a4fd42b1599eb35b3af408884" integrity sha512-Z5ba73P98O1KUYCCJTUeVpja9RcGoMdncZ6T49FCUl2lN38JtCJ+3WgIDBv0AuY4WChU5PmtJmOCTlN6FZTFKQ== -"@eslint/eslintrc@^2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.0.tgz#82256f164cc9e0b59669efc19d57f8092706841d" - integrity sha512-Lj7DECXqIVCqnqjjHMPna4vn6GJcMgul/wuS0je9OZ9gsL0zzDpKPVtcG1HaDVc+9y+qgXneTeUMbCqXJNpH1A== +"@eslint-community/regexpp@^4.6.1": + version "4.10.0" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.10.0.tgz#548f6de556857c8bb73bbee70c35dc82a2e74d63" + integrity sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA== + +"@eslint/eslintrc@^2.1.4": + version "2.1.4" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.4.tgz#388a269f0f25c1b6adc317b5a2c55714894c70ad" + integrity sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ== dependencies: ajv "^6.12.4" debug "^4.3.2" @@ -890,10 +895,10 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@8.44.0": - version "8.44.0" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.44.0.tgz#961a5903c74139390478bdc808bcde3fc45ab7af" - integrity sha512-Ag+9YM4ocKQx9AarydN0KY2j0ErMHNIocPDrVo8zAE44xLTjEtz81OdR68/cydGtk6m6jDb5Za3r2useMzYmSw== +"@eslint/js@8.57.0": + version "8.57.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.57.0.tgz#a5417ae8427873f1dd08b70b3574b453e67b5f7f" + integrity sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g== "@gar/promisify@^1.0.1": version "1.1.3" @@ -1288,13 +1293,13 @@ resolved "https://registry.yarnpkg.com/@graphql-typed-document-node/core/-/core-3.2.0.tgz#5f3d96ec6b2354ad6d8a28bf216a1d97b5426861" integrity sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ== -"@humanwhocodes/config-array@^0.11.10": - version "0.11.10" - resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.10.tgz#5a3ffe32cc9306365fb3fd572596cd602d5e12d2" - integrity sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ== +"@humanwhocodes/config-array@^0.11.14": + version "0.11.14" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.14.tgz#d78e481a039f7566ecc9660b4ea7fe6b1fec442b" + integrity sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg== dependencies: - "@humanwhocodes/object-schema" "^1.2.1" - debug "^4.1.1" + "@humanwhocodes/object-schema" "^2.0.2" + debug "^4.3.1" minimatch "^3.0.5" "@humanwhocodes/module-importer@^1.0.1": @@ -1302,10 +1307,10 @@ resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== -"@humanwhocodes/object-schema@^1.2.1": - version "1.2.1" - resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" - integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== +"@humanwhocodes/object-schema@^2.0.2": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz#4a2868d75d6d6963e423bcf90b7fd1be343409d3" + integrity sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA== "@hutson/parse-repository-url@^3.0.0": version "3.0.2" @@ -2275,6 +2280,62 @@ globby "^11.0.0" read-yaml-file "^1.1.0" +"@microsoft/api-documenter@^7.13.30": + version "7.24.1" + resolved "https://registry.yarnpkg.com/@microsoft/api-documenter/-/api-documenter-7.24.1.tgz#56c57bd0b28ddd40f5ff51b44b5ee22913f4eea4" + integrity sha512-DX332aznb5SWpOLGuymvzg2OZsQ5+dCbSm8yvVYqTylDgSAiPouvKrdlWPoEeicuLU8wzxSl3xv7DMb6xgYwPw== + dependencies: + "@microsoft/api-extractor-model" "7.28.13" + "@microsoft/tsdoc" "0.14.2" + "@rushstack/node-core-library" "4.0.2" + "@rushstack/terminal" "0.10.0" + "@rushstack/ts-command-line" "4.19.1" + js-yaml "~3.13.1" + resolve "~1.22.1" + +"@microsoft/api-extractor-model@7.28.13": + version "7.28.13" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.28.13.tgz#96fbc52155e0d07e0eabbd9699065b77702fe33a" + integrity sha512-39v/JyldX4MS9uzHcdfmjjfS6cYGAoXV+io8B5a338pkHiSt+gy2eXQ0Q7cGFJ7quSa1VqqlMdlPrB6sLR/cAw== + dependencies: + "@microsoft/tsdoc" "0.14.2" + "@microsoft/tsdoc-config" "~0.16.1" + "@rushstack/node-core-library" "4.0.2" + +"@microsoft/api-extractor@^7.18.1": + version "7.43.0" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.43.0.tgz#41c42677bc71cd8e0f23c63c56802d85044e65cd" + integrity sha512-GFhTcJpB+MI6FhvXEI9b2K0snulNLWHqC/BbcJtyNYcKUiw7l3Lgis5ApsYncJ0leALX7/of4XfmXk+maT111w== + dependencies: + "@microsoft/api-extractor-model" "7.28.13" + "@microsoft/tsdoc" "0.14.2" + "@microsoft/tsdoc-config" "~0.16.1" + "@rushstack/node-core-library" "4.0.2" + "@rushstack/rig-package" "0.5.2" + "@rushstack/terminal" "0.10.0" + "@rushstack/ts-command-line" "4.19.1" + lodash "~4.17.15" + minimatch "~3.0.3" + resolve "~1.22.1" + semver "~7.5.4" + source-map "~0.6.1" + typescript "5.4.2" + +"@microsoft/tsdoc-config@~0.16.1": + version "0.16.2" + resolved "https://registry.yarnpkg.com/@microsoft/tsdoc-config/-/tsdoc-config-0.16.2.tgz#b786bb4ead00d54f53839a458ce626c8548d3adf" + integrity sha512-OGiIzzoBLgWWR0UdRJX98oYO+XKGf7tiK4Zk6tQ/E4IJqGCe7dvkTvgDZV5cFJUzLGDOjeAXrnZoA6QkVySuxw== + dependencies: + "@microsoft/tsdoc" "0.14.2" + ajv "~6.12.6" + jju "~1.4.0" + resolve "~1.19.0" + +"@microsoft/tsdoc@0.14.2": + version "0.14.2" + resolved "https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.14.2.tgz#c3ec604a0b54b9a9b87e9735dfc59e1a5da6a5fb" + integrity sha512-9b8mPpKrfeGRuhFH5iO1iwCLeIIsV6+H1sRfxbkoGXIyQE2BTsPd9zqSqQJ+pv5sJ/hT5M1zvOFL02MnEezFug== + "@mswjs/cookies@^0.2.0": version "0.2.2" resolved "https://registry.yarnpkg.com/@mswjs/cookies/-/cookies-0.2.2.tgz#b4e207bf6989e5d5427539c2443380a33ebb922b" @@ -2568,6 +2629,13 @@ dependencies: "@rollup/pluginutils" "^5.0.1" +"@rollup/plugin-json@^6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@rollup/plugin-json/-/plugin-json-6.1.0.tgz#fbe784e29682e9bb6dee28ea75a1a83702e7b805" + integrity sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA== + dependencies: + "@rollup/pluginutils" "^5.1.0" + "@rollup/plugin-node-resolve@^13.0.6": version "13.3.0" resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-13.3.0.tgz#da1c5c5ce8316cef96a2f823d111c1e4e498801c" @@ -2606,6 +2674,53 @@ estree-walker "^2.0.2" picomatch "^2.3.1" +"@rollup/pluginutils@^5.1.0": + version "5.1.0" + resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.1.0.tgz#7e53eddc8c7f483a4ad0b94afb1f7f5fd3c771e0" + integrity sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g== + dependencies: + "@types/estree" "^1.0.0" + estree-walker "^2.0.2" + picomatch "^2.3.1" + +"@rushstack/node-core-library@4.0.2": + version "4.0.2" + resolved "https://registry.yarnpkg.com/@rushstack/node-core-library/-/node-core-library-4.0.2.tgz#e26854a3314b279d57e8abdb4acce7797d02f554" + integrity sha512-hyES82QVpkfQMeBMteQUnrhASL/KHPhd7iJ8euduwNJG4mu2GSOKybf0rOEjOm1Wz7CwJEUm9y0yD7jg2C1bfg== + dependencies: + fs-extra "~7.0.1" + import-lazy "~4.0.0" + jju "~1.4.0" + resolve "~1.22.1" + semver "~7.5.4" + z-schema "~5.0.2" + +"@rushstack/rig-package@0.5.2": + version "0.5.2" + resolved "https://registry.yarnpkg.com/@rushstack/rig-package/-/rig-package-0.5.2.tgz#0e23a115904678717a74049661931c0b37dd5495" + integrity sha512-mUDecIJeH3yYGZs2a48k+pbhM6JYwWlgjs2Ca5f2n1G2/kgdgP9D/07oglEGf6mRyXEnazhEENeYTSNDRCwdqA== + dependencies: + resolve "~1.22.1" + strip-json-comments "~3.1.1" + +"@rushstack/terminal@0.10.0": + version "0.10.0" + resolved "https://registry.yarnpkg.com/@rushstack/terminal/-/terminal-0.10.0.tgz#e81909fa0e5c8016b6df4739f0f381f44358269f" + integrity sha512-UbELbXnUdc7EKwfH2sb8ChqNgapUOdqcCIdQP4NGxBpTZV2sQyeekuK3zmfQSa/MN+/7b4kBogl2wq0vpkpYGw== + dependencies: + "@rushstack/node-core-library" "4.0.2" + supports-color "~8.1.1" + +"@rushstack/ts-command-line@4.19.1": + version "4.19.1" + resolved "https://registry.yarnpkg.com/@rushstack/ts-command-line/-/ts-command-line-4.19.1.tgz#288ee54dd607e558a8be07705869c16c31b5c3ef" + integrity sha512-J7H768dgcpG60d7skZ5uSSwyCZs/S2HrWP1Ds8d1qYAyaaeJmpmmLr9BVw97RjFzmQPOYnoXcKA4GkqDCkduQg== + dependencies: + "@rushstack/terminal" "0.10.0" + "@types/argparse" "1.0.38" + argparse "~1.0.9" + string-argv "~0.3.1" + "@sinclair/typebox@^0.27.8": version "0.27.8" resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" @@ -2650,6 +2765,11 @@ resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.4.tgz#0b92dcc0cc1c81f6f306a381f28e31b1a56536e9" integrity sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA== +"@types/argparse@1.0.38": + version "1.0.38" + resolved "https://registry.yarnpkg.com/@types/argparse/-/argparse-1.0.38.tgz#a81fd8606d481f873a3800c6ebae4f1d768a56a9" + integrity sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA== + "@types/babel__core@^7.1.14": version "7.20.1" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.1.tgz#916ecea274b0c776fec721e333e55762d3a9614b" @@ -2948,44 +3068,52 @@ "@typescript-eslint/types" "5.61.0" eslint-visitor-keys "^3.3.0" -"@vue-storefront/api-extractor-config@^0.0.3": - version "0.0.3" - resolved "https://registry.yarnpkg.com/@vue-storefront/api-extractor-config/-/api-extractor-config-0.0.3.tgz#05bab58c485a39e721d9f9e673bb28a5fbf95840" - integrity sha512-o/vbqbehZ2luLNyMRzGGcw7/K4gqYTcVUJud1iRu5lAoGJjH6hBwU4ZWy/XfSmhuudPY4LKQco5etTUfNDAuPQ== +"@ungap/structured-clone@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.2.0.tgz#756641adb587851b5ccb3e095daf27ae581c8406" + integrity sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ== -"@vue-storefront/eslint-config-integrations@^0.0.14": - version "0.0.14" - resolved "https://registry.yarnpkg.com/@vue-storefront/eslint-config-integrations/-/eslint-config-integrations-0.0.14.tgz#645568fe2b46f7b59060ff0cc99dd888da8bf726" - integrity sha512-FOi2qgOGLyIcd9H5rehsPK0ZyvmJtNiiSDqtezJFfUwZSu8Wydc5plMlod1BiO+IhnhvCVddpsbGqWEhB4A7ng== +"@vue-storefront/api-extractor-config@^0.0.5": + version "0.0.5" + resolved "https://registry.yarnpkg.com/@vue-storefront/api-extractor-config/-/api-extractor-config-0.0.5.tgz#61fc8a380202531bf82584bdb417e468a2e533a4" + integrity sha512-FNHS+bxZJbNUpJYrMckMXBjStwgZslPmLZoUoueO/umwc9l6H9tClwLkIdG1RPjNT/SNMDFSgyGfRTq4wJpj+g== + dependencies: + "@microsoft/api-documenter" "^7.13.30" + "@microsoft/api-extractor" "^7.18.1" + +"@vue-storefront/eslint-config-integrations@^0.0.21": + version "0.0.21" + resolved "https://registry.yarnpkg.com/@vue-storefront/eslint-config-integrations/-/eslint-config-integrations-0.0.21.tgz#12a5a664859288274bb6502da21c68ce8062bd55" + integrity sha512-leD6wYorkZ+a++k0OAQ8iWkqBkPQTuK8F3HxNI7+cTpJjF249G5v9arrkSsxWc47v1dt8zAdetA//tDLweBuew== dependencies: "@typescript-eslint/eslint-plugin" "^5.59.9" "@typescript-eslint/parser" "^5.59.9" - eslint "^8.42.0" + eslint "^8.55.0" eslint-config-airbnb-base "^15.0.0" eslint-config-prettier "^8.8.0" eslint-plugin-import "^2.27.5" eslint-plugin-prettier "^4.2.1" prettier "^2.8.8" -"@vue-storefront/integrations-tsconfig@^0.0.2": - version "0.0.2" - resolved "https://registry.yarnpkg.com/@vue-storefront/integrations-tsconfig/-/integrations-tsconfig-0.0.2.tgz#de3bf7775cebb816c491323fc486e745e3045e0b" - integrity sha512-8zWgGKU7EGrwAK+zcfxNUYSdsuFvrdLo5Oq95o5Unwcj5X153rgexTVGL4qYC18NRXD76r52Fbj8hWKWIBVdFw== +"@vue-storefront/integrations-tsconfig@^0.0.4": + version "0.0.4" + resolved "https://registry.yarnpkg.com/@vue-storefront/integrations-tsconfig/-/integrations-tsconfig-0.0.4.tgz#36b9f742dedac04df17657ad296e08c91f2fae6d" + integrity sha512-Joi9dTblviEaujemcWT30GSF3nh0MaPfrz76V6kHyGgO3ftbWVq2tfq2jtbiL+YJxT3FaY1/giq7cSRCjb9kcQ== -"@vue-storefront/jest-config@^0.0.2": - version "0.0.2" - resolved "https://registry.yarnpkg.com/@vue-storefront/jest-config/-/jest-config-0.0.2.tgz#12998b1d390fb75113e2f5649934c3fd55c4c96c" - integrity sha512-FVaA6jDoPtn5+4yv+RwwlEUvcvRc1cgysvDKX7pB8MR7NkVPT1zBxFJMAdGbFzgVMhM3Nbgz1MWZrPxVQkhxJQ== +"@vue-storefront/jest-config@^0.0.4": + version "0.0.4" + resolved "https://registry.yarnpkg.com/@vue-storefront/jest-config/-/jest-config-0.0.4.tgz#45a124247f21cc9ff71a61ffdcae9d30fb2529aa" + integrity sha512-+1ZHIrPYROO3ixQKHxuvAHheBSb1TyurpXNCX3LyBzDJR/QCZ9BJjiTUFGwpgJQNyV5V8LuNoSjq/mnhV80Mzw== dependencies: "@types/jest" "^27.4.0" jest "^29.5.0" ts-jest "^29.1.0" ts-node "^10.9.1" -"@vue-storefront/middleware@^3.5.0": - version "3.5.0" - resolved "https://registry.yarnpkg.com/@vue-storefront/middleware/-/middleware-3.5.0.tgz#54221d1419ce20c7433157827f3f572b84c36379" - integrity sha512-jn0pLSiytBSo8F8nPRQEVJGU3K7fkHq5NHvKEEwPQg2KyxMOB6atBTKkWzrIxehfEfATcjhO04+RyxW43QbFBg== +"@vue-storefront/middleware@^3.9.0": + version "3.9.0" + resolved "https://registry.yarnpkg.com/@vue-storefront/middleware/-/middleware-3.9.0.tgz#58ec3c0e5f6c0b706187f8a87c1ee014b92fa4e4" + integrity sha512-4NSga6xlPETMHeROHyANfv8282pV2viBHIW3ivytmxzdWJN1pLh/rwM9sKgPdpjhZF9mBAzxsRCo7KCf5R7Oyw== dependencies: consola "^2.15.3" cookie-parser "^1.4.6" @@ -2993,12 +3121,13 @@ express "^4.18.1" helmet "^5.1.1" -"@vue-storefront/rollup-config@^0.0.3": - version "0.0.3" - resolved "https://registry.yarnpkg.com/@vue-storefront/rollup-config/-/rollup-config-0.0.3.tgz#e8481c66908b92675daefdac100319e08952e479" - integrity sha512-YsrKqyBu+6+lxS4EG3p+bw26obhu5+NQ+E98PTCLFXbepk29MBGqxc3394zCZAFAbmTnWzPLeAm75TrllhKGSw== +"@vue-storefront/rollup-config@^0.0.7": + version "0.0.7" + resolved "https://registry.yarnpkg.com/@vue-storefront/rollup-config/-/rollup-config-0.0.7.tgz#9cf6b7d8b4645191873908dcc1f87f625fa490e4" + integrity sha512-iBT/8l8Nqu+U4lEa2D6tzkGHDF3N/t7H2OnyfYLbClBeveXxhmdOJYTfwZfhGK+rBT+lYXKdNVW3DOqksQ7+0w== dependencies: "@rollup/plugin-commonjs" "^21.0.1" + "@rollup/plugin-json" "^6.1.0" "@rollup/plugin-node-resolve" "^13.0.6" rollup "^2.59.0" rollup-plugin-typescript2 "^0.35.0" @@ -3233,7 +3362,7 @@ aggregate-error@^3.0.0: clean-stack "^2.0.0" indent-string "^4.0.0" -ajv@^6.10.0, ajv@^6.12.3, ajv@^6.12.4: +ajv@^6.12.3, ajv@^6.12.4, ajv@~6.12.6: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -3343,7 +3472,7 @@ arg@^4.1.0: resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== -argparse@^1.0.7: +argparse@^1.0.7, argparse@~1.0.9: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== @@ -4103,6 +4232,11 @@ combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6: dependencies: delayed-stream "~1.0.0" +commander@^10.0.0: + version "10.0.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-10.0.1.tgz#881ee46b4f77d1c1dccc5823433aa39b022cbe06" + integrity sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug== + commander@^9.3.0: version "9.5.0" resolved "https://registry.yarnpkg.com/commander/-/commander-9.5.0.tgz#bc08d1eb5cedf7ccb797a96199d41c7bc3e60d30" @@ -5066,10 +5200,10 @@ eslint-scope@^5.1.1: esrecurse "^4.3.0" estraverse "^4.1.1" -eslint-scope@^7.2.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.0.tgz#f21ebdafda02352f103634b96dd47d9f81ca117b" - integrity sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw== +eslint-scope@^7.2.2: + version "7.2.2" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.2.tgz#deb4f92563390f32006894af62a22dba1c46423f" + integrity sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg== dependencies: esrecurse "^4.3.0" estraverse "^5.2.0" @@ -5079,27 +5213,33 @@ eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz#c22c48f48942d08ca824cc526211ae400478a994" integrity sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA== -eslint@^8.42.0: - version "8.44.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.44.0.tgz#51246e3889b259bbcd1d7d736a0c10add4f0e500" - integrity sha512-0wpHoUbDUHgNCyvFB5aXLiQVfK9B0at6gUvzy83k4kAsQ/u769TQDX6iKC+aO4upIHO9WSaA3QoXYQDHbNwf1A== +eslint-visitor-keys@^3.4.3: + version "3.4.3" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" + integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== + +eslint@^8.55.0: + version "8.57.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.57.0.tgz#c786a6fd0e0b68941aaf624596fb987089195668" + integrity sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ== dependencies: "@eslint-community/eslint-utils" "^4.2.0" - "@eslint-community/regexpp" "^4.4.0" - "@eslint/eslintrc" "^2.1.0" - "@eslint/js" "8.44.0" - "@humanwhocodes/config-array" "^0.11.10" + "@eslint-community/regexpp" "^4.6.1" + "@eslint/eslintrc" "^2.1.4" + "@eslint/js" "8.57.0" + "@humanwhocodes/config-array" "^0.11.14" "@humanwhocodes/module-importer" "^1.0.1" "@nodelib/fs.walk" "^1.2.8" - ajv "^6.10.0" + "@ungap/structured-clone" "^1.2.0" + ajv "^6.12.4" chalk "^4.0.0" cross-spawn "^7.0.2" debug "^4.3.2" doctrine "^3.0.0" escape-string-regexp "^4.0.0" - eslint-scope "^7.2.0" - eslint-visitor-keys "^3.4.1" - espree "^9.6.0" + eslint-scope "^7.2.2" + eslint-visitor-keys "^3.4.3" + espree "^9.6.1" esquery "^1.4.2" esutils "^2.0.2" fast-deep-equal "^3.1.3" @@ -5109,7 +5249,6 @@ eslint@^8.42.0: globals "^13.19.0" graphemer "^1.4.0" ignore "^5.2.0" - import-fresh "^3.0.0" imurmurhash "^0.1.4" is-glob "^4.0.0" is-path-inside "^3.0.3" @@ -5121,7 +5260,6 @@ eslint@^8.42.0: natural-compare "^1.4.0" optionator "^0.9.3" strip-ansi "^6.0.1" - strip-json-comments "^3.1.0" text-table "^0.2.0" espree@^9.6.0: @@ -5133,6 +5271,15 @@ espree@^9.6.0: acorn-jsx "^5.3.2" eslint-visitor-keys "^3.4.1" +espree@^9.6.1: + version "9.6.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f" + integrity sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ== + dependencies: + acorn "^8.9.0" + acorn-jsx "^5.3.2" + eslint-visitor-keys "^3.4.1" + esprima@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" @@ -5531,7 +5678,7 @@ fs-extra@^10.0.0: jsonfile "^6.0.1" universalify "^2.0.0" -fs-extra@^7.0.1: +fs-extra@^7.0.1, fs-extra@~7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw== @@ -5588,6 +5735,11 @@ function-bind@^1.1.1: resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== +function-bind@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" + integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== + function.prototype.name@^1.1.5: version "1.1.5" resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.5.tgz#cce0505fe1ffb80503e6f9e46cc64e46a12a9621" @@ -5949,6 +6101,13 @@ has@^1.0.3: dependencies: function-bind "^1.1.1" +hasown@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" + integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== + dependencies: + function-bind "^1.1.2" + header-case@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/header-case/-/header-case-2.0.4.tgz#5a42e63b55177349cf405beb8d775acabb92c063" @@ -6117,7 +6276,7 @@ immutable@~3.7.6: resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.7.6.tgz#13b4d3cb12befa15482a26fe1b2ebae640071e4b" integrity sha512-AizQPcaofEtO11RZhPPHBOJRdo/20MKQF9mBLnVkBoyHi1/zXK8fzVdnEpSV9gxqtnh6Qomfp3F0xT5qP/vThw== -import-fresh@^3.0.0, import-fresh@^3.2.1: +import-fresh@^3.2.1: version "3.3.0" resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== @@ -6130,6 +6289,11 @@ import-from@4.0.0: resolved "https://registry.yarnpkg.com/import-from/-/import-from-4.0.0.tgz#2710b8d66817d232e16f4166e319248d3d5492e2" integrity sha512-P9J71vT5nLlDeV8FHs5nNxaLbrpfAV5cF5srvbZfpwpcJoM/xZR3hiv+q+SAnuSmuGbXMWud063iIMx/V/EWZQ== +import-lazy@~4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-4.0.0.tgz#e8eb627483a0a43da3c03f3e35548be5cb0cc153" + integrity sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw== + import-local@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.1.0.tgz#b4479df8a5fd44f6cdce24070675676063c95cb4" @@ -6320,6 +6484,13 @@ is-ci@^3.0.1: dependencies: ci-info "^3.2.0" +is-core-module@^2.1.0, is-core-module@^2.13.0: + version "2.13.1" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.13.1.tgz#ad0d7532c6fea9da1ebdc82742d74525c6273384" + integrity sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw== + dependencies: + hasown "^2.0.0" + is-core-module@^2.11.0, is-core-module@^2.5.0: version "2.12.1" resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.12.1.tgz#0c0b6885b6f80011c71541ce15c8d66cf5a4f9fd" @@ -7038,6 +7209,11 @@ jiti@1.17.1: resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.17.1.tgz#264daa43ee89a03e8be28c3d712ccc4eb9f1e8ed" integrity sha512-NZIITw8uZQFuzQimqjUxIrIcEdxYDFIe/0xYfIlVXTkiBjjyBEvgasj5bb0/cHtPRD/NziPbT312sFrkI5ALpw== +jju@~1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/jju/-/jju-1.4.0.tgz#a3abe2718af241a2b2904f84a625970f389ae32a" + integrity sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA== + jose@^4.11.4: version "4.14.4" resolved "https://registry.yarnpkg.com/jose/-/jose-4.14.4.tgz#59e09204e2670c3164ee24cbfe7115c6f8bff9ca" @@ -7068,6 +7244,14 @@ js-yaml@^4.0.0, js-yaml@^4.1.0: dependencies: argparse "^2.0.1" +js-yaml@~3.13.1: + version "3.13.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" + integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + jsbn@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" @@ -7359,6 +7543,16 @@ lodash._reinterpolate@^3.0.0: resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d" integrity sha512-xYHt68QRoYGjeeM/XOE1uJtvXQAgvszfBhjV4yvsQH0u2i9I6cI6c6/eG4Hh3UAOVn0y/xAXwmTzEay49Q//HA== +lodash.get@^4.4.2: + version "4.4.2" + resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" + integrity sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ== + +lodash.isequal@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" + integrity sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ== + lodash.ismatch@^4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz#756cb5150ca3ba6f11085a78849645f188f85f37" @@ -7394,7 +7588,7 @@ lodash.templatesettings@^4.0.0: dependencies: lodash._reinterpolate "^3.0.0" -lodash@^4.11.2, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.7.0, lodash@~4.17.0: +lodash@^4.11.2, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.7.0, lodash@~4.17.0, lodash@~4.17.15: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -7677,6 +7871,13 @@ minimatch@^9.0.1: dependencies: brace-expansion "^2.0.1" +minimatch@~3.0.3: + version "3.0.8" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.8.tgz#5e6a59bd11e2ab0de1cfb843eb2d82e546c321c1" + integrity sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q== + dependencies: + brace-expansion "^1.1.7" + minimist-options@4.1.0, minimist-options@^4.0.2: version "4.1.0" resolved "https://registry.yarnpkg.com/minimist-options/-/minimist-options-4.1.0.tgz#c0655713c53a8a2ebd77ffa247d342c40f010619" @@ -8514,7 +8715,7 @@ path-key@^3.0.0, path-key@^3.1.0: resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== -path-parse@^1.0.7: +path-parse@^1.0.6, path-parse@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== @@ -9108,6 +9309,23 @@ resolve@^1.10.0, resolve@^1.17.0, resolve@^1.19.0, resolve@^1.20.0, resolve@^1.2 path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" +resolve@~1.19.0: + version "1.19.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.19.0.tgz#1af5bf630409734a067cae29318aac7fa29a267c" + integrity sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg== + dependencies: + is-core-module "^2.1.0" + path-parse "^1.0.6" + +resolve@~1.22.1: + version "1.22.8" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d" + integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw== + dependencies: + is-core-module "^2.13.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" + response-iterator@^0.2.6: version "0.2.6" resolved "https://registry.yarnpkg.com/response-iterator/-/response-iterator-0.2.6.tgz#249005fb14d2e4eeb478a3f735a28fd8b4c9f3da" @@ -9257,6 +9475,13 @@ semver@^7.1.1, semver@^7.1.3, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semve dependencies: lru-cache "^6.0.0" +semver@~7.5.4: + version "7.5.4" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" + integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== + dependencies: + lru-cache "^6.0.0" + send@0.18.0: version "0.18.0" resolved "https://registry.yarnpkg.com/send/-/send-0.18.0.tgz#670167cc654b05f5aa4a767f9113bb371bc706be" @@ -9494,7 +9719,7 @@ source-map-support@0.5.13: buffer-from "^1.0.0" source-map "^0.6.0" -source-map@^0.6.0, source-map@^0.6.1: +source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== @@ -9627,7 +9852,7 @@ strict-uri-encode@^2.0.0: resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz#b9c7330c7042862f6b142dc274bbcc5866ce3546" integrity sha512-QwiXZgpRcKkhTj2Scnn++4PKtWsH0kpzZ62L2R6c/LUVYv7hVnZqcg2+sMuT6R7Jusu1vviK/MFsu6kNJfWlEQ== -string-argv@^0.3.1: +string-argv@^0.3.1, string-argv@~0.3.1: version "0.3.2" resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.2.tgz#2b6d0ef24b656274d957d54e0a4bbf6153dc02b6" integrity sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q== @@ -9756,7 +9981,7 @@ strip-indent@^3.0.0: dependencies: min-indent "^1.0.0" -strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: +strip-json-comments@^3.1.1, strip-json-comments@~3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== @@ -9784,7 +10009,7 @@ supports-color@^7.1.0: dependencies: has-flag "^4.0.0" -supports-color@^8.0.0: +supports-color@^8.0.0, supports-color@~8.1.1: version "8.1.1" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== @@ -10147,6 +10372,11 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA== +typescript@5.4.2: + version "5.4.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.2.tgz#0ae9cebcfae970718474fe0da2c090cad6577372" + integrity sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ== + typescript@^4.7.4: version "4.9.5" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" @@ -10362,6 +10592,11 @@ validate-npm-package-name@^3.0.0: dependencies: builtins "^1.0.3" +validator@^13.7.0: + version "13.11.0" + resolved "https://registry.yarnpkg.com/validator/-/validator-13.11.0.tgz#23ab3fd59290c61248364eabf4067f04955fbb1b" + integrity sha512-Ii+sehpSfZy+At5nPdnyMhx78fEoPDkR2XW/zimHEL3MyGJQOCQ7WeP20jPYRz7ZCpcKLB21NxuXHF3bxjStBQ== + value-or-promise@^1.0.11, value-or-promise@^1.0.12: version "1.0.12" resolved "https://registry.yarnpkg.com/value-or-promise/-/value-or-promise-1.0.12.tgz#0e5abfeec70148c78460a849f6b003ea7986f15c" @@ -10723,6 +10958,17 @@ yocto-queue@^0.1.0: resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== +z-schema@~5.0.2: + version "5.0.6" + resolved "https://registry.yarnpkg.com/z-schema/-/z-schema-5.0.6.tgz#46d6a687b15e4a4369e18d6cb1c7b8618fc256c5" + integrity sha512-+XR1GhnWklYdfr8YaZv/iu+vY+ux7V5DS5zH1DQf6bO5ufrt/5cgNhVO5qyhsjFXvsqQb/f08DWE9b6uPscyAg== + dependencies: + lodash.get "^4.4.2" + lodash.isequal "^4.5.0" + validator "^13.7.0" + optionalDependencies: + commander "^10.0.0" + zen-observable-ts@^1.2.5: version "1.2.5" resolved "https://registry.yarnpkg.com/zen-observable-ts/-/zen-observable-ts-1.2.5.tgz#6c6d9ea3d3a842812c6e9519209365a122ba8b58"