@chevre/domain 26.0.0-alpha.25 → 26.0.0-alpha.27

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 (43) hide show
  1. package/lib/chevre/repo/adminAssetTransaction.d.ts +132 -0
  2. package/lib/chevre/repo/adminAssetTransaction.js +504 -0
  3. package/lib/chevre/repo/adminTransaction.d.ts +131 -0
  4. package/lib/chevre/repo/adminTransaction.js +237 -0
  5. package/lib/chevre/repo/aggregateAssetTransaction.d.ts +43 -0
  6. package/lib/chevre/repo/aggregateAssetTransaction.js +166 -0
  7. package/lib/chevre/repo/aggregateTransaction.d.ts +39 -0
  8. package/lib/chevre/repo/aggregateTransaction.js +166 -0
  9. package/lib/chevre/repo/assetTransaction.d.ts +10 -235
  10. package/lib/chevre/repo/assetTransaction.js +48 -636
  11. package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +8 -9
  12. package/lib/chevre/repo/mongoose/schemas/event.js +7 -0
  13. package/lib/chevre/repo/mongoose/schemas/eventOffer.js +7 -0
  14. package/lib/chevre/repo/mongoose/schemas/pendingReservation.js +11 -4
  15. package/lib/chevre/repo/transaction.d.ts +1 -187
  16. package/lib/chevre/repo/transaction.js +2 -383
  17. package/lib/chevre/repository.d.ts +20 -5
  18. package/lib/chevre/repository.js +46 -13
  19. package/lib/chevre/service/aggregation/system.d.ts +7 -7
  20. package/lib/chevre/service/aggregation/system.js +4 -4
  21. package/lib/chevre/service/assetTransaction/cancelReservation/start.js +10 -17
  22. package/lib/chevre/service/assetTransaction/refund.js +2 -2
  23. package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.js +1 -3
  24. package/lib/chevre/service/order/onAssetTransactionStatusChanged/isDeliverable.js +1 -49
  25. package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.js +2 -2
  26. package/lib/chevre/service/payment/any/processVoidPayTransaction.js +1 -1
  27. package/lib/chevre/service/reserve/cancelReservation.js +3 -3
  28. package/lib/chevre/service/reserve/checkInReservation.js +2 -2
  29. package/lib/chevre/service/reserve/confirmReservation.js +1 -1
  30. package/lib/chevre/service/reserve/useReservation.js +1 -1
  31. package/lib/chevre/service/task/deleteTransaction.js +2 -4
  32. package/lib/chevre/service/task/returnPayTransaction.js +2 -2
  33. package/lib/chevre/service/transaction/deleteTransaction/deletePayTransactionsByPlaceOrder.js +2 -2
  34. package/lib/chevre/service/transaction/deleteTransaction/deleteReservationsByPlaceOrder.js +2 -2
  35. package/lib/chevre/service/transaction/deleteTransaction.d.ts +2 -2
  36. package/lib/chevre/service/transaction/deleteTransaction.js +2 -2
  37. package/lib/chevre/service/transaction/placeOrder/confirm.js +1 -1
  38. package/lib/chevre/service/validation/validateOrder.js +2 -2
  39. package/package.json +2 -2
  40. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +0 -13
  41. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +0 -82
  42. package/lib/chevre/repo/ownershipInfo.d.ts +0 -20
  43. package/lib/chevre/repo/ownershipInfo.js +0 -130
@@ -38,18 +38,17 @@ const schemaOptions = {
38
38
  }
39
39
  };
