@comando.one/sdk 0.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/README.md +71 -0
- package/dist/index.d.ts +188 -0
- package/dist/index.js +248 -0
- package/dist/index.js.map +1 -0
- package/package.json +46 -0
package/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# @comando.one/sdk
|
|
2
|
+
|
|
3
|
+
SDK oficial da **API pública do Comando.One** — ERP para empresas de serviço (clientes, propostas, contratos, faturas, cobranças Pix/boleto, NFS-e, contas a pagar, financeiro e webhooks).
|
|
4
|
+
|
|
5
|
+
- **Zero dependências** — usa `fetch` nativo. Funciona no Node 18+ e no navegador.
|
|
6
|
+
- **Tipado** — TypeScript com autocomplete em todos os recursos.
|
|
7
|
+
- **Multi-empresa, paginação automática e idempotência** embutidos.
|
|
8
|
+
|
|
9
|
+
## Instalação
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @comando.one/sdk
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Uso
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { ComandoApi } from "@comando.one/sdk";
|
|
19
|
+
|
|
20
|
+
const api = new ComandoApi({ apiKey: "cmd_live_..." });
|
|
21
|
+
|
|
22
|
+
// Identidade
|
|
23
|
+
const me = await api.me();
|
|
24
|
+
|
|
25
|
+
// Listar e paginar
|
|
26
|
+
const page = await api.customers.list({ status: "ativo", per_page: 50 });
|
|
27
|
+
const todos = await api.customers.listAll(); // pagina sozinho
|
|
28
|
+
|
|
29
|
+
// Criar
|
|
30
|
+
const cliente = await api.customers.create({ name: "ACME", type: "juridica" });
|
|
31
|
+
const fatura = await api.invoices.create({
|
|
32
|
+
customer_id: cliente.id,
|
|
33
|
+
title: "Mensalidade",
|
|
34
|
+
due_date: "2026-07-01",
|
|
35
|
+
items: [{ name: "Serviço", quantity: 1, unit_price: 250 }],
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// Cobrança Pix
|
|
39
|
+
const cobranca = await api.charges.create({ invoice_id: fatura.id, method: "pix" });
|
|
40
|
+
|
|
41
|
+
// Multi-empresa
|
|
42
|
+
const filial = api.withCompany("uuid-da-empresa");
|
|
43
|
+
await filial.customers.list();
|
|
44
|
+
|
|
45
|
+
// Idempotência automática em POSTs
|
|
46
|
+
const apiIdem = new ComandoApi({ apiKey: "cmd_live_...", autoIdempotency: true });
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Tratamento de erros
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
import { ComandoApi, ComandoApiError } from "@comando.one/sdk";
|
|
53
|
+
|
|
54
|
+
try {
|
|
55
|
+
await api.customers.get("inexistente");
|
|
56
|
+
} catch (err) {
|
|
57
|
+
if (err instanceof ComandoApiError) {
|
|
58
|
+
console.error(err.status, err.body); // ex.: 404 { error: "..." }
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Recursos disponíveis
|
|
64
|
+
|
|
65
|
+
`companies`, `customers` (+ `addresses`, `contacts`, `invoices`, `contracts`, `proposals`), `suppliers` (+ `paymentMethods`), `services`, `expenses`, `proposals` (+ `send`), `contracts`, `invoices` (+ `cancel`), `purchaseInvoices` (+ `cancel`), `charges` (+ `cancel`/`refund`/`confirm`), `payouts` (+ `cancel`/`sync`), `nfse` (+ `emit`/`cancel`), `finance` (`ledger`/`natures`/`createMovement`/`deleteMovement`), `lookups`, `bankAccounts`, `webhooks` (+ `deliveries`).
|
|
66
|
+
|
|
67
|
+
Para endpoints não cobertos pelos namespaces, use `api.request(method, path, opts)`.
|
|
68
|
+
|
|
69
|
+
## Licença
|
|
70
|
+
|
|
71
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK oficial da API pública do Comando.One.
|
|
3
|
+
* ESM puro, zero dependências — funciona no navegador e no Node 18+ (fetch nativo).
|
|
4
|
+
*
|
|
5
|
+
* import { ComandoApi } from "@comando.one/sdk";
|
|
6
|
+
* const api = new ComandoApi({ apiKey: "cmd_live_..." });
|
|
7
|
+
* const me = await api.me();
|
|
8
|
+
* const clientes = await api.customers.list({ status: "ativo" });
|
|
9
|
+
* const todos = await api.customers.listAll(); // pagina sozinho
|
|
10
|
+
* const filial = api.withCompany("uuid"); // multi-empresa
|
|
11
|
+
*
|
|
12
|
+
* Base URL padrão: https://api.comando.one/v1
|
|
13
|
+
*/
|
|
14
|
+
type HttpMethod = "GET" | "POST" | "PATCH" | "PUT" | "DELETE";
|
|
15
|
+
type QueryParams = Record<string, string | number | boolean | null | undefined>;
|
|
16
|
+
interface RequestOpts {
|
|
17
|
+
body?: unknown;
|
|
18
|
+
idempotencyKey?: string;
|
|
19
|
+
companyId?: string;
|
|
20
|
+
/** Se true, retorna { status, body, replayed } em vez de lançar em erro. */
|
|
21
|
+
raw?: boolean;
|
|
22
|
+
}
|
|
23
|
+
interface RawResponse<T = unknown> {
|
|
24
|
+
status: number;
|
|
25
|
+
body: T;
|
|
26
|
+
replayed: boolean;
|
|
27
|
+
}
|
|
28
|
+
interface PaginatedMeta {
|
|
29
|
+
page: number;
|
|
30
|
+
per_page: number;
|
|
31
|
+
total: number;
|
|
32
|
+
total_pages: number;
|
|
33
|
+
}
|
|
34
|
+
interface Paginated<T = unknown> {
|
|
35
|
+
data: T[];
|
|
36
|
+
meta: PaginatedMeta;
|
|
37
|
+
}
|
|
38
|
+
interface ComandoApiOptions {
|
|
39
|
+
apiKey: string;
|
|
40
|
+
baseUrl?: string;
|
|
41
|
+
companyId?: string | null;
|
|
42
|
+
/** Gera Idempotency-Key automaticamente em POSTs. */
|
|
43
|
+
autoIdempotency?: boolean;
|
|
44
|
+
}
|
|
45
|
+
declare class ComandoApiError extends Error {
|
|
46
|
+
readonly status: number;
|
|
47
|
+
readonly body: unknown;
|
|
48
|
+
constructor(status: number, body: unknown, method: string, path: string);
|
|
49
|
+
}
|
|
50
|
+
declare function qs(params?: QueryParams): string;
|
|
51
|
+
type Json = Record<string, unknown>;
|
|
52
|
+
interface CrudResource {
|
|
53
|
+
list(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;
|
|
54
|
+
listAll(params?: QueryParams, opts?: RequestOpts): Promise<unknown[]>;
|
|
55
|
+
get(id: string, opts?: RequestOpts): Promise<unknown>;
|
|
56
|
+
create?(data: Json, opts?: RequestOpts): Promise<unknown>;
|
|
57
|
+
update?(id: string, data: Json, opts?: RequestOpts): Promise<unknown>;
|
|
58
|
+
delete?(id: string, opts?: RequestOpts): Promise<unknown>;
|
|
59
|
+
}
|
|
60
|
+
declare class ComandoApi {
|
|
61
|
+
readonly apiKey: string;
|
|
62
|
+
readonly baseUrl: string;
|
|
63
|
+
readonly companyId: string | null;
|
|
64
|
+
readonly autoIdempotency: boolean;
|
|
65
|
+
companies: {
|
|
66
|
+
list(opts?: RequestOpts): Promise<Paginated>;
|
|
67
|
+
get(id: string, opts?: RequestOpts): Promise<unknown>;
|
|
68
|
+
};
|
|
69
|
+
customers: CrudResource & {
|
|
70
|
+
invoices(id: string, params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;
|
|
71
|
+
contracts(id: string, params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;
|
|
72
|
+
proposals(id: string, params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;
|
|
73
|
+
addresses: {
|
|
74
|
+
list(cid: string, opts?: RequestOpts): Promise<Paginated>;
|
|
75
|
+
create(cid: string, data: Json, opts?: RequestOpts): Promise<unknown>;
|
|
76
|
+
update(cid: string, aid: string, data: Json, opts?: RequestOpts): Promise<unknown>;
|
|
77
|
+
delete(cid: string, aid: string, opts?: RequestOpts): Promise<unknown>;
|
|
78
|
+
};
|
|
79
|
+
contacts: {
|
|
80
|
+
list(cid: string, opts?: RequestOpts): Promise<Paginated>;
|
|
81
|
+
create(cid: string, data: Json, opts?: RequestOpts): Promise<unknown>;
|
|
82
|
+
update(cid: string, kid: string, data: Json, opts?: RequestOpts): Promise<unknown>;
|
|
83
|
+
delete(cid: string, kid: string, opts?: RequestOpts): Promise<unknown>;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
suppliers: CrudResource & {
|
|
87
|
+
paymentMethods: {
|
|
88
|
+
list(sid: string, opts?: RequestOpts): Promise<Paginated>;
|
|
89
|
+
create(sid: string, data: Json, opts?: RequestOpts): Promise<unknown>;
|
|
90
|
+
update(sid: string, mid: string, data: Json, opts?: RequestOpts): Promise<unknown>;
|
|
91
|
+
delete(sid: string, mid: string, opts?: RequestOpts): Promise<unknown>;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
services: CrudResource;
|
|
95
|
+
expenses: CrudResource;
|
|
96
|
+
proposals: CrudResource & {
|
|
97
|
+
send(id: string, opts?: RequestOpts): Promise<unknown>;
|
|
98
|
+
};
|
|
99
|
+
contracts: CrudResource;
|
|
100
|
+
invoices: {
|
|
101
|
+
list(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;
|
|
102
|
+
listAll(params?: QueryParams, opts?: RequestOpts): Promise<unknown[]>;
|
|
103
|
+
get(id: string, opts?: RequestOpts): Promise<unknown>;
|
|
104
|
+
create(data: Json, opts?: RequestOpts): Promise<unknown>;
|
|
105
|
+
cancel(id: string, opts?: RequestOpts): Promise<unknown>;
|
|
106
|
+
};
|
|
107
|
+
purchaseInvoices: {
|
|
108
|
+
list(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;
|
|
109
|
+
listAll(params?: QueryParams, opts?: RequestOpts): Promise<unknown[]>;
|
|
110
|
+
get(id: string, opts?: RequestOpts): Promise<unknown>;
|
|
111
|
+
create(data: Json, opts?: RequestOpts): Promise<unknown>;
|
|
112
|
+
cancel(id: string, opts?: RequestOpts): Promise<unknown>;
|
|
113
|
+
};
|
|
114
|
+
charges: {
|
|
115
|
+
list(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;
|
|
116
|
+
listAll(params?: QueryParams, opts?: RequestOpts): Promise<unknown[]>;
|
|
117
|
+
get(id: string, opts?: RequestOpts): Promise<unknown>;
|
|
118
|
+
create(data: Json, opts?: RequestOpts): Promise<unknown>;
|
|
119
|
+
cancel(id: string, opts?: RequestOpts): Promise<unknown>;
|
|
120
|
+
refund(id: string, opts?: RequestOpts): Promise<unknown>;
|
|
121
|
+
confirm(id: string, opts?: RequestOpts): Promise<unknown>;
|
|
122
|
+
};
|
|
123
|
+
payouts: {
|
|
124
|
+
list(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;
|
|
125
|
+
listAll(params?: QueryParams, opts?: RequestOpts): Promise<unknown[]>;
|
|
126
|
+
get(id: string, opts?: RequestOpts): Promise<unknown>;
|
|
127
|
+
create(data: Json, opts?: RequestOpts): Promise<unknown>;
|
|
128
|
+
cancel(id: string, opts?: RequestOpts): Promise<unknown>;
|
|
129
|
+
sync(id: string, opts?: RequestOpts): Promise<unknown>;
|
|
130
|
+
};
|
|
131
|
+
nfse: {
|
|
132
|
+
list(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;
|
|
133
|
+
get(id: string, opts?: RequestOpts): Promise<unknown>;
|
|
134
|
+
emit(invoiceId: string, opts?: RequestOpts): Promise<unknown>;
|
|
135
|
+
cancel(id: string, args: {
|
|
136
|
+
motivo: number;
|
|
137
|
+
justificativa: string;
|
|
138
|
+
}, opts?: RequestOpts): Promise<unknown>;
|
|
139
|
+
};
|
|
140
|
+
finance: {
|
|
141
|
+
ledger(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;
|
|
142
|
+
natures(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;
|
|
143
|
+
createMovement(data: Json, opts?: RequestOpts): Promise<unknown>;
|
|
144
|
+
deleteMovement(id: string, opts?: RequestOpts): Promise<unknown>;
|
|
145
|
+
};
|
|
146
|
+
lookups: {
|
|
147
|
+
costCenters(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;
|
|
148
|
+
paymentConditions(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;
|
|
149
|
+
serviceUnits(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;
|
|
150
|
+
paymentMethods(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;
|
|
151
|
+
paymentMethodsAp(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;
|
|
152
|
+
};
|
|
153
|
+
bankAccounts: {
|
|
154
|
+
list(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;
|
|
155
|
+
get(id: string, opts?: RequestOpts): Promise<unknown>;
|
|
156
|
+
};
|
|
157
|
+
webhooks: {
|
|
158
|
+
list(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;
|
|
159
|
+
get(id: string, opts?: RequestOpts): Promise<unknown>;
|
|
160
|
+
create(data: Json, opts?: RequestOpts): Promise<unknown>;
|
|
161
|
+
update(id: string, data: Json, opts?: RequestOpts): Promise<unknown>;
|
|
162
|
+
delete(id: string, opts?: RequestOpts): Promise<unknown>;
|
|
163
|
+
test(id: string, opts?: RequestOpts): Promise<unknown>;
|
|
164
|
+
events(opts?: RequestOpts): Promise<unknown>;
|
|
165
|
+
deliveries: {
|
|
166
|
+
list(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;
|
|
167
|
+
redeliver(id: string, opts?: RequestOpts): Promise<unknown>;
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
constructor({ apiKey, baseUrl, companyId, autoIdempotency }: ComandoApiOptions);
|
|
171
|
+
/** Clona o client fixando uma empresa (header X-Company-Id). */
|
|
172
|
+
withCompany(companyId: string): ComandoApi;
|
|
173
|
+
/** Requisição genérica. */
|
|
174
|
+
request<T = unknown>(method: HttpMethod, path: string, opts: RequestOpts & {
|
|
175
|
+
raw: true;
|
|
176
|
+
}): Promise<RawResponse<T>>;
|
|
177
|
+
request<T = unknown>(method: HttpMethod, path: string, opts?: RequestOpts): Promise<T>;
|
|
178
|
+
get<T = unknown>(path: string, opts?: RequestOpts): Promise<T>;
|
|
179
|
+
post<T = unknown>(path: string, body: unknown, opts?: RequestOpts): Promise<T>;
|
|
180
|
+
patch<T = unknown>(path: string, body: unknown, opts?: RequestOpts): Promise<T>;
|
|
181
|
+
delete<T = unknown>(path: string, opts?: RequestOpts): Promise<T>;
|
|
182
|
+
/** Paginação automática: itera ?page= até cobrir meta.total. Retorna array achatado. */
|
|
183
|
+
listAll(path: string, params?: QueryParams, opts?: RequestOpts): Promise<unknown[]>;
|
|
184
|
+
me<T = unknown>(opts?: RequestOpts): Promise<T>;
|
|
185
|
+
private _bindResources;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export { ComandoApi, ComandoApiError, type ComandoApiOptions, type HttpMethod, type Paginated, type PaginatedMeta, type QueryParams, type RawResponse, type RequestOpts, qs };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
var ComandoApiError = class extends Error {
|
|
3
|
+
status;
|
|
4
|
+
body;
|
|
5
|
+
constructor(status, body, method, path) {
|
|
6
|
+
const errMsg = body && typeof body === "object" && "error" in body ? String(body.error) : JSON.stringify(body);
|
|
7
|
+
super(`${method} ${path} \u2192 ${status}: ${errMsg}`);
|
|
8
|
+
this.name = "ComandoApiError";
|
|
9
|
+
this.status = status;
|
|
10
|
+
this.body = body;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
function qs(params) {
|
|
14
|
+
if (!params) return "";
|
|
15
|
+
const u = new URLSearchParams();
|
|
16
|
+
for (const [k, v] of Object.entries(params)) {
|
|
17
|
+
if (v !== void 0 && v !== null && v !== "") u.set(k, String(v));
|
|
18
|
+
}
|
|
19
|
+
const s = u.toString();
|
|
20
|
+
return s ? `?${s}` : "";
|
|
21
|
+
}
|
|
22
|
+
var _autoCounter = 0;
|
|
23
|
+
function genIdemKey() {
|
|
24
|
+
try {
|
|
25
|
+
return `auto-${crypto.randomUUID()}`;
|
|
26
|
+
} catch {
|
|
27
|
+
return `auto-${Date.now()}-${_autoCounter++}`;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
var ComandoApi = class _ComandoApi {
|
|
31
|
+
apiKey;
|
|
32
|
+
baseUrl;
|
|
33
|
+
companyId;
|
|
34
|
+
autoIdempotency;
|
|
35
|
+
// Namespaces de recursos (cobertura total da API)
|
|
36
|
+
companies;
|
|
37
|
+
customers;
|
|
38
|
+
suppliers;
|
|
39
|
+
services;
|
|
40
|
+
expenses;
|
|
41
|
+
proposals;
|
|
42
|
+
contracts;
|
|
43
|
+
invoices;
|
|
44
|
+
purchaseInvoices;
|
|
45
|
+
charges;
|
|
46
|
+
payouts;
|
|
47
|
+
nfse;
|
|
48
|
+
finance;
|
|
49
|
+
lookups;
|
|
50
|
+
bankAccounts;
|
|
51
|
+
webhooks;
|
|
52
|
+
constructor({ apiKey, baseUrl = "https://api.comando.one/v1", companyId, autoIdempotency = false }) {
|
|
53
|
+
if (!apiKey) throw new Error("apiKey \xE9 obrigat\xF3rio (cmd_live_...).");
|
|
54
|
+
this.apiKey = apiKey;
|
|
55
|
+
this.baseUrl = baseUrl.replace(/\/+$/, "");
|
|
56
|
+
this.companyId = companyId || null;
|
|
57
|
+
this.autoIdempotency = autoIdempotency;
|
|
58
|
+
this._bindResources();
|
|
59
|
+
}
|
|
60
|
+
/** Clona o client fixando uma empresa (header X-Company-Id). */
|
|
61
|
+
withCompany(companyId) {
|
|
62
|
+
return new _ComandoApi({
|
|
63
|
+
apiKey: this.apiKey,
|
|
64
|
+
baseUrl: this.baseUrl,
|
|
65
|
+
companyId,
|
|
66
|
+
autoIdempotency: this.autoIdempotency
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
async request(method, path, opts = {}) {
|
|
70
|
+
const headers = {
|
|
71
|
+
"x-api-key": this.apiKey,
|
|
72
|
+
"Content-Type": "application/json"
|
|
73
|
+
};
|
|
74
|
+
const company = opts.companyId ?? this.companyId;
|
|
75
|
+
if (company) headers["X-Company-Id"] = company;
|
|
76
|
+
let idem = opts.idempotencyKey;
|
|
77
|
+
if (!idem && this.autoIdempotency && method === "POST") idem = genIdemKey();
|
|
78
|
+
if (idem) headers["Idempotency-Key"] = idem;
|
|
79
|
+
const init = { method, headers };
|
|
80
|
+
if (opts.body !== void 0) init.body = JSON.stringify(opts.body);
|
|
81
|
+
const res = await fetch(`${this.baseUrl}${path}`, init);
|
|
82
|
+
const text = await res.text();
|
|
83
|
+
let body = null;
|
|
84
|
+
try {
|
|
85
|
+
body = text ? JSON.parse(text) : null;
|
|
86
|
+
} catch {
|
|
87
|
+
body = { raw: text };
|
|
88
|
+
}
|
|
89
|
+
if (opts.raw) return { status: res.status, body, replayed: res.headers.get("idempotent-replayed") === "true" };
|
|
90
|
+
if (!res.ok) throw new ComandoApiError(res.status, body, method, path);
|
|
91
|
+
return body;
|
|
92
|
+
}
|
|
93
|
+
get(path, opts) {
|
|
94
|
+
return this.request("GET", path, opts);
|
|
95
|
+
}
|
|
96
|
+
post(path, body, opts) {
|
|
97
|
+
return this.request("POST", path, { ...opts, body });
|
|
98
|
+
}
|
|
99
|
+
patch(path, body, opts) {
|
|
100
|
+
return this.request("PATCH", path, { ...opts, body });
|
|
101
|
+
}
|
|
102
|
+
delete(path, opts) {
|
|
103
|
+
return this.request("DELETE", path, opts);
|
|
104
|
+
}
|
|
105
|
+
/** Paginação automática: itera ?page= até cobrir meta.total. Retorna array achatado. */
|
|
106
|
+
async listAll(path, params = {}, opts) {
|
|
107
|
+
const perPage = params.per_page ?? 100;
|
|
108
|
+
let page = 1;
|
|
109
|
+
let all = [];
|
|
110
|
+
let total = Infinity;
|
|
111
|
+
while (all.length < total) {
|
|
112
|
+
const r = await this.get(`${path}${qs({ ...params, page, per_page: perPage })}`, opts);
|
|
113
|
+
const data = r.data ?? [];
|
|
114
|
+
all = all.concat(data);
|
|
115
|
+
total = r.meta?.total ?? all.length;
|
|
116
|
+
if (data.length === 0) break;
|
|
117
|
+
page++;
|
|
118
|
+
if (page > 1e3) break;
|
|
119
|
+
}
|
|
120
|
+
return all;
|
|
121
|
+
}
|
|
122
|
+
me(opts) {
|
|
123
|
+
return this.get("/me", opts);
|
|
124
|
+
}
|
|
125
|
+
_bindResources() {
|
|
126
|
+
const g = this;
|
|
127
|
+
const crud = (base, flags = {}) => {
|
|
128
|
+
const { create = true, update = true, del = true } = flags;
|
|
129
|
+
const r = {
|
|
130
|
+
list: (params, opts) => g.get(`${base}${qs(params)}`, opts),
|
|
131
|
+
listAll: (params, opts) => g.listAll(base, params, opts),
|
|
132
|
+
get: (id, opts) => g.get(`${base}/${id}`, opts)
|
|
133
|
+
};
|
|
134
|
+
if (create) r.create = (data, opts) => g.post(base, data, opts);
|
|
135
|
+
if (update) r.update = (id, data, opts) => g.patch(`${base}/${id}`, data, opts);
|
|
136
|
+
if (del) r.delete = (id, opts) => g.delete(`${base}/${id}`, opts);
|
|
137
|
+
return r;
|
|
138
|
+
};
|
|
139
|
+
this.companies = {
|
|
140
|
+
list: (opts) => g.get("/companies", opts),
|
|
141
|
+
get: (id, opts) => g.get(`/companies/${id}`, opts)
|
|
142
|
+
};
|
|
143
|
+
this.customers = Object.assign(crud("/customers"), {
|
|
144
|
+
invoices: (id, params, opts) => g.get(`/customers/${id}/invoices${qs(params)}`, opts),
|
|
145
|
+
contracts: (id, params, opts) => g.get(`/customers/${id}/contracts${qs(params)}`, opts),
|
|
146
|
+
proposals: (id, params, opts) => g.get(`/customers/${id}/proposals${qs(params)}`, opts),
|
|
147
|
+
addresses: {
|
|
148
|
+
list: (cid, opts) => g.get(`/customers/${cid}/addresses`, opts),
|
|
149
|
+
create: (cid, data, opts) => g.post(`/customers/${cid}/addresses`, data, opts),
|
|
150
|
+
update: (cid, aid, data, opts) => g.patch(`/customers/${cid}/addresses/${aid}`, data, opts),
|
|
151
|
+
delete: (cid, aid, opts) => g.delete(`/customers/${cid}/addresses/${aid}`, opts)
|
|
152
|
+
},
|
|
153
|
+
contacts: {
|
|
154
|
+
list: (cid, opts) => g.get(`/customers/${cid}/contacts`, opts),
|
|
155
|
+
create: (cid, data, opts) => g.post(`/customers/${cid}/contacts`, data, opts),
|
|
156
|
+
update: (cid, kid, data, opts) => g.patch(`/customers/${cid}/contacts/${kid}`, data, opts),
|
|
157
|
+
delete: (cid, kid, opts) => g.delete(`/customers/${cid}/contacts/${kid}`, opts)
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
this.suppliers = Object.assign(crud("/suppliers"), {
|
|
161
|
+
paymentMethods: {
|
|
162
|
+
list: (sid, opts) => g.get(`/suppliers/${sid}/payment-methods`, opts),
|
|
163
|
+
create: (sid, data, opts) => g.post(`/suppliers/${sid}/payment-methods`, data, opts),
|
|
164
|
+
update: (sid, mid, data, opts) => g.patch(`/suppliers/${sid}/payment-methods/${mid}`, data, opts),
|
|
165
|
+
delete: (sid, mid, opts) => g.delete(`/suppliers/${sid}/payment-methods/${mid}`, opts)
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
this.services = crud("/services");
|
|
169
|
+
this.expenses = crud("/expenses");
|
|
170
|
+
this.proposals = Object.assign(crud("/proposals"), {
|
|
171
|
+
send: (id, opts) => g.post(`/proposals/${id}/send`, void 0, opts)
|
|
172
|
+
});
|
|
173
|
+
this.contracts = crud("/contracts");
|
|
174
|
+
this.invoices = {
|
|
175
|
+
list: (params, opts) => g.get(`/invoices${qs(params)}`, opts),
|
|
176
|
+
listAll: (params, opts) => g.listAll("/invoices", params, opts),
|
|
177
|
+
get: (id, opts) => g.get(`/invoices/${id}`, opts),
|
|
178
|
+
create: (data, opts) => g.post("/invoices", data, opts),
|
|
179
|
+
cancel: (id, opts) => g.patch(`/invoices/${id}/cancel`, {}, opts)
|
|
180
|
+
};
|
|
181
|
+
this.purchaseInvoices = {
|
|
182
|
+
list: (params, opts) => g.get(`/purchase-invoices${qs(params)}`, opts),
|
|
183
|
+
listAll: (params, opts) => g.listAll("/purchase-invoices", params, opts),
|
|
184
|
+
get: (id, opts) => g.get(`/purchase-invoices/${id}`, opts),
|
|
185
|
+
create: (data, opts) => g.post("/purchase-invoices", data, opts),
|
|
186
|
+
cancel: (id, opts) => g.patch(`/purchase-invoices/${id}/cancel`, {}, opts)
|
|
187
|
+
};
|
|
188
|
+
this.charges = {
|
|
189
|
+
list: (params, opts) => g.get(`/charges${qs(params)}`, opts),
|
|
190
|
+
listAll: (params, opts) => g.listAll("/charges", params, opts),
|
|
191
|
+
get: (id, opts) => g.get(`/charges/${id}`, opts),
|
|
192
|
+
create: (data, opts) => g.post("/charges", data, opts),
|
|
193
|
+
cancel: (id, opts) => g.delete(`/charges/${id}`, opts),
|
|
194
|
+
refund: (id, opts) => g.post(`/charges/${id}/refund`, void 0, opts),
|
|
195
|
+
confirm: (id, opts) => g.post(`/charges/${id}/confirm`, void 0, opts)
|
|
196
|
+
};
|
|
197
|
+
this.payouts = {
|
|
198
|
+
list: (params, opts) => g.get(`/payouts${qs(params)}`, opts),
|
|
199
|
+
listAll: (params, opts) => g.listAll("/payouts", params, opts),
|
|
200
|
+
get: (id, opts) => g.get(`/payouts/${id}`, opts),
|
|
201
|
+
create: (data, opts) => g.post("/payouts", data, opts),
|
|
202
|
+
cancel: (id, opts) => g.post(`/payouts/${id}/cancel`, void 0, opts),
|
|
203
|
+
sync: (id, opts) => g.post(`/payouts/${id}/sync`, void 0, opts)
|
|
204
|
+
};
|
|
205
|
+
this.nfse = {
|
|
206
|
+
list: (params, opts) => g.get(`/nfse${qs(params)}`, opts),
|
|
207
|
+
get: (id, opts) => g.get(`/nfse/${id}`, opts),
|
|
208
|
+
emit: (invoiceId, opts) => g.post("/nfse", { invoice_id: invoiceId }, opts),
|
|
209
|
+
cancel: (id, { motivo, justificativa }, opts) => g.patch(`/nfse/${id}/cancel`, { motivo, justificativa }, opts)
|
|
210
|
+
};
|
|
211
|
+
this.finance = {
|
|
212
|
+
ledger: (params, opts) => g.get(`/finance/ledger${qs(params)}`, opts),
|
|
213
|
+
natures: (params, opts) => g.get(`/finance/natures${qs(params)}`, opts),
|
|
214
|
+
createMovement: (data, opts) => g.post("/finance/movements", data, opts),
|
|
215
|
+
deleteMovement: (id, opts) => g.delete(`/finance/movements/${id}`, opts)
|
|
216
|
+
};
|
|
217
|
+
this.lookups = {
|
|
218
|
+
costCenters: (params, opts) => g.get(`/cost-centers${qs(params)}`, opts),
|
|
219
|
+
paymentConditions: (params, opts) => g.get(`/payment-conditions${qs(params)}`, opts),
|
|
220
|
+
serviceUnits: (params, opts) => g.get(`/service-units${qs(params)}`, opts),
|
|
221
|
+
paymentMethods: (params, opts) => g.get(`/payment-methods${qs(params)}`, opts),
|
|
222
|
+
paymentMethodsAp: (params, opts) => g.get(`/payment-methods/ap${qs(params)}`, opts)
|
|
223
|
+
};
|
|
224
|
+
this.bankAccounts = {
|
|
225
|
+
list: (params, opts) => g.get(`/bank-accounts${qs(params)}`, opts),
|
|
226
|
+
get: (id, opts) => g.get(`/bank-accounts/${id}`, opts)
|
|
227
|
+
};
|
|
228
|
+
this.webhooks = {
|
|
229
|
+
list: (params, opts) => g.get(`/webhooks${qs(params)}`, opts),
|
|
230
|
+
get: (id, opts) => g.get(`/webhooks/${id}`, opts),
|
|
231
|
+
create: (data, opts) => g.post("/webhooks", data, opts),
|
|
232
|
+
update: (id, data, opts) => g.patch(`/webhooks/${id}`, data, opts),
|
|
233
|
+
delete: (id, opts) => g.delete(`/webhooks/${id}`, opts),
|
|
234
|
+
test: (id, opts) => g.post(`/webhooks/${id}/test`, void 0, opts),
|
|
235
|
+
events: (opts) => g.get("/webhooks/events", opts),
|
|
236
|
+
deliveries: {
|
|
237
|
+
list: (params, opts) => g.get(`/webhooks/deliveries${qs(params)}`, opts),
|
|
238
|
+
redeliver: (id, opts) => g.post(`/webhooks/deliveries/${id}/redeliver`, void 0, opts)
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
export {
|
|
244
|
+
ComandoApi,
|
|
245
|
+
ComandoApiError,
|
|
246
|
+
qs
|
|
247
|
+
};
|
|
248
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * SDK oficial da API pública do Comando.One.\n * ESM puro, zero dependências — funciona no navegador e no Node 18+ (fetch nativo).\n *\n * import { ComandoApi } from \"@comando.one/sdk\";\n * const api = new ComandoApi({ apiKey: \"cmd_live_...\" });\n * const me = await api.me();\n * const clientes = await api.customers.list({ status: \"ativo\" });\n * const todos = await api.customers.listAll(); // pagina sozinho\n * const filial = api.withCompany(\"uuid\"); // multi-empresa\n *\n * Base URL padrão: https://api.comando.one/v1\n */\n\nexport type HttpMethod = \"GET\" | \"POST\" | \"PATCH\" | \"PUT\" | \"DELETE\";\n\nexport type QueryParams = Record<string, string | number | boolean | null | undefined>;\n\nexport interface RequestOpts {\n body?: unknown;\n idempotencyKey?: string;\n companyId?: string;\n /** Se true, retorna { status, body, replayed } em vez de lançar em erro. */\n raw?: boolean;\n}\n\nexport interface RawResponse<T = unknown> {\n status: number;\n body: T;\n replayed: boolean;\n}\n\nexport interface PaginatedMeta {\n page: number;\n per_page: number;\n total: number;\n total_pages: number;\n}\n\nexport interface Paginated<T = unknown> {\n data: T[];\n meta: PaginatedMeta;\n}\n\nexport interface ComandoApiOptions {\n apiKey: string;\n baseUrl?: string;\n companyId?: string | null;\n /** Gera Idempotency-Key automaticamente em POSTs. */\n autoIdempotency?: boolean;\n}\n\nexport class ComandoApiError extends Error {\n readonly status: number;\n readonly body: unknown;\n constructor(status: number, body: unknown, method: string, path: string) {\n const errMsg =\n body && typeof body === \"object\" && \"error\" in body\n ? String((body as { error: unknown }).error)\n : JSON.stringify(body);\n super(`${method} ${path} → ${status}: ${errMsg}`);\n this.name = \"ComandoApiError\";\n this.status = status;\n this.body = body;\n }\n}\n\nexport function qs(params?: QueryParams): string {\n if (!params) return \"\";\n const u = new URLSearchParams();\n for (const [k, v] of Object.entries(params)) {\n if (v !== undefined && v !== null && v !== \"\") u.set(k, String(v));\n }\n const s = u.toString();\n return s ? `?${s}` : \"\";\n}\n\nlet _autoCounter = 0;\nfunction genIdemKey(): string {\n try {\n return `auto-${crypto.randomUUID()}`;\n } catch {\n return `auto-${Date.now()}-${_autoCounter++}`;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Tipos auxiliares dos namespaces\n// ---------------------------------------------------------------------------\n\ntype Json = Record<string, unknown>;\n\ninterface CrudResource {\n list(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;\n listAll(params?: QueryParams, opts?: RequestOpts): Promise<unknown[]>;\n get(id: string, opts?: RequestOpts): Promise<unknown>;\n create?(data: Json, opts?: RequestOpts): Promise<unknown>;\n update?(id: string, data: Json, opts?: RequestOpts): Promise<unknown>;\n delete?(id: string, opts?: RequestOpts): Promise<unknown>;\n}\n\n// ---------------------------------------------------------------------------\n\nexport class ComandoApi {\n readonly apiKey: string;\n readonly baseUrl: string;\n readonly companyId: string | null;\n readonly autoIdempotency: boolean;\n\n // Namespaces de recursos (cobertura total da API)\n companies!: {\n list(opts?: RequestOpts): Promise<Paginated>;\n get(id: string, opts?: RequestOpts): Promise<unknown>;\n };\n customers!: CrudResource & {\n invoices(id: string, params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;\n contracts(id: string, params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;\n proposals(id: string, params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;\n addresses: {\n list(cid: string, opts?: RequestOpts): Promise<Paginated>;\n create(cid: string, data: Json, opts?: RequestOpts): Promise<unknown>;\n update(cid: string, aid: string, data: Json, opts?: RequestOpts): Promise<unknown>;\n delete(cid: string, aid: string, opts?: RequestOpts): Promise<unknown>;\n };\n contacts: {\n list(cid: string, opts?: RequestOpts): Promise<Paginated>;\n create(cid: string, data: Json, opts?: RequestOpts): Promise<unknown>;\n update(cid: string, kid: string, data: Json, opts?: RequestOpts): Promise<unknown>;\n delete(cid: string, kid: string, opts?: RequestOpts): Promise<unknown>;\n };\n };\n suppliers!: CrudResource & {\n paymentMethods: {\n list(sid: string, opts?: RequestOpts): Promise<Paginated>;\n create(sid: string, data: Json, opts?: RequestOpts): Promise<unknown>;\n update(sid: string, mid: string, data: Json, opts?: RequestOpts): Promise<unknown>;\n delete(sid: string, mid: string, opts?: RequestOpts): Promise<unknown>;\n };\n };\n services!: CrudResource;\n expenses!: CrudResource;\n proposals!: CrudResource & { send(id: string, opts?: RequestOpts): Promise<unknown> };\n contracts!: CrudResource;\n invoices!: {\n list(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;\n listAll(params?: QueryParams, opts?: RequestOpts): Promise<unknown[]>;\n get(id: string, opts?: RequestOpts): Promise<unknown>;\n create(data: Json, opts?: RequestOpts): Promise<unknown>;\n cancel(id: string, opts?: RequestOpts): Promise<unknown>;\n };\n purchaseInvoices!: {\n list(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;\n listAll(params?: QueryParams, opts?: RequestOpts): Promise<unknown[]>;\n get(id: string, opts?: RequestOpts): Promise<unknown>;\n create(data: Json, opts?: RequestOpts): Promise<unknown>;\n cancel(id: string, opts?: RequestOpts): Promise<unknown>;\n };\n charges!: {\n list(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;\n listAll(params?: QueryParams, opts?: RequestOpts): Promise<unknown[]>;\n get(id: string, opts?: RequestOpts): Promise<unknown>;\n create(data: Json, opts?: RequestOpts): Promise<unknown>;\n cancel(id: string, opts?: RequestOpts): Promise<unknown>;\n refund(id: string, opts?: RequestOpts): Promise<unknown>;\n confirm(id: string, opts?: RequestOpts): Promise<unknown>;\n };\n payouts!: {\n list(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;\n listAll(params?: QueryParams, opts?: RequestOpts): Promise<unknown[]>;\n get(id: string, opts?: RequestOpts): Promise<unknown>;\n create(data: Json, opts?: RequestOpts): Promise<unknown>;\n cancel(id: string, opts?: RequestOpts): Promise<unknown>;\n sync(id: string, opts?: RequestOpts): Promise<unknown>;\n };\n nfse!: {\n list(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;\n get(id: string, opts?: RequestOpts): Promise<unknown>;\n emit(invoiceId: string, opts?: RequestOpts): Promise<unknown>;\n cancel(id: string, args: { motivo: number; justificativa: string }, opts?: RequestOpts): Promise<unknown>;\n };\n finance!: {\n ledger(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;\n natures(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;\n createMovement(data: Json, opts?: RequestOpts): Promise<unknown>;\n deleteMovement(id: string, opts?: RequestOpts): Promise<unknown>;\n };\n lookups!: {\n costCenters(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;\n paymentConditions(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;\n serviceUnits(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;\n paymentMethods(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;\n paymentMethodsAp(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;\n };\n bankAccounts!: {\n list(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;\n get(id: string, opts?: RequestOpts): Promise<unknown>;\n };\n webhooks!: {\n list(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;\n get(id: string, opts?: RequestOpts): Promise<unknown>;\n create(data: Json, opts?: RequestOpts): Promise<unknown>;\n update(id: string, data: Json, opts?: RequestOpts): Promise<unknown>;\n delete(id: string, opts?: RequestOpts): Promise<unknown>;\n test(id: string, opts?: RequestOpts): Promise<unknown>;\n events(opts?: RequestOpts): Promise<unknown>;\n deliveries: {\n list(params?: QueryParams, opts?: RequestOpts): Promise<Paginated>;\n redeliver(id: string, opts?: RequestOpts): Promise<unknown>;\n };\n };\n\n constructor({ apiKey, baseUrl = \"https://api.comando.one/v1\", companyId, autoIdempotency = false }: ComandoApiOptions) {\n if (!apiKey) throw new Error(\"apiKey é obrigatório (cmd_live_...).\");\n this.apiKey = apiKey;\n this.baseUrl = baseUrl.replace(/\\/+$/, \"\");\n this.companyId = companyId || null;\n this.autoIdempotency = autoIdempotency;\n this._bindResources();\n }\n\n /** Clona o client fixando uma empresa (header X-Company-Id). */\n withCompany(companyId: string): ComandoApi {\n return new ComandoApi({\n apiKey: this.apiKey,\n baseUrl: this.baseUrl,\n companyId,\n autoIdempotency: this.autoIdempotency,\n });\n }\n\n /** Requisição genérica. */\n async request<T = unknown>(method: HttpMethod, path: string, opts: RequestOpts & { raw: true }): Promise<RawResponse<T>>;\n async request<T = unknown>(method: HttpMethod, path: string, opts?: RequestOpts): Promise<T>;\n async request(method: HttpMethod, path: string, opts: RequestOpts = {}): Promise<unknown> {\n const headers: Record<string, string> = {\n \"x-api-key\": this.apiKey,\n \"Content-Type\": \"application/json\",\n };\n const company = opts.companyId ?? this.companyId;\n if (company) headers[\"X-Company-Id\"] = company;\n let idem = opts.idempotencyKey;\n if (!idem && this.autoIdempotency && method === \"POST\") idem = genIdemKey();\n if (idem) headers[\"Idempotency-Key\"] = idem;\n\n const init: RequestInit = { method, headers };\n if (opts.body !== undefined) init.body = JSON.stringify(opts.body);\n\n const res = await fetch(`${this.baseUrl}${path}`, init);\n const text = await res.text();\n let body: unknown = null;\n try {\n body = text ? JSON.parse(text) : null;\n } catch {\n body = { raw: text };\n }\n\n if (opts.raw) return { status: res.status, body, replayed: res.headers.get(\"idempotent-replayed\") === \"true\" };\n if (!res.ok) throw new ComandoApiError(res.status, body, method, path);\n return body;\n }\n\n get<T = unknown>(path: string, opts?: RequestOpts) {\n return this.request<T>(\"GET\", path, opts);\n }\n post<T = unknown>(path: string, body: unknown, opts?: RequestOpts) {\n return this.request<T>(\"POST\", path, { ...opts, body });\n }\n patch<T = unknown>(path: string, body: unknown, opts?: RequestOpts) {\n return this.request<T>(\"PATCH\", path, { ...opts, body });\n }\n delete<T = unknown>(path: string, opts?: RequestOpts) {\n return this.request<T>(\"DELETE\", path, opts);\n }\n\n /** Paginação automática: itera ?page= até cobrir meta.total. Retorna array achatado. */\n async listAll(path: string, params: QueryParams = {}, opts?: RequestOpts): Promise<unknown[]> {\n const perPage = (params.per_page as number) ?? 100;\n let page = 1;\n let all: unknown[] = [];\n let total = Infinity;\n while (all.length < total) {\n const r = (await this.get(`${path}${qs({ ...params, page, per_page: perPage })}`, opts)) as Paginated;\n const data = r.data ?? [];\n all = all.concat(data);\n total = r.meta?.total ?? all.length;\n if (data.length === 0) break;\n page++;\n if (page > 1000) break;\n }\n return all;\n }\n\n me<T = unknown>(opts?: RequestOpts) {\n return this.get<T>(\"/me\", opts);\n }\n\n private _bindResources(): void {\n const g = this;\n const crud = (base: string, flags: { create?: boolean; update?: boolean; del?: boolean } = {}): CrudResource => {\n const { create = true, update = true, del = true } = flags;\n const r: CrudResource = {\n list: (params, opts) => g.get<Paginated>(`${base}${qs(params)}`, opts),\n listAll: (params, opts) => g.listAll(base, params, opts),\n get: (id, opts) => g.get(`${base}/${id}`, opts),\n };\n if (create) r.create = (data, opts) => g.post(base, data, opts);\n if (update) r.update = (id, data, opts) => g.patch(`${base}/${id}`, data, opts);\n if (del) r.delete = (id, opts) => g.delete(`${base}/${id}`, opts);\n return r;\n };\n\n this.companies = {\n list: (opts) => g.get<Paginated>(\"/companies\", opts),\n get: (id, opts) => g.get(`/companies/${id}`, opts),\n };\n\n this.customers = Object.assign(crud(\"/customers\"), {\n invoices: (id: string, params?: QueryParams, opts?: RequestOpts) =>\n g.get<Paginated>(`/customers/${id}/invoices${qs(params)}`, opts),\n contracts: (id: string, params?: QueryParams, opts?: RequestOpts) =>\n g.get<Paginated>(`/customers/${id}/contracts${qs(params)}`, opts),\n proposals: (id: string, params?: QueryParams, opts?: RequestOpts) =>\n g.get<Paginated>(`/customers/${id}/proposals${qs(params)}`, opts),\n addresses: {\n list: (cid: string, opts?: RequestOpts) => g.get<Paginated>(`/customers/${cid}/addresses`, opts),\n create: (cid: string, data: Json, opts?: RequestOpts) => g.post(`/customers/${cid}/addresses`, data, opts),\n update: (cid: string, aid: string, data: Json, opts?: RequestOpts) =>\n g.patch(`/customers/${cid}/addresses/${aid}`, data, opts),\n delete: (cid: string, aid: string, opts?: RequestOpts) => g.delete(`/customers/${cid}/addresses/${aid}`, opts),\n },\n contacts: {\n list: (cid: string, opts?: RequestOpts) => g.get<Paginated>(`/customers/${cid}/contacts`, opts),\n create: (cid: string, data: Json, opts?: RequestOpts) => g.post(`/customers/${cid}/contacts`, data, opts),\n update: (cid: string, kid: string, data: Json, opts?: RequestOpts) =>\n g.patch(`/customers/${cid}/contacts/${kid}`, data, opts),\n delete: (cid: string, kid: string, opts?: RequestOpts) => g.delete(`/customers/${cid}/contacts/${kid}`, opts),\n },\n });\n\n this.suppliers = Object.assign(crud(\"/suppliers\"), {\n paymentMethods: {\n list: (sid: string, opts?: RequestOpts) => g.get<Paginated>(`/suppliers/${sid}/payment-methods`, opts),\n create: (sid: string, data: Json, opts?: RequestOpts) => g.post(`/suppliers/${sid}/payment-methods`, data, opts),\n update: (sid: string, mid: string, data: Json, opts?: RequestOpts) =>\n g.patch(`/suppliers/${sid}/payment-methods/${mid}`, data, opts),\n delete: (sid: string, mid: string, opts?: RequestOpts) =>\n g.delete(`/suppliers/${sid}/payment-methods/${mid}`, opts),\n },\n });\n\n this.services = crud(\"/services\");\n this.expenses = crud(\"/expenses\");\n\n this.proposals = Object.assign(crud(\"/proposals\"), {\n send: (id: string, opts?: RequestOpts) => g.post(`/proposals/${id}/send`, undefined, opts),\n });\n this.contracts = crud(\"/contracts\");\n\n this.invoices = {\n list: (params, opts) => g.get<Paginated>(`/invoices${qs(params)}`, opts),\n listAll: (params, opts) => g.listAll(\"/invoices\", params, opts),\n get: (id, opts) => g.get(`/invoices/${id}`, opts),\n create: (data, opts) => g.post(\"/invoices\", data, opts),\n cancel: (id, opts) => g.patch(`/invoices/${id}/cancel`, {}, opts),\n };\n\n this.purchaseInvoices = {\n list: (params, opts) => g.get<Paginated>(`/purchase-invoices${qs(params)}`, opts),\n listAll: (params, opts) => g.listAll(\"/purchase-invoices\", params, opts),\n get: (id, opts) => g.get(`/purchase-invoices/${id}`, opts),\n create: (data, opts) => g.post(\"/purchase-invoices\", data, opts),\n cancel: (id, opts) => g.patch(`/purchase-invoices/${id}/cancel`, {}, opts),\n };\n\n this.charges = {\n list: (params, opts) => g.get<Paginated>(`/charges${qs(params)}`, opts),\n listAll: (params, opts) => g.listAll(\"/charges\", params, opts),\n get: (id, opts) => g.get(`/charges/${id}`, opts),\n create: (data, opts) => g.post(\"/charges\", data, opts),\n cancel: (id, opts) => g.delete(`/charges/${id}`, opts),\n refund: (id, opts) => g.post(`/charges/${id}/refund`, undefined, opts),\n confirm: (id, opts) => g.post(`/charges/${id}/confirm`, undefined, opts),\n };\n\n this.payouts = {\n list: (params, opts) => g.get<Paginated>(`/payouts${qs(params)}`, opts),\n listAll: (params, opts) => g.listAll(\"/payouts\", params, opts),\n get: (id, opts) => g.get(`/payouts/${id}`, opts),\n create: (data, opts) => g.post(\"/payouts\", data, opts),\n cancel: (id, opts) => g.post(`/payouts/${id}/cancel`, undefined, opts),\n sync: (id, opts) => g.post(`/payouts/${id}/sync`, undefined, opts),\n };\n\n this.nfse = {\n list: (params, opts) => g.get<Paginated>(`/nfse${qs(params)}`, opts),\n get: (id, opts) => g.get(`/nfse/${id}`, opts),\n emit: (invoiceId, opts) => g.post(\"/nfse\", { invoice_id: invoiceId }, opts),\n cancel: (id, { motivo, justificativa }, opts) => g.patch(`/nfse/${id}/cancel`, { motivo, justificativa }, opts),\n };\n\n this.finance = {\n ledger: (params, opts) => g.get<Paginated>(`/finance/ledger${qs(params)}`, opts),\n natures: (params, opts) => g.get<Paginated>(`/finance/natures${qs(params)}`, opts),\n createMovement: (data, opts) => g.post(\"/finance/movements\", data, opts),\n deleteMovement: (id, opts) => g.delete(`/finance/movements/${id}`, opts),\n };\n\n this.lookups = {\n costCenters: (params, opts) => g.get<Paginated>(`/cost-centers${qs(params)}`, opts),\n paymentConditions: (params, opts) => g.get<Paginated>(`/payment-conditions${qs(params)}`, opts),\n serviceUnits: (params, opts) => g.get<Paginated>(`/service-units${qs(params)}`, opts),\n paymentMethods: (params, opts) => g.get<Paginated>(`/payment-methods${qs(params)}`, opts),\n paymentMethodsAp: (params, opts) => g.get<Paginated>(`/payment-methods/ap${qs(params)}`, opts),\n };\n\n this.bankAccounts = {\n list: (params, opts) => g.get<Paginated>(`/bank-accounts${qs(params)}`, opts),\n get: (id, opts) => g.get(`/bank-accounts/${id}`, opts),\n };\n\n this.webhooks = {\n list: (params, opts) => g.get<Paginated>(`/webhooks${qs(params)}`, opts),\n get: (id, opts) => g.get(`/webhooks/${id}`, opts),\n create: (data, opts) => g.post(\"/webhooks\", data, opts),\n update: (id, data, opts) => g.patch(`/webhooks/${id}`, data, opts),\n delete: (id, opts) => g.delete(`/webhooks/${id}`, opts),\n test: (id, opts) => g.post(`/webhooks/${id}/test`, undefined, opts),\n events: (opts) => g.get(\"/webhooks/events\", opts),\n deliveries: {\n list: (params, opts) => g.get<Paginated>(`/webhooks/deliveries${qs(params)}`, opts),\n redeliver: (id, opts) => g.post(`/webhooks/deliveries/${id}/redeliver`, undefined, opts),\n },\n };\n }\n}\n"],"mappings":";AAoDO,IAAM,kBAAN,cAA8B,MAAM;AAAA,EAChC;AAAA,EACA;AAAA,EACT,YAAY,QAAgB,MAAe,QAAgB,MAAc;AACvE,UAAM,SACJ,QAAQ,OAAO,SAAS,YAAY,WAAW,OAC3C,OAAQ,KAA4B,KAAK,IACzC,KAAK,UAAU,IAAI;AACzB,UAAM,GAAG,MAAM,IAAI,IAAI,WAAM,MAAM,KAAK,MAAM,EAAE;AAChD,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,OAAO;AAAA,EACd;AACF;AAEO,SAAS,GAAG,QAA8B;AAC/C,MAAI,CAAC,OAAQ,QAAO;AACpB,QAAM,IAAI,IAAI,gBAAgB;AAC9B,aAAW,CAAC,GAAG,CAAC,KAAK,OAAO,QAAQ,MAAM,GAAG;AAC3C,QAAI,MAAM,UAAa,MAAM,QAAQ,MAAM,GAAI,GAAE,IAAI,GA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,IAAI;AAAA,MACxF,kBAAkB,CAAC,QAAQ,SAAS,EAAE,IAAe,sBAAsB,GAAG,MAAM,CAAC,IAAI,IAAI;AAAA,IAC/F;AAEA,SAAK,eAAe;AAAA,MAClB,MAAM,CAAC,QAAQ,SAAS,EAAE,IAAe,iBAAiB,GAAG,MAAM,CAAC,IAAI,IAAI;AAAA,MAC5E,KAAK,CAAC,IAAI,SAAS,EAAE,IAAI,kBAAkB,EAAE,IAAI,IAAI;AAAA,IACvD;AAEA,SAAK,WAAW;AAAA,MACd,MAAM,CAAC,QAAQ,SAAS,EAAE,IAAe,YAAY,GAAG,MAAM,CAAC,IAAI,IAAI;AAAA,MACvE,KAAK,CAAC,IAAI,SAAS,EAAE,IAAI,aAAa,EAAE,IAAI,IAAI;AAAA,MAChD,QAAQ,CAAC,MAAM,SAAS,EAAE,KAAK,aAAa,MAAM,IAAI;AAAA,MACtD,QAAQ,CAAC,IAAI,MAAM,SAAS,EAAE,MAAM,aAAa,EAAE,IAAI,MAAM,IAAI;AAAA,MACjE,QAAQ,CAAC,IAAI,SAAS,EAAE,OAAO,aAAa,EAAE,IAAI,IAAI;AAAA,MACtD,MAAM,CAAC,IAAI,SAAS,EAAE,KAAK,aAAa,EAAE,SAAS,QAAW,IAAI;AAAA,MAClE,QAAQ,CAAC,SAAS,EAAE,IAAI,oBAAoB,IAAI;AAAA,MAChD,YAAY;AAAA,QACV,MAAM,CAAC,QAAQ,SAAS,EAAE,IAAe,uBAAuB,GAAG,MAAM,CAAC,IAAI,IAAI;AAAA,QAClF,WAAW,CAAC,IAAI,SAAS,EAAE,KAAK,wBAAwB,EAAE,cAAc,QAAW,IAAI;AAAA,MACzF;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@comando.one/sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "SDK oficial da API pública do Comando.One — ERP para empresas de serviço. Zero dependências, ESM, tipado.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=18"
|
|
22
|
+
},
|
|
23
|
+
"sideEffects": false,
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsup",
|
|
26
|
+
"typecheck": "tsc --noEmit",
|
|
27
|
+
"prepublishOnly": "npm run build"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"tsup": "^8.3.0",
|
|
31
|
+
"typescript": "^5.5.0"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"comando",
|
|
35
|
+
"comando.one",
|
|
36
|
+
"erp",
|
|
37
|
+
"api",
|
|
38
|
+
"sdk",
|
|
39
|
+
"pix",
|
|
40
|
+
"nfse",
|
|
41
|
+
"boleto"
|
|
42
|
+
],
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
}
|
|
46
|
+
}
|