@chevre/domain 22.6.0-alpha.8 → 22.6.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 (213) hide show
  1. package/example/src/chevre/aggregateAllEvents2.ts +0 -19
  2. package/example/src/chevre/createEventBySchedule.ts +53 -0
  3. package/example/src/chevre/findSchedule.ts +23 -19
  4. package/example/src/chevre/findSetting.ts +75 -0
  5. package/example/src/chevre/projectEventFieldsById.ts +23 -0
  6. package/example/src/chevre/reIndex.ts +20 -0
  7. package/example/src/chevre/retryTasks.ts +6 -4
  8. package/example/src/chevre/searchAuthorizations.ts +35 -0
  9. package/example/src/chevre/unsetUnnecessaryFields.ts +34 -16
  10. package/lib/chevre/credentials.js +0 -13
  11. package/lib/chevre/emailMessageBuilder.d.ts +5 -5
  12. package/lib/chevre/emailMessageBuilder.js +20 -8
  13. package/lib/chevre/repo/action.d.ts +11 -5
  14. package/lib/chevre/repo/authorization.js +5 -1
  15. package/lib/chevre/repo/credentials.d.ts +19 -0
  16. package/lib/chevre/repo/credentials.js +70 -0
  17. package/lib/chevre/repo/event.d.ts +0 -5
  18. package/lib/chevre/repo/event.js +0 -26
  19. package/lib/chevre/repo/interface.d.ts +25 -0
  20. package/lib/chevre/repo/interface.js +62 -0
  21. package/lib/chevre/repo/mongoose/schemas/aggregateOffer.js +5 -21
  22. package/lib/chevre/repo/mongoose/schemas/authorization.js +9 -0
  23. package/lib/chevre/repo/mongoose/schemas/categoryCode.js +36 -11
  24. package/lib/chevre/repo/mongoose/schemas/civicStructure.js +9 -1
  25. package/lib/chevre/repo/mongoose/schemas/creativeWork.js +9 -1
  26. package/lib/chevre/repo/mongoose/schemas/interface.d.ts +11 -0
  27. package/lib/chevre/repo/mongoose/schemas/interface.js +55 -0
  28. package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +1 -1
  29. package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +29 -25
  30. package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.d.ts +1 -1
  31. package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.js +21 -15
  32. package/lib/chevre/repo/mongoose/schemas/place.js +1 -1
  33. package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +1 -1
  34. package/lib/chevre/repo/mongoose/schemas/reservation.js +25 -19
  35. package/lib/chevre/repo/mongoose/schemas/schedule.d.ts +1 -1
  36. package/lib/chevre/repo/mongoose/schemas/setting.d.ts +41 -0
  37. package/lib/chevre/repo/mongoose/schemas/setting.js +61 -0
  38. package/lib/chevre/repo/offerCatalog.d.ts +5 -1
  39. package/lib/chevre/repo/offerCatalog.js +6 -0
  40. package/lib/chevre/repo/offerCatalogItem.d.ts +5 -1
  41. package/lib/chevre/repo/offerCatalogItem.js +6 -0
  42. package/lib/chevre/repo/place/movieTheater.d.ts +0 -6
  43. package/lib/chevre/repo/place/movieTheater.js +0 -14
  44. package/lib/chevre/repo/reservation.d.ts +2 -1
  45. package/lib/chevre/repo/reservation.js +13 -3
  46. package/lib/chevre/repo/schedule.d.ts +13 -2
  47. package/lib/chevre/repo/schedule.js +24 -4
  48. package/lib/chevre/repo/setting.d.ts +50 -0
  49. package/lib/chevre/repo/setting.js +60 -0
  50. package/lib/chevre/repository.d.ts +15 -0
  51. package/lib/chevre/repository.js +41 -2
  52. package/lib/chevre/service/aggregation/event/aggregateOffers.js +44 -29
  53. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +10 -4
  54. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +17 -9
  55. package/lib/chevre/service/assetTransaction/pay.d.ts +6 -1
  56. package/lib/chevre/service/assetTransaction/pay.js +9 -4
  57. package/lib/chevre/service/assetTransaction/reserve/cancel.d.ts +2 -0
  58. package/lib/chevre/service/assetTransaction/reserve/cancel.js +4 -2
  59. package/lib/chevre/service/assetTransaction/reserve/confirm.d.ts +2 -0
  60. package/lib/chevre/service/assetTransaction/reserve/confirm.js +11 -11
  61. package/lib/chevre/service/assetTransaction/reserve/exportTasksById.js +31 -39
  62. package/lib/chevre/service/assetTransaction/reserve/start/factory/createReservation.d.ts +7 -3
  63. package/lib/chevre/service/assetTransaction/reserve/start/factory/createReservation.js +3 -1
  64. package/lib/chevre/service/assetTransaction/reserve/start.d.ts +2 -0
  65. package/lib/chevre/service/assetTransaction/reserve/start.js +6 -4
  66. package/lib/chevre/service/event.d.ts +4 -4
  67. package/lib/chevre/service/event.js +8 -10
  68. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +2 -0
  69. package/lib/chevre/service/offer/event/authorize.d.ts +2 -0
  70. package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.d.ts +2 -0
  71. package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -0
  72. package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +2 -0
  73. package/lib/chevre/service/offer/onEventChanged.d.ts +3 -2
  74. package/lib/chevre/service/offer/onEventChanged.js +22 -11
  75. package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +3 -0
  76. package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +1 -1
  77. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.d.ts +2 -2
  78. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.js +5 -2
  79. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.d.ts +3 -2
  80. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +6 -2
  81. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +2 -2
  82. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.js +5 -2
  83. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.d.ts +3 -2
  84. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.js +6 -2
  85. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.d.ts +2 -2
  86. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +5 -2
  87. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +2 -0
  88. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +2 -1
  89. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +2 -2
  90. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +5 -2
  91. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.d.ts +3 -2
  92. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +6 -2
  93. package/lib/chevre/service/order/onOrderUpdated/factory.d.ts +2 -2
  94. package/lib/chevre/service/order/onOrderUpdated/factory.js +5 -2
  95. package/lib/chevre/service/order/onOrderUpdated.d.ts +3 -2
  96. package/lib/chevre/service/order/onOrderUpdated.js +8 -2
  97. package/lib/chevre/service/order/payOrder.d.ts +2 -0
  98. package/lib/chevre/service/order/placeOrder.d.ts +2 -0
  99. package/lib/chevre/service/order/returnOrder.d.ts +3 -2
  100. package/lib/chevre/service/order/returnOrder.js +7 -5
  101. package/lib/chevre/service/order/sendOrder.d.ts +2 -0
  102. package/lib/chevre/service/order/sendOrder.js +5 -3
  103. package/lib/chevre/service/payment/any/onRefund.js +30 -17
  104. package/lib/chevre/service/payment/any/person2username.d.ts +2 -2
  105. package/lib/chevre/service/payment/any/person2username.js +10 -2
  106. package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.d.ts +2 -1
  107. package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.js +26 -17
  108. package/lib/chevre/service/payment/any.d.ts +5 -1
  109. package/lib/chevre/service/payment/any.js +31 -12
  110. package/lib/chevre/service/payment/movieTicket/authorize.d.ts +6 -1
  111. package/lib/chevre/service/payment/movieTicket/authorize.js +4 -2
  112. package/lib/chevre/service/payment/movieTicket/checkMovieTicket.d.ts +2 -0
  113. package/lib/chevre/service/payment/movieTicket/checkMovieTicket.js +9 -12
  114. package/lib/chevre/service/payment/movieTicket/factory.js +12 -16
  115. package/lib/chevre/service/payment/movieTicket/payMovieTicket.d.ts +2 -0
  116. package/lib/chevre/service/payment/movieTicket/payMovieTicket.js +2 -1
  117. package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.d.ts +2 -0
  118. package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.js +2 -1
  119. package/lib/chevre/service/payment/movieTicket/refundMovieTicket.d.ts +2 -0
  120. package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +2 -1
  121. package/lib/chevre/service/payment/movieTicket/validation.d.ts +5 -1
  122. package/lib/chevre/service/payment/movieTicket/validation.js +47 -40
  123. package/lib/chevre/service/payment/movieTicket/voidTransaction.d.ts +2 -0
  124. package/lib/chevre/service/payment.d.ts +13 -4
  125. package/lib/chevre/service/payment.js +15 -11
  126. package/lib/chevre/service/reserve/cancelReservation.d.ts +5 -3
  127. package/lib/chevre/service/reserve/cancelReservation.js +8 -4
  128. package/lib/chevre/service/reserve/checkInReservation.d.ts +3 -2
  129. package/lib/chevre/service/reserve/checkInReservation.js +18 -21
  130. package/lib/chevre/service/reserve/confirmReservation.d.ts +3 -2
  131. package/lib/chevre/service/reserve/confirmReservation.js +4 -2
  132. package/lib/chevre/service/reserve/potentialActions/onPendingReservationCanceled.d.ts +3 -2
  133. package/lib/chevre/service/reserve/potentialActions/onPendingReservationCanceled.js +8 -2
  134. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +3 -2
  135. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +8 -2
  136. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.d.ts +6 -3
  137. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +10 -9
  138. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +3 -2
  139. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +8 -2
  140. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.d.ts +7 -3
  141. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +28 -13
  142. package/lib/chevre/service/reserve/potentialActions/onReservationsCreated.d.ts +3 -2
  143. package/lib/chevre/service/reserve/potentialActions/onReservationsCreated.js +8 -2
  144. package/lib/chevre/service/reserve/useReservation.d.ts +3 -2
  145. package/lib/chevre/service/reserve/useReservation.js +11 -7
  146. package/lib/chevre/service/task/acceptCOAOffer.d.ts +1 -1
  147. package/lib/chevre/service/task/acceptCOAOffer.js +27 -4
  148. package/lib/chevre/service/task/authorizePayment.js +9 -0
  149. package/lib/chevre/service/task/cancelPendingReservation.js +12 -14
  150. package/lib/chevre/service/task/cancelReservation.js +12 -14
  151. package/lib/chevre/service/task/checkMovieTicket.js +12 -3
  152. package/lib/chevre/service/task/confirmReserveTransaction.d.ts +3 -1
  153. package/lib/chevre/service/task/confirmReserveTransaction.js +22 -6
  154. package/lib/chevre/service/task/createEvent/createEvent.d.ts +25 -0
  155. package/lib/chevre/service/task/createEvent/createEvent.js +46 -0
  156. package/lib/chevre/service/task/createEvent/createEventBySchedule.d.ts +25 -0
  157. package/lib/chevre/service/task/createEvent/createEventBySchedule.js +371 -0
  158. package/lib/chevre/service/task/createEvent/createEventSeries.d.ts +13 -0
  159. package/lib/chevre/service/{event/createEvent.js → task/createEvent/createEventSeries.js} +4 -4
  160. package/lib/chevre/service/task/createEvent.js +17 -3
  161. package/lib/chevre/service/task/deletePerson.js +28 -10
  162. package/lib/chevre/service/task/importEventCapacitiesFromCOA.d.ts +2 -2
  163. package/lib/chevre/service/task/importEventCapacitiesFromCOA.js +14 -5
  164. package/lib/chevre/service/task/importEventsFromCOA.d.ts +2 -2
  165. package/lib/chevre/service/task/importEventsFromCOA.js +14 -5
  166. package/lib/chevre/service/task/importOffersFromCOA.d.ts +2 -2
  167. package/lib/chevre/service/task/importOffersFromCOA.js +15 -6
  168. package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +2 -0
  169. package/lib/chevre/service/task/onAuthorizationCreated.js +13 -12
  170. package/lib/chevre/service/task/onEventChanged.js +6 -2
  171. package/lib/chevre/service/task/onOrderPaymentCompleted.js +2 -0
  172. package/lib/chevre/service/task/onResourceUpdated/onAggregateOfferUpdated.d.ts +3 -3
  173. package/lib/chevre/service/task/onResourceUpdated/onAggregateOfferUpdated.js +7 -3
  174. package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.d.ts +3 -2
  175. package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.js +8 -3
  176. package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.d.ts +4 -3
  177. package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.js +7 -3
  178. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +3 -2
  179. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +7 -3
  180. package/lib/chevre/service/task/onResourceUpdated.js +61 -33
  181. package/lib/chevre/service/task/pay.js +27 -2
  182. package/lib/chevre/service/task/placeOrder.js +2 -0
  183. package/lib/chevre/service/task/refund.js +10 -0
  184. package/lib/chevre/service/task/reserve.js +6 -2
  185. package/lib/chevre/service/task/returnOrder.js +6 -2
  186. package/lib/chevre/service/task/returnReserveTransaction.d.ts +1 -1
  187. package/lib/chevre/service/task/returnReserveTransaction.js +21 -7
  188. package/lib/chevre/service/task/sendOrder.js +2 -0
  189. package/lib/chevre/service/task/useReservation.js +6 -2
  190. package/lib/chevre/service/task/voidPayment.js +14 -1
  191. package/lib/chevre/service/task/voidReserveTransaction.d.ts +1 -1
  192. package/lib/chevre/service/task/voidReserveTransaction.js +21 -6
  193. package/lib/chevre/service/task.d.ts +0 -5
  194. package/lib/chevre/service/task.js +6 -0
  195. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.d.ts +2 -2
  196. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.js +5 -2
  197. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.d.ts +2 -2
  198. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.js +5 -2
  199. package/lib/chevre/service/transaction/placeOrder/confirm.d.ts +3 -2
  200. package/lib/chevre/service/transaction/placeOrder/confirm.js +11 -2
  201. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.d.ts +2 -2
  202. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +14 -7
  203. package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.d.ts +2 -2
  204. package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +4 -2
  205. package/lib/chevre/service/transaction/returnOrder/potentialActions.d.ts +2 -2
  206. package/lib/chevre/service/transaction/returnOrder/potentialActions.js +6 -3
  207. package/lib/chevre/service/transaction/returnOrder.d.ts +3 -1
  208. package/lib/chevre/service/transaction/returnOrder.js +10 -2
  209. package/lib/chevre/settings.d.ts +20 -66
  210. package/lib/chevre/settings.js +21 -10
  211. package/package.json +5 -5
  212. package/example/src/chevre/searchAssetTransactions.ts +0 -38
  213. package/lib/chevre/service/event/createEvent.d.ts +0 -13
