@cinerino/sdk 3.63.0 → 3.66.0
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.
|
@@ -7986,7 +7986,11 @@ var OrderService = /** @class */ (function (_super) {
|
|
|
7986
7986
|
/**
|
|
7987
7987
|
* なければ作成する
|
|
7988
7988
|
*/
|
|
7989
|
-
OrderService.prototype.createIfNotExist = function (params
|
|
7989
|
+
OrderService.prototype.createIfNotExist = function (params
|
|
7990
|
+
// options: {
|
|
7991
|
+
// byTransaction?: '1';
|
|
7992
|
+
// }
|
|
7993
|
+
) {
|
|
7990
7994
|
return __awaiter(this, void 0, void 0, function () {
|
|
7991
7995
|
return __generator(this, function (_a) {
|
|
7992
7996
|
switch (_a.label) {
|
|
@@ -7994,7 +7998,7 @@ var OrderService = /** @class */ (function (_super) {
|
|
|
7994
7998
|
uri: "/orders/" + params.orderNumber,
|
|
7995
7999
|
method: 'PUT',
|
|
7996
8000
|
body: params,
|
|
7997
|
-
qs: options,
|
|
8001
|
+
// qs: options,
|
|
7998
8002
|
expectedStatusCodes: [http_status_1.NO_CONTENT]
|
|
7999
8003
|
})];
|
|
8000
8004
|
case 1:
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
/**
|
|
3
|
+
* ユーザー認証
|
|
4
|
+
*/
|
|
5
|
+
// tslint:disable-next-line:no-implicit-dependencies
|
|
6
|
+
import * as open from 'open';
|
|
7
|
+
import * as readline from 'readline';
|
|
8
|
+
import * as client from '../../../lib/';
|
|
9
|
+
|
|
10
|
+
export async function login() {
|
|
11
|
+
const auth = new client.auth.OAuth2({
|
|
12
|
+
domain: <string>process.env.TEST_CHILD_AUTHORIZE_SERVER_DOMAIN,
|
|
13
|
+
clientId: <string>process.env.TEST_CHILD_CLIENT_ID,
|
|
14
|
+
clientSecret: <string>process.env.TEST_CHILD_CLIENT_SECRET,
|
|
15
|
+
redirectUri: 'https://localhost/signIn',
|
|
16
|
+
logoutUri: 'https://localhost/signOut'
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const scopes: string[] = [];
|
|
20
|
+
const state = '12345';
|
|
21
|
+
const codeVerifier = '12345';
|
|
22
|
+
|
|
23
|
+
let authUrl = auth.generateAuthUrl({
|
|
24
|
+
scopes: scopes,
|
|
25
|
+
state: state,
|
|
26
|
+
codeVerifier: codeVerifier
|
|
27
|
+
});
|
|
28
|
+
const signInUrl = new URL(authUrl);
|
|
29
|
+
authUrl = `${signInUrl.href}&identity_provider=`;
|
|
30
|
+
|
|
31
|
+
console.log('authUrl:', authUrl);
|
|
32
|
+
open(authUrl);
|
|
33
|
+
|
|
34
|
+
await new Promise<void>((resolve, reject) => {
|
|
35
|
+
const rl = readline.createInterface({
|
|
36
|
+
input: process.stdin,
|
|
37
|
+
output: process.stdout
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
rl.question('enter authorization code:\n', async (code) => {
|
|
41
|
+
rl.question('enter state:\n', async (givenState) => {
|
|
42
|
+
if (givenState !== state) {
|
|
43
|
+
reject(new Error('state not matched'));
|
|
44
|
+
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
let credentials = await auth.getToken(code, codeVerifier);
|
|
49
|
+
console.log('credentials published', credentials);
|
|
50
|
+
|
|
51
|
+
auth.setCredentials(credentials);
|
|
52
|
+
|
|
53
|
+
credentials = await auth.refreshAccessToken();
|
|
54
|
+
console.log('credentials refreshed', credentials);
|
|
55
|
+
|
|
56
|
+
// rl.close();
|
|
57
|
+
resolve();
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const logoutUrl = auth.generateLogoutUrl();
|
|
63
|
+
console.log('logoutUrl:', logoutUrl);
|
|
64
|
+
|
|
65
|
+
return auth;
|
|
66
|
+
}
|
|
@@ -4,9 +4,16 @@ import * as httpStatus from 'http-status';
|
|
|
4
4
|
|
|
5
5
|
import * as client from '../../../../lib/index';
|
|
6
6
|
import * as auth from '../../auth/auth';
|
|
7
|
+
import * as authChild from '../../auth/authChild';
|
|
7
8
|
|
|
8
|
-
// tslint:disable-next-line:max-func-body-length
|
|
9
9
|
async function main() {
|
|
10
|
+
const childAuthClient = await authChild.login();
|
|
11
|
+
await childAuthClient.refreshAccessToken();
|
|
12
|
+
const childLoginTicket = childAuthClient.verifyIdToken({});
|
|
13
|
+
console.log('username is', childLoginTicket.getUsername());
|
|
14
|
+
|
|
15
|
+
// return;
|
|
16
|
+
|
|
10
17
|
const authClient = await auth.login();
|
|
11
18
|
await authClient.refreshAccessToken();
|
|
12
19
|
const loginTicket = authClient.verifyIdToken({});
|
package/lib/bundle.js
CHANGED
|
@@ -7986,7 +7986,11 @@ var OrderService = /** @class */ (function (_super) {
|
|
|
7986
7986
|
/**
|
|
7987
7987
|
* なければ作成する
|
|
7988
7988
|
*/
|
|
7989
|
-
OrderService.prototype.createIfNotExist = function (params
|
|
7989
|
+
OrderService.prototype.createIfNotExist = function (params
|
|
7990
|
+
// options: {
|
|
7991
|
+
// byTransaction?: '1';
|
|
7992
|
+
// }
|
|
7993
|
+
) {
|
|
7990
7994
|
return __awaiter(this, void 0, void 0, function () {
|
|
7991
7995
|
return __generator(this, function (_a) {
|
|
7992
7996
|
switch (_a.label) {
|
|
@@ -7994,7 +7998,7 @@ var OrderService = /** @class */ (function (_super) {
|
|
|
7994
7998
|
uri: "/orders/" + params.orderNumber,
|
|
7995
7999
|
method: 'PUT',
|
|
7996
8000
|
body: params,
|
|
7997
|
-
qs: options,
|
|
8001
|
+
// qs: options,
|
|
7998
8002
|
expectedStatusCodes: [http_status_1.NO_CONTENT]
|
|
7999
8003
|
})];
|
|
8000
8004
|
case 1:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cinerino/sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.66.0",
|
|
4
4
|
"description": "Cinerino SDK",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"browser": {
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"watchify": "^3.11.1"
|
|
98
98
|
},
|
|
99
99
|
"dependencies": {
|
|
100
|
-
"@cinerino/api-abstract-client": "3.
|
|
100
|
+
"@cinerino/api-abstract-client": "3.66.0",
|
|
101
101
|
"debug": "^3.2.6",
|
|
102
102
|
"http-status": "^1.4.2",
|
|
103
103
|
"idtoken-verifier": "^2.0.3",
|