Compare commits
No commits in common. "master" and "development" have entirely different histories.
master
...
developmen
5 changed files with 315 additions and 349 deletions
316
README.md
316
README.md
|
|
@ -1,316 +0,0 @@
|
||||||
# lhisp-oauth-client
|
|
||||||
|
|
||||||
Bilingual README (Português / English) for the **lhisp-oauth-client** library.
|
|
||||||
|
|
||||||
- [Português (PT-BR)](#português-pt-br)
|
|
||||||
- [English](#english)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Português (PT-BR)
|
|
||||||
|
|
||||||
Cliente HTTP simples para consumir uma API protegida por **OAuth2 (Client Credentials)**, cuidando automaticamente de:
|
|
||||||
|
|
||||||
- Obter o `access_token` no endpoint de autenticação
|
|
||||||
- Cache do token até expirar (com margem de ~10s)
|
|
||||||
- Enviar o token nas requisições subsequentes para a API
|
|
||||||
- Suporte opcional a **certificado cliente (PFX)** via `https.Agent`
|
|
||||||
|
|
||||||
> Observação: refresh token **ainda não está implementado** (há um `TODO` no código). Quando o token expira, um novo token é solicitado.
|
|
||||||
|
|
||||||
### Instalação
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm i lhisp-oauth-client
|
|
||||||
# ou
|
|
||||||
yarn add lhisp-oauth-client
|
|
||||||
```
|
|
||||||
|
|
||||||
### Uso rápido
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import { LhispOauthClient } from "lhisp-oauth-client";
|
|
||||||
|
|
||||||
const client = new LhispOauthClient({
|
|
||||||
apiUrl: "https://api.exemplo.com",
|
|
||||||
authUrl: "https://auth.exemplo.com/oauth/token",
|
|
||||||
clientId: "SEU_CLIENT_ID",
|
|
||||||
clientSecret: "SEU_CLIENT_SECRET",
|
|
||||||
});
|
|
||||||
|
|
||||||
type StatusResponse = { status: string };
|
|
||||||
|
|
||||||
async function main() {
|
|
||||||
const resp = await client.get<StatusResponse>({
|
|
||||||
path: "/status",
|
|
||||||
params: { verbose: true },
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log(resp.status);
|
|
||||||
}
|
|
||||||
|
|
||||||
main();
|
|
||||||
```
|
|
||||||
|
|
||||||
### API (principais métodos)
|
|
||||||
|
|
||||||
- `getAccessToken(): Promise<AccessToken>`
|
|
||||||
- Obtém e cacheia o token.
|
|
||||||
- `getAuthToken(): string`
|
|
||||||
- Retorna o header final de autorização (por padrão `"<token_type> <access_token>"`).
|
|
||||||
- `executarRequest<ResponseType>(params): Promise<ResponseType>`
|
|
||||||
- Método base que injeta token e executa request via Axios.
|
|
||||||
- Atalhos HTTP:
|
|
||||||
- `get`, `post`, `put`, `patch`, `delete`
|
|
||||||
|
|
||||||
### Parâmetros do construtor
|
|
||||||
|
|
||||||
`new LhispOauthClient(params)` aceita:
|
|
||||||
|
|
||||||
- `apiUrl` (string, obrigatório): URL base da API (ex.: `https://api.exemplo.com`)
|
|
||||||
- `authUrl` (string, obrigatório): endpoint OAuth2 para obter token
|
|
||||||
- `clientId` (string, obrigatório)
|
|
||||||
- `clientSecret` (string, obrigatório)
|
|
||||||
|
|
||||||
Opcionalmente:
|
|
||||||
|
|
||||||
- `certificado` (string | Buffer): certificado cliente PFX
|
|
||||||
- Se for string, o código assume **base64** e faz `Buffer.from(certificado, "base64")`
|
|
||||||
- `senhaCertificado` (string): senha do PFX
|
|
||||||
- `authScope` (string): adiciona `scope` no request de token
|
|
||||||
- `grantType` (string): padrão `client_credentials`
|
|
||||||
- `authContentType` (`ContentType`): padrão `application/x-www-form-urlencoded`
|
|
||||||
- `authData` (Record<string,string>): campos extras enviados ao endpoint de token
|
|
||||||
- `headers` (object): headers aplicados nas requisições para a API
|
|
||||||
- `authHeaders` (object): headers extras somente na obtenção do token
|
|
||||||
- `authHeaderName` (string): nome do header usado para credenciais Basic (padrão `Authorization`)
|
|
||||||
- `tokenHeaderName` (string): nome do header onde o token é enviado (padrão `Authorization`)
|
|
||||||
- `sendAuthCredentialsOnRequestBody` (boolean): envia `client_id` e `client_secret` também no body
|
|
||||||
- `formatAccessToken` ((token?) => string): personaliza o valor enviado no header do token
|
|
||||||
- `timeout` (number): timeout das requisições (ms). Padrão `60000`
|
|
||||||
- `logger` (Logger): logger compatível (com `.child()` + métodos `info/warn/error/debug`)
|
|
||||||
|
|
||||||
### Content-Type
|
|
||||||
|
|
||||||
Você pode escolher o `Content-Type` das requisições para API via `contentType`:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import { ContentType } from "lhisp-oauth-client";
|
|
||||||
|
|
||||||
await client.post({
|
|
||||||
path: "/clientes",
|
|
||||||
contentType: ContentType.APPLICATION_JSON,
|
|
||||||
data: { name: "Maria" },
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
> Nota: o `contentType` de **autenticação** (request do token) é controlado por `authContentType`.
|
|
||||||
|
|
||||||
### Exemplo: credenciais no body (alguns servidores exigem)
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import { LhispOauthClient, ContentType } from "lhisp-oauth-client";
|
|
||||||
|
|
||||||
const client = new LhispOauthClient({
|
|
||||||
apiUrl: "https://api.exemplo.com",
|
|
||||||
authUrl: "https://auth.exemplo.com/oauth/token",
|
|
||||||
clientId: "SEU_CLIENT_ID",
|
|
||||||
clientSecret: "SEU_CLIENT_SECRET",
|
|
||||||
authContentType: ContentType.APPLICATION_JSON,
|
|
||||||
sendAuthCredentialsOnRequestBody: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
await client.get({ path: "/status" });
|
|
||||||
```
|
|
||||||
|
|
||||||
### Exemplo: header de token customizado
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import { LhispOauthClient } from "lhisp-oauth-client";
|
|
||||||
|
|
||||||
const client = new LhispOauthClient({
|
|
||||||
apiUrl: "https://api.exemplo.com",
|
|
||||||
authUrl: "https://auth.exemplo.com/oauth/token",
|
|
||||||
clientId: "SEU_CLIENT_ID",
|
|
||||||
clientSecret: "SEU_CLIENT_SECRET",
|
|
||||||
tokenHeaderName: "x-token",
|
|
||||||
});
|
|
||||||
|
|
||||||
await client.get({ path: "/status" });
|
|
||||||
```
|
|
||||||
|
|
||||||
### Exemplo: usando certificado (PFX)
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import fs from "node:fs";
|
|
||||||
import { LhispOauthClient } from "lhisp-oauth-client";
|
|
||||||
|
|
||||||
const pfxBuffer = fs.readFileSync("./certificado.pfx");
|
|
||||||
|
|
||||||
const client = new LhispOauthClient({
|
|
||||||
apiUrl: "https://api.exemplo.com",
|
|
||||||
authUrl: "https://auth.exemplo.com/oauth/token",
|
|
||||||
clientId: "SEU_CLIENT_ID",
|
|
||||||
clientSecret: "SEU_CLIENT_SECRET",
|
|
||||||
certificado: pfxBuffer,
|
|
||||||
senhaCertificado: "SENHA_DO_PFX",
|
|
||||||
});
|
|
||||||
|
|
||||||
await client.get({ path: "/status" });
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## English
|
|
||||||
|
|
||||||
A lightweight HTTP client to consume an API protected by **OAuth2 (Client Credentials)**. It automatically:
|
|
||||||
|
|
||||||
- Fetches an `access_token` from the auth endpoint
|
|
||||||
- Caches the token until it expires (with a ~10s safety margin)
|
|
||||||
- Sends the token on subsequent API requests
|
|
||||||
- Optionally supports **client certificate (PFX)** via `https.Agent`
|
|
||||||
|
|
||||||
> Note: refresh token is **not implemented yet** (there is a `TODO` in the code). When the token expires, a new token is requested.
|
|
||||||
|
|
||||||
### Install
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm i lhisp-oauth-client
|
|
||||||
# or
|
|
||||||
yarn add lhisp-oauth-client
|
|
||||||
```
|
|
||||||
|
|
||||||
### Quick start
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import { LhispOauthClient } from "lhisp-oauth-client";
|
|
||||||
|
|
||||||
const client = new LhispOauthClient({
|
|
||||||
apiUrl: "https://api.example.com",
|
|
||||||
authUrl: "https://auth.example.com/oauth/token",
|
|
||||||
clientId: "YOUR_CLIENT_ID",
|
|
||||||
clientSecret: "YOUR_CLIENT_SECRET",
|
|
||||||
});
|
|
||||||
|
|
||||||
type StatusResponse = { status: string };
|
|
||||||
|
|
||||||
async function main() {
|
|
||||||
const resp = await client.get<StatusResponse>({
|
|
||||||
path: "/status",
|
|
||||||
params: { verbose: true },
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log(resp.status);
|
|
||||||
}
|
|
||||||
|
|
||||||
main();
|
|
||||||
```
|
|
||||||
|
|
||||||
### API (main methods)
|
|
||||||
|
|
||||||
- `getAccessToken(): Promise<AccessToken>`
|
|
||||||
- Fetches and caches the token.
|
|
||||||
- `getAuthToken(): string`
|
|
||||||
- Returns the final auth header value (by default `"<token_type> <access_token>"`).
|
|
||||||
- `executarRequest<ResponseType>(params): Promise<ResponseType>`
|
|
||||||
- Base method that injects the token and performs the request via Axios.
|
|
||||||
- HTTP helpers:
|
|
||||||
- `get`, `post`, `put`, `patch`, `delete`
|
|
||||||
|
|
||||||
### Constructor parameters
|
|
||||||
|
|
||||||
`new LhispOauthClient(params)` accepts:
|
|
||||||
|
|
||||||
Required:
|
|
||||||
|
|
||||||
- `apiUrl` (string): API base URL (e.g. `https://api.example.com`)
|
|
||||||
- `authUrl` (string): OAuth2 token endpoint
|
|
||||||
- `clientId` (string)
|
|
||||||
- `clientSecret` (string)
|
|
||||||
|
|
||||||
Optional:
|
|
||||||
|
|
||||||
- `certificado` (string | Buffer): PFX client certificate
|
|
||||||
- If string, it is treated as **base64** and converted using `Buffer.from(certificado, "base64")`
|
|
||||||
- `senhaCertificado` (string): PFX password
|
|
||||||
- `authScope` (string): adds `scope` to the token request
|
|
||||||
- `grantType` (string): default `client_credentials`
|
|
||||||
- `authContentType` (`ContentType`): default `application/x-www-form-urlencoded`
|
|
||||||
- `authData` (Record<string,string>): extra fields sent to the token endpoint
|
|
||||||
- `headers` (object): headers applied to API calls
|
|
||||||
- `authHeaders` (object): extra headers only for token retrieval
|
|
||||||
- `authHeaderName` (string): Basic credentials header name (default `Authorization`)
|
|
||||||
- `tokenHeaderName` (string): token header name (default `Authorization`)
|
|
||||||
- `sendAuthCredentialsOnRequestBody` (boolean): also sends `client_id` and `client_secret` in the request body
|
|
||||||
- `formatAccessToken` ((token?) => string): customize token header value
|
|
||||||
- `timeout` (number): request timeout in ms (default `60000`)
|
|
||||||
- `logger` (Logger): compatible logger (must support `.child()` and `info/warn/error/debug`)
|
|
||||||
|
|
||||||
### Content-Type
|
|
||||||
|
|
||||||
You can set the API request `Content-Type` using `contentType`:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import { ContentType } from "lhisp-oauth-client";
|
|
||||||
|
|
||||||
await client.post({
|
|
||||||
path: "/customers",
|
|
||||||
contentType: ContentType.APPLICATION_JSON,
|
|
||||||
data: { name: "Alice" },
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
> Note: the **auth/token** request content type is controlled by `authContentType`.
|
|
||||||
|
|
||||||
### Example: credentials in request body
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import { LhispOauthClient, ContentType } from "lhisp-oauth-client";
|
|
||||||
|
|
||||||
const client = new LhispOauthClient({
|
|
||||||
apiUrl: "https://api.example.com",
|
|
||||||
authUrl: "https://auth.example.com/oauth/token",
|
|
||||||
clientId: "YOUR_CLIENT_ID",
|
|
||||||
clientSecret: "YOUR_CLIENT_SECRET",
|
|
||||||
authContentType: ContentType.APPLICATION_JSON,
|
|
||||||
sendAuthCredentialsOnRequestBody: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
await client.get({ path: "/status" });
|
|
||||||
```
|
|
||||||
|
|
||||||
### Example: custom token header
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import { LhispOauthClient } from "lhisp-oauth-client";
|
|
||||||
|
|
||||||
const client = new LhispOauthClient({
|
|
||||||
apiUrl: "https://api.example.com",
|
|
||||||
authUrl: "https://auth.example.com/oauth/token",
|
|
||||||
clientId: "YOUR_CLIENT_ID",
|
|
||||||
clientSecret: "YOUR_CLIENT_SECRET",
|
|
||||||
tokenHeaderName: "x-token",
|
|
||||||
});
|
|
||||||
|
|
||||||
await client.get({ path: "/status" });
|
|
||||||
```
|
|
||||||
|
|
||||||
### Example: using a PFX certificate
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import fs from "node:fs";
|
|
||||||
import { LhispOauthClient } from "lhisp-oauth-client";
|
|
||||||
|
|
||||||
const pfxBuffer = fs.readFileSync("./certificate.pfx");
|
|
||||||
|
|
||||||
const client = new LhispOauthClient({
|
|
||||||
apiUrl: "https://api.example.com",
|
|
||||||
authUrl: "https://auth.example.com/oauth/token",
|
|
||||||
clientId: "YOUR_CLIENT_ID",
|
|
||||||
clientSecret: "YOUR_CLIENT_SECRET",
|
|
||||||
certificado: pfxBuffer,
|
|
||||||
senhaCertificado: "PFX_PASSWORD",
|
|
||||||
});
|
|
||||||
|
|
||||||
await client.get({ path: "/status" });
|
|
||||||
```
|
|
||||||
311
package-lock.json
generated
311
package-lock.json
generated
|
|
@ -1,15 +1,16 @@
|
||||||
{
|
{
|
||||||
"name": "lhisp-oauth-client",
|
"name": "lhisp-oauth-client-dev",
|
||||||
"version": "1.0.40",
|
"version": "1.0.35",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "lhisp-oauth-client",
|
"name": "lhisp-oauth-client-dev",
|
||||||
"version": "1.0.40",
|
"version": "1.0.35",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.10.0"
|
"axios": "^1.10.0",
|
||||||
|
"lhisp-logger": "^2.2.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^30.0.0",
|
"@types/jest": "^30.0.0",
|
||||||
|
|
@ -973,6 +974,12 @@
|
||||||
"@jridgewell/sourcemap-codec": "^1.4.14"
|
"@jridgewell/sourcemap-codec": "^1.4.14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@pinojs/redact": {
|
||||||
|
"version": "0.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@pinojs/redact/-/redact-0.4.0.tgz",
|
||||||
|
"integrity": "sha512-k2ENnmBugE/rzQfEcdWHcCY+/FM3VLzH9cYEsbdsoqrvzAKRhUZeRNhAZvB8OitQJ1TBed3yqWtdjzS6wJKBwg==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/@pkgjs/parseargs": {
|
"node_modules/@pkgjs/parseargs": {
|
||||||
"version": "0.11.0",
|
"version": "0.11.0",
|
||||||
"resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz",
|
"resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz",
|
||||||
|
|
@ -1257,6 +1264,15 @@
|
||||||
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
|
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/atomic-sleep": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/axios": {
|
"node_modules/axios": {
|
||||||
"version": "1.13.2",
|
"version": "1.13.2",
|
||||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.13.2.tgz",
|
"resolved": "https://registry.npmjs.org/axios/-/axios-1.13.2.tgz",
|
||||||
|
|
@ -1679,6 +1695,12 @@
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/colorette": {
|
||||||
|
"version": "2.0.20",
|
||||||
|
"resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz",
|
||||||
|
"integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/combined-stream": {
|
"node_modules/combined-stream": {
|
||||||
"version": "1.0.8",
|
"version": "1.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||||
|
|
@ -1720,6 +1742,15 @@
|
||||||
"node": ">= 8"
|
"node": ">= 8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/dateformat": {
|
||||||
|
"version": "4.6.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/dateformat/-/dateformat-4.6.3.tgz",
|
||||||
|
"integrity": "sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/debug": {
|
"node_modules/debug": {
|
||||||
"version": "4.3.4",
|
"version": "4.3.4",
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
||||||
|
|
@ -1846,6 +1877,15 @@
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/end-of-stream": {
|
||||||
|
"version": "1.4.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz",
|
||||||
|
"integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"once": "^1.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/error-ex": {
|
"node_modules/error-ex": {
|
||||||
"version": "1.3.2",
|
"version": "1.3.2",
|
||||||
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
|
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
|
||||||
|
|
@ -1987,6 +2027,12 @@
|
||||||
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
|
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/fast-copy": {
|
||||||
|
"version": "4.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/fast-copy/-/fast-copy-4.0.2.tgz",
|
||||||
|
"integrity": "sha512-ybA6PDXIXOXivLJK/z9e+Otk7ve13I4ckBvGO5I2RRmBU1gMHLVDJYEuJYhGwez7YNlYji2M2DvVU+a9mSFDlw==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/fast-json-stable-stringify": {
|
"node_modules/fast-json-stable-stringify": {
|
||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
|
||||||
|
|
@ -1994,6 +2040,12 @@
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/fast-safe-stringify": {
|
||||||
|
"version": "2.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz",
|
||||||
|
"integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/fb-watchman": {
|
"node_modules/fb-watchman": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz",
|
||||||
|
|
@ -2350,6 +2402,12 @@
|
||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/help-me": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/help-me/-/help-me-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-7xgomUX6ADmcYzFik0HzAxh/73YlKR9bmFzf51CZwR+b6YtzU2m0u49hQCqV6SvlqIqsaxovfwdvbnsw3b/zpg==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/html-escaper": {
|
"node_modules/html-escaper": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz",
|
||||||
|
|
@ -3198,6 +3256,15 @@
|
||||||
"url": "https://github.com/chalk/supports-color?sponsor=1"
|
"url": "https://github.com/chalk/supports-color?sponsor=1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/joycon": {
|
||||||
|
"version": "3.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz",
|
||||||
|
"integrity": "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/js-tokens": {
|
"node_modules/js-tokens": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
||||||
|
|
@ -3262,6 +3329,17 @@
|
||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/lhisp-logger": {
|
||||||
|
"version": "2.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/lhisp-logger/-/lhisp-logger-2.2.2.tgz",
|
||||||
|
"integrity": "sha512-hoQced0w2ZShF+UbTu6OkQsWSdGcyG3qJ6oxmJFJjb/tBrTbAiRX0WrvPMC5wa1hBICm2v8KcnaGZN25HITxxw==",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"pino": "^10.1.0",
|
||||||
|
"pino-loki": "^3.0.0",
|
||||||
|
"pino-pretty": "^13.1.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/lines-and-columns": {
|
"node_modules/lines-and-columns": {
|
||||||
"version": "1.2.4",
|
"version": "1.2.4",
|
||||||
"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz",
|
||||||
|
|
@ -3417,6 +3495,15 @@
|
||||||
"node": "*"
|
"node": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/minimist": {
|
||||||
|
"version": "1.2.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
|
||||||
|
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/minipass": {
|
"node_modules/minipass": {
|
||||||
"version": "7.1.2",
|
"version": "7.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
|
||||||
|
|
@ -3492,11 +3579,19 @@
|
||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/on-exit-leak-free": {
|
||||||
|
"version": "2.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/on-exit-leak-free/-/on-exit-leak-free-2.1.2.tgz",
|
||||||
|
"integrity": "sha512-0eJJY6hXLGf1udHwfNftBqH+g73EU4B504nZeKpz1sYRKafAghwxEJunB2O7rDZkL4PGfsMVnTXZ2EjibbqcsA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/once": {
|
"node_modules/once": {
|
||||||
"version": "1.4.0",
|
"version": "1.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||||
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
|
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
|
||||||
"dev": true,
|
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"wrappy": "1"
|
"wrappy": "1"
|
||||||
|
|
@ -3673,6 +3768,116 @@
|
||||||
"url": "https://github.com/sponsors/jonschlinkert"
|
"url": "https://github.com/sponsors/jonschlinkert"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/pino": {
|
||||||
|
"version": "10.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pino/-/pino-10.1.0.tgz",
|
||||||
|
"integrity": "sha512-0zZC2ygfdqvqK8zJIr1e+wT1T/L+LF6qvqvbzEQ6tiMAoTqEVK9a1K3YRu8HEUvGEvNqZyPJTtb2sNIoTkB83w==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@pinojs/redact": "^0.4.0",
|
||||||
|
"atomic-sleep": "^1.0.0",
|
||||||
|
"on-exit-leak-free": "^2.1.0",
|
||||||
|
"pino-abstract-transport": "^2.0.0",
|
||||||
|
"pino-std-serializers": "^7.0.0",
|
||||||
|
"process-warning": "^5.0.0",
|
||||||
|
"quick-format-unescaped": "^4.0.3",
|
||||||
|
"real-require": "^0.2.0",
|
||||||
|
"safe-stable-stringify": "^2.3.1",
|
||||||
|
"sonic-boom": "^4.0.1",
|
||||||
|
"thread-stream": "^3.0.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"pino": "bin.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/pino-abstract-transport": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pino-abstract-transport/-/pino-abstract-transport-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-F63x5tizV6WCh4R6RHyi2Ml+M70DNRXt/+HANowMflpgGFMAym/VKm6G7ZOQRjqN7XbGxK1Lg9t6ZrtzOaivMw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"split2": "^4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/pino-loki": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pino-loki/-/pino-loki-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-9TyUW5syTjp2nT70QcijJtIWUzdYUj+olQ7+fWNfm1/HrDGEWt86Q4ACzClH6DM6GBwtQimRDgneNczP+p4ypA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"pino-abstract-transport": "^3.0.0",
|
||||||
|
"pump": "^3.0.3"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"pino-loki": "dist/cli.mjs"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=20"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/Julien-R44"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/pino-loki/node_modules/pino-abstract-transport": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pino-abstract-transport/-/pino-abstract-transport-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-wlfUczU+n7Hy/Ha5j9a/gZNy7We5+cXp8YL+X+PG8S0KXxw7n/JXA3c46Y0zQznIJ83URJiwy7Lh56WLokNuxg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"split2": "^4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/pino-pretty": {
|
||||||
|
"version": "13.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/pino-pretty/-/pino-pretty-13.1.3.tgz",
|
||||||
|
"integrity": "sha512-ttXRkkOz6WWC95KeY9+xxWL6AtImwbyMHrL1mSwqwW9u+vLp/WIElvHvCSDg0xO/Dzrggz1zv3rN5ovTRVowKg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"colorette": "^2.0.7",
|
||||||
|
"dateformat": "^4.6.3",
|
||||||
|
"fast-copy": "^4.0.0",
|
||||||
|
"fast-safe-stringify": "^2.1.1",
|
||||||
|
"help-me": "^5.0.0",
|
||||||
|
"joycon": "^3.1.1",
|
||||||
|
"minimist": "^1.2.6",
|
||||||
|
"on-exit-leak-free": "^2.1.0",
|
||||||
|
"pino-abstract-transport": "^3.0.0",
|
||||||
|
"pump": "^3.0.0",
|
||||||
|
"secure-json-parse": "^4.0.0",
|
||||||
|
"sonic-boom": "^4.0.1",
|
||||||
|
"strip-json-comments": "^5.0.2"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"pino-pretty": "bin.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/pino-pretty/node_modules/pino-abstract-transport": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pino-abstract-transport/-/pino-abstract-transport-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-wlfUczU+n7Hy/Ha5j9a/gZNy7We5+cXp8YL+X+PG8S0KXxw7n/JXA3c46Y0zQznIJ83URJiwy7Lh56WLokNuxg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"split2": "^4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/pino-pretty/node_modules/strip-json-comments": {
|
||||||
|
"version": "5.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-5.0.3.tgz",
|
||||||
|
"integrity": "sha512-1tB5mhVo7U+ETBKNf92xT4hrQa3pm0MZ0PQvuDnWgAAGHDsfp4lPSpiS6psrSiet87wyGPh9ft6wmhOMQ0hDiw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.16"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/pino-std-serializers": {
|
||||||
|
"version": "7.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-7.0.0.tgz",
|
||||||
|
"integrity": "sha512-e906FRY0+tV27iq4juKzSYPbUj2do2X2JX4EzSca1631EB2QJQUqGbDuERal7LCtOpxl6x3+nvo9NPZcmjkiFA==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/pirates": {
|
"node_modules/pirates": {
|
||||||
"version": "4.0.7",
|
"version": "4.0.7",
|
||||||
"resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.7.tgz",
|
"resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.7.tgz",
|
||||||
|
|
@ -3724,12 +3929,38 @@
|
||||||
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/process-warning": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/process-warning/-/process-warning-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-a39t9ApHNx2L4+HBnQKqxxHNs1r7KF+Intd8Q/g1bUh6q0WIp9voPXJ/x0j+ZL45KF1pJd9+q2jLIRMfvEshkA==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/fastify"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/fastify"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/proxy-from-env": {
|
"node_modules/proxy-from-env": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
|
||||||
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
|
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/pump": {
|
||||||
|
"version": "3.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.3.tgz",
|
||||||
|
"integrity": "sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"end-of-stream": "^1.1.0",
|
||||||
|
"once": "^1.3.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/pure-rand": {
|
"node_modules/pure-rand": {
|
||||||
"version": "7.0.1",
|
"version": "7.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-7.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-7.0.1.tgz",
|
||||||
|
|
@ -3747,6 +3978,12 @@
|
||||||
],
|
],
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/quick-format-unescaped": {
|
||||||
|
"version": "4.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-4.0.4.tgz",
|
||||||
|
"integrity": "sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/react-is": {
|
"node_modules/react-is": {
|
||||||
"version": "18.3.1",
|
"version": "18.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz",
|
||||||
|
|
@ -3754,6 +3991,15 @@
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/real-require": {
|
||||||
|
"version": "0.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/real-require/-/real-require-0.2.0.tgz",
|
||||||
|
"integrity": "sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 12.13.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/require-directory": {
|
"node_modules/require-directory": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
|
||||||
|
|
@ -3787,6 +4033,31 @@
|
||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/safe-stable-stringify": {
|
||||||
|
"version": "2.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz",
|
||||||
|
"integrity": "sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/secure-json-parse": {
|
||||||
|
"version": "4.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-4.1.0.tgz",
|
||||||
|
"integrity": "sha512-l4KnYfEyqYJxDwlNVyRfO2E4NTHfMKAWdUuA8J0yve2Dz/E/PdBepY03RvyJpssIpRFwJoCD55wA+mEDs6ByWA==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/fastify"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/fastify"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"license": "BSD-3-Clause"
|
||||||
|
},
|
||||||
"node_modules/semver": {
|
"node_modules/semver": {
|
||||||
"version": "6.3.1",
|
"version": "6.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
|
||||||
|
|
@ -3835,6 +4106,15 @@
|
||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/sonic-boom": {
|
||||||
|
"version": "4.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-4.2.0.tgz",
|
||||||
|
"integrity": "sha512-INb7TM37/mAcsGmc9hyyI6+QR3rR1zVRu36B0NeGXKnOOLiZOfER5SA+N7X7k3yUYRzLWafduTDvJAfDswwEww==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"atomic-sleep": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/source-map": {
|
"node_modules/source-map": {
|
||||||
"version": "0.6.1",
|
"version": "0.6.1",
|
||||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||||
|
|
@ -3856,6 +4136,15 @@
|
||||||
"source-map": "^0.6.0"
|
"source-map": "^0.6.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/split2": {
|
||||||
|
"version": "4.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz",
|
||||||
|
"integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==",
|
||||||
|
"license": "ISC",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10.x"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/sprintf-js": {
|
"node_modules/sprintf-js": {
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
|
||||||
|
|
@ -4116,6 +4405,15 @@
|
||||||
"url": "https://github.com/sponsors/isaacs"
|
"url": "https://github.com/sponsors/isaacs"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/thread-stream": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/thread-stream/-/thread-stream-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-OqyPZ9u96VohAyMfJykzmivOrY2wfMSf3C5TtFJVgN+Hm6aj+voFhlK+kZEIv2FBh1X6Xp3DlnCOfEQ3B2J86A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"real-require": "^0.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/tmpl": {
|
"node_modules/tmpl": {
|
||||||
"version": "1.0.5",
|
"version": "1.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz",
|
||||||
|
|
@ -4463,7 +4761,6 @@
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||||
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
|
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
|
||||||
"dev": true,
|
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
"node_modules/write-file-atomic": {
|
"node_modules/write-file-atomic": {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "lhisp-oauth-client",
|
"name": "lhisp-oauth-client",
|
||||||
"version": "1.0.40",
|
"version": "1.0.36",
|
||||||
"main": "src/index",
|
"main": "src/index",
|
||||||
"types": "src/index.d.ts",
|
"types": "src/index.d.ts",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
@ -12,7 +12,6 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"publish": "rm -rfv dist/; npm run build; cd dist; cp ../package* .; cp ../README.md .; npm publish; cd -; rm -rfv dist/;",
|
|
||||||
"test:watch": "jest --watchAll"
|
"test:watch": "jest --watchAll"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
@ -23,6 +22,7 @@
|
||||||
"typescript": "^5.8.3"
|
"typescript": "^5.8.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.10.0"
|
"axios": "^1.10.0",
|
||||||
|
"lhisp-logger": "^2.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,5 @@
|
||||||
import { AxiosRequestConfig } from "axios";
|
import { AxiosRequestConfig } from "axios";
|
||||||
|
|
||||||
export interface Logger {
|
|
||||||
child: (params: any) => Logger;
|
|
||||||
info: Console["info"];
|
|
||||||
warn: Console["warn"];
|
|
||||||
error: Console["error"];
|
|
||||||
debug: Console["debug"];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Headers {
|
export interface Headers {
|
||||||
[name: string]: any;
|
[name: string]: any;
|
||||||
}
|
}
|
||||||
|
|
@ -31,8 +23,6 @@ export interface LhispOauthClientConstructorParams {
|
||||||
formatAccessToken?: (accessToken?: AccessToken) => string;
|
formatAccessToken?: (accessToken?: AccessToken) => string;
|
||||||
debug?: boolean;
|
debug?: boolean;
|
||||||
timeout?: number;
|
timeout?: number;
|
||||||
logger?: Logger;
|
|
||||||
rejectUnauthorized?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ExecutarRequestParams extends AxiosRequestConfig {
|
export interface ExecutarRequestParams extends AxiosRequestConfig {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import axios, { AxiosHeaders, AxiosRequestConfig } from "axios";
|
import axios, { AxiosHeaders, AxiosRequestConfig } from "axios";
|
||||||
import https from "https";
|
import https from "https";
|
||||||
|
import lhLogger from "lhisp-logger";
|
||||||
import qs from "querystring";
|
import qs from "querystring";
|
||||||
import {
|
import {
|
||||||
AccessToken,
|
AccessToken,
|
||||||
|
|
@ -10,9 +11,10 @@ import {
|
||||||
defaultTokenHeaderName,
|
defaultTokenHeaderName,
|
||||||
ExecutarRequestParams,
|
ExecutarRequestParams,
|
||||||
LhispOauthClientConstructorParams,
|
LhispOauthClientConstructorParams,
|
||||||
Logger,
|
|
||||||
} from "./lhisp-oauth-client.t";
|
} from "./lhisp-oauth-client.t";
|
||||||
|
|
||||||
|
const logger = lhLogger({ name: "lhisp-oauth-client" });
|
||||||
|
|
||||||
export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
|
export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
|
||||||
protected authUrl: string;
|
protected authUrl: string;
|
||||||
protected apiUrl: string;
|
protected apiUrl: string;
|
||||||
|
|
@ -36,18 +38,17 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
|
||||||
protected sendAuthCredentialsOnRequestBody?: boolean;
|
protected sendAuthCredentialsOnRequestBody?: boolean;
|
||||||
protected timeout: number;
|
protected timeout: number;
|
||||||
protected formatAccessToken?: (accessToken?: iAccessToken) => string;
|
protected formatAccessToken?: (accessToken?: iAccessToken) => string;
|
||||||
private logger: Logger;
|
|
||||||
|
|
||||||
constructor(params: LhispOauthClientConstructorParams) {
|
constructor(params: LhispOauthClientConstructorParams) {
|
||||||
if (params.certificado) {
|
if (params.certificado) {
|
||||||
this.agent = new https.Agent({
|
this.agent = new https.Agent({
|
||||||
pfx: Buffer.isBuffer(params.certificado) ? params.certificado : Buffer.from(params.certificado, "base64"),
|
pfx: Buffer.isBuffer(params.certificado) ? params.certificado : Buffer.from(params.certificado, "base64"),
|
||||||
passphrase: params.senhaCertificado ? params.senhaCertificado : undefined,
|
passphrase: params.senhaCertificado ? params.senhaCertificado : undefined,
|
||||||
rejectUnauthorized: params.rejectUnauthorized ?? false,
|
rejectUnauthorized: false,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.agent = new https.Agent({
|
this.agent = new https.Agent({
|
||||||
rejectUnauthorized: params.rejectUnauthorized ?? false,
|
rejectUnauthorized: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -67,7 +68,6 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
|
||||||
this.sendAuthCredentialsOnRequestBody = params.sendAuthCredentialsOnRequestBody;
|
this.sendAuthCredentialsOnRequestBody = params.sendAuthCredentialsOnRequestBody;
|
||||||
this.formatAccessToken = params.formatAccessToken;
|
this.formatAccessToken = params.formatAccessToken;
|
||||||
this.timeout = params.timeout ? params.timeout : 60000;
|
this.timeout = params.timeout ? params.timeout : 60000;
|
||||||
this.logger = params.logger || consoleLogger;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getAuthHeaderValue(): string {
|
getAuthHeaderValue(): string {
|
||||||
|
|
@ -131,7 +131,7 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
|
||||||
});
|
});
|
||||||
const resp = await axios.request(authRequestOpt);
|
const resp = await axios.request(authRequestOpt);
|
||||||
if (!resp?.data) {
|
if (!resp?.data) {
|
||||||
this.logger.error({ message: "LhispOauthClient.getAccessToken", resp });
|
logger.error({ message: "LhispOauthClient.getAccessToken", resp });
|
||||||
throw new Error("Resposta inválida ao obter token de acesso.");
|
throw new Error("Resposta inválida ao obter token de acesso.");
|
||||||
}
|
}
|
||||||
this.accessToken = this.buildAccessToken(resp.data);
|
this.accessToken = this.buildAccessToken(resp.data);
|
||||||
|
|
@ -139,7 +139,7 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
|
||||||
this.tokenExpiresIn = this.accessToken?.expires_in || this.tokenCreatedAt + 60000;
|
this.tokenExpiresIn = this.accessToken?.expires_in || this.tokenCreatedAt + 60000;
|
||||||
return this.accessToken;
|
return this.accessToken;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logger.error({ message: "LhispOauthClient.getAccessToken", error });
|
logger.error({ message: "LhispOauthClient.getAccessToken", error });
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -192,7 +192,7 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
|
||||||
|
|
||||||
return response.data;
|
return response.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logger.error({
|
logger.error({
|
||||||
message: "LhispOauthClient.executarRequest",
|
message: "LhispOauthClient.executarRequest",
|
||||||
method,
|
method,
|
||||||
url: `${this.apiUrl}${path}`,
|
url: `${this.apiUrl}${path}`,
|
||||||
|
|
@ -240,8 +240,3 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const consoleLogger: Logger = {
|
|
||||||
...console,
|
|
||||||
child: () => consoleLogger,
|
|
||||||
};
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue