@chevre/domain 21.37.0-alpha.3 → 21.37.0-alpha.5

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 (32) hide show
  1. package/lib/chevre/repo/assetTransaction.d.ts +1 -4
  2. package/lib/chevre/repo/assetTransaction.js +2 -2
  3. package/lib/chevre/service/assetTransaction/refund/potentialActions.js +6 -8
  4. package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +8 -1
  5. package/lib/chevre/service/assetTransaction/reserve/factory.js +6 -1
  6. package/lib/chevre/service/assetTransaction/reserve.js +16 -13
  7. package/lib/chevre/service/notification.d.ts +5 -1
  8. package/lib/chevre/service/notification.js +5 -2
  9. package/lib/chevre/service/offer/onEventChanged.js +4 -4
  10. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.js +4 -4
  11. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.js +4 -4
  12. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +4 -4
  13. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +4 -4
  14. package/lib/chevre/service/order/onOrderUpdated/factory.js +4 -4
  15. package/lib/chevre/service/payment/any/onPaid.d.ts +1 -3
  16. package/lib/chevre/service/payment/any/onPaid.js +7 -4
  17. package/lib/chevre/service/payment/any/onRefund.js +6 -3
  18. package/lib/chevre/service/payment/factory.js +6 -8
  19. package/lib/chevre/service/reserve/factory.d.ts +3 -1
  20. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +4 -4
  21. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +8 -8
  22. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +4 -4
  23. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +4 -4
  24. package/lib/chevre/service/task/onResourceUpdated/onAggregateOfferUpdated.js +4 -4
  25. package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.js +4 -4
  26. package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.js +4 -4
  27. package/lib/chevre/service/task/onResourceUpdated.js +24 -24
  28. package/lib/chevre/service/task/triggerWebhook.d.ts +2 -2
  29. package/lib/chevre/service/task/triggerWebhook.js +3 -3
  30. package/lib/chevre/service/task.js +1 -0
  31. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +0 -2
  32. package/package.json +2 -2
