@unchainedshop/api 4.8.0 → 4.8.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 (54) hide show
  1. package/lib/chat/generateImageHandler.js +5 -6
  2. package/lib/express/createBulkImportMiddleware.js +3 -2
  3. package/lib/express/createMCPMiddleware.js +1 -1
  4. package/lib/fastify/bulkImportHandler.js +3 -2
  5. package/lib/fastify/mcpHandler.js +1 -1
  6. package/lib/loaders/buildTextMap.js +13 -15
  7. package/lib/mcp/tools/assortment/assortmentManagement.d.ts +2 -2
  8. package/lib/mcp/tools/assortment/assortmentManagement.js +2 -2
  9. package/lib/mcp/tools/assortment/handlers/getAssortment.js +1 -1
  10. package/lib/mcp/tools/assortment/schemas.d.ts +141 -322
  11. package/lib/mcp/tools/assortment/schemas.js +96 -179
  12. package/lib/mcp/tools/filter/filterManagement.d.ts +2 -2
  13. package/lib/mcp/tools/filter/filterManagement.js +2 -2
  14. package/lib/mcp/tools/filter/schemas.d.ts +75 -184
  15. package/lib/mcp/tools/filter/schemas.js +51 -87
  16. package/lib/mcp/tools/localization/localizationManagement.d.ts +2 -2
  17. package/lib/mcp/tools/localization/localizationManagement.js +2 -2
  18. package/lib/mcp/tools/localization/schemas.d.ts +47 -110
  19. package/lib/mcp/tools/localization/schemas.js +36 -51
  20. package/lib/mcp/tools/order/orderManagement.d.ts +2 -2
  21. package/lib/mcp/tools/order/orderManagement.js +2 -2
  22. package/lib/mcp/tools/order/schemas.d.ts +75 -184
  23. package/lib/mcp/tools/order/schemas.js +51 -113
  24. package/lib/mcp/tools/product/handlers/getProduct.js +1 -1
  25. package/lib/mcp/tools/product/productManagement.d.ts +2 -2
  26. package/lib/mcp/tools/product/productManagement.js +2 -2
  27. package/lib/mcp/tools/product/schemas.d.ts +317 -642
  28. package/lib/mcp/tools/product/schemas.js +191 -287
  29. package/lib/mcp/tools/provider/providerManagement.d.ts +2 -2
  30. package/lib/mcp/tools/provider/providerManagement.js +2 -2
  31. package/lib/mcp/tools/provider/schemas.d.ts +47 -142
  32. package/lib/mcp/tools/provider/schemas.js +32 -67
  33. package/lib/mcp/tools/quotation/quotationManagement.d.ts +2 -2
  34. package/lib/mcp/tools/quotation/quotationManagement.js +2 -2
  35. package/lib/mcp/tools/quotation/schemas.d.ts +40 -111
  36. package/lib/mcp/tools/quotation/schemas.js +29 -54
  37. package/lib/mcp/tools/system/schemas.d.ts +84 -179
  38. package/lib/mcp/tools/system/schemas.js +67 -188
  39. package/lib/mcp/tools/system/systemManagement.d.ts +1 -1
  40. package/lib/mcp/tools/system/systemManagement.js +1 -1
  41. package/lib/mcp/tools/users/schemas.d.ts +163 -296
  42. package/lib/mcp/tools/users/schemas.js +71 -152
  43. package/lib/mcp/tools/users/usersManagement.d.ts +2 -2
  44. package/lib/mcp/tools/users/usersManagement.js +2 -2
  45. package/lib/mcp/utils/sharedSchemas.d.ts +39 -28
  46. package/lib/mcp/utils/sharedSchemas.js +47 -28
  47. package/lib/resolvers/mutations/accounts/changePassword.js +1 -4
  48. package/lib/resolvers/mutations/worker/addWork.js +2 -2
  49. package/lib/resolvers/queries/events/registeredEventTypes.d.ts +1 -0
  50. package/lib/resolvers/queries/events/registeredEventTypes.js +4 -0
  51. package/lib/resolvers/queries/index.d.ts +1 -0
  52. package/lib/resolvers/queries/index.js +2 -0
  53. package/lib/schema/query.js +5 -0
  54. package/package.json +1 -1
