@chevre/domain 22.2.0-alpha.8 → 22.2.0

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 (248) hide show
  1. package/example/src/chevre/createProject.ts +19 -0
  2. package/example/src/chevre/findValidAuthorization.ts +1 -2
  3. package/example/src/chevre/migrateDeleteTransactionTasks.ts +1 -1
  4. package/example/src/chevre/{migrateMovieTheaterAdditionalProperties.ts → migrateRoomAdditionalProperties.ts} +17 -17
  5. package/example/src/chevre/migrateRoomSectionAdditionalProperties.ts +119 -0
  6. package/example/src/chevre/playAroundTicket.ts +3 -2
  7. package/example/src/chevre/processAction.ts +3 -1
  8. package/example/src/chevre/projectFields.ts +42 -0
  9. package/example/src/chevre/{projectEventFieldsById.ts → projectFieldsById.ts} +7 -12
  10. package/example/src/chevre/searchActionsByPurpose.ts +38 -0
  11. package/example/src/chevre/searchProjects.ts +9 -4
  12. package/example/src/chevre/searchSellersByAggregate.ts +3 -3
  13. package/example/src/chevre/searchTransactions.ts +1 -1
  14. package/example/src/chevre/unsetUnnecessaryFields.ts +2 -41
  15. package/lib/chevre/repo/accountTitle.d.ts +9 -3
  16. package/lib/chevre/repo/accountingReport.d.ts +2 -15
  17. package/lib/chevre/repo/action.d.ts +110 -47
  18. package/lib/chevre/repo/action.js +170 -133
  19. package/lib/chevre/repo/aggregateReservation.d.ts +1 -14
  20. package/lib/chevre/repo/assetTransaction.d.ts +134 -7
  21. package/lib/chevre/repo/assetTransaction.js +2 -2
  22. package/lib/chevre/repo/categoryCode.d.ts +14 -2
  23. package/lib/chevre/repo/categoryCode.js +47 -19
  24. package/lib/chevre/repo/comment.d.ts +5 -1
  25. package/lib/chevre/repo/creativeWork.d.ts +14 -2
  26. package/lib/chevre/repo/customer.d.ts +5 -1
  27. package/lib/chevre/repo/customerType.d.ts +1 -1
  28. package/lib/chevre/repo/event.d.ts +49 -2
  29. package/lib/chevre/repo/member.d.ts +5 -1
  30. package/lib/chevre/repo/merchantReturnPolicy.d.ts +22 -2
  31. package/lib/chevre/repo/message.d.ts +1 -15
  32. package/lib/chevre/repo/mongoose/schemas/account.d.ts +8 -3
  33. package/lib/chevre/repo/mongoose/schemas/account.js +1 -1
  34. package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +8 -3
  35. package/lib/chevre/repo/mongoose/schemas/accountTitle.js +2 -2
  36. package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +8 -3
  37. package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +1 -1
  38. package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +22 -3
  39. package/lib/chevre/repo/mongoose/schemas/accountingReport.js +1 -1
  40. package/lib/chevre/repo/mongoose/schemas/action.d.ts +8 -3
  41. package/lib/chevre/repo/mongoose/schemas/action.js +1 -1
  42. package/lib/chevre/repo/mongoose/schemas/actionRecipe.d.ts +14 -3
  43. package/lib/chevre/repo/mongoose/schemas/actionRecipe.js +2 -5
  44. package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +8 -3
  45. package/lib/chevre/repo/mongoose/schemas/additionalProperty.js +12 -12
  46. package/lib/chevre/repo/mongoose/schemas/aggregateOffer.d.ts +11 -3
  47. package/lib/chevre/repo/mongoose/schemas/aggregateOffer.js +1 -1
  48. package/lib/chevre/repo/mongoose/schemas/aggregateReservation.d.ts +22 -3
  49. package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +1 -1
  50. package/lib/chevre/repo/mongoose/schemas/aggregation.d.ts +7 -3
  51. package/lib/chevre/repo/mongoose/schemas/aggregation.js +2 -1
  52. package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +10 -3
  53. package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +1 -1
  54. package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +8 -3
  55. package/lib/chevre/repo/mongoose/schemas/authorization.js +1 -1
  56. package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +8 -3
  57. package/lib/chevre/repo/mongoose/schemas/categoryCode.js +22 -24
  58. package/lib/chevre/repo/mongoose/schemas/comments.d.ts +8 -3
  59. package/lib/chevre/repo/mongoose/schemas/comments.js +1 -1
  60. package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +10 -3
  61. package/lib/chevre/repo/mongoose/schemas/creativeWork.js +2 -2
  62. package/lib/chevre/repo/mongoose/schemas/customer.d.ts +8 -3
  63. package/lib/chevre/repo/mongoose/schemas/customer.js +1 -1
  64. package/lib/chevre/repo/mongoose/schemas/customerType.d.ts +9 -3
  65. package/lib/chevre/repo/mongoose/schemas/customerType.js +1 -1
  66. package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +8 -3
  67. package/lib/chevre/repo/mongoose/schemas/emailMessages.js +1 -1
  68. package/lib/chevre/repo/mongoose/schemas/event.d.ts +19 -3
  69. package/lib/chevre/repo/mongoose/schemas/event.js +1 -1
  70. package/lib/chevre/repo/mongoose/schemas/member.d.ts +8 -3
  71. package/lib/chevre/repo/mongoose/schemas/member.js +1 -1
  72. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +8 -3
  73. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.js +1 -1
  74. package/lib/chevre/repo/mongoose/schemas/message.d.ts +23 -3
  75. package/lib/chevre/repo/mongoose/schemas/message.js +1 -1
  76. package/lib/chevre/repo/mongoose/schemas/note.d.ts +8 -3
  77. package/lib/chevre/repo/mongoose/schemas/note.js +1 -1
  78. package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +12 -3
  79. package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +1 -1
  80. package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.d.ts +12 -3
  81. package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.js +1 -1
  82. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.d.ts +8 -3
  83. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.js +1 -1
  84. package/lib/chevre/repo/mongoose/schemas/order.d.ts +10 -3
  85. package/lib/chevre/repo/mongoose/schemas/order.js +1 -1
  86. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +10 -3
  87. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +1 -1
  88. package/lib/chevre/repo/mongoose/schemas/paymentService.d.ts +10 -3
  89. package/lib/chevre/repo/mongoose/schemas/paymentService.js +13 -4
  90. package/lib/chevre/repo/mongoose/schemas/place.d.ts +16 -3
  91. package/lib/chevre/repo/mongoose/schemas/place.js +1 -1
  92. package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +11 -3
  93. package/lib/chevre/repo/mongoose/schemas/priceSpecification.js +1 -1
  94. package/lib/chevre/repo/mongoose/schemas/product.d.ts +12 -3
  95. package/lib/chevre/repo/mongoose/schemas/product.js +6 -13
  96. package/lib/chevre/repo/mongoose/schemas/productModel.d.ts +30 -3
  97. package/lib/chevre/repo/mongoose/schemas/productModel.js +1 -1
  98. package/lib/chevre/repo/mongoose/schemas/project.d.ts +12 -3
  99. package/lib/chevre/repo/mongoose/schemas/project.js +3 -3
  100. package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +12 -3
  101. package/lib/chevre/repo/mongoose/schemas/reservation.js +5 -5
  102. package/lib/chevre/repo/mongoose/schemas/role.d.ts +9 -3
  103. package/lib/chevre/repo/mongoose/schemas/role.js +1 -1
  104. package/lib/chevre/repo/mongoose/schemas/seller.d.ts +8 -3
  105. package/lib/chevre/repo/mongoose/schemas/seller.js +22 -24
  106. package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +8 -3
  107. package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +1 -1
  108. package/lib/chevre/repo/mongoose/schemas/task.d.ts +8 -3
  109. package/lib/chevre/repo/mongoose/schemas/task.js +1 -1
  110. package/lib/chevre/repo/mongoose/schemas/telemetry.d.ts +7 -3
  111. package/lib/chevre/repo/mongoose/schemas/telemetry.js +2 -1
  112. package/lib/chevre/repo/mongoose/schemas/ticket.d.ts +26 -3
  113. package/lib/chevre/repo/mongoose/schemas/ticket.js +1 -1
  114. package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +8 -3
  115. package/lib/chevre/repo/mongoose/schemas/transaction.js +2 -2
  116. package/lib/chevre/repo/mongoose/schemas/trip.d.ts +8 -3
  117. package/lib/chevre/repo/mongoose/schemas/trip.js +3 -3
  118. package/lib/chevre/repo/offer.d.ts +13 -4
  119. package/lib/chevre/repo/offerCatalog.d.ts +15 -2
  120. package/lib/chevre/repo/order.d.ts +13 -1
  121. package/lib/chevre/repo/ownershipInfo.d.ts +15 -3
  122. package/lib/chevre/repo/ownershipInfo.js +40 -11
  123. package/lib/chevre/repo/paymentService.d.ts +2 -2
  124. package/lib/chevre/repo/paymentService.js +108 -58
  125. package/lib/chevre/repo/paymentServiceProvider.d.ts +1 -10
  126. package/lib/chevre/repo/place/movieTheater.d.ts +54 -2
  127. package/lib/chevre/repo/priceSpecification.d.ts +42 -1
  128. package/lib/chevre/repo/product.d.ts +8 -3
  129. package/lib/chevre/repo/product.js +67 -33
  130. package/lib/chevre/repo/productModel.d.ts +1 -22
  131. package/lib/chevre/repo/project.d.ts +25 -5
  132. package/lib/chevre/repo/project.js +69 -28
  133. package/lib/chevre/repo/reservation.d.ts +35 -3
  134. package/lib/chevre/repo/reservation.js +1 -1
  135. package/lib/chevre/repo/role.d.ts +2 -9
  136. package/lib/chevre/repo/role.js +20 -10
  137. package/lib/chevre/repo/seller.d.ts +64 -14
  138. package/lib/chevre/repo/seller.js +61 -27
  139. package/lib/chevre/repo/task.d.ts +64 -3
  140. package/lib/chevre/repo/telemetry.d.ts +3 -2
  141. package/lib/chevre/repo/ticket.d.ts +4 -20
  142. package/lib/chevre/repo/ticket.js +23 -10
  143. package/lib/chevre/repo/transaction.d.ts +30 -14
  144. package/lib/chevre/repo/transaction.js +106 -77
  145. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +1 -1
  146. package/lib/chevre/service/aggregation/event/findEventOffers.js +1 -1
  147. package/lib/chevre/service/aggregation/project.js +1 -1
  148. package/lib/chevre/service/assetTransaction/cancelReservation.d.ts +1 -1
  149. package/lib/chevre/service/assetTransaction/cancelReservation.js +2 -2
  150. package/lib/chevre/service/assetTransaction/moneyTransfer.js +1 -1
  151. package/lib/chevre/service/assetTransaction/pay/factory.d.ts +1 -1
  152. package/lib/chevre/service/assetTransaction/pay.js +3 -3
  153. package/lib/chevre/service/assetTransaction/refund/factory.d.ts +1 -1
  154. package/lib/chevre/service/assetTransaction/refund.js +3 -3
  155. package/lib/chevre/service/assetTransaction/registerService.js +4 -6
  156. package/lib/chevre/service/assetTransaction/reserve/start/createSubReservations.js +9 -11
  157. package/lib/chevre/service/assetTransaction/reserve/start/factory/createReservation.js +4 -1
  158. package/lib/chevre/service/assetTransaction/reserve/start.js +1 -3
  159. package/lib/chevre/service/code.d.ts +0 -4
  160. package/lib/chevre/service/code.js +22 -18
  161. package/lib/chevre/service/event.js +4 -4
  162. package/lib/chevre/service/moneyTransfer.js +3 -5
  163. package/lib/chevre/service/notification.js +2 -2
  164. package/lib/chevre/service/offer/event/authorize/factory.d.ts +3 -3
  165. package/lib/chevre/service/offer/event/authorize/factory.js +16 -2
  166. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.js +2 -2
  167. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +3 -2
  168. package/lib/chevre/service/offer/event/authorize.d.ts +4 -2
  169. package/lib/chevre/service/offer/event/authorize.js +3 -2
  170. package/lib/chevre/service/offer/event/importFromCOA.js +2 -2
  171. package/lib/chevre/service/offer/event/searchEventTicketOffers.js +4 -12
  172. package/lib/chevre/service/offer/event/voidTransaction.js +2 -2
  173. package/lib/chevre/service/offer/event/voidTransactionByActionId.js +1 -1
  174. package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer/authorize.d.ts +2 -2
  175. package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer/authorize.js +41 -4
  176. package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer/factory.d.ts +3 -3
  177. package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +3 -3
  178. package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +7 -3
  179. package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +10 -5
  180. package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.d.ts +3 -1
  181. package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.d.ts +3 -1
  182. package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +14 -6
  183. package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +8 -5
  184. package/lib/chevre/service/offer/eventServiceByCOA/validateAcceptedOffers.d.ts +1 -1
  185. package/lib/chevre/service/offer/moneyTransfer/authorize.js +1 -1
  186. package/lib/chevre/service/offer/moneyTransfer/voidTransaction.js +1 -1
  187. package/lib/chevre/service/offer/product/searchProductOffers.js +1 -3
  188. package/lib/chevre/service/offer/product.d.ts +4 -2
  189. package/lib/chevre/service/offer/product.js +12 -12
  190. package/lib/chevre/service/order/findPlaceOrderTransaction.js +1 -1
  191. package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
  192. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +1 -1
  193. package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +1 -1
  194. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
  195. package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +3 -3
  196. package/lib/chevre/service/order/placeOrder.js +1 -1
  197. package/lib/chevre/service/order/returnOrder.js +1 -1
  198. package/lib/chevre/service/payment/any/factory.d.ts +1 -1
  199. package/lib/chevre/service/payment/any/onPaid.d.ts +1 -1
  200. package/lib/chevre/service/payment/any/onRefund.d.ts +1 -1
  201. package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.d.ts +1 -4
  202. package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.js +21 -26
  203. package/lib/chevre/service/payment/any.d.ts +3 -1
  204. package/lib/chevre/service/payment/any.js +21 -13
  205. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.js +1 -1
  206. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard3ds.js +1 -1
  207. package/lib/chevre/service/payment/creditCard/payCreditCard.d.ts +1 -2
  208. package/lib/chevre/service/payment/creditCard/payCreditCard.js +12 -5
  209. package/lib/chevre/service/payment/creditCard/refundCreditCard.js +13 -3
  210. package/lib/chevre/service/payment/creditCard/voidTransaction.js +1 -1
  211. package/lib/chevre/service/payment/faceToFace.d.ts +2 -2
  212. package/lib/chevre/service/payment/faceToFace.js +28 -10
  213. package/lib/chevre/service/payment/movieTicket/authorize.d.ts +0 -1
  214. package/lib/chevre/service/payment/movieTicket/authorize.js +8 -3
  215. package/lib/chevre/service/payment/movieTicket/payMovieTicket.d.ts +1 -2
  216. package/lib/chevre/service/payment/movieTicket/payMovieTicket.js +12 -4
  217. package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +15 -4
  218. package/lib/chevre/service/payment/movieTicket/validation.js +1 -1
  219. package/lib/chevre/service/payment/paymentCard.d.ts +2 -2
  220. package/lib/chevre/service/payment/paymentCard.js +29 -16
  221. package/lib/chevre/service/payment.d.ts +1 -1
  222. package/lib/chevre/service/report/telemetry.js +2 -2
  223. package/lib/chevre/service/reserve/cancelReservation.js +1 -1
  224. package/lib/chevre/service/reserve/confirmReservation.js +1 -1
  225. package/lib/chevre/service/task/onAuthorizationCreated.js +20 -16
  226. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +2 -2
  227. package/lib/chevre/service/task/onResourceUpdated/syncCategoryCode.js +1 -1
  228. package/lib/chevre/service/task/onResourceUpdated.js +16 -4
  229. package/lib/chevre/service/task/publishPaymentUrl.js +4 -0
  230. package/lib/chevre/service/task/returnPayTransaction.js +1 -1
  231. package/lib/chevre/service/transaction/deleteTransaction.js +2 -2
  232. package/lib/chevre/service/transaction/moneyTransfer.js +4 -4
  233. package/lib/chevre/service/transaction/placeOrder/confirm.js +1 -1
  234. package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +1 -1
  235. package/lib/chevre/service/transaction/placeOrder/start/validateStartRequest.d.ts +2 -2
  236. package/lib/chevre/service/transaction/placeOrder/start/validateStartRequest.js +1 -1
  237. package/lib/chevre/service/transaction/placeOrder/start.js +1 -1
  238. package/lib/chevre/service/transaction/returnOrder/preStart.d.ts +2 -2
  239. package/lib/chevre/service/transaction/returnOrder/preStart.js +1 -1
  240. package/lib/chevre/service/transaction/returnOrder.js +2 -2
  241. package/lib/chevre/service/transaction.js +1 -1
  242. package/package.json +4 -4
  243. package/example/src/chevre/findTransactionById.ts +0 -23
  244. package/example/src/chevre/findTransactionInProgressById.ts +0 -23
  245. package/example/src/chevre/migrateTransactionObjectPaymentMethods.ts +0 -154
  246. package/example/src/chevre/projectReservationFields.ts +0 -31
  247. package/example/src/chevre/searchActions.ts +0 -40
  248. package/example/src/chevre/searchProducts.ts +0 -28
