@hartl-services/medusa-contracts 1.5.0 → 1.7.0

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.
@@ -0,0 +1,391 @@
1
+ import { z } from "@medusajs/framework/zod";
2
+ /** Plugin key and container key of the order assistant in the base. */
3
+ export declare const ORDER_ASSISTANT_PLUGIN_KEY = "order_assistant";
4
+ /** Tool names as the MCP client sees them. */
5
+ export declare const ORDER_ASSISTANT_TOOLS: {
6
+ readonly searchCustomers: "kunden_suchen";
7
+ readonly searchProducts: "produkte_suchen";
8
+ readonly listShippingOptions: "versandarten_auflisten";
9
+ readonly createDraftOrder: "bestellentwurf_anlegen";
10
+ };
11
+ export type OrderAssistantToolName = (typeof ORDER_ASSISTANT_TOOLS)[keyof typeof ORDER_ASSISTANT_TOOLS];
12
+ /** How the order reached the shop; stored in the order metadata. */
13
+ export declare const OrderAssistantSourceSchema: z.ZodEnum<{
14
+ fax: "fax";
15
+ telefon: "telefon";
16
+ }>;
17
+ /** Order metadata keys the assistant writes. */
18
+ export declare const ORDER_ASSISTANT_METADATA: {
19
+ readonly source: "order_source";
20
+ readonly note: "order_note";
21
+ };
22
+ export declare const ORDER_ASSISTANT_LIMITS: {
23
+ readonly customers: 10;
24
+ readonly variants: 20;
25
+ readonly items: 50;
26
+ readonly noteLength: 2000;
27
+ };
28
+ export declare const OrderAssistantAddressSchema: z.ZodObject<{
29
+ first_name: z.ZodString;
30
+ last_name: z.ZodString;
31
+ company: z.ZodOptional<z.ZodString>;
32
+ address_1: z.ZodString;
33
+ address_2: z.ZodOptional<z.ZodString>;
34
+ postal_code: z.ZodString;
35
+ city: z.ZodString;
36
+ country_code: z.ZodString;
37
+ phone: z.ZodOptional<z.ZodString>;
38
+ }, z.core.$strict>;
39
+ export declare const SearchCustomersInputSchema: z.ZodObject<{
40
+ query: z.ZodOptional<z.ZodString>;
41
+ postal_code: z.ZodOptional<z.ZodString>;
42
+ city: z.ZodOptional<z.ZodString>;
43
+ }, z.core.$strict>;
44
+ export declare const OrderAssistantCustomerAddressSchema: z.ZodObject<{
45
+ first_name: z.ZodNullable<z.ZodString>;
46
+ last_name: z.ZodNullable<z.ZodString>;
47
+ company: z.ZodNullable<z.ZodString>;
48
+ address_1: z.ZodNullable<z.ZodString>;
49
+ address_2: z.ZodNullable<z.ZodString>;
50
+ postal_code: z.ZodNullable<z.ZodString>;
51
+ city: z.ZodNullable<z.ZodString>;
52
+ country_code: z.ZodNullable<z.ZodString>;
53
+ phone: z.ZodNullable<z.ZodString>;
54
+ }, z.core.$strip>;
55
+ export declare const OrderAssistantCustomerSchema: z.ZodObject<{
56
+ id: z.ZodString;
57
+ first_name: z.ZodNullable<z.ZodString>;
58
+ last_name: z.ZodNullable<z.ZodString>;
59
+ company_name: z.ZodNullable<z.ZodString>;
60
+ email: z.ZodNullable<z.ZodString>;
61
+ phone: z.ZodNullable<z.ZodString>;
62
+ has_account: z.ZodBoolean;
63
+ addresses: z.ZodArray<z.ZodObject<{
64
+ first_name: z.ZodNullable<z.ZodString>;
65
+ last_name: z.ZodNullable<z.ZodString>;
66
+ company: z.ZodNullable<z.ZodString>;
67
+ address_1: z.ZodNullable<z.ZodString>;
68
+ address_2: z.ZodNullable<z.ZodString>;
69
+ postal_code: z.ZodNullable<z.ZodString>;
70
+ city: z.ZodNullable<z.ZodString>;
71
+ country_code: z.ZodNullable<z.ZodString>;
72
+ phone: z.ZodNullable<z.ZodString>;
73
+ }, z.core.$strip>>;
74
+ }, z.core.$strip>;
75
+ export declare const SearchCustomersOutputSchema: z.ZodObject<{
76
+ customers: z.ZodArray<z.ZodObject<{
77
+ id: z.ZodString;
78
+ first_name: z.ZodNullable<z.ZodString>;
79
+ last_name: z.ZodNullable<z.ZodString>;
80
+ company_name: z.ZodNullable<z.ZodString>;
81
+ email: z.ZodNullable<z.ZodString>;
82
+ phone: z.ZodNullable<z.ZodString>;
83
+ has_account: z.ZodBoolean;
84
+ addresses: z.ZodArray<z.ZodObject<{
85
+ first_name: z.ZodNullable<z.ZodString>;
86
+ last_name: z.ZodNullable<z.ZodString>;
87
+ company: z.ZodNullable<z.ZodString>;
88
+ address_1: z.ZodNullable<z.ZodString>;
89
+ address_2: z.ZodNullable<z.ZodString>;
90
+ postal_code: z.ZodNullable<z.ZodString>;
91
+ city: z.ZodNullable<z.ZodString>;
92
+ country_code: z.ZodNullable<z.ZodString>;
93
+ phone: z.ZodNullable<z.ZodString>;
94
+ }, z.core.$strip>>;
95
+ }, z.core.$strip>>;
96
+ }, z.core.$strip>;
97
+ export declare const SearchProductsInputSchema: z.ZodObject<{
98
+ query: z.ZodString;
99
+ country_code: z.ZodString;
100
+ }, z.core.$strict>;
101
+ export declare const OrderAssistantVariantSchema: z.ZodObject<{
102
+ variant_id: z.ZodString;
103
+ product_title: z.ZodString;
104
+ variant_title: z.ZodNullable<z.ZodString>;
105
+ sku: z.ZodNullable<z.ZodString>;
106
+ unit_price: z.ZodNullable<z.ZodNumber>;
107
+ currency_code: z.ZodString;
108
+ available_quantity: z.ZodNullable<z.ZodNumber>;
109
+ orderable: z.ZodBoolean;
110
+ }, z.core.$strip>;
111
+ export declare const SearchProductsOutputSchema: z.ZodObject<{
112
+ variants: z.ZodArray<z.ZodObject<{
113
+ variant_id: z.ZodString;
114
+ product_title: z.ZodString;
115
+ variant_title: z.ZodNullable<z.ZodString>;
116
+ sku: z.ZodNullable<z.ZodString>;
117
+ unit_price: z.ZodNullable<z.ZodNumber>;
118
+ currency_code: z.ZodString;
119
+ available_quantity: z.ZodNullable<z.ZodNumber>;
120
+ orderable: z.ZodBoolean;
121
+ }, z.core.$strip>>;
122
+ }, z.core.$strip>;
123
+ export declare const ListShippingOptionsInputSchema: z.ZodObject<{
124
+ country_code: z.ZodString;
125
+ }, z.core.$strict>;
126
+ export declare const OrderAssistantShippingOptionSchema: z.ZodObject<{
127
+ id: z.ZodString;
128
+ name: z.ZodString;
129
+ amount: z.ZodNullable<z.ZodNumber>;
130
+ currency_code: z.ZodString;
131
+ }, z.core.$strip>;
132
+ export declare const ListShippingOptionsOutputSchema: z.ZodObject<{
133
+ shipping_options: z.ZodArray<z.ZodObject<{
134
+ id: z.ZodString;
135
+ name: z.ZodString;
136
+ amount: z.ZodNullable<z.ZodNumber>;
137
+ currency_code: z.ZodString;
138
+ }, z.core.$strip>>;
139
+ }, z.core.$strip>;
140
+ export declare const OrderAssistantNewCustomerSchema: z.ZodObject<{
141
+ first_name: z.ZodString;
142
+ last_name: z.ZodString;
143
+ company_name: z.ZodOptional<z.ZodString>;
144
+ email: z.ZodOptional<z.ZodString>;
145
+ phone: z.ZodOptional<z.ZodString>;
146
+ }, z.core.$strict>;
147
+ export declare const CreateDraftOrderInputSchema: z.ZodObject<{
148
+ customer_id: z.ZodOptional<z.ZodString>;
149
+ new_customer: z.ZodOptional<z.ZodObject<{
150
+ first_name: z.ZodString;
151
+ last_name: z.ZodString;
152
+ company_name: z.ZodOptional<z.ZodString>;
153
+ email: z.ZodOptional<z.ZodString>;
154
+ phone: z.ZodOptional<z.ZodString>;
155
+ }, z.core.$strict>>;
156
+ shipping_address: z.ZodObject<{
157
+ first_name: z.ZodString;
158
+ last_name: z.ZodString;
159
+ company: z.ZodOptional<z.ZodString>;
160
+ address_1: z.ZodString;
161
+ address_2: z.ZodOptional<z.ZodString>;
162
+ postal_code: z.ZodString;
163
+ city: z.ZodString;
164
+ country_code: z.ZodString;
165
+ phone: z.ZodOptional<z.ZodString>;
166
+ }, z.core.$strict>;
167
+ billing_address: z.ZodOptional<z.ZodObject<{
168
+ first_name: z.ZodString;
169
+ last_name: z.ZodString;
170
+ company: z.ZodOptional<z.ZodString>;
171
+ address_1: z.ZodString;
172
+ address_2: z.ZodOptional<z.ZodString>;
173
+ postal_code: z.ZodString;
174
+ city: z.ZodString;
175
+ country_code: z.ZodString;
176
+ phone: z.ZodOptional<z.ZodString>;
177
+ }, z.core.$strict>>;
178
+ items: z.ZodArray<z.ZodObject<{
179
+ variant_id: z.ZodString;
180
+ quantity: z.ZodNumber;
181
+ }, z.core.$strict>>;
182
+ shipping_option_id: z.ZodString;
183
+ source: z.ZodEnum<{
184
+ fax: "fax";
185
+ telefon: "telefon";
186
+ }>;
187
+ note: z.ZodOptional<z.ZodString>;
188
+ }, z.core.$strict>;
189
+ export declare const OrderAssistantDraftItemSchema: z.ZodObject<{
190
+ title: z.ZodString;
191
+ sku: z.ZodNullable<z.ZodString>;
192
+ quantity: z.ZodNumber;
193
+ unit_price: z.ZodNumber;
194
+ total: z.ZodNumber;
195
+ }, z.core.$strip>;
196
+ export declare const CreateDraftOrderOutputSchema: z.ZodObject<{
197
+ draft_order_id: z.ZodString;
198
+ display_id: z.ZodNullable<z.ZodNumber>;
199
+ customer_id: z.ZodString;
200
+ customer_created: z.ZodBoolean;
201
+ currency_code: z.ZodString;
202
+ items: z.ZodArray<z.ZodObject<{
203
+ title: z.ZodString;
204
+ sku: z.ZodNullable<z.ZodString>;
205
+ quantity: z.ZodNumber;
206
+ unit_price: z.ZodNumber;
207
+ total: z.ZodNumber;
208
+ }, z.core.$strip>>;
209
+ shipping_total: z.ZodNumber;
210
+ tax_total: z.ZodNumber;
211
+ total: z.ZodNumber;
212
+ admin_path: z.ZodString;
213
+ }, z.core.$strip>;
214
+ /** Feature keys of the order assistant's plugin toggles. */
215
+ export declare const ORDER_ASSISTANT_FEATURES: {
216
+ readonly oauth: "oauth";
217
+ };
218
+ export declare const ORDER_ASSISTANT_OAUTH: {
219
+ /** The one scope: use the assistant's tools as the signed-in Admin user. */
220
+ readonly scope: "order_assistant";
221
+ readonly accessTokenTtlSeconds: 3600;
222
+ /** A connection ends when its refresh token stays unused this long. */
223
+ readonly connectionIdleDays: 30;
224
+ /** How long the consent page may stay open. */
225
+ readonly authorizationRequestTtlSeconds: 600;
226
+ /** How long the client has to redeem the code after the consent. */
227
+ readonly authorizationCodeTtlSeconds: 120;
228
+ readonly maxRedirectUris: 10;
229
+ readonly maxUriLength: 2000;
230
+ readonly maxClientNameLength: 120;
231
+ readonly maxStateLength: 2000;
232
+ };
233
+ /** `http://localhost`, `http://127.0.0.1` or `http://[::1]`, any port. */
234
+ export declare const isOAuthLoopbackRedirectUri: (value: string) => boolean;
235
+ /**
236
+ * A redirect URI a client may register: https, or http on a loopback address
237
+ * (native clients such as Claude Code), without credentials or fragment.
238
+ */
239
+ export declare const OAuthRedirectUriSchema: z.ZodString;
240
+ /**
241
+ * Dynamic client registration request (RFC 7591). Unknown metadata is
242
+ * ignored; the requested authentication method, grant and response types are
243
+ * accepted as sent and answered with what the server actually supports.
244
+ */
245
+ export declare const OAuthClientRegistrationRequestSchema: z.ZodObject<{
246
+ redirect_uris: z.ZodArray<z.ZodString>;
247
+ client_name: z.ZodOptional<z.ZodString>;
248
+ }, z.core.$strip>;
249
+ export declare const OAuthClientRegistrationResponseSchema: z.ZodObject<{
250
+ client_id: z.ZodString;
251
+ client_id_issued_at: z.ZodNumber;
252
+ client_name: z.ZodOptional<z.ZodString>;
253
+ redirect_uris: z.ZodArray<z.ZodString>;
254
+ token_endpoint_auth_method: z.ZodLiteral<"none">;
255
+ grant_types: z.ZodArray<z.ZodString>;
256
+ response_types: z.ZodArray<z.ZodString>;
257
+ scope: z.ZodString;
258
+ }, z.core.$strip>;
259
+ /** Query of the authorization endpoint, before the client is looked up. */
260
+ export declare const OAuthAuthorizeQuerySchema: z.ZodObject<{
261
+ client_id: z.ZodString;
262
+ redirect_uri: z.ZodString;
263
+ response_type: z.ZodOptional<z.ZodString>;
264
+ code_challenge: z.ZodOptional<z.ZodString>;
265
+ code_challenge_method: z.ZodOptional<z.ZodString>;
266
+ state: z.ZodOptional<z.ZodString>;
267
+ scope: z.ZodOptional<z.ZodString>;
268
+ resource: z.ZodOptional<z.ZodString>;
269
+ }, z.core.$strip>;
270
+ /** Body of the token endpoint (`application/x-www-form-urlencoded`). */
271
+ export declare const OAuthTokenRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
272
+ grant_type: z.ZodLiteral<"authorization_code">;
273
+ code: z.ZodString;
274
+ code_verifier: z.ZodString;
275
+ client_id: z.ZodString;
276
+ redirect_uri: z.ZodOptional<z.ZodString>;
277
+ resource: z.ZodOptional<z.ZodString>;
278
+ }, z.core.$strip>, z.ZodObject<{
279
+ grant_type: z.ZodLiteral<"refresh_token">;
280
+ refresh_token: z.ZodString;
281
+ client_id: z.ZodString;
282
+ resource: z.ZodOptional<z.ZodString>;
283
+ }, z.core.$strip>], "grant_type">;
284
+ export declare const OAuthTokenResponseSchema: z.ZodObject<{
285
+ access_token: z.ZodString;
286
+ token_type: z.ZodLiteral<"Bearer">;
287
+ expires_in: z.ZodNumber;
288
+ refresh_token: z.ZodString;
289
+ scope: z.ZodString;
290
+ }, z.core.$strip>;
291
+ export declare const OAuthErrorCodeSchema: z.ZodEnum<{
292
+ invalid_request: "invalid_request";
293
+ invalid_client: "invalid_client";
294
+ invalid_grant: "invalid_grant";
295
+ invalid_target: "invalid_target";
296
+ invalid_client_metadata: "invalid_client_metadata";
297
+ invalid_redirect_uri: "invalid_redirect_uri";
298
+ unsupported_grant_type: "unsupported_grant_type";
299
+ unsupported_response_type: "unsupported_response_type";
300
+ access_denied: "access_denied";
301
+ temporarily_unavailable: "temporarily_unavailable";
302
+ }>;
303
+ /** Error body of the registration and token endpoints (RFC 6749, RFC 7591). */
304
+ export declare const OAuthErrorResponseSchema: z.ZodObject<{
305
+ error: z.ZodEnum<{
306
+ invalid_request: "invalid_request";
307
+ invalid_client: "invalid_client";
308
+ invalid_grant: "invalid_grant";
309
+ invalid_target: "invalid_target";
310
+ invalid_client_metadata: "invalid_client_metadata";
311
+ invalid_redirect_uri: "invalid_redirect_uri";
312
+ unsupported_grant_type: "unsupported_grant_type";
313
+ unsupported_response_type: "unsupported_response_type";
314
+ access_denied: "access_denied";
315
+ temporarily_unavailable: "temporarily_unavailable";
316
+ }>;
317
+ error_description: z.ZodString;
318
+ }, z.core.$strip>;
319
+ /** RFC 9728: where the MCP endpoint's authorization server is. */
320
+ export declare const OAuthProtectedResourceMetadataSchema: z.ZodObject<{
321
+ resource: z.ZodString;
322
+ authorization_servers: z.ZodArray<z.ZodString>;
323
+ bearer_methods_supported: z.ZodArray<z.ZodString>;
324
+ scopes_supported: z.ZodArray<z.ZodString>;
325
+ resource_name: z.ZodString;
326
+ }, z.core.$strip>;
327
+ /** RFC 8414: the authorization server's endpoints and capabilities. */
328
+ export declare const OAuthAuthorizationServerMetadataSchema: z.ZodObject<{
329
+ issuer: z.ZodString;
330
+ authorization_endpoint: z.ZodString;
331
+ token_endpoint: z.ZodString;
332
+ registration_endpoint: z.ZodString;
333
+ response_types_supported: z.ZodArray<z.ZodString>;
334
+ grant_types_supported: z.ZodArray<z.ZodString>;
335
+ code_challenge_methods_supported: z.ZodArray<z.ZodString>;
336
+ token_endpoint_auth_methods_supported: z.ZodArray<z.ZodString>;
337
+ scopes_supported: z.ZodArray<z.ZodString>;
338
+ authorization_response_iss_parameter_supported: z.ZodBoolean;
339
+ }, z.core.$strip>;
340
+ /** What the consent page shows about a pending sign-in request. */
341
+ export declare const AdminOrderAssistantAuthorizationSchema: z.ZodObject<{
342
+ id: z.ZodString;
343
+ client_name: z.ZodNullable<z.ZodString>;
344
+ redirect_host: z.ZodString;
345
+ redirect_is_loopback: z.ZodBoolean;
346
+ redirect_is_known: z.ZodBoolean;
347
+ expires_at: z.ZodString;
348
+ }, z.core.$strip>;
349
+ export declare const AdminOrderAssistantAuthorizationResponseSchema: z.ZodObject<{
350
+ authorization: z.ZodObject<{
351
+ id: z.ZodString;
352
+ client_name: z.ZodNullable<z.ZodString>;
353
+ redirect_host: z.ZodString;
354
+ redirect_is_loopback: z.ZodBoolean;
355
+ redirect_is_known: z.ZodBoolean;
356
+ expires_at: z.ZodString;
357
+ }, z.core.$strip>;
358
+ }, z.core.$strip>;
359
+ export declare const DecideOrderAssistantAuthorizationSchema: z.ZodObject<{
360
+ approve: z.ZodBoolean;
361
+ }, z.core.$strict>;
362
+ export declare const DecideOrderAssistantAuthorizationResponseSchema: z.ZodObject<{
363
+ redirect_to: z.ZodString;
364
+ }, z.core.$strip>;
365
+ /** One chatbot an Admin user connected through OAuth. */
366
+ export declare const AdminOrderAssistantConnectionSchema: z.ZodObject<{
367
+ id: z.ZodString;
368
+ client_name: z.ZodNullable<z.ZodString>;
369
+ redirect_host: z.ZodString;
370
+ user_id: z.ZodString;
371
+ user_email: z.ZodNullable<z.ZodString>;
372
+ created_at: z.ZodString;
373
+ last_used_at: z.ZodNullable<z.ZodString>;
374
+ expires_at: z.ZodString;
375
+ }, z.core.$strip>;
376
+ export declare const AdminOrderAssistantConnectionsResponseSchema: z.ZodObject<{
377
+ connections: z.ZodArray<z.ZodObject<{
378
+ id: z.ZodString;
379
+ client_name: z.ZodNullable<z.ZodString>;
380
+ redirect_host: z.ZodString;
381
+ user_id: z.ZodString;
382
+ user_email: z.ZodNullable<z.ZodString>;
383
+ created_at: z.ZodString;
384
+ last_used_at: z.ZodNullable<z.ZodString>;
385
+ expires_at: z.ZodString;
386
+ }, z.core.$strip>>;
387
+ }, z.core.$strip>;
388
+ export declare const DeleteOrderAssistantConnectionResponseSchema: z.ZodObject<{
389
+ id: z.ZodString;
390
+ deleted: z.ZodLiteral<true>;
391
+ }, z.core.$strip>;