@unchainedshop/api 4.0.0-rc.5 → 4.0.0-rc.6

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.
Files changed (143) hide show
  1. package/lib/errors.d.ts +1 -0
  2. package/lib/errors.d.ts.map +1 -1
  3. package/lib/errors.js +1 -0
  4. package/lib/errors.js.map +1 -1
  5. package/lib/mcp/tools/assortment/addAssortmentMediaUploadHandler.d.ts.map +1 -1
  6. package/lib/mcp/tools/assortment/addAssortmentMediaUploadHandler.js +2 -1
  7. package/lib/mcp/tools/assortment/addAssortmentMediaUploadHandler.js.map +1 -1
  8. package/lib/mcp/tools/assortment/assortmentMediaHandler.d.ts +32 -0
  9. package/lib/mcp/tools/assortment/assortmentMediaHandler.d.ts.map +1 -0
  10. package/lib/mcp/tools/assortment/assortmentMediaHandler.js +48 -0
  11. package/lib/mcp/tools/assortment/assortmentMediaHandler.js.map +1 -0
  12. package/lib/mcp/tools/assortment/index.d.ts.map +1 -1
  13. package/lib/mcp/tools/assortment/index.js +3 -1
  14. package/lib/mcp/tools/assortment/index.js.map +1 -1
  15. package/lib/mcp/tools/assortment/removeAssortmentMediaHandler.d.ts.map +1 -1
  16. package/lib/mcp/tools/assortment/removeAssortmentMediaHandler.js +3 -1
  17. package/lib/mcp/tools/assortment/removeAssortmentMediaHandler.js.map +1 -1
  18. package/lib/mcp/tools/assortment/reorderAssortmentMediaHandler.js +2 -2
  19. package/lib/mcp/tools/assortment/reorderAssortmentMediaHandler.js.map +1 -1
  20. package/lib/mcp/tools/assortment/translatedAssortmentMediaTextsHandler.d.ts.map +1 -1
  21. package/lib/mcp/tools/assortment/translatedAssortmentMediaTextsHandler.js +7 -1
  22. package/lib/mcp/tools/assortment/translatedAssortmentMediaTextsHandler.js.map +1 -1
  23. package/lib/mcp/tools/assortment/updateAssortmentMediaTextsHandler.d.ts.map +1 -1
  24. package/lib/mcp/tools/assortment/updateAssortmentMediaTextsHandler.js +4 -1
  25. package/lib/mcp/tools/assortment/updateAssortmentMediaTextsHandler.js.map +1 -1
  26. package/lib/mcp/tools/product/addProductAssignmentHandler.d.ts.map +1 -1
  27. package/lib/mcp/tools/product/addProductAssignmentHandler.js +1 -1
  28. package/lib/mcp/tools/product/addProductAssignmentHandler.js.map +1 -1
  29. package/lib/mcp/tools/product/addProductBundleItemHandler.d.ts +48 -0
  30. package/lib/mcp/tools/product/addProductBundleItemHandler.d.ts.map +1 -0
  31. package/lib/mcp/tools/product/addProductBundleItemHandler.js +52 -0
  32. package/lib/mcp/tools/product/addProductBundleItemHandler.js.map +1 -0
  33. package/lib/mcp/tools/product/addProductMediaUploadHandler.d.ts.map +1 -1
  34. package/lib/mcp/tools/product/addProductMediaUploadHandler.js +3 -2
  35. package/lib/mcp/tools/product/addProductMediaUploadHandler.js.map +1 -1
  36. package/lib/mcp/tools/product/catalogPriceHandler.d.ts +28 -0
  37. package/lib/mcp/tools/product/catalogPriceHandler.d.ts.map +1 -0
  38. package/lib/mcp/tools/product/catalogPriceHandler.js +57 -0
  39. package/lib/mcp/tools/product/catalogPriceHandler.js.map +1 -0
  40. package/lib/mcp/tools/product/index.d.ts.map +1 -1
  41. package/lib/mcp/tools/product/index.js +27 -3
  42. package/lib/mcp/tools/product/index.js.map +1 -1
  43. package/lib/mcp/tools/product/productAssignmentsHandler.d.ts +24 -0
  44. package/lib/mcp/tools/product/productAssignmentsHandler.d.ts.map +1 -0
  45. package/lib/mcp/tools/product/productAssignmentsHandler.js +79 -0
  46. package/lib/mcp/tools/product/productAssignmentsHandler.js.map +1 -0
  47. package/lib/mcp/tools/product/productBundleItemsHandler.d.ts +20 -0
  48. package/lib/mcp/tools/product/productBundleItemsHandler.d.ts.map +1 -0
  49. package/lib/mcp/tools/product/productBundleItemsHandler.js +45 -0
  50. package/lib/mcp/tools/product/productBundleItemsHandler.js.map +1 -0
  51. package/lib/mcp/tools/product/productMediaHandler.d.ts +32 -0
  52. package/lib/mcp/tools/product/productMediaHandler.d.ts.map +1 -0
  53. package/lib/mcp/tools/product/productMediaHandler.js +46 -0
  54. package/lib/mcp/tools/product/productMediaHandler.js.map +1 -0
  55. package/lib/mcp/tools/product/productSiblingsHandler.d.ts +36 -0
  56. package/lib/mcp/tools/product/productSiblingsHandler.d.ts.map +1 -0
  57. package/lib/mcp/tools/product/productSiblingsHandler.js +66 -0
  58. package/lib/mcp/tools/product/productSiblingsHandler.js.map +1 -0
  59. package/lib/mcp/tools/product/productVariationsHandler.d.ts +20 -0
  60. package/lib/mcp/tools/product/productVariationsHandler.d.ts.map +1 -0
  61. package/lib/mcp/tools/product/productVariationsHandler.js +47 -0
  62. package/lib/mcp/tools/product/productVariationsHandler.js.map +1 -0
  63. package/lib/mcp/tools/product/removeProductBundleItemHandler.d.ts +24 -0
  64. package/lib/mcp/tools/product/removeProductBundleItemHandler.d.ts.map +1 -0
  65. package/lib/mcp/tools/product/removeProductBundleItemHandler.js +46 -0
  66. package/lib/mcp/tools/product/removeProductBundleItemHandler.js.map +1 -0
  67. package/lib/mcp/tools/product/removeProductMediaHandler.js +1 -1
  68. package/lib/mcp/tools/product/removeProductMediaHandler.js.map +1 -1
  69. package/lib/mcp/tools/product/reorderProductMediaHandler.js +2 -2
  70. package/lib/mcp/tools/product/reorderProductMediaHandler.js.map +1 -1
  71. package/lib/mcp/tools/product/simulatedPriceHandler.d.ts +70 -0
  72. package/lib/mcp/tools/product/simulatedPriceHandler.d.ts.map +1 -0
  73. package/lib/mcp/tools/product/simulatedPriceHandler.js +74 -0
  74. package/lib/mcp/tools/product/simulatedPriceHandler.js.map +1 -0
  75. package/lib/mcp/tools/product/simulatedPriceRangeHandler.d.ts +74 -0
  76. package/lib/mcp/tools/product/simulatedPriceRangeHandler.d.ts.map +1 -0
  77. package/lib/mcp/tools/product/simulatedPriceRangeHandler.js +103 -0
  78. package/lib/mcp/tools/product/simulatedPriceRangeHandler.js.map +1 -0
  79. package/lib/mcp/tools/product/translatedProductMediaTextsHandler.d.ts.map +1 -1
  80. package/lib/mcp/tools/product/translatedProductMediaTextsHandler.js +7 -1
  81. package/lib/mcp/tools/product/translatedProductMediaTextsHandler.js.map +1 -1
  82. package/lib/mcp/tools/product/translatedProductVariationTextsHandler.d.ts.map +1 -1
  83. package/lib/mcp/tools/product/translatedProductVariationTextsHandler.js +7 -1
  84. package/lib/mcp/tools/product/translatedProductVariationTextsHandler.js.map +1 -1
  85. package/lib/mcp/tools/product/updateProductMediaTextsHandler.js +1 -1
  86. package/lib/mcp/tools/product/updateProductMediaTextsHandler.js.map +1 -1
  87. package/lib/mcp/tools/product/updateProductPlanHandler.d.ts +47 -26
  88. package/lib/mcp/tools/product/updateProductPlanHandler.d.ts.map +1 -1
  89. package/lib/mcp/tools/product/updateProductPlanHandler.js +23 -7
  90. package/lib/mcp/tools/product/updateProductPlanHandler.js.map +1 -1
  91. package/lib/mcp/tools/product/updateProductVariationTextsHandler.d.ts +73 -0
  92. package/lib/mcp/tools/product/updateProductVariationTextsHandler.d.ts.map +1 -0
  93. package/lib/mcp/tools/product/updateProductVariationTextsHandler.js +52 -0
  94. package/lib/mcp/tools/product/updateProductVariationTextsHandler.js.map +1 -0
  95. package/lib/mcp/tools/product/variationProductsHandler.d.ts +52 -0
  96. package/lib/mcp/tools/product/variationProductsHandler.d.ts.map +1 -0
  97. package/lib/mcp/tools/product/variationProductsHandler.js +54 -0
  98. package/lib/mcp/tools/product/variationProductsHandler.js.map +1 -0
  99. package/lib/mcp/tools/shopInfoHandler.d.ts.map +1 -1
  100. package/lib/mcp/tools/shopInfoHandler.js +4 -2
  101. package/lib/mcp/tools/shopInfoHandler.js.map +1 -1
  102. package/lib/mcp/utils/getNormalizedProductDetails.d.ts +1 -1
  103. package/lib/mcp/utils/getNormalizedProductDetails.d.ts.map +1 -1
  104. package/lib/mcp/utils/getNormalizedProductDetails.js +25 -0
  105. package/lib/mcp/utils/getNormalizedProductDetails.js.map +1 -1
  106. package/lib/resolvers/mutations/filters/createFilter.d.ts.map +1 -1
  107. package/lib/resolvers/mutations/filters/createFilter.js +14 -5
  108. package/lib/resolvers/mutations/filters/createFilter.js.map +1 -1
  109. package/lib/schema/types/product/bundle-product.js +1 -1
  110. package/package.json +6 -6
  111. package/src/errors.ts +5 -0
  112. package/src/mcp/tools/assortment/addAssortmentMediaUploadHandler.ts +2 -1
  113. package/src/mcp/tools/assortment/assortmentMediaHandler.ts +57 -0
  114. package/src/mcp/tools/assortment/index.ts +9 -1
  115. package/src/mcp/tools/assortment/removeAssortmentMediaHandler.ts +3 -1
  116. package/src/mcp/tools/assortment/reorderAssortmentMediaHandler.ts +2 -2
  117. package/src/mcp/tools/assortment/translatedAssortmentMediaTextsHandler.ts +8 -1
  118. package/src/mcp/tools/assortment/updateAssortmentMediaTextsHandler.ts +4 -1
  119. package/src/mcp/tools/product/addProductAssignmentHandler.ts +3 -1
  120. package/src/mcp/tools/product/addProductBundleItemHandler.ts +64 -0
  121. package/src/mcp/tools/product/addProductMediaUploadHandler.ts +3 -2
  122. package/src/mcp/tools/product/catalogPriceHandler.ts +61 -0
  123. package/src/mcp/tools/product/index.ts +104 -3
  124. package/src/mcp/tools/product/productAssignmentsHandler.ts +86 -0
  125. package/src/mcp/tools/product/productBundleItemsHandler.ts +50 -0
  126. package/src/mcp/tools/product/productMediaHandler.ts +53 -0
  127. package/src/mcp/tools/product/productSiblingsHandler.ts +82 -0
  128. package/src/mcp/tools/product/productVariationsHandler.ts +53 -0
  129. package/src/mcp/tools/product/removeProductBundleItemHandler.ts +55 -0
  130. package/src/mcp/tools/product/removeProductMediaHandler.ts +1 -1
  131. package/src/mcp/tools/product/reorderProductMediaHandler.ts +2 -2
  132. package/src/mcp/tools/product/simulatedPriceHandler.ts +82 -0
  133. package/src/mcp/tools/product/simulatedPriceRangeHandler.ts +126 -0
  134. package/src/mcp/tools/product/translatedProductMediaTextsHandler.ts +6 -2
  135. package/src/mcp/tools/product/translatedProductVariationTextsHandler.ts +6 -1
  136. package/src/mcp/tools/product/updateProductMediaTextsHandler.ts +1 -1
  137. package/src/mcp/tools/product/updateProductPlanHandler.ts +37 -7
  138. package/src/mcp/tools/product/updateProductVariationTextsHandler.ts +65 -0
  139. package/src/mcp/tools/product/variationProductsHandler.ts +61 -0
  140. package/src/mcp/tools/shopInfoHandler.ts +4 -2
  141. package/src/mcp/utils/getNormalizedProductDetails.ts +28 -0
  142. package/src/resolvers/mutations/filters/createFilter.ts +11 -6
  143. package/src/schema/types/product/bundle-product.ts +1 -1
