@chevre/domain 21.2.0-alpha.13 → 21.2.0-alpha.131

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 (296) hide show
  1. package/example/src/chevre/aggregateEventReservation.ts +1 -1
  2. package/example/src/chevre/aggregation/aggregateSystem.ts +85 -27
  3. package/example/src/chevre/countDelayedTasks.ts +7 -2
  4. package/example/src/chevre/deleteTasksByName.ts +10 -2
  5. package/example/src/chevre/findMovieTheaterById.ts +40 -0
  6. package/example/src/chevre/importEventsFromCOA.ts +3 -4
  7. package/example/src/chevre/lockStockHolder.ts +5 -2
  8. package/example/src/chevre/migrateOrderAdditionalProperties.ts +85 -0
  9. package/example/src/chevre/migrateScreeningEventSeriesVersion.ts +79 -0
  10. package/example/src/chevre/processPay.ts +5 -1
  11. package/example/src/chevre/processRegisterMembership.ts +8 -4
  12. package/example/src/chevre/processRegisterPaymentCard.ts +8 -4
  13. package/example/src/chevre/processReserve.ts +5 -2
  14. package/example/src/chevre/saveTasks.ts +13 -10
  15. package/example/src/chevre/searchAbortedTasks.ts +34 -0
  16. package/example/src/chevre/searchActions.ts +33 -0
  17. package/example/src/chevre/searchEventSeats.ts +5 -2
  18. package/example/src/chevre/searchHoldReservations.ts +38 -0
  19. package/example/src/chevre/searchReservationNumbersByOrderNumbers.ts +37 -1
  20. package/example/src/chevre/searchScreeningRooms.ts +23 -0
  21. package/example/src/chevre/searchSendEmailActions.ts +44 -0
  22. package/example/src/chevre/task/executeTasks.ts +26 -0
  23. package/example/src/chevre/transaction/findCreditCard.ts +1 -1
  24. package/example/src/chevre/transaction/orderMembershipService.ts +1 -1
  25. package/example/src/chevre/transaction/processReturnOrder.ts +40 -0
  26. package/example/src/chevre/transaction/startExportTasks.ts +2 -1
  27. package/example/src/chevre/updateScreeningRoom.ts +41 -0
  28. package/example/src/chevre/updateTransaction.ts +1 -1
  29. package/example/src/playOnMoment.ts +24 -0
  30. package/lib/chevre/credentials.d.ts +1 -0
  31. package/lib/chevre/credentials.js +2 -1
  32. package/lib/chevre/eventEmitter/assetTransaction.d.ts +21 -0
  33. package/lib/chevre/eventEmitter/assetTransaction.js +25 -0
  34. package/lib/chevre/eventEmitter/task.d.ts +18 -0
  35. package/lib/chevre/eventEmitter/task.js +25 -0
  36. package/lib/chevre/eventEmitter/transaction.d.ts +21 -0
  37. package/lib/chevre/eventEmitter/transaction.js +25 -0
  38. package/lib/chevre/eventEmitter.d.ts +4 -0
  39. package/lib/chevre/eventEmitter.js +9 -0
  40. package/lib/chevre/index.d.ts +3 -2
  41. package/lib/chevre/index.js +5 -3
  42. package/lib/chevre/repo/account.js +3 -2
  43. package/lib/chevre/repo/accountTransaction.d.ts +3 -1
  44. package/lib/chevre/repo/accountTransaction.js +3 -2
  45. package/lib/chevre/repo/action.d.ts +42 -2
  46. package/lib/chevre/repo/action.js +130 -57
  47. package/lib/chevre/repo/additionalProperty.js +2 -1
  48. package/lib/chevre/repo/aggregation.d.ts +3 -0
  49. package/lib/chevre/repo/aggregation.js +3 -0
  50. package/lib/chevre/repo/assetTransaction.d.ts +23 -8
  51. package/lib/chevre/repo/assetTransaction.js +253 -80
  52. package/lib/chevre/repo/categoryCode.d.ts +1 -1
  53. package/lib/chevre/repo/categoryCode.js +37 -25
  54. package/lib/chevre/repo/code.js +3 -2
  55. package/lib/chevre/repo/comment.d.ts +4 -1
  56. package/lib/chevre/repo/comment.js +22 -6
  57. package/lib/chevre/repo/confirmationNumber.d.ts +0 -1
  58. package/lib/chevre/repo/confirmationNumber.js +3 -15
  59. package/lib/chevre/repo/creativeWork.d.ts +2 -4
  60. package/lib/chevre/repo/creativeWork.js +35 -12
  61. package/lib/chevre/repo/customer.js +2 -1
  62. package/lib/chevre/repo/emailMessage.d.ts +1 -27
  63. package/lib/chevre/repo/emailMessage.js +2 -1
  64. package/lib/chevre/repo/event.d.ts +27 -1
  65. package/lib/chevre/repo/event.js +67 -33
  66. package/lib/chevre/repo/member.js +4 -3
  67. package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -3
  68. package/lib/chevre/repo/merchantReturnPolicy.js +2 -1
  69. package/lib/chevre/repo/mongoose/schemas/account.d.ts +4 -2
  70. package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +29 -3
  71. package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +31 -3
  72. package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +1 -1
  73. package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +13 -3
  74. package/lib/chevre/repo/mongoose/schemas/action.d.ts +43 -3
  75. package/lib/chevre/repo/mongoose/schemas/action.js +19 -1
  76. package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +17 -3
  77. package/lib/chevre/repo/mongoose/schemas/aggregation.d.ts +4 -2
  78. package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +44 -3
  79. package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +32 -19
  80. package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +19 -3
  81. package/lib/chevre/repo/mongoose/schemas/authorization.js +1 -1
  82. package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +25 -3
  83. package/lib/chevre/repo/mongoose/schemas/comments.d.ts +27 -3
  84. package/lib/chevre/repo/mongoose/schemas/comments.js +1 -1
  85. package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +43 -3
  86. package/lib/chevre/repo/mongoose/schemas/customer.d.ts +25 -3
  87. package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +21 -3
  88. package/lib/chevre/repo/mongoose/schemas/event.d.ts +71 -3
  89. package/lib/chevre/repo/mongoose/schemas/holdReservation.d.ts +75 -0
  90. package/lib/chevre/repo/mongoose/schemas/holdReservation.js +92 -0
  91. package/lib/chevre/repo/mongoose/schemas/member.d.ts +13 -3
  92. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +21 -3
  93. package/lib/chevre/repo/mongoose/schemas/offer.d.ts +65 -3
  94. package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +27 -3
  95. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.d.ts +74 -0
  96. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.js +45 -0
  97. package/lib/chevre/repo/mongoose/schemas/order.d.ts +51 -3
  98. package/lib/chevre/repo/mongoose/schemas/order.js +1 -1
  99. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +25 -3
  100. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +1 -1
  101. package/lib/chevre/repo/mongoose/schemas/place.d.ts +49 -3
  102. package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +29 -3
  103. package/lib/chevre/repo/mongoose/schemas/product.d.ts +31 -3
  104. package/lib/chevre/repo/mongoose/schemas/project.d.ts +23 -3
  105. package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +63 -5
  106. package/lib/chevre/repo/mongoose/schemas/reservation.js +1 -1
  107. package/lib/chevre/repo/mongoose/schemas/role.d.ts +11 -3
  108. package/lib/chevre/repo/mongoose/schemas/seller.d.ts +31 -3
  109. package/lib/chevre/repo/mongoose/schemas/seller.js +6 -0
  110. package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +11 -3
  111. package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +1 -1
  112. package/lib/chevre/repo/mongoose/schemas/task.d.ts +30 -3
  113. package/lib/chevre/repo/mongoose/schemas/task.js +2 -1
  114. package/lib/chevre/repo/mongoose/schemas/telemetry.d.ts +21 -3
  115. package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +40 -3
  116. package/lib/chevre/repo/mongoose/schemas/transaction.js +2 -1
  117. package/lib/chevre/repo/mongoose/schemas/trip.d.ts +11 -3
  118. package/lib/chevre/repo/offer.js +3 -2
  119. package/lib/chevre/repo/offerCatalog.js +0 -27
  120. package/lib/chevre/repo/offerItemCondition.d.ts +22 -0
  121. package/lib/chevre/repo/offerItemCondition.js +121 -0
  122. package/lib/chevre/repo/order.d.ts +55 -3
  123. package/lib/chevre/repo/order.js +62 -10
  124. package/lib/chevre/repo/ownershipInfo.js +2 -7
  125. package/lib/chevre/repo/place.d.ts +20 -5
  126. package/lib/chevre/repo/place.js +63 -23
  127. package/lib/chevre/repo/priceSpecification.js +3 -2
  128. package/lib/chevre/repo/product.d.ts +1 -3
  129. package/lib/chevre/repo/product.js +25 -4
  130. package/lib/chevre/repo/project.js +2 -1
  131. package/lib/chevre/repo/reservation.d.ts +20 -4
  132. package/lib/chevre/repo/reservation.js +40 -59
  133. package/lib/chevre/repo/role.js +3 -2
  134. package/lib/chevre/repo/seller.d.ts +1 -1
  135. package/lib/chevre/repo/seller.js +44 -23
  136. package/lib/chevre/repo/serviceOutput.js +2 -1
  137. package/lib/chevre/repo/stockHolder.d.ts +139 -7
  138. package/lib/chevre/repo/stockHolder.js +569 -102
  139. package/lib/chevre/repo/task.d.ts +45 -2
  140. package/lib/chevre/repo/task.js +94 -15
  141. package/lib/chevre/repo/transaction.d.ts +21 -2
  142. package/lib/chevre/repo/transaction.js +171 -50
  143. package/lib/chevre/repo/trip.js +2 -1
  144. package/lib/chevre/repository.d.ts +5 -2
  145. package/lib/chevre/repository.js +8 -4
  146. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +6 -2
  147. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +8 -6
  148. package/lib/chevre/service/aggregation/system.d.ts +110 -23
  149. package/lib/chevre/service/aggregation/system.js +213 -91
  150. package/lib/chevre/service/assetTransaction/cancelReservation.js +1 -28
  151. package/lib/chevre/service/assetTransaction/moneyTransfer.js +2 -24
  152. package/lib/chevre/service/assetTransaction/pay/account/validation.js +1 -1
  153. package/lib/chevre/service/assetTransaction/pay/potentialActions.js +17 -1
  154. package/lib/chevre/service/assetTransaction/pay.d.ts +5 -1
  155. package/lib/chevre/service/assetTransaction/pay.js +20 -34
  156. package/lib/chevre/service/assetTransaction/refund.js +2 -24
  157. package/lib/chevre/service/assetTransaction/registerService.js +1 -25
  158. package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +15 -5
  159. package/lib/chevre/service/assetTransaction/reserve/factory.js +122 -58
  160. package/lib/chevre/service/assetTransaction/reserve.d.ts +10 -1
  161. package/lib/chevre/service/assetTransaction/reserve.js +92 -69
  162. package/lib/chevre/service/assetTransaction.d.ts +6 -0
  163. package/lib/chevre/service/assetTransaction.js +9 -4
  164. package/lib/chevre/service/event.js +25 -6
  165. package/lib/chevre/service/notification/factory.js +2 -2
  166. package/lib/chevre/service/notification.d.ts +3 -1
  167. package/lib/chevre/service/notification.js +41 -7
  168. package/lib/chevre/service/offer/event/authorize.d.ts +3 -0
  169. package/lib/chevre/service/offer/event/authorize.js +8 -2
  170. package/lib/chevre/service/offer/event/factory.d.ts +3 -0
  171. package/lib/chevre/service/offer/event/factory.js +16 -5
  172. package/lib/chevre/service/offer/event/importFromCOA.js +2 -2
  173. package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -0
  174. package/lib/chevre/service/offer/event/voidTransaction.js +17 -1
  175. package/lib/chevre/service/offer/eventServiceByCOA.js +7 -9
  176. package/lib/chevre/service/offer/product.js +2 -2
  177. package/lib/chevre/service/offer.d.ts +16 -8
  178. package/lib/chevre/service/offer.js +71 -8
  179. package/lib/chevre/service/order/deleteOrder.d.ts +3 -1
  180. package/lib/chevre/service/order/deleteOrder.js +8 -8
  181. package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +5 -2
  182. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +41 -81
  183. package/lib/chevre/service/order/onOrderStatusChanged.js +1 -3
  184. package/lib/chevre/service/order/onOrderUpdated.d.ts +16 -0
  185. package/lib/chevre/service/order/onOrderUpdated.js +22 -0
  186. package/lib/chevre/service/order/placeOrder.d.ts +1 -0
  187. package/lib/chevre/service/order/placeOrder.js +41 -24
  188. package/lib/chevre/service/order/returnOrder.d.ts +1 -0
  189. package/lib/chevre/service/order/returnOrder.js +7 -12
  190. package/lib/chevre/service/order/sendOrder.d.ts +1 -0
  191. package/lib/chevre/service/order/sendOrder.js +7 -10
  192. package/lib/chevre/service/order.d.ts +2 -1
  193. package/lib/chevre/service/order.js +3 -1
  194. package/lib/chevre/service/payment/any/onPaid.js +1 -1
  195. package/lib/chevre/service/payment/any/onRefund.js +1 -1
  196. package/lib/chevre/service/payment/any.d.ts +9 -5
  197. package/lib/chevre/service/payment/any.js +80 -18
  198. package/lib/chevre/service/payment/creditCard.d.ts +1 -1
  199. package/lib/chevre/service/payment/creditCard.js +23 -17
  200. package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +8 -7
  201. package/lib/chevre/service/payment/movieTicket/factory.d.ts +1 -1
  202. package/lib/chevre/service/payment/movieTicket/getCredentials.d.ts +1 -1
  203. package/lib/chevre/service/payment/movieTicket/getCredentials.js +1 -1
  204. package/lib/chevre/service/payment/movieTicket/validation.d.ts +6 -6
  205. package/lib/chevre/service/payment/movieTicket/validation.js +55 -32
  206. package/lib/chevre/service/payment/movieTicket.d.ts +2 -2
  207. package/lib/chevre/service/payment/movieTicket.js +7 -6
  208. package/lib/chevre/service/product.js +1 -5
  209. package/lib/chevre/service/report/telemetry.d.ts +0 -11
  210. package/lib/chevre/service/report/telemetry.js +21 -24
  211. package/lib/chevre/service/reserve/cancelReservation.d.ts +5 -3
  212. package/lib/chevre/service/reserve/cancelReservation.js +162 -142
  213. package/lib/chevre/service/reserve/checkInReservation.d.ts +9 -4
  214. package/lib/chevre/service/reserve/checkInReservation.js +77 -3
  215. package/lib/chevre/service/reserve/confirmReservation.d.ts +7 -4
  216. package/lib/chevre/service/reserve/confirmReservation.js +133 -58
  217. package/lib/chevre/service/reserve/factory.d.ts +1 -1
  218. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +17 -5
  219. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +26 -24
  220. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +2 -3
  221. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -31
  222. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +2 -3
  223. package/lib/chevre/service/reserve/useReservation.d.ts +7 -3
  224. package/lib/chevre/service/reserve/useReservation.js +61 -71
  225. package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +15 -0
  226. package/lib/chevre/service/reserve/verifyToken4reservation.js +56 -0
  227. package/lib/chevre/service/reserve.d.ts +3 -2
  228. package/lib/chevre/service/reserve.js +4 -2
  229. package/lib/chevre/service/task/aggregateScreeningEvent.js +1 -1
  230. package/lib/chevre/service/task/cancelPendingReservation.js +6 -2
  231. package/lib/chevre/service/task/cancelReservation.js +1 -1
  232. package/lib/chevre/service/task/confirmRegisterServiceTransaction.js +1 -1
  233. package/lib/chevre/service/task/deleteTransaction.js +10 -8
  234. package/lib/chevre/service/task/importOffersFromCOA.js +4 -0
  235. package/lib/chevre/service/task/onAuthorizationCreated.d.ts +7 -0
  236. package/lib/chevre/service/task/onAuthorizationCreated.js +108 -0
  237. package/lib/chevre/service/task/onEventChanged.d.ts +7 -0
  238. package/lib/chevre/service/task/{deleteOrder.js → onEventChanged.js} +8 -14
  239. package/lib/chevre/service/task/onResourceUpdated.d.ts +7 -0
  240. package/lib/chevre/service/task/onResourceUpdated.js +352 -0
  241. package/lib/chevre/service/task/placeOrder.js +1 -1
  242. package/lib/chevre/service/task/reserve.js +10 -7
  243. package/lib/chevre/service/task/returnOrder.js +1 -1
  244. package/lib/chevre/service/task/returnPayTransaction.js +2 -12
  245. package/lib/chevre/service/task/sendOrder.js +1 -1
  246. package/lib/chevre/service/task/useReservation.d.ts +7 -0
  247. package/lib/chevre/service/task/useReservation.js +36 -0
  248. package/lib/chevre/service/task/voidReserveTransaction.js +4 -2
  249. package/lib/chevre/service/task.d.ts +9 -0
  250. package/lib/chevre/service/task.js +43 -4
  251. package/lib/chevre/service/transaction/deleteTransaction.d.ts +21 -0
  252. package/lib/chevre/service/transaction/deleteTransaction.js +232 -0
  253. package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.js +11 -1
  254. package/lib/chevre/service/transaction/moneyTransfer/factory.d.ts +1 -1
  255. package/lib/chevre/service/transaction/moneyTransfer/factory.js +3 -1
  256. package/lib/chevre/service/transaction/moneyTransfer/potentialActions.d.ts +1 -0
  257. package/lib/chevre/service/transaction/moneyTransfer/potentialActions.js +1 -1
  258. package/lib/chevre/service/transaction/moneyTransfer.js +10 -13
  259. package/lib/chevre/service/transaction/orderProgramMembership/findCreditCard.js +1 -1
  260. package/lib/chevre/service/transaction/orderProgramMembership/findPaymentCardPermit.js +1 -1
  261. package/lib/chevre/service/transaction/orderProgramMembership.js +7 -3
  262. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +42 -30
  263. package/lib/chevre/service/transaction/placeOrder.js +1 -5
  264. package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +1 -1
  265. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.d.ts +1 -0
  266. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +1 -1
  267. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.d.ts +1 -0
  268. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +1 -1
  269. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.d.ts +1 -0
  270. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.d.ts +3 -0
  271. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +7 -3
  272. package/lib/chevre/service/transaction/placeOrderInProgress/result.d.ts +1 -0
  273. package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -2
  274. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.d.ts +1 -1
  275. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +2 -2
  276. package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +2 -1
  277. package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +23 -17
  278. package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +0 -3
  279. package/lib/chevre/service/transaction/placeOrderInProgress.js +28 -15
  280. package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +10 -1
  281. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +25 -17
  282. package/lib/chevre/service/transaction/returnOrder.d.ts +4 -0
  283. package/lib/chevre/service/transaction/returnOrder.js +228 -36
  284. package/lib/chevre/service/transaction.d.ts +7 -13
  285. package/lib/chevre/service/transaction.js +12 -139
  286. package/lib/chevre/settings.d.ts +13 -1
  287. package/lib/chevre/settings.js +56 -6
  288. package/package.json +5 -5
  289. package/example/src/chevre/createManyEventsIfNotExist.ts +0 -205
  290. package/example/src/chevre/eventCatalog2eventService.ts +0 -123
  291. package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +0 -96
  292. package/example/src/chevre/migrateMovieAdditionalProperties.ts +0 -98
  293. package/example/src/chevre/migrateStockHolderKeys.ts +0 -89
  294. package/lib/chevre/service/task/deleteAssetTransaction.d.ts +0 -12
  295. package/lib/chevre/service/task/deleteAssetTransaction.js +0 -65
  296. package/lib/chevre/service/task/deleteOrder.d.ts +0 -6
