@chevre/domain 21.12.0 → 21.13.0-alpha.1

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 (219) hide show
  1. package/example/src/chevre/searchEvents.ts +1 -1
  2. package/example/src/chevre/searchOrders.ts +1 -1
  3. package/example/src/chevre/transaction/processReturnOrder.ts +8 -8
  4. package/example/src/chevre/transaction/startExportTasks.ts +1 -1
  5. package/example/src/chevre/unsetContainsInPlaceFromMovieTheater.ts +1 -1
  6. package/example/src/chevre/unsetUnnecessaryFields.ts +1 -1
  7. package/example/src/chevre/updateOfferCatalogs.ts +1 -1
  8. package/example/src/chevre/updateTransaction.ts +1 -1
  9. package/lib/chevre/index.d.ts +1 -2
  10. package/lib/chevre/index.js +2 -3
  11. package/lib/chevre/repo/account.js +1 -1
  12. package/lib/chevre/repo/accountTitle.js +1 -1
  13. package/lib/chevre/repo/accountTransaction.js +1 -1
  14. package/lib/chevre/repo/accountingReport.js +1 -1
  15. package/lib/chevre/repo/action.js +1 -1
  16. package/lib/chevre/repo/additionalProperty.js +1 -1
  17. package/lib/chevre/repo/aggregateOffer.js +1 -1
  18. package/lib/chevre/repo/aggregation.js +1 -1
  19. package/lib/chevre/repo/assetTransaction.js +1 -1
  20. package/lib/chevre/repo/categoryCode.js +1 -1
  21. package/lib/chevre/repo/code.js +1 -1
  22. package/lib/chevre/repo/comment.js +1 -1
  23. package/lib/chevre/repo/creativeWork.js +1 -1
  24. package/lib/chevre/repo/customer.js +1 -1
  25. package/lib/chevre/repo/emailMessage.js +1 -1
  26. package/lib/chevre/repo/event.d.ts +2 -2
  27. package/lib/chevre/repo/event.js +6 -2
  28. package/lib/chevre/repo/member.js +1 -1
  29. package/lib/chevre/repo/merchantReturnPolicy.js +1 -1
  30. package/lib/chevre/repo/mongoose/schemas/account.d.ts +4 -56
  31. package/lib/chevre/repo/mongoose/schemas/account.js +80 -32
  32. package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +4 -90
  33. package/lib/chevre/repo/mongoose/schemas/accountTitle.js +81 -44
  34. package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +4 -95
  35. package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +129 -62
  36. package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +4 -68
  37. package/lib/chevre/repo/mongoose/schemas/accountingReport.js +108 -63
  38. package/lib/chevre/repo/mongoose/schemas/action.d.ts +4 -113
  39. package/lib/chevre/repo/mongoose/schemas/action.js +345 -215
  40. package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +4 -74
  41. package/lib/chevre/repo/mongoose/schemas/additionalProperty.js +65 -32
  42. package/lib/chevre/repo/mongoose/schemas/aggregateOffer.d.ts +4 -73
  43. package/lib/chevre/repo/mongoose/schemas/aggregateOffer.js +258 -155
  44. package/lib/chevre/repo/mongoose/schemas/aggregation.d.ts +4 -56
  45. package/lib/chevre/repo/mongoose/schemas/aggregation.js +28 -10
  46. package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +4 -113
  47. package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +258 -146
  48. package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +4 -77
  49. package/lib/chevre/repo/mongoose/schemas/authorization.js +110 -61
  50. package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +4 -86
  51. package/lib/chevre/repo/mongoose/schemas/categoryCode.js +85 -46
  52. package/lib/chevre/repo/mongoose/schemas/comments.d.ts +4 -89
  53. package/lib/chevre/repo/mongoose/schemas/comments.js +59 -28
  54. package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +4 -104
  55. package/lib/chevre/repo/mongoose/schemas/creativeWork.js +121 -70
  56. package/lib/chevre/repo/mongoose/schemas/customer.d.ts +4 -86
  57. package/lib/chevre/repo/mongoose/schemas/customer.js +56 -26
  58. package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +4 -80
  59. package/lib/chevre/repo/mongoose/schemas/emailMessages.js +41 -17
  60. package/lib/chevre/repo/mongoose/schemas/event.d.ts +4 -158
  61. package/lib/chevre/repo/mongoose/schemas/event.js +307 -193
  62. package/lib/chevre/repo/mongoose/schemas/member.d.ts +4 -68
  63. package/lib/chevre/repo/mongoose/schemas/member.js +65 -37
  64. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +4 -80
  65. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.js +29 -11
  66. package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +4 -91
  67. package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +85 -45
  68. package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.d.ts +4 -91
  69. package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.js +29 -10
  70. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.d.ts +4 -73
  71. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.js +37 -12
  72. package/lib/chevre/repo/mongoose/schemas/order.d.ts +4 -128
  73. package/lib/chevre/repo/mongoose/schemas/order.js +407 -259
  74. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +4 -86
  75. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +187 -111
  76. package/lib/chevre/repo/mongoose/schemas/place.d.ts +4 -128
  77. package/lib/chevre/repo/mongoose/schemas/place.js +159 -93
  78. package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +4 -92
  79. package/lib/chevre/repo/mongoose/schemas/priceSpecification.js +94 -49
  80. package/lib/chevre/repo/mongoose/schemas/product.d.ts +4 -95
  81. package/lib/chevre/repo/mongoose/schemas/product.js +109 -61
  82. package/lib/chevre/repo/mongoose/schemas/project.d.ts +4 -83
  83. package/lib/chevre/repo/mongoose/schemas/project.js +20 -9
  84. package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +4 -143
  85. package/lib/chevre/repo/mongoose/schemas/reservation.js +377 -229
  86. package/lib/chevre/repo/mongoose/schemas/role.d.ts +4 -65
  87. package/lib/chevre/repo/mongoose/schemas/role.js +43 -19
  88. package/lib/chevre/repo/mongoose/schemas/seller.d.ts +4 -95
  89. package/lib/chevre/repo/mongoose/schemas/seller.js +96 -51
  90. package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +4 -65
  91. package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +112 -63
  92. package/lib/chevre/repo/mongoose/schemas/task.d.ts +4 -95
  93. package/lib/chevre/repo/mongoose/schemas/task.js +214 -126
  94. package/lib/chevre/repo/mongoose/schemas/telemetry.d.ts +4 -80
  95. package/lib/chevre/repo/mongoose/schemas/telemetry.js +44 -24
  96. package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +4 -107
  97. package/lib/chevre/repo/mongoose/schemas/transaction.js +291 -176
  98. package/lib/chevre/repo/mongoose/schemas/trip.d.ts +4 -65
  99. package/lib/chevre/repo/mongoose/schemas/trip.js +20 -9
  100. package/lib/chevre/repo/offer.js +5 -4
  101. package/lib/chevre/repo/offerCatalog.d.ts +1 -1
  102. package/lib/chevre/repo/offerCatalog.js +2 -2
  103. package/lib/chevre/repo/offerCatalogItem.js +1 -1
  104. package/lib/chevre/repo/offerItemCondition.js +1 -1
  105. package/lib/chevre/repo/order.js +1 -1
  106. package/lib/chevre/repo/ownershipInfo.js +1 -1
  107. package/lib/chevre/repo/paymentServiceProvider.js +1 -1
  108. package/lib/chevre/repo/permit.js +1 -1
  109. package/lib/chevre/repo/place/hasPOS.js +1 -1
  110. package/lib/chevre/repo/place.js +1 -1
  111. package/lib/chevre/repo/priceSpecification.js +1 -1
  112. package/lib/chevre/repo/product.js +1 -1
  113. package/lib/chevre/repo/productOffer.js +1 -1
  114. package/lib/chevre/repo/project.js +1 -1
  115. package/lib/chevre/repo/reservation.js +1 -1
  116. package/lib/chevre/repo/role.js +1 -1
  117. package/lib/chevre/repo/seller.js +1 -1
  118. package/lib/chevre/repo/serviceOutput.js +1 -1
  119. package/lib/chevre/repo/task.js +1 -1
  120. package/lib/chevre/repo/telemetry.js +1 -1
  121. package/lib/chevre/repo/transaction.js +1 -1
  122. package/lib/chevre/repo/trip.js +1 -1
  123. package/lib/chevre/repository.d.ts +160 -137
  124. package/lib/chevre/repository.js +531 -223
  125. package/lib/chevre/service/account.d.ts +2 -2
  126. package/lib/chevre/service/accountTransaction/deposit.d.ts +2 -2
  127. package/lib/chevre/service/accountTransaction/transfer.d.ts +2 -2
  128. package/lib/chevre/service/accountTransaction/withdraw.d.ts +2 -2
  129. package/lib/chevre/service/accountTransaction.d.ts +1 -1
  130. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +7 -7
  131. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.d.ts +6 -6
  132. package/lib/chevre/service/aggregation/event/findEventOffers.d.ts +4 -4
  133. package/lib/chevre/service/aggregation/event/importFromCOA.d.ts +1 -1
  134. package/lib/chevre/service/aggregation/project.d.ts +3 -3
  135. package/lib/chevre/service/aggregation/system.d.ts +5 -5
  136. package/lib/chevre/service/assetTransaction/cancelReservation.d.ts +4 -4
  137. package/lib/chevre/service/assetTransaction/moneyTransfer.d.ts +4 -4
  138. package/lib/chevre/service/assetTransaction/moneyTransfer.js +1 -1
  139. package/lib/chevre/service/assetTransaction/pay/account/validation.d.ts +1 -1
  140. package/lib/chevre/service/assetTransaction/pay.d.ts +10 -10
  141. package/lib/chevre/service/assetTransaction/refund.d.ts +4 -4
  142. package/lib/chevre/service/assetTransaction/registerService.d.ts +8 -8
  143. package/lib/chevre/service/assetTransaction/reserve.d.ts +14 -14
  144. package/lib/chevre/service/assetTransaction.d.ts +2 -2
  145. package/lib/chevre/service/code.d.ts +2 -2
  146. package/lib/chevre/service/code.js +1 -2
  147. package/lib/chevre/service/delivery.d.ts +5 -5
  148. package/lib/chevre/service/event/createEvent.d.ts +4 -4
  149. package/lib/chevre/service/event.d.ts +7 -7
  150. package/lib/chevre/service/iam.d.ts +2 -2
  151. package/lib/chevre/service/moneyTransfer.d.ts +5 -5
  152. package/lib/chevre/service/notification.d.ts +2 -2
  153. package/lib/chevre/service/offer/event/authorize.d.ts +15 -15
  154. package/lib/chevre/service/offer/event/cancel.d.ts +7 -7
  155. package/lib/chevre/service/offer/event/importFromCOA.d.ts +3 -3
  156. package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +7 -7
  157. package/lib/chevre/service/offer/event/voidTransaction.d.ts +7 -7
  158. package/lib/chevre/service/offer/eventServiceByCOA/validateAcceptedOffers.d.ts +1 -1
  159. package/lib/chevre/service/offer/eventServiceByCOA.d.ts +5 -5
  160. package/lib/chevre/service/offer/moneyTransfer/authorize.d.ts +6 -6
  161. package/lib/chevre/service/offer/moneyTransfer/returnMoneyTransfer.d.ts +5 -5
  162. package/lib/chevre/service/offer/moneyTransfer/settleTransaction.d.ts +2 -2
  163. package/lib/chevre/service/offer/moneyTransfer/voidTransaction.d.ts +3 -3
  164. package/lib/chevre/service/offer/product/searchProductOffers.d.ts +3 -3
  165. package/lib/chevre/service/offer/product.d.ts +14 -14
  166. package/lib/chevre/service/offer.d.ts +6 -6
  167. package/lib/chevre/service/order/confirmPayTransaction.d.ts +10 -10
  168. package/lib/chevre/service/order/deleteOrder.d.ts +5 -5
  169. package/lib/chevre/service/order/findPlaceOrderTransaction.d.ts +1 -1
  170. package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +5 -5
  171. package/lib/chevre/service/order/onOrderStatusChanged.d.ts +2 -2
  172. package/lib/chevre/service/order/onOrderUpdated.d.ts +1 -1
  173. package/lib/chevre/service/order/payOrder.d.ts +4 -4
  174. package/lib/chevre/service/order/placeOrder.d.ts +6 -6
  175. package/lib/chevre/service/order/returnOrder.d.ts +6 -6
  176. package/lib/chevre/service/order/sendOrder.d.ts +6 -6
  177. package/lib/chevre/service/payment/any/onPaid.d.ts +3 -3
  178. package/lib/chevre/service/payment/any/onPaymentStatusChanged/onPaid.d.ts +1 -1
  179. package/lib/chevre/service/payment/any/onPaymentStatusChanged/onRefunded.d.ts +1 -1
  180. package/lib/chevre/service/payment/any/onPaymentStatusChanged.d.ts +2 -2
  181. package/lib/chevre/service/payment/any/onRefund.d.ts +3 -3
  182. package/lib/chevre/service/payment/any.d.ts +10 -10
  183. package/lib/chevre/service/payment/creditCard.d.ts +6 -6
  184. package/lib/chevre/service/payment/faceToFace.d.ts +6 -6
  185. package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +2 -2
  186. package/lib/chevre/service/payment/movieTicket/getCredentials.d.ts +1 -1
  187. package/lib/chevre/service/payment/movieTicket/validation.d.ts +5 -5
  188. package/lib/chevre/service/payment/movieTicket.d.ts +6 -6
  189. package/lib/chevre/service/payment/paymentCard.d.ts +7 -7
  190. package/lib/chevre/service/payment.d.ts +9 -9
  191. package/lib/chevre/service/permit.d.ts +2 -2
  192. package/lib/chevre/service/product.d.ts +3 -3
  193. package/lib/chevre/service/project.d.ts +16 -16
  194. package/lib/chevre/service/report/telemetry.d.ts +19 -16
  195. package/lib/chevre/service/reserve/cancelReservation.d.ts +3 -3
  196. package/lib/chevre/service/reserve/checkInReservation.d.ts +5 -5
  197. package/lib/chevre/service/reserve/confirmReservation.d.ts +4 -4
  198. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +1 -1
  199. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.d.ts +2 -2
  200. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +1 -1
  201. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.d.ts +1 -1
  202. package/lib/chevre/service/reserve/useReservation.d.ts +5 -5
  203. package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +1 -1
  204. package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.d.ts +2 -2
  205. package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.d.ts +3 -3
  206. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +15 -15
  207. package/lib/chevre/service/task/onResourceUpdated/syncOfferCatalog.d.ts +2 -2
  208. package/lib/chevre/service/task.d.ts +1 -1
  209. package/lib/chevre/service/task.js +3 -4
  210. package/lib/chevre/service/transaction/deleteTransaction.d.ts +9 -9
  211. package/lib/chevre/service/transaction/moneyTransfer.d.ts +9 -9
  212. package/lib/chevre/service/transaction/orderProgramMembership/findPaymentCardPermit.d.ts +2 -2
  213. package/lib/chevre/service/transaction/placeOrder.d.ts +2 -2
  214. package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +7 -7
  215. package/lib/chevre/service/transaction/returnOrder.d.ts +10 -10
  216. package/lib/chevre/service/transaction.d.ts +2 -2
  217. package/lib/chevre/settings.d.ts +1 -0
  218. package/lib/chevre/settings.js +2 -1
  219. package/package.json +1 -1
