@chevre/domain 22.0.0-alpha.0 → 22.0.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (252) hide show
  1. package/example/src/chevre/aggregateAllEvents2.ts +41 -2
  2. package/example/src/chevre/aggregation/aggregateSystem.ts +24 -12
  3. package/example/src/chevre/findReservationByCode.ts +17 -5
  4. package/example/src/chevre/findValidAuthorization.ts +16 -4
  5. package/example/src/chevre/importCategoryCodesFromCOA.ts +8 -11
  6. package/example/src/chevre/importEventsFromCOA.ts +15 -1
  7. package/example/src/chevre/migrateCognitoUser.ts +18 -2
  8. package/example/src/chevre/person/updateProfile.ts +10 -1
  9. package/example/src/chevre/processOrder.ts +4 -1
  10. package/example/src/chevre/searchReservationsByOrder.ts +15 -3
  11. package/lib/chevre/credentials/coa.d.ts +17 -0
  12. package/lib/chevre/credentials/coa.js +17 -0
  13. package/lib/chevre/credentials/customSearch.d.ts +13 -0
  14. package/lib/chevre/credentials/customSearch.js +14 -0
  15. package/lib/chevre/credentials/jwt.d.ts +23 -0
  16. package/lib/chevre/credentials/jwt.js +18 -0
  17. package/lib/chevre/credentials/lineNotify.d.ts +17 -0
  18. package/lib/chevre/credentials/lineNotify.js +16 -0
  19. package/lib/chevre/credentials/sendGrid.d.ts +11 -0
  20. package/lib/chevre/credentials/sendGrid.js +13 -0
  21. package/lib/chevre/credentials.d.ts +28 -57
  22. package/lib/chevre/credentials.js +91 -69
  23. package/lib/chevre/emailMessageBuilder.d.ts +4 -3
  24. package/lib/chevre/emailMessageBuilder.js +8 -9
  25. package/lib/chevre/index.d.ts +2 -0
  26. package/lib/chevre/index.js +11 -1
  27. package/lib/chevre/repo/aggregation.d.ts +1 -0
  28. package/lib/chevre/repo/aggregation.js +1 -0
  29. package/lib/chevre/repo/authorization.d.ts +1 -2
  30. package/lib/chevre/repo/order.d.ts +25 -0
  31. package/lib/chevre/repo/order.js +67 -0
  32. package/lib/chevre/repo/person.d.ts +3 -2
  33. package/lib/chevre/repo/person.js +11 -10
  34. package/lib/chevre/repo/rateLimit/offer.js +0 -8
  35. package/lib/chevre/repo/stockHolder.js +0 -7
  36. package/lib/chevre/repo/transaction.d.ts +0 -6
  37. package/lib/chevre/repo/transaction.js +23 -36
  38. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +2 -1
  39. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +7 -8
  40. package/lib/chevre/service/aggregation/event/importFromCOA.d.ts +5 -0
  41. package/lib/chevre/service/aggregation/event/importFromCOA.js +1 -15
  42. package/lib/chevre/service/aggregation/system.d.ts +16 -1
  43. package/lib/chevre/service/aggregation/system.js +35 -1
  44. package/lib/chevre/service/assetTransaction/cancelReservationCOA.d.ts +4 -2
  45. package/lib/chevre/service/assetTransaction/cancelReservationCOA.js +3 -17
  46. package/lib/chevre/service/assetTransaction/pay.d.ts +6 -5
  47. package/lib/chevre/service/assetTransaction/pay.js +15 -15
  48. package/lib/chevre/service/assetTransaction/reserve/cancel.d.ts +2 -1
  49. package/lib/chevre/service/assetTransaction/reserve/cancel.js +2 -2
  50. package/lib/chevre/service/assetTransaction/reserve/confirm.d.ts +2 -1
  51. package/lib/chevre/service/assetTransaction/reserve/confirm.js +3 -4
  52. package/lib/chevre/service/assetTransaction/reserve/exportTasksById.d.ts +2 -1
  53. package/lib/chevre/service/assetTransaction/reserve/exportTasksById.js +4 -4
  54. package/lib/chevre/service/assetTransaction/reserve/start.d.ts +5 -0
  55. package/lib/chevre/service/assetTransaction/reserve/start.js +8 -8
  56. package/lib/chevre/service/assetTransaction/reserveCOA.d.ts +5 -0
  57. package/lib/chevre/service/assetTransaction/reserveCOA.js +3 -17
  58. package/lib/chevre/service/assetTransaction.d.ts +3 -2
  59. package/lib/chevre/service/assetTransaction.js +3 -9
  60. package/lib/chevre/service/code.d.ts +21 -10
  61. package/lib/chevre/service/code.js +74 -70
  62. package/lib/chevre/service/event.d.ts +7 -1
  63. package/lib/chevre/service/event.js +13 -35
  64. package/lib/chevre/service/notification.d.ts +12 -3
  65. package/lib/chevre/service/notification.js +26 -25
  66. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +8 -0
  67. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.js +8 -7
  68. package/lib/chevre/service/offer/event/authorize.d.ts +19 -8
  69. package/lib/chevre/service/offer/event/authorize.js +4 -4
  70. package/lib/chevre/service/offer/event/importFromCOA.d.ts +1 -1
  71. package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.d.ts +2 -1
  72. package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.js +2 -2
  73. package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4coa.d.ts +5 -1
  74. package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4coa.js +5 -19
  75. package/lib/chevre/service/offer/event/voidTransaction.d.ts +4 -1
  76. package/lib/chevre/service/offer/event/voidTransaction.js +4 -4
  77. package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +4 -1
  78. package/lib/chevre/service/offer/event/voidTransactionByActionId.js +3 -3
  79. package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.d.ts +1 -1
  80. package/lib/chevre/service/offer/factory.js +2 -3
  81. package/lib/chevre/service/offer/onEventChanged.d.ts +2 -1
  82. package/lib/chevre/service/offer/onEventChanged.js +24 -26
  83. package/lib/chevre/service/offer/product/searchProductOffers.js +1 -6
  84. package/lib/chevre/service/order/deleteOrder.js +3 -44
  85. package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +4 -3
  86. package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +10 -17
  87. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.d.ts +2 -1
  88. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.js +3 -4
  89. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.d.ts +2 -1
  90. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +2 -2
  91. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +2 -1
  92. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.js +3 -4
  93. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.d.ts +2 -1
  94. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.js +2 -2
  95. package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.d.ts +2 -1
  96. package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +4 -6
  97. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.d.ts +2 -1
  98. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +3 -4
  99. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/processOrder.d.ts +1 -0
  100. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/processOrder.js +3 -3
  101. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +2 -1
  102. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +11 -5
  103. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +2 -1
  104. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +4 -6
  105. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.d.ts +2 -1
  106. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +2 -2
  107. package/lib/chevre/service/order/onOrderUpdated/factory.d.ts +2 -1
  108. package/lib/chevre/service/order/onOrderUpdated/factory.js +3 -4
  109. package/lib/chevre/service/order/onOrderUpdated.d.ts +2 -1
  110. package/lib/chevre/service/order/onOrderUpdated.js +2 -2
  111. package/lib/chevre/service/order/payOrder.d.ts +2 -1
  112. package/lib/chevre/service/order/payOrder.js +2 -2
  113. package/lib/chevre/service/order/placeOrder.d.ts +2 -1
  114. package/lib/chevre/service/order/placeOrder.js +2 -2
  115. package/lib/chevre/service/order/returnOrder.d.ts +2 -1
  116. package/lib/chevre/service/order/returnOrder.js +2 -2
  117. package/lib/chevre/service/order/sendOrder.d.ts +2 -1
  118. package/lib/chevre/service/order/sendOrder.js +6 -11
  119. package/lib/chevre/service/payment/any/person2username.d.ts +3 -1
  120. package/lib/chevre/service/payment/any/person2username.js +3 -3
  121. package/lib/chevre/service/payment/any.d.ts +8 -4
  122. package/lib/chevre/service/payment/any.js +15 -12
  123. package/lib/chevre/service/payment/creditCard/authorize.d.ts +2 -1
  124. package/lib/chevre/service/payment/creditCard/authorize.js +5 -6
  125. package/lib/chevre/service/payment/creditCard/payCreditCard.d.ts +2 -1
  126. package/lib/chevre/service/payment/creditCard/payCreditCard.js +3 -4
  127. package/lib/chevre/service/payment/creditCard/refundCreditCard.d.ts +2 -1
  128. package/lib/chevre/service/payment/creditCard/refundCreditCard.js +3 -4
  129. package/lib/chevre/service/payment/creditCard/searchGMOTrade.d.ts +2 -1
  130. package/lib/chevre/service/payment/creditCard/searchGMOTrade.js +3 -4
  131. package/lib/chevre/service/payment/creditCard/voidTransaction.d.ts +2 -1
  132. package/lib/chevre/service/payment/creditCard/voidTransaction.js +3 -4
  133. package/lib/chevre/service/payment/factory/createPayObjectServiceOutput.js +3 -6
  134. package/lib/chevre/service/payment/movieTicket/authorize.d.ts +2 -1
  135. package/lib/chevre/service/payment/movieTicket/authorize.js +3 -3
  136. package/lib/chevre/service/payment/movieTicket/checkMovieTicket.d.ts +2 -1
  137. package/lib/chevre/service/payment/movieTicket/checkMovieTicket.js +2 -2
  138. package/lib/chevre/service/payment/movieTicket/payMovieTicket.d.ts +2 -1
  139. package/lib/chevre/service/payment/movieTicket/payMovieTicket.js +2 -3
  140. package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.d.ts +2 -1
  141. package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.js +2 -4
  142. package/lib/chevre/service/payment/movieTicket/refundMovieTicket.d.ts +2 -1
  143. package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +2 -3
  144. package/lib/chevre/service/payment/movieTicket/validation.d.ts +2 -1
  145. package/lib/chevre/service/payment/movieTicket/validation.js +5 -6
  146. package/lib/chevre/service/payment/movieTicket/voidTransaction.d.ts +2 -1
  147. package/lib/chevre/service/payment/movieTicket/voidTransaction.js +2 -2
  148. package/lib/chevre/service/payment.d.ts +4 -3
  149. package/lib/chevre/service/payment.js +9 -9
  150. package/lib/chevre/service/reserve/cancelReservation.d.ts +3 -2
  151. package/lib/chevre/service/reserve/cancelReservation.js +4 -4
  152. package/lib/chevre/service/reserve/checkInReservation.d.ts +2 -1
  153. package/lib/chevre/service/reserve/checkInReservation.js +5 -5
  154. package/lib/chevre/service/reserve/confirmReservation.d.ts +2 -1
  155. package/lib/chevre/service/reserve/confirmReservation.js +2 -2
  156. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +2 -1
  157. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +2 -3
  158. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.d.ts +2 -1
  159. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +2 -3
  160. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +2 -1
  161. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -3
  162. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.d.ts +2 -1
  163. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +3 -4
  164. package/lib/chevre/service/reserve/searchByOrder.d.ts +2 -0
  165. package/lib/chevre/service/reserve/searchByOrder.js +1 -12
  166. package/lib/chevre/service/reserve/useReservation.d.ts +2 -1
  167. package/lib/chevre/service/reserve/useReservation.js +5 -5
  168. package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +3 -0
  169. package/lib/chevre/service/reserve/verifyToken4reservation.js +4 -3
  170. package/lib/chevre/service/task/acceptCOAOffer.js +17 -14
  171. package/lib/chevre/service/task/aggregateScreeningEvent.js +12 -12
  172. package/lib/chevre/service/task/authorizePayment.js +21 -18
  173. package/lib/chevre/service/task/cancelPendingReservation.js +9 -9
  174. package/lib/chevre/service/task/cancelReservation.js +9 -9
  175. package/lib/chevre/service/task/checkMovieTicket.js +9 -9
  176. package/lib/chevre/service/task/confirmReserveTransaction.d.ts +4 -1
  177. package/lib/chevre/service/task/confirmReserveTransaction.js +29 -11
  178. package/lib/chevre/service/task/importEventCapacitiesFromCOA.js +20 -3
  179. package/lib/chevre/service/task/importEventsFromCOA.js +26 -8
  180. package/lib/chevre/service/task/importOffersFromCOA.js +18 -12
  181. package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +7 -7
  182. package/lib/chevre/service/task/onAuthorizationCreated.js +13 -13
  183. package/lib/chevre/service/task/onEventChanged.js +5 -5
  184. package/lib/chevre/service/task/onOrderPaymentCompleted.js +6 -6
  185. package/lib/chevre/service/task/onResourceUpdated/onAggregateOfferUpdated.d.ts +2 -1
  186. package/lib/chevre/service/task/onResourceUpdated/onAggregateOfferUpdated.js +2 -3
  187. package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.d.ts +2 -1
  188. package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.js +3 -3
  189. package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.d.ts +2 -1
  190. package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.js +2 -3
  191. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +2 -1
  192. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +2 -2
  193. package/lib/chevre/service/task/onResourceUpdated.js +27 -21
  194. package/lib/chevre/service/task/pay.js +14 -14
  195. package/lib/chevre/service/task/placeOrder.js +2 -2
  196. package/lib/chevre/service/task/publishPaymentUrl.js +11 -11
  197. package/lib/chevre/service/task/refund.js +13 -13
  198. package/lib/chevre/service/task/reserve.js +6 -6
  199. package/lib/chevre/service/task/returnOrder.js +8 -8
  200. package/lib/chevre/service/task/returnReserveTransaction.js +27 -8
  201. package/lib/chevre/service/task/sendEmailMessage.js +5 -5
  202. package/lib/chevre/service/task/sendOrder.js +8 -8
  203. package/lib/chevre/service/task/triggerWebhook.js +5 -5
  204. package/lib/chevre/service/task/useReservation.js +7 -7
  205. package/lib/chevre/service/task/voidPayTransaction.js +10 -10
  206. package/lib/chevre/service/task/voidPayment.js +10 -10
  207. package/lib/chevre/service/task/voidReserveTransaction.js +29 -12
  208. package/lib/chevre/service/task.d.ts +25 -5
  209. package/lib/chevre/service/task.js +11 -22
  210. package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.d.ts +2 -1
  211. package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.js +3 -4
  212. package/lib/chevre/service/transaction/moneyTransfer.d.ts +8 -2
  213. package/lib/chevre/service/transaction/moneyTransfer.js +14 -13
  214. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.d.ts +2 -1
  215. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.js +2 -2
  216. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.d.ts +2 -1
  217. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.js +2 -2
  218. package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateMovieTicket.js +60 -71
  219. package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +5 -0
  220. package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +5 -5
  221. package/lib/chevre/service/transaction/placeOrder/confirm.d.ts +18 -14
  222. package/lib/chevre/service/transaction/placeOrder/confirm.js +8 -8
  223. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +2 -1
  224. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +4 -5
  225. package/lib/chevre/service/transaction/placeOrder/exportTasksById.d.ts +2 -1
  226. package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +2 -2
  227. package/lib/chevre/service/transaction/placeOrder.d.ts +1 -3
  228. package/lib/chevre/service/transaction/placeOrder.js +3 -5
  229. package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.d.ts +2 -1
  230. package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +3 -4
  231. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.d.ts +2 -1
  232. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +7 -7
  233. package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.d.ts +2 -1
  234. package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +2 -2
  235. package/lib/chevre/service/transaction/returnOrder/potentialActions.d.ts +2 -1
  236. package/lib/chevre/service/transaction/returnOrder/potentialActions.js +3 -4
  237. package/lib/chevre/service/transaction/returnOrder.d.ts +3 -2
  238. package/lib/chevre/service/transaction/returnOrder.js +4 -4
  239. package/lib/chevre/service/transaction.d.ts +3 -2
  240. package/lib/chevre/service/transaction.js +7 -12
  241. package/lib/chevre/settings.d.ts +114 -33
  242. package/lib/chevre/settings.js +27 -152
  243. package/package.json +10 -10
  244. package/example/src/chevre/aggregation/aggregateEventReservation.ts +0 -40
  245. package/example/src/chevre/importOffersFromCOA.ts +0 -44
  246. package/example/src/chevre/notifyAbortedTasks.ts +0 -25
  247. package/example/src/chevre/onAssetTransactionStatusChanged.ts +0 -36
  248. package/example/src/chevre/ownershipInfosCsv2peopleJson.ts +0 -181
  249. package/example/src/chevre/person/globalSignOutAndDisable.ts +0 -23
  250. package/example/src/chevre/person/search.ts +0 -38
  251. package/example/src/chevre/report2developers.ts +0 -39
  252. package/example/src/chevre/sendOrder.ts +0 -37
