@unchainedshop/api 4.8.3 → 5.0.0-alpha.1
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/acl.js +30 -3
- package/lib/api-index.d.ts +3 -1
- package/lib/chat/generateImageHandler.js +6 -5
- package/lib/context.d.ts +4 -1
- package/lib/context.js +9 -3
- package/lib/events.d.ts +2 -0
- package/lib/events.js +2 -0
- package/lib/express/createMCPMiddleware.js +1 -1
- package/lib/express/index.d.ts +6 -9
- package/lib/express/index.js +52 -125
- package/lib/fastify/index.d.ts +6 -9
- package/lib/fastify/index.js +51 -117
- package/lib/fastify/mcpHandler.js +1 -1
- package/lib/loaders/buildTextMap.js +15 -13
- package/lib/locale-context.d.ts +4 -2
- package/lib/locale-context.js +2 -6
- package/lib/mcp/tools/assortment/assortmentManagement.d.ts +2 -2
- package/lib/mcp/tools/assortment/assortmentManagement.js +2 -2
- package/lib/mcp/tools/assortment/handlers/getAssortment.js +1 -1
- package/lib/mcp/tools/assortment/schemas.d.ts +322 -141
- package/lib/mcp/tools/assortment/schemas.js +179 -96
- package/lib/mcp/tools/filter/filterManagement.d.ts +2 -2
- package/lib/mcp/tools/filter/filterManagement.js +2 -2
- package/lib/mcp/tools/filter/schemas.d.ts +184 -75
- package/lib/mcp/tools/filter/schemas.js +87 -51
- package/lib/mcp/tools/localization/getLocalizationsConfig.d.ts +1 -1
- package/lib/mcp/tools/localization/localizationManagement.d.ts +2 -2
- package/lib/mcp/tools/localization/localizationManagement.js +2 -2
- package/lib/mcp/tools/localization/schemas.d.ts +144 -47
- package/lib/mcp/tools/localization/schemas.js +51 -36
- package/lib/mcp/tools/order/handlers/getTopCustomers.d.ts +2 -0
- package/lib/mcp/tools/order/orderManagement.d.ts +2 -2
- package/lib/mcp/tools/order/orderManagement.js +2 -2
- package/lib/mcp/tools/order/schemas.d.ts +184 -75
- package/lib/mcp/tools/order/schemas.js +113 -51
- package/lib/mcp/tools/product/handlers/getProduct.js +1 -1
- package/lib/mcp/tools/product/productManagement.d.ts +2 -2
- package/lib/mcp/tools/product/productManagement.js +2 -2
- package/lib/mcp/tools/product/schemas.d.ts +642 -317
- package/lib/mcp/tools/product/schemas.js +287 -191
- package/lib/mcp/tools/provider/providerManagement.d.ts +2 -2
- package/lib/mcp/tools/provider/providerManagement.js +2 -2
- package/lib/mcp/tools/provider/schemas.d.ts +142 -47
- package/lib/mcp/tools/provider/schemas.js +67 -32
- package/lib/mcp/tools/quotation/handlers/getQuotation.d.ts +2 -0
- package/lib/mcp/tools/quotation/handlers/listQuotations.d.ts +2 -0
- package/lib/mcp/tools/quotation/handlers/makeQuotationProposal.d.ts +2 -0
- package/lib/mcp/tools/quotation/handlers/rejectQuotation.d.ts +2 -0
- package/lib/mcp/tools/quotation/handlers/verifyQuotation.d.ts +2 -0
- package/lib/mcp/tools/quotation/quotationManagement.d.ts +2 -2
- package/lib/mcp/tools/quotation/quotationManagement.js +2 -2
- package/lib/mcp/tools/quotation/schemas.d.ts +111 -40
- package/lib/mcp/tools/quotation/schemas.js +54 -29
- package/lib/mcp/tools/system/handlers/countEvents.d.ts +8 -1
- package/lib/mcp/tools/system/handlers/countWork.d.ts +10 -1
- package/lib/mcp/tools/system/handlers/countWork.js +1 -0
- package/lib/mcp/tools/system/handlers/index.d.ts +4 -4
- package/lib/mcp/tools/system/handlers/listEvents.d.ts +12 -1
- package/lib/mcp/tools/system/handlers/listWork.d.ts +14 -1
- package/lib/mcp/tools/system/handlers/listWork.js +1 -0
- package/lib/mcp/tools/system/schemas.d.ts +179 -84
- package/lib/mcp/tools/system/schemas.js +188 -67
- package/lib/mcp/tools/system/systemManagement.d.ts +1 -1
- package/lib/mcp/tools/system/systemManagement.js +1 -1
- package/lib/mcp/tools/users/handlers/addUserEmail.d.ts +2 -0
- package/lib/mcp/tools/users/handlers/createUser.d.ts +2 -0
- package/lib/mcp/tools/users/handlers/enrollUser.d.ts +2 -0
- package/lib/mcp/tools/users/handlers/getCurrentUser.d.ts +2 -0
- package/lib/mcp/tools/users/handlers/getUser.d.ts +2 -0
- package/lib/mcp/tools/users/handlers/listUsers.d.ts +2 -0
- package/lib/mcp/tools/users/handlers/setUserTags.d.ts +2 -0
- package/lib/mcp/tools/users/handlers/setUserUsername.d.ts +2 -0
- package/lib/mcp/tools/users/handlers/updateUser.d.ts +2 -0
- package/lib/mcp/tools/users/schemas.d.ts +296 -163
- package/lib/mcp/tools/users/schemas.js +152 -71
- package/lib/mcp/tools/users/usersManagement.d.ts +2 -2
- package/lib/mcp/tools/users/usersManagement.js +2 -2
- package/lib/mcp/utils/getNormalizedQuotationDetails.d.ts +2 -0
- package/lib/mcp/utils/getNormalizedUserDetails.d.ts +2 -0
- package/lib/mcp/utils/normalizeMediaUrl.js +1 -1
- package/lib/mcp/utils/sanitizeLocalizationEntityData.d.ts +1 -1
- package/lib/mcp/utils/sharedSchemas.d.ts +28 -39
- package/lib/mcp/utils/sharedSchemas.js +28 -47
- package/lib/mcp/utils/validateIsoCode.d.ts +1 -1
- package/lib/resolvers/mutations/accounts/changePassword.js +1 -2
- package/lib/resolvers/mutations/index.d.ts +1 -6
- package/lib/resolvers/mutations/index.js +2 -12
- package/lib/resolvers/mutations/orders/updateCart.js +7 -1
- package/lib/resolvers/mutations/users/setRoles.d.ts +1 -1
- package/lib/resolvers/mutations/users/setRoles.js +8 -1
- package/lib/resolvers/queries/events/registeredEventTypes.d.ts +1 -1
- package/lib/resolvers/queries/events/registeredEventTypes.js +1 -1
- package/lib/resolvers/queries/index.d.ts +1 -1
- package/lib/resolvers/queries/index.js +1 -1
- package/lib/resolvers/type/index.d.ts +0 -1
- package/lib/resolvers/type/login-method-response-types.js +2 -1
- package/lib/resolvers/type/order/order-delivery-pickup-types.d.ts +0 -1
- package/lib/resolvers/type/order/order-delivery-pickup-types.js +0 -7
- package/lib/resolvers/type/shop-types.js +1 -1
- package/lib/resolvers/type/user-types.js +3 -3
- package/lib/roles/all.js +5 -3
- package/lib/roles/index.d.ts +4 -11
- package/lib/roles/index.js +16 -11
- package/lib/roles/loggedIn.js +2 -0
- package/lib/schema/mutation.js +6 -44
- package/lib/schema/query.js +5 -5
- package/lib/schema/types/index.js +2 -2
- package/lib/schema/types/order/delivery.js +0 -2
- package/package.json +13 -23
|
@@ -1,187 +1,270 @@
|
|
|
1
|
-
import { z } from 'zod
|
|
1
|
+
import { z } from 'zod';
|
|
2
2
|
import { SortDirection } from '@unchainedshop/utils';
|
|
3
|
-
import { PaginationSchema, SortingSchema, SearchSchema, LocalizationTextSchema,
|
|
3
|
+
import { PaginationSchema, SortingSchema, SearchSchema, LocalizationTextSchema, } from "../../utils/sharedSchemas.js";
|
|
4
4
|
export const sortDirectionKeys = Object.keys(SortDirection);
|
|
5
|
-
export const AssortmentTextInputSchema =
|
|
6
|
-
.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
.check(z.describe('Assortment localized text data'));
|
|
11
|
-
export const AssortmentMediaTextInputSchema = LocalizationTextSchema.check(z.describe('Assortment media localized text data'));
|
|
5
|
+
export const AssortmentTextInputSchema = LocalizationTextSchema.extend({
|
|
6
|
+
slug: z.string().optional().describe('URL slug'),
|
|
7
|
+
description: z.string().optional().describe('Markdown description'),
|
|
8
|
+
}).describe('Assortment localized text data');
|
|
9
|
+
export const AssortmentMediaTextInputSchema = LocalizationTextSchema.describe('Assortment media localized text data');
|
|
12
10
|
export const AssortmentSchema = z.object({
|
|
13
|
-
isRoot: z.
|
|
14
|
-
isActive: z.
|
|
15
|
-
tags: z
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
sequence: z.optional(z.int()).check(z.describe('Sorting sequence')),
|
|
19
|
-
meta: z.optional(z.record(z.any(), z.any())).check(z.describe('Custom metadata as key-value pairs')),
|
|
11
|
+
isRoot: z.boolean().optional().describe('Whether this is a root-level assortment'),
|
|
12
|
+
isActive: z.boolean().optional().describe('Whether this assortment is active'),
|
|
13
|
+
tags: z.array(z.string().min(1).toLowerCase()).optional().describe('Tags (lowercased strings)'),
|
|
14
|
+
sequence: z.number().int().optional().describe('Sorting sequence'),
|
|
15
|
+
meta: z.record(z.any(), z.any()).optional().describe('Custom metadata as key-value pairs'),
|
|
20
16
|
});
|
|
21
17
|
export const actionValidators = {
|
|
22
18
|
CREATE: z.object({
|
|
23
|
-
assortment: AssortmentSchema.
|
|
24
|
-
texts: z
|
|
25
|
-
.optional(z.array(AssortmentTextInputSchema))
|
|
26
|
-
.check(z.describe('Localized assortment text entries')),
|
|
19
|
+
assortment: AssortmentSchema.describe('Assortment data'),
|
|
20
|
+
texts: z.array(AssortmentTextInputSchema).optional().describe('Localized assortment text entries'),
|
|
27
21
|
}),
|
|
28
22
|
UPDATE: z.object({
|
|
29
|
-
assortmentId: z.string().
|
|
30
|
-
assortment: AssortmentSchema.
|
|
23
|
+
assortmentId: z.string().min(1).describe('Assortment ID'),
|
|
24
|
+
assortment: AssortmentSchema.describe('Assortment data to update'),
|
|
31
25
|
}),
|
|
32
26
|
REMOVE: z.object({
|
|
33
|
-
assortmentId: z.string().
|
|
27
|
+
assortmentId: z.string().min(1).describe('Assortment ID'),
|
|
34
28
|
}),
|
|
35
29
|
GET: z
|
|
36
30
|
.object({
|
|
37
|
-
assortmentId: z.
|
|
38
|
-
slug: z.
|
|
31
|
+
assortmentId: z.string().min(1).optional().describe('Assortment ID'),
|
|
32
|
+
slug: z.string().optional().describe('Assortment slug'),
|
|
39
33
|
})
|
|
40
|
-
.
|
|
34
|
+
.refine((data) => data.assortmentId || data.slug, {
|
|
41
35
|
message: 'Either assortmentId or slug is required',
|
|
42
|
-
})
|
|
36
|
+
}),
|
|
43
37
|
LIST: z.object({
|
|
44
38
|
...PaginationSchema,
|
|
45
39
|
...SortingSchema,
|
|
46
40
|
...SearchSchema,
|
|
47
|
-
tags: z
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
slugs: z
|
|
51
|
-
.optional(z.array(z.string().check(z.minLength(1))))
|
|
52
|
-
.check(z.describe('Filter by assortment slugs')),
|
|
53
|
-
includeLeaves: z._default(z.boolean(), true).check(z.describe('Include leaf-level assortments')),
|
|
41
|
+
tags: z.array(z.string().min(1).toLowerCase()).optional().describe('Filter by tags'),
|
|
42
|
+
slugs: z.array(z.string().min(1)).optional().describe('Filter by assortment slugs'),
|
|
43
|
+
includeLeaves: z.boolean().default(true).optional().describe('Include leaf-level assortments'),
|
|
54
44
|
}),
|
|
55
45
|
COUNT: z.object({
|
|
56
46
|
...SearchSchema,
|
|
57
|
-
tags: z
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
slugs: z
|
|
61
|
-
.optional(z.array(z.string().check(z.minLength(1))))
|
|
62
|
-
.check(z.describe('Filter by assortment slugs')),
|
|
63
|
-
includeLeaves: z.optional(z.boolean()).check(z.describe('Include leaf-level assortments')),
|
|
47
|
+
tags: z.array(z.string().min(1).toLowerCase()).optional().describe('Filter by tags'),
|
|
48
|
+
slugs: z.array(z.string().min(1)).optional().describe('Filter by assortment slugs'),
|
|
49
|
+
includeLeaves: z.boolean().optional().describe('Include leaf-level assortments'),
|
|
64
50
|
}),
|
|
65
51
|
UPDATE_STATUS: z.object({
|
|
66
|
-
assortmentId: z.string().
|
|
67
|
-
statusAction: z.enum(['ACTIVATE', 'DEACTIVATE']).
|
|
52
|
+
assortmentId: z.string().min(1).describe('Assortment ID'),
|
|
53
|
+
statusAction: z.enum(['ACTIVATE', 'DEACTIVATE']).describe('Status action'),
|
|
68
54
|
}),
|
|
69
55
|
ADD_MEDIA: z.object({
|
|
70
|
-
assortmentId: z.string().
|
|
71
|
-
mediaId: z.string().
|
|
72
|
-
tags: z
|
|
73
|
-
.optional(z.array(z.string().check(z.minLength(1), z.toLowerCase())))
|
|
74
|
-
.check(z.describe('Tags for media association')),
|
|
56
|
+
assortmentId: z.string().min(1).describe('Assortment ID'),
|
|
57
|
+
mediaId: z.string().min(1).describe('Media ID'),
|
|
58
|
+
tags: z.array(z.string().min(1).toLowerCase()).optional().describe('Tags for media association'),
|
|
75
59
|
}),
|
|
76
60
|
REMOVE_MEDIA: z.object({
|
|
77
|
-
mediaId: z.string().
|
|
61
|
+
mediaId: z.string().min(1).describe('Media ID'),
|
|
78
62
|
}),
|
|
79
63
|
REORDER_MEDIA: z.object({
|
|
80
64
|
sortKeys: z
|
|
81
65
|
.array(z.object({
|
|
82
|
-
assortmentMediaId: z.string().
|
|
83
|
-
sortKey: z.
|
|
66
|
+
assortmentMediaId: z.string().min(1).describe('Assortment Media asset ID'),
|
|
67
|
+
sortKey: z.number().int().describe('New sort position'),
|
|
84
68
|
}))
|
|
85
|
-
.
|
|
69
|
+
.nonempty()
|
|
70
|
+
.describe('Sort keys'),
|
|
86
71
|
}),
|
|
87
72
|
GET_MEDIA: z.object({
|
|
88
|
-
assortmentId: z.string().
|
|
89
|
-
tags: z
|
|
90
|
-
.optional(z.array(z.string().check(z.minLength(1), z.toLowerCase())))
|
|
91
|
-
.check(z.describe('Filter by tags')),
|
|
73
|
+
assortmentId: z.string().min(1).describe('Assortment ID'),
|
|
74
|
+
tags: z.array(z.string().min(1).toLowerCase()).optional().describe('Filter by tags'),
|
|
92
75
|
...PaginationSchema,
|
|
93
76
|
}),
|
|
94
77
|
UPDATE_MEDIA_TEXTS: z.object({
|
|
95
|
-
assortmentMediaId: z.string().
|
|
96
|
-
mediaTexts: z.array(AssortmentMediaTextInputSchema).
|
|
78
|
+
assortmentMediaId: z.string().min(1).describe('Assortment media ID'),
|
|
79
|
+
mediaTexts: z.array(AssortmentMediaTextInputSchema).describe('Media texts'),
|
|
97
80
|
}),
|
|
98
81
|
ADD_PRODUCT: z.object({
|
|
99
|
-
assortmentId: z.string().
|
|
100
|
-
productId: z.string().
|
|
101
|
-
tags: z
|
|
102
|
-
.optional(z.array(z.string().check(z.minLength(1), z.toLowerCase())))
|
|
103
|
-
.check(z.describe('Tags for product association')),
|
|
82
|
+
assortmentId: z.string().min(1).describe('Assortment ID'),
|
|
83
|
+
productId: z.string().min(1).describe('Product ID'),
|
|
84
|
+
tags: z.array(z.string().min(1).toLowerCase()).optional().describe('Tags for product association'),
|
|
104
85
|
}),
|
|
105
86
|
REMOVE_PRODUCT: z.object({
|
|
106
87
|
assortmentProductId: z
|
|
107
88
|
.string()
|
|
108
|
-
.
|
|
89
|
+
.min(1)
|
|
90
|
+
.describe('Assortment Product ID (from assortment product relationship, _id of assortment product)'),
|
|
109
91
|
}),
|
|
110
92
|
GET_PRODUCTS: z.object({
|
|
111
|
-
assortmentId: z.string().
|
|
93
|
+
assortmentId: z.string().min(1).describe('Assortment ID'),
|
|
112
94
|
}),
|
|
113
95
|
REORDER_PRODUCTS: z.object({
|
|
114
96
|
sortKeys: z
|
|
115
97
|
.array(z.object({
|
|
116
98
|
assortmentProductId: z
|
|
117
99
|
.string()
|
|
118
|
-
.
|
|
119
|
-
|
|
100
|
+
.min(1)
|
|
101
|
+
.describe('Assortment product ID,(from assortment product relationship, _id of assortment product)'),
|
|
102
|
+
sortKey: z.number().int().describe('New sort position'),
|
|
120
103
|
}))
|
|
121
|
-
.
|
|
104
|
+
.nonempty()
|
|
105
|
+
.describe('Sort keys'),
|
|
122
106
|
}),
|
|
123
107
|
ADD_FILTER: z.object({
|
|
124
|
-
assortmentId: z.string().
|
|
125
|
-
filterId: z.string().
|
|
126
|
-
tags: z
|
|
127
|
-
.optional(z.array(z.string().check(z.minLength(1), z.toLowerCase())))
|
|
128
|
-
.check(z.describe('Tags for filter association')),
|
|
108
|
+
assortmentId: z.string().min(1).describe('Assortment ID'),
|
|
109
|
+
filterId: z.string().min(1).describe('Filter ID'),
|
|
110
|
+
tags: z.array(z.string().min(1).toLowerCase()).optional().describe('Tags for filter association'),
|
|
129
111
|
}),
|
|
130
112
|
REMOVE_FILTER: z.object({
|
|
131
113
|
assortmentFilterId: z
|
|
132
114
|
.string()
|
|
133
|
-
.
|
|
115
|
+
.min(1)
|
|
116
|
+
.describe('Assortment Filter ID (from assortment filter relationship)'),
|
|
134
117
|
}),
|
|
135
118
|
GET_FILTERS: z.object({
|
|
136
|
-
assortmentId: z.string().
|
|
119
|
+
assortmentId: z.string().min(1).describe('Assortment ID'),
|
|
137
120
|
}),
|
|
138
121
|
REORDER_FILTERS: z.object({
|
|
139
122
|
sortKeys: z
|
|
140
123
|
.array(z.object({
|
|
141
124
|
assortmentFilterId: z
|
|
142
125
|
.string()
|
|
143
|
-
.
|
|
144
|
-
|
|
126
|
+
.min(1)
|
|
127
|
+
.describe('Assortment filter ID (from assortment filter relationship)'),
|
|
128
|
+
sortKey: z.number().int().describe('New sort position'),
|
|
145
129
|
}))
|
|
146
|
-
.
|
|
130
|
+
.nonempty()
|
|
131
|
+
.describe('Sort keys'),
|
|
147
132
|
}),
|
|
148
133
|
ADD_LINK: z.object({
|
|
149
|
-
parentAssortmentId: z.string().
|
|
150
|
-
childAssortmentId: z.string().
|
|
151
|
-
tags: z
|
|
152
|
-
.optional(z.array(z.string().check(z.minLength(1), z.toLowerCase())))
|
|
153
|
-
.check(z.describe('Tags for link association')),
|
|
134
|
+
parentAssortmentId: z.string().min(1).describe('Parent assortment ID'),
|
|
135
|
+
childAssortmentId: z.string().min(1).describe('Child assortment ID'),
|
|
136
|
+
tags: z.array(z.string().min(1).toLowerCase()).optional().describe('Tags for link association'),
|
|
154
137
|
}),
|
|
155
138
|
REMOVE_LINK: z.object({
|
|
156
|
-
assortmentLinkId: z.string().
|
|
139
|
+
assortmentLinkId: z.string().min(1).describe('Assortment link ID'),
|
|
157
140
|
}),
|
|
158
141
|
GET_LINKS: z.object({
|
|
159
|
-
assortmentId: z.string().
|
|
142
|
+
assortmentId: z.string().min(1).describe('Assortment ID'),
|
|
160
143
|
}),
|
|
161
144
|
REORDER_LINKS: z.object({
|
|
162
145
|
sortKeys: z
|
|
163
146
|
.array(z.object({
|
|
164
|
-
assortmentLinkId: z.string().
|
|
165
|
-
sortKey: z.
|
|
147
|
+
assortmentLinkId: z.string().min(1).describe('Assortment link ID'),
|
|
148
|
+
sortKey: z.number().int().describe('New sort position'),
|
|
166
149
|
}))
|
|
167
|
-
.
|
|
150
|
+
.nonempty()
|
|
151
|
+
.describe('Sort keys'),
|
|
168
152
|
}),
|
|
169
153
|
GET_CHILDREN: z.object({
|
|
170
|
-
assortmentId: z
|
|
171
|
-
|
|
172
|
-
.check(z.minLength(1), z.describe('Assortment ID (optional for root-level)')),
|
|
173
|
-
includeInactive: z.optional(z.boolean()).check(z.describe('Include inactive children')),
|
|
154
|
+
assortmentId: z.string().min(1).describe('Assortment ID (optional for root-level)'),
|
|
155
|
+
includeInactive: z.boolean().optional().describe('Include inactive children'),
|
|
174
156
|
}),
|
|
175
157
|
SEARCH_PRODUCTS: z.object({
|
|
176
|
-
assortmentId: z.string().
|
|
158
|
+
assortmentId: z.string().min(1).describe('Assortment ID'),
|
|
177
159
|
...PaginationSchema,
|
|
178
160
|
...SearchSchema,
|
|
179
161
|
}),
|
|
180
162
|
GET_TEXTS: z.object({
|
|
181
|
-
assortmentId: z.string().
|
|
163
|
+
assortmentId: z.string().min(1).describe('Assortment ID'),
|
|
182
164
|
}),
|
|
183
165
|
GET_MEDIA_TEXTS: z.object({
|
|
184
|
-
assortmentMediaId: z.string().
|
|
166
|
+
assortmentMediaId: z.string().min(1).describe('Assortment media ID'),
|
|
185
167
|
}),
|
|
186
168
|
};
|
|
187
|
-
export const AssortmentManagementSchema =
|
|
169
|
+
export const AssortmentManagementSchema = {
|
|
170
|
+
action: z
|
|
171
|
+
.enum([
|
|
172
|
+
'CREATE',
|
|
173
|
+
'UPDATE',
|
|
174
|
+
'REMOVE',
|
|
175
|
+
'GET',
|
|
176
|
+
'LIST',
|
|
177
|
+
'COUNT',
|
|
178
|
+
'UPDATE_STATUS',
|
|
179
|
+
'ADD_MEDIA',
|
|
180
|
+
'REMOVE_MEDIA',
|
|
181
|
+
'REORDER_MEDIA',
|
|
182
|
+
'GET_MEDIA',
|
|
183
|
+
'UPDATE_MEDIA_TEXTS',
|
|
184
|
+
'ADD_PRODUCT',
|
|
185
|
+
'REMOVE_PRODUCT',
|
|
186
|
+
'GET_PRODUCTS',
|
|
187
|
+
'REORDER_PRODUCTS',
|
|
188
|
+
'ADD_FILTER',
|
|
189
|
+
'REMOVE_FILTER',
|
|
190
|
+
'GET_FILTERS',
|
|
191
|
+
'REORDER_FILTERS',
|
|
192
|
+
'ADD_LINK',
|
|
193
|
+
'REMOVE_LINK',
|
|
194
|
+
'GET_LINKS',
|
|
195
|
+
'REORDER_LINKS',
|
|
196
|
+
'GET_CHILDREN',
|
|
197
|
+
'SEARCH_PRODUCTS',
|
|
198
|
+
'GET_TEXTS',
|
|
199
|
+
'GET_MEDIA_TEXTS',
|
|
200
|
+
])
|
|
201
|
+
.describe('Assortment management action to perform'),
|
|
202
|
+
assortmentId: z
|
|
203
|
+
.string()
|
|
204
|
+
.min(1)
|
|
205
|
+
.optional()
|
|
206
|
+
.describe('Assortment ID (required for most actions except CREATE, LIST, COUNT)'),
|
|
207
|
+
slug: z.string().optional().describe('Assortment slug (alternative to assortmentId for GET action)'),
|
|
208
|
+
assortmentMediaId: z
|
|
209
|
+
.string()
|
|
210
|
+
.min(1)
|
|
211
|
+
.optional()
|
|
212
|
+
.describe('Assortment media ID (required for media-specific actions)'),
|
|
213
|
+
assortment: AssortmentSchema.optional().describe('Assortment data object for CREATE/UPDATE actions'),
|
|
214
|
+
texts: z
|
|
215
|
+
.array(AssortmentTextInputSchema)
|
|
216
|
+
.optional()
|
|
217
|
+
.describe('Localized assortment text entries for CREATE action'),
|
|
218
|
+
statusAction: z
|
|
219
|
+
.enum(['ACTIVATE', 'DEACTIVATE'])
|
|
220
|
+
.optional()
|
|
221
|
+
.describe('Status action for UPDATE_STATUS action'),
|
|
222
|
+
mediaId: z.string().min(1).optional().describe('Media ID for ADD_MEDIA action'),
|
|
223
|
+
sortKeys: z
|
|
224
|
+
.array(z.union([
|
|
225
|
+
z.object({
|
|
226
|
+
assortmentMediaId: z.string().min(1).describe('Media asset ID'),
|
|
227
|
+
sortKey: z.number().int().describe('New sort position'),
|
|
228
|
+
}),
|
|
229
|
+
z.object({
|
|
230
|
+
assortmentProductId: z.string().min(1).describe('_id of assortment product relationship ID'),
|
|
231
|
+
sortKey: z.number().int().describe('New sort position'),
|
|
232
|
+
}),
|
|
233
|
+
z.object({
|
|
234
|
+
assortmentFilterId: z.string().min(1).describe('Filter relationship ID'),
|
|
235
|
+
sortKey: z.number().int().describe('New sort position'),
|
|
236
|
+
}),
|
|
237
|
+
z.object({
|
|
238
|
+
assortmentLinkId: z.string().min(1).describe('Link relationship ID'),
|
|
239
|
+
sortKey: z.number().int().describe('New sort position'),
|
|
240
|
+
}),
|
|
241
|
+
]))
|
|
242
|
+
.optional()
|
|
243
|
+
.describe('Sort keys for REORDER actions'),
|
|
244
|
+
mediaTexts: z
|
|
245
|
+
.array(AssortmentMediaTextInputSchema)
|
|
246
|
+
.optional()
|
|
247
|
+
.describe('Media text updates for UPDATE_MEDIA_TEXTS action'),
|
|
248
|
+
tags: z.array(z.string()).optional().describe('Tags filter or association tags'),
|
|
249
|
+
assortmentProductId: z
|
|
250
|
+
.string()
|
|
251
|
+
.min(1)
|
|
252
|
+
.optional()
|
|
253
|
+
.describe('Product ID for REORDER_PRODUCTS/REMOVE_PRODUCT actions'),
|
|
254
|
+
productId: z.string().min(1).optional().describe('Product ID for ADD_PRODUCT/REMOVE_PRODUCT actions'),
|
|
255
|
+
filterId: z.string().min(1).optional().describe('Filter ID for ADD_FILTER/REMOVE_FILTER actions'),
|
|
256
|
+
assortmentFilterId: z
|
|
257
|
+
.string()
|
|
258
|
+
.min(1)
|
|
259
|
+
.optional()
|
|
260
|
+
.describe('Filter ID for REORDER_FILTERS/REMOVE_FILTER actions'),
|
|
261
|
+
parentAssortmentId: z.string().min(1).optional().describe('Parent assortment ID for ADD_LINK action'),
|
|
262
|
+
childAssortmentId: z.string().min(1).optional().describe('Child assortment ID for ADD_LINK action'),
|
|
263
|
+
assortmentLinkId: z.string().min(1).optional().describe('Link ID for REMOVE_LINK action'),
|
|
264
|
+
...PaginationSchema,
|
|
265
|
+
...SortingSchema,
|
|
266
|
+
...SearchSchema,
|
|
267
|
+
includeLeaves: z.boolean().optional().describe('Include leaf-level assortments in results'),
|
|
268
|
+
slugs: z.array(z.string()).optional().describe('Filter by specific slugs'),
|
|
269
|
+
};
|
|
270
|
+
export const AssortmentManagementZodSchema = z.object(AssortmentManagementSchema);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Context } from '../../../context.ts';
|
|
2
|
-
import { FilterManagementSchema, type FilterManagementParams } from './schemas.ts';
|
|
3
|
-
export { FilterManagementSchema };
|
|
2
|
+
import { FilterManagementSchema, FilterManagementZodSchema, type FilterManagementParams } from './schemas.ts';
|
|
3
|
+
export { FilterManagementSchema, FilterManagementZodSchema };
|
|
4
4
|
export type { FilterManagementParams };
|
|
5
5
|
export declare function filterManagement(context: Context, params: FilterManagementParams): Promise<{
|
|
6
6
|
content: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { log } from '@unchainedshop/logger';
|
|
2
|
-
import { actionValidators, FilterManagementSchema, } from "./schemas.js";
|
|
2
|
+
import { actionValidators, FilterManagementSchema, FilterManagementZodSchema, } from "./schemas.js";
|
|
3
3
|
import actionHandlers from "./handlers/index.js";
|
|
4
4
|
import { createMcpResponse, createMcpErrorResponse } from "../../utils/sharedSchemas.js";
|
|
5
|
-
export { FilterManagementSchema };
|
|
5
|
+
export { FilterManagementSchema, FilterManagementZodSchema };
|
|
6
6
|
export async function filterManagement(context, params) {
|
|
7
7
|
const { action, ...actionParams } = params;
|
|
8
8
|
log('MCP handler filterManagement ', { userId: context.userId, params });
|