@chevre/domain 25.2.0-alpha.4 → 25.2.0-alpha.41

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 (177) hide show
  1. package/lib/chevre/factory/customerTelephone2COATelNum.d.ts +3 -0
  2. package/lib/chevre/factory/customerTelephone2COATelNum.js +22 -0
  3. package/lib/chevre/repo/action/acceptPay.d.ts +15 -0
  4. package/lib/chevre/repo/action/acceptPay.js +47 -19
  5. package/lib/chevre/repo/action/actionProcess.js +57 -57
  6. package/lib/chevre/repo/action.d.ts +16 -9
  7. package/lib/chevre/repo/action.js +99 -180
  8. package/lib/chevre/repo/aggregateOffer.d.ts +2 -3
  9. package/lib/chevre/repo/creativeWork.d.ts +2 -3
  10. package/lib/chevre/repo/customerType.d.ts +2 -3
  11. package/lib/chevre/repo/event.d.ts +10 -11
  12. package/lib/chevre/repo/eventOffer.d.ts +4 -5
  13. package/lib/chevre/repo/eventSellerMakesOffer.d.ts +2 -3
  14. package/lib/chevre/repo/eventSeries.d.ts +4 -5
  15. package/lib/chevre/repo/message.d.ts +1 -1
  16. package/lib/chevre/repo/message.js +1 -1
  17. package/lib/chevre/repo/mongoose/schemas/action.js +67 -66
  18. package/lib/chevre/repo/mongoose/schemas/order.d.ts +4 -0
  19. package/lib/chevre/repo/mongoose/schemas/order.js +10 -0
  20. package/lib/chevre/repo/mongoose/schemas/setting.d.ts +4 -0
  21. package/lib/chevre/repo/mongoose/schemas/task.js +12 -12
  22. package/lib/chevre/repo/note.d.ts +3 -4
  23. package/lib/chevre/repo/noteAboutOrder.d.ts +2 -3
  24. package/lib/chevre/repo/offer/unitPriceInCatalog.d.ts +4 -0
  25. package/lib/chevre/repo/offer/unitPriceInCatalog.js +40 -0
  26. package/lib/chevre/repo/offerCatalog.d.ts +2 -3
  27. package/lib/chevre/repo/offerCatalogItem.d.ts +2 -3
  28. package/lib/chevre/repo/order.d.ts +2 -0
  29. package/lib/chevre/repo/order.js +14 -14
  30. package/lib/chevre/repo/orderInTransaction.d.ts +68 -1
  31. package/lib/chevre/repo/orderInTransaction.js +181 -3
  32. package/lib/chevre/repo/person.d.ts +0 -15
  33. package/lib/chevre/repo/person.js +122 -108
  34. package/lib/chevre/repo/place/entranceGate.d.ts +4 -5
  35. package/lib/chevre/repo/place/movieTheater.d.ts +3 -4
  36. package/lib/chevre/repo/place/screeningRoom.d.ts +4 -5
  37. package/lib/chevre/repo/place/seat.d.ts +4 -5
  38. package/lib/chevre/repo/place/section.d.ts +3 -4
  39. package/lib/chevre/repo/product.d.ts +3 -4
  40. package/lib/chevre/repo/rateLimit/offer.js +0 -12
  41. package/lib/chevre/repo/reservation.d.ts +2 -3
  42. package/lib/chevre/repo/sellerMakesOffer.d.ts +3 -4
  43. package/lib/chevre/repo/stockHolder.d.ts +1 -1
  44. package/lib/chevre/repo/stockHolder.js +0 -146
  45. package/lib/chevre/repo/transaction/placeOrder.d.ts +2 -45
  46. package/lib/chevre/repo/transaction/placeOrder.js +43 -83
  47. package/lib/chevre/repo/transaction.d.ts +2 -2
  48. package/lib/chevre/repo/transactionNumberCounter.js +0 -34
  49. package/lib/chevre/repo/transactionProcess.js +0 -13
  50. package/lib/chevre/service/assetTransaction/pay/publishPaymentUrl.js +1 -1
  51. package/lib/chevre/service/assetTransaction/pay/start/factory.d.ts +1 -1
  52. package/lib/chevre/service/assetTransaction/pay/start/factory.js +3 -4
  53. package/lib/chevre/service/assetTransaction/pay/start.d.ts +1 -1
  54. package/lib/chevre/service/notification/factory.d.ts +2 -4
  55. package/lib/chevre/service/notification/factory.js +26 -24
  56. package/lib/chevre/service/notification/notifyAbortedTasksByEmail.d.ts +11 -5
  57. package/lib/chevre/service/notification/notifyAbortedTasksByEmail.js +11 -3
  58. package/lib/chevre/service/offer/event/authorize/factory.d.ts +3 -5
  59. package/lib/chevre/service/offer/event/authorize/factory.js +93 -75
  60. package/lib/chevre/service/offer/event/authorize.d.ts +0 -4
  61. package/lib/chevre/service/offer/event/authorize.js +2 -2
  62. package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +6 -7
  63. package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.js +10 -10
  64. package/lib/chevre/service/offer/eventServiceByCOA/authorize/validateAcceptedOffers.js +2 -1
  65. package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +0 -5
  66. package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +17 -14
  67. package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.d.ts +0 -5
  68. package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.js +2 -2
  69. package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +1 -1
  70. package/lib/chevre/service/order/deleteOrder.d.ts +5 -1
  71. package/lib/chevre/service/order/deleteOrder.js +8 -1
  72. package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionCanceled.js +19 -11
  73. package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.d.ts +2 -0
  74. package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.d.ts +2 -2
  75. package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.js +1 -7
  76. package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +2 -0
  77. package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +2 -0
  78. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.d.ts +5 -1
  79. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.js +95 -33
  80. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +2 -2
  81. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +4 -2
  82. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +2 -6
  83. package/lib/chevre/service/order/payOrder.d.ts +2 -0
  84. package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.d.ts +2 -1
  85. package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +13 -58
  86. package/lib/chevre/service/order/placeOrder/factory.js +3 -21
  87. package/lib/chevre/service/order/placeOrder.d.ts +4 -5
  88. package/lib/chevre/service/order/placeOrder.js +20 -31
  89. package/lib/chevre/service/payment/any/authorize/fixOrderAsNeeded.js +1 -2
  90. package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.d.ts +3 -2
  91. package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts +4 -3
  92. package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.js +3 -31
  93. package/lib/chevre/service/payment/any/authorize.js +13 -37
  94. package/lib/chevre/service/payment/any/factory.d.ts +7 -7
  95. package/lib/chevre/service/payment/any/factory.js +19 -22
  96. package/lib/chevre/service/payment/any/findAcceptAction.d.ts +3 -1
  97. package/lib/chevre/service/payment/any/findAcceptAction.js +14 -6
  98. package/lib/chevre/service/payment/any/invalidatePaymentUrl.d.ts +2 -0
  99. package/lib/chevre/service/payment/any/invalidatePaymentUrl.js +4 -66
  100. package/lib/chevre/service/payment/any/publishPaymentUrl.d.ts +4 -0
  101. package/lib/chevre/service/payment/any/publishPaymentUrl.js +4 -18
  102. package/lib/chevre/service/payment/any/voidPayTransaction.d.ts +2 -0
  103. package/lib/chevre/service/payment/any/voidPayTransaction.js +1 -23
  104. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.d.ts +1 -1
  105. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.js +5 -9
  106. package/lib/chevre/service/reserve/adminFindReservations.d.ts +15 -0
  107. package/lib/chevre/service/reserve/adminFindReservations.js +35 -0
  108. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +17 -8
  109. package/lib/chevre/service/reserve/searchByOrder.js +2 -6
  110. package/lib/chevre/service/reserve.d.ts +2 -2
  111. package/lib/chevre/service/reserve.js +3 -3
  112. package/lib/chevre/service/task/aggregateOffers.d.ts +2 -2
  113. package/lib/chevre/service/task/aggregateOffers.js +2 -1
  114. package/lib/chevre/service/task/aggregateScreeningEvent.d.ts +2 -2
  115. package/lib/chevre/service/task/aggregateScreeningEvent.js +2 -1
  116. package/lib/chevre/service/task/authorizePayment.js +3 -1
  117. package/lib/chevre/service/task/cancelReservation.d.ts +2 -2
  118. package/lib/chevre/service/task/cancelReservation.js +2 -1
  119. package/lib/chevre/service/task/confirmPayTransaction.js +0 -1
  120. package/lib/chevre/service/task/confirmReserveTransaction.js +2 -7
  121. package/lib/chevre/service/task/deleteTransaction.d.ts +2 -2
  122. package/lib/chevre/service/task/deleteTransaction.js +2 -1
  123. package/lib/chevre/service/task/onAssetTransactionStatusChanged.d.ts +2 -2
  124. package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +4 -3
  125. package/lib/chevre/service/task/onEventChanged.d.ts +2 -2
  126. package/lib/chevre/service/task/onEventChanged.js +2 -1
  127. package/lib/chevre/service/task/onOrderPaymentCompleted.d.ts +2 -2
  128. package/lib/chevre/service/task/onOrderPaymentCompleted.js +4 -1
  129. package/lib/chevre/service/task/onResourceUpdated/onAggregateOfferUpdated.js +1 -1
  130. package/lib/chevre/service/task/onResourceUpdated.d.ts +2 -2
  131. package/lib/chevre/service/task/onResourceUpdated.js +2 -1
  132. package/lib/chevre/service/task/placeOrder.d.ts +2 -2
  133. package/lib/chevre/service/task/placeOrder.js +6 -3
  134. package/lib/chevre/service/task/publishPaymentUrl.js +7 -3
  135. package/lib/chevre/service/task/refund.d.ts +2 -2
  136. package/lib/chevre/service/task/refund.js +4 -10
  137. package/lib/chevre/service/task/reserve.d.ts +2 -2
  138. package/lib/chevre/service/task/reserve.js +2 -1
  139. package/lib/chevre/service/task/returnOrder.d.ts +2 -2
  140. package/lib/chevre/service/task/returnOrder.js +2 -1
  141. package/lib/chevre/service/task/sendOrder.d.ts +2 -2
  142. package/lib/chevre/service/task/sendOrder.js +2 -1
  143. package/lib/chevre/service/task/voidPayTransaction.js +3 -7
  144. package/lib/chevre/service/task/voidPayment.d.ts +2 -2
  145. package/lib/chevre/service/task/voidPayment.js +2 -1
  146. package/lib/chevre/service/taskHandler.d.ts +2 -2
  147. package/lib/chevre/service/taskHandler.js +36 -37
  148. package/lib/chevre/service/transaction/deleteTransaction/deletePayTransactionsByPlaceOrder.d.ts +15 -0
  149. package/lib/chevre/service/transaction/deleteTransaction/deletePayTransactionsByPlaceOrder.js +51 -0
  150. package/lib/chevre/service/transaction/deleteTransaction/deleteReservationsByPlaceOrder.d.ts +23 -0
  151. package/lib/chevre/service/transaction/deleteTransaction/deleteReservationsByPlaceOrder.js +64 -0
  152. package/lib/chevre/service/transaction/deleteTransaction.js +15 -152
  153. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.d.ts +28 -2
  154. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.js +11 -12
  155. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.d.ts +4 -2
  156. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.js +6 -7
  157. package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.d.ts +35 -2
  158. package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.js +17 -13
  159. package/lib/chevre/service/transaction/placeOrder/confirm/validation/factory.d.ts +5 -1
  160. package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +11 -2
  161. package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +112 -91
  162. package/lib/chevre/service/transaction/placeOrder/confirm.d.ts +6 -5
  163. package/lib/chevre/service/transaction/placeOrder/confirm.js +33 -78
  164. package/lib/chevre/service/transaction/placeOrder/publishConfirmationNumberIfNotExist.d.ts +4 -7
  165. package/lib/chevre/service/transaction/placeOrder/publishConfirmationNumberIfNotExist.js +33 -15
  166. package/lib/chevre/service/transaction/placeOrder/start.d.ts +1 -1
  167. package/lib/chevre/service/transaction/placeOrder/updateAgent/fixCustomer.d.ts +20 -0
  168. package/lib/chevre/service/transaction/placeOrder/updateAgent/fixCustomer.js +63 -0
  169. package/lib/chevre/service/transaction/placeOrder/updateAgent.d.ts +0 -1
  170. package/lib/chevre/service/transaction/placeOrder/updateAgent.js +17 -86
  171. package/lib/chevre/service/transaction/returnOrder/preStart.js +1 -1
  172. package/lib/chevre/taskSettings.d.ts +1 -3
  173. package/package.json +8 -11
  174. package/lib/chevre/service/order/findConfirmedPlaceOrder.d.ts +0 -13
  175. package/lib/chevre/service/order/findConfirmedPlaceOrder.js +0 -32
  176. package/lib/chevre/service/reserve/findReservations.d.ts +0 -33
  177. package/lib/chevre/service/reserve/findReservations.js +0 -61