@@ -1,19 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.settings = exports.USE_NEW_CONFIRMATION_NUMBER_KEY_FROM = exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.ABORTED_TASKS_WITHOUT_REPORT = void 0;
3
+ exports.settings = exports.MONGO_MAX_TIME_MS = exports.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS = exports.USE_NEW_STOCK_HOLDER_REPO_IDS = exports.USE_NEW_STOCK_HOLDER_REPO_FROM = exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.ABORTED_TASKS_WITHOUT_REPORT = exports.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS = exports.TRIGGER_WEBHOOK_MAX_RETRY_COUNT = void 0;
4
4
  const moment = require("moment");
5
5
  const factory = require("./factory");
6
6
  const transactionWebhookUrls = (typeof process.env.INFORM_TRANSACTION_URL === 'string')
7
7
  ? process.env.INFORM_TRANSACTION_URL.split(' ')
8
8
  : [];
9
+ const informEventUrls = (typeof process.env.INFORM_EVENT_URL === 'string')
10
+ ? process.env.INFORM_EVENT_URL.split(' ')
11
+ : [];
9
12
  const informOrderUrls = (typeof process.env.INFORM_ORDER_URL === 'string')
10
13
  ? process.env.INFORM_ORDER_URL.split(' ')
11
14
  : [];
