@xylex-group/athena 2.8.2 → 2.10.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 +154 -64
- package/dist/browser.cjs +1550 -181
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +8 -7
- package/dist/browser.d.ts +8 -7
- package/dist/browser.js +1540 -182
- package/dist/browser.js.map +1 -1
- package/dist/cli/index.cjs +1337 -67
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.d.cts +3 -3
- package/dist/cli/index.d.ts +3 -3
- package/dist/cli/index.js +1337 -67
- package/dist/cli/index.js.map +1 -1
- package/dist/{model-form-Cx3wtvi8.d.ts → client-B7EQ_hPV.d.cts} +606 -118
- package/dist/{model-form-_ugfOXao.d.cts → client-BYii6dU9.d.ts} +606 -118
- package/dist/index.cjs +1540 -113
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.js +1530 -114
- package/dist/index.js.map +1 -1
- package/dist/model-form-ByvyyvxB.d.ts +96 -0
- package/dist/model-form-DACdBLYG.d.cts +96 -0
- package/dist/{react-email-CiiSVa9F.d.cts → module-DC96HJa3.d.cts} +130 -5
- package/dist/{react-email-WN8UU3AL.d.ts → module-DbHlxpeR.d.ts} +130 -5
- package/dist/next/client.cjs +8591 -0
- package/dist/next/client.cjs.map +1 -0
- package/dist/next/client.d.cts +24 -0
- package/dist/next/client.d.ts +24 -0
- package/dist/next/client.js +8589 -0
- package/dist/next/client.js.map +1 -0
- package/dist/next/server.cjs +8709 -0
- package/dist/next/server.cjs.map +1 -0
- package/dist/next/server.d.cts +52 -0
- package/dist/next/server.d.ts +52 -0
- package/dist/next/server.js +8706 -0
- package/dist/next/server.js.map +1 -0
- package/dist/{pipeline-BtD-Uo5X.d.cts → pipeline-CmUZsXsi.d.cts} +1 -1
- package/dist/{pipeline-yCIZNJHE.d.ts → pipeline-DZMsPxUg.d.ts} +1 -1
- package/dist/react.cjs +30 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +38 -10
- package/dist/react.d.ts +38 -10
- package/dist/react.js +30 -2
- package/dist/react.js.map +1 -1
- package/dist/shared-BMVGMnti.d.cts +35 -0
- package/dist/shared-DRptGBWP.d.ts +35 -0
- package/dist/{types-g8G6J0xE.d.cts → types-BeZIHduP.d.cts} +2 -1
- package/dist/{types-g8G6J0xE.d.ts → types-BeZIHduP.d.ts} +2 -1
- package/dist/{types-C2kiTt6-.d.ts → types-C-YvfgYh.d.cts} +26 -2
- package/dist/{types-89EfjLjV.d.cts → types-CRjDwmtJ.d.ts} +26 -2
- package/package.json +32 -14
package/dist/browser.js
CHANGED
|
@@ -660,8 +660,8 @@ function deleteSessionCookie(ctx, skipDontRememberMe) {
|
|
|
660
660
|
expireCookie(ctx, ctx.context.authCookies.dontRememberToken);
|
|
661
661
|
}
|
|
662
662
|
}
|
|
663
|
-
var getSessionCookie = (
|
|
664
|
-
const cookies = (
|
|
663
|
+
var getSessionCookie = (request2, config) => {
|
|
664
|
+
const cookies = (request2 instanceof Headers || !("headers" in request2) ? request2 : request2.headers).get("cookie");
|
|
665
665
|
if (!cookies) {
|
|
666
666
|
return null;
|
|
667
667
|
}
|
|
@@ -681,8 +681,8 @@ var getSessionCookie = (request, config) => {
|
|
|
681
681
|
}
|
|
682
682
|
return null;
|
|
683
683
|
};
|
|
684
|
-
var getCookieCache = async (
|
|
685
|
-
const headers =
|
|
684
|
+
var getCookieCache = async (request2, config) => {
|
|
685
|
+
const headers = request2 instanceof Headers || !("headers" in request2) ? request2 : request2.headers;
|
|
686
686
|
const cookieHeader = headers.get("cookie");
|
|
687
687
|
if (!cookieHeader) {
|
|
688
688
|
return null;
|
|
@@ -800,7 +800,7 @@ var getCookieCache = async (request, config) => {
|
|
|
800
800
|
|
|
801
801
|
// package.json
|
|
802
802
|
var package_default = {
|
|
803
|
-
version: "2.
|
|
803
|
+
version: "2.10.0"
|
|
804
804
|
};
|
|
805
805
|
|
|
806
806
|
// src/sdk-version.ts
|
|
@@ -813,6 +813,7 @@ function buildSdkHeaderValue(sdkName) {
|
|
|
813
813
|
var DEFAULT_CLIENT = "railway_direct";
|
|
814
814
|
var SDK_NAME = "xylex-group/athena";
|
|
815
815
|
var SDK_HEADER_VALUE = buildSdkHeaderValue(SDK_NAME);
|
|
816
|
+
var NO_CACHE_HEADER_VALUE = "no-cache";
|
|
816
817
|
function parseResponseBody(rawText, contentType) {
|
|
817
818
|
if (!rawText) {
|
|
818
819
|
return { parsed: null, parseFailed: false };
|
|
@@ -831,6 +832,9 @@ function parseResponseBody(rawText, contentType) {
|
|
|
831
832
|
function normalizeHeaderValue(value) {
|
|
832
833
|
return value ? value : void 0;
|
|
833
834
|
}
|
|
835
|
+
function isCacheControlHeaderName(name) {
|
|
836
|
+
return name.toLowerCase() === "cache-control";
|
|
837
|
+
}
|
|
834
838
|
function resolveHeaderValue(headers, candidates) {
|
|
835
839
|
for (const candidate of candidates) {
|
|
836
840
|
const direct = normalizeHeaderValue(headers[candidate]);
|
|
@@ -989,6 +993,7 @@ function buildRpcGetEndpoint(payload) {
|
|
|
989
993
|
}
|
|
990
994
|
function buildHeaders(config, options) {
|
|
991
995
|
const mergedStripNulls = options?.stripNulls ?? true;
|
|
996
|
+
const forceNoCache = Boolean(config.forceNoCache || options?.forceNoCache);
|
|
992
997
|
const extraHeaders = {
|
|
993
998
|
...config.headers ?? {},
|
|
994
999
|
...options?.headers ?? {}
|
|
@@ -1042,11 +1047,15 @@ function buildHeaders(config, options) {
|
|
|
1042
1047
|
const athenaClientKeys = ["x-athena-client", "X-Athena-Client"];
|
|
1043
1048
|
Object.entries(extraHeaders).forEach(([key, value]) => {
|
|
1044
1049
|
if (athenaClientKeys.includes(key)) return;
|
|
1050
|
+
if (forceNoCache && isCacheControlHeaderName(key)) return;
|
|
1045
1051
|
const normalized = normalizeHeaderValue(value);
|
|
1046
1052
|
if (normalized) {
|
|
1047
1053
|
headers[key] = normalized;
|
|
1048
1054
|
}
|
|
1049
1055
|
});
|
|
1056
|
+
if (forceNoCache) {
|
|
1057
|
+
headers["Cache-Control"] = NO_CACHE_HEADER_VALUE;
|
|
1058
|
+
}
|
|
1050
1059
|
return headers;
|
|
1051
1060
|
}
|
|
1052
1061
|
function toInvalidUrlResponse(error, endpoint, method) {
|
|
@@ -1507,6 +1516,45 @@ function identifier(...segments) {
|
|
|
1507
1516
|
return new SqlIdentifierPath(expandedSegments);
|
|
1508
1517
|
}
|
|
1509
1518
|
|
|
1519
|
+
// src/auth/limits.ts
|
|
1520
|
+
var ATHENA_AUTH_MAX_ADMIN_JSON_BYTES = 32 * 1024;
|
|
1521
|
+
var ATHENA_AUTH_MAX_ADMIN_JSON_DEPTH = 8;
|
|
1522
|
+
var ATHENA_AUTH_MAX_TEMPLATE_VARIABLES = 64;
|
|
1523
|
+
var ATHENA_AUTH_MAX_TEMPLATE_VARIABLE_LENGTH = 128;
|
|
1524
|
+
var ATHENA_AUTH_ADMIN_LIMITS = {
|
|
1525
|
+
maxAdminJsonBytes: ATHENA_AUTH_MAX_ADMIN_JSON_BYTES,
|
|
1526
|
+
maxAdminJsonDepth: ATHENA_AUTH_MAX_ADMIN_JSON_DEPTH,
|
|
1527
|
+
maxTemplateVariables: ATHENA_AUTH_MAX_TEMPLATE_VARIABLES,
|
|
1528
|
+
maxTemplateVariableLength: ATHENA_AUTH_MAX_TEMPLATE_VARIABLE_LENGTH
|
|
1529
|
+
};
|
|
1530
|
+
function describeTemplateVariableTarget(target) {
|
|
1531
|
+
const normalized = target?.trim();
|
|
1532
|
+
return normalized && normalized.length > 0 ? normalized : "Athena auth admin email template variables";
|
|
1533
|
+
}
|
|
1534
|
+
function assertAthenaAuthTemplateVariables(variables, target) {
|
|
1535
|
+
const label = describeTemplateVariableTarget(target);
|
|
1536
|
+
if (!Array.isArray(variables)) {
|
|
1537
|
+
throw new Error(`${label} must be an array of strings.`);
|
|
1538
|
+
}
|
|
1539
|
+
if (variables.length > ATHENA_AUTH_MAX_TEMPLATE_VARIABLES) {
|
|
1540
|
+
throw new Error(
|
|
1541
|
+
`${label} cannot contain more than ${ATHENA_AUTH_MAX_TEMPLATE_VARIABLES} entries.`
|
|
1542
|
+
);
|
|
1543
|
+
}
|
|
1544
|
+
variables.forEach((variable, index) => {
|
|
1545
|
+
if (typeof variable !== "string") {
|
|
1546
|
+
throw new Error(
|
|
1547
|
+
`${label} must contain only strings. Received ${typeof variable} at index ${index}.`
|
|
1548
|
+
);
|
|
1549
|
+
}
|
|
1550
|
+
if (variable.length > ATHENA_AUTH_MAX_TEMPLATE_VARIABLE_LENGTH) {
|
|
1551
|
+
throw new Error(
|
|
1552
|
+
`${label} cannot contain entries longer than ${ATHENA_AUTH_MAX_TEMPLATE_VARIABLE_LENGTH} characters. Received ${variable.length} characters at index ${index}.`
|
|
1553
|
+
);
|
|
1554
|
+
}
|
|
1555
|
+
});
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1510
1558
|
// src/auth/react-email.ts
|
|
1511
1559
|
var reactEmailRenderModulePromise;
|
|
1512
1560
|
function isRecord2(value) {
|
|
@@ -1736,6 +1784,7 @@ async function resolveReactEmailPayloadFields(input, fields, options) {
|
|
|
1736
1784
|
var DEFAULT_AUTH_BASE_URL = "http://localhost:3001/api/auth";
|
|
1737
1785
|
var SDK_NAME2 = "xylex-group/athena-auth";
|
|
1738
1786
|
var SDK_HEADER_VALUE2 = buildSdkHeaderValue(SDK_NAME2);
|
|
1787
|
+
var NO_CACHE_HEADER_VALUE2 = "no-cache";
|
|
1739
1788
|
function normalizeBaseUrl(baseUrl) {
|
|
1740
1789
|
return (baseUrl ?? DEFAULT_AUTH_BASE_URL).replace(/\/$/, "");
|
|
1741
1790
|
}
|
|
@@ -1745,6 +1794,9 @@ function isRecord3(value) {
|
|
|
1745
1794
|
function normalizeHeaderValue2(value) {
|
|
1746
1795
|
return value ? value : void 0;
|
|
1747
1796
|
}
|
|
1797
|
+
function isCacheControlHeaderName2(name) {
|
|
1798
|
+
return name.toLowerCase() === "cache-control";
|
|
1799
|
+
}
|
|
1748
1800
|
function parseResponseBody2(rawText, contentType) {
|
|
1749
1801
|
if (!rawText) {
|
|
1750
1802
|
return { parsed: null, parseFailed: false };
|
|
@@ -1800,6 +1852,98 @@ function mergeCallOptions(base, override) {
|
|
|
1800
1852
|
}
|
|
1801
1853
|
};
|
|
1802
1854
|
}
|
|
1855
|
+
function copyDefinedField(target, source, targetKey, sourceKey) {
|
|
1856
|
+
if (!(sourceKey in source)) {
|
|
1857
|
+
return;
|
|
1858
|
+
}
|
|
1859
|
+
const value = source[sourceKey];
|
|
1860
|
+
if (value !== void 0) {
|
|
1861
|
+
target[targetKey] = value;
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
function normalizeAdminEmailTemplatePayload(payload) {
|
|
1865
|
+
const normalized = { ...payload };
|
|
1866
|
+
copyDefinedField(normalized, payload, "template_key", "templateKey");
|
|
1867
|
+
copyDefinedField(normalized, payload, "event_type", "eventType");
|
|
1868
|
+
copyDefinedField(normalized, payload, "subject_template", "subjectTemplate");
|
|
1869
|
+
copyDefinedField(normalized, payload, "text_template", "textTemplate");
|
|
1870
|
+
copyDefinedField(normalized, payload, "html_template", "htmlTemplate");
|
|
1871
|
+
copyDefinedField(normalized, payload, "variable_bindings", "variableBindings");
|
|
1872
|
+
copyDefinedField(normalized, payload, "attachment_failure_mode", "attachmentFailureMode");
|
|
1873
|
+
copyDefinedField(normalized, payload, "is_active", "isActive");
|
|
1874
|
+
return normalized;
|
|
1875
|
+
}
|
|
1876
|
+
function toReactEmailTemplateCompatibilityInput(input) {
|
|
1877
|
+
const payload = input;
|
|
1878
|
+
const compatibility = { ...payload };
|
|
1879
|
+
copyDefinedField(compatibility, payload, "templateKey", "template_key");
|
|
1880
|
+
copyDefinedField(compatibility, payload, "eventType", "event_type");
|
|
1881
|
+
copyDefinedField(compatibility, payload, "subjectTemplate", "subject_template");
|
|
1882
|
+
copyDefinedField(compatibility, payload, "textTemplate", "text_template");
|
|
1883
|
+
copyDefinedField(compatibility, payload, "htmlTemplate", "html_template");
|
|
1884
|
+
copyDefinedField(compatibility, payload, "variableBindings", "variable_bindings");
|
|
1885
|
+
copyDefinedField(compatibility, payload, "attachmentFailureMode", "attachment_failure_mode");
|
|
1886
|
+
copyDefinedField(compatibility, payload, "isActive", "is_active");
|
|
1887
|
+
return compatibility;
|
|
1888
|
+
}
|
|
1889
|
+
function normalizeAdminEmailTemplateSendPayload(payload) {
|
|
1890
|
+
const normalized = { ...payload };
|
|
1891
|
+
copyDefinedField(normalized, payload, "template_id", "templateId");
|
|
1892
|
+
copyDefinedField(normalized, payload, "recipient_email", "recipientEmail");
|
|
1893
|
+
copyDefinedField(normalized, payload, "render_variables", "renderVariables");
|
|
1894
|
+
copyDefinedField(normalized, payload, "user_id", "userId");
|
|
1895
|
+
copyDefinedField(normalized, payload, "organization_id", "organizationId");
|
|
1896
|
+
copyDefinedField(normalized, payload, "session_token", "sessionToken");
|
|
1897
|
+
return normalized;
|
|
1898
|
+
}
|
|
1899
|
+
function toSessionGuardFailure(sessionResult) {
|
|
1900
|
+
if (sessionResult.status === 401 || sessionResult.data == null) {
|
|
1901
|
+
return {
|
|
1902
|
+
ok: false,
|
|
1903
|
+
reason: "unauthorized",
|
|
1904
|
+
status: 401,
|
|
1905
|
+
error: sessionResult.error ?? "Unauthorized",
|
|
1906
|
+
sessionResult
|
|
1907
|
+
};
|
|
1908
|
+
}
|
|
1909
|
+
return {
|
|
1910
|
+
ok: false,
|
|
1911
|
+
reason: "upstream_error",
|
|
1912
|
+
status: sessionResult.status,
|
|
1913
|
+
error: sessionResult.error ?? "Failed to resolve current session",
|
|
1914
|
+
sessionResult
|
|
1915
|
+
};
|
|
1916
|
+
}
|
|
1917
|
+
function toPermissionGuardFailure(permissionResult, sessionResult) {
|
|
1918
|
+
if (permissionResult.status === 401) {
|
|
1919
|
+
return {
|
|
1920
|
+
ok: false,
|
|
1921
|
+
reason: "unauthorized",
|
|
1922
|
+
status: 401,
|
|
1923
|
+
error: permissionResult.error ?? "Unauthorized",
|
|
1924
|
+
sessionResult,
|
|
1925
|
+
permissionResult
|
|
1926
|
+
};
|
|
1927
|
+
}
|
|
1928
|
+
if (permissionResult.status === 403) {
|
|
1929
|
+
return {
|
|
1930
|
+
ok: false,
|
|
1931
|
+
reason: "forbidden",
|
|
1932
|
+
status: 403,
|
|
1933
|
+
error: permissionResult.error ?? "Forbidden",
|
|
1934
|
+
sessionResult,
|
|
1935
|
+
permissionResult
|
|
1936
|
+
};
|
|
1937
|
+
}
|
|
1938
|
+
return {
|
|
1939
|
+
ok: false,
|
|
1940
|
+
reason: "upstream_error",
|
|
1941
|
+
status: permissionResult.status,
|
|
1942
|
+
error: permissionResult.error ?? "Failed to resolve permission check",
|
|
1943
|
+
sessionResult,
|
|
1944
|
+
permissionResult
|
|
1945
|
+
};
|
|
1946
|
+
}
|
|
1803
1947
|
function extractFetchOptions(input) {
|
|
1804
1948
|
if (!input) {
|
|
1805
1949
|
return {
|
|
@@ -1815,6 +1959,7 @@ function extractFetchOptions(input) {
|
|
|
1815
1959
|
};
|
|
1816
1960
|
}
|
|
1817
1961
|
function buildHeaders2(config, options) {
|
|
1962
|
+
const forceNoCache = Boolean(config.forceNoCache || options?.forceNoCache);
|
|
1818
1963
|
const headers = {
|
|
1819
1964
|
"Content-Type": "application/json",
|
|
1820
1965
|
"X-Athena-Sdk": SDK_HEADER_VALUE2
|
|
@@ -1828,16 +1973,30 @@ function buildHeaders2(config, options) {
|
|
|
1828
1973
|
if (bearerToken) {
|
|
1829
1974
|
headers.Authorization = `Bearer ${bearerToken}`;
|
|
1830
1975
|
}
|
|
1976
|
+
const cookie = options?.cookie ?? config.cookie;
|
|
1977
|
+
if (cookie) {
|
|
1978
|
+
headers.Cookie = cookie;
|
|
1979
|
+
}
|
|
1980
|
+
const sessionToken = options?.sessionToken ?? config.sessionToken;
|
|
1981
|
+
if (sessionToken) {
|
|
1982
|
+
headers["X-Athena-Auth-Session-Token"] = sessionToken;
|
|
1983
|
+
}
|
|
1831
1984
|
const mergedExtraHeaders = {
|
|
1832
1985
|
...config.headers ?? {},
|
|
1833
1986
|
...options?.headers ?? {}
|
|
1834
1987
|
};
|
|
1835
1988
|
Object.entries(mergedExtraHeaders).forEach(([key, value]) => {
|
|
1989
|
+
if (forceNoCache && isCacheControlHeaderName2(key)) {
|
|
1990
|
+
return;
|
|
1991
|
+
}
|
|
1836
1992
|
const normalized = normalizeHeaderValue2(value);
|
|
1837
1993
|
if (normalized) {
|
|
1838
1994
|
headers[key] = normalized;
|
|
1839
1995
|
}
|
|
1840
1996
|
});
|
|
1997
|
+
if (forceNoCache) {
|
|
1998
|
+
headers["Cache-Control"] = NO_CACHE_HEADER_VALUE2;
|
|
1999
|
+
}
|
|
1841
2000
|
return headers;
|
|
1842
2001
|
}
|
|
1843
2002
|
function appendQueryParam(searchParams, key, value) {
|
|
@@ -2043,7 +2202,7 @@ function createAuthClient(config = {}) {
|
|
|
2043
2202
|
...config,
|
|
2044
2203
|
baseUrl: normalizedBaseUrl
|
|
2045
2204
|
};
|
|
2046
|
-
const
|
|
2205
|
+
const request2 = (input, options) => {
|
|
2047
2206
|
const method = input.method ?? (input.body !== void 0 ? "POST" : inferDefaultMethod(input.endpoint));
|
|
2048
2207
|
const mergedOptions = mergeCallOptions(input.fetchOptions, options);
|
|
2049
2208
|
return callAuthEndpoint(
|
|
@@ -2056,7 +2215,7 @@ function createAuthClient(config = {}) {
|
|
|
2056
2215
|
};
|
|
2057
2216
|
const postGeneric = (endpoint, input, options) => {
|
|
2058
2217
|
const { payload, fetchOptions } = extractFetchOptions(input);
|
|
2059
|
-
return
|
|
2218
|
+
return request2(
|
|
2060
2219
|
{
|
|
2061
2220
|
endpoint,
|
|
2062
2221
|
method: "POST",
|
|
@@ -2068,7 +2227,7 @@ function createAuthClient(config = {}) {
|
|
|
2068
2227
|
};
|
|
2069
2228
|
const getGeneric = (endpoint, input, options) => {
|
|
2070
2229
|
const { fetchOptions } = extractFetchOptions(input);
|
|
2071
|
-
return
|
|
2230
|
+
return request2(
|
|
2072
2231
|
{
|
|
2073
2232
|
endpoint,
|
|
2074
2233
|
method: "GET",
|
|
@@ -2080,7 +2239,7 @@ function createAuthClient(config = {}) {
|
|
|
2080
2239
|
const getWithQuery = (endpoint, input, options) => {
|
|
2081
2240
|
const { payload, fetchOptions } = extractFetchOptions(input);
|
|
2082
2241
|
const query = payload?.query;
|
|
2083
|
-
return
|
|
2242
|
+
return request2(
|
|
2084
2243
|
{
|
|
2085
2244
|
endpoint,
|
|
2086
2245
|
method: "GET",
|
|
@@ -2098,11 +2257,96 @@ function createAuthClient(config = {}) {
|
|
|
2098
2257
|
htmlField: "htmlBody",
|
|
2099
2258
|
textField: "textBody"
|
|
2100
2259
|
}, withReactEmailRoute(route));
|
|
2101
|
-
const resolveAdminEmailTemplatePayload = (route, input) => resolveReactEmailPayloadFields(input, {
|
|
2260
|
+
const resolveAdminEmailTemplatePayload = (route, input) => resolveReactEmailPayloadFields(toReactEmailTemplateCompatibilityInput(input), {
|
|
2102
2261
|
htmlField: "htmlTemplate",
|
|
2103
2262
|
textField: "textTemplate",
|
|
2104
2263
|
variablesField: "variables"
|
|
2105
|
-
}, withReactEmailRoute(route))
|
|
2264
|
+
}, withReactEmailRoute(route)).then((payload) => {
|
|
2265
|
+
const normalizedPayload = normalizeAdminEmailTemplatePayload(payload);
|
|
2266
|
+
if ("variables" in payload && payload.variables !== void 0 && payload.variables !== null) {
|
|
2267
|
+
assertAthenaAuthTemplateVariables(
|
|
2268
|
+
payload.variables,
|
|
2269
|
+
`${route} variables`
|
|
2270
|
+
);
|
|
2271
|
+
}
|
|
2272
|
+
return normalizedPayload;
|
|
2273
|
+
});
|
|
2274
|
+
const requireSession = async (input, options) => {
|
|
2275
|
+
const sessionInput = input?.fetchOptions ? { fetchOptions: input.fetchOptions } : void 0;
|
|
2276
|
+
const sessionResult = await getGeneric(
|
|
2277
|
+
"/get-session",
|
|
2278
|
+
sessionInput,
|
|
2279
|
+
options
|
|
2280
|
+
);
|
|
2281
|
+
if (!sessionResult.ok || sessionResult.data == null) {
|
|
2282
|
+
return toSessionGuardFailure(sessionResult);
|
|
2283
|
+
}
|
|
2284
|
+
return {
|
|
2285
|
+
ok: true,
|
|
2286
|
+
session: sessionResult.data
|
|
2287
|
+
};
|
|
2288
|
+
};
|
|
2289
|
+
const getUser = async (input, options) => {
|
|
2290
|
+
const sessionResult = await getGeneric(
|
|
2291
|
+
"/get-session",
|
|
2292
|
+
input,
|
|
2293
|
+
options
|
|
2294
|
+
);
|
|
2295
|
+
if (!sessionResult.ok) {
|
|
2296
|
+
return {
|
|
2297
|
+
...sessionResult,
|
|
2298
|
+
data: null
|
|
2299
|
+
};
|
|
2300
|
+
}
|
|
2301
|
+
return {
|
|
2302
|
+
...sessionResult,
|
|
2303
|
+
data: {
|
|
2304
|
+
user: sessionResult.data?.user ?? null
|
|
2305
|
+
}
|
|
2306
|
+
};
|
|
2307
|
+
};
|
|
2308
|
+
const requirePermission = async (endpoint, input, options) => {
|
|
2309
|
+
const sessionGuard = await requireSession(
|
|
2310
|
+
input?.fetchOptions ? { fetchOptions: input.fetchOptions } : void 0,
|
|
2311
|
+
options
|
|
2312
|
+
);
|
|
2313
|
+
if (!sessionGuard.ok) {
|
|
2314
|
+
return sessionGuard;
|
|
2315
|
+
}
|
|
2316
|
+
const permissionResult = await postGeneric(
|
|
2317
|
+
endpoint,
|
|
2318
|
+
input,
|
|
2319
|
+
options
|
|
2320
|
+
);
|
|
2321
|
+
if (!permissionResult.ok) {
|
|
2322
|
+
return toPermissionGuardFailure(permissionResult, {
|
|
2323
|
+
ok: true,
|
|
2324
|
+
status: 200,
|
|
2325
|
+
data: sessionGuard.session,
|
|
2326
|
+
error: null,
|
|
2327
|
+
errorDetails: null,
|
|
2328
|
+
raw: sessionGuard.session
|
|
2329
|
+
});
|
|
2330
|
+
}
|
|
2331
|
+
if (!permissionResult.data?.success) {
|
|
2332
|
+
return {
|
|
2333
|
+
ok: false,
|
|
2334
|
+
reason: "forbidden",
|
|
2335
|
+
status: 403,
|
|
2336
|
+
error: permissionResult.data?.error ?? "Forbidden",
|
|
2337
|
+
sessionResult: {
|
|
2338
|
+
ok: true,
|
|
2339
|
+
status: 200,
|
|
2340
|
+
data: sessionGuard.session,
|
|
2341
|
+
error: null,
|
|
2342
|
+
errorDetails: null,
|
|
2343
|
+
raw: sessionGuard.session
|
|
2344
|
+
},
|
|
2345
|
+
permissionResult
|
|
2346
|
+
};
|
|
2347
|
+
}
|
|
2348
|
+
return sessionGuard;
|
|
2349
|
+
};
|
|
2106
2350
|
const listUserEmailsWithFallback = async (input, options) => {
|
|
2107
2351
|
const primary = await getWithQuery(
|
|
2108
2352
|
"/email/list",
|
|
@@ -2264,6 +2508,7 @@ function createAuthClient(config = {}) {
|
|
|
2264
2508
|
input,
|
|
2265
2509
|
options
|
|
2266
2510
|
),
|
|
2511
|
+
requirePermission: (input, options) => requirePermission("/organization/has-permission", input, options),
|
|
2267
2512
|
invitation: {
|
|
2268
2513
|
cancel: (input, options) => executePostWithCompatibleInput(
|
|
2269
2514
|
resolvedConfig,
|
|
@@ -2459,6 +2704,8 @@ function createAuthClient(config = {}) {
|
|
|
2459
2704
|
};
|
|
2460
2705
|
const auth = {
|
|
2461
2706
|
getSession: (input, options) => getGeneric("/get-session", input, options),
|
|
2707
|
+
getUser,
|
|
2708
|
+
requireSession,
|
|
2462
2709
|
signOut,
|
|
2463
2710
|
forgetPassword: (input, options) => postGeneric("/forget-password", input, options),
|
|
2464
2711
|
resetPassword: authResetPassword,
|
|
@@ -2553,6 +2800,7 @@ function createAuthClient(config = {}) {
|
|
|
2553
2800
|
}
|
|
2554
2801
|
},
|
|
2555
2802
|
hasPermission: (input, options) => postGeneric("/admin/has-permission", input, options),
|
|
2803
|
+
requirePermission: (input, options) => requirePermission("/admin/has-permission", input, options),
|
|
2556
2804
|
apiKey: {
|
|
2557
2805
|
create: (input, options) => postGeneric("/admin/api-key/create", input, options)
|
|
2558
2806
|
},
|
|
@@ -2597,7 +2845,15 @@ function createAuthClient(config = {}) {
|
|
|
2597
2845
|
await resolveAdminEmailTemplatePayload("/admin/email-template/update", input),
|
|
2598
2846
|
options
|
|
2599
2847
|
),
|
|
2600
|
-
delete: (input, options) => postGeneric("/admin/email-template/delete", input, options)
|
|
2848
|
+
delete: (input, options) => postGeneric("/admin/email-template/delete", input, options),
|
|
2849
|
+
send: (input, options) => postGeneric(
|
|
2850
|
+
"/admin/email-template/send",
|
|
2851
|
+
normalizeAdminEmailTemplateSendPayload(extractFetchOptions(input).payload),
|
|
2852
|
+
options
|
|
2853
|
+
)
|
|
2854
|
+
},
|
|
2855
|
+
eventType: {
|
|
2856
|
+
list: (input, options) => getWithQuery("/admin/email-event-type/list", input, options)
|
|
2601
2857
|
}
|
|
2602
2858
|
},
|
|
2603
2859
|
emailTemplate: {
|
|
@@ -2613,7 +2869,15 @@ function createAuthClient(config = {}) {
|
|
|
2613
2869
|
"/admin/email-template/update",
|
|
2614
2870
|
await resolveAdminEmailTemplatePayload("/admin/email-template/update", input),
|
|
2615
2871
|
options
|
|
2872
|
+
),
|
|
2873
|
+
send: (input, options) => postGeneric(
|
|
2874
|
+
"/admin/email-template/send",
|
|
2875
|
+
normalizeAdminEmailTemplateSendPayload(extractFetchOptions(input).payload),
|
|
2876
|
+
options
|
|
2616
2877
|
)
|
|
2878
|
+
},
|
|
2879
|
+
emailEventType: {
|
|
2880
|
+
list: (input, options) => getWithQuery("/admin/email-event-type/list", input, options)
|
|
2617
2881
|
}
|
|
2618
2882
|
},
|
|
2619
2883
|
apiKey: {
|
|
@@ -2653,7 +2917,7 @@ function createAuthClient(config = {}) {
|
|
|
2653
2917
|
throw new Error("callback.provider requires non-empty code and state values");
|
|
2654
2918
|
}
|
|
2655
2919
|
const endpoint = `/callback/${encodeURIComponent(provider)}`;
|
|
2656
|
-
return
|
|
2920
|
+
return request2({
|
|
2657
2921
|
endpoint,
|
|
2658
2922
|
method: "GET",
|
|
2659
2923
|
query: {
|
|
@@ -2667,7 +2931,7 @@ function createAuthClient(config = {}) {
|
|
|
2667
2931
|
};
|
|
2668
2932
|
return {
|
|
2669
2933
|
baseUrl: normalizedBaseUrl,
|
|
2670
|
-
request,
|
|
2934
|
+
request: request2,
|
|
2671
2935
|
signIn: {
|
|
2672
2936
|
email: (input, options) => executePostWithCompatibleInput(
|
|
2673
2937
|
resolvedConfig,
|
|
@@ -2704,6 +2968,8 @@ function createAuthClient(config = {}) {
|
|
|
2704
2968
|
input,
|
|
2705
2969
|
options
|
|
2706
2970
|
),
|
|
2971
|
+
getUser,
|
|
2972
|
+
requireSession,
|
|
2707
2973
|
listSessions: (input, options) => executeGetWithCompatibleInput(
|
|
2708
2974
|
resolvedConfig,
|
|
2709
2975
|
{ endpoint: "/list-sessions", method: "GET" },
|
|
@@ -3406,16 +3672,16 @@ function createStorageFileModule(base, config = {}) {
|
|
|
3406
3672
|
};
|
|
3407
3673
|
});
|
|
3408
3674
|
input.onProgress?.(createProgressSnapshot("preparing", sources, 0, 0, 0));
|
|
3409
|
-
const uploadUrls = uploadRequests.length === 1 ? [await base.createStorageUploadUrl(uploadRequests[0].uploadRequest, options)] : (await base.createStorageUploadUrls({ files: uploadRequests.map((
|
|
3675
|
+
const uploadUrls = uploadRequests.length === 1 ? [await base.createStorageUploadUrl(uploadRequests[0].uploadRequest, options)] : (await base.createStorageUploadUrls({ files: uploadRequests.map((request2) => request2.uploadRequest) }, options)).files;
|
|
3410
3676
|
const aggregateLoaded = new Array(uploadRequests.length).fill(0);
|
|
3411
3677
|
const uploaded = [];
|
|
3412
3678
|
for (let index = 0; index < uploadRequests.length; index += 1) {
|
|
3413
|
-
const
|
|
3679
|
+
const request2 = uploadRequests[index];
|
|
3414
3680
|
const uploadUrl = uploadUrls[index];
|
|
3415
3681
|
const response = await putUploadBody(
|
|
3416
3682
|
uploadUrl.upload.url,
|
|
3417
3683
|
uploadUrl.upload.headers ?? {},
|
|
3418
|
-
|
|
3684
|
+
request2.source,
|
|
3419
3685
|
input,
|
|
3420
3686
|
options,
|
|
3421
3687
|
(progress) => {
|
|
@@ -3426,13 +3692,13 @@ function createStorageFileModule(base, config = {}) {
|
|
|
3426
3692
|
uploaded.push({
|
|
3427
3693
|
file: uploadUrl.file,
|
|
3428
3694
|
upload: uploadUrl.upload,
|
|
3429
|
-
source:
|
|
3430
|
-
fileName:
|
|
3431
|
-
storage_key:
|
|
3695
|
+
source: request2.source.source,
|
|
3696
|
+
fileName: request2.source.fileName,
|
|
3697
|
+
storage_key: request2.uploadRequest.storage_key,
|
|
3432
3698
|
response
|
|
3433
3699
|
});
|
|
3434
|
-
aggregateLoaded[index] =
|
|
3435
|
-
input.onProgress?.(createProgressSnapshot("complete", sources, index,
|
|
3700
|
+
aggregateLoaded[index] = request2.source.sizeBytes;
|
|
3701
|
+
input.onProgress?.(createProgressSnapshot("complete", sources, index, request2.source.sizeBytes, sum(aggregateLoaded)));
|
|
3436
3702
|
}
|
|
3437
3703
|
return {
|
|
3438
3704
|
files: uploaded,
|
|
@@ -5407,113 +5673,636 @@ function createStorageModule(gateway, runtimeOptions) {
|
|
|
5407
5673
|
};
|
|
5408
5674
|
}
|
|
5409
5675
|
|
|
5410
|
-
// src/
|
|
5411
|
-
var
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
|
|
5428
|
-
merged.headers = mergeHeaders(current?.headers, next.headers ?? {});
|
|
5676
|
+
// src/chat/module.ts
|
|
5677
|
+
var SDK_NAME3 = "xylex-group/athena-chat";
|
|
5678
|
+
var SDK_HEADER_VALUE3 = buildSdkHeaderValue(SDK_NAME3);
|
|
5679
|
+
var NO_CACHE_HEADER_VALUE3 = "no-cache";
|
|
5680
|
+
var AthenaChatError = class extends Error {
|
|
5681
|
+
status;
|
|
5682
|
+
endpoint;
|
|
5683
|
+
method;
|
|
5684
|
+
requestId;
|
|
5685
|
+
body;
|
|
5686
|
+
constructor(input) {
|
|
5687
|
+
super(input.message);
|
|
5688
|
+
this.name = "AthenaChatError";
|
|
5689
|
+
this.status = input.status;
|
|
5690
|
+
this.endpoint = input.endpoint;
|
|
5691
|
+
this.method = input.method;
|
|
5692
|
+
this.requestId = input.requestId;
|
|
5693
|
+
this.body = input.body;
|
|
5429
5694
|
}
|
|
5430
|
-
|
|
5695
|
+
};
|
|
5696
|
+
function deriveRealtimeInfoUrl(wsUrl) {
|
|
5697
|
+
if (!wsUrl) {
|
|
5698
|
+
return void 0;
|
|
5699
|
+
}
|
|
5700
|
+
const parsed = new URL(normalizeWsUrl(wsUrl, "Athena chat WebSocket URL"));
|
|
5701
|
+
parsed.protocol = parsed.protocol === "wss:" ? "https:" : "http:";
|
|
5702
|
+
parsed.pathname = parsed.pathname.replace(/\/wss\/gateway$/, "/wss/info");
|
|
5703
|
+
return parsed.toString();
|
|
5431
5704
|
}
|
|
5432
|
-
function
|
|
5433
|
-
const
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
};
|
|
5437
|
-
if (current?.traceQueries && typeof current.traceQueries === "object" && next.traceQueries && typeof next.traceQueries === "object") {
|
|
5438
|
-
merged.traceQueries = {
|
|
5439
|
-
...current.traceQueries,
|
|
5440
|
-
...next.traceQueries
|
|
5441
|
-
};
|
|
5705
|
+
function normalizeWsUrl(value, label) {
|
|
5706
|
+
const normalized = value.trim();
|
|
5707
|
+
if (!normalized) {
|
|
5708
|
+
throw new Error(`${label} is required.`);
|
|
5442
5709
|
}
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
};
|
|
5710
|
+
let parsed;
|
|
5711
|
+
try {
|
|
5712
|
+
parsed = new URL(normalized);
|
|
5713
|
+
} catch {
|
|
5714
|
+
throw new Error(`${label} must be a valid absolute ws(s) URL.`);
|
|
5448
5715
|
}
|
|
5449
|
-
|
|
5716
|
+
if (parsed.protocol !== "ws:" && parsed.protocol !== "wss:") {
|
|
5717
|
+
throw new Error(`${label} must use ws or wss.`);
|
|
5718
|
+
}
|
|
5719
|
+
parsed.pathname = parsed.pathname.replace(/\/+$/, "");
|
|
5720
|
+
return parsed.toString().replace(/\/$/, "");
|
|
5450
5721
|
}
|
|
5451
|
-
function
|
|
5452
|
-
return
|
|
5722
|
+
function isRecord7(value) {
|
|
5723
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
5453
5724
|
}
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5725
|
+
function normalizeHeaderValue3(value) {
|
|
5726
|
+
return value ? value : void 0;
|
|
5727
|
+
}
|
|
5728
|
+
function parseResponseBody4(rawText, contentType) {
|
|
5729
|
+
if (!rawText) {
|
|
5730
|
+
return { parsed: null, parseFailed: false };
|
|
5457
5731
|
}
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
defaultHeaders;
|
|
5463
|
-
authConfig;
|
|
5464
|
-
dbUrlOverride;
|
|
5465
|
-
gatewayUrlOverride;
|
|
5466
|
-
authUrlOverride;
|
|
5467
|
-
storageUrlOverride;
|
|
5468
|
-
experimentalOptions;
|
|
5469
|
-
url(url) {
|
|
5470
|
-
this.rootUrl = url;
|
|
5471
|
-
return this;
|
|
5732
|
+
const contentTypeSuggestsJson = contentType?.toLowerCase().includes("application/json") ?? false;
|
|
5733
|
+
const looksJson = contentTypeSuggestsJson || rawText.startsWith("{") || rawText.startsWith("[");
|
|
5734
|
+
if (!looksJson) {
|
|
5735
|
+
return { parsed: rawText, parseFailed: false };
|
|
5472
5736
|
}
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5737
|
+
try {
|
|
5738
|
+
return { parsed: JSON.parse(rawText), parseFailed: false };
|
|
5739
|
+
} catch {
|
|
5740
|
+
return { parsed: rawText, parseFailed: true };
|
|
5476
5741
|
}
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5742
|
+
}
|
|
5743
|
+
function resolveRequestId3(headers) {
|
|
5744
|
+
return headers.get("x-request-id") ?? headers.get("x-correlation-id") ?? headers.get("x-athena-request-id") ?? void 0;
|
|
5745
|
+
}
|
|
5746
|
+
function resolveErrorMessage4(payload, fallback) {
|
|
5747
|
+
if (isRecord7(payload)) {
|
|
5748
|
+
for (const candidate of [payload.error, payload.message, payload.details]) {
|
|
5749
|
+
if (typeof candidate === "string" && candidate.trim().length > 0) {
|
|
5750
|
+
return candidate.trim();
|
|
5751
|
+
}
|
|
5752
|
+
}
|
|
5480
5753
|
}
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
return this;
|
|
5754
|
+
if (typeof payload === "string" && payload.trim().length > 0) {
|
|
5755
|
+
return payload.trim();
|
|
5484
5756
|
}
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5757
|
+
return fallback;
|
|
5758
|
+
}
|
|
5759
|
+
function encodePathSegment(value, label) {
|
|
5760
|
+
const normalized = value.trim();
|
|
5761
|
+
if (!normalized) {
|
|
5762
|
+
throw new Error(`${label} is required.`);
|
|
5488
5763
|
}
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5764
|
+
return encodeURIComponent(normalized);
|
|
5765
|
+
}
|
|
5766
|
+
function encodeQuery(query) {
|
|
5767
|
+
if (!query) {
|
|
5768
|
+
return "";
|
|
5492
5769
|
}
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
if (
|
|
5496
|
-
|
|
5497
|
-
}
|
|
5498
|
-
if (options.athenaStorageBackend) {
|
|
5499
|
-
return resolveBuilderReturn(this);
|
|
5770
|
+
const params = new URLSearchParams();
|
|
5771
|
+
for (const [key, value] of Object.entries(query)) {
|
|
5772
|
+
if (value === void 0 || value === null) {
|
|
5773
|
+
continue;
|
|
5500
5774
|
}
|
|
5501
|
-
if (
|
|
5502
|
-
|
|
5775
|
+
if (Array.isArray(value)) {
|
|
5776
|
+
for (const item of value) {
|
|
5777
|
+
if (item !== void 0 && item !== null) {
|
|
5778
|
+
params.append(key, String(item));
|
|
5779
|
+
}
|
|
5780
|
+
}
|
|
5781
|
+
continue;
|
|
5503
5782
|
}
|
|
5504
|
-
|
|
5783
|
+
params.set(key, String(value));
|
|
5505
5784
|
}
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5785
|
+
const encoded = params.toString();
|
|
5786
|
+
return encoded ? `?${encoded}` : "";
|
|
5787
|
+
}
|
|
5788
|
+
function createSocket(factory, url, protocols) {
|
|
5789
|
+
try {
|
|
5790
|
+
return new factory(url, protocols);
|
|
5791
|
+
} catch (error) {
|
|
5792
|
+
if (error instanceof TypeError) {
|
|
5793
|
+
return factory(url, protocols);
|
|
5509
5794
|
}
|
|
5510
|
-
|
|
5511
|
-
|
|
5795
|
+
throw error;
|
|
5796
|
+
}
|
|
5797
|
+
}
|
|
5798
|
+
function buildHeaders3(config, options) {
|
|
5799
|
+
const headers = {
|
|
5800
|
+
Accept: "application/json",
|
|
5801
|
+
apikey: config.apiKey,
|
|
5802
|
+
"x-api-key": config.apiKey,
|
|
5803
|
+
"X-Athena-Sdk": SDK_HEADER_VALUE3
|
|
5804
|
+
};
|
|
5805
|
+
if (config.client || options?.client) {
|
|
5806
|
+
headers["X-Athena-Client"] = options?.client ?? config.client ?? "";
|
|
5807
|
+
}
|
|
5808
|
+
const bearerToken = options?.bearerToken ?? config.bearerToken;
|
|
5809
|
+
if (typeof bearerToken === "string" && bearerToken.trim()) {
|
|
5810
|
+
headers.Authorization = bearerToken.startsWith("Bearer ") ? bearerToken : `Bearer ${bearerToken}`;
|
|
5811
|
+
}
|
|
5812
|
+
const cookie = options?.cookie ?? config.cookie;
|
|
5813
|
+
if (typeof cookie === "string" && cookie.trim()) {
|
|
5814
|
+
headers.Cookie = cookie;
|
|
5815
|
+
}
|
|
5816
|
+
const sessionToken = options?.sessionToken ?? config.sessionToken;
|
|
5817
|
+
if (typeof sessionToken === "string" && sessionToken.trim()) {
|
|
5818
|
+
headers["X-Athena-Auth-Session-Token"] = sessionToken;
|
|
5819
|
+
}
|
|
5820
|
+
if (config.forceNoCache || options?.forceNoCache) {
|
|
5821
|
+
headers["Cache-Control"] = NO_CACHE_HEADER_VALUE3;
|
|
5822
|
+
}
|
|
5823
|
+
for (const source of [config.headers, options?.headers]) {
|
|
5824
|
+
for (const [key, value] of Object.entries(source ?? {})) {
|
|
5825
|
+
const normalized = normalizeHeaderValue3(value);
|
|
5826
|
+
if (normalized) {
|
|
5827
|
+
headers[key] = normalized;
|
|
5828
|
+
}
|
|
5512
5829
|
}
|
|
5513
|
-
|
|
5514
|
-
|
|
5830
|
+
}
|
|
5831
|
+
return headers;
|
|
5832
|
+
}
|
|
5833
|
+
function withJsonBody(init, body) {
|
|
5834
|
+
return {
|
|
5835
|
+
...init,
|
|
5836
|
+
body: body === void 0 ? void 0 : JSON.stringify(body),
|
|
5837
|
+
headers: {
|
|
5838
|
+
"Content-Type": "application/json",
|
|
5839
|
+
...init.headers
|
|
5515
5840
|
}
|
|
5516
|
-
|
|
5841
|
+
};
|
|
5842
|
+
}
|
|
5843
|
+
async function request(config, method, endpoint, options, body) {
|
|
5844
|
+
if (!config.baseUrl) {
|
|
5845
|
+
throw new Error(
|
|
5846
|
+
"Athena chat base URL is not configured. Pass createClient({ url }) for unified routing or set chat.url / chatUrl explicitly."
|
|
5847
|
+
);
|
|
5848
|
+
}
|
|
5849
|
+
const url = `${config.baseUrl}${endpoint}`;
|
|
5850
|
+
const init = {
|
|
5851
|
+
method,
|
|
5852
|
+
headers: buildHeaders3(config, options),
|
|
5853
|
+
signal: options?.signal
|
|
5854
|
+
};
|
|
5855
|
+
const finalInit = body === void 0 || method === "GET" ? init : withJsonBody(init, body);
|
|
5856
|
+
const response = await fetch(url, finalInit);
|
|
5857
|
+
const rawText = await response.text();
|
|
5858
|
+
const { parsed } = parseResponseBody4(rawText, response.headers.get("content-type"));
|
|
5859
|
+
if (!response.ok) {
|
|
5860
|
+
throw new AthenaChatError({
|
|
5861
|
+
message: resolveErrorMessage4(parsed, `Athena chat ${method} ${endpoint} failed with ${response.status}`),
|
|
5862
|
+
status: response.status,
|
|
5863
|
+
endpoint,
|
|
5864
|
+
method,
|
|
5865
|
+
requestId: resolveRequestId3(response.headers),
|
|
5866
|
+
body: parsed
|
|
5867
|
+
});
|
|
5868
|
+
}
|
|
5869
|
+
return parsed;
|
|
5870
|
+
}
|
|
5871
|
+
function unwrapEnvelopeData(payload) {
|
|
5872
|
+
return payload.data;
|
|
5873
|
+
}
|
|
5874
|
+
function createRealtimeConnection(config, options) {
|
|
5875
|
+
if (!config.wsUrl) {
|
|
5876
|
+
throw new Error(
|
|
5877
|
+
"Athena chat WebSocket URL is not configured. Pass createClient({ url }) for unified routing or set chat.wsUrl / chatWsUrl explicitly."
|
|
5878
|
+
);
|
|
5879
|
+
}
|
|
5880
|
+
const wsFactory = config.webSocketFactory ?? globalThis.WebSocket;
|
|
5881
|
+
if (!wsFactory) {
|
|
5882
|
+
throw new Error(
|
|
5883
|
+
"No WebSocket implementation is available. Provide chat.webSocketFactory in createClient(...) or run in a runtime with global WebSocket support."
|
|
5884
|
+
);
|
|
5885
|
+
}
|
|
5886
|
+
const socket = createSocket(wsFactory, config.wsUrl, options?.protocols);
|
|
5887
|
+
const send = (command) => {
|
|
5888
|
+
socket.send(JSON.stringify(command));
|
|
5889
|
+
};
|
|
5890
|
+
if (options?.onMessage) {
|
|
5891
|
+
const listener = (event) => {
|
|
5892
|
+
const messageEvent = event;
|
|
5893
|
+
const raw = messageEvent?.data;
|
|
5894
|
+
if (typeof raw !== "string") {
|
|
5895
|
+
return;
|
|
5896
|
+
}
|
|
5897
|
+
try {
|
|
5898
|
+
options.onMessage?.(JSON.parse(raw));
|
|
5899
|
+
} catch {
|
|
5900
|
+
options.onMessage?.({ type: "error", error: "Invalid JSON message from Athena chat realtime gateway." });
|
|
5901
|
+
}
|
|
5902
|
+
};
|
|
5903
|
+
if (typeof socket.addEventListener === "function") {
|
|
5904
|
+
socket.addEventListener("message", listener);
|
|
5905
|
+
} else {
|
|
5906
|
+
socket.onmessage = listener;
|
|
5907
|
+
}
|
|
5908
|
+
}
|
|
5909
|
+
const hello = (command) => {
|
|
5910
|
+
send({
|
|
5911
|
+
type: "auth.hello",
|
|
5912
|
+
token: command?.token,
|
|
5913
|
+
room_subscriptions: command?.room_subscriptions
|
|
5914
|
+
});
|
|
5915
|
+
};
|
|
5916
|
+
if (options?.hello) {
|
|
5917
|
+
const onOpen = () => hello({
|
|
5918
|
+
token: options.hello?.token ?? void 0,
|
|
5919
|
+
room_subscriptions: options.hello?.room_subscriptions ?? void 0
|
|
5920
|
+
});
|
|
5921
|
+
if (typeof socket.addEventListener === "function") {
|
|
5922
|
+
socket.addEventListener("open", onOpen);
|
|
5923
|
+
} else {
|
|
5924
|
+
socket.onopen = onOpen;
|
|
5925
|
+
}
|
|
5926
|
+
}
|
|
5927
|
+
return {
|
|
5928
|
+
socket,
|
|
5929
|
+
send,
|
|
5930
|
+
hello,
|
|
5931
|
+
subscribe(roomId, fromSeq) {
|
|
5932
|
+
send({
|
|
5933
|
+
type: "chat.subscribe",
|
|
5934
|
+
room_id: roomId,
|
|
5935
|
+
from_seq: fromSeq ?? void 0
|
|
5936
|
+
});
|
|
5937
|
+
},
|
|
5938
|
+
unsubscribe(roomId) {
|
|
5939
|
+
send({
|
|
5940
|
+
type: "chat.unsubscribe",
|
|
5941
|
+
room_id: roomId
|
|
5942
|
+
});
|
|
5943
|
+
},
|
|
5944
|
+
resume(rooms) {
|
|
5945
|
+
send({
|
|
5946
|
+
type: "chat.resume",
|
|
5947
|
+
rooms
|
|
5948
|
+
});
|
|
5949
|
+
},
|
|
5950
|
+
typingStart(roomId) {
|
|
5951
|
+
send({
|
|
5952
|
+
type: "chat.typing.start",
|
|
5953
|
+
room_id: roomId
|
|
5954
|
+
});
|
|
5955
|
+
},
|
|
5956
|
+
typingStop(roomId) {
|
|
5957
|
+
send({
|
|
5958
|
+
type: "chat.typing.stop",
|
|
5959
|
+
room_id: roomId
|
|
5960
|
+
});
|
|
5961
|
+
},
|
|
5962
|
+
presenceHeartbeat(activeRoomId) {
|
|
5963
|
+
send({
|
|
5964
|
+
type: "chat.presence.heartbeat",
|
|
5965
|
+
active_room_id: activeRoomId ?? void 0
|
|
5966
|
+
});
|
|
5967
|
+
},
|
|
5968
|
+
readUpTo(roomId, input) {
|
|
5969
|
+
send({
|
|
5970
|
+
type: "chat.read.up_to",
|
|
5971
|
+
room_id: roomId,
|
|
5972
|
+
message_id: input?.message_id ?? void 0,
|
|
5973
|
+
seq: input?.seq ?? void 0
|
|
5974
|
+
});
|
|
5975
|
+
},
|
|
5976
|
+
ping(at = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
5977
|
+
send({
|
|
5978
|
+
type: "ping",
|
|
5979
|
+
at
|
|
5980
|
+
});
|
|
5981
|
+
},
|
|
5982
|
+
close(code, reason) {
|
|
5983
|
+
socket.close(code, reason);
|
|
5984
|
+
}
|
|
5985
|
+
};
|
|
5986
|
+
}
|
|
5987
|
+
function createChatModule(config) {
|
|
5988
|
+
const realtime = {
|
|
5989
|
+
info(options) {
|
|
5990
|
+
const realtimeInfoUrl = config.realtimeInfoUrl ?? deriveRealtimeInfoUrl(config.wsUrl);
|
|
5991
|
+
if (!realtimeInfoUrl) {
|
|
5992
|
+
throw new Error(
|
|
5993
|
+
"Athena chat realtime info URL is not configured. Pass createClient({ url }) for unified routing or set chat.wsUrl / chatWsUrl explicitly."
|
|
5994
|
+
);
|
|
5995
|
+
}
|
|
5996
|
+
return request(
|
|
5997
|
+
{
|
|
5998
|
+
...config,
|
|
5999
|
+
baseUrl: realtimeInfoUrl
|
|
6000
|
+
},
|
|
6001
|
+
"GET",
|
|
6002
|
+
"",
|
|
6003
|
+
options
|
|
6004
|
+
);
|
|
6005
|
+
},
|
|
6006
|
+
connect(options) {
|
|
6007
|
+
return createRealtimeConnection(config, options);
|
|
6008
|
+
}
|
|
6009
|
+
};
|
|
6010
|
+
return {
|
|
6011
|
+
room: {
|
|
6012
|
+
list(query, options) {
|
|
6013
|
+
return request(
|
|
6014
|
+
config,
|
|
6015
|
+
"GET",
|
|
6016
|
+
`/rooms${encodeQuery(query)}`,
|
|
6017
|
+
options
|
|
6018
|
+
);
|
|
6019
|
+
},
|
|
6020
|
+
create(input, options) {
|
|
6021
|
+
return request(config, "POST", "/rooms", options, input);
|
|
6022
|
+
},
|
|
6023
|
+
get(roomId, options) {
|
|
6024
|
+
return request(
|
|
6025
|
+
config,
|
|
6026
|
+
"GET",
|
|
6027
|
+
`/rooms/${encodePathSegment(roomId, "chat room ID")}`,
|
|
6028
|
+
options
|
|
6029
|
+
);
|
|
6030
|
+
},
|
|
6031
|
+
update(roomId, input, options) {
|
|
6032
|
+
return request(
|
|
6033
|
+
config,
|
|
6034
|
+
"PATCH",
|
|
6035
|
+
`/rooms/${encodePathSegment(roomId, "chat room ID")}`,
|
|
6036
|
+
options,
|
|
6037
|
+
input
|
|
6038
|
+
);
|
|
6039
|
+
},
|
|
6040
|
+
archive(roomId, options) {
|
|
6041
|
+
return request(
|
|
6042
|
+
config,
|
|
6043
|
+
"POST",
|
|
6044
|
+
`/rooms/${encodePathSegment(roomId, "chat room ID")}/archive`,
|
|
6045
|
+
options
|
|
6046
|
+
);
|
|
6047
|
+
},
|
|
6048
|
+
readCursor: {
|
|
6049
|
+
upTo(roomId, input, options) {
|
|
6050
|
+
return request(
|
|
6051
|
+
config,
|
|
6052
|
+
"POST",
|
|
6053
|
+
`/rooms/${encodePathSegment(roomId, "chat room ID")}/read-cursor`,
|
|
6054
|
+
options,
|
|
6055
|
+
input ?? {}
|
|
6056
|
+
);
|
|
6057
|
+
}
|
|
6058
|
+
},
|
|
6059
|
+
member: {
|
|
6060
|
+
list(roomId, options) {
|
|
6061
|
+
return request(
|
|
6062
|
+
config,
|
|
6063
|
+
"GET",
|
|
6064
|
+
`/rooms/${encodePathSegment(roomId, "chat room ID")}/members`,
|
|
6065
|
+
options
|
|
6066
|
+
);
|
|
6067
|
+
},
|
|
6068
|
+
add(roomId, input, options) {
|
|
6069
|
+
return request(
|
|
6070
|
+
config,
|
|
6071
|
+
"POST",
|
|
6072
|
+
`/rooms/${encodePathSegment(roomId, "chat room ID")}/members`,
|
|
6073
|
+
options,
|
|
6074
|
+
input
|
|
6075
|
+
);
|
|
6076
|
+
},
|
|
6077
|
+
remove(roomId, userId, options) {
|
|
6078
|
+
return request(
|
|
6079
|
+
config,
|
|
6080
|
+
"DELETE",
|
|
6081
|
+
`/rooms/${encodePathSegment(roomId, "chat room ID")}/members/${encodePathSegment(userId, "chat user ID")}`,
|
|
6082
|
+
options
|
|
6083
|
+
);
|
|
6084
|
+
}
|
|
6085
|
+
},
|
|
6086
|
+
message: {
|
|
6087
|
+
list(roomId, query, options) {
|
|
6088
|
+
return request(
|
|
6089
|
+
config,
|
|
6090
|
+
"GET",
|
|
6091
|
+
`/rooms/${encodePathSegment(roomId, "chat room ID")}/messages${encodeQuery(query)}`,
|
|
6092
|
+
options
|
|
6093
|
+
);
|
|
6094
|
+
},
|
|
6095
|
+
send(roomId, input, options) {
|
|
6096
|
+
return request(
|
|
6097
|
+
config,
|
|
6098
|
+
"POST",
|
|
6099
|
+
`/rooms/${encodePathSegment(roomId, "chat room ID")}/messages`,
|
|
6100
|
+
options,
|
|
6101
|
+
input
|
|
6102
|
+
);
|
|
6103
|
+
},
|
|
6104
|
+
update(roomId, messageId, input, options) {
|
|
6105
|
+
return request(
|
|
6106
|
+
config,
|
|
6107
|
+
"PATCH",
|
|
6108
|
+
`/rooms/${encodePathSegment(roomId, "chat room ID")}/messages/${encodePathSegment(messageId, "chat message ID")}`,
|
|
6109
|
+
options,
|
|
6110
|
+
input
|
|
6111
|
+
);
|
|
6112
|
+
},
|
|
6113
|
+
delete(roomId, messageId, options) {
|
|
6114
|
+
return request(
|
|
6115
|
+
config,
|
|
6116
|
+
"DELETE",
|
|
6117
|
+
`/rooms/${encodePathSegment(roomId, "chat room ID")}/messages/${encodePathSegment(messageId, "chat message ID")}`,
|
|
6118
|
+
options
|
|
6119
|
+
);
|
|
6120
|
+
}
|
|
6121
|
+
}
|
|
6122
|
+
},
|
|
6123
|
+
message: {
|
|
6124
|
+
reaction: {
|
|
6125
|
+
add(messageId, input, options) {
|
|
6126
|
+
return request(
|
|
6127
|
+
config,
|
|
6128
|
+
"POST",
|
|
6129
|
+
`/messages/${encodePathSegment(messageId, "chat message ID")}/reactions`,
|
|
6130
|
+
options,
|
|
6131
|
+
input
|
|
6132
|
+
);
|
|
6133
|
+
},
|
|
6134
|
+
remove(messageId, emoji, options) {
|
|
6135
|
+
return request(
|
|
6136
|
+
config,
|
|
6137
|
+
"DELETE",
|
|
6138
|
+
`/messages/${encodePathSegment(messageId, "chat message ID")}/reactions/${encodePathSegment(emoji, "reaction emoji")}`,
|
|
6139
|
+
options
|
|
6140
|
+
);
|
|
6141
|
+
}
|
|
6142
|
+
},
|
|
6143
|
+
search(input, options) {
|
|
6144
|
+
return request(
|
|
6145
|
+
config,
|
|
6146
|
+
"POST",
|
|
6147
|
+
"/messages/search",
|
|
6148
|
+
options,
|
|
6149
|
+
input
|
|
6150
|
+
);
|
|
6151
|
+
}
|
|
6152
|
+
},
|
|
6153
|
+
realtime
|
|
6154
|
+
};
|
|
6155
|
+
}
|
|
6156
|
+
var chatSdkManifest = {
|
|
6157
|
+
namespace: "chat",
|
|
6158
|
+
basePath: "/chat",
|
|
6159
|
+
methods: [
|
|
6160
|
+
{ name: "listRooms", method: "GET", path: "/chat/rooms" },
|
|
6161
|
+
{ name: "createRoom", method: "POST", path: "/chat/rooms" },
|
|
6162
|
+
{ name: "getRoom", method: "GET", path: "/chat/rooms/{room_id}" },
|
|
6163
|
+
{ name: "updateRoom", method: "PATCH", path: "/chat/rooms/{room_id}" },
|
|
6164
|
+
{ name: "archiveRoom", method: "POST", path: "/chat/rooms/{room_id}/archive" },
|
|
6165
|
+
{ name: "listRoomMessages", method: "GET", path: "/chat/rooms/{room_id}/messages" },
|
|
6166
|
+
{ name: "sendRoomMessage", method: "POST", path: "/chat/rooms/{room_id}/messages" },
|
|
6167
|
+
{ name: "updateRoomMessage", method: "PATCH", path: "/chat/rooms/{room_id}/messages/{message_id}" },
|
|
6168
|
+
{ name: "deleteRoomMessage", method: "DELETE", path: "/chat/rooms/{room_id}/messages/{message_id}" },
|
|
6169
|
+
{ name: "advanceReadCursor", method: "POST", path: "/chat/rooms/{room_id}/read-cursor" },
|
|
6170
|
+
{ name: "listRoomMembers", method: "GET", path: "/chat/rooms/{room_id}/members" },
|
|
6171
|
+
{ name: "addRoomMembers", method: "POST", path: "/chat/rooms/{room_id}/members" },
|
|
6172
|
+
{ name: "removeRoomMember", method: "DELETE", path: "/chat/rooms/{room_id}/members/{user_id}" },
|
|
6173
|
+
{ name: "addReaction", method: "POST", path: "/chat/messages/{message_id}/reactions" },
|
|
6174
|
+
{ name: "removeReaction", method: "DELETE", path: "/chat/messages/{message_id}/reactions/{emoji}" },
|
|
6175
|
+
{ name: "searchMessages", method: "POST", path: "/chat/messages/search" },
|
|
6176
|
+
{ name: "getRealtimeInfo", method: "GET", path: "/wss/info" },
|
|
6177
|
+
{ name: "connectRealtime", method: "GET", path: "/wss/gateway" }
|
|
6178
|
+
]
|
|
6179
|
+
};
|
|
6180
|
+
function unwrapChatRoom(payload) {
|
|
6181
|
+
return unwrapEnvelopeData(payload);
|
|
6182
|
+
}
|
|
6183
|
+
function unwrapChatMessage(payload) {
|
|
6184
|
+
return unwrapEnvelopeData(payload);
|
|
6185
|
+
}
|
|
6186
|
+
|
|
6187
|
+
// src/client-builder.ts
|
|
6188
|
+
var DEFAULT_BACKEND = { type: "athena" };
|
|
6189
|
+
function toBackendConfig(value) {
|
|
6190
|
+
if (!value) return DEFAULT_BACKEND;
|
|
6191
|
+
return typeof value === "string" ? { type: value } : value;
|
|
6192
|
+
}
|
|
6193
|
+
function mergeHeaders(current, next) {
|
|
6194
|
+
return {
|
|
6195
|
+
...current ?? {},
|
|
6196
|
+
...next
|
|
6197
|
+
};
|
|
6198
|
+
}
|
|
6199
|
+
function mergeAuthClientConfig(current, next) {
|
|
6200
|
+
const merged = {
|
|
6201
|
+
...current ?? {},
|
|
6202
|
+
...next
|
|
6203
|
+
};
|
|
6204
|
+
if (current?.headers || next.headers) {
|
|
6205
|
+
merged.headers = mergeHeaders(current?.headers, next.headers ?? {});
|
|
6206
|
+
}
|
|
6207
|
+
return merged;
|
|
6208
|
+
}
|
|
6209
|
+
function mergeExperimentalOptions(current, next) {
|
|
6210
|
+
const merged = {
|
|
6211
|
+
...current ?? {},
|
|
6212
|
+
...next
|
|
6213
|
+
};
|
|
6214
|
+
if (current?.traceQueries && typeof current.traceQueries === "object" && next.traceQueries && typeof next.traceQueries === "object") {
|
|
6215
|
+
merged.traceQueries = {
|
|
6216
|
+
...current.traceQueries,
|
|
6217
|
+
...next.traceQueries
|
|
6218
|
+
};
|
|
6219
|
+
}
|
|
6220
|
+
if (current?.storage || next.storage) {
|
|
6221
|
+
merged.storage = {
|
|
6222
|
+
...current?.storage ?? {},
|
|
6223
|
+
...next.storage ?? {}
|
|
6224
|
+
};
|
|
6225
|
+
}
|
|
6226
|
+
return merged;
|
|
6227
|
+
}
|
|
6228
|
+
function resolveBuilderReturn(builder, storageEnabled, strictEnabled) {
|
|
6229
|
+
return builder;
|
|
6230
|
+
}
|
|
6231
|
+
var AthenaClientBuilderImpl = class {
|
|
6232
|
+
constructor(buildClient) {
|
|
6233
|
+
this.buildClient = buildClient;
|
|
6234
|
+
}
|
|
6235
|
+
rootUrl;
|
|
6236
|
+
apiKey;
|
|
6237
|
+
backendConfig = DEFAULT_BACKEND;
|
|
6238
|
+
clientName;
|
|
6239
|
+
defaultUserId;
|
|
6240
|
+
defaultOrganizationId;
|
|
6241
|
+
forceNoCacheEnabled = false;
|
|
6242
|
+
defaultHeaders;
|
|
6243
|
+
authConfig;
|
|
6244
|
+
dbUrlOverride;
|
|
6245
|
+
gatewayUrlOverride;
|
|
6246
|
+
authUrlOverride;
|
|
6247
|
+
storageUrlOverride;
|
|
6248
|
+
experimentalOptions;
|
|
6249
|
+
url(url) {
|
|
6250
|
+
this.rootUrl = url;
|
|
6251
|
+
return this;
|
|
6252
|
+
}
|
|
6253
|
+
key(apiKey) {
|
|
6254
|
+
this.apiKey = apiKey;
|
|
6255
|
+
return this;
|
|
6256
|
+
}
|
|
6257
|
+
backend(backend) {
|
|
6258
|
+
this.backendConfig = toBackendConfig(backend);
|
|
6259
|
+
return this;
|
|
6260
|
+
}
|
|
6261
|
+
client(clientName) {
|
|
6262
|
+
this.clientName = clientName;
|
|
6263
|
+
return this;
|
|
6264
|
+
}
|
|
6265
|
+
headers(headers) {
|
|
6266
|
+
this.defaultHeaders = headers;
|
|
6267
|
+
return this;
|
|
6268
|
+
}
|
|
6269
|
+
auth(config) {
|
|
6270
|
+
this.authConfig = mergeAuthClientConfig(this.authConfig, config);
|
|
6271
|
+
return this;
|
|
6272
|
+
}
|
|
6273
|
+
experimental(options) {
|
|
6274
|
+
this.experimentalOptions = mergeExperimentalOptions(this.experimentalOptions, options);
|
|
6275
|
+
if (options.athenaStorageBackend && options.typecheckColumns) {
|
|
6276
|
+
return resolveBuilderReturn(this);
|
|
6277
|
+
}
|
|
6278
|
+
if (options.athenaStorageBackend) {
|
|
6279
|
+
return resolveBuilderReturn(this);
|
|
6280
|
+
}
|
|
6281
|
+
if (options.typecheckColumns) {
|
|
6282
|
+
return resolveBuilderReturn(this);
|
|
6283
|
+
}
|
|
6284
|
+
return this;
|
|
6285
|
+
}
|
|
6286
|
+
options(options) {
|
|
6287
|
+
if (options.client !== void 0) {
|
|
6288
|
+
this.clientName = options.client;
|
|
6289
|
+
}
|
|
6290
|
+
if (options.userId !== void 0) {
|
|
6291
|
+
this.defaultUserId = options.userId;
|
|
6292
|
+
}
|
|
6293
|
+
if (options.organizationId !== void 0) {
|
|
6294
|
+
this.defaultOrganizationId = options.organizationId;
|
|
6295
|
+
}
|
|
6296
|
+
if (options.forceNoCache !== void 0) {
|
|
6297
|
+
this.forceNoCacheEnabled = options.forceNoCache;
|
|
6298
|
+
}
|
|
6299
|
+
if (options.backend !== void 0) {
|
|
6300
|
+
this.backendConfig = toBackendConfig(options.backend);
|
|
6301
|
+
}
|
|
6302
|
+
if (options.headers !== void 0) {
|
|
6303
|
+
this.defaultHeaders = mergeHeaders(this.defaultHeaders, options.headers);
|
|
6304
|
+
}
|
|
6305
|
+
if (options.auth !== void 0) {
|
|
5517
6306
|
this.authConfig = mergeAuthClientConfig(this.authConfig, options.auth);
|
|
5518
6307
|
}
|
|
5519
6308
|
if (options.db?.url !== void 0 && options.db.url !== null) {
|
|
@@ -5561,6 +6350,9 @@ var AthenaClientBuilderImpl = class {
|
|
|
5561
6350
|
url: this.rootUrl,
|
|
5562
6351
|
key: this.apiKey,
|
|
5563
6352
|
client: this.clientName,
|
|
6353
|
+
userId: this.defaultUserId,
|
|
6354
|
+
organizationId: this.defaultOrganizationId,
|
|
6355
|
+
forceNoCache: this.forceNoCacheEnabled,
|
|
5564
6356
|
backend: this.backendConfig,
|
|
5565
6357
|
headers: this.defaultHeaders,
|
|
5566
6358
|
db: this.dbUrlOverride ? { url: this.dbUrlOverride } : void 0,
|
|
@@ -5604,7 +6396,7 @@ var BOOLEAN_SAFE_OPERATORS = /* @__PURE__ */ new Set([
|
|
|
5604
6396
|
"ilike",
|
|
5605
6397
|
"is"
|
|
5606
6398
|
]);
|
|
5607
|
-
function
|
|
6399
|
+
function isRecord8(value) {
|
|
5608
6400
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
5609
6401
|
}
|
|
5610
6402
|
function isUuidString(value) {
|
|
@@ -5617,7 +6409,7 @@ function shouldUseUuidTextComparison(column, value) {
|
|
|
5617
6409
|
return typeof value === "string" && isUuidString(value) && isUuidIdentifierColumn(column);
|
|
5618
6410
|
}
|
|
5619
6411
|
function isRelationSelectNode(value) {
|
|
5620
|
-
return
|
|
6412
|
+
return isRecord8(value) && isRecord8(value.select);
|
|
5621
6413
|
}
|
|
5622
6414
|
function normalizeIdentifier(value, label) {
|
|
5623
6415
|
const normalized = value.trim();
|
|
@@ -5673,7 +6465,7 @@ function compileRelationToken(key, node) {
|
|
|
5673
6465
|
return `${prefix}${relationToken}(${nested})`;
|
|
5674
6466
|
}
|
|
5675
6467
|
function compileSelectShape(select) {
|
|
5676
|
-
if (!
|
|
6468
|
+
if (!isRecord8(select)) {
|
|
5677
6469
|
throw new Error("findMany select must be an object");
|
|
5678
6470
|
}
|
|
5679
6471
|
const tokens = [];
|
|
@@ -5697,7 +6489,7 @@ function compileSelectShape(select) {
|
|
|
5697
6489
|
return tokens.join(",");
|
|
5698
6490
|
}
|
|
5699
6491
|
function selectShapeUsesRelationSchema(select) {
|
|
5700
|
-
if (!
|
|
6492
|
+
if (!isRecord8(select)) {
|
|
5701
6493
|
return false;
|
|
5702
6494
|
}
|
|
5703
6495
|
for (const rawValue of Object.values(select)) {
|
|
@@ -5715,7 +6507,7 @@ function selectShapeUsesRelationSchema(select) {
|
|
|
5715
6507
|
}
|
|
5716
6508
|
function compileColumnWhere(column, input) {
|
|
5717
6509
|
const normalizedColumn = normalizeIdentifier(column, "where column");
|
|
5718
|
-
if (!
|
|
6510
|
+
if (!isRecord8(input)) {
|
|
5719
6511
|
return [buildGatewayCondition("eq", normalizedColumn, input)];
|
|
5720
6512
|
}
|
|
5721
6513
|
const conditions = [];
|
|
@@ -5743,7 +6535,7 @@ function compileColumnWhere(column, input) {
|
|
|
5743
6535
|
return conditions;
|
|
5744
6536
|
}
|
|
5745
6537
|
function compileBooleanExpressionTerms(clause, label) {
|
|
5746
|
-
if (!
|
|
6538
|
+
if (!isRecord8(clause)) {
|
|
5747
6539
|
throw new Error(`findMany where.${label} clauses must be objects`);
|
|
5748
6540
|
}
|
|
5749
6541
|
const entries = Object.entries(clause).filter(([, value]) => value !== void 0);
|
|
@@ -5752,7 +6544,7 @@ function compileBooleanExpressionTerms(clause, label) {
|
|
|
5752
6544
|
}
|
|
5753
6545
|
const [rawColumn, rawValue] = entries[0];
|
|
5754
6546
|
const column = normalizeIdentifier(rawColumn, `where.${label} column`);
|
|
5755
|
-
if (!
|
|
6547
|
+
if (!isRecord8(rawValue)) {
|
|
5756
6548
|
return [`${column}.eq.${stringifyFilterValue(rawValue)}`];
|
|
5757
6549
|
}
|
|
5758
6550
|
const operatorEntries = Object.entries(rawValue).filter(([, value]) => value !== void 0);
|
|
@@ -5776,7 +6568,7 @@ function compileWhere(where) {
|
|
|
5776
6568
|
if (where === void 0) {
|
|
5777
6569
|
return void 0;
|
|
5778
6570
|
}
|
|
5779
|
-
if (!
|
|
6571
|
+
if (!isRecord8(where)) {
|
|
5780
6572
|
throw new Error("findMany where must be an object");
|
|
5781
6573
|
}
|
|
5782
6574
|
const conditions = [];
|
|
@@ -5826,7 +6618,7 @@ function compileOrderBy(orderBy) {
|
|
|
5826
6618
|
if (orderBy === void 0) {
|
|
5827
6619
|
return void 0;
|
|
5828
6620
|
}
|
|
5829
|
-
if (!
|
|
6621
|
+
if (!isRecord8(orderBy)) {
|
|
5830
6622
|
throw new Error("findMany orderBy must be an object");
|
|
5831
6623
|
}
|
|
5832
6624
|
if ("column" in orderBy) {
|
|
@@ -6001,11 +6793,11 @@ function toFindManyAstOrder(order) {
|
|
|
6001
6793
|
ascending: order.direction !== "descending"
|
|
6002
6794
|
};
|
|
6003
6795
|
}
|
|
6004
|
-
function
|
|
6796
|
+
function isRecord9(value) {
|
|
6005
6797
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
6006
6798
|
}
|
|
6007
6799
|
function normalizeFindManyAstColumnPredicate(value) {
|
|
6008
|
-
if (!
|
|
6800
|
+
if (!isRecord9(value)) {
|
|
6009
6801
|
return {
|
|
6010
6802
|
eq: value
|
|
6011
6803
|
};
|
|
@@ -6029,7 +6821,7 @@ function normalizeFindManyAstBooleanOperand(clause) {
|
|
|
6029
6821
|
return normalized;
|
|
6030
6822
|
}
|
|
6031
6823
|
function normalizeFindManyAstWhere(where) {
|
|
6032
|
-
if (!where || !
|
|
6824
|
+
if (!where || !isRecord9(where)) {
|
|
6033
6825
|
return where;
|
|
6034
6826
|
}
|
|
6035
6827
|
const normalized = {};
|
|
@@ -6043,7 +6835,7 @@ function normalizeFindManyAstWhere(where) {
|
|
|
6043
6835
|
);
|
|
6044
6836
|
continue;
|
|
6045
6837
|
}
|
|
6046
|
-
if (key === "not" &&
|
|
6838
|
+
if (key === "not" && isRecord9(value)) {
|
|
6047
6839
|
normalized.not = normalizeFindManyAstBooleanOperand(
|
|
6048
6840
|
value
|
|
6049
6841
|
);
|
|
@@ -6054,7 +6846,7 @@ function normalizeFindManyAstWhere(where) {
|
|
|
6054
6846
|
return normalized;
|
|
6055
6847
|
}
|
|
6056
6848
|
function predicateRequiresUuidQueryFallback(column, value) {
|
|
6057
|
-
if (!
|
|
6849
|
+
if (!isRecord9(value)) {
|
|
6058
6850
|
return shouldUseUuidTextComparison(column, value);
|
|
6059
6851
|
}
|
|
6060
6852
|
const eqValue = value.eq;
|
|
@@ -6072,7 +6864,7 @@ function booleanOperandRequiresUuidQueryFallback(clause) {
|
|
|
6072
6864
|
return false;
|
|
6073
6865
|
}
|
|
6074
6866
|
function findManyAstWhereRequiresLegacyTransport(where) {
|
|
6075
|
-
if (!where || !
|
|
6867
|
+
if (!where || !isRecord9(where)) {
|
|
6076
6868
|
return false;
|
|
6077
6869
|
}
|
|
6078
6870
|
for (const [key, value] of Object.entries(where)) {
|
|
@@ -6087,7 +6879,7 @@ function findManyAstWhereRequiresLegacyTransport(where) {
|
|
|
6087
6879
|
}
|
|
6088
6880
|
continue;
|
|
6089
6881
|
}
|
|
6090
|
-
if (key === "not" &&
|
|
6882
|
+
if (key === "not" && isRecord9(value)) {
|
|
6091
6883
|
if (booleanOperandRequiresUuidQueryFallback(value)) {
|
|
6092
6884
|
return true;
|
|
6093
6885
|
}
|
|
@@ -6636,6 +7428,7 @@ function resolveAthenaModelTargetTableName(target, options = {}) {
|
|
|
6636
7428
|
var DEFAULT_COLUMNS = "*";
|
|
6637
7429
|
var SAFE_CAST_PATTERN = /^[a-z_][a-z0-9_]*(?:\[\])?$/i;
|
|
6638
7430
|
var ATHENA_NORMALIZED_ERROR_KEY = "__athenaNormalizedError";
|
|
7431
|
+
var SDK_NAME4 = "xylex-group/athena";
|
|
6639
7432
|
function formatResult(response) {
|
|
6640
7433
|
const result = {
|
|
6641
7434
|
data: response.data ?? null,
|
|
@@ -6712,7 +7505,7 @@ async function executeExperimentalRead(experimental, runner) {
|
|
|
6712
7505
|
throw error;
|
|
6713
7506
|
}
|
|
6714
7507
|
}
|
|
6715
|
-
function
|
|
7508
|
+
function isRecord10(value) {
|
|
6716
7509
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
6717
7510
|
}
|
|
6718
7511
|
function firstNonEmptyString2(...values) {
|
|
@@ -6724,8 +7517,8 @@ function firstNonEmptyString2(...values) {
|
|
|
6724
7517
|
return void 0;
|
|
6725
7518
|
}
|
|
6726
7519
|
function resolveStructuredErrorPayload2(raw) {
|
|
6727
|
-
if (!
|
|
6728
|
-
return
|
|
7520
|
+
if (!isRecord10(raw)) return null;
|
|
7521
|
+
return isRecord10(raw.error) ? raw.error : raw;
|
|
6729
7522
|
}
|
|
6730
7523
|
function resolveStructuredErrorDetails(payload, message) {
|
|
6731
7524
|
if (!payload || !("details" in payload)) {
|
|
@@ -6741,7 +7534,7 @@ function resolveStructuredErrorDetails(payload, message) {
|
|
|
6741
7534
|
return details;
|
|
6742
7535
|
}
|
|
6743
7536
|
function createResultError(response, result, normalized) {
|
|
6744
|
-
const rawRecord =
|
|
7537
|
+
const rawRecord = isRecord10(response.raw) ? response.raw : null;
|
|
6745
7538
|
const payload = resolveStructuredErrorPayload2(response.raw);
|
|
6746
7539
|
const message = firstNonEmptyString2(
|
|
6747
7540
|
response.error,
|
|
@@ -6804,6 +7597,43 @@ function asAthenaJsonObject(value) {
|
|
|
6804
7597
|
function asAthenaJsonObjectArray(values) {
|
|
6805
7598
|
return values;
|
|
6806
7599
|
}
|
|
7600
|
+
function parseArbitraryResponseBody(rawText, contentType) {
|
|
7601
|
+
if (!rawText) {
|
|
7602
|
+
return null;
|
|
7603
|
+
}
|
|
7604
|
+
const contentTypeSuggestsJson = contentType?.toLowerCase().includes("application/json") ?? false;
|
|
7605
|
+
const looksJson = contentTypeSuggestsJson || rawText.startsWith("{") || rawText.startsWith("[");
|
|
7606
|
+
if (!looksJson) {
|
|
7607
|
+
return rawText;
|
|
7608
|
+
}
|
|
7609
|
+
try {
|
|
7610
|
+
return JSON.parse(rawText);
|
|
7611
|
+
} catch {
|
|
7612
|
+
return rawText;
|
|
7613
|
+
}
|
|
7614
|
+
}
|
|
7615
|
+
function toRequestQueryString(query) {
|
|
7616
|
+
if (!query) {
|
|
7617
|
+
return "";
|
|
7618
|
+
}
|
|
7619
|
+
const params = new URLSearchParams();
|
|
7620
|
+
for (const [key, value] of Object.entries(query)) {
|
|
7621
|
+
if (value === void 0 || value === null) {
|
|
7622
|
+
continue;
|
|
7623
|
+
}
|
|
7624
|
+
if (Array.isArray(value)) {
|
|
7625
|
+
for (const item of value) {
|
|
7626
|
+
if (item !== void 0 && item !== null) {
|
|
7627
|
+
params.append(key, String(item));
|
|
7628
|
+
}
|
|
7629
|
+
}
|
|
7630
|
+
continue;
|
|
7631
|
+
}
|
|
7632
|
+
params.set(key, String(value));
|
|
7633
|
+
}
|
|
7634
|
+
const encoded = params.toString();
|
|
7635
|
+
return encoded ? `?${encoded}` : "";
|
|
7636
|
+
}
|
|
6807
7637
|
function normalizeSelectColumnsInput(columns) {
|
|
6808
7638
|
if (columns === void 0) {
|
|
6809
7639
|
return void 0;
|
|
@@ -8103,6 +8933,85 @@ function createQueryBuilder(client, formatGatewayResult, experimental, tracer) {
|
|
|
8103
8933
|
);
|
|
8104
8934
|
};
|
|
8105
8935
|
}
|
|
8936
|
+
var ATHENA_ENV_URL_KEYS = ["ATHENA_URL", "NEXT_PUBLIC_ATHENA_URL"];
|
|
8937
|
+
var ATHENA_ENV_GATEWAY_URL_KEYS = [
|
|
8938
|
+
"ATHENA_DB_URL",
|
|
8939
|
+
"ATHENA_GATEWAY_URL",
|
|
8940
|
+
"NEXT_PUBLIC_ATHENA_DB_API_URL"
|
|
8941
|
+
];
|
|
8942
|
+
var ATHENA_ENV_AUTH_URL_KEYS = ["ATHENA_AUTH_URL", "NEXT_PUBLIC_ATHENA_AUTH_URL"];
|
|
8943
|
+
var ATHENA_ENV_CHAT_URL_KEYS = ["ATHENA_CHAT_URL", "NEXT_PUBLIC_ATHENA_CHAT_URL"];
|
|
8944
|
+
var ATHENA_ENV_CHAT_WS_URL_KEYS = ["ATHENA_CHAT_WS_URL", "NEXT_PUBLIC_ATHENA_CHAT_WS_URL"];
|
|
8945
|
+
var ATHENA_ENV_STORAGE_URL_KEYS = ["ATHENA_STORAGE_URL", "NEXT_PUBLIC_ATHENA_STORAGE_URL"];
|
|
8946
|
+
var ATHENA_ENV_KEY_KEYS = [
|
|
8947
|
+
"ATHENA_API_KEY",
|
|
8948
|
+
"NEXT_PUBLIC_ATHENA_API_KEY",
|
|
8949
|
+
"ATHENA_GATEWAY_API_KEY",
|
|
8950
|
+
"X_API_KEY"
|
|
8951
|
+
];
|
|
8952
|
+
var ATHENA_ENV_CLIENT_KEYS = ["ATHENA_CLIENT", "NEXT_PUBLIC_ATHENA_CLIENT"];
|
|
8953
|
+
function normalizeOptionalString(value) {
|
|
8954
|
+
if (typeof value !== "string") {
|
|
8955
|
+
return void 0;
|
|
8956
|
+
}
|
|
8957
|
+
const normalizedValue = value.trim();
|
|
8958
|
+
return normalizedValue ? normalizedValue : void 0;
|
|
8959
|
+
}
|
|
8960
|
+
function readFirstEnvValue(env, keys) {
|
|
8961
|
+
for (const key of keys) {
|
|
8962
|
+
const value = normalizeOptionalString(env[key]);
|
|
8963
|
+
if (value) {
|
|
8964
|
+
return value;
|
|
8965
|
+
}
|
|
8966
|
+
}
|
|
8967
|
+
return void 0;
|
|
8968
|
+
}
|
|
8969
|
+
function readHeaderBagValue(headers, targetKey) {
|
|
8970
|
+
if (!headers) {
|
|
8971
|
+
return void 0;
|
|
8972
|
+
}
|
|
8973
|
+
if (typeof headers.get === "function") {
|
|
8974
|
+
return normalizeOptionalString(headers.get(targetKey));
|
|
8975
|
+
}
|
|
8976
|
+
const normalizedTargetKey = targetKey.toLowerCase();
|
|
8977
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
8978
|
+
if (key.toLowerCase() !== normalizedTargetKey) {
|
|
8979
|
+
continue;
|
|
8980
|
+
}
|
|
8981
|
+
if (typeof value === "string") {
|
|
8982
|
+
return normalizeOptionalString(value);
|
|
8983
|
+
}
|
|
8984
|
+
return void 0;
|
|
8985
|
+
}
|
|
8986
|
+
return void 0;
|
|
8987
|
+
}
|
|
8988
|
+
function resolveSessionContextOptions(session, options) {
|
|
8989
|
+
const sessionToken = normalizeOptionalString(session?.session?.token);
|
|
8990
|
+
const requestCookie = readHeaderBagValue(options?.requestHeaders, "cookie") ?? readHeaderBagValue(options?.headers, "cookie");
|
|
8991
|
+
const authInput = options?.auth;
|
|
8992
|
+
const resolvedUserId = options?.userId !== void 0 ? options.userId : session?.user?.id;
|
|
8993
|
+
const resolvedOrganizationId = options?.organizationId !== void 0 ? options.organizationId : session?.session?.activeOrganizationId;
|
|
8994
|
+
const resolvedBearerToken = authInput?.bearerToken !== void 0 ? authInput.bearerToken : sessionToken;
|
|
8995
|
+
const resolvedSessionToken = authInput?.sessionToken !== void 0 ? authInput.sessionToken : sessionToken;
|
|
8996
|
+
const resolvedCookie = authInput?.cookie !== void 0 ? authInput.cookie : requestCookie;
|
|
8997
|
+
const auth = authInput !== void 0 || resolvedBearerToken !== void 0 || resolvedSessionToken !== void 0 || resolvedCookie !== void 0 ? {
|
|
8998
|
+
...authInput ?? {},
|
|
8999
|
+
...resolvedBearerToken !== void 0 ? { bearerToken: resolvedBearerToken } : {},
|
|
9000
|
+
...resolvedSessionToken !== void 0 ? { sessionToken: resolvedSessionToken } : {},
|
|
9001
|
+
...resolvedCookie !== void 0 ? { cookie: resolvedCookie } : {},
|
|
9002
|
+
headers: authInput?.headers ? { ...authInput.headers } : void 0
|
|
9003
|
+
} : void 0;
|
|
9004
|
+
if (resolvedUserId === void 0 && resolvedOrganizationId === void 0 && options?.forceNoCache === void 0 && !options?.headers && !auth) {
|
|
9005
|
+
return void 0;
|
|
9006
|
+
}
|
|
9007
|
+
return {
|
|
9008
|
+
userId: resolvedUserId,
|
|
9009
|
+
organizationId: resolvedOrganizationId,
|
|
9010
|
+
forceNoCache: options?.forceNoCache,
|
|
9011
|
+
headers: options?.headers ? { ...options.headers } : void 0,
|
|
9012
|
+
auth
|
|
9013
|
+
};
|
|
9014
|
+
}
|
|
8106
9015
|
function resolveClientServiceBaseUrl(value, label) {
|
|
8107
9016
|
if (value === void 0 || value === null) {
|
|
8108
9017
|
return void 0;
|
|
@@ -8113,6 +9022,15 @@ function appendServicePath(baseUrl, segment) {
|
|
|
8113
9022
|
const normalizedBaseUrl = normalizeAthenaGatewayBaseUrl(baseUrl, { label: "Athena public base URL" });
|
|
8114
9023
|
return `${normalizedBaseUrl}/${segment.replace(/^\/+/, "")}`;
|
|
8115
9024
|
}
|
|
9025
|
+
function appendRealtimeGatewayPath(baseUrl) {
|
|
9026
|
+
const normalizedBaseUrl = normalizeAthenaGatewayBaseUrl(baseUrl, { label: "Athena public base URL" });
|
|
9027
|
+
const wsUrl = new URL(normalizedBaseUrl);
|
|
9028
|
+
wsUrl.protocol = wsUrl.protocol === "https:" ? "wss:" : "ws:";
|
|
9029
|
+
wsUrl.pathname = `${wsUrl.pathname.replace(/\/+$/, "")}/wss/gateway`;
|
|
9030
|
+
wsUrl.search = "";
|
|
9031
|
+
wsUrl.hash = "";
|
|
9032
|
+
return wsUrl.toString();
|
|
9033
|
+
}
|
|
8116
9034
|
function resolveServiceUrlOverride(value, label) {
|
|
8117
9035
|
return resolveClientServiceBaseUrl(value, label);
|
|
8118
9036
|
}
|
|
@@ -8121,6 +9039,8 @@ function resolveServiceUrls(config) {
|
|
|
8121
9039
|
return {
|
|
8122
9040
|
dbUrl: resolveServiceUrlOverride(config.db?.url, "Athena DB base URL") ?? resolveServiceUrlOverride(config.gateway?.url, "Athena gateway base URL") ?? resolveServiceUrlOverride(config.dbUrl, "Athena DB base URL") ?? resolveServiceUrlOverride(config.gatewayUrl, "Athena gateway base URL") ?? (baseUrl ? appendServicePath(baseUrl, "db") : void 0),
|
|
8123
9041
|
authUrl: resolveServiceUrlOverride(config.auth?.url, "Athena auth base URL") ?? resolveServiceUrlOverride(config.auth?.baseUrl, "Athena auth base URL") ?? resolveServiceUrlOverride(config.authUrl, "Athena auth base URL") ?? (baseUrl ? appendServicePath(baseUrl, "auth") : void 0),
|
|
9042
|
+
chatUrl: resolveServiceUrlOverride(config.chat?.url, "Athena chat base URL") ?? resolveServiceUrlOverride(config.chatUrl, "Athena chat base URL") ?? (baseUrl ? appendServicePath(baseUrl, "chat") : void 0),
|
|
9043
|
+
chatWsUrl: normalizeOptionalString(config.chat?.wsUrl) ?? normalizeOptionalString(config.chatWsUrl) ?? (baseUrl ? appendRealtimeGatewayPath(baseUrl) : void 0),
|
|
8124
9044
|
storageUrl: resolveServiceUrlOverride(config.storage?.url, "Athena storage base URL") ?? resolveServiceUrlOverride(config.storageUrl, "Athena storage base URL") ?? (baseUrl ? appendServicePath(baseUrl, "storage") : void 0)
|
|
8125
9045
|
};
|
|
8126
9046
|
}
|
|
@@ -8145,6 +9065,89 @@ function resolveRequiredClientApiKey(value) {
|
|
|
8145
9065
|
}
|
|
8146
9066
|
return normalizedValue;
|
|
8147
9067
|
}
|
|
9068
|
+
function hasHeaderIgnoreCase(headers, targetKey) {
|
|
9069
|
+
const normalizedTargetKey = targetKey.toLowerCase();
|
|
9070
|
+
return Object.keys(headers).some((key) => key.toLowerCase() === normalizedTargetKey);
|
|
9071
|
+
}
|
|
9072
|
+
function mergeClientHeaders(current, next) {
|
|
9073
|
+
if (!current && !next) {
|
|
9074
|
+
return void 0;
|
|
9075
|
+
}
|
|
9076
|
+
return {
|
|
9077
|
+
...current ?? {},
|
|
9078
|
+
...next ?? {}
|
|
9079
|
+
};
|
|
9080
|
+
}
|
|
9081
|
+
function mergeDefinedObject(current, next) {
|
|
9082
|
+
if (!current && !next) {
|
|
9083
|
+
return void 0;
|
|
9084
|
+
}
|
|
9085
|
+
const merged = {
|
|
9086
|
+
...current ?? {}
|
|
9087
|
+
};
|
|
9088
|
+
const mutableMerged = merged;
|
|
9089
|
+
for (const [key, value] of Object.entries(next ?? {})) {
|
|
9090
|
+
if (value !== void 0) {
|
|
9091
|
+
mutableMerged[key] = value;
|
|
9092
|
+
}
|
|
9093
|
+
}
|
|
9094
|
+
return merged;
|
|
9095
|
+
}
|
|
9096
|
+
function mergeAuthClientOptions(current, next) {
|
|
9097
|
+
const merged = mergeDefinedObject(current, next);
|
|
9098
|
+
if (!merged) {
|
|
9099
|
+
return void 0;
|
|
9100
|
+
}
|
|
9101
|
+
const mergedHeaders = mergeClientHeaders(current?.headers, next?.headers);
|
|
9102
|
+
if (mergedHeaders) {
|
|
9103
|
+
merged.headers = mergedHeaders;
|
|
9104
|
+
}
|
|
9105
|
+
return merged;
|
|
9106
|
+
}
|
|
9107
|
+
function mergeServiceUrlOverrides(current, next) {
|
|
9108
|
+
return mergeDefinedObject(current, next);
|
|
9109
|
+
}
|
|
9110
|
+
function toClientContextOverrides(context) {
|
|
9111
|
+
if (!context) {
|
|
9112
|
+
return void 0;
|
|
9113
|
+
}
|
|
9114
|
+
return {
|
|
9115
|
+
userId: context.userId,
|
|
9116
|
+
organizationId: context.organizationId,
|
|
9117
|
+
forceNoCache: context.forceNoCache,
|
|
9118
|
+
headers: context.headers,
|
|
9119
|
+
auth: context.auth ? {
|
|
9120
|
+
...context.auth,
|
|
9121
|
+
headers: context.auth.headers ? { ...context.auth.headers } : void 0
|
|
9122
|
+
} : void 0
|
|
9123
|
+
};
|
|
9124
|
+
}
|
|
9125
|
+
function mergeClientOverrideOptions(base, overrides) {
|
|
9126
|
+
if (!overrides) {
|
|
9127
|
+
return {
|
|
9128
|
+
...base,
|
|
9129
|
+
headers: base.headers ? { ...base.headers } : void 0,
|
|
9130
|
+
auth: base.auth ? {
|
|
9131
|
+
...base.auth,
|
|
9132
|
+
headers: base.auth.headers ? { ...base.auth.headers } : void 0
|
|
9133
|
+
} : void 0,
|
|
9134
|
+
db: base.db ? { ...base.db } : void 0,
|
|
9135
|
+
gateway: base.gateway ? { ...base.gateway } : void 0,
|
|
9136
|
+
chat: base.chat ? { ...base.chat } : void 0,
|
|
9137
|
+
storage: base.storage ? { ...base.storage } : void 0
|
|
9138
|
+
};
|
|
9139
|
+
}
|
|
9140
|
+
const merged = mergeDefinedObject(base, overrides) ?? { ...base };
|
|
9141
|
+
return {
|
|
9142
|
+
...merged,
|
|
9143
|
+
headers: mergeClientHeaders(base.headers, overrides.headers),
|
|
9144
|
+
auth: mergeAuthClientOptions(base.auth, overrides.auth),
|
|
9145
|
+
db: mergeServiceUrlOverrides(base.db, overrides.db),
|
|
9146
|
+
gateway: mergeServiceUrlOverrides(base.gateway, overrides.gateway),
|
|
9147
|
+
chat: mergeServiceUrlOverrides(base.chat, overrides.chat),
|
|
9148
|
+
storage: mergeServiceUrlOverrides(base.storage, overrides.storage)
|
|
9149
|
+
};
|
|
9150
|
+
}
|
|
8148
9151
|
function normalizeAuthClientConfig(auth, defaultBaseUrl) {
|
|
8149
9152
|
if (!auth && defaultBaseUrl === void 0) {
|
|
8150
9153
|
return void 0;
|
|
@@ -8154,6 +9157,8 @@ function normalizeAuthClientConfig(auth, defaultBaseUrl) {
|
|
|
8154
9157
|
baseUrl,
|
|
8155
9158
|
apiKey,
|
|
8156
9159
|
bearerToken,
|
|
9160
|
+
cookie,
|
|
9161
|
+
sessionToken,
|
|
8157
9162
|
...rest
|
|
8158
9163
|
} = auth ?? {};
|
|
8159
9164
|
const normalized = {
|
|
@@ -8172,6 +9177,12 @@ function normalizeAuthClientConfig(auth, defaultBaseUrl) {
|
|
|
8172
9177
|
if (typeof bearerToken === "string") {
|
|
8173
9178
|
normalized.bearerToken = bearerToken;
|
|
8174
9179
|
}
|
|
9180
|
+
if (typeof cookie === "string") {
|
|
9181
|
+
normalized.cookie = cookie;
|
|
9182
|
+
}
|
|
9183
|
+
if (typeof sessionToken === "string") {
|
|
9184
|
+
normalized.sessionToken = sessionToken;
|
|
9185
|
+
}
|
|
8175
9186
|
return normalized;
|
|
8176
9187
|
}
|
|
8177
9188
|
function resolveCreateClientConfig(config) {
|
|
@@ -8185,31 +9196,53 @@ function resolveCreateClientConfig(config) {
|
|
|
8185
9196
|
baseUrl: resolvedUrls.dbUrl,
|
|
8186
9197
|
apiKey: resolveRequiredClientApiKey(config.key),
|
|
8187
9198
|
client: resolveOptionalClientName(config.client),
|
|
9199
|
+
userId: config.userId,
|
|
9200
|
+
organizationId: config.organizationId,
|
|
9201
|
+
forceNoCache: config.forceNoCache,
|
|
8188
9202
|
backend: toBackendConfig(config.backend),
|
|
8189
9203
|
headers: config.headers,
|
|
8190
9204
|
auth: config.auth,
|
|
8191
9205
|
authUrl: resolvedUrls.authUrl,
|
|
9206
|
+
chat: config.chat,
|
|
9207
|
+
chatUrl: resolvedUrls.chatUrl,
|
|
9208
|
+
chatWsUrl: resolvedUrls.chatWsUrl,
|
|
8192
9209
|
storageUrl: resolvedUrls.storageUrl,
|
|
8193
9210
|
experimental: config.experimental
|
|
8194
9211
|
};
|
|
8195
9212
|
}
|
|
8196
|
-
function
|
|
9213
|
+
function createClientFromInput(sourceConfig) {
|
|
9214
|
+
return createClientFromConfig(resolveCreateClientConfig(sourceConfig), sourceConfig);
|
|
9215
|
+
}
|
|
9216
|
+
function createClientFromConfig(config, sourceConfig) {
|
|
9217
|
+
const normalizedAuthConfig = normalizeAuthClientConfig(config.auth, config.authUrl);
|
|
8197
9218
|
const gatewayHeaders = {
|
|
8198
9219
|
...config.headers ?? {}
|
|
8199
9220
|
};
|
|
8200
|
-
if (
|
|
8201
|
-
gatewayHeaders["X-Athena-Auth-Bearer-Token"] =
|
|
9221
|
+
if (normalizedAuthConfig?.bearerToken && !hasHeaderIgnoreCase(gatewayHeaders, "X-Athena-Auth-Bearer-Token")) {
|
|
9222
|
+
gatewayHeaders["X-Athena-Auth-Bearer-Token"] = normalizedAuthConfig.bearerToken;
|
|
9223
|
+
}
|
|
9224
|
+
if (normalizedAuthConfig?.cookie && !hasHeaderIgnoreCase(gatewayHeaders, "Cookie")) {
|
|
9225
|
+
gatewayHeaders.Cookie = normalizedAuthConfig.cookie;
|
|
9226
|
+
}
|
|
9227
|
+
if (normalizedAuthConfig?.sessionToken && !hasHeaderIgnoreCase(gatewayHeaders, "X-Athena-Auth-Session-Token")) {
|
|
9228
|
+
gatewayHeaders["X-Athena-Auth-Session-Token"] = normalizedAuthConfig.sessionToken;
|
|
8202
9229
|
}
|
|
8203
9230
|
const gateway = createAthenaGatewayClient({
|
|
8204
9231
|
baseUrl: config.baseUrl,
|
|
8205
9232
|
apiKey: config.apiKey,
|
|
8206
9233
|
client: config.client,
|
|
9234
|
+
userId: config.userId,
|
|
9235
|
+
organizationId: config.organizationId,
|
|
9236
|
+
forceNoCache: config.forceNoCache,
|
|
8207
9237
|
backend: config.backend,
|
|
8208
9238
|
headers: gatewayHeaders
|
|
8209
9239
|
});
|
|
8210
9240
|
const formatGatewayResult = createResultFormatter(config.experimental);
|
|
8211
9241
|
const queryTracer = createQueryTracer(config.experimental);
|
|
8212
|
-
const auth = createAuthClient(
|
|
9242
|
+
const auth = createAuthClient({
|
|
9243
|
+
...normalizedAuthConfig ?? {},
|
|
9244
|
+
...config.forceNoCache ? { forceNoCache: true } : {}
|
|
9245
|
+
});
|
|
8213
9246
|
function from(tableOrModel, options) {
|
|
8214
9247
|
if (isAthenaModelTarget(tableOrModel)) {
|
|
8215
9248
|
if (options?.schema !== void 0) {
|
|
@@ -8257,17 +9290,160 @@ function createClientFromConfig(config) {
|
|
|
8257
9290
|
queryTracer
|
|
8258
9291
|
);
|
|
8259
9292
|
const db = createDbModule({ from, rpc, query });
|
|
9293
|
+
const chat = createChatModule({
|
|
9294
|
+
baseUrl: config.chatUrl,
|
|
9295
|
+
apiKey: config.apiKey,
|
|
9296
|
+
client: config.client,
|
|
9297
|
+
headers: config.headers,
|
|
9298
|
+
bearerToken: normalizedAuthConfig?.bearerToken,
|
|
9299
|
+
cookie: normalizedAuthConfig?.cookie,
|
|
9300
|
+
sessionToken: normalizedAuthConfig?.sessionToken,
|
|
9301
|
+
forceNoCache: config.forceNoCache,
|
|
9302
|
+
wsUrl: config.chatWsUrl,
|
|
9303
|
+
webSocketFactory: config.chat?.webSocketFactory ?? void 0
|
|
9304
|
+
});
|
|
9305
|
+
const request2 = async (options) => {
|
|
9306
|
+
const method = options.method ?? "GET";
|
|
9307
|
+
const responseType = options.responseType ?? "json";
|
|
9308
|
+
const service = options.service ?? "db";
|
|
9309
|
+
const baseUrlByService = {
|
|
9310
|
+
db: config.baseUrl,
|
|
9311
|
+
auth: config.authUrl,
|
|
9312
|
+
chat: config.chatUrl,
|
|
9313
|
+
storage: config.storageUrl
|
|
9314
|
+
};
|
|
9315
|
+
const resolvedBaseUrl = options.url ?? baseUrlByService[service];
|
|
9316
|
+
if (!resolvedBaseUrl) {
|
|
9317
|
+
throw new Error(
|
|
9318
|
+
`Athena ${service} base URL is not configured. Pass createClient({ url }) for unified routing or set the service-specific URL first.`
|
|
9319
|
+
);
|
|
9320
|
+
}
|
|
9321
|
+
const normalizedBaseUrl = normalizeAthenaGatewayBaseUrl(resolvedBaseUrl, {
|
|
9322
|
+
label: `Athena ${service} base URL`
|
|
9323
|
+
});
|
|
9324
|
+
const normalizedPath = options.url ? "" : (() => {
|
|
9325
|
+
const path = options.path?.trim();
|
|
9326
|
+
if (!path) {
|
|
9327
|
+
throw new Error("client.request(...) requires either an absolute url or a non-empty path.");
|
|
9328
|
+
}
|
|
9329
|
+
return path.startsWith("/") ? path : `/${path}`;
|
|
9330
|
+
})();
|
|
9331
|
+
const targetUrl = options.url ? `${normalizedBaseUrl}${toRequestQueryString(options.query)}` : `${normalizedBaseUrl}${normalizedPath}${toRequestQueryString(options.query)}`;
|
|
9332
|
+
const headers = {
|
|
9333
|
+
"X-Athena-Sdk": buildSdkHeaderValue(SDK_NAME4),
|
|
9334
|
+
...config.headers ?? {},
|
|
9335
|
+
...options.headers ?? {}
|
|
9336
|
+
};
|
|
9337
|
+
if (service !== "auth") {
|
|
9338
|
+
headers.apikey = headers.apikey ?? config.apiKey;
|
|
9339
|
+
headers["x-api-key"] = headers["x-api-key"] ?? config.apiKey;
|
|
9340
|
+
if (config.client && !hasHeaderIgnoreCase(headers, "X-Athena-Client")) {
|
|
9341
|
+
headers["X-Athena-Client"] = config.client;
|
|
9342
|
+
}
|
|
9343
|
+
if (config.userId && !hasHeaderIgnoreCase(headers, "X-User-Id")) {
|
|
9344
|
+
headers["X-User-Id"] = config.userId;
|
|
9345
|
+
}
|
|
9346
|
+
if (config.organizationId && !hasHeaderIgnoreCase(headers, "X-Organization-Id")) {
|
|
9347
|
+
headers["X-Organization-Id"] = config.organizationId;
|
|
9348
|
+
}
|
|
9349
|
+
if (normalizedAuthConfig?.sessionToken && !hasHeaderIgnoreCase(headers, "X-Athena-Auth-Session-Token")) {
|
|
9350
|
+
headers["X-Athena-Auth-Session-Token"] = normalizedAuthConfig.sessionToken;
|
|
9351
|
+
}
|
|
9352
|
+
if (normalizedAuthConfig?.bearerToken && !hasHeaderIgnoreCase(headers, "X-Athena-Auth-Bearer-Token")) {
|
|
9353
|
+
headers["X-Athena-Auth-Bearer-Token"] = normalizedAuthConfig.bearerToken;
|
|
9354
|
+
}
|
|
9355
|
+
if (normalizedAuthConfig?.cookie && !hasHeaderIgnoreCase(headers, "Cookie")) {
|
|
9356
|
+
headers.Cookie = normalizedAuthConfig.cookie;
|
|
9357
|
+
}
|
|
9358
|
+
} else {
|
|
9359
|
+
const authApiKey = normalizedAuthConfig?.apiKey ?? config.apiKey;
|
|
9360
|
+
if (authApiKey && !hasHeaderIgnoreCase(headers, "x-api-key")) {
|
|
9361
|
+
headers.apikey = headers.apikey ?? authApiKey;
|
|
9362
|
+
headers["x-api-key"] = headers["x-api-key"] ?? authApiKey;
|
|
9363
|
+
}
|
|
9364
|
+
if (normalizedAuthConfig?.bearerToken && !hasHeaderIgnoreCase(headers, "Authorization")) {
|
|
9365
|
+
headers.Authorization = `Bearer ${normalizedAuthConfig.bearerToken}`;
|
|
9366
|
+
}
|
|
9367
|
+
if (normalizedAuthConfig?.cookie && !hasHeaderIgnoreCase(headers, "Cookie")) {
|
|
9368
|
+
headers.Cookie = normalizedAuthConfig.cookie;
|
|
9369
|
+
}
|
|
9370
|
+
if (normalizedAuthConfig?.sessionToken && !hasHeaderIgnoreCase(headers, "X-Athena-Auth-Session-Token")) {
|
|
9371
|
+
headers["X-Athena-Auth-Session-Token"] = normalizedAuthConfig.sessionToken;
|
|
9372
|
+
}
|
|
9373
|
+
}
|
|
9374
|
+
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";
|
|
9375
|
+
if (shouldSendJsonBody && !hasHeaderIgnoreCase(headers, "Content-Type")) {
|
|
9376
|
+
headers["Content-Type"] = "application/json";
|
|
9377
|
+
}
|
|
9378
|
+
const response = await fetch(targetUrl, {
|
|
9379
|
+
method,
|
|
9380
|
+
headers,
|
|
9381
|
+
body: options.body === void 0 || options.body === null ? void 0 : shouldSendJsonBody ? JSON.stringify(options.body) : options.body,
|
|
9382
|
+
signal: options.signal,
|
|
9383
|
+
credentials: options.credentials
|
|
9384
|
+
});
|
|
9385
|
+
if (responseType === "response") {
|
|
9386
|
+
return {
|
|
9387
|
+
ok: response.ok,
|
|
9388
|
+
status: response.status,
|
|
9389
|
+
statusText: response.statusText,
|
|
9390
|
+
headers: response.headers,
|
|
9391
|
+
data: null,
|
|
9392
|
+
raw: response
|
|
9393
|
+
};
|
|
9394
|
+
}
|
|
9395
|
+
const rawText = await response.text();
|
|
9396
|
+
const parsed = responseType === "text" ? rawText : parseArbitraryResponseBody(rawText, response.headers.get("content-type"));
|
|
9397
|
+
return {
|
|
9398
|
+
ok: response.ok,
|
|
9399
|
+
status: response.status,
|
|
9400
|
+
statusText: response.statusText,
|
|
9401
|
+
headers: response.headers,
|
|
9402
|
+
data: parsed,
|
|
9403
|
+
raw: response
|
|
9404
|
+
};
|
|
9405
|
+
};
|
|
9406
|
+
const withContext = (context) => createClientFromInput(
|
|
9407
|
+
mergeClientOverrideOptions(sourceConfig, toClientContextOverrides(context))
|
|
9408
|
+
);
|
|
9409
|
+
const withSession = (session, options) => createClientFromInput(
|
|
9410
|
+
mergeClientOverrideOptions(
|
|
9411
|
+
sourceConfig,
|
|
9412
|
+
toClientContextOverrides(resolveSessionContextOptions(session, options))
|
|
9413
|
+
)
|
|
9414
|
+
);
|
|
9415
|
+
const authWithOptions = (options) => createClientFromInput(mergeClientOverrideOptions(sourceConfig, options));
|
|
8260
9416
|
const sdkClient = {
|
|
8261
9417
|
from,
|
|
8262
9418
|
db,
|
|
8263
9419
|
rpc,
|
|
8264
9420
|
query,
|
|
9421
|
+
request: request2,
|
|
8265
9422
|
verifyConnection: gateway.verifyConnection,
|
|
8266
|
-
auth: auth.auth
|
|
9423
|
+
auth: auth.auth,
|
|
9424
|
+
chat,
|
|
9425
|
+
withContext,
|
|
9426
|
+
withSession,
|
|
9427
|
+
withOptions: authWithOptions
|
|
8267
9428
|
};
|
|
8268
9429
|
if (config.experimental?.athenaStorageBackend) {
|
|
9430
|
+
const storageWithContext = (context) => createClientFromInput(
|
|
9431
|
+
mergeClientOverrideOptions(sourceConfig, toClientContextOverrides(context))
|
|
9432
|
+
);
|
|
9433
|
+
const storageWithSession = (session, options) => createClientFromInput(
|
|
9434
|
+
mergeClientOverrideOptions(
|
|
9435
|
+
sourceConfig,
|
|
9436
|
+
toClientContextOverrides(resolveSessionContextOptions(session, options))
|
|
9437
|
+
)
|
|
9438
|
+
);
|
|
9439
|
+
const storageWithOptions = (options) => createClientFromInput(
|
|
9440
|
+
mergeClientOverrideOptions(sourceConfig, options)
|
|
9441
|
+
);
|
|
8269
9442
|
const storageClient = {
|
|
8270
9443
|
...sdkClient,
|
|
9444
|
+
withContext: storageWithContext,
|
|
9445
|
+
withSession: storageWithSession,
|
|
9446
|
+
withOptions: storageWithOptions,
|
|
8271
9447
|
storage: createStorageModule(gateway, {
|
|
8272
9448
|
...config.experimental.storage,
|
|
8273
9449
|
...config.storageUrl ? {
|
|
@@ -8283,38 +9459,46 @@ function createClientFromConfig(config) {
|
|
|
8283
9459
|
var AthenaClient = class {
|
|
8284
9460
|
/** Create a fluent builder for a strongly-typed Athena SDK client. */
|
|
8285
9461
|
static builder() {
|
|
8286
|
-
return createAthenaClientBuilder((config) =>
|
|
8287
|
-
}
|
|
8288
|
-
|
|
8289
|
-
|
|
8290
|
-
const url =
|
|
8291
|
-
const gatewayUrl =
|
|
8292
|
-
const authUrl =
|
|
8293
|
-
const
|
|
8294
|
-
const
|
|
9462
|
+
return createAthenaClientBuilder((config) => createClientFromInput(config));
|
|
9463
|
+
}
|
|
9464
|
+
static fromEnvironment(options = {}) {
|
|
9465
|
+
const env = options.env ?? process.env;
|
|
9466
|
+
const url = options.url ?? readFirstEnvValue(env, ATHENA_ENV_URL_KEYS);
|
|
9467
|
+
const gatewayUrl = options.gatewayUrl ?? readFirstEnvValue(env, ATHENA_ENV_GATEWAY_URL_KEYS);
|
|
9468
|
+
const authUrl = options.authUrl ?? readFirstEnvValue(env, ATHENA_ENV_AUTH_URL_KEYS);
|
|
9469
|
+
const chatUrl = options.chatUrl ?? readFirstEnvValue(env, ATHENA_ENV_CHAT_URL_KEYS);
|
|
9470
|
+
const chatWsUrl = options.chatWsUrl ?? readFirstEnvValue(env, ATHENA_ENV_CHAT_WS_URL_KEYS);
|
|
9471
|
+
const storageUrl = options.storageUrl ?? readFirstEnvValue(env, ATHENA_ENV_STORAGE_URL_KEYS);
|
|
9472
|
+
const key = options.key ?? readFirstEnvValue(env, ATHENA_ENV_KEY_KEYS);
|
|
9473
|
+
const client = options.client ?? readFirstEnvValue(env, ATHENA_ENV_CLIENT_KEYS);
|
|
8295
9474
|
if (!url && !gatewayUrl || !key) {
|
|
8296
9475
|
throw new Error(
|
|
8297
|
-
"
|
|
9476
|
+
"AthenaClient.fromEnvironment() requires an API key plus a public or gateway URL. Supported aliases include ATHENA_API_KEY, NEXT_PUBLIC_ATHENA_API_KEY, ATHENA_GATEWAY_API_KEY, X_API_KEY, ATHENA_URL, NEXT_PUBLIC_ATHENA_URL, ATHENA_GATEWAY_URL, and ATHENA_DB_URL."
|
|
8298
9477
|
);
|
|
8299
9478
|
}
|
|
9479
|
+
const { env: _env, ...clientOptions } = options;
|
|
8300
9480
|
return createClient({
|
|
9481
|
+
...clientOptions,
|
|
8301
9482
|
url,
|
|
8302
9483
|
gatewayUrl,
|
|
8303
9484
|
authUrl,
|
|
9485
|
+
chatUrl,
|
|
9486
|
+
chatWsUrl,
|
|
8304
9487
|
storageUrl,
|
|
8305
|
-
key
|
|
9488
|
+
key,
|
|
9489
|
+
client
|
|
8306
9490
|
});
|
|
8307
9491
|
}
|
|
8308
9492
|
};
|
|
8309
9493
|
function createClient(configOrUrl, apiKey, options) {
|
|
8310
9494
|
if (typeof configOrUrl === "string" || configOrUrl === null || configOrUrl === void 0) {
|
|
8311
|
-
return
|
|
9495
|
+
return createClientFromInput({
|
|
8312
9496
|
url: configOrUrl,
|
|
8313
9497
|
key: apiKey ?? "",
|
|
8314
9498
|
...options
|
|
8315
|
-
})
|
|
9499
|
+
});
|
|
8316
9500
|
}
|
|
8317
|
-
return
|
|
9501
|
+
return createClientFromInput(configOrUrl);
|
|
8318
9502
|
}
|
|
8319
9503
|
|
|
8320
9504
|
// src/gateway/types.ts
|
|
@@ -8345,7 +9529,7 @@ function resolveNullishValue(mode) {
|
|
|
8345
9529
|
if (mode === "null") return null;
|
|
8346
9530
|
return "";
|
|
8347
9531
|
}
|
|
8348
|
-
function
|
|
9532
|
+
function isRecord11(value) {
|
|
8349
9533
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
8350
9534
|
}
|
|
8351
9535
|
function isNullableColumn(model, key) {
|
|
@@ -8354,7 +9538,7 @@ function isNullableColumn(model, key) {
|
|
|
8354
9538
|
}
|
|
8355
9539
|
function toModelFormDefaults(model, values, options) {
|
|
8356
9540
|
const source = values;
|
|
8357
|
-
if (!
|
|
9541
|
+
if (!isRecord11(source)) {
|
|
8358
9542
|
return {};
|
|
8359
9543
|
}
|
|
8360
9544
|
const mode = options?.nullishMode ?? "empty-string";
|
|
@@ -8680,6 +9864,9 @@ function createColumnsBuilder(name, mappedName, schemaName, columns) {
|
|
|
8680
9864
|
resolveTableTarget(name, mappedName, normalizedSchemaName);
|
|
8681
9865
|
return createColumnsBuilder(name, mappedName, normalizedSchemaName, columns);
|
|
8682
9866
|
},
|
|
9867
|
+
withoutPrimaryKey() {
|
|
9868
|
+
return finalizeTable(name, mappedName, schemaName, columns, []);
|
|
9869
|
+
},
|
|
8683
9870
|
primaryKey(...keys) {
|
|
8684
9871
|
return finalizeTable(name, mappedName, schemaName, columns, keys);
|
|
8685
9872
|
}
|
|
@@ -8731,6 +9918,59 @@ var TenantHeaderMapper = class {
|
|
|
8731
9918
|
return Object.keys(headers).length > 0 ? headers : void 0;
|
|
8732
9919
|
}
|
|
8733
9920
|
};
|
|
9921
|
+
function normalizeOptionalString2(value) {
|
|
9922
|
+
if (typeof value !== "string") {
|
|
9923
|
+
return void 0;
|
|
9924
|
+
}
|
|
9925
|
+
const normalizedValue = value.trim();
|
|
9926
|
+
return normalizedValue ? normalizedValue : void 0;
|
|
9927
|
+
}
|
|
9928
|
+
function readHeaderBagValue2(headers, targetKey) {
|
|
9929
|
+
if (!headers) {
|
|
9930
|
+
return void 0;
|
|
9931
|
+
}
|
|
9932
|
+
if (typeof headers.get === "function") {
|
|
9933
|
+
return normalizeOptionalString2(headers.get(targetKey));
|
|
9934
|
+
}
|
|
9935
|
+
const normalizedTargetKey = targetKey.toLowerCase();
|
|
9936
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
9937
|
+
if (key.toLowerCase() !== normalizedTargetKey) {
|
|
9938
|
+
continue;
|
|
9939
|
+
}
|
|
9940
|
+
if (typeof value === "string") {
|
|
9941
|
+
return normalizeOptionalString2(value);
|
|
9942
|
+
}
|
|
9943
|
+
return void 0;
|
|
9944
|
+
}
|
|
9945
|
+
return void 0;
|
|
9946
|
+
}
|
|
9947
|
+
function resolveSessionContextOptions2(session, options) {
|
|
9948
|
+
const sessionToken = normalizeOptionalString2(session?.session?.token);
|
|
9949
|
+
const requestCookie = readHeaderBagValue2(options?.requestHeaders, "cookie") ?? readHeaderBagValue2(options?.headers, "cookie");
|
|
9950
|
+
const authInput = options?.auth;
|
|
9951
|
+
const resolvedUserId = options?.userId !== void 0 ? options.userId : session?.user?.id;
|
|
9952
|
+
const resolvedOrganizationId = options?.organizationId !== void 0 ? options.organizationId : session?.session?.activeOrganizationId;
|
|
9953
|
+
const resolvedBearerToken = authInput?.bearerToken !== void 0 ? authInput.bearerToken : sessionToken;
|
|
9954
|
+
const resolvedSessionToken = authInput?.sessionToken !== void 0 ? authInput.sessionToken : sessionToken;
|
|
9955
|
+
const resolvedCookie = authInput?.cookie !== void 0 ? authInput.cookie : requestCookie;
|
|
9956
|
+
const auth = authInput !== void 0 || resolvedBearerToken !== void 0 || resolvedSessionToken !== void 0 || resolvedCookie !== void 0 ? {
|
|
9957
|
+
...authInput ?? {},
|
|
9958
|
+
...resolvedBearerToken !== void 0 ? { bearerToken: resolvedBearerToken } : {},
|
|
9959
|
+
...resolvedSessionToken !== void 0 ? { sessionToken: resolvedSessionToken } : {},
|
|
9960
|
+
...resolvedCookie !== void 0 ? { cookie: resolvedCookie } : {},
|
|
9961
|
+
headers: authInput?.headers ? { ...authInput.headers } : void 0
|
|
9962
|
+
} : void 0;
|
|
9963
|
+
if (resolvedUserId === void 0 && resolvedOrganizationId === void 0 && options?.forceNoCache === void 0 && !options?.headers && !auth) {
|
|
9964
|
+
return void 0;
|
|
9965
|
+
}
|
|
9966
|
+
return {
|
|
9967
|
+
userId: resolvedUserId,
|
|
9968
|
+
organizationId: resolvedOrganizationId,
|
|
9969
|
+
forceNoCache: options?.forceNoCache,
|
|
9970
|
+
headers: options?.headers ? { ...options.headers } : void 0,
|
|
9971
|
+
auth
|
|
9972
|
+
};
|
|
9973
|
+
}
|
|
8734
9974
|
var RegistryNavigator = class {
|
|
8735
9975
|
constructor(registry) {
|
|
8736
9976
|
this.registry = registry;
|
|
@@ -8782,12 +10022,22 @@ var TypedAthenaClientImpl = class _TypedAthenaClientImpl {
|
|
|
8782
10022
|
backend: input.options?.backend,
|
|
8783
10023
|
client: input.options?.client,
|
|
8784
10024
|
headers: input.options?.headers,
|
|
10025
|
+
forceNoCache: input.options?.forceNoCache,
|
|
10026
|
+
userId: input.options?.userId,
|
|
10027
|
+
organizationId: input.options?.organizationId,
|
|
10028
|
+
auth: input.options?.auth,
|
|
10029
|
+
tenantKeyMap,
|
|
10030
|
+
tenantContext,
|
|
8785
10031
|
experimental: input.options?.experimental
|
|
8786
10032
|
};
|
|
8787
10033
|
this.baseClient = createClient(this.url, this.apiKey, {
|
|
8788
10034
|
backend: this.clientOptions.backend,
|
|
8789
10035
|
client: this.clientOptions.client,
|
|
8790
10036
|
headers: this.tenantHeaderMapper.apply(this.clientOptions.headers, tenantContext),
|
|
10037
|
+
forceNoCache: this.clientOptions.forceNoCache,
|
|
10038
|
+
userId: this.clientOptions.userId,
|
|
10039
|
+
organizationId: this.clientOptions.organizationId,
|
|
10040
|
+
auth: this.clientOptions.auth,
|
|
8791
10041
|
experimental: this.clientOptions.experimental
|
|
8792
10042
|
});
|
|
8793
10043
|
this.db = this.baseClient.db;
|
|
@@ -8802,9 +10052,46 @@ var TypedAthenaClientImpl = class _TypedAthenaClientImpl {
|
|
|
8802
10052
|
query(query, options) {
|
|
8803
10053
|
return this.baseClient.query(query, options);
|
|
8804
10054
|
}
|
|
10055
|
+
request(options) {
|
|
10056
|
+
return this.baseClient.request(options);
|
|
10057
|
+
}
|
|
8805
10058
|
verifyConnection(options) {
|
|
8806
10059
|
return this.baseClient.verifyConnection(options);
|
|
8807
10060
|
}
|
|
10061
|
+
withContext(context) {
|
|
10062
|
+
const headers = {
|
|
10063
|
+
...this.clientOptions.headers ?? {},
|
|
10064
|
+
...context?.headers ?? {}
|
|
10065
|
+
};
|
|
10066
|
+
const auth = this.clientOptions.auth || context?.auth ? {
|
|
10067
|
+
...this.clientOptions.auth ?? {},
|
|
10068
|
+
...context?.auth ?? {},
|
|
10069
|
+
headers: this.clientOptions.auth?.headers || context?.auth?.headers ? {
|
|
10070
|
+
...this.clientOptions.auth?.headers ?? {},
|
|
10071
|
+
...context?.auth?.headers ?? {}
|
|
10072
|
+
} : void 0
|
|
10073
|
+
} : void 0;
|
|
10074
|
+
return new _TypedAthenaClientImpl({
|
|
10075
|
+
registry: this.registry,
|
|
10076
|
+
url: this.url,
|
|
10077
|
+
apiKey: this.apiKey,
|
|
10078
|
+
options: {
|
|
10079
|
+
...this.clientOptions,
|
|
10080
|
+
headers: Object.keys(headers).length > 0 ? headers : void 0,
|
|
10081
|
+
auth,
|
|
10082
|
+
tenantKeyMap: this.tenantKeyMap,
|
|
10083
|
+
tenantContext: {
|
|
10084
|
+
...this.tenantContext
|
|
10085
|
+
},
|
|
10086
|
+
...context?.userId !== void 0 ? { userId: context.userId } : {},
|
|
10087
|
+
...context?.organizationId !== void 0 ? { organizationId: context.organizationId } : {},
|
|
10088
|
+
...context?.forceNoCache !== void 0 ? { forceNoCache: context.forceNoCache } : {}
|
|
10089
|
+
}
|
|
10090
|
+
});
|
|
10091
|
+
}
|
|
10092
|
+
withSession(session, options) {
|
|
10093
|
+
return this.withContext(resolveSessionContextOptions2(session, options));
|
|
10094
|
+
}
|
|
8808
10095
|
withTenantContext(context) {
|
|
8809
10096
|
return new _TypedAthenaClientImpl({
|
|
8810
10097
|
registry: this.registry,
|
|
@@ -8865,6 +10152,77 @@ function resolveProviderSchemas(providerConfig) {
|
|
|
8865
10152
|
return [...DEFAULT_POSTGRES_SCHEMAS];
|
|
8866
10153
|
}
|
|
8867
10154
|
|
|
10155
|
+
// src/generator/table-selection.ts
|
|
10156
|
+
function normalizeTableSelector(value) {
|
|
10157
|
+
const trimmed = value.trim();
|
|
10158
|
+
return trimmed.length > 0 ? trimmed : void 0;
|
|
10159
|
+
}
|
|
10160
|
+
function normalizeTableSelection(value) {
|
|
10161
|
+
if (typeof value === "string") {
|
|
10162
|
+
return Array.from(
|
|
10163
|
+
new Set(
|
|
10164
|
+
value.split(",").map(normalizeTableSelector).filter((entry) => Boolean(entry))
|
|
10165
|
+
)
|
|
10166
|
+
);
|
|
10167
|
+
}
|
|
10168
|
+
if (Array.isArray(value)) {
|
|
10169
|
+
return Array.from(
|
|
10170
|
+
new Set(
|
|
10171
|
+
value.map((entry) => typeof entry === "string" ? normalizeTableSelector(entry) : void 0).filter((entry) => Boolean(entry))
|
|
10172
|
+
)
|
|
10173
|
+
);
|
|
10174
|
+
}
|
|
10175
|
+
return [];
|
|
10176
|
+
}
|
|
10177
|
+
function matchesTableSelector(schemaName, tableName, selector) {
|
|
10178
|
+
const separatorIndex = selector.indexOf(".");
|
|
10179
|
+
if (separatorIndex < 0) {
|
|
10180
|
+
return tableName === selector;
|
|
10181
|
+
}
|
|
10182
|
+
const selectorSchema = selector.slice(0, separatorIndex).trim();
|
|
10183
|
+
const selectorTable = selector.slice(separatorIndex + 1).trim();
|
|
10184
|
+
return selectorSchema === schemaName && selectorTable === tableName;
|
|
10185
|
+
}
|
|
10186
|
+
function shouldKeepTable(schemaName, tableName, filter) {
|
|
10187
|
+
const included = filter.includeTables.length === 0 || filter.includeTables.some((selector) => matchesTableSelector(schemaName, tableName, selector));
|
|
10188
|
+
if (!included) {
|
|
10189
|
+
return false;
|
|
10190
|
+
}
|
|
10191
|
+
return !filter.excludeTables.some((selector) => matchesTableSelector(schemaName, tableName, selector));
|
|
10192
|
+
}
|
|
10193
|
+
function hasTableFilters(filter) {
|
|
10194
|
+
return filter.includeTables.length > 0 || filter.excludeTables.length > 0;
|
|
10195
|
+
}
|
|
10196
|
+
function filterIntrospectionSnapshot(snapshot, filter) {
|
|
10197
|
+
if (!hasTableFilters(filter)) {
|
|
10198
|
+
return snapshot;
|
|
10199
|
+
}
|
|
10200
|
+
const schemas = {};
|
|
10201
|
+
for (const [schemaName, schema] of Object.entries(snapshot.schemas)) {
|
|
10202
|
+
const tables = Object.fromEntries(
|
|
10203
|
+
Object.entries(schema.tables).filter(([tableName]) => shouldKeepTable(schemaName, tableName, filter))
|
|
10204
|
+
);
|
|
10205
|
+
if (Object.keys(tables).length === 0) {
|
|
10206
|
+
continue;
|
|
10207
|
+
}
|
|
10208
|
+
schemas[schemaName] = {
|
|
10209
|
+
...schema,
|
|
10210
|
+
tables
|
|
10211
|
+
};
|
|
10212
|
+
}
|
|
10213
|
+
if (Object.keys(schemas).length === 0) {
|
|
10214
|
+
const includeLabel = filter.includeTables.length > 0 ? ` includeTables=${filter.includeTables.join(", ")}` : "";
|
|
10215
|
+
const excludeLabel = filter.excludeTables.length > 0 ? ` excludeTables=${filter.excludeTables.join(", ")}` : "";
|
|
10216
|
+
throw new Error(
|
|
10217
|
+
`Generator table filters matched no tables after schema selection.${includeLabel}${excludeLabel}`
|
|
10218
|
+
);
|
|
10219
|
+
}
|
|
10220
|
+
return {
|
|
10221
|
+
...snapshot,
|
|
10222
|
+
schemas
|
|
10223
|
+
};
|
|
10224
|
+
}
|
|
10225
|
+
|
|
8868
10226
|
// src/generator/env.ts
|
|
8869
10227
|
function readEnvStringValue(key) {
|
|
8870
10228
|
if (typeof process === "undefined" || !process.env) {
|
|
@@ -9130,15 +10488,15 @@ function readCookieFromHeaders(headers, name) {
|
|
|
9130
10488
|
}
|
|
9131
10489
|
return parseCookies(cookieHeader).get(name);
|
|
9132
10490
|
}
|
|
9133
|
-
function
|
|
10491
|
+
function isRecord12(value) {
|
|
9134
10492
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
9135
10493
|
}
|
|
9136
10494
|
function resolveSessionCandidate(value) {
|
|
9137
|
-
if (!
|
|
10495
|
+
if (!isRecord12(value)) {
|
|
9138
10496
|
return null;
|
|
9139
10497
|
}
|
|
9140
|
-
const session =
|
|
9141
|
-
const user =
|
|
10498
|
+
const session = isRecord12(value.session) ? value.session : void 0;
|
|
10499
|
+
const user = isRecord12(value.user) ? value.user : void 0;
|
|
9142
10500
|
if (session && typeof session.token === "string" && session.token.length > 0 && user) {
|
|
9143
10501
|
return {
|
|
9144
10502
|
session,
|
|
@@ -9148,7 +10506,7 @@ function resolveSessionCandidate(value) {
|
|
|
9148
10506
|
return null;
|
|
9149
10507
|
}
|
|
9150
10508
|
function inferSessionPair(returned) {
|
|
9151
|
-
return resolveSessionCandidate(returned) ?? (
|
|
10509
|
+
return resolveSessionCandidate(returned) ?? (isRecord12(returned) ? resolveSessionCandidate(returned.data) : null) ?? (isRecord12(returned) ? resolveSessionCandidate(returned.session) : null);
|
|
9152
10510
|
}
|
|
9153
10511
|
function resolveResponseHeaders(ctx) {
|
|
9154
10512
|
if (ctx.context.responseHeaders instanceof Headers) {
|
|
@@ -9171,23 +10529,23 @@ function normalizeBasePath(basePath) {
|
|
|
9171
10529
|
function isDynamicBaseURLConfig2(baseURL) {
|
|
9172
10530
|
return typeof baseURL === "object" && baseURL !== null && "allowedHosts" in baseURL && Array.isArray(baseURL.allowedHosts);
|
|
9173
10531
|
}
|
|
9174
|
-
function getRequestUrl(
|
|
10532
|
+
function getRequestUrl(request2) {
|
|
9175
10533
|
try {
|
|
9176
|
-
return new URL(
|
|
10534
|
+
return new URL(request2.url);
|
|
9177
10535
|
} catch {
|
|
9178
10536
|
return new URL("http://localhost");
|
|
9179
10537
|
}
|
|
9180
10538
|
}
|
|
9181
|
-
function getRequestHost(
|
|
9182
|
-
const forwardedHost =
|
|
9183
|
-
const host = forwardedHost ||
|
|
10539
|
+
function getRequestHost(request2, url) {
|
|
10540
|
+
const forwardedHost = request2.headers.get("x-forwarded-host")?.split(",")[0]?.trim();
|
|
10541
|
+
const host = forwardedHost || request2.headers.get("host") || url.host;
|
|
9184
10542
|
return host || null;
|
|
9185
10543
|
}
|
|
9186
|
-
function getRequestProtocol(
|
|
10544
|
+
function getRequestProtocol(request2, configuredProtocol, url) {
|
|
9187
10545
|
if (configuredProtocol === "http" || configuredProtocol === "https") {
|
|
9188
10546
|
return configuredProtocol;
|
|
9189
10547
|
}
|
|
9190
|
-
const forwardedProto =
|
|
10548
|
+
const forwardedProto = request2.headers.get("x-forwarded-proto")?.split(",")[0]?.trim();
|
|
9191
10549
|
if (forwardedProto === "http" || forwardedProto === "https") {
|
|
9192
10550
|
return forwardedProto;
|
|
9193
10551
|
}
|
|
@@ -9196,12 +10554,12 @@ function getRequestProtocol(request, configuredProtocol, url) {
|
|
|
9196
10554
|
}
|
|
9197
10555
|
return "http";
|
|
9198
10556
|
}
|
|
9199
|
-
function resolveRequestBaseURL(baseURL,
|
|
10557
|
+
function resolveRequestBaseURL(baseURL, request2) {
|
|
9200
10558
|
if (typeof baseURL === "string") {
|
|
9201
10559
|
return normalizeBaseURL(baseURL);
|
|
9202
10560
|
}
|
|
9203
|
-
const requestUrl = getRequestUrl(
|
|
9204
|
-
const host = getRequestHost(
|
|
10561
|
+
const requestUrl = getRequestUrl(request2);
|
|
10562
|
+
const host = getRequestHost(request2, requestUrl);
|
|
9205
10563
|
if (!host) {
|
|
9206
10564
|
return null;
|
|
9207
10565
|
}
|
|
@@ -9211,7 +10569,7 @@ function resolveRequestBaseURL(baseURL, request) {
|
|
|
9211
10569
|
return null;
|
|
9212
10570
|
}
|
|
9213
10571
|
}
|
|
9214
|
-
const protocol = typeof baseURL === "object" && baseURL !== null ? getRequestProtocol(
|
|
10572
|
+
const protocol = typeof baseURL === "object" && baseURL !== null ? getRequestProtocol(request2, baseURL.protocol, requestUrl) : getRequestProtocol(request2, void 0, requestUrl);
|
|
9215
10573
|
return `${protocol}://${host}`;
|
|
9216
10574
|
}
|
|
9217
10575
|
function getOrigin(baseURL) {
|
|
@@ -9224,16 +10582,16 @@ function getOrigin(baseURL) {
|
|
|
9224
10582
|
return void 0;
|
|
9225
10583
|
}
|
|
9226
10584
|
}
|
|
9227
|
-
async function resolveTrustedOrigins(config, baseURL,
|
|
9228
|
-
const resolved = typeof config.trustedOrigins === "function" ? await config.trustedOrigins(
|
|
10585
|
+
async function resolveTrustedOrigins(config, baseURL, request2) {
|
|
10586
|
+
const resolved = typeof config.trustedOrigins === "function" ? await config.trustedOrigins(request2) : config.trustedOrigins ?? [];
|
|
9229
10587
|
const values = [
|
|
9230
10588
|
getOrigin(baseURL),
|
|
9231
10589
|
...resolved
|
|
9232
10590
|
];
|
|
9233
10591
|
return Array.from(new Set(values.filter((value) => typeof value === "string" && value.length > 0)));
|
|
9234
10592
|
}
|
|
9235
|
-
async function resolveTrustedProviders(config,
|
|
9236
|
-
const configured = typeof config.trustedProviders === "function" ? await config.trustedProviders(
|
|
10593
|
+
async function resolveTrustedProviders(config, request2) {
|
|
10594
|
+
const configured = typeof config.trustedProviders === "function" ? await config.trustedProviders(request2) : config.trustedProviders ?? [];
|
|
9237
10595
|
const values = [
|
|
9238
10596
|
...Object.keys(config.socialProviders ?? {}),
|
|
9239
10597
|
...configured
|
|
@@ -9358,9 +10716,9 @@ function athenaAuth(config) {
|
|
|
9358
10716
|
}
|
|
9359
10717
|
return ctx;
|
|
9360
10718
|
};
|
|
9361
|
-
const resolveRequestContext = async (
|
|
9362
|
-
const requestUrl = getRequestUrl(
|
|
9363
|
-
const resolvedBaseURL = resolveRequestBaseURL(config.baseURL,
|
|
10719
|
+
const resolveRequestContext = async (request2) => {
|
|
10720
|
+
const requestUrl = getRequestUrl(request2);
|
|
10721
|
+
const resolvedBaseURL = resolveRequestBaseURL(config.baseURL, request2);
|
|
9364
10722
|
if (!resolvedBaseURL) {
|
|
9365
10723
|
throw new Error(
|
|
9366
10724
|
isDynamicBaseURLConfig2(config.baseURL) ? "Could not resolve base URL from request. Check allowedHosts/baseURL." : "Could not resolve base URL from request."
|
|
@@ -9371,17 +10729,17 @@ function athenaAuth(config) {
|
|
|
9371
10729
|
session: config.session,
|
|
9372
10730
|
advanced: config.advanced
|
|
9373
10731
|
});
|
|
9374
|
-
const trustedOrigins = await resolveTrustedOrigins(config, resolvedBaseURL,
|
|
9375
|
-
const trustedProviders = await resolveTrustedProviders(config,
|
|
10732
|
+
const trustedOrigins = await resolveTrustedOrigins(config, resolvedBaseURL, request2);
|
|
10733
|
+
const trustedProviders = await resolveTrustedProviders(config, request2);
|
|
9376
10734
|
return {
|
|
9377
10735
|
auth,
|
|
9378
|
-
request,
|
|
10736
|
+
request: request2,
|
|
9379
10737
|
url: requestUrl,
|
|
9380
10738
|
path: requestUrl.pathname,
|
|
9381
10739
|
basePath: normalizedBasePath,
|
|
9382
10740
|
baseURL: resolvedBaseURL,
|
|
9383
10741
|
origin: getOrigin(resolvedBaseURL) ?? resolvedBaseURL,
|
|
9384
|
-
headers:
|
|
10742
|
+
headers: request2.headers,
|
|
9385
10743
|
cookies: requestCookies,
|
|
9386
10744
|
trustedOrigins,
|
|
9387
10745
|
trustedProviders,
|
|
@@ -9394,8 +10752,8 @@ function athenaAuth(config) {
|
|
|
9394
10752
|
socialProviders: auth.socialProviders
|
|
9395
10753
|
};
|
|
9396
10754
|
};
|
|
9397
|
-
const handler = async (
|
|
9398
|
-
const requestContext = await resolveRequestContext(
|
|
10755
|
+
const handler = async (request2) => {
|
|
10756
|
+
const requestContext = await resolveRequestContext(request2);
|
|
9399
10757
|
if (typeof config.handler !== "function") {
|
|
9400
10758
|
return createJsonResponse(
|
|
9401
10759
|
{
|
|
@@ -9416,7 +10774,7 @@ function athenaAuth(config) {
|
|
|
9416
10774
|
const responseHeaders = new Headers(response.headers);
|
|
9417
10775
|
await runAfterHooks({
|
|
9418
10776
|
path: requestContext.path,
|
|
9419
|
-
headers:
|
|
10777
|
+
headers: request2.headers,
|
|
9420
10778
|
context: {
|
|
9421
10779
|
responseHeaders,
|
|
9422
10780
|
returned: result.returned,
|
|
@@ -9523,6 +10881,6 @@ async function runSchemaGenerator(options = {}) {
|
|
|
9523
10881
|
return throwBrowserUnsupported("runSchemaGenerator");
|
|
9524
10882
|
}
|
|
9525
10883
|
|
|
9526
|
-
export { ATHENA_AUTH_BASE_ERROR_CODES, AthenaClient, AthenaError, AthenaErrorCategory, AthenaErrorCode, AthenaErrorKind, AthenaGatewayError, AthenaStorageError, AthenaStorageErrorCode, Backend, DEFAULT_POSTGRES_SCHEMAS, assertInt, athenaAuth, boolean, coerceInt, createAthenaStorageError, createAuthClient, createAuthReactEmailInput, createClient, createModelFormAdapter, createPostgresIntrospectionProvider, createTypedClient, defineAthenaAuthConfig, defineAuthEmailTemplate, defineDatabase, defineGeneratorConfig, defineModel, defineRegistry, defineSchema, enumeration, findGeneratorConfigPath, generateArtifactsFromSnapshot, generatorEnv, getAthenaDebugAst, identifier, isAthenaGatewayError, isOk, json, loadGeneratorConfig, normalizeAthenaError, normalizeAthenaGatewayBaseUrl, normalizeGeneratorConfig, normalizeSchemaSelection, number, parseBooleanFlag2 as parseBooleanFlag, renderAthenaReactEmail, requireAffected, requireSuccess, resolveGeneratorProvider, resolvePostgresColumnType, resolveProviderSchemas, runSchemaGenerator, storageSdkManifest, string, table, toModelFormDefaults, toModelPayload, unwrap, unwrapOne, unwrapRows, verifyAthenaGatewayUrl, withRetry };
|
|
10884
|
+
export { ATHENA_AUTH_ADMIN_LIMITS, ATHENA_AUTH_BASE_ERROR_CODES, ATHENA_AUTH_MAX_ADMIN_JSON_BYTES, ATHENA_AUTH_MAX_ADMIN_JSON_DEPTH, ATHENA_AUTH_MAX_TEMPLATE_VARIABLES, ATHENA_AUTH_MAX_TEMPLATE_VARIABLE_LENGTH, AthenaChatError, AthenaClient, AthenaError, AthenaErrorCategory, AthenaErrorCode, AthenaErrorKind, AthenaGatewayError, AthenaStorageError, AthenaStorageErrorCode, Backend, DEFAULT_POSTGRES_SCHEMAS, assertInt, athenaAuth, boolean, chatSdkManifest, coerceInt, createAthenaStorageError, createAuthClient, createAuthReactEmailInput, createClient, createModelFormAdapter, createPostgresIntrospectionProvider, createTypedClient, defineAthenaAuthConfig, defineAuthEmailTemplate, defineDatabase, defineGeneratorConfig, defineModel, defineRegistry, defineSchema, enumeration, filterIntrospectionSnapshot, findGeneratorConfigPath, generateArtifactsFromSnapshot, generatorEnv, getAthenaDebugAst, identifier, isAthenaGatewayError, isOk, json, loadGeneratorConfig, normalizeAthenaError, normalizeAthenaGatewayBaseUrl, normalizeGeneratorConfig, normalizeSchemaSelection, normalizeTableSelection, number, parseBooleanFlag2 as parseBooleanFlag, renderAthenaReactEmail, requireAffected, requireSuccess, resolveGeneratorProvider, resolvePostgresColumnType, resolveProviderSchemas, runSchemaGenerator, storageSdkManifest, string, table, toModelFormDefaults, toModelPayload, unwrap, unwrapChatMessage, unwrapChatRoom, unwrapOne, unwrapRows, verifyAthenaGatewayUrl, withRetry };
|
|
9527
10885
|
//# sourceMappingURL=browser.js.map
|
|
9528
10886
|
//# sourceMappingURL=browser.js.map
|