@unchainedshop/api 4.7.2 → 4.8.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 +1 -29
- package/lib/api-index.d.ts +0 -1
- package/lib/chat/generateImageHandler.js +5 -6
- package/lib/context.d.ts +0 -1
- package/lib/context.js +3 -8
- package/lib/events.d.ts +0 -2
- package/lib/events.js +0 -2
- package/lib/express/createMCPMiddleware.js +1 -1
- package/lib/express/index.d.ts +9 -6
- package/lib/express/index.js +125 -52
- package/lib/fastify/index.d.ts +9 -6
- package/lib/fastify/index.js +113 -51
- 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/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 +47 -144
- package/lib/mcp/tools/localization/schemas.js +36 -51
- package/lib/mcp/tools/order/handlers/getTopCustomers.d.ts +0 -2
- 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/handlers/getQuotation.d.ts +0 -2
- package/lib/mcp/tools/quotation/handlers/listQuotations.d.ts +0 -2
- package/lib/mcp/tools/quotation/handlers/makeQuotationProposal.d.ts +0 -2
- package/lib/mcp/tools/quotation/handlers/rejectQuotation.d.ts +0 -2
- package/lib/mcp/tools/quotation/handlers/verifyQuotation.d.ts +0 -2
- 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/handlers/countEvents.d.ts +1 -8
- package/lib/mcp/tools/system/handlers/countWork.d.ts +1 -10
- package/lib/mcp/tools/system/handlers/countWork.js +0 -1
- package/lib/mcp/tools/system/handlers/index.d.ts +4 -4
- package/lib/mcp/tools/system/handlers/listEvents.d.ts +1 -12
- package/lib/mcp/tools/system/handlers/listWork.d.ts +1 -14
- package/lib/mcp/tools/system/handlers/listWork.js +0 -1
- 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/handlers/addUserEmail.d.ts +0 -2
- package/lib/mcp/tools/users/handlers/createUser.d.ts +0 -2
- package/lib/mcp/tools/users/handlers/enrollUser.d.ts +0 -2
- package/lib/mcp/tools/users/handlers/getCurrentUser.d.ts +0 -2
- package/lib/mcp/tools/users/handlers/getUser.d.ts +0 -2
- package/lib/mcp/tools/users/handlers/listUsers.d.ts +0 -2
- package/lib/mcp/tools/users/handlers/setUserTags.d.ts +0 -2
- package/lib/mcp/tools/users/handlers/setUserUsername.d.ts +0 -2
- package/lib/mcp/tools/users/handlers/updateUser.d.ts +0 -2
- 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/getNormalizedQuotationDetails.d.ts +0 -2
- package/lib/mcp/utils/getNormalizedUserDetails.d.ts +0 -2
- package/lib/mcp/utils/normalizeMediaUrl.js +1 -1
- package/lib/mcp/utils/sanitizeLocalizationEntityData.d.ts +1 -1
- package/lib/mcp/utils/sharedSchemas.d.ts +39 -28
- package/lib/mcp/utils/sharedSchemas.js +47 -28
- package/lib/mcp/utils/validateIsoCode.d.ts +1 -1
- package/lib/resolvers/mutations/accounts/changePassword.js +1 -4
- package/lib/resolvers/mutations/index.d.ts +6 -1
- package/lib/resolvers/mutations/index.js +12 -2
- package/lib/resolvers/mutations/orders/updateCart.js +1 -7
- package/lib/resolvers/queries/orders/orders.js +2 -2
- package/lib/resolvers/type/index.d.ts +1 -0
- package/lib/resolvers/type/order/order-delivery-pickup-types.d.ts +1 -0
- package/lib/resolvers/type/order/order-delivery-pickup-types.js +7 -0
- package/lib/roles/index.js +0 -1
- package/lib/roles/loggedIn.js +0 -1
- package/lib/schema/mutation.js +44 -6
- package/lib/schema/types/index.js +2 -2
- package/lib/schema/types/order/delivery.js +2 -0
- package/package.json +17 -8
|
@@ -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>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { PaginationSchema, SortingSchema, SearchSchema, DateRangeSchema, } from "../../utils/sharedSchemas.js";
|
|
1
|
+
import { z } from 'zod/v4-mini';
|
|
2
|
+
import { PaginationSchema, SortingSchema, SearchSchema, DateRangeSchema, createManagementSchemaFromValidators, } 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().describe('Configuration key'),
|
|
12
|
-
value: z.string().describe('Configuration value'),
|
|
11
|
+
key: z.string().check(z.describe('Configuration key')),
|
|
12
|
+
value: z.string().check(z.describe('Configuration value')),
|
|
13
13
|
});
|
|
14
14
|
export const actionValidators = {
|
|
15
15
|
LIST: z
|
|
@@ -18,81 +18,56 @@ export const actionValidators = {
|
|
|
18
18
|
...SortingSchema,
|
|
19
19
|
...SearchSchema,
|
|
20
20
|
...DateRangeSchema,
|
|
21
|
-
status:
|
|
22
|
-
userId: z.string().
|
|
23
|
-
productId: z.string().
|
|
21
|
+
status: z.optional(QuotationStatusEnum).check(z.describe('Filter by quotation status')),
|
|
22
|
+
userId: z.optional(z.string()).check(z.describe('Filter by user ID')),
|
|
23
|
+
productId: z.optional(z.string()).check(z.describe('Filter by product ID')),
|
|
24
24
|
})
|
|
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.'),
|
|
25
|
+
.check(z.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
|
|
28
|
+
quotationId: z
|
|
29
|
+
.string()
|
|
30
|
+
.check(z.minLength(1, 'quotationId is required'), z.describe('Quotation ID to retrieve')),
|
|
29
31
|
})
|
|
30
|
-
.describe('Retrieves a single quotation by ID. Requirements: quotationId must be provided.'),
|
|
32
|
+
.check(z.describe('Retrieves a single quotation by ID. Requirements: quotationId must be provided.')),
|
|
31
33
|
COUNT: z
|
|
32
34
|
.object({
|
|
33
35
|
...SearchSchema,
|
|
34
36
|
...DateRangeSchema,
|
|
35
|
-
status:
|
|
36
|
-
userId: z.string().
|
|
37
|
-
productId: z.string().
|
|
37
|
+
status: z.optional(QuotationStatusEnum).check(z.describe('Filter by quotation status')),
|
|
38
|
+
userId: z.optional(z.string()).check(z.describe('Filter by user ID')),
|
|
39
|
+
productId: z.optional(z.string()).check(z.describe('Filter by product ID')),
|
|
38
40
|
})
|
|
39
|
-
.describe('Returns the total count of quotations matching the provided filters. Useful for pagination. Accepts same filter parameters as LIST.'),
|
|
41
|
+
.check(z.describe('Returns the total count of quotations matching the provided filters. Useful for pagination. Accepts same filter parameters as LIST.')),
|
|
40
42
|
VERIFY: z
|
|
41
43
|
.object({
|
|
42
44
|
quotationId: z
|
|
43
45
|
.string()
|
|
44
|
-
.
|
|
45
|
-
.describe('Quotation ID to verify. Must be in REQUESTED status.'),
|
|
46
|
+
.check(z.minLength(1, 'quotationId is required'), z.describe('Quotation ID to verify. Must be in REQUESTED status.')),
|
|
46
47
|
quotationContext: z
|
|
47
|
-
.record(z.any(), z.any())
|
|
48
|
-
.
|
|
49
|
-
.describe('Optional context for verification (e.g., verification notes, approval details)'),
|
|
48
|
+
.optional(z.record(z.any(), z.any()))
|
|
49
|
+
.check(z.describe('Optional context for verification (e.g., verification notes, approval details)')),
|
|
50
50
|
})
|
|
51
|
-
.describe('Verifies a quotation and transitions it from REQUESTED to PROCESSING status. Requirements: quotation must exist AND current status must be REQUESTED.'),
|
|
51
|
+
.check(z.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
|
-
.
|
|
57
|
-
.describe('Quotation ID to create proposal for. Must be in PROCESSING status.'),
|
|
56
|
+
.check(z.minLength(1, 'quotationId is required'), z.describe('Quotation ID to create proposal for. Must be in PROCESSING status.')),
|
|
58
57
|
quotationContext: z
|
|
59
|
-
.record(z.any(), z.any())
|
|
60
|
-
.
|
|
61
|
-
.describe('Optional context for the proposal (e.g., pricing details, terms, delivery estimates)'),
|
|
58
|
+
.optional(z.record(z.any(), z.any()))
|
|
59
|
+
.check(z.describe('Optional context for the proposal (e.g., pricing details, terms, delivery estimates)')),
|
|
62
60
|
})
|
|
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.'),
|
|
61
|
+
.check(z.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.')),
|
|
64
62
|
REJECT: z
|
|
65
63
|
.object({
|
|
66
64
|
quotationId: z
|
|
67
65
|
.string()
|
|
68
|
-
.
|
|
69
|
-
.describe('Quotation ID to reject. Cannot be FULFILLED.'),
|
|
66
|
+
.check(z.minLength(1, 'quotationId is required'), z.describe('Quotation ID to reject. Cannot be FULFILLED.')),
|
|
70
67
|
quotationContext: z
|
|
71
|
-
.record(z.any(), z.any())
|
|
72
|
-
.
|
|
73
|
-
.describe('Optional context for rejection (e.g., reason for rejection, alternative suggestions)'),
|
|
68
|
+
.optional(z.record(z.any(), z.any()))
|
|
69
|
+
.check(z.describe('Optional context for rejection (e.g., reason for rejection, alternative suggestions)')),
|
|
74
70
|
})
|
|
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)'),
|
|
71
|
+
.check(z.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.')),
|
|
97
72
|
};
|
|
98
|
-
export const
|
|
73
|
+
export const QuotationManagementSchema = createManagementSchemaFromValidators(actionValidators);
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import type { Context } from '../../../../context.ts';
|
|
2
|
-
|
|
3
|
-
queryString?: string;
|
|
4
|
-
created?: {
|
|
5
|
-
start?: Date;
|
|
6
|
-
end?: Date;
|
|
7
|
-
};
|
|
8
|
-
types?: string[];
|
|
9
|
-
}
|
|
2
|
+
import type { EventCountOptions } from '../types.ts';
|
|
10
3
|
declare const countEvents: ({ modules }: Context, options?: EventCountOptions) => Promise<{
|
|
11
4
|
count: number;
|
|
12
5
|
}>;
|
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
import { type WorkStatus } from '@unchainedshop/core-worker';
|
|
2
1
|
import type { Context } from '../../../../context.ts';
|
|
3
|
-
|
|
4
|
-
queryString?: string;
|
|
5
|
-
status?: WorkStatus[];
|
|
6
|
-
created?: {
|
|
7
|
-
start?: Date;
|
|
8
|
-
end?: Date;
|
|
9
|
-
};
|
|
10
|
-
types?: string[];
|
|
11
|
-
}
|
|
2
|
+
import type { WorkCountOptions } from '../types.ts';
|
|
12
3
|
declare const countWork: ({ modules }: Context, options?: WorkCountOptions) => Promise<{
|
|
13
4
|
count: number;
|
|
14
5
|
}>;
|
|
@@ -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("../types.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("../types.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("../types.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("../types.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,16 +1,5 @@
|
|
|
1
|
-
import type { SortOption } from '@unchainedshop/utils';
|
|
2
1
|
import type { Context } from '../../../../context.ts';
|
|
3
|
-
|
|
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
|
-
}
|
|
2
|
+
import type { EventListOptions } from '../types.ts';
|
|
14
3
|
declare const listEvents: ({ modules }: Context, options?: EventListOptions) => Promise<{
|
|
15
4
|
events: import("@unchainedshop/core-events").Event[];
|
|
16
5
|
}>;
|
|
@@ -1,18 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type WorkStatus } from '@unchainedshop/core-worker';
|
|
1
|
+
import type { WorkListOptions } from '../types.ts';
|
|
3
2
|
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
|
-
}
|
|
16
3
|
declare const listWork: (context: UnchainedCore, options?: WorkListOptions) => Promise<{
|
|
17
4
|
works: any[];
|
|
18
5
|
}>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { buildObfuscatedFieldsFilter } from '@unchainedshop/utils';
|
|
2
|
-
import {} from '@unchainedshop/core-worker';
|
|
3
2
|
const listWork = async (context, options) => {
|
|
4
3
|
const { modules } = context;
|
|
5
4
|
const removePrivateFieldsFromWork = buildObfuscatedFieldsFilter(context.options.worker?.blacklistedVariables);
|