@@ -1,5 +1,4 @@
1
- import type { BulkWriteResult } from 'mongodb';
2
- import type { Connection, FilterQuery } from 'mongoose';
1
+ import type { Connection, FilterQuery, mongo } from 'mongoose';
3
2
  import { factory } from '../../factory';
4
3
  import { IDocType } from '../mongoose/schemas/civicStructure';
5
4
  export type IScreeningRoomFoundByBranchCode = Pick<factory.place.screeningRoom.IPlace, 'typeOf' | 'branchCode' | 'name' | 'containsPlace' | 'seatCount' | 'parentOrganization'>;
@@ -49,7 +48,7 @@ export declare class MovieTheaterRepo {
49
48
  [key in keyof IUpsertingMovieTheater]?: 1;
50
49
  };
51
50
  }[], options: IUpsertOptions): Promise<{
52
- bulkWriteResult?: BulkWriteResult;
51
+ bulkWriteResult?: mongo.BulkWriteResult;
53
52
  /**
54
53
  * 追加あるいは編集された施設
55
54
  */
@@ -86,7 +85,7 @@ export declare class MovieTheaterRepo {
86
85
  */
87
86
  id: string;
88
87
  };
89
- }): Promise<import("mongodb").DeleteResult>;
88
+ }): Promise<mongo.DeleteResult>;
90
89
  /**
91
90
  * プロジェクトに属する施設を全削除
92
91
  */
