@unchainedshop/api 4.8.1 → 4.8.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.
@@ -43,8 +43,9 @@ export default async function bulkImportMiddleware(req, res) {
43
43
  res.status(200).send(work);
44
44
  }
45
45
  catch (e) {
46
- logger.error(e);
47
- res.status(503).send({ name: e.name, code: e.code, message: e.message });
46
+ logger.error(e.message);
47
+ const cause = e.cause?.issues || e.cause;
48
+ res.status(503).send({ name: e.name, code: e.code, message: e.message, cause });
48
49
  return;
49
50
  }
50
51
  }
@@ -37,9 +37,10 @@ const bulkImportHandler = async (req, res) => {
37
37
  return res.send(work);
38
38
  }
39
39
  catch (e) {
40
- logger.error(e);
40
+ logger.error(e.message);
41
41
  res.status(503);
42
- return res.send({ name: e.name, code: e.code, message: e.message });
42
+ const cause = e.cause?.issues || e.cause;
43
+ return res.send({ name: e.name, code: e.code, message: e.message, cause });
43
44
  }
44
45
  };
45
46
  export default bulkImportHandler;
@@ -1,6 +1,6 @@
1
1
  import { log } from '@unchainedshop/logger';
2
2
  export default async function addWork(root, workData, { modules, userId }) {
3
- const { type, input } = workData;
4
- log(`mutation addWork ${type} ${JSON.stringify(input)}`, { userId });
3
+ const { type, priority, retries, worker } = workData;
4
+ log(`mutation addWork ${type}`, { userId, priority, retries, worker });
5
5
  return modules.worker.addWork(workData);
6
6
  }
@@ -0,0 +1 @@
1
+ export default function registeredEventTypes(): string[];
@@ -0,0 +1,4 @@
1
+ import { getRegisteredEvents } from '@unchainedshop/events';
2
+ export default function registeredEventTypes() {
3
+ return getRegisteredEvents();
4
+ }
@@ -68,6 +68,7 @@ declare const _default: {
68
68
  event: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
69
69
  events: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
70
70
  eventsCount: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
71
+ registeredEventTypes: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
71
72
  validateResetPasswordToken: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
72
73
  validateVerifyEmailToken: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
73
74
  workStatistics: (root: any, params: any, context: any, ...other: any[]) => Promise<any>;
@@ -70,6 +70,7 @@ import workQueueCount from "./worker/workQueueCount.js";
70
70
  import validateResetPasswordToken from "./users/validateResetPasswordToken.js";
71
71
  import validateVerifyEmailToken from "./users/validateVerifyEmailToken.js";
72
72
  import eventStatistics from "./events/eventStatistics.js";
73
+ import registeredEventTypes from "./events/registeredEventTypes.js";
73
74
  import orderStatistics from "./orders/orderStatistics.js";
74
75
  import impersonator from "./users/impersonator.js";
75
76
  export default {
@@ -140,6 +141,7 @@ export default {
140
141
  event: acl(actions.viewEvent)(event),
141
142
  events: acl(actions.viewEvents)(events),
142
143
  eventsCount: acl(actions.viewEvents)(eventsCount),
144
+ registeredEventTypes: acl(actions.viewEvents)(registeredEventTypes),
143
145
  validateResetPasswordToken: acl(actions.resetPassword)(validateResetPasswordToken),
144
146
  validateVerifyEmailToken: acl(actions.verifyEmail)(validateVerifyEmailToken),
145
147
  workStatistics: acl(actions.viewStatistics)(workStatistics),
@@ -491,6 +491,11 @@ 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
+
494
499
  """
495
500
  Determines if a token is valid/active for reset password
496
501
  """
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unchainedshop/api",
3
3
  "description": "GraphQL API layer for the Unchained Engine with Express/Fastify adapters and MCP server",
4
- "version": "4.8.1",
4
+ "version": "4.8.2",
5
5
  "main": "lib/api-index.js",
6
6
  "types": "lib/api-index.d.ts",
7
7
  "type": "module",