@chevre/domain 21.2.0-alpha.99 → 21.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/example/src/chevre/aggregateEventReservation.ts +1 -1
  2. package/example/src/chevre/aggregateSellerPaymentAccepted.ts +27 -0
  3. package/example/src/chevre/aggregation/aggregateSystem.ts +53 -22
  4. package/example/src/chevre/countDelayedTasks.ts +7 -2
  5. package/example/src/chevre/createManyEventsIfNotExist.ts +199 -46
  6. package/example/src/chevre/findScreeningRoomsByBranchCode.ts +4 -3
  7. package/example/src/chevre/giveUpStartDatePassedCertainPeriod.ts +56 -0
  8. package/example/src/chevre/lockStockHolder.ts +5 -2
  9. package/example/src/chevre/migrateCategoryCodeAdditionalProperties.ts +116 -0
  10. package/example/src/chevre/migrateScreeningEventSeriesVersion.ts +79 -0
  11. package/example/src/chevre/processRegisterMembership.ts +8 -4
  12. package/example/src/chevre/processRegisterPaymentCard.ts +8 -4
  13. package/example/src/chevre/processReserve.ts +1 -1
  14. package/example/src/chevre/searchAbortedTasks.ts +4 -6
  15. package/example/src/chevre/searchEventSeats.ts +5 -2
  16. package/example/src/chevre/searchHoldReservations.ts +38 -0
  17. package/example/src/chevre/searchPermissions.ts +54 -0
  18. package/example/src/chevre/searchScreeningRooms.ts +35 -0
  19. package/example/src/chevre/sendEmailMessage.ts +1 -2
  20. package/example/src/chevre/syncScreeningRooms.ts +22 -0
  21. package/example/src/chevre/syncScreeningRoomsAll.ts +44 -0
  22. package/example/src/chevre/unsetContainsInPlaceFromMovieTheater.ts +41 -0
  23. package/lib/chevre/factory/order.d.ts +4 -1
  24. package/lib/chevre/factory/order.js +19 -6
  25. package/lib/chevre/repo/account.js +3 -2
  26. package/lib/chevre/repo/accountTransaction.js +2 -1
  27. package/lib/chevre/repo/accountingReport.d.ts +1 -3
  28. package/lib/chevre/repo/action.d.ts +50 -1
  29. package/lib/chevre/repo/action.js +53 -2
  30. package/lib/chevre/repo/additionalProperty.js +2 -1
  31. package/lib/chevre/repo/aggregation.d.ts +3 -0
  32. package/lib/chevre/repo/aggregation.js +3 -0
  33. package/lib/chevre/repo/assetTransaction.js +6 -5
  34. package/lib/chevre/repo/categoryCode.d.ts +1 -1
  35. package/lib/chevre/repo/categoryCode.js +37 -25
  36. package/lib/chevre/repo/code.js +3 -2
  37. package/lib/chevre/repo/comment.js +2 -1
  38. package/lib/chevre/repo/creativeWork.d.ts +1 -1
  39. package/lib/chevre/repo/creativeWork.js +35 -12
  40. package/lib/chevre/repo/customer.js +2 -1
  41. package/lib/chevre/repo/emailMessage.js +2 -1
  42. package/lib/chevre/repo/event.d.ts +30 -2
  43. package/lib/chevre/repo/event.js +87 -36
  44. package/lib/chevre/repo/member.d.ts +14 -0
  45. package/lib/chevre/repo/member.js +31 -3
  46. package/lib/chevre/repo/merchantReturnPolicy.js +2 -1
  47. package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +3 -3
  48. package/lib/chevre/repo/mongoose/schemas/holdReservation.d.ts +75 -0
  49. package/lib/chevre/repo/mongoose/schemas/holdReservation.js +93 -0
  50. package/lib/chevre/repo/mongoose/schemas/offer.d.ts +3 -3
  51. package/lib/chevre/repo/mongoose/schemas/order.d.ts +21 -21
  52. package/lib/chevre/repo/mongoose/schemas/place.d.ts +6 -0
  53. package/lib/chevre/repo/mongoose/schemas/place.js +16 -1
  54. package/lib/chevre/repo/mongoose/schemas/product.js +6 -0
  55. package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +9 -9
  56. package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +3 -3
  57. package/lib/chevre/repo/offer.js +3 -2
  58. package/lib/chevre/repo/offerCatalog.js +0 -27
  59. package/lib/chevre/repo/offerItemCondition.js +2 -1
  60. package/lib/chevre/repo/order.js +8 -7
  61. package/lib/chevre/repo/ownershipInfo.js +2 -7
  62. package/lib/chevre/repo/paymentServiceProvider.d.ts +65 -0
  63. package/lib/chevre/repo/paymentServiceProvider.js +156 -0
  64. package/lib/chevre/repo/place.d.ts +203 -27
  65. package/lib/chevre/repo/place.js +1726 -694
  66. package/lib/chevre/repo/priceSpecification.js +3 -2
  67. package/lib/chevre/repo/product.d.ts +5 -3
  68. package/lib/chevre/repo/product.js +92 -5
  69. package/lib/chevre/repo/project.js +2 -1
  70. package/lib/chevre/repo/reservation.d.ts +9 -1
  71. package/lib/chevre/repo/reservation.js +29 -20
  72. package/lib/chevre/repo/role.d.ts +7 -0
  73. package/lib/chevre/repo/role.js +39 -2
  74. package/lib/chevre/repo/seller.d.ts +21 -1
  75. package/lib/chevre/repo/seller.js +59 -4
  76. package/lib/chevre/repo/serviceOutput.js +2 -1
  77. package/lib/chevre/repo/stockHolder.d.ts +143 -7
  78. package/lib/chevre/repo/stockHolder.js +622 -104
  79. package/lib/chevre/repo/task.d.ts +12 -1
  80. package/lib/chevre/repo/task.js +17 -7
  81. package/lib/chevre/repo/transaction.js +6 -5
  82. package/lib/chevre/repo/trip.js +2 -1
  83. package/lib/chevre/repository.d.ts +6 -0
  84. package/lib/chevre/repository.js +8 -1
  85. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +18 -8
  86. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +19 -8
  87. package/lib/chevre/service/aggregation/system.d.ts +43 -1
  88. package/lib/chevre/service/aggregation/system.js +112 -2
  89. package/lib/chevre/service/assetTransaction/moneyTransfer.js +1 -1
  90. package/lib/chevre/service/assetTransaction/pay/account/validation.js +1 -1
  91. package/lib/chevre/service/assetTransaction/pay.js +2 -2
  92. package/lib/chevre/service/assetTransaction/refund.js +1 -1
  93. package/lib/chevre/service/assetTransaction/reserve.js +10 -3
  94. package/lib/chevre/service/event.d.ts +3 -0
  95. package/lib/chevre/service/event.js +52 -21
  96. package/lib/chevre/service/iam.d.ts +6 -2
  97. package/lib/chevre/service/iam.js +23 -9
  98. package/lib/chevre/service/offer/event/factory.js +22 -13
  99. package/lib/chevre/service/offer/event/importFromCOA.js +2 -2
  100. package/lib/chevre/service/offer/eventServiceByCOA/factory.js +15 -8
  101. package/lib/chevre/service/offer/eventServiceByCOA.js +7 -9
  102. package/lib/chevre/service/offer/product/factory.js +13 -6
  103. package/lib/chevre/service/offer/product.js +2 -2
  104. package/lib/chevre/service/offer.d.ts +16 -8
  105. package/lib/chevre/service/offer.js +71 -8
  106. package/lib/chevre/service/order/createAccountingReportIfNotExist.js +31 -17
  107. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +1 -1
  108. package/lib/chevre/service/order/onOrderStatusChanged.js +2 -2
  109. package/lib/chevre/service/order/placeOrder.js +4 -4
  110. package/lib/chevre/service/order/returnOrder.js +1 -1
  111. package/lib/chevre/service/order/sendOrder.js +3 -3
  112. package/lib/chevre/service/payment/any/onPaymentStatusChanged.js +4 -6
  113. package/lib/chevre/service/payment/any/onRefund.js +46 -42
  114. package/lib/chevre/service/payment/creditCard.js +2 -2
  115. package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +1 -1
  116. package/lib/chevre/service/payment/movieTicket/factory.d.ts +1 -1
  117. package/lib/chevre/service/payment/movieTicket/getCredentials.d.ts +1 -1
  118. package/lib/chevre/service/payment/movieTicket/getCredentials.js +1 -1
  119. package/lib/chevre/service/payment/movieTicket/validation.js +16 -9
  120. package/lib/chevre/service/payment/movieTicket.js +2 -2
  121. package/lib/chevre/service/reserve/cancelReservation.js +15 -3
  122. package/lib/chevre/service/reserve/confirmReservation.js +19 -11
  123. package/lib/chevre/service/task/aggregateScreeningEvent.js +1 -1
  124. package/lib/chevre/service/task/cancelPendingReservation.js +1 -1
  125. package/lib/chevre/service/task/cancelReservation.js +1 -1
  126. package/lib/chevre/service/task/deleteTransaction.js +2 -0
  127. package/lib/chevre/service/task/onEventChanged.d.ts +7 -0
  128. package/lib/chevre/service/task/onEventChanged.js +29 -0
  129. package/lib/chevre/service/task/onResourceUpdated.d.ts +7 -0
  130. package/lib/chevre/service/task/onResourceUpdated.js +396 -0
  131. package/lib/chevre/service/task/syncScreeningRooms.d.ts +7 -0
  132. package/lib/chevre/service/task/syncScreeningRooms.js +24 -0
  133. package/lib/chevre/service/task/voidReserveTransaction.js +1 -1
  134. package/lib/chevre/service/transaction/deleteTransaction.d.ts +2 -0
  135. package/lib/chevre/service/transaction/deleteTransaction.js +129 -1
  136. package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.js +1 -0
  137. package/lib/chevre/service/transaction/moneyTransfer/factory.d.ts +1 -1
  138. package/lib/chevre/service/transaction/moneyTransfer.js +1 -1
  139. package/lib/chevre/service/transaction/orderProgramMembership/findCreditCard.js +1 -1
  140. package/lib/chevre/service/transaction/orderProgramMembership/findPaymentCardPermit.js +1 -1
  141. package/lib/chevre/service/transaction/orderProgramMembership.js +1 -1
  142. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +1 -0
  143. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/givePointAward.js +1 -1
  144. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +1 -1
  145. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +1 -1
  146. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/sendEmailMessage.js +4 -4
  147. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.js +3 -4
  148. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +8 -12
  149. package/lib/chevre/service/transaction/placeOrderInProgress.js +6 -4
  150. package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +1 -0
  151. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.js +2 -2
  152. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +5 -5
  153. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.js +2 -2
  154. package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +3 -3
  155. package/lib/chevre/service/transaction/returnOrder/potentialActions.js +1 -1
  156. package/lib/chevre/service/transaction/returnOrder.js +3 -1
  157. package/lib/chevre/settings.d.ts +11 -0
  158. package/lib/chevre/settings.js +44 -2
  159. package/package.json +3 -3
  160. package/example/src/chevre/eventCatalog2eventService.ts +0 -123
  161. package/example/src/chevre/migrateOrderAdditionalProperties.ts +0 -85
  162. package/example/src/chevre/migrateStockHolderKeys.ts +0 -89