@@ -1,5 +1,4 @@
1
- import type { BulkWriteResult } from 'mongodb';
2
- import { Connection, FilterQuery, PipelineStage } from 'mongoose';
1
+ import type { Connection, FilterQuery, PipelineStage, mongo } from 'mongoose';
3
2
  import { factory } from '../../factory';
4
3
  import { IDocType } from '../mongoose/schemas/place';
5
4
  export type IScreeningRoomFoundByBranchCode = Pick<factory.place.screeningRoom.IPlace, 'typeOf' | 'branchCode' | 'name' | 'containsPlace' | 'seatCount' | 'parentOrganization'>;
@@ -66,7 +65,7 @@ export declare class ScreeningRoomRepo {
66
65
  [key in keyof IUpsertingRoom]?: 1;
67
66
  };
68
67
  }[], options: IUpsertOptions): Promise<{
69
- bulkWriteResult?: BulkWriteResult;
68
+ bulkWriteResult?: mongo.BulkWriteResult;
70
69
  }>;
71
70
  deleteRoomByBranchCode(screeningRoom: {
72
71
  /**
@@ -84,7 +83,7 @@ export declare class ScreeningRoomRepo {
84
83
  */
85
84
  id: string;
86
85
  };
87
- }): Promise<import("mongodb").DeleteResult>;
86
+ }): Promise<mongo.DeleteResult>;
88
87
  searchScreeningRooms(searchConditions: factory.place.screeningRoom.ISearchConditions): Promise<Omit<factory.place.screeningRoom.IPlace, 'containsPlace' | 'parentOrganization'>[]>;
