@chevre/domain 22.0.0-alpha.1 → 22.0.0-alpha.4
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/findReservationByCode.ts +17 -5
- package/example/src/chevre/findValidAuthorization.ts +16 -4
- package/example/src/chevre/importCategoryCodesFromCOA.ts +8 -11
- package/example/src/chevre/importEventsFromCOA.ts +15 -1
- package/example/src/chevre/migrateCognitoUser.ts +18 -2
- package/example/src/chevre/person/updateProfile.ts +10 -1
- package/example/src/chevre/searchReservationsByOrder.ts +15 -3
- package/lib/chevre/credentials/coa.d.ts +17 -0
- package/lib/chevre/credentials/coa.js +17 -0
- package/lib/chevre/credentials/jwt.d.ts +23 -0
- package/lib/chevre/credentials/jwt.js +18 -0
- package/lib/chevre/credentials.d.ts +17 -33
- package/lib/chevre/credentials.js +84 -45
- package/lib/chevre/index.d.ts +2 -0
- package/lib/chevre/index.js +11 -1
- package/lib/chevre/repo/authorization.d.ts +1 -2
- package/lib/chevre/repo/person.d.ts +3 -2
- package/lib/chevre/repo/person.js +11 -10
- package/lib/chevre/service/aggregation/event/importFromCOA.d.ts +5 -0
- package/lib/chevre/service/aggregation/event/importFromCOA.js +1 -15
- package/lib/chevre/service/assetTransaction/cancelReservationCOA.d.ts +4 -2
- package/lib/chevre/service/assetTransaction/cancelReservationCOA.js +3 -17
- package/lib/chevre/service/assetTransaction/reserveCOA.d.ts +5 -0
- package/lib/chevre/service/assetTransaction/reserveCOA.js +3 -17
- package/lib/chevre/service/code.d.ts +21 -10
- package/lib/chevre/service/code.js +74 -70
- package/lib/chevre/service/event.d.ts +5 -0
- package/lib/chevre/service/event.js +11 -33
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +3 -0
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.js +6 -5
- package/lib/chevre/service/offer/event/authorize.d.ts +4 -1
- package/lib/chevre/service/offer/event/authorize.js +2 -2
- package/lib/chevre/service/offer/event/importFromCOA.d.ts +1 -1
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4coa.d.ts +5 -1
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4coa.js +5 -19
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -0
- package/lib/chevre/service/offer/event/voidTransaction.js +1 -1
- package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +2 -0
- package/lib/chevre/service/offer/event/voidTransactionByActionId.js +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.d.ts +1 -1
- package/lib/chevre/service/payment/any/person2username.d.ts +2 -1
- package/lib/chevre/service/payment/any/person2username.js +2 -1
- package/lib/chevre/service/payment/any.d.ts +4 -1
- package/lib/chevre/service/payment/any.js +8 -5
- package/lib/chevre/service/reserve/searchByOrder.d.ts +2 -0
- package/lib/chevre/service/reserve/searchByOrder.js +1 -12
- package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +3 -0
- package/lib/chevre/service/reserve/verifyToken4reservation.js +4 -3
- package/lib/chevre/service/task/acceptCOAOffer.js +16 -13
- package/lib/chevre/service/task/authorizePayment.js +21 -17
- package/lib/chevre/service/task/confirmReserveTransaction.d.ts +2 -0
- package/lib/chevre/service/task/confirmReserveTransaction.js +22 -7
- package/lib/chevre/service/task/importEventCapacitiesFromCOA.js +17 -2
- package/lib/chevre/service/task/importEventsFromCOA.js +23 -7
- package/lib/chevre/service/task/importOffersFromCOA.js +15 -11
- package/lib/chevre/service/task/returnReserveTransaction.js +24 -7
- package/lib/chevre/service/task/voidReserveTransaction.js +25 -10
- package/lib/chevre/service/task.d.ts +4 -0
- package/lib/chevre/service/transaction/moneyTransfer.d.ts +6 -1
- package/lib/chevre/service/transaction/moneyTransfer.js +12 -11
- package/package.json +6 -5
- package/example/src/chevre/importOffersFromCOA.ts +0 -44
- package/example/src/chevre/ownershipInfosCsv2peopleJson.ts +0 -181
- package/example/src/chevre/person/globalSignOutAndDisable.ts +0 -23
- package/example/src/chevre/person/search.ts +0 -38
|
@@ -28,11 +28,23 @@ async function main() {
|
|
|
28
28
|
ticket: {
|
|
29
29
|
ticketToken: CODE
|
|
30
30
|
}
|
|
31
|
-
})(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
})(
|
|
32
|
+
{
|
|
33
|
+
authorization: authorizationRepo,
|
|
34
|
+
order: orderRepo,
|
|
35
|
+
ticket: ticketRepo
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
jwt: await chevre.credentials.JWT.createInstance({
|
|
39
|
+
secret: <string>process.env.TOKEN_SECRET,
|
|
40
|
+
issuers: (typeof process.env.TOKEN_ISSUERS_BY_AUTHORIZATION === 'string')
|
|
41
|
+
? process.env.TOKEN_ISSUERS_BY_AUTHORIZATION.split(' ')
|
|
42
|
+
: [],
|
|
43
|
+
version: (typeof process.env.TOKEN_VERSION === 'string') ? process.env.TOKEN_VERSION : '2024-05-02',
|
|
44
|
+
payloadTypPrefix: (typeof process.env.TOKEN_PAYLOAD_TYP_PREFIX === 'string') ? process.env.TOKEN_PAYLOAD_TYP_PREFIX : 'chevre'
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
);
|
|
36
48
|
console.log('verified.');
|
|
37
49
|
|
|
38
50
|
const result = await (await chevre.service.reserve.createService()).findByCode({
|
|
@@ -33,10 +33,22 @@ async function main() {
|
|
|
33
33
|
issuer: 'https://example.com',
|
|
34
34
|
audience: 'https://example.com',
|
|
35
35
|
useJti: true
|
|
36
|
-
})(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
})(
|
|
37
|
+
{
|
|
38
|
+
authorization: authorizationRepo,
|
|
39
|
+
ticket: ticketRepo
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
jwt: await chevre.credentials.JWT.createInstance({
|
|
43
|
+
secret: <string>process.env.TOKEN_SECRET,
|
|
44
|
+
issuers: (typeof process.env.TOKEN_ISSUERS_BY_AUTHORIZATION === 'string')
|
|
45
|
+
? process.env.TOKEN_ISSUERS_BY_AUTHORIZATION.split(' ')
|
|
46
|
+
: [],
|
|
47
|
+
version: (typeof process.env.TOKEN_VERSION === 'string') ? process.env.TOKEN_VERSION : '2024-05-02',
|
|
48
|
+
payloadTypPrefix: (typeof process.env.TOKEN_PAYLOAD_TYP_PREFIX === 'string') ? process.env.TOKEN_PAYLOAD_TYP_PREFIX : 'chevre'
|
|
49
|
+
})
|
|
50
|
+
}
|
|
51
|
+
);
|
|
40
52
|
console.log('token:', token);
|
|
41
53
|
}
|
|
42
54
|
|
|
@@ -1,28 +1,25 @@
|
|
|
1
1
|
// tslint:disable:no-console
|
|
2
|
-
import * as COA from '@motionpicture/coa-service';
|
|
3
|
-
// import * as redis from 'redis';
|
|
4
2
|
import * as mongoose from 'mongoose';
|
|
5
3
|
|
|
6
4
|
import { chevre } from '../../../lib/index';
|
|
7
5
|
|
|
8
6
|
const project = { id: String(process.env.PROJECT_ID) };
|
|
9
7
|
|
|
10
|
-
const coaAuthClient = new COA.auth.RefreshToken({
|
|
11
|
-
endpoint: chevre.credentials.coa.endpoint,
|
|
12
|
-
refreshToken: chevre.credentials.coa.refreshToken,
|
|
13
|
-
useFetch: chevre.credentials.coa.useFetch
|
|
14
|
-
});
|
|
15
|
-
|
|
16
8
|
async function main() {
|
|
17
9
|
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
18
10
|
|
|
19
11
|
const categoryCodeRepo = await chevre.repository.CategoryCode.createInstance(mongoose.connection);
|
|
20
|
-
const
|
|
12
|
+
const coaAuthClient = new (await chevre.loadCOA()).auth.RefreshToken({
|
|
13
|
+
endpoint: '',
|
|
14
|
+
refreshToken: '',
|
|
15
|
+
useFetch: true
|
|
16
|
+
});
|
|
17
|
+
const masterService = new (await chevre.loadCOA()).service.Master(
|
|
21
18
|
{
|
|
22
|
-
endpoint:
|
|
19
|
+
endpoint: '',
|
|
23
20
|
auth: coaAuthClient
|
|
24
21
|
},
|
|
25
|
-
{ timeout:
|
|
22
|
+
{ timeout: 20000 }
|
|
26
23
|
);
|
|
27
24
|
|
|
28
25
|
await (await chevre.service.offer.createService()).event.importCategoryCodesFromCOA({
|
|
@@ -18,6 +18,19 @@ async function main() {
|
|
|
18
18
|
const movieTheaterRepo = await chevre.repository.place.MovieTheater.createInstance(mongoose.connection);
|
|
19
19
|
const sellerRepo = await chevre.repository.Seller.createInstance(mongoose.connection);
|
|
20
20
|
|
|
21
|
+
const coaAuthClient = new (await chevre.loadCOA()).auth.RefreshToken({
|
|
22
|
+
endpoint: '',
|
|
23
|
+
refreshToken: '',
|
|
24
|
+
useFetch: true
|
|
25
|
+
});
|
|
26
|
+
const masterService = new (await chevre.loadCOA()).service.Master(
|
|
27
|
+
{
|
|
28
|
+
endpoint: '',
|
|
29
|
+
auth: coaAuthClient
|
|
30
|
+
},
|
|
31
|
+
{ timeout: 20000 }
|
|
32
|
+
);
|
|
33
|
+
|
|
21
34
|
await (await chevre.service.event.createService()).importFromCOA({
|
|
22
35
|
project: {
|
|
23
36
|
id: project.id,
|
|
@@ -39,7 +52,8 @@ async function main() {
|
|
|
39
52
|
event: eventRepo,
|
|
40
53
|
movieTheater: movieTheaterRepo,
|
|
41
54
|
screeningRoom: screeningRoomRepo,
|
|
42
|
-
seller: sellerRepo
|
|
55
|
+
seller: sellerRepo,
|
|
56
|
+
masterService
|
|
43
57
|
});
|
|
44
58
|
console.log('imported');
|
|
45
59
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
// tslint:disable:no-console
|
|
2
|
+
import { CognitoIdentityProvider } from '@aws-sdk/client-cognito-identity-provider';
|
|
3
|
+
import { fromEnv } from '@aws-sdk/credential-providers';
|
|
4
|
+
|
|
2
5
|
import { chevre } from '../../../lib/index';
|
|
3
6
|
|
|
4
7
|
export const USERPOOL_ID_OLD = String(process.env.USERPOOL_ID_OLD);
|
|
@@ -9,11 +12,21 @@ const NEW_USERPOOL_PROVIDER_NAME = 'SSKTS';
|
|
|
9
12
|
export async function migrateUser(params: {
|
|
10
13
|
id: string;
|
|
11
14
|
}): Promise<void> {
|
|
15
|
+
const awsCredentials = fromEnv();
|
|
16
|
+
const cognitoIdentityServiceProvider = new CognitoIdentityProvider({
|
|
17
|
+
apiVersion: 'latest',
|
|
18
|
+
region: 'ap-northeast-1',
|
|
19
|
+
credentials: awsCredentials
|
|
20
|
+
});
|
|
21
|
+
|
|
12
22
|
// 旧会員を取得
|
|
13
23
|
let oldPerson: chevre.factory.person.IPerson | undefined;
|
|
14
24
|
|
|
15
25
|
try {
|
|
16
|
-
const oldPersonRepo = await chevre.repository.Person.createInstance({
|
|
26
|
+
const oldPersonRepo = await chevre.repository.Person.createInstance({
|
|
27
|
+
userPoolId: USERPOOL_ID_OLD,
|
|
28
|
+
cognitoIdentityServiceProvider
|
|
29
|
+
});
|
|
17
30
|
oldPerson = await oldPersonRepo.findById({ userId: params.id });
|
|
18
31
|
console.log('oldPerson found', oldPerson.id, oldPerson.givenName, oldPerson.familyName);
|
|
19
32
|
} catch (error) {
|
|
@@ -33,7 +46,10 @@ export async function migrateUser(params: {
|
|
|
33
46
|
}
|
|
34
47
|
|
|
35
48
|
// create user
|
|
36
|
-
const newPersonRepo = await chevre.repository.Person.createInstance({
|
|
49
|
+
const newPersonRepo = await chevre.repository.Person.createInstance({
|
|
50
|
+
userPoolId: USERPOOL_ID_NEW,
|
|
51
|
+
cognitoIdentityServiceProvider
|
|
52
|
+
});
|
|
37
53
|
const newUsername = `${NEW_USERPOOL_PROVIDER_NAME}_${oldPerson.id}`;
|
|
38
54
|
const newUserId = await new Promise<string>((resolve, reject) => {
|
|
39
55
|
newPersonRepo.cognitoIdentityServiceProvider.adminCreateUser(
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
import { CognitoIdentityProvider } from '@aws-sdk/client-cognito-identity-provider';
|
|
2
|
+
import { fromEnv } from '@aws-sdk/credential-providers';
|
|
3
|
+
|
|
1
4
|
// tslint:disable:no-console no-magic-numbers
|
|
2
5
|
import { chevre } from '../../../../lib/index';
|
|
3
6
|
|
|
4
7
|
async function main() {
|
|
8
|
+
const awsCredentials = fromEnv();
|
|
5
9
|
const personRepo = await chevre.repository.Person.createInstance({
|
|
6
|
-
userPoolId: <string>process.env.COGNITO_USER_POOL_ID
|
|
10
|
+
userPoolId: <string>process.env.COGNITO_USER_POOL_ID,
|
|
11
|
+
cognitoIdentityServiceProvider: new CognitoIdentityProvider({
|
|
12
|
+
apiVersion: 'latest',
|
|
13
|
+
region: 'ap-northeast-1',
|
|
14
|
+
credentials: awsCredentials
|
|
15
|
+
})
|
|
7
16
|
});
|
|
8
17
|
|
|
9
18
|
const username = 'xxx';
|
|
@@ -8,19 +8,31 @@ const project = { id: String(process.env.PROJECT_ID) };
|
|
|
8
8
|
async function main() {
|
|
9
9
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
10
|
|
|
11
|
+
const coaAuthClient = new (await chevre.loadCOA()).auth.RefreshToken({
|
|
12
|
+
endpoint: '',
|
|
13
|
+
refreshToken: '',
|
|
14
|
+
useFetch: true
|
|
15
|
+
});
|
|
16
|
+
|
|
11
17
|
const { reservations } = await (await chevre.service.reserve.createService()).searchByOrder({
|
|
12
18
|
limit: 10,
|
|
13
19
|
page: 1,
|
|
14
20
|
project: { id: project.id },
|
|
15
21
|
orderNumber: 'CIN3-0760465-8981560',
|
|
16
|
-
// orderNumber: 'SSK1-3743647-5975553',
|
|
17
|
-
// orderNumber: 'SSK9-4864565-8689164',
|
|
18
22
|
typeOf: chevre.factory.reservationType.EventReservation
|
|
19
23
|
})({
|
|
20
24
|
acceptedOffer: await chevre.repository.AcceptedOffer.createInstance(mongoose.connection),
|
|
21
25
|
order: await chevre.repository.Order.createInstance(mongoose.connection),
|
|
22
|
-
reservation: await chevre.repository.Reservation.createInstance(mongoose.connection)
|
|
26
|
+
reservation: await chevre.repository.Reservation.createInstance(mongoose.connection),
|
|
27
|
+
reserveService: new (await chevre.loadCOA()).service.Reserve(
|
|
28
|
+
{
|
|
29
|
+
endpoint: '',
|
|
30
|
+
auth: coaAuthClient
|
|
31
|
+
},
|
|
32
|
+
{ timeout: 20000 }
|
|
33
|
+
)
|
|
23
34
|
});
|
|
35
|
+
|
|
24
36
|
console.log(reservations);
|
|
25
37
|
console.log(reservations.length, 'reservations found');
|
|
26
38
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface IOptions {
|
|
2
|
+
endpoint: string;
|
|
3
|
+
refreshToken: string;
|
|
4
|
+
timeout: number;
|
|
5
|
+
useFetch: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* COA認証情報
|
|
9
|
+
*/
|
|
10
|
+
declare class COACredentials {
|
|
11
|
+
readonly endpoint: string;
|
|
12
|
+
readonly refreshToken: string;
|
|
13
|
+
readonly timeout: number;
|
|
14
|
+
readonly useFetch: boolean;
|
|
15
|
+
constructor(options: IOptions);
|
|
16
|
+
}
|
|
17
|
+
export { COACredentials };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.COACredentials = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* COA認証情報
|
|
6
|
+
*/
|
|
7
|
+
class COACredentials {
|
|
8
|
+
constructor(options) {
|
|
9
|
+
this.timeout = 20000;
|
|
10
|
+
const { endpoint, refreshToken, timeout, useFetch } = options;
|
|
11
|
+
this.endpoint = endpoint;
|
|
12
|
+
this.refreshToken = refreshToken;
|
|
13
|
+
this.timeout = timeout;
|
|
14
|
+
this.useFetch = useFetch;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.COACredentials = COACredentials;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
interface IOptions {
|
|
2
|
+
secret: string;
|
|
3
|
+
/**
|
|
4
|
+
* トークン検証時の発行者リスト
|
|
5
|
+
*/
|
|
6
|
+
issuers: string[];
|
|
7
|
+
version: string;
|
|
8
|
+
payloadTypPrefix: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* トークン認証情報
|
|
12
|
+
*/
|
|
13
|
+
declare class JWTCredentials {
|
|
14
|
+
readonly secret: string;
|
|
15
|
+
/**
|
|
16
|
+
* トークン検証時の発行者リスト
|
|
17
|
+
*/
|
|
18
|
+
readonly issuers: string[];
|
|
19
|
+
readonly version: string;
|
|
20
|
+
readonly payloadTypPrefix: string;
|
|
21
|
+
constructor(options: IOptions);
|
|
22
|
+
}
|
|
23
|
+
export { JWTCredentials };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JWTCredentials = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* トークン認証情報
|
|
6
|
+
*/
|
|
7
|
+
class JWTCredentials {
|
|
8
|
+
constructor(options) {
|
|
9
|
+
this.version = '2024-05-02'; // 追加(2024-05-02~)
|
|
10
|
+
this.payloadTypPrefix = 'chevre';
|
|
11
|
+
const { secret, issuers, version, payloadTypPrefix } = options;
|
|
12
|
+
this.issuers = issuers;
|
|
13
|
+
this.payloadTypPrefix = payloadTypPrefix;
|
|
14
|
+
this.secret = secret;
|
|
15
|
+
this.version = version;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.JWTCredentials = JWTCredentials;
|
|
@@ -1,40 +1,25 @@
|
|
|
1
|
+
import type { COACredentials } from './credentials/coa';
|
|
2
|
+
import type { JWTCredentials } from './credentials/jwt';
|
|
1
3
|
/**
|
|
2
4
|
* 外部サービスを使用するための認証情報
|
|
3
5
|
*/
|
|
4
|
-
export declare
|
|
5
|
-
|
|
6
|
-
accessKeyId: string;
|
|
7
|
-
secretAccessKey: string;
|
|
8
|
-
tokenIssuerEndpoint: string;
|
|
9
|
-
};
|
|
10
|
-
chevre: {
|
|
11
|
-
authorizeServerDomain: string;
|
|
12
|
-
clientId: string;
|
|
13
|
-
clientSecret: string;
|
|
14
|
-
endpoint: string;
|
|
15
|
-
};
|
|
16
|
-
coa: {
|
|
17
|
-
endpoint: string;
|
|
18
|
-
refreshToken: string;
|
|
19
|
-
timeout: number;
|
|
20
|
-
useFetch: boolean;
|
|
21
|
-
};
|
|
22
|
-
customSearch: {
|
|
6
|
+
export declare namespace credentials {
|
|
7
|
+
const customSearch: {
|
|
23
8
|
engineId: string;
|
|
24
9
|
apiKey: string;
|
|
25
10
|
};
|
|
26
|
-
gmo: {
|
|
11
|
+
const gmo: {
|
|
27
12
|
timeout: number;
|
|
28
13
|
timeoutBackground: number | undefined;
|
|
29
14
|
useFetch: boolean;
|
|
30
15
|
};
|
|
31
|
-
lineNotify: {
|
|
16
|
+
const lineNotify: {
|
|
32
17
|
url: string | undefined;
|
|
33
18
|
accessToken: string | undefined;
|
|
34
19
|
accessTokenAlert: string | undefined;
|
|
35
20
|
accessTokenInfo: string | undefined;
|
|
36
21
|
};
|
|
37
|
-
movieticketReserve: {
|
|
22
|
+
const movieticketReserve: {
|
|
38
23
|
/**
|
|
39
24
|
* 着券時タイムアウト
|
|
40
25
|
*/
|
|
@@ -44,16 +29,15 @@ export declare const credentials: {
|
|
|
44
29
|
*/
|
|
45
30
|
timeoutCheck: number;
|
|
46
31
|
};
|
|
47
|
-
sendGrid: {
|
|
32
|
+
const sendGrid: {
|
|
48
33
|
apiKey: string | undefined;
|
|
49
34
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
};
|
|
35
|
+
type COA = COACredentials;
|
|
36
|
+
namespace COA {
|
|
37
|
+
function createInstance(...params: ConstructorParameters<typeof COACredentials>): Promise<COACredentials>;
|
|
38
|
+
}
|
|
39
|
+
type JWT = JWTCredentials;
|
|
40
|
+
namespace JWT {
|
|
41
|
+
function createInstance(...params: ConstructorParameters<typeof JWTCredentials>): Promise<JWTCredentials>;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -1,47 +1,75 @@
|
|
|
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
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.credentials = void 0;
|
|
13
|
+
// export const credentials = {
|
|
14
|
+
// migrate to JWTCredentials(2024-07-11~)
|
|
15
|
+
// jwt: {
|
|
16
|
+
// secret: <string>process.env.TOKEN_SECRET,
|
|
17
|
+
// // RESOURCE_SERVER_IDENTIFIERとは分離して指定可能に拡張(2024-05-02~)
|
|
18
|
+
// // issuer: (typeof process.env.TOKEN_ISSUER_BY_AUTHORIZATION === 'string')
|
|
19
|
+
// // ? process.env.TOKEN_ISSUER_BY_AUTHORIZATION
|
|
20
|
+
// // : <string>process.env.RESOURCE_SERVER_IDENTIFIER,
|
|
21
|
+
// /**
|
|
22
|
+
// * トークン検証時の発行者リスト
|
|
23
|
+
// */
|
|
24
|
+
// issuers: (typeof process.env.TOKEN_ISSUERS_BY_AUTHORIZATION === 'string')
|
|
25
|
+
// ? process.env.TOKEN_ISSUERS_BY_AUTHORIZATION.split(' ')
|
|
26
|
+
// : [], // 追加(2024-05-02~)
|
|
27
|
+
// version: (typeof process.env.TOKEN_VERSION === 'string') ? process.env.TOKEN_VERSION : '2024-05-02', // 追加(2024-05-02~)
|
|
28
|
+
// payloadTypPrefix: (typeof process.env.TOKEN_PAYLOAD_TYP_PREFIX === 'string') ? process.env.TOKEN_PAYLOAD_TYP_PREFIX : 'chevre'
|
|
29
|
+
// }
|
|
30
|
+
// };
|
|
4
31
|
/**
|
|
5
32
|
* 外部サービスを使用するための認証情報
|
|
6
33
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
34
|
+
var credentials;
|
|
35
|
+
(function (credentials) {
|
|
36
|
+
// export const aws = {
|
|
37
|
+
// accessKeyId: <string>process.env.AWS_ACCESS_KEY_ID,
|
|
38
|
+
// secretAccessKey: <string>process.env.AWS_SECRET_ACCESS_KEY,
|
|
39
|
+
// tokenIssuerEndpoint: <string>process.env.TOKEN_ISSUER_ENDPOINT
|
|
40
|
+
// };
|
|
41
|
+
// export const chevre = {
|
|
42
|
+
// authorizeServerDomain: <string>process.env.CHEVRE_AUTHORIZE_SERVER_DOMAIN,
|
|
43
|
+
// clientId: <string>process.env.CHEVRE_CLIENT_ID,
|
|
44
|
+
// clientSecret: <string>process.env.CHEVRE_CLIENT_SECRET,
|
|
45
|
+
// endpoint: <string>process.env.CHEVRE_ENDPOINT
|
|
46
|
+
// };
|
|
47
|
+
// export const coa = {
|
|
48
|
+
// endpoint: <string>process.env.COA_ENDPOINT,
|
|
49
|
+
// refreshToken: <string>process.env.COA_REFRESH_TOKEN,
|
|
50
|
+
// // tslint:disable-next-line:no-magic-numbers
|
|
51
|
+
// timeout: (typeof process.env.COA_TIMEOUT === 'string') ? Number(process.env.COA_TIMEOUT) : 20000,
|
|
52
|
+
// useFetch: process.env.COA_USE_FETCH === '1'
|
|
53
|
+
// };
|
|
54
|
+
credentials.customSearch = {
|
|
27
55
|
engineId: process.env.CUSTOM_SEARCH_ENGINE_ID,
|
|
28
56
|
apiKey: process.env.GOOGLE_API_KEY
|
|
29
|
-
}
|
|
30
|
-
gmo
|
|
57
|
+
};
|
|
58
|
+
credentials.gmo = {
|
|
31
59
|
// tslint:disable-next-line:no-magic-numbers
|
|
32
60
|
timeout: (typeof process.env.GMO_TIMEOUT === 'string') ? Number(process.env.GMO_TIMEOUT) : 5000,
|
|
33
61
|
timeoutBackground: (typeof process.env.GMO_TIMEOUT_BACKGROUND === 'string')
|
|
34
62
|
? Number(process.env.GMO_TIMEOUT_BACKGROUND)
|
|
35
63
|
: undefined,
|
|
36
64
|
useFetch: process.env.GMO_USE_FETCH === '1'
|
|
37
|
-
}
|
|
38
|
-
lineNotify
|
|
65
|
+
};
|
|
66
|
+
credentials.lineNotify = {
|
|
39
67
|
url: process.env.LINE_NOTIFY_URL,
|
|
40
68
|
accessToken: process.env.LINE_NOTIFY_ACCESS_TOKEN,
|
|
41
69
|
accessTokenAlert: process.env.LINE_NOTIFY_ACCESS_TOKEN_ALERT,
|
|
42
70
|
accessTokenInfo: process.env.LINE_NOTIFY_ACCESS_TOKEN_INFO
|
|
43
|
-
}
|
|
44
|
-
movieticketReserve
|
|
71
|
+
};
|
|
72
|
+
credentials.movieticketReserve = {
|
|
45
73
|
/**
|
|
46
74
|
* 着券時タイムアウト
|
|
47
75
|
*/
|
|
@@ -52,23 +80,34 @@ exports.credentials = {
|
|
|
52
80
|
*/
|
|
53
81
|
// tslint:disable-next-line:no-magic-numbers
|
|
54
82
|
timeoutCheck: (typeof process.env.MVTK_TIMEOUT_CHECK === 'string') ? Number(process.env.MVTK_TIMEOUT_CHECK) : 5000
|
|
55
|
-
}
|
|
56
|
-
sendGrid
|
|
83
|
+
};
|
|
84
|
+
credentials.sendGrid = {
|
|
57
85
|
apiKey: process.env.SENDGRID_API_KEY
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
86
|
+
};
|
|
87
|
+
let COA;
|
|
88
|
+
(function (COA) {
|
|
89
|
+
let cred;
|
|
90
|
+
function createInstance(...params) {
|
|
91
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
92
|
+
if (cred === undefined) {
|
|
93
|
+
cred = (yield Promise.resolve().then(() => require('./credentials/coa'))).COACredentials;
|
|
94
|
+
}
|
|
95
|
+
return new cred(...params);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
COA.createInstance = createInstance;
|
|
99
|
+
})(COA = credentials.COA || (credentials.COA = {}));
|
|
100
|
+
let JWT;
|
|
101
|
+
(function (JWT) {
|
|
102
|
+
let cred;
|
|
103
|
+
function createInstance(...params) {
|
|
104
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
if (cred === undefined) {
|
|
106
|
+
cred = (yield Promise.resolve().then(() => require('./credentials/jwt'))).JWTCredentials;
|
|
107
|
+
}
|
|
108
|
+
return new cred(...params);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
JWT.createInstance = createInstance;
|
|
112
|
+
})(JWT = credentials.JWT || (credentials.JWT = {}));
|
|
113
|
+
})(credentials = exports.credentials || (exports.credentials = {}));
|
package/lib/chevre/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* index module
|
|
3
3
|
*/
|
|
4
|
+
import type * as COAService from '@motionpicture/coa-service';
|
|
4
5
|
import type * as GMOService from '@motionpicture/gmo-service';
|
|
5
6
|
import type * as Pecorinoapi from './pecorinoapi';
|
|
6
7
|
import { credentials } from './credentials';
|
|
@@ -12,4 +13,5 @@ import * as service from './service';
|
|
|
12
13
|
import * as settings from './settings';
|
|
13
14
|
export { credentials, errorHandler, eventEmitter, factory, repository, service, settings };
|
|
14
15
|
export declare function loadPecorinoapi(): Promise<typeof Pecorinoapi>;
|
|
16
|
+
export declare function loadCOA(): Promise<typeof COAService>;
|
|
15
17
|
export declare function loadGMO(): Promise<typeof GMOService>;
|
package/lib/chevre/index.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.loadGMO = exports.loadPecorinoapi = exports.settings = exports.service = exports.repository = exports.factory = exports.eventEmitter = exports.errorHandler = exports.credentials = void 0;
|
|
12
|
+
exports.loadGMO = exports.loadCOA = exports.loadPecorinoapi = exports.settings = exports.service = exports.repository = exports.factory = exports.eventEmitter = exports.errorHandler = exports.credentials = void 0;
|
|
13
13
|
const credentials_1 = require("./credentials");
|
|
14
14
|
Object.defineProperty(exports, "credentials", { enumerable: true, get: function () { return credentials_1.credentials; } });
|
|
15
15
|
const errorHandler = require("./errorHandler");
|
|
@@ -34,6 +34,16 @@ function loadPecorinoapi() {
|
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
exports.loadPecorinoapi = loadPecorinoapi;
|
|
37
|
+
let COA;
|
|
38
|
+
function loadCOA() {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
if (COA === undefined) {
|
|
41
|
+
COA = yield Promise.resolve().then(() => require('@motionpicture/coa-service'));
|
|
42
|
+
}
|
|
43
|
+
return COA;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
exports.loadCOA = loadCOA;
|
|
37
47
|
let GMO;
|
|
38
48
|
function loadGMO() {
|
|
39
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Connection, FilterQuery } from 'mongoose';
|
|
2
2
|
import * as factory from '../factory';
|
|
3
|
-
export type ICode = string;
|
|
4
3
|
type IFindValidOneResult = Pick<factory.authorization.IAuthorization, 'object' | 'typeOf' | 'audience' | 'issuedBy'> & {
|
|
5
4
|
id: string;
|
|
6
5
|
};
|
|
@@ -26,7 +25,7 @@ export declare class AuthorizationRepo {
|
|
|
26
25
|
project: {
|
|
27
26
|
id: string;
|
|
28
27
|
};
|
|
29
|
-
code:
|
|
28
|
+
code: string;
|
|
30
29
|
}): Promise<IFindValidOneResult>;
|
|
31
30
|
/**
|
|
32
31
|
* 有効な承認を参照する
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CognitoIdentityProvider } from '@aws-sdk/client-cognito-identity-provider';
|
|
1
|
+
import type { CognitoIdentityProvider } from '@aws-sdk/client-cognito-identity-provider';
|
|
2
2
|
import type { AttributeType } from '@aws-sdk/client-cognito-identity-provider/dist-types/models/models_0';
|
|
3
3
|
import * as factory from '../factory';
|
|
4
4
|
export type IPerson = factory.person.IPerson;
|
|
@@ -8,7 +8,8 @@ export type IPerson = factory.person.IPerson;
|
|
|
8
8
|
export declare class PersonRepo {
|
|
9
9
|
readonly cognitoIdentityServiceProvider: CognitoIdentityProvider;
|
|
10
10
|
private readonly userPoolId;
|
|
11
|
-
constructor(
|
|
11
|
+
constructor(options: {
|
|
12
|
+
cognitoIdentityServiceProvider: CognitoIdentityProvider;
|
|
12
13
|
userPoolId: string;
|
|
13
14
|
});
|
|
14
15
|
static ATTRIBUTE2PROFILE(params: {
|
|
@@ -10,22 +10,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.PersonRepo = void 0;
|
|
13
|
-
|
|
14
|
-
const credential_providers_1 = require("@aws-sdk/credential-providers");
|
|
13
|
+
// import { fromEnv } from '@aws-sdk/credential-providers';
|
|
15
14
|
const google_libphonenumber_1 = require("google-libphonenumber");
|
|
16
15
|
const factory = require("../factory");
|
|
17
|
-
const awsCredentials =
|
|
16
|
+
// const awsCredentials = fromEnv();
|
|
18
17
|
/**
|
|
19
18
|
* 会員リポジトリ
|
|
20
19
|
*/
|
|
21
20
|
class PersonRepo {
|
|
22
|
-
constructor(
|
|
23
|
-
|
|
24
|
-
this.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
constructor(options) {
|
|
22
|
+
const { cognitoIdentityServiceProvider, userPoolId } = options;
|
|
23
|
+
this.userPoolId = userPoolId;
|
|
24
|
+
this.cognitoIdentityServiceProvider = cognitoIdentityServiceProvider;
|
|
25
|
+
// this.cognitoIdentityServiceProvider = new CognitoIdentityProvider({
|
|
26
|
+
// apiVersion: 'latest',
|
|
27
|
+
// region: 'ap-northeast-1',
|
|
28
|
+
// credentials: awsCredentials
|
|
29
|
+
// });
|
|
29
30
|
}
|
|
30
31
|
static ATTRIBUTE2PROFILE(params) {
|
|
31
32
|
let additionalProperty = [];
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* COAイベント集計サービス
|
|
3
|
+
*/
|
|
4
|
+
import type * as COA from '@motionpicture/coa-service';
|
|
1
5
|
import type { EventRepo } from '../../../repo/event';
|
|
2
6
|
import * as factory from '../../../factory';
|
|
3
7
|
/**
|
|
@@ -13,4 +17,5 @@ export declare function importFromCOA(params: {
|
|
|
13
17
|
importThrough: Date;
|
|
14
18
|
}): (repos: {
|
|
15
19
|
event: EventRepo;
|
|
20
|
+
reserveService: COA.service.Reserve;
|
|
16
21
|
}) => Promise<void>;
|