@chevre/domain 22.11.0-alpha.1 → 22.11.0-alpha.10
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/assetTransaction/processReserve.ts +0 -1
- package/example/src/chevre/checkProjectMembers.ts +55 -0
- package/example/src/chevre/orders/searchWithUnwoundAcceptedOffers.ts +73 -0
- package/example/src/chevre/roles/addAdminInventoryManagerRole.ts +50 -0
- 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/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 +32 -0
- package/example/src/chevre/stockHolder/checkRedisKeyCount.ts +11 -20
- package/example/src/chevre/unsetUnnecessaryFields.ts +8 -5
- package/lib/chevre/index.d.ts +0 -2
- package/lib/chevre/index.js +0 -10
- package/lib/chevre/repo/acceptedOffer.d.ts +3 -1
- package/lib/chevre/repo/acceptedOffer.js +11 -3
- 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/mongoose/schemas/identity.d.ts +1 -1
- package/lib/chevre/repo/orderNumber.d.ts +0 -11
- package/lib/chevre/repo/orderNumber.js +13 -51
- package/lib/chevre/repo/role.d.ts +11 -0
- package/lib/chevre/repo/role.js +36 -0
- package/lib/chevre/repo/serviceOutputIdentifier.d.ts +0 -4
- package/lib/chevre/repo/serviceOutputIdentifier.js +13 -38
- package/lib/chevre/repo/setting.d.ts +14 -1
- package/lib/chevre/repo/setting.js +15 -0
- package/lib/chevre/repo/stockHolder.js +0 -11
- 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/code.d.ts +5 -28
- package/lib/chevre/service/code.js +3 -79
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +22 -14
- package/lib/chevre/service/task/acceptCOAOffer.js +6 -5
- package/lib/chevre/service/task/authorizePayment.js +7 -6
- package/lib/chevre/service/task/checkMovieTicket.js +4 -3
- package/lib/chevre/service/task/givePointAward.js +1 -1
- package/lib/chevre/service/task/moneyTransfer.js +1 -1
- package/lib/chevre/service/task/publishPaymentUrl.js +6 -7
- package/lib/chevre/service/task/refund.js +1 -1
- package/lib/chevre/service/task/returnMoneyTransfer.js +1 -1
- package/lib/chevre/service/task/returnPayTransaction.js +1 -1
- package/lib/chevre/service/task/returnPointAward.js +1 -1
- package/lib/chevre/service/task/returnReserveTransaction.js +1 -1
- package/lib/chevre/service/task/voidReserveTransaction.js +4 -3
- 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/package.json +3 -3
- package/example/src/chevre/adminAuth/adminIdentity.ts +0 -38
- package/example/src/chevre/checkActions.ts +0 -65
- package/example/src/chevre/roles/addRoleMembers.ts +0 -75
- 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
|
@@ -29,7 +29,7 @@ const task_1 = require("../../repo/task");
|
|
|
29
29
|
const ticket_1 = require("../../repo/ticket");
|
|
30
30
|
const transaction_1 = require("../../repo/transaction");
|
|
31
31
|
const transactionNumber_1 = require("../../repo/transactionNumber");
|
|
32
|
-
|
|
32
|
+
// import { TransactionProcessRepo } from '../../repo/transactionProcess';
|
|
33
33
|
const any_1 = require("../payment/any");
|
|
34
34
|
/**
|
|
35
35
|
* タスク実行関数
|
|
@@ -45,7 +45,7 @@ function call(params) {
|
|
|
45
45
|
}
|
|
46
46
|
let callResult;
|
|
47
47
|
const actionRepo = new action_1.ActionRepo(connection);
|
|
48
|
-
const transactionProcessRepo = new
|
|
48
|
+
// const transactionProcessRepo = new TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
|
|
49
49
|
const paymentServiceId = params.data.object.issuedThrough.id;
|
|
50
50
|
const credentialsExpireInSeconds = settings.movieticketReserve.credentialsExpireInSeconds;
|
|
51
51
|
const useCredentialsRepo = typeof paymentServiceId === 'string' && paymentServiceId !== ''
|
|
@@ -57,13 +57,13 @@ function call(params) {
|
|
|
57
57
|
action: actionRepo,
|
|
58
58
|
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
59
59
|
authorization: new authorization_1.AuthorizationRepo(connection),
|
|
60
|
-
confirmationNumber: new confirmationNumber_1.ConfirmationNumberRepo({
|
|
60
|
+
confirmationNumber: new confirmationNumber_1.ConfirmationNumberRepo({ connection }),
|
|
61
61
|
credentials: new credentials_1.CredentialsRepo(redisClient, {
|
|
62
62
|
scope: `${factory.service.paymentService.PaymentServiceType.MovieTicket}:${paymentServiceId}`,
|
|
63
63
|
expireInSeconds: (useCredentialsRepo) ? credentialsExpireInSeconds : 0
|
|
64
64
|
}),
|
|
65
65
|
event: new event_1.EventRepo(connection),
|
|
66
|
-
orderNumber: new orderNumber_1.OrderNumberRepo({
|
|
66
|
+
orderNumber: new orderNumber_1.OrderNumberRepo({ connection }),
|
|
67
67
|
paymentAccepted: new sellerPaymentAccepted_1.SellerPaymentAcceptedRepo(connection),
|
|
68
68
|
paymentService: new paymentService_1.PaymentServiceRepo(connection),
|
|
69
69
|
paymentServiceProvider: new paymentServiceProvider_1.PaymentServiceProviderRepo(connection),
|
|
@@ -73,7 +73,7 @@ function call(params) {
|
|
|
73
73
|
task: new task_1.TaskRepo(connection),
|
|
74
74
|
ticket: new ticket_1.TicketRepo(connection),
|
|
75
75
|
transaction: new transaction_1.TransactionRepo(connection),
|
|
76
|
-
transactionNumber: new transactionNumber_1.TransactionNumberRepo({
|
|
76
|
+
transactionNumber: new transactionNumber_1.TransactionNumberRepo({ connection })
|
|
77
77
|
// transactionProcess: transactionProcessRepo
|
|
78
78
|
}, settings);
|
|
79
79
|
}
|
|
@@ -101,7 +101,8 @@ function call(params) {
|
|
|
101
101
|
finally {
|
|
102
102
|
// 取引プロセスロック解除(2024-04-20~)
|
|
103
103
|
if (params.data.options.useUnlockTransactionProcess) {
|
|
104
|
-
|
|
104
|
+
// taskRepo.runImmediatelyのnextパラメータでの解決へ移行したためここでの解除は不要(2025-07-12~)
|
|
105
|
+
// await transactionProcessRepo.unlock({ typeOf: params.data.purpose.typeOf, id: params.data.purpose.id });
|
|
105
106
|
}
|
|
106
107
|
}
|
|
107
108
|
if (callResult !== undefined) {
|
|
@@ -17,7 +17,7 @@ const event_1 = require("../../repo/event");
|
|
|
17
17
|
const paymentService_1 = require("../../repo/paymentService");
|
|
18
18
|
const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
19
19
|
const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
|
|
20
|
-
|
|
20
|
+
// import { TransactionProcessRepo } from '../../repo/transactionProcess';
|
|
21
21
|
const pay_1 = require("../assetTransaction/pay");
|
|
22
22
|
/**
|
|
23
23
|
* タスク実行関数
|
|
@@ -33,7 +33,7 @@ function call(params) {
|
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
35
|
const actionRepo = new action_1.ActionRepo(connection);
|
|
36
|
-
const transactionProcessRepo = new
|
|
36
|
+
// const transactionProcessRepo = new TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
|
|
37
37
|
const paymentServiceId = (_b = params.data.object[0]) === null || _b === void 0 ? void 0 : _b.id;
|
|
38
38
|
const credentialsExpireInSeconds = settings.movieticketReserve.credentialsExpireInSeconds;
|
|
39
39
|
const useCredentialsRepo = typeof paymentServiceId === 'string' && paymentServiceId !== ''
|
|
@@ -67,7 +67,8 @@ function call(params) {
|
|
|
67
67
|
finally {
|
|
68
68
|
// 取引プロセスロック解除
|
|
69
69
|
if (typeof ((_d = params.data.purpose) === null || _d === void 0 ? void 0 : _d.id) === 'string') {
|
|
70
|
-
|
|
70
|
+
// taskRepo.runImmediatelyのnextパラメータでの解決へ移行したためここでの解除は不要(2025-07-12~)
|
|
71
|
+
// await transactionProcessRepo.unlock({ typeOf: params.data.purpose.typeOf, id: params.data.purpose.id });
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
74
|
});
|
|
@@ -29,7 +29,7 @@ function call(data) {
|
|
|
29
29
|
const assetTransactionRepo = new assetTransaction_1.AssetTransactionRepo(connection);
|
|
30
30
|
const productRepo = new product_1.ProductRepo(connection);
|
|
31
31
|
const projectRepo = new project_1.ProjectRepo(connection);
|
|
32
|
-
const transactionNumberRepo = new transactionNumber_1.TransactionNumberRepo({
|
|
32
|
+
const transactionNumberRepo = new transactionNumber_1.TransactionNumberRepo({ connection });
|
|
33
33
|
yield DeliveryService.givePointAward(data)({
|
|
34
34
|
action: actionRepo,
|
|
35
35
|
assetTransaction: assetTransactionRepo,
|
|
@@ -25,7 +25,7 @@ function call(data) {
|
|
|
25
25
|
}
|
|
26
26
|
const actionRepo = new action_1.ActionRepo(connection);
|
|
27
27
|
const productRepo = new product_1.ProductRepo(connection);
|
|
28
|
-
const transactionNumberRepo = new transactionNumber_1.TransactionNumberRepo({
|
|
28
|
+
const transactionNumberRepo = new transactionNumber_1.TransactionNumberRepo({ connection });
|
|
29
29
|
yield MoneyTransferService.moneyTransfer(data)({
|
|
30
30
|
action: actionRepo,
|
|
31
31
|
product: productRepo,
|
|
@@ -22,7 +22,7 @@ const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
|
|
|
22
22
|
const ticket_1 = require("../../repo/ticket");
|
|
23
23
|
const transaction_1 = require("../../repo/transaction");
|
|
24
24
|
const transactionNumber_1 = require("../../repo/transactionNumber");
|
|
25
|
-
|
|
25
|
+
// import { TransactionProcessRepo } from '../../repo/transactionProcess';
|
|
26
26
|
const any_1 = require("../payment/any");
|
|
27
27
|
/**
|
|
28
28
|
* タスク実行関数
|
|
@@ -37,20 +37,20 @@ function call(params) {
|
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
const actionRepo = new action_1.ActionRepo(connection);
|
|
40
|
-
const transactionProcessRepo = new
|
|
40
|
+
// const transactionProcessRepo = new TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
|
|
41
41
|
try {
|
|
42
42
|
yield (0, any_1.publishPaymentUrl)(Object.assign(Object.assign({}, params.data), { sameAs: { id: params.id } }))({
|
|
43
43
|
action: actionRepo,
|
|
44
44
|
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
45
45
|
authorization: new authorization_1.AuthorizationRepo(connection),
|
|
46
|
-
orderNumber: new orderNumber_1.OrderNumberRepo({
|
|
46
|
+
orderNumber: new orderNumber_1.OrderNumberRepo({ connection }),
|
|
47
47
|
paymentAccepted: new sellerPaymentAccepted_1.SellerPaymentAcceptedRepo(connection),
|
|
48
48
|
paymentService: new paymentService_1.PaymentServiceRepo(connection),
|
|
49
49
|
paymentServiceProvider: new paymentServiceProvider_1.PaymentServiceProviderRepo(connection),
|
|
50
50
|
project: new project_1.ProjectRepo(connection),
|
|
51
51
|
ticket: new ticket_1.TicketRepo(connection),
|
|
52
52
|
transaction: new transaction_1.TransactionRepo(connection),
|
|
53
|
-
transactionNumber: new transactionNumber_1.TransactionNumberRepo({
|
|
53
|
+
transactionNumber: new transactionNumber_1.TransactionNumberRepo({ connection })
|
|
54
54
|
}, settings);
|
|
55
55
|
}
|
|
56
56
|
catch (error) {
|
|
@@ -69,10 +69,9 @@ function call(params) {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
finally {
|
|
72
|
+
// taskRepo.runImmediatelyのnextパラメータでの解決へ移行したためここでの解除は不要(2025-07-12~)
|
|
72
73
|
// 取引プロセスロック解除
|
|
73
|
-
//
|
|
74
|
-
yield transactionProcessRepo.unlock({ typeOf: params.data.purpose.typeOf, id: params.data.purpose.id });
|
|
75
|
-
// }
|
|
74
|
+
// await transactionProcessRepo.unlock({ typeOf: params.data.purpose.typeOf, id: params.data.purpose.id });
|
|
76
75
|
}
|
|
77
76
|
});
|
|
78
77
|
}
|
|
@@ -58,7 +58,7 @@ function call(params) {
|
|
|
58
58
|
project: new project_1.ProjectRepo(connection),
|
|
59
59
|
task: new task_1.TaskRepo(connection),
|
|
60
60
|
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
61
|
-
transactionNumber: new transactionNumber_1.TransactionNumberRepo({
|
|
61
|
+
transactionNumber: new transactionNumber_1.TransactionNumberRepo({ connection })
|
|
62
62
|
}, settings);
|
|
63
63
|
});
|
|
64
64
|
}
|
|
@@ -29,7 +29,7 @@ function call(data) {
|
|
|
29
29
|
const assetTransactionRepo = new assetTransaction_1.AssetTransactionRepo(connection);
|
|
30
30
|
const productRepo = new product_1.ProductRepo(connection);
|
|
31
31
|
const projectRepo = new project_1.ProjectRepo(connection);
|
|
32
|
-
const transactionNumberRepo = new transactionNumber_1.TransactionNumberRepo({
|
|
32
|
+
const transactionNumberRepo = new transactionNumber_1.TransactionNumberRepo({ connection });
|
|
33
33
|
yield (0, returnMoneyTransfer_1.returnMoneyTransfer)(data)({
|
|
34
34
|
action: actionRepo,
|
|
35
35
|
assetTransaction: assetTransactionRepo,
|
|
@@ -39,7 +39,7 @@ function call(params) {
|
|
|
39
39
|
product: new product_1.ProductRepo(connection),
|
|
40
40
|
task: new task_1.TaskRepo(connection),
|
|
41
41
|
transaction: new transaction_1.TransactionRepo(connection),
|
|
42
|
-
transactionNumber: new transactionNumber_1.TransactionNumberRepo({
|
|
42
|
+
transactionNumber: new transactionNumber_1.TransactionNumberRepo({ connection })
|
|
43
43
|
});
|
|
44
44
|
});
|
|
45
45
|
}
|
|
@@ -29,7 +29,7 @@ function call(data) {
|
|
|
29
29
|
const assetTransactionRepo = new assetTransaction_1.AssetTransactionRepo(connection);
|
|
30
30
|
const productRepo = new product_1.ProductRepo(connection);
|
|
31
31
|
const projectRepo = new project_1.ProjectRepo(connection);
|
|
32
|
-
const transactionNumberRepo = new transactionNumber_1.TransactionNumberRepo({
|
|
32
|
+
const transactionNumberRepo = new transactionNumber_1.TransactionNumberRepo({ connection });
|
|
33
33
|
yield DeliveryService.returnPointAward(data)({
|
|
34
34
|
action: actionRepo,
|
|
35
35
|
assetTransaction: assetTransactionRepo,
|
|
@@ -55,7 +55,7 @@ function call(params) {
|
|
|
55
55
|
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
56
56
|
project: new project_1.ProjectRepo(connection),
|
|
57
57
|
reservation: new reservation_1.ReservationRepo(connection),
|
|
58
|
-
transactionNumber: new transactionNumber_1.TransactionNumberRepo({
|
|
58
|
+
transactionNumber: new transactionNumber_1.TransactionNumberRepo({ connection }),
|
|
59
59
|
reserveService
|
|
60
60
|
});
|
|
61
61
|
});
|
|
@@ -23,7 +23,7 @@ const setting_1 = require("../../repo/setting");
|
|
|
23
23
|
const stockHolder_1 = require("../../repo/stockHolder");
|
|
24
24
|
const task_1 = require("../../repo/task");
|
|
25
25
|
const transaction_1 = require("../../repo/transaction");
|
|
26
|
-
|
|
26
|
+
// import { TransactionProcessRepo } from '../../repo/transactionProcess';
|
|
27
27
|
let coaAuthClientCreated = false;
|
|
28
28
|
let coaAuthClient = new COA.auth.RefreshToken({
|
|
29
29
|
endpoint: '', // 使用されないので空文字でok
|
|
@@ -59,7 +59,7 @@ function call(params) {
|
|
|
59
59
|
endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
|
|
60
60
|
auth: coaAuthClient
|
|
61
61
|
}, { timeout: settings.coa.timeout });
|
|
62
|
-
const transactionProcessRepo = new
|
|
62
|
+
// const transactionProcessRepo = new TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
|
|
63
63
|
try {
|
|
64
64
|
yield (0, voidTransaction_1.voidTransaction)(Object.assign(Object.assign({}, params.data), { project: { id: params.project.id }, sameAs: { id: params.id } }))({
|
|
65
65
|
action: new action_1.ActionRepo(connection),
|
|
@@ -80,7 +80,8 @@ function call(params) {
|
|
|
80
80
|
finally {
|
|
81
81
|
// アクションID指定であれば取引プロセスロック解除(2024-05-26~)
|
|
82
82
|
if (voidByActionId) {
|
|
83
|
-
|
|
83
|
+
// taskRepo.runImmediatelyのnextパラメータでの解決へ移行したためここでの解除は不要(2025-07-12~)
|
|
84
|
+
// await transactionProcessRepo.unlock({ typeOf: params.data.purpose.typeOf, id: params.data.purpose.id });
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
87
|
});
|
|
@@ -12,35 +12,51 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.validateOrder = validateOrder;
|
|
13
13
|
// import * as createDebug from 'debug';
|
|
14
14
|
const moment = require("moment");
|
|
15
|
-
const util = require("util");
|
|
16
15
|
const factory = require("../../factory");
|
|
17
16
|
const factory_1 = require("../offer/event/authorize/factory");
|
|
18
17
|
const factory_2 = require("../offer/product/factory");
|
|
19
18
|
const validateMovieTicket_1 = require("../transaction/placeOrder/confirm/validation/validateMovieTicket");
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
19
|
+
// const debug = createDebug('chevre-domain:service:validation');
|
|
20
|
+
// type ICreatingCheckEventTask = Pick<
|
|
21
|
+
// factory.task.checkResource.IAttributes,
|
|
22
|
+
// 'data' | 'executionResults' | 'name' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt' | 'status' | 'description'
|
|
23
|
+
// > & {
|
|
24
|
+
// description: string;
|
|
25
|
+
// };
|
|
26
|
+
// function createCheckEventTasks(params: {
|
|
27
|
+
// order: Pick<factory.order.IOrder, 'orderNumber' | 'typeOf'>;
|
|
28
|
+
// project: { id: string };
|
|
29
|
+
// reservationForIds: string[];
|
|
30
|
+
// }): ICreatingCheckEventTask[] {
|
|
31
|
+
// const { order, project, reservationForIds } = params;
|
|
32
|
+
// const runsAt = new Date();
|
|
33
|
+
// return reservationForIds.map((reservationForId) => {
|
|
34
|
+
// const object: factory.task.checkResource.IResourceAsEvent = { id: reservationForId, typeOf: factory.eventType.ScreeningEvent };
|
|
35
|
+
// const data: factory.task.checkResource.IData = {
|
|
36
|
+
// object,
|
|
37
|
+
// project: { id: project.id, typeOf: factory.organizationType.Project },
|
|
38
|
+
// typeOf: factory.actionType.CheckAction
|
|
39
|
+
// };
|
|
40
|
+
// const description: string = util.format(
|
|
41
|
+
// '%s:%s:%s:%s',
|
|
42
|
+
// order.typeOf,
|
|
43
|
+
// order.orderNumber,
|
|
44
|
+
// factory.eventType.ScreeningEvent,
|
|
45
|
+
// reservationForId
|
|
46
|
+
// );
|
|
47
|
+
// return {
|
|
48
|
+
// description,
|
|
49
|
+
// project: { id: project.id, typeOf: factory.organizationType.Project },
|
|
50
|
+
// name: factory.taskName.CheckResource,
|
|
51
|
+
// status: factory.taskStatus.Ready,
|
|
52
|
+
// runsAt,
|
|
53
|
+
// remainingNumberOfTries: 3,
|
|
54
|
+
// numberOfTried: 0,
|
|
55
|
+
// executionResults: [],
|
|
56
|
+
// data
|
|
57
|
+
// };
|
|
58
|
+
// });
|
|
59
|
+
// }
|
|
44
60
|
function validateOrder(params) {
|
|
45
61
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
46
62
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -216,18 +232,20 @@ function validateOrder(params) {
|
|
|
216
232
|
throw new Error(`invalid ticketIdentifiers.length:${reservationReservedTicketIdentifiers.length} [expected:${acceptedOffers.length}]`);
|
|
217
233
|
}
|
|
218
234
|
}
|
|
235
|
+
// useMongoAsStockHolderProjectsの場合のイベント検証タスク作成を廃止(もう十分検証したので)(2025-07-11~)
|
|
219
236
|
// add check event task(2025-05-01~)
|
|
220
|
-
const setting =
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
237
|
+
// const setting = <Pick<ISetting, 'useMongoAsStockHolderProjects'> | null>
|
|
238
|
+
// await repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['useMongoAsStockHolderProjects']);
|
|
239
|
+
// const useMongoAsStockHolderProjects = setting?.useMongoAsStockHolderProjects;
|
|
240
|
+
// if (Array.isArray(useMongoAsStockHolderProjects) && useMongoAsStockHolderProjects.includes(params.project.id)) {
|
|
241
|
+
// const creatingCheckResourceTask = createCheckEventTasks({
|
|
242
|
+
// order: { orderNumber: order.orderNumber, typeOf: factory.order.OrderType.Order },
|
|
243
|
+
// project: { id: params.project.id },
|
|
244
|
+
// reservationForIds
|
|
245
|
+
// });
|
|
246
|
+
// if (creatingCheckResourceTask.length > 0) {
|
|
247
|
+
// await repos.task.saveMany(creatingCheckResourceTask, { emitImmediately: true });
|
|
248
|
+
// }
|
|
249
|
+
// }
|
|
232
250
|
});
|
|
233
251
|
}
|
package/lib/chevre/service.d.ts
CHANGED
|
@@ -11,7 +11,6 @@ import type * as AccountService from './service/account';
|
|
|
11
11
|
import type * as AccountTransactionService from './service/accountTransaction';
|
|
12
12
|
import type * as AggregationService from './service/aggregation';
|
|
13
13
|
import type * as AssetTransactionService from './service/assetTransaction';
|
|
14
|
-
import type * as CodeService from './service/code';
|
|
15
14
|
import type * as DeliveryService from './service/delivery';
|
|
16
15
|
import type * as EventService from './service/event';
|
|
17
16
|
import type * as IAMService from './service/iam';
|
|
@@ -37,9 +36,6 @@ export declare namespace aggregation {
|
|
|
37
36
|
export declare namespace assetTransaction {
|
|
38
37
|
function createService(): Promise<typeof AssetTransactionService>;
|
|
39
38
|
}
|
|
40
|
-
export declare namespace code {
|
|
41
|
-
function createService(): Promise<typeof CodeService>;
|
|
42
|
-
}
|
|
43
39
|
export declare namespace delivery {
|
|
44
40
|
function createService(): Promise<typeof DeliveryService>;
|
|
45
41
|
}
|
package/lib/chevre/service.js
CHANGED
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.factory = exports.transaction = exports.task = exports.reserve = exports.report = exports.project = exports.permit = exports.payment = exports.order = exports.offer = exports.notification = exports.iam = exports.event = exports.delivery = exports.
|
|
12
|
+
exports.factory = exports.transaction = exports.task = exports.reserve = exports.report = exports.project = exports.permit = exports.payment = exports.order = exports.offer = exports.notification = exports.iam = exports.event = exports.delivery = exports.assetTransaction = exports.aggregation = exports.accountTransaction = exports.account = void 0;
|
|
13
13
|
/**
|
|
14
14
|
* service module
|
|
15
15
|
*/
|
|
@@ -72,19 +72,15 @@ var assetTransaction;
|
|
|
72
72
|
}
|
|
73
73
|
assetTransaction.createService = createService;
|
|
74
74
|
})(assetTransaction || (exports.assetTransaction = assetTransaction = {}));
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
code.createService = createService;
|
|
87
|
-
})(code || (exports.code = code = {}));
|
|
75
|
+
// export namespace code {
|
|
76
|
+
// let service: typeof CodeService | undefined;
|
|
77
|
+
// export async function createService() {
|
|
78
|
+
// if (service === undefined) {
|
|
79
|
+
// service = await import('./service/code');
|
|
80
|
+
// }
|
|
81
|
+
// return service;
|
|
82
|
+
// }
|
|
83
|
+
// }
|
|
88
84
|
var delivery;
|
|
89
85
|
(function (delivery) {
|
|
90
86
|
let service;
|
package/package.json
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.600.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.600.0",
|
|
14
|
-
"@chevre/factory": "4.395.0
|
|
15
|
-
"@cinerino/sdk": "11.0.0-alpha.
|
|
14
|
+
"@chevre/factory": "4.395.0",
|
|
15
|
+
"@cinerino/sdk": "11.0.0-alpha.8",
|
|
16
16
|
"@motionpicture/coa-service": "9.6.0",
|
|
17
17
|
"@motionpicture/gmo-service": "5.3.0",
|
|
18
18
|
"@sendgrid/client": "8.1.4",
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"postversion": "git push origin --tags",
|
|
114
114
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
115
115
|
},
|
|
116
|
-
"version": "22.11.0-alpha.
|
|
116
|
+
"version": "22.11.0-alpha.10"
|
|
117
117
|
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../../lib/index';
|
|
5
|
-
|
|
6
|
-
const ADMIN_AUTH_ENDPOINT = process.env.ADMIN_AUTH_ENDPOINT;
|
|
7
|
-
|
|
8
|
-
async function main() {
|
|
9
|
-
if (typeof ADMIN_AUTH_ENDPOINT !== 'string') {
|
|
10
|
-
throw new Error('ADMIN_AUTH_ENDPOINT undfined');
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
14
|
-
|
|
15
|
-
const adminIdentityService = await (await (await chevre.loadAdminAuth()).loadChevreAuth({
|
|
16
|
-
endpoint: ADMIN_AUTH_ENDPOINT
|
|
17
|
-
})).createIdentityInstance();
|
|
18
|
-
|
|
19
|
-
const identities = await adminIdentityService.projectIdentityFields(
|
|
20
|
-
{
|
|
21
|
-
about: { id: { $eq: '36jneiog293vb2c7u9e5p4rn7r' } }
|
|
22
|
-
// identifier: { $eq: IDENTIFIER }
|
|
23
|
-
}
|
|
24
|
-
);
|
|
25
|
-
console.log('docs:', identities);
|
|
26
|
-
console.log(identities.length, 'docs found');
|
|
27
|
-
|
|
28
|
-
const { id } = await adminIdentityService.createIdentity({
|
|
29
|
-
clientId: 'xxx',
|
|
30
|
-
clientSecret: 'xxx',
|
|
31
|
-
iss: ['xxx']
|
|
32
|
-
});
|
|
33
|
-
console.log('saved.', id);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
main()
|
|
37
|
-
.then()
|
|
38
|
-
.catch(console.error);
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as moment from 'moment';
|
|
3
|
-
import * as mongoose from 'mongoose';
|
|
4
|
-
|
|
5
|
-
import { chevre } from '../../../lib/index';
|
|
6
|
-
|
|
7
|
-
const CONSOLE_CLIENT_ID = 'xxx';
|
|
8
|
-
// const project = { id: String(process.env.PROJECT_ID) };
|
|
9
|
-
type IAction = chevre.factory.action.IAction<chevre.factory.action.IAttributes<chevre.factory.actionType, any, any>>;
|
|
10
|
-
|
|
11
|
-
// tslint:disable-next-line:max-func-body-length
|
|
12
|
-
async function main() {
|
|
13
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
14
|
-
|
|
15
|
-
const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
|
|
16
|
-
|
|
17
|
-
const cursor = actionRepo.getCursor(
|
|
18
|
-
{
|
|
19
|
-
typeOf: { $eq: chevre.factory.actionType.CreateAction },
|
|
20
|
-
'object.typeOf': { $exists: true, $eq: chevre.factory.eventType.ScreeningEvent },
|
|
21
|
-
startDate: {
|
|
22
|
-
$gte: moment()
|
|
23
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
24
|
-
.add(-60, 'days')
|
|
25
|
-
.toDate()
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
console.log('actions found');
|
|
32
|
-
|
|
33
|
-
let i = 0;
|
|
34
|
-
await cursor.eachAsync(async (doc) => {
|
|
35
|
-
i += 1;
|
|
36
|
-
const action = <IAction>doc.toObject();
|
|
37
|
-
// const size = JSON.stringify(action).length;
|
|
38
|
-
// // console.log(JSON.stringify(action).length);
|
|
39
|
-
// if (action.typeOf !== chevre.factory.actionType.InformAction
|
|
40
|
-
// && action.typeOf !== chevre.factory.actionType.AuthorizeAction
|
|
41
|
-
// && action.typeOf !== chevre.factory.actionType.CheckAction
|
|
42
|
-
// && size > 2000) {
|
|
43
|
-
// console.log(action.typeOf, action.object?.typeOf);
|
|
44
|
-
// console.log(size);
|
|
45
|
-
// }
|
|
46
|
-
|
|
47
|
-
const eventCount = (Array.isArray(action.result))
|
|
48
|
-
? action.result.filter(({ typeOf }) => typeOf === chevre.factory.eventType.ScreeningEvent)
|
|
49
|
-
.length
|
|
50
|
-
: 0;
|
|
51
|
-
if (action.instrument?.id !== CONSOLE_CLIENT_ID) {
|
|
52
|
-
console.log(eventCount, 'events created', action.project.id, action.startDate, action.instrument?.id, i);
|
|
53
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
54
|
-
if (eventCount > 10) {
|
|
55
|
-
throw new Error('eventCount too large');
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
console.log(i, 'actions checked');
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
main()
|
|
64
|
-
.then()
|
|
65
|
-
.catch(console.error);
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../../lib/index';
|
|
5
|
-
|
|
6
|
-
async function main() {
|
|
7
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
8
|
-
|
|
9
|
-
const roleRepo = await chevre.repository.Role.createInstance(mongoose.connection);
|
|
10
|
-
|
|
11
|
-
let roleNames = [
|
|
12
|
-
chevre.factory.role.organizationRole.RoleName.Customer,
|
|
13
|
-
chevre.factory.role.organizationRole.RoleName.EventsViewer,
|
|
14
|
-
chevre.factory.role.organizationRole.RoleName.POS
|
|
15
|
-
];
|
|
16
|
-
for (const roleName of roleNames) {
|
|
17
|
-
const result = await roleRepo.addMember({
|
|
18
|
-
roleName,
|
|
19
|
-
member: { typeOf: chevre.factory.creativeWorkType.WebApplication },
|
|
20
|
-
memberOf: { typeOf: chevre.factory.organizationType.Project }
|
|
21
|
-
});
|
|
22
|
-
console.log(result, roleName);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
roleNames = [
|
|
26
|
-
chevre.factory.role.organizationRole.RoleName.Server
|
|
27
|
-
];
|
|
28
|
-
for (const roleName of roleNames) {
|
|
29
|
-
const result = await roleRepo.addMember({
|
|
30
|
-
roleName,
|
|
31
|
-
member: { typeOf: chevre.factory.creativeWorkType.SoftwareApplication },
|
|
32
|
-
memberOf: { typeOf: chevre.factory.organizationType.Project }
|
|
33
|
-
});
|
|
34
|
-
console.log(result, roleName);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
roleNames = [
|
|
38
|
-
chevre.factory.role.organizationRole.RoleName.Accountant,
|
|
39
|
-
chevre.factory.role.organizationRole.RoleName.IAMRoleAdmin,
|
|
40
|
-
chevre.factory.role.organizationRole.RoleName.InventoryManager,
|
|
41
|
-
chevre.factory.role.organizationRole.RoleName.MemberAdmin,
|
|
42
|
-
chevre.factory.role.organizationRole.RoleName.Owner,
|
|
43
|
-
chevre.factory.role.organizationRole.RoleName.PaymentServiceAdmin,
|
|
44
|
-
chevre.factory.role.organizationRole.RoleName.SellerAdmin,
|
|
45
|
-
chevre.factory.role.organizationRole.RoleName.TicketClerk,
|
|
46
|
-
chevre.factory.role.organizationRole.RoleName.TicketCollector,
|
|
47
|
-
chevre.factory.role.organizationRole.RoleName.User
|
|
48
|
-
];
|
|
49
|
-
for (const roleName of roleNames) {
|
|
50
|
-
const result = await roleRepo.addMember({
|
|
51
|
-
roleName,
|
|
52
|
-
member: { typeOf: chevre.factory.personType.Person },
|
|
53
|
-
memberOf: { typeOf: chevre.factory.organizationType.Project }
|
|
54
|
-
});
|
|
55
|
-
console.log(result, roleName);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
roleNames = [
|
|
59
|
-
chevre.factory.role.organizationRole.RoleName.SellersIAMRoleAdmin,
|
|
60
|
-
chevre.factory.role.organizationRole.RoleName.SellersInventoryManager,
|
|
61
|
-
chevre.factory.role.organizationRole.RoleName.SellersOwner
|
|
62
|
-
];
|
|
63
|
-
for (const roleName of roleNames) {
|
|
64
|
-
const result = await roleRepo.addMember({
|
|
65
|
-
roleName,
|
|
66
|
-
member: { typeOf: chevre.factory.personType.Person },
|
|
67
|
-
memberOf: { typeOf: chevre.factory.organizationType.Corporation }
|
|
68
|
-
});
|
|
69
|
-
console.log(result, roleName);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
main()
|
|
74
|
-
.then()
|
|
75
|
-
.catch(console.error);
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as mongoose from 'mongoose';
|
|
3
|
-
import * as redis from 'redis';
|
|
4
|
-
import { chevre } from '../../../../lib/index';
|
|
5
|
-
|
|
6
|
-
// const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
-
|
|
8
|
-
const redisClient = redis.createClient<redis.RedisDefaultModules, Record<string, never>, Record<string, never>>({
|
|
9
|
-
socket: {
|
|
10
|
-
port: Number(<string>process.env.REDIS_PORT),
|
|
11
|
-
host: <string>process.env.REDIS_HOST
|
|
12
|
-
},
|
|
13
|
-
password: <string>process.env.REDIS_KEY,
|
|
14
|
-
name: 'checkRedisKeyCount'
|
|
15
|
-
})
|
|
16
|
-
.on('error', (err) => {
|
|
17
|
-
// eslint-disable-next-line no-console
|
|
18
|
-
console.error('createDefaultRedisClient: client onError:', err);
|
|
19
|
-
// reject(err);
|
|
20
|
-
});
|
|
21
|
-
redisClient.connect();
|
|
22
|
-
mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
23
|
-
|
|
24
|
-
async function main() {
|
|
25
|
-
const confirmationNumberRepo = await chevre.repository.ConfirmationNumber.createInstance({
|
|
26
|
-
redisClient,
|
|
27
|
-
connection: mongoose.connection
|
|
28
|
-
});
|
|
29
|
-
const result = await confirmationNumberRepo.publish({ orderDate: new Date() });
|
|
30
|
-
console.log(result);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
main()
|
|
34
|
-
.then(() => {
|
|
35
|
-
console.log('success!');
|
|
36
|
-
})
|
|
37
|
-
.catch(console.error);
|