@@ -35,8 +35,47 @@ export async function aggregateScreeningEvent() {
35
35
  try {
36
36
  console.log('executing...', count);
37
37
  await (await chevre.service.task.createService()).executeByName({
38
- name: chevre.factory.taskName.AggregateScreeningEvent
39
- })({ connection: mongoose.connection, redisClient: redisClient });
38
+ name: chevre.factory.taskName.AggregateScreeningEvent,
39
+ executor: { name: 'sample' }
40
+ })({
41
+ connection: mongoose.connection,
42
+ redisClient,
43
+ credentials: {
44
+ sendGrid: await chevre.credentials.SendGrid.createInstance({ apiKey: 'xxx' })
45
+ },
46
+ settings: new chevre.settings.Settings({
47
+ onEventChanged: {
48
+ informEvent: []
49
+ },
50
+ onOrderStatusChanged: {
51
+ informOrder: []
52
+ },
53
+ onResourceUpdated: {
54
+ informResource: []
55
+ },
56
+ onReservationStatusChanged: {
57
+ informReservation: []
58
+ },
59
+ notification: {
60
+ timeout: 1000,
61
+ useFetchAPI: true
62
+ },
63
+ userPoolIdOld: '',
64
+ userPoolIdNew: '',
65
+ useAggregateEntranceGateProjects: [],
66
+ useAggregateOfferProjects: [],
67
+ useOfferRateLimitProjects: [],
68
+ defaultSenderEmail: 'test@example.com',
69
+ deliverOrderLimit: 1,
70
+ transaction: { informUrls: [], confirmedStoragePeriodInDays: 365, canceledStoragePeriodInDays: 365 },
71
+ abortedTasksWithoutReport: [],
72
+ gmo: { timeout: 1000, timeoutBackground: 1000, useFetch: true },
73
+ movieticketReserve: { timeout: 1000, timeoutCheck: 1000 },
74
+ numTryConfirmReserveTransaction: 10,
75
+ useAssetTransactionSyncProcessing: true,
76
+ useExperimentalFeature: false
77
+ })
78
+ });
40
79
  console.log('executed', count);
