@chevre/domain 28.1.0-alpha.4 → 28.1.0-alpha.6

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 (97) hide show
  1. package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +1 -1
  2. package/lib/chevre/repo/mongoose/schemas/setting.d.ts +28 -36
  3. package/lib/chevre/repo/mongoose/schemas/setting.js +9 -6
  4. package/lib/chevre/repo/mongoose/schemas/transactionNumber.d.ts +1 -2
  5. package/lib/chevre/repo/mongoose/schemas/transactionNumber.js +1 -1
  6. package/lib/chevre/repo/setting/integration.d.ts +2 -0
  7. package/lib/chevre/repo/setting/integration.js +53 -0
  8. package/lib/chevre/repo/setting.d.ts +1 -1
  9. package/lib/chevre/service/assetTransaction/reserve/cancel.d.ts +3 -4
  10. package/lib/chevre/service/assetTransaction/reserve/cancel.js +1 -3
  11. package/lib/chevre/service/assetTransaction/reserve/confirm.d.ts +3 -4
  12. package/lib/chevre/service/assetTransaction/reserve/confirm.js +1 -3
  13. package/lib/chevre/service/assetTransaction/reserve/start.d.ts +3 -2
  14. package/lib/chevre/service/notification/triggerWebhook/processInformAction.d.ts +1 -3
  15. package/lib/chevre/service/notification/triggerWebhook/processInformAction.js +3 -3
  16. package/lib/chevre/service/notification/triggerWebhook.js +4 -4
  17. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +3 -2
  18. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.js +2 -6
  19. package/lib/chevre/service/offer/event/authorize.d.ts +3 -2
  20. package/lib/chevre/service/offer/event/authorize.js +2 -2
  21. package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.d.ts +3 -4
  22. package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.js +2 -2
  23. package/lib/chevre/service/offer/event/voidTransaction.d.ts +3 -4
  24. package/lib/chevre/service/offer/event/voidTransaction.js +3 -3
  25. package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +3 -4
  26. package/lib/chevre/service/offer/event/voidTransactionByActionId.js +2 -2
  27. package/lib/chevre/service/offer/onEventChanged.js +4 -4
  28. package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionCanceled.d.ts +0 -2
  29. package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.d.ts +3 -4
  30. package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.js +2 -2
  31. package/lib/chevre/service/order/onAssetTransactionStatusChanged/onReserveTransactionConfirmed.d.ts +0 -2
  32. package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.d.ts +3 -4
  33. package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.js +2 -2
  34. package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +2 -2
  35. package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +1 -1
  36. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.d.ts +2 -2
  37. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.js +1 -1
  38. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.d.ts +2 -2
  39. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +1 -1
  40. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +2 -2
  41. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.js +1 -1
  42. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.d.ts +2 -2
  43. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.js +2 -4
  44. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.d.ts +2 -2
  45. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +1 -1
  46. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +3 -4
  47. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +3 -3
  48. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +2 -2
  49. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +1 -1
  50. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.d.ts +2 -2
  51. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +1 -1
  52. package/lib/chevre/service/order/onOrderUpdated/factory.d.ts +2 -2
  53. package/lib/chevre/service/order/onOrderUpdated/factory.js +1 -1
  54. package/lib/chevre/service/order/onOrderUpdated.d.ts +2 -2
  55. package/lib/chevre/service/order/onOrderUpdated.js +1 -1
  56. package/lib/chevre/service/order/payOrder.d.ts +3 -4
  57. package/lib/chevre/service/order/payOrder.js +2 -2
  58. package/lib/chevre/service/order/placeOrder.d.ts +3 -4
  59. package/lib/chevre/service/order/placeOrder.js +2 -2
  60. package/lib/chevre/service/order/returnOrder.d.ts +2 -2
  61. package/lib/chevre/service/order/sendOrder.d.ts +2 -2
  62. package/lib/chevre/service/reserve/cancelReservation.d.ts +3 -3
  63. package/lib/chevre/service/reserve/checkInReservation.d.ts +2 -2
  64. package/lib/chevre/service/reserve/confirmReservation.d.ts +2 -2
  65. package/lib/chevre/service/reserve/potentialActions/onPendingReservationCanceled.d.ts +2 -2
  66. package/lib/chevre/service/reserve/potentialActions/onPendingReservationCanceled.js +2 -3
  67. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +2 -2
  68. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +2 -3
  69. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.d.ts +2 -2
  70. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +2 -2
  71. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +2 -2
  72. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -2
  73. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.d.ts +2 -2
  74. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +2 -3
  75. package/lib/chevre/service/reserve/potentialActions/onReservationsCreated.d.ts +2 -2
  76. package/lib/chevre/service/reserve/potentialActions/onReservationsCreated.js +2 -3
  77. package/lib/chevre/service/reserve/useReservation.d.ts +2 -2
  78. package/lib/chevre/service/task/cancelPendingReservation.js +3 -4
  79. package/lib/chevre/service/task/cancelReservation.js +2 -2
  80. package/lib/chevre/service/task/confirmReserveTransaction.d.ts +3 -4
  81. package/lib/chevre/service/task/confirmReserveTransaction.js +6 -7
  82. package/lib/chevre/service/task/informHub.js +0 -2
  83. package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +3 -4
  84. package/lib/chevre/service/task/onAuthorizationCreated.js +2 -2
  85. package/lib/chevre/service/task/onOrderPaymentCompleted.js +2 -4
  86. package/lib/chevre/service/task/placeOrder.js +2 -4
  87. package/lib/chevre/service/task/reserve.js +2 -2
  88. package/lib/chevre/service/task/returnOrder.js +2 -2
  89. package/lib/chevre/service/task/sendOrder.js +2 -2
  90. package/lib/chevre/service/task/triggerWebhook.js +0 -2
  91. package/lib/chevre/service/task/useReservation.js +2 -2
  92. package/lib/chevre/service/task/voidReserveTransaction.js +4 -5
  93. package/lib/chevre/service/taskHandler/onOperationFailed/informTaskIfNeeded.d.ts +2 -2
  94. package/lib/chevre/service/taskHandler/onOperationFailed/informTaskIfNeeded.js +4 -4
  95. package/lib/chevre/service/taskHandler/onOperationFailed.d.ts +2 -2
  96. package/lib/chevre/service/taskHandler.js +2 -2
  97. package/package.json +1 -1
