@motionpicture/coa-service 9.6.0 → 9.7.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/example/findFilms.js
CHANGED
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.RefreshTokenClient = void 0;
|
|
13
13
|
const createDebug = require("debug");
|
|
14
14
|
const http_status_1 = require("http-status");
|
|
15
|
-
|
|
15
|
+
// import { default as fetch } from 'node-fetch';
|
|
16
16
|
const transporters_1 = require("../transporters");
|
|
17
17
|
const debug = createDebug('coa-service:auth:refreshTokenClient');
|
|
18
18
|
const TIMEOUT = 10000;
|
|
@@ -33,7 +33,7 @@ class RefreshTokenClient {
|
|
|
33
33
|
debug('requesting an access token...');
|
|
34
34
|
try {
|
|
35
35
|
const params = new URLSearchParams({ refresh_token: String(this.options.refreshToken) });
|
|
36
|
-
const res = yield (
|
|
36
|
+
const res = yield fetch(`${this.options.endpoint}/token/access_token`, {
|
|
37
37
|
method: 'POST',
|
|
38
38
|
headers: {
|
|
39
39
|
'Content-Type': 'application/x-www-form-urlencoded'
|
package/lib/transporters.js
CHANGED
|
@@ -16,7 +16,7 @@ exports.FetchTransporter = exports.Transporter = exports.COAServiceError = expor
|
|
|
16
16
|
*/
|
|
17
17
|
const createDebug = require("debug");
|
|
18
18
|
const http_status_1 = require("http-status");
|
|
19
|
-
|
|
19
|
+
// import { default as fetch, Response } from 'node-fetch';
|
|
20
20
|
const querystring = require("querystring");
|
|
21
21
|
const coaServiceError_1 = require("./transporter/coaServiceError");
|
|
22
22
|
Object.defineProperty(exports, "COAServiceError", { enumerable: true, get: function () { return coaServiceError_1.COAServiceError; } });
|
|
@@ -169,7 +169,7 @@ class FetchTransporter {
|
|
|
169
169
|
const input = `${requestOptions.baseUrl}${requestOptions.uri}?${querystring.stringify(requestOptions.qs)}`;
|
|
170
170
|
const accessToken = (_a = requestOptions.auth) === null || _a === void 0 ? void 0 : _a.bearer;
|
|
171
171
|
debug('fetching...', input, requestOptions);
|
|
172
|
-
return (
|
|
172
|
+
return fetch(input, Object.assign({ method: requestOptions.method, headers: Object.assign(Object.assign({}, requestOptions.headers), (typeof accessToken === 'string') ? { Authorization: `Bearer ${accessToken}` } /* istanbul ignore else */ : undefined) }, (typeof requestOptions.timeout === 'number') ? { signal: AbortSignal.timeout(requestOptions.timeout) } : undefined))
|
|
173
173
|
.then((res) => __awaiter(this, void 0, void 0, function* () { return this.wrapCallback(res, requestOptions); }));
|
|
174
174
|
});
|
|
175
175
|
}
|
package/package.json
CHANGED
|
@@ -13,9 +13,8 @@
|
|
|
13
13
|
}
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"debug": "
|
|
17
|
-
"http-status": "
|
|
18
|
-
"node-fetch": "2.7.0"
|
|
16
|
+
"debug": "3.2.7",
|
|
17
|
+
"http-status": "1.5.2"
|
|
19
18
|
},
|
|
20
19
|
"description": "COA client library for Node.js",
|
|
21
20
|
"devDependencies": {
|
|
@@ -23,7 +22,6 @@
|
|
|
23
22
|
"@types/http-status": "^0.2.30",
|
|
24
23
|
"@types/mocha": "^5.2.0",
|
|
25
24
|
"@types/node": "18.19.2",
|
|
26
|
-
"@types/node-fetch": "2.6.11",
|
|
27
25
|
"@types/sinon": "^4.3.3",
|
|
28
26
|
"coveralls": "^3.0.1",
|
|
29
27
|
"grunt-contrib-watch": "^1.1.0",
|
|
@@ -77,5 +75,5 @@
|
|
|
77
75
|
"postversion": "git push origin --tags",
|
|
78
76
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
79
77
|
},
|
|
80
|
-
"version": "9.
|
|
78
|
+
"version": "9.7.0-alpha.0"
|
|
81
79
|
}
|