@chevre/domain 21.2.0-alpha.99 → 21.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/example/src/chevre/aggregateEventReservation.ts +1 -1
  2. package/example/src/chevre/aggregateSellerPaymentAccepted.ts +27 -0
  3. package/example/src/chevre/aggregation/aggregateSystem.ts +53 -22
  4. package/example/src/chevre/countDelayedTasks.ts +7 -2
  5. package/example/src/chevre/createManyEventsIfNotExist.ts +199 -46
  6. package/example/src/chevre/findScreeningRoomsByBranchCode.ts +4 -3
  7. package/example/src/chevre/giveUpStartDatePassedCertainPeriod.ts +56 -0
  8. package/example/src/chevre/lockStockHolder.ts +5 -2
  9. package/example/src/chevre/migrateCategoryCodeAdditionalProperties.ts +116 -0
  10. package/example/src/chevre/migrateScreeningEventSeriesVersion.ts +79 -0
  11. package/example/src/chevre/processRegisterMembership.ts +8 -4
  12. package/example/src/chevre/processRegisterPaymentCard.ts +8 -4
  13. package/example/src/chevre/processReserve.ts +1 -1
  14. package/example/src/chevre/searchAbortedTasks.ts +4 -6
  15. package/example/src/chevre/searchEventSeats.ts +5 -2
  16. package/example/src/chevre/searchHoldReservations.ts +38 -0
  17. package/example/src/chevre/searchPermissions.ts +54 -0
  18. package/example/src/chevre/searchScreeningRooms.ts +35 -0
  19. package/example/src/chevre/sendEmailMessage.ts +1 -2
  20. package/example/src/chevre/syncScreeningRooms.ts +22 -0
  21. package/example/src/chevre/syncScreeningRoomsAll.ts +44 -0
  22. package/example/src/chevre/unsetContainsInPlaceFromMovieTheater.ts +41 -0
  23. package/lib/chevre/factory/order.d.ts +4 -1
  24. package/lib/chevre/factory/order.js +19 -6
  25. package/lib/chevre/repo/account.js +3 -2
  26. package/lib/chevre/repo/accountTransaction.js +2 -1
  27. package/lib/chevre/repo/accountingReport.d.ts +1 -3
  28. package/lib/chevre/repo/action.d.ts +50 -1
  29. package/lib/chevre/repo/action.js +53 -2
  30. package/lib/chevre/repo/additionalProperty.js +2 -1
  31. package/lib/chevre/repo/aggregation.d.ts +3 -0
  32. package/lib/chevre/repo/aggregation.js +3 -0
  33. package/lib/chevre/repo/assetTransaction.js +6 -5
  34. package/lib/chevre/repo/categoryCode.d.ts +1 -1
  35. package/lib/chevre/repo/categoryCode.js +37 -25
  36. package/lib/chevre/repo/code.js +3 -2
  37. package/lib/chevre/repo/comment.js +2 -1
  38. package/lib/chevre/repo/creativeWork.d.ts +1 -1
  39. package/lib/chevre/repo/creativeWork.js +35 -12
  40. package/lib/chevre/repo/customer.js +2 -1
  41. package/lib/chevre/repo/emailMessage.js +2 -1
  42. package/lib/chevre/repo/event.d.ts +30 -2
  43. package/lib/chevre/repo/event.js +87 -36
  44. package/lib/chevre/repo/member.d.ts +14 -0
  45. package/lib/chevre/repo/member.js +31 -3
  46. package/lib/chevre/repo/merchantReturnPolicy.js +2 -1
  47. package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +3 -3
  48. package/lib/chevre/repo/mongoose/schemas/holdReservation.d.ts +75 -0
  49. package/lib/chevre/repo/mongoose/schemas/holdReservation.js +93 -0
  50. package/lib/chevre/repo/mongoose/schemas/offer.d.ts +3 -3
  51. package/lib/chevre/repo/mongoose/schemas/order.d.ts +21 -21
  52. package/lib/chevre/repo/mongoose/schemas/place.d.ts +6 -0
  53. package/lib/chevre/repo/mongoose/schemas/place.js +16 -1
  54. package/lib/chevre/repo/mongoose/schemas/product.js +6 -0
  55. package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +9 -9
  56. package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +3 -3
  57. package/lib/chevre/repo/offer.js +3 -2
  58. package/lib/chevre/repo/offerCatalog.js +0 -27
  59. package/lib/chevre/repo/offerItemCondition.js +2 -1
  60. package/lib/chevre/repo/order.js +8 -7
  61. package/lib/chevre/repo/ownershipInfo.js +2 -7
  62. package/lib/chevre/repo/paymentServiceProvider.d.ts +65 -0
  63. package/lib/chevre/repo/paymentServiceProvider.js +156 -0
  64. package/lib/chevre/repo/place.d.ts +203 -27
  65. package/lib/chevre/repo/place.js +1726 -694
  66. package/lib/chevre/repo/priceSpecification.js +3 -2
  67. package/lib/chevre/repo/product.d.ts +5 -3
  68. package/lib/chevre/repo/product.js +92 -5
  69. package/lib/chevre/repo/project.js +2 -1
  70. package/lib/chevre/repo/reservation.d.ts +9 -1
  71. package/lib/chevre/repo/reservation.js +29 -20
  72. package/lib/chevre/repo/role.d.ts +7 -0
  73. package/lib/chevre/repo/role.js +39 -2
  74. package/lib/chevre/repo/seller.d.ts +21 -1
  75. package/lib/chevre/repo/seller.js +59 -4
  76. package/lib/chevre/repo/serviceOutput.js +2 -1
  77. package/lib/chevre/repo/stockHolder.d.ts +143 -7
  78. package/lib/chevre/repo/stockHolder.js +622 -104
  79. package/lib/chevre/repo/task.d.ts +12 -1
  80. package/lib/chevre/repo/task.js +17 -7
  81. package/lib/chevre/repo/transaction.js +6 -5
  82. package/lib/chevre/repo/trip.js +2 -1
  83. package/lib/chevre/repository.d.ts +6 -0
  84. package/lib/chevre/repository.js +8 -1
  85. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +18 -8
  86. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +19 -8
  87. package/lib/chevre/service/aggregation/system.d.ts +43 -1
  88. package/lib/chevre/service/aggregation/system.js +112 -2
  89. package/lib/chevre/service/assetTransaction/moneyTransfer.js +1 -1
  90. package/lib/chevre/service/assetTransaction/pay/account/validation.js +1 -1
  91. package/lib/chevre/service/assetTransaction/pay.js +2 -2
  92. package/lib/chevre/service/assetTransaction/refund.js +1 -1
  93. package/lib/chevre/service/assetTransaction/reserve.js +10 -3
  94. package/lib/chevre/service/event.d.ts +3 -0
  95. package/lib/chevre/service/event.js +52 -21
  96. package/lib/chevre/service/iam.d.ts +6 -2
  97. package/lib/chevre/service/iam.js +23 -9
  98. package/lib/chevre/service/offer/event/factory.js +22 -13
  99. package/lib/chevre/service/offer/event/importFromCOA.js +2 -2
  100. package/lib/chevre/service/offer/eventServiceByCOA/factory.js +15 -8
  101. package/lib/chevre/service/offer/eventServiceByCOA.js +7 -9
  102. package/lib/chevre/service/offer/product/factory.js +13 -6
  103. package/lib/chevre/service/offer/product.js +2 -2
  104. package/lib/chevre/service/offer.d.ts +16 -8
  105. package/lib/chevre/service/offer.js +71 -8
  106. package/lib/chevre/service/order/createAccountingReportIfNotExist.js +31 -17
  107. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +1 -1
  108. package/lib/chevre/service/order/onOrderStatusChanged.js +2 -2
  109. package/lib/chevre/service/order/placeOrder.js +4 -4
  110. package/lib/chevre/service/order/returnOrder.js +1 -1
  111. package/lib/chevre/service/order/sendOrder.js +3 -3
  112. package/lib/chevre/service/payment/any/onPaymentStatusChanged.js +4 -6
  113. package/lib/chevre/service/payment/any/onRefund.js +46 -42
  114. package/lib/chevre/service/payment/creditCard.js +2 -2
  115. package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +1 -1
  116. package/lib/chevre/service/payment/movieTicket/factory.d.ts +1 -1
  117. package/lib/chevre/service/payment/movieTicket/getCredentials.d.ts +1 -1
  118. package/lib/chevre/service/payment/movieTicket/getCredentials.js +1 -1
  119. package/lib/chevre/service/payment/movieTicket/validation.js +16 -9
  120. package/lib/chevre/service/payment/movieTicket.js +2 -2
  121. package/lib/chevre/service/reserve/cancelReservation.js +15 -3
  122. package/lib/chevre/service/reserve/confirmReservation.js +19 -11
  123. package/lib/chevre/service/task/aggregateScreeningEvent.js +1 -1
  124. package/lib/chevre/service/task/cancelPendingReservation.js +1 -1
  125. package/lib/chevre/service/task/cancelReservation.js +1 -1
  126. package/lib/chevre/service/task/deleteTransaction.js +2 -0
  127. package/lib/chevre/service/task/onEventChanged.d.ts +7 -0
  128. package/lib/chevre/service/task/onEventChanged.js +29 -0
  129. package/lib/chevre/service/task/onResourceUpdated.d.ts +7 -0
  130. package/lib/chevre/service/task/onResourceUpdated.js +396 -0
  131. package/lib/chevre/service/task/syncScreeningRooms.d.ts +7 -0
  132. package/lib/chevre/service/task/syncScreeningRooms.js +24 -0
  133. package/lib/chevre/service/task/voidReserveTransaction.js +1 -1
  134. package/lib/chevre/service/transaction/deleteTransaction.d.ts +2 -0
  135. package/lib/chevre/service/transaction/deleteTransaction.js +129 -1
  136. package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.js +1 -0
  137. package/lib/chevre/service/transaction/moneyTransfer/factory.d.ts +1 -1
  138. package/lib/chevre/service/transaction/moneyTransfer.js +1 -1
  139. package/lib/chevre/service/transaction/orderProgramMembership/findCreditCard.js +1 -1
  140. package/lib/chevre/service/transaction/orderProgramMembership/findPaymentCardPermit.js +1 -1
  141. package/lib/chevre/service/transaction/orderProgramMembership.js +1 -1
  142. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +1 -0
  143. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/givePointAward.js +1 -1
  144. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +1 -1
  145. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +1 -1
  146. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/sendEmailMessage.js +4 -4
  147. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.js +3 -4
  148. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +8 -12
  149. package/lib/chevre/service/transaction/placeOrderInProgress.js +6 -4
  150. package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +1 -0
  151. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.js +2 -2
  152. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +5 -5
  153. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.js +2 -2
  154. package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +3 -3
  155. package/lib/chevre/service/transaction/returnOrder/potentialActions.js +1 -1
  156. package/lib/chevre/service/transaction/returnOrder.js +3 -1
  157. package/lib/chevre/settings.d.ts +11 -0
  158. package/lib/chevre/settings.js +44 -2
  159. package/package.json +3 -3
  160. package/example/src/chevre/eventCatalog2eventService.ts +0 -123
  161. package/example/src/chevre/migrateOrderAdditionalProperties.ts +0 -85
  162. package/example/src/chevre/migrateStockHolderKeys.ts +0 -89
