lhisp-oauth-client 1.0.35 → 1.0.36
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lhisp-oauth-client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.36",
|
|
4
4
|
"main": "src/index",
|
|
5
5
|
"types": "src/index.d.ts",
|
|
6
6
|
"repository": {
|
|
@@ -23,6 +23,6 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"axios": "^1.10.0",
|
|
26
|
-
"lhisp-logger": "^
|
|
26
|
+
"lhisp-logger": "^2.2.2"
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import https from "https";
|
|
2
1
|
import { AxiosHeaders } from "axios";
|
|
2
|
+
import https from "https";
|
|
3
3
|
import { AccessToken, ContentType, ExecutarRequestParams, LhispOauthClientConstructorParams } from "./lhisp-oauth-client.t";
|
|
4
4
|
export declare class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
|
|
5
5
|
protected authUrl: string;
|
|
@@ -24,11 +24,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.LhispOauthClient = void 0;
|
|
27
|
-
const querystring_1 = __importDefault(require("querystring"));
|
|
28
|
-
const https_1 = __importDefault(require("https"));
|
|
29
27
|
const axios_1 = __importDefault(require("axios"));
|
|
30
|
-
const
|
|
28
|
+
const https_1 = __importDefault(require("https"));
|
|
31
29
|
const lhisp_logger_1 = __importDefault(require("lhisp-logger"));
|
|
30
|
+
const querystring_1 = __importDefault(require("querystring"));
|
|
31
|
+
const lhisp_oauth_client_t_1 = require("./lhisp-oauth-client.t");
|
|
32
|
+
const logger = (0, lhisp_logger_1.default)({ name: "lhisp-oauth-client" });
|
|
32
33
|
class LhispOauthClient {
|
|
33
34
|
constructor(params) {
|
|
34
35
|
this.authData = {};
|
|
@@ -118,7 +119,7 @@ class LhispOauthClient {
|
|
|
118
119
|
});
|
|
119
120
|
const resp = yield axios_1.default.request(authRequestOpt);
|
|
120
121
|
if (!(resp === null || resp === void 0 ? void 0 : resp.data)) {
|
|
121
|
-
|
|
122
|
+
logger.error({ message: "LhispOauthClient.getAccessToken", resp });
|
|
122
123
|
throw new Error("Resposta inválida ao obter token de acesso.");
|
|
123
124
|
}
|
|
124
125
|
this.accessToken = this.buildAccessToken(resp.data);
|
|
@@ -127,7 +128,7 @@ class LhispOauthClient {
|
|
|
127
128
|
return this.accessToken;
|
|
128
129
|
}
|
|
129
130
|
catch (error) {
|
|
130
|
-
|
|
131
|
+
logger.error({ message: "LhispOauthClient.getAccessToken", error });
|
|
131
132
|
throw error;
|
|
132
133
|
}
|
|
133
134
|
});
|
|
@@ -157,7 +158,7 @@ class LhispOauthClient {
|
|
|
157
158
|
return response.data;
|
|
158
159
|
}
|
|
159
160
|
catch (error) {
|
|
160
|
-
|
|
161
|
+
logger.error({
|
|
161
162
|
message: "LhispOauthClient.executarRequest",
|
|
162
163
|
method,
|
|
163
164
|
url: `${this.apiUrl}${path}`,
|