@chevre/domain 21.27.0-alpha.9 → 21.27.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 (58) hide show
  1. package/example/src/chevre/{aggregateEventReservation.ts → aggregation/aggregateEventReservation.ts} +2 -3
  2. package/example/src/chevre/aggregation/aggregateOffersOnEvent.ts +82 -0
  3. package/example/src/chevre/{aggregateAllEvents.ts → aggregation/createAggregateEventTasks.ts} +26 -13
  4. package/example/src/chevre/aggregation/searchAggregateReservations.ts +33 -0
  5. package/example/src/chevre/searchEvents.ts +4 -4
  6. package/example/src/chevre/transaction/processPlaceOrder.ts +1 -2
  7. package/example/src/chevre/unsetUnnecessaryFields.ts +4 -4
  8. package/lib/chevre/credentials.d.ts +7 -0
  9. package/lib/chevre/credentials.js +10 -6
  10. package/lib/chevre/repo/action.d.ts +2 -2
  11. package/lib/chevre/repo/action.js +64 -49
  12. package/lib/chevre/repo/aggregateReservation.d.ts +68 -0
  13. package/lib/chevre/repo/aggregateReservation.js +135 -0
  14. package/lib/chevre/repo/event.d.ts +16 -14
  15. package/lib/chevre/repo/event.js +62 -20
  16. package/lib/chevre/repo/mongoose/schemas/action.js +18 -0
  17. package/lib/chevre/repo/mongoose/schemas/aggregateReservation.d.ts +5 -0
  18. package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +84 -0
  19. package/lib/chevre/repo/mongoose/schemas/event.js +1 -1
  20. package/lib/chevre/repo/offer.d.ts +5 -0
  21. package/lib/chevre/repository.d.ts +5 -0
  22. package/lib/chevre/repository.js +15 -2
  23. package/lib/chevre/service/aggregation/event/aggregateOffers.d.ts +31 -0
  24. package/lib/chevre/service/aggregation/event/aggregateOffers.js +290 -0
  25. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +3 -4
  26. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +33 -238
  27. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.d.ts +2 -0
  28. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +19 -15
  29. package/lib/chevre/service/aggregation/event/findEventOffers.d.ts +2 -2
  30. package/lib/chevre/service/aggregation/event/findEventOffers.js +0 -2
  31. package/lib/chevre/service/aggregation/event.d.ts +2 -1
  32. package/lib/chevre/service/aggregation/event.js +3 -1
  33. package/lib/chevre/service/assetTransaction/pay.d.ts +4 -1
  34. package/lib/chevre/service/assetTransaction/pay.js +53 -27
  35. package/lib/chevre/service/assetTransaction/reserve.js +2 -1
  36. package/lib/chevre/service/event.js +16 -23
  37. package/lib/chevre/service/notification.js +0 -102
  38. package/lib/chevre/service/offer/onEventChanged.d.ts +25 -0
  39. package/lib/chevre/service/offer/onEventChanged.js +232 -0
  40. package/lib/chevre/service/offer.d.ts +0 -40
  41. package/lib/chevre/service/offer.js +1 -184
  42. package/lib/chevre/service/payment/any.d.ts +4 -2
  43. package/lib/chevre/service/payment/any.js +76 -48
  44. package/lib/chevre/service/payment/creditCard.js +14 -7
  45. package/lib/chevre/service/payment/movieTicket/checkByIdentifier.js +1 -9
  46. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +2 -2
  47. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +2 -2
  48. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -2
  49. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +2 -2
  50. package/lib/chevre/service/task/aggregateOffers.d.ts +7 -0
  51. package/lib/chevre/service/task/aggregateOffers.js +47 -0
  52. package/lib/chevre/service/task/aggregateScreeningEvent.js +0 -2
  53. package/lib/chevre/service/task/aggregateUseActionsOnEvent.js +2 -0
  54. package/lib/chevre/service/task/onEventChanged.js +2 -2
  55. package/lib/chevre/service/transaction/returnOrder/preStart.js +0 -18
  56. package/lib/chevre/settings.d.ts +1 -0
  57. package/lib/chevre/settings.js +2 -1
  58. package/package.json +3 -3
