mitra-interactions-sdk 1.0.66 → 1.0.67
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/README.md +8 -0
- package/dist/index.d.mts +24 -1
- package/dist/index.d.ts +24 -1
- package/dist/index.js +27 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -359,6 +359,28 @@ async function resetPasswordMitra(options) {
|
|
|
359
359
|
});
|
|
360
360
|
}
|
|
361
361
|
|
|
362
|
+
// src/sf-proof.ts
|
|
363
|
+
var SF_EXECUTION_TOKEN_ENV = "MITRA_SF_EXECUTION_TOKEN";
|
|
364
|
+
var SF_EXECUTION_TOKEN_HEADER = "X-SF-Execution-Token";
|
|
365
|
+
function defaultEnv() {
|
|
366
|
+
const proc = globalThis.process;
|
|
367
|
+
return proc == null ? void 0 : proc.env;
|
|
368
|
+
}
|
|
369
|
+
function defaultHasWindow() {
|
|
370
|
+
return typeof globalThis.window !== "undefined";
|
|
371
|
+
}
|
|
372
|
+
function readServerFunctionProof(env = defaultEnv(), hasWindow = defaultHasWindow()) {
|
|
373
|
+
if (hasWindow) return null;
|
|
374
|
+
const raw = env == null ? void 0 : env[SF_EXECUTION_TOKEN_ENV];
|
|
375
|
+
if (typeof raw !== "string") return null;
|
|
376
|
+
const token = raw.trim();
|
|
377
|
+
return token.length > 0 ? token : null;
|
|
378
|
+
}
|
|
379
|
+
function withServerFunctionProof(headers, proof = readServerFunctionProof()) {
|
|
380
|
+
if (!proof) return headers;
|
|
381
|
+
return { ...headers, [SF_EXECUTION_TOKEN_HEADER]: proof };
|
|
382
|
+
}
|
|
383
|
+
|
|
362
384
|
// src/client.ts
|
|
363
385
|
function getFetch2() {
|
|
364
386
|
if (typeof globalThis.fetch === "function") {
|
|
@@ -373,7 +395,7 @@ function buildHeaders() {
|
|
|
373
395
|
const config = getConfig();
|
|
374
396
|
const headers = { "Content-Type": "application/json" };
|
|
375
397
|
if (config.token) headers["Authorization"] = formatToken(config.token);
|
|
376
|
-
return headers;
|
|
398
|
+
return withServerFunctionProof(headers);
|
|
377
399
|
}
|
|
378
400
|
function buildUrl(endpoint, params) {
|
|
379
401
|
const config = getConfig();
|
|
@@ -481,7 +503,7 @@ var http = {
|
|
|
481
503
|
if (config.token) headers["Authorization"] = formatToken(config.token);
|
|
482
504
|
return fetchWithRefresh(buildUrl(endpoint), {
|
|
483
505
|
method: "POST",
|
|
484
|
-
headers,
|
|
506
|
+
headers: withServerFunctionProof(headers),
|
|
485
507
|
body: formData
|
|
486
508
|
});
|
|
487
509
|
},
|
|
@@ -2308,6 +2330,6 @@ function resolveProjectId2(projectId) {
|
|
|
2308
2330
|
throw new Error("projectId \xE9 obrigat\xF3rio. Passe nas options ou configure via configureSdkMitra({ projectId }).");
|
|
2309
2331
|
}
|
|
2310
2332
|
|
|
2311
|
-
export { 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, resolveProjectId2 as resolveProjectId, runActionMitra, sendPasswordResetCodeMitra, setFileStatusMitra, setProfileActionsMitra, setProfileDmlTablesMitra, setProfileScreensMitra, setProfileSelectTablesMitra, setProfileServerFunctionsMitra, setProfileUsersMitra, setVariableMitra, stopServerFunctionExecutionMitra, updateProfileMitra, updateRecordMitra, uploadFileLoadableMitra, uploadFilePrivateMitra, uploadFilePublicMitra, validatePasswordResetCodeMitra };
|
|
2333
|
+
export { SF_EXECUTION_TOKEN_ENV, SF_EXECUTION_TOKEN_HEADER, 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, readServerFunctionProof, refreshTokenSilently, resetPasswordMitra, resolveProjectId2 as resolveProjectId, runActionMitra, sendPasswordResetCodeMitra, setFileStatusMitra, setProfileActionsMitra, setProfileDmlTablesMitra, setProfileScreensMitra, setProfileSelectTablesMitra, setProfileServerFunctionsMitra, setProfileUsersMitra, setVariableMitra, stopServerFunctionExecutionMitra, updateProfileMitra, updateRecordMitra, uploadFileLoadableMitra, uploadFilePrivateMitra, uploadFilePublicMitra, validatePasswordResetCodeMitra };
|
|
2312
2334
|
//# sourceMappingURL=index.mjs.map
|
|
2313
2335
|
//# sourceMappingURL=index.mjs.map
|