mitra-interactions-sdk 1.0.50 → 1.0.53

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.mjs CHANGED
@@ -447,6 +447,38 @@ function createMitraInstance(initialConfig) {
447
447
  if (options.input !== void 0) body.input = options.input;
448
448
  return request("POST", "/interactions/executeServerFunctionAsync", { body });
449
449
  },
450
+ async executePublicServerFunction(options) {
451
+ const { projectId, serverFunctionId, input } = options;
452
+ const url = `${_config.baseURL}/public/serverFunction/${projectId}/${serverFunctionId}/execute`;
453
+ const fetchFn = getFetch();
454
+ const response = await fetchFn(url, {
455
+ method: "POST",
456
+ headers: { "Content-Type": "application/json" },
457
+ body: JSON.stringify(input || {})
458
+ });
459
+ return handleResponse2(response);
460
+ },
461
+ async executePublicServerFunctionAsync(options) {
462
+ const { projectId, serverFunctionId, input } = options;
463
+ const url = `${_config.baseURL}/public/serverFunction/${projectId}/${serverFunctionId}/executeAsync`;
464
+ const fetchFn = getFetch();
465
+ const response = await fetchFn(url, {
466
+ method: "POST",
467
+ headers: { "Content-Type": "application/json" },
468
+ body: JSON.stringify(input || {})
469
+ });
470
+ return handleResponse2(response);
471
+ },
472
+ async getPublicServerFunctionExecution(options) {
473
+ const { projectId, executionId } = options;
474
+ const url = `${_config.baseURL}/public/serverFunction/${projectId}/execution/${executionId}`;
475
+ const fetchFn = getFetch();
476
+ const response = await fetchFn(url, {
477
+ method: "GET",
478
+ headers: { "Content-Type": "application/json" }
479
+ });
480
+ return handleResponse2(response);
481
+ },
450
482
  async stopServerFunctionExecution(options) {
451
483
  return request("POST", "/interactions/stopServerFunctionExecution", {
452
484
  body: { projectId: resolveProjectId2(options.projectId), executionId: options.executionId }
@@ -943,6 +975,53 @@ async function executeServerFunctionAsyncMitra(options) {
943
975
  }
944
976
  return http.post("/interactions/executeServerFunctionAsync", body);
945
977
  }
978
+ async function executePublicServerFunctionMitra(options) {
979
+ const { projectId, serverFunctionId, input } = options;
980
+ const baseURL = getConfig().baseURL;
981
+ const url = `${baseURL}/public/serverFunction/${projectId}/${serverFunctionId}/execute`;
982
+ const response = await fetch(url, {
983
+ method: "POST",
984
+ headers: { "Content-Type": "application/json" },
985
+ body: JSON.stringify(input || {})
986
+ });
987
+ if (!response.ok) {
988
+ const data = await response.json().catch(() => null);
989
+ const msg = (data == null ? void 0 : data.message) || (data == null ? void 0 : data.error) || `HTTP ${response.status}`;
990
+ throw { message: msg, status: response.status, details: data };
991
+ }
992
+ return response.json();
993
+ }
994
+ async function executePublicServerFunctionAsyncMitra(options) {
995
+ const { projectId, serverFunctionId, input } = options;
996
+ const baseURL = getConfig().baseURL;
997
+ const url = `${baseURL}/public/serverFunction/${projectId}/${serverFunctionId}/executeAsync`;
998
+ const response = await fetch(url, {
999
+ method: "POST",
1000
+ headers: { "Content-Type": "application/json" },
1001
+ body: JSON.stringify(input || {})
1002
+ });
1003
+ if (!response.ok) {
1004
+ const data = await response.json().catch(() => null);
1005
+ const msg = (data == null ? void 0 : data.message) || (data == null ? void 0 : data.error) || `HTTP ${response.status}`;
1006
+ throw { message: msg, status: response.status, details: data };
1007
+ }
1008
+ return response.json();
1009
+ }
1010
+ async function getPublicServerFunctionExecutionMitra(options) {
1011
+ const { projectId, executionId } = options;
1012
+ const baseURL = getConfig().baseURL;
1013
+ const url = `${baseURL}/public/serverFunction/${projectId}/execution/${executionId}`;
1014
+ const response = await fetch(url, {
1015
+ method: "GET",
1016
+ headers: { "Content-Type": "application/json" }
1017
+ });
1018
+ if (!response.ok) {
1019
+ const data = await response.json().catch(() => null);
1020
+ const msg = (data == null ? void 0 : data.message) || (data == null ? void 0 : data.error) || `HTTP ${response.status}`;
1021
+ throw { message: msg, status: response.status, details: data };
1022
+ }
1023
+ return response.json();
1024
+ }
946
1025
  async function listIntegrationsMitra(options = {}) {
947
1026
  return http.get("/interactions/integrations", {
948
1027
  projectId: resolveProjectId(options.projectId)
@@ -1098,6 +1177,6 @@ async function setProfileServerFunctionsMitra(options) {
1098
1177
  });
1099
1178
  }
1100
1179
 
1101
- export { 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 };
1180
+ export { 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, stopTracking, updateProfileMitra, updateRecordMitra, uploadFileLoadableMitra, uploadFilePublicMitra };
1102
1181
  //# sourceMappingURL=index.mjs.map
1103
1182
  //# sourceMappingURL=index.mjs.map