@chevre/domain 23.2.0 → 24.0.0-alpha.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 (240) hide show
  1. package/lib/chevre/index.d.ts +2 -1
  2. package/lib/chevre/index.js +3 -1
  3. package/lib/chevre/repo/assetTransaction.d.ts +1 -1
  4. package/lib/chevre/repo/identityProvider.d.ts +4 -4
  5. package/lib/chevre/repo/potentialAction.d.ts +4 -4
  6. package/lib/chevre/repo/seller.d.ts +8 -8
  7. package/lib/chevre/repo/task.d.ts +25 -28
  8. package/lib/chevre/repo/transaction.d.ts +5 -5
  9. package/lib/chevre/service/assetTransaction/reserve/start/createSubReservations.js +3 -2
  10. package/lib/chevre/service/assetTransaction/reserve/start/factory/addOffers2seat.d.ts +14 -0
  11. package/lib/chevre/service/assetTransaction/reserve/start/factory/addOffers2seat.js +63 -0
  12. package/lib/chevre/service/assetTransaction/reserve/start.js +2 -2
  13. package/lib/chevre/service/offer.d.ts +0 -12
  14. package/lib/chevre/service/offer.js +0 -37
  15. package/lib/chevre/service/task.d.ts +1 -1
  16. package/lib/chevre/service/taskHandler/onOperationFailed/informTaskIfNeeded.d.ts +2 -1
  17. package/lib/chevre/service/taskHandler/onOperationFailed.d.ts +2 -1
  18. package/lib/chevre/service/taskHandler.d.ts +2 -20
  19. package/lib/chevre/settings.d.ts +1 -2
  20. package/lib/chevre/settings.js +1 -3
  21. package/lib/chevre/taskSettings.d.ts +58 -0
  22. package/package.json +14 -16
  23. package/example/src/chevre/acceptedPaymentMethodOffer/adminAcceptedPaymentMethodOffers.ts +0 -76
  24. package/example/src/chevre/actions/checkAcceptPayActions.ts +0 -60
  25. package/example/src/chevre/actions/checkAuthorizePaymentActions.ts +0 -55
  26. package/example/src/chevre/activateOptionalAggregationSettings.ts +0 -19
  27. package/example/src/chevre/adminIdentities.ts +0 -71
  28. package/example/src/chevre/aggreateOwnershipInfosByOrder.ts +0 -24
  29. package/example/src/chevre/aggregateEventPublicFields.ts +0 -47
  30. package/example/src/chevre/aggregateOfferCatalogItemList.ts +0 -36
  31. package/example/src/chevre/aggregateScreeningEventMaxVersion.ts +0 -36
  32. package/example/src/chevre/aggregation/aggregateOffersOnEvent.ts +0 -86
  33. package/example/src/chevre/aggregation/aggregateOrderOfCustomer.ts +0 -138
  34. package/example/src/chevre/aggregation/aggregateOrderOfCustomerGlobally.ts +0 -34
  35. package/example/src/chevre/aggregation/aggregateOrderOfSeatByRoyalCustomers.ts +0 -172
  36. package/example/src/chevre/aggregation/aggregateOrderOnSystem.ts +0 -40
  37. package/example/src/chevre/aggregation/aggregateReservationByProject.ts +0 -79
  38. package/example/src/chevre/aggregation/aggregateSystem.ts +0 -201
  39. package/example/src/chevre/aggregation/aggregateTasks.ts +0 -41
  40. package/example/src/chevre/aggregation/createAggregateEventTasks.ts +0 -71
  41. package/example/src/chevre/aggregation/searchAggregateReservations.ts +0 -33
  42. package/example/src/chevre/assetTransaction/checkPayTransactionsTicketToken.ts +0 -67
  43. package/example/src/chevre/assetTransaction/processReserve.ts +0 -149
  44. package/example/src/chevre/attendIfNotAttended.ts +0 -31
  45. package/example/src/chevre/authorizeEventServiceOffer.ts +0 -122
  46. package/example/src/chevre/categoryCode/checkUniqueness.ts +0 -69
  47. package/example/src/chevre/changeOrderStatus.ts +0 -29
  48. package/example/src/chevre/checkCustomerAttributesLength.ts +0 -109
  49. package/example/src/chevre/checkEventDuration.ts +0 -59
  50. package/example/src/chevre/checkPaymentServiceUniqueness.ts +0 -79
  51. package/example/src/chevre/checkProjectMembers.ts +0 -55
  52. package/example/src/chevre/checkReserveTransactionSizes.ts +0 -46
  53. package/example/src/chevre/cleanActions.ts +0 -23
  54. package/example/src/chevre/cleanReservations.ts +0 -69
  55. package/example/src/chevre/cleanTransactions.ts +0 -39
  56. package/example/src/chevre/concurrentLock/lockOfferRateLimit.ts +0 -64
  57. package/example/src/chevre/concurrentLock/lockTransactionProcess.ts +0 -44
  58. package/example/src/chevre/confirmationNumber/testRandomness.ts +0 -49
  59. package/example/src/chevre/countPotentiallyExportTasks.ts +0 -42
  60. package/example/src/chevre/countTransactions.ts +0 -30
  61. package/example/src/chevre/createProject.ts +0 -19
  62. package/example/src/chevre/createTaskIfNotExistByAlternateName.ts +0 -57
  63. package/example/src/chevre/db/stats.ts +0 -35
  64. package/example/src/chevre/deleteDiscontinuedPeople.ts +0 -153
  65. package/example/src/chevre/deleteDiscontinuedPeopleByFetch.ts +0 -38
  66. package/example/src/chevre/deleteOwnershipInfosByOwnedThrough.ts +0 -79
  67. package/example/src/chevre/deleteStartDatePassedCertainPeriod.ts +0 -27
  68. package/example/src/chevre/deleteTasksByName.ts +0 -30
  69. package/example/src/chevre/emailMessage/createEmailMessageText.ts +0 -63
  70. package/example/src/chevre/event/checkEventAdditionalPropertyUniqueness.ts +0 -108
  71. package/example/src/chevre/event/importEventSeriesFromCOAByTitle.ts +0 -83
  72. package/example/src/chevre/event/importEventsFromCOAByTitle.ts +0 -148
  73. package/example/src/chevre/event/migrateEventAdditionalProperty2identifier.ts +0 -121
  74. package/example/src/chevre/event/migrateEventMaximumPhysicalAttendeeCapacity.ts +0 -76
  75. package/example/src/chevre/event/unsetSuperEventVideoFormat.ts +0 -30
  76. package/example/src/chevre/event/updateSellerMakesOffersByIdentifier.ts +0 -106
  77. package/example/src/chevre/eventSeries/unsetVideoFormat.ts +0 -31
  78. package/example/src/chevre/eventSeries/upsertScreeningEventSeriesByVersion.ts +0 -106
  79. package/example/src/chevre/findAnyEventById.ts +0 -24
  80. package/example/src/chevre/findAuthorizePaymentAction.ts +0 -34
  81. package/example/src/chevre/findAvailableChannelMovieTicket.ts +0 -25
  82. package/example/src/chevre/findCheckAction.ts +0 -34
  83. package/example/src/chevre/findCustomerByOrderNumber.ts +0 -19
  84. package/example/src/chevre/findItemListElementByCatalogId.ts +0 -30
  85. package/example/src/chevre/findItemListElementById.ts +0 -23
  86. package/example/src/chevre/findJWTSetting.ts +0 -19
  87. package/example/src/chevre/findOneAvailableHours.ts +0 -39
  88. package/example/src/chevre/findReservationByCode.ts +0 -64
  89. package/example/src/chevre/findSchedule.ts +0 -43
  90. package/example/src/chevre/giveUpStartDatePassedCertainPeriod.ts +0 -56
  91. package/example/src/chevre/identity/getCommonClients.ts +0 -126
  92. package/example/src/chevre/identity/migrateClients2oauth.ts +0 -200
  93. package/example/src/chevre/importCategoryCodesFromCOA.ts +0 -34
  94. package/example/src/chevre/importEventsFromCOA.ts +0 -66
  95. package/example/src/chevre/investigateEvents.ts +0 -86
  96. package/example/src/chevre/investigateTransaction.ts +0 -66
  97. package/example/src/chevre/isPaymentAcceptedBySeller.ts +0 -24
  98. package/example/src/chevre/issuer/adminMemberProgramTiers.ts +0 -55
  99. package/example/src/chevre/issuer/migrateIssuerUrls.ts +0 -62
  100. package/example/src/chevre/issuer/renameIssuerIdentifier.ts +0 -61
  101. package/example/src/chevre/maintenance/checkTransactionStatuses.ts +0 -105
  102. package/example/src/chevre/makeExpiredManyTasks.ts +0 -27
  103. package/example/src/chevre/makeTransactionExpired.ts +0 -28
  104. package/example/src/chevre/member/migrateMemberIdentifier.ts +0 -99
  105. package/example/src/chevre/migrateAuthorizeEventServiceOfferChevre.ts +0 -84
  106. package/example/src/chevre/migrateCancelReservationObject.ts +0 -71
  107. package/example/src/chevre/migrateCognitoUser.ts +0 -153
  108. package/example/src/chevre/migrateCustomerAdditionalProperties.ts +0 -116
  109. package/example/src/chevre/migrateEventSellerMakesOfferAvailableAt.ts +0 -101
  110. package/example/src/chevre/migrateIdentities.ts +0 -69
  111. package/example/src/chevre/migrateProjectSettings.ts +0 -64
  112. package/example/src/chevre/migrateRoomAdditionalProperties.ts +0 -118
  113. package/example/src/chevre/migrateRoomSectionAdditionalProperties.ts +0 -121
  114. package/example/src/chevre/note/findNotes.ts +0 -34
  115. package/example/src/chevre/note/upsertNotesByIdentifier.ts +0 -63
  116. package/example/src/chevre/notifyAbortedTasksByEmail.ts +0 -56
  117. package/example/src/chevre/notifyByEmail.ts +0 -43
  118. package/example/src/chevre/offerCatalog/updateManyOfferCatalogsByIds.ts +0 -49
  119. package/example/src/chevre/offerCatalog/upsertOfferCatalogItemsByIdentifier.ts +0 -49
  120. package/example/src/chevre/offerCatalog/upsertOfferCatalogsByIdentifier.ts +0 -51
  121. package/example/src/chevre/offers/checkIncludedInCatalogCount.ts +0 -47
  122. package/example/src/chevre/offers/projectItemListElement.ts +0 -54
  123. package/example/src/chevre/offers/searchAvaialbleAppliesToMovieTicketByOfferCatalogId.ts +0 -51
  124. package/example/src/chevre/offers/searchByOfferCatalogIdWithSortIndex.ts +0 -44
  125. package/example/src/chevre/offers/searchOfferCatalogItemAvailability.ts +0 -68
  126. package/example/src/chevre/offers/upsertOffersByIdentifier.ts +0 -63
  127. package/example/src/chevre/optimizeActions.ts +0 -61
  128. package/example/src/chevre/orderNumber/testRandomness.ts +0 -54
  129. package/example/src/chevre/orders/searchOrders.ts +0 -28
  130. package/example/src/chevre/orders/searchWithUnwoundAcceptedOffers.ts +0 -73
  131. package/example/src/chevre/paymentServices/findPaymentServices.ts +0 -37
  132. package/example/src/chevre/pendingReservation/findEventSeatOffersBySection.ts +0 -46
  133. package/example/src/chevre/person/checkUserPoolClients.ts +0 -120
  134. package/example/src/chevre/person/cleanUpCognitoUsers.ts +0 -140
  135. package/example/src/chevre/person/cleanUpCognitoUsersByFetch.ts +0 -162
  136. package/example/src/chevre/person/cleanUpCreditCard.ts +0 -113
  137. package/example/src/chevre/person/updateProfile.ts +0 -56
  138. package/example/src/chevre/place/adminEntranceGates.ts +0 -69
  139. package/example/src/chevre/place/adminHasPOS.ts +0 -44
  140. package/example/src/chevre/place/aggregateSeatingTypes.ts +0 -29
  141. package/example/src/chevre/place/checkEntranceGatesCount.ts +0 -82
  142. package/example/src/chevre/place/checkSectionCount.ts +0 -27
  143. package/example/src/chevre/place/findRooms.ts +0 -24
  144. package/example/src/chevre/place/findSections.ts +0 -28
  145. package/example/src/chevre/place/findSectionsByRoom.ts +0 -50
  146. package/example/src/chevre/place/migrateSectionIdentifier.ts +0 -92
  147. package/example/src/chevre/place/seatsJson2csv.ts +0 -63
  148. package/example/src/chevre/place/upsertMovieTheatersByBranchCode.ts +0 -41
  149. package/example/src/chevre/place/upsertRoomsByBranchCode.ts +0 -40
  150. package/example/src/chevre/place/upsertSeatSectionsByBranchCode.ts +0 -56
  151. package/example/src/chevre/processAction.ts +0 -44
  152. package/example/src/chevre/processOrder.ts +0 -90
  153. package/example/src/chevre/product/findHasOfferCatalog.ts +0 -31
  154. package/example/src/chevre/productOffer/publishMemberTierToken.ts +0 -92
  155. package/example/src/chevre/project/unsetProjectSettings.ts +0 -73
  156. package/example/src/chevre/projectEventFieldsById.ts +0 -23
  157. package/example/src/chevre/projectFields.ts +0 -28
  158. package/example/src/chevre/projectFieldsById.ts +0 -30
  159. package/example/src/chevre/projectOwnershipInfoFieldsById.ts +0 -24
  160. package/example/src/chevre/pushIncludedInDataCatalog.ts +0 -47
  161. package/example/src/chevre/reExportAction.ts +0 -40
  162. package/example/src/chevre/reIndex.ts +0 -20
  163. package/example/src/chevre/recreateRefundTasks.ts +0 -187
  164. package/example/src/chevre/roles/addAdminAcceptedPaymentMethodReadPermissionIfNotExists.ts +0 -33
  165. package/example/src/chevre/roles/addAdminAcceptedPaymentMethodWritePermissionIfNotExists.ts +0 -33
  166. package/example/src/chevre/roles/addAdminEventSeriesReadPermissionIfNotExists.ts +0 -49
  167. package/example/src/chevre/roles/addAdminMovieReadPermissionIfNotExists.ts +0 -49
  168. package/example/src/chevre/roles/addAdminNotePermissionIfNotExists.ts +0 -48
  169. package/example/src/chevre/roles/addAdminPaymentServiceReadPermissionIfNotExists.ts +0 -49
  170. package/example/src/chevre/roles/addAdminProductHasOfferCatalogReadPermissionIfNotExists.ts +0 -33
  171. package/example/src/chevre/roles/addAdminRoomReadPermissionIfNotExists.ts +0 -34
  172. package/example/src/chevre/roles/addAdminRoomWritePermissionIfNotExists.ts +0 -34
  173. package/example/src/chevre/roles/addAdminSellerEventOfferIfNotExists.ts +0 -48
  174. package/example/src/chevre/roles/addProjectCreatorRole.ts +0 -48
  175. package/example/src/chevre/roles/assignGlobalRoles.ts +0 -72
  176. package/example/src/chevre/roles/findPermissions.ts +0 -84
  177. package/example/src/chevre/roles/findRoleNames.ts +0 -117
  178. package/example/src/chevre/roles/removeConsolePermissionIfExists.ts +0 -34
  179. package/example/src/chevre/roles/removePermissionFromAPIRoles.ts +0 -46
  180. package/example/src/chevre/roles/removePermissionIfExists.ts +0 -34
  181. package/example/src/chevre/saveOfferCatalogItem.ts +0 -40
  182. package/example/src/chevre/saveWebSite.ts +0 -56
  183. package/example/src/chevre/searchAcceptedOfferIds.ts +0 -57
  184. package/example/src/chevre/searchActionsByOrderNumber.ts +0 -29
  185. package/example/src/chevre/searchActionsByPurpose.ts +0 -38
  186. package/example/src/chevre/searchActionsBySameAs.ts +0 -27
  187. package/example/src/chevre/searchAggregateOffers.ts +0 -51
  188. package/example/src/chevre/searchAggregations.ts +0 -50
  189. package/example/src/chevre/searchAuthorizations.ts +0 -36
  190. package/example/src/chevre/searchCheckMovieTicketResultYkknInfo.ts +0 -56
  191. package/example/src/chevre/searchEventHasOfferCatalog.ts +0 -43
  192. package/example/src/chevre/searchEventSeats.ts +0 -45
  193. package/example/src/chevre/searchIdsByReservationNumber.ts +0 -16
  194. package/example/src/chevre/searchMembers.ts +0 -55
  195. package/example/src/chevre/searchOfferCatalogItemListElement.ts +0 -26
  196. package/example/src/chevre/searchOffers.ts +0 -68
  197. package/example/src/chevre/searchProducts.ts +0 -28
  198. package/example/src/chevre/searchProjects.ts +0 -36
  199. package/example/src/chevre/searchReservationsByOrder.ts +0 -42
  200. package/example/src/chevre/searchSellersByAggregate.ts +0 -33
  201. package/example/src/chevre/searchSlicedAcceptedOffersByOrderNumber.ts +0 -31
  202. package/example/src/chevre/seller/adminMakesOffer.ts +0 -113
  203. package/example/src/chevre/sendEmailMessage.ts +0 -60
  204. package/example/src/chevre/sendGrid/filterEmailActivity.ts +0 -31
  205. package/example/src/chevre/settings/addOrderNumberSetting.ts +0 -44
  206. package/example/src/chevre/settings/addTransactionNumberSetting.ts +0 -40
  207. package/example/src/chevre/stockHolder/findSeatsBySection.ts +0 -59
  208. package/example/src/chevre/stockHolder/getSize.ts +0 -97
  209. package/example/src/chevre/stockHolder/projectPendingReservation.ts +0 -43
  210. package/example/src/chevre/stockHolder/searchSeats.ts +0 -61
  211. package/example/src/chevre/task/countPotentiallyRunning.ts +0 -41
  212. package/example/src/chevre/task/countTasks.ts +0 -51
  213. package/example/src/chevre/task/deleteRunsAtPassedCertainPeriod.ts +0 -43
  214. package/example/src/chevre/task/deleteUnexpectedTasks.ts +0 -23
  215. package/example/src/chevre/task/emitRunning.ts +0 -89
  216. package/example/src/chevre/transaction/processPlaceOrder.ts +0 -57
  217. package/example/src/chevre/transaction/processReturnOrder.ts +0 -43
  218. package/example/src/chevre/transaction/startExportTasks.ts +0 -21
  219. package/example/src/chevre/transactionNumber/publishByTimestamp.ts +0 -23
  220. package/example/src/chevre/transactionNumber/testRandomness.ts +0 -42
  221. package/example/src/chevre/unsetUnnecessaryFields.ts +0 -35
  222. package/example/src/chevre/updateEventPartiallyById.ts +0 -22
  223. package/example/src/chevre/updateProjectAggregateReservation.ts +0 -21
  224. package/example/src/chevre/validateCheckMovieTicketActions.ts +0 -70
  225. package/example/src/customSearch.ts +0 -48
  226. package/example/src/duration.ts +0 -22
  227. package/example/src/fetch.ts +0 -45
  228. package/example/src/moment.ts +0 -22
  229. package/example/src/mongoConnectionList.ts +0 -81
  230. package/example/src/mvtkMessage.ts +0 -11
  231. package/example/src/objectId.ts +0 -12
  232. package/example/src/redisClientList.ts +0 -80
  233. package/example/src/redisMulti.ts +0 -63
  234. package/example/src/regex.ts +0 -31
  235. package/example/src/signPayload.ts +0 -50
  236. package/example/src/verifyToken.ts +0 -44
  237. package/lib/chevre/repo/mongoose/onIndexCreated.d.ts +0 -2
  238. package/lib/chevre/repo/mongoose/onIndexCreated.js +0 -10
  239. package/lib/chevre/settings/aggregation.d.ts +0 -35
  240. /package/lib/chevre/{settings/aggregation.js → taskSettings.js} +0 -0
