@unchainedshop/api 4.8.24 → 4.8.26
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/errors.d.ts +1 -0
- package/lib/errors.js +1 -0
- package/lib/mcp/tools/assortment/schemas.d.ts +13 -13
- package/lib/mcp/tools/filter/schemas.d.ts +2 -2
- package/lib/mcp/tools/localization/schemas.d.ts +5 -5
- package/lib/mcp/tools/order/schemas.d.ts +7 -7
- package/lib/mcp/tools/product/schemas.d.ts +44 -44
- package/lib/mcp/tools/quotation/schemas.d.ts +2 -2
- package/lib/mcp/tools/system/handlers/allocateWork.js +2 -2
- package/lib/mcp/tools/system/schemas.d.ts +6 -6
- package/lib/mcp/tools/users/schemas.d.ts +10 -10
- package/lib/mcp/utils/sharedSchemas.d.ts +4 -4
- package/lib/resolvers/mutations/orders/checkoutCart.js +1 -1
- package/lib/resolvers/mutations/users/removeUser.js +9 -2
- package/lib/resolvers/mutations/users/setRoles.js +9 -2
- package/lib/resolvers/mutations/worker/allocateWork.d.ts +1 -1
- package/lib/resolvers/mutations/worker/allocateWork.js +4 -3
- package/package.json +1 -1
- package/lib/adminUiPlugins.d.ts +0 -97
- package/lib/adminUiPlugins.js +0 -164
- package/lib/auth.d.ts +0 -36
- package/lib/auth.js +0 -167
- package/lib/express/mountPluginRoutes.d.ts +0 -3
- package/lib/express/mountPluginRoutes.js +0 -59
- package/lib/express/mountRoutes.d.ts +0 -3
- package/lib/express/mountRoutes.js +0 -57
- package/lib/fastify/mountPluginRoutes.d.ts +0 -3
- package/lib/fastify/mountPluginRoutes.js +0 -62
- package/lib/fastify/mountRoutes.d.ts +0 -3
- package/lib/fastify/mountRoutes.js +0 -60
- package/lib/handlers/createBackchannelLogoutHandler.d.ts +0 -4
- package/lib/handlers/createBackchannelLogoutHandler.js +0 -170
- package/lib/middleware/createAuthMiddleware.d.ts +0 -29
- package/lib/middleware/createAuthMiddleware.js +0 -89
- package/lib/resolvers/mutations/accounts/logoutAllSessions.d.ts +0 -4
- package/lib/resolvers/mutations/accounts/logoutAllSessions.js +0 -11
- package/lib/resolvers/type/order/order-payment-base.d.ts +0 -7
- package/lib/resolvers/type/order/order-payment-base.js +0 -14
- package/lib/schema/types/common.d.ts +0 -2
- package/lib/schema/types/common.js +0 -12
- package/lib/utils/mapServiceError.d.ts +0 -1
- package/lib/utils/mapServiceError.js +0 -59
- package/lib/utils/maskError.d.ts +0 -1
- package/lib/utils/maskError.js +0 -22
package/lib/errors.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export declare const CurrencyNotFoundError: any;
|
|
|
19
19
|
export declare const DeliverProviderNotFoundError: any;
|
|
20
20
|
export declare const LanguageNotFoundError: any;
|
|
21
21
|
export declare const UserNotFoundError: any;
|
|
22
|
+
export declare const LastAdminError: any;
|
|
22
23
|
export declare const UserWebAuthnCredentialsNotFoundError: any;
|
|
23
24
|
export declare const WebAuthnDisabledError: any;
|
|
24
25
|
export declare const UserWeb3AddressNotFoundError: any;
|
package/lib/errors.js
CHANGED
|
@@ -29,6 +29,7 @@ export const CurrencyNotFoundError = createError('CurrencyNotFoundError', 'Curre
|
|
|
29
29
|
export const DeliverProviderNotFoundError = createError('DeliverProviderNotFoundError', 'Delivery provider not found');
|
|
30
30
|
export const LanguageNotFoundError = createError('LanguageNotFoundError', 'Language not found');
|
|
31
31
|
export const UserNotFoundError = createError('UserNotFoundError', 'User not found');
|
|
32
|
+
export const LastAdminError = createError('LastAdminError', 'At least one active administrator is required. Assign another administrator before removing this account or revoking its admin role.');
|
|
32
33
|
export const UserWebAuthnCredentialsNotFoundError = createError('UserWebAuthnCredentialsNotFoundError', 'User WebAuth Credentials not found');
|
|
33
34
|
export const WebAuthnDisabledError = createError('WebAuthnDisabledError', 'WebAuthn disabled');
|
|
34
35
|
export const UserWeb3AddressNotFoundError = createError('UserWeb3AddressNotFoundError', 'Web3 Account not found for User');
|
|
@@ -16,7 +16,7 @@ export declare const AssortmentSchema: z.ZodMiniObject<{
|
|
|
16
16
|
isRoot: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
17
17
|
isActive: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
18
18
|
tags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
19
|
-
sequence: z.ZodMiniOptional<z.
|
|
19
|
+
sequence: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
20
20
|
meta: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniAny, z.ZodMiniAny>>;
|
|
21
21
|
}, z.core.$strip>;
|
|
22
22
|
export declare const actionValidators: {
|
|
@@ -25,7 +25,7 @@ export declare const actionValidators: {
|
|
|
25
25
|
isRoot: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
26
26
|
isActive: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
27
27
|
tags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
28
|
-
sequence: z.ZodMiniOptional<z.
|
|
28
|
+
sequence: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
29
29
|
meta: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniAny, z.ZodMiniAny>>;
|
|
30
30
|
}, z.core.$strip>;
|
|
31
31
|
texts: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
|
|
@@ -42,7 +42,7 @@ export declare const actionValidators: {
|
|
|
42
42
|
isRoot: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
43
43
|
isActive: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
44
44
|
tags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
45
|
-
sequence: z.ZodMiniOptional<z.
|
|
45
|
+
sequence: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
46
46
|
meta: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniAny, z.ZodMiniAny>>;
|
|
47
47
|
}, z.core.$strip>;
|
|
48
48
|
}, z.core.$strip>;
|
|
@@ -65,8 +65,8 @@ export declare const actionValidators: {
|
|
|
65
65
|
[x: string]: string;
|
|
66
66
|
}>;
|
|
67
67
|
}, z.core.$strip>>>;
|
|
68
|
-
limit: z.ZodMiniOptional<z.
|
|
69
|
-
offset: z.ZodMiniOptional<z.
|
|
68
|
+
limit: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
69
|
+
offset: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
70
70
|
}, z.core.$strip>;
|
|
71
71
|
readonly COUNT: z.ZodMiniObject<{
|
|
72
72
|
tags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
@@ -93,12 +93,12 @@ export declare const actionValidators: {
|
|
|
93
93
|
readonly REORDER_MEDIA: z.ZodMiniObject<{
|
|
94
94
|
sortKeys: z.ZodMiniArray<z.ZodMiniObject<{
|
|
95
95
|
assortmentMediaId: z.ZodMiniString<string>;
|
|
96
|
-
sortKey: z.
|
|
96
|
+
sortKey: z.ZodMiniInt;
|
|
97
97
|
}, z.core.$strip>>;
|
|
98
98
|
}, z.core.$strip>;
|
|
99
99
|
readonly GET_MEDIA: z.ZodMiniObject<{
|
|
100
|
-
limit: z.ZodMiniOptional<z.
|
|
101
|
-
offset: z.ZodMiniOptional<z.
|
|
100
|
+
limit: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
101
|
+
offset: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
102
102
|
assortmentId: z.ZodMiniString<string>;
|
|
103
103
|
tags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
104
104
|
}, z.core.$strip>;
|
|
@@ -124,7 +124,7 @@ export declare const actionValidators: {
|
|
|
124
124
|
readonly REORDER_PRODUCTS: z.ZodMiniObject<{
|
|
125
125
|
sortKeys: z.ZodMiniArray<z.ZodMiniObject<{
|
|
126
126
|
assortmentProductId: z.ZodMiniString<string>;
|
|
127
|
-
sortKey: z.
|
|
127
|
+
sortKey: z.ZodMiniInt;
|
|
128
128
|
}, z.core.$strip>>;
|
|
129
129
|
}, z.core.$strip>;
|
|
130
130
|
readonly ADD_FILTER: z.ZodMiniObject<{
|
|
@@ -141,7 +141,7 @@ export declare const actionValidators: {
|
|
|
141
141
|
readonly REORDER_FILTERS: z.ZodMiniObject<{
|
|
142
142
|
sortKeys: z.ZodMiniArray<z.ZodMiniObject<{
|
|
143
143
|
assortmentFilterId: z.ZodMiniString<string>;
|
|
144
|
-
sortKey: z.
|
|
144
|
+
sortKey: z.ZodMiniInt;
|
|
145
145
|
}, z.core.$strip>>;
|
|
146
146
|
}, z.core.$strip>;
|
|
147
147
|
readonly ADD_LINK: z.ZodMiniObject<{
|
|
@@ -158,7 +158,7 @@ export declare const actionValidators: {
|
|
|
158
158
|
readonly REORDER_LINKS: z.ZodMiniObject<{
|
|
159
159
|
sortKeys: z.ZodMiniArray<z.ZodMiniObject<{
|
|
160
160
|
assortmentLinkId: z.ZodMiniString<string>;
|
|
161
|
-
sortKey: z.
|
|
161
|
+
sortKey: z.ZodMiniInt;
|
|
162
162
|
}, z.core.$strip>>;
|
|
163
163
|
}, z.core.$strip>;
|
|
164
164
|
readonly GET_CHILDREN: z.ZodMiniObject<{
|
|
@@ -168,8 +168,8 @@ export declare const actionValidators: {
|
|
|
168
168
|
readonly SEARCH_PRODUCTS: z.ZodMiniObject<{
|
|
169
169
|
queryString: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
170
170
|
includeInactive: z.ZodMiniDefault<z.ZodMiniBoolean<boolean>>;
|
|
171
|
-
limit: z.ZodMiniOptional<z.
|
|
172
|
-
offset: z.ZodMiniOptional<z.
|
|
171
|
+
limit: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
172
|
+
offset: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
173
173
|
assortmentId: z.ZodMiniString<string>;
|
|
174
174
|
}, z.core.$strip>;
|
|
175
175
|
readonly GET_TEXTS: z.ZodMiniObject<{
|
|
@@ -75,8 +75,8 @@ export declare const actionValidators: {
|
|
|
75
75
|
[x: string]: string;
|
|
76
76
|
}>;
|
|
77
77
|
}, z.core.$strip>>>;
|
|
78
|
-
limit: z.ZodMiniOptional<z.
|
|
79
|
-
offset: z.ZodMiniOptional<z.
|
|
78
|
+
limit: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
79
|
+
offset: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
80
80
|
}, z.core.$strip>;
|
|
81
81
|
readonly COUNT: z.ZodMiniObject<{
|
|
82
82
|
queryString: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
@@ -11,7 +11,7 @@ export declare const LocalizationEntitySchema: z.ZodMiniObject<{
|
|
|
11
11
|
isActive: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
12
12
|
defaultCurrencyCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
13
13
|
contractAddress: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
14
|
-
decimals: z.ZodMiniOptional<z.
|
|
14
|
+
decimals: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
15
15
|
}, z.core.$strip>;
|
|
16
16
|
export declare const actionValidators: {
|
|
17
17
|
readonly CREATE: z.ZodMiniObject<{
|
|
@@ -24,7 +24,7 @@ export declare const actionValidators: {
|
|
|
24
24
|
isActive: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
25
25
|
defaultCurrencyCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
26
26
|
contractAddress: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
27
|
-
decimals: z.ZodMiniOptional<z.
|
|
27
|
+
decimals: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
28
28
|
isoCode: z.ZodMiniString<string>;
|
|
29
29
|
}, z.core.$strip>;
|
|
30
30
|
}, z.core.$strip>;
|
|
@@ -40,7 +40,7 @@ export declare const actionValidators: {
|
|
|
40
40
|
isActive: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
41
41
|
defaultCurrencyCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
42
42
|
contractAddress: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
43
|
-
decimals: z.ZodMiniOptional<z.
|
|
43
|
+
decimals: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
44
44
|
}, z.core.$strip>;
|
|
45
45
|
}, z.core.$strip>;
|
|
46
46
|
readonly REMOVE: z.ZodMiniObject<{
|
|
@@ -68,8 +68,8 @@ export declare const actionValidators: {
|
|
|
68
68
|
[x: string]: string;
|
|
69
69
|
}>;
|
|
70
70
|
}, z.core.$strip>>>;
|
|
71
|
-
limit: z.ZodMiniOptional<z.
|
|
72
|
-
offset: z.ZodMiniOptional<z.
|
|
71
|
+
limit: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
72
|
+
offset: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
73
73
|
localizationType: z.ZodMiniEnum<{
|
|
74
74
|
COUNTRY: "COUNTRY";
|
|
75
75
|
CURRENCY: "CURRENCY";
|
|
@@ -65,11 +65,11 @@ export declare const actionValidators: {
|
|
|
65
65
|
[x: string]: string;
|
|
66
66
|
}>;
|
|
67
67
|
}, z.core.$strip>>>;
|
|
68
|
-
limit: z.ZodMiniOptional<z.
|
|
69
|
-
offset: z.ZodMiniOptional<z.
|
|
68
|
+
limit: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
69
|
+
offset: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
70
70
|
}, z.core.$strip>;
|
|
71
71
|
readonly SALES_SUMMARY: z.ZodMiniObject<{
|
|
72
|
-
days: z.ZodMiniOptional<z.
|
|
72
|
+
days: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
73
73
|
paymentProviderIds: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
74
74
|
deliveryProviderIds: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
75
75
|
status: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniEnum<{
|
|
@@ -99,14 +99,14 @@ export declare const actionValidators: {
|
|
|
99
99
|
customerStatus: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
100
100
|
from: z.ZodMiniOptional<z.iso.ZodMiniISODateTime>;
|
|
101
101
|
to: z.ZodMiniOptional<z.iso.ZodMiniISODateTime>;
|
|
102
|
-
limit: z.ZodMiniOptional<z.
|
|
103
|
-
offset: z.ZodMiniOptional<z.
|
|
102
|
+
limit: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
103
|
+
offset: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
104
104
|
}, z.core.$strip>;
|
|
105
105
|
readonly TOP_PRODUCTS: z.ZodMiniObject<{
|
|
106
106
|
from: z.ZodMiniOptional<z.iso.ZodMiniISODateTime>;
|
|
107
107
|
to: z.ZodMiniOptional<z.iso.ZodMiniISODateTime>;
|
|
108
|
-
limit: z.ZodMiniOptional<z.
|
|
109
|
-
offset: z.ZodMiniOptional<z.
|
|
108
|
+
limit: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
109
|
+
offset: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
110
110
|
}, z.core.$strip>;
|
|
111
111
|
readonly GET_CART: z.ZodMiniObject<{
|
|
112
112
|
userId: z.ZodMiniString<string>;
|
|
@@ -25,7 +25,7 @@ export declare const UpdateProductPlanInputSchema: z.ZodMiniObject<{
|
|
|
25
25
|
MONTHS: "MONTHS";
|
|
26
26
|
YEARS: "YEARS";
|
|
27
27
|
}>;
|
|
28
|
-
billingIntervalCount: z.
|
|
28
|
+
billingIntervalCount: z.ZodMiniInt;
|
|
29
29
|
trialInterval: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
30
30
|
HOURS: "HOURS";
|
|
31
31
|
DAYS: "DAYS";
|
|
@@ -33,7 +33,7 @@ export declare const UpdateProductPlanInputSchema: z.ZodMiniObject<{
|
|
|
33
33
|
MONTHS: "MONTHS";
|
|
34
34
|
YEARS: "YEARS";
|
|
35
35
|
}>>;
|
|
36
|
-
trialIntervalCount: z.ZodMiniOptional<z.
|
|
36
|
+
trialIntervalCount: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
37
37
|
}, z.core.$strip>;
|
|
38
38
|
export declare const ProductTextInputSchema: z.ZodMiniObject<{
|
|
39
39
|
locale: z.ZodMiniString<string>;
|
|
@@ -64,7 +64,7 @@ export declare const ProductSchema: z.ZodMiniObject<{
|
|
|
64
64
|
[x: string]: string;
|
|
65
65
|
}>>;
|
|
66
66
|
tags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
67
|
-
sequence: z.ZodMiniOptional<z.
|
|
67
|
+
sequence: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
68
68
|
meta: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniAny, z.ZodMiniAny>>;
|
|
69
69
|
plan: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
70
70
|
usageCalculationType: z.ZodMiniEnum<{
|
|
@@ -78,7 +78,7 @@ export declare const ProductSchema: z.ZodMiniObject<{
|
|
|
78
78
|
MONTHS: "MONTHS";
|
|
79
79
|
YEARS: "YEARS";
|
|
80
80
|
}>;
|
|
81
|
-
billingIntervalCount: z.
|
|
81
|
+
billingIntervalCount: z.ZodMiniInt;
|
|
82
82
|
trialInterval: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
83
83
|
HOURS: "HOURS";
|
|
84
84
|
DAYS: "DAYS";
|
|
@@ -86,29 +86,29 @@ export declare const ProductSchema: z.ZodMiniObject<{
|
|
|
86
86
|
MONTHS: "MONTHS";
|
|
87
87
|
YEARS: "YEARS";
|
|
88
88
|
}>>;
|
|
89
|
-
trialIntervalCount: z.ZodMiniOptional<z.
|
|
89
|
+
trialIntervalCount: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
90
90
|
}, z.core.$strip>>;
|
|
91
91
|
warehousing: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
92
92
|
sku: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
93
93
|
baseUnit: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
94
94
|
}, z.core.$strip>>;
|
|
95
95
|
supply: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
96
|
-
weightInGram: z.ZodMiniOptional<z.
|
|
97
|
-
heightInMillimeters: z.ZodMiniOptional<z.
|
|
98
|
-
lengthInMillimeters: z.ZodMiniOptional<z.
|
|
99
|
-
widthInMillimeters: z.ZodMiniOptional<z.
|
|
96
|
+
weightInGram: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
97
|
+
heightInMillimeters: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
98
|
+
lengthInMillimeters: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
99
|
+
widthInMillimeters: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
100
100
|
}, z.core.$strip>>;
|
|
101
101
|
tokenization: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
102
102
|
contractAddress: z.ZodMiniString<string>;
|
|
103
103
|
contractStandard: z.ZodMiniString<string>;
|
|
104
104
|
tokenId: z.ZodMiniString<string>;
|
|
105
|
-
supply: z.
|
|
105
|
+
supply: z.ZodMiniInt;
|
|
106
106
|
ercMetadataProperties: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniAny, z.ZodMiniAny>>;
|
|
107
107
|
}, z.core.$strip>>;
|
|
108
108
|
commerce: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
109
109
|
pricing: z.ZodMiniArray<z.ZodMiniObject<{
|
|
110
|
-
amount: z.
|
|
111
|
-
maxQuantity: z.ZodMiniOptional<z.
|
|
110
|
+
amount: z.ZodMiniInt;
|
|
111
|
+
maxQuantity: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
112
112
|
isTaxable: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
113
113
|
isNetPrice: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
114
114
|
currencyCode: z.ZodMiniString<string>;
|
|
@@ -120,7 +120,7 @@ export declare const actionValidators: {
|
|
|
120
120
|
readonly CREATE: z.ZodMiniObject<{
|
|
121
121
|
product: z.ZodMiniObject<{
|
|
122
122
|
tags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
123
|
-
sequence: z.ZodMiniOptional<z.
|
|
123
|
+
sequence: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
124
124
|
meta: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniAny, z.ZodMiniAny>>;
|
|
125
125
|
plan: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
126
126
|
usageCalculationType: z.ZodMiniEnum<{
|
|
@@ -134,7 +134,7 @@ export declare const actionValidators: {
|
|
|
134
134
|
MONTHS: "MONTHS";
|
|
135
135
|
YEARS: "YEARS";
|
|
136
136
|
}>;
|
|
137
|
-
billingIntervalCount: z.
|
|
137
|
+
billingIntervalCount: z.ZodMiniInt;
|
|
138
138
|
trialInterval: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
139
139
|
HOURS: "HOURS";
|
|
140
140
|
DAYS: "DAYS";
|
|
@@ -142,29 +142,29 @@ export declare const actionValidators: {
|
|
|
142
142
|
MONTHS: "MONTHS";
|
|
143
143
|
YEARS: "YEARS";
|
|
144
144
|
}>>;
|
|
145
|
-
trialIntervalCount: z.ZodMiniOptional<z.
|
|
145
|
+
trialIntervalCount: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
146
146
|
}, z.core.$strip>>;
|
|
147
147
|
warehousing: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
148
148
|
sku: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
149
149
|
baseUnit: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
150
150
|
}, z.core.$strip>>;
|
|
151
151
|
supply: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
152
|
-
weightInGram: z.ZodMiniOptional<z.
|
|
153
|
-
heightInMillimeters: z.ZodMiniOptional<z.
|
|
154
|
-
lengthInMillimeters: z.ZodMiniOptional<z.
|
|
155
|
-
widthInMillimeters: z.ZodMiniOptional<z.
|
|
152
|
+
weightInGram: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
153
|
+
heightInMillimeters: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
154
|
+
lengthInMillimeters: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
155
|
+
widthInMillimeters: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
156
156
|
}, z.core.$strip>>;
|
|
157
157
|
tokenization: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
158
158
|
contractAddress: z.ZodMiniString<string>;
|
|
159
159
|
contractStandard: z.ZodMiniString<string>;
|
|
160
160
|
tokenId: z.ZodMiniString<string>;
|
|
161
|
-
supply: z.
|
|
161
|
+
supply: z.ZodMiniInt;
|
|
162
162
|
ercMetadataProperties: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniAny, z.ZodMiniAny>>;
|
|
163
163
|
}, z.core.$strip>>;
|
|
164
164
|
commerce: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
165
165
|
pricing: z.ZodMiniArray<z.ZodMiniObject<{
|
|
166
|
-
amount: z.
|
|
167
|
-
maxQuantity: z.ZodMiniOptional<z.
|
|
166
|
+
amount: z.ZodMiniInt;
|
|
167
|
+
maxQuantity: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
168
168
|
isTaxable: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
169
169
|
isNetPrice: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
170
170
|
currencyCode: z.ZodMiniString<string>;
|
|
@@ -193,7 +193,7 @@ export declare const actionValidators: {
|
|
|
193
193
|
[x: string]: string;
|
|
194
194
|
}>>;
|
|
195
195
|
tags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
196
|
-
sequence: z.ZodMiniOptional<z.
|
|
196
|
+
sequence: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
197
197
|
meta: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniAny, z.ZodMiniAny>>;
|
|
198
198
|
plan: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
199
199
|
usageCalculationType: z.ZodMiniEnum<{
|
|
@@ -207,7 +207,7 @@ export declare const actionValidators: {
|
|
|
207
207
|
MONTHS: "MONTHS";
|
|
208
208
|
YEARS: "YEARS";
|
|
209
209
|
}>;
|
|
210
|
-
billingIntervalCount: z.
|
|
210
|
+
billingIntervalCount: z.ZodMiniInt;
|
|
211
211
|
trialInterval: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
212
212
|
HOURS: "HOURS";
|
|
213
213
|
DAYS: "DAYS";
|
|
@@ -215,29 +215,29 @@ export declare const actionValidators: {
|
|
|
215
215
|
MONTHS: "MONTHS";
|
|
216
216
|
YEARS: "YEARS";
|
|
217
217
|
}>>;
|
|
218
|
-
trialIntervalCount: z.ZodMiniOptional<z.
|
|
218
|
+
trialIntervalCount: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
219
219
|
}, z.core.$strip>>;
|
|
220
220
|
warehousing: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
221
221
|
sku: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
222
222
|
baseUnit: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
223
223
|
}, z.core.$strip>>;
|
|
224
224
|
supply: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
225
|
-
weightInGram: z.ZodMiniOptional<z.
|
|
226
|
-
heightInMillimeters: z.ZodMiniOptional<z.
|
|
227
|
-
lengthInMillimeters: z.ZodMiniOptional<z.
|
|
228
|
-
widthInMillimeters: z.ZodMiniOptional<z.
|
|
225
|
+
weightInGram: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
226
|
+
heightInMillimeters: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
227
|
+
lengthInMillimeters: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
228
|
+
widthInMillimeters: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
229
229
|
}, z.core.$strip>>;
|
|
230
230
|
tokenization: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
231
231
|
contractAddress: z.ZodMiniString<string>;
|
|
232
232
|
contractStandard: z.ZodMiniString<string>;
|
|
233
233
|
tokenId: z.ZodMiniString<string>;
|
|
234
|
-
supply: z.
|
|
234
|
+
supply: z.ZodMiniInt;
|
|
235
235
|
ercMetadataProperties: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniAny, z.ZodMiniAny>>;
|
|
236
236
|
}, z.core.$strip>>;
|
|
237
237
|
commerce: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
238
238
|
pricing: z.ZodMiniArray<z.ZodMiniObject<{
|
|
239
|
-
amount: z.
|
|
240
|
-
maxQuantity: z.ZodMiniOptional<z.
|
|
239
|
+
amount: z.ZodMiniInt;
|
|
240
|
+
maxQuantity: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
241
241
|
isTaxable: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
242
242
|
isNetPrice: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
243
243
|
currencyCode: z.ZodMiniString<string>;
|
|
@@ -266,8 +266,8 @@ export declare const actionValidators: {
|
|
|
266
266
|
[x: string]: string;
|
|
267
267
|
}>;
|
|
268
268
|
}, z.core.$strip>>>;
|
|
269
|
-
limit: z.ZodMiniOptional<z.
|
|
270
|
-
offset: z.ZodMiniOptional<z.
|
|
269
|
+
limit: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
270
|
+
offset: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
271
271
|
}, z.core.$strip>;
|
|
272
272
|
readonly COUNT: z.ZodMiniObject<{
|
|
273
273
|
tags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
@@ -294,12 +294,12 @@ export declare const actionValidators: {
|
|
|
294
294
|
readonly REORDER_MEDIA: z.ZodMiniObject<{
|
|
295
295
|
sortKeys: z.ZodMiniArray<z.ZodMiniObject<{
|
|
296
296
|
productMediaId: z.ZodMiniString<string>;
|
|
297
|
-
sortKey: z.
|
|
297
|
+
sortKey: z.ZodMiniInt;
|
|
298
298
|
}, z.core.$strip>>;
|
|
299
299
|
}, z.core.$strip>;
|
|
300
300
|
readonly GET_MEDIA: z.ZodMiniObject<{
|
|
301
|
-
limit: z.ZodMiniOptional<z.
|
|
302
|
-
offset: z.ZodMiniOptional<z.
|
|
301
|
+
limit: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
302
|
+
offset: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
303
303
|
productId: z.ZodMiniString<string>;
|
|
304
304
|
tags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
305
305
|
}, z.core.$strip>;
|
|
@@ -380,18 +380,18 @@ export declare const actionValidators: {
|
|
|
380
380
|
readonly ADD_BUNDLE_ITEM: z.ZodMiniObject<{
|
|
381
381
|
bundleId: z.ZodMiniString<string>;
|
|
382
382
|
bundleProductId: z.ZodMiniString<string>;
|
|
383
|
-
quantity: z.ZodMiniDefault<z.
|
|
383
|
+
quantity: z.ZodMiniDefault<z.ZodMiniInt>;
|
|
384
384
|
}, z.core.$strip>;
|
|
385
385
|
readonly REMOVE_BUNDLE_ITEM: z.ZodMiniObject<{
|
|
386
386
|
bundleId: z.ZodMiniString<string>;
|
|
387
|
-
index: z.
|
|
387
|
+
index: z.ZodMiniInt;
|
|
388
388
|
}, z.core.$strip>;
|
|
389
389
|
readonly GET_BUNDLE_ITEMS: z.ZodMiniObject<{
|
|
390
390
|
bundleId: z.ZodMiniString<string>;
|
|
391
391
|
}, z.core.$strip>;
|
|
392
392
|
readonly GET_CATALOG_PRICE: z.ZodMiniObject<{
|
|
393
393
|
productId: z.ZodMiniString<string>;
|
|
394
|
-
quantity: z.ZodMiniOptional<z.
|
|
394
|
+
quantity: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
395
395
|
currencyCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
396
396
|
}, z.core.$strip>;
|
|
397
397
|
readonly SIMULATE_PRICE: z.ZodMiniObject<{
|
|
@@ -400,7 +400,7 @@ export declare const actionValidators: {
|
|
|
400
400
|
key: z.ZodMiniString<string>;
|
|
401
401
|
value: z.ZodMiniString<string>;
|
|
402
402
|
}, z.core.$strip>>>;
|
|
403
|
-
quantity: z.ZodMiniOptional<z.
|
|
403
|
+
quantity: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
404
404
|
currencyCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
405
405
|
useNetPrice: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
406
406
|
}, z.core.$strip>;
|
|
@@ -410,7 +410,7 @@ export declare const actionValidators: {
|
|
|
410
410
|
key: z.ZodMiniString<string>;
|
|
411
411
|
value: z.ZodMiniString<string>;
|
|
412
412
|
}, z.core.$strip>>>;
|
|
413
|
-
quantity: z.ZodMiniOptional<z.
|
|
413
|
+
quantity: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
414
414
|
currencyCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
415
415
|
useNetPrice: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
416
416
|
}, z.core.$strip>;
|
|
@@ -433,8 +433,8 @@ export declare const actionValidators: {
|
|
|
433
433
|
[x: string]: string;
|
|
434
434
|
}>;
|
|
435
435
|
}, z.core.$strip>>>;
|
|
436
|
-
limit: z.ZodMiniOptional<z.
|
|
437
|
-
offset: z.ZodMiniOptional<z.
|
|
436
|
+
limit: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
437
|
+
offset: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
438
438
|
productId: z.ZodMiniString<string>;
|
|
439
439
|
}, z.core.$strip>;
|
|
440
440
|
readonly COUNT_REVIEWS: z.ZodMiniObject<{
|
|
@@ -31,8 +31,8 @@ export declare const actionValidators: {
|
|
|
31
31
|
[x: string]: string;
|
|
32
32
|
}>;
|
|
33
33
|
}, z.core.$strip>>>;
|
|
34
|
-
limit: z.ZodMiniOptional<z.
|
|
35
|
-
offset: z.ZodMiniOptional<z.
|
|
34
|
+
limit: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
35
|
+
offset: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
36
36
|
}, z.core.$strip>;
|
|
37
37
|
readonly GET: z.ZodMiniObject<{
|
|
38
38
|
quotationId: z.ZodMiniString<string>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { buildObfuscatedFieldsFilter } from '@unchainedshop/utils';
|
|
2
|
+
import { WorkerDirector } from '@unchainedshop/core';
|
|
2
3
|
const allocateWork = async (context, options) => {
|
|
3
|
-
const { modules } = context;
|
|
4
4
|
const removePrivateFieldsFromWork = buildObfuscatedFieldsFilter(context.options.worker?.blacklistedVariables);
|
|
5
|
-
const work = await
|
|
5
|
+
const work = await WorkerDirector.allocateWork(context, {
|
|
6
6
|
types: options.types || [],
|
|
7
7
|
worker: options.worker || '',
|
|
8
8
|
});
|
|
@@ -5,11 +5,11 @@ export declare const actionValidators: {
|
|
|
5
5
|
readonly SHOP_INFO: z.ZodMiniObject<{}, z.core.$strip>;
|
|
6
6
|
readonly WORKER_ADD: z.ZodMiniObject<{
|
|
7
7
|
type: z.ZodMiniString<string>;
|
|
8
|
-
priority: z.ZodMiniDefault<z.
|
|
8
|
+
priority: z.ZodMiniDefault<z.ZodMiniInt>;
|
|
9
9
|
input: z.ZodMiniOptional<z.ZodMiniAny>;
|
|
10
10
|
originalWorkId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
11
11
|
scheduled: z.ZodMiniOptional<z.iso.ZodMiniISODateTime>;
|
|
12
|
-
retries: z.ZodMiniDefault<z.
|
|
12
|
+
retries: z.ZodMiniDefault<z.ZodMiniInt>;
|
|
13
13
|
worker: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
14
14
|
}, z.core.$strip>;
|
|
15
15
|
readonly WORKER_ACTIVE_WORK_TYPES: z.ZodMiniObject<{}, z.core.$strip>;
|
|
@@ -40,8 +40,8 @@ export declare const actionValidators: {
|
|
|
40
40
|
[x: string]: string;
|
|
41
41
|
}>;
|
|
42
42
|
}, z.core.$strip>>>;
|
|
43
|
-
limit: z.ZodMiniOptional<z.
|
|
44
|
-
offset: z.ZodMiniOptional<z.
|
|
43
|
+
limit: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
44
|
+
offset: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
45
45
|
}, z.core.$strip>;
|
|
46
46
|
readonly WORKER_COUNT: z.ZodMiniObject<{
|
|
47
47
|
created: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
@@ -91,8 +91,8 @@ export declare const actionValidators: {
|
|
|
91
91
|
[x: string]: string;
|
|
92
92
|
}>;
|
|
93
93
|
}, z.core.$strip>>>;
|
|
94
|
-
limit: z.ZodMiniOptional<z.
|
|
95
|
-
offset: z.ZodMiniOptional<z.
|
|
94
|
+
limit: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
95
|
+
offset: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
96
96
|
}, z.core.$strip>;
|
|
97
97
|
readonly EVENT_COUNT: z.ZodMiniObject<{
|
|
98
98
|
types: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
@@ -30,8 +30,8 @@ export declare const actionValidators: {
|
|
|
30
30
|
[x: string]: string;
|
|
31
31
|
}>;
|
|
32
32
|
}, z.core.$strip>>>;
|
|
33
|
-
limit: z.ZodMiniOptional<z.
|
|
34
|
-
offset: z.ZodMiniOptional<z.
|
|
33
|
+
limit: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
34
|
+
offset: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
35
35
|
}, z.core.$strip>;
|
|
36
36
|
readonly COUNT: z.ZodMiniObject<{
|
|
37
37
|
includeGuests: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
@@ -144,8 +144,8 @@ export declare const actionValidators: {
|
|
|
144
144
|
[x: string]: string;
|
|
145
145
|
}>;
|
|
146
146
|
}, z.core.$strip>>>;
|
|
147
|
-
limit: z.ZodMiniOptional<z.
|
|
148
|
-
offset: z.ZodMiniOptional<z.
|
|
147
|
+
limit: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
148
|
+
offset: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
149
149
|
userId: z.ZodMiniString<string>;
|
|
150
150
|
}, z.core.$strip>;
|
|
151
151
|
readonly GET_ENROLLMENTS: z.ZodMiniObject<{
|
|
@@ -158,8 +158,8 @@ export declare const actionValidators: {
|
|
|
158
158
|
[x: string]: string;
|
|
159
159
|
}>;
|
|
160
160
|
}, z.core.$strip>>>;
|
|
161
|
-
limit: z.ZodMiniOptional<z.
|
|
162
|
-
offset: z.ZodMiniOptional<z.
|
|
161
|
+
limit: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
162
|
+
offset: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
163
163
|
userId: z.ZodMiniString<string>;
|
|
164
164
|
}, z.core.$strip>;
|
|
165
165
|
readonly GET_QUOTATIONS: z.ZodMiniObject<{
|
|
@@ -171,8 +171,8 @@ export declare const actionValidators: {
|
|
|
171
171
|
[x: string]: string;
|
|
172
172
|
}>;
|
|
173
173
|
}, z.core.$strip>>>;
|
|
174
|
-
limit: z.ZodMiniOptional<z.
|
|
175
|
-
offset: z.ZodMiniOptional<z.
|
|
174
|
+
limit: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
175
|
+
offset: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
176
176
|
userId: z.ZodMiniString<string>;
|
|
177
177
|
}, z.core.$strip>;
|
|
178
178
|
readonly GET_BOOKMARKS: z.ZodMiniObject<{
|
|
@@ -192,8 +192,8 @@ export declare const actionValidators: {
|
|
|
192
192
|
[x: string]: string;
|
|
193
193
|
}>;
|
|
194
194
|
}, z.core.$strip>>>;
|
|
195
|
-
limit: z.ZodMiniOptional<z.
|
|
196
|
-
offset: z.ZodMiniOptional<z.
|
|
195
|
+
limit: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
196
|
+
offset: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
197
197
|
userId: z.ZodMiniString<string>;
|
|
198
198
|
}, z.core.$strip>;
|
|
199
199
|
readonly GET_REVIEWS_COUNT: z.ZodMiniObject<{
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod/v4-mini';
|
|
2
2
|
import type { StandardSchemaWithJSON } from '@modelcontextprotocol/server';
|
|
3
3
|
export declare const PaginationSchema: {
|
|
4
|
-
limit: z.ZodMiniOptional<z.
|
|
5
|
-
offset: z.ZodMiniOptional<z.
|
|
4
|
+
limit: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
5
|
+
offset: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
6
6
|
};
|
|
7
7
|
export declare const SortingSchema: {
|
|
8
8
|
sort: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
|
|
@@ -51,8 +51,8 @@ export declare function createManagementSchema<T extends readonly string[]>(acti
|
|
|
51
51
|
[x: string]: string;
|
|
52
52
|
}>;
|
|
53
53
|
}, z.core.$strip>>>;
|
|
54
|
-
limit: z.ZodMiniOptional<z.
|
|
55
|
-
offset: z.ZodMiniOptional<z.
|
|
54
|
+
limit: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
55
|
+
offset: z.ZodMiniOptional<z.ZodMiniInt>;
|
|
56
56
|
action: z.ZodMiniEnum<{
|
|
57
57
|
[x: string]: any;
|
|
58
58
|
}>;
|
|
@@ -22,7 +22,7 @@ export default async function checkoutCart(root, params, context) {
|
|
|
22
22
|
userId,
|
|
23
23
|
orderId: order._id,
|
|
24
24
|
...transactionContext,
|
|
25
|
-
detailCode: error.name || error.code,
|
|
25
|
+
detailCode: error.extensions?.code || error.name || error.code,
|
|
26
26
|
detailMessage: error.message,
|
|
27
27
|
});
|
|
28
28
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { log } from '@unchainedshop/logger';
|
|
2
|
-
import { UserNotFoundError } from "../../../errors.js";
|
|
2
|
+
import { LastAdminError, UserNotFoundError } from "../../../errors.js";
|
|
3
3
|
export default async function removeUser(root, params, { modules, services, userId: currentUserId }) {
|
|
4
4
|
const { userId: paramUserId, removeUserReviews = false } = params;
|
|
5
5
|
const normalizedUserId = paramUserId || currentUserId;
|
|
@@ -9,5 +9,12 @@ export default async function removeUser(root, params, { modules, services, user
|
|
|
9
9
|
if (removeUserReviews) {
|
|
10
10
|
await modules.products.reviews.deleteByAuthorId(normalizedUserId);
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
try {
|
|
13
|
+
return await services.users.deleteUser({ userId: normalizedUserId });
|
|
14
|
+
}
|
|
15
|
+
catch (e) {
|
|
16
|
+
if (e.cause === 'LAST_ADMIN')
|
|
17
|
+
throw new LastAdminError({ userId: normalizedUserId });
|
|
18
|
+
throw e;
|
|
19
|
+
}
|
|
13
20
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { log } from '@unchainedshop/logger';
|
|
2
2
|
import { Roles } from '@unchainedshop/roles';
|
|
3
|
-
import { InvalidIdError, UserNotFoundError } from "../../../errors.js";
|
|
3
|
+
import { InvalidIdError, LastAdminError, UserNotFoundError } from "../../../errors.js";
|
|
4
4
|
export default async function setRoles(root, params, { modules, userId }) {
|
|
5
5
|
const foreignUserId = params.userId;
|
|
6
6
|
log(`mutation setRoles ${foreignUserId}`, { userId });
|
|
@@ -12,5 +12,12 @@ export default async function setRoles(root, params, { modules, userId }) {
|
|
|
12
12
|
if (invalidRoles.length > 0) {
|
|
13
13
|
throw new Error(`Invalid role names: ${invalidRoles.join(', ')}`);
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
try {
|
|
16
|
+
return await modules.users.updateRoles(foreignUserId, params.roles);
|
|
17
|
+
}
|
|
18
|
+
catch (e) {
|
|
19
|
+
if (e.cause === 'LAST_ADMIN')
|
|
20
|
+
throw new LastAdminError({ userId: foreignUserId });
|
|
21
|
+
throw e;
|
|
22
|
+
}
|
|
16
23
|
}
|