41
80
  } catch (error) {
42
81
  console.error(error);
@@ -16,6 +16,7 @@ async function main() {
16
16
 
17
17
  const aggregationRepo = await chevre.repository.Aggregation.createInstance(mongoose.connection);
18
18
  const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
19
+ const orderRepo = await chevre.repository.Order.createInstance(mongoose.connection);
19
20
  const transactionRepo = await chevre.repository.Transaction.createInstance(mongoose.connection);
20
21
  const assetTransactionRepo = await chevre.repository.AssetTransaction.createInstance(mongoose.connection);
21
22
  const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
@@ -23,17 +24,30 @@ async function main() {
23
24
 
24
25
  let result: { aggregationCount: number; aggregateDuration: string };
25
26
 
26
- result = await (await chevre.service.aggregation.createService()).system.aggregateReserveAction({
27
+ result = await (await chevre.service.aggregation.createService()).system.aggregateOrder({
27
28
  aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
28
29
  aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
29
30
  excludedProjectId: EXCLUDED_PROJECT_ID
30
31
  })({
31
32
  agregation: aggregationRepo,
32
- action: actionRepo
33
+ order: orderRepo
33
34
  });
34
- console.log('aggregateReserveAction processed.', result);
35
+ console.log('aggregateOrder processed.', result);
36
+ // return;
35
37
 
36
- result = await (await chevre.service.aggregation.createService()).system.aggregateOrderAction({
38
+ result = await (await chevre.service.aggregation.createService()).system.aggregatePlaceOrder({
39
+ aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
40
+ aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
41
+ excludedProjectId: EXCLUDED_PROJECT_ID,
42
+ clientIds: AGGREGATE_CLIENT_IDS
43
+ })({
44
+ agregation: aggregationRepo,
45
+ transaction: transactionRepo
46
+ });
47
+ console.log('aggregatePlaceOrder processed.', result);
48
+ // return;
49
+
50
+ result = await (await chevre.service.aggregation.createService()).system.aggregateReserveAction({
37
51
  aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
38
52
  aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
39
53
  excludedProjectId: EXCLUDED_PROJECT_ID
@@ -43,7 +57,7 @@ async function main() {
43
57
  });
44
58
  console.log('aggregateReserveAction processed.', result);
45
59
 
46
- result = await (await chevre.service.aggregation.createService()).system.aggregateCancelReservationAction({
60
+ result = await (await chevre.service.aggregation.createService()).system.aggregateOrderAction({
47
61
  aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
48
62
  aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
49
63
  excludedProjectId: EXCLUDED_PROJECT_ID
@@ -51,19 +65,17 @@ async function main() {
51
65
  agregation: aggregationRepo,
52
66
  action: actionRepo
53
67
  });
54
- console.log('aggregateCancelReservationAction processed.', result);
68
+ console.log('aggregateReserveAction processed.', result);
55
69
 
56
- result = await (await chevre.service.aggregation.createService()).system.aggregatePlaceOrder({
70
+ result = await (await chevre.service.aggregation.createService()).system.aggregateCancelReservationAction({
57
71
  aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
58
72
  aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
59
- excludedProjectId: EXCLUDED_PROJECT_ID,
60
- clientIds: AGGREGATE_CLIENT_IDS
73
+ excludedProjectId: EXCLUDED_PROJECT_ID
61
74
  })({
62
75
  agregation: aggregationRepo,
63
- transaction: transactionRepo
76
+ action: actionRepo
64
77
  });
65
- console.log('aggregatePlaceOrder processed.', result);
66
- // return;
78
+ console.log('aggregateCancelReservationAction processed.', result);
67
79
 
68
80
  result = await (await chevre.service.aggregation.createService()).system.aggregateTask({
69
81
  aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
@@ -28,11 +28,23 @@ async function main() {
28
28
  ticket: {
29
29
  ticketToken: CODE
30
30
  }
31
- })({
32
- authorization: authorizationRepo,
33
- order: orderRepo,
34
- ticket: ticketRepo
35
- });
31
+ })(
32
+ {
33
+ authorization: authorizationRepo,
34
+ order: orderRepo,
35
+ ticket: ticketRepo
36
+ },
37
+ {
38
+ jwt: await chevre.credentials.JWT.createInstance({
39
+ secret: <string>process.env.TOKEN_SECRET,
40
+ issuers: (typeof process.env.TOKEN_ISSUERS_BY_AUTHORIZATION === 'string')
41
+ ? process.env.TOKEN_ISSUERS_BY_AUTHORIZATION.split(' ')
42
+ : [],
43
+ version: (typeof process.env.TOKEN_VERSION === 'string') ? process.env.TOKEN_VERSION : '2024-05-02',
44
+ payloadTypPrefix: (typeof process.env.TOKEN_PAYLOAD_TYP_PREFIX === 'string') ? process.env.TOKEN_PAYLOAD_TYP_PREFIX : 'chevre'
45
+ })
46
+ }
47
+ );
36
48
  console.log('verified.');
37
49
 
38
50
  const result = await (await chevre.service.reserve.createService()).findByCode({
@@ -33,10 +33,22 @@ async function main() {
33
33
  issuer: 'https://example.com',
34
34
  audience: 'https://example.com',
35
35
  useJti: true
36
- })({
37
- authorization: authorizationRepo,
38
- ticket: ticketRepo
39
- });
36
+ })(
37
+ {
38
+ authorization: authorizationRepo,
39
+ ticket: ticketRepo
40
+ },
41
+ {
42
+ jwt: await chevre.credentials.JWT.createInstance({
43
+ secret: <string>process.env.TOKEN_SECRET,
44
+ issuers: (typeof process.env.TOKEN_ISSUERS_BY_AUTHORIZATION === 'string')
45
+ ? process.env.TOKEN_ISSUERS_BY_AUTHORIZATION.split(' ')
46
+ : [],
47
+ version: (typeof process.env.TOKEN_VERSION === 'string') ? process.env.TOKEN_VERSION : '2024-05-02',
48
+ payloadTypPrefix: (typeof process.env.TOKEN_PAYLOAD_TYP_PREFIX === 'string') ? process.env.TOKEN_PAYLOAD_TYP_PREFIX : 'chevre'
49
+ })
50
+ }
51
+ );
40
52
  console.log('token:', token);
41
53
  }
42
54
 
@@ -1,28 +1,25 @@
1
1
  // tslint:disable:no-console
2
- import * as COA from '@motionpicture/coa-service';
3
- // import * as redis from 'redis';
4
2
  import * as mongoose from 'mongoose';
5
3
 
6
4
  import { chevre } from '../../../lib/index';
7
5
 
8
6
  const project = { id: String(process.env.PROJECT_ID) };
9
7
 
10
- const coaAuthClient = new COA.auth.RefreshToken({
11
- endpoint: chevre.credentials.coa.endpoint,
12
- refreshToken: chevre.credentials.coa.refreshToken,
13
- useFetch: chevre.credentials.coa.useFetch
14
- });
15
-
16
8
  async function main() {
17
9
  await mongoose.connect(<string>process.env.MONGOLAB_URI);
18
10
 
19
11
  const categoryCodeRepo = await chevre.repository.CategoryCode.createInstance(mongoose.connection);
20
- const masterService = new COA.service.Master(
12
+ const coaAuthClient = new (await chevre.loadCOA()).auth.RefreshToken({
13
+ endpoint: '',
14
+ refreshToken: '',
15
+ useFetch: true
16
+ });
17
+ const masterService = new (await chevre.loadCOA()).service.Master(
21
18
  {
22
- endpoint: chevre.credentials.coa.endpoint,
19
+ endpoint: '',
23
20
  auth: coaAuthClient
24
21
  },
25
- { timeout: chevre.credentials.coa.timeout }
22
+ { timeout: 20000 }
26
23
  );
27
24
 
28
25
  await (await chevre.service.offer.createService()).event.importCategoryCodesFromCOA({
@@ -18,6 +18,19 @@ async function main() {
18
18
  const movieTheaterRepo = await chevre.repository.place.MovieTheater.createInstance(mongoose.connection);
19
19
  const sellerRepo = await chevre.repository.Seller.createInstance(mongoose.connection);
20
20
 
21
+ const coaAuthClient = new (await chevre.loadCOA()).auth.RefreshToken({
22
+ endpoint: '',
23
+ refreshToken: '',
24
+ useFetch: true
25
+ });
26
+ const masterService = new (await chevre.loadCOA()).service.Master(
27
+ {
28
+ endpoint: '',
29
+ auth: coaAuthClient
30
+ },
31
+ { timeout: 20000 }
32
+ );
33
+
21
34
  await (await chevre.service.event.createService()).importFromCOA({
22
35
  project: {
23
36
  id: project.id,
@@ -39,7 +52,8 @@ async function main() {
39
52
  event: eventRepo,
40
53
  movieTheater: movieTheaterRepo,
41
54
  screeningRoom: screeningRoomRepo,
42
- seller: sellerRepo
55
+ seller: sellerRepo,
56
+ masterService
43
57
  });
44
58
  console.log('imported');
45
59
  }
@@ -1,4 +1,7 @@
1
1
  // tslint:disable:no-console
2
+ import { CognitoIdentityProvider } from '@aws-sdk/client-cognito-identity-provider';
3
+ import { fromEnv } from '@aws-sdk/credential-providers';
4
+
2
5
  import { chevre } from '../../../lib/index';
3
6
 
4
7
  export const USERPOOL_ID_OLD = String(process.env.USERPOOL_ID_OLD);
@@ -9,11 +12,21 @@ const NEW_USERPOOL_PROVIDER_NAME = 'SSKTS';
9
12
  export async function migrateUser(params: {
10
13
  id: string;
11
14
  }): Promise<void> {
15
+ const awsCredentials = fromEnv();
16
+ const cognitoIdentityServiceProvider = new CognitoIdentityProvider({
17
+ apiVersion: 'latest',
18
+ region: 'ap-northeast-1',
19
+ credentials: awsCredentials
20
+ });
21
+
12
22
  // 旧会員を取得
13
23
  let oldPerson: chevre.factory.person.IPerson | undefined;
14
24
 
15
25
  try {
16
- const oldPersonRepo = await chevre.repository.Person.createInstance({ userPoolId: USERPOOL_ID_OLD });
26
+ const oldPersonRepo = await chevre.repository.Person.createInstance({
27
+ userPoolId: USERPOOL_ID_OLD,
28
+ cognitoIdentityServiceProvider
29
+ });
17
30
  oldPerson = await oldPersonRepo.findById({ userId: params.id });
18
31
  console.log('oldPerson found', oldPerson.id, oldPerson.givenName, oldPerson.familyName);
19
32
  } catch (error) {
@@ -33,7 +46,10 @@ export async function migrateUser(params: {
33
46
  }
34
47
 
35
48
  // create user
36
- const newPersonRepo = await chevre.repository.Person.createInstance({ userPoolId: USERPOOL_ID_NEW });
49
+ const newPersonRepo = await chevre.repository.Person.createInstance({
50
+ userPoolId: USERPOOL_ID_NEW,
51
+ cognitoIdentityServiceProvider
52
+ });
37
53
  const newUsername = `${NEW_USERPOOL_PROVIDER_NAME}_${oldPerson.id}`;
38
54
  const newUserId = await new Promise<string>((resolve, reject) => {
39
55
  newPersonRepo.cognitoIdentityServiceProvider.adminCreateUser(
@@ -1,9 +1,18 @@
1
+ import { CognitoIdentityProvider } from '@aws-sdk/client-cognito-identity-provider';
2
+ import { fromEnv } from '@aws-sdk/credential-providers';
3
+
1
4
  // tslint:disable:no-console no-magic-numbers
2
5
  import { chevre } from '../../../../lib/index';
3
6
 
4
7
  async function main() {
8
+ const awsCredentials = fromEnv();
5
9
  const personRepo = await chevre.repository.Person.createInstance({
6
- userPoolId: <string>process.env.COGNITO_USER_POOL_ID
10
+ userPoolId: <string>process.env.COGNITO_USER_POOL_ID,
11
+ cognitoIdentityServiceProvider: new CognitoIdentityProvider({
12
+ apiVersion: 'latest',
13
+ region: 'ap-northeast-1',
14
+ credentials: awsCredentials
15
+ })
7
16
  });
8
17
 
9
18
  const username = 'xxx';
@@ -64,7 +64,10 @@ async function main() {
64
64
  serialNumbers,
65
65
  offeredThroughIdentifier
66
66
  },
67
- options: { force: true }
67
+ options: {
68
+ force: true,
69
+ numTryConfirmReserveTransaction: 10
70
+ }
68
71
  })({ task: taskRepo });
69
72
  console.log('order processed', order.orderNumber);
70
73
  updateCount += 1;
@@ -8,19 +8,31 @@ 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 coaAuthClient = new (await chevre.loadCOA()).auth.RefreshToken({
12
+ endpoint: '',
13
+ refreshToken: '',
14
+ useFetch: true
15
+ });
16
+
11
17
  const { reservations } = await (await chevre.service.reserve.createService()).searchByOrder({
12
18
  limit: 10,
13
19
  page: 1,
14
20
  project: { id: project.id },
15
21
  orderNumber: 'CIN3-0760465-8981560',
16
- // orderNumber: 'SSK1-3743647-5975553',
17
- // orderNumber: 'SSK9-4864565-8689164',
18
22
  typeOf: chevre.factory.reservationType.EventReservation
19
23
  })({
20
24
  acceptedOffer: await chevre.repository.AcceptedOffer.createInstance(mongoose.connection),
21
25
  order: await chevre.repository.Order.createInstance(mongoose.connection),
22
- reservation: await chevre.repository.Reservation.createInstance(mongoose.connection)
26
+ reservation: await chevre.repository.Reservation.createInstance(mongoose.connection),
27
+ reserveService: new (await chevre.loadCOA()).service.Reserve(
28
+ {
29
+ endpoint: '',
30
+ auth: coaAuthClient
31
+ },
32
+ { timeout: 20000 }
33
+ )
23
34
  });
35
+
24
36
  console.log(reservations);
25
37
  console.log(reservations.length, 'reservations found');
26
38
  }
@@ -0,0 +1,17 @@
1
+ interface IOptions {
2
+ endpoint: string;
3
+ refreshToken: string;
4
+ timeout: number;
5
+ useFetch: boolean;
6
+ }
7
+ /**
8
+ * COA認証情報
9
+ */
10
+ declare class COACredentials {
11
+ readonly endpoint: string;
12
+ readonly refreshToken: string;
13
+ readonly timeout: number;
14
+ readonly useFetch: boolean;
15
+ constructor(options: IOptions);
16
+ }
17
+ export { COACredentials };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.COACredentials = void 0;
4
+ /**
5
+ * COA認証情報
6
+ */
7
+ class COACredentials {
8
+ constructor(options) {
9
+ this.timeout = 20000;
10
+ const { endpoint, refreshToken, timeout, useFetch } = options;
11
+ this.endpoint = endpoint;
12
+ this.refreshToken = refreshToken;
13
+ this.timeout = timeout;
14
+ this.useFetch = useFetch;
15
+ }
16
+ }
17
+ exports.COACredentials = COACredentials;
@@ -0,0 +1,13 @@
1
+ interface IOptions {
2
+ engineId: string;
3
+ apiKey: string;
4
+ }
5
+ /**
6
+ * GoogleCustomSearch認証情報
7
+ */
8
+ declare class CustomSearchCredentials {
9
+ readonly engineId: string;
10
+ readonly apiKey: string;
11
+ constructor(options: IOptions);
12
+ }
13
+ export { CustomSearchCredentials };
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustomSearchCredentials = void 0;
4
+ /**
5
+ * GoogleCustomSearch認証情報
6
+ */
7
+ class CustomSearchCredentials {
8
+ constructor(options) {
9
+ const { engineId, apiKey } = options;
10
+ this.engineId = engineId;
11
+ this.apiKey = apiKey;
12
+ }
13
+ }
14
+ exports.CustomSearchCredentials = CustomSearchCredentials;
@@ -0,0 +1,23 @@
1
+ interface IOptions {
2
+ secret: string;
3
+ /**
4
+ * トークン検証時の発行者リスト
5
+ */
6
+ issuers: string[];
7
+ version: string;
8
+ payloadTypPrefix: string;
9
+ }
10
+ /**
11
+ * トークン認証情報
12
+ */
13
+ declare class JWTCredentials {
14
+ readonly secret: string;
15
+ /**
16
+ * トークン検証時の発行者リスト
17
+ */
18
+ readonly issuers: string[];
19
+ readonly version: string;
20
+ readonly payloadTypPrefix: string;
21
+ constructor(options: IOptions);
22
+ }
23
+ export { JWTCredentials };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JWTCredentials = void 0;
4
+ /**
5
+ * トークン認証情報
6
+ */
7
+ class JWTCredentials {
8
+ constructor(options) {
9
+ this.version = '2024-05-02'; // 追加(2024-05-02~)
10
+ this.payloadTypPrefix = 'chevre';
11
+ const { secret, issuers, version, payloadTypPrefix } = options;
12
+ this.issuers = issuers;
13
+ this.payloadTypPrefix = payloadTypPrefix;
14
+ this.secret = secret;
15
+ this.version = version;
16
+ }
17
+ }
18
+ exports.JWTCredentials = JWTCredentials;
@@ -0,0 +1,17 @@
1
+ interface IOptions {
2
+ url: string;
3
+ accessToken: string;
4
+ accessTokenAlert: string;
5
+ accessTokenInfo: string;
6
+ }
7
+ /**
8
+ * 通知認証情報
9
+ */
10
+ declare class LINENotifyCredentials {
11
+ readonly url: string;
12
+ readonly accessToken: string;
13
+ readonly accessTokenAlert: string;
14
+ readonly accessTokenInfo: string;
15
+ constructor(options: IOptions);
16
+ }
17
+ export { LINENotifyCredentials };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LINENotifyCredentials = void 0;
4
+ /**
5
+ * 通知認証情報
6
+ */
7
+ class LINENotifyCredentials {
8
+ constructor(options) {
9
+ const { url, accessToken, accessTokenAlert, accessTokenInfo } = options;
10
+ this.url = url;
11
+ this.accessToken = accessToken;
12
+ this.accessTokenAlert = accessTokenAlert;
13
+ this.accessTokenInfo = accessTokenInfo;
14
+ }
15
+ }
16
+ exports.LINENotifyCredentials = LINENotifyCredentials;
@@ -0,0 +1,11 @@
1
+ interface IOptions {
2
+ apiKey: string;
3
+ }
4
+ /**
5
+ * SendGrid認証情報
6
+ */
7
+ declare class SendGridCredentials {
8
+ readonly apiKey: string;
9
+ constructor(options: IOptions);
10
+ }
11
+ export { SendGridCredentials };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SendGridCredentials = void 0;
4
+ /**
5
+ * SendGrid認証情報
6
+ */
7
+ class SendGridCredentials {
8
+ constructor(options) {
9
+ const { apiKey } = options;
10
+ this.apiKey = apiKey;
11
+ }
12
+ }
13
+ exports.SendGridCredentials = SendGridCredentials;
@@ -1,59 +1,30 @@
1
+ import type { COACredentials } from './credentials/coa';
2
+ import type { CustomSearchCredentials } from './credentials/customSearch';
3
+ import type { JWTCredentials } from './credentials/jwt';
4
+ import type { LINENotifyCredentials } from './credentials/lineNotify';
5
+ import type { SendGridCredentials } from './credentials/sendGrid';
1
6
  /**
2
- * 外部サービスを使用するための認証情報
7
+ * 外部サービス認証情報
3
8
  */
4
- export declare const credentials: {
5
- aws: {
6
- accessKeyId: string;
7
- secretAccessKey: string;
8
- tokenIssuerEndpoint: string;
9
- };
10
- chevre: {
11
- authorizeServerDomain: string;
12
- clientId: string;
13
- clientSecret: string;
14
- endpoint: string;
15
- };
16
- coa: {
17
- endpoint: string;
18
- refreshToken: string;
19
- timeout: number;
20
- useFetch: boolean;
21
- };
22
- customSearch: {
23
- engineId: string;
24
- apiKey: string;
25
- };
26
- gmo: {
27
- timeout: number;
28
- timeoutBackground: number | undefined;
29
- useFetch: boolean;
30
- };
31
- lineNotify: {
32
- url: string | undefined;
33
- accessToken: string | undefined;
34
- accessTokenAlert: string | undefined;
35
- accessTokenInfo: string | undefined;
36
- };
37
- movieticketReserve: {
38
- /**
39
- * 着券時タイムアウト
40
- */
41
- timeout: number;
42
- /**
43
- * 認証時タイムアウト
44
- */
45
- timeoutCheck: number;
46
- };
47
- sendGrid: {
48
- apiKey: string | undefined;
49
- };
50
- jwt: {
51
- secret: string;
52
- /**
53
- * トークン検証時の発行者リスト
54
- */
55
- issuers: string[];
56
- version: string;
57
- payloadTypPrefix: string;
58
- };
59
- };
9
+ export declare namespace credentials {
10
+ type COA = COACredentials;
11
+ namespace COA {
12
+ function createInstance(...params: ConstructorParameters<typeof COACredentials>): Promise<COACredentials>;
13
+ }
14
+ type CustomSearch = CustomSearchCredentials;
15
+ namespace CustomSearch {
16
+ function createInstance(...params: ConstructorParameters<typeof CustomSearchCredentials>): Promise<CustomSearchCredentials>;
17
+ }
18
+ type JWT = JWTCredentials;
19
+ namespace JWT {
20
+ function createInstance(...params: ConstructorParameters<typeof JWTCredentials>): Promise<JWTCredentials>;
21
+ }
22
+ type LINENotify = LINENotifyCredentials;
23
+ namespace LINENotify {
24
+ function createInstance(...params: ConstructorParameters<typeof LINENotifyCredentials>): Promise<LINENotifyCredentials>;
25
+ }
26
+ type SendGrid = SendGridCredentials;
27
+ namespace SendGrid {
28
+ function createInstance(...params: ConstructorParameters<typeof SendGridCredentials>): Promise<SendGridCredentials>;
29
+ }
30
+ }