@chevre/domain 23.2.0-alpha.6 → 23.2.0-alpha.60

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 (133) hide show
  1. package/example/src/chevre/acceptedPaymentMethodOffer/adminAcceptedPaymentMethodOffers.ts +25 -17
  2. package/example/src/chevre/confirmationNumber/testRandomness.ts +49 -0
  3. package/example/src/chevre/emailMessage/createEmailMessageText.ts +63 -0
  4. package/example/src/chevre/event/importEventsFromCOAByTitle.ts +2 -2
  5. package/example/src/chevre/event/unsetSuperEventVideoFormat.ts +30 -0
  6. package/example/src/chevre/eventSeries/unsetVideoFormat.ts +31 -0
  7. package/example/src/chevre/{upsertScreeningEventSeriesByVersion.ts → eventSeries/upsertScreeningEventSeriesByVersion.ts} +47 -43
  8. package/example/src/chevre/{upsertOfferCatalogItemsByIdentifier.ts → offerCatalog/upsertOfferCatalogItemsByIdentifier.ts} +6 -3
  9. package/example/src/chevre/{upsertOfferCatalogsByIdentifier.ts → offerCatalog/upsertOfferCatalogsByIdentifier.ts} +8 -3
  10. package/example/src/chevre/{upsertOffersByIdentifier.ts → offers/upsertOffersByIdentifier.ts} +5 -3
  11. package/example/src/chevre/orderNumber/decryptOrderNumber.ts +14 -0
  12. package/example/src/chevre/orderNumber/testRandomness.ts +54 -0
  13. package/example/src/chevre/place/adminEntranceGates.ts +69 -0
  14. package/example/src/chevre/place/checkEntranceGatesCount.ts +82 -0
  15. package/example/src/chevre/place/findRooms.ts +24 -0
  16. package/example/src/chevre/place/findSections.ts +28 -0
  17. package/example/src/chevre/place/migrateSectionIdentifier.ts +92 -0
  18. package/example/src/chevre/place/seatsJson2csv.ts +63 -0
  19. package/example/src/chevre/place/upsertMovieTheatersByBranchCode.ts +41 -0
  20. package/example/src/chevre/place/upsertRoomsByBranchCode.ts +40 -0
  21. package/example/src/chevre/place/upsertSeatSectionsByBranchCode.ts +56 -0
  22. package/example/src/chevre/reIndex.ts +1 -1
  23. package/example/src/chevre/roles/addAdminAcceptedPaymentMethodReadPermissionIfNotExists.ts +33 -0
  24. package/example/src/chevre/roles/addAdminAcceptedPaymentMethodWritePermissionIfNotExists.ts +33 -0
  25. package/example/src/chevre/roles/addAdminMovieReadPermissionIfNotExists.ts +49 -0
  26. package/example/src/chevre/roles/addAdminRoomReadPermissionIfNotExists.ts +34 -0
  27. package/example/src/chevre/roles/addAdminRoomWritePermissionIfNotExists.ts +34 -0
  28. package/example/src/chevre/settings/addOrderNumberSetting.ts +44 -0
  29. package/example/src/chevre/settings/addTransactionNumberSetting.ts +40 -0
  30. package/example/src/chevre/transactionNumber/publishByTimestamp.ts +23 -0
  31. package/example/src/chevre/transactionNumber/testRandomness.ts +42 -0
  32. package/example/src/chevre/unsetUnnecessaryFields.ts +8 -4
  33. package/lib/chevre/emailMessageBuilder.js +1 -0
  34. package/lib/chevre/factory/event.d.ts +1 -1
  35. package/lib/chevre/factory/event.js +11 -5
  36. package/lib/chevre/factory/transactionNumber.d.ts +19 -0
  37. package/lib/chevre/factory/transactionNumber.js +54 -0
  38. package/lib/chevre/repo/acceptedPaymentMethod.d.ts +41 -8
  39. package/lib/chevre/repo/acceptedPaymentMethod.js +72 -27
  40. package/lib/chevre/repo/aggregateOffer.d.ts +6 -1
  41. package/lib/chevre/repo/aggregateOffer.js +11 -3
  42. package/lib/chevre/repo/aggregateOrder.js +0 -93
  43. package/lib/chevre/repo/aggregateReservation.d.ts +0 -1
  44. package/lib/chevre/repo/aggregateReservation.js +0 -2
  45. package/lib/chevre/repo/confirmationNumber.d.ts +1 -0
  46. package/lib/chevre/repo/confirmationNumber.js +32 -25
  47. package/lib/chevre/repo/event.d.ts +3 -3
  48. package/lib/chevre/repo/event.js +20 -8
  49. package/lib/chevre/repo/eventOffer.d.ts +8 -0
  50. package/lib/chevre/repo/eventOffer.js +11 -0
  51. package/lib/chevre/repo/eventSeries.d.ts +18 -25
  52. package/lib/chevre/repo/eventSeries.js +155 -101
  53. package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +0 -1
  54. package/lib/chevre/repo/mongoose/schemas/eventSeries.js +13 -25
  55. package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +2 -8
  56. package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.js +28 -2
  57. package/lib/chevre/repo/mongoose/schemas/place.d.ts +6 -2
  58. package/lib/chevre/repo/mongoose/schemas/setting.d.ts +40 -0
  59. package/lib/chevre/repo/mongoose/schemas/setting.js +3 -0
  60. package/lib/chevre/repo/offerCatalog.d.ts +14 -1
  61. package/lib/chevre/repo/offerCatalog.js +41 -19
  62. package/lib/chevre/repo/offerCatalogItem.d.ts +10 -1
  63. package/lib/chevre/repo/offerCatalogItem.js +32 -17
  64. package/lib/chevre/repo/orderNumber.d.ts +7 -0
  65. package/lib/chevre/repo/orderNumber.js +110 -34
  66. package/lib/chevre/repo/place/entranceGate.d.ts +57 -0
  67. package/lib/chevre/repo/place/entranceGate.js +172 -0
  68. package/lib/chevre/repo/place/movieTheater.d.ts +40 -3
  69. package/lib/chevre/repo/place/movieTheater.js +77 -6
  70. package/lib/chevre/repo/place/screeningRoom.d.ts +60 -31
  71. package/lib/chevre/repo/place/screeningRoom.js +227 -135
  72. package/lib/chevre/repo/place/seat.d.ts +47 -45
  73. package/lib/chevre/repo/place/seat.js +175 -45
  74. package/lib/chevre/repo/place/section.d.ts +60 -30
  75. package/lib/chevre/repo/place/section.js +337 -127
  76. package/lib/chevre/repo/serviceOutputIdentifier.d.ts +3 -1
  77. package/lib/chevre/repo/serviceOutputIdentifier.js +42 -27
  78. package/lib/chevre/repo/setting.d.ts +1 -1
  79. package/lib/chevre/repo/setting.js +2 -2
  80. package/lib/chevre/repo/task.d.ts +1 -1
  81. package/lib/chevre/repo/transactionNumber.d.ts +5 -0
  82. package/lib/chevre/repo/transactionNumber.js +63 -27
  83. package/lib/chevre/repository.d.ts +8 -0
  84. package/lib/chevre/repository.js +16 -0
  85. package/lib/chevre/service/assetTransaction/reserve/start/factory/createStartParams.js +10 -2
  86. package/lib/chevre/service/event/processUpdateMovieTheater.d.ts +1 -1
  87. package/lib/chevre/service/event/processUpdateMovieTheater.js +13 -11
  88. package/lib/chevre/service/event/saveScreeningEventSeries.js +4 -5
  89. package/lib/chevre/service/event/saveScreeningEvents.d.ts +2 -2
  90. package/lib/chevre/service/event/saveScreeningEvents.js +16 -12
  91. package/lib/chevre/service/offer/event/authorize/factory.js +9 -1
  92. package/lib/chevre/service/offer/event/searchEventTicketOffers.js +7 -4
  93. package/lib/chevre/service/offer/event/searchOfferAppliesToMovieTicket.js +9 -6
  94. package/lib/chevre/service/offer/event/searchOffersByIds.js +7 -4
  95. package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.js +7 -1
  96. package/lib/chevre/service/offer/onEventChanged.js +10 -6
  97. package/lib/chevre/service/offer/product.js +1 -1
  98. package/lib/chevre/service/offer.d.ts +5 -0
  99. package/lib/chevre/service/offer.js +34 -9
  100. package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
  101. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +1 -1
  102. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
  103. package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.d.ts +2 -2
  104. package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.js +5 -3
  105. package/lib/chevre/service/task/createEvent/createEventBySchedule/schedule2events.js +4 -2
  106. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByAggregateOffer.d.ts +13 -0
  107. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByAggregateOffer.js +53 -0
  108. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByEventSeries.d.ts +13 -0
  109. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByEventSeries.js +56 -0
  110. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByMovieTheater.d.ts +15 -0
  111. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByMovieTheater.js +58 -0
  112. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByOfferCatalog.d.ts +17 -0
  113. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByOfferCatalog.js +75 -0
  114. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.d.ts +19 -0
  115. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.js +60 -0
  116. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByRoom.d.ts +20 -0
  117. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByRoom.js +51 -0
  118. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesBySeller.d.ts +27 -0
  119. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesBySeller.js +100 -0
  120. package/lib/chevre/service/task/onResourceDeleted.d.ts +6 -0
  121. package/lib/chevre/service/task/onResourceDeleted.js +168 -0
  122. package/lib/chevre/service/task/onResourceUpdated.js +205 -42
  123. package/lib/chevre/service/task/syncResourcesFromCOA.js +4 -2
  124. package/lib/chevre/service/taskHandler.js +1 -0
  125. package/package.json +10 -8
  126. package/example/src/chevre/event/upsertManyScreeningEventByIdentifier.ts +0 -191
  127. package/example/src/chevre/eventSeries/migrateEventSeriesUnacceptedPaymentMethod.ts +0 -93
  128. package/example/src/chevre/offers/createSampleOffers.ts +0 -154
  129. package/example/src/chevre/settings/addSettings.ts +0 -46
  130. package/lib/chevre/service/eventOld.d.ts +0 -60
  131. package/lib/chevre/service/eventOld.js +0 -864
  132. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +0 -45
  133. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +0 -447