@@ -44,30 +44,12 @@ export async function aggregateScreeningEvent() {
44
44
  sendGrid: await chevre.credentials.SendGrid.createInstance({ apiKey: 'xxx' })
45
45
  },
46
46
  settings: new chevre.settings.Settings({
47
- onEventChanged: {
48
- informEvent: []
49
- },
50
- onOrderStatusChanged: {
51
- informOrder: []
52
- },
53
- onResourceUpdated: {
54
- informResource: []
55
- },
56
- onReservationStatusChanged: {
57
- informReservation: []
58
- },
59
47
  notification: {
60
48
  timeout: 1000,
61
49
  useFetchAPI: true,
62
50
  secretKey: 'xx',
63
51
  headerIdentifier: 'xx'
64
52
  },
65
- userPoolIdOld: '',
66
- userPoolIdNew: '',
67
- // useAggregateEntranceGateProjects: [],
68
- // useAggregateOfferProjects: [],
69
- // useOfferRateLimitProjects: [],
70
- defaultSenderEmail: 'test@example.com',
71
53
  deliverOrderLimit: 1,
72
54
  transaction: { informUrls: [], confirmedStoragePeriodInDays: 365, canceledStoragePeriodInDays: 365 },
73
55
  abortedTasksWithoutReport: [],
@@ -75,7 +57,6 @@ export async function aggregateScreeningEvent() {
75
57
  gmo: { timeout: 1000, timeoutBackground: 1000, useFetch: true },
76
58
  movieticketReserve: { timeout: 1000, timeoutCheck: 1000, minIntervalBetweenPayAndRefund: 0 },
77
59
  numTryConfirmReserveTransaction: 10,
78
- useAssetTransactionSyncProcessing: true,
79
60
  useExperimentalFeature: false
80
61
  })
81
62
  });
