@unchainedshop/api 4.8.0 → 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/chat/generateImageHandler.js +5 -6
- package/lib/express/createMCPMiddleware.js +1 -1
- 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/localizationManagement.d.ts +2 -2
- package/lib/mcp/tools/localization/localizationManagement.js +2 -2
- package/lib/mcp/tools/localization/schemas.d.ts +47 -110
- package/lib/mcp/tools/localization/schemas.js +36 -51
- 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/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/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/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/sharedSchemas.d.ts +39 -28
- package/lib/mcp/utils/sharedSchemas.js +47 -28
- package/lib/resolvers/mutations/accounts/changePassword.js +1 -4
- package/package.json +1 -1
|
@@ -1,227 +1,118 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const FilterTextInputSchema: z.
|
|
3
|
-
locale: z.
|
|
4
|
-
title: z.
|
|
5
|
-
subtitle: z.
|
|
1
|
+
import { z } from 'zod/v4-mini';
|
|
2
|
+
export declare const FilterTextInputSchema: z.ZodMiniObject<{
|
|
3
|
+
locale: z.ZodMiniString<string>;
|
|
4
|
+
title: z.ZodMiniString<string>;
|
|
5
|
+
subtitle: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
6
6
|
}, z.core.$strip>;
|
|
7
|
-
export declare const FilterOptionTextInputSchema: z.
|
|
8
|
-
locale: z.
|
|
9
|
-
subtitle: z.
|
|
10
|
-
title: z.
|
|
7
|
+
export declare const FilterOptionTextInputSchema: z.ZodMiniObject<{
|
|
8
|
+
locale: z.ZodMiniString<string>;
|
|
9
|
+
subtitle: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
10
|
+
title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
11
11
|
}, z.core.$strip>;
|
|
12
|
-
export declare const SortOptionInputSchema: z.
|
|
13
|
-
key: z.
|
|
14
|
-
value: z.
|
|
12
|
+
export declare const SortOptionInputSchema: z.ZodMiniObject<{
|
|
13
|
+
key: z.ZodMiniString<string>;
|
|
14
|
+
value: z.ZodMiniEnum<{
|
|
15
15
|
ASC: "ASC";
|
|
16
16
|
DESC: "DESC";
|
|
17
17
|
}>;
|
|
18
18
|
}, z.core.$strict>;
|
|
19
|
-
export declare const CreateFilterInputSchema: z.
|
|
20
|
-
key: z.
|
|
21
|
-
type: z.
|
|
19
|
+
export declare const CreateFilterInputSchema: z.ZodMiniObject<{
|
|
20
|
+
key: z.ZodMiniString<string>;
|
|
21
|
+
type: z.ZodMiniEnum<{
|
|
22
22
|
SWITCH: "SWITCH";
|
|
23
23
|
SINGLE_CHOICE: "SINGLE_CHOICE";
|
|
24
24
|
MULTI_CHOICE: "MULTI_CHOICE";
|
|
25
25
|
RANGE: "RANGE";
|
|
26
26
|
}>;
|
|
27
|
-
options: z.
|
|
27
|
+
options: z.ZodMiniDefault<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
28
28
|
}, z.core.$strip>;
|
|
29
|
-
export declare const UpdateFilterInputSchema: z.
|
|
30
|
-
isActive: z.
|
|
31
|
-
key: z.
|
|
29
|
+
export declare const UpdateFilterInputSchema: z.ZodMiniObject<{
|
|
30
|
+
isActive: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
31
|
+
key: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
32
32
|
}, z.core.$strip>;
|
|
33
|
-
export declare const FilterUpdateTextInputSchema: z.
|
|
34
|
-
locale: z.
|
|
35
|
-
title: z.
|
|
36
|
-
subtitle: z.
|
|
33
|
+
export declare const FilterUpdateTextInputSchema: z.ZodMiniObject<{
|
|
34
|
+
locale: z.ZodMiniString<string>;
|
|
35
|
+
title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
36
|
+
subtitle: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
37
37
|
}, z.core.$strip>;
|
|
38
38
|
export declare const actionValidators: {
|
|
39
|
-
readonly CREATE: z.
|
|
40
|
-
filter: z.
|
|
41
|
-
key: z.
|
|
42
|
-
type: z.
|
|
39
|
+
readonly CREATE: z.ZodMiniObject<{
|
|
40
|
+
filter: z.ZodMiniObject<{
|
|
41
|
+
key: z.ZodMiniString<string>;
|
|
42
|
+
type: z.ZodMiniEnum<{
|
|
43
43
|
SWITCH: "SWITCH";
|
|
44
44
|
SINGLE_CHOICE: "SINGLE_CHOICE";
|
|
45
45
|
MULTI_CHOICE: "MULTI_CHOICE";
|
|
46
46
|
RANGE: "RANGE";
|
|
47
47
|
}>;
|
|
48
|
-
options: z.
|
|
48
|
+
options: z.ZodMiniDefault<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
49
49
|
}, z.core.$strip>;
|
|
50
|
-
texts: z.
|
|
51
|
-
locale: z.
|
|
52
|
-
title: z.
|
|
53
|
-
subtitle: z.
|
|
50
|
+
texts: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
|
|
51
|
+
locale: z.ZodMiniString<string>;
|
|
52
|
+
title: z.ZodMiniString<string>;
|
|
53
|
+
subtitle: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
54
54
|
}, z.core.$strip>>>;
|
|
55
55
|
}, z.core.$strip>;
|
|
56
|
-
readonly UPDATE: z.
|
|
57
|
-
filterId: z.
|
|
58
|
-
updateData: z.
|
|
59
|
-
isActive: z.
|
|
60
|
-
key: z.
|
|
56
|
+
readonly UPDATE: z.ZodMiniObject<{
|
|
57
|
+
filterId: z.ZodMiniString<string>;
|
|
58
|
+
updateData: z.ZodMiniObject<{
|
|
59
|
+
isActive: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
60
|
+
key: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
61
61
|
}, z.core.$strip>;
|
|
62
62
|
}, z.core.$strip>;
|
|
63
|
-
readonly REMOVE: z.
|
|
64
|
-
filterId: z.
|
|
63
|
+
readonly REMOVE: z.ZodMiniObject<{
|
|
64
|
+
filterId: z.ZodMiniString<string>;
|
|
65
65
|
}, z.core.$strip>;
|
|
66
|
-
readonly GET: z.
|
|
67
|
-
filterId: z.
|
|
66
|
+
readonly GET: z.ZodMiniObject<{
|
|
67
|
+
filterId: z.ZodMiniString<string>;
|
|
68
68
|
}, z.core.$strip>;
|
|
69
|
-
readonly LIST: z.
|
|
70
|
-
queryString: z.
|
|
71
|
-
includeInactive: z.
|
|
72
|
-
sort: z.
|
|
73
|
-
key: z.
|
|
74
|
-
value: z.
|
|
69
|
+
readonly LIST: z.ZodMiniObject<{
|
|
70
|
+
queryString: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
71
|
+
includeInactive: z.ZodMiniDefault<z.ZodMiniBoolean<boolean>>;
|
|
72
|
+
sort: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
|
|
73
|
+
key: z.ZodMiniString<string>;
|
|
74
|
+
value: z.ZodMiniEnum<{
|
|
75
75
|
[x: string]: string;
|
|
76
76
|
}>;
|
|
77
77
|
}, z.core.$strip>>>;
|
|
78
|
-
limit: z.
|
|
79
|
-
offset: z.
|
|
78
|
+
limit: z.ZodMiniOptional<z.ZodMiniNumberFormat>;
|
|
79
|
+
offset: z.ZodMiniOptional<z.ZodMiniNumberFormat>;
|
|
80
80
|
}, z.core.$strip>;
|
|
81
|
-
readonly COUNT: z.
|
|
82
|
-
queryString: z.
|
|
83
|
-
includeInactive: z.
|
|
81
|
+
readonly COUNT: z.ZodMiniObject<{
|
|
82
|
+
queryString: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
83
|
+
includeInactive: z.ZodMiniDefault<z.ZodMiniBoolean<boolean>>;
|
|
84
84
|
}, z.core.$strip>;
|
|
85
|
-
readonly CREATE_OPTION: z.
|
|
86
|
-
filterId: z.
|
|
87
|
-
option: z.
|
|
88
|
-
optionTexts: z.
|
|
89
|
-
locale: z.
|
|
90
|
-
subtitle: z.
|
|
91
|
-
title: z.
|
|
85
|
+
readonly CREATE_OPTION: z.ZodMiniObject<{
|
|
86
|
+
filterId: z.ZodMiniString<string>;
|
|
87
|
+
option: z.ZodMiniString<string>;
|
|
88
|
+
optionTexts: z.ZodMiniArray<z.ZodMiniObject<{
|
|
89
|
+
locale: z.ZodMiniString<string>;
|
|
90
|
+
subtitle: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
91
|
+
title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
92
92
|
}, z.core.$strip>>;
|
|
93
93
|
}, z.core.$strip>;
|
|
94
|
-
readonly REMOVE_OPTION: z.
|
|
95
|
-
filterId: z.
|
|
96
|
-
option: z.
|
|
94
|
+
readonly REMOVE_OPTION: z.ZodMiniObject<{
|
|
95
|
+
filterId: z.ZodMiniString<string>;
|
|
96
|
+
option: z.ZodMiniString<string>;
|
|
97
97
|
}, z.core.$strip>;
|
|
98
|
-
readonly UPDATE_TEXTS: z.
|
|
99
|
-
filterId: z.
|
|
100
|
-
textUpdates: z.
|
|
101
|
-
locale: z.
|
|
102
|
-
title: z.
|
|
103
|
-
subtitle: z.
|
|
98
|
+
readonly UPDATE_TEXTS: z.ZodMiniObject<{
|
|
99
|
+
filterId: z.ZodMiniString<string>;
|
|
100
|
+
textUpdates: z.ZodMiniArray<z.ZodMiniObject<{
|
|
101
|
+
locale: z.ZodMiniString<string>;
|
|
102
|
+
title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
103
|
+
subtitle: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
104
104
|
}, z.core.$strip>>;
|
|
105
|
-
filterOptionValue: z.
|
|
105
|
+
filterOptionValue: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
106
106
|
}, z.core.$strip>;
|
|
107
|
-
readonly GET_TEXTS: z.
|
|
108
|
-
filterId: z.
|
|
109
|
-
filterOptionValue: z.
|
|
107
|
+
readonly GET_TEXTS: z.ZodMiniObject<{
|
|
108
|
+
filterId: z.ZodMiniString<string>;
|
|
109
|
+
filterOptionValue: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
110
110
|
}, z.core.$strip>;
|
|
111
111
|
};
|
|
112
112
|
export declare const FilterManagementSchema: {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
subtitle: z.ZodOptional<z.ZodString>;
|
|
117
|
-
title: z.ZodOptional<z.ZodString>;
|
|
118
|
-
}, z.core.$strip>>>;
|
|
119
|
-
filterOptionValue: z.ZodOptional<z.ZodString>;
|
|
120
|
-
textUpdates: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
121
|
-
locale: z.ZodString;
|
|
122
|
-
title: z.ZodOptional<z.ZodString>;
|
|
123
|
-
subtitle: z.ZodOptional<z.ZodString>;
|
|
124
|
-
}, z.core.$strip>>>;
|
|
125
|
-
queryString: z.ZodOptional<z.ZodString>;
|
|
126
|
-
includeInactive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
127
|
-
sort: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
128
|
-
key: z.ZodString;
|
|
129
|
-
value: z.ZodEnum<{
|
|
130
|
-
[x: string]: string;
|
|
131
|
-
}>;
|
|
132
|
-
}, z.core.$strip>>>;
|
|
133
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
134
|
-
offset: z.ZodOptional<z.ZodNumber>;
|
|
135
|
-
action: z.ZodEnum<{
|
|
136
|
-
GET: "GET";
|
|
137
|
-
CREATE: "CREATE";
|
|
138
|
-
UPDATE: "UPDATE";
|
|
139
|
-
REMOVE: "REMOVE";
|
|
140
|
-
LIST: "LIST";
|
|
141
|
-
COUNT: "COUNT";
|
|
142
|
-
CREATE_OPTION: "CREATE_OPTION";
|
|
143
|
-
REMOVE_OPTION: "REMOVE_OPTION";
|
|
144
|
-
UPDATE_TEXTS: "UPDATE_TEXTS";
|
|
145
|
-
GET_TEXTS: "GET_TEXTS";
|
|
146
|
-
}>;
|
|
147
|
-
filterId: z.ZodOptional<z.ZodString>;
|
|
148
|
-
filter: z.ZodOptional<z.ZodObject<{
|
|
149
|
-
key: z.ZodString;
|
|
150
|
-
type: z.ZodEnum<{
|
|
151
|
-
SWITCH: "SWITCH";
|
|
152
|
-
SINGLE_CHOICE: "SINGLE_CHOICE";
|
|
153
|
-
MULTI_CHOICE: "MULTI_CHOICE";
|
|
154
|
-
RANGE: "RANGE";
|
|
155
|
-
}>;
|
|
156
|
-
options: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
157
|
-
}, z.core.$strip>>;
|
|
158
|
-
texts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
159
|
-
locale: z.ZodString;
|
|
160
|
-
title: z.ZodString;
|
|
161
|
-
subtitle: z.ZodOptional<z.ZodString>;
|
|
162
|
-
}, z.core.$strip>>>;
|
|
163
|
-
updateData: z.ZodOptional<z.ZodObject<{
|
|
164
|
-
isActive: z.ZodOptional<z.ZodBoolean>;
|
|
165
|
-
key: z.ZodOptional<z.ZodString>;
|
|
166
|
-
}, z.core.$strip>>;
|
|
167
|
-
};
|
|
168
|
-
export declare const FilterManagementZodSchema: z.ZodObject<{
|
|
169
|
-
option: z.ZodOptional<z.ZodString>;
|
|
170
|
-
optionTexts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
171
|
-
locale: z.ZodString;
|
|
172
|
-
subtitle: z.ZodOptional<z.ZodString>;
|
|
173
|
-
title: z.ZodOptional<z.ZodString>;
|
|
174
|
-
}, z.core.$strip>>>;
|
|
175
|
-
filterOptionValue: z.ZodOptional<z.ZodString>;
|
|
176
|
-
textUpdates: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
177
|
-
locale: z.ZodString;
|
|
178
|
-
title: z.ZodOptional<z.ZodString>;
|
|
179
|
-
subtitle: z.ZodOptional<z.ZodString>;
|
|
180
|
-
}, z.core.$strip>>>;
|
|
181
|
-
queryString: z.ZodOptional<z.ZodString>;
|
|
182
|
-
includeInactive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
183
|
-
sort: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
184
|
-
key: z.ZodString;
|
|
185
|
-
value: z.ZodEnum<{
|
|
186
|
-
[x: string]: string;
|
|
187
|
-
}>;
|
|
188
|
-
}, z.core.$strip>>>;
|
|
189
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
190
|
-
offset: z.ZodOptional<z.ZodNumber>;
|
|
191
|
-
action: z.ZodEnum<{
|
|
192
|
-
GET: "GET";
|
|
193
|
-
CREATE: "CREATE";
|
|
194
|
-
UPDATE: "UPDATE";
|
|
195
|
-
REMOVE: "REMOVE";
|
|
196
|
-
LIST: "LIST";
|
|
197
|
-
COUNT: "COUNT";
|
|
198
|
-
CREATE_OPTION: "CREATE_OPTION";
|
|
199
|
-
REMOVE_OPTION: "REMOVE_OPTION";
|
|
200
|
-
UPDATE_TEXTS: "UPDATE_TEXTS";
|
|
201
|
-
GET_TEXTS: "GET_TEXTS";
|
|
202
|
-
}>;
|
|
203
|
-
filterId: z.ZodOptional<z.ZodString>;
|
|
204
|
-
filter: z.ZodOptional<z.ZodObject<{
|
|
205
|
-
key: z.ZodString;
|
|
206
|
-
type: z.ZodEnum<{
|
|
207
|
-
SWITCH: "SWITCH";
|
|
208
|
-
SINGLE_CHOICE: "SINGLE_CHOICE";
|
|
209
|
-
MULTI_CHOICE: "MULTI_CHOICE";
|
|
210
|
-
RANGE: "RANGE";
|
|
211
|
-
}>;
|
|
212
|
-
options: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
213
|
-
}, z.core.$strip>>;
|
|
214
|
-
texts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
215
|
-
locale: z.ZodString;
|
|
216
|
-
title: z.ZodString;
|
|
217
|
-
subtitle: z.ZodOptional<z.ZodString>;
|
|
218
|
-
}, z.core.$strip>>>;
|
|
219
|
-
updateData: z.ZodOptional<z.ZodObject<{
|
|
220
|
-
isActive: z.ZodOptional<z.ZodBoolean>;
|
|
221
|
-
key: z.ZodOptional<z.ZodString>;
|
|
222
|
-
}, z.core.$strip>>;
|
|
223
|
-
}, z.core.$strip>;
|
|
224
|
-
export type FilterManagementParams = z.infer<typeof FilterManagementZodSchema>;
|
|
113
|
+
action: z.core.$ZodType<string>;
|
|
114
|
+
} & Record<string, z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
115
|
+
export type { ManagementParams as FilterManagementParams } from '../../utils/sharedSchemas.ts';
|
|
225
116
|
export type ActionName = keyof typeof actionValidators;
|
|
226
117
|
export type Params<T extends ActionName> = z.infer<(typeof actionValidators)[T]>;
|
|
227
118
|
export type Handler<T extends ActionName> = (filterModule: any, params: Params<T>) => Promise<unknown>;
|
|
@@ -1,46 +1,55 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { PaginationSchema, SortingSchema, SearchSchema, LocalizationTextSchema, } from "../../utils/sharedSchemas.js";
|
|
3
|
-
export const FilterTextInputSchema = LocalizationTextSchema.describe('Filter localized text data');
|
|
4
|
-
export const FilterOptionTextInputSchema =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export const SortOptionInputSchema = z
|
|
8
|
-
.object({
|
|
9
|
-
key: z.string().min(1).describe('Field key to sort by (e.g., "key", "createdAt")'),
|
|
10
|
-
value: z.enum(['ASC', 'DESC']).describe('Sort direction: ASC for ascending, DESC for descending'),
|
|
1
|
+
import { z } from 'zod/v4-mini';
|
|
2
|
+
import { PaginationSchema, SortingSchema, SearchSchema, LocalizationTextSchema, createManagementSchemaFromValidators, } from "../../utils/sharedSchemas.js";
|
|
3
|
+
export const FilterTextInputSchema = LocalizationTextSchema.check(z.describe('Filter localized text data'));
|
|
4
|
+
export const FilterOptionTextInputSchema = z
|
|
5
|
+
.extend(LocalizationTextSchema, {
|
|
6
|
+
title: z.optional(z.string()).check(z.describe('Optional localized title for the filter option')),
|
|
11
7
|
})
|
|
12
|
-
.
|
|
8
|
+
.check(z.describe('Filter option localized text data'));
|
|
9
|
+
export const SortOptionInputSchema = z.strictObject({
|
|
10
|
+
key: z.string().check(z.minLength(1), z.describe('Field key to sort by (e.g., "key", "createdAt")')),
|
|
11
|
+
value: z
|
|
12
|
+
.enum(['ASC', 'DESC'])
|
|
13
|
+
.check(z.describe('Sort direction: ASC for ascending, DESC for descending')),
|
|
14
|
+
});
|
|
13
15
|
export const CreateFilterInputSchema = z.object({
|
|
14
|
-
key: z.string().
|
|
15
|
-
type: z
|
|
16
|
-
|
|
16
|
+
key: z.string().check(z.minLength(1), z.describe('Unique key for the filter')),
|
|
17
|
+
type: z
|
|
18
|
+
.enum(['SWITCH', 'SINGLE_CHOICE', 'MULTI_CHOICE', 'RANGE'])
|
|
19
|
+
.check(z.describe('Type of the filter')),
|
|
20
|
+
options: z
|
|
21
|
+
._default(z.array(z.string().check(z.minLength(1))), [])
|
|
22
|
+
.check(z.describe('Selectable options (if applicable)')),
|
|
17
23
|
});
|
|
18
24
|
export const UpdateFilterInputSchema = z.object({
|
|
19
|
-
isActive: z.boolean().
|
|
20
|
-
key: z
|
|
25
|
+
isActive: z.optional(z.boolean()).check(z.describe('Whether the filter should be active or not')),
|
|
26
|
+
key: z
|
|
27
|
+
.optional(z.string().check(z.minLength(1)))
|
|
28
|
+
.check(z.describe('New unique key for the filter (if updating)')),
|
|
21
29
|
});
|
|
22
30
|
export const FilterUpdateTextInputSchema = z.object({
|
|
23
|
-
locale: z.string().
|
|
24
|
-
title: z
|
|
31
|
+
locale: z.string().check(z.minLength(1), z.describe('Locale ISO code (e.g., "en-US", "de-CH")')),
|
|
32
|
+
title: z
|
|
33
|
+
.optional(z.string())
|
|
34
|
+
.check(z.describe('Title for the filter or filter option in the specified locale')),
|
|
25
35
|
subtitle: z
|
|
26
|
-
.string()
|
|
27
|
-
.
|
|
28
|
-
.describe('Subtitle for the filter or filter option in the specified locale'),
|
|
36
|
+
.optional(z.string())
|
|
37
|
+
.check(z.describe('Subtitle for the filter or filter option in the specified locale')),
|
|
29
38
|
});
|
|
30
39
|
export const actionValidators = {
|
|
31
40
|
CREATE: z.object({
|
|
32
|
-
filter: CreateFilterInputSchema.describe('Filter data'),
|
|
33
|
-
texts: z.array(FilterTextInputSchema).
|
|
41
|
+
filter: CreateFilterInputSchema.check(z.describe('Filter data')),
|
|
42
|
+
texts: z.optional(z.array(FilterTextInputSchema)).check(z.describe('Localized text entries')),
|
|
34
43
|
}),
|
|
35
44
|
UPDATE: z.object({
|
|
36
|
-
filterId: z.string().
|
|
37
|
-
updateData: UpdateFilterInputSchema.describe('Filter updates'),
|
|
45
|
+
filterId: z.string().check(z.minLength(1), z.describe('Unique filter identifier')),
|
|
46
|
+
updateData: UpdateFilterInputSchema.check(z.describe('Filter updates')),
|
|
38
47
|
}),
|
|
39
48
|
REMOVE: z.object({
|
|
40
|
-
filterId: z.string().
|
|
49
|
+
filterId: z.string().check(z.minLength(1), z.describe('Unique filter identifier')),
|
|
41
50
|
}),
|
|
42
51
|
GET: z.object({
|
|
43
|
-
filterId: z.string().
|
|
52
|
+
filterId: z.string().check(z.minLength(1), z.describe('Unique filter identifier')),
|
|
44
53
|
}),
|
|
45
54
|
LIST: z.object({
|
|
46
55
|
...PaginationSchema,
|
|
@@ -51,77 +60,32 @@ export const actionValidators = {
|
|
|
51
60
|
...SearchSchema,
|
|
52
61
|
}),
|
|
53
62
|
CREATE_OPTION: z.object({
|
|
54
|
-
filterId: z.string().
|
|
55
|
-
option: z
|
|
63
|
+
filterId: z.string().check(z.minLength(1), z.describe('Unique filter identifier')),
|
|
64
|
+
option: z
|
|
65
|
+
.string()
|
|
66
|
+
.check(z.minLength(1), z.describe('Option value string - must be unique within the filter')),
|
|
56
67
|
optionTexts: z
|
|
57
68
|
.array(FilterOptionTextInputSchema)
|
|
58
|
-
.describe('Localized titles/subtitles - can be added later via UPDATE_TEXTS'),
|
|
69
|
+
.check(z.describe('Localized titles/subtitles - can be added later via UPDATE_TEXTS')),
|
|
59
70
|
}),
|
|
60
71
|
REMOVE_OPTION: z.object({
|
|
61
|
-
filterId: z.string().
|
|
62
|
-
option: z.string().
|
|
72
|
+
filterId: z.string().check(z.minLength(1), z.describe('Unique filter identifier')),
|
|
73
|
+
option: z.string().check(z.minLength(1), z.describe('Option value to remove')),
|
|
63
74
|
}),
|
|
64
75
|
UPDATE_TEXTS: z.object({
|
|
65
|
-
filterId: z.string().
|
|
76
|
+
filterId: z.string().check(z.minLength(1), z.describe('Unique filter identifier')),
|
|
66
77
|
textUpdates: z
|
|
67
78
|
.array(FilterUpdateTextInputSchema)
|
|
68
|
-
.
|
|
69
|
-
.describe('Array of localized text updates - each entry contains locale, title, and optional subtitle'),
|
|
79
|
+
.check(z.minLength(1), z.describe('Array of localized text updates - each entry contains locale, title, and optional subtitle')),
|
|
70
80
|
filterOptionValue: z
|
|
71
|
-
.string()
|
|
72
|
-
.
|
|
73
|
-
.describe('Specific filter option value for text operations - omit to work with main filter texts'),
|
|
81
|
+
.optional(z.string())
|
|
82
|
+
.check(z.describe('Specific filter option value for text operations - omit to work with main filter texts')),
|
|
74
83
|
}),
|
|
75
84
|
GET_TEXTS: z.object({
|
|
76
|
-
filterId: z.string().
|
|
85
|
+
filterId: z.string().check(z.minLength(1), z.describe('Unique filter identifier')),
|
|
77
86
|
filterOptionValue: z
|
|
78
|
-
.string()
|
|
79
|
-
.
|
|
80
|
-
.describe('Specific filter option value - omit to get main filter texts'),
|
|
87
|
+
.optional(z.string())
|
|
88
|
+
.check(z.describe('Specific filter option value - omit to get main filter texts')),
|
|
81
89
|
}),
|
|
82
90
|
};
|
|
83
|
-
export const FilterManagementSchema =
|
|
84
|
-
action: z
|
|
85
|
-
.enum([
|
|
86
|
-
'CREATE',
|
|
87
|
-
'UPDATE',
|
|
88
|
-
'REMOVE',
|
|
89
|
-
'GET',
|
|
90
|
-
'LIST',
|
|
91
|
-
'COUNT',
|
|
92
|
-
'CREATE_OPTION',
|
|
93
|
-
'REMOVE_OPTION',
|
|
94
|
-
'UPDATE_TEXTS',
|
|
95
|
-
'GET_TEXTS',
|
|
96
|
-
])
|
|
97
|
-
.describe('Action to perform: CREATE (new filter), UPDATE (modify filter), REMOVE (delete filter), GET (retrieve filter), LIST (search filters), COUNT (count filters), CREATE_OPTION (add filter option), REMOVE_OPTION (delete filter option), UPDATE_TEXTS (modify localized texts), GET_TEXTS (retrieve localized texts)'),
|
|
98
|
-
filterId: z
|
|
99
|
-
.string()
|
|
100
|
-
.min(1)
|
|
101
|
-
.optional()
|
|
102
|
-
.describe('Unique filter identifier. Required for: UPDATE, REMOVE, GET, CREATE_OPTION, REMOVE_OPTION, UPDATE_TEXTS, GET_TEXTS. Not needed for: CREATE, LIST, COUNT'),
|
|
103
|
-
filter: CreateFilterInputSchema.optional().describe('Filter data for CREATE action'),
|
|
104
|
-
texts: z.array(FilterTextInputSchema).optional().describe('Localized text entries for CREATE action'),
|
|
105
|
-
updateData: UpdateFilterInputSchema.optional().describe('Filter updates for UPDATE action'),
|
|
106
|
-
...PaginationSchema,
|
|
107
|
-
...SortingSchema,
|
|
108
|
-
...SearchSchema,
|
|
109
|
-
option: z
|
|
110
|
-
.string()
|
|
111
|
-
.min(1)
|
|
112
|
-
.optional()
|
|
113
|
-
.describe('Option value string for CREATE_OPTION/REMOVE_OPTION actions. Must be unique within the filter'),
|
|
114
|
-
optionTexts: z
|
|
115
|
-
.array(FilterOptionTextInputSchema)
|
|
116
|
-
.optional()
|
|
117
|
-
.describe('Localized titles/subtitles for CREATE_OPTION action. Optional - can be added later via UPDATE_TEXTS'),
|
|
118
|
-
filterOptionValue: z
|
|
119
|
-
.string()
|
|
120
|
-
.optional()
|
|
121
|
-
.describe('Specific filter option value for text operations (UPDATE_TEXTS/GET_TEXTS). Omit to work with main filter texts'),
|
|
122
|
-
textUpdates: z
|
|
123
|
-
.array(FilterUpdateTextInputSchema)
|
|
124
|
-
.optional()
|
|
125
|
-
.describe('Array of localized text updates for UPDATE_TEXTS action. Each entry contains locale, title, and optional subtitle'),
|
|
126
|
-
};
|
|
127
|
-
export const FilterManagementZodSchema = z.object(FilterManagementSchema);
|
|
91
|
+
export const FilterManagementSchema = createManagementSchemaFromValidators(actionValidators);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Context } from '../../../context.ts';
|
|
2
|
-
import { LocalizationManagementSchema,
|
|
3
|
-
export { LocalizationManagementSchema
|
|
2
|
+
import { LocalizationManagementSchema, type LocalizationManagementParams } from './schemas.ts';
|
|
3
|
+
export { LocalizationManagementSchema };
|
|
4
4
|
export type { LocalizationManagementParams };
|
|
5
5
|
export declare function localizationManagement(context: Context, params: LocalizationManagementParams): Promise<{
|
|
6
6
|
content: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { log } from '@unchainedshop/logger';
|
|
2
|
-
import { actionValidators, LocalizationManagementSchema,
|
|
2
|
+
import { actionValidators, LocalizationManagementSchema, } from "./schemas.js";
|
|
3
3
|
import actionHandlers from "./handlers/index.js";
|
|
4
4
|
import { createMcpErrorResponse, createMcpResponse } from "../../utils/sharedSchemas.js";
|
|
5
|
-
export { LocalizationManagementSchema
|
|
5
|
+
export { LocalizationManagementSchema };
|
|
6
6
|
export async function localizationManagement(context, params) {
|
|
7
7
|
const { action, ...actionParams } = params;
|
|
8
8
|
log('MCP localizationManagement', { userId: context.userId, params });
|