@@ -23,7 +23,7 @@ const credentials_1 = require("../credentials");
23
23
  const factory = require("../factory");
24
24
  const createEvent_1 = require("./event/createEvent");
25
25
  Object.defineProperty(exports, "createEvent", { enumerable: true, get: function () { return createEvent_1.createEvent; } });
26
- const offer_1 = require("./offer");
26
+ const onEventChanged_1 = require("./offer/onEventChanged");
27
27
  const debug = createDebug('chevre-domain:service:event');
28
28
  const coaAuthClient = new COA.auth.RefreshToken({
29
29
  endpoint: credentials_1.credentials.coa.endpoint,
@@ -304,16 +304,6 @@ function saveScreeningEvents(params) {
304
304
  for (const screeningEvent of screeningEvents) {
305
305
  try {
306
306
  const attributes = screeningEvent;
307
- // repository側で制御しているため不要(2022-08-26~)
308
- // const attributes = {
309
- // ...screeningEvent,
310
- // ...{
311
- // // 残席数は作成時のみ
312
- // $setOnInsert: { remainingAttendeeCapacity: screeningEvent.remainingAttendeeCapacity }
313
- // }
314
- // };
315
- // repository側で制御しているためdeleteは不要(2022-08-26~)
316
- // delete attributes.remainingAttendeeCapacity;
317
307
  saveParams.push({
318
308
  id: screeningEvent.id,
319
309
  attributes: attributes,
@@ -321,10 +311,7 @@ function saveScreeningEvents(params) {
321
311
  });
322
312
  }
323
313
  catch (error) {
324
- // tslint:disable-next-line:no-single-line-block-comment
325
- /* istanbul ignore next */
326
- // tslint:disable-next-line:no-console
327
- console.error(error);
314
+ // no op
328
315
  }
329
316
  }
330
317
  yield repos.event.saveMany(saveParams);
@@ -425,10 +412,7 @@ function cancelDeletedEvents(params) {
425
412
  });
426
413
  }
427
414
  catch (error) {
428
- // tslint:disable-next-line:no-single-line-block-comment
429
- /* istanbul ignore next */
430
- // tslint:disable-next-line:no-console
431
- console.error(error);
415
+ // no op
432
416
  }
433
417
  }
434
418
  debug(`${cancelledIds.length} events cancelled.`);
@@ -484,15 +468,24 @@ function createScreeningEventFromCOA(params) {
484
468
  typeOf: 'WebAPI',
485
469
  identifier: factory.service.webAPI.Identifier.COA
486
470
  },
487
- // 廃止(2023-08-07~)
488
- // priceCurrency: factory.priceCurrency.JPY,
471
+ eligibleQuantity: {
472
+ typeOf: 'QuantitativeValue',
473
+ unitCode: factory.unitCode.C62,
474
+ maxValue: Number(params.performanceFromCOA.availableNum)
475
+ },
489
476
  itemOffered: {
490
477
  serviceOutput: {
491
478
  reservedTicket: {
492
479
  typeOf: 'Ticket',
493
- ticketedSeat: { typeOf: factory.placeType.Seat }
480
+ ticketedSeat: { typeOf: factory.placeType.Seat } // 必ず指定席
494
481
  }
495
482
  }
483
+ },
484
+ seller: {
485
+ typeOf: factory.organizationType.Corporation,
486
+ id: params.seller.id,
487
+ // name: params.sellerFromDB.name,
488
+ makesOffer: []
496
489
  }
497
490
  };
498
491
  const { additionalProperty, coaInfo } = createScreeningEventAdditionalPropertyFromCOA(params);
@@ -809,7 +802,7 @@ function updateEvent4ttts(params) {
809
802
  }
810
803
  // アクション完了
811
804
  yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: { id: event.id } });