@@ -1,3 +1,27 @@
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" />
1
25
  import { Connection } from 'mongoose';
2
26
  import * as factory from '../factory';
3
27
  export type IAction<T extends factory.actionType> = T extends factory.actionType.OrderAction ? factory.action.trade.order.IAction : T extends factory.actionType.AuthorizeAction ? factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>> : factory.action.IAction<factory.action.IAttributes<T, any, any>>;
@@ -61,6 +85,18 @@ export declare class MongoRepository {
61
85
  id: string;
62
86
  error: any;
63
87
  }): Promise<IAction<T>>;
88
+ /**
89
+ * 一定期間ActiveActionStatusのアクションをFailedActionStatusにする
90
+ */
91
+ giveUpStartDatePassedCertainPeriod(params: {
92
+ id?: {
93
+ $eq?: string;
94
+ };
95
+ error: any;
96
+ startDate: {
97
+ $lt: Date;
98
+ };
99
+ }): Promise<any>;
64
100
  findById<T extends factory.actionType>(params: {
65
101
  typeOf: T;
66
102
  id: string;
@@ -180,7 +216,19 @@ export declare class MongoRepository {
180
216
  startThrough: Date;
181
217
  typeOf: factory.actionType;
182
218
  }): Promise<IAggregateAction>;
183
- aggregateUseAction(params: {
219
+ aggregateCancelReservationAction(params: {
220
+ project?: {
221
+ id?: {
222
+ $ne?: string;
223
+ };
224
+ };
225
+ startFrom: Date;
226
+ startThrough: Date;
227
+ }): Promise<IAggregateAction>;
228
+ /**
229
+ * アクションタイプによる汎用的な集計
230
+ */
231
+ aggregateByTypeOf(params: {
184
232
  project?: {
185
233
  id?: {
186
234
  $ne?: string;
@@ -208,6 +256,7 @@ export declare class MongoRepository {
208
256
  startFrom: Date;
209
257
  startThrough: Date;
210
258
  }): Promise<IAggregateAction>;
259
+ getCursor(conditions: any, projection: any): import("mongoose").Cursor<any, import("mongoose").QueryOptions<any>>;
211
260
  private agggregateByStatus;
212
261
  }
213
262
  export {};
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.MongoRepository = void 0;
13
13
  const factory = require("../factory");
14
14
  const action_1 = require("./mongoose/schemas/action");
15
+ const settings_1 = require("../settings");
15
16
  /**
16
17
  * アクションリポジトリ
17
18
  */
@@ -456,7 +457,7 @@ class MongoRepository {
456
457
  }
457
458
  // const explainResult = await (<any>query).explain();
458
459
  // console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
459
- return query.setOptions({ maxTimeMS: 10000 })
460
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
460
461
  .exec()
461
462
  .then((docs) => docs.map((doc) => doc.toObject()));
462
463
  });
@@ -529,6 +530,22 @@ class MongoRepository {
529
530
  return doc.toObject();
530
531
  });
531
532
  }
533
+ /**
534
+ * 一定期間ActiveActionStatusのアクションをFailedActionStatusにする
535
+ */
536
+ giveUpStartDatePassedCertainPeriod(params) {
537
+ var _a;
538
+ return __awaiter(this, void 0, void 0, function* () {
539
+ return this.actionModel.updateMany(Object.assign({ actionStatus: { $eq: factory.actionStatusType.ActiveActionStatus },
540
+ // 一定期間過ぎたもの
541
+ startDate: { $lt: params.startDate.$lt } }, (typeof ((_a = params.id) === null || _a === void 0 ? void 0 : _a.$eq) === 'string') ? { _id: { $eq: params.id.$eq } } : undefined), {
542
+ actionStatus: factory.actionStatusType.FailedActionStatus,
543
+ error: params.error,
544
+ endDate: new Date()
545
+ })
546
+ .exec();
547
+ });
548
+ }
532
549
  findById(params) {
533
550
  return __awaiter(this, void 0, void 0, function* () {
534
551
  const doc = yield this.actionModel.findOne({
@@ -800,7 +817,36 @@ class MongoRepository {
800
817
  return { statuses };
801
818
  });
802
819
  }
803
- aggregateUseAction(params) {
820
+ aggregateCancelReservationAction(params) {
821
+ return __awaiter(this, void 0, void 0, function* () {
822
+ const statuses = yield Promise.all([
823
+ factory.actionStatusType.CompletedActionStatus,
824
+ factory.actionStatusType.CanceledActionStatus,
825
+ factory.actionStatusType.FailedActionStatus
826
+ ].map((actionStatus) => __awaiter(this, void 0, void 0, function* () {
827
+ var _a, _b;
828
+ const matchConditions = Object.assign({ startDate: {
829
+ $gte: params.startFrom,
830
+ $lte: params.startThrough
831
+ }, typeOf: { $eq: factory.actionType.CancelAction }, actionStatus: { $eq: actionStatus }, 'object.typeOf': {
832
+ $exists: true,
833
+ $in: [
834
+ factory.reservationType.BusReservation,
835
+ factory.reservationType.EventReservation,
836
+ factory.reservationType.ReservationPackage
837
+ ]
838
+ } }, (typeof ((_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$ne) === 'string')
839
+ ? { 'project.id': { $ne: params.project.id.$ne } }
840
+ : undefined);
841
+ return this.agggregateByStatus({ matchConditions, actionStatus });
842
+ })));
843
+ return { statuses };
844
+ });
845
+ }
846
+ /**
847
+ * アクションタイプによる汎用的な集計
848
+ */
849
+ aggregateByTypeOf(params) {
804
850
  return __awaiter(this, void 0, void 0, function* () {
805
851
  const statuses = yield Promise.all([
806
852
  factory.actionStatusType.CompletedActionStatus,
@@ -863,6 +909,11 @@ class MongoRepository {
863
909
  return { statuses };
864
910
  });
865
911
  }
912
+ getCursor(conditions, projection) {
913
+ return this.actionModel.find(conditions, projection)
914
+ .sort({ startDate: factory.sortType.Ascending })
915
+ .cursor();
916
+ }
866
917
  // tslint:disable-next-line:max-func-body-length
867
918
  agggregateByStatus(params) {
868
919
  return __awaiter(this, void 0, void 0, function* () {
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = void 0;
24
24
  const additionalProperty_1 = require("./mongoose/schemas/additionalProperty");
25
25
  const factory = require("../factory");
26
+ const settings_1 = require("../settings");
26
27
  /**
27
28
  * 追加特性リポジトリ
28
29
  */
@@ -145,7 +146,7 @@ class MongoRepository {
145
146
  if (params.sort !== undefined) {
146
147
  query.sort(params.sort);
147
148
  }
148
- return query.setOptions({ maxTimeMS: 10000 })
149
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
149
150
  .exec()
150
151
  .then((docs) => docs.map((doc) => doc.toObject()));
151
152
  });
@@ -4,12 +4,15 @@ export declare enum AggregationType {
4
4
  AggregateAuthorizeEventServiceOfferAction = "AggregateAuthorizeEventServiceOfferAction",
5
5
  AggregateAuthorizeOrderAction = "AggregateAuthorizeOrderAction",
6
6
  AggregateAuthorizePaymentAction = "AggregateAuthorizePaymentAction",
7
+ AggregateCancelReservationAction = "AggregateCancelReservationAction",
7
8
  AggregateCheckMovieTicketAction = "AggregateCheckMovieTicketAction",
8
9
  AggregateEvent = "AggregateEvent",
10
+ AggregateOrderAction = "AggregateOrderAction",
9
11
  AggregatePay = "AggregatePay",
10
12
  AggregatePayMovieTicketAction = "AggregatePayMovieTicketAction",
11
13
  AggregatePlaceOrder = "AggregatePlaceOrder",
12
14
  AggregateReserve = "AggregateReserve",
15
+ AggregateReserveAction = "AggregateReserveAction",
13
16
  AggregateTask = "AggregateTask",
14
17
  AggregateUseAction = "AggregateUseAction"
15
18
  }
@@ -27,12 +27,15 @@ var AggregationType;
27
27
  AggregationType["AggregateAuthorizeEventServiceOfferAction"] = "AggregateAuthorizeEventServiceOfferAction";
28
28
  AggregationType["AggregateAuthorizeOrderAction"] = "AggregateAuthorizeOrderAction";
29
29
  AggregationType["AggregateAuthorizePaymentAction"] = "AggregateAuthorizePaymentAction";
30
+ AggregationType["AggregateCancelReservationAction"] = "AggregateCancelReservationAction";
30
31
  AggregationType["AggregateCheckMovieTicketAction"] = "AggregateCheckMovieTicketAction";
31
32
  AggregationType["AggregateEvent"] = "AggregateEvent";
33
+ AggregationType["AggregateOrderAction"] = "AggregateOrderAction";
32
34
  AggregationType["AggregatePay"] = "AggregatePay";
33
35
  AggregationType["AggregatePayMovieTicketAction"] = "AggregatePayMovieTicketAction";
34
36
  AggregationType["AggregatePlaceOrder"] = "AggregatePlaceOrder";
35
37
  AggregationType["AggregateReserve"] = "AggregateReserve";
38
+ AggregationType["AggregateReserveAction"] = "AggregateReserveAction";
36
39
  AggregationType["AggregateTask"] = "AggregateTask";
37
40
  AggregationType["AggregateUseAction"] = "AggregateUseAction";
38
41
  })(AggregationType = exports.AggregationType || (exports.AggregationType = {}));
@@ -14,6 +14,7 @@ const moment = require("moment");
14
14
  const assetTransaction_1 = require("./mongoose/schemas/assetTransaction");
15
15
  const factory = require("../factory");
16
16
  const assetTransaction_2 = require("../eventEmitter/assetTransaction");
17
+ const settings_1 = require("../settings");
17
18
  /**
18
19
  * 資産取引リポジトリ
19
20
  */
@@ -448,7 +449,7 @@ class MongoRepository {
448
449
  typeOf: 1,
449
450
  status: 1
450
451
  })
451
- .setOptions({ maxTimeMS: 10000 })
452
+ .setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
452
453
  .exec();
453
454
  if (reexportingTransactions.length > 0) {
454
455
  for (const reexportingTransaction of reexportingTransactions) {
@@ -491,7 +492,7 @@ class MongoRepository {
491
492
  typeOf: 1,
492
493
  status: 1
493
494
  })
494
- .setOptions({ maxTimeMS: 10000 })
495
+ .setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
495
496
  .exec();
496
497
  if (delayedTransactions.length > 0) {
497
498
  delayedTransactions.forEach((delayedTransaction) => {
@@ -538,7 +539,7 @@ class MongoRepository {
538
539
  _id: 1,
539
540
  typeOf: 1
540
541
  })
541
- .setOptions({ maxTimeMS: 10000 })
542
+ .setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
542
543
  .exec();
543
544
  if (expiringTransactions.length > 0) {
544
545
  // ステータスと期限を見て更新
@@ -618,7 +619,7 @@ class MongoRepository {
618
619
  return __awaiter(this, void 0, void 0, function* () {
619
620
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
620
621
  return this.transactionModel.countDocuments({ $and: conditions })
621
- .setOptions({ maxTimeMS: 10000 })
622
+ .setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
622
623
  .exec();
623
624
  });
624
625
  }
@@ -659,7 +660,7 @@ class MongoRepository {
659
660
  if (((_a = params.sort) === null || _a === void 0 ? void 0 : _a.startDate) !== undefined) {
660
661
  query.sort({ startDate: params.sort.startDate });
661
662
  }
662
- return query.setOptions({ maxTimeMS: 10000 })
663
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
663
664
  .exec()
664
665
  .then((docs) => docs.map((doc) => doc.toObject()));
665
666
  });
@@ -35,7 +35,7 @@ export declare class MongoRepository {
35
35
  /**
36
36
  * 検索
37
37
  */
38
- search(params: factory.categoryCode.ISearchConditions): Promise<factory.categoryCode.ICategoryCode[]>;
38
+ search(params: factory.categoryCode.ISearchConditions, inclusion: string[], exclusion: string[]): Promise<factory.categoryCode.ICategoryCode[]>;
39
39
  findById(params: {
40
40
  id: string;
41
41
  }): Promise<factory.categoryCode.ICategoryCode>;
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = void 0;
24
24
  const categoryCode_1 = require("./mongoose/schemas/categoryCode");
25
25
  const factory = require("../factory");
26
+ const settings_1 = require("../settings");
26
27
  /**
27
28
  * 区分リポジトリ
28
29
  */
@@ -32,7 +33,7 @@ class MongoRepository {
32
33
  }
33
34
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
34
35
  static CREATE_MONGO_CONDITIONS(params) {
35
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
36
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
36
37
  // MongoDB検索条件
37
38
  const andConditions = [];
38
39
  // tslint:disable-next-line:no-single-line-block-comment
@@ -48,16 +49,13 @@ class MongoRepository {
48
49
  }
49
50
  }
50
51
  }
51
- // tslint:disable-next-line:no-single-line-block-comment
52
- /* istanbul ignore else */
53
- if (params.id !== undefined && params.id !== null) {
54
- if (typeof params.id.$eq === 'string') {
55
- andConditions.push({
56
- _id: {
57
- $eq: params.id.$eq
58
- }
59
- });
60
- }
52
+ const idEq = (_a = params.id) === null || _a === void 0 ? void 0 : _a.$eq;
53
+ if (typeof idEq === 'string') {
54
+ andConditions.push({ _id: { $eq: idEq } });
55
+ }
56
+ const idIn = (_b = params.id) === null || _b === void 0 ? void 0 : _b.$in;
57
+ if (Array.isArray(idIn)) {
58
+ andConditions.push({ _id: { $in: idIn } });
61
59
  }
62
60
  // tslint:disable-next-line:no-single-line-block-comment
63
61
  /* istanbul ignore else */
@@ -81,7 +79,7 @@ class MongoRepository {
81
79
  });
82
80
  }
83
81
  }
84
- const codeValueEq = (_a = params.codeValue) === null || _a === void 0 ? void 0 : _a.$eq;
82
+ const codeValueEq = (_c = params.codeValue) === null || _c === void 0 ? void 0 : _c.$eq;
85
83
  if (typeof codeValueEq === 'string') {
86
84
  andConditions.push({
87
85
  codeValue: {
@@ -90,7 +88,7 @@ class MongoRepository {
90
88
  }
91
89
  });
92
90
  }
93
- const codeValueIn = (_b = params.codeValue) === null || _b === void 0 ? void 0 : _b.$in;
91
+ const codeValueIn = (_d = params.codeValue) === null || _d === void 0 ? void 0 : _d.$in;
94
92
  if (Array.isArray(codeValueIn)) {
95
93
  andConditions.push({
96
94
  codeValue: {
@@ -113,7 +111,7 @@ class MongoRepository {
113
111
  }
114
112
  }
115
113
  }
116
- const inCodeSetIdentifierIn = (_d = (_c = params.inCodeSet) === null || _c === void 0 ? void 0 : _c.identifier) === null || _d === void 0 ? void 0 : _d.$in;
114
+ const inCodeSetIdentifierIn = (_f = (_e = params.inCodeSet) === null || _e === void 0 ? void 0 : _e.identifier) === null || _f === void 0 ? void 0 : _f.$in;
117
115
  if (Array.isArray(inCodeSetIdentifierIn)) {
118
116
  andConditions.push({
119
117
  'inCodeSet.identifier': {
@@ -122,7 +120,7 @@ class MongoRepository {
122
120
  }
123
121
  });
124
122
  }
125
- const paymentMethodTypeOfEq = (_f = (_e = params.paymentMethod) === null || _e === void 0 ? void 0 : _e.typeOf) === null || _f === void 0 ? void 0 : _f.$eq;
123
+ const paymentMethodTypeOfEq = (_h = (_g = params.paymentMethod) === null || _g === void 0 ? void 0 : _g.typeOf) === null || _h === void 0 ? void 0 : _h.$eq;
126
124
  if (typeof paymentMethodTypeOfEq === 'string') {
127
125
  andConditions.push({
128
126
  'paymentMethod.typeOf': {
@@ -131,7 +129,7 @@ class MongoRepository {
131
129
  }
132
130
  });
133
131
  }
134
- const paymentMethodTypeOfIn = (_h = (_g = params.paymentMethod) === null || _g === void 0 ? void 0 : _g.typeOf) === null || _h === void 0 ? void 0 : _h.$in;
132
+ const paymentMethodTypeOfIn = (_k = (_j = params.paymentMethod) === null || _j === void 0 ? void 0 : _j.typeOf) === null || _k === void 0 ? void 0 : _k.$in;
135
133
  if (Array.isArray(paymentMethodTypeOfIn)) {
136
134
  andConditions.push({
137
135
  'paymentMethod.typeOf': {
@@ -140,7 +138,7 @@ class MongoRepository {
140
138
  }
141
139
  });
142
140
  }
143
- const additionalPropertyElemMatch = (_j = params.additionalProperty) === null || _j === void 0 ? void 0 : _j.$elemMatch;
141
+ const additionalPropertyElemMatch = (_l = params.additionalProperty) === null || _l === void 0 ? void 0 : _l.$elemMatch;
144
142
  if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
145
143
  andConditions.push({
146
144
  additionalProperty: {
@@ -155,21 +153,35 @@ class MongoRepository {
155
153
  return __awaiter(this, void 0, void 0, function* () {
156
154
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
157
155
  return this.categoryCodeModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
158
- .setOptions({ maxTimeMS: 10000 })
156
+ .setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
159
157
  .exec();
160
158
  });
161
159
  }
162
160
  /**
163
161
  * 検索
164
162
  */
165
- search(params) {
163
+ search(params, inclusion, exclusion) {
166
164
  return __awaiter(this, void 0, void 0, function* () {
167
165
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
168
- const query = this.categoryCodeModel.find((conditions.length > 0) ? { $and: conditions } : {}, {
169
- __v: 0,
170
- createdAt: 0,
171
- updatedAt: 0
172
- });
166
+ let projection = {};
167
+ if (Array.isArray(inclusion) && inclusion.length > 0) {
168
+ inclusion.forEach((field) => {
169
+ projection[field] = 1;
170
+ });
171
+ }
172
+ else {
173
+ projection = {
174
+ __v: 0,
175
+ createdAt: 0,
176
+ updatedAt: 0
177
+ };
178
+ if (Array.isArray(exclusion) && exclusion.length > 0) {
179
+ exclusion.forEach((field) => {
180
+ projection[field] = 0;
181
+ });
182
+ }
183
+ }
184
+ const query = this.categoryCodeModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
173
185
  if (typeof params.limit === 'number' && params.limit > 0) {
174
186
  const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
175
187
  query.limit(params.limit)
@@ -180,7 +192,7 @@ class MongoRepository {
180
192
  if (params.sort !== undefined) {
181
193
  query.sort(params.sort);
182
194
  }
183
- return query.setOptions({ maxTimeMS: 10000 })
195
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
184
196
  .exec()
185
197
  .then((docs) => docs.map((doc) => doc.toObject()));
186
198
  });
@@ -15,6 +15,7 @@ const uuid = require("uuid");
15
15
  const factory = require("../factory");
16
16
  const authorization_1 = require("./mongoose/schemas/authorization");
17
17
  Object.defineProperty(exports, "modelName", { enumerable: true, get: function () { return authorization_1.modelName; } });
18
+ const settings_1 = require("../settings");
18
19
  /**
19
20
  * 承認コードリポジトリ
20
21
  */
@@ -177,7 +178,7 @@ class MongoRepository {
177
178
  return __awaiter(this, void 0, void 0, function* () {
178
179
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
179
180
  return this.authorizationModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
180
- .setOptions({ maxTimeMS: 10000 })
181
+ .setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
181
182
  .exec();
182
183
  });
183
184
  }
@@ -200,7 +201,7 @@ class MongoRepository {
200
201
  if (((_a = params.sort) === null || _a === void 0 ? void 0 : _a.validFrom) !== undefined) {
201
202
  query.sort({ validFrom: params.sort.validFrom });
202
203
  }
203
- return query.setOptions({ maxTimeMS: 10000 })
204
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
204
205
  .exec()
205
206
  .then((docs) => docs.map((doc) => doc.toObject()));
206
207
  });
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.MongoRepository = void 0;
13
13
  const comments_1 = require("./mongoose/schemas/comments");
14
14
  const factory = require("../factory");
15
+ const settings_1 = require("../settings");
15
16
  /**
16
17
  * コメントリポジトリ
17
18
  */
@@ -73,7 +74,7 @@ class MongoRepository {
73
74
  if (((_a = params.sort) === null || _a === void 0 ? void 0 : _a.dateCreated) !== undefined) {
74
75
  query.sort({ dateCreated: params.sort.dateCreated });
75
76
  }
76
- return query.setOptions({ maxTimeMS: 10000 })
77
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
77
78
  .exec()
78
79
  .then((docs) => docs.map((doc) => doc.toObject()));
79
80
  });
@@ -42,7 +42,7 @@ export declare class MongoRepository {
42
42
  /**
43
43
  * コンテンツを検索する
44
44
  */
45
- searchMovies(params: factory.creativeWork.movie.ISearchConditions): Promise<factory.creativeWork.movie.ICreativeWork[]>;
45
+ searchMovies(params: factory.creativeWork.movie.ISearchConditions, inclusion: string[], exclusion: string[]): Promise<factory.creativeWork.movie.ICreativeWork[]>;
46
46
  /**
47
47
  * コンテンツを削除する
48
48
  */
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = void 0;
24
24
  const creativeWork_1 = require("./mongoose/schemas/creativeWork");
25
25
  const factory = require("../factory");
26
+ const settings_1 = require("../settings");
26
27
  /**
27
28
  * コンテンツリポジトリ
28
29
  */
@@ -32,7 +33,7 @@ class MongoRepository {
32
33
  }
33
34
  // tslint:disable-next-line:max-func-body-length
34
35
  static CREATE_MONGO_CONDITIONS(params) {
35
- var _a, _b, _c, _d, _e, _f, _g, _h;
36
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
36
37
  // MongoDB検索条件
37
38
  const andConditions = [
38
39
  {
@@ -65,6 +66,14 @@ class MongoRepository {
65
66
  }
66
67
  });
67
68
  }
69
+ const idEq = (_f = params.id) === null || _f === void 0 ? void 0 : _f.$eq;
70
+ if (typeof idEq === 'string') {
71
+ andConditions.push({ _id: { $eq: idEq } });
72
+ }
73
+ const idIn = (_g = params.id) === null || _g === void 0 ? void 0 : _g.$in;
74
+ if (Array.isArray(idIn)) {
75
+ andConditions.push({ _id: { $in: idIn } });
76
+ }
68
77
  if (typeof params.identifier === 'string') {
69
78
  if (params.identifier.length > 0) {
70
79
  andConditions.push({
@@ -73,13 +82,13 @@ class MongoRepository {
73
82
  }
74
83
  }
75
84
  else {
76
- const identifierEq = (_f = params.identifier) === null || _f === void 0 ? void 0 : _f.$eq;
85
+ const identifierEq = (_h = params.identifier) === null || _h === void 0 ? void 0 : _h.$eq;
77
86
  if (typeof identifierEq === 'string') {
78
87
  andConditions.push({
79
88
  identifier: { $eq: identifierEq }
80
89
  });
81
90
  }
82
- const identifierIn = (_g = params.identifier) === null || _g === void 0 ? void 0 : _g.$in;
91
+ const identifierIn = (_j = params.identifier) === null || _j === void 0 ? void 0 : _j.$in;
83
92
  if (Array.isArray(identifierIn)) {
84
93
  andConditions.push({
85
94
  identifier: { $in: identifierIn }
@@ -155,7 +164,7 @@ class MongoRepository {
155
164
  });
156
165
  }
157
166
  }
158
- const additionalPropertyElemMatch = (_h = params.additionalProperty) === null || _h === void 0 ? void 0 : _h.$elemMatch;
167
+ const additionalPropertyElemMatch = (_k = params.additionalProperty) === null || _k === void 0 ? void 0 : _k.$elemMatch;
159
168
  if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
160
169
  andConditions.push({
161
170
  additionalProperty: {
@@ -205,22 +214,36 @@ class MongoRepository {
205
214
  return __awaiter(this, void 0, void 0, function* () {
206
215
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
207
216
  return this.creativeWorkModel.countDocuments({ $and: conditions })
208
- .setOptions({ maxTimeMS: 10000 })
217
+ .setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
209
218
  .exec();
210
219
  });
211
220
  }
212
221
  /**
213
222
  * コンテンツを検索する
214
223
  */
215
- searchMovies(params) {
224
+ searchMovies(params, inclusion, exclusion) {
216
225
  var _a;
217
226
  return __awaiter(this, void 0, void 0, function* () {
218
227
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
219
- const query = this.creativeWorkModel.find({ $and: conditions }, {
220
- __v: 0,
221
- createdAt: 0,
222
- updatedAt: 0
223
- });
228
+ let projection = {};
229
+ if (Array.isArray(inclusion) && inclusion.length > 0) {
230
+ inclusion.forEach((field) => {
231
+ projection[field] = 1;
232
+ });
233
+ }
234
+ else {
235
+ projection = {
236
+ __v: 0,
237
+ createdAt: 0,
238
+ updatedAt: 0
239
+ };
240
+ if (Array.isArray(exclusion) && exclusion.length > 0) {
241
+ exclusion.forEach((field) => {
242
+ projection[field] = 0;
243
+ });
244
+ }
245
+ }
246
+ const query = this.creativeWorkModel.find({ $and: conditions }, projection);
224
247
  if (typeof params.limit === 'number' && params.limit > 0) {
225
248
  const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
226
249
  query.limit(params.limit)
@@ -231,7 +254,7 @@ class MongoRepository {
231
254
  if (((_a = params.sort) === null || _a === void 0 ? void 0 : _a.identifier) !== undefined) {
232
255
  query.sort({ identifier: params.sort.identifier });
233
256
  }
234
- return query.setOptions({ maxTimeMS: 10000 })
257
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
235
258
  .exec()
236
259
  .then((docs) => docs.map((doc) => doc.toObject()));
237
260
  });
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = void 0;
24
24
  const customer_1 = require("./mongoose/schemas/customer");
25
25
  const factory = require("../factory");
26
+ const settings_1 = require("../settings");
26
27
  /**
27
28
  * 顧客リポジトリ
28
29
  */
@@ -120,7 +121,7 @@ class MongoRepository {
120
121
  if (((_a = conditions.sort) === null || _a === void 0 ? void 0 : _a.branchCode) !== undefined) {
121
122
  query.sort({ branchCode: conditions.sort.branchCode });
122
123
  }
123
- return query.setOptions({ maxTimeMS: 10000 })
124
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
124
125
  .exec()
125
126
  .then((docs) => docs.map((doc) => doc.toObject()));
126
127
  });
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = void 0;
24
24
  const emailMessages_1 = require("./mongoose/schemas/emailMessages");
25
25
  const factory = require("../factory");
26
+ const settings_1 = require("../settings");
26
27
  /**
27
28
  * Eメールメッセージリポジトリ
28
29
  */
@@ -107,7 +108,7 @@ class MongoRepository {
107
108
  if (params.sort !== undefined) {
108
109
  query.sort(params.sort);
109
110
  }
110
- return query.setOptions({ maxTimeMS: 10000 })
111
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
111
112
  .exec()
112
113
  .then((docs) => docs.map((doc) => doc.toObject()));
113
114
  });