@unchainedshop/api 4.6.2 → 4.7.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.js +29 -1
- package/lib/api-index.d.ts +1 -0
- package/lib/auth.js +1 -0
- package/lib/context.d.ts +1 -0
- package/lib/context.js +8 -3
- package/lib/events.d.ts +2 -0
- package/lib/events.js +2 -0
- package/lib/express/index.d.ts +6 -9
- package/lib/express/index.js +52 -125
- package/lib/fastify/index.d.ts +6 -9
- package/lib/fastify/index.js +51 -113
- package/lib/mcp/tools/localization/getLocalizationsConfig.d.ts +1 -1
- package/lib/mcp/tools/localization/schemas.d.ts +34 -0
- package/lib/mcp/tools/order/handlers/getTopCustomers.d.ts +2 -0
- 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/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/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/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/validateIsoCode.d.ts +1 -1
- package/lib/resolvers/mutations/index.d.ts +1 -6
- package/lib/resolvers/mutations/index.js +2 -12
- package/lib/resolvers/mutations/orders/updateCart.js +7 -1
- package/lib/resolvers/queries/orders/orders.js +2 -2
- package/lib/resolvers/type/index.d.ts +0 -1
- package/lib/resolvers/type/order/order-delivery-pickup-types.d.ts +0 -1
- package/lib/resolvers/type/order/order-delivery-pickup-types.js +0 -7
- package/lib/roles/index.js +1 -0
- package/lib/roles/loggedIn.js +1 -0
- package/lib/schema/mutation.js +6 -44
- package/lib/schema/types/index.js +2 -2
- package/lib/schema/types/order/delivery.js +0 -2
- package/package.json +8 -17
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { SortDirection } from '@unchainedshop/utils';
|
|
3
|
+
export type LocalizationType = 'COUNTRY' | 'CURRENCY' | 'LANGUAGE';
|
|
4
|
+
export interface LocalizationModuleConfig {
|
|
5
|
+
module: any;
|
|
6
|
+
NotFoundError: any;
|
|
7
|
+
entityName: string;
|
|
8
|
+
idField: string;
|
|
9
|
+
existsMethod: any;
|
|
10
|
+
findMethod: any;
|
|
11
|
+
findMultipleMethod: any;
|
|
12
|
+
}
|
|
13
|
+
export interface LocalizationEntity {
|
|
14
|
+
isoCode: string;
|
|
15
|
+
contractAddress?: string;
|
|
16
|
+
decimals?: number;
|
|
17
|
+
}
|
|
18
|
+
export interface LocalizationUpdateEntity {
|
|
19
|
+
isoCode?: string;
|
|
20
|
+
contractAddress?: string;
|
|
21
|
+
decimals?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface LocalizationListOptions {
|
|
24
|
+
limit?: number;
|
|
25
|
+
offset?: number;
|
|
26
|
+
includeInactive?: boolean;
|
|
27
|
+
queryString?: string;
|
|
28
|
+
sort?: {
|
|
29
|
+
key: string;
|
|
30
|
+
value: 'ASC' | 'DESC';
|
|
31
|
+
}[];
|
|
32
|
+
}
|
|
33
|
+
export interface LocalizationCountOptions {
|
|
34
|
+
includeInactive?: boolean;
|
|
35
|
+
queryString?: string;
|
|
36
|
+
}
|
|
3
37
|
export declare const sortDirectionKeys: [keyof typeof SortDirection, ...(keyof typeof SortDirection)[]];
|
|
4
38
|
export declare const LocalizationTypeEnum: z.ZodEnum<{
|
|
5
39
|
COUNTRY: "COUNTRY";
|
|
@@ -22,6 +22,8 @@ export default function getTopCustomers(context: Context, params: Params<'TOP_CU
|
|
|
22
22
|
services: any;
|
|
23
23
|
pushSubscriptions: import("@unchainedshop/core-users").PushSubscriptionObject[];
|
|
24
24
|
username?: string | undefined;
|
|
25
|
+
tokenVersion?: number | undefined;
|
|
26
|
+
oidcLogoutAt?: Date | undefined;
|
|
25
27
|
_id: string;
|
|
26
28
|
} | null;
|
|
27
29
|
currencyCode: string | null;
|
|
@@ -25,6 +25,8 @@ export default function getQuotation(context: Context, params: Params<'GET'>): P
|
|
|
25
25
|
pushSubscriptions: import("@unchainedshop/core-users").PushSubscriptionObject[];
|
|
26
26
|
username?: string;
|
|
27
27
|
meta?: any;
|
|
28
|
+
tokenVersion?: number;
|
|
29
|
+
oidcLogoutAt?: Date;
|
|
28
30
|
created: Date;
|
|
29
31
|
updated?: Date;
|
|
30
32
|
};
|
|
@@ -26,6 +26,8 @@ export default function listQuotations(context: Context, params: Params<'LIST'>)
|
|
|
26
26
|
pushSubscriptions: import("@unchainedshop/core-users").PushSubscriptionObject[];
|
|
27
27
|
username?: string;
|
|
28
28
|
meta?: any;
|
|
29
|
+
tokenVersion?: number;
|
|
30
|
+
oidcLogoutAt?: Date;
|
|
29
31
|
created: Date;
|
|
30
32
|
updated?: Date;
|
|
31
33
|
};
|
|
@@ -26,6 +26,8 @@ export default function makeQuotationProposal(context: Context, params: Params<'
|
|
|
26
26
|
pushSubscriptions: import("@unchainedshop/core-users").PushSubscriptionObject[];
|
|
27
27
|
username?: string;
|
|
28
28
|
meta?: any;
|
|
29
|
+
tokenVersion?: number;
|
|
30
|
+
oidcLogoutAt?: Date;
|
|
29
31
|
created: Date;
|
|
30
32
|
updated?: Date;
|
|
31
33
|
};
|
|
@@ -26,6 +26,8 @@ export default function rejectQuotation(context: Context, params: Params<'REJECT
|
|
|
26
26
|
pushSubscriptions: import("@unchainedshop/core-users").PushSubscriptionObject[];
|
|
27
27
|
username?: string;
|
|
28
28
|
meta?: any;
|
|
29
|
+
tokenVersion?: number;
|
|
30
|
+
oidcLogoutAt?: Date;
|
|
29
31
|
created: Date;
|
|
30
32
|
updated?: Date;
|
|
31
33
|
};
|
|
@@ -26,6 +26,8 @@ export default function verifyQuotation(context: Context, params: Params<'VERIFY
|
|
|
26
26
|
pushSubscriptions: import("@unchainedshop/core-users").PushSubscriptionObject[];
|
|
27
27
|
username?: string;
|
|
28
28
|
meta?: any;
|
|
29
|
+
tokenVersion?: number;
|
|
30
|
+
oidcLogoutAt?: Date;
|
|
29
31
|
created: Date;
|
|
30
32
|
updated?: Date;
|
|
31
33
|
};
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import type { Context } from '../../../../context.ts';
|
|
2
|
-
|
|
2
|
+
export interface EventCountOptions {
|
|
3
|
+
queryString?: string;
|
|
4
|
+
created?: {
|
|
5
|
+
start?: Date;
|
|
6
|
+
end?: Date;
|
|
7
|
+
};
|
|
8
|
+
types?: string[];
|
|
9
|
+
}
|
|
3
10
|
declare const countEvents: ({ modules }: Context, options?: EventCountOptions) => Promise<{
|
|
4
11
|
count: number;
|
|
5
12
|
}>;
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
+
import { type WorkStatus } from '@unchainedshop/core-worker';
|
|
1
2
|
import type { Context } from '../../../../context.ts';
|
|
2
|
-
|
|
3
|
+
export interface WorkCountOptions {
|
|
4
|
+
queryString?: string;
|
|
5
|
+
status?: WorkStatus[];
|
|
6
|
+
created?: {
|
|
7
|
+
start?: Date;
|
|
8
|
+
end?: Date;
|
|
9
|
+
};
|
|
10
|
+
types?: string[];
|
|
11
|
+
}
|
|
3
12
|
declare const countWork: ({ modules }: Context, options?: WorkCountOptions) => Promise<{
|
|
4
13
|
count: number;
|
|
5
14
|
}>;
|
|
@@ -22,10 +22,10 @@ declare const _default: {
|
|
|
22
22
|
WORKER_GET: (context: import("../../../../context.ts").Context, { workId }: import("../schemas.ts").Params<"WORKER_GET">) => Promise<{
|
|
23
23
|
work: any;
|
|
24
24
|
}>;
|
|
25
|
-
WORKER_LIST: (context: import("@unchainedshop/core").UnchainedCore, options?: import("
|
|
25
|
+
WORKER_LIST: (context: import("@unchainedshop/core").UnchainedCore, options?: import("./listWork.ts").WorkListOptions) => Promise<{
|
|
26
26
|
works: any[];
|
|
27
27
|
}>;
|
|
28
|
-
WORKER_COUNT: ({ modules }: import("../../../../context.ts").Context, options?: import("
|
|
28
|
+
WORKER_COUNT: ({ modules }: import("../../../../context.ts").Context, options?: import("./countWork.ts").WorkCountOptions) => Promise<{
|
|
29
29
|
count: number;
|
|
30
30
|
}>;
|
|
31
31
|
WORKER_FINISH_WORK: (context: import("../../../../context.ts").Context, options: import("../schemas.ts").Params<"WORKER_FINISH_WORK">) => Promise<{
|
|
@@ -47,10 +47,10 @@ declare const _default: {
|
|
|
47
47
|
EVENT_GET: ({ modules }: import("../../../../context.ts").Context, { eventId }: import("../schemas.ts").Params<"EVENT_GET">) => Promise<{
|
|
48
48
|
event: import("@unchainedshop/core-events").Event | null;
|
|
49
49
|
}>;
|
|
50
|
-
EVENT_LIST: ({ modules }: import("../../../../context.ts").Context, options?: import("
|
|
50
|
+
EVENT_LIST: ({ modules }: import("../../../../context.ts").Context, options?: import("./listEvents.ts").EventListOptions) => Promise<{
|
|
51
51
|
events: import("@unchainedshop/core-events").Event[];
|
|
52
52
|
}>;
|
|
53
|
-
EVENT_COUNT: ({ modules }: import("../../../../context.ts").Context, options?: import("
|
|
53
|
+
EVENT_COUNT: ({ modules }: import("../../../../context.ts").Context, options?: import("./countEvents.ts").EventCountOptions) => Promise<{
|
|
54
54
|
count: number;
|
|
55
55
|
}>;
|
|
56
56
|
EVENT_STATISTICS: ({ modules }: import("../../../../context.ts").Context, options: import("../schemas.ts").Params<"EVENT_STATISTICS">) => Promise<{
|
|
@@ -1,5 +1,16 @@
|
|
|
1
|
+
import type { SortOption } from '@unchainedshop/utils';
|
|
1
2
|
import type { Context } from '../../../../context.ts';
|
|
2
|
-
|
|
3
|
+
export interface EventListOptions {
|
|
4
|
+
limit?: number;
|
|
5
|
+
offset?: number;
|
|
6
|
+
queryString?: string;
|
|
7
|
+
types?: string[];
|
|
8
|
+
sort?: SortOption[];
|
|
9
|
+
created?: {
|
|
10
|
+
start?: Date;
|
|
11
|
+
end?: Date;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
3
14
|
declare const listEvents: ({ modules }: Context, options?: EventListOptions) => Promise<{
|
|
4
15
|
events: import("@unchainedshop/core-events").Event[];
|
|
5
16
|
}>;
|
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type SortOption } from '@unchainedshop/utils';
|
|
2
|
+
import { type WorkStatus } from '@unchainedshop/core-worker';
|
|
2
3
|
import type { UnchainedCore } from '@unchainedshop/core';
|
|
4
|
+
export interface WorkListOptions {
|
|
5
|
+
limit?: number;
|
|
6
|
+
offset?: number;
|
|
7
|
+
queryString?: string;
|
|
8
|
+
status: WorkStatus[];
|
|
9
|
+
types?: string[];
|
|
10
|
+
sort?: SortOption[];
|
|
11
|
+
created?: {
|
|
12
|
+
start?: Date;
|
|
13
|
+
end?: Date;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
3
16
|
declare const listWork: (context: UnchainedCore, options?: WorkListOptions) => Promise<{
|
|
4
17
|
works: any[];
|
|
5
18
|
}>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { buildObfuscatedFieldsFilter } from '@unchainedshop/utils';
|
|
2
|
+
import {} from '@unchainedshop/core-worker';
|
|
2
3
|
const listWork = async (context, options) => {
|
|
3
4
|
const { modules } = context;
|
|
4
5
|
const removePrivateFieldsFromWork = buildObfuscatedFieldsFilter(context.options.worker?.blacklistedVariables);
|
|
@@ -37,6 +37,8 @@ export default function addUserEmail(context: Context, params: Params<'ADD_EMAIL
|
|
|
37
37
|
pushSubscriptions: import("@unchainedshop/core-users").PushSubscriptionObject[];
|
|
38
38
|
username?: string;
|
|
39
39
|
meta?: any;
|
|
40
|
+
tokenVersion?: number;
|
|
41
|
+
oidcLogoutAt?: Date;
|
|
40
42
|
created: Date;
|
|
41
43
|
updated?: Date;
|
|
42
44
|
} | null;
|
|
@@ -37,6 +37,8 @@ export default function createUser(context: Context, params: Params<'CREATE'>):
|
|
|
37
37
|
pushSubscriptions: import("@unchainedshop/core-users").PushSubscriptionObject[];
|
|
38
38
|
username?: string;
|
|
39
39
|
meta?: any;
|
|
40
|
+
tokenVersion?: number;
|
|
41
|
+
oidcLogoutAt?: Date;
|
|
40
42
|
created: Date;
|
|
41
43
|
updated?: Date;
|
|
42
44
|
} | null;
|
|
@@ -37,6 +37,8 @@ export default function enrollUser(context: Context, params: Params<'ENROLL'>):
|
|
|
37
37
|
pushSubscriptions: import("@unchainedshop/core-users").PushSubscriptionObject[];
|
|
38
38
|
username?: string;
|
|
39
39
|
meta?: any;
|
|
40
|
+
tokenVersion?: number;
|
|
41
|
+
oidcLogoutAt?: Date;
|
|
40
42
|
created: Date;
|
|
41
43
|
updated?: Date;
|
|
42
44
|
} | null;
|
|
@@ -36,6 +36,8 @@ export default function getCurrentUser(context: Context): Promise<{
|
|
|
36
36
|
pushSubscriptions: import("@unchainedshop/core-users").PushSubscriptionObject[];
|
|
37
37
|
username?: string;
|
|
38
38
|
meta?: any;
|
|
39
|
+
tokenVersion?: number;
|
|
40
|
+
oidcLogoutAt?: Date;
|
|
39
41
|
created: Date;
|
|
40
42
|
updated?: Date;
|
|
41
43
|
} | null;
|
|
@@ -37,6 +37,8 @@ export default function getUser(context: Context, params: Params<'GET'>): Promis
|
|
|
37
37
|
pushSubscriptions: import("@unchainedshop/core-users").PushSubscriptionObject[];
|
|
38
38
|
username?: string;
|
|
39
39
|
meta?: any;
|
|
40
|
+
tokenVersion?: number;
|
|
41
|
+
oidcLogoutAt?: Date;
|
|
40
42
|
created: Date;
|
|
41
43
|
updated?: Date;
|
|
42
44
|
} | null;
|
|
@@ -37,6 +37,8 @@ export default function listUsers(context: Context, params: Params<'LIST'>): Pro
|
|
|
37
37
|
pushSubscriptions: import("@unchainedshop/core-users").PushSubscriptionObject[];
|
|
38
38
|
username?: string;
|
|
39
39
|
meta?: any;
|
|
40
|
+
tokenVersion?: number;
|
|
41
|
+
oidcLogoutAt?: Date;
|
|
40
42
|
created: Date;
|
|
41
43
|
updated?: Date;
|
|
42
44
|
} | null)[];
|
|
@@ -37,6 +37,8 @@ export default function setUserTags(context: Context, params: Params<'SET_TAGS'>
|
|
|
37
37
|
pushSubscriptions: import("@unchainedshop/core-users").PushSubscriptionObject[];
|
|
38
38
|
username?: string;
|
|
39
39
|
meta?: any;
|
|
40
|
+
tokenVersion?: number;
|
|
41
|
+
oidcLogoutAt?: Date;
|
|
40
42
|
created: Date;
|
|
41
43
|
updated?: Date;
|
|
42
44
|
} | null;
|
|
@@ -37,6 +37,8 @@ export default function setUserUsername(context: Context, params: Params<'SET_US
|
|
|
37
37
|
pushSubscriptions: import("@unchainedshop/core-users").PushSubscriptionObject[];
|
|
38
38
|
username?: string;
|
|
39
39
|
meta?: any;
|
|
40
|
+
tokenVersion?: number;
|
|
41
|
+
oidcLogoutAt?: Date;
|
|
40
42
|
created: Date;
|
|
41
43
|
updated?: Date;
|
|
42
44
|
} | null;
|
|
@@ -37,6 +37,8 @@ export default function updateUser(context: Context, params: Params<'UPDATE'>):
|
|
|
37
37
|
pushSubscriptions: import("@unchainedshop/core-users").PushSubscriptionObject[];
|
|
38
38
|
username?: string;
|
|
39
39
|
meta?: any;
|
|
40
|
+
tokenVersion?: number;
|
|
41
|
+
oidcLogoutAt?: Date;
|
|
40
42
|
created: Date;
|
|
41
43
|
updated?: Date;
|
|
42
44
|
} | null;
|
|
@@ -24,6 +24,8 @@ export declare function getNormalizedQuotationDetails(quotationId: string, conte
|
|
|
24
24
|
pushSubscriptions: import("@unchainedshop/core-users").PushSubscriptionObject[];
|
|
25
25
|
username?: string;
|
|
26
26
|
meta?: any;
|
|
27
|
+
tokenVersion?: number;
|
|
28
|
+
oidcLogoutAt?: Date;
|
|
27
29
|
created: Date;
|
|
28
30
|
updated?: Date;
|
|
29
31
|
};
|
|
@@ -35,6 +35,8 @@ export declare function getNormalizedUserDetails(userId: string, context: Contex
|
|
|
35
35
|
pushSubscriptions: import("@unchainedshop/core-users").PushSubscriptionObject[];
|
|
36
36
|
username?: string;
|
|
37
37
|
meta?: any;
|
|
38
|
+
tokenVersion?: number;
|
|
39
|
+
oidcLogoutAt?: Date;
|
|
38
40
|
created: Date;
|
|
39
41
|
updated?: Date;
|
|
40
42
|
} | null>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LocalizationType, LocalizationEntity, LocalizationUpdateEntity } from '../tools/localization/
|
|
1
|
+
import type { LocalizationType, LocalizationEntity, LocalizationUpdateEntity } from '../tools/localization/schemas.ts';
|
|
2
2
|
declare const sanitizeEntityData: (localizationType: LocalizationType, entity: LocalizationEntity | LocalizationUpdateEntity) => {
|
|
3
3
|
isoCode: string;
|
|
4
4
|
contractAddress?: string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { LocalizationType } from '../tools/localization/
|
|
1
|
+
import type { LocalizationType } from '../tools/localization/schemas.ts';
|
|
2
2
|
declare const validateIsoCode: (localizationType: LocalizationType, isoCode: string) => string;
|
|
3
3
|
export default validateIsoCode;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
2
|
logout: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
3
|
+
logoutAllSessions: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
3
4
|
loginAsGuest: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
4
5
|
impersonate: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
5
6
|
stopImpersonation: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
@@ -85,12 +86,6 @@ declare const _default: {
|
|
|
85
86
|
updateCartDeliveryShipping: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
86
87
|
updateCartPaymentGeneric: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
87
88
|
updateCartPaymentInvoice: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
88
|
-
setOrderPaymentProvider: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
89
|
-
setOrderDeliveryProvider: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
90
|
-
updateOrderDeliveryShipping: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
91
|
-
updateOrderDeliveryPickUp: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
92
|
-
updateOrderPaymentGeneric: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
93
|
-
updateOrderPaymentInvoice: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
94
89
|
removeOrder: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
95
90
|
confirmOrder: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
96
91
|
rejectOrder: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
|
|
@@ -4,6 +4,7 @@ import loginWithPassword from "./accounts/loginWithPassword.js";
|
|
|
4
4
|
import loginWithWebAuthn from "./accounts/loginWithWebAuthn.js";
|
|
5
5
|
import loginAsGuest from "./accounts/loginAsGuest.js";
|
|
6
6
|
import logout from "./accounts/logout.js";
|
|
7
|
+
import logoutAllSessions from "./accounts/logoutAllSessions.js";
|
|
7
8
|
import impersonate from "./accounts/impersonate.js";
|
|
8
9
|
import stopImpersonation from "./accounts/stopImpersonation.js";
|
|
9
10
|
import changePassword from "./accounts/changePassword.js";
|
|
@@ -69,8 +70,6 @@ import updateCartItem from "./orders/updateCartItem.js";
|
|
|
69
70
|
import removeCartItem from "./orders/removeCartItem.js";
|
|
70
71
|
import removeCartDiscount from "./orders/removeCartDiscount.js";
|
|
71
72
|
import removeOrder from "./orders/removeOrder.js";
|
|
72
|
-
import setOrderPaymentProvider from "./orders/setOrderPaymentProvider.js";
|
|
73
|
-
import setOrderDeliveryProvider from "./orders/setOrderDeliveryProvider.js";
|
|
74
73
|
import confirmOrder from "./orders/confirmOrder.js";
|
|
75
74
|
import payOrder from "./orders/payOrder.js";
|
|
76
75
|
import deliverOrder from "./orders/deliverOrder.js";
|
|
@@ -134,10 +133,6 @@ import updateEnrollment from "./enrollments/updateEnrollment.js";
|
|
|
134
133
|
import registerPaymentCredentials from "./payment/registerPaymentCredentials.js";
|
|
135
134
|
import markPaymentCredentialsPreferred from "./payment/markPaymentCredentialsPreferred.js";
|
|
136
135
|
import removePaymentCredentials from "./payment/removePaymentCredentials.js";
|
|
137
|
-
import updateOrderDeliveryShipping from "./orders/updateOrderDeliveryShipping.js";
|
|
138
|
-
import updateOrderDeliveryPickUp from "./orders/updateOrderDeliveryPickUp.js";
|
|
139
|
-
import updateOrderPaymentGeneric from "./orders/updateOrderPaymentGeneric.js";
|
|
140
|
-
import updateOrderPaymentInvoice from "./orders/updateOrderPaymentInvoice.js";
|
|
141
136
|
import signPaymentProviderForCredentialRegistration from "./payment/signPaymentProviderForCredentialRegistration.js";
|
|
142
137
|
import signPaymentProviderForCheckout from "./orders/signPaymentProviderForCheckout.js";
|
|
143
138
|
import pageView from "./pageView.js";
|
|
@@ -157,6 +152,7 @@ import updateCartPaymentGeneric from "./orders/updateCartPaymentGeneric.js";
|
|
|
157
152
|
import updateCartPaymentInvoice from "./orders/updateCartPaymentInvoice.js";
|
|
158
153
|
export default {
|
|
159
154
|
logout: acl(actions.logout)(logout),
|
|
155
|
+
logoutAllSessions: acl(actions.logoutAllSessions)(logoutAllSessions),
|
|
160
156
|
loginAsGuest: acl(actions.loginAsGuest)(loginAsGuest),
|
|
161
157
|
impersonate: acl(actions.impersonate)(impersonate),
|
|
162
158
|
stopImpersonation: acl(actions.stopImpersonation)(stopImpersonation),
|
|
@@ -242,12 +238,6 @@ export default {
|
|
|
242
238
|
updateCartDeliveryShipping: acl(actions.updateCart)(updateCartDeliveryShipping),
|
|
243
239
|
updateCartPaymentGeneric: acl(actions.updateCart)(updateCartPaymentGeneric),
|
|
244
240
|
updateCartPaymentInvoice: acl(actions.updateCart)(updateCartPaymentInvoice),
|
|
245
|
-
setOrderPaymentProvider: acl(actions.updateOrder)(setOrderPaymentProvider),
|
|
246
|
-
setOrderDeliveryProvider: acl(actions.updateOrder)(setOrderDeliveryProvider),
|
|
247
|
-
updateOrderDeliveryShipping: acl(actions.updateOrderDelivery)(updateOrderDeliveryShipping),
|
|
248
|
-
updateOrderDeliveryPickUp: acl(actions.updateOrderDelivery)(updateOrderDeliveryPickUp),
|
|
249
|
-
updateOrderPaymentGeneric: acl(actions.updateOrderPayment)(updateOrderPaymentGeneric),
|
|
250
|
-
updateOrderPaymentInvoice: acl(actions.updateOrderPayment)(updateOrderPaymentInvoice),
|
|
251
241
|
removeOrder: acl(actions.updateOrder)(removeOrder),
|
|
252
242
|
confirmOrder: acl(actions.markOrderConfirmed)(confirmOrder),
|
|
253
243
|
rejectOrder: acl(actions.markOrderRejected)(rejectOrder),
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { log } from '@unchainedshop/logger';
|
|
2
|
-
import { OrderNotFoundError, OrderWrongStatusError } from "../../../errors.js";
|
|
2
|
+
import { InvalidIdError, OrderNotFoundError, OrderWrongStatusError } from "../../../errors.js";
|
|
3
3
|
export default async function updateCart(root, params, context) {
|
|
4
4
|
const { orderId, billingAddress, contact, paymentProviderId, deliveryProviderId, meta } = params;
|
|
5
5
|
const { modules, services, userId, user } = context;
|
|
6
6
|
log('mutation updateCart', { userId });
|
|
7
|
+
if (orderId === '')
|
|
8
|
+
throw new InvalidIdError({ orderId });
|
|
9
|
+
if (paymentProviderId === '')
|
|
10
|
+
throw new InvalidIdError({ paymentProviderId });
|
|
11
|
+
if (deliveryProviderId === '')
|
|
12
|
+
throw new InvalidIdError({ deliveryProviderId });
|
|
7
13
|
const order = await services.orders.findOrInitCart({
|
|
8
14
|
orderId,
|
|
9
15
|
user: user,
|
|
@@ -2,6 +2,8 @@ import { log } from '@unchainedshop/logger';
|
|
|
2
2
|
export default async function orders(root, params, { modules, userId }) {
|
|
3
3
|
const { limit, offset, paymentProviderIds, deliveryProviderIds, ...restParams } = params;
|
|
4
4
|
log(`query orders: ${limit} ${offset} ${restParams?.queryString || ''}`, { userId });
|
|
5
|
+
const promises = [];
|
|
6
|
+
await Promise.all(promises);
|
|
5
7
|
const [orderPayments, orderDeliveries] = await Promise.all([
|
|
6
8
|
paymentProviderIds?.length
|
|
7
9
|
? modules.orders.payments.findOrderPaymentsByProviderIds({ paymentProviderIds })
|
|
@@ -17,8 +19,6 @@ export default async function orders(root, params, { modules, userId }) {
|
|
|
17
19
|
const deliveryIds = orderDeliveries.map((d) => d._id);
|
|
18
20
|
return modules.orders.findOrders({
|
|
19
21
|
...restParams,
|
|
20
|
-
limit,
|
|
21
|
-
offset,
|
|
22
22
|
paymentIds,
|
|
23
23
|
deliveryIds,
|
|
24
24
|
});
|
|
@@ -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,
|
package/lib/roles/index.js
CHANGED
package/lib/roles/loggedIn.js
CHANGED
|
@@ -172,4 +172,5 @@ export const loggedIn = (role, actions) => {
|
|
|
172
172
|
role.allow(actions.downloadFile, isFileAccessible);
|
|
173
173
|
role.allow(actions.uploadUserAvatar, canUpdateAvatar);
|
|
174
174
|
role.allow(actions.uploadTempFile, canUpdateAvatar);
|
|
175
|
+
role.allow(actions.logoutAllSessions, () => true);
|
|
175
176
|
};
|
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
|
"""
|
|
@@ -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,
|