89
88
  findRooms(params: Omit<factory.place.screeningRoom.ISearchConditions, '$projection'>): Promise<Pick<factory.place.screeningRoom.IPlace, 'additionalProperty' | 'address' | 'branchCode' | 'name' | 'openSeatingAllowed' | 'maximumAttendeeCapacity'>[]>;
90
89
  /**
@@ -116,7 +115,7 @@ export declare class ScreeningRoomRepo {
116
115
  */
117
116
  id: string;
118
117
  };
119
- }): Promise<import("mongodb").DeleteResult>;
118
+ }): Promise<mongo.DeleteResult>;
120
119
  /**
121
120
  * プロジェクトに属するルームを全削除
122
121
  */
@@ -1,5 +1,4 @@
1
- import type { BulkWriteResult } from 'mongodb';
2
- import { AnyExpression, Connection, PipelineStage } from 'mongoose';
1
+ import type { AnyExpression, Connection, PipelineStage, mongo } from 'mongoose';
3
2
  import { factory } from '../../factory';
4
3
  type IMatchStage = PipelineStage.Match;
5
4
  type ICreatingSeat = Pick<factory.place.seat.IPlace, 'additionalProperty' | 'branchCode' | 'name' | 'maximumAttendeeCapacity' | 'seatingType'>;
@@ -45,7 +44,7 @@ export declare class SeatRepo {
45
44
  addSeatsByBranchCodeIfNotExist(params: {
46
45
  $set: ICreatingSeat;
47
46
  }[], options: IUpdateOptions): Promise<{
48
- bulkWriteResult?: BulkWriteResult;
47
+ bulkWriteResult?: mongo.BulkWriteResult;
49
48
  }>;
50
49
  /**
51
50
  * コードをキーにして冪等編集
@@ -56,7 +55,7 @@ export declare class SeatRepo {
56
55
  [key in keyof ICreatingSeat]?: 1;
57
56
  };
58
57
  }[], options: IUpdateOptions): Promise<{
59
- bulkWriteResult?: BulkWriteResult;
58
+ bulkWriteResult?: mongo.BulkWriteResult;
60
59
  }>;
61
60
  updateSeatByBranchCode(seat: ICreatingSeat, $unset: any, // eslint-disable-line @typescript-eslint/no-explicit-any
62
61
  options: IUpdateOptions): Promise<IUpdateSeatResult>;
@@ -166,7 +165,7 @@ export declare class SeatRepo {
166
165
  */
167
166
  branchCode: string;
168
167
  }[], options: IUpdateOptions): Promise<{
169
- bulkWriteResult?: BulkWriteResult;
168
+ bulkWriteResult?: mongo.BulkWriteResult;
170
169
  }>;
