@chevre/domain 22.0.0-alpha.1 → 22.0.0-alpha.11

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 (239) hide show
  1. package/example/src/chevre/aggregateAllEvents2.ts +42 -2
  2. package/example/src/chevre/findReservationByCode.ts +17 -5
  3. package/example/src/chevre/findValidAuthorization.ts +16 -4
  4. package/example/src/chevre/importCategoryCodesFromCOA.ts +8 -11
  5. package/example/src/chevre/importEventsFromCOA.ts +15 -1
  6. package/example/src/chevre/migrateCognitoUser.ts +18 -2
  7. package/example/src/chevre/person/updateProfile.ts +10 -1
  8. package/example/src/chevre/processOrder.ts +4 -1
  9. package/example/src/chevre/searchReservationsByOrder.ts +15 -3
  10. package/lib/chevre/credentials/customSearch.d.ts +13 -0
  11. package/lib/chevre/credentials/customSearch.js +14 -0
  12. package/lib/chevre/credentials/jwt.d.ts +23 -0
  13. package/lib/chevre/credentials/jwt.js +18 -0
  14. package/lib/chevre/credentials/lineNotify.d.ts +17 -0
  15. package/lib/chevre/credentials/lineNotify.js +16 -0
  16. package/lib/chevre/credentials/sendGrid.d.ts +11 -0
  17. package/lib/chevre/credentials/sendGrid.js +13 -0
  18. package/lib/chevre/credentials.d.ts +23 -57
  19. package/lib/chevre/credentials.js +78 -69
  20. package/lib/chevre/emailMessageBuilder.d.ts +4 -3
  21. package/lib/chevre/emailMessageBuilder.js +8 -9
  22. package/lib/chevre/index.d.ts +2 -0
  23. package/lib/chevre/index.js +11 -1
  24. package/lib/chevre/repo/authorization.d.ts +1 -2
  25. package/lib/chevre/repo/person.d.ts +3 -2
  26. package/lib/chevre/repo/person.js +11 -10
  27. package/lib/chevre/repo/rateLimit/offer.js +0 -8
  28. package/lib/chevre/repo/stockHolder.js +0 -7
  29. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +2 -1
  30. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +7 -8
  31. package/lib/chevre/service/aggregation/event/importFromCOA.d.ts +5 -0
  32. package/lib/chevre/service/aggregation/event/importFromCOA.js +1 -15
  33. package/lib/chevre/service/assetTransaction/cancelReservationCOA.d.ts +4 -2
  34. package/lib/chevre/service/assetTransaction/cancelReservationCOA.js +3 -17
  35. package/lib/chevre/service/assetTransaction/pay.d.ts +6 -5
  36. package/lib/chevre/service/assetTransaction/pay.js +15 -15
  37. package/lib/chevre/service/assetTransaction/reserve/cancel.d.ts +2 -1
  38. package/lib/chevre/service/assetTransaction/reserve/cancel.js +2 -2
  39. package/lib/chevre/service/assetTransaction/reserve/confirm.d.ts +2 -1
  40. package/lib/chevre/service/assetTransaction/reserve/confirm.js +3 -4
  41. package/lib/chevre/service/assetTransaction/reserve/exportTasksById.d.ts +2 -1
  42. package/lib/chevre/service/assetTransaction/reserve/exportTasksById.js +4 -4
  43. package/lib/chevre/service/assetTransaction/reserve/start.d.ts +5 -0
  44. package/lib/chevre/service/assetTransaction/reserve/start.js +8 -8
  45. package/lib/chevre/service/assetTransaction/reserveCOA.d.ts +5 -0
  46. package/lib/chevre/service/assetTransaction/reserveCOA.js +3 -17
  47. package/lib/chevre/service/assetTransaction.d.ts +3 -2
  48. package/lib/chevre/service/assetTransaction.js +3 -9
  49. package/lib/chevre/service/code.d.ts +21 -10
  50. package/lib/chevre/service/code.js +74 -70
  51. package/lib/chevre/service/event.d.ts +7 -1
  52. package/lib/chevre/service/event.js +13 -35
  53. package/lib/chevre/service/notification.d.ts +12 -3
  54. package/lib/chevre/service/notification.js +26 -25
  55. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +8 -0
  56. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.js +8 -7
  57. package/lib/chevre/service/offer/event/authorize.d.ts +19 -8
  58. package/lib/chevre/service/offer/event/authorize.js +4 -4
  59. package/lib/chevre/service/offer/event/importFromCOA.d.ts +1 -1
  60. package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.d.ts +2 -1
  61. package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.js +2 -2
  62. package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4coa.d.ts +5 -1
  63. package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4coa.js +5 -19
  64. package/lib/chevre/service/offer/event/voidTransaction.d.ts +4 -1
  65. package/lib/chevre/service/offer/event/voidTransaction.js +4 -4
  66. package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +4 -1
  67. package/lib/chevre/service/offer/event/voidTransactionByActionId.js +3 -3
  68. package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.d.ts +1 -1
  69. package/lib/chevre/service/offer/factory.js +2 -3
  70. package/lib/chevre/service/offer/onEventChanged.d.ts +2 -1
  71. package/lib/chevre/service/offer/onEventChanged.js +24 -26
  72. package/lib/chevre/service/offer/product/searchProductOffers.js +1 -6
  73. package/lib/chevre/service/order/deleteOrder.js +3 -44
  74. package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +4 -3
  75. package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +10 -17
  76. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.d.ts +2 -1
  77. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.js +3 -4
  78. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.d.ts +2 -1
  79. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +2 -2
  80. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +2 -1
  81. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.js +3 -4
  82. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.d.ts +2 -1
  83. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.js +2 -2
  84. package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.d.ts +2 -1
  85. package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +4 -6
  86. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.d.ts +2 -1
  87. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +3 -4
  88. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/processOrder.d.ts +1 -0
  89. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/processOrder.js +3 -3
  90. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +2 -1
  91. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +11 -5
  92. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +2 -1
  93. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +4 -6
  94. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.d.ts +2 -1
  95. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +2 -2
  96. package/lib/chevre/service/order/onOrderUpdated/factory.d.ts +2 -1
  97. package/lib/chevre/service/order/onOrderUpdated/factory.js +3 -4
  98. package/lib/chevre/service/order/onOrderUpdated.d.ts +2 -1
  99. package/lib/chevre/service/order/onOrderUpdated.js +2 -2
  100. package/lib/chevre/service/order/payOrder.d.ts +2 -1
  101. package/lib/chevre/service/order/payOrder.js +2 -2
  102. package/lib/chevre/service/order/placeOrder.d.ts +2 -1
  103. package/lib/chevre/service/order/placeOrder.js +2 -2
  104. package/lib/chevre/service/order/returnOrder.d.ts +2 -1
  105. package/lib/chevre/service/order/returnOrder.js +2 -2
  106. package/lib/chevre/service/order/sendOrder.d.ts +2 -1
  107. package/lib/chevre/service/order/sendOrder.js +6 -11
  108. package/lib/chevre/service/payment/any/person2username.d.ts +3 -1
  109. package/lib/chevre/service/payment/any/person2username.js +3 -3
  110. package/lib/chevre/service/payment/any.d.ts +8 -4
  111. package/lib/chevre/service/payment/any.js +15 -12
  112. package/lib/chevre/service/payment/creditCard/authorize.d.ts +2 -1
  113. package/lib/chevre/service/payment/creditCard/authorize.js +5 -6
  114. package/lib/chevre/service/payment/creditCard/payCreditCard.d.ts +2 -1
  115. package/lib/chevre/service/payment/creditCard/payCreditCard.js +3 -4
  116. package/lib/chevre/service/payment/creditCard/refundCreditCard.d.ts +2 -1
  117. package/lib/chevre/service/payment/creditCard/refundCreditCard.js +3 -4
  118. package/lib/chevre/service/payment/creditCard/searchGMOTrade.d.ts +2 -1
  119. package/lib/chevre/service/payment/creditCard/searchGMOTrade.js +3 -4
  120. package/lib/chevre/service/payment/creditCard/voidTransaction.d.ts +2 -1
  121. package/lib/chevre/service/payment/creditCard/voidTransaction.js +3 -4
  122. package/lib/chevre/service/payment/factory/createPayObjectServiceOutput.js +3 -6
  123. package/lib/chevre/service/payment/movieTicket/authorize.d.ts +2 -1
  124. package/lib/chevre/service/payment/movieTicket/authorize.js +3 -3
  125. package/lib/chevre/service/payment/movieTicket/checkMovieTicket.d.ts +2 -1
  126. package/lib/chevre/service/payment/movieTicket/checkMovieTicket.js +2 -2
  127. package/lib/chevre/service/payment/movieTicket/payMovieTicket.d.ts +2 -1
  128. package/lib/chevre/service/payment/movieTicket/payMovieTicket.js +2 -3
  129. package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.d.ts +2 -1
  130. package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.js +2 -4
  131. package/lib/chevre/service/payment/movieTicket/refundMovieTicket.d.ts +2 -1
  132. package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +2 -3
  133. package/lib/chevre/service/payment/movieTicket/validation.d.ts +2 -1
  134. package/lib/chevre/service/payment/movieTicket/validation.js +5 -6
  135. package/lib/chevre/service/payment/movieTicket/voidTransaction.d.ts +2 -1
  136. package/lib/chevre/service/payment/movieTicket/voidTransaction.js +2 -2
  137. package/lib/chevre/service/payment.d.ts +4 -3
  138. package/lib/chevre/service/payment.js +9 -9
  139. package/lib/chevre/service/reserve/cancelReservation.d.ts +3 -2
  140. package/lib/chevre/service/reserve/cancelReservation.js +4 -4
  141. package/lib/chevre/service/reserve/checkInReservation.d.ts +2 -1
  142. package/lib/chevre/service/reserve/checkInReservation.js +5 -5
  143. package/lib/chevre/service/reserve/confirmReservation.d.ts +2 -1
  144. package/lib/chevre/service/reserve/confirmReservation.js +2 -2
  145. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +2 -1
  146. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +2 -3
  147. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.d.ts +2 -1
  148. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +2 -3
  149. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +2 -1
  150. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -3
  151. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.d.ts +2 -1
  152. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +3 -4
  153. package/lib/chevre/service/reserve/searchByOrder.d.ts +2 -0
  154. package/lib/chevre/service/reserve/searchByOrder.js +1 -12
  155. package/lib/chevre/service/reserve/useReservation.d.ts +2 -1
  156. package/lib/chevre/service/reserve/useReservation.js +5 -5
  157. package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +3 -0
  158. package/lib/chevre/service/reserve/verifyToken4reservation.js +4 -3
  159. package/lib/chevre/service/task/acceptCOAOffer.js +15 -21
  160. package/lib/chevre/service/task/aggregateScreeningEvent.js +12 -12
  161. package/lib/chevre/service/task/authorizePayment.js +21 -18
  162. package/lib/chevre/service/task/cancelPendingReservation.js +9 -9
  163. package/lib/chevre/service/task/cancelReservation.js +9 -9
  164. package/lib/chevre/service/task/checkMovieTicket.js +9 -9
  165. package/lib/chevre/service/task/confirmReserveTransaction.d.ts +4 -1
  166. package/lib/chevre/service/task/confirmReserveTransaction.js +21 -11
  167. package/lib/chevre/service/task/importEventCapacitiesFromCOA.js +12 -3
  168. package/lib/chevre/service/task/importEventsFromCOA.js +18 -8
  169. package/lib/chevre/service/task/importOffersFromCOA.js +10 -12
  170. package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +7 -7
  171. package/lib/chevre/service/task/onAuthorizationCreated.js +13 -13
  172. package/lib/chevre/service/task/onEventChanged.js +5 -5
  173. package/lib/chevre/service/task/onOrderPaymentCompleted.js +6 -6
  174. package/lib/chevre/service/task/onResourceUpdated/onAggregateOfferUpdated.d.ts +2 -1
  175. package/lib/chevre/service/task/onResourceUpdated/onAggregateOfferUpdated.js +2 -3
  176. package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.d.ts +2 -1
  177. package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.js +3 -3
  178. package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.d.ts +2 -1
  179. package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.js +2 -3
  180. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +2 -1
  181. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +2 -2
  182. package/lib/chevre/service/task/onResourceUpdated.js +27 -21
  183. package/lib/chevre/service/task/pay.js +14 -14
  184. package/lib/chevre/service/task/placeOrder.js +2 -2
  185. package/lib/chevre/service/task/publishPaymentUrl.js +11 -11
  186. package/lib/chevre/service/task/refund.js +13 -13
  187. package/lib/chevre/service/task/reserve.js +6 -6
  188. package/lib/chevre/service/task/returnOrder.js +8 -8
  189. package/lib/chevre/service/task/returnReserveTransaction.js +19 -8
  190. package/lib/chevre/service/task/sendEmailMessage.js +5 -5
  191. package/lib/chevre/service/task/sendOrder.js +8 -8
  192. package/lib/chevre/service/task/triggerWebhook.js +5 -5
  193. package/lib/chevre/service/task/useReservation.js +7 -7
  194. package/lib/chevre/service/task/voidPayTransaction.js +10 -10
  195. package/lib/chevre/service/task/voidPayment.js +10 -10
  196. package/lib/chevre/service/task/voidReserveTransaction.js +21 -12
  197. package/lib/chevre/service/task.d.ts +28 -5
  198. package/lib/chevre/service/task.js +11 -25
  199. package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.d.ts +2 -1
  200. package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.js +3 -4
  201. package/lib/chevre/service/transaction/moneyTransfer.d.ts +8 -2
  202. package/lib/chevre/service/transaction/moneyTransfer.js +14 -13
  203. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.d.ts +2 -1
  204. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.js +2 -2
  205. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.d.ts +2 -1
  206. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.js +2 -2
  207. package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateMovieTicket.js +60 -71
  208. package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +5 -0
  209. package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +5 -5
  210. package/lib/chevre/service/transaction/placeOrder/confirm.d.ts +18 -14
  211. package/lib/chevre/service/transaction/placeOrder/confirm.js +8 -8
  212. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +2 -1
  213. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +4 -5
  214. package/lib/chevre/service/transaction/placeOrder/exportTasksById.d.ts +2 -1
  215. package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +2 -2
  216. package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.d.ts +2 -1
  217. package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +3 -4
  218. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.d.ts +2 -1
  219. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +7 -7
  220. package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.d.ts +2 -1
  221. package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +2 -2
  222. package/lib/chevre/service/transaction/returnOrder/potentialActions.d.ts +2 -1
  223. package/lib/chevre/service/transaction/returnOrder/potentialActions.js +3 -4
  224. package/lib/chevre/service/transaction/returnOrder.d.ts +3 -2
  225. package/lib/chevre/service/transaction/returnOrder.js +4 -4
  226. package/lib/chevre/service/transaction.d.ts +3 -2
  227. package/lib/chevre/service/transaction.js +5 -11
  228. package/lib/chevre/settings.d.ts +120 -33
  229. package/lib/chevre/settings.js +28 -152
  230. package/package.json +7 -7
  231. package/example/src/chevre/aggregation/aggregateEventReservation.ts +0 -40
  232. package/example/src/chevre/importOffersFromCOA.ts +0 -44
  233. package/example/src/chevre/notifyAbortedTasks.ts +0 -25
  234. package/example/src/chevre/onAssetTransactionStatusChanged.ts +0 -36
  235. package/example/src/chevre/ownershipInfosCsv2peopleJson.ts +0 -181
  236. package/example/src/chevre/person/globalSignOutAndDisable.ts +0 -23
  237. package/example/src/chevre/person/search.ts +0 -38
  238. package/example/src/chevre/report2developers.ts +0 -39
  239. package/example/src/chevre/sendOrder.ts +0 -37
