@unchainedshop/api 4.8.12 → 5.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/acl.d.ts +2 -2
- package/lib/acl.js +36 -8
- package/lib/api-index.d.ts +3 -1
- package/lib/chat/generateImageHandler.js +6 -5
- package/lib/context.d.ts +3 -1
- package/lib/context.js +9 -4
- 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 +53 -126
- package/lib/fastify/index.d.ts +6 -9
- package/lib/fastify/index.js +52 -118
- package/lib/fastify/mcpHandler.js +1 -1
- package/lib/loaders/buildTextMap.js +6 -3
- package/lib/loaders/index.d.ts +0 -25
- package/lib/loaders/index.js +0 -10
- 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/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/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/middleware/createAuthMiddleware.js +1 -3
- package/lib/resolvers/mutations/accounts/changePassword.js +1 -2
- package/lib/resolvers/mutations/index.d.ts +150 -155
- 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 +6 -4
- 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 +71 -71
- package/lib/resolvers/queries/index.js +1 -1
- package/lib/resolvers/type/index.d.ts +5 -6
- 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/order/order-types.d.ts +5 -5
- package/lib/resolvers/type/order/order-types.js +27 -12
- package/lib/resolvers/type/shop-types.js +1 -1
- package/lib/resolvers/type/user-types.js +3 -3
- package/lib/roles/index.d.ts +4 -11
- package/lib/roles/index.js +16 -11
- package/lib/roles/loggedIn.js +2 -1
- 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 +14 -24
|
@@ -3,76 +3,76 @@ import impersonator from './users/impersonator.ts';
|
|
|
3
3
|
declare const _default: {
|
|
4
4
|
me: typeof me;
|
|
5
5
|
impersonator: typeof impersonator;
|
|
6
|
-
user: (root: any, params: any, context: any,
|
|
7
|
-
users: (root: any, params: any, context: any,
|
|
8
|
-
usersCount: (root: any, params: any, context: any,
|
|
9
|
-
product: (root: any, params: any, context: any,
|
|
10
|
-
products: (root: any, params: any, context: any,
|
|
11
|
-
productsCount: (root: any, params: any, context: any,
|
|
12
|
-
productCatalogPrices: (root: any, params: any, context: any,
|
|
13
|
-
languagesCount: (root: any, params: any, context: any,
|
|
14
|
-
languages: (root: any, params: any, context: any,
|
|
15
|
-
language: (root: any, params: any, context: any,
|
|
16
|
-
countriesCount: (root: any, params: any, context: any,
|
|
17
|
-
countries: (root: any, params: any, context: any,
|
|
18
|
-
country: (root: any, params: any, context: any,
|
|
19
|
-
currenciesCount: (root: any, params: any, context: any,
|
|
20
|
-
currencies: (root: any, params: any, context: any,
|
|
21
|
-
currency: (root: any, params: any, context: any,
|
|
22
|
-
paymentProviders: (root: any, params: any, context: any,
|
|
23
|
-
paymentProvidersCount: (root: any, params: any, context: any,
|
|
24
|
-
paymentProvider: (root: any, params: any, context: any,
|
|
25
|
-
paymentInterfaces: (root: any, params: any, context: any,
|
|
26
|
-
deliveryProvidersCount: (root: any, params: any, context: any,
|
|
27
|
-
deliveryProviders: (root: any, params: any, context: any,
|
|
28
|
-
deliveryProvider: (root: any, params: any, context: any,
|
|
29
|
-
deliveryInterfaces: (root: any, params: any, context: any,
|
|
30
|
-
warehousingProvidersCount: (root: any, params: any, context: any,
|
|
31
|
-
warehousingProviders: (root: any, params: any, context: any,
|
|
32
|
-
warehousingProvider: (root: any, params: any, context: any,
|
|
33
|
-
warehousingInterfaces: (root: any, params: any, context: any,
|
|
34
|
-
token: (root: any, params: any, context: any,
|
|
35
|
-
tokens: (root: any, params: any, context: any,
|
|
36
|
-
tokensCount: (root: any, params: any, context: any,
|
|
37
|
-
translatedProductTexts: (root: any, params: any, context: any,
|
|
38
|
-
translatedProductMediaTexts: (root: any, params: any, context: any,
|
|
39
|
-
translatedProductVariationTexts: (root: any, params: any, context: any,
|
|
40
|
-
ordersCount: (root: any, params: any, context: any,
|
|
41
|
-
orders: (root: any, params: any, context: any,
|
|
42
|
-
order: (root: any, params: any, context: any,
|
|
43
|
-
assortmentsCount: (root: any, params: any, context: any,
|
|
44
|
-
assortments: (root: any, params: any, context: any,
|
|
45
|
-
translatedAssortmentMediaTexts: (root: any, params: any, context: any,
|
|
46
|
-
assortment: (root: any, params: any, context: any,
|
|
47
|
-
filtersCount: (root: any, params: any, context: any,
|
|
48
|
-
filters: (root: any, params: any, context: any,
|
|
49
|
-
filter: (root: any, params: any, context: any,
|
|
50
|
-
shopInfo: (root: any, params: any, context: any,
|
|
51
|
-
translatedAssortmentTexts: (root: any, params: any, context: any,
|
|
52
|
-
translatedFilterTexts: (root: any, params: any, context: any,
|
|
53
|
-
productReview: (root: any, params: any, context: any,
|
|
54
|
-
productReviews: (root: any, params: any, context: any,
|
|
55
|
-
productReviewsCount: (root: any, params: any, context: any,
|
|
56
|
-
quotation: (root: any, params: any, context: any,
|
|
57
|
-
quotations: (root: any, params: any, context: any,
|
|
58
|
-
quotationsCount: (root: any, params: any, context: any,
|
|
59
|
-
searchProducts: (root: any, params: any, context: any,
|
|
60
|
-
searchAssortments: (root: any, params: any, context: any,
|
|
61
|
-
workQueue: (root: any, params: any, context: any,
|
|
62
|
-
workQueueCount: (root: any, params: any, context: any,
|
|
63
|
-
activeWorkTypes: (root: any, params: any, context: any,
|
|
64
|
-
enrollment: (root: any, params: any, context: any,
|
|
65
|
-
enrollments: (root: any, params: any, context: any,
|
|
66
|
-
enrollmentsCount: (root: any, params: any, context: any,
|
|
67
|
-
work: (root: any, params: any, context: any,
|
|
68
|
-
event: (root: any, params: any, context: any,
|
|
69
|
-
events: (root: any, params: any, context: any,
|
|
70
|
-
eventsCount: (root: any, params: any, context: any,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
eventStatistics: (root: any, params: any, context: any,
|
|
76
|
-
orderStatistics: (root: any, params: any, context: any,
|
|
6
|
+
user: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
7
|
+
users: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
8
|
+
usersCount: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
9
|
+
product: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
10
|
+
products: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
11
|
+
productsCount: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
12
|
+
productCatalogPrices: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
13
|
+
languagesCount: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
14
|
+
languages: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
15
|
+
language: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
16
|
+
countriesCount: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
17
|
+
countries: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
18
|
+
country: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
19
|
+
currenciesCount: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
20
|
+
currencies: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
21
|
+
currency: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
22
|
+
paymentProviders: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
23
|
+
paymentProvidersCount: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
24
|
+
paymentProvider: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
25
|
+
paymentInterfaces: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
26
|
+
deliveryProvidersCount: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
27
|
+
deliveryProviders: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
28
|
+
deliveryProvider: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
29
|
+
deliveryInterfaces: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
30
|
+
warehousingProvidersCount: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
31
|
+
warehousingProviders: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
32
|
+
warehousingProvider: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
33
|
+
warehousingInterfaces: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
34
|
+
token: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
35
|
+
tokens: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
36
|
+
tokensCount: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
37
|
+
translatedProductTexts: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
38
|
+
translatedProductMediaTexts: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
39
|
+
translatedProductVariationTexts: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
40
|
+
ordersCount: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
41
|
+
orders: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
42
|
+
order: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
43
|
+
assortmentsCount: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
44
|
+
assortments: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
45
|
+
translatedAssortmentMediaTexts: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
46
|
+
assortment: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
47
|
+
filtersCount: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
48
|
+
filters: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
49
|
+
filter: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
50
|
+
shopInfo: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
51
|
+
translatedAssortmentTexts: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
52
|
+
translatedFilterTexts: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
53
|
+
productReview: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
54
|
+
productReviews: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
55
|
+
productReviewsCount: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
56
|
+
quotation: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
57
|
+
quotations: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
58
|
+
quotationsCount: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
59
|
+
searchProducts: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
60
|
+
searchAssortments: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
61
|
+
workQueue: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
62
|
+
workQueueCount: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
63
|
+
activeWorkTypes: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
64
|
+
enrollment: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
65
|
+
enrollments: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
66
|
+
enrollmentsCount: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
67
|
+
work: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
68
|
+
event: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
69
|
+
events: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
70
|
+
eventsCount: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
71
|
+
validateResetPasswordToken: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
72
|
+
validateVerifyEmailToken: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
73
|
+
workStatistics: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
74
|
+
registeredEventTypes: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
75
|
+
eventStatistics: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
76
|
+
orderStatistics: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
77
77
|
};
|
|
78
78
|
export default _default;
|
|
@@ -141,10 +141,10 @@ export default {
|
|
|
141
141
|
event: acl(actions.viewEvent)(event),
|
|
142
142
|
events: acl(actions.viewEvents)(events),
|
|
143
143
|
eventsCount: acl(actions.viewEvents)(eventsCount),
|
|
144
|
-
registeredEventTypes: acl(actions.viewEvents)(registeredEventTypes),
|
|
145
144
|
validateResetPasswordToken: acl(actions.resetPassword)(validateResetPasswordToken),
|
|
146
145
|
validateVerifyEmailToken: acl(actions.verifyEmail)(validateVerifyEmailToken),
|
|
147
146
|
workStatistics: acl(actions.viewStatistics)(workStatistics),
|
|
147
|
+
registeredEventTypes: acl(actions.viewEvents)(registeredEventTypes),
|
|
148
148
|
eventStatistics: acl(actions.viewStatistics)(eventStatistics),
|
|
149
149
|
orderStatistics: acl(actions.viewStatistics)(orderStatistics),
|
|
150
150
|
};
|
|
@@ -305,11 +305,11 @@ declare const types: {
|
|
|
305
305
|
supportedPaymentProviders(order: import("@unchainedshop/core-orders").Order, _: any, context: import("../../context.ts").Context): Promise<import("@unchainedshop/core-payment").PaymentProvider[]>;
|
|
306
306
|
currency(order: import("@unchainedshop/core-orders").Order, _: any, { loaders }: import("../../context.ts").Context): Promise<import("@unchainedshop/core-currencies").Currency>;
|
|
307
307
|
country(order: import("@unchainedshop/core-orders").Order, _: any, { loaders }: import("../../context.ts").Context): Promise<import("@unchainedshop/core-countries").Country>;
|
|
308
|
-
discounts(order: import("@unchainedshop/core-orders").Order, _: any, {
|
|
309
|
-
delivery(order: import("@unchainedshop/core-orders").Order, _: any, {
|
|
310
|
-
enrollment(order: import("@unchainedshop/core-orders").Order, _: any, {
|
|
311
|
-
items(order: import("@unchainedshop/core-orders").Order, _: any, {
|
|
312
|
-
payment(order: import("@unchainedshop/core-orders").Order, _: any, {
|
|
308
|
+
discounts(order: import("@unchainedshop/core-orders").Order, _: any, { modules }: import("../../context.ts").Context): Promise<import("@unchainedshop/core-orders").OrderDiscount[]>;
|
|
309
|
+
delivery(order: import("@unchainedshop/core-orders").Order, _: any, { modules }: import("../../context.ts").Context): Promise<import("@unchainedshop/core-orders").OrderDelivery | null>;
|
|
310
|
+
enrollment(order: import("@unchainedshop/core-orders").Order, _: any, { modules }: import("../../context.ts").Context): Promise<import("@unchainedshop/core-enrollments").Enrollment | null>;
|
|
311
|
+
items(order: import("@unchainedshop/core-orders").Order, _: any, { modules }: import("../../context.ts").Context): Promise<import("@unchainedshop/core-orders").OrderPosition[]>;
|
|
312
|
+
payment(order: import("@unchainedshop/core-orders").Order, _: any, { modules }: import("../../context.ts").Context): Promise<import("@unchainedshop/core-orders").OrderPayment | null>;
|
|
313
313
|
status(order: import("@unchainedshop/core-orders").Order): string;
|
|
314
314
|
total(order: import("@unchainedshop/core-orders").Order, params: {
|
|
315
315
|
category: string;
|
|
@@ -330,7 +330,6 @@ declare const types: {
|
|
|
330
330
|
};
|
|
331
331
|
OrderDeliveryPickUp: {
|
|
332
332
|
activePickUpLocation(orderDelivery: import("@unchainedshop/core-orders").OrderDelivery, _: never, requestContext: import("../../context.ts").Context): Promise<import("@unchainedshop/core-delivery").DeliveryLocation | null>;
|
|
333
|
-
pickUpLocations(obj: import("@unchainedshop/core-orders").OrderDelivery, _: never, context: import("../../context.ts").Context): Promise<import("@unchainedshop/core-delivery").DeliveryLocation[]>;
|
|
334
333
|
provider(obj: import("@unchainedshop/core-orders").OrderDelivery, _: never, { loaders }: import("../../context.ts").Context): Promise<import("@unchainedshop/core-delivery").DeliveryProvider>;
|
|
335
334
|
status(obj: import("@unchainedshop/core-orders").OrderDelivery, _: never, { modules }: import("../../context.ts").Context): import("@unchainedshop/core-orders").OrderDeliveryStatus;
|
|
336
335
|
discounts(obj: import("@unchainedshop/core-orders").OrderDelivery, _: never, { loaders }: import("../../context.ts").Context): Promise<{
|
|
@@ -2,7 +2,6 @@ import type { Context } from '../../../context.ts';
|
|
|
2
2
|
import type { OrderDelivery } from '@unchainedshop/core-orders';
|
|
3
3
|
export declare const OrderDeliveryPickUp: {
|
|
4
4
|
activePickUpLocation(orderDelivery: OrderDelivery, _: never, requestContext: Context): Promise<import("@unchainedshop/core-delivery").DeliveryLocation | null>;
|
|
5
|
-
pickUpLocations(obj: OrderDelivery, _: never, context: Context): Promise<import("@unchainedshop/core-delivery").DeliveryLocation[]>;
|
|
6
5
|
provider(obj: OrderDelivery, _: never, { loaders }: Context): Promise<import("@unchainedshop/core-delivery").DeliveryProvider>;
|
|
7
6
|
status(obj: OrderDelivery, _: never, { modules }: Context): import("@unchainedshop/core-orders").OrderDeliveryStatus;
|
|
8
7
|
discounts(obj: OrderDelivery, _: never, { loaders }: Context): Promise<{
|
|
@@ -8,13 +8,6 @@ export const OrderDeliveryPickUp = {
|
|
|
8
8
|
const director = await DeliveryDirector.actions(provider, { orderDelivery: orderDelivery }, requestContext);
|
|
9
9
|
return director.pickUpLocationById(orderPickUpLocationId);
|
|
10
10
|
},
|
|
11
|
-
async pickUpLocations(obj, _, context) {
|
|
12
|
-
const provider = await context.loaders.deliveryProviderLoader.load({
|
|
13
|
-
deliveryProviderId: obj.deliveryProviderId,
|
|
14
|
-
});
|
|
15
|
-
const director = await DeliveryDirector.actions(provider, { orderDelivery: obj }, context);
|
|
16
|
-
return director.pickUpLocations();
|
|
17
|
-
},
|
|
18
11
|
async provider(obj, _, { loaders }) {
|
|
19
12
|
return loaders.deliveryProviderLoader.load({
|
|
20
13
|
deliveryProviderId: obj.deliveryProviderId,
|
|
@@ -11,11 +11,11 @@ export declare const Order: {
|
|
|
11
11
|
supportedPaymentProviders(order: OrderType, _: any, context: Context): Promise<import("@unchainedshop/core-payment").PaymentProvider[]>;
|
|
12
12
|
currency(order: OrderType, _: any, { loaders }: Context): Promise<Currency>;
|
|
13
13
|
country(order: OrderType, _: any, { loaders }: Context): Promise<Country>;
|
|
14
|
-
discounts(order: OrderType, _: any, {
|
|
15
|
-
delivery(order: OrderType, _: any, {
|
|
16
|
-
enrollment(order: OrderType, _: any, {
|
|
17
|
-
items(order: OrderType, _: any, {
|
|
18
|
-
payment(order: OrderType, _: any, {
|
|
14
|
+
discounts(order: OrderType, _: any, { modules }: Context): Promise<OrderDiscount[]>;
|
|
15
|
+
delivery(order: OrderType, _: any, { modules }: Context): Promise<OrderDelivery | null>;
|
|
16
|
+
enrollment(order: OrderType, _: any, { modules }: Context): Promise<Enrollment | null>;
|
|
17
|
+
items(order: OrderType, _: any, { modules }: Context): Promise<OrderPosition[]>;
|
|
18
|
+
payment(order: OrderType, _: any, { modules }: Context): Promise<OrderPayment | null>;
|
|
19
19
|
status(order: OrderType): string;
|
|
20
20
|
total(order: OrderType, params: {
|
|
21
21
|
category: string;
|
|
@@ -16,24 +16,39 @@ export const Order = {
|
|
|
16
16
|
async country(order, _, { loaders }) {
|
|
17
17
|
return loaders.countryLoader.load({ isoCode: order.countryCode });
|
|
18
18
|
},
|
|
19
|
-
async discounts(order, _, {
|
|
20
|
-
return
|
|
19
|
+
async discounts(order, _, { modules }) {
|
|
20
|
+
return modules.orders.discounts.findOrderDiscounts({ orderId: order._id });
|
|
21
21
|
},
|
|
22
|
-
async delivery(order, _, {
|
|
23
|
-
|
|
22
|
+
async delivery(order, _, { modules }) {
|
|
23
|
+
const orderDelivery = order.deliveryId &&
|
|
24
|
+
(await modules.orders.deliveries.findDelivery({
|
|
25
|
+
orderDeliveryId: order.deliveryId,
|
|
26
|
+
}));
|
|
27
|
+
if (!orderDelivery)
|
|
24
28
|
return null;
|
|
25
|
-
return
|
|
29
|
+
return orderDelivery;
|
|
26
30
|
},
|
|
27
|
-
async enrollment(order, _, {
|
|
28
|
-
|
|
31
|
+
async enrollment(order, _, { modules }) {
|
|
32
|
+
const enrollment = await modules.enrollments.findEnrollment({
|
|
33
|
+
orderId: order._id,
|
|
34
|
+
});
|
|
35
|
+
if (!enrollment)
|
|
36
|
+
return null;
|
|
37
|
+
return enrollment;
|
|
29
38
|
},
|
|
30
|
-
async items(order, _, {
|
|
31
|
-
return
|
|
39
|
+
async items(order, _, { modules }) {
|
|
40
|
+
return modules.orders.positions.findOrderPositions({
|
|
41
|
+
orderId: order._id,
|
|
42
|
+
});
|
|
32
43
|
},
|
|
33
|
-
async payment(order, _, {
|
|
34
|
-
|
|
44
|
+
async payment(order, _, { modules }) {
|
|
45
|
+
const payment = order.paymentId &&
|
|
46
|
+
(await modules.orders.payments.findOrderPayment({
|
|
47
|
+
orderPaymentId: order.paymentId,
|
|
48
|
+
}));
|
|
49
|
+
if (!payment)
|
|
35
50
|
return null;
|
|
36
|
-
return
|
|
51
|
+
return payment;
|
|
37
52
|
},
|
|
38
53
|
status(order) {
|
|
39
54
|
if (order.status === null) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { permissions } from '@unchainedshop/roles';
|
|
2
2
|
import { checkAction, checkTypeResolver } from "../../acl.js";
|
|
3
3
|
import { actions } from "../../roles/index.js";
|
|
4
4
|
const { viewUserPrivateInfos, viewUserPublicInfos, viewUserOrders, viewUserEnrollments, viewUserQuotations, viewUserProductReviews, } = actions;
|
|
@@ -90,8 +90,8 @@ export const User = {
|
|
|
90
90
|
},
|
|
91
91
|
allowedActions: async (user, params, context) => {
|
|
92
92
|
await checkAction(context, viewUserPrivateInfos, [user, params]);
|
|
93
|
-
const userRoles =
|
|
94
|
-
return permissions(userRoles, context.roles);
|
|
93
|
+
const userRoles = context.roles.getUserRoles(user?._id, user.roles, true);
|
|
94
|
+
return permissions(userRoles, context.roles.roles);
|
|
95
95
|
},
|
|
96
96
|
orders: async (user, params, context) => {
|
|
97
97
|
await checkAction(context, viewUserOrders, [user, params]);
|
package/lib/roles/index.d.ts
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
ADMIN: import("@unchainedshop/roles").RoleInterface | undefined;
|
|
3
|
-
LOGGEDIN: import("@unchainedshop/roles").RoleInterface | undefined;
|
|
4
|
-
ALL: import("@unchainedshop/roles").RoleInterface | undefined;
|
|
5
|
-
};
|
|
1
|
+
import { type RolesInterface } from '@unchainedshop/roles';
|
|
6
2
|
declare const actions: Record<string, string>;
|
|
3
|
+
declare let allRoles: Record<string, any>;
|
|
7
4
|
declare const configureRoles: ({ additionalRoles, additionalActions, }: {
|
|
8
5
|
additionalRoles?: Record<string, any>;
|
|
9
6
|
additionalActions?: string[];
|
|
10
|
-
}) =>
|
|
11
|
-
|
|
12
|
-
LOGGEDIN: import("@unchainedshop/roles").RoleInterface | undefined;
|
|
13
|
-
ALL: import("@unchainedshop/roles").RoleInterface | undefined;
|
|
14
|
-
};
|
|
15
|
-
declare const getPublicRoles: () => string[];
|
|
7
|
+
}) => RolesInterface;
|
|
8
|
+
declare const getPublicRoles: (roles: RolesInterface) => string[];
|
|
16
9
|
export { allRoles, actions, configureRoles, getPublicRoles };
|
package/lib/roles/index.js
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createRoles, Role } from '@unchainedshop/roles';
|
|
2
2
|
import { all } from "./all.js";
|
|
3
3
|
import { loggedIn } from "./loggedIn.js";
|
|
4
4
|
import { admin } from "./admin.js";
|
|
5
|
-
const roles = {
|
|
6
|
-
ADMIN: Roles.adminRole,
|
|
7
|
-
LOGGEDIN: Roles.loggedInRole,
|
|
8
|
-
ALL: Roles.allRole,
|
|
9
|
-
};
|
|
10
|
-
const allRoles = roles;
|
|
11
5
|
const actions = [
|
|
12
6
|
'impersonate',
|
|
13
7
|
'stopImpersonation',
|
|
@@ -101,6 +95,7 @@ const actions = [
|
|
|
101
95
|
'managePaymentCredentials',
|
|
102
96
|
'bulkImport',
|
|
103
97
|
'logout',
|
|
98
|
+
'logoutAllSessions',
|
|
104
99
|
'loginAsGuest',
|
|
105
100
|
'loginWithPassword',
|
|
106
101
|
'loginWithWebAuthn',
|
|
@@ -124,21 +119,31 @@ const actions = [
|
|
|
124
119
|
newValue[actionValue] = actionValue;
|
|
125
120
|
return newValue;
|
|
126
121
|
}, {});
|
|
122
|
+
let allRoles = {};
|
|
127
123
|
const configureRoles = ({ additionalRoles, additionalActions, }) => {
|
|
124
|
+
const roles = createRoles();
|
|
125
|
+
roles.adminRole = roles.addRole(new Role('admin'));
|
|
126
|
+
roles.loggedInRole = roles.addRole(new Role('__loggedIn__'));
|
|
127
|
+
roles.allRole = roles.addRole(new Role('__all__'));
|
|
128
128
|
additionalActions?.forEach((action) => {
|
|
129
129
|
actions[action] = action;
|
|
130
130
|
});
|
|
131
|
+
allRoles = {
|
|
132
|
+
ADMIN: roles.adminRole,
|
|
133
|
+
LOGGEDIN: roles.loggedInRole,
|
|
134
|
+
ALL: roles.allRole,
|
|
135
|
+
};
|
|
131
136
|
Object.entries(additionalRoles || {}).forEach(([key, val]) => {
|
|
132
|
-
allRoles[key] = new Role(key);
|
|
137
|
+
allRoles[key] = roles.addRole(new Role(key));
|
|
133
138
|
val(allRoles[key], actions);
|
|
134
139
|
});
|
|
135
140
|
all(allRoles.ALL, actions);
|
|
136
141
|
loggedIn(allRoles.LOGGEDIN, actions);
|
|
137
142
|
admin(allRoles.ADMIN, actions);
|
|
138
|
-
return
|
|
143
|
+
return roles;
|
|
139
144
|
};
|
|
140
|
-
const getPublicRoles = () => {
|
|
141
|
-
return Object.values(
|
|
145
|
+
const getPublicRoles = (roles) => {
|
|
146
|
+
return Object.values(roles.roles)
|
|
142
147
|
.map((role) => role?.name)
|
|
143
148
|
.filter(Boolean)
|
|
144
149
|
.filter((name) => !name.startsWith('__'));
|
package/lib/roles/loggedIn.js
CHANGED
|
@@ -166,11 +166,12 @@ export const loggedIn = (role, actions) => {
|
|
|
166
166
|
role.allow(actions.manageBookmarks, isOwnedBookmark);
|
|
167
167
|
role.allow(actions.bookmarkProduct, () => true);
|
|
168
168
|
role.allow(actions.voteProductReview, () => true);
|
|
169
|
-
role.allow(actions.changePassword, () => true);
|
|
170
169
|
role.allow(actions.registerPaymentCredentials, () => true);
|
|
171
170
|
role.allow(actions.managePaymentCredentials, isOwnedPaymentCredential);
|
|
172
171
|
role.allow(actions.confirmMediaUpload, () => true);
|
|
173
172
|
role.allow(actions.downloadFile, isFileAccessible);
|
|
174
173
|
role.allow(actions.uploadUserAvatar, canUpdateAvatar);
|
|
175
174
|
role.allow(actions.uploadTempFile, canUpdateAvatar);
|
|
175
|
+
role.allow(actions.changePassword, () => true);
|
|
176
|
+
role.allow(actions.logoutAllSessions, () => true);
|
|
176
177
|
};
|
package/lib/schema/mutation.js
CHANGED
|
@@ -57,6 +57,12 @@ export default [
|
|
|
57
57
|
"""
|
|
58
58
|
logout: SuccessResponse
|
|
59
59
|
|
|
60
|
+
"""
|
|
61
|
+
Log the user out of all sessions by invalidating all JWT tokens.
|
|
62
|
+
This increments the token version, making all existing tokens invalid.
|
|
63
|
+
"""
|
|
64
|
+
logoutAllSessions: SuccessResponse
|
|
65
|
+
|
|
60
66
|
"""
|
|
61
67
|
Impersonate a user
|
|
62
68
|
"""
|
|
@@ -221,20 +227,6 @@ export default [
|
|
|
221
227
|
"""
|
|
222
228
|
terminateEnrollment(enrollmentId: ID!): Enrollment!
|
|
223
229
|
|
|
224
|
-
"""
|
|
225
|
-
Change the delivery method/provider to an order. If the delivery provider
|
|
226
|
-
doesn’t exists new delivery provider will be created with the provided ID.
|
|
227
|
-
"""
|
|
228
|
-
setOrderDeliveryProvider(orderId: ID!, deliveryProviderId: ID!): Order!
|
|
229
|
-
@deprecated(reason: "Use updateCart or updateCartDelivery* mutations instead")
|
|
230
|
-
|
|
231
|
-
"""
|
|
232
|
-
Change the payment method/provider to an order. If the payment provider
|
|
233
|
-
doesn’t exists new payment provider will be created with the provided ID.
|
|
234
|
-
"""
|
|
235
|
-
setOrderPaymentProvider(orderId: ID!, paymentProviderId: ID!): Order!
|
|
236
|
-
@deprecated(reason: "Use updateCart or updateCartPayment* mutations instead")
|
|
237
|
-
|
|
238
230
|
"""
|
|
239
231
|
Update the cart by changing the delivery provider and using a shipping specific configuration
|
|
240
232
|
"""
|
|
@@ -265,36 +257,6 @@ export default [
|
|
|
265
257
|
"""
|
|
266
258
|
updateCartPaymentGeneric(orderId: ID, paymentProviderId: ID!, meta: JSON): Order!
|
|
267
259
|
|
|
268
|
-
"""
|
|
269
|
-
Update a Shipping Delivery Provider's specific configuration
|
|
270
|
-
"""
|
|
271
|
-
updateOrderDeliveryShipping(
|
|
272
|
-
orderDeliveryId: ID!
|
|
273
|
-
address: AddressInput
|
|
274
|
-
meta: JSON
|
|
275
|
-
): OrderDeliveryShipping! @deprecated(reason: "Use updateCartDeliveryShipping instead")
|
|
276
|
-
|
|
277
|
-
"""
|
|
278
|
-
Update a Pick Up Delivery Provider's specific configuration
|
|
279
|
-
"""
|
|
280
|
-
updateOrderDeliveryPickUp(
|
|
281
|
-
orderDeliveryId: ID!
|
|
282
|
-
orderPickUpLocationId: ID!
|
|
283
|
-
meta: JSON
|
|
284
|
-
): OrderDeliveryPickUp! @deprecated(reason: "Use updateCartDeliveryPickUp instead")
|
|
285
|
-
|
|
286
|
-
"""
|
|
287
|
-
Update an Invoice Payment Provider's specific configuration
|
|
288
|
-
"""
|
|
289
|
-
updateOrderPaymentInvoice(orderPaymentId: ID!, meta: JSON): OrderPaymentInvoice!
|
|
290
|
-
@deprecated(reason: "Use updateCartPaymentInvoice instead")
|
|
291
|
-
|
|
292
|
-
"""
|
|
293
|
-
Update a Generic Payment Provider's specific configuration
|
|
294
|
-
"""
|
|
295
|
-
updateOrderPaymentGeneric(orderPaymentId: ID!, meta: JSON): OrderPaymentGeneric!
|
|
296
|
-
@deprecated(reason: "Use updateCartPaymentGeneric instead")
|
|
297
|
-
|
|
298
260
|
"""
|
|
299
261
|
Remove an order while it's still open
|
|
300
262
|
"""
|
package/lib/schema/query.js
CHANGED
|
@@ -491,11 +491,6 @@ export default [
|
|
|
491
491
|
"""
|
|
492
492
|
eventsCount(types: [String!], queryString: String, created: DateFilterInput): Int!
|
|
493
493
|
|
|
494
|
-
"""
|
|
495
|
-
Get all registered event types
|
|
496
|
-
"""
|
|
497
|
-
registeredEventTypes: [String!]!
|
|
498
|
-
|
|
499
494
|
"""
|
|
500
495
|
Determines if a token is valid/active for reset password
|
|
501
496
|
"""
|
|
@@ -506,6 +501,11 @@ export default [
|
|
|
506
501
|
"""
|
|
507
502
|
validateVerifyEmailToken(token: String!): Boolean!
|
|
508
503
|
|
|
504
|
+
"""
|
|
505
|
+
Get all registered event types
|
|
506
|
+
"""
|
|
507
|
+
registeredEventTypes: [String!]!
|
|
508
|
+
|
|
509
509
|
"""
|
|
510
510
|
Returns aggregated report of all the events that occurred in the system
|
|
511
511
|
"""
|
|
@@ -15,7 +15,7 @@ import price from "./price.js";
|
|
|
15
15
|
import payment from "./payment.js";
|
|
16
16
|
import shop from "./shop.js";
|
|
17
17
|
import stock from "./stock.js";
|
|
18
|
-
import
|
|
18
|
+
import common from "./common.js";
|
|
19
19
|
import user from "./user.js";
|
|
20
20
|
import warehousing from "./warehousing.js";
|
|
21
21
|
import order from "./order/index.js";
|
|
@@ -46,7 +46,7 @@ export default [
|
|
|
46
46
|
...payment,
|
|
47
47
|
...shop,
|
|
48
48
|
...stock,
|
|
49
|
-
...
|
|
49
|
+
...common,
|
|
50
50
|
...user,
|
|
51
51
|
...warehousing,
|
|
52
52
|
...product,
|