@@ -7,7 +7,7 @@ const assetTransaction_1 = require("../../repo/assetTransaction");
7
7
  const authorization_1 = require("../../repo/authorization");
8
8
  const order_1 = require("../../repo/order");
9
9
  const reservation_1 = require("../../repo/reservation");
10
- const setting_1 = require("../../repo/setting");
10
+ const integration_1 = require("../../repo/setting/integration");
11
11
  const task_1 = require("../../repo/task");
12
12
  const useReservation_1 = require("../reserve/useReservation");
13
13
  /**
@@ -31,7 +31,7 @@ function call(params) {
31
31
  code: new authorization_1.AuthorizationRepo(connection),
32
32
  order: new order_1.OrderRepo(connection),
33
33
  reservation: new reservation_1.ReservationRepo(connection),
34
- setting: new setting_1.SettingRepo(connection),
34
+ integrationSetting: new integration_1.IntegrationSettingRepo({ connection }),
35
35
  task: new task_1.TaskRepo(connection)
36
36
  });
37
37
  };
@@ -12,7 +12,6 @@ const orderInTransaction_1 = require("../../repo/orderInTransaction");
12
12
  const offer_1 = require("../../repo/rateLimit/offer");
13
13
  const reservation_1 = require("../../repo/reservation");
14
14
  const reserveInterface_1 = require("../../repo/reserveInterface");
15
- const setting_1 = require("../../repo/setting");
16
15
  const integration_1 = require("../../repo/setting/integration");
17
16
  const stockHolder_1 = require("../../repo/stockHolder");
18
17
  const task_1 = require("../../repo/task");
@@ -46,11 +45,11 @@ function call(params) {
46
45
  coaAuthClientCreated = true;
47
46
  }
48
47
  }
49
- const settings = new integration_1.IntegrationSettingRepo({ connection });
48
+ const integrationSettingRepo = new integration_1.IntegrationSettingRepo({ connection });
50
49
  const reserveService = new coa_service_1.COA.service.Reserve({
51
50
  endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
52
51
  auth: coaAuthClient
53
- }, { timeout: (await settings.getByKey('coa')).timeoutReserve });
52
+ }, { timeout: (await integrationSettingRepo.getByKey('coa')).timeoutReserve });
54
53
  try {
55
54
  await (0, voidTransaction_1.voidTransaction)({
56
55
  ...params.data,
@@ -67,11 +66,11 @@ function call(params) {
67
66
  offerRateLimit: new offer_1.OfferRateLimitRepo(redisClient),
68
67
  orderInTransaction: new orderInTransaction_1.OrderInTransactionRepo(connection),
69
68
  reservation: new reservation_1.ReservationRepo(connection),
70
- setting: new setting_1.SettingRepo(connection),
69
+ integrationSetting: integrationSettingRepo,
71
70
  task: new task_1.TaskRepo(connection),
72
71
  placeOrder: new placeOrder_1.PlaceOrderRepo(connection),
73
72
  reserveService
74
- }, settings);
73
+ });
75
74
  }
76
75
  catch (error) { // eslint-disable-line no-useless-catch
77
76
  throw error;
@@ -1,12 +1,12 @@
1
1
  import { factory } from '../../../factory';
2
- import type { SettingRepo } from '../../../repo/setting';
2
+ import type { IntegrationSettingRepo } from '../../../repo/setting/integration';
3
3
  import type { TaskRepo } from '../../../repo/task';
4
4
  import type { IExecutableTask } from '../../../taskSettings';
5
5
  declare function informTaskIfNeeded(params: {
6
6
  task: IExecutableTask<factory.taskName>;
7
7
  executionEndDate: Date;
8
8
  }): (repos: {
9
- setting: SettingRepo;
9
+ integrationSetting: IntegrationSettingRepo;
10
10
  task: TaskRepo;
11
11
  }) => Promise<void>;
12
12
  export { informTaskIfNeeded };
@@ -9,9 +9,9 @@ const factory_1 = require("../../../factory");
9
9
  const debug = (0, debug_1.default)('chevre-domain:service:taskHandler:onOperationFailed');
10
10
  function createInformTasks(params) {
11
11
  const { task, setting, executionEndDate } = params;
12
- const informTask = setting?.onTaskStatusChanged?.informTask;
13
- const informTaskNames = setting?.onTaskStatusChanged?.informTaskNames;
14
- const informTaskStatuses = setting?.onTaskStatusChanged?.informTaskStatuses;
12
+ const informTask = setting?.informActions;
13
+ const informTaskNames = setting?.informTaskNames;
14
+ const informTaskStatuses = setting?.informTaskStatuses;
15
15
  const informTasks = [];
16
16
  if (Array.isArray(informTaskNames) && informTaskNames.includes(task.name)) {
17
17
  if (Array.isArray(informTaskStatuses)) {
@@ -85,7 +85,7 @@ function informTaskIfNeeded(params) {
85
85
  && task.name !== factory_1.factory.taskName.HandleNotification // nameで絞る
86
86
  && task.name !== factory_1.factory.taskName.TriggerWebhook;
87
87
  if (useInform) {
88
- const setting = await repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['onTaskStatusChanged']);
88
+ const setting = await repos.integrationSetting.getByKey('agg');
89
89
  const informTasks = createInformTasks({ task, setting, executionEndDate });
90
90
  debug('informTaskIfNeeded: creating inform tasks...', JSON.stringify(informTasks));
91
91
  if (informTasks.length > 0) {
@@ -1,5 +1,5 @@
1
1
  import { factory } from '../../factory';
2
- import type { SettingRepo } from '../../repo/setting';
2
+ import type { IntegrationSettingRepo } from '../../repo/setting/integration';
3
3
  import type { TaskRepo } from '../../repo/task';
4
4
  import type { TaskRunningRepo } from '../../repo/taskRunning';
5
5
  import type { IExecutableTask } from '../../taskSettings';
@@ -12,7 +12,7 @@ declare function onOperationFailed(params: {
12
12
  error: any;
13
13
  next?: never;
14
14
  }): (repos: {
15
- setting: SettingRepo;
15
+ integrationSetting: IntegrationSettingRepo;
16
16
  task: TaskRepo;
17
17
  taskRunning: TaskRunningRepo;
18
18
  }) => Promise<void>;
@@ -21,7 +21,7 @@ function executeTask(task) {
21
21
  const now = new Date();
22
22
  debug('executing an executableTask...', task, now);
23
23
  return async (settings, options) => {
24
- const settingRepo = new (await import('../repo/setting.js')).SettingRepo(settings.connection);
24
+ const integrationSettingRepo = new (await import('../repo/setting/integration.js')).IntegrationSettingRepo({ connection: settings.connection });
25
25
  const taskRepo = new (await import('../repo/task.js')).TaskRepo(settings.connection);
26
26
  const taskRunningRepo = new (await import('../repo/taskRunning.js')).TaskRunningRepo(settings.connection);
27
27
  try {
@@ -56,7 +56,7 @@ function executeTask(task) {
56
56
  catch (error) {
57
57
  await (0, onOperationFailed_1.onOperationFailed)({
58
58
  task, now, error
59
- })({ setting: settingRepo, task: taskRepo, taskRunning: taskRunningRepo });
59
+ })({ integrationSetting: integrationSettingRepo, task: taskRepo, taskRunning: taskRunningRepo });
60
60
  }
61
61
  };
62
62
  }
package/package.json CHANGED
@@ -89,5 +89,5 @@
89
89
  "postversion": "git push origin --tags",
90
90
  "prepublishOnly": "npm run clean && npm run build"
91
91
  },
92
- "version": "28.1.0-alpha.4"
92
+ "version": "28.1.0-alpha.6"
93
93
  }