@@ -0,0 +1,53 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+ import { call } from '../../../lib/chevre/service/task/createEvent';
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
+ await call({
12
+ agent: { id: 'sample', typeOf: chevre.factory.creativeWorkType.WebApplication },
13
+ project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
14
+ object: {
15
+ typeOf: chevre.factory.eventType.ScreeningEvent,
16
+ eventSchedule: { id: '672bf38b5d6d3f5642d658fc' }
17
+ },
18
+ // targetCollection: {},
19
+ typeOf: chevre.factory.actionType.CreateAction
20
+ })(
21
+ {
22
+ connection: mongoose.connection,
23
+ credentials: {
24
+ sendGrid: await chevre.credentials.SendGrid.createInstance({ apiKey: 'xxx' })
25
+ },
26
+ settings: new chevre.settings.Settings({
27
+ notification: {
28
+ timeout: 1000,
29
+ useFetchAPI: true,
30
+ secretKey: 'xx',
31
+ headerIdentifier: 'xx'
32
+ },
33
+ deliverOrderLimit: 1,
34
+ transaction: { informUrls: [], confirmedStoragePeriodInDays: 365, canceledStoragePeriodInDays: 365 },
35
+ abortedTasksWithoutReport: [],
36
+ coa: { timeout: 1000 },
37
+ gmo: { timeout: 1000, timeoutBackground: 1000, useFetch: true },
38
+ movieticketReserve: { timeout: 1000, timeoutCheck: 1000, minIntervalBetweenPayAndRefund: 0 },
39
+ numTryConfirmReserveTransaction: 10,
40
+ useExperimentalFeature: false
41
+ })
42
+ },
43
+ {
44
+ executeById: true,
45
+ executeByName: false
46
+ }
47
+ );
48
+ console.log('success!');
49
+ }
50
+
51
+ main()
52
+ .then(console.log)
53
+ .catch(console.error);
@@ -8,29 +8,33 @@ async function main() {
8
8
 
9
9
  const scheduleRepo = await chevre.repository.Schedule.createInstance(mongoose.connection);
10
10
 
11
- const result = await scheduleRepo.findOne();
11
+ const findOneIdResult = await scheduleRepo.findOneId();
12
+ // tslint:disable-next-line:no-null-keyword
13
+ console.dir(findOneIdResult, { depth: null });
14
+
15
+ const result = await scheduleRepo.findOne({ id: { $eq: '672bf38b5d6d3f5642d658fc' } });
12
16
  // tslint:disable-next-line:no-null-keyword
13
17
  console.dir(result, { depth: null });
14
18
 
15
19
  if (result === null) {
16
- await scheduleRepo.saveOne({
17
- project: { id: 'ttts-test', typeOf: chevre.factory.organizationType.Project },
18
- film: '001',
19
- theater: '001',
20
- eventServiceProductID: 'EventService8k7nv3w4b',
21
- duration: 15,
22
- noPerformanceTimes: [
23
- '2215',
24
- '2230',
25
- '2245'
26
- ],
27
- hours: ['9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22'],
28
- minutes: ['00', '15', '30', '45'],
29
- tours: ['1', '2', '3', '4'],
30
- start: 91,
31
- days: 1
32
- });
33
- console.log('saved');
20
+ // await scheduleRepo.saveOne({
21
+ // project: { id: 'ttts-test', typeOf: chevre.factory.organizationType.Project },
22
+ // film: '001',
23
+ // theater: '001',
24
+ // eventServiceProductID: 'EventService8k7nv3w4b',
25
+ // duration: 15,
26
+ // noPerformanceTimes: [
27
+ // '2215',
28
+ // '2230',
29
+ // '2245'
30
+ // ],
31
+ // hours: ['9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22'],
32
+ // minutes: ['00', '15', '30', '45'],
33
+ // tours: ['1', '2', '3', '4'],
34
+ // start: 91,
35
+ // days: 1
36
+ // });
37
+ // console.log('saved');
34
38
  }
35
39
  }