@@ -1,4 +1,6 @@
1
+ import { Connection } from 'mongoose';
1
2
  import { RedisClientType } from 'redis';
3
+ import * as factory from '../factory';
2
4
  export interface IOffer {
3
5
  itemOffered?: {
4
6
  serviceOutput?: {
@@ -12,18 +14,70 @@ export interface IOffer {
12
14
  seatNumber: string;
13
15
  }
14
16
  export interface ILockKey {
17
+ project: {
18
+ id: string;
19
+ };
15
20
  eventId: string;
16
21
  startDate: Date;
22
+ hasTicketedSeat: boolean;
17
23
  offers: IOffer[];
18
24
  expires: Date;
19
25
  holder: string;
20
26
  }
21
27
  export interface IUnlockKey {
28
+ project: {
29
+ id: string;
30
+ };
22
31
  eventId: string;
23
32
  startDate: Date;
33
+ hasTicketedSeat: boolean;
24
34
  offer: IOffer;
35
+ holder: string;
25
36
  }
26
37
  export type IGetHolderResult = string | null;
38
+ export interface ISubReservation {
39
+ id?: string;
40
+ identifier: string;
41
+ reservedTicket?: {
42
+ ticketedSeat?: Pick<factory.reservation.ISeat<factory.reservationType>, 'seatNumber' | 'seatSection'>;
43
+ };
44
+ }
45
+ export interface IReservationPackage {
46
+ reservationNumber: string;
47
+ subReservation: ISubReservation[];
48
+ }
49
+ export interface IAggregateReservation {
50
+ project: {
51
+ id: string;
52
+ typeOf: factory.organizationType.Project;
53
+ };
54
+ typeOf: 'AggregateReservation';
55
+ reservationCount: number;
56
+ reservationFor: {
57
+ id: string;
58
+ startDate: Date;
59
+ };
60
+ reservations: IReservationPackage[];
61
+ }
62
+ export interface ISearchSubReservationResult {
63
+ reservationNumber: string;
64
+ identifier: string;
65
+ }
66
+ export interface ISearchResult {
67
+ reservationNumber: string;
68
+ identifier: string;
69
+ reservationFor: {
70
+ id: string;
71
+ startDate: Date;
72
+ aggregateReservation: {
73
+ reservationCount: number;
74
+ };
75
+ };
76
+ reservedTicket?: {
77
+ ticketedSeat?: Pick<factory.reservation.ISeat<factory.reservationType>, 'seatNumber' | 'seatSection'>;
78
+ };
79
+ objectSize?: number;
80
+ }
27
81
  /**
28
82
  * イベントストックホルダーリポジトリ
29
83
  */
@@ -31,9 +85,15 @@ export declare class StockHolderRepository {
31
85
  static KEY_PREFIX_NEW: string;
32
86
  static KEY_PREFIX: string;
33
87
  private readonly redisClient;
34
- constructor(redisClient: RedisClientType);
88
+ private readonly holdReservationModel;
89
+ constructor(redisClient: RedisClientType, connection: Connection);
35
90
  private static offer2field;
91
+ private static offer2subReservation;
36
92
  private static createKey;
93
+ /**
94
+ * 新リポジトリを使用するかどうか
95
+ */
96
+ private static useMongoose;
37
97
  /**
38
98
  * 座席をロックする(maxキャパシティチェック有)
39
99
  */
@@ -41,7 +101,12 @@ export declare class StockHolderRepository {
41
101
  /**
42
102
  * 座席をロックする
43
103
  */
44
- lock(lockKey: ILockKey): Promise<void>;
104
+ lock(lockKey: ILockKey & {
105
+ /**
106
+ * テスト目的の強制オプション
107
+ */
108
+ useMongooseForcibly?: boolean;
109
+ }): Promise<void>;
45
110
  /**
46
111
  * 座席ロックを解除する
47
112
  */
@@ -49,10 +114,6 @@ export declare class StockHolderRepository {
49
114
  /**
50
115
  * 空席でない座席を検索する
51
116
  */
52
- findUnavailableOffersByEventId(params: {
53
- eventId: string;
54
- startDate: Date;
55
- }): Promise<IOffer[]>;
56
117
  /**
57
118
  * 空席でない座席をカウントする
58
119
  */
@@ -60,20 +121,95 @@ export declare class StockHolderRepository {
60
121
  event: {
61
122
  id: string;
62
123
  startDate: Date;
124
+ hasTicketedSeat: boolean;
63
125
  };
64
126
  }): Promise<number>;
65
127
  /**
66
128
  * 保持者を取得する
67
129
  */
68
- getHolder(params: IUnlockKey): Promise<string | null | undefined>;
130
+ getHolder(params: Omit<IUnlockKey, 'holder'>): Promise<string | null | undefined>;
69
131
  /**
70
132
  * 在庫状況を検索する
71
133
  * offers.lengthが0だと"ERR wrong number of arguments for 'hmget' command"となるので注意
72
134
  */
73
135
  searchHolders(params: {
136
+ project: {
137
+ id: string;
138
+ };
74
139
  eventId: string;
75
140
  startDate: Date;
141
+ hasTicketedSeat: boolean;
76
142
  offers: IOffer[];
77
143
  }): Promise<IGetHolderResult[]>;
144
+ /**
145
+ * 汎用的な検索(mongooseのみ対応)
146
+ */
147
+ search(params: {
148
+ limit?: number;
149
+ page?: number;
150
+ sort?: {
151
+ 'reservationFor.startDate': factory.sortType;
152
+ };
153
+ project?: {
154
+ id?: {
155
+ $eq?: string;
156
+ };
157
+ };
158
+ reservationFor?: {
159
+ id?: {
160
+ $eq?: string;
161
+ };
162
+ };
163
+ reservationNumber?: {
164
+ $eq?: string;
165
+ };
166
+ id?: {
167
+ $eq?: string;
168
+ };
169
+ identifier?: {
170
+ $eq?: string;
171
+ };
172
+ reservedTicket?: {
173
+ ticketedSeat?: {
174
+ seatNumber?: {
175
+ $eq?: string;
176
+ };
177
+ seatSection?: {
178
+ $eq?: string;
179
+ };
180
+ };
181
+ };
182
+ }): Promise<ISearchResult[]>;
183
+ /**
184
+ * 汎用的な集計(mongooseのみ対応)
185
+ */
186
+ aggregateByReservationFor(params: {
187
+ limit?: number;
188
+ page?: number;
189
+ project?: {
190
+ id?: {
191
+ $eq?: string;
192
+ };
193
+ };
194
+ reservationFor?: {
195
+ id?: {
196
+ $eq?: string;
197
+ };
198
+ };
199
+ }): Promise<{
200
+ typeOf: 'AggregateReservation';
201
+ reservationCount: number;
202
+ reservationFor: {
203
+ id: string;
204
+ startDate: Date;
205
+ };
206
+ reservationPackageCount: number;
207
+ objectSize: number;
208
+ }[]>;
78
209
  private checkIfConflicted;
210
+ private initializeHoldReservation;
211
+ /**
212
+ * 仮で追加したholdReservationsが重複していないかどうか検証する
213
+ */
214
+ private checkIfAlreadyInUse;
79
215
  }