@unchainedshop/api 4.7.2 → 4.8.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 +1 -29
- package/lib/api-index.d.ts +0 -1
- package/lib/chat/generateImageHandler.js +5 -6
- package/lib/context.d.ts +0 -1
- package/lib/context.js +3 -8
- package/lib/events.d.ts +0 -2
- package/lib/events.js +0 -2
- package/lib/express/createMCPMiddleware.js +1 -1
- package/lib/express/index.d.ts +9 -6
- package/lib/express/index.js +125 -52
- package/lib/fastify/index.d.ts +9 -6
- package/lib/fastify/index.js +113 -51
- package/lib/fastify/mcpHandler.js +1 -1
- package/lib/loaders/buildTextMap.js +13 -15
- 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 +141 -322
- package/lib/mcp/tools/assortment/schemas.js +96 -179
- 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 +75 -184
- package/lib/mcp/tools/filter/schemas.js +51 -87
- 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 +47 -144
- package/lib/mcp/tools/localization/schemas.js +36 -51
- package/lib/mcp/tools/order/handlers/getTopCustomers.d.ts +0 -2
- 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 +75 -184
- package/lib/mcp/tools/order/schemas.js +51 -113
- 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 +317 -642
- package/lib/mcp/tools/product/schemas.js +191 -287
- 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 +47 -142
- package/lib/mcp/tools/provider/schemas.js +32 -67
- package/lib/mcp/tools/quotation/handlers/getQuotation.d.ts +0 -2
- package/lib/mcp/tools/quotation/handlers/listQuotations.d.ts +0 -2
- package/lib/mcp/tools/quotation/handlers/makeQuotationProposal.d.ts +0 -2
- package/lib/mcp/tools/quotation/handlers/rejectQuotation.d.ts +0 -2
- package/lib/mcp/tools/quotation/handlers/verifyQuotation.d.ts +0 -2
- 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 +40 -111
- package/lib/mcp/tools/quotation/schemas.js +29 -54
- package/lib/mcp/tools/system/handlers/countEvents.d.ts +1 -8
- package/lib/mcp/tools/system/handlers/countWork.d.ts +1 -10
- package/lib/mcp/tools/system/handlers/countWork.js +0 -1
- package/lib/mcp/tools/system/handlers/index.d.ts +4 -4
- package/lib/mcp/tools/system/handlers/listEvents.d.ts +1 -12
- package/lib/mcp/tools/system/handlers/listWork.d.ts +1 -14
- package/lib/mcp/tools/system/handlers/listWork.js +0 -1
- package/lib/mcp/tools/system/schemas.d.ts +84 -179
- package/lib/mcp/tools/system/schemas.js +67 -188
- 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 +0 -2
- package/lib/mcp/tools/users/handlers/createUser.d.ts +0 -2
- package/lib/mcp/tools/users/handlers/enrollUser.d.ts +0 -2
- package/lib/mcp/tools/users/handlers/getCurrentUser.d.ts +0 -2
- package/lib/mcp/tools/users/handlers/getUser.d.ts +0 -2
- package/lib/mcp/tools/users/handlers/listUsers.d.ts +0 -2
- package/lib/mcp/tools/users/handlers/setUserTags.d.ts +0 -2
- package/lib/mcp/tools/users/handlers/setUserUsername.d.ts +0 -2
- package/lib/mcp/tools/users/handlers/updateUser.d.ts +0 -2
- package/lib/mcp/tools/users/schemas.d.ts +163 -296
- package/lib/mcp/tools/users/schemas.js +71 -152
- 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 +0 -2
- package/lib/mcp/utils/getNormalizedUserDetails.d.ts +0 -2
- package/lib/mcp/utils/normalizeMediaUrl.js +1 -1
- package/lib/mcp/utils/sanitizeLocalizationEntityData.d.ts +1 -1
- package/lib/mcp/utils/sharedSchemas.d.ts +39 -28
- package/lib/mcp/utils/sharedSchemas.js +47 -28
- package/lib/mcp/utils/validateIsoCode.d.ts +1 -1
- package/lib/resolvers/mutations/accounts/changePassword.js +1 -4
- package/lib/resolvers/mutations/index.d.ts +6 -1
- package/lib/resolvers/mutations/index.js +12 -2
- package/lib/resolvers/mutations/orders/updateCart.js +1 -7
- package/lib/resolvers/queries/orders/orders.js +2 -2
- package/lib/resolvers/type/index.d.ts +1 -0
- package/lib/resolvers/type/order/order-delivery-pickup-types.d.ts +1 -0
- package/lib/resolvers/type/order/order-delivery-pickup-types.js +7 -0
- package/lib/roles/index.js +0 -1
- package/lib/roles/loggedIn.js +0 -1
- package/lib/schema/mutation.js +44 -6
- package/lib/schema/types/index.js +2 -2
- package/lib/schema/types/order/delivery.js +2 -0
- package/package.json +17 -8
|
@@ -1,270 +1,187 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
1
|
+
import { z } from 'zod/v4-mini';
|
|
2
2
|
import { SortDirection } from '@unchainedshop/utils';
|
|
3
|
-
import { PaginationSchema, SortingSchema, SearchSchema, LocalizationTextSchema, } from "../../utils/sharedSchemas.js";
|
|
3
|
+
import { PaginationSchema, SortingSchema, SearchSchema, LocalizationTextSchema, createManagementSchemaFromValidators, } from "../../utils/sharedSchemas.js";
|
|
4
4
|
export const sortDirectionKeys = Object.keys(SortDirection);
|
|
5
|
-
export const AssortmentTextInputSchema =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
export const AssortmentTextInputSchema = z
|
|
6
|
+
.extend(LocalizationTextSchema, {
|
|
7
|
+
slug: z.optional(z.string()).check(z.describe('URL slug')),
|
|
8
|
+
description: z.optional(z.string()).check(z.describe('Markdown description')),
|
|
9
|
+
})
|
|
10
|
+
.check(z.describe('Assortment localized text data'));
|
|
11
|
+
export const AssortmentMediaTextInputSchema = LocalizationTextSchema.check(z.describe('Assortment media localized text data'));
|
|
10
12
|
export const AssortmentSchema = z.object({
|
|
11
|
-
isRoot: z.boolean().
|
|
12
|
-
isActive: z.boolean().
|
|
13
|
-
tags: z
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
isRoot: z.optional(z.boolean()).check(z.describe('Whether this is a root-level assortment')),
|
|
14
|
+
isActive: z.optional(z.boolean()).check(z.describe('Whether this assortment is active')),
|
|
15
|
+
tags: z
|
|
16
|
+
.optional(z.array(z.string().check(z.minLength(1), z.toLowerCase())))
|
|
17
|
+
.check(z.describe('Tags (lowercased strings)')),
|
|
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')),
|
|
16
20
|
});
|
|
17
21
|
export const actionValidators = {
|
|
18
22
|
CREATE: z.object({
|
|
19
|
-
assortment: AssortmentSchema.describe('Assortment data'),
|
|
20
|
-
texts: z
|
|
23
|
+
assortment: AssortmentSchema.check(z.describe('Assortment data')),
|
|
24
|
+
texts: z
|
|
25
|
+
.optional(z.array(AssortmentTextInputSchema))
|
|
26
|
+
.check(z.describe('Localized assortment text entries')),
|
|
21
27
|
}),
|
|
22
28
|
UPDATE: z.object({
|
|
23
|
-
assortmentId: z.string().
|
|
24
|
-
assortment: AssortmentSchema.describe('Assortment data to update'),
|
|
29
|
+
assortmentId: z.string().check(z.minLength(1), z.describe('Assortment ID')),
|
|
30
|
+
assortment: AssortmentSchema.check(z.describe('Assortment data to update')),
|
|
25
31
|
}),
|
|
26
32
|
REMOVE: z.object({
|
|
27
|
-
assortmentId: z.string().
|
|
33
|
+
assortmentId: z.string().check(z.minLength(1), z.describe('Assortment ID')),
|
|
28
34
|
}),
|
|
29
35
|
GET: z
|
|
30
36
|
.object({
|
|
31
|
-
assortmentId: z.string().
|
|
32
|
-
slug: z.string().
|
|
37
|
+
assortmentId: z.optional(z.string().check(z.minLength(1))).check(z.describe('Assortment ID')),
|
|
38
|
+
slug: z.optional(z.string()).check(z.describe('Assortment slug')),
|
|
33
39
|
})
|
|
34
|
-
.refine((data) => data.assortmentId || data.slug, {
|
|
40
|
+
.check(z.refine((data) => data.assortmentId || data.slug, {
|
|
35
41
|
message: 'Either assortmentId or slug is required',
|
|
36
|
-
}),
|
|
42
|
+
})),
|
|
37
43
|
LIST: z.object({
|
|
38
44
|
...PaginationSchema,
|
|
39
45
|
...SortingSchema,
|
|
40
46
|
...SearchSchema,
|
|
41
|
-
tags: z
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
tags: z
|
|
48
|
+
.optional(z.array(z.string().check(z.minLength(1), z.toLowerCase())))
|
|
49
|
+
.check(z.describe('Filter by tags')),
|
|
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')),
|
|
44
54
|
}),
|
|
45
55
|
COUNT: z.object({
|
|
46
56
|
...SearchSchema,
|
|
47
|
-
tags: z
|
|
48
|
-
|
|
49
|
-
|
|
57
|
+
tags: z
|
|
58
|
+
.optional(z.array(z.string().check(z.minLength(1), z.toLowerCase())))
|
|
59
|
+
.check(z.describe('Filter by tags')),
|
|
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')),
|
|
50
64
|
}),
|
|
51
65
|
UPDATE_STATUS: z.object({
|
|
52
|
-
assortmentId: z.string().
|
|
53
|
-
statusAction: z.enum(['ACTIVATE', 'DEACTIVATE']).describe('Status action'),
|
|
66
|
+
assortmentId: z.string().check(z.minLength(1), z.describe('Assortment ID')),
|
|
67
|
+
statusAction: z.enum(['ACTIVATE', 'DEACTIVATE']).check(z.describe('Status action')),
|
|
54
68
|
}),
|
|
55
69
|
ADD_MEDIA: z.object({
|
|
56
|
-
assortmentId: z.string().
|
|
57
|
-
mediaId: z.string().
|
|
58
|
-
tags: z
|
|
70
|
+
assortmentId: z.string().check(z.minLength(1), z.describe('Assortment ID')),
|
|
71
|
+
mediaId: z.string().check(z.minLength(1), z.describe('Media ID')),
|
|
72
|
+
tags: z
|
|
73
|
+
.optional(z.array(z.string().check(z.minLength(1), z.toLowerCase())))
|
|
74
|
+
.check(z.describe('Tags for media association')),
|
|
59
75
|
}),
|
|
60
76
|
REMOVE_MEDIA: z.object({
|
|
61
|
-
mediaId: z.string().
|
|
77
|
+
mediaId: z.string().check(z.minLength(1), z.describe('Media ID')),
|
|
62
78
|
}),
|
|
63
79
|
REORDER_MEDIA: z.object({
|
|
64
80
|
sortKeys: z
|
|
65
81
|
.array(z.object({
|
|
66
|
-
assortmentMediaId: z.string().
|
|
67
|
-
sortKey: z.
|
|
82
|
+
assortmentMediaId: z.string().check(z.minLength(1), z.describe('Assortment Media asset ID')),
|
|
83
|
+
sortKey: z.int().check(z.describe('New sort position')),
|
|
68
84
|
}))
|
|
69
|
-
.
|
|
70
|
-
.describe('Sort keys'),
|
|
85
|
+
.check(z.minLength(1), z.describe('Sort keys')),
|
|
71
86
|
}),
|
|
72
87
|
GET_MEDIA: z.object({
|
|
73
|
-
assortmentId: z.string().
|
|
74
|
-
tags: z
|
|
88
|
+
assortmentId: z.string().check(z.minLength(1), z.describe('Assortment ID')),
|
|
89
|
+
tags: z
|
|
90
|
+
.optional(z.array(z.string().check(z.minLength(1), z.toLowerCase())))
|
|
91
|
+
.check(z.describe('Filter by tags')),
|
|
75
92
|
...PaginationSchema,
|
|
76
93
|
}),
|
|
77
94
|
UPDATE_MEDIA_TEXTS: z.object({
|
|
78
|
-
assortmentMediaId: z.string().
|
|
79
|
-
mediaTexts: z.array(AssortmentMediaTextInputSchema).describe('Media texts'),
|
|
95
|
+
assortmentMediaId: z.string().check(z.minLength(1), z.describe('Assortment media ID')),
|
|
96
|
+
mediaTexts: z.array(AssortmentMediaTextInputSchema).check(z.describe('Media texts')),
|
|
80
97
|
}),
|
|
81
98
|
ADD_PRODUCT: z.object({
|
|
82
|
-
assortmentId: z.string().
|
|
83
|
-
productId: z.string().
|
|
84
|
-
tags: z
|
|
99
|
+
assortmentId: z.string().check(z.minLength(1), z.describe('Assortment ID')),
|
|
100
|
+
productId: z.string().check(z.minLength(1), z.describe('Product ID')),
|
|
101
|
+
tags: z
|
|
102
|
+
.optional(z.array(z.string().check(z.minLength(1), z.toLowerCase())))
|
|
103
|
+
.check(z.describe('Tags for product association')),
|
|
85
104
|
}),
|
|
86
105
|
REMOVE_PRODUCT: z.object({
|
|
87
106
|
assortmentProductId: z
|
|
88
107
|
.string()
|
|
89
|
-
.
|
|
90
|
-
.describe('Assortment Product ID (from assortment product relationship, _id of assortment product)'),
|
|
108
|
+
.check(z.minLength(1), z.describe('Assortment Product ID (from assortment product relationship, _id of assortment product)')),
|
|
91
109
|
}),
|
|
92
110
|
GET_PRODUCTS: z.object({
|
|
93
|
-
assortmentId: z.string().
|
|
111
|
+
assortmentId: z.string().check(z.minLength(1), z.describe('Assortment ID')),
|
|
94
112
|
}),
|
|
95
113
|
REORDER_PRODUCTS: z.object({
|
|
96
114
|
sortKeys: z
|
|
97
115
|
.array(z.object({
|
|
98
116
|
assortmentProductId: z
|
|
99
117
|
.string()
|
|
100
|
-
.
|
|
101
|
-
|
|
102
|
-
sortKey: z.number().int().describe('New sort position'),
|
|
118
|
+
.check(z.minLength(1), z.describe('Assortment product ID,(from assortment product relationship, _id of assortment product)')),
|
|
119
|
+
sortKey: z.int().check(z.describe('New sort position')),
|
|
103
120
|
}))
|
|
104
|
-
.
|
|
105
|
-
.describe('Sort keys'),
|
|
121
|
+
.check(z.minLength(1), z.describe('Sort keys')),
|
|
106
122
|
}),
|
|
107
123
|
ADD_FILTER: z.object({
|
|
108
|
-
assortmentId: z.string().
|
|
109
|
-
filterId: z.string().
|
|
110
|
-
tags: z
|
|
124
|
+
assortmentId: z.string().check(z.minLength(1), z.describe('Assortment ID')),
|
|
125
|
+
filterId: z.string().check(z.minLength(1), z.describe('Filter ID')),
|
|
126
|
+
tags: z
|
|
127
|
+
.optional(z.array(z.string().check(z.minLength(1), z.toLowerCase())))
|
|
128
|
+
.check(z.describe('Tags for filter association')),
|
|
111
129
|
}),
|
|
112
130
|
REMOVE_FILTER: z.object({
|
|
113
131
|
assortmentFilterId: z
|
|
114
132
|
.string()
|
|
115
|
-
.
|
|
116
|
-
.describe('Assortment Filter ID (from assortment filter relationship)'),
|
|
133
|
+
.check(z.minLength(1), z.describe('Assortment Filter ID (from assortment filter relationship)')),
|
|
117
134
|
}),
|
|
118
135
|
GET_FILTERS: z.object({
|
|
119
|
-
assortmentId: z.string().
|
|
136
|
+
assortmentId: z.string().check(z.minLength(1), z.describe('Assortment ID')),
|
|
120
137
|
}),
|
|
121
138
|
REORDER_FILTERS: z.object({
|
|
122
139
|
sortKeys: z
|
|
123
140
|
.array(z.object({
|
|
124
141
|
assortmentFilterId: z
|
|
125
142
|
.string()
|
|
126
|
-
.
|
|
127
|
-
|
|
128
|
-
sortKey: z.number().int().describe('New sort position'),
|
|
143
|
+
.check(z.minLength(1), z.describe('Assortment filter ID (from assortment filter relationship)')),
|
|
144
|
+
sortKey: z.int().check(z.describe('New sort position')),
|
|
129
145
|
}))
|
|
130
|
-
.
|
|
131
|
-
.describe('Sort keys'),
|
|
146
|
+
.check(z.minLength(1), z.describe('Sort keys')),
|
|
132
147
|
}),
|
|
133
148
|
ADD_LINK: z.object({
|
|
134
|
-
parentAssortmentId: z.string().
|
|
135
|
-
childAssortmentId: z.string().
|
|
136
|
-
tags: z
|
|
149
|
+
parentAssortmentId: z.string().check(z.minLength(1), z.describe('Parent assortment ID')),
|
|
150
|
+
childAssortmentId: z.string().check(z.minLength(1), z.describe('Child assortment ID')),
|
|
151
|
+
tags: z
|
|
152
|
+
.optional(z.array(z.string().check(z.minLength(1), z.toLowerCase())))
|
|
153
|
+
.check(z.describe('Tags for link association')),
|
|
137
154
|
}),
|
|
138
155
|
REMOVE_LINK: z.object({
|
|
139
|
-
assortmentLinkId: z.string().
|
|
156
|
+
assortmentLinkId: z.string().check(z.minLength(1), z.describe('Assortment link ID')),
|
|
140
157
|
}),
|
|
141
158
|
GET_LINKS: z.object({
|
|
142
|
-
assortmentId: z.string().
|
|
159
|
+
assortmentId: z.string().check(z.minLength(1), z.describe('Assortment ID')),
|
|
143
160
|
}),
|
|
144
161
|
REORDER_LINKS: z.object({
|
|
145
162
|
sortKeys: z
|
|
146
163
|
.array(z.object({
|
|
147
|
-
assortmentLinkId: z.string().
|
|
148
|
-
sortKey: z.
|
|
164
|
+
assortmentLinkId: z.string().check(z.minLength(1), z.describe('Assortment link ID')),
|
|
165
|
+
sortKey: z.int().check(z.describe('New sort position')),
|
|
149
166
|
}))
|
|
150
|
-
.
|
|
151
|
-
.describe('Sort keys'),
|
|
167
|
+
.check(z.minLength(1), z.describe('Sort keys')),
|
|
152
168
|
}),
|
|
153
169
|
GET_CHILDREN: z.object({
|
|
154
|
-
assortmentId: z
|
|
155
|
-
|
|
170
|
+
assortmentId: z
|
|
171
|
+
.string()
|
|
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')),
|
|
156
174
|
}),
|
|
157
175
|
SEARCH_PRODUCTS: z.object({
|
|
158
|
-
assortmentId: z.string().
|
|
176
|
+
assortmentId: z.string().check(z.minLength(1), z.describe('Assortment ID')),
|
|
159
177
|
...PaginationSchema,
|
|
160
178
|
...SearchSchema,
|
|
161
179
|
}),
|
|
162
180
|
GET_TEXTS: z.object({
|
|
163
|
-
assortmentId: z.string().
|
|
181
|
+
assortmentId: z.string().check(z.minLength(1), z.describe('Assortment ID')),
|
|
164
182
|
}),
|
|
165
183
|
GET_MEDIA_TEXTS: z.object({
|
|
166
|
-
assortmentMediaId: z.string().
|
|
184
|
+
assortmentMediaId: z.string().check(z.minLength(1), z.describe('Assortment media ID')),
|
|
167
185
|
}),
|
|
168
186
|
};
|
|
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);
|
|
187
|
+
export const AssortmentManagementSchema = createManagementSchemaFromValidators(actionValidators);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Context } from '../../../context.ts';
|
|
2
|
-
import { FilterManagementSchema,
|
|
3
|
-
export { FilterManagementSchema
|
|
2
|
+
import { FilterManagementSchema, type FilterManagementParams } from './schemas.ts';
|
|
3
|
+
export { FilterManagementSchema };
|
|
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,
|
|
2
|
+
import { actionValidators, FilterManagementSchema, } 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 };
|
|
6
6
|
export async function filterManagement(context, params) {
|
|
7
7
|
const { action, ...actionParams } = params;
|
|
8
8
|
log('MCP handler filterManagement ', { userId: context.userId, params });
|