@chevre/domain 21.0.0-alpha.7 → 21.0.0-alpha.9

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 (125) hide show
  1. package/lib/chevre/errorHandler.d.ts +1 -0
  2. package/lib/chevre/errorHandler.js +6 -2
  3. package/lib/chevre/repo/account.d.ts +0 -2
  4. package/lib/chevre/repo/account.js +9 -5
  5. package/lib/chevre/repo/accountTitle.js +5 -1
  6. package/lib/chevre/repo/accountTransaction.d.ts +0 -2
  7. package/lib/chevre/repo/accountTransaction.js +8 -5
  8. package/lib/chevre/repo/accountingReport.js +6 -2
  9. package/lib/chevre/repo/action.d.ts +1 -2
  10. package/lib/chevre/repo/action.js +8 -5
  11. package/lib/chevre/repo/additionalProperty.js +7 -3
  12. package/lib/chevre/repo/aggregation.js +5 -1
  13. package/lib/chevre/repo/assetTransaction.d.ts +1 -2
  14. package/lib/chevre/repo/assetTransaction.js +8 -5
  15. package/lib/chevre/repo/categoryCode.js +7 -3
  16. package/lib/chevre/repo/code.d.ts +1 -1
  17. package/lib/chevre/repo/code.js +7 -3
  18. package/lib/chevre/repo/comment.js +7 -3
  19. package/lib/chevre/repo/creativeWork.d.ts +0 -2
  20. package/lib/chevre/repo/creativeWork.js +8 -5
  21. package/lib/chevre/repo/customer.js +7 -3
  22. package/lib/chevre/repo/emailMessage.js +7 -3
  23. package/lib/chevre/repo/event.js +7 -3
  24. package/lib/chevre/repo/member.js +15 -8
  25. package/lib/chevre/repo/merchantReturnPolicy.d.ts +0 -2
  26. package/lib/chevre/repo/merchantReturnPolicy.js +8 -5
  27. package/lib/chevre/repo/mongoose/onIndexCreated.d.ts +2 -0
  28. package/lib/chevre/repo/mongoose/onIndexCreated.js +11 -0
  29. package/lib/chevre/repo/offer.js +9 -4
  30. package/lib/chevre/repo/offerCatalog.js +7 -3
  31. package/lib/chevre/repo/order.d.ts +0 -2
  32. package/lib/chevre/repo/order.js +11 -8
  33. package/lib/chevre/repo/ownershipInfo.d.ts +0 -2
  34. package/lib/chevre/repo/ownershipInfo.js +9 -6
  35. package/lib/chevre/repo/permit.js +5 -1
  36. package/lib/chevre/repo/place.js +15 -11
  37. package/lib/chevre/repo/priceSpecification.js +7 -3
  38. package/lib/chevre/repo/product.js +7 -3
  39. package/lib/chevre/repo/project.js +7 -3
  40. package/lib/chevre/repo/reservation.js +7 -20
  41. package/lib/chevre/repo/role.js +7 -3
  42. package/lib/chevre/repo/seller.js +7 -3
  43. package/lib/chevre/repo/serviceOutput.js +7 -3
  44. package/lib/chevre/repo/task.js +7 -3
  45. package/lib/chevre/repo/telemetry.js +5 -1
  46. package/lib/chevre/repo/transaction.d.ts +1 -2
  47. package/lib/chevre/repo/transaction.js +8 -5
  48. package/lib/chevre/repo/trip.js +7 -3
  49. package/lib/chevre/service/accountTransaction/deposit.js +0 -5
  50. package/lib/chevre/service/accountTransaction/transfer.js +0 -5
  51. package/lib/chevre/service/accountTransaction/withdraw.js +0 -5
  52. package/lib/chevre/service/assetTransaction/moneyTransfer.js +0 -5
  53. package/lib/chevre/service/assetTransaction/refund.js +0 -5
  54. package/lib/chevre/service/assetTransaction/registerService.js +0 -5
  55. package/lib/chevre/service/assetTransaction/reserve.js +0 -10
  56. package/lib/chevre/service/transaction/moneyTransfer.js +0 -5
  57. package/lib/chevre/service/transaction/placeOrderInProgress.js +2 -2
  58. package/lib/chevre/service/transaction/returnOrder.js +1 -1
  59. package/package.json +1 -1
  60. /package/lib/chevre/repo/mongoose/{model → schemas}/account.d.ts +0 -0
  61. /package/lib/chevre/repo/mongoose/{model → schemas}/account.js +0 -0
  62. /package/lib/chevre/repo/mongoose/{model → schemas}/accountTitle.d.ts +0 -0
  63. /package/lib/chevre/repo/mongoose/{model → schemas}/accountTitle.js +0 -0
  64. /package/lib/chevre/repo/mongoose/{model → schemas}/accountTransaction.d.ts +0 -0
  65. /package/lib/chevre/repo/mongoose/{model → schemas}/accountTransaction.js +0 -0
  66. /package/lib/chevre/repo/mongoose/{model → schemas}/accountingReport.d.ts +0 -0
  67. /package/lib/chevre/repo/mongoose/{model → schemas}/accountingReport.js +0 -0
  68. /package/lib/chevre/repo/mongoose/{model → schemas}/action.d.ts +0 -0
  69. /package/lib/chevre/repo/mongoose/{model → schemas}/action.js +0 -0
  70. /package/lib/chevre/repo/mongoose/{model → schemas}/additionalProperty.d.ts +0 -0
  71. /package/lib/chevre/repo/mongoose/{model → schemas}/additionalProperty.js +0 -0
  72. /package/lib/chevre/repo/mongoose/{model → schemas}/aggregation.d.ts +0 -0
  73. /package/lib/chevre/repo/mongoose/{model → schemas}/aggregation.js +0 -0
  74. /package/lib/chevre/repo/mongoose/{model → schemas}/assetTransaction.d.ts +0 -0
  75. /package/lib/chevre/repo/mongoose/{model → schemas}/assetTransaction.js +0 -0
  76. /package/lib/chevre/repo/mongoose/{model → schemas}/authorization.d.ts +0 -0
  77. /package/lib/chevre/repo/mongoose/{model → schemas}/authorization.js +0 -0
  78. /package/lib/chevre/repo/mongoose/{model → schemas}/categoryCode.d.ts +0 -0
  79. /package/lib/chevre/repo/mongoose/{model → schemas}/categoryCode.js +0 -0
  80. /package/lib/chevre/repo/mongoose/{model → schemas}/comments.d.ts +0 -0
  81. /package/lib/chevre/repo/mongoose/{model → schemas}/comments.js +0 -0
  82. /package/lib/chevre/repo/mongoose/{model → schemas}/creativeWork.d.ts +0 -0
  83. /package/lib/chevre/repo/mongoose/{model → schemas}/creativeWork.js +0 -0
  84. /package/lib/chevre/repo/mongoose/{model → schemas}/customer.d.ts +0 -0
  85. /package/lib/chevre/repo/mongoose/{model → schemas}/customer.js +0 -0
  86. /package/lib/chevre/repo/mongoose/{model → schemas}/emailMessages.d.ts +0 -0
  87. /package/lib/chevre/repo/mongoose/{model → schemas}/emailMessages.js +0 -0
  88. /package/lib/chevre/repo/mongoose/{model → schemas}/event.d.ts +0 -0
  89. /package/lib/chevre/repo/mongoose/{model → schemas}/event.js +0 -0
  90. /package/lib/chevre/repo/mongoose/{model → schemas}/member.d.ts +0 -0
  91. /package/lib/chevre/repo/mongoose/{model → schemas}/member.js +0 -0
  92. /package/lib/chevre/repo/mongoose/{model → schemas}/merchantReturnPolicy.d.ts +0 -0
  93. /package/lib/chevre/repo/mongoose/{model → schemas}/merchantReturnPolicy.js +0 -0
  94. /package/lib/chevre/repo/mongoose/{model → schemas}/offer.d.ts +0 -0
  95. /package/lib/chevre/repo/mongoose/{model → schemas}/offer.js +0 -0
  96. /package/lib/chevre/repo/mongoose/{model → schemas}/offerCatalog.d.ts +0 -0
  97. /package/lib/chevre/repo/mongoose/{model → schemas}/offerCatalog.js +0 -0
  98. /package/lib/chevre/repo/mongoose/{model → schemas}/order.d.ts +0 -0
  99. /package/lib/chevre/repo/mongoose/{model → schemas}/order.js +0 -0
  100. /package/lib/chevre/repo/mongoose/{model → schemas}/ownershipInfo.d.ts +0 -0
  101. /package/lib/chevre/repo/mongoose/{model → schemas}/ownershipInfo.js +0 -0
  102. /package/lib/chevre/repo/mongoose/{model → schemas}/place.d.ts +0 -0
  103. /package/lib/chevre/repo/mongoose/{model → schemas}/place.js +0 -0
  104. /package/lib/chevre/repo/mongoose/{model → schemas}/priceSpecification.d.ts +0 -0
  105. /package/lib/chevre/repo/mongoose/{model → schemas}/priceSpecification.js +0 -0
  106. /package/lib/chevre/repo/mongoose/{model → schemas}/product.d.ts +0 -0
  107. /package/lib/chevre/repo/mongoose/{model → schemas}/product.js +0 -0
  108. /package/lib/chevre/repo/mongoose/{model → schemas}/project.d.ts +0 -0
  109. /package/lib/chevre/repo/mongoose/{model → schemas}/project.js +0 -0
  110. /package/lib/chevre/repo/mongoose/{model → schemas}/reservation.d.ts +0 -0
  111. /package/lib/chevre/repo/mongoose/{model → schemas}/reservation.js +0 -0
  112. /package/lib/chevre/repo/mongoose/{model → schemas}/role.d.ts +0 -0
  113. /package/lib/chevre/repo/mongoose/{model → schemas}/role.js +0 -0
  114. /package/lib/chevre/repo/mongoose/{model → schemas}/seller.d.ts +0 -0
  115. /package/lib/chevre/repo/mongoose/{model → schemas}/seller.js +0 -0
  116. /package/lib/chevre/repo/mongoose/{model → schemas}/serviceOutput.d.ts +0 -0
  117. /package/lib/chevre/repo/mongoose/{model → schemas}/serviceOutput.js +0 -0
  118. /package/lib/chevre/repo/mongoose/{model → schemas}/task.d.ts +0 -0
  119. /package/lib/chevre/repo/mongoose/{model → schemas}/task.js +0 -0
  120. /package/lib/chevre/repo/mongoose/{model → schemas}/telemetry.d.ts +0 -0
  121. /package/lib/chevre/repo/mongoose/{model → schemas}/telemetry.js +0 -0
  122. /package/lib/chevre/repo/mongoose/{model → schemas}/transaction.d.ts +0 -0
  123. /package/lib/chevre/repo/mongoose/{model → schemas}/transaction.js +0 -0
  124. /package/lib/chevre/repo/mongoose/{model → schemas}/trip.d.ts +0 -0
  125. /package/lib/chevre/repo/mongoose/{model → schemas}/trip.js +0 -0
@@ -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
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
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,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
@@ -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.7"
123
+ "version": "21.0.0-alpha.9"
124
124
  }