812
- yield (0, offer_1.onEventChanged)({
805
+ yield (0, onEventChanged_1.onEventChanged)({
813
806
  id: [event.id],
814
807
  project: { id: event.project.id },
815
808
  typeOf: event.typeOf,
@@ -89,7 +89,6 @@ function sendEmailMessage(params) {
89
89
  projectId: project.id
90
90
  } });
91
91
  // mlutiple recipients対応(2023-03-06~)
92
- // const response = await sgMail.send(msg);
93
92
  const response = yield sgMail.sendMultiple(msg);
94
93
  // check the response.
95
94
  if (response[0].statusCode !== http_status_1.ACCEPTED) {
@@ -107,7 +106,6 @@ function sendEmailMessage(params) {
107
106
  }
108
107
  throw error;
109
108
  }
110
- // アクション完了
111
109
  yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: result });
112
110
  });
113
111
  }
@@ -117,7 +115,6 @@ exports.sendEmailMessage = sendEmailMessage;
117
115
  * https://notify-bot.line.me/doc/ja/
118
116
  */
119
117
  function report2developers({ subject, content, imageThumbnail, imageFullsize }) {
120
- // tslint:disable-next-line:max-func-body-length
121
118
  return (repos) => __awaiter(this, void 0, void 0, function* () {
122
119
  var _a;
123
120
  const LINE_NOTIFY_URL = credentials_1.credentials.lineNotify.url;
@@ -158,58 +155,11 @@ ${content}`;
158
155
  }
159
156
  }
160
157
  catch (err) {
161
- if (err.name === 'TimeoutError') {
162
- // tslint:disable-next-line:no-console
163
- console.error('report2developers: Timeout: It took more than 5 seconds to get the result!', err);
164
- }
165
- else if (err.name === 'AbortError') {
166
- // tslint:disable-next-line:no-console
167
- console.error('report2developers: Fetch aborted by user action (browser stop button, closing tab, etc.', err);
168
- }
169
- else if (err.name === 'TypeError') {
170
- // tslint:disable-next-line:no-console
171
- console.error('report2developers: AbortSignal.timeout() method is not supported', err);
172
- }
173
- else {
174
- // A network error, or some other problem.
175
- // tslint:disable-next-line:no-console
176
- console.error(`report2developers: Error: type: ${err.name}, message: ${err.message}`, err);
177
- }
178
158
  throw err;
179
159
  }
180
160
  }
181
161
  else {
182
162
  throw new factory.errors.NotImplemented('only useFetchAPI implemented');
183
- // LINE通知APIにPOST
184
- // const formData: any = {
185
- // message: message,
186
- // ...(typeof imageThumbnail === 'string') ? { imageThumbnail } : undefined,
187
- // ...(typeof imageFullsize === 'string') ? { imageFullsize } : undefined
188
- // };
189
- // return new Promise<void>((resolve, reject) => {
190
- // request.post(
191
- // {
192
- // url: LINE_NOTIFY_URL,
193
- // auth: { bearer: repos.accessToken },
194
- // form: formData,
195
- // json: true,
196
- // timeout: settings.webhook?.timeout
197
- // },
198
- // (error, response, body) => {
199
- // if (error !== null) {
200
- // reject(error);
201
- // } else {
202
- // switch (response.statusCode) {
203
- // case OK:
204
- // resolve();
205
- // break;
206
- // default:
207
- // reject(new Error(body.message));
208
- // }
209
- // }
210
- // }
211
- // );
212
- // });
213
163
  }
214
164
  });
215
165
  }
@@ -255,7 +205,6 @@ function sleep(waitTime) {
255
205
  });
256
206
  }
257
207
  function processInformAction(params) {
258
- // tslint:disable-next-line:max-func-body-length
259
208
  return (repos) => __awaiter(this, void 0, void 0, function* () {
260
209
  var _a, _b, _c;
261
210
  // アクション開始
@@ -293,64 +242,13 @@ function processInformAction(params) {
293
242
  default:
294
243
  throw new Error(`statusCode: ${res.status} body: ${body}`);
295
244
  }
296
- // return res.json();
297
245
  }
298
246
  catch (err) {
299
- if (err.name === 'TimeoutError') {
300
- // tslint:disable-next-line:no-console
301
- console.error('processInformAction: Timeout: It took more than 5 seconds to get the result!', err);
302
- }
303
- else if (err.name === 'AbortError') {
304
- // tslint:disable-next-line:no-console
305
- console.error('processInformAction: Fetch aborted by user action (browser stop button, closing tab, etc.', err);
306
- }
307
- else if (err.name === 'TypeError') {
308
- // tslint:disable-next-line:no-console
309
- console.error('processInformAction: AbortSignal.timeout() method is not supported', err);
310
- }
311
- else {
312
- // A network error, or some other problem.
313
- // tslint:disable-next-line:no-console
314
- console.error(`processInformAction: Error: type: ${err.name}, message: ${err.message}`, err);
315
- }
316
247
  throw err;
317
248
  }
318
249
  }
319
250
  else {
320
251
  throw new factory.errors.NotImplemented('only useFetchAPI implemented');
321
- // await new Promise<void>((resolve, reject) => {
322
- // request.post(
323
- // {
324
- // url: url,
325
- // body: {
326
- // data: params.object
327
- // },
328
- // json: true,
329
- // timeout: settings.webhook?.timeout
330
- // },
331
- // (error, response, body) => {
332
- // if (error instanceof Error) {
333
- // reject(error);
334
- // } else {
335
- // switch (response.statusCode) {
336
- // case OK:
337
- // case CREATED:
338
- // case ACCEPTED:
339
- // case NO_CONTENT:
340
- // result = {
341
- // statusCode: response.statusCode,
342
- // useFetchAPI: repos.useFetchAPI
343
- // // body: body
344
- // };
345
- // resolve();
346
- // break;
347
- // default:
348
- // reject(new Error(`statusCode: ${response.statusCode} body: ${body}`));
349
- // }
350
- // }
351
- // }
352
- // );
353
- // });
354
252
  }
355
253
  }
356
254
  }
@@ -0,0 +1,25 @@
1
+ import type { MongoRepository as EventRepo } from '../../repo/event';
2
+ import type { MongoRepository as ProjectRepo } from '../../repo/project';
3
+ import type { MongoRepository as TaskRepo } from '../../repo/task';
4
+ import * as factory from '../../factory';
5
+ /**
6
+ * イベント変更時処理
7
+ */
8
+ declare function onEventChanged(params: factory.task.onEventChanged.IData): (repos: {
9
+ event: EventRepo;
10
+ project: ProjectRepo;
11
+ task: TaskRepo;
12
+ }) => Promise<void>;
13
+ declare function createAggregateScreeningEventIfNotExist(params: {
14
+ project: {
15
+ id: string;
16
+ };
17
+ reservationFor: {
18
+ id: string;
19
+ }[];
20
+ force: boolean;
21
+ identifier: string;
22
+ }): (repos: {
23
+ task: TaskRepo;
24
+ }) => Promise<void>;
25
+ export { createAggregateScreeningEventIfNotExist, onEventChanged };
@@ -0,0 +1,232 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.onEventChanged = exports.createAggregateScreeningEventIfNotExist = void 0;
13
+ const factory = require("../../factory");
14
+ const settings_1 = require("../../settings");
15
+ const informEvents = settings_1.settings.onEventChanged.informEvent;
16
+ /**
17
+ * イベント変更時処理
18
+ */
19
+ function onEventChanged(params) {
20
+ return (repos) => __awaiter(this, void 0, void 0, function* () {
21
+ if (params.id.length > 0) {
22
+ // ScreeningEventであれば集計タスク
23
+ if (params.typeOf === factory.eventType.ScreeningEvent) {
24
+ yield createAggregateScreeningEventIfNotExist({
25
+ project: { id: params.project.id },
26
+ reservationFor: params.id.map((id) => {
27
+ return { id };
28
+ }),
29
+ // 新規作成の場合は強制的に集計
30
+ force: params.isNew,
31
+ identifier: `onEventChanged`
32
+ })(repos);
33
+ }
34
+ // 通知タスク作成(2023-06-08~)
35
+ if (params.useInform === true) {
36
+ yield createInformTasks({
37
+ project: { id: params.project.id },
38
+ ids: params.id,
39
+ typeOf: params.typeOf
40
+ })(repos);
41
+ }
42
+ if (params.useSync === true) {
43
+ switch (params.typeOf) {
44
+ case factory.eventType.ScreeningEventSeries:
45
+ // 施設コンテンツを興行イベントへ同期(2023-07-28~)
46
+ yield syncEventSeries2screeningEvents({
47
+ project: { id: params.project.id },
48
+ ids: params.id
49
+ })(repos);
50
+ break;
51
+ default:
52
+ // no op
53
+ }
54
+ }
55
+ }
56
+ });
57
+ }
58
+ exports.onEventChanged = onEventChanged;
59
+ function syncEventSeries2screeningEvents(params) {
60
+ return (repos) => __awaiter(this, void 0, void 0, function* () {
61
+ const now = new Date();
62
+ for (const eventSeriesId of params.ids) {
63
+ yield repos.event.syncScreeningEventSeries2screeningEvents({
64
+ project: { id: params.project.id },
65
+ superEvent: { id: eventSeriesId },
66
+ startDate: { $gte: now }
67
+ });
68
+ }
69
+ });
70
+ }
71
+ function createAggregateScreeningEventIfNotExist(params) {
72
+ return (repos) => __awaiter(this, void 0, void 0, function* () {
73
+ let aggregateTasks = [];
74
+ const runsAt = new Date();
75
+ const remainingNumberOfTries = 2;
76
+ const project = {
77
+ id: params.project.id, typeOf: factory.organizationType.Project
78
+ };
79
+ const nowInMilliseconds = Date.now();
80
+ if (params.force) {
81
+ aggregateTasks = params.reservationFor.map((reservationFor) => {
82
+ const taskIdentifier = `${params.project.id}:${factory.taskName.AggregateScreeningEvent}:${reservationFor.id}:${params.identifier}:${nowInMilliseconds}`;
83
+ return {
84
+ identifier: taskIdentifier,
85
+ project,
86
+ name: factory.taskName.AggregateScreeningEvent,
87
+ status: factory.taskStatus.Ready,
88
+ runsAt,
89
+ remainingNumberOfTries,
90
+ numberOfTried: 0,
91
+ executionResults: [],
92
+ data: { typeOf: factory.eventType.ScreeningEvent, id: reservationFor.id }
93
+ };
94
+ });
95
+ }
96
+ else {
97
+ for (const reservationFor of params.reservationFor) {
98
+ // 冗長な作成を避ける
99
+ const readyAggregateScreeningEventTaskDoc = yield repos.task.taskModel.findOne({
100
+ 'project.id': { $eq: project.id },
101
+ name: { $eq: factory.taskName.AggregateScreeningEvent },
102
+ status: { $eq: factory.taskStatus.Ready },
103
+ 'data.id': { $exists: true, $eq: reservationFor.id }
104
+ }, { _id: 1 })
105
+ .exec();
106
+ if (readyAggregateScreeningEventTaskDoc === null) {
107
+ const taskIdentifier = `${params.project.id}:${factory.taskName.AggregateScreeningEvent}:${reservationFor.id}:${params.identifier}:${nowInMilliseconds}`;
108
+ aggregateTasks.push({
109
+ identifier: taskIdentifier,
110
+ project,
111
+ name: factory.taskName.AggregateScreeningEvent,
112
+ status: factory.taskStatus.Ready,
113
+ runsAt,
114
+ remainingNumberOfTries,
115
+ numberOfTried: 0,
116
+ executionResults: [],
117
+ data: { typeOf: factory.eventType.ScreeningEvent, id: reservationFor.id }
118
+ });
119
+ }
120
+ }
121
+ }
122
+ if (aggregateTasks.length > 0) {
123
+ yield repos.task.saveMany(aggregateTasks, { emitImmediately: true });
124
+ }
125
+ });
126
+ }
127
+ exports.createAggregateScreeningEventIfNotExist = createAggregateScreeningEventIfNotExist;
128
+ function createInformTasks(params) {
129
+ // tslint:disable-next-line:max-func-body-length
130
+ return (repos) => __awaiter(this, void 0, void 0, function* () {
131
+ let events4inform;
132
+ if (params.typeOf === factory.eventType.Event) {
133
+ const eventsFromDB = yield repos.event.search({
134
+ id: { $in: params.ids },
135
+ typeOf: params.typeOf
136
+ }, [], [
137
+ 'aggregateEntranceGate', 'aggregateOffer', 'aggregateReservation',
138
+ 'remainingAttendeeCapacity', 'checkInCount', 'attendeeCount'
139
+ ]);
140
+ // 最適化(2024-03-26~)
141
+ events4inform = eventsFromDB.map(({ project, organizer, typeOf, name, doorTime, endDate, eventStatus, location, startDate, id, additionalProperty }) => {
142
+ return {
143
+ project, organizer, typeOf, name, doorTime, endDate,
144
+ eventStatus, location, startDate, id, additionalProperty
145
+ };
146
+ });
147
+ }
148
+ else if (params.typeOf === factory.eventType.ScreeningEvent) {
149
+ const screeningEvents4inform = yield repos.event.search({
150
+ id: { $in: params.ids },
151
+ typeOf: params.typeOf
152
+ }, [], [
153
+ 'aggregateEntranceGate', 'aggregateOffer', 'aggregateReservation',
154
+ 'remainingAttendeeCapacity', 'checkInCount', 'attendeeCount'
155
+ ]);
156
+ // 最適化(2024-03-22~)
157
+ events4inform = screeningEvents4inform.map(({ project, organizer, typeOf, name, doorTime, endDate, eventStatus, location, startDate, superEvent, offers, id, additionalProperty }) => {
158
+ var _a;
159
+ return Object.assign({ project, organizer, typeOf, name, doorTime, endDate,
160
+ eventStatus, location, startDate, superEvent, id, additionalProperty }, (settings_1.USE_OPTIMIZE_INFORM_EVENT)
161
+ ? {
162
+ offers: (((_a = offers.offeredThrough) === null || _a === void 0 ? void 0 : _a.identifier) === factory.service.webAPI.Identifier.COA)
163
+ ? {
164
+ typeOf: offers.typeOf,
165
+ itemOffered: offers.itemOffered
166
+ }
167
+ : {
168
+ typeOf: offers.typeOf,
169
+ itemOffered: offers.itemOffered,
170
+ seller: {
171
+ id: offers.seller.id,
172
+ typeOf: offers.seller.typeOf,
173
+ // makesOfferを追加(2024-03-26~)
174
+ makesOffer: (Array.isArray(offers.seller.makesOffer))
175
+ ? offers.seller.makesOffer
176
+ : []
177
+ }
178
+ }
179
+ }
180
+ : { offers });
181
+ });
182
+ }
183
+ else {
184
+ const screeningEventSeries4inform = yield repos.event.search({
185
+ id: { $in: params.ids },
186
+ typeOf: params.typeOf
187
+ }, [], ['offers']);
188
+ // 最適化(2024-03-25~)
189
+ events4inform = screeningEventSeries4inform.map(({ project, organizer, typeOf, name, location, id, videoFormat, soundFormat, workPerformed, kanaName, eventStatus, endDate, startDate, additionalProperty, subtitleLanguage, dubLanguage, alternativeHeadline, description, duration, headline }) => {
190
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ project, organizer, typeOf, name, location, id, videoFormat, soundFormat, workPerformed, kanaName, eventStatus }, (endDate !== undefined) ? { endDate } : undefined), (startDate !== undefined) ? { startDate } : undefined), (Array.isArray(additionalProperty)) ? { additionalProperty } : undefined), (subtitleLanguage !== undefined) ? {} : undefined), (dubLanguage !== undefined) ? { dubLanguage } : undefined), (alternativeHeadline !== undefined) ? { alternativeHeadline } : undefined), (description !== undefined) ? { description } : undefined), (typeof duration === 'string') ? { duration } : undefined), (headline !== undefined) ? { headline } : undefined);
191
+ });
192
+ }
193
+ if (events4inform.length > 0) {
194
+ const taskRunsAt = new Date();
195
+ const informTasks = [];
196
+ informEvents === null || informEvents === void 0 ? void 0 : informEvents.forEach((informEvent) => {
197
+ var _a;
198
+ const informUrl = String((_a = informEvent.recipient) === null || _a === void 0 ? void 0 : _a.url);
199
+ events4inform.forEach((event4inform) => {
200
+ var _a;
201
+ // _idは不要であり、存在すると予期せぬ影響を及ぼす可能性がある
202
+ delete event4inform._id;
203
+ const informActionAttributes = {
204
+ agent: event4inform.project,
205
+ object: event4inform,
206
+ project: event4inform.project,
207
+ recipient: {
208
+ id: '',
209
+ name: String((_a = informEvent.recipient) === null || _a === void 0 ? void 0 : _a.name),
210
+ typeOf: factory.creativeWorkType.WebApplication,
211
+ url: informUrl
212
+ },
213
+ typeOf: factory.actionType.InformAction
214
+ };
215
+ informTasks.push({
216
+ project: event4inform.project,
217
+ name: factory.taskName.TriggerWebhook,
218
+ status: factory.taskStatus.Ready,
219
+ runsAt: taskRunsAt,
220
+ remainingNumberOfTries: 10,
221
+ numberOfTried: 0,
222
+ executionResults: [],
223
+ data: informActionAttributes
224
+ });
225
+ });
226
+ });
227
+ if (informTasks.length > 0) {
228
+ yield repos.task.saveMany(informTasks, { emitImmediately: true });
229
+ }
230
+ }
231
+ });
232
+ }
@@ -1,9 +1,7 @@
1
1
  import type { MongoRepository as EventRepo } from '../repo/event';
2
2
  import type { MongoRepository as PlaceRepo } from '../repo/place';
3
3
  import type { MongoRepository as PriceSpecificationRepo } from '../repo/priceSpecification';
4
- import type { MongoRepository as ProjectRepo } from '../repo/project';
5
4
  import type { StockHolderRepository as StockHolderRepo } from '../repo/stockHolder';
6
- import type { MongoRepository as TaskRepo } from '../repo/task';
7
5
  import * as factory from '../factory';
8
6
  import * as EventOfferService from './offer/event';
9
7
  import * as EventServiceByCOAOfferService from './offer/eventServiceByCOA';
@@ -46,41 +44,3 @@ export declare function searchEventSeatOffersWithPaging(params: {
46
44
  stockHolder: StockHolderRepo;
47
45
  place: PlaceRepo;
48
46
  }) => Promise<Pick<factory.place.seat.IPlaceWithOffer, 'branchCode' | 'containedInPlace' | 'offers' | 'seatingType' | 'typeOf'>[]>;
49
- /**
50
- * イベント変更時処理
51
- */
52
- export declare function onEventChanged(params: factory.task.onEventChanged.IData): (repos: {
53
- event: EventRepo;
54
- project: ProjectRepo;
55
- task: TaskRepo;
56
- }) => Promise<void>;
57
- export declare function syncEventSeries2screeningEvents(params: {
58
- project: {
59
- id: string;
60
- };
61
- ids: string[];
62
- }): (repos: {
63
- event: EventRepo;
64
- }) => Promise<void>;
65
- export declare function createAggregateScreeningEventIfNotExist(params: {
66
- project: {
67
- id: string;
68
- };
69
- reservationFor: {
70
- id: string;
71
- }[];
72
- force: boolean;
73
- identifier: string;
74
- }): (repos: {
75
- task: TaskRepo;
76
- }) => Promise<void>;
77
- export declare function createInformTasks(params: {
78
- project: {
79
- id: string;
80
- };
81
- ids: string[];
82
- typeOf: factory.eventType;
83
- }): (repos: {
84
- event: EventRepo;
85
- task: TaskRepo;
86
- }) => Promise<void>;