@unchainedshop/api 4.8.12 → 5.0.0-alpha.2
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.d.ts +2 -2
- package/lib/acl.js +36 -8
- package/lib/api-index.d.ts +3 -1
- package/lib/chat/generateImageHandler.js +6 -5
- package/lib/context.d.ts +3 -1
- package/lib/context.js +9 -4
- 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 +53 -126
- package/lib/fastify/index.d.ts +6 -9
- package/lib/fastify/index.js +52 -118
- package/lib/fastify/mcpHandler.js +1 -1
- package/lib/loaders/buildTextMap.js +6 -3
- package/lib/loaders/index.d.ts +0 -25
- package/lib/loaders/index.js +0 -10
- 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/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/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/middleware/createAuthMiddleware.js +1 -3
- package/lib/resolvers/mutations/accounts/changePassword.js +1 -2
- package/lib/resolvers/mutations/index.d.ts +150 -155
- 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 +6 -4
- 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 +71 -71
- package/lib/resolvers/queries/index.js +1 -1
- package/lib/resolvers/type/index.d.ts +5 -6
- 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/order/order-types.d.ts +5 -5
- package/lib/resolvers/type/order/order-types.js +27 -12
- package/lib/resolvers/type/shop-types.js +1 -1
- package/lib/resolvers/type/user-types.js +3 -3
- package/lib/roles/index.d.ts +4 -11
- package/lib/roles/index.js +16 -11
- package/lib/roles/loggedIn.js +2 -1
- 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 +14 -24
|
@@ -1,118 +1,227 @@
|
|
|
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';
|
|
2
|
+
export declare const FilterTextInputSchema: z.ZodObject<{
|
|
3
|
+
locale: z.ZodString;
|
|
4
|
+
title: z.ZodString;
|
|
5
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
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.ZodObject<{
|
|
8
|
+
locale: z.ZodString;
|
|
9
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
10
|
+
title: z.ZodOptional<z.ZodString>;
|
|
11
11
|
}, z.core.$strip>;
|
|
12
|
-
export declare const SortOptionInputSchema: z.
|
|
13
|
-
key: z.
|
|
14
|
-
value: z.
|
|
12
|
+
export declare const SortOptionInputSchema: z.ZodObject<{
|
|
13
|
+
key: z.ZodString;
|
|
14
|
+
value: z.ZodEnum<{
|
|
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.ZodObject<{
|
|
20
|
+
key: z.ZodString;
|
|
21
|
+
type: z.ZodEnum<{
|
|
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.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
28
28
|
}, z.core.$strip>;
|
|
29
|
-
export declare const UpdateFilterInputSchema: z.
|
|
30
|
-
isActive: z.
|
|
31
|
-
key: z.
|
|
29
|
+
export declare const UpdateFilterInputSchema: z.ZodObject<{
|
|
30
|
+
isActive: z.ZodOptional<z.ZodBoolean>;
|
|
31
|
+
key: z.ZodOptional<z.ZodString>;
|
|
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.ZodObject<{
|
|
34
|
+
locale: z.ZodString;
|
|
35
|
+
title: z.ZodOptional<z.ZodString>;
|
|
36
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
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.ZodObject<{
|
|
40
|
+
filter: z.ZodObject<{
|
|
41
|
+
key: z.ZodString;
|
|
42
|
+
type: z.ZodEnum<{
|
|
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.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
49
49
|
}, z.core.$strip>;
|
|
50
|
-
texts: z.
|
|
51
|
-
locale: z.
|
|
52
|
-
title: z.
|
|
53
|
-
subtitle: z.
|
|
50
|
+
texts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
51
|
+
locale: z.ZodString;
|
|
52
|
+
title: z.ZodString;
|
|
53
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
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.ZodObject<{
|
|
57
|
+
filterId: z.ZodString;
|
|
58
|
+
updateData: z.ZodObject<{
|
|
59
|
+
isActive: z.ZodOptional<z.ZodBoolean>;
|
|
60
|
+
key: z.ZodOptional<z.ZodString>;
|
|
61
61
|
}, z.core.$strip>;
|
|
62
62
|
}, z.core.$strip>;
|
|
63
|
-
readonly REMOVE: z.
|
|
64
|
-
filterId: z.
|
|
63
|
+
readonly REMOVE: z.ZodObject<{
|
|
64
|
+
filterId: z.ZodString;
|
|
65
65
|
}, z.core.$strip>;
|
|
66
|
-
readonly GET: z.
|
|
67
|
-
filterId: z.
|
|
66
|
+
readonly GET: z.ZodObject<{
|
|
67
|
+
filterId: z.ZodString;
|
|
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.ZodObject<{
|
|
70
|
+
queryString: z.ZodOptional<z.ZodString>;
|
|
71
|
+
includeInactive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
72
|
+
sort: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
73
|
+
key: z.ZodString;
|
|
74
|
+
value: z.ZodEnum<{
|
|
75
75
|
[x: string]: string;
|
|
76
76
|
}>;
|
|
77
77
|
}, z.core.$strip>>>;
|
|
78
|
-
limit: z.
|
|
79
|
-
offset: z.
|
|
78
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
79
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
80
80
|
}, z.core.$strip>;
|
|
81
|
-
readonly COUNT: z.
|
|
82
|
-
queryString: z.
|
|
83
|
-
includeInactive: z.
|
|
81
|
+
readonly COUNT: z.ZodObject<{
|
|
82
|
+
queryString: z.ZodOptional<z.ZodString>;
|
|
83
|
+
includeInactive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
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.ZodObject<{
|
|
86
|
+
filterId: z.ZodString;
|
|
87
|
+
option: z.ZodString;
|
|
88
|
+
optionTexts: z.ZodArray<z.ZodObject<{
|
|
89
|
+
locale: z.ZodString;
|
|
90
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
91
|
+
title: z.ZodOptional<z.ZodString>;
|
|
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.ZodObject<{
|
|
95
|
+
filterId: z.ZodString;
|
|
96
|
+
option: z.ZodString;
|
|
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.ZodObject<{
|
|
99
|
+
filterId: z.ZodString;
|
|
100
|
+
textUpdates: z.ZodArray<z.ZodObject<{
|
|
101
|
+
locale: z.ZodString;
|
|
102
|
+
title: z.ZodOptional<z.ZodString>;
|
|
103
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
104
104
|
}, z.core.$strip>>;
|
|
105
|
-
filterOptionValue: z.
|
|
105
|
+
filterOptionValue: z.ZodOptional<z.ZodString>;
|
|
106
106
|
}, z.core.$strip>;
|
|
107
|
-
readonly GET_TEXTS: z.
|
|
108
|
-
filterId: z.
|
|
109
|
-
filterOptionValue: z.
|
|
107
|
+
readonly GET_TEXTS: z.ZodObject<{
|
|
108
|
+
filterId: z.ZodString;
|
|
109
|
+
filterOptionValue: z.ZodOptional<z.ZodString>;
|
|
110
110
|
}, z.core.$strip>;
|
|
111
111
|
};
|
|
112
112
|
export declare const FilterManagementSchema: {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
option: z.ZodOptional<z.ZodString>;
|
|
114
|
+
optionTexts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
115
|
+
locale: z.ZodString;
|
|
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>;
|
|
116
225
|
export type ActionName = keyof typeof actionValidators;
|
|
117
226
|
export type Params<T extends ActionName> = z.infer<(typeof actionValidators)[T]>;
|
|
118
227
|
export type Handler<T extends ActionName> = (filterModule: any, params: Params<T>) => Promise<unknown>;
|
|
@@ -1,55 +1,46 @@
|
|
|
1
|
-
import { z } from 'zod
|
|
2
|
-
import { PaginationSchema, SortingSchema, SearchSchema, LocalizationTextSchema,
|
|
3
|
-
export const FilterTextInputSchema = LocalizationTextSchema.
|
|
4
|
-
export const FilterOptionTextInputSchema =
|
|
5
|
-
.
|
|
6
|
-
|
|
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 = LocalizationTextSchema.extend({
|
|
5
|
+
title: z.string().optional().describe('Optional localized title for the filter option'),
|
|
6
|
+
}).describe('Filter option localized text data');
|
|
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'),
|
|
7
11
|
})
|
|
8
|
-
.
|
|
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
|
-
});
|
|
12
|
+
.strict();
|
|
15
13
|
export const CreateFilterInputSchema = z.object({
|
|
16
|
-
key: z.string().
|
|
17
|
-
type: z
|
|
18
|
-
|
|
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)')),
|
|
14
|
+
key: z.string().min(1).describe('Unique key for the filter'),
|
|
15
|
+
type: z.enum(['SWITCH', 'SINGLE_CHOICE', 'MULTI_CHOICE', 'RANGE']).describe('Type of the filter'),
|
|
16
|
+
options: z.array(z.string().min(1)).default([]).describe('Selectable options (if applicable)'),
|
|
23
17
|
});
|
|
24
18
|
export const UpdateFilterInputSchema = z.object({
|
|
25
|
-
isActive: z.
|
|
26
|
-
key: z
|
|
27
|
-
.optional(z.string().check(z.minLength(1)))
|
|
28
|
-
.check(z.describe('New unique key for the filter (if updating)')),
|
|
19
|
+
isActive: z.boolean().optional().describe('Whether the filter should be active or not'),
|
|
20
|
+
key: z.string().min(1).optional().describe('New unique key for the filter (if updating)'),
|
|
29
21
|
});
|
|
30
22
|
export const FilterUpdateTextInputSchema = z.object({
|
|
31
|
-
locale: z.string().
|
|
32
|
-
title: z
|
|
33
|
-
.optional(z.string())
|
|
34
|
-
.check(z.describe('Title for the filter or filter option in the specified locale')),
|
|
23
|
+
locale: z.string().min(1).describe('Locale ISO code (e.g., "en-US", "de-CH")'),
|
|
24
|
+
title: z.string().optional().describe('Title for the filter or filter option in the specified locale'),
|
|
35
25
|
subtitle: z
|
|
36
|
-
.
|
|
37
|
-
.
|
|
26
|
+
.string()
|
|
27
|
+
.optional()
|
|
28
|
+
.describe('Subtitle for the filter or filter option in the specified locale'),
|
|
38
29
|
});
|
|
39
30
|
export const actionValidators = {
|
|
40
31
|
CREATE: z.object({
|
|
41
|
-
filter: CreateFilterInputSchema.
|
|
42
|
-
texts: z.
|
|
32
|
+
filter: CreateFilterInputSchema.describe('Filter data'),
|
|
33
|
+
texts: z.array(FilterTextInputSchema).optional().describe('Localized text entries'),
|
|
43
34
|
}),
|
|
44
35
|
UPDATE: z.object({
|
|
45
|
-
filterId: z.string().
|
|
46
|
-
updateData: UpdateFilterInputSchema.
|
|
36
|
+
filterId: z.string().min(1).describe('Unique filter identifier'),
|
|
37
|
+
updateData: UpdateFilterInputSchema.describe('Filter updates'),
|
|
47
38
|
}),
|
|
48
39
|
REMOVE: z.object({
|
|
49
|
-
filterId: z.string().
|
|
40
|
+
filterId: z.string().min(1).describe('Unique filter identifier'),
|
|
50
41
|
}),
|
|
51
42
|
GET: z.object({
|
|
52
|
-
filterId: z.string().
|
|
43
|
+
filterId: z.string().min(1).describe('Unique filter identifier'),
|
|
53
44
|
}),
|
|
54
45
|
LIST: z.object({
|
|
55
46
|
...PaginationSchema,
|
|
@@ -60,32 +51,77 @@ export const actionValidators = {
|
|
|
60
51
|
...SearchSchema,
|
|
61
52
|
}),
|
|
62
53
|
CREATE_OPTION: z.object({
|
|
63
|
-
filterId: z.string().
|
|
64
|
-
option: z
|
|
65
|
-
.string()
|
|
66
|
-
.check(z.minLength(1), z.describe('Option value string - must be unique within the filter')),
|
|
54
|
+
filterId: z.string().min(1).describe('Unique filter identifier'),
|
|
55
|
+
option: z.string().min(1).describe('Option value string - must be unique within the filter'),
|
|
67
56
|
optionTexts: z
|
|
68
57
|
.array(FilterOptionTextInputSchema)
|
|
69
|
-
.
|
|
58
|
+
.describe('Localized titles/subtitles - can be added later via UPDATE_TEXTS'),
|
|
70
59
|
}),
|
|
71
60
|
REMOVE_OPTION: z.object({
|
|
72
|
-
filterId: z.string().
|
|
73
|
-
option: z.string().
|
|
61
|
+
filterId: z.string().min(1).describe('Unique filter identifier'),
|
|
62
|
+
option: z.string().min(1).describe('Option value to remove'),
|
|
74
63
|
}),
|
|
75
64
|
UPDATE_TEXTS: z.object({
|
|
76
|
-
filterId: z.string().
|
|
65
|
+
filterId: z.string().min(1).describe('Unique filter identifier'),
|
|
77
66
|
textUpdates: z
|
|
78
67
|
.array(FilterUpdateTextInputSchema)
|
|
79
|
-
.
|
|
68
|
+
.min(1)
|
|
69
|
+
.describe('Array of localized text updates - each entry contains locale, title, and optional subtitle'),
|
|
80
70
|
filterOptionValue: z
|
|
81
|
-
.
|
|
82
|
-
.
|
|
71
|
+
.string()
|
|
72
|
+
.optional()
|
|
73
|
+
.describe('Specific filter option value for text operations - omit to work with main filter texts'),
|
|
83
74
|
}),
|
|
84
75
|
GET_TEXTS: z.object({
|
|
85
|
-
filterId: z.string().
|
|
76
|
+
filterId: z.string().min(1).describe('Unique filter identifier'),
|
|
86
77
|
filterOptionValue: z
|
|
87
|
-
.
|
|
88
|
-
.
|
|
78
|
+
.string()
|
|
79
|
+
.optional()
|
|
80
|
+
.describe('Specific filter option value - omit to get main filter texts'),
|
|
89
81
|
}),
|
|
90
82
|
};
|
|
91
|
-
export const FilterManagementSchema =
|
|
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);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Context } from 'vm';
|
|
2
|
-
import type { LocalizationType, LocalizationModuleConfig } from './
|
|
2
|
+
import type { LocalizationType, LocalizationModuleConfig } from './schemas.ts';
|
|
3
3
|
export declare const getLocalizationsConfig: (context: Context, localizationType: LocalizationType) => LocalizationModuleConfig;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Context } from '../../../context.ts';
|
|
2
|
-
import { LocalizationManagementSchema, type LocalizationManagementParams } from './schemas.ts';
|
|
3
|
-
export { LocalizationManagementSchema };
|
|
2
|
+
import { LocalizationManagementSchema, LocalizationManagementZodSchema, type LocalizationManagementParams } from './schemas.ts';
|
|
3
|
+
export { LocalizationManagementSchema, LocalizationManagementZodSchema };
|
|
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, } from "./schemas.js";
|
|
2
|
+
import { actionValidators, LocalizationManagementSchema, LocalizationManagementZodSchema, } 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, LocalizationManagementZodSchema };
|
|
6
6
|
export async function localizationManagement(context, params) {
|
|
7
7
|
const { action, ...actionParams } = params;
|
|
8
8
|
log('MCP localizationManagement', { userId: context.userId, params });
|