@chevre/domain 21.0.0-alpha.8 → 21.0.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 (227) hide show
  1. package/lib/chevre/errorHandler.d.ts +1 -0
  2. package/lib/chevre/errorHandler.js +6 -2
  3. package/lib/chevre/factory/event.d.ts +1 -1
  4. package/lib/chevre/repo/account.d.ts +0 -2
  5. package/lib/chevre/repo/account.js +6 -3
  6. package/lib/chevre/repo/accountTitle.js +5 -1
  7. package/lib/chevre/repo/accountTransaction.d.ts +0 -2
  8. package/lib/chevre/repo/accountTransaction.js +6 -3
  9. package/lib/chevre/repo/accountingReport.d.ts +1 -1
  10. package/lib/chevre/repo/accountingReport.js +6 -2
  11. package/lib/chevre/repo/action/registerServiceInProgress.js +1 -1
  12. package/lib/chevre/repo/action.d.ts +3 -4
  13. package/lib/chevre/repo/action.js +6 -3
  14. package/lib/chevre/repo/additionalProperty.js +5 -1
  15. package/lib/chevre/repo/aggregation.js +5 -1
  16. package/lib/chevre/repo/assetTransaction.d.ts +1 -2
  17. package/lib/chevre/repo/assetTransaction.js +6 -3
  18. package/lib/chevre/repo/categoryCode.js +5 -1
  19. package/lib/chevre/repo/code.d.ts +3 -3
  20. package/lib/chevre/repo/code.js +5 -1
  21. package/lib/chevre/repo/comment.js +5 -1
  22. package/lib/chevre/repo/confirmationNumber.js +1 -1
  23. package/lib/chevre/repo/creativeWork.d.ts +0 -2
  24. package/lib/chevre/repo/creativeWork.js +6 -3
  25. package/lib/chevre/repo/customer.js +5 -1
  26. package/lib/chevre/repo/emailMessage.d.ts +1 -1
  27. package/lib/chevre/repo/emailMessage.js +5 -1
  28. package/lib/chevre/repo/event.d.ts +7 -1
  29. package/lib/chevre/repo/event.js +104 -27
  30. package/lib/chevre/repo/itemAvailability/screeningEvent.js +1 -1
  31. package/lib/chevre/repo/member.js +5 -1
  32. package/lib/chevre/repo/merchantReturnPolicy.d.ts +0 -2
  33. package/lib/chevre/repo/merchantReturnPolicy.js +6 -3
  34. package/lib/chevre/repo/mongoose/onIndexCreated.d.ts +2 -0
  35. package/lib/chevre/repo/mongoose/onIndexCreated.js +11 -0
  36. package/lib/chevre/repo/mongoose/{model → schemas}/event.js +23 -0
  37. package/lib/chevre/repo/offer.js +7 -2
  38. package/lib/chevre/repo/offerCatalog.js +5 -1
  39. package/lib/chevre/repo/order.d.ts +0 -2
  40. package/lib/chevre/repo/order.js +7 -4
  41. package/lib/chevre/repo/orderNumber.js +1 -1
  42. package/lib/chevre/repo/ownershipInfo.d.ts +1 -3
  43. package/lib/chevre/repo/ownershipInfo.js +7 -4
  44. package/lib/chevre/repo/paymentMethod/creditCard.d.ts +3 -3
  45. package/lib/chevre/repo/permit.js +5 -1
  46. package/lib/chevre/repo/person.d.ts +2 -2
  47. package/lib/chevre/repo/place.d.ts +2 -2
  48. package/lib/chevre/repo/place.js +5 -1
  49. package/lib/chevre/repo/priceSpecification.js +5 -1
  50. package/lib/chevre/repo/product.d.ts +1 -1
  51. package/lib/chevre/repo/product.js +5 -1
  52. package/lib/chevre/repo/project.js +5 -1
  53. package/lib/chevre/repo/rateLimit/offer.js +1 -1
  54. package/lib/chevre/repo/reservation.d.ts +1 -1
  55. package/lib/chevre/repo/reservation.js +5 -1
  56. package/lib/chevre/repo/role.js +5 -1
  57. package/lib/chevre/repo/seller.d.ts +1 -1
  58. package/lib/chevre/repo/seller.js +5 -1
  59. package/lib/chevre/repo/serviceOutput.js +5 -1
  60. package/lib/chevre/repo/serviceOutputIdentifier.js +1 -1
  61. package/lib/chevre/repo/task.js +5 -1
  62. package/lib/chevre/repo/telemetry.js +5 -1
  63. package/lib/chevre/repo/transaction.d.ts +1 -2
  64. package/lib/chevre/repo/transaction.js +6 -3
  65. package/lib/chevre/repo/transactionNumber.js +1 -1
  66. package/lib/chevre/repo/trip.d.ts +1 -1
  67. package/lib/chevre/repo/trip.js +5 -1
  68. package/lib/chevre/service/account.d.ts +1 -1
  69. package/lib/chevre/service/accountTransaction/deposit.d.ts +1 -1
  70. package/lib/chevre/service/accountTransaction/deposit.js +0 -5
  71. package/lib/chevre/service/accountTransaction/transfer.d.ts +1 -1
  72. package/lib/chevre/service/accountTransaction/transfer.js +0 -5
  73. package/lib/chevre/service/accountTransaction/withdraw.d.ts +1 -1
  74. package/lib/chevre/service/accountTransaction/withdraw.js +0 -5
  75. package/lib/chevre/service/accountTransaction.d.ts +1 -1
  76. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +1 -1
  77. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.d.ts +1 -1
  78. package/lib/chevre/service/aggregation/project.d.ts +1 -1
  79. package/lib/chevre/service/assetTransaction/cancelReservation.d.ts +3 -3
  80. package/lib/chevre/service/assetTransaction/moneyTransfer.d.ts +4 -4
  81. package/lib/chevre/service/assetTransaction/moneyTransfer.js +0 -5
  82. package/lib/chevre/service/assetTransaction/pay/potentialActions.d.ts +1 -1
  83. package/lib/chevre/service/assetTransaction/pay.d.ts +7 -7
  84. package/lib/chevre/service/assetTransaction/refund.d.ts +4 -4
  85. package/lib/chevre/service/assetTransaction/refund.js +0 -5
  86. package/lib/chevre/service/assetTransaction/registerService/factory.d.ts +1 -1
  87. package/lib/chevre/service/assetTransaction/registerService.d.ts +4 -4
  88. package/lib/chevre/service/assetTransaction/registerService.js +0 -5
  89. package/lib/chevre/service/assetTransaction/reserve/factory/price.d.ts +1 -1
  90. package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +2 -2
  91. package/lib/chevre/service/assetTransaction/reserve.d.ts +6 -6
  92. package/lib/chevre/service/assetTransaction/reserve.js +0 -10
  93. package/lib/chevre/service/code.d.ts +2 -2
  94. package/lib/chevre/service/code.js +6 -1
  95. package/lib/chevre/service/delivery/factory.d.ts +1 -1
  96. package/lib/chevre/service/delivery/product/factory.d.ts +1 -1
  97. package/lib/chevre/service/delivery/reservation/factory.d.ts +1 -1
  98. package/lib/chevre/service/iam.d.ts +1 -1
  99. package/lib/chevre/service/moneyTransfer.d.ts +1 -1
  100. package/lib/chevre/service/notification.d.ts +1 -1
  101. package/lib/chevre/service/offer/event/authorize.d.ts +2 -2
  102. package/lib/chevre/service/offer/event/factory.d.ts +5 -5
  103. package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +2 -2
  104. package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +2 -2
  105. package/lib/chevre/service/offer/eventServiceByCOA/validateAcceptedOffers.d.ts +1 -1
  106. package/lib/chevre/service/offer/eventServiceByCOA.d.ts +2 -2
  107. package/lib/chevre/service/offer/factory.d.ts +2 -2
  108. package/lib/chevre/service/offer/moneyTransfer/authorize.d.ts +1 -1
  109. package/lib/chevre/service/offer/product.d.ts +2 -2
  110. package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +1 -1
  111. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +6 -1
  112. package/lib/chevre/service/order/onOrderStatusChanged.d.ts +2 -2
  113. package/lib/chevre/service/order/placeOrder.d.ts +1 -1
  114. package/lib/chevre/service/order/sendOrder.d.ts +1 -1
  115. package/lib/chevre/service/payment/any/factory.d.ts +1 -1
  116. package/lib/chevre/service/payment/any/onPaymentStatusChanged/onPaid.d.ts +1 -1
  117. package/lib/chevre/service/payment/any/onPaymentStatusChanged/onRefunded.d.ts +1 -1
  118. package/lib/chevre/service/payment/any.d.ts +3 -3
  119. package/lib/chevre/service/payment/creditCard.js +5 -0
  120. package/lib/chevre/service/payment/movieTicket.d.ts +4 -4
  121. package/lib/chevre/service/payment/paymentCard.d.ts +1 -1
  122. package/lib/chevre/service/permit.d.ts +1 -1
  123. package/lib/chevre/service/report/telemetry.d.ts +7 -7
  124. package/lib/chevre/service/reserve/cancelReservation.d.ts +1 -1
  125. package/lib/chevre/service/reserve/factory.d.ts +5 -5
  126. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +1 -1
  127. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +1 -1
  128. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.d.ts +2 -2
  129. package/lib/chevre/service/task/aggregateScreeningEvent.d.ts +1 -1
  130. package/lib/chevre/service/task/aggregateUseActionsOnEvent.d.ts +1 -1
  131. package/lib/chevre/service/task/cancelMoneyTransfer.d.ts +1 -1
  132. package/lib/chevre/service/task/cancelPendingReservation.d.ts +1 -1
  133. package/lib/chevre/service/task/cancelReservation.d.ts +1 -1
  134. package/lib/chevre/service/task/importEventCapacitiesFromCOA.d.ts +1 -1
  135. package/lib/chevre/service/task/importEventsFromCOA.d.ts +1 -1
  136. package/lib/chevre/service/task/importOffersFromCOA.d.ts +1 -1
  137. package/lib/chevre/service/task/moneyTransfer.d.ts +1 -1
  138. package/lib/chevre/service/task/registerService.d.ts +1 -1
  139. package/lib/chevre/service/task/reserve.d.ts +1 -1
  140. package/lib/chevre/service/task.d.ts +2 -2
  141. package/lib/chevre/service/task.js +1 -1
  142. package/lib/chevre/service/transaction/moneyTransfer/potentialActions.d.ts +1 -1
  143. package/lib/chevre/service/transaction/moneyTransfer.d.ts +6 -6
  144. package/lib/chevre/service/transaction/moneyTransfer.js +0 -5
  145. package/lib/chevre/service/transaction/orderProgramMembership.d.ts +1 -1
  146. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +1 -1
  147. package/lib/chevre/service/transaction/placeOrder.d.ts +1 -1
  148. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.d.ts +1 -1
  149. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.d.ts +2 -2
  150. package/lib/chevre/service/transaction/placeOrderInProgress/result.d.ts +1 -1
  151. package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +8 -8
  152. package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +7 -7
  153. package/lib/chevre/service/transaction/placeOrderInProgress.js +2 -2
  154. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.d.ts +1 -1
  155. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.d.ts +1 -1
  156. package/lib/chevre/service/transaction/returnOrder/potentialActions.d.ts +1 -1
  157. package/lib/chevre/service/transaction/returnOrder.d.ts +2 -2
  158. package/lib/chevre/service/transaction/returnOrder.js +1 -1
  159. package/lib/chevre/service/transaction/validation.d.ts +2 -2
  160. package/lib/chevre/service/transaction.d.ts +2 -2
  161. package/lib/chevre/settings.d.ts +1 -1
  162. package/package.json +12 -12
  163. /package/lib/chevre/repo/mongoose/{model → schemas}/account.d.ts +0 -0
  164. /package/lib/chevre/repo/mongoose/{model → schemas}/account.js +0 -0
  165. /package/lib/chevre/repo/mongoose/{model → schemas}/accountTitle.d.ts +0 -0
  166. /package/lib/chevre/repo/mongoose/{model → schemas}/accountTitle.js +0 -0
  167. /package/lib/chevre/repo/mongoose/{model → schemas}/accountTransaction.d.ts +0 -0
  168. /package/lib/chevre/repo/mongoose/{model → schemas}/accountTransaction.js +0 -0
  169. /package/lib/chevre/repo/mongoose/{model → schemas}/accountingReport.d.ts +0 -0
  170. /package/lib/chevre/repo/mongoose/{model → schemas}/accountingReport.js +0 -0
  171. /package/lib/chevre/repo/mongoose/{model → schemas}/action.d.ts +0 -0
  172. /package/lib/chevre/repo/mongoose/{model → schemas}/action.js +0 -0
  173. /package/lib/chevre/repo/mongoose/{model → schemas}/additionalProperty.d.ts +0 -0
  174. /package/lib/chevre/repo/mongoose/{model → schemas}/additionalProperty.js +0 -0
  175. /package/lib/chevre/repo/mongoose/{model → schemas}/aggregation.d.ts +0 -0
  176. /package/lib/chevre/repo/mongoose/{model → schemas}/aggregation.js +0 -0
  177. /package/lib/chevre/repo/mongoose/{model → schemas}/assetTransaction.d.ts +0 -0
  178. /package/lib/chevre/repo/mongoose/{model → schemas}/assetTransaction.js +0 -0
  179. /package/lib/chevre/repo/mongoose/{model → schemas}/authorization.d.ts +0 -0
  180. /package/lib/chevre/repo/mongoose/{model → schemas}/authorization.js +0 -0
  181. /package/lib/chevre/repo/mongoose/{model → schemas}/categoryCode.d.ts +0 -0
  182. /package/lib/chevre/repo/mongoose/{model → schemas}/categoryCode.js +0 -0
  183. /package/lib/chevre/repo/mongoose/{model → schemas}/comments.d.ts +0 -0
  184. /package/lib/chevre/repo/mongoose/{model → schemas}/comments.js +0 -0
  185. /package/lib/chevre/repo/mongoose/{model → schemas}/creativeWork.d.ts +0 -0
  186. /package/lib/chevre/repo/mongoose/{model → schemas}/creativeWork.js +0 -0
  187. /package/lib/chevre/repo/mongoose/{model → schemas}/customer.d.ts +0 -0
  188. /package/lib/chevre/repo/mongoose/{model → schemas}/customer.js +0 -0
  189. /package/lib/chevre/repo/mongoose/{model → schemas}/emailMessages.d.ts +0 -0
  190. /package/lib/chevre/repo/mongoose/{model → schemas}/emailMessages.js +0 -0
  191. /package/lib/chevre/repo/mongoose/{model → schemas}/event.d.ts +0 -0
  192. /package/lib/chevre/repo/mongoose/{model → schemas}/member.d.ts +0 -0
  193. /package/lib/chevre/repo/mongoose/{model → schemas}/member.js +0 -0
  194. /package/lib/chevre/repo/mongoose/{model → schemas}/merchantReturnPolicy.d.ts +0 -0
  195. /package/lib/chevre/repo/mongoose/{model → schemas}/merchantReturnPolicy.js +0 -0
  196. /package/lib/chevre/repo/mongoose/{model → schemas}/offer.d.ts +0 -0
  197. /package/lib/chevre/repo/mongoose/{model → schemas}/offer.js +0 -0
  198. /package/lib/chevre/repo/mongoose/{model → schemas}/offerCatalog.d.ts +0 -0
  199. /package/lib/chevre/repo/mongoose/{model → schemas}/offerCatalog.js +0 -0
  200. /package/lib/chevre/repo/mongoose/{model → schemas}/order.d.ts +0 -0
  201. /package/lib/chevre/repo/mongoose/{model → schemas}/order.js +0 -0
  202. /package/lib/chevre/repo/mongoose/{model → schemas}/ownershipInfo.d.ts +0 -0
  203. /package/lib/chevre/repo/mongoose/{model → schemas}/ownershipInfo.js +0 -0
  204. /package/lib/chevre/repo/mongoose/{model → schemas}/place.d.ts +0 -0
  205. /package/lib/chevre/repo/mongoose/{model → schemas}/place.js +0 -0
  206. /package/lib/chevre/repo/mongoose/{model → schemas}/priceSpecification.d.ts +0 -0
  207. /package/lib/chevre/repo/mongoose/{model → schemas}/priceSpecification.js +0 -0
  208. /package/lib/chevre/repo/mongoose/{model → schemas}/product.d.ts +0 -0
  209. /package/lib/chevre/repo/mongoose/{model → schemas}/product.js +0 -0
  210. /package/lib/chevre/repo/mongoose/{model → schemas}/project.d.ts +0 -0
  211. /package/lib/chevre/repo/mongoose/{model → schemas}/project.js +0 -0
  212. /package/lib/chevre/repo/mongoose/{model → schemas}/reservation.d.ts +0 -0
  213. /package/lib/chevre/repo/mongoose/{model → schemas}/reservation.js +0 -0
  214. /package/lib/chevre/repo/mongoose/{model → schemas}/role.d.ts +0 -0
  215. /package/lib/chevre/repo/mongoose/{model → schemas}/role.js +0 -0
  216. /package/lib/chevre/repo/mongoose/{model → schemas}/seller.d.ts +0 -0
  217. /package/lib/chevre/repo/mongoose/{model → schemas}/seller.js +0 -0
  218. /package/lib/chevre/repo/mongoose/{model → schemas}/serviceOutput.d.ts +0 -0
  219. /package/lib/chevre/repo/mongoose/{model → schemas}/serviceOutput.js +0 -0
  220. /package/lib/chevre/repo/mongoose/{model → schemas}/task.d.ts +0 -0
  221. /package/lib/chevre/repo/mongoose/{model → schemas}/task.js +0 -0
  222. /package/lib/chevre/repo/mongoose/{model → schemas}/telemetry.d.ts +0 -0
  223. /package/lib/chevre/repo/mongoose/{model → schemas}/telemetry.js +0 -0
  224. /package/lib/chevre/repo/mongoose/{model → schemas}/transaction.d.ts +0 -0
  225. /package/lib/chevre/repo/mongoose/{model → schemas}/transaction.js +0 -0
  226. /package/lib/chevre/repo/mongoose/{model → schemas}/trip.d.ts +0 -0
  227. /package/lib/chevre/repo/mongoose/{model → schemas}/trip.js +0 -0
