@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
@@ -0,0 +1,58 @@
1
+ import type { SendGridCredentials } from './credentials/sendGrid';
2
+ import type { IExecuteSettings as IMinimumExecuteSettings } from './eventEmitter/task';
3
+ import * as factory from './factory';
4
+ import type { Settings } from './settings';
5
+ interface IOnOrderStatusChanged {
6
+ informOrder2hub?: factory.project.IInformParams[];
7
+ }
8
+ interface IOnReservationStatusChanged {
9
+ informReservation2hub?: factory.project.IInformParams[];
10
+ }
11
+ interface IOnTaskStatusChanged {
12
+ informTask2hub?: factory.project.IInformParams[];
13
+ }
14
+ interface ICallableTask {
15
+ aggregateOnSystem?: ICallableTaskOperation;
16
+ handleNotification?: ICallableTaskOperation;
17
+ }
18
+ interface IOptions {
19
+ /**
20
+ * タスク実行処理の実装
21
+ */
22
+ callableTask?: ICallableTask;
23
+ onOrderStatusChanged: IOnOrderStatusChanged;
24
+ onReservationStatusChanged: IOnReservationStatusChanged;
25
+ onTaskStatusChanged: IOnTaskStatusChanged;
26
+ }
27
+ /**
28
+ * aggregation domain settings
29
+ */
30
+ declare class AggregationSettings {
31
+ readonly callableTask?: ICallableTask;
32
+ readonly onOrderStatusChanged: IOnOrderStatusChanged;
33
+ readonly onReservationStatusChanged: IOnReservationStatusChanged;
34
+ readonly onTaskStatusChanged: IOnTaskStatusChanged;
35
+ constructor(options: IOptions);
36
+ }
37
+ interface ICredentialSettings {
38
+ sendGrid: SendGridCredentials;
39
+ }
40
+ interface IExecuteSettings extends IMinimumExecuteSettings {
41
+ credentials: ICredentialSettings;
42
+ settings: Settings;
43
+ aggregationSettings?: AggregationSettings;
44
+ }
45
+ interface IExecuteOptions {
46
+ executeById: boolean;
47
+ executeByName: boolean;
48
+ }
49
+ type IOperation<T> = (settings: IExecuteSettings) => Promise<T>;
50
+ type IOperationExecute<T> = (settings: IExecuteSettings, options: IExecuteOptions) => Promise<T>;
51
+ type ICallResult = void | Pick<factory.task.IExecutionResult, 'error'>;
52
+ type ICallableTaskOperationSimple = (taskData: factory.task.IData<factory.taskName>) => IOperation<void>;
53
+ type ICallableTaskOperation = (task: IExecutableTask<factory.taskName>) => IOperationExecute<ICallResult>;
54
+ type IExecutableTaskKeys = 'data' | 'id' | 'name' | 'status' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt' | 'expires';
55
+ type IExecutableTask<T extends factory.taskName> = Pick<factory.task.ITask<T>, IExecutableTaskKeys> & {
56
+ status: factory.taskStatus.Running;
57
+ };
58
+ export { ICallableTaskOperation, ICallableTaskOperationSimple, ICallResult, IExecutableTask, IExecutableTaskKeys, IExecuteSettings, IExecuteOptions, IOperationExecute, AggregationSettings };
package/package.json CHANGED
@@ -15,6 +15,7 @@
15
15
  "@cinerino/sdk": "13.0.0",
16
16
  "@motionpicture/coa-service": "9.6.0",
17
17
  "@motionpicture/gmo-service": "5.4.0-alpha.1",
18
+ "@rollup/rollup-linux-x64-gnu": "^4.57.1",
18
19
  "@sendgrid/client": "8.1.4",
19
20
  "@surfrock/sdk": "1.4.0-alpha.1",
20
21
  "debug": "^3.2.7",
@@ -34,6 +35,7 @@
34
35
  "@eslint/js": "10.0.1",
35
36
  "@json2csv/plainjs": "7.0.6",
36
37
  "@sendgrid/helpers": "8.0.0",
38
+ "@size-limit/preset-big-lib": "12.0.0",
37
39
  "@types/debug": "0.0.30",