@@ -39,7 +39,7 @@ function createDeleteTransactionTasksByAgentId(params) {
39
39
  // agentIdによる全取引についてDeleteTransactionタスクを作成する
40
40
  if (typeof agentIdSpecified === 'string' && agentIdSpecified.length > 0) {
41
41
  const transactionTypeOf = params.object.typeOf;
42
- const transactions = yield repos.transaction.search({
42
+ const transactions = yield repos.transaction.projectFields({
43
43
  project: { id: { $eq: params.object.project.id } },
44
44
  agent: {
45
45
  ids: [agentIdSpecified],
@@ -128,7 +128,7 @@ function deleteTransactionById(params) {
128
128
  if (typeof deletingTransactionId !== 'string' || deletingTransactionId.length === 0) {
129
129
  throw new factory.errors.ArgumentNull('object.id');
130
130
  }
131
- const transaction = (yield repos.transaction.search({
131
+ const transaction = (yield repos.transaction.projectFields({
132
132
  ids: [deletingTransactionId],
133
133
  typeOf: params.object.typeOf,
134
134
  inclusion: ['typeOf', 'project', 'status', 'result']
@@ -28,7 +28,7 @@ const CodeService = require("../code");
28
28
  function start(params) {
29
29
  return (repos, credentials) => __awaiter(this, void 0, void 0, function* () {
30
30
  const { passport } = yield repos.passport.validatePassportTokenIfExist(params);
31
- const sellers = yield repos.seller.search({
31
+ const sellers = yield repos.seller.projectFields({
32
32
  limit: 1,
33
33
  page: 1,
34
34
  id: { $eq: params.seller.id }
@@ -162,7 +162,7 @@ function fixToLocation(params) {
162
162
  function processAuthorizePaymentCard(params) {
163
163
  return (repos, credentials) => __awaiter(this, void 0, void 0, function* () {
164
164
  var _a;
165
- const transaction = yield repos.transaction.findInProgressById({
165
+ const transaction = yield repos.transaction.projectFieldsInProgressById({
166
166
  typeOf: factory.transactionType.MoneyTransfer,
167
167
  id: params.purpose.id
168
168
  }, ['agent', 'project', 'recipient', 'seller', 'typeOf', 'object']);
@@ -504,7 +504,7 @@ function validateToLocation(project, toLocationBeforeStart, issuedThrough) {
504
504
  function confirm(params) {
505
505
  return (repos) => __awaiter(this, void 0, void 0, function* () {
506
506
  const now = new Date();
507
- const transaction = yield repos.transaction.findById({
507
+ const transaction = yield repos.transaction.projectFieldsById({
508
508
  typeOf: factory.transactionType.MoneyTransfer,
509
509
  id: params.id
510
510
  }, ['typeOf', 'status', 'project']);
@@ -562,7 +562,7 @@ function searchAuthorizeActions(params) {
562
562
  */
563
563
  function exportTasksById(params) {
564
564
  return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
565
- const transaction = yield repos.transaction.findById({
565
+ const transaction = yield repos.transaction.projectFieldsById({
566
566
  typeOf: factory.transactionType.MoneyTransfer,
567
567
  id: params.id
568
568
  }, ['endDate', 'status', 'project', 'startDate', 'typeOf', 'object', 'potentialActions']);
@@ -59,7 +59,7 @@ function confirm(params, options) {
59
59
  status: { $in: [factory.transactionStatusType.Confirmed, factory.transactionStatusType.InProgress] },
60
60
  object: { orderDate: params.result.order.orderDate }
61
61
  })(repos);
62
- const transaction = yield repos.transaction.findById({ typeOf: factory.transactionType.PlaceOrder, id: params.id }, ['typeOf', 'project', 'status', 'agent', 'seller', 'object', 'result']);
62
+ const transaction = yield repos.transaction.projectFieldsById({ typeOf: factory.transactionType.PlaceOrder, id: params.id }, ['typeOf', 'project', 'status', 'agent', 'seller', 'object', 'result']);
63
63
  const confirmResult = yield processTransactionNotInProgress(transaction)(repos);
64
64
  if (confirmResult !== undefined) {
65
65
  return confirmResult;
@@ -18,7 +18,7 @@ const factory_1 = require("./exportTasks/factory");
18
18
  */
19
19
  function exportTasksById(params) {
20
20
  return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
21
- const transaction = yield repos.transaction.findById({
21
+ const transaction = yield repos.transaction.projectFieldsById({
22
22
  typeOf: factory.transactionType.PlaceOrder,
23
23
  id: params.id
24
24
  }, ['endDate', 'object', 'project', 'seller', 'startDate', 'status', 'typeOf']);
@@ -1,8 +1,8 @@
1
1
  import type { MemberRepo } from '../../../../repo/member';
2
2
  import type { ProjectMakesOfferRepo } from '../../../../repo/projectMakesOffer';
3
- import type { SellerRepo } from '../../../../repo/seller';
3
+ import type { ISellerWithId, SellerRepo } from '../../../../repo/seller';
4
4
  import * as factory from '../../../../factory';
5
- type ISeller = Pick<factory.seller.ISeller, 'id' | 'name' | 'project' | 'typeOf' | 'makesOffer' | 'additionalProperty'>;
5
+ type ISeller = Pick<ISellerWithId, 'id' | 'name' | 'project' | 'typeOf' | 'makesOffer' | 'additionalProperty'>;
6
6
  declare function validateStartRequest(params: {
7
7
  project: {
8
8
  id: string;
@@ -67,7 +67,7 @@ function validateStartRequest(params) {
67
67
  if (projectMakesOffer === undefined) {
68
68
  throw new factory.errors.Argument('project', 'project makes no offers');
69
69
  }
70
- const seller = (yield repos.seller.search({
70
+ const seller = (yield repos.seller.projectFields({
71
71
  limit: 1,
72
72
  page: 1,
73
73
  project: { id: { $eq: params.project.id } },
@@ -35,7 +35,7 @@ function start(params, options) {
35
35
  }
36
36
  catch (error) {
37
37
  // in case already locked
38
- const alreadyStartedTransaction = (yield repos.transaction.search({
38
+ const alreadyStartedTransaction = (yield repos.transaction.projectFields({
39
39
  limit: 1, page: 1,
40
40
  typeOf: factory.transactionType.PlaceOrder,
41
41
  project: { id: { $eq: startParams.project.id } },
@@ -7,7 +7,7 @@ import type { OfferItemConditionRepo } from '../../../repo/offerItemCondition';
7
7
  import type { OrderRepo } from '../../../repo/order';
8
8
  import type { ProjectRepo } from '../../../repo/project';
9
9
  import type { ReservationRepo } from '../../../repo/reservation';
10
- import type { SellerRepo } from '../../../repo/seller';
10
+ import type { ISellerWithId, SellerRepo } from '../../../repo/seller';
11
11
  interface IPreStartOperationRepos {
12
12
  acceptedOffer: AcceptedOfferRepo;
13
13
  event: EventRepo;
@@ -20,7 +20,7 @@ interface IPreStartOperationRepos {
20
20
  seller: SellerRepo;
21
21
  }
22
22
  type IPreStartOperation<T> = (repos: IPreStartOperationRepos) => Promise<T>;
23
- type IFixedSeller = Pick<factory.seller.ISeller, 'id' | 'name' | 'project' | 'hasMerchantReturnPolicy' | 'typeOf'>;
23
+ type IFixedSeller = Pick<ISellerWithId, 'id' | 'name' | 'project' | 'hasMerchantReturnPolicy' | 'typeOf'>;
24
24
  /**
25
25
  * 返品取引開始前処理
26
26
  */
@@ -36,7 +36,7 @@ function preStart(params) {
36
36
  const now = new Date();
37
37
  const { acceptedOffers, eventIds, offerIds, orders } = yield fixOrders(params)(repos);
38
38
  // sellerはorderから自動取得
39
- const sellers = yield repos.seller.search({
39
+ const sellers = yield repos.seller.projectFields({
40
40
  limit: 1,
41
41
  page: 1,
42
42
  id: { $eq: String(orders[0].seller.id) }
@@ -83,7 +83,7 @@ function saveMessagesIfNeeded(params) {
83
83
  function confirm(params) {
84
84
  return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
85
85
  var _a;
86
- const transaction = yield repos.transaction.findById({ typeOf: factory.transactionType.ReturnOrder, id: params.id }, ['typeOf', 'status', 'project', 'agent', 'object', 'result']);
86
+ const transaction = yield repos.transaction.projectFieldsById({ typeOf: factory.transactionType.ReturnOrder, id: params.id }, ['typeOf', 'status', 'project', 'agent', 'object', 'result']);
87
87
  if (transaction.status === factory.transactionStatusType.Confirmed) {
88
88
  // すでに確定済の場合
89
89
  return transaction.result;
@@ -148,7 +148,7 @@ exports.confirm = confirm;
148
148
  */
149
149
  function exportTasksById(params) {
150
150
  return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
151
- const transaction = yield repos.transaction.findById({ typeOf: factory.transactionType.ReturnOrder, id: params.id }, ['typeOf', 'status', 'project', 'endDate', 'startDate', 'object', 'potentialActions']);
151
+ const transaction = yield repos.transaction.projectFieldsById({ typeOf: factory.transactionType.ReturnOrder, id: params.id }, ['typeOf', 'status', 'project', 'endDate', 'startDate', 'object', 'potentialActions']);
152
152
  // タスク実行日時バッファの指定があれば調整
153
153
  let taskRunsAt = new Date();
154
154
  if (typeof params.runsTasksAfterInSeconds === 'number') {
@@ -39,7 +39,7 @@ function fixCustomer(params) {
39
39
  catch (error) {
40
40
  throw new factory.errors.Argument('telephone', error.message);
41
41
  }
42
- const transaction = yield repos.transaction.findInProgressById({
42
+ const transaction = yield repos.transaction.projectFieldsInProgressById({
43
43
  typeOf: params.typeOf,
44
44
  id: params.id
45
45
  }, ['agent', 'object', 'typeOf', 'project']);
package/package.json CHANGED
@@ -9,9 +9,9 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.381.0-alpha.7",
13
- "@cinerino/sdk": "10.5.0-alpha.2",
14
- "@motionpicture/coa-service": "9.4.0",
12
+ "@chevre/factory": "4.382.0",
13
+ "@cinerino/sdk": "10.8.0",
14
+ "@motionpicture/coa-service": "9.5.0-alpha.0",
15
15
  "@motionpicture/gmo-service": "5.3.0",
16
16
  "@sendgrid/mail": "6.4.0",
17
17
  "@surfrock/sdk": "1.3.0",
@@ -110,5 +110,5 @@
110
110
  "postversion": "git push origin --tags",
111
111
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
112
112
  },
113
- "version": "22.2.0-alpha.8"
113
+ "version": "22.2.0"
114
114
  }
@@ -1,23 +0,0 @@
1
- // tslint:disable:no-console
2
- import * as mongoose from 'mongoose';
3
-
4
- import { chevre } from '../../../lib/index';
5
-
6
- async function main() {
7
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
8
-
9
- const transactionRepo = await chevre.repository.Transaction.createInstance(mongoose.connection);
10
-
11
- const transaction = await transactionRepo.findById(
12
- {
13
- typeOf: chevre.factory.transactionType.PlaceOrder,
14
- id: '666e59edbf16a7761d26f8f4'
15
- },
16
- ['status']
17
- );
18
- console.log('transaction:', transaction);
19
- }
20
-
21
- main()
22
- .then(console.log)
23
- .catch(console.error);
@@ -1,23 +0,0 @@
1
- // tslint:disable:no-console
2
- import * as mongoose from 'mongoose';
3
-
4
- import { chevre } from '../../../lib/index';
5
-
6
- async function main() {
7
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
8
-
9
- const transactionRepo = await chevre.repository.Transaction.createInstance(mongoose.connection);
10
-
11
- const transaction = await transactionRepo.findInProgressById(
12
- {
13
- typeOf: chevre.factory.transactionType.PlaceOrder,
14
- id: '6656d35dd1f13f8c658be102'
15
- },
16
- ['status']
17
- );
18
- console.log('transaction:', transaction);
19
- }
20
-
21
- main()
22
- .then(console.log)
23
- .catch(console.error);
@@ -1,154 +0,0 @@
1
- // tslint:disable:no-console
2
- import * as moment from 'moment';
3
- import * as mongoose from 'mongoose';
4
-
5
- import { chevre } from '../../../lib/index';
6
-
7
- // const project = { id: String(process.env.PROJECT_ID) };
8
-
9
- type IAcceptPayAction = chevre.factory.action.accept.pay.IAction;
10
-
11
- // tslint:disable-next-line:max-func-body-length
12
- async function main() {
13
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
14
-
15
- const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
16
- const transactionRepo = await chevre.repository.Transaction.createInstance(mongoose.connection);
17
-
18
- const cursor = transactionRepo.getCursor(
19
- {
20
- // 'project.id': { $eq: project.id },
21
- typeOf: { $eq: chevre.factory.transactionType.PlaceOrder },
22
- status: { $eq: chevre.factory.transactionStatusType.Confirmed },
23
- startDate: {
24
- $gte: moment()
25
- // tslint:disable-next-line:no-magic-numbers
26
- .add(-30, 'days')
27
- .toDate()
28
- }
29
- },
30
- {
31
- startDate: 1,
32
- project: 1,
33
- object: 1
34
- }
35
- );
36
- console.log('transactions found');
37
-
38
- let i = 0;
39
- let updateCount = 0;
40
- let saveRecipeCount = 0;
41
- // tslint:disable-next-line:max-func-body-length
42
- await cursor.eachAsync(async (doc) => {
43
- i += 1;
44
- const placeOrder: Pick<
45
- chevre.factory.transaction.placeOrder.ITransaction,
46
- 'startDate' | 'project' | 'object' | 'id'
47
- > = doc.toObject();
48
-
49
- const paymentMethodsByTransaction = placeOrder.object.paymentMethods;
50
- const paymentMethodId4paymentUrl = paymentMethodsByTransaction?.paymentMethodId;
51
- const alreadyMigrated =
52
- typeof paymentMethodId4paymentUrl !== 'string'
53
- || (typeof paymentMethodId4paymentUrl === 'string' && (<any>paymentMethodsByTransaction).entryTranArgs === undefined);
54
-
55
- if (alreadyMigrated) {
56
- console.log('already migrated.', placeOrder.project.id, placeOrder.id, placeOrder.startDate, i);
57
- } else {
58
- const acceptPayAction = (<Pick<IAcceptPayAction, 'object' | 'result' | 'id' | 'typeOf' | 'endDate'>[]>await actionRepo.search(
59
- {
60
- limit: 1,
61
- page: 1,
62
- project: { id: { $eq: placeOrder.project.id } },
63
- typeOf: { $eq: chevre.factory.actionType.AcceptAction },
64
- actionStatus: { $in: [chevre.factory.actionStatusType.CompletedActionStatus] },
65
- purpose: { id: { $in: [placeOrder.id] } },
66
- object: {
67
- transactionNumber: { $eq: paymentMethodId4paymentUrl },
68
- typeOf: { $eq: chevre.factory.assetTransactionType.Pay }
69
- }
70
- },
71
- ['object', 'result', 'typeOf', 'endDate'],
72
- []
73
- )).shift();
74
-
75
- if (acceptPayAction !== undefined) {
76
- const actionRecipe = await actionRepo.findRecipeByAction({
77
- project: { id: placeOrder.project.id },
78
- recipeFor: { id: acceptPayAction.id }
79
- });
80
- if (actionRecipe !== null) {
81
- console.log(
82
- 'actionRecipe already exists. step:',
83
- actionRecipe.step.length, placeOrder.project.id, placeOrder.id, placeOrder.startDate, i);
84
-
85
- // 取引から冗長な属性を削除
86
- if ((<any>paymentMethodsByTransaction).entryTranArgs !== undefined) {
87
- await transactionRepo.findByIdAndUpdate4migrate({
88
- id: placeOrder.id,
89
- update: {
90
- $set: { 'object.paymentMethods': { paymentMethodId: paymentMethodId4paymentUrl } }
91
- }
92
- });
93
- updateCount += 1;
94
- }
95
- } else {
96
- const recipe: chevre.factory.action.accept.pay.IRecipe & {
97
- recipeFor: { id: string; typeOf: chevre.factory.actionType };
98
- dateCreated: Date;
99
- dateModified: Date;
100
- } = {
101
- project: { id: placeOrder.project.id, typeOf: chevre.factory.organizationType.Project },
102
- typeOf: 'Recipe',
103
- recipeCategory: chevre.factory.recipe.RecipeCategory.publishPaymentUrl,
104
- recipeFor: { id: acceptPayAction.id, typeOf: acceptPayAction.typeOf },
105
- step: [{
106
- typeOf: 'HowToSection',
107
- itemListElement: [
108
- {
109
- typeOf: 'HowToStep',
110
- identifier: chevre.factory.recipe.StepIdentifier.entryTran,
111
- itemListElement: [{
112
- typeOf: 'HowToDirection',
113
- beforeMedia: (<any>paymentMethodsByTransaction).entryTranArgs,
114
- afterMedia: (<any>paymentMethodsByTransaction).entryTranResult
115
- }]
116
- },
117
- {
118
- typeOf: 'HowToStep',
119
- identifier: chevre.factory.recipe.StepIdentifier.execTran,
120
- itemListElement: [{
121
- typeOf: 'HowToDirection',
122
- beforeMedia: (<any>paymentMethodsByTransaction).execTranArgs,
123
- afterMedia: (<any>paymentMethodsByTransaction).execTranResult
124
- }]
125
- }
126
- ]
127
- }],
128
- dateCreated: moment(acceptPayAction.endDate)
129
- .toDate(),
130
- dateModified: moment(acceptPayAction.endDate)
131
- .toDate()
132
- };
133
- console.log(
134
- 'saving recipe...',
135
- placeOrder.project.id, placeOrder.id, placeOrder.startDate, i);
136
- // console.dir(recipe, { depth: null });
137
- await actionRepo.saveRecipeWithDateCreated(recipe);
138
- saveRecipeCount += 1;
139
- console.log('recipe saved.', placeOrder.project.id, placeOrder.id, placeOrder.startDate, i);
140
- }
141
- } else {
142
- console.log('acceptPayAction does not exist.', placeOrder.project.id, placeOrder.id, placeOrder.startDate, i);
143
- }
144
- }
145
- });
146
-
147
- console.log(i, 'transactions checked');
148
- console.log(updateCount, 'transactions updated');
149
- console.log(saveRecipeCount, 'recipe saved');
150
- }
151
-
152
- main()
153
- .then()
154
- .catch(console.error);
@@ -1,31 +0,0 @@
1
- // tslint:disable:no-console
2
- import * as mongoose from 'mongoose';
3
-
4
- import { chevre } from '../../../lib/index';
5
-
6
- const project = { id: String(process.env.PROJECT_ID) };
7
-
8
- async function main() {
9
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
10
-
11
- const reservationRepo = await chevre.repository.Reservation.createInstance(mongoose.connection);
12
-
13
- const reservations = await reservationRepo.projectFields<chevre.factory.reservationType.EventReservation>(
14
- {
15
- limit: 1,
16
- page: 1,
17
- typeOf: chevre.factory.reservationType.EventReservation,
18
- project: { id: { $eq: project.id } }
19
- },
20
- {
21
- id: 1
22
- }
23
- );
24
- // tslint:disable-next-line:no-null-keyword
25
- console.dir(reservations, { depth: null });
26
- console.log(reservations.length, 'reservations found');
27
- }
28
-
29
- main()
30
- .then()
31
- .catch(console.error);
@@ -1,40 +0,0 @@
1
- // tslint:disable:no-implicit-dependencies no-console
2
- import { chevre } from '../../../lib/index';
3
-
4
- import * as mongoose from 'mongoose';
5
-
6
- // const project = { id: String(process.env.PROJECT_ID) };
7
-
8
- mongoose.Model.on('index', (...args) => {
9
- console.error('******** index event emitted. ********\n', args);
10
- });
11
-
12
- async function main() {
13
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
14
-
15
- const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
16
- const actions = await actionRepo.search(
17
- {
18
- limit: 1,
19
- // typeOf: { $eq: chevre.factory.actionType.CheckAction },
20
- // project: { id: { $eq: project.id } },
21
- // object: {
22
- // movieTickets: {
23
- // identifier: { $eq: '0947524082' },
24
- // serviceOutput: { reservationFor: { id: { $eq: 'clhvvbpyn' } } }
25
- // }
26
- // }
27
- // instrument: { transactionNumber: { $eq: 'x' } },
28
- sameAs: { id: { $eq: '66275034ae5d4c3e8997808c' } }
29
- },
30
- ['_id'],
31
- []
32
- );
33
- console.log('actions:', actions);
34
- }
35
-
36
- main()
37
- .then(() => {
38
- console.log('success!');
39
- })
40
- .catch(console.error);
@@ -1,28 +0,0 @@
1
- // tslint:disable:no-implicit-dependencies no-console
2
- import { chevre } from '../../../lib/index';
3
-
4
- import * as mongoose from 'mongoose';
5
-
6
- const project = { id: String(process.env.PROJECT_ID) };
7
-
8
- async function main() {
9
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
10
-
11
- const productRepo = await chevre.repository.Product.createInstance(mongoose.connection);
12
- const products = await productRepo.searchProducts(
13
- {
14
- project: { id: { $eq: project.id } }
15
- },
16
- // ['_id', 'typeOf'],
17
- [],
18
- []
19
- );
20
- console.log('products:', products);
21
- console.log(products.length, 'products found');
22
- }
23
-
24
- main()
25
- .then(() => {
26
- console.log('success!');
27
- })
28
- .catch(console.error);