@chevre/domain 21.0.0-alpha.1 → 21.0.0-alpha.10

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 (163) hide show
  1. package/lib/chevre/errorHandler.d.ts +1 -0
  2. package/lib/chevre/errorHandler.js +6 -2
  3. package/lib/chevre/index.d.ts +1 -2
  4. package/lib/chevre/index.js +1 -3
  5. package/lib/chevre/repo/account.d.ts +0 -2
  6. package/lib/chevre/repo/account.js +10 -6
  7. package/lib/chevre/repo/accountTitle.js +6 -2
  8. package/lib/chevre/repo/accountTransaction.d.ts +0 -2
  9. package/lib/chevre/repo/accountTransaction.js +9 -6
  10. package/lib/chevre/repo/accountingReport.js +7 -3
  11. package/lib/chevre/repo/action.d.ts +1 -2
  12. package/lib/chevre/repo/action.js +9 -6
  13. package/lib/chevre/repo/additionalProperty.js +8 -4
  14. package/lib/chevre/repo/aggregation.js +6 -2
  15. package/lib/chevre/repo/assetTransaction.d.ts +1 -2
  16. package/lib/chevre/repo/assetTransaction.js +9 -6
  17. package/lib/chevre/repo/categoryCode.js +8 -4
  18. package/lib/chevre/repo/code.d.ts +1 -1
  19. package/lib/chevre/repo/code.js +10 -5
  20. package/lib/chevre/repo/comment.js +8 -4
  21. package/lib/chevre/repo/creativeWork.d.ts +0 -2
  22. package/lib/chevre/repo/creativeWork.js +9 -6
  23. package/lib/chevre/repo/customer.js +8 -4
  24. package/lib/chevre/repo/emailMessage.js +8 -4
  25. package/lib/chevre/repo/event.js +8 -4
  26. package/lib/chevre/repo/member.js +16 -9
  27. package/lib/chevre/repo/merchantReturnPolicy.d.ts +0 -2
  28. package/lib/chevre/repo/merchantReturnPolicy.js +9 -6
  29. package/lib/chevre/repo/mongoose/onIndexCreated.d.ts +2 -0
  30. package/lib/chevre/repo/mongoose/onIndexCreated.js +11 -0
  31. package/lib/chevre/repo/mongoose/schemas/account.d.ts +54 -0
  32. package/lib/chevre/repo/mongoose/{model → schemas}/account.js +4 -14
  33. package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +64 -0
  34. package/lib/chevre/repo/mongoose/{model → schemas}/accountTitle.js +10 -35
  35. package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +67 -0
  36. package/lib/chevre/repo/mongoose/{model → schemas}/accountTransaction.js +9 -19
  37. package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +58 -0
  38. package/lib/chevre/repo/mongoose/{model → schemas}/accountingReport.js +7 -17
  39. package/lib/chevre/repo/mongoose/schemas/action.d.ts +73 -0
  40. package/lib/chevre/repo/mongoose/{model → schemas}/action.js +17 -27
  41. package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +60 -0
  42. package/lib/chevre/repo/mongoose/{model → schemas}/additionalProperty.js +7 -17
  43. package/lib/chevre/repo/mongoose/schemas/aggregation.d.ts +54 -0
  44. package/lib/chevre/repo/mongoose/{model → schemas}/aggregation.js +4 -14
  45. package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +72 -0
  46. package/lib/chevre/repo/mongoose/{model → schemas}/assetTransaction.js +13 -23
  47. package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +61 -0
  48. package/lib/chevre/repo/mongoose/{model → schemas}/authorization.js +6 -16
  49. package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +64 -0
  50. package/lib/chevre/repo/mongoose/{model → schemas}/categoryCode.js +9 -19
  51. package/lib/chevre/repo/mongoose/schemas/comments.d.ts +65 -0
  52. package/lib/chevre/repo/mongoose/{model → schemas}/comments.js +9 -19
  53. package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +73 -0
  54. package/lib/chevre/repo/mongoose/{model → schemas}/creativeWork.js +10 -20
  55. package/lib/chevre/repo/mongoose/schemas/customer.d.ts +64 -0
  56. package/lib/chevre/repo/mongoose/{model → schemas}/customer.js +8 -18
  57. package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +62 -0
  58. package/lib/chevre/repo/mongoose/{model → schemas}/emailMessages.js +8 -18
  59. package/lib/chevre/repo/mongoose/{model → schemas}/event.d.ts +26 -2
  60. package/lib/chevre/repo/mongoose/{model → schemas}/event.js +24 -34
  61. package/lib/chevre/repo/mongoose/schemas/member.d.ts +58 -0
  62. package/lib/chevre/repo/mongoose/{model → schemas}/member.js +6 -16
  63. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +62 -0
  64. package/lib/chevre/repo/mongoose/{model → schemas}/merchantReturnPolicy.js +7 -17
  65. package/lib/chevre/repo/mongoose/schemas/offer.d.ts +83 -0
  66. package/lib/chevre/repo/mongoose/{model → schemas}/offer.js +28 -38
  67. package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +64 -0
  68. package/lib/chevre/repo/mongoose/{model → schemas}/offerCatalog.js +11 -21
  69. package/lib/chevre/repo/mongoose/schemas/order.d.ts +77 -0
  70. package/lib/chevre/repo/mongoose/{model → schemas}/order.js +15 -25
  71. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +64 -0
  72. package/lib/chevre/repo/mongoose/{model → schemas}/ownershipInfo.js +9 -19
  73. package/lib/chevre/repo/mongoose/schemas/place.d.ts +76 -0
  74. package/lib/chevre/repo/mongoose/{model → schemas}/place.js +17 -27
  75. package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +66 -0
  76. package/lib/chevre/repo/mongoose/{model → schemas}/priceSpecification.js +9 -19
  77. package/lib/chevre/repo/mongoose/schemas/product.d.ts +67 -0
  78. package/lib/chevre/repo/mongoose/{model → schemas}/product.js +14 -24
  79. package/lib/chevre/repo/mongoose/schemas/project.d.ts +63 -0
  80. package/lib/chevre/repo/mongoose/{model → schemas}/project.js +7 -17
  81. package/lib/chevre/repo/mongoose/{model → schemas}/reservation.d.ts +26 -2
  82. package/lib/chevre/repo/mongoose/{model → schemas}/reservation.js +15 -25
  83. package/lib/chevre/repo/mongoose/schemas/role.d.ts +57 -0
  84. package/lib/chevre/repo/mongoose/{model → schemas}/role.js +4 -14
  85. package/lib/chevre/repo/mongoose/schemas/seller.d.ts +67 -0
  86. package/lib/chevre/repo/mongoose/{model → schemas}/seller.js +12 -22
  87. package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +57 -0
  88. package/lib/chevre/repo/mongoose/{model → schemas}/serviceOutput.js +5 -15
  89. package/lib/chevre/repo/mongoose/schemas/task.d.ts +65 -0
  90. package/lib/chevre/repo/mongoose/{model → schemas}/task.js +7 -17
  91. package/lib/chevre/repo/mongoose/schemas/telemetry.d.ts +62 -0
  92. package/lib/chevre/repo/mongoose/{model → schemas}/telemetry.js +9 -19
  93. package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +70 -0
  94. package/lib/chevre/repo/mongoose/{model → schemas}/transaction.js +12 -22
  95. package/lib/chevre/repo/mongoose/schemas/trip.d.ts +57 -0
  96. package/lib/chevre/repo/mongoose/{model → schemas}/trip.js +5 -15
  97. package/lib/chevre/repo/mongoose/writeConcern.d.ts +3 -0
  98. package/lib/chevre/repo/mongoose/writeConcern.js +5 -0
  99. package/lib/chevre/repo/offer.js +11 -6
  100. package/lib/chevre/repo/offerCatalog.js +8 -4
  101. package/lib/chevre/repo/order.d.ts +0 -2
  102. package/lib/chevre/repo/order.js +12 -9
  103. package/lib/chevre/repo/ownershipInfo.d.ts +0 -2
  104. package/lib/chevre/repo/ownershipInfo.js +10 -7
  105. package/lib/chevre/repo/permit.js +6 -2
  106. package/lib/chevre/repo/place.js +16 -12
  107. package/lib/chevre/repo/priceSpecification.js +8 -4
  108. package/lib/chevre/repo/product.js +8 -4
  109. package/lib/chevre/repo/project.js +7 -3
  110. package/lib/chevre/repo/reservation.js +8 -21
  111. package/lib/chevre/repo/role.js +8 -4
  112. package/lib/chevre/repo/seller.js +8 -4
  113. package/lib/chevre/repo/serviceOutput.js +8 -4
  114. package/lib/chevre/repo/task.js +8 -4
  115. package/lib/chevre/repo/telemetry.js +6 -2
  116. package/lib/chevre/repo/transaction.d.ts +1 -2
  117. package/lib/chevre/repo/transaction.js +9 -6
  118. package/lib/chevre/repo/trip.js +8 -4
  119. package/lib/chevre/service/accountTransaction/deposit.js +0 -5
  120. package/lib/chevre/service/accountTransaction/transfer.js +0 -5
  121. package/lib/chevre/service/accountTransaction/withdraw.js +0 -5
  122. package/lib/chevre/service/assetTransaction/moneyTransfer.js +0 -5
  123. package/lib/chevre/service/assetTransaction/refund.js +0 -5
  124. package/lib/chevre/service/assetTransaction/registerService.js +0 -5
  125. package/lib/chevre/service/assetTransaction/reserve.js +0 -10
  126. package/lib/chevre/service/code.js +6 -1
  127. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +6 -1
  128. package/lib/chevre/service/report/ownershipInfo.js +4 -0
  129. package/lib/chevre/service/transaction/moneyTransfer.js +0 -5
  130. package/lib/chevre/service/transaction/placeOrderInProgress.js +2 -2
  131. package/lib/chevre/service/transaction/returnOrder.js +1 -1
  132. package/package.json +7 -7
  133. package/lib/chevre/repo/mongoose/model/account.d.ts +0 -30
  134. package/lib/chevre/repo/mongoose/model/accountTitle.d.ts +0 -40
  135. package/lib/chevre/repo/mongoose/model/accountTransaction.d.ts +0 -43
  136. package/lib/chevre/repo/mongoose/model/accountingReport.d.ts +0 -34
  137. package/lib/chevre/repo/mongoose/model/action.d.ts +0 -49
  138. package/lib/chevre/repo/mongoose/model/additionalProperty.d.ts +0 -36
  139. package/lib/chevre/repo/mongoose/model/aggregation.d.ts +0 -30
  140. package/lib/chevre/repo/mongoose/model/assetTransaction.d.ts +0 -48
  141. package/lib/chevre/repo/mongoose/model/authorization.d.ts +0 -37
  142. package/lib/chevre/repo/mongoose/model/categoryCode.d.ts +0 -40
  143. package/lib/chevre/repo/mongoose/model/comments.d.ts +0 -41
  144. package/lib/chevre/repo/mongoose/model/creativeWork.d.ts +0 -49
  145. package/lib/chevre/repo/mongoose/model/customer.d.ts +0 -40
  146. package/lib/chevre/repo/mongoose/model/emailMessages.d.ts +0 -38
  147. package/lib/chevre/repo/mongoose/model/member.d.ts +0 -34
  148. package/lib/chevre/repo/mongoose/model/merchantReturnPolicy.d.ts +0 -38
  149. package/lib/chevre/repo/mongoose/model/offer.d.ts +0 -59
  150. package/lib/chevre/repo/mongoose/model/offerCatalog.d.ts +0 -40
  151. package/lib/chevre/repo/mongoose/model/order.d.ts +0 -53
  152. package/lib/chevre/repo/mongoose/model/ownershipInfo.d.ts +0 -40
  153. package/lib/chevre/repo/mongoose/model/place.d.ts +0 -52
  154. package/lib/chevre/repo/mongoose/model/priceSpecification.d.ts +0 -42
  155. package/lib/chevre/repo/mongoose/model/product.d.ts +0 -43
  156. package/lib/chevre/repo/mongoose/model/project.d.ts +0 -39
  157. package/lib/chevre/repo/mongoose/model/role.d.ts +0 -33
  158. package/lib/chevre/repo/mongoose/model/seller.d.ts +0 -43
  159. package/lib/chevre/repo/mongoose/model/serviceOutput.d.ts +0 -33
  160. package/lib/chevre/repo/mongoose/model/task.d.ts +0 -41
  161. package/lib/chevre/repo/mongoose/model/telemetry.d.ts +0 -38
  162. package/lib/chevre/repo/mongoose/model/transaction.d.ts +0 -46
  163. package/lib/chevre/repo/mongoose/model/trip.d.ts +0 -33