171
170
  deleteSeatByBranchCode(seat: {
172
171
  /**
@@ -1,5 +1,4 @@
1
- import type { BulkWriteResult } from 'mongodb';
2
- import type { Connection, PipelineStage } from 'mongoose';
1
+ import type { Connection, PipelineStage, mongo } from 'mongoose';
3
2
  import { factory } from '../../factory';
4
3
  type IScreeningRoomSectionWithoutContainsPlace = Omit<factory.place.screeningRoomSection.IPlace, 'containsPlace'>;
5
4
  type ICreatingSection = Pick<factory.place.screeningRoomSection.IPlace, 'additionalProperty' | 'branchCode' | 'name'>;
@@ -57,7 +56,7 @@ export declare class SectionRepo {
57
56
  addSeatSectionsByBranchCodeIfNotExist(params: {
58
57
  $set: IUpsertingSeatSection;
59
58
  }[], options: IUpsertOptions): Promise<{
60
- bulkWriteResult?: BulkWriteResult;
59
+ bulkWriteResult?: mongo.BulkWriteResult;
61
60
  }>;
62
61
  /**
63
62
  * コードをキーにして冪等編集
@@ -65,7 +64,7 @@ export declare class SectionRepo {
65
64
  updateSeatSectionsByBranchCode(params: {
66
65
  $set: IUpsertingSeatSection;
67
66
  }[], options: IUpsertOptions): Promise<{
68
- bulkWriteResult?: BulkWriteResult;
67
+ bulkWriteResult?: mongo.BulkWriteResult;
69
68
  }>;
70
69
  migrateSectionIdentifier(screeningRoomSection: {
71
70
  project: {
@@ -1,5 +1,4 @@
1
- import type { BulkWriteResult } from 'mongodb';
2
- import { Connection, FilterQuery, Types } from 'mongoose';
1
+ import { Connection, FilterQuery, Types, mongo } from 'mongoose';
3
2
  import { factory } from '../factory';
4
3
  import { IDocType, IDocTypeAsProduct } from './mongoose/schemas/product';
5
4
  type IKeyOfProjection = keyof factory.product.IProduct | 'hasOfferCatalog.id';
@@ -65,7 +64,7 @@ export declare class ProductRepo {
65
64
  };
66
65
  $unset?: Partial<Record<IUnsetKey, 1>>;
67
66
  }[]): Promise<{
68
- bulkWriteResult?: BulkWriteResult;
67
+ bulkWriteResult?: mongo.BulkWriteResult;
69
68
  modifiedProducts?: {
70
69
  id: string;
71
70
  }[];
@@ -80,7 +79,7 @@ export declare class ProductRepo {
80
79
  hasOfferCatalog: {
81
80
  id: string;
82
81
  };
83
- }): Promise<import("mongodb").DeleteResult>;
82
+ }): Promise<mongo.DeleteResult>;
84
83
  /**
85
84
  * プロジェクト指定で削除する
86
85
  */
@@ -28,7 +28,6 @@ class OfferRateLimitRepo {
28
28
  * ロックする
29
29
  * discontinue array params(2025-05-26~)
30
30
  */
31
- // public async lock(ratelimitKeys: IRateLimitKey[]): Promise<void> {
32
31
  async lock(params) {
33
32
  const key = OfferRateLimitRepo.createKey(params);
34
33
  const value = params.reservationNumber;
@@ -50,18 +49,8 @@ class OfferRateLimitRepo {
50
49
  catch (_error) {
51
50
  throw new factory_1.factory.errors.RateLimitExceeded('Offer');
52
51
  }
53
- // const multi = this.redisClient.multi();
54
- // multi.setNX(key, value)
55
- // .expire(key, ttl);
56
- // const results = await multi.exec();
57
- // if (Array.isArray(results) && (results[0] === 1 || (<any>results)[0] === true)) {
58
- // return;
59
- // } else {
60
- // throw new factory.errors.RateLimitExceeded('Offer');
61
- // }
62
52
  }
63
53
  // discontinue array params(2025-05-26~)
64
- // public async unlock(ratelimitKeys: IRateLimitKey[]): Promise<void> {
65
54
  async unlock(params) {
66
55
  const key = OfferRateLimitRepo.createKey(params);
67
56
  // reimplement using concurrentLockRepo(2025-05-27~)
@@ -69,7 +58,6 @@ class OfferRateLimitRepo {
69
58
  about: { identifier: key, typeOf: 'Thing' },
70
59
  audience: { identifier: params.reservationNumber, typeOf: 'Audience' }
71
60
  });
72
- // await this.redisClient.del(key);
73
61
  }
74
62
  async getHolder(ratelimitKey) {
75
63
  const key = OfferRateLimitRepo.createKey(ratelimitKey);
@@ -1,5 +1,4 @@
1
- import type { BulkWriteResult } from 'mongodb';
2
- import type { Connection, UpdateWriteOpResult } from 'mongoose';
1
+ import type { Connection, UpdateWriteOpResult, mongo } from 'mongoose';
3
2
  import { IDocType } from './mongoose/schemas/reservation';
4
3
  import { factory } from '../factory';
5
4
  export interface IUpdatePartiallyParams {
@@ -77,7 +76,7 @@ export declare class ReservationRepo {
77
76
  reservationNumber: string;
78
77
  underName?: factory.reservation.IUnderName;
79
78
  broker?: factory.reservation.IBroker;
80
- }): Promise<BulkWriteResult | undefined>;
79
+ }): Promise<mongo.BulkWriteResult | undefined>;
81
80
  /**
82
81
  * 予約取消
83
82
  */
@@ -1,5 +1,4 @@
1
- import type { BulkWriteResult } from 'mongodb';
2
- import { Connection } from 'mongoose';
1
+ import { Connection, mongo } from 'mongoose';
3
2
  import { factory } from '../factory';
4
3
  type IMakesOffer = Pick<factory.seller.IMakesOffer, 'typeOf' | 'availableAtOrFrom' | 'eligibleTransactionDuration'>;
5
4
  type IMakesOfferAsFindResult = IMakesOffer & {
@@ -51,7 +50,7 @@ export declare class SellerMakesOfferRepo {
51
50
  id: string;
52
51
  };
53
52
  }[];
54
- }): Promise<BulkWriteResult | undefined>;
53
+ }): Promise<mongo.BulkWriteResult | undefined>;
55
54
  /**
56
55
  * 販売者とアプリケーションに対してオファーが存在すれば削除する
57
56
  */
