@chevre/domain 25.2.0-alpha.5 → 25.2.0-alpha.50

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 (202) hide show
  1. package/lib/chevre/eventEmitter/task.d.ts +2 -1
  2. package/lib/chevre/factory/customerTelephone2COATelNum.d.ts +3 -0
  3. package/lib/chevre/factory/customerTelephone2COATelNum.js +22 -0
  4. package/lib/chevre/repo/action/acceptPay.d.ts +15 -0
  5. package/lib/chevre/repo/action/acceptPay.js +47 -19
  6. package/lib/chevre/repo/action/actionProcess.js +57 -57
  7. package/lib/chevre/repo/action.d.ts +16 -9
  8. package/lib/chevre/repo/action.js +99 -180
  9. package/lib/chevre/repo/aggregateOffer.d.ts +3 -14
  10. package/lib/chevre/repo/aggregateOffer.js +16 -125
  11. package/lib/chevre/repo/asyncAction.d.ts +64 -0
  12. package/lib/chevre/repo/asyncAction.js +178 -0
  13. package/lib/chevre/repo/concurrentLock.d.ts +3 -1
  14. package/lib/chevre/repo/creativeWork.d.ts +2 -3
  15. package/lib/chevre/repo/credentials.d.ts +2 -1
  16. package/lib/chevre/repo/customerType.d.ts +2 -3
  17. package/lib/chevre/repo/event.d.ts +10 -11
  18. package/lib/chevre/repo/eventOffer.d.ts +4 -5
  19. package/lib/chevre/repo/eventSellerMakesOffer.d.ts +2 -3
  20. package/lib/chevre/repo/eventSeries.d.ts +4 -5
  21. package/lib/chevre/repo/message.d.ts +1 -1
  22. package/lib/chevre/repo/message.js +1 -1
  23. package/lib/chevre/repo/mongoose/schemas/action.js +67 -66
  24. package/lib/chevre/repo/mongoose/schemas/asyncAction.d.ts +11 -0
  25. package/lib/chevre/repo/mongoose/schemas/asyncAction.js +89 -0
  26. package/lib/chevre/repo/mongoose/schemas/order.d.ts +4 -0
  27. package/lib/chevre/repo/mongoose/schemas/order.js +10 -0
  28. package/lib/chevre/repo/mongoose/schemas/setting.d.ts +4 -0
  29. package/lib/chevre/repo/mongoose/schemas/task.js +12 -12
  30. package/lib/chevre/repo/note.d.ts +3 -4
  31. package/lib/chevre/repo/noteAboutOrder.d.ts +2 -3
  32. package/lib/chevre/repo/offer/offerInCatalogReadOnly.d.ts +2 -2
  33. package/lib/chevre/repo/offer/unitPriceInCatalog.d.ts +2 -2
  34. package/lib/chevre/repo/offer/unitPriceInCatalog.js +59 -11
  35. package/lib/chevre/repo/offerCatalog.d.ts +2 -3
  36. package/lib/chevre/repo/offerCatalogItem.d.ts +2 -3
  37. package/lib/chevre/repo/order.d.ts +2 -0
  38. package/lib/chevre/repo/order.js +14 -14
  39. package/lib/chevre/repo/orderInTransaction.d.ts +68 -1
  40. package/lib/chevre/repo/orderInTransaction.js +181 -3
  41. package/lib/chevre/repo/passport.d.ts +2 -1
  42. package/lib/chevre/repo/person.d.ts +0 -15
  43. package/lib/chevre/repo/person.js +122 -108
  44. package/lib/chevre/repo/place/entranceGate.d.ts +4 -5
  45. package/lib/chevre/repo/place/movieTheater.d.ts +3 -4
  46. package/lib/chevre/repo/place/screeningRoom.d.ts +4 -5
  47. package/lib/chevre/repo/place/seat.d.ts +4 -5
  48. package/lib/chevre/repo/place/section.d.ts +3 -4
  49. package/lib/chevre/repo/priceSpecification.d.ts +4 -4
  50. package/lib/chevre/repo/product.d.ts +3 -4
  51. package/lib/chevre/repo/rateLimit/offer.d.ts +3 -1
  52. package/lib/chevre/repo/rateLimit/offer.js +0 -12
  53. package/lib/chevre/repo/reservation.d.ts +2 -3
  54. package/lib/chevre/repo/sellerMakesOffer.d.ts +3 -4
  55. package/lib/chevre/repo/stockHolder.d.ts +1 -1
  56. package/lib/chevre/repo/stockHolder.js +0 -146
  57. package/lib/chevre/repo/transaction/placeOrder.d.ts +2 -45
  58. package/lib/chevre/repo/transaction/placeOrder.js +43 -83
  59. package/lib/chevre/repo/transaction.d.ts +2 -2
  60. package/lib/chevre/repo/transactionNumberCounter.js +0 -34
  61. package/lib/chevre/repo/transactionProcess.d.ts +2 -1
  62. package/lib/chevre/repo/transactionProcess.js +0 -13
  63. package/lib/chevre/repository.d.ts +5 -0
  64. package/lib/chevre/repository.js +12 -1
  65. package/lib/chevre/service/assetTransaction/pay/publishPaymentUrl.js +1 -1
  66. package/lib/chevre/service/assetTransaction/pay/start/factory.d.ts +1 -1
  67. package/lib/chevre/service/assetTransaction/pay/start/factory.js +3 -4
  68. package/lib/chevre/service/assetTransaction/pay/start.d.ts +1 -1
  69. package/lib/chevre/service/asyncAction.d.ts +16 -0
  70. package/lib/chevre/service/asyncAction.js +36 -0
  71. package/lib/chevre/service/asyncActionHandler/onOperationFailed.d.ts +15 -0
  72. package/lib/chevre/service/asyncActionHandler/onOperationFailed.js +42 -0
  73. package/lib/chevre/service/asyncActionHandler.d.ts +13 -0
  74. package/lib/chevre/service/asyncActionHandler.js +89 -0
  75. package/lib/chevre/service/notification/factory.d.ts +2 -4
  76. package/lib/chevre/service/notification/factory.js +26 -24
  77. package/lib/chevre/service/notification/notifyAbortedTasksByEmail.d.ts +11 -5
  78. package/lib/chevre/service/notification/notifyAbortedTasksByEmail.js +11 -3
  79. package/lib/chevre/service/offer/event/authorize/factory.d.ts +3 -5
  80. package/lib/chevre/service/offer/event/authorize/factory.js +93 -75
  81. package/lib/chevre/service/offer/event/authorize.d.ts +0 -4
  82. package/lib/chevre/service/offer/event/authorize.js +2 -2
  83. package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +6 -7
  84. package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.js +10 -10
  85. package/lib/chevre/service/offer/eventServiceByCOA/authorize/validateAcceptedOffers.js +2 -1
  86. package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +0 -5
  87. package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +15 -12
  88. package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.d.ts +0 -5
  89. package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.js +2 -2
  90. package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.d.ts +4 -0
  91. package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.js +22 -9
  92. package/lib/chevre/service/order/deleteOrder.d.ts +5 -1
  93. package/lib/chevre/service/order/deleteOrder.js +8 -1
  94. package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionCanceled.js +19 -11
  95. package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.d.ts +2 -0
  96. package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.d.ts +2 -2
  97. package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.js +1 -7
  98. package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +2 -0
  99. package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +2 -0
  100. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.d.ts +5 -1
  101. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.js +95 -33
  102. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +2 -2
  103. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +4 -2
  104. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +2 -6
  105. package/lib/chevre/service/order/payOrder.d.ts +2 -0
  106. package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.d.ts +2 -1
  107. package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +13 -58
  108. package/lib/chevre/service/order/placeOrder/factory.js +3 -21
  109. package/lib/chevre/service/order/placeOrder.d.ts +4 -5
  110. package/lib/chevre/service/order/placeOrder.js +20 -31
  111. package/lib/chevre/service/payment/any/authorize/fixOrderAsNeeded.js +1 -2
  112. package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.d.ts +3 -2
  113. package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts +4 -3
  114. package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.js +3 -31
  115. package/lib/chevre/service/payment/any/authorize.js +13 -37
  116. package/lib/chevre/service/payment/any/factory.d.ts +7 -7
  117. package/lib/chevre/service/payment/any/factory.js +19 -22
  118. package/lib/chevre/service/payment/any/findAcceptAction.d.ts +3 -1
  119. package/lib/chevre/service/payment/any/findAcceptAction.js +14 -6
  120. package/lib/chevre/service/payment/any/invalidatePaymentUrl.d.ts +2 -0
  121. package/lib/chevre/service/payment/any/invalidatePaymentUrl.js +4 -66
  122. package/lib/chevre/service/payment/any/publishPaymentUrl.d.ts +4 -0
  123. package/lib/chevre/service/payment/any/publishPaymentUrl.js +4 -18
  124. package/lib/chevre/service/payment/any/voidPayTransaction.d.ts +2 -0
  125. package/lib/chevre/service/payment/any/voidPayTransaction.js +1 -23
  126. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.d.ts +1 -1
  127. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.js +5 -9
  128. package/lib/chevre/service/reserve/adminFindReservations.d.ts +15 -0
  129. package/lib/chevre/service/reserve/adminFindReservations.js +35 -0
  130. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +17 -8
  131. package/lib/chevre/service/reserve/searchByOrder.js +2 -6
  132. package/lib/chevre/service/reserve.d.ts +2 -2
  133. package/lib/chevre/service/reserve.js +3 -3
  134. package/lib/chevre/service/task/aggregateOffers.d.ts +2 -2
  135. package/lib/chevre/service/task/aggregateOffers.js +2 -1
  136. package/lib/chevre/service/task/aggregateScreeningEvent.d.ts +2 -2
  137. package/lib/chevre/service/task/aggregateScreeningEvent.js +2 -1
  138. package/lib/chevre/service/task/authorizePayment.js +3 -1
  139. package/lib/chevre/service/task/cancelReservation.d.ts +2 -2
  140. package/lib/chevre/service/task/cancelReservation.js +2 -1
  141. package/lib/chevre/service/task/confirmPayTransaction.js +0 -1
  142. package/lib/chevre/service/task/confirmReserveTransaction.js +2 -7
  143. package/lib/chevre/service/task/deleteTransaction.d.ts +2 -2
  144. package/lib/chevre/service/task/deleteTransaction.js +2 -1
  145. package/lib/chevre/service/task/onAssetTransactionStatusChanged.d.ts +2 -2
  146. package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +4 -3
  147. package/lib/chevre/service/task/onEventChanged.d.ts +2 -2
  148. package/lib/chevre/service/task/onEventChanged.js +2 -1
  149. package/lib/chevre/service/task/onOrderPaymentCompleted.d.ts +2 -2
  150. package/lib/chevre/service/task/onOrderPaymentCompleted.js +4 -1
  151. package/lib/chevre/service/task/onResourceUpdated/onAggregateOfferUpdated.js +1 -1
  152. package/lib/chevre/service/task/onResourceUpdated.d.ts +2 -2
  153. package/lib/chevre/service/task/onResourceUpdated.js +2 -1
  154. package/lib/chevre/service/task/placeOrder.d.ts +2 -2
  155. package/lib/chevre/service/task/placeOrder.js +6 -3
  156. package/lib/chevre/service/task/publishPaymentUrl.js +7 -3
  157. package/lib/chevre/service/task/refund.d.ts +2 -2
  158. package/lib/chevre/service/task/refund.js +4 -10
  159. package/lib/chevre/service/task/reserve.d.ts +2 -2
  160. package/lib/chevre/service/task/reserve.js +2 -1
  161. package/lib/chevre/service/task/returnOrder.d.ts +2 -2
  162. package/lib/chevre/service/task/returnOrder.js +2 -1
  163. package/lib/chevre/service/task/sendOrder.d.ts +2 -2
  164. package/lib/chevre/service/task/sendOrder.js +2 -1
  165. package/lib/chevre/service/task/voidPayTransaction.js +3 -7
  166. package/lib/chevre/service/task/voidPayment.d.ts +2 -2
  167. package/lib/chevre/service/task/voidPayment.js +2 -1
  168. package/lib/chevre/service/taskHandler/onOperationFailed.js +1 -1
  169. package/lib/chevre/service/taskHandler.d.ts +2 -2
  170. package/lib/chevre/service/taskHandler.js +36 -37
  171. package/lib/chevre/service/transaction/deleteTransaction/deletePayTransactionsByPlaceOrder.d.ts +15 -0
  172. package/lib/chevre/service/transaction/deleteTransaction/deletePayTransactionsByPlaceOrder.js +51 -0
  173. package/lib/chevre/service/transaction/deleteTransaction/deleteReservationsByPlaceOrder.d.ts +23 -0
  174. package/lib/chevre/service/transaction/deleteTransaction/deleteReservationsByPlaceOrder.js +64 -0
  175. package/lib/chevre/service/transaction/deleteTransaction.js +15 -152
  176. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.d.ts +28 -2
  177. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.js +11 -12
  178. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.d.ts +4 -2
  179. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.js +6 -7
  180. package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.d.ts +35 -2
  181. package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.js +15 -11
  182. package/lib/chevre/service/transaction/placeOrder/confirm/validation/factory.d.ts +5 -1
  183. package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +11 -2
  184. package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +53 -32
  185. package/lib/chevre/service/transaction/placeOrder/confirm.d.ts +6 -5
  186. package/lib/chevre/service/transaction/placeOrder/confirm.js +33 -78
  187. package/lib/chevre/service/transaction/placeOrder/publishConfirmationNumberIfNotExist.d.ts +4 -7
  188. package/lib/chevre/service/transaction/placeOrder/publishConfirmationNumberIfNotExist.js +33 -15
  189. package/lib/chevre/service/transaction/placeOrder/start.d.ts +1 -1
  190. package/lib/chevre/service/transaction/placeOrder/updateAgent/fixCustomer.d.ts +20 -0
  191. package/lib/chevre/service/transaction/placeOrder/updateAgent/fixCustomer.js +63 -0
  192. package/lib/chevre/service/transaction/placeOrder/updateAgent.d.ts +0 -1
  193. package/lib/chevre/service/transaction/placeOrder/updateAgent.js +17 -86
  194. package/lib/chevre/service/transaction/returnOrder/preStart.js +1 -1
  195. package/lib/chevre/service.d.ts +4 -0
  196. package/lib/chevre/service.js +12 -1
  197. package/lib/chevre/taskSettings.d.ts +1 -3
  198. package/package.json +8 -11
  199. package/lib/chevre/service/order/findConfirmedPlaceOrder.d.ts +0 -13
  200. package/lib/chevre/service/order/findConfirmedPlaceOrder.js +0 -32
  201. package/lib/chevre/service/reserve/findReservations.d.ts +0 -33
  202. package/lib/chevre/service/reserve/findReservations.js +0 -61