@@ -35,8 +35,48 @@ 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
+ coa: { timeout: 1000 },
73
+ gmo: { timeout: 1000, timeoutBackground: 1000, useFetch: true },
74
+ movieticketReserve: { timeout: 1000, timeoutCheck: 1000 },
75
+ numTryConfirmReserveTransaction: 10,
76
+ useAssetTransactionSyncProcessing: true,
77
+ useExperimentalFeature: false
78
+ })
79
+ });
40
80
  console.log('executed', count);
41
81
  } catch (error) {
42
82
  console.error(error);
@@ -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,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,25 @@
1
+ import type { CustomSearchCredentials } from './credentials/customSearch';
2
+ import type { JWTCredentials } from './credentials/jwt';
3
+ import type { LINENotifyCredentials } from './credentials/lineNotify';
4
+ import type { SendGridCredentials } from './credentials/sendGrid';
1
5
  /**
2
- * 外部サービスを使用するための認証情報
6
+ * 外部サービス認証情報
3
7
  */
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
- };
8
+ export declare namespace credentials {
9
+ type CustomSearch = CustomSearchCredentials;
10
+ namespace CustomSearch {
11
+ function createInstance(...params: ConstructorParameters<typeof CustomSearchCredentials>): Promise<CustomSearchCredentials>;
12
+ }
13
+ type JWT = JWTCredentials;
14
+ namespace JWT {
15
+ function createInstance(...params: ConstructorParameters<typeof JWTCredentials>): Promise<JWTCredentials>;
16
+ }
17
+ type LINENotify = LINENotifyCredentials;
18
+ namespace LINENotify {
19
+ function createInstance(...params: ConstructorParameters<typeof LINENotifyCredentials>): Promise<LINENotifyCredentials>;
20
+ }
21
+ type SendGrid = SendGridCredentials;
22
+ namespace SendGrid {
23
+ function createInstance(...params: ConstructorParameters<typeof SendGridCredentials>): Promise<SendGridCredentials>;
24
+ }
25
+ }