lhisp-oauth-client 1.0.15 → 1.0.17
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,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import https from "https";
|
|
3
4
|
import { AccessToken, ContentType, ExecutarRequestParams, LhispOauthClientConstructorParams } from "./lhisp-oauth-client.t";
|
|
4
5
|
export declare class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
|
|
@@ -9,7 +10,7 @@ export declare class LhispOauthClient<iAccessToken extends AccessToken = AccessT
|
|
|
9
10
|
protected authHeaderName: string;
|
|
10
11
|
protected tokenHeaderName: string;
|
|
11
12
|
protected authContentType: ContentType;
|
|
12
|
-
protected certificado?: string;
|
|
13
|
+
protected certificado?: string | Buffer;
|
|
13
14
|
protected senhaCertificado?: string;
|
|
14
15
|
protected authScope?: string;
|
|
15
16
|
protected headers?: Headers;
|
|
@@ -33,6 +34,7 @@ export declare class LhispOauthClient<iAccessToken extends AccessToken = AccessT
|
|
|
33
34
|
executarRequest<ResponseType>({ method, path, data, params, contentType, }: ExecutarRequestParams): Promise<ResponseType>;
|
|
34
35
|
get<ResponseType>({ path, contentType, params }: ExecutarRequestParams): Promise<ResponseType>;
|
|
35
36
|
put<ResponseType>({ path, data, contentType }: ExecutarRequestParams): Promise<ResponseType>;
|
|
37
|
+
patch<ResponseType>({ path, data, contentType }: ExecutarRequestParams): Promise<ResponseType>;
|
|
36
38
|
post<ResponseType>({ path, data, contentType }: ExecutarRequestParams): Promise<ResponseType>;
|
|
37
39
|
delete<ResponseType>({ path, contentType }: ExecutarRequestParams): Promise<ResponseType>;
|
|
38
40
|
}
|
|
@@ -24,7 +24,7 @@ class LhispOauthClient {
|
|
|
24
24
|
this.tokenExpiresIn = 0;
|
|
25
25
|
if (params.certificado) {
|
|
26
26
|
this.agent = new https_1.default.Agent({
|
|
27
|
-
pfx: params.certificado,
|
|
27
|
+
pfx: Buffer.isBuffer(params.certificado) ? params.certificado : Buffer.from(params.certificado, "base64"),
|
|
28
28
|
passphrase: params.senhaCertificado,
|
|
29
29
|
rejectUnauthorized: false,
|
|
30
30
|
});
|
|
@@ -173,6 +173,16 @@ class LhispOauthClient {
|
|
|
173
173
|
});
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
|
+
patch({ path, data, contentType = lhisp_oauth_client_t_1.ContentType.APPLICATION_JSON }) {
|
|
177
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
178
|
+
return this.executarRequest({
|
|
179
|
+
method: "PATCH",
|
|
180
|
+
path,
|
|
181
|
+
data,
|
|
182
|
+
contentType,
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
}
|
|
176
186
|
post({ path, data, contentType = lhisp_oauth_client_t_1.ContentType.APPLICATION_JSON }) {
|
|
177
187
|
return __awaiter(this, void 0, void 0, function* () {
|
|
178
188
|
return this.executarRequest({
|