@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.
- package/lib/chat/generateImageHandler.js +5 -6
- package/lib/express/createBulkImportMiddleware.js +3 -2
- package/lib/express/createMCPMiddleware.js +1 -1
- package/lib/fastify/bulkImportHandler.js +3 -2
- 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/lib/resolvers/mutations/worker/addWork.js +2 -2
- package/lib/resolvers/queries/events/registeredEventTypes.d.ts +1 -0
- package/lib/resolvers/queries/events/registeredEventTypes.js +4 -0
- package/lib/resolvers/queries/index.d.ts +1 -0
- package/lib/resolvers/queries/index.js +2 -0
- package/lib/schema/query.js +5 -0
- package/package.json +1 -1
|
@@ -1,233 +1,138 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const ProviderTypeEnum: z.
|
|
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.
|
|
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.
|
|
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.
|
|
17
|
+
export declare const WarehousingProviderTypeEnum: z.ZodMiniEnum<{
|
|
18
18
|
PHYSICAL: "PHYSICAL";
|
|
19
19
|
VIRTUAL: "VIRTUAL";
|
|
20
20
|
}>;
|
|
21
|
-
export declare const ConfigurationEntry: z.
|
|
22
|
-
key: z.
|
|
23
|
-
value: z.
|
|
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.
|
|
26
|
-
type: z.
|
|
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.
|
|
30
|
+
}>, z.ZodMiniEnum<{
|
|
31
31
|
SHIPPING: "SHIPPING";
|
|
32
32
|
PICKUP: "PICKUP";
|
|
33
33
|
LOCAL: "LOCAL";
|
|
34
|
-
}>, z.
|
|
34
|
+
}>, z.ZodMiniEnum<{
|
|
35
35
|
PHYSICAL: "PHYSICAL";
|
|
36
36
|
VIRTUAL: "VIRTUAL";
|
|
37
37
|
}>]>;
|
|
38
|
-
adapterKey: z.
|
|
38
|
+
adapterKey: z.ZodMiniString<string>;
|
|
39
39
|
}, z.core.$strip>;
|
|
40
40
|
export declare const actionValidators: {
|
|
41
|
-
readonly CREATE: z.
|
|
42
|
-
providerType: z.
|
|
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.
|
|
48
|
-
type: z.
|
|
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.
|
|
52
|
+
}>, z.ZodMiniEnum<{
|
|
53
53
|
SHIPPING: "SHIPPING";
|
|
54
54
|
PICKUP: "PICKUP";
|
|
55
55
|
LOCAL: "LOCAL";
|
|
56
|
-
}>, z.
|
|
56
|
+
}>, z.ZodMiniEnum<{
|
|
57
57
|
PHYSICAL: "PHYSICAL";
|
|
58
58
|
VIRTUAL: "VIRTUAL";
|
|
59
59
|
}>]>;
|
|
60
|
-
adapterKey: z.
|
|
60
|
+
adapterKey: z.ZodMiniString<string>;
|
|
61
61
|
}, z.core.$strip>;
|
|
62
62
|
}, z.core.$strip>;
|
|
63
|
-
readonly UPDATE: z.
|
|
64
|
-
providerType: z.
|
|
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.
|
|
70
|
-
configuration: z.
|
|
71
|
-
key: z.
|
|
72
|
-
value: z.
|
|
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.
|
|
76
|
-
providerType: z.
|
|
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.
|
|
81
|
+
providerId: z.ZodMiniString<string>;
|
|
82
82
|
}, z.core.$strip>;
|
|
83
|
-
readonly GET: z.
|
|
84
|
-
providerType: z.
|
|
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.
|
|
89
|
+
providerId: z.ZodMiniString<string>;
|
|
90
90
|
}, z.core.$strip>;
|
|
91
|
-
readonly LIST: z.
|
|
92
|
-
queryString: z.
|
|
93
|
-
includeInactive: z.
|
|
94
|
-
providerType: z.
|
|
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.
|
|
99
|
+
typeFilter: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniEnum<{
|
|
100
100
|
INVOICE: "INVOICE";
|
|
101
101
|
GENERIC: "GENERIC";
|
|
102
102
|
CARD: "CARD";
|
|
103
|
-
}>, z.
|
|
103
|
+
}>, z.ZodMiniEnum<{
|
|
104
104
|
SHIPPING: "SHIPPING";
|
|
105
105
|
PICKUP: "PICKUP";
|
|
106
106
|
LOCAL: "LOCAL";
|
|
107
|
-
}>, z.
|
|
107
|
+
}>, z.ZodMiniEnum<{
|
|
108
108
|
PHYSICAL: "PHYSICAL";
|
|
109
109
|
VIRTUAL: "VIRTUAL";
|
|
110
110
|
}>]>>;
|
|
111
111
|
}, z.core.$strip>;
|
|
112
|
-
readonly INTERFACES: z.
|
|
113
|
-
providerType: z.
|
|
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.
|
|
118
|
+
typeFilter: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniEnum<{
|
|
119
119
|
INVOICE: "INVOICE";
|
|
120
120
|
GENERIC: "GENERIC";
|
|
121
121
|
CARD: "CARD";
|
|
122
|
-
}>, z.
|
|
122
|
+
}>, z.ZodMiniEnum<{
|
|
123
123
|
SHIPPING: "SHIPPING";
|
|
124
124
|
PICKUP: "PICKUP";
|
|
125
125
|
LOCAL: "LOCAL";
|
|
126
|
-
}>, z.
|
|
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
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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
|
-
.
|
|
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
|
-
.
|
|
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
|
|
37
|
-
|
|
38
|
-
.
|
|
39
|
-
|
|
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
|
|
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
|
|
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
|
-
.
|
|
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
|
-
.
|
|
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,
|
|
3
|
-
export { QuotationManagementSchema
|
|
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,
|
|
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
|
|
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.
|
|
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.
|
|
10
|
-
key: z.
|
|
11
|
-
value: z.
|
|
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.
|
|
15
|
-
status: z.
|
|
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.
|
|
23
|
-
productId: z.
|
|
24
|
-
from: z.
|
|
25
|
-
to: z.
|
|
26
|
-
queryString: z.
|
|
27
|
-
includeInactive: z.
|
|
28
|
-
sort: z.
|
|
29
|
-
key: z.
|
|
30
|
-
value: z.
|
|
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.
|
|
35
|
-
offset: z.
|
|
34
|
+
limit: z.ZodMiniOptional<z.ZodMiniNumberFormat>;
|
|
35
|
+
offset: z.ZodMiniOptional<z.ZodMiniNumberFormat>;
|
|
36
36
|
}, z.core.$strip>;
|
|
37
|
-
readonly GET: z.
|
|
38
|
-
quotationId: z.
|
|
37
|
+
readonly GET: z.ZodMiniObject<{
|
|
38
|
+
quotationId: z.ZodMiniString<string>;
|
|
39
39
|
}, z.core.$strip>;
|
|
40
|
-
readonly COUNT: z.
|
|
41
|
-
status: z.
|
|
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.
|
|
49
|
-
productId: z.
|
|
50
|
-
from: z.
|
|
51
|
-
to: z.
|
|
52
|
-
queryString: z.
|
|
53
|
-
includeInactive: z.
|
|
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.
|
|
56
|
-
quotationId: z.
|
|
57
|
-
quotationContext: z.
|
|
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.
|
|
60
|
-
quotationId: z.
|
|
61
|
-
quotationContext: z.
|
|
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.
|
|
64
|
-
quotationId: z.
|
|
65
|
-
quotationContext: z.
|
|
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
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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>;
|