36
40
 
@@ -0,0 +1,75 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+
4
+ import { chevre } from '../../../lib/index';
5
+
6
+ const informOrderUrls = (typeof process.env.INFORM_ORDER_URL === 'string')
7
+ ? process.env.INFORM_ORDER_URL.split(' ')
8
+ : [];
9
+ // const informReservationUrls = (typeof process.env.INFORM_RESERVATION_URL === 'string')
10
+ // ? process.env.INFORM_RESERVATION_URL.split(' ')
11
+ // : [];
12
+ // const informResourceUrls = (typeof process.env.INFORM_RESOURCE_URL === 'string')
13
+ // ? process.env.INFORM_RESOURCE_URL.split(',')
14
+ // : [];
15
+ // const informEvent2aggUrls = (typeof process.env.INFORM_EVENT_AGG_URL === 'string')
16
+ // ? process.env.INFORM_EVENT_AGG_URL.split(' ')
17
+ // : [];
18
+ // const userPoolIdOld = process.env.USERPOOL_ID_OLD;
19
+ // const userPoolIdNew = process.env.USERPOOL_ID_NEW;
20
+ // const defaultSenderEmail = process.env.DEFAULT_SENDER_EMAIL;
21
+
22
+ // tslint:disable-next-line:max-func-body-length
23
+ async function main() {
24
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
25
+
26
+ const settingRepo = await chevre.repository.Setting.createInstance(mongoose.connection);
27
+
28
+ const result = await settingRepo.findOne({}, ['useInformResourceTypes']);
29
+ // tslint:disable-next-line:no-null-keyword
30
+ console.dir(result, { depth: null });
31
+
32
+ if (result === null) {
33
+ if (informOrderUrls.length > 0) {
34
+ await settingRepo.saveOne({
35
+ project: { id: '*', typeOf: chevre.factory.organizationType.Project },
36
+ onOrderStatusChanged: {
37
+ informOrder: informOrderUrls
38
+ .filter((url) => url.length > 0)
39
+ .map((url) => {
40
+ return {
41
+ recipient: {
42
+ typeOf: chevre.factory.creativeWorkType.WebApplication,
43
+ name: 'Aggregation Service',
44
+ url
45
+ }
46
+ };
47
+ })
48
+ }
49
+ });
50
+ console.log('saved');
51
+ }
52
+ } else {
53
+ const updateResult = await settingRepo.updateByProject(
54
+ { project: { id: { $eq: '*' } } },
55
+ {
56
+ useInformResourceTypes: [
57
+ 'AccountTitle',
58
+ 'CategoryCode',
59
+ 'Movie',
60
+ 'MovieTheater',
61
+ 'EventService',
62
+ 'NoteDigitalDocument',
63
+ 'POS',
64
+ 'ScreeningEvent',
65
+ 'ScreeningEventSeries'
66
+ ]
67
+ }
68
+ );
69
+ console.log('updated', updateResult);
70
+ }
71
+ }
72
+
73
+ main()
74
+ .then(console.log)
75
+ .catch(console.error);
@@ -0,0 +1,23 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+
4
+ import { chevre } from '../../../lib/index';
5
+
6
+ // const PROJECT_ID = process.env.PROJECT_ID;
7
+
8
+ async function main() {
9
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
10
+
11
+ const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
12
+
13
+ const doc = await eventRepo.projectEventFieldsById(
14
+ { id: 'blzoa1w8g' },
15
+ ['location', 'project', 'startDate', 'typeOf', 'superEvent.id', 'superEvent.location.id', 'offers.itemOffered']
16
+ );
17
+ // tslint:disable-next-line:no-null-keyword
18
+ console.dir(doc, { depth: null });
19
+ }
20
+
21
+ main()
22
+ .then(console.log)
23
+ .catch(console.error);
@@ -0,0 +1,20 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+
4
+ import { chevre } from '../../../lib/index';
5
+
6
+ mongoose.Model.on('index', (...args) => {
7
+ console.error('******** index event emitted. ********\n', args);
8
+ });
9
+ // const project = { id: String(process.env.PROJECT_ID) };
10
+
11
+ async function main() {
12
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
13
+
14
+ await chevre.repository.Reservation.createInstance(mongoose.connection);
15
+ console.log('success!');
16
+ }
17
+
18
+ main()
19
+ .then()
20
+ .catch(console.error);
@@ -12,19 +12,21 @@ async function main() {
12
12
  const taskRepo = await chevre.repository.Task.createInstance(mongoose.connection);
13
13
  const result = await taskRepo.taskModel.updateMany(
14
14
  {
15
+ // _id: { $eq: '673b5f8f5735a0a2dc953cfc' },
16
+ 'project.id': { $eq: project.id },
15
17
  status: { $eq: chevre.factory.taskStatus.Aborted },
16
18
  lastTriedAt: {
17
19
  $gt: moment()
18
- .add(-1, 'day')
20
+ // tslint:disable-next-line:no-magic-numbers
21
+ .add(-2, 'days')
19
22
  .toDate()
20
23
  },
21
- name: { $eq: chevre.factory.taskName.TriggerWebhook },
22
- 'project.id': { $eq: project.id }
24
+ name: { $eq: chevre.factory.taskName.VoidPayment }
23
25
  },
24
26
  {
25
27
  $set: {
26
28
  status: chevre.factory.taskStatus.Ready,
27
- remainingNumberOfTries: 20
29
+ remainingNumberOfTries: 3
28
30
  }
29
31
  }
30
32
  )
@@ -0,0 +1,35 @@
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 indexes = await mongoose.connection.db.collection('authorizations')
16
+ .indexes();
17
+ // console.log(indexes);
18
+ console.log(indexes.length, 'indexes found');
19
+
20
+ const authorizationRepo = await chevre.repository.Authorization.createInstance(mongoose.connection);
21
+
22
+ const docs = await authorizationRepo.projectFields(
23
+ {
24
+ limit: 10,
25
+ project: { id: { $eq: project.id } },
26
+ audience: { id: { $eq: '6749bd9b84c1b2a0759cbfc8' } }
27
+ }
28
+ );
29
+ console.log('docs found', docs);
30
+ console.log(docs.length, 'docs found');
31
+ }
32
+
33
+ main()
34
+ .then()
35
+ .catch(console.error);
@@ -1,33 +1,51 @@
1
1
  // tslint:disable:no-console
