mitra-interactions-sdk 1.0.64 → 1.0.66

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/dist/index.d.mts CHANGED
@@ -290,7 +290,75 @@ interface UploadFileResponse {
290
290
  status: string;
291
291
  result: {
292
292
  fileName: string;
293
+ /** No PUBLIC é a URL completa; no PRIVATE/LOADABLE é a chave relativa. Prefira `key`. */
293
294
  currentPath: string;
295
+ /**
296
+ * Chave relativa do objeto. No PRIVATE: `ai-files/private/{24 chars aleatórios}/nome` — não é
297
+ * adivinhável e dois uploads com o mesmo nome não se sobrescrevem. Guarde-a na tabela da
298
+ * aplicação, na linha do registro dono; é ela que a Server Function usa para liberar o
299
+ * arquivo. (Backends anteriores ao TKT-000a0394 não a enviam.)
300
+ */
301
+ key?: string;
302
+ publicUrl: string | null;
303
+ message: string;
304
+ };
305
+ }
306
+ interface DownloadFileOptions {
307
+ /** ID do projeto (opcional se já configurado via configureSdkMitra) */
308
+ projectId?: number;
309
+ /**
310
+ * Chave do arquivo: `result.key` do upload (`ai-files/private/{aleatório}/nome`, ou
311
+ * `ai-files/{public|loadable}/nome`). Também aceita `result.currentPath`, inclusive a URL
312
+ * pública de um upload PUBLIC do mesmo projeto. Chave fora dessas pastas é recusada com 400.
313
+ *
314
+ * Permissão: só usuário DEV do projeto ou Server Function em execução. Tela de usuário final
315
+ * NÃO chama isto — pede o anexo pelo registro a uma SF (ver README, "Anexos").
316
+ */
317
+ key: string;
318
+ }
319
+ interface FileLinkOptions {
320
+ /** ID do projeto (opcional se já configurado via configureSdkMitra) */
321
+ projectId?: number;
322
+ /** Chave do arquivo — mesma regra de `DownloadFileOptions.key` */
323
+ key: string;
324
+ /** Validade em segundos (padrão 300 no backend; máximo configurado no backend, 3600 por padrão) */
325
+ ttlSeconds?: number;
326
+ }
327
+ /**
328
+ * Sucesso: `{ status: "success", result }`. Erro: `{ status: "error", error: { code, message } }`
329
+ * com HTTP 400 (INVALID_KEY/MISSING_*), 403 (ACCESS_DENIED), 404 (FILE_NOT_FOUND), 500.
330
+ */
331
+ interface FileLinkResponse {
332
+ status: string;
333
+ result?: {
334
+ key: string;
335
+ /** URL assinada; vale até `expiresAt` */
336
+ url: string;
337
+ expiresAt: string;
338
+ expiresInSeconds: number;
339
+ };
340
+ error?: {
341
+ code: string;
342
+ message: string;
343
+ };
344
+ }
345
+ interface DeleteFileOptions {
346
+ /** ID do projeto (opcional se já configurado via configureSdkMitra) */
347
+ projectId?: number;
348
+ /** Chave do arquivo — mesma regra de `DownloadFileOptions.key`. Exclui exatamente um objeto. */
349
+ key: string;
350
+ }
351
+ /**
352
+ * Sucesso: `{ status: "success", result }`. Erro: `{ status: "error", error: { code, message } }`
353
+ * com code MISSING_KEY | INVALID_KEY | ACCESS_DENIED (usuário sem perfil DEV no projeto ou API key
354
+ * BUSINESS) | FILE_NOT_FOUND (nada apagado) | INTERNAL_ERROR.
355
+ */
356
+ interface DeleteFileResponse {
357
+ status: string;
358
+ result: {
359
+ fileName: string;
360
+ currentPath: string;
361
+ key?: string;
294
362
  publicUrl: string | null;
295
363
  message: string;
296
364
  };
@@ -892,7 +960,11 @@ interface MitraInstance {
892
960
  getPublicServerFunctionExecution(options: GetPublicServerFunctionExecutionOptions): Promise<GetPublicServerFunctionExecutionResponse>;
893
961
  stopServerFunctionExecution(options: StopServerFunctionExecutionOptions): Promise<StopServerFunctionExecutionResponse>;
894
962
  uploadFilePublic(options: UploadFileOptions): Promise<UploadFileResponse>;
963
+ uploadFilePrivate(options: UploadFileOptions): Promise<UploadFileResponse>;
895
964
  uploadFileLoadable(options: UploadFileOptions): Promise<UploadFileResponse>;
965
+ downloadFilePrivate(options: DownloadFileOptions): Promise<Blob>;
966
+ getFileLink(options: FileLinkOptions): Promise<FileLinkResponse>;
967
+ deleteFile(options: DeleteFileOptions): Promise<DeleteFileResponse>;
896
968
  listIntegrations(options?: ListIntegrationsOptions): Promise<IntegrationResponse[]>;
897
969
  callIntegration(options: CallIntegrationOptions): Promise<CallIntegrationResponse>;
898
970
  listRecords(options: ListRecordsOptions): Promise<ListRecordsResponse>;
@@ -1243,6 +1315,36 @@ declare function uploadFilePublicMitra(options: UploadFileOptions): Promise<Uplo
1243
1315
  * Faz upload de um arquivo para a pasta LOADABLE do projeto.
1244
1316
  */
1245
1317
  declare function uploadFileLoadableMitra(options: UploadFileOptions): Promise<UploadFileResponse>;
1318
+ /**
1319
+ * POST /interactions/uploadFilePrivate (multipart/form-data)
1320
+ * Faz upload de um arquivo para a pasta PRIVATE do projeto. O arquivo NAO fica publico
1321
+ * no S3 (sem ACL public-read) — este e o modo recomendado/padrao. O acesso e feito por
1322
+ * download autenticado; guarde `result.key` (a chave relativa) para baixar ou excluir depois.
1323
+ * `result.publicUrl` sempre vem `null` para upload privado. Privado e por PROJETO, nao por
1324
+ * usuario: qualquer usuario do projeto que conheca a chave consegue baixar.
1325
+ */
1326
+ declare function uploadFilePrivateMitra(options: UploadFileOptions): Promise<UploadFileResponse>;
1327
+ /**
1328
+ * GET /interactions/downloadFile
1329
+ * Baixa (com credencial) um arquivo do projeto e retorna o conteúdo como Blob.
1330
+ * `key` é a chave retornada no upload (`result.key`; `result.currentPath` também é aceito).
1331
+ * Permissão: usuário DEV do projeto ou Server Function em execução (403 para usuário final).
1332
+ */
1333
+ declare function downloadFilePrivateMitra(options: DownloadFileOptions): Promise<Blob>;
1334
+ /**
1335
+ * GET /interactions/fileLink
1336
+ * Link temporário (assinado) para um arquivo do projeto. Mesma permissão do download: DEV ou
1337
+ * Server Function em execução. Use quando precisar exibir muitas imagens numa tela de DEV ou em
1338
+ * ferramental; para usuário final, a SF é quem emite o link depois de validar o registro.
1339
+ */
1340
+ declare function getFileLinkMitra(options: FileLinkOptions): Promise<FileLinkResponse>;
1341
+ /**
1342
+ * DELETE /interactions/deleteFile
1343
+ * Exclui exatamente um arquivo do projeto pela `key` (`result.key` do upload).
1344
+ * Permissão: usuário DEV do projeto ou Server Function em execução (403 para usuário final);
1345
+ * chave inexistente devolve FILE_NOT_FOUND (HTTP 404).
1346
+ */
1347
+ declare function deleteFileMitra(options: DeleteFileOptions): Promise<DeleteFileResponse>;
1246
1348
  declare function listRecordsMitra(options: ListRecordsOptions): Promise<ListRecordsResponse>;
1247
1349
  declare function getRecordMitra(options: GetRecordOptions): Promise<Record<string, any>>;
1248
1350
  declare function createRecordMitra(options: CreateRecordOptions): Promise<Record<string, any>>;
@@ -1306,4 +1408,4 @@ declare function setProfileScreensMitra(options: SetProfileScreensOptions): Prom
1306
1408
  */
1307
1409
  declare function setProfileServerFunctionsMitra(options: SetProfileServerFunctionsOptions): Promise<SetProfilePermissionResponse>;
1308
1410
 
1309
- export { type AgentApiKeyTarget, type AgentAttachment, type AgentAttachmentType, type AgentAuthMeta, type AgentChat, type AgentDeltaEvent, type AgentErrorEvent, type AgentMessage, type AgentModelGroup, type AgentModelOption, type AgentProviderListItem, type AgentQueueChangeEvent, type AgentStatusChangeEvent, type AgentSubscriptionAccount, type AgentSubscriptionTarget, type AgentTaskCreatedEvent, type AgentTaskEventMap, type AgentTaskEventName, type AgentTaskSession, type AgentTaskStatus, type AgentToolEvent, type AgentTurnEndEvent, type AgentType, type AuthAgentCredentialOptions, type AuthAgentCredentialResult, type AuthClaudeResult, type AuthCodexResult, type AuthMethod, type CallIntegrationOptions, type CallIntegrationResponse, type ChatManageAction, type ConnectAgentCredentialOptions, type ConnectAgentSubscriptionResult, type ConnectableSubscriptionTarget, type CreateProfileOptions, type CreateProfileResponse, type CreateRecordOptions, type CreateRecordsBatchOptions, type CredentialAccessType, type CredentialAction, type CredentialTarget, type DeleteAgentChatResult, type DeleteProfileOptions, type DeleteProfileResponse, type DeleteRecordOptions, type EmailLoginOptions, type EmailResendCodeOptions, type EmailSignupOptions, type EmailVerifyCodeOptions, type ExecuteDataLoaderOptions, type ExecuteDataLoaderResponse, type ExecuteDbActionOptions, type ExecuteDbActionResponse, type ExecutePublicServerFunctionAsyncResponse, type ExecutePublicServerFunctionOptions, type ExecutePublicServerFunctionResponse, type ExecuteServerFunctionAsyncOptions, type ExecuteServerFunctionAsyncResponse, type ExecuteServerFunctionOptions, type ExecuteServerFunctionResponse, type GetAgentTaskCreateOptions, type GetAgentTaskOpenOptions, type GetAgentTaskOptions, type GetProfileDetailsOptions, type GetProfileDetailsResponse, type GetPublicServerFunctionExecutionOptions, type GetPublicServerFunctionExecutionResponse, type GetRecordOptions, type GetVariableOptions, type GetVariableResponse, type IntegrationResponse, type ListAgentModelsResult, type ListAgentProvidersResult, type ListIntegrationsOptions, type ListProfilesOptions, type ListProfilesResponse, type ListRecordsOptions, type ListRecordsResponse, type ListVariablesOptions, type ListVariablesResponse, type LoginOptions, type LoginResponse, type ManageAgentChatDeleteOptions, type ManageAgentChatListOptions, type ManageAgentChatOptions, type ManageAgentChatRenameOptions, type ManageAgentCredentialOptions, type ManageAgentCredentialResult, type MitraConfig, type MitraInstance, type PatchRecordOptions, type ProfileTableRef, type QueuedItem, type RenameAgentChatResult, type ResetPasswordOptions, type RunActionOptions, type RunActionResponse, type SendOptions, type SendPasswordResetCodeOptions, type SetFileStatusOptions, type SetFileStatusResponse, type SetProfileActionsOptions, type SetProfileDmlTablesOptions, type SetProfilePermissionResponse, type SetProfileScreensOptions, type SetProfileSelectTablesOptions, type SetProfileServerFunctionsOptions, type SetProfileUsersOptions, type SetVariableOptions, type SetVariableResponse, type StopServerFunctionExecutionOptions, type StopServerFunctionExecutionResponse, type UpdateProfileOptions, type UpdateProfileResponse, type UpdateRecordOptions, type UploadFileOptions, type UploadFileResponse, type ValidatePasswordResetCodeOptions, callIntegrationMitra, closeChatMitra, configureSdkMitra, createMitraInstance, createProfileMitra, createRecordMitra, createRecordsBatchMitra, deleteProfileMitra, deleteRecordMitra, emailLoginMitra, emailResendCodeMitra, emailSignupMitra, emailVerifyCodeMitra, executeDataLoaderMitra, executeDbActionMitra, executePublicServerFunctionAsyncMitra, executePublicServerFunctionMitra, executeServerFunctionAsyncMitra, executeServerFunctionMitra, getAgentTaskMitra, getConfig, getProfileDetailsMitra, getPublicServerFunctionExecutionMitra, getRecordMitra, getVariableMitra, listIntegrationsMitra, listProfilesMitra, listRecordsMitra, listVariablesMitra, loginMitra, loginWithEmailMitra, loginWithGoogleMitra, loginWithMicrosoftMitra, manageAgentChatMitra, manageAgentCredentialMitra, openChatMitra, patchRecordMitra, refreshTokenSilently, resetPasswordMitra, resolveProjectId, runActionMitra, sendPasswordResetCodeMitra, setFileStatusMitra, setProfileActionsMitra, setProfileDmlTablesMitra, setProfileScreensMitra, setProfileSelectTablesMitra, setProfileServerFunctionsMitra, setProfileUsersMitra, setVariableMitra, stopServerFunctionExecutionMitra, updateProfileMitra, updateRecordMitra, uploadFileLoadableMitra, uploadFilePublicMitra, validatePasswordResetCodeMitra };
1411
+ export { type AgentApiKeyTarget, type AgentAttachment, type AgentAttachmentType, type AgentAuthMeta, type AgentChat, type AgentDeltaEvent, type AgentErrorEvent, type AgentMessage, type AgentModelGroup, type AgentModelOption, type AgentProviderListItem, type AgentQueueChangeEvent, type AgentStatusChangeEvent, type AgentSubscriptionAccount, type AgentSubscriptionTarget, type AgentTaskCreatedEvent, type AgentTaskEventMap, type AgentTaskEventName, type AgentTaskSession, type AgentTaskStatus, type AgentToolEvent, type AgentTurnEndEvent, type AgentType, type AuthAgentCredentialOptions, type AuthAgentCredentialResult, type AuthClaudeResult, type AuthCodexResult, type AuthMethod, type CallIntegrationOptions, type CallIntegrationResponse, type ChatManageAction, type ConnectAgentCredentialOptions, type ConnectAgentSubscriptionResult, type ConnectableSubscriptionTarget, type CreateProfileOptions, type CreateProfileResponse, type CreateRecordOptions, type CreateRecordsBatchOptions, type CredentialAccessType, type CredentialAction, type CredentialTarget, type DeleteAgentChatResult, type DeleteFileOptions, type DeleteFileResponse, type DeleteProfileOptions, type DeleteProfileResponse, type DeleteRecordOptions, type DownloadFileOptions, type EmailLoginOptions, type EmailResendCodeOptions, type EmailSignupOptions, type EmailVerifyCodeOptions, type ExecuteDataLoaderOptions, type ExecuteDataLoaderResponse, type ExecuteDbActionOptions, type ExecuteDbActionResponse, type ExecutePublicServerFunctionAsyncResponse, type ExecutePublicServerFunctionOptions, type ExecutePublicServerFunctionResponse, type ExecuteServerFunctionAsyncOptions, type ExecuteServerFunctionAsyncResponse, type ExecuteServerFunctionOptions, type ExecuteServerFunctionResponse, type FileLinkOptions, type FileLinkResponse, type GetAgentTaskCreateOptions, type GetAgentTaskOpenOptions, type GetAgentTaskOptions, type GetProfileDetailsOptions, type GetProfileDetailsResponse, type GetPublicServerFunctionExecutionOptions, type GetPublicServerFunctionExecutionResponse, type GetRecordOptions, type GetVariableOptions, type GetVariableResponse, type IntegrationResponse, type ListAgentModelsResult, type ListAgentProvidersResult, type ListIntegrationsOptions, type ListProfilesOptions, type ListProfilesResponse, type ListRecordsOptions, type ListRecordsResponse, type ListVariablesOptions, type ListVariablesResponse, type LoginOptions, type LoginResponse, type ManageAgentChatDeleteOptions, type ManageAgentChatListOptions, type ManageAgentChatOptions, type ManageAgentChatRenameOptions, type ManageAgentCredentialOptions, type ManageAgentCredentialResult, type MitraConfig, type MitraInstance, type PatchRecordOptions, type ProfileTableRef, type QueuedItem, type RenameAgentChatResult, type ResetPasswordOptions, type RunActionOptions, type RunActionResponse, type SendOptions, type SendPasswordResetCodeOptions, type SetFileStatusOptions, type SetFileStatusResponse, type SetProfileActionsOptions, type SetProfileDmlTablesOptions, type SetProfilePermissionResponse, type SetProfileScreensOptions, type SetProfileSelectTablesOptions, type SetProfileServerFunctionsOptions, type SetProfileUsersOptions, type SetVariableOptions, type SetVariableResponse, type StopServerFunctionExecutionOptions, type StopServerFunctionExecutionResponse, type UpdateProfileOptions, type UpdateProfileResponse, type UpdateRecordOptions, type UploadFileOptions, type UploadFileResponse, type ValidatePasswordResetCodeOptions, callIntegrationMitra, closeChatMitra, configureSdkMitra, createMitraInstance, createProfileMitra, createRecordMitra, createRecordsBatchMitra, deleteFileMitra, deleteProfileMitra, deleteRecordMitra, downloadFilePrivateMitra, emailLoginMitra, emailResendCodeMitra, emailSignupMitra, emailVerifyCodeMitra, executeDataLoaderMitra, executeDbActionMitra, executePublicServerFunctionAsyncMitra, executePublicServerFunctionMitra, executeServerFunctionAsyncMitra, executeServerFunctionMitra, getAgentTaskMitra, getConfig, getFileLinkMitra, getProfileDetailsMitra, getPublicServerFunctionExecutionMitra, getRecordMitra, getVariableMitra, listIntegrationsMitra, listProfilesMitra, listRecordsMitra, listVariablesMitra, loginMitra, loginWithEmailMitra, loginWithGoogleMitra, loginWithMicrosoftMitra, manageAgentChatMitra, manageAgentCredentialMitra, openChatMitra, patchRecordMitra, refreshTokenSilently, resetPasswordMitra, resolveProjectId, runActionMitra, sendPasswordResetCodeMitra, setFileStatusMitra, setProfileActionsMitra, setProfileDmlTablesMitra, setProfileScreensMitra, setProfileSelectTablesMitra, setProfileServerFunctionsMitra, setProfileUsersMitra, setVariableMitra, stopServerFunctionExecutionMitra, updateProfileMitra, updateRecordMitra, uploadFileLoadableMitra, uploadFilePrivateMitra, uploadFilePublicMitra, validatePasswordResetCodeMitra };
package/dist/index.d.ts CHANGED
@@ -290,7 +290,75 @@ interface UploadFileResponse {
290
290
  status: string;
291
291
  result: {
292
292
  fileName: string;
293
+ /** No PUBLIC é a URL completa; no PRIVATE/LOADABLE é a chave relativa. Prefira `key`. */
293
294
  currentPath: string;
295
+ /**
296
+ * Chave relativa do objeto. No PRIVATE: `ai-files/private/{24 chars aleatórios}/nome` — não é
297
+ * adivinhável e dois uploads com o mesmo nome não se sobrescrevem. Guarde-a na tabela da
298
+ * aplicação, na linha do registro dono; é ela que a Server Function usa para liberar o
299
+ * arquivo. (Backends anteriores ao TKT-000a0394 não a enviam.)
300
+ */
301
+ key?: string;
302
+ publicUrl: string | null;
303
+ message: string;
304
+ };
305
+ }
306
+ interface DownloadFileOptions {
307
+ /** ID do projeto (opcional se já configurado via configureSdkMitra) */
308
+ projectId?: number;
309
+ /**
310
+ * Chave do arquivo: `result.key` do upload (`ai-files/private/{aleatório}/nome`, ou
311
+ * `ai-files/{public|loadable}/nome`). Também aceita `result.currentPath`, inclusive a URL
312
+ * pública de um upload PUBLIC do mesmo projeto. Chave fora dessas pastas é recusada com 400.
313
+ *
314
+ * Permissão: só usuário DEV do projeto ou Server Function em execução. Tela de usuário final
315
+ * NÃO chama isto — pede o anexo pelo registro a uma SF (ver README, "Anexos").
316
+ */
317
+ key: string;
318
+ }
319
+ interface FileLinkOptions {
320
+ /** ID do projeto (opcional se já configurado via configureSdkMitra) */
321
+ projectId?: number;
322
+ /** Chave do arquivo — mesma regra de `DownloadFileOptions.key` */
323
+ key: string;
324
+ /** Validade em segundos (padrão 300 no backend; máximo configurado no backend, 3600 por padrão) */
325
+ ttlSeconds?: number;
326
+ }
327
+ /**
328
+ * Sucesso: `{ status: "success", result }`. Erro: `{ status: "error", error: { code, message } }`
329
+ * com HTTP 400 (INVALID_KEY/MISSING_*), 403 (ACCESS_DENIED), 404 (FILE_NOT_FOUND), 500.
330
+ */
331
+ interface FileLinkResponse {
332
+ status: string;
333
+ result?: {
334
+ key: string;
335
+ /** URL assinada; vale até `expiresAt` */
336
+ url: string;
337
+ expiresAt: string;
338
+ expiresInSeconds: number;
339
+ };
340
+ error?: {
341
+ code: string;
342
+ message: string;
343
+ };
344
+ }
345
+ interface DeleteFileOptions {
346
+ /** ID do projeto (opcional se já configurado via configureSdkMitra) */
347
+ projectId?: number;
348
+ /** Chave do arquivo — mesma regra de `DownloadFileOptions.key`. Exclui exatamente um objeto. */
349
+ key: string;
350
+ }
351
+ /**
352
+ * Sucesso: `{ status: "success", result }`. Erro: `{ status: "error", error: { code, message } }`
353
+ * com code MISSING_KEY | INVALID_KEY | ACCESS_DENIED (usuário sem perfil DEV no projeto ou API key
354
+ * BUSINESS) | FILE_NOT_FOUND (nada apagado) | INTERNAL_ERROR.
355
+ */
356
+ interface DeleteFileResponse {
357
+ status: string;
358
+ result: {
359
+ fileName: string;
360
+ currentPath: string;
361
+ key?: string;
294
362
  publicUrl: string | null;
295
363
  message: string;
296
364
  };
@@ -892,7 +960,11 @@ interface MitraInstance {
892
960
  getPublicServerFunctionExecution(options: GetPublicServerFunctionExecutionOptions): Promise<GetPublicServerFunctionExecutionResponse>;
893
961
  stopServerFunctionExecution(options: StopServerFunctionExecutionOptions): Promise<StopServerFunctionExecutionResponse>;
894
962
  uploadFilePublic(options: UploadFileOptions): Promise<UploadFileResponse>;
963
+ uploadFilePrivate(options: UploadFileOptions): Promise<UploadFileResponse>;
895
964
  uploadFileLoadable(options: UploadFileOptions): Promise<UploadFileResponse>;
965
+ downloadFilePrivate(options: DownloadFileOptions): Promise<Blob>;
966
+ getFileLink(options: FileLinkOptions): Promise<FileLinkResponse>;
967
+ deleteFile(options: DeleteFileOptions): Promise<DeleteFileResponse>;
896
968
  listIntegrations(options?: ListIntegrationsOptions): Promise<IntegrationResponse[]>;
897
969
  callIntegration(options: CallIntegrationOptions): Promise<CallIntegrationResponse>;
898
970
  listRecords(options: ListRecordsOptions): Promise<ListRecordsResponse>;
@@ -1243,6 +1315,36 @@ declare function uploadFilePublicMitra(options: UploadFileOptions): Promise<Uplo
1243
1315
  * Faz upload de um arquivo para a pasta LOADABLE do projeto.
1244
1316
  */
1245
1317
  declare function uploadFileLoadableMitra(options: UploadFileOptions): Promise<UploadFileResponse>;
1318
+ /**
1319
+ * POST /interactions/uploadFilePrivate (multipart/form-data)
1320
+ * Faz upload de um arquivo para a pasta PRIVATE do projeto. O arquivo NAO fica publico
1321
+ * no S3 (sem ACL public-read) — este e o modo recomendado/padrao. O acesso e feito por
1322
+ * download autenticado; guarde `result.key` (a chave relativa) para baixar ou excluir depois.
1323
+ * `result.publicUrl` sempre vem `null` para upload privado. Privado e por PROJETO, nao por
1324
+ * usuario: qualquer usuario do projeto que conheca a chave consegue baixar.
1325
+ */
1326
+ declare function uploadFilePrivateMitra(options: UploadFileOptions): Promise<UploadFileResponse>;
1327
+ /**
1328
+ * GET /interactions/downloadFile
1329
+ * Baixa (com credencial) um arquivo do projeto e retorna o conteúdo como Blob.
1330
+ * `key` é a chave retornada no upload (`result.key`; `result.currentPath` também é aceito).
1331
+ * Permissão: usuário DEV do projeto ou Server Function em execução (403 para usuário final).
1332
+ */
1333
+ declare function downloadFilePrivateMitra(options: DownloadFileOptions): Promise<Blob>;
1334
+ /**
1335
+ * GET /interactions/fileLink
1336
+ * Link temporário (assinado) para um arquivo do projeto. Mesma permissão do download: DEV ou
1337
+ * Server Function em execução. Use quando precisar exibir muitas imagens numa tela de DEV ou em
1338
+ * ferramental; para usuário final, a SF é quem emite o link depois de validar o registro.
1339
+ */
1340
+ declare function getFileLinkMitra(options: FileLinkOptions): Promise<FileLinkResponse>;
1341
+ /**
1342
+ * DELETE /interactions/deleteFile
1343
+ * Exclui exatamente um arquivo do projeto pela `key` (`result.key` do upload).
1344
+ * Permissão: usuário DEV do projeto ou Server Function em execução (403 para usuário final);
1345
+ * chave inexistente devolve FILE_NOT_FOUND (HTTP 404).
1346
+ */
1347
+ declare function deleteFileMitra(options: DeleteFileOptions): Promise<DeleteFileResponse>;
1246
1348
  declare function listRecordsMitra(options: ListRecordsOptions): Promise<ListRecordsResponse>;
1247
1349
  declare function getRecordMitra(options: GetRecordOptions): Promise<Record<string, any>>;
1248
1350
  declare function createRecordMitra(options: CreateRecordOptions): Promise<Record<string, any>>;
@@ -1306,4 +1408,4 @@ declare function setProfileScreensMitra(options: SetProfileScreensOptions): Prom
1306
1408
  */
1307
1409
  declare function setProfileServerFunctionsMitra(options: SetProfileServerFunctionsOptions): Promise<SetProfilePermissionResponse>;
1308
1410
 
1309
- export { type AgentApiKeyTarget, type AgentAttachment, type AgentAttachmentType, type AgentAuthMeta, type AgentChat, type AgentDeltaEvent, type AgentErrorEvent, type AgentMessage, type AgentModelGroup, type AgentModelOption, type AgentProviderListItem, type AgentQueueChangeEvent, type AgentStatusChangeEvent, type AgentSubscriptionAccount, type AgentSubscriptionTarget, type AgentTaskCreatedEvent, type AgentTaskEventMap, type AgentTaskEventName, type AgentTaskSession, type AgentTaskStatus, type AgentToolEvent, type AgentTurnEndEvent, type AgentType, type AuthAgentCredentialOptions, type AuthAgentCredentialResult, type AuthClaudeResult, type AuthCodexResult, type AuthMethod, type CallIntegrationOptions, type CallIntegrationResponse, type ChatManageAction, type ConnectAgentCredentialOptions, type ConnectAgentSubscriptionResult, type ConnectableSubscriptionTarget, type CreateProfileOptions, type CreateProfileResponse, type CreateRecordOptions, type CreateRecordsBatchOptions, type CredentialAccessType, type CredentialAction, type CredentialTarget, type DeleteAgentChatResult, type DeleteProfileOptions, type DeleteProfileResponse, type DeleteRecordOptions, type EmailLoginOptions, type EmailResendCodeOptions, type EmailSignupOptions, type EmailVerifyCodeOptions, type ExecuteDataLoaderOptions, type ExecuteDataLoaderResponse, type ExecuteDbActionOptions, type ExecuteDbActionResponse, type ExecutePublicServerFunctionAsyncResponse, type ExecutePublicServerFunctionOptions, type ExecutePublicServerFunctionResponse, type ExecuteServerFunctionAsyncOptions, type ExecuteServerFunctionAsyncResponse, type ExecuteServerFunctionOptions, type ExecuteServerFunctionResponse, type GetAgentTaskCreateOptions, type GetAgentTaskOpenOptions, type GetAgentTaskOptions, type GetProfileDetailsOptions, type GetProfileDetailsResponse, type GetPublicServerFunctionExecutionOptions, type GetPublicServerFunctionExecutionResponse, type GetRecordOptions, type GetVariableOptions, type GetVariableResponse, type IntegrationResponse, type ListAgentModelsResult, type ListAgentProvidersResult, type ListIntegrationsOptions, type ListProfilesOptions, type ListProfilesResponse, type ListRecordsOptions, type ListRecordsResponse, type ListVariablesOptions, type ListVariablesResponse, type LoginOptions, type LoginResponse, type ManageAgentChatDeleteOptions, type ManageAgentChatListOptions, type ManageAgentChatOptions, type ManageAgentChatRenameOptions, type ManageAgentCredentialOptions, type ManageAgentCredentialResult, type MitraConfig, type MitraInstance, type PatchRecordOptions, type ProfileTableRef, type QueuedItem, type RenameAgentChatResult, type ResetPasswordOptions, type RunActionOptions, type RunActionResponse, type SendOptions, type SendPasswordResetCodeOptions, type SetFileStatusOptions, type SetFileStatusResponse, type SetProfileActionsOptions, type SetProfileDmlTablesOptions, type SetProfilePermissionResponse, type SetProfileScreensOptions, type SetProfileSelectTablesOptions, type SetProfileServerFunctionsOptions, type SetProfileUsersOptions, type SetVariableOptions, type SetVariableResponse, type StopServerFunctionExecutionOptions, type StopServerFunctionExecutionResponse, type UpdateProfileOptions, type UpdateProfileResponse, type UpdateRecordOptions, type UploadFileOptions, type UploadFileResponse, type ValidatePasswordResetCodeOptions, callIntegrationMitra, closeChatMitra, configureSdkMitra, createMitraInstance, createProfileMitra, createRecordMitra, createRecordsBatchMitra, deleteProfileMitra, deleteRecordMitra, emailLoginMitra, emailResendCodeMitra, emailSignupMitra, emailVerifyCodeMitra, executeDataLoaderMitra, executeDbActionMitra, executePublicServerFunctionAsyncMitra, executePublicServerFunctionMitra, executeServerFunctionAsyncMitra, executeServerFunctionMitra, getAgentTaskMitra, getConfig, getProfileDetailsMitra, getPublicServerFunctionExecutionMitra, getRecordMitra, getVariableMitra, listIntegrationsMitra, listProfilesMitra, listRecordsMitra, listVariablesMitra, loginMitra, loginWithEmailMitra, loginWithGoogleMitra, loginWithMicrosoftMitra, manageAgentChatMitra, manageAgentCredentialMitra, openChatMitra, patchRecordMitra, refreshTokenSilently, resetPasswordMitra, resolveProjectId, runActionMitra, sendPasswordResetCodeMitra, setFileStatusMitra, setProfileActionsMitra, setProfileDmlTablesMitra, setProfileScreensMitra, setProfileSelectTablesMitra, setProfileServerFunctionsMitra, setProfileUsersMitra, setVariableMitra, stopServerFunctionExecutionMitra, updateProfileMitra, updateRecordMitra, uploadFileLoadableMitra, uploadFilePublicMitra, validatePasswordResetCodeMitra };
1411
+ export { type AgentApiKeyTarget, type AgentAttachment, type AgentAttachmentType, type AgentAuthMeta, type AgentChat, type AgentDeltaEvent, type AgentErrorEvent, type AgentMessage, type AgentModelGroup, type AgentModelOption, type AgentProviderListItem, type AgentQueueChangeEvent, type AgentStatusChangeEvent, type AgentSubscriptionAccount, type AgentSubscriptionTarget, type AgentTaskCreatedEvent, type AgentTaskEventMap, type AgentTaskEventName, type AgentTaskSession, type AgentTaskStatus, type AgentToolEvent, type AgentTurnEndEvent, type AgentType, type AuthAgentCredentialOptions, type AuthAgentCredentialResult, type AuthClaudeResult, type AuthCodexResult, type AuthMethod, type CallIntegrationOptions, type CallIntegrationResponse, type ChatManageAction, type ConnectAgentCredentialOptions, type ConnectAgentSubscriptionResult, type ConnectableSubscriptionTarget, type CreateProfileOptions, type CreateProfileResponse, type CreateRecordOptions, type CreateRecordsBatchOptions, type CredentialAccessType, type CredentialAction, type CredentialTarget, type DeleteAgentChatResult, type DeleteFileOptions, type DeleteFileResponse, type DeleteProfileOptions, type DeleteProfileResponse, type DeleteRecordOptions, type DownloadFileOptions, type EmailLoginOptions, type EmailResendCodeOptions, type EmailSignupOptions, type EmailVerifyCodeOptions, type ExecuteDataLoaderOptions, type ExecuteDataLoaderResponse, type ExecuteDbActionOptions, type ExecuteDbActionResponse, type ExecutePublicServerFunctionAsyncResponse, type ExecutePublicServerFunctionOptions, type ExecutePublicServerFunctionResponse, type ExecuteServerFunctionAsyncOptions, type ExecuteServerFunctionAsyncResponse, type ExecuteServerFunctionOptions, type ExecuteServerFunctionResponse, type FileLinkOptions, type FileLinkResponse, type GetAgentTaskCreateOptions, type GetAgentTaskOpenOptions, type GetAgentTaskOptions, type GetProfileDetailsOptions, type GetProfileDetailsResponse, type GetPublicServerFunctionExecutionOptions, type GetPublicServerFunctionExecutionResponse, type GetRecordOptions, type GetVariableOptions, type GetVariableResponse, type IntegrationResponse, type ListAgentModelsResult, type ListAgentProvidersResult, type ListIntegrationsOptions, type ListProfilesOptions, type ListProfilesResponse, type ListRecordsOptions, type ListRecordsResponse, type ListVariablesOptions, type ListVariablesResponse, type LoginOptions, type LoginResponse, type ManageAgentChatDeleteOptions, type ManageAgentChatListOptions, type ManageAgentChatOptions, type ManageAgentChatRenameOptions, type ManageAgentCredentialOptions, type ManageAgentCredentialResult, type MitraConfig, type MitraInstance, type PatchRecordOptions, type ProfileTableRef, type QueuedItem, type RenameAgentChatResult, type ResetPasswordOptions, type RunActionOptions, type RunActionResponse, type SendOptions, type SendPasswordResetCodeOptions, type SetFileStatusOptions, type SetFileStatusResponse, type SetProfileActionsOptions, type SetProfileDmlTablesOptions, type SetProfilePermissionResponse, type SetProfileScreensOptions, type SetProfileSelectTablesOptions, type SetProfileServerFunctionsOptions, type SetProfileUsersOptions, type SetVariableOptions, type SetVariableResponse, type StopServerFunctionExecutionOptions, type StopServerFunctionExecutionResponse, type UpdateProfileOptions, type UpdateProfileResponse, type UpdateRecordOptions, type UploadFileOptions, type UploadFileResponse, type ValidatePasswordResetCodeOptions, callIntegrationMitra, closeChatMitra, configureSdkMitra, createMitraInstance, createProfileMitra, createRecordMitra, createRecordsBatchMitra, deleteFileMitra, deleteProfileMitra, deleteRecordMitra, downloadFilePrivateMitra, emailLoginMitra, emailResendCodeMitra, emailSignupMitra, emailVerifyCodeMitra, executeDataLoaderMitra, executeDbActionMitra, executePublicServerFunctionAsyncMitra, executePublicServerFunctionMitra, executeServerFunctionAsyncMitra, executeServerFunctionMitra, getAgentTaskMitra, getConfig, getFileLinkMitra, getProfileDetailsMitra, getPublicServerFunctionExecutionMitra, getRecordMitra, getVariableMitra, listIntegrationsMitra, listProfilesMitra, listRecordsMitra, listVariablesMitra, loginMitra, loginWithEmailMitra, loginWithGoogleMitra, loginWithMicrosoftMitra, manageAgentChatMitra, manageAgentCredentialMitra, openChatMitra, patchRecordMitra, refreshTokenSilently, resetPasswordMitra, resolveProjectId, runActionMitra, sendPasswordResetCodeMitra, setFileStatusMitra, setProfileActionsMitra, setProfileDmlTablesMitra, setProfileScreensMitra, setProfileSelectTablesMitra, setProfileServerFunctionsMitra, setProfileUsersMitra, setVariableMitra, stopServerFunctionExecutionMitra, updateProfileMitra, updateRecordMitra, uploadFileLoadableMitra, uploadFilePrivateMitra, uploadFilePublicMitra, validatePasswordResetCodeMitra };
package/dist/index.js CHANGED
@@ -486,6 +486,34 @@ var http = {
486
486
  headers,
487
487
  body: formData
488
488
  });
489
+ },
490
+ // Download binário (Blob). Usado para baixar arquivos privados com credencial,
491
+ // já que a resposta não é JSON. Mesma lógica de refresh-on-403 do fetchWithRefresh.
492
+ async download(endpoint, params) {
493
+ const fetchFn = getFetch2();
494
+ const url = buildUrl(endpoint, params);
495
+ let response = await fetchFn(url, { method: "GET", headers: buildHeaders() });
496
+ if (response.status === 403) {
497
+ const refreshed = await tryRefreshToken();
498
+ if (refreshed) {
499
+ response = await fetchFn(url, { method: "GET", headers: buildHeaders() });
500
+ }
501
+ }
502
+ if (!response.ok) {
503
+ const text = await response.text();
504
+ let data = null;
505
+ try {
506
+ data = text ? JSON.parse(text) : null;
507
+ } catch (e) {
508
+ }
509
+ const base = (data == null ? void 0 : data.message) || (data == null ? void 0 : data.error) || `HTTP ${response.status}`;
510
+ throw {
511
+ message: (data == null ? void 0 : data.hint) ? `${base} \u2014 ${data.hint}` : base,
512
+ status: response.status,
513
+ details: data
514
+ };
515
+ }
516
+ return response.blob();
489
517
  }
490
518
  };
491
519
  async function requestWithTenant(method, endpoint, tenantId, options) {
@@ -683,6 +711,32 @@ async function uploadFileLoadableMitra(options) {
683
711
  if (options.debug !== void 0) formData.append("debug", String(options.debug));
684
712
  return http.upload("/interactions/uploadFileLoadable", formData);
685
713
  }
714
+ async function uploadFilePrivateMitra(options) {
715
+ const formData = new FormData();
716
+ formData.append("file", options.file);
717
+ formData.append("projectId", String(resolveProjectId2(options.projectId)));
718
+ if (options.debug !== void 0) formData.append("debug", String(options.debug));
719
+ return http.upload("/interactions/uploadFilePrivate", formData);
720
+ }
721
+ async function downloadFilePrivateMitra(options) {
722
+ return http.download("/interactions/downloadFile", {
723
+ projectId: resolveProjectId2(options.projectId),
724
+ key: options.key
725
+ });
726
+ }
727
+ async function getFileLinkMitra(options) {
728
+ return http.get("/interactions/fileLink", {
729
+ projectId: resolveProjectId2(options.projectId),
730
+ key: options.key,
731
+ ...options.ttlSeconds !== void 0 ? { ttlSeconds: options.ttlSeconds } : {}
732
+ });
733
+ }
734
+ async function deleteFileMitra(options) {
735
+ return http.del("/interactions/deleteFile", {
736
+ projectId: resolveProjectId2(options.projectId),
737
+ key: options.key
738
+ });
739
+ }
686
740
  async function listRecordsMitra(options) {
687
741
  const { tableName, page, size, filters, jdbcConnectionConfigId } = options;
688
742
  const pid = resolveProjectId2(options.projectId);
@@ -1871,6 +1925,30 @@ function createMitraInstance(initialConfig) {
1871
1925
  body: formData
1872
1926
  });
1873
1927
  }
1928
+ async function requestDownload(endpoint, params) {
1929
+ let url = `${_config.baseURL}${endpoint}`;
1930
+ if (params) {
1931
+ const q = buildQuery(params);
1932
+ if (q) url += `?${q}`;
1933
+ }
1934
+ const fetchFn = getFetch3();
1935
+ let response = await fetchFn(url, { method: "GET", headers: authHeaders() });
1936
+ if (response.status === 403) {
1937
+ const refreshed = await tryRefreshToken2();
1938
+ if (refreshed) response = await fetchFn(url, { method: "GET", headers: authHeaders() });
1939
+ }
1940
+ if (!response.ok) {
1941
+ const text = await response.text();
1942
+ let data = null;
1943
+ try {
1944
+ data = text ? JSON.parse(text) : null;
1945
+ } catch (e) {
1946
+ }
1947
+ const base = (data == null ? void 0 : data.message) || (data == null ? void 0 : data.error) || `HTTP ${response.status}`;
1948
+ throw { message: (data == null ? void 0 : data.hint) ? `${base} \u2014 ${data.hint}` : base, status: response.status, details: data };
1949
+ }
1950
+ return response.blob();
1951
+ }
1874
1952
  async function requestTenant(method, endpoint, tenantId, opts) {
1875
1953
  let url = `${_config.baseURL}${endpoint}`;
1876
1954
  if (opts == null ? void 0 : opts.params) {
@@ -1978,6 +2056,13 @@ function createMitraInstance(initialConfig) {
1978
2056
  if (options.debug !== void 0) formData.append("debug", String(options.debug));
1979
2057
  return requestUpload("/interactions/uploadFilePublic", formData);
1980
2058
  },
2059
+ async uploadFilePrivate(options) {
2060
+ const formData = new FormData();
2061
+ formData.append("file", options.file);
2062
+ formData.append("projectId", String(resolveProjectId4(options.projectId)));
2063
+ if (options.debug !== void 0) formData.append("debug", String(options.debug));
2064
+ return requestUpload("/interactions/uploadFilePrivate", formData);
2065
+ },
1981
2066
  async uploadFileLoadable(options) {
1982
2067
  const formData = new FormData();
1983
2068
  formData.append("file", options.file);
@@ -1985,6 +2070,26 @@ function createMitraInstance(initialConfig) {
1985
2070
  if (options.debug !== void 0) formData.append("debug", String(options.debug));
1986
2071
  return requestUpload("/interactions/uploadFileLoadable", formData);
1987
2072
  },
2073
+ async downloadFilePrivate(options) {
2074
+ return requestDownload("/interactions/downloadFile", {
2075
+ projectId: resolveProjectId4(options.projectId),
2076
+ key: options.key
2077
+ });
2078
+ },
2079
+ async getFileLink(options) {
2080
+ return request("GET", "/interactions/fileLink", {
2081
+ params: {
2082
+ projectId: resolveProjectId4(options.projectId),
2083
+ key: options.key,
2084
+ ...options.ttlSeconds !== void 0 ? { ttlSeconds: options.ttlSeconds } : {}
2085
+ }
2086
+ });
2087
+ },
2088
+ async deleteFile(options) {
2089
+ return request("DELETE", "/interactions/deleteFile", {
2090
+ params: { projectId: resolveProjectId4(options.projectId), key: options.key }
2091
+ });
2092
+ },
1988
2093
  // Integrations
1989
2094
  async listIntegrations(options = {}) {
1990
2095
  return request("GET", "/interactions/integrations", { params: { projectId: resolveProjectId4(options.projectId) } });
@@ -2212,8 +2317,10 @@ exports.createMitraInstance = createMitraInstance;
2212
2317
  exports.createProfileMitra = createProfileMitra;
2213
2318
  exports.createRecordMitra = createRecordMitra;
2214
2319
  exports.createRecordsBatchMitra = createRecordsBatchMitra;
2320
+ exports.deleteFileMitra = deleteFileMitra;
2215
2321
  exports.deleteProfileMitra = deleteProfileMitra;
2216
2322
  exports.deleteRecordMitra = deleteRecordMitra;
2323
+ exports.downloadFilePrivateMitra = downloadFilePrivateMitra;
2217
2324
  exports.emailLoginMitra = emailLoginMitra;
2218
2325
  exports.emailResendCodeMitra = emailResendCodeMitra;
2219
2326
  exports.emailSignupMitra = emailSignupMitra;
@@ -2226,6 +2333,7 @@ exports.executeServerFunctionAsyncMitra = executeServerFunctionAsyncMitra;
2226
2333
  exports.executeServerFunctionMitra = executeServerFunctionMitra;
2227
2334
  exports.getAgentTaskMitra = getAgentTaskMitra;
2228
2335
  exports.getConfig = getConfig;
2336
+ exports.getFileLinkMitra = getFileLinkMitra;
2229
2337
  exports.getProfileDetailsMitra = getProfileDetailsMitra;
2230
2338
  exports.getPublicServerFunctionExecutionMitra = getPublicServerFunctionExecutionMitra;
2231
2339
  exports.getRecordMitra = getRecordMitra;
@@ -2259,6 +2367,7 @@ exports.stopServerFunctionExecutionMitra = stopServerFunctionExecutionMitra;
2259
2367
  exports.updateProfileMitra = updateProfileMitra;
2260
2368
  exports.updateRecordMitra = updateRecordMitra;
2261
2369
  exports.uploadFileLoadableMitra = uploadFileLoadableMitra;
2370
+ exports.uploadFilePrivateMitra = uploadFilePrivateMitra;
2262
2371
  exports.uploadFilePublicMitra = uploadFilePublicMitra;
2263
2372
  exports.validatePasswordResetCodeMitra = validatePasswordResetCodeMitra;
2264
2373
  //# sourceMappingURL=index.js.map