@chevre/domain 21.27.0-alpha.6 → 21.27.0-alpha.7

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.
@@ -1,24 +1,25 @@
1
1
  import * as factory from '../../factory';
2
2
  type IEventReservation = factory.reservation.IReservation<factory.reservationType.EventReservation>;
3
3
  type IMaskedUnderName = Pick<factory.reservation.IUnderName<factory.reservationType.EventReservation>, 'id' | 'typeOf'>;
4
- type IEventReservationUnderNameMasked = Omit<factory.reservation.IReservation<factory.reservationType.EventReservation>, 'underName'> & {
5
- underName?: IMaskedUnderName;
6
- };
7
- export declare function maskUnderName(reservation: IEventReservation): IEventReservationUnderNameMasked;
8
- export interface IProject {
4
+ export declare function optimizeUnderName4inform(params: {
5
+ underName: factory.reservation.IUnderName<factory.reservationType.EventReservation>;
6
+ }): IMaskedUnderName;
7
+ interface IProject {
9
8
  id: string;
10
9
  typeOf: factory.organizationType.Project;
11
10
  }
12
- export type ISubReservation = Omit<IEventReservation, 'broker' | 'project' | 'reservationFor' | 'reservationNumber' | 'reservationStatus' | 'underName'>;
11
+ export type ISubReservation4inform = Pick<IEventReservation, 'additionalProperty' | 'additionalTicketText' | 'attended' | 'bookingTime' | 'checkedIn' | 'id' | 'modifiedTime' | 'numSeats' | 'price' | 'programMembershipUsed' | 'reservedTicket' | 'subReservation' | 'typeOf'>;
13
12
  /**
14
13
  * 確定予約通知
15
14
  */
16
15
  export interface IReservationPackage4informConfirmed {
16
+ issuedThrough: factory.reservation.eventReservation.IIssuedThrough;
17
17
  project: IProject;
18
+ provider: factory.reservation.IProvider;
18
19
  reservationFor: factory.reservation.IReservationFor<factory.reservationType.EventReservation>;
19
20
  reservationNumber: string;
20
21
  reservationStatus: factory.reservationStatusType;
21
- subReservation: ISubReservation[];
22
+ subReservation: ISubReservation4inform[];
22
23
  underName?: IMaskedUnderName;
23
24
  typeOf: factory.reservationType.ReservationPackage;
24
25
  }
@@ -1,23 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NUM_TRY_INFORM_RESERVATION = exports.maskUnderName = void 0;
4
- function maskUnderName(reservation) {
5
- var _a;
6
- const underName = (typeof ((_a = reservation.underName) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
7
- // ReservationPackage通知アクションのobject.underNameを最小化(2024-03-19~)
8
- // ? {
9
- // ...reservation.underName,
10
- // email: MASKED_PROFILE,
11
- // telephone: MASKED_PROFILE,
12
- // name: MASKED_PROFILE,
13
- // familyName: MASKED_PROFILE,
14
- // givenName: MASKED_PROFILE,
15
- // // identifierも隠蔽(2022-12-27~)
16
- // identifier: []
17
- // }
18
- ? { id: reservation.underName.id, typeOf: reservation.underName.typeOf }
19
- : undefined;
20
- return Object.assign(Object.assign({}, reservation), (underName !== undefined) ? { underName } : undefined);
3
+ exports.NUM_TRY_INFORM_RESERVATION = exports.optimizeUnderName4inform = void 0;
4
+ function optimizeUnderName4inform(params) {
5
+ // ReservationPackage通知アクションのobject.underNameを最小化(2024-03-19~)
6
+ // ? {
7
+ // ...reservation.underName,
8
+ // email: MASKED_PROFILE,
9
+ // telephone: MASKED_PROFILE,
10
+ // name: MASKED_PROFILE,
11
+ // familyName: MASKED_PROFILE,
12
+ // givenName: MASKED_PROFILE,
13
+ // // identifierも隠蔽(2022-12-27~)
14
+ // identifier: []
15
+ // }
16
+ return { id: params.underName.id, typeOf: params.underName.typeOf };
21
17
  }
22
- exports.maskUnderName = maskUnderName;
18
+ exports.optimizeUnderName4inform = optimizeUnderName4inform;
23
19
  exports.NUM_TRY_INFORM_RESERVATION = 10;
@@ -8,17 +8,6 @@ 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
- };
22
11
  Object.defineProperty(exports, "__esModule", { value: true });
23
12
  exports.onReservationConfirmed = exports.onReservationConfirmedByAction = void 0;
24
13
  /**
@@ -65,30 +54,44 @@ exports.onReservationConfirmedByAction = onReservationConfirmedByAction;
65
54
  function onReservationConfirmed(confirmedReservations) {
66
55
  return (repos) => __awaiter(this, void 0, void 0, function* () {
67
56
  if (Array.isArray(confirmedReservations) && confirmedReservations.length > 0) {
57
+ // ひとつめの予約からReservationPackageの共有属性を取り出す
58
+ const { issuedThrough, project, provider, reservationFor, reservationNumber, reservationStatus, underName } = confirmedReservations[0];
68
59
  yield (0, offer_1.createAggregateScreeningEventIfNotExist)({
69
- project: confirmedReservations[0].project,
70
- reservationFor: [{ id: confirmedReservations[0].reservationFor.id }],
60
+ project,
61
+ reservationFor: [{ id: reservationFor.id }],
71
62
  force: false,
72
- identifier: `onReservationConfirmed:${confirmedReservations[0].reservationNumber}`
63
+ identifier: `onReservationConfirmed:${reservationNumber}`
73
64
  })({ task: repos.task });
74
65
  const now = new Date();
75
66
  const taskAttributes = [];
76
67
  // inform galobally
77
68
  if (Array.isArray(informReservations)) {
78
69
  taskAttributes.push(...informReservations.map((informReservation) => {
79
- var _a, _b;
80
- const informUrl = String((_a = informReservation.recipient) === null || _a === void 0 ? void 0 : _a.url);
70
+ var _a;
71
+ const subReservations4inform = confirmedReservations.map((r) => {
72
+ // const {
73
+ // broker, project, reservationFor, reservationNumber, reservationStatus, underName,
74
+ // ...subReservation
75
+ // } = r;
76
+ const { additionalProperty, additionalTicketText, attended, bookingTime, checkedIn, id, modifiedTime, numSeats, price, programMembershipUsed, reservedTicket, subReservation, typeOf } = r;
77
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ id,
78
+ typeOf,
79
+ reservedTicket }, (Array.isArray(additionalProperty)) ? { additionalProperty } : undefined), (typeof additionalTicketText === 'string') ? { additionalTicketText } : undefined), (typeof attended === 'boolean') ? { attended } : undefined), (typeof checkedIn === 'boolean') ? { checkedIn } : undefined), (bookingTime instanceof Date) ? { bookingTime } : undefined), (modifiedTime instanceof Date) ? { modifiedTime } : undefined), (typeof numSeats === 'number') ? { numSeats } : undefined), (price !== undefined) ? { price } : undefined), (programMembershipUsed !== undefined) ? { programMembershipUsed } : undefined), (Array.isArray(subReservation)) ? { subReservation } : undefined);
80
+ });
81
81
  // ReservationPackage通知に変更(2022-12-24~)
82
- const informObject = [Object.assign({ project: confirmedReservations[0].project, reservationFor: confirmedReservations[0].reservationFor, reservationNumber: confirmedReservations[0].reservationNumber, reservationStatus: confirmedReservations[0].reservationStatus, subReservation: confirmedReservations.map((r) => {
83
- const { broker, project, reservationFor, reservationNumber, reservationStatus, underName } = r, subReservation = __rest(r, ["broker", "project", "reservationFor", "reservationNumber", "reservationStatus", "underName"]);
84
- return subReservation;
85
- }), typeOf: factory.reservationType.ReservationPackage }, (typeof ((_b = confirmedReservations[0].underName) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string')
86
- ? { underName: (0, factory_1.maskUnderName)(confirmedReservations[0]).underName }
82
+ const informObject = [Object.assign({ issuedThrough,
83
+ project,
84
+ provider,
85
+ reservationFor,
86
+ reservationNumber,
87
+ reservationStatus, subReservation: subReservations4inform, typeOf: factory.reservationType.ReservationPackage }, (typeof (underName === null || underName === void 0 ? void 0 : underName.typeOf) === 'string')
88
+ ? { underName: (0, factory_1.optimizeUnderName4inform)({ underName }) }
87
89
  : undefined)];
90
+ const informUrl = String((_a = informReservation.recipient) === null || _a === void 0 ? void 0 : _a.url);
88
91
  const informReservationAttributes = {
89
- agent: confirmedReservations[0].project,
92
+ agent: project,
90
93
  object: informObject,
91
- project: confirmedReservations[0].project,
94
+ project,
92
95
  recipient: {
93
96
  id: '',
94
97
  name: informUrl,
@@ -98,7 +101,7 @@ function onReservationConfirmed(confirmedReservations) {
98
101
  typeOf: factory.actionType.InformAction
99
102
  };
100
103
  return {
101
- project: confirmedReservations[0].project,
104
+ project,
102
105
  name: factory.taskName.TriggerWebhook,
103
106
  status: factory.taskStatus.Ready,
104
107
  runsAt: now,
@@ -1,11 +1,10 @@
1
1
  /**
2
2
  * 予約サービス
3
3
  */
4
- import { maskUnderName } from './reserve/factory';
5
4
  import { cancelPendingReservation, cancelReservation } from './reserve/cancelReservation';
6
5
  import { checkInReservation } from './reserve/checkInReservation';
7
6
  import { confirmReservation } from './reserve/confirmReservation';
8
7
  import { findByCode } from './reserve/findByCode';
9
8
  import { searchByOrder } from './reserve/searchByOrder';
10
9
  import { verifyToken4reservation } from './reserve/verifyToken4reservation';
11
- export { maskUnderName, cancelPendingReservation, cancelReservation, checkInReservation, confirmReservation, findByCode, searchByOrder, verifyToken4reservation };
10
+ export { cancelPendingReservation, cancelReservation, checkInReservation, confirmReservation, findByCode, searchByOrder, verifyToken4reservation };
@@ -1,11 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.verifyToken4reservation = exports.searchByOrder = exports.findByCode = exports.confirmReservation = exports.checkInReservation = exports.cancelReservation = exports.cancelPendingReservation = exports.maskUnderName = void 0;
3
+ exports.verifyToken4reservation = exports.searchByOrder = exports.findByCode = exports.confirmReservation = exports.checkInReservation = exports.cancelReservation = exports.cancelPendingReservation = void 0;
4
4
  /**
5
5
  * 予約サービス
6
6
  */
7
- const factory_1 = require("./reserve/factory");
8
- Object.defineProperty(exports, "maskUnderName", { enumerable: true, get: function () { return factory_1.maskUnderName; } });
9
7
  const cancelReservation_1 = require("./reserve/cancelReservation");
10
8
  Object.defineProperty(exports, "cancelPendingReservation", { enumerable: true, get: function () { return cancelReservation_1.cancelPendingReservation; } });
11
9
  Object.defineProperty(exports, "cancelReservation", { enumerable: true, get: function () { return cancelReservation_1.cancelReservation; } });
@@ -17,6 +15,5 @@ const findByCode_1 = require("./reserve/findByCode");
17
15
  Object.defineProperty(exports, "findByCode", { enumerable: true, get: function () { return findByCode_1.findByCode; } });
18
16
  const searchByOrder_1 = require("./reserve/searchByOrder");
19
17
  Object.defineProperty(exports, "searchByOrder", { enumerable: true, get: function () { return searchByOrder_1.searchByOrder; } });
20
- // import { useReservation } from './reserve/useReservation';
21
18
  const verifyToken4reservation_1 = require("./reserve/verifyToken4reservation");
22
19
  Object.defineProperty(exports, "verifyToken4reservation", { enumerable: true, get: function () { return verifyToken4reservation_1.verifyToken4reservation; } });
package/package.json CHANGED
@@ -110,5 +110,5 @@
110
110
  "postversion": "git push origin --tags",
111
111
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
112
112
  },
113
- "version": "21.27.0-alpha.6"
113
+ "version": "21.27.0-alpha.7"
114
114
  }