@motionpicture/coa-service 9.1.0 → 9.3.0-alpha.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.
- package/README.md +2 -8
- package/example/delReserve.js +1 -1
- package/example/delTmpReserve.js +1 -1
- package/example/findFilms.js +17 -1
- package/example/findKubunNames.js +6 -3
- package/example/getToken.js +21 -0
- package/example/salesTicket.js +6 -5
- package/example/stateReserve.js +1 -1
- package/lib/auth/credentials.d.ts +1 -2
- package/lib/auth/refreshTokenClient.d.ts +11 -6
- package/lib/auth/refreshTokenClient.js +77 -3
- package/lib/factory/reserve.d.ts +6 -6
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/service.d.ts +4 -3
- package/lib/transporters.d.ts +7 -6
- package/lib/transporters.js +1 -1
- package/package.json +12 -15
- package/docs/assets/css/main.css +0 -1
- package/docs/assets/images/icons.png +0 -0
- package/docs/assets/images/icons@2x.png +0 -0
- package/docs/assets/images/widgets.png +0 -0
- package/docs/assets/images/widgets@2x.png +0 -0
- package/docs/assets/js/main.js +0 -51
- package/docs/assets/js/search.json +0 -1
- package/docs/classes/_auth_refreshtokenclient_.refreshtokenclient.html +0 -517
- package/docs/classes/_index_.auth.refreshtoken.html +0 -529
- package/docs/classes/_index_.service.master.html +0 -599
- package/docs/classes/_index_.service.reserve.html +0 -594
- package/docs/classes/_service_.service.html +0 -316
- package/docs/classes/_service_master_.masterservice.html +0 -583
- package/docs/classes/_service_reserve_.reserveservice.html +0 -578
- package/docs/classes/_transporters_.coaserviceerror.html +0 -370
- package/docs/classes/_transporters_.defaulttransporter.html +0 -408
- package/docs/classes/_transporters_.transporter.html +0 -246
- package/docs/enums/_factory_master_.flgearlybooking.html +0 -277
- package/docs/enums/_factory_master_.flgmember.html +0 -277
- package/docs/enums/_factory_reserve_.flgmember.html +0 -295
- package/docs/globals.html +0 -173
- package/docs/index.html +0 -250
- package/docs/interfaces/_auth_credentials_.icredentials.html +0 -232
- package/docs/interfaces/_auth_refreshtokenclient_.ioptions.html +0 -221
- package/docs/interfaces/_factory_master_.ikubunnameargs.html +0 -286
- package/docs/interfaces/_factory_master_.ikubunnameresult.html +0 -324
- package/docs/interfaces/_factory_master_.imgtkticketcodeargs.html +0 -343
- package/docs/interfaces/_factory_master_.imgtkticketcoderesult.html +0 -362
- package/docs/interfaces/_factory_master_.imvtkticketcodeargs.html +0 -438
- package/docs/interfaces/_factory_master_.imvtkticketcoderesult.html +0 -362
- package/docs/interfaces/_factory_master_.ischeduleargs.html +0 -305
- package/docs/interfaces/_factory_master_.ischeduleresult.html +0 -518
- package/docs/interfaces/_factory_master_.iscreenargs.html +0 -267
- package/docs/interfaces/_factory_master_.iscreenresult.html +0 -324
- package/docs/interfaces/_factory_master_.iscreenseat.html +0 -381
- package/docs/interfaces/_factory_master_.itheaterargs.html +0 -267
- package/docs/interfaces/_factory_master_.itheaterresult.html +0 -343
- package/docs/interfaces/_factory_master_.iticketargs.html +0 -267
- package/docs/interfaces/_factory_master_.iticketresult.html +0 -362
- package/docs/interfaces/_factory_master_.ititleargs.html +0 -267
- package/docs/interfaces/_factory_master_.ititleresult.html +0 -552
- package/docs/interfaces/_factory_reserve_.icountfreeseatargs.html +0 -323
- package/docs/interfaces/_factory_reserve_.icountfreeseatdate.html +0 -323
- package/docs/interfaces/_factory_reserve_.icountfreeseatperformance.html +0 -380
- package/docs/interfaces/_factory_reserve_.icountfreeseatresult.html +0 -304
- package/docs/interfaces/_factory_reserve_.idelreserveargs.html +0 -418
- package/docs/interfaces/_factory_reserve_.idelreserveseat.html +0 -304
- package/docs/interfaces/_factory_reserve_.ideltmpreserveargs.html +0 -380
- package/docs/interfaces/_factory_reserve_.isalesticketargs.html +0 -380
- package/docs/interfaces/_factory_reserve_.isalesticketresult.html +0 -475
- package/docs/interfaces/_factory_reserve_.istatereserveargs.html +0 -323
- package/docs/interfaces/_factory_reserve_.istatereserveresult.html +0 -380
- package/docs/interfaces/_factory_reserve_.istatereserveseatargs.html +0 -380
- package/docs/interfaces/_factory_reserve_.istatereserveseatfreeseat.html +0 -345
- package/docs/interfaces/_factory_reserve_.istatereserveseatresult.html +0 -323
- package/docs/interfaces/_factory_reserve_.istatereserveseatseat.html +0 -304
- package/docs/interfaces/_factory_reserve_.istatereserveticket.html +0 -411
- package/docs/interfaces/_factory_reserve_.iupdreserveargs.html +0 -494
- package/docs/interfaces/_factory_reserve_.iupdreserveqr.html +0 -323
- package/docs/interfaces/_factory_reserve_.iupdreserveresult.html +0 -304
- package/docs/interfaces/_factory_reserve_.iupdreserveticket.html +0 -647
- package/docs/interfaces/_factory_reserve_.iupdtmpreserveseatargs.html +0 -399
- package/docs/interfaces/_factory_reserve_.iupdtmpreserveseatresult.html +0 -304
- package/docs/interfaces/_factory_reserve_.iupdtmpreserveseatseat.html +0 -304
- package/docs/interfaces/_factory_reserve_.iupdtmpreserveseattmpreserve.html +0 -323
- package/docs/interfaces/_service_.ioptions.html +0 -225
- package/docs/modules/_auth_credentials_.html +0 -167
- package/docs/modules/_auth_refreshtokenclient_.html +0 -198
- package/docs/modules/_auth_refreshtokenclient_spec_.html +0 -208
- package/docs/modules/_factory_.html +0 -194
- package/docs/modules/_factory_master_.html +0 -244
- package/docs/modules/_factory_reserve_.html +0 -268
- package/docs/modules/_index_.auth.html +0 -178
- package/docs/modules/_index_.html +0 -195
- package/docs/modules/_index_.service.html +0 -189
- package/docs/modules/_service_.html +0 -176
- package/docs/modules/_service_master_.html +0 -167
- package/docs/modules/_service_master_spec_.html +0 -208
- package/docs/modules/_service_reserve_.html +0 -167
- package/docs/modules/_service_reserve_spec_.html +0 -208
- package/docs/modules/_transporters_.html +0 -253
package/README.md
CHANGED
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/@motionpicture/coa-service)
|
|
4
4
|
[](https://circleci.com/gh/motionpicture/coa-service)
|
|
5
5
|
[](https://coveralls.io/github/motionpicture/coa-service?branch=master)
|
|
6
|
-
[](https://david-dm.org/motionpicture/coa-service)
|
|
7
6
|
[](https://snyk.io/test/github/motionpicture/coa-service)
|
|
8
7
|
[](https://nodei.co/npm/@motionpicture/coa-service/)
|
|
9
8
|
|
|
10
|
-
Node.js
|
|
9
|
+
COA SDK for Node.js
|
|
11
10
|
|
|
12
11
|
## Table of contents
|
|
13
12
|
|
|
@@ -19,7 +18,6 @@ Node.jsでCOAサービスを使うためのライブラリです。
|
|
|
19
18
|
- [劇場情報を取得する](#劇場情報を取得する)
|
|
20
19
|
- [Code Samples](#code-samples)
|
|
21
20
|
- [Documentation](#documentation)
|
|
22
|
-
- [License](#license)
|
|
23
21
|
|
|
24
22
|
## Specification
|
|
25
23
|
|
|
@@ -27,7 +25,7 @@ COA APIの仕様で注意すべき点は以下の通りです。
|
|
|
27
25
|
|
|
28
26
|
* 正常時レスポンスにはstatusが含まれるが、0以外のステータスはない。
|
|
29
27
|
* カタカナは全角統一(半角はありえない)
|
|
30
|
-
* 仮予約番号と購入番号の型は
|
|
28
|
+
* 仮予約番号と購入番号の型はstringで統一。
|
|
31
29
|
* 座席番号は半角と全角を区別する、
|
|
32
30
|
* 購入番号は劇場内でユニーク、劇場コード合わせれば全体でユニーク。
|
|
33
31
|
* 購入番号は連番かどうか
|
|
@@ -79,7 +77,3 @@ Code sample are [here](https://github.com/motionpicture/coa-service/tree/master/
|
|
|
79
77
|
## Documentation
|
|
80
78
|
|
|
81
79
|
`npm run doc` emits typedoc to ./docs.
|
|
82
|
-
|
|
83
|
-
## License
|
|
84
|
-
|
|
85
|
-
ISC
|
package/example/delReserve.js
CHANGED
package/example/delTmpReserve.js
CHANGED
package/example/findFilms.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
const COA = require('../');
|
|
5
5
|
const fs = require('fs');
|
|
6
|
+
const moment = require('moment');
|
|
6
7
|
|
|
7
8
|
const service = new COA.service.Master(
|
|
8
9
|
{
|
|
@@ -15,10 +16,25 @@ const service = new COA.service.Master(
|
|
|
15
16
|
);
|
|
16
17
|
|
|
17
18
|
service.title({
|
|
18
|
-
theaterCode: '
|
|
19
|
+
theaterCode: '120'
|
|
19
20
|
}).then((result) => {
|
|
20
21
|
fs.writeFileSync(`${__dirname}/output/title.json`, JSON.stringify(result, null, ' '));
|
|
21
22
|
console.log(result);
|
|
23
|
+
const someMonthsAgo = moment()
|
|
24
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
25
|
+
.add(-3, 'months');
|
|
26
|
+
const filteredResult = result.filter((filmFromCOA) => {
|
|
27
|
+
const startDate = (moment(`${filmFromCOA.dateBegin} +09:00`, 'YYYYMMDD Z')
|
|
28
|
+
.isValid())
|
|
29
|
+
? moment(`${filmFromCOA.dateBegin} +09:00`, 'YYYYMMDD Z')
|
|
30
|
+
.toDate()
|
|
31
|
+
: moment('2018-01-01T00:00:00+09:00') // 値がない場合、十分に長く
|
|
32
|
+
.toDate();
|
|
33
|
+
|
|
34
|
+
return moment(startDate)
|
|
35
|
+
.isAfter(someMonthsAgo);
|
|
36
|
+
});
|
|
37
|
+
console.log(filteredResult.length);
|
|
22
38
|
}).catch((err) => {
|
|
23
39
|
console.error(err);
|
|
24
40
|
});
|
|
@@ -14,11 +14,14 @@ const service = new COA.service.Master(
|
|
|
14
14
|
}
|
|
15
15
|
);
|
|
16
16
|
|
|
17
|
+
// const kubunClass = '000'; // すべて
|
|
18
|
+
// const kubunClass = '050'; // 特別席区分
|
|
19
|
+
const kubunClass = '005'; // 販売区分
|
|
17
20
|
service.kubunName({
|
|
18
|
-
theaterCode: '
|
|
19
|
-
kubunClass
|
|
21
|
+
theaterCode: '120',
|
|
22
|
+
kubunClass
|
|
20
23
|
}).then((result) => {
|
|
21
|
-
fs.writeFileSync(`${__dirname}/output/kubunName.json`, JSON.stringify(result, null, ' '));
|
|
24
|
+
fs.writeFileSync(`${__dirname}/output/kubunName-${kubunClass}.json`, JSON.stringify(result, null, ' '));
|
|
22
25
|
console.log(result);
|
|
23
26
|
}).catch((err) => {
|
|
24
27
|
console.error(err);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const COA = require('../');
|
|
2
|
+
|
|
3
|
+
const auth = new COA.auth.RefreshToken({
|
|
4
|
+
endpoint: process.env.COA_ENDPOINT,
|
|
5
|
+
refreshToken: process.env.COA_REFRESH_TOKEN
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
auth.getToken()
|
|
9
|
+
.then((result) => {
|
|
10
|
+
console.log('getToken result:', result);
|
|
11
|
+
}).catch((err) => {
|
|
12
|
+
console.error(err);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
auth.getTokenWithFetch()
|
|
17
|
+
.then((result) => {
|
|
18
|
+
console.log('getTokenWithFetch result:', result);
|
|
19
|
+
}).catch((err) => {
|
|
20
|
+
console.error(err);
|
|
21
|
+
});
|
package/example/salesTicket.js
CHANGED
|
@@ -15,13 +15,14 @@ const service = new COA.service.Reserve(
|
|
|
15
15
|
);
|
|
16
16
|
|
|
17
17
|
service.salesTicket({
|
|
18
|
-
theaterCode: '
|
|
19
|
-
dateJouei: '
|
|
20
|
-
titleCode: '
|
|
18
|
+
theaterCode: '120',
|
|
19
|
+
dateJouei: '20230309',
|
|
20
|
+
titleCode: '99100',
|
|
21
21
|
titleBranchNum: '0',
|
|
22
|
-
timeBegin: '
|
|
22
|
+
timeBegin: '1720',
|
|
23
|
+
flgMember: '1'
|
|
23
24
|
}).then((result) => {
|
|
24
|
-
fs.writeFileSync(`${__dirname}/output/
|
|
25
|
+
fs.writeFileSync(`${__dirname}/output/salesTicket2.json`, JSON.stringify(result, null, ' '));
|
|
25
26
|
console.log(result);
|
|
26
27
|
}).catch((err) => {
|
|
27
28
|
console.error(err);
|
package/example/stateReserve.js
CHANGED
|
@@ -14,7 +14,7 @@ const service = new COA.service.Reserve({
|
|
|
14
14
|
|
|
15
15
|
service.stateReserve({
|
|
16
16
|
theaterCode: '118',
|
|
17
|
-
reserveNum: 99150,
|
|
17
|
+
reserveNum: '99150',
|
|
18
18
|
telNum: '09012345678'
|
|
19
19
|
}).then((result) => {
|
|
20
20
|
fs.writeFileSync(`${__dirname}/output/stateReserve.json`, JSON.stringify(result, null, ' '));
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import ICredentials from './credentials';
|
|
1
|
+
import { IRequestOptions } from '../transporters';
|
|
2
|
+
import { ICredentials } from './credentials';
|
|
3
3
|
export interface IOptions {
|
|
4
4
|
endpoint: string;
|
|
5
5
|
refreshToken?: string;
|
|
6
6
|
}
|
|
7
|
+
export { IRequestOptions };
|
|
7
8
|
/**
|
|
8
9
|
* リフレッシュトークン認証クライアント
|
|
9
10
|
*/
|
|
10
|
-
export
|
|
11
|
+
export declare class RefreshTokenClient {
|
|
11
12
|
/**
|
|
12
13
|
* アクセストークンの有効期限までの猶予時間初期値
|
|
13
14
|
*/
|
|
@@ -18,7 +19,11 @@ export default class RefreshTokenClient {
|
|
|
18
19
|
/**
|
|
19
20
|
* トークンエンドポイントからアクセストークンを取得します。
|
|
20
21
|
*/
|
|
21
|
-
|
|
22
|
+
getTokenWithRequest(): Promise<ICredentials>;
|
|
23
|
+
/**
|
|
24
|
+
* トークンエンドポイントからアクセストークンを取得します。
|
|
25
|
+
*/
|
|
26
|
+
getTokenWithFetch(): Promise<ICredentials>;
|
|
22
27
|
/**
|
|
23
28
|
* 認証情報を手動でセットする
|
|
24
29
|
*/
|
|
@@ -36,11 +41,11 @@ export default class RefreshTokenClient {
|
|
|
36
41
|
* APIリクエストを投げる
|
|
37
42
|
* 認証エラー(401,403)であれば自動的に一度だけアクセストークンをリフレッシュします。
|
|
38
43
|
*/
|
|
39
|
-
request(options:
|
|
44
|
+
request(options: IRequestOptions, expectedStatusCodes: number[]): Promise<any>;
|
|
40
45
|
/**
|
|
41
46
|
* 認証情報が適切である前提でAPIリクエストを投げる
|
|
42
47
|
*/
|
|
43
|
-
protected makeRequest(options:
|
|
48
|
+
protected makeRequest(options: IRequestOptions, expectedStatusCodes: number[]): Promise<any>;
|
|
44
49
|
/**
|
|
45
50
|
* 認証情報を更新する
|
|
46
51
|
*/
|
|
@@ -9,11 +9,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.RefreshTokenClient = void 0;
|
|
12
13
|
const createDebug = require("debug");
|
|
13
14
|
const http_status_1 = require("http-status");
|
|
14
15
|
const request = require("request");
|
|
15
16
|
const transporters_1 = require("../transporters");
|
|
16
17
|
const debug = createDebug('coa-service:auth:refreshTokenClient');
|
|
18
|
+
const TIMEOUT = 10000;
|
|
17
19
|
/**
|
|
18
20
|
* リフレッシュトークン認証クライアント
|
|
19
21
|
*/
|
|
@@ -25,7 +27,7 @@ class RefreshTokenClient {
|
|
|
25
27
|
/**
|
|
26
28
|
* トークンエンドポイントからアクセストークンを取得します。
|
|
27
29
|
*/
|
|
28
|
-
|
|
30
|
+
getTokenWithRequest() {
|
|
29
31
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30
32
|
return new Promise((resolve, reject) => {
|
|
31
33
|
debug('requesting an access token...');
|
|
@@ -64,6 +66,77 @@ class RefreshTokenClient {
|
|
|
64
66
|
});
|
|
65
67
|
});
|
|
66
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* トークンエンドポイントからアクセストークンを取得します。
|
|
71
|
+
*/
|
|
72
|
+
getTokenWithFetch() {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
debug('requesting an access token...');
|
|
75
|
+
try {
|
|
76
|
+
const params = new URLSearchParams({ refresh_token: String(this.options.refreshToken) });
|
|
77
|
+
const res = yield fetch(`${this.options.endpoint}/token/access_token`, {
|
|
78
|
+
method: 'POST',
|
|
79
|
+
headers: {
|
|
80
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
|
81
|
+
},
|
|
82
|
+
body: params,
|
|
83
|
+
signal: AbortSignal.timeout(TIMEOUT)
|
|
84
|
+
});
|
|
85
|
+
let body;
|
|
86
|
+
try {
|
|
87
|
+
body = yield res.json();
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
// no op
|
|
91
|
+
}
|
|
92
|
+
debug('res.status:', res.status, 'body:', body);
|
|
93
|
+
switch (res.status) {
|
|
94
|
+
case http_status_1.OK:
|
|
95
|
+
this.credentials = body;
|
|
96
|
+
break;
|
|
97
|
+
default:
|
|
98
|
+
let err = new Error('Unexpected error occurred.');
|
|
99
|
+
if (body !== undefined && body !== null) {
|
|
100
|
+
if (typeof body === 'string') {
|
|
101
|
+
err = new Error(body);
|
|
102
|
+
}
|
|
103
|
+
else if (typeof body.message === 'string' && body.message.length > 0) {
|
|
104
|
+
// エラーレスポンスにメッセージがあった場合
|
|
105
|
+
err = new Error(body.message);
|
|
106
|
+
}
|
|
107
|
+
else if (body.status !== undefined && body.status !== 0) {
|
|
108
|
+
// エラーレスポンスにステータスがあった場合
|
|
109
|
+
err = new Error(body.status);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
throw err;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
catch (err) {
|
|
116
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
117
|
+
/* istanbul ignore next */
|
|
118
|
+
if (err.name === 'TimeoutError') {
|
|
119
|
+
// tslint:disable-next-line:no-console
|
|
120
|
+
console.error('getTokenWithFetch: Timeout: It took more than 5 seconds to get the result!', err);
|
|
121
|
+
}
|
|
122
|
+
else if (err.name === 'AbortError') {
|
|
123
|
+
// tslint:disable-next-line:no-console
|
|
124
|
+
console.error('getTokenWithFetch: Fetch aborted by user action (browser stop button, closing tab, etc.', err);
|
|
125
|
+
}
|
|
126
|
+
else if (err.name === 'TypeError') {
|
|
127
|
+
// tslint:disable-next-line:no-console
|
|
128
|
+
console.error('getTokenWithFetch: AbortSignal.timeout() method is not supported', err);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
// A network error, or some other problem.
|
|
132
|
+
// tslint:disable-next-line:no-console
|
|
133
|
+
console.error(`getTokenWithFetch: Error: type: ${err.name}, message: ${err.message}`, err);
|
|
134
|
+
}
|
|
135
|
+
throw err;
|
|
136
|
+
}
|
|
137
|
+
return this.credentials;
|
|
138
|
+
});
|
|
139
|
+
}
|
|
67
140
|
/**
|
|
68
141
|
* 認証情報を手動でセットする
|
|
69
142
|
*/
|
|
@@ -174,12 +247,13 @@ class RefreshTokenClient {
|
|
|
174
247
|
refreshToken(__) {
|
|
175
248
|
return __awaiter(this, void 0, void 0, function* () {
|
|
176
249
|
debug('refreshing an access token...');
|
|
177
|
-
return this.
|
|
250
|
+
// return this.getTokenWithRequest();
|
|
251
|
+
return this.getTokenWithFetch();
|
|
178
252
|
});
|
|
179
253
|
}
|
|
180
254
|
}
|
|
181
|
-
exports.default = RefreshTokenClient;
|
|
182
255
|
/**
|
|
183
256
|
* アクセストークンの有効期限までの猶予時間初期値
|
|
184
257
|
*/
|
|
185
258
|
RefreshTokenClient.DEFAULT_SPARE_TIME_IN_MILLISECONDS = 60000;
|
|
259
|
+
exports.RefreshTokenClient = RefreshTokenClient;
|
package/lib/factory/reserve.d.ts
CHANGED
|
@@ -230,7 +230,7 @@ export interface IUpdTmpReserveSeatResult {
|
|
|
230
230
|
/**
|
|
231
231
|
* 座席チケット仮予約番号
|
|
232
232
|
*/
|
|
233
|
-
tmpReserveNum:
|
|
233
|
+
tmpReserveNum: string;
|
|
234
234
|
/**
|
|
235
235
|
* 仮予約結果リスト(仮予約失敗時の座席毎の仮予約状況)
|
|
236
236
|
*/
|
|
@@ -263,7 +263,7 @@ export interface IDelTmpReserveArgs {
|
|
|
263
263
|
/**
|
|
264
264
|
* 座席チケット仮予約番号
|
|
265
265
|
*/
|
|
266
|
-
tmpReserveNum:
|
|
266
|
+
tmpReserveNum: string;
|
|
267
267
|
}
|
|
268
268
|
/**
|
|
269
269
|
* 座席本予約in
|
|
@@ -292,7 +292,7 @@ export interface IUpdReserveArgs {
|
|
|
292
292
|
/**
|
|
293
293
|
* 座席チケット仮予約番号
|
|
294
294
|
*/
|
|
295
|
-
tmpReserveNum:
|
|
295
|
+
tmpReserveNum: string;
|
|
296
296
|
/**
|
|
297
297
|
* 予約者名
|
|
298
298
|
*/
|
|
@@ -426,7 +426,7 @@ export interface IUpdReserveResult {
|
|
|
426
426
|
/**
|
|
427
427
|
* 座席チケット購入番号
|
|
428
428
|
*/
|
|
429
|
-
reserveNum:
|
|
429
|
+
reserveNum: string;
|
|
430
430
|
/**
|
|
431
431
|
* 入場qrリスト
|
|
432
432
|
*/
|
|
@@ -476,7 +476,7 @@ export interface IDelReserveArgs {
|
|
|
476
476
|
/**
|
|
477
477
|
* 座席チケット購入番号
|
|
478
478
|
*/
|
|
479
|
-
reserveNum:
|
|
479
|
+
reserveNum: string;
|
|
480
480
|
/**
|
|
481
481
|
* 電話番号
|
|
482
482
|
*/
|
|
@@ -510,7 +510,7 @@ export interface IStateReserveArgs {
|
|
|
510
510
|
/**
|
|
511
511
|
* 座席チケット購入番号
|
|
512
512
|
*/
|
|
513
|
-
reserveNum:
|
|
513
|
+
reserveNum: string;
|
|
514
514
|
/**
|
|
515
515
|
* 電話番号
|
|
516
516
|
*/
|
package/lib/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import * as factory from './factory';
|
|
5
5
|
import { MasterService } from './service/master';
|
|
6
6
|
import { ReserveService } from './service/reserve';
|
|
7
|
-
import RefreshTokenClient from './auth/refreshTokenClient';
|
|
7
|
+
import { RefreshTokenClient } from './auth/refreshTokenClient';
|
|
8
8
|
export import factory = factory;
|
|
9
9
|
export declare namespace auth {
|
|
10
10
|
/**
|
package/lib/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var auth;
|
|
|
14
14
|
/**
|
|
15
15
|
* リフレッシュトークン認証クライアント
|
|
16
16
|
*/
|
|
17
|
-
class RefreshToken extends refreshTokenClient_1.
|
|
17
|
+
class RefreshToken extends refreshTokenClient_1.RefreshTokenClient {
|
|
18
18
|
}
|
|
19
19
|
auth.RefreshToken = RefreshToken;
|
|
20
20
|
})(auth = exports.auth || (exports.auth = {}));
|
package/lib/service.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as request from 'request';
|
|
2
|
-
import RefreshTokenClient from './auth/refreshTokenClient';
|
|
2
|
+
import { IRequestOptions, RefreshTokenClient } from './auth/refreshTokenClient';
|
|
3
3
|
/**
|
|
4
4
|
* service constructor options
|
|
5
5
|
*/
|
|
@@ -7,15 +7,16 @@ export interface IOptions {
|
|
|
7
7
|
endpoint: string;
|
|
8
8
|
auth: RefreshTokenClient;
|
|
9
9
|
}
|
|
10
|
+
export type ICustomRequestOption = Pick<request.CoreOptions, 'timeout'>;
|
|
10
11
|
/**
|
|
11
12
|
* base service class
|
|
12
13
|
*/
|
|
13
14
|
export declare class Service {
|
|
14
15
|
options: IOptions;
|
|
15
16
|
requestOptions: request.CoreOptions;
|
|
16
|
-
constructor(options: IOptions, requestOptions?:
|
|
17
|
+
constructor(options: IOptions, requestOptions?: ICustomRequestOption);
|
|
17
18
|
/**
|
|
18
19
|
* Create and send request to API
|
|
19
20
|
*/
|
|
20
|
-
request(options:
|
|
21
|
+
request(options: IRequestOptions, expectedStatusCodes: number[]): Promise<any>;
|
|
21
22
|
}
|
package/lib/transporters.d.ts
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import * as request from 'request';
|
|
2
|
+
export type IRequestOptions = Pick<request.OptionsWithUri, 'uri' | 'method' | 'qs' | 'auth' | 'headers'>;
|
|
2
3
|
/**
|
|
3
4
|
* transporter abstract class
|
|
4
5
|
* トランスポーター抽象クラス
|
|
5
6
|
*/
|
|
6
7
|
export declare abstract class Transporter {
|
|
7
|
-
abstract request(options:
|
|
8
|
+
abstract request(options: IRequestOptions): Promise<any>;
|
|
8
9
|
}
|
|
9
|
-
export
|
|
10
|
+
export type IBodyResponseCallback = Promise<any>;
|
|
10
11
|
/**
|
|
11
12
|
* COAServiceError
|
|
12
13
|
*/
|
|
13
14
|
export declare class COAServiceError extends Error {
|
|
14
15
|
code: number;
|
|
15
16
|
status: string;
|
|
16
|
-
requestOptions:
|
|
17
|
-
constructor(code: number, status: string, message?: string, requestOptions?:
|
|
17
|
+
requestOptions: IRequestOptions | undefined;
|
|
18
|
+
constructor(code: number, status: string, message?: string, requestOptions?: IRequestOptions);
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
21
|
* DefaultTransporter
|
|
@@ -29,11 +30,11 @@ export declare class DefaultTransporter implements Transporter {
|
|
|
29
30
|
/**
|
|
30
31
|
* Configures request options before making a request.
|
|
31
32
|
*/
|
|
32
|
-
static CONFIGURE(options:
|
|
33
|
+
static CONFIGURE(options: IRequestOptions): IRequestOptions;
|
|
33
34
|
/**
|
|
34
35
|
* Makes a request with given options and invokes callback.
|
|
35
36
|
*/
|
|
36
|
-
request(options: request.OptionsWithUri): Promise<any>;
|
|
37
|
+
request(options: Pick<request.OptionsWithUri, 'uri' | 'method' | 'qs' | 'headers'>): Promise<any>;
|
|
37
38
|
/**
|
|
38
39
|
* Wraps the response callback.
|
|
39
40
|
*/
|
package/lib/transporters.js
CHANGED
|
@@ -143,8 +143,8 @@ class DefaultTransporter {
|
|
|
143
143
|
throw err;
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
exports.DefaultTransporter = DefaultTransporter;
|
|
147
146
|
/**
|
|
148
147
|
* Default user agent.
|
|
149
148
|
*/
|
|
150
149
|
DefaultTransporter.USER_AGENT = `coa-service/${pkg.version}`;
|
|
150
|
+
exports.DefaultTransporter = DefaultTransporter;
|
package/package.json
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
}
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"debug": "^3.2.
|
|
17
|
-
"http-status": "^1.
|
|
16
|
+
"debug": "^3.2.7",
|
|
17
|
+
"http-status": "^1.5.2",
|
|
18
18
|
"request": "^2.88.2"
|
|
19
19
|
},
|
|
20
20
|
"description": "COA client library for Node.js",
|
|
@@ -23,8 +23,7 @@
|
|
|
23
23
|
"@types/http-status": "^0.2.30",
|
|
24
24
|
"@types/mocha": "^5.2.0",
|
|
25
25
|
"@types/nock": "^9.1.3",
|
|
26
|
-
"@types/node": "
|
|
27
|
-
"@types/power-assert": "^1.5.0",
|
|
26
|
+
"@types/node": "18.19.2",
|
|
28
27
|
"@types/request": "^2.48.5",
|
|
29
28
|
"@types/sinon": "^4.3.3",
|
|
30
29
|
"coveralls": "^3.0.1",
|
|
@@ -33,21 +32,19 @@
|
|
|
33
32
|
"moment": "^2.22.1",
|
|
34
33
|
"nock": "^9.3.0",
|
|
35
34
|
"nyc": "^15.1.0",
|
|
36
|
-
"power-assert": "^1.5.0",
|
|
37
35
|
"rimraf": "^2.6.2",
|
|
38
36
|
"sinon": "^5.0.10",
|
|
39
|
-
"ts-node": "
|
|
40
|
-
"tslint": "
|
|
41
|
-
"tslint-microsoft-contrib": "
|
|
42
|
-
"
|
|
43
|
-
"typescript": "^4.0.3"
|
|
37
|
+
"ts-node": "10.8.0",
|
|
38
|
+
"tslint": "6.1.3",
|
|
39
|
+
"tslint-microsoft-contrib": "6.2.0",
|
|
40
|
+
"typescript": "5.0.3"
|
|
44
41
|
},
|
|
45
42
|
"engines": {
|
|
46
|
-
"node": ">=
|
|
47
|
-
"npm": ">=
|
|
43
|
+
"node": ">=18.0.0",
|
|
44
|
+
"npm": ">=6.0.0"
|
|
48
45
|
},
|
|
49
46
|
"keywords": [],
|
|
50
|
-
"license": "
|
|
47
|
+
"license": "UNLICENSED",
|
|
51
48
|
"main": "./lib/index.js",
|
|
52
49
|
"types": "./lib/index.d.ts",
|
|
53
50
|
"files": [
|
|
@@ -70,7 +67,7 @@
|
|
|
70
67
|
"build": "tsc",
|
|
71
68
|
"check": "npm run tslint",
|
|
72
69
|
"clean": "rimraf \"npm-debug.log*\" ./lib ./docs ./coverage ./.nyc_output",
|
|
73
|
-
"doc": "
|
|
70
|
+
"doc": "echo \"implementing...\" && exit 0",
|
|
74
71
|
"mocha": "mocha",
|
|
75
72
|
"nyc": "nyc mocha \"src/**/*.spec.ts\"",
|
|
76
73
|
"coverage": "npm run nyc && nyc report --reporter=text-lcov | coveralls",
|
|
@@ -81,5 +78,5 @@
|
|
|
81
78
|
"postversion": "git push origin --tags",
|
|
82
79
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
83
80
|
},
|
|
84
|
-
"version": "9.
|
|
81
|
+
"version": "9.3.0-alpha.0"
|
|
85
82
|
}
|