@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,81 +0,0 @@
1
-
2
- // tslint:disable:no-console no-magic-numbers no-null-keyword
3
- import mongoose from 'mongoose';
4
-
5
- const MONGOLAB_URI = String(process.env.MONGOLAB_URI);
6
-
7
- interface IConnectionByAppName {
8
- connection: mongoose.Connection;
9
- isReady: boolean;
10
- }
11
- const uniqueConnections: Record<string, IConnectionByAppName> = {};
12
- export async function getUniqueConnectionByAppName(params: { appName: string }): Promise<mongoose.Connection> {
13
- const { appName } = params;
14
- if (uniqueConnections[appName] === undefined) {
15
- uniqueConnections[appName] = {
16
- connection: mongoose.createConnection(MONGOLAB_URI, { appName }),
17
- isReady: false
18
- };
19
- uniqueConnections[appName].connection.on('connected', () => console.log('connected'));
20
- uniqueConnections[appName].connection.on('open', () => console.log('open'));
21
- uniqueConnections[appName].connection.on('disconnected', () => console.log('disconnected'));
22
- uniqueConnections[appName].connection.on('reconnected', () => console.log('reconnected'));
23
- uniqueConnections[appName].connection.on('disconnecting', () => console.log('disconnecting'));
24
- uniqueConnections[appName].connection.on('close', () => console.log('close'));
25
- }
26
- const conectionByAppName = uniqueConnections[appName];
27
-
28
- if (!conectionByAppName.isReady) {
29
- console.log('connecting(asPromise)...');
30
- await conectionByAppName.connection.asPromise();
31
- conectionByAppName.isReady = true;
32
- } else {
33
- console.log('is ready.');
34
- }
35
-
36
- return conectionByAppName.connection;
37
- }
38
-
39
- async function main() {
40
- console.log(mongoose.connections.length, 'mongoose.connections found');
41
-
42
- mongoose.connection.on('connected', () => console.log('connected'));
43
- mongoose.connection.on('open', () => console.log('open'));
44
- mongoose.connection.on('disconnected', () => console.log('disconnected'));
45
- mongoose.connection.on('reconnected', () => console.log('reconnected'));
46
- mongoose.connection.on('disconnecting', () => console.log('disconnecting'));
47
- mongoose.connection.on('close', () => console.log('close'));
48
- // await mongoose.connect(MONGOLAB_URI);
49
-
50
- // const firstConnection = mongoose.createConnection(<string>process.env.MONGOLAB_URI);
51
- // firstConnection.on('connected', () => console.log('connected'));
52
- // firstConnection.on('open', () => console.log('open'));
53
- // firstConnection.on('disconnected', () => console.log('disconnected'));
54
- // firstConnection.on('reconnected', () => console.log('reconnected'));
55
- // firstConnection.on('disconnecting', () => console.log('disconnecting'));
56
- // firstConnection.on('close', () => console.log('close'));
57
-
58
- // tslint:disable-next-line:prefer-array-literal
59
- [...Array(10)].map(async (__, i) => {
60
- getUniqueConnectionByAppName({ appName: 'xxx' })
61
- .then(async (connectResult) => {
62
- console.log('connected:', connectResult.id, i);
63
- await getUniqueConnectionByAppName({ appName: 'xxx' });
64
- });
65
- });
66
-
67
- console.log(mongoose.connections.length, 'mongoose.connections found');
68
-
69
- // db.currentOp(true)
70
- // .inprog.forEach((op) => {
71
- // if (op.active = true && op.client != undefined) {
72
- // const miniOp = {
73
- // client: op.client, description: op.desc
74
- // };
75
- // console.log(miniOp);
76
- // }
77
- // });
78
- }
79
-
80
- main()
81
- .catch(console.error);
@@ -1,11 +0,0 @@
1
- // tslint:disable:no-console
2
-
3
- const paymentMethodId = '792943638208219';
4
- const message = `{\"message\":\"bookingNo:\\\"${paymentMethodId}\\\" が見つかりません。\"}`;
5
- console.log(JSON.parse(message));
6
-
7
- const error = { message: `bookingNo:"${paymentMethodId}" が見つかりません。` };
8
- const expectedMessage4surfrockNotFound = JSON.stringify(error);
9
- console.log(expectedMessage4surfrockNotFound);
10
-
11
- console.log(expectedMessage4surfrockNotFound === message);
@@ -1,12 +0,0 @@
1
-
2
- // tslint:disable:no-console no-magic-numbers no-null-keyword
3
- import mongoose from 'mongoose';
4
-
5
- // const MONGOLAB_URI = String(process.env.MONGOLAB_URI);
6
-
7
- async function main() {
8
- console.log(new mongoose.Types.ObjectId());
9
- }
10
-
11
- main()
12
- .catch(console.error);
@@ -1,80 +0,0 @@
1
-
2
- // tslint:disable:no-console no-magic-numbers no-null-keyword
3
- import type * as Redis from 'redis';
4
-
5
- const REDIS_PING_INTERVAL_MS: number = (typeof process.env.REDIS_PING_INTERVAL_MS === 'string')
6
- ? Number(process.env.REDIS_PING_INTERVAL_MS)
7
- // tslint:disable-next-line:no-magic-numbers
8
- : 30000;
9
- const REDIS_HOST: string = String(process.env.REDIS_HOST);
10
- const REDIS_PORT: number = Number(process.env.REDIS_PORT);
11
- const REDIS_KEY: string = String(process.env.REDIS_KEY);
12
-
13
- const redisClientOptions: Redis.RedisClientOptions<Redis.RedisDefaultModules, Record<string, never>, Record<string, never>> = {
14
- socket: {
15
- host: REDIS_HOST,
16
- port: REDIS_PORT
17
- // tls: (process.env.REDIS_TLS_SERVERNAME !== undefined) ? { servername: process.env.REDIS_TLS_SERVERNAME } : undefined
18
- },
19
- password: REDIS_KEY,
20
- pingInterval: REDIS_PING_INTERVAL_MS,
21
- disableOfflineQueue: false
22
- };
23
-
24
- let redis: typeof Redis | undefined;
25
- async function createRedisClient(): Promise<Redis.RedisClientType> {
26
- return new Promise<Redis.RedisClientType>(async (resolve, reject) => {
27
- if (redis === undefined) {
28
- redis = await import('redis');
29
- }
30
-
31
- const client = redis.createClient<Redis.RedisDefaultModules, Record<string, never>, Record<string, never>>(redisClientOptions)
32
- .on('error', (err) => {
33
- // tslint:disable-next-line:no-console
34
- console.error('createRedisClient: client onError:', err);
35
- reject(err);
36
- })
37
- .on('connect', () => {
38
- resolve(client);
39
- });
40
- // client.on('ready', () => {
41
- // console.error('Redis Client ready');
42
- // });
43
-
44
- await client.connect()
45
- .catch((err) => {
46
- // tslint:disable-next-line:no-console
47
- console.error('createRedisClient: redisClient.connect:', err);
48
- reject(new Error('createRedisClient: failed in creating connection'));
49
- });
50
- });
51
- }
52
-
53
- async function main() {
54
- const redisClient = await createRedisClient();
55
- console.log('redisClient created.', redisClient.options?.name);
56
-
57
- const reply = await redisClient.CLIENT_LIST();
58
- // console.dir(reply, { depth: null });
59
- console.dir(
60
- reply.map(
61
- ({ id, name, age, idle, user, addr, flags }) => `${id}, ${name}, ${age}, ${idle}, ${user}, ${addr}, ${flags}`
62
- ),
63
- { depth: null }
64
- );
65
- const connectRedisCount = reply.filter(({ name }) => name.slice(-13) === ':connectRedis')
66
- .length;
67
- const clientsByName: Record<string, any> = {};
68
- reply.forEach(({ name }) => {
69
- if (clientsByName[name] === undefined) {
70
- clientsByName[name] = { count: 0 };
71
- }
72
- clientsByName[name].count += 1;
73
- });
74
- console.log(reply.length, 'clients found');
75
- console.log('connectRedisCount:', connectRedisCount);
76
- console.log(clientsByName);
77
- }
78
-
79
- main()
80
- .catch(console.error);
@@ -1,63 +0,0 @@
1
-
2
- // tslint:disable:no-console no-magic-numbers no-null-keyword
3
- import type * as Redis from 'redis';
4
-
5
- const REDIS_PING_INTERVAL_MS: number = (typeof process.env.REDIS_PING_INTERVAL_MS === 'string')
6
- ? Number(process.env.REDIS_PING_INTERVAL_MS)
7
- // tslint:disable-next-line:no-magic-numbers
8
- : 30000;
9
- const REDIS_HOST: string = String(process.env.REDIS_HOST);
10
- const REDIS_PORT: number = Number(process.env.REDIS_PORT);
11
- const REDIS_KEY: string = String(process.env.REDIS_KEY);
12
-
13
- const redisClientOptions: Redis.RedisClientOptions<Redis.RedisDefaultModules, Record<string, never>, Record<string, never>> = {
14
- socket: {
15
- host: REDIS_HOST,
16
- port: REDIS_PORT
17
- // tls: (process.env.REDIS_TLS_SERVERNAME !== undefined) ? { servername: process.env.REDIS_TLS_SERVERNAME } : undefined
18
- },
19
- password: REDIS_KEY,
20
- pingInterval: REDIS_PING_INTERVAL_MS,
21
- disableOfflineQueue: false
22
- };
23
-
24
- let redis: typeof Redis | undefined;
25
- async function createRedisClient(): Promise<Redis.RedisClientType> {
26
- return new Promise<Redis.RedisClientType>(async (resolve, reject) => {
27
- if (redis === undefined) {
28
- redis = await import('redis');
29
- }
30
-
31
- const client = redis.createClient<Redis.RedisDefaultModules, Record<string, never>, Record<string, never>>(redisClientOptions)
32
- .on('error', (err) => {
33
- // tslint:disable-next-line:no-console
34
- console.error('createRedisClient: client onError:', err);
35
- reject(err);
36
- })
37
- .on('connect', () => {
38
- resolve(client);
39
- });
40
- // client.on('ready', () => {
41
- // console.error('Redis Client ready');
42
- // });
43
-
44
- await client.connect()
45
- .catch((err) => {
46
- // tslint:disable-next-line:no-console
47
- console.error('createRedisClient: redisClient.connect:', err);
48
- reject(new Error('createRedisClient: failed in creating connection'));
49
- });
50
- });
51
- }
52
-
53
- async function main() {
54
- const redisClient = await createRedisClient();
55
- console.log('redisClient created.', redisClient.options?.name);
56
-
57
- const multi = await redisClient.multi();
58
- const results = await multi.exec();
59
- console.log(results);
60
- }
61
-
62
- main()
63
- .catch(console.error);
@@ -1,31 +0,0 @@
1
- // tslint:disable:no-console
2
- const projectIdMustBe = /^[0-9a-z-]+$/; // 記号はhyphenのみ許可
3
-
4
- let projectId: string;
5
-
6
- projectId = 'projectId';
7
- console.log(projectId, ':', projectIdMustBe.test(projectId));
8
-
9
- projectId = 'projectid';
10
- console.log(projectId, ':', projectIdMustBe.test(projectId));
11
-
12
- projectId = 'abcd1234-test';
13
- console.log(projectId, ':', projectIdMustBe.test(projectId));
14
-
15
- projectId = 'a-z';
16
- console.log(projectId, ':', projectIdMustBe.test(projectId));
17
-
18
- projectId = '0-9';
19
- console.log(projectId, ':', projectIdMustBe.test(projectId));
20
-
21
- projectId = '---';
22
- console.log(projectId, ':', projectIdMustBe.test(projectId));
23
-
24
- projectId = '-';
25
- console.log(projectId, ':', projectIdMustBe.test(projectId));
26
-
27
- projectId = '&';
28
- console.log(projectId, ':', projectIdMustBe.test(projectId));
29
-
30
- projectId = 'A';
31
- console.log(projectId, ':', projectIdMustBe.test(projectId));
@@ -1,50 +0,0 @@
1
- // tslint:disable:no-console
2
- import * as jwt from 'jsonwebtoken';
3
-
4
- async function main(): Promise<void> {
5
- const payload = {
6
- /**
7
- * アプリケーションオファーコード
8
- */
9
- identifier: 'LegacyReservation',
10
- validFrom: '2025-10-20T00:00:00Z',
11
- validThrough: '2025-10-25T00:00:00Z',
12
- eligibleQuantity: { maxValue: 1 },
13
- itemOffered: {
14
- /**
15
- * イベント識別子
16
- */
17
- identifier: '251025001001010900'
18
- }
19
- };
20
-
21
- const token = await new Promise<string>((resolve, reject) => {
22
- // 所有権を暗号化する
23
- jwt.sign(
24
- payload,
25
- '12345qwert',
26
- {
27
- // algorithm: jwtSetting.algorithm,
28
- issuer: 'https://example.com',
29
- expiresIn: 1800
30
- // subject,
31
- },
32
- (err, encoded) => {
33
- if (err instanceof Error) {
34
- reject(err);
35
- } else {
36
- if (typeof encoded !== 'string') {
37
- reject(new Error('cannot be signed unexpectedly'));
38
- } else {
39
- resolve(encoded);
40
- }
41
- }
42
- }
43
- );
44
- });
45
- console.log(token);
46
- }
47
-
48
- main()
49
- .then(console.log)
50
- .catch(console.error);
@@ -1,44 +0,0 @@
1
- import * as jwt from 'jsonwebtoken';
2
- async function verifyMembershipToken(params: {
3
- token?: string;
4
- secret: string;
5
- }): Promise<any> {
6
- let result: any;
7
- const { secret, token } = params;
8
-
9
- if (typeof token === 'string' && token.length > 0) {
10
- try {
11
- result = await new Promise<any>((resolve, reject) => {
12
- jwt.verify(
13
- token,
14
- secret,
15
- {
16
- // issuer: credentials.jwt.issuer,
17
- // ...(Array.isArray(params.audience)) ? { audience: params.audience } : undefined
18
- },
19
- (err, decoded: any) => {
20
- if (err instanceof Error) {
21
- reject(err);
22
- } else {
23
- resolve(decoded);
24
- }
25
- });
26
- });
27
- } catch (error) {
28
- throw error;
29
- }
30
- } else {
31
- throw new Error('Membership token');
32
- }
33
-
34
- return result;
35
- }
36
-
37
- verifyMembershipToken({
38
- token: 'xxx',
39
- secret: 'xxx'
40
- })
41
- // tslint:disable-next-line:no-console
42
- .then(console.log)
43
- // tslint:disable-next-line:no-console
44
- .catch(console.error);
@@ -1,2 +0,0 @@
1
- export declare const INDEX_EVENT = "index";
2
- export declare function onIndexCreated(error: any): void;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.INDEX_EVENT = void 0;
4
- exports.onIndexCreated = onIndexCreated;
5
- exports.INDEX_EVENT = 'index';
6
- function onIndexCreated(error) {
7
- if (error !== undefined) {
8
- console.error('index event emitted.', error);
9
- }
10
- }
@@ -1,35 +0,0 @@
1
- import * as factory from '../factory';
2
- import type { ICallableTaskOperation, ICallResult, IOperationExecute } from '../service/taskHandler';
3
- interface IOnOrderStatusChanged {
4
- informOrder2hub?: factory.project.IInformParams[];
5
- }
6
- interface IOnReservationStatusChanged {
7
- informReservation2hub?: factory.project.IInformParams[];
8
- }
9
- interface IOnTaskStatusChanged {
10
- informTask2hub?: factory.project.IInformParams[];
11
- }
12
- interface ICallableTask {
13
- aggregateOnSystem?: ICallableTaskOperation;
14
- handleNotification?: ICallableTaskOperation;
15
- }
16
- interface IOptions {
17
- /**
18
- * タスク実行処理の実装
19
- */
20
- callableTask?: ICallableTask;
21
- onOrderStatusChanged: IOnOrderStatusChanged;
22
- onReservationStatusChanged: IOnReservationStatusChanged;
23
- onTaskStatusChanged: IOnTaskStatusChanged;
24
- }
25
- /**
26
- * aggregation domain settings
27
- */
28
- declare class AggregationSettings {
29
- readonly callableTask?: ICallableTask;
30
- readonly onOrderStatusChanged: IOnOrderStatusChanged;
31
- readonly onReservationStatusChanged: IOnReservationStatusChanged;
32
- readonly onTaskStatusChanged: IOnTaskStatusChanged;
33
- constructor(options: IOptions);
34
- }
35
- export { ICallableTaskOperation, ICallResult, IOperationExecute, AggregationSettings };