@@ -67,6 +66,6 @@ export declare class SellerMakesOfferRepo {
67
66
  id: string;
68
67
  };
69
68
  }[];
70
- }): Promise<BulkWriteResult | undefined>;
69
+ }): Promise<mongo.BulkWriteResult | undefined>;
71
70
  }
72
71
  export {};
@@ -16,7 +16,7 @@ export declare class StockHolderRepo implements AbstractStockHolderRepo {
16
16
  /**
17
17
  * 座席をロックする
18
18
  */
19
- lock(lockKey: ILockKey & {}): Promise<void>;
19
+ lock(lockKey: ILockKey): Promise<void>;
20
20
  /**
21
21
  * 座席ロックを解除する
22
22
  */
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StockHolderRepo = void 0;
4
- // import type { RedisClientType } from 'redis';
5
4
  const factory_1 = require("../factory");
6
5
  const pendingReservation_1 = require("./pendingReservation");
7
6
  const SEARCH_OFFERS_MAX_LENGTH = 100;
@@ -9,36 +8,11 @@ const SEARCH_OFFERS_MAX_LENGTH = 100;
9
8
  * 保留予約リポジトリ
10
9
  */
11
10
  class StockHolderRepo {
12
- // public static KEY_PREFIX_NEW: string = 'stockHolder';
13
- // private readonly redisClient: RedisClientType | undefined;
14
11
  pendingReservationRepo;
15
12
  constructor(params) {
16
13
  const { connection } = params;
17
- // this.redisClient = redisClient;
18
14
  this.pendingReservationRepo = new pendingReservation_1.PendingReservationRepo(connection);
19
15
  }
20
- // private static offer2field(params: IOffer, hasTicketedSeat: boolean) {
21
- // if (hasTicketedSeat) {
22
- // return `${params.seatSection}:${params.seatNumber}`;
23
- // } else {
24
- // // 予約IDをfieldにする場合
25
- // const serviceOutputId = params.itemOffered?.serviceOutput?.id;
26
- // if (typeof serviceOutputId === 'string') {
27
- // return serviceOutputId;
28
- // } else {
29
- // throw new factory.errors.Internal('offer2field requires itemOffered.serviceOutput.id');
30
- // }
31
- // }
32
- // }
33
- // private static createKey(params: {
34
- // eventId: string;
35
- // startDate: Date;
36
- // }): string {
37
- // if (!(params.startDate instanceof Date)) {
38
- // throw new factory.errors.Argument('startDate', 'must be Date');
39
- // }
40
- // return `${StockHolderRepo.KEY_PREFIX_NEW}:${params.eventId}`;
41
- // }
42
16
  /**
43
17
  * 座席をロックする(maxキャパシティチェック有)
44
18
  */
@@ -54,16 +28,6 @@ class StockHolderRepo {
54
28
  }
55
29
  else {
56
30
  throw new factory_1.factory.errors.NotImplemented('useRedis discontinued.');
57
- // if (this.redisClient === undefined) {
58
- // throw new factory.errors.Internal('redisClient required');
59
- // }
60
- // const key = StockHolderRepo.createKey({ eventId: lockKey.eventId, startDate: lockKey.startDate });
61
- // await this.redisClient.watch(key);
62
- // const hashCount = await this.redisClient.hLen(key);
63
- // if (hashCount + lockKey.offers.length > maximum) {
64
- // throw new factory.errors.Argument('Event', 'maximumAttendeeCapacity exceeded');
65
- // }
66
- // await this.lock(lockKey);
67
31
  }
68
32
  }
69
33
  /**
@@ -79,59 +43,11 @@ class StockHolderRepo {
79
43
  startDate: lockKey.startDate,
80
44
  hasTicketedSeat: lockKey.hasTicketedSeat
81
45
  });
82
- // const key = StockHolderRepo.createKey({ eventId: lockKey.eventId, startDate: lockKey.startDate });
83
- // await this.checkIfConflicted({ key, eventId: lockKey.eventId, useMongoose });
84
46
  if (useMongoose) {
85
47
  return this.pendingReservationRepo.lock(lockKey);
86
48
  }
87
49
  else {
88
50
  throw new factory_1.factory.errors.NotImplemented('useRedis discontinued.');
89
- // if (this.redisClient === undefined) {
90
- // throw new factory.errors.Internal('redisClient required');
91
- // }
92
- // const value = lockKey.holder;
93
- // const multi = this.redisClient.multi();
94
- // const fields = lockKey.offers.map((offer) => StockHolderRepo.offer2field(offer, lockKey.hasTicketedSeat));
95
- // // check uniqueness(2025-04-20~)
96
- // const uniqueFields = [...new Set(fields)];
97
- // if (uniqueFields.length !== fields.length) {
98
- // throw new factory.errors.Argument('offers', 'offers must be unique');
99
- // }
100
- // fields.forEach((field) => {
101
- // multi.hSetNX(key, field, value);
102
- // });
103
- // const results = await multi.expireAt(
104
- // key,
105
- // moment(lockKey.expires)
106
- // .unix()
107
- // )
108
- // .exec();
109
- // const lockedFields: string[] = [];
110
- // if (Array.isArray(results)) {
111
- // results.slice(0, fields.length)
112
- // .forEach((r, index) => {
113
- // if (r === 1 || (<any>r) === true) {
114
- // lockedFields.push(fields[index]);
115
- // }
116
- // });
117
- // }
118
- // const lockedAll = lockedFields.length === fields.length;
119
- // // expireAtReplyの検証も追加する(2023-04-19~)
120
- // const expiredAll = results.slice(fields.length)
121
- // .every((r) => (r === 1 || (<any>r) === true));
122
- // if (!lockedAll || !expiredAll) {
123
- // if (lockedFields.length > 0) {
124
- // // 全て仮押さえできなければ仮押さえできたものは解除
125
- // await this.redisClient.multi()
126
- // .hDel(key, lockedFields)
127
- // .exec();
128
- // }
129
- // if (!lockedAll) {
130
- // throw new factory.errors.AlreadyInUse(factory.reservationType.EventReservation, ['ticketedSeat'], 'Already hold');
131
- // } else {
132
- // throw new factory.errors.Internal('timeout cannot be set unexpectedly');
133
- // }
134
- // }
135
51
  }
136
52
  }
137
53
  /**
@@ -144,20 +60,11 @@ class StockHolderRepo {
144
60
  startDate: params.startDate,
145
61
  hasTicketedSeat: params.hasTicketedSeat
146
62
  });
147
- // const key = StockHolderRepo.createKey({ eventId: params.eventId, startDate: params.startDate });
148
- // await this.checkIfConflicted({ key, eventId: params.eventId, useMongoose });
149
63
  if (useMongoose) {
150
64
  return this.pendingReservationRepo.unlock(params);
151
65
  }
152
66
  else {
153
67
  throw new factory_1.factory.errors.NotImplemented('useRedis discontinued.');
154
- // if (this.redisClient === undefined) {
155
- // throw new factory.errors.Internal('redisClient required');
156
- // }
157
- // const field = StockHolderRepo.offer2field(params.offer, params.hasTicketedSeat);
158
- // await this.redisClient.multi()
159
- // .hDel(key, field)
160
- // .exec();
161
68
  }
162
69
  }
163
70
  /**
@@ -174,16 +81,6 @@ class StockHolderRepo {
174
81
  }
175
82
  else {
176
83
  throw new factory_1.factory.errors.NotImplemented('useRedis discontinued.');
177
- // if (this.redisClient === undefined) {
178
- // throw new factory.errors.Internal('redisClient required');
179
- // }
180
- // const key = StockHolderRepo.createKey({ eventId: params.event.id, startDate: params.event.startDate });
181
- // const reply = await this.redisClient.hLen(key);
182
- // let fieldCount: number = 0;
183
- // if (typeof reply === 'number') {
184
- // fieldCount = Number(reply);
185
- // }
186
- // return fieldCount;
187
84
  }
188
85
  }
189
86
  /**
@@ -200,12 +97,6 @@ class StockHolderRepo {
200
97
  }
201
98
  else {
202
99
  throw new factory_1.factory.errors.NotImplemented('useRedis discontinued.');
203
- // if (this.redisClient === undefined) {
204
- // throw new factory.errors.Internal('redisClient required');
205
- // }
206
- // const key = StockHolderRepo.createKey({ eventId: params.eventId, startDate: params.startDate });
207
- // const field = StockHolderRepo.offer2field(params.offer, params.hasTicketedSeat);
208
- // return this.redisClient.hGet(key, field);
209
100
  }
210
101
  }
211
102
  async searchHolders(params) {
@@ -223,32 +114,8 @@ class StockHolderRepo {
223
114
  }
224
115
  else {
225
116
  throw new factory_1.factory.errors.NotImplemented('useRedis discontinued.');
226
- // if (this.redisClient === undefined) {
227
- // throw new factory.errors.Internal('redisClient required');
228
- // }
229
- // const key = StockHolderRepo.createKey({ eventId: params.eventId, startDate: params.startDate });
230
- // const fields = params.offers.map((o) => {
231
- // return StockHolderRepo.offer2field(o, params.hasTicketedSeat);
232
- // });
233
- // // Array reply: list of values associated with the given fields, in the same order as they are requested.
234
- // const result = await this.redisClient.hmGet(key, fields);
235
- // if (!Array.isArray(result)) {
236
- // throw new factory.errors.Internal(`searchAvailability got non-array: ${typeof result}`);
237
- // }
238
- // // そのまま返却(2023-04-17~)
239
- // return result;
240
117
  }
241
118
  }
242
- // public async checkIfConflicted(params: {
243
- // eventId: string;
244
- // startDate: Date;
245
- // }): Promise<void> {
246
- // const redisKeyExists = await this.redisKeyExists(params);
247
- // const mongoDocExists = await this.pendingReservationRepo.docExists(params);
248
- // if (redisKeyExists && mongoDocExists) {
249
- // throw new factory.errors.Internal(`repository conflicted. eventId:${params.eventId}`);
250
- // }
251
- // }
252
119
  /**
253
120
  * 新リポジトリを使用するかどうか
254
121
  */
@@ -258,19 +125,6 @@ class StockHolderRepo {
258
125
  }
259
126
  // always use mongo(2025-08-17~)
260
127
  return true;
261
- // let useMongoose = false;
262
- // const redisKeyExists = await this.redisKeyExists(params);
263
- // if (redisKeyExists) {
264
- // useMongoose = false;
265
- // } else {
266
- // // redis keyが存在しなければmongo利用
267
- // useMongoose = true;
268
- // }
269
- // // check confliction for test
270
- // if (USE_STOCK_HOLDER_CHECK_CONFLICT) {
271
- // await this.checkIfConflicted(params);
272
- // }
273
- // return useMongoose;
274
128
  }