40
40
  const indexes = [
41
- // [ // discontinue(2024-08-07~)
42
- // { createdAt: 1 },
43
- // { name: 'searchByCreatedAt' }
44
- // ],
45
- // [
46
- // { updatedAt: 1 },
47
- // { name: 'searchByUpdatedAt' }
48
- // ],
49
41
  [
50
42
  { 'reservationFor.startDate': 1 },
51
- { name: 'searchByReservationForStartDate' }
43
+ {
44
+ name: 'ttlByReservationForStartDate', // support ttl index(2026-08-11~)
45
+ expireAfterSeconds: 16416000 // 190 days
46
+ }
52
47
  ],
48
+ // [
49
+ // { 'reservationFor.startDate': 1 },
50
+ // { name: 'searchByReservationForStartDate' }
51
+ // ],
53
52
  [
54
53
  { 'project.id': 1, 'reservationFor.startDate': 1 },
55
54
  { name: 'searchByProjectId' }
@@ -77,6 +77,13 @@ const schemaOptions = {
77
77
  }
78
78
  };
79
79
  const indexes = [
80
+ [
81
+ { endDate: 1 },
82
+ {
83
+ name: 'ttlByEndDate', // support ttl index(2026-08-11~)
84
+ expireAfterSeconds: 16416000 // 190 days
85
+ }
86
+ ],
80
87
  [
81
88
  { 'project.id': 1, startDate: 1 },
82
89
  {
@@ -44,6 +44,13 @@ const schemaOptions = {
44
44
  }
45
45
  };
46
46
  const indexes = [
47
+ [
48
+ { validThrough: 1 },
49
+ {
50
+ name: 'ttlByValidThrough', // support ttl index(2026-08-11~)
51
+ expireAfterSeconds: 0 // 0 days
52
+ }
53
+ ],
47
54
  [
48
55
  { validFrom: 1 },
49
56
  { name: 'validFrom' }
@@ -45,6 +45,13 @@ const schemaOptions = {
45
45
  }
46
46
  };
47
47
  const indexes = [
48
+ [
49
+ { expires: 1 },
50
+ {
51
+ name: 'ttlByExpires', // support ttl index(2026-08-11~)
52
+ expireAfterSeconds: 0 // 0 days
53
+ }
54
+ ],
48
55
  [
49
56
  { bookingTime: -1 },
50
57
  { name: 'bookingTime' }
@@ -113,10 +120,10 @@ const indexes = [
113
120
  }
114
121
  }
115
122
  ],
116
- [
117
- { expires: 1 },
118
- { name: 'deleteExpiredMany' }
119
- ]
123
+ // [
124
+ // { expires: 1 },
125
+ // { name: 'deleteExpiredMany' }
126
+ // ]
120
127
  ];
121
128
  exports.indexes = indexes;
122
129
  /**
@@ -1,37 +1,11 @@
1
- import type { Connection, UpdateQuery } from 'mongoose';
1
+ import type { Connection } from 'mongoose';
2
2
  import { factory } from '../factory';
3
- import { IDocType } from './mongoose/schemas/transaction';
4
- interface IAggregationByStatus {
5
- transactionCount: number;
6
- avgDuration: number;
7
- maxDuration: number;
8
- minDuration: number;
9
- percentilesDuration: {
10
- name: string;
11
- value: number;
12
- }[];
13
- }
14
- interface IStatus {
15
- status: factory.transactionStatusType;
16
- aggregation: IAggregationByStatus;
17
- }
18
- export interface IAggregatePlaceOrder {
19
- statuses: IStatus[];
20
- }
21
3
  /**
22
4
  * 取引リポジトリ
23
5
  */
24
6
  export declare class TransactionRepo {
25
7
  private readonly transactionModel;
26
8
  constructor(connection: Connection);
27
- countPotentiallyExportTasks(params: {
28
- endDate: {
29
- $lt: Date;
30
- };
31
- limit?: number;
32
- }): Promise<{
33
- count: number;
34
- }>;
35
9
  /**
36
10
  * タスク未エクスポートの取引をひとつ取得してエクスポートを開始する
37
11
  */
@@ -53,27 +27,6 @@ export declare class TransactionRepo {
53
27
  startDate?: factory.sortType;
54
28
  };
55
29
  }): Promise<Pick<factory.transaction.ITransaction<factory.transactionType>, 'id' | 'typeOf'> | null>;
56
- /**
57
- * tasksExportAction.actionStatusがActiveActionStatusのまま一定時間経過した取引について
58
- * PotentialActionStatusに変更する
59
- * 2025-03-10~
60
- */
61
- reExportAction(params: {
62
- startDate: {
63
- $lt: Date;
64
- };
65
- }): Promise<import("mongoose").UpdateWriteOpResult>;
66
- /**
67
- * タスクエクスポートの遅延している取引について明示的にemitTransactionStatusChangedを実行する
68
- */
69
- exportTasksMany(params: {
70
- now: Date;
71
- delayInSeconds: number;
72
- status: {
73
- $in: factory.transactionStatusType[];
74
- };
75
- limit: number;
76
- }): Promise<Pick<import("@chevre/factory/lib/chevre/transaction/placeOrder").ITransaction | import("@chevre/factory/lib/chevre/transaction/returnOrder").ITransaction, "id" | "typeOf" | "status">[]>;
77
30
  /**
78
31
  * set task status exported by transaction id
79
32
  * IDでタスクをエクスポート済に変更する
@@ -81,143 +34,4 @@ export declare class TransactionRepo {
81
34
  setTasksExportedById(params: {
82
35
  id: string;
83
36
  }): Promise<void>;
84
- /**
85
- * add(2025-03-13~)
86
- */
87
- countPotentiallyExpired(params: {
88
- expires: {
89
- $lt: Date;
90
- };
91
- limit?: number;
92
- }): Promise<{
93
- count: number;
94
- }>;
95
- /**
96
- * add(2025-03-03~)
97
- */
98
- makeOneExpiredIfExists(params: {
99
- expires: {
100
- $lt: Date;
101
- };
102
- }): Promise<Pick<factory.transaction.ITransaction<factory.transactionType>, 'id' | 'typeOf'> | undefined>;
103
- /**
104
- * 取引を期限切れにする
105
- */
106
- makeExpired(params: {
107
- expires: {
108
- $lt: Date;
109
- };
110
- limit: number;
111
- }): Promise<Pick<factory.transaction.ITransaction<factory.transactionType>, 'id' | 'typeOf'>[]>;
112
- findByIdAndDelete(params: {
113
- id: string;
114
- }): Promise<void>;
115
- unsetUnnecessaryFields(params: {
116
- filter: any;
117
- $unset: any;
118
- }): Promise<import("mongoose").UpdateWriteOpResult>;
119
- updateById4migration(params: {
120
- id: string;
121
- update: UpdateQuery<IDocType>;
122
- }): Promise<import("mongoose").UpdateWriteOpResult>;
123
- /**
124
- * 終了日時を一定期間過ぎたアクションを削除する
125
- */
126
- deleteEndDatePassedCertainPeriod(params: {
127
- typeOf: factory.transactionType;
128
- endDate: {
129
- $gte: Date;
130
- $lt: Date;
131
- };
132
- }): Promise<import("mongodb").DeleteResult>;
133
- getCursor(conditions: any, projection: any, sort?: factory.sortType): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & (({
134
- object: import("@chevre/factory/lib/chevre/transaction/placeOrder").IObject;
135
- error?: any;
136
- project: import("@chevre/factory/lib/chevre/transaction").IProject;
137
- seller: import("@chevre/factory/lib/chevre/transaction/placeOrder").ISeller;
138
- typeOf: factory.transactionType.PlaceOrder;
139
- expires: Date;
140
- result?: import("@chevre/factory/lib/chevre/transaction/placeOrder").IResult | undefined;
141
- startDate: Date;
142
- endDate?: Date | undefined;
143
- instrument?: import("@chevre/factory/lib/chevre/transaction/placeOrder").IInstrument | undefined;
144
- agent: import("@chevre/factory/lib/chevre/transaction/placeOrder").IAgent;
145
- status: factory.transactionStatusType;
146
- tasksExportAction?: import("@chevre/factory/lib/chevre/transaction").ITasksExportAction | undefined;
147
- potentialActions?: undefined;
148
- } & {
149
- _id: import("mongoose").Types.ObjectId;
150
- } & {
151
- __v: number;
152
- }) | ({
153
- object: import("@chevre/factory/lib/chevre/transaction/returnOrder").IObject;
154
- error?: any;
155
- project: import("@chevre/factory/lib/chevre/transaction").IProject;
156
- seller: import("@chevre/factory/lib/chevre/transaction").ISeller;
157
- typeOf: factory.transactionType.ReturnOrder;
158
- expires: Date;
159
- result?: import("@chevre/factory/lib/chevre/transaction/returnOrder").IResult | undefined;
160
- startDate: Date;
161
- endDate?: Date | undefined;
162
- agent: import("@chevre/factory/lib/chevre/transaction").IAgent;
163
- recipient?: undefined;
164
- status: factory.transactionStatusType;
165
- tasksExportAction?: import("@chevre/factory/lib/chevre/transaction").ITasksExportAction | undefined;
166
- potentialActions?: import("@chevre/factory/lib/chevre/transaction/returnOrder").IPotentialActions | undefined;
167
- } & {
168
- _id: import("mongoose").Types.ObjectId;
169
- } & {
170
- __v: number;
171
- })), import("mongoose").QueryOptions<IDocType>, (import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & (({
172
- object: import("@chevre/factory/lib/chevre/transaction/placeOrder").IObject;
173
- error?: any;
174
- project: import("@chevre/factory/lib/chevre/transaction").IProject;
175
- seller: import("@chevre/factory/lib/chevre/transaction/placeOrder").ISeller;
176
- typeOf: factory.transactionType.PlaceOrder;
177
- expires: Date;
178
- result?: import("@chevre/factory/lib/chevre/transaction/placeOrder").IResult | undefined;
179
- startDate: Date;
180
- endDate?: Date | undefined;
181
- instrument?: import("@chevre/factory/lib/chevre/transaction/placeOrder").IInstrument | undefined;
182
- agent: import("@chevre/factory/lib/chevre/transaction/placeOrder").IAgent;
183
- status: factory.transactionStatusType;
184
- tasksExportAction?: import("@chevre/factory/lib/chevre/transaction").ITasksExportAction | undefined;
185
- potentialActions?: undefined;
186
- } & {
187
- _id: import("mongoose").Types.ObjectId;
188
- } & {
189
- __v: number;
190
- }) | ({
191
- object: import("@chevre/factory/lib/chevre/transaction/returnOrder").IObject;
192
- error?: any;
193
- project: import("@chevre/factory/lib/chevre/transaction").IProject;
194
- seller: import("@chevre/factory/lib/chevre/transaction").ISeller;
195
- typeOf: factory.transactionType.ReturnOrder;
196
- expires: Date;
197
- result?: import("@chevre/factory/lib/chevre/transaction/returnOrder").IResult | undefined;
198
- startDate: Date;
199
- endDate?: Date | undefined;
200
- agent: import("@chevre/factory/lib/chevre/transaction").IAgent;
201
- recipient?: undefined;
202
- status: factory.transactionStatusType;
203
- tasksExportAction?: import("@chevre/factory/lib/chevre/transaction").ITasksExportAction | undefined;
204
- potentialActions?: import("@chevre/factory/lib/chevre/transaction/returnOrder").IPotentialActions | undefined;
205
- } & {
206
- _id: import("mongoose").Types.ObjectId;
207
- } & {
208
- __v: number;
209
- }))) | null>;
210
- aggregatePlaceOrder(params: {
211
- project?: {
212
- id?: {
213
- $ne?: string;
214
- };
215
- };
216
- startFrom: Date;
217
- startThrough: Date;
218
- typeOf: factory.transactionType;
219
- clientId?: string;
220
- }): Promise<IAggregatePlaceOrder>;
221
- private agggregateByStatus;
222
37
  }
223
- export {};