@chevre/domain 23.2.0-alpha.32 → 23.2.0-alpha.34

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.
@@ -21,9 +21,18 @@ interface IUpdateOptions {
21
21
  * 施設の入場ゲートリポジトリ
22
22
  */
23
23
  export declare class EntranceGateRepo {
24
+ /**
25
+ * 施設
26
+ */
24
27
  private readonly operator;
25
28
  private readonly civicStructureModel;
26
29
  constructor(connection: Connection, operater: IOperator);
30
+ /**
31
+ * リポジトリの施設をセットする
32
+ */
33
+ setOperatorId(params: {
34
+ id: string;
35
+ }): void;
27
36
  findEntranceGates(params: factory.place.entranceGate.ISearchConditions): Promise<IEntranceGate[]>;
28
37
  addEntranceGatesByIdentifierIfNotExist(params: {
29
38
  $set: ICreatingEntranceGate;
@@ -22,6 +22,12 @@ class EntranceGateRepo {
22
22
  this.civicStructureModel = connection.model(civicStructure_1.modelName, (0, civicStructure_1.createSchema)());
23
23
  this.operator = operater;
24
24
  }
25
+ /**
26
+ * リポジトリの施設をセットする
27
+ */
28
+ setOperatorId(params) {
29
+ this.operator.id = params.id;
30
+ }
25
31
  findEntranceGates(params) {
26
32
  return __awaiter(this, void 0, void 0, function* () {
27
33
  const aggregate = this.civicStructureModel.aggregate([
@@ -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");
@@ -48,6 +60,7 @@ function call(data) {
48
60
  aggregateOffer: new aggregateOffer_1.AggregateOfferRepo(connection),
49
61
  categoryCode: new categoryCode_1.CategoryCodeRepo(connection),
50
62
  creativeWork: new creativeWork_1.CreativeWorkRepo(connection),
63
+ entranceGate: new entranceGate_1.EntranceGateRepo(connection, { id: '' }), // 先の処理で明示的に指定される
51
64
  event: new event_1.EventRepo(connection),
52
65
  eventSeries: new eventSeries_1.EventSeriesRepo(connection),
53
66
  hasPOS: new hasPOS_1.HasPOSRepo(connection, { id: '' }), // 先の処理で明示的に指定される
@@ -124,6 +137,10 @@ function onResourceUpdated(params) {
124
137
  case factory.placeType.ScreeningRoom:
125
138
  yield createInformRoomTasks(params, setting)(repos);
126
139
  break;
140
+ // 入場ゲート通知に対応(2026-01-17~)
141
+ case factory.placeType.EntranceGate:
142
+ yield createInformEntranceGateTasks(params, setting)(repos);
143
+ break;
127
144
  case 'AccountTitle':
128
145
  yield createInformAccountTitleTasks({
129
146
  project: { id: params.project.id },
@@ -403,27 +420,28 @@ function createInformCategoryCodeTasks(params, setting) {
403
420
  }
404
421
  });
405
422
  }
406
- // tslint:disable-next-line:max-func-body-length
407
423
  function createInformMovieTheaterTasks(params, setting) {
408
- return (repos
409
- // settings: Settings
410
- ) => __awaiter(this, void 0, void 0, function* () {
424
+ // tslint:disable-next-line:max-func-body-length
425
+ return (repos) => __awaiter(this, void 0, void 0, function* () {
411
426
  var _a;
412
- if (params.ids.length !== 1) {
413
- throw new factory.errors.Argument('id', 'id.length must be 1');
427
+ // 複数対応(2026-01-18~)
428
+ // if (params.ids.length !== 1) {
429
+ // throw new factory.errors.Argument('id', 'id.length must be 1');
430
+ // }
431
+ if (params.ids.length === 0) {
432
+ return;
414
433
  }
415
- // const informResources = settings.onResourceUpdated.informResource;
416
434
  const informResources = (_a = setting === null || setting === void 0 ? void 0 : setting.onResourceUpdated) === null || _a === void 0 ? void 0 : _a.informResource;
417
435
  const movieTheaters = yield repos.movieTheater.projectFields({
418
- limit: 1,
419
- page: 1,
436
+ // limit: 1,
437
+ // page: 1,
420
438
  project: { id: { $eq: params.project.id } },
421
- id: { $eq: params.ids[0] }
439
+ // id: { $eq: params.ids[0] }
440
+ id: { $in: params.ids }
422
441
  }, [
423
442
  'additionalProperty',
424
443
  'branchCode',
425
- 'hasEntranceGate',
426
- // 'hasPOS',
444
+ // 'hasEntranceGate', // migrate to IEntranceGateAsNotification(2026-01-17~)
427
445
  'kanaName',
428
446
  'name',
429
447
  'parentOrganization',
@@ -434,17 +452,21 @@ function createInformMovieTheaterTasks(params, setting) {
434
452
  ]
435
453
  // []
436
454
  );
437
- const movieTheater = movieTheaters.shift();
438
- if (movieTheater === undefined) {
439
- throw new factory.errors.NotFound(factory.placeType.MovieTheater);
440
- }
455
+ // const movieTheater = movieTheaters.shift();
456
+ // if (movieTheater === undefined) {
457
+ // throw new factory.errors.NotFound(factory.placeType.MovieTheater);
458
+ // }
441
459
  // // ルームを検索
442
460
  // const screeningRooms = await repos.screeningRoom.findRooms(
443
461
  // {
444
462
  // containedInPlace: { id: { $eq: movieTheater.id } }
445
463
  // }
446
464
  // );
447
- const movieTheaters4inform = [Object.assign({}, movieTheater
465
+ // 入場ゲートを廃止(2026-01-17~)
466
+ const movieTheaters4inform = movieTheaters.map((movieTheater) => {
467
+ const { hasEntranceGate } = movieTheater, movieTheaterWithoutEntranceGates = __rest(movieTheater, ["hasEntranceGate"]);
468
+ return Object.assign({}, movieTheaterWithoutEntranceGates
469
+ // ...movieTheater
448
470
  // migrate to IRoomAsNotification(2026-01-16~)
449
471
  // containsPlace: screeningRooms.map((room) => {
450
472
  // return {
@@ -455,7 +477,8 @@ function createInformMovieTheaterTasks(params, setting) {
455
477
  // address: room.address
456
478
  // };
457
479
  // })
458
- )];
480
+ );
481
+ });
459
482
  if (movieTheaters4inform.length > 0) {
460
483
  const taskRunsAt = new Date();
461
484
  const informTasks = [];
@@ -464,8 +487,8 @@ function createInformMovieTheaterTasks(params, setting) {
464
487
  const informUrl = String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.url);
465
488
  movieTheaters4inform.forEach((movieTheater4inform) => {
466
489
  var _a;
467
- // _idは不要であり、存在すると予期せぬ影響を及ぼす可能性がある
468
- delete movieTheater4inform._id;
490
+ // // _idは不要であり、存在すると予期せぬ影響を及ぼす可能性がある
491
+ // delete (<any>movieTheater4inform)._id;
469
492
  const informActionAttributes = {
470
493
  object: movieTheater4inform,
471
494
  recipient: {
@@ -566,6 +589,64 @@ function createInformRoomTasks(params, setting) {
566
589
  }
567
590
  });
568
591
  }
592
+ // tslint:disable-next-line:max-func-body-length
593
+ function createInformEntranceGateTasks(params, setting) {
594
+ return (repos) => __awaiter(this, void 0, void 0, function* () {
595
+ var _a;
596
+ const informResources = (_a = setting === null || setting === void 0 ? void 0 : setting.onResourceUpdated) === null || _a === void 0 ? void 0 : _a.informResource;
597
+ if (Array.isArray(params.identifier) && params.identifier.length > 0) {
598
+ // 入場ゲートを検索
599
+ repos.entranceGate.setOperatorId({ id: params.containedInPlace.id });
600
+ const entranceGates = (yield repos.entranceGate.findEntranceGates({
601
+ project: { id: { $eq: params.project.id } },
602
+ identifier: { $in: params.identifier }
603
+ }));
604
+ const entranceGatesAsNotification = [{
605
+ id: params.containedInPlace.id,
606
+ typeOf: factory.placeType.MovieTheater,
607
+ hasEntranceGate: entranceGates.map((entranceGate) => {
608
+ return Object.assign(Object.assign({}, entranceGate), { typeOf: factory.placeType.Place });
609
+ })
610
+ }];
611
+ const taskRunsAt = new Date();
612
+ const informTasks = [];
613
+ informResources === null || informResources === void 0 ? void 0 : informResources.forEach((informResource) => {
614
+ var _a;
615
+ const informUrl = String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.url);
616
+ entranceGatesAsNotification.forEach((entranceGateAsNotification) => {
617
+ var _a;
618
+ const informActionAttributes = {
619
+ object: entranceGateAsNotification,
620
+ recipient: {
621
+ id: '',
622
+ name: String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.name),
623
+ typeOf: factory.creativeWorkType.WebApplication
624
+ },
625
+ target: {
626
+ httpMethod: 'POST',
627
+ encodingType: factory.encodingFormat.Application.json,
628
+ typeOf: 'EntryPoint',
629
+ urlTemplate: informUrl
630
+ }
631
+ };
632
+ informTasks.push({
633
+ project: { id: params.project.id, typeOf: factory.organizationType.Project },
634
+ name: factory.taskName.TriggerWebhook,
635
+ status: factory.taskStatus.Ready,
636
+ runsAt: taskRunsAt,
637
+ remainingNumberOfTries: 10,
638
+ numberOfTried: 0,
639
+ executionResults: [],
640
+ data: informActionAttributes
641
+ });
642
+ });
643
+ });
644
+ if (informTasks.length > 0) {
645
+ yield repos.task.saveMany(informTasks, { emitImmediately: true });
646
+ }
647
+ }
648
+ });
649
+ }
569
650
  function createInformAccountTitleTasks(params, setting) {
570
651
  return (repos
571
652
  // settings: Settings
package/package.json CHANGED
@@ -11,7 +11,7 @@
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.20",
14
+ "@chevre/factory": "5.4.0-alpha.22",
15
15
  "@cinerino/sdk": "12.13.0",
16
16
  "@motionpicture/coa-service": "9.6.0",
17
17
  "@motionpicture/gmo-service": "5.4.0-alpha.1",
@@ -116,5 +116,5 @@
116
116
  "postversion": "git push origin --tags",
117
117
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
118
118
  },
119
- "version": "23.2.0-alpha.32"
119
+ "version": "23.2.0-alpha.34"
120
120
  }