@@ -10,60 +10,75 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.ServiceOutputIdentifierRepo = void 0;
13
- const cdigit = require("cdigit");
13
+ // import * as cdigit from 'cdigit';
14
14
  const moment = require("moment-timezone");
15
- // import { RedisClientType } from 'redis';
16
15
  // tslint:disable-next-line:no-require-imports no-var-requires
17
- const fpe = require('node-fpe');
18
- // import { createSchema as createSettingSchema, modelName as settingModelName } from './mongoose/schemas/setting';
19
- const transactionNumber_1 = require("./mongoose/schemas/transactionNumber");
16
+ // const fpe = require('node-fpe-v1');
17
+ const factory = require("../factory");
18
+ const transactionNumber_1 = require("../factory/transactionNumber");
19
+ const setting_1 = require("./mongoose/schemas/setting");
20
+ const transactionNumber_2 = require("./mongoose/schemas/transactionNumber");
20
21
  const transactionNumberCounter_1 = require("./transactionNumberCounter");
21
22
  /**
22
23
  * サービスアウトプット識別子リポジトリ
23
24
  */
24
25
  class ServiceOutputIdentifierRepo {
25
26
  constructor(params) {
26
- // const { connection } = params;
27
- // this.settingModel = connection.model(settingModelName, createSettingSchema());
28
27
  this.counterRepo = new transactionNumberCounter_1.TransactionNumberCounterRepo(params);
28
+ this.settingModel = params.connection.model(setting_1.modelName, (0, setting_1.createSchema)());
29
29
  }
30
- // private static createKey(params: {
31
- // startDate: Date;
32
- // timestamp: string;
33
- // }): string {
34
- // return util.format(
35
- // '%s:%s',
36
- // ServiceOutputIdentifierRepo.REDIS_KEY_PREFIX,
37
- // params.timestamp
38
- // );
39
- // }
40
30
  /**
41
31
  * タイムスタンプから発行する
42
32
  */
43
- publishByTimestamp(params) {
33
+ issueServiceOutputIdentifier(params) {
44
34
  return __awaiter(this, void 0, void 0, function* () {
35
+ const { fpeSecret, version } = yield this.findSetting();
45
36
  const timestamp = moment(params.startDate)
46
37
  .valueOf()
47
38
  .toString();
48
39
  let dataFeedExpires;
49
40
  const dataFeedIdentifier = timestamp;
50
41
  let incrReply;
51
- // const useMongoBySettings = await this.useMongoBySettings(params);
52
42
  dataFeedExpires = moment(params.startDate)
53
43
  .add(1, 'minute') // ミリ秒でカウントしていくので、予約日時後1分で十分
54
44
  .toDate();
55
45
  incrReply = yield this.counterRepo.incrementByMongo({
56
46
  identifier: dataFeedIdentifier,
57
- includedInDataCatalog: { identifier: transactionNumber_1.DataCatalogIdentifier.serviceOutputIdentifier },
47
+ includedInDataCatalog: { identifier: transactionNumber_2.DataCatalogIdentifier.serviceOutputIdentifier },
58
48
  expires: dataFeedExpires
59
49
  });
60
- let identifier = `${timestamp}${incrReply}`;
61
- // checkdigit
62
- const cd = cdigit.luhn.compute(identifier);
63
- identifier = fpe({ password: cd })
64
- .encrypt(identifier);
65
- identifier = `${cd}${identifier}`;
66
- return identifier;
50
+ const transactionFactory = new transactionNumber_1.TransactionNumberFactory({ fpeSecret, version });
51
+ return transactionFactory.generate(timestamp, incrReply);
52
+ // let identifier: string = `${timestamp}${incrReply}`;
53
+ // // checkdigit
54
+ // const cd = cdigit.luhn.compute(identifier);
55
+ // identifier = fpe({ password: cd })
56
+ // .encrypt(identifier);
57
+ // identifier = `${cd}${identifier}`;
58
+ // return identifier;
59
+ });
60
+ }
61
+ findSetting() {
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ const filterQuery = { 'project.id': { $eq: '*' } };
64
+ const projection = {
65
+ _id: 0,
66
+ serviceOutputIdentifier: 1
67
+ };
68
+ const setting = yield this.settingModel.findOne(filterQuery, projection)
69
+ .lean()
70
+ .exec();
71
+ if (setting === null || setting.serviceOutputIdentifier === undefined) {
72
+ throw new factory.errors.NotFound('setting.serviceOutputIdentifier');
73
+ }
74
+ const { fpeSecret, version } = setting.serviceOutputIdentifier;
75
+ if (typeof fpeSecret !== 'string' || fpeSecret === '') {
76
+ throw new factory.errors.NotFound('setting.serviceOutputIdentifier.secret');
77
+ }
78
+ if (typeof version !== 'string' || version === '') {
79
+ throw new factory.errors.NotFound('setting.serviceOutputIdentifier.version');
80
+ }
81
+ return { fpeSecret, version };
67
82
  });
68
83
  }
