@unchainedshop/api 3.1.13 → 4.0.0-rc.3
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/api-index.d.ts.map +1 -1
- package/lib/api-index.js +4 -1
- package/lib/api-index.js.map +1 -1
- 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 -1
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +2 -1
- package/lib/errors.js.map +1 -1
- package/lib/express/createBulkImportMiddleware copy.d.ts +6 -0
- package/lib/express/createBulkImportMiddleware copy.d.ts.map +1 -0
- package/lib/express/createBulkImportMiddleware copy.js +49 -0
- package/lib/express/createBulkImportMiddleware copy.js.map +1 -0
- 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.map +1 -1
- package/lib/express/createMCPMiddleware.js +12 -3
- package/lib/express/createMCPMiddleware.js.map +1 -1
- package/lib/express/createTempUploadMiddleware.d.ts +7 -0
- package/lib/express/createTempUploadMiddleware.d.ts.map +1 -0
- package/lib/express/createTempUploadMiddleware.js +48 -0
- package/lib/express/createTempUploadMiddleware.js.map +1 -0
- package/lib/express/index.d.ts.map +1 -1
- package/lib/express/index.js +17 -6
- package/lib/express/index.js.map +1 -1
- package/lib/express/setupMCPChatHandler.d.ts +3 -0
- package/lib/express/setupMCPChatHandler.d.ts.map +1 -0
- package/lib/express/setupMCPChatHandler.js +57 -0
- package/lib/express/setupMCPChatHandler.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.d.ts.map +1 -1
- package/lib/fastify/index.js +24 -5
- package/lib/fastify/index.js.map +1 -1
- package/lib/fastify/mcpChatHandler.d.ts +3 -0
- package/lib/fastify/mcpChatHandler.d.ts.map +1 -0
- package/lib/fastify/mcpChatHandler.js +60 -0
- package/lib/fastify/mcpChatHandler.js.map +1 -0
- package/lib/fastify/mcpHandler copy.d.ts +4 -0
- package/lib/fastify/mcpHandler copy.d.ts.map +1 -0
- package/lib/fastify/mcpHandler copy.js +72 -0
- package/lib/fastify/mcpHandler copy.js.map +1 -0
- package/lib/fastify/mcpHandler.d.ts +4 -0
- package/lib/fastify/mcpHandler.d.ts.map +1 -0
- package/lib/fastify/mcpHandler.js +78 -0
- package/lib/fastify/mcpHandler.js.map +1 -0
- package/lib/fastify/tempUploadHandler.d.ts +4 -0
- package/lib/fastify/tempUploadHandler.d.ts.map +1 -0
- package/lib/fastify/tempUploadHandler.js +41 -0
- package/lib/fastify/tempUploadHandler.js.map +1 -0
- package/lib/loaders/buildLocaleMap.d.ts +4 -4
- package/lib/loaders/buildLocaleMap.d.ts.map +1 -1
- package/lib/loaders/buildLocaleMap.js +34 -5
- package/lib/loaders/buildLocaleMap.js.map +1 -1
- package/lib/loaders/buildTextMap.d.ts +2 -2
- package/lib/loaders/buildTextMap.d.ts.map +1 -1
- package/lib/loaders/buildTextMap.js +3 -0
- package/lib/loaders/buildTextMap.js.map +1 -1
- package/lib/loaders/index.d.ts +79 -49
- package/lib/loaders/index.d.ts.map +1 -1
- package/lib/loaders/index.js +47 -240
- package/lib/loaders/index.js.map +1 -1
- 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 +1 -1
- package/lib/mcp/index.d.ts.map +1 -1
- package/lib/mcp/index.js +38 -2
- package/lib/mcp/index.js.map +1 -1
- package/lib/mcp/tools/addProductAssignmentHandler.js.map +1 -1
- package/lib/mcp/tools/addProductMediaUploadHandler.d.ts +28 -0
- package/lib/mcp/tools/addProductMediaUploadHandler.d.ts.map +1 -0
- package/lib/mcp/tools/addProductMediaUploadHandler.js +62 -0
- package/lib/mcp/tools/addProductMediaUploadHandler.js.map +1 -0
- package/lib/mcp/tools/createLanguageHandler.d.ts +36 -0
- package/lib/mcp/tools/createLanguageHandler.d.ts.map +1 -0
- package/lib/mcp/tools/createLanguageHandler.js +39 -0
- package/lib/mcp/tools/createLanguageHandler.js.map +1 -0
- package/lib/mcp/tools/createProductVariationHandler.d.ts +2 -2
- package/lib/mcp/tools/createProductVariationHandler.d.ts.map +1 -1
- package/lib/mcp/tools/createProductVariationHandler.js +10 -4
- package/lib/mcp/tools/createProductVariationHandler.js.map +1 -1
- package/lib/mcp/tools/createProductVariationOptionHandler.d.ts +60 -0
- package/lib/mcp/tools/createProductVariationOptionHandler.d.ts.map +1 -0
- package/lib/mcp/tools/createProductVariationOptionHandler.js +59 -0
- package/lib/mcp/tools/createProductVariationOptionHandler.js.map +1 -0
- package/lib/mcp/tools/getProduct.d.ts.map +1 -1
- package/lib/mcp/tools/getProduct.js +2 -45
- package/lib/mcp/tools/getProduct.js.map +1 -1
- package/lib/mcp/tools/index.d.ts +33 -0
- package/lib/mcp/tools/index.d.ts.map +1 -1
- package/lib/mcp/tools/index.js +33 -0
- package/lib/mcp/tools/index.js.map +1 -1
- package/lib/mcp/tools/listProducts.d.ts.map +1 -1
- package/lib/mcp/tools/listProducts.js +29 -17
- package/lib/mcp/tools/listProducts.js.map +1 -1
- package/lib/mcp/tools/productReviewsCountHandler.d.ts +20 -0
- package/lib/mcp/tools/productReviewsCountHandler.d.ts.map +1 -0
- package/lib/mcp/tools/productReviewsCountHandler.js +30 -0
- package/lib/mcp/tools/productReviewsCountHandler.js.map +1 -0
- package/lib/mcp/tools/productReviewsHandler.d.ts +56 -0
- package/lib/mcp/tools/productReviewsHandler.d.ts.map +1 -0
- package/lib/mcp/tools/productReviewsHandler.js +45 -0
- package/lib/mcp/tools/productReviewsHandler.js.map +1 -0
- package/lib/mcp/tools/removeLanguageHandler.d.ts +20 -0
- package/lib/mcp/tools/removeLanguageHandler.d.ts.map +1 -0
- package/lib/mcp/tools/removeLanguageHandler.js +35 -0
- package/lib/mcp/tools/removeLanguageHandler.js.map +1 -0
- package/lib/mcp/tools/removeProductAssignmentHandler.d.ts +48 -0
- package/lib/mcp/tools/removeProductAssignmentHandler.d.ts.map +1 -0
- package/lib/mcp/tools/removeProductAssignmentHandler.js +51 -0
- package/lib/mcp/tools/removeProductAssignmentHandler.js.map +1 -0
- package/lib/mcp/tools/removeProductHandler.d.ts +20 -0
- package/lib/mcp/tools/removeProductHandler.d.ts.map +1 -0
- package/lib/mcp/tools/removeProductHandler.js +34 -0
- package/lib/mcp/tools/removeProductHandler.js.map +1 -0
- package/lib/mcp/tools/removeProductMediaHandler.d.ts +20 -0
- package/lib/mcp/tools/removeProductMediaHandler.d.ts.map +1 -0
- package/lib/mcp/tools/removeProductMediaHandler.js +42 -0
- package/lib/mcp/tools/removeProductMediaHandler.js.map +1 -0
- package/lib/mcp/tools/removeProductVariationOptionHandler.d.ts +24 -0
- package/lib/mcp/tools/removeProductVariationOptionHandler.d.ts.map +1 -0
- package/lib/mcp/tools/removeProductVariationOptionHandler.js +47 -0
- package/lib/mcp/tools/removeProductVariationOptionHandler.js.map +1 -0
- package/lib/mcp/tools/reorderProductMediaHandler.d.ts +44 -0
- package/lib/mcp/tools/reorderProductMediaHandler.d.ts.map +1 -0
- package/lib/mcp/tools/reorderProductMediaHandler.js +39 -0
- package/lib/mcp/tools/reorderProductMediaHandler.js.map +1 -0
- package/lib/mcp/tools/updateLanguageHandler.d.ts +48 -0
- package/lib/mcp/tools/updateLanguageHandler.d.ts.map +1 -0
- package/lib/mcp/tools/updateLanguageHandler.js +40 -0
- package/lib/mcp/tools/updateLanguageHandler.js.map +1 -0
- package/lib/mcp/tools/updateProductMediaTextsHandler.d.ts +56 -0
- package/lib/mcp/tools/updateProductMediaTextsHandler.d.ts.map +1 -0
- package/lib/mcp/tools/updateProductMediaTextsHandler.js +45 -0
- package/lib/mcp/tools/updateProductMediaTextsHandler.js.map +1 -0
- package/lib/mcp/utils/getNormalizedProductDetails.d.ts.map +1 -1
- package/lib/mcp/utils/getNormalizedProductDetails.js +2 -0
- package/lib/mcp/utils/getNormalizedProductDetails.js.map +1 -1
- 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.d.ts.map +1 -1
- package/lib/resolvers/queries/filters/searchAssortments.js +2 -7
- package/lib/resolvers/queries/filters/searchAssortments.js.map +1 -1
- package/lib/resolvers/queries/filters/searchProducts.d.ts.map +1 -1
- package/lib/resolvers/queries/filters/searchProducts.js +3 -8
- 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.js +1 -1
- package/lib/roles/all.js.map +1 -1
- package/lib/roles/index.d.ts.map +1 -1
- package/lib/roles/index.js +1 -0
- package/lib/roles/index.js.map +1 -1
- package/lib/roles/loggedIn.d.ts.map +1 -1
- package/lib/roles/loggedIn.js +1 -0
- package/lib/roles/loggedIn.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/package.json +32 -16
- package/src/api-index.ts +4 -1
- package/src/context.ts +3 -3
- package/src/createGraphQLServer.ts +2 -2
- package/src/errors.ts +10 -4
- package/src/express/createERCMetadataMiddleware.ts +11 -5
- package/src/express/createMCPMiddleware.ts +91 -0
- package/src/express/createTempUploadMiddleware.ts +60 -0
- package/src/express/index.ts +37 -9
- package/src/fastify/ercMetadataHandler.ts +11 -5
- package/src/fastify/index.ts +34 -5
- package/src/fastify/mcpHandler.ts +97 -0
- package/src/fastify/tempUploadHandler.ts +52 -0
- 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/buildLocaleMap.test.ts +9 -5
- package/src/loaders/buildLocaleMap.ts +43 -9
- package/src/loaders/buildTextMap.ts +4 -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 -329
- 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/mcp/README.md +25 -0
- package/src/mcp/index.ts +313 -0
- package/src/mcp/tools/addProductAssignmentHandler.ts +118 -0
- package/src/mcp/tools/addProductMediaUploadHandler.ts +79 -0
- package/src/mcp/tools/countriesHandler.ts +60 -0
- package/src/mcp/tools/countryHandler.ts +40 -0
- package/src/mcp/tools/createLanguageHandler.ts +46 -0
- package/src/mcp/tools/createProduct.ts +75 -0
- package/src/mcp/tools/createProductVariationHandler.ts +93 -0
- package/src/mcp/tools/createProductVariationOptionHandler.ts +73 -0
- package/src/mcp/tools/currenciesHandler.ts +63 -0
- package/src/mcp/tools/currencyHandler.ts +40 -0
- package/src/mcp/tools/getProduct.ts +74 -0
- package/src/mcp/tools/index.ts +39 -0
- package/src/mcp/tools/languageHandler.ts +37 -0
- package/src/mcp/tools/languagesHandler.ts +54 -0
- package/src/mcp/tools/listProducts.ts +148 -0
- package/src/mcp/tools/productReviewsCountHandler.ts +36 -0
- package/src/mcp/tools/productReviewsHandler.ts +54 -0
- package/src/mcp/tools/productsCountHandler.ts +38 -0
- package/src/mcp/tools/publishProduct.ts +45 -0
- package/src/mcp/tools/removeLanguageHandler.ts +42 -0
- package/src/mcp/tools/removeProductAssignmentHandler.ts +61 -0
- package/src/mcp/tools/removeProductHandler.ts +40 -0
- package/src/mcp/tools/removeProductMediaHandler.ts +49 -0
- package/src/mcp/tools/removeProductVariationHandler.ts +51 -0
- package/src/mcp/tools/removeProductVariationOptionHandler.ts +58 -0
- package/src/mcp/tools/reorderProductMediaHandler.ts +48 -0
- package/src/mcp/tools/unPublishProduct.ts +46 -0
- package/src/mcp/tools/updateLanguageHandler.ts +47 -0
- package/src/mcp/tools/updateProduct.ts +51 -0
- package/src/mcp/tools/updateProductCommerceHandler.ts +79 -0
- package/src/mcp/tools/updateProductMediaTextsHandler.ts +56 -0
- package/src/mcp/tools/updateProductPlanHandler.ts +58 -0
- package/src/mcp/tools/updateProductSupplyHandler.ts +59 -0
- package/src/mcp/tools/updateProductTextsHandler.ts +59 -0
- package/src/mcp/tools/updateProductTokenizationHandler.ts +58 -0
- package/src/mcp/tools/updateProductWarehousingHandler.ts +54 -0
- package/src/mcp/utils/getNormalizedProductDetails.ts +42 -0
- package/src/mcp/utils/normalizeMediaUrl.ts +26 -0
- 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 +45 -2
- 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 -7
- package/src/resolvers/queries/filters/searchProducts.ts +3 -8
- 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 +1 -1
- package/src/roles/index.ts +1 -0
- package/src/roles/loggedIn.ts +1 -0
- 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/api-index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-index.d.ts","sourceRoot":"","sources":["../src/api-index.ts"],"names":[],"mappings":"AAAA,OAA4B,EAAE,oBAAoB,EAAE,MAAM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AAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,CAAC;AAMvF,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,YAAY,EAAE,aAAa,CAAC;IAC5B,OAAO,CAAC,EAAE,CAAC,eAAe,EAAE,wBAAwB,KAAK,wBAAwB,CAAC;CACnF,GAAG,oBAAoB,CAAC;AAEzB,eAAO,MAAM,cAAc,GAAU,SAAS,sBAAsB,iEAkCnE,CAAC"}
|
package/lib/api-index.js
CHANGED
|
@@ -13,7 +13,10 @@ import resolvers from './resolvers/index.js';
|
|
|
13
13
|
import { actions } from './roles/index.js';
|
|
14
14
|
export const startAPIServer = async (options) => {
|
|
15
15
|
const { unchainedAPI, context: customContext, roles, adminUiConfig = {}, typeDefs: additionalTypeDefs = [], resolvers: additionalResolvers = [], ...serverOptions } = options || {};
|
|
16
|
-
const contextResolver = createContextResolver(unchainedAPI, {
|
|
16
|
+
const contextResolver = createContextResolver(unchainedAPI, {
|
|
17
|
+
roles,
|
|
18
|
+
adminUiConfig,
|
|
19
|
+
});
|
|
17
20
|
setCurrentContextResolver(customContext
|
|
18
21
|
? (props, ...rest) => {
|
|
19
22
|
return customContext(contextResolver)(props, ...rest);
|
package/lib/api-index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-index.js","sourceRoot":"","sources":["../src/api-index.ts"],"names":[],"mappings":"AAAA,OAAO,mBAA6C,MAAM,0BAA0B,CAAC;AACrF,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,yBAAyB,GAG1B,MAAM,cAAc,CAAC;AAEtB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,GAAG,MAAM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S3C,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EAAE,OAA+B,EAAE,EAAE;IACtE,MAAM,EACJ,YAAY,EACZ,OAAO,EAAE,aAAa,EACtB,KAAK,EACL,aAAa,GAAG,EAAE,EAClB,QAAQ,EAAE,kBAAkB,GAAG,EAAE,EACjC,SAAS,EAAE,mBAAmB,GAAG,EAAE,EACnC,GAAG,aAAa,EACjB,GAAG,OAAO,IAAI,EAAE,CAAC;IAElB,MAAM,eAAe,GAAG,qBAAqB,CAAC,YAAY,EAAE;QAC1D,KAAK;QACL,aAAa;KACd,CAAC,CAAC;IAEH,yBAAyB,CACvB,aAAa;QACX,CAAC,CAAC,CAAC,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE;YACjB,OAAO,aAAa,CAAC,eAAe,CAAC,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;QACxD,CAAC;QACH,CAAC,CAAC,eAAe,CACpB,CAAC;IAEF,OAAO,mBAAmB,CAAC;QACzB,QAAQ,EAAE;YACR,GAAG,oBAAoB,CAAC;gBACtB,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;aAC9B,CAAC;YACF,GAAG,kBAAkB;SACtB;QACD,SAAS,EAAE,CAAC,SAAS,EAAE,GAAG,mBAAmB,CAAC;QAC9C,GAAG,aAAa;KACjB,CAAC,CAAC;AACL,CAAC,CAAC"}
|
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,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAEjD,MAAM,MAAM,OAAO,GAAG,CACpB,IAAI,EAAE,IAAI,EACV,OAAO,CAAC,EAAE;IACR,YAAY,CAAC,EAAE,IAAI,CAAC;CACrB,KACE,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,IAAI,CAAA;CAAE,CAAC,CAAC;AAElD,MAAM,MAAM,QAAQ,GAAG,CAAC,SAAS,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAChE,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,QAAQ,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,IAAI,CAAC;CACb;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,gBAAgB,CAAC,EAAE,uBAAuB,EAAE,CAAC;IAC7C,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.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AM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,OAAO,GAAG,aAAa,GAAG;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,OAAO,EAAE,gBAAgB,CAAC;CAC3B,GAAG,oBAAoB,GACtB,sBAAsB,GACtB,0BAA0B,CAAC;AAI7B,eAAO,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,EAAE,CAAC,OAAO,CAAC;AAEjF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,UAAoC,EAAE,EAAE;IAChF,OAAO,GAAG,UAAU,CAAC;AACvB,CAAC,CAAC;AAQF,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,MAAM,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,kBAAkB,EAAE;IACtF,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;CACvB,CAAC,CAAC;AACH,MAAM,EAAE,qBAAqB,GAAG,WAAW,EAAE,OAAO,IAAI,KAAK,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;AAE9E,MAAM,CAAC,MAAM,qBAAqB,GAChC,CACE,YAA2B,EAC3B,eAAwE,EAC9C,EAAE,CAC9B,KAAK,EAAE,EACL,SAAS,EACT,SAAS,EACT,aAAa,EACb,UAAU,EACV,MAAM,EACN,cAAc,EACd,WAAW,EACX,KAAK,EACL,MAAM,GACP,EAAE,EAAE;IACH,MAAM,yBAAyB,GAAG,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;IACtF,MAAM,OAAO,GAAG,
|
|
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;AA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C;IACH,CAAC;IACD,IAAI,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;QAClC,WAAW,CAAC,IAAI,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QACzE,WAAW,CAAC,MAAM,GAAG,MAAM,CAAC;IAC9B,CAAC;IAED,OAAO;QACL,GAAG,YAAY;QACf,GAAG,eAAe;QAClB,GAAG,aAAa;QAChB,GAAG,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
|
@@ -46,7 +46,6 @@ export declare const QuotationNotFoundError: any;
|
|
|
46
46
|
export declare const BookmarkAlreadyExistsError: any;
|
|
47
47
|
export declare const BookmarkNotFoundError: any;
|
|
48
48
|
export declare const MultipleBookmarksFound: any;
|
|
49
|
-
export declare const QueryStringRequiredError: any;
|
|
50
49
|
export declare const PaymentProviderNotFoundError: any;
|
|
51
50
|
export declare const WorkNotFoundOrWrongStatus: any;
|
|
52
51
|
export declare const WorkNotFoundError: any;
|
|
@@ -76,6 +75,8 @@ export declare const ProductLinkedToActiveVariationError: any;
|
|
|
76
75
|
export declare const ProductLinkedToActiveBundleError: any;
|
|
77
76
|
export declare const ProductLinkedToEnrollmentError: any;
|
|
78
77
|
export declare const ProductLinkedToQuotationError: any;
|
|
78
|
+
export declare const ProductVariationVectorAlreadySet: any;
|
|
79
|
+
export declare const ProductVariationVectorInvalid: any;
|
|
79
80
|
export declare const FileNotFoundError: any;
|
|
80
81
|
export declare const FileUploadExpiredError: any;
|
|
81
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,M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,iBAAiB,KAAqD,CAAC;AAEpF,eAAO,MAAM,sBAAsB,KAA8D,CAAC;AAElG,eAAO,MAAM,2BAA2B,KAGvC,CAAC"}
|
package/lib/errors.js
CHANGED
|
@@ -56,7 +56,6 @@ export const QuotationNotFoundError = createError('QuotationNotFoundError', 'Quo
|
|
|
56
56
|
export const BookmarkAlreadyExistsError = createError('BookmarkAlreadyExistsError', 'Bookmark already exists');
|
|
57
57
|
export const BookmarkNotFoundError = createError('BookmarkNotFoundError', 'Bookmark not found');
|
|
58
58
|
export const MultipleBookmarksFound = createError('MultipleBookmarksFound', 'The convenience bookmark mutation cannot be used because multiple bookmarks were explicitly created with different metadata');
|
|
59
|
-
export const QueryStringRequiredError = createError('QueryStringRequiredError', 'Query string is required when no assortments are in scope');
|
|
60
59
|
export const PaymentProviderNotFoundError = createError('PaymentProviderNotFoundError', 'Payment provider not found');
|
|
61
60
|
export const WorkNotFoundOrWrongStatus = createError('WorkNotFoundOrWrongStatus', 'Could not find work or no work with the correct status');
|
|
62
61
|
export const WorkNotFoundError = createError('WorkNotFoundError', 'Work not found');
|
|
@@ -86,6 +85,8 @@ export const ProductLinkedToActiveVariationError = createError('ProductLinkedToA
|
|
|
86
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');
|
|
87
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');
|
|
88
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');
|
|
89
90
|
export const FileNotFoundError = createError('FileNotFoundError', 'File not found');
|
|
90
91
|
export const FileUploadExpiredError = createError('FileUploadExpired', 'File upload has expired');
|
|
91
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,CAAC,MAAM,uBAAuB,GAAG,WAAW,CAChD,yBAAyB,EACzB,iEAAiE,CAClE,CAAC;AAEF,MAAM,CAAC,MAAM,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WAAW,CAC7D,iCAAiC,EACjC,sDAAsD,CACvD,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,WAAW,CAC7C,sBAAsB,EACtB,8CAA8C,CAC/C,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,WAAW,CACjD,qBAAqB,EACrB,8EAA8E,CAC/E,CAAC;AAEF,MAAM,CAAC,MAAM,mCAAmC,GAAG,WAAW,CAC5D,gCAAgC,EAChC,kGAAkG,CACnG,CAAC;AAEF,MAAM,CAAC,MAAM,gCAAgC,GAAG,WAAW,CACzD,6BAA6B,EAC7B,4GAA4G,CAC7G,CAAC;AAEF,MAAM,CAAC,MAAM,8BAA8B,GAAG,WAAW,CACvD,2BAA2B,EAC3B,4HAA4H,CAC7H,CAAC;AAEF,MAAM,CAAC,MAAM,6BAA6B,GAAG,WAAW,CACtD,0BAA0B,EAC1B,gIAAgI,CACjI,CAAC;AAEF,MAAM,CAAC,MAAM,gCAAgC,GAAG,WAAW,CACzD,kCAAkC,EAClC,2FAA2F,CAC5F,CAAC;AAEF,MAAM,CAAC,MAAM,6BAA6B,GAAG,WAAW,CACtD,+BAA+B,EAC/B,gDAAgD,CACjD,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,WAAW,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;AAEpF,MAAM,CAAC,MAAM,sBAAsB,GAAG,WAAW,CAAC,mBAAmB,EAAE,yBAAyB,CAAC,CAAC;AAElG,MAAM,CAAC,MAAM,2BAA2B,GAAG,WAAW,CACpD,6BAA6B,EAC7B,0CAA0C,CAC3C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createBulkImportMiddleware copy.d.ts","sourceRoot":"","sources":["../../src/express/createBulkImportMiddleware copy.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAWxC,wBAA8B,oBAAoB,CAChD,GAAG,EAAE,OAAO,GAAG;IAAE,KAAK,CAAC,EAAE,GAAG,CAAC;IAAC,gBAAgB,EAAE,OAAO,CAAA;CAAE,EACzD,GAAG,KAAA,iBA8CJ"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { createLogger } from '@unchainedshop/logger';
|
|
2
|
+
import { checkAction } from '../acl.js';
|
|
3
|
+
import { actions } from '../roles/index.js';
|
|
4
|
+
const logger = createLogger('unchained:bulk-import');
|
|
5
|
+
const methodWrongHandler = (res) => {
|
|
6
|
+
logger.error('Method not supported, return 404');
|
|
7
|
+
res.writeHead(404);
|
|
8
|
+
res.end();
|
|
9
|
+
return;
|
|
10
|
+
};
|
|
11
|
+
export default async function bulkImportMiddleware(req, res) {
|
|
12
|
+
try {
|
|
13
|
+
const context = req.unchainedContext;
|
|
14
|
+
if (req.method !== 'POST') {
|
|
15
|
+
return methodWrongHandler(res);
|
|
16
|
+
}
|
|
17
|
+
await checkAction(context, actions.bulkImport);
|
|
18
|
+
const input = {
|
|
19
|
+
createShouldUpsertIfIDExists: !!req.query?.createShouldUpsertIfIDExists,
|
|
20
|
+
updateShouldUpsertIfIDNotExists: !!req.query?.updateShouldUpsertIfIDNotExists,
|
|
21
|
+
skipCacheInvalidation: !!req.query?.skipCacheInvalidation,
|
|
22
|
+
remoteAddress: context.remoteAddress,
|
|
23
|
+
};
|
|
24
|
+
const date = new Date().toISOString();
|
|
25
|
+
const file = await context.services.files.uploadFileFromStream({
|
|
26
|
+
directoryName: 'bulk-import-streams',
|
|
27
|
+
rawFile: Promise.resolve({ filename: `${date}.json`, createReadStream: () => req }),
|
|
28
|
+
meta: {},
|
|
29
|
+
});
|
|
30
|
+
input.payloadId = file._id;
|
|
31
|
+
input.payloadSize = file.size;
|
|
32
|
+
const purgedInput = Object.fromEntries(Object.entries(input).filter(([, value]) => Boolean(value)));
|
|
33
|
+
const work = await context.modules.worker.addWork({
|
|
34
|
+
type: 'BULK_IMPORT',
|
|
35
|
+
input: purgedInput,
|
|
36
|
+
retries: 0,
|
|
37
|
+
priority: 10,
|
|
38
|
+
});
|
|
39
|
+
res.writeHead(200);
|
|
40
|
+
res.end(JSON.stringify(work));
|
|
41
|
+
}
|
|
42
|
+
catch (e) {
|
|
43
|
+
logger.error(e.message);
|
|
44
|
+
res.writeHead(503);
|
|
45
|
+
res.end(JSON.stringify({ name: e.name, code: e.code, message: e.message }));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=createBulkImportMiddleware%20copy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createBulkImportMiddleware copy.js","sourceRoot":"","sources":["../../src/express/createBulkImportMiddleware copy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,MAAM,MAAM,GAAG,YAAY,CAAC,uBAAuB,CAAC,CAAC;AAErD,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,CAAC,OAAO,CAAC,KAAK,UAAU,oBAAoB,CAChD,GAAyD,EACzD,GAAG;IAEH,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,GAAG,CAAC,gBAAgB,CAAC;QAErC,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;YAC1B,OAAO,kBAAkB,CAAC,GAAG,CAAC,CAAC;QACjC,CAAC;QAED,MAAM,WAAW,CAAC,OAAO,EAAG,OAAe,CAAC,UAAU,CAAC,CAAC;QAExD,MAAM,KAAK,GAAQ;YACjB,4BAA4B,EA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,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"}
|
|
@@ -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,OA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":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createMCPMiddleware.d.ts","sourceRoot":"","sources":["../../src/express/createMCPMiddleware.ts"],"names":[],"mappings":"AAGA,OAAO,EAAW,cAAc,EAAE,MAAM,SAAS,CAAC;AAiElD,QAAA,MAAM,mBAAmB,EAAE,cAoB1B,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { randomUUID } from 'node:crypto';
|
|
2
1
|
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
3
2
|
import { isInitializeRequest } from '@modelcontextprotocol/sdk/types.js';
|
|
4
3
|
import createMcpServer from '../mcp/index.js';
|
|
@@ -15,7 +14,7 @@ const handlePostRequest = async (req, res) => {
|
|
|
15
14
|
else if (!sessionId && isInitializeRequest(req.body)) {
|
|
16
15
|
// New initialization request
|
|
17
16
|
transport = new StreamableHTTPServerTransport({
|
|
18
|
-
sessionIdGenerator: () => randomUUID(),
|
|
17
|
+
sessionIdGenerator: () => crypto.randomUUID(),
|
|
19
18
|
onsessioninitialized: (sessionId) => {
|
|
20
19
|
// Store the transport by session ID
|
|
21
20
|
transports[sessionId] = transport;
|
|
@@ -27,7 +26,8 @@ const handlePostRequest = async (req, res) => {
|
|
|
27
26
|
delete transports[transport.sessionId];
|
|
28
27
|
}
|
|
29
28
|
};
|
|
30
|
-
const
|
|
29
|
+
const roles = req.unchainedContext.user.roles || [];
|
|
30
|
+
const server = createMcpServer(req.unchainedContext, roles);
|
|
31
31
|
await server.connect(transport);
|
|
32
32
|
}
|
|
33
33
|
else {
|
|
@@ -56,6 +56,15 @@ const handleSessionRequest = async (req, res) => {
|
|
|
56
56
|
await transport.handleRequest(req, res);
|
|
57
57
|
};
|
|
58
58
|
const createMCPMiddleware = (req, res, next) => {
|
|
59
|
+
if (!req.unchainedContext.user) {
|
|
60
|
+
res.status(401);
|
|
61
|
+
res.header('WWW-Authenticate', `Bearer realm="Unchained MCP", error="invalid_token", resource="${process.env.ROOT_URL || 'http://localhost:4010'}",`);
|
|
62
|
+
res.json({
|
|
63
|
+
error: 'invalid_token',
|
|
64
|
+
resource_metadata: `${process.env.ROOT_URL || 'http://localhost:4010'}/.well-known/oauth-protected-resource`,
|
|
65
|
+
});
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
59
68
|
if (req.method === 'POST') {
|
|
60
69
|
return handlePostRequest(req, res, next);
|
|
61
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createMCPMiddleware.js","sourceRoot":"","sources":["../../src/express/createMCPMiddleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"createMCPMiddleware.js","sourceRoot":"","sources":["../../src/express/createMCPMiddleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,eAAe,MAAM,iBAAiB,CAAC;AAI9C,wCAAwC;AACxC,MAAM,UAAU,GAAkD,EAAE,CAAC;AAErE,MAAM,iBAAiB,GAAmB,KAAK,EAAE,GAA4C,EAAE,GAAG,EAAE,EAAE;IACpG,gCAAgC;IAEhC,MAAM,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,gBAAgB,CAAuB,CAAC;IAEtE,IAAI,SAAwC,CAAC;IAE7C,IAAI,SAAS,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QACvC,2BAA2B;QAC3B,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;SAAM,IAAI,CAAC,SAAS,IAAI,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QACvD,6BAA6B;QAC7B,SAAS,GAAG,IAAI,6BAA6B,CAAC;YAC5C,kBAAkB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE;YAC7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MAAM,eAAe,CAAC;AAYxC,wBAA8B,oBAAoB,CAChD,GAAG,EAAE,OAAO,GAAG;IAAE,KAAK,CAAC,EAAE,GAAG,CAAC;IAAC,KAAK,EAAE,GAAG,CAAC;IAAC,gBAAgB,EAAE,OAAO,CAAA;CAAE,EACrE,GAAG,KAAA,iBA0CJ"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { createLogger } from '@unchainedshop/logger';
|
|
2
|
+
import { checkAction } from '../acl.js';
|
|
3
|
+
import { actions } from '../roles/index.js';
|
|
4
|
+
import { getFileAdapter } from '@unchainedshop/core-files';
|
|
5
|
+
const logger = createLogger('unchained:temp-upload');
|
|
6
|
+
const methodWrongHandler = (res) => {
|
|
7
|
+
logger.error('Method not supported, return 404');
|
|
8
|
+
res.writeHead(404);
|
|
9
|
+
res.end();
|
|
10
|
+
return;
|
|
11
|
+
};
|
|
12
|
+
export default async function tempUploadMiddleware(req, res) {
|
|
13
|
+
try {
|
|
14
|
+
const context = req.unchainedContext;
|
|
15
|
+
if (req.method !== 'POST') {
|
|
16
|
+
return methodWrongHandler(res);
|
|
17
|
+
}
|
|
18
|
+
await checkAction(context, actions.uploadTempFile);
|
|
19
|
+
const [data] = req.files || [];
|
|
20
|
+
const file = await context.services.files.uploadFileFromStream({
|
|
21
|
+
directoryName: 'temp-uploads',
|
|
22
|
+
rawFile: {
|
|
23
|
+
filename: data.originalname,
|
|
24
|
+
buffer: data.buffer,
|
|
25
|
+
mimetype: data.mimetype,
|
|
26
|
+
},
|
|
27
|
+
meta: { fieldname: data.fieldname, encoding: data.encoding },
|
|
28
|
+
});
|
|
29
|
+
// Add an expiration date to this file manually!
|
|
30
|
+
const expires = new Date(Date.now() + 24 * 60 * 60 * 1000);
|
|
31
|
+
await context.modules.files.update(file._id, {
|
|
32
|
+
expires, // Default to 1 hour
|
|
33
|
+
});
|
|
34
|
+
const fileUploadAdapter = getFileAdapter();
|
|
35
|
+
const rawUrl = await fileUploadAdapter.createDownloadURL(file);
|
|
36
|
+
const url = context.modules.files.normalizeUrl(rawUrl, {});
|
|
37
|
+
const body = JSON.stringify({ fileId: file._id, url, expires: expires.toISOString() });
|
|
38
|
+
res.writeHead(200);
|
|
39
|
+
res.end(body);
|
|
40
|
+
}
|
|
41
|
+
catch (e) {
|
|
42
|
+
logger.error(e.message);
|
|
43
|
+
res.writeHead(503);
|
|
44
|
+
res.end(JSON.stringify({ name: e.name, code: e.code, message: e.message }));
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=createTempUploadMiddleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createTempUploadMiddleware.js","sourceRoot":"","sources":["../../src/express/createTempUploadMiddleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,MAAM,MAAM,GAAG,YAAY,CAAC,uBAAuB,CAAC,CAAC;AAErD,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,CAAC,OAAO,CAAC,KAAK,UAAU,oBAAoB,CAChD,GAAqE,EACrE,GAAG;IAEH,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,GAAG,CAAC,gBAAgB,CAAC;QAErC,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;YAC1B,OAAO,kBAAkB,CAAC,GAAG,CAAC,CAAC;QACjC,CAAC;QAED,MAAM,WAAW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AAC,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/express/index.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/express/index.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,SAAS,CAAC;AAKxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AA6HpD,eAAO,MAAM,OAAO,GAClB,YAAY,CAAC,CAAC,OAAO,EACrB,yBAGG;IACD,cAAc,EAAE,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC7C,EAAE,EAAE,OAAO,CAAC,EAAE,CAAC;IACf,YAAY,EAAE,aAAa,CAAC;CAC7B,EACD,2CAEG;IACD,mCAAmC,CAAC,EAAE,OAAO,CAAC;CAC1C,SA0EP,CAAC"}
|
package/lib/express/index.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import createBulkImportMiddleware from './createBulkImportMiddleware.js';
|
|
3
|
-
import createERCMetadataMiddleware from './createERCMetadataMiddleware.js';
|
|
1
|
+
import e from 'express';
|
|
4
2
|
import session from 'express-session';
|
|
3
|
+
import multer from 'multer';
|
|
5
4
|
import MongoStore from 'connect-mongo';
|
|
6
5
|
import { Passport } from 'passport';
|
|
7
6
|
import { emit } from '@unchainedshop/events';
|
|
7
|
+
import { getCurrentContextResolver } from '../context.js';
|
|
8
|
+
import createBulkImportMiddleware from './createBulkImportMiddleware.js';
|
|
9
|
+
import createERCMetadataMiddleware from './createERCMetadataMiddleware.js';
|
|
10
|
+
import createTempUploadMiddleware from './createTempUploadMiddleware.js';
|
|
11
|
+
import createMCPMiddleware from './createMCPMiddleware.js';
|
|
8
12
|
import { API_EVENTS } from '../events.js';
|
|
9
13
|
const resolveUserRemoteAddress = (req) => {
|
|
10
14
|
const remoteAddress = req.headers['x-real-ip'] ||
|
|
@@ -13,7 +17,9 @@ const resolveUserRemoteAddress = (req) => {
|
|
|
13
17
|
const remotePort = req.socket?.remotePort;
|
|
14
18
|
return { remoteAddress, remotePort };
|
|
15
19
|
};
|
|
16
|
-
const
|
|
20
|
+
const storage = multer.memoryStorage();
|
|
21
|
+
const upload = multer({ storage: storage });
|
|
22
|
+
const { BULK_IMPORT_API_PATH = '/bulk-import', ERC_METADATA_API_PATH = '/erc-metadata', TEMP_UPLOAD_API_PATH = '/temp-upload', MCP_API_PATH = '/mcp', GRAPHQL_API_PATH = '/graphql', UNCHAINED_COOKIE_NAME = 'unchained_token', UNCHAINED_COOKIE_PATH = '/', UNCHAINED_COOKIE_DOMAIN, UNCHAINED_COOKIE_SAMESITE, UNCHAINED_COOKIE_INSECURE, } = process.env;
|
|
17
23
|
const addContext = async function middlewareWithContext(req, res, next) {
|
|
18
24
|
try {
|
|
19
25
|
const setHeader = (key, value) => res.setHeader(key, value);
|
|
@@ -34,11 +40,9 @@ const addContext = async function middlewareWithContext(req, res, next) {
|
|
|
34
40
|
const tokenObject = {
|
|
35
41
|
_id: req.sessionID,
|
|
36
42
|
userId: user._id,
|
|
37
|
-
/* eslint-disable-next-line */
|
|
38
43
|
tokenExpires: new Date(req.session?.cookie._expires),
|
|
39
44
|
};
|
|
40
45
|
await emit(API_EVENTS.API_LOGIN_TOKEN_CREATED, tokenObject);
|
|
41
|
-
/* eslint-disable-next-line */
|
|
42
46
|
user._inLoginMethodResponse = true;
|
|
43
47
|
return { user, ...tokenObject };
|
|
44
48
|
};
|
|
@@ -90,6 +94,10 @@ export const connect = (expressApp, { graphqlHandler, db, }, { allowRemoteToLoca
|
|
|
90
94
|
expressApp.use((req, res, next) => {
|
|
91
95
|
req.headers['x-forwarded-proto'] = 'https';
|
|
92
96
|
res.setHeader('Access-Control-Allow-Private-Network', 'true');
|
|
97
|
+
res.setHeader('Access-Control-Allow-Origin', req.headers.origin || '*');
|
|
98
|
+
res.setHeader('Access-Control-Allow-Credentials', 'true');
|
|
99
|
+
res.setHeader('Access-Control-Allow-Methods', ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'].join(', '));
|
|
100
|
+
res.setHeader('Access-Control-Allow-Headers', req.headers['access-control-request-headers'] || '*');
|
|
93
101
|
next();
|
|
94
102
|
});
|
|
95
103
|
}
|
|
@@ -134,5 +142,8 @@ export const connect = (expressApp, { graphqlHandler, db, }, { allowRemoteToLoca
|
|
|
134
142
|
expressApp.use(GRAPHQL_API_PATH, graphqlHandler.handle);
|
|
135
143
|
expressApp.use(ERC_METADATA_API_PATH, createERCMetadataMiddleware);
|
|
136
144
|
expressApp.use(BULK_IMPORT_API_PATH, createBulkImportMiddleware);
|
|
145
|
+
expressApp.use(TEMP_UPLOAD_API_PATH, upload.any(), createTempUploadMiddleware);
|
|
146
|
+
expressApp.use(MCP_API_PATH, e.json({ limit: '10mb' }));
|
|
147
|
+
expressApp.use(MCP_API_PATH, createMCPMiddleware);
|
|
137
148
|
};
|
|
138
149
|
//# sourceMappingURL=index.js.map
|
package/lib/express/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/express/index.ts"],"names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AAI;YACd,MAAM,EAAE,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;SAChC;KACF,CAAC,EACF,QAAQ,CAAC,UAAU,EAAE,EACrB,QAAQ,CAAC,OAAO,EAAE,EAClB,UAAU,CACX,CAAC;IACF,UAAU,CAAC,GAAG,CAAC,gBAAgB,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxD,UAAU,CAAC,GAAG,CAAC,qBAAqB,EAAE,2BAA2B,CAAC,CAAC;IACnE,UAAU,CAAC,GAAG,CAAC,oBAAoB,EAAE,0BAA0B,CAAC,CAAC;IACjE,UAAU,CAAC,GAAG,CAAC,oBAAoB,EAAE,MAAM,CAAC,GAAG,EAAE,EAAE,0BAA0B,CAAC,CAAC;IAE/E,UAAU,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;IACxD,UAAU,CAAC,GAAG,CAAC,YAAY,EAAE,mBAAmB,CAAC,CAAC;AACpD,CAAC,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { RequestHandler } from 'express';
|
|
2
|
+
export declare const setupMCPChatHandler: (chatConfiguration: any) => RequestHandler<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>;
|
|
3
|
+
//# sourceMappingURL=setupMCPChatHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setupMCPChatHandler.d.ts","sourceRoot":"","sources":["../../src/express/setupMCPChatHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,cAAc,EAAY,MAAM,SAAS,CAAC;AAwB5D,eAAO,MAAM,mBAAmB,GAAI,sBAAiB,+HA+CpD,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { experimental_createMCPClient as createMCPClient, InvalidToolArgumentsError, NoSuchToolError, ToolExecutionError, streamText, } from 'ai';
|
|
2
|
+
import { createLogger } from '@unchainedshop/logger';
|
|
3
|
+
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
4
|
+
const logger = createLogger('unchained:mcp-chat-handler');
|
|
5
|
+
const { ROOT_URL } = process.env;
|
|
6
|
+
const errorHandler = (error) => {
|
|
7
|
+
if (NoSuchToolError.isInstance(error))
|
|
8
|
+
return 'NoSuchToolError';
|
|
9
|
+
if (InvalidToolArgumentsError.isInstance(error))
|
|
10
|
+
return 'InvalidToolArgumentsError';
|
|
11
|
+
if (ToolExecutionError.isInstance(error))
|
|
12
|
+
return 'ToolExecutionError';
|
|
13
|
+
if (error?.message?.toLowerCase() === 'forbidden')
|
|
14
|
+
return 'NetworkError';
|
|
15
|
+
logger.error(error);
|
|
16
|
+
return `Failed to stream response: ${error?.message || 'Unknown error'}`;
|
|
17
|
+
};
|
|
18
|
+
export const setupMCPChatHandler = (chatConfiguration) => {
|
|
19
|
+
let client;
|
|
20
|
+
if (!chatConfiguration || !chatConfiguration?.model)
|
|
21
|
+
return null;
|
|
22
|
+
const { tools = {}, ...restChatConfig } = chatConfiguration || {};
|
|
23
|
+
const mcpChatHandler = async (req, res) => {
|
|
24
|
+
if (req.method === 'OPTIONS') {
|
|
25
|
+
res.status(204).end();
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (req.method !== 'POST') {
|
|
29
|
+
res.status(405).json({ error: 'Method Not Allowed. Use POST.' });
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const { messages } = req.body;
|
|
33
|
+
try {
|
|
34
|
+
client = await createMCPClient({
|
|
35
|
+
transport: new StreamableHTTPClientTransport(new URL(`${ROOT_URL}/mcp`)),
|
|
36
|
+
});
|
|
37
|
+
const defaultUnchainedTools = await client.tools();
|
|
38
|
+
const result = streamText({
|
|
39
|
+
...restChatConfig,
|
|
40
|
+
messages,
|
|
41
|
+
tools: { ...defaultUnchainedTools, ...tools },
|
|
42
|
+
onFinish: async () => {
|
|
43
|
+
await client?.close();
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
result.pipeDataStreamToResponse(res, {
|
|
47
|
+
getErrorMessage: errorHandler,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
await client?.close();
|
|
52
|
+
res.status(500).json({ error: errorHandler(err) });
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
return mcpChatHandler;
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=setupMCPChatHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setupMCPChatHandler.js","sourceRoot":"","sources":["../../src/express/setupMCPChatHandler.ts"],"names":[],"mappings":"AACA,OAAO,EACL,4BAA4B,IAAI,eAAe,EAC/C,yBAAyB,EACzB,eAAe,EACf,kBAAkB,EAClB,UAAU,GACX,MAAM,IAAI,CAAC;AACZ,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AAEnG,MAAM,MAAM,GAAG,YAAY,CAAC,4BAA4B,CAAC,CAAC;AAE1D,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;AACjC,MAAM,YAAY,GAAG,CAAC,KAAU,EAAU,EAAE;IAC1C,IAAI,eAAe,CAAC,UAAU,CAAC,KAAK,CAAC;QAAE,OAAO,iBAAiB,CAAC;IAChE,IAAI,yBAAyB,CAAC,UAAU,CAAC,KAAK,CAAC;QAAE,OAAO,2BAA2B,CAAC;IACpF,IAAI,kBAAkB,CAAC,UAAU,CAAC,KAAK,CAAC;QAAE,OAAO,oBAAoB,CAAC;IACtE,IAAI,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,WAAW;QAAE,OAAO,cAAc,CAAC;IACzE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACpB,OAAO,8BAA8B,KAAK,E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CAAC,CAAC;YAEH,MAAM,CAAC,wBAAwB,CAAC,GAAG,EAAE;gBACnC,eAAe,EAAE,YAAY;aAC9B,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,MAAM,EAAE,KAAK,EAAE,CAAC;YACtB,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACrD,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,cAAc,CAAC;AACxB,CAAC,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"}
|