@@ -1,22 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateAgent = updateAgent;
4
- const google_libphonenumber_1 = require("google-libphonenumber");
5
4
  const factory_1 = require("../../../factory");
6
- function fixCustomer(params) {
5
+ const fixCustomer_1 = require("./updateAgent/fixCustomer");
6
+ /**
7
+ * 取引人プロフィール更新
8
+ */
9
+ function updateAgent(params) {
7
10
  return async (repos) => {
8
- let formattedTelephone;
9
- try {
10
- const phoneUtil = google_libphonenumber_1.PhoneNumberUtil.getInstance();
11
- const phoneNumber = phoneUtil.parse(params.agent.telephone, params.agent.telephoneRegion);
12
- if (!phoneUtil.isValidNumber(phoneNumber)) {
13
- throw new factory_1.factory.errors.Argument('telephone', 'Invalid phone number');
14
- }
15
- formattedTelephone = phoneUtil.format(phoneNumber, google_libphonenumber_1.PhoneNumberFormat.E164);
16
- }
17
- catch (error) {
18
- throw new factory_1.factory.errors.Argument('telephone', (error instanceof Error) ? error.message : String(error));
19
- }
20
11
  const transaction = await repos.placeOrder.findPlaceOrderInProgressById({
21
12
  typeOf: factory_1.factory.transactionType.PlaceOrder,
22
13
  id: params.id
@@ -24,77 +15,17 @@ function fixCustomer(params) {
24
15
  if (transaction.agent.id !== params.agent.id) {
25
16
  throw new factory_1.factory.errors.Forbidden('Transaction not yours');
26
17
  }
27
- // 注文取引の場合、object.customerにも適用
28
- let customer;
29
- if (transaction.typeOf === factory_1.factory.transactionType.PlaceOrder) {
30
- // orderInTransaction.customer?.typeOfは取引開始時にセットされている前提で再実装(2026-06-24~)
31
- const customerByTransaction = await repos.orderInTransaction.findCustomerByOrderIdentifier({
32
- identifier: params.id,
33
- // project: { id: transaction.project.id }
34
- });
35
- // // いったんtransaction.object.customer?.typeOfは取引開始時にセットされている前提
36
- // const customerByTransaction = transaction.object.customer;
37
- if (typeof customerByTransaction?.typeOf === 'string') {
38
- customer = {
39
- typeOf: customerByTransaction.typeOf,
40
- id: customerByTransaction.id,
41
- ...(Array.isArray(customerByTransaction.identifier))
42
- ? { identifier: customerByTransaction.identifier }
43
- : /* istanbul ignore next */ undefined,
44
- ...(Array.isArray(params.agent.additionalProperty))
45
- ? { additionalProperty: params.agent.additionalProperty }
46
- : /* istanbul ignore next */ undefined,
47
- ...(typeof params.agent.age === 'string') ? { age: params.agent.age }
48
- : /* istanbul ignore next */ undefined,
49
- ...(typeof params.agent.address === 'string') ? { address: params.agent.address }
50
- : /* istanbul ignore next */ undefined,
51
- ...(typeof params.agent.email === 'string') ? { email: params.agent.email }
52
- : /* istanbul ignore next */ undefined,
53
- ...(typeof params.agent.familyName === 'string') ? { familyName: params.agent.familyName }
54
- : /* istanbul ignore next */ undefined,
55
- ...(typeof params.agent.gender === 'string') ? { gender: params.agent.gender }
56
- : /* istanbul ignore next */ undefined,
57
- ...(typeof params.agent.givenName === 'string') ? { givenName: params.agent.givenName }
58
- : /* istanbul ignore next */ undefined,
59
- ...(typeof params.agent.name === 'string') ? { name: params.agent.name } : /* istanbul ignore next */ undefined,
60
- ...(typeof formattedTelephone === 'string') ? { telephone: formattedTelephone } : /* istanbul ignore next */ undefined,
61
- ...(typeof params.agent.url === 'string') ? { url: params.agent.url } : /* istanbul ignore next */ undefined
62
- };
63
- }
64
- }
65
- return { customer, transaction };
66
- };
67
- }
68
- /**
69
- * 取引人プロフィール更新
70
- */
71
- function updateAgent(params) {
72
- return async (repos) => {
73
- const { customer, transaction } = await fixCustomer(params)(repos);
74
- // also save in orderInTransaction(2024-06-20~)
75
- if (customer !== undefined) {
76
- // // 注文ドキュメントを参照(2026-06-24~)
77
- // const orderNumber = await repos.orderInTransaction.findOrderNumberByIdentifier({
78
- // identifier: params.id,
79
- // project: { id: transaction.project.id },
80
- // }, { onlyPlaceOrder: true });
81
- const customerName = (typeof customer.name === 'string' && customer.name !== '')
82
- ? customer.name
83
- : (typeof customer.givenName === 'string' && typeof customer.familyName === 'string'
84
- && customer.givenName !== '' && customer.familyName !== '')
85
- ? `${customer.givenName} ${customer.familyName}`
86
- : undefined;
87
- const customerInOrder = {
88
- ...customer,
89
- identifier: (Array.isArray(customer.identifier)) ? customer.identifier : [],
90
- ...(typeof customerName === 'string') ? { name: customerName } : undefined
91
- };
92
- await repos.orderInTransaction.setCustomerByIdentifier({
93
- project: transaction.project,
94
- identifier: params.id,
95
- customer: customerInOrder
96
- });
97
- }
98
- // return newAgent;
18
+ const { id: _id, typeOf: _typeOf, ...profileByRequest } = params.agent;
19
+ const { customer } = await (0, fixCustomer_1.fixCustomer)({ id: params.id, profileByRequest })(repos);
20
+ // // 注文ドキュメントを参照(2026-06-24~)
21
+ // const orderNumber = await repos.orderInTransaction.findOrderNumberByIdentifier({
22
+ // identifier: params.id,
23
+ // project: { id: transaction.project.id },
24
+ // }, { onlyPlaceOrder: true });
25
+ await repos.orderInTransaction.setCustomerByIdentifier({
26
+ project: transaction.project,
27
+ identifier: params.id,
28
+ customer
29
+ });
99
30
  };
100
31
  }
@@ -28,7 +28,7 @@ function preStart(params) {
28
28
  await validateOrder({ orders })();
29
29
  let offers = [];
30
30
  if (offerIds.length > 0) {
31
- offers = await repos.offer.search({
31
+ offers = await repos.offer.findUnitPriceOffers({
32
32
  id: { $in: offerIds }
33
33
  });
34
34
  }
@@ -17,6 +17,7 @@ import type * as AnyPaymentService from './service/payment/any';
17
17
  import type * as ProjectService from './service/project';
18
18
  import type * as ReserveService from './service/reserve';
19
19
  import type * as TaskService from './service/task';
20
+ import type * as AsyncActionService from './service/asyncAction';
20
21
  import type * as TransactionService from './service/transaction';
21
22
  export declare namespace aggregation {
22
23
  function createService(): Promise<typeof AggregationService>;
@@ -53,6 +54,9 @@ export declare namespace reserve {
53
54
  export declare namespace task {
54
55
  function createService(): Promise<typeof TaskService>;
55
56
  }
57
+ export declare namespace asyncAction {
58
+ function createService(): Promise<typeof AsyncActionService>;
59
+ }
56
60
  export declare namespace transaction {
57
61
  function createService(): Promise<typeof TransactionService>;
58
62
  }
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.factory = exports.transaction = exports.task = exports.reserve = exports.project = exports.payment = exports.order = exports.offer = exports.notification = exports.iam = exports.event = exports.assetTransaction = exports.aggregation = void 0;
36
+ exports.factory = exports.transaction = exports.asyncAction = exports.task = exports.reserve = exports.project = exports.payment = exports.order = exports.offer = exports.notification = exports.iam = exports.event = exports.assetTransaction = exports.aggregation = void 0;
37
37
  /* eslint-disable @typescript-eslint/no-namespace */
38
38
  /**
39
39
  * service module
@@ -167,6 +167,17 @@ var task;
167
167
  }
168
168
  task.createService = createService;
169
169
  })(task || (exports.task = task = {}));
170
+ var asyncAction;
171
+ (function (asyncAction) {
172
+ let service;
173
+ async function createService() {
174
+ if (service === undefined) {
175
+ service = await import('./service/asyncAction.js');
176
+ }
177
+ return service;
178
+ }
179
+ asyncAction.createService = createService;
180
+ })(asyncAction || (exports.asyncAction = asyncAction = {}));
170
181
  var transaction;
171
182
  (function (transaction) {
172
183
  let service;
@@ -24,13 +24,11 @@ interface IExecuteOptions {
24
24
  executeById: boolean;
25
25
  executeByName: boolean;
26
26
  }
27
- type IOperation<T> = (settings: IExecuteSettings) => Promise<T>;
28
27
  type IOperationExecute<T> = (settings: IExecuteSettings, options: IExecuteOptions) => Promise<T>;
29
28
  type ICallResult = void | Pick<factory.task.IExecutionResult, 'error'>;
30
- type ICallableTaskOperationSimple = (taskData: factory.task.IData<factory.taskName>) => IOperation<void>;
31
29
  type ICallableTaskOperation = (task: IExecutableTask<factory.taskName>) => IOperationExecute<ICallResult>;
32
30
  type IExecutableTaskKeys = 'data' | 'id' | 'name' | 'status' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt' | 'expires';
33
31
  type IExecutableTask<T extends factory.taskName> = Pick<factory.task.ITask<T>, IExecutableTaskKeys> & {
34
32
  status: factory.taskStatus.Running;
35
33
  };
36
- export { ICallableTaskOperation, ICallableTaskOperationSimple, ICallResult, IExecutableTask, IExecutableTaskKeys, IExecuteSettings, IExecuteOptions, IOperationExecute, AggregationSettings };
34
+ export { ICallableTaskOperation, ICallResult, IExecutableTask, IExecutableTaskKeys, IExecuteSettings, IExecuteOptions, IOperationExecute, AggregationSettings };
package/package.json CHANGED
@@ -9,24 +9,24 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@aws-sdk/client-cognito-identity-provider": "3.600.0",
13
- "@aws-sdk/credential-providers": "3.600.0",
14
- "@chevre/factory": "9.5.0-alpha.3",
12
+ "@aws-sdk/client-cognito-identity-provider": "3.1090.0",
13
+ "@aws-sdk/credential-providers": "3.1090.0",
14
+ "@chevre/factory": "10.1.0-alpha.1",
15
15
  "@motionpicture/coa-service": "10.0.0",
16
16
  "@motionpicture/gmo-service": "6.1.0-alpha.0",
17
17
  "@sendgrid/client": "8.1.4",
18
18
  "@surfrock/sdk": "2.0.0",
19
19
  "debug": "4.4.3",
20
- "google-libphonenumber": "^3.2.18",
21
20
  "http-status": "2.1.0",
22
21
  "jsonwebtoken": "9.0.0",
22
+ "libphonenumber-js": "1.13.8",
23
23
  "lodash.difference": "^4.5.0",
24
24
  "moment": "^2.29.1",
25
25
  "moment-timezone": "^0.5.33",
26
26
  "node-fpe": "2.0.4",
27
27
  "pug": "3.0.3",
28
28
  "uniqid": "5.4.0",
29
- "uuid": "^3.4.0"
29
+ "uuid": "11.1.1"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@eslint/js": "9.39.4",
@@ -34,21 +34,18 @@
34
34
  "@sendgrid/helpers": "8.0.0",
35
35
  "@size-limit/preset-big-lib": "12.0.0",
36
36
  "@types/debug": "4.1.13",
37
- "@types/google-libphonenumber": "^7.4.19",
38
37
  "@types/jsonwebtoken": "9.0.1",
39
38
  "@types/lodash.difference": "^4.5.6",
40
39
  "@types/node": "22.19.7",
41
40
  "@types/pug": "2.0.10",
42
41
  "@types/uniqid": "^4.1.3",
43
- "@types/uuid": "^3.4.10",
44
42
  "@vitest/coverage-v8": "4.0.18",
45
43
  "@vitest/ui": "4.0.18",
46
44
  "csvtojson": "^2.0.10",
47
45
  "dependency-cruiser": "17.3.8",
48
46
  "eslint": "9.39.2",
49
- "mongodb": "6.20.0",
50
47
  "mongoose": "8.23.0",
51
- "redis": "4.6.5",
48
+ "redis": "4.7.1",
52
49
  "rimraf": "6.1.3",
53
50
  "size-limit": "12.0.0",
54
51
  "typescript": "5.9.3",
@@ -57,7 +54,7 @@
57
54
  },
58
55
  "peerDependencies": {
59
56
  "mongoose": "^8.23.0",
60
- "redis": "^4.6.5"
57
+ "redis": "^4.7.1"
61
58
  },
62
59
  "engines": {
63
60
  "node": ">=22.0.0",
@@ -91,5 +88,5 @@
91
88
  "postversion": "git push origin --tags",
92
89
  "prepublishOnly": "npm run clean && npm run build"
93
90
  },
94
- "version": "25.2.0-alpha.5"
91
+ "version": "25.2.0-alpha.50"
95
92
  }
@@ -1,13 +0,0 @@
1
- import type { PlaceOrderRepo } from '../../repo/transaction/placeOrder';
2
- import { factory } from '../../factory';
3
- type ITransaction = Pick<factory.transaction.placeOrder.ITransaction, 'id' | 'potentialActions' | 'project' | 'typeOf'>;
4
- export declare function findConfirmedPlaceOrder(params: {
5
- project: {
6
- id: string;
7
- };
8
- confirmationNumber: string;
9
- orderNumber: string;
10
- }): (repos: {
11
- placeOrder: PlaceOrderRepo;
12
- }) => Promise<ITransaction>;
13
- export {};
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findConfirmedPlaceOrder = findConfirmedPlaceOrder;
4
- const factory_1 = require("../../factory");
5
- function findConfirmedPlaceOrder(params) {
6
- return async (repos) => {
7
- const placeOrderTransactions = await repos.placeOrder.findPlaceOrderTransactions({
8
- limit: 1,
9
- page: 1,
10
- project: { id: { $eq: params.project.id } },
11
- typeOf: factory_1.factory.transactionType.PlaceOrder,
12
- statuses: [factory_1.factory.transactionStatusType.Confirmed],
13
- // resultではなくobjectで参照するように変更(2026-06-16~)
14
- object: {
15
- confirmationNumber: { $eq: params.confirmationNumber },
16
- orderNumber: { $eq: params.orderNumber },
17
- },
18
- // result: {
19
- // order: {
20
- // confirmationNumber: { $eq: params.confirmationNumber },
21
- // orderNumbers: [params.orderNumber]
22
- // }
23
- // },
24
- inclusion: ['potentialActions', 'project', 'typeOf']
25
- });
26
- const placeOrderTransaction = placeOrderTransactions.shift();
27
- if (placeOrderTransaction === undefined) {
28
- throw new factory_1.factory.errors.NotFound(factory_1.factory.transactionType.PlaceOrder);
29
- }
30
- return placeOrderTransaction;
31
- };
32
- }
@@ -1,33 +0,0 @@
1
- import { factory } from '../../factory';
2
- import type { ReserveTransactionRepo } from '../../repo/assetTransaction/reserve';
3
- import type { IKeyOfProjection, ReservationRepo } from '../../repo/reservation';
4
- /**
5
- * 予約検索レスポンスとしての予約
6
- * 予約ドキュメントに予約取引の情報を補完する
7
- */
8
- type IReservationAsFindResult = Omit<factory.reservation.eventReservation.IReservation, 'underName' | 'reservedTicket' | 'reservationFor'> & {
9
- underName?: factory.assetTransaction.reserve.IUnderName;
10
- reservedTicket?: factory.reservation.eventReservation.IReservedTicket | factory.assetTransaction.reserve.IObjectSubReservation['reservedTicket'];
11
- reservationFor?: factory.reservation.eventReservation.IReservationForMinimized | factory.assetTransaction.reserve.IReservationFor;
12
- price?: never;
13
- };
14
- /**
15
- * 予約を検索する
16
- */
17
- export declare function findReservations(params: factory.reservation.eventReservation.ISearchConditions, options: {
18
- inclusion: Partial<Record<IKeyOfProjection | 'underName', 1>>;
19
- /**
20
- * reservationForを予約ドキュメントそのままで返すかどうか
21
- */
22
- minimizeReservationFor: boolean;
23
- /**
24
- * reservedTicketからticketTypeを除外するかどうか
25
- */
26
- minimizeReservedTicket: boolean;
27
- }): (repos: {
28
- assetTransaction: {
29
- reserve: ReserveTransactionRepo;
30
- };
31
- reservation: ReservationRepo;
32
- }) => Promise<IReservationAsFindResult[]>;
33
- export {};
@@ -1,61 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findReservations = findReservations;
4
- /**
5
- * 予約を検索する
6
- */
7
- function findReservations(params, options) {
8
- return async (repos) => {
9
- const { inclusion, minimizeReservationFor, minimizeReservedTicket } = options;
10
- const rawReservations = await repos.reservation.findReservations(params, inclusion);
11
- if (rawReservations.length === 0) {
12
- return [];
13
- }
14
- else {
15
- const requireUnderName = Object.keys(inclusion).includes('underName');
16
- const requireReservedTicket = Object.keys(inclusion).includes('reservedTicket');
17
- const requireReservationFor = Object.keys(inclusion).includes('reservationFor');
18
- const reservationIds = rawReservations.map(({ id }) => id);
19
- const subReservations = await repos.assetTransaction.reserve.findSubReservationsById({
20
- ids: reservationIds
21
- });
22
- return rawReservations.map((reservation) => {
23
- const subReservationByTransaction = subReservations.find((s) => s.id === reservation.id);
24
- const underNameByTransaction = subReservationByTransaction?.underName;
25
- const ticketTypeByTransaction = subReservationByTransaction?.reservedTicket?.ticketType;
26
- const reservationForByTransaction = subReservationByTransaction?.reservationFor;
27
- const { reservationFor, issuedThrough: _issuedThrough, priceCurrency: _priceCurrency, numSeats: _numSeats, reservedTicket, ...rawReservation4result } = reservation;
28
- return {
29
- ...rawReservation4result, // 予約ドキュメントはそのまま返す
30
- ...(requireUnderName && underNameByTransaction !== undefined) ? { underName: underNameByTransaction } : undefined, // underNameがあれば上書き
31
- ...(requireReservedTicket)
32
- ? (!minimizeReservedTicket && ticketTypeByTransaction !== undefined)
33
- ? {
34
- reservedTicket: {
35
- ...reservedTicket, // 予約ドキュメントのreservedTicketはそのまま返す
36
- ticketType: ticketTypeByTransaction
37
- }
38
- }
39
- : { reservedTicket } // 予約検索レスポンスからticketTypeは廃止(2026-06-01~)
40
- : undefined,
41
- ...(requireReservationFor)
42
- ? (!minimizeReservationFor && reservationForByTransaction !== undefined)
43
- ? { reservationFor: reservationForByTransaction }
44
- : { reservationFor } // 予約検索レスポンスのreservationForはそのまま返す(2026-06-01~)
45
- : undefined,
46
- // ...(requireReservedTicket && ticketTypeByTransaction !== undefined) // ticketTypeがあれば上書き
47
- // ? {
48
- // reservedTicket: {
49
- // ...reservedTicket, // 予約ドキュメントのreservedTicketはそのまま返す
50
- // ticketType: ticketTypeByTransaction
51
- // }
52
- // }
53
- // : undefined,
54
- // ...(requireReservationFor && reservationForByTransaction !== undefined)
55
- // ? { reservationFor: reservationForByTransaction }
56
- // : undefined, // reservationForがあれば上書き(2026-04-06~)
57
- };
58
- });
59
- }
60
- };
61
- }