@unchainedshop/api 2.0.0-beta8 → 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 +1 -0
- package/lib/api-index.js +1 -1
- package/lib/api-index.js.map +1 -1
- package/lib/createGraphQLServer.js +11 -17
- 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/createBulkImportMiddleware.js +1 -1
- package/lib/express/createBulkImportMiddleware.js.map +1 -1
- package/lib/express/createERCMetadataMiddleware.js +2 -1
- package/lib/express/createERCMetadataMiddleware.js.map +1 -1
- package/lib/express/createSingleSignOnMiddleware.js.map +1 -1
- package/lib/loaders/index.js +5 -9
- package/lib/loaders/index.js.map +1 -1
- package/lib/resolvers/mutations/accounts/changePassword.js +12 -1
- package/lib/resolvers/mutations/accounts/changePassword.js.map +1 -1
- package/lib/resolvers/mutations/accounts/createUser.js +17 -3
- 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 +17 -4
- 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.js +19 -1
- 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.js +17 -2
- package/lib/resolvers/mutations/accounts/resetPassword.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/removeAssortmentMedia.js +2 -2
- package/lib/resolvers/mutations/assortments/removeAssortmentMedia.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.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 +3 -3
- 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 +1 -0
- 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/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.js +14 -2
- 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.js +0 -1
- package/lib/resolvers/type/assortment/assortment-filter-types.js.map +1 -1
- 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.js +2 -0
- package/lib/resolvers/type/assortment/assortment-media-types.js.map +1 -1
- package/lib/resolvers/type/assortment/assortment-path-link-types.js +1 -0
- package/lib/resolvers/type/assortment/assortment-path-link-types.js.map +1 -1
- 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.js +8 -4
- package/lib/resolvers/type/assortment/assortment-types.js.map +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/enrollment/enrollment-plan-tyes.js +0 -1
- package/lib/resolvers/type/enrollment/enrollment-plan-tyes.js.map +1 -1
- 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-item-types.js +0 -3
- package/lib/resolvers/type/order/order-item-types.js.map +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-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.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.js +0 -1
- package/lib/resolvers/type/quotation-types.js.map +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 +3 -0
- package/lib/resolvers/type/user-types.js +10 -9
- package/lib/resolvers/type/user-types.js.map +1 -1
- package/lib/roles/admin.js +3 -72
- package/lib/roles/admin.js.map +1 -1
- package/lib/schema/mutation.js +20 -15
- package/lib/schema/mutation.js.map +1 -1
- package/lib/schema/query.js +14 -12
- package/lib/schema/query.js.map +1 -1
- package/lib/schema/types/assortment.js +1 -0
- package/lib/schema/types/assortment.js.map +1 -1
- package/lib/schema/types/dispatch.js +0 -1
- package/lib/schema/types/dispatch.js.map +1 -1
- package/lib/schema/types/product/plan-product.js +0 -1
- package/lib/schema/types/product/plan-product.js.map +1 -1
- package/lib/schema/types/product/simple-product.js +0 -1
- package/lib/schema/types/product/simple-product.js.map +1 -1
- package/lib/schema/types/product/tokenized-product.js +0 -1
- package/lib/schema/types/product/tokenized-product.js.map +1 -1
- package/lib/schema/types/stock.js +0 -1
- package/lib/schema/types/stock.js.map +1 -1
- package/lib/schema/types/user.js +3 -0
- package/lib/schema/types/user.js.map +1 -1
- package/package.json +12 -11
- package/src/acl.ts +2 -2
- package/src/api-index.ts +1 -1
- package/src/createGraphQLServer.ts +13 -24
- package/src/errors.ts +85 -0
- package/src/express/createBulkImportMiddleware.ts +6 -9
- package/src/express/createERCMetadataMiddleware.ts +2 -1
- package/src/express/createSingleSignOnMiddleware.ts +3 -2
- package/src/loaders/index.ts +27 -35
- package/src/resolvers/mutations/accounts/changePassword.ts +9 -2
- package/src/resolvers/mutations/accounts/createUser.ts +19 -4
- 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 +19 -4
- 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 +24 -1
- 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 +19 -3
- 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/removeAssortmentMedia.ts +2 -2
- 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 +3 -3
- 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/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 +23 -2
- 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 -0
- 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 -10
- package/src/roles/admin.ts +3 -72
- package/src/schema/mutation.js +20 -15
- package/src/schema/query.js +14 -12
- package/src/schema/types/assortment.js +1 -0
- package/src/schema/types/dispatch.js +0 -1
- package/src/schema/types/product/plan-product.js +0 -1
- package/src/schema/types/product/simple-product.js +0 -1
- package/src/schema/types/product/tokenized-product.js +0 -1
- package/src/schema/types/stock.js +0 -1
- package/src/schema/types/user.js +3 -0
- package/tests/api-index.test.ts +78 -0
package/jest.config.js
CHANGED
package/lib/acl.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { CheckPermissionArgs } from '@unchainedshop/types/roles';
|
|
2
|
+
export declare const ensureActionExists: (action: any, userOptions: any) => void;
|
|
3
|
+
export declare const ensureIsFunction: (fn: any, action: any, options: any, key: any) => void;
|
|
2
4
|
declare const checkAction: (context: any, action: any, args?: CheckPermissionArgs, options?: any) => Promise<void>;
|
|
3
5
|
declare const checkResolver: (action: any, userOptions?: any) => (fn: any, name?: string) => (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
4
6
|
declare const checkTypeResolver: (action: any, key: any) => (obj: any, params: any, context: any) => Promise<any>;
|
package/lib/acl.js
CHANGED
|
@@ -6,12 +6,12 @@ const defaultOptions = {
|
|
|
6
6
|
};
|
|
7
7
|
const emptyObject = {};
|
|
8
8
|
const emptyArray = [];
|
|
9
|
-
const ensureActionExists = (action, userOptions) => {
|
|
9
|
+
export const ensureActionExists = (action, userOptions) => {
|
|
10
10
|
if (!action) {
|
|
11
11
|
throw new PermissionSystemError({ userOptions });
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
|
-
const ensureIsFunction = (fn, action, options, key) => {
|
|
14
|
+
export const ensureIsFunction = (fn, action, options, key) => {
|
|
15
15
|
if (typeof fn !== 'function') {
|
|
16
16
|
throw new PermissionSystemError({
|
|
17
17
|
action,
|
package/lib/acl.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acl.js","sourceRoot":"","sources":["../src/acl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEpE,MAAM,cAAc,GAAG;IACrB,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,IAAI;CAC3B,CAAC;AAEF,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,UAAU,GAAwB,EAAE,CAAC;AAE3C,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"acl.js","sourceRoot":"","sources":["../src/acl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEpE,MAAM,cAAc,GAAG;IACrB,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,IAAI;CAC3B,CAAC;AAEF,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,UAAU,GAAwB,EAAE,CAAC;AAE3C,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE;IACxD,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,IAAI,qBAAqB,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC;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C5E,kBAAkB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACxC,OAAO,SAAS,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,UAAU;QAC/C,MAAM,EAAE,GAAG,UAAU,CAAC,KAAK,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC;QAC3C,OAAO;YACL,YAAY,EAAE,IAAI;YAClB,GAAG;gBACD,MAAM,KAAK,GAAG,YAAY,CAAC,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;gBACzD,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,EAAE;oBAC/B,KAAK;oBACL,YAAY,EAAE,IAAI;oBAClB,QAAQ,EAAE,IAAI;iBACf,CAAC,CAAC;gBACH,OAAO,KAAK,CAAC;YACf,CAAC;SACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,6BAA6B;AAC7B,iCAAiC;AACjC,eAAe,iBAAiB,CAAC;AAEjC,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,CAAC"}
|
package/lib/api-index.d.ts
CHANGED
|
@@ -8,4 +8,5 @@ export * as express from './express';
|
|
|
8
8
|
export { hashPassword } from './hashPassword';
|
|
9
9
|
export * as roles from './roles';
|
|
10
10
|
export { createContextResolver, getCurrentContextResolver, setCurrentContextResolver };
|
|
11
|
+
export declare const loadJSON: (filename: any) => any;
|
|
11
12
|
export declare const startAPIServer: (options: UnchainedServerOptions) => Promise<ApolloServer>;
|
package/lib/api-index.js
CHANGED
|
@@ -9,7 +9,7 @@ export * as express from './express';
|
|
|
9
9
|
export { hashPassword } from './hashPassword';
|
|
10
10
|
export * as roles from './roles';
|
|
11
11
|
export { createContextResolver, getCurrentContextResolver, setCurrentContextResolver };
|
|
12
|
-
const loadJSON = (filename) => {
|
|
12
|
+
export const loadJSON = (filename) => {
|
|
13
13
|
try {
|
|
14
14
|
const base = typeof __filename !== 'undefined' && __filename;
|
|
15
15
|
if (!base)
|
package/lib/api-index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-index.js","sourceRoot":"","sources":["../src/api-index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAExG,cAAc,WAAW,CAAC;AAC1B,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,CAAC;AAEvF,MAAM,QAAQ,GAAG,CAAC,QAAQ,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"api-index.js","sourceRoot":"","sources":["../src/api-index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAExG,cAAc,WAAW,CAAC;AAC1B,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,qBAAqB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CACpB,CAAC;IAEF,OAAO,mBAAmB,CAAC,mBAAmB,CAAC,CAAC;AAClD,CAAC,CAAC"}
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import { ApolloServer } from '@apollo/server';
|
|
2
|
-
import { GraphQLError } from 'graphql';
|
|
3
2
|
import { log, LogLevel } from '@unchainedshop/logger';
|
|
4
3
|
import typeDefs from './schema';
|
|
5
4
|
import resolvers from './resolvers';
|
|
6
5
|
const { APOLLO_ENGINE_KEY } = process.env;
|
|
7
6
|
const logGraphQLServerError = (error) => {
|
|
8
7
|
try {
|
|
9
|
-
const { message, extensions: {
|
|
10
|
-
log(`${message} ${
|
|
8
|
+
const { message, extensions: { stacktrace, ...parameters }, ...rest } = error;
|
|
9
|
+
log(`${message} ${parameters && parameters.code}`, {
|
|
11
10
|
level: LogLevel.Error,
|
|
12
|
-
...
|
|
11
|
+
...parameters,
|
|
13
12
|
...rest,
|
|
14
13
|
});
|
|
15
|
-
|
|
14
|
+
if (stacktrace && process.env.NODE_ENV !== 'production' && process.env.NODE_ENV !== 'test') {
|
|
15
|
+
const nativeError = new Error(message);
|
|
16
|
+
nativeError.stack = stacktrace.join('\n');
|
|
17
|
+
nativeError.name = parameters.code;
|
|
18
|
+
// eslint-disable-next-line
|
|
19
|
+
console.error(nativeError);
|
|
20
|
+
}
|
|
16
21
|
}
|
|
17
22
|
catch (e) { } // eslint-disable-line
|
|
18
23
|
};
|
|
@@ -23,18 +28,7 @@ export default async (options) => {
|
|
|
23
28
|
resolvers: [resolvers, ...additionalResolvers],
|
|
24
29
|
formatError: (error) => {
|
|
25
30
|
logGraphQLServerError(error);
|
|
26
|
-
|
|
27
|
-
} = error;
|
|
28
|
-
const apolloError = new GraphQLError(message, {
|
|
29
|
-
extensions: {
|
|
30
|
-
code,
|
|
31
|
-
...extensions,
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
// eslint-disable-next-line
|
|
35
|
-
// @ts-ignore
|
|
36
|
-
apolloError.path = path;
|
|
37
|
-
return apolloError;
|
|
31
|
+
return error;
|
|
38
32
|
},
|
|
39
33
|
apollo: APOLLO_ENGINE_KEY
|
|
40
34
|
? {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createGraphQLServer.js","sourceRoot":"","sources":["../src/createGraphQLServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"createGraphQLServer.js","sourceRoot":"","sources":["../src/createGraphQLServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,MAAM,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;AAE1C,MAAM,qBAAqB,GAAG,CAAC,KAA4B,EAAE,EAAE;IAC7D,IAAI;QACF,MAAM,EACJ,OAAO,EACP,UAAU,EAAE,EAAE,UAAU,EAAE,GAAG,UAAU,EAAE,EACzC,GAAG,IAAI,EACR,GAAG,KAAK,CAAC;QACV,GAAG,CAAC,GAAG,OAAO,IAAI,UAAU,IAAI,UAAU,CAAC,IAAI,EAAE,EAAE;YACjD,KAAK,EAAE,QAAQ,CAAC,KAAK;YACrB,GAAG,UAAU;YACb,GAAG,IAAI;SACR,CAAC,CAAC;QACH,IAAI,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,EAAE;YAC1F,MAAM,WAAW,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;YACvC,WAAW,CAAC,KAAK,GAAI,UAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACxD,WAAW,CAAC,IAAI,GAAG,UAAU,CAAC,IAAc,CAAC;YAC7C,2BAA2B;YAC3B,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;SAC5B;KACF;IAAC,OAAO,CAAC,EAAE,GAAE,CAAC,sBAAsB;AACvC,CAAC,CAAC;AAEF,eAAe,KAAK,EAAE,OAAO,EAAE,EAAE;IAC/B,MAAM,EACJ,QAAQ,EAAE,kBAAkB,GAAG,EAAE,EACjC,SAAS,EAAE,mBAAmB,GAAG,EAAE,EACnC,MAAM,GAAG,EAAE,EACX,GAAG,mBAAmB,EACvB,GAAG,OAAO,IAAI,EAAE,CAAC;IAElB,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC;QAC9B,QAAQ,EAAE,CAAC,GAAG,QAAQ,EAAE,GAAG,kBAAkB,CAAC;QAC9C,SAAS,EAAE,CAAC,SAAS,EAAE,GAAG,mBAAmB,CAAC;QAC9C,WAAW,EAAE,CAAC,KAAK,EAAE,EAAE;YACrB,qBAAqB,CAAC,KAAK,CAAC,CAAC;YAC7B,OAAO,KAAK,CAAC;QACf,CAAC;QACD,MAAM,EAAE,iBAAiB;YACvB,CAAC,CAAC;gBACE,GAAG,EAAE,iBAAiB;gBACtB,gBAAgB,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,kBAAkB,CAAC;gBACpF,GAAG,MAAM;aACV;YACH,CAAC,CAAC,SAAS;QACb,GAAG,mBAAmB;KACvB,CAAC,CAAC;IAEH,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IAErB,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
package/lib/errors.d.ts
CHANGED
|
@@ -53,3 +53,23 @@ export declare const WarehousingProviderNotFoundError: any;
|
|
|
53
53
|
export declare const InvalidIdError: any;
|
|
54
54
|
export declare const ProviderConfigurationInvalid: any;
|
|
55
55
|
export declare const TokenWrongStatusError: any;
|
|
56
|
+
export declare const CyclicAssortmentLinkNotSupportedError: any;
|
|
57
|
+
export declare const EmailAlreadyExistsError: any;
|
|
58
|
+
export declare const UsernameAlreadyExistsError: any;
|
|
59
|
+
export declare const UsernameOrEmailRequiredError: any;
|
|
60
|
+
export declare const TwoFactorCodeDidNotMatchError: any;
|
|
61
|
+
export declare const TwoFactorCodeRequiredError: any;
|
|
62
|
+
export declare const TwoFactorAlreadySetError: any;
|
|
63
|
+
export declare const TwoFactorNotSetError: any;
|
|
64
|
+
export declare const InvalidCredentialsError: any;
|
|
65
|
+
export declare const InvalidResetTokenError: any;
|
|
66
|
+
export declare const NoEmailSetError: any;
|
|
67
|
+
export declare const ResetPasswordLinkExpiredError: any;
|
|
68
|
+
export declare const ResetPasswordLinkUnknownAddressError: any;
|
|
69
|
+
export declare const AuthenticationFailedError: any;
|
|
70
|
+
export declare const UserDeactivatedError: any;
|
|
71
|
+
export declare const AuthOperationFailedError: any;
|
|
72
|
+
export declare const ProductLinkedToActiveVariationError: any;
|
|
73
|
+
export declare const ProductLinkedToActiveBundleError: any;
|
|
74
|
+
export declare const ProductLinkedToEnrollmentError: any;
|
|
75
|
+
export declare const ProductLinkedToQuotationError: any;
|
package/lib/errors.js
CHANGED
|
@@ -63,4 +63,24 @@ export const WarehousingProviderNotFoundError = createError('WarehousingProvider
|
|
|
63
63
|
export const InvalidIdError = createError('InvalidIdError', 'Invalid ID provided');
|
|
64
64
|
export const ProviderConfigurationInvalid = createError('ProviderConfigurationInvalid', 'Provider Configuration invalid (check if the Adapter Key exists)');
|
|
65
65
|
export const TokenWrongStatusError = createError('TokenWrongStatusError', 'The current status of the token does not allow this operation');
|
|
66
|
+
export const CyclicAssortmentLinkNotSupportedError = createError('CyclicAssortmentLinkNotSupported', 'Cyclic assortment link detected, make sure child assortment is not assigned as a parent on the assortment graph');
|
|
67
|
+
export const EmailAlreadyExistsError = createError('EmailAlreadyExists', 'Email already exist in the database');
|
|
68
|
+
export const UsernameAlreadyExistsError = createError('UsernameAlreadyExists', 'Username already exist in the database');
|
|
69
|
+
export const UsernameOrEmailRequiredError = createError('UsernameOrEmailRequired', 'No username or email is provided.');
|
|
70
|
+
export const TwoFactorCodeDidNotMatchError = createError('TwoFactorCodeDidNotMatch', "2FA code didn't match");
|
|
71
|
+
export const TwoFactorCodeRequiredError = createError('TwoFactorCodeRequired', '2FA code required');
|
|
72
|
+
export const TwoFactorAlreadySetError = createError('TwoFactorAlreadySet', '2FA already set for user');
|
|
73
|
+
export const TwoFactorNotSetError = createError('TwoFactorNotSet', '2FA not set for user');
|
|
74
|
+
export const InvalidCredentialsError = createError('InvalidCredentials', 'Incorrect credential provided');
|
|
75
|
+
export const InvalidResetTokenError = createError('InvalidResetTokenError', 'Token validation failed');
|
|
76
|
+
export const NoEmailSetError = createError('NoEmailSet', 'User has no email set');
|
|
77
|
+
export const ResetPasswordLinkExpiredError = createError('ResetPasswordLinkExpired', 'Token does not exist or is expired');
|
|
78
|
+
export const ResetPasswordLinkUnknownAddressError = createError('ResetPasswordLinkUnknownAddress', 'Valid token but no email address found for the entry');
|
|
79
|
+
export const AuthenticationFailedError = createError('AuthenticationFailed', 'Failed to authenticate the user');
|
|
80
|
+
export const UserDeactivatedError = createError('UserDeactivatedError', 'User is deactivated, so not allowed to login');
|
|
81
|
+
export const AuthOperationFailedError = createError('AuthOperationFailed', 'Operation failed, please make sure you have provided all required parameters');
|
|
82
|
+
export const ProductLinkedToActiveVariationError = createError('ProductLinkedToActiveVariation', 'Product is part of a active variation, remove it from any active/draft variation before deleting');
|
|
83
|
+
export const ProductLinkedToActiveBundleError = createError('ProductLinkedToActiveBundle', 'Product is part of a active/draft bundle item, remove it from any active/draft bundle item before deleting');
|
|
84
|
+
export const ProductLinkedToEnrollmentError = createError('ProductLinkedToEnrollment', 'Product is part of a active/paused subscriptions item, remove it from any active/paused subscriptions item before deleting');
|
|
85
|
+
export const ProductLinkedToQuotationError = createError('ProductLinkedToQuotation', 'Product is part of a requested/proposed quotations item, remove it from any requested/proposed quotations item before deleting');
|
|
66
86
|
//# sourceMappingURL=errors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GAAG,WAAW,CAAC,YAAY,EAAE,uBAAuB,CAAC,CAAC;AAElF,MAAM,CAAC,MAAM,6BAA6B,GAAG,WAAW,CACtD,0BAA0B,EAC1B,oCAAoC,CACrC,CAAC;AAEF,MAAM,CAAC,MAAM,oCAAoC,GAAG,WAAW,CAC7D,iCAAiC,EACjC,sDAAsD,CACvD,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG,WAAW,CAClD,sBAAsB,EACtB,iCAAiC,CAClC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,WAAW,CAC7C,sBAAsB,EACtB,8CAA8C,CAC/C,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,WAAW,CACjD,qBAAqB,EACrB,8EAA8E,CAC/E,CAAC;AAEF,MAAM,CAAC,MAAM,mCAAmC,GAAG,WAAW,CAC5D,gCAAgC,EAChC,kGAAkG,CACnG,CAAC;AAEF,MAAM,CAAC,MAAM,gCAAgC,GAAG,WAAW,CACzD,6BAA6B,EAC7B,4GAA4G,CAC7G,CAAC;AAEF,MAAM,CAAC,MAAM,8BAA8B,GAAG,WAAW,CACvD,2BAA2B,EAC3B,4HAA4H,CAC7H,CAAC;AAEF,MAAM,CAAC,MAAM,6BAA6B,GAAG,WAAW,CACtD,0BAA0B,EAC1B,gIAAgI,CACjI,CAAC"}
|
|
@@ -62,7 +62,7 @@ export default function bulkImportMiddleware(contextResolver) {
|
|
|
62
62
|
input: Object.fromEntries(Object.entries(input).filter(([, value]) => Boolean(value))),
|
|
63
63
|
retries: 0,
|
|
64
64
|
priority: 10,
|
|
65
|
-
}
|
|
65
|
+
});
|
|
66
66
|
res.writeHead(200);
|
|
67
67
|
res.end(JSON.stringify(work));
|
|
68
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createBulkImportMiddleware.js","sourceRoot":"","sources":["../../src/express/createBulkImportMiddleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,M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,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;iBACtB;YACH,CAAC,CAAC,CAAC;SACN;QAAC,OAAO,CAAC,EAAE;YACV,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;SACtB;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -39,8 +39,9 @@ export default function ercMetadataMiddleware(contextResolver) {
|
|
|
39
39
|
const ercMetadata = await context.modules.warehousing.tokenMetadata(chainTokenId, {
|
|
40
40
|
token,
|
|
41
41
|
product,
|
|
42
|
+
locale: new Locale(locale),
|
|
42
43
|
referenceDate: new Date(),
|
|
43
|
-
},
|
|
44
|
+
}, context);
|
|
44
45
|
const body = JSON.stringify(ercMetadata);
|
|
45
46
|
res.writeHead(200, {
|
|
46
47
|
'Content-Length': Buffer.byteLength(body),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createERCMetadataMiddleware.js","sourceRoot":"","sources":["../../src/express/createERCMetadataMiddleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,SAAS,MAAM,QAAQ,CAAC;AAC/B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;AAE7B,MAAM,MAAM,GAAG,YAAY,CAAC,wBAAwB,CAAC,CAAC;AAEtD,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;IAClC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IACxB,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACnB,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,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Y,EAAE,eAAe;aACxD,CAAC,CAAC;YAEH,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,aAAa,CACjE,YAAY,EACZ;gBACE,KAAK;gBACL,OAAO;gBACP,MAAM,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC;gBAC1B,aAAa,EAAE,IAAI,IAAI,EAAE;aAC1B,EACD,OAAO,CACR,CAAC;YAEF,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;YACzC,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE;gBACjB,gBAAgB,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC;gBACzC,cAAc,EAAE,YAAY;aAC7B,CAAC,CAAC;YACH,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SACf;QAAC,OAAO,CAAC,EAAE;YACV,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;SACtB;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSingleSignOnMiddleware.js","sourceRoot":"","sources":["../../src/express/createSingleSignOnMiddleware.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,OAAO,MAAM,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"createSingleSignOnMiddleware.js","sourceRoot":"","sources":["../../src/express/createSingleSignOnMiddleware.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,OAAO,MAAM,MAAM,QAAQ,CAAC;AAG5B,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,wBAAwB,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;AAErE,MAAM,MAAM,GAAG,YAAY,CAAC,+BAA+B,CAAC,CAAC;AAE7D,MAAM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ACzB;QACD,IAAI,EAAE,CAAC;IACT,CAAC,CAAC;AACJ,CAAC"}
|
package/lib/loaders/index.js
CHANGED
|
@@ -12,13 +12,10 @@ export default async (req, res, unchainedAPI) => {
|
|
|
12
12
|
includeInactive: true,
|
|
13
13
|
includeLeaves: true,
|
|
14
14
|
});
|
|
15
|
-
return queries.map(({ assortmentId
|
|
15
|
+
return queries.map(({ assortmentId }) => {
|
|
16
16
|
return assortments.find((assortment) => {
|
|
17
17
|
if (assortment._id !== assortmentId)
|
|
18
18
|
return false;
|
|
19
|
-
if (!includeInactive) {
|
|
20
|
-
return assortment.isActive === true;
|
|
21
|
-
}
|
|
22
19
|
return true;
|
|
23
20
|
});
|
|
24
21
|
});
|
|
@@ -85,15 +82,14 @@ export default async (req, res, unchainedAPI) => {
|
|
|
85
82
|
const productIds = [...new Set(queries.map((q) => q.productId).filter(Boolean))];
|
|
86
83
|
const products = await unchainedAPI.modules.products.findProducts({
|
|
87
84
|
productIds,
|
|
88
|
-
|
|
85
|
+
productSelector: {
|
|
86
|
+
status: { $in: [null, ProductStatus.ACTIVE, ProductStatus.DELETED] },
|
|
87
|
+
},
|
|
89
88
|
});
|
|
90
|
-
return queries.map(({ productId
|
|
89
|
+
return queries.map(({ productId }) => {
|
|
91
90
|
return products.find((product) => {
|
|
92
91
|
if (product._id !== productId)
|
|
93
92
|
return false;
|
|
94
|
-
if (!includeDrafts) {
|
|
95
|
-
return product.status === ProductStatus.ACTIVE;
|
|
96
|
-
}
|
|
97
93
|
return true;
|
|
98
94
|
});
|
|
99
95
|
});
|
package/lib/loaders/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/loaders/index.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,SAAS,MAAM,QAAQ,CAAC;AAK/B,OAAO,EAAE,a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EAAE,MAAM,EAAE,EAAE,EAAE;gBAC3C,MAAM,SAAS,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;gBACrC,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC;gBAC1E,IAAI,CAAC,YAAY,CAAC,MAAM;oBAAE,OAAO,IAAI,CAAC;gBACtC,MAAM,aAAa,GAAG,CAAC,SAAS,CAAC,UAAU,EAAE,SAAS,CAAC,QAAQ,EAAE,GAAG,mBAAmB,CAAC,CAAC;gBAEzF,MAAM,WAAW,GAAG,aAAa,CAAC,MAAM,CAAc,CAAC,GAAG,EAAE,YAAY,EAAE,EAAE;oBAC1E,IAAI,GAAG;wBAAE,OAAO,GAAG,CAAC;oBACpB,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,YAAY,CAAC,CAAC;gBAC7D,CAAC,EAAE,IAAI,CAAC,CAAC;gBACT,OAAO,WAAW,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC;YACxC,CAAC,CAAC,CAAC;QACL,CAAC,CACF;KACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { log } from '@unchainedshop/logger';
|
|
2
|
+
import { AuthOperationFailedError, InvalidCredentialsError } from '../../../errors';
|
|
2
3
|
export default async function changePassword(root, params, { modules, userId }) {
|
|
3
4
|
log('mutation changePassword', { userId });
|
|
4
5
|
if (!params.newPlainPassword) {
|
|
@@ -7,7 +8,17 @@ export default async function changePassword(root, params, { modules, userId })
|
|
|
7
8
|
if (!params.oldPlainPassword) {
|
|
8
9
|
throw new Error('Old password is required');
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
+
let success = false;
|
|
12
|
+
try {
|
|
13
|
+
success = await modules.accounts.changePassword(userId, params);
|
|
14
|
+
}
|
|
15
|
+
catch (e) {
|
|
16
|
+
success = false;
|
|
17
|
+
if (e.code === 'InvalidCredentials')
|
|
18
|
+
throw new InvalidCredentialsError({});
|
|
19
|
+
else
|
|
20
|
+
throw new AuthOperationFailedError({});
|
|
21
|
+
}
|
|
11
22
|
return { success };
|
|
12
23
|
}
|
|
13
24
|
//# sourceMappingURL=changePassword.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changePassword.js","sourceRoot":"","sources":["../../../../src/resolvers/mutations/accounts/changePassword.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"changePassword.js","sourceRoot":"","sources":["../../../../src/resolvers/mutations/accounts/changePassword.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAEpF,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,cAAc,CAC1C,IAAU,EACV,MAGC,EACD,EAAE,OAAO,EAAE,MAAM,EAAW;IAE5B,GAAG,CAAC,yBAAyB,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IAE3C,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;KAC7C;IACD,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;KAC7C;IACD,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,IAAI;QACF,OAAO,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACjE;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,GAAG,KAAK,CAAC;QAChB,IAAI,CAAC,CAAC,IAAI,KAAK,oBAAoB;YAAE,MAAM,IAAI,uBAAuB,CAAC,EAAE,CAAC,CAAC;;YACtE,MAAM,IAAI,wBAAwB,CAAC,EAAE,CAAC,CAAC;KAC7C;IAED,OAAO,EAAE,OAAO,EAAE,CAAC;AACrB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { log } from '@unchainedshop/logger';
|
|
2
2
|
import { hashPassword } from '../../../hashPassword';
|
|
3
|
+
import { AuthOperationFailedError, EmailAlreadyExistsError, UsernameAlreadyExistsError, UsernameOrEmailRequiredError, } from '../../../errors';
|
|
3
4
|
export default async function createUser(root, params, context) {
|
|
4
5
|
const { modules, userId } = context;
|
|
5
6
|
log('mutation createUser', { email: params.email, username: params.username, userId });
|
|
@@ -14,9 +15,22 @@ export default async function createUser(root, params, context) {
|
|
|
14
15
|
delete mappedUser.webAuthnPublicKeyCredentials;
|
|
15
16
|
const webAuthnService = params.webAuthnPublicKeyCredentials &&
|
|
16
17
|
(await modules.accounts.webAuthn.verifyCredentialCreation(params.username, params.webAuthnPublicKeyCredentials));
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
let newUserId;
|
|
19
|
+
try {
|
|
20
|
+
newUserId = await modules.accounts.createUser(mappedUser, {
|
|
21
|
+
skipPasswordEnrollment: !!webAuthnService,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
catch (e) {
|
|
25
|
+
if (e.code === 'EmailAlreadyExists')
|
|
26
|
+
throw new EmailAlreadyExistsError({ email: params?.email });
|
|
27
|
+
else if (e.code === 'UsernameAlreadyExists')
|
|
28
|
+
throw new UsernameAlreadyExistsError({ username: params?.username });
|
|
29
|
+
else if (e.code === 'UsernameOrEmailRequired')
|
|
30
|
+
throw new UsernameOrEmailRequiredError({ username: params?.username });
|
|
31
|
+
else
|
|
32
|
+
throw new AuthOperationFailedError({ username: params?.username, email: params.email });
|
|
33
|
+
}
|
|
20
34
|
if (newUserId && webAuthnService) {
|
|
21
35
|
await modules.users.updateUser({ _id: newUserId }, {
|
|
22
36
|
$push: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createUser.js","sourceRoot":"","sources":["../../../../src/resolvers/mutations/accounts/createUser.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"createUser.js","sourceRoot":"","sources":["../../../../src/resolvers/mutations/accounts/createUser.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,EAC1B,4BAA4B,GAC7B,MAAM,iBAAiB,CAAC;AAEzB,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,UAAU,CAAC,IAAU,EAAE,MAAgB,EAAE,OAAgB;IACrF,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAEpC,GAAG,CAAC,qBAAqB,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IAEvF,IAAI,CAAC,MAAM,CAAC,aAAa,IAAI,CAAC,MAAM,CAAC,4BAA4B,EAAE;QACjE,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;KACvD;IAED,MAAM,UAAU,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC;IACjC,IAAI,UAAU,CAAC,aAAa,EAAE;QAC5B,UAAU,CAAC,QAAQ,GAAG,YAAY,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;KAC9D;IACD,OAAO,UAAU,CAAC,aAAa,CAAC;IAChC,OAAO,UAAU,CAAC,4BAA4B,CAAC;IAE/C,MAAM,eAAe,GACnB,MAAM,C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
|
2
|
-
import { UserNotFoundError } from '../../../errors';
|
|
2
|
+
import { TwoFactorCodeDidNotMatchError, TwoFactorNotSetError, UserNotFoundError } from '../../../errors';
|
|
3
3
|
export default async function disableTOTP(root, params, { modules, userId }) {
|
|
4
4
|
const normalizedUserId = params.userId || userId;
|
|
5
5
|
log(`mutation disableTOTP ${params.code} ${normalizedUserId}`, {
|
|
@@ -8,7 +8,20 @@ export default async function disableTOTP(root, params, { modules, userId }) {
|
|
|
8
8
|
const user = await modules.users.findUserById(normalizedUserId);
|
|
9
9
|
if (!user)
|
|
10
10
|
throw new UserNotFoundError({ userId: normalizedUserId });
|
|
11
|
-
|
|
11
|
+
try {
|
|
12
|
+
await modules.accounts.disableTOTP(normalizedUserId, params.code);
|
|
13
|
+
}
|
|
14
|
+
catch (e) {
|
|
15
|
+
if (e?.message?.includes("2FA code didn't match"))
|
|
16
|
+
throw new TwoFactorCodeDidNotMatchError({
|
|
17
|
+
submittedCode: params.code,
|
|
18
|
+
userId: params?.userId || userId,
|
|
19
|
+
});
|
|
20
|
+
else if (e?.message?.includes('2FA not set'))
|
|
21
|
+
throw new TwoFactorNotSetError({ userId: params?.userId || userId });
|
|
22
|
+
else
|
|
23
|
+
throw e;
|
|
24
|
+
}
|
|
12
25
|
return user;
|
|
13
26
|
}
|
|
14
27
|
//# sourceMappingURL=disableTOTP.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disableTOTP.js","sourceRoot":"","sources":["../../../../src/resolvers/mutations/accounts/disableTOTP.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"disableTOTP.js","sourceRoot":"","sources":["../../../../src/resolvers/mutations/accounts/disableTOTP.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,OAA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|
export default async function enableTOTP(root, params, { modules, userId }) {
|
|
3
4
|
log(`mutation enableTOTP ${params.code}`, {
|
|
4
5
|
userId,
|
|
5
6
|
});
|
|
6
|
-
|
|
7
|
+
try {
|
|
8
|
+
await modules.accounts.enableTOTP(userId, params.secretBase32, params.code);
|
|
9
|
+
}
|
|
10
|
+
catch (e) {
|
|
11
|
+
if (e?.message?.includes("2FA code didn't match"))
|
|
12
|
+
throw new TwoFactorCodeDidNotMatchError({ submittedCode: params.code, userId });
|
|
13
|
+
else if (e?.message?.includes('2FA already set'))
|
|
14
|
+
throw new TwoFactorAlreadySetError({ userId });
|
|
15
|
+
else
|
|
16
|
+
throw e;
|
|
17
|
+
}
|
|
7
18
|
return modules.users.findUserById(userId);
|
|
8
19
|
}
|
|
9
20
|
//# sourceMappingURL=enableTOTP.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enableTOTP.js","sourceRoot":"","sources":["../../../../src/resolvers/mutations/accounts/enableTOTP.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"enableTOTP.js","sourceRoot":"","sources":["../../../../src/resolvers/mutations/accounts/enableTOTP.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,OAAO,EAAE,wBAAwB,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AAE1F,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,UAAU,CACtC,IAAU,EACV,MAA8C,EAC9C,EAAE,OAAO,EAAE,MAAM,EAAW;IAE5B,GAAG,CAAC,uBAAuB,MAAM,CAAC,IAAI,EAAE,EAAE;QACxC,MAAM;KACP,CAAC,CAAC;IACH,IAAI;QACF,MAAM,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;KAC7E;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,uBAAuB,CAAC;YAC/C,MAAM,IAAI,6BAA6B,CAAC,EAAE,aAAa,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;aAC7E,IAAI,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,iBAAiB,CAAC;YAAE,MAAM,IAAI,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;;YAC5F,MAAM,CAAC,CAAC;KACd;IAED,OAAO,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { log } from '@unchainedshop/logger';
|
|
2
2
|
import { hashPassword } from '../../../hashPassword';
|
|
3
|
+
import { AuthOperationFailedError, EmailAlreadyExistsError, UsernameAlreadyExistsError, UsernameOrEmailRequiredError, } from '../../../errors';
|
|
3
4
|
export default async function enrollUser(root, params, context) {
|
|
4
5
|
const { modules } = context;
|
|
5
6
|
log('mutation enrollUser', { email: params.email, userId: context.userId });
|
|
@@ -11,9 +12,21 @@ export default async function enrollUser(root, params, context) {
|
|
|
11
12
|
delete mappedUserData.plainPassword;
|
|
12
13
|
// Skip Messaging when password is set so we
|
|
13
14
|
// don't send a verification e-mail after enrollment
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
try {
|
|
16
|
+
const userId = await modules.accounts.createUser(mappedUserData, {
|
|
17
|
+
skipMessaging: !!mappedUserData.password,
|
|
18
|
+
});
|
|
19
|
+
return modules.users.findUserById(userId);
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
if (e.code === 'EmailAlreadyExists')
|
|
23
|
+
throw new EmailAlreadyExistsError({ email: params?.email });
|
|
24
|
+
else if (e.code === 'UsernameAlreadyExists')
|
|
25
|
+
throw new UsernameAlreadyExistsError({ username: params?.username, email: params.email });
|
|
26
|
+
else if (e.code === 'UsernameOrEmailRequired')
|
|
27
|
+
throw new UsernameOrEmailRequiredError({ username: params?.username, email: params.email });
|
|
28
|
+
else
|
|
29
|
+
throw new AuthOperationFailedError({ username: params?.username, email: params.email });
|
|
30
|
+
}
|
|
18
31
|
}
|
|
19
32
|
//# sourceMappingURL=enrollUser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enrollUser.js","sourceRoot":"","sources":["../../../../src/resolvers/mutations/accounts/enrollUser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAG5C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"enrollUser.js","sourceRoot":"","sources":["../../../../src/resolvers/mutations/accounts/enrollUser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAG5C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,EAC1B,4BAA4B,GAC7B,MAAM,iBAAiB,CAAC;AAEzB,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,UAAU,CAAC,IAAU,EAAE,MAAgB,EAAE,OAAgB;IACrF,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAE5B,GAAG,CAAC,qBAAqB,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAE5E,MAAM,cAAc,GAAG,MAAM,CAAC;IAC9B,cAAc,CAAC,eAAe,GAAG,IAAI,CAAC;IACtC,IAAI,cAAc,CAAC,aAAa,EAAE;QAChC,cAAc,CAAC,QAAQ,GAAG,YAAY,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;KACtE;IACD,OAAO,cAAc,CAAC,aAAa,CAAC;IAEpC,4CAA4C;IAC5C,oDAAoD;IACpD,IAAI;QACF,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,cAAc,EAAE;YAC/D,aAAa,EAAE,CAAC,CAAC,cAAc,CAAC,QAAQ;SACzC,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;KAC3C;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,CAAC,CAAC,IAAI,KAAK,oBAAoB;YAAE,MAAM,IAAI,uBAAuB,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;aAC5F,IAAI,CAAC,CAAC,IAAI,KAAK,uBAAuB;YACzC,MAAM,IAAI,0BAA0B,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;aACvF,IAAI,CAAC,CAAC,IAAI,KAAK,yBAAyB;YAC3C,MAAM,IAAI,4BAA4B,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;;YACzF,MAAM,IAAI,wBAAwB,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;KAC9F;AACH,CAAC"}
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import { log } from '@unchainedshop/logger';
|
|
2
|
+
import { AuthOperationFailedError, UserNotFoundError } from '../../../errors';
|
|
2
3
|
export default async function forgotPassword(root, { email }, { modules, userId }) {
|
|
3
4
|
log('mutation forgotPassword', { email, userId });
|
|
4
|
-
|
|
5
|
+
let success = false;
|
|
6
|
+
try {
|
|
7
|
+
success = await modules.accounts.sendResetPasswordEmail(email);
|
|
8
|
+
}
|
|
9
|
+
catch (e) {
|
|
10
|
+
if (e.code === 'UserNotFound')
|
|
11
|
+
throw new UserNotFoundError({ email });
|
|
12
|
+
else
|
|
13
|
+
throw new AuthOperationFailedError({ email });
|
|
14
|
+
}
|
|
5
15
|
return { success };
|
|
6
16
|
}
|
|
7
17
|
//# sourceMappingURL=forgotPassword.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forgotPassword.js","sourceRoot":"","sources":["../../../../src/resolvers/mutations/accounts/forgotPassword.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"forgotPassword.js","sourceRoot":"","sources":["../../../../src/resolvers/mutations/accounts/forgotPassword.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAE9E,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,cAAc,CAC1C,IAAU,EACV,EAAE,KAAK,EAAqB,EAC5B,EAAE,OAAO,EAAE,MAAM,EAAW;IAE5B,GAAG,CAAC,yBAAyB,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;IAElD,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,IAAI;QACF,OAAO,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;KAChE;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,CAAC,CAAC,IAAI,KAAK,cAAc;YAAE,MAAM,IAAI,iBAAiB,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;;YACjE,MAAM,IAAI,wBAAwB,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;KACpD;IAED,OAAO,EAAE,OAAO,EAAE,CAAC;AACrB,CAAC"}
|
|
@@ -4,7 +4,7 @@ const impersonate = async (root, { userId }, context) => {
|
|
|
4
4
|
log(`mutation impersonate ${userId}`);
|
|
5
5
|
const userToImpersonate = await context.modules.users.findUserById(userId);
|
|
6
6
|
if (!userToImpersonate) {
|
|
7
|
-
throw new UserNotFoundError(
|
|
7
|
+
throw new UserNotFoundError({ userId });
|
|
8
8
|
}
|
|
9
9
|
if ((userToImpersonate.roles || []).includes('admin')) {
|
|
10
10
|
throw new NoPermissionError("Cannot impersonate users with role 'admin'");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impersonate.js","sourceRoot":"","sources":["../../../../src/resolvers/mutations/accounts/impersonate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEvE,MAAM,WAAW,GAAG,KAAK,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,OAAgB,EAAE,EAAE;IAC/D,GAAG,CAAC,wBAAwB,MAAM,EAAE,CAAC,CAAC;IAEtC,MAAM,iBAAiB,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAE3E,IAAI,CAAC,iBAAiB,EAAE;QACtB,MAAM,IAAI,iBAAiB,CAAC,
|
|
1
|
+
{"version":3,"file":"impersonate.js","sourceRoot":"","sources":["../../../../src/resolvers/mutations/accounts/impersonate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEvE,MAAM,WAAW,GAAG,KAAK,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,OAAgB,EAAE,EAAE;IAC/D,GAAG,CAAC,wBAAwB,MAAM,EAAE,CAAC,CAAC;IAEtC,MAAM,iBAAiB,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,YA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