@databolsa/credit-sdk 3.7.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 ADDED
@@ -0,0 +1,71 @@
1
+ # @databolsa/credit-sdk
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@databolsa/credit-sdk?color=cb3837&logo=npm)](https://www.npmjs.com/package/@databolsa/credit-sdk)
4
+ [![license](https://img.shields.io/npm/l/@databolsa/credit-sdk?color=2ea44f)](https://github.com/databolsahq/databolsa/blob/main/LICENSE)
5
+
6
+ SDK TypeScript tipado para a API da **mesa de crédito do DataBolsa** — a camada de
7
+ trabalho de quem acompanha crédito privado: watchlists de classes de FIDC, grade de
8
+ acompanhamento, notas, alertas e limiares extraídos do regulamento. O contrato da mesa é
9
+ **separado** do contrato de dados de mercado; este pacote é uma casca fina sobre ele e não
10
+ calcula nada no cliente.
11
+
12
+ ## Uso rápido
13
+
14
+ ```bash
15
+ npm install @databolsa/credit-sdk
16
+ ```
17
+
18
+ ```ts
19
+ import { DataBolsaCredit, DataBolsaCreditError } from "@databolsa/credit-sdk";
20
+
21
+ const desk = new DataBolsaCredit({ apiKey: process.env.DATABOLSA_CREDIT_API_KEY });
22
+
23
+ const me = await desk.getMe();
24
+ const org = me.organizations[0].org_slug;
25
+
26
+ const { data: listas } = await desk.listWatchlists(org);
27
+ const quadro = await desk.getWatchlistBoard(org, listas[0].slug);
28
+ const { data: limiares } = await desk.listOrgRegulationTerms(org, { status: "pending" });
29
+
30
+ try {
31
+ await desk.createNote(org, {
32
+ entity_id: quadro.rows[0].cnpj,
33
+ entity_kind: "fidc_class",
34
+ body: "revisar subordinação",
35
+ });
36
+ } catch (err) {
37
+ if (err instanceof DataBolsaCreditError && err.problem?.code === "license_required") {
38
+ console.warn("licença vencida — escritas bloqueadas, leituras seguem abertas");
39
+ } else {
40
+ throw err;
41
+ }
42
+ }
43
+ ```
44
+
45
+ Toda operação, exceto as de conta, recebe o identificador da mesa (`slug` ou `id`) como
46
+ primeiro argumento; `getMe()` lista em quais mesas a credencial pode agir. Opções do
47
+ construtor: `baseUrl` (default `https://api.databolsa.com`), `apiKey` (chave pessoal
48
+ `db_live_…`), `workspace` (id da mesa, vai no header
49
+ `x-databolsa-workspace`), `credentials` e um `fetch` próprio. Mantenha a chave no servidor:
50
+ ela abre a mesa inteira.
51
+
52
+ ## Comportamento que vale em toda rota
53
+
54
+ - **Escopo é a mesa.** Recurso fora dela responde **404**, nunca 403 — não conclua que um
55
+ registro existe a partir do erro.
56
+ - **Licença trava escrita, não leitura.** Licença vencida responde **402** com
57
+ `code: license_required` nas escritas; as leituras continuam.
58
+ - **Unidade preservada.** Razões (inadimplência, alavancagem) viajam como fração
59
+ (`0.0445` = 4,45%); participação de cedente viaja como percentual (`90` = 90%). Ausência
60
+ de dado é `null`, nunca zero.
61
+ - Erros seguem RFC 9457: `DataBolsaCreditError` carrega o `status` HTTP e o corpo
62
+ `problem+json` em `problem` (`title`, `detail`, `code`). Toda escrita é auditada.
63
+
64
+ Os tipos de request e response são resolvidos por lookup no schema gerado do contrato com
65
+ `openapi-typescript`; o pacote também exporta os paths crus como `CreditPaths`. O mesmo
66
+ contrato está disponível como servidor MCP em `@databolsa/credit-mcp`, e os dados de
67
+ mercado (ações, FIIs, fundos, crédito, macro) em `@databolsa/sdk`.
68
+
69
+ ## Licença
70
+
71
+ Apache-2.0. O DataBolsa é infraestrutura de dados, não recomendação de investimento.
@@ -0,0 +1,408 @@
1
+ /**
2
+ * Cliente fino da API da mesa de crédito do DataBolsa — cada método é uma operação do
3
+ * contrato, com request/response tipados por lookup no schema gerado (openapi-typescript).
4
+ * Autentica com a chave pessoal do membro (`db_live_...`); no portal da mesa, cookies de
5
+ * sessão via `credentials: "include"`.
6
+ *
7
+ * A API age numa mesa da pessoa: a indicada em `workspace` (id da organização) ou, sem
8
+ * ela, a primeira em que a mesa está habilitada.
9
+ */
10
+ import type { paths } from "./schema";
11
+ type JsonOf<T> = T extends {
12
+ content: {
13
+ "application/json": infer J;
14
+ };
15
+ } ? J : never;
16
+ type Body<P extends keyof paths, M extends keyof paths[P]> = paths[P][M] extends {
17
+ requestBody?: infer B;
18
+ } ? JsonOf<NonNullable<B>> : never;
19
+ export declare class DataBolsaCreditError extends Error {
20
+ readonly status: number;
21
+ readonly problem: {
22
+ title?: string;
23
+ detail?: string;
24
+ code?: string;
25
+ } | null;
26
+ constructor(status: number, problem: {
27
+ title?: string;
28
+ detail?: string;
29
+ code?: string;
30
+ } | null);
31
+ }
32
+ export interface CreditClientOptions {
33
+ /** Origem da API (default: https://api.databolsa.com). Os paths já têm /v1/desk. */
34
+ baseUrl?: string;
35
+ /** Chave pessoal `db_live_...`. Omitida no portal (sessão via cookie). */
36
+ apiKey?: string;
37
+ /** Id da organização em que agir (header `x-databolsa-workspace`). */
38
+ workspace?: string;
39
+ /** `include` no portal (cookie de sessão same-origin). */
40
+ credentials?: "omit" | "same-origin" | "include";
41
+ fetch?: typeof fetch;
42
+ }
43
+ export declare class DataBolsaCredit {
44
+ private readonly baseUrl;
45
+ private readonly apiKey?;
46
+ private readonly workspace?;
47
+ private readonly credentials?;
48
+ private readonly fetchImpl;
49
+ constructor(opts?: CreditClientOptions);
50
+ private request;
51
+ getMe(): Promise<{
52
+ user_id: string | null;
53
+ email: string | null;
54
+ name: string | null;
55
+ organizations: {
56
+ org_id: string;
57
+ org_slug: string;
58
+ org_name: string;
59
+ role: "owner" | "admin" | "analyst" | "viewer";
60
+ member_id: string;
61
+ }[];
62
+ }>;
63
+ acceptInvitation(body: Body<"/v1/desk/invitations/accept", "post">): Promise<{
64
+ org_id: string;
65
+ org_slug: string;
66
+ member_id: string;
67
+ role: string;
68
+ }>;
69
+ getOrganization(org: string): Promise<{
70
+ id: string;
71
+ slug: string;
72
+ name: string;
73
+ cnpj: string | null;
74
+ cvm_registration: string | null;
75
+ status: string;
76
+ }>;
77
+ updateOrganization(org: string, body: Body<"/v1/desk/orgs/{org}", "patch">): Promise<{
78
+ id: string;
79
+ slug: string;
80
+ name: string;
81
+ cnpj: string | null;
82
+ cvm_registration: string | null;
83
+ status: string;
84
+ }>;
85
+ getLicense(org: string): Promise<{
86
+ plan: string | null;
87
+ seats_limit: number;
88
+ watched_limit: number | null;
89
+ expires_at: string | null;
90
+ expired: boolean;
91
+ }>;
92
+ listMembers(org: string): Promise<{
93
+ data: {
94
+ id: string;
95
+ role: string;
96
+ display_name: string | null;
97
+ status: string;
98
+ created_at: string;
99
+ }[];
100
+ }>;
101
+ assignSeat(org: string, body: Body<"/v1/desk/orgs/{org}/members", "post">): Promise<{
102
+ id: string;
103
+ role: string;
104
+ display_name: string | null;
105
+ status: string;
106
+ created_at: string;
107
+ }>;
108
+ updateMember(org: string, memberId: string, body: Body<"/v1/desk/orgs/{org}/members/{memberId}", "patch">): Promise<{
109
+ id: string;
110
+ role: string;
111
+ display_name: string | null;
112
+ status: string;
113
+ created_at: string;
114
+ }>;
115
+ listInvitations(org: string): Promise<{
116
+ data: {
117
+ id: string;
118
+ email: string;
119
+ role: string;
120
+ status: string;
121
+ expires_at: string;
122
+ }[];
123
+ }>;
124
+ createInvitation(org: string, body: Body<"/v1/desk/orgs/{org}/invitations", "post">): Promise<{
125
+ invitation_id: string;
126
+ invite_url: string;
127
+ }>;
128
+ revokeInvitation(org: string, invitationId: string): Promise<{
129
+ revoked: boolean;
130
+ }>;
131
+ listAudit(org: string, params?: {
132
+ entityId?: string;
133
+ cursor?: string;
134
+ limit?: number;
135
+ }): Promise<{
136
+ data: {
137
+ id: string;
138
+ action: string;
139
+ summary: string | null;
140
+ via: string;
141
+ actor_member_id: string | null;
142
+ actor_display_name: string | null;
143
+ entity_type: string | null;
144
+ entity_id: string | null;
145
+ created_at: string;
146
+ }[];
147
+ meta: {
148
+ next_cursor: string | null;
149
+ count: number;
150
+ };
151
+ }>;
152
+ listWatchlists(org: string): Promise<{
153
+ data: {
154
+ id: string;
155
+ slug: string;
156
+ name: string;
157
+ description: string | null;
158
+ kind: string;
159
+ item_count: number;
160
+ }[];
161
+ }>;
162
+ createWatchlist(org: string, body: Body<"/v1/desk/orgs/{org}/watchlists", "post">): Promise<{
163
+ id: string;
164
+ slug: string;
165
+ name: string;
166
+ description: string | null;
167
+ kind: string;
168
+ item_count: number;
169
+ }>;
170
+ deleteWatchlist(org: string, list: string): Promise<{
171
+ deleted: boolean;
172
+ }>;
173
+ listWatchlistItems(org: string, list: string): Promise<{
174
+ data: {
175
+ cnpj: string;
176
+ entity_kind: string;
177
+ label: string | null;
178
+ relation: string;
179
+ position: number;
180
+ }[];
181
+ }>;
182
+ addWatchlistItems(org: string, list: string, body: Body<"/v1/desk/orgs/{org}/watchlists/{list}/items", "post">): Promise<{
183
+ added: number;
184
+ skipped: number;
185
+ }>;
186
+ removeWatchlistItem(org: string, list: string, cnpj: string): Promise<{
187
+ removed: boolean;
188
+ }>;
189
+ getWatchlistBoard(org: string, list: string): Promise<{
190
+ watchlist: {
191
+ id: string;
192
+ slug: string;
193
+ name: string;
194
+ kind: string;
195
+ };
196
+ latest_competence: string | null;
197
+ columns: {
198
+ metric: string;
199
+ label: string;
200
+ unit: string;
201
+ help: string;
202
+ }[];
203
+ rows: {
204
+ cnpj: string;
205
+ entity_kind: string;
206
+ relation: string;
207
+ label: string | null;
208
+ name: string | null;
209
+ reference_date: string | null;
210
+ unknown: boolean;
211
+ cells: {
212
+ metric: string;
213
+ value: number | null;
214
+ unit: string;
215
+ }[];
216
+ }[];
217
+ }>;
218
+ getGrid(org: string): Promise<{
219
+ columns: {
220
+ metric: string;
221
+ position: number;
222
+ }[];
223
+ catalog: {
224
+ metric: string;
225
+ label: string;
226
+ unit: string;
227
+ help: string;
228
+ }[];
229
+ }>;
230
+ setGrid(org: string, body: Body<"/v1/desk/orgs/{org}/grid", "put">): Promise<{
231
+ columns: string[];
232
+ }>;
233
+ listAlerts(org: string, list: string): Promise<{
234
+ data: {
235
+ key: string;
236
+ cnpj: string;
237
+ name: string | null;
238
+ source: "covenant" | "rule" | "reporting";
239
+ severity: "info" | "attention" | "critical";
240
+ metric: string;
241
+ value: number | null;
242
+ threshold: number | null;
243
+ distance: number | null;
244
+ reference_date: string | null;
245
+ title: string;
246
+ evidence: {
247
+ doc_id: string | null;
248
+ page: number | null;
249
+ quote: string | null;
250
+ } | null;
251
+ status: "open" | "acknowledged" | "muted";
252
+ first_detected_at?: string | null;
253
+ }[];
254
+ meta: {
255
+ count: number;
256
+ };
257
+ }>;
258
+ listAlertHistory(org: string, params?: {
259
+ cnpj?: string;
260
+ source?: "covenant" | "rule" | "reporting";
261
+ since?: string;
262
+ limit?: number;
263
+ }): Promise<{
264
+ data: {
265
+ alert_key: string;
266
+ cnpj: string;
267
+ source: string;
268
+ severity: string;
269
+ metric: string;
270
+ value: number | null;
271
+ threshold: number | null;
272
+ distance: number | null;
273
+ reference_date: string | null;
274
+ title: string;
275
+ detected_at: string;
276
+ }[];
277
+ meta: {
278
+ count: number;
279
+ };
280
+ }>;
281
+ acknowledgeAlert(org: string, key: string, body: Body<"/v1/desk/orgs/{org}/alerts/{key}/ack", "post">): Promise<{
282
+ key: string;
283
+ status: string;
284
+ }>;
285
+ listAlertRules(org: string): Promise<{
286
+ data: {
287
+ id: string;
288
+ metric: string;
289
+ comparator: string;
290
+ threshold: number;
291
+ severity: string;
292
+ enabled: boolean;
293
+ }[];
294
+ }>;
295
+ upsertAlertRule(org: string, body: Body<"/v1/desk/orgs/{org}/alert-rules", "put">): Promise<{
296
+ id: string;
297
+ metric: string;
298
+ comparator: string;
299
+ threshold: number;
300
+ severity: string;
301
+ enabled: boolean;
302
+ }>;
303
+ deleteAlertRule(org: string, ruleId: string): Promise<{
304
+ deleted: boolean;
305
+ }>;
306
+ listNotes(org: string, params?: {
307
+ entityId?: string;
308
+ limit?: number;
309
+ }): Promise<{
310
+ data: {
311
+ id: string;
312
+ entity_kind: string;
313
+ entity_id: string;
314
+ body: string;
315
+ author_member_id: string | null;
316
+ author_name: string | null;
317
+ created_at: string;
318
+ updated_at: string;
319
+ }[];
320
+ }>;
321
+ createNote(org: string, body: Body<"/v1/desk/orgs/{org}/notes", "post">): Promise<{
322
+ id: string;
323
+ }>;
324
+ deleteNote(org: string, noteId: string): Promise<{
325
+ deleted: boolean;
326
+ }>;
327
+ listRegulationTerms(org: string, cnpj: string, params?: {
328
+ includeHistory?: boolean;
329
+ status?: "pending" | "confirmed" | "rejected";
330
+ }): Promise<{
331
+ data: {
332
+ id: string;
333
+ cnpj: string;
334
+ term: string;
335
+ label: string;
336
+ value_num: number | null;
337
+ value_text: string | null;
338
+ unit: string | null;
339
+ doc_id: string | null;
340
+ doc_page: number | null;
341
+ quote: string | null;
342
+ confidence: number | null;
343
+ status: "pending" | "confirmed" | "rejected";
344
+ valid_from: string;
345
+ valid_to: string | null;
346
+ }[];
347
+ meta: {
348
+ terms: string[];
349
+ };
350
+ }>;
351
+ proposeRegulationTerm(org: string, cnpj: string, body: Body<"/v1/desk/orgs/{org}/classes/{cnpj}/terms", "post">): Promise<{
352
+ id: string;
353
+ cnpj: string;
354
+ term: string;
355
+ label: string;
356
+ value_num: number | null;
357
+ value_text: string | null;
358
+ unit: string | null;
359
+ doc_id: string | null;
360
+ doc_page: number | null;
361
+ quote: string | null;
362
+ confidence: number | null;
363
+ status: "pending" | "confirmed" | "rejected";
364
+ valid_from: string;
365
+ valid_to: string | null;
366
+ }>;
367
+ listOrgRegulationTerms(org: string, params?: {
368
+ status?: "pending" | "confirmed" | "rejected";
369
+ limit?: number;
370
+ }): Promise<{
371
+ data: {
372
+ id: string;
373
+ cnpj: string;
374
+ term: string;
375
+ label: string;
376
+ value_num: number | null;
377
+ value_text: string | null;
378
+ unit: string | null;
379
+ doc_id: string | null;
380
+ doc_page: number | null;
381
+ quote: string | null;
382
+ confidence: number | null;
383
+ status: "pending" | "confirmed" | "rejected";
384
+ valid_from: string;
385
+ valid_to: string | null;
386
+ }[];
387
+ meta: {
388
+ count: number;
389
+ };
390
+ }>;
391
+ reviewRegulationTerm(org: string, termId: string, body: Body<"/v1/desk/orgs/{org}/terms/{termId}/review", "post">): Promise<{
392
+ id: string;
393
+ cnpj: string;
394
+ term: string;
395
+ label: string;
396
+ value_num: number | null;
397
+ value_text: string | null;
398
+ unit: string | null;
399
+ doc_id: string | null;
400
+ doc_page: number | null;
401
+ quote: string | null;
402
+ confidence: number | null;
403
+ status: "pending" | "confirmed" | "rejected";
404
+ valid_from: string;
405
+ valid_to: string | null;
406
+ }>;
407
+ }
408
+ export {};
@@ -0,0 +1,2 @@
1
+ export { DataBolsaCredit, DataBolsaCreditError, type CreditClientOptions } from "./client";
2
+ export type { paths as CreditPaths } from "./schema";
package/dist/index.js ADDED
@@ -0,0 +1,161 @@
1
+ // src/client.ts
2
+ class DataBolsaCreditError extends Error {
3
+ status;
4
+ problem;
5
+ constructor(status, problem) {
6
+ super(problem?.detail ?? problem?.title ?? `HTTP ${status}`);
7
+ this.status = status;
8
+ this.problem = problem;
9
+ }
10
+ }
11
+
12
+ class DataBolsaCredit {
13
+ baseUrl;
14
+ apiKey;
15
+ workspace;
16
+ credentials;
17
+ fetchImpl;
18
+ constructor(opts = {}) {
19
+ this.baseUrl = (opts.baseUrl ?? "https://api.databolsa.com").replace(/\/+$/, "");
20
+ this.apiKey = opts.apiKey;
21
+ this.workspace = opts.workspace;
22
+ this.credentials = opts.credentials;
23
+ this.fetchImpl = opts.fetch ?? fetch;
24
+ }
25
+ async request(method, path, body, query) {
26
+ const url = new URL(`${this.baseUrl}${path}`);
27
+ for (const [k, v] of Object.entries(query ?? {}))
28
+ if (v != null)
29
+ url.searchParams.set(k, String(v));
30
+ const res = await this.fetchImpl(url, {
31
+ method,
32
+ credentials: this.credentials,
33
+ headers: {
34
+ ...body !== undefined ? { "content-type": "application/json" } : {},
35
+ ...this.apiKey ? { authorization: `Bearer ${this.apiKey}` } : {},
36
+ ...this.workspace ? { "x-databolsa-workspace": this.workspace } : {}
37
+ },
38
+ body: body === undefined ? undefined : JSON.stringify(body)
39
+ });
40
+ if (!res.ok) {
41
+ const problem = await res.json().catch(() => null);
42
+ throw new DataBolsaCreditError(res.status, problem);
43
+ }
44
+ return await res.json();
45
+ }
46
+ getMe() {
47
+ return this.request("GET", "/v1/desk/me");
48
+ }
49
+ acceptInvitation(body) {
50
+ return this.request("POST", "/v1/desk/invitations/accept", body);
51
+ }
52
+ getOrganization(org) {
53
+ return this.request("GET", `/v1/desk/orgs/${enc(org)}`);
54
+ }
55
+ updateOrganization(org, body) {
56
+ return this.request("PATCH", `/v1/desk/orgs/${enc(org)}`, body);
57
+ }
58
+ getLicense(org) {
59
+ return this.request("GET", `/v1/desk/orgs/${enc(org)}/license`);
60
+ }
61
+ listMembers(org) {
62
+ return this.request("GET", `/v1/desk/orgs/${enc(org)}/members`);
63
+ }
64
+ assignSeat(org, body) {
65
+ return this.request("POST", `/v1/desk/orgs/${enc(org)}/members`, body);
66
+ }
67
+ updateMember(org, memberId, body) {
68
+ return this.request("PATCH", `/v1/desk/orgs/${enc(org)}/members/${enc(memberId)}`, body);
69
+ }
70
+ listInvitations(org) {
71
+ return this.request("GET", `/v1/desk/orgs/${enc(org)}/invitations`);
72
+ }
73
+ createInvitation(org, body) {
74
+ return this.request("POST", `/v1/desk/orgs/${enc(org)}/invitations`, body);
75
+ }
76
+ revokeInvitation(org, invitationId) {
77
+ return this.request("DELETE", `/v1/desk/orgs/${enc(org)}/invitations/${enc(invitationId)}`);
78
+ }
79
+ listAudit(org, params) {
80
+ return this.request("GET", `/v1/desk/orgs/${enc(org)}/audit`, undefined, { entity_id: params?.entityId, cursor: params?.cursor, limit: params?.limit });
81
+ }
82
+ listWatchlists(org) {
83
+ return this.request("GET", `/v1/desk/orgs/${enc(org)}/watchlists`);
84
+ }
85
+ createWatchlist(org, body) {
86
+ return this.request("POST", `/v1/desk/orgs/${enc(org)}/watchlists`, body);
87
+ }
88
+ deleteWatchlist(org, list) {
89
+ return this.request("DELETE", `/v1/desk/orgs/${enc(org)}/watchlists/${enc(list)}`);
90
+ }
91
+ listWatchlistItems(org, list) {
92
+ return this.request("GET", `/v1/desk/orgs/${enc(org)}/watchlists/${enc(list)}/items`);
93
+ }
94
+ addWatchlistItems(org, list, body) {
95
+ return this.request("POST", `/v1/desk/orgs/${enc(org)}/watchlists/${enc(list)}/items`, body);
96
+ }
97
+ removeWatchlistItem(org, list, cnpj) {
98
+ return this.request("DELETE", `/v1/desk/orgs/${enc(org)}/watchlists/${enc(list)}/items/${enc(cnpj)}`);
99
+ }
100
+ getWatchlistBoard(org, list) {
101
+ return this.request("GET", `/v1/desk/orgs/${enc(org)}/watchlists/${enc(list)}/board`);
102
+ }
103
+ getGrid(org) {
104
+ return this.request("GET", `/v1/desk/orgs/${enc(org)}/grid`);
105
+ }
106
+ setGrid(org, body) {
107
+ return this.request("PUT", `/v1/desk/orgs/${enc(org)}/grid`, body);
108
+ }
109
+ listAlerts(org, list) {
110
+ return this.request("GET", `/v1/desk/orgs/${enc(org)}/watchlists/${enc(list)}/alerts`);
111
+ }
112
+ listAlertHistory(org, params) {
113
+ return this.request("GET", `/v1/desk/orgs/${enc(org)}/alert-history`, undefined, { cnpj: params?.cnpj, source: params?.source, since: params?.since, limit: params?.limit });
114
+ }
115
+ acknowledgeAlert(org, key, body) {
116
+ return this.request("POST", `/v1/desk/orgs/${enc(org)}/alerts/${enc(key)}/ack`, body);
117
+ }
118
+ listAlertRules(org) {
119
+ return this.request("GET", `/v1/desk/orgs/${enc(org)}/alert-rules`);
120
+ }
121
+ upsertAlertRule(org, body) {
122
+ return this.request("PUT", `/v1/desk/orgs/${enc(org)}/alert-rules`, body);
123
+ }
124
+ deleteAlertRule(org, ruleId) {
125
+ return this.request("DELETE", `/v1/desk/orgs/${enc(org)}/alert-rules/${enc(ruleId)}`);
126
+ }
127
+ listNotes(org, params) {
128
+ return this.request("GET", `/v1/desk/orgs/${enc(org)}/notes`, undefined, {
129
+ entity_id: params?.entityId,
130
+ limit: params?.limit
131
+ });
132
+ }
133
+ createNote(org, body) {
134
+ return this.request("POST", `/v1/desk/orgs/${enc(org)}/notes`, body);
135
+ }
136
+ deleteNote(org, noteId) {
137
+ return this.request("DELETE", `/v1/desk/orgs/${enc(org)}/notes/${enc(noteId)}`);
138
+ }
139
+ listRegulationTerms(org, cnpj, params) {
140
+ return this.request("GET", `/v1/desk/orgs/${enc(org)}/classes/${enc(cnpj)}/terms`, undefined, { include_history: params?.includeHistory, status: params?.status });
141
+ }
142
+ proposeRegulationTerm(org, cnpj, body) {
143
+ return this.request("POST", `/v1/desk/orgs/${enc(org)}/classes/${enc(cnpj)}/terms`, body);
144
+ }
145
+ listOrgRegulationTerms(org, params) {
146
+ return this.request("GET", `/v1/desk/orgs/${enc(org)}/terms`, undefined, {
147
+ status: params?.status,
148
+ limit: params?.limit
149
+ });
150
+ }
151
+ reviewRegulationTerm(org, termId, body) {
152
+ return this.request("POST", `/v1/desk/orgs/${enc(org)}/terms/${enc(termId)}/review`, body);
153
+ }
154
+ }
155
+ function enc(segment) {
156
+ return encodeURIComponent(segment);
157
+ }
158
+ export {
159
+ DataBolsaCreditError,
160
+ DataBolsaCredit
161
+ };