@xylex-group/athena 2.11.0 → 2.12.0
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 +1 -1
- package/dist/browser.cjs +296 -240
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +9 -8
- package/dist/browser.d.ts +9 -8
- package/dist/browser.js +296 -240
- package/dist/browser.js.map +1 -1
- package/dist/cli/index.cjs +269 -240
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.d.cts +4 -3
- package/dist/cli/index.d.ts +4 -3
- package/dist/cli/index.js +269 -240
- package/dist/cli/index.js.map +1 -1
- package/dist/{client-DD_UeF3Q.d.ts → client-C3x75Zgn.d.cts} +20 -9
- package/dist/{client-WqBuu60O.d.cts → client-QUbAs7E8.d.ts} +20 -9
- package/dist/index.cjs +296 -240
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -8
- package/dist/index.d.ts +9 -8
- package/dist/index.js +296 -240
- package/dist/index.js.map +1 -1
- package/dist/{model-form-DACdBLYG.d.cts → model-form-CD1uhWSh.d.cts} +2 -1
- package/dist/{model-form-ByvyyvxB.d.ts → model-form-Dm69I-oO.d.ts} +2 -1
- package/dist/{module-DRkIHtY-.d.ts → module-CW3tWJ10.d.ts} +5 -4
- package/dist/{module-BFMyVmwX.d.cts → module-Cxcurfes.d.cts} +5 -4
- package/dist/next/client.cjs +296 -240
- package/dist/next/client.cjs.map +1 -1
- package/dist/next/client.d.cts +4 -3
- package/dist/next/client.d.ts +4 -3
- package/dist/next/client.js +296 -240
- package/dist/next/client.js.map +1 -1
- package/dist/next/server.cjs +296 -240
- package/dist/next/server.cjs.map +1 -1
- package/dist/next/server.d.cts +4 -3
- package/dist/next/server.d.ts +4 -3
- package/dist/next/server.js +296 -240
- package/dist/next/server.js.map +1 -1
- package/dist/{pipeline-CmUZsXsi.d.cts → pipeline-B14jVK7J.d.cts} +1 -1
- package/dist/{pipeline-DZMsPxUg.d.ts → pipeline-BAwb6Vzm.d.ts} +1 -1
- package/dist/react.cjs +234 -98
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +5 -4
- package/dist/react.d.ts +5 -4
- package/dist/react.js +234 -98
- package/dist/react.js.map +1 -1
- package/dist/{shared-GPAprhBb.d.ts → shared-0Kdc74lu.d.ts} +2 -2
- package/dist/{shared-B1ueL-Ox.d.cts → shared-C0wVICRv.d.cts} +2 -2
- package/dist/{types-C-YvfgYh.d.cts → types-BcVmPBP-.d.ts} +2 -1
- package/dist/types-Cq4-NoB4.d.ts +204 -0
- package/dist/types-CwJCPpLD.d.cts +236 -0
- package/dist/types-CwJCPpLD.d.ts +236 -0
- package/dist/{types-CRjDwmtJ.d.ts → types-DMOoYnPS.d.cts} +2 -1
- package/dist/types-Dr849HD6.d.cts +204 -0
- package/dist/utils.cjs +276 -0
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +58 -1
- package/dist/utils.d.ts +58 -1
- package/dist/utils.js +269 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/dist/types-BeZIHduP.d.cts +0 -428
- package/dist/types-BeZIHduP.d.ts +0 -428
package/dist/index.cjs
CHANGED
|
@@ -804,42 +804,31 @@ var getCookieCache = async (request2, config) => {
|
|
|
804
804
|
};
|
|
805
805
|
};
|
|
806
806
|
|
|
807
|
-
//
|
|
808
|
-
var package_default = {
|
|
809
|
-
version: "2.11.0"
|
|
810
|
-
};
|
|
811
|
-
|
|
812
|
-
// src/sdk-version.ts
|
|
813
|
-
var PACKAGE_VERSION = package_default.version;
|
|
814
|
-
function buildSdkHeaderValue(sdkName) {
|
|
815
|
-
return `${sdkName} ${PACKAGE_VERSION}`;
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
// src/gateway/client.ts
|
|
819
|
-
var DEFAULT_CLIENT = "railway_direct";
|
|
820
|
-
var SDK_NAME = "xylex-group/athena";
|
|
821
|
-
var SDK_HEADER_VALUE = buildSdkHeaderValue(SDK_NAME);
|
|
807
|
+
// src/utils/athena-request-headers.ts
|
|
822
808
|
var NO_CACHE_HEADER_VALUE = "no-cache";
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
}
|
|
809
|
+
var API_KEY_HEADER_CANDIDATES = ["x-api-key", "apikey"];
|
|
810
|
+
var ATHENA_KEY_HEADER_CANDIDATES = ["X-Athena-Key", "x-athena-key"];
|
|
811
|
+
var SESSION_TOKEN_HEADER_CANDIDATES = ["X-Athena-Auth-Session-Token"];
|
|
812
|
+
var BEARER_MIRROR_HEADER_CANDIDATES = ["X-Athena-Auth-Bearer-Token"];
|
|
813
|
+
var CLIENT_HEADER_CANDIDATES = ["X-Athena-Client", "x-athena-client"];
|
|
814
|
+
var PG_URI_HEADER_CANDIDATES = ["x-pg-uri"];
|
|
815
|
+
var JDBC_URI_HEADER_CANDIDATES = ["x-athena-jdbc-url", "x-jdbc-url"];
|
|
816
|
+
var PROFILE_RULES = {
|
|
817
|
+
gateway: { apiKeys: true, routing: true, authMirror: true, authBearer: false, contentType: true, stripNullsDefault: true },
|
|
818
|
+
chat: { apiKeys: true, routing: true, authMirror: true, authBearer: true, accept: true },
|
|
819
|
+
storage: { apiKeys: true, routing: true, authMirror: true, authBearer: false, contentType: true },
|
|
820
|
+
auth: { apiKeys: true, routing: false, authMirror: false, authBearer: true, contentType: true },
|
|
821
|
+
minimal: { apiKeys: false, routing: false, authMirror: false, authBearer: false }
|
|
822
|
+
};
|
|
838
823
|
function normalizeHeaderValue(value) {
|
|
839
824
|
return value ? value : void 0;
|
|
840
825
|
}
|
|
841
|
-
function
|
|
842
|
-
return
|
|
826
|
+
function mergeExtraHeaders(configHeaders, callHeaders) {
|
|
827
|
+
return { ...configHeaders ?? {}, ...callHeaders ?? {} };
|
|
828
|
+
}
|
|
829
|
+
function hasHeaderIgnoreCase(headers, targetKey) {
|
|
830
|
+
const normalizedTargetKey = targetKey.toLowerCase();
|
|
831
|
+
return Object.keys(headers).some((key) => key.toLowerCase() === normalizedTargetKey);
|
|
843
832
|
}
|
|
844
833
|
function resolveHeaderValue(headers, candidates) {
|
|
845
834
|
for (const candidate of candidates) {
|
|
@@ -856,13 +845,20 @@ function resolveHeaderValue(headers, candidates) {
|
|
|
856
845
|
}
|
|
857
846
|
return void 0;
|
|
858
847
|
}
|
|
848
|
+
function isCacheControlHeaderName(name) {
|
|
849
|
+
return name.toLowerCase() === "cache-control";
|
|
850
|
+
}
|
|
851
|
+
function normalizeBearerToken(value) {
|
|
852
|
+
const trimmed = value.trim();
|
|
853
|
+
const match = trimmed.match(/^Bearer\s+(.+)$/i);
|
|
854
|
+
return match?.[1]?.trim() ?? trimmed;
|
|
855
|
+
}
|
|
859
856
|
function resolveBearerTokenFromAuthorizationHeader(headers) {
|
|
860
857
|
const authorization = resolveHeaderValue(headers, ["Authorization"]);
|
|
861
858
|
if (!authorization) {
|
|
862
859
|
return void 0;
|
|
863
860
|
}
|
|
864
|
-
const
|
|
865
|
-
const token = match?.[1]?.trim();
|
|
861
|
+
const token = normalizeBearerToken(authorization);
|
|
866
862
|
return token ? token : void 0;
|
|
867
863
|
}
|
|
868
864
|
function resolveSessionTokenFromCookieHeader(headers) {
|
|
@@ -872,6 +868,207 @@ function resolveSessionTokenFromCookieHeader(headers) {
|
|
|
872
868
|
}
|
|
873
869
|
return getSessionCookie(new Headers({ cookie })) ?? void 0;
|
|
874
870
|
}
|
|
871
|
+
function resolveBackendType(backend) {
|
|
872
|
+
if (!backend) {
|
|
873
|
+
return void 0;
|
|
874
|
+
}
|
|
875
|
+
return typeof backend === "string" ? backend : backend.type;
|
|
876
|
+
}
|
|
877
|
+
function resolveRequestHeaderOverrides(config, options, defaults) {
|
|
878
|
+
return {
|
|
879
|
+
apiKey: options?.apiKey ?? config.apiKey,
|
|
880
|
+
athenaKey: options?.athenaKey ?? config.athenaKey,
|
|
881
|
+
client: options?.client ?? config.client ?? defaults?.client,
|
|
882
|
+
userId: options?.userId ?? config.userId,
|
|
883
|
+
organizationId: options?.organizationId ?? config.organizationId,
|
|
884
|
+
backend: options?.backend ?? config.backend,
|
|
885
|
+
publishEvent: options?.publishEvent ?? config.publishEvent,
|
|
886
|
+
stripNulls: options?.stripNulls ?? config.stripNulls ?? defaults?.stripNulls,
|
|
887
|
+
bearerToken: options?.bearerToken ?? config.bearerToken,
|
|
888
|
+
cookie: options?.cookie ?? config.cookie,
|
|
889
|
+
sessionToken: options?.sessionToken ?? config.sessionToken,
|
|
890
|
+
pgUri: options?.pgUri ?? config.pgUri,
|
|
891
|
+
jdbcUrl: options?.jdbcUrl ?? config.jdbcUrl,
|
|
892
|
+
forceNoCache: Boolean(config.forceNoCache || options?.forceNoCache),
|
|
893
|
+
configHeaders: config.headers,
|
|
894
|
+
callHeaders: options?.headers
|
|
895
|
+
};
|
|
896
|
+
}
|
|
897
|
+
function buildServiceRequestHeaders(profile, sdkHeaderValue, config, options, extras) {
|
|
898
|
+
const rules = PROFILE_RULES[profile];
|
|
899
|
+
return buildAthenaRequestHeaders({
|
|
900
|
+
profile,
|
|
901
|
+
sdkHeaderValue,
|
|
902
|
+
...resolveRequestHeaderOverrides(config, options, {
|
|
903
|
+
client: extras?.client ?? void 0,
|
|
904
|
+
stripNulls: extras?.stripNulls ?? (rules.stripNullsDefault ? true : void 0)
|
|
905
|
+
}),
|
|
906
|
+
contentType: extras?.contentType ?? (rules.contentType ? "application/json" : void 0),
|
|
907
|
+
accept: extras?.accept ?? (rules.accept ? "application/json" : void 0)
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
function applyAthenaApiKeyHeaders(headers, apiKey, athenaKey) {
|
|
911
|
+
if (apiKey) {
|
|
912
|
+
if (!hasHeaderIgnoreCase(headers, "apikey")) {
|
|
913
|
+
headers.apikey = apiKey;
|
|
914
|
+
}
|
|
915
|
+
if (!hasHeaderIgnoreCase(headers, "x-api-key")) {
|
|
916
|
+
headers["x-api-key"] = apiKey;
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
const resolvedAthenaKey = normalizeHeaderValue(athenaKey) ?? normalizeHeaderValue(apiKey);
|
|
920
|
+
if (resolvedAthenaKey && !hasHeaderIgnoreCase(headers, "X-Athena-Key")) {
|
|
921
|
+
headers["X-Athena-Key"] = resolvedAthenaKey;
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
function applyAthenaAuthContextHeaders(headers, input) {
|
|
925
|
+
const mergedExtraHeaders = mergeExtraHeaders(input.configHeaders, input.callHeaders);
|
|
926
|
+
const rules = PROFILE_RULES[input.profile];
|
|
927
|
+
const explicitCookie = normalizeHeaderValue(input.cookie);
|
|
928
|
+
if (explicitCookie) {
|
|
929
|
+
mergedExtraHeaders.Cookie = explicitCookie;
|
|
930
|
+
}
|
|
931
|
+
const explicitSessionToken = normalizeHeaderValue(input.sessionToken) ?? resolveHeaderValue(mergedExtraHeaders, SESSION_TOKEN_HEADER_CANDIDATES);
|
|
932
|
+
const derivedSessionToken = explicitSessionToken ?? resolveSessionTokenFromCookieHeader(mergedExtraHeaders);
|
|
933
|
+
const cookieFromHeaders = resolveHeaderValue(mergedExtraHeaders, ["Cookie"]);
|
|
934
|
+
if (explicitCookie && !hasHeaderIgnoreCase(headers, "Cookie")) {
|
|
935
|
+
headers.Cookie = explicitCookie;
|
|
936
|
+
} else if (cookieFromHeaders && !hasHeaderIgnoreCase(headers, "Cookie")) {
|
|
937
|
+
headers.Cookie = cookieFromHeaders;
|
|
938
|
+
}
|
|
939
|
+
const explicitBearerToken = (() => {
|
|
940
|
+
const configured = normalizeHeaderValue(input.bearerToken);
|
|
941
|
+
if (configured) {
|
|
942
|
+
return normalizeBearerToken(configured);
|
|
943
|
+
}
|
|
944
|
+
const mirrored = resolveHeaderValue(mergedExtraHeaders, BEARER_MIRROR_HEADER_CANDIDATES);
|
|
945
|
+
return mirrored ? normalizeBearerToken(mirrored) : void 0;
|
|
946
|
+
})();
|
|
947
|
+
const derivedBearerToken = explicitBearerToken ?? resolveBearerTokenFromAuthorizationHeader(mergedExtraHeaders);
|
|
948
|
+
if (rules.authBearer && derivedBearerToken && !hasHeaderIgnoreCase(headers, "Authorization")) {
|
|
949
|
+
headers.Authorization = `Bearer ${derivedBearerToken}`;
|
|
950
|
+
}
|
|
951
|
+
if (rules.authMirror) {
|
|
952
|
+
if (derivedSessionToken && !hasHeaderIgnoreCase(headers, "X-Athena-Auth-Session-Token")) {
|
|
953
|
+
headers["X-Athena-Auth-Session-Token"] = derivedSessionToken;
|
|
954
|
+
}
|
|
955
|
+
if (derivedBearerToken && !hasHeaderIgnoreCase(headers, "X-Athena-Auth-Bearer-Token")) {
|
|
956
|
+
headers["X-Athena-Auth-Bearer-Token"] = derivedBearerToken;
|
|
957
|
+
}
|
|
958
|
+
} else if (derivedSessionToken && !hasHeaderIgnoreCase(headers, "X-Athena-Auth-Session-Token")) {
|
|
959
|
+
headers["X-Athena-Auth-Session-Token"] = derivedSessionToken;
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
function applyAthenaPgUriHeaders(headers, input) {
|
|
963
|
+
const mergedExtraHeaders = mergeExtraHeaders(input.configHeaders, input.callHeaders);
|
|
964
|
+
const pgUri = normalizeHeaderValue(input.pgUri) ?? resolveHeaderValue(mergedExtraHeaders, PG_URI_HEADER_CANDIDATES);
|
|
965
|
+
if (pgUri && !hasHeaderIgnoreCase(headers, "x-pg-uri")) {
|
|
966
|
+
headers["x-pg-uri"] = pgUri;
|
|
967
|
+
}
|
|
968
|
+
const jdbcUrl = normalizeHeaderValue(input.jdbcUrl) ?? resolveHeaderValue(mergedExtraHeaders, JDBC_URI_HEADER_CANDIDATES);
|
|
969
|
+
if (jdbcUrl) {
|
|
970
|
+
if (!hasHeaderIgnoreCase(headers, "x-athena-jdbc-url")) {
|
|
971
|
+
headers["x-athena-jdbc-url"] = jdbcUrl;
|
|
972
|
+
}
|
|
973
|
+
if (!hasHeaderIgnoreCase(headers, "x-jdbc-url")) {
|
|
974
|
+
headers["x-jdbc-url"] = jdbcUrl;
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
function buildAthenaRequestHeaders(input) {
|
|
979
|
+
const forceNoCache = Boolean(input.forceNoCache);
|
|
980
|
+
const mergedExtraHeaders = mergeExtraHeaders(input.configHeaders, input.callHeaders);
|
|
981
|
+
const rules = PROFILE_RULES[input.profile];
|
|
982
|
+
const headerClient = resolveHeaderValue(mergedExtraHeaders, CLIENT_HEADER_CANDIDATES);
|
|
983
|
+
const finalClient = normalizeHeaderValue(input.client) ?? headerClient;
|
|
984
|
+
const finalApiKey = normalizeHeaderValue(input.apiKey) ?? resolveHeaderValue(mergedExtraHeaders, API_KEY_HEADER_CANDIDATES);
|
|
985
|
+
const finalAthenaKey = normalizeHeaderValue(input.athenaKey) ?? resolveHeaderValue(mergedExtraHeaders, ATHENA_KEY_HEADER_CANDIDATES) ?? finalApiKey;
|
|
986
|
+
const headers = {
|
|
987
|
+
"X-Athena-Sdk": input.sdkHeaderValue
|
|
988
|
+
};
|
|
989
|
+
if (rules.contentType) {
|
|
990
|
+
headers["Content-Type"] = input.contentType ?? "application/json";
|
|
991
|
+
}
|
|
992
|
+
if (input.accept ?? rules.accept) {
|
|
993
|
+
headers.Accept = input.accept ?? "application/json";
|
|
994
|
+
}
|
|
995
|
+
if (rules.routing) {
|
|
996
|
+
if (normalizeHeaderValue(input.userId)) {
|
|
997
|
+
headers["X-User-Id"] = input.userId ?? "";
|
|
998
|
+
}
|
|
999
|
+
if (normalizeHeaderValue(input.organizationId)) {
|
|
1000
|
+
headers["X-Organization-Id"] = input.organizationId ?? "";
|
|
1001
|
+
}
|
|
1002
|
+
if (finalClient) {
|
|
1003
|
+
headers["X-Athena-Client"] = finalClient;
|
|
1004
|
+
}
|
|
1005
|
+
const backendType = resolveBackendType(input.backend);
|
|
1006
|
+
if (backendType) {
|
|
1007
|
+
headers["X-Backend-Type"] = backendType;
|
|
1008
|
+
}
|
|
1009
|
+
if (typeof input.stripNulls === "boolean") {
|
|
1010
|
+
headers["X-Strip-Nulls"] = input.stripNulls ? "true" : "false";
|
|
1011
|
+
} else if (rules.stripNullsDefault) {
|
|
1012
|
+
headers["X-Strip-Nulls"] = "true";
|
|
1013
|
+
}
|
|
1014
|
+
if (normalizeHeaderValue(input.publishEvent)) {
|
|
1015
|
+
headers["X-Publish-Event"] = input.publishEvent ?? "";
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
if (rules.apiKeys && (finalApiKey || finalAthenaKey)) {
|
|
1019
|
+
applyAthenaApiKeyHeaders(headers, finalApiKey, finalAthenaKey);
|
|
1020
|
+
}
|
|
1021
|
+
applyAthenaAuthContextHeaders(headers, input);
|
|
1022
|
+
applyAthenaPgUriHeaders(headers, input);
|
|
1023
|
+
const reservedClientHeaderKeys = new Set(CLIENT_HEADER_CANDIDATES.map((key) => key.toLowerCase()));
|
|
1024
|
+
Object.entries(mergedExtraHeaders).forEach(([key, value]) => {
|
|
1025
|
+
if (reservedClientHeaderKeys.has(key.toLowerCase())) {
|
|
1026
|
+
return;
|
|
1027
|
+
}
|
|
1028
|
+
if (forceNoCache && isCacheControlHeaderName(key)) {
|
|
1029
|
+
return;
|
|
1030
|
+
}
|
|
1031
|
+
const normalized = normalizeHeaderValue(value);
|
|
1032
|
+
if (normalized) {
|
|
1033
|
+
headers[key] = normalized;
|
|
1034
|
+
}
|
|
1035
|
+
});
|
|
1036
|
+
if (forceNoCache) {
|
|
1037
|
+
headers["Cache-Control"] = NO_CACHE_HEADER_VALUE;
|
|
1038
|
+
}
|
|
1039
|
+
return headers;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
// package.json
|
|
1043
|
+
var package_default = {
|
|
1044
|
+
version: "2.12.0"
|
|
1045
|
+
};
|
|
1046
|
+
|
|
1047
|
+
// src/sdk-version.ts
|
|
1048
|
+
var PACKAGE_VERSION = package_default.version;
|
|
1049
|
+
function buildSdkHeaderValue(sdkName) {
|
|
1050
|
+
return `${sdkName} ${PACKAGE_VERSION}`;
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
// src/gateway/client.ts
|
|
1054
|
+
var DEFAULT_CLIENT = "railway_direct";
|
|
1055
|
+
var SDK_NAME = "xylex-group/athena";
|
|
1056
|
+
var SDK_HEADER_VALUE = buildSdkHeaderValue(SDK_NAME);
|
|
1057
|
+
function parseResponseBody(rawText, contentType) {
|
|
1058
|
+
if (!rawText) {
|
|
1059
|
+
return { parsed: null, parseFailed: false };
|
|
1060
|
+
}
|
|
1061
|
+
const contentTypeSuggestsJson = contentType?.toLowerCase().includes("application/json") ?? false;
|
|
1062
|
+
const looksJson = contentTypeSuggestsJson || rawText.startsWith("{") || rawText.startsWith("[");
|
|
1063
|
+
if (!looksJson) {
|
|
1064
|
+
return { parsed: rawText, parseFailed: false };
|
|
1065
|
+
}
|
|
1066
|
+
try {
|
|
1067
|
+
return { parsed: JSON.parse(rawText), parseFailed: false };
|
|
1068
|
+
} catch {
|
|
1069
|
+
return { parsed: rawText, parseFailed: true };
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
875
1072
|
function isRecord(value) {
|
|
876
1073
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
877
1074
|
}
|
|
@@ -998,71 +1195,10 @@ function buildRpcGetEndpoint(payload) {
|
|
|
998
1195
|
return withQuery;
|
|
999
1196
|
}
|
|
1000
1197
|
function buildHeaders(config, options) {
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
...config.headers ?? {},
|
|
1005
|
-
...options?.headers ?? {}
|
|
1006
|
-
};
|
|
1007
|
-
const headerClient = extraHeaders["x-athena-client"] ?? extraHeaders["X-Athena-Client"];
|
|
1008
|
-
const finalClient = options?.client ?? config.client ?? (typeof headerClient === "string" ? headerClient : void 0) ?? DEFAULT_CLIENT;
|
|
1009
|
-
const finalApiKey = options?.apiKey ?? config.apiKey;
|
|
1010
|
-
const finalPublishEvent = options?.publishEvent ?? config.publishEvent;
|
|
1011
|
-
const headers = {
|
|
1012
|
-
"Content-Type": "application/json",
|
|
1013
|
-
"X-Athena-Sdk": SDK_HEADER_VALUE
|
|
1014
|
-
};
|
|
1015
|
-
if (options?.userId ?? config.userId) {
|
|
1016
|
-
headers["X-User-Id"] = options?.userId ?? config.userId ?? "";
|
|
1017
|
-
}
|
|
1018
|
-
if (options?.organizationId ?? config.organizationId) {
|
|
1019
|
-
headers["X-Organization-Id"] = options?.organizationId ?? config.organizationId ?? "";
|
|
1020
|
-
}
|
|
1021
|
-
if (finalClient) {
|
|
1022
|
-
headers["X-Athena-Client"] = finalClient;
|
|
1023
|
-
}
|
|
1024
|
-
const finalBackend = options?.backend ?? config.backend;
|
|
1025
|
-
if (finalBackend) {
|
|
1026
|
-
const type = typeof finalBackend === "string" ? finalBackend : finalBackend.type;
|
|
1027
|
-
if (type) headers["X-Backend-Type"] = type;
|
|
1028
|
-
}
|
|
1029
|
-
if (typeof mergedStripNulls === "boolean") {
|
|
1030
|
-
headers["X-Strip-Nulls"] = mergedStripNulls ? "true" : "false";
|
|
1031
|
-
}
|
|
1032
|
-
if (finalPublishEvent) {
|
|
1033
|
-
headers["X-Publish-Event"] = finalPublishEvent;
|
|
1034
|
-
}
|
|
1035
|
-
if (finalApiKey) {
|
|
1036
|
-
headers["apikey"] = finalApiKey;
|
|
1037
|
-
headers["x-api-key"] = headers["x-api-key"] ?? finalApiKey;
|
|
1038
|
-
}
|
|
1039
|
-
const explicitSessionToken = resolveHeaderValue(extraHeaders, [
|
|
1040
|
-
"X-Athena-Auth-Session-Token"
|
|
1041
|
-
]);
|
|
1042
|
-
const derivedSessionToken = explicitSessionToken ?? resolveSessionTokenFromCookieHeader(extraHeaders);
|
|
1043
|
-
if (derivedSessionToken) {
|
|
1044
|
-
headers["X-Athena-Auth-Session-Token"] = derivedSessionToken;
|
|
1045
|
-
}
|
|
1046
|
-
const explicitBearerToken = resolveHeaderValue(extraHeaders, [
|
|
1047
|
-
"X-Athena-Auth-Bearer-Token"
|
|
1048
|
-
]);
|
|
1049
|
-
const derivedBearerToken = explicitBearerToken ?? resolveBearerTokenFromAuthorizationHeader(extraHeaders);
|
|
1050
|
-
if (derivedBearerToken) {
|
|
1051
|
-
headers["X-Athena-Auth-Bearer-Token"] = derivedBearerToken;
|
|
1052
|
-
}
|
|
1053
|
-
const athenaClientKeys = ["x-athena-client", "X-Athena-Client"];
|
|
1054
|
-
Object.entries(extraHeaders).forEach(([key, value]) => {
|
|
1055
|
-
if (athenaClientKeys.includes(key)) return;
|
|
1056
|
-
if (forceNoCache && isCacheControlHeaderName(key)) return;
|
|
1057
|
-
const normalized = normalizeHeaderValue(value);
|
|
1058
|
-
if (normalized) {
|
|
1059
|
-
headers[key] = normalized;
|
|
1060
|
-
}
|
|
1198
|
+
return buildServiceRequestHeaders("gateway", SDK_HEADER_VALUE, config, options, {
|
|
1199
|
+
client: options?.client ?? config.client ?? DEFAULT_CLIENT,
|
|
1200
|
+
stripNulls: options?.stripNulls ?? true
|
|
1061
1201
|
});
|
|
1062
|
-
if (forceNoCache) {
|
|
1063
|
-
headers["Cache-Control"] = NO_CACHE_HEADER_VALUE;
|
|
1064
|
-
}
|
|
1065
|
-
return headers;
|
|
1066
1202
|
}
|
|
1067
1203
|
function toInvalidUrlResponse(error, endpoint, method) {
|
|
1068
1204
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -1790,19 +1926,12 @@ async function resolveReactEmailPayloadFields(input, fields, options) {
|
|
|
1790
1926
|
var DEFAULT_AUTH_BASE_URL = "http://localhost:3001/api/auth";
|
|
1791
1927
|
var SDK_NAME2 = "xylex-group/athena-auth";
|
|
1792
1928
|
var SDK_HEADER_VALUE2 = buildSdkHeaderValue(SDK_NAME2);
|
|
1793
|
-
var NO_CACHE_HEADER_VALUE2 = "no-cache";
|
|
1794
1929
|
function normalizeBaseUrl(baseUrl) {
|
|
1795
1930
|
return (baseUrl ?? DEFAULT_AUTH_BASE_URL).replace(/\/$/, "");
|
|
1796
1931
|
}
|
|
1797
1932
|
function isRecord3(value) {
|
|
1798
1933
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
1799
1934
|
}
|
|
1800
|
-
function normalizeHeaderValue2(value) {
|
|
1801
|
-
return value ? value : void 0;
|
|
1802
|
-
}
|
|
1803
|
-
function isCacheControlHeaderName2(name) {
|
|
1804
|
-
return name.toLowerCase() === "cache-control";
|
|
1805
|
-
}
|
|
1806
1935
|
function parseResponseBody2(rawText, contentType) {
|
|
1807
1936
|
if (!rawText) {
|
|
1808
1937
|
return { parsed: null, parseFailed: false };
|
|
@@ -2002,45 +2131,7 @@ function extractFetchOptions(input) {
|
|
|
2002
2131
|
};
|
|
2003
2132
|
}
|
|
2004
2133
|
function buildHeaders2(config, options) {
|
|
2005
|
-
|
|
2006
|
-
const headers = {
|
|
2007
|
-
"Content-Type": "application/json",
|
|
2008
|
-
"X-Athena-Sdk": SDK_HEADER_VALUE2
|
|
2009
|
-
};
|
|
2010
|
-
const apiKey = options?.apiKey ?? config.apiKey;
|
|
2011
|
-
if (apiKey) {
|
|
2012
|
-
headers.apikey = apiKey;
|
|
2013
|
-
headers["x-api-key"] = apiKey;
|
|
2014
|
-
}
|
|
2015
|
-
const bearerToken = options?.bearerToken ?? config.bearerToken;
|
|
2016
|
-
if (bearerToken) {
|
|
2017
|
-
headers.Authorization = `Bearer ${bearerToken}`;
|
|
2018
|
-
}
|
|
2019
|
-
const cookie = options?.cookie ?? config.cookie;
|
|
2020
|
-
if (cookie) {
|
|
2021
|
-
headers.Cookie = cookie;
|
|
2022
|
-
}
|
|
2023
|
-
const sessionToken = options?.sessionToken ?? config.sessionToken;
|
|
2024
|
-
if (sessionToken) {
|
|
2025
|
-
headers["X-Athena-Auth-Session-Token"] = sessionToken;
|
|
2026
|
-
}
|
|
2027
|
-
const mergedExtraHeaders = {
|
|
2028
|
-
...config.headers ?? {},
|
|
2029
|
-
...options?.headers ?? {}
|
|
2030
|
-
};
|
|
2031
|
-
Object.entries(mergedExtraHeaders).forEach(([key, value]) => {
|
|
2032
|
-
if (forceNoCache && isCacheControlHeaderName2(key)) {
|
|
2033
|
-
return;
|
|
2034
|
-
}
|
|
2035
|
-
const normalized = normalizeHeaderValue2(value);
|
|
2036
|
-
if (normalized) {
|
|
2037
|
-
headers[key] = normalized;
|
|
2038
|
-
}
|
|
2039
|
-
});
|
|
2040
|
-
if (forceNoCache) {
|
|
2041
|
-
headers["Cache-Control"] = NO_CACHE_HEADER_VALUE2;
|
|
2042
|
-
}
|
|
2043
|
-
return headers;
|
|
2134
|
+
return buildServiceRequestHeaders("auth", SDK_HEADER_VALUE2, config, options);
|
|
2044
2135
|
}
|
|
2045
2136
|
function appendQueryParam(searchParams, key, value) {
|
|
2046
2137
|
if (value === void 0 || value === null) return;
|
|
@@ -5719,7 +5810,6 @@ function createStorageModule(gateway, runtimeOptions) {
|
|
|
5719
5810
|
// src/chat/module.ts
|
|
5720
5811
|
var SDK_NAME3 = "xylex-group/athena-chat";
|
|
5721
5812
|
var SDK_HEADER_VALUE3 = buildSdkHeaderValue(SDK_NAME3);
|
|
5722
|
-
var NO_CACHE_HEADER_VALUE3 = "no-cache";
|
|
5723
5813
|
var AthenaChatError = class extends Error {
|
|
5724
5814
|
status;
|
|
5725
5815
|
endpoint;
|
|
@@ -5765,9 +5855,6 @@ function normalizeWsUrl(value, label) {
|
|
|
5765
5855
|
function isRecord7(value) {
|
|
5766
5856
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
5767
5857
|
}
|
|
5768
|
-
function normalizeHeaderValue3(value) {
|
|
5769
|
-
return value ? value : void 0;
|
|
5770
|
-
}
|
|
5771
5858
|
function parseResponseBody4(rawText, contentType) {
|
|
5772
5859
|
if (!rawText) {
|
|
5773
5860
|
return { parsed: null, parseFailed: false };
|
|
@@ -5839,39 +5926,7 @@ function createSocket(factory, url, protocols) {
|
|
|
5839
5926
|
}
|
|
5840
5927
|
}
|
|
5841
5928
|
function buildHeaders3(config, options) {
|
|
5842
|
-
|
|
5843
|
-
Accept: "application/json",
|
|
5844
|
-
apikey: config.apiKey,
|
|
5845
|
-
"x-api-key": config.apiKey,
|
|
5846
|
-
"X-Athena-Sdk": SDK_HEADER_VALUE3
|
|
5847
|
-
};
|
|
5848
|
-
if (config.client || options?.client) {
|
|
5849
|
-
headers["X-Athena-Client"] = options?.client ?? config.client ?? "";
|
|
5850
|
-
}
|
|
5851
|
-
const bearerToken = options?.bearerToken ?? config.bearerToken;
|
|
5852
|
-
if (typeof bearerToken === "string" && bearerToken.trim()) {
|
|
5853
|
-
headers.Authorization = bearerToken.startsWith("Bearer ") ? bearerToken : `Bearer ${bearerToken}`;
|
|
5854
|
-
}
|
|
5855
|
-
const cookie = options?.cookie ?? config.cookie;
|
|
5856
|
-
if (typeof cookie === "string" && cookie.trim()) {
|
|
5857
|
-
headers.Cookie = cookie;
|
|
5858
|
-
}
|
|
5859
|
-
const sessionToken = options?.sessionToken ?? config.sessionToken;
|
|
5860
|
-
if (typeof sessionToken === "string" && sessionToken.trim()) {
|
|
5861
|
-
headers["X-Athena-Auth-Session-Token"] = sessionToken;
|
|
5862
|
-
}
|
|
5863
|
-
if (config.forceNoCache || options?.forceNoCache) {
|
|
5864
|
-
headers["Cache-Control"] = NO_CACHE_HEADER_VALUE3;
|
|
5865
|
-
}
|
|
5866
|
-
for (const source of [config.headers, options?.headers]) {
|
|
5867
|
-
for (const [key, value] of Object.entries(source ?? {})) {
|
|
5868
|
-
const normalized = normalizeHeaderValue3(value);
|
|
5869
|
-
if (normalized) {
|
|
5870
|
-
headers[key] = normalized;
|
|
5871
|
-
}
|
|
5872
|
-
}
|
|
5873
|
-
}
|
|
5874
|
-
return headers;
|
|
5929
|
+
return buildServiceRequestHeaders("chat", SDK_HEADER_VALUE3, config, options);
|
|
5875
5930
|
}
|
|
5876
5931
|
function withJsonBody(init, body) {
|
|
5877
5932
|
return {
|
|
@@ -6283,6 +6338,9 @@ var AthenaClientBuilderImpl = class {
|
|
|
6283
6338
|
defaultOrganizationId;
|
|
6284
6339
|
forceNoCacheEnabled = false;
|
|
6285
6340
|
defaultHeaders;
|
|
6341
|
+
pgUriValue;
|
|
6342
|
+
jdbcUrlValue;
|
|
6343
|
+
athenaKeyValue;
|
|
6286
6344
|
authConfig;
|
|
6287
6345
|
dbUrlOverride;
|
|
6288
6346
|
gatewayUrlOverride;
|
|
@@ -6309,6 +6367,18 @@ var AthenaClientBuilderImpl = class {
|
|
|
6309
6367
|
this.defaultHeaders = headers;
|
|
6310
6368
|
return this;
|
|
6311
6369
|
}
|
|
6370
|
+
pgUri(pgUri) {
|
|
6371
|
+
this.pgUriValue = pgUri;
|
|
6372
|
+
return this;
|
|
6373
|
+
}
|
|
6374
|
+
jdbcUrl(jdbcUrl) {
|
|
6375
|
+
this.jdbcUrlValue = jdbcUrl;
|
|
6376
|
+
return this;
|
|
6377
|
+
}
|
|
6378
|
+
athenaKey(athenaKey) {
|
|
6379
|
+
this.athenaKeyValue = athenaKey;
|
|
6380
|
+
return this;
|
|
6381
|
+
}
|
|
6312
6382
|
auth(config) {
|
|
6313
6383
|
this.authConfig = mergeAuthClientConfig(this.authConfig, config);
|
|
6314
6384
|
return this;
|
|
@@ -6345,6 +6415,15 @@ var AthenaClientBuilderImpl = class {
|
|
|
6345
6415
|
if (options.headers !== void 0) {
|
|
6346
6416
|
this.defaultHeaders = mergeHeaders(this.defaultHeaders, options.headers);
|
|
6347
6417
|
}
|
|
6418
|
+
if (options.pgUri !== void 0) {
|
|
6419
|
+
this.pgUriValue = options.pgUri;
|
|
6420
|
+
}
|
|
6421
|
+
if (options.jdbcUrl !== void 0) {
|
|
6422
|
+
this.jdbcUrlValue = options.jdbcUrl;
|
|
6423
|
+
}
|
|
6424
|
+
if (options.athenaKey !== void 0) {
|
|
6425
|
+
this.athenaKeyValue = options.athenaKey;
|
|
6426
|
+
}
|
|
6348
6427
|
if (options.auth !== void 0) {
|
|
6349
6428
|
this.authConfig = mergeAuthClientConfig(this.authConfig, options.auth);
|
|
6350
6429
|
}
|
|
@@ -6396,6 +6475,9 @@ var AthenaClientBuilderImpl = class {
|
|
|
6396
6475
|
userId: this.defaultUserId,
|
|
6397
6476
|
organizationId: this.defaultOrganizationId,
|
|
6398
6477
|
forceNoCache: this.forceNoCacheEnabled,
|
|
6478
|
+
pgUri: this.pgUriValue,
|
|
6479
|
+
jdbcUrl: this.jdbcUrlValue,
|
|
6480
|
+
athenaKey: this.athenaKeyValue,
|
|
6399
6481
|
backend: this.backendConfig,
|
|
6400
6482
|
headers: this.defaultHeaders,
|
|
6401
6483
|
db: this.dbUrlOverride ? { url: this.dbUrlOverride } : void 0,
|
|
@@ -9108,10 +9190,6 @@ function resolveRequiredClientApiKey(value) {
|
|
|
9108
9190
|
}
|
|
9109
9191
|
return normalizedValue;
|
|
9110
9192
|
}
|
|
9111
|
-
function hasHeaderIgnoreCase(headers, targetKey) {
|
|
9112
|
-
const normalizedTargetKey = targetKey.toLowerCase();
|
|
9113
|
-
return Object.keys(headers).some((key) => key.toLowerCase() === normalizedTargetKey);
|
|
9114
|
-
}
|
|
9115
9193
|
function mergeClientHeaders(current, next) {
|
|
9116
9194
|
if (!current && !next) {
|
|
9117
9195
|
return void 0;
|
|
@@ -9242,6 +9320,9 @@ function resolveCreateClientConfig(config) {
|
|
|
9242
9320
|
userId: config.userId,
|
|
9243
9321
|
organizationId: config.organizationId,
|
|
9244
9322
|
forceNoCache: config.forceNoCache,
|
|
9323
|
+
pgUri: config.pgUri,
|
|
9324
|
+
jdbcUrl: config.jdbcUrl,
|
|
9325
|
+
athenaKey: config.athenaKey,
|
|
9245
9326
|
backend: toBackendConfig(config.backend),
|
|
9246
9327
|
headers: config.headers,
|
|
9247
9328
|
auth: config.auth,
|
|
@@ -9258,18 +9339,6 @@ function createClientFromInput(sourceConfig) {
|
|
|
9258
9339
|
}
|
|
9259
9340
|
function createClientFromConfig(config, sourceConfig) {
|
|
9260
9341
|
const normalizedAuthConfig = normalizeAuthClientConfig(config.auth, config.authUrl);
|
|
9261
|
-
const gatewayHeaders = {
|
|
9262
|
-
...config.headers ?? {}
|
|
9263
|
-
};
|
|
9264
|
-
if (normalizedAuthConfig?.bearerToken && !hasHeaderIgnoreCase(gatewayHeaders, "X-Athena-Auth-Bearer-Token")) {
|
|
9265
|
-
gatewayHeaders["X-Athena-Auth-Bearer-Token"] = normalizedAuthConfig.bearerToken;
|
|
9266
|
-
}
|
|
9267
|
-
if (normalizedAuthConfig?.cookie && !hasHeaderIgnoreCase(gatewayHeaders, "Cookie")) {
|
|
9268
|
-
gatewayHeaders.Cookie = normalizedAuthConfig.cookie;
|
|
9269
|
-
}
|
|
9270
|
-
if (normalizedAuthConfig?.sessionToken && !hasHeaderIgnoreCase(gatewayHeaders, "X-Athena-Auth-Session-Token")) {
|
|
9271
|
-
gatewayHeaders["X-Athena-Auth-Session-Token"] = normalizedAuthConfig.sessionToken;
|
|
9272
|
-
}
|
|
9273
9342
|
const gateway = createAthenaGatewayClient({
|
|
9274
9343
|
baseUrl: config.baseUrl,
|
|
9275
9344
|
apiKey: config.apiKey,
|
|
@@ -9277,8 +9346,14 @@ function createClientFromConfig(config, sourceConfig) {
|
|
|
9277
9346
|
userId: config.userId,
|
|
9278
9347
|
organizationId: config.organizationId,
|
|
9279
9348
|
forceNoCache: config.forceNoCache,
|
|
9349
|
+
pgUri: config.pgUri,
|
|
9350
|
+
jdbcUrl: config.jdbcUrl,
|
|
9351
|
+
athenaKey: config.athenaKey,
|
|
9280
9352
|
backend: config.backend,
|
|
9281
|
-
|
|
9353
|
+
bearerToken: normalizedAuthConfig?.bearerToken,
|
|
9354
|
+
cookie: normalizedAuthConfig?.cookie,
|
|
9355
|
+
sessionToken: normalizedAuthConfig?.sessionToken,
|
|
9356
|
+
headers: config.headers
|
|
9282
9357
|
});
|
|
9283
9358
|
const formatGatewayResult = createResultFormatter(config.experimental);
|
|
9284
9359
|
const queryTracer = createQueryTracer(config.experimental);
|
|
@@ -9336,6 +9411,7 @@ function createClientFromConfig(config, sourceConfig) {
|
|
|
9336
9411
|
const chat = createChatModule({
|
|
9337
9412
|
baseUrl: config.chatUrl,
|
|
9338
9413
|
apiKey: config.apiKey,
|
|
9414
|
+
athenaKey: config.athenaKey,
|
|
9339
9415
|
client: config.client,
|
|
9340
9416
|
headers: config.headers,
|
|
9341
9417
|
bearerToken: normalizedAuthConfig?.bearerToken,
|
|
@@ -9372,48 +9448,28 @@ function createClientFromConfig(config, sourceConfig) {
|
|
|
9372
9448
|
return path.startsWith("/") ? path : `/${path}`;
|
|
9373
9449
|
})();
|
|
9374
9450
|
const targetUrl = options.url ? `${normalizedBaseUrl}${toRequestQueryString(options.query)}` : `${normalizedBaseUrl}${normalizedPath}${toRequestQueryString(options.query)}`;
|
|
9375
|
-
const
|
|
9376
|
-
|
|
9377
|
-
|
|
9378
|
-
|
|
9379
|
-
|
|
9380
|
-
|
|
9381
|
-
|
|
9382
|
-
|
|
9383
|
-
|
|
9384
|
-
|
|
9385
|
-
|
|
9386
|
-
|
|
9387
|
-
|
|
9388
|
-
|
|
9389
|
-
|
|
9390
|
-
|
|
9391
|
-
|
|
9392
|
-
|
|
9393
|
-
|
|
9394
|
-
|
|
9395
|
-
|
|
9396
|
-
|
|
9397
|
-
}
|
|
9398
|
-
if (normalizedAuthConfig?.cookie && !hasHeaderIgnoreCase(headers, "Cookie")) {
|
|
9399
|
-
headers.Cookie = normalizedAuthConfig.cookie;
|
|
9400
|
-
}
|
|
9401
|
-
} else {
|
|
9402
|
-
const authApiKey = normalizedAuthConfig?.apiKey ?? config.apiKey;
|
|
9403
|
-
if (authApiKey && !hasHeaderIgnoreCase(headers, "x-api-key")) {
|
|
9404
|
-
headers.apikey = headers.apikey ?? authApiKey;
|
|
9405
|
-
headers["x-api-key"] = headers["x-api-key"] ?? authApiKey;
|
|
9406
|
-
}
|
|
9407
|
-
if (normalizedAuthConfig?.bearerToken && !hasHeaderIgnoreCase(headers, "Authorization")) {
|
|
9408
|
-
headers.Authorization = `Bearer ${normalizedAuthConfig.bearerToken}`;
|
|
9409
|
-
}
|
|
9410
|
-
if (normalizedAuthConfig?.cookie && !hasHeaderIgnoreCase(headers, "Cookie")) {
|
|
9411
|
-
headers.Cookie = normalizedAuthConfig.cookie;
|
|
9412
|
-
}
|
|
9413
|
-
if (normalizedAuthConfig?.sessionToken && !hasHeaderIgnoreCase(headers, "X-Athena-Auth-Session-Token")) {
|
|
9414
|
-
headers["X-Athena-Auth-Session-Token"] = normalizedAuthConfig.sessionToken;
|
|
9415
|
-
}
|
|
9416
|
-
}
|
|
9451
|
+
const requestProfile = service === "auth" ? "auth" : service === "chat" ? "chat" : service === "storage" ? "storage" : "gateway";
|
|
9452
|
+
const headers = buildAthenaRequestHeaders({
|
|
9453
|
+
profile: requestProfile,
|
|
9454
|
+
sdkHeaderValue: buildSdkHeaderValue(SDK_NAME4),
|
|
9455
|
+
apiKey: options.apiKey ?? (service === "auth" ? normalizedAuthConfig?.apiKey ?? config.apiKey : config.apiKey),
|
|
9456
|
+
athenaKey: options.athenaKey ?? config.athenaKey,
|
|
9457
|
+
client: config.client,
|
|
9458
|
+
userId: config.userId,
|
|
9459
|
+
organizationId: config.organizationId,
|
|
9460
|
+
backend: config.backend,
|
|
9461
|
+
pgUri: config.pgUri,
|
|
9462
|
+
jdbcUrl: config.jdbcUrl,
|
|
9463
|
+
bearerToken: normalizedAuthConfig?.bearerToken,
|
|
9464
|
+
cookie: normalizedAuthConfig?.cookie,
|
|
9465
|
+
sessionToken: normalizedAuthConfig?.sessionToken,
|
|
9466
|
+
forceNoCache: config.forceNoCache,
|
|
9467
|
+
configHeaders: config.headers,
|
|
9468
|
+
callHeaders: options.headers,
|
|
9469
|
+
accept: service === "chat" ? "application/json" : void 0,
|
|
9470
|
+
contentType: service === "auth" || service === "db" || service === "storage" ? "application/json" : void 0,
|
|
9471
|
+
stripNulls: service === "db" ? true : void 0
|
|
9472
|
+
});
|
|
9417
9473
|
const shouldSendJsonBody = options.body !== void 0 && options.body !== null && !(options.body instanceof FormData) && !(options.body instanceof Blob) && !(options.body instanceof URLSearchParams) && !(options.body instanceof ArrayBuffer) && !ArrayBuffer.isView(options.body) && typeof options.body !== "string";
|
|
9418
9474
|
if (shouldSendJsonBody && !hasHeaderIgnoreCase(headers, "Content-Type")) {
|
|
9419
9475
|
headers["Content-Type"] = "application/json";
|