@chevre/domain 21.2.0-alpha.5 → 21.2.0-alpha.51

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 (213) hide show
  1. package/example/src/chevre/aggregation/aggregateSystem.ts +58 -31
  2. package/example/src/chevre/countDelayedTasks.ts +17 -0
  3. package/example/src/chevre/countDelayedTransactions.ts +60 -0
  4. package/example/src/chevre/countMoneyTransferTransaction.ts +36 -0
  5. package/example/src/chevre/createManyEventsIfNotExist.ts +4 -1
  6. package/example/src/chevre/migrateOrderAdditionalProperties.ts +85 -0
  7. package/example/src/chevre/migrateStockHolderKeys.ts +89 -0
  8. package/example/src/chevre/saveTasks.ts +13 -10
  9. package/example/src/chevre/searchAbortedTasks.ts +36 -0
  10. package/example/src/chevre/searchSendEmailActions.ts +44 -0
  11. package/example/src/chevre/task/executeTasks.ts +26 -0
  12. package/example/src/chevre/transaction/findCreditCard.ts +1 -1
  13. package/example/src/chevre/transaction/orderMembershipService.ts +1 -1
  14. package/example/src/chevre/transaction/startExportTasks.ts +20 -0
  15. package/example/src/chevre/updateTransaction.ts +1 -1
  16. package/lib/chevre/credentials.d.ts +1 -0
  17. package/lib/chevre/credentials.js +2 -1
  18. package/lib/chevre/eventEmitter/assetTransaction.d.ts +21 -0
  19. package/lib/chevre/eventEmitter/assetTransaction.js +25 -0
  20. package/lib/chevre/eventEmitter/task.d.ts +18 -0
  21. package/lib/chevre/eventEmitter/task.js +25 -0
  22. package/lib/chevre/eventEmitter/transaction.d.ts +21 -0
  23. package/lib/chevre/eventEmitter/transaction.js +25 -0
  24. package/lib/chevre/eventEmitter.d.ts +4 -0
  25. package/lib/chevre/eventEmitter.js +9 -0
  26. package/lib/chevre/index.d.ts +3 -2
  27. package/lib/chevre/index.js +5 -3
  28. package/lib/chevre/repo/account.js +0 -4
  29. package/lib/chevre/repo/accountTitle.js +0 -4
  30. package/lib/chevre/repo/accountTransaction.d.ts +3 -11
  31. package/lib/chevre/repo/accountTransaction.js +1 -58
  32. package/lib/chevre/repo/accountingReport.js +0 -4
  33. package/lib/chevre/repo/action.d.ts +12 -1
  34. package/lib/chevre/repo/action.js +9 -29
  35. package/lib/chevre/repo/additionalProperty.js +0 -4
  36. package/lib/chevre/repo/aggregation.js +0 -4
  37. package/lib/chevre/repo/assetTransaction.d.ts +22 -7
  38. package/lib/chevre/repo/assetTransaction.js +173 -55
  39. package/lib/chevre/repo/categoryCode.js +0 -4
  40. package/lib/chevre/repo/code.js +0 -4
  41. package/lib/chevre/repo/comment.d.ts +4 -1
  42. package/lib/chevre/repo/comment.js +20 -9
  43. package/lib/chevre/repo/confirmationNumber.d.ts +0 -1
  44. package/lib/chevre/repo/confirmationNumber.js +3 -15
  45. package/lib/chevre/repo/creativeWork.d.ts +1 -3
  46. package/lib/chevre/repo/creativeWork.js +0 -4
  47. package/lib/chevre/repo/customer.js +0 -4
  48. package/lib/chevre/repo/emailMessage.d.ts +1 -27
  49. package/lib/chevre/repo/emailMessage.js +0 -4
  50. package/lib/chevre/repo/event.d.ts +5 -1
  51. package/lib/chevre/repo/event.js +0 -4
  52. package/lib/chevre/repo/member.js +0 -4
  53. package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -3
  54. package/lib/chevre/repo/merchantReturnPolicy.js +0 -4
  55. package/lib/chevre/repo/mongoose/schemas/account.d.ts +5 -2
  56. package/lib/chevre/repo/mongoose/schemas/account.js +1 -0
  57. package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +30 -3
  58. package/lib/chevre/repo/mongoose/schemas/accountTitle.js +1 -0
  59. package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +32 -3
  60. package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +2 -1
  61. package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +14 -3
  62. package/lib/chevre/repo/mongoose/schemas/accountingReport.js +1 -0
  63. package/lib/chevre/repo/mongoose/schemas/action.d.ts +44 -3
  64. package/lib/chevre/repo/mongoose/schemas/action.js +2 -1
  65. package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +18 -3
  66. package/lib/chevre/repo/mongoose/schemas/additionalProperty.js +1 -0
  67. package/lib/chevre/repo/mongoose/schemas/aggregation.d.ts +5 -2
  68. package/lib/chevre/repo/mongoose/schemas/aggregation.js +1 -0
  69. package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +45 -3
  70. package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +3 -1
  71. package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +20 -3
  72. package/lib/chevre/repo/mongoose/schemas/authorization.js +2 -1
  73. package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +26 -3
  74. package/lib/chevre/repo/mongoose/schemas/categoryCode.js +1 -0
  75. package/lib/chevre/repo/mongoose/schemas/comments.d.ts +28 -3
  76. package/lib/chevre/repo/mongoose/schemas/comments.js +2 -1
  77. package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +44 -3
  78. package/lib/chevre/repo/mongoose/schemas/creativeWork.js +1 -0
  79. package/lib/chevre/repo/mongoose/schemas/customer.d.ts +26 -3
  80. package/lib/chevre/repo/mongoose/schemas/customer.js +1 -0
  81. package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +22 -3
  82. package/lib/chevre/repo/mongoose/schemas/emailMessages.js +1 -0
  83. package/lib/chevre/repo/mongoose/schemas/event.d.ts +72 -3
  84. package/lib/chevre/repo/mongoose/schemas/event.js +1 -0
  85. package/lib/chevre/repo/mongoose/schemas/member.d.ts +14 -3
  86. package/lib/chevre/repo/mongoose/schemas/member.js +1 -0
  87. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +22 -3
  88. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.js +1 -0
  89. package/lib/chevre/repo/mongoose/schemas/offer.d.ts +66 -3
  90. package/lib/chevre/repo/mongoose/schemas/offer.js +1 -0
  91. package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +28 -3
  92. package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +1 -0
  93. package/lib/chevre/repo/mongoose/schemas/order.d.ts +52 -3
  94. package/lib/chevre/repo/mongoose/schemas/order.js +2 -1
  95. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +26 -3
  96. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +2 -1
  97. package/lib/chevre/repo/mongoose/schemas/place.d.ts +50 -3
  98. package/lib/chevre/repo/mongoose/schemas/place.js +1 -0
  99. package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +30 -3
  100. package/lib/chevre/repo/mongoose/schemas/priceSpecification.js +1 -0
  101. package/lib/chevre/repo/mongoose/schemas/product.d.ts +32 -3
  102. package/lib/chevre/repo/mongoose/schemas/product.js +1 -0
  103. package/lib/chevre/repo/mongoose/schemas/project.d.ts +24 -3
  104. package/lib/chevre/repo/mongoose/schemas/project.js +1 -0
  105. package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +62 -3
  106. package/lib/chevre/repo/mongoose/schemas/reservation.js +2 -1
  107. package/lib/chevre/repo/mongoose/schemas/role.d.ts +12 -3
  108. package/lib/chevre/repo/mongoose/schemas/role.js +1 -0
  109. package/lib/chevre/repo/mongoose/schemas/seller.d.ts +32 -3
  110. package/lib/chevre/repo/mongoose/schemas/seller.js +1 -0
  111. package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +12 -3
  112. package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +2 -1
  113. package/lib/chevre/repo/mongoose/schemas/task.d.ts +31 -3
  114. package/lib/chevre/repo/mongoose/schemas/task.js +3 -1
  115. package/lib/chevre/repo/mongoose/schemas/telemetry.d.ts +22 -3
  116. package/lib/chevre/repo/mongoose/schemas/telemetry.js +1 -0
  117. package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +41 -3
  118. package/lib/chevre/repo/mongoose/schemas/transaction.js +3 -1
  119. package/lib/chevre/repo/mongoose/schemas/trip.d.ts +12 -3
  120. package/lib/chevre/repo/mongoose/schemas/trip.js +1 -0
  121. package/lib/chevre/repo/offer.js +0 -5
  122. package/lib/chevre/repo/offerCatalog.js +0 -4
  123. package/lib/chevre/repo/order.d.ts +25 -0
  124. package/lib/chevre/repo/order.js +5 -4
  125. package/lib/chevre/repo/ownershipInfo.js +0 -4
  126. package/lib/chevre/repo/permit.js +0 -4
  127. package/lib/chevre/repo/place.d.ts +5 -1
  128. package/lib/chevre/repo/place.js +1 -10
  129. package/lib/chevre/repo/priceSpecification.js +0 -4
  130. package/lib/chevre/repo/product.js +0 -4
  131. package/lib/chevre/repo/project.js +0 -4
  132. package/lib/chevre/repo/reservation.js +0 -4
  133. package/lib/chevre/repo/role.js +0 -4
  134. package/lib/chevre/repo/seller.js +0 -4
  135. package/lib/chevre/repo/serviceOutput.js +0 -4
  136. package/lib/chevre/repo/stockHolder.js +30 -0
  137. package/lib/chevre/repo/task.d.ts +38 -2
  138. package/lib/chevre/repo/task.js +96 -10
  139. package/lib/chevre/repo/telemetry.js +0 -4
  140. package/lib/chevre/repo/transaction.d.ts +23 -3
  141. package/lib/chevre/repo/transaction.js +174 -58
  142. package/lib/chevre/repo/trip.js +0 -4
  143. package/lib/chevre/service/aggregation/system.d.ts +67 -22
  144. package/lib/chevre/service/aggregation/system.js +101 -89
  145. package/lib/chevre/service/assetTransaction/cancelReservation.js +1 -5
  146. package/lib/chevre/service/assetTransaction/moneyTransfer.js +1 -1
  147. package/lib/chevre/service/assetTransaction/pay.js +10 -4
  148. package/lib/chevre/service/assetTransaction/refund.js +1 -1
  149. package/lib/chevre/service/assetTransaction/registerService.js +1 -2
  150. package/lib/chevre/service/assetTransaction/reserve.js +1 -1
  151. package/lib/chevre/service/assetTransaction.d.ts +6 -2
  152. package/lib/chevre/service/assetTransaction.js +9 -5
  153. package/lib/chevre/service/notification/factory.js +2 -2
  154. package/lib/chevre/service/notification.d.ts +3 -1
  155. package/lib/chevre/service/notification.js +41 -7
  156. package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -0
  157. package/lib/chevre/service/offer/event/voidTransaction.js +17 -1
  158. package/lib/chevre/service/offer.js +1 -1
  159. package/lib/chevre/service/order/deleteOrder.js +8 -1
  160. package/lib/chevre/service/order/onOrderStatusChanged.js +1 -1
  161. package/lib/chevre/service/order/placeOrder.js +1 -1
  162. package/lib/chevre/service/order/returnOrder.js +1 -5
  163. package/lib/chevre/service/order/sendOrder.js +1 -1
  164. package/lib/chevre/service/payment/any/onPaid.js +1 -1
  165. package/lib/chevre/service/payment/any/onRefund.js +1 -1
  166. package/lib/chevre/service/payment/any.js +60 -10
  167. package/lib/chevre/service/payment/movieTicket/validation.d.ts +6 -2
  168. package/lib/chevre/service/payment/movieTicket/validation.js +12 -25
  169. package/lib/chevre/service/payment/movieTicket.d.ts +4 -1
  170. package/lib/chevre/service/payment/movieTicket.js +4 -3
  171. package/lib/chevre/service/product.js +1 -5
  172. package/lib/chevre/service/report/telemetry.d.ts +0 -11
  173. package/lib/chevre/service/report/telemetry.js +21 -24
  174. package/lib/chevre/service/reserve/cancelReservation.js +0 -2
  175. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +0 -3
  176. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +20 -20
  177. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +2 -3
  178. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -31
  179. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +2 -3
  180. package/lib/chevre/service/reserve/useReservation.js +1 -8
  181. package/lib/chevre/service/task/confirmRegisterServiceTransaction.js +1 -1
  182. package/lib/chevre/service/task/returnPayTransaction.js +1 -5
  183. package/lib/chevre/service/task/voidReserveTransaction.js +3 -1
  184. package/lib/chevre/service/task.d.ts +9 -0
  185. package/lib/chevre/service/task.js +43 -4
  186. package/lib/chevre/service/transaction/moneyTransfer.js +4 -4
  187. package/lib/chevre/service/transaction/orderProgramMembership.js +2 -1
  188. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +30 -29
  189. package/lib/chevre/service/transaction/placeOrder.js +1 -5
  190. package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +1 -1
  191. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.d.ts +1 -0
  192. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +1 -1
  193. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.d.ts +1 -0
  194. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +1 -1
  195. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.d.ts +1 -0
  196. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.d.ts +3 -0
  197. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +7 -3
  198. package/lib/chevre/service/transaction/placeOrderInProgress/result.d.ts +1 -0
  199. package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -2
  200. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.d.ts +1 -1
  201. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +2 -2
  202. package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +2 -1
  203. package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +23 -17
  204. package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +1 -0
  205. package/lib/chevre/service/transaction/placeOrderInProgress.js +17 -10
  206. package/lib/chevre/service/transaction/returnOrder.js +1 -5
  207. package/lib/chevre/service/transaction.d.ts +6 -0
  208. package/lib/chevre/service/transaction.js +22 -16
  209. package/lib/chevre/settings.d.ts +4 -1
  210. package/lib/chevre/settings.js +11 -4
  211. package/package.json +5 -5
  212. package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +0 -96
  213. package/example/src/chevre/migrateMovieAdditionalProperties.ts +0 -98
