@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.
- package/lib/chevre/repo/adminAssetTransaction.d.ts +132 -0
- package/lib/chevre/repo/adminAssetTransaction.js +504 -0
- package/lib/chevre/repo/adminTransaction.d.ts +131 -0
- package/lib/chevre/repo/adminTransaction.js +237 -0
- package/lib/chevre/repo/aggregateAssetTransaction.d.ts +43 -0
- package/lib/chevre/repo/aggregateAssetTransaction.js +166 -0
- package/lib/chevre/repo/aggregateTransaction.d.ts +39 -0
- package/lib/chevre/repo/aggregateTransaction.js +166 -0
- package/lib/chevre/repo/assetTransaction.d.ts +10 -235
- package/lib/chevre/repo/assetTransaction.js +48 -636
- package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +8 -9
- package/lib/chevre/repo/mongoose/schemas/event.js +7 -0
- package/lib/chevre/repo/mongoose/schemas/eventOffer.js +7 -0
- package/lib/chevre/repo/mongoose/schemas/pendingReservation.js +11 -4
- package/lib/chevre/repo/transaction.d.ts +1 -187
- package/lib/chevre/repo/transaction.js +2 -383
- package/lib/chevre/repository.d.ts +20 -5
- package/lib/chevre/repository.js +46 -13
- package/lib/chevre/service/aggregation/system.d.ts +7 -7
- package/lib/chevre/service/aggregation/system.js +4 -4
- package/lib/chevre/service/assetTransaction/cancelReservation/start.js +10 -17
- package/lib/chevre/service/assetTransaction/refund.js +2 -2
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.js +1 -3
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/isDeliverable.js +1 -49
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.js +2 -2
- package/lib/chevre/service/payment/any/processVoidPayTransaction.js +1 -1
- package/lib/chevre/service/reserve/cancelReservation.js +3 -3
- package/lib/chevre/service/reserve/checkInReservation.js +2 -2
- package/lib/chevre/service/reserve/confirmReservation.js +1 -1
- package/lib/chevre/service/reserve/useReservation.js +1 -1
- package/lib/chevre/service/task/deleteTransaction.js +2 -4
- package/lib/chevre/service/task/returnPayTransaction.js +2 -2
- package/lib/chevre/service/transaction/deleteTransaction/deletePayTransactionsByPlaceOrder.js +2 -2
- package/lib/chevre/service/transaction/deleteTransaction/deleteReservationsByPlaceOrder.js +2 -2
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +2 -2
- package/lib/chevre/service/transaction/deleteTransaction.js +2 -2
- package/lib/chevre/service/transaction/placeOrder/confirm.js +1 -1
- package/lib/chevre/service/validation/validateOrder.js +2 -2
- package/package.json +2 -2
- package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +0 -13
- package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +0 -82
- package/lib/chevre/repo/ownershipInfo.d.ts +0 -20
- package/lib/chevre/repo/ownershipInfo.js +0 -130
|
@@ -1,48 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.TransactionRepo = void 0;
|
|
7
|
-
const moment_1 = __importDefault(require("moment"));
|
|
8
|
-
const transaction_1 = require("../eventEmitter/transaction");
|
|
9
4
|
const factory_1 = require("../factory");
|
|
10
5
|
const settings_1 = require("../settings");
|
|
11
|
-
const
|
|
6
|
+
const transaction_1 = require("./mongoose/schemas/transaction");
|
|
12
7
|
/**
|
|
13
8
|
* 取引リポジトリ
|
|
14
9
|
*/
|
|
15
10
|
class TransactionRepo {
|
|
16
11
|
transactionModel;
|
|
17
12
|
constructor(connection) {
|
|
18
|
-
this.transactionModel = connection.model(
|
|
19
|
-
}
|
|
20
|
-
async countPotentiallyExportTasks(params) {
|
|
21
|
-
const { endDate, limit } = params;
|
|
22
|
-
const endDateLt = endDate?.$lt;
|
|
23
|
-
if (!(endDateLt instanceof Date)) {
|
|
24
|
-
throw new factory_1.factory.errors.Argument('endDate.$lt', 'must be Date');
|
|
25
|
-
}
|
|
26
|
-
const query = this.transactionModel.countDocuments({
|
|
27
|
-
status: {
|
|
28
|
-
$in: [
|
|
29
|
-
factory_1.factory.transactionStatusType.Canceled,
|
|
30
|
-
factory_1.factory.transactionStatusType.Confirmed,
|
|
31
|
-
factory_1.factory.transactionStatusType.Expired
|
|
32
|
-
]
|
|
33
|
-
},
|
|
34
|
-
'tasksExportAction.actionStatus': {
|
|
35
|
-
$exists: true,
|
|
36
|
-
$eq: factory_1.factory.actionStatusType.PotentialActionStatus
|
|
37
|
-
},
|
|
38
|
-
endDate: { $exists: true, $lt: endDateLt }
|
|
39
|
-
});
|
|
40
|
-
if (typeof limit === 'number' && limit >= 0) {
|
|
41
|
-
query.limit(limit);
|
|
42
|
-
}
|
|
43
|
-
const count = await query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
44
|
-
.exec();
|
|
45
|
-
return { count };
|
|
13
|
+
this.transactionModel = connection.model(transaction_1.modelName, (0, transaction_1.createSchema)());
|
|
46
14
|
}
|
|
47
15
|
/**
|
|
48
16
|
* タスク未エクスポートの取引をひとつ取得してエクスポートを開始する
|
|
@@ -101,72 +69,6 @@ class TransactionRepo {
|
|
|
101
69
|
.exec()
|
|
102
70
|
.then((doc) => (doc === null) ? null : doc);
|
|
103
71
|
}
|
|
104
|
-
/**
|
|
105
|
-
* tasksExportAction.actionStatusがActiveActionStatusのまま一定時間経過した取引について
|
|
106
|
-
* PotentialActionStatusに変更する
|
|
107
|
-
* 2025-03-10~
|
|
108
|
-
*/
|
|
109
|
-
async reExportAction(params) {
|
|
110
|
-
const { startDate } = params;
|
|
111
|
-
if (!(startDate.$lt instanceof Date)) {
|
|
112
|
-
throw new factory_1.factory.errors.Argument('startDate.$lt', 'must be Date');
|
|
113
|
-
}
|
|
114
|
-
return this.transactionModel.updateMany({
|
|
115
|
-
'tasksExportAction.actionStatus': {
|
|
116
|
-
$exists: true,
|
|
117
|
-
$eq: factory_1.factory.actionStatusType.ActiveActionStatus
|
|
118
|
-
},
|
|
119
|
-
'tasksExportAction.startDate': {
|
|
120
|
-
$exists: true,
|
|
121
|
-
$lt: startDate.$lt
|
|
122
|
-
}
|
|
123
|
-
}, {
|
|
124
|
-
$set: {
|
|
125
|
-
tasksExportAction: {
|
|
126
|
-
actionStatus: factory_1.factory.actionStatusType.PotentialActionStatus
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
})
|
|
130
|
-
.exec();
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* タスクエクスポートの遅延している取引について明示的にemitTransactionStatusChangedを実行する
|
|
134
|
-
*/
|
|
135
|
-
async exportTasksMany(params) {
|
|
136
|
-
const delayedTransactions = await this.transactionModel.find({
|
|
137
|
-
status: { $in: params.status.$in },
|
|
138
|
-
'tasksExportAction.actionStatus': {
|
|
139
|
-
$exists: true,
|
|
140
|
-
$eq: factory_1.factory.actionStatusType.PotentialActionStatus
|
|
141
|
-
},
|
|
142
|
-
endDate: {
|
|
143
|
-
$exists: true,
|
|
144
|
-
$lt: (0, moment_1.default)(params.now)
|
|
145
|
-
.add(-params.delayInSeconds, 'seconds')
|
|
146
|
-
.toDate()
|
|
147
|
-
}
|
|
148
|
-
})
|
|
149
|
-
.select({
|
|
150
|
-
_id: 0,
|
|
151
|
-
id: { $toString: '$_id' },
|
|
152
|
-
typeOf: 1,
|
|
153
|
-
status: 1
|
|
154
|
-
})
|
|
155
|
-
.limit(params.limit)
|
|
156
|
-
.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
157
|
-
.lean()
|
|
158
|
-
.exec();
|
|
159
|
-
if (delayedTransactions.length > 0) {
|
|
160
|
-
delayedTransactions.forEach((delayedTransaction) => {
|
|
161
|
-
transaction_1.transactionEventEmitter.emitTransactionStatusChanged({
|
|
162
|
-
id: delayedTransaction.id,
|
|
163
|
-
typeOf: delayedTransaction.typeOf,
|
|
164
|
-
status: delayedTransaction.status
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
return delayedTransactions;
|
|
169
|
-
}
|
|
170
72
|
/**
|
|
171
73
|
* set task status exported by transaction id
|
|
172
74
|
* IDでタスクをエクスポート済に変更する
|
|
@@ -189,288 +91,5 @@ class TransactionRepo {
|
|
|
189
91
|
})
|
|
190
92
|
.exec();
|
|
191
93
|
}
|
|
192
|
-
/**
|
|
193
|
-
* add(2025-03-13~)
|
|
194
|
-
*/
|
|
195
|
-
async countPotentiallyExpired(params) {
|
|
196
|
-
const { expires, limit } = params;
|
|
197
|
-
const query = this.transactionModel.countDocuments({
|
|
198
|
-
status: { $eq: factory_1.factory.transactionStatusType.InProgress },
|
|
199
|
-
expires: { $lt: expires.$lt }
|
|
200
|
-
});
|
|
201
|
-
if (typeof limit === 'number' && limit >= 0) {
|
|
202
|
-
query.limit(limit);
|
|
203
|
-
}
|
|
204
|
-
const count = await query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
205
|
-
.exec();
|
|
206
|
-
return { count };
|
|
207
|
-
}
|
|
208
|
-
/**
|
|
209
|
-
* add(2025-03-03~)
|
|
210
|
-
*/
|
|
211
|
-
async makeOneExpiredIfExists(params) {
|
|
212
|
-
const endDate = new Date();
|
|
213
|
-
const sort = {
|
|
214
|
-
expires: factory_1.factory.sortType.Ascending
|
|
215
|
-
};
|
|
216
|
-
const doc = await this.transactionModel.findOneAndUpdate({
|
|
217
|
-
status: { $eq: factory_1.factory.transactionStatusType.InProgress },
|
|
218
|
-
expires: { $lt: params.expires.$lt }
|
|
219
|
-
}, {
|
|
220
|
-
status: factory_1.factory.transactionStatusType.Expired,
|
|
221
|
-
endDate
|
|
222
|
-
}, {
|
|
223
|
-
new: true,
|
|
224
|
-
projection: {
|
|
225
|
-
_id: 0,
|
|
226
|
-
id: { $toString: '$_id' },
|
|
227
|
-
typeOf: 1
|
|
228
|
-
}
|
|
229
|
-
})
|
|
230
|
-
.sort(sort)
|
|
231
|
-
.lean()
|
|
232
|
-
.exec();
|
|
233
|
-
if (doc === null) {
|
|
234
|
-
// no op
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
else {
|
|
238
|
-
transaction_1.transactionEventEmitter.emitTransactionStatusChanged({
|
|
239
|
-
id: doc.id,
|
|
240
|
-
typeOf: doc.typeOf,
|
|
241
|
-
status: factory_1.factory.transactionStatusType.Expired
|
|
242
|
-
});
|
|
243
|
-
return doc;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* 取引を期限切れにする
|
|
248
|
-
*/
|
|
249
|
-
async makeExpired(params) {
|
|
250
|
-
if (typeof params.limit !== 'number' || params.limit === 0) {
|
|
251
|
-
throw new factory_1.factory.errors.ArgumentNull('limit');
|
|
252
|
-
}
|
|
253
|
-
const sort = {
|
|
254
|
-
expires: factory_1.factory.sortType.Ascending
|
|
255
|
-
};
|
|
256
|
-
// IDをemitしたいのでまずリスト検索(2023-04-27~)
|
|
257
|
-
const expiringTransactions = await this.transactionModel.find({
|
|
258
|
-
status: { $eq: factory_1.factory.transactionStatusType.InProgress },
|
|
259
|
-
expires: { $lt: params.expires.$lt }
|
|
260
|
-
})
|
|
261
|
-
.select({
|
|
262
|
-
_id: 0,
|
|
263
|
-
id: { $toString: '$_id' },
|
|
264
|
-
typeOf: 1
|
|
265
|
-
})
|
|
266
|
-
.limit(params.limit)
|
|
267
|
-
.sort(sort) // sort(2025-03-03~)
|
|
268
|
-
.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
269
|
-
.lean()
|
|
270
|
-
.exec();
|
|
271
|
-
if (expiringTransactions.length > 0) {
|
|
272
|
-
// ステータスと期限を見て更新
|
|
273
|
-
await this.transactionModel.updateMany({
|
|
274
|
-
_id: { $in: expiringTransactions.map((t) => t.id) },
|
|
275
|
-
status: { $eq: factory_1.factory.transactionStatusType.InProgress },
|
|
276
|
-
expires: { $lt: params.expires.$lt }
|
|
277
|
-
}, {
|
|
278
|
-
status: factory_1.factory.transactionStatusType.Expired,
|
|
279
|
-
endDate: new Date()
|
|
280
|
-
})
|
|
281
|
-
.exec();
|
|
282
|
-
expiringTransactions.forEach((expiringTransaction) => {
|
|
283
|
-
transaction_1.transactionEventEmitter.emitTransactionStatusChanged({
|
|
284
|
-
id: expiringTransaction.id,
|
|
285
|
-
typeOf: expiringTransaction.typeOf,
|
|
286
|
-
status: factory_1.factory.transactionStatusType.Expired
|
|
287
|
-
});
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
return expiringTransactions;
|
|
291
|
-
}
|
|
292
|
-
async findByIdAndDelete(params) {
|
|
293
|
-
await this.transactionModel.findByIdAndDelete(params.id)
|
|
294
|
-
.exec();
|
|
295
|
-
}
|
|
296
|
-
async unsetUnnecessaryFields(params) {
|
|
297
|
-
return this.transactionModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
|
|
298
|
-
.exec();
|
|
299
|
-
}
|
|
300
|
-
async updateById4migration(params) {
|
|
301
|
-
return this.transactionModel.updateOne({ _id: { $eq: params.id } }, params.update)
|
|
302
|
-
.exec();
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* 終了日時を一定期間過ぎたアクションを削除する
|
|
306
|
-
*/
|
|
307
|
-
async deleteEndDatePassedCertainPeriod(params) {
|
|
308
|
-
return this.transactionModel.deleteMany({
|
|
309
|
-
typeOf: { $eq: params.typeOf },
|
|
310
|
-
// 終了日時を一定期間過ぎたもの
|
|
311
|
-
endDate: {
|
|
312
|
-
$exists: true,
|
|
313
|
-
$gte: params.endDate.$gte,
|
|
314
|
-
$lt: params.endDate.$lt
|
|
315
|
-
}
|
|
316
|
-
})
|
|
317
|
-
.exec();
|
|
318
|
-
}
|
|
319
|
-
getCursor(conditions, projection, sort) {
|
|
320
|
-
return this.transactionModel.find(conditions, projection)
|
|
321
|
-
.sort({ startDate: (sort === factory_1.factory.sortType.Ascending) ? sort : factory_1.factory.sortType.Descending })
|
|
322
|
-
.cursor();
|
|
323
|
-
}
|
|
324
|
-
async aggregatePlaceOrder(params) {
|
|
325
|
-
const statuses = await Promise.all([
|
|
326
|
-
factory_1.factory.transactionStatusType.Confirmed,
|
|
327
|
-
factory_1.factory.transactionStatusType.Canceled,
|
|
328
|
-
factory_1.factory.transactionStatusType.Expired
|
|
329
|
-
].map(async (transactionStatus) => {
|
|
330
|
-
const matchConditions = {
|
|
331
|
-
startDate: {
|
|
332
|
-
$gte: params.startFrom,
|
|
333
|
-
$lte: params.startThrough
|
|
334
|
-
},
|
|
335
|
-
typeOf: { $eq: params.typeOf },
|
|
336
|
-
status: { $eq: transactionStatus },
|
|
337
|
-
...(typeof params.project?.id?.$ne === 'string')
|
|
338
|
-
? { 'project.id': { $ne: params.project.id.$ne } }
|
|
339
|
-
: undefined,
|
|
340
|
-
...(typeof params.clientId === 'string')
|
|
341
|
-
// customerIdentifierAll.push();
|
|
342
|
-
? {
|
|
343
|
-
'agent.identifier': {
|
|
344
|
-
$exists: true,
|
|
345
|
-
$all: [{ name: 'clientId', value: params.clientId }]
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
: undefined
|
|
349
|
-
};
|
|
350
|
-
return this.agggregateByStatus({ matchConditions, status: transactionStatus });
|
|
351
|
-
}));
|
|
352
|
-
return { statuses };
|
|
353
|
-
}
|
|
354
|
-
async agggregateByStatus(params) {
|
|
355
|
-
const matchConditions = params.matchConditions;
|
|
356
|
-
const transactionStatus = params.status;
|
|
357
|
-
const aggregations = await this.transactionModel.aggregate([
|
|
358
|
-
{
|
|
359
|
-
$match: matchConditions
|
|
360
|
-
},
|
|
361
|
-
{
|
|
362
|
-
$project: {
|
|
363
|
-
duration: { $subtract: ['$endDate', '$startDate'] },
|
|
364
|
-
status: '$status',
|
|
365
|
-
startDate: '$startDate',
|
|
366
|
-
endDate: '$endDate',
|
|
367
|
-
typeOf: '$typeOf'
|
|
368
|
-
}
|
|
369
|
-
},
|
|
370
|
-
{
|
|
371
|
-
$group: {
|
|
372
|
-
_id: '$typeOf',
|
|
373
|
-
transactionCount: { $sum: 1 },
|
|
374
|
-
maxDuration: { $max: '$duration' },
|
|
375
|
-
minDuration: { $min: '$duration' },
|
|
376
|
-
avgDuration: { $avg: '$duration' }
|
|
377
|
-
}
|
|
378
|
-
},
|
|
379
|
-
{
|
|
380
|
-
$project: {
|
|
381
|
-
_id: 0,
|
|
382
|
-
transactionCount: '$transactionCount',
|
|
383
|
-
avgDuration: '$avgDuration',
|
|
384
|
-
maxDuration: '$maxDuration',
|
|
385
|
-
minDuration: '$minDuration'
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
])
|
|
389
|
-
.exec();
|
|
390
|
-
const percents = [50, 95, 99];
|
|
391
|
-
if (aggregations.length === 0) {
|
|
392
|
-
return {
|
|
393
|
-
status: transactionStatus,
|
|
394
|
-
aggregation: {
|
|
395
|
-
transactionCount: 0,
|
|
396
|
-
avgDuration: 0,
|
|
397
|
-
maxDuration: 0,
|
|
398
|
-
minDuration: 0,
|
|
399
|
-
percentilesDuration: percents.map((percent) => {
|
|
400
|
-
return {
|
|
401
|
-
name: String(percent),
|
|
402
|
-
value: 0
|
|
403
|
-
};
|
|
404
|
-
})
|
|
405
|
-
// totalPrice: 0,
|
|
406
|
-
// maxPrice: 0,
|
|
407
|
-
// minPrice: 0,
|
|
408
|
-
// avgPrice: 0
|
|
409
|
-
}
|
|
410
|
-
};
|
|
411
|
-
}
|
|
412
|
-
const ranks4percentile = percents.map((percentile) => {
|
|
413
|
-
return {
|
|
414
|
-
percentile,
|
|
415
|
-
rank: Math.floor(aggregations[0].transactionCount * percentile / 100)
|
|
416
|
-
};
|
|
417
|
-
});
|
|
418
|
-
const aggregations2 = await this.transactionModel.aggregate([
|
|
419
|
-
{
|
|
420
|
-
$match: matchConditions
|
|
421
|
-
},
|
|
422
|
-
{
|
|
423
|
-
$project: {
|
|
424
|
-
duration: { $subtract: ['$endDate', '$startDate'] },
|
|
425
|
-
status: '$status',
|
|
426
|
-
startDate: '$startDate',
|
|
427
|
-
endDate: '$endDate',
|
|
428
|
-
typeOf: '$typeOf'
|
|
429
|
-
// result: '$result',
|
|
430
|
-
// price: {
|
|
431
|
-
// $cond: {
|
|
432
|
-
// if: { $isNumber: '$result.order.price' },
|
|
433
|
-
// then: '$result.order.price',
|
|
434
|
-
// else: 0
|
|
435
|
-
// }
|
|
436
|
-
// }
|
|
437
|
-
}
|
|
438
|
-
},
|
|
439
|
-
{ $sort: { duration: 1 } },
|
|
440
|
-
{
|
|
441
|
-
$group: {
|
|
442
|
-
_id: '$typeOf',
|
|
443
|
-
durations: { $push: '$duration' }
|
|
444
|
-
// totalPrice: { $sum: '$price' },
|
|
445
|
-
// maxPrice: { $max: '$price' },
|
|
446
|
-
// minPrice: { $min: '$price' },
|
|
447
|
-
// avgPrice: { $avg: '$price' }
|
|
448
|
-
}
|
|
449
|
-
},
|
|
450
|
-
{
|
|
451
|
-
$project: {
|
|
452
|
-
_id: 0,
|
|
453
|
-
percentilesDuration: ranks4percentile.map((rank) => {
|
|
454
|
-
return {
|
|
455
|
-
name: String(rank.percentile),
|
|
456
|
-
value: { $arrayElemAt: ['$durations', rank.rank] }
|
|
457
|
-
};
|
|
458
|
-
})
|
|
459
|
-
// totalPrice: '$totalPrice',
|
|
460
|
-
// maxPrice: '$maxPrice',
|
|
461
|
-
// minPrice: '$minPrice',
|
|
462
|
-
// avgPrice: '$avgPrice'
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
])
|
|
466
|
-
.exec();
|
|
467
|
-
return {
|
|
468
|
-
status: transactionStatus,
|
|
469
|
-
aggregation: {
|
|
470
|
-
...aggregations[0],
|
|
471
|
-
...aggregations2[0]
|
|
472
|
-
}
|
|
473
|
-
};
|
|
474
|
-
}
|
|
475
94
|
}
|
|
476
95
|
exports.TransactionRepo = TransactionRepo;
|
|
@@ -17,15 +17,19 @@ import type { PayActionRepo } from './repo/action/pay';
|
|
|
17
17
|
import type { RefundActionRepo } from './repo/action/refund';
|
|
18
18
|
import type { AsyncActionRepo } from './repo/asyncAction';
|
|
19
19
|
import type { AdditionalPropertyRepo } from './repo/additionalProperty';
|
|
20
|
+
import type { AdminAssetTransactionRepo } from './repo/adminAssetTransaction';
|
|
20
21
|
import type { AdminAsyncActionRepo } from './repo/adminAsyncAction';
|
|
21
22
|
import type { AdminScheduledTaskRepo } from './repo/adminScheduledTask';
|
|
22
23
|
import type { AdminTaskRepo } from './repo/adminTask';
|
|
24
|
+
import type { AdminTransactionRepo } from './repo/adminTransaction';
|
|
23
25
|
import type { AggregateActionRepo } from './repo/aggregateAction';
|
|
26
|
+
import type { AggregateAssetTransactionRepo } from './repo/aggregateAssetTransaction';
|
|
24
27
|
import type { AggregateOfferRepo } from './repo/aggregateOffer';
|
|
25
28
|
import type { AggregateOrderRepo } from './repo/aggregateOrder';
|
|
26
29
|
import type { AggregateReservationRepo } from './repo/aggregateReservation';
|
|
27
30
|
import type { AggregateScheduledTaskRepo } from './repo/aggregateScheduledTask';
|
|
28
31
|
import type { AggregateTaskRepo } from './repo/aggregateTask';
|
|
32
|
+
import type { AggregateTransactionRepo } from './repo/aggregateTransaction';
|
|
29
33
|
import type { AggregationRepo } from './repo/aggregation';
|
|
30
34
|
import type { AssetTransactionRepo } from './repo/assetTransaction';
|
|
31
35
|
import type { ReserveTransactionRepo } from './repo/assetTransaction/reserve';
|
|
@@ -56,7 +60,6 @@ import type { OfferCatalogItemRepo } from './repo/offerCatalogItem';
|
|
|
56
60
|
import type { OfferItemConditionRepo } from './repo/offerItemCondition';
|
|
57
61
|
import type { OrderRepo } from './repo/order';
|
|
58
62
|
import type { OrderInTransactionRepo } from './repo/orderInTransaction';
|
|
59
|
-
import type { OwnershipInfoRepo } from './repo/ownershipInfo';
|
|
60
63
|
import type { PassportRepo } from './repo/passport';
|
|
61
64
|
import type { PaymentServiceRepo } from './repo/paymentService';
|
|
62
65
|
import type { PaymentServiceChannelRepo } from './repo/paymentServiceChannel';
|
|
@@ -166,6 +169,10 @@ export type AdditionalProperty = AdditionalPropertyRepo;
|
|
|
166
169
|
export declare namespace AdditionalProperty {
|
|
167
170
|
function createInstance(...params: ConstructorParameters<typeof AdditionalPropertyRepo>): Promise<AdditionalPropertyRepo>;
|
|
168
171
|
}
|
|
172
|
+
export type AdminAssetTransaction = AdminAssetTransactionRepo;
|
|
173
|
+
export declare namespace AdminAssetTransaction {
|
|
174
|
+
function createInstance(...params: ConstructorParameters<typeof AdminAssetTransactionRepo>): Promise<AdminAssetTransactionRepo>;
|
|
175
|
+
}
|
|
169
176
|
export type AdminAsyncAction = AdminAsyncActionRepo;
|
|
170
177
|
export declare namespace AdminAsyncAction {
|
|
171
178
|
function createInstance(...params: ConstructorParameters<typeof AdminAsyncActionRepo>): Promise<AdminAsyncActionRepo>;
|
|
@@ -178,6 +185,10 @@ export type AdminTask = AdminTaskRepo;
|
|
|
178
185
|
export declare namespace AdminTask {
|
|
179
186
|
function createInstance(...params: ConstructorParameters<typeof AdminTaskRepo>): Promise<AdminTaskRepo>;
|
|
180
187
|
}
|
|
188
|
+
export type AdminTransaction = AdminTransactionRepo;
|
|
189
|
+
export declare namespace AdminTransaction {
|
|
190
|
+
function createInstance(...params: ConstructorParameters<typeof AdminTransactionRepo>): Promise<AdminTransactionRepo>;
|
|
191
|
+
}
|
|
181
192
|
export type AggregateAction = AggregateActionRepo;
|
|
182
193
|
export declare namespace AggregateAction {
|
|
183
194
|
function createInstance(...params: ConstructorParameters<typeof AggregateActionRepo>): Promise<AggregateActionRepo>;
|
|
@@ -190,6 +201,14 @@ export type AggregateTask = AggregateTaskRepo;
|
|
|
190
201
|
export declare namespace AggregateTask {
|
|
191
202
|
function createInstance(...params: ConstructorParameters<typeof AggregateTaskRepo>): Promise<AggregateTaskRepo>;
|
|
192
203
|
}
|
|
204
|
+
export type AggregateTransaction = AggregateTransactionRepo;
|
|
205
|
+
export declare namespace AggregateTransaction {
|
|
206
|
+
function createInstance(...params: ConstructorParameters<typeof AggregateTransactionRepo>): Promise<AggregateTransactionRepo>;
|
|
207
|
+
}
|
|
208
|
+
export type AggregateAssetTransaction = AggregateAssetTransactionRepo;
|
|
209
|
+
export declare namespace AggregateAssetTransaction {
|
|
210
|
+
function createInstance(...params: ConstructorParameters<typeof AggregateAssetTransactionRepo>): Promise<AggregateAssetTransactionRepo>;
|
|
211
|
+
}
|
|
193
212
|
export type AggregateOffer = AggregateOfferRepo;
|
|
194
213
|
export declare namespace AggregateOffer {
|
|
195
214
|
function createInstance(...params: ConstructorParameters<typeof AggregateOfferRepo>): Promise<AggregateOfferRepo>;
|
|
@@ -332,10 +351,6 @@ export type OrderNumber = OrderNumberRepo;
|
|
|
332
351
|
export declare namespace OrderNumber {
|
|
333
352
|
function createInstance(...params: ConstructorParameters<typeof OrderNumberRepo>): Promise<OrderNumberRepo>;
|
|
334
353
|
}
|
|
335
|
-
export type OwnershipInfo = OwnershipInfoRepo;
|
|
336
|
-
export declare namespace OwnershipInfo {
|
|
337
|
-
function createInstance(...params: ConstructorParameters<typeof OwnershipInfoRepo>): Promise<OwnershipInfoRepo>;
|
|
338
|
-
}
|
|
339
354
|
export type Passport = PassportRepo;
|
|
340
355
|
export declare namespace Passport {
|
|
341
356
|
function createInstance(...params: ConstructorParameters<typeof PassportRepo>): Promise<PassportRepo>;
|
package/lib/chevre/repository.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.WebSite = exports.rateLimit = exports.TransactionProcess = exports.TransactionNumber = exports.transaction = exports.Transaction = exports.Ticket = exports.AsyncAction = exports.TaskDelayed = exports.Task = exports.ScheduledTask = exports.StockHolder = exports.setting = exports.Setting = exports.ServiceAvailableHour = exports.SellerReturnPolicy = exports.SellerPaymentAccepted = exports.SellerMakesOffer = exports.Seller = exports.Schedule = exports.Role = exports.ReserveInterface = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductHasOfferCatalog = exports.Product = exports.PriceSpecification = exports.PotentialAction = exports.place = exports.Person = exports.PendingReservation = exports.PaymentServiceProvider = exports.PaymentServiceChannel = void 0;
|
|
3
|
+
exports.OrderInTransaction = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalogItem = exports.OfferCatalog = exports.NoteAboutOrder = exports.Note = exports.MovieTicketType = exports.Message = exports.MerchantReturnPolicy = exports.MemberProgram = exports.Member = exports.Issuer = exports.IdentityProvider = exports.Identity = exports.EventSeries = exports.EventSellerMakesOffer = exports.EventOffer = exports.Event = exports.EmailMessage = exports.CustomerType = exports.Customer = exports.Credentials = exports.CreativeWork = exports.ConfirmationNumber = exports.Authorization = exports.CategoryCode = exports.assetTransaction = exports.AssetTransaction = exports.Aggregation = exports.AggregateReservation = exports.AggregateOrder = exports.AggregateOffer = exports.AggregateAssetTransaction = exports.AggregateTransaction = exports.AggregateTask = exports.AggregateScheduledTask = exports.AggregateAction = exports.AdminTransaction = exports.AdminTask = exports.AdminScheduledTask = exports.AdminAsyncAction = exports.AdminAssetTransaction = exports.AdditionalProperty = exports.action = exports.Action = exports.AccountTitle = exports.AccountingReport = exports.AcceptedOffer = void 0;
|
|
4
|
+
exports.WebSite = exports.rateLimit = exports.TransactionProcess = exports.TransactionNumber = exports.transaction = exports.Transaction = exports.Ticket = exports.AsyncAction = exports.TaskDelayed = exports.Task = exports.ScheduledTask = exports.StockHolder = exports.setting = exports.Setting = exports.ServiceAvailableHour = exports.SellerReturnPolicy = exports.SellerPaymentAccepted = exports.SellerMakesOffer = exports.Seller = exports.Schedule = exports.Role = exports.ReserveInterface = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductHasOfferCatalog = exports.Product = exports.PriceSpecification = exports.PotentialAction = exports.place = exports.Person = exports.PendingReservation = exports.PaymentServiceProvider = exports.PaymentServiceChannel = exports.PaymentService = exports.Passport = exports.OrderNumber = void 0;
|
|
5
5
|
var AcceptedOffer;
|
|
6
6
|
(function (AcceptedOffer) {
|
|
7
7
|
let repo;
|
|
@@ -170,6 +170,17 @@ var AdditionalProperty;
|
|
|
170
170
|
}
|
|
171
171
|
AdditionalProperty.createInstance = createInstance;
|
|
172
172
|
})(AdditionalProperty || (exports.AdditionalProperty = AdditionalProperty = {}));
|
|
173
|
+
var AdminAssetTransaction;
|
|
174
|
+
(function (AdminAssetTransaction) {
|
|
175
|
+
let repo;
|
|
176
|
+
async function createInstance(...params) {
|
|
177
|
+
if (repo === undefined) {
|
|
178
|
+
repo = (await import('./repo/adminAssetTransaction.js')).AdminAssetTransactionRepo;
|
|
179
|
+
}
|
|
180
|
+
return new repo(...params);
|
|
181
|
+
}
|
|
182
|
+
AdminAssetTransaction.createInstance = createInstance;
|
|
183
|
+
})(AdminAssetTransaction || (exports.AdminAssetTransaction = AdminAssetTransaction = {}));
|
|
173
184
|
var AdminAsyncAction;
|
|
174
185
|
(function (AdminAsyncAction) {
|
|
175
186
|
let repo;
|
|
@@ -203,6 +214,17 @@ var AdminTask;
|
|
|
203
214
|
}
|
|
204
215
|
AdminTask.createInstance = createInstance;
|
|
205
216
|
})(AdminTask || (exports.AdminTask = AdminTask = {}));
|
|
217
|
+
var AdminTransaction;
|
|
218
|
+
(function (AdminTransaction) {
|
|
219
|
+
let repo;
|
|
220
|
+
async function createInstance(...params) {
|
|
221
|
+
if (repo === undefined) {
|
|
222
|
+
repo = (await import('./repo/adminTransaction.js')).AdminTransactionRepo;
|
|
223
|
+
}
|
|
224
|
+
return new repo(...params);
|
|
225
|
+
}
|
|
226
|
+
AdminTransaction.createInstance = createInstance;
|
|
227
|
+
})(AdminTransaction || (exports.AdminTransaction = AdminTransaction = {}));
|
|
206
228
|
var AggregateAction;
|
|
207
229
|
(function (AggregateAction) {
|
|
208
230
|
let repo;
|
|
@@ -236,6 +258,28 @@ var AggregateTask;
|
|
|
236
258
|
}
|
|
237
259
|
AggregateTask.createInstance = createInstance;
|
|
238
260
|
})(AggregateTask || (exports.AggregateTask = AggregateTask = {}));
|
|
261
|
+
var AggregateTransaction;
|
|
262
|
+
(function (AggregateTransaction) {
|
|
263
|
+
let repo;
|
|
264
|
+
async function createInstance(...params) {
|
|
265
|
+
if (repo === undefined) {
|
|
266
|
+
repo = (await import('./repo/aggregateTransaction.js')).AggregateTransactionRepo;
|
|
267
|
+
}
|
|
268
|
+
return new repo(...params);
|
|
269
|
+
}
|
|
270
|
+
AggregateTransaction.createInstance = createInstance;
|
|
271
|
+
})(AggregateTransaction || (exports.AggregateTransaction = AggregateTransaction = {}));
|
|
272
|
+
var AggregateAssetTransaction;
|
|
273
|
+
(function (AggregateAssetTransaction) {
|
|
274
|
+
let repo;
|
|
275
|
+
async function createInstance(...params) {
|
|
276
|
+
if (repo === undefined) {
|
|
277
|
+
repo = (await import('./repo/aggregateAssetTransaction.js')).AggregateAssetTransactionRepo;
|
|
278
|
+
}
|
|
279
|
+
return new repo(...params);
|
|
280
|
+
}
|
|
281
|
+
AggregateAssetTransaction.createInstance = createInstance;
|
|
282
|
+
})(AggregateAssetTransaction || (exports.AggregateAssetTransaction = AggregateAssetTransaction = {}));
|
|
239
283
|
var AggregateOffer;
|
|
240
284
|
(function (AggregateOffer) {
|
|
241
285
|
let repo;
|
|
@@ -624,17 +668,6 @@ var OrderNumber;
|
|
|
624
668
|
}
|
|
625
669
|
OrderNumber.createInstance = createInstance;
|
|
626
670
|
})(OrderNumber || (exports.OrderNumber = OrderNumber = {}));
|
|
627
|
-
var OwnershipInfo;
|
|
628
|
-
(function (OwnershipInfo) {
|
|
629
|
-
let repo;
|
|
630
|
-
async function createInstance(...params) {
|
|
631
|
-
if (repo === undefined) {
|
|
632
|
-
repo = (await import('./repo/ownershipInfo.js')).OwnershipInfoRepo;
|
|
633
|
-
}
|
|
634
|
-
return new repo(...params);
|
|
635
|
-
}
|
|
636
|
-
OwnershipInfo.createInstance = createInstance;
|
|
637
|
-
})(OwnershipInfo || (exports.OwnershipInfo = OwnershipInfo = {}));
|
|
638
671
|
var Passport;
|
|
639
672
|
(function (Passport) {
|
|
640
673
|
let repo;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { AggregateActionRepo } from '../../repo/aggregateAction';
|
|
2
|
+
import type { AggregateAssetTransactionRepo } from '../../repo/aggregateAssetTransaction';
|
|
2
3
|
import type { AggregateScheduledTaskRepo } from '../../repo/aggregateScheduledTask';
|
|
3
4
|
import type { AggregateTaskRepo } from '../../repo/aggregateTask';
|
|
4
|
-
import {
|
|
5
|
-
import type {
|
|
5
|
+
import type { AggregateTransactionRepo } from '../../repo/aggregateTransaction';
|
|
6
|
+
import type { AggregationRepo } from '../../repo/aggregation';
|
|
6
7
|
import type { EventRepo } from '../../repo/event';
|
|
7
|
-
import { OrderRepo } from '../../repo/order';
|
|
8
|
-
import type { TransactionRepo } from '../../repo/transaction';
|
|
8
|
+
import type { OrderRepo } from '../../repo/order';
|
|
9
9
|
type AggregateDurationUnit = 'days' | 'hours';
|
|
10
10
|
interface IAggregateParams {
|
|
11
11
|
aggregateDate: Date;
|
|
@@ -37,7 +37,7 @@ declare function aggregatePlaceOrder(params: IAggregateParams & {
|
|
|
37
37
|
clientIds?: string[];
|
|
38
38
|
}): (repos: {
|
|
39
39
|
agregation: AggregationRepo;
|
|
40
|
-
|
|
40
|
+
aggregateTransaction: AggregateTransactionRepo;
|
|
41
41
|
}) => Promise<{
|
|
42
42
|
aggregationCount: number;
|
|
43
43
|
aggregateDuration: string;
|
|
@@ -125,7 +125,7 @@ declare function aggregatePayMovieTicketAction(params: IAggregateParams): (repos
|
|
|
125
125
|
}>;
|
|
126
126
|
declare function aggregatePayTransaction(params: IAggregateParams): (repos: {
|
|
127
127
|
agregation: AggregationRepo;
|
|
128
|
-
|
|
128
|
+
aggregateAssetTransaction: AggregateAssetTransactionRepo;
|
|
129
129
|
}) => Promise<{
|
|
130
130
|
aggregationCount: number;
|
|
131
131
|
aggregateDuration: string;
|
|
@@ -135,7 +135,7 @@ declare function aggregatePayTransaction(params: IAggregateParams): (repos: {
|
|
|
135
135
|
*/
|
|
136
136
|
declare function aggregateReserveTransaction(params: IAggregateParams): (repos: {
|
|
137
137
|
agregation: AggregationRepo;
|
|
138
|
-
|
|
138
|
+
aggregateAssetTransaction: AggregateAssetTransactionRepo;
|
|
139
139
|
}) => Promise<{
|
|
140
140
|
aggregationCount: number;
|
|
141
141
|
aggregateDuration: string;
|
|
@@ -134,7 +134,7 @@ function aggregatePlaceOrder(params) {
|
|
|
134
134
|
.add(-i, params.aggregateDurationUnit)
|
|
135
135
|
.endOf(params.aggregateDurationUnit)
|
|
136
136
|
.toDate();
|
|
137
|
-
const aggregateResult = await repos.
|
|
137
|
+
const aggregateResult = await repos.aggregateTransaction.aggregatePlaceOrder({
|
|
138
138
|
project: { id: { $ne: params.excludedProjectId } },
|
|
139
139
|
startFrom,
|
|
140
140
|
startThrough,
|
|
@@ -144,7 +144,7 @@ function aggregatePlaceOrder(params) {
|
|
|
144
144
|
const aggregateResultsByClientId = [];
|
|
145
145
|
if (Array.isArray(params.clientIds)) {
|
|
146
146
|
for (const clientId of params.clientIds) {
|
|
147
|
-
const aggregateResultByClientId = await repos.
|
|
147
|
+
const aggregateResultByClientId = await repos.aggregateTransaction.aggregatePlaceOrder({
|
|
148
148
|
project: { id: { $ne: params.excludedProjectId } },
|
|
149
149
|
startFrom,
|
|
150
150
|
startThrough,
|
|
@@ -587,7 +587,7 @@ function aggregatePayTransaction(params) {
|
|
|
587
587
|
.add(-i, params.aggregateDurationUnit)
|
|
588
588
|
.endOf(params.aggregateDurationUnit)
|
|
589
589
|
.toDate();
|
|
590
|
-
const aggregateResult = await repos.
|
|
590
|
+
const aggregateResult = await repos.aggregateAssetTransaction.aggregateAssetTransaction({
|
|
591
591
|
project: { id: { $ne: params.excludedProjectId } },
|
|
592
592
|
startFrom,
|
|
593
593
|
startThrough,
|
|
@@ -632,7 +632,7 @@ function aggregateReserveTransaction(params) {
|
|
|
632
632
|
.add(-i, params.aggregateDurationUnit)
|
|
633
633
|
.endOf(params.aggregateDurationUnit)
|
|
634
634
|
.toDate();
|
|
635
|
-
const aggregateResult = await repos.
|
|
635
|
+
const aggregateResult = await repos.aggregateAssetTransaction.aggregateAssetTransaction({
|
|
636
636
|
project: { id: { $ne: params.excludedProjectId } },
|
|
637
637
|
startFrom,
|
|
638
638
|
startThrough,
|