69
84
  }
@@ -22,7 +22,7 @@ export declare class SettingRepo {
22
22
  $eq: string;
23
23
  };
24
24
  };
25
- }, update: Pick<ISetting, 'onEventChanged' | 'onReservationStatusChanged' | 'onTaskStatusChanged' | 'onResourceUpdated' | 'defaultSenderEmail' | 'useInformResourceTypes' | 'userPoolIdNew' | 'userPoolIdOld' | 'storage' | 'quota' | 'triggerWebhook' | 'waiter'>): Promise<import("mongoose").UpdateWriteOpResult>;
25
+ }, update: Pick<ISetting, 'onEventChanged' | 'onReservationStatusChanged' | 'onTaskStatusChanged' | 'onResourceUpdated' | 'defaultSenderEmail' | 'useInformResourceTypes' | 'userPoolIdNew' | 'userPoolIdOld' | 'storage' | 'quota' | 'triggerWebhook' | 'waiter' | 'orderNumber' | 'transactionNumber'>): Promise<import("mongoose").UpdateWriteOpResult>;
26
26
  unsetUnnecessaryFields(params: {
27
27
  filter: FilterQuery<ISetting>;
28
28
  $unset: any;
@@ -49,9 +49,9 @@ class SettingRepo {
49
49
  }
50
50
  updateByProject(filter, update) {
51
51
  return __awaiter(this, void 0, void 0, function* () {
52
- const { onEventChanged, onReservationStatusChanged, onTaskStatusChanged, onResourceUpdated, defaultSenderEmail, useInformResourceTypes, userPoolIdNew, userPoolIdOld, storage, quota, triggerWebhook, waiter } = update;
52
+ const { onEventChanged, onReservationStatusChanged, onTaskStatusChanged, onResourceUpdated, defaultSenderEmail, useInformResourceTypes, userPoolIdNew, userPoolIdOld, storage, quota, triggerWebhook, waiter, orderNumber, transactionNumber } = update;
53
53
  return this.settingModel.updateOne({ 'project.id': { $eq: filter.project.id.$eq } }, {
54
- $set: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (onEventChanged !== undefined) ? { onEventChanged } : undefined), (onReservationStatusChanged !== undefined) ? { onReservationStatusChanged } : undefined), (onTaskStatusChanged !== undefined) ? { onTaskStatusChanged } : undefined), (onResourceUpdated !== undefined) ? { onResourceUpdated } : undefined), (defaultSenderEmail !== undefined) ? { defaultSenderEmail } : undefined), (useInformResourceTypes !== undefined) ? { useInformResourceTypes } : undefined), (userPoolIdNew !== undefined) ? { userPoolIdNew } : undefined), (userPoolIdOld !== undefined) ? { userPoolIdOld } : undefined), (storage !== undefined) ? { storage } : undefined), (quota !== undefined) ? { quota } : undefined), (triggerWebhook !== undefined) ? { triggerWebhook } : undefined), (waiter !== undefined) ? { waiter } : undefined)
54
+ $set: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (onEventChanged !== undefined) ? { onEventChanged } : undefined), (onReservationStatusChanged !== undefined) ? { onReservationStatusChanged } : undefined), (onTaskStatusChanged !== undefined) ? { onTaskStatusChanged } : undefined), (onResourceUpdated !== undefined) ? { onResourceUpdated } : undefined), (defaultSenderEmail !== undefined) ? { defaultSenderEmail } : undefined), (useInformResourceTypes !== undefined) ? { useInformResourceTypes } : undefined), (userPoolIdNew !== undefined) ? { userPoolIdNew } : undefined), (userPoolIdOld !== undefined) ? { userPoolIdOld } : undefined), (storage !== undefined) ? { storage } : undefined), (quota !== undefined) ? { quota } : undefined), (triggerWebhook !== undefined) ? { triggerWebhook } : undefined), (waiter !== undefined) ? { waiter } : undefined), (orderNumber !== undefined) ? { orderNumber } : undefined), (transactionNumber !== undefined) ? { transactionNumber } : undefined)
55
55
  })
