@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/browser.cjs
CHANGED
|
@@ -800,42 +800,31 @@ var getCookieCache = async (request2, config) => {
|
|
|
800
800
|
};
|
|
801
801
|
};
|
|
802
802
|
|
|
803
|
-
//
|
|
804
|
-
var package_default = {
|
|
805
|
-
version: "2.11.0"
|
|
806
|
-
};
|
|
807
|
-
|
|
808
|
-
// src/sdk-version.ts
|
|
809
|
-
var PACKAGE_VERSION = package_default.version;
|
|
810
|
-
function buildSdkHeaderValue(sdkName) {
|
|
811
|
-
return `${sdkName} ${PACKAGE_VERSION}`;
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
// src/gateway/client.ts
|
|
815
|
-
var DEFAULT_CLIENT = "railway_direct";
|
|
816
|
-
var SDK_NAME = "xylex-group/athena";
|
|
817
|
-
var SDK_HEADER_VALUE = buildSdkHeaderValue(SDK_NAME);
|
|
803
|
+
// src/utils/athena-request-headers.ts
|
|
818
804
|
var NO_CACHE_HEADER_VALUE = "no-cache";
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
}
|
|
805
|
+
var API_KEY_HEADER_CANDIDATES = ["x-api-key", "apikey"];
|
|
806
|
+
var ATHENA_KEY_HEADER_CANDIDATES = ["X-Athena-Key", "x-athena-key"];
|
|
807
|
+
var SESSION_TOKEN_HEADER_CANDIDATES = ["X-Athena-Auth-Session-Token"];
|
|
808
|
+
var BEARER_MIRROR_HEADER_CANDIDATES = ["X-Athena-Auth-Bearer-Token"];
|
|
809
|
+
var CLIENT_HEADER_CANDIDATES = ["X-Athena-Client", "x-athena-client"];
|
|
810
|
+
var PG_URI_HEADER_CANDIDATES = ["x-pg-uri"];
|
|
811
|
+
var JDBC_URI_HEADER_CANDIDATES = ["x-athena-jdbc-url", "x-jdbc-url"];
|
|
812
|
+
var PROFILE_RULES = {
|
|
813
|
+
gateway: { apiKeys: true, routing: true, authMirror: true, authBearer: false, contentType: true, stripNullsDefault: true },
|
|
814
|
+
chat: { apiKeys: true, routing: true, authMirror: true, authBearer: true, accept: true },
|
|
815
|
+
storage: { apiKeys: true, routing: true, authMirror: true, authBearer: false, contentType: true },
|
|
816
|
+
auth: { apiKeys: true, routing: false, authMirror: false, authBearer: true, contentType: true },
|
|
817
|
+
minimal: { apiKeys: false, routing: false, authMirror: false, authBearer: false }
|
|
818
|
+
};
|
|
834
819
|
function normalizeHeaderValue(value) {
|
|
835
820
|
return value ? value : void 0;
|
|
836
821
|
}
|
|
837
|
-
function
|
|
838
|
-
return
|
|
822
|
+
function mergeExtraHeaders(configHeaders, callHeaders) {
|
|
823
|
+
return { ...configHeaders ?? {}, ...callHeaders ?? {} };
|
|
824
|
+
}
|
|
825
|
+
function hasHeaderIgnoreCase(headers, targetKey) {
|
|
826
|
+
const normalizedTargetKey = targetKey.toLowerCase();
|
|
827
|
+
return Object.keys(headers).some((key) => key.toLowerCase() === normalizedTargetKey);
|
|
839
828
|
}
|
|
840
829
|
function resolveHeaderValue(headers, candidates) {
|
|
841
830
|
for (const candidate of candidates) {
|
|
@@ -852,13 +841,20 @@ function resolveHeaderValue(headers, candidates) {
|
|
|
852
841
|
}
|
|
853
842
|
return void 0;
|
|
854
843
|
}
|
|
844
|
+
function isCacheControlHeaderName(name) {
|
|
845
|
+
return name.toLowerCase() === "cache-control";
|
|
846
|
+
}
|
|
847
|
+
function normalizeBearerToken(value) {
|
|
848
|
+
const trimmed = value.trim();
|
|
849
|
+
const match = trimmed.match(/^Bearer\s+(.+)$/i);
|
|
850
|
+
return match?.[1]?.trim() ?? trimmed;
|
|
851
|
+
}
|
|
855
852
|
function resolveBearerTokenFromAuthorizationHeader(headers) {
|
|
856
853
|
const authorization = resolveHeaderValue(headers, ["Authorization"]);
|
|
857
854
|
if (!authorization) {
|
|
858
855
|
return void 0;
|
|
859
856
|
}
|
|
860
|
-
const
|
|
861
|
-
const token = match?.[1]?.trim();
|
|
857
|
+
const token = normalizeBearerToken(authorization);
|
|
862
858
|
return token ? token : void 0;
|
|
863
859
|
}
|
|
864
860
|
function resolveSessionTokenFromCookieHeader(headers) {
|
|
@@ -868,6 +864,207 @@ function resolveSessionTokenFromCookieHeader(headers) {
|
|
|
868
864
|
}
|
|
869
865
|
return getSessionCookie(new Headers({ cookie })) ?? void 0;
|
|
870
866
|
}
|
|
867
|
+
function resolveBackendType(backend) {
|
|
868
|
+
if (!backend) {
|
|
869
|
+
return void 0;
|
|
870
|
+
}
|
|
871
|
+
return typeof backend === "string" ? backend : backend.type;
|
|
872
|
+
}
|
|
873
|
+
function resolveRequestHeaderOverrides(config, options, defaults) {
|
|
874
|
+
return {
|
|
875
|
+
apiKey: options?.apiKey ?? config.apiKey,
|
|
876
|
+
athenaKey: options?.athenaKey ?? config.athenaKey,
|
|
877
|
+
client: options?.client ?? config.client ?? defaults?.client,
|
|
878
|
+
userId: options?.userId ?? config.userId,
|
|
879
|
+
organizationId: options?.organizationId ?? config.organizationId,
|
|
880
|
+
backend: options?.backend ?? config.backend,
|
|
881
|
+
publishEvent: options?.publishEvent ?? config.publishEvent,
|
|
882
|
+
stripNulls: options?.stripNulls ?? config.stripNulls ?? defaults?.stripNulls,
|
|
883
|
+
bearerToken: options?.bearerToken ?? config.bearerToken,
|
|
884
|
+
cookie: options?.cookie ?? config.cookie,
|
|
885
|
+
sessionToken: options?.sessionToken ?? config.sessionToken,
|
|
886
|
+
pgUri: options?.pgUri ?? config.pgUri,
|
|
887
|
+
jdbcUrl: options?.jdbcUrl ?? config.jdbcUrl,
|
|
888
|
+
forceNoCache: Boolean(config.forceNoCache || options?.forceNoCache),
|
|
889
|
+
configHeaders: config.headers,
|
|
890
|
+
callHeaders: options?.headers
|
|
891
|
+
};
|
|
892
|
+
}
|
|
893
|
+
function buildServiceRequestHeaders(profile, sdkHeaderValue, config, options, extras) {
|
|
894
|
+
const rules = PROFILE_RULES[profile];
|
|
895
|
+
return buildAthenaRequestHeaders({
|
|
896
|
+
profile,
|
|
897
|
+
sdkHeaderValue,
|
|
898
|
+
...resolveRequestHeaderOverrides(config, options, {
|
|
899
|
+
client: extras?.client ?? void 0,
|
|
900
|
+
stripNulls: extras?.stripNulls ?? (rules.stripNullsDefault ? true : void 0)
|
|
901
|
+
}),
|
|
902
|
+
contentType: extras?.contentType ?? (rules.contentType ? "application/json" : void 0),
|
|
903
|
+
accept: extras?.accept ?? (rules.accept ? "application/json" : void 0)
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
function applyAthenaApiKeyHeaders(headers, apiKey, athenaKey) {
|
|
907
|
+
if (apiKey) {
|
|
908
|
+
if (!hasHeaderIgnoreCase(headers, "apikey")) {
|
|
909
|
+
headers.apikey = apiKey;
|
|
910
|
+
}
|
|
911
|
+
if (!hasHeaderIgnoreCase(headers, "x-api-key")) {
|
|
912
|
+
headers["x-api-key"] = apiKey;
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
const resolvedAthenaKey = normalizeHeaderValue(athenaKey) ?? normalizeHeaderValue(apiKey);
|
|
916
|
+
if (resolvedAthenaKey && !hasHeaderIgnoreCase(headers, "X-Athena-Key")) {
|
|
917
|
+
headers["X-Athena-Key"] = resolvedAthenaKey;
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
function applyAthenaAuthContextHeaders(headers, input) {
|
|
921
|
+
const mergedExtraHeaders = mergeExtraHeaders(input.configHeaders, input.callHeaders);
|
|
922
|
+
const rules = PROFILE_RULES[input.profile];
|
|
923
|
+
const explicitCookie = normalizeHeaderValue(input.cookie);
|
|
924
|
+
if (explicitCookie) {
|
|
925
|
+
mergedExtraHeaders.Cookie = explicitCookie;
|
|
926
|
+
}
|
|
927
|
+
const explicitSessionToken = normalizeHeaderValue(input.sessionToken) ?? resolveHeaderValue(mergedExtraHeaders, SESSION_TOKEN_HEADER_CANDIDATES);
|
|
928
|
+
const derivedSessionToken = explicitSessionToken ?? resolveSessionTokenFromCookieHeader(mergedExtraHeaders);
|
|
929
|
+
const cookieFromHeaders = resolveHeaderValue(mergedExtraHeaders, ["Cookie"]);
|
|
930
|
+
if (explicitCookie && !hasHeaderIgnoreCase(headers, "Cookie")) {
|
|
931
|
+
headers.Cookie = explicitCookie;
|
|
932
|
+
} else if (cookieFromHeaders && !hasHeaderIgnoreCase(headers, "Cookie")) {
|
|
933
|
+
headers.Cookie = cookieFromHeaders;
|
|
934
|
+
}
|
|
935
|
+
const explicitBearerToken = (() => {
|
|
936
|
+
const configured = normalizeHeaderValue(input.bearerToken);
|
|
937
|
+
if (configured) {
|
|
938
|
+
return normalizeBearerToken(configured);
|
|
939
|
+
}
|
|
940
|
+
const mirrored = resolveHeaderValue(mergedExtraHeaders, BEARER_MIRROR_HEADER_CANDIDATES);
|
|
941
|
+
return mirrored ? normalizeBearerToken(mirrored) : void 0;
|
|
942
|
+
})();
|
|
943
|
+
const derivedBearerToken = explicitBearerToken ?? resolveBearerTokenFromAuthorizationHeader(mergedExtraHeaders);
|
|
944
|
+
if (rules.authBearer && derivedBearerToken && !hasHeaderIgnoreCase(headers, "Authorization")) {
|
|
945
|
+
headers.Authorization = `Bearer ${derivedBearerToken}`;
|
|
946
|
+
}
|
|
947
|
+
if (rules.authMirror) {
|
|
948
|
+
if (derivedSessionToken && !hasHeaderIgnoreCase(headers, "X-Athena-Auth-Session-Token")) {
|
|
949
|
+
headers["X-Athena-Auth-Session-Token"] = derivedSessionToken;
|
|
950
|
+
}
|
|
951
|
+
if (derivedBearerToken && !hasHeaderIgnoreCase(headers, "X-Athena-Auth-Bearer-Token")) {
|
|
952
|
+
headers["X-Athena-Auth-Bearer-Token"] = derivedBearerToken;
|
|
953
|
+
}
|
|
954
|
+
} else if (derivedSessionToken && !hasHeaderIgnoreCase(headers, "X-Athena-Auth-Session-Token")) {
|
|
955
|
+
headers["X-Athena-Auth-Session-Token"] = derivedSessionToken;
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
function applyAthenaPgUriHeaders(headers, input) {
|
|
959
|
+
const mergedExtraHeaders = mergeExtraHeaders(input.configHeaders, input.callHeaders);
|
|
960
|
+
const pgUri = normalizeHeaderValue(input.pgUri) ?? resolveHeaderValue(mergedExtraHeaders, PG_URI_HEADER_CANDIDATES);
|
|
961
|
+
if (pgUri && !hasHeaderIgnoreCase(headers, "x-pg-uri")) {
|
|
962
|
+
headers["x-pg-uri"] = pgUri;
|
|
963
|
+
}
|
|
964
|
+
const jdbcUrl = normalizeHeaderValue(input.jdbcUrl) ?? resolveHeaderValue(mergedExtraHeaders, JDBC_URI_HEADER_CANDIDATES);
|
|
965
|
+
if (jdbcUrl) {
|
|
966
|
+
if (!hasHeaderIgnoreCase(headers, "x-athena-jdbc-url")) {
|
|
967
|
+
headers["x-athena-jdbc-url"] = jdbcUrl;
|
|
968
|
+
}
|
|
969
|
+
if (!hasHeaderIgnoreCase(headers, "x-jdbc-url")) {
|
|
970
|
+
headers["x-jdbc-url"] = jdbcUrl;
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
function buildAthenaRequestHeaders(input) {
|
|
975
|
+
const forceNoCache = Boolean(input.forceNoCache);
|
|
976
|
+
const mergedExtraHeaders = mergeExtraHeaders(input.configHeaders, input.callHeaders);
|
|
977
|
+
const rules = PROFILE_RULES[input.profile];
|
|
978
|
+
const headerClient = resolveHeaderValue(mergedExtraHeaders, CLIENT_HEADER_CANDIDATES);
|
|
979
|
+
const finalClient = normalizeHeaderValue(input.client) ?? headerClient;
|
|
980
|
+
const finalApiKey = normalizeHeaderValue(input.apiKey) ?? resolveHeaderValue(mergedExtraHeaders, API_KEY_HEADER_CANDIDATES);
|
|
981
|
+
const finalAthenaKey = normalizeHeaderValue(input.athenaKey) ?? resolveHeaderValue(mergedExtraHeaders, ATHENA_KEY_HEADER_CANDIDATES) ?? finalApiKey;
|
|
982
|
+
const headers = {
|
|
983
|
+
"X-Athena-Sdk": input.sdkHeaderValue
|
|
984
|
+
};
|
|
985
|
+
if (rules.contentType) {
|
|
986
|
+
headers["Content-Type"] = input.contentType ?? "application/json";
|
|
987
|
+
}
|
|
988
|
+
if (input.accept ?? rules.accept) {
|
|
989
|
+
headers.Accept = input.accept ?? "application/json";
|
|
990
|
+
}
|
|
991
|
+
if (rules.routing) {
|
|
992
|
+
if (normalizeHeaderValue(input.userId)) {
|
|
993
|
+
headers["X-User-Id"] = input.userId ?? "";
|
|
994
|
+
}
|
|
995
|
+
if (normalizeHeaderValue(input.organizationId)) {
|
|
996
|
+
headers["X-Organization-Id"] = input.organizationId ?? "";
|
|
997
|
+
}
|
|
998
|
+
if (finalClient) {
|
|
999
|
+
headers["X-Athena-Client"] = finalClient;
|
|
1000
|
+
}
|
|
1001
|
+
const backendType = resolveBackendType(input.backend);
|
|
1002
|
+
if (backendType) {
|
|
1003
|
+
headers["X-Backend-Type"] = backendType;
|
|
1004
|
+
}
|
|
1005
|
+
if (typeof input.stripNulls === "boolean") {
|
|
1006
|
+
headers["X-Strip-Nulls"] = input.stripNulls ? "true" : "false";
|
|
1007
|
+
} else if (rules.stripNullsDefault) {
|
|
1008
|
+
headers["X-Strip-Nulls"] = "true";
|
|
1009
|
+
}
|
|
1010
|
+
if (normalizeHeaderValue(input.publishEvent)) {
|
|
1011
|
+
headers["X-Publish-Event"] = input.publishEvent ?? "";
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
if (rules.apiKeys && (finalApiKey || finalAthenaKey)) {
|
|
1015
|
+
applyAthenaApiKeyHeaders(headers, finalApiKey, finalAthenaKey);
|
|
1016
|
+
}
|
|
1017
|
+
applyAthenaAuthContextHeaders(headers, input);
|
|
1018
|
+
applyAthenaPgUriHeaders(headers, input);
|
|
1019
|
+
const reservedClientHeaderKeys = new Set(CLIENT_HEADER_CANDIDATES.map((key) => key.toLowerCase()));
|
|
1020
|
+
Object.entries(mergedExtraHeaders).forEach(([key, value]) => {
|
|
1021
|
+
if (reservedClientHeaderKeys.has(key.toLowerCase())) {
|
|
1022
|
+
return;
|
|
1023
|
+
}
|
|
1024
|
+
if (forceNoCache && isCacheControlHeaderName(key)) {
|
|
1025
|
+
return;
|
|
1026
|
+
}
|
|
1027
|
+
const normalized = normalizeHeaderValue(value);
|
|
1028
|
+
if (normalized) {
|
|
1029
|
+
headers[key] = normalized;
|
|
1030
|
+
}
|
|
1031
|
+
});
|
|
1032
|
+
if (forceNoCache) {
|
|
1033
|
+
headers["Cache-Control"] = NO_CACHE_HEADER_VALUE;
|
|
1034
|
+
}
|
|
1035
|
+
return headers;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
// package.json
|
|
1039
|
+
var package_default = {
|
|
1040
|
+
version: "2.12.0"
|
|
1041
|
+
};
|
|
1042
|
+
|
|
1043
|
+
// src/sdk-version.ts
|
|
1044
|
+
var PACKAGE_VERSION = package_default.version;
|
|
1045
|
+
function buildSdkHeaderValue(sdkName) {
|
|
1046
|
+
return `${sdkName} ${PACKAGE_VERSION}`;
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
// src/gateway/client.ts
|
|
1050
|
+
var DEFAULT_CLIENT = "railway_direct";
|
|
1051
|
+
var SDK_NAME = "xylex-group/athena";
|
|
1052
|
+
var SDK_HEADER_VALUE = buildSdkHeaderValue(SDK_NAME);
|
|
1053
|
+
function parseResponseBody(rawText, contentType) {
|
|
1054
|
+
if (!rawText) {
|
|
1055
|
+
return { parsed: null, parseFailed: false };
|
|
1056
|
+
}
|
|
1057
|
+
const contentTypeSuggestsJson = contentType?.toLowerCase().includes("application/json") ?? false;
|
|
1058
|
+
const looksJson = contentTypeSuggestsJson || rawText.startsWith("{") || rawText.startsWith("[");
|
|
1059
|
+
if (!looksJson) {
|
|
1060
|
+
return { parsed: rawText, parseFailed: false };
|
|
1061
|
+
}
|
|
1062
|
+
try {
|
|
1063
|
+
return { parsed: JSON.parse(rawText), parseFailed: false };
|
|
1064
|
+
} catch {
|
|
1065
|
+
return { parsed: rawText, parseFailed: true };
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
871
1068
|
function isRecord(value) {
|
|
872
1069
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
873
1070
|
}
|
|
@@ -994,71 +1191,10 @@ function buildRpcGetEndpoint(payload) {
|
|
|
994
1191
|
return withQuery;
|
|
995
1192
|
}
|
|
996
1193
|
function buildHeaders(config, options) {
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
...config.headers ?? {},
|
|
1001
|
-
...options?.headers ?? {}
|
|
1002
|
-
};
|
|
1003
|
-
const headerClient = extraHeaders["x-athena-client"] ?? extraHeaders["X-Athena-Client"];
|
|
1004
|
-
const finalClient = options?.client ?? config.client ?? (typeof headerClient === "string" ? headerClient : void 0) ?? DEFAULT_CLIENT;
|
|
1005
|
-
const finalApiKey = options?.apiKey ?? config.apiKey;
|
|
1006
|
-
const finalPublishEvent = options?.publishEvent ?? config.publishEvent;
|
|
1007
|
-
const headers = {
|
|
1008
|
-
"Content-Type": "application/json",
|
|
1009
|
-
"X-Athena-Sdk": SDK_HEADER_VALUE
|
|
1010
|
-
};
|
|
1011
|
-
if (options?.userId ?? config.userId) {
|
|
1012
|
-
headers["X-User-Id"] = options?.userId ?? config.userId ?? "";
|
|
1013
|
-
}
|
|
1014
|
-
if (options?.organizationId ?? config.organizationId) {
|
|
1015
|
-
headers["X-Organization-Id"] = options?.organizationId ?? config.organizationId ?? "";
|
|
1016
|
-
}
|
|
1017
|
-
if (finalClient) {
|
|
1018
|
-
headers["X-Athena-Client"] = finalClient;
|
|
1019
|
-
}
|
|
1020
|
-
const finalBackend = options?.backend ?? config.backend;
|
|
1021
|
-
if (finalBackend) {
|
|
1022
|
-
const type = typeof finalBackend === "string" ? finalBackend : finalBackend.type;
|
|
1023
|
-
if (type) headers["X-Backend-Type"] = type;
|
|
1024
|
-
}
|
|
1025
|
-
if (typeof mergedStripNulls === "boolean") {
|
|
1026
|
-
headers["X-Strip-Nulls"] = mergedStripNulls ? "true" : "false";
|
|
1027
|
-
}
|
|
1028
|
-
if (finalPublishEvent) {
|
|
1029
|
-
headers["X-Publish-Event"] = finalPublishEvent;
|
|
1030
|
-
}
|
|
1031
|
-
if (finalApiKey) {
|
|
1032
|
-
headers["apikey"] = finalApiKey;
|
|
1033
|
-
headers["x-api-key"] = headers["x-api-key"] ?? finalApiKey;
|
|
1034
|
-
}
|
|
1035
|
-
const explicitSessionToken = resolveHeaderValue(extraHeaders, [
|
|
1036
|
-
"X-Athena-Auth-Session-Token"
|
|
1037
|
-
]);
|
|
1038
|
-
const derivedSessionToken = explicitSessionToken ?? resolveSessionTokenFromCookieHeader(extraHeaders);
|
|
1039
|
-
if (derivedSessionToken) {
|
|
1040
|
-
headers["X-Athena-Auth-Session-Token"] = derivedSessionToken;
|
|
1041
|
-
}
|
|
1042
|
-
const explicitBearerToken = resolveHeaderValue(extraHeaders, [
|
|
1043
|
-
"X-Athena-Auth-Bearer-Token"
|
|
1044
|
-
]);
|
|
1045
|
-
const derivedBearerToken = explicitBearerToken ?? resolveBearerTokenFromAuthorizationHeader(extraHeaders);
|
|
1046
|
-
if (derivedBearerToken) {
|
|
1047
|
-
headers["X-Athena-Auth-Bearer-Token"] = derivedBearerToken;
|
|
1048
|
-
}
|
|
1049
|
-
const athenaClientKeys = ["x-athena-client", "X-Athena-Client"];
|
|
1050
|
-
Object.entries(extraHeaders).forEach(([key, value]) => {
|
|
1051
|
-
if (athenaClientKeys.includes(key)) return;
|
|
1052
|
-
if (forceNoCache && isCacheControlHeaderName(key)) return;
|
|
1053
|
-
const normalized = normalizeHeaderValue(value);
|
|
1054
|
-
if (normalized) {
|
|
1055
|
-
headers[key] = normalized;
|
|
1056
|
-
}
|
|
1194
|
+
return buildServiceRequestHeaders("gateway", SDK_HEADER_VALUE, config, options, {
|
|
1195
|
+
client: options?.client ?? config.client ?? DEFAULT_CLIENT,
|
|
1196
|
+
stripNulls: options?.stripNulls ?? true
|
|
1057
1197
|
});
|
|
1058
|
-
if (forceNoCache) {
|
|
1059
|
-
headers["Cache-Control"] = NO_CACHE_HEADER_VALUE;
|
|
1060
|
-
}
|
|
1061
|
-
return headers;
|
|
1062
1198
|
}
|
|
1063
1199
|
function toInvalidUrlResponse(error, endpoint, method) {
|
|
1064
1200
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -1786,19 +1922,12 @@ async function resolveReactEmailPayloadFields(input, fields, options) {
|
|
|
1786
1922
|
var DEFAULT_AUTH_BASE_URL = "http://localhost:3001/api/auth";
|
|
1787
1923
|
var SDK_NAME2 = "xylex-group/athena-auth";
|
|
1788
1924
|
var SDK_HEADER_VALUE2 = buildSdkHeaderValue(SDK_NAME2);
|
|
1789
|
-
var NO_CACHE_HEADER_VALUE2 = "no-cache";
|
|
1790
1925
|
function normalizeBaseUrl(baseUrl) {
|
|
1791
1926
|
return (baseUrl ?? DEFAULT_AUTH_BASE_URL).replace(/\/$/, "");
|
|
1792
1927
|
}
|
|
1793
1928
|
function isRecord3(value) {
|
|
1794
1929
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
1795
1930
|
}
|
|
1796
|
-
function normalizeHeaderValue2(value) {
|
|
1797
|
-
return value ? value : void 0;
|
|
1798
|
-
}
|
|
1799
|
-
function isCacheControlHeaderName2(name) {
|
|
1800
|
-
return name.toLowerCase() === "cache-control";
|
|
1801
|
-
}
|
|
1802
1931
|
function parseResponseBody2(rawText, contentType) {
|
|
1803
1932
|
if (!rawText) {
|
|
1804
1933
|
return { parsed: null, parseFailed: false };
|
|
@@ -1998,45 +2127,7 @@ function extractFetchOptions(input) {
|
|
|
1998
2127
|
};
|
|
1999
2128
|
}
|
|
2000
2129
|
function buildHeaders2(config, options) {
|
|
2001
|
-
|
|
2002
|
-
const headers = {
|
|
2003
|
-
"Content-Type": "application/json",
|
|
2004
|
-
"X-Athena-Sdk": SDK_HEADER_VALUE2
|
|
2005
|
-
};
|
|
2006
|
-
const apiKey = options?.apiKey ?? config.apiKey;
|
|
2007
|
-
if (apiKey) {
|
|
2008
|
-
headers.apikey = apiKey;
|
|
2009
|
-
headers["x-api-key"] = apiKey;
|
|
2010
|
-
}
|
|
2011
|
-
const bearerToken = options?.bearerToken ?? config.bearerToken;
|
|
2012
|
-
if (bearerToken) {
|
|
2013
|
-
headers.Authorization = `Bearer ${bearerToken}`;
|
|
2014
|
-
}
|
|
2015
|
-
const cookie = options?.cookie ?? config.cookie;
|
|
2016
|
-
if (cookie) {
|
|
2017
|
-
headers.Cookie = cookie;
|
|
2018
|
-
}
|
|
2019
|
-
const sessionToken = options?.sessionToken ?? config.sessionToken;
|
|
2020
|
-
if (sessionToken) {
|
|
2021
|
-
headers["X-Athena-Auth-Session-Token"] = sessionToken;
|
|
2022
|
-
}
|
|
2023
|
-
const mergedExtraHeaders = {
|
|
2024
|
-
...config.headers ?? {},
|
|
2025
|
-
...options?.headers ?? {}
|
|
2026
|
-
};
|
|
2027
|
-
Object.entries(mergedExtraHeaders).forEach(([key, value]) => {
|
|
2028
|
-
if (forceNoCache && isCacheControlHeaderName2(key)) {
|
|
2029
|
-
return;
|
|
2030
|
-
}
|
|
2031
|
-
const normalized = normalizeHeaderValue2(value);
|
|
2032
|
-
if (normalized) {
|
|
2033
|
-
headers[key] = normalized;
|
|
2034
|
-
}
|
|
2035
|
-
});
|
|
2036
|
-
if (forceNoCache) {
|
|
2037
|
-
headers["Cache-Control"] = NO_CACHE_HEADER_VALUE2;
|
|
2038
|
-
}
|
|
2039
|
-
return headers;
|
|
2130
|
+
return buildServiceRequestHeaders("auth", SDK_HEADER_VALUE2, config, options);
|
|
2040
2131
|
}
|
|
2041
2132
|
function appendQueryParam(searchParams, key, value) {
|
|
2042
2133
|
if (value === void 0 || value === null) return;
|
|
@@ -5715,7 +5806,6 @@ function createStorageModule(gateway, runtimeOptions) {
|
|
|
5715
5806
|
// src/chat/module.ts
|
|
5716
5807
|
var SDK_NAME3 = "xylex-group/athena-chat";
|
|
5717
5808
|
var SDK_HEADER_VALUE3 = buildSdkHeaderValue(SDK_NAME3);
|
|
5718
|
-
var NO_CACHE_HEADER_VALUE3 = "no-cache";
|
|
5719
5809
|
var AthenaChatError = class extends Error {
|
|
5720
5810
|
status;
|
|
5721
5811
|
endpoint;
|
|
@@ -5761,9 +5851,6 @@ function normalizeWsUrl(value, label) {
|
|
|
5761
5851
|
function isRecord7(value) {
|
|
5762
5852
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
5763
5853
|
}
|
|
5764
|
-
function normalizeHeaderValue3(value) {
|
|
5765
|
-
return value ? value : void 0;
|
|
5766
|
-
}
|
|
5767
5854
|
function parseResponseBody4(rawText, contentType) {
|
|
5768
5855
|
if (!rawText) {
|
|
5769
5856
|
return { parsed: null, parseFailed: false };
|
|
@@ -5835,39 +5922,7 @@ function createSocket(factory, url, protocols) {
|
|
|
5835
5922
|
}
|
|
5836
5923
|
}
|
|
5837
5924
|
function buildHeaders3(config, options) {
|
|
5838
|
-
|
|
5839
|
-
Accept: "application/json",
|
|
5840
|
-
apikey: config.apiKey,
|
|
5841
|
-
"x-api-key": config.apiKey,
|
|
5842
|
-
"X-Athena-Sdk": SDK_HEADER_VALUE3
|
|
5843
|
-
};
|
|
5844
|
-
if (config.client || options?.client) {
|
|
5845
|
-
headers["X-Athena-Client"] = options?.client ?? config.client ?? "";
|
|
5846
|
-
}
|
|
5847
|
-
const bearerToken = options?.bearerToken ?? config.bearerToken;
|
|
5848
|
-
if (typeof bearerToken === "string" && bearerToken.trim()) {
|
|
5849
|
-
headers.Authorization = bearerToken.startsWith("Bearer ") ? bearerToken : `Bearer ${bearerToken}`;
|
|
5850
|
-
}
|
|
5851
|
-
const cookie = options?.cookie ?? config.cookie;
|
|
5852
|
-
if (typeof cookie === "string" && cookie.trim()) {
|
|
5853
|
-
headers.Cookie = cookie;
|
|
5854
|
-
}
|
|
5855
|
-
const sessionToken = options?.sessionToken ?? config.sessionToken;
|
|
5856
|
-
if (typeof sessionToken === "string" && sessionToken.trim()) {
|
|
5857
|
-
headers["X-Athena-Auth-Session-Token"] = sessionToken;
|
|
5858
|
-
}
|
|
5859
|
-
if (config.forceNoCache || options?.forceNoCache) {
|
|
5860
|
-
headers["Cache-Control"] = NO_CACHE_HEADER_VALUE3;
|
|
5861
|
-
}
|
|
5862
|
-
for (const source of [config.headers, options?.headers]) {
|
|
5863
|
-
for (const [key, value] of Object.entries(source ?? {})) {
|
|
5864
|
-
const normalized = normalizeHeaderValue3(value);
|
|
5865
|
-
if (normalized) {
|
|
5866
|
-
headers[key] = normalized;
|
|
5867
|
-
}
|
|
5868
|
-
}
|
|
5869
|
-
}
|
|
5870
|
-
return headers;
|
|
5925
|
+
return buildServiceRequestHeaders("chat", SDK_HEADER_VALUE3, config, options);
|
|
5871
5926
|
}
|
|
5872
5927
|
function withJsonBody(init, body) {
|
|
5873
5928
|
return {
|
|
@@ -6279,6 +6334,9 @@ var AthenaClientBuilderImpl = class {
|
|
|
6279
6334
|
defaultOrganizationId;
|
|
6280
6335
|
forceNoCacheEnabled = false;
|
|
6281
6336
|
defaultHeaders;
|
|
6337
|
+
pgUriValue;
|
|
6338
|
+
jdbcUrlValue;
|
|
6339
|
+
athenaKeyValue;
|
|
6282
6340
|
authConfig;
|
|
6283
6341
|
dbUrlOverride;
|
|
6284
6342
|
gatewayUrlOverride;
|
|
@@ -6305,6 +6363,18 @@ var AthenaClientBuilderImpl = class {
|
|
|
6305
6363
|
this.defaultHeaders = headers;
|
|
6306
6364
|
return this;
|
|
6307
6365
|
}
|
|
6366
|
+
pgUri(pgUri) {
|
|
6367
|
+
this.pgUriValue = pgUri;
|
|
6368
|
+
return this;
|
|
6369
|
+
}
|
|
6370
|
+
jdbcUrl(jdbcUrl) {
|
|
6371
|
+
this.jdbcUrlValue = jdbcUrl;
|
|
6372
|
+
return this;
|
|
6373
|
+
}
|
|
6374
|
+
athenaKey(athenaKey) {
|
|
6375
|
+
this.athenaKeyValue = athenaKey;
|
|
6376
|
+
return this;
|
|
6377
|
+
}
|
|
6308
6378
|
auth(config) {
|
|
6309
6379
|
this.authConfig = mergeAuthClientConfig(this.authConfig, config);
|
|
6310
6380
|
return this;
|
|
@@ -6341,6 +6411,15 @@ var AthenaClientBuilderImpl = class {
|
|
|
6341
6411
|
if (options.headers !== void 0) {
|
|
6342
6412
|
this.defaultHeaders = mergeHeaders(this.defaultHeaders, options.headers);
|
|
6343
6413
|
}
|
|
6414
|
+
if (options.pgUri !== void 0) {
|
|
6415
|
+
this.pgUriValue = options.pgUri;
|
|
6416
|
+
}
|
|
6417
|
+
if (options.jdbcUrl !== void 0) {
|
|
6418
|
+
this.jdbcUrlValue = options.jdbcUrl;
|
|
6419
|
+
}
|
|
6420
|
+
if (options.athenaKey !== void 0) {
|
|
6421
|
+
this.athenaKeyValue = options.athenaKey;
|
|
6422
|
+
}
|
|
6344
6423
|
if (options.auth !== void 0) {
|
|
6345
6424
|
this.authConfig = mergeAuthClientConfig(this.authConfig, options.auth);
|
|
6346
6425
|
}
|
|
@@ -6392,6 +6471,9 @@ var AthenaClientBuilderImpl = class {
|
|
|
6392
6471
|
userId: this.defaultUserId,
|
|
6393
6472
|
organizationId: this.defaultOrganizationId,
|
|
6394
6473
|
forceNoCache: this.forceNoCacheEnabled,
|
|
6474
|
+
pgUri: this.pgUriValue,
|
|
6475
|
+
jdbcUrl: this.jdbcUrlValue,
|
|
6476
|
+
athenaKey: this.athenaKeyValue,
|
|
6395
6477
|
backend: this.backendConfig,
|
|
6396
6478
|
headers: this.defaultHeaders,
|
|
6397
6479
|
db: this.dbUrlOverride ? { url: this.dbUrlOverride } : void 0,
|
|
@@ -9104,10 +9186,6 @@ function resolveRequiredClientApiKey(value) {
|
|
|
9104
9186
|
}
|
|
9105
9187
|
return normalizedValue;
|
|
9106
9188
|
}
|
|
9107
|
-
function hasHeaderIgnoreCase(headers, targetKey) {
|
|
9108
|
-
const normalizedTargetKey = targetKey.toLowerCase();
|
|
9109
|
-
return Object.keys(headers).some((key) => key.toLowerCase() === normalizedTargetKey);
|
|
9110
|
-
}
|
|
9111
9189
|
function mergeClientHeaders(current, next) {
|
|
9112
9190
|
if (!current && !next) {
|
|
9113
9191
|
return void 0;
|
|
@@ -9238,6 +9316,9 @@ function resolveCreateClientConfig(config) {
|
|
|
9238
9316
|
userId: config.userId,
|
|
9239
9317
|
organizationId: config.organizationId,
|
|
9240
9318
|
forceNoCache: config.forceNoCache,
|
|
9319
|
+
pgUri: config.pgUri,
|
|
9320
|
+
jdbcUrl: config.jdbcUrl,
|
|
9321
|
+
athenaKey: config.athenaKey,
|
|
9241
9322
|
backend: toBackendConfig(config.backend),
|
|
9242
9323
|
headers: config.headers,
|
|
9243
9324
|
auth: config.auth,
|
|
@@ -9254,18 +9335,6 @@ function createClientFromInput(sourceConfig) {
|
|
|
9254
9335
|
}
|
|
9255
9336
|
function createClientFromConfig(config, sourceConfig) {
|
|
9256
9337
|
const normalizedAuthConfig = normalizeAuthClientConfig(config.auth, config.authUrl);
|
|
9257
|
-
const gatewayHeaders = {
|
|
9258
|
-
...config.headers ?? {}
|
|
9259
|
-
};
|
|
9260
|
-
if (normalizedAuthConfig?.bearerToken && !hasHeaderIgnoreCase(gatewayHeaders, "X-Athena-Auth-Bearer-Token")) {
|
|
9261
|
-
gatewayHeaders["X-Athena-Auth-Bearer-Token"] = normalizedAuthConfig.bearerToken;
|
|
9262
|
-
}
|
|
9263
|
-
if (normalizedAuthConfig?.cookie && !hasHeaderIgnoreCase(gatewayHeaders, "Cookie")) {
|
|
9264
|
-
gatewayHeaders.Cookie = normalizedAuthConfig.cookie;
|
|
9265
|
-
}
|
|
9266
|
-
if (normalizedAuthConfig?.sessionToken && !hasHeaderIgnoreCase(gatewayHeaders, "X-Athena-Auth-Session-Token")) {
|
|
9267
|
-
gatewayHeaders["X-Athena-Auth-Session-Token"] = normalizedAuthConfig.sessionToken;
|
|
9268
|
-
}
|
|
9269
9338
|
const gateway = createAthenaGatewayClient({
|
|
9270
9339
|
baseUrl: config.baseUrl,
|
|
9271
9340
|
apiKey: config.apiKey,
|
|
@@ -9273,8 +9342,14 @@ function createClientFromConfig(config, sourceConfig) {
|
|
|
9273
9342
|
userId: config.userId,
|
|
9274
9343
|
organizationId: config.organizationId,
|
|
9275
9344
|
forceNoCache: config.forceNoCache,
|
|
9345
|
+
pgUri: config.pgUri,
|
|
9346
|
+
jdbcUrl: config.jdbcUrl,
|
|
9347
|
+
athenaKey: config.athenaKey,
|
|
9276
9348
|
backend: config.backend,
|
|
9277
|
-
|
|
9349
|
+
bearerToken: normalizedAuthConfig?.bearerToken,
|
|
9350
|
+
cookie: normalizedAuthConfig?.cookie,
|
|
9351
|
+
sessionToken: normalizedAuthConfig?.sessionToken,
|
|
9352
|
+
headers: config.headers
|
|
9278
9353
|
});
|
|
9279
9354
|
const formatGatewayResult = createResultFormatter(config.experimental);
|
|
9280
9355
|
const queryTracer = createQueryTracer(config.experimental);
|
|
@@ -9332,6 +9407,7 @@ function createClientFromConfig(config, sourceConfig) {
|
|
|
9332
9407
|
const chat = createChatModule({
|
|
9333
9408
|
baseUrl: config.chatUrl,
|
|
9334
9409
|
apiKey: config.apiKey,
|
|
9410
|
+
athenaKey: config.athenaKey,
|
|
9335
9411
|
client: config.client,
|
|
9336
9412
|
headers: config.headers,
|
|
9337
9413
|
bearerToken: normalizedAuthConfig?.bearerToken,
|
|
@@ -9368,48 +9444,28 @@ function createClientFromConfig(config, sourceConfig) {
|
|
|
9368
9444
|
return path.startsWith("/") ? path : `/${path}`;
|
|
9369
9445
|
})();
|
|
9370
9446
|
const targetUrl = options.url ? `${normalizedBaseUrl}${toRequestQueryString(options.query)}` : `${normalizedBaseUrl}${normalizedPath}${toRequestQueryString(options.query)}`;
|
|
9371
|
-
const
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
|
|
9375
|
-
|
|
9376
|
-
|
|
9377
|
-
|
|
9378
|
-
|
|
9379
|
-
|
|
9380
|
-
|
|
9381
|
-
|
|
9382
|
-
|
|
9383
|
-
|
|
9384
|
-
|
|
9385
|
-
|
|
9386
|
-
|
|
9387
|
-
|
|
9388
|
-
|
|
9389
|
-
|
|
9390
|
-
|
|
9391
|
-
|
|
9392
|
-
|
|
9393
|
-
}
|
|
9394
|
-
if (normalizedAuthConfig?.cookie && !hasHeaderIgnoreCase(headers, "Cookie")) {
|
|
9395
|
-
headers.Cookie = normalizedAuthConfig.cookie;
|
|
9396
|
-
}
|
|
9397
|
-
} else {
|
|
9398
|
-
const authApiKey = normalizedAuthConfig?.apiKey ?? config.apiKey;
|
|
9399
|
-
if (authApiKey && !hasHeaderIgnoreCase(headers, "x-api-key")) {
|
|
9400
|
-
headers.apikey = headers.apikey ?? authApiKey;
|
|
9401
|
-
headers["x-api-key"] = headers["x-api-key"] ?? authApiKey;
|
|
9402
|
-
}
|
|
9403
|
-
if (normalizedAuthConfig?.bearerToken && !hasHeaderIgnoreCase(headers, "Authorization")) {
|
|
9404
|
-
headers.Authorization = `Bearer ${normalizedAuthConfig.bearerToken}`;
|
|
9405
|
-
}
|
|
9406
|
-
if (normalizedAuthConfig?.cookie && !hasHeaderIgnoreCase(headers, "Cookie")) {
|
|
9407
|
-
headers.Cookie = normalizedAuthConfig.cookie;
|
|
9408
|
-
}
|
|
9409
|
-
if (normalizedAuthConfig?.sessionToken && !hasHeaderIgnoreCase(headers, "X-Athena-Auth-Session-Token")) {
|
|
9410
|
-
headers["X-Athena-Auth-Session-Token"] = normalizedAuthConfig.sessionToken;
|
|
9411
|
-
}
|
|
9412
|
-
}
|
|
9447
|
+
const requestProfile = service === "auth" ? "auth" : service === "chat" ? "chat" : service === "storage" ? "storage" : "gateway";
|
|
9448
|
+
const headers = buildAthenaRequestHeaders({
|
|
9449
|
+
profile: requestProfile,
|
|
9450
|
+
sdkHeaderValue: buildSdkHeaderValue(SDK_NAME4),
|
|
9451
|
+
apiKey: options.apiKey ?? (service === "auth" ? normalizedAuthConfig?.apiKey ?? config.apiKey : config.apiKey),
|
|
9452
|
+
athenaKey: options.athenaKey ?? config.athenaKey,
|
|
9453
|
+
client: config.client,
|
|
9454
|
+
userId: config.userId,
|
|
9455
|
+
organizationId: config.organizationId,
|
|
9456
|
+
backend: config.backend,
|
|
9457
|
+
pgUri: config.pgUri,
|
|
9458
|
+
jdbcUrl: config.jdbcUrl,
|
|
9459
|
+
bearerToken: normalizedAuthConfig?.bearerToken,
|
|
9460
|
+
cookie: normalizedAuthConfig?.cookie,
|
|
9461
|
+
sessionToken: normalizedAuthConfig?.sessionToken,
|
|
9462
|
+
forceNoCache: config.forceNoCache,
|
|
9463
|
+
configHeaders: config.headers,
|
|
9464
|
+
callHeaders: options.headers,
|
|
9465
|
+
accept: service === "chat" ? "application/json" : void 0,
|
|
9466
|
+
contentType: service === "auth" || service === "db" || service === "storage" ? "application/json" : void 0,
|
|
9467
|
+
stripNulls: service === "db" ? true : void 0
|
|
9468
|
+
});
|
|
9413
9469
|
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";
|
|
9414
9470
|
if (shouldSendJsonBody && !hasHeaderIgnoreCase(headers, "Content-Type")) {
|
|
9415
9471
|
headers["Content-Type"] = "application/json";
|