@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.
Files changed (111) hide show
  1. package/lib/acl.d.ts +2 -2
  2. package/lib/acl.js +36 -8
  3. package/lib/api-index.d.ts +3 -1
  4. package/lib/chat/generateImageHandler.js +6 -5
  5. package/lib/context.d.ts +3 -1
  6. package/lib/context.js +9 -4
  7. package/lib/events.d.ts +2 -0
  8. package/lib/events.js +2 -0
  9. package/lib/express/createMCPMiddleware.js +1 -1
  10. package/lib/express/index.d.ts +6 -9
  11. package/lib/express/index.js +53 -126
  12. package/lib/fastify/index.d.ts +6 -9
  13. package/lib/fastify/index.js +52 -118
  14. package/lib/fastify/mcpHandler.js +1 -1
  15. package/lib/loaders/buildTextMap.js +6 -3
  16. package/lib/loaders/index.d.ts +0 -25
  17. package/lib/loaders/index.js +0 -10
  18. package/lib/locale-context.d.ts +4 -2
  19. package/lib/locale-context.js +2 -6
  20. package/lib/mcp/tools/assortment/assortmentManagement.d.ts +2 -2
  21. package/lib/mcp/tools/assortment/assortmentManagement.js +2 -2
  22. package/lib/mcp/tools/assortment/schemas.d.ts +322 -141
  23. package/lib/mcp/tools/assortment/schemas.js +179 -96
  24. package/lib/mcp/tools/filter/filterManagement.d.ts +2 -2
  25. package/lib/mcp/tools/filter/filterManagement.js +2 -2
  26. package/lib/mcp/tools/filter/schemas.d.ts +184 -75
  27. package/lib/mcp/tools/filter/schemas.js +87 -51
  28. package/lib/mcp/tools/localization/getLocalizationsConfig.d.ts +1 -1
  29. package/lib/mcp/tools/localization/localizationManagement.d.ts +2 -2
  30. package/lib/mcp/tools/localization/localizationManagement.js +2 -2
  31. package/lib/mcp/tools/localization/schemas.d.ts +144 -47
  32. package/lib/mcp/tools/localization/schemas.js +51 -36
  33. package/lib/mcp/tools/order/handlers/getTopCustomers.d.ts +2 -0
  34. package/lib/mcp/tools/order/orderManagement.d.ts +2 -2
  35. package/lib/mcp/tools/order/orderManagement.js +2 -2
  36. package/lib/mcp/tools/order/schemas.d.ts +184 -75
  37. package/lib/mcp/tools/order/schemas.js +113 -51
  38. package/lib/mcp/tools/product/productManagement.d.ts +2 -2
  39. package/lib/mcp/tools/product/productManagement.js +2 -2
  40. package/lib/mcp/tools/product/schemas.d.ts +642 -317
  41. package/lib/mcp/tools/product/schemas.js +287 -191
  42. package/lib/mcp/tools/provider/providerManagement.d.ts +2 -2
  43. package/lib/mcp/tools/provider/providerManagement.js +2 -2
  44. package/lib/mcp/tools/provider/schemas.d.ts +142 -47
  45. package/lib/mcp/tools/provider/schemas.js +67 -32
  46. package/lib/mcp/tools/quotation/handlers/getQuotation.d.ts +2 -0
  47. package/lib/mcp/tools/quotation/handlers/listQuotations.d.ts +2 -0
  48. package/lib/mcp/tools/quotation/handlers/makeQuotationProposal.d.ts +2 -0
  49. package/lib/mcp/tools/quotation/handlers/rejectQuotation.d.ts +2 -0
  50. package/lib/mcp/tools/quotation/handlers/verifyQuotation.d.ts +2 -0
  51. package/lib/mcp/tools/quotation/quotationManagement.d.ts +2 -2
  52. package/lib/mcp/tools/quotation/quotationManagement.js +2 -2
  53. package/lib/mcp/tools/quotation/schemas.d.ts +111 -40
  54. package/lib/mcp/tools/quotation/schemas.js +54 -29
  55. package/lib/mcp/tools/system/handlers/countEvents.d.ts +8 -1
  56. package/lib/mcp/tools/system/handlers/countWork.d.ts +10 -1
  57. package/lib/mcp/tools/system/handlers/countWork.js +1 -0
  58. package/lib/mcp/tools/system/handlers/index.d.ts +4 -4
  59. package/lib/mcp/tools/system/handlers/listEvents.d.ts +12 -1
  60. package/lib/mcp/tools/system/handlers/listWork.d.ts +14 -1
  61. package/lib/mcp/tools/system/handlers/listWork.js +1 -0
  62. package/lib/mcp/tools/system/schemas.d.ts +179 -84
  63. package/lib/mcp/tools/system/schemas.js +188 -67
  64. package/lib/mcp/tools/system/systemManagement.d.ts +1 -1
  65. package/lib/mcp/tools/system/systemManagement.js +1 -1
  66. package/lib/mcp/tools/users/handlers/addUserEmail.d.ts +2 -0
  67. package/lib/mcp/tools/users/handlers/createUser.d.ts +2 -0
  68. package/lib/mcp/tools/users/handlers/enrollUser.d.ts +2 -0
  69. package/lib/mcp/tools/users/handlers/getCurrentUser.d.ts +2 -0
  70. package/lib/mcp/tools/users/handlers/getUser.d.ts +2 -0
  71. package/lib/mcp/tools/users/handlers/listUsers.d.ts +2 -0
  72. package/lib/mcp/tools/users/handlers/setUserTags.d.ts +2 -0
  73. package/lib/mcp/tools/users/handlers/setUserUsername.d.ts +2 -0
  74. package/lib/mcp/tools/users/handlers/updateUser.d.ts +2 -0
  75. package/lib/mcp/tools/users/schemas.d.ts +296 -163
  76. package/lib/mcp/tools/users/schemas.js +152 -71
  77. package/lib/mcp/tools/users/usersManagement.d.ts +2 -2
  78. package/lib/mcp/tools/users/usersManagement.js +2 -2
  79. package/lib/mcp/utils/getNormalizedQuotationDetails.d.ts +2 -0
  80. package/lib/mcp/utils/getNormalizedUserDetails.d.ts +2 -0
  81. package/lib/mcp/utils/normalizeMediaUrl.js +1 -1
  82. package/lib/mcp/utils/sanitizeLocalizationEntityData.d.ts +1 -1
  83. package/lib/mcp/utils/sharedSchemas.d.ts +28 -39
  84. package/lib/mcp/utils/sharedSchemas.js +28 -47
  85. package/lib/mcp/utils/validateIsoCode.d.ts +1 -1
  86. package/lib/middleware/createAuthMiddleware.js +1 -3
  87. package/lib/resolvers/mutations/accounts/changePassword.js +1 -2
  88. package/lib/resolvers/mutations/index.d.ts +150 -155
  89. package/lib/resolvers/mutations/index.js +2 -12
  90. package/lib/resolvers/mutations/orders/updateCart.js +7 -1
  91. package/lib/resolvers/mutations/users/setRoles.d.ts +1 -1
  92. package/lib/resolvers/mutations/users/setRoles.js +6 -4
  93. package/lib/resolvers/queries/events/registeredEventTypes.d.ts +1 -1
  94. package/lib/resolvers/queries/events/registeredEventTypes.js +1 -1
  95. package/lib/resolvers/queries/index.d.ts +71 -71
  96. package/lib/resolvers/queries/index.js +1 -1
  97. package/lib/resolvers/type/index.d.ts +5 -6
  98. package/lib/resolvers/type/order/order-delivery-pickup-types.d.ts +0 -1
  99. package/lib/resolvers/type/order/order-delivery-pickup-types.js +0 -7
  100. package/lib/resolvers/type/order/order-types.d.ts +5 -5
  101. package/lib/resolvers/type/order/order-types.js +27 -12
  102. package/lib/resolvers/type/shop-types.js +1 -1
  103. package/lib/resolvers/type/user-types.js +3 -3
  104. package/lib/roles/index.d.ts +4 -11
  105. package/lib/roles/index.js +16 -11
  106. package/lib/roles/loggedIn.js +2 -1
  107. package/lib/schema/mutation.js +6 -44
  108. package/lib/schema/query.js +5 -5
  109. package/lib/schema/types/index.js +2 -2
  110. package/lib/schema/types/order/delivery.js +0 -2
  111. package/package.json +14 -24
