@unchainedshop/api 4.7.2 → 4.8.0

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.
Files changed (52) hide show
  1. package/lib/acl.js +1 -29
  2. package/lib/api-index.d.ts +0 -1
  3. package/lib/context.d.ts +0 -1
  4. package/lib/context.js +3 -8
  5. package/lib/events.d.ts +0 -2
  6. package/lib/events.js +0 -2
  7. package/lib/express/index.d.ts +9 -6
  8. package/lib/express/index.js +125 -52
  9. package/lib/fastify/index.d.ts +9 -6
  10. package/lib/fastify/index.js +113 -51
  11. package/lib/mcp/tools/localization/getLocalizationsConfig.d.ts +1 -1
  12. package/lib/mcp/tools/localization/schemas.d.ts +0 -34
  13. package/lib/mcp/tools/order/handlers/getTopCustomers.d.ts +0 -2
  14. package/lib/mcp/tools/quotation/handlers/getQuotation.d.ts +0 -2
  15. package/lib/mcp/tools/quotation/handlers/listQuotations.d.ts +0 -2
  16. package/lib/mcp/tools/quotation/handlers/makeQuotationProposal.d.ts +0 -2
  17. package/lib/mcp/tools/quotation/handlers/rejectQuotation.d.ts +0 -2
  18. package/lib/mcp/tools/quotation/handlers/verifyQuotation.d.ts +0 -2
  19. package/lib/mcp/tools/system/handlers/countEvents.d.ts +1 -8
  20. package/lib/mcp/tools/system/handlers/countWork.d.ts +1 -10
  21. package/lib/mcp/tools/system/handlers/countWork.js +0 -1
  22. package/lib/mcp/tools/system/handlers/index.d.ts +4 -4
  23. package/lib/mcp/tools/system/handlers/listEvents.d.ts +1 -12
  24. package/lib/mcp/tools/system/handlers/listWork.d.ts +1 -14
  25. package/lib/mcp/tools/system/handlers/listWork.js +0 -1
  26. package/lib/mcp/tools/users/handlers/addUserEmail.d.ts +0 -2
  27. package/lib/mcp/tools/users/handlers/createUser.d.ts +0 -2
  28. package/lib/mcp/tools/users/handlers/enrollUser.d.ts +0 -2
  29. package/lib/mcp/tools/users/handlers/getCurrentUser.d.ts +0 -2
  30. package/lib/mcp/tools/users/handlers/getUser.d.ts +0 -2
  31. package/lib/mcp/tools/users/handlers/listUsers.d.ts +0 -2
  32. package/lib/mcp/tools/users/handlers/setUserTags.d.ts +0 -2
  33. package/lib/mcp/tools/users/handlers/setUserUsername.d.ts +0 -2
  34. package/lib/mcp/tools/users/handlers/updateUser.d.ts +0 -2
  35. package/lib/mcp/utils/getNormalizedQuotationDetails.d.ts +0 -2
  36. package/lib/mcp/utils/getNormalizedUserDetails.d.ts +0 -2
  37. package/lib/mcp/utils/normalizeMediaUrl.js +1 -1
  38. package/lib/mcp/utils/sanitizeLocalizationEntityData.d.ts +1 -1
  39. package/lib/mcp/utils/validateIsoCode.d.ts +1 -1
  40. package/lib/resolvers/mutations/index.d.ts +6 -1
  41. package/lib/resolvers/mutations/index.js +12 -2
  42. package/lib/resolvers/mutations/orders/updateCart.js +1 -7
  43. package/lib/resolvers/queries/orders/orders.js +2 -2
  44. package/lib/resolvers/type/index.d.ts +1 -0
  45. package/lib/resolvers/type/order/order-delivery-pickup-types.d.ts +1 -0
  46. package/lib/resolvers/type/order/order-delivery-pickup-types.js +7 -0
  47. package/lib/roles/index.js +0 -1
  48. package/lib/roles/loggedIn.js +0 -1
  49. package/lib/schema/mutation.js +44 -6
  50. package/lib/schema/types/index.js +2 -2
  51. package/lib/schema/types/order/delivery.js +2 -0
  52. package/package.json +17 -8
