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.mjs CHANGED
@@ -447,6 +447,17 @@ 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
+ },
450
461
  async stopServerFunctionExecution(options) {
451
462
  return request("POST", "/interactions/stopServerFunctionExecution", {
452
463
  body: { projectId: resolveProjectId2(options.projectId), executionId: options.executionId }
@@ -943,6 +954,22 @@ async function executeServerFunctionAsyncMitra(options) {
943
954
  }
944
955
  return http.post("/interactions/executeServerFunctionAsync", body);
945
956
  }
957
+ async function executePublicServerFunctionMitra(options) {
958
+ const { projectId, serverFunctionId, input } = options;
959
+ const baseURL = getConfig().baseURL;
960
+ const url = `${baseURL}/public/serverFunction/${projectId}/${serverFunctionId}/execute`;
961
+ const response = await fetch(url, {
962
+ method: "POST",
963
+ headers: { "Content-Type": "application/json" },
964
+ body: JSON.stringify(input || {})
965
+ });
966
+ if (!response.ok) {
967
+ const data = await response.json().catch(() => null);
968
+ const msg = (data == null ? void 0 : data.message) || (data == null ? void 0 : data.error) || `HTTP ${response.status}`;
969
+ throw { message: msg, status: response.status, details: data };
970
+ }
971
+ return response.json();
972
+ }
946
973
  async function listIntegrationsMitra(options = {}) {
947
974
  return http.get("/interactions/integrations", {
948
975
  projectId: resolveProjectId(options.projectId)
@@ -1098,6 +1125,6 @@ async function setProfileServerFunctionsMitra(options) {
1098
1125
  });
1099
1126
  }
1100
1127
 
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 };
1128
+ export { 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 };
1102
1129
  //# sourceMappingURL=index.mjs.map
1103
1130
  //# sourceMappingURL=index.mjs.map