38
40
  "@types/google-libphonenumber": "^7.4.19",
39
41
  "@types/http-status": "^0.2.30",
@@ -52,6 +54,7 @@
52
54
  "@vitest/coverage-v8": "4.0.18",
53
55
  "coveralls": "^3.1.0",
54
56
  "csvtojson": "^2.0.10",
57
+ "dependency-cruiser": "17.3.8",
55
58
  "eslint": "9.39.2",
56
59
  "googleapis": "^85.0.0",
57
60
  "jose": "6.0.12",
@@ -64,6 +67,7 @@
64
67
  "rimraf": "^2.7.1",
65
68
  "sinon": "4.5.0",
66
69
  "sinon-mongoose": "^2.3.0",
70
+ "size-limit": "12.0.0",
67
71
  "ts-node": "^10.9.1",
68
72
  "typescript": "5.6.3",
69
73
  "typescript-eslint": "8.55.0",
@@ -82,16 +86,8 @@
82
86
  "main": "./lib/index.js",
83
87
  "types": "./lib/index.d.ts",
84
88
  "files": [
85
- "doc",
86
- "example",
87
89
  "lib"
88
90
  ],
89
- "directories": {
90
- "doc": "./doc",
91
- "lib": "./lib",
92
- "example": "./example",
93
- "test": "./test"
94
- },
95
91
  "name": "@chevre/domain",
96
92
  "repository": {
97
93
  "type": "git",
@@ -101,18 +97,20 @@
101
97
  "build": "tsc",
102
98
  "build:example": "tsc --watch --project tsconfig.example.json --declaration false",
103
99
  "clean": "rimraf ./lib \"npm-debug.log*\" ./doc ./coverage ./.nyc_output ./example/dst",
100
+ "depcruise": "depcruise src",
104
101
  "doc": "echo \"implementing...\" && exit 0",
105
- "eslint": "eslint src/**/*.ts",
102
+ "eslint": "eslint \"src/**/*.ts\"",
106
103
  "mocha": "mocha",
107
104
  "nyc": "nyc mocha \"src/**/*.spec.ts\"",
108
- "coverage": "npm run nyc && nyc report --reporter=text-lcov | coveralls",
109
- "coverage:vitest": "vitest run --coverage",
110
- "test": "npm run eslint && npm run coverage",
111
- "test:vitest": "vitest",
112
- "preversion": "npm run clean && npm run build && npm test && npm run doc",
105
+ "coverage:nyc": "npm run nyc && nyc report --reporter=text-lcov | coveralls",
106
+ "coverage": "vitest run --coverage",
107
+ "test": "npm run eslint && npm run coverage && npm run coverage:nyc",
108
+ "preversion": "npm run clean && npm run build && npm run depcruise && npm run size && npm test && npm run doc",
109
+ "size": "size-limit",
113
110
  "version": "git add -A",
111
+ "vitest": "vitest",
114
112
  "postversion": "git push origin --tags",
115
- "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
113
+ "prepublishOnly": "npm run clean && npm run build && npm run depcruise && npm run size && npm test && npm run doc"
116
114
  },
117
- "version": "23.2.0"
115
+ "version": "24.0.0-alpha.0"
118
116
  }
