mitra-interactions-sdk 1.0.56-beta.1 → 1.0.56
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 +27 -0
- package/dist/index.d.mts +132 -100
- package/dist/index.d.ts +132 -100
- package/dist/index.js +113 -285
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +104 -276
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -206,6 +206,33 @@ await executeDbActionMitra({ dbActionId: 1 });
|
|
|
206
206
|
|
|
207
207
|
> **Nota:** `authUrl` e `projectId` são opcionais em todas as funções de email se já foram configurados via `configureSdkMitra()`.
|
|
208
208
|
|
|
209
|
+
### Reset de Senha (esqueci minha senha)
|
|
210
|
+
|
|
211
|
+
Endpoints públicos (sem token) para o fluxo de "esqueci minha senha":
|
|
212
|
+
|
|
213
|
+
```typescript
|
|
214
|
+
import {
|
|
215
|
+
sendPasswordResetCodeMitra,
|
|
216
|
+
validatePasswordResetCodeMitra,
|
|
217
|
+
resetPasswordMitra,
|
|
218
|
+
emailLoginMitra
|
|
219
|
+
} from 'mitra-interactions-sdk';
|
|
220
|
+
|
|
221
|
+
// 1. Envia código de 6 dígitos por email
|
|
222
|
+
await sendPasswordResetCodeMitra({ email });
|
|
223
|
+
|
|
224
|
+
// 2. (opcional) Valida o código antes de pedir a senha nova
|
|
225
|
+
await validatePasswordResetCodeMitra({ email, code: '123456' });
|
|
226
|
+
|
|
227
|
+
// 3. Troca a senha
|
|
228
|
+
await resetPasswordMitra({ email, code: '123456', newPassword: 'novaSenha' });
|
|
229
|
+
|
|
230
|
+
// 4. Login com a nova senha
|
|
231
|
+
await emailLoginMitra({ email, password: 'novaSenha' });
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
> **Nota:** `projectId` é opcional se já configurado via `configureSdkMitra()`.
|
|
235
|
+
|
|
209
236
|
## Métodos Disponíveis
|
|
210
237
|
|
|
211
238
|
### executeServerFunctionMitra
|
package/dist/index.d.mts
CHANGED
|
@@ -5,7 +5,7 @@ interface LoginOptions {
|
|
|
5
5
|
/** URL da página de autenticação Mitra (ex: https://coder.mitralab.io/sdk-auth/). Opcional se já configurado via configureSdkMitra. */
|
|
6
6
|
authUrl?: string;
|
|
7
7
|
/** ID do projeto. Opcional se já configurado via configureSdkMitra. */
|
|
8
|
-
projectId?: number
|
|
8
|
+
projectId?: number;
|
|
9
9
|
/** Modo de login: 'popup' (default) abre popup, 'redirect' navega para a página de auth. */
|
|
10
10
|
mode?: 'popup' | 'redirect';
|
|
11
11
|
/** URL de retorno após login com mode 'redirect'. A página de auth redirecionará de volta para esta URL com token nos query params. */
|
|
@@ -18,8 +18,6 @@ interface LoginOptions {
|
|
|
18
18
|
interface LoginResponse {
|
|
19
19
|
/** Token JWT (já com prefixo Bearer) */
|
|
20
20
|
token: string;
|
|
21
|
-
/** Refresh token (novo Mitra). Presente apenas no novo mundo. */
|
|
22
|
-
refreshToken?: string;
|
|
23
21
|
/** URL base da API */
|
|
24
22
|
baseURL: string;
|
|
25
23
|
/** URL do serviço de integrações (opcional) */
|
|
@@ -29,7 +27,7 @@ interface EmailSignupOptions {
|
|
|
29
27
|
/** URL da página de auth (ex: https://validacao.mitralab.io/sdk-auth/). Opcional se já configurado via configureSdkMitra. */
|
|
30
28
|
authUrl?: string;
|
|
31
29
|
/** ID do projeto. Opcional se já configurado via configureSdkMitra. */
|
|
32
|
-
projectId?: number
|
|
30
|
+
projectId?: number;
|
|
33
31
|
/** Nome completo do usuário */
|
|
34
32
|
name: string;
|
|
35
33
|
/** Email do usuário */
|
|
@@ -41,7 +39,7 @@ interface EmailLoginOptions {
|
|
|
41
39
|
/** URL da página de auth (ex: https://validacao.mitralab.io/sdk-auth/). Opcional se já configurado via configureSdkMitra. */
|
|
42
40
|
authUrl?: string;
|
|
43
41
|
/** ID do projeto. Opcional se já configurado via configureSdkMitra. */
|
|
44
|
-
projectId?: number
|
|
42
|
+
projectId?: number;
|
|
45
43
|
/** Email do usuário */
|
|
46
44
|
email: string;
|
|
47
45
|
/** Senha */
|
|
@@ -51,7 +49,7 @@ interface EmailVerifyCodeOptions {
|
|
|
51
49
|
/** URL da página de auth. Opcional se já configurado via configureSdkMitra. */
|
|
52
50
|
authUrl?: string;
|
|
53
51
|
/** ID do projeto. Opcional se já configurado via configureSdkMitra. */
|
|
54
|
-
projectId?: number
|
|
52
|
+
projectId?: number;
|
|
55
53
|
/** Email do usuário */
|
|
56
54
|
email: string;
|
|
57
55
|
/** Código de verificação de 6 dígitos */
|
|
@@ -63,13 +61,15 @@ interface EmailResendCodeOptions {
|
|
|
63
61
|
/** URL da página de auth. Opcional se já configurado via configureSdkMitra. */
|
|
64
62
|
authUrl?: string;
|
|
65
63
|
/** ID do projeto. Opcional se já configurado via configureSdkMitra. */
|
|
66
|
-
projectId?: number
|
|
64
|
+
projectId?: number;
|
|
67
65
|
/** Email do usuário */
|
|
68
66
|
email: string;
|
|
69
67
|
}
|
|
70
68
|
interface SendPasswordResetCodeOptions {
|
|
71
69
|
/** Email do usuário que esqueceu a senha */
|
|
72
70
|
email: string;
|
|
71
|
+
/** ID do projeto. Default: do config global. */
|
|
72
|
+
projectId?: number | string;
|
|
73
73
|
/** URL da página de auth (opcional — usado pra derivar a API base). Default: do config global. */
|
|
74
74
|
authUrl?: string;
|
|
75
75
|
/** Override explícito da API base (ex: https://api0.mitraecp.com:1005). Default: derivado do authUrl. */
|
|
@@ -79,6 +79,7 @@ interface ValidatePasswordResetCodeOptions {
|
|
|
79
79
|
email: string;
|
|
80
80
|
/** Código de 6 dígitos recebido por email */
|
|
81
81
|
code: string;
|
|
82
|
+
projectId?: number | string;
|
|
82
83
|
authUrl?: string;
|
|
83
84
|
authApiURL?: string;
|
|
84
85
|
}
|
|
@@ -88,18 +89,19 @@ interface ResetPasswordOptions {
|
|
|
88
89
|
code: string;
|
|
89
90
|
/** Nova senha */
|
|
90
91
|
newPassword: string;
|
|
92
|
+
projectId?: number | string;
|
|
91
93
|
authUrl?: string;
|
|
92
94
|
authApiURL?: string;
|
|
93
95
|
}
|
|
94
96
|
interface ExecuteDataLoaderOptions {
|
|
95
|
-
projectId?: number
|
|
96
|
-
dataLoaderId: number
|
|
97
|
+
projectId?: number;
|
|
98
|
+
dataLoaderId: number;
|
|
97
99
|
input?: Record<string, unknown>;
|
|
98
100
|
}
|
|
99
101
|
interface ExecuteDataLoaderResponse {
|
|
100
102
|
status: string;
|
|
101
103
|
result: {
|
|
102
|
-
dataLoaderId: number
|
|
104
|
+
dataLoaderId: number;
|
|
103
105
|
executionLog: {
|
|
104
106
|
timestamp: string;
|
|
105
107
|
rowCount: number;
|
|
@@ -113,9 +115,9 @@ interface ExecuteDataLoaderResponse {
|
|
|
113
115
|
}
|
|
114
116
|
interface ExecuteDbActionOptions {
|
|
115
117
|
/** ID do projeto (opcional se já configurado via configureSdkMitra) */
|
|
116
|
-
projectId?: number
|
|
118
|
+
projectId?: number;
|
|
117
119
|
/** ID da DBAction cadastrada */
|
|
118
|
-
dbActionId: number
|
|
120
|
+
dbActionId: number;
|
|
119
121
|
/** Parâmetros de entrada (opcional) — substituição de variáveis no SQL (ex: { "nome": "João" } substitui :nome) */
|
|
120
122
|
input?: Record<string, unknown>;
|
|
121
123
|
}
|
|
@@ -127,7 +129,7 @@ interface ExecuteDbActionResponse {
|
|
|
127
129
|
}
|
|
128
130
|
interface SetFileStatusOptions {
|
|
129
131
|
/** ID do projeto (opcional se já configurado via configureSdkMitra) */
|
|
130
|
-
projectId?: number
|
|
132
|
+
projectId?: number;
|
|
131
133
|
/** Nome do arquivo */
|
|
132
134
|
fileName: string;
|
|
133
135
|
/** Caminho de destino: "PUBLIC" ou "LOADABLE" */
|
|
@@ -144,7 +146,7 @@ interface SetFileStatusResponse {
|
|
|
144
146
|
}
|
|
145
147
|
interface SetVariableOptions {
|
|
146
148
|
/** ID do projeto (opcional se já configurado via configureSdkMitra) */
|
|
147
|
-
projectId?: number
|
|
149
|
+
projectId?: number;
|
|
148
150
|
/** Nome da variável (key) */
|
|
149
151
|
key: string;
|
|
150
152
|
/** Valor da variável (opcional) */
|
|
@@ -159,9 +161,9 @@ interface SetVariableResponse {
|
|
|
159
161
|
}
|
|
160
162
|
interface ExecuteServerFunctionOptions {
|
|
161
163
|
/** ID do projeto (opcional se já configurado via configureSdkMitra) */
|
|
162
|
-
projectId?: number
|
|
164
|
+
projectId?: number;
|
|
163
165
|
/** ID da Server Function cadastrada */
|
|
164
|
-
serverFunctionId: number
|
|
166
|
+
serverFunctionId: number;
|
|
165
167
|
/** Objeto de entrada para a função (opcional) */
|
|
166
168
|
input?: Record<string, unknown>;
|
|
167
169
|
}
|
|
@@ -178,9 +180,9 @@ interface ExecuteServerFunctionResponse {
|
|
|
178
180
|
}
|
|
179
181
|
interface ExecuteServerFunctionAsyncOptions {
|
|
180
182
|
/** ID do projeto (opcional se já configurado via configureSdkMitra) */
|
|
181
|
-
projectId?: number
|
|
183
|
+
projectId?: number;
|
|
182
184
|
/** ID da Server Function cadastrada */
|
|
183
|
-
serverFunctionId: number
|
|
185
|
+
serverFunctionId: number;
|
|
184
186
|
/** Objeto de entrada para a função (opcional) */
|
|
185
187
|
input?: Record<string, unknown>;
|
|
186
188
|
}
|
|
@@ -193,9 +195,9 @@ interface ExecuteServerFunctionAsyncResponse {
|
|
|
193
195
|
}
|
|
194
196
|
interface ExecutePublicServerFunctionOptions {
|
|
195
197
|
/** ID do projeto (tenant) */
|
|
196
|
-
projectId: number
|
|
198
|
+
projectId: number;
|
|
197
199
|
/** ID da Server Function (deve ter publicExecution = true) */
|
|
198
|
-
serverFunctionId: number
|
|
200
|
+
serverFunctionId: number;
|
|
199
201
|
/** Objeto de entrada para a função (opcional) */
|
|
200
202
|
input?: Record<string, unknown>;
|
|
201
203
|
}
|
|
@@ -212,7 +214,7 @@ interface ExecutePublicServerFunctionAsyncResponse {
|
|
|
212
214
|
status: string;
|
|
213
215
|
}
|
|
214
216
|
interface GetPublicServerFunctionExecutionOptions {
|
|
215
|
-
projectId: number
|
|
217
|
+
projectId: number;
|
|
216
218
|
executionId: string;
|
|
217
219
|
}
|
|
218
220
|
interface GetPublicServerFunctionExecutionResponse {
|
|
@@ -231,54 +233,54 @@ interface ListRecordsResponse {
|
|
|
231
233
|
totalPages: number;
|
|
232
234
|
}
|
|
233
235
|
interface ListRecordsOptions {
|
|
234
|
-
projectId?: number
|
|
236
|
+
projectId?: number;
|
|
235
237
|
tableName: string;
|
|
236
238
|
page?: number;
|
|
237
239
|
size?: number;
|
|
238
240
|
filters?: Record<string, unknown>;
|
|
239
|
-
jdbcConnectionConfigId?: number
|
|
241
|
+
jdbcConnectionConfigId?: number;
|
|
240
242
|
}
|
|
241
243
|
interface GetRecordOptions {
|
|
242
|
-
projectId?: number
|
|
244
|
+
projectId?: number;
|
|
243
245
|
tableName: string;
|
|
244
|
-
id: number
|
|
245
|
-
jdbcConnectionConfigId?: number
|
|
246
|
+
id: number;
|
|
247
|
+
jdbcConnectionConfigId?: number;
|
|
246
248
|
}
|
|
247
249
|
interface CreateRecordOptions {
|
|
248
|
-
projectId?: number
|
|
250
|
+
projectId?: number;
|
|
249
251
|
tableName: string;
|
|
250
252
|
data: Record<string, unknown>;
|
|
251
|
-
jdbcConnectionConfigId?: number
|
|
253
|
+
jdbcConnectionConfigId?: number;
|
|
252
254
|
}
|
|
253
255
|
interface UpdateRecordOptions {
|
|
254
|
-
projectId?: number
|
|
256
|
+
projectId?: number;
|
|
255
257
|
tableName: string;
|
|
256
|
-
id: number
|
|
258
|
+
id: number;
|
|
257
259
|
data: Record<string, unknown>;
|
|
258
|
-
jdbcConnectionConfigId?: number
|
|
260
|
+
jdbcConnectionConfigId?: number;
|
|
259
261
|
}
|
|
260
262
|
interface PatchRecordOptions {
|
|
261
|
-
projectId?: number
|
|
263
|
+
projectId?: number;
|
|
262
264
|
tableName: string;
|
|
263
|
-
id: number
|
|
265
|
+
id: number;
|
|
264
266
|
data: Record<string, unknown>;
|
|
265
|
-
jdbcConnectionConfigId?: number
|
|
267
|
+
jdbcConnectionConfigId?: number;
|
|
266
268
|
}
|
|
267
269
|
interface DeleteRecordOptions {
|
|
268
|
-
projectId?: number
|
|
270
|
+
projectId?: number;
|
|
269
271
|
tableName: string;
|
|
270
|
-
id: number
|
|
271
|
-
jdbcConnectionConfigId?: number
|
|
272
|
+
id: number;
|
|
273
|
+
jdbcConnectionConfigId?: number;
|
|
272
274
|
}
|
|
273
275
|
interface CreateRecordsBatchOptions {
|
|
274
|
-
projectId?: number
|
|
276
|
+
projectId?: number;
|
|
275
277
|
tableName: string;
|
|
276
278
|
records: Record<string, unknown>[];
|
|
277
|
-
jdbcConnectionConfigId?: number
|
|
279
|
+
jdbcConnectionConfigId?: number;
|
|
278
280
|
}
|
|
279
281
|
interface UploadFileOptions {
|
|
280
282
|
/** ID do projeto (opcional se já configurado via configureSdkMitra) */
|
|
281
|
-
projectId?: number
|
|
283
|
+
projectId?: number;
|
|
282
284
|
/** Arquivo a ser enviado (File ou Blob) */
|
|
283
285
|
file: File | Blob;
|
|
284
286
|
/** Habilitar debug (opcional) */
|
|
@@ -295,11 +297,11 @@ interface UploadFileResponse {
|
|
|
295
297
|
}
|
|
296
298
|
interface ListVariablesOptions {
|
|
297
299
|
/** ID do projeto (opcional se já configurado via configureSdkMitra) */
|
|
298
|
-
projectId?: number
|
|
300
|
+
projectId?: number;
|
|
299
301
|
}
|
|
300
302
|
interface ListVariablesResponse {
|
|
301
303
|
status: string;
|
|
302
|
-
projectId: number
|
|
304
|
+
projectId: number;
|
|
303
305
|
result: {
|
|
304
306
|
key: string;
|
|
305
307
|
value: string;
|
|
@@ -307,7 +309,7 @@ interface ListVariablesResponse {
|
|
|
307
309
|
}
|
|
308
310
|
interface GetVariableOptions {
|
|
309
311
|
/** ID do projeto (opcional se já configurado via configureSdkMitra) */
|
|
310
|
-
projectId?: number
|
|
312
|
+
projectId?: number;
|
|
311
313
|
/** Nome da variável (com ou sem :VAR_) */
|
|
312
314
|
key: string;
|
|
313
315
|
}
|
|
@@ -320,9 +322,9 @@ interface GetVariableResponse {
|
|
|
320
322
|
}
|
|
321
323
|
interface RunActionOptions {
|
|
322
324
|
/** ID do projeto (opcional se já configurado via configureSdkMitra) */
|
|
323
|
-
projectId?: number
|
|
325
|
+
projectId?: number;
|
|
324
326
|
/** ID da Action a executar */
|
|
325
|
-
actionId: number
|
|
327
|
+
actionId: number;
|
|
326
328
|
/** Parâmetros de entrada para a action (opcional) */
|
|
327
329
|
input?: Record<string, unknown>;
|
|
328
330
|
}
|
|
@@ -336,7 +338,7 @@ interface RunActionResponse {
|
|
|
336
338
|
}
|
|
337
339
|
interface CallIntegrationOptions {
|
|
338
340
|
/** ID do projeto (opcional se já configurado via configureSdkMitra) */
|
|
339
|
-
projectId?: number
|
|
341
|
+
projectId?: number;
|
|
340
342
|
/** Slug da integração configurada no painel */
|
|
341
343
|
connection: string;
|
|
342
344
|
/** Método HTTP: GET, POST, PUT, DELETE */
|
|
@@ -356,11 +358,11 @@ interface CallIntegrationResponse {
|
|
|
356
358
|
}
|
|
357
359
|
interface ListIntegrationsOptions {
|
|
358
360
|
/** ID do projeto (opcional se já configurado via configureSdkMitra) */
|
|
359
|
-
projectId?: number
|
|
361
|
+
projectId?: number;
|
|
360
362
|
}
|
|
361
363
|
interface IntegrationResponse {
|
|
362
364
|
id: string;
|
|
363
|
-
projectId: number
|
|
365
|
+
projectId: number;
|
|
364
366
|
name: string;
|
|
365
367
|
slug: string;
|
|
366
368
|
blueprintId: string | null;
|
|
@@ -374,7 +376,7 @@ interface IntegrationResponse {
|
|
|
374
376
|
}
|
|
375
377
|
interface StopServerFunctionExecutionOptions {
|
|
376
378
|
/** ID do projeto (opcional se já configurado via configureSdkMitra) */
|
|
377
|
-
projectId?: number
|
|
379
|
+
projectId?: number;
|
|
378
380
|
/** ID da execução a ser parada */
|
|
379
381
|
executionId: string;
|
|
380
382
|
}
|
|
@@ -386,87 +388,87 @@ interface StopServerFunctionExecutionResponse {
|
|
|
386
388
|
};
|
|
387
389
|
}
|
|
388
390
|
interface ListProfilesOptions {
|
|
389
|
-
projectId?: number
|
|
391
|
+
projectId?: number;
|
|
390
392
|
}
|
|
391
393
|
interface ListProfilesResponse {
|
|
392
394
|
status: string;
|
|
393
|
-
projectId: number
|
|
395
|
+
projectId: number;
|
|
394
396
|
result: {
|
|
395
|
-
id: number
|
|
397
|
+
id: number;
|
|
396
398
|
name: string;
|
|
397
399
|
color: string;
|
|
398
|
-
homeScreenId: number
|
|
400
|
+
homeScreenId: number;
|
|
399
401
|
}[];
|
|
400
402
|
}
|
|
401
403
|
interface GetProfileDetailsOptions {
|
|
402
|
-
projectId?: number
|
|
403
|
-
profileId: number
|
|
404
|
+
projectId?: number;
|
|
405
|
+
profileId: number;
|
|
404
406
|
}
|
|
405
407
|
interface GetProfileDetailsResponse {
|
|
406
408
|
status: string;
|
|
407
|
-
projectId: number
|
|
409
|
+
projectId: number;
|
|
408
410
|
result: {
|
|
409
|
-
id: number
|
|
411
|
+
id: number;
|
|
410
412
|
name: string;
|
|
411
413
|
users: {
|
|
412
|
-
id: number
|
|
414
|
+
id: number;
|
|
413
415
|
name: string;
|
|
414
416
|
email: string;
|
|
415
417
|
}[];
|
|
416
418
|
selectTables: {
|
|
417
419
|
tableName: string;
|
|
418
|
-
jdbcConnectionConfigId?: number
|
|
420
|
+
jdbcConnectionConfigId?: number;
|
|
419
421
|
}[];
|
|
420
422
|
dmlTables: {
|
|
421
423
|
tableName: string;
|
|
422
|
-
jdbcConnectionConfigId?: number
|
|
424
|
+
jdbcConnectionConfigId?: number;
|
|
423
425
|
}[];
|
|
424
426
|
actions: {
|
|
425
|
-
id: number
|
|
427
|
+
id: number;
|
|
426
428
|
name: string;
|
|
427
429
|
}[];
|
|
428
430
|
screens: {
|
|
429
|
-
id: number
|
|
431
|
+
id: number;
|
|
430
432
|
name: string;
|
|
431
433
|
}[];
|
|
432
434
|
serverFunctions: {
|
|
433
|
-
id: number
|
|
435
|
+
id: number;
|
|
434
436
|
name: string;
|
|
435
437
|
}[];
|
|
436
438
|
};
|
|
437
439
|
}
|
|
438
440
|
interface CreateProfileOptions {
|
|
439
|
-
projectId?: number
|
|
441
|
+
projectId?: number;
|
|
440
442
|
name: string;
|
|
441
443
|
color?: string;
|
|
442
|
-
homeScreenId?: number
|
|
444
|
+
homeScreenId?: number;
|
|
443
445
|
}
|
|
444
446
|
interface CreateProfileResponse {
|
|
445
447
|
status: string;
|
|
446
448
|
result: {
|
|
447
|
-
id: number
|
|
449
|
+
id: number;
|
|
448
450
|
name: string;
|
|
449
451
|
message: string;
|
|
450
452
|
};
|
|
451
453
|
}
|
|
452
454
|
interface UpdateProfileOptions {
|
|
453
|
-
projectId?: number
|
|
454
|
-
profileId: number
|
|
455
|
+
projectId?: number;
|
|
456
|
+
profileId: number;
|
|
455
457
|
name?: string;
|
|
456
458
|
color?: string;
|
|
457
|
-
homeScreenId?: number
|
|
459
|
+
homeScreenId?: number;
|
|
458
460
|
}
|
|
459
461
|
interface UpdateProfileResponse {
|
|
460
462
|
status: string;
|
|
461
463
|
result: {
|
|
462
|
-
id: number
|
|
464
|
+
id: number;
|
|
463
465
|
name: string;
|
|
464
466
|
message: string;
|
|
465
467
|
};
|
|
466
468
|
}
|
|
467
469
|
interface DeleteProfileOptions {
|
|
468
|
-
projectId?: number
|
|
469
|
-
profileId: number
|
|
470
|
+
projectId?: number;
|
|
471
|
+
profileId: number;
|
|
470
472
|
}
|
|
471
473
|
interface DeleteProfileResponse {
|
|
472
474
|
status: string;
|
|
@@ -475,44 +477,44 @@ interface DeleteProfileResponse {
|
|
|
475
477
|
};
|
|
476
478
|
}
|
|
477
479
|
interface SetProfileUsersOptions {
|
|
478
|
-
projectId?: number
|
|
479
|
-
profileId: number
|
|
480
|
+
projectId?: number;
|
|
481
|
+
profileId: number;
|
|
480
482
|
userIds: number[];
|
|
481
483
|
}
|
|
482
484
|
interface ProfileTableRef {
|
|
483
485
|
tableName: string;
|
|
484
486
|
}
|
|
485
487
|
interface SetProfileSelectTablesOptions {
|
|
486
|
-
projectId?: number
|
|
487
|
-
profileId: number
|
|
488
|
-
jdbcConnectionConfigId?: number
|
|
488
|
+
projectId?: number;
|
|
489
|
+
profileId: number;
|
|
490
|
+
jdbcConnectionConfigId?: number;
|
|
489
491
|
tables: ProfileTableRef[];
|
|
490
492
|
}
|
|
491
493
|
interface SetProfileDmlTablesOptions {
|
|
492
|
-
projectId?: number
|
|
493
|
-
profileId: number
|
|
494
|
-
jdbcConnectionConfigId?: number
|
|
494
|
+
projectId?: number;
|
|
495
|
+
profileId: number;
|
|
496
|
+
jdbcConnectionConfigId?: number;
|
|
495
497
|
tables: ProfileTableRef[];
|
|
496
498
|
}
|
|
497
499
|
interface SetProfileActionsOptions {
|
|
498
|
-
projectId?: number
|
|
499
|
-
profileId: number
|
|
500
|
+
projectId?: number;
|
|
501
|
+
profileId: number;
|
|
500
502
|
actionIds: number[];
|
|
501
503
|
}
|
|
502
504
|
interface SetProfileScreensOptions {
|
|
503
|
-
projectId?: number
|
|
504
|
-
profileId: number
|
|
505
|
+
projectId?: number;
|
|
506
|
+
profileId: number;
|
|
505
507
|
screenIds: number[];
|
|
506
508
|
}
|
|
507
509
|
interface SetProfileServerFunctionsOptions {
|
|
508
|
-
projectId?: number
|
|
509
|
-
profileId: number
|
|
510
|
+
projectId?: number;
|
|
511
|
+
profileId: number;
|
|
510
512
|
serverFunctionIds: number[];
|
|
511
513
|
}
|
|
512
514
|
interface SetProfilePermissionResponse {
|
|
513
515
|
status: string;
|
|
514
516
|
result: {
|
|
515
|
-
profileId: number
|
|
517
|
+
profileId: number;
|
|
516
518
|
message: string;
|
|
517
519
|
[key: string]: unknown;
|
|
518
520
|
};
|
|
@@ -574,14 +576,12 @@ interface MitraConfig {
|
|
|
574
576
|
baseURL: string;
|
|
575
577
|
/** Token JWT para autenticação (opcional para Server Functions públicas) */
|
|
576
578
|
token?: string;
|
|
577
|
-
/** Refresh token (novo Mitra). Necessário para refresh automático no novo mundo. */
|
|
578
|
-
refreshToken?: string;
|
|
579
579
|
/** URL base do serviço de integrações (ex: https://api0.mitraecp.com:1003) */
|
|
580
580
|
integrationURL?: string;
|
|
581
581
|
/** URL da página de autenticação Mitra (ex: https://coder.mitralab.io/sdk-auth/) */
|
|
582
582
|
authUrl?: string;
|
|
583
583
|
/** ID do projeto (usado como fallback nos métodos de login e serviços) */
|
|
584
|
-
projectId?: number
|
|
584
|
+
projectId?: number;
|
|
585
585
|
/** Callback chamado quando o token é renovado automaticamente (após 401/403). Recebe a nova sessão. */
|
|
586
586
|
onTokenRefresh?: (session: LoginResponse) => void;
|
|
587
587
|
}
|
|
@@ -596,7 +596,7 @@ declare function getConfig(): MitraConfig;
|
|
|
596
596
|
/**
|
|
597
597
|
* Resolve projectId: usa o valor passado, senão pega do config salvo.
|
|
598
598
|
*/
|
|
599
|
-
declare function resolveProjectId(projectId?: number
|
|
599
|
+
declare function resolveProjectId(projectId?: number): number;
|
|
600
600
|
|
|
601
601
|
/**
|
|
602
602
|
* Mitra Interactions SDK - Chat Integration
|
|
@@ -615,24 +615,56 @@ declare function openChatMitra(): void;
|
|
|
615
615
|
declare function closeChatMitra(): void;
|
|
616
616
|
|
|
617
617
|
/**
|
|
618
|
-
* Mitra Interactions SDK - Autenticação
|
|
618
|
+
* Mitra Interactions SDK - Autenticação
|
|
619
619
|
*
|
|
620
|
-
*
|
|
621
|
-
*
|
|
622
|
-
* - Qualquer outro authUrl → auth-new.ts (novo Mitra: Kong gateway + IAM service)
|
|
623
|
-
*
|
|
624
|
-
* A API pública é idêntica à legacy. Consumers não precisam alterar código.
|
|
620
|
+
* Login via popup seguro hospedado no domínio Mitra.
|
|
621
|
+
* Credenciais nunca passam pelo código do desenvolvedor.
|
|
625
622
|
*/
|
|
626
623
|
|
|
627
|
-
|
|
624
|
+
/**
|
|
625
|
+
* Login com email e senha via popup/redirect seguro Mitra.
|
|
626
|
+
*/
|
|
628
627
|
declare function loginWithEmailMitra(options?: LoginOptions): Promise<LoginResponse>;
|
|
628
|
+
/**
|
|
629
|
+
* Login com Google via popup/redirect seguro Mitra.
|
|
630
|
+
*/
|
|
629
631
|
declare function loginWithGoogleMitra(options?: LoginOptions): Promise<LoginResponse>;
|
|
632
|
+
/**
|
|
633
|
+
* Login com Microsoft via popup/redirect seguro Mitra.
|
|
634
|
+
*/
|
|
630
635
|
declare function loginWithMicrosoftMitra(options?: LoginOptions): Promise<LoginResponse>;
|
|
636
|
+
/**
|
|
637
|
+
* Login genérico via popup/redirect seguro Mitra.
|
|
638
|
+
*/
|
|
639
|
+
declare function loginMitra(method: 'email' | 'google' | 'microsoft' | 'mitra', options?: LoginOptions): Promise<LoginResponse>;
|
|
640
|
+
/**
|
|
641
|
+
* Renova o token silenciosamente via iframe invisível.
|
|
642
|
+
* Se já houver um refresh em andamento, reaproveita a mesma promise.
|
|
643
|
+
*/
|
|
644
|
+
declare function refreshTokenSilently(authUrl: string, projectId: number): Promise<LoginResponse>;
|
|
645
|
+
/**
|
|
646
|
+
* Cria conta via email usando iframe silencioso.
|
|
647
|
+
* Após sucesso, o usuário recebe um código de verificação por email.
|
|
648
|
+
* Fluxo: emailSignupMitra → emailVerifyCodeMitra → emailLoginMitra
|
|
649
|
+
*/
|
|
631
650
|
declare function emailSignupMitra(options: EmailSignupOptions): Promise<void>;
|
|
632
|
-
|
|
651
|
+
/**
|
|
652
|
+
* Verifica o código de 6 dígitos enviado por email após signup.
|
|
653
|
+
* Após verificação, faz login automático e retorna LoginResponse.
|
|
654
|
+
* Auto-configura o SDK após sucesso.
|
|
655
|
+
*/
|
|
633
656
|
declare function emailVerifyCodeMitra(options: EmailVerifyCodeOptions): Promise<LoginResponse>;
|
|
657
|
+
/**
|
|
658
|
+
* Reenvia o código de verificação para o email.
|
|
659
|
+
*/
|
|
634
660
|
declare function emailResendCodeMitra(options: EmailResendCodeOptions): Promise<void>;
|
|
635
|
-
|
|
661
|
+
/**
|
|
662
|
+
* Login via email e senha usando iframe silencioso.
|
|
663
|
+
* O HTML de auth faz a chamada à API e resolve as credenciais do projeto.
|
|
664
|
+
* Retorna LoginResponse com token, baseURL e integrationURL.
|
|
665
|
+
* Auto-configura o SDK após sucesso.
|
|
666
|
+
*/
|
|
667
|
+
declare function emailLoginMitra(options: EmailLoginOptions): Promise<LoginResponse>;
|
|
636
668
|
|
|
637
669
|
/**
|
|
638
670
|
* Mitra Interactions SDK - Password Reset (legacy backend)
|