@@ -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
- this.priceSpecificationModel = connection.model(priceSpecification_1.modelName);
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) {
@@ -169,8 +173,8 @@ class MongoRepository {
169
173
  createdAt: 0,
170
174
  updatedAt: 0
171
175
  });
172
- if (typeof params.limit === 'number') {
173
- const page = (typeof params.page === 'number') ? params.page : 1;
176
+ if (typeof params.limit === 'number' && params.limit > 0) {
177
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
174
178
  query.limit(params.limit)
175
179
  .skip(params.limit * (page - 1));
176
180
  }
@@ -21,14 +21,18 @@ 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
  * プロダクトリポジトリ
28
29
  */
29
30
  class MongoRepository {
30
31
  constructor(connection) {
31
- this.productModel = connection.model(product_1.modelName);
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) {
@@ -160,8 +164,8 @@ class MongoRepository {
160
164
  return __awaiter(this, void 0, void 0, function* () {
161
165
  const andConditions = MongoRepository.CREATE_MONGO_CONDITIONS(conditions);
162
166
  const query = this.productModel.find((andConditions.length > 0) ? { $and: andConditions } : {}, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection));
163
- if (typeof conditions.limit === 'number') {
164
- const page = (typeof conditions.page === 'number') ? conditions.page : 1;
167
+ if (typeof conditions.limit === 'number' && conditions.limit > 0) {
168
+ const page = (typeof conditions.page === 'number' && conditions.page > 0) ? conditions.page : 1;
165
169
  query.limit(conditions.limit)
166
170
  .skip(conditions.limit * (page - 1));
167
171
  }
@@ -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検索条件
@@ -79,8 +83,8 @@ class MongoRepository {
79
83
  return __awaiter(this, void 0, void 0, function* () {
80
84
  const andConditions = MongoRepository.CREATE_MONGO_CONDITIONS(conditions);
81
85
  const query = this.projectModel.find((andConditions.length > 0) ? { $and: andConditions } : {}, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection));
82
- if (typeof conditions.limit === 'number') {
83
- const page = (typeof conditions.page === 'number') ? conditions.page : 1;
86
+ if (typeof conditions.limit === 'number' && conditions.limit > 0) {
87
+ const page = (typeof conditions.page === 'number' && conditions.page > 0) ? conditions.page : 1;
84
88
  query.limit(conditions.limit)
85
89
  .skip(conditions.limit * (page - 1));
86
90
  }
@@ -10,14 +10,18 @@ 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 reservation_1 = require("./mongoose/model/reservation");
13
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
14
+ const reservation_1 = require("./mongoose/schemas/reservation");
14
15
  const factory = require("../factory");
15
16
  /**
16
17
  * 予約リポジトリ
17
18
  */
18
19
  class MongoRepository {
19
20
  constructor(connection) {
20
- this.reservationModel = connection.model(reservation_1.modelName);
21
+ this.reservationModel = connection.model(reservation_1.modelName, reservation_1.schema);
22
+ if (connection.get('autoIndex') === true) {
23
+ this.reservationModel.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) {
@@ -867,8 +871,8 @@ class MongoRepository {
867
871
  createdAt: 0,
868
872
  updatedAt: 0
869
873
  });
870
- if (typeof params.limit === 'number') {
871
- const page = (typeof params.page === 'number') ? params.page : 1;
874
+ if (typeof params.limit === 'number' && params.limit > 0) {
875
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
872
876
  query.limit(params.limit)
873
877
  .skip(params.limit * (page - 1));
874
878
  }
@@ -882,23 +886,6 @@ class MongoRepository {
882
886
  .then((docs) => docs.map((doc) => doc.toObject()));
883
887
  });
884
888
  }
885
- // public stream<T extends factory.reservationType>(params: factory.reservation.ISearchConditions<T>): QueryCursor<Document> {
886
- // const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
887
- // const query = this.reservationModel.find((conditions.length > 0) ? { $and: conditions } : {})
888
- // .select({ __v: 0, createdAt: 0, updatedAt: 0 });
889
- // // tslint:disable-next-line:no-single-line-block-comment
890
- // /* istanbul ignore else */
891
- // if (params.limit !== undefined && params.page !== undefined) {
892
- // query.limit(params.limit)
893
- // .skip(params.limit * (params.page - 1));
894
- // }
895
- // // tslint:disable-next-line:no-single-line-block-comment
896
- // /* istanbul ignore else */
897
- // if (params.sort !== undefined) {
898
- // query.sort(params.sort);
899
- // }
900
- // return query.cursor();
901
- // }
902
889
  findById(params) {
903
890
  return __awaiter(this, void 0, void 0, function* () {
904
891
  let projection = {};
@@ -11,7 +11,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.MongoRepository = exports.RoleType = void 0;
13
13
  const factory = require("../factory");
14
- const role_1 = require("./mongoose/model/role");
14
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
15
+ const role_1 = require("./mongoose/schemas/role");
15
16
  var RoleType;
16
17
  (function (RoleType) {
17
18
  RoleType["OrganizationRole"] = "OrganizationRole";
@@ -21,7 +22,10 @@ var RoleType;
21
22
  */
22
23
  class MongoRepository {
23
24
  constructor(connection) {
24
- this.roleModel = connection.model(role_1.modelName);
25
+ this.roleModel = connection.model(role_1.modelName, role_1.schema);
26
+ if (connection.get('autoIndex') === true) {
27
+ this.roleModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
28
+ }
25
29
  }
26
30
  static CREATE_MONGO_CONDITIONS(params) {
27
31
  var _a, _b, _c;
@@ -79,8 +83,8 @@ class MongoRepository {
79
83
  createdAt: 0,
80
84
  updatedAt: 0
81
85
  });
82
- if (typeof params.limit === 'number') {
83
- const page = (typeof params.page === 'number') ? params.page : 1;
86
+ if (typeof params.limit === 'number' && params.limit > 0) {
87
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
84
88
  query.limit(params.limit)
85
89
  .skip(params.limit * (page - 1));
86
90
  }
@@ -21,14 +21,18 @@ 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 seller_1 = require("./mongoose/model/seller");
24
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
25
+ const seller_1 = require("./mongoose/schemas/seller");
25
26
  const factory = require("../factory");
26
27
  /**
27
28
  * 販売者リポジトリ
28
29
  */
29
30
  class MongoRepository {
30
31
  constructor(connection) {
31
- this.organizationModel = connection.model(seller_1.modelName);
32
+ this.organizationModel = connection.model(seller_1.modelName, seller_1.schema);
33
+ if (connection.get('autoIndex') === true) {
34
+ this.organizationModel.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) {
@@ -172,8 +176,8 @@ class MongoRepository {
172
176
  return __awaiter(this, void 0, void 0, function* () {
173
177
  const andConditions = MongoRepository.CREATE_MONGO_CONDITIONS(conditions);
174
178
  const query = this.organizationModel.find((andConditions.length > 0) ? { $and: andConditions } : {}, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection));
175
- if (typeof conditions.limit === 'number') {
176
- const page = (typeof conditions.page === 'number') ? conditions.page : 1;
179
+ if (typeof conditions.limit === 'number' && conditions.limit > 0) {
180
+ const page = (typeof conditions.page === 'number' && conditions.page > 0) ? conditions.page : 1;
177
181
  query.limit(conditions.limit)
178
182
  .skip(conditions.limit * (page - 1));
179
183
  }
@@ -10,14 +10,18 @@ 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
  * サービスアウトプットリポジトリ
17
18
  */
18
19
  class MongoRepository {
19
20
  constructor(connection) {
20
- this.serviceOutputModel = connection.model(serviceOutput_1.modelName);
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
  // tslint:disable-next-line:max-func-body-length
23
27
  static CREATE_MONGO_CONDITIONS(params) {
@@ -118,8 +122,8 @@ class MongoRepository {
118
122
  return __awaiter(this, void 0, void 0, function* () {
119
123
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
120
124
  const query = this.serviceOutputModel.find((conditions.length > 0) ? { $and: conditions } : {}, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection));
121
- if (typeof params.limit === 'number') {
122
- const page = (typeof params.page === 'number') ? params.page : 1;
125
+ if (typeof params.limit === 'number' && params.limit > 0) {
126
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
123
127
  query.limit(params.limit)
124
128
  .skip(params.limit * (page - 1));
125
129
  }
@@ -12,7 +12,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.MongoRepository = void 0;
13
13
  const moment = require("moment");
14
14
  const factory = require("../factory");
15
- const task_1 = require("./mongoose/model/task");
15
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
16
+ const task_1 = require("./mongoose/schemas/task");
16
17
  /**
17
18
  * タスク実行時のソート条件
18
19
  */
@@ -25,7 +26,10 @@ const sortOrder4executionOfTasks = {
25
26
  */
26
27
  class MongoRepository {
27
28
  constructor(connection) {
28
- this.taskModel = connection.model(task_1.modelName);
29
+ this.taskModel = connection.model(task_1.modelName, task_1.schema);
30
+ if (connection.get('autoIndex') === true) {
31
+ this.taskModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
32
+ }
29
33
  }
30
34
  // tslint:disable-next-line:max-func-body-length
31
35
  static CREATE_MONGO_CONDITIONS(params) {
@@ -309,8 +313,8 @@ class MongoRepository {
309
313
  return __awaiter(this, void 0, void 0, function* () {
310
314
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
311
315
  const query = this.taskModel.find((conditions.length > 0) ? { $and: conditions } : {}, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection));
312
- if (typeof params.limit === 'number') {
313
- const page = (typeof params.page === 'number') ? params.page : 1;
316
+ if (typeof params.limit === 'number' && params.limit > 0) {
317
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
314
318
  query.limit(params.limit)
315
319
  .skip(params.limit * (page - 1));
316
320
  }
@@ -1,13 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MongoRepository = void 0;
4
- const telemetry_1 = require("./mongoose/model/telemetry");
4
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
5
+ const telemetry_1 = require("./mongoose/schemas/telemetry");
5
6
  /**
6
7
  * 測定リポジトリ
7
8
  */
8
9
  class MongoRepository {
9
10
  constructor(connection) {
10
- this.telemetryModel = connection.model(telemetry_1.modelName);
11
+ this.telemetryModel = connection.model(telemetry_1.modelName, telemetry_1.schema);
12
+ if (connection.get('autoIndex') === true) {
13
+ this.telemetryModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
14
+ }
11
15
  }
12
16
  }
13
17
  exports.MongoRepository = MongoRepository;
@@ -1,7 +1,5 @@
1
1
  import { Connection } from 'mongoose';
2
2
  import * as factory from '../factory';
3
- import { modelName } from './mongoose/model/transaction';
4
- export { modelName };
5
3
  interface IAggregationByStatus {
6
4
  transactionCount: number;
7
5
  avgDuration: number;
@@ -185,3 +183,4 @@ export declare class MongoRepository {
185
183
  }): Promise<IAggregatePlaceOrder>;
186
184
  private agggregateByStatus;
187
185
  }
186
+ export {};
@@ -9,17 +9,20 @@ 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 moment = require("moment");
14
14
  const factory = require("../factory");
15
- const transaction_1 = require("./mongoose/model/transaction");
16
- Object.defineProperty(exports, "modelName", { enumerable: true, get: function () { return transaction_1.modelName; } });
15
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
16
+ const transaction_1 = require("./mongoose/schemas/transaction");
17
17
  /**
18
18
  * 取引リポジトリ
19
19
  */
20
20
  class MongoRepository {
21
21
  constructor(connection) {
22
- this.transactionModel = connection.model(transaction_1.modelName);
22
+ this.transactionModel = connection.model(transaction_1.modelName, transaction_1.schema);
23
+ if (connection.get('autoIndex') === true) {
24
+ this.transactionModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
25
+ }
23
26
  }
24
27
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
25
28
  static CREATE_MONGO_CONDITIONS(params) {
@@ -592,8 +595,8 @@ class MongoRepository {
592
595
  }
593
596
  const query = this.transactionModel.find((conditions.length > 0) ? { $and: conditions } : {})
594
597
  .select(projection);
595
- if (typeof params.limit === 'number') {
596
- const page = (typeof params.page === 'number') ? params.page : 1;
598
+ if (typeof params.limit === 'number' && params.limit > 0) {
599
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
597
600
  query.limit(params.limit)
598
601
  .skip(params.limit * (page - 1));
599
602
  }
@@ -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 trip_1 = require("./mongoose/model/trip");
25
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
26
+ const trip_1 = require("./mongoose/schemas/trip");
26
27
  /**
27
28
  * トリップリポジトリ
28
29
  */
29
30
  class MongoRepository {
30
31
  constructor(connection) {
31
- this.tripModel = connection.model(trip_1.modelName);
32
+ this.tripModel = connection.model(trip_1.modelName, trip_1.schema);
33
+ if (connection.get('autoIndex') === true) {
34
+ this.tripModel.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(conditions) {
@@ -175,8 +179,8 @@ class MongoRepository {
175
179
  return __awaiter(this, void 0, void 0, function* () {
176
180
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
177
181
  const query = this.tripModel.find({ $and: conditions }, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection));
178
- if (typeof params.limit === 'number') {
179
- const page = (typeof params.page === 'number') ? params.page : 1;
182
+ if (typeof params.limit === 'number' && params.limit > 0) {
183
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
180
184
  query.limit(params.limit)
181
185
  .skip(params.limit * (page - 1));
182
186
  }
@@ -45,11 +45,6 @@ function start(params) {
45
45
  transaction = yield repos.accountTransaction.startByIdentifier(startParams);
46
46
  }
47
47
  catch (error) {
48
- // tslint:disable-next-line:no-single-line-block-comment
49
- /* istanbul ignore next */
50
- if (error.name === 'MongoError') {
51
- // no op
52
- }
53
48
  throw error;
54
49
  }
55
50
  const pendingTransaction = {
@@ -70,11 +70,6 @@ function start(params) {
70
70
  transaction = yield repos.accountTransaction.startByIdentifier(startParams);
71
71
  }
72
72
  catch (error) {
73
- // tslint:disable-next-line:no-single-line-block-comment
74
- /* istanbul ignore next */
75
- if (error.name === 'MongoError') {
76
- // no op
77
- }
78
73
  throw error;
79
74
  }
80
75
  const pendingTransaction = {
@@ -52,11 +52,6 @@ function start(params) {
52
52
  transaction = yield repos.accountTransaction.startByIdentifier(startParams);
53
53
  }
54
54
  catch (error) {
55
- // tslint:disable-next-line:no-single-line-block-comment
56
- /* istanbul ignore next */
57
- if (error.name === 'MongoError') {
58
- // no op
59
- }
60
55
  throw error;
61
56
  }
62
57
  const pendingTransaction = {
@@ -87,11 +87,6 @@ function start(params) {
87
87
  // });
88
88
  }
89
89
  catch (error) {
90
- // tslint:disable-next-line:no-single-line-block-comment
91
- /* istanbul ignore next */
92
- if (error.name === 'MongoError') {
93
- // no op
94
- }
95
90
  throw error;
96
91
  }
97
92
  return transaction;
@@ -68,11 +68,6 @@ function start(params) {
68
68
  }
69
69
  }
70
70
  catch (error) {
71
- // tslint:disable-next-line:no-single-line-block-comment
72
- /* istanbul ignore next */
73
- if (error.name === 'MongoError') {
74
- // no op
75
- }
76
71
  throw error;
77
72
  }
78
73
  return transaction;
@@ -71,11 +71,6 @@ function start(params) {
71
71
  transaction = yield repos.assetTransaction.start(startParams);
72
72
  }
73
73
  catch (error) {
74
- // tslint:disable-next-line:no-single-line-block-comment
75
- /* istanbul ignore next */
76
- if (error.name === 'MongoError') {
77
- // no op
78
- }
79
74
  throw error;
80
75
  }
81
76
  // 必要あれば在庫確認など
@@ -61,11 +61,6 @@ function start(params) {
61
61
  transaction = yield repos.assetTransaction.start(startParams);
62
62
  }
63
63
  catch (error) {
64
- // tslint:disable-next-line:no-single-line-block-comment
65
- /* istanbul ignore next */
66
- if (error.name === 'MongoError') {
67
- // no op
68
- }
69
64
  throw error;
70
65
  }
71
66
  // 指定があれば予約追加
@@ -160,11 +155,6 @@ function addReservations(params) {
160
155
  yield (0, cancelReservation_1.processUnlockOfferRateLimit)({ reservation, reservationFor })(repos);
161
156
  })));
162
157
  }
163
- // tslint:disable-next-line:no-single-line-block-comment
164
- /* istanbul ignore next */
165
- if (error.name === 'MongoError') {
166
- // no op
167
- }
168
158
  throw error;
169
159
  }
170
160
  // 座席指定でも座席ロック
@@ -48,7 +48,12 @@ function getToken(params) {
48
48
  reject(err);
49
49
  }
50
50
  else {
51
- resolve(encoded);
51
+ if (typeof encoded !== 'string') {
52
+ reject(new factory.errors.ServiceUnavailable('authorization.object cannot be signed unexpectedly'));
53
+ }
54
+ else {
55
+ resolve(encoded);
56
+ }
52
57
  }
53
58
  });
54
59
  });
@@ -64,7 +64,12 @@ function getOrderWithToken(params) {
64
64
  reject(err);
65
65
  }
66
66
  else {
67
- resolve(encoded);
67
+ if (typeof encoded !== 'string') {
68
+ reject(new factory.errors.ServiceUnavailable('order cannot be signed unexpectedly'));
69
+ }
70
+ else {
71
+ resolve(encoded);
72
+ }
68
73
  }
69
74
  });
70
75
  });
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ownershipInfo2report = void 0;
4
+ /**
5
+ * 所有権レポートサービス
6
+ */
7
+ // import * as json2csv from 'json2csv';
4
8
  const moment = require("moment");
5
9
  function ownershipInfo2report(params) {
6
10
  var _a, _b, _c;
@@ -48,11 +48,6 @@ function start(params) {
48
48
  yield authorizePaymentCard({ transaction })(repos);
49
49
  }
50
50
  catch (error) {
51
- // tslint:disable-next-line:no-single-line-block-comment
52
- /* istanbul ignore next */
53
- if (error.name === 'MongoError') {
54
- // no op
55
- }
56
51
  throw error;
57
52
  }
58
53
  return transaction;
@@ -57,7 +57,7 @@ function start(params) {
57
57
  transaction = yield repos.transaction.start(startParams);
58
58
  }
59
59
  catch (error) {
60
- if (error.name === 'MongoError') {
60
+ if ((0, errorHandler_1.isMongoError)(error)) {
61
61
  // no op
62
62
  }
63
63
  throw error;
@@ -132,7 +132,7 @@ function confirm(params) {
132
132
  });
133
133
  }
134
134
  catch (error) {
135
- if (error.name === 'MongoError') {
135
+ if ((0, errorHandler_1.isMongoError)(error)) {
136
136
  // 万が一同一注文番号で確定しようとすると、MongoDBでE11000 duplicate key errorが発生する
137
137
  // message: 'E11000 duplicate key error collection: prodttts.transactions index:result.order.orderNumber_1 dup key:...',
138
138
  if (error.code === errorHandler_1.MongoErrorCode.DuplicateKey) {
@@ -81,7 +81,7 @@ function start(params) {
81
81
  returnOrderTransaction = yield repos.transaction.start(returnOrderAttributes);
82
82
  }
83
83
  catch (error) {
84
- if (error.name === 'MongoError') {
84
+ if ((0, errorHandler_1.isMongoError)(error)) {
85
85
  // 同一取引に対して返品取引を作成しようとすると、MongoDBでE11000 duplicate key errorが発生する
86
86
  // tslint:disable-next-line:no-single-line-block-comment
87
87
  /* istanbul ignore else */
package/package.json CHANGED
@@ -15,16 +15,13 @@
15
15
  "@motionpicture/gmo-service": "5.2.0",
16
16
  "@sendgrid/mail": "6.4.0",
17
17
  "@surfrock/sdk": "1.2.0-alpha.0",
18
- "@waiter/domain": "5.1.0",
19
- "JSONStream": "^1.3.5",
20
- "aws-sdk": "^2.984.0",
18
+ "@waiter/domain": "6.1.0",
21
19
  "azure-storage": "^2.10.4",
22
20
  "cdigit": "2.6.7",
23
21
  "debug": "^3.2.7",
24
22
  "google-libphonenumber": "^3.2.18",
25
23
  "http-status": "^1.5.0",
26
- "json2csv": "^4.5.4",
27
- "jsonwebtoken": "^8.5.1",
24
+ "jsonwebtoken": "9.0.0",
28
25
  "lodash.difference": "^4.5.0",
29
26
  "moment": "^2.29.1",
30
27
  "moment-range": "^4.0.2",
@@ -41,7 +38,7 @@
41
38
  "@types/google-libphonenumber": "^7.4.19",
42
39
  "@types/http-status": "^0.2.30",
43
40
  "@types/json2csv": "^4.5.1",
44
- "@types/jsonwebtoken": "^7.2.8",
41
+ "@types/jsonwebtoken": "9.0.1",
45
42
  "@types/lodash.difference": "^4.5.6",
46
43
  "@types/mocha": "^5.2.7",
47
44
  "@types/moment-timezone": "^0.5.30",
@@ -57,9 +54,11 @@
57
54
  "@types/sinon-mongoose": "^1.3.11",
58
55
  "@types/uniqid": "^4.1.3",
59
56
  "@types/uuid": "^3.4.10",
57
+ "aws-sdk": "2.1348.0",
60
58
  "coveralls": "^3.1.0",
61
59
  "csvtojson": "^2.0.10",
62
60
  "googleapis": "^85.0.0",
61
+ "json2csv": "4.5.4",
63
62
  "mocha": "^5.2.0",
64
63
  "mongoose": "6.10.4",
65
64
  "nock": "^9.6.1",
@@ -77,6 +76,7 @@
77
76
  "typescript": "^4.8.4"
78
77
  },
79
78
  "peerDependencies": {
79
+ "aws-sdk": "^2.0.0",
80
80
  "mongoose": "^6.0.0",
81
81
  "redis": "^3.1.2"
82
82
  },
@@ -120,5 +120,5 @@
120
120
  "postversion": "git push origin --tags",
121
121
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
122
122
  },
123
- "version": "21.0.0-alpha.1"
123
+ "version": "21.0.0-alpha.10"
124
124
  }