@lana-commerce/core 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +531 -0
- package/cjs/actionLock.js +31 -0
- package/cjs/addEmptyListItem.js +7 -0
- package/cjs/aggregateOptions.js +178 -0
- package/cjs/analytics.js +90 -0
- package/cjs/analyticsProductData.js +33 -0
- package/cjs/arrayToDict.js +12 -0
- package/cjs/asyncModuleWrapper.js +52 -0
- package/cjs/averageReviewScore.js +45 -0
- package/cjs/buildconfig.js +16 -0
- package/cjs/cachedLoader.js +36 -0
- package/cjs/canonicalVariantURL.js +2 -0
- package/cjs/cartOperation.js +132 -0
- package/cjs/categorySEO.js +20 -0
- package/cjs/commonTypes.js +2 -0
- package/cjs/compact.js +8 -0
- package/cjs/configLoader.js +69 -0
- package/cjs/controlledQueue.js +46 -0
- package/cjs/convertImageURL.js +19 -0
- package/cjs/dataLoader.js +185 -0
- package/cjs/defaultVariant.js +30 -0
- package/cjs/effector/clearOnChangeAfterDelay.js +17 -0
- package/cjs/effector/combineEvery.js +8 -0
- package/cjs/effector/combineSome.js +8 -0
- package/cjs/effector/debounced.js +18 -0
- package/cjs/effector/form.js +168 -0
- package/cjs/effector/hideOnChangeAfterDelay.js +17 -0
- package/cjs/effector/requestResponse.js +30 -0
- package/cjs/effector/requestResponseMulti.js +51 -0
- package/cjs/effector/restoreNamed.js +8 -0
- package/cjs/effector/split.js +29 -0
- package/cjs/effector/validator.js +33 -0
- package/cjs/effector/wrapSignInRequired.js +13 -0
- package/cjs/exceptions.js +6 -0
- package/cjs/fetchAllItems.js +56 -0
- package/cjs/file.js +83 -0
- package/cjs/fileWebsocket.js +83 -0
- package/cjs/filterFunc.js +48 -0
- package/cjs/filterFuncBrand.js +12 -0
- package/cjs/filterFuncCategory.js +12 -0
- package/cjs/filterFuncContentBlock.js +19 -0
- package/cjs/filterFuncCustomer.js +161 -0
- package/cjs/filterFuncDataFeed.js +54 -0
- package/cjs/filterFuncOrder.js +334 -0
- package/cjs/filterFuncPreprocess.js +14 -0
- package/cjs/filterFuncProduct.js +70 -0
- package/cjs/filterFuncPurchaseOrder.js +126 -0
- package/cjs/filterFuncSupplier.js +36 -0
- package/cjs/filterFuncTransfer.js +135 -0
- package/cjs/formatAbbrevNumber.js +21 -0
- package/cjs/formatCurrency.js +47 -0
- package/cjs/formatToJSX.js +123 -0
- package/cjs/fulfillmentNumber.js +7 -0
- package/cjs/generateRandomToken.js +12 -0
- package/cjs/generateUUID.js +10 -0
- package/cjs/generated/codes.js +47 -0
- package/cjs/genericFile.js +73 -0
- package/cjs/getSalesChannelID.js +13 -0
- package/cjs/getSessionID.js +13 -0
- package/cjs/getTimezone.js +12 -0
- package/cjs/graphql/fragments/Branding.js +3 -0
- package/cjs/graphql/fragments/BrandingField.js +3 -0
- package/cjs/graphql/fragments/CartCustomItem.js +3 -0
- package/cjs/graphql/fragments/CartOrder.js +3 -0
- package/cjs/graphql/fragments/CartVariant.js +3 -0
- package/cjs/graphql/fragments/CartVariantFull.js +3 -0
- package/cjs/graphql/fragments/Category.js +3 -0
- package/cjs/graphql/fragments/CommonCartVariant.js +3 -0
- package/cjs/graphql/fragments/Currency.js +3 -0
- package/cjs/graphql/fragments/CurrencyPrice.js +3 -0
- package/cjs/graphql/fragments/CustomField.js +3 -0
- package/cjs/graphql/fragments/CustomFieldObjects.js +3 -0
- package/cjs/graphql/fragments/Customer.js +3 -0
- package/cjs/graphql/fragments/CustomerBalance.js +3 -0
- package/cjs/graphql/fragments/CustomerBalanceHistory.js +3 -0
- package/cjs/graphql/fragments/CustomerFavorite.js +3 -0
- package/cjs/graphql/fragments/CustomerFavoriteShort.js +3 -0
- package/cjs/graphql/fragments/CustomerOAuthProvider.js +3 -0
- package/cjs/graphql/fragments/CustomerOrderBrief.js +3 -0
- package/cjs/graphql/fragments/CustomerOrderFulfillment.js +3 -0
- package/cjs/graphql/fragments/CustomerOrderFull.js +3 -0
- package/cjs/graphql/fragments/CustomerPaymentSource.js +3 -0
- package/cjs/graphql/fragments/CustomerReturnBrief.js +3 -0
- package/cjs/graphql/fragments/CustomerReturnFull.js +3 -0
- package/cjs/graphql/fragments/CustomerReturnPolicy.js +3 -0
- package/cjs/graphql/fragments/CustomerSubscriptionBrief.js +3 -0
- package/cjs/graphql/fragments/CustomerSubscriptionFull.js +3 -0
- package/cjs/graphql/fragments/File.js +3 -0
- package/cjs/graphql/fragments/FileForUpload.js +3 -0
- package/cjs/graphql/fragments/FileNoFallback.js +3 -0
- package/cjs/graphql/fragments/FullAddress.js +3 -0
- package/cjs/graphql/fragments/Gateway.js +3 -0
- package/cjs/graphql/fragments/GatewayManual.js +3 -0
- package/cjs/graphql/fragments/GatewayPaypal.js +3 -0
- package/cjs/graphql/fragments/GatewayStripe.js +3 -0
- package/cjs/graphql/fragments/GatewayTest.js +3 -0
- package/cjs/graphql/fragments/IPAndUAInfo.js +3 -0
- package/cjs/graphql/fragments/InfoCountry.js +3 -0
- package/cjs/graphql/fragments/InfoCountryDedupField.js +3 -0
- package/cjs/graphql/fragments/InfoCurrency.js +3 -0
- package/cjs/graphql/fragments/InfoProvince.js +3 -0
- package/cjs/graphql/fragments/KeyValue.js +3 -0
- package/cjs/graphql/fragments/LineItemField.js +3 -0
- package/cjs/graphql/fragments/MediaFile.js +3 -0
- package/cjs/graphql/fragments/MinCurrencyPrice.js +3 -0
- package/cjs/graphql/fragments/ProductField.js +3 -0
- package/cjs/graphql/fragments/ProductFieldSet.js +3 -0
- package/cjs/graphql/fragments/ProductFlat.js +3 -0
- package/cjs/graphql/fragments/ProductQuestion.js +3 -0
- package/cjs/graphql/fragments/ProductQuestionAnswer.js +3 -0
- package/cjs/graphql/fragments/ProductQuestionPage.js +3 -0
- package/cjs/graphql/fragments/ProductReview.js +3 -0
- package/cjs/graphql/fragments/ProductReviewAnswer.js +3 -0
- package/cjs/graphql/fragments/ProductReviewAverageScore.js +3 -0
- package/cjs/graphql/fragments/ProductReviewPage.js +3 -0
- package/cjs/graphql/fragments/ProductReviewScore.js +3 -0
- package/cjs/graphql/fragments/ProductReviewSurveyAnswer.js +3 -0
- package/cjs/graphql/fragments/ProductSearchOptionAgg.js +3 -0
- package/cjs/graphql/fragments/ProductSearchResult.js +3 -0
- package/cjs/graphql/fragments/ReturnReason.js +3 -0
- package/cjs/graphql/fragments/ReviewDimension.js +3 -0
- package/cjs/graphql/fragments/ReviewDimensionSet.js +3 -0
- package/cjs/graphql/fragments/ReviewImagePage.js +3 -0
- package/cjs/graphql/fragments/ReviewQuestionProduct.js +3 -0
- package/cjs/graphql/fragments/ReviewSettings.js +3 -0
- package/cjs/graphql/fragments/SearchProduct.js +3 -0
- package/cjs/graphql/fragments/Shop.js +3 -0
- package/cjs/graphql/fragments/SubscriptionPlan.js +3 -0
- package/cjs/graphql/fragments/SurveyQuestion.js +3 -0
- package/cjs/graphql/fragments/TieredPricing.js +3 -0
- package/cjs/graphql/fragments/TieredPricingTier.js +3 -0
- package/cjs/graphql/fragments/VariantOption.js +3 -0
- package/cjs/graphql/operations/ApplyGiftCardMutation.js +3 -0
- package/cjs/graphql/operations/AuthRequestMutation.js +3 -0
- package/cjs/graphql/operations/CancelOrderMutation.js +3 -0
- package/cjs/graphql/operations/CancelSubscriptionMutation.js +3 -0
- package/cjs/graphql/operations/ConnectOAuth2Mutation.js +3 -0
- package/cjs/graphql/operations/CreateCartMutation.js +26 -0
- package/cjs/graphql/operations/CreateFavoriteMutation.js +22 -0
- package/cjs/graphql/operations/CreateFileMutation.js +6 -0
- package/cjs/graphql/operations/CreatePaymentSourceMutation.js +6 -0
- package/cjs/graphql/operations/CreateProductQuestionAnswerMutation.js +3 -0
- package/cjs/graphql/operations/CreateProductQuestionMutation.js +8 -0
- package/cjs/graphql/operations/CreateProductReviewMutation.js +18 -0
- package/cjs/graphql/operations/CreateReturnMutation.js +22 -0
- package/cjs/graphql/operations/DeleteFavoriteMutation.js +3 -0
- package/cjs/graphql/operations/DeletePaymentSourceMutation.js +3 -0
- package/cjs/graphql/operations/DeleteProductQuestionAnswerMutation.js +3 -0
- package/cjs/graphql/operations/DeleteProductQuestionMutation.js +3 -0
- package/cjs/graphql/operations/DeleteProductReviewMutation.js +3 -0
- package/cjs/graphql/operations/DisconnectOAuth2Mutation.js +3 -0
- package/cjs/graphql/operations/EditSubscriptionMutation.js +3 -0
- package/cjs/graphql/operations/FileUploadedMutation.js +6 -0
- package/cjs/graphql/operations/FlagQuestionAnswerMutation.js +3 -0
- package/cjs/graphql/operations/FlagQuestionMutation.js +3 -0
- package/cjs/graphql/operations/FlagReviewAnswerMutation.js +3 -0
- package/cjs/graphql/operations/FlagReviewMutation.js +3 -0
- package/cjs/graphql/operations/GetBrandingQuery.js +10 -0
- package/cjs/graphql/operations/GetCartQuery.js +26 -0
- package/cjs/graphql/operations/GetCustomerAddressesPageDataQuery.js +16 -0
- package/cjs/graphql/operations/GetCustomerBalanceHistoryPageQuery.js +6 -0
- package/cjs/graphql/operations/GetCustomerBalanceQuery.js +8 -0
- package/cjs/graphql/operations/GetCustomerInfoQuery.js +10 -0
- package/cjs/graphql/operations/GetCustomerQuery.js +8 -0
- package/cjs/graphql/operations/GetFavoritesQuery.js +22 -0
- package/cjs/graphql/operations/GetFileStatusQuery.js +6 -0
- package/cjs/graphql/operations/GetGatewaysQuery.js +14 -0
- package/cjs/graphql/operations/GetInfoCurrenciesQuery.js +6 -0
- package/cjs/graphql/operations/GetLastCartQuery.js +26 -0
- package/cjs/graphql/operations/GetOrderQuery.js +30 -0
- package/cjs/graphql/operations/GetOrdersPageQuery.js +24 -0
- package/cjs/graphql/operations/GetPaymentMethodsPageDataQuery.js +18 -0
- package/cjs/graphql/operations/GetProductQuestionsPageQuery.js +10 -0
- package/cjs/graphql/operations/GetProductReviewImagesPageQuery.js +8 -0
- package/cjs/graphql/operations/GetProductReviewsPageQuery.js +20 -0
- package/cjs/graphql/operations/GetProvincesQuery.js +6 -0
- package/cjs/graphql/operations/GetQuestionQuery.js +8 -0
- package/cjs/graphql/operations/GetReturnCreationInfoQuery.js +36 -0
- package/cjs/graphql/operations/GetReturnQuery.js +28 -0
- package/cjs/graphql/operations/GetReturnsPageQuery.js +22 -0
- package/cjs/graphql/operations/GetReviewDimensionsQuery.js +6 -0
- package/cjs/graphql/operations/GetReviewQuery.js +18 -0
- package/cjs/graphql/operations/GetReviewSettingsQuery.js +12 -0
- package/cjs/graphql/operations/GetShopCurrenciesQuery.js +6 -0
- package/cjs/graphql/operations/GetShopQuery.js +8 -0
- package/cjs/graphql/operations/GetSubscriptionQuery.js +36 -0
- package/cjs/graphql/operations/GetSubscriptionsPageQuery.js +22 -0
- package/cjs/graphql/operations/GetVariantPageQuery.js +20 -0
- package/cjs/graphql/operations/LoadProductNoCustomerQuery.js +62 -0
- package/cjs/graphql/operations/LoadProductQuery.js +66 -0
- package/cjs/graphql/operations/ModifyCartMutation.js +26 -0
- package/cjs/graphql/operations/ModifyCustomerMutation.js +8 -0
- package/cjs/graphql/operations/ModifyFavoriteMutation.js +22 -0
- package/cjs/graphql/operations/ModifyProductQuestionAnswerMutation.js +3 -0
- package/cjs/graphql/operations/ModifyProductQuestionMutation.js +8 -0
- package/cjs/graphql/operations/ModifyProductReviewMutation.js +18 -0
- package/cjs/graphql/operations/NewPasswordMutation.js +3 -0
- package/cjs/graphql/operations/PauseSubscriptionMutation.js +3 -0
- package/cjs/graphql/operations/ResetPasswordMutation.js +3 -0
- package/cjs/graphql/operations/ResumeSubscriptionMutation.js +3 -0
- package/cjs/graphql/operations/SearchProductsAdvancedQuery.js +24 -0
- package/cjs/graphql/operations/SearchProductsQuery.js +20 -0
- package/cjs/graphql/operations/SearchQuestionsQuery.js +8 -0
- package/cjs/graphql/operations/SearchReviewsQuery.js +18 -0
- package/cjs/graphql/operations/SignInMutation.js +3 -0
- package/cjs/graphql/operations/SignInViaEmailCompleteMutation.js +3 -0
- package/cjs/graphql/operations/SignInViaEmailInitMutation.js +3 -0
- package/cjs/graphql/operations/SignUpMutation.js +3 -0
- package/cjs/graphql/operations/SkipNextSubscriptionMutation.js +3 -0
- package/cjs/graphql/operations/UploadFileMutation.js +3 -0
- package/cjs/graphql/operations/VerifyCodeMutation.js +3 -0
- package/cjs/graphql/operations/VoteQuestionAnswerMutation.js +3 -0
- package/cjs/graphql/operations/VoteQuestionMutation.js +3 -0
- package/cjs/graphql/operations/VoteReviewAnswerMutation.js +3 -0
- package/cjs/graphql/operations/VoteReviewMutation.js +3 -0
- package/cjs/graphql/types.js +2 -0
- package/cjs/hierarchicalSearchOption.js +42 -0
- package/cjs/idgen.js +8 -0
- package/cjs/ignoreQueue.js +50 -0
- package/cjs/imageAltProps.js +13 -0
- package/cjs/invoiceFormat.js +59 -0
- package/cjs/isShippingRequired.js +20 -0
- package/cjs/isoStripTrailingZeros.js +7 -0
- package/cjs/json/commerce.js +10 -0
- package/cjs/json/commerceFileUpload.js +57 -0
- package/cjs/json/commerceTypes.js +2 -0
- package/cjs/json/common.js +320 -0
- package/cjs/json/fetchAllItems.js +61 -0
- package/cjs/json/mutator.js +957 -0
- package/cjs/json/storefront.js +10 -0
- package/cjs/json/storefrontTypes.js +2 -0
- package/cjs/lastValue.js +17 -0
- package/cjs/lineItemPrice.js +111 -0
- package/cjs/loadJWT.js +25 -0
- package/cjs/mapInvalidInput.js +33 -0
- package/cjs/mapResponseData.js +16 -0
- package/cjs/mapResponseMultiData.js +14 -0
- package/cjs/meanBy.js +15 -0
- package/cjs/media.js +16 -0
- package/cjs/modules/advancedSearch.js +127 -0
- package/cjs/modules/cart.js +708 -0
- package/cjs/modules/config/defaultAdvancedSearchGraphQLConfig.js +8 -0
- package/cjs/modules/config/defaultCartGraphQLConfig.js +14 -0
- package/cjs/modules/config/defaultProductGraphQLConfig.js +48 -0
- package/cjs/modules/config/defaultSearchGraphQLConfig.js +8 -0
- package/cjs/modules/customer.js +2174 -0
- package/cjs/modules/helpers/cartInitOption.js +22 -0
- package/cjs/modules/helpers/cookieConsent.js +33 -0
- package/cjs/modules/helpers/customerOauth2.js +64 -0
- package/cjs/modules/helpers/getOAuth2Hook.js +52 -0
- package/cjs/modules/helpers/hookUpAnalytics.js +49 -0
- package/cjs/modules/helpers/loadJWT.js +23 -0
- package/cjs/modules/helpers/misc.js +58 -0
- package/cjs/modules/imageDialog.js +78 -0
- package/cjs/modules/persist.js +55 -0
- package/cjs/modules/popupMessage.js +21 -0
- package/cjs/modules/product.js +1261 -0
- package/cjs/modules/recentlyVisitedProducts.js +72 -0
- package/cjs/modules/search.js +102 -0
- package/cjs/multiResponseToResponse.js +22 -0
- package/cjs/nonNull.js +10 -0
- package/cjs/oauthState.js +40 -0
- package/cjs/orderShippingAddress.js +7 -0
- package/cjs/package.json +3 -0
- package/cjs/pender.js +16 -0
- package/cjs/percentageOff.js +7 -0
- package/cjs/popupConnectQueue.js +62 -0
- package/cjs/preact/components/SixDigitInput.js +167 -0
- package/cjs/preact/effector.js +74 -0
- package/cjs/preact/transition/CSSTransition.js +55 -0
- package/cjs/preact/transition/Transition.js +104 -0
- package/cjs/preact/translateLocalStatic.js +31 -0
- package/cjs/productFiltering.js +173 -0
- package/cjs/productSEO.js +51 -0
- package/cjs/productSorting.js +93 -0
- package/cjs/promiseAll.js +18 -0
- package/cjs/promiseLimit.js +38 -0
- package/cjs/rdsToInitialScores.js +32 -0
- package/cjs/react/components/Portal.js +7 -0
- package/cjs/react/components/RootCloseWrapper.js +41 -0
- package/cjs/react/components/SixDigitInput.js +167 -0
- package/cjs/react/contains.js +14 -0
- package/cjs/react/popperBinder.js +70 -0
- package/cjs/react/rootClose.js +112 -0
- package/cjs/react/translateLocalStatic.js +32 -0
- package/cjs/react/useAsyncCachedValue.js +14 -0
- package/cjs/refreshTimeout.js +25 -0
- package/cjs/remoteAuth.js +59 -0
- package/cjs/request.js +348 -0
- package/cjs/requestDetails.js +76 -0
- package/cjs/rfc3339Normalize.js +10 -0
- package/cjs/script.js +172 -0
- package/cjs/seo.js +2 -0
- package/cjs/shopDomain.js +8 -0
- package/cjs/shopLinks.js +63 -0
- package/cjs/slate.js +376 -0
- package/cjs/sleep.js +10 -0
- package/cjs/splitBy.js +21 -0
- package/cjs/splitName.js +28 -0
- package/cjs/stripZeros.js +13 -0
- package/cjs/stripeError.js +65 -0
- package/cjs/tailSplit.js +12 -0
- package/cjs/tieredPrice.js +32 -0
- package/cjs/timeIt.js +15 -0
- package/cjs/toMajor.js +8 -0
- package/cjs/toMinor.js +8 -0
- package/cjs/trace.js +37 -0
- package/cjs/translateLocale.js +12 -0
- package/cjs/traverse.js +14 -0
- package/cjs/truncate.js +21 -0
- package/cjs/typedLocalStorage.js +30 -0
- package/cjs/variantImage.js +26 -0
- package/cjs/variantImageURL.js +13 -0
- package/cjs/variantImages.js +19 -0
- package/cjs/variantInventory.js +43 -0
- package/cjs/variantOptions.js +21 -0
- package/cjs/variantPrice.js +96 -0
- package/cjs/variantPriceCommerce.js +29 -0
- package/cjs/variantTitle.js +9 -0
- package/cjs/variantTitleFull.js +11 -0
- package/cjs/variantURL.js +9 -0
- package/cjs/vendor/popper/index.d.ts +160 -0
- package/cjs/vendor/popper/index.js +2657 -0
- package/cjs/vendor/popper/index.js.map +1 -0
- package/cjs/vendor/popper/package.json +3 -0
- package/cjs/websocket.js +179 -0
- package/esm/actionLock.js +24 -0
- package/esm/addEmptyListItem.js +3 -0
- package/esm/aggregateOptions.js +169 -0
- package/esm/analytics.js +91 -0
- package/esm/analyticsProductData.js +28 -0
- package/esm/arrayToDict.js +8 -0
- package/esm/asyncModuleWrapper.js +47 -0
- package/esm/averageReviewScore.js +40 -0
- package/esm/buildconfig.js +13 -0
- package/esm/cachedLoader.js +32 -0
- package/esm/canonicalVariantURL.js +1 -0
- package/esm/cartOperation.js +126 -0
- package/esm/categorySEO.js +16 -0
- package/esm/commonTypes.js +1 -0
- package/esm/compact.js +4 -0
- package/esm/configLoader.js +61 -0
- package/esm/controlledQueue.js +38 -0
- package/esm/convertImageURL.js +15 -0
- package/esm/dataLoader.js +192 -0
- package/esm/defaultVariant.js +25 -0
- package/esm/effector/clearOnChangeAfterDelay.js +13 -0
- package/esm/effector/combineEvery.js +4 -0
- package/esm/effector/combineSome.js +4 -0
- package/esm/effector/debounced.js +14 -0
- package/esm/effector/form.js +166 -0
- package/esm/effector/hideOnChangeAfterDelay.js +13 -0
- package/esm/effector/requestResponse.js +24 -0
- package/esm/effector/requestResponseMulti.js +47 -0
- package/esm/effector/restoreNamed.js +4 -0
- package/esm/effector/split.js +25 -0
- package/esm/effector/validator.js +28 -0
- package/esm/effector/wrapSignInRequired.js +9 -0
- package/esm/exceptions.js +2 -0
- package/esm/fetchAllItems.js +44 -0
- package/esm/file.js +67 -0
- package/esm/fileWebsocket.js +75 -0
- package/esm/filterFunc.js +43 -0
- package/esm/filterFuncBrand.js +9 -0
- package/esm/filterFuncCategory.js +9 -0
- package/esm/filterFuncContentBlock.js +16 -0
- package/esm/filterFuncCustomer.js +153 -0
- package/esm/filterFuncDataFeed.js +50 -0
- package/esm/filterFuncOrder.js +325 -0
- package/esm/filterFuncPreprocess.js +9 -0
- package/esm/filterFuncProduct.js +66 -0
- package/esm/filterFuncPurchaseOrder.js +122 -0
- package/esm/filterFuncSupplier.js +31 -0
- package/esm/filterFuncTransfer.js +130 -0
- package/esm/formatAbbrevNumber.js +16 -0
- package/esm/formatCurrency.js +42 -0
- package/esm/formatToJSX.js +118 -0
- package/esm/fulfillmentNumber.js +3 -0
- package/esm/generateRandomToken.js +8 -0
- package/esm/generateUUID.js +6 -0
- package/esm/generated/codes.js +44 -0
- package/esm/genericFile.js +65 -0
- package/esm/getSalesChannelID.js +9 -0
- package/esm/getSessionID.js +9 -0
- package/esm/getTimezone.js +8 -0
- package/esm/graphql/fragments/Branding.js +1 -0
- package/esm/graphql/fragments/BrandingField.js +1 -0
- package/esm/graphql/fragments/CartCustomItem.js +1 -0
- package/esm/graphql/fragments/CartOrder.js +1 -0
- package/esm/graphql/fragments/CartVariant.js +1 -0
- package/esm/graphql/fragments/CartVariantFull.js +1 -0
- package/esm/graphql/fragments/Category.js +1 -0
- package/esm/graphql/fragments/CommonCartVariant.js +1 -0
- package/esm/graphql/fragments/Currency.js +1 -0
- package/esm/graphql/fragments/CurrencyPrice.js +1 -0
- package/esm/graphql/fragments/CustomField.js +1 -0
- package/esm/graphql/fragments/CustomFieldObjects.js +1 -0
- package/esm/graphql/fragments/Customer.js +1 -0
- package/esm/graphql/fragments/CustomerBalance.js +1 -0
- package/esm/graphql/fragments/CustomerBalanceHistory.js +1 -0
- package/esm/graphql/fragments/CustomerFavorite.js +1 -0
- package/esm/graphql/fragments/CustomerFavoriteShort.js +1 -0
- package/esm/graphql/fragments/CustomerOAuthProvider.js +1 -0
- package/esm/graphql/fragments/CustomerOrderBrief.js +1 -0
- package/esm/graphql/fragments/CustomerOrderFulfillment.js +1 -0
- package/esm/graphql/fragments/CustomerOrderFull.js +1 -0
- package/esm/graphql/fragments/CustomerPaymentSource.js +1 -0
- package/esm/graphql/fragments/CustomerReturnBrief.js +1 -0
- package/esm/graphql/fragments/CustomerReturnFull.js +1 -0
- package/esm/graphql/fragments/CustomerReturnPolicy.js +1 -0
- package/esm/graphql/fragments/CustomerSubscriptionBrief.js +1 -0
- package/esm/graphql/fragments/CustomerSubscriptionFull.js +1 -0
- package/esm/graphql/fragments/File.js +1 -0
- package/esm/graphql/fragments/FileForUpload.js +1 -0
- package/esm/graphql/fragments/FileNoFallback.js +1 -0
- package/esm/graphql/fragments/FullAddress.js +1 -0
- package/esm/graphql/fragments/Gateway.js +1 -0
- package/esm/graphql/fragments/GatewayManual.js +1 -0
- package/esm/graphql/fragments/GatewayPaypal.js +1 -0
- package/esm/graphql/fragments/GatewayStripe.js +1 -0
- package/esm/graphql/fragments/GatewayTest.js +1 -0
- package/esm/graphql/fragments/IPAndUAInfo.js +1 -0
- package/esm/graphql/fragments/InfoCountry.js +1 -0
- package/esm/graphql/fragments/InfoCountryDedupField.js +1 -0
- package/esm/graphql/fragments/InfoCurrency.js +1 -0
- package/esm/graphql/fragments/InfoProvince.js +1 -0
- package/esm/graphql/fragments/KeyValue.js +1 -0
- package/esm/graphql/fragments/LineItemField.js +1 -0
- package/esm/graphql/fragments/MediaFile.js +1 -0
- package/esm/graphql/fragments/MinCurrencyPrice.js +1 -0
- package/esm/graphql/fragments/ProductField.js +1 -0
- package/esm/graphql/fragments/ProductFieldSet.js +1 -0
- package/esm/graphql/fragments/ProductFlat.js +1 -0
- package/esm/graphql/fragments/ProductQuestion.js +1 -0
- package/esm/graphql/fragments/ProductQuestionAnswer.js +1 -0
- package/esm/graphql/fragments/ProductQuestionPage.js +1 -0
- package/esm/graphql/fragments/ProductReview.js +1 -0
- package/esm/graphql/fragments/ProductReviewAnswer.js +1 -0
- package/esm/graphql/fragments/ProductReviewAverageScore.js +1 -0
- package/esm/graphql/fragments/ProductReviewPage.js +1 -0
- package/esm/graphql/fragments/ProductReviewScore.js +1 -0
- package/esm/graphql/fragments/ProductReviewSurveyAnswer.js +1 -0
- package/esm/graphql/fragments/ProductSearchOptionAgg.js +1 -0
- package/esm/graphql/fragments/ProductSearchResult.js +1 -0
- package/esm/graphql/fragments/ReturnReason.js +1 -0
- package/esm/graphql/fragments/ReviewDimension.js +1 -0
- package/esm/graphql/fragments/ReviewDimensionSet.js +1 -0
- package/esm/graphql/fragments/ReviewImagePage.js +1 -0
- package/esm/graphql/fragments/ReviewQuestionProduct.js +1 -0
- package/esm/graphql/fragments/ReviewSettings.js +1 -0
- package/esm/graphql/fragments/SearchProduct.js +1 -0
- package/esm/graphql/fragments/Shop.js +1 -0
- package/esm/graphql/fragments/SubscriptionPlan.js +1 -0
- package/esm/graphql/fragments/SurveyQuestion.js +1 -0
- package/esm/graphql/fragments/TieredPricing.js +1 -0
- package/esm/graphql/fragments/TieredPricingTier.js +1 -0
- package/esm/graphql/fragments/VariantOption.js +1 -0
- package/esm/graphql/operations/ApplyGiftCardMutation.js +1 -0
- package/esm/graphql/operations/AuthRequestMutation.js +1 -0
- package/esm/graphql/operations/CancelOrderMutation.js +1 -0
- package/esm/graphql/operations/CancelSubscriptionMutation.js +1 -0
- package/esm/graphql/operations/ConnectOAuth2Mutation.js +1 -0
- package/esm/graphql/operations/CreateCartMutation.js +23 -0
- package/esm/graphql/operations/CreateFavoriteMutation.js +19 -0
- package/esm/graphql/operations/CreateFileMutation.js +3 -0
- package/esm/graphql/operations/CreatePaymentSourceMutation.js +3 -0
- package/esm/graphql/operations/CreateProductQuestionAnswerMutation.js +1 -0
- package/esm/graphql/operations/CreateProductQuestionMutation.js +5 -0
- package/esm/graphql/operations/CreateProductReviewMutation.js +15 -0
- package/esm/graphql/operations/CreateReturnMutation.js +19 -0
- package/esm/graphql/operations/DeleteFavoriteMutation.js +1 -0
- package/esm/graphql/operations/DeletePaymentSourceMutation.js +1 -0
- package/esm/graphql/operations/DeleteProductQuestionAnswerMutation.js +1 -0
- package/esm/graphql/operations/DeleteProductQuestionMutation.js +1 -0
- package/esm/graphql/operations/DeleteProductReviewMutation.js +1 -0
- package/esm/graphql/operations/DisconnectOAuth2Mutation.js +1 -0
- package/esm/graphql/operations/EditSubscriptionMutation.js +1 -0
- package/esm/graphql/operations/FileUploadedMutation.js +3 -0
- package/esm/graphql/operations/FlagQuestionAnswerMutation.js +1 -0
- package/esm/graphql/operations/FlagQuestionMutation.js +1 -0
- package/esm/graphql/operations/FlagReviewAnswerMutation.js +1 -0
- package/esm/graphql/operations/FlagReviewMutation.js +1 -0
- package/esm/graphql/operations/GetBrandingQuery.js +7 -0
- package/esm/graphql/operations/GetCartQuery.js +23 -0
- package/esm/graphql/operations/GetCustomerAddressesPageDataQuery.js +13 -0
- package/esm/graphql/operations/GetCustomerBalanceHistoryPageQuery.js +3 -0
- package/esm/graphql/operations/GetCustomerBalanceQuery.js +5 -0
- package/esm/graphql/operations/GetCustomerInfoQuery.js +7 -0
- package/esm/graphql/operations/GetCustomerQuery.js +5 -0
- package/esm/graphql/operations/GetFavoritesQuery.js +19 -0
- package/esm/graphql/operations/GetFileStatusQuery.js +3 -0
- package/esm/graphql/operations/GetGatewaysQuery.js +11 -0
- package/esm/graphql/operations/GetInfoCurrenciesQuery.js +3 -0
- package/esm/graphql/operations/GetLastCartQuery.js +23 -0
- package/esm/graphql/operations/GetOrderQuery.js +27 -0
- package/esm/graphql/operations/GetOrdersPageQuery.js +21 -0
- package/esm/graphql/operations/GetPaymentMethodsPageDataQuery.js +15 -0
- package/esm/graphql/operations/GetProductQuestionsPageQuery.js +7 -0
- package/esm/graphql/operations/GetProductReviewImagesPageQuery.js +5 -0
- package/esm/graphql/operations/GetProductReviewsPageQuery.js +17 -0
- package/esm/graphql/operations/GetProvincesQuery.js +3 -0
- package/esm/graphql/operations/GetQuestionQuery.js +5 -0
- package/esm/graphql/operations/GetReturnCreationInfoQuery.js +33 -0
- package/esm/graphql/operations/GetReturnQuery.js +25 -0
- package/esm/graphql/operations/GetReturnsPageQuery.js +19 -0
- package/esm/graphql/operations/GetReviewDimensionsQuery.js +3 -0
- package/esm/graphql/operations/GetReviewQuery.js +15 -0
- package/esm/graphql/operations/GetReviewSettingsQuery.js +9 -0
- package/esm/graphql/operations/GetShopCurrenciesQuery.js +3 -0
- package/esm/graphql/operations/GetShopQuery.js +5 -0
- package/esm/graphql/operations/GetSubscriptionQuery.js +33 -0
- package/esm/graphql/operations/GetSubscriptionsPageQuery.js +19 -0
- package/esm/graphql/operations/GetVariantPageQuery.js +17 -0
- package/esm/graphql/operations/LoadProductNoCustomerQuery.js +59 -0
- package/esm/graphql/operations/LoadProductQuery.js +63 -0
- package/esm/graphql/operations/ModifyCartMutation.js +23 -0
- package/esm/graphql/operations/ModifyCustomerMutation.js +5 -0
- package/esm/graphql/operations/ModifyFavoriteMutation.js +19 -0
- package/esm/graphql/operations/ModifyProductQuestionAnswerMutation.js +1 -0
- package/esm/graphql/operations/ModifyProductQuestionMutation.js +5 -0
- package/esm/graphql/operations/ModifyProductReviewMutation.js +15 -0
- package/esm/graphql/operations/NewPasswordMutation.js +1 -0
- package/esm/graphql/operations/PauseSubscriptionMutation.js +1 -0
- package/esm/graphql/operations/ResetPasswordMutation.js +1 -0
- package/esm/graphql/operations/ResumeSubscriptionMutation.js +1 -0
- package/esm/graphql/operations/SearchProductsAdvancedQuery.js +21 -0
- package/esm/graphql/operations/SearchProductsQuery.js +17 -0
- package/esm/graphql/operations/SearchQuestionsQuery.js +5 -0
- package/esm/graphql/operations/SearchReviewsQuery.js +15 -0
- package/esm/graphql/operations/SignInMutation.js +1 -0
- package/esm/graphql/operations/SignInViaEmailCompleteMutation.js +1 -0
- package/esm/graphql/operations/SignInViaEmailInitMutation.js +1 -0
- package/esm/graphql/operations/SignUpMutation.js +1 -0
- package/esm/graphql/operations/SkipNextSubscriptionMutation.js +1 -0
- package/esm/graphql/operations/UploadFileMutation.js +1 -0
- package/esm/graphql/operations/VerifyCodeMutation.js +1 -0
- package/esm/graphql/operations/VoteQuestionAnswerMutation.js +1 -0
- package/esm/graphql/operations/VoteQuestionMutation.js +1 -0
- package/esm/graphql/operations/VoteReviewAnswerMutation.js +1 -0
- package/esm/graphql/operations/VoteReviewMutation.js +1 -0
- package/esm/graphql/types.js +1 -0
- package/esm/hierarchicalSearchOption.js +43 -0
- package/esm/idgen.js +4 -0
- package/esm/ignoreQueue.js +45 -0
- package/esm/imageAltProps.js +9 -0
- package/esm/invoiceFormat.js +54 -0
- package/esm/isShippingRequired.js +16 -0
- package/esm/isoStripTrailingZeros.js +3 -0
- package/esm/json/commerce.js +3 -0
- package/esm/json/commerceFileUpload.js +43 -0
- package/esm/json/commerceTypes.js +1 -0
- package/esm/json/common.js +309 -0
- package/esm/json/fetchAllItems.js +51 -0
- package/esm/json/mutator.js +952 -0
- package/esm/json/storefront.js +3 -0
- package/esm/json/storefrontTypes.js +1 -0
- package/esm/lastValue.js +12 -0
- package/esm/lineItemPrice.js +106 -0
- package/esm/loadJWT.js +20 -0
- package/esm/mapInvalidInput.js +27 -0
- package/esm/mapResponseData.js +11 -0
- package/esm/mapResponseMultiData.js +10 -0
- package/esm/meanBy.js +11 -0
- package/esm/media.js +12 -0
- package/esm/modules/advancedSearch.js +132 -0
- package/esm/modules/cart.js +699 -0
- package/esm/modules/config/defaultAdvancedSearchGraphQLConfig.js +4 -0
- package/esm/modules/config/defaultCartGraphQLConfig.js +10 -0
- package/esm/modules/config/defaultProductGraphQLConfig.js +44 -0
- package/esm/modules/config/defaultSearchGraphQLConfig.js +4 -0
- package/esm/modules/customer.js +2198 -0
- package/esm/modules/helpers/cartInitOption.js +18 -0
- package/esm/modules/helpers/cookieConsent.js +29 -0
- package/esm/modules/helpers/customerOauth2.js +53 -0
- package/esm/modules/helpers/getOAuth2Hook.js +48 -0
- package/esm/modules/helpers/hookUpAnalytics.js +44 -0
- package/esm/modules/helpers/loadJWT.js +18 -0
- package/esm/modules/helpers/misc.js +49 -0
- package/esm/modules/imageDialog.js +71 -0
- package/esm/modules/persist.js +49 -0
- package/esm/modules/popupMessage.js +17 -0
- package/esm/modules/product.js +1278 -0
- package/esm/modules/recentlyVisitedProducts.js +70 -0
- package/esm/modules/search.js +103 -0
- package/esm/multiResponseToResponse.js +18 -0
- package/esm/nonNull.js +6 -0
- package/esm/oauthState.js +35 -0
- package/esm/orderShippingAddress.js +3 -0
- package/esm/package.json +3 -0
- package/esm/pender.js +11 -0
- package/esm/percentageOff.js +3 -0
- package/esm/popupConnectQueue.js +55 -0
- package/esm/preact/components/SixDigitInput.js +159 -0
- package/esm/preact/effector.js +69 -0
- package/esm/preact/transition/CSSTransition.js +47 -0
- package/esm/preact/transition/Transition.js +100 -0
- package/esm/preact/translateLocalStatic.js +26 -0
- package/esm/productFiltering.js +164 -0
- package/esm/productSEO.js +46 -0
- package/esm/productSorting.js +89 -0
- package/esm/promiseAll.js +11 -0
- package/esm/promiseLimit.js +32 -0
- package/esm/rdsToInitialScores.js +27 -0
- package/esm/react/components/Portal.js +2 -0
- package/esm/react/components/RootCloseWrapper.js +33 -0
- package/esm/react/components/SixDigitInput.js +158 -0
- package/esm/react/contains.js +10 -0
- package/esm/react/popperBinder.js +71 -0
- package/esm/react/rootClose.js +106 -0
- package/esm/react/translateLocalStatic.js +26 -0
- package/esm/react/useAsyncCachedValue.js +10 -0
- package/esm/refreshTimeout.js +21 -0
- package/esm/remoteAuth.js +52 -0
- package/esm/request.js +323 -0
- package/esm/requestDetails.js +69 -0
- package/esm/rfc3339Normalize.js +6 -0
- package/esm/script.js +157 -0
- package/esm/seo.js +1 -0
- package/esm/shopDomain.js +4 -0
- package/esm/shopLinks.js +47 -0
- package/esm/slate.js +364 -0
- package/esm/sleep.js +3 -0
- package/esm/splitBy.js +17 -0
- package/esm/splitName.js +22 -0
- package/esm/stripZeros.js +9 -0
- package/esm/stripeError.js +53 -0
- package/esm/tailSplit.js +8 -0
- package/esm/tieredPrice.js +28 -0
- package/esm/timeIt.js +8 -0
- package/esm/toMajor.js +4 -0
- package/esm/toMinor.js +4 -0
- package/esm/trace.js +37 -0
- package/esm/translateLocale.js +7 -0
- package/esm/traverse.js +10 -0
- package/esm/truncate.js +17 -0
- package/esm/typedLocalStorage.js +24 -0
- package/esm/variantImage.js +22 -0
- package/esm/variantImageURL.js +9 -0
- package/esm/variantImages.js +15 -0
- package/esm/variantInventory.js +38 -0
- package/esm/variantOptions.js +15 -0
- package/esm/variantPrice.js +92 -0
- package/esm/variantPriceCommerce.js +25 -0
- package/esm/variantTitle.js +5 -0
- package/esm/variantTitleFull.js +7 -0
- package/esm/variantURL.js +5 -0
- package/esm/vendor/popper/index.d.ts +160 -0
- package/esm/vendor/popper/index.js +2657 -0
- package/esm/vendor/popper/index.js.map +1 -0
- package/esm/vendor/popper/package.json +3 -0
- package/esm/websocket.js +169 -0
- package/package.json +92 -0
- package/types/actionLock.d.ts +7 -0
- package/types/addEmptyListItem.d.ts +2 -0
- package/types/aggregateOptions.d.ts +33 -0
- package/types/analytics.d.ts +23 -0
- package/types/analyticsProductData.d.ts +38 -0
- package/types/arrayToDict.d.ts +2 -0
- package/types/asyncModuleWrapper.d.ts +13 -0
- package/types/averageReviewScore.d.ts +28 -0
- package/types/buildconfig.d.ts +13 -0
- package/types/cachedLoader.d.ts +10 -0
- package/types/canonicalVariantURL.d.ts +12 -0
- package/types/cartOperation.d.ts +28 -0
- package/types/categorySEO.d.ts +17 -0
- package/types/commonTypes.d.ts +10 -0
- package/types/compact.d.ts +1 -0
- package/types/configLoader.d.ts +53 -0
- package/types/controlledQueue.d.ts +17 -0
- package/types/convertImageURL.d.ts +9 -0
- package/types/dataLoader.d.ts +301 -0
- package/types/defaultVariant.d.ts +9 -0
- package/types/effector/clearOnChangeAfterDelay.d.ts +2 -0
- package/types/effector/combineEvery.d.ts +2 -0
- package/types/effector/combineSome.d.ts +2 -0
- package/types/effector/debounced.d.ts +2 -0
- package/types/effector/form.d.ts +74 -0
- package/types/effector/hideOnChangeAfterDelay.d.ts +6 -0
- package/types/effector/requestResponse.d.ts +9 -0
- package/types/effector/requestResponseMulti.d.ts +7 -0
- package/types/effector/restoreNamed.d.ts +2 -0
- package/types/effector/split.d.ts +7 -0
- package/types/effector/validator.d.ts +14 -0
- package/types/effector/wrapSignInRequired.d.ts +2 -0
- package/types/exceptions.d.ts +2 -0
- package/types/fetchAllItems.d.ts +25 -0
- package/types/file.d.ts +4 -0
- package/types/fileWebsocket.d.ts +6 -0
- package/types/filterFunc.d.ts +8 -0
- package/types/filterFuncBrand.d.ts +3 -0
- package/types/filterFuncCategory.d.ts +3 -0
- package/types/filterFuncContentBlock.d.ts +3 -0
- package/types/filterFuncCustomer.d.ts +3 -0
- package/types/filterFuncDataFeed.d.ts +8 -0
- package/types/filterFuncOrder.d.ts +3 -0
- package/types/filterFuncPreprocess.d.ts +2 -0
- package/types/filterFuncProduct.d.ts +3 -0
- package/types/filterFuncPurchaseOrder.d.ts +3 -0
- package/types/filterFuncSupplier.d.ts +3 -0
- package/types/filterFuncTransfer.d.ts +3 -0
- package/types/formatAbbrevNumber.d.ts +6 -0
- package/types/formatCurrency.d.ts +44 -0
- package/types/formatToJSX.d.ts +24 -0
- package/types/fulfillmentNumber.d.ts +1 -0
- package/types/generateRandomToken.d.ts +1 -0
- package/types/generateUUID.d.ts +1 -0
- package/types/generated/codes.d.ts +234 -0
- package/types/genericFile.d.ts +57 -0
- package/types/getSalesChannelID.d.ts +1 -0
- package/types/getSessionID.d.ts +1 -0
- package/types/getTimezone.d.ts +1 -0
- package/types/graphql/fragments/Branding.d.ts +2 -0
- package/types/graphql/fragments/BrandingField.d.ts +2 -0
- package/types/graphql/fragments/CartCustomItem.d.ts +2 -0
- package/types/graphql/fragments/CartOrder.d.ts +2 -0
- package/types/graphql/fragments/CartVariant.d.ts +2 -0
- package/types/graphql/fragments/CartVariantFull.d.ts +2 -0
- package/types/graphql/fragments/Category.d.ts +2 -0
- package/types/graphql/fragments/CommonCartVariant.d.ts +2 -0
- package/types/graphql/fragments/Currency.d.ts +2 -0
- package/types/graphql/fragments/CurrencyPrice.d.ts +2 -0
- package/types/graphql/fragments/CustomField.d.ts +2 -0
- package/types/graphql/fragments/CustomFieldObjects.d.ts +2 -0
- package/types/graphql/fragments/Customer.d.ts +2 -0
- package/types/graphql/fragments/CustomerBalance.d.ts +2 -0
- package/types/graphql/fragments/CustomerBalanceHistory.d.ts +2 -0
- package/types/graphql/fragments/CustomerFavorite.d.ts +2 -0
- package/types/graphql/fragments/CustomerFavoriteShort.d.ts +2 -0
- package/types/graphql/fragments/CustomerOAuthProvider.d.ts +2 -0
- package/types/graphql/fragments/CustomerOrderBrief.d.ts +2 -0
- package/types/graphql/fragments/CustomerOrderFulfillment.d.ts +2 -0
- package/types/graphql/fragments/CustomerOrderFull.d.ts +2 -0
- package/types/graphql/fragments/CustomerPaymentSource.d.ts +2 -0
- package/types/graphql/fragments/CustomerReturnBrief.d.ts +2 -0
- package/types/graphql/fragments/CustomerReturnFull.d.ts +2 -0
- package/types/graphql/fragments/CustomerReturnPolicy.d.ts +2 -0
- package/types/graphql/fragments/CustomerSubscriptionBrief.d.ts +2 -0
- package/types/graphql/fragments/CustomerSubscriptionFull.d.ts +2 -0
- package/types/graphql/fragments/File.d.ts +2 -0
- package/types/graphql/fragments/FileForUpload.d.ts +2 -0
- package/types/graphql/fragments/FileNoFallback.d.ts +2 -0
- package/types/graphql/fragments/FullAddress.d.ts +2 -0
- package/types/graphql/fragments/Gateway.d.ts +2 -0
- package/types/graphql/fragments/GatewayManual.d.ts +2 -0
- package/types/graphql/fragments/GatewayPaypal.d.ts +2 -0
- package/types/graphql/fragments/GatewayStripe.d.ts +2 -0
- package/types/graphql/fragments/GatewayTest.d.ts +2 -0
- package/types/graphql/fragments/IPAndUAInfo.d.ts +2 -0
- package/types/graphql/fragments/InfoCountry.d.ts +2 -0
- package/types/graphql/fragments/InfoCountryDedupField.d.ts +2 -0
- package/types/graphql/fragments/InfoCurrency.d.ts +2 -0
- package/types/graphql/fragments/InfoProvince.d.ts +2 -0
- package/types/graphql/fragments/KeyValue.d.ts +2 -0
- package/types/graphql/fragments/LineItemField.d.ts +2 -0
- package/types/graphql/fragments/MediaFile.d.ts +2 -0
- package/types/graphql/fragments/MinCurrencyPrice.d.ts +2 -0
- package/types/graphql/fragments/ProductField.d.ts +2 -0
- package/types/graphql/fragments/ProductFieldSet.d.ts +2 -0
- package/types/graphql/fragments/ProductFlat.d.ts +2 -0
- package/types/graphql/fragments/ProductQuestion.d.ts +2 -0
- package/types/graphql/fragments/ProductQuestionAnswer.d.ts +2 -0
- package/types/graphql/fragments/ProductQuestionPage.d.ts +2 -0
- package/types/graphql/fragments/ProductReview.d.ts +2 -0
- package/types/graphql/fragments/ProductReviewAnswer.d.ts +2 -0
- package/types/graphql/fragments/ProductReviewAverageScore.d.ts +2 -0
- package/types/graphql/fragments/ProductReviewPage.d.ts +2 -0
- package/types/graphql/fragments/ProductReviewScore.d.ts +2 -0
- package/types/graphql/fragments/ProductReviewSurveyAnswer.d.ts +2 -0
- package/types/graphql/fragments/ProductSearchOptionAgg.d.ts +2 -0
- package/types/graphql/fragments/ProductSearchResult.d.ts +2 -0
- package/types/graphql/fragments/ReturnReason.d.ts +2 -0
- package/types/graphql/fragments/ReviewDimension.d.ts +2 -0
- package/types/graphql/fragments/ReviewDimensionSet.d.ts +2 -0
- package/types/graphql/fragments/ReviewImagePage.d.ts +2 -0
- package/types/graphql/fragments/ReviewQuestionProduct.d.ts +2 -0
- package/types/graphql/fragments/ReviewSettings.d.ts +2 -0
- package/types/graphql/fragments/SearchProduct.d.ts +2 -0
- package/types/graphql/fragments/Shop.d.ts +2 -0
- package/types/graphql/fragments/SubscriptionPlan.d.ts +2 -0
- package/types/graphql/fragments/SurveyQuestion.d.ts +2 -0
- package/types/graphql/fragments/TieredPricing.d.ts +2 -0
- package/types/graphql/fragments/TieredPricingTier.d.ts +2 -0
- package/types/graphql/fragments/VariantOption.d.ts +2 -0
- package/types/graphql/operations/ApplyGiftCardMutation.d.ts +3 -0
- package/types/graphql/operations/AuthRequestMutation.d.ts +3 -0
- package/types/graphql/operations/CancelOrderMutation.d.ts +3 -0
- package/types/graphql/operations/CancelSubscriptionMutation.d.ts +3 -0
- package/types/graphql/operations/ConnectOAuth2Mutation.d.ts +3 -0
- package/types/graphql/operations/CreateCartMutation.d.ts +3 -0
- package/types/graphql/operations/CreateFavoriteMutation.d.ts +3 -0
- package/types/graphql/operations/CreateFileMutation.d.ts +3 -0
- package/types/graphql/operations/CreatePaymentSourceMutation.d.ts +3 -0
- package/types/graphql/operations/CreateProductQuestionAnswerMutation.d.ts +3 -0
- package/types/graphql/operations/CreateProductQuestionMutation.d.ts +3 -0
- package/types/graphql/operations/CreateProductReviewMutation.d.ts +3 -0
- package/types/graphql/operations/CreateReturnMutation.d.ts +3 -0
- package/types/graphql/operations/DeleteFavoriteMutation.d.ts +3 -0
- package/types/graphql/operations/DeletePaymentSourceMutation.d.ts +3 -0
- package/types/graphql/operations/DeleteProductQuestionAnswerMutation.d.ts +3 -0
- package/types/graphql/operations/DeleteProductQuestionMutation.d.ts +3 -0
- package/types/graphql/operations/DeleteProductReviewMutation.d.ts +3 -0
- package/types/graphql/operations/DisconnectOAuth2Mutation.d.ts +3 -0
- package/types/graphql/operations/EditSubscriptionMutation.d.ts +3 -0
- package/types/graphql/operations/FileUploadedMutation.d.ts +3 -0
- package/types/graphql/operations/FlagQuestionAnswerMutation.d.ts +3 -0
- package/types/graphql/operations/FlagQuestionMutation.d.ts +3 -0
- package/types/graphql/operations/FlagReviewAnswerMutation.d.ts +3 -0
- package/types/graphql/operations/FlagReviewMutation.d.ts +3 -0
- package/types/graphql/operations/GetBrandingQuery.d.ts +3 -0
- package/types/graphql/operations/GetCartQuery.d.ts +3 -0
- package/types/graphql/operations/GetCustomerAddressesPageDataQuery.d.ts +3 -0
- package/types/graphql/operations/GetCustomerBalanceHistoryPageQuery.d.ts +3 -0
- package/types/graphql/operations/GetCustomerBalanceQuery.d.ts +3 -0
- package/types/graphql/operations/GetCustomerInfoQuery.d.ts +3 -0
- package/types/graphql/operations/GetCustomerQuery.d.ts +3 -0
- package/types/graphql/operations/GetFavoritesQuery.d.ts +3 -0
- package/types/graphql/operations/GetFileStatusQuery.d.ts +3 -0
- package/types/graphql/operations/GetGatewaysQuery.d.ts +3 -0
- package/types/graphql/operations/GetInfoCurrenciesQuery.d.ts +3 -0
- package/types/graphql/operations/GetLastCartQuery.d.ts +3 -0
- package/types/graphql/operations/GetOrderQuery.d.ts +3 -0
- package/types/graphql/operations/GetOrdersPageQuery.d.ts +3 -0
- package/types/graphql/operations/GetPaymentMethodsPageDataQuery.d.ts +3 -0
- package/types/graphql/operations/GetProductQuestionsPageQuery.d.ts +3 -0
- package/types/graphql/operations/GetProductReviewImagesPageQuery.d.ts +3 -0
- package/types/graphql/operations/GetProductReviewsPageQuery.d.ts +3 -0
- package/types/graphql/operations/GetProvincesQuery.d.ts +3 -0
- package/types/graphql/operations/GetQuestionQuery.d.ts +3 -0
- package/types/graphql/operations/GetReturnCreationInfoQuery.d.ts +3 -0
- package/types/graphql/operations/GetReturnQuery.d.ts +3 -0
- package/types/graphql/operations/GetReturnsPageQuery.d.ts +3 -0
- package/types/graphql/operations/GetReviewDimensionsQuery.d.ts +3 -0
- package/types/graphql/operations/GetReviewQuery.d.ts +3 -0
- package/types/graphql/operations/GetReviewSettingsQuery.d.ts +3 -0
- package/types/graphql/operations/GetShopCurrenciesQuery.d.ts +3 -0
- package/types/graphql/operations/GetShopQuery.d.ts +3 -0
- package/types/graphql/operations/GetSubscriptionQuery.d.ts +3 -0
- package/types/graphql/operations/GetSubscriptionsPageQuery.d.ts +3 -0
- package/types/graphql/operations/GetVariantPageQuery.d.ts +3 -0
- package/types/graphql/operations/LoadProductNoCustomerQuery.d.ts +3 -0
- package/types/graphql/operations/LoadProductQuery.d.ts +3 -0
- package/types/graphql/operations/ModifyCartMutation.d.ts +3 -0
- package/types/graphql/operations/ModifyCustomerMutation.d.ts +3 -0
- package/types/graphql/operations/ModifyFavoriteMutation.d.ts +3 -0
- package/types/graphql/operations/ModifyProductQuestionAnswerMutation.d.ts +3 -0
- package/types/graphql/operations/ModifyProductQuestionMutation.d.ts +3 -0
- package/types/graphql/operations/ModifyProductReviewMutation.d.ts +3 -0
- package/types/graphql/operations/NewPasswordMutation.d.ts +3 -0
- package/types/graphql/operations/PauseSubscriptionMutation.d.ts +3 -0
- package/types/graphql/operations/ResetPasswordMutation.d.ts +3 -0
- package/types/graphql/operations/ResumeSubscriptionMutation.d.ts +3 -0
- package/types/graphql/operations/SearchProductsAdvancedQuery.d.ts +3 -0
- package/types/graphql/operations/SearchProductsQuery.d.ts +3 -0
- package/types/graphql/operations/SearchQuestionsQuery.d.ts +3 -0
- package/types/graphql/operations/SearchReviewsQuery.d.ts +3 -0
- package/types/graphql/operations/SignInMutation.d.ts +3 -0
- package/types/graphql/operations/SignInViaEmailCompleteMutation.d.ts +3 -0
- package/types/graphql/operations/SignInViaEmailInitMutation.d.ts +3 -0
- package/types/graphql/operations/SignUpMutation.d.ts +3 -0
- package/types/graphql/operations/SkipNextSubscriptionMutation.d.ts +3 -0
- package/types/graphql/operations/UploadFileMutation.d.ts +3 -0
- package/types/graphql/operations/VerifyCodeMutation.d.ts +3 -0
- package/types/graphql/operations/VoteQuestionAnswerMutation.d.ts +3 -0
- package/types/graphql/operations/VoteQuestionMutation.d.ts +3 -0
- package/types/graphql/operations/VoteReviewAnswerMutation.d.ts +3 -0
- package/types/graphql/operations/VoteReviewMutation.d.ts +3 -0
- package/types/graphql/types.d.ts +2471 -0
- package/types/hierarchicalSearchOption.d.ts +14 -0
- package/types/idgen.d.ts +1 -0
- package/types/ignoreQueue.d.ts +10 -0
- package/types/imageAltProps.d.ts +11 -0
- package/types/invoiceFormat.d.ts +32 -0
- package/types/isShippingRequired.d.ts +14 -0
- package/types/isoStripTrailingZeros.d.ts +1 -0
- package/types/json/commerce.d.ts +3 -0
- package/types/json/commerceFileUpload.d.ts +20 -0
- package/types/json/commerceTypes.d.ts +15422 -0
- package/types/json/common.d.ts +81 -0
- package/types/json/fetchAllItems.d.ts +15 -0
- package/types/json/mutator.d.ts +238 -0
- package/types/json/storefront.d.ts +3 -0
- package/types/json/storefrontTypes.d.ts +5059 -0
- package/types/lastValue.d.ts +10 -0
- package/types/lineItemPrice.d.ts +18 -0
- package/types/loadJWT.d.ts +1 -0
- package/types/mapInvalidInput.d.ts +15 -0
- package/types/mapResponseData.d.ts +3 -0
- package/types/mapResponseMultiData.d.ts +2 -0
- package/types/meanBy.d.ts +1 -0
- package/types/media.d.ts +3 -0
- package/types/modules/advancedSearch.d.ts +78 -0
- package/types/modules/cart.d.ts +263 -0
- package/types/modules/config/defaultAdvancedSearchGraphQLConfig.d.ts +3 -0
- package/types/modules/config/defaultCartGraphQLConfig.d.ts +6 -0
- package/types/modules/config/defaultProductGraphQLConfig.d.ts +23 -0
- package/types/modules/config/defaultSearchGraphQLConfig.d.ts +3 -0
- package/types/modules/customer.d.ts +624 -0
- package/types/modules/helpers/cartInitOption.d.ts +2 -0
- package/types/modules/helpers/cookieConsent.d.ts +4 -0
- package/types/modules/helpers/customerOauth2.d.ts +19 -0
- package/types/modules/helpers/getOAuth2Hook.d.ts +22 -0
- package/types/modules/helpers/hookUpAnalytics.d.ts +21 -0
- package/types/modules/helpers/loadJWT.d.ts +1 -0
- package/types/modules/helpers/misc.d.ts +14 -0
- package/types/modules/imageDialog.d.ts +31 -0
- package/types/modules/persist.d.ts +13 -0
- package/types/modules/popupMessage.d.ts +9 -0
- package/types/modules/product.d.ts +320 -0
- package/types/modules/recentlyVisitedProducts.d.ts +25 -0
- package/types/modules/search.d.ts +54 -0
- package/types/multiResponseToResponse.d.ts +2 -0
- package/types/nonNull.d.ts +1 -0
- package/types/oauthState.d.ts +3 -0
- package/types/orderShippingAddress.d.ts +6 -0
- package/types/pender.d.ts +5 -0
- package/types/percentageOff.d.ts +1 -0
- package/types/popupConnectQueue.d.ts +41 -0
- package/types/preact/components/SixDigitInput.d.ts +28 -0
- package/types/preact/effector.d.ts +8 -0
- package/types/preact/transition/CSSTransition.d.ts +8 -0
- package/types/preact/transition/Transition.d.ts +30 -0
- package/types/preact/translateLocalStatic.d.ts +4 -0
- package/types/productFiltering.d.ts +58 -0
- package/types/productSEO.d.ts +59 -0
- package/types/productSorting.d.ts +35 -0
- package/types/promiseAll.d.ts +5 -0
- package/types/promiseLimit.d.ts +13 -0
- package/types/rdsToInitialScores.d.ts +26 -0
- package/types/react/components/Portal.d.ts +2 -0
- package/types/react/components/RootCloseWrapper.d.ts +18 -0
- package/types/react/components/SixDigitInput.d.ts +27 -0
- package/types/react/contains.d.ts +1 -0
- package/types/react/popperBinder.d.ts +23 -0
- package/types/react/rootClose.d.ts +18 -0
- package/types/react/translateLocalStatic.d.ts +4 -0
- package/types/react/useAsyncCachedValue.d.ts +2 -0
- package/types/refreshTimeout.d.ts +5 -0
- package/types/remoteAuth.d.ts +14 -0
- package/types/request.d.ts +104 -0
- package/types/requestDetails.d.ts +16 -0
- package/types/rfc3339Normalize.d.ts +1 -0
- package/types/script.d.ts +36 -0
- package/types/seo.d.ts +5 -0
- package/types/shopDomain.d.ts +7 -0
- package/types/shopLinks.d.ts +14 -0
- package/types/slate.d.ts +47 -0
- package/types/sleep.d.ts +1 -0
- package/types/splitBy.d.ts +1 -0
- package/types/splitName.d.ts +2 -0
- package/types/stripZeros.d.ts +1 -0
- package/types/stripeError.d.ts +14 -0
- package/types/tailSplit.d.ts +1 -0
- package/types/tieredPrice.d.ts +2 -0
- package/types/timeIt.d.ts +1 -0
- package/types/toMajor.d.ts +8 -0
- package/types/toMinor.d.ts +8 -0
- package/types/trace.d.ts +17 -0
- package/types/translateLocale.d.ts +2 -0
- package/types/traverse.d.ts +1 -0
- package/types/truncate.d.ts +7 -0
- package/types/typedLocalStorage.d.ts +3 -0
- package/types/variantImage.d.ts +16 -0
- package/types/variantImageURL.d.ts +25 -0
- package/types/variantImages.d.ts +11 -0
- package/types/variantInventory.d.ts +14 -0
- package/types/variantOptions.d.ts +18 -0
- package/types/variantPrice.d.ts +37 -0
- package/types/variantPriceCommerce.d.ts +26 -0
- package/types/variantTitle.d.ts +7 -0
- package/types/variantTitleFull.d.ts +11 -0
- package/types/variantURL.d.ts +7 -0
- package/types/websocket.d.ts +33 -0
|
@@ -0,0 +1,957 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Mutator = exports.deferredJSONObject = exports.NullLogger = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const commerceFileUpload_js_1 = require("./commerceFileUpload.js");
|
|
6
|
+
const commerce_js_1 = require("./commerce.js");
|
|
7
|
+
const promiseLimit_js_1 = require("../promiseLimit.js");
|
|
8
|
+
const genericFile_js_1 = require("../genericFile.js");
|
|
9
|
+
const generateUUID_js_1 = require("../generateUUID.js");
|
|
10
|
+
const trace_js_1 = require("..//trace.js");
|
|
11
|
+
const traverse_js_1 = require("../traverse.js");
|
|
12
|
+
const fileWebsocket_js_1 = require("../fileWebsocket.js");
|
|
13
|
+
function isUnresolvedID(id) {
|
|
14
|
+
return id.startsWith(":TMPID:");
|
|
15
|
+
}
|
|
16
|
+
function unID(kind) {
|
|
17
|
+
return `:TMPID:${kind}:${(0, generateUUID_js_1.generateUUID)()}`;
|
|
18
|
+
}
|
|
19
|
+
function extractUniqueUnresolvedIDs(obj) {
|
|
20
|
+
const allIDs = new Set();
|
|
21
|
+
(0, traverse_js_1.traverse)(obj, (_obj, _prop, value) => {
|
|
22
|
+
if (typeof value === "string" && isUnresolvedID(value)) {
|
|
23
|
+
allIDs.add(value);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
return Array.from(allIDs.keys());
|
|
27
|
+
}
|
|
28
|
+
class NullLogger {
|
|
29
|
+
line() { }
|
|
30
|
+
bar() {
|
|
31
|
+
return { start: () => { }, stop: () => { }, increment: () => { } };
|
|
32
|
+
}
|
|
33
|
+
tree() { }
|
|
34
|
+
}
|
|
35
|
+
exports.NullLogger = NullLogger;
|
|
36
|
+
function collectNextBatch(resolvedItems, queue) {
|
|
37
|
+
const out = {
|
|
38
|
+
collected: [],
|
|
39
|
+
remaining: [],
|
|
40
|
+
};
|
|
41
|
+
for (const q of queue) {
|
|
42
|
+
if (q.items.length === 0)
|
|
43
|
+
continue;
|
|
44
|
+
const itemsReady = q.items.map((item) => item.deps.every((dep) => resolvedItems.has(dep)));
|
|
45
|
+
const itemsReadyCount = itemsReady.reduce((count, b) => count + (b ? 1 : 0), 0);
|
|
46
|
+
if (itemsReadyCount === q.items.length) {
|
|
47
|
+
out.collected.push(q);
|
|
48
|
+
}
|
|
49
|
+
else if (itemsReadyCount > 0) {
|
|
50
|
+
// split batch
|
|
51
|
+
out.collected.push(q.extractItems((_item, idx) => itemsReady[idx]));
|
|
52
|
+
out.remaining.push(q);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
out.remaining.push(q);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
60
|
+
function normalizeName(name) {
|
|
61
|
+
if (typeof name === "string") {
|
|
62
|
+
return { singular: name, plural: name };
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
return name;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function plur(v) {
|
|
69
|
+
return {
|
|
70
|
+
singular: v.replace("(s)", ""),
|
|
71
|
+
plural: v.replace("(s)", "s"),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function formatName(name, n) {
|
|
75
|
+
return n === 1 ? name.singular : name.plural;
|
|
76
|
+
}
|
|
77
|
+
//--------------------------------------------------------------------------------------------------------------------
|
|
78
|
+
//--------------------------------------------------------------------------------------------------------------------
|
|
79
|
+
//--------------------------------------------------------------------------------------------------------------------
|
|
80
|
+
function applyResolvedIDs(obj, resolvedIDs) {
|
|
81
|
+
(0, traverse_js_1.traverse)(obj, (obj, prop, value) => {
|
|
82
|
+
if (typeof value === "string" && isUnresolvedID(value)) {
|
|
83
|
+
const rid = resolvedIDs.get(value);
|
|
84
|
+
if (!rid)
|
|
85
|
+
throw new Error(`unresolved id: ${value}`);
|
|
86
|
+
obj[prop] = rid;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
// important to do this after ID resolving
|
|
90
|
+
(0, traverse_js_1.traverse)(obj, (obj, prop, value) => {
|
|
91
|
+
if (value !== null && typeof value === "object" && value.__deferredJSONObject === true) {
|
|
92
|
+
obj[prop] = JSON.stringify(value.value);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function applyResolvedIDsToItems(items, resolvedIDs) {
|
|
97
|
+
for (const { item } of items) {
|
|
98
|
+
applyResolvedIDs(item, resolvedIDs);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
// the type here is very evil, be sure to use this function only within the mutator context and for a specific need
|
|
102
|
+
// e.g. as custom_fields[].value
|
|
103
|
+
function deferredJSONObject(value) {
|
|
104
|
+
return {
|
|
105
|
+
value,
|
|
106
|
+
__deferredJSONObject: true,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
exports.deferredJSONObject = deferredJSONObject;
|
|
110
|
+
//--------------------------------------------------------------------------------------------------------------------
|
|
111
|
+
//--------------------------------------------------------------------------------------------------------------------
|
|
112
|
+
//--------------------------------------------------------------------------------------------------------------------
|
|
113
|
+
const jsonify = (v) => JSON.stringify(v, null, 2);
|
|
114
|
+
//--------------------------------------------------------------------------------------------------------------------
|
|
115
|
+
//--------------------------------------------------------------------------------------------------------------------
|
|
116
|
+
//--------------------------------------------------------------------------------------------------------------------
|
|
117
|
+
function chunk(input, size) {
|
|
118
|
+
return input.reduce((arr, item, idx) => {
|
|
119
|
+
return idx % size === 0 ? [...arr, [item]] : [...arr.slice(0, -1), [...arr.slice(-1)[0], item]];
|
|
120
|
+
}, []);
|
|
121
|
+
}
|
|
122
|
+
//--------------------------------------------------------------------------------------------------------------------
|
|
123
|
+
//--------------------------------------------------------------------------------------------------------------------
|
|
124
|
+
//--------------------------------------------------------------------------------------------------------------------
|
|
125
|
+
function itemByItemProcessor(name, resolveItem) {
|
|
126
|
+
const normalizedName = normalizeName(name);
|
|
127
|
+
return (ectx, ctx, items, resolvedIDs) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
128
|
+
const resolveItemImpl = (item) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
129
|
+
const result = yield ectx.enqueue(normalizedName, 1, () => resolveItem(ctx, item));
|
|
130
|
+
if (result === null)
|
|
131
|
+
return [item.id, ""];
|
|
132
|
+
if (!result)
|
|
133
|
+
throw new Error(`unsuccessful API call\nitem: ${jsonify(item)}`);
|
|
134
|
+
if (Array.isArray(result)) {
|
|
135
|
+
if (result.length !== 1)
|
|
136
|
+
throw new Error(`unsuccessful API call\nitem: ${jsonify(item)}`);
|
|
137
|
+
return [item.id, result[0].id];
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
return [item.id, result.id];
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
applyResolvedIDsToItems(items, resolvedIDs);
|
|
144
|
+
if (ectx.opts.sequential) {
|
|
145
|
+
const out = [];
|
|
146
|
+
for (const item of items) {
|
|
147
|
+
out.push(yield resolveItemImpl(item));
|
|
148
|
+
}
|
|
149
|
+
return out;
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
return Promise.all(items.map(resolveItemImpl));
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
function resultToIDMap(props, items, result) {
|
|
157
|
+
if (!result) {
|
|
158
|
+
throw new Error(`unsuccessful batch API call\nprops: ${jsonify(props)}\nitems: ${jsonify(items)}`);
|
|
159
|
+
}
|
|
160
|
+
if (items.length !== result.length) {
|
|
161
|
+
throw new Error(`mismatching number of items\nprops: ${jsonify(props)}\nitems: ${jsonify(items)}\nresult: ${jsonify(result)}`);
|
|
162
|
+
}
|
|
163
|
+
return items.map((item, idx) => [item.id, result[idx].id]);
|
|
164
|
+
}
|
|
165
|
+
function batchProcessor(name, perBatch, groupBy, resolveItems) {
|
|
166
|
+
const normalizedName = normalizeName(name);
|
|
167
|
+
return (ectx, ctx, items, resolvedIDs) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
168
|
+
applyResolvedIDsToItems(items, resolvedIDs);
|
|
169
|
+
// group items
|
|
170
|
+
const groupsMap = new Map();
|
|
171
|
+
for (const item of items) {
|
|
172
|
+
const key = groupBy(item.item);
|
|
173
|
+
let group = groupsMap.get(key);
|
|
174
|
+
if (!group) {
|
|
175
|
+
group = { props: item.item, items: [] };
|
|
176
|
+
groupsMap.set(key, group);
|
|
177
|
+
}
|
|
178
|
+
group.items.push(item);
|
|
179
|
+
}
|
|
180
|
+
const groups = Array.from(groupsMap.values());
|
|
181
|
+
let result = [];
|
|
182
|
+
if (ectx.opts.sequential) {
|
|
183
|
+
for (const { props, items } of groups) {
|
|
184
|
+
const r1 = [];
|
|
185
|
+
const batches = chunk(items, perBatch);
|
|
186
|
+
for (const items of batches) {
|
|
187
|
+
const result = yield ectx.enqueue(normalizedName, items.length, () => resolveItems(ctx, props, items));
|
|
188
|
+
if (result === null)
|
|
189
|
+
return [];
|
|
190
|
+
r1.push(resultToIDMap(props, items, result));
|
|
191
|
+
}
|
|
192
|
+
result.push(r1);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
result = yield Promise.all(groups.map(({ props, items }) => {
|
|
197
|
+
return Promise.all(chunk(items, perBatch).map((items) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
198
|
+
const result = yield ectx.enqueue(normalizedName, items.length, () => resolveItems(ctx, props, items));
|
|
199
|
+
if (result === null)
|
|
200
|
+
return [];
|
|
201
|
+
return resultToIDMap(props, items, result);
|
|
202
|
+
})));
|
|
203
|
+
}));
|
|
204
|
+
}
|
|
205
|
+
// flatten result
|
|
206
|
+
return result.reduce((a, b) => a.concat(b), []).reduce((a, b) => a.concat(b), []);
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
class StatsExecuteContext {
|
|
210
|
+
constructor(name, opts, progressCallback) {
|
|
211
|
+
this.progressCallback = progressCallback;
|
|
212
|
+
this.opts = opts;
|
|
213
|
+
this.stats = { name, stats: new Map(), secondsElapsed: +new Date() };
|
|
214
|
+
this.limit = new promiseLimit_js_1.PromiseLimiter(opts.sequential ? 1 : 20);
|
|
215
|
+
}
|
|
216
|
+
done() {
|
|
217
|
+
this.stats.secondsElapsed = (+new Date() - this.stats.secondsElapsed) / 1000;
|
|
218
|
+
}
|
|
219
|
+
enqueue(name, quantity, f) {
|
|
220
|
+
var _a;
|
|
221
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
222
|
+
const stats = this.stats.stats;
|
|
223
|
+
let s = stats.get(name);
|
|
224
|
+
if (!s) {
|
|
225
|
+
s = { apiCalls: 0, objects: 0, secondsElapsed: 0 };
|
|
226
|
+
stats.set(name, s);
|
|
227
|
+
}
|
|
228
|
+
const t0 = +new Date();
|
|
229
|
+
const result = yield this.limit.run((tid) => {
|
|
230
|
+
return (0, trace_js_1.trace)(tid, `${quantity} ${formatName(name, quantity)}`, () => f());
|
|
231
|
+
});
|
|
232
|
+
const t1 = +new Date();
|
|
233
|
+
s.secondsElapsed += (t1 - t0) / 1000;
|
|
234
|
+
s.apiCalls++;
|
|
235
|
+
s.objects += quantity;
|
|
236
|
+
(_a = this.progressCallback) === null || _a === void 0 ? void 0 : _a.call(this, quantity);
|
|
237
|
+
return result;
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
function batchShopIDAndReqCreator(batcher, name, desc, ep) {
|
|
242
|
+
return makeQueue(batcher, name, batchProcessor(desc, 30, (props) => props.shopID, (ctx, props, items) => {
|
|
243
|
+
return ep(ctx)
|
|
244
|
+
.shop_id(props.shopID)
|
|
245
|
+
.data(items.map((v) => v.item.req))
|
|
246
|
+
.sendUnwrap();
|
|
247
|
+
}), (q, shopID, req) => {
|
|
248
|
+
const uid = q.unID();
|
|
249
|
+
q.push(uid, { shopID, req });
|
|
250
|
+
return uid;
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
function batchShopIDAndReqModifier(batcher, name, desc, ep) {
|
|
254
|
+
return makeQueue(batcher, name, batchProcessor(desc, 30, (props) => props.shopID, (ctx, props, items) => {
|
|
255
|
+
return ep(ctx)
|
|
256
|
+
.ids(items.map((v) => v.item.id))
|
|
257
|
+
.data(items.map((v) => v.item.req))
|
|
258
|
+
.shop_id(props.shopID)
|
|
259
|
+
.sendUnwrap();
|
|
260
|
+
}), (q, shopID, id, req) => {
|
|
261
|
+
const uid = q.unID();
|
|
262
|
+
q.push(uid, { shopID, id, req });
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
function batchShopIDAndReqAndLocaleModifier(batcher, name, desc, ep) {
|
|
266
|
+
return makeQueue(batcher, name, batchProcessor(desc, 30, (props) => `${props.shopID}:${props.locale}`, (ctx, props, items) => {
|
|
267
|
+
const lctx = Object.assign(Object.assign({}, ctx), { locale: props.locale });
|
|
268
|
+
return ep(lctx)
|
|
269
|
+
.ids(items.map((v) => v.item.id))
|
|
270
|
+
.data(items.map((v) => v.item.req))
|
|
271
|
+
.shop_id(props.shopID)
|
|
272
|
+
.sendUnwrap();
|
|
273
|
+
}), (q, shopID, id, req, locale) => {
|
|
274
|
+
const uid = q.unID();
|
|
275
|
+
q.push(uid, { locale, shopID, id, req });
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
function batchShopIDAndIDDeletor(batcher, name, desc, ep) {
|
|
279
|
+
return makeQueue(batcher, name, batchProcessor(desc, 30, (props) => props.shopID, (ctx, props, items) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
280
|
+
yield ep(ctx)
|
|
281
|
+
.ids(items.map((v) => v.id))
|
|
282
|
+
.shop_id(props.shopID)
|
|
283
|
+
.sendUnwrap();
|
|
284
|
+
return null;
|
|
285
|
+
})), (q, shopID, id) => {
|
|
286
|
+
const uid = q.unID();
|
|
287
|
+
q.push(uid, { shopID, id, req: null });
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
class GenericQueueItemCollection {
|
|
291
|
+
constructor(_name, _processor) {
|
|
292
|
+
this._name = _name;
|
|
293
|
+
this._processor = _processor;
|
|
294
|
+
this._queue = [];
|
|
295
|
+
this._id = (0, generateUUID_js_1.generateUUID)();
|
|
296
|
+
}
|
|
297
|
+
get id() {
|
|
298
|
+
return this._id;
|
|
299
|
+
}
|
|
300
|
+
get items() {
|
|
301
|
+
return this._queue;
|
|
302
|
+
}
|
|
303
|
+
get processor() {
|
|
304
|
+
return this._processor;
|
|
305
|
+
}
|
|
306
|
+
unID() {
|
|
307
|
+
return unID(this._name);
|
|
308
|
+
}
|
|
309
|
+
push(id, item) {
|
|
310
|
+
const deps = extractUniqueUnresolvedIDs(item);
|
|
311
|
+
this._queue.push({ id, deps, item });
|
|
312
|
+
}
|
|
313
|
+
extractItems(cond) {
|
|
314
|
+
const result = this._queue.reduce((accum, item, idx) => {
|
|
315
|
+
(cond(item, idx) ? accum.extracted : accum.remaining).push(item);
|
|
316
|
+
return accum;
|
|
317
|
+
}, { extracted: [], remaining: [] });
|
|
318
|
+
this._queue = result.remaining;
|
|
319
|
+
const c = new GenericQueueItemCollection(this._name, this._processor);
|
|
320
|
+
c._queue = result.extracted;
|
|
321
|
+
return c;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
class Batch {
|
|
325
|
+
constructor() {
|
|
326
|
+
this.queues = new Map();
|
|
327
|
+
}
|
|
328
|
+
get allQueues() {
|
|
329
|
+
const out = [];
|
|
330
|
+
this.queues.forEach((val) => {
|
|
331
|
+
out.push(val);
|
|
332
|
+
});
|
|
333
|
+
return out;
|
|
334
|
+
}
|
|
335
|
+
// Note that when processing multiple batches with cross batch dependencies (see barrier()), this
|
|
336
|
+
// function needs to be aware of previously resolved IDs, hence these are provided via argument.
|
|
337
|
+
topoSort(resolvedIDs) {
|
|
338
|
+
const out = [];
|
|
339
|
+
const resolvedItems = new Set(resolvedIDs);
|
|
340
|
+
let remaining = this.allQueues;
|
|
341
|
+
while (true) {
|
|
342
|
+
if (remaining.length === 0)
|
|
343
|
+
break;
|
|
344
|
+
const nextBatch = collectNextBatch(resolvedItems, remaining);
|
|
345
|
+
if (nextBatch.collected.length === 0) {
|
|
346
|
+
const items = [];
|
|
347
|
+
remaining.forEach((q) => {
|
|
348
|
+
q.items.forEach((item) => {
|
|
349
|
+
items.push(`${item.id}: ${item.deps.join(", ")}`);
|
|
350
|
+
});
|
|
351
|
+
});
|
|
352
|
+
throw new Error(`unable to resolve dependencies, remaining items:\n${items.join("\n")}`);
|
|
353
|
+
}
|
|
354
|
+
for (const q of nextBatch.collected) {
|
|
355
|
+
for (const item of q.items) {
|
|
356
|
+
resolvedItems.add(item.id);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
out.push(nextBatch.collected);
|
|
360
|
+
remaining = nextBatch.remaining;
|
|
361
|
+
}
|
|
362
|
+
return out;
|
|
363
|
+
}
|
|
364
|
+
numberOfItems() {
|
|
365
|
+
let n = 0;
|
|
366
|
+
for (const q of this.allQueues) {
|
|
367
|
+
n += q.items.length;
|
|
368
|
+
}
|
|
369
|
+
return n;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
function makeQueue(batcher, name, itemProcessor, f) {
|
|
373
|
+
return ((...args) => {
|
|
374
|
+
const b = batcher.currentBatch;
|
|
375
|
+
let q = b.queues.get(name);
|
|
376
|
+
if (!q) {
|
|
377
|
+
q = new GenericQueueItemCollection(name, itemProcessor);
|
|
378
|
+
b.queues.set(name, q);
|
|
379
|
+
}
|
|
380
|
+
return f(q, ...args);
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
class Mutator {
|
|
384
|
+
constructor(opts) {
|
|
385
|
+
this.batches = [new Batch()];
|
|
386
|
+
this.shop = makeQueue(this, "shop", itemByItemProcessor(plur("shop(s) created"), (ctx, { item }) => {
|
|
387
|
+
return (0, commerce_js_1.request)(ctx, `POST:shops.json`).data([item.req]).sendUnwrap();
|
|
388
|
+
}), (q, req) => {
|
|
389
|
+
const uid = q.unID();
|
|
390
|
+
q.push(uid, { req });
|
|
391
|
+
return uid;
|
|
392
|
+
});
|
|
393
|
+
this.shopModify = makeQueue(this, "shopModify", itemByItemProcessor(plur("shop(s) modified"), (ctx, { item }) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
394
|
+
yield (0, commerce_js_1.request)(ctx, `POST:shops.json`).shop_id(item.shopID).data([item.req]).sendUnwrap();
|
|
395
|
+
return null;
|
|
396
|
+
})), (q, shopID, req) => {
|
|
397
|
+
const uid = q.unID();
|
|
398
|
+
q.push(uid, { shopID, req });
|
|
399
|
+
});
|
|
400
|
+
this.shopSettings = makeQueue(this, "shopSettings", itemByItemProcessor(plur("shop settings applied"), (ctx, { item }) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
401
|
+
yield (0, commerce_js_1.request)(ctx, `POST:shops/settings.json`).shop_id(item.shopID).data(item.req).sendUnwrap();
|
|
402
|
+
return null;
|
|
403
|
+
})), (q, shopID, req) => {
|
|
404
|
+
const uid = q.unID();
|
|
405
|
+
q.push(uid, { shopID, req });
|
|
406
|
+
});
|
|
407
|
+
this.taxRule = batchShopIDAndReqCreator(this, "taxRule", plur("tax rule(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:tax_rules.json`));
|
|
408
|
+
this.taxRuleModify = batchShopIDAndReqModifier(this, "taxRuleModify", plur("tax rule(s) modified"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:tax_rules.json`));
|
|
409
|
+
this.taxRuleDelete = batchShopIDAndIDDeletor(this, "taxRuleDelete", plur("tax rule(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:tax_rules.json`));
|
|
410
|
+
this.taxRulesAddDefault = makeQueue(this, "taxRulesAddDefault", itemByItemProcessor(plur("default tax rule(s) added"), (ctx, { item }) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
411
|
+
yield (0, commerce_js_1.request)(ctx, `POST:tax_rules/add_default.json`).shop_id(item.shopID).country(item.country).sendUnwrap();
|
|
412
|
+
return null;
|
|
413
|
+
})), (q, shopID, country) => {
|
|
414
|
+
const uid = q.unID();
|
|
415
|
+
q.push(uid, { shopID, country, req: null });
|
|
416
|
+
});
|
|
417
|
+
this.returnReason = batchShopIDAndReqCreator(this, "returnReason", plur("return reason(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:return_reasons.json`));
|
|
418
|
+
this.returnReasonModify = batchShopIDAndReqModifier(this, "returnReasonModify", plur("return reason(s) modified"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:return_reasons.json`));
|
|
419
|
+
this.returnReasonDelete = batchShopIDAndIDDeletor(this, "returnReasonDelete", plur("return reason(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:return_reasons.json`));
|
|
420
|
+
this.returnReasonsAddDefault = makeQueue(this, "returnReasonsAddDefault", itemByItemProcessor(plur("default return reason(s) added"), (ctx, { item }) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
421
|
+
yield (0, commerce_js_1.request)(ctx, `POST:return_reasons/add_default.json`).shop_id(item.shopID).sendUnwrap();
|
|
422
|
+
return null;
|
|
423
|
+
})), (q, shopID) => {
|
|
424
|
+
const uid = q.unID();
|
|
425
|
+
q.push(uid, { shopID, req: null });
|
|
426
|
+
});
|
|
427
|
+
this.returnInspectionsAddDefault = makeQueue(this, "returnInspectionsAddDefault", itemByItemProcessor(plur("default return inspection(s) added"), (ctx, { item }) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
428
|
+
yield (0, commerce_js_1.request)(ctx, `POST:return_inspections/add_default.json`).shop_id(item.shopID).sendUnwrap();
|
|
429
|
+
return null;
|
|
430
|
+
})), (q, shopID) => {
|
|
431
|
+
const uid = q.unID();
|
|
432
|
+
q.push(uid, { shopID, req: null });
|
|
433
|
+
});
|
|
434
|
+
this.inventoryLocation = batchShopIDAndReqCreator(this, "inventoryLocation", plur("inventory location(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:inventory_locations.json`));
|
|
435
|
+
this.inventoryLocationModify = batchShopIDAndReqAndLocaleModifier(this, "inventoryLocationModify", plur("inventory location(s) modified"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:inventory_locations.json`));
|
|
436
|
+
this.gateway = makeQueue(this, "gateway", itemByItemProcessor(plur("gateway(s) created"), (ctx, { item }) => {
|
|
437
|
+
return (0, commerce_js_1.request)(ctx, `POST:gateways.json`).shop_id(item.shopID).data([item.req]).sendUnwrap();
|
|
438
|
+
}), (q, shopID, req) => {
|
|
439
|
+
const uid = q.unID();
|
|
440
|
+
q.push(uid, { shopID, req });
|
|
441
|
+
return uid;
|
|
442
|
+
});
|
|
443
|
+
this.gatewayModify = makeQueue(this, "gatewayModify", itemByItemProcessor(plur("gateway(s) modified"), (ctx, { item }) => {
|
|
444
|
+
const lctx = Object.assign(Object.assign({}, ctx), { locale: item.locale });
|
|
445
|
+
return (0, commerce_js_1.request)(lctx, `POST:gateways.json`).ids([item.id]).shop_id(item.shopID).data([item.req]).sendUnwrap();
|
|
446
|
+
}), (q, shopID, id, req, locale) => {
|
|
447
|
+
const uid = q.unID();
|
|
448
|
+
q.push(uid, { locale, shopID, id, req });
|
|
449
|
+
});
|
|
450
|
+
this.gatewayDelete = makeQueue(this, "gatewayDelete", itemByItemProcessor(plur("gateway(s) deleted"), (ctx, { item }) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
451
|
+
yield (0, commerce_js_1.request)(ctx, `DELETE:gateways.json`).ids([item.id]).shop_id(item.shopID).sendUnwrap();
|
|
452
|
+
return null;
|
|
453
|
+
})), (q, shopID, id) => {
|
|
454
|
+
const uid = q.unID();
|
|
455
|
+
q.push(uid, { shopID, id, req: null });
|
|
456
|
+
});
|
|
457
|
+
this.webhook = batchShopIDAndReqCreator(this, "webhook", plur("webhook(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:webhooks.json`));
|
|
458
|
+
this.webhookModify = batchShopIDAndReqModifier(this, "webhookModify", plur("webhook(s) modified"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:webhooks.json`));
|
|
459
|
+
this.webhookDelete = batchShopIDAndIDDeletor(this, "webhookDelete", plur("webhook(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:webhooks.json`));
|
|
460
|
+
this.shippingProvider = batchShopIDAndReqCreator(this, "shippingProvider", plur("shipping provider(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:shipping_providers.json`));
|
|
461
|
+
this.shippingProviderModify = batchShopIDAndReqAndLocaleModifier(this, "shippingProviderModify", plur("shipping provider(s) modified"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:shipping_providers.json`));
|
|
462
|
+
this.shippingProviderDelete = batchShopIDAndIDDeletor(this, "shippingProviderDelete", plur("shipping provider(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:shipping_providers.json`));
|
|
463
|
+
this.shippingRule = batchShopIDAndReqCreator(this, "shippingRule", plur("shipping rule(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:shipping_rules.json`));
|
|
464
|
+
this.shippingRuleModify = batchShopIDAndReqModifier(this, "shippingRuleModify", plur("shipping rule(s) modified"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:shipping_rules.json`));
|
|
465
|
+
this.shippingRuleDelete = batchShopIDAndIDDeletor(this, "shippingRuleDelete", plur("shipping rule(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:shipping_rules.json`));
|
|
466
|
+
this.promotion = batchShopIDAndReqCreator(this, "promotion", plur("promotion(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:promotions.json`));
|
|
467
|
+
this.promotionModify = batchShopIDAndReqModifier(this, "promotionModify", plur("promotion(s) modified"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:promotions.json`));
|
|
468
|
+
this.promotionDelete = batchShopIDAndIDDeletor(this, "promotionDelete", plur("promotion(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:promotions.json`));
|
|
469
|
+
this.coupon = makeQueue(this, "coupon", batchProcessor(plur("coupon(s) created"), 30, (props) => `${props.shopID}:${props.promotionID}`, (ctx, props, items) => {
|
|
470
|
+
return (0, commerce_js_1.request)(ctx, `POST:coupons.json`)
|
|
471
|
+
.shop_id(props.shopID)
|
|
472
|
+
.promotion_id(props.promotionID)
|
|
473
|
+
.data(items.map((v) => v.item.req))
|
|
474
|
+
.sendUnwrap();
|
|
475
|
+
}), (q, shopID, promotionID, req) => {
|
|
476
|
+
const uid = q.unID();
|
|
477
|
+
q.push(uid, { shopID, promotionID, req });
|
|
478
|
+
return uid;
|
|
479
|
+
});
|
|
480
|
+
this.couponDelete = batchShopIDAndIDDeletor(this, "couponDelete", plur("coupon(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:coupons.json`));
|
|
481
|
+
this.domain = batchShopIDAndReqCreator(this, "domain", plur("domain(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:domains.json`));
|
|
482
|
+
this.domainDelete = batchShopIDAndIDDeletor(this, "domainDelete", plur("domain(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:domains.json`));
|
|
483
|
+
this.reviewDimension = batchShopIDAndReqCreator(this, "reviewDimension", plur("review dimension(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:review_dimensions.json`));
|
|
484
|
+
this.reviewDimensionModify = batchShopIDAndReqAndLocaleModifier(this, "reviewDimensionModify", plur("review dimension(s) modified"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:review_dimensions.json`));
|
|
485
|
+
this.reviewDimensionDelete = batchShopIDAndIDDeletor(this, "reviewDimensionDelete", plur("review dimension(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:review_dimensions.json`));
|
|
486
|
+
this.reviewDimensionSet = batchShopIDAndReqCreator(this, "reviewDimensionSet", plur("review dimension set(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:review_dimension_sets.json`));
|
|
487
|
+
this.reviewDimensionSetModify = batchShopIDAndReqModifier(this, "reviewDimensionSetModify", plur("review dimension set(s) modified"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:review_dimension_sets.json`));
|
|
488
|
+
this.reviewDimensionSetDelete = batchShopIDAndIDDeletor(this, "reviewDimensionSetDelete", plur("review dimension set(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:review_dimension_sets.json`));
|
|
489
|
+
this.customer = batchShopIDAndReqCreator(this, "customer", plur("customer(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:customers.json`));
|
|
490
|
+
this.customerModify = batchShopIDAndReqModifier(this, "customerModify", plur("customer(s) modified"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:customers.json`));
|
|
491
|
+
this.customerDelete = batchShopIDAndIDDeletor(this, "customerDelete", plur("customer(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:customers.json`));
|
|
492
|
+
this.category = batchShopIDAndReqCreator(this, "category", { singular: "category created", plural: "categories created" }, (ctx) => (0, commerce_js_1.request)(ctx, `POST:categories.json`));
|
|
493
|
+
this.categoryModify = makeQueue(this, "categoryModify", itemByItemProcessor({ singular: "category modified", plural: "categories modified" }, (ctx, { item }) => {
|
|
494
|
+
const lctx = Object.assign(Object.assign({}, ctx), { locale: item.locale });
|
|
495
|
+
return (0, commerce_js_1.request)(lctx, `POST:categories.json`).ids([item.id]).shop_id(item.shopID).data([item.req]).sendUnwrap();
|
|
496
|
+
}), (q, shopID, id, req, locale) => {
|
|
497
|
+
const uid = q.unID();
|
|
498
|
+
q.push(uid, { locale, shopID, id, req });
|
|
499
|
+
});
|
|
500
|
+
this.categoryDelete = batchShopIDAndIDDeletor(this, "categoryDelete", { singular: "category deleted", plural: "categories deleted" }, (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:categories.json`));
|
|
501
|
+
this.brand = batchShopIDAndReqCreator(this, "brand", plur("brand(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:brands.json`));
|
|
502
|
+
this.brandModify = makeQueue(this, "brandModify", itemByItemProcessor(plur("brand(s) modified"), (ctx, { item }) => {
|
|
503
|
+
const lctx = Object.assign(Object.assign({}, ctx), { locale: item.locale });
|
|
504
|
+
return (0, commerce_js_1.request)(lctx, `POST:brands.json`).ids([item.id]).shop_id(item.shopID).data([item.req]).sendUnwrap();
|
|
505
|
+
}), (q, shopID, id, req, locale) => {
|
|
506
|
+
const uid = q.unID();
|
|
507
|
+
q.push(uid, { locale, shopID, id, req });
|
|
508
|
+
});
|
|
509
|
+
this.brandDelete = batchShopIDAndIDDeletor(this, "brandDelete", plur("brand(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:brands.json`));
|
|
510
|
+
this.contentBlock = batchShopIDAndReqCreator(this, "contentBlock", plur("content block(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:content_blocks.json`));
|
|
511
|
+
this.contentBlockModify = makeQueue(this, "contentBlockModify", itemByItemProcessor(plur("content block(s) modified"), (ctx, { item }) => {
|
|
512
|
+
const lctx = Object.assign(Object.assign({}, ctx), { locale: item.locale });
|
|
513
|
+
return (0, commerce_js_1.request)(lctx, `POST:content_blocks.json`)
|
|
514
|
+
.ids([item.id])
|
|
515
|
+
.shop_id(item.shopID)
|
|
516
|
+
.data([item.req])
|
|
517
|
+
.sendUnwrap();
|
|
518
|
+
}), (q, shopID, id, req, locale) => {
|
|
519
|
+
const uid = q.unID();
|
|
520
|
+
q.push(uid, { locale, shopID, id, req });
|
|
521
|
+
});
|
|
522
|
+
this.contentBlockDelete = batchShopIDAndIDDeletor(this, "contentBlockDelete", plur("content block(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:content_blocks.json`));
|
|
523
|
+
this.contentModel = batchShopIDAndReqCreator(this, "contentModel", plur("content model(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:content_models.json`));
|
|
524
|
+
this.contentModelModify = batchShopIDAndReqAndLocaleModifier(this, "contentModelModify", plur("content model(s) modified"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:content_models.json`));
|
|
525
|
+
this.contentModelDelete = batchShopIDAndIDDeletor(this, "contentModelDelete", plur("content model(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:content_models.json`));
|
|
526
|
+
this.menu = makeQueue(this, "menu", itemByItemProcessor(plur("menu(s) created"), (ctx, { item }) => {
|
|
527
|
+
return (0, commerce_js_1.request)(ctx, `POST:menus.json`).shop_id(item.shopID).data([item.req]).sendUnwrap();
|
|
528
|
+
}), (q, shopID, req) => {
|
|
529
|
+
const uid = q.unID();
|
|
530
|
+
q.push(uid, { shopID, req });
|
|
531
|
+
return uid;
|
|
532
|
+
});
|
|
533
|
+
this.menuModify = makeQueue(this, "menuModify", itemByItemProcessor(plur("menu(s) modified"), (ctx, { item }) => {
|
|
534
|
+
const lctx = Object.assign(Object.assign({}, ctx), { locale: item.locale });
|
|
535
|
+
return (0, commerce_js_1.request)(lctx, `POST:menus.json`).ids([item.id]).shop_id(item.shopID).data([item.req]).sendUnwrap();
|
|
536
|
+
}), (q, shopID, id, req, locale) => {
|
|
537
|
+
const uid = q.unID();
|
|
538
|
+
q.push(uid, { locale, shopID, id, req });
|
|
539
|
+
});
|
|
540
|
+
this.menuDelete = batchShopIDAndIDDeletor(this, "menuDelete", plur("menu(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:menus.json`));
|
|
541
|
+
this.option = batchShopIDAndReqCreator(this, "option", plur("option(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:options.json`));
|
|
542
|
+
this.optionModify = batchShopIDAndReqAndLocaleModifier(this, "optionModify", plur("option(s) modified"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:options.json`));
|
|
543
|
+
this.optionDelete = batchShopIDAndIDDeletor(this, "optionDelete", plur("option(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:options.json`));
|
|
544
|
+
this.surveyQuestion = batchShopIDAndReqCreator(this, "surveyQuestion", plur("survey question(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:survey_questions.json`));
|
|
545
|
+
this.surveyQuestionModify = batchShopIDAndReqAndLocaleModifier(this, "surveyQuestionModify", plur("survey question(s) modified"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:survey_questions.json`));
|
|
546
|
+
this.surveyQuestionDelete = batchShopIDAndIDDeletor(this, "surveyQuestionDelete", plur("survey question(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:survey_questions.json`));
|
|
547
|
+
this.uploadFile = makeQueue(this, "uploadFile", itemByItemProcessor(plur("file(s) uploaded"), (ctx, { item }) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
548
|
+
let result;
|
|
549
|
+
if (ctx.ws && ctx.token) {
|
|
550
|
+
result = yield (0, fileWebsocket_js_1.uploadFileWebsocket)({
|
|
551
|
+
api: new commerceFileUpload_js_1.CommerceFileUploadAPI(ctx),
|
|
552
|
+
data: item.data,
|
|
553
|
+
name: item.name,
|
|
554
|
+
contentType: item.contentType,
|
|
555
|
+
size: item.data.byteLength,
|
|
556
|
+
shopID: item.shopID,
|
|
557
|
+
storage: item.storage,
|
|
558
|
+
jwt: ctx.token,
|
|
559
|
+
ws: ctx.ws,
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
else {
|
|
563
|
+
result = yield (0, genericFile_js_1.uploadFileGeneric)({
|
|
564
|
+
api: new commerceFileUpload_js_1.CommerceFileUploadAPI(ctx),
|
|
565
|
+
data: item.data,
|
|
566
|
+
name: item.name,
|
|
567
|
+
contentType: item.contentType,
|
|
568
|
+
size: item.data.byteLength,
|
|
569
|
+
shopID: item.shopID,
|
|
570
|
+
storage: item.storage,
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
if (result.kind !== "ok") {
|
|
574
|
+
throw new Error(`file upload failure: ${result.kind}`);
|
|
575
|
+
}
|
|
576
|
+
return [{ id: result.file.id }];
|
|
577
|
+
})), (q, shopID, name, data, contentType, storage) => {
|
|
578
|
+
const uid = q.unID();
|
|
579
|
+
q.push(uid, {
|
|
580
|
+
shopID,
|
|
581
|
+
name,
|
|
582
|
+
data,
|
|
583
|
+
contentType,
|
|
584
|
+
storage,
|
|
585
|
+
req: null,
|
|
586
|
+
});
|
|
587
|
+
return uid;
|
|
588
|
+
});
|
|
589
|
+
this.customerNote = makeQueue(this, "customerNote", batchProcessor(plur("customer note(s) created"), 30, (props) => `${props.shopID}:${props.customerID}`, (ctx, props, items) => {
|
|
590
|
+
return (0, commerce_js_1.request)(ctx, `POST:customer_notes.json`)
|
|
591
|
+
.customer_id(props.customerID)
|
|
592
|
+
.data(items.map((v) => v.item.req))
|
|
593
|
+
.shop_id(props.shopID)
|
|
594
|
+
.sendUnwrap();
|
|
595
|
+
}), (q, shopID, customerID, req) => {
|
|
596
|
+
const uid = q.unID();
|
|
597
|
+
q.push(uid, { shopID, customerID, req });
|
|
598
|
+
return uid;
|
|
599
|
+
});
|
|
600
|
+
this.customerNoteModify = makeQueue(this, "customerNoteModify", batchProcessor(plur("customer note(s) modified"), 30, (props) => `${props.shopID}:${props.customerID}`, (ctx, props, items) => {
|
|
601
|
+
return (0, commerce_js_1.request)(ctx, `POST:customer_notes.json`)
|
|
602
|
+
.ids(items.map((v) => v.item.id))
|
|
603
|
+
.customer_id(props.customerID)
|
|
604
|
+
.data(items.map((v) => v.item.req))
|
|
605
|
+
.shop_id(props.shopID)
|
|
606
|
+
.sendUnwrap();
|
|
607
|
+
}), (q, shopID, customerID, id, req) => {
|
|
608
|
+
const uid = q.unID();
|
|
609
|
+
q.push(uid, { shopID, id, customerID, req });
|
|
610
|
+
});
|
|
611
|
+
this.customerNoteDelete = makeQueue(this, "customerNoteDelete", batchProcessor(plur("customer note(s) deleted"), 30, (props) => `${props.shopID}:${props.customerID}`, (ctx, props, items) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
612
|
+
yield (0, commerce_js_1.request)(ctx, `DELETE:customer_notes.json`)
|
|
613
|
+
.ids(items.map((v) => v.item.id))
|
|
614
|
+
.customer_id(props.customerID)
|
|
615
|
+
.shop_id(props.shopID)
|
|
616
|
+
.sendUnwrap();
|
|
617
|
+
return null;
|
|
618
|
+
})), (q, shopID, customerID, id) => {
|
|
619
|
+
const uid = q.unID();
|
|
620
|
+
q.push(uid, { shopID, id, customerID, req: null });
|
|
621
|
+
});
|
|
622
|
+
this.orderNote = makeQueue(this, "orderNote", batchProcessor(plur("order note(s) created"), 30, (props) => `${props.shopID}:${props.orderID}`, (ctx, props, items) => {
|
|
623
|
+
return (0, commerce_js_1.request)(ctx, `POST:order_notes.json`)
|
|
624
|
+
.order_id(props.orderID)
|
|
625
|
+
.data(items.map((v) => v.item.req))
|
|
626
|
+
.shop_id(props.shopID)
|
|
627
|
+
.sendUnwrap();
|
|
628
|
+
}), (q, shopID, orderID, req) => {
|
|
629
|
+
const uid = q.unID();
|
|
630
|
+
q.push(uid, { shopID, orderID, req });
|
|
631
|
+
return uid;
|
|
632
|
+
});
|
|
633
|
+
this.orderNoteModify = makeQueue(this, "orderNoteModify", batchProcessor(plur("order note(s) modified"), 30, (props) => `${props.shopID}:${props.orderID}`, (ctx, props, items) => {
|
|
634
|
+
return (0, commerce_js_1.request)(ctx, `POST:order_notes.json`)
|
|
635
|
+
.ids(items.map((v) => v.item.id))
|
|
636
|
+
.order_id(props.orderID)
|
|
637
|
+
.data(items.map((v) => v.item.req))
|
|
638
|
+
.shop_id(props.shopID)
|
|
639
|
+
.sendUnwrap();
|
|
640
|
+
}), (q, shopID, orderID, id, req) => {
|
|
641
|
+
const uid = q.unID();
|
|
642
|
+
q.push(uid, { shopID, id, orderID, req });
|
|
643
|
+
});
|
|
644
|
+
this.orderNoteDelete = makeQueue(this, "orderNoteDelete", batchProcessor(plur("order note(s) deleted"), 30, (props) => `${props.shopID}:${props.orderID}`, (ctx, props, items) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
645
|
+
yield (0, commerce_js_1.request)(ctx, `DELETE:order_notes.json`)
|
|
646
|
+
.ids(items.map((v) => v.item.id))
|
|
647
|
+
.order_id(props.orderID)
|
|
648
|
+
.shop_id(props.shopID)
|
|
649
|
+
.sendUnwrap();
|
|
650
|
+
return null;
|
|
651
|
+
})), (q, shopID, orderID, id) => {
|
|
652
|
+
const uid = q.unID();
|
|
653
|
+
q.push(uid, { shopID, id, orderID, req: null });
|
|
654
|
+
});
|
|
655
|
+
this.purchaseOrderNote = makeQueue(this, "purchaseOrderNote", batchProcessor(plur("purchase order note(s) created"), 30, (props) => `${props.shopID}:${props.purchaseOrderID}`, (ctx, props, items) => {
|
|
656
|
+
return (0, commerce_js_1.request)(ctx, `POST:purchase_order_notes.json`)
|
|
657
|
+
.purchase_order_id(props.purchaseOrderID)
|
|
658
|
+
.data(items.map((v) => v.item.req))
|
|
659
|
+
.shop_id(props.shopID)
|
|
660
|
+
.sendUnwrap();
|
|
661
|
+
}), (q, shopID, purchaseOrderID, req) => {
|
|
662
|
+
const uid = q.unID();
|
|
663
|
+
q.push(uid, { shopID, purchaseOrderID, req });
|
|
664
|
+
return uid;
|
|
665
|
+
});
|
|
666
|
+
this.purchaseOrderNoteModify = makeQueue(this, "purchaseOrderNoteModify", batchProcessor(plur("purchase order note(s) modified"), 30, (props) => `${props.shopID}:${props.purchaseOrderID}`, (ctx, props, items) => {
|
|
667
|
+
return (0, commerce_js_1.request)(ctx, `POST:purchase_order_notes.json`)
|
|
668
|
+
.ids(items.map((v) => v.item.id))
|
|
669
|
+
.purchase_order_id(props.purchaseOrderID)
|
|
670
|
+
.data(items.map((v) => v.item.req))
|
|
671
|
+
.shop_id(props.shopID)
|
|
672
|
+
.sendUnwrap();
|
|
673
|
+
}), (q, shopID, purchaseOrderID, id, req) => {
|
|
674
|
+
const uid = q.unID();
|
|
675
|
+
q.push(uid, { shopID, id, purchaseOrderID, req });
|
|
676
|
+
});
|
|
677
|
+
this.purchaseOrderNoteDelete = makeQueue(this, "purchaseOrderNoteDelete", batchProcessor(plur("purchase order note(s) deleted"), 30, (props) => `${props.shopID}:${props.purchaseOrderID}`, (ctx, props, items) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
678
|
+
yield (0, commerce_js_1.request)(ctx, `DELETE:purchase_order_notes.json`)
|
|
679
|
+
.ids(items.map((v) => v.item.id))
|
|
680
|
+
.purchase_order_id(props.purchaseOrderID)
|
|
681
|
+
.shop_id(props.shopID)
|
|
682
|
+
.sendUnwrap();
|
|
683
|
+
return null;
|
|
684
|
+
})), (q, shopID, purchaseOrderID, id) => {
|
|
685
|
+
const uid = q.unID();
|
|
686
|
+
q.push(uid, { shopID, id, purchaseOrderID, req: null });
|
|
687
|
+
});
|
|
688
|
+
this.transferNote = makeQueue(this, "transferNote", batchProcessor(plur("transfer note(s) created"), 30, (props) => `${props.shopID}:${props.transferID}`, (ctx, props, items) => {
|
|
689
|
+
return (0, commerce_js_1.request)(ctx, `POST:purchase_order_notes.json`)
|
|
690
|
+
.purchase_order_id(props.transferID)
|
|
691
|
+
.data(items.map((v) => v.item.req))
|
|
692
|
+
.shop_id(props.shopID)
|
|
693
|
+
.sendUnwrap();
|
|
694
|
+
}), (q, shopID, transferID, req) => {
|
|
695
|
+
const uid = q.unID();
|
|
696
|
+
q.push(uid, { shopID, transferID, req });
|
|
697
|
+
return uid;
|
|
698
|
+
});
|
|
699
|
+
this.transferNoteModify = makeQueue(this, "transferNoteModify", batchProcessor(plur("transfer note(s) modified"), 30, (props) => `${props.shopID}:${props.transferID}`, (ctx, props, items) => {
|
|
700
|
+
return (0, commerce_js_1.request)(ctx, `POST:transfer_notes.json`)
|
|
701
|
+
.ids(items.map((v) => v.item.id))
|
|
702
|
+
.transfer_id(props.transferID)
|
|
703
|
+
.data(items.map((v) => v.item.req))
|
|
704
|
+
.shop_id(props.shopID)
|
|
705
|
+
.sendUnwrap();
|
|
706
|
+
}), (q, shopID, transferID, id, req) => {
|
|
707
|
+
const uid = q.unID();
|
|
708
|
+
q.push(uid, { shopID, id, transferID, req });
|
|
709
|
+
});
|
|
710
|
+
this.transferNoteDelete = makeQueue(this, "transferNoteDelete", batchProcessor(plur("transfer note(s) deleted"), 30, (props) => `${props.shopID}:${props.transferID}`, (ctx, props, items) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
711
|
+
yield (0, commerce_js_1.request)(ctx, `DELETE:transfer_notes.json`)
|
|
712
|
+
.ids(items.map((v) => v.item.id))
|
|
713
|
+
.transfer_id(props.transferID)
|
|
714
|
+
.shop_id(props.shopID)
|
|
715
|
+
.sendUnwrap();
|
|
716
|
+
return null;
|
|
717
|
+
})), (q, shopID, transferID, id) => {
|
|
718
|
+
const uid = q.unID();
|
|
719
|
+
q.push(uid, { shopID, id, transferID, req: null });
|
|
720
|
+
});
|
|
721
|
+
this.order = batchShopIDAndReqCreator(this, "order", plur("order(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:orders.json`));
|
|
722
|
+
this.orderModify = batchShopIDAndReqModifier(this, "orderModify", plur("order(s) modified"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:orders.json`));
|
|
723
|
+
this.orderDelete = batchShopIDAndIDDeletor(this, "orderDelete", plur("order(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:orders.json`));
|
|
724
|
+
this.purchaseOrder = batchShopIDAndReqCreator(this, "purchaseOrder", plur("purchase order(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:purchase_orders.json`));
|
|
725
|
+
this.purchaseOrderModify = batchShopIDAndReqModifier(this, "purchaseOrderModify", plur("purchase order(s) modified"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:purchase_orders.json`));
|
|
726
|
+
this.purchaseOrderDelete = batchShopIDAndIDDeletor(this, "purchaseOrderDelete", plur("purchase order(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:purchase_orders.json`));
|
|
727
|
+
this.transfer = batchShopIDAndReqCreator(this, "transfer", plur("transfer(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:transfers.json`));
|
|
728
|
+
this.transferModify = batchShopIDAndReqModifier(this, "transferModify", plur("transfer(s) modified"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:transfers.json`));
|
|
729
|
+
this.transferDelete = batchShopIDAndIDDeletor(this, "transferDelete", plur("transfer(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:transfers.json`));
|
|
730
|
+
this.supplier = batchShopIDAndReqCreator(this, "supplier", plur("supplier(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:suppliers.json`));
|
|
731
|
+
this.supplierModify = batchShopIDAndReqModifier(this, "supplierModify", plur("supplier(s) modified"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:suppliers.json`));
|
|
732
|
+
this.supplierDelete = batchShopIDAndIDDeletor(this, "supplierDelete", plur("supplier(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:suppliers.json`));
|
|
733
|
+
this.packaging = batchShopIDAndReqCreator(this, "packaging", plur("packaging configuration(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:packaging.json`));
|
|
734
|
+
this.packagingModify = batchShopIDAndReqModifier(this, "packagingModify", plur("packaging configuration(s) modified"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:packaging.json`));
|
|
735
|
+
this.packagingDelete = batchShopIDAndIDDeletor(this, "packagingDelete", plur("packaging configuration(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:packaging.json`));
|
|
736
|
+
this.invitation = batchShopIDAndReqCreator(this, "invitation", plur("invitation(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:invitations.json`));
|
|
737
|
+
this.invitationDelete = batchShopIDAndIDDeletor(this, "invitationDelete", plur("invitation(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:invitations.json`));
|
|
738
|
+
this.buyLink = batchShopIDAndReqCreator(this, "buyLink", plur("buy link(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:buy_links.json`));
|
|
739
|
+
this.buyLinkModify = batchShopIDAndReqModifier(this, "buyLinkModify", plur("buy link(s) modified"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:buy_links.json`));
|
|
740
|
+
this.buyLinkDelete = batchShopIDAndIDDeletor(this, "buyLinkDelete", plur("buy link(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:buy_links.json`));
|
|
741
|
+
this.customerGroup = batchShopIDAndReqCreator(this, "customerGroup", plur("customer group(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:customer_groups.json`));
|
|
742
|
+
this.customerGroupModify = batchShopIDAndReqModifier(this, "customerGroupModify", plur("customer group(s) modified"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:customer_groups.json`));
|
|
743
|
+
this.customerGroupDelete = batchShopIDAndIDDeletor(this, "customerGroupDelete", plur("customer group(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:customer_groups.json`));
|
|
744
|
+
this.dataFeed = batchShopIDAndReqCreator(this, "dataFeed", plur("data feed(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:data_feeds.json`));
|
|
745
|
+
this.dataFeedModify = batchShopIDAndReqModifier(this, "dataFeedModify", plur("data feed(s) modified"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:data_feeds.json`));
|
|
746
|
+
this.dataFeedDelete = batchShopIDAndIDDeletor(this, "dataFeedDelete", plur("data feed(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:data_feeds.json`));
|
|
747
|
+
this.inventoryRule = batchShopIDAndReqCreator(this, "inventoryRule", plur("inventory rule(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:inventory_rules.json`));
|
|
748
|
+
this.inventoryRuleModify = batchShopIDAndReqModifier(this, "inventoryRuleModify", plur("inventory rule(s) modified"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:inventory_rules.json`));
|
|
749
|
+
this.inventoryRuleDelete = batchShopIDAndIDDeletor(this, "inventoryRuleDelete", plur("inventory rule(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:inventory_rules.json`));
|
|
750
|
+
this.returnInspection = batchShopIDAndReqCreator(this, "returnInspection", plur("return inspection(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:return_inspections.json`));
|
|
751
|
+
this.returnInspectionModify = batchShopIDAndReqModifier(this, "returnInspectionModify", plur("return inspection(s) modified"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:return_inspections.json`));
|
|
752
|
+
this.returnInspectionDelete = batchShopIDAndIDDeletor(this, "returnInspectionDelete", plur("return inspection(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:return_inspections.json`));
|
|
753
|
+
this.scheduledFulfillment = makeQueue(this, "scheduledFulfillment", batchProcessor(plur("scheduled fulfillment(s) created"), 30, (props) => `${props.shopID}:${props.orderID}`, (ctx, props, items) => {
|
|
754
|
+
return (0, commerce_js_1.request)(ctx, `POST:scheduled_fulfillments.json`)
|
|
755
|
+
.shop_id(props.shopID)
|
|
756
|
+
.order_id(props.orderID)
|
|
757
|
+
.data(items.map((v) => v.item.req))
|
|
758
|
+
.sendUnwrap();
|
|
759
|
+
}), (q, shopID, orderID, req) => {
|
|
760
|
+
const uid = q.unID();
|
|
761
|
+
q.push(uid, { shopID, orderID, req });
|
|
762
|
+
return uid;
|
|
763
|
+
});
|
|
764
|
+
this.scheduledFulfillmentModify = makeQueue(this, "scheduledFulfillmentModify", batchProcessor(plur("scheduled fulfillment(s) modified"), 30, (props) => `${props.shopID}:${props.orderID}`, (ctx, props, items) => {
|
|
765
|
+
return (0, commerce_js_1.request)(ctx, `POST:scheduled_fulfillments.json`)
|
|
766
|
+
.ids(items.map((v) => v.item.id))
|
|
767
|
+
.shop_id(props.shopID)
|
|
768
|
+
.order_id(props.orderID)
|
|
769
|
+
.data(items.map((v) => v.item.req))
|
|
770
|
+
.sendUnwrap();
|
|
771
|
+
}), (q, shopID, orderID, id, req) => {
|
|
772
|
+
const uid = q.unID();
|
|
773
|
+
q.push(uid, { shopID, orderID, id, req });
|
|
774
|
+
});
|
|
775
|
+
this.scheduledFulfillmentDelete = makeQueue(this, "scheduledFulfillmentDelete", batchProcessor(plur("scheduled fulfillment(s) deleted"), 30, (props) => `${props.shopID}:${props.orderID}`, (ctx, props, items) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
776
|
+
yield (0, commerce_js_1.request)(ctx, `DELETE:scheduled_fulfillments.json`)
|
|
777
|
+
.ids(items.map((v) => v.id))
|
|
778
|
+
.order_id(props.orderID)
|
|
779
|
+
.shop_id(props.shopID)
|
|
780
|
+
.sendUnwrap();
|
|
781
|
+
return null;
|
|
782
|
+
})), (q, shopID, orderID, id) => {
|
|
783
|
+
const uid = q.unID();
|
|
784
|
+
q.push(uid, { shopID, id, orderID, req: null });
|
|
785
|
+
});
|
|
786
|
+
this.role = batchShopIDAndReqCreator(this, "role", plur("role(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:roles.json`));
|
|
787
|
+
this.roleModify = batchShopIDAndReqModifier(this, "roleModify", plur("role(s) modified"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:roles.json`));
|
|
788
|
+
this.roleDelete = batchShopIDAndIDDeletor(this, "roleDelete", plur("role(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:roles.json`));
|
|
789
|
+
this.returnPolicy = batchShopIDAndReqCreator(this, "returnPolicy", { plural: "return policies created", singular: "return policy created" }, (ctx) => (0, commerce_js_1.request)(ctx, `POST:return_policies.json`));
|
|
790
|
+
this.returnPolicyModify = batchShopIDAndReqModifier(this, "returnPolicyModify", { plural: "return policies modified", singular: "return policy modified" }, (ctx) => (0, commerce_js_1.request)(ctx, `POST:return_policies.json`));
|
|
791
|
+
this.returnPolicyDelete = batchShopIDAndIDDeletor(this, "returnPolicyDelete", { plural: "return policies deleted", singular: "return policy deleted" }, (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:return_policies.json`));
|
|
792
|
+
this.optionSet = batchShopIDAndReqCreator(this, "optionSet", plur("option set(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:option_sets.json`));
|
|
793
|
+
this.optionSetModify = batchShopIDAndReqModifier(this, "optionSetModify", plur("option set(s) modified"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:option_sets.json`));
|
|
794
|
+
this.optionSetDelete = batchShopIDAndIDDeletor(this, "optionSetDelete", plur("option set(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:option_sets.json`));
|
|
795
|
+
this.productFieldSet = batchShopIDAndReqCreator(this, "productFieldSet", plur("product field set(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:product_field_sets.json`));
|
|
796
|
+
this.productFieldSetModify = batchShopIDAndReqAndLocaleModifier(this, "productFieldSetModify", plur("product field set(s) modified"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:product_field_sets.json`));
|
|
797
|
+
this.productFieldSetDelete = batchShopIDAndIDDeletor(this, "productFieldSetDelete", plur("product field set(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:product_field_sets.json`));
|
|
798
|
+
this.key = batchShopIDAndReqCreator(this, "key", plur("key(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:keys.json`));
|
|
799
|
+
this.keyModify = batchShopIDAndReqModifier(this, "keyModify", plur("key(s) modified"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:keys.json`));
|
|
800
|
+
this.keyDelete = batchShopIDAndIDDeletor(this, "keyDelete", plur("key(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:keys.json`));
|
|
801
|
+
this.product = batchShopIDAndReqCreator(this, "product", plur("product(s) created"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:products.json`));
|
|
802
|
+
this.productModify = batchShopIDAndReqAndLocaleModifier(this, "productModify", plur("product(s) modified"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:products.json`));
|
|
803
|
+
this.productDelete = batchShopIDAndIDDeletor(this, "productDelete", plur("product(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:products.json`));
|
|
804
|
+
this.variant = makeQueue(this, "variant", batchProcessor(plur("product variant(s) created"), 30, (props) => props.shopID, (ctx, props, items) => {
|
|
805
|
+
return (0, commerce_js_1.request)(ctx, `POST:product_variants.json`)
|
|
806
|
+
.shop_id(props.shopID)
|
|
807
|
+
.data(items.map((v) => (Object.assign(Object.assign({}, v.item.req), { product_id: v.item.productID }))))
|
|
808
|
+
.sendUnwrap();
|
|
809
|
+
}), (q, shopID, productID, req) => {
|
|
810
|
+
const uid = q.unID();
|
|
811
|
+
q.push(uid, { shopID, productID, req });
|
|
812
|
+
return uid;
|
|
813
|
+
});
|
|
814
|
+
this.variantModify = batchShopIDAndReqAndLocaleModifier(this, "variantModify", plur("product variant(s) modified"), (ctx) => (0, commerce_js_1.request)(ctx, `POST:product_variants.json`));
|
|
815
|
+
this.variantDelete = batchShopIDAndIDDeletor(this, "variantDelete", plur("product variant(s) deleted"), (ctx) => (0, commerce_js_1.request)(ctx, `DELETE:product_variants.json`));
|
|
816
|
+
this.currency = makeQueue(this, "currency", batchProcessor({ singular: "currency created", plural: "currencies created" }, 30, (props) => props.shopID, (ctx, props, items) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
817
|
+
yield (0, commerce_js_1.request)(ctx, `POST:currencies.json`)
|
|
818
|
+
.shop_id(props.shopID)
|
|
819
|
+
.data(items.map((v) => v.item.req))
|
|
820
|
+
.sendUnwrap();
|
|
821
|
+
return null;
|
|
822
|
+
})), (q, shopID, req) => {
|
|
823
|
+
const uid = q.unID();
|
|
824
|
+
q.push(uid, { shopID, req });
|
|
825
|
+
return uid;
|
|
826
|
+
});
|
|
827
|
+
this.review = makeQueue(this, "review", batchProcessor(plur("review(s) created"), 30, (props) => `${props.shopID}:${props.req.product_id}`, (ctx, props, items) => {
|
|
828
|
+
return (0, commerce_js_1.request)(ctx, `POST:product_reviews.json`)
|
|
829
|
+
.shop_id(props.shopID)
|
|
830
|
+
.data(items.map((v) => v.item.req))
|
|
831
|
+
.sendUnwrap();
|
|
832
|
+
}), (q, shopID, req) => {
|
|
833
|
+
const uid = q.unID();
|
|
834
|
+
q.push(uid, { shopID, req });
|
|
835
|
+
return uid;
|
|
836
|
+
});
|
|
837
|
+
this.question = makeQueue(this, "question", batchProcessor(plur("question(s) created"), 30, (props) => `${props.shopID}:${props.req.product_id}`, (ctx, props, items) => {
|
|
838
|
+
return (0, commerce_js_1.request)(ctx, `POST:product_questions.json`)
|
|
839
|
+
.shop_id(props.shopID)
|
|
840
|
+
.data(items.map((v) => v.item.req))
|
|
841
|
+
.sendUnwrap();
|
|
842
|
+
}), (q, shopID, req) => {
|
|
843
|
+
const uid = q.unID();
|
|
844
|
+
q.push(uid, { shopID, req });
|
|
845
|
+
return uid;
|
|
846
|
+
});
|
|
847
|
+
this.variantInventory = makeQueue(this, "variantInventory", batchProcessor({ singular: "inventory entry set", plural: "inventory entries set" }, 30, (props) => `${props.shopID}:${props.variantID}`, (ctx, props, items) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
848
|
+
yield (0, commerce_js_1.request)(ctx, `POST:variant_inventory.json`)
|
|
849
|
+
.shop_id(props.shopID)
|
|
850
|
+
.variant_id(props.variantID)
|
|
851
|
+
.data(items.map((v) => v.item.req))
|
|
852
|
+
.sendUnwrap();
|
|
853
|
+
return null;
|
|
854
|
+
})), (q, shopID, variantID, req) => {
|
|
855
|
+
const uid = q.unID();
|
|
856
|
+
q.push(uid, { shopID, variantID, req });
|
|
857
|
+
return uid;
|
|
858
|
+
});
|
|
859
|
+
this.opts = opts || {};
|
|
860
|
+
}
|
|
861
|
+
get currentBatch() {
|
|
862
|
+
const n = this.batches.length;
|
|
863
|
+
return this.batches[n - 1];
|
|
864
|
+
}
|
|
865
|
+
barrier(desc, data, func) {
|
|
866
|
+
if (desc && func) {
|
|
867
|
+
this.currentBatch.barrier = { desc, data, func };
|
|
868
|
+
}
|
|
869
|
+
this.batches.push(new Batch());
|
|
870
|
+
}
|
|
871
|
+
countTotalNumberOfItems() {
|
|
872
|
+
let totalItems = 0;
|
|
873
|
+
for (const b of this.batches) {
|
|
874
|
+
totalItems += b.numberOfItems();
|
|
875
|
+
if (b.barrier) {
|
|
876
|
+
totalItems++;
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
return totalItems;
|
|
880
|
+
}
|
|
881
|
+
execute(ctx, logger = new NullLogger()) {
|
|
882
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
883
|
+
const t0 = +new Date();
|
|
884
|
+
const resolvedIDs = new Map();
|
|
885
|
+
const ectx = {
|
|
886
|
+
batchNum: 0,
|
|
887
|
+
numTotal: this.countTotalNumberOfItems(),
|
|
888
|
+
numComplete: 0,
|
|
889
|
+
};
|
|
890
|
+
logger.line(`╒═══════════════════════════════════════════════════════════════════╕`);
|
|
891
|
+
logger.line(`│ Executing (${ectx.numTotal} items)`.padEnd(68, " ") + "│");
|
|
892
|
+
logger.line(`├───────────────────────────────────────────────────────────────────┘`);
|
|
893
|
+
for (const b of this.batches) {
|
|
894
|
+
for (const batch of b.topoSort(resolvedIDs.keys())) {
|
|
895
|
+
const batchStr = `Batch #${++ectx.batchNum}`;
|
|
896
|
+
const bar = logger.bar("└─ {job} [{bar}] | {percentage}% | ETA: {eta}s | {value}/{total}");
|
|
897
|
+
const statsExecuteContext = new StatsExecuteContext(batchStr, this.opts, (v) => {
|
|
898
|
+
bar.increment(v);
|
|
899
|
+
ectx.numComplete += v;
|
|
900
|
+
});
|
|
901
|
+
bar.start(ectx.numTotal, ectx.numComplete, { job: batchStr });
|
|
902
|
+
let result = [];
|
|
903
|
+
if (this.opts.sequential) {
|
|
904
|
+
for (const b of batch) {
|
|
905
|
+
result.push(yield b.processor(statsExecuteContext, ctx, b.items, resolvedIDs));
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
else {
|
|
909
|
+
result = yield Promise.all(batch.map((b) => b.processor(statsExecuteContext, ctx, b.items, resolvedIDs)));
|
|
910
|
+
}
|
|
911
|
+
statsExecuteContext.done();
|
|
912
|
+
bar.stop();
|
|
913
|
+
const newIDs = result.reduce((a, b) => a.concat(b), []);
|
|
914
|
+
for (const [key, val] of newIDs) {
|
|
915
|
+
resolvedIDs.set(key, val);
|
|
916
|
+
}
|
|
917
|
+
// report stats
|
|
918
|
+
const bstats = {};
|
|
919
|
+
const tree = {
|
|
920
|
+
[`${batchStr} [${statsExecuteContext.stats.secondsElapsed.toFixed(3)}s]`]: bstats,
|
|
921
|
+
};
|
|
922
|
+
for (const [name, stat] of Array.from(statsExecuteContext.stats.stats.entries())) {
|
|
923
|
+
const apiCalls = stat.apiCalls === 1 ? `1 api call` : `${stat.apiCalls} api calls`;
|
|
924
|
+
const nm = formatName(name, stat.objects);
|
|
925
|
+
bstats[`${stat.objects} ${nm} (${apiCalls}) [${stat.secondsElapsed.toFixed(3)}s]`] = "";
|
|
926
|
+
}
|
|
927
|
+
logger.tree(tree);
|
|
928
|
+
}
|
|
929
|
+
if (b.barrier) {
|
|
930
|
+
const barrierStr = `Barrier #${ectx.batchNum}: ${b.barrier.desc}`;
|
|
931
|
+
const bar = logger.bar("└─ {job} [{bar}] | {percentage}% | ETA: {eta}s | {value}/{total}");
|
|
932
|
+
bar.start(ectx.numTotal, ectx.numComplete, { job: barrierStr });
|
|
933
|
+
const statsExecuteContext = new StatsExecuteContext(barrierStr, this.opts);
|
|
934
|
+
applyResolvedIDs(b.barrier.data, resolvedIDs);
|
|
935
|
+
yield b.barrier.func(b.barrier.data);
|
|
936
|
+
bar.increment();
|
|
937
|
+
ectx.numComplete++;
|
|
938
|
+
statsExecuteContext.done();
|
|
939
|
+
bar.stop();
|
|
940
|
+
const tree = {
|
|
941
|
+
[`${barrierStr} [${statsExecuteContext.stats.secondsElapsed.toFixed(3)}s]`]: {},
|
|
942
|
+
};
|
|
943
|
+
logger.tree(tree);
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
const t1 = +new Date();
|
|
947
|
+
const elapsed = (t1 - t0) / 1000;
|
|
948
|
+
logger.line(`├───────────────────────────────────────────────────────────────────┐`);
|
|
949
|
+
logger.line(`│ Total seconds elapsed: ${elapsed.toFixed(3)}s`.padEnd(68, " ") + "│");
|
|
950
|
+
logger.line(`╘═══════════════════════════════════════════════════════════════════╛`);
|
|
951
|
+
return {
|
|
952
|
+
resolvedIDs,
|
|
953
|
+
};
|
|
954
|
+
});
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
exports.Mutator = Mutator;
|