@@ -1,118 +1,227 @@
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>>;
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.ZodMiniObject<{
8
- locale: z.ZodMiniString<string>;
9
- subtitle: z.ZodMiniOptional<z.ZodMiniString<string>>;
10
- title: z.ZodMiniOptional<z.ZodMiniString<string>>;
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.ZodMiniObject<{
13
- key: z.ZodMiniString<string>;
14
- value: z.ZodMiniEnum<{
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.ZodMiniObject<{
20
- key: z.ZodMiniString<string>;
21
- type: z.ZodMiniEnum<{
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.ZodMiniDefault<z.ZodMiniArray<z.ZodMiniString<string>>>;
27
+ options: z.ZodDefault<z.ZodArray<z.ZodString>>;
28
28
  }, z.core.$strip>;
29
- export declare const UpdateFilterInputSchema: z.ZodMiniObject<{
30
- isActive: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
31
- key: z.ZodMiniOptional<z.ZodMiniString<string>>;
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.ZodMiniObject<{
34
- locale: z.ZodMiniString<string>;
35
- title: z.ZodMiniOptional<z.ZodMiniString<string>>;
36
- subtitle: z.ZodMiniOptional<z.ZodMiniString<string>>;
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.ZodMiniObject<{
40
- filter: z.ZodMiniObject<{
41
- key: z.ZodMiniString<string>;
42
- type: z.ZodMiniEnum<{
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.ZodMiniDefault<z.ZodMiniArray<z.ZodMiniString<string>>>;
48
+ options: z.ZodDefault<z.ZodArray<z.ZodString>>;
49
49
  }, z.core.$strip>;
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>>;
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.ZodMiniObject<{
57
- filterId: z.ZodMiniString<string>;
58
- updateData: z.ZodMiniObject<{
59
- isActive: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
60
- key: z.ZodMiniOptional<z.ZodMiniString<string>>;
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.ZodMiniObject<{
64
- filterId: z.ZodMiniString<string>;
63
+ readonly REMOVE: z.ZodObject<{
64
+ filterId: z.ZodString;
65
65
  }, z.core.$strip>;
66
- readonly GET: z.ZodMiniObject<{
67
- filterId: z.ZodMiniString<string>;
66
+ readonly GET: z.ZodObject<{
67
+ filterId: z.ZodString;
68
68
  }, z.core.$strip>;
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<{
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.ZodMiniOptional<z.ZodMiniNumberFormat>;
79
- offset: z.ZodMiniOptional<z.ZodMiniNumberFormat>;
78
+ limit: z.ZodOptional<z.ZodNumber>;
79
+ offset: z.ZodOptional<z.ZodNumber>;
80
80
  }, z.core.$strip>;
81
- readonly COUNT: z.ZodMiniObject<{
82
- queryString: z.ZodMiniOptional<z.ZodMiniString<string>>;
83
- includeInactive: z.ZodMiniDefault<z.ZodMiniBoolean<boolean>>;
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.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>>;
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.ZodMiniObject<{
95
- filterId: z.ZodMiniString<string>;
96
- option: z.ZodMiniString<string>;
94
+ readonly REMOVE_OPTION: z.ZodObject<{
95
+ filterId: z.ZodString;
96
+ option: z.ZodString;
97
97
  }, z.core.$strip>;
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>>;
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.ZodMiniOptional<z.ZodMiniString<string>>;
105
+ filterOptionValue: z.ZodOptional<z.ZodString>;
106
106
  }, z.core.$strip>;
107
- readonly GET_TEXTS: z.ZodMiniObject<{
108
- filterId: z.ZodMiniString<string>;
109
- filterOptionValue: z.ZodMiniOptional<z.ZodMiniString<string>>;
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
- 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';
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/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')),
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
- .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
- });
12
+ .strict();
15
13
  export const CreateFilterInputSchema = z.object({
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)')),
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.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)')),
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().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')),
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
- .optional(z.string())
37
- .check(z.describe('Subtitle for the filter or filter option in the specified locale')),
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.check(z.describe('Filter data')),
42
- texts: z.optional(z.array(FilterTextInputSchema)).check(z.describe('Localized text entries')),
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().check(z.minLength(1), z.describe('Unique filter identifier')),
46
- updateData: UpdateFilterInputSchema.check(z.describe('Filter updates')),
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().check(z.minLength(1), z.describe('Unique filter identifier')),
40
+ filterId: z.string().min(1).describe('Unique filter identifier'),
50
41
  }),
51
42
  GET: z.object({
52
- filterId: z.string().check(z.minLength(1), z.describe('Unique filter identifier')),
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().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')),
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
- .check(z.describe('Localized titles/subtitles - can be added later via UPDATE_TEXTS')),
58
+ .describe('Localized titles/subtitles - can be added later via UPDATE_TEXTS'),
70
59
  }),
71
60
  REMOVE_OPTION: z.object({
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')),
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().check(z.minLength(1), z.describe('Unique filter identifier')),
65
+ filterId: z.string().min(1).describe('Unique filter identifier'),
77
66
  textUpdates: z
78
67
  .array(FilterUpdateTextInputSchema)
79
- .check(z.minLength(1), z.describe('Array of localized text updates - each entry contains locale, title, and optional subtitle')),
68
+ .min(1)
69
+ .describe('Array of localized text updates - each entry contains locale, title, and optional subtitle'),
80
70
  filterOptionValue: z
81
- .optional(z.string())
82
- .check(z.describe('Specific filter option value for text operations - omit to work with main filter texts')),
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().check(z.minLength(1), z.describe('Unique filter identifier')),
76
+ filterId: z.string().min(1).describe('Unique filter identifier'),
86
77
  filterOptionValue: z
87
- .optional(z.string())
88
- .check(z.describe('Specific filter option value - omit to get main filter texts')),
78
+ .string()
79
+ .optional()
80
+ .describe('Specific filter option value - omit to get main filter texts'),
89
81
  }),
90
82
  };
91
- export const FilterManagementSchema = createManagementSchemaFromValidators(actionValidators);
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 './types.ts';
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 });