275
129
  }
276
130
  exports.StockHolderRepo = StockHolderRepo;
@@ -37,21 +37,6 @@ export declare class PlaceOrderRepo {
37
37
  }): Promise<(Pick<factory.transaction.ITransaction<factory.transactionType.PlaceOrder>, IKeyOfProjection> & {
38
38
  id: string;
39
39
  })[]>;
40
- /**
41
- * 進行中取引に保管された採用済決済方法を検索する
42
- */
43
- findInProgressPaymentMethodId(params: {
44
- id: string;
45
- }): Promise<factory.transaction.placeOrder.IPaymentMethodByPaymentUrl | undefined>;
46
- /**
47
- * 取引の確認番号を検索する
48
- */
49
- findInProgressConfirmationNumberById(params: {
50
- id: string;
51
- status: {
52
- $in: factory.transactionStatusType[];
53
- };
54
- }): Promise<string | undefined>;
55
40
  /**
56
41
  * 取引期限変更
57
42
  */
@@ -60,28 +45,6 @@ export declare class PlaceOrderRepo {
60
45
  id: string;
61
46
  expires: Date;
62
47
  }): Promise<void>;
63
- /**
64
- * 取引オブジェクトを更新
65
- * 注文名称など
66
- */
67
- updateObject(params: {
68
- typeOf: factory.transactionType.PlaceOrder;
69
- id: string;
70
- object?: {
71
- name?: string;
72
- };
73
- }): Promise<void>;
74
- /**
75
- * 特定の進行中取引を更新する(汎用)
76
- */
77
- findByIdAndUpdateInProgress(params: {
78
- id: string;
79
- update: {
80
- $set?: {
81
- 'object.paymentMethods'?: factory.transaction.placeOrder.IPaymentMethodByPaymentUrl;
82
- };
83
- };
84
- }): Promise<void>;
85
48
  /**
86
49
  * 進行中取引のobjectに注文番号を保管する
87
50
  */
@@ -91,13 +54,6 @@ export declare class PlaceOrderRepo {
91
54
  }): Promise<{
92
55
  modifiedCount: number;
93
56
  }>;
94
- saveConfirmationNumberIfNotExist(params: {
95
- id: string;
96
- status: {
97
- $in: factory.transactionStatusType[];
98
- };
99
- confirmationNumber: string;
100
- }): Promise<void>;
101
57
  /**
102
58
  * 進行中の注文取引を取得する
103
59
  */
@@ -125,9 +81,10 @@ export declare class PlaceOrderRepo {
125
81
  object: {
126
82
  orderDate: Date;
127
83
  orderNumber: string;
84
+ confirmationNumber: string;
128
85
  };
129
86
  result: factory.transaction.IResult<factory.transactionType.PlaceOrder>;
130
- potentialActions: factory.transaction.IPotentialActions<factory.transactionType.PlaceOrder>;
87
+ potentialActions?: factory.transaction.IPotentialActions<factory.transactionType.PlaceOrder>;
131
88
  }): Promise<void>;
132
89
  /**
133
90
  * 取引を中止する