56
56
  .exec();
57
57
  });
@@ -34,7 +34,7 @@ type ICreatingTask = Pick<factory.task.IAttributes<factory.taskName>, 'data' | '
34
34
  export declare class TaskRepo {
35
35
  readonly taskModel: IModel;
36
36
  constructor(connection: Connection);
37
- static CREATE_MONGO_CONDITIONS(params: factory.task.ISearchConditions): FilterQuery<import("@chevre/factory/lib/task").ITask | import("@chevre/factory/lib/task/confirmMoneyTransfer").ITask | import("@chevre/factory/lib/task/confirmRegisterService").ITask | import("@chevre/factory/lib/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/task/createAccountingReport").ITask | import("@chevre/factory/lib/task/createEvent").ITask | import("@chevre/factory/lib/task/deletePerson").ITask | import("@chevre/factory/lib/task/deleteTransaction").ITask | import("@chevre/factory/lib/task/givePointAward").ITask | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").ITask | import("@chevre/factory/lib/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/task/onEventChanged").ITask | import("@chevre/factory/lib/task/onResourceUpdated").ITask | import("@chevre/factory/lib/task/onOrderPaymentCompleted").ITask | import("@chevre/factory/lib/task/placeOrder").ITask | import("@chevre/factory/lib/task/returnOrder").ITask | import("@chevre/factory/lib/task/returnMoneyTransfer").ITask | import("@chevre/factory/lib/task/returnPayTransaction").ITask | import("@chevre/factory/lib/task/returnPointAward").ITask | import("@chevre/factory/lib/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/task/sendEmailMessage").ITask | import("@chevre/factory/lib/task/sendOrder").ITask | import("@chevre/factory/lib/task/triggerWebhook").ITask | import("@chevre/factory/lib/task/useReservation").ITask | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").ITask | import("@chevre/factory/lib/task/voidPayTransaction").ITask | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/voidReserveTransaction").ITask>[];
37
+ static CREATE_MONGO_CONDITIONS(params: factory.task.ISearchConditions): FilterQuery<import("@chevre/factory/lib/task").ITask | import("@chevre/factory/lib/task/confirmMoneyTransfer").ITask | import("@chevre/factory/lib/task/confirmRegisterService").ITask | import("@chevre/factory/lib/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/task/createAccountingReport").ITask | import("@chevre/factory/lib/task/createEvent").ITask | import("@chevre/factory/lib/task/deletePerson").ITask | import("@chevre/factory/lib/task/deleteTransaction").ITask | import("@chevre/factory/lib/task/givePointAward").ITask | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").ITask | import("@chevre/factory/lib/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/task/onEventChanged").ITask | import("@chevre/factory/lib/task/onResourceDeleted").ITask | import("@chevre/factory/lib/task/onResourceUpdated").ITask | import("@chevre/factory/lib/task/onOrderPaymentCompleted").ITask | import("@chevre/factory/lib/task/placeOrder").ITask | import("@chevre/factory/lib/task/returnOrder").ITask | import("@chevre/factory/lib/task/returnMoneyTransfer").ITask | import("@chevre/factory/lib/task/returnPayTransaction").ITask | import("@chevre/factory/lib/task/returnPointAward").ITask | import("@chevre/factory/lib/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/task/sendEmailMessage").ITask | import("@chevre/factory/lib/task/sendOrder").ITask | import("@chevre/factory/lib/task/triggerWebhook").ITask | import("@chevre/factory/lib/task/useReservation").ITask | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").ITask | import("@chevre/factory/lib/task/voidPayTransaction").ITask | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/voidReserveTransaction").ITask>[];
38
38
  runImmediately(params: Pick<factory.task.IAttributes<factory.taskName>, 'data' | 'expires' | 'name' | 'project' | 'remainingNumberOfTries' | 'runsAt'> & {
39
39
  alternateName?: never;
40
40
  identifier?: never;
@@ -1,12 +1,15 @@
1
1
  import type { Connection } from 'mongoose';
2
2
  interface IPublishResult {
3
3
  transactionNumber: string;
4
+ timestamp: string;
5
+ incrReply: number;
4
6
  }
5
7
  /**
6
8
  * 取引番号リポジトリ
7
9
  */
8
10
  export declare class TransactionNumberRepo {
9
11
  private readonly counterRepo;
12
+ private readonly settingModel;
10
13
  constructor(params: {
11
14
  connection: Connection;
12
15
  });
@@ -16,5 +19,7 @@ export declare class TransactionNumberRepo {
16
19
  publishByTimestamp(params: {
17
20
  startDate: Date;
18
21
  }): Promise<IPublishResult>;
22
+ decrypt(id: string): Promise<string>;
23
+ private findSetting;
19
24
  }
20
25
  export {};
@@ -10,60 +10,96 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.TransactionNumberRepo = void 0;
13
- const cdigit = require("cdigit");
14
13
  const moment = require("moment-timezone");
15
- // import { RedisClientType } from 'redis';
16
- // tslint:disable-next-line:no-require-imports no-var-requires
17
- const fpe = require('node-fpe');
18
- // import { createSchema as createSettingSchema, modelName as settingModelName } from './mongoose/schemas/setting';
19
- const transactionNumber_1 = require("./mongoose/schemas/transactionNumber");
14
+ const factory = require("../factory");
15
+ const transactionNumber_1 = require("../factory/transactionNumber");
16
+ const setting_1 = require("./mongoose/schemas/setting");
17
+ const transactionNumber_2 = require("./mongoose/schemas/transactionNumber");
20
18
  const transactionNumberCounter_1 = require("./transactionNumberCounter");
21
19
  /**
22
20
  * 取引番号リポジトリ
23
21
  */
24
22
  class TransactionNumberRepo {
25
23
  constructor(params) {
26
- // const { connection } = params;
27
- // this.settingModel = connection.model(settingModelName, createSettingSchema());
28
24
  this.counterRepo = new transactionNumberCounter_1.TransactionNumberCounterRepo(params);
25
+ this.settingModel = params.connection.model(setting_1.modelName, (0, setting_1.createSchema)());
29
26
  }
30
- // private static createKey(params: {
31
- // startDate: Date;
32
- // timestamp: string;
33
- // }): string {
34
- // return util.format(
35
- // '%s:%s',
36
- // TransactionNumberRepo.REDIS_KEY_PREFIX,
37
- // params.timestamp
38
- // );
39
- // }
40
27
  /**
41
28
  * タイムスタンプから発行する
42
29
  */
43
30
  publishByTimestamp(params) {
44
31
  return __awaiter(this, void 0, void 0, function* () {
32
+ const { fpeSecret, version, validFrom } = yield this.findSetting();
45
33
  const timestamp = moment(params.startDate)
46
34
  .valueOf()
47
35
  .toString();
48
36
  let dataFeedExpires;
49
37
  const dataFeedIdentifier = timestamp;
50
38
  let incrReply;
51
- // const useMongoBySettings = await this.useMongoBySettings(params);
52
39
  dataFeedExpires = moment(params.startDate)
53
40
  .add(1, 'minute') // ミリ秒でカウントしていくので、予約日時後1分で十分
54
41
  .toDate();
55
42
  incrReply = yield this.counterRepo.incrementByMongo({
56
43
  identifier: dataFeedIdentifier,
57
- includedInDataCatalog: { identifier: transactionNumber_1.DataCatalogIdentifier.transactionNumber },
44
+ includedInDataCatalog: { identifier: transactionNumber_2.DataCatalogIdentifier.transactionNumber },
58
45
  expires: dataFeedExpires
59
46
  });
60
- let transactionNumber = `${timestamp}${incrReply}`;
61
- // checkdigit
62
- const cd = cdigit.luhn.compute(transactionNumber);
63
- transactionNumber = fpe({ password: cd })
64
- .encrypt(transactionNumber);
65
- transactionNumber = `${cd}${transactionNumber}`;
66
- return { transactionNumber };
47
+ let transactionNumber;
48
+ const useVersioning = validFrom instanceof Date && moment(validFrom)
49
+ .isSameOrBefore(params.startDate);
50
+ if (typeof fpeSecret === 'string' && typeof version === 'string' && useVersioning) {
51
+ const transactionFactory = new transactionNumber_1.TransactionNumberFactory({ fpeSecret, version });
52
+ transactionNumber = transactionFactory.generate(timestamp, incrReply);
53
+ }
54
+ else {
55
+ // discontinue version0(2026-02-10~)
56
+ throw new factory.errors.NotImplemented('transactionNumber with no version discontinued');
57
+ // transactionNumber = `${timestamp}${incrReply}`;
58
+ // // checkdigit
59
+ // const cd = cdigit.luhn.compute(transactionNumber);
60
+ // transactionNumber = fpe1({ password: cd })
61
+ // .encrypt(transactionNumber);
62
+ // transactionNumber = `${cd}${transactionNumber}`;
63
+ }
64
+ return { transactionNumber, timestamp, incrReply };
65
+ });
66
+ }
67
+ decrypt(id) {
68
+ return __awaiter(this, void 0, void 0, function* () {
69
+ const { fpeSecret, version } = yield this.findSetting();
70
+ if (typeof fpeSecret === 'string' && typeof version === 'string') {
71
+ const transactionFactory = new transactionNumber_1.TransactionNumberFactory({ fpeSecret, version });
72
+ return transactionFactory.decrypt(id);
73
+ }
74
+ else {
75
+ throw new factory.errors.NotImplemented('no version not implemented');
76
+ }
77
+ });
78
+ }
79
+ findSetting() {
80
+ return __awaiter(this, void 0, void 0, function* () {
81
+ const filterQuery = { 'project.id': { $eq: '*' } };
82
+ const projection = {
83
+ _id: 0,
84
+ transactionNumber: 1
85
+ };
86
+ const setting = yield this.settingModel.findOne(filterQuery, projection)
87
+ .lean()
88
+ .exec();
89
+ if (setting === null || setting.transactionNumber === undefined) {
90
+ return {};
91
+ }
92
+ const { fpeSecret, version, validFrom } = setting.transactionNumber;
93
+ if (typeof fpeSecret !== 'string' || fpeSecret === '') {
94
+ throw new factory.errors.NotFound('setting.transactionNumber.secret');
95
+ }
96
+ if (typeof version !== 'string' || version === '') {
97
+ throw new factory.errors.NotFound('setting.transactionNumber.version');
98
+ }
99
+ if (!(validFrom instanceof Date)) {
100
+ throw new factory.errors.NotFound('setting.transactionNumber.validFrom must be Date');
101
+ }
102
+ return { fpeSecret, version, validFrom };
67
103
  });
68
104
  }
69
105
  }
@@ -51,6 +51,7 @@ import type { PaymentServiceProviderRepo } from './repo/paymentServiceProvider';
51
51
  import type { PendingReservationRepo } from './repo/pendingReservation';
52
52
  import type { PermitRepo } from './repo/permit';
53
53
  import type { BusStopRepo } from './repo/place/busStop';
54
+ import type { EntranceGateRepo } from './repo/place/entranceGate';
54
55
  import type { HasPOSRepo } from './repo/place/hasPOS';
55
56
  import type { MovieTheaterRepo } from './repo/place/movieTheater';
56
57
  import type { ScreeningRoomRepo } from './repo/place/screeningRoom';
@@ -316,6 +317,13 @@ export declare namespace place {
316
317
  namespace BusStop {
317
318
  function createInstance(...params: ConstructorParameters<typeof BusStopRepo>): Promise<BusStopRepo>;
318
319
  }
320
+ type EntranceGate = EntranceGateRepo;
321
+ /**
322
+ * 施設の入場ゲートリポジトリ
323
+ */
324
+ namespace EntranceGate {
325
+ function createInstance(...params: ConstructorParameters<typeof EntranceGateRepo>): Promise<EntranceGateRepo>;
326
+ }
319
327
  type HasPOS = HasPOSRepo;
320
328
  /**
321
329
  * 施設PointOfSalesリポジトリ
@@ -721,6 +721,22 @@ var place;
721
721
  }
722
722
  BusStop.createInstance = createInstance;
723
723
  })(BusStop = place.BusStop || (place.BusStop = {}));
724
+ /**
725
+ * 施設の入場ゲートリポジトリ
726
+ */
727
+ let EntranceGate;
728
+ (function (EntranceGate) {
729
+ let repo;
730
+ function createInstance(...params) {
731
+ return __awaiter(this, void 0, void 0, function* () {
732
+ if (repo === undefined) {
733
+ repo = (yield Promise.resolve().then(() => require('./repo/place/entranceGate'))).EntranceGateRepo;
734
+ }
735
+ return new repo(...params);
736
+ });
737
+ }
738
+ EntranceGate.createInstance = createInstance;
739
+ })(EntranceGate = place.EntranceGate || (place.EntranceGate = {}));
724
740
  /**
725
741
  * 施設PointOfSalesリポジトリ
726
742
  */
@@ -38,7 +38,7 @@ function optimizeReservationSuperEvent(params, useOptimizeReservation) {
38
38
  const superEvent = params.superEvent;
39
39
  return Object.assign(Object.assign({ id: superEvent.id,
40
40
  // kanaName: superEvent.kanaName, // 廃止(2024-01-26~)
41
- location: superEvent.location, name: superEvent.name, soundFormat: superEvent.soundFormat, typeOf: superEvent.typeOf, videoFormat: superEvent.videoFormat, workPerformed: superEvent.workPerformed }, (superEvent.headline !== undefined)
41
+ location: superEvent.location, name: superEvent.name, soundFormat: superEvent.soundFormat, typeOf: superEvent.typeOf, workPerformed: superEvent.workPerformed }, (superEvent.headline !== undefined)
42
42
  ? { headline: superEvent.headline }
43
43
  : undefined), (useOptimizeReservation)
44
44
  ? {}
@@ -46,7 +46,15 @@ function optimizeReservationSuperEvent(params, useOptimizeReservation) {
46
46
  additionalProperty: (Array.isArray(superEvent.additionalProperty))
47
47
  ? superEvent.additionalProperty
48
48
  : []
49
- });
49
+ }
50
+ // videoFormatをデータとしても廃止(万が一に備えてUSE_DEPRECATED_VIDEO_FORMATで再設定可能)(2026-02-03~)
51
+ // ...(USE_DEPRECATED_VIDEO_FORMAT)
52
+ // ? {
53
+ // // 現時点で型廃止済だがデータとしては互換性維持(2026-01-15~)
54
+ // videoFormat: (<any>superEvent).videoFormat
55
+ // }
56
+ // : undefined
57
+ );
50
58
  }
51
59
  function createIssuedThrough(params) {
52
60
  var _a;
@@ -19,6 +19,6 @@ declare function processUpdateMovieTheater(params: IImportFromCOAParams): (repos
19
19
  id: string;
20
20
  };
21
21
  movieTheater: IMovieTheater;
22
- screeningRooms: Omit<factory.place.screeningRoom.IPlace, "containsPlace" | "parentOrganization">[];
22
+ screeningRooms: Pick<factory.place.screeningRoom.IPlace, "additionalProperty" | "address" | "branchCode" | "name" | "openSeatingAllowed">[];
23
23
  }>;
24
24
  export { processUpdateMovieTheater };
@@ -65,7 +65,7 @@ function processUpdateMovieTheater(params) {
65
65
  if (movieTheater === undefined) {
66
66
  throw new factory.errors.NotFound(factory.placeType.MovieTheater);
67
67
  }
68
- screeningRooms = yield repos.screeningRoom.searchScreeningRooms({
68
+ screeningRooms = yield repos.screeningRoom.findRooms({
69
69
  project: { id: { $eq: params.project.id } },
70
70
  containedInPlace: { branchCode: { $eq: movieTheater.branchCode } }
71
71
  });
@@ -124,17 +124,19 @@ function createMovieTheaterFromCOA(project, seller, theaterFromCOA, screensFromC
124
124
  typeOf: 'QuantitativeValue',
125
125
  value: 1200,
126
126
  unitCode: factory.unitCode.Sec
127
- },
128
- availabilityStartsGraceTimeOnPOS: {
129
- typeOf: 'QuantitativeValue',
130
- value: -93,
131
- unitCode: factory.unitCode.Day
132
- },
133
- availabilityEndsGraceTimeOnPOS: {
134
- typeOf: 'QuantitativeValue',
135
- value: 2678400,
136
- unitCode: factory.unitCode.Sec
137
127
  }
128
+ // discontinue(2026-01-15~)
129
+ // availabilityStartsGraceTimeOnPOS: {
130
+ // typeOf: 'QuantitativeValue',
131
+ // value: -93,
132
+ // unitCode: factory.unitCode.Day
133
+ // },
134
+ // discontinue(2026-01-15~)
135
+ // availabilityEndsGraceTimeOnPOS: {
136
+ // typeOf: 'QuantitativeValue',
137
+ // value: 2678400,
138
+ // unitCode: factory.unitCode.Sec
139
+ // }
138
140
  },
139
141
  parentOrganization: { id: seller.id, typeOf: factory.organizationType.Corporation }
140
142
  };
@@ -188,10 +188,9 @@ function createScreeningEventSeriesFromCOA(params) {
188
188
  ? { version: params.filmFromCOA.titleBranchNum } // add version(2024-01-31~)
189
189
  : undefined);
190
190
  // redefine videoFormat(2024-09-18~)
191
- // const videoFormat: factory.event.screeningEventSeries.ICOAKubun =
192
- // params.eizouKubuns.filter((kubun) => kubun.kubunCode === params.filmFromCOA.kbnEizou)[0];
193
- const videoFormat = params.joueihousikiKubuns.filter(({ kubunCode }) => kubunCode === params.filmFromCOA.kbnJoueihousiki)
194
- .map(({ kubunCode }) => ({ typeOf: kubunCode, name: kubunCode }));
191
+ // const videoFormat: factory.eventSeries.IVideoFormat[] =
192
+ // params.joueihousikiKubuns.filter(({ kubunCode }) => kubunCode === params.filmFromCOA.kbnJoueihousiki)
193
+ // .map(({ kubunCode }) => ({ typeOf: kubunCode, name: kubunCode }));
195
194
  return {
196
195
  project: { typeOf: params.project.typeOf, id: params.project.id },
197
196
  typeOf: factory.eventType.ScreeningEventSeries,
@@ -214,7 +213,7 @@ function createScreeningEventSeriesFromCOA(params) {
214
213
  },
215
214
  // 必須化(2023-07-12~)
216
215
  organizer: { id: params.seller.id },
217
- videoFormat,
216
+ // videoFormat, // discontinue(2026-02-10~)
218
217
  soundFormat: [],
219
218
  workPerformed,
220
219
  duration: moment.duration(params.filmFromCOA.showTime, 'm')
@@ -7,8 +7,8 @@ import * as factory from '../../factory';
7
7
  type IMovieTheater = Pick<factory.place.movieTheater.IPlace, 'id' | 'typeOf' | 'branchCode' | 'name' | 'kanaName'>;
8
8
  declare function saveScreeningEvents(params: {
9
9
  movieTheater: IMovieTheater;
10
- screeningRooms: Pick<factory.place.screeningRoom.IPlace, 'typeOf' | 'branchCode' | 'name' | 'maximumAttendeeCapacity'>[];
11
- screeningEventSerieses?: factory.eventSeries.IEvent[];
10
+ screeningRooms: Pick<factory.place.screeningRoom.IPlace, 'branchCode' | 'name' | 'maximumAttendeeCapacity'>[];
11
+ screeningEventSerieses?: Omit<factory.eventSeries.IEvent, 'videoFormat'>[];
12
12
  project: {
13
13
  id: string;
14
14
  typeOf: factory.organizationType.Project;
@@ -101,7 +101,9 @@ function createScreeningEvents(params, options) {
101
101
  }, [
102
102
  'project', 'typeOf', 'eventStatus', 'identifier',
103
103
  'name', 'kanaName', 'alternativeHeadline', 'location',
104
- 'organizer', 'videoFormat', 'soundFormat', 'workPerformed',
104
+ 'organizer',
105
+ // 'videoFormat', // 参照廃止(2026-02-10~)
106
+ 'soundFormat', 'workPerformed',
105
107
  'duration', 'endDate', 'startDate', 'coaInfo',
106
108
  'offers', 'additionalProperty'
107
109
  ]);
@@ -170,20 +172,22 @@ function createScreeningEvents(params, options) {
170
172
  });
171
173
  }
172
174
  function minimizeSuperEvent(params) {
173
- const { workPerformed, videoFormat, startDate, soundFormat, name, location, kanaName, identifier, endDate, duration, coaInfo, alternativeHeadline,
174
- // additionalProperty,
175
- typeOf, id
176
- // project,
177
- // organizer,
178
- // offers,
179
- // eventStatus
180
- } = params.superEvent;
175
+ const { workPerformed,
176
+ // videoFormat,
177
+ startDate, soundFormat, name, location, kanaName, identifier, endDate, duration, coaInfo, alternativeHeadline, typeOf, id } = params.superEvent;
181
178
  return {
182
- workPerformed, videoFormat, startDate, soundFormat,
179
+ workPerformed, startDate, soundFormat,
183
180
  name, location, kanaName, identifier,
184
181
  endDate, duration, coaInfo, alternativeHeadline,
185
- // additionalProperty,
186
182
  typeOf, id
183
+ // 完全に廃止(2026-02-10~)
184
+ // // videoFormatをデータとしても廃止(万が一に備えてUSE_DEPRECATED_VIDEO_FORMAT_EVENTSで再設定可能)(2026-02-03~)
185
+ // ...(USE_DEPRECATED_VIDEO_FORMAT_EVENTS)
186
+ // ? {
187
+ // // 現時点で型廃止済だがデータとしては互換性維持(2026-01-15~)
188
+ // videoFormat
189
+ // }
190
+ // : undefined
187
191
  };
188
192
  }
189
193
  /**
@@ -266,7 +270,7 @@ function createScreeningEventFromCOA(params) {
266
270
  name: params.superEvent.name,
267
271
  eventStatus: factory.eventStatusType.EventScheduled,
268
272
  location: {
269
- typeOf: params.screenRoom.typeOf,
273
+ typeOf: factory.placeType.ScreeningRoom,
270
274
  branchCode: params.screenRoom.branchCode,
271
275
  name: params.screenRoom.name
272
276
  },
@@ -297,7 +297,15 @@ function createReservation(params) {
297
297
  startDate: moment(event.startDate)
298
298
  .toDate(),
299
299
  // 最適化(2022-05-31~)
300
- superEvent: Object.assign(Object.assign({ typeOf: event.superEvent.typeOf, id: event.superEvent.id, location: event.superEvent.location, name: event.superEvent.name, soundFormat: event.superEvent.soundFormat, videoFormat: event.superEvent.videoFormat, workPerformed }, (typeof event.superEvent.duration === 'string') ? { duration: event.superEvent.duration } : undefined), (event.superEvent.headline !== undefined) ? { headline: event.superEvent.headline } : undefined)
300
+ superEvent: Object.assign(Object.assign({ typeOf: event.superEvent.typeOf, id: event.superEvent.id, location: event.superEvent.location, name: event.superEvent.name, soundFormat: event.superEvent.soundFormat, workPerformed }, (typeof event.superEvent.duration === 'string') ? { duration: event.superEvent.duration } : undefined), (event.superEvent.headline !== undefined) ? { headline: event.superEvent.headline } : undefined
301
+ // videoFormatをデータとしても廃止(万が一に備えてUSE_DEPRECATED_VIDEO_FORMATで再設定可能)(2026-02-03~)
302
+ // ...(USE_DEPRECATED_VIDEO_FORMAT)
303
+ // ? {
304
+ // // 現時点で型廃止済だがデータとしては互換性維持(2026-01-15~)
305
+ // videoFormat: (<any>event.superEvent).videoFormat
306
+ // }
307
+ // : undefined
308
+ )
301
309
  };
302
310
  if (params.issuedThrough.typeOf !== factory.product.ProductType.EventService) {
303
311
  throw new factory.errors.Argument('issuedThrough', `issuedThrough.typeOf must be ${factory.product.ProductType.EventService}`);
@@ -127,7 +127,7 @@ function searchTicketOffersByItemOffered(params) {
127
127
  function searchEventTicketOffersByEvent(params) {
128
128
  // tslint:disable-next-line:max-func-body-length
129
129
  return (repos) => __awaiter(this, void 0, void 0, function* () {
130
- var _a;
130
+ var _a, _b;
131
131
  const event = params.event;
132
132
  let soundFormatTypes = [];
133
133
  let videoFormatTypes = [];
@@ -137,13 +137,16 @@ function searchEventTicketOffersByEvent(params) {
137
137
  page: 1,
138
138
  id: { $eq: event.superEvent.id }
139
139
  // typeOf: factory.eventType.ScreeningEventSeries
140
- }, ['soundFormat', 'videoFormat']);
140
+ },
141
+ // ['soundFormat', 'videoFormat', 'subEvent']
142
+ ['soundFormat', 'subEvent']);
141
143
  const superEvent = superEvents.shift();
142
144
  if (superEvent === undefined) {
143
145
  throw new factory.errors.NotFound(factory.eventType.ScreeningEventSeries);
144
146
  }
145
147
  soundFormatTypes = (Array.isArray(superEvent.soundFormat)) ? superEvent.soundFormat.map((f) => f.typeOf) : [];
146
- videoFormatTypes = (Array.isArray(superEvent.videoFormat)) ? superEvent.videoFormat.map((f) => f.typeOf) : [];
148
+ // videoFormatTypes = (Array.isArray(superEvent.videoFormat)) ? superEvent.videoFormat.map((f) => f.typeOf) : [];
149
+ videoFormatTypes = (Array.isArray((_a = superEvent.subEvent) === null || _a === void 0 ? void 0 : _a.videoFormat)) ? superEvent.subEvent.videoFormat : [];
147
150
  }
148
151
  const unacceptedPaymentMethod = getUnacceptedPaymentMethodByEvent({ event });
149
152
  // 上映方式がなければMovieTicket除外(2023-02-21~)
@@ -151,7 +154,7 @@ function searchEventTicketOffersByEvent(params) {
151
154
  // 興行設定があれば興行のカタログを参照する(2022-08-31~)
152
155
  const eventOffers = event.offers;
153
156
  const { availableOffers, sortedOfferIds } = yield searchTicketOffersByItemOffered({
154
- itemOffered: { id: String((_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered) === null || _a === void 0 ? void 0 : _a.id) },
157
+ itemOffered: { id: String((_b = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered) === null || _b === void 0 ? void 0 : _b.id) },
155
158
  // ids: params.ids,
156
159
  store: params.store,
157
160
  limit: params.limit,
@@ -28,7 +28,7 @@ function getUnacceptedPaymentMethodByEvent(params) {
28
28
  */
29
29
  function searchOfferAppliesToMovieTicket(params) {
30
30
  return (repos) => __awaiter(this, void 0, void 0, function* () {
31
- var _a, _b, _c, _d;
31
+ var _a, _b, _c, _d, _e;
32
32
  // optimize(2024-07-18~)
33
33
  const event = yield repos.event.projectEventFieldsById({ id: params.event.id }, ['project', 'startDate', 'typeOf', 'superEvent.id', 'offers.itemOffered.id', 'offers.unacceptedPaymentMethod']);
34
34
  // let soundFormatTypes: string[] = [];
@@ -39,13 +39,16 @@ function searchOfferAppliesToMovieTicket(params) {
39
39
  page: 1,
40
40
  id: { $eq: event.superEvent.id }
41
41
  // typeOf: factory.eventType.ScreeningEventSeries
42
- }, ['soundFormat', 'videoFormat']);
42
+ },
43
+ // ['soundFormat', 'videoFormat', 'subEvent']
44
+ ['soundFormat', 'subEvent']);
43
45
  const superEvent = superEvents.shift();
44
46
  if (superEvent === undefined) {
45
47
  throw new factory.errors.NotFound(factory.eventType.ScreeningEventSeries);
46
48
  }
47
49
  // soundFormatTypes = (Array.isArray(superEvent.soundFormat)) ? superEvent.soundFormat.map((f) => f.typeOf) : [];
48
- videoFormatTypes = (Array.isArray(superEvent.videoFormat)) ? superEvent.videoFormat.map((f) => f.typeOf) : [];
50
+ // videoFormatTypes = (Array.isArray(superEvent.videoFormat)) ? superEvent.videoFormat.map((f) => f.typeOf) : [];
51
+ videoFormatTypes = (Array.isArray((_a = superEvent.subEvent) === null || _a === void 0 ? void 0 : _a.videoFormat)) ? superEvent.subEvent.videoFormat : [];
49
52
  }
50
53
  const unacceptedPaymentMethod = getUnacceptedPaymentMethodByEvent({ event });
51
54
  // 上映方式がなければMovieTicket除外
@@ -53,7 +56,7 @@ function searchOfferAppliesToMovieTicket(params) {
53
56
  // 興行設定があれば興行のカタログを参照する
54
57
  const eventOffers = event.offers;
55
58
  let catalogId;
56
- if (typeof ((_a = eventOffers.itemOffered) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
59
+ if (typeof ((_b = eventOffers.itemOffered) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
57
60
  const eventService = (yield repos.product.projectFields({
58
61
  limit: 1,
59
62
  page: 1,
@@ -65,7 +68,7 @@ function searchOfferAppliesToMovieTicket(params) {
65
68
  throw new factory.errors.NotFound(factory.product.ProductType.EventService);
66
69
  }
67
70
  // const firstCatalogIdOfProduct = eventService.hasOfferCatalog?.id; // migrate to itemListElement(2024-09-30~)
68
- const firstCatalogIdOfProduct = (_c = (_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.itemListElement.at(0)) === null || _c === void 0 ? void 0 : _c.id;
71
+ const firstCatalogIdOfProduct = (_d = (_c = eventService.hasOfferCatalog) === null || _c === void 0 ? void 0 : _c.itemListElement.at(0)) === null || _d === void 0 ? void 0 : _d.id;
69
72
  if (typeof firstCatalogIdOfProduct === 'string') {
70
73
  catalogId = firstCatalogIdOfProduct;
71
74
  }
@@ -83,7 +86,7 @@ function searchOfferAppliesToMovieTicket(params) {
83
86
  }
84
87
  return repos.offer.searchAvaialbleAppliesToMovieTicketByOfferCatalogId({
85
88
  subOfferCatalog: { id: subOfferCatalogId, isOfferCatalogItem },
86
- availableAtOrFrom: { id: (_d = params.store) === null || _d === void 0 ? void 0 : _d.id },
89
+ availableAtOrFrom: { id: (_e = params.store) === null || _e === void 0 ? void 0 : _e.id },
87
90
  unacceptedPaymentMethod: unacceptedPaymentMethod,
88
91
  excludeAppliesToMovieTicket: excludeAppliesToMovieTicket,
89
92
  onlyValid: params.onlyValid === true,