@@ -1,113 +0,0 @@
1
- // tslint:disable:no-console no-null-keyword
2
- import mongoose from 'mongoose';
3
-
4
- import { chevre } from '../../../../lib/index';
5
-
6
- const project = { id: String(process.env.PROJECT_ID) };
7
- const availableAtOrFromId = '51qbjcfr72h62m06vtv5kkhgje';
8
- const SELLER_ID = '59d20831e53ebc2b4e774466';
9
- const INVALID_SELLER_ID = '11d20831e53ebc2b4e111111';
10
-
11
- async function main() {
12
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false, appName: 'sample' });
13
-
14
- const sellerMakesOfferRepo = await chevre.repository.SellerMakesOffer.createInstance(mongoose.connection);
15
-
16
- const offers = await sellerMakesOfferRepo.findOffers(
17
- {
18
- limit: 20,
19
- page: 1,
20
- project: { id: { $eq: project.id } },
21
- availableAtOrFrom: { id: { $eq: availableAtOrFromId } },
22
- offeredBy: { id: { $eq: SELLER_ID } }
23
- }
24
- );
25
- console.dir(offers, { depth: null });
26
- console.log(offers.length, 'offers found');
27
-
28
- if (offers.length > 0) {
29
- const sellerId = offers[0].offeredBy.id;
30
- let deleteResult = await sellerMakesOfferRepo.deleteOffersIfExists({
31
- project: { id: project.id },
32
- offers: [
33
- {
34
- availableAtOrFrom: { id: availableAtOrFromId },
35
- offeredBy: { id: sellerId }
36
- },
37
- {
38
- availableAtOrFrom: { id: availableAtOrFromId },
39
- offeredBy: { id: INVALID_SELLER_ID }
40
- }
41
- ]
42
- });
43
- console.log('deleted.', deleteResult);
44
- deleteResult = await sellerMakesOfferRepo.deleteOffersIfExists({
45
- project: { id: project.id },
46
- offers: [
47
- {
48
- availableAtOrFrom: { id: availableAtOrFromId },
49
- offeredBy: { id: sellerId }
50
- },
51
- {
52
- availableAtOrFrom: { id: availableAtOrFromId },
53
- offeredBy: { id: INVALID_SELLER_ID }
54
- }
55
- ]
56
- });
57
- console.log('deleted.', deleteResult);
58
- }
59
-
60
- let createResult = await sellerMakesOfferRepo.createOffersIfNotExists({
61
- project: { id: project.id },
62
- offers: [
63
- {
64
- availableAtOrFrom: { id: availableAtOrFromId },
65
- offeredBy: { id: SELLER_ID },
66
- eligibleTransactionDuration: {
67
- typeOf: 'QuantitativeValue',
68
- unitCode: chevre.factory.unitCode.Sec,
69
- maxValue: 900
70
- }
71
- },
72
- {
73
- availableAtOrFrom: { id: availableAtOrFromId },
74
- offeredBy: { id: INVALID_SELLER_ID },
75
- eligibleTransactionDuration: {
76
- typeOf: 'QuantitativeValue',
77
- unitCode: chevre.factory.unitCode.Sec,
78
- maxValue: 900
79
- }
80
- }
81
- ]
82
- });
83
- console.log('created.', createResult);
84
-
85
- createResult = await sellerMakesOfferRepo.createOffersIfNotExists({
86
- project: { id: project.id },
87
- offers: [
88
- {
89
- availableAtOrFrom: { id: availableAtOrFromId },
90
- offeredBy: { id: SELLER_ID },
91
- eligibleTransactionDuration: {
92
- typeOf: 'QuantitativeValue',
93
- unitCode: chevre.factory.unitCode.Sec,
94
- maxValue: 900
95
- }
96
- },
97
- {
98
- availableAtOrFrom: { id: availableAtOrFromId },
99
- offeredBy: { id: INVALID_SELLER_ID },
100
- eligibleTransactionDuration: {
101
- typeOf: 'QuantitativeValue',
102
- unitCode: chevre.factory.unitCode.Sec,
103
- maxValue: 900
104
- }
105
- }
106
- ]
107
- });
108
- console.log('created.', createResult);
109
- }
110
-
111
- main()
112
- .then()
113
- .catch(console.error);
@@ -1,60 +0,0 @@
1
- // tslint:disable:no-console
2
- import mongoose from 'mongoose';
3
-
4
- import { chevre } from '../../../lib/index';
5
-
6
- const project = { id: String(process.env.PROJECT_ID) };
7
-
8
- async function main() {
9
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
10
-
11
- const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
12
- const messageRepo = await chevre.repository.Message.createInstance(mongoose.connection);
13
- const projectRepo = await chevre.repository.Project.createInstance(mongoose.connection);
14
- const sendGridCredentials = await chevre.credentials.SendGrid.createInstance({
15
- apiKey: <string>process.env.SENDGRID_API_KEY
16
- });
17
-
18
- const result = await (await chevre.service.notification.createService()).sendEmailMessage({
19
- agent: { id: project.id, typeOf: chevre.factory.organizationType.Project },
20
- object: {
21
- text: 'sample',
22
- toRecipient: [{
23
- name: 'sample',
24
- email: 'xxx'
25
- }],
26
- typeOf: chevre.factory.creativeWorkType.EmailMessage,
27
- sender: {
28
- name: 'xxx',
29
- email: 'xxx'
30
- },
31
- about: {
32
- identifier: <any>'sample',
33
- name: 'sample',
34
- typeOf: 'Thing'
35
- }
36
- },
37
- project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
38
- purpose: <any>{},
39
- recipient: { id: 'xxx', typeOf: chevre.factory.creativeWorkType.WebApplication },
40
- typeOf: chevre.factory.actionType.SendAction
41
- })(
42
- {
43
- action: actionRepo,
44
- message: messageRepo,
45
- project: projectRepo
46
- },
47
- {
48
- sendGrid: sendGridCredentials
49
- }
50
- );
51
- // tslint:disable-next-line:no-null-keyword
52
- console.dir(result, { depth: null });
53
- }
54
-
55
- main()
56
- .then(console.log)
57
- .catch((error) => {
58
- // tslint:disable-next-line:no-null-keyword
59
- console.dir(error, { depth: null });
60
- });
@@ -1,31 +0,0 @@
1
- // tslint:disable:no-console
2
- // tslint:disable-next-line:no-implicit-dependencies
3
- import * as client from '@sendgrid/client';
4
-
5
- // tslint:disable-next-line:max-func-body-length
6
- async function main() {
7
- client.setApiKey(<string>process.env.SENDGRID_API_KEY);
8
-
9
- const queryParams = {
10
- // "query": "from_email=\"email@example.com\"",
11
- // "limit": 10
12
- };
13
-
14
- client.request({
15
- url: `/v3/messages`,
16
- method: 'GET',
17
- qs: queryParams
18
- })
19
- .then(([response, body]) => {
20
- console.log(response.statusCode);
21
- console.log(response.body, body);
22
- })
23
- .catch((error) => {
24
- console.error(error);
25
- });
26
-
27
- }
28
-
29
- main()
30
- .then()
31
- .catch(console.error);
@@ -1,44 +0,0 @@
1
- // tslint:disable:no-console
2
- import moment from 'moment';
3
- import mongoose from 'mongoose';
4
-
5
- import { chevre } from '../../../../lib/index';
6
-
7
- const { FPE_SECRET } = process.env;
8
-
9
- async function main() {
10
- if (typeof FPE_SECRET !== 'string') {
11
- throw new Error('FPE_SECRET required');
12
- }
13
-
14
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
15
-
16
- const settingRepo = await chevre.repository.Setting.createInstance(mongoose.connection);
17
-
18
- const setting = await settingRepo.findOne({ project: { id: { $eq: '*' } } }, ['orderNumber']);
19
- console.log(setting);
20
-
21
- if (typeof setting?.orderNumber?.version !== 'string' || !(setting?.orderNumber?.validFrom instanceof Date)) {
22
- console.log('updating orderNumber...');
23
- await settingRepo.updateByProject(
24
- { project: { id: { $eq: '*' } } },
25
- {
26
- orderNumber: {
27
- validFrom: moment('2026-02-10T05:00:00Z')
28
- .toDate(),
29
- fpeSecret: FPE_SECRET,
30
- version: 'A',
31
- versioningForceProjects: [
32
- 'TTT',
33
- 'SSK'
34
- ]
35
- }
36
- }
37
- );
38
- console.log('orderNumber updated.');
39
- }
40
- }
41
-
42
- main()
43
- .then()
44
- .catch(console.error);
@@ -1,40 +0,0 @@
1
- // tslint:disable:no-console
2
- import moment from 'moment';
3
- import mongoose from 'mongoose';
4
-
5
- import { chevre } from '../../../../lib/index';
6
-
7
- const { FPE_SECRET } = process.env;
8
-
9
- async function main() {
10
- if (typeof FPE_SECRET !== 'string') {
11
- throw new Error('FPE_SECRET required');
12
- }
13
-
14
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
15
-
16
- const settingRepo = await chevre.repository.Setting.createInstance(mongoose.connection);
17
-
18
- const setting = await settingRepo.findOne({ project: { id: { $eq: '*' } } }, ['transactionNumber']);
19
- console.log(setting);
20
-
21
- if (typeof setting?.transactionNumber?.version !== 'string' || !(setting?.transactionNumber?.validFrom instanceof Date)) {
22
- console.log('updating transactionNumber...');
23
- await settingRepo.updateByProject(
24
- { project: { id: { $eq: '*' } } },
25
- {
26
- transactionNumber: {
27
- validFrom: moment('2026-02-05T00:00:00Z')
28
- .toDate(),
29
- fpeSecret: FPE_SECRET,
30
- version: '1'
31
- }
32
- }
33
- );
34
- console.log('transactionNumber updated.');
35
- }
36
- }
37
-
38
- main()
39
- .then()
40
- .catch(console.error);
@@ -1,59 +0,0 @@
1
- // tslint:disable:no-console
2
- import mongoose from 'mongoose';
3
-
4
- import { chevre } from '../../../../lib/index';
5
-
6
- const PROJECT_ID = String(process.env.PROJECT_ID);
7
- const SCREEN_CODE = '100';
8
- const MOVIE_THEATER_CODE = '118';
9
- const SELLER_ID = '59d20831e53ebc2b4e774466';
10
-
11
- const formatter = new Intl.NumberFormat('ja-JP');
12
-
13
- // tslint:disable-next-line:max-func-body-length
14
- async function main() {
15
- let startTime: [number, number] = process.hrtime();
16
- let diff: [number, number] = process.hrtime(startTime);
17
-
18
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
19
-
20
- const seatRepo = await chevre.repository.place.Seat.createInstance(mongoose.connection);
21
-
22
- setInterval(
23
- async () => {
24
- startTime = process.hrtime();
25
- const seats = await seatRepo.findSeatsBySection(
26
- {
27
- limit: 100,
28
- page: 100,
29
- projectId: PROJECT_ID,
30
- sellerId: SELLER_ID,
31
- movieTheaterCode: MOVIE_THEATER_CODE,
32
- roomCode: SCREEN_CODE,
33
- sectionCode: 'Default'
34
- },
35
- {
36
- // branchCode: { $in: ['Z-384'] },
37
- // containedInPlace: {
38
- // branchCode: {
39
- // $in: ['Default']
40
- // }
41
- // }
42
- }
43
- );
44
- diff = process.hrtime(startTime);
45
- // tslint:disable-next-line:no-null-keyword
46
- console.dir(seats, { depth: null });
47
- console.log(seats.length, 'seats found');
48
- console.log('diff:', [diff[0], formatter.format(diff[1])]);
49
- },
50
- // tslint:disable-next-line:no-magic-numbers
51
- 1000
52
- );
53
- }
54
-
55
- main()
56
- .then(() => {
57
- console.log('success!');
58
- })
59
- .catch(console.error);
@@ -1,97 +0,0 @@
1
- // tslint:disable:no-console
2
- import moment from 'moment-timezone';
3
- import mongoose from 'mongoose';
4
- import * as redis from 'redis';
5
- import { PendingReservationRepo } from '../../../../lib/chevre/repo/pendingReservation';
6
- // import { chevre } from '../../../../lib/index';
7
-
8
- mongoose.Model.on('index', (...args) => {
9
- console.error('******** index event emitted. ********\n', args);
10
- });
11
-
12
- const today = moment()
13
- .tz('Asia/Tokyo')
14
- .format('YYYYMMDD');
15
- const project = { id: String(process.env.PROJECT_ID) };
16
- const eventId = `sampleEventId${today}:03`;
17
- // const eventId = 'bma1pcxs0';
18
- const eventStartDate = new Date('2025-05-01T00:00:00Z');
19
- // const seatSection = 'SampleSectionNameXXXXXXXXXXXXXXXXXXX';
20
- const seatSection = 'Default';
21
- // tslint:disable-next-line:no-magic-numbers prefer-array-literal
22
- const allSeatNumbers = [...Array(10000)].map((__, seatKey) => `SampleSeatNumber-${seatKey}`);
23
- // const allSeatNumbers = [...Array(10000)].map((__, seatKey) => `A-${seatKey}`);
24
-
25
- const client = redis.createClient<redis.RedisDefaultModules, Record<string, never>, Record<string, never>>({
26
- socket: {
27
- port: Number(<string>process.env.REDIS_PORT),
28
- host: <string>process.env.REDIS_HOST
29
- },
30
- password: <string>process.env.REDIS_KEY
31
- })
32
- .on('error', (err) => {
33
- // eslint-disable-next-line no-console
34
- console.error('createDefaultRedisClient: client onError:', err);
35
- // reject(err);
36
- });
37
- client.connect();
38
- mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
39
-
40
- const formatter = new Intl.NumberFormat('ja-JP');
41
-
42
- // tslint:disable-next-line:max-func-body-length
43
- async function main() {
44
- let startTime: [number, number] = process.hrtime();
45
- let diff: [number, number] = process.hrtime(startTime);
46
- let result: any;
47
-
48
- // const stockHolderRepo = await chevre.repository.StockHolder.createInstance(client, mongoose.connection);
49
- const pendingReservationRepo = new PendingReservationRepo(mongoose.connection);
50
-
51
- result = await pendingReservationRepo.countUnavailableOffers({
52
- project: { id: project.id },
53
- event: {
54
- id: eventId,
55
- startDate: eventStartDate,
56
- hasTicketedSeat: true
57
- }
58
- });
59
- console.log('countUnavailableOffersResult:', result);
60
-
61
- startTime = process.hrtime();
62
- const searchHoldersResult = await pendingReservationRepo.searchHolders({
63
- project: { id: project.id },
64
- eventId,
65
- startDate: eventStartDate,
66
- hasTicketedSeat: true,
67
- offers: [
68
- // tslint:disable-next-line:no-magic-numbers
69
- ...allSeatNumbers.slice(0, 10)
70
- .map((seatNumber) => ({ seatSection, seatNumber }))
71
- // { seatSection, seatNumber: 'SampleSeatNumber-7341' }
72
- ]
73
- });
74
- diff = process.hrtime(startTime);
75
- console.log('searchHoldersResult:', searchHoldersResult, searchHoldersResult.length);
76
- console.log('diff:', [diff[0], formatter.format(diff[1])]);
77
-
78
- // startTime = process.hrtime();
79
- // const searchHolders2Result = await pendingReservationRepo.searchHolders2({
80
- // project: { id: project.id },
81
- // eventId,
82
- // startDate: eventStartDate,
83
- // hasTicketedSeat: true,
84
- // offers: [
85
- // // tslint:disable-next-line:no-magic-numbers
86
- // ...allSeatNumbers.slice(0, 10)
87
- // .map((seatNumber) => ({ seatSection, seatNumber }))
88
- // ]
89
- // });
90
- // diff = process.hrtime(startTime);
91
- // console.log('searchHolders2:', searchHolders2Result, searchHolders2Result.length);
92
- // console.log('diff:', [diff[0], formatter.format(diff[1])]);
93
- }
94
-
95
- main()
96
- .then(console.log)
97
- .catch(console.error);
@@ -1,43 +0,0 @@
1
- // tslint:disable:no-console
2
- import mongoose from 'mongoose';
3
- import { chevre } from '../../../../lib/index';
4
-
5
- const project = { id: String(process.env.PROJECT_ID) };
6
- mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
7
-
8
- const formatter = new Intl.NumberFormat('ja-JP');
9
-
10
- // tslint:disable-next-line:max-func-body-length
11
- async function main() {
12
- let startTime: [number, number] = process.hrtime();
13
- let diff: [number, number] = process.hrtime(startTime);
14
- let result: any;
15
-
16
- const pendingReservationRepo = await chevre.repository.PendingReservation.createInstance(mongoose.connection);
17
-
18
- startTime = process.hrtime();
19
- result = await pendingReservationRepo.projectFields({
20
- limit: 10,
21
- page: 1,
22
- project: { id: { $eq: project.id } }
23
- // reservationFor: { id: { $eq: 'bma31zpnv' } },
24
- // subReservation: { identifier: { $eq: 'Default:A-1' } },
25
- // reservationNumber: { $eq: '283714519921158' }
26
- });
27
- diff = process.hrtime(startTime);
28
- console.log('result:', result, result.length);
29
- console.log('diff:', [diff[0], formatter.format(diff[1])]);
30
-
31
- startTime = process.hrtime();
32
- result = await pendingReservationRepo.projectSubReservationByReservationNumber({
33
- project: { id: { $eq: project.id } },
34
- reservationNumber: { $eq: '863146502102826' }
35
- });
36
- diff = process.hrtime(startTime);
37
- console.log('result:', result, result.length);
38
- console.log('diff:', [diff[0], formatter.format(diff[1])]);
39
- }
40
-
41
- main()
42
- .then(console.log)
43
- .catch(console.error);
@@ -1,61 +0,0 @@
1
- // tslint:disable:no-console
2
- import mongoose from 'mongoose';
3
-
4
- import { chevre } from '../../../../lib/index';
5
-
6
- const PROJECT_ID = String(process.env.PROJECT_ID);
7
- const SCREEN_CODE = '100';
8
- const MOVIE_THEATER_CODE = '118';
9
-
10
- const formatter = new Intl.NumberFormat('ja-JP');
11
-
12
- // tslint:disable-next-line:max-func-body-length
13
- async function main() {
14
- let startTime: [number, number] = process.hrtime();
15
- let diff: [number, number] = process.hrtime(startTime);
16
-
17
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
18
-
19
- const seatRepo = await chevre.repository.place.Seat.createInstance(mongoose.connection);
20
-
21
- setInterval(
22
- async () => {
23
- startTime = process.hrtime();
24
- const seats = <Pick<chevre.factory.place.seat.IPlace, 'branchCode'>[]>await seatRepo.projectSeatsByScreeningRoom({
25
- limit: 100,
26
- page: 100,
27
- $projection: {
28
- 'containedInPlace.containedInPlace': 0,
29
- 'containedInPlace.typeOf': 0,
30
- 'containedInPlace.name': 0,
31
- typeOf: 0
32
- // additionalProperty: 0
33
- },
34
- project: { id: { $eq: PROJECT_ID } },
35
- screeningRoom: {
36
- branchCode: { $eq: SCREEN_CODE },
37
- containedInPlace: { branchCode: { $eq: MOVIE_THEATER_CODE } }
38
- }
39
- // branchCode: { $in: ['Z-384'] },
40
- // containedInPlace: {
41
- // branchCode: {
42
- // $in: ['Default']
43
- // }
44
- // }
45
- });
46
- diff = process.hrtime(startTime);
47
- // tslint:disable-next-line:no-null-keyword
48
- console.dir(seats, { depth: null });
49
- console.log(seats.length, 'seats found');
50
- console.log('diff:', [diff[0], formatter.format(diff[1])]);
51
- },
52
- // tslint:disable-next-line:no-magic-numbers
53
- 1000
54
- );
55
- }
56
-
57
- main()
58
- .then(() => {
59
- console.log('success!');
60
- })
61
- .catch(console.error);
@@ -1,41 +0,0 @@
1
- // tslint:disable:no-console
2
- import 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
- const excludedTaskNames = [
13
- chevre.factory.taskName.DeleteTransaction,
14
- chevre.factory.taskName.ImportEventCapacitiesFromCOA,
15
- chevre.factory.taskName.ImportEventsFromCOA,
16
- chevre.factory.taskName.AcceptCOAOffer,
17
- chevre.factory.taskName.CheckMovieTicket,
18
- chevre.factory.taskName.AuthorizePayment,
19
- chevre.factory.taskName.PublishPaymentUrl
20
- ];
21
- async function main() {
22
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
23
-
24
- let allTaskNames = Object.values(chevre.factory.taskName);
25
- allTaskNames = allTaskNames.filter((taskName) => !excludedTaskNames.includes(taskName));
26
- console.log('allTaskNames:', allTaskNames, allTaskNames.length);
27
- const taskRepo = await chevre.repository.Task.createInstance(mongoose.connection);
28
-
29
- const result = await taskRepo.countPotentiallyRunning({
30
- name: {
31
- $in: allTaskNames
32
- },
33
- runsAt: { $lt: new Date() },
34
- limit: 100
35
- });
36
- console.log('result:', result);
37
- }
38
-
39
- main()
40
- .then()
41
- .catch(console.error);
@@ -1,51 +0,0 @@
1
- // tslint:disable:no-console
2
- import 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 taskRepo = await chevre.repository.Task.createInstance(mongoose.connection);
16
-
17
- setInterval(
18
- async () => {
19
- const readyTasksCountResult = await taskRepo.count({
20
- limit: 100,
21
- status: { $eq: chevre.factory.taskStatus.Ready },
22
- runsThrough: new Date()
23
- });
24
- console.log('readyTasksCountResult:', readyTasksCountResult);
25
-
26
- const readyTasks = await taskRepo.projectFields(
27
- {
28
- limit: 10,
29
- status: { $eq: chevre.factory.taskStatus.Ready },
30
- runsThrough: new Date(),
31
- name: { $nin: [chevre.factory.taskName.DeleteTransaction] }
32
- },
33
- ['name']
34
- );
35
- console.log('readyTasks:', readyTasks);
36
-
37
- const runningTasksCountResult = await taskRepo.count({
38
- limit: 100,
39
- status: { $eq: chevre.factory.taskStatus.Running },
40
- runsThrough: new Date()
41
- });
42
- console.log('runningTasksCountResult:', runningTasksCountResult);
43
- },
44
- // tslint:disable-next-line:no-magic-numbers
45
- 10000
46
- );
47
- }
48
-
49
- main()
50
- .then()
51
- .catch(console.error);