mitra-interactions-sdk 1.0.28 → 1.0.30
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 +5 -52
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -42,19 +42,19 @@ import { loginMitra } from 'mitra-interactions-sdk';
|
|
|
42
42
|
|
|
43
43
|
// Login com email e senha
|
|
44
44
|
const result = await loginMitra('email', {
|
|
45
|
-
authUrl: 'https://
|
|
45
|
+
authUrl: 'https://coder.mitralab.io/sdk-auth/',
|
|
46
46
|
projectId: 123
|
|
47
47
|
});
|
|
48
48
|
|
|
49
49
|
// Login com Google
|
|
50
50
|
const result = await loginMitra('google', {
|
|
51
|
-
authUrl: 'https://
|
|
51
|
+
authUrl: 'https://coder.mitralab.io/sdk-auth/',
|
|
52
52
|
projectId: 123
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
// Login com Microsoft
|
|
56
56
|
const result = await loginMitra('microsoft', {
|
|
57
|
-
authUrl: 'https://
|
|
57
|
+
authUrl: 'https://coder.mitralab.io/sdk-auth/',
|
|
58
58
|
projectId: 123
|
|
59
59
|
});
|
|
60
60
|
|
|
@@ -64,21 +64,6 @@ const result = await loginMitra('microsoft', {
|
|
|
64
64
|
|
|
65
65
|
## Métodos Disponíveis
|
|
66
66
|
|
|
67
|
-
### runQueryMitra
|
|
68
|
-
|
|
69
|
-
Executa uma query SQL (SELECT) em um projeto.
|
|
70
|
-
|
|
71
|
-
```typescript
|
|
72
|
-
import { runQueryMitra } from 'mitra-interactions-sdk';
|
|
73
|
-
|
|
74
|
-
const result = await runQueryMitra({
|
|
75
|
-
projectId: 123,
|
|
76
|
-
sql: 'SELECT * FROM usuarios LIMIT 10',
|
|
77
|
-
jdbcId: 1 // Opcional, usa autoConnect se não informado
|
|
78
|
-
});
|
|
79
|
-
// result: { status, result: { rows: Record<string, any>[], rowCount: number } }
|
|
80
|
-
```
|
|
81
|
-
|
|
82
67
|
### executeDbActionMitra
|
|
83
68
|
|
|
84
69
|
Executa uma DBAction (DML) cadastrada.
|
|
@@ -160,34 +145,6 @@ const integrations = await listIntegrationsMitra({ projectId: 123 });
|
|
|
160
145
|
// result: IntegrationResponse[] — [{ id (UUID), projectId, name, slug, blueprintId, blueprintType, authType, credentials, status, lastCheckedAt, createdAt, updatedAt }]
|
|
161
146
|
```
|
|
162
147
|
|
|
163
|
-
#### callIntegrationMitra
|
|
164
|
-
|
|
165
|
-
Chama uma API externa via serviço de integrações do Mitra. O serviço cuida de autenticação, tokens e refresh automaticamente.
|
|
166
|
-
|
|
167
|
-
```typescript
|
|
168
|
-
import { callIntegrationMitra } from 'mitra-interactions-sdk';
|
|
169
|
-
|
|
170
|
-
// POST para API externa
|
|
171
|
-
const result = await callIntegrationMitra({
|
|
172
|
-
projectId: 123,
|
|
173
|
-
connection: 'meu-erp-sankhya',
|
|
174
|
-
method: 'POST',
|
|
175
|
-
endpoint: '/api/v1/pedidos',
|
|
176
|
-
params: { status: 'aberto' }, // Opcional - query parameters
|
|
177
|
-
body: { campo: 'valor' } // Opcional - body da requisição
|
|
178
|
-
});
|
|
179
|
-
// result: { statusCode: 200, body: { ...resposta da API externa... } }
|
|
180
|
-
|
|
181
|
-
// GET simples
|
|
182
|
-
const result2 = await callIntegrationMitra({
|
|
183
|
-
projectId: 123,
|
|
184
|
-
connection: 'api-vendas',
|
|
185
|
-
method: 'GET',
|
|
186
|
-
endpoint: '/v1/pedidos',
|
|
187
|
-
params: { status: 'aberto', page: 1 }
|
|
188
|
-
});
|
|
189
|
-
```
|
|
190
|
-
|
|
191
148
|
### setFileStatusMitra
|
|
192
149
|
|
|
193
150
|
Move arquivo do chat para PUBLIC ou LOADABLE.
|
|
@@ -319,12 +276,10 @@ import type {
|
|
|
319
276
|
LoginOptions,
|
|
320
277
|
LoginResponse,
|
|
321
278
|
// Options
|
|
322
|
-
RunQueryOptions,
|
|
323
279
|
ExecuteDbActionOptions,
|
|
324
280
|
ExecuteServerFunctionOptions,
|
|
325
281
|
ExecuteServerFunctionAsyncOptions,
|
|
326
282
|
ListIntegrationsOptions,
|
|
327
|
-
CallIntegrationOptions,
|
|
328
283
|
StopServerFunctionExecutionOptions,
|
|
329
284
|
SetFileStatusOptions,
|
|
330
285
|
SetVariableOptions,
|
|
@@ -339,7 +294,6 @@ import type {
|
|
|
339
294
|
DeleteRecordOptions,
|
|
340
295
|
CreateRecordsBatchOptions,
|
|
341
296
|
// Responses
|
|
342
|
-
RunQueryResponse,
|
|
343
297
|
ExecuteDbActionResponse,
|
|
344
298
|
SetFileStatusResponse,
|
|
345
299
|
SetVariableResponse,
|
|
@@ -349,7 +303,6 @@ import type {
|
|
|
349
303
|
ExecuteServerFunctionResponse,
|
|
350
304
|
ExecuteServerFunctionAsyncResponse,
|
|
351
305
|
IntegrationResponse,
|
|
352
|
-
CallIntegrationResponse,
|
|
353
306
|
StopServerFunctionExecutionResponse,
|
|
354
307
|
ListRecordsResponse
|
|
355
308
|
} from 'mitra-interactions-sdk';
|
|
@@ -359,9 +312,9 @@ import type {
|
|
|
359
312
|
|
|
360
313
|
```typescript
|
|
361
314
|
try {
|
|
362
|
-
const result = await
|
|
315
|
+
const result = await executeDbActionMitra({
|
|
363
316
|
projectId: 123,
|
|
364
|
-
|
|
317
|
+
dbActionId: 456
|
|
365
318
|
});
|
|
366
319
|
} catch (error) {
|
|
367
320
|
console.log('Erro:', error.message);
|