@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
@@ -8,6 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
11
22
  Object.defineProperty(exports, "__esModule", { value: true });
12
23
  exports.call = call;
13
24
  const factory = require("../../factory");
@@ -24,6 +35,7 @@ const unitPriceInCatalog_1 = require("../../repo/offer/unitPriceInCatalog");
24
35
  const offerCatalog_1 = require("../../repo/offerCatalog");
25
36
  const offerCatalogItem_1 = require("../../repo/offerCatalogItem");
26
37
  const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
38
+ const entranceGate_1 = require("../../repo/place/entranceGate");
27
39
  const hasPOS_1 = require("../../repo/place/hasPOS");
28
40
  const movieTheater_1 = require("../../repo/place/movieTheater");
29
41
  const screeningRoom_1 = require("../../repo/place/screeningRoom");
@@ -36,7 +48,6 @@ const onAggregateOfferUpdated_1 = require("./onResourceUpdated/onAggregateOfferU
36
48
  const onCategoryCodeUpdated_1 = require("./onResourceUpdated/onCategoryCodeUpdated");
37
49
  const onHasPOSUpdated_1 = require("./onResourceUpdated/onHasPOSUpdated");
38
50
  const onOfferCatalogUpdated_1 = require("./onResourceUpdated/onOfferCatalogUpdated");
39
- const onResourceDeleted_1 = require("./onResourceUpdated/onResourceDeleted");
40
51
  /**
41
52
  * タスク実行関数
42
53
  */
@@ -48,6 +59,7 @@ function call(data) {
48
59
  aggregateOffer: new aggregateOffer_1.AggregateOfferRepo(connection),
49
60
  categoryCode: new categoryCode_1.CategoryCodeRepo(connection),
50
61
  creativeWork: new creativeWork_1.CreativeWorkRepo(connection),
62
+ entranceGate: new entranceGate_1.EntranceGateRepo(connection, { id: '' }), // 先の処理で明示的に指定される
51
63
  event: new event_1.EventRepo(connection),
52
64
  eventSeries: new eventSeries_1.EventSeriesRepo(connection),
53
65
  hasPOS: new hasPOS_1.HasPOSRepo(connection, { id: '' }), // 先の処理で明示的に指定される
@@ -73,7 +85,9 @@ function onResourceUpdated(params) {
73
85
  return (repos) => __awaiter(this, void 0, void 0, function* () {
74
86
  const isDeleted = params.isDeleted === true;
75
87
  if (isDeleted) {
76
- yield (0, onResourceDeleted_1.onResourceDeleted)(params)(repos);
88
+ // migrate to onResourceDeleted task(2026-01-16~)
89
+ throw new factory.errors.Argument('isDeleted', 'isDeleted must be false');
90
+ // await onResourceDeleted(params)(repos);
77
91
  }
78
92
  else {
79
93
  const setting = yield repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['onResourceUpdated', 'useInformResourceTypes']);
@@ -118,6 +132,14 @@ function onResourceUpdated(params) {
118
132
  typeOf: params.typeOf
119
133
  }, setting)(repos);
120
134
  break;
135
+ // ルーム通知に対応(2026-01-16~)
136
+ case factory.placeType.ScreeningRoom:
137
+ yield createInformRoomTasks(params, setting)(repos);
138
+ break;
139
+ // 入場ゲート通知に対応(2026-01-17~)
140
+ case factory.placeType.EntranceGate:
141
+ yield createInformEntranceGateTasks(params, setting)(repos);
142
+ break;
121
143
  case 'AccountTitle':
122
144
  yield createInformAccountTitleTasks({
123
145
  project: { id: params.project.id },
@@ -397,27 +419,28 @@ function createInformCategoryCodeTasks(params, setting) {
397
419
  }
398
420
  });
399
421
  }
400
- // tslint:disable-next-line:max-func-body-length
401
422
  function createInformMovieTheaterTasks(params, setting) {
402
- return (repos
403
- // settings: Settings
404
- ) => __awaiter(this, void 0, void 0, function* () {
423
+ // tslint:disable-next-line:max-func-body-length
424
+ return (repos) => __awaiter(this, void 0, void 0, function* () {
405
425
  var _a;
406
- if (params.ids.length !== 1) {
407
- throw new factory.errors.Argument('id', 'id.length must be 1');
426
+ // 複数対応(2026-01-18~)
427
+ // if (params.ids.length !== 1) {
428
+ // throw new factory.errors.Argument('id', 'id.length must be 1');
429
+ // }
430
+ if (params.ids.length === 0) {
431
+ return;
408
432
  }
409
- // const informResources = settings.onResourceUpdated.informResource;
410
433
  const informResources = (_a = setting === null || setting === void 0 ? void 0 : setting.onResourceUpdated) === null || _a === void 0 ? void 0 : _a.informResource;
411
434
  const movieTheaters = yield repos.movieTheater.projectFields({
412
- limit: 1,
413
- page: 1,
435
+ // limit: 1,
436
+ // page: 1,
414
437
  project: { id: { $eq: params.project.id } },
415
- id: { $eq: params.ids[0] }
438
+ // id: { $eq: params.ids[0] }
439
+ id: { $in: params.ids }
416
440
  }, [
417
441
  'additionalProperty',
418
442
  'branchCode',
419
- 'hasEntranceGate',
420
- // 'hasPOS',
443
+ // 'hasEntranceGate', // migrate to IEntranceGateAsNotification(2026-01-17~)
421
444
  'kanaName',
422
445
  'name',
423
446
  'parentOrganization',
@@ -428,23 +451,33 @@ function createInformMovieTheaterTasks(params, setting) {
428
451
  ]
429
452
  // []
430
453
  );
431
- const movieTheater = movieTheaters.shift();
432
- if (movieTheater === undefined) {
433
- throw new factory.errors.NotFound(factory.placeType.MovieTheater);
434
- }
435
- // ルームを検索
436
- const screeningRooms = yield repos.screeningRoom.searchScreeningRooms({
437
- containedInPlace: { id: { $eq: movieTheater.id } }
454
+ // const movieTheater = movieTheaters.shift();
455
+ // if (movieTheater === undefined) {
456
+ // throw new factory.errors.NotFound(factory.placeType.MovieTheater);
457
+ // }
458
+ // // ルームを検索
459
+ // const screeningRooms = await repos.screeningRoom.findRooms(
460
+ // {
461
+ // containedInPlace: { id: { $eq: movieTheater.id } }
462
+ // }
463
+ // );
464
+ // 入場ゲートを廃止(2026-01-17~)
465
+ const movieTheaters4inform = movieTheaters.map((movieTheater) => {
466
+ const { hasEntranceGate } = movieTheater, movieTheaterWithoutEntranceGates = __rest(movieTheater, ["hasEntranceGate"]);
467
+ return Object.assign({}, movieTheaterWithoutEntranceGates
468
+ // ...movieTheater
469
+ // migrate to IRoomAsNotification(2026-01-16~)
470
+ // containsPlace: screeningRooms.map((room) => {
471
+ // return {
472
+ // branchCode: room.branchCode,
473
+ // name: room.name,
474
+ // typeOf: factory.placeType.ScreeningRoom,
475
+ // additionalProperty: room.additionalProperty,
476
+ // address: room.address
477
+ // };
478
+ // })
479
+ );
438
480
  });
439
- const movieTheaters4inform = [Object.assign(Object.assign({}, movieTheater), { containsPlace: screeningRooms.map((room) => {
440
- return {
441
- branchCode: room.branchCode,
442
- name: room.name,
443
- typeOf: room.typeOf,
444
- additionalProperty: room.additionalProperty,
445
- address: room.address
446
- };
447
- }) })];
448
481
  if (movieTheaters4inform.length > 0) {
449
482
  const taskRunsAt = new Date();
450
483
  const informTasks = [];
@@ -453,8 +486,8 @@ function createInformMovieTheaterTasks(params, setting) {
453
486
  const informUrl = String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.url);
454
487
  movieTheaters4inform.forEach((movieTheater4inform) => {
455
488
  var _a;
456
- // _idは不要であり、存在すると予期せぬ影響を及ぼす可能性がある
457
- delete movieTheater4inform._id;
489
+ // // _idは不要であり、存在すると予期せぬ影響を及ぼす可能性がある
490
+ // delete (<any>movieTheater4inform)._id;
458
491
  const informActionAttributes = {
459
492
  object: movieTheater4inform,
460
493
  recipient: {
@@ -488,6 +521,131 @@ function createInformMovieTheaterTasks(params, setting) {
488
521
  }
489
522
  });
490
523
  }
524
+ // tslint:disable-next-line:max-func-body-length
525
+ function createInformRoomTasks(params, setting) {
526
+ return (repos
527
+ // settings: Settings
528
+ ) => __awaiter(this, void 0, void 0, function* () {
529
+ var _a;
530
+ // const informResources = settings.onResourceUpdated.informResource;
531
+ const informResources = (_a = setting === null || setting === void 0 ? void 0 : setting.onResourceUpdated) === null || _a === void 0 ? void 0 : _a.informResource;
532
+ if (Array.isArray(params.branchCode) && params.branchCode.length > 0) {
533
+ // ルームを検索
534
+ const rooms = (yield repos.screeningRoom.findRooms({
535
+ project: { id: { $eq: params.project.id } },
536
+ branchCode: { $in: params.branchCode },
537
+ containedInPlace: { id: { $eq: params.containedInPlace.id } }
538
+ }));
539
+ const rooms4inform = rooms.map((room) => {
540
+ return {
541
+ branchCode: room.branchCode,
542
+ name: room.name,
543
+ typeOf: factory.placeType.ScreeningRoom,
544
+ additionalProperty: room.additionalProperty,
545
+ address: room.address,
546
+ containedInPlace: { id: params.containedInPlace.id },
547
+ project: { id: params.project.id }
548
+ };
549
+ });
550
+ if (rooms4inform.length > 0) {
551
+ const taskRunsAt = new Date();
552
+ const informTasks = [];
553
+ informResources === null || informResources === void 0 ? void 0 : informResources.forEach((informResource) => {
554
+ var _a;
555
+ const informUrl = String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.url);
556
+ rooms4inform.forEach((room4inform) => {
557
+ var _a;
558
+ const informActionAttributes = {
559
+ object: room4inform,
560
+ recipient: {
561
+ id: '',
562
+ name: String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.name),
563
+ typeOf: factory.creativeWorkType.WebApplication
564
+ },
565
+ target: {
566
+ httpMethod: 'POST',
567
+ encodingType: factory.encodingFormat.Application.json,
568
+ typeOf: 'EntryPoint',
569
+ urlTemplate: informUrl
570
+ }
571
+ };
572
+ informTasks.push({
573
+ project: { id: params.project.id, typeOf: factory.organizationType.Project },
574
+ name: factory.taskName.TriggerWebhook,
575
+ status: factory.taskStatus.Ready,
576
+ runsAt: taskRunsAt,
577
+ remainingNumberOfTries: 10,
578
+ numberOfTried: 0,
579
+ executionResults: [],
580
+ data: informActionAttributes
581
+ });
582
+ });
583
+ });
584
+ if (informTasks.length > 0) {
585
+ yield repos.task.saveMany(informTasks, { emitImmediately: true });
586
+ }
587
+ }
588
+ }
589
+ });
590
+ }
591
+ // tslint:disable-next-line:max-func-body-length
592
+ function createInformEntranceGateTasks(params, setting) {
593
+ return (repos) => __awaiter(this, void 0, void 0, function* () {
594
+ var _a;
595
+ const informResources = (_a = setting === null || setting === void 0 ? void 0 : setting.onResourceUpdated) === null || _a === void 0 ? void 0 : _a.informResource;
596
+ if (Array.isArray(params.identifier) && params.identifier.length > 0) {
597
+ // 入場ゲートを検索
598
+ repos.entranceGate.setOperatorId({ id: params.containedInPlace.id });
599
+ const entranceGates = (yield repos.entranceGate.findEntranceGates({
600
+ project: { id: { $eq: params.project.id } },
601
+ identifier: { $in: params.identifier }
602
+ }));
603
+ const entranceGatesAsNotification = [{
604
+ id: params.containedInPlace.id,
605
+ typeOf: factory.placeType.MovieTheater,
606
+ hasEntranceGate: entranceGates.map((entranceGate) => {
607
+ return Object.assign(Object.assign({}, entranceGate), { typeOf: factory.placeType.Place });
608
+ })
609
+ }];
610
+ const taskRunsAt = new Date();
611
+ const informTasks = [];
612
+ informResources === null || informResources === void 0 ? void 0 : informResources.forEach((informResource) => {
613
+ var _a;
614
+ const informUrl = String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.url);
615
+ entranceGatesAsNotification.forEach((entranceGateAsNotification) => {
616
+ var _a;
617
+ const informActionAttributes = {
618
+ object: entranceGateAsNotification,
619
+ recipient: {
620
+ id: '',
621
+ name: String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.name),
622
+ typeOf: factory.creativeWorkType.WebApplication
623
+ },
624
+ target: {
625
+ httpMethod: 'POST',
626
+ encodingType: factory.encodingFormat.Application.json,
627
+ typeOf: 'EntryPoint',
628
+ urlTemplate: informUrl
629
+ }
630
+ };
631
+ informTasks.push({
632
+ project: { id: params.project.id, typeOf: factory.organizationType.Project },
633
+ name: factory.taskName.TriggerWebhook,
634
+ status: factory.taskStatus.Ready,
635
+ runsAt: taskRunsAt,
636
+ remainingNumberOfTries: 10,
637
+ numberOfTried: 0,
638
+ executionResults: [],
639
+ data: informActionAttributes
640
+ });
641
+ });
642
+ });
643
+ if (informTasks.length > 0) {
644
+ yield repos.task.saveMany(informTasks, { emitImmediately: true });
645
+ }
646
+ }
647
+ });
648
+ }
491
649
  function createInformAccountTitleTasks(params, setting) {
492
650
  return (repos
493
651
  // settings: Settings
@@ -566,22 +724,27 @@ function createInformAccountTitleTasks(params, setting) {
566
724
  }
567
725
  function syncMovieTheater(params) {
568
726
  return (repos) => __awaiter(this, void 0, void 0, function* () {
569
- if (params.ids.length !== 1) {
570
- throw new factory.errors.Argument('id', 'id.length must be 1');
727
+ // if (params.ids.length !== 1) {
728
+ // throw new factory.errors.Argument('id', 'id.length must be 1');
729
+ // }
730
+ if (params.ids.length === 0) {
731
+ return;
571
732
  }
572
733
  const movieTheaters = yield repos.movieTheater.projectFields({
573
- id: { $eq: params.ids[0] },
734
+ id: { $in: params.ids },
574
735
  project: { id: { $eq: params.project.id } }
575
736
  }, ['id', 'name']
576
737
  // []
577
738
  );
578
- const movieTheater = movieTheaters.shift();
579
- if (movieTheater === undefined) {
580
- throw new factory.errors.NotFound(factory.placeType.MovieTheater);
739
+ // const movieTheater = movieTheaters.shift();
740
+ // if (movieTheater === undefined) {
741
+ // throw new factory.errors.NotFound(factory.placeType.MovieTheater);
742
+ // }
743
+ for (const movieTheater of movieTheaters) {
744
+ yield repos.screeningRoom.updateScreeningRoomsByContainedInPlaceId({
745
+ project: { id: params.project.id },
746
+ containedInPlace: movieTheater
747
+ });
581
748
  }
582
- yield repos.screeningRoom.updateScreeningRoomsByContainedInPlaceId({
583
- project: { id: params.project.id },
584
- containedInPlace: movieTheater
585
- });
586
749
  });
587
750
  }
@@ -216,7 +216,7 @@ function syncEvents(params) {
216
216
  throw new factory.errors.NotFound(factory.placeType.MovieTheater);
217
217
  }
218
218
  // console.log('movieTheater:', movieTheater);
219
- const screeningRoom = (yield repos.screeningRoom.searchScreeningRooms({
219
+ const screeningRoom = (yield repos.screeningRoom.findRooms({
220
220
  project: { id: { $eq: params.project.id } },
221
221
  containedInPlace: { branchCode: { $eq: movieTheater.branchCode } },
222
222
  branchCode: { $eq: roomCode }
@@ -236,7 +236,9 @@ function syncEvents(params) {
236
236
  }, [
237
237
  'project', 'typeOf', 'eventStatus', 'identifier',
238
238
  'name', 'kanaName', 'alternativeHeadline', 'location',
239
- 'organizer', 'videoFormat', 'soundFormat', 'workPerformed',
239
+ 'organizer',
240
+ // 'videoFormat', // 参照廃止(2026-02-10~)
241
+ 'soundFormat', 'workPerformed',
240
242
  'duration', 'endDate', 'startDate', 'coaInfo',
241
243
  'offers', 'additionalProperty'
242
244
  ])).shift();
@@ -59,6 +59,7 @@ function executeTask(task, next) {
59
59
  case factory.taskName.ImportOffersFromCOA:
60
60
  case factory.taskName.InvalidatePaymentUrl:
61
61
  case factory.taskName.OnAuthorizationCreated:
62
+ case factory.taskName.OnResourceDeleted:
62
63
  case factory.taskName.Pay:
63
64
  case factory.taskName.PublishPaymentUrl:
64
65
  case factory.taskName.Refund:
package/package.json CHANGED
@@ -11,8 +11,8 @@
11
11
  "dependencies": {
12
12
  "@aws-sdk/client-cognito-identity-provider": "3.600.0",
13
13
  "@aws-sdk/credential-providers": "3.600.0",
14
- "@chevre/factory": "5.4.0-alpha.9",
15
- "@cinerino/sdk": "12.12.1",
14
+ "@chevre/factory": "5.4.0-alpha.30",
15
+ "@cinerino/sdk": "13.0.0",
16
16
  "@motionpicture/coa-service": "9.6.0",
17
17
  "@motionpicture/gmo-service": "5.4.0-alpha.1",
18
18
  "@sendgrid/client": "8.1.4",
@@ -25,14 +25,16 @@
25
25
  "lodash.difference": "^4.5.0",
26
26
  "moment": "^2.29.1",
27
27
  "moment-timezone": "^0.5.33",
28
- "node-fpe": "1.0.0",
29
- "pug": "^2.0.4",
28
+ "node-fpe-v1": "npm:node-fpe@1.0.0",
29
+ "node-fpe-v2": "npm:node-fpe@2.0.4",
30
+ "pug": "3.0.3",
30
31
  "uniqid": "5.4.0",
31
32
  "uuid": "^3.4.0"
32
33
  },
33
34
  "description": "Chevre Domain Library for Node.js",
34
35
  "devDependencies": {
35
36
  "@eslint/js": "9.16.0",
37
+ "@json2csv/plainjs": "7.0.6",
36
38
  "@sendgrid/helpers": "8.0.0",
37
39
  "@types/debug": "0.0.30",
38
40
  "@types/google-libphonenumber": "^7.4.19",
@@ -42,9 +44,9 @@
42
44
  "@types/lodash.difference": "^4.5.6",
43
45
  "@types/mocha": "10.0.7",
44
46
  "@types/moment-timezone": "^0.5.30",
45
- "@types/node": "18.19.2",
47
+ "@types/node": "22.19.7",
46
48
  "@types/power-assert": "^1.5.3",
47
- "@types/pug": "^2.0.4",
49
+ "@types/pug": "2.0.10",
48
50
  "@types/sinon": "^4.3.3",
49
51
  "@types/sinon-mongoose": "^1.3.11",
50
52
  "@types/uniqid": "^4.1.3",
@@ -76,7 +78,7 @@
76
78
  },
77
79
  "engines": {
78
80
  "node": ">=18.0.0",
79
- "npm": ">=6.0.0"
81
+ "npm": ">=10.0.0"
80
82
  },
81
83
  "keywords": [],
82
84
  "license": "UNLICENSED",
@@ -115,5 +117,5 @@
115
117
  "postversion": "git push origin --tags",
116
118
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
117
119
  },
118
- "version": "23.2.0-alpha.6"
120
+ "version": "23.2.0-alpha.60"
119
121
  }
@@ -1,191 +0,0 @@
1
- // tslint:disable:no-console no-magic-numbers
2
- import * as moment from 'moment-timezone';
3
- import * as mongoose from 'mongoose';
4
-
5
- import { chevre } from '../../../../lib/index';
6
-
7
- const project = { id: String(process.env.PROJECT_ID) };
8
- const ADDITIONAL_PROPERTY_NAME = 'sampleCreateId';
9
-
10
- // tslint:disable-next-line:max-func-body-length
11
- async function main() {
12
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
13
-
14
- const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
15
-
16
- const today = moment()
17
- .tz('Asia/Tokyo')
18
- .format('YYYY-MM-DD');
19
- const identifier = `fromSamples:${moment()
20
- .format('YYYY-MM-DD HH:mm')}`;
21
- const settingEvent: chevre.factory.event.screeningEvent.IAttributes = {
22
- identifier,
23
- additionalProperty: [
24
- { name: ADDITIONAL_PROPERTY_NAME, value: identifier }
25
- ],
26
- project: {
27
- id: project.id,
28
- typeOf: chevre.factory.organizationType.Project
29
- },
30
- organizer: {
31
- id: '59d20831e53ebc2b4e774466'
32
- },
33
- typeOf: chevre.factory.eventType.ScreeningEvent,
34
- name: {
35
- en: 'pet IMAX2D',
36
- ja: 'ペット IMAX2D'
37
- },
38
- doorTime: moment(`${today}T13:00:00Z`)
39
- .toDate(),
40
- startDate: moment(`${today}T13:00:00Z`)
41
- .toDate(),
42
- endDate: moment(`${today}T14:00:00Z`)
43
- .toDate(),
44
- eventStatus: chevre.factory.eventStatusType.EventScheduled,
45
- location: {
46
- typeOf: chevre.factory.placeType.ScreeningRoom,
47
- branchCode: '70',
48
- name: {
49
- ja: 'シネマ7',
50
- en: 'CINEMA7'
51
- },
52
- address: {
53
- ja: '',
54
- en: ''
55
- }
56
- },
57
- superEvent: {
58
- typeOf: chevre.factory.eventType.ScreeningEventSeries,
59
- id: 'al9s38bj6',
60
- videoFormat: [
61
- {
62
- typeOf: '2D',
63
- name: '2D'
64
- },
65
- {
66
- typeOf: 'IMAX',
67
- name: 'IMAX'
68
- }
69
- ],
70
- soundFormat: [],
71
- workPerformed: {
72
- typeOf: chevre.factory.creativeWorkType.Movie,
73
- identifier: '1622100',
74
- id: '5bfb841d5a78d7948369980a',
75
- name: {
76
- en: 'Pet',
77
- ja: 'ペット'
78
- },
79
- duration: 'PT2H3M'
80
- },
81
- location: {
82
- typeOf: chevre.factory.placeType.MovieTheater,
83
- id: '5bfb841d5a78d7948369979a',
84
- branchCode: '118',
85
- name: {
86
- ja: 'シネモーション赤坂 ',
87
- en: 'CineMotion Akasaka'
88
- }
89
- },
90
- kanaName: 'ペット IMAX2D',
91
- name: {
92
- en: 'pet IMAX2D',
93
- ja: 'ペット IMAX2D'
94
- },
95
- additionalProperty: [],
96
- startDate: moment('2022-09-30T15:00:00.000Z')
97
- .toDate(),
98
- endDate: moment('2029-07-31T15:00:00.000Z')
99
- .toDate(),
100
- headline: {
101
- ja: 'IMAX2D上映'
102
- }
103
- },
104
- offers: {
105
- typeOf: chevre.factory.offerType.Offer,
106
- eligibleQuantity: {
107
- typeOf: 'QuantitativeValue',
108
- unitCode: chevre.factory.unitCode.C62,
109
- maxValue: 6
110
- },
111
- itemOffered: {
112
- id: '655dc6b02cbb99d946cb6081',
113
- name: {
114
- ja: '通常興行カタログ(サブカタログ版)'
115
- },
116
- serviceOutput: {
117
- typeOf: chevre.factory.reservationType.EventReservation,
118
- reservedTicket: {
119
- typeOf: 'Ticket',
120
- ticketedSeat: {
121
- typeOf: chevre.factory.placeType.Seat
122
- }
123
- }
124
- },
125
- typeOf: chevre.factory.product.ProductType.EventService,
126
- availableChannel: {
127
- typeOf: 'ServiceChannel',
128
- serviceLocation: {
129
- typeOf: chevre.factory.placeType.ScreeningRoom,
130
- branchCode: '70',
131
- name: {
132
- ja: 'シネマ7',
133
- en: 'CINEMA7'
134
- },
135
- containedInPlace: {
136
- typeOf: chevre.factory.placeType.MovieTheater,
137
- id: '5bfb841d5a78d7948369979a',
138
- branchCode: '118',
139
- name: {
140
- ja: 'シネモーション赤坂 ',
141
- en: 'CineMotion Akasaka'
142
- }
143
- }
144
- }
145
- }
146
- },
147
- seller: {
148
- typeOf: chevre.factory.organizationType.Corporation,
149
- id: '59d20831e53ebc2b4e774466',
150
- name: {
151
- ja: 'シネモーション赤坂',
152
- en: 'CineMotion Akasaka'
153
- },
154
- makesOffer: [
155
- ]
156
- }
157
- }
158
- };
159
-
160
- const createResult = await eventRepo.upsertManyScreeningEventByIdentifier(
161
- [
162
- {
163
- $set: settingEvent,
164
- $unset: {}
165
- }
166
- ],
167
- { update: false }
168
- );
169
- // tslint:disable-next-line:no-null-keyword
170
- console.dir(createResult, { depth: null });
171
-
172
- const updateResult = await eventRepo.upsertManyScreeningEventByIdentifier(
173
- [
174
- {
175
- $set: {
176
- ...settingEvent,
177
- eventStatus: chevre.factory.eventStatusType.EventCancelled
178
- },
179
- $unset: {}
180
- }
181
- ],
182
- { update: true }
183
- );
184
- // tslint:disable-next-line:no-null-keyword
185
- console.dir(updateResult, { depth: null });
186
-
187
- }
188
-
189
- main()
190
- .then()
191
- .catch(console.error);