@@ -8,7 +8,7 @@ const PROJECT_ID = process.env.PROJECT_ID;
8
8
  async function main() {
9
9
  await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
10
10
 
11
- const eventRepo = new chevre.repository.Event(mongoose.connection);
11
+ const eventRepo: chevre.repository.Event = await chevre.repository.Event.createInstance(mongoose.connection);
12
12
 
13
13
  const events = await eventRepo.search(
14
14
  {
@@ -8,7 +8,7 @@ const project = { id: String(process.env.PROJECT_ID) };
8
8
  async function main() {
9
9
  await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
10
10
 
11
- const orderRepo = new chevre.repository.Order(mongoose.connection);
11
+ const orderRepo = await chevre.repository.Order.createInstance(mongoose.connection);
12
12
 
13
13
  const orders = await orderRepo.search({
14
14
  limit: 10,
@@ -23,14 +23,14 @@ async function main() {
23
23
  id: 'xxx'
24
24
  }
25
25
  })({
26
- event: new chevre.repository.Event(mongoose.connection),
27
- merchantReturnPolicy: new chevre.repository.MerchantReturnPolicy(mongoose.connection),
28
- offer: new chevre.repository.Offer(mongoose.connection),
29
- offerItemCondition: new chevre.repository.OfferItemCondition(mongoose.connection),
30
- order: new chevre.repository.Order(mongoose.connection),
31
- reservation: new chevre.repository.Reservation(mongoose.connection),
32
- seller: new chevre.repository.Seller(mongoose.connection),
33
- transaction: new chevre.repository.Transaction(mongoose.connection)
26
+ event: await chevre.repository.Event.createInstance(mongoose.connection),
27
+ merchantReturnPolicy: await chevre.repository.MerchantReturnPolicy.createInstance(mongoose.connection),
28
+ offer: await chevre.repository.Offer.createInstance(mongoose.connection),
29
+ offerItemCondition: await chevre.repository.OfferItemCondition.createInstance(mongoose.connection),
30
+ order: await chevre.repository.Order.createInstance(mongoose.connection),
31
+ reservation: await chevre.repository.Reservation.createInstance(mongoose.connection),
32
+ seller: await chevre.repository.Seller.createInstance(mongoose.connection),
33
+ transaction: await chevre.repository.Transaction.createInstance(mongoose.connection)
34
34
  });
35
35
  console.log(result);
36
36
  }
@@ -6,7 +6,7 @@ import { chevre } from '../../../../lib/index';
6
6
  async function main() {
7
7
  await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
8
8
 
9
- const transactionRepo = new chevre.repository.Transaction(mongoose.connection);
9
+ const transactionRepo = await chevre.repository.Transaction.createInstance(mongoose.connection);
10
10
  const result = await transactionRepo.startExportTasks({
11
11
  typeOf: { $in: [chevre.factory.transactionType.PlaceOrder] },
12
12
  status: chevre.factory.transactionStatusType.Confirmed,
@@ -8,7 +8,7 @@ import { chevre } from '../../../lib/index';
8
8
  async function main() {
9
9
  await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
10
10
 
11
- const placeRepo = new chevre.repository.Place(mongoose.connection);
11
+ const placeRepo = await chevre.repository.Place.createInstance(mongoose.connection);
12
12
 
13
13
  const cursor = placeRepo.getCursor(
14
14
  {
@@ -9,7 +9,7 @@ const PROJECT_ID = String(process.env.PROJECT_ID);
9
9
  async function main() {
10
10
  await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
11
11
 
12
- const transactionRepo = new chevre.repository.Transaction(mongoose.connection);
12
+ const transactionRepo = await chevre.repository.Transaction.createInstance(mongoose.connection);
13
13
 
14
14
  let updateResult: any;
15
15
  updateResult = await transactionRepo.unsetUnnecessaryFields({
@@ -6,7 +6,7 @@ import { chevre } from '../../../lib/index';
6
6
  async function main() {
7
7
  await mongoose.connect(<string>process.env.MONGOLAB_URI);
8
8
 
9
- const offerCatalogRepo = new chevre.repository.OfferCatalog(mongoose.connection);
9
+ const offerCatalogRepo = await chevre.repository.OfferCatalog.createInstance(mongoose.connection);
10
10
 
11
11
  await offerCatalogRepo.updateManyById({
12
12
  id: { $in: ['0002'] },
@@ -7,7 +7,7 @@ import { chevre } from '../../../lib/index';
7
7
  async function main() {
8
8
  await mongoose.connect(<string>process.env.MONGOLAB_URI);
9
9
 
10
- const transactionRepo = new chevre.repository.Transaction(mongoose.connection);
10
+ const transactionRepo = await chevre.repository.Transaction.createInstance(mongoose.connection);
11
11
  const transactionId = '63ce4d501c45c2000bdb2f9d';
12
12
  let update = {
13
13
  $set: { 'object.modifiedTime': new Date() }
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * index module
3
3
  */
4
- import * as COA from '@motionpicture/coa-service';
5
4
  import * as GMO from '@motionpicture/gmo-service';
6
5
  import * as surfrock from '@surfrock/sdk';
7
6
  import { credentials } from './credentials';
@@ -12,4 +11,4 @@ import * as pecorinoapi from './pecorinoapi';
12
11
  import * as repository from './repository';
13
12
  import * as service from './service';
14
13
  import * as settings from './settings';
15
- export { credentials, errorHandler, eventEmitter, factory, repository, service, settings, surfrock, pecorinoapi, COA, GMO };
14
+ export { credentials, errorHandler, eventEmitter, factory, repository, service, settings, surfrock, pecorinoapi, GMO };
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GMO = exports.COA = exports.pecorinoapi = exports.surfrock = exports.settings = exports.service = exports.repository = exports.factory = exports.eventEmitter = exports.errorHandler = exports.credentials = void 0;
3
+ exports.GMO = exports.pecorinoapi = exports.surfrock = exports.settings = exports.service = exports.repository = exports.factory = exports.eventEmitter = exports.errorHandler = exports.credentials = void 0;
4
4
  /**
5
5
  * index module
6
6
  */
7
- const COA = require("@motionpicture/coa-service");
8
- exports.COA = COA;
7
+ // import * as COA from '@motionpicture/coa-service';
9
8
  const GMO = require("@motionpicture/gmo-service");
10
9
  exports.GMO = GMO;
11
10
  const surfrock = require("@surfrock/sdk");
@@ -18,7 +18,7 @@ const settings_1 = require("../settings");
18
18
  */
19
19
  class MongoRepository {
20
20
  constructor(connection) {
21
- this.accountModel = connection.model(account_1.modelName, account_1.schema);
21
+ this.accountModel = connection.model(account_1.modelName, (0, account_1.createSchema)());
22
22
  }
23
23
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
24
24
  static CREATE_MONGO_CONDITIONS(params) {
@@ -17,7 +17,7 @@ const accountTitle_1 = require("./mongoose/schemas/accountTitle");
17
17
  */
18
18
  class MongoRepository {
19
19
  constructor(connection) {
20
- this.accountTitleModel = connection.model(accountTitle_1.modelName, accountTitle_1.schema);
20
+ this.accountTitleModel = connection.model(accountTitle_1.modelName, (0, accountTitle_1.createSchema)());
21
21
  }
22
22
  deleteByProject(params) {
23
23
  return __awaiter(this, void 0, void 0, function* () {
@@ -19,7 +19,7 @@ const settings_1 = require("../settings");
19
19
  */
20
20
  class MongoRepository {
21
21
  constructor(connection) {
22
- this.transactionModel = connection.model(accountTransaction_1.modelName, accountTransaction_1.schema);
22
+ this.transactionModel = connection.model(accountTransaction_1.modelName, (0, accountTransaction_1.createSchema)());
23
23
  }
24
24
  static CREATE_MONGO_CONDITIONS(params) {
25
25
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
@@ -17,7 +17,7 @@ const errorHandler_1 = require("../errorHandler");
17
17
  */
18
18
  class MongoRepository {
19
19
  constructor(connection) {
20
- this.accountingReportModel = connection.model(accountingReport_1.modelName, accountingReport_1.schema);
20
+ this.accountingReportModel = connection.model(accountingReport_1.modelName, (0, accountingReport_1.createSchema)());
21
21
  }
22
22
  /**
23
23
  * なければ作成する
@@ -18,7 +18,7 @@ const settings_1 = require("../settings");
18
18
  */
19
19
  class MongoRepository {
20
20
  constructor(connection) {
21
- this.actionModel = connection.model(action_1.modelName, action_1.schema);
21
+ this.actionModel = connection.model(action_1.modelName, (0, action_1.createSchema)());
22
22
  }
23
23
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
24
24
  static CREATE_MONGO_CONDITIONS(params) {
@@ -29,7 +29,7 @@ const settings_1 = require("../settings");
29
29
  */
30
30
  class MongoRepository {
31
31
  constructor(connection) {
32
- this.additionalPropertyModel = connection.model(additionalProperty_1.modelName, additionalProperty_1.schema);
32
+ this.additionalPropertyModel = connection.model(additionalProperty_1.modelName, (0, additionalProperty_1.createSchema)());
33
33
  }
34
34
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
35
35
  static CREATE_MONGO_CONDITIONS(params) {
@@ -18,7 +18,7 @@ const debug = createDebug('chevre-domain:repo:aggregateOffer');
18
18
  */
19
19
  class MongoRepository {
20
20
  constructor(connection) {
21
- this.aggregateOfferModel = connection.model(aggregateOffer_1.modelName, aggregateOffer_1.schema);
21
+ this.aggregateOfferModel = connection.model(aggregateOffer_1.modelName, (0, aggregateOffer_1.createSchema)());
22
22
  }
23
23
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
24
24
  static CREATE_AGGREGATE_OFFERS_MATCH_CONDITIONS(params) {
@@ -44,7 +44,7 @@ var AggregationType;
44
44
  */
45
45
  class MongoRepository {
46
46
  constructor(connection) {
47
- this.aggregationModel = connection.model(aggregation_1.modelName, aggregation_1.schema);
47
+ this.aggregationModel = connection.model(aggregation_1.modelName, (0, aggregation_1.createSchema)());
48
48
  }
49
49
  saveAggregation(params) {
50
50
  return __awaiter(this, void 0, void 0, function* () {
@@ -20,7 +20,7 @@ const settings_1 = require("../settings");
20
20
  */
21
21
  class MongoRepository {
22
22
  constructor(connection) {
23
- this.transactionModel = connection.model(assetTransaction_1.modelName, assetTransaction_1.schema);
23
+ this.transactionModel = connection.model(assetTransaction_1.modelName, (0, assetTransaction_1.createSchema)());
24
24
  }
25
25
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
26
26
  static CREATE_MONGO_CONDITIONS(params) {
@@ -29,7 +29,7 @@ const settings_1 = require("../settings");
29
29
  */
30
30
  class MongoRepository {
31
31
  constructor(connection) {
32
- this.categoryCodeModel = connection.model(categoryCode_1.modelName, categoryCode_1.schema);
32
+ this.categoryCodeModel = connection.model(categoryCode_1.modelName, (0, categoryCode_1.createSchema)());
33
33
  }
34
34
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
35
35
  static CREATE_MONGO_CONDITIONS(params) {
@@ -21,7 +21,7 @@ const settings_1 = require("../settings");
21
21
  */
22
22
  class MongoRepository {
23
23
  constructor(connection) {
24
- this.authorizationModel = connection.model(authorization_1.modelName, authorization_1.schema);
24
+ this.authorizationModel = connection.model(authorization_1.modelName, (0, authorization_1.createSchema)());
25
25
  }
26
26
  // tslint:disable-next-line:max-func-body-length
27
27
  static CREATE_MONGO_CONDITIONS(params) {
@@ -18,7 +18,7 @@ const settings_1 = require("../settings");
18
18
  */
19
19
  class MongoRepository {
20
20
  constructor(connection) {
21
- this.commentModel = connection.model(comments_1.modelName, comments_1.schema);
21
+ this.commentModel = connection.model(comments_1.modelName, (0, comments_1.createSchema)());
22
22
  }
23
23
  static CREATE_MONGO_CONDITIONS(params) {
24
24
  var _a, _b, _c, _d, _e, _f;
@@ -29,7 +29,7 @@ const settings_1 = require("../settings");
29
29
  */
30
30
  class MongoRepository {
31
31
  constructor(connection) {
32
- this.creativeWorkModel = connection.model(creativeWork_1.modelName, creativeWork_1.schema);
32
+ this.creativeWorkModel = connection.model(creativeWork_1.modelName, (0, creativeWork_1.createSchema)());
33
33
  }
34
34
  // tslint:disable-next-line:max-func-body-length
35
35
  static CREATE_MONGO_CONDITIONS(params) {
@@ -29,7 +29,7 @@ const settings_1 = require("../settings");
29
29
  */
30
30
  class MongoRepository {
31
31
  constructor(connection) {
32
- this.customerModel = connection.model(customer_1.modelName, customer_1.schema);
32
+ this.customerModel = connection.model(customer_1.modelName, (0, customer_1.createSchema)());
33
33
  }
34
34
  // tslint:disable-next-line:max-func-body-length
35
35
  static CREATE_MONGO_CONDITIONS(params) {
@@ -29,7 +29,7 @@ const settings_1 = require("../settings");
29
29
  */
30
30
  class MongoRepository {
31
31
  constructor(connection) {
32
- this.emailMessageModel = connection.model(emailMessages_1.modelName, emailMessages_1.schema);
32
+ this.emailMessageModel = connection.model(emailMessages_1.modelName, (0, emailMessages_1.createSchema)());
33
33
  }
34
34
  static CREATE_MONGO_CONDITIONS(params) {
35
35
  var _a, _b, _c, _d, _e;
@@ -22,8 +22,8 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
- import { BulkWriteResult as BulkWriteOpResultObject } from 'mongodb';
26
- import { Connection } from 'mongoose';
25
+ import type { BulkWriteResult as BulkWriteOpResultObject } from 'mongodb';
26
+ import type { Connection } from 'mongoose';
27
27
  import * as factory from '../factory';
28
28
  import * as EventFactory from '../factory/event';
29
29
  export interface IAttributes4patchUpdate<T extends factory.eventType> {
@@ -21,7 +21,6 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = exports.PROJECTION_MINIMIZED_EVENT = void 0;
24
- const uniqid = require("uniqid");
25
24
  const factory = require("../factory");
26
25
  const EventFactory = require("../factory/event");
27
26
  const event_1 = require("./mongoose/schemas/event");
@@ -49,7 +48,7 @@ exports.PROJECTION_MINIMIZED_EVENT = {
49
48
  */
50
49
  class MongoRepository {
51
50
  constructor(connection) {
52
- this.eventModel = connection.model(event_1.modelName, event_1.schema);
51
+ this.eventModel = connection.model(event_1.modelName, (0, event_1.createSchema)());
53
52
  }
54
53
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
55
54
  static CREATE_MONGO_CONDITIONS(conditions) {
@@ -468,6 +467,7 @@ class MongoRepository {
468
467
  */
469
468
  createMany(params) {
470
469
  return __awaiter(this, void 0, void 0, function* () {
470
+ const uniqid = yield Promise.resolve().then(() => require('uniqid'));
471
471
  let docs;
472
472
  try {
473
473
  docs = yield this.eventModel.insertMany(params.attributes.map((p) => {
@@ -494,6 +494,7 @@ class MongoRepository {
494
494
  */
495
495
  createManyIfNotExist(params) {
496
496
  return __awaiter(this, void 0, void 0, function* () {
497
+ const uniqid = yield Promise.resolve().then(() => require('uniqid'));
497
498
  const bulkWriteOps = [];
498
499
  const additionalProperties = [];
499
500
  if (Array.isArray(params)) {
@@ -554,6 +555,7 @@ class MongoRepository {
554
555
  */
555
556
  createScreeningEventSeriesIfNotExistByWorkPerformed(params) {
556
557
  return __awaiter(this, void 0, void 0, function* () {
558
+ const uniqid = yield Promise.resolve().then(() => require('uniqid'));
557
559
  const bulkWriteOps = [];
558
560
  if (Array.isArray(params)) {
559
561
  params.forEach((creatingEventParams) => {
@@ -624,6 +626,7 @@ class MongoRepository {
624
626
  let doc;
625
627
  try {
626
628
  if (params.id === undefined) {
629
+ const uniqid = yield Promise.resolve().then(() => require('uniqid'));
627
630
  const id = uniqid();
628
631
  doc = yield this.eventModel.create(Object.assign(Object.assign({}, params.attributes), { _id: id }));
629
632
  }
@@ -705,6 +708,7 @@ class MongoRepository {
705
708
  return __awaiter(this, void 0, void 0, function* () {
706
709
  let doc;
707
710
  const _a = params.attributes, { identifier, project, typeOf } = _a, updateFields = __rest(_a, ["identifier", "project", "typeOf"]);
711
+ const uniqid = yield Promise.resolve().then(() => require('uniqid'));
708
712
  const id = uniqid();
709
713
  doc = yield this.eventModel.findOneAndUpdate({
710
714
  'project.id': { $eq: params.attributes.project.id },
@@ -18,7 +18,7 @@ const settings_1 = require("../settings");
18
18
  */
19
19
  class MongoRepository {
20
20
  constructor(connection) {
21
- this.memberModel = connection.model(member_1.modelName, member_1.schema);
21
+ this.memberModel = connection.model(member_1.modelName, (0, member_1.createSchema)());
22
22
  }
23
23
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
24
24
  static CREATE_MONGO_CONDITIONS(params) {
@@ -29,7 +29,7 @@ const settings_1 = require("../settings");
29
29
  */
30
30
  class MongoRepository {
31
31
  constructor(connection) {
32
- this.merchantReturnPolicyModel = connection.model(merchantReturnPolicy_1.modelName, merchantReturnPolicy_1.schema);
32
+ this.merchantReturnPolicyModel = connection.model(merchantReturnPolicy_1.modelName, (0, merchantReturnPolicy_1.createSchema)());
33
33
  }
34
34
  // tslint:disable-next-line:max-func-body-length
35
35
  static CREATE_MONGO_CONDITIONS(params) {
@@ -1,57 +1,5 @@
1
- /// <reference types="mongoose/types/aggregate" />
2
- /// <reference types="mongoose/types/callback" />
3
- /// <reference types="mongoose/types/collection" />
4
- /// <reference types="mongoose/types/connection" />
5
- /// <reference types="mongoose/types/cursor" />
6
- /// <reference types="mongoose/types/document" />
7
- /// <reference types="mongoose/types/error" />
8
- /// <reference types="mongoose/types/expressions" />
9
- /// <reference types="mongoose/types/helpers" />
10
- /// <reference types="mongoose/types/middlewares" />
11
- /// <reference types="mongoose/types/indexes" />
12
- /// <reference types="mongoose/types/models" />
13
- /// <reference types="mongoose/types/mongooseoptions" />
14
- /// <reference types="mongoose/types/pipelinestage" />
15
- /// <reference types="mongoose/types/populate" />
16
- /// <reference types="mongoose/types/query" />
17
- /// <reference types="mongoose/types/schemaoptions" />
18
- /// <reference types="mongoose/types/schematypes" />
19
- /// <reference types="mongoose/types/session" />
20
- /// <reference types="mongoose/types/types" />
21
- /// <reference types="mongoose/types/utility" />
22
- /// <reference types="mongoose/types/validation" />
23
- /// <reference types="mongoose/types/virtuals" />
24
- /// <reference types="mongoose/types/inferschematype" />
25
- import { Schema } from 'mongoose';
1
+ import { IndexDefinition, IndexOptions, Schema } from 'mongoose';
26
2
  declare const modelName = "Account";
27
- /**
28
- * 口座スキーマ
29
- */
30
- declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
31
- collection: string;
32
- id: true;
33
- read: string;
34
- writeConcern: import("mongodb").WriteConcern;
35
- strict: false;
36
- strictQuery: false;
37
- useNestedStrict: boolean;
38
- timestamps: {
39
- createdAt: string;
40
- updatedAt: string;
41
- };
42
- toJSON: {
43
- getters: false;
44
- virtuals: false;
45
- minimize: false;
46
- versionKey: false;
47
- };
48
- toObject: {
49
- getters: false;
50
- virtuals: true;
51
- minimize: false;
52
- versionKey: false;
53
- };
54
- }, {}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{}>> & Omit<import("mongoose").FlatRecord<{}> & Required<{
55
- _id: unknown;
56
- }>, never>>;
57
- export { modelName, schema };
3
+ declare function createSchema(): Schema;
4
+ declare const indexes: [d: IndexDefinition, o: IndexOptions][];
5
+ export { modelName, indexes, createSchema };
@@ -1,22 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.schema = exports.modelName = void 0;
3
+ exports.createSchema = exports.indexes = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
6
  const settings_1 = require("../../../settings");
7
7
  const modelName = 'Account';
8
8
  exports.modelName = modelName;
9
- /**
10
- * 口座スキーマ
11
- */
12
- const schema = new mongoose_1.Schema({}, {
9
+ const schemaDefinition = {};
10
+ const schemaOptions = {
11
+ autoIndex: settings_1.MONGO_AUTO_INDEX,
12
+ autoCreate: false,
13
13
  collection: 'accounts',
14
14
  id: true,
15
15
  read: settings_1.MONGO_READ_PREFERENCE,
16
16
  writeConcern: writeConcern_1.writeConcern,
17
17
  strict: false,
18
18
  strictQuery: false,
19
- useNestedStrict: true,
20
19
  timestamps: {
21
20
  createdAt: 'createdAt',
22
21
  updatedAt: 'updatedAt'
@@ -33,30 +32,79 @@ const schema = new mongoose_1.Schema({}, {
33
32
  minimize: false,
34
33
  versionKey: false
35
34
  }
36
- });
37
- exports.schema = schema;
38
- // 口座タイプと口座番号でユニーク
39
- schema.index({
40
- accountType: 1,
41
- accountNumber: 1
42
- }, {
43
- unique: true,
44
- partialFilterExpression: {
45
- accountType: { $exists: true },
46
- accountNumber: { $exists: true }
35
+ };
36
+ /**
37
+ * 口座スキーマ
38
+ */
39
+ let schema;
40
+ function createSchema() {
41
+ if (schema === undefined) {
42
+ schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
47
43
  }
48
- });
49
- // 口座番号はグローバルユニーク
50
- schema.index({ accountNumber: 1 }, { name: 'uniqueAccountNumber', unique: true });
51
- schema.index({ createdAt: 1 }, { name: 'searchByCreatedAt' });
52
- schema.index({ updatedAt: 1 }, { name: 'searchByUpdatedAt' });
53
- schema.index({ 'project.id': 1, openDate: -1 }, {
54
- name: 'searchByProjectId-v20220721'
55
- });
56
- schema.index({ typeOf: 1, openDate: -1 }, { name: 'searchByTypeOf-v2' });
57
- schema.index({ accountNumber: 1, openDate: -1 }, { name: 'searchByAccountNumber-v2' });
58
- schema.index({ accountType: 1, openDate: -1 }, { name: 'searchByAccountType-v2' });
59
- schema.index({ name: 1, openDate: -1 }, { name: 'searchByName-v2' });
60
- schema.index({ openDate: -1 }, { name: 'searchByOpenDate-v2' });
61
- schema.index({ status: 1, openDate: -1 }, { name: 'searchByStatus-v2' });
62
- schema.index({ accountType: 1, accountNumber: 1, status: 1 }, { name: 'authorizeAmount' });
44
+ return schema;
45
+ }
46
+ exports.createSchema = createSchema;
47
+ const indexes = [
48
+ // 口座タイプと口座番号でユニーク
49
+ [
50
+ {
51
+ accountType: 1,
52
+ accountNumber: 1
53
+ },
54
+ {
55
+ unique: true,
56
+ partialFilterExpression: {
57
+ accountType: { $exists: true },
58
+ accountNumber: { $exists: true }
59
+ }
60
+ }
61
+ ],
62
+ // 口座番号はグローバルユニーク
63
+ [
64
+ { accountNumber: 1 },
65
+ { name: 'uniqueAccountNumber', unique: true }
66
+ ],
67
+ [
68
+ { createdAt: 1 },
69
+ { name: 'searchByCreatedAt' }
70
+ ],
71
+ [
72
+ { updatedAt: 1 },
73
+ { name: 'searchByUpdatedAt' }
74
+ ],
75
+ [
76
+ { 'project.id': 1, openDate: -1 },
77
+ {
78
+ name: 'searchByProjectId-v20220721'
79
+ }
80
+ ],
81
+ [
82
+ { typeOf: 1, openDate: -1 },
83
+ { name: 'searchByTypeOf-v2' }
84
+ ],
85
+ [
86
+ { accountNumber: 1, openDate: -1 },
87
+ { name: 'searchByAccountNumber-v2' }
88
+ ],
89
+ [
90
+ { accountType: 1, openDate: -1 },
91
+ { name: 'searchByAccountType-v2' }
92
+ ],
93
+ [
94
+ { name: 1, openDate: -1 },
95
+ { name: 'searchByName-v2' }
96
+ ],
97
+ [
98
+ { openDate: -1 },
99
+ { name: 'searchByOpenDate-v2' }
100
+ ],
101
+ [
102
+ { status: 1, openDate: -1 },
103
+ { name: 'searchByStatus-v2' }
104
+ ],
105
+ [
106
+ { accountType: 1, accountNumber: 1, status: 1 },
107
+ { name: 'authorizeAmount' }
108
+ ]
109
+ ];
110
+ exports.indexes = indexes;