12
15
  const informReservationUrls = (typeof process.env.INFORM_RESERVATION_URL === 'string')
13
16
  ? process.env.INFORM_RESERVATION_URL.split(' ')
14
17
  : [];
18
+ const informResourceUrls = (typeof process.env.INFORM_RESOURCE_URL === 'string')
19
+ ? process.env.INFORM_RESOURCE_URL.split(' ')
20
+ : [];
15
21
  // tslint:disable-next-line:no-magic-numbers
16
22
  const triggerWebhookTimeout = (process.env.TRIGGER_WEBHOOK_TIMEOUT !== undefined) ? Number(process.env.TRIGGER_WEBHOOK_TIMEOUT) : 15000;
23
+ exports.TRIGGER_WEBHOOK_MAX_RETRY_COUNT = (typeof process.env.TRIGGER_WEBHOOK_MAX_RETRY_COUNT === 'string')
24
+ ? Number(process.env.TRIGGER_WEBHOOK_MAX_RETRY_COUNT)
25
+ : 0;
26
+ exports.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS = (typeof process.env.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS === 'string')
27
+ ? Number(process.env.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS)
28
+ : 0;
17
29
  const MAXIMUM_RESERVATION_GRACE_PERIOD_IN_DAYS = (typeof process.env.MAXIMUM_RESERVATION_GRACE_PERIOD_IN_DAYS === 'string')
