@chevre/domain 22.11.0-alpha.2 → 22.11.0-alpha.22
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/notifyAbortedTasksByEmail.ts +1 -1
- package/example/src/chevre/orders/searchWithUnwoundAcceptedOffers.ts +73 -0
- 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 +23 -17
- package/example/src/chevre/stockHolder/checkRedisKeyCount.ts +11 -20
- 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 +13 -4
- 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/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 +11 -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 +38 -25
- package/lib/chevre/repo/task.js +114 -211
- 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 +1 -23
- package/lib/chevre/service/task.js +3 -110
- package/lib/chevre/service/taskHandler.d.ts +26 -0
- package/lib/chevre/service/taskHandler.js +139 -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/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
|
@@ -18,7 +18,7 @@ export declare function validateStartParams(params: IStartParams): (repos: {
|
|
|
18
18
|
assetTransaction: AssetTransactionRepo;
|
|
19
19
|
}) => Promise<{
|
|
20
20
|
reserveTransaction: import("@chevre/factory/lib/assetTransaction/reserve").ITransaction | undefined;
|
|
21
|
-
reservations: (Pick<import("@chevre/factory/lib/reservation/event").IReservation, "id" | "typeOf" | "
|
|
21
|
+
reservations: (Pick<import("@chevre/factory/lib/reservation/event").IReservation, "id" | "typeOf" | "issuedThrough" | "reservationNumber"> & {
|
|
22
22
|
reservationFor: Pick<factory.reservation.IReservationFor<factory.reservationType.EventReservation>, "id" | "typeOf">;
|
|
23
23
|
})[] | undefined;
|
|
24
24
|
}>;
|
|
@@ -1,31 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type IToken = string;
|
|
6
|
-
interface IPayload extends Pick<factory.clientUser.IClientUser, 'aud' | 'exp' | 'iat' | 'iss' | 'sub' | 'token_use' | 'typ' | 'version'> {
|
|
7
|
-
version: string;
|
|
8
|
-
typ: string;
|
|
9
|
-
jti?: string;
|
|
10
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* 承認サービス
|
|
3
|
+
* ひとまず不要なので廃止(2025-07-18~)
|
|
4
|
+
*/
|
|
11
5
|
/**
|
|
12
6
|
* コードをトークンに変換する
|
|
13
7
|
*/
|
|
14
|
-
|
|
15
|
-
agent: {
|
|
16
|
-
id: string;
|
|
17
|
-
typeOf: factory.creativeWorkType.SoftwareApplication | factory.creativeWorkType.WebApplication | factory.personType.Person;
|
|
18
|
-
};
|
|
19
|
-
project: {
|
|
20
|
-
id: string;
|
|
21
|
-
};
|
|
22
|
-
code: string;
|
|
23
|
-
expiresIn: number;
|
|
24
|
-
}): (repos: {
|
|
25
|
-
authorization: AuthorizationRepo;
|
|
26
|
-
jwtSetting: JWTSettingRepo;
|
|
27
|
-
ticket: TicketRepo;
|
|
28
|
-
}) => Promise<{
|
|
29
|
-
token: IToken;
|
|
30
|
-
}>;
|
|
31
|
-
export { IPayload, getToken };
|
|
8
|
+
export {};
|
|
@@ -1,83 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.getToken = getToken;
|
|
13
2
|
/**
|
|
14
3
|
* 承認サービス
|
|
4
|
+
* ひとまず不要なので廃止(2025-07-18~)
|
|
15
5
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* コードをトークンに変換する
|
|
20
|
-
*/
|
|
21
|
-
function getToken(params) {
|
|
22
|
-
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
var _a;
|
|
24
|
-
const jwtSetting = yield repos.jwtSetting.findDefault();
|
|
25
|
-
if (typeof params.project.id !== 'string' || params.project.id.length === 0) {
|
|
26
|
-
throw new factory.errors.ArgumentNull('project.id');
|
|
27
|
-
}
|
|
28
|
-
if (typeof params.code !== 'string' || params.code.length === 0) {
|
|
29
|
-
throw new factory.errors.ArgumentNull('code');
|
|
30
|
-
}
|
|
31
|
-
const authorization = yield repos.authorization.findValidOneByCode({
|
|
32
|
-
project: { id: params.project.id },
|
|
33
|
-
code: params.code
|
|
34
|
-
});
|
|
35
|
-
// if (typeof params.issuer !== 'string' || params.issuer.length === 0) {
|
|
36
|
-
// throw new factory.errors.ArgumentNull('issuer');
|
|
37
|
-
// }
|
|
38
|
-
let subject;
|
|
39
|
-
let typ;
|
|
40
|
-
// jti必須化(2024-08-22~)
|
|
41
|
-
const { id } = yield repos.ticket.issueByTicketToken(Object.assign({ project: { id: params.project.id }, ticketToken: params.code }, (typeof ((_a = authorization.issuedBy) === null || _a === void 0 ? void 0 : _a.id) === 'string') ? { issuedBy: authorization.issuedBy } : undefined));
|
|
42
|
-
const jti = id;
|
|
43
|
-
// ロール承認の場合、subjectはメンバーID,typはメンバータイプ
|
|
44
|
-
if (authorization.object.typeOf === factory.role.RoleType.OrganizationRole) {
|
|
45
|
-
subject = authorization.object.member.id;
|
|
46
|
-
typ = `${jwtSetting.payloadTypPrefix}:${authorization.object.member.typeOf}`;
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
// useJtiの場合、subject,typはagent(2024-05-09~)
|
|
50
|
-
subject = params.agent.id;
|
|
51
|
-
typ = `${jwtSetting.payloadTypPrefix}:${params.agent.typeOf}`;
|
|
52
|
-
}
|
|
53
|
-
const payload = {
|
|
54
|
-
token_use: 'access', // 拡張(2024-05-01~)
|
|
55
|
-
version: jwtSetting.version, // 拡張(2024-05-02~)
|
|
56
|
-
typ // 拡張(2024-05-07~)
|
|
57
|
-
};
|
|
58
|
-
const token = yield new Promise((resolve, reject) => {
|
|
59
|
-
// 所有権を暗号化する
|
|
60
|
-
jwt.sign(payload, jwtSetting.secret, {
|
|
61
|
-
algorithm: jwtSetting.algorithm, // 明示的に指定(2024-05-05~)
|
|
62
|
-
issuer: jwtSetting.issuer, // 都度指定に変更(2024-05-05~)
|
|
63
|
-
expiresIn: params.expiresIn,
|
|
64
|
-
subject, // 拡張(2024-05-01~)
|
|
65
|
-
audience: jwtSetting.issuer, // 拡張(2024-05-02~)
|
|
66
|
-
jwtid: jti // 拡張(2024-05-08~)
|
|
67
|
-
}, (err, encoded) => {
|
|
68
|
-
if (err instanceof Error) {
|
|
69
|
-
reject(err);
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
if (typeof encoded !== 'string') {
|
|
73
|
-
reject(new factory.errors.Internal('authorization.object cannot be signed unexpectedly'));
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
resolve(encoded);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
return { token };
|
|
82
|
-
});
|
|
83
|
-
}
|
|
6
|
+
// import * as jwt from 'jsonwebtoken';
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -8,7 +8,7 @@ export type IPermission = string;
|
|
|
8
8
|
/**
|
|
9
9
|
* プロジェクトメンバーの権限を検索する
|
|
10
10
|
*/
|
|
11
|
-
export declare function
|
|
11
|
+
export declare function findProjectPermissionsByMember(params: {
|
|
12
12
|
project: {
|
|
13
13
|
id: string;
|
|
14
14
|
};
|
|
@@ -23,10 +23,20 @@ export declare function searchPermissions(params: {
|
|
|
23
23
|
member: MemberRepo;
|
|
24
24
|
role: RoleRepo;
|
|
25
25
|
}) => Promise<{
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
roleNames: string[];
|
|
27
|
+
permissions: string[];
|
|
28
|
+
}>;
|
|
29
|
+
/**
|
|
30
|
+
* グローバル権限を検索する
|
|
31
|
+
*/
|
|
32
|
+
export declare function findGloablPermissionsByMember(params: {
|
|
33
|
+
member: {
|
|
34
|
+
id: string;
|
|
35
|
+
};
|
|
36
|
+
}): (repos: {
|
|
37
|
+
member: MemberRepo;
|
|
38
|
+
role: RoleRepo;
|
|
39
|
+
}) => Promise<{
|
|
40
|
+
roleNames: string[];
|
|
41
|
+
permissions: string[];
|
|
32
42
|
}>;
|
|
@@ -9,14 +9,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.findProjectPermissionsByMember = findProjectPermissionsByMember;
|
|
13
|
+
exports.findGloablPermissionsByMember = findGloablPermissionsByMember;
|
|
13
14
|
/**
|
|
14
15
|
* プロジェクトメンバーの権限を検索する
|
|
15
16
|
*/
|
|
16
|
-
function
|
|
17
|
+
function findProjectPermissionsByMember(params) {
|
|
17
18
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
18
19
|
let permissions = [];
|
|
19
|
-
const hasRole =
|
|
20
|
+
// const hasRole = await repos.member.aggregateRoleNames({
|
|
21
|
+
const roleNames = yield repos.member.findRoleNamesByMember({
|
|
20
22
|
project: { id: { $eq: params.project.id } },
|
|
21
23
|
member: {
|
|
22
24
|
id: { $eq: params.member.id },
|
|
@@ -26,9 +28,27 @@ function searchPermissions(params) {
|
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
30
|
});
|
|
29
|
-
if (
|
|
30
|
-
permissions =
|
|
31
|
+
if (roleNames.length > 0) {
|
|
32
|
+
// permissions = await repos.role.aggregatePermissions({ roleName: { $in: hasRole.map((r) => r.roleName) } });
|
|
33
|
+
permissions = yield repos.role.findUniquePermissionsByRoleName({ roleName: { $in: roleNames } });
|
|
31
34
|
}
|
|
32
|
-
return {
|
|
35
|
+
return { roleNames, permissions };
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* グローバル権限を検索する
|
|
40
|
+
*/
|
|
41
|
+
function findGloablPermissionsByMember(params) {
|
|
42
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
let permissions = [];
|
|
44
|
+
const roleNames = yield repos.member.findGlobalRoleNamesByMember({
|
|
45
|
+
member: {
|
|
46
|
+
id: { $eq: params.member.id }
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
if (roleNames.length > 0) {
|
|
50
|
+
permissions = yield repos.role.findUniquePermissionsByRoleName({ roleName: { $in: roleNames } });
|
|
51
|
+
}
|
|
52
|
+
return { roleNames, permissions };
|
|
33
53
|
});
|
|
34
54
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SendGridCredentials } from '../../credentials/sendGrid';
|
|
2
|
+
import type { TaskRepo } from '../../repo/task';
|
|
3
|
+
import { Settings } from '../../settings';
|
|
4
|
+
/**
|
|
5
|
+
* 中止されたタスクリストをEメールで通知する
|
|
6
|
+
* add(2025-03-13~)
|
|
7
|
+
*/
|
|
8
|
+
declare function notifyAbortedTasksByEmail(params: {
|
|
9
|
+
dateAbortedGte: Date;
|
|
10
|
+
}): (repos: {
|
|
11
|
+
task: TaskRepo;
|
|
12
|
+
}, settings: Pick<Settings, "abortedTasksWithoutReport">, credentials: {
|
|
13
|
+
sendGrid: SendGridCredentials;
|
|
14
|
+
}) => Promise<void>;
|
|
15
|
+
export { notifyAbortedTasksByEmail };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.notifyAbortedTasksByEmail = notifyAbortedTasksByEmail;
|
|
13
|
+
const createDebug = require("debug");
|
|
14
|
+
const factory = require("../../factory");
|
|
15
|
+
const factory_1 = require("./factory");
|
|
16
|
+
const notifyByEmail_1 = require("./notifyByEmail");
|
|
17
|
+
const debug = createDebug('chevre-domain:service:notification');
|
|
18
|
+
/**
|
|
19
|
+
* 中止されたタスクリストをEメールで通知する
|
|
20
|
+
* add(2025-03-13~)
|
|
21
|
+
*/
|
|
22
|
+
function notifyAbortedTasksByEmail(params) {
|
|
23
|
+
return (repos, settings, credentials) => __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
const { abortedTasksWithoutReport } = settings;
|
|
25
|
+
const abortedTasks = yield repos.task.projectFields(Object.assign({ status: { $eq: factory.taskStatus.Aborted }, dateAborted: { $gte: params.dateAbortedGte } }, (abortedTasksWithoutReport.length > 0)
|
|
26
|
+
? { name: { $nin: abortedTasksWithoutReport } }
|
|
27
|
+
: undefined), []);
|
|
28
|
+
if (abortedTasks.length > 0) {
|
|
29
|
+
// 開発者へ報告
|
|
30
|
+
const message = (0, factory_1.tasks2lineNotify)({ tasks: abortedTasks });
|
|
31
|
+
const notifyResult = yield (0, notifyByEmail_1.notifyByEmail)({
|
|
32
|
+
subject: message.subject, content: message.content,
|
|
33
|
+
logLevel: 'error'
|
|
34
|
+
})({}, credentials);
|
|
35
|
+
debug('notifyResult:', notifyResult);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import { notifyAbortedTasksByEmail } from './notification/notifyAbortedTasksByEmail';
|
|
1
2
|
import { notifyByEmail } from './notification/notifyByEmail';
|
|
2
3
|
import { sendEmailMessage } from './notification/sendEmailMessage';
|
|
3
4
|
import { triggerWebhook } from './notification/triggerWebhook';
|
|
4
|
-
export { notifyByEmail, sendEmailMessage, triggerWebhook };
|
|
5
|
+
export { notifyAbortedTasksByEmail, notifyByEmail, sendEmailMessage, triggerWebhook };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.triggerWebhook = exports.sendEmailMessage = exports.notifyByEmail = void 0;
|
|
3
|
+
exports.triggerWebhook = exports.sendEmailMessage = exports.notifyByEmail = exports.notifyAbortedTasksByEmail = void 0;
|
|
4
|
+
const notifyAbortedTasksByEmail_1 = require("./notification/notifyAbortedTasksByEmail");
|
|
5
|
+
Object.defineProperty(exports, "notifyAbortedTasksByEmail", { enumerable: true, get: function () { return notifyAbortedTasksByEmail_1.notifyAbortedTasksByEmail; } });
|
|
4
6
|
const notifyByEmail_1 = require("./notification/notifyByEmail");
|
|
5
7
|
Object.defineProperty(exports, "notifyByEmail", { enumerable: true, get: function () { return notifyByEmail_1.notifyByEmail; } });
|
|
6
8
|
const sendEmailMessage_1 = require("./notification/sendEmailMessage");
|
|
@@ -19,7 +19,7 @@ const orderNumber_1 = require("../../repo/orderNumber");
|
|
|
19
19
|
const project_1 = require("../../repo/project");
|
|
20
20
|
const reserveInterface_1 = require("../../repo/reserveInterface");
|
|
21
21
|
const transaction_1 = require("../../repo/transaction");
|
|
22
|
-
|
|
22
|
+
// import { TransactionProcessRepo } from '../../repo/transactionProcess';
|
|
23
23
|
const acceptOffer_1 = require("../offer/eventServiceByCOA/acceptOffer");
|
|
24
24
|
let coaAuthClient;
|
|
25
25
|
/**
|
|
@@ -62,7 +62,7 @@ function call(params) {
|
|
|
62
62
|
coaAuthClient = new COA.auth.RefreshToken(Object.assign(Object.assign({}, credentials), (credentialsRepo !== undefined) ? { credentialsRepo } : undefined));
|
|
63
63
|
}
|
|
64
64
|
const actionRepo = new action_1.ActionRepo(connection);
|
|
65
|
-
const transactionProcessRepo = new
|
|
65
|
+
// const transactionProcessRepo = new TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
|
|
66
66
|
try {
|
|
67
67
|
const reserveService = new COA.service.Reserve({
|
|
68
68
|
endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
|
|
@@ -86,7 +86,7 @@ function call(params) {
|
|
|
86
86
|
})({
|
|
87
87
|
action: actionRepo,
|
|
88
88
|
event: new event_1.EventRepo(connection),
|
|
89
|
-
orderNumber: new orderNumber_1.OrderNumberRepo({
|
|
89
|
+
orderNumber: new orderNumber_1.OrderNumberRepo({ connection }),
|
|
90
90
|
project: new project_1.ProjectRepo(connection),
|
|
91
91
|
transaction: new transaction_1.TransactionRepo(connection),
|
|
92
92
|
reserveService,
|
|
@@ -104,7 +104,7 @@ function call(params) {
|
|
|
104
104
|
})({
|
|
105
105
|
action: actionRepo,
|
|
106
106
|
event: new event_1.EventRepo(connection),
|
|
107
|
-
orderNumber: new orderNumber_1.OrderNumberRepo({
|
|
107
|
+
orderNumber: new orderNumber_1.OrderNumberRepo({ connection }),
|
|
108
108
|
project: new project_1.ProjectRepo(connection),
|
|
109
109
|
transaction: new transaction_1.TransactionRepo(connection),
|
|
110
110
|
reserveService,
|
|
@@ -128,8 +128,9 @@ function call(params) {
|
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
finally {
|
|
131
|
+
// taskRepo.runImmediatelyのnextパラメータでの解決へ移行したためここでの解除は不要(2025-07-12~)
|
|
131
132
|
// 取引プロセスロック解除
|
|
132
|
-
|
|
133
|
+
// await transactionProcessRepo.unlock({ typeOf: factory.transactionType.PlaceOrder, id: params.data.purpose.id });
|
|
133
134
|
}
|
|
134
135
|
});
|
|
135
136
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
|
-
import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../
|
|
3
|
-
export declare function call(params: Pick<factory.task.aggregateOnSystem.ITask, IExecutableTaskKeys>
|
|
2
|
+
import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../taskHandler';
|
|
3
|
+
export declare function call(params: Pick<factory.task.aggregateOnSystem.ITask, IExecutableTaskKeys> & {
|
|
4
|
+
status: factory.taskStatus.Running;
|
|
5
|
+
}): IOperationExecute<ICallResult>;
|
|
@@ -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
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IOperationExecute } from '../
|
|
1
|
+
import type { IOperationExecute } from '../taskHandler';
|
|
2
2
|
import * as factory from '../../factory';
|
|
3
3
|
import { ActionRepo } from '../../repo/action';
|
|
4
4
|
import { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as COA from '@motionpicture/coa-service';
|
|
2
2
|
import * as factory from '../../factory';
|
|
3
3
|
import { Settings } from '../../settings';
|
|
4
|
-
import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../
|
|
4
|
+
import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../taskHandler';
|
|
5
5
|
import { AcceptedOfferRepo } from '../../repo/acceptedOffer';
|
|
6
6
|
import { ActionRepo } from '../../repo/action';
|
|
7
7
|
import { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
@@ -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,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
|
-
import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../
|
|
3
|
-
export declare function call(params: Pick<factory.task.handleNotification.ITask, IExecutableTaskKeys>
|
|
2
|
+
import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../taskHandler';
|
|
3
|
+
export declare function call(params: Pick<factory.task.handleNotification.ITask, IExecutableTaskKeys> & {
|
|
4
|
+
status: factory.taskStatus.Running;
|
|
5
|
+
}): IOperationExecute<ICallResult>;
|