mitra-interactions-sdk 1.0.49 → 1.0.52
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 +21 -1
- package/dist/index.d.ts +21 -1
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -165,6 +165,18 @@ interface ExecuteServerFunctionAsyncResponse {
|
|
|
165
165
|
executionStatus: string;
|
|
166
166
|
};
|
|
167
167
|
}
|
|
168
|
+
interface ExecutePublicServerFunctionOptions {
|
|
169
|
+
/** ID do projeto (tenant) */
|
|
170
|
+
projectId: number;
|
|
171
|
+
/** ID da Server Function (deve ter publicExecution = true) */
|
|
172
|
+
serverFunctionId: number;
|
|
173
|
+
/** Objeto de entrada para a função (opcional) */
|
|
174
|
+
input?: Record<string, unknown>;
|
|
175
|
+
}
|
|
176
|
+
interface ExecutePublicServerFunctionResponse {
|
|
177
|
+
executionId: string;
|
|
178
|
+
status: string;
|
|
179
|
+
}
|
|
168
180
|
interface ListRecordsResponse {
|
|
169
181
|
content: Record<string, any>[];
|
|
170
182
|
page: number;
|
|
@@ -477,6 +489,7 @@ interface MitraInstance {
|
|
|
477
489
|
runAction(options: RunActionOptions): Promise<RunActionResponse>;
|
|
478
490
|
executeServerFunction(options: ExecuteServerFunctionOptions): Promise<ExecuteServerFunctionResponse>;
|
|
479
491
|
executeServerFunctionAsync(options: ExecuteServerFunctionAsyncOptions): Promise<ExecuteServerFunctionAsyncResponse>;
|
|
492
|
+
executePublicServerFunction(options: ExecutePublicServerFunctionOptions): Promise<ExecutePublicServerFunctionResponse>;
|
|
480
493
|
stopServerFunctionExecution(options: StopServerFunctionExecutionOptions): Promise<StopServerFunctionExecutionResponse>;
|
|
481
494
|
uploadFilePublic(options: UploadFileOptions): Promise<UploadFileResponse>;
|
|
482
495
|
uploadFileLoadable(options: UploadFileOptions): Promise<UploadFileResponse>;
|
|
@@ -654,6 +667,13 @@ declare function executeServerFunctionMitra(options: ExecuteServerFunctionOption
|
|
|
654
667
|
* Executa uma Server Function de forma ASSÍNCRONA (retorna executionId imediatamente)
|
|
655
668
|
*/
|
|
656
669
|
declare function executeServerFunctionAsyncMitra(options: ExecuteServerFunctionAsyncOptions): Promise<ExecuteServerFunctionAsyncResponse>;
|
|
670
|
+
/**
|
|
671
|
+
* POST /public/serverFunction/{projectId}/{serverFunctionId}/execute
|
|
672
|
+
* Executa uma Server Function pública (sem autenticação).
|
|
673
|
+
* A SF deve ter publicExecution = true no backend.
|
|
674
|
+
* Retorna executionId (assíncrono).
|
|
675
|
+
*/
|
|
676
|
+
declare function executePublicServerFunctionMitra(options: ExecutePublicServerFunctionOptions): Promise<ExecutePublicServerFunctionResponse>;
|
|
657
677
|
/**
|
|
658
678
|
* GET /interactions/integrations?projectId=X
|
|
659
679
|
* Lista integrações configuradas no projeto
|
|
@@ -743,4 +763,4 @@ declare function setProfileScreensMitra(options: SetProfileScreensOptions): Prom
|
|
|
743
763
|
*/
|
|
744
764
|
declare function setProfileServerFunctionsMitra(options: SetProfileServerFunctionsOptions): Promise<SetProfilePermissionResponse>;
|
|
745
765
|
|
|
746
|
-
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 ExecuteServerFunctionAsyncOptions, type ExecuteServerFunctionAsyncResponse, type ExecuteServerFunctionOptions, type ExecuteServerFunctionResponse, type GetProfileDetailsOptions, type GetProfileDetailsResponse, 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, executeServerFunctionAsyncMitra, executeServerFunctionMitra, getConfig, getProfileDetailsMitra, getRecordMitra, getVariableMitra, listIntegrationsMitra, listProfilesMitra, listRecordsMitra, listVariablesMitra, loginMitra, loginWithEmailMitra, loginWithGoogleMitra, loginWithMicrosoftMitra, openChatMitra, patchRecordMitra, refreshTokenSilently, resolveProjectId, runActionMitra, setFileStatusMitra, setProfileActionsMitra, setProfileDmlTablesMitra, setProfileScreensMitra, setProfileSelectTablesMitra, setProfileServerFunctionsMitra, setProfileUsersMitra, setVariableMitra, stopServerFunctionExecutionMitra, stopTracking, updateProfileMitra, updateRecordMitra, uploadFileLoadableMitra, uploadFilePublicMitra };
|
|
766
|
+
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 ExecutePublicServerFunctionOptions, type ExecutePublicServerFunctionResponse, type ExecuteServerFunctionAsyncOptions, type ExecuteServerFunctionAsyncResponse, type ExecuteServerFunctionOptions, type ExecuteServerFunctionResponse, type GetProfileDetailsOptions, type GetProfileDetailsResponse, 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, executePublicServerFunctionMitra, executeServerFunctionAsyncMitra, executeServerFunctionMitra, getConfig, getProfileDetailsMitra, getRecordMitra, getVariableMitra, listIntegrationsMitra, listProfilesMitra, listRecordsMitra, listVariablesMitra, loginMitra, loginWithEmailMitra, loginWithGoogleMitra, loginWithMicrosoftMitra, openChatMitra, patchRecordMitra, refreshTokenSilently, resolveProjectId, runActionMitra, setFileStatusMitra, setProfileActionsMitra, setProfileDmlTablesMitra, setProfileScreensMitra, setProfileSelectTablesMitra, setProfileServerFunctionsMitra, setProfileUsersMitra, setVariableMitra, stopServerFunctionExecutionMitra, stopTracking, updateProfileMitra, updateRecordMitra, uploadFileLoadableMitra, uploadFilePublicMitra };
|
package/dist/index.d.ts
CHANGED
|
@@ -165,6 +165,18 @@ interface ExecuteServerFunctionAsyncResponse {
|
|
|
165
165
|
executionStatus: string;
|
|
166
166
|
};
|
|
167
167
|
}
|
|
168
|
+
interface ExecutePublicServerFunctionOptions {
|
|
169
|
+
/** ID do projeto (tenant) */
|
|
170
|
+
projectId: number;
|
|
171
|
+
/** ID da Server Function (deve ter publicExecution = true) */
|
|
172
|
+
serverFunctionId: number;
|
|
173
|
+
/** Objeto de entrada para a função (opcional) */
|
|
174
|
+
input?: Record<string, unknown>;
|
|
175
|
+
}
|
|
176
|
+
interface ExecutePublicServerFunctionResponse {
|
|
177
|
+
executionId: string;
|
|
178
|
+
status: string;
|
|
179
|
+
}
|
|
168
180
|
interface ListRecordsResponse {
|
|
169
181
|
content: Record<string, any>[];
|
|
170
182
|
page: number;
|
|
@@ -477,6 +489,7 @@ interface MitraInstance {
|
|
|
477
489
|
runAction(options: RunActionOptions): Promise<RunActionResponse>;
|
|
478
490
|
executeServerFunction(options: ExecuteServerFunctionOptions): Promise<ExecuteServerFunctionResponse>;
|
|
479
491
|
executeServerFunctionAsync(options: ExecuteServerFunctionAsyncOptions): Promise<ExecuteServerFunctionAsyncResponse>;
|
|
492
|
+
executePublicServerFunction(options: ExecutePublicServerFunctionOptions): Promise<ExecutePublicServerFunctionResponse>;
|
|
480
493
|
stopServerFunctionExecution(options: StopServerFunctionExecutionOptions): Promise<StopServerFunctionExecutionResponse>;
|
|
481
494
|
uploadFilePublic(options: UploadFileOptions): Promise<UploadFileResponse>;
|
|
482
495
|
uploadFileLoadable(options: UploadFileOptions): Promise<UploadFileResponse>;
|
|
@@ -654,6 +667,13 @@ declare function executeServerFunctionMitra(options: ExecuteServerFunctionOption
|
|
|
654
667
|
* Executa uma Server Function de forma ASSÍNCRONA (retorna executionId imediatamente)
|
|
655
668
|
*/
|
|
656
669
|
declare function executeServerFunctionAsyncMitra(options: ExecuteServerFunctionAsyncOptions): Promise<ExecuteServerFunctionAsyncResponse>;
|
|
670
|
+
/**
|
|
671
|
+
* POST /public/serverFunction/{projectId}/{serverFunctionId}/execute
|
|
672
|
+
* Executa uma Server Function pública (sem autenticação).
|
|
673
|
+
* A SF deve ter publicExecution = true no backend.
|
|
674
|
+
* Retorna executionId (assíncrono).
|
|
675
|
+
*/
|
|
676
|
+
declare function executePublicServerFunctionMitra(options: ExecutePublicServerFunctionOptions): Promise<ExecutePublicServerFunctionResponse>;
|
|
657
677
|
/**
|
|
658
678
|
* GET /interactions/integrations?projectId=X
|
|
659
679
|
* Lista integrações configuradas no projeto
|
|
@@ -743,4 +763,4 @@ declare function setProfileScreensMitra(options: SetProfileScreensOptions): Prom
|
|
|
743
763
|
*/
|
|
744
764
|
declare function setProfileServerFunctionsMitra(options: SetProfileServerFunctionsOptions): Promise<SetProfilePermissionResponse>;
|
|
745
765
|
|
|
746
|
-
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 ExecuteServerFunctionAsyncOptions, type ExecuteServerFunctionAsyncResponse, type ExecuteServerFunctionOptions, type ExecuteServerFunctionResponse, type GetProfileDetailsOptions, type GetProfileDetailsResponse, 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, executeServerFunctionAsyncMitra, executeServerFunctionMitra, getConfig, getProfileDetailsMitra, getRecordMitra, getVariableMitra, listIntegrationsMitra, listProfilesMitra, listRecordsMitra, listVariablesMitra, loginMitra, loginWithEmailMitra, loginWithGoogleMitra, loginWithMicrosoftMitra, openChatMitra, patchRecordMitra, refreshTokenSilently, resolveProjectId, runActionMitra, setFileStatusMitra, setProfileActionsMitra, setProfileDmlTablesMitra, setProfileScreensMitra, setProfileSelectTablesMitra, setProfileServerFunctionsMitra, setProfileUsersMitra, setVariableMitra, stopServerFunctionExecutionMitra, stopTracking, updateProfileMitra, updateRecordMitra, uploadFileLoadableMitra, uploadFilePublicMitra };
|
|
766
|
+
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 ExecutePublicServerFunctionOptions, type ExecutePublicServerFunctionResponse, type ExecuteServerFunctionAsyncOptions, type ExecuteServerFunctionAsyncResponse, type ExecuteServerFunctionOptions, type ExecuteServerFunctionResponse, type GetProfileDetailsOptions, type GetProfileDetailsResponse, 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, executePublicServerFunctionMitra, executeServerFunctionAsyncMitra, executeServerFunctionMitra, getConfig, getProfileDetailsMitra, getRecordMitra, getVariableMitra, listIntegrationsMitra, listProfilesMitra, listRecordsMitra, listVariablesMitra, loginMitra, loginWithEmailMitra, loginWithGoogleMitra, loginWithMicrosoftMitra, openChatMitra, patchRecordMitra, refreshTokenSilently, resolveProjectId, runActionMitra, setFileStatusMitra, setProfileActionsMitra, setProfileDmlTablesMitra, setProfileScreensMitra, setProfileSelectTablesMitra, setProfileServerFunctionsMitra, setProfileUsersMitra, setVariableMitra, stopServerFunctionExecutionMitra, stopTracking, updateProfileMitra, updateRecordMitra, uploadFileLoadableMitra, uploadFilePublicMitra };
|
package/dist/index.js
CHANGED
|
@@ -449,6 +449,17 @@ function createMitraInstance(initialConfig) {
|
|
|
449
449
|
if (options.input !== void 0) body.input = options.input;
|
|
450
450
|
return request("POST", "/interactions/executeServerFunctionAsync", { body });
|
|
451
451
|
},
|
|
452
|
+
async executePublicServerFunction(options) {
|
|
453
|
+
const { projectId, serverFunctionId, input } = options;
|
|
454
|
+
const url = `${_config.baseURL}/public/serverFunction/${projectId}/${serverFunctionId}/execute`;
|
|
455
|
+
const fetchFn = getFetch();
|
|
456
|
+
const response = await fetchFn(url, {
|
|
457
|
+
method: "POST",
|
|
458
|
+
headers: { "Content-Type": "application/json" },
|
|
459
|
+
body: JSON.stringify(input || {})
|
|
460
|
+
});
|
|
461
|
+
return handleResponse2(response);
|
|
462
|
+
},
|
|
452
463
|
async stopServerFunctionExecution(options) {
|
|
453
464
|
return request("POST", "/interactions/stopServerFunctionExecution", {
|
|
454
465
|
body: { projectId: resolveProjectId2(options.projectId), executionId: options.executionId }
|
|
@@ -945,6 +956,22 @@ async function executeServerFunctionAsyncMitra(options) {
|
|
|
945
956
|
}
|
|
946
957
|
return http.post("/interactions/executeServerFunctionAsync", body);
|
|
947
958
|
}
|
|
959
|
+
async function executePublicServerFunctionMitra(options) {
|
|
960
|
+
const { projectId, serverFunctionId, input } = options;
|
|
961
|
+
const baseURL = getConfig().baseURL;
|
|
962
|
+
const url = `${baseURL}/public/serverFunction/${projectId}/${serverFunctionId}/execute`;
|
|
963
|
+
const response = await fetch(url, {
|
|
964
|
+
method: "POST",
|
|
965
|
+
headers: { "Content-Type": "application/json" },
|
|
966
|
+
body: JSON.stringify(input || {})
|
|
967
|
+
});
|
|
968
|
+
if (!response.ok) {
|
|
969
|
+
const data = await response.json().catch(() => null);
|
|
970
|
+
const msg = (data == null ? void 0 : data.message) || (data == null ? void 0 : data.error) || `HTTP ${response.status}`;
|
|
971
|
+
throw { message: msg, status: response.status, details: data };
|
|
972
|
+
}
|
|
973
|
+
return response.json();
|
|
974
|
+
}
|
|
948
975
|
async function listIntegrationsMitra(options = {}) {
|
|
949
976
|
return http.get("/interactions/integrations", {
|
|
950
977
|
projectId: resolveProjectId(options.projectId)
|
|
@@ -1115,6 +1142,7 @@ exports.emailSignupMitra = emailSignupMitra;
|
|
|
1115
1142
|
exports.emailVerifyCodeMitra = emailVerifyCodeMitra;
|
|
1116
1143
|
exports.executeDataLoaderMitra = executeDataLoaderMitra;
|
|
1117
1144
|
exports.executeDbActionMitra = executeDbActionMitra;
|
|
1145
|
+
exports.executePublicServerFunctionMitra = executePublicServerFunctionMitra;
|
|
1118
1146
|
exports.executeServerFunctionAsyncMitra = executeServerFunctionAsyncMitra;
|
|
1119
1147
|
exports.executeServerFunctionMitra = executeServerFunctionMitra;
|
|
1120
1148
|
exports.getConfig = getConfig;
|