18
30
  ? Number(process.env.MAXIMUM_RESERVATION_GRACE_PERIOD_IN_DAYS)
19
31
  // tslint:disable-next-line:no-magic-numbers
@@ -34,7 +46,10 @@ exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = (typeof process.env.ASSET_TRA
34
46
  /**
35
47
  * 取引保管期間(Confirmed)
36
48
  */
37
- exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = 365;
49
+ exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = (typeof process.env.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS === 'string')
50
+ ? Number(process.env.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS)
51
+ // tslint:disable-next-line:no-magic-numbers
52
+ : 365;
38
53
  /**
39
54
  * 取引保管期間(Canceled)
40
55
  */
@@ -44,18 +59,41 @@ exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = (typeof process.env.TRANSA
44
59
  : 7;
45
60
  exports.DEFAULT_SENDER_EMAIL = process.env.DEFAULT_SENDER_EMAIL;
46
61
  exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = String(process.env.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD);
62
+ exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = `${process.env.GAE_APPLICATION}:${process.env.GAE_SERVICE}:jobs`;
47
63
  exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = process.env.USE_ASSET_TRANSACTION_SYNC_PROCESSING === '1';
48
64
  exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = process.env.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING === '1';
49
65
  exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = (typeof process.env.USE_NEW_EVENT_AVAILABILITY_KEY_FROM === 'string')
50
66
  ? moment(process.env.USE_NEW_EVENT_AVAILABILITY_KEY_FROM)
51
67
  : moment('2023-08-31T15:00:00Z');
52
- exports.USE_NEW_CONFIRMATION_NUMBER_KEY_FROM = (typeof process.env.USE_NEW_CONFIRMATION_NUMBER_KEY_FROM === 'string')
53
- ? moment(process.env.USE_NEW_CONFIRMATION_NUMBER_KEY_FROM)
54
- : moment('2023-04-30T15:00:00Z');
68
+ exports.USE_NEW_STOCK_HOLDER_REPO_FROM = (typeof process.env.USE_NEW_STOCK_HOLDER_REPO_FROM === 'string')
69
+ ? moment(process.env.USE_NEW_STOCK_HOLDER_REPO_FROM)
70
+ : moment('2023-11-30T15:00:00Z');
71
+ exports.USE_NEW_STOCK_HOLDER_REPO_IDS = (typeof process.env.USE_NEW_STOCK_HOLDER_REPO_IDS === 'string')
72
+ ? process.env.USE_NEW_STOCK_HOLDER_REPO_IDS.split(' ')
73
+ : [];
74
+ exports.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS = (typeof process.env.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS === 'string')
75
+ ? Number(process.env.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS)
76
+ : 0;
77
+ exports.MONGO_MAX_TIME_MS = (typeof process.env.MONGO_MAX_TIME_MS === 'string')
78
+ ? Number(process.env.MONGO_MAX_TIME_MS)
79
+ // tslint:disable-next-line:no-magic-numbers
80
+ : 10000;
55
81
  /**
56
82
  * グローバル設定
57
83
  */
58
- exports.settings = Object.assign(Object.assign({ transactionWebhookUrls, onOrderStatusChanged: {
84
+ exports.settings = Object.assign(Object.assign({ transactionWebhookUrls, onEventChanged: {
85
+ informEvent: informEventUrls
86
+ .filter((url) => url.length > 0)
87
+ .map((url) => {
88
+ return {
89
+ recipient: {
90
+ typeOf: factory.creativeWorkType.WebApplication,
91
+ name: 'Global HUB',
92
+ url
93
+ }
94
+ };
95
+ })
96
+ }, onOrderStatusChanged: {
59
97
  informOrder: informOrderUrls
60
98
  .filter((url) => url.length > 0)
61
99
  .map((url) => {
@@ -67,6 +105,18 @@ exports.settings = Object.assign(Object.assign({ transactionWebhookUrls, onOrder
67
105
  }
68
106
  };
69
107
  })
108
+ }, onResourceUpdated: {
109
+ informResource: informResourceUrls
110
+ .filter((url) => url.length > 0)
111
+ .map((url) => {
112
+ return {
113
+ recipient: {
114
+ typeOf: factory.creativeWorkType.WebApplication,
115
+ name: 'Global HUB',
116
+ url
117
+ }
118
+ };
119
+ })
70
120
  },
71
121
  // 廃止(2022-10-29~)
72
122
  // onPaymentStatusChanged: {
package/package.json CHANGED
@@ -9,8 +9,8 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.311.0",
13
- "@cinerino/sdk": "3.154.0",
12
+ "@chevre/factory": "4.313.0-alpha.39",
13
+ "@cinerino/sdk": "3.157.0-alpha.16",
14
14
  "@motionpicture/coa-service": "9.2.0",
15
15
  "@motionpicture/gmo-service": "5.2.0",
16
16
  "@sendgrid/mail": "6.4.0",
@@ -58,7 +58,7 @@
58
58
  "googleapis": "^85.0.0",
59
59
  "json2csv": "4.5.4",
60
60
  "mocha": "^5.2.0",
61
- "mongoose": "6.10.4",
61
+ "mongoose": "7.0.5",
62
62
  "nock": "^9.6.1",
63
63
  "nyc": "^15.1.0",
64
64
  "power-assert": "^1.6.1",
@@ -74,7 +74,7 @@
74
74
  },
75
75
  "peerDependencies": {
76
76
  "aws-sdk": "^2.0.0",
77
- "mongoose": "^6.0.0",
77
+ "mongoose": "^7.0.5",
78
78
  "redis": "^4.6.5"
79
79
  },
80
80
  "engines": {
@@ -117,5 +117,5 @@
117
117
  "postversion": "git push origin --tags",
118
118
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
119
119
  },
120
- "version": "21.2.0-alpha.13"
120
+ "version": "21.2.0-alpha.131"
121
121
  }
@@ -1,205 +0,0 @@
1
- // tslint:disable:no-console
2
- import * as moment from 'moment';
3
- import * as mongoose from 'mongoose';
4
-
5
- import { chevre } from '../../../lib/index';
6
-
7
- const PROJECT_ID = String(process.env.PROJECT_ID);
8
- const filterName: string = 'eventIdentifier';
9
-
10
- // tslint:disable-next-line:max-func-body-length
11
- async function main() {
12
- await mongoose.connect(<string>process.env.MONGOLAB_URI);
13
-
14
- const eventRepo = new chevre.repository.Event(mongoose.connection);
15
-
16
- const result = await eventRepo.createManyIfNotExist<chevre.factory.eventType.ScreeningEvent>([
17
- {
18
- attributes: {
19
- additionalProperty: [{
20
- name: filterName,
21
- value: '20230201143000-03'
22
- }],
23
- project: {
24
- id: PROJECT_ID,
25
- typeOf: chevre.factory.organizationType.Project
26
- },
27
- typeOf: chevre.factory.eventType.ScreeningEvent,
28
- doorTime: moment('2023-02-01T05:00:00.000Z')
29
- .toDate(),
30
- startDate: moment('2023-02-01T05:00:00.000Z')
31
- .toDate(),
32
- endDate: moment('2023-02-01T06:00:00.000Z')
33
- .toDate(),
34
- // workPerformed: {
35
- // typeOf: chevre.factory.creativeWorkType.Movie,
36
- // identifier: '1622100',
37
- // id: '5bfb841d5a78d7948369980a',
38
- // name: {
39
- // en: 'Pet',
40
- // ja: 'ペット'
41
- // },
42
- // duration: 'PT2H3M'
43
- // },
44
- location: {
45
- typeOf: chevre.factory.placeType.ScreeningRoom,
46
- branchCode: '10',
47
- name: {
48
- ja: 'シネマ1',
49
- en: 'CINEMA1'
50
- },
51
- address: {
52
- ja: '7階',
53
- en: '7F'
54
- }
55
- },
56
- superEvent: {
57
- typeOf: chevre.factory.eventType.ScreeningEventSeries,
58
- project: {
59
- typeOf: chevre.factory.organizationType.Project,
60
- id: 'cinerino'
61
- },
62
- id: '7k9ayl8hc',
63
- videoFormat: [
64
- {
65
- typeOf: '2D',
66
- name: '2D'
67
- }
68
- ],
69
- soundFormat: [],
70
- workPerformed: {
71
- typeOf: chevre.factory.creativeWorkType.Movie,
72
- identifier: '1622100',
73
- id: '5bfb841d5a78d7948369980a',
74
- name: {
75
- en: 'Pet',
76
- ja: 'ペット'
77
- },
78
- duration: 'PT2H3M'
79
- },
80
- location: {
81
- typeOf: chevre.factory.placeType.MovieTheater,
82
- id: '5bfb841d5a78d7948369979a',
83
- branchCode: '118',
84
- name: {
85
- ja: 'シネモーション赤坂 ',
86
- en: 'CineMotion Akasaka'
87
- },
88
- kanaName: 'シネモーションアカサカ'
89
- },
90
- kanaName: 'ペットカナタイトル',
91
- name: {
92
- en: 'PetPetPetPet',
93
- ja: 'ペット'
94
- },
95
- additionalProperty: [
96
- {
97
- name: 'sortNumber',
98
- value: '99'
99
- }
100
- ],
101
- startDate: moment('2020-03-31T15:00:00.000Z')
102
- .toDate(),
103
- endDate: moment('2034-12-01T15:00:00.000Z')
104
- .toDate(),
105
- description: {
106
- en: 'english description',
107
- ja: 'ムビチケ検証用のイベントです。'
108
- },
109
- headline: {
110
- en: 'headlineheadlineheadlineheadlineheadlineheadlineheadline',
111
- ja: 'サブタイトルkanaName'
112
- },
113
- subtitleLanguage: {
114
- typeOf: 'Language',
115
- name: 'Japanese'
116
- }
117
- },
118
- name: {
119
- en: 'PetPetPetPet',
120
- ja: 'ペット'
121
- },
122
- eventStatus: chevre.factory.eventStatusType.EventScheduled,
123
- offers: {
124
- typeOf: chevre.factory.offerType.Offer,
125
- priceCurrency: chevre.factory.priceCurrency.JPY,
126
- availabilityEnds: moment('2023-02-01T01:20:00.000Z')
127
- .toDate(),
128
- availabilityStarts: moment('2023-01-30T15:00:00.000Z')
129
- .toDate(),
130
- eligibleQuantity: {
131
- typeOf: 'QuantitativeValue',
132
- unitCode: chevre.factory.unitCode.C62,
133
- maxValue: 6,
134
- value: 1
135
- },
136
- itemOffered: {
137
- id: '6308580bdef565000a9aa1fd',
138
- name: {
139
- ja: '通常興行カタログ'
140
- },
141
- serviceOutput: {
142
- typeOf: chevre.factory.reservationType.EventReservation,
143
- reservedTicket: {
144
- typeOf: 'Ticket',
145
- ticketedSeat: {
146
- typeOf: chevre.factory.placeType.Seat
147
- }
148
- }
149
- },
150
- typeOf: chevre.factory.product.ProductType.EventService,
151
- availableChannel: {
152
- typeOf: 'ServiceChannel',
153
- serviceLocation: {
154
- typeOf: chevre.factory.placeType.ScreeningRoom,
155
- branchCode: '10',
156
- name: {
157
- ja: 'シネマ1',
158
- en: 'CINEMA1'
159
- },
160
- containedInPlace: {
161
- typeOf: chevre.factory.placeType.MovieTheater,
162
- id: '5bfb841d5a78d7948369979a',
163
- branchCode: '118',
164
- name: {
165
- ja: 'シネモーション赤坂 ',
166
- en: 'CineMotion Akasaka'
167
- }
168
- }
169
- }
170
- },
171
- serviceType: {
172
- codeValue: '0001',
173
- id: '5e3361d01dc1ef1a20dd8737',
174
- inCodeSet: {
175
- typeOf: 'CategoryCodeSet',
176
- identifier: chevre.factory.categoryCode.CategorySetIdentifier.ServiceType
177
- },
178
- typeOf: 'CategoryCode'
179
- }
180
- },
181
- validFrom: moment('2023-01-29T15:00:00.000Z')
182
- .toDate(),
183
- validThrough: moment('2023-02-01T01:20:00.000Z')
184
- .toDate(),
185
- seller: {
186
- typeOf: chevre.factory.organizationType.Corporation,
187
- id: '59d20831e53ebc2b4e774466',
188
- name: {
189
- ja: 'シネモーション赤坂',
190
- en: 'CineMotion Akasaka'
191
- },
192
- makesOffer: []
193
- }
194
- }
195
- },
196
- filter: { name: filterName }
197
- }
198
- ]);
199
- console.log(result);
200
- console.log('upsertedIds:', (Array.isArray(result?.result.upserted)) ? result?.result.upserted.map((u: any) => u._id) : []);
201
- }
202
-
203
- main()
204
- .then(console.log)
205
- .catch(console.error);
@@ -1,123 +0,0 @@
1
- // tslint:disable:no-console
2
- import * as moment from 'moment';
3
- import * as mongoose from 'mongoose';
4
-
5
- import { chevre } from '../../../lib/index';
6
-
7
- // const project = { id: String(process.env.PROJECT_ID) };
8
-
9
- async function main() {
10
- await mongoose.connect(<string>process.env.MONGOLAB_URI);
11
-
12
- const eventRepo = new chevre.repository.Event(mongoose.connection);
13
- const offerCatalogRepo = new chevre.repository.OfferCatalog(mongoose.connection);
14
- const productRepo = new chevre.repository.Product(mongoose.connection);
15
-
16
- const cursor = eventRepo.getCursor(
17
- {
18
- // 'project.id': { $eq: project.id },
19
- 'project.id': { $ne: '' },
20
- typeOf: { $eq: chevre.factory.eventType.ScreeningEvent },
21
- startDate: {
22
- $gte: moment()
23
- .add(-1, 'month')
24
- .toDate()
25
- }
26
- // _id: { $eq: 'al6afd7np' }
27
- },
28
- {
29
- // _id: 1,
30
- }
31
- );
32
- console.log('events found');
33
-
34
- let i = 0;
35
- let updateCount = 0;
36
- await cursor.eachAsync(async (doc) => {
37
- i += 1;
38
- const event: chevre.factory.event.screeningEvent.IEvent = doc.toObject();
39
-
40
- const itemOfferedId = (<chevre.factory.event.screeningEvent.IOffer | undefined>event.offers)?.itemOffered?.id;
41
- const catalogId = (<any>event).hasOfferCatalog?.id;
42
-
43
- if (typeof catalogId === 'string' && catalogId.length > 0) {
44
- if (typeof itemOfferedId === 'string' && itemOfferedId.length > 0) {
45
- console.log(
46
- 'already exist...', event.project.id, event.id, event.startDate, itemOfferedId, i);
47
- } else {
48
- const existingCatalogs = await offerCatalogRepo.search({
49
- limit: 1,
50
- page: 1,
51
- project: { id: { $eq: event.project.id } },
52
- id: { $in: [catalogId] }
53
- });
54
- const existingCatalog = existingCatalogs.shift();
55
-
56
- if (existingCatalog !== undefined) {
57
- const existingProducts = await productRepo.search({
58
- limit: 1,
59
- page: 1,
60
- project: { id: { $eq: event.project.id } },
61
- productID: { $eq: `${chevre.factory.product.ProductType.EventService}${catalogId}` }
62
- });
63
- const existingProduct = existingProducts.shift();
64
- if (existingProduct === undefined) {
65
- throw new Error(`product not found ${event.id}`);
66
- }
67
- console.log(
68
- 'updating event...', event.project.id, event.id, event.startDate, itemOfferedId, i);
69
- await eventRepo.updatePartiallyById({
70
- id: event.id,
71
- attributes: <any>{
72
- typeOf: event.typeOf,
73
- 'offers.itemOffered.id': String(existingProduct.id)
74
- }
75
- });
76
- updateCount += 1;
77
- console.log(
78
- 'updated', event.project.id, event.id, event.startDate, itemOfferedId, i);
79
- } else {
80
- // カタログが存在しないのではもはや無効なのでスルー
81
- console.log(
82
- 'catalog not exist', event.project.id, event.id, event.startDate, itemOfferedId, i);
83
- }
84
- }
85
- } else {
86
- console.log(
87
- 'no catalog...', event.project.id, event.id, event.startDate, itemOfferedId, i);
88
- }
89
- });
90
-
91
- console.log(i, 'events checked');
92
- console.log(updateCount, 'events updated');
93
- }
94
-
95
- // function offerCatalog2eventService(offerCatalog: chevre.factory.offerCatalog.IOfferCatalog): chevre.factory.product.IProduct {
96
- // tslint:disable-next-line:max-line-length
97
- // const serviceType: chevre.factory.product.IServiceType | undefined = (typeof offerCatalog.itemOffered.serviceType?.typeOf === 'string')
98
- // ? {
99
- // codeValue: offerCatalog.itemOffered.serviceType.codeValue,
100
- // inCodeSet: offerCatalog.itemOffered.serviceType.inCodeSet,
101
- // project: offerCatalog.itemOffered.serviceType.project,
102
- // typeOf: offerCatalog.itemOffered.serviceType.typeOf
103
- // }
104
- // : undefined;
105
-
106
- // if (typeof offerCatalog.id !== 'string' || offerCatalog.id.length === 0) {
107
- // throw new Error('offerCatalog.id undefined');
108
- // }
109
-
110
- // return {
111
- // project: offerCatalog.project,
112
- // typeOf: chevre.factory.product.ProductType.EventService,
113
- // // productIDフォーマット確定(matches(/^[0-9a-zA-Z]+$/)に注意)(.isLength({ min: 3, max: 30 })に注意)
114
- // productID: `${chevre.factory.product.ProductType.EventService}${offerCatalog.id}`,
115
- // name: offerCatalog.name,
116
- // hasOfferCatalog: { id: offerCatalog.id, typeOf: offerCatalog.typeOf },
117
- // ...(typeof serviceType?.typeOf === 'string') ? { serviceType } : undefined
118
- // };
119
- // }
120
-
121
- main()
122
- .then()
123
- .catch(console.error);
@@ -1,96 +0,0 @@
1
- // tslint:disable:no-console
2
- import * as moment from 'moment';
3
- import * as mongoose from 'mongoose';
4
-
5
- import { chevre } from '../../../lib/index';
6
-
7
- const project = { id: String(process.env.PROJECT_ID) };
8
-
9
- // tslint:disable-next-line:max-func-body-length
10
- async function main() {
11
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
12
-
13
- const accountTransactionRepo = new chevre.repository.AccountTransaction(mongoose.connection);
14
- const assetTransactionRepo = new chevre.repository.AssetTransaction(mongoose.connection);
15
-
16
- const cursor = assetTransactionRepo.getCursor(
17
- {
18
- 'project.id': { $eq: project.id },
19
- typeOf: { $eq: chevre.factory.assetTransactionType.MoneyTransfer },
20
- startDate: {
21
- $gte: moment('2023-02-17T15:00:00Z')
22
- .toDate()
23
- }
24
- // _id: { $eq: 'al6aff83w' }
25
- },
26
- {
27
- // _id: 1,
28
- }
29
- );
30
- console.log('assetTransactions found');
31
-
32
- let i = 0;
33
- let updateCount = 0;
34
- // tslint:disable-next-line:max-func-body-length
35
- await cursor.eachAsync(async (doc) => {
36
- i += 1;
37
- const moneyTransferTransaction: chevre.factory.assetTransaction.moneyTransfer.ITransaction = doc.toObject();
38
-
39
- const description = moneyTransferTransaction.object.description;
40
- if (description !== '鑑賞' && description !== '受け取り') {
41
- console.log(
42
- 'no operation needed',
43
- description,
44
- moneyTransferTransaction.project.id,
45
- moneyTransferTransaction.transactionNumber,
46
- moneyTransferTransaction.startDate
47
- );
48
- } else {
49
- const pendingTransactionIdentifier = moneyTransferTransaction.object.pendingTransaction?.identifier;
50
- if (typeof pendingTransactionIdentifier === 'string' && pendingTransactionIdentifier.length > 0) {
51
- console.log(
52
- 'pendingTransactionIdentifier found',
53
- description,
54
- moneyTransferTransaction.project.id,
55
- moneyTransferTransaction.transactionNumber,
56
- moneyTransferTransaction.startDate
57
- );
58
- } else {
59
- // 口座取引からidentifierを取得
60
- const accountTransaction =
61
- await accountTransactionRepo.findByTransactionNumber({ transactionNumber: moneyTransferTransaction.transactionNumber });
62
- console.log(
63
- 'updating identifier...',
64
- accountTransaction.identifier,
65
- description,
66
- moneyTransferTransaction.project.id,
67
- moneyTransferTransaction.transactionNumber,
68
- moneyTransferTransaction.startDate
69
- );
70
- if (typeof accountTransaction.identifier === 'string') {
71
- await assetTransactionRepo.findByIdAndUpdate({
72
- id: moneyTransferTransaction.id,
73
- update: {
74
- 'object.pendingTransaction.identifier': accountTransaction.identifier
75
- }
76
- });
77
- }
78
- console.log(
79
- 'ientifier updated',
80
- accountTransaction.identifier,
81
- description,
82
- moneyTransferTransaction.project.id,
83
- moneyTransferTransaction.transactionNumber,
84
- moneyTransferTransaction.startDate
85
- );
86
- updateCount += 1;
87
- }
88
- }
89
- });
90
- console.log(i, 'assetTransactions checked');
91
- console.log(updateCount, 'assetTransactions updated');
92
- }
93
-
94
- main()
95
- .then()
96
- .catch(console.error);
@@ -1,98 +0,0 @@
1
- // tslint:disable:no-console
2
- // import * as moment from 'moment';
3
- import * as mongoose from 'mongoose';
4
-
5
- import { chevre } from '../../../lib/index';
6
-
7
- // const project = { id: String(process.env.PROJECT_ID) };
8
- const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
9
-
10
- // tslint:disable-next-line:max-func-body-length
11
- async function main() {
12
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
13
-
14
- const additionalPropertyRepo = new chevre.repository.AdditionalProperty(mongoose.connection);
15
- const creativeWorkRepo = new chevre.repository.CreativeWork(mongoose.connection);
16
-
17
- const cursor = creativeWorkRepo.getCursor(
18
- {
19
- // 'project.id': { $eq: project.id },
20
- 'project.id': { $ne: EXCLUDED_PROJECT_ID }
21
- },
22
- {
23
- // _id: 1,
24
- }
25
- );
26
- console.log('movies found');
27
-
28
- const additionalPropertyNames: string[] = [];
29
- const projectIds: string[] = [];
30
- const unexpextedprojectIds: string[] = [];
31
-
32
- let i = 0;
33
- let updateCount = 0;
34
- await cursor.eachAsync(async (doc) => {
35
- i += 1;
36
- const movie: chevre.factory.creativeWork.movie.ICreativeWork = doc.toObject();
37
-
38
- const additionalPropertyNamesOnEvent = movie.additionalProperty?.map((p) => p.name);
39
- if (Array.isArray(additionalPropertyNamesOnEvent) && additionalPropertyNamesOnEvent.length > 0) {
40
- console.log(
41
- additionalPropertyNamesOnEvent.length,
42
- 'additionalPropertyNamesOnEvent found',
43
- movie.project.id,
44
- movie.id
45
- );
46
- additionalPropertyNames.push(...additionalPropertyNamesOnEvent);
47
- projectIds.push(movie.project.id);
48
- additionalPropertyNamesOnEvent.forEach((name) => {
49
- if (!name.match(/^[a-zA-Z]*$/)) {
50
- // throw new Error(`not matched ${creativeWork.project.id} ${creativeWork.id}`);
51
- unexpextedprojectIds.push(movie.project.id);
52
- }
53
- // tslint:disable-next-line:no-magic-numbers
54
- if (name.length < 5) {
55
- // throw new Error(`length matched ${creativeWork.project.id} ${creativeWork.id} ${name}`);
56
- unexpextedprojectIds.push(movie.project.id);
57
- }
58
- });
59
-
60
- for (const additionalPropertyNameOnEvent of additionalPropertyNamesOnEvent) {
61
- const existings = await additionalPropertyRepo.search({
62
- project: { id: { $eq: movie.project.id } },
63
- limit: 1,
64
- page: 1,
65
- name: { $regex: `^${additionalPropertyNameOnEvent}$` }
66
- });
67
- if (existings.length > 0) {
68
- console.log('already existed', additionalPropertyNameOnEvent, movie.id, movie.project.id);
69
- } else {
70
- updateCount += 1;
71
- const newAdditionalProperty: chevre.factory.additionalProperty.IAdditionalProperty = {
72
- project: movie.project,
73
- typeOf: 'CategoryCode',
74
- codeValue: additionalPropertyNameOnEvent,
75
- inCodeSet: {
76
- typeOf: 'CategoryCodeSet',
77
- identifier: <chevre.factory.creativeWorkType.Movie>movie.typeOf
78
- },
79
- name: { ja: additionalPropertyNameOnEvent }
80
- };
81
- await additionalPropertyRepo.save({
82
- attributes: newAdditionalProperty
83
- });
84
- console.log('created', additionalPropertyNameOnEvent, movie.id, movie.project.id);
85
- }
86
- }
87
- }
88
- });
89
- console.log(i, 'events checked');
90
- console.log(updateCount, 'properties updated');
91
- console.log('additionalPropertyNames:', [...new Set(additionalPropertyNames)]);
92
- console.log('projectIds:', [...new Set(projectIds)]);
93
- console.log('unexpextedprojectIds:', [...new Set(unexpextedprojectIds)]);
94
- }
95
-
96
- main()
97
- .then()
98
- .catch(console.error);