@@ -22,8 +22,6 @@ 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;
27
25
  _id: string;
28
26
  } | null;
29
27
  currencyCode: string | null;
@@ -25,8 +25,6 @@ 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;
30
28
  created: Date;
31
29
  updated?: Date;
32
30
  };
@@ -26,8 +26,6 @@ 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;
31
29
  created: Date;
32
30
  updated?: Date;
33
31
  };
@@ -26,8 +26,6 @@ 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;
31
29
  created: Date;
32
30
  updated?: Date;
33
31
  };
@@ -26,8 +26,6 @@ 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;
31
29
  created: Date;
32
30
  updated?: Date;
33
31
  };
@@ -26,8 +26,6 @@ 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;
31
29
  created: Date;
32
30
  updated?: Date;
33
31
  };
@@ -1,12 +1,5 @@
1
1
  import type { Context } from '../../../../context.ts';
2
- export interface EventCountOptions {
3
- queryString?: string;
4
- created?: {
5
- start?: Date;
6
- end?: Date;
7
- };
8
- types?: string[];
9
- }
2
+ import type { EventCountOptions } from '../types.ts';
10
3
  declare const countEvents: ({ modules }: Context, options?: EventCountOptions) => Promise<{
11
4
  count: number;
12
5
  }>;
@@ -1,14 +1,5 @@
1
- import { type WorkStatus } from '@unchainedshop/core-worker';
2
1
  import type { Context } from '../../../../context.ts';
3
- export interface WorkCountOptions {
4
- queryString?: string;
5
- status?: WorkStatus[];
6
- created?: {
7
- start?: Date;
8
- end?: Date;
9
- };
10
- types?: string[];
11
- }
2
+ import type { WorkCountOptions } from '../types.ts';
12
3
  declare const countWork: ({ modules }: Context, options?: WorkCountOptions) => Promise<{
13
4
  count: number;
14
5
  }>;
