@unchainedshop/api 3.1.11 → 3.1.13
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/errors.d.ts +1 -0
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +1 -0
- package/lib/errors.js.map +1 -1
- package/lib/express/chatRouter.d.ts +3 -0
- package/lib/express/chatRouter.d.ts.map +1 -0
- package/lib/express/chatRouter.js +86 -0
- package/lib/express/chatRouter.js.map +1 -0
- package/lib/express/createApolloMiddleware.d.ts +4 -0
- package/lib/express/createApolloMiddleware.d.ts.map +1 -0
- package/lib/express/createApolloMiddleware.js +36 -0
- package/lib/express/createApolloMiddleware.js.map +1 -0
- package/lib/express/createMCPMiddleware.d.ts +4 -0
- package/lib/express/createMCPMiddleware.d.ts.map +1 -0
- package/lib/express/createMCPMiddleware.js +68 -0
- package/lib/express/createMCPMiddleware.js.map +1 -0
- package/lib/express/createSingleSignOnMiddleware.d.ts +5 -0
- package/lib/express/createSingleSignOnMiddleware.d.ts.map +1 -0
- package/lib/express/createSingleSignOnMiddleware.js +71 -0
- package/lib/express/createSingleSignOnMiddleware.js.map +1 -0
- package/lib/hashPassword.d.ts +2 -0
- package/lib/hashPassword.d.ts.map +1 -0
- package/lib/hashPassword.js +5 -0
- package/lib/hashPassword.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/buildLocaleMap.d.ts +6 -0
- package/lib/loaders/buildLocaleMap.d.ts.map +1 -0
- package/lib/loaders/buildLocaleMap.js +38 -0
- package/lib/loaders/buildLocaleMap.js.map +1 -0
- package/lib/loaders/buildTextMap.d.ts +1 -1
- package/lib/loaders/buildTextMap.d.ts.map +1 -1
- package/lib/loaders/buildTextMap.js +16 -6
- package/lib/loaders/buildTextMap.js.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.map +1 -1
- package/lib/loaders/index.js +1 -29
- 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/mcp/index.d.ts +4 -0
- package/lib/mcp/index.d.ts.map +1 -0
- package/lib/mcp/index.js +12 -0
- package/lib/mcp/index.js.map +1 -0
- package/lib/mcp/tools/addProductAssignmentHandler.d.ts +52 -0
- package/lib/mcp/tools/addProductAssignmentHandler.d.ts.map +1 -0
- package/lib/mcp/tools/addProductAssignmentHandler.js +97 -0
- package/lib/mcp/tools/addProductAssignmentHandler.js.map +1 -0
- package/lib/mcp/tools/countriesHandler.d.ts +60 -0
- package/lib/mcp/tools/countriesHandler.d.ts.map +1 -0
- package/lib/mcp/tools/countriesHandler.js +48 -0
- package/lib/mcp/tools/countriesHandler.js.map +1 -0
- package/lib/mcp/tools/countryHandler.d.ts +20 -0
- package/lib/mcp/tools/countryHandler.d.ts.map +1 -0
- package/lib/mcp/tools/countryHandler.js +34 -0
- package/lib/mcp/tools/countryHandler.js.map +1 -0
- package/lib/mcp/tools/createProduct.d.ts +138 -0
- package/lib/mcp/tools/createProduct.d.ts.map +1 -0
- package/lib/mcp/tools/createProduct.js +60 -0
- package/lib/mcp/tools/createProduct.js.map +1 -0
- package/lib/mcp/tools/createProductVariationHandler.d.ts +84 -0
- package/lib/mcp/tools/createProductVariationHandler.d.ts.map +1 -0
- package/lib/mcp/tools/createProductVariationHandler.js +67 -0
- package/lib/mcp/tools/createProductVariationHandler.js.map +1 -0
- package/lib/mcp/tools/currenciesHandler.d.ts +60 -0
- package/lib/mcp/tools/currenciesHandler.d.ts.map +1 -0
- package/lib/mcp/tools/currenciesHandler.js +50 -0
- package/lib/mcp/tools/currenciesHandler.js.map +1 -0
- package/lib/mcp/tools/currencyHandler.d.ts +20 -0
- package/lib/mcp/tools/currencyHandler.d.ts.map +1 -0
- package/lib/mcp/tools/currencyHandler.js +34 -0
- package/lib/mcp/tools/currencyHandler.js.map +1 -0
- package/lib/mcp/tools/getProduct.d.ts +48 -0
- package/lib/mcp/tools/getProduct.d.ts.map +1 -0
- package/lib/mcp/tools/getProduct.js +104 -0
- package/lib/mcp/tools/getProduct.js.map +1 -0
- package/lib/mcp/tools/index.d.ts +6 -0
- package/lib/mcp/tools/index.d.ts.map +1 -0
- package/lib/mcp/tools/index.js +6 -0
- package/lib/mcp/tools/index.js.map +1 -0
- package/lib/mcp/tools/languageHandler.d.ts +20 -0
- package/lib/mcp/tools/languageHandler.d.ts.map +1 -0
- package/lib/mcp/tools/languageHandler.js +31 -0
- package/lib/mcp/tools/languageHandler.js.map +1 -0
- package/lib/mcp/tools/languagesHandler.d.ts +60 -0
- package/lib/mcp/tools/languagesHandler.d.ts.map +1 -0
- package/lib/mcp/tools/languagesHandler.js +42 -0
- package/lib/mcp/tools/languagesHandler.js.map +1 -0
- package/lib/mcp/tools/listProducts.d.ts +112 -0
- package/lib/mcp/tools/listProducts.d.ts.map +1 -0
- package/lib/mcp/tools/listProducts.js +98 -0
- package/lib/mcp/tools/listProducts.js.map +1 -0
- package/lib/mcp/tools/normalizeMediaUrl.d.ts +3 -0
- package/lib/mcp/tools/normalizeMediaUrl.d.ts.map +1 -0
- package/lib/mcp/tools/normalizeMediaUrl.js +21 -0
- package/lib/mcp/tools/normalizeMediaUrl.js.map +1 -0
- package/lib/mcp/tools/productsCountHandler.d.ts +32 -0
- package/lib/mcp/tools/productsCountHandler.d.ts.map +1 -0
- package/lib/mcp/tools/productsCountHandler.js +33 -0
- package/lib/mcp/tools/productsCountHandler.js.map +1 -0
- package/lib/mcp/tools/publishProduct.d.ts +20 -0
- package/lib/mcp/tools/publishProduct.d.ts.map +1 -0
- package/lib/mcp/tools/publishProduct.js +40 -0
- package/lib/mcp/tools/publishProduct.js.map +1 -0
- package/lib/mcp/tools/removeProduct.d.ts +20 -0
- package/lib/mcp/tools/removeProduct.d.ts.map +1 -0
- package/lib/mcp/tools/removeProduct.js +34 -0
- package/lib/mcp/tools/removeProduct.js.map +1 -0
- package/lib/mcp/tools/removeProductVariationHandler.d.ts +20 -0
- package/lib/mcp/tools/removeProductVariationHandler.d.ts.map +1 -0
- package/lib/mcp/tools/removeProductVariationHandler.js +43 -0
- package/lib/mcp/tools/removeProductVariationHandler.js.map +1 -0
- package/lib/mcp/tools/unPublishProduct.d.ts +20 -0
- package/lib/mcp/tools/unPublishProduct.d.ts.map +1 -0
- package/lib/mcp/tools/unPublishProduct.js +40 -0
- package/lib/mcp/tools/unPublishProduct.js.map +1 -0
- package/lib/mcp/tools/updateProduct.d.ts +56 -0
- package/lib/mcp/tools/updateProduct.d.ts.map +1 -0
- package/lib/mcp/tools/updateProduct.js +44 -0
- package/lib/mcp/tools/updateProduct.js.map +1 -0
- package/lib/mcp/tools/updateProductCommerceHandler.d.ts +166 -0
- package/lib/mcp/tools/updateProductCommerceHandler.d.ts.map +1 -0
- package/lib/mcp/tools/updateProductCommerceHandler.js +64 -0
- package/lib/mcp/tools/updateProductCommerceHandler.js.map +1 -0
- package/lib/mcp/tools/updateProductPlanHandler.d.ts +72 -0
- package/lib/mcp/tools/updateProductPlanHandler.d.ts.map +1 -0
- package/lib/mcp/tools/updateProductPlanHandler.js +51 -0
- package/lib/mcp/tools/updateProductPlanHandler.js.map +1 -0
- package/lib/mcp/tools/updateProductSupplyHandler.d.ts +64 -0
- package/lib/mcp/tools/updateProductSupplyHandler.d.ts.map +1 -0
- package/lib/mcp/tools/updateProductSupplyHandler.js +52 -0
- package/lib/mcp/tools/updateProductSupplyHandler.js.map +1 -0
- package/lib/mcp/tools/updateProductTextsHandler.d.ts +114 -0
- package/lib/mcp/tools/updateProductTextsHandler.d.ts.map +1 -0
- package/lib/mcp/tools/updateProductTextsHandler.js +50 -0
- package/lib/mcp/tools/updateProductTextsHandler.js.map +1 -0
- package/lib/mcp/tools/updateProductTokenizationHandler.d.ts +72 -0
- package/lib/mcp/tools/updateProductTokenizationHandler.d.ts.map +1 -0
- package/lib/mcp/tools/updateProductTokenizationHandler.js +49 -0
- package/lib/mcp/tools/updateProductTokenizationHandler.js.map +1 -0
- package/lib/mcp/tools/updateProductWarehousingHandler.d.ts +48 -0
- package/lib/mcp/tools/updateProductWarehousingHandler.d.ts.map +1 -0
- package/lib/mcp/tools/updateProductWarehousingHandler.js +45 -0
- package/lib/mcp/tools/updateProductWarehousingHandler.js.map +1 -0
- package/lib/mcp/utils/getNormalizedProductDetails.d.ts +26 -0
- package/lib/mcp/utils/getNormalizedProductDetails.d.ts.map +1 -0
- package/lib/mcp/utils/getNormalizedProductDetails.js +36 -0
- package/lib/mcp/utils/getNormalizedProductDetails.js.map +1 -0
- package/lib/mcp/utils/normalizeMediaUrl.d.ts +3 -0
- package/lib/mcp/utils/normalizeMediaUrl.d.ts.map +1 -0
- package/lib/mcp/utils/normalizeMediaUrl.js +21 -0
- package/lib/mcp/utils/normalizeMediaUrl.js.map +1 -0
- package/lib/resolvers/mutations/accounts/buildSecretTOTPAuthURL.d.ts +3 -0
- package/lib/resolvers/mutations/accounts/buildSecretTOTPAuthURL.d.ts.map +1 -0
- package/lib/resolvers/mutations/accounts/buildSecretTOTPAuthURL.js +6 -0
- package/lib/resolvers/mutations/accounts/buildSecretTOTPAuthURL.js.map +1 -0
- package/lib/resolvers/mutations/accounts/disableTOTP.d.ts +6 -0
- package/lib/resolvers/mutations/accounts/disableTOTP.d.ts.map +1 -0
- package/lib/resolvers/mutations/accounts/disableTOTP.js +27 -0
- package/lib/resolvers/mutations/accounts/disableTOTP.js.map +1 -0
- package/lib/resolvers/mutations/accounts/enableTOTP.d.ts +6 -0
- package/lib/resolvers/mutations/accounts/enableTOTP.d.ts.map +1 -0
- package/lib/resolvers/mutations/accounts/enableTOTP.js +20 -0
- package/lib/resolvers/mutations/accounts/enableTOTP.js.map +1 -0
- package/lib/resolvers/mutations/accounts/linkOAuthAccount.d.ts +7 -0
- package/lib/resolvers/mutations/accounts/linkOAuthAccount.d.ts.map +1 -0
- package/lib/resolvers/mutations/accounts/linkOAuthAccount.js +30 -0
- package/lib/resolvers/mutations/accounts/linkOAuthAccount.js.map +1 -0
- package/lib/resolvers/mutations/accounts/loginWithOAuth.d.ts +8 -0
- package/lib/resolvers/mutations/accounts/loginWithOAuth.d.ts.map +1 -0
- package/lib/resolvers/mutations/accounts/loginWithOAuth.js +25 -0
- package/lib/resolvers/mutations/accounts/loginWithOAuth.js.map +1 -0
- package/lib/resolvers/mutations/accounts/logoutAllSessions.d.ts +5 -0
- package/lib/resolvers/mutations/accounts/logoutAllSessions.d.ts.map +1 -0
- package/lib/resolvers/mutations/accounts/logoutAllSessions.js +20 -0
- package/lib/resolvers/mutations/accounts/logoutAllSessions.js.map +1 -0
- package/lib/resolvers/mutations/accounts/unlinkOAuthAccount.d.ts +6 -0
- package/lib/resolvers/mutations/accounts/unlinkOAuthAccount.d.ts.map +1 -0
- package/lib/resolvers/mutations/accounts/unlinkOAuthAccount.js +13 -0
- package/lib/resolvers/mutations/accounts/unlinkOAuthAccount.js.map +1 -0
- package/lib/resolvers/mutations/assortments/addAssortmentMedia.d.ts +6 -0
- package/lib/resolvers/mutations/assortments/addAssortmentMedia.d.ts.map +1 -0
- package/lib/resolvers/mutations/assortments/addAssortmentMedia.js +18 -0
- package/lib/resolvers/mutations/assortments/addAssortmentMedia.js.map +1 -0
- package/lib/resolvers/mutations/products/addProductAssignment.d.ts.map +1 -1
- package/lib/resolvers/mutations/products/addProductAssignment.js +3 -1
- package/lib/resolvers/mutations/products/addProductAssignment.js.map +1 -1
- package/lib/resolvers/mutations/products/addProductMedia.d.ts +6 -0
- package/lib/resolvers/mutations/products/addProductMedia.d.ts.map +1 -0
- package/lib/resolvers/mutations/products/addProductMedia.js +18 -0
- package/lib/resolvers/mutations/products/addProductMedia.js.map +1 -0
- package/lib/resolvers/mutations/users/updateUserAvatar.d.ts +6 -0
- package/lib/resolvers/mutations/users/updateUserAvatar.d.ts.map +1 -0
- package/lib/resolvers/mutations/users/updateUserAvatar.js +22 -0
- package/lib/resolvers/mutations/users/updateUserAvatar.js.map +1 -0
- package/lib/resolvers/mutations/utils/getOrderCart.d.ts +7 -0
- package/lib/resolvers/mutations/utils/getOrderCart.d.ts.map +1 -0
- package/lib/resolvers/mutations/utils/getOrderCart.js +13 -0
- package/lib/resolvers/mutations/utils/getOrderCart.js.map +1 -0
- package/lib/resolvers/type/dispatch-types.d.ts +15 -0
- package/lib/resolvers/type/dispatch-types.d.ts.map +1 -0
- package/lib/resolvers/type/dispatch-types.js +16 -0
- package/lib/resolvers/type/dispatch-types.js.map +1 -0
- package/lib/resolvers/type/oauth-account.d.ts +6 -0
- package/lib/resolvers/type/oauth-account.d.ts.map +1 -0
- package/lib/resolvers/type/oauth-account.js +7 -0
- package/lib/resolvers/type/oauth-account.js.map +1 -0
- package/lib/resolvers/type/oauth-provider.d.ts +6 -0
- package/lib/resolvers/type/oauth-provider.d.ts.map +1 -0
- package/lib/resolvers/type/oauth-provider.js +6 -0
- package/lib/resolvers/type/oauth-provider.js.map +1 -0
- package/lib/resolvers/type/stock-types.d.ts +14 -0
- package/lib/resolvers/type/stock-types.d.ts.map +1 -0
- package/lib/resolvers/type/stock-types.js +15 -0
- package/lib/resolvers/type/stock-types.js.map +1 -0
- package/lib/user-context.d.ts +7 -0
- package/lib/user-context.d.ts.map +1 -0
- package/lib/user-context.js +76 -0
- package/lib/user-context.js.map +1 -0
- package/package.json +13 -13
- package/src/errors.ts +5 -0
- package/src/loaders/buildLocaleMap.test.ts +61 -0
- package/src/loaders/buildLocaleMap.ts +39 -0
- package/src/loaders/buildTextMap.test.ts +54 -0
- package/src/loaders/buildTextMap.ts +22 -6
- package/src/loaders/index.ts +1 -32
- package/src/resolvers/mutations/products/addProductAssignment.ts +8 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { getNormalizedProductDetails } from '../utils/getNormalizedProductDetails.js';
|
|
3
|
+
export const UpdateProductCommerceSchema = {
|
|
4
|
+
productId: z
|
|
5
|
+
.string()
|
|
6
|
+
.min(1)
|
|
7
|
+
.describe('ID of the product of all type except for CONFIGURABLE_PRODUCT to update commerce info'),
|
|
8
|
+
commerce: z
|
|
9
|
+
.object({
|
|
10
|
+
pricing: z
|
|
11
|
+
.array(z.object({
|
|
12
|
+
amount: z.number().int().describe('Price amount in smallest currency unit (e.g., cents)'),
|
|
13
|
+
maxQuantity: z
|
|
14
|
+
.number()
|
|
15
|
+
.int()
|
|
16
|
+
.optional()
|
|
17
|
+
.describe('Optional maximum quantity for this price tier'),
|
|
18
|
+
isTaxable: z.boolean().optional().describe('Whether tax applies to this price'),
|
|
19
|
+
isNetPrice: z.boolean().optional().describe('Whether this is a net price (without tax)'),
|
|
20
|
+
currencyCode: z
|
|
21
|
+
.string()
|
|
22
|
+
.min(3)
|
|
23
|
+
.max(3)
|
|
24
|
+
.describe('ISO currency code (e.g., USD, EUR) always use values registered in the system and if explicitly provided check if it exists'),
|
|
25
|
+
countryCode: z
|
|
26
|
+
.string()
|
|
27
|
+
.min(2)
|
|
28
|
+
.max(2)
|
|
29
|
+
.describe('ISO country code (e.g., US, DE) always use values registered in the system and if explicitly provided check if it exists'),
|
|
30
|
+
}))
|
|
31
|
+
.nonempty()
|
|
32
|
+
.describe('List of price configurations'),
|
|
33
|
+
})
|
|
34
|
+
.describe('Commerce info to update'),
|
|
35
|
+
};
|
|
36
|
+
export const UpdateProductCommerceZodSchema = z.object(UpdateProductCommerceSchema);
|
|
37
|
+
export async function updateProductCommerceHandler(context, params) {
|
|
38
|
+
const { productId, commerce } = params;
|
|
39
|
+
const { modules } = context;
|
|
40
|
+
try {
|
|
41
|
+
await modules.products.update(productId, { commerce });
|
|
42
|
+
return {
|
|
43
|
+
content: [
|
|
44
|
+
{
|
|
45
|
+
type: 'text',
|
|
46
|
+
text: JSON.stringify({
|
|
47
|
+
product: await getNormalizedProductDetails(productId, context),
|
|
48
|
+
}),
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
return {
|
|
55
|
+
content: [
|
|
56
|
+
{
|
|
57
|
+
type: 'text',
|
|
58
|
+
text: `Error updating product commerce info: ${error.message}`,
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=updateProductCommerceHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateProductCommerceHandler.js","sourceRoot":"","sources":["../../../src/mcp/tools/updateProductCommerceHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AAEtF,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,uFAAuF,CAAC;IACpG,QAAQ,EAAE,CAAC;SACR,MAAM,CAAC;QACN,OA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AO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wBACnB,OAAO,EAAE,MAAM,2BAA2B,CAAC,SAAS,EAAE,OAAO,CAAC;qBAC/D,CAAC;iBACH;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,yCAA0C,KAAe,CAAC,OAAO,EAAE;iBAC1E;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Context } from '../../context.js';
|
|
3
|
+
export declare const UpdateProductPlanSchema: {
|
|
4
|
+
productId: z.ZodString;
|
|
5
|
+
plan: z.ZodObject<{
|
|
6
|
+
usageCalculationType: z.ZodString;
|
|
7
|
+
billingInterval: z.ZodString;
|
|
8
|
+
billingIntervalCount: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
trialInterval: z.ZodOptional<z.ZodString>;
|
|
10
|
+
trialIntervalCount: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
usageCalculationType?: string;
|
|
13
|
+
billingInterval?: string;
|
|
14
|
+
billingIntervalCount?: number;
|
|
15
|
+
trialInterval?: string;
|
|
16
|
+
trialIntervalCount?: number;
|
|
17
|
+
}, {
|
|
18
|
+
usageCalculationType?: string;
|
|
19
|
+
billingInterval?: string;
|
|
20
|
+
billingIntervalCount?: number;
|
|
21
|
+
trialInterval?: string;
|
|
22
|
+
trialIntervalCount?: number;
|
|
23
|
+
}>;
|
|
24
|
+
};
|
|
25
|
+
export declare const UpdateProductPlanZodSchema: z.ZodObject<{
|
|
26
|
+
productId: z.ZodString;
|
|
27
|
+
plan: z.ZodObject<{
|
|
28
|
+
usageCalculationType: z.ZodString;
|
|
29
|
+
billingInterval: z.ZodString;
|
|
30
|
+
billingIntervalCount: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
trialInterval: z.ZodOptional<z.ZodString>;
|
|
32
|
+
trialIntervalCount: z.ZodOptional<z.ZodNumber>;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
usageCalculationType?: string;
|
|
35
|
+
billingInterval?: string;
|
|
36
|
+
billingIntervalCount?: number;
|
|
37
|
+
trialInterval?: string;
|
|
38
|
+
trialIntervalCount?: number;
|
|
39
|
+
}, {
|
|
40
|
+
usageCalculationType?: string;
|
|
41
|
+
billingInterval?: string;
|
|
42
|
+
billingIntervalCount?: number;
|
|
43
|
+
trialInterval?: string;
|
|
44
|
+
trialIntervalCount?: number;
|
|
45
|
+
}>;
|
|
46
|
+
}, "strip", z.ZodTypeAny, {
|
|
47
|
+
productId?: string;
|
|
48
|
+
plan?: {
|
|
49
|
+
usageCalculationType?: string;
|
|
50
|
+
billingInterval?: string;
|
|
51
|
+
billingIntervalCount?: number;
|
|
52
|
+
trialInterval?: string;
|
|
53
|
+
trialIntervalCount?: number;
|
|
54
|
+
};
|
|
55
|
+
}, {
|
|
56
|
+
productId?: string;
|
|
57
|
+
plan?: {
|
|
58
|
+
usageCalculationType?: string;
|
|
59
|
+
billingInterval?: string;
|
|
60
|
+
billingIntervalCount?: number;
|
|
61
|
+
trialInterval?: string;
|
|
62
|
+
trialIntervalCount?: number;
|
|
63
|
+
};
|
|
64
|
+
}>;
|
|
65
|
+
export type UpdateProductPlanParams = z.infer<typeof UpdateProductPlanZodSchema>;
|
|
66
|
+
export declare function updateProductPlanHandler(context: Context, params: UpdateProductPlanParams): Promise<{
|
|
67
|
+
content: {
|
|
68
|
+
type: "text";
|
|
69
|
+
text: string;
|
|
70
|
+
}[];
|
|
71
|
+
}>;
|
|
72
|
+
//# sourceMappingURL=updateProductPlanHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateProductPlanHandler.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/updateProductPlanHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAK3C,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;CASnC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAoC,CAAC;AAE5E,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAEjF,wBAAsB,wBAAwB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,uBAAuB;;;;;GAoC/F"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ProductNotFoundError, ProductWrongStatusError } from '../../errors.js';
|
|
3
|
+
import { ProductTypes } from '@unchainedshop/core-products';
|
|
4
|
+
import { getNormalizedProductDetails } from '../utils/getNormalizedProductDetails.js';
|
|
5
|
+
export const UpdateProductPlanSchema = {
|
|
6
|
+
productId: z.string().min(1).describe('ID of the product of type PLAN_PRODUCT to update only'),
|
|
7
|
+
plan: z.object({
|
|
8
|
+
usageCalculationType: z.string(),
|
|
9
|
+
billingInterval: z.string(),
|
|
10
|
+
billingIntervalCount: z.number().int().positive().optional(),
|
|
11
|
+
trialInterval: z.string().optional(),
|
|
12
|
+
trialIntervalCount: z.number().int().positive().optional(),
|
|
13
|
+
}),
|
|
14
|
+
};
|
|
15
|
+
export const UpdateProductPlanZodSchema = z.object(UpdateProductPlanSchema);
|
|
16
|
+
export async function updateProductPlanHandler(context, params) {
|
|
17
|
+
const { productId, plan } = params;
|
|
18
|
+
const { modules } = context;
|
|
19
|
+
try {
|
|
20
|
+
const product = await modules.products.findProduct({ productId });
|
|
21
|
+
if (!product)
|
|
22
|
+
throw new ProductNotFoundError({ productId });
|
|
23
|
+
if (product?.type !== ProductTypes.PlanProduct)
|
|
24
|
+
throw new ProductWrongStatusError({
|
|
25
|
+
received: product?.type,
|
|
26
|
+
required: ProductTypes.PlanProduct,
|
|
27
|
+
});
|
|
28
|
+
await modules.products.update(productId, { plan });
|
|
29
|
+
return {
|
|
30
|
+
content: [
|
|
31
|
+
{
|
|
32
|
+
type: 'text',
|
|
33
|
+
text: JSON.stringify({
|
|
34
|
+
product: await getNormalizedProductDetails(productId, context),
|
|
35
|
+
}),
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
return {
|
|
42
|
+
content: [
|
|
43
|
+
{
|
|
44
|
+
type: 'text',
|
|
45
|
+
text: `Error updating product plan: ${error.message}`,
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=updateProductPlanHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateProductPlanHandler.js","sourceRoot":"","sources":["../../../src/mcp/tools/updateProductPlanHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AAEtF,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,uDAAuD,CAAC;IAC9F,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;QACb,oBAAoB,EAAE,CAAC,CAAC,MAAM,EAAE;QAChC,eAAe,EAAE,CAAC,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aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,gCAAiC,KAAe,CAAC,OAAO,EAAE;iBACjE;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Context } from '../../context.js';
|
|
3
|
+
export declare const UpdateProductSupplySchema: {
|
|
4
|
+
productId: z.ZodString;
|
|
5
|
+
supply: z.ZodObject<{
|
|
6
|
+
weightInGram: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
heightInMillimeters: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
lengthInMillimeters: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
widthInMillimeters: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
weightInGram?: number;
|
|
12
|
+
lengthInMillimeters?: number;
|
|
13
|
+
widthInMillimeters?: number;
|
|
14
|
+
heightInMillimeters?: number;
|
|
15
|
+
}, {
|
|
16
|
+
weightInGram?: number;
|
|
17
|
+
lengthInMillimeters?: number;
|
|
18
|
+
widthInMillimeters?: number;
|
|
19
|
+
heightInMillimeters?: number;
|
|
20
|
+
}>;
|
|
21
|
+
};
|
|
22
|
+
export declare const UpdateProductSupplyZodSchema: z.ZodObject<{
|
|
23
|
+
productId: z.ZodString;
|
|
24
|
+
supply: z.ZodObject<{
|
|
25
|
+
weightInGram: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
heightInMillimeters: z.ZodOptional<z.ZodNumber>;
|
|
27
|
+
lengthInMillimeters: z.ZodOptional<z.ZodNumber>;
|
|
28
|
+
widthInMillimeters: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
weightInGram?: number;
|
|
31
|
+
lengthInMillimeters?: number;
|
|
32
|
+
widthInMillimeters?: number;
|
|
33
|
+
heightInMillimeters?: number;
|
|
34
|
+
}, {
|
|
35
|
+
weightInGram?: number;
|
|
36
|
+
lengthInMillimeters?: number;
|
|
37
|
+
widthInMillimeters?: number;
|
|
38
|
+
heightInMillimeters?: number;
|
|
39
|
+
}>;
|
|
40
|
+
}, "strip", z.ZodTypeAny, {
|
|
41
|
+
productId?: string;
|
|
42
|
+
supply?: {
|
|
43
|
+
weightInGram?: number;
|
|
44
|
+
lengthInMillimeters?: number;
|
|
45
|
+
widthInMillimeters?: number;
|
|
46
|
+
heightInMillimeters?: number;
|
|
47
|
+
};
|
|
48
|
+
}, {
|
|
49
|
+
productId?: string;
|
|
50
|
+
supply?: {
|
|
51
|
+
weightInGram?: number;
|
|
52
|
+
lengthInMillimeters?: number;
|
|
53
|
+
widthInMillimeters?: number;
|
|
54
|
+
heightInMillimeters?: number;
|
|
55
|
+
};
|
|
56
|
+
}>;
|
|
57
|
+
export type UpdateProductSupplyParams = z.infer<typeof UpdateProductSupplyZodSchema>;
|
|
58
|
+
export declare function updateProductSupplyHandler(context: Context, params: UpdateProductSupplyParams): Promise<{
|
|
59
|
+
content: {
|
|
60
|
+
type: "text";
|
|
61
|
+
text: string;
|
|
62
|
+
}[];
|
|
63
|
+
}>;
|
|
64
|
+
//# sourceMappingURL=updateProductSupplyHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateProductSupplyHandler.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/updateProductSupplyHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAK3C,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;CAarC,CAAC;AAEF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAsC,CAAC;AAEhF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAErF,wBAAsB,0BAA0B,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,yBAAyB;;;;;GAiCnG"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ProductWrongTypeError } from '../../errors.js';
|
|
3
|
+
import { ProductTypes } from '@unchainedshop/core-products';
|
|
4
|
+
import { getNormalizedProductDetails } from '../utils/getNormalizedProductDetails.js';
|
|
5
|
+
export const UpdateProductSupplySchema = {
|
|
6
|
+
productId: z
|
|
7
|
+
.string()
|
|
8
|
+
.min(1)
|
|
9
|
+
.describe('Product ID of a SIMPLE_PRODUCT only to update supply details for'),
|
|
10
|
+
supply: z
|
|
11
|
+
.object({
|
|
12
|
+
weightInGram: z.number().int().positive().optional(),
|
|
13
|
+
heightInMillimeters: z.number().int().positive().optional(),
|
|
14
|
+
lengthInMillimeters: z.number().int().positive().optional(),
|
|
15
|
+
widthInMillimeters: z.number().int().positive().optional(),
|
|
16
|
+
})
|
|
17
|
+
.describe('Supply (delivery) attributes of the product'),
|
|
18
|
+
};
|
|
19
|
+
export const UpdateProductSupplyZodSchema = z.object(UpdateProductSupplySchema);
|
|
20
|
+
export async function updateProductSupplyHandler(context, params) {
|
|
21
|
+
const { productId, supply } = params;
|
|
22
|
+
const { modules } = context;
|
|
23
|
+
try {
|
|
24
|
+
const product = await modules.products.findProduct({ productId });
|
|
25
|
+
if (product?.type !== ProductTypes.SimpleProduct)
|
|
26
|
+
throw new ProductWrongTypeError({
|
|
27
|
+
productId,
|
|
28
|
+
received: product?.type,
|
|
29
|
+
required: ProductTypes.SimpleProduct,
|
|
30
|
+
});
|
|
31
|
+
await modules.products.update(productId, { supply });
|
|
32
|
+
return {
|
|
33
|
+
content: [
|
|
34
|
+
{
|
|
35
|
+
type: 'text',
|
|
36
|
+
text: JSON.stringify({ product: await getNormalizedProductDetails(productId, context) }),
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
return {
|
|
43
|
+
content: [
|
|
44
|
+
{
|
|
45
|
+
type: 'text',
|
|
46
|
+
text: `Error updating product supply: ${error.message}`,
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=updateProductSupplyHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateProductSupplyHandler.js","sourceRoot":"","sources":["../../../src/mcp/tools/updateProductSupplyHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AAEtF,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,kEAAkE,CAAC;IAC/E,MAAM,EAAE,CAAC;SACN,MAAM,CAAC;QACN,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;QACpD,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;QAC3D,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;QAC3D,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QA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ProductTextsSchema: {
|
|
4
|
+
productId: z.ZodString;
|
|
5
|
+
texts: z.ZodArray<z.ZodObject<{
|
|
6
|
+
locale: z.ZodString;
|
|
7
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
8
|
+
title: z.ZodOptional<z.ZodString>;
|
|
9
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
10
|
+
description: z.ZodOptional<z.ZodString>;
|
|
11
|
+
vendor: z.ZodOptional<z.ZodString>;
|
|
12
|
+
brand: z.ZodOptional<z.ZodString>;
|
|
13
|
+
labels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
description?: string;
|
|
16
|
+
locale?: string;
|
|
17
|
+
title?: string;
|
|
18
|
+
subtitle?: string;
|
|
19
|
+
slug?: string;
|
|
20
|
+
brand?: string;
|
|
21
|
+
vendor?: string;
|
|
22
|
+
labels?: string[];
|
|
23
|
+
}, {
|
|
24
|
+
description?: string;
|
|
25
|
+
locale?: string;
|
|
26
|
+
title?: string;
|
|
27
|
+
subtitle?: string;
|
|
28
|
+
slug?: string;
|
|
29
|
+
brand?: string;
|
|
30
|
+
vendor?: string;
|
|
31
|
+
labels?: string[];
|
|
32
|
+
}>, "atleastone">;
|
|
33
|
+
};
|
|
34
|
+
export declare const UpdateProductTextsZodSchema: z.ZodObject<{
|
|
35
|
+
productId: z.ZodString;
|
|
36
|
+
texts: z.ZodArray<z.ZodObject<{
|
|
37
|
+
locale: z.ZodString;
|
|
38
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
39
|
+
title: z.ZodOptional<z.ZodString>;
|
|
40
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
41
|
+
description: z.ZodOptional<z.ZodString>;
|
|
42
|
+
vendor: z.ZodOptional<z.ZodString>;
|
|
43
|
+
brand: z.ZodOptional<z.ZodString>;
|
|
44
|
+
labels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
45
|
+
}, "strip", z.ZodTypeAny, {
|
|
46
|
+
description?: string;
|
|
47
|
+
locale?: string;
|
|
48
|
+
title?: string;
|
|
49
|
+
subtitle?: string;
|
|
50
|
+
slug?: string;
|
|
51
|
+
brand?: string;
|
|
52
|
+
vendor?: string;
|
|
53
|
+
labels?: string[];
|
|
54
|
+
}, {
|
|
55
|
+
description?: string;
|
|
56
|
+
locale?: string;
|
|
57
|
+
title?: string;
|
|
58
|
+
subtitle?: string;
|
|
59
|
+
slug?: string;
|
|
60
|
+
brand?: string;
|
|
61
|
+
vendor?: string;
|
|
62
|
+
labels?: string[];
|
|
63
|
+
}>, "atleastone">;
|
|
64
|
+
}, "strip", z.ZodTypeAny, {
|
|
65
|
+
productId?: string;
|
|
66
|
+
texts?: [{
|
|
67
|
+
description?: string;
|
|
68
|
+
locale?: string;
|
|
69
|
+
title?: string;
|
|
70
|
+
subtitle?: string;
|
|
71
|
+
slug?: string;
|
|
72
|
+
brand?: string;
|
|
73
|
+
vendor?: string;
|
|
74
|
+
labels?: string[];
|
|
75
|
+
}, ...{
|
|
76
|
+
description?: string;
|
|
77
|
+
locale?: string;
|
|
78
|
+
title?: string;
|
|
79
|
+
subtitle?: string;
|
|
80
|
+
slug?: string;
|
|
81
|
+
brand?: string;
|
|
82
|
+
vendor?: string;
|
|
83
|
+
labels?: string[];
|
|
84
|
+
}[]];
|
|
85
|
+
}, {
|
|
86
|
+
productId?: string;
|
|
87
|
+
texts?: [{
|
|
88
|
+
description?: string;
|
|
89
|
+
locale?: string;
|
|
90
|
+
title?: string;
|
|
91
|
+
subtitle?: string;
|
|
92
|
+
slug?: string;
|
|
93
|
+
brand?: string;
|
|
94
|
+
vendor?: string;
|
|
95
|
+
labels?: string[];
|
|
96
|
+
}, ...{
|
|
97
|
+
description?: string;
|
|
98
|
+
locale?: string;
|
|
99
|
+
title?: string;
|
|
100
|
+
subtitle?: string;
|
|
101
|
+
slug?: string;
|
|
102
|
+
brand?: string;
|
|
103
|
+
vendor?: string;
|
|
104
|
+
labels?: string[];
|
|
105
|
+
}[]];
|
|
106
|
+
}>;
|
|
107
|
+
export type UpdateProductTextsParams = z.infer<typeof UpdateProductTextsZodSchema>;
|
|
108
|
+
export declare function updateProductTextsHandler(context: Context, params: UpdateProductTextsParams): Promise<{
|
|
109
|
+
content: {
|
|
110
|
+
type: "text";
|
|
111
|
+
text: string;
|
|
112
|
+
}[];
|
|
113
|
+
}>;
|
|
114
|
+
//# sourceMappingURL=updateProductTextsHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateProductTextsHandler.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/updateProductTextsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsBpC,CAAC;AAEF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAqC,CAAC;AAE9E,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEnF,wBAAsB,yBAAyB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,wBAAwB;;;;;GA0BjG"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { getNormalizedProductDetails } from '../utils/getNormalizedProductDetails.js';
|
|
3
|
+
export const UpdateProductTextsSchema = {
|
|
4
|
+
productId: z.string().min(1).describe('ID of the product to update texts for'),
|
|
5
|
+
texts: z
|
|
6
|
+
.array(z.object({
|
|
7
|
+
locale: z
|
|
8
|
+
.string()
|
|
9
|
+
.min(2)
|
|
10
|
+
.describe('Locale code like "en", "de" always use locales registered in the system languages, if explicitly provided check if it exists'),
|
|
11
|
+
slug: z.string().optional().describe('URL slug'),
|
|
12
|
+
title: z.string().optional().describe('Product title'),
|
|
13
|
+
subtitle: z.string().optional().describe('Product subtitle'),
|
|
14
|
+
description: z.string().optional().describe('Markdown description'),
|
|
15
|
+
vendor: z.string().optional().describe('Vendor name'),
|
|
16
|
+
brand: z.string().optional().describe('Brand name'),
|
|
17
|
+
labels: z.array(z.string()).optional().describe('Labels or tags'),
|
|
18
|
+
}))
|
|
19
|
+
.nonempty()
|
|
20
|
+
.describe('Localized product text entries'),
|
|
21
|
+
};
|
|
22
|
+
export const UpdateProductTextsZodSchema = z.object(UpdateProductTextsSchema);
|
|
23
|
+
export async function updateProductTextsHandler(context, params) {
|
|
24
|
+
const { productId, texts } = params;
|
|
25
|
+
const { modules } = context;
|
|
26
|
+
try {
|
|
27
|
+
await modules.products.texts.updateTexts(productId, texts);
|
|
28
|
+
return {
|
|
29
|
+
content: [
|
|
30
|
+
{
|
|
31
|
+
type: 'text',
|
|
32
|
+
text: JSON.stringify({
|
|
33
|
+
product: await getNormalizedProductDetails(productId, context),
|
|
34
|
+
}),
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
return {
|
|
41
|
+
content: [
|
|
42
|
+
{
|
|
43
|
+
type: 'text',
|
|
44
|
+
text: `Error updating product texts: ${error.message}`,
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=updateProductTextsHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateProductTextsHandler.js","sourceRoot":"","sources":["../../../src/mcp/tools/updateProductTextsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AAEtF,MAAM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AE,SAAS,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IACpC,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAE5B,IAAI,CAAC;QACH,MAAM,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,KAAc,CAAC,CAAC;QACpE,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wBACnB,OAAO,EAAE,MAAM,2BAA2B,CAAC,SAAS,EAAE,OAAO,CAAC;qBAC/D,CAAC;iBACH;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,iCAAkC,KAAe,CAAC,OAAO,EAAE;iBAClE;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Context } from '../../context.js';
|
|
3
|
+
export declare const UpdateProductTokenizationSchema: {
|
|
4
|
+
productId: z.ZodString;
|
|
5
|
+
tokenization: z.ZodObject<{
|
|
6
|
+
contractAddress: z.ZodString;
|
|
7
|
+
contractStandard: z.ZodString;
|
|
8
|
+
tokenId: z.ZodString;
|
|
9
|
+
supply: z.ZodNumber;
|
|
10
|
+
ercMetadataProperties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
supply?: number;
|
|
13
|
+
contractAddress?: string;
|
|
14
|
+
tokenId?: string;
|
|
15
|
+
contractStandard?: string;
|
|
16
|
+
ercMetadataProperties?: Record<string, any>;
|
|
17
|
+
}, {
|
|
18
|
+
supply?: number;
|
|
19
|
+
contractAddress?: string;
|
|
20
|
+
tokenId?: string;
|
|
21
|
+
contractStandard?: string;
|
|
22
|
+
ercMetadataProperties?: Record<string, any>;
|
|
23
|
+
}>;
|
|
24
|
+
};
|
|
25
|
+
export declare const UpdateProductTokenizationZodSchema: z.ZodObject<{
|
|
26
|
+
productId: z.ZodString;
|
|
27
|
+
tokenization: z.ZodObject<{
|
|
28
|
+
contractAddress: z.ZodString;
|
|
29
|
+
contractStandard: z.ZodString;
|
|
30
|
+
tokenId: z.ZodString;
|
|
31
|
+
supply: z.ZodNumber;
|
|
32
|
+
ercMetadataProperties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
supply?: number;
|
|
35
|
+
contractAddress?: string;
|
|
36
|
+
tokenId?: string;
|
|
37
|
+
contractStandard?: string;
|
|
38
|
+
ercMetadataProperties?: Record<string, any>;
|
|
39
|
+
}, {
|
|
40
|
+
supply?: number;
|
|
41
|
+
contractAddress?: string;
|
|
42
|
+
tokenId?: string;
|
|
43
|
+
contractStandard?: string;
|
|
44
|
+
ercMetadataProperties?: Record<string, any>;
|
|
45
|
+
}>;
|
|
46
|
+
}, "strip", z.ZodTypeAny, {
|
|
47
|
+
productId?: string;
|
|
48
|
+
tokenization?: {
|
|
49
|
+
supply?: number;
|
|
50
|
+
contractAddress?: string;
|
|
51
|
+
tokenId?: string;
|
|
52
|
+
contractStandard?: string;
|
|
53
|
+
ercMetadataProperties?: Record<string, any>;
|
|
54
|
+
};
|
|
55
|
+
}, {
|
|
56
|
+
productId?: string;
|
|
57
|
+
tokenization?: {
|
|
58
|
+
supply?: number;
|
|
59
|
+
contractAddress?: string;
|
|
60
|
+
tokenId?: string;
|
|
61
|
+
contractStandard?: string;
|
|
62
|
+
ercMetadataProperties?: Record<string, any>;
|
|
63
|
+
};
|
|
64
|
+
}>;
|
|
65
|
+
export type UpdateProductTokenizationParams = z.infer<typeof UpdateProductTokenizationZodSchema>;
|
|
66
|
+
export declare function updateProductTokenizationHandler(context: Context, params: UpdateProductTokenizationParams): Promise<{
|
|
67
|
+
content: {
|
|
68
|
+
type: "text";
|
|
69
|
+
text: string;
|
|
70
|
+
}[];
|
|
71
|
+
}>;
|
|
72
|
+
//# sourceMappingURL=updateProductTokenizationHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateProductTokenizationHandler.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/updateProductTokenizationHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAK3C,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;CAS3C,CAAC;AAEF,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA4C,CAAC;AAC5F,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC;AAEjG,wBAAsB,gCAAgC,CACpD,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,+BAA+B;;;;;GAmCxC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ProductTypes } from '@unchainedshop/core-products';
|
|
3
|
+
import { ProductNotFoundError, ProductWrongStatusError } from '../../errors.js';
|
|
4
|
+
import { getNormalizedProductDetails } from '../utils/getNormalizedProductDetails.js';
|
|
5
|
+
export const UpdateProductTokenizationSchema = {
|
|
6
|
+
productId: z.string().min(1).describe('ID of the product of type TOKENIZED_PRODUCT to tokenize only'),
|
|
7
|
+
tokenization: z.object({
|
|
8
|
+
contractAddress: z.string().min(1),
|
|
9
|
+
contractStandard: z.string(),
|
|
10
|
+
tokenId: z.string().min(1),
|
|
11
|
+
supply: z.number().int().positive(),
|
|
12
|
+
ercMetadataProperties: z.record(z.any()).optional(),
|
|
13
|
+
}),
|
|
14
|
+
};
|
|
15
|
+
export const UpdateProductTokenizationZodSchema = z.object(UpdateProductTokenizationSchema);
|
|
16
|
+
export async function updateProductTokenizationHandler(context, params) {
|
|
17
|
+
const { productId, tokenization } = params;
|
|
18
|
+
const { modules } = context;
|
|
19
|
+
try {
|
|
20
|
+
const product = await modules.products.findProduct({ productId });
|
|
21
|
+
if (!product)
|
|
22
|
+
throw new ProductNotFoundError({ productId });
|
|
23
|
+
if (product?.type !== ProductTypes.TokenizedProduct)
|
|
24
|
+
throw new ProductWrongStatusError({
|
|
25
|
+
received: product?.type,
|
|
26
|
+
required: ProductTypes.TokenizedProduct,
|
|
27
|
+
});
|
|
28
|
+
await modules.products.update(productId, { tokenization });
|
|
29
|
+
return {
|
|
30
|
+
content: [
|
|
31
|
+
{
|
|
32
|
+
type: 'text',
|
|
33
|
+
text: JSON.stringify({ product: await getNormalizedProductDetails(productId, context) }),
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
return {
|
|
40
|
+
content: [
|
|
41
|
+
{
|
|
42
|
+
type: 'text',
|
|
43
|
+
text: `Error updating product tokenization: ${error.message}`,
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=updateProductTokenizationHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateProductTokenizationHandler.js","sourceRoot":"","sources":["../../../src/mcp/tools/updateProductTokenizationHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AAEtF,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC7C,SAAS,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