@@ -11,18 +11,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.MongoRepository = void 0;
13
13
  const moment = require("moment");
14
- const onIndexCreated_1 = require("./mongoose/onIndexCreated");
15
14
  const assetTransaction_1 = require("./mongoose/schemas/assetTransaction");
16
15
  const factory = require("../factory");
16
+ const assetTransaction_2 = require("../eventEmitter/assetTransaction");
17
17
  /**
18
18
  * 資産取引リポジトリ
19
19
  */
20
20
  class MongoRepository {
21
21
  constructor(connection) {
22
22
  this.transactionModel = connection.model(assetTransaction_1.modelName, assetTransaction_1.schema);
23
- if (connection.get('autoIndex') === true) {
24
- this.transactionModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
25
- }
26
23
  }
27
24
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
28
25
  static CREATE_MONGO_CONDITIONS(params) {
@@ -106,6 +103,11 @@ class MongoRepository {
106
103
  }
107
104
  });
108
105
  }
106
+ if (Array.isArray(params.tasksExportationStatuses)) {
107
+ andConditions.push({
108
+ tasksExportationStatus: { $in: params.tasksExportationStatuses }
109
+ });
110
+ }
109
111
  switch (params.typeOf) {
110
112
  case factory.assetTransactionType.Pay:
111
113
  const objectAccountIdEq = (_e = (_d = params.object) === null || _d === void 0 ? void 0 : _d.accountId) === null || _e === void 0 ? void 0 : _e.$eq;
@@ -246,7 +248,9 @@ class MongoRepository {
246
248
  */
247
249
  start(params) {
248
250
  return __awaiter(this, void 0, void 0, function* () {
249
- return this.transactionModel.create(Object.assign(Object.assign({}, params), { typeOf: params.typeOf, status: factory.transactionStatusType.InProgress, startDate: new Date(), endDate: undefined, tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported }))
251
+ return this.transactionModel.create(Object.assign(Object.assign({}, params), { typeOf: params.typeOf, status: factory.transactionStatusType.InProgress, startDate: new Date(), endDate: undefined, tasksExportAction: {
252
+ actionStatus: factory.actionStatusType.PotentialActionStatus
253
+ }, tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported }))
250
254
  .then((doc) => doc.toObject());
251
255
  });
252
256
  }
@@ -276,15 +280,12 @@ class MongoRepository {
276
280
  return doc.toObject();
277
281
  });
278
282
  }