@@ -1,76 +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 project = { id: String(process.env.PROJECT_ID) };
8
-
9
- async function main() {
10
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
11
-
12
- const acceptedPaymentMethodRepo = await chevre.repository.AcceptedPaymentMethod.createInstance(mongoose.connection);
13
-
14
- const validFrom = moment()
15
- .toDate();
16
- const validThrough = moment(validFrom)
17
- .add(1, 'hour')
18
- .toDate();
19
- const settingOffer: Pick<chevre.factory.acceptedPaymentMethodOffer.IAcceptedPaymentMethodOffer, 'acceptedPaymentMethod' | 'identifier' | 'validFrom' | 'validThrough'> = {
20
- identifier: '20260206acceptedPaymentMethod',
21
- acceptedPaymentMethod: {
22
- id: '5f9a52994f3709000abe6417',
23
- typeOf: chevre.factory.service.paymentService.PaymentServiceType.MovieTicket
24
- },
25
- validFrom,
26
- validThrough
27
- };
28
-
29
- let result = await acceptedPaymentMethodRepo.addAcceptedPaymentMethodsByIdentifier(
30
- [
31
- {
32
- $set: settingOffer,
33
- $unset: {}
34
- }
35
- ],
36
- {
37
- upsert: false,
38
- itemOffered: {
39
- id: '7k9ayl8hc',
40
- typeOf: chevre.factory.eventType.ScreeningEventSeries
41
- },
42
- seller: {
43
- id: '59d20831e53ebc2b4e774466',
44
- typeOf: chevre.factory.organizationType.Corporation
45
- },
46
- project: { id: project.id, typeOf: chevre.factory.organizationType.Project }
47
- }
48
- );
49
- console.log(result);
50
-
51
- result = await acceptedPaymentMethodRepo.addAcceptedPaymentMethodsByIdentifier(
52
- [
53
- {
54
- $set: settingOffer,
55
- $unset: {}
56
- }
57
- ],
58
- {
59
- upsert: true,
60
- itemOffered: {
61
- id: '7k9ayl8hc',
62
- typeOf: chevre.factory.eventType.ScreeningEventSeries
63
- },
64
- seller: {
65
- id: '59d20831e53ebc2b4e774466',
66
- typeOf: chevre.factory.organizationType.Corporation
67
- },
68
- project: { id: project.id, typeOf: chevre.factory.organizationType.Project }
69
- }
70
- );
71
- console.log(result);
72
- }
73
-
74
- main()
75
- .then()
76
- .catch(console.error);
@@ -1,60 +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
- // tslint:disable-next-line:max-func-body-length
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
-
13
- const cursor = actionRepo.getCursor(
14
- {
15
- typeOf: { $eq: chevre.factory.actionType.AcceptAction },
16
- 'object.typeOf': { $exists: true, $eq: chevre.factory.assetTransactionType.Pay },
17
- startDate: {
18
- $gte: moment()
19
- // tslint:disable-next-line:no-magic-numbers
20
- .add(-3, 'days')
21
- .toDate()
22
- }
23
- },
24
- {
25
- }
26
- );
27
- console.log('docs found');
28
-
29
- let i = 0;
30
- let ticketTokenCount = 0;
31
- await cursor.eachAsync(async (doc) => {
32
- i += 1;
33
- const acceptAction = <chevre.factory.action.accept.pay.IAction>doc.toObject();
34
-
35
- const ticketTokenByInstrument = acceptAction.instrument?.find((instrument) => instrument.typeOf === 'Ticket')?.ticketToken;
36
- if (typeof ticketTokenByInstrument === 'string' && ticketTokenByInstrument !== '') {
37
- console.log(
38
- ticketTokenByInstrument,
39
- ' ticket token exists.',
40
- acceptAction.project.id, acceptAction.typeOf, acceptAction.object.typeOf,
41
- acceptAction.startDate, acceptAction.identifier, i
42
- );
43
- ticketTokenCount += 1;
44
- } else {
45
- console.log(
46
- ticketTokenByInstrument,
47
- ' ticket token does not exists.',
48
- acceptAction.project.id, acceptAction.typeOf, acceptAction.object.typeOf,
49
- acceptAction.startDate, acceptAction.identifier, i
50
- );
51
- }
52
- });
53
-
54
- console.log(i, 'docs checked');
55
- console.log(ticketTokenCount, 'ticketToken exist');
56
- }
57
-
58
- main()
59
- .then()
60
- .catch(console.error);
@@ -1,55 +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
- // tslint:disable-next-line:max-func-body-length
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
-
13
- const cursor = actionRepo.getCursor(
14
- {
15
- typeOf: { $eq: chevre.factory.actionType.AuthorizeAction },
16
- 'object.typeOf': { $exists: true, $eq: chevre.factory.action.authorize.paymentMethod.any.ResultType.Payment },
17
- startDate: {
18
- $gte: moment()
19
- // tslint:disable-next-line:no-magic-numbers
20
- .add(-7, 'days')
21
- .toDate()
22
- }
23
- },
24
- {
25
- }
26
- );
27
- console.log('docs found');
28
-
29
- let i = 0;
30
- let expectdCount = 0;
31
- await cursor.eachAsync(async (doc) => {
32
- i += 1;
33
- const authorizeAction = <chevre.factory.action.authorize.paymentMethod.any.IAction>doc.toObject();
34
-
35
- const isExpected = authorizeAction.object.paymentMethodId === authorizeAction.instrument.transactionNumber;
36
- if (isExpected) {
37
- console.log(
38
- authorizeAction.object.paymentMethodId,
39
- ' expected.',
40
- authorizeAction.project.id, authorizeAction.typeOf, authorizeAction.object.typeOf,
41
- authorizeAction.startDate, authorizeAction.identifier, i
42
- );
43
- expectdCount += 1;
44
- } else {
45
- throw new Error(`not expected ${authorizeAction.object.paymentMethodId} ${authorizeAction.instrument.transactionNumber} ${authorizeAction.project.id}`);
46
- }
47
- });
48
-
49
- console.log(i, 'docs checked');
50
- console.log(expectdCount, 'expectd');
51
- }
52
-
53
- main()
54
- .then()
55
- .catch(console.error);
@@ -1,19 +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 projectRepo = await chevre.repository.Project.createInstance(mongoose.connection);
12
-
13
- await projectRepo.activateOptionalAggregationSettings({ id: PROJECT_ID });
14
- console.log('activated.');
15
- }
16
-
17
- main()
18
- .then(console.log)
19
- .catch(console.error);
@@ -1,71 +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 IDENTIFIER = 'sampleidentity20250528';
8
-
9
- async function main() {
10
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
11
-
12
- const identityRepo = await chevre.repository.Identity.createInstance(mongoose.connection);
13
-
14
- let docs = await identityRepo.projectIdentityFields(
15
- {
16
- project: { id: { $eq: project.id } },
17
- about: { id: { $eq: IDENTIFIER } }
18
- },
19
- ['about', 'typeOf', 'issuedBy', 'project']
20
- );
21
- console.log('docs:', docs);
22
- console.log(docs.length, 'docs found');
23
-
24
- if (docs.length > 0) {
25
- await identityRepo.deleteIdentityById({
26
- project: { id: docs[0].project.id },
27
- id: docs[0].id
28
- });
29
- console.log('deleted', docs[0].id);
30
- }
31
-
32
- await identityRepo.projectIdentityFields(
33
- {
34
- project: { id: { $eq: project.id } },
35
- about: { id: { $eq: IDENTIFIER } }
36
- },
37
- ['about', 'typeOf', 'issuedBy', 'project']
38
- );
39
- console.log('docs:', docs);
40
- console.log(docs.length, 'docs found');
41
-
42
- await identityRepo.saveIdentity({
43
- attributes: {
44
- project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
45
- typeOf: chevre.factory.creativeWorkType.Certification,
46
- about: {
47
- id: IDENTIFIER,
48
- typeOf: chevre.factory.creativeWorkType.WebApplication
49
- },
50
- issuedBy: [{
51
- identifier: 'https://example.com',
52
- typeOf: chevre.factory.organizationType.Organization
53
- }]
54
- }
55
- });
56
- console.log('created.');
57
-
58
- docs = await await identityRepo.projectIdentityFields(
59
- {
60
- project: { id: { $eq: project.id } },
61
- about: { id: { $eq: IDENTIFIER } }
62
- },
63
- ['about', 'typeOf', 'issuedBy', 'project']
64
- );
65
- console.log('docs:', docs);
66
- console.log(docs.length, 'docs found');
67
- }
68
-
69
- main()
70
- .then()
71
- .catch(console.error);
@@ -1,24 +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);
10
-
11
- const acceptedOfferRepo = await chevre.repository.AcceptedOffer.createInstance(mongoose.connection);
12
-
13
- const ownershipInfos = await acceptedOfferRepo.aggreateOwnershipInfosByOrder(
14
- {
15
- orderNumber: { $eq: 'CIN4-3943271-4221863' }
16
- }
17
- );
18
- // tslint:disable-next-line:no-null-keyword
19
- console.dir(ownershipInfos, { depth: 1 });
20
- }
21
-
22
- main()
23
- .then()
24
- .catch(console.error);
@@ -1,47 +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 project = { id: String(process.env.PROJECT_ID) };
8
-
9
- async function main() {
10
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
11
-
12
- const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
13
- const result = await eventRepo.aggregatePublicFields(
14
- {
15
- limit: 10,
16
- page: 1,
17
- sort: { startDate: chevre.factory.sortType.Ascending },
18
- // id: { $eq: 'bm0f0cadu' },
19
- typeOf: chevre.factory.eventType.ScreeningEvent,
20
- project: { id: { $eq: project.id } },
21
- startFrom: new Date(),
22
- startThrough: moment()
23
- // tslint:disable-next-line:no-magic-numbers
24
- .add(3, 'days')
25
- .toDate()
26
- // availableAtOrFrom: { id: { $eq: '3eo6okferrsdpfd9j2ce1iv9k7' } },
27
- // itemOffered: {
28
- // serviceOutput: { reservationFor: { id: { $in: ['bm0f0cadu', 'blco2394l'] } } }
29
- // }
30
- },
31
- ['eventStatus', 'startDate'],
32
- {
33
- includeOffers: true,
34
- includeSellerMakesOffer: false,
35
- // includeOffers: false,
36
- sellerMakesOfferAvailableAtIn: ['51qbjcfr72h62m06vtv5kkhgje', 'g']
37
- }
38
- );
39
- // tslint:disable-next-line:no-null-keyword
40
- console.dir(result, { depth: null });
41
- console.log(result.length, 'results found');
42
- console.log(result.at(0)?.offers?.seller?.makesOffer?.length, 'makesOffer found');
43
- }
44
-
45
- main()
46
- .then(console.log)
47
- .catch(console.error);
@@ -1,36 +0,0 @@
1
- // tslint:disable:no-console
2
- /**
3
- * イベント集計タスク実行
4
- */
5
- import { chevre } from '../../../lib/index';
6
-
7
- import mongoose from 'mongoose';
8
-
9
- export async function main() {
10
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
11
-
12
- const offerCatalogRepo = await chevre.repository.OfferCatalog.createInstance(mongoose.connection);
13
- const offerCatalogItemRepo = await chevre.repository.OfferCatalogItem.createInstance(mongoose.connection);
14
-
15
- const result = await offerCatalogRepo.aggregateItemList({ itemListElement: { typeOf: { $eq: chevre.factory.offerType.Offer } } });
16
- // tslint:disable-next-line:no-null-keyword
17
- console.dir(result, { depth: null });
18
-
19
- const result2 = await offerCatalogRepo.aggregateItemList({ itemListElement: { typeOf: { $eq: 'OfferCatalog' } } });
20
- // tslint:disable-next-line:no-null-keyword
21
- console.dir(result2, { depth: null });
22
-
23
- const result3 = await offerCatalogItemRepo.aggregateItemList({ itemListElement: { typeOf: { $eq: chevre.factory.offerType.Offer } } });
24
- // tslint:disable-next-line:no-null-keyword
25
- console.dir(result3, { depth: null });
26
-
27
- const result4 = await offerCatalogItemRepo.aggregateItemList({ itemListElement: { typeOf: { $eq: 'OfferCatalog' } } });
28
- // tslint:disable-next-line:no-null-keyword
29
- console.dir(result4, { depth: null });
30
- }
31
-
32
- main()
33
- .then(() => {
34
- console.log('success!');
35
- })
36
- .catch(console.error);
@@ -1,36 +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 eventSeriesRepo = await chevre.repository.EventSeries.createInstance(mongoose.connection);
12
- const result = await eventSeriesRepo.aggregateMaxVersion(
13
- {
14
- project: {
15
- id: { $eq: project.id }
16
- },
17
- workPerformed: {
18
- identifier: {
19
- $eq: '00001'
20
- }
21
- },
22
- location: {
23
- branchCode: {
24
- $in: ['118']
25
- }
26
- }
27
- }
28
- );
29
- // tslint:disable-next-line:no-null-keyword
30
- console.dir(result, { depth: null });
31
- console.log(result);
32
- }
33
-
34
- main()
35
- .then(console.log)
36
- .catch(console.error);
@@ -1,86 +0,0 @@
1
- // tslint:disable:no-console
2
- import mongoose from 'mongoose';
3
- // import * as redis from 'redis';
4
-
5
- import { chevre } from '../../../../lib/index';
6
-
7
- const project = { id: <string>process.env.PROJECT_ID };
8
- // const EVENT_ID = String(process.env.EVENT_ID);
9
-
10
- // tslint:disable-next-line:max-func-body-length
11
- async function main() {
12
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
13
- // const client = redis.createClient<redis.RedisDefaultModules, Record<string, never>, Record<string, never>>({
14
- // socket: {
15
- // port: Number(<string>process.env.REDIS_PORT),
16
- // host: <string>process.env.REDIS_HOST
17
- // },
18
- // password: <string>process.env.REDIS_KEY
19
- // });
20
- // await client.connect();
21
-
22
- const aggregateReservationRepo = await chevre.repository.AggregateReservation.createInstance(mongoose.connection);
23
- const aggregateReservations = await aggregateReservationRepo.searchWithReservationForId(
24
- {
25
- limit: 10,
26
- page: 1,
27
- project: { id: { $eq: project.id } },
28
- reservationFor: {
29
- id: {
30
- $in: [
31
- 'blvcj2vfl', 'blvcj2w48',
32
- 'blvcj2wqj', 'blvcj2y1n',
33
- 'blvcj2ylh', 'blvcj2z7k',
34
- 'blvcj2zqz', 'blvcj30d3',
35
- 'blvcj30wo', 'blvcj32as'
36
- ]
37
- },
38
- typeOf: chevre.factory.eventType.ScreeningEvent
39
- },
40
- sort: { 'reservationFor.startDate': 1 }
41
- },
42
- ['aggregateOffer']
43
- );
44
- console.log('aggregateReservations:', aggregateReservations);
45
- console.log('aggregateReservations:', aggregateReservations.map(({ id }) => id));
46
-
47
- // await (await chevre.service.aggregation.createService()).event.aggregateOffers({
48
- // id: EVENT_ID,
49
- // typeOf: chevre.factory.eventType.ScreeningEvent
50
- // })({
51
- // aggregateReservation: aggregateReservationRepo,
52
- // event: await chevre.repository.Event.createInstance(mongoose.connection),
53
- // stockHolder: await chevre.repository.StockHolder.createInstance(client, mongoose.connection),
54
- // offer: await chevre.repository.Offer.createInstance(mongoose.connection),
55
- // offerCatalog: await chevre.repository.OfferCatalog.createInstance(mongoose.connection),
56
- // offerRateLimit: await chevre.repository.rateLimit.Offer.createInstance(client),
57
- // screeningRoom: await chevre.repository.place.ScreeningRoom.createInstance(mongoose.connection),
58
- // product: await chevre.repository.Product.createInstance(mongoose.connection),
59
- // reservation: await chevre.repository.Reservation.createInstance(mongoose.connection)
60
- // });
61
- // console.log('aggregateReserveAction processed.');
62
-
63
- // aggregateReservations = await aggregateReservationRepo.searchWithReservationForId(
64
- // {
65
- // limit: 1,
66
- // page: 1,
67
- // sort: { 'reservationFor.startDate': 1 },
68
- // project: { id: { $eq: project.id } },
69
- // reservationFor: {
70
- // id: {
71
- // $eq: EVENT_ID,
72
- // $in: [EVENT_ID]
73
- // },
74
- // typeOf: chevre.factory.eventType.ScreeningEvent
75
- // }
76
- // },
77
- // []
78
- // );
79
- // console.log('aggregateReservations:', aggregateReservations);
80
- }
81
-
82
- main()
83
- .then(() => {
84
- console.log('success!');
85
- })
86
- .catch(console.error);