2
- import * as moment from 'moment';
2
+ // import * as moment from 'moment';
3
3
  import * as mongoose from 'mongoose';
4
4
 
5
5
  import { chevre } from '../../../lib/index';
6
6
 
7
- const excludedProject = { id: String(process.env.EXCLUDED_PROJECT_ID) };
7
+ // const excludedProject = { id: String(process.env.EXCLUDED_PROJECT_ID) };
8
8
 
9
9
  async function main() {
10
10
  await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
11
11
 
12
- const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
12
+ const aggregateOfferRepo = await chevre.repository.AggregateOffer.createInstance(mongoose.connection);
13
+ const offerCatalogRepo = await chevre.repository.OfferCatalog.createInstance(mongoose.connection);
14
+ const offerCatalogItemRepo = await chevre.repository.OfferCatalogItem.createInstance(mongoose.connection);
13
15
 
14
16
  let updateResult: any;
15
- updateResult = await eventRepo.unsetUnnecessaryFields({
17
+ updateResult = await aggregateOfferRepo.unsetUnnecessaryFields({
16
18
  filter: {
17
- 'project.id': { $ne: excludedProject.id },
18
- 'offers.validFrom': { $exists: true },
19
- startDate: {
20
- $gte: moment()
21
- .add(-1, 'days')
22
- .toDate()
23
- }
24
- // _id: { $eq: 'blxd1grz3' }
19
+ _id: { $exists: true }
25
20
  },
26
21
  $unset: <any>{
27
- 'offers.availabilityEnds': 1,
28
- 'offers.availabilityStarts': 1,
29
- 'offers.validFrom': 1,
30
- 'offers.validThrough': 1
22
+ createdAt: 1,
23
+ updatedAt: 1,
24
+ __v: 1
25
+ }
26
+ });
27
+ console.log(updateResult);
28
+
29
+ updateResult = await offerCatalogRepo.unsetUnnecessaryFields({
30
+ filter: {
31
+ _id: { $exists: true }
32
+ },
33
+ $unset: <any>{
34
+ createdAt: 1,
35
+ updatedAt: 1,
36
+ __v: 1
37
+ }
38
+ });
39
+ console.log(updateResult);
40
+
41
+ updateResult = await offerCatalogItemRepo.unsetUnnecessaryFields({
42
+ filter: {
43
+ _id: { $exists: true }
44
+ },
45
+ $unset: <any>{
46
+ createdAt: 1,
47
+ updatedAt: 1,
48
+ __v: 1
31
49
  }
32
50
  });
33
51
  console.log(updateResult);
@@ -15,19 +15,6 @@ exports.credentials = void 0;
15
15
  */
16
16
  var credentials;
17
17
  (function (credentials) {
18
- // export const customSearch = {
19
- // engineId: <string>process.env.CUSTOM_SEARCH_ENGINE_ID,
20
- // apiKey: <string>process.env.GOOGLE_API_KEY
21
- // };
22
- // export const lineNotify = {
23
- // url: process.env.LINE_NOTIFY_URL,
24
- // accessToken: process.env.LINE_NOTIFY_ACCESS_TOKEN,
25
- // accessTokenAlert: process.env.LINE_NOTIFY_ACCESS_TOKEN_ALERT,
26
- // accessTokenInfo: process.env.LINE_NOTIFY_ACCESS_TOKEN_INFO
27
- // };
28
- // export const sendGrid = {
29
- // apiKey: process.env.SENDGRID_API_KEY
30
- // };
31
18
  let CustomSearch;
32
19
  (function (CustomSearch) {
33
20
  let cred;
@@ -1,10 +1,10 @@
1
1
  import * as factory from './factory';
2
- import { Settings } from './settings';
2
+ import type { ISetting } from './repo/setting';
3
3
  type ISendableEmailMessage = factory.action.transfer.send.message.email.IObjectAsEmailMessage & {
4
4
  identifier: string;
5
5
  name: string;
6
6
  };
7
- export type IOrderAsCreateEmailParams = Pick<factory.order.IOrder, 'confirmationNumber' | 'identifier' | 'customer' | 'orderDate' | 'orderNumber' | 'orderStatus' | 'orderedItem' | 'paymentMethods' | 'price' | 'priceCurrency' | 'seller' | 'typeOf'> & {};
7
+ export type IOrderAsCreateEmailParams = Pick<factory.order.IOrder, 'confirmationNumber' | 'identifier' | 'customer' | 'orderDate' | 'orderNumber' | 'orderStatus' | 'orderedItem' | 'paymentMethods' | 'price' | 'priceCurrency' | 'seller' | 'typeOf'>;
8
8
  /**
9
9
  * 注文配送メッセージを作成する
10
10
  */
@@ -13,7 +13,7 @@ declare function createSendOrderMessage(params: {
13
13
  email?: factory.creativeWork.message.email.ICustomization;
14
14
  emailMessage?: factory.creativeWork.message.email.ICreativeWork;
15
15
  index: number;
16
- }, settings: Settings): Promise<ISendableEmailMessage>;
16
+ }, setting: Pick<ISetting, 'defaultSenderEmail'>): Promise<ISendableEmailMessage>;
17
17
  /**
18
18
  * 注文返品メッセージを作成する
19
19
  */
@@ -22,7 +22,7 @@ declare function createReturnOrderMessage(params: {
22
22
  email?: factory.creativeWork.message.email.ICustomization;
23
23
  emailMessage?: factory.creativeWork.message.email.ICreativeWork;
24
24
  index: number;
25
- }, settings: Settings): Promise<ISendableEmailMessage>;
25
+ }, setting: Pick<ISetting, 'defaultSenderEmail'>): Promise<ISendableEmailMessage>;
26
26
  /**
27
27
  * 返金メッセージを作成する
28
28
  */
@@ -30,5 +30,5 @@ declare function createRefundMessage(params: {
30
30
  order: IOrderAsCreateEmailParams;
31
31
  email?: factory.creativeWork.message.email.ICustomization;
32
32
  paymentMethodId: string;
33
- }, settings: Settings): Promise<ISendableEmailMessage>;
33
+ }, setting: Pick<ISetting, 'defaultSenderEmail'>): Promise<ISendableEmailMessage>;
34
34
  export { createSendOrderMessage, createReturnOrderMessage, createRefundMessage };
@@ -105,8 +105,13 @@ function createEmailMessageAbout(params) {
105
105
  return about;
106
106
  });
