@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/context.d.ts
CHANGED
|
@@ -26,12 +26,12 @@ export interface AdminUiConfig {
|
|
|
26
26
|
customProperties?: CustomAdminUiProperties[];
|
|
27
27
|
singleSignOnURL?: string;
|
|
28
28
|
}
|
|
29
|
-
export
|
|
29
|
+
export interface UnchainedHTTPServerContext {
|
|
30
30
|
setHeader: (key: string, value: string) => void;
|
|
31
31
|
getHeader: (key: string) => string;
|
|
32
32
|
remoteAddress?: string;
|
|
33
33
|
remotePort?: number;
|
|
34
|
-
}
|
|
34
|
+
}
|
|
35
35
|
export type Context = UnchainedCore & {
|
|
36
36
|
version?: string;
|
|
37
37
|
roles?: any;
|
package/lib/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAA2B,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAoB,sBAAsB,EAAE,MAAM,qBAAqB,C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AO,MAAM,yBAAyB,QAAO,wBAAmC,CAAC;AAEjF,eAAO,MAAM,yBAAyB,GAAI,YAAY,wBAAwB,SAE7E,CAAC;AAEF,MAAM,MAAM,wBAAwB,CAAC,OAAO,GAAG,GAAG,EAAE,QAAQ,GAAG,GAAG,IAAI,CACpE,MAAM,EAAE,0BAA0B,GAAG,IAAI,CAAC,oBAAoB,EAAE,MAAM,CAAC,EACvE,GAAG,CAAC,EAAE,OAAO,EACb,GAAG,CAAC,EAAE,QAAQ,KACX,OAAO,CAAC,OAAO,CAAC,CAAC;AAOtB,eAAO,MAAM,qBAAqB,GAE9B,cAAc,aAAa,EAC3B,iBAAiB,IAAI,CAAC,sBAAsB,EAAE,OAAO,GAAG,eAAe,CAAC,KACvE,wBAsCF,CAAC"}
|
package/lib/context.js
CHANGED
|
@@ -11,7 +11,7 @@ const { default: packageJson } = await import(`${import.meta.dirname}/../package
|
|
|
11
11
|
const { UNCHAINED_API_VERSION = packageJson?.version || '3.x' } = process.env;
|
|
12
12
|
export const createContextResolver = (unchainedAPI, unchainedConfig) => async ({ getHeader, setHeader, remoteAddress, remotePort, userId, impersonatorId, accessToken, login, logout, }) => {
|
|
13
13
|
const abstractHttpServerContext = { remoteAddress, remotePort, getHeader, setHeader };
|
|
14
|
-
const loaders =
|
|
14
|
+
const loaders = instantiateLoaders(unchainedAPI);
|
|
15
15
|
const localeContext = await getLocaleContext(abstractHttpServerContext, unchainedAPI);
|
|
16
16
|
const userContext = { login, logout, impersonatorId };
|
|
17
17
|
if (accessToken) {
|
package/lib/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AACA,OAAO,kBAAwC,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAA0B,MAAM,qBAAqB,CAAC;AA+C/E,IAAI,OAAO,CAAC;AAEZ,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAA6B,EA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AG,WAAW;QACd,GAAG,yBAAyB;QAC5B,OAAO;QACP,OAAO,EAAE,qBAAqB;KAC/B,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { YogaServerOptions } from 'graphql-yoga';
|
|
2
2
|
export type GraphQLServerOptions = YogaServerOptions<any, any> & {
|
|
3
|
-
typeDefs?:
|
|
4
|
-
resolvers?:
|
|
3
|
+
typeDefs?: string[];
|
|
4
|
+
resolvers?: Record<string, any>[];
|
|
5
5
|
};
|
|
6
6
|
declare const _default: (options: GraphQLServerOptions) => Promise<import("graphql-yoga").YogaServerInstance<any, any>>;
|
|
7
7
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createGraphQLServer.d.ts","sourceRoot":"","sources":["../src/createGraphQLServer.ts"],"names":[],"mappings":"AACA,OAAO,EAA4B,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAI3E,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG;IAC/D,QAAQ,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"createGraphQLServer.d.ts","sourceRoot":"","sources":["../src/createGraphQLServer.ts"],"names":[],"mappings":"AACA,OAAO,EAA4B,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAI3E,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG;IAC/D,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;CACnC,CAAC;yBAEoB,SAAS,oBAAoB;AAAnD,wBAoBE"}
|
package/lib/errors.d.ts
CHANGED
|
@@ -75,6 +75,8 @@ export declare const ProductLinkedToActiveVariationError: any;
|
|
|
75
75
|
export declare const ProductLinkedToActiveBundleError: any;
|
|
76
76
|
export declare const ProductLinkedToEnrollmentError: any;
|
|
77
77
|
export declare const ProductLinkedToQuotationError: any;
|
|
78
|
+
export declare const ProductVariationVectorAlreadySet: any;
|
|
79
|
+
export declare const ProductVariationVectorInvalid: any;
|
|
78
80
|
export declare const FileNotFoundError: any;
|
|
79
81
|
export declare const FileUploadExpiredError: any;
|
|
80
82
|
export declare const ImpersonatingAdminUserError: any;
|
package/lib/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,EAAE,SAAS,MAAM,KAAG,GAUzD,CAAC;AAEJ,eAAO,MAAM,qBAAqB,KAAkE,CAAC;AACrG,eAAO,MAAM,iBAAiB,KAAqD,CAAC;AACpF,eAAO,MAAM,oBAAoB,KAA2D,CAAC;AAE7F,eAAO,MAAM,6BAA6B,KAGzC,CAAC;AAEF,eAAO,MAAM,yBAAyB,KAGrC,CAAC;AAEF,eAAO,MAAM,0BAA0B,KAGtC,CAAC;AACF,eAAO,MAAM,uBAAuB,KAGnC,CAAC;AAEF,eAAO,MAAM,qBAAqB,KAGjC,CAAC;AAEF,eAAO,MAAM,uBAAuB,KAAiE,CAAC;AAEtG,eAAO,MAAM,6BAA6B,KAGzC,CAAC;AAEF,eAAO,MAAM,2BAA2B,KAGvC,CAAC;AAEF,eAAO,MAAM,8BAA8B,KAG1C,CAAC;AAEF,eAAO,MAAM,4BAA4B,KAGxC,CAAC;AACF,eAAO,MAAM,mBAAmB,KAAyD,CAAC;AAE1F,eAAO,MAAM,oBAAoB,KAA2D,CAAC;AAC7F,eAAO,MAAM,qBAAqB,KAA6D,CAAC;AAEhG,eAAO,MAAM,4BAA4B,KAGxC,CAAC;AAEF,eAAO,MAAM,qBAAqB,KAA6D,CAAC;AAEhG,eAAO,MAAM,iBAAiB,KAAqD,CAAC;AACpF,eAAO,MAAM,oCAAoC,KAGhD,CAAC;AAEF,eAAO,MAA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AEF,eAAO,MAAM,4BAA4B,KAGxC,CAAC;AAEF,eAAO,MAAM,oBAAoB,KAGhC,CAAC;AAEF,eAAO,MAAM,wCAAwC,KAGpD,CAAC;AAEF,eAAO,MAAM,uBAAuB,KAAoE,CAAC;AAEzG,eAAO,MAAM,sBAAsB,KAAoE,CAAC;AAExG,eAAO,MAAM,kCAAkC,KAG9C,CAAC;AAEF,eAAO,MAAM,eAAe,KAAqD,CAAC;AAElF,eAAO,MAAM,oCAAoC,KAGhD,CAAC;AAEF,eAAO,MAAM,oBAAoB,KAGhC,CAAC;AAEF,eAAO,MAAM,wBAAwB,KAGpC,CAAC;AAEF,eAAO,MAAM,mCAAmC,KAG/C,CAAC;AAEF,eAAO,MAAM,gCAAgC,KAG5C,CAAC;AAEF,eAAO,MAAM,8BAA8B,KAG1C,CAAC;AAEF,eAAO,MAAM,6BAA6B,KAGzC,CAAC;AAEF,eAAO,MAAM,gCAAgC,KAG5C,CAAC;AAEF,eAAO,MAAM,6BAA6B,KAGzC,CAAC;AAEF,eAAO,MAAM,iBAAiB,KAAqD,CAAC;AAEpF,eAAO,MAAM,sBAAsB,KAA8D,CAAC;AAElG,eAAO,MAAM,2BAA2B,KAGvC,CAAC"}
|
package/lib/errors.js
CHANGED
|
@@ -85,6 +85,8 @@ export const ProductLinkedToActiveVariationError = createError('ProductLinkedToA
|
|
|
85
85
|
export const ProductLinkedToActiveBundleError = createError('ProductLinkedToActiveBundle', 'Product is part of a active/draft bundle item, remove it from any active/draft bundle item before deleting');
|
|
86
86
|
export const ProductLinkedToEnrollmentError = createError('ProductLinkedToEnrollment', 'Product is part of a active/paused subscriptions item, remove it from any active/paused subscriptions item before deleting');
|
|
87
87
|
export const ProductLinkedToQuotationError = createError('ProductLinkedToQuotation', 'Product is part of a requested/proposed quotations item, remove it from any requested/proposed quotations item before deleting');
|
|
88
|
+
export const ProductVariationVectorAlreadySet = createError('ProductVariationVectorAlreadySet', 'Product variation vector is already set, remove the existing one before setting a new one');
|
|
89
|
+
export const ProductVariationVectorInvalid = createError('ProductVariationVectorInvalid', 'Product variation vector is invalid/incomplete');
|
|
88
90
|
export const FileNotFoundError = createError('FileNotFoundError', 'File not found');
|
|
89
91
|
export const FileUploadExpiredError = createError('FileUploadExpired', 'File upload has expired');
|
|
90
92
|
export const ImpersonatingAdminUserError = createError('ImpersonatingAdminUserError', 'Can not impersonate a admin user account');
|
package/lib/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,OAAe,EAAO,EAAE,CAChE,KAAM,SAAQ,YAAY;IACxB,YAAY,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,IAAI,EAAE;QAC/C,KAAK,CAAC,eAAe,IAAI,OAAO,EAAE;YAChC,UAAU,EAAE;gBACV,IAAI;gBACJ,GAAG,IAAI;aACR;SACF,CAAC,CAAC;IACL,CAAC;CACF,CAAC;AAEJ,MAAM,CAAC,MAAM,qBAAqB,GAAG,WAAW,CAAC,uBAAuB,EAAE,yBAAyB,CAAC,CAAC;AACrG,MAAM,CAAC,MAAM,iBAAiB,GAAG,WAAW,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;AACpF,MAAM,CAAC,MAAM,oBAAoB,GAAG,WAAW,CAAC,sBAAsB,EAAE,mBAAmB,CAAC,CAAC;AAE7F,MAAM,CAAC,MAAM,6BAA6B,GAAG,WAAW,CACtD,+BAA+B,EAC/B,6BAA6B,CAC9B,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG,WAAW,CAClD,2BAA2B,EAC3B,yBAAyB,CAC1B,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG,WAAW,CACnD,4BAA4B,EAC5B,yBAAyB,CAC1B,CAAC;AACF,MAAM,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B,GAAG,WAAW,CAAC,mBAAmB,EAAE,yBAAyB,CAAC,CAAC;AAElG,MAAM,CAAC,MAAM,2BAA2B,GAAG,WAAW,CACpD,6BAA6B,EAC7B,0CAA0C,CAC3C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createERCMetadataMiddleware.d.ts","sourceRoot":"","sources":["../../src/express/createERCMetadataMiddleware.ts"],"names":[],"mappings":"AAGA,OAAO,EAAW,cAAc,EAAE,MAAM,SAAS,CAAC;AAalD,QAAA,MAAM,qBAAqB,EAAE,
|
|
1
|
+
{"version":3,"file":"createERCMetadataMiddleware.d.ts","sourceRoot":"","sources":["../../src/express/createERCMetadataMiddleware.ts"],"names":[],"mappings":"AAGA,OAAO,EAAW,cAAc,EAAE,MAAM,SAAS,CAAC;AAalD,QAAA,MAAM,qBAAqB,EAAE,cA8C5B,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -13,17 +13,21 @@ const ercMetadataMiddleware = async (req, res) => {
|
|
|
13
13
|
if (req.method !== 'GET') {
|
|
14
14
|
return methodWrongHandler(res);
|
|
15
15
|
}
|
|
16
|
-
const { services,
|
|
16
|
+
const { services, modules, loaders, locale } = req.unchainedContext;
|
|
17
17
|
const url = new URL(req.url, ROOT_URL);
|
|
18
18
|
const parsedPath = path.parse(url.pathname);
|
|
19
19
|
if (parsedPath.ext !== '.json')
|
|
20
20
|
throw new Error('Invalid ERC Metadata URI');
|
|
21
21
|
const [, productId, localeOrTokenFilename, tokenFileName] = url.pathname.split('/');
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
productId,
|
|
25
|
-
locale,
|
|
22
|
+
const product = await loaders.productLoader.load({ productId });
|
|
23
|
+
const [token] = await modules.warehousing.findTokens({
|
|
26
24
|
chainTokenId: parsedPath.name,
|
|
25
|
+
contractAddress: product?.tokenization?.contractAddress,
|
|
26
|
+
});
|
|
27
|
+
const ercMetadata = await services.warehousing.ercMetadata({
|
|
28
|
+
product,
|
|
29
|
+
token,
|
|
30
|
+
locale: tokenFileName ? new Intl.Locale(localeOrTokenFilename) : locale,
|
|
27
31
|
});
|
|
28
32
|
if (!ercMetadata) {
|
|
29
33
|
return methodWrongHandler(res);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createERCMetadataMiddleware.js","sourceRoot":"","sources":["../../src/express/createERCMetadataMiddleware.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAIrD,MAAM,MAAM,GAAG,YAAY,CAAC,wBAAwB,CAAC,CAAC;AAEtD,MAAM,EAAE,QAAQ,GAAG,uBAAuB,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;AAE3D,MAAM,kBAAkB,GAAG,CAAC,GAAG,EAAE,EAAE;IACjC,MAAM,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACjD,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACnB,GAAG,CAAC,GAAG,EAAE,CAAC;IACV,OAAO;AACT,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAmB,KAAK,EACjD,GAA4C,EAC5C,GAAG,EACH,EAAE;IACF,IAAI,CAAC;QACH,IAAI,GAAG,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;YACzB,OAAO,kBAAkB,CAAC,GAAG,CAAC,CAAC;QACjC,CAAC;QAED,MAAM,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"createERCMetadataMiddleware.js","sourceRoot":"","sources":["../../src/express/createERCMetadataMiddleware.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAIrD,MAAM,MAAM,GAAG,YAAY,CAAC,wBAAwB,CAAC,CAAC;AAEtD,MAAM,EAAE,QAAQ,GAAG,uBAAuB,EAAE,GAAG,OAAO,CA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,WAAW,CAAC,WAAW,CAAC;YACzD,OAAO;YACP,KAAK;YACL,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,MAAM;SACxE,CAAC,CAAC;QAEH,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,OAAO,kBAAkB,CAAC,GAAG,CAAC,CAAC;QACjC,CAAC;QAED,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QACzC,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE;YACjB,gBAAgB,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC;YACzC,cAAc,EAAE,YAAY;SAC7B,CAAC,CAAC;QACH,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QACxB,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QACnB,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC5E,OAAO;IACT,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Request, Response } from 'express';
|
|
2
|
+
import { UnchainedCore } from '@unchainedshop/core';
|
|
3
|
+
export interface MCPMiddlewareOptions {
|
|
4
|
+
unchainedAPI: UnchainedCore;
|
|
5
|
+
}
|
|
6
|
+
declare const createMCPMiddleware: ({ unchainedAPI }: MCPMiddlewareOptions) => (req: Request, res: Response) => Promise<void>;
|
|
7
|
+
export default createMCPMiddleware;
|
|
8
|
+
//# sourceMappingURL=createMCPMiddleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createMCPMiddleware.d.ts","sourceRoot":"","sources":["../../src/express/createMCPMiddleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,aAAa,CAAC;CAC7B;AAED,QAAA,MAAM,mBAAmB,GAAI,kBAAkB,oBAAoB,MACnD,KAAK,OAAO,EAAE,KAAK,QAAQ,kBA6C1C,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { searchProductsWithCore, renderProductList, searchProductsTool } from '../mcp/index.js';
|
|
2
|
+
const createMCPMiddleware = ({ unchainedAPI }) => {
|
|
3
|
+
return async (req, res) => {
|
|
4
|
+
if (req.method !== 'POST') {
|
|
5
|
+
res.status(405).json({ error: 'Method not allowed' });
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
try {
|
|
9
|
+
const { method, params } = req.body;
|
|
10
|
+
if (method === 'tools/list') {
|
|
11
|
+
res.json({
|
|
12
|
+
tools: [searchProductsTool],
|
|
13
|
+
});
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (method === 'tools/call' && params?.name === 'searchProducts') {
|
|
17
|
+
const args = params.arguments || {};
|
|
18
|
+
const result = await searchProductsWithCore(unchainedAPI, args);
|
|
19
|
+
res.json({
|
|
20
|
+
content: [
|
|
21
|
+
{
|
|
22
|
+
type: 'text',
|
|
23
|
+
text: renderProductList(result),
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
});
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
res.status(400).json({ error: 'Unknown method' });
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
console.error('MCP middleware error:', error);
|
|
33
|
+
res.status(500).json({
|
|
34
|
+
content: [
|
|
35
|
+
{
|
|
36
|
+
type: 'text',
|
|
37
|
+
text: `Error: ${error.message}`,
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
isError: true,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export default createMCPMiddleware;
|
|
46
|
+
//# sourceMappingURL=createMCPMiddleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createMCPMiddleware.js","sourceRoot":"","sources":["../../src/express/createMCPMiddleware.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAMhG,MAAM,mBAAmB,GAAG,CAAC,EAAE,YAAY,EAAwB,EAAE,EAAE;IACrE,OAAO,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,EAAE;QAC3C,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;YAC1B,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,oBAAoB,EAAE,CAAC,CAAC;YACtD,OAAO;QACT,CAAC;QAED,IAAI,CAAC;YACH,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC;YAEpC,IAAI,MAAM,KAAK,YAAY,EAAE,CAAC;gBAC5B,GAAG,CAAC,IAAI,CAAC;oBACP,KAAK,EAAE,CAAC,kBAAkB,CAAC;iBAC5B,CAAC,CAAC;gBACH,OAAO;YACT,CAAC;YAED,IAAI,MAAM,KAAK,YAAY,IAAI,MAAM,EAAE,IAAI,KAAK,gBAAgB,EAAE,CAAC;gBACjE,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC;gBACpC,MAAM,MAAM,GAAG,MAAM,sBAAsB,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;gBAEhE,GAAG,CAAC,IAAI,CAAC;oBACP,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAM;4BACZ,IAAI,EAAE,iBAAiB,CAAC,MAAM,CAAC;yBAChC;qBACF;iBACF,CAAC,CAAC;gBACH,OAAO;YACT,CAAC;YAED,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC,CAAC;QACpD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC;YAC9C,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBACnB,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,UAAU,KAAK,CAAC,OAAO,EAAE;qBAChC;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/express/index.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,SAAS,CAAC;AAOxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/express/index.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,SAAS,CAAC;AAOxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAkHpD,eAAO,MAAM,OAAO,GAClB,YAAY,CAAC,CAAC,OAAO,EACrB,yBAGG;IAAE,cAAc,EAAE,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAAC,EAAE,EAAE,OAAO,CAAC,EAAE,CAAC;IAAC,YAAY,EAAE,aAAa,CAAA;CAAE,EAChG,2CAEG;IAAE,mCAAmC,CAAC,EAAE,OAAO,CAAA;CAAO,SA4D1D,CAAC"}
|
package/lib/express/index.js
CHANGED
|
@@ -34,11 +34,9 @@ const addContext = async function middlewareWithContext(req, res, next) {
|
|
|
34
34
|
const tokenObject = {
|
|
35
35
|
_id: req.sessionID,
|
|
36
36
|
userId: user._id,
|
|
37
|
-
/* eslint-disable-next-line */
|
|
38
37
|
tokenExpires: new Date(req.session?.cookie._expires),
|
|
39
38
|
};
|
|
40
39
|
await emit(API_EVENTS.API_LOGIN_TOKEN_CREATED, tokenObject);
|
|
41
|
-
/* eslint-disable-next-line */
|
|
42
40
|
user._inLoginMethodResponse = true;
|
|
43
41
|
return { user, ...tokenObject };
|
|
44
42
|
};
|
package/lib/express/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/express/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAqB,MAAM,eAAe,CAAC;AAC7E,OAAO,0BAA0B,MAAM,iCAAiC,CAAC;AACzE,OAAO,2BAA2B,MAAM,kCAAkC,CAAC;AAC3E,OAAO,OAAO,MAAM,iBAAiB,CAAC;AACtC,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAIpC,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,MAAM,wBAAwB,GAAG,CAAC,GAAc,EAAE,EAAE;IAClD,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"file":"mcpHandler.d.ts","sourceRoot":"","sources":["../../src/express/mcpHandler.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AA4DzC,QAAA,MAAM,UAAU,EAAE,cAOjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
3
|
+
import { isInitializeRequest } from '@modelcontextprotocol/sdk/types.js';
|
|
4
|
+
import createMcpServer from '../mcp/index.js';
|
|
5
|
+
// Map to store transports by session ID
|
|
6
|
+
const transports = {};
|
|
7
|
+
const handlePostRequest = async (req, res) => {
|
|
8
|
+
// Check for existing session ID
|
|
9
|
+
const sessionId = req.headers['mcp-session-id'];
|
|
10
|
+
let transport;
|
|
11
|
+
if (sessionId && transports[sessionId]) {
|
|
12
|
+
// Reuse existing transport
|
|
13
|
+
transport = transports[sessionId];
|
|
14
|
+
}
|
|
15
|
+
else if (!sessionId && isInitializeRequest(req.body)) {
|
|
16
|
+
// New initialization request
|
|
17
|
+
transport = new StreamableHTTPServerTransport({
|
|
18
|
+
sessionIdGenerator: () => randomUUID(),
|
|
19
|
+
onsessioninitialized: (sessionId) => {
|
|
20
|
+
// Store the transport by session ID
|
|
21
|
+
transports[sessionId] = transport;
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
// Clean up transport when closed
|
|
25
|
+
transport.onclose = () => {
|
|
26
|
+
if (transport.sessionId) {
|
|
27
|
+
delete transports[transport.sessionId];
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const server = createMcpServer();
|
|
31
|
+
await server.connect(transport);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
// Invalid request
|
|
35
|
+
res.status(400).json({
|
|
36
|
+
jsonrpc: '2.0',
|
|
37
|
+
error: {
|
|
38
|
+
code: -32000,
|
|
39
|
+
message: 'Bad Request: No valid session ID provided',
|
|
40
|
+
},
|
|
41
|
+
id: null,
|
|
42
|
+
});
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
// Handle the request
|
|
46
|
+
await transport.handleRequest(req, res, req.body);
|
|
47
|
+
};
|
|
48
|
+
// Reusable handler for GET and DELETE requests
|
|
49
|
+
const handleSessionRequest = async (req, res) => {
|
|
50
|
+
const sessionId = req.headers['mcp-session-id'];
|
|
51
|
+
if (!sessionId || !transports[sessionId]) {
|
|
52
|
+
res.status(400).send('Invalid or missing session ID');
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const transport = transports[sessionId];
|
|
56
|
+
await transport.handleRequest(req, res);
|
|
57
|
+
};
|
|
58
|
+
const mcpHandler = (req, res, next) => {
|
|
59
|
+
if (req.method === 'POST') {
|
|
60
|
+
return handlePostRequest(req, res, next);
|
|
61
|
+
}
|
|
62
|
+
else if (req.method === 'GET' || req.method === 'DELETE') {
|
|
63
|
+
return handleSessionRequest(req, res, next);
|
|
64
|
+
}
|
|
65
|
+
res.status(405).send('Method Not Allowed');
|
|
66
|
+
};
|
|
67
|
+
export default mcpHandler;
|
|
68
|
+
//# sourceMappingURL=mcpHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcpHandler.js","sourceRoot":"","sources":["../../src/express/mcpHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,eAAe,MAAM,iBAAiB,CAAC;AAG9C,wCAAwC;AACxC,MAAM,UAAU,GAAkD,EAAE,CAAC;AAErE,MAAM,iBAAiB,GAAmB,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;IAC3D,gCAAgC;IAChC,MAAM,SAAS,GAA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B,GAAmB,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;IAC9D,MAAM,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,gBAAgB,CAAuB,CAAC;IACtE,IAAI,CAAC,SAAS,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QACzC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;QACtD,OAAO;IACT,CAAC;IAED,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;IACxC,MAAM,SAAS,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAC1C,CAAC,CAAC;AAEF,MAAM,UAAU,GAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;IACpD,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;QAC1B,OAAO,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IAC3C,CAAC;SAAM,IAAI,GAAG,CAAC,MAAM,KAAK,KAAK,IAAI,GAAG,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC3D,OAAO,oBAAoB,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IAC9C,CAAC;IACD,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;AAC7C,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ercMetadataHandler.d.ts","sourceRoot":"","sources":["../../src/fastify/ercMetadataHandler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAY7D,QAAA,MAAM,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"ercMetadataHandler.d.ts","sourceRoot":"","sources":["../../src/fastify/ercMetadataHandler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAY7D,QAAA,MAAM,kBAAkB,EAAE,kBAqCzB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -8,16 +8,20 @@ const notFoundHandler = (res) => {
|
|
|
8
8
|
};
|
|
9
9
|
const ercMetadataHandler = async (req, res) => {
|
|
10
10
|
try {
|
|
11
|
-
const { services,
|
|
11
|
+
const { services, modules, locale, loaders } = req.unchainedContext;
|
|
12
12
|
const url = new URL(req.url, ROOT_URL);
|
|
13
13
|
if (!url.pathname.toLowerCase().endsWith('.json'))
|
|
14
14
|
throw new Error('Invalid ERC Metadata URI');
|
|
15
15
|
const { productId, localeOrTokenFilename, tokenFileName } = req.params;
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
productId,
|
|
19
|
-
locale,
|
|
16
|
+
const product = await loaders.productLoader.load({ productId });
|
|
17
|
+
const [token] = await modules.warehousing.findTokens({
|
|
20
18
|
chainTokenId: (tokenFileName || localeOrTokenFilename).toLowerCase().replace('.json', ''),
|
|
19
|
+
contractAddress: product?.tokenization?.contractAddress,
|
|
20
|
+
});
|
|
21
|
+
const ercMetadata = await services.warehousing.ercMetadata({
|
|
22
|
+
product,
|
|
23
|
+
token,
|
|
24
|
+
locale: tokenFileName ? new Intl.Locale(localeOrTokenFilename) : locale,
|
|
21
25
|
});
|
|
22
26
|
if (!ercMetadata)
|
|
23
27
|
return notFoundHandler(res);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ercMetadataHandler.js","sourceRoot":"","sources":["../../src/fastify/ercMetadataHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAIrD,MAAM,MAAM,GAAG,YAAY,CAAC,wBAAwB,CAAC,CAAC;AAEtD,MAAM,EAAE,QAAQ,GAAG,uBAAuB,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;AAE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CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IACtF,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index copy.d.ts","sourceRoot":"","sources":["../../src/fastify/index copy.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAMpD,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAkB,MAAM,SAAS,CAAC;AAgF7E,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,KAAG,iBAehD,CAAC;AAEF,eAAO,MAAM,OAAO,GAClB,SAAS,eAAe,EACxB,yBAGG;IAAE,cAAc,EAAE,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAAC,EAAE,EAAE,OAAO,CAAC,EAAE,CAAC;IAAC,YAAY,EAAE,aAAa,CAAA;CAAE,EAChG,2CAEG;IAAE,mCAAmC,CAAC,EAAE,OAAO,CAAA;CAAO,SAwF1D,CAAC"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { getCurrentContextResolver } from '../context.js';
|
|
2
|
+
import bulkImportHandler from './bulkImportHandler.js';
|
|
3
|
+
import ercMetadataHandler from './ercMetadataHandler.js';
|
|
4
|
+
import MongoStore from 'connect-mongo';
|
|
5
|
+
import { emit } from '@unchainedshop/events';
|
|
6
|
+
import { API_EVENTS } from '../events.js';
|
|
7
|
+
import fastifySession from '@fastify/session';
|
|
8
|
+
import fastifyCookie from '@fastify/cookie';
|
|
9
|
+
import { createLogger } from '@unchainedshop/logger';
|
|
10
|
+
const resolveUserRemoteAddress = (req) => {
|
|
11
|
+
const remoteAddress = req.headers['x-real-ip'] ||
|
|
12
|
+
req.headers['x-forwarded-for'] ||
|
|
13
|
+
req.socket?.remoteAddress;
|
|
14
|
+
const remotePort = req.socket?.remotePort;
|
|
15
|
+
return { remoteAddress, remotePort };
|
|
16
|
+
};
|
|
17
|
+
const { GRAPHQL_API_PATH = '/graphql', BULK_IMPORT_API_PATH = '/bulk-import', ERC_METADATA_API_PATH = '/erc-metadata/:productId/:localeOrTokenFilename/:tokenFileName?', UNCHAINED_COOKIE_NAME = 'unchained_token', UNCHAINED_COOKIE_PATH = '/', UNCHAINED_COOKIE_DOMAIN, UNCHAINED_COOKIE_SAMESITE, UNCHAINED_COOKIE_INSECURE, } = process.env;
|
|
18
|
+
const middlewareHook = async function middlewareHook(req, reply) {
|
|
19
|
+
const setHeader = (key, value) => reply.header(key, value);
|
|
20
|
+
const getHeader = (key) => req.headers[key];
|
|
21
|
+
const { remoteAddress, remotePort } = resolveUserRemoteAddress(req);
|
|
22
|
+
const context = getCurrentContextResolver();
|
|
23
|
+
const login = async function (user, options = {}) {
|
|
24
|
+
const { impersonator } = options;
|
|
25
|
+
req.session.userId = user._id;
|
|
26
|
+
req.session.impersonatorId = impersonator?._id;
|
|
27
|
+
const tokenObject = {
|
|
28
|
+
_id: req.session.sessionId,
|
|
29
|
+
userId: user._id,
|
|
30
|
+
tokenExpires: new Date(req.session.cookie._expires),
|
|
31
|
+
};
|
|
32
|
+
await emit(API_EVENTS.API_LOGIN_TOKEN_CREATED, tokenObject);
|
|
33
|
+
user._inLoginMethodResponse = true;
|
|
34
|
+
return { user, ...tokenObject };
|
|
35
|
+
};
|
|
36
|
+
const logout = async function logout() {
|
|
37
|
+
const tokenObject = {
|
|
38
|
+
_id: req.session.sessionId,
|
|
39
|
+
userId: req.session?.userId,
|
|
40
|
+
};
|
|
41
|
+
req.session.userId = null;
|
|
42
|
+
req.session.impersonatorId = null;
|
|
43
|
+
await emit(API_EVENTS.API_LOGOUT, tokenObject);
|
|
44
|
+
return true;
|
|
45
|
+
};
|
|
46
|
+
const [, accessToken] = req.headers.authorization?.split(' ') || [];
|
|
47
|
+
req.unchainedContext = await context({
|
|
48
|
+
setHeader,
|
|
49
|
+
getHeader,
|
|
50
|
+
remoteAddress,
|
|
51
|
+
remotePort,
|
|
52
|
+
login,
|
|
53
|
+
logout,
|
|
54
|
+
accessToken,
|
|
55
|
+
userId: req.session.userId,
|
|
56
|
+
impersonatorId: req.session.impersonatorId,
|
|
57
|
+
}, req, reply);
|
|
58
|
+
};
|
|
59
|
+
export const unchainedLogger = (prefix) => {
|
|
60
|
+
const logger = createLogger(prefix);
|
|
61
|
+
function Logger(...args) {
|
|
62
|
+
this.args = args;
|
|
63
|
+
}
|
|
64
|
+
Logger.prototype.info = logger.info;
|
|
65
|
+
Logger.prototype.error = logger.error;
|
|
66
|
+
Logger.prototype.debug = logger.debug;
|
|
67
|
+
Logger.prototype.fatal = logger.error;
|
|
68
|
+
Logger.prototype.warn = logger.warn;
|
|
69
|
+
Logger.prototype.trace = logger.trace;
|
|
70
|
+
Logger.prototype.child = function () {
|
|
71
|
+
return new Logger();
|
|
72
|
+
};
|
|
73
|
+
return new Logger();
|
|
74
|
+
};
|
|
75
|
+
export const connect = (fastify, { graphqlHandler, db, }, { allowRemoteToLocalhostSecureCookies = false, } = {}) => {
|
|
76
|
+
if (allowRemoteToLocalhostSecureCookies) {
|
|
77
|
+
// Workaround: Allow to use sandbox with localhost
|
|
78
|
+
// https://github.com/fastify/fastify-cookie/issues/308
|
|
79
|
+
fastify.addHook('preHandler', async function (request) {
|
|
80
|
+
request.headers['x-forwarded-proto'] = 'https';
|
|
81
|
+
});
|
|
82
|
+
fastify.addHook('onSend', async function (_, reply) {
|
|
83
|
+
reply.headers({
|
|
84
|
+
'Access-Control-Allow-Private-Network': 'true',
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
const cookieName = UNCHAINED_COOKIE_NAME;
|
|
89
|
+
const domain = UNCHAINED_COOKIE_DOMAIN;
|
|
90
|
+
const path = UNCHAINED_COOKIE_PATH;
|
|
91
|
+
const secure = UNCHAINED_COOKIE_INSECURE ? false : true;
|
|
92
|
+
const sameSite = ({
|
|
93
|
+
none: 'none',
|
|
94
|
+
lax: 'lax',
|
|
95
|
+
strict: 'strict',
|
|
96
|
+
'1': true,
|
|
97
|
+
'0': false,
|
|
98
|
+
}[UNCHAINED_COOKIE_SAMESITE?.trim()?.toLowerCase()] || false);
|
|
99
|
+
if (!fastify.hasPlugin('@fastify/cookie')) {
|
|
100
|
+
fastify.register(fastifyCookie);
|
|
101
|
+
}
|
|
102
|
+
fastify.register(fastifySession, {
|
|
103
|
+
secret: process.env.UNCHAINED_TOKEN_SECRET,
|
|
104
|
+
cookieName,
|
|
105
|
+
store: MongoStore.create({
|
|
106
|
+
client: db.client,
|
|
107
|
+
dbName: db.databaseName,
|
|
108
|
+
collectionName: 'sessions',
|
|
109
|
+
}),
|
|
110
|
+
cookie: {
|
|
111
|
+
domain,
|
|
112
|
+
httpOnly: true,
|
|
113
|
+
path,
|
|
114
|
+
secure,
|
|
115
|
+
sameSite,
|
|
116
|
+
maxAge: 1000 * 60 * 60 * 24 * 7,
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
fastify.decorateRequest('unchainedContext');
|
|
120
|
+
fastify.addHook('onRequest', middlewareHook);
|
|
121
|
+
fastify.route({
|
|
122
|
+
url: GRAPHQL_API_PATH,
|
|
123
|
+
method: ['GET', 'POST', 'OPTIONS'],
|
|
124
|
+
handler: async (req, reply) => {
|
|
125
|
+
// Second parameter adds Fastify's `req` and `reply` to the GraphQL Context
|
|
126
|
+
const response = await graphqlHandler.handleNodeRequestAndResponse(req, reply, {
|
|
127
|
+
req,
|
|
128
|
+
reply,
|
|
129
|
+
});
|
|
130
|
+
response.headers.forEach((value, key) => {
|
|
131
|
+
reply.header(key, value);
|
|
132
|
+
});
|
|
133
|
+
reply.status(response.status);
|
|
134
|
+
reply.send(response.body);
|
|
135
|
+
return reply;
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
fastify.route({
|
|
139
|
+
url: ERC_METADATA_API_PATH,
|
|
140
|
+
method: ['GET'],
|
|
141
|
+
handler: ercMetadataHandler,
|
|
142
|
+
});
|
|
143
|
+
fastify.register((s, opts, registered) => {
|
|
144
|
+
s.removeAllContentTypeParsers();
|
|
145
|
+
s.addContentTypeParser('*', function (req, payload, done) {
|
|
146
|
+
done(null);
|
|
147
|
+
});
|
|
148
|
+
s.route({
|
|
149
|
+
url: BULK_IMPORT_API_PATH,
|
|
150
|
+
method: ['POST'],
|
|
151
|
+
bodyLimit: 1024 * 1024 * 1024 * 5, // 5GB
|
|
152
|
+
handler: bulkImportHandler,
|
|
153
|
+
});
|
|
154
|
+
registered();
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
//# sourceMappingURL=index%20copy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index copy.js","sourceRoot":"","sources":["../../src/fastify/index copy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAqB,MAAM,eAAe,CAAC;AAC7E,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AACvD,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AACzD,OAAO,UAAU,MAAM,eAAe,CAAC;AAIvC,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,MAAM,wBAAwB,GAAG,CAAC,GAAmB,EAAE,EAAE;IACvD,MAAM,aAAa,GAChB,GAAG,CAAC,OAAO,CAAC,WAAW,CAAY;QACnC,GAAG,CAAC,OAAO,CAAC,iBA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AAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAMpD,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAkB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fastify/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAMpD,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAkB,MAAM,SAAS,CAAC;AAgF7E,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,KAAG,iBAehD,CAAC;AAEF,eAAO,MAAM,OAAO,GAClB,SAAS,eAAe,EACxB,yBAGG;IAAE,cAAc,EAAE,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAAC,EAAE,EAAE,OAAO,CAAC,EAAE,CAAC;IAAC,YAAY,EAAE,aAAa,CAAA;CAAE,EAChG,2CAEG;IAAE,mCAAmC,CAAC,EAAE,OAAO,CAAA;CAAO,SAwF1D,CAAC"}
|
package/lib/fastify/index.js
CHANGED
|
@@ -27,16 +27,13 @@ const middlewareHook = async function middlewareHook(req, reply) {
|
|
|
27
27
|
const tokenObject = {
|
|
28
28
|
_id: req.session.sessionId,
|
|
29
29
|
userId: user._id,
|
|
30
|
-
// eslint-disable-next-line
|
|
31
30
|
tokenExpires: new Date(req.session.cookie._expires),
|
|
32
31
|
};
|
|
33
32
|
await emit(API_EVENTS.API_LOGIN_TOKEN_CREATED, tokenObject);
|
|
34
|
-
/* eslint-disable-next-line */
|
|
35
33
|
user._inLoginMethodResponse = true;
|
|
36
34
|
return { user, ...tokenObject };
|
|
37
35
|
};
|
|
38
36
|
const logout = async function logout() {
|
|
39
|
-
/* eslint-disable-line */
|
|
40
37
|
const tokenObject = {
|
|
41
38
|
_id: req.session.sessionId,
|
|
42
39
|
userId: req.session?.userId,
|