rtcloud-sdk 1.0.0 → 1.1.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/CHANGELOG.md +4 -0
- package/package.json +1 -1
- package/src/index.d.ts +2 -2
- package/src/index.js +8 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.1.0 — 01/12/2026
|
|
4
|
+
|
|
5
|
+
- **Endereço novo da API:** a biblioteca fala com `https://api.rtcloud.com.br/v1`, o endereço oficial — o endereço antigo (rtcloud.com.br/api/v1) saiu de circulação em 01/12/2026, por isso a 1.0.0 parou de funcionar. Se `baseUrl` ou `RTCLOUD_API_URL` ainda tiverem o endereço antigo, a biblioteca usa o novo sozinha.
|
|
6
|
+
|
|
3
7
|
## 1.0.0 — 27/11/2026
|
|
4
8
|
|
|
5
9
|
- Primeira versão: aplicações, arquivos (inclusive a busca em todos os arquivos), variáveis, snapshots com restauração acompanhada, monitor, relatórios do site, domínio próprio, bancos (certificado e troca de senha) e equipes.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rtcloud-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Biblioteca oficial da RTCloud para JavaScript e TypeScript: aplicações, arquivos, variáveis, snapshots, bancos e equipes pela API pública.",
|
|
5
5
|
"keywords": ["rtcloud", "rt cloud", "hospedagem", "api", "sdk", "deploy", "bot", "discord", "pt-br"],
|
|
6
6
|
"homepage": "https://docs.rtcloud.com.br/sdk-javascript",
|
package/src/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Tipos da rtcloud-sdk (API pública
|
|
1
|
+
/** Tipos da rtcloud-sdk (API pública da RTCloud: https://api.rtcloud.com.br/v1). */
|
|
2
2
|
|
|
3
3
|
export declare const VERSAO: string;
|
|
4
4
|
|
|
@@ -7,7 +7,7 @@ export type Metodo = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
|
7
7
|
export interface OpcoesDoCliente {
|
|
8
8
|
/** chave da API (rtc_…). Padrão: a variável RTCLOUD_API_KEY */
|
|
9
9
|
apiKey?: string;
|
|
10
|
-
/** padrão: https://rtcloud.com.br/
|
|
10
|
+
/** padrão: https://api.rtcloud.com.br/v1 (ou RTCLOUD_API_URL) */
|
|
11
11
|
baseUrl?: string;
|
|
12
12
|
/** tempo máximo de cada pedido, em ms (padrão 60 000; commit usa pelo menos 10 min) */
|
|
13
13
|
timeoutMs?: number;
|
package/src/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* const rt = new RTCloud({ apiKey: process.env.RTCLOUD_API_KEY });
|
|
6
6
|
* const apps = await rt.apps.list();
|
|
7
7
|
*
|
|
8
|
-
* Fala com a API pública (
|
|
8
|
+
* Fala com a API pública (https://api.rtcloud.com.br/v1). Toda resposta da API vem num envelope
|
|
9
9
|
* `{ status, response }`; aqui você recebe só o `response`. Erro vira um
|
|
10
10
|
* `RTCloudError` com `status` (HTTP), `code` e a mensagem da API.
|
|
11
11
|
*
|
|
@@ -19,8 +19,11 @@
|
|
|
19
19
|
* navegador nem em código público.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
export const VERSAO = "1.
|
|
23
|
-
|
|
22
|
+
export const VERSAO = "1.1.0";
|
|
23
|
+
/* 1.1.0 (01/12/2026): a API mora em api.rtcloud.com.br — o endereço antigo saiu de circulação */
|
|
24
|
+
const BASE_PADRAO = "https://api.rtcloud.com.br/v1";
|
|
25
|
+
/** O endereço antigo (rtcloud.com.br/api/v1) vira o oficial, mesmo se vier de baseUrl ou RTCLOUD_API_URL. */
|
|
26
|
+
const BASE_ANTIGA = /^https?:\/\/(www\.)?rtcloud\.com\.br\/api\/v1\/*$/i;
|
|
24
27
|
const ATUALIZACAO_MAX_MS = 5 * 60_000;
|
|
25
28
|
|
|
26
29
|
const esperar = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
@@ -69,7 +72,8 @@ export class RTCloud {
|
|
|
69
72
|
code: "WRONG_KEY_TYPE",
|
|
70
73
|
});
|
|
71
74
|
}
|
|
72
|
-
|
|
75
|
+
const escolhida = String(opcoes.baseUrl ?? ambiente.RTCLOUD_API_URL ?? "").trim();
|
|
76
|
+
this.baseUrl = (!escolhida || BASE_ANTIGA.test(escolhida) ? BASE_PADRAO : escolhida).replace(/\/+$/, "");
|
|
73
77
|
this.timeoutMs = Number(opcoes.timeoutMs) > 0 ? Number(opcoes.timeoutMs) : 60_000;
|
|
74
78
|
this._fetch = opcoes.fetch ?? globalThis.fetch;
|
|
75
79
|
if (typeof this._fetch !== "function") throw new RTCloudError("Este ambiente não tem fetch: use Node.js 18 ou mais novo.", { code: "NO_FETCH" });
|