@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.
- 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/mcp/tools/assortment/addAssortmentMediaUploadHandler.d.ts.map +1 -1
- package/lib/mcp/tools/assortment/addAssortmentMediaUploadHandler.js +2 -1
- package/lib/mcp/tools/assortment/addAssortmentMediaUploadHandler.js.map +1 -1
- package/lib/mcp/tools/assortment/assortmentMediaHandler.d.ts +32 -0
- package/lib/mcp/tools/assortment/assortmentMediaHandler.d.ts.map +1 -0
- package/lib/mcp/tools/assortment/assortmentMediaHandler.js +48 -0
- package/lib/mcp/tools/assortment/assortmentMediaHandler.js.map +1 -0
- package/lib/mcp/tools/assortment/index.d.ts.map +1 -1
- package/lib/mcp/tools/assortment/index.js +3 -1
- package/lib/mcp/tools/assortment/index.js.map +1 -1
- package/lib/mcp/tools/assortment/removeAssortmentMediaHandler.d.ts.map +1 -1
- package/lib/mcp/tools/assortment/removeAssortmentMediaHandler.js +3 -1
- package/lib/mcp/tools/assortment/removeAssortmentMediaHandler.js.map +1 -1
- package/lib/mcp/tools/assortment/reorderAssortmentMediaHandler.js +2 -2
- package/lib/mcp/tools/assortment/reorderAssortmentMediaHandler.js.map +1 -1
- package/lib/mcp/tools/assortment/translatedAssortmentMediaTextsHandler.d.ts.map +1 -1
- package/lib/mcp/tools/assortment/translatedAssortmentMediaTextsHandler.js +7 -1
- package/lib/mcp/tools/assortment/translatedAssortmentMediaTextsHandler.js.map +1 -1
- package/lib/mcp/tools/assortment/updateAssortmentMediaTextsHandler.d.ts.map +1 -1
- package/lib/mcp/tools/assortment/updateAssortmentMediaTextsHandler.js +4 -1
- package/lib/mcp/tools/assortment/updateAssortmentMediaTextsHandler.js.map +1 -1
- package/lib/mcp/tools/product/addProductAssignmentHandler.d.ts.map +1 -1
- package/lib/mcp/tools/product/addProductAssignmentHandler.js +1 -1
- package/lib/mcp/tools/product/addProductAssignmentHandler.js.map +1 -1
- package/lib/mcp/tools/product/addProductBundleItemHandler.d.ts +48 -0
- package/lib/mcp/tools/product/addProductBundleItemHandler.d.ts.map +1 -0
- package/lib/mcp/tools/product/addProductBundleItemHandler.js +52 -0
- package/lib/mcp/tools/product/addProductBundleItemHandler.js.map +1 -0
- package/lib/mcp/tools/product/addProductMediaUploadHandler.d.ts.map +1 -1
- package/lib/mcp/tools/product/addProductMediaUploadHandler.js +3 -2
- package/lib/mcp/tools/product/addProductMediaUploadHandler.js.map +1 -1
- package/lib/mcp/tools/product/catalogPriceHandler.d.ts +28 -0
- package/lib/mcp/tools/product/catalogPriceHandler.d.ts.map +1 -0
- package/lib/mcp/tools/product/catalogPriceHandler.js +57 -0
- package/lib/mcp/tools/product/catalogPriceHandler.js.map +1 -0
- package/lib/mcp/tools/product/index.d.ts.map +1 -1
- package/lib/mcp/tools/product/index.js +27 -3
- package/lib/mcp/tools/product/index.js.map +1 -1
- package/lib/mcp/tools/product/productAssignmentsHandler.d.ts +24 -0
- package/lib/mcp/tools/product/productAssignmentsHandler.d.ts.map +1 -0
- package/lib/mcp/tools/product/productAssignmentsHandler.js +79 -0
- package/lib/mcp/tools/product/productAssignmentsHandler.js.map +1 -0
- package/lib/mcp/tools/product/productBundleItemsHandler.d.ts +20 -0
- package/lib/mcp/tools/product/productBundleItemsHandler.d.ts.map +1 -0
- package/lib/mcp/tools/product/productBundleItemsHandler.js +45 -0
- package/lib/mcp/tools/product/productBundleItemsHandler.js.map +1 -0
- package/lib/mcp/tools/product/productMediaHandler.d.ts +32 -0
- package/lib/mcp/tools/product/productMediaHandler.d.ts.map +1 -0
- package/lib/mcp/tools/product/productMediaHandler.js +46 -0
- package/lib/mcp/tools/product/productMediaHandler.js.map +1 -0
- package/lib/mcp/tools/product/productSiblingsHandler.d.ts +36 -0
- package/lib/mcp/tools/product/productSiblingsHandler.d.ts.map +1 -0
- package/lib/mcp/tools/product/productSiblingsHandler.js +66 -0
- package/lib/mcp/tools/product/productSiblingsHandler.js.map +1 -0
- package/lib/mcp/tools/product/productVariationsHandler.d.ts +20 -0
- package/lib/mcp/tools/product/productVariationsHandler.d.ts.map +1 -0
- package/lib/mcp/tools/product/productVariationsHandler.js +47 -0
- package/lib/mcp/tools/product/productVariationsHandler.js.map +1 -0
- package/lib/mcp/tools/product/removeProductBundleItemHandler.d.ts +24 -0
- package/lib/mcp/tools/product/removeProductBundleItemHandler.d.ts.map +1 -0
- package/lib/mcp/tools/product/removeProductBundleItemHandler.js +46 -0
- package/lib/mcp/tools/product/removeProductBundleItemHandler.js.map +1 -0
- package/lib/mcp/tools/product/removeProductMediaHandler.js +1 -1
- package/lib/mcp/tools/product/removeProductMediaHandler.js.map +1 -1
- package/lib/mcp/tools/product/reorderProductMediaHandler.js +2 -2
- package/lib/mcp/tools/product/reorderProductMediaHandler.js.map +1 -1
- package/lib/mcp/tools/product/simulatedPriceHandler.d.ts +70 -0
- package/lib/mcp/tools/product/simulatedPriceHandler.d.ts.map +1 -0
- package/lib/mcp/tools/product/simulatedPriceHandler.js +74 -0
- package/lib/mcp/tools/product/simulatedPriceHandler.js.map +1 -0
- package/lib/mcp/tools/product/simulatedPriceRangeHandler.d.ts +74 -0
- package/lib/mcp/tools/product/simulatedPriceRangeHandler.d.ts.map +1 -0
- package/lib/mcp/tools/product/simulatedPriceRangeHandler.js +103 -0
- package/lib/mcp/tools/product/simulatedPriceRangeHandler.js.map +1 -0
- package/lib/mcp/tools/product/translatedProductMediaTextsHandler.d.ts.map +1 -1
- package/lib/mcp/tools/product/translatedProductMediaTextsHandler.js +7 -1
- package/lib/mcp/tools/product/translatedProductMediaTextsHandler.js.map +1 -1
- package/lib/mcp/tools/product/translatedProductVariationTextsHandler.d.ts.map +1 -1
- package/lib/mcp/tools/product/translatedProductVariationTextsHandler.js +7 -1
- package/lib/mcp/tools/product/translatedProductVariationTextsHandler.js.map +1 -1
- package/lib/mcp/tools/product/updateProductMediaTextsHandler.js +1 -1
- package/lib/mcp/tools/product/updateProductMediaTextsHandler.js.map +1 -1
- package/lib/mcp/tools/product/updateProductPlanHandler.d.ts +47 -26
- package/lib/mcp/tools/product/updateProductPlanHandler.d.ts.map +1 -1
- package/lib/mcp/tools/product/updateProductPlanHandler.js +23 -7
- package/lib/mcp/tools/product/updateProductPlanHandler.js.map +1 -1
- package/lib/mcp/tools/product/updateProductVariationTextsHandler.d.ts +73 -0
- package/lib/mcp/tools/product/updateProductVariationTextsHandler.d.ts.map +1 -0
- package/lib/mcp/tools/product/updateProductVariationTextsHandler.js +52 -0
- package/lib/mcp/tools/product/updateProductVariationTextsHandler.js.map +1 -0
- package/lib/mcp/tools/product/variationProductsHandler.d.ts +52 -0
- package/lib/mcp/tools/product/variationProductsHandler.d.ts.map +1 -0
- package/lib/mcp/tools/product/variationProductsHandler.js +54 -0
- package/lib/mcp/tools/product/variationProductsHandler.js.map +1 -0
- package/lib/mcp/tools/shopInfoHandler.d.ts.map +1 -1
- package/lib/mcp/tools/shopInfoHandler.js +4 -2
- package/lib/mcp/tools/shopInfoHandler.js.map +1 -1
- package/lib/mcp/utils/getNormalizedProductDetails.d.ts +1 -1
- package/lib/mcp/utils/getNormalizedProductDetails.d.ts.map +1 -1
- package/lib/mcp/utils/getNormalizedProductDetails.js +25 -0
- package/lib/mcp/utils/getNormalizedProductDetails.js.map +1 -1
- package/lib/resolvers/mutations/filters/createFilter.d.ts.map +1 -1
- package/lib/resolvers/mutations/filters/createFilter.js +14 -5
- package/lib/resolvers/mutations/filters/createFilter.js.map +1 -1
- package/lib/schema/types/product/bundle-product.js +1 -1
- package/package.json +6 -6
- package/src/errors.ts +5 -0
- package/src/mcp/tools/assortment/addAssortmentMediaUploadHandler.ts +2 -1
- package/src/mcp/tools/assortment/assortmentMediaHandler.ts +57 -0
- package/src/mcp/tools/assortment/index.ts +9 -1
- package/src/mcp/tools/assortment/removeAssortmentMediaHandler.ts +3 -1
- package/src/mcp/tools/assortment/reorderAssortmentMediaHandler.ts +2 -2
- package/src/mcp/tools/assortment/translatedAssortmentMediaTextsHandler.ts +8 -1
- package/src/mcp/tools/assortment/updateAssortmentMediaTextsHandler.ts +4 -1
- package/src/mcp/tools/product/addProductAssignmentHandler.ts +3 -1
- package/src/mcp/tools/product/addProductBundleItemHandler.ts +64 -0
- package/src/mcp/tools/product/addProductMediaUploadHandler.ts +3 -2
- package/src/mcp/tools/product/catalogPriceHandler.ts +61 -0
- package/src/mcp/tools/product/index.ts +104 -3
- package/src/mcp/tools/product/productAssignmentsHandler.ts +86 -0
- package/src/mcp/tools/product/productBundleItemsHandler.ts +50 -0
- package/src/mcp/tools/product/productMediaHandler.ts +53 -0
- package/src/mcp/tools/product/productSiblingsHandler.ts +82 -0
- package/src/mcp/tools/product/productVariationsHandler.ts +53 -0
- package/src/mcp/tools/product/removeProductBundleItemHandler.ts +55 -0
- package/src/mcp/tools/product/removeProductMediaHandler.ts +1 -1
- package/src/mcp/tools/product/reorderProductMediaHandler.ts +2 -2
- package/src/mcp/tools/product/simulatedPriceHandler.ts +82 -0
- package/src/mcp/tools/product/simulatedPriceRangeHandler.ts +126 -0
- package/src/mcp/tools/product/translatedProductMediaTextsHandler.ts +6 -2
- package/src/mcp/tools/product/translatedProductVariationTextsHandler.ts +6 -1
- package/src/mcp/tools/product/updateProductMediaTextsHandler.ts +1 -1
- package/src/mcp/tools/product/updateProductPlanHandler.ts +37 -7
- package/src/mcp/tools/product/updateProductVariationTextsHandler.ts +65 -0
- package/src/mcp/tools/product/variationProductsHandler.ts +61 -0
- package/src/mcp/tools/shopInfoHandler.ts +4 -2
- package/src/mcp/utils/getNormalizedProductDetails.ts +28 -0
- package/src/resolvers/mutations/filters/createFilter.ts +11 -6
- package/src/schema/types/product/bundle-product.ts +1 -1
|
@@ -1,64 +1,85 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { Context } from '../../../context.js';
|
|
3
|
+
export declare const ProductPlanUsageCalculationTypeEnum: z.ZodEnum<["LICENSED", "METERED"]>;
|
|
4
|
+
export declare const ProductPlanConfigurationIntervalEnum: z.ZodEnum<["HOURS", "DAYS", "WEEKS", "MONTHS", "YEARS"]>;
|
|
5
|
+
export declare const UpdateProductPlanInputSchema: z.ZodObject<{
|
|
6
|
+
usageCalculationType: z.ZodEnum<["LICENSED", "METERED"]>;
|
|
7
|
+
billingInterval: z.ZodEnum<["HOURS", "DAYS", "WEEKS", "MONTHS", "YEARS"]>;
|
|
8
|
+
billingIntervalCount: z.ZodNumber;
|
|
9
|
+
trialInterval: z.ZodOptional<z.ZodEnum<["HOURS", "DAYS", "WEEKS", "MONTHS", "YEARS"]>>;
|
|
10
|
+
trialIntervalCount: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
usageCalculationType?: "LICENSED" | "METERED";
|
|
13
|
+
billingInterval?: "HOURS" | "DAYS" | "WEEKS" | "MONTHS" | "YEARS";
|
|
14
|
+
billingIntervalCount?: number;
|
|
15
|
+
trialInterval?: "HOURS" | "DAYS" | "WEEKS" | "MONTHS" | "YEARS";
|
|
16
|
+
trialIntervalCount?: number;
|
|
17
|
+
}, {
|
|
18
|
+
usageCalculationType?: "LICENSED" | "METERED";
|
|
19
|
+
billingInterval?: "HOURS" | "DAYS" | "WEEKS" | "MONTHS" | "YEARS";
|
|
20
|
+
billingIntervalCount?: number;
|
|
21
|
+
trialInterval?: "HOURS" | "DAYS" | "WEEKS" | "MONTHS" | "YEARS";
|
|
22
|
+
trialIntervalCount?: number;
|
|
23
|
+
}>;
|
|
3
24
|
export declare const UpdateProductPlanSchema: {
|
|
4
25
|
productId: z.ZodString;
|
|
5
26
|
plan: z.ZodObject<{
|
|
6
|
-
usageCalculationType: z.
|
|
7
|
-
billingInterval: z.
|
|
8
|
-
billingIntervalCount: z.
|
|
9
|
-
trialInterval: z.ZodOptional<z.
|
|
27
|
+
usageCalculationType: z.ZodEnum<["LICENSED", "METERED"]>;
|
|
28
|
+
billingInterval: z.ZodEnum<["HOURS", "DAYS", "WEEKS", "MONTHS", "YEARS"]>;
|
|
29
|
+
billingIntervalCount: z.ZodNumber;
|
|
30
|
+
trialInterval: z.ZodOptional<z.ZodEnum<["HOURS", "DAYS", "WEEKS", "MONTHS", "YEARS"]>>;
|
|
10
31
|
trialIntervalCount: z.ZodOptional<z.ZodNumber>;
|
|
11
32
|
}, "strip", z.ZodTypeAny, {
|
|
12
|
-
usageCalculationType?:
|
|
13
|
-
billingInterval?:
|
|
33
|
+
usageCalculationType?: "LICENSED" | "METERED";
|
|
34
|
+
billingInterval?: "HOURS" | "DAYS" | "WEEKS" | "MONTHS" | "YEARS";
|
|
14
35
|
billingIntervalCount?: number;
|
|
15
|
-
trialInterval?:
|
|
36
|
+
trialInterval?: "HOURS" | "DAYS" | "WEEKS" | "MONTHS" | "YEARS";
|
|
16
37
|
trialIntervalCount?: number;
|
|
17
38
|
}, {
|
|
18
|
-
usageCalculationType?:
|
|
19
|
-
billingInterval?:
|
|
39
|
+
usageCalculationType?: "LICENSED" | "METERED";
|
|
40
|
+
billingInterval?: "HOURS" | "DAYS" | "WEEKS" | "MONTHS" | "YEARS";
|
|
20
41
|
billingIntervalCount?: number;
|
|
21
|
-
trialInterval?:
|
|
42
|
+
trialInterval?: "HOURS" | "DAYS" | "WEEKS" | "MONTHS" | "YEARS";
|
|
22
43
|
trialIntervalCount?: number;
|
|
23
44
|
}>;
|
|
24
45
|
};
|
|
25
46
|
export declare const UpdateProductPlanZodSchema: z.ZodObject<{
|
|
26
47
|
productId: z.ZodString;
|
|
27
48
|
plan: z.ZodObject<{
|
|
28
|
-
usageCalculationType: z.
|
|
29
|
-
billingInterval: z.
|
|
30
|
-
billingIntervalCount: z.
|
|
31
|
-
trialInterval: z.ZodOptional<z.
|
|
49
|
+
usageCalculationType: z.ZodEnum<["LICENSED", "METERED"]>;
|
|
50
|
+
billingInterval: z.ZodEnum<["HOURS", "DAYS", "WEEKS", "MONTHS", "YEARS"]>;
|
|
51
|
+
billingIntervalCount: z.ZodNumber;
|
|
52
|
+
trialInterval: z.ZodOptional<z.ZodEnum<["HOURS", "DAYS", "WEEKS", "MONTHS", "YEARS"]>>;
|
|
32
53
|
trialIntervalCount: z.ZodOptional<z.ZodNumber>;
|
|
33
54
|
}, "strip", z.ZodTypeAny, {
|
|
34
|
-
usageCalculationType?:
|
|
35
|
-
billingInterval?:
|
|
55
|
+
usageCalculationType?: "LICENSED" | "METERED";
|
|
56
|
+
billingInterval?: "HOURS" | "DAYS" | "WEEKS" | "MONTHS" | "YEARS";
|
|
36
57
|
billingIntervalCount?: number;
|
|
37
|
-
trialInterval?:
|
|
58
|
+
trialInterval?: "HOURS" | "DAYS" | "WEEKS" | "MONTHS" | "YEARS";
|
|
38
59
|
trialIntervalCount?: number;
|
|
39
60
|
}, {
|
|
40
|
-
usageCalculationType?:
|
|
41
|
-
billingInterval?:
|
|
61
|
+
usageCalculationType?: "LICENSED" | "METERED";
|
|
62
|
+
billingInterval?: "HOURS" | "DAYS" | "WEEKS" | "MONTHS" | "YEARS";
|
|
42
63
|
billingIntervalCount?: number;
|
|
43
|
-
trialInterval?:
|
|
64
|
+
trialInterval?: "HOURS" | "DAYS" | "WEEKS" | "MONTHS" | "YEARS";
|
|
44
65
|
trialIntervalCount?: number;
|
|
45
66
|
}>;
|
|
46
67
|
}, "strip", z.ZodTypeAny, {
|
|
47
68
|
productId?: string;
|
|
48
69
|
plan?: {
|
|
49
|
-
usageCalculationType?:
|
|
50
|
-
billingInterval?:
|
|
70
|
+
usageCalculationType?: "LICENSED" | "METERED";
|
|
71
|
+
billingInterval?: "HOURS" | "DAYS" | "WEEKS" | "MONTHS" | "YEARS";
|
|
51
72
|
billingIntervalCount?: number;
|
|
52
|
-
trialInterval?:
|
|
73
|
+
trialInterval?: "HOURS" | "DAYS" | "WEEKS" | "MONTHS" | "YEARS";
|
|
53
74
|
trialIntervalCount?: number;
|
|
54
75
|
};
|
|
55
76
|
}, {
|
|
56
77
|
productId?: string;
|
|
57
78
|
plan?: {
|
|
58
|
-
usageCalculationType?:
|
|
59
|
-
billingInterval?:
|
|
79
|
+
usageCalculationType?: "LICENSED" | "METERED";
|
|
80
|
+
billingInterval?: "HOURS" | "DAYS" | "WEEKS" | "MONTHS" | "YEARS";
|
|
60
81
|
billingIntervalCount?: number;
|
|
61
|
-
trialInterval?:
|
|
82
|
+
trialInterval?: "HOURS" | "DAYS" | "WEEKS" | "MONTHS" | "YEARS";
|
|
62
83
|
trialIntervalCount?: number;
|
|
63
84
|
};
|
|
64
85
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateProductPlanHandler.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/product/updateProductPlanHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAM9C,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"updateProductPlanHandler.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/product/updateProductPlanHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAM9C,eAAO,MAAM,mCAAmC,oCAG9C,CAAC;AAEH,eAAO,MAAM,oCAAoC,0DAMhD,CAAC;AAEF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;EAqBvC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;CAGnC,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;;;;;GAqC/F"}
|
|
@@ -3,15 +3,31 @@ import { ProductNotFoundError, ProductWrongStatusError } from '../../../errors.j
|
|
|
3
3
|
import { ProductTypes } from '@unchainedshop/core-products';
|
|
4
4
|
import { getNormalizedProductDetails } from '../../utils/getNormalizedProductDetails.js';
|
|
5
5
|
import { log } from '@unchainedshop/logger';
|
|
6
|
+
export const ProductPlanUsageCalculationTypeEnum = z.enum(['LICENSED', 'METERED'], {
|
|
7
|
+
description: 'Determines how usage is calculated for the product plan. LICENSED means a fixed license count, METERED means usage is tracked dynamically.',
|
|
8
|
+
});
|
|
9
|
+
export const ProductPlanConfigurationIntervalEnum = z.enum(['HOURS', 'DAYS', 'WEEKS', 'MONTHS', 'YEARS'], {
|
|
10
|
+
description: 'Defines the time unit for billing intervals and trial periods (e.g., MONTHS means billing every month).',
|
|
11
|
+
});
|
|
12
|
+
export const UpdateProductPlanInputSchema = z.object({
|
|
13
|
+
usageCalculationType: ProductPlanUsageCalculationTypeEnum.describe('The billing usage calculation method for the product plan.'),
|
|
14
|
+
billingInterval: ProductPlanConfigurationIntervalEnum.describe('The interval unit used for billing cycles.'),
|
|
15
|
+
billingIntervalCount: z
|
|
16
|
+
.number()
|
|
17
|
+
.int()
|
|
18
|
+
.positive()
|
|
19
|
+
.describe('The number of billing intervals per billing cycle (e.g., 3 for every 3 months).'),
|
|
20
|
+
trialInterval: ProductPlanConfigurationIntervalEnum.optional().describe('Optional trial period interval unit before billing starts.'),
|
|
21
|
+
trialIntervalCount: z
|
|
22
|
+
.number()
|
|
23
|
+
.int()
|
|
24
|
+
.positive()
|
|
25
|
+
.optional()
|
|
26
|
+
.describe('Number of trial intervals before the billing cycle starts.'),
|
|
27
|
+
});
|
|
6
28
|
export const UpdateProductPlanSchema = {
|
|
7
29
|
productId: z.string().min(1).describe('ID of the product of type PLAN_PRODUCT to update only'),
|
|
8
|
-
plan:
|
|
9
|
-
usageCalculationType: z.string().describe('Type of usage calculation'),
|
|
10
|
-
billingInterval: z.string().describe('Billing interval, e.g., "month", "year"'),
|
|
11
|
-
billingIntervalCount: z.number().int().positive().optional().describe('Count of billing intervals'),
|
|
12
|
-
trialInterval: z.string().optional().describe('Trial period interval'),
|
|
13
|
-
trialIntervalCount: z.number().int().positive().optional().describe('Count of trial intervals'),
|
|
14
|
-
}),
|
|
30
|
+
plan: UpdateProductPlanInputSchema.describe('Configuration settings for the product plan.'),
|
|
15
31
|
};
|
|
16
32
|
export const UpdateProductPlanZodSchema = z.object(UpdateProductPlanSchema);
|
|
17
33
|
export async function updateProductPlanHandler(context, params) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateProductPlanHandler.js","sourceRoot":"","sources":["../../../../src/mcp/tools/product/updateProductPlanHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AACzF,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"updateProductPlanHandler.js","sourceRoot":"","sources":["../../../../src/mcp/tools/product/updateProductPlanHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AACzF,OAAO,EAAE,GA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AgB,EAAE,MAA+B;IAC9F,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IACnC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAEpC,IAAI,CAAC;QACH,GAAG,CAAC,kCAAkC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QAC5D,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;QAClE,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,oBAAoB,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;QAE5D,IAAI,OAAO,EAAE,IAAI,KAAK,YAAY,CAAC,WAAW;YAC5C,MAAM,IAAI,uBAAuB,CAAC;gBAChC,QAAQ,EAAE,OAAO,EAAE,IAAI;gBACvB,QAAQ,EAAE,YAAY,CAAC,WAAW;aACnC,CAAC,CAAC;QAEL,MAAM,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QAEnD,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,gCAAiC,KAAe,CAAC,OAAO,EAAE;iBACjE;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Context } from '../../../context.js';
|
|
3
|
+
export declare const ProductVariationTextInputSchema: z.ZodObject<{
|
|
4
|
+
locale: z.ZodString;
|
|
5
|
+
title: z.ZodOptional<z.ZodString>;
|
|
6
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
locale?: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
subtitle?: string;
|
|
11
|
+
}, {
|
|
12
|
+
locale?: string;
|
|
13
|
+
title?: string;
|
|
14
|
+
subtitle?: string;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const UpdateProductVariationTextsSchema: {
|
|
17
|
+
productVariationId: z.ZodString;
|
|
18
|
+
productVariationOptionValue: z.ZodOptional<z.ZodString>;
|
|
19
|
+
texts: z.ZodArray<z.ZodObject<{
|
|
20
|
+
locale: z.ZodString;
|
|
21
|
+
title: z.ZodOptional<z.ZodString>;
|
|
22
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
locale?: string;
|
|
25
|
+
title?: string;
|
|
26
|
+
subtitle?: string;
|
|
27
|
+
}, {
|
|
28
|
+
locale?: string;
|
|
29
|
+
title?: string;
|
|
30
|
+
subtitle?: string;
|
|
31
|
+
}>, "many">;
|
|
32
|
+
};
|
|
33
|
+
export declare const UpdateProductVariationTextsZodSchema: z.ZodObject<{
|
|
34
|
+
productVariationId: z.ZodString;
|
|
35
|
+
productVariationOptionValue: z.ZodOptional<z.ZodString>;
|
|
36
|
+
texts: z.ZodArray<z.ZodObject<{
|
|
37
|
+
locale: z.ZodString;
|
|
38
|
+
title: z.ZodOptional<z.ZodString>;
|
|
39
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
40
|
+
}, "strip", z.ZodTypeAny, {
|
|
41
|
+
locale?: string;
|
|
42
|
+
title?: string;
|
|
43
|
+
subtitle?: string;
|
|
44
|
+
}, {
|
|
45
|
+
locale?: string;
|
|
46
|
+
title?: string;
|
|
47
|
+
subtitle?: string;
|
|
48
|
+
}>, "many">;
|
|
49
|
+
}, "strip", z.ZodTypeAny, {
|
|
50
|
+
productVariationId?: string;
|
|
51
|
+
productVariationOptionValue?: string;
|
|
52
|
+
texts?: {
|
|
53
|
+
locale?: string;
|
|
54
|
+
title?: string;
|
|
55
|
+
subtitle?: string;
|
|
56
|
+
}[];
|
|
57
|
+
}, {
|
|
58
|
+
productVariationId?: string;
|
|
59
|
+
productVariationOptionValue?: string;
|
|
60
|
+
texts?: {
|
|
61
|
+
locale?: string;
|
|
62
|
+
title?: string;
|
|
63
|
+
subtitle?: string;
|
|
64
|
+
}[];
|
|
65
|
+
}>;
|
|
66
|
+
export type UpdateProductVariationTextsParams = z.infer<typeof UpdateProductVariationTextsZodSchema>;
|
|
67
|
+
export declare function updateProductVariationTextsHandler(context: Context, params: UpdateProductVariationTextsParams): Promise<{
|
|
68
|
+
content: {
|
|
69
|
+
type: "text";
|
|
70
|
+
text: string;
|
|
71
|
+
}[];
|
|
72
|
+
}>;
|
|
73
|
+
//# sourceMappingURL=updateProductVariationTextsHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateProductVariationTextsHandler.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/product/updateProductVariationTextsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAI9C,eAAO,MAAM,+BAA+B;;;;;;;;;;;;EAI1C,CAAC;AAEH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;CAU7C,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;;;;;GAmC1C"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { log } from '@unchainedshop/logger';
|
|
3
|
+
import { ProductVariationNotFoundError } from '../../../errors.js';
|
|
4
|
+
export const ProductVariationTextInputSchema = z.object({
|
|
5
|
+
locale: z.string().min(1).describe('Locale code (e.g., "en", "de")'),
|
|
6
|
+
title: z.string().optional().describe('Title of the variation in the given locale'),
|
|
7
|
+
subtitle: z.string().optional().describe('Subtitle of the variation in the given locale'),
|
|
8
|
+
});
|
|
9
|
+
export const UpdateProductVariationTextsSchema = {
|
|
10
|
+
productVariationId: z.string().min(1).describe('ID of the product variation to update'),
|
|
11
|
+
productVariationOptionValue: z
|
|
12
|
+
.string()
|
|
13
|
+
.optional()
|
|
14
|
+
.describe('Optional production option value to filter variations'),
|
|
15
|
+
texts: z
|
|
16
|
+
.array(ProductVariationTextInputSchema)
|
|
17
|
+
.min(1)
|
|
18
|
+
.describe('Localized texts to apply to the variation'),
|
|
19
|
+
};
|
|
20
|
+
export const UpdateProductVariationTextsZodSchema = z.object(UpdateProductVariationTextsSchema);
|
|
21
|
+
export async function updateProductVariationTextsHandler(context, params) {
|
|
22
|
+
const { productVariationId, productVariationOptionValue, texts } = params;
|
|
23
|
+
const { modules, userId } = context;
|
|
24
|
+
try {
|
|
25
|
+
log('handler updateProductVariationTextsHandler', { userId, params });
|
|
26
|
+
const productVariation = await modules.products.variations.findProductVariation({
|
|
27
|
+
productVariationId,
|
|
28
|
+
});
|
|
29
|
+
if (!productVariation)
|
|
30
|
+
throw new ProductVariationNotFoundError({ productVariationId });
|
|
31
|
+
const updatedTexts = await modules.products.variations.texts.updateVariationTexts(productVariationId, texts, productVariationOptionValue);
|
|
32
|
+
return {
|
|
33
|
+
content: [
|
|
34
|
+
{
|
|
35
|
+
type: 'text',
|
|
36
|
+
text: JSON.stringify({ texts: updatedTexts, productId: productVariation.productId }),
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
return {
|
|
43
|
+
content: [
|
|
44
|
+
{
|
|
45
|
+
type: 'text',
|
|
46
|
+
text: `Error updating product warehousing: ${error.message}`,
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=updateProductVariationTextsHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateProductVariationTextsHandler.js","sourceRoot":"","sources":["../../../../src/mcp/tools/product/updateProductVariationTextsHandler.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,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC;IACtD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,gCAAgC,CAAC;IACpE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4CAA4C,CAAC;IACnF,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,+CAA+C,CAAC;CAC1F,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iCAAiC,GAAG;IAC/C,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,uCAAuC,CAAC;IACvF,2BAA2B,EAAE,CAAC;SAC3B,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,uDAAuD,CAAC;IACpE,KAAK,EAAE,CAAC;SACL,KAAK,CAAC,+BAA+B,CAAC;SACtC,GAAG,CAAC,C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 'zod';
|
|
2
|
+
import { Context } from '../../../context.js';
|
|
3
|
+
export declare const VariationProductsSchema: {
|
|
4
|
+
productId: z.ZodString;
|
|
5
|
+
vectors: z.ZodArray<z.ZodObject<{
|
|
6
|
+
key: z.ZodString;
|
|
7
|
+
value: z.ZodString;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
key?: string;
|
|
10
|
+
value?: string;
|
|
11
|
+
}, {
|
|
12
|
+
key?: string;
|
|
13
|
+
value?: string;
|
|
14
|
+
}>, "many">;
|
|
15
|
+
includeInactive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
16
|
+
};
|
|
17
|
+
export declare const VariationProductsZodSchema: z.ZodObject<{
|
|
18
|
+
productId: z.ZodString;
|
|
19
|
+
vectors: z.ZodArray<z.ZodObject<{
|
|
20
|
+
key: z.ZodString;
|
|
21
|
+
value: z.ZodString;
|
|
22
|
+
}, "strip", z.ZodTypeAny, {
|
|
23
|
+
key?: string;
|
|
24
|
+
value?: string;
|
|
25
|
+
}, {
|
|
26
|
+
key?: string;
|
|
27
|
+
value?: string;
|
|
28
|
+
}>, "many">;
|
|
29
|
+
includeInactive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
productId?: string;
|
|
32
|
+
includeInactive?: boolean;
|
|
33
|
+
vectors?: {
|
|
34
|
+
key?: string;
|
|
35
|
+
value?: string;
|
|
36
|
+
}[];
|
|
37
|
+
}, {
|
|
38
|
+
productId?: string;
|
|
39
|
+
includeInactive?: boolean;
|
|
40
|
+
vectors?: {
|
|
41
|
+
key?: string;
|
|
42
|
+
value?: string;
|
|
43
|
+
}[];
|
|
44
|
+
}>;
|
|
45
|
+
export type VariationProductsParams = z.infer<typeof VariationProductsZodSchema>;
|
|
46
|
+
export declare const variationProductsHandler: (context: Context, params: VariationProductsParams) => Promise<{
|
|
47
|
+
content: {
|
|
48
|
+
type: "text";
|
|
49
|
+
text: string;
|
|
50
|
+
}[];
|
|
51
|
+
}>;
|
|
52
|
+
//# sourceMappingURL=variationProductsHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variationProductsHandler.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/product/variationProductsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAU9C,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;CAInC,CAAC;AACF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAoC,CAAC;AAC5E,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAEjF,eAAO,MAAM,wBAAwB,GAAU,SAAS,OAAO,EAAE,QAAQ,uBAAuB;;;;;EAyC/F,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
const VariationProductsVectorSchema = z.object({
|
|
6
|
+
key: z.string().min(1),
|
|
7
|
+
value: z.string().min(1),
|
|
8
|
+
});
|
|
9
|
+
export const VariationProductsSchema = {
|
|
10
|
+
productId: z.string().min(1),
|
|
11
|
+
vectors: z.array(VariationProductsVectorSchema).min(1),
|
|
12
|
+
includeInactive: z.boolean().optional().default(true).describe('Whether to include inactive products'),
|
|
13
|
+
};
|
|
14
|
+
export const VariationProductsZodSchema = z.object(VariationProductsSchema);
|
|
15
|
+
export const variationProductsHandler = async (context, params) => {
|
|
16
|
+
const { modules, userId } = context;
|
|
17
|
+
const { productId, vectors, includeInactive } = params;
|
|
18
|
+
try {
|
|
19
|
+
log('handler variationProductsHandler', { userId, params });
|
|
20
|
+
const product = await modules.products.findProduct({ productId });
|
|
21
|
+
if (!product)
|
|
22
|
+
throw new ProductNotFoundError({ productId });
|
|
23
|
+
if (product.type !== 'CONFIGURABLE_PRODUCT') {
|
|
24
|
+
throw new ProductWrongTypeError({
|
|
25
|
+
productId,
|
|
26
|
+
received: product.type,
|
|
27
|
+
required: 'CONFIGURABLE_PRODUCT',
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
const products = await modules.products.proxyProducts(product, vectors, {
|
|
31
|
+
includeInactive,
|
|
32
|
+
});
|
|
33
|
+
const normalizedProducts = await Promise.all(products.map(async ({ _id }) => getNormalizedProductDetails(_id, context)));
|
|
34
|
+
return {
|
|
35
|
+
content: [
|
|
36
|
+
{
|
|
37
|
+
type: 'text',
|
|
38
|
+
text: JSON.stringify({ products: normalizedProducts }),
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
return {
|
|
45
|
+
content: [
|
|
46
|
+
{
|
|
47
|
+
type: 'text',
|
|
48
|
+
text: `Error fetching variation products: ${error.message}`,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=variationProductsHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variationProductsHandler.js","sourceRoot":"","sources":["../../../../src/mcp/tools/product/variationProductsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AAEzF,MAAM,6BAA6B,GAAG,CAAC,CAA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;gBACtB,QAAQ,EAAE,sBAAsB;aACjC,CAAC,CAAC;QACL,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,OAAO,EAAE,OAAc,EAAE;YAC7E,eAAe;SAChB,CAAC,CAAC;QACH,MAAM,kBAAkB,GAAG,MAAM,OAAO,CAAC,GAAG,CAC1C,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,2BAA2B,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAC3E,CAAC;QACF,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,kBAAkB,EAAE,CAAC;iBACvD;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,sCAAuC,KAAe,CAAC,OAAO,EAAE;iBACvE;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shopInfoHandler.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/shopInfoHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C,wBAAsB,eAAe,CAAC,OAAO,EAAE,OAAO;;;;;
|
|
1
|
+
{"version":3,"file":"shopInfoHandler.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/shopInfoHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C,wBAAsB,eAAe,CAAC,OAAO,EAAE,OAAO;;;;;GA+BrD"}
|
|
@@ -2,10 +2,12 @@ import { log } from '@unchainedshop/logger';
|
|
|
2
2
|
export async function shopInfoHandler(context) {
|
|
3
3
|
const { version, userId, loaders, locale, countryCode } = context;
|
|
4
4
|
try {
|
|
5
|
-
log('
|
|
5
|
+
log('handler shopInfoHandler', { userId });
|
|
6
6
|
const language = await loaders.languageLoader.load({ isoCode: locale.language });
|
|
7
7
|
const country = await loaders.countryLoader.load({ isoCode: countryCode });
|
|
8
|
-
const defaultLanguageIsoCode = language
|
|
8
|
+
const defaultLanguageIsoCode = language?.isoCode
|
|
9
|
+
? `${language.isoCode}${country?.isoCode ? '-' + country.isoCode : ''}`
|
|
10
|
+
: null;
|
|
9
11
|
return {
|
|
10
12
|
content: [
|
|
11
13
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shopInfoHandler.js","sourceRoot":"","sources":["../../../src/mcp/tools/shopInfoHandler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,OAAgB;IACpD,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAElE,IAAI,CAAC;QACH,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"shopInfoHandler.js","sourceRoot":"","sources":["../../../src/mcp/tools/shopInfoHandler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,OAAgB;IACpD,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAElE,IAAI,CAAC;QACH,GAAG,CAAC,yBAAyB,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QAE3C,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;QAEjF,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;QAC3E,MAAM,sBAAsB,GAAG,QAAQ,EAAE,OAAO;YAC9C,CAAC,CAAC,GAAG,QAAQ,CAAC,OAAO,GAAG,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACvE,CAAC,CAAC,IAAI,CAAC;QAET,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,sBAAsB,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;iBAC7E;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,4BAA6B,KAAe,CAAC,OAAO,EAAE;iBAC7D;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -3,9 +3,9 @@ export declare function getNormalizedProductDetails(productId: string, context:
|
|
|
3
3
|
texts: import("@unchainedshop/core-products").ProductText;
|
|
4
4
|
media: any[];
|
|
5
5
|
variations: any[];
|
|
6
|
+
bundleItems: any[];
|
|
6
7
|
pricing: any;
|
|
7
8
|
_id?: string;
|
|
8
|
-
bundleItems: import("@unchainedshop/core-products").ProductBundleItem[];
|
|
9
9
|
commerce?: import("@unchainedshop/core-products").ProductCommerce;
|
|
10
10
|
meta?: any;
|
|
11
11
|
plan: import("@unchainedshop/core-products").ProductPlan;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getNormalizedProductDetails.d.ts","sourceRoot":"","sources":["../../../src/mcp/utils/getNormalizedProductDetails.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C,wBAAsB,2BAA2B,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"getNormalizedProductDetails.d.ts","sourceRoot":"","sources":["../../../src/mcp/utils/getNormalizedProductDetails.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C,wBAAsB,2BAA2B,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;GAiEpF"}
|
|
@@ -10,10 +10,34 @@ export async function getNormalizedProductDetails(productId, context) {
|
|
|
10
10
|
locale,
|
|
11
11
|
});
|
|
12
12
|
let variations = [];
|
|
13
|
+
let bundleItems = [];
|
|
13
14
|
if (product.type === ProductTypes.ConfigurableProduct)
|
|
14
15
|
variations = await context.modules.products.variations.findProductVariations({
|
|
15
16
|
productId: product._id,
|
|
16
17
|
});
|
|
18
|
+
if (product.type === ProductTypes.BundleProduct) {
|
|
19
|
+
bundleItems = await Promise.all((product.bundleItems || []).map(async (item) => {
|
|
20
|
+
const bundleItemProduct = await loaders.productLoader.load({
|
|
21
|
+
productId: item.productId,
|
|
22
|
+
});
|
|
23
|
+
const productMedias = await modules.products.media.findProductMedias({
|
|
24
|
+
productId: item.productId,
|
|
25
|
+
});
|
|
26
|
+
const media = await normalizeMediaUrl(productMedias, context);
|
|
27
|
+
const texts = await loaders.productTextLoader.load({
|
|
28
|
+
productId: item.productId,
|
|
29
|
+
locale,
|
|
30
|
+
});
|
|
31
|
+
return {
|
|
32
|
+
product: {
|
|
33
|
+
...bundleItemProduct,
|
|
34
|
+
media,
|
|
35
|
+
texts,
|
|
36
|
+
},
|
|
37
|
+
...item,
|
|
38
|
+
};
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
17
41
|
// Get pricing information
|
|
18
42
|
let pricing = null;
|
|
19
43
|
try {
|
|
@@ -32,6 +56,7 @@ export async function getNormalizedProductDetails(productId, context) {
|
|
|
32
56
|
texts,
|
|
33
57
|
media,
|
|
34
58
|
variations,
|
|
59
|
+
bundleItems,
|
|
35
60
|
pricing,
|
|
36
61
|
};
|
|
37
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getNormalizedProductDetails.js","sourceRoot":"","sources":["../../../src/mcp/utils/getNormalizedProductDetails.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AAEvD,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,SAAiB,EAAE,OAAgB;IACnF,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAC7C,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;IAElE,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAE1B,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC;QACjD,SAAS;QACT,MAAM;KACP,CAAC,CAAC;IACH,IAAI,UAAU,GAAG,EAAE,CAAC;IACpB,IAAI,OAAO,CAAC,IAAI,KAAK,YAAY,CAAC,mBAAmB;QACnD,UAAU,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,qBAAqB,CAAC;YAC3E,SAAS,EAAE,OAAO,CAAC,GAAG;SACvB,CAAC,CAAC;IAEL,0BAA0B;IAC1B,IAAI,OAAO,GAAG,IAAI,CAAC;IACnB,IAAI,CAAC;QACH,OAAO,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE;YAC7D,WAAW,EAAE,OAAO,CAAC,WAAW;SACjC,CAAC,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACP,kDAAkD;QAClD,OAAO,CAAC,IAAI,CAAC,oCAAoC,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IAClE,CAAC;IAED,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;IACpF,MAAM,KAAK,GAAG,MAAM,iBAAiB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IAE9D,OAAO;QACL,GAAG,OAAO;QACV,KAAK;QACL,KAAK;QACL,UAAU;QACV,OAAO;KACR,CAAC;AACJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"getNormalizedProductDetails.js","sourceRoot":"","sources":["../../../src/mcp/utils/getNormalizedProductDetails.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AAEvD,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,SAAiB,EAAE,OAAgB;IACnF,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAC7C,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;IAElE,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAE1B,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC;QACjD,SAAS;QACT,MAAM;KACP,CAAC,CAAC;IACH,IAAI,UAAU,GAAG,EAAE,CAAC;IACpB,IAAI,WAAW,GAAG,EAAE,CAAC;IACrB,IAAI,OAAO,CAAC,IAAI,KAAK,YAAY,CAAC,mBAAmB;QACnD,UAAU,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,q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AC;IAClE,CAAC;IAED,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;IACpF,MAAM,KAAK,GAAG,MAAM,iBAAiB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IAE9D,OAAO;QACL,GAAG,OAAO;QACV,KAAK;QACL,KAAK;QACL,UAAU;QACV,WAAW;QACX,OAAO;KACR,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createFilter.d.ts","sourceRoot":"","sources":["../../../../src/resolvers/mutations/filters/createFilter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAkB,eAAe,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"createFilter.d.ts","sourceRoot":"","sources":["../../../../src/resolvers/mutations/filters/createFilter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAkB,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGtE,wBAA8B,YAAY,CACxC,IAAI,EAAE,KAAK,EACX,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,eAAe,EAAE,CAAA;CAAE,EAC/D,OAAO,EAAE,OAAO,mBAiBjB"}
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import { log } from '@unchainedshop/logger';
|
|
2
2
|
import { FilterDirector } from '@unchainedshop/core';
|
|
3
|
+
import { DuplicateFilterKeyError } from '../../../errors.js';
|
|
3
4
|
export default async function createFilter(root, { filter, texts }, context) {
|
|
4
5
|
const { modules, userId } = context;
|
|
5
6
|
log('mutation createFilter', { userId });
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
try {
|
|
8
|
+
const newFilter = await modules.filters.create(filter);
|
|
9
|
+
await FilterDirector.invalidateProductIdCache(newFilter, context);
|
|
10
|
+
if (texts) {
|
|
11
|
+
await modules.filters.texts.updateTexts({ filterId: newFilter._id }, texts);
|
|
12
|
+
}
|
|
13
|
+
return newFilter;
|
|
14
|
+
}
|
|
15
|
+
catch (e) {
|
|
16
|
+
if (e?.message?.includes('duplicate'))
|
|
17
|
+
throw new DuplicateFilterKeyError({ filter });
|
|
18
|
+
else
|
|
19
|
+
throw e;
|
|
10
20
|
}
|
|
11
|
-
return newFilter;
|
|
12
21
|
}
|
|
13
22
|
//# sourceMappingURL=createFilter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createFilter.js","sourceRoot":"","sources":["../../../../src/resolvers/mutations/filters/createFilter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAG5C,OAAO,EAAE,cAAc,EAAmB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"createFilter.js","sourceRoot":"","sources":["../../../../src/resolvers/mutations/filters/createFilter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAG5C,OAAO,EAAE,cAAc,EAAmB,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAE7D,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,YAAY,CACxC,IAAW,EACX,EAAE,MAAM,EAAE,KAAK,EAAgD,EAC/D,OAAgB;IAEhB,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IACpC,GAAG,CAAC,uBAAuB,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IACzC,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAEvD,MAAM,cAAc,CAAC,wBAAwB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAElE,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,QAAQ,EAAE,SAAS,CAAC,GAAG,EAAE,EAAE,KAAK,CAAC,CAAC;QAC9E,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,WAAW,CAAC;YAAE,MAAM,IAAI,uBAAuB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;;YAChF,MAAM,CAAC,CAAC;IACf,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unchainedshop/api",
|
|
3
|
-
"version": "4.0.0-rc.
|
|
3
|
+
"version": "4.0.0-rc.6",
|
|
4
4
|
"main": "lib/api-index.js",
|
|
5
5
|
"types": "lib/api-index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -94,19 +94,19 @@
|
|
|
94
94
|
"graphql-scalars": "^1.24.2",
|
|
95
95
|
"moniker": "0.1.2",
|
|
96
96
|
"p-memoize": "^7.1.1",
|
|
97
|
-
"zod": "^3.25.
|
|
97
|
+
"zod": "^3.25.76"
|
|
98
98
|
},
|
|
99
99
|
"devDependencies": {
|
|
100
100
|
"@ethereumjs/util": "^10.0.0",
|
|
101
|
-
"fastify": "^5.4.0",
|
|
102
101
|
"@fastify/cookie": "^11.0.2",
|
|
103
|
-
"@fastify/session": "^11.1.0",
|
|
104
102
|
"@fastify/multipart": "^9.0.3",
|
|
105
|
-
"@
|
|
103
|
+
"@fastify/session": "^11.1.0",
|
|
104
|
+
"@modelcontextprotocol/sdk": "^1.15.1",
|
|
106
105
|
"@types/express": "^5.0.3",
|
|
107
|
-
"@types/node": "^24.0.
|
|
106
|
+
"@types/node": "^24.0.13",
|
|
108
107
|
"express": "^5.1.0",
|
|
109
108
|
"express-session": "^1.18.1",
|
|
109
|
+
"fastify": "^5.4.0",
|
|
110
110
|
"multer": "^2.0.1",
|
|
111
111
|
"passport": "^0.7.0",
|
|
112
112
|
"tsx": "^4.20.3",
|
package/src/errors.ts
CHANGED
|
@@ -319,3 +319,8 @@ export const ImpersonatingAdminUserError = createError(
|
|
|
319
319
|
'ImpersonatingAdminUserError',
|
|
320
320
|
'Can not impersonate a admin user account',
|
|
321
321
|
);
|
|
322
|
+
|
|
323
|
+
export const DuplicateFilterKeyError = createError(
|
|
324
|
+
'DuplicateFilterKeyError',
|
|
325
|
+
'Key already registered for another filter',
|
|
326
|
+
);
|