@chevre/domain 22.11.0-alpha.3 → 22.11.0-alpha.30
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/example/src/chevre/aggregation/aggregateTasks.ts +41 -0
- package/example/src/chevre/assetTransaction/processReserve.ts +0 -1
- package/example/src/chevre/notifyAbortedTasksByEmail.ts +1 -1
- package/example/src/chevre/reIndex.ts +1 -1
- package/example/src/chevre/roles/addAdminPermissionIfNotExists.ts +132 -0
- package/example/src/chevre/roles/addDefaultPermissionIfNotExists.ts +37 -0
- package/example/src/chevre/roles/addEventOfferPermissionIfNotExists.ts +27 -0
- package/example/src/chevre/roles/addPermissionIfNotExists.ts +39 -6
- package/example/src/chevre/roles/addProjectCreatorRole.ts +48 -0
- package/example/src/chevre/roles/assignGlobalRoles.ts +72 -0
- package/example/src/chevre/roles/findPermissions.ts +84 -0
- package/example/src/chevre/roles/findRoleNames.ts +117 -0
- package/example/src/chevre/roles/removeConsolePermissionIfExists.ts +38 -0
- package/example/src/chevre/roles/removePermissionFromAPIRoles.ts +46 -0
- package/example/src/chevre/roles/removePermissionIfExists.ts +39 -0
- package/example/src/chevre/settings/addSettings.ts +31 -17
- package/example/src/chevre/stockHolder/checkRedisKeyCount.ts +11 -20
- package/example/src/chevre/task/countPotentiallyRunning.ts +41 -0
- package/example/src/chevre/task/countTasks.ts +51 -0
- package/example/src/chevre/unsetUnnecessaryFields.ts +8 -5
- package/example/src/idaas/auth0/adminApplications.ts +183 -0
- package/example/src/idaas/auth0/getToken.ts +55 -0
- package/example/src/idaas/auth0/getTokenByPrivateKeyJWT.ts +84 -0
- package/example/src/regex.ts +31 -0
- package/lib/chevre/eventEmitter/task.d.ts +29 -6
- package/lib/chevre/index.d.ts +0 -2
- package/lib/chevre/index.js +0 -10
- package/lib/chevre/repo/confirmationNumber.d.ts +0 -11
- package/lib/chevre/repo/confirmationNumber.js +15 -54
- package/lib/chevre/repo/identity.d.ts +11 -33
- package/lib/chevre/repo/identity.js +10 -15
- package/lib/chevre/repo/member.d.ts +22 -4
- package/lib/chevre/repo/member.js +81 -27
- package/lib/chevre/repo/mongoose/schemas/identity.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/member/global.d.ts +14 -0
- package/lib/chevre/repo/mongoose/schemas/member/global.js +82 -0
- package/lib/chevre/repo/mongoose/schemas/setting.d.ts +15 -0
- package/lib/chevre/repo/mongoose/schemas/setting.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/task.js +9 -0
- package/lib/chevre/repo/orderNumber.d.ts +0 -11
- package/lib/chevre/repo/orderNumber.js +13 -51
- package/lib/chevre/repo/role.d.ts +16 -4
- package/lib/chevre/repo/role.js +71 -32
- package/lib/chevre/repo/serviceOutputIdentifier.d.ts +0 -4
- package/lib/chevre/repo/serviceOutputIdentifier.js +13 -38
- package/lib/chevre/repo/setting.d.ts +5 -10
- package/lib/chevre/repo/setting.js +4 -7
- package/lib/chevre/repo/stockHolder.js +0 -11
- package/lib/chevre/repo/task.d.ts +47 -34
- package/lib/chevre/repo/task.js +116 -292
- package/lib/chevre/repo/transaction.js +10 -10
- package/lib/chevre/repo/transactionNumber.d.ts +0 -11
- package/lib/chevre/repo/transactionNumber.js +13 -51
- package/lib/chevre/repo/transactionNumberCounter.d.ts +0 -10
- package/lib/chevre/repo/transactionNumberCounter.js +34 -29
- package/lib/chevre/service/assetTransaction/cancelReservation/start.d.ts +1 -1
- package/lib/chevre/service/code.d.ts +5 -28
- package/lib/chevre/service/code.js +3 -79
- package/lib/chevre/service/iam.d.ts +17 -7
- package/lib/chevre/service/iam.js +26 -6
- package/lib/chevre/service/notification/notifyAbortedTasksByEmail.d.ts +15 -0
- package/lib/chevre/service/notification/notifyAbortedTasksByEmail.js +38 -0
- package/lib/chevre/service/notification.d.ts +2 -1
- package/lib/chevre/service/notification.js +3 -1
- package/lib/chevre/service/task/acceptCOAOffer.d.ts +1 -1
- package/lib/chevre/service/task/acceptCOAOffer.js +6 -5
- package/lib/chevre/service/task/aggregateOffers.d.ts +1 -1
- package/lib/chevre/service/task/aggregateOnSystem.d.ts +4 -2
- package/lib/chevre/service/task/aggregateScreeningEvent.d.ts +1 -1
- package/lib/chevre/service/task/authorizePayment.d.ts +1 -1
- package/lib/chevre/service/task/authorizePayment.js +7 -6
- package/lib/chevre/service/task/cancelMoneyTransfer.d.ts +1 -1
- package/lib/chevre/service/task/cancelPendingReservation.d.ts +1 -1
- package/lib/chevre/service/task/cancelReservation.d.ts +1 -1
- package/lib/chevre/service/task/checkMovieTicket.d.ts +1 -1
- package/lib/chevre/service/task/checkMovieTicket.js +4 -3
- package/lib/chevre/service/task/checkResource.d.ts +1 -1
- package/lib/chevre/service/task/confirmMoneyTransfer.d.ts +1 -1
- package/lib/chevre/service/task/confirmPayTransaction.d.ts +1 -1
- package/lib/chevre/service/task/confirmRegisterService.d.ts +1 -1
- package/lib/chevre/service/task/confirmRegisterServiceTransaction.d.ts +1 -1
- package/lib/chevre/service/task/confirmReserveTransaction.d.ts +1 -1
- package/lib/chevre/service/task/createAccountingReport.d.ts +1 -1
- package/lib/chevre/service/task/createEvent.d.ts +1 -1
- package/lib/chevre/service/task/deletePerson.d.ts +1 -1
- package/lib/chevre/service/task/deleteTransaction.d.ts +1 -1
- package/lib/chevre/service/task/givePointAward.d.ts +1 -1
- package/lib/chevre/service/task/givePointAward.js +1 -1
- package/lib/chevre/service/task/handleNotification.d.ts +4 -2
- package/lib/chevre/service/task/importEventCapacitiesFromCOA.d.ts +1 -1
- package/lib/chevre/service/task/importEventsFromCOA.d.ts +1 -1
- package/lib/chevre/service/task/importOffersFromCOA.d.ts +1 -1
- package/lib/chevre/service/task/invalidatePaymentUrl.d.ts +1 -1
- package/lib/chevre/service/task/moneyTransfer.d.ts +1 -1
- package/lib/chevre/service/task/moneyTransfer.js +1 -1
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.d.ts +1 -1
- package/lib/chevre/service/task/onAuthorizationCreated.d.ts +1 -1
- package/lib/chevre/service/task/onEventChanged.d.ts +1 -1
- package/lib/chevre/service/task/onOrderPaymentCompleted.d.ts +1 -1
- package/lib/chevre/service/task/onResourceUpdated.d.ts +1 -1
- package/lib/chevre/service/task/pay.d.ts +1 -1
- package/lib/chevre/service/task/placeOrder.d.ts +1 -1
- package/lib/chevre/service/task/publishPaymentUrl.d.ts +1 -1
- package/lib/chevre/service/task/publishPaymentUrl.js +6 -7
- package/lib/chevre/service/task/refund.d.ts +1 -1
- package/lib/chevre/service/task/refund.js +1 -1
- package/lib/chevre/service/task/registerService.d.ts +1 -1
- package/lib/chevre/service/task/reserve.d.ts +1 -1
- package/lib/chevre/service/task/returnMoneyTransfer.d.ts +1 -1
- package/lib/chevre/service/task/returnMoneyTransfer.js +1 -1
- package/lib/chevre/service/task/returnOrder.d.ts +1 -1
- package/lib/chevre/service/task/returnPayTransaction.d.ts +1 -1
- package/lib/chevre/service/task/returnPayTransaction.js +1 -1
- package/lib/chevre/service/task/returnPointAward.d.ts +1 -1
- package/lib/chevre/service/task/returnPointAward.js +1 -1
- package/lib/chevre/service/task/returnReserveTransaction.d.ts +1 -1
- package/lib/chevre/service/task/returnReserveTransaction.js +1 -1
- package/lib/chevre/service/task/sendEmailMessage.d.ts +1 -1
- package/lib/chevre/service/task/sendOrder.d.ts +1 -1
- package/lib/chevre/service/task/triggerWebhook.d.ts +1 -1
- package/lib/chevre/service/task/useReservation.d.ts +1 -1
- package/lib/chevre/service/task/voidMoneyTransferTransaction.d.ts +1 -1
- package/lib/chevre/service/task/voidPayTransaction.d.ts +1 -1
- package/lib/chevre/service/task/voidPayment.d.ts +1 -1
- package/lib/chevre/service/task/voidRegisterServiceTransaction.d.ts +1 -1
- package/lib/chevre/service/task/voidReserveTransaction.d.ts +1 -1
- package/lib/chevre/service/task/voidReserveTransaction.js +4 -3
- package/lib/chevre/service/task.d.ts +7 -29
- package/lib/chevre/service/task.js +9 -114
- package/lib/chevre/service/taskHandler/onOperationFailed/informTaskIfNeeded.d.ts +11 -0
- package/lib/chevre/service/taskHandler/onOperationFailed/informTaskIfNeeded.js +105 -0
- package/lib/chevre/service/taskHandler/onOperationFailed.d.ts +17 -0
- package/lib/chevre/service/taskHandler/onOperationFailed.js +70 -0
- package/lib/chevre/service/taskHandler.d.ts +26 -0
- package/lib/chevre/service/taskHandler.js +96 -0
- package/lib/chevre/service/validation/validateOrder.js +55 -37
- package/lib/chevre/service.d.ts +0 -4
- package/lib/chevre/service.js +10 -14
- package/lib/chevre/settings/aggregation.d.ts +6 -1
- package/lib/chevre/settings/aggregation.js +2 -1
- package/package.json +5 -3
- package/example/src/chevre/adminAuth/adminIdentity.ts +0 -38
- package/example/src/chevre/executeOneTask.ts +0 -41
- package/example/src/chevre/executeTaskIfExists.ts +0 -80
- package/example/src/chevre/findExecutableTask.ts +0 -50
- package/example/src/chevre/findSetting.ts +0 -79
- package/example/src/chevre/roles/addRoleMembers.ts +0 -75
- package/example/src/chevre/searchPermissions.ts +0 -46
- package/example/src/chevre/transactionNumber/publishConfimationNumber.ts +0 -37
- package/example/src/chevre/transactionNumber/publishOrderNumber.ts +0 -40
- package/example/src/chevre/transactionNumber/setUseMongo4confirmationNumberFrom.ts +0 -45
- package/example/src/chevre/transactionNumber/setUseMongo4orderNumberFrom.ts +0 -41
- package/example/src/chevre/transactionNumber/setUseMongo4transactionNumberFrom.ts +0 -41
- package/lib/chevre/adminAuth.d.ts +0 -2
- package/lib/chevre/adminAuth.js +0 -6
package/lib/chevre/repo/task.js
CHANGED
|
@@ -30,10 +30,10 @@ const task_2 = require("./mongoose/schemas/task");
|
|
|
30
30
|
/**
|
|
31
31
|
* タスク実行時のソート条件
|
|
32
32
|
*/
|
|
33
|
-
const sortOrder4executionOfTasks = {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
};
|
|
33
|
+
// const sortOrder4executionOfTasks: { [key in keyof factory.task.IAttributes<factory.taskName>]?: factory.sortType } = {
|
|
34
|
+
// numberOfTried: factory.sortType.Ascending, // トライ回数の少なさ優先
|
|
35
|
+
// runsAt: factory.sortType.Ascending // 実行予定日時の早さ優先
|
|
36
|
+
// };
|
|
37
37
|
const executableTaskProjection = {
|
|
38
38
|
_id: 0,
|
|
39
39
|
id: { $toString: '$_id' },
|
|
@@ -242,48 +242,6 @@ class TaskRepo {
|
|
|
242
242
|
return { id, status };
|
|
243
243
|
});
|
|
244
244
|
}
|
|
245
|
-
// public async createIfNotExistByIdentifier(
|
|
246
|
-
// params: factory.task.IAttributes<factory.taskName> & {
|
|
247
|
-
// // resolve uniqueness of identifier(2025-03-27~)
|
|
248
|
-
// identifier: string;
|
|
249
|
-
// },
|
|
250
|
-
// options: IOptionOnCreate
|
|
251
|
-
// ): Promise<void> {
|
|
252
|
-
// if (typeof params.identifier !== 'string' || params.identifier.length === 0) {
|
|
253
|
-
// throw new factory.errors.ArgumentNull('identifier');
|
|
254
|
-
// }
|
|
255
|
-
// try {
|
|
256
|
-
// const createdTask = await this.taskModel.findOneAndUpdate(
|
|
257
|
-
// {
|
|
258
|
-
// 'project.id': { $eq: params.project.id },
|
|
259
|
-
// name: { $eq: params.name },
|
|
260
|
-
// identifier: { $exists: true, $eq: params.identifier }
|
|
261
|
-
// },
|
|
262
|
-
// { $setOnInsert: params },
|
|
263
|
-
// { new: true, upsert: true }
|
|
264
|
-
// )
|
|
265
|
-
// .select({ _id: 1 })
|
|
266
|
-
// .exec();
|
|
267
|
-
// if (options.emitImmediately) {
|
|
268
|
-
// taskEventEmitter.emitTaskStatusChanged({
|
|
269
|
-
// id: createdTask.id,
|
|
270
|
-
// name: params.name,
|
|
271
|
-
// status: factory.taskStatus.Ready
|
|
272
|
-
// });
|
|
273
|
-
// }
|
|
274
|
-
// } catch (error) {
|
|
275
|
-
// let throwsError = true;
|
|
276
|
-
// if (await isMongoError(error)) {
|
|
277
|
-
// // すでにidentifierが存在する場合ok
|
|
278
|
-
// if (error.code === MongoErrorCode.DuplicateKey) {
|
|
279
|
-
// throwsError = false;
|
|
280
|
-
// }
|
|
281
|
-
// }
|
|
282
|
-
// if (throwsError) {
|
|
283
|
-
// throw error;
|
|
284
|
-
// }
|
|
285
|
-
// }
|
|
286
|
-
// }
|
|
287
245
|
/**
|
|
288
246
|
* タスク識別子から冪等作成する
|
|
289
247
|
* reimplement createIfNotExistByIdentifier(2025-03-28~)
|
|
@@ -341,40 +299,6 @@ class TaskRepo {
|
|
|
341
299
|
}
|
|
342
300
|
});
|
|
343
301
|
}
|
|
344
|
-
// public async createInformTaskIfNotExist(
|
|
345
|
-
// // resolve uniqueness of identifier(2025-03-27~)
|
|
346
|
-
// params: Pick<
|
|
347
|
-
// factory.task.IAttributes<factory.taskName.TriggerWebhook>,
|
|
348
|
-
// 'data' | 'executionResults' | 'name' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt' | 'status'
|
|
349
|
-
// > & {
|
|
350
|
-
// data: factory.task.triggerWebhook.IInformAnyResourceAction & {
|
|
351
|
-
// object: factory.notification.person.IPersonAsNotification;
|
|
352
|
-
// };
|
|
353
|
-
// },
|
|
354
|
-
// options: IOptionOnCreate
|
|
355
|
-
// ): Promise<void> {
|
|
356
|
-
// const createdTask = await this.taskModel.findOneAndUpdate(
|
|
357
|
-
// {
|
|
358
|
-
// 'project.id': { $eq: params.project.id },
|
|
359
|
-
// name: params.name,
|
|
360
|
-
// 'data.object.id': {
|
|
361
|
-
// $exists: true,
|
|
362
|
-
// $eq: String(params.data.object.id)
|
|
363
|
-
// }
|
|
364
|
-
// },
|
|
365
|
-
// { $setOnInsert: params },
|
|
366
|
-
// { new: true, upsert: true }
|
|
367
|
-
// )
|
|
368
|
-
// .select({ _id: 1 })
|
|
369
|
-
// .exec();
|
|
370
|
-
// if (options.emitImmediately) {
|
|
371
|
-
// taskEventEmitter.emitTaskStatusChanged({
|
|
372
|
-
// id: createdTask.id,
|
|
373
|
-
// name: params.name,
|
|
374
|
-
// status: factory.taskStatus.Ready
|
|
375
|
-
// });
|
|
376
|
-
// }
|
|
377
|
-
// }
|
|
378
302
|
/**
|
|
379
303
|
* 取引削除タスク冪等作成
|
|
380
304
|
*/
|
|
@@ -401,36 +325,6 @@ class TaskRepo {
|
|
|
401
325
|
}
|
|
402
326
|
});
|
|
403
327
|
}
|
|
404
|
-
// public async createConfirmReserveTransactionTaskIfNotExist(
|
|
405
|
-
// params: factory.task.IAttributes<factory.taskName.ConfirmReserveTransaction>,
|
|
406
|
-
// options: IOptionOnCreate
|
|
407
|
-
// ): Promise<void> {
|
|
408
|
-
// const createdTask = await this.taskModel.findOneAndUpdate(
|
|
409
|
-
// {
|
|
410
|
-
// 'project.id': { $eq: params.project.id },
|
|
411
|
-
// name: { $eq: params.name },
|
|
412
|
-
// 'data.object.transactionNumber': {
|
|
413
|
-
// $exists: true,
|
|
414
|
-
// $eq: String(params.data.object.transactionNumber)
|
|
415
|
-
// },
|
|
416
|
-
// 'data.purpose.orderNumber': {
|
|
417
|
-
// $exists: true,
|
|
418
|
-
// $eq: String(params.data.purpose.orderNumber)
|
|
419
|
-
// }
|
|
420
|
-
// },
|
|
421
|
-
// { $setOnInsert: params },
|
|
422
|
-
// { new: true, upsert: true }
|
|
423
|
-
// )
|
|
424
|
-
// .select({ _id: 1 })
|
|
425
|
-
// .exec();
|
|
426
|
-
// if (options.emitImmediately) {
|
|
427
|
-
// taskEventEmitter.emitTaskStatusChanged({
|
|
428
|
-
// id: createdTask.id,
|
|
429
|
-
// name: params.name,
|
|
430
|
-
// status: factory.taskStatus.Ready
|
|
431
|
-
// });
|
|
432
|
-
// }
|
|
433
|
-
// }
|
|
434
328
|
createOnAssetTransactionStatusChangedTaskIfNotExist(
|
|
435
329
|
// resolve uniqueness of identifier(2025-03-27~)
|
|
436
330
|
params, options) {
|
|
@@ -458,6 +352,10 @@ class TaskRepo {
|
|
|
458
352
|
}
|
|
459
353
|
});
|
|
460
354
|
}
|
|
355
|
+
/**
|
|
356
|
+
* Ready -> remainingNumberOfTriesが1減る
|
|
357
|
+
* Running -> findOneするだけ
|
|
358
|
+
*/
|
|
461
359
|
executeOneById(params) {
|
|
462
360
|
return __awaiter(this, void 0, void 0, function* () {
|
|
463
361
|
const now = new Date();
|
|
@@ -492,19 +390,21 @@ class TaskRepo {
|
|
|
492
390
|
});
|
|
493
391
|
}
|
|
494
392
|
/**
|
|
495
|
-
*
|
|
393
|
+
* Readyのタスクをname指定でひとつRunningに変更する
|
|
496
394
|
*/
|
|
497
395
|
executeOneIfExists(params) {
|
|
498
396
|
return __awaiter(this, void 0, void 0, function* () {
|
|
499
|
-
var _a
|
|
397
|
+
var _a;
|
|
500
398
|
if (!(params.runsAt.$lt instanceof Date)) {
|
|
501
399
|
throw new factory.errors.Argument('runsAt.$lt', 'must be Date');
|
|
502
400
|
}
|
|
503
401
|
const nameEq = (_a = params.name) === null || _a === void 0 ? void 0 : _a.$eq;
|
|
504
|
-
const nameNin =
|
|
505
|
-
const doc = yield this.taskModel.findOneAndUpdate(Object.assign({ status: { $eq: factory.taskStatus.Ready }, runsAt: { $lt: params.runsAt.$lt } }, (typeof nameEq === 'string'
|
|
402
|
+
// const nameNin = params.name?.$nin;
|
|
403
|
+
const doc = yield this.taskModel.findOneAndUpdate(Object.assign({ status: { $eq: factory.taskStatus.Ready }, runsAt: { $lt: params.runsAt.$lt } }, (typeof nameEq === 'string')
|
|
506
404
|
? {
|
|
507
|
-
name: Object.assign(
|
|
405
|
+
name: Object.assign({}, (typeof nameEq === 'string') ? { $eq: nameEq } : undefined
|
|
406
|
+
// ...(Array.isArray(nameNin)) ? { $nin: nameNin } : undefined
|
|
407
|
+
)
|
|
508
408
|
}
|
|
509
409
|
: undefined), {
|
|
510
410
|
$set: {
|
|
@@ -516,8 +416,9 @@ class TaskRepo {
|
|
|
516
416
|
remainingNumberOfTries: -1, // 残りトライ可能回数減らす
|
|
517
417
|
numberOfTried: 1 // トライ回数増やす
|
|
518
418
|
}
|
|
519
|
-
}, { new: true, projection: executableTaskProjection })
|
|
520
|
-
.sort
|
|
419
|
+
}, Object.assign({ new: true, projection: executableTaskProjection }, (typeof params.sort.numberOfTried === 'number' || typeof params.sort.runsAt === 'number')
|
|
420
|
+
? { sort: params.sort }
|
|
421
|
+
: undefined))
|
|
521
422
|
.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
522
423
|
.lean() // lean(2024-09-26~)
|
|
523
424
|
.exec();
|
|
@@ -535,13 +436,14 @@ class TaskRepo {
|
|
|
535
436
|
return __awaiter(this, void 0, void 0, function* () {
|
|
536
437
|
const { runsAt, limit, name } = params;
|
|
537
438
|
const nameEq = name === null || name === void 0 ? void 0 : name.$eq;
|
|
538
|
-
const nameNin = name
|
|
439
|
+
// const nameNin = name?.$nin;
|
|
440
|
+
const nameIn = name === null || name === void 0 ? void 0 : name.$in;
|
|
539
441
|
if (!(runsAt.$lt instanceof Date)) {
|
|
540
442
|
throw new factory.errors.Argument('runsAt.$lt', 'must be Date');
|
|
541
443
|
}
|
|
542
|
-
const query = this.taskModel.countDocuments(Object.assign({ status: { $eq: factory.taskStatus.Ready }, runsAt: { $lt: params.runsAt.$lt } }, (typeof nameEq === 'string' || Array.isArray(
|
|
444
|
+
const query = this.taskModel.countDocuments(Object.assign({ status: { $eq: factory.taskStatus.Ready }, runsAt: { $lt: params.runsAt.$lt } }, (typeof nameEq === 'string' || Array.isArray(nameIn))
|
|
543
445
|
? {
|
|
544
|
-
name: Object.assign(Object.assign({}, (typeof nameEq === 'string') ? { $eq: nameEq } : undefined), (Array.isArray(
|
|
446
|
+
name: Object.assign(Object.assign({}, (typeof nameEq === 'string') ? { $eq: nameEq } : undefined), (Array.isArray(nameIn)) ? { $in: nameIn } : undefined)
|
|
545
447
|
}
|
|
546
448
|
: undefined));
|
|
547
449
|
if (typeof limit === 'number' && limit >= 0) {
|
|
@@ -552,7 +454,11 @@ class TaskRepo {
|
|
|
552
454
|
return { count };
|
|
553
455
|
});
|
|
554
456
|
}
|
|
555
|
-
|
|
457
|
+
/**
|
|
458
|
+
* 実行日時を一定期間過ぎたReadyタスクについて、Runningスタータスに変更した上で、Runningイベントを発生させる
|
|
459
|
+
*/
|
|
460
|
+
emitRunningIfExists(params, next // support next function(2025-08-02~)
|
|
461
|
+
) {
|
|
556
462
|
return __awaiter(this, void 0, void 0, function* () {
|
|
557
463
|
var _a, _b;
|
|
558
464
|
if (!(params.runsAt.$lt instanceof Date)) {
|
|
@@ -564,10 +470,11 @@ class TaskRepo {
|
|
|
564
470
|
name: 1
|
|
565
471
|
};
|
|
566
472
|
const nameEq = (_a = params.name) === null || _a === void 0 ? void 0 : _a.$eq;
|
|
567
|
-
const nameNin =
|
|
568
|
-
const
|
|
473
|
+
// const nameNin = params.name?.$nin;
|
|
474
|
+
const nameIn = (_b = params.name) === null || _b === void 0 ? void 0 : _b.$in;
|
|
475
|
+
const doc = yield this.taskModel.findOneAndUpdate(Object.assign({ status: { $eq: factory.taskStatus.Ready }, runsAt: { $lt: params.runsAt.$lt } }, (typeof nameEq === 'string' || Array.isArray(nameIn))
|
|
569
476
|
? {
|
|
570
|
-
name: Object.assign(Object.assign({}, (typeof nameEq === 'string') ? { $eq: nameEq } : undefined), (Array.isArray(
|
|
477
|
+
name: Object.assign(Object.assign({}, (typeof nameEq === 'string') ? { $eq: nameEq } : undefined), (Array.isArray(nameIn)) ? { $in: nameIn } : undefined)
|
|
571
478
|
}
|
|
572
479
|
: undefined), {
|
|
573
480
|
$set: {
|
|
@@ -579,8 +486,9 @@ class TaskRepo {
|
|
|
579
486
|
remainingNumberOfTries: -1, // 残りトライ可能回数減らす
|
|
580
487
|
numberOfTried: 1 // トライ回数増やす
|
|
581
488
|
}
|
|
582
|
-
}, { new: true, projection })
|
|
583
|
-
|
|
489
|
+
}, Object.assign({ new: true, projection }, (typeof params.sort.numberOfTried === 'number' || typeof params.sort.runsAt === 'number')
|
|
490
|
+
? { sort: params.sort }
|
|
491
|
+
: undefined))
|
|
584
492
|
.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
585
493
|
.lean()
|
|
586
494
|
.exec();
|
|
@@ -588,101 +496,26 @@ class TaskRepo {
|
|
|
588
496
|
// tslint:disable-next-line:no-null-keyword
|
|
589
497
|
return null;
|
|
590
498
|
}
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
findExecutableOne(params) {
|
|
599
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
600
|
-
var _a, _b;
|
|
601
|
-
if (!(params.runsAt.$lt instanceof Date)) {
|
|
602
|
-
throw new factory.errors.Argument('runsAt.$lt', 'must be Date');
|
|
499
|
+
let changedTask;
|
|
500
|
+
if (typeof nameEq === 'string') {
|
|
501
|
+
changedTask = {
|
|
502
|
+
id: doc.id,
|
|
503
|
+
status: factory.taskStatus.Running,
|
|
504
|
+
name: nameEq
|
|
505
|
+
};
|
|
603
506
|
}
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
}
|
|
610
|
-
: undefined), executableTaskProjection)
|
|
611
|
-
.sort({
|
|
612
|
-
runsAt: factory.sortType.Ascending
|
|
613
|
-
});
|
|
614
|
-
// .hint('executeOneByName');
|
|
615
|
-
// const explainResult = await query.explain();
|
|
616
|
-
// console.dir(explainResult, { depth: null });
|
|
617
|
-
// console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
|
|
618
|
-
const doc = yield query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
619
|
-
.lean()
|
|
620
|
-
.exec();
|
|
621
|
-
if (doc === null) {
|
|
622
|
-
// tslint:disable-next-line:no-null-keyword
|
|
623
|
-
return null;
|
|
507
|
+
else {
|
|
508
|
+
changedTask = {
|
|
509
|
+
id: doc.id,
|
|
510
|
+
status: factory.taskStatus.Running
|
|
511
|
+
};
|
|
624
512
|
}
|
|
513
|
+
task_1.taskEventEmitter.emitTaskStatusChanged(changedTask, (typeof next === 'function') ? next : undefined);
|
|
625
514
|
return doc;
|
|
626
515
|
});
|
|
627
516
|
}
|
|
628
|
-
// discontinue(2025-05-26~)
|
|
629
|
-
/**
|
|
630
|
-
* emit OnTaskStatusChanged on delayed tasks
|
|
631
|
-
*/
|
|
632
|
-
// public async emitDelayedTasksEvent(params: {
|
|
633
|
-
// now: Date;
|
|
634
|
-
// /**
|
|
635
|
-
// * 指定期間遅延しているタスクを実行する
|
|
636
|
-
// */
|
|
637
|
-
// delayInSeconds: number;
|
|
638
|
-
// limit: number;
|
|
639
|
-
// name: {
|
|
640
|
-
// /**
|
|
641
|
-
// * 指定タスクのみ実行する
|
|
642
|
-
// */
|
|
643
|
-
// $in?: factory.taskName[];
|
|
644
|
-
// /**
|
|
645
|
-
// * 指定タスク以外のみ実行する
|
|
646
|
-
// */
|
|
647
|
-
// $nin?: factory.taskName[];
|
|
648
|
-
// };
|
|
649
|
-
// }) {
|
|
650
|
-
// const runsAtLt = moment(params.now)
|
|
651
|
-
// .add(-params.delayInSeconds, 'seconds')
|
|
652
|
-
// .toDate();
|
|
653
|
-
// const projection: ProjectionType<factory.task.ITask<factory.taskName>> = {
|
|
654
|
-
// _id: 0,
|
|
655
|
-
// id: { $toString: '$_id' },
|
|
656
|
-
// name: 1,
|
|
657
|
-
// status: 1
|
|
658
|
-
// };
|
|
659
|
-
// const delayedTasks = await this.taskModel.find(
|
|
660
|
-
// {
|
|
661
|
-
// status: { $eq: factory.taskStatus.Ready },
|
|
662
|
-
// runsAt: { $lt: runsAtLt },
|
|
663
|
-
// ...(Array.isArray(params.name.$in)) ? { name: { $in: params.name.$in } } : undefined,
|
|
664
|
-
// ...(Array.isArray(params.name.$nin)) ? { name: { $nin: params.name.$nin } } : undefined
|
|
665
|
-
// },
|
|
666
|
-
// projection
|
|
667
|
-
// )
|
|
668
|
-
// .limit(params.limit)
|
|
669
|
-
// .sort(sortOrder4executionOfTasks) // sort(2025-03-03~)
|
|
670
|
-
// .setOptions({ maxTimeMS: MONGO_MAX_TIME_MS })
|
|
671
|
-
// .lean<IDelayedTask[]>() // lean(2024-09-26~)
|
|
672
|
-
// .exec();
|
|
673
|
-
// if (delayedTasks.length > 0) {
|
|
674
|
-
// delayedTasks.forEach((delayedTask) => {
|
|
675
|
-
// taskEventEmitter.emitTaskStatusChanged({
|
|
676
|
-
// id: delayedTask.id,
|
|
677
|
-
// name: delayedTask.name,
|
|
678
|
-
// status: factory.taskStatus.Ready
|
|
679
|
-
// });
|
|
680
|
-
// });
|
|
681
|
-
// }
|
|
682
|
-
// return delayedTasks;
|
|
683
|
-
// }
|
|
684
517
|
/**
|
|
685
|
-
*
|
|
518
|
+
* Readyのままで期限切れのタスクをExpiredに変更する
|
|
686
519
|
*/
|
|
687
520
|
makeExpiredMany(params) {
|
|
688
521
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -702,21 +535,23 @@ class TaskRepo {
|
|
|
702
535
|
});
|
|
703
536
|
}
|
|
704
537
|
/**
|
|
705
|
-
*
|
|
538
|
+
* Runningのまま一定期間超過し、かつ、remainingNumberOfTries>0のタスクをReadyに変更する
|
|
706
539
|
*/
|
|
707
|
-
|
|
540
|
+
retryMany(params) {
|
|
708
541
|
return __awaiter(this, void 0, void 0, function* () {
|
|
709
542
|
const lastTriedAtShoudBeLessThan = moment()
|
|
710
543
|
.add(-params.intervalInMinutes, 'minutes')
|
|
711
544
|
.toDate();
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
545
|
+
const remainingNumberOfTriesGte = params.remainingNumberOfTries.$gte;
|
|
546
|
+
const remainingNumberOfTriesLte = params.remainingNumberOfTries.$lte;
|
|
547
|
+
return this.taskModel.updateMany(Object.assign(Object.assign(Object.assign({ status: { $eq: factory.taskStatus.Running }, lastTriedAt: {
|
|
715
548
|
$type: 'date',
|
|
716
549
|
$lt: lastTriedAtShoudBeLessThan
|
|
717
|
-
},
|
|
718
|
-
remainingNumberOfTries: { $
|
|
719
|
-
|
|
550
|
+
} }, (typeof remainingNumberOfTriesGte === 'number')
|
|
551
|
+
? { remainingNumberOfTries: { $gte: remainingNumberOfTriesGte } }
|
|
552
|
+
: undefined), (typeof remainingNumberOfTriesLte === 'number')
|
|
553
|
+
? { remainingNumberOfTries: { $lte: remainingNumberOfTriesLte } }
|
|
554
|
+
: undefined), (Array.isArray(params.name.$in)) ? { name: { $in: params.name.$in } } : undefined), {
|
|
720
555
|
$set: {
|
|
721
556
|
status: factory.taskStatus.Ready // 実行前に変更
|
|
722
557
|
}
|
|
@@ -744,47 +579,51 @@ class TaskRepo {
|
|
|
744
579
|
.exec();
|
|
745
580
|
});
|
|
746
581
|
}
|
|
747
|
-
abortOne(params
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
582
|
+
// public async abortOne(params: {
|
|
583
|
+
// intervalInMinutes: number;
|
|
584
|
+
// }): Promise<factory.task.ITask<factory.taskName> | null> {
|
|
585
|
+
// const lastTriedAtShoudBeLessThan = moment()
|
|
586
|
+
// .add(-params.intervalInMinutes, 'minutes')
|
|
587
|
+
// .toDate();
|
|
588
|
+
// const projection: ProjectionType<factory.task.ITask<factory.taskName>> = {
|
|
589
|
+
// _id: 0,
|
|
590
|
+
// id: { $toString: '$_id' },
|
|
591
|
+
// ...Object.fromEntries<1>(AVAILABLE_PROJECT_FIELDS.map((key) => ([key, 1])))
|
|
592
|
+
// };
|
|
593
|
+
// const doc = await this.taskModel.findOneAndUpdate(
|
|
594
|
+
// {
|
|
595
|
+
// status: { $eq: factory.taskStatus.Running },
|
|
596
|
+
// lastTriedAt: {
|
|
597
|
+
// $type: 'date',
|
|
598
|
+
// $lt: lastTriedAtShoudBeLessThan
|
|
599
|
+
// },
|
|
600
|
+
// remainingNumberOfTries: { $eq: 0 }
|
|
601
|
+
// },
|
|
602
|
+
// {
|
|
603
|
+
// $set: {
|
|
604
|
+
// status: factory.taskStatus.Aborted,
|
|
605
|
+
// dateAborted: new Date()
|
|
606
|
+
// }
|
|
607
|
+
// },
|
|
608
|
+
// { new: true, projection }
|
|
609
|
+
// )
|
|
610
|
+
// .lean<factory.task.ITask<factory.taskName>>() // lean(2024-09-26~)
|
|
611
|
+
// .exec();
|
|
612
|
+
// if (doc === null) {
|
|
613
|
+
// // tslint:disable-next-line:no-null-keyword
|
|
614
|
+
// return null;
|
|
615
|
+
// }
|
|
616
|
+
// return doc;
|
|
617
|
+
// }
|
|
775
618
|
abortMany(params) {
|
|
776
619
|
return __awaiter(this, void 0, void 0, function* () {
|
|
777
620
|
const lastTriedAtShoudBeLessThan = moment()
|
|
778
621
|
.add(-params.intervalInMinutes, 'minutes')
|
|
779
622
|
.toDate();
|
|
780
|
-
return this.taskModel.updateMany({
|
|
781
|
-
status: { $eq: factory.taskStatus.Running },
|
|
782
|
-
lastTriedAt: {
|
|
623
|
+
return this.taskModel.updateMany(Object.assign({ status: { $eq: factory.taskStatus.Running }, lastTriedAt: {
|
|
783
624
|
$type: 'date',
|
|
784
625
|
$lt: lastTriedAtShoudBeLessThan
|
|
785
|
-
},
|
|
786
|
-
remainingNumberOfTries: { $eq: 0 }
|
|
787
|
-
}, {
|
|
626
|
+
}, remainingNumberOfTries: { $eq: 0 } }, (Array.isArray(params.name.$in)) ? { name: { $in: params.name.$in } } : undefined), {
|
|
788
627
|
$set: {
|
|
789
628
|
status: factory.taskStatus.Aborted,
|
|
790
629
|
dateAborted: new Date()
|
|
@@ -794,48 +633,30 @@ class TaskRepo {
|
|
|
794
633
|
});
|
|
795
634
|
}
|
|
796
635
|
/**
|
|
797
|
-
*
|
|
636
|
+
* タスクIDから実行結果とステータスを保管する
|
|
637
|
+
* Abortedの場合、dateAbortedもセットする
|
|
798
638
|
*/
|
|
799
|
-
|
|
639
|
+
setExecutionResultAndStatus(params, update,
|
|
800
640
|
// support customr function(2025-05-25~)
|
|
801
641
|
next) {
|
|
802
642
|
return __awaiter(this, void 0, void 0, function* () {
|
|
803
|
-
const { id,
|
|
643
|
+
const { id, remainingNumberOfTries, name } = params;
|
|
644
|
+
const { status, executionResult } = update;
|
|
804
645
|
yield this.taskModel.updateOne({ _id: { $eq: id } }, {
|
|
805
|
-
$set: { status },
|
|
646
|
+
$set: Object.assign({ status }, (status === factory.taskStatus.Aborted) ? { dateAborted: executionResult.endDate } : undefined // 2025-08-04~
|
|
647
|
+
),
|
|
806
648
|
$push: { executionResults: executionResult }
|
|
807
649
|
})
|
|
808
650
|
.exec();
|
|
809
651
|
// emit event(2025-05-26~)
|
|
810
652
|
if (typeof next === 'function') {
|
|
811
|
-
|
|
653
|
+
if (status !== factory.taskStatus.Executed) {
|
|
654
|
+
const changedTask = { id, name, status, remainingNumberOfTries, executionResult };
|
|
655
|
+
task_1.taskEventEmitter.emitTaskStatusChanged(changedTask, next);
|
|
656
|
+
}
|
|
812
657
|
}
|
|
813
658
|
});
|
|
814
659
|
}
|
|
815
|
-
/**
|
|
816
|
-
* 特定タスク検索
|
|
817
|
-
*/
|
|
818
|
-
// public async findById<T extends factory.taskName>(params: {
|
|
819
|
-
// name: T;
|
|
820
|
-
// id: string;
|
|
821
|
-
// }): Promise<factory.task.ITask<T>> {
|
|
822
|
-
// const doc = await this.taskModel.findOne(
|
|
823
|
-
// {
|
|
824
|
-
// name: { $eq: params.name },
|
|
825
|
-
// _id: { $eq: params.id }
|
|
826
|
-
// },
|
|
827
|
-
// {
|
|
828
|
-
// __v: 0,
|
|
829
|
-
// createdAt: 0,
|
|
830
|
-
// updatedAt: 0
|
|
831
|
-
// }
|
|
832
|
-
// )
|
|
833
|
-
// .exec();
|
|
834
|
-
// if (doc === null) {
|
|
835
|
-
// throw new factory.errors.NotFound('Task');
|
|
836
|
-
// }
|
|
837
|
-
// return doc.toObject();
|
|
838
|
-
// }
|
|
839
660
|
count(params) {
|
|
840
661
|
return __awaiter(this, void 0, void 0, function* () {
|
|
841
662
|
const { limit } = params;
|
|
@@ -970,7 +791,7 @@ class TaskRepo {
|
|
|
970
791
|
return __awaiter(this, void 0, void 0, function* () {
|
|
971
792
|
const matchConditions = params.matchConditions;
|
|
972
793
|
const taskStatus = params.status;
|
|
973
|
-
const
|
|
794
|
+
const aggregate1 = this.taskModel.aggregate([
|
|
974
795
|
{
|
|
975
796
|
$match: matchConditions
|
|
976
797
|
},
|
|
@@ -1000,8 +821,11 @@ class TaskRepo {
|
|
|
1000
821
|
minLatency: '$minLatency'
|
|
1001
822
|
}
|
|
1002
823
|
}
|
|
1003
|
-
])
|
|
1004
|
-
|
|
824
|
+
]);
|
|
825
|
+
// const explainResult = await aggregate1.explain();
|
|
826
|
+
// console.dir(explainResult, { depth: null });
|
|
827
|
+
// return;
|
|
828
|
+
const aggregations = yield aggregate1.exec();
|
|
1005
829
|
// tslint:disable-next-line:no-magic-numbers
|
|
1006
830
|
const percents = [50, 95, 99];
|
|
1007
831
|
if (aggregations.length === 0) {
|
|
@@ -1028,7 +852,7 @@ class TaskRepo {
|
|
|
1028
852
|
rank: Math.floor(aggregations[0].taskCount * percentile / 100)
|
|
1029
853
|
};
|
|
1030
854
|
});
|
|
1031
|
-
const
|
|
855
|
+
const aggregate2 = this.taskModel.aggregate([
|
|
1032
856
|
{
|
|
1033
857
|
$match: matchConditions
|
|
1034
858
|
},
|
|
@@ -1058,8 +882,8 @@ class TaskRepo {
|
|
|
1058
882
|
})
|
|
1059
883
|
}
|
|
1060
884
|
}
|
|
1061
|
-
])
|
|
1062
|
-
|
|
885
|
+
]);
|
|
886
|
+
const aggregations2 = yield aggregate2.exec();
|
|
1063
887
|
return {
|
|
1064
888
|
status: taskStatus,
|
|
1065
889
|
aggregation: Object.assign(Object.assign({}, aggregations[0]), aggregations2[0])
|
|
@@ -323,7 +323,7 @@ class TransactionRepo {
|
|
|
323
323
|
.lean() // 2024-08-26~
|
|
324
324
|
.exec();
|
|
325
325
|
if (doc === null) {
|
|
326
|
-
throw new factory.errors.NotFound(this.transactionModel.modelName);
|
|
326
|
+
throw new factory.errors.NotFound(this.transactionModel.modelName, `${params.typeOf} not found`);
|
|
327
327
|
}
|
|
328
328
|
return doc;
|
|
329
329
|
});
|
|
@@ -371,7 +371,7 @@ class TransactionRepo {
|
|
|
371
371
|
.lean() // 2024-08-26~
|
|
372
372
|
.exec();
|
|
373
373
|
if (doc === null) {
|
|
374
|
-
throw new factory.errors.NotFound(this.transactionModel.modelName);
|
|
374
|
+
throw new factory.errors.NotFound(this.transactionModel.modelName, `${params.typeOf} ${factory.transactionStatusType.InProgress} not found`);
|
|
375
375
|
}
|
|
376
376
|
return doc;
|
|
377
377
|
});
|
|
@@ -389,7 +389,7 @@ class TransactionRepo {
|
|
|
389
389
|
.lean() // 2024-08-26~
|
|
390
390
|
.exec();
|
|
391
391
|
if (doc === null) {
|
|
392
|
-
throw new factory.errors.NotFound(this.transactionModel.modelName);
|
|
392
|
+
throw new factory.errors.NotFound(this.transactionModel.modelName, `${factory.transactionType.PlaceOrder} ${factory.transactionStatusType.InProgress} not found`);
|
|
393
393
|
}
|
|
394
394
|
return doc.object.paymentMethods;
|
|
395
395
|
});
|
|
@@ -407,7 +407,7 @@ class TransactionRepo {
|
|
|
407
407
|
.lean() // 2024-08-26~
|
|
408
408
|
.exec();
|
|
409
409
|
if (doc === null) {
|
|
410
|
-
throw new factory.errors.NotFound(this.transactionModel.modelName);
|
|
410
|
+
throw new factory.errors.NotFound(this.transactionModel.modelName, `${factory.transactionType.PlaceOrder} ${factory.transactionStatusType.InProgress} not found`);
|
|
411
411
|
}
|
|
412
412
|
return doc.object.orderNumber;
|
|
413
413
|
});
|
|
@@ -425,7 +425,7 @@ class TransactionRepo {
|
|
|
425
425
|
.lean() // 2024-08-26~
|
|
426
426
|
.exec();
|
|
427
427
|
if (doc === null) {
|
|
428
|
-
throw new factory.errors.NotFound(this.transactionModel.modelName);
|
|
428
|
+
throw new factory.errors.NotFound(this.transactionModel.modelName, `${factory.transactionType.PlaceOrder} ${params.status.$in.join(' or ')} not found`);
|
|
429
429
|
}
|
|
430
430
|
return doc.object.confirmationNumber;
|
|
431
431
|
});
|
|
@@ -448,7 +448,7 @@ class TransactionRepo {
|
|
|
448
448
|
.lean()
|
|
449
449
|
.exec();
|
|
450
450
|
if (doc === null) {
|
|
451
|
-
throw new factory.errors.NotFound(this.transactionModel.modelName);
|
|
451
|
+
throw new factory.errors.NotFound(this.transactionModel.modelName, `${params.typeOf} ${factory.transactionStatusType.InProgress} not found`);
|
|
452
452
|
}
|
|
453
453
|
});
|
|
454
454
|
}
|
|
@@ -471,7 +471,7 @@ class TransactionRepo {
|
|
|
471
471
|
.lean()
|
|
472
472
|
.exec();
|
|
473
473
|
if (doc === null) {
|
|
474
|
-
throw new factory.errors.NotFound(this.transactionModel.modelName);
|
|
474
|
+
throw new factory.errors.NotFound(this.transactionModel.modelName, `${params.typeOf} ${factory.transactionStatusType.InProgress} not found`);
|
|
475
475
|
}
|
|
476
476
|
});
|
|
477
477
|
}
|
|
@@ -494,7 +494,7 @@ class TransactionRepo {
|
|
|
494
494
|
.lean()
|
|
495
495
|
.exec();
|
|
496
496
|
if (doc === null) {
|
|
497
|
-
throw new factory.errors.NotFound(this.transactionModel.modelName);
|
|
497
|
+
throw new factory.errors.NotFound(this.transactionModel.modelName, `${params.typeOf} ${factory.transactionStatusType.InProgress} not found`);
|
|
498
498
|
}
|
|
499
499
|
});
|
|
500
500
|
}
|
|
@@ -538,7 +538,7 @@ class TransactionRepo {
|
|
|
538
538
|
.isSameOrBefore(moment(endDate))) {
|
|
539
539
|
throw new factory.errors.Argument('Transaction id', 'potentially expired');
|
|
540
540
|
}
|
|
541
|
-
throw new factory.errors.NotFound(this.transactionModel.modelName);
|
|
541
|
+
throw new factory.errors.NotFound(this.transactionModel.modelName, `${params.typeOf} ${factory.transactionStatusType.InProgress} not found`);
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
544
|
transaction_1.transactionEventEmitter.emitTransactionStatusChanged({
|
|
@@ -914,7 +914,7 @@ class TransactionRepo {
|
|
|
914
914
|
throw new factory.errors.Argument('Transaction id', 'Confirmed transaction unable to cancel');
|
|
915
915
|
}
|
|
916
916
|
else {
|
|
917
|
-
throw new factory.errors.NotFound(this.transactionModel.modelName);
|
|
917
|
+
throw new factory.errors.NotFound(this.transactionModel.modelName, `${params.typeOf} ${factory.transactionStatusType.InProgress} not found`);
|
|
918
918
|
}
|
|
919
919
|
}
|
|
920
920
|
transaction_1.transactionEventEmitter.emitTransactionStatusChanged({
|