@chevre/domain 22.6.0-alpha.9 → 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 (210) 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 +4 -0
  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 +7 -1
  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 +9 -2
  47. package/lib/chevre/repo/schedule.js +19 -6
  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 +3 -2
  67. package/lib/chevre/service/event.js +7 -7
  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 +3 -2
  155. package/lib/chevre/service/task/createEvent/createEvent.js +5 -2
  156. package/lib/chevre/service/task/createEvent/createEventBySchedule.d.ts +3 -2
  157. package/lib/chevre/service/task/createEvent/createEventBySchedule.js +185 -94
  158. package/lib/chevre/service/task/createEvent.js +6 -2
  159. package/lib/chevre/service/task/deletePerson.js +28 -10
  160. package/lib/chevre/service/task/importEventCapacitiesFromCOA.d.ts +2 -2
  161. package/lib/chevre/service/task/importEventCapacitiesFromCOA.js +14 -5
  162. package/lib/chevre/service/task/importEventsFromCOA.d.ts +2 -2
  163. package/lib/chevre/service/task/importEventsFromCOA.js +14 -5
  164. package/lib/chevre/service/task/importOffersFromCOA.d.ts +2 -2
  165. package/lib/chevre/service/task/importOffersFromCOA.js +15 -6
  166. package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +2 -0
  167. package/lib/chevre/service/task/onAuthorizationCreated.js +13 -12
  168. package/lib/chevre/service/task/onEventChanged.js +6 -2
  169. package/lib/chevre/service/task/onOrderPaymentCompleted.js +2 -0
  170. package/lib/chevre/service/task/onResourceUpdated/onAggregateOfferUpdated.d.ts +3 -3
  171. package/lib/chevre/service/task/onResourceUpdated/onAggregateOfferUpdated.js +7 -3
  172. package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.d.ts +3 -2
  173. package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.js +8 -3
  174. package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.d.ts +4 -3
  175. package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.js +7 -3
  176. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +3 -2
  177. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +7 -3
  178. package/lib/chevre/service/task/onResourceUpdated.js +61 -33
  179. package/lib/chevre/service/task/pay.js +27 -2
  180. package/lib/chevre/service/task/placeOrder.js +2 -0
  181. package/lib/chevre/service/task/refund.js +10 -0
  182. package/lib/chevre/service/task/reserve.js +6 -2
  183. package/lib/chevre/service/task/returnOrder.js +6 -2
  184. package/lib/chevre/service/task/returnReserveTransaction.d.ts +1 -1
  185. package/lib/chevre/service/task/returnReserveTransaction.js +21 -7
  186. package/lib/chevre/service/task/sendOrder.js +2 -0
  187. package/lib/chevre/service/task/useReservation.js +6 -2
  188. package/lib/chevre/service/task/voidPayment.js +14 -1
  189. package/lib/chevre/service/task/voidReserveTransaction.d.ts +1 -1
  190. package/lib/chevre/service/task/voidReserveTransaction.js +21 -6
  191. package/lib/chevre/service/task.d.ts +0 -5
  192. package/lib/chevre/service/task.js +6 -0
  193. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.d.ts +2 -2
  194. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.js +5 -2
  195. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.d.ts +2 -2
  196. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.js +5 -2
  197. package/lib/chevre/service/transaction/placeOrder/confirm.d.ts +3 -2
  198. package/lib/chevre/service/transaction/placeOrder/confirm.js +11 -2
  199. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.d.ts +2 -2
  200. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +14 -7
  201. package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.d.ts +2 -2
  202. package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +4 -2
  203. package/lib/chevre/service/transaction/returnOrder/potentialActions.d.ts +2 -2
  204. package/lib/chevre/service/transaction/returnOrder/potentialActions.js +6 -3
  205. package/lib/chevre/service/transaction/returnOrder.d.ts +3 -1
  206. package/lib/chevre/service/transaction/returnOrder.js +10 -2
  207. package/lib/chevre/settings.d.ts +20 -66
  208. package/lib/chevre/settings.js +21 -10
  209. package/package.json +5 -5
  210. package/example/src/chevre/searchAssetTransactions.ts +0 -38
@@ -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,6 +8,10 @@ async function main() {
8
8
 
9
9
  const scheduleRepo = await chevre.repository.Schedule.createInstance(mongoose.connection);
10
10
 
11
+ const findOneIdResult = await scheduleRepo.findOneId();
12
+ // tslint:disable-next-line:no-null-keyword
13
+ console.dir(findOneIdResult, { depth: null });
14
+
11
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 });
@@ -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 {
@@ -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 {};
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.CredentialsRepo = void 0;
13
+ /**
14
+ * 認証情報リポジトリ
15
+ */
16
+ class CredentialsRepo {
17
+ constructor(redisClient, options) {
18
+ this.redisClient = redisClient;
19
+ this.options = options;
20
+ }
21
+ save(credentials) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ if (typeof this.options.expireInSeconds !== 'number' || this.options.expireInSeconds <= 0) {
24
+ // expireInSeconds:0に設定すれば保管しない
25
+ return;
26
+ }
27
+ // const { access_token, expired_at } = credentials;
28
+ if (typeof credentials.access_token !== 'string') {
29
+ throw new Error('access_token must be string');
30
+ }
31
+ // if (typeof credentials.expired_at !== 'string') {
32
+ // throw new Error('expired_at must be string');
33
+ // }
34
+ const key = this.createKey();
35
+ const value = JSON.stringify(credentials);
36
+ const multi = this.redisClient.multi();
37
+ yield multi.set(key, value)
38
+ // .expireAt(key, Number(expired_at))
39
+ .expire(key, this.options.expireInSeconds)
40
+ .exec();
41
+ // if (Array.isArray(results) && (results[0] === 1 || (<any>results)[0] === true)) {
42
+ // return true;
43
+ // } else {
44
+ // throw new Error('unexpected');
45
+ // }
46
+ });
47
+ }
48
+ find() {
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ const key = this.createKey();
51
+ let credentials;
52
+ try {
53
+ const credentialsStr = yield this.redisClient.get(key);
54
+ if (typeof credentialsStr === 'string') {
55
+ credentials = JSON.parse(credentialsStr);
56
+ }
57
+ }
58
+ catch (error) {
59
+ // tslint:disable-next-line:no-console
60
+ console.error('credential parse error:', error);
61
+ }
62
+ return credentials;
63
+ });
64
+ }
65
+ createKey() {
66
+ return `${CredentialsRepo.KEY_PREFIX}:${this.options.scope}`;
67
+ }
68
+ }
69
+ CredentialsRepo.KEY_PREFIX = 'credentials';
70
+ exports.CredentialsRepo = CredentialsRepo;
@@ -294,11 +294,6 @@ export declare class EventRepo {
294
294
  };
295
295
  };
296
296
  }): Promise<import("mongodb").DeleteResult>;
297
- /**
298
- * 旧施設コンテンツ廃止専用メソッド
299
- * 2024-09-11~
300
- */
301
- deleteOldEventSeries(): Promise<import("mongodb").DeleteResult>;
302
297
  deleteManyEventsEndedByProject(params: {
303
298
  typeOf: {
304
299
  $in: AvailableEventType[];