@@ -68,10 +68,7 @@ export declare class MongoRepository {
68
68
  addReservations(params: {
69
69
  typeOf: factory.assetTransactionType.Reserve;
70
70
  id: string;
71
- object: Pick<factory.assetTransaction.reserve.IObject, 'acceptedOffer' | 'issuedThrough' | 'reservationFor' | 'subReservation'> & {
72
- issuedThrough: factory.assetTransaction.reserve.IIssuedThrough;
73
- reservationFor: factory.assetTransaction.reserve.IReservationFor;
74
- };
71
+ object: Pick<factory.assetTransaction.reserve.IObject, 'acceptedOffer' | 'subReservation'>;
75
72
  }): Promise<void>;
76
73
  /**
77
74
  * 取引を確定する
@@ -360,8 +360,8 @@ class MongoRepository {
360
360
  }, {
361
361
  $set: {
362
362
  'object.acceptedOffer': params.object.acceptedOffer,
363
- 'object.issuedThrough': params.object.issuedThrough,
364
- 'object.reservationFor': params.object.reservationFor,
363
+ // 'object.issuedThrough': params.object.issuedThrough, // start時保管へ移行(2024-07-01~)
364
+ // 'object.reservationFor': params.object.reservationFor, // start時保管へ移行(2024-07-01~)
365
365
  'object.subReservation': params.object.subReservation
366
366
  }
367
367
  }, { new: false, projection: { _id: 1 } })
@@ -50,17 +50,15 @@ function createInformPaymentActions(params) {
50
50
  : String(transaction.agent.id),
51
51
  url: String((_c = a.recipient) === null || _c === void 0 ? void 0 : _c.url)
52
52
  };
53
+ // optimize(2024-07-01~)
53
54
  return {
54
- project: transaction.project,
55
- typeOf: factory.actionType.InformAction,
56
- agent: transaction.project,
55
+ // project: transaction.project,
56
+ // typeOf: factory.actionType.InformAction,
57
+ // agent: transaction.project,
57
58
  recipient,
58
59
  // 実際にタスクが生成される直前にactionに置き換える
59
- object: {},
60
- purpose: {
61
- typeOf: transaction.typeOf,
62
- id: transaction.id
63
- }
60
+ // object: {},
61
+ purpose: { typeOf: transaction.typeOf, id: transaction.id }
64
62
  };
65
63
  }));
66
64
  }
@@ -3,6 +3,10 @@ import { IMinimizedIndividualEvent } from '../../../factory/event';
3
3
  import { IAcceptedAddOn } from './factory/price';
4
4
  type IObjectSubReservation = factory.assetTransaction.reserve.IObjectSubReservation;
5
5
  export { IAcceptedAddOn };
6
+ type IObject = factory.assetTransaction.reserve.IObject & {
7
+ issuedThrough: factory.assetTransaction.reserve.IIssuedThrough;
8
+ reservationFor: factory.assetTransaction.reserve.IReservationFor;
9
+ };
6
10
  export declare function createStartParams(params: factory.assetTransaction.reserve.IStartParamsWithoutDetail & {
7
11
  provider: {
8
12
  /**
@@ -12,7 +16,10 @@ export declare function createStartParams(params: factory.assetTransaction.reser
12
16
  };
13
17
  reservationNumber: string;
14
18
  useHoldStockByTransactionNumber: boolean;
15
- }): factory.assetTransaction.IStartParams<factory.assetTransactionType.Reserve>;
19
+ event: IMinimizedIndividualEvent<factory.eventType.Event | factory.eventType.ScreeningEvent>;
20
+ }): factory.assetTransaction.IStartParams<factory.assetTransactionType.Reserve> & {
21
+ object: IObject;
22
+ };
16
23
  /**
17
24
  * ポイント特典を作成する
18
25
  */
@@ -16,7 +16,12 @@ function createStartParams(params) {
16
16
  id: params.provider.id,
17
17
  typeOf: factory.organizationType.Corporation
18
18
  };
19
- const reservationPackage = Object.assign({ provider, reservationNumber: reservationNumber, reservationStatus: factory.reservationStatusType.ReservationPending,
19
+ // reservationFor,issuedThrough保管をaddReservationsから移行(2024-07-01~)
20
+ const reservationFor = createReservationFor(params.event, true);
21
+ const { issuedThrough } = createIssuedThrough({ reservationFor: params.event });
22
+ const reservationPackage = Object.assign({ issuedThrough,
23
+ provider,
24
+ reservationFor, reservationNumber: reservationNumber, reservationStatus: factory.reservationStatusType.ReservationPending,
20
25
  // trueで固定(2023-07-19~)
21
26
  disablePendingReservations: true, useHoldStockByTransactionNumber: params.useHoldStockByTransactionNumber, typeOf: factory.reservationType.ReservationPackage }, (typeof ((_a = params.object.broker) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { broker: params.object.broker } : undefined);
22
27
  return {
@@ -57,7 +57,8 @@ function start(params) {
57
57
  now,
58
58
  store: { id: (_c = params.availableAtOrFrom) === null || _c === void 0 ? void 0 : _c.id }
59
59
  });
60
- const startParams = (0, factory_1.createStartParams)(Object.assign(Object.assign({}, params), { provider: { id: event.organizer.id }, reservationNumber }));
60
+ const startParams = (0, factory_1.createStartParams)(Object.assign(Object.assign({}, params), { provider: { id: event.organizer.id }, reservationNumber,
61
+ event }));
61
62
  // 取引作成
62
63
  let transaction;
63
64
  try {
@@ -84,7 +85,8 @@ function start(params) {
84
85
  return {
85
86
  transaction: { id: transaction.id },
86
87
  objectSubReservations,
87
- issuedThrough: addReservationsResult.issuedThrough
88
+ // issuedThrough: addReservationsResult.issuedThrough
89
+ issuedThrough: startParams.object.issuedThrough
88
90
  };
89
91
  });
90
92
  }
@@ -137,17 +139,18 @@ function addReservations(params) {
137
139
  const availableSeatOffers = yield searchAvailableSeatOffers({ acceptedOffers, event })(repos);
138
140
  // 仮予約作成
139
141
  const { acceptedOffers4transactionObject, objectSubReservations } = yield createAcceptedOffers4transactionObject({
140
- acceptedOffers,
141
- ticketOffers,
142
- availableOffers, now,
143
- event, availableSeatOffers,
144
- transaction,
142
+ acceptedOffers, ticketOffers, availableOffers, now,
143
+ event, availableSeatOffers, transaction,
145
144
  availableAtOrFrom: params.availableAtOrFrom,
146
145
  validateAppliesToMovieTicket: params.validateAppliesToMovieTicket
147
146
  })(repos);
148
- // 予約イベント最適化
149
- const reservationFor = (0, factory_1.createReservationFor)(event, true);
150
- const { issuedThrough } = (0, factory_1.createIssuedThrough)({ reservationFor: event });
147
+ // const reservationFor = createReservationFor(event, true);
148
+ // const { issuedThrough } = createIssuedThrough({ reservationFor: event });
149
+ const reservationFor = transaction.object.reservationFor;
150
+ if (reservationFor === undefined) {
151
+ // 必ずstart時に保管されているはず
152
+ throw new factory.errors.Internal('transaction.object.reservationFor undefined unexpectedly');
153
+ }
151
154
  // 取引に予約追加
152
155
  let lockedOfferRateLimitKeys = [];
153
156
  try {
@@ -164,8 +167,8 @@ function addReservations(params) {
164
167
  object: {
165
168
  acceptedOffer: acceptedOffers4transactionObject,
166
169
  // issuedThroughを追加(2023-06-05~)
167
- issuedThrough,
168
- reservationFor,
170
+ // issuedThrough, // start時保管へ移行(2024-07-01~)
171
+ // reservationFor, // start時保管へ移行(2024-07-01~)
169
172
  subReservation: objectSubReservations
170
173
  }
171
174
  });
@@ -198,7 +201,7 @@ function addReservations(params) {
198
201
  })(repos);
199
202
  // ストックホルダー処理(stockHolderで残席数を集計しているので必要)
200
203
  yield onReservationsCreated({ event, transaction: { transactionNumber: transaction.transactionNumber } })(repos);
201
- return { objectSubReservations, issuedThrough };
204
+ return { objectSubReservations };
202
205
  });
203
206
  }
204
207
  /**
@@ -26,7 +26,11 @@ declare function lineNotify({ subject, content, imageThumbnail, imageFullsize, l
26
26
  imageFullsize?: string;
27
27
  logLevel: LineNotifyLogLevel;
28
28
  }): ILineNotifyOperation<void>;
29
- declare function triggerWebhook(params: factory.task.IData<factory.taskName.TriggerWebhook>): (repos: {
29
+ declare function triggerWebhook(params: factory.task.IData<factory.taskName.TriggerWebhook> & {
30
+ project: {
31
+ id: string;
32
+ };
33
+ }): (repos: {
30
34
  action: ActionRepo;
31
35
  useFetchAPI: boolean;
32
36
  }) => Promise<void>;
@@ -231,11 +231,14 @@ function sleep(waitTime) {
231
231
  });
232
232
  });
233
233
  }
234
+ function createInformActionAttributes(params) {
235
+ const { object, purpose, recipient, project } = params;
236
+ return Object.assign({ agent: { id: project.id, typeOf: factory.organizationType.Project }, object, project: { id: project.id, typeOf: factory.organizationType.Project }, recipient, typeOf: factory.actionType.InformAction }, (typeof (purpose === null || purpose === void 0 ? void 0 : purpose.typeOf) === 'string') ? { purpose } : undefined);
237
+ }
234
238
  function processInformAction(params) {
235
239
  return (repos) => __awaiter(this, void 0, void 0, function* () {
236
240
  var _a, _b, _c;
237
- // アクション開始
238
- const action = yield repos.action.start(params);
241
+ const action = yield repos.action.start(createInformActionAttributes(params));
239
242
  let result = {};
240
243
  try {
241
244
  if (typeof ((_a = params.recipient) === null || _a === void 0 ? void 0 : _a.url) === 'string') {
@@ -201,16 +201,16 @@ function createInformTasks(params) {
201
201
  // _idは不要であり、存在すると予期せぬ影響を及ぼす可能性がある
202
202
  delete event4inform._id;
203
203
  const informActionAttributes = {
204
- agent: event4inform.project,
204
+ // agent: event4inform.project,
205
205
  object: event4inform,
206
- project: event4inform.project,
206
+ // project: event4inform.project,
207
207
  recipient: {
208
208
  id: '',
209
209
  name: String((_a = informEvent.recipient) === null || _a === void 0 ? void 0 : _a.name),
210
210
  typeOf: factory.creativeWorkType.WebApplication,
211
211
  url: informUrl
212
- },
213
- typeOf: factory.actionType.InformAction
212
+ }
213
+ // typeOf: factory.actionType.InformAction
214
214
  };
215
215
  informTasks.push({
216
216
  project: event4inform.project,
@@ -15,16 +15,16 @@ function createInformTasks(order) {
15
15
  informTasks = informOrder.map((informOrderParams) => {
16
16
  var _a, _b;
17
17
  const informActionAttributes = {
18
- agent: order.project,
18
+ // agent: order.project,
19
19
  object: order4inform,
20
- project: order.project,
20
+ // project: order.project,
21
21
  recipient: {
22
22
  url: (_a = informOrderParams.recipient) === null || _a === void 0 ? void 0 : _a.url,
23
23
  id: recipientId,
24
24
  name: (_b = informOrderParams.recipient) === null || _b === void 0 ? void 0 : _b.name,
25
25
  typeOf: factory.creativeWorkType.WebApplication
26
- },
27
- typeOf: factory.actionType.InformAction
26
+ }
27
+ // typeOf: factory.actionType.InformAction
28
28
  };
29
29
  return {
30
30
  project: order.project,
@@ -19,16 +19,16 @@ function createInformTasks(params) {
19
19
  informTasks = informOrder.map((informOrderParams) => {
20
20
  var _a, _b;
21
21
  const informActionAttributes = {
22
- agent: order.project,
22
+ // agent: order.project,
23
23
  object: order4inform,
24
- project: order.project,
24
+ // project: order.project,
25
25
  recipient: {
26
26
  url: (_a = informOrderParams.recipient) === null || _a === void 0 ? void 0 : _a.url,
27
27
  id: recipientId,
28
28
  name: (_b = informOrderParams.recipient) === null || _b === void 0 ? void 0 : _b.name,
29
29
  typeOf: factory.creativeWorkType.WebApplication
30
- },
31
- typeOf: factory.actionType.InformAction
30
+ }
31
+ // typeOf: factory.actionType.InformAction
32
32
  };
33
33
  return {
34
34
  project: order.project,
@@ -17,16 +17,16 @@ function createInformTasks(order) {
17
17
  informTasks = informOrder.map((informOrderParams) => {
18
18
  var _a, _b;
19
19
  const informActionAttributes = {
20
- agent: order.project,
20
+ // agent: order.project,
21
21
  object: order4inform,
22
- project: order.project,
22
+ // project: order.project,
23
23
  recipient: {
24
24
  url: (_a = informOrderParams.recipient) === null || _a === void 0 ? void 0 : _a.url,
25
25
  id: recipientId,
26
26
  name: (_b = informOrderParams.recipient) === null || _b === void 0 ? void 0 : _b.name,
27
27
  typeOf: factory.creativeWorkType.WebApplication
28
- },
29
- typeOf: factory.actionType.InformAction
28
+ }
29
+ // typeOf: factory.actionType.InformAction
30
30
  };
31
31
  return {
32
32
  project: order.project,
@@ -19,16 +19,16 @@ function createInformTasks(order) {
19
19
  informTasks = informOrder.map((informOrderParams) => {
20
20
  var _a, _b;
21
21
  const informActionAttributes = {
22
- agent: order.project,
22
+ // agent: order.project,
23
23
  object: order4inform,
24
- project: order.project,
24
+ // project: order.project,
25
25
  recipient: {
26
26
  url: (_a = informOrderParams.recipient) === null || _a === void 0 ? void 0 : _a.url,
27
27
  id: recipientId,
28
28
  name: (_b = informOrderParams.recipient) === null || _b === void 0 ? void 0 : _b.name,
29
29
  typeOf: factory.creativeWorkType.WebApplication
30
- },
31
- typeOf: factory.actionType.InformAction
30
+ }
31
+ // typeOf: factory.actionType.InformAction
32
32
  };
33
33
  return {
34
34
  project: order.project,
@@ -14,16 +14,16 @@ function createInformTasks(order) {
14
14
  informTasks = informOrder.map((informOrderParams) => {
15
15
  var _a, _b;
16
16
  const informActionAttributes = {
17
- agent: order.project,
17
+ // agent: order.project,
18
18
  object: order4inform,
19
- project: order.project,
19
+ // project: order.project,
20
20
  recipient: {
21
21
  url: (_a = informOrderParams.recipient) === null || _a === void 0 ? void 0 : _a.url,
22
22
  id: recipientId,
23
23
  name: (_b = informOrderParams.recipient) === null || _b === void 0 ? void 0 : _b.name,
24
24
  typeOf: factory.creativeWorkType.WebApplication
25
- },
26
- typeOf: factory.actionType.InformAction
25
+ }
26
+ // typeOf: factory.actionType.InformAction
27
27
  };
28
28
  return {
29
29
  project: order.project,
@@ -12,7 +12,5 @@ declare function onPaid(payAction: factory.action.trade.pay.IAction): (repos: {
12
12
  action: ActionRepo;
13
13
  accountingReport: AccountingReportRepo;
14
14
  task: TaskRepo;
15
- }) => Promise<{
16
- id: string;
17
- }[]>;
15
+ }) => Promise<void>;
18
16
  export { onPaid };
@@ -32,21 +32,24 @@ function onPaid(payAction) {
32
32
  }
33
33
  const informPayment = potentialActions === null || potentialActions === void 0 ? void 0 : potentialActions.informPayment;
34
34
  if (Array.isArray(informPayment)) {
35
- taskAttributes.push(...informPayment.map((a) => {
35
+ taskAttributes.push(...informPayment.map(({ purpose, recipient }) => {
36
36
  return {
37
- project: a.project,
37
+ project: payAction.project,
38
38
  name: factory.taskName.TriggerWebhook,
39
39
  status: factory.taskStatus.Ready,
40
40
  runsAt: now,
41
41
  remainingNumberOfTries: 30,
42
42
  numberOfTried: 0,
43
43
  executionResults: [],
44
- data: Object.assign(Object.assign({}, a), { object: aciton4inform })
44
+ data: Object.assign({
45
+ // optimize(2024-07-01~)
46
+ // ...a,
47
+ recipient, object: aciton4inform }, (typeof (purpose === null || purpose === void 0 ? void 0 : purpose.typeOf) === 'string') ? { purpose } : undefined)
45
48
  };
46
49
  }));
47
50
  }
48
51
  // タスク保管
49
- return repos.task.saveMany(taskAttributes, { emitImmediately: true });
52
+ yield repos.task.saveMany(taskAttributes, { emitImmediately: true });
50
53
  });
51
54
  }
52
55
  exports.onPaid = onPaid;
@@ -90,16 +90,19 @@ function onRefund(refundAction) {
90
90
  }
91
91
  }
92
92
  if (Array.isArray(informPayment)) {
93
- taskAttributes.push(...informPayment.map((a) => {
93
+ taskAttributes.push(...informPayment.map(({ purpose, recipient }) => {
94
94
  return {
95
- project: a.project,
95
+ project: refundAction.project,
96
96
  name: factory.taskName.TriggerWebhook,
97
97
  status: factory.taskStatus.Ready,
98
98
  runsAt: now,
99
99
  remainingNumberOfTries: 30,
100
100
  numberOfTried: 0,
101
101
  executionResults: [],
102
- data: Object.assign(Object.assign({}, a), { object: aciton4inform })
102
+ data: Object.assign({
103
+ // optimize(2024-07-01~)
104
+ // ...a,
105
+ recipient, object: aciton4inform }, (typeof (purpose === null || purpose === void 0 ? void 0 : purpose.typeOf) === 'string') ? { purpose } : undefined)
103
106
  };
104
107
  }));
105
108
  }
@@ -140,17 +140,15 @@ function createInformPaymentActions(params) {
140
140
  : String(transaction.agent.id),
141
141
  url: String((_c = a.recipient) === null || _c === void 0 ? void 0 : _c.url)
142
142
  };
143
+ // optimize(2024-07-01~)
143
144
  return {
144
- project: transaction.project,
145
- typeOf: factory.actionType.InformAction,
146
- agent: transaction.project,
145
+ // project: transaction.project,
146
+ // typeOf: factory.actionType.InformAction,
147
+ // agent: transaction.project,
147
148
  recipient,
148
149
  // 実際にタスクが生成される直前にactionに置き換える
149
- object: {},
150
- purpose: {
151
- typeOf: transaction.typeOf,
152
- id: transaction.id
153
- }
150
+ // object: {},
151
+ purpose: { typeOf: transaction.typeOf, id: transaction.id }
154
152
  };
155
153
  }));
156
154
  }
@@ -60,6 +60,8 @@ export interface IReservation4informUsed {
60
60
  }
61
61
  export type IReservation4inform = IReservationPackage4informConfirmed | IReservation4informCanceled | IReservation4informCheckedIn | IReservation4informUsed;
62
62
  export type IInformObject = IReservation4inform[];
63
- export type InformReservationActionattributes = factory.action.interact.inform.IAttributes<IInformObject, any>;
63
+ export interface IPotentialInformReservationAction extends factory.task.triggerWebhook.IPotentialInformAction {
64
+ object: IInformObject;
65
+ }
64
66
  export declare const NUM_TRY_INFORM_RESERVATION: number;
65
67
  export {};
@@ -55,16 +55,16 @@ reservationFor) {
55
55
  var _a;
56
56
  const informUrl = String((_a = informReservation.recipient) === null || _a === void 0 ? void 0 : _a.url);
57
57
  const informReservationAttributes = {
58
- agent: project,
58
+ // agent: project,
59
59
  object: reservations4inform,
60
- project,
60
+ // project,
61
61
  recipient: {
62
62
  id: '',
63
63
  name: informUrl,
64
64
  typeOf: factory.creativeWorkType.WebApplication,
65
65
  url: informUrl
66
- },
67
- typeOf: factory.actionType.InformAction
66
+ }
67
+ // typeOf: factory.actionType.InformAction
68
68
  };
69
69
  return {
70
70
  project,
@@ -42,16 +42,16 @@ function onReservationCheckedIn(params) {
42
42
  };
43
43
  });
44
44
  const informReservationAttributes = {
45
- agent: project,
45
+ // agent: project,
46
46
  object: reservations4inform,
47
- project,
47
+ // project,
48
48
  recipient: {
49
49
  id: '',
50
50
  name: informUrl,
51
51
  typeOf: factory.creativeWorkType.WebApplication,
52
52
  url: informUrl
53
- },
54
- typeOf: factory.actionType.InformAction
53
+ }
54
+ // typeOf: factory.actionType.InformAction
55
55
  };
56
56
  const informReservationTask = {
57
57
  project,
@@ -76,16 +76,16 @@ function onReservationCheckedIn(params) {
76
76
  };
77
77
  });
78
78
  const informReservationAttributes = {
79
- agent: project,
79
+ // agent: project,
80
80
  object: reservations4inform,
81
- project,
81
+ // project,
82
82
  recipient: {
83
83
  id: '',
84
84
  name: informUrl,
85
85
  typeOf: factory.creativeWorkType.WebApplication,
86
86
  url: informUrl
87
- },
88
- typeOf: factory.actionType.InformAction
87
+ }
88
+ // typeOf: factory.actionType.InformAction
89
89
  };
90
90
  const informReservationTask = {
91
91
  project,
@@ -86,16 +86,16 @@ function onReservationConfirmed(confirmedReservations) {
86
86
  : undefined)];
87
87
  const informUrl = String((_a = informReservation.recipient) === null || _a === void 0 ? void 0 : _a.url);
88
88
  const informReservationAttributes = {
89
- agent: project,
89
+ // agent: project,
90
90
  object: informObject,
91
- project,
91
+ // project,
92
92
  recipient: {
93
93
  id: '',
94
94
  name: informUrl,
95
95
  typeOf: factory.creativeWorkType.WebApplication,
96
96
  url: informUrl
97
- },
98
- typeOf: factory.actionType.InformAction
97
+ }
98
+ // typeOf: factory.actionType.InformAction
99
99
  };
100
100
  return {
101
101
  project,
@@ -42,16 +42,16 @@ function onReservationUsed(attendedReservation) {
42
42
  var _a;
43
43
  const informUrl = String((_a = informReservation.recipient) === null || _a === void 0 ? void 0 : _a.url);
44
44
  const informReservationAttributes = {
45
- agent: attendedReservation.project,
45
+ // agent: attendedReservation.project,
46
46
  object: [reservation4inform],
47
- project: attendedReservation.project,
47
+ // project: attendedReservation.project,
48
48
  recipient: {
49
49
  id: '',
50
50
  name: informUrl,
51
51
  typeOf: factory.creativeWorkType.WebApplication,
52
52
  url: informUrl
53
- },
54
- typeOf: factory.actionType.InformAction
53
+ }
54
+ // typeOf: factory.actionType.InformAction
55
55
  };
56
56
  return {
57
57
  project: attendedReservation.project,
@@ -33,16 +33,16 @@ function createInformOfferTasks(params) {
33
33
  offers4inform.forEach((offer4inform) => {
34
34
  var _a;
35
35
  const informActionAttributes = {
36
- agent: { id: params.project.id, typeOf: factory.organizationType.Project },
36
+ // agent: { id: params.project.id, typeOf: factory.organizationType.Project },
37
37
  object: offer4inform,
38
- project: { id: params.project.id, typeOf: factory.organizationType.Project },
38
+ // project: { id: params.project.id, typeOf: factory.organizationType.Project },
39
39
  recipient: {
40
40
  id: '',
41
41
  name: String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.name),
42
42
  typeOf: factory.creativeWorkType.WebApplication,
43
43
  url: informUrl
44
- },
45
- typeOf: factory.actionType.InformAction
44
+ }
45
+ // typeOf: factory.actionType.InformAction
46
46
  };
47
47
  informTasks.push({
48
48
  project: { id: params.project.id, typeOf: factory.organizationType.Project },
@@ -48,16 +48,16 @@ function createInformHasPOSTasks(params) {
48
48
  movieTheaters4inform.forEach((movieTheater4inform) => {
49
49
  var _a;
50
50
  const informActionAttributes = {
51
- agent: { id: params.project.id, typeOf: factory.organizationType.Project },
51
+ // agent: { id: params.project.id, typeOf: factory.organizationType.Project },
52
52
  object: movieTheater4inform,
53
- project: { id: params.project.id, typeOf: factory.organizationType.Project },
53
+ // project: { id: params.project.id, typeOf: factory.organizationType.Project },
54
54
  recipient: {
55
55
  id: '',
56
56
  name: String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.name),
57
57
  typeOf: factory.creativeWorkType.WebApplication,
58
58
  url: informUrl
59
- },
60
- typeOf: factory.actionType.InformAction
59
+ }
60
+ // typeOf: factory.actionType.InformAction
61
61
  };
62
62
  informTasks.push({
63
63
  project: { id: params.project.id, typeOf: factory.organizationType.Project },
@@ -38,16 +38,16 @@ function createInformOfferCatalogTasks(params) {
38
38
  offerCatalogs4inform.forEach((offerCatalog4inform) => {
39
39
  var _a;
40
40
  const informActionAttributes = {
41
- agent: { id: params.project.id, typeOf: factory.organizationType.Project },
41
+ // agent: { id: params.project.id, typeOf: factory.organizationType.Project },
42
42
  object: offerCatalog4inform,
43
- project: { id: params.project.id, typeOf: factory.organizationType.Project },
43
+ // project: { id: params.project.id, typeOf: factory.organizationType.Project },
44
44
  recipient: {
45
45
  id: '',
46
46
  name: String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.name),
47
47
  typeOf: factory.creativeWorkType.WebApplication,
48
48
  url: informUrl
49
- },
50
- typeOf: factory.actionType.InformAction
49
+ }
50
+ // typeOf: factory.actionType.InformAction
51
51
  };
52
52
  informTasks.push({
53
53
  project: { id: params.project.id, typeOf: factory.organizationType.Project },
@@ -197,16 +197,16 @@ function createInformNoteTasks(params) {
197
197
  const { about, id, identifier, project, text, typeOf, version } = note4inform;
198
198
  const informObject = { about, id, identifier, project, text, typeOf, version }; // 明示的に必要最低限の属性のみ通知
199
199
  const informActionAttributes = {
200
- agent: project,
200
+ // agent: project,
201
201
  object: informObject,
202
- project: project,
202
+ // project: project,
203
203
  recipient: {
204
204
  id: '',
205
205
  name: String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.name),
206
206
  typeOf: factory.creativeWorkType.WebApplication,
207
207
  url: informUrl
208
- },
209
- typeOf: factory.actionType.InformAction
208
+ }
209
+ // typeOf: factory.actionType.InformAction
210
210
  };
211
211
  informTasks.push({
212
212
  project: project,
@@ -243,16 +243,16 @@ function createInformMovieTasks(params) {
243
243
  // _idは不要であり、存在すると予期せぬ影響を及ぼす可能性がある
244
244
  delete movie4inform._id;
245
245
  const informActionAttributes = {
246
- agent: movie4inform.project,
246
+ // agent: movie4inform.project,
247
247
  object: movie4inform,
248
- project: movie4inform.project,
248
+ // project: movie4inform.project,
249
249
  recipient: {
250
250
  id: '',
251
251
  name: String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.name),
252
252
  typeOf: factory.creativeWorkType.WebApplication,
253
253
  url: informUrl
254
- },
255
- typeOf: factory.actionType.InformAction
254
+ }
255
+ // typeOf: factory.actionType.InformAction
256
256
  };
257
257
  informTasks.push({
258
258
  project: movie4inform.project,
@@ -289,16 +289,16 @@ function createInformProductTasks(params) {
289
289
  // _idは不要であり、存在すると予期せぬ影響を及ぼす可能性がある
290
290
  delete product4inform._id;
291
291
  const informActionAttributes = {
292
- agent: product4inform.project,
292
+ // agent: product4inform.project,
293
293
  object: product4inform,
294
- project: product4inform.project,
294
+ // project: product4inform.project,
295
295
  recipient: {
296
296
  id: '',
297
297
  name: String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.name),
298
298
  typeOf: factory.creativeWorkType.WebApplication,
299
299
  url: informUrl
300
- },
301
- typeOf: factory.actionType.InformAction
300
+ }
301
+ // typeOf: factory.actionType.InformAction
302
302
  };
303
303
  informTasks.push({
304
304
  project: product4inform.project,
@@ -336,16 +336,16 @@ function createInformCategoryCodeTasks(params) {
336
336
  // _idは不要であり、存在すると予期せぬ影響を及ぼす可能性がある
337
337
  delete categoryCode4inform._id;
338
338
  const informActionAttributes = {
339
- agent: categoryCode4inform.project,
339
+ // agent: categoryCode4inform.project,
340
340
  object: categoryCode4inform,
341
- project: categoryCode4inform.project,
341
+ // project: categoryCode4inform.project,
342
342
  recipient: {
343
343
  id: '',
344
344
  name: String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.name),
345
345
  typeOf: factory.creativeWorkType.WebApplication,
346
346
  url: informUrl
347
- },
348
- typeOf: factory.actionType.InformAction
347
+ }
348
+ // typeOf: factory.actionType.InformAction
349
349
  };
350
350
  informTasks.push({
351
351
  project: categoryCode4inform.project,
@@ -416,16 +416,16 @@ function createInformMovieTheaterTasks(params) {
416
416
  // _idは不要であり、存在すると予期せぬ影響を及ぼす可能性がある
417
417
  delete movieTheater4inform._id;
418
418
  const informActionAttributes = {
419
- agent: movieTheater4inform.project,
419
+ // agent: movieTheater4inform.project,
420
420
  object: movieTheater4inform,
421
- project: movieTheater4inform.project,
421
+ // project: movieTheater4inform.project,
422
422
  recipient: {
423
423
  id: '',
424
424
  name: String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.name),
425
425
  typeOf: factory.creativeWorkType.WebApplication,
426
426
  url: informUrl
427
- },
428
- typeOf: factory.actionType.InformAction
427
+ }
428
+ // typeOf: factory.actionType.InformAction
429
429
  };
430
430
  informTasks.push({
431
431
  project: movieTheater4inform.project,
@@ -480,16 +480,16 @@ function createInformAccountTitleTasks(params) {
480
480
  // _idは不要であり、存在すると予期せぬ影響を及ぼす可能性がある
481
481
  delete accountTitle4inform._id;
482
482
  const informActionAttributes = {
483
- agent: accountTitle4inform.project,
483
+ // agent: accountTitle4inform.project,
484
484
  object: accountTitle4inform,
485
- project: accountTitle4inform.project,
485
+ // project: accountTitle4inform.project,
486
486
  recipient: {
487
487
  id: '',
488
488
  name: String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.name),
489
489
  typeOf: factory.creativeWorkType.WebApplication,
490
490
  url: informUrl
491
- },
492
- typeOf: factory.actionType.InformAction
491
+ }
492
+ // typeOf: factory.actionType.InformAction
493
493
  };
494
494
  informTasks.push({
495
495
  project: accountTitle4inform.project,
@@ -1,6 +1,6 @@
1
- import type { IOperationExecute } from '../task';
1
+ import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../task';
2
2
  import * as factory from '../../factory';
3
3
  /**
4
4
  * タスク実行関数
5
5
  */
6
- export declare function call(data: factory.task.triggerWebhook.IData): IOperationExecute<void>;
6
+ export declare function call(params: Pick<factory.task.triggerWebhook.ITask, IExecutableTaskKeys>): IOperationExecute<ICallResult>;
@@ -12,13 +12,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.call = void 0;
13
13
  const settings_1 = require("../../settings");
14
14
  const action_1 = require("../../repo/action");
15
- const NotificationService = require("../notification");
15
+ const notification_1 = require("../notification");
16
16
  /**
17
17
  * タスク実行関数
18
18
  */
19
- function call(data) {
19
+ function call(params) {
20
20
  return (settings) => __awaiter(this, void 0, void 0, function* () {
21
- yield NotificationService.triggerWebhook(data)({
21
+ yield (0, notification_1.triggerWebhook)(Object.assign(Object.assign({}, params.data), { project: { id: params.project.id } }))({
22
22
  action: new action_1.MongoRepository(settings.connection),
23
23
  useFetchAPI: settings_1.USE_FETCH_API
24
24
  });
@@ -116,6 +116,7 @@ function execute(task) {
116
116
  case factory.taskName.ReturnPayTransaction:
117
117
  case factory.taskName.ReturnReserveTransaction:
118
118
  case factory.taskName.SendEmailMessage:
119
+ case factory.taskName.TriggerWebhook:
119
120
  callResult = yield call(task)(settings, options);
120
121
  break;
121
122
  default:
@@ -25,10 +25,8 @@ function createTasks(params) {
25
25
  executionResults: [],
26
26
  data: {
27
27
  agent: transaction.project,
28
- // 通知内容最適化(2022-12-28~)
29
28
  object: informObject,
30
29
  project: transaction.project,
31
- purpose: { typeOf: transaction.typeOf, id: transaction.id },
32
30
  recipient: {
33
31
  id: '',
34
32
  name: webhookUrl,
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  ],
11
11
  "dependencies": {
12
12
  "@aws-sdk/credential-providers": "3.433.0",
13
- "@chevre/factory": "4.377.0-alpha.2",
13
+ "@chevre/factory": "4.377.0-alpha.3",
14
14
  "@cinerino/sdk": "8.0.0",
15
15
  "@motionpicture/coa-service": "9.4.0",
16
16
  "@motionpicture/gmo-service": "5.3.0",
@@ -110,5 +110,5 @@
110
110
  "postversion": "git push origin --tags",
111
111
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
112
112
  },
113
- "version": "21.37.0-alpha.3"
113
+ "version": "21.37.0-alpha.5"
114
114
  }