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