@@ -1,233 +1,138 @@
1
- import { z } from 'zod';
2
- export declare const ProviderTypeEnum: z.ZodEnum<{
1
+ import { z } from 'zod/v4-mini';
2
+ export declare const ProviderTypeEnum: z.ZodMiniEnum<{
3
3
  PAYMENT: "PAYMENT";
4
4
  DELIVERY: "DELIVERY";
5
5
  WAREHOUSING: "WAREHOUSING";
6
6
  }>;
7
- export declare const PaymentProviderTypeEnum: z.ZodEnum<{
7
+ export declare const PaymentProviderTypeEnum: z.ZodMiniEnum<{
8
8
  INVOICE: "INVOICE";
9
9
  GENERIC: "GENERIC";
10
10
  CARD: "CARD";
11
11
  }>;
12
- export declare const DeliveryProviderTypeEnum: z.ZodEnum<{
12
+ export declare const DeliveryProviderTypeEnum: z.ZodMiniEnum<{
13
13
  SHIPPING: "SHIPPING";
14
14
  PICKUP: "PICKUP";
15
15
  LOCAL: "LOCAL";
16
16
  }>;
17
- export declare const WarehousingProviderTypeEnum: z.ZodEnum<{
17
+ export declare const WarehousingProviderTypeEnum: z.ZodMiniEnum<{
18
18
  PHYSICAL: "PHYSICAL";
19
19
  VIRTUAL: "VIRTUAL";
20
20
  }>;
21
- export declare const ConfigurationEntry: z.ZodObject<{
22
- key: z.ZodString;
23
- value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodRecord<z.ZodAny, z.ZodAny>]>;
21
+ export declare const ConfigurationEntry: z.ZodMiniObject<{
22
+ key: z.ZodMiniString<string>;
23
+ value: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNumber<number>, z.ZodMiniBoolean<boolean>, z.ZodMiniRecord<z.ZodMiniAny, z.ZodMiniAny>]>;
24
24
  }, z.core.$strict>;
25
- export declare const ProviderConfigSchema: z.ZodObject<{
26
- type: z.ZodUnion<readonly [z.ZodEnum<{
25
+ export declare const ProviderConfigSchema: z.ZodMiniObject<{
26
+ type: z.ZodMiniUnion<readonly [z.ZodMiniEnum<{
27
27
  INVOICE: "INVOICE";
28
28
  GENERIC: "GENERIC";
29
29
  CARD: "CARD";
30
- }>, z.ZodEnum<{
30
+ }>, z.ZodMiniEnum<{
31
31
  SHIPPING: "SHIPPING";
32
32
  PICKUP: "PICKUP";
33
33
  LOCAL: "LOCAL";
34
- }>, z.ZodEnum<{
34
+ }>, z.ZodMiniEnum<{
35
35
  PHYSICAL: "PHYSICAL";
36
36
  VIRTUAL: "VIRTUAL";
37
37
  }>]>;
38
- adapterKey: z.ZodString;
38
+ adapterKey: z.ZodMiniString<string>;
39
39
  }, z.core.$strip>;
40
40
  export declare const actionValidators: {
41
- readonly CREATE: z.ZodObject<{
42
- providerType: z.ZodEnum<{
41
+ readonly CREATE: z.ZodMiniObject<{
42
+ providerType: z.ZodMiniEnum<{
43
43
  PAYMENT: "PAYMENT";
44
44
  DELIVERY: "DELIVERY";
45
45
  WAREHOUSING: "WAREHOUSING";
46
46
  }>;
47
- provider: z.ZodObject<{
48
- type: z.ZodUnion<readonly [z.ZodEnum<{
47
+ provider: z.ZodMiniObject<{
48
+ type: z.ZodMiniUnion<readonly [z.ZodMiniEnum<{
49
49
  INVOICE: "INVOICE";
50
50
  GENERIC: "GENERIC";
51
51
  CARD: "CARD";
52
- }>, z.ZodEnum<{
52
+ }>, z.ZodMiniEnum<{
53
53
  SHIPPING: "SHIPPING";
54
54
  PICKUP: "PICKUP";
55
55
  LOCAL: "LOCAL";
56
- }>, z.ZodEnum<{
56
+ }>, z.ZodMiniEnum<{
57
57
  PHYSICAL: "PHYSICAL";
58
58
  VIRTUAL: "VIRTUAL";
59
59
  }>]>;
60
- adapterKey: z.ZodString;
60
+ adapterKey: z.ZodMiniString<string>;
61
61
  }, z.core.$strip>;
62
62
  }, z.core.$strip>;
63
- readonly UPDATE: z.ZodObject<{
64
- providerType: z.ZodEnum<{
63
+ readonly UPDATE: z.ZodMiniObject<{
64
+ providerType: z.ZodMiniEnum<{
65
65
  PAYMENT: "PAYMENT";
66
66
  DELIVERY: "DELIVERY";
67
67
  WAREHOUSING: "WAREHOUSING";
68
68
  }>;
69
- providerId: z.ZodString;
70
- configuration: z.ZodArray<z.ZodObject<{
71
- key: z.ZodString;
72
- value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodRecord<z.ZodAny, z.ZodAny>]>;
69
+ providerId: z.ZodMiniString<string>;
70
+ configuration: z.ZodMiniArray<z.ZodMiniObject<{
71
+ key: z.ZodMiniString<string>;
72
+ value: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNumber<number>, z.ZodMiniBoolean<boolean>, z.ZodMiniRecord<z.ZodMiniAny, z.ZodMiniAny>]>;
73
73
  }, z.core.$strict>>;
74
74
  }, z.core.$strip>;
75
- readonly REMOVE: z.ZodObject<{
76
- providerType: z.ZodEnum<{
75
+ readonly REMOVE: z.ZodMiniObject<{
76
+ providerType: z.ZodMiniEnum<{
77
77
  PAYMENT: "PAYMENT";
78
78
  DELIVERY: "DELIVERY";
79
79
  WAREHOUSING: "WAREHOUSING";
80
80
  }>;
81
- providerId: z.ZodString;
81
+ providerId: z.ZodMiniString<string>;
82
82
  }, z.core.$strip>;
83
- readonly GET: z.ZodObject<{
84
- providerType: z.ZodEnum<{
83
+ readonly GET: z.ZodMiniObject<{
84
+ providerType: z.ZodMiniEnum<{
85
85
  PAYMENT: "PAYMENT";
86
86
  DELIVERY: "DELIVERY";
87
87
  WAREHOUSING: "WAREHOUSING";
88
88
  }>;
89
- providerId: z.ZodString;
89
+ providerId: z.ZodMiniString<string>;
90
90
  }, z.core.$strip>;
91
- readonly LIST: z.ZodObject<{
92
- queryString: z.ZodOptional<z.ZodString>;
93
- includeInactive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
94
- providerType: z.ZodEnum<{
91
+ readonly LIST: z.ZodMiniObject<{
92
+ queryString: z.ZodMiniOptional<z.ZodMiniString<string>>;
93
+ includeInactive: z.ZodMiniDefault<z.ZodMiniBoolean<boolean>>;
94
+ providerType: z.ZodMiniEnum<{
95
95
  PAYMENT: "PAYMENT";
96
96
  DELIVERY: "DELIVERY";
97
97
  WAREHOUSING: "WAREHOUSING";
98
98
  }>;
99
- typeFilter: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
99
+ typeFilter: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniEnum<{
100
100
  INVOICE: "INVOICE";
101
101
  GENERIC: "GENERIC";
102
102
  CARD: "CARD";
103
- }>, z.ZodEnum<{
103
+ }>, z.ZodMiniEnum<{
104
104
  SHIPPING: "SHIPPING";
105
105
  PICKUP: "PICKUP";
106
106
  LOCAL: "LOCAL";
107
- }>, z.ZodEnum<{
107
+ }>, z.ZodMiniEnum<{
108
108
  PHYSICAL: "PHYSICAL";
109
109
  VIRTUAL: "VIRTUAL";
110
110
  }>]>>;
111
111
  }, z.core.$strip>;
112
- readonly INTERFACES: z.ZodObject<{
113
- providerType: z.ZodEnum<{
112
+ readonly INTERFACES: z.ZodMiniObject<{
113
+ providerType: z.ZodMiniEnum<{
114
114
  PAYMENT: "PAYMENT";
115
115
  DELIVERY: "DELIVERY";
116
116
  WAREHOUSING: "WAREHOUSING";
117
117
  }>;
118
- typeFilter: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
118
+ typeFilter: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniEnum<{
119
119
  INVOICE: "INVOICE";
120
120
  GENERIC: "GENERIC";
121
121
  CARD: "CARD";
122
- }>, z.ZodEnum<{
122
+ }>, z.ZodMiniEnum<{
123
123
  SHIPPING: "SHIPPING";
124
124
  PICKUP: "PICKUP";
125
125
  LOCAL: "LOCAL";
126
- }>, z.ZodEnum<{
126
+ }>, z.ZodMiniEnum<{
127
127
  PHYSICAL: "PHYSICAL";
128
128
  VIRTUAL: "VIRTUAL";
129
129
  }>]>>;
130
130
  }, z.core.$strip>;
131
131
  };
132
132
  export declare const ProviderManagementSchema: {
133
- queryString: z.ZodOptional<z.ZodString>;
134
- includeInactive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
135
- action: z.ZodEnum<{
136
- GET: "GET";
137
- CREATE: "CREATE";
138
- UPDATE: "UPDATE";
139
- REMOVE: "REMOVE";
140
- LIST: "LIST";
141
- INTERFACES: "INTERFACES";
142
- }>;
143
- providerType: z.ZodEnum<{
144
- PAYMENT: "PAYMENT";
145
- DELIVERY: "DELIVERY";
146
- WAREHOUSING: "WAREHOUSING";
147
- }>;
148
- provider: z.ZodOptional<z.ZodObject<{
149
- type: z.ZodUnion<readonly [z.ZodEnum<{
150
- INVOICE: "INVOICE";
151
- GENERIC: "GENERIC";
152
- CARD: "CARD";
153
- }>, z.ZodEnum<{
154
- SHIPPING: "SHIPPING";
155
- PICKUP: "PICKUP";
156
- LOCAL: "LOCAL";
157
- }>, z.ZodEnum<{
158
- PHYSICAL: "PHYSICAL";
159
- VIRTUAL: "VIRTUAL";
160
- }>]>;
161
- adapterKey: z.ZodString;
162
- }, z.core.$strip>>;
163
- providerId: z.ZodOptional<z.ZodString>;
164
- configuration: z.ZodOptional<z.ZodArray<z.ZodObject<{
165
- key: z.ZodString;
166
- value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodRecord<z.ZodAny, z.ZodAny>]>;
167
- }, z.core.$strict>>>;
168
- typeFilter: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
169
- INVOICE: "INVOICE";
170
- GENERIC: "GENERIC";
171
- CARD: "CARD";
172
- }>, z.ZodEnum<{
173
- SHIPPING: "SHIPPING";
174
- PICKUP: "PICKUP";
175
- LOCAL: "LOCAL";
176
- }>, z.ZodEnum<{
177
- PHYSICAL: "PHYSICAL";
178
- VIRTUAL: "VIRTUAL";
179
- }>]>>;
180
- };
181
- export declare const ProviderManagementZodSchema: z.ZodObject<{
182
- queryString: z.ZodOptional<z.ZodString>;
183
- includeInactive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
184
- action: z.ZodEnum<{
185
- GET: "GET";
186
- CREATE: "CREATE";
187
- UPDATE: "UPDATE";
188
- REMOVE: "REMOVE";
189
- LIST: "LIST";
190
- INTERFACES: "INTERFACES";
191
- }>;
192
- providerType: z.ZodEnum<{
193
- PAYMENT: "PAYMENT";
194
- DELIVERY: "DELIVERY";
195
- WAREHOUSING: "WAREHOUSING";
196
- }>;
197
- provider: z.ZodOptional<z.ZodObject<{
198
- type: z.ZodUnion<readonly [z.ZodEnum<{
199
- INVOICE: "INVOICE";
200
- GENERIC: "GENERIC";
201
- CARD: "CARD";
202
- }>, z.ZodEnum<{
203
- SHIPPING: "SHIPPING";
204
- PICKUP: "PICKUP";
205
- LOCAL: "LOCAL";
206
- }>, z.ZodEnum<{
207
- PHYSICAL: "PHYSICAL";
208
- VIRTUAL: "VIRTUAL";
209
- }>]>;
210
- adapterKey: z.ZodString;
211
- }, z.core.$strip>>;
212
- providerId: z.ZodOptional<z.ZodString>;
213
- configuration: z.ZodOptional<z.ZodArray<z.ZodObject<{
214
- key: z.ZodString;
215
- value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodRecord<z.ZodAny, z.ZodAny>]>;
216
- }, z.core.$strict>>>;
217
- typeFilter: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
218
- INVOICE: "INVOICE";
219
- GENERIC: "GENERIC";
220
- CARD: "CARD";
221
- }>, z.ZodEnum<{
222
- SHIPPING: "SHIPPING";
223
- PICKUP: "PICKUP";
224
- LOCAL: "LOCAL";
225
- }>, z.ZodEnum<{
226
- PHYSICAL: "PHYSICAL";
227
- VIRTUAL: "VIRTUAL";
228
- }>]>>;
229
- }, z.core.$strip>;
230
- export type ProviderManagementParams = z.infer<typeof ProviderManagementZodSchema>;
133
+ action: z.core.$ZodType<string>;
134
+ } & Record<string, z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
135
+ export type { ManagementParams as ProviderManagementParams } from '../../utils/sharedSchemas.ts';
231
136
  export type ActionName = keyof typeof actionValidators;
232
137
  export type Params<T extends ActionName> = z.infer<(typeof actionValidators)[T]>;
233
138
  export type Handler<T extends ActionName> = (providerModule: any, params: Params<T>) => Promise<unknown>;
@@ -1,103 +1,68 @@
1
- import { z } from 'zod';
2
- import { SearchSchema } from "../../utils/sharedSchemas.js";
1
+ import { z } from 'zod/v4-mini';
2
+ import { SearchSchema, createManagementSchemaFromValidators } from "../../utils/sharedSchemas.js";
3
3
  export const ProviderTypeEnum = z
4
4
  .enum(['PAYMENT', 'DELIVERY', 'WAREHOUSING'])
5
- .describe('Type of provider - PAYMENT for payment processing (cards, invoices), DELIVERY for shipping/pickup methods, WAREHOUSING for inventory management');
5
+ .check(z.describe('Type of provider - PAYMENT for payment processing (cards, invoices), DELIVERY for shipping/pickup methods, WAREHOUSING for inventory management'));
6
6
  export const PaymentProviderTypeEnum = z.enum(['CARD', 'INVOICE', 'GENERIC']);
7
7
  export const DeliveryProviderTypeEnum = z.enum(['PICKUP', 'SHIPPING', 'LOCAL']);
8
8
  export const WarehousingProviderTypeEnum = z.enum(['PHYSICAL', 'VIRTUAL']);
9
- export const ConfigurationEntry = z
10
- .object({
9
+ export const ConfigurationEntry = z.strictObject({
11
10
  key: z
12
11
  .string()
13
- .min(1)
14
- .describe('Configuration parameter name (e.g., "apiKey", "webhookUrl", "sandbox")'),
12
+ .check(z.minLength(1), z.describe('Configuration parameter name (e.g., "apiKey", "webhookUrl", "sandbox")')),
15
13
  value: z
16
14
  .union([z.string(), z.number(), z.boolean(), z.record(z.any(), z.any())])
17
- .describe('Configuration parameter value (string, number, boolean, or object depending on the setting)'),
18
- })
19
- .strict();
15
+ .check(z.describe('Configuration parameter value (string, number, boolean, or object depending on the setting)')),
16
+ });
20
17
  export const ProviderConfigSchema = z.object({
21
18
  type: z
22
19
  .union([PaymentProviderTypeEnum, DeliveryProviderTypeEnum, WarehousingProviderTypeEnum])
23
- .describe('Specific provider subtype: PAYMENT types (CARD, INVOICE, GENERIC), DELIVERY types (PICKUP, SHIPPING, LOCAL), WAREHOUSING types (PHYSICAL, VIRTUAL) - must match providerType category'),
20
+ .check(z.describe('Specific provider subtype: PAYMENT types (CARD, INVOICE, GENERIC), DELIVERY types (PICKUP, SHIPPING, LOCAL), WAREHOUSING types (PHYSICAL, VIRTUAL) - must match providerType category')),
24
21
  adapterKey: z
25
22
  .string()
26
- .min(1)
27
- .describe('Unique adapter key that identifies the specific provider implementation - get available keys from provider_interfaces tool'),
23
+ .check(z.minLength(1), z.describe('Unique adapter key that identifies the specific provider implementation - get available keys from provider_interfaces tool')),
28
24
  });
29
25
  export const actionValidators = {
30
26
  CREATE: z.object({
31
- providerType: ProviderTypeEnum.describe('Type of provider system to operate on'),
32
- provider: ProviderConfigSchema.describe('Provider configuration including type and adapter'),
27
+ providerType: ProviderTypeEnum.check(z.describe('Type of provider system to operate on')),
28
+ provider: ProviderConfigSchema.check(z.describe('Provider configuration including type and adapter')),
33
29
  }),
34
30
  UPDATE: z.object({
35
- providerType: ProviderTypeEnum.describe('Type of provider system to operate on'),
36
- providerId: z.string().min(1).describe('Unique identifier of the specific provider instance'),
37
- configuration: z
38
- .array(ConfigurationEntry)
39
- .min(1)
40
- .describe('Array of configuration key-value pairs to update - each provider adapter has different required/optional configuration parameters')
41
- .refine((data) => {
31
+ providerType: ProviderTypeEnum.check(z.describe('Type of provider system to operate on')),
32
+ providerId: z
33
+ .string()
34
+ .check(z.minLength(1), z.describe('Unique identifier of the specific provider instance')),
35
+ configuration: z.array(ConfigurationEntry).check(z.minLength(1), z.describe('Array of configuration key-value pairs to update - each provider adapter has different required/optional configuration parameters'), z.refine((data) => {
42
36
  const keys = data.map((entry) => entry.key);
43
37
  return new Set(keys).size === keys.length;
44
38
  }, {
45
39
  message: 'Duplicate configuration keys are not allowed - each key must be unique.',
46
- }),
40
+ })),
47
41
  }),
48
42
  REMOVE: z.object({
49
- providerType: ProviderTypeEnum.describe('Type of provider system to operate on'),
50
- providerId: z.string().min(1).describe('Unique identifier of the specific provider instance'),
43
+ providerType: ProviderTypeEnum.check(z.describe('Type of provider system to operate on')),
44
+ providerId: z
45
+ .string()
46
+ .check(z.minLength(1), z.describe('Unique identifier of the specific provider instance')),
51
47
  }),
52
48
  GET: z.object({
53
- providerType: ProviderTypeEnum.describe('Type of provider system to operate on'),
54
- providerId: z.string().min(1).describe('Unique identifier of the specific provider instance'),
49
+ providerType: ProviderTypeEnum.check(z.describe('Type of provider system to operate on')),
50
+ providerId: z
51
+ .string()
52
+ .check(z.minLength(1), z.describe('Unique identifier of the specific provider instance')),
55
53
  }),
56
54
  LIST: z.object({
57
- providerType: ProviderTypeEnum.describe('Type of provider system to operate on'),
55
+ providerType: ProviderTypeEnum.check(z.describe('Type of provider system to operate on')),
58
56
  typeFilter: z
59
- .union([PaymentProviderTypeEnum, DeliveryProviderTypeEnum, WarehousingProviderTypeEnum])
60
- .optional()
61
- .describe('Optional filter by specific subtype: PAYMENT (CARD, INVOICE, GENERIC), DELIVERY (PICKUP, SHIPPING, LOCAL), WAREHOUSING (PHYSICAL, VIRTUAL)'),
57
+ .optional(z.union([PaymentProviderTypeEnum, DeliveryProviderTypeEnum, WarehousingProviderTypeEnum]))
58
+ .check(z.describe('Optional filter by specific subtype: PAYMENT (CARD, INVOICE, GENERIC), DELIVERY (PICKUP, SHIPPING, LOCAL), WAREHOUSING (PHYSICAL, VIRTUAL)')),
62
59
  ...SearchSchema,
63
60
  }),
64
61
  INTERFACES: z.object({
65
- providerType: ProviderTypeEnum.describe('Type of provider system to operate on'),
62
+ providerType: ProviderTypeEnum.check(z.describe('Type of provider system to operate on')),
66
63
  typeFilter: z
67
- .union([PaymentProviderTypeEnum, DeliveryProviderTypeEnum, WarehousingProviderTypeEnum])
68
- .optional()
69
- .describe('Optional filter by specific subtype: PAYMENT (CARD, INVOICE, GENERIC), DELIVERY (PICKUP, SHIPPING, LOCAL), WAREHOUSING (PHYSICAL, VIRTUAL)'),
64
+ .optional(z.union([PaymentProviderTypeEnum, DeliveryProviderTypeEnum, WarehousingProviderTypeEnum]))
65
+ .check(z.describe('Optional filter by specific subtype: PAYMENT (CARD, INVOICE, GENERIC), DELIVERY (PICKUP, SHIPPING, LOCAL), WAREHOUSING (PHYSICAL, VIRTUAL)')),
70
66
  }),
71
67
  };
72
- export const ProviderManagementSchema = {
73
- action: z
74
- .enum(['CREATE', 'UPDATE', 'REMOVE', 'GET', 'LIST', 'INTERFACES'])
75
- .describe('Provider action: CREATE (new provider), UPDATE (modify configuration), REMOVE (soft delete), GET (retrieve single), LIST (find multiple), INTERFACES (available adapters)'),
76
- providerType: ProviderTypeEnum.describe('Type of provider system to operate on'),
77
- provider: ProviderConfigSchema.optional().describe('Provider configuration including type and adapter (required for CREATE action)'),
78
- providerId: z
79
- .string()
80
- .min(1)
81
- .optional()
82
- .describe('Unique identifier of the specific provider instance (required for UPDATE, REMOVE, GET actions)'),
83
- configuration: z
84
- .array(ConfigurationEntry)
85
- .min(1)
86
- .optional()
87
- .describe('Array of configuration key-value pairs to update (required for UPDATE action) - each provider adapter has different required/optional configuration parameters')
88
- .refine((data) => {
89
- if (!data)
90
- return true;
91
- const keys = data.map((entry) => entry.key);
92
- return new Set(keys).size === keys.length;
93
- }, {
94
- message: 'Duplicate configuration keys are not allowed - each key must be unique.',
95
- path: ['configuration'],
96
- }),
97
- typeFilter: z
98
- .union([PaymentProviderTypeEnum, DeliveryProviderTypeEnum, WarehousingProviderTypeEnum])
99
- .optional()
100
- .describe('Optional filter by specific subtype for LIST/INTERFACES action: PAYMENT (CARD, INVOICE, GENERIC), DELIVERY (PICKUP, SHIPPING, LOCAL), WAREHOUSING (PHYSICAL, VIRTUAL)'),
101
- ...SearchSchema,
102
- };
103
- export const ProviderManagementZodSchema = z.object(ProviderManagementSchema);
68
+ export const ProviderManagementSchema = createManagementSchemaFromValidators(actionValidators);
@@ -1,6 +1,6 @@
1
1
  import type { Context } from '../../../context.ts';
2
- import { QuotationManagementSchema, QuotationManagementZodSchema, type QuotationManagementParams } from './schemas.ts';
3
- export { QuotationManagementSchema, QuotationManagementZodSchema };
2
+ import { QuotationManagementSchema, type QuotationManagementParams } from './schemas.ts';
3
+ export { QuotationManagementSchema };
4
4
  export type { QuotationManagementParams };
5
5
  export declare function quotationManagement(context: Context, params: QuotationManagementParams): Promise<{
6
6
  content: {
@@ -1,8 +1,8 @@
1
1
  import { log } from '@unchainedshop/logger';
2
- import { actionValidators, QuotationManagementSchema, QuotationManagementZodSchema, } from "./schemas.js";
2
+ import { actionValidators, QuotationManagementSchema, } from "./schemas.js";
3
3
  import actionHandlers from "./handlers/index.js";
4
4
  import { createMcpResponse, createMcpErrorResponse } from "../../utils/sharedSchemas.js";
5
- export { QuotationManagementSchema, QuotationManagementZodSchema };
5
+ export { QuotationManagementSchema };
6
6
  export async function quotationManagement(context, params) {
7
7
  const { action, ...actionParams } = params;
8
8
  log('MCP handler quotationManagement ', { userId: context.userId, params });
@@ -1,145 +1,74 @@
1
- import { z } from 'zod';
2
- export declare const QuotationStatusEnum: z.ZodEnum<{
1
+ import { z } from 'zod/v4-mini';
2
+ export declare const QuotationStatusEnum: z.ZodMiniEnum<{
3
3
  FULFILLED: "FULFILLED";
4
4
  REJECTED: "REJECTED";
5
5
  REQUESTED: "REQUESTED";
6
6
  PROCESSING: "PROCESSING";
7
7
  PROPOSED: "PROPOSED";
8
8
  }>;
9
- export declare const ProductConfigurationInput: z.ZodObject<{
10
- key: z.ZodString;
11
- value: z.ZodString;
9
+ export declare const ProductConfigurationInput: z.ZodMiniObject<{
10
+ key: z.ZodMiniString<string>;
11
+ value: z.ZodMiniString<string>;
12
12
  }, z.core.$strip>;
13
13
  export declare const actionValidators: {
14
- readonly LIST: z.ZodObject<{
15
- status: z.ZodOptional<z.ZodEnum<{
14
+ readonly LIST: z.ZodMiniObject<{
15
+ status: z.ZodMiniOptional<z.ZodMiniEnum<{
16
16
  FULFILLED: "FULFILLED";
17
17
  REJECTED: "REJECTED";
18
18
  REQUESTED: "REQUESTED";
19
19
  PROCESSING: "PROCESSING";
20
20
  PROPOSED: "PROPOSED";
21
21
  }>>;
22
- userId: z.ZodOptional<z.ZodString>;
23
- productId: z.ZodOptional<z.ZodString>;
24
- from: z.ZodOptional<z.ZodString>;
25
- to: z.ZodOptional<z.ZodString>;
26
- queryString: z.ZodOptional<z.ZodString>;
27
- includeInactive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
28
- sort: z.ZodOptional<z.ZodArray<z.ZodObject<{
29
- key: z.ZodString;
30
- value: z.ZodEnum<{
22
+ userId: z.ZodMiniOptional<z.ZodMiniString<string>>;
23
+ productId: z.ZodMiniOptional<z.ZodMiniString<string>>;
24
+ from: z.ZodMiniOptional<z.iso.ZodMiniISODateTime>;
25
+ to: z.ZodMiniOptional<z.iso.ZodMiniISODateTime>;
26
+ queryString: z.ZodMiniOptional<z.ZodMiniString<string>>;
27
+ includeInactive: z.ZodMiniDefault<z.ZodMiniBoolean<boolean>>;
28
+ sort: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
29
+ key: z.ZodMiniString<string>;
30
+ value: z.ZodMiniEnum<{
31
31
  [x: string]: string;
32
32
  }>;
33
33
  }, z.core.$strip>>>;
34
- limit: z.ZodOptional<z.ZodNumber>;
35
- offset: z.ZodOptional<z.ZodNumber>;
34
+ limit: z.ZodMiniOptional<z.ZodMiniNumberFormat>;
35
+ offset: z.ZodMiniOptional<z.ZodMiniNumberFormat>;
36
36
  }, z.core.$strip>;
37
- readonly GET: z.ZodObject<{
38
- quotationId: z.ZodString;
37
+ readonly GET: z.ZodMiniObject<{
38
+ quotationId: z.ZodMiniString<string>;
39
39
  }, z.core.$strip>;
40
- readonly COUNT: z.ZodObject<{
41
- status: z.ZodOptional<z.ZodEnum<{
40
+ readonly COUNT: z.ZodMiniObject<{
41
+ status: z.ZodMiniOptional<z.ZodMiniEnum<{
42
42
  FULFILLED: "FULFILLED";
43
43
  REJECTED: "REJECTED";
44
44
  REQUESTED: "REQUESTED";
45
45
  PROCESSING: "PROCESSING";
46
46
  PROPOSED: "PROPOSED";
47
47
  }>>;
48
- userId: z.ZodOptional<z.ZodString>;
49
- productId: z.ZodOptional<z.ZodString>;
50
- from: z.ZodOptional<z.ZodString>;
51
- to: z.ZodOptional<z.ZodString>;
52
- queryString: z.ZodOptional<z.ZodString>;
53
- includeInactive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
48
+ userId: z.ZodMiniOptional<z.ZodMiniString<string>>;
49
+ productId: z.ZodMiniOptional<z.ZodMiniString<string>>;
50
+ from: z.ZodMiniOptional<z.iso.ZodMiniISODateTime>;
51
+ to: z.ZodMiniOptional<z.iso.ZodMiniISODateTime>;
52
+ queryString: z.ZodMiniOptional<z.ZodMiniString<string>>;
53
+ includeInactive: z.ZodMiniDefault<z.ZodMiniBoolean<boolean>>;
54
54
  }, z.core.$strip>;
55
- readonly VERIFY: z.ZodObject<{
56
- quotationId: z.ZodString;
57
- quotationContext: z.ZodOptional<z.ZodRecord<z.ZodAny, z.ZodAny>>;
55
+ readonly VERIFY: z.ZodMiniObject<{
56
+ quotationId: z.ZodMiniString<string>;
57
+ quotationContext: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniAny, z.ZodMiniAny>>;
58
58
  }, z.core.$strip>;
59
- readonly MAKE_PROPOSAL: z.ZodObject<{
60
- quotationId: z.ZodString;
61
- quotationContext: z.ZodOptional<z.ZodRecord<z.ZodAny, z.ZodAny>>;
59
+ readonly MAKE_PROPOSAL: z.ZodMiniObject<{
60
+ quotationId: z.ZodMiniString<string>;
61
+ quotationContext: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniAny, z.ZodMiniAny>>;
62
62
  }, z.core.$strip>;
63
- readonly REJECT: z.ZodObject<{
64
- quotationId: z.ZodString;
65
- quotationContext: z.ZodOptional<z.ZodRecord<z.ZodAny, z.ZodAny>>;
63
+ readonly REJECT: z.ZodMiniObject<{
64
+ quotationId: z.ZodMiniString<string>;
65
+ quotationContext: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniAny, z.ZodMiniAny>>;
66
66
  }, z.core.$strip>;
67
67
  };
68
68
  export declare const QuotationManagementSchema: {
69
- status: z.ZodOptional<z.ZodEnum<{
70
- FULFILLED: "FULFILLED";
71
- REJECTED: "REJECTED";
72
- REQUESTED: "REQUESTED";
73
- PROCESSING: "PROCESSING";
74
- PROPOSED: "PROPOSED";
75
- }>>;
76
- userId: z.ZodOptional<z.ZodString>;
77
- productId: z.ZodOptional<z.ZodString>;
78
- quotationId: z.ZodOptional<z.ZodString>;
79
- configuration: z.ZodOptional<z.ZodArray<z.ZodObject<{
80
- key: z.ZodString;
81
- value: z.ZodString;
82
- }, z.core.$strip>>>;
83
- quotationContext: z.ZodOptional<z.ZodRecord<z.ZodAny, z.ZodAny>>;
84
- from: z.ZodOptional<z.ZodString>;
85
- to: z.ZodOptional<z.ZodString>;
86
- queryString: z.ZodOptional<z.ZodString>;
87
- includeInactive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
88
- sort: z.ZodOptional<z.ZodArray<z.ZodObject<{
89
- key: z.ZodString;
90
- value: z.ZodEnum<{
91
- [x: string]: string;
92
- }>;
93
- }, z.core.$strip>>>;
94
- limit: z.ZodOptional<z.ZodNumber>;
95
- offset: z.ZodOptional<z.ZodNumber>;
96
- action: z.ZodEnum<{
97
- GET: "GET";
98
- LIST: "LIST";
99
- COUNT: "COUNT";
100
- VERIFY: "VERIFY";
101
- MAKE_PROPOSAL: "MAKE_PROPOSAL";
102
- REJECT: "REJECT";
103
- }>;
104
- };
105
- export declare const QuotationManagementZodSchema: z.ZodObject<{
106
- status: z.ZodOptional<z.ZodEnum<{
107
- FULFILLED: "FULFILLED";
108
- REJECTED: "REJECTED";
109
- REQUESTED: "REQUESTED";
110
- PROCESSING: "PROCESSING";
111
- PROPOSED: "PROPOSED";
112
- }>>;
113
- userId: z.ZodOptional<z.ZodString>;
114
- productId: z.ZodOptional<z.ZodString>;
115
- quotationId: z.ZodOptional<z.ZodString>;
116
- configuration: z.ZodOptional<z.ZodArray<z.ZodObject<{
117
- key: z.ZodString;
118
- value: z.ZodString;
119
- }, z.core.$strip>>>;
120
- quotationContext: z.ZodOptional<z.ZodRecord<z.ZodAny, z.ZodAny>>;
121
- from: z.ZodOptional<z.ZodString>;
122
- to: z.ZodOptional<z.ZodString>;
123
- queryString: z.ZodOptional<z.ZodString>;
124
- includeInactive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
125
- sort: z.ZodOptional<z.ZodArray<z.ZodObject<{
126
- key: z.ZodString;
127
- value: z.ZodEnum<{
128
- [x: string]: string;
129
- }>;
130
- }, z.core.$strip>>>;
131
- limit: z.ZodOptional<z.ZodNumber>;
132
- offset: z.ZodOptional<z.ZodNumber>;
133
- action: z.ZodEnum<{
134
- GET: "GET";
135
- LIST: "LIST";
136
- COUNT: "COUNT";
137
- VERIFY: "VERIFY";
138
- MAKE_PROPOSAL: "MAKE_PROPOSAL";
139
- REJECT: "REJECT";
140
- }>;
141
- }, z.core.$strip>;
142
- export type QuotationManagementParams = z.infer<typeof QuotationManagementZodSchema>;
69
+ action: z.core.$ZodType<string>;
70
+ } & Record<string, z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
71
+ export type { ManagementParams as QuotationManagementParams } from '../../utils/sharedSchemas.ts';
143
72
  export type ActionName = keyof typeof actionValidators;
144
73
  export type Params<T extends ActionName> = z.infer<(typeof actionValidators)[T]>;
145
74
  export type Handler<T extends ActionName> = (context: any, params: Params<T>) => Promise<unknown>;