@unchainedshop/api 2.0.0-beta7 → 2.0.0-beta9
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/jest.config.js +9 -0
- package/lib/acl.d.ts +2 -0
- package/lib/acl.js +2 -2
- package/lib/acl.js.map +1 -1
- package/lib/api-index.d.ts +4 -6
- package/lib/api-index.js +5 -13
- package/lib/api-index.js.map +1 -1
- package/lib/context.d.ts +0 -1
- package/lib/context.js +0 -12
- package/lib/context.js.map +1 -1
- package/lib/createGraphQLServer.d.ts +1 -1
- package/lib/createGraphQLServer.js +13 -50
- package/lib/createGraphQLServer.js.map +1 -1
- package/lib/errors.d.ts +20 -0
- package/lib/errors.js +20 -0
- package/lib/errors.js.map +1 -1
- package/lib/express/createApolloMiddleware.d.ts +4 -0
- package/lib/express/createApolloMiddleware.js +34 -0
- package/lib/express/createApolloMiddleware.js.map +1 -0
- package/lib/express/createBulkImportMiddleware.d.ts +2 -0
- package/lib/express/createBulkImportMiddleware.js +79 -0
- package/lib/express/createBulkImportMiddleware.js.map +1 -0
- package/lib/express/createERCMetadataMiddleware.d.ts +3 -0
- package/lib/express/createERCMetadataMiddleware.js +57 -0
- package/lib/express/createERCMetadataMiddleware.js.map +1 -0
- package/lib/express/createSingleSignOnMiddleware.d.ts +6 -0
- package/lib/express/createSingleSignOnMiddleware.js +71 -0
- package/lib/express/createSingleSignOnMiddleware.js.map +1 -0
- package/lib/express/index.d.ts +6 -0
- package/lib/express/index.js +27 -0
- package/lib/express/index.js.map +1 -0
- package/lib/loaders/index.js +5 -9
- package/lib/loaders/index.js.map +1 -1
- package/lib/resolvers/mutations/accounts/changePassword.d.ts +0 -2
- package/lib/resolvers/mutations/accounts/changePassword.js +14 -3
- package/lib/resolvers/mutations/accounts/changePassword.js.map +1 -1
- package/lib/resolvers/mutations/accounts/createUser.js +19 -5
- package/lib/resolvers/mutations/accounts/createUser.js.map +1 -1
- package/lib/resolvers/mutations/accounts/disableTOTP.js +15 -2
- package/lib/resolvers/mutations/accounts/disableTOTP.js.map +1 -1
- package/lib/resolvers/mutations/accounts/enableTOTP.js +12 -1
- package/lib/resolvers/mutations/accounts/enableTOTP.js.map +1 -1
- package/lib/resolvers/mutations/accounts/enrollUser.js +18 -5
- package/lib/resolvers/mutations/accounts/enrollUser.js.map +1 -1
- package/lib/resolvers/mutations/accounts/forgotPassword.js +11 -1
- package/lib/resolvers/mutations/accounts/forgotPassword.js.map +1 -1
- package/lib/resolvers/mutations/accounts/impersonate.js +1 -1
- package/lib/resolvers/mutations/accounts/impersonate.js.map +1 -1
- package/lib/resolvers/mutations/accounts/loginWithPassword.d.ts +0 -1
- package/lib/resolvers/mutations/accounts/loginWithPassword.js +22 -4
- package/lib/resolvers/mutations/accounts/loginWithPassword.js.map +1 -1
- package/lib/resolvers/mutations/accounts/loginWithWebAuthn.js +13 -1
- package/lib/resolvers/mutations/accounts/loginWithWebAuthn.js.map +1 -1
- package/lib/resolvers/mutations/accounts/logout.d.ts +1 -1
- package/lib/resolvers/mutations/accounts/logout.js +6 -2
- package/lib/resolvers/mutations/accounts/logout.js.map +1 -1
- package/lib/resolvers/mutations/accounts/logoutAllSessions.js +4 -1
- package/lib/resolvers/mutations/accounts/logoutAllSessions.js.map +1 -1
- package/lib/resolvers/mutations/accounts/resetPassword.d.ts +0 -1
- package/lib/resolvers/mutations/accounts/resetPassword.js +18 -3
- package/lib/resolvers/mutations/accounts/resetPassword.js.map +1 -1
- package/lib/resolvers/mutations/accounts/setPassword.d.ts +0 -1
- package/lib/resolvers/mutations/accounts/setPassword.js +1 -1
- package/lib/resolvers/mutations/accounts/setPassword.js.map +1 -1
- package/lib/resolvers/mutations/assortments/addAssortmentFilter.js +1 -2
- package/lib/resolvers/mutations/assortments/addAssortmentFilter.js.map +1 -1
- package/lib/resolvers/mutations/assortments/addAssortmentLink.js +16 -9
- package/lib/resolvers/mutations/assortments/addAssortmentLink.js.map +1 -1
- package/lib/resolvers/mutations/assortments/addAssortmentMedia.js +2 -3
- package/lib/resolvers/mutations/assortments/addAssortmentMedia.js.map +1 -1
- package/lib/resolvers/mutations/assortments/addAssortmentProduct.js +1 -2
- package/lib/resolvers/mutations/assortments/addAssortmentProduct.js.map +1 -1
- package/lib/resolvers/mutations/assortments/createAssortment.js +1 -2
- package/lib/resolvers/mutations/assortments/createAssortment.js.map +1 -1
- package/lib/resolvers/mutations/assortments/prepareAssortmentMediaUpload.js +0 -1
- package/lib/resolvers/mutations/assortments/prepareAssortmentMediaUpload.js.map +1 -1
- package/lib/resolvers/mutations/assortments/removeAssortment.js +1 -1
- package/lib/resolvers/mutations/assortments/removeAssortment.js.map +1 -1
- package/lib/resolvers/mutations/assortments/removeAssortmentFilter.js +1 -1
- package/lib/resolvers/mutations/assortments/removeAssortmentFilter.js.map +1 -1
- package/lib/resolvers/mutations/assortments/removeAssortmentLink.js +1 -1
- package/lib/resolvers/mutations/assortments/removeAssortmentLink.js.map +1 -1
- package/lib/resolvers/mutations/assortments/removeAssortmentMedia.js +2 -2
- package/lib/resolvers/mutations/assortments/removeAssortmentMedia.js.map +1 -1
- package/lib/resolvers/mutations/assortments/removeAssortmentProduct.js +1 -1
- package/lib/resolvers/mutations/assortments/removeAssortmentProduct.js.map +1 -1
- package/lib/resolvers/mutations/assortments/reorderAssortmentFilters.js +1 -1
- package/lib/resolvers/mutations/assortments/reorderAssortmentFilters.js.map +1 -1
- package/lib/resolvers/mutations/assortments/reorderAssortmentLinks.js +1 -1
- package/lib/resolvers/mutations/assortments/reorderAssortmentLinks.js.map +1 -1
- package/lib/resolvers/mutations/assortments/reorderAssortmentMedia.js +1 -1
- package/lib/resolvers/mutations/assortments/reorderAssortmentMedia.js.map +1 -1
- package/lib/resolvers/mutations/assortments/reorderAssortmentProducts.js +1 -1
- package/lib/resolvers/mutations/assortments/reorderAssortmentProducts.js.map +1 -1
- package/lib/resolvers/mutations/assortments/setBaseAssortment.js +1 -1
- package/lib/resolvers/mutations/assortments/setBaseAssortment.js.map +1 -1
- package/lib/resolvers/mutations/assortments/updateAssortment.js +1 -1
- package/lib/resolvers/mutations/assortments/updateAssortment.js.map +1 -1
- package/lib/resolvers/mutations/assortments/updateAssortmentMediaTexts.js +1 -1
- package/lib/resolvers/mutations/assortments/updateAssortmentMediaTexts.js.map +1 -1
- package/lib/resolvers/mutations/assortments/updateAssortmentTexts.js +1 -1
- package/lib/resolvers/mutations/assortments/updateAssortmentTexts.js.map +1 -1
- package/lib/resolvers/mutations/bookmarks/bookmark.js +2 -2
- package/lib/resolvers/mutations/bookmarks/bookmark.js.map +1 -1
- package/lib/resolvers/mutations/bookmarks/createBookmark.js +1 -1
- package/lib/resolvers/mutations/bookmarks/createBookmark.js.map +1 -1
- package/lib/resolvers/mutations/countries/createCountry.js +1 -2
- package/lib/resolvers/mutations/countries/createCountry.js.map +1 -1
- package/lib/resolvers/mutations/countries/removeCountry.js +1 -1
- package/lib/resolvers/mutations/countries/removeCountry.js.map +1 -1
- package/lib/resolvers/mutations/countries/updateCountry.js +1 -1
- package/lib/resolvers/mutations/countries/updateCountry.js.map +1 -1
- package/lib/resolvers/mutations/currencies/createCurrency.js +1 -2
- package/lib/resolvers/mutations/currencies/createCurrency.js.map +1 -1
- package/lib/resolvers/mutations/currencies/removeCurrency.js +1 -1
- package/lib/resolvers/mutations/currencies/removeCurrency.js.map +1 -1
- package/lib/resolvers/mutations/currencies/updateCurrency.js +1 -1
- package/lib/resolvers/mutations/currencies/updateCurrency.js.map +1 -1
- package/lib/resolvers/mutations/delivery/createDeliveryProvider.js +1 -2
- package/lib/resolvers/mutations/delivery/createDeliveryProvider.js.map +1 -1
- package/lib/resolvers/mutations/delivery/removeDeliveryProvider.js +1 -1
- package/lib/resolvers/mutations/delivery/removeDeliveryProvider.js.map +1 -1
- package/lib/resolvers/mutations/delivery/updateDeliveryProvider.js +1 -1
- package/lib/resolvers/mutations/delivery/updateDeliveryProvider.js.map +1 -1
- package/lib/resolvers/mutations/enrollments/activateEnrollment.js +1 -1
- package/lib/resolvers/mutations/enrollments/activateEnrollment.js.map +1 -1
- package/lib/resolvers/mutations/enrollments/terminateEnrollment.js +1 -1
- package/lib/resolvers/mutations/enrollments/terminateEnrollment.js.map +1 -1
- package/lib/resolvers/mutations/enrollments/updateEnrollment.d.ts +1 -1
- package/lib/resolvers/mutations/enrollments/updateEnrollment.js +5 -5
- package/lib/resolvers/mutations/enrollments/updateEnrollment.js.map +1 -1
- package/lib/resolvers/mutations/filters/createFilter.js +1 -2
- package/lib/resolvers/mutations/filters/createFilter.js.map +1 -1
- package/lib/resolvers/mutations/filters/createFilterOption.js +1 -1
- package/lib/resolvers/mutations/filters/createFilterOption.js.map +1 -1
- package/lib/resolvers/mutations/filters/removeFilter.d.ts +1 -1
- package/lib/resolvers/mutations/filters/removeFilter.js +4 -4
- package/lib/resolvers/mutations/filters/removeFilter.js.map +1 -1
- package/lib/resolvers/mutations/filters/updateFilter.js +1 -1
- package/lib/resolvers/mutations/filters/updateFilter.js.map +1 -1
- package/lib/resolvers/mutations/filters/updateFilterTexts.js +1 -1
- package/lib/resolvers/mutations/filters/updateFilterTexts.js.map +1 -1
- package/lib/resolvers/mutations/index.d.ts +2 -1
- package/lib/resolvers/mutations/index.js +2 -0
- package/lib/resolvers/mutations/index.js.map +1 -1
- package/lib/resolvers/mutations/languages/createLanguage.js +1 -2
- package/lib/resolvers/mutations/languages/createLanguage.js.map +1 -1
- package/lib/resolvers/mutations/languages/removeLanguage.js +1 -1
- package/lib/resolvers/mutations/languages/removeLanguage.js.map +1 -1
- package/lib/resolvers/mutations/languages/updateLanguage.js +1 -1
- package/lib/resolvers/mutations/languages/updateLanguage.js.map +1 -1
- package/lib/resolvers/mutations/orders/createCart.js +1 -1
- package/lib/resolvers/mutations/orders/createCart.js.map +1 -1
- package/lib/resolvers/mutations/orders/payOrder.js +1 -1
- package/lib/resolvers/mutations/orders/payOrder.js.map +1 -1
- package/lib/resolvers/mutations/orders/removeOrder.js +1 -1
- package/lib/resolvers/mutations/orders/removeOrder.js.map +1 -1
- package/lib/resolvers/mutations/pageView.d.ts +1 -1
- package/lib/resolvers/mutations/pageView.js +2 -2
- package/lib/resolvers/mutations/pageView.js.map +1 -1
- package/lib/resolvers/mutations/payment/createPaymentProvider.js +1 -2
- package/lib/resolvers/mutations/payment/createPaymentProvider.js.map +1 -1
- package/lib/resolvers/mutations/payment/registerPaymentCredentials.js +2 -2
- package/lib/resolvers/mutations/payment/registerPaymentCredentials.js.map +1 -1
- package/lib/resolvers/mutations/payment/removePaymentProvider.js +1 -1
- package/lib/resolvers/mutations/payment/removePaymentProvider.js.map +1 -1
- package/lib/resolvers/mutations/payment/updatePaymentProvider.js +1 -1
- package/lib/resolvers/mutations/payment/updatePaymentProvider.js.map +1 -1
- package/lib/resolvers/mutations/products/addProductAssignment.js +1 -1
- package/lib/resolvers/mutations/products/addProductAssignment.js.map +1 -1
- package/lib/resolvers/mutations/products/addProductMedia.js +1 -2
- package/lib/resolvers/mutations/products/addProductMedia.js.map +1 -1
- package/lib/resolvers/mutations/products/addProductReviewVote.js +1 -1
- package/lib/resolvers/mutations/products/addProductReviewVote.js.map +1 -1
- package/lib/resolvers/mutations/products/createProduct.js +1 -2
- package/lib/resolvers/mutations/products/createProduct.js.map +1 -1
- package/lib/resolvers/mutations/products/createProductBundleItem.js +1 -1
- package/lib/resolvers/mutations/products/createProductBundleItem.js.map +1 -1
- package/lib/resolvers/mutations/products/createProductReview.js +1 -1
- package/lib/resolvers/mutations/products/createProductReview.js.map +1 -1
- package/lib/resolvers/mutations/products/createProductVariation.js +1 -2
- package/lib/resolvers/mutations/products/createProductVariation.js.map +1 -1
- package/lib/resolvers/mutations/products/createProductVariationOption.js +4 -1
- package/lib/resolvers/mutations/products/createProductVariationOption.js.map +1 -1
- package/lib/resolvers/mutations/products/prepareProductMediaUpload.js +0 -1
- package/lib/resolvers/mutations/products/prepareProductMediaUpload.js.map +1 -1
- package/lib/resolvers/mutations/products/publishProduct.js +1 -1
- package/lib/resolvers/mutations/products/publishProduct.js.map +1 -1
- package/lib/resolvers/mutations/products/removeBundleItem.js +2 -2
- package/lib/resolvers/mutations/products/removeBundleItem.js.map +1 -1
- package/lib/resolvers/mutations/products/removeProduct.d.ts +1 -1
- package/lib/resolvers/mutations/products/removeProduct.js +17 -8
- package/lib/resolvers/mutations/products/removeProduct.js.map +1 -1
- package/lib/resolvers/mutations/products/removeProductAssignment.js +1 -1
- package/lib/resolvers/mutations/products/removeProductAssignment.js.map +1 -1
- package/lib/resolvers/mutations/products/removeProductMedia.js +2 -2
- package/lib/resolvers/mutations/products/removeProductMedia.js.map +1 -1
- package/lib/resolvers/mutations/products/removeProductReview.js +1 -1
- package/lib/resolvers/mutations/products/removeProductReview.js.map +1 -1
- package/lib/resolvers/mutations/products/removeProductReviewVote.js +1 -1
- package/lib/resolvers/mutations/products/removeProductReviewVote.js.map +1 -1
- package/lib/resolvers/mutations/products/removeProductVariation.js +1 -1
- package/lib/resolvers/mutations/products/removeProductVariation.js.map +1 -1
- package/lib/resolvers/mutations/products/removeProductVariationOption.js +1 -1
- package/lib/resolvers/mutations/products/removeProductVariationOption.js.map +1 -1
- package/lib/resolvers/mutations/products/reorderProductMedia.js +1 -1
- package/lib/resolvers/mutations/products/reorderProductMedia.js.map +1 -1
- package/lib/resolvers/mutations/products/unpublishProduct.js +1 -1
- package/lib/resolvers/mutations/products/unpublishProduct.js.map +1 -1
- package/lib/resolvers/mutations/products/updateProduct.js +1 -1
- package/lib/resolvers/mutations/products/updateProduct.js.map +1 -1
- package/lib/resolvers/mutations/products/updateProductCommerce.js +1 -1
- package/lib/resolvers/mutations/products/updateProductCommerce.js.map +1 -1
- package/lib/resolvers/mutations/products/updateProductMediaTexts.js +1 -1
- package/lib/resolvers/mutations/products/updateProductMediaTexts.js.map +1 -1
- package/lib/resolvers/mutations/products/updateProductPlan.js +1 -1
- package/lib/resolvers/mutations/products/updateProductPlan.js.map +1 -1
- package/lib/resolvers/mutations/products/updateProductReview.js +1 -1
- package/lib/resolvers/mutations/products/updateProductReview.js.map +1 -1
- package/lib/resolvers/mutations/products/updateProductSupply.js +1 -1
- package/lib/resolvers/mutations/products/updateProductSupply.js.map +1 -1
- package/lib/resolvers/mutations/products/updateProductTexts.js +1 -1
- package/lib/resolvers/mutations/products/updateProductTexts.js.map +1 -1
- package/lib/resolvers/mutations/products/updateProductTokenization.js +1 -1
- package/lib/resolvers/mutations/products/updateProductTokenization.js.map +1 -1
- package/lib/resolvers/mutations/products/updateProductVariationTexts.js +1 -1
- package/lib/resolvers/mutations/products/updateProductVariationTexts.js.map +1 -1
- package/lib/resolvers/mutations/products/updateProductWarehousing.js +1 -1
- package/lib/resolvers/mutations/products/updateProductWarehousing.js.map +1 -1
- package/lib/resolvers/mutations/users/prepareUserAvatarUpload.js +0 -1
- package/lib/resolvers/mutations/users/prepareUserAvatarUpload.js.map +1 -1
- package/lib/resolvers/mutations/users/removeUser.d.ts +4 -0
- package/lib/resolvers/mutations/users/removeUser.js +11 -0
- package/lib/resolvers/mutations/users/removeUser.js.map +1 -0
- package/lib/resolvers/mutations/users/setRoles.js +1 -1
- package/lib/resolvers/mutations/users/setRoles.js.map +1 -1
- package/lib/resolvers/mutations/users/setUserTags.js +1 -1
- package/lib/resolvers/mutations/users/setUserTags.js.map +1 -1
- package/lib/resolvers/mutations/users/updateUserAvatar.js +1 -2
- package/lib/resolvers/mutations/users/updateUserAvatar.js.map +1 -1
- package/lib/resolvers/mutations/users/updateUserProfile.js +1 -1
- package/lib/resolvers/mutations/users/updateUserProfile.js.map +1 -1
- package/lib/resolvers/mutations/utils/getOrderCart.js +1 -1
- package/lib/resolvers/mutations/utils/getOrderCart.js.map +1 -1
- package/lib/resolvers/mutations/warehousing/createWarehousingProvider.js +1 -2
- package/lib/resolvers/mutations/warehousing/createWarehousingProvider.js.map +1 -1
- package/lib/resolvers/mutations/warehousing/removeWarehousingProvider.js +1 -1
- package/lib/resolvers/mutations/warehousing/removeWarehousingProvider.js.map +1 -1
- package/lib/resolvers/mutations/warehousing/updateWarehousingProvider.js +1 -1
- package/lib/resolvers/mutations/warehousing/updateWarehousingProvider.js.map +1 -1
- package/lib/resolvers/mutations/worker/addWork.js +1 -1
- package/lib/resolvers/mutations/worker/addWork.js.map +1 -1
- package/lib/resolvers/mutations/worker/finishWork.js +1 -1
- package/lib/resolvers/mutations/worker/finishWork.js.map +1 -1
- package/lib/resolvers/mutations/worker/removeWork.js +1 -1
- package/lib/resolvers/mutations/worker/removeWork.js.map +1 -1
- package/lib/resolvers/queries/products/productCatalogPrices.js +0 -1
- package/lib/resolvers/queries/products/productCatalogPrices.js.map +1 -1
- package/lib/resolvers/queries/users/users.d.ts +2 -1
- package/lib/resolvers/queries/users/users.js.map +1 -1
- package/lib/resolvers/queries/worker/workQueue.d.ts +1 -1
- package/lib/resolvers/queries/worker/workQueue.js +1 -1
- package/lib/resolvers/queries/worker/workQueue.js.map +1 -1
- package/lib/resolvers/type/assortment/assortment-filter-types.d.ts +2 -2
- package/lib/resolvers/type/assortment/assortment-filter-types.js +0 -1
- package/lib/resolvers/type/assortment/assortment-filter-types.js.map +1 -1
- package/lib/resolvers/type/assortment/assortment-link-types.d.ts +2 -2
- package/lib/resolvers/type/assortment/assortment-link-types.js +0 -2
- package/lib/resolvers/type/assortment/assortment-link-types.js.map +1 -1
- package/lib/resolvers/type/assortment/assortment-media-types.d.ts +1 -1
- package/lib/resolvers/type/assortment/assortment-media-types.js +2 -0
- package/lib/resolvers/type/assortment/assortment-media-types.js.map +1 -1
- package/lib/resolvers/type/assortment/assortment-path-link-types.d.ts +1 -4
- package/lib/resolvers/type/assortment/assortment-path-link-types.js +1 -7
- package/lib/resolvers/type/assortment/assortment-path-link-types.js.map +1 -1
- package/lib/resolvers/type/assortment/assortment-product-types.d.ts +2 -2
- package/lib/resolvers/type/assortment/assortment-product-types.js +0 -2
- package/lib/resolvers/type/assortment/assortment-product-types.js.map +1 -1
- package/lib/resolvers/type/assortment/assortment-types.d.ts +1 -1
- package/lib/resolvers/type/assortment/assortment-types.js +8 -4
- package/lib/resolvers/type/assortment/assortment-types.js.map +1 -1
- package/lib/resolvers/type/bookmark-types.d.ts +1 -1
- package/lib/resolvers/type/bookmark-types.js +0 -1
- package/lib/resolvers/type/bookmark-types.js.map +1 -1
- package/lib/resolvers/type/country-types.d.ts +1 -1
- package/lib/resolvers/type/delivery-provider-types.d.ts +1 -1
- package/lib/resolvers/type/enrollment/enrollment-delivery-types.d.ts +2 -2
- package/lib/resolvers/type/enrollment/enrollment-payment-types.d.ts +2 -2
- package/lib/resolvers/type/enrollment/enrollment-period-types.d.ts +2 -2
- package/lib/resolvers/type/enrollment/enrollment-plan-tyes.d.ts +2 -2
- package/lib/resolvers/type/enrollment/enrollment-plan-tyes.js +0 -1
- package/lib/resolvers/type/enrollment/enrollment-plan-tyes.js.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-types.d.ts +2 -2
- package/lib/resolvers/type/event-types.d.ts +1 -1
- package/lib/resolvers/type/filter/filter-option-types.d.ts +2 -2
- package/lib/resolvers/type/filter/filter-types.d.ts +2 -2
- package/lib/resolvers/type/index.d.ts +1 -0
- package/lib/resolvers/type/login-method-response-types.d.ts +1 -0
- package/lib/resolvers/type/order/order-delivery-discount-types.d.ts +1 -1
- package/lib/resolvers/type/order/order-delivery-pickup-types.d.ts +1 -1
- package/lib/resolvers/type/order/order-delivery-shipping-types.d.ts +1 -1
- package/lib/resolvers/type/order/order-discount-types.d.ts +1 -1
- package/lib/resolvers/type/order/order-global-discount-types.d.ts +1 -1
- package/lib/resolvers/type/order/order-item-discount-types.d.ts +1 -1
- package/lib/resolvers/type/order/order-item-types.d.ts +1 -1
- package/lib/resolvers/type/order/order-item-types.js +0 -3
- package/lib/resolvers/type/order/order-item-types.js.map +1 -1
- package/lib/resolvers/type/order/order-payment-card-types.d.ts +1 -1
- package/lib/resolvers/type/order/order-payment-discount-types.d.ts +1 -1
- package/lib/resolvers/type/order/order-payment-generic-types.d.ts +1 -1
- package/lib/resolvers/type/order/order-payment-invoice-types.d.ts +1 -1
- package/lib/resolvers/type/order/order-types.d.ts +1 -1
- package/lib/resolvers/type/price-types.d.ts +1 -1
- package/lib/resolvers/type/product/product-assortment-path-types.js +1 -0
- package/lib/resolvers/type/product/product-assortment-path-types.js.map +1 -1
- package/lib/resolvers/type/product/product-bundle-item-types.js +0 -1
- package/lib/resolvers/type/product/product-bundle-item-types.js.map +1 -1
- package/lib/resolvers/type/product/product-configurable-types.js +1 -0
- package/lib/resolvers/type/product/product-configurable-types.js.map +1 -1
- package/lib/resolvers/type/product/product-discount.d.ts +1 -1
- package/lib/resolvers/type/product/product-media-types.js +2 -0
- package/lib/resolvers/type/product/product-media-types.js.map +1 -1
- package/lib/resolvers/type/product/product-plan-types.js +1 -12
- package/lib/resolvers/type/product/product-plan-types.js.map +1 -1
- package/lib/resolvers/type/product/product-review-types.d.ts +1 -1
- package/lib/resolvers/type/product/product-review-types.js +0 -1
- package/lib/resolvers/type/product/product-review-types.js.map +1 -1
- package/lib/resolvers/type/product/product-variation-assignment-types.js +0 -1
- package/lib/resolvers/type/product/product-variation-assignment-types.js.map +1 -1
- package/lib/resolvers/type/quotation-types.d.ts +2 -2
- package/lib/resolvers/type/quotation-types.js +0 -1
- package/lib/resolvers/type/quotation-types.js.map +1 -1
- package/lib/resolvers/type/shop-types.d.ts +1 -1
- package/lib/resolvers/type/token-types.d.ts +1 -1
- package/lib/resolvers/type/token-types.js +2 -1
- package/lib/resolvers/type/token-types.js.map +1 -1
- package/lib/resolvers/type/user-types.d.ts +4 -3
- package/lib/resolvers/type/user-types.js +10 -21
- package/lib/resolvers/type/user-types.js.map +1 -1
- package/lib/resolvers/type/webauthn-credentials-types.d.ts +1 -1
- package/lib/resolvers/type/work-types.d.ts +1 -1
- package/lib/roles/admin.js +3 -72
- package/lib/roles/admin.js.map +1 -1
- package/lib/schema/{types/log.d.ts → directives.d.ts} +0 -0
- package/lib/schema/directives.js +15 -0
- package/lib/schema/directives.js.map +1 -0
- package/lib/schema/index.js +2 -1
- package/lib/schema/index.js.map +1 -1
- package/lib/schema/inputTypes.js +0 -15
- package/lib/schema/inputTypes.js.map +1 -1
- package/lib/schema/mutation.js +22 -36
- package/lib/schema/mutation.js.map +1 -1
- package/lib/schema/query.js +42 -22
- package/lib/schema/query.js.map +1 -1
- package/lib/schema/types/assortment.js +10 -10
- package/lib/schema/types/color.js +1 -1
- package/lib/schema/types/country.js +1 -1
- package/lib/schema/types/currency.js +1 -1
- package/lib/schema/types/delivery.js +3 -2
- package/lib/schema/types/delivery.js.map +1 -1
- package/lib/schema/types/dimensions.js +1 -1
- package/lib/schema/types/discount.js +1 -1
- package/lib/schema/types/filter.js +5 -8
- package/lib/schema/types/filter.js.map +1 -1
- package/lib/schema/types/geo-position.js +1 -1
- package/lib/schema/types/language.js +1 -1
- package/lib/schema/types/media.js +1 -1
- package/lib/schema/types/payment.js +3 -3
- package/lib/schema/types/price.js +2 -2
- package/lib/schema/types/product/bundle-product.js +2 -3
- package/lib/schema/types/product/bundle-product.js.map +1 -1
- package/lib/schema/types/product/configurable-product.js +7 -7
- package/lib/schema/types/product/plan-product.js +3 -3
- package/lib/schema/types/product/product.js +11 -11
- package/lib/schema/types/product/simple-product.js +4 -4
- package/lib/schema/types/product/tokenized-product.js +3 -3
- package/lib/schema/types/search.js +3 -8
- package/lib/schema/types/search.js.map +1 -1
- package/lib/schema/types/shop.js +2 -2
- package/lib/schema/types/types.js +1 -1
- package/lib/schema/types/user.js +4 -3
- package/lib/schema/types/user.js.map +1 -1
- package/lib/schema/types/warehousing.js +3 -3
- package/package.json +26 -12
- package/src/acl.ts +2 -2
- package/src/api-index.ts +6 -27
- package/src/context.ts +0 -18
- package/src/createGraphQLServer.ts +14 -68
- package/src/errors.ts +85 -0
- package/src/express/createApolloMiddleware.ts +40 -0
- package/src/express/createBulkImportMiddleware.ts +87 -0
- package/src/express/createERCMetadataMiddleware.ts +73 -0
- package/src/express/createSingleSignOnMiddleware.ts +84 -0
- package/src/express/index.ts +48 -0
- package/src/loaders/index.ts +27 -35
- package/src/resolvers/mutations/accounts/changePassword.ts +11 -6
- package/src/resolvers/mutations/accounts/createUser.ts +21 -6
- package/src/resolvers/mutations/accounts/disableTOTP.ts +13 -3
- package/src/resolvers/mutations/accounts/enableTOTP.ts +9 -2
- package/src/resolvers/mutations/accounts/enrollUser.ts +20 -5
- package/src/resolvers/mutations/accounts/forgotPassword.ts +8 -1
- package/src/resolvers/mutations/accounts/impersonate.ts +1 -1
- package/src/resolvers/mutations/accounts/loginWithPassword.ts +27 -5
- package/src/resolvers/mutations/accounts/loginWithWebAuthn.ts +13 -2
- package/src/resolvers/mutations/accounts/logout.ts +9 -2
- package/src/resolvers/mutations/accounts/logoutAllSessions.ts +7 -1
- package/src/resolvers/mutations/accounts/resetPassword.ts +21 -5
- package/src/resolvers/mutations/accounts/setPassword.ts +2 -2
- package/src/resolvers/mutations/assortments/addAssortmentFilter.ts +5 -9
- package/src/resolvers/mutations/assortments/addAssortmentLink.ts +22 -14
- package/src/resolvers/mutations/assortments/addAssortmentMedia.ts +2 -6
- package/src/resolvers/mutations/assortments/addAssortmentProduct.ts +0 -2
- package/src/resolvers/mutations/assortments/createAssortment.ts +4 -8
- package/src/resolvers/mutations/assortments/prepareAssortmentMediaUpload.ts +0 -1
- package/src/resolvers/mutations/assortments/removeAssortment.ts +1 -1
- package/src/resolvers/mutations/assortments/removeAssortmentFilter.ts +1 -1
- package/src/resolvers/mutations/assortments/removeAssortmentLink.ts +1 -1
- package/src/resolvers/mutations/assortments/removeAssortmentMedia.ts +2 -2
- package/src/resolvers/mutations/assortments/removeAssortmentProduct.ts +1 -1
- package/src/resolvers/mutations/assortments/reorderAssortmentFilters.ts +3 -6
- package/src/resolvers/mutations/assortments/reorderAssortmentLinks.ts +0 -1
- package/src/resolvers/mutations/assortments/reorderAssortmentMedia.ts +3 -6
- package/src/resolvers/mutations/assortments/reorderAssortmentProducts.ts +0 -1
- package/src/resolvers/mutations/assortments/setBaseAssortment.ts +1 -1
- package/src/resolvers/mutations/assortments/updateAssortment.ts +1 -1
- package/src/resolvers/mutations/assortments/updateAssortmentMediaTexts.ts +1 -1
- package/src/resolvers/mutations/assortments/updateAssortmentTexts.ts +1 -1
- package/src/resolvers/mutations/bookmarks/bookmark.ts +4 -7
- package/src/resolvers/mutations/bookmarks/createBookmark.ts +4 -7
- package/src/resolvers/mutations/countries/createCountry.ts +3 -7
- package/src/resolvers/mutations/countries/removeCountry.ts +1 -1
- package/src/resolvers/mutations/countries/updateCountry.ts +1 -1
- package/src/resolvers/mutations/currencies/createCurrency.ts +3 -7
- package/src/resolvers/mutations/currencies/removeCurrency.ts +1 -1
- package/src/resolvers/mutations/currencies/updateCurrency.ts +1 -1
- package/src/resolvers/mutations/delivery/createDeliveryProvider.ts +3 -7
- package/src/resolvers/mutations/delivery/removeDeliveryProvider.ts +1 -1
- package/src/resolvers/mutations/delivery/updateDeliveryProvider.ts +1 -1
- package/src/resolvers/mutations/enrollments/activateEnrollment.ts +1 -1
- package/src/resolvers/mutations/enrollments/terminateEnrollment.ts +1 -1
- package/src/resolvers/mutations/enrollments/updateEnrollment.ts +5 -5
- package/src/resolvers/mutations/filters/createFilter.ts +0 -2
- package/src/resolvers/mutations/filters/createFilterOption.ts +5 -1
- package/src/resolvers/mutations/filters/removeFilter.ts +4 -4
- package/src/resolvers/mutations/filters/updateFilter.ts +1 -1
- package/src/resolvers/mutations/filters/updateFilterTexts.ts +1 -1
- package/src/resolvers/mutations/index.ts +2 -0
- package/src/resolvers/mutations/languages/createLanguage.ts +3 -7
- package/src/resolvers/mutations/languages/removeLanguage.ts +1 -1
- package/src/resolvers/mutations/languages/updateLanguage.ts +1 -1
- package/src/resolvers/mutations/orders/createCart.ts +4 -1
- package/src/resolvers/mutations/orders/payOrder.ts +1 -1
- package/src/resolvers/mutations/orders/removeOrder.ts +1 -1
- package/src/resolvers/mutations/pageView.ts +2 -2
- package/src/resolvers/mutations/payment/createPaymentProvider.ts +3 -7
- package/src/resolvers/mutations/payment/registerPaymentCredentials.ts +6 -2
- package/src/resolvers/mutations/payment/removePaymentProvider.ts +1 -1
- package/src/resolvers/mutations/payment/updatePaymentProvider.ts +1 -1
- package/src/resolvers/mutations/products/addProductAssignment.ts +4 -8
- package/src/resolvers/mutations/products/addProductMedia.ts +1 -2
- package/src/resolvers/mutations/products/addProductReviewVote.ts +1 -1
- package/src/resolvers/mutations/products/createProduct.ts +4 -8
- package/src/resolvers/mutations/products/createProductBundleItem.ts +1 -1
- package/src/resolvers/mutations/products/createProductReview.ts +5 -8
- package/src/resolvers/mutations/products/createProductVariation.ts +6 -10
- package/src/resolvers/mutations/products/createProductVariationOption.ts +4 -5
- package/src/resolvers/mutations/products/prepareProductMediaUpload.ts +0 -1
- package/src/resolvers/mutations/products/publishProduct.ts +1 -1
- package/src/resolvers/mutations/products/removeBundleItem.ts +2 -2
- package/src/resolvers/mutations/products/removeProduct.ts +26 -7
- package/src/resolvers/mutations/products/removeProductAssignment.ts +1 -1
- package/src/resolvers/mutations/products/removeProductMedia.ts +2 -2
- package/src/resolvers/mutations/products/removeProductReview.ts +1 -1
- package/src/resolvers/mutations/products/removeProductReviewVote.ts +1 -1
- package/src/resolvers/mutations/products/removeProductVariation.ts +1 -1
- package/src/resolvers/mutations/products/removeProductVariationOption.ts +0 -1
- package/src/resolvers/mutations/products/reorderProductMedia.ts +1 -1
- package/src/resolvers/mutations/products/unpublishProduct.ts +1 -1
- package/src/resolvers/mutations/products/updateProduct.ts +1 -1
- package/src/resolvers/mutations/products/updateProductCommerce.ts +1 -1
- package/src/resolvers/mutations/products/updateProductMediaTexts.ts +1 -1
- package/src/resolvers/mutations/products/updateProductPlan.ts +1 -1
- package/src/resolvers/mutations/products/updateProductReview.ts +1 -1
- package/src/resolvers/mutations/products/updateProductSupply.ts +1 -1
- package/src/resolvers/mutations/products/updateProductTexts.ts +1 -1
- package/src/resolvers/mutations/products/updateProductTokenization.ts +1 -1
- package/src/resolvers/mutations/products/updateProductVariationTexts.ts +0 -1
- package/src/resolvers/mutations/products/updateProductWarehousing.ts +1 -1
- package/src/resolvers/mutations/users/prepareUserAvatarUpload.ts +0 -1
- package/src/resolvers/mutations/users/removeUser.ts +19 -0
- package/src/resolvers/mutations/users/setRoles.ts +1 -1
- package/src/resolvers/mutations/users/setUserTags.ts +1 -1
- package/src/resolvers/mutations/users/updateUserAvatar.ts +1 -2
- package/src/resolvers/mutations/users/updateUserProfile.ts +1 -1
- package/src/resolvers/mutations/utils/getOrderCart.ts +1 -1
- package/src/resolvers/mutations/warehousing/createWarehousingProvider.ts +3 -7
- package/src/resolvers/mutations/warehousing/removeWarehousingProvider.ts +1 -1
- package/src/resolvers/mutations/warehousing/updateWarehousingProvider.ts +1 -1
- package/src/resolvers/mutations/worker/addWork.ts +1 -1
- package/src/resolvers/mutations/worker/finishWork.ts +8 -12
- package/src/resolvers/mutations/worker/removeWork.ts +1 -1
- package/src/resolvers/queries/products/productCatalogPrices.ts +0 -1
- package/src/resolvers/queries/users/users.ts +2 -1
- package/src/resolvers/queries/worker/workQueue.ts +1 -1
- package/src/resolvers/type/assortment/assortment-filter-types.ts +0 -1
- package/src/resolvers/type/assortment/assortment-link-types.ts +0 -2
- package/src/resolvers/type/assortment/assortment-media-types.ts +2 -0
- package/src/resolvers/type/assortment/assortment-path-link-types.ts +1 -11
- package/src/resolvers/type/assortment/assortment-product-types.ts +0 -2
- package/src/resolvers/type/assortment/assortment-types.ts +9 -4
- package/src/resolvers/type/bookmark-types.ts +0 -1
- package/src/resolvers/type/enrollment/enrollment-plan-tyes.ts +0 -1
- package/src/resolvers/type/order/order-item-types.ts +0 -3
- package/src/resolvers/type/product/product-assortment-path-types.ts +1 -0
- package/src/resolvers/type/product/product-bundle-item-types.ts +0 -1
- package/src/resolvers/type/product/product-configurable-types.ts +1 -0
- package/src/resolvers/type/product/product-media-types.ts +2 -0
- package/src/resolvers/type/product/product-plan-types.ts +2 -18
- package/src/resolvers/type/product/product-review-types.ts +0 -1
- package/src/resolvers/type/product/product-variation-assignment-types.ts +0 -1
- package/src/resolvers/type/quotation-types.ts +0 -1
- package/src/resolvers/type/token-types.ts +2 -1
- package/src/resolvers/type/user-types.ts +14 -25
- package/src/roles/admin.ts +3 -72
- package/src/schema/directives.js +14 -0
- package/src/schema/index.js +2 -1
- package/src/schema/inputTypes.js +0 -15
- package/src/schema/mutation.js +22 -36
- package/src/schema/query.js +42 -22
- package/src/schema/types/assortment.js +10 -10
- package/src/schema/types/color.js +1 -1
- package/src/schema/types/country.js +1 -1
- package/src/schema/types/currency.js +1 -1
- package/src/schema/types/delivery.js +3 -2
- package/src/schema/types/dimensions.js +1 -1
- package/src/schema/types/discount.js +1 -1
- package/src/schema/types/filter.js +5 -8
- package/src/schema/types/geo-position.js +1 -1
- package/src/schema/types/language.js +1 -1
- package/src/schema/types/media.js +1 -1
- package/src/schema/types/payment.js +3 -3
- package/src/schema/types/price.js +2 -2
- package/src/schema/types/product/bundle-product.js +2 -3
- package/src/schema/types/product/configurable-product.js +7 -7
- package/src/schema/types/product/plan-product.js +3 -3
- package/src/schema/types/product/product.js +11 -11
- package/src/schema/types/product/simple-product.js +4 -4
- package/src/schema/types/product/tokenized-product.js +3 -3
- package/src/schema/types/search.js +3 -8
- package/src/schema/types/shop.js +2 -2
- package/src/schema/types/types.js +1 -1
- package/src/schema/types/user.js +4 -3
- package/src/schema/types/warehousing.js +3 -3
- package/tests/api-index.test.ts +78 -0
- package/lib/createBulkImportServer.d.ts +0 -2
- package/lib/createBulkImportServer.js +0 -81
- package/lib/createBulkImportServer.js.map +0 -1
- package/lib/createERCMetadataServer.d.ts +0 -2
- package/lib/createERCMetadataServer.js +0 -59
- package/lib/createERCMetadataServer.js.map +0 -1
- package/lib/schema/types/log.js +0 -16
- package/lib/schema/types/log.js.map +0 -1
- package/src/createBulkImportServer.ts +0 -95
- package/src/createERCMetadataServer.ts +0 -78
- package/src/schema/types/log.js +0 -15
|
@@ -16,6 +16,10 @@ export default async function createFilterOption(
|
|
|
16
16
|
|
|
17
17
|
if (!(await modules.filters.filterExists({ filterId }))) throw new FilterNotFoundError({ filterId });
|
|
18
18
|
|
|
19
|
-
const filter = await modules.filters.createFilterOption(
|
|
19
|
+
const filter = await modules.filters.createFilterOption(
|
|
20
|
+
filterId,
|
|
21
|
+
{ ...option, locale: context.localeContext.language },
|
|
22
|
+
context,
|
|
23
|
+
);
|
|
20
24
|
return filter;
|
|
21
25
|
}
|
|
@@ -5,9 +5,9 @@ import { FilterNotFoundError, InvalidIdError } from '../../../errors';
|
|
|
5
5
|
export default async function removeFilter(
|
|
6
6
|
root: Root,
|
|
7
7
|
{ filterId }: { filterId: string },
|
|
8
|
-
|
|
8
|
+
context: Context,
|
|
9
9
|
) {
|
|
10
|
-
const { modules, userId } =
|
|
10
|
+
const { modules, userId } = context;
|
|
11
11
|
log(`mutation removeFilter ${filterId}`, { userId });
|
|
12
12
|
|
|
13
13
|
if (!filterId) throw new InvalidIdError({ filterId });
|
|
@@ -15,8 +15,8 @@ export default async function removeFilter(
|
|
|
15
15
|
const filter = await modules.filters.findFilter({ filterId });
|
|
16
16
|
if (!filter) throw new FilterNotFoundError({ filterId });
|
|
17
17
|
|
|
18
|
-
await modules.assortments.filters.deleteMany({ filterId }
|
|
19
|
-
await modules.filters.delete(filterId
|
|
18
|
+
await modules.assortments.filters.deleteMany({ filterId });
|
|
19
|
+
await modules.filters.delete(filterId);
|
|
20
20
|
|
|
21
21
|
return filter;
|
|
22
22
|
}
|
|
@@ -16,7 +16,7 @@ export default async function updateFilter(
|
|
|
16
16
|
|
|
17
17
|
if (!(await modules.filters.filterExists({ filterId }))) throw new FilterNotFoundError({ filterId });
|
|
18
18
|
|
|
19
|
-
await modules.filters.update(filterId, filter, context, { skipInvalidation: false }
|
|
19
|
+
await modules.filters.update(filterId, filter, context, { skipInvalidation: false });
|
|
20
20
|
|
|
21
21
|
return modules.filters.findFilter({ filterId });
|
|
22
22
|
}
|
|
@@ -22,5 +22,5 @@ export default async function updateFilterTexts(
|
|
|
22
22
|
const filter = await modules.filters.findFilter({ filterId });
|
|
23
23
|
if (!filter) throw new FilterNotFoundError({ filterId });
|
|
24
24
|
|
|
25
|
-
return modules.filters.texts.updateTexts({ filterId, filterOptionValue }, texts
|
|
25
|
+
return modules.filters.texts.updateTexts({ filterId, filterOptionValue }, texts);
|
|
26
26
|
}
|
|
@@ -28,6 +28,7 @@ import removeWeb3Address from './accounts/removeWeb3Address';
|
|
|
28
28
|
import verifyWeb3Address from './accounts/verifyWeb3Address';
|
|
29
29
|
import updateUserAvatar from './users/updateUserAvatar';
|
|
30
30
|
import updateUserProfile from './users/updateUserProfile';
|
|
31
|
+
import removeUser from './users/removeUser';
|
|
31
32
|
import setUserTags from './users/setUserTags';
|
|
32
33
|
import createLanguage from './languages/createLanguage';
|
|
33
34
|
import updateLanguage from './languages/updateLanguage';
|
|
@@ -186,6 +187,7 @@ export default {
|
|
|
186
187
|
updateUserAvatar: acl(actions.updateUser)(updateUserAvatar),
|
|
187
188
|
prepareUserAvatarUpload: acl(actions.updateUser)(prepareUserAvatarUpload),
|
|
188
189
|
updateUserProfile: acl(actions.updateUser)(updateUserProfile),
|
|
190
|
+
removeUser: acl(actions.updateUser)(removeUser),
|
|
189
191
|
setUserTags: acl(actions.manageUsers)(setUserTags),
|
|
190
192
|
setPassword: acl(actions.manageUsers)(setPassword),
|
|
191
193
|
setUsername: acl(actions.updateUsername)(setUsername),
|
|
@@ -9,13 +9,9 @@ export default async function createLanguage(
|
|
|
9
9
|
) {
|
|
10
10
|
log('mutation createLanguage', { userId });
|
|
11
11
|
|
|
12
|
-
const languageId = await modules.languages.create(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
authorId: userId,
|
|
16
|
-
},
|
|
17
|
-
userId,
|
|
18
|
-
);
|
|
12
|
+
const languageId = await modules.languages.create({
|
|
13
|
+
...language,
|
|
14
|
+
});
|
|
19
15
|
|
|
20
16
|
return modules.languages.findLanguage({ languageId });
|
|
21
17
|
}
|
|
@@ -14,7 +14,7 @@ export default async function removeLanguage(
|
|
|
14
14
|
if (!(await modules.languages.languageExists({ languageId })))
|
|
15
15
|
throw new LanguageNotFoundError({ languageId });
|
|
16
16
|
|
|
17
|
-
await modules.languages.delete(languageId
|
|
17
|
+
await modules.languages.delete(languageId);
|
|
18
18
|
|
|
19
19
|
return modules.languages.findLanguage({ languageId });
|
|
20
20
|
}
|
|
@@ -15,7 +15,7 @@ export default async function updateLanguage(
|
|
|
15
15
|
if (!(await modules.languages.languageExists({ languageId })))
|
|
16
16
|
throw new LanguageNotFoundError({ languageId });
|
|
17
17
|
|
|
18
|
-
await modules.languages.update(languageId, language
|
|
18
|
+
await modules.languages.update(languageId, language);
|
|
19
19
|
|
|
20
20
|
return modules.languages.findLanguage({ languageId });
|
|
21
21
|
}
|
|
@@ -13,5 +13,8 @@ export default async function createCart(
|
|
|
13
13
|
const order = await modules.orders.findOrder({ orderNumber });
|
|
14
14
|
if (order) throw new OrderNumberAlreadyExistsError({ orderNumber });
|
|
15
15
|
|
|
16
|
-
return services.orders.createUserCart(
|
|
16
|
+
return services.orders.createUserCart(
|
|
17
|
+
{ user, orderNumber, countryCode: context.countryContext },
|
|
18
|
+
context,
|
|
19
|
+
);
|
|
17
20
|
}
|
|
@@ -32,6 +32,6 @@ export default async function payOrder(root: Root, { orderId }: { orderId: strin
|
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
await modules.orders.payments.markAsPaid(payment, null
|
|
35
|
+
await modules.orders.payments.markAsPaid(payment, null);
|
|
36
36
|
return modules.orders.processOrder(order, {}, context);
|
|
37
37
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { log } from '@unchainedshop/logger';
|
|
2
2
|
import { emit } from '@unchainedshop/events';
|
|
3
3
|
|
|
4
|
-
export default (root, { path, referrer }, { userId }) => {
|
|
4
|
+
export default async (root, { path, referrer }, { userId }) => {
|
|
5
5
|
log(`mutation pageView ${path} ${referrer}`, { userId });
|
|
6
6
|
|
|
7
|
-
emit('PAGE_VIEW', {
|
|
7
|
+
await emit('PAGE_VIEW', {
|
|
8
8
|
path,
|
|
9
9
|
referrer,
|
|
10
10
|
});
|
|
@@ -10,13 +10,9 @@ export default async (
|
|
|
10
10
|
) => {
|
|
11
11
|
log('mutation createPaymentProvider', { userId });
|
|
12
12
|
|
|
13
|
-
const provider = await modules.payment.paymentProviders.create(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
authorId: userId,
|
|
17
|
-
},
|
|
18
|
-
userId,
|
|
19
|
-
);
|
|
13
|
+
const provider = await modules.payment.paymentProviders.create({
|
|
14
|
+
...paymentProvider,
|
|
15
|
+
});
|
|
20
16
|
|
|
21
17
|
if (!provider) throw new ProviderConfigurationInvalid(paymentProvider);
|
|
22
18
|
|
|
@@ -7,7 +7,7 @@ export default async function registerPaymentCredentials(
|
|
|
7
7
|
params: { paymentProviderId: string; transactionContext: any },
|
|
8
8
|
context: Context,
|
|
9
9
|
) {
|
|
10
|
-
const { modules,
|
|
10
|
+
const { modules, userId } = context;
|
|
11
11
|
const { paymentProviderId, transactionContext } = params;
|
|
12
12
|
log(`mutation registerPaymentCredentials for ${paymentProviderId}`, {
|
|
13
13
|
userId,
|
|
@@ -18,5 +18,9 @@ export default async function registerPaymentCredentials(
|
|
|
18
18
|
const paymentProvider = await modules.payment.paymentProviders.findProvider({ paymentProviderId });
|
|
19
19
|
if (!paymentProvider) throw new PaymentProviderNotFoundError({ paymentProviderId });
|
|
20
20
|
|
|
21
|
-
return
|
|
21
|
+
return modules.payment.registerCredentials(
|
|
22
|
+
paymentProviderId,
|
|
23
|
+
{ transactionContext, userId: context.userId },
|
|
24
|
+
context,
|
|
25
|
+
);
|
|
22
26
|
}
|
|
@@ -21,5 +21,5 @@ export default async (
|
|
|
21
21
|
)
|
|
22
22
|
throw new PaymentProviderNotFoundError({ paymentProviderId });
|
|
23
23
|
|
|
24
|
-
return modules.payment.paymentProviders.update(paymentProviderId, paymentProvider
|
|
24
|
+
return modules.payment.paymentProviders.update(paymentProviderId, paymentProvider);
|
|
25
25
|
};
|
|
@@ -36,14 +36,10 @@ export default async function addProductAssignment(
|
|
|
36
36
|
required: ProductTypes.ConfigurableProduct,
|
|
37
37
|
});
|
|
38
38
|
|
|
39
|
-
await modules.products.assignments.addProxyAssignment(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
vectors,
|
|
44
|
-
},
|
|
45
|
-
userId,
|
|
46
|
-
);
|
|
39
|
+
await modules.products.assignments.addProxyAssignment(productId, {
|
|
40
|
+
proxyId,
|
|
41
|
+
vectors,
|
|
42
|
+
});
|
|
47
43
|
|
|
48
44
|
return modules.products.findProduct({ productId: proxyId });
|
|
49
45
|
}
|
|
@@ -16,10 +16,9 @@ export default async function addProductMedia(root: Root, { media, productId },
|
|
|
16
16
|
directoryName: 'product-media',
|
|
17
17
|
rawFile: media,
|
|
18
18
|
meta: { productId },
|
|
19
|
-
userId,
|
|
20
19
|
},
|
|
21
20
|
context,
|
|
22
21
|
);
|
|
23
22
|
|
|
24
|
-
return modules.products.media.create({ productId, mediaId: file._id }
|
|
23
|
+
return modules.products.media.create({ productId, mediaId: file._id });
|
|
25
24
|
}
|
|
@@ -18,5 +18,5 @@ export default async function addProductReviewVote(
|
|
|
18
18
|
});
|
|
19
19
|
if (!productReview) throw new ProductReviewNotFoundError({ productReviewId });
|
|
20
20
|
|
|
21
|
-
return modules.products.reviews.votes.addVote(productReview, { meta, type
|
|
21
|
+
return modules.products.reviews.votes.addVote(productReview, { meta, type, userId });
|
|
22
22
|
}
|
|
@@ -9,12 +9,8 @@ export default async function createProduct(
|
|
|
9
9
|
) {
|
|
10
10
|
log('mutation createProduct', { userId });
|
|
11
11
|
|
|
12
|
-
return modules.products.create(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
locale: localeContext.language,
|
|
17
|
-
},
|
|
18
|
-
userId,
|
|
19
|
-
);
|
|
12
|
+
return modules.products.create({
|
|
13
|
+
...product,
|
|
14
|
+
locale: localeContext.language,
|
|
15
|
+
});
|
|
20
16
|
}
|
|
@@ -27,7 +27,7 @@ export default async function createProductBundleItem(
|
|
|
27
27
|
if (!(await modules.products.productExists({ productId: item.productId })))
|
|
28
28
|
throw new ProductNotFoundError({ productId: item.productId });
|
|
29
29
|
|
|
30
|
-
await modules.products.bundleItems.addBundleItem(productId, item
|
|
30
|
+
await modules.products.bundleItems.addBundleItem(productId, item);
|
|
31
31
|
|
|
32
32
|
return modules.products.findProduct({ productId });
|
|
33
33
|
}
|
|
@@ -16,12 +16,9 @@ export default async function createProductReview(
|
|
|
16
16
|
if (!(await modules.products.productExists({ productId })))
|
|
17
17
|
throw new ProductNotFoundError({ productId });
|
|
18
18
|
|
|
19
|
-
return modules.products.reviews.create(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
userId,
|
|
26
|
-
);
|
|
19
|
+
return modules.products.reviews.create({
|
|
20
|
+
productId,
|
|
21
|
+
authorId: userId,
|
|
22
|
+
...productReview,
|
|
23
|
+
});
|
|
27
24
|
}
|
|
@@ -32,14 +32,10 @@ export default async function F(
|
|
|
32
32
|
required: ProductTypes.ConfigurableProduct,
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
return modules.products.variations.create(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
...variation,
|
|
42
|
-
},
|
|
43
|
-
userId,
|
|
44
|
-
);
|
|
35
|
+
return modules.products.variations.create({
|
|
36
|
+
locale: localeContext.language,
|
|
37
|
+
options: [],
|
|
38
|
+
productId,
|
|
39
|
+
...variation,
|
|
40
|
+
});
|
|
45
41
|
}
|
|
@@ -23,9 +23,8 @@ export default async function createProductVariationOption(
|
|
|
23
23
|
});
|
|
24
24
|
if (!variation) throw new ProductVariationNotFoundError({ productVariationId });
|
|
25
25
|
|
|
26
|
-
return modules.products.variations.addVariationOption(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
);
|
|
26
|
+
return modules.products.variations.addVariationOption(productVariationId, {
|
|
27
|
+
...inputData,
|
|
28
|
+
locale: localeContext.language,
|
|
29
|
+
});
|
|
31
30
|
}
|
|
@@ -14,7 +14,7 @@ export default async function publishProduct(
|
|
|
14
14
|
const product = await modules.products.findProduct({ productId });
|
|
15
15
|
if (!product) throw new ProductNotFoundError({ productId });
|
|
16
16
|
|
|
17
|
-
if (!(await modules.products.publish(product
|
|
17
|
+
if (!(await modules.products.publish(product))) {
|
|
18
18
|
throw new ProductWrongStatusError({ status: product.status });
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -8,7 +8,7 @@ export default async function removeBundleItem(
|
|
|
8
8
|
{ productId, index }: { productId: string; index: number },
|
|
9
9
|
{ modules, userId }: Context,
|
|
10
10
|
) {
|
|
11
|
-
log(`mutation removeBundleItem ${productId}`, {
|
|
11
|
+
log(`mutation removeBundleItem ${productId} ${index}`, { userId });
|
|
12
12
|
|
|
13
13
|
if (!productId) throw new InvalidIdError({ productId });
|
|
14
14
|
|
|
@@ -22,7 +22,7 @@ export default async function removeBundleItem(
|
|
|
22
22
|
required: ProductTypes.BundleProduct,
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
await modules.products.bundleItems.removeBundleItem(productId, index
|
|
25
|
+
await modules.products.bundleItems.removeBundleItem(productId, index);
|
|
26
26
|
|
|
27
27
|
return modules.products.findProduct({ productId });
|
|
28
28
|
}
|
|
@@ -1,23 +1,42 @@
|
|
|
1
1
|
import { log } from '@unchainedshop/logger';
|
|
2
2
|
import { Context, Root } from '@unchainedshop/types/api';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
ProductNotFoundError,
|
|
5
|
+
InvalidIdError,
|
|
6
|
+
ProductLinkedToActiveVariationError,
|
|
7
|
+
ProductLinkedToActiveBundleError,
|
|
8
|
+
ProductLinkedToEnrollmentError,
|
|
9
|
+
ProductLinkedToQuotationError,
|
|
10
|
+
} from '../../../errors';
|
|
4
11
|
|
|
5
12
|
export default async function removeProduct(
|
|
6
13
|
root: Root,
|
|
7
14
|
{ productId }: { productId: string },
|
|
8
|
-
|
|
15
|
+
context: Context,
|
|
9
16
|
) {
|
|
17
|
+
const { modules, services, userId } = context;
|
|
10
18
|
log(`mutation removeProduct ${productId}`, { userId });
|
|
11
19
|
|
|
12
20
|
if (!productId) throw new InvalidIdError({ productId });
|
|
13
21
|
|
|
14
|
-
|
|
15
|
-
|
|
22
|
+
if (!(await modules.products.productExists({ productId })))
|
|
23
|
+
throw new ProductNotFoundError({ productId });
|
|
16
24
|
|
|
17
|
-
|
|
25
|
+
const activeBundle = await modules.products.firstActiveProductBundle(productId);
|
|
26
|
+
if (activeBundle)
|
|
27
|
+
throw new ProductLinkedToActiveBundleError({ productId, bundleId: activeBundle._id });
|
|
28
|
+
const activeProxy = await modules.products.firstActiveProductProxy(productId);
|
|
29
|
+
if (activeProxy)
|
|
30
|
+
throw new ProductLinkedToActiveVariationError({ productId, proxyId: activeProxy._id });
|
|
18
31
|
|
|
19
|
-
await modules.
|
|
20
|
-
|
|
32
|
+
const openQuotation = await modules.quotations.openQuotationWithProduct({ productId });
|
|
33
|
+
if (openQuotation)
|
|
34
|
+
throw new ProductLinkedToQuotationError({ productId, quotationId: openQuotation?._id });
|
|
35
|
+
const openEnrollment = await modules.enrollments.openEnrollmentWithProduct({ productId });
|
|
36
|
+
if (openEnrollment)
|
|
37
|
+
throw new ProductLinkedToEnrollmentError({ productId, enrollmentId: openEnrollment?._id });
|
|
38
|
+
|
|
39
|
+
await services.products.removeProduct({ productId }, context);
|
|
21
40
|
|
|
22
41
|
return modules.products.findProduct({ productId });
|
|
23
42
|
}
|
|
@@ -24,7 +24,7 @@ export default async function removeProductAssignment(
|
|
|
24
24
|
required: ProductTypes.ConfigurableProduct,
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
await modules.products.assignments.removeAssignment(proxyId, { vectors }
|
|
27
|
+
await modules.products.assignments.removeAssignment(proxyId, { vectors });
|
|
28
28
|
|
|
29
29
|
return modules.products.findProduct({ productId: proxyId });
|
|
30
30
|
}
|
|
@@ -16,8 +16,8 @@ export default async function removeProductMedia(
|
|
|
16
16
|
});
|
|
17
17
|
if (!productMedia) throw new ProductMediaNotFoundError({ productMediaId });
|
|
18
18
|
|
|
19
|
-
await modules.files.delete(productMedia.mediaId
|
|
20
|
-
await modules.products.media.delete(productMediaId
|
|
19
|
+
await modules.files.delete(productMedia.mediaId);
|
|
20
|
+
await modules.products.media.delete(productMediaId);
|
|
21
21
|
|
|
22
22
|
return productMedia;
|
|
23
23
|
}
|
|
@@ -14,7 +14,7 @@ export default async function removeProductReview(
|
|
|
14
14
|
if (!(await modules.products.reviews.reviewExists({ productReviewId })))
|
|
15
15
|
throw new ProductReviewNotFoundError({ productReviewId });
|
|
16
16
|
|
|
17
|
-
await modules.products.reviews.delete(productReviewId
|
|
17
|
+
await modules.products.reviews.delete(productReviewId);
|
|
18
18
|
|
|
19
19
|
return modules.products.reviews.findProductReview({
|
|
20
20
|
productReviewId,
|
|
@@ -19,5 +19,5 @@ export default async function removeProductReviewVote(
|
|
|
19
19
|
});
|
|
20
20
|
if (!productReview) throw new ProductReviewNotFoundError({ productReviewId });
|
|
21
21
|
|
|
22
|
-
return modules.products.reviews.votes.removeVote(productReviewId, { type, userId }
|
|
22
|
+
return modules.products.reviews.votes.removeVote(productReviewId, { type, userId });
|
|
23
23
|
}
|
|
@@ -16,7 +16,7 @@ export default async function removeProductVariation(
|
|
|
16
16
|
});
|
|
17
17
|
if (!productVariation) throw new ProductVariationNotFoundError({ productVariationId });
|
|
18
18
|
|
|
19
|
-
await modules.products.variations.delete(productVariationId
|
|
19
|
+
await modules.products.variations.delete(productVariationId);
|
|
20
20
|
|
|
21
21
|
return productVariation;
|
|
22
22
|
}
|
|
@@ -14,7 +14,7 @@ export default async function unpublishProduct(
|
|
|
14
14
|
const product = await modules.products.findProduct({ productId });
|
|
15
15
|
if (!product) throw new ProductNotFoundError({ productId });
|
|
16
16
|
|
|
17
|
-
if (!(await modules.products.unpublish(product
|
|
17
|
+
if (!(await modules.products.unpublish(product))) {
|
|
18
18
|
throw new ProductWrongStatusError({ status: product.status });
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -15,7 +15,7 @@ export default async function updateProduct(
|
|
|
15
15
|
if (!(await modules.products.productExists({ productId })))
|
|
16
16
|
throw new ProductNotFoundError({ productId });
|
|
17
17
|
|
|
18
|
-
await modules.products.update(productId, product
|
|
18
|
+
await modules.products.update(productId, product);
|
|
19
19
|
|
|
20
20
|
return modules.products.findProduct({ productId });
|
|
21
21
|
}
|
|
@@ -15,7 +15,7 @@ export default async function updateProductCommerce(
|
|
|
15
15
|
if (!(await modules.products.productExists({ productId })))
|
|
16
16
|
throw new ProductNotFoundError({ productId });
|
|
17
17
|
|
|
18
|
-
await modules.products.update(productId, { commerce }
|
|
18
|
+
await modules.products.update(productId, { commerce });
|
|
19
19
|
|
|
20
20
|
return modules.products.findProduct({ productId });
|
|
21
21
|
}
|
|
@@ -17,5 +17,5 @@ export default async function updateProductMediaTexts(
|
|
|
17
17
|
});
|
|
18
18
|
if (!productMedia) throw new ProductMediaNotFoundError({ productMediaId });
|
|
19
19
|
|
|
20
|
-
return modules.products.media.texts.updateMediaTexts(productMediaId, texts
|
|
20
|
+
return modules.products.media.texts.updateMediaTexts(productMediaId, texts);
|
|
21
21
|
}
|
|
@@ -22,7 +22,7 @@ export default async function updateProductPlan(
|
|
|
22
22
|
required: ProductTypes.PlanProduct,
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
await modules.products.update(productId, { plan }
|
|
25
|
+
await modules.products.update(productId, { plan });
|
|
26
26
|
|
|
27
27
|
return modules.products.findProduct({ productId });
|
|
28
28
|
}
|
|
@@ -17,5 +17,5 @@ export default async function updateProductReview(
|
|
|
17
17
|
if (!(await modules.products.reviews.reviewExists({ productReviewId })))
|
|
18
18
|
throw new ProductReviewNotFoundError({ productReviewId });
|
|
19
19
|
|
|
20
|
-
return modules.products.reviews.update(productReviewId, productReview
|
|
20
|
+
return modules.products.reviews.update(productReviewId, productReview);
|
|
21
21
|
}
|
|
@@ -24,7 +24,7 @@ export default async function updateProductSupply(
|
|
|
24
24
|
required: ProductTypes.SimpleProduct,
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
await modules.products.update(productId, { supply }
|
|
27
|
+
await modules.products.update(productId, { supply });
|
|
28
28
|
|
|
29
29
|
return modules.products.findProduct({ productId });
|
|
30
30
|
}
|
|
@@ -14,7 +14,7 @@ export default async function updateProductTexts(
|
|
|
14
14
|
const product = await modules.products.findProduct({ productId });
|
|
15
15
|
if (!product) throw new ProductNotFoundError({ productId });
|
|
16
16
|
|
|
17
|
-
const productTexts = await modules.products.texts.updateTexts(productId, texts
|
|
17
|
+
const productTexts = await modules.products.texts.updateTexts(productId, texts);
|
|
18
18
|
|
|
19
19
|
return productTexts;
|
|
20
20
|
}
|
|
@@ -22,7 +22,7 @@ export default async function updateProductTokenization(
|
|
|
22
22
|
required: ProductTypes.TokenizedProduct,
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
await modules.products.update(productId, { tokenization }
|
|
25
|
+
await modules.products.update(productId, { tokenization });
|
|
26
26
|
|
|
27
27
|
return modules.products.findProduct({ productId });
|
|
28
28
|
}
|
|
@@ -24,7 +24,7 @@ export default async function updateProductWarehousing(
|
|
|
24
24
|
required: ProductTypes.SimpleProduct,
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
await modules.products.update(productId, { warehousing }
|
|
27
|
+
await modules.products.update(productId, { warehousing });
|
|
28
28
|
|
|
29
29
|
return modules.products.findProduct({ productId });
|
|
30
30
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { log } from '@unchainedshop/logger';
|
|
2
|
+
import { Context, Root } from '@unchainedshop/types/api';
|
|
3
|
+
import { UserNotFoundError } from '../../../errors';
|
|
4
|
+
|
|
5
|
+
export default async function removeUser(
|
|
6
|
+
root: Root,
|
|
7
|
+
params: { userId: string },
|
|
8
|
+
{ modules, userId }: Context,
|
|
9
|
+
) {
|
|
10
|
+
const { userId: paramUserId } = params;
|
|
11
|
+
const normalizedUserId = paramUserId || userId;
|
|
12
|
+
|
|
13
|
+
log(`mutation removeUser ${normalizedUserId}`, { userId });
|
|
14
|
+
|
|
15
|
+
if (!(await modules.users.userExists({ userId: normalizedUserId })))
|
|
16
|
+
throw UserNotFoundError({ id: normalizedUserId });
|
|
17
|
+
|
|
18
|
+
return modules.users.delete(normalizedUserId);
|
|
19
|
+
}
|