107
107
  }
108
- function createEmailMessageSender(params, settings) {
108
+ function createEmailMessageSender(params,
109
+ // settings: Settings
110
+ setting) {
109
111
  var _a, _b;
112
+ if (typeof setting.defaultSenderEmail !== 'string') {
113
+ throw new factory.errors.NotFound('setting.defaultSenderEmail');
114
+ }
110
115
  return {
111
116
  typeOf: params.order.seller.typeOf,
112
117
  name: (typeof ((_b = (_a = params.email) === null || _a === void 0 ? void 0 : _a.sender) === null || _b === void 0 ? void 0 : _b.name) === 'string')
@@ -114,13 +119,16 @@ function createEmailMessageSender(params, settings) {
114
119
  : (typeof params.order.seller.name === 'string')
115
120
  ? params.order.seller.name
116
121
  : String(params.order.seller.id),
117
- email: settings.defaultSenderEmail
122
+ // email: settings.defaultSenderEmail
123
+ email: setting.defaultSenderEmail
118
124
  };
119
125
  }
120
126
  /**
121
127
  * 注文配送メッセージを作成する
122
128
  */
123
- function createSendOrderMessage(params, settings) {
129
+ function createSendOrderMessage(params,
130
+ // settings: Settings
131
+ setting) {
124
132
  var _a;
125
133
  return __awaiter(this, void 0, void 0, function* () {
126
134
  const emailMessageText = yield createEmailMessageText({
@@ -140,7 +148,7 @@ function createSendOrderMessage(params, settings) {
140
148
  throw new factory.errors.Argument('order', 'order.customer.email undefined');
141
149
  }
142
150
  const defaultRecipientName = `${params.order.customer.familyName} ${params.order.customer.givenName}`;
143
- const sender = createEmailMessageSender(params, settings);
151
+ const sender = createEmailMessageSender(params, setting);
144
152
  const toRecipientCustomization = (_a = params.email) === null || _a === void 0 ? void 0 : _a.toRecipient;
145
153
  const toRecipient = (Array.isArray(toRecipientCustomization))
146
154
  ? toRecipientCustomization.map((customizedRecipient) => {
@@ -178,7 +186,9 @@ exports.createSendOrderMessage = createSendOrderMessage;
178
186
  /**
179
187
  * 注文返品メッセージを作成する
180
188
  */
181
- function createReturnOrderMessage(params, settings) {
189
+ function createReturnOrderMessage(params,
190
+ // settings: Settings
191
+ setting) {
182
192
  var _a;
183
193
  return __awaiter(this, void 0, void 0, function* () {
184
194
  const emailMessageText = yield createEmailMessageText({
@@ -198,7 +208,7 @@ function createReturnOrderMessage(params, settings) {
198
208
  throw new factory.errors.Argument('order', 'order.customer.email undefined');
199
209
  }
200
210
  const defaultRecipientName = `${params.order.customer.familyName} ${params.order.customer.givenName}`;
201
- const sender = createEmailMessageSender(params, settings);
211
+ const sender = createEmailMessageSender(params, setting);
202
212
  const toRecipientCustomization = (_a = params.email) === null || _a === void 0 ? void 0 : _a.toRecipient;
203
213
  const toRecipient = (Array.isArray(toRecipientCustomization))
204
214
  ? toRecipientCustomization.map((customizedRecipient) => {
@@ -236,7 +246,9 @@ exports.createReturnOrderMessage = createReturnOrderMessage;
236
246
  /**
237
247
  * 返金メッセージを作成する
238
248
  */
239
- function createRefundMessage(params, settings) {
249
+ function createRefundMessage(params,
250
+ // settings: Settings
251
+ setting) {
240
252
  var _a;
241
253
  return __awaiter(this, void 0, void 0, function* () {
242
254
  const emailMessageText = yield createEmailMessageText({
@@ -254,7 +266,7 @@ function createRefundMessage(params, settings) {
254
266
  throw new factory.errors.Argument('order', 'order.customer.email undefined');
255
267
  }
256
268
  const defaultRecipientName = `${params.order.customer.familyName} ${params.order.customer.givenName}`;
257
- const sender = createEmailMessageSender(params, settings);
269
+ const sender = createEmailMessageSender(params, setting);
258
270
  const toRecipientCustomization = (_a = params.email) === null || _a === void 0 ? void 0 : _a.toRecipient;
259
271
  const toRecipient = (Array.isArray(toRecipientCustomization))
260
272
  ? toRecipientCustomization.map((customizedRecipient) => {
@@ -29,7 +29,13 @@ export type IAction4transaction<T extends factory.actionType.AcceptAction | fact
29
29
  export type IAction<T extends factory.actionType> = T extends factory.actionType.OrderAction ? factory.action.trade.order.IAction : T extends factory.actionType.AcceptAction ? IAction4transaction<factory.actionType.AcceptAction> : T extends factory.actionType.AuthorizeAction ? factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>> : T extends factory.actionType.CheckAction ? (factory.action.check.paymentMethod.movieTicket.IAction | factory.action.check.token.IAction) : T extends factory.actionType.MoneyTransfer ? factory.action.transfer.moneyTransfer.IAction : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IAction<factory.action.update.replace.IAttributes<any, any>> : factory.action.IAction<factory.action.IAttributes<T, any, any>>;
30
30
  export type IPayAction = factory.action.trade.pay.IAction;
31
31
  export interface IUseActionCountByOffer {
32
- _id: string[];
32
+ /**
33
+ * 単価オファーID
34
+ */
35
+ _id: [string];
36
+ /**
37
+ * 使用アクション数
38
+ */
33
39
  useActionCount?: number;
34
40
  }
35
41
  interface IAggregationByStatus {
@@ -379,6 +385,7 @@ export declare class ActionRepo {
379
385
  agent: import("@chevre/factory/lib/action").IParticipant;
380
386
  purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
381
387
  typeOf: factory.actionType;
388
+ targetCollection?: any;
382
389
  potentialActions?: any;
383
390
  instrument?: any;
384
391
  recipient?: import("@chevre/factory/lib/action").IParticipant | undefined;
@@ -392,7 +399,6 @@ export declare class ActionRepo {
392
399
  fromLocation?: any;
393
400
  toLocation?: any;
394
401
  replacer?: any;
395
- targetCollection?: any;
396
402
  cancelAction?: any;
397
403
  actionStatus: factory.actionStatusType;
398
404
  }> & {
@@ -402,6 +408,7 @@ export declare class ActionRepo {
402
408
  agent: import("@chevre/factory/lib/action").IParticipant;
403
409
  purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
404
410
  typeOf: factory.actionType;
411
+ targetCollection?: any;
405
412
  potentialActions?: any;
406
413
  instrument?: any;
407
414
  recipient?: import("@chevre/factory/lib/action").IParticipant | undefined;
@@ -415,7 +422,6 @@ export declare class ActionRepo {
415
422
  fromLocation?: any;
416
423
  toLocation?: any;
417
424
  replacer?: any;
418
- targetCollection?: any;
419
425
  cancelAction?: any;
420
426
  actionStatus: factory.actionStatusType;
421
427
  } & {
@@ -427,6 +433,7 @@ export declare class ActionRepo {
427
433
  agent: import("@chevre/factory/lib/action").IParticipant;
428
434
  purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
429
435
  typeOf: factory.actionType;
436
+ targetCollection?: any;
430
437
  potentialActions?: any;
431
438
  instrument?: any;
432
439
  recipient?: import("@chevre/factory/lib/action").IParticipant | undefined;
@@ -440,7 +447,6 @@ export declare class ActionRepo {
440
447
  fromLocation?: any;
441
448
  toLocation?: any;
442
449
  replacer?: any;
443
- targetCollection?: any;
444
450
  cancelAction?: any;
445
451
  actionStatus: factory.actionStatusType;
446
452
  }> & {
@@ -450,6 +456,7 @@ export declare class ActionRepo {
450
456
  agent: import("@chevre/factory/lib/action").IParticipant;
451
457
  purpose?: import("@chevre/factory/lib/action").IPurpose | undefined;
452
458
  typeOf: factory.actionType;
459
+ targetCollection?: any;
453
460
  potentialActions?: any;
454
461
  instrument?: any;
455
462
  recipient?: import("@chevre/factory/lib/action").IParticipant | undefined;
@@ -463,7 +470,6 @@ export declare class ActionRepo {
463
470
  fromLocation?: any;
464
471
  toLocation?: any;
465
472
  replacer?: any;
466
- targetCollection?: any;
467
473
  cancelAction?: any;
468
474
  actionStatus: factory.actionStatusType;
469
475
  } & {
@@ -24,7 +24,7 @@ class AuthorizationRepo {
24
24
  }
25
25
  // tslint:disable-next-line:max-func-body-length
26
26
  static CREATE_MONGO_CONDITIONS(params) {
27
- var _a, _b, _c, _d, _e, _f;
27
+ var _a, _b, _c, _d, _e, _f, _g, _h;
28
28
  const andConditions = [];
29
29
  const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
30
30
  if (typeof projectIdEq === 'string') {
@@ -89,6 +89,10 @@ class AuthorizationRepo {
89
89
  if (params.validThrough instanceof Date) {
90
90
  andConditions.push({ validFrom: { $lte: params.validThrough } });
91
91
  }
92
+ const audienceIdeEq = (_h = (_g = params.audience) === null || _g === void 0 ? void 0 : _g.id) === null || _h === void 0 ? void 0 : _h.$eq;
93
+ if (typeof audienceIdeEq === 'string') {
94
+ andConditions.push({ 'audience.id': { $exists: true, $eq: audienceIdeEq } });
95
+ }
92
96
  return andConditions;
93
97
  }
94
98
  /**
@@ -0,0 +1,19 @@
1
+ import type * as COA from '@motionpicture/coa-service';
2
+ import type { RedisClientType } from 'redis';
3
+ interface IOptions {
4
+ scope: string;
5
+ expireInSeconds: number;
6
+ }
7
+ /**
8
+ * 認証情報リポジトリ
9
+ */
10
+ export declare class CredentialsRepo implements COA.auth.repo.credentials.AbstractCredentialsRepo {
11
+ static KEY_PREFIX: string;
12
+ private readonly redisClient;
13
+ private readonly options;
14
+ constructor(redisClient: RedisClientType, options: IOptions);
15
+ save(credentials: COA.auth.repo.credentials.ISaveParams): Promise<void>;
16
+ find(): Promise<COA.auth.repo.credentials.IFindResult>;
17
+ private createKey;
18
+ }
19
+ export {};