@@ -0,0 +1,47 @@
1
+ import { z } from 'zod';
2
+ import { ProductNotFoundError, ProductWrongTypeError } from '../../../errors.js';
3
+ import { log } from '@unchainedshop/logger';
4
+ import { getNormalizedProductDetails } from '../../utils/getNormalizedProductDetails.js';
5
+ export const ProductVariationsSchema = {
6
+ productId: z.string().min(1).describe('ID of the CONFIGURABLE_PRODUCT to retrieve variations from'),
7
+ };
8
+ export const ProductVariationsZodSchema = z.object(ProductVariationsSchema);
9
+ export const productVariationsHandler = async (context, params) => {
10
+ const { productId } = params;
11
+ const { modules, userId } = context;
12
+ try {
13
+ log('handler productVariationsHandler', { userId, productId });
14
+ const product = await getNormalizedProductDetails(productId, context);
15
+ if (!product)
16
+ throw new ProductNotFoundError({ productId });
17
+ if (product.type !== 'CONFIGURABLE_PRODUCT') {
18
+ throw new ProductWrongTypeError({
19
+ productId,
20
+ received: product.type,
21
+ required: 'CONFIGURABLE_PRODUCT',
22
+ });
23
+ }
24
+ const variations = await modules.products.variations.findProductVariations({
25
+ productId,
26
+ });
27
+ return {
28
+ content: [
29
+ {
30
+ type: 'text',
31
+ text: JSON.stringify({ product, variations }),
32
+ },
33
+ ],
34
+ };
35
+ }
36
+ catch (error) {
37
+ return {
38
+ content: [
39
+ {
40
+ type: 'text',
41
+ text: `Error fetching variations: ${error.message}`,
42
+ },
43
+ ],
44
+ };
45
+ }
46
+ };
47
+ //# sourceMappingURL=productVariationsHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"productVariationsHandler.js","sourceRoot":"","sources":["../../../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C;YACzE,SAAS;SACV,CAAC,CAAC;QAEH,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;iBAC9C;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,8BAA+B,KAAe,CAAC,OAAO,EAAE;iBAC/D;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+ import { Context } from '../../../context.js';
3
+ export declare const RemoveProductBundleItemSchema: {
4
+ productId: z.ZodString;
5
+ index: z.ZodNumber;
6
+ };
7
+ export declare const RemoveProductBundleItemZodSchema: z.ZodObject<{
8
+ productId: z.ZodString;
9
+ index: z.ZodNumber;
10
+ }, "strip", z.ZodTypeAny, {
11
+ index?: number;
12
+ productId?: string;
13
+ }, {
14
+ index?: number;
15
+ productId?: string;
16
+ }>;
17
+ export type RemoveProductBundleItemParams = z.infer<typeof RemoveProductBundleItemZodSchema>;
18
+ export declare const removeProductBundleItemHandler: (context: Context, params: RemoveProductBundleItemParams) => Promise<{
19
+ content: {
20
+ type: "text";
21
+ text: string;
22
+ }[];
23
+ }>;
24
+ //# sourceMappingURL=removeProductBundleItemHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"removeProductBundleItemHandler.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/product/removeProductBundleItemHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAM9C,eAAO,MAAM,6BAA6B;;;CAGzC,CAAC;AAEF,eAAO,MAAM,gCAAgC;;;;;;;;;EAA0C,CAAC;AAExF,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAE7F,eAAO,MAAM,8BAA8B,GACzC,SAAS,OAAO,EAChB,QAAQ,6BAA6B;;;;;EAoCtC,CAAC"}
@@ -0,0 +1,46 @@
1
+ import { z } from 'zod';
2
+ import { ProductNotFoundError, ProductWrongTypeError } from '../../../errors.js';
3
+ import { log } from '@unchainedshop/logger';
4
+ import { getNormalizedProductDetails } from '../../utils/getNormalizedProductDetails.js';
5
+ import { ProductTypes } from '@unchainedshop/core-products';
6
+ export const RemoveProductBundleItemSchema = {
7
+ productId: z.string().min(1).describe('ID of the BUNDLE_PRODUCT from which the item will be removed'),
8
+ index: z.number().int().min(0).describe('0-based index of the bundle item to remove'),
9
+ };
10
+ export const RemoveProductBundleItemZodSchema = z.object(RemoveProductBundleItemSchema);
11
+ export const removeProductBundleItemHandler = async (context, params) => {
12
+ const { modules, userId } = context;
13
+ const { productId, index } = params;
14
+ log('handler removeProductBundleItemHandler', { userId, params });
15
+ try {
16
+ const product = await modules.products.findProduct({ productId });
17
+ if (!product)
18
+ throw new ProductNotFoundError({ productId });
19
+ if (product.type !== ProductTypes.BundleProduct)
20
+ throw new ProductWrongTypeError({
21
+ productId,
22
+ received: product.type,
23
+ required: ProductTypes.BundleProduct,
24
+ });
25
+ await modules.products.bundleItems.removeBundleItem(productId, index);
26
+ return {
27
+ content: [
28
+ {
29
+ type: 'text',
30
+ text: JSON.stringify({ product: await getNormalizedProductDetails(productId, context) }),
31
+ },
32
+ ],
33
+ };
34
+ }
35
+ catch (error) {
36
+ return {
37
+ content: [
38
+ {
39
+ type: 'text',
40
+ text: `Error removing bundle item: ${error.message}`,
41
+ },
42
+ ],
43
+ };
44
+ }
45
+ };
46
+ //# sourceMappingURL=removeProductBundleItemHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"removeProductBundleItemHandler.js","sourceRoot":"","sources":["../../../../src/mcp/tools/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qB,CAAC;gBAC9B,SAAS;gBACT,QAAQ,EAAE,OAAO,CAAC,IAAI;gBACtB,QAAQ,EAAE,YAAY,CAAC,aAAa;aACrC,CAAC,CAAC;QAEL,MAAM,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,gBAAgB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QACtE,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC;iBACzF;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,+BAAgC,KAAe,CAAC,OAAO,EAAE;iBAChE;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC,CAAC"}
@@ -22,7 +22,7 @@ export async function removeProductMediaHandler(context, params) {
22
22
  {
23
23
  type: 'text',
24
24
  text: JSON.stringify({
25
- media: productMedia,
25
+ success: true,
26
26
  }),
27
27
  },
28
28
  ],
