@unchainedshop/api 4.8.3 → 5.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/acl.js +30 -3
- package/lib/api-index.d.ts +3 -1
- package/lib/chat/generateImageHandler.js +6 -5
- package/lib/context.d.ts +4 -1
- package/lib/context.js +9 -3
- package/lib/events.d.ts +2 -0
- package/lib/events.js +2 -0
- package/lib/express/createMCPMiddleware.js +1 -1
- package/lib/express/index.d.ts +6 -9
- package/lib/express/index.js +52 -125
- package/lib/fastify/index.d.ts +6 -9
- package/lib/fastify/index.js +51 -117
- package/lib/fastify/mcpHandler.js +1 -1
- package/lib/loaders/buildTextMap.js +15 -13
- package/lib/locale-context.d.ts +4 -2
- package/lib/locale-context.js +2 -6
- package/lib/mcp/tools/assortment/assortmentManagement.d.ts +2 -2
- package/lib/mcp/tools/assortment/assortmentManagement.js +2 -2
- package/lib/mcp/tools/assortment/handlers/getAssortment.js +1 -1
- package/lib/mcp/tools/assortment/schemas.d.ts +322 -141
- package/lib/mcp/tools/assortment/schemas.js +179 -96
- package/lib/mcp/tools/filter/filterManagement.d.ts +2 -2
- package/lib/mcp/tools/filter/filterManagement.js +2 -2
- package/lib/mcp/tools/filter/schemas.d.ts +184 -75
- package/lib/mcp/tools/filter/schemas.js +87 -51
- package/lib/mcp/tools/localization/getLocalizationsConfig.d.ts +1 -1
- package/lib/mcp/tools/localization/localizationManagement.d.ts +2 -2
- package/lib/mcp/tools/localization/localizationManagement.js +2 -2
- package/lib/mcp/tools/localization/schemas.d.ts +144 -47
- package/lib/mcp/tools/localization/schemas.js +51 -36
- package/lib/mcp/tools/order/handlers/getTopCustomers.d.ts +2 -0
- package/lib/mcp/tools/order/orderManagement.d.ts +2 -2
- package/lib/mcp/tools/order/orderManagement.js +2 -2
- package/lib/mcp/tools/order/schemas.d.ts +184 -75
- package/lib/mcp/tools/order/schemas.js +113 -51
- package/lib/mcp/tools/product/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 +642 -317
- package/lib/mcp/tools/product/schemas.js +287 -191
- package/lib/mcp/tools/provider/providerManagement.d.ts +2 -2
- package/lib/mcp/tools/provider/providerManagement.js +2 -2
- package/lib/mcp/tools/provider/schemas.d.ts +142 -47
- package/lib/mcp/tools/provider/schemas.js +67 -32
- package/lib/mcp/tools/quotation/handlers/getQuotation.d.ts +2 -0
- package/lib/mcp/tools/quotation/handlers/listQuotations.d.ts +2 -0
- package/lib/mcp/tools/quotation/handlers/makeQuotationProposal.d.ts +2 -0
- package/lib/mcp/tools/quotation/handlers/rejectQuotation.d.ts +2 -0
- package/lib/mcp/tools/quotation/handlers/verifyQuotation.d.ts +2 -0
- package/lib/mcp/tools/quotation/quotationManagement.d.ts +2 -2
- package/lib/mcp/tools/quotation/quotationManagement.js +2 -2
- package/lib/mcp/tools/quotation/schemas.d.ts +111 -40
- package/lib/mcp/tools/quotation/schemas.js +54 -29
- package/lib/mcp/tools/system/handlers/countEvents.d.ts +8 -1
- package/lib/mcp/tools/system/handlers/countWork.d.ts +10 -1
- package/lib/mcp/tools/system/handlers/countWork.js +1 -0
- package/lib/mcp/tools/system/handlers/index.d.ts +4 -4
- package/lib/mcp/tools/system/handlers/listEvents.d.ts +12 -1
- package/lib/mcp/tools/system/handlers/listWork.d.ts +14 -1
- package/lib/mcp/tools/system/handlers/listWork.js +1 -0
- package/lib/mcp/tools/system/schemas.d.ts +179 -84
- package/lib/mcp/tools/system/schemas.js +188 -67
- package/lib/mcp/tools/system/systemManagement.d.ts +1 -1
- package/lib/mcp/tools/system/systemManagement.js +1 -1
- package/lib/mcp/tools/users/handlers/addUserEmail.d.ts +2 -0
- package/lib/mcp/tools/users/handlers/createUser.d.ts +2 -0
- package/lib/mcp/tools/users/handlers/enrollUser.d.ts +2 -0
- package/lib/mcp/tools/users/handlers/getCurrentUser.d.ts +2 -0
- package/lib/mcp/tools/users/handlers/getUser.d.ts +2 -0
- package/lib/mcp/tools/users/handlers/listUsers.d.ts +2 -0
- package/lib/mcp/tools/users/handlers/setUserTags.d.ts +2 -0
- package/lib/mcp/tools/users/handlers/setUserUsername.d.ts +2 -0
- package/lib/mcp/tools/users/handlers/updateUser.d.ts +2 -0
- package/lib/mcp/tools/users/schemas.d.ts +296 -163
- package/lib/mcp/tools/users/schemas.js +152 -71
- package/lib/mcp/tools/users/usersManagement.d.ts +2 -2
- package/lib/mcp/tools/users/usersManagement.js +2 -2
- package/lib/mcp/utils/getNormalizedQuotationDetails.d.ts +2 -0
- package/lib/mcp/utils/getNormalizedUserDetails.d.ts +2 -0
- package/lib/mcp/utils/normalizeMediaUrl.js +1 -1
- package/lib/mcp/utils/sanitizeLocalizationEntityData.d.ts +1 -1
- package/lib/mcp/utils/sharedSchemas.d.ts +28 -39
- package/lib/mcp/utils/sharedSchemas.js +28 -47
- package/lib/mcp/utils/validateIsoCode.d.ts +1 -1
- package/lib/resolvers/mutations/accounts/changePassword.js +1 -2
- package/lib/resolvers/mutations/index.d.ts +1 -6
- package/lib/resolvers/mutations/index.js +2 -12
- package/lib/resolvers/mutations/orders/updateCart.js +7 -1
- package/lib/resolvers/mutations/users/setRoles.d.ts +1 -1
- package/lib/resolvers/mutations/users/setRoles.js +8 -1
- package/lib/resolvers/queries/events/registeredEventTypes.d.ts +1 -1
- package/lib/resolvers/queries/events/registeredEventTypes.js +1 -1
- package/lib/resolvers/queries/index.d.ts +1 -1
- package/lib/resolvers/queries/index.js +1 -1
- package/lib/resolvers/type/index.d.ts +0 -1
- package/lib/resolvers/type/login-method-response-types.js +2 -1
- package/lib/resolvers/type/order/order-delivery-pickup-types.d.ts +0 -1
- package/lib/resolvers/type/order/order-delivery-pickup-types.js +0 -7
- package/lib/resolvers/type/shop-types.js +1 -1
- package/lib/resolvers/type/user-types.js +3 -3
- package/lib/roles/all.js +5 -3
- package/lib/roles/index.d.ts +4 -11
- package/lib/roles/index.js +16 -11
- package/lib/roles/loggedIn.js +2 -0
- package/lib/schema/mutation.js +6 -44
- package/lib/schema/query.js +5 -5
- package/lib/schema/types/index.js +2 -2
- package/lib/schema/types/order/delivery.js +0 -2
- package/package.json +13 -23
|
@@ -1,74 +1,145 @@
|
|
|
1
|
-
import { z } from 'zod
|
|
2
|
-
export declare const QuotationStatusEnum: z.
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const QuotationStatusEnum: z.ZodEnum<{
|
|
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.ZodObject<{
|
|
10
|
+
key: z.ZodString;
|
|
11
|
+
value: z.ZodString;
|
|
12
12
|
}, z.core.$strip>;
|
|
13
13
|
export declare const actionValidators: {
|
|
14
|
-
readonly LIST: z.
|
|
15
|
-
status: z.
|
|
14
|
+
readonly LIST: z.ZodObject<{
|
|
15
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
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.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<{
|
|
31
31
|
[x: string]: string;
|
|
32
32
|
}>;
|
|
33
33
|
}, z.core.$strip>>>;
|
|
34
|
-
limit: z.
|
|
35
|
-
offset: z.
|
|
34
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
35
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
36
36
|
}, z.core.$strip>;
|
|
37
|
-
readonly GET: z.
|
|
38
|
-
quotationId: z.
|
|
37
|
+
readonly GET: z.ZodObject<{
|
|
38
|
+
quotationId: z.ZodString;
|
|
39
39
|
}, z.core.$strip>;
|
|
40
|
-
readonly COUNT: z.
|
|
41
|
-
status: z.
|
|
40
|
+
readonly COUNT: z.ZodObject<{
|
|
41
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
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.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>>;
|
|
54
54
|
}, z.core.$strip>;
|
|
55
|
-
readonly VERIFY: z.
|
|
56
|
-
quotationId: z.
|
|
57
|
-
quotationContext: z.
|
|
55
|
+
readonly VERIFY: z.ZodObject<{
|
|
56
|
+
quotationId: z.ZodString;
|
|
57
|
+
quotationContext: z.ZodOptional<z.ZodRecord<z.ZodAny, z.ZodAny>>;
|
|
58
58
|
}, z.core.$strip>;
|
|
59
|
-
readonly MAKE_PROPOSAL: z.
|
|
60
|
-
quotationId: z.
|
|
61
|
-
quotationContext: z.
|
|
59
|
+
readonly MAKE_PROPOSAL: z.ZodObject<{
|
|
60
|
+
quotationId: z.ZodString;
|
|
61
|
+
quotationContext: z.ZodOptional<z.ZodRecord<z.ZodAny, z.ZodAny>>;
|
|
62
62
|
}, z.core.$strip>;
|
|
63
|
-
readonly REJECT: z.
|
|
64
|
-
quotationId: z.
|
|
65
|
-
quotationContext: z.
|
|
63
|
+
readonly REJECT: z.ZodObject<{
|
|
64
|
+
quotationId: z.ZodString;
|
|
65
|
+
quotationContext: z.ZodOptional<z.ZodRecord<z.ZodAny, z.ZodAny>>;
|
|
66
66
|
}, z.core.$strip>;
|
|
67
67
|
};
|
|
68
68
|
export declare const QuotationManagementSchema: {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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>;
|
|
72
143
|
export type ActionName = keyof typeof actionValidators;
|
|
73
144
|
export type Params<T extends ActionName> = z.infer<(typeof actionValidators)[T]>;
|
|
74
145
|
export type Handler<T extends ActionName> = (context: any, params: Params<T>) => Promise<unknown>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { z } from 'zod
|
|
2
|
-
import { PaginationSchema, SortingSchema, SearchSchema, DateRangeSchema,
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PaginationSchema, SortingSchema, SearchSchema, DateRangeSchema, } from "../../utils/sharedSchemas.js";
|
|
3
3
|
export const QuotationStatusEnum = z.enum([
|
|
4
4
|
'REQUESTED',
|
|
5
5
|
'PROCESSING',
|
|
@@ -8,8 +8,8 @@ export const QuotationStatusEnum = z.enum([
|
|
|
8
8
|
'REJECTED',
|
|
9
9
|
]);
|
|
10
10
|
export const ProductConfigurationInput = z.object({
|
|
11
|
-
key: z.string().
|
|
12
|
-
value: z.string().
|
|
11
|
+
key: z.string().describe('Configuration key'),
|
|
12
|
+
value: z.string().describe('Configuration value'),
|
|
13
13
|
});
|
|
14
14
|
export const actionValidators = {
|
|
15
15
|
LIST: z
|
|
@@ -18,56 +18,81 @@ export const actionValidators = {
|
|
|
18
18
|
...SortingSchema,
|
|
19
19
|
...SearchSchema,
|
|
20
20
|
...DateRangeSchema,
|
|
21
|
-
status:
|
|
22
|
-
userId: z.
|
|
23
|
-
productId: z.
|
|
21
|
+
status: QuotationStatusEnum.optional().describe('Filter by quotation status'),
|
|
22
|
+
userId: z.string().optional().describe('Filter by user ID'),
|
|
23
|
+
productId: z.string().optional().describe('Filter by product ID'),
|
|
24
24
|
})
|
|
25
|
-
.
|
|
25
|
+
.describe('Retrieves a list of quotations with optional filters. Supports pagination (limit/offset), sorting, text search (queryString), status filtering, and filtering by userId or productId.'),
|
|
26
26
|
GET: z
|
|
27
27
|
.object({
|
|
28
|
-
quotationId: z
|
|
29
|
-
.string()
|
|
30
|
-
.check(z.minLength(1, 'quotationId is required'), z.describe('Quotation ID to retrieve')),
|
|
28
|
+
quotationId: z.string().min(1, 'quotationId is required').describe('Quotation ID to retrieve'),
|
|
31
29
|
})
|
|
32
|
-
.
|
|
30
|
+
.describe('Retrieves a single quotation by ID. Requirements: quotationId must be provided.'),
|
|
33
31
|
COUNT: z
|
|
34
32
|
.object({
|
|
35
33
|
...SearchSchema,
|
|
36
34
|
...DateRangeSchema,
|
|
37
|
-
status:
|
|
38
|
-
userId: z.
|
|
39
|
-
productId: z.
|
|
35
|
+
status: QuotationStatusEnum.optional().describe('Filter by quotation status'),
|
|
36
|
+
userId: z.string().optional().describe('Filter by user ID'),
|
|
37
|
+
productId: z.string().optional().describe('Filter by product ID'),
|
|
40
38
|
})
|
|
41
|
-
.
|
|
39
|
+
.describe('Returns the total count of quotations matching the provided filters. Useful for pagination. Accepts same filter parameters as LIST.'),
|
|
42
40
|
VERIFY: z
|
|
43
41
|
.object({
|
|
44
42
|
quotationId: z
|
|
45
43
|
.string()
|
|
46
|
-
.
|
|
44
|
+
.min(1, 'quotationId is required')
|
|
45
|
+
.describe('Quotation ID to verify. Must be in REQUESTED status.'),
|
|
47
46
|
quotationContext: z
|
|
48
|
-
.
|
|
49
|
-
.
|
|
47
|
+
.record(z.any(), z.any())
|
|
48
|
+
.optional()
|
|
49
|
+
.describe('Optional context for verification (e.g., verification notes, approval details)'),
|
|
50
50
|
})
|
|
51
|
-
.
|
|
51
|
+
.describe('Verifies a quotation and transitions it from REQUESTED to PROCESSING status. Requirements: quotation must exist AND current status must be REQUESTED.'),
|
|
52
52
|
MAKE_PROPOSAL: z
|
|
53
53
|
.object({
|
|
54
54
|
quotationId: z
|
|
55
55
|
.string()
|
|
56
|
-
.
|
|
56
|
+
.min(1, 'quotationId is required')
|
|
57
|
+
.describe('Quotation ID to create proposal for. Must be in PROCESSING status.'),
|
|
57
58
|
quotationContext: z
|
|
58
|
-
.
|
|
59
|
-
.
|
|
59
|
+
.record(z.any(), z.any())
|
|
60
|
+
.optional()
|
|
61
|
+
.describe('Optional context for the proposal (e.g., pricing details, terms, delivery estimates)'),
|
|
60
62
|
})
|
|
61
|
-
.
|
|
63
|
+
.describe('Creates a proposal for a quotation and transitions it from PROCESSING to PROPOSED status. Requirements: quotation must exist AND current status must be PROCESSING.'),
|
|
62
64
|
REJECT: z
|
|
63
65
|
.object({
|
|
64
66
|
quotationId: z
|
|
65
67
|
.string()
|
|
66
|
-
.
|
|
68
|
+
.min(1, 'quotationId is required')
|
|
69
|
+
.describe('Quotation ID to reject. Cannot be FULFILLED.'),
|
|
67
70
|
quotationContext: z
|
|
68
|
-
.
|
|
69
|
-
.
|
|
71
|
+
.record(z.any(), z.any())
|
|
72
|
+
.optional()
|
|
73
|
+
.describe('Optional context for rejection (e.g., reason for rejection, alternative suggestions)'),
|
|
70
74
|
})
|
|
71
|
-
.
|
|
75
|
+
.describe('Rejects a quotation and transitions it to REJECTED status. Requirements: quotation must exist AND current status must NOT be FULFILLED (cannot reject completed quotations). Sets rejected timestamp.'),
|
|
76
|
+
};
|
|
77
|
+
export const QuotationManagementSchema = {
|
|
78
|
+
action: z
|
|
79
|
+
.enum(['LIST', 'GET', 'COUNT', 'VERIFY', 'MAKE_PROPOSAL', 'REJECT'])
|
|
80
|
+
.describe('Quotation action: LIST (get quotations with filters), GET (single quotation by ID), COUNT (count quotations), VERIFY (verify a REQUESTED quotation), MAKE_PROPOSAL (create proposal for PROCESSING quotation), REJECT (reject a quotation)'),
|
|
81
|
+
...PaginationSchema,
|
|
82
|
+
...SortingSchema,
|
|
83
|
+
...SearchSchema,
|
|
84
|
+
...DateRangeSchema,
|
|
85
|
+
status: QuotationStatusEnum.optional().describe('Filter by quotation status (LIST & COUNT only)'),
|
|
86
|
+
userId: z.string().optional().describe('Filter by user ID (LIST & COUNT only)'),
|
|
87
|
+
productId: z.string().optional().describe('Product ID (LIST, COUNT only)'),
|
|
88
|
+
quotationId: z.string().optional().describe('Quotation ID (GET, VERIFY, MAKE_PROPOSAL, REJECT only)'),
|
|
89
|
+
configuration: z
|
|
90
|
+
.array(ProductConfigurationInput)
|
|
91
|
+
.optional()
|
|
92
|
+
.describe('Use this to add any additional information for the quotation, it can be how many for when or price or anything a user might want to add'),
|
|
93
|
+
quotationContext: z
|
|
94
|
+
.record(z.any(), z.any())
|
|
95
|
+
.optional()
|
|
96
|
+
.describe('Context object (VERIFY, MAKE_PROPOSAL, REJECT only)'),
|
|
72
97
|
};
|
|
73
|
-
export const
|
|
98
|
+
export const QuotationManagementZodSchema = z.object(QuotationManagementSchema);
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import type { Context } from '../../../../context.ts';
|
|
2
|
-
|
|
2
|
+
export interface EventCountOptions {
|
|
3
|
+
queryString?: string;
|
|
4
|
+
created?: {
|
|
5
|
+
start?: Date;
|
|
6
|
+
end?: Date;
|
|
7
|
+
};
|
|
8
|
+
types?: string[];
|
|
9
|
+
}
|
|
3
10
|
declare const countEvents: ({ modules }: Context, options?: EventCountOptions) => Promise<{
|
|
4
11
|
count: number;
|
|
5
12
|
}>;
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
+
import { type WorkStatus } from '@unchainedshop/core-worker';
|
|
1
2
|
import type { Context } from '../../../../context.ts';
|
|
2
|
-
|
|
3
|
+
export interface WorkCountOptions {
|
|
4
|
+
queryString?: string;
|
|
5
|
+
status?: WorkStatus[];
|
|
6
|
+
created?: {
|
|
7
|
+
start?: Date;
|
|
8
|
+
end?: Date;
|
|
9
|
+
};
|
|
10
|
+
types?: string[];
|
|
11
|
+
}
|
|
3
12
|
declare const countWork: ({ modules }: Context, options?: WorkCountOptions) => Promise<{
|
|
4
13
|
count: number;
|
|
5
14
|
}>;
|
|
@@ -22,10 +22,10 @@ declare const _default: {
|
|
|
22
22
|
WORKER_GET: (context: import("../../../../context.ts").Context, { workId }: import("../schemas.ts").Params<"WORKER_GET">) => Promise<{
|
|
23
23
|
work: any;
|
|
24
24
|
}>;
|
|
25
|
-
WORKER_LIST: (context: import("@unchainedshop/core").UnchainedCore, options?: import("
|
|
25
|
+
WORKER_LIST: (context: import("@unchainedshop/core").UnchainedCore, options?: import("./listWork.ts").WorkListOptions) => Promise<{
|
|
26
26
|
works: any[];
|
|
27
27
|
}>;
|
|
28
|
-
WORKER_COUNT: ({ modules }: import("../../../../context.ts").Context, options?: import("
|
|
28
|
+
WORKER_COUNT: ({ modules }: import("../../../../context.ts").Context, options?: import("./countWork.ts").WorkCountOptions) => Promise<{
|
|
29
29
|
count: number;
|
|
30
30
|
}>;
|
|
31
31
|
WORKER_FINISH_WORK: (context: import("../../../../context.ts").Context, options: import("../schemas.ts").Params<"WORKER_FINISH_WORK">) => Promise<{
|
|
@@ -47,10 +47,10 @@ declare const _default: {
|
|
|
47
47
|
EVENT_GET: ({ modules }: import("../../../../context.ts").Context, { eventId }: import("../schemas.ts").Params<"EVENT_GET">) => Promise<{
|
|
48
48
|
event: import("@unchainedshop/core-events").Event | null;
|
|
49
49
|
}>;
|
|
50
|
-
EVENT_LIST: ({ modules }: import("../../../../context.ts").Context, options?: import("
|
|
50
|
+
EVENT_LIST: ({ modules }: import("../../../../context.ts").Context, options?: import("./listEvents.ts").EventListOptions) => Promise<{
|
|
51
51
|
events: import("@unchainedshop/core-events").Event[];
|
|
52
52
|
}>;
|
|
53
|
-
EVENT_COUNT: ({ modules }: import("../../../../context.ts").Context, options?: import("
|
|
53
|
+
EVENT_COUNT: ({ modules }: import("../../../../context.ts").Context, options?: import("./countEvents.ts").EventCountOptions) => Promise<{
|
|
54
54
|
count: number;
|
|
55
55
|
}>;
|
|
56
56
|
EVENT_STATISTICS: ({ modules }: import("../../../../context.ts").Context, options: import("../schemas.ts").Params<"EVENT_STATISTICS">) => Promise<{
|
|
@@ -1,5 +1,16 @@
|
|
|
1
|
+
import type { SortOption } from '@unchainedshop/utils';
|
|
1
2
|
import type { Context } from '../../../../context.ts';
|
|
2
|
-
|
|
3
|
+
export interface EventListOptions {
|
|
4
|
+
limit?: number;
|
|
5
|
+
offset?: number;
|
|
6
|
+
queryString?: string;
|
|
7
|
+
types?: string[];
|
|
8
|
+
sort?: SortOption[];
|
|
9
|
+
created?: {
|
|
10
|
+
start?: Date;
|
|
11
|
+
end?: Date;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
3
14
|
declare const listEvents: ({ modules }: Context, options?: EventListOptions) => Promise<{
|
|
4
15
|
events: import("@unchainedshop/core-events").Event[];
|
|
5
16
|
}>;
|
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type SortOption } from '@unchainedshop/utils';
|
|
2
|
+
import { type WorkStatus } from '@unchainedshop/core-worker';
|
|
2
3
|
import type { UnchainedCore } from '@unchainedshop/core';
|
|
4
|
+
export interface WorkListOptions {
|
|
5
|
+
limit?: number;
|
|
6
|
+
offset?: number;
|
|
7
|
+
queryString?: string;
|
|
8
|
+
status: WorkStatus[];
|
|
9
|
+
types?: string[];
|
|
10
|
+
sort?: SortOption[];
|
|
11
|
+
created?: {
|
|
12
|
+
start?: Date;
|
|
13
|
+
end?: Date;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
3
16
|
declare const listWork: (context: UnchainedCore, options?: WorkListOptions) => Promise<{
|
|
4
17
|
works: any[];
|
|
5
18
|
}>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { buildObfuscatedFieldsFilter } from '@unchainedshop/utils';
|
|
2
|
+
import {} from '@unchainedshop/core-worker';
|
|
2
3
|
const listWork = async (context, options) => {
|
|
3
4
|
const { modules } = context;
|
|
4
5
|
const removePrivateFieldsFromWork = buildObfuscatedFieldsFilter(context.options.worker?.blacklistedVariables);
|