@@ -23,7 +23,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = exports.PROJECTION_MINIMIZED_EVENT = void 0;
24
24
  const uniqid = require("uniqid");
25
25
  const factory = require("../factory");
26
- const event_1 = require("./mongoose/model/event");
26
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
27
+ const event_1 = require("./mongoose/schemas/event");
28
+ const errorHandler_1 = require("../errorHandler");
27
29
  exports.PROJECTION_MINIMIZED_EVENT = {
28
30
  project: 1,
29
31
  _id: 1,
@@ -46,10 +48,13 @@ exports.PROJECTION_MINIMIZED_EVENT = {
46
48
  class MongoRepository {
47
49
  constructor(connection) {
48
50
  this.eventModel = connection.model(event_1.modelName, event_1.schema);
51
+ if (connection.get('autoIndex') === true) {
52
+ this.eventModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
53
+ }
49
54
  }
50
55
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
51
56
  static CREATE_MONGO_CONDITIONS(conditions) {
52
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35;
57
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37;
53
58
  const andConditions = [{ typeOf: { $eq: conditions.typeOf } }];
54
59
  const projectIdEq = (_b = (_a = conditions.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
55
60
  if (typeof projectIdEq === 'string') {
@@ -396,13 +401,16 @@ class MongoRepository {
396
401
  /* istanbul ignore else */
397
402
  if (Array.isArray(workPerformedIdentifierIn)) {
398
403
  andConditions.push({
399
- 'workPerformed.identifier': {
400
- $exists: true,
401
- $in: workPerformedIdentifierIn
402
- }
404
+ 'workPerformed.identifier': { $exists: true, $in: workPerformedIdentifierIn }
405
+ });
406
+ }
407
+ const workPerformedVersionEq = (_29 = (_28 = params.workPerformed) === null || _28 === void 0 ? void 0 : _28.version) === null || _29 === void 0 ? void 0 : _29.$eq;
408
+ if (typeof workPerformedVersionEq === 'string') {
409
+ andConditions.push({
410
+ 'workPerformed.version': { $exists: true, $eq: workPerformedVersionEq }
403
411
  });
404
412
  }
405
- const videoFormatTypeOfEq = (_29 = (_28 = params.videoFormat) === null || _28 === void 0 ? void 0 : _28.typeOf) === null || _29 === void 0 ? void 0 : _29.$eq;
413
+ const videoFormatTypeOfEq = (_31 = (_30 = params.videoFormat) === null || _30 === void 0 ? void 0 : _30.typeOf) === null || _31 === void 0 ? void 0 : _31.$eq;
406
414
  if (typeof videoFormatTypeOfEq === 'string') {
407
415
  andConditions.push({
408
416
  'videoFormat.typeOf': {
@@ -411,7 +419,7 @@ class MongoRepository {
411
419
  }
412
420
  });
413
421
  }
414
- const videoFormatTypeOfIn = (_31 = (_30 = params.videoFormat) === null || _30 === void 0 ? void 0 : _30.typeOf) === null || _31 === void 0 ? void 0 : _31.$in;
422
+ const videoFormatTypeOfIn = (_33 = (_32 = params.videoFormat) === null || _32 === void 0 ? void 0 : _32.typeOf) === null || _33 === void 0 ? void 0 : _33.$in;
415
423
  if (Array.isArray(videoFormatTypeOfIn)) {
416
424
  andConditions.push({
417
425
  'videoFormat.typeOf': {
@@ -420,7 +428,7 @@ class MongoRepository {
420
428
  }
421
429
  });
422
430
  }
423
- const soundFormatTypeOfEq = (_33 = (_32 = params.soundFormat) === null || _32 === void 0 ? void 0 : _32.typeOf) === null || _33 === void 0 ? void 0 : _33.$eq;
431
+ const soundFormatTypeOfEq = (_35 = (_34 = params.soundFormat) === null || _34 === void 0 ? void 0 : _34.typeOf) === null || _35 === void 0 ? void 0 : _35.$eq;
424
432
  if (typeof soundFormatTypeOfEq === 'string') {
425
433
  andConditions.push({
426
434
  'soundFormat.typeOf': {
@@ -429,7 +437,7 @@ class MongoRepository {
429
437
  }
430
438
  });
431
439
  }
432
- const soundFormatTypeOfIn = (_35 = (_34 = params.soundFormat) === null || _34 === void 0 ? void 0 : _34.typeOf) === null || _35 === void 0 ? void 0 : _35.$in;
440
+ const soundFormatTypeOfIn = (_37 = (_36 = params.soundFormat) === null || _36 === void 0 ? void 0 : _36.typeOf) === null || _37 === void 0 ? void 0 : _37.$in;
433
441
  if (Array.isArray(soundFormatTypeOfIn)) {
434
442
  andConditions.push({
435
443
  'soundFormat.typeOf': {
@@ -448,9 +456,20 @@ class MongoRepository {
448
456
  */
449
457
  createMany(params) {
450
458
  return __awaiter(this, void 0, void 0, function* () {
451
- const docs = yield this.eventModel.insertMany(params.attributes.map((p) => {
452
- return Object.assign({ _id: uniqid() }, p);
453
- }));
459
+ let docs;
460
+ try {
461
+ docs = yield this.eventModel.insertMany(params.attributes.map((p) => {
462
+ return Object.assign({ _id: uniqid() }, p);
463
+ }));
464
+ }
465
+ catch (error) {
466
+ if ((0, errorHandler_1.isMongoError)(error)) {
467
+ if (error.code === errorHandler_1.MongoErrorCode.DuplicateKey) {
468
+ throw new factory.errors.AlreadyInUse(factory.eventType.ScreeningEventSeries, ['workPerformed.version']);
469
+ }
470
+ }
471
+ throw error;
472
+ }
454
473
  if (params.expectsNoContent) {
455
474
  return;
456
475
  }
@@ -478,6 +497,8 @@ class MongoRepository {
478
497
  updateOne: {
479
498
  filter: {
480
499
  typeOf: creatingEventParams.attributes.typeOf,
500
+ // 追加特性をキーにした冪等イベント作成時のfilterにproject.idを追加(2023-04-06~)
501
+ 'project.id': { $eq: creatingEventParams.attributes.project.id },
481
502
  // 追加特性をキーに更新
482
503
  additionalProperty: {
483
504
  $exists: true,
@@ -499,6 +520,52 @@ class MongoRepository {
499
520
  }
500
521
  });
501
522
  }
523
+ /**
524
+ * コンテンツ+バージョンをキーにして、なければ作成する(複数対応)
525
+ */
526
+ createScreeningEventSeriesIfNotExistByWorkPerformed(params) {
527
+ return __awaiter(this, void 0, void 0, function* () {
528
+ const bulkWriteOps = [];
529
+ if (Array.isArray(params)) {
530
+ params.forEach((creatingEventParams) => {
531
+ const version = creatingEventParams.attributes.workPerformed.version;
532
+ if (typeof version !== 'string') {
533
+ throw new factory.errors.ArgumentNull('workPerformed.version');
534
+ }
535
+ const setOnInsertFields = creatingEventParams.attributes;
536
+ bulkWriteOps.push({
537
+ updateOne: {
538
+ filter: {
539
+ typeOf: creatingEventParams.attributes.typeOf,
540
+ 'project.id': { $eq: creatingEventParams.attributes.project.id },
541
+ 'location.branchCode': {
542
+ $exists: true,
543
+ $eq: creatingEventParams.attributes.location.branchCode
544
+ },
545
+ 'workPerformed.identifier': {
546
+ $exists: true,
547
+ $eq: creatingEventParams.attributes.workPerformed.identifier
548
+ },
549
+ 'workPerformed.version': {
550
+ $exists: true,
551
+ $eq: version
552
+ }
553
+ },
554
+ update: {
555
+ $setOnInsert: Object.assign(Object.assign({}, setOnInsertFields), { _id: uniqid() })
556
+ // 変更可能な属性のみ上書き
557
+ // $set: {}
558
+ },
559
+ upsert: true
560
+ }
561
+ });
562
+ });
563
+ }
564
+ if (bulkWriteOps.length > 0) {
565
+ return this.eventModel.bulkWrite(bulkWriteOps, { ordered: false });
566
+ }
567
+ });
568
+ }
502
569
  /**
503
570
  * イベント部分更新
504
571
  */
@@ -525,21 +592,31 @@ class MongoRepository {
525
592
  save(params) {
526
593
  return __awaiter(this, void 0, void 0, function* () {
527
594
  let doc;
528
- if (params.id === undefined) {
529
- const id = uniqid();
530
- doc = yield this.eventModel.create(Object.assign(Object.assign({}, params.attributes), { _id: id }));
595
+ try {
596
+ if (params.id === undefined) {
597
+ const id = uniqid();
598
+ doc = yield this.eventModel.create(Object.assign(Object.assign({}, params.attributes), { _id: id }));
599
+ }
600
+ else {
601
+ const upsert = params.upsert === true;
602
+ // 上書き禁止属性を除外(2022-08-24~)
603
+ const _a = params.attributes, { identifier, project, typeOf } = _a, updateFields = __rest(_a, ["identifier", "project", "typeOf"]);
604
+ doc = yield this.eventModel.findOneAndUpdate({
605
+ _id: params.id,
606
+ typeOf: params.attributes.typeOf
607
+ }, Object.assign({ $setOnInsert: Object.assign(Object.assign({ typeOf: params.attributes.typeOf }, (params.attributes.project !== undefined)
608
+ ? { project: params.attributes.project } : undefined), (params.attributes.identifier !== undefined)
609
+ ? { identifier: params.attributes.identifier } : undefined), $set: updateFields }, (params.$unset !== undefined) ? { $unset: params.$unset } : undefined), { upsert, new: true })
610
+ .exec();
611
+ }
531
612
  }
532
- else {
533
- const upsert = params.upsert === true;
534
- // 上書き禁止属性を除外(2022-08-24~)
535
- const _a = params.attributes, { identifier, project, typeOf } = _a, updateFields = __rest(_a, ["identifier", "project", "typeOf"]);
536
- doc = yield this.eventModel.findOneAndUpdate({
537
- _id: params.id,
538
- typeOf: params.attributes.typeOf
539
- }, Object.assign({ $setOnInsert: Object.assign(Object.assign({ typeOf: params.attributes.typeOf }, (params.attributes.project !== undefined)
540
- ? { project: params.attributes.project } : undefined), (params.attributes.identifier !== undefined)
541
- ? { identifier: params.attributes.identifier } : undefined), $set: updateFields }, (params.$unset !== undefined) ? { $unset: params.$unset } : undefined), { upsert, new: true })
542
- .exec();
613
+ catch (error) {
614
+ if ((0, errorHandler_1.isMongoError)(error)) {
615
+ if (error.code === errorHandler_1.MongoErrorCode.DuplicateKey) {
616
+ throw new factory.errors.AlreadyInUse(factory.eventType.ScreeningEventSeries, ['workPerformed.version']);
617
+ }
618
+ }
619
+ throw error;
543
620
  }
544
621
  if (doc === null) {
545
622
  throw new factory.errors.NotFound(this.eventModel.modelName);
@@ -251,5 +251,5 @@ class RedisRepository {
251
251
  });
252
252
  }
253
253
  }
254
- exports.RedisRepository = RedisRepository;
255
254
  RedisRepository.KEY_PREFIX = 'chevre:itemAvailability:screeningEvent';
255
+ exports.RedisRepository = RedisRepository;
@@ -11,13 +11,17 @@ 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 factory = require("../factory");
14
- const member_1 = require("./mongoose/model/member");
14
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
15
+ const member_1 = require("./mongoose/schemas/member");
15
16
  /**
16
17
  * IAMメンバーリポジトリ
17
18
  */
18
19
  class MongoRepository {
19
20
  constructor(connection) {
20
21
  this.memberModel = connection.model(member_1.modelName, member_1.schema);
22
+ if (connection.get('autoIndex') === true) {
23
+ this.memberModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
24
+ }
21
25
  }
22
26
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
23
27
  static CREATE_MONGO_CONDITIONS(params) {
@@ -23,9 +23,7 @@
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
25
  import { Connection } from 'mongoose';
26
- import { modelName } from './mongoose/model/merchantReturnPolicy';
27
26
  import * as factory from '../factory';
28
- export { modelName };
29
27
  /**
30
28
  * 返品ポリシーリポジトリ
31
29
  */
@@ -20,9 +20,9 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  return t;
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.MongoRepository = exports.modelName = void 0;
24
- const merchantReturnPolicy_1 = require("./mongoose/model/merchantReturnPolicy");
25
- Object.defineProperty(exports, "modelName", { enumerable: true, get: function () { return merchantReturnPolicy_1.modelName; } });
23
+ exports.MongoRepository = void 0;
24
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
25
+ const merchantReturnPolicy_1 = require("./mongoose/schemas/merchantReturnPolicy");
26
26
  const factory = require("../factory");
27
27
  /**
28
28
  * 返品ポリシーリポジトリ
@@ -30,6 +30,9 @@ const factory = require("../factory");
30
30
  class MongoRepository {
31
31
  constructor(connection) {
32
32
  this.merchantReturnPolicyModel = connection.model(merchantReturnPolicy_1.modelName, merchantReturnPolicy_1.schema);
33
+ if (connection.get('autoIndex') === true) {
34
+ this.merchantReturnPolicyModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
35
+ }
33
36
  }
34
37
  // tslint:disable-next-line:max-func-body-length
35
38
  static CREATE_MONGO_CONDITIONS(params) {
@@ -0,0 +1,2 @@
1
+ export declare const INDEX_EVENT = "index";
2
+ export declare function onIndexCreated(error: any): void;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.onIndexCreated = exports.INDEX_EVENT = void 0;
4
+ exports.INDEX_EVENT = 'index';
5
+ function onIndexCreated(error) {
6
+ if (error !== undefined) {
7
+ // tslint:disable-next-line:no-console
8
+ console.error('index event emitted.', error);
9
+ }
10
+ }
11
+ exports.onIndexCreated = onIndexCreated;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const factory = require("../../../factory");
6
7
  const modelName = 'Event';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -121,6 +122,28 @@ schema.index({ 'workPerformed.identifier': 1, startDate: 1 }, {
121
122
  'workPerformed.identifier': { $exists: true }
122
123
  }
123
124
  });
125
+ schema.index({ 'workPerformed.version': 1, startDate: 1 }, {
126
+ name: 'searchByWorkPerformedVersion',
127
+ partialFilterExpression: {
128
+ 'workPerformed.version': { $exists: true }
129
+ }
130
+ });
131
+ // コンテンツ+バージョンに対するuniqueness
132
+ schema.index({
133
+ 'project.id': 1,
134
+ 'location.branchCode': 1,
135
+ 'workPerformed.identifier': 1,
136
+ 'workPerformed.version': 1
137
+ }, {
138
+ unique: true,
139
+ name: 'uniqueScreeningEventSeries',
140
+ partialFilterExpression: {
141
+ typeOf: factory.eventType.ScreeningEventSeries,
142
+ 'location.branchCode': { $exists: true },
143
+ 'workPerformed.identifier': { $exists: true },
144
+ 'workPerformed.version': { $exists: true }
145
+ }
146
+ });
124
147
  schema.index({ startDate: 1 }, { name: 'searchByStartDate' });
125
148
  schema.index({ endDate: 1, startDate: 1 }, { name: 'searchByEndDate' });
126
149
  schema.index({ 'hasOfferCatalog.id': 1, startDate: 1 }, {
@@ -23,8 +23,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = void 0;
24
24
  const uniqid = require("uniqid");
25
25
  const factory = require("../factory");
26
- const offer_1 = require("./mongoose/model/offer");
27
- const offerCatalog_1 = require("./mongoose/model/offerCatalog");
26
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
27
+ const offer_1 = require("./mongoose/schemas/offer");
28
+ const offerCatalog_1 = require("./mongoose/schemas/offerCatalog");
28
29
  /**
29
30
  * オファーリポジトリ
30
31
  */
@@ -32,6 +33,10 @@ class MongoRepository {
32
33
  constructor(connection) {
33
34
  this.offerModel = connection.model(offer_1.modelName, offer_1.schema);
34
35
  this.offerCatalogModel = connection.model(offerCatalog_1.modelName, offerCatalog_1.schema);
36
+ if (connection.get('autoIndex') === true) {
37
+ this.offerModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
38
+ this.offerCatalogModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
39
+ }
35
40
  }
36
41
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
37
42
  static CREATE_OFFER_MONGO_CONDITIONS(params) {
@@ -23,13 +23,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = void 0;
24
24
  const uniqid = require("uniqid");
25
25
  const factory = require("../factory");
26
- const offerCatalog_1 = require("./mongoose/model/offerCatalog");
26
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
27
+ const offerCatalog_1 = require("./mongoose/schemas/offerCatalog");
27
28
  /**
28
29
  * オファーカタログリポジトリ
29
30
  */
30
31
  class MongoRepository {
31
32
  constructor(connection) {
32
33
  this.offerCatalogModel = connection.model(offerCatalog_1.modelName, offerCatalog_1.schema);
34
+ if (connection.get('autoIndex') === true) {
35
+ this.offerCatalogModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
36
+ }
33
37
  }
34
38
  // tslint:disable-next-line:max-func-body-length
35
39
  static CREATE_MONGO_CONDITIONS(params) {
@@ -1,7 +1,5 @@
1
1
  import { Connection } from 'mongoose';
2
2
  import * as factory from '../factory';
3
- import { modelName } from './mongoose/model/order';
4
- export { modelName };
5
3
  /**
6
4
  * 注文リポジトリ
7
5
  */
@@ -9,10 +9,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.MongoRepository = exports.modelName = void 0;
12
+ exports.MongoRepository = void 0;
13
13
  const factory = require("../factory");
14
- const order_1 = require("./mongoose/model/order");
15
- Object.defineProperty(exports, "modelName", { enumerable: true, get: function () { return order_1.modelName; } });
14
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
15
+ const order_1 = require("./mongoose/schemas/order");
16
16
  const errorHandler_1 = require("../errorHandler");
17
17
  const order_2 = require("../factory/order");
18
18
  /**
@@ -21,6 +21,9 @@ const order_2 = require("../factory/order");
21
21
  class MongoRepository {
22
22
  constructor(connection) {
23
23
  this.orderModel = connection.model(order_1.modelName, order_1.schema);
24
+ if (connection.get('autoIndex') === true) {
25
+ this.orderModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
26
+ }
24
27
  }
25
28
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
26
29
  static CREATE_MONGO_CONDITIONS(params) {
@@ -678,7 +681,7 @@ class MongoRepository {
678
681
  }
679
682
  catch (error) {
680
683
  let throwsError = true;
681
- if (error.name === 'MongoError') {
684
+ if ((0, errorHandler_1.isMongoError)(error)) {
682
685
  // すでにorderNumberが存在する場合ok
683
686
  if (error.code === errorHandler_1.MongoErrorCode.DuplicateKey) {
684
687
  throwsError = false;
@@ -86,5 +86,5 @@ class RedisRepository {
86
86
  });
87
87
  }
88
88
  }
89
- exports.RedisRepository = RedisRepository;
90
89
  RedisRepository.REDIS_KEY_PREFIX = 'cinerino:orderNumber';
90
+ exports.RedisRepository = RedisRepository;
@@ -23,10 +23,8 @@
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
25
  import { Connection } from 'mongoose';
26
- import { modelName } from './mongoose/model/ownershipInfo';
27
26
  import * as factory from '../factory';
28
- export declare type IOwnershipInfo = factory.ownershipInfo.IOwnershipInfo<factory.ownershipInfo.IGood>;
29
- export { modelName };
27
+ export type IOwnershipInfo = factory.ownershipInfo.IOwnershipInfo<factory.ownershipInfo.IGood>;
30
28
  /**
31
29
  * 所有権リポジトリ
32
30
  */
@@ -9,10 +9,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.MongoRepository = exports.modelName = void 0;
12
+ exports.MongoRepository = void 0;
13
13
  const uuid = require("uuid");
14
- const ownershipInfo_1 = require("./mongoose/model/ownershipInfo");
15
- Object.defineProperty(exports, "modelName", { enumerable: true, get: function () { return ownershipInfo_1.modelName; } });
14
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
15
+ const ownershipInfo_1 = require("./mongoose/schemas/ownershipInfo");
16
16
  const errorHandler_1 = require("../errorHandler");
17
17
  const factory = require("../factory");
18
18
  /**
@@ -21,6 +21,9 @@ const factory = require("../factory");
21
21
  class MongoRepository {
22
22
  constructor(connection) {
23
23
  this.ownershipInfoModel = connection.model(ownershipInfo_1.modelName, ownershipInfo_1.schema);
24
+ if (connection.get('autoIndex') === true) {
25
+ this.ownershipInfoModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
26
+ }
24
27
  }
25
28
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
26
29
  static CREATE_MONGO_CONDITIONS(params) {
@@ -242,7 +245,7 @@ class MongoRepository {
242
245
  .exec();
243
246
  }
244
247
  catch (error) {
245
- if (error.name === 'MongoError') {
248
+ if ((0, errorHandler_1.isMongoError)(error)) {
246
249
  // すでに所有権が存在する場合ok
247
250
  if (error.code === errorHandler_1.MongoErrorCode.DuplicateKey) {
248
251
  duplicate = true;
@@ -1,8 +1,8 @@
1
1
  import * as GMO from '@motionpicture/gmo-service';
2
2
  import * as factory from '../../factory';
3
- export declare type IUncheckedCardRaw = factory.paymentMethod.paymentCard.creditCard.IUncheckedCardRaw;
4
- export declare type IUncheckedCardTokenized = factory.paymentMethod.paymentCard.creditCard.IUncheckedCardTokenized;
5
- export declare type ISearchCardResult = GMO.factory.card.ISearchCardResult;
3
+ export type IUncheckedCardRaw = factory.paymentMethod.paymentCard.creditCard.IUncheckedCardRaw;
4
+ export type IUncheckedCardTokenized = factory.paymentMethod.paymentCard.creditCard.IUncheckedCardTokenized;
5
+ export type ISearchCardResult = GMO.factory.card.ISearchCardResult;
6
6
  export interface IOptions {
7
7
  /**
8
8
  * GMOサイトID
@@ -10,7 +10,8 @@ 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 serviceOutput_1 = require("./mongoose/model/serviceOutput");
13
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
14
+ const serviceOutput_1 = require("./mongoose/schemas/serviceOutput");
14
15
  const factory = require("../factory");
15
16
  /**
16
17
  * 許可証リポジトリ
@@ -18,6 +19,9 @@ const factory = require("../factory");
18
19
  class MongoRepository {
19
20
  constructor(connection) {
20
21
  this.serviceOutputModel = connection.model(serviceOutput_1.modelName, serviceOutput_1.schema);
22
+ if (connection.get('autoIndex') === true) {
23
+ this.serviceOutputModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
24
+ }
21
25
  }
22
26
  findByIdentifier(params, projection) {
23
27
  var _a, _b;
@@ -1,7 +1,7 @@
1
1
  import * as AWS from 'aws-sdk';
2
2
  import * as factory from '../factory';
3
- export declare type AttributeListType = AWS.CognitoIdentityServiceProvider.AttributeListType;
4
- export declare type IPerson = factory.person.IPerson;
3
+ export type AttributeListType = AWS.CognitoIdentityServiceProvider.AttributeListType;
4
+ export type IPerson = factory.person.IPerson;
5
5
  /**
6
6
  * 会員リポジトリ
7
7
  */
@@ -24,8 +24,8 @@
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
25
  import { Connection } from 'mongoose';
26
26
  import * as factory from '../factory';
27
- declare type IScreeningRoomSectionWithoutContainsPlace = Omit<factory.place.screeningRoomSection.IPlace, 'containsPlace'>;
28
- export declare type IScreeningRoomFoundByBranchCode = Pick<factory.place.screeningRoom.IPlace, 'typeOf' | 'branchCode' | 'name' | 'containsPlace'>;
27
+ type IScreeningRoomSectionWithoutContainsPlace = Omit<factory.place.screeningRoomSection.IPlace, 'containsPlace'>;
28
+ export type IScreeningRoomFoundByBranchCode = Pick<factory.place.screeningRoom.IPlace, 'typeOf' | 'branchCode' | 'name' | 'containsPlace'>;
29
29
  /**
30
30
  * 施設リポジトリ
31
31
  */
@@ -22,7 +22,8 @@ var __rest = (this && this.__rest) || function (s, e) {
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = void 0;
24
24
  const mongoose_1 = require("mongoose");
25
- const place_1 = require("./mongoose/model/place");
25
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
26
+ const place_1 = require("./mongoose/schemas/place");
26
27
  const factory = require("../factory");
27
28
  /**
28
29
  * 施設リポジトリ
@@ -30,6 +31,9 @@ const factory = require("../factory");
30
31
  class MongoRepository {
31
32
  constructor(connection) {
32
33
  this.placeModel = connection.model(place_1.modelName, place_1.schema);
34
+ if (connection.get('autoIndex') === true) {
35
+ this.placeModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
36
+ }
33
37
  }
34
38
  // tslint:disable-next-line:max-func-body-length
35
39
  static CREATE_BUS_STOP_MONGO_CONDITIONS(params) {
@@ -22,13 +22,17 @@ var __rest = (this && this.__rest) || function (s, e) {
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = void 0;
24
24
  const factory = require("../factory");
25
- const priceSpecification_1 = require("./mongoose/model/priceSpecification");
25
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
26
+ const priceSpecification_1 = require("./mongoose/schemas/priceSpecification");
26
27
  /**
27
28
  * 価格仕様リポジトリ
28
29
  */
29
30
  class MongoRepository {
30
31
  constructor(connection) {
31
32
  this.priceSpecificationModel = connection.model(priceSpecification_1.modelName, priceSpecification_1.schema);
33
+ if (connection.get('autoIndex') === true) {
34
+ this.priceSpecificationModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
35
+ }
32
36
  }
33
37
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
34
38
  static CREATE_MONGO_CONDITIONS(params) {
@@ -24,7 +24,7 @@
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
25
  import { Connection } from 'mongoose';
26
26
  import * as factory from '../factory';
27
- export declare type IProduct = factory.product.IProduct | factory.service.paymentService.IService;
27
+ export type IProduct = factory.product.IProduct | factory.service.paymentService.IService;
28
28
  /**
29
29
  * プロダクトリポジトリ
30
30
  */
@@ -21,7 +21,8 @@ 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 product_1 = require("./mongoose/model/product");
24
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
25
+ const product_1 = require("./mongoose/schemas/product");
25
26
  const factory = require("../factory");
26
27
  /**
27
28
  * プロダクトリポジトリ
@@ -29,6 +30,9 @@ const factory = require("../factory");
29
30
  class MongoRepository {
30
31
  constructor(connection) {
31
32
  this.productModel = connection.model(product_1.modelName, product_1.schema);
33
+ if (connection.get('autoIndex') === true) {
34
+ this.productModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
35
+ }
32
36
  }
33
37
  // tslint:disable-next-line:max-func-body-length
34
38
  static CREATE_MONGO_CONDITIONS(params) {
@@ -10,7 +10,8 @@ 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 project_1 = require("./mongoose/model/project");
13
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
14
+ const project_1 = require("./mongoose/schemas/project");
14
15
  const factory = require("../factory");
15
16
  /**
16
17
  * プロジェクトリポジトリ
@@ -18,6 +19,9 @@ const factory = require("../factory");
18
19
  class MongoRepository {
19
20
  constructor(connection) {
20
21
  this.projectModel = connection.model(project_1.modelName, project_1.schema);
22
+ if (connection.get('autoIndex') === true) {
23
+ this.projectModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
24
+ }
21
25
  }
22
26
  static CREATE_MONGO_CONDITIONS(params) {
23
27
  // MongoDB検索条件
@@ -131,5 +131,5 @@ class RedisRepository {
131
131
  });
132
132
  }
133
133
  }
134
- exports.RedisRepository = RedisRepository;
135
134
  RedisRepository.KEY_PREFIX = 'chevre:rateLimit:offer';
135
+ exports.RedisRepository = RedisRepository;
@@ -4,7 +4,7 @@ export interface IUpdatePartiallyParams {
4
4
  additionalTicketText?: string;
5
5
  'reservedTicket.dateUsed'?: Date;
6
6
  }
7
- export declare type ICancelResult = UpdateWriteOpResult;
7
+ export type ICancelResult = UpdateWriteOpResult;
8
8
  /**
9
9
  * 予約リポジトリ
10
10
  */