@@ -1,4 +1,3 @@
1
- import {} from '@unchainedshop/core-worker';
2
1
  const countWork = async ({ modules }, options) => {
3
2
  const countOptions = options || {};
4
3
  const count = await modules.worker.count({
@@ -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("./listWork.ts").WorkListOptions) => Promise<{
25
+ WORKER_LIST: (context: import("@unchainedshop/core").UnchainedCore, options?: import("../types.ts").WorkListOptions) => Promise<{
26
26
  works: any[];
27
27
  }>;
28
- WORKER_COUNT: ({ modules }: import("../../../../context.ts").Context, options?: import("./countWork.ts").WorkCountOptions) => Promise<{
28
+ WORKER_COUNT: ({ modules }: import("../../../../context.ts").Context, options?: import("../types.ts").WorkCountOptions) => Promise<{
29
29
  count: number;
30
30
  }>;
31
31
  WORKER_FINISH_WORK: (context: import("../../../../context.ts").Context, options: import("../schemas.ts").Params<"WORKER_FINISH_WORK">) => Promise<{
@@ -47,10 +47,10 @@ declare const _default: {
47
47
  EVENT_GET: ({ modules }: import("../../../../context.ts").Context, { eventId }: import("../schemas.ts").Params<"EVENT_GET">) => Promise<{
48
48
  event: import("@unchainedshop/core-events").Event | null;
49
49
  }>;
50
- EVENT_LIST: ({ modules }: import("../../../../context.ts").Context, options?: import("./listEvents.ts").EventListOptions) => Promise<{
50
+ EVENT_LIST: ({ modules }: import("../../../../context.ts").Context, options?: import("../types.ts").EventListOptions) => Promise<{
51
51
  events: import("@unchainedshop/core-events").Event[];
52
52
  }>;
53
- EVENT_COUNT: ({ modules }: import("../../../../context.ts").Context, options?: import("./countEvents.ts").EventCountOptions) => Promise<{
53
+ EVENT_COUNT: ({ modules }: import("../../../../context.ts").Context, options?: import("../types.ts").EventCountOptions) => Promise<{
54
54
  count: number;
55
55
  }>;
56
56
  EVENT_STATISTICS: ({ modules }: import("../../../../context.ts").Context, options: import("../schemas.ts").Params<"EVENT_STATISTICS">) => Promise<{
@@ -1,16 +1,5 @@
1
- import type { SortOption } from '@unchainedshop/utils';
2
1
  import type { Context } from '../../../../context.ts';
3
- 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
- }
2
+ import type { EventListOptions } from '../types.ts';
14
3
  declare const listEvents: ({ modules }: Context, options?: EventListOptions) => Promise<{
15
4
  events: import("@unchainedshop/core-events").Event[];
16
5
  }>;
@@ -1,18 +1,5 @@
1
- import { type SortOption } from '@unchainedshop/utils';
2
- import { type WorkStatus } from '@unchainedshop/core-worker';
1
+ import type { WorkListOptions } from '../types.ts';
3
2
  import type { UnchainedCore } from '@unchainedshop/core';
4
- export interface WorkListOptions {
5
- limit?: number;
6
- offset?: number;
7
- queryString?: string;
8
- status: WorkStatus[];
9
- types?: string[];
10
- sort?: SortOption[];
11
- created?: {
12
- start?: Date;
13
- end?: Date;
14
- };
15
- }
16
3
  declare const listWork: (context: UnchainedCore, options?: WorkListOptions) => Promise<{
17
4
  works: any[];
18
5
  }>;
@@ -1,5 +1,4 @@
1
1
  import { buildObfuscatedFieldsFilter } from '@unchainedshop/utils';
2
- import {} from '@unchainedshop/core-worker';
3
2
  const listWork = async (context, options) => {
4
3
  const { modules } = context;
5
4
  const removePrivateFieldsFromWork = buildObfuscatedFieldsFilter(context.options.worker?.blacklistedVariables);
@@ -37,8 +37,6 @@ 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;
42
40
  created: Date;
43
41
  updated?: Date;
44
42
  } | null;
@@ -37,8 +37,6 @@ 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;
42
40
  created: Date;
43
41
  updated?: Date;
44
42
  } | null;
@@ -37,8 +37,6 @@ 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;
42
40
  created: Date;
43
41
  updated?: Date;
44
42
  } | null;
@@ -36,8 +36,6 @@ 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;
41
39
  created: Date;
42
40
  updated?: Date;
43
41
  } | null;
@@ -37,8 +37,6 @@ 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;
42
40
  created: Date;
43
41
  updated?: Date;
44
42
  } | null;
@@ -37,8 +37,6 @@ 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;
42
40
  created: Date;
43
41
  updated?: Date;
44
42
  } | null)[];
@@ -37,8 +37,6 @@ 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;
42
40
  created: Date;
43
41
  updated?: Date;
44
42
  } | null;
@@ -37,8 +37,6 @@ 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;
42
40
  created: Date;
43
41
  updated?: Date;
44
42
  } | null;
@@ -37,8 +37,6 @@ 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;
42
40
  created: Date;
43
41
  updated?: Date;
44
42
  } | null;
@@ -24,8 +24,6 @@ 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;
29
27
  created: Date;
30
28
  updated?: Date;
31
29
  };
@@ -35,8 +35,6 @@ 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;
40
38
  created: Date;
41
39
  updated?: Date;
42
40
  } | null>;
