mitra-interactions-sdk 1.0.56-beta.0 → 1.0.56-beta.1
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 +52 -1
- package/dist/index.d.ts +52 -1
- package/dist/index.js +97 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +95 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -67,6 +67,30 @@ interface EmailResendCodeOptions {
|
|
|
67
67
|
/** Email do usuário */
|
|
68
68
|
email: string;
|
|
69
69
|
}
|
|
70
|
+
interface SendPasswordResetCodeOptions {
|
|
71
|
+
/** Email do usuário que esqueceu a senha */
|
|
72
|
+
email: string;
|
|
73
|
+
/** URL da página de auth (opcional — usado pra derivar a API base). Default: do config global. */
|
|
74
|
+
authUrl?: string;
|
|
75
|
+
/** Override explícito da API base (ex: https://api0.mitraecp.com:1005). Default: derivado do authUrl. */
|
|
76
|
+
authApiURL?: string;
|
|
77
|
+
}
|
|
78
|
+
interface ValidatePasswordResetCodeOptions {
|
|
79
|
+
email: string;
|
|
80
|
+
/** Código de 6 dígitos recebido por email */
|
|
81
|
+
code: string;
|
|
82
|
+
authUrl?: string;
|
|
83
|
+
authApiURL?: string;
|
|
84
|
+
}
|
|
85
|
+
interface ResetPasswordOptions {
|
|
86
|
+
email: string;
|
|
87
|
+
/** Código de 6 dígitos recebido por email */
|
|
88
|
+
code: string;
|
|
89
|
+
/** Nova senha */
|
|
90
|
+
newPassword: string;
|
|
91
|
+
authUrl?: string;
|
|
92
|
+
authApiURL?: string;
|
|
93
|
+
}
|
|
70
94
|
interface ExecuteDataLoaderOptions {
|
|
71
95
|
projectId?: number | string;
|
|
72
96
|
dataLoaderId: number | string;
|
|
@@ -537,6 +561,9 @@ interface MitraInstance {
|
|
|
537
561
|
setProfileActions(options: SetProfileActionsOptions): Promise<SetProfilePermissionResponse>;
|
|
538
562
|
setProfileScreens(options: SetProfileScreensOptions): Promise<SetProfilePermissionResponse>;
|
|
539
563
|
setProfileServerFunctions(options: SetProfileServerFunctionsOptions): Promise<SetProfilePermissionResponse>;
|
|
564
|
+
sendPasswordResetCode(options: SendPasswordResetCodeOptions): Promise<Record<string, unknown>>;
|
|
565
|
+
validatePasswordResetCode(options: ValidatePasswordResetCodeOptions): Promise<Record<string, unknown>>;
|
|
566
|
+
resetPassword(options: ResetPasswordOptions): Promise<Record<string, unknown>>;
|
|
540
567
|
openChat(): void;
|
|
541
568
|
closeChat(): void;
|
|
542
569
|
}
|
|
@@ -607,6 +634,30 @@ declare function emailVerifyCodeMitra(options: EmailVerifyCodeOptions): Promise<
|
|
|
607
634
|
declare function emailResendCodeMitra(options: EmailResendCodeOptions): Promise<void>;
|
|
608
635
|
declare function refreshTokenSilently(authUrl: string, projectId: number | string): Promise<LoginResponse>;
|
|
609
636
|
|
|
637
|
+
/**
|
|
638
|
+
* Mitra Interactions SDK - Password Reset (legacy backend)
|
|
639
|
+
*
|
|
640
|
+
* Endpoints públicos (sem auth) para fluxo de "esqueci minha senha".
|
|
641
|
+
* Usa um backend separado (porta 1005 ou 4133 dependendo do ambiente),
|
|
642
|
+
* resolvido a partir do `authUrl` configurado.
|
|
643
|
+
*/
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* POST /mitraspace/auth/resetPassword
|
|
647
|
+
* Envia um código de verificação por email para iniciar o fluxo de reset de senha.
|
|
648
|
+
*/
|
|
649
|
+
declare function sendPasswordResetCodeMitra(options: SendPasswordResetCodeOptions): Promise<Record<string, unknown>>;
|
|
650
|
+
/**
|
|
651
|
+
* POST /mitraspace/auth/resetPassword/validateCode
|
|
652
|
+
* Valida o código recebido por email (sem trocar a senha ainda).
|
|
653
|
+
*/
|
|
654
|
+
declare function validatePasswordResetCodeMitra(options: ValidatePasswordResetCodeOptions): Promise<Record<string, unknown>>;
|
|
655
|
+
/**
|
|
656
|
+
* PUT /mitraspace/auth/resetPassword
|
|
657
|
+
* Troca a senha usando email + código + nova senha.
|
|
658
|
+
*/
|
|
659
|
+
declare function resetPasswordMitra(options: ResetPasswordOptions): Promise<Record<string, unknown>>;
|
|
660
|
+
|
|
610
661
|
/**
|
|
611
662
|
* Mitra Interactions SDK - Services
|
|
612
663
|
*/
|
|
@@ -762,4 +813,4 @@ declare function setProfileScreensMitra(options: SetProfileScreensOptions): Prom
|
|
|
762
813
|
*/
|
|
763
814
|
declare function setProfileServerFunctionsMitra(options: SetProfileServerFunctionsOptions): Promise<SetProfilePermissionResponse>;
|
|
764
815
|
|
|
765
|
-
export { type CallIntegrationOptions, type CallIntegrationResponse, type CreateProfileOptions, type CreateProfileResponse, type CreateRecordOptions, type CreateRecordsBatchOptions, 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 GetProfileDetailsOptions, type GetProfileDetailsResponse, type GetPublicServerFunctionExecutionOptions, type GetPublicServerFunctionExecutionResponse, type GetRecordOptions, type GetVariableOptions, type GetVariableResponse, type IntegrationResponse, type ListIntegrationsOptions, type ListProfilesOptions, type ListProfilesResponse, type ListRecordsOptions, type ListRecordsResponse, type ListVariablesOptions, type ListVariablesResponse, type LoginOptions, type LoginResponse, type MitraConfig, type MitraInstance, type PatchRecordOptions, type ProfileTableRef, type RunActionOptions, type RunActionResponse, 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, callIntegrationMitra, closeChatMitra, configureSdkMitra, createMitraInstance, createProfileMitra, createRecordMitra, createRecordsBatchMitra, deleteProfileMitra, deleteRecordMitra, emailLoginMitra, emailResendCodeMitra, emailSignupMitra, emailVerifyCodeMitra, executeDataLoaderMitra, executeDbActionMitra, executePublicServerFunctionAsyncMitra, executePublicServerFunctionMitra, executeServerFunctionAsyncMitra, executeServerFunctionMitra, getConfig, getProfileDetailsMitra, getPublicServerFunctionExecutionMitra, getRecordMitra, getVariableMitra, listIntegrationsMitra, listProfilesMitra, listRecordsMitra, listVariablesMitra, loginMitra, loginWithEmailMitra, loginWithGoogleMitra, loginWithMicrosoftMitra, openChatMitra, patchRecordMitra, refreshTokenSilently, resolveProjectId, runActionMitra, setFileStatusMitra, setProfileActionsMitra, setProfileDmlTablesMitra, setProfileScreensMitra, setProfileSelectTablesMitra, setProfileServerFunctionsMitra, setProfileUsersMitra, setVariableMitra, stopServerFunctionExecutionMitra, updateProfileMitra, updateRecordMitra, uploadFileLoadableMitra, uploadFilePublicMitra };
|
|
816
|
+
export { type CallIntegrationOptions, type CallIntegrationResponse, type CreateProfileOptions, type CreateProfileResponse, type CreateRecordOptions, type CreateRecordsBatchOptions, 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 GetProfileDetailsOptions, type GetProfileDetailsResponse, type GetPublicServerFunctionExecutionOptions, type GetPublicServerFunctionExecutionResponse, type GetRecordOptions, type GetVariableOptions, type GetVariableResponse, type IntegrationResponse, type ListIntegrationsOptions, type ListProfilesOptions, type ListProfilesResponse, type ListRecordsOptions, type ListRecordsResponse, type ListVariablesOptions, type ListVariablesResponse, type LoginOptions, type LoginResponse, type MitraConfig, type MitraInstance, type PatchRecordOptions, type ProfileTableRef, type ResetPasswordOptions, type RunActionOptions, type RunActionResponse, 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, getConfig, getProfileDetailsMitra, getPublicServerFunctionExecutionMitra, getRecordMitra, getVariableMitra, listIntegrationsMitra, listProfilesMitra, listRecordsMitra, listVariablesMitra, loginMitra, loginWithEmailMitra, loginWithGoogleMitra, loginWithMicrosoftMitra, openChatMitra, patchRecordMitra, refreshTokenSilently, resetPasswordMitra, resolveProjectId, runActionMitra, sendPasswordResetCodeMitra, setFileStatusMitra, setProfileActionsMitra, setProfileDmlTablesMitra, setProfileScreensMitra, setProfileSelectTablesMitra, setProfileServerFunctionsMitra, setProfileUsersMitra, setVariableMitra, stopServerFunctionExecutionMitra, updateProfileMitra, updateRecordMitra, uploadFileLoadableMitra, uploadFilePublicMitra, validatePasswordResetCodeMitra };
|
package/dist/index.d.ts
CHANGED
|
@@ -67,6 +67,30 @@ interface EmailResendCodeOptions {
|
|
|
67
67
|
/** Email do usuário */
|
|
68
68
|
email: string;
|
|
69
69
|
}
|
|
70
|
+
interface SendPasswordResetCodeOptions {
|
|
71
|
+
/** Email do usuário que esqueceu a senha */
|
|
72
|
+
email: string;
|
|
73
|
+
/** URL da página de auth (opcional — usado pra derivar a API base). Default: do config global. */
|
|
74
|
+
authUrl?: string;
|
|
75
|
+
/** Override explícito da API base (ex: https://api0.mitraecp.com:1005). Default: derivado do authUrl. */
|
|
76
|
+
authApiURL?: string;
|
|
77
|
+
}
|
|
78
|
+
interface ValidatePasswordResetCodeOptions {
|
|
79
|
+
email: string;
|
|
80
|
+
/** Código de 6 dígitos recebido por email */
|
|
81
|
+
code: string;
|
|
82
|
+
authUrl?: string;
|
|
83
|
+
authApiURL?: string;
|
|
84
|
+
}
|
|
85
|
+
interface ResetPasswordOptions {
|
|
86
|
+
email: string;
|
|
87
|
+
/** Código de 6 dígitos recebido por email */
|
|
88
|
+
code: string;
|
|
89
|
+
/** Nova senha */
|
|
90
|
+
newPassword: string;
|
|
91
|
+
authUrl?: string;
|
|
92
|
+
authApiURL?: string;
|
|
93
|
+
}
|
|
70
94
|
interface ExecuteDataLoaderOptions {
|
|
71
95
|
projectId?: number | string;
|
|
72
96
|
dataLoaderId: number | string;
|
|
@@ -537,6 +561,9 @@ interface MitraInstance {
|
|
|
537
561
|
setProfileActions(options: SetProfileActionsOptions): Promise<SetProfilePermissionResponse>;
|
|
538
562
|
setProfileScreens(options: SetProfileScreensOptions): Promise<SetProfilePermissionResponse>;
|
|
539
563
|
setProfileServerFunctions(options: SetProfileServerFunctionsOptions): Promise<SetProfilePermissionResponse>;
|
|
564
|
+
sendPasswordResetCode(options: SendPasswordResetCodeOptions): Promise<Record<string, unknown>>;
|
|
565
|
+
validatePasswordResetCode(options: ValidatePasswordResetCodeOptions): Promise<Record<string, unknown>>;
|
|
566
|
+
resetPassword(options: ResetPasswordOptions): Promise<Record<string, unknown>>;
|
|
540
567
|
openChat(): void;
|
|
541
568
|
closeChat(): void;
|
|
542
569
|
}
|
|
@@ -607,6 +634,30 @@ declare function emailVerifyCodeMitra(options: EmailVerifyCodeOptions): Promise<
|
|
|
607
634
|
declare function emailResendCodeMitra(options: EmailResendCodeOptions): Promise<void>;
|
|
608
635
|
declare function refreshTokenSilently(authUrl: string, projectId: number | string): Promise<LoginResponse>;
|
|
609
636
|
|
|
637
|
+
/**
|
|
638
|
+
* Mitra Interactions SDK - Password Reset (legacy backend)
|
|
639
|
+
*
|
|
640
|
+
* Endpoints públicos (sem auth) para fluxo de "esqueci minha senha".
|
|
641
|
+
* Usa um backend separado (porta 1005 ou 4133 dependendo do ambiente),
|
|
642
|
+
* resolvido a partir do `authUrl` configurado.
|
|
643
|
+
*/
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* POST /mitraspace/auth/resetPassword
|
|
647
|
+
* Envia um código de verificação por email para iniciar o fluxo de reset de senha.
|
|
648
|
+
*/
|
|
649
|
+
declare function sendPasswordResetCodeMitra(options: SendPasswordResetCodeOptions): Promise<Record<string, unknown>>;
|
|
650
|
+
/**
|
|
651
|
+
* POST /mitraspace/auth/resetPassword/validateCode
|
|
652
|
+
* Valida o código recebido por email (sem trocar a senha ainda).
|
|
653
|
+
*/
|
|
654
|
+
declare function validatePasswordResetCodeMitra(options: ValidatePasswordResetCodeOptions): Promise<Record<string, unknown>>;
|
|
655
|
+
/**
|
|
656
|
+
* PUT /mitraspace/auth/resetPassword
|
|
657
|
+
* Troca a senha usando email + código + nova senha.
|
|
658
|
+
*/
|
|
659
|
+
declare function resetPasswordMitra(options: ResetPasswordOptions): Promise<Record<string, unknown>>;
|
|
660
|
+
|
|
610
661
|
/**
|
|
611
662
|
* Mitra Interactions SDK - Services
|
|
612
663
|
*/
|
|
@@ -762,4 +813,4 @@ declare function setProfileScreensMitra(options: SetProfileScreensOptions): Prom
|
|
|
762
813
|
*/
|
|
763
814
|
declare function setProfileServerFunctionsMitra(options: SetProfileServerFunctionsOptions): Promise<SetProfilePermissionResponse>;
|
|
764
815
|
|
|
765
|
-
export { type CallIntegrationOptions, type CallIntegrationResponse, type CreateProfileOptions, type CreateProfileResponse, type CreateRecordOptions, type CreateRecordsBatchOptions, 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 GetProfileDetailsOptions, type GetProfileDetailsResponse, type GetPublicServerFunctionExecutionOptions, type GetPublicServerFunctionExecutionResponse, type GetRecordOptions, type GetVariableOptions, type GetVariableResponse, type IntegrationResponse, type ListIntegrationsOptions, type ListProfilesOptions, type ListProfilesResponse, type ListRecordsOptions, type ListRecordsResponse, type ListVariablesOptions, type ListVariablesResponse, type LoginOptions, type LoginResponse, type MitraConfig, type MitraInstance, type PatchRecordOptions, type ProfileTableRef, type RunActionOptions, type RunActionResponse, 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, callIntegrationMitra, closeChatMitra, configureSdkMitra, createMitraInstance, createProfileMitra, createRecordMitra, createRecordsBatchMitra, deleteProfileMitra, deleteRecordMitra, emailLoginMitra, emailResendCodeMitra, emailSignupMitra, emailVerifyCodeMitra, executeDataLoaderMitra, executeDbActionMitra, executePublicServerFunctionAsyncMitra, executePublicServerFunctionMitra, executeServerFunctionAsyncMitra, executeServerFunctionMitra, getConfig, getProfileDetailsMitra, getPublicServerFunctionExecutionMitra, getRecordMitra, getVariableMitra, listIntegrationsMitra, listProfilesMitra, listRecordsMitra, listVariablesMitra, loginMitra, loginWithEmailMitra, loginWithGoogleMitra, loginWithMicrosoftMitra, openChatMitra, patchRecordMitra, refreshTokenSilently, resolveProjectId, runActionMitra, setFileStatusMitra, setProfileActionsMitra, setProfileDmlTablesMitra, setProfileScreensMitra, setProfileSelectTablesMitra, setProfileServerFunctionsMitra, setProfileUsersMitra, setVariableMitra, stopServerFunctionExecutionMitra, updateProfileMitra, updateRecordMitra, uploadFileLoadableMitra, uploadFilePublicMitra };
|
|
816
|
+
export { type CallIntegrationOptions, type CallIntegrationResponse, type CreateProfileOptions, type CreateProfileResponse, type CreateRecordOptions, type CreateRecordsBatchOptions, 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 GetProfileDetailsOptions, type GetProfileDetailsResponse, type GetPublicServerFunctionExecutionOptions, type GetPublicServerFunctionExecutionResponse, type GetRecordOptions, type GetVariableOptions, type GetVariableResponse, type IntegrationResponse, type ListIntegrationsOptions, type ListProfilesOptions, type ListProfilesResponse, type ListRecordsOptions, type ListRecordsResponse, type ListVariablesOptions, type ListVariablesResponse, type LoginOptions, type LoginResponse, type MitraConfig, type MitraInstance, type PatchRecordOptions, type ProfileTableRef, type ResetPasswordOptions, type RunActionOptions, type RunActionResponse, 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, getConfig, getProfileDetailsMitra, getPublicServerFunctionExecutionMitra, getRecordMitra, getVariableMitra, listIntegrationsMitra, listProfilesMitra, listRecordsMitra, listVariablesMitra, loginMitra, loginWithEmailMitra, loginWithGoogleMitra, loginWithMicrosoftMitra, openChatMitra, patchRecordMitra, refreshTokenSilently, resetPasswordMitra, resolveProjectId, runActionMitra, sendPasswordResetCodeMitra, setFileStatusMitra, setProfileActionsMitra, setProfileDmlTablesMitra, setProfileScreensMitra, setProfileSelectTablesMitra, setProfileServerFunctionsMitra, setProfileUsersMitra, setVariableMitra, stopServerFunctionExecutionMitra, updateProfileMitra, updateRecordMitra, uploadFileLoadableMitra, uploadFilePublicMitra, validatePasswordResetCodeMitra };
|
package/dist/index.js
CHANGED
|
@@ -452,11 +452,83 @@ function closeChatMitra() {
|
|
|
452
452
|
(_a = window.__mitraChat) == null ? void 0 : _a.close();
|
|
453
453
|
}
|
|
454
454
|
|
|
455
|
+
// src/password-reset.ts
|
|
456
|
+
var AUTH_API_BY_AUTH_URL = {
|
|
457
|
+
"https://coder.mitralab.io/sdk-auth/": "https://api0.mitraecp.com:1005",
|
|
458
|
+
"https://agent.mitralab.io/sdk-auth/": "https://api2.mitrasheet.com:4133"
|
|
459
|
+
};
|
|
460
|
+
function normalizeAuthUrl(url) {
|
|
461
|
+
const stripped = url.split("?")[0].split("#")[0];
|
|
462
|
+
return stripped.endsWith("/") ? stripped : stripped + "/";
|
|
463
|
+
}
|
|
464
|
+
function resolveAuthApiURL(opts) {
|
|
465
|
+
var _a;
|
|
466
|
+
if (opts.authApiURL) return opts.authApiURL.replace(/\/+$/, "");
|
|
467
|
+
if (typeof window !== "undefined") {
|
|
468
|
+
const injected = (_a = window.__mitraEnv) == null ? void 0 : _a.apiBaseURL;
|
|
469
|
+
if (typeof injected === "string" && injected.length > 0) {
|
|
470
|
+
return injected.replace(/\/+$/, "");
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
const authUrl = opts.authUrl || (isConfigured() ? getConfig().authUrl : void 0);
|
|
474
|
+
if (authUrl) {
|
|
475
|
+
const apiURL = AUTH_API_BY_AUTH_URL[normalizeAuthUrl(authUrl)];
|
|
476
|
+
if (apiURL) return apiURL;
|
|
477
|
+
}
|
|
478
|
+
throw new Error(
|
|
479
|
+
"N\xE3o foi poss\xEDvel resolver a API base. Configure window.__mitraEnv.apiBaseURL via build-proxy, passe authApiURL nas options, ou use um authUrl conhecido (coder.mitralab.io ou agent.mitralab.io)."
|
|
480
|
+
);
|
|
481
|
+
}
|
|
482
|
+
function getFetch2() {
|
|
483
|
+
if (typeof globalThis.fetch === "function") return globalThis.fetch;
|
|
484
|
+
throw new Error("fetch n\xE3o dispon\xEDvel. Use Node.js 18+ ou instale node-fetch.");
|
|
485
|
+
}
|
|
486
|
+
async function callAuthApi(url, method, body) {
|
|
487
|
+
const fetchFn = getFetch2();
|
|
488
|
+
const response = await fetchFn(url, {
|
|
489
|
+
method,
|
|
490
|
+
headers: { "Content-Type": "application/json", accept: "application/json" },
|
|
491
|
+
body: JSON.stringify(body)
|
|
492
|
+
});
|
|
493
|
+
const text = await response.text();
|
|
494
|
+
let data = null;
|
|
495
|
+
try {
|
|
496
|
+
data = text ? JSON.parse(text) : null;
|
|
497
|
+
} catch (e) {
|
|
498
|
+
}
|
|
499
|
+
if (!response.ok) {
|
|
500
|
+
const msg = (data == null ? void 0 : data.message) || (data == null ? void 0 : data.error) || `HTTP ${response.status}`;
|
|
501
|
+
throw { message: msg, status: response.status, details: data };
|
|
502
|
+
}
|
|
503
|
+
return data;
|
|
504
|
+
}
|
|
505
|
+
async function sendPasswordResetCodeMitra(options) {
|
|
506
|
+
const apiURL = resolveAuthApiURL(options);
|
|
507
|
+
return callAuthApi(`${apiURL}/mitraspace/auth/resetPassword`, "POST", {
|
|
508
|
+
email: options.email
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
async function validatePasswordResetCodeMitra(options) {
|
|
512
|
+
const apiURL = resolveAuthApiURL(options);
|
|
513
|
+
return callAuthApi(`${apiURL}/mitraspace/auth/resetPassword/validateCode`, "POST", {
|
|
514
|
+
email: options.email,
|
|
515
|
+
code: options.code
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
async function resetPasswordMitra(options) {
|
|
519
|
+
const apiURL = resolveAuthApiURL(options);
|
|
520
|
+
return callAuthApi(`${apiURL}/mitraspace/auth/resetPassword`, "PUT", {
|
|
521
|
+
email: options.email,
|
|
522
|
+
code: options.code,
|
|
523
|
+
newPassword: options.newPassword
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
|
|
455
527
|
// src/instance.ts
|
|
456
528
|
function formatToken(token) {
|
|
457
529
|
return token.startsWith("Bearer ") ? token : `Bearer ${token}`;
|
|
458
530
|
}
|
|
459
|
-
function
|
|
531
|
+
function getFetch3() {
|
|
460
532
|
if (typeof globalThis.fetch === "function") return globalThis.fetch;
|
|
461
533
|
throw new Error("fetch n\xE3o dispon\xEDvel. Use Node.js 18+ ou instale node-fetch.");
|
|
462
534
|
}
|
|
@@ -498,7 +570,7 @@ function createMitraInstance(initialConfig) {
|
|
|
498
570
|
if (!_config.token || _config.projectId == null) return false;
|
|
499
571
|
try {
|
|
500
572
|
const baseURL = _config.baseURL.replace(/\/+$/, "");
|
|
501
|
-
const resp = await
|
|
573
|
+
const resp = await getFetch3()(`${baseURL}/mitraspace/project/refreshedToken/${_config.projectId}`, {
|
|
502
574
|
method: "GET",
|
|
503
575
|
headers: { "Authorization": formatToken(_config.token) }
|
|
504
576
|
});
|
|
@@ -533,7 +605,7 @@ function createMitraInstance(initialConfig) {
|
|
|
533
605
|
}
|
|
534
606
|
}
|
|
535
607
|
async function fetchWithRefresh2(url, init) {
|
|
536
|
-
const fetchFn =
|
|
608
|
+
const fetchFn = getFetch3();
|
|
537
609
|
const response = await fetchFn(url, init);
|
|
538
610
|
if (response.status === 403) {
|
|
539
611
|
const refreshed = await tryRefreshToken2();
|
|
@@ -638,7 +710,7 @@ function createMitraInstance(initialConfig) {
|
|
|
638
710
|
async executePublicServerFunction(options) {
|
|
639
711
|
const { projectId, serverFunctionId, input } = options;
|
|
640
712
|
const url = `${_config.baseURL}/public/serverFunction/${projectId}/${serverFunctionId}/execute`;
|
|
641
|
-
const fetchFn =
|
|
713
|
+
const fetchFn = getFetch3();
|
|
642
714
|
const response = await fetchFn(url, {
|
|
643
715
|
method: "POST",
|
|
644
716
|
headers: { "Content-Type": "application/json" },
|
|
@@ -649,7 +721,7 @@ function createMitraInstance(initialConfig) {
|
|
|
649
721
|
async executePublicServerFunctionAsync(options) {
|
|
650
722
|
const { projectId, serverFunctionId, input } = options;
|
|
651
723
|
const url = `${_config.baseURL}/public/serverFunction/${projectId}/${serverFunctionId}/executeAsync`;
|
|
652
|
-
const fetchFn =
|
|
724
|
+
const fetchFn = getFetch3();
|
|
653
725
|
const response = await fetchFn(url, {
|
|
654
726
|
method: "POST",
|
|
655
727
|
headers: { "Content-Type": "application/json" },
|
|
@@ -660,7 +732,7 @@ function createMitraInstance(initialConfig) {
|
|
|
660
732
|
async getPublicServerFunctionExecution(options) {
|
|
661
733
|
const { projectId, executionId } = options;
|
|
662
734
|
const url = `${_config.baseURL}/public/serverFunction/${projectId}/execution/${executionId}`;
|
|
663
|
-
const fetchFn =
|
|
735
|
+
const fetchFn = getFetch3();
|
|
664
736
|
const response = await fetchFn(url, {
|
|
665
737
|
method: "GET",
|
|
666
738
|
headers: { "Content-Type": "application/json" }
|
|
@@ -791,6 +863,19 @@ function createMitraInstance(initialConfig) {
|
|
|
791
863
|
body: { projectId: resolveProjectId2(options.projectId), profileId: options.profileId, serverFunctionIds: options.serverFunctionIds }
|
|
792
864
|
});
|
|
793
865
|
},
|
|
866
|
+
// Password Reset (pré-login)
|
|
867
|
+
sendPasswordResetCode(options) {
|
|
868
|
+
var _a2;
|
|
869
|
+
return sendPasswordResetCodeMitra({ ...options, authUrl: (_a2 = options.authUrl) != null ? _a2 : _config.authUrl });
|
|
870
|
+
},
|
|
871
|
+
validatePasswordResetCode(options) {
|
|
872
|
+
var _a2;
|
|
873
|
+
return validatePasswordResetCodeMitra({ ...options, authUrl: (_a2 = options.authUrl) != null ? _a2 : _config.authUrl });
|
|
874
|
+
},
|
|
875
|
+
resetPassword(options) {
|
|
876
|
+
var _a2;
|
|
877
|
+
return resetPasswordMitra({ ...options, authUrl: (_a2 = options.authUrl) != null ? _a2 : _config.authUrl });
|
|
878
|
+
},
|
|
794
879
|
// Chat
|
|
795
880
|
openChat() {
|
|
796
881
|
openChatMitra();
|
|
@@ -843,7 +928,7 @@ function resolveProjectId(projectId) {
|
|
|
843
928
|
}
|
|
844
929
|
|
|
845
930
|
// src/client.ts
|
|
846
|
-
function
|
|
931
|
+
function getFetch4() {
|
|
847
932
|
if (typeof globalThis.fetch === "function") {
|
|
848
933
|
return globalThis.fetch;
|
|
849
934
|
}
|
|
@@ -873,7 +958,7 @@ async function tryRefreshToken() {
|
|
|
873
958
|
if (!config.token || config.projectId == null) return false;
|
|
874
959
|
try {
|
|
875
960
|
const baseURL = config.baseURL.replace(/\/+$/, "");
|
|
876
|
-
const resp = await
|
|
961
|
+
const resp = await getFetch4()(`${baseURL}/mitraspace/project/refreshedToken/${config.projectId}`, {
|
|
877
962
|
method: "GET",
|
|
878
963
|
headers: { "Authorization": formatToken2(config.token) }
|
|
879
964
|
});
|
|
@@ -918,7 +1003,7 @@ async function handleResponse(response) {
|
|
|
918
1003
|
return data;
|
|
919
1004
|
}
|
|
920
1005
|
async function fetchWithRefresh(url, init) {
|
|
921
|
-
const fetchFn =
|
|
1006
|
+
const fetchFn = getFetch4();
|
|
922
1007
|
const response = await fetchFn(url, init);
|
|
923
1008
|
if (response.status === 403) {
|
|
924
1009
|
const refreshed = await tryRefreshToken();
|
|
@@ -1324,8 +1409,10 @@ exports.loginWithMicrosoftMitra = loginWithMicrosoftMitra3;
|
|
|
1324
1409
|
exports.openChatMitra = openChatMitra;
|
|
1325
1410
|
exports.patchRecordMitra = patchRecordMitra;
|
|
1326
1411
|
exports.refreshTokenSilently = refreshTokenSilently3;
|
|
1412
|
+
exports.resetPasswordMitra = resetPasswordMitra;
|
|
1327
1413
|
exports.resolveProjectId = resolveProjectId;
|
|
1328
1414
|
exports.runActionMitra = runActionMitra;
|
|
1415
|
+
exports.sendPasswordResetCodeMitra = sendPasswordResetCodeMitra;
|
|
1329
1416
|
exports.setFileStatusMitra = setFileStatusMitra;
|
|
1330
1417
|
exports.setProfileActionsMitra = setProfileActionsMitra;
|
|
1331
1418
|
exports.setProfileDmlTablesMitra = setProfileDmlTablesMitra;
|
|
@@ -1339,5 +1426,6 @@ exports.updateProfileMitra = updateProfileMitra;
|
|
|
1339
1426
|
exports.updateRecordMitra = updateRecordMitra;
|
|
1340
1427
|
exports.uploadFileLoadableMitra = uploadFileLoadableMitra;
|
|
1341
1428
|
exports.uploadFilePublicMitra = uploadFilePublicMitra;
|
|
1429
|
+
exports.validatePasswordResetCodeMitra = validatePasswordResetCodeMitra;
|
|
1342
1430
|
//# sourceMappingURL=index.js.map
|
|
1343
1431
|
//# sourceMappingURL=index.js.map
|