@unchainedshop/api 3.1.11 → 4.0.0-rc.2
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/lib/context.d.ts +2 -2
- package/lib/context.d.ts.map +1 -1
- package/lib/context.js +1 -1
- package/lib/context.js.map +1 -1
- package/lib/createGraphQLServer.d.ts +2 -2
- package/lib/createGraphQLServer.d.ts.map +1 -1
- package/lib/errors.d.ts +2 -0
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +2 -0
- package/lib/errors.js.map +1 -1
- package/lib/express/createERCMetadataMiddleware.d.ts.map +1 -1
- package/lib/express/createERCMetadataMiddleware.js +9 -5
- package/lib/express/createERCMetadataMiddleware.js.map +1 -1
- package/lib/express/createMCPMiddleware.d.ts +8 -0
- package/lib/express/createMCPMiddleware.d.ts.map +1 -0
- package/lib/express/createMCPMiddleware.js +46 -0
- package/lib/express/createMCPMiddleware.js.map +1 -0
- package/lib/express/index.d.ts.map +1 -1
- package/lib/express/index.js +0 -2
- package/lib/express/index.js.map +1 -1
- package/lib/express/mcpHandler.d.ts.map +1 -0
- package/lib/express/mcpHandler.js +68 -0
- package/lib/express/mcpHandler.js.map +1 -0
- package/lib/fastify/ercMetadataHandler.d.ts.map +1 -1
- package/lib/fastify/ercMetadataHandler.js +9 -5
- package/lib/fastify/ercMetadataHandler.js.map +1 -1
- package/lib/fastify/index copy.d.ts.map +1 -0
- package/lib/fastify/index copy.js +157 -0
- package/lib/fastify/index copy.js.map +1 -0
- package/lib/fastify/index.d.ts.map +1 -1
- package/lib/fastify/index.js +0 -3
- package/lib/fastify/index.js.map +1 -1
- package/lib/fastify/mcpHandler.d.ts +8 -0
- package/lib/fastify/mcpHandler.d.ts.map +1 -0
- package/lib/fastify/mcpHandler.js +46 -0
- package/lib/fastify/mcpHandler.js.map +1 -0
- package/lib/loaders/assortmentLinkLoader.d.ts +12 -0
- package/lib/loaders/assortmentLinkLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentLinkLoader.js +23 -0
- package/lib/loaders/assortmentLinkLoader.js.map +1 -0
- package/lib/loaders/assortmentLinksLoader.d.ts +14 -0
- package/lib/loaders/assortmentLinksLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentLinksLoader.js +38 -0
- package/lib/loaders/assortmentLinksLoader.js.map +1 -0
- package/lib/loaders/assortmentLoader.d.ts +10 -0
- package/lib/loaders/assortmentLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentLoader.js +15 -0
- package/lib/loaders/assortmentLoader.js.map +1 -0
- package/lib/loaders/assortmentMediaTextLoader.d.ts +12 -0
- package/lib/loaders/assortmentMediaTextLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentMediaTextLoader.js +15 -0
- package/lib/loaders/assortmentMediaTextLoader.js.map +1 -0
- package/lib/loaders/assortmentMediasLoader.d.ts +10 -0
- package/lib/loaders/assortmentMediasLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentMediasLoader.js +18 -0
- package/lib/loaders/assortmentMediasLoader.js.map +1 -0
- package/lib/loaders/assortmentProductLoader.d.ts +12 -0
- package/lib/loaders/assortmentProductLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentProductLoader.js +14 -0
- package/lib/loaders/assortmentProductLoader.js.map +1 -0
- package/lib/loaders/assortmentProductsLoader.d.ts +10 -0
- package/lib/loaders/assortmentProductsLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentProductsLoader.js +18 -0
- package/lib/loaders/assortmentProductsLoader.js.map +1 -0
- package/lib/loaders/assortmentTextLoader.d.ts +12 -0
- package/lib/loaders/assortmentTextLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentTextLoader.js +15 -0
- package/lib/loaders/assortmentTextLoader.js.map +1 -0
- package/lib/loaders/buildTextMap.d.ts +2 -2
- package/lib/loaders/buildTextMap.d.ts.map +1 -1
- package/lib/loaders/countryLoader.d.ts +10 -0
- package/lib/loaders/countryLoader.d.ts.map +1 -0
- package/lib/loaders/countryLoader.js +14 -0
- package/lib/loaders/countryLoader.js.map +1 -0
- package/lib/loaders/currencyLoader.d.ts +10 -0
- package/lib/loaders/currencyLoader.d.ts.map +1 -0
- package/lib/loaders/currencyLoader.js +14 -0
- package/lib/loaders/currencyLoader.js.map +1 -0
- package/lib/loaders/deliveryProviderLoader.d.ts +10 -0
- package/lib/loaders/deliveryProviderLoader.d.ts.map +1 -0
- package/lib/loaders/deliveryProviderLoader.js +13 -0
- package/lib/loaders/deliveryProviderLoader.js.map +1 -0
- package/lib/loaders/fileLoader.d.ts +10 -0
- package/lib/loaders/fileLoader.d.ts.map +1 -0
- package/lib/loaders/fileLoader.js +13 -0
- package/lib/loaders/fileLoader.js.map +1 -0
- package/lib/loaders/filterLoader.d.ts +10 -0
- package/lib/loaders/filterLoader.d.ts.map +1 -0
- package/lib/loaders/filterLoader.js +14 -0
- package/lib/loaders/filterLoader.js.map +1 -0
- package/lib/loaders/filterTextLoader.d.ts +14 -0
- package/lib/loaders/filterTextLoader.d.ts.map +1 -0
- package/lib/loaders/filterTextLoader.js +15 -0
- package/lib/loaders/filterTextLoader.js.map +1 -0
- package/lib/loaders/index.d.ts +79 -49
- package/lib/loaders/index.d.ts.map +1 -1
- package/lib/loaders/index.js +47 -268
- package/lib/loaders/index.js.map +1 -1
- package/lib/loaders/languageLoader.d.ts +10 -0
- package/lib/loaders/languageLoader.d.ts.map +1 -0
- package/lib/loaders/languageLoader.js +14 -0
- package/lib/loaders/languageLoader.js.map +1 -0
- package/lib/loaders/orderLoader.d.ts +10 -0
- package/lib/loaders/orderLoader.d.ts.map +1 -0
- package/lib/loaders/orderLoader.js +16 -0
- package/lib/loaders/orderLoader.js.map +1 -0
- package/lib/loaders/paymentProviderLoader.d.ts +10 -0
- package/lib/loaders/paymentProviderLoader.d.ts.map +1 -0
- package/lib/loaders/paymentProviderLoader.js +13 -0
- package/lib/loaders/paymentProviderLoader.js.map +1 -0
- package/lib/loaders/productLoader.d.ts +10 -0
- package/lib/loaders/productLoader.d.ts.map +1 -0
- package/lib/loaders/productLoader.js +16 -0
- package/lib/loaders/productLoader.js.map +1 -0
- package/lib/loaders/productLoaderBySKU.d.ts +10 -0
- package/lib/loaders/productLoaderBySKU.d.ts.map +1 -0
- package/lib/loaders/productLoaderBySKU.js +16 -0
- package/lib/loaders/productLoaderBySKU.js.map +1 -0
- package/lib/loaders/productMediaTextLoader.d.ts +12 -0
- package/lib/loaders/productMediaTextLoader.d.ts.map +1 -0
- package/lib/loaders/productMediaTextLoader.js +15 -0
- package/lib/loaders/productMediaTextLoader.js.map +1 -0
- package/lib/loaders/productMediasLoader.d.ts +10 -0
- package/lib/loaders/productMediasLoader.d.ts.map +1 -0
- package/lib/loaders/productMediasLoader.js +18 -0
- package/lib/loaders/productMediasLoader.js.map +1 -0
- package/lib/loaders/productTextLoader.d.ts +12 -0
- package/lib/loaders/productTextLoader.d.ts.map +1 -0
- package/lib/loaders/productTextLoader.js +15 -0
- package/lib/loaders/productTextLoader.js.map +1 -0
- package/lib/loaders/userLoader.d.ts +10 -0
- package/lib/loaders/userLoader.d.ts.map +1 -0
- package/lib/loaders/userLoader.js +17 -0
- package/lib/loaders/userLoader.js.map +1 -0
- package/lib/loaders/utils.d.ts +7 -0
- package/lib/loaders/utils.d.ts.map +1 -0
- package/lib/loaders/utils.js +29 -0
- package/lib/loaders/utils.js.map +1 -0
- package/lib/locale-context.d.ts +3 -3
- package/lib/locale-context.d.ts.map +1 -1
- package/lib/locale-context.js +9 -10
- package/lib/locale-context.js.map +1 -1
- package/lib/mcp/index.d.ts +95 -0
- package/lib/mcp/index.d.ts.map +1 -0
- package/lib/mcp/index.js +138 -0
- package/lib/mcp/index.js.map +1 -0
- package/lib/mcp/server.d.ts +4 -0
- package/lib/mcp/server.d.ts.map +1 -0
- package/lib/mcp/server.js +60 -0
- package/lib/mcp/server.js.map +1 -0
- package/lib/mcp/types.d.ts +28 -0
- package/lib/mcp/types.d.ts.map +1 -0
- package/lib/mcp/types.js +2 -0
- package/lib/mcp/types.js.map +1 -0
- package/lib/middleware/accountLockout.d.ts.map +1 -0
- package/lib/middleware/accountLockout.js +84 -0
- package/lib/middleware/accountLockout.js.map +1 -0
- package/lib/middleware/rateLimiter.d.ts.map +1 -0
- package/lib/middleware/rateLimiter.js +91 -0
- package/lib/middleware/rateLimiter.js.map +1 -0
- package/lib/plugins/inputValidation.d.ts.map +1 -0
- package/lib/plugins/inputValidation.js +95 -0
- package/lib/plugins/inputValidation.js.map +1 -0
- package/lib/resolvers/mutations/accounts/createUser.d.ts.map +1 -1
- package/lib/resolvers/mutations/accounts/createUser.js +4 -5
- package/lib/resolvers/mutations/accounts/createUser.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/loginAsGuest.d.ts.map +1 -1
- package/lib/resolvers/mutations/accounts/loginAsGuest.js +4 -5
- package/lib/resolvers/mutations/accounts/loginAsGuest.js.map +1 -1
- package/lib/resolvers/mutations/accounts/loginWithPassword.js +3 -3
- package/lib/resolvers/mutations/accounts/loginWithPassword.js.map +1 -1
- package/lib/resolvers/mutations/accounts/loginWithWebAuthn.js +3 -3
- package/lib/resolvers/mutations/accounts/loginWithWebAuthn.js.map +1 -1
- package/lib/resolvers/mutations/accounts/resetPassword.js +3 -3
- package/lib/resolvers/mutations/accounts/resetPassword.js.map +1 -1
- package/lib/resolvers/mutations/accounts/stopImpersonation.js +1 -1
- package/lib/resolvers/mutations/accounts/stopImpersonation.js.map +1 -1
- package/lib/resolvers/mutations/accounts/verifyEmail.js +3 -3
- package/lib/resolvers/mutations/accounts/verifyEmail.js.map +1 -1
- package/lib/resolvers/mutations/assortments/reorderAssortmentFilters.d.ts +2 -2
- package/lib/resolvers/mutations/assortments/reorderAssortmentFilters.d.ts.map +1 -1
- package/lib/resolvers/mutations/assortments/reorderAssortmentFilters.js.map +1 -1
- package/lib/resolvers/mutations/assortments/reorderAssortmentLinks.d.ts +2 -2
- package/lib/resolvers/mutations/assortments/reorderAssortmentLinks.d.ts.map +1 -1
- package/lib/resolvers/mutations/assortments/reorderAssortmentLinks.js.map +1 -1
- package/lib/resolvers/mutations/assortments/reorderAssortmentMedia.d.ts +2 -2
- package/lib/resolvers/mutations/assortments/reorderAssortmentMedia.d.ts.map +1 -1
- package/lib/resolvers/mutations/assortments/reorderAssortmentMedia.js.map +1 -1
- package/lib/resolvers/mutations/assortments/reorderAssortmentProducts.d.ts +2 -2
- package/lib/resolvers/mutations/assortments/reorderAssortmentProducts.d.ts.map +1 -1
- package/lib/resolvers/mutations/assortments/reorderAssortmentProducts.js.map +1 -1
- package/lib/resolvers/mutations/assortments/updateAssortmentMediaTexts.d.ts +1 -1
- package/lib/resolvers/mutations/assortments/updateAssortmentMediaTexts.d.ts.map +1 -1
- package/lib/resolvers/mutations/assortments/updateAssortmentMediaTexts.js.map +1 -1
- package/lib/resolvers/mutations/assortments/updateAssortmentTexts.d.ts +1 -1
- package/lib/resolvers/mutations/assortments/updateAssortmentTexts.d.ts.map +1 -1
- package/lib/resolvers/mutations/assortments/updateAssortmentTexts.js.map +1 -1
- package/lib/resolvers/mutations/enrollments/createEnrollment.js +3 -3
- package/lib/resolvers/mutations/enrollments/createEnrollment.js.map +1 -1
- package/lib/resolvers/mutations/enrollments/updateEnrollment.d.ts +2 -2
- package/lib/resolvers/mutations/enrollments/updateEnrollment.d.ts.map +1 -1
- package/lib/resolvers/mutations/filters/createFilter.d.ts.map +1 -1
- package/lib/resolvers/mutations/filters/createFilter.js +2 -6
- package/lib/resolvers/mutations/filters/createFilter.js.map +1 -1
- package/lib/resolvers/mutations/filters/updateFilterTexts.d.ts +2 -2
- package/lib/resolvers/mutations/filters/updateFilterTexts.d.ts.map +1 -1
- package/lib/resolvers/mutations/orders/addCartDiscount.js +1 -1
- package/lib/resolvers/mutations/orders/addCartDiscount.js.map +1 -1
- package/lib/resolvers/mutations/orders/addCartProduct.js +1 -1
- package/lib/resolvers/mutations/orders/addCartProduct.js.map +1 -1
- package/lib/resolvers/mutations/orders/addCartQuotation.d.ts +2 -2
- package/lib/resolvers/mutations/orders/addCartQuotation.d.ts.map +1 -1
- package/lib/resolvers/mutations/orders/addCartQuotation.js +1 -1
- package/lib/resolvers/mutations/orders/addCartQuotation.js.map +1 -1
- package/lib/resolvers/mutations/orders/addMultipleCartProducts.d.ts +4 -4
- package/lib/resolvers/mutations/orders/addMultipleCartProducts.d.ts.map +1 -1
- package/lib/resolvers/mutations/orders/addMultipleCartProducts.js +1 -1
- package/lib/resolvers/mutations/orders/addMultipleCartProducts.js.map +1 -1
- package/lib/resolvers/mutations/orders/checkoutCart.js +1 -1
- package/lib/resolvers/mutations/orders/checkoutCart.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/emptyCart.js +1 -1
- package/lib/resolvers/mutations/orders/emptyCart.js.map +1 -1
- package/lib/resolvers/mutations/orders/signPaymentProviderForCheckout.js +1 -1
- package/lib/resolvers/mutations/orders/signPaymentProviderForCheckout.js.map +1 -1
- package/lib/resolvers/mutations/orders/updateCart.js +1 -1
- package/lib/resolvers/mutations/orders/updateCart.js.map +1 -1
- package/lib/resolvers/mutations/orders/updateCartItem.d.ts +2 -2
- package/lib/resolvers/mutations/orders/updateCartItem.d.ts.map +1 -1
- package/lib/resolvers/mutations/products/addProductAssignment.d.ts +1 -1
- package/lib/resolvers/mutations/products/addProductAssignment.d.ts.map +1 -1
- package/lib/resolvers/mutations/products/addProductAssignment.js +35 -2
- package/lib/resolvers/mutations/products/addProductAssignment.js.map +1 -1
- package/lib/resolvers/mutations/products/createProductVariation.d.ts +2 -2
- package/lib/resolvers/mutations/products/createProductVariation.d.ts.map +1 -1
- package/lib/resolvers/mutations/products/createProductVariation.js.map +1 -1
- package/lib/resolvers/mutations/products/removeProductAssignment.d.ts +1 -1
- package/lib/resolvers/mutations/products/removeProductAssignment.d.ts.map +1 -1
- package/lib/resolvers/mutations/products/removeProductAssignment.js.map +1 -1
- package/lib/resolvers/mutations/products/reorderProductMedia.d.ts +2 -2
- package/lib/resolvers/mutations/products/reorderProductMedia.d.ts.map +1 -1
- package/lib/resolvers/mutations/products/reorderProductMedia.js.map +1 -1
- package/lib/resolvers/mutations/products/updateProductMediaTexts.d.ts +1 -1
- package/lib/resolvers/mutations/products/updateProductMediaTexts.d.ts.map +1 -1
- package/lib/resolvers/mutations/products/updateProductMediaTexts.js.map +1 -1
- package/lib/resolvers/mutations/products/updateProductVariationTexts.d.ts +1 -1
- package/lib/resolvers/mutations/products/updateProductVariationTexts.d.ts.map +1 -1
- package/lib/resolvers/mutations/quotations/requestQuotation.d.ts +2 -2
- package/lib/resolvers/mutations/quotations/requestQuotation.d.ts.map +1 -1
- package/lib/resolvers/mutations/quotations/requestQuotation.js +3 -3
- package/lib/resolvers/mutations/quotations/requestQuotation.js.map +1 -1
- package/lib/resolvers/mutations/users/heartbeat.d.ts +1 -1
- package/lib/resolvers/mutations/users/heartbeat.d.ts.map +1 -1
- package/lib/resolvers/mutations/users/heartbeat.js +3 -3
- package/lib/resolvers/mutations/users/heartbeat.js.map +1 -1
- package/lib/resolvers/mutations/users/setRoles.d.ts +1 -1
- package/lib/resolvers/mutations/users/setRoles.d.ts.map +1 -1
- package/lib/resolvers/mutations/users/setRoles.js.map +1 -1
- package/lib/resolvers/mutations/users/setUserTags.d.ts +1 -1
- package/lib/resolvers/mutations/users/setUserTags.d.ts.map +1 -1
- package/lib/resolvers/mutations/users/setUserTags.js.map +1 -1
- package/lib/resolvers/mutations/warehousing/invalidateToken.js +1 -3
- package/lib/resolvers/mutations/warehousing/invalidateToken.js.map +1 -1
- package/lib/resolvers/mutations/worker/allocateWork.d.ts +1 -1
- package/lib/resolvers/mutations/worker/allocateWork.d.ts.map +1 -1
- package/lib/resolvers/mutations/worker/allocateWork.js.map +1 -1
- package/lib/resolvers/queries/assortments/assortments.d.ts +1 -1
- package/lib/resolvers/queries/assortments/assortments.d.ts.map +1 -1
- package/lib/resolvers/queries/countries/countries.d.ts +1 -1
- package/lib/resolvers/queries/countries/countries.d.ts.map +1 -1
- package/lib/resolvers/queries/countries/countries.js.map +1 -1
- package/lib/resolvers/queries/currencies/currencies.d.ts +1 -1
- package/lib/resolvers/queries/currencies/currencies.d.ts.map +1 -1
- package/lib/resolvers/queries/currencies/currencies.js.map +1 -1
- package/lib/resolvers/queries/enrollments/enrollments.d.ts +1 -1
- package/lib/resolvers/queries/enrollments/enrollments.d.ts.map +1 -1
- package/lib/resolvers/queries/filters/filters.d.ts +1 -1
- package/lib/resolvers/queries/filters/filters.d.ts.map +1 -1
- package/lib/resolvers/queries/filters/searchAssortments.js +2 -2
- package/lib/resolvers/queries/filters/searchAssortments.js.map +1 -1
- package/lib/resolvers/queries/filters/searchProducts.js +3 -3
- package/lib/resolvers/queries/filters/searchProducts.js.map +1 -1
- package/lib/resolvers/queries/languages/languages.d.ts +1 -1
- package/lib/resolvers/queries/languages/languages.d.ts.map +1 -1
- package/lib/resolvers/queries/languages/languages.js.map +1 -1
- package/lib/resolvers/queries/orders/orders.d.ts +1 -1
- package/lib/resolvers/queries/orders/orders.d.ts.map +1 -1
- package/lib/resolvers/queries/orders/orders.js.map +1 -1
- package/lib/resolvers/queries/products/productReviews.d.ts +1 -1
- package/lib/resolvers/queries/products/productReviews.d.ts.map +1 -1
- package/lib/resolvers/queries/products/products.d.ts +1 -1
- package/lib/resolvers/queries/products/products.d.ts.map +1 -1
- package/lib/resolvers/queries/quotations/quotations.d.ts +1 -1
- package/lib/resolvers/queries/quotations/quotations.d.ts.map +1 -1
- package/lib/resolvers/queries/quotations/quotations.js.map +1 -1
- package/lib/resolvers/queries/users/impersonator.d.ts.map +1 -1
- package/lib/resolvers/queries/users/impersonator.js +1 -1
- package/lib/resolvers/queries/users/impersonator.js.map +1 -1
- package/lib/resolvers/queries/users/user.d.ts.map +1 -1
- package/lib/resolvers/queries/users/user.js.map +1 -1
- package/lib/resolvers/queries/users/users.d.ts +1 -1
- package/lib/resolvers/queries/users/users.d.ts.map +1 -1
- package/lib/resolvers/queries/worker/workQueue.d.ts +3 -3
- package/lib/resolvers/queries/worker/workQueue.d.ts.map +1 -1
- package/lib/resolvers/type/assortment/assortment-filter-types.d.ts +4 -8
- package/lib/resolvers/type/assortment/assortment-filter-types.d.ts.map +1 -1
- package/lib/resolvers/type/assortment/assortment-filter-types.js +4 -6
- 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.d.ts.map +1 -1
- package/lib/resolvers/type/assortment/assortment-media-types.js +2 -2
- package/lib/resolvers/type/assortment/assortment-media-types.js.map +1 -1
- package/lib/resolvers/type/assortment/assortment-path-link-types.d.ts +2 -2
- package/lib/resolvers/type/assortment/assortment-path-link-types.d.ts.map +1 -1
- package/lib/resolvers/type/assortment/assortment-path-link-types.js +2 -2
- 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.d.ts.map +1 -1
- package/lib/resolvers/type/assortment/assortment-types.d.ts +2 -2
- package/lib/resolvers/type/assortment/assortment-types.d.ts.map +1 -1
- package/lib/resolvers/type/assortment/assortment-types.js +5 -5
- package/lib/resolvers/type/assortment/assortment-types.js.map +1 -1
- package/lib/resolvers/type/bookmark-types.d.ts.map +1 -1
- package/lib/resolvers/type/bookmark-types.js +2 -3
- package/lib/resolvers/type/bookmark-types.js.map +1 -1
- package/lib/resolvers/type/country-types.d.ts +1 -1
- package/lib/resolvers/type/country-types.d.ts.map +1 -1
- package/lib/resolvers/type/country-types.js +4 -7
- package/lib/resolvers/type/country-types.js.map +1 -1
- package/lib/resolvers/type/delivery-provider-types.d.ts +10 -13
- package/lib/resolvers/type/delivery-provider-types.d.ts.map +1 -1
- package/lib/resolvers/type/delivery-provider-types.js +8 -9
- package/lib/resolvers/type/delivery-provider-types.js.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-delivery-types.d.ts +2 -6
- package/lib/resolvers/type/enrollment/enrollment-delivery-types.d.ts.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-delivery-types.js +4 -3
- package/lib/resolvers/type/enrollment/enrollment-delivery-types.js.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-payment-types.d.ts +2 -6
- package/lib/resolvers/type/enrollment/enrollment-payment-types.d.ts.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-payment-types.js +2 -3
- package/lib/resolvers/type/enrollment/enrollment-payment-types.js.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-period-types.d.ts +2 -6
- package/lib/resolvers/type/enrollment/enrollment-period-types.d.ts.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-period-types.js +2 -3
- package/lib/resolvers/type/enrollment/enrollment-period-types.js.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-plan-tyes.d.ts +2 -6
- package/lib/resolvers/type/enrollment/enrollment-plan-tyes.d.ts.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-plan-tyes.js +2 -3
- package/lib/resolvers/type/enrollment/enrollment-plan-tyes.js.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-types.d.ts +15 -14
- package/lib/resolvers/type/enrollment/enrollment-types.d.ts.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-types.js +3 -6
- package/lib/resolvers/type/enrollment/enrollment-types.js.map +1 -1
- package/lib/resolvers/type/filter/filter-option-types.d.ts +6 -9
- package/lib/resolvers/type/filter/filter-option-types.d.ts.map +1 -1
- package/lib/resolvers/type/filter/filter-option-types.js +2 -3
- package/lib/resolvers/type/filter/filter-option-types.js.map +1 -1
- package/lib/resolvers/type/filter/filter-types.d.ts +16 -8
- package/lib/resolvers/type/filter/filter-types.d.ts.map +1 -1
- package/lib/resolvers/type/filter/filter-types.js +2 -3
- package/lib/resolvers/type/filter/filter-types.js.map +1 -1
- package/lib/resolvers/type/filter/loaded-filter-types.d.ts +2 -3
- package/lib/resolvers/type/filter/loaded-filter-types.d.ts.map +1 -1
- package/lib/resolvers/type/index.d.ts +273 -261
- package/lib/resolvers/type/index.d.ts.map +1 -1
- package/lib/resolvers/type/login-method-response-types.js +1 -1
- package/lib/resolvers/type/login-method-response-types.js.map +1 -1
- package/lib/resolvers/type/order/order-delivery-discount-types.d.ts +1 -1
- package/lib/resolvers/type/order/order-delivery-discount-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-delivery-discount-types.js +1 -2
- package/lib/resolvers/type/order/order-delivery-discount-types.js.map +1 -1
- package/lib/resolvers/type/order/order-delivery-pickup-types.d.ts +13 -12
- package/lib/resolvers/type/order/order-delivery-pickup-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-delivery-pickup-types.js +10 -14
- package/lib/resolvers/type/order/order-delivery-pickup-types.js.map +1 -1
- package/lib/resolvers/type/order/order-delivery-shipping-types.d.ts +12 -12
- package/lib/resolvers/type/order/order-delivery-shipping-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-delivery-shipping-types.js +7 -10
- package/lib/resolvers/type/order/order-delivery-shipping-types.js.map +1 -1
- package/lib/resolvers/type/order/order-delivery-types.d.ts +1 -1
- package/lib/resolvers/type/order/order-delivery-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-delivery-types.js +2 -3
- package/lib/resolvers/type/order/order-delivery-types.js.map +1 -1
- package/lib/resolvers/type/order/order-discount-types.d.ts +11 -13
- package/lib/resolvers/type/order/order-discount-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-discount-types.js +9 -16
- package/lib/resolvers/type/order/order-discount-types.js.map +1 -1
- package/lib/resolvers/type/order/order-global-discount-types.d.ts +1 -1
- package/lib/resolvers/type/order/order-global-discount-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-global-discount-types.js +1 -2
- package/lib/resolvers/type/order/order-global-discount-types.js.map +1 -1
- package/lib/resolvers/type/order/order-item-discount-types.d.ts +1 -1
- package/lib/resolvers/type/order/order-item-discount-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-item-discount-types.js +1 -2
- package/lib/resolvers/type/order/order-item-discount-types.js.map +1 -1
- package/lib/resolvers/type/order/order-item-types.d.ts +5 -5
- package/lib/resolvers/type/order/order-item-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-item-types.js +14 -17
- package/lib/resolvers/type/order/order-item-types.js.map +1 -1
- package/lib/resolvers/type/order/order-payment-card-types.d.ts +11 -10
- package/lib/resolvers/type/order/order-payment-card-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-payment-card-types.js +6 -9
- package/lib/resolvers/type/order/order-payment-card-types.js.map +1 -1
- package/lib/resolvers/type/order/order-payment-discount-types.d.ts +1 -1
- package/lib/resolvers/type/order/order-payment-discount-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-payment-discount-types.js +2 -4
- package/lib/resolvers/type/order/order-payment-discount-types.js.map +1 -1
- package/lib/resolvers/type/order/order-payment-generic-types.d.ts +11 -10
- package/lib/resolvers/type/order/order-payment-generic-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-payment-generic-types.js +6 -9
- package/lib/resolvers/type/order/order-payment-generic-types.js.map +1 -1
- package/lib/resolvers/type/order/order-payment-invoice-types.d.ts +11 -10
- package/lib/resolvers/type/order/order-payment-invoice-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-payment-invoice-types.js +6 -9
- package/lib/resolvers/type/order/order-payment-invoice-types.js.map +1 -1
- package/lib/resolvers/type/order/order-payment-types.d.ts +1 -1
- package/lib/resolvers/type/order/order-payment-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-payment-types.js +2 -3
- package/lib/resolvers/type/order/order-payment-types.js.map +1 -1
- package/lib/resolvers/type/order/order-types.d.ts +6 -6
- package/lib/resolvers/type/order/order-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-types.js +7 -15
- package/lib/resolvers/type/order/order-types.js.map +1 -1
- package/lib/resolvers/type/payment/payment-credentials-types.d.ts.map +1 -1
- package/lib/resolvers/type/payment/payment-credentials-types.js +6 -9
- package/lib/resolvers/type/payment/payment-credentials-types.js.map +1 -1
- package/lib/resolvers/type/payment/payment-provider-types.d.ts +2 -2
- package/lib/resolvers/type/payment/payment-provider-types.d.ts.map +1 -1
- package/lib/resolvers/type/payment/payment-provider-types.js +8 -9
- package/lib/resolvers/type/payment/payment-provider-types.js.map +1 -1
- package/lib/resolvers/type/price-types.d.ts +3 -4
- package/lib/resolvers/type/price-types.d.ts.map +1 -1
- package/lib/resolvers/type/price-types.js +2 -2
- package/lib/resolvers/type/price-types.js.map +1 -1
- package/lib/resolvers/type/product/product-assortment-path-types.d.ts +1 -1
- package/lib/resolvers/type/product/product-assortment-path-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-bundle-types.d.ts +10 -10
- package/lib/resolvers/type/product/product-bundle-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-catalog-price-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-catalog-price-types.js +4 -6
- package/lib/resolvers/type/product/product-catalog-price-types.js.map +1 -1
- package/lib/resolvers/type/product/product-configurable-types.d.ts +20 -20
- package/lib/resolvers/type/product/product-configurable-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-configurable-types.js +10 -12
- 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-discount.js +1 -1
- package/lib/resolvers/type/product/product-discount.js.map +1 -1
- package/lib/resolvers/type/product/product-media-types.js +2 -2
- package/lib/resolvers/type/product/product-media-types.js.map +1 -1
- package/lib/resolvers/type/product/product-plan-types.d.ts +18 -18
- package/lib/resolvers/type/product/product-plan-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-plan-types.js +16 -16
- 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.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-review-types.js +2 -3
- package/lib/resolvers/type/product/product-review-types.js.map +1 -1
- package/lib/resolvers/type/product/product-simple-types.d.ts +22 -22
- package/lib/resolvers/type/product/product-simple-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-simple-types.js +3 -11
- package/lib/resolvers/type/product/product-simple-types.js.map +1 -1
- package/lib/resolvers/type/product/product-tokenized-types.d.ts +20 -20
- package/lib/resolvers/type/product/product-tokenized-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-tokenized-types.js +1 -5
- package/lib/resolvers/type/product/product-tokenized-types.js.map +1 -1
- package/lib/resolvers/type/product/product-types.d.ts +9 -9
- package/lib/resolvers/type/product/product-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-types.js +2 -5
- package/lib/resolvers/type/product/product-types.js.map +1 -1
- package/lib/resolvers/type/product/product-variation-assignment-types.d.ts +2 -2
- package/lib/resolvers/type/product/product-variation-assignment-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-variation-assignment-types.js +1 -1
- package/lib/resolvers/type/product/product-variation-assignment-types.js.map +1 -1
- package/lib/resolvers/type/product/product-variation-assignment-vector.js +2 -2
- package/lib/resolvers/type/product/product-variation-assignment-vector.js.map +1 -1
- package/lib/resolvers/type/product/product-variation-option-types.js +3 -3
- package/lib/resolvers/type/product/product-variation-option-types.js.map +1 -1
- package/lib/resolvers/type/product/product-variation-types.d.ts +2 -2
- package/lib/resolvers/type/product/product-variation-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-variation-types.js +3 -3
- package/lib/resolvers/type/product/product-variation-types.js.map +1 -1
- package/lib/resolvers/type/product-search-result-types.d.ts +5 -6
- package/lib/resolvers/type/product-search-result-types.d.ts.map +1 -1
- package/lib/resolvers/type/quotation-types.d.ts +8 -15
- package/lib/resolvers/type/quotation-types.d.ts.map +1 -1
- package/lib/resolvers/type/quotation-types.js +3 -6
- package/lib/resolvers/type/quotation-types.js.map +1 -1
- package/lib/resolvers/type/shop-types.d.ts +1 -1
- package/lib/resolvers/type/shop-types.d.ts.map +1 -1
- package/lib/resolvers/type/shop-types.js +4 -6
- package/lib/resolvers/type/shop-types.js.map +1 -1
- package/lib/resolvers/type/token-types.d.ts +2 -2
- package/lib/resolvers/type/token-types.d.ts.map +1 -1
- package/lib/resolvers/type/token-types.js +12 -26
- package/lib/resolvers/type/token-types.js.map +1 -1
- package/lib/resolvers/type/user-types.d.ts +22 -22
- package/lib/resolvers/type/user-types.d.ts.map +1 -1
- package/lib/resolvers/type/user-types.js +5 -16
- package/lib/resolvers/type/user-types.js.map +1 -1
- package/lib/resolvers/type/work-types.d.ts.map +1 -1
- package/lib/resolvers/type/work-types.js +0 -1
- package/lib/resolvers/type/work-types.js.map +1 -1
- package/lib/roles/all.d.ts.map +1 -1
- package/lib/roles/all.js +0 -1
- package/lib/roles/all.js.map +1 -1
- package/lib/schema/types/assortment.js +5 -5
- package/lib/schema/types/country.js +1 -1
- package/lib/schema/types/delivery.d.ts.map +1 -1
- package/lib/schema/types/delivery.js +6 -2
- package/lib/schema/types/delivery.js.map +1 -1
- package/lib/schema/types/filter.js +3 -3
- package/lib/schema/types/payment.d.ts.map +1 -1
- package/lib/schema/types/payment.js +6 -2
- package/lib/schema/types/payment.js.map +1 -1
- package/lib/schema/types/price.js +1 -1
- package/lib/schema/types/product/bundle-product.js +1 -1
- package/lib/schema/types/product/configurable-product.js +6 -6
- package/lib/schema/types/product/plan-product.js +5 -5
- package/lib/schema/types/product/product.js +4 -4
- package/lib/schema/types/product/simple-product.js +4 -4
- package/lib/schema/types/product/tokenized-product.js +5 -5
- package/lib/schema/types/warehousing.js +1 -1
- package/lib/utils/inputValidation.d.ts.map +1 -0
- package/lib/utils/inputValidation.js +51 -0
- package/lib/utils/inputValidation.js.map +1 -0
- package/package.json +12 -12
- package/src/context.ts +3 -3
- package/src/createGraphQLServer.ts +2 -2
- package/src/errors.ts +10 -0
- package/src/express/createERCMetadataMiddleware.ts +11 -5
- package/src/express/index.ts +2 -3
- package/src/fastify/ercMetadataHandler.ts +11 -5
- package/src/fastify/index.ts +2 -3
- package/src/loaders/assortmentLinkLoader.ts +32 -0
- package/src/loaders/assortmentLinksLoader.ts +46 -0
- package/src/loaders/assortmentLoader.ts +20 -0
- package/src/loaders/assortmentMediaTextLoader.ts +26 -0
- package/src/loaders/assortmentMediasLoader.ts +21 -0
- package/src/loaders/assortmentProductLoader.ts +19 -0
- package/src/loaders/assortmentProductsLoader.ts +22 -0
- package/src/loaders/assortmentTextLoader.ts +24 -0
- package/src/loaders/buildTextMap.ts +1 -1
- package/src/loaders/countryLoader.ts +20 -0
- package/src/loaders/currencyLoader.ts +20 -0
- package/src/loaders/deliveryProviderLoader.ts +19 -0
- package/src/loaders/fileLoader.ts +19 -0
- package/src/loaders/filterLoader.ts +20 -0
- package/src/loaders/filterTextLoader.ts +26 -0
- package/src/loaders/index.ts +48 -360
- package/src/loaders/languageLoader.ts +20 -0
- package/src/loaders/orderLoader.ts +22 -0
- package/src/loaders/paymentProviderLoader.ts +19 -0
- package/src/loaders/productLoader.ts +22 -0
- package/src/loaders/productLoaderBySKU.ts +22 -0
- package/src/loaders/productMediaTextLoader.ts +24 -0
- package/src/loaders/productMediasLoader.ts +21 -0
- package/src/loaders/productTextLoader.ts +22 -0
- package/src/loaders/userLoader.ts +23 -0
- package/src/loaders/utils.ts +35 -0
- package/src/locale-context.ts +16 -22
- package/src/resolvers/mutations/accounts/createUser.ts +4 -6
- package/src/resolvers/mutations/accounts/impersonate.ts +1 -1
- package/src/resolvers/mutations/accounts/loginAsGuest.ts +4 -6
- package/src/resolvers/mutations/accounts/loginWithPassword.ts +3 -3
- package/src/resolvers/mutations/accounts/loginWithWebAuthn.ts +3 -3
- package/src/resolvers/mutations/accounts/resetPassword.ts +3 -3
- package/src/resolvers/mutations/accounts/stopImpersonation.ts +1 -1
- package/src/resolvers/mutations/accounts/verifyEmail.ts +3 -3
- package/src/resolvers/mutations/assortments/reorderAssortmentFilters.ts +1 -1
- package/src/resolvers/mutations/assortments/reorderAssortmentLinks.ts +1 -1
- package/src/resolvers/mutations/assortments/reorderAssortmentMedia.ts +1 -1
- package/src/resolvers/mutations/assortments/reorderAssortmentProducts.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/enrollments/createEnrollment.ts +3 -3
- package/src/resolvers/mutations/enrollments/updateEnrollment.ts +2 -2
- package/src/resolvers/mutations/filters/createFilter.ts +2 -6
- package/src/resolvers/mutations/filters/updateFilterTexts.ts +1 -1
- package/src/resolvers/mutations/orders/addCartDiscount.ts +1 -1
- package/src/resolvers/mutations/orders/addCartProduct.ts +1 -1
- package/src/resolvers/mutations/orders/addCartQuotation.ts +2 -2
- package/src/resolvers/mutations/orders/addMultipleCartProducts.ts +4 -4
- package/src/resolvers/mutations/orders/checkoutCart.ts +1 -1
- package/src/resolvers/mutations/orders/createCart.ts +1 -1
- package/src/resolvers/mutations/orders/emptyCart.ts +1 -1
- package/src/resolvers/mutations/orders/signPaymentProviderForCheckout.ts +1 -1
- package/src/resolvers/mutations/orders/updateCart.ts +1 -1
- package/src/resolvers/mutations/orders/updateCartItem.ts +1 -1
- package/src/resolvers/mutations/products/addProductAssignment.ts +50 -3
- package/src/resolvers/mutations/products/createProductVariation.ts +5 -1
- package/src/resolvers/mutations/products/removeProductAssignment.ts +1 -1
- package/src/resolvers/mutations/products/reorderProductMedia.ts +1 -1
- package/src/resolvers/mutations/products/updateProductMediaTexts.ts +1 -1
- package/src/resolvers/mutations/products/updateProductVariationTexts.ts +1 -1
- package/src/resolvers/mutations/quotations/requestQuotation.ts +4 -4
- package/src/resolvers/mutations/users/heartbeat.ts +3 -3
- package/src/resolvers/mutations/users/setRoles.ts +1 -1
- package/src/resolvers/mutations/users/setUserTags.ts +1 -1
- package/src/resolvers/mutations/warehousing/invalidateToken.ts +3 -3
- package/src/resolvers/mutations/worker/allocateWork.ts +1 -1
- package/src/resolvers/queries/assortments/assortments.ts +1 -1
- package/src/resolvers/queries/countries/countries.ts +1 -1
- package/src/resolvers/queries/currencies/currencies.ts +1 -1
- package/src/resolvers/queries/enrollments/enrollments.ts +1 -1
- package/src/resolvers/queries/filters/filters.ts +1 -1
- package/src/resolvers/queries/filters/searchAssortments.ts +2 -2
- package/src/resolvers/queries/filters/searchProducts.ts +3 -3
- package/src/resolvers/queries/languages/languages.ts +1 -1
- package/src/resolvers/queries/orders/orders.ts +1 -1
- package/src/resolvers/queries/products/productReviews.ts +1 -1
- package/src/resolvers/queries/products/products.ts +1 -1
- package/src/resolvers/queries/quotations/quotations.ts +1 -1
- package/src/resolvers/queries/users/impersonator.ts +2 -1
- package/src/resolvers/queries/users/user.ts +1 -0
- package/src/resolvers/queries/users/users.ts +1 -1
- package/src/resolvers/queries/worker/workQueue.ts +3 -3
- package/src/resolvers/type/assortment/assortment-filter-types.ts +6 -16
- package/src/resolvers/type/assortment/assortment-link-types.ts +2 -2
- package/src/resolvers/type/assortment/assortment-media-types.ts +2 -2
- package/src/resolvers/type/assortment/assortment-path-link-types.ts +3 -3
- package/src/resolvers/type/assortment/assortment-product-types.ts +2 -2
- package/src/resolvers/type/assortment/assortment-types.ts +6 -6
- package/src/resolvers/type/bookmark-types.ts +2 -3
- package/src/resolvers/type/country-types.ts +5 -8
- package/src/resolvers/type/delivery-provider-types.ts +26 -47
- package/src/resolvers/type/enrollment/enrollment-delivery-types.ts +5 -11
- package/src/resolvers/type/enrollment/enrollment-payment-types.ts +3 -11
- package/src/resolvers/type/enrollment/enrollment-period-types.ts +3 -11
- package/src/resolvers/type/enrollment/enrollment-plan-tyes.ts +3 -11
- package/src/resolvers/type/enrollment/enrollment-types.ts +10 -25
- package/src/resolvers/type/filter/filter-option-types.ts +10 -15
- package/src/resolvers/type/filter/filter-types.ts +5 -13
- package/src/resolvers/type/filter/loaded-filter-types.ts +2 -2
- package/src/resolvers/type/login-method-response-types.ts +1 -1
- package/src/resolvers/type/order/order-delivery-discount-types.ts +1 -2
- package/src/resolvers/type/order/order-delivery-pickup-types.ts +12 -28
- package/src/resolvers/type/order/order-delivery-shipping-types.ts +9 -23
- package/src/resolvers/type/order/order-delivery-types.ts +2 -3
- package/src/resolvers/type/order/order-discount-types.ts +12 -39
- package/src/resolvers/type/order/order-global-discount-types.ts +1 -2
- package/src/resolvers/type/order/order-item-discount-types.ts +1 -2
- package/src/resolvers/type/order/order-item-types.ts +19 -27
- package/src/resolvers/type/order/order-payment-card-types.ts +8 -21
- package/src/resolvers/type/order/order-payment-discount-types.ts +1 -2
- package/src/resolvers/type/order/order-payment-generic-types.ts +8 -20
- package/src/resolvers/type/order/order-payment-invoice-types.ts +8 -20
- package/src/resolvers/type/order/order-payment-types.ts +2 -3
- package/src/resolvers/type/order/order-types.ts +10 -22
- package/src/resolvers/type/payment/payment-credentials-types.ts +6 -10
- package/src/resolvers/type/payment/payment-provider-types.ts +9 -10
- package/src/resolvers/type/price-types.ts +4 -4
- package/src/resolvers/type/product/product-assortment-path-types.ts +1 -1
- package/src/resolvers/type/product/product-bundle-types.ts +1 -1
- package/src/resolvers/type/product/product-catalog-price-types.ts +4 -6
- package/src/resolvers/type/product/product-configurable-types.ts +20 -21
- package/src/resolvers/type/product/product-discount.ts +1 -1
- package/src/resolvers/type/product/product-media-types.ts +2 -2
- package/src/resolvers/type/product/product-plan-types.ts +22 -22
- package/src/resolvers/type/product/product-review-types.ts +3 -4
- package/src/resolvers/type/product/product-simple-types.ts +7 -19
- package/src/resolvers/type/product/product-tokenized-types.ts +3 -10
- package/src/resolvers/type/product/product-types.ts +10 -13
- package/src/resolvers/type/product/product-variation-assignment-types.ts +2 -2
- package/src/resolvers/type/product/product-variation-assignment-vector.ts +2 -2
- package/src/resolvers/type/product/product-variation-option-types.ts +3 -3
- package/src/resolvers/type/product/product-variation-types.ts +5 -5
- package/src/resolvers/type/product-search-result-types.ts +5 -5
- package/src/resolvers/type/quotation-types.ts +11 -25
- package/src/resolvers/type/shop-types.ts +5 -7
- package/src/resolvers/type/token-types.ts +15 -32
- package/src/resolvers/type/user-types.ts +27 -39
- package/src/resolvers/type/work-types.ts +0 -2
- package/src/roles/all.ts +0 -1
- package/src/schema/types/assortment.ts +5 -5
- package/src/schema/types/country.ts +1 -1
- package/src/schema/types/delivery.ts +6 -2
- package/src/schema/types/filter.ts +3 -3
- package/src/schema/types/payment.ts +6 -2
- package/src/schema/types/price.ts +1 -1
- package/src/schema/types/product/bundle-product.ts +1 -1
- package/src/schema/types/product/configurable-product.ts +6 -6
- package/src/schema/types/product/plan-product.ts +5 -5
- package/src/schema/types/product/product.ts +4 -4
- package/src/schema/types/product/simple-product.ts +4 -4
- package/src/schema/types/product/tokenized-product.ts +5 -5
- package/src/schema/types/warehousing.ts +1 -1
package/lib/mcp/index.js
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
export async function searchProductsWithCore(unchainedAPI, args) {
|
|
2
|
+
const { limit = 10, offset = 0, ...searchArgs } = args;
|
|
3
|
+
// Use the services directly
|
|
4
|
+
const searchResult = await unchainedAPI.services.filters.searchProducts({
|
|
5
|
+
queryString: searchArgs.queryString,
|
|
6
|
+
filterQuery: searchArgs.filterQuery,
|
|
7
|
+
assortmentIds: searchArgs.assortmentId ? [searchArgs.assortmentId] : undefined,
|
|
8
|
+
includeInactive: searchArgs.includeInactive,
|
|
9
|
+
orderBy: searchArgs.orderBy,
|
|
10
|
+
}, { forceLiveCollection: false, locale: new Intl.Locale('en') });
|
|
11
|
+
// Get products from the filtered product IDs
|
|
12
|
+
const productIds = searchResult.aggregatedFilteredProductIds.slice(offset, offset + limit);
|
|
13
|
+
const products = await Promise.all(productIds.map(async (productId) => {
|
|
14
|
+
const product = await unchainedAPI.modules.products.findProduct({ productId });
|
|
15
|
+
if (!product)
|
|
16
|
+
return null;
|
|
17
|
+
const texts = await unchainedAPI.modules.products.texts.findTexts({ productId }, { limit: 1 });
|
|
18
|
+
const media = await unchainedAPI.modules.products.media.findProductMedia({ productId });
|
|
19
|
+
// Simulate pricing to get the price
|
|
20
|
+
let price = null;
|
|
21
|
+
try {
|
|
22
|
+
const pricing = await unchainedAPI.services.products.simulateProductPricing({
|
|
23
|
+
product,
|
|
24
|
+
user: undefined, // Anonymous user
|
|
25
|
+
countryCode: 'CH',
|
|
26
|
+
currencyCode: 'CHF',
|
|
27
|
+
quantity: 1,
|
|
28
|
+
});
|
|
29
|
+
price = pricing?.total;
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
// Price simulation failed, continue without price
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
id: productId,
|
|
36
|
+
title: texts[0]?.title || 'Untitled Product',
|
|
37
|
+
image: media[0]?.file?.url || null,
|
|
38
|
+
price: price ? `${price.amount / 100} ${price.currency}` : 'Price not available',
|
|
39
|
+
breadcrumb: searchArgs.assortmentId ? `Assortment: ${searchArgs.assortmentId}` : null,
|
|
40
|
+
};
|
|
41
|
+
}));
|
|
42
|
+
// Load filters and options
|
|
43
|
+
const filters = await unchainedAPI.services.filters.loadFilters(searchResult.searchConfiguration.searchQuery, { productIds: searchResult.aggregatedFilteredProductIds, forceLiveCollection: false });
|
|
44
|
+
return {
|
|
45
|
+
summary: {
|
|
46
|
+
totalProducts: searchResult.aggregatedTotalProductIds.length,
|
|
47
|
+
filteredProducts: searchResult.aggregatedFilteredProductIds.length,
|
|
48
|
+
},
|
|
49
|
+
products: products.filter(Boolean),
|
|
50
|
+
filters,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export function renderProductList(results) {
|
|
54
|
+
let output = `# Product Search Results\n\n`;
|
|
55
|
+
output += `Found ${results.summary.filteredProducts} products (${results.summary.totalProducts} total)\n\n`;
|
|
56
|
+
if (results.products.length > 0) {
|
|
57
|
+
output += `## Products\n\n`;
|
|
58
|
+
results.products.forEach((product, index) => {
|
|
59
|
+
output += `### ${index + 1}. ${product.title}\n`;
|
|
60
|
+
output += `- **ID**: ${product.id}\n`;
|
|
61
|
+
output += `- **Price**: ${product.price}\n`;
|
|
62
|
+
if (product.image) {
|
|
63
|
+
output += `- **Image**: \n`;
|
|
64
|
+
}
|
|
65
|
+
if (product.breadcrumb) {
|
|
66
|
+
output += `- **Location**: ${product.breadcrumb}\n`;
|
|
67
|
+
}
|
|
68
|
+
output += `\n`;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
if (results.filters && results.filters.length > 0) {
|
|
72
|
+
output += `## Available Filters\n\n`;
|
|
73
|
+
results.filters.forEach((filter) => {
|
|
74
|
+
output += `### ${filter.title} (${filter.key})\n`;
|
|
75
|
+
filter.options.forEach((option) => {
|
|
76
|
+
const selected = option.isSelected ? ' ✓' : '';
|
|
77
|
+
output += `- ${option.title} (${option.productsCount} products)${selected}\n`;
|
|
78
|
+
});
|
|
79
|
+
output += `\n`;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return output;
|
|
83
|
+
}
|
|
84
|
+
export const searchProductsTool = {
|
|
85
|
+
name: 'searchProducts',
|
|
86
|
+
description: 'Search for products in the Unchained E-Commerce system',
|
|
87
|
+
inputSchema: {
|
|
88
|
+
type: 'object',
|
|
89
|
+
properties: {
|
|
90
|
+
queryString: {
|
|
91
|
+
type: 'string',
|
|
92
|
+
description: 'Free text search query',
|
|
93
|
+
},
|
|
94
|
+
filterQuery: {
|
|
95
|
+
type: 'array',
|
|
96
|
+
items: {
|
|
97
|
+
type: 'object',
|
|
98
|
+
properties: {
|
|
99
|
+
key: { type: 'string' },
|
|
100
|
+
value: { type: 'string' },
|
|
101
|
+
},
|
|
102
|
+
required: ['key'],
|
|
103
|
+
},
|
|
104
|
+
description: 'Array of filter criteria',
|
|
105
|
+
},
|
|
106
|
+
assortmentId: {
|
|
107
|
+
type: 'string',
|
|
108
|
+
description: 'Restrict search to products within a specific assortment',
|
|
109
|
+
},
|
|
110
|
+
orderBy: {
|
|
111
|
+
type: 'string',
|
|
112
|
+
enum: ['default'],
|
|
113
|
+
description: 'Sort order for results',
|
|
114
|
+
},
|
|
115
|
+
includeInactive: {
|
|
116
|
+
type: 'boolean',
|
|
117
|
+
default: false,
|
|
118
|
+
description: 'Whether to include inactive products',
|
|
119
|
+
},
|
|
120
|
+
ignoreChildAssortments: {
|
|
121
|
+
type: 'boolean',
|
|
122
|
+
default: false,
|
|
123
|
+
description: 'When assortmentId is provided, whether to ignore child assortments',
|
|
124
|
+
},
|
|
125
|
+
limit: {
|
|
126
|
+
type: 'integer',
|
|
127
|
+
default: 10,
|
|
128
|
+
description: 'Number of products to return',
|
|
129
|
+
},
|
|
130
|
+
offset: {
|
|
131
|
+
type: 'integer',
|
|
132
|
+
default: 0,
|
|
133
|
+
description: 'Number of products to skip for pagination',
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":"AAaA,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,YAA2B,EAAE,IAAwB;IAChG,MAAM,EAAE,KAAK,GAAG,EAAE,EAAE,MAAM,GAAG,CAAC,EAAE,GAAG,UAAU,EAAE,GAAG,IAAI,CAAC;IAEvD,4BAA4B;IAC5B,MAAM,YAAY,GAAG,MAAM,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,cAAc,CACrE;QACE,WAAW,EAAE,UAAU,CAAC,WAAW;QACnC,WAAW,EAAE,UAAU,CAAC,WAAW;QACnC,aAAa,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS;QAC9E,eAAe,EAAE,UAAU,CAAC,eAAe;QAC3C,OAAO,EAAE,UAAU,CAAC,OAAO;KAC5B,E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AE,wDAAwD;IACrE,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,wBAAwB;aACtC;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;wBACvB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;qBAC1B;oBACD,QAAQ,EAAE,CAAC,KAAK,CAAC;iBAClB;gBACD,WAAW,EAAE,0BAA0B;aACxC;YACD,YAAY,EAAE;gBACZ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,0DAA0D;aACxE;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,SAAS,CAAC;gBACjB,WAAW,EAAE,wBAAwB;aACtC;YACD,eAAe,EAAE;gBACf,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,KAAK;gBACd,WAAW,EAAE,sCAAsC;aACpD;YACD,sBAAsB,EAAE;gBACtB,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,KAAK;gBACd,WAAW,EAAE,oEAAoE;aAClF;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,8BAA8B;aAC5C;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,CAAC;gBACV,WAAW,EAAE,2CAA2C;aACzD;SACF;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
|
+
export declare function createMCPServer(unchainedAPI: UnchainedCore): Promise<import("./types.js").MCPServer>;
|
|
3
|
+
export declare function startMCPServer(unchainedAPI: UnchainedCore): Promise<import("./types.js").MCPServer>;
|
|
4
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIpD,wBAAsB,eAAe,CAAC,YAAY,EAAE,aAAa,2CAyDhE;AAGD,wBAAsB,cAAc,CAAC,YAAY,EAAE,aAAa,2CAQ/D"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { searchProductsWithCore, renderProductList, searchProductsTool } from './index.js';
|
|
2
|
+
export async function createMCPServer(unchainedAPI) {
|
|
3
|
+
// Dynamically import MCP SDK
|
|
4
|
+
const { Server } = (await eval('import("@modelcontextprotocol/sdk/server/index.js")'));
|
|
5
|
+
const { CallToolRequestSchema, ListToolsRequestSchema } = (await eval('import("@modelcontextprotocol/sdk/types.js")'));
|
|
6
|
+
const server = new Server({
|
|
7
|
+
name: 'unchained',
|
|
8
|
+
version: '1.0.0',
|
|
9
|
+
}, {
|
|
10
|
+
capabilities: {
|
|
11
|
+
tools: {},
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
// Handle list tools request
|
|
15
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
16
|
+
return {
|
|
17
|
+
tools: [searchProductsTool],
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
// Handle tool calls
|
|
21
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
22
|
+
if (request.params.name === 'searchProducts') {
|
|
23
|
+
const args = request.params.arguments;
|
|
24
|
+
try {
|
|
25
|
+
const result = await searchProductsWithCore(unchainedAPI, args);
|
|
26
|
+
return {
|
|
27
|
+
content: [
|
|
28
|
+
{
|
|
29
|
+
type: 'text',
|
|
30
|
+
text: renderProductList(result),
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
return {
|
|
37
|
+
content: [
|
|
38
|
+
{
|
|
39
|
+
type: 'text',
|
|
40
|
+
text: `Error searching products: ${error.message}`,
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
isError: true,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
throw new Error(`Unknown tool: ${request.params.name}`);
|
|
48
|
+
});
|
|
49
|
+
return server;
|
|
50
|
+
}
|
|
51
|
+
// For standalone server usage - export a function that can be called from project examples
|
|
52
|
+
export async function startMCPServer(unchainedAPI) {
|
|
53
|
+
const { StdioServerTransport } = (await eval('import("@modelcontextprotocol/sdk/server/stdio.js")'));
|
|
54
|
+
const server = await createMCPServer(unchainedAPI);
|
|
55
|
+
const transport = new StdioServerTransport();
|
|
56
|
+
await server.connect(transport);
|
|
57
|
+
console.error('Unchained MCP server started');
|
|
58
|
+
return server;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAG3F,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,YAA2B;IAC/D,6BAA6B;IAC7B,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,IAAI,CAAC,qDAAqD,CAAC,CAAoB,CAAC;IAC1G,MAAM,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,GAAG,CAAC,MAAM,IAAI,CAAC,8CAA8C,CAAC,CAAa,CAAC;IAEnI,MAAM,MAAM,GAAG,IAAI,MAAM,CACvB;QACE,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,OAAO;KACjB,EACD;QACE,YAAY,EAAE;YACZ,KAAK,EAAE,EAAE;SACV;KACF,CACF,CAAC;IAEF,4BAA4B;IAC5B,MA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AC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAC9C,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface MCPServer {
|
|
2
|
+
setRequestHandler(schema: any, handler: Function): void;
|
|
3
|
+
connect(transport: any): Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
export interface MCPServerTransport {
|
|
6
|
+
}
|
|
7
|
+
export interface MCPServerConstructor {
|
|
8
|
+
new (info: {
|
|
9
|
+
name: string;
|
|
10
|
+
version: string;
|
|
11
|
+
}, capabilities: {
|
|
12
|
+
capabilities: any;
|
|
13
|
+
}): MCPServer;
|
|
14
|
+
}
|
|
15
|
+
export interface MCPStdioTransportConstructor {
|
|
16
|
+
new (): MCPServerTransport;
|
|
17
|
+
}
|
|
18
|
+
export interface MCPTypes {
|
|
19
|
+
CallToolRequestSchema: any;
|
|
20
|
+
ListToolsRequestSchema: any;
|
|
21
|
+
}
|
|
22
|
+
export interface MCPServerModule {
|
|
23
|
+
Server: MCPServerConstructor;
|
|
24
|
+
}
|
|
25
|
+
export interface MCPStdioModule {
|
|
26
|
+
StdioServerTransport: MCPStdioTransportConstructor;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/mcp/types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,SAAS;IACxB,iBAAiB,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,GAAG,IAAI,CAAC;IACxD,OAAO,CAAC,SAAS,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxC;AAED,MAAM,WAAW,kBAAkB;CAElC;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,YAAY,EAAE;QAAE,YAAY,EAAE,GAAG,CAAA;KAAE,GAAG,SAAS,CAAC;CAC/F;AAED,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,kBAAkB,CAAC;CAC5B;AAED,MAAM,WAAW,QAAQ;IACvB,qBAAqB,EAAE,GAAG,CAAC;IAC3B,sBAAsB,EAAE,GAAG,CAAC;CAC7B;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,oBAAoB,CAAC;CAC9B;AAED,MAAM,WAAW,cAAc;IAC7B,oBAAoB,EAAE,4BAA4B,CAAC;CACpD"}
|
package/lib/mcp/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/mcp/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accountLockout.d.ts","sourceRoot":"","sources":["../../src/middleware/accountLockout.ts"],"names":[],"mappings":"AAuCA,wBAAsB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAwB3E;AAED,wBAAsB,wBAAwB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAuChF;AAED,wBAAsB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAG1E"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { GraphQLError } from 'graphql';
|
|
2
|
+
// Store login attempts by user identifier (username/email)
|
|
3
|
+
const loginAttempts = new Map();
|
|
4
|
+
// Configuration
|
|
5
|
+
const MAX_ATTEMPTS = 5;
|
|
6
|
+
const LOCKOUT_DURATION = 30 * 60 * 1000; // 30 minutes
|
|
7
|
+
const ATTEMPT_WINDOW = 15 * 60 * 1000; // 15 minutes
|
|
8
|
+
// Clean up old entries periodically
|
|
9
|
+
setInterval(() => {
|
|
10
|
+
const now = Date.now();
|
|
11
|
+
for (const [key, attempt] of loginAttempts.entries()) {
|
|
12
|
+
// Remove entries older than 24 hours
|
|
13
|
+
if (now - attempt.lastAttempt > 24 * 60 * 60 * 1000) {
|
|
14
|
+
loginAttempts.delete(key);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}, 60 * 60 * 1000); // Clean every hour
|
|
18
|
+
async function createIdentifierHash(identifier) {
|
|
19
|
+
const encoder = new TextEncoder();
|
|
20
|
+
const dataBuffer = encoder.encode(identifier.toLowerCase());
|
|
21
|
+
const hashBuffer = await crypto.subtle.digest('SHA-256', dataBuffer);
|
|
22
|
+
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
23
|
+
return hashArray.map((b) => b.toString(16).padStart(2, '0')).join('');
|
|
24
|
+
}
|
|
25
|
+
export async function checkAccountLockout(identifier) {
|
|
26
|
+
const hashedIdentifier = await createIdentifierHash(identifier);
|
|
27
|
+
const attempt = loginAttempts.get(hashedIdentifier);
|
|
28
|
+
if (!attempt)
|
|
29
|
+
return;
|
|
30
|
+
const now = Date.now();
|
|
31
|
+
// Check if account is locked
|
|
32
|
+
if (attempt.lockedUntil && attempt.lockedUntil > now) {
|
|
33
|
+
const remainingMinutes = Math.ceil((attempt.lockedUntil - now) / 60000);
|
|
34
|
+
throw new GraphQLError(`Account is locked. Please try again in ${remainingMinutes} minutes.`, {
|
|
35
|
+
extensions: {
|
|
36
|
+
code: 'ACCOUNT_LOCKED',
|
|
37
|
+
lockedUntil: attempt.lockedUntil,
|
|
38
|
+
remainingMinutes,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
// Reset attempts if outside the window
|
|
43
|
+
if (now - attempt.firstAttempt > ATTEMPT_WINDOW) {
|
|
44
|
+
loginAttempts.delete(hashedIdentifier);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export async function recordFailedLoginAttempt(identifier) {
|
|
48
|
+
const hashedIdentifier = await createIdentifierHash(identifier);
|
|
49
|
+
const now = Date.now();
|
|
50
|
+
let attempt = loginAttempts.get(hashedIdentifier);
|
|
51
|
+
if (!attempt || now - attempt.firstAttempt > ATTEMPT_WINDOW) {
|
|
52
|
+
// Create new attempt record or reset if outside window
|
|
53
|
+
attempt = {
|
|
54
|
+
count: 1,
|
|
55
|
+
firstAttempt: now,
|
|
56
|
+
lastAttempt: now,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
// Increment existing attempt
|
|
61
|
+
attempt.count++;
|
|
62
|
+
attempt.lastAttempt = now;
|
|
63
|
+
// Lock account if max attempts exceeded
|
|
64
|
+
if (attempt.count >= MAX_ATTEMPTS) {
|
|
65
|
+
attempt.lockedUntil = now + LOCKOUT_DURATION;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
loginAttempts.set(hashedIdentifier, attempt);
|
|
69
|
+
// Provide warning about remaining attempts
|
|
70
|
+
if (attempt.count >= 3 && attempt.count < MAX_ATTEMPTS) {
|
|
71
|
+
const remainingAttempts = MAX_ATTEMPTS - attempt.count;
|
|
72
|
+
throw new GraphQLError(`Invalid credentials. ${remainingAttempts} attempts remaining before account lockout.`, {
|
|
73
|
+
extensions: {
|
|
74
|
+
code: 'INVALID_CREDENTIALS',
|
|
75
|
+
remainingAttempts,
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
export async function clearLoginAttempts(identifier) {
|
|
81
|
+
const hashedIdentifier = await createIdentifierHash(identifier);
|
|
82
|
+
loginAttempts.delete(hashedIdentifier);
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=accountLockout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accountLockout.js","sourceRoot":"","sources":["../../src/middleware/accountLockout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AASvC,2DAA2D;A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CAAC;CAClD;AAkCD,eAAO,MAAM,iBAAiB,GAAI,WAAW,MAAM,EAAE,UAAS,gBAAqB,MAmBnE,SAAS,GAAG,qBA8B3B,CAAC;AAGF,eAAO,MAAM,eAAe,YAjCH,GAAG,qBAqC1B,CAAC;AAEH,eAAO,MAAM,wBAAwB,YAvCZ,GAAG,qBAiD1B,CAAC;AAEH,eAAO,MAAM,uBAAuB,YAnDX,GAAG,qBA4D1B,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { GraphQLError } from 'graphql';
|
|
2
|
+
const stores = {};
|
|
3
|
+
// Clean up expired entries periodically
|
|
4
|
+
setInterval(() => {
|
|
5
|
+
const now = Date.now();
|
|
6
|
+
Object.keys(stores).forEach((storeName) => {
|
|
7
|
+
const store = stores[storeName];
|
|
8
|
+
Object.keys(store).forEach((key) => {
|
|
9
|
+
if (store[key].resetTime < now) {
|
|
10
|
+
delete store[key];
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
}, 60000); // Clean every minute
|
|
15
|
+
// Helper to create hash using WebCrypto
|
|
16
|
+
async function createHash(data) {
|
|
17
|
+
const encoder = new TextEncoder();
|
|
18
|
+
const dataBuffer = encoder.encode(data);
|
|
19
|
+
const hashBuffer = await crypto.subtle.digest('SHA-256', dataBuffer);
|
|
20
|
+
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
21
|
+
return hashArray.map((b) => b.toString(16).padStart(2, '0')).join('');
|
|
22
|
+
}
|
|
23
|
+
export const createRateLimiter = (storeName, options = {}) => {
|
|
24
|
+
const { windowMs = 15 * 60 * 1000, // 15 minutes default
|
|
25
|
+
max = 5, // 5 requests per window default
|
|
26
|
+
message = 'Too many requests, please try again later.', keyGenerator = async (context) => {
|
|
27
|
+
// Default key generator uses IP + userId
|
|
28
|
+
const ip = context.req?.ip || context.req?.connection?.remoteAddress || 'unknown';
|
|
29
|
+
const userId = context.userId || 'anonymous';
|
|
30
|
+
return createHash(`${ip}-${userId}`);
|
|
31
|
+
}, } = options;
|
|
32
|
+
// Initialize store for this limiter
|
|
33
|
+
if (!stores[storeName]) {
|
|
34
|
+
stores[storeName] = {};
|
|
35
|
+
}
|
|
36
|
+
const store = stores[storeName];
|
|
37
|
+
return async (context) => {
|
|
38
|
+
const key = await keyGenerator(context);
|
|
39
|
+
const now = Date.now();
|
|
40
|
+
// Get or create rate limit entry
|
|
41
|
+
let entry = store[key];
|
|
42
|
+
if (!entry || entry.resetTime < now) {
|
|
43
|
+
entry = {
|
|
44
|
+
count: 0,
|
|
45
|
+
resetTime: now + windowMs,
|
|
46
|
+
};
|
|
47
|
+
store[key] = entry;
|
|
48
|
+
}
|
|
49
|
+
// Increment counter
|
|
50
|
+
entry.count++;
|
|
51
|
+
// Check if limit exceeded
|
|
52
|
+
if (entry.count > max) {
|
|
53
|
+
const retryAfter = Math.ceil((entry.resetTime - now) / 1000);
|
|
54
|
+
throw new GraphQLError(message, {
|
|
55
|
+
extensions: {
|
|
56
|
+
code: 'RATE_LIMIT_EXCEEDED',
|
|
57
|
+
retryAfter,
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return true;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
// Pre-configured rate limiters for common use cases
|
|
65
|
+
export const authRateLimiter = createRateLimiter('auth', {
|
|
66
|
+
windowMs: 15 * 60 * 1000, // 15 minutes
|
|
67
|
+
max: 5, // 5 attempts per 15 minutes
|
|
68
|
+
message: 'Too many authentication attempts. Please try again later.',
|
|
69
|
+
});
|
|
70
|
+
export const passwordResetRateLimiter = createRateLimiter('passwordReset', {
|
|
71
|
+
windowMs: 60 * 60 * 1000, // 1 hour
|
|
72
|
+
max: 3, // 3 attempts per hour
|
|
73
|
+
message: 'Too many password reset requests. Please try again later.',
|
|
74
|
+
keyGenerator: async (context) => {
|
|
75
|
+
// Rate limit by email/username instead of IP for password reset
|
|
76
|
+
const { email, username } = context.args || {};
|
|
77
|
+
const identifier = email || username || 'unknown';
|
|
78
|
+
return createHash(identifier.toLowerCase());
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
export const registrationRateLimiter = createRateLimiter('registration', {
|
|
82
|
+
windowMs: 60 * 60 * 1000, // 1 hour
|
|
83
|
+
max: 10, // 10 registrations per hour per IP
|
|
84
|
+
message: 'Too many registration attempts. Please try again later.',
|
|
85
|
+
keyGenerator: async (context) => {
|
|
86
|
+
// Rate limit by IP only for registrations
|
|
87
|
+
const ip = context.req?.ip || context.req?.connection?.remoteAddress || 'unknown';
|
|
88
|
+
return createHash(ip);
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
//# sourceMappingURL=rateLimiter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rateLimiter.js","sourceRoot":"","sources":["../../src/middleware/rateLimiter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAiBvC,MAAM,MAAM,GAAmC,EAAE,CAAC;AAElD,wCAAwC;AACxC,WAAW,CAAC,GAAG,EAAE;IACf,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACvB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;QACxC,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;QAChC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACjC,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,SAAS,GAAG,GAAG,EAAE,CAAC;gBAC/B,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC;YACpB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,qBAAqB;AAEhC,wCAAwC;AACxC,KAAK,UAAU,UAAU,CAAC,IAAY;I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,CAAC;CACrB;AAED,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,sBAA2B,GAAG,MAAM,CA6C/E"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { GraphQLError } from 'graphql';
|
|
2
|
+
// Dangerous patterns to check for
|
|
3
|
+
const DANGEROUS_PATTERNS = [
|
|
4
|
+
/<script/i, // Script tags
|
|
5
|
+
/<iframe/i, // Iframes
|
|
6
|
+
/<object/i, // Object embeds
|
|
7
|
+
/<embed/i, // Embed tags
|
|
8
|
+
/<link/i, // Link tags (can load CSS)
|
|
9
|
+
/javascript:/i, // JavaScript protocol
|
|
10
|
+
/vbscript:/i, // VBScript protocol
|
|
11
|
+
/on\w+\s*=/i, // Event handlers (onclick, onload, etc)
|
|
12
|
+
/<meta/i, // Meta tags
|
|
13
|
+
/data:text\/html/i, // Data URLs with HTML
|
|
14
|
+
/<svg.*onload/i, // SVG with event handlers
|
|
15
|
+
/&#x?[0-9a-f]+;/i, // HTML entities (could be obfuscation)
|
|
16
|
+
/\\u[0-9a-f]{4}/i, // Unicode escapes
|
|
17
|
+
/expression\s*\(/i, // CSS expressions
|
|
18
|
+
/@import/i, // CSS imports
|
|
19
|
+
/<!--|-->/, // HTML comments
|
|
20
|
+
];
|
|
21
|
+
function checkForDangerousContent(value, path) {
|
|
22
|
+
for (const dangerous of DANGEROUS_PATTERNS) {
|
|
23
|
+
if (dangerous.test(value)) {
|
|
24
|
+
throw new GraphQLError(`Potentially dangerous content detected in ${path}`, {
|
|
25
|
+
extensions: {
|
|
26
|
+
code: 'DANGEROUS_INPUT',
|
|
27
|
+
path,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function validateValue(value, path = '') {
|
|
34
|
+
if (value === null || value === undefined) {
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
if (typeof value === 'string') {
|
|
38
|
+
checkForDangerousContent(value, path);
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
if (Array.isArray(value)) {
|
|
42
|
+
return value.map((item, index) => validateValue(item, `${path}[${index}]`));
|
|
43
|
+
}
|
|
44
|
+
if (typeof value === 'object') {
|
|
45
|
+
const validated = {};
|
|
46
|
+
for (const [key, val] of Object.entries(value)) {
|
|
47
|
+
validated[key] = validateValue(val, path ? `${path}.${key}` : key);
|
|
48
|
+
}
|
|
49
|
+
return validated;
|
|
50
|
+
}
|
|
51
|
+
return value;
|
|
52
|
+
}
|
|
53
|
+
export function useInputValidation(options = {}) {
|
|
54
|
+
const { skipOperations = [], skipFields = [], customValidator, logErrors = false } = options;
|
|
55
|
+
return {
|
|
56
|
+
onParams({ params, setParams }) {
|
|
57
|
+
// Get operation name from the request
|
|
58
|
+
const operationName = params.operationName || '';
|
|
59
|
+
// Skip if operation is in skip list
|
|
60
|
+
if (operationName && skipOperations.includes(operationName)) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
try {
|
|
64
|
+
// Validate variables
|
|
65
|
+
if (params.variables) {
|
|
66
|
+
const validatedVariables = {};
|
|
67
|
+
for (const [key, value] of Object.entries(params.variables)) {
|
|
68
|
+
if (!skipFields.includes(key)) {
|
|
69
|
+
validatedVariables[key] = validateValue(value, `variables.${key}`);
|
|
70
|
+
// Run custom validator if provided
|
|
71
|
+
if (customValidator) {
|
|
72
|
+
customValidator(value, `variables.${key}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
validatedVariables[key] = value;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
// Update params with validated variables
|
|
80
|
+
setParams({
|
|
81
|
+
...params,
|
|
82
|
+
variables: validatedVariables,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
if (logErrors) {
|
|
88
|
+
console.error('Input validation error:', error);
|
|
89
|
+
}
|
|
90
|
+
throw error;
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=inputValidation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inputValidation.js","sourceRoot":"","sources":["../../src/plugins/inputValidation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,kCAAkC;AAClC,MAAM,kBAAkB,GAAG;IACzB,UAAU,EAAE,cAAc;IAC1B,UAAU,EAAE,UAAU;IACtB,UAAU,EAAE,gBAAgB;IAC5B,SAAS,EAAE,aAAa;IACxB,QAAQ,EAAE,2BAA2B;IACrC,cAAc,EAAE,sBAAsB;IACtC,YAAY,EAAE,oBAAoB;IAClC,YAAY,EAAE,wCAAwC;IACtD,QAAQ,EAAE,YAAY;IACtB,kBAAkB,EAAE,sBAAsB;IAC1C,eAAe,EAAE,0BAA0B;IAC3C,iBAAiB,EAAE,uCAAuC;IAC1D,iBAAiB,EAAE,kBAAkB;IACrC,kBAAkB,EAAE,kBAAkB;IACtC,UAAU,EAAE,cAAc;IAC1B,UAAU,EAAE,gBAAgB;CAC7B,CAAC;AAEF,SAAS,wBAAwB,CAAC,KAAa,EAAE,IAAY;IAC3D,KAAK,MAAM,SAAS,IAAI,kBAAkB,EAAE,CAAC;QAC3C,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1B,MAAM,IAAI,YAAY,CAAC,6CAA6C,IAAI,EAAE,EAAE;gBAC1E,UAAU,EAAE;oBACV,IAAI,EAAE,iBAAiB;oBACvB,IAAI;iBACL;aACF,CAAC,CAAC;QACL,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,KAAU,EAAE,IAAI,GAAG,EAAE;IAC1C,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QAC1C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ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AAC;oBACrB,MAAM,kBAAkB,GAAQ,EAAE,CAAC;oBAEnC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;wBAC5D,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;4BAC9B,kBAAkB,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,EAAE,CAAC,CAAC;4BAEnE,mCAAmC;4BACnC,IAAI,eAAe,EAAE,CAAC;gCACpB,eAAe,CAAC,KAAK,EAAE,aAAa,GAAG,EAAE,CAAC,CAAC;4BAC7C,CAAC;wBACH,CAAC;6BAAM,CAAC;4BACN,kBAAkB,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;wBAClC,CAAC;oBACH,CAAC;oBAED,yCAAyC;oBACzC,SAAS,CAAC;wBACR,GAAG,MAAM;wBACT,SAAS,EAAE,kBAAkB;qBAC9B,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,SAAS,EAAE,CAAC;oBACd,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;gBAClD,CAAC;gBACD,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createUser.d.ts","sourceRoot":"","sources":["../../../../src/resolvers/mutations/accounts/createUser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAW9C,wBAA8B,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,oBAAoB,EAAE,OAAO,EAAE,OAAO;;;
|
|
1
|
+
{"version":3,"file":"createUser.d.ts","sourceRoot":"","sources":["../../../../src/resolvers/mutations/accounts/createUser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAW9C,wBAA8B,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,oBAAoB,EAAE,OAAO,EAAE,OAAO;;;GAyCnG"}
|
|
@@ -14,15 +14,14 @@ export default async function createUser(root, params, context) {
|
|
|
14
14
|
...params,
|
|
15
15
|
initialPassword: false,
|
|
16
16
|
}, {});
|
|
17
|
-
|
|
18
|
-
user = await context.modules.users.updateHeartbeat(user._id, {
|
|
17
|
+
const user = await context.modules.users.updateHeartbeat(newUserId, {
|
|
19
18
|
remoteAddress: context.remoteAddress,
|
|
20
19
|
remotePort: context.remotePort,
|
|
21
20
|
userAgent: context.getHeader('user-agent'),
|
|
22
|
-
locale: context.
|
|
23
|
-
countryCode: context.
|
|
21
|
+
locale: context.locale.baseName,
|
|
22
|
+
countryCode: context.countryCode,
|
|
24
23
|
});
|
|
25
|
-
await context.services.orders.nextUserCart({ user, countryCode: context.
|
|
24
|
+
await context.services.orders.nextUserCart({ user, countryCode: context.countryCode });
|
|
26
25
|
return context.login(user);
|
|
27
26
|
}
|
|
28
27
|
catch (e) {
|
|
@@ -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,EACL,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,EAC1B,4BAA4B,EAC5B,wCAAwC,EACxC,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,UAAU,CAAC,IAAW,EAAE,MAA4B,EAAE,OAAgB;IAClG,MAAM,EAA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AAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;aAClE,IAAI,CAAC,CAAC,KAAK,KAAK,kBAAkB;YACrC,MAAM,IAAI,oBAAoB,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;;YAC5D,MAAM,IAAI,wBAAwB,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;IAC/F,CAAC;AACH,CAAC"}
|
|
@@ -11,7 +11,7 @@ const impersonate = async (root, { userId }, context) => {
|
|
|
11
11
|
}
|
|
12
12
|
await context.services.orders.nextUserCart({
|
|
13
13
|
user: userToImpersonate,
|
|
14
|
-
countryCode: context.
|
|
14
|
+
countryCode: context.countryCode,
|
|
15
15
|
});
|
|
16
16
|
return context.login(userToImpersonate, {
|
|
17
17
|
impersonator: context.user,
|
|
@@ -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;AAC5C,OAAO,EAAE,2BAA2B,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGpF,MAAM,WAAW,GAAG,KAAK,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,OAAgB,EAAE,EAAE;IAC/D,GAAG,CAAC,wBAAwB,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAElE,MAAM,iBAAiB,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAE3E,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,MAAM,IAAI,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAC1C,CAAC;IAED,IAAI,CA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;QACzC,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,OAAO,CAAC,WAAW;KACjC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC,KAAK,CAAC,iBAAiB,EAAE;QACtC,YAAY,EAAE,OAAO,CAAC,IAAI;KAC3B,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loginAsGuest.d.ts","sourceRoot":"","sources":["../../../../src/resolvers/mutations/accounts/loginAsGuest.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAG9C,wBAA8B,YAAY,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO;;;
|
|
1
|
+
{"version":3,"file":"loginAsGuest.d.ts","sourceRoot":"","sources":["../../../../src/resolvers/mutations/accounts/loginAsGuest.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAG9C,wBAA8B,YAAY,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO;;;GAyB/E"}
|