@@ -1,4 +1,4 @@
1
- import { getFileAdapter } from '@unchainedshop/core';
1
+ import { getFileAdapter } from '@unchainedshop/core-files';
2
2
  const normalizeMediaUrl = async (medias = [], context) => {
3
3
  if (medias?.length) {
4
4
  const normalizedMedias = await Promise.all(medias
@@ -1,4 +1,4 @@
1
- import type { LocalizationType, LocalizationEntity, LocalizationUpdateEntity } from '../tools/localization/schemas.ts';
1
+ import type { LocalizationType, LocalizationEntity, LocalizationUpdateEntity } from '../tools/localization/types.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/schemas.ts';
1
+ import type { LocalizationType } from '../tools/localization/types.ts';
2
2
  declare const validateIsoCode: (localizationType: LocalizationType, isoCode: string) => string;
3
3
  export default validateIsoCode;
@@ -1,6 +1,5 @@
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>;
4
3
  loginAsGuest: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
5
4
  impersonate: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
6
5
  stopImpersonation: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
@@ -86,6 +85,12 @@ declare const _default: {
86
85
  updateCartDeliveryShipping: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
87
86
  updateCartPaymentGeneric: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
88
87
  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>;
89
94
  removeOrder: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
90
95
  confirmOrder: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
91
96
  rejectOrder: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
@@ -4,7 +4,6 @@ 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";
8
7
  import impersonate from "./accounts/impersonate.js";
9
8
  import stopImpersonation from "./accounts/stopImpersonation.js";
10
9
  import changePassword from "./accounts/changePassword.js";
@@ -70,6 +69,8 @@ import updateCartItem from "./orders/updateCartItem.js";
70
69
  import removeCartItem from "./orders/removeCartItem.js";
71
70
  import removeCartDiscount from "./orders/removeCartDiscount.js";
72
71
  import removeOrder from "./orders/removeOrder.js";
72
+ import setOrderPaymentProvider from "./orders/setOrderPaymentProvider.js";
73
+ import setOrderDeliveryProvider from "./orders/setOrderDeliveryProvider.js";
73
74
  import confirmOrder from "./orders/confirmOrder.js";
74
75
  import payOrder from "./orders/payOrder.js";
75
76
  import deliverOrder from "./orders/deliverOrder.js";
@@ -133,6 +134,10 @@ import updateEnrollment from "./enrollments/updateEnrollment.js";
133
134
  import registerPaymentCredentials from "./payment/registerPaymentCredentials.js";
134
135
  import markPaymentCredentialsPreferred from "./payment/markPaymentCredentialsPreferred.js";
135
136
  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";
136
141
  import signPaymentProviderForCredentialRegistration from "./payment/signPaymentProviderForCredentialRegistration.js";
137
142
  import signPaymentProviderForCheckout from "./orders/signPaymentProviderForCheckout.js";
138
143
  import pageView from "./pageView.js";
@@ -152,7 +157,6 @@ import updateCartPaymentGeneric from "./orders/updateCartPaymentGeneric.js";
152
157
  import updateCartPaymentInvoice from "./orders/updateCartPaymentInvoice.js";
153
158
  export default {
154
159
  logout: acl(actions.logout)(logout),
155
- logoutAllSessions: acl(actions.logoutAllSessions)(logoutAllSessions),
156
160
  loginAsGuest: acl(actions.loginAsGuest)(loginAsGuest),
157
161
  impersonate: acl(actions.impersonate)(impersonate),
158
162
  stopImpersonation: acl(actions.stopImpersonation)(stopImpersonation),
@@ -238,6 +242,12 @@ export default {
238
242
  updateCartDeliveryShipping: acl(actions.updateCart)(updateCartDeliveryShipping),
239
243
  updateCartPaymentGeneric: acl(actions.updateCart)(updateCartPaymentGeneric),
240
244
  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),
241
251
  removeOrder: acl(actions.updateOrder)(removeOrder),
242
252
  confirmOrder: acl(actions.markOrderConfirmed)(confirmOrder),
243
253
  rejectOrder: acl(actions.markOrderRejected)(rejectOrder),
@@ -1,15 +1,9 @@
1
1
  import { log } from '@unchainedshop/logger';
2
- import { InvalidIdError, OrderNotFoundError, OrderWrongStatusError } from "../../../errors.js";
2
+ import { 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 });
13
7
  const order = await services.orders.findOrInitCart({
14
8
  orderId,
15
9
  user: user,
@@ -2,8 +2,6 @@ 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);
7
5
  const [orderPayments, orderDeliveries] = await Promise.all([
8
6
  paymentProviderIds?.length
9
7
  ? modules.orders.payments.findOrderPaymentsByProviderIds({ paymentProviderIds })
@@ -19,6 +17,8 @@ export default async function orders(root, params, { modules, userId }) {
19
17
  const deliveryIds = orderDeliveries.map((d) => d._id);
20
18
  return modules.orders.findOrders({
21
19
  ...restParams,
20
+ limit,
21
+ offset,
22
22
  paymentIds,
23
23
  deliveryIds,
24
24
  });
@@ -330,6 +330,7 @@ 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[]>;
333
334
  provider(obj: import("@unchainedshop/core-orders").OrderDelivery, _: never, { loaders }: import("../../context.ts").Context): Promise<import("@unchainedshop/core-delivery").DeliveryProvider>;
334
335
  status(obj: import("@unchainedshop/core-orders").OrderDelivery, _: never, { modules }: import("../../context.ts").Context): import("@unchainedshop/core-orders").OrderDeliveryStatus;
335
336
  discounts(obj: import("@unchainedshop/core-orders").OrderDelivery, _: never, { loaders }: import("../../context.ts").Context): Promise<{
@@ -2,6 +2,7 @@ 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[]>;
5
6
  provider(obj: OrderDelivery, _: never, { loaders }: Context): Promise<import("@unchainedshop/core-delivery").DeliveryProvider>;
6
7
  status(obj: OrderDelivery, _: never, { modules }: Context): import("@unchainedshop/core-orders").OrderDeliveryStatus;
7
8
  discounts(obj: OrderDelivery, _: never, { loaders }: Context): Promise<{
@@ -8,6 +8,13 @@ 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
+ },
11
18
  async provider(obj, _, { loaders }) {
12
19
  return loaders.deliveryProviderLoader.load({
13
20
  deliveryProviderId: obj.deliveryProviderId,
@@ -101,7 +101,6 @@ const actions = [
101
101
  'managePaymentCredentials',
102
102
  'bulkImport',
103
103
  'logout',
104
- 'logoutAllSessions',
105
104
  'loginAsGuest',
106
105
  'loginWithPassword',
107
106
  'loginWithWebAuthn',
@@ -172,5 +172,4 @@ 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);
176
175
  };
@@ -57,12 +57,6 @@ 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
-
66
60
  """
67
61
  Impersonate a user
68
62
  """
@@ -227,6 +221,20 @@ export default [
227
221
  """
228
222
  terminateEnrollment(enrollmentId: ID!): Enrollment!
229
223
 
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
+
230
238
  """
231
239
  Update the cart by changing the delivery provider and using a shipping specific configuration
232
240
  """
@@ -257,6 +265,36 @@ export default [
257
265
  """
258
266
  updateCartPaymentGeneric(orderId: ID, paymentProviderId: ID!, meta: JSON): Order!
259
267
 
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
+
260
298
  """
261
299
  Remove an order while it's still open
262
300
  """
@@ -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 common from "./common.js";
18
+ import types from "./types.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
- ...common,
49
+ ...types,
50
50
  ...user,
51
51
  ...warehousing,
52
52
  ...product,
@@ -33,6 +33,8 @@ export default [
33
33
  delivered: DateTime
34
34
  fee: Price
35
35
  discounts: [OrderDeliveryDiscount!]
36
+ pickUpLocations: [PickUpLocation!]!
37
+ @deprecated(reason: "Use DeliveryProvider.pickupLocations instead")
36
38
  activePickUpLocation: PickUpLocation
37
39
  }
38
40