@@ -1 +1 @@
1
- {"version":3,"file":"removeProductMediaHandler.js","sourceRoot":"","sources":["../../../../src/mcp/tools/product/removeProductMediaHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,uCAAuC,CAAC;CACpF,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC;AAI9E,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,OAAgB,EAAE,MAAgC;IAChG,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC;IAClC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAEpC,IAAI,CAAC;QACH,GAAG,CAAC,mCAAmC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QAE7D,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,gBAAgB,CAAC;YACjE,cAAc;SACf,CAAC,CAAC;QACH,IAAI,CAAC,YAAY;YAAE,MAAM,IAAI,yBAAyB,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC;QAE3E,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACjD,MAAM,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;QAEpD,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wBACnB,KAAK,EAAE,YAAY;qBACpB,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"}
1
+ {"version":3,"file":"removeProductMediaHandler.js","sourceRoot":"","sources":["../../../../src/mcp/tools/product/removeProductMediaHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,yBA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IACJ,CAAC;AACH,CAAC"}
@@ -15,12 +15,12 @@ export async function reorderProductMediaHandler(context, params) {
15
15
  const { modules, userId } = context;
16
16
  try {
17
17
  log('handler reorderProductMediaHandler', { userId, params });
18
- const reorderedMedia = await modules.products.media.updateManualOrder({ sortKeys: sortKeys });
18
+ const media = await modules.products.media.updateManualOrder({ sortKeys: sortKeys });
19
19
  return {
20
20
  content: [
21
21
  {
22
22
  type: 'text',
23
- text: JSON.stringify({ reorderedMedia }, null, 2),
23
+ text: JSON.stringify({ media }, null, 2),
24
24
  },
25
25
  ],
26
26
  };
@@ -1 +1 @@
1
- {"version":3,"file":"reorderProductMediaHandler.js","sourceRoot":"","sources":["../../../../src/mcp/tools/product/reorderProductMediaHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,QAAQ,EAAE,CAAC;SACR,KAAK,CACJ,CAAC,CAAC,MAAM,CAAC;QACP,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,uBAAuB,CAAC;QACnE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;KAChE,CAAC,CACH;SACA,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,kDAAkD,CAAC;CAChE,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC;AAIhF,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAAC,OAAgB,EAAE,MAAiC;IAClG,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IAC5B,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAEpC,IAAI,CAAC;QACH,GAAG,CAAC,oCAAoC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QAE9D,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAAE,QAAQ,EAAE,QAAe,EAAE,CAAC,CAAC;QAErG,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,cAAc,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;iBAClD;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,mCAAoC,KAAe,CAAC,OAAO,EAAE;iBACpE;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"reorderProductMediaHandler.js","sourceRoot":"","sources":["../../../../src/mcp/tools/product/reorderProductMediaHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,QAAQ,EAAE,CAAC;SACR,KAAK,CACJ,CAAC,CAAC,MAAM,CAAC;QACP,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,uBAAuB,CAAC;QACnE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;KAChE,CAAC,CACH;SACA,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,kDAAkD,CAAC;CAChE,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC;AAIhF,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAAC,OAAgB,EAAE,MAAiC;IAClG,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IAC5B,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAEpC,IAAI,CAAC;QACH,GAAG,CAAC,oCAAoC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QAE9D,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAAE,QAAQ,EAAE,QAAe,EAAE,CAAC,CAAC;QAE5F,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;iBACzC;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,mCAAoC,KAAe,CAAC,OAAO,EAAE;iBACpE;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,70 @@
1
+ import { Context } from '../../../context.js';
2
+ import { z } from 'zod';
3
+ export declare const ProductConfigurationParameterInputSchema: z.ZodObject<{
4
+ key: z.ZodString;
5
+ value: z.ZodString;
6
+ }, "strip", z.ZodTypeAny, {
7
+ key?: string;
8
+ value?: string;
9
+ }, {
10
+ key?: string;
11
+ value?: string;
12
+ }>;
13
+ export declare const SimulatedPriceSchema: {
14
+ productId: z.ZodString;
15
+ quantity: z.ZodDefault<z.ZodNumber>;
16
+ currencyCode: z.ZodOptional<z.ZodString>;
17
+ useNetPrice: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
18
+ configuration: z.ZodOptional<z.ZodArray<z.ZodObject<{
19
+ key: z.ZodString;
20
+ value: z.ZodString;
21
+ }, "strip", z.ZodTypeAny, {
22
+ key?: string;
23
+ value?: string;
24
+ }, {
25
+ key?: string;
26
+ value?: string;
27
+ }>, "many">>;
28
+ };
29
+ export declare const SimulatedPriceZodSchema: z.ZodObject<{
30
+ productId: z.ZodString;
31
+ quantity: z.ZodDefault<z.ZodNumber>;
32
+ currencyCode: z.ZodOptional<z.ZodString>;
33
+ useNetPrice: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
34
+ configuration: z.ZodOptional<z.ZodArray<z.ZodObject<{
35
+ key: z.ZodString;
36
+ value: z.ZodString;
37
+ }, "strip", z.ZodTypeAny, {
38
+ key?: string;
39
+ value?: string;
40
+ }, {
41
+ key?: string;
42
+ value?: string;
43
+ }>, "many">>;
44
+ }, "strip", z.ZodTypeAny, {
45
+ productId?: string;
46
+ configuration?: {
47
+ key?: string;
48
+ value?: string;
49
+ }[];
50
+ currencyCode?: string;
51
+ quantity?: number;
52
+ useNetPrice?: boolean;
53
+ }, {
54
+ productId?: string;
55
+ configuration?: {
56
+ key?: string;
57
+ value?: string;
58
+ }[];
59
+ currencyCode?: string;
60
+ quantity?: number;
61
+ useNetPrice?: boolean;
62
+ }>;
63
+ export type SimulatedPriceParams = z.infer<typeof SimulatedPriceZodSchema>;
64
+ export declare function simulatedPriceHandler(context: Context, params: SimulatedPriceParams): Promise<{
65
+ content: {
66
+ type: "text";
67
+ text: string;
68
+ }[];
69
+ }>;
70
+ //# sourceMappingURL=simulatedPriceHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simulatedPriceHandler.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/product/simulatedPriceHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAG9C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,wCAAwC;;;;;;;;;EAGnD,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;CAkBhC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAiC,CAAC;AAEtE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE3E,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,oBAAoB;;;;;GA8CzF"}
@@ -0,0 +1,74 @@
1
+ import { ProductNotFoundError } from '../../../errors.js';
2
+ import { log } from '@unchainedshop/logger';
3
+ import { z } from 'zod';
4
+ import { getNormalizedProductDetails } from '../../utils/getNormalizedProductDetails.js';
5
+ export const ProductConfigurationParameterInputSchema = z.object({
6
+ key: z.string().min(1).describe('Configuration attribute key'),
7
+ value: z.string().min(1).describe('Configuration attribute value'),
8
+ });
9
+ export const SimulatedPriceSchema = {
10
+ productId: z.string().min(1).describe('ID of the product for which to simulate pricing'),
11
+ quantity: z
12
+ .number()
13
+ .int()
14
+ .positive()
15
+ .default(1)
16
+ .describe('Quantity to simulate price for (default is 1)'),
17
+ currencyCode: z.string().optional().describe('Currency code for price simulation (e.g., "USD")'),
18
+ useNetPrice: z
19
+ .boolean()
20
+ .optional()
21
+ .default(false)
22
+ .describe('If true, returns net price; otherwise, returns gross price'),
23
+ configuration: z
24
+ .array(ProductConfigurationParameterInputSchema)
25
+ .optional()
26
+ .describe('Complete configuration vector (e.g., Color: Red, Size: M)'),
27
+ };
28
+ export const SimulatedPriceZodSchema = z.object(SimulatedPriceSchema);
29
+ export async function simulatedPriceHandler(context, params) {
30
+ const { userId, countryCode, user, services } = context;
31
+ const { productId, quantity, configuration, currencyCode: forcedCurrencyCode, useNetPrice } = params;
32
+ try {
33
+ log('handler simulatedPriceHandler', { userId, params });
34
+ const product = await getNormalizedProductDetails(productId, context);
35
+ if (!product)
36
+ throw new ProductNotFoundError({ productId });
37
+ const currencyCode = forcedCurrencyCode || context.currencyCode;
38
+ const pricingContext = {
39
+ product,
40
+ user,
41
+ countryCode,
42
+ currencyCode,
43
+ quantity,
44
+ configuration,
45
+ };
46
+ const pricing = await services.products.simulateProductPricing(pricingContext);
47
+ const unitPrice = pricing.unitPrice({ useNetPrice });
48
+ const price = {
49
+ ...unitPrice,
50
+ isNetPrice: useNetPrice,
51
+ isTaxable: pricing.taxSum() > 0,
52
+ currencyCode: pricing.currencyCode,
53
+ };
54
+ return {
55
+ content: [
56
+ {
57
+ type: 'text',
58
+ text: JSON.stringify({ product, price }),
59
+ },
60
+ ],
61
+ };
62
+ }
63
+ catch (error) {
64
+ return {
65
+ content: [
66
+ {
67
+ type: 'text',
68
+ text: `Error simulating price: ${error.message}`,
69
+ },
70
+ ],
71
+ };
72
+ }
73
+ }
74
+ //# sourceMappingURL=simulatedPriceHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simulatedPriceHandler.js","sourceRoot":"","sources":["../../../../src/mcp/tools/product/simulatedPriceHandler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AAEzF,MAAM,CAAC,MAAM,wCAAwC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/D,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,6BAA6B,CAAC;IAC9D,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,+BAA+B,CAAC;CACnE,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE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,OAAO;YACP,IAAI;YACJ,WAAW;YACX,YAAY;YACZ,QAAQ;YACR,aAAa;SACd,CAAC;QACF,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC,sBAAsB,CAAC,cAAqB,CAAC,CAAC;QACtF,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC;QAErD,MAAM,KAAK,GAAG;YACZ,GAAG,SAAS;YACZ,UAAU,EAAE,WAAW;YACvB,SAAS,EAAE,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;YAC/B,YAAY,EAAE,OAAO,CAAC,YAAY;SACnC,CAAC;QAEF,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;iBACzC;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,2BAA4B,KAAe,CAAC,OAAO,EAAE;iBAC5D;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,74 @@
1
+ import { Context } from '../../../context.js';
2
+ import { z } from 'zod';
3
+ export declare const ProductAssignmentVectorInputSchema: z.ZodObject<{
4
+ key: z.ZodString;
5
+ value: z.ZodString;
6
+ }, "strip", z.ZodTypeAny, {
7
+ key?: string;
8
+ value?: string;
9
+ }, {
10
+ key?: string;
11
+ value?: string;
12
+ }>;
13
+ export declare const SimulatedPriceRangeSchema: {
14
+ productId: z.ZodString;
15
+ quantity: z.ZodOptional<z.ZodNumber>;
16
+ vectors: z.ZodOptional<z.ZodArray<z.ZodObject<{
17
+ key: z.ZodString;
18
+ value: z.ZodString;
19
+ }, "strip", z.ZodTypeAny, {
20
+ key?: string;
21
+ value?: string;
22
+ }, {
23
+ key?: string;
24
+ value?: string;
25
+ }>, "many">>;
26
+ includeInactive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
27
+ currencyCode: z.ZodOptional<z.ZodString>;
28
+ useNetPrice: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
29
+ };
30
+ export declare const SimulatedPriceRangeZodSchema: z.ZodObject<{
31
+ productId: z.ZodString;
32
+ quantity: z.ZodOptional<z.ZodNumber>;
33
+ vectors: z.ZodOptional<z.ZodArray<z.ZodObject<{
34
+ key: z.ZodString;
35
+ value: z.ZodString;
36
+ }, "strip", z.ZodTypeAny, {
37
+ key?: string;
38
+ value?: string;
39
+ }, {
40
+ key?: string;
41
+ value?: string;
42
+ }>, "many">>;
43
+ includeInactive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
44
+ currencyCode: z.ZodOptional<z.ZodString>;
45
+ useNetPrice: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
46
+ }, "strip", z.ZodTypeAny, {
47
+ productId?: string;
48
+ includeInactive?: boolean;
49
+ currencyCode?: string;
50
+ quantity?: number;
51
+ vectors?: {
52
+ key?: string;
53
+ value?: string;
54
+ }[];
55
+ useNetPrice?: boolean;
56
+ }, {
57
+ productId?: string;
58
+ includeInactive?: boolean;
59
+ currencyCode?: string;
60
+ quantity?: number;
61
+ vectors?: {
62
+ key?: string;
63
+ value?: string;
64
+ }[];
65
+ useNetPrice?: boolean;
66
+ }>;
67
+ export type SimulatedPriceRangeParams = z.infer<typeof SimulatedPriceRangeZodSchema>;
68
+ export declare function simulatedPriceRangeHandler(context: Context, params: SimulatedPriceRangeParams): Promise<{
69
+ content: {
70
+ type: "text";
71
+ text: string;
72
+ }[];
73
+ }>;
74
+ //# sourceMappingURL=simulatedPriceRangeHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simulatedPriceRangeHandler.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/product/simulatedPriceRangeHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,kCAAkC;;;;;;;;;EAG7C,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;CA0BrC,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;;;;;GAkFnG"}
@@ -0,0 +1,103 @@
1
+ import { log } from '@unchainedshop/logger';
2
+ import { z } from 'zod';
3
+ import { ProductWrongTypeError } from '../../../errors.js';
4
+ import { getNormalizedProductDetails } from '../../utils/getNormalizedProductDetails.js';
5
+ export const ProductAssignmentVectorInputSchema = z.object({
6
+ key: z.string().min(1).describe('Variation attribute key (e.g., "Color")'),
7
+ value: z.string().min(1).describe('Variation attribute value (e.g., "Red")'),
8
+ });
9
+ export const SimulatedPriceRangeSchema = {
10
+ productId: z.string().min(1).describe('ID of the CONFIGURABLE_PRODUCT to simulate price range for'),
11
+ quantity: z
12
+ .number()
13
+ .int()
14
+ .positive()
15
+ .optional()
16
+ .describe('Desired quantity for price simulation (default is 1)'),
17
+ vectors: z
18
+ .array(ProductAssignmentVectorInputSchema)
19
+ .optional()
20
+ .describe('Optional variation key-value pairs (e.g., Color: Red) to simulate specific variant'),
21
+ includeInactive: z
22
+ .boolean()
23
+ .optional()
24
+ .default(false)
25
+ .describe('Whether to include inactive variants'),
26
+ currencyCode: z
27
+ .string()
28
+ .optional()
29
+ .describe('Currency code to simulate pricing with (e.g., "USD", "EUR")'),
30
+ useNetPrice: z
31
+ .boolean()
32
+ .optional()
33
+ .default(false)
34
+ .describe('Return net price if true, otherwise gross price'),
35
+ };
36
+ export const SimulatedPriceRangeZodSchema = z.object(SimulatedPriceRangeSchema);
37
+ export async function simulatedPriceRangeHandler(context, params) {
38
+ const { productId, quantity, vectors, includeInactive, currencyCode: forcedCurrencyCode, useNetPrice, } = params;
39
+ const { modules, userId, countryCode, services } = context;
40
+ try {
41
+ log('handler simulatedPriceRangeHandler', { userId, params });
42
+ const currencyCode = forcedCurrencyCode || context.currencyCode;
43
+ const product = await getNormalizedProductDetails(productId, context);
44
+ if (product.type !== 'CONFIGURABLE_PRODUCT') {
45
+ throw new ProductWrongTypeError({
46
+ productId,
47
+ received: product.type,
48
+ required: 'CONFIGURABLE_PRODUCT',
49
+ });
50
+ }
51
+ const products = await modules.products.proxyProducts(product, vectors, {
52
+ includeInactive,
53
+ });
54
+ const filteredPrices = (await Promise.all(products.map(async (proxyProduct) => {
55
+ const pricingContext = {
56
+ product: proxyProduct,
57
+ user: context.user,
58
+ countryCode,
59
+ currencyCode,
60
+ quantity,
61
+ };
62
+ const pricing = await services.products.simulateProductPricing(pricingContext);
63
+ if (!pricing)
64
+ return null;
65
+ const unitPrice = pricing.unitPrice({ useNetPrice });
66
+ return {
67
+ ...unitPrice,
68
+ isNetPrice: useNetPrice,
69
+ isTaxable: pricing.taxSum() > 0,
70
+ currencyCode: pricing.currencyCode,
71
+ };
72
+ }))).filter(Boolean);
73
+ if (!filteredPrices.length)
74
+ return null;
75
+ const { minPrice, maxPrice } = modules.products.prices.priceRange({
76
+ productId: product._id,
77
+ prices: filteredPrices,
78
+ });
79
+ const priceRange = {
80
+ minPrice,
81
+ maxPrice,
82
+ };
83
+ return {
84
+ content: [
85
+ {
86
+ type: 'text',
87
+ text: JSON.stringify({ product, priceRange }),
88
+ },
89
+ ],
90
+ };
91
+ }
92
+ catch (error) {
93
+ return {
94
+ content: [
95
+ {
96
+ type: 'text',
97
+ text: `Error simulating price range: ${error.message}`,
98
+ },
99
+ ],
100
+ };
101
+ }
102
+ }
103
+ //# sourceMappingURL=simulatedPriceRangeHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simulatedPriceRangeHandler.js","sourceRoot":"","sources":["../../../../src/mcp/tools/product/simulatedPriceRangeHandler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AAEzF,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,CAAC,MAAM,CAAC;IACzD,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,yCAAyC,CAAC;IAC1E,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,yCAAyC,CAAC;CAC7E,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,4DAA4D,CAAC;IACnG,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,QAAQ,EAAE;SACV,QAAQ,CAAC,sDAAsD,CAAC;IACnE,OAAO,EAAE,CAAC;SACP,KAAK,CAAC,kCAAkC,CAAC;SACzC,QAAQ,EAAE;SACV,QAAQ,CAAC,oFAAoF,CAAC;IACjG,eAAe,EAAE,CAAC;SACf,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,OAAO,CAAC,KAAK,CAAC;SACd,QAAQ,CAAC,sCAAsC,CAAC;IACnD,YAAY,EAAE,CAAC;SACZ,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,6DAA6D,CAAC;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":["../../../../src/mcp/tools/product/translatedProductMediaTextsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAG9C,eAAO,MAAM,iCAAiC;;CAE7C,CAAC;AAEF,eAAO,MAAM,oCAAoC;;;;;;EAA8C,CAAC;AAEhG,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC;AAErG,wBAAsB,kCAAkC,CACtD,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,iCAAiC;;;;;GA4B1C"}
1
+ {"version":3,"file":"translatedProductMediaTextsHandler.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/product/translatedProductMediaTextsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAI9C,eAAO,MAAM,iCAAiC;;CAE7C,CAAC;AAEF,eAAO,MAAM,oCAAoC;;;;;;EAA8C,CAAC;AAEhG,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC;AAErG,wBAAsB,kCAAkC,CACtD,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,iCAAiC;;;;;GA+B1C"}
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { log } from '@unchainedshop/logger';
3
+ import { ProductMediaNotFoundError } from '../../../errors.js';
3
4
  export const TranslatedProductMediaTextsSchema = {
4
5
  productMediaId: z.string().min(1).describe('ID of the product media to fetch translated texts for'),
5
6
  };
@@ -9,12 +10,17 @@ export async function translatedProductMediaTextsHandler(context, params) {
9
10
  const { modules, userId } = context;
10
11
  try {
11
12
  log(`handler translatedProductMediaTexts`, { userId, params });
13
+ const productMedia = await modules.products.media.findProductMedia({
14
+ productMediaId,
15
+ });
16
+ if (!productMedia)
17
+ throw new ProductMediaNotFoundError({ productMediaId });
12
18
  const texts = await modules.products.media.texts.findMediaTexts({ productMediaId });
13
19
  return {
14
20
  content: [
15
21
  {
16
22
  type: 'text',
17
- text: JSON.stringify({ texts }),
23
+ text: JSON.stringify({ texts, productId: productMedia.productId }),
18
24
  },
19
25
  ],
20
26
  };
@@ -1 +1 @@
1
- {"version":3,"file":"translatedProductMediaTextsHandler.js","sourceRoot":"","sources":["../../../../src/mcp/tools/product/translatedProductMediaTextsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,MAAM,CAAC,MAAM,iCAAiC,GAAG;IAC/C,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,uDAAuD,CAAC;CACpG,CAAC;AAEF,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,CAAC,MAAM,CAAC,iCAAiC,CAAC,CAAC;AAIhG,MAAM,CAAC,KAAK,UAAU,kCAAkC,CACtD,OAAgB,EAChB,MAAyC;IAEzC,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC;IAClC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAEpC,IAAI,CAAC;QACH,GAAG,CAAC,qCAAqC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QAE/D,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC;QAEpF,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC;iBAChC;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,iDAAkD,KAAe,CAAC,OAAO,EAAE;iBAClF;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"translatedProductMediaTextsHandler.js","sourceRoot":"","sources":["../../../../src/mcp/tools/product/translatedProductMediaTextsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,CAAC,MAAM,iCAAiC,GAAG;IAC/C,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,uDAAuD,CAAC;CACpG,CAAC;AAEF,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,CAAC,MAAM,CAAC,iCAAiC,CAAC,CAAC;AAIhG,MAAM,CAAC,KAAK,UAAU,kCAAkC,CACtD,OAAgB,EAChB,MAAyC;IAEzC,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC;IAClC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAEpC,IAAI,CAAC;QACH,GAAG,CAAC,qCAAqC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QAC/D,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,gBAAgB,CAAC;YACjE,cAAc;SACf,CAAC,CAAC;QACH,IAAI,CAAC,YAAY;YAAE,MAAM,IAAI,yBAAyB,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC;QAC3E,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC;QAEpF,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,CAAC,SAAS,EAAE,CAAC;iBACnE;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,iDAAkD,KAAe,CAAC,OAAO,EAAE;iBAClF;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"translatedProductVariationTextsHandler.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/product/translatedProductVariationTextsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAG9C,eAAO,MAAM,qCAAqC;;;CAMjD,CAAC;AAEF,eAAO,MAAM,wCAAwC;;;;;;;;;EAAkD,CAAC;AAExG,MAAM,MAAM,qCAAqC,GAAG,CAAC,CAAC,KAAK,CACzD,OAAO,wCAAwC,CAChD,CAAC;AAEF,wBAAsB,sCAAsC,CAC1D,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,qCAAqC;;;;;GAkC9C"}
1
+ {"version":3,"file":"translatedProductVariationTextsHandler.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/product/translatedProductVariationTextsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAI9C,eAAO,MAAM,qCAAqC;;;CAMjD,CAAC;AAEF,eAAO,MAAM,wCAAwC;;;;;;;;;EAAkD,CAAC;AAExG,MAAM,MAAM,qCAAqC,GAAG,CAAC,CAAC,KAAK,CACzD,OAAO,wCAAwC,CAChD,CAAC;AAEF,wBAAsB,sCAAsC,CAC1D,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,qCAAqC;;;;;GAsC9C"}
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { log } from '@unchainedshop/logger';
3
+ import { ProductVariationNotFoundError } from '../../../errors.js';
3
4
  export const TranslatedProductVariationTextsSchema = {
4
5
  productVariationId: z.string().min(1).describe('ID of the product variation'),
5
6
  productVariationOptionValue: z
@@ -16,6 +17,11 @@ export async function translatedProductVariationTextsHandler(context, params) {
16
17
  userId,
17
18
  params,
18
19
  });
20
+ const productVariation = await modules.products.variations.findProductVariation({
21
+ productVariationId,
22
+ });
23
+ if (!productVariation)
24
+ throw new ProductVariationNotFoundError({ productVariationId });
19
25
  const texts = await modules.products.variations.texts.findVariationTexts({
20
26
  productVariationId,
21
27
  productVariationOptionValue,
@@ -24,7 +30,7 @@ export async function translatedProductVariationTextsHandler(context, params) {
24
30
  content: [
25
31
  {
26
32
  type: 'text',
27
- text: JSON.stringify({ texts }),
33
+ text: JSON.stringify({ texts, productId: productVariation.productId }),
28
34
  },
29
35
  ],
30
36
  };
@@ -1 +1 @@
1
- {"version":3,"file":"translatedProductVariationTextsHandler.js","sourceRoot":"","sources":["../../../../src/mcp/tools/product/translatedProductVariationTextsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,MAAM,CAAC,MAAM,qCAAqC,GAAG;IACnD,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,6BAA6B,CAAC;IAC7E,2BAA2B,EAAE,CAAC;SAC3B,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,0CAA0C,CAAC;CACxD,CAAC;AAEF,MAAM,CAAC,MAAM,wCAAwC,GAAG,CAAC,CAAC,MAAM,CAAC,qCAAqC,CAAC,CAAC;AAMxG,MAAM,CAAC,KAAK,UAAU,sCAAsC,CAC1D,OAAgB,EAChB,MAA6C;IAE7C,MAAM,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,GAAG,MAAM,CAAC;IACnE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAEpC,IAAI,CAAC;QACH,GAAG,CAAC,yCAAyC,EAAE;YAC7C,MAAM;YACN,MAAM;SACP,CAAC,CAAC;QAEH,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,kBAAkB,CAAC;YACvE,kBAAkB;YAClB,2BAA2B;SAC5B,CAAC,CAAC;QAEH,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC;iBAChC;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,qDAAsD,KAAe,CAAC,OAAO,EAAE;iBACtF;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"translatedProductVariationTextsHandler.js","sourceRoot":"","sources":["../../../../src/mcp/tools/product/translatedProductVariationTextsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AAEnE,MAAM,CAAC,MAAM,qCAAqC,GAAG;IACnD,kBAAkB,EAAE,CAAC,CAAC,MAAM,E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AE;iBACtF;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -31,7 +31,7 @@ export async function updateProductMediaTextsHandler(context, params) {
31
31
  content: [
32
32
  {
33
33
  type: 'text',
34
- text: JSON.stringify({ texts: updatedTexts }),
34
+ text: JSON.stringify({ texts: updatedTexts, productId: productMedia.productId }),
35
35
  },
36
36
  ],
37
37
  };
@@ -1 +1 @@
1
- {"version":3,"file":"updateProductMediaTextsHandler.js","sourceRoot":"","sources":["../../../../src/mcp/tools/product/updateProductMediaTextsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,iCAAiC,CAAC;IAC7E,KAAK,EAAE,CAAC;SACL,KAAK,CACJ,CAAC,CAAC,MAAM,CAAC;QACP,MAAM,EAAE,CAAC;aACN,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CACP,yKAAyK,CAC1K;QACH,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;QAClE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;KACzE,CAAC,CACH;SACA,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,mCAAmC,CAAC;CACjD,CAAC;AAEF,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,MAAM,CAAC,6BAA6B,CAAC,CAAC;AAIxF,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAClD,OAAgB,EAChB,MAAqC;IAErC,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IACzC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAEpC,IAAI,CAAC;QACH,GAAG,CAAC,wCAAwC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QAClE,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,gBAAgB,CAAC;YACjE,cAAc;SACf,CAAC,CAAC;QACH,IAAI,CAAC,YAAY;YAAE,MAAM,IAAI,yBAAyB,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC;QAE3E,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,gBAAgB,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;QAEhG,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC;iBAC9C;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,uCAAwC,KAAe,CAAC,OAAO,EAAE;iBACxE;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"updateProductMediaTextsHandler.js","sourceRoot":"","sources":["../../../../src/mcp/tools/product/updateProductMediaTextsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,cAAc,EAAE,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