@chevre/domain 22.2.0-alpha.9 → 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 +1 -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
@@ -0,0 +1,19 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+ import { chevre } from '../../../lib/index';
4
+
5
+ async function main() {
6
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
7
+
8
+ const projectRepo = await chevre.repository.Project.createInstance(mongoose.connection);
9
+ const result = await projectRepo.createById({
10
+ id: 'xxx',
11
+ typeOf: chevre.factory.organizationType.Project
12
+ });
13
+ // tslint:disable-next-line:no-null-keyword
14
+ console.dir(result, { depth: null });
15
+ }
16
+
17
+ main()
18
+ .then(console.log)
19
+ .catch(console.error);
@@ -31,8 +31,7 @@ async function main() {
31
31
  code: CODE,
32
32
  expiresIn: 18000,
33
33
  issuer: 'https://example.com',
34
- audience: 'https://example.com',
35
- useJti: true
34
+ audience: 'https://example.com'
36
35
  })(
37
36
  {
38
37
  authorization: authorizationRepo,
@@ -68,7 +68,7 @@ async function main() {
68
68
  deleteTransactionTask.project.id, deleteTransactionTask.name, deleteTransactionTask.id, deleteTransactionTask.runsAt,
69
69
  placeOrderTransactionId
70
70
  );
71
- const placeOrderTransaction = (await transactionRepo.search({
71
+ const placeOrderTransaction = (await transactionRepo.projectFields({
72
72
  limit: 1,
73
73
  page: 1,
74
74
  typeOf: chevre.factory.transactionType.PlaceOrder,
@@ -16,7 +16,7 @@ async function main() {
16
16
 
17
17
  const cursor = placeRepo.getCursor(
18
18
  {
19
- typeOf: { $eq: chevre.factory.placeType.MovieTheater }
19
+ typeOf: { $eq: chevre.factory.placeType.ScreeningRoom }
20
20
  // 'project.id': { $eq: project.id },
21
21
  // 'project.id': { $ne: EXCLUDED_PROJECT_ID },
22
22
  },
@@ -37,30 +37,30 @@ async function main() {
37
37
  let i = 0;
38
38
  await cursor.eachAsync(async (doc) => {
39
39
  i += 1;
40
- const movieTheater: chevre.factory.place.movieTheater.IPlace = doc.toObject();
40
+ const screeningRoom: chevre.factory.place.screeningRoom.IPlace = doc.toObject();
41
41
 
42
- const additionalPropertyNamesOnResource = (Array.isArray(movieTheater.additionalProperty))
43
- ? movieTheater.additionalProperty?.map((p) => p.name)
42
+ const additionalPropertyNamesOnResource = (Array.isArray(screeningRoom.additionalProperty))
43
+ ? screeningRoom.additionalProperty?.map((p) => p.name)
44
44
  : [];
45
45
  if (Array.isArray(additionalPropertyNamesOnResource) && additionalPropertyNamesOnResource.length > 0) {
46
46
  console.log(
47
47
  additionalPropertyNamesOnResource.join(','),
48
48
  additionalPropertyNamesOnResource.length,
49
49
  'additionalPropertyNamesOnResource found',
50
- movieTheater.project.id,
51
- movieTheater.branchCode
50
+ screeningRoom.project.id,
51
+ screeningRoom.branchCode
52
52
  );
53
53
  additionalPropertyNames.push(...additionalPropertyNamesOnResource);
54
- projectIds.push(movieTheater.project.id);
54
+ projectIds.push(screeningRoom.project.id);
55
55
  additionalPropertyNamesOnResource.forEach((name) => {
56
56
  if (!name.match(/^[a-zA-Z]*$/)) {
57
57
  // throw new Error(`not matched ${creativeWork.project.id} ${creativeWork.id}`);
58
- unexpextedprojectIds.push(movieTheater.project.id);
58
+ unexpextedprojectIds.push(screeningRoom.project.id);
59
59
  }
60
60
  // tslint:disable-next-line:no-magic-numbers
61
61
  if (name.length < 5) {
62
62
  // throw new Error(`length matched ${creativeWork.project.id} ${creativeWork.id} ${name}`);
63
- unexpextedprojectIds.push(movieTheater.project.id);
63
+ unexpextedprojectIds.push(screeningRoom.project.id);
64
64
  }
65
65
  });
66
66
 
@@ -68,19 +68,19 @@ async function main() {
68
68
  checked += 1;
69
69
  const existingAdditionalProperties = await additionalPropertyRepo.search({
70
70
  limit: 1,
71
- project: { id: { $eq: movieTheater.project.id } },
71
+ project: { id: { $eq: screeningRoom.project.id } },
72
72
  codeValue: { $eq: additionalPropertyNameOnResource },
73
- inCodeSet: { identifier: { $eq: movieTheater.typeOf } }
73
+ inCodeSet: { identifier: { $eq: screeningRoom.typeOf } }
74
74
  });
75
75
  if (existingAdditionalProperties.length === 0) {
76
76
  const additionalProperty: chevre.factory.additionalProperty.IAdditionalProperty = {
77
- project: movieTheater.project,
77
+ project: screeningRoom.project,
78
78
  // id?: string;
79
79
  typeOf: 'CategoryCode',
80
80
  codeValue: additionalPropertyNameOnResource,
81
81
  inCodeSet: {
82
82
  typeOf: 'CategoryCodeSet',
83
- identifier: movieTheater.typeOf
83
+ identifier: screeningRoom.typeOf
84
84
  },
85
85
  name: { ja: additionalPropertyNameOnResource }
86
86
  };
@@ -89,15 +89,15 @@ async function main() {
89
89
  console.log(
90
90
  'additionalProerty created',
91
91
  additionalPropertyNameOnResource,
92
- movieTheater.project.id,
93
- movieTheater.branchCode
92
+ screeningRoom.project.id,
93
+ screeningRoom.branchCode
94
94
  );
95
95
  } else {
96
96
  console.log(
97
97
  'additionalProerty existed',
98
98
  additionalPropertyNameOnResource,
99
- movieTheater.project.id,
100
- movieTheater.branchCode
99
+ screeningRoom.project.id,
100
+ screeningRoom.branchCode
101
101
  );
102
102
  }
103
103
  }
@@ -0,0 +1,119 @@
1
+ // tslint:disable:no-console
2
+ // import * as moment from 'moment';
3
+ import * as mongoose from 'mongoose';
4
+
5
+ import { chevre } from '../../../lib/index';
6
+
7
+ // const project = { id: String(process.env.PROJECT_ID) };
8
+ // const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
9
+
10
+ // tslint:disable-next-line:max-func-body-length
11
+ async function main() {
12
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
13
+
14
+ const additionalPropertyRepo = await chevre.repository.AdditionalProperty.createInstance(mongoose.connection);
15
+ const placeRepo = await chevre.repository.place.MovieTheater.createInstance(mongoose.connection);
16
+
17
+ const cursor = placeRepo.getCursor(
18
+ {
19
+ typeOf: { $eq: chevre.factory.placeType.ScreeningRoom }
20
+ // 'project.id': { $eq: project.id },
21
+ // 'project.id': { $ne: EXCLUDED_PROJECT_ID },
22
+ },
23
+ {
24
+ // paymentMethods: 1,
25
+ // project: 1,
26
+ // orderDate: 1
27
+ }
28
+ );
29
+ console.log('places found');
30
+
31
+ const additionalPropertyNames: string[] = [];
32
+ const projectIds: string[] = [];
33
+ const unexpextedprojectIds: string[] = [];
34
+ let checked: number = 0;
35
+ let created: number = 0;
36
+
37
+ let i = 0;
38
+ await cursor.eachAsync(async (doc) => {
39
+ i += 1;
40
+ const screeningRoom: chevre.factory.place.screeningRoom.IPlace = doc.toObject();
41
+ const sections: Pick<chevre.factory.place.screeningRoomSection.IPlace, 'additionalProperty' | 'branchCode' | 'typeOf'>[] =
42
+ screeningRoom.containsPlace;
43
+ for (const section of sections) {
44
+ const additionalPropertyNamesOnResource = (Array.isArray(section.additionalProperty))
45
+ ? section.additionalProperty?.map((p) => p.name)
46
+ : [];
47
+ if (Array.isArray(additionalPropertyNamesOnResource) && additionalPropertyNamesOnResource.length > 0) {
48
+ console.log(
49
+ additionalPropertyNamesOnResource.join(','),
50
+ additionalPropertyNamesOnResource.length,
51
+ 'additionalPropertyNamesOnResource found',
52
+ screeningRoom.project.id,
53
+ section.branchCode
54
+ );
55
+ additionalPropertyNames.push(...additionalPropertyNamesOnResource);
56
+ projectIds.push(screeningRoom.project.id);
57
+ additionalPropertyNamesOnResource.forEach((name) => {
58
+ if (!name.match(/^[a-zA-Z]*$/)) {
59
+ // throw new Error(`not matched ${creativeWork.project.id} ${creativeWork.id}`);
60
+ unexpextedprojectIds.push(screeningRoom.project.id);
61
+ }
62
+ // tslint:disable-next-line:no-magic-numbers
63
+ if (name.length < 5) {
64
+ // throw new Error(`length matched ${creativeWork.project.id} ${creativeWork.id} ${name}`);
65
+ unexpextedprojectIds.push(screeningRoom.project.id);
66
+ }
67
+ });
68
+
69
+ for (const additionalPropertyNameOnResource of additionalPropertyNamesOnResource) {
70
+ checked += 1;
71
+ const existingAdditionalProperties = await additionalPropertyRepo.search({
72
+ limit: 1,
73
+ project: { id: { $eq: screeningRoom.project.id } },
74
+ codeValue: { $eq: additionalPropertyNameOnResource },
75
+ inCodeSet: { identifier: { $eq: section.typeOf } }
76
+ });
77
+ if (existingAdditionalProperties.length === 0) {
78
+ const additionalProperty: chevre.factory.additionalProperty.IAdditionalProperty = {
79
+ project: screeningRoom.project,
80
+ // id?: string;
81
+ typeOf: 'CategoryCode',
82
+ codeValue: additionalPropertyNameOnResource,
83
+ inCodeSet: {
84
+ typeOf: 'CategoryCodeSet',
85
+ identifier: section.typeOf
86
+ },
87
+ name: { ja: additionalPropertyNameOnResource }
88
+ };
89
+ await additionalPropertyRepo.save({ attributes: additionalProperty });
90
+ created += 1;
91
+ console.log(
92
+ 'additionalProerty created',
93
+ additionalPropertyNameOnResource,
94
+ screeningRoom.project.id,
95
+ section.branchCode
96
+ );
97
+ } else {
98
+ console.log(
99
+ 'additionalProerty existed',
100
+ additionalPropertyNameOnResource,
101
+ screeningRoom.project.id,
102
+ section.branchCode
103
+ );
104
+ }
105
+ }
106
+ }
107
+ }
108
+ });
109
+ console.log(i, 'places checked');
110
+ console.log('additionalPropertyNames:', [...new Set(additionalPropertyNames)]);
111
+ console.log('projectIds:', [...new Set(projectIds)]);
112
+ console.log('unexpextedprojectIds:', [...new Set(unexpextedprojectIds)]);
113
+ console.log('checked:', checked);
114
+ console.log('created:', created);
115
+ }
116
+
117
+ main()
118
+ .then()
119
+ .catch(console.error);
@@ -14,7 +14,7 @@ async function main() {
14
14
  await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
15
15
 
16
16
  const ticketRepo = await chevre.repository.Ticket.createInstance(mongoose.connection);
17
- const tickets = await ticketRepo.search(
17
+ const tickets = await ticketRepo.projectFields(
18
18
  {
19
19
  limit: 1,
20
20
  page: 1,
@@ -23,7 +23,8 @@ async function main() {
23
23
  id: { $eq: project.id }
24
24
  },
25
25
  ticketToken: { $eq: TICKET_TOKEN }
26
- }
26
+ },
27
+ []
27
28
  );
28
29
  console.log('tickets:', tickets);
29
30
  console.log(tickets.length, 'tickets found');
@@ -23,6 +23,7 @@ async function main() {
23
23
  targetCollection: { typeOf: chevre.factory.offerType.Offer }
24
24
  }
25
25
  });
26
+ console.log('actions started,', action);
26
27
  // const error = new Error('sample error');
27
28
  // await actionRepo.giveUp({
28
29
  // typeOf: action.typeOf,
@@ -30,11 +31,12 @@ async function main() {
30
31
  // // error: { ...error, message: error.message, name: error.name }
31
32
  // error
32
33
  // });
33
- await actionRepo.completeWithVoid({
34
+ const result = await actionRepo.completeWithVoid({
34
35
  typeOf: action.typeOf,
35
36
  id: action.id,
36
37
  result: {}
37
38
  });
39
+ console.log('actions completed', result);
38
40
  }
39
41
 
40
42
  main()
@@ -0,0 +1,42 @@
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
+ 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
+
17
+ const docs = await actionRepo.search(
18
+ {
19
+ limit: 1,
20
+ page: 1,
21
+ typeOf: { $eq: chevre.factory.actionType.AuthorizeAction }
22
+ },
23
+ ['id', 'typeOf', 'actionStatus'],
24
+ ['result', 'cancelAction', 'instrument', 'object']
25
+ );
26
+ // tslint:disable-next-line:no-null-keyword
27
+ console.dir(docs, { depth: null });
28
+ console.log(docs.length, 'docs found');
29
+
30
+ const actions = await actionRepo.searchByOrderNumber(
31
+ {
32
+ orderNumber: 'CIN9-4893721-9248784'
33
+ }
34
+ );
35
+ // tslint:disable-next-line:no-null-keyword
36
+ console.dir(actions, { depth: null });
37
+ console.log(actions.length, 'actions found');
38
+ }
39
+
40
+ main()
41
+ .then()
42
+ .catch(console.error);
@@ -11,23 +11,18 @@ console.log(`importing chevre took ${diff[0]} seconds and ${diff[1]} nanoseconds
11
11
  async function main() {
12
12
  await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
13
13
 
14
- const eventRepo: chevre.repository.Event = await chevre.repository.Event.createInstance(mongoose.connection);
14
+ const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
15
15
 
16
- const event = await eventRepo.projectFieldsById(
16
+ const doc = await actionRepo.findById(
17
17
  {
18
- // id: '120162210202407171202250'
19
- id: 'blxonxv1m'
18
+ id: '66cc6030fe3d4df76011aa75',
19
+ typeOf: chevre.factory.actionType.DeleteAction
20
20
  },
21
- // [
22
- // 'project', 'organizer', 'typeOf',
23
- // 'name', 'doorTime', 'endDate', 'eventStatus',
24
- // 'location', 'startDate', 'superEvent',
25
- // 'offers'
26
- // ]
27
- ['project', 'startDate', 'typeOf', 'superEvent.location.id']
21
+ ['id', 'actionStatus'],
22
+ []
28
23
  );
29
24
  // tslint:disable-next-line:no-null-keyword
30
- console.dir(event, { depth: null });
25
+ console.dir(doc, { depth: null });
31
26
  }
32
27
 
33
28
  main()
@@ -0,0 +1,38 @@
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
+ 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
+
17
+ const docs = await actionRepo.searchByPurpose(
18
+ {
19
+ purpose: { id: '66ce6fe0f254c2172e578c9a', typeOf: chevre.factory.transactionType.PlaceOrder },
20
+ // typeOf: chevre.factory.actionType.AuthorizeAction,
21
+ object: {
22
+ // typeOf: { $eq: 'AggregateOffer' }
23
+ // paymentMethodId: { $eq: '137280454658483' }
24
+ },
25
+ actionStatus: { $eq: chevre.factory.actionStatusType.CompletedActionStatus },
26
+ sort: { startDate: chevre.factory.sortType.Descending }
27
+ }
28
+ );
29
+ // tslint:disable-next-line:no-null-keyword
30
+ console.dir(docs, { depth: null });
31
+ // tslint:disable-next-line:no-null-keyword
32
+ console.dir(docs.map(({ typeOf, startDate }) => ({ typeOf, startDate })), { depth: null });
33
+ console.log(docs.length, 'docs found');
34
+ }
35
+
36
+ main()
37
+ .then()
38
+ .catch(console.error);
@@ -3,29 +3,34 @@ import * as mongoose from 'mongoose';
3
3
 
4
4
  import { chevre } from '../../../lib/index';
5
5
 
6
+ const PROJECT_ID = String(process.env.PROJECT_ID);
7
+
6
8
  async function main() {
7
9
  await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
8
10
 
9
11
  const projectRepo = await chevre.repository.Project.createInstance(mongoose.connection);
10
12
 
11
13
  const project = await projectRepo.findById({
12
- id: 'xxx',
14
+ id: PROJECT_ID,
13
15
  inclusion: [],
14
- exclusion: ['settings']
16
+ exclusion: ['settings', 'hasMerchantReturnPolicy']
15
17
  });
16
18
  console.log('project:', project);
17
19
 
18
- const projects = await projectRepo.search(
20
+ const projects = await projectRepo.projectFields(
19
21
  {
20
22
  limit: 1,
21
23
  page: 1,
22
24
  id: { $eq: project.id }
23
25
  },
24
- ['_id', 'name'],
26
+ ['typeOf'],
25
27
  []
26
28
  );
27
29
  console.log(projects);
28
30
  console.log(projects.length, 'projects found');
31
+
32
+ const findAlternateNameByIdReulst = await projectRepo.findAlternateNameById({ id: project.id });
33
+ console.log('findAlternateNameByIdReulst:', findAlternateNameByIdReulst);
29
34
  }
30
35
 
31
36
  main()
@@ -15,7 +15,7 @@ async function main() {
15
15
  limit: 5,
16
16
  page: 1,
17
17
  sort: { branchCode: chevre.factory.sortType.Descending },
18
- id: { $eq: 'xxx' }
18
+ id: { $eq: '59d20831e53ebc2b4e774466' }
19
19
  // project: { id: { $eq: project.id } }
20
20
  // paymentAccepted: { paymentMethodType: { $eq: 'Cash' } },
21
21
  // hasMerchantReturnPolicy: { applicablePaymentMethod: {} }
@@ -26,12 +26,12 @@ async function main() {
26
26
  console.log('sellers found', sellersByAggregate, sellersByAggregate[0]?.hasMerchantReturnPolicy);
27
27
  console.log(sellersByAggregate.length, 'sellers found');
28
28
 
29
- const sellers = await sellerRepo.search(
29
+ const sellers = await sellerRepo.projectFields(
30
30
  {
31
31
  limit: 5,
32
32
  page: 1,
33
33
  sort: { branchCode: chevre.factory.sortType.Descending },
34
- id: { $eq: 'xxx' }
34
+ id: { $eq: '59d20831e53ebc2b4e774466' }
35
35
  // project: { id: { $eq: project.id } }
36
36
  // paymentAccepted: { paymentMethodType: { $eq: 'Cash' } },
37
37
  // hasMerchantReturnPolicy: { applicablePaymentMethod: {} }
@@ -14,7 +14,7 @@ async function main() {
14
14
 
15
15
  const transactionRepo = await chevre.repository.Transaction.createInstance(mongoose.connection);
16
16
 
17
- const transactions = await transactionRepo.search<chevre.factory.transactionType.PlaceOrder, 'status' | 'startDate'>({
17
+ const transactions = await transactionRepo.projectFields<chevre.factory.transactionType.PlaceOrder, 'status' | 'startDate'>({
18
18
  limit: 1,
19
19
  page: 1,
20
20
  project: { id: { $eq: project.id } },
@@ -6,49 +6,10 @@ import { chevre } from '../../../lib/index';
6
6
  async function main() {
7
7
  await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
8
8
 
9
- const accountingReportRepo = await chevre.repository.AccountingReport.createInstance(mongoose.connection);
10
- const aggregateReservationRepo = await chevre.repository.AggregateReservation.createInstance(mongoose.connection);
11
- const reservationRepo = await chevre.repository.Reservation.createInstance(mongoose.connection);
12
- const projectRepo = await chevre.repository.Project.createInstance(mongoose.connection);
9
+ const categoryCodeRepo = await chevre.repository.CategoryCode.createInstance(mongoose.connection);
13
10
 
14
11
  let updateResult: any;
15
- updateResult = await accountingReportRepo.unsetUnnecessaryFields({
16
- filter: {
17
- _id: { $exists: true }
18
- },
19
- $unset: {
20
- createdAt: 1,
21
- updatedAt: 1,
22
- __v: 1
23
- }
24
- });
25
- console.log(updateResult);
26
-
27
- updateResult = await aggregateReservationRepo.unsetUnnecessaryFields({
28
- filter: {
29
- _id: { $exists: true }
30
- },
31
- $unset: {
32
- createdAt: 1,
33
- updatedAt: 1,
34
- __v: 1
35
- }
36
- });
37
- console.log(updateResult);
38
-
39
- updateResult = await projectRepo.unsetUnnecessaryFields({
40
- filter: {
41
- _id: { $exists: true }
42
- },
43
- $unset: {
44
- createdAt: 1,
45
- updatedAt: 1,
46
- __v: 1
47
- }
48
- });
49
- console.log(updateResult);
50
-
51
- updateResult = await reservationRepo.unsetUnnecessaryFields({
12
+ updateResult = await categoryCodeRepo.unsetUnnecessaryFields({
52
13
  filter: {
53
14
  _id: { $exists: true }
54
15
  },
@@ -22,17 +22,23 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
- import type { Connection, Model } from 'mongoose';
25
+ import type { Connection } from 'mongoose';
26
+ import * as factory from '../factory';
27
+ import { IModel } from './mongoose/schemas/accountTitle';
26
28
  /**
27
29
  * 科目リポジトリ
28
30
  */
29
31
  export declare class AccountTitleRepo {
30
- readonly accountTitleModel: typeof Model;
32
+ readonly accountTitleModel: IModel;
31
33
  constructor(connection: Connection);
32
34
  deleteByProject(params: {
33
35
  project: {
34
36
  id: string;
35
37
  };
36
38
  }): Promise<void>;
37
- getCursor(conditions: any, projection: any): import("mongoose").Cursor<any, import("mongoose").QueryOptions<any>>;
39
+ getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, {}, factory.accountTitle.IAccountTitle> & Omit<factory.accountTitle.IAccountTitle & {
40
+ _id: import("mongoose").Types.ObjectId;
41
+ }, never>, import("mongoose").QueryOptions<import("mongoose").Document<unknown, {}, factory.accountTitle.IAccountTitle> & Omit<factory.accountTitle.IAccountTitle & {
42
+ _id: import("mongoose").Types.ObjectId;
43
+ }, never>>>;
38
44
  }
@@ -1,20 +1,8 @@
1
1
  import type { Connection, PipelineStage } from 'mongoose';
2
+ import { IAccountingReport, IChildReport, IOrder4report } from './mongoose/schemas/accountingReport';
2
3
  import * as factory from '../factory';
3
4
  type IMatchStage = PipelineStage.Match;
4
- export type IOrder4report = factory.report.accountingReport.IOrderAsMainEntity;
5
- export interface IChildReport {
6
- typeOf: 'Report';
7
- mainEntity: factory.report.accountingReport.IAction;
8
- }
9
- export interface IAccountingReport {
10
- project: {
11
- id: string;
12
- typeOf: factory.organizationType.Project;
13
- };
14
- typeOf: 'Report';
15
- hasPart: IChildReport[];
16
- mainEntity: IOrder4report;
17
- }
5
+ export { IAccountingReport, IChildReport, IOrder4report };
18
6
  /**
19
7
  * 経理レポートリポジトリ
20
8
  */
@@ -58,4 +46,3 @@ export declare class AccountingReportRepo {
58
46
  $unset: any;
59
47
  }): Promise<import("mongodb").UpdateResult>;
60
48
  }
61
- export {};