279
- /**
280
- * 取引を確定する
281
- */
282
283
  addReservations(params) {
283
284
  return __awaiter(this, void 0, void 0, function* () {
284
285
  const doc = yield this.transactionModel.findOneAndUpdate({
285
- _id: params.id,
286
- typeOf: params.typeOf,
287
- status: factory.transactionStatusType.InProgress
286
+ _id: { $eq: params.id },
287
+ typeOf: { $eq: params.typeOf },
288
+ status: { $eq: factory.transactionStatusType.InProgress }
288
289
  }, {
289
290
  'object.acceptedOffer': params.object.acceptedOffer,
290
291
  // 念のため残す(2021/10/14)が、そのうち削除
@@ -309,34 +310,40 @@ class MongoRepository {
309
310
  confirm(params) {
310
311
  return __awaiter(this, void 0, void 0, function* () {
311
312
  const doc = yield this.transactionModel.findOneAndUpdate({
312
- _id: params.id,
313
- typeOf: params.typeOf,
314
- status: factory.transactionStatusType.InProgress
313
+ _id: { $eq: params.id },
314
+ typeOf: { $eq: params.typeOf },
315
+ status: { $eq: factory.transactionStatusType.InProgress }
315
316
  }, {
316
317
  status: factory.transactionStatusType.Confirmed,
317
318
  endDate: new Date(),
318
319
  result: params.result,
319
320
  potentialActions: params.potentialActions // resultを更新
320
- }, { new: true })
321
+ }, {
322
+ new: true,
323
+ projection: { _id: 1 }
324
+ })
321
325
  .exec();
322
326
  // NotFoundであれば取引状態確認
323
327
  if (doc === null) {
324
328
  const transaction = yield this.findById({ typeOf: params.typeOf, id: params.id });
325
329
  if (transaction.status === factory.transactionStatusType.Confirmed) {
326
- // すでに確定済の場合
327
- return transaction;
330
+ // すでに確定済の場合スルー
328
331
  }
329
332
  else if (transaction.status === factory.transactionStatusType.Expired) {
330
- throw new factory.errors.Argument('Transaction id', 'Transaction already expired');
333
+ throw new factory.errors.Argument('Transaction id', `Transaction ${transaction.typeOf} ${transaction.transactionNumber} already expired`);
331
334
  }
332
335
  else if (transaction.status === factory.transactionStatusType.Canceled) {
333
- throw new factory.errors.Argument('Transaction id', 'Transaction already canceled');
336
+ throw new factory.errors.Argument('Transaction id', `Transaction ${transaction.typeOf} ${transaction.transactionNumber} already canceled`);
334
337
  }
335
338
  else {
336
339
  throw new factory.errors.NotFound(this.transactionModel.modelName);
337
340
  }
338
341
  }
339
- return doc.toObject();
342
+ assetTransaction_2.assetTransactionEventEmitter.emitAssetTransactionStatusChanged({
343
+ id: params.id,
344
+ typeOf: params.typeOf,
345
+ status: factory.transactionStatusType.Confirmed
346
+ });
340
347
  });
341
348
  }
342
349
  /**
@@ -344,23 +351,42 @@ class MongoRepository {
344
351
  */
345
352
  startAndConfirm(params) {
346
353
  return __awaiter(this, void 0, void 0, function* () {
347
- return this.transactionModel.create(Object.assign(Object.assign({ _id: params.id, typeOf: params.typeOf }, params), { startDate: new Date(), status: factory.transactionStatusType.Confirmed, tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported, endDate: new Date(), result: params.result, potentialActions: params.potentialActions }))
354
+ const startDate = new Date();
355
+ const confirmedTransaction = yield this.transactionModel.create(Object.assign(Object.assign({}, params), { _id: params.id, typeOf: params.typeOf, startDate, status: factory.transactionStatusType.Confirmed, tasksExportAction: {
356
+ actionStatus: factory.actionStatusType.PotentialActionStatus
357
+ }, tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported, endDate: startDate, result: params.result, potentialActions: params.potentialActions }))
348
358
  .then((doc) => doc.toObject());
359
+ assetTransaction_2.assetTransactionEventEmitter.emitAssetTransactionStatusChanged({
360
+ id: params.id,
361
+ typeOf: params.typeOf,
362
+ status: factory.transactionStatusType.Confirmed
363
+ });
364
+ return confirmedTransaction;
349
365
  });
350
366
  }
351
367
  /**
352
368
  * タスク未エクスポートの取引をひとつ取得してエクスポートを開始する
353
369
  */
354
370
  startExportTasks(params) {
355
- var _a, _b, _c;
371
+ var _a, _b;
356
372
  return __awaiter(this, void 0, void 0, function* () {
357
- return this.transactionModel.findOneAndUpdate(Object.assign(Object.assign(Object.assign({}, (typeof ((_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === 'string')
358
- ? {
359
- 'project.id': {
360
- $eq: params.project.id
361
- }
362
- } : undefined), (Array.isArray((_b = params.typeOf) === null || _b === void 0 ? void 0 : _b.$in))
363
- ? { typeOf: { $in: (_c = params.typeOf) === null || _c === void 0 ? void 0 : _c.$in } } : undefined), { status: params.status, tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported }), { tasksExportationStatus: factory.transactionTasksExportationStatus.Exporting }, { new: true })
373
+ switch (params.status) {
374
+ case factory.transactionStatusType.InProgress:
375
+ throw new factory.errors.NotImplemented(`status "${params.status}" not implemented on startExportTasks`);
376
+ default:
377
+ // no op
378
+ }
379
+ const typeOfIn = (_a = params.typeOf) === null || _a === void 0 ? void 0 : _a.$in;
380
+ return this.transactionModel.findOneAndUpdate(Object.assign(Object.assign(Object.assign(Object.assign({}, (typeof ((_b = params.project) === null || _b === void 0 ? void 0 : _b.id) === 'string') ? { 'project.id': { $eq: params.project.id } } : undefined), (Array.isArray(typeOfIn)) ? { typeOf: { $in: typeOfIn } } : undefined), { status: { $eq: params.status }, tasksExportationStatus: { $eq: factory.transactionTasksExportationStatus.Unexported } }), (typeof params.id === 'string') ? { _id: { $eq: params.id } } : undefined), {
381
+ 'tasksExportAction.actionStatus': factory.actionStatusType.ActiveActionStatus,
382
+ 'tasksExportAction.agent': { name: params.tasksExportAction.agent.name },
383
+ 'tasksExportAction.startDate': new Date(),
384
+ tasksExportationStatus: factory.transactionTasksExportationStatus.Exporting
385
+ }, { new: true })
386
+ .select({
387
+ _id: 1,
388
+ typeOf: 1
389
+ })
364
390
  .exec()
365
391
  // tslint:disable-next-line:no-null-keyword
366
392
  .then((doc) => (doc === null) ? null : doc.toObject());
@@ -373,17 +399,74 @@ class MongoRepository {
373
399
  */
374
400
  reexportTasks(params) {
375
401
  return __awaiter(this, void 0, void 0, function* () {
376
- yield this.transactionModel.updateMany({
377
- tasksExportationStatus: factory.transactionTasksExportationStatus.Exporting,
402
+ const reexportingTransactions = yield this.transactionModel.find({
403
+ tasksExportationStatus: { $eq: factory.transactionTasksExportationStatus.Exporting },
378
404
  updatedAt: {
379
405
  $lt: moment()
380
406
  .add(-params.intervalInMinutes, 'minutes')
381
407
  .toDate()
382
408
  }
383
- }, {
384
- tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported
385
409
  })
410
+ .select({
411
+ _id: 1,
412
+ typeOf: 1,
413
+ status: 1
414
+ })
415
+ .setOptions({ maxTimeMS: 10000 })
386
416
  .exec();
417
+ if (reexportingTransactions.length > 0) {
418
+ for (const reexportingTransaction of reexportingTransactions) {
419
+ yield this.transactionModel.updateOne({
420
+ _id: { $eq: reexportingTransaction.id },
421
+ tasksExportationStatus: { $eq: factory.transactionTasksExportationStatus.Exporting }
422
+ }, {
423
+ tasksExportAction: {
424
+ actionStatus: factory.actionStatusType.PotentialActionStatus
425
+ },
426
+ tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported
427
+ })
428
+ .exec();
429
+ assetTransaction_2.assetTransactionEventEmitter.emitAssetTransactionStatusChanged({
430
+ id: reexportingTransaction.id,
431
+ typeOf: reexportingTransaction.typeOf,
432
+ status: reexportingTransaction.status
433
+ });
434
+ }
435
+ }
436
+ });
437
+ }
438
+ /**
439
+ * タスクエクスポートの遅延している取引について明示的にemitTransactionStatusChangedを実行する
440
+ */
441
+ exportTasks(params) {
442
+ return __awaiter(this, void 0, void 0, function* () {
443
+ const delayedTransactions = yield this.transactionModel.find({
444
+ status: { $in: params.status.$in },
445
+ tasksExportationStatus: { $eq: factory.transactionTasksExportationStatus.Unexported },
446
+ endDate: {
447
+ $exists: true,
448
+ $lt: moment(params.now)
449
+ .add(-params.delayInSeconds, 'seconds')
450
+ .toDate()
451
+ }
452
+ })
453
+ .select({
454
+ _id: 1,
455
+ typeOf: 1,
456
+ status: 1
457
+ })
458
+ .setOptions({ maxTimeMS: 10000 })
459
+ .exec();
460
+ if (delayedTransactions.length > 0) {
461
+ delayedTransactions.forEach((delayedTransaction) => {
462
+ assetTransaction_2.assetTransactionEventEmitter.emitAssetTransactionStatusChanged({
463
+ id: delayedTransaction.id,
464
+ typeOf: delayedTransaction.typeOf,
465
+ status: delayedTransaction.status
466
+ });
467
+ });
468
+ }
469
+ return delayedTransactions;
387
470
  });
388
471
  }
389
472
  /**
@@ -392,10 +475,15 @@ class MongoRepository {
392
475
  */
393
476
  setTasksExportedById(params) {
394
477
  return __awaiter(this, void 0, void 0, function* () {
395
- yield this.transactionModel.findByIdAndUpdate(params.id, {
478
+ const endDate = new Date();
479
+ yield this.transactionModel.updateOne({
480
+ _id: { $eq: params.id },
481
+ tasksExportationStatus: { $eq: factory.transactionTasksExportationStatus.Exporting }
482
+ }, {
396
483
  tasksExportationStatus: factory.transactionTasksExportationStatus.Exported,
397
- tasksExportedAt: moment()
398
- .toDate()
484
+ tasksExportedAt: endDate,
485
+ 'tasksExportAction.actionStatus': factory.actionStatusType.CompletedActionStatus,
486
+ 'tasksExportAction.endDate': endDate
399
487
  })
400
488
  .exec();
401
489
  });
@@ -405,15 +493,36 @@ class MongoRepository {
405
493
  */
406
494
  makeExpired(params) {
407
495
  return __awaiter(this, void 0, void 0, function* () {
408
- // ステータスと期限を見て更新
409
- yield this.transactionModel.updateMany({
410
- status: factory.transactionStatusType.InProgress,
411
- expires: { $lt: params.expires }
412
- }, {
413
- status: factory.transactionStatusType.Expired,
414
- endDate: new Date()
496
+ // IDをemitしたいのでまずリスト検索(2023-04-27~)
497
+ const expiringTransactions = yield this.transactionModel.find({
498
+ status: { $eq: factory.transactionStatusType.InProgress },
499
+ expires: { $lt: params.expires.$lt }
500
+ })
501
+ .select({
502
+ _id: 1,
503
+ typeOf: 1
415
504
  })
505
+ .setOptions({ maxTimeMS: 10000 })
416
506
  .exec();
507
+ if (expiringTransactions.length > 0) {
508
+ // ステータスと期限を見て更新
509
+ yield this.transactionModel.updateMany({
510
+ _id: { $in: expiringTransactions.map((t) => t.id) },
511
+ status: { $eq: factory.transactionStatusType.InProgress },
512
+ expires: { $lt: params.expires.$lt }
513
+ }, {
514
+ status: factory.transactionStatusType.Expired,
515
+ endDate: new Date()
516
+ })
517
+ .exec();
518
+ expiringTransactions.forEach((expiringTransaction) => {
519
+ assetTransaction_2.assetTransactionEventEmitter.emitAssetTransactionStatusChanged({
520
+ id: expiringTransaction.id,
521
+ typeOf: expiringTransaction.typeOf,
522
+ status: factory.transactionStatusType.Expired
523
+ });
524
+ });
525
+ }
417
526
  });
418
527
  }
419
528
  /**
@@ -421,19 +530,18 @@ class MongoRepository {
421
530
  */
422
531
  cancel(params) {
423
532
  return __awaiter(this, void 0, void 0, function* () {
424
- const endDate = moment()
425
- .toDate();
533
+ const endDate = new Date();
426
534
  // 進行中ステータスの取引を中止する
427
- const doc = yield this.transactionModel.findOneAndUpdate(Object.assign(Object.assign(Object.assign({ typeOf: params.typeOf }, (typeof params.id === 'string') ? { _id: params.id } : undefined), (typeof params.transactionNumber === 'string')
535
+ const doc = yield this.transactionModel.findOneAndUpdate(Object.assign(Object.assign(Object.assign({ typeOf: { $eq: params.typeOf } }, (typeof params.id === 'string') ? { _id: { $eq: params.id } } : undefined), (typeof params.transactionNumber === 'string')
428
536
  ? { transactionNumber: { $exists: true, $eq: params.transactionNumber } }
429
- : undefined), { status: factory.transactionStatusType.InProgress }), {
537
+ : undefined), { status: { $eq: factory.transactionStatusType.InProgress } }), {
430
538
  status: factory.transactionStatusType.Canceled,
431
539
  endDate: endDate
432
540
  }, { new: true })
433
541
  .exec();
542
+ let transaction;
434
543
  // NotFoundであれば取引状態確認
435
544
  if (doc === null) {
436
- let transaction;
437
545
  if (typeof params.id === 'string') {
438
546
  transaction = yield this.findById({ typeOf: params.typeOf, id: params.id });
439
547
  }
@@ -447,20 +555,27 @@ class MongoRepository {
447
555
  throw new factory.errors.ArgumentNull('Transaction ID or Transaction Number');
448
556
  }
449
557
  if (transaction.status === factory.transactionStatusType.Canceled) {
450
- // すでに中止済の場合
451
- return transaction;
558
+ // すでに中止済の場合スルー
452
559
  }
453
560
  else if (transaction.status === factory.transactionStatusType.Expired) {
454
- throw new factory.errors.Argument('Transaction id', 'Transaction already expired');
561
+ throw new factory.errors.Argument('Transaction id', `Transaction ${transaction.typeOf} ${transaction.transactionNumber} already expired`);
455
562
  }
456
563
  else if (transaction.status === factory.transactionStatusType.Confirmed) {
457
- throw new factory.errors.Argument('Transaction id', 'Confirmed transaction unable to cancel');
564
+ throw new factory.errors.Argument('Transaction id', `Confirmed transaction ${transaction.typeOf} ${transaction.transactionNumber} unable to cancel`);
458
565
  }
459
566
  else {
460
567
  throw new factory.errors.NotFound(this.transactionModel.modelName);
461
568
  }
462
569
  }
463
- return doc.toObject();
570
+ else {
571
+ transaction = doc.toObject();
572
+ }
573
+ assetTransaction_2.assetTransactionEventEmitter.emitAssetTransactionStatusChanged({
574
+ id: transaction.id,
575
+ typeOf: params.typeOf,
576
+ status: factory.transactionStatusType.Canceled
577
+ });
578
+ return transaction;
464
579
  });
465
580
  }
466
581
  count(params) {
@@ -522,9 +637,12 @@ class MongoRepository {
522
637
  /**
523
638
  * 特定の取引を更新する(汎用)
524
639
  */
525
- findByIdAndUpdate(params) {
640
+ findByIdAndUpdateInProgress(params) {
526
641
  return __awaiter(this, void 0, void 0, function* () {
527
- return this.transactionModel.findOneAndUpdate({ _id: params.id }, params.update, { new: true })
642
+ return this.transactionModel.findOneAndUpdate({
643
+ _id: { $eq: params.id },
644
+ status: { $eq: factory.transactionStatusType.InProgress }
645
+ }, params.update, { new: true })
528
646
  .exec()
529
647
  .then((doc) => {
530
648
  if (doc === null) {
@@ -21,7 +21,6 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = void 0;
24
- const onIndexCreated_1 = require("./mongoose/onIndexCreated");
25
24
  const categoryCode_1 = require("./mongoose/schemas/categoryCode");
26
25
  const factory = require("../factory");
27
26
  /**
@@ -30,9 +29,6 @@ const factory = require("../factory");
30
29
  class MongoRepository {
31
30
  constructor(connection) {
32
31
  this.categoryCodeModel = connection.model(categoryCode_1.modelName, categoryCode_1.schema);
33
- if (connection.get('autoIndex') === true) {
34
- this.categoryCodeModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
35
- }
36
32
  }
37
33
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
38
34
  static CREATE_MONGO_CONDITIONS(params) {
@@ -13,7 +13,6 @@ exports.MongoRepository = exports.modelName = void 0;
13
13
  const moment = require("moment");
14
14
  const uuid = require("uuid");
15
15
  const factory = require("../factory");
16
- const onIndexCreated_1 = require("./mongoose/onIndexCreated");
17
16
  const authorization_1 = require("./mongoose/schemas/authorization");
18
17
  Object.defineProperty(exports, "modelName", { enumerable: true, get: function () { return authorization_1.modelName; } });
19
18
  /**
@@ -22,9 +21,6 @@ Object.defineProperty(exports, "modelName", { enumerable: true, get: function ()
22
21
  class MongoRepository {
23
22
  constructor(connection) {
24
23
  this.authorizationModel = connection.model(authorization_1.modelName, authorization_1.schema);
25
- if (connection.get('autoIndex') === true) {
26
- this.authorizationModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
27
- }
28
24
  }
29
25
  // tslint:disable-next-line:max-func-body-length
30
26
  static CREATE_MONGO_CONDITIONS(params) {
@@ -34,7 +34,10 @@ export declare class MongoRepository {
34
34
  /**
35
35
  * 検索
36
36
  */
37
- search(params: factory.creativeWork.comment.ISearchConditions): Promise<factory.creativeWork.comment.IComment[]>;
37
+ search(params: factory.creativeWork.comment.ISearchConditions & {
38
+ inclusion: string[];
39
+ exclusion: string[];
40
+ }): Promise<factory.creativeWork.comment.IComment[]>;
38
41
  findById(params: {
39
42
  id: string;
40
43
  }): Promise<factory.creativeWork.comment.IComment>;
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.MongoRepository = void 0;
13
- const onIndexCreated_1 = require("./mongoose/onIndexCreated");
14
13
  const comments_1 = require("./mongoose/schemas/comments");
15
14
  const factory = require("../factory");
16
15
  /**
@@ -19,9 +18,6 @@ const factory = require("../factory");
19
18
  class MongoRepository {
20
19
  constructor(connection) {
21
20
  this.commentModel = connection.model(comments_1.modelName, comments_1.schema);
22
- if (connection.get('autoIndex') === true) {
23
- this.commentModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
24
- }
25
21
  }
26
22
  static CREATE_MONGO_CONDITIONS(params) {
27
23
  var _a, _b, _c, _d, _e, _f;
@@ -46,12 +42,27 @@ class MongoRepository {
46
42
  search(params) {
47
43
  var _a;
48
44
  return __awaiter(this, void 0, void 0, function* () {
45
+ let projection = {};
46
+ if (Array.isArray(params.inclusion) && params.inclusion.length > 0) {
47
+ params.inclusion.forEach((field) => {
48
+ projection[field] = 1;
49
+ });
50
+ }
51
+ else {
52
+ projection = {
53
+ __v: 0,
54
+ createdAt: 0,
55
+ updatedAt: 0
56
+ };
57
+ if (Array.isArray(params.exclusion) && params.exclusion.length > 0) {
58
+ params.exclusion.forEach((field) => {
59
+ projection[field] = 0;
60
+ });
61
+ }
62
+ }
49
63
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
50
- const query = this.commentModel.find((conditions.length > 0) ? { $and: conditions } : {}, {
51
- __v: 0,
52
- createdAt: 0,
53
- updatedAt: 0
54
- });
64
+ const query = this.commentModel.find((conditions.length > 0) ? { $and: conditions } : {})
65
+ .select(projection);
55
66
  if (typeof params.limit === 'number' && params.limit > 0) {
56
67
  const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
57
68
  query.limit(params.limit)
@@ -4,7 +4,6 @@ import { RedisClientType } from 'redis';
4
4
  */
5
5
  export declare class RedisRepository {
6
6
  private static readonly REDIS_KEY_PREFIX_NEW;
7
- private static readonly REDIS_KEY_PREFIX;
8
7
  private readonly redisClient;
9
8
  constructor(redisClient: RedisClientType);
10
9
  private static alignDigits;
@@ -16,7 +16,6 @@ const util = require("util");
16
16
  // tslint:disable-next-line:no-require-imports no-var-requires
17
17
  const fpe = require('node-fpe');
18
18
  const factory = require("../factory");
19
- const settings_1 = require("../settings");
20
19
  const CONFIRMATION_NUMBER_MIN_LENGH = 4;
21
20
  /**
22
21
  * 確認番号リポジトリ
@@ -34,19 +33,9 @@ class RedisRepository {
34
33
  return aligndNumber;
35
34
  }
36
35
  static createKey(params) {
37
- const useNewKey = params.orderDate instanceof Date
38
- && moment(params.orderDate)
39
- .isSameOrAfter(settings_1.USE_NEW_CONFIRMATION_NUMBER_KEY_FROM);
40
- if (useNewKey) {
41
- return util.format('%s:%s', RedisRepository.REDIS_KEY_PREFIX_NEW, moment(params.orderDate)
42
- .tz('Asia/Tokyo')
43
- .format('YYMM'));
44
- }
45
- else {
46
- return util.format('%s:%s', RedisRepository.REDIS_KEY_PREFIX, moment(params.orderDate)
47
- .tz('Asia/Tokyo')
48
- .format('YYMM'));
49
- }
36
+ return util.format('%s:%s', RedisRepository.REDIS_KEY_PREFIX_NEW, moment(params.orderDate)
37
+ .tz('Asia/Tokyo')
38
+ .format('YYMM'));
50
39
  }
51
40
  /**
52
41
  * 発行する
@@ -81,5 +70,4 @@ class RedisRepository {
81
70
  }
82
71
  }
83
72
  RedisRepository.REDIS_KEY_PREFIX_NEW = 'confirmationNumber';
84
- RedisRepository.REDIS_KEY_PREFIX = 'cinerino:confirmationNumber';
85
73
  exports.RedisRepository = RedisRepository;
@@ -34,9 +34,7 @@ export declare class MongoRepository {
34
34
  /**
35
35
  * コンテンツを保管する
36
36
  */
37
- saveMovie(params: factory.creativeWork.movie.ICreativeWork): Promise<import("mongoose").LeanDocument<any> & Required<{
38
- _id: unknown;
39
- }>>;
37
+ saveMovie(params: factory.creativeWork.movie.ICreativeWork): Promise<any>;
40
38
  findMovieById(params: {
41
39
  id: string;
42
40
  }): Promise<factory.creativeWork.movie.ICreativeWork>;
@@ -21,7 +21,6 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = void 0;
24
- const onIndexCreated_1 = require("./mongoose/onIndexCreated");
25
24
  const creativeWork_1 = require("./mongoose/schemas/creativeWork");
26
25
  const factory = require("../factory");
27
26
  /**
@@ -30,9 +29,6 @@ const factory = require("../factory");
30
29
  class MongoRepository {
31
30
  constructor(connection) {
32
31
  this.creativeWorkModel = connection.model(creativeWork_1.modelName, creativeWork_1.schema);
33
- if (connection.get('autoIndex') === true) {
34
- this.creativeWorkModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
35
- }
36
32
  }
37
33
  // tslint:disable-next-line:max-func-body-length
38
34
  static CREATE_MONGO_CONDITIONS(params) {
@@ -21,7 +21,6 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = void 0;
24
- const onIndexCreated_1 = require("./mongoose/onIndexCreated");
25
24
  const customer_1 = require("./mongoose/schemas/customer");
26
25
  const factory = require("../factory");
27
26
  /**
@@ -30,9 +29,6 @@ const factory = require("../factory");
30
29
  class MongoRepository {
31
30
  constructor(connection) {
32
31
  this.customerModel = connection.model(customer_1.modelName, customer_1.schema);
33
- if (connection.get('autoIndex') === true) {
34
- this.customerModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
35
- }
36
32
  }
37
33
  // tslint:disable-next-line:max-func-body-length
38
34
  static CREATE_MONGO_CONDITIONS(params) {
@@ -1,27 +1,3 @@
1
- /// <reference types="mongoose/types/aggregate" />
2
- /// <reference types="mongoose/types/callback" />
3
- /// <reference types="mongoose/types/collection" />
4
- /// <reference types="mongoose/types/connection" />
5
- /// <reference types="mongoose/types/cursor" />
6
- /// <reference types="mongoose/types/document" />
7
- /// <reference types="mongoose/types/error" />
8
- /// <reference types="mongoose/types/expressions" />
9
- /// <reference types="mongoose/types/helpers" />
10
- /// <reference types="mongoose/types/middlewares" />
11
- /// <reference types="mongoose/types/indexes" />
12
- /// <reference types="mongoose/types/models" />
13
- /// <reference types="mongoose/types/mongooseoptions" />
14
- /// <reference types="mongoose/types/pipelinestage" />
15
- /// <reference types="mongoose/types/populate" />
16
- /// <reference types="mongoose/types/query" />
17
- /// <reference types="mongoose/types/schemaoptions" />
18
- /// <reference types="mongoose/types/schematypes" />
19
- /// <reference types="mongoose/types/session" />
20
- /// <reference types="mongoose/types/types" />
21
- /// <reference types="mongoose/types/utility" />
22
- /// <reference types="mongoose/types/validation" />
23
- /// <reference types="mongoose/types/virtuals" />
24
- /// <reference types="mongoose/types/inferschematype" />
25
1
  import { Connection } from 'mongoose';
26
2
  import * as factory from '../factory';
27
3
  export type IEmailMessage = factory.creativeWork.message.email.ICreativeWork;
@@ -50,9 +26,7 @@ export declare class MongoRepository {
50
26
  private readonly emailMessageModel;
51
27
  constructor(connection: Connection);
52
28
  static CREATE_MONGO_CONDITIONS(params: ISearchConditions): any[];
53
- save(params: IEmailMessage): Promise<import("mongoose").LeanDocument<any> & Required<{
54
- _id: unknown;
55
- }>>;
29
+ save(params: IEmailMessage): Promise<any>;
56
30
  findById(params: {
57
31
  id: string;
58
32
  }): Promise<IEmailMessage>;
@@ -21,7 +21,6 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = void 0;
24
- const onIndexCreated_1 = require("./mongoose/onIndexCreated");
25
24
  const emailMessages_1 = require("./mongoose/schemas/emailMessages");
26
25
  const factory = require("../factory");
27
26
  /**
@@ -30,9 +29,6 @@ const factory = require("../factory");
30
29
  class MongoRepository {
31
30
  constructor(connection) {
32
31
  this.emailMessageModel = connection.model(emailMessages_1.modelName, emailMessages_1.schema);
33
- if (connection.get('autoIndex') === true) {
34
- this.emailMessageModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
35
- }
36
32
  }
37
33
  static CREATE_MONGO_CONDITIONS(params) {
38
34
  var _a, _b, _c, _d, _e;
@@ -169,7 +169,11 @@ export declare class MongoRepository {
169
169
  updateAggregationById<T extends factory.eventType>(params: {
170
170
  id: string;
171
171
  }, update: IUpdateAggregateReservationParams | IUpdateAggregateUseActionsParams): Promise<factory.event.IEvent<T>>;
172
- bulkWrite(bulkWriteOps: any[]): Promise<BulkWriteOpResultObject>;
172
+ bulkWrite(bulkWriteOps: any[]): Promise<BulkWriteOpResultObject & {
173
+ mongoose?: {
174
+ validationErrors: import("mongoose").Error[];
175
+ } | undefined;
176
+ }>;
173
177
  getCursor(conditions: any, projection: any): import("mongoose").Cursor<any, import("mongoose").QueryOptions<any>>;
174
178
  unsetUnnecessaryFields(params: {
175
179
  filter: any;