@xylex-group/athena 2.8.0 → 2.9.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 +165 -68
- package/dist/browser.cjs +1331 -70
- 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 +1325 -71
- package/dist/browser.js.map +1 -1
- package/dist/cli/index.cjs +1354 -117
- 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 +1354 -117
- package/dist/cli/index.js.map +1 -1
- package/dist/{model-form-DMed05gE.d.cts → client-CfAE_QOj.d.cts} +741 -132
- package/dist/{model-form-DXPlOnlI.d.ts → client-D6EIJdQS.d.ts} +741 -132
- package/dist/index.cjs +1391 -71
- 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 +1385 -72
- 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/next/client.cjs +7875 -0
- package/dist/next/client.cjs.map +1 -0
- package/dist/next/client.d.cts +25 -0
- package/dist/next/client.d.ts +25 -0
- package/dist/next/client.js +7873 -0
- package/dist/next/client.js.map +1 -0
- package/dist/next/server.cjs +7993 -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 +7990 -0
- package/dist/next/server.js.map +1 -0
- package/dist/{pipeline-D4sJRKqN.d.cts → pipeline-CmUZsXsi.d.cts} +1 -1
- package/dist/{pipeline-CkMnhwPI.d.ts → pipeline-DZMsPxUg.d.ts} +1 -1
- package/dist/{react-email-DZhDDlEl.d.cts → react-email-BvJ3fj_F.d.cts} +35 -7
- package/dist/{react-email-Lrz9A-BW.d.ts → react-email-PLAJuZuO.d.ts} +35 -7
- package/dist/react.cjs +30 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +39 -10
- package/dist/react.d.ts +39 -10
- package/dist/react.js +30 -2
- package/dist/react.js.map +1 -1
- package/dist/shared-BW6hoLBY.d.cts +33 -0
- package/dist/shared-BiJvoURI.d.ts +33 -0
- package/dist/{types-vikz9YIO.d.cts → types-BeZIHduP.d.cts} +5 -1
- package/dist/{types-vikz9YIO.d.ts → types-BeZIHduP.d.ts} +5 -1
- package/dist/{types-CAtTGGoz.d.cts → types-C-YvfgYh.d.cts} +27 -2
- package/dist/{types-BzY6fETM.d.ts → types-CRjDwmtJ.d.ts} +27 -2
- package/package.json +37 -49
package/dist/browser.js
CHANGED
|
@@ -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.9.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,54 @@ function mergeCallOptions(base, override) {
|
|
|
1800
1852
|
}
|
|
1801
1853
|
};
|
|
1802
1854
|
}
|
|
1855
|
+
function toSessionGuardFailure(sessionResult) {
|
|
1856
|
+
if (sessionResult.status === 401 || sessionResult.data == null) {
|
|
1857
|
+
return {
|
|
1858
|
+
ok: false,
|
|
1859
|
+
reason: "unauthorized",
|
|
1860
|
+
status: 401,
|
|
1861
|
+
error: sessionResult.error ?? "Unauthorized",
|
|
1862
|
+
sessionResult
|
|
1863
|
+
};
|
|
1864
|
+
}
|
|
1865
|
+
return {
|
|
1866
|
+
ok: false,
|
|
1867
|
+
reason: "upstream_error",
|
|
1868
|
+
status: sessionResult.status,
|
|
1869
|
+
error: sessionResult.error ?? "Failed to resolve current session",
|
|
1870
|
+
sessionResult
|
|
1871
|
+
};
|
|
1872
|
+
}
|
|
1873
|
+
function toPermissionGuardFailure(permissionResult, sessionResult) {
|
|
1874
|
+
if (permissionResult.status === 401) {
|
|
1875
|
+
return {
|
|
1876
|
+
ok: false,
|
|
1877
|
+
reason: "unauthorized",
|
|
1878
|
+
status: 401,
|
|
1879
|
+
error: permissionResult.error ?? "Unauthorized",
|
|
1880
|
+
sessionResult,
|
|
1881
|
+
permissionResult
|
|
1882
|
+
};
|
|
1883
|
+
}
|
|
1884
|
+
if (permissionResult.status === 403) {
|
|
1885
|
+
return {
|
|
1886
|
+
ok: false,
|
|
1887
|
+
reason: "forbidden",
|
|
1888
|
+
status: 403,
|
|
1889
|
+
error: permissionResult.error ?? "Forbidden",
|
|
1890
|
+
sessionResult,
|
|
1891
|
+
permissionResult
|
|
1892
|
+
};
|
|
1893
|
+
}
|
|
1894
|
+
return {
|
|
1895
|
+
ok: false,
|
|
1896
|
+
reason: "upstream_error",
|
|
1897
|
+
status: permissionResult.status,
|
|
1898
|
+
error: permissionResult.error ?? "Failed to resolve permission check",
|
|
1899
|
+
sessionResult,
|
|
1900
|
+
permissionResult
|
|
1901
|
+
};
|
|
1902
|
+
}
|
|
1803
1903
|
function extractFetchOptions(input) {
|
|
1804
1904
|
if (!input) {
|
|
1805
1905
|
return {
|
|
@@ -1815,6 +1915,7 @@ function extractFetchOptions(input) {
|
|
|
1815
1915
|
};
|
|
1816
1916
|
}
|
|
1817
1917
|
function buildHeaders2(config, options) {
|
|
1918
|
+
const forceNoCache = Boolean(config.forceNoCache || options?.forceNoCache);
|
|
1818
1919
|
const headers = {
|
|
1819
1920
|
"Content-Type": "application/json",
|
|
1820
1921
|
"X-Athena-Sdk": SDK_HEADER_VALUE2
|
|
@@ -1828,16 +1929,30 @@ function buildHeaders2(config, options) {
|
|
|
1828
1929
|
if (bearerToken) {
|
|
1829
1930
|
headers.Authorization = `Bearer ${bearerToken}`;
|
|
1830
1931
|
}
|
|
1932
|
+
const cookie = options?.cookie ?? config.cookie;
|
|
1933
|
+
if (cookie) {
|
|
1934
|
+
headers.Cookie = cookie;
|
|
1935
|
+
}
|
|
1936
|
+
const sessionToken = options?.sessionToken ?? config.sessionToken;
|
|
1937
|
+
if (sessionToken) {
|
|
1938
|
+
headers["X-Athena-Auth-Session-Token"] = sessionToken;
|
|
1939
|
+
}
|
|
1831
1940
|
const mergedExtraHeaders = {
|
|
1832
1941
|
...config.headers ?? {},
|
|
1833
1942
|
...options?.headers ?? {}
|
|
1834
1943
|
};
|
|
1835
1944
|
Object.entries(mergedExtraHeaders).forEach(([key, value]) => {
|
|
1945
|
+
if (forceNoCache && isCacheControlHeaderName2(key)) {
|
|
1946
|
+
return;
|
|
1947
|
+
}
|
|
1836
1948
|
const normalized = normalizeHeaderValue2(value);
|
|
1837
1949
|
if (normalized) {
|
|
1838
1950
|
headers[key] = normalized;
|
|
1839
1951
|
}
|
|
1840
1952
|
});
|
|
1953
|
+
if (forceNoCache) {
|
|
1954
|
+
headers["Cache-Control"] = NO_CACHE_HEADER_VALUE2;
|
|
1955
|
+
}
|
|
1841
1956
|
return headers;
|
|
1842
1957
|
}
|
|
1843
1958
|
function appendQueryParam(searchParams, key, value) {
|
|
@@ -2102,7 +2217,91 @@ function createAuthClient(config = {}) {
|
|
|
2102
2217
|
htmlField: "htmlTemplate",
|
|
2103
2218
|
textField: "textTemplate",
|
|
2104
2219
|
variablesField: "variables"
|
|
2105
|
-
}, withReactEmailRoute(route))
|
|
2220
|
+
}, withReactEmailRoute(route)).then((payload) => {
|
|
2221
|
+
if ("variables" in payload && payload.variables !== void 0 && payload.variables !== null) {
|
|
2222
|
+
assertAthenaAuthTemplateVariables(
|
|
2223
|
+
payload.variables,
|
|
2224
|
+
`${route} variables`
|
|
2225
|
+
);
|
|
2226
|
+
}
|
|
2227
|
+
return payload;
|
|
2228
|
+
});
|
|
2229
|
+
const requireSession = async (input, options) => {
|
|
2230
|
+
const sessionInput = input?.fetchOptions ? { fetchOptions: input.fetchOptions } : void 0;
|
|
2231
|
+
const sessionResult = await getGeneric(
|
|
2232
|
+
"/get-session",
|
|
2233
|
+
sessionInput,
|
|
2234
|
+
options
|
|
2235
|
+
);
|
|
2236
|
+
if (!sessionResult.ok || sessionResult.data == null) {
|
|
2237
|
+
return toSessionGuardFailure(sessionResult);
|
|
2238
|
+
}
|
|
2239
|
+
return {
|
|
2240
|
+
ok: true,
|
|
2241
|
+
session: sessionResult.data
|
|
2242
|
+
};
|
|
2243
|
+
};
|
|
2244
|
+
const getUser = async (input, options) => {
|
|
2245
|
+
const sessionResult = await getGeneric(
|
|
2246
|
+
"/get-session",
|
|
2247
|
+
input,
|
|
2248
|
+
options
|
|
2249
|
+
);
|
|
2250
|
+
if (!sessionResult.ok) {
|
|
2251
|
+
return {
|
|
2252
|
+
...sessionResult,
|
|
2253
|
+
data: null
|
|
2254
|
+
};
|
|
2255
|
+
}
|
|
2256
|
+
return {
|
|
2257
|
+
...sessionResult,
|
|
2258
|
+
data: {
|
|
2259
|
+
user: sessionResult.data?.user ?? null
|
|
2260
|
+
}
|
|
2261
|
+
};
|
|
2262
|
+
};
|
|
2263
|
+
const requirePermission = async (endpoint, input, options) => {
|
|
2264
|
+
const sessionGuard = await requireSession(
|
|
2265
|
+
input?.fetchOptions ? { fetchOptions: input.fetchOptions } : void 0,
|
|
2266
|
+
options
|
|
2267
|
+
);
|
|
2268
|
+
if (!sessionGuard.ok) {
|
|
2269
|
+
return sessionGuard;
|
|
2270
|
+
}
|
|
2271
|
+
const permissionResult = await postGeneric(
|
|
2272
|
+
endpoint,
|
|
2273
|
+
input,
|
|
2274
|
+
options
|
|
2275
|
+
);
|
|
2276
|
+
if (!permissionResult.ok) {
|
|
2277
|
+
return toPermissionGuardFailure(permissionResult, {
|
|
2278
|
+
ok: true,
|
|
2279
|
+
status: 200,
|
|
2280
|
+
data: sessionGuard.session,
|
|
2281
|
+
error: null,
|
|
2282
|
+
errorDetails: null,
|
|
2283
|
+
raw: sessionGuard.session
|
|
2284
|
+
});
|
|
2285
|
+
}
|
|
2286
|
+
if (!permissionResult.data?.success) {
|
|
2287
|
+
return {
|
|
2288
|
+
ok: false,
|
|
2289
|
+
reason: "forbidden",
|
|
2290
|
+
status: 403,
|
|
2291
|
+
error: permissionResult.data?.error ?? "Forbidden",
|
|
2292
|
+
sessionResult: {
|
|
2293
|
+
ok: true,
|
|
2294
|
+
status: 200,
|
|
2295
|
+
data: sessionGuard.session,
|
|
2296
|
+
error: null,
|
|
2297
|
+
errorDetails: null,
|
|
2298
|
+
raw: sessionGuard.session
|
|
2299
|
+
},
|
|
2300
|
+
permissionResult
|
|
2301
|
+
};
|
|
2302
|
+
}
|
|
2303
|
+
return sessionGuard;
|
|
2304
|
+
};
|
|
2106
2305
|
const listUserEmailsWithFallback = async (input, options) => {
|
|
2107
2306
|
const primary = await getWithQuery(
|
|
2108
2307
|
"/email/list",
|
|
@@ -2264,6 +2463,7 @@ function createAuthClient(config = {}) {
|
|
|
2264
2463
|
input,
|
|
2265
2464
|
options
|
|
2266
2465
|
),
|
|
2466
|
+
requirePermission: (input, options) => requirePermission("/organization/has-permission", input, options),
|
|
2267
2467
|
invitation: {
|
|
2268
2468
|
cancel: (input, options) => executePostWithCompatibleInput(
|
|
2269
2469
|
resolvedConfig,
|
|
@@ -2459,6 +2659,8 @@ function createAuthClient(config = {}) {
|
|
|
2459
2659
|
};
|
|
2460
2660
|
const auth = {
|
|
2461
2661
|
getSession: (input, options) => getGeneric("/get-session", input, options),
|
|
2662
|
+
getUser,
|
|
2663
|
+
requireSession,
|
|
2462
2664
|
signOut,
|
|
2463
2665
|
forgetPassword: (input, options) => postGeneric("/forget-password", input, options),
|
|
2464
2666
|
resetPassword: authResetPassword,
|
|
@@ -2553,6 +2755,7 @@ function createAuthClient(config = {}) {
|
|
|
2553
2755
|
}
|
|
2554
2756
|
},
|
|
2555
2757
|
hasPermission: (input, options) => postGeneric("/admin/has-permission", input, options),
|
|
2758
|
+
requirePermission: (input, options) => requirePermission("/admin/has-permission", input, options),
|
|
2556
2759
|
apiKey: {
|
|
2557
2760
|
create: (input, options) => postGeneric("/admin/api-key/create", input, options)
|
|
2558
2761
|
},
|
|
@@ -2704,6 +2907,8 @@ function createAuthClient(config = {}) {
|
|
|
2704
2907
|
input,
|
|
2705
2908
|
options
|
|
2706
2909
|
),
|
|
2910
|
+
getUser,
|
|
2911
|
+
requireSession,
|
|
2707
2912
|
listSessions: (input, options) => executeGetWithCompatibleInput(
|
|
2708
2913
|
resolvedConfig,
|
|
2709
2914
|
{ endpoint: "/list-sessions", method: "GET" },
|
|
@@ -3396,7 +3601,12 @@ function createStorageFileModule(base, config = {}) {
|
|
|
3396
3601
|
content_type: input.content_type ?? source.contentType,
|
|
3397
3602
|
size_bytes: source.sizeBytes,
|
|
3398
3603
|
public: input.public,
|
|
3399
|
-
metadata: input.metadata
|
|
3604
|
+
metadata: input.metadata,
|
|
3605
|
+
server_side_encryption: input.server_side_encryption,
|
|
3606
|
+
sse: input.sse,
|
|
3607
|
+
ssekms_key_id: input.ssekms_key_id,
|
|
3608
|
+
kms_key_id: input.kms_key_id,
|
|
3609
|
+
bucket_key_enabled: input.bucket_key_enabled
|
|
3400
3610
|
}
|
|
3401
3611
|
};
|
|
3402
3612
|
});
|
|
@@ -3407,10 +3617,17 @@ function createStorageFileModule(base, config = {}) {
|
|
|
3407
3617
|
for (let index = 0; index < uploadRequests.length; index += 1) {
|
|
3408
3618
|
const request = uploadRequests[index];
|
|
3409
3619
|
const uploadUrl = uploadUrls[index];
|
|
3410
|
-
const response = await putUploadBody(
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3620
|
+
const response = await putUploadBody(
|
|
3621
|
+
uploadUrl.upload.url,
|
|
3622
|
+
uploadUrl.upload.headers ?? {},
|
|
3623
|
+
request.source,
|
|
3624
|
+
input,
|
|
3625
|
+
options,
|
|
3626
|
+
(progress) => {
|
|
3627
|
+
aggregateLoaded[index] = progress.loaded;
|
|
3628
|
+
input.onProgress?.(createProgressSnapshot("uploading", sources, index, progress.loaded, sum(aggregateLoaded)));
|
|
3629
|
+
}
|
|
3630
|
+
);
|
|
3414
3631
|
uploaded.push({
|
|
3415
3632
|
file: uploadUrl.file,
|
|
3416
3633
|
upload: uploadUrl.upload,
|
|
@@ -3513,8 +3730,9 @@ function validateUploadConstraints(sources, input) {
|
|
|
3513
3730
|
}
|
|
3514
3731
|
}
|
|
3515
3732
|
}
|
|
3516
|
-
async function putUploadBody(url, source, input, options, onProgress) {
|
|
3517
|
-
const headers = new Headers(
|
|
3733
|
+
async function putUploadBody(url, uploadHeaders, source, input, options, onProgress) {
|
|
3734
|
+
const headers = new Headers(uploadHeaders);
|
|
3735
|
+
new Headers(input.uploadHeaders).forEach((value, key) => headers.set(key, value));
|
|
3518
3736
|
if (source.contentType && !headers.has("Content-Type")) {
|
|
3519
3737
|
headers.set("Content-Type", source.contentType);
|
|
3520
3738
|
}
|
|
@@ -3801,59 +4019,554 @@ var storageSdkManifest = {
|
|
|
3801
4019
|
pathParams: ["file_id"],
|
|
3802
4020
|
queryParams: ["purpose"],
|
|
3803
4021
|
responseEnvelope: "athena",
|
|
3804
|
-
responseType: "PresignedFileUrlResponse"
|
|
4022
|
+
responseType: "PresignedFileUrlResponse"
|
|
4023
|
+
},
|
|
4024
|
+
{
|
|
4025
|
+
name: "getStorageFileProxy",
|
|
4026
|
+
method: "GET",
|
|
4027
|
+
path: "/storage/files/{file_id}/proxy",
|
|
4028
|
+
pathParams: ["file_id"],
|
|
4029
|
+
queryParams: ["purpose"],
|
|
4030
|
+
responseEnvelope: "raw",
|
|
4031
|
+
responseType: "Response",
|
|
4032
|
+
binary: true
|
|
4033
|
+
},
|
|
4034
|
+
{
|
|
4035
|
+
name: "updateStorageFile",
|
|
4036
|
+
method: "PATCH",
|
|
4037
|
+
path: "/storage/files/{file_id}",
|
|
4038
|
+
pathParams: ["file_id"],
|
|
4039
|
+
requestType: "UpdateStorageFileRequest",
|
|
4040
|
+
responseEnvelope: "athena",
|
|
4041
|
+
responseType: "StorageFileMutationResponse"
|
|
4042
|
+
},
|
|
4043
|
+
{
|
|
4044
|
+
name: "deleteStorageFile",
|
|
4045
|
+
method: "DELETE",
|
|
4046
|
+
path: "/storage/files/{file_id}",
|
|
4047
|
+
pathParams: ["file_id"],
|
|
4048
|
+
responseEnvelope: "athena",
|
|
4049
|
+
responseType: "StorageFileMutationResponse"
|
|
4050
|
+
},
|
|
4051
|
+
{
|
|
4052
|
+
name: "setStorageFileVisibility",
|
|
4053
|
+
method: "PATCH",
|
|
4054
|
+
path: "/storage/files/{file_id}/visibility",
|
|
4055
|
+
pathParams: ["file_id"],
|
|
4056
|
+
requestType: "SetStorageFileVisibilityRequest",
|
|
4057
|
+
responseEnvelope: "athena",
|
|
4058
|
+
responseType: "StorageFileMutationResponse"
|
|
4059
|
+
},
|
|
4060
|
+
{
|
|
4061
|
+
name: "postStorageFileVisibility",
|
|
4062
|
+
method: "POST",
|
|
4063
|
+
path: "/storage/files/{file_id}/visibility",
|
|
4064
|
+
pathParams: ["file_id"],
|
|
4065
|
+
requestType: "SetStorageFileVisibilityRequest",
|
|
4066
|
+
responseEnvelope: "athena",
|
|
4067
|
+
responseType: "StorageFileMutationResponse"
|
|
4068
|
+
},
|
|
4069
|
+
{
|
|
4070
|
+
name: "setManyStorageFileVisibility",
|
|
4071
|
+
method: "POST",
|
|
4072
|
+
path: "/storage/files/visibility-many",
|
|
4073
|
+
requestType: "SetManyStorageFileVisibilityRequest",
|
|
4074
|
+
responseEnvelope: "athena",
|
|
4075
|
+
responseType: "StorageFileMutationManyResponse"
|
|
4076
|
+
},
|
|
4077
|
+
{
|
|
4078
|
+
name: "deleteStorageFolder",
|
|
4079
|
+
method: "POST",
|
|
4080
|
+
path: "/storage/folders/delete",
|
|
4081
|
+
requestType: "DeleteStorageFolderRequest",
|
|
4082
|
+
responseEnvelope: "athena",
|
|
4083
|
+
responseType: "StorageFolderMutationResponse"
|
|
4084
|
+
},
|
|
4085
|
+
{
|
|
4086
|
+
name: "moveStorageFolder",
|
|
4087
|
+
method: "POST",
|
|
4088
|
+
path: "/storage/folders/move",
|
|
4089
|
+
requestType: "MoveStorageFolderRequest",
|
|
4090
|
+
responseEnvelope: "athena",
|
|
4091
|
+
responseType: "StorageFolderMutationResponse"
|
|
4092
|
+
},
|
|
4093
|
+
{
|
|
4094
|
+
name: "searchStorageFiles",
|
|
4095
|
+
method: "POST",
|
|
4096
|
+
path: "/storage/files/search",
|
|
4097
|
+
requestType: "SearchStorageFilesRequest",
|
|
4098
|
+
responseEnvelope: "athena",
|
|
4099
|
+
responseType: "StorageListFilesResponse"
|
|
4100
|
+
},
|
|
4101
|
+
{
|
|
4102
|
+
name: "confirmStorageUpload",
|
|
4103
|
+
method: "POST",
|
|
4104
|
+
path: "/storage/files/{file_id}/confirm-upload",
|
|
4105
|
+
pathParams: ["file_id"],
|
|
4106
|
+
requestType: "ConfirmStorageUploadRequest",
|
|
4107
|
+
responseEnvelope: "athena",
|
|
4108
|
+
responseType: "StorageFileMutationResponse"
|
|
4109
|
+
},
|
|
4110
|
+
{
|
|
4111
|
+
name: "uploadStorageFileBinary",
|
|
4112
|
+
method: "PUT",
|
|
4113
|
+
path: "/storage/files/{file_id}/upload",
|
|
4114
|
+
pathParams: ["file_id"],
|
|
4115
|
+
responseEnvelope: "athena",
|
|
4116
|
+
responseType: "StorageFileMutationResponse",
|
|
4117
|
+
binary: true
|
|
4118
|
+
},
|
|
4119
|
+
{
|
|
4120
|
+
name: "copyStorageFile",
|
|
4121
|
+
method: "POST",
|
|
4122
|
+
path: "/storage/files/{file_id}/copy",
|
|
4123
|
+
pathParams: ["file_id"],
|
|
4124
|
+
requestType: "CopyStorageFileRequest",
|
|
4125
|
+
responseEnvelope: "athena",
|
|
4126
|
+
responseType: "StorageFileMutationResponse"
|
|
4127
|
+
},
|
|
4128
|
+
{
|
|
4129
|
+
name: "deleteManyStorageFiles",
|
|
4130
|
+
method: "POST",
|
|
4131
|
+
path: "/storage/files/delete-many",
|
|
4132
|
+
requestType: "DeleteManyStorageFilesRequest",
|
|
4133
|
+
responseEnvelope: "athena",
|
|
4134
|
+
responseType: "StorageFileMutationManyResponse"
|
|
4135
|
+
},
|
|
4136
|
+
{
|
|
4137
|
+
name: "updateManyStorageFiles",
|
|
4138
|
+
method: "POST",
|
|
4139
|
+
path: "/storage/files/update-many",
|
|
4140
|
+
requestType: "UpdateManyStorageFilesRequest",
|
|
4141
|
+
responseEnvelope: "athena",
|
|
4142
|
+
responseType: "StorageFileMutationManyResponse"
|
|
4143
|
+
},
|
|
4144
|
+
{
|
|
4145
|
+
name: "restoreStorageFile",
|
|
4146
|
+
method: "POST",
|
|
4147
|
+
path: "/storage/files/{file_id}/restore",
|
|
4148
|
+
pathParams: ["file_id"],
|
|
4149
|
+
responseEnvelope: "athena",
|
|
4150
|
+
responseType: "StorageFileMutationResponse"
|
|
4151
|
+
},
|
|
4152
|
+
{
|
|
4153
|
+
name: "purgeStorageFile",
|
|
4154
|
+
method: "DELETE",
|
|
4155
|
+
path: "/storage/files/{file_id}/purge",
|
|
4156
|
+
pathParams: ["file_id"],
|
|
4157
|
+
responseEnvelope: "athena",
|
|
4158
|
+
responseType: "StorageFileMutationResponse"
|
|
4159
|
+
},
|
|
4160
|
+
{
|
|
4161
|
+
name: "getStorageFilePublicUrl",
|
|
4162
|
+
method: "GET",
|
|
4163
|
+
path: "/storage/files/{file_id}/public-url",
|
|
4164
|
+
pathParams: ["file_id"],
|
|
4165
|
+
responseEnvelope: "athena",
|
|
4166
|
+
responseType: "Record<string, unknown>"
|
|
4167
|
+
},
|
|
4168
|
+
{
|
|
4169
|
+
name: "getStorageFileProxyUrl",
|
|
4170
|
+
method: "GET",
|
|
4171
|
+
path: "/storage/files/{file_id}/proxy-url",
|
|
4172
|
+
pathParams: ["file_id"],
|
|
4173
|
+
queryParams: ["purpose"],
|
|
4174
|
+
responseEnvelope: "athena",
|
|
4175
|
+
responseType: "Record<string, unknown>"
|
|
4176
|
+
},
|
|
4177
|
+
{
|
|
4178
|
+
name: "listStorageFileVersions",
|
|
4179
|
+
method: "GET",
|
|
4180
|
+
path: "/storage/files/{file_id}/versions",
|
|
4181
|
+
pathParams: ["file_id"],
|
|
4182
|
+
responseEnvelope: "athena",
|
|
4183
|
+
responseType: "Record<string, unknown>"
|
|
4184
|
+
},
|
|
4185
|
+
{
|
|
4186
|
+
name: "restoreStorageFileVersion",
|
|
4187
|
+
method: "POST",
|
|
4188
|
+
path: "/storage/files/{file_id}/versions/{version_id}/restore",
|
|
4189
|
+
pathParams: ["file_id", "version_id"],
|
|
4190
|
+
responseEnvelope: "athena",
|
|
4191
|
+
responseType: "Record<string, unknown>"
|
|
4192
|
+
},
|
|
4193
|
+
{
|
|
4194
|
+
name: "deleteStorageFileVersion",
|
|
4195
|
+
method: "DELETE",
|
|
4196
|
+
path: "/storage/files/{file_id}/versions/{version_id}",
|
|
4197
|
+
pathParams: ["file_id", "version_id"],
|
|
4198
|
+
responseEnvelope: "athena",
|
|
4199
|
+
responseType: "Record<string, unknown>"
|
|
4200
|
+
},
|
|
4201
|
+
{
|
|
4202
|
+
name: "getStorageFileRetention",
|
|
4203
|
+
method: "GET",
|
|
4204
|
+
path: "/storage/files/{file_id}/retention",
|
|
4205
|
+
pathParams: ["file_id"],
|
|
4206
|
+
queryParams: ["version_id"],
|
|
4207
|
+
responseEnvelope: "athena",
|
|
4208
|
+
responseType: "Record<string, unknown>"
|
|
4209
|
+
},
|
|
4210
|
+
{
|
|
4211
|
+
name: "setStorageFileRetention",
|
|
4212
|
+
method: "POST",
|
|
4213
|
+
path: "/storage/files/{file_id}/retention",
|
|
4214
|
+
pathParams: ["file_id"],
|
|
4215
|
+
requestType: "StorageFileRetentionRequest",
|
|
4216
|
+
responseEnvelope: "athena",
|
|
4217
|
+
responseType: "Record<string, unknown>"
|
|
4218
|
+
},
|
|
4219
|
+
{
|
|
4220
|
+
name: "listStorageFolders",
|
|
4221
|
+
method: "POST",
|
|
4222
|
+
path: "/storage/folders/list",
|
|
4223
|
+
requestType: "ListStorageFoldersRequest",
|
|
4224
|
+
responseEnvelope: "athena",
|
|
4225
|
+
responseType: "Record<string, unknown>"
|
|
4226
|
+
},
|
|
4227
|
+
{
|
|
4228
|
+
name: "treeStorageFolders",
|
|
4229
|
+
method: "POST",
|
|
4230
|
+
path: "/storage/folders/tree",
|
|
4231
|
+
requestType: "TreeStorageFoldersRequest",
|
|
4232
|
+
responseEnvelope: "athena",
|
|
4233
|
+
responseType: "Record<string, unknown>"
|
|
4234
|
+
},
|
|
4235
|
+
{
|
|
4236
|
+
name: "listStoragePermissions",
|
|
4237
|
+
method: "POST",
|
|
4238
|
+
path: "/storage/permissions/list",
|
|
4239
|
+
requestType: "StoragePermissionListRequest",
|
|
4240
|
+
responseEnvelope: "athena",
|
|
4241
|
+
responseType: "StoragePermissionListResponse"
|
|
4242
|
+
},
|
|
4243
|
+
{
|
|
4244
|
+
name: "grantStoragePermission",
|
|
4245
|
+
method: "POST",
|
|
4246
|
+
path: "/storage/permissions/grant",
|
|
4247
|
+
requestType: "StoragePermissionGrantRequest",
|
|
4248
|
+
responseEnvelope: "athena",
|
|
4249
|
+
responseType: "Record<string, unknown>"
|
|
4250
|
+
},
|
|
4251
|
+
{
|
|
4252
|
+
name: "revokeStoragePermission",
|
|
4253
|
+
method: "POST",
|
|
4254
|
+
path: "/storage/permissions/revoke",
|
|
4255
|
+
requestType: "StoragePermissionRevokeRequest",
|
|
4256
|
+
responseEnvelope: "athena",
|
|
4257
|
+
responseType: "Record<string, unknown>"
|
|
4258
|
+
},
|
|
4259
|
+
{
|
|
4260
|
+
name: "checkStoragePermission",
|
|
4261
|
+
method: "POST",
|
|
4262
|
+
path: "/storage/permissions/check",
|
|
4263
|
+
requestType: "StoragePermissionCheckRequest",
|
|
4264
|
+
responseEnvelope: "athena",
|
|
4265
|
+
responseType: "StoragePermissionCheckResponse"
|
|
4266
|
+
},
|
|
4267
|
+
{
|
|
4268
|
+
name: "listStorageObjects",
|
|
4269
|
+
method: "POST",
|
|
4270
|
+
path: "/storage/objects",
|
|
4271
|
+
requestType: "StorageListObjectsRequest",
|
|
4272
|
+
responseEnvelope: "athena",
|
|
4273
|
+
responseType: "Record<string, unknown>"
|
|
4274
|
+
},
|
|
4275
|
+
{
|
|
4276
|
+
name: "headStorageObject",
|
|
4277
|
+
method: "POST",
|
|
4278
|
+
path: "/storage/objects/head",
|
|
4279
|
+
requestType: "StorageObjectRequest",
|
|
4280
|
+
responseEnvelope: "athena",
|
|
4281
|
+
responseType: "Record<string, unknown>"
|
|
4282
|
+
},
|
|
4283
|
+
{
|
|
4284
|
+
name: "existsStorageObject",
|
|
4285
|
+
method: "POST",
|
|
4286
|
+
path: "/storage/objects/exists",
|
|
4287
|
+
requestType: "StorageObjectRequest",
|
|
4288
|
+
responseEnvelope: "athena",
|
|
4289
|
+
responseType: "Record<string, unknown>"
|
|
4290
|
+
},
|
|
4291
|
+
{
|
|
4292
|
+
name: "validateStorageObject",
|
|
4293
|
+
method: "POST",
|
|
4294
|
+
path: "/storage/objects/validate",
|
|
4295
|
+
requestType: "StorageObjectValidateRequest",
|
|
4296
|
+
responseEnvelope: "athena",
|
|
4297
|
+
responseType: "Record<string, unknown>"
|
|
4298
|
+
},
|
|
4299
|
+
{
|
|
4300
|
+
name: "updateStorageObject",
|
|
4301
|
+
method: "POST",
|
|
4302
|
+
path: "/storage/objects/update",
|
|
4303
|
+
requestType: "StorageUpdateObjectRequest",
|
|
4304
|
+
responseEnvelope: "athena",
|
|
4305
|
+
responseType: "Record<string, unknown>"
|
|
4306
|
+
},
|
|
4307
|
+
{
|
|
4308
|
+
name: "copyStorageObject",
|
|
4309
|
+
method: "POST",
|
|
4310
|
+
path: "/storage/objects/copy",
|
|
4311
|
+
requestType: "StorageObjectCopyRequest",
|
|
4312
|
+
responseEnvelope: "athena",
|
|
4313
|
+
responseType: "Record<string, unknown>"
|
|
4314
|
+
},
|
|
4315
|
+
{
|
|
4316
|
+
name: "getStorageObjectUrl",
|
|
4317
|
+
method: "POST",
|
|
4318
|
+
path: "/storage/objects/url",
|
|
4319
|
+
requestType: "StorageObjectRequest",
|
|
4320
|
+
responseEnvelope: "athena",
|
|
4321
|
+
responseType: "Record<string, unknown>"
|
|
4322
|
+
},
|
|
4323
|
+
{
|
|
4324
|
+
name: "getStorageObjectPublicUrl",
|
|
4325
|
+
method: "POST",
|
|
4326
|
+
path: "/storage/objects/public-url",
|
|
4327
|
+
requestType: "StorageObjectPublicUrlRequest",
|
|
4328
|
+
responseEnvelope: "athena",
|
|
4329
|
+
responseType: "Record<string, unknown>"
|
|
4330
|
+
},
|
|
4331
|
+
{
|
|
4332
|
+
name: "deleteStorageObject",
|
|
4333
|
+
method: "POST",
|
|
4334
|
+
path: "/storage/objects/delete",
|
|
4335
|
+
requestType: "StorageObjectRequest",
|
|
4336
|
+
responseEnvelope: "athena",
|
|
4337
|
+
responseType: "Record<string, unknown>"
|
|
4338
|
+
},
|
|
4339
|
+
{
|
|
4340
|
+
name: "createStorageObjectUploadUrl",
|
|
4341
|
+
method: "POST",
|
|
4342
|
+
path: "/storage/objects/upload-url",
|
|
4343
|
+
requestType: "StoragePresignUploadRequest",
|
|
4344
|
+
responseEnvelope: "athena",
|
|
4345
|
+
responseType: "Record<string, unknown>"
|
|
4346
|
+
},
|
|
4347
|
+
{
|
|
4348
|
+
name: "createStorageObjectPostPolicy",
|
|
4349
|
+
method: "POST",
|
|
4350
|
+
path: "/storage/objects/post-policy",
|
|
4351
|
+
requestType: "StorageSignedPostPolicyRequest",
|
|
4352
|
+
responseEnvelope: "athena",
|
|
4353
|
+
responseType: "Record<string, unknown>"
|
|
4354
|
+
},
|
|
4355
|
+
{
|
|
4356
|
+
name: "listStorageObjectVersions",
|
|
4357
|
+
method: "POST",
|
|
4358
|
+
path: "/storage/objects/versions",
|
|
4359
|
+
requestType: "StorageObjectVersionListRequest",
|
|
4360
|
+
responseEnvelope: "athena",
|
|
4361
|
+
responseType: "Record<string, unknown>"
|
|
4362
|
+
},
|
|
4363
|
+
{
|
|
4364
|
+
name: "restoreStorageObjectVersion",
|
|
4365
|
+
method: "POST",
|
|
4366
|
+
path: "/storage/objects/versions/restore",
|
|
4367
|
+
requestType: "StorageObjectVersionMutationRequest",
|
|
4368
|
+
responseEnvelope: "athena",
|
|
4369
|
+
responseType: "Record<string, unknown>"
|
|
4370
|
+
},
|
|
4371
|
+
{
|
|
4372
|
+
name: "deleteStorageObjectVersion",
|
|
4373
|
+
method: "POST",
|
|
4374
|
+
path: "/storage/objects/versions/delete",
|
|
4375
|
+
requestType: "StorageObjectVersionMutationRequest",
|
|
4376
|
+
responseEnvelope: "athena",
|
|
4377
|
+
responseType: "Record<string, unknown>"
|
|
4378
|
+
},
|
|
4379
|
+
{
|
|
4380
|
+
name: "createStorageObjectFolder",
|
|
4381
|
+
method: "POST",
|
|
4382
|
+
path: "/storage/objects/folder",
|
|
4383
|
+
requestType: "StorageObjectFolderCreateRequest",
|
|
4384
|
+
responseEnvelope: "athena",
|
|
4385
|
+
responseType: "Record<string, unknown>"
|
|
4386
|
+
},
|
|
4387
|
+
{
|
|
4388
|
+
name: "deleteStorageObjectFolder",
|
|
4389
|
+
method: "POST",
|
|
4390
|
+
path: "/storage/objects/folder/delete",
|
|
4391
|
+
requestType: "StorageObjectFolderDeleteRequest",
|
|
4392
|
+
responseEnvelope: "athena",
|
|
4393
|
+
responseType: "Record<string, unknown>"
|
|
4394
|
+
},
|
|
4395
|
+
{
|
|
4396
|
+
name: "renameStorageObjectFolder",
|
|
4397
|
+
method: "POST",
|
|
4398
|
+
path: "/storage/objects/folder/rename",
|
|
4399
|
+
requestType: "StorageObjectFolderRenameRequest",
|
|
4400
|
+
responseEnvelope: "athena",
|
|
4401
|
+
responseType: "Record<string, unknown>"
|
|
4402
|
+
},
|
|
4403
|
+
{
|
|
4404
|
+
name: "listStorageBuckets",
|
|
4405
|
+
method: "POST",
|
|
4406
|
+
path: "/storage/buckets/list",
|
|
4407
|
+
requestType: "Omit<StorageObjectBaseRequest, 'bucket'>",
|
|
4408
|
+
responseEnvelope: "athena",
|
|
4409
|
+
responseType: "Record<string, unknown>"
|
|
4410
|
+
},
|
|
4411
|
+
{
|
|
4412
|
+
name: "createStorageBucket",
|
|
4413
|
+
method: "POST",
|
|
4414
|
+
path: "/storage/buckets/create",
|
|
4415
|
+
requestType: "StorageObjectBaseRequest",
|
|
4416
|
+
responseEnvelope: "athena",
|
|
4417
|
+
responseType: "Record<string, unknown>"
|
|
4418
|
+
},
|
|
4419
|
+
{
|
|
4420
|
+
name: "deleteStorageBucket",
|
|
4421
|
+
method: "POST",
|
|
4422
|
+
path: "/storage/buckets/delete",
|
|
4423
|
+
requestType: "StorageObjectBaseRequest",
|
|
4424
|
+
responseEnvelope: "athena",
|
|
4425
|
+
responseType: "Record<string, unknown>"
|
|
4426
|
+
},
|
|
4427
|
+
{
|
|
4428
|
+
name: "getStorageBucketLifecycle",
|
|
4429
|
+
method: "POST",
|
|
4430
|
+
path: "/storage/buckets/lifecycle",
|
|
4431
|
+
requestType: "StorageBucketLifecycleRequest",
|
|
4432
|
+
responseEnvelope: "athena",
|
|
4433
|
+
responseType: "Record<string, unknown>"
|
|
4434
|
+
},
|
|
4435
|
+
{
|
|
4436
|
+
name: "setStorageBucketLifecycle",
|
|
4437
|
+
method: "POST",
|
|
4438
|
+
path: "/storage/buckets/lifecycle/set",
|
|
4439
|
+
requestType: "StorageSetBucketLifecycleRequest",
|
|
4440
|
+
responseEnvelope: "athena",
|
|
4441
|
+
responseType: "Record<string, unknown>"
|
|
4442
|
+
},
|
|
4443
|
+
{
|
|
4444
|
+
name: "deleteStorageBucketLifecycle",
|
|
4445
|
+
method: "POST",
|
|
4446
|
+
path: "/storage/buckets/lifecycle/delete",
|
|
4447
|
+
requestType: "StorageBucketLifecycleRequest",
|
|
4448
|
+
responseEnvelope: "athena",
|
|
4449
|
+
responseType: "Record<string, unknown>"
|
|
4450
|
+
},
|
|
4451
|
+
{
|
|
4452
|
+
name: "getStorageBucketPolicy",
|
|
4453
|
+
method: "POST",
|
|
4454
|
+
path: "/storage/buckets/policy",
|
|
4455
|
+
requestType: "StorageBucketPolicyRequest",
|
|
4456
|
+
responseEnvelope: "athena",
|
|
4457
|
+
responseType: "Record<string, unknown>"
|
|
4458
|
+
},
|
|
4459
|
+
{
|
|
4460
|
+
name: "setStorageBucketPolicy",
|
|
4461
|
+
method: "POST",
|
|
4462
|
+
path: "/storage/buckets/policy/set",
|
|
4463
|
+
requestType: "StorageSetBucketPolicyRequest",
|
|
4464
|
+
responseEnvelope: "athena",
|
|
4465
|
+
responseType: "Record<string, unknown>"
|
|
4466
|
+
},
|
|
4467
|
+
{
|
|
4468
|
+
name: "deleteStorageBucketPolicy",
|
|
4469
|
+
method: "POST",
|
|
4470
|
+
path: "/storage/buckets/policy/delete",
|
|
4471
|
+
requestType: "StorageBucketPolicyRequest",
|
|
4472
|
+
responseEnvelope: "athena",
|
|
4473
|
+
responseType: "Record<string, unknown>"
|
|
4474
|
+
},
|
|
4475
|
+
{
|
|
4476
|
+
name: "getStorageBucketPublicAccess",
|
|
4477
|
+
method: "POST",
|
|
4478
|
+
path: "/storage/buckets/public-access",
|
|
4479
|
+
requestType: "StoragePublicAccessBlockRequest",
|
|
4480
|
+
responseEnvelope: "athena",
|
|
4481
|
+
responseType: "Record<string, unknown>"
|
|
4482
|
+
},
|
|
4483
|
+
{
|
|
4484
|
+
name: "setStorageBucketPublicAccess",
|
|
4485
|
+
method: "POST",
|
|
4486
|
+
path: "/storage/buckets/public-access/set",
|
|
4487
|
+
requestType: "StorageSetPublicAccessBlockRequest",
|
|
4488
|
+
responseEnvelope: "athena",
|
|
4489
|
+
responseType: "Record<string, unknown>"
|
|
4490
|
+
},
|
|
4491
|
+
{
|
|
4492
|
+
name: "deleteStorageBucketPublicAccess",
|
|
4493
|
+
method: "POST",
|
|
4494
|
+
path: "/storage/buckets/public-access/delete",
|
|
4495
|
+
requestType: "StoragePublicAccessBlockRequest",
|
|
4496
|
+
responseEnvelope: "athena",
|
|
4497
|
+
responseType: "Record<string, unknown>"
|
|
4498
|
+
},
|
|
4499
|
+
{
|
|
4500
|
+
name: "getStorageBucketCors",
|
|
4501
|
+
method: "POST",
|
|
4502
|
+
path: "/storage/buckets/cors",
|
|
4503
|
+
requestType: "StorageBucketCorsRequest",
|
|
4504
|
+
responseEnvelope: "athena",
|
|
4505
|
+
responseType: "Record<string, unknown>"
|
|
4506
|
+
},
|
|
4507
|
+
{
|
|
4508
|
+
name: "setStorageBucketCors",
|
|
4509
|
+
method: "POST",
|
|
4510
|
+
path: "/storage/buckets/cors/set",
|
|
4511
|
+
requestType: "StorageSetBucketCorsRequest",
|
|
4512
|
+
responseEnvelope: "athena",
|
|
4513
|
+
responseType: "Record<string, unknown>"
|
|
3805
4514
|
},
|
|
3806
4515
|
{
|
|
3807
|
-
name: "
|
|
3808
|
-
method: "
|
|
3809
|
-
path: "/storage/
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
responseType: "Response",
|
|
3814
|
-
binary: true
|
|
4516
|
+
name: "deleteStorageBucketCors",
|
|
4517
|
+
method: "POST",
|
|
4518
|
+
path: "/storage/buckets/cors/delete",
|
|
4519
|
+
requestType: "StorageBucketCorsRequest",
|
|
4520
|
+
responseEnvelope: "athena",
|
|
4521
|
+
responseType: "Record<string, unknown>"
|
|
3815
4522
|
},
|
|
3816
4523
|
{
|
|
3817
|
-
name: "
|
|
3818
|
-
method: "
|
|
3819
|
-
path: "/storage/
|
|
3820
|
-
|
|
3821
|
-
requestType: "UpdateStorageFileRequest",
|
|
4524
|
+
name: "createStorageMultipartUpload",
|
|
4525
|
+
method: "POST",
|
|
4526
|
+
path: "/storage/multipart/create",
|
|
4527
|
+
requestType: "StorageMultipartCreateRequest",
|
|
3822
4528
|
responseEnvelope: "athena",
|
|
3823
|
-
responseType: "
|
|
4529
|
+
responseType: "Record<string, unknown>"
|
|
3824
4530
|
},
|
|
3825
4531
|
{
|
|
3826
|
-
name: "
|
|
3827
|
-
method: "
|
|
3828
|
-
path: "/storage/
|
|
3829
|
-
|
|
4532
|
+
name: "signStorageMultipartPart",
|
|
4533
|
+
method: "POST",
|
|
4534
|
+
path: "/storage/multipart/sign-part",
|
|
4535
|
+
requestType: "StorageMultipartSignPartRequest",
|
|
3830
4536
|
responseEnvelope: "athena",
|
|
3831
|
-
responseType: "
|
|
4537
|
+
responseType: "Record<string, unknown>"
|
|
3832
4538
|
},
|
|
3833
4539
|
{
|
|
3834
|
-
name: "
|
|
3835
|
-
method: "
|
|
3836
|
-
path: "/storage/
|
|
3837
|
-
|
|
3838
|
-
requestType: "SetStorageFileVisibilityRequest",
|
|
4540
|
+
name: "completeStorageMultipartUpload",
|
|
4541
|
+
method: "POST",
|
|
4542
|
+
path: "/storage/multipart/complete",
|
|
4543
|
+
requestType: "StorageMultipartCompleteRequest",
|
|
3839
4544
|
responseEnvelope: "athena",
|
|
3840
4545
|
responseType: "StorageFileMutationResponse"
|
|
3841
4546
|
},
|
|
3842
4547
|
{
|
|
3843
|
-
name: "
|
|
4548
|
+
name: "abortStorageMultipartUpload",
|
|
3844
4549
|
method: "POST",
|
|
3845
|
-
path: "/storage/
|
|
3846
|
-
requestType: "
|
|
4550
|
+
path: "/storage/multipart/abort",
|
|
4551
|
+
requestType: "StorageMultipartAbortRequest",
|
|
3847
4552
|
responseEnvelope: "athena",
|
|
3848
|
-
responseType: "
|
|
4553
|
+
responseType: "Record<string, unknown>"
|
|
3849
4554
|
},
|
|
3850
4555
|
{
|
|
3851
|
-
name: "
|
|
4556
|
+
name: "listStorageMultipartParts",
|
|
3852
4557
|
method: "POST",
|
|
3853
|
-
path: "/storage/
|
|
3854
|
-
requestType: "
|
|
4558
|
+
path: "/storage/multipart/list-parts",
|
|
4559
|
+
requestType: "StorageMultipartListPartsRequest",
|
|
3855
4560
|
responseEnvelope: "athena",
|
|
3856
|
-
responseType: "
|
|
4561
|
+
responseType: "Record<string, unknown>"
|
|
4562
|
+
},
|
|
4563
|
+
{
|
|
4564
|
+
name: "listStorageAuditEvents",
|
|
4565
|
+
method: "POST",
|
|
4566
|
+
path: "/storage/audit/list",
|
|
4567
|
+
requestType: "StorageAuditQueryRequest",
|
|
4568
|
+
responseEnvelope: "athena",
|
|
4569
|
+
responseType: "StorageAuditListResponse"
|
|
3857
4570
|
}
|
|
3858
4571
|
]
|
|
3859
4572
|
};
|
|
@@ -4314,7 +5027,7 @@ async function putPresignedUploadBody(uploadUrl, uploadHeaders, body, options) {
|
|
|
4314
5027
|
return fetch(uploadUrl, init);
|
|
4315
5028
|
}
|
|
4316
5029
|
function attachManagedUpload(upload) {
|
|
4317
|
-
const headers = {};
|
|
5030
|
+
const headers = { ...upload.headers ?? {} };
|
|
4318
5031
|
return {
|
|
4319
5032
|
...upload,
|
|
4320
5033
|
method: "PUT",
|
|
@@ -4360,7 +5073,12 @@ function normalizeUploadUrlRequest(input) {
|
|
|
4360
5073
|
file_id: input.file_id ?? input.fileId,
|
|
4361
5074
|
public: input.public,
|
|
4362
5075
|
visibility: input.visibility,
|
|
4363
|
-
metadata: input.metadata
|
|
5076
|
+
metadata: input.metadata,
|
|
5077
|
+
server_side_encryption: input.server_side_encryption,
|
|
5078
|
+
sse: input.sse,
|
|
5079
|
+
ssekms_key_id: input.ssekms_key_id,
|
|
5080
|
+
kms_key_id: input.kms_key_id,
|
|
5081
|
+
bucket_key_enabled: input.bucket_key_enabled
|
|
4364
5082
|
};
|
|
4365
5083
|
}
|
|
4366
5084
|
async function callStorageUploadBinaryEndpoint(gateway, endpoint, body, options, runtimeOptions) {
|
|
@@ -4511,6 +5229,12 @@ function createStorageModule(gateway, runtimeOptions) {
|
|
|
4511
5229
|
options,
|
|
4512
5230
|
resolvedRuntimeOptions
|
|
4513
5231
|
);
|
|
5232
|
+
const callStorageFileVisibility = (fileId, method, input, options) => callAthena2(
|
|
5233
|
+
withPathParam("/storage/files/{file_id}/visibility", "file_id", fileId),
|
|
5234
|
+
method,
|
|
5235
|
+
input,
|
|
5236
|
+
options
|
|
5237
|
+
);
|
|
4514
5238
|
const base = {
|
|
4515
5239
|
listStorageCatalogs(options) {
|
|
4516
5240
|
return callRaw("/storage/catalogs", "GET", void 0, options);
|
|
@@ -4560,7 +5284,7 @@ function createStorageModule(gateway, runtimeOptions) {
|
|
|
4560
5284
|
return callAthena2(withPathParam("/storage/files/{file_id}", "file_id", fileId), "DELETE", void 0, options);
|
|
4561
5285
|
},
|
|
4562
5286
|
setStorageFileVisibility(fileId, input, options) {
|
|
4563
|
-
return
|
|
5287
|
+
return callStorageFileVisibility(fileId, "PATCH", input, options);
|
|
4564
5288
|
},
|
|
4565
5289
|
deleteStorageFolder(input, options) {
|
|
4566
5290
|
return callAthena2("/storage/folders/delete", "POST", input, options);
|
|
@@ -4632,13 +5356,62 @@ function createStorageModule(gateway, runtimeOptions) {
|
|
|
4632
5356
|
publicUrl(fileId, options) {
|
|
4633
5357
|
return callAthena2(withPathParam("/storage/files/{file_id}/public-url", "file_id", fileId), "GET", void 0, options);
|
|
4634
5358
|
},
|
|
5359
|
+
proxyUrl(fileId, query, options) {
|
|
5360
|
+
const path = appendQuery(
|
|
5361
|
+
withPathParam("/storage/files/{file_id}/proxy-url", "file_id", fileId),
|
|
5362
|
+
query
|
|
5363
|
+
);
|
|
5364
|
+
return callAthena2(path, "GET", void 0, options);
|
|
5365
|
+
},
|
|
4635
5366
|
proxy(fileId, query, options) {
|
|
4636
5367
|
return base.getStorageFileProxy(fileId, query, options);
|
|
4637
5368
|
},
|
|
4638
|
-
|
|
5369
|
+
versions(fileId, options) {
|
|
5370
|
+
return callAthena2(withPathParam("/storage/files/{file_id}/versions", "file_id", fileId), "GET", void 0, options);
|
|
5371
|
+
},
|
|
5372
|
+
restoreVersion(fileId, versionId, options) {
|
|
5373
|
+
return callAthena2(
|
|
5374
|
+
withPathParam(
|
|
5375
|
+
withPathParam("/storage/files/{file_id}/versions/{version_id}/restore", "file_id", fileId),
|
|
5376
|
+
"version_id",
|
|
5377
|
+
versionId
|
|
5378
|
+
),
|
|
5379
|
+
"POST",
|
|
5380
|
+
{},
|
|
5381
|
+
options
|
|
5382
|
+
);
|
|
5383
|
+
},
|
|
5384
|
+
deleteVersion(fileId, versionId, options) {
|
|
5385
|
+
return callAthena2(
|
|
5386
|
+
withPathParam(
|
|
5387
|
+
withPathParam("/storage/files/{file_id}/versions/{version_id}", "file_id", fileId),
|
|
5388
|
+
"version_id",
|
|
5389
|
+
versionId
|
|
5390
|
+
),
|
|
5391
|
+
"DELETE",
|
|
5392
|
+
void 0,
|
|
5393
|
+
options
|
|
5394
|
+
);
|
|
5395
|
+
},
|
|
5396
|
+
retention: {
|
|
5397
|
+
get(fileId, query, options) {
|
|
5398
|
+
const path = appendQuery(
|
|
5399
|
+
withPathParam("/storage/files/{file_id}/retention", "file_id", fileId),
|
|
5400
|
+
query
|
|
5401
|
+
);
|
|
5402
|
+
return callAthena2(path, "GET", void 0, options);
|
|
5403
|
+
},
|
|
4639
5404
|
set(fileId, input, options) {
|
|
5405
|
+
return callAthena2(withPathParam("/storage/files/{file_id}/retention", "file_id", fileId), "POST", input, options);
|
|
5406
|
+
}
|
|
5407
|
+
},
|
|
5408
|
+
visibility: {
|
|
5409
|
+
update(fileId, input, options) {
|
|
4640
5410
|
return base.setStorageFileVisibility(fileId, input, options);
|
|
4641
5411
|
},
|
|
5412
|
+
set(fileId, input, options) {
|
|
5413
|
+
return callStorageFileVisibility(fileId, "POST", input, options);
|
|
5414
|
+
},
|
|
4642
5415
|
setMany(input, options) {
|
|
4643
5416
|
return callAthena2("/storage/files/visibility-many", "POST", input, options);
|
|
4644
5417
|
}
|
|
@@ -4733,6 +5506,18 @@ function createStorageModule(gateway, runtimeOptions) {
|
|
|
4733
5506
|
uploadUrl(input, options) {
|
|
4734
5507
|
return callAthena2("/storage/objects/upload-url", "POST", input, options);
|
|
4735
5508
|
},
|
|
5509
|
+
versions(input, options) {
|
|
5510
|
+
return callAthena2("/storage/objects/versions", "POST", input, options);
|
|
5511
|
+
},
|
|
5512
|
+
restoreVersion(input, options) {
|
|
5513
|
+
return callAthena2("/storage/objects/versions/restore", "POST", input, options);
|
|
5514
|
+
},
|
|
5515
|
+
deleteVersion(input, options) {
|
|
5516
|
+
return callAthena2("/storage/objects/versions/delete", "POST", input, options);
|
|
5517
|
+
},
|
|
5518
|
+
postPolicy(input, options) {
|
|
5519
|
+
return callAthena2("/storage/objects/post-policy", "POST", input, options);
|
|
5520
|
+
},
|
|
4736
5521
|
folder: objectFolder
|
|
4737
5522
|
};
|
|
4738
5523
|
const bucket = {
|
|
@@ -4745,6 +5530,39 @@ function createStorageModule(gateway, runtimeOptions) {
|
|
|
4745
5530
|
delete(input, options) {
|
|
4746
5531
|
return callAthena2("/storage/buckets/delete", "POST", input, options);
|
|
4747
5532
|
},
|
|
5533
|
+
lifecycle: {
|
|
5534
|
+
get(input, options) {
|
|
5535
|
+
return callAthena2("/storage/buckets/lifecycle", "POST", input, options);
|
|
5536
|
+
},
|
|
5537
|
+
set(input, options) {
|
|
5538
|
+
return callAthena2("/storage/buckets/lifecycle/set", "POST", input, options);
|
|
5539
|
+
},
|
|
5540
|
+
delete(input, options) {
|
|
5541
|
+
return callAthena2("/storage/buckets/lifecycle/delete", "POST", input, options);
|
|
5542
|
+
}
|
|
5543
|
+
},
|
|
5544
|
+
policy: {
|
|
5545
|
+
get(input, options) {
|
|
5546
|
+
return callAthena2("/storage/buckets/policy", "POST", input, options);
|
|
5547
|
+
},
|
|
5548
|
+
set(input, options) {
|
|
5549
|
+
return callAthena2("/storage/buckets/policy/set", "POST", input, options);
|
|
5550
|
+
},
|
|
5551
|
+
delete(input, options) {
|
|
5552
|
+
return callAthena2("/storage/buckets/policy/delete", "POST", input, options);
|
|
5553
|
+
}
|
|
5554
|
+
},
|
|
5555
|
+
publicAccess: {
|
|
5556
|
+
get(input, options) {
|
|
5557
|
+
return callAthena2("/storage/buckets/public-access", "POST", input, options);
|
|
5558
|
+
},
|
|
5559
|
+
set(input, options) {
|
|
5560
|
+
return callAthena2("/storage/buckets/public-access/set", "POST", input, options);
|
|
5561
|
+
},
|
|
5562
|
+
delete(input, options) {
|
|
5563
|
+
return callAthena2("/storage/buckets/public-access/delete", "POST", input, options);
|
|
5564
|
+
}
|
|
5565
|
+
},
|
|
4748
5566
|
cors: {
|
|
4749
5567
|
get(input, options) {
|
|
4750
5568
|
return callAthena2("/storage/buckets/cors", "POST", input, options);
|
|
@@ -4846,6 +5664,9 @@ var AthenaClientBuilderImpl = class {
|
|
|
4846
5664
|
apiKey;
|
|
4847
5665
|
backendConfig = DEFAULT_BACKEND;
|
|
4848
5666
|
clientName;
|
|
5667
|
+
defaultUserId;
|
|
5668
|
+
defaultOrganizationId;
|
|
5669
|
+
forceNoCacheEnabled = false;
|
|
4849
5670
|
defaultHeaders;
|
|
4850
5671
|
authConfig;
|
|
4851
5672
|
dbUrlOverride;
|
|
@@ -4894,6 +5715,15 @@ var AthenaClientBuilderImpl = class {
|
|
|
4894
5715
|
if (options.client !== void 0) {
|
|
4895
5716
|
this.clientName = options.client;
|
|
4896
5717
|
}
|
|
5718
|
+
if (options.userId !== void 0) {
|
|
5719
|
+
this.defaultUserId = options.userId;
|
|
5720
|
+
}
|
|
5721
|
+
if (options.organizationId !== void 0) {
|
|
5722
|
+
this.defaultOrganizationId = options.organizationId;
|
|
5723
|
+
}
|
|
5724
|
+
if (options.forceNoCache !== void 0) {
|
|
5725
|
+
this.forceNoCacheEnabled = options.forceNoCache;
|
|
5726
|
+
}
|
|
4897
5727
|
if (options.backend !== void 0) {
|
|
4898
5728
|
this.backendConfig = toBackendConfig(options.backend);
|
|
4899
5729
|
}
|
|
@@ -4948,6 +5778,9 @@ var AthenaClientBuilderImpl = class {
|
|
|
4948
5778
|
url: this.rootUrl,
|
|
4949
5779
|
key: this.apiKey,
|
|
4950
5780
|
client: this.clientName,
|
|
5781
|
+
userId: this.defaultUserId,
|
|
5782
|
+
organizationId: this.defaultOrganizationId,
|
|
5783
|
+
forceNoCache: this.forceNoCacheEnabled,
|
|
4951
5784
|
backend: this.backendConfig,
|
|
4952
5785
|
headers: this.defaultHeaders,
|
|
4953
5786
|
db: this.dbUrlOverride ? { url: this.dbUrlOverride } : void 0,
|
|
@@ -7490,6 +8323,83 @@ function createQueryBuilder(client, formatGatewayResult, experimental, tracer) {
|
|
|
7490
8323
|
);
|
|
7491
8324
|
};
|
|
7492
8325
|
}
|
|
8326
|
+
var ATHENA_ENV_URL_KEYS = ["ATHENA_URL", "NEXT_PUBLIC_ATHENA_URL"];
|
|
8327
|
+
var ATHENA_ENV_GATEWAY_URL_KEYS = [
|
|
8328
|
+
"ATHENA_DB_URL",
|
|
8329
|
+
"ATHENA_GATEWAY_URL",
|
|
8330
|
+
"NEXT_PUBLIC_ATHENA_DB_API_URL"
|
|
8331
|
+
];
|
|
8332
|
+
var ATHENA_ENV_AUTH_URL_KEYS = ["ATHENA_AUTH_URL", "NEXT_PUBLIC_ATHENA_AUTH_URL"];
|
|
8333
|
+
var ATHENA_ENV_STORAGE_URL_KEYS = ["ATHENA_STORAGE_URL", "NEXT_PUBLIC_ATHENA_STORAGE_URL"];
|
|
8334
|
+
var ATHENA_ENV_KEY_KEYS = [
|
|
8335
|
+
"ATHENA_API_KEY",
|
|
8336
|
+
"NEXT_PUBLIC_ATHENA_API_KEY",
|
|
8337
|
+
"ATHENA_GATEWAY_API_KEY",
|
|
8338
|
+
"X_API_KEY"
|
|
8339
|
+
];
|
|
8340
|
+
var ATHENA_ENV_CLIENT_KEYS = ["ATHENA_CLIENT", "NEXT_PUBLIC_ATHENA_CLIENT"];
|
|
8341
|
+
function normalizeOptionalString(value) {
|
|
8342
|
+
if (typeof value !== "string") {
|
|
8343
|
+
return void 0;
|
|
8344
|
+
}
|
|
8345
|
+
const normalizedValue = value.trim();
|
|
8346
|
+
return normalizedValue ? normalizedValue : void 0;
|
|
8347
|
+
}
|
|
8348
|
+
function readFirstEnvValue(env, keys) {
|
|
8349
|
+
for (const key of keys) {
|
|
8350
|
+
const value = normalizeOptionalString(env[key]);
|
|
8351
|
+
if (value) {
|
|
8352
|
+
return value;
|
|
8353
|
+
}
|
|
8354
|
+
}
|
|
8355
|
+
return void 0;
|
|
8356
|
+
}
|
|
8357
|
+
function readHeaderBagValue(headers, targetKey) {
|
|
8358
|
+
if (!headers) {
|
|
8359
|
+
return void 0;
|
|
8360
|
+
}
|
|
8361
|
+
if (typeof headers.get === "function") {
|
|
8362
|
+
return normalizeOptionalString(headers.get(targetKey));
|
|
8363
|
+
}
|
|
8364
|
+
const normalizedTargetKey = targetKey.toLowerCase();
|
|
8365
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
8366
|
+
if (key.toLowerCase() !== normalizedTargetKey) {
|
|
8367
|
+
continue;
|
|
8368
|
+
}
|
|
8369
|
+
if (typeof value === "string") {
|
|
8370
|
+
return normalizeOptionalString(value);
|
|
8371
|
+
}
|
|
8372
|
+
return void 0;
|
|
8373
|
+
}
|
|
8374
|
+
return void 0;
|
|
8375
|
+
}
|
|
8376
|
+
function resolveSessionContextOptions(session, options) {
|
|
8377
|
+
const sessionToken = normalizeOptionalString(session?.session?.token);
|
|
8378
|
+
const requestCookie = readHeaderBagValue(options?.requestHeaders, "cookie") ?? readHeaderBagValue(options?.headers, "cookie");
|
|
8379
|
+
const authInput = options?.auth;
|
|
8380
|
+
const resolvedUserId = options?.userId !== void 0 ? options.userId : session?.user?.id;
|
|
8381
|
+
const resolvedOrganizationId = options?.organizationId !== void 0 ? options.organizationId : session?.session?.activeOrganizationId;
|
|
8382
|
+
const resolvedBearerToken = authInput?.bearerToken !== void 0 ? authInput.bearerToken : sessionToken;
|
|
8383
|
+
const resolvedSessionToken = authInput?.sessionToken !== void 0 ? authInput.sessionToken : sessionToken;
|
|
8384
|
+
const resolvedCookie = authInput?.cookie !== void 0 ? authInput.cookie : requestCookie;
|
|
8385
|
+
const auth = authInput !== void 0 || resolvedBearerToken !== void 0 || resolvedSessionToken !== void 0 || resolvedCookie !== void 0 ? {
|
|
8386
|
+
...authInput ?? {},
|
|
8387
|
+
...resolvedBearerToken !== void 0 ? { bearerToken: resolvedBearerToken } : {},
|
|
8388
|
+
...resolvedSessionToken !== void 0 ? { sessionToken: resolvedSessionToken } : {},
|
|
8389
|
+
...resolvedCookie !== void 0 ? { cookie: resolvedCookie } : {},
|
|
8390
|
+
headers: authInput?.headers ? { ...authInput.headers } : void 0
|
|
8391
|
+
} : void 0;
|
|
8392
|
+
if (resolvedUserId === void 0 && resolvedOrganizationId === void 0 && options?.forceNoCache === void 0 && !options?.headers && !auth) {
|
|
8393
|
+
return void 0;
|
|
8394
|
+
}
|
|
8395
|
+
return {
|
|
8396
|
+
userId: resolvedUserId,
|
|
8397
|
+
organizationId: resolvedOrganizationId,
|
|
8398
|
+
forceNoCache: options?.forceNoCache,
|
|
8399
|
+
headers: options?.headers ? { ...options.headers } : void 0,
|
|
8400
|
+
auth
|
|
8401
|
+
};
|
|
8402
|
+
}
|
|
7493
8403
|
function resolveClientServiceBaseUrl(value, label) {
|
|
7494
8404
|
if (value === void 0 || value === null) {
|
|
7495
8405
|
return void 0;
|
|
@@ -7511,21 +8421,143 @@ function resolveServiceUrls(config) {
|
|
|
7511
8421
|
storageUrl: resolveServiceUrlOverride(config.storage?.url, "Athena storage base URL") ?? resolveServiceUrlOverride(config.storageUrl, "Athena storage base URL") ?? (baseUrl ? appendServicePath(baseUrl, "storage") : void 0)
|
|
7512
8422
|
};
|
|
7513
8423
|
}
|
|
8424
|
+
function resolveOptionalClientName(value) {
|
|
8425
|
+
if (value === void 0 || value === null) {
|
|
8426
|
+
return void 0;
|
|
8427
|
+
}
|
|
8428
|
+
const normalizedValue = value.trim();
|
|
8429
|
+
return normalizedValue ? normalizedValue : void 0;
|
|
8430
|
+
}
|
|
8431
|
+
function resolveRequiredClientApiKey(value) {
|
|
8432
|
+
if (value === void 0 || value === null) {
|
|
8433
|
+
throw new Error(
|
|
8434
|
+
"Athena API key is required. Pass createClient(url, key) with a real API key, or set key in the config object."
|
|
8435
|
+
);
|
|
8436
|
+
}
|
|
8437
|
+
const normalizedValue = value.trim();
|
|
8438
|
+
if (!normalizedValue) {
|
|
8439
|
+
throw new Error(
|
|
8440
|
+
"Athena API key is required. Pass createClient(url, key) with a real API key, or set key in the config object."
|
|
8441
|
+
);
|
|
8442
|
+
}
|
|
8443
|
+
return normalizedValue;
|
|
8444
|
+
}
|
|
8445
|
+
function hasHeaderIgnoreCase(headers, targetKey) {
|
|
8446
|
+
const normalizedTargetKey = targetKey.toLowerCase();
|
|
8447
|
+
return Object.keys(headers).some((key) => key.toLowerCase() === normalizedTargetKey);
|
|
8448
|
+
}
|
|
8449
|
+
function mergeClientHeaders(current, next) {
|
|
8450
|
+
if (!current && !next) {
|
|
8451
|
+
return void 0;
|
|
8452
|
+
}
|
|
8453
|
+
return {
|
|
8454
|
+
...current ?? {},
|
|
8455
|
+
...next ?? {}
|
|
8456
|
+
};
|
|
8457
|
+
}
|
|
8458
|
+
function mergeDefinedObject(current, next) {
|
|
8459
|
+
if (!current && !next) {
|
|
8460
|
+
return void 0;
|
|
8461
|
+
}
|
|
8462
|
+
const merged = {
|
|
8463
|
+
...current ?? {}
|
|
8464
|
+
};
|
|
8465
|
+
const mutableMerged = merged;
|
|
8466
|
+
for (const [key, value] of Object.entries(next ?? {})) {
|
|
8467
|
+
if (value !== void 0) {
|
|
8468
|
+
mutableMerged[key] = value;
|
|
8469
|
+
}
|
|
8470
|
+
}
|
|
8471
|
+
return merged;
|
|
8472
|
+
}
|
|
8473
|
+
function mergeAuthClientOptions(current, next) {
|
|
8474
|
+
const merged = mergeDefinedObject(current, next);
|
|
8475
|
+
if (!merged) {
|
|
8476
|
+
return void 0;
|
|
8477
|
+
}
|
|
8478
|
+
const mergedHeaders = mergeClientHeaders(current?.headers, next?.headers);
|
|
8479
|
+
if (mergedHeaders) {
|
|
8480
|
+
merged.headers = mergedHeaders;
|
|
8481
|
+
}
|
|
8482
|
+
return merged;
|
|
8483
|
+
}
|
|
8484
|
+
function mergeServiceUrlOverrides(current, next) {
|
|
8485
|
+
return mergeDefinedObject(current, next);
|
|
8486
|
+
}
|
|
8487
|
+
function toClientContextOverrides(context) {
|
|
8488
|
+
if (!context) {
|
|
8489
|
+
return void 0;
|
|
8490
|
+
}
|
|
8491
|
+
return {
|
|
8492
|
+
userId: context.userId,
|
|
8493
|
+
organizationId: context.organizationId,
|
|
8494
|
+
forceNoCache: context.forceNoCache,
|
|
8495
|
+
headers: context.headers,
|
|
8496
|
+
auth: context.auth ? {
|
|
8497
|
+
...context.auth,
|
|
8498
|
+
headers: context.auth.headers ? { ...context.auth.headers } : void 0
|
|
8499
|
+
} : void 0
|
|
8500
|
+
};
|
|
8501
|
+
}
|
|
8502
|
+
function mergeClientOverrideOptions(base, overrides) {
|
|
8503
|
+
if (!overrides) {
|
|
8504
|
+
return {
|
|
8505
|
+
...base,
|
|
8506
|
+
headers: base.headers ? { ...base.headers } : void 0,
|
|
8507
|
+
auth: base.auth ? {
|
|
8508
|
+
...base.auth,
|
|
8509
|
+
headers: base.auth.headers ? { ...base.auth.headers } : void 0
|
|
8510
|
+
} : void 0,
|
|
8511
|
+
db: base.db ? { ...base.db } : void 0,
|
|
8512
|
+
gateway: base.gateway ? { ...base.gateway } : void 0,
|
|
8513
|
+
storage: base.storage ? { ...base.storage } : void 0
|
|
8514
|
+
};
|
|
8515
|
+
}
|
|
8516
|
+
const merged = mergeDefinedObject(base, overrides) ?? { ...base };
|
|
8517
|
+
return {
|
|
8518
|
+
...merged,
|
|
8519
|
+
headers: mergeClientHeaders(base.headers, overrides.headers),
|
|
8520
|
+
auth: mergeAuthClientOptions(base.auth, overrides.auth),
|
|
8521
|
+
db: mergeServiceUrlOverrides(base.db, overrides.db),
|
|
8522
|
+
gateway: mergeServiceUrlOverrides(base.gateway, overrides.gateway),
|
|
8523
|
+
storage: mergeServiceUrlOverrides(base.storage, overrides.storage)
|
|
8524
|
+
};
|
|
8525
|
+
}
|
|
7514
8526
|
function normalizeAuthClientConfig(auth, defaultBaseUrl) {
|
|
7515
8527
|
if (!auth && defaultBaseUrl === void 0) {
|
|
7516
8528
|
return void 0;
|
|
7517
8529
|
}
|
|
7518
|
-
const {
|
|
8530
|
+
const {
|
|
8531
|
+
url,
|
|
8532
|
+
baseUrl,
|
|
8533
|
+
apiKey,
|
|
8534
|
+
bearerToken,
|
|
8535
|
+
cookie,
|
|
8536
|
+
sessionToken,
|
|
8537
|
+
...rest
|
|
8538
|
+
} = auth ?? {};
|
|
7519
8539
|
const normalized = {
|
|
7520
8540
|
...rest
|
|
7521
8541
|
};
|
|
7522
8542
|
const resolvedBaseUrl = resolveClientServiceBaseUrl(
|
|
7523
|
-
url ??
|
|
8543
|
+
url ?? baseUrl ?? defaultBaseUrl,
|
|
7524
8544
|
"Athena auth base URL"
|
|
7525
8545
|
);
|
|
7526
8546
|
if (resolvedBaseUrl !== void 0) {
|
|
7527
8547
|
normalized.baseUrl = resolvedBaseUrl;
|
|
7528
8548
|
}
|
|
8549
|
+
if (typeof apiKey === "string") {
|
|
8550
|
+
normalized.apiKey = apiKey;
|
|
8551
|
+
}
|
|
8552
|
+
if (typeof bearerToken === "string") {
|
|
8553
|
+
normalized.bearerToken = bearerToken;
|
|
8554
|
+
}
|
|
8555
|
+
if (typeof cookie === "string") {
|
|
8556
|
+
normalized.cookie = cookie;
|
|
8557
|
+
}
|
|
8558
|
+
if (typeof sessionToken === "string") {
|
|
8559
|
+
normalized.sessionToken = sessionToken;
|
|
8560
|
+
}
|
|
7529
8561
|
return normalized;
|
|
7530
8562
|
}
|
|
7531
8563
|
function resolveCreateClientConfig(config) {
|
|
@@ -7537,8 +8569,11 @@ function resolveCreateClientConfig(config) {
|
|
|
7537
8569
|
}
|
|
7538
8570
|
return {
|
|
7539
8571
|
baseUrl: resolvedUrls.dbUrl,
|
|
7540
|
-
apiKey: config.key,
|
|
7541
|
-
client: config.client,
|
|
8572
|
+
apiKey: resolveRequiredClientApiKey(config.key),
|
|
8573
|
+
client: resolveOptionalClientName(config.client),
|
|
8574
|
+
userId: config.userId,
|
|
8575
|
+
organizationId: config.organizationId,
|
|
8576
|
+
forceNoCache: config.forceNoCache,
|
|
7542
8577
|
backend: toBackendConfig(config.backend),
|
|
7543
8578
|
headers: config.headers,
|
|
7544
8579
|
auth: config.auth,
|
|
@@ -7547,23 +8582,39 @@ function resolveCreateClientConfig(config) {
|
|
|
7547
8582
|
experimental: config.experimental
|
|
7548
8583
|
};
|
|
7549
8584
|
}
|
|
7550
|
-
function
|
|
8585
|
+
function createClientFromInput(sourceConfig) {
|
|
8586
|
+
return createClientFromConfig(resolveCreateClientConfig(sourceConfig), sourceConfig);
|
|
8587
|
+
}
|
|
8588
|
+
function createClientFromConfig(config, sourceConfig) {
|
|
8589
|
+
const normalizedAuthConfig = normalizeAuthClientConfig(config.auth, config.authUrl);
|
|
7551
8590
|
const gatewayHeaders = {
|
|
7552
8591
|
...config.headers ?? {}
|
|
7553
8592
|
};
|
|
7554
|
-
if (
|
|
7555
|
-
gatewayHeaders["X-Athena-Auth-Bearer-Token"] =
|
|
8593
|
+
if (normalizedAuthConfig?.bearerToken && !hasHeaderIgnoreCase(gatewayHeaders, "X-Athena-Auth-Bearer-Token")) {
|
|
8594
|
+
gatewayHeaders["X-Athena-Auth-Bearer-Token"] = normalizedAuthConfig.bearerToken;
|
|
8595
|
+
}
|
|
8596
|
+
if (normalizedAuthConfig?.cookie && !hasHeaderIgnoreCase(gatewayHeaders, "Cookie")) {
|
|
8597
|
+
gatewayHeaders.Cookie = normalizedAuthConfig.cookie;
|
|
8598
|
+
}
|
|
8599
|
+
if (normalizedAuthConfig?.sessionToken && !hasHeaderIgnoreCase(gatewayHeaders, "X-Athena-Auth-Session-Token")) {
|
|
8600
|
+
gatewayHeaders["X-Athena-Auth-Session-Token"] = normalizedAuthConfig.sessionToken;
|
|
7556
8601
|
}
|
|
7557
8602
|
const gateway = createAthenaGatewayClient({
|
|
7558
8603
|
baseUrl: config.baseUrl,
|
|
7559
8604
|
apiKey: config.apiKey,
|
|
7560
8605
|
client: config.client,
|
|
8606
|
+
userId: config.userId,
|
|
8607
|
+
organizationId: config.organizationId,
|
|
8608
|
+
forceNoCache: config.forceNoCache,
|
|
7561
8609
|
backend: config.backend,
|
|
7562
8610
|
headers: gatewayHeaders
|
|
7563
8611
|
});
|
|
7564
8612
|
const formatGatewayResult = createResultFormatter(config.experimental);
|
|
7565
8613
|
const queryTracer = createQueryTracer(config.experimental);
|
|
7566
|
-
const auth = createAuthClient(
|
|
8614
|
+
const auth = createAuthClient({
|
|
8615
|
+
...normalizedAuthConfig ?? {},
|
|
8616
|
+
...config.forceNoCache ? { forceNoCache: true } : {}
|
|
8617
|
+
});
|
|
7567
8618
|
function from(tableOrModel, options) {
|
|
7568
8619
|
if (isAthenaModelTarget(tableOrModel)) {
|
|
7569
8620
|
if (options?.schema !== void 0) {
|
|
@@ -7611,17 +8662,45 @@ function createClientFromConfig(config) {
|
|
|
7611
8662
|
queryTracer
|
|
7612
8663
|
);
|
|
7613
8664
|
const db = createDbModule({ from, rpc, query });
|
|
8665
|
+
const withContext = (context) => createClientFromInput(
|
|
8666
|
+
mergeClientOverrideOptions(sourceConfig, toClientContextOverrides(context))
|
|
8667
|
+
);
|
|
8668
|
+
const withSession = (session, options) => createClientFromInput(
|
|
8669
|
+
mergeClientOverrideOptions(
|
|
8670
|
+
sourceConfig,
|
|
8671
|
+
toClientContextOverrides(resolveSessionContextOptions(session, options))
|
|
8672
|
+
)
|
|
8673
|
+
);
|
|
8674
|
+
const authWithOptions = (options) => createClientFromInput(mergeClientOverrideOptions(sourceConfig, options));
|
|
7614
8675
|
const sdkClient = {
|
|
7615
8676
|
from,
|
|
7616
8677
|
db,
|
|
7617
8678
|
rpc,
|
|
7618
8679
|
query,
|
|
7619
8680
|
verifyConnection: gateway.verifyConnection,
|
|
7620
|
-
auth: auth.auth
|
|
8681
|
+
auth: auth.auth,
|
|
8682
|
+
withContext,
|
|
8683
|
+
withSession,
|
|
8684
|
+
withOptions: authWithOptions
|
|
7621
8685
|
};
|
|
7622
8686
|
if (config.experimental?.athenaStorageBackend) {
|
|
8687
|
+
const storageWithContext = (context) => createClientFromInput(
|
|
8688
|
+
mergeClientOverrideOptions(sourceConfig, toClientContextOverrides(context))
|
|
8689
|
+
);
|
|
8690
|
+
const storageWithSession = (session, options) => createClientFromInput(
|
|
8691
|
+
mergeClientOverrideOptions(
|
|
8692
|
+
sourceConfig,
|
|
8693
|
+
toClientContextOverrides(resolveSessionContextOptions(session, options))
|
|
8694
|
+
)
|
|
8695
|
+
);
|
|
8696
|
+
const storageWithOptions = (options) => createClientFromInput(
|
|
8697
|
+
mergeClientOverrideOptions(sourceConfig, options)
|
|
8698
|
+
);
|
|
7623
8699
|
const storageClient = {
|
|
7624
8700
|
...sdkClient,
|
|
8701
|
+
withContext: storageWithContext,
|
|
8702
|
+
withSession: storageWithSession,
|
|
8703
|
+
withOptions: storageWithOptions,
|
|
7625
8704
|
storage: createStorageModule(gateway, {
|
|
7626
8705
|
...config.experimental.storage,
|
|
7627
8706
|
...config.storageUrl ? {
|
|
@@ -7637,38 +8716,42 @@ function createClientFromConfig(config) {
|
|
|
7637
8716
|
var AthenaClient = class {
|
|
7638
8717
|
/** Create a fluent builder for a strongly-typed Athena SDK client. */
|
|
7639
8718
|
static builder() {
|
|
7640
|
-
return createAthenaClientBuilder((config) =>
|
|
7641
|
-
}
|
|
7642
|
-
|
|
7643
|
-
|
|
7644
|
-
const url =
|
|
7645
|
-
const gatewayUrl =
|
|
7646
|
-
const authUrl =
|
|
7647
|
-
const storageUrl =
|
|
7648
|
-
const key =
|
|
8719
|
+
return createAthenaClientBuilder((config) => createClientFromInput(config));
|
|
8720
|
+
}
|
|
8721
|
+
static fromEnvironment(options = {}) {
|
|
8722
|
+
const env = options.env ?? process.env;
|
|
8723
|
+
const url = options.url ?? readFirstEnvValue(env, ATHENA_ENV_URL_KEYS);
|
|
8724
|
+
const gatewayUrl = options.gatewayUrl ?? readFirstEnvValue(env, ATHENA_ENV_GATEWAY_URL_KEYS);
|
|
8725
|
+
const authUrl = options.authUrl ?? readFirstEnvValue(env, ATHENA_ENV_AUTH_URL_KEYS);
|
|
8726
|
+
const storageUrl = options.storageUrl ?? readFirstEnvValue(env, ATHENA_ENV_STORAGE_URL_KEYS);
|
|
8727
|
+
const key = options.key ?? readFirstEnvValue(env, ATHENA_ENV_KEY_KEYS);
|
|
8728
|
+
const client = options.client ?? readFirstEnvValue(env, ATHENA_ENV_CLIENT_KEYS);
|
|
7649
8729
|
if (!url && !gatewayUrl || !key) {
|
|
7650
8730
|
throw new Error(
|
|
7651
|
-
"
|
|
8731
|
+
"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."
|
|
7652
8732
|
);
|
|
7653
8733
|
}
|
|
8734
|
+
const { env: _env, ...clientOptions } = options;
|
|
7654
8735
|
return createClient({
|
|
8736
|
+
...clientOptions,
|
|
7655
8737
|
url,
|
|
7656
8738
|
gatewayUrl,
|
|
7657
8739
|
authUrl,
|
|
7658
8740
|
storageUrl,
|
|
7659
|
-
key
|
|
8741
|
+
key,
|
|
8742
|
+
client
|
|
7660
8743
|
});
|
|
7661
8744
|
}
|
|
7662
8745
|
};
|
|
7663
8746
|
function createClient(configOrUrl, apiKey, options) {
|
|
7664
|
-
if (typeof configOrUrl === "string") {
|
|
7665
|
-
return
|
|
8747
|
+
if (typeof configOrUrl === "string" || configOrUrl === null || configOrUrl === void 0) {
|
|
8748
|
+
return createClientFromInput({
|
|
7666
8749
|
url: configOrUrl,
|
|
7667
8750
|
key: apiKey ?? "",
|
|
7668
8751
|
...options
|
|
7669
|
-
})
|
|
8752
|
+
});
|
|
7670
8753
|
}
|
|
7671
|
-
return
|
|
8754
|
+
return createClientFromInput(configOrUrl);
|
|
7672
8755
|
}
|
|
7673
8756
|
|
|
7674
8757
|
// src/gateway/types.ts
|
|
@@ -8034,6 +9117,9 @@ function createColumnsBuilder(name, mappedName, schemaName, columns) {
|
|
|
8034
9117
|
resolveTableTarget(name, mappedName, normalizedSchemaName);
|
|
8035
9118
|
return createColumnsBuilder(name, mappedName, normalizedSchemaName, columns);
|
|
8036
9119
|
},
|
|
9120
|
+
withoutPrimaryKey() {
|
|
9121
|
+
return finalizeTable(name, mappedName, schemaName, columns, []);
|
|
9122
|
+
},
|
|
8037
9123
|
primaryKey(...keys) {
|
|
8038
9124
|
return finalizeTable(name, mappedName, schemaName, columns, keys);
|
|
8039
9125
|
}
|
|
@@ -8085,6 +9171,59 @@ var TenantHeaderMapper = class {
|
|
|
8085
9171
|
return Object.keys(headers).length > 0 ? headers : void 0;
|
|
8086
9172
|
}
|
|
8087
9173
|
};
|
|
9174
|
+
function normalizeOptionalString2(value) {
|
|
9175
|
+
if (typeof value !== "string") {
|
|
9176
|
+
return void 0;
|
|
9177
|
+
}
|
|
9178
|
+
const normalizedValue = value.trim();
|
|
9179
|
+
return normalizedValue ? normalizedValue : void 0;
|
|
9180
|
+
}
|
|
9181
|
+
function readHeaderBagValue2(headers, targetKey) {
|
|
9182
|
+
if (!headers) {
|
|
9183
|
+
return void 0;
|
|
9184
|
+
}
|
|
9185
|
+
if (typeof headers.get === "function") {
|
|
9186
|
+
return normalizeOptionalString2(headers.get(targetKey));
|
|
9187
|
+
}
|
|
9188
|
+
const normalizedTargetKey = targetKey.toLowerCase();
|
|
9189
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
9190
|
+
if (key.toLowerCase() !== normalizedTargetKey) {
|
|
9191
|
+
continue;
|
|
9192
|
+
}
|
|
9193
|
+
if (typeof value === "string") {
|
|
9194
|
+
return normalizeOptionalString2(value);
|
|
9195
|
+
}
|
|
9196
|
+
return void 0;
|
|
9197
|
+
}
|
|
9198
|
+
return void 0;
|
|
9199
|
+
}
|
|
9200
|
+
function resolveSessionContextOptions2(session, options) {
|
|
9201
|
+
const sessionToken = normalizeOptionalString2(session?.session?.token);
|
|
9202
|
+
const requestCookie = readHeaderBagValue2(options?.requestHeaders, "cookie") ?? readHeaderBagValue2(options?.headers, "cookie");
|
|
9203
|
+
const authInput = options?.auth;
|
|
9204
|
+
const resolvedUserId = options?.userId !== void 0 ? options.userId : session?.user?.id;
|
|
9205
|
+
const resolvedOrganizationId = options?.organizationId !== void 0 ? options.organizationId : session?.session?.activeOrganizationId;
|
|
9206
|
+
const resolvedBearerToken = authInput?.bearerToken !== void 0 ? authInput.bearerToken : sessionToken;
|
|
9207
|
+
const resolvedSessionToken = authInput?.sessionToken !== void 0 ? authInput.sessionToken : sessionToken;
|
|
9208
|
+
const resolvedCookie = authInput?.cookie !== void 0 ? authInput.cookie : requestCookie;
|
|
9209
|
+
const auth = authInput !== void 0 || resolvedBearerToken !== void 0 || resolvedSessionToken !== void 0 || resolvedCookie !== void 0 ? {
|
|
9210
|
+
...authInput ?? {},
|
|
9211
|
+
...resolvedBearerToken !== void 0 ? { bearerToken: resolvedBearerToken } : {},
|
|
9212
|
+
...resolvedSessionToken !== void 0 ? { sessionToken: resolvedSessionToken } : {},
|
|
9213
|
+
...resolvedCookie !== void 0 ? { cookie: resolvedCookie } : {},
|
|
9214
|
+
headers: authInput?.headers ? { ...authInput.headers } : void 0
|
|
9215
|
+
} : void 0;
|
|
9216
|
+
if (resolvedUserId === void 0 && resolvedOrganizationId === void 0 && options?.forceNoCache === void 0 && !options?.headers && !auth) {
|
|
9217
|
+
return void 0;
|
|
9218
|
+
}
|
|
9219
|
+
return {
|
|
9220
|
+
userId: resolvedUserId,
|
|
9221
|
+
organizationId: resolvedOrganizationId,
|
|
9222
|
+
forceNoCache: options?.forceNoCache,
|
|
9223
|
+
headers: options?.headers ? { ...options.headers } : void 0,
|
|
9224
|
+
auth
|
|
9225
|
+
};
|
|
9226
|
+
}
|
|
8088
9227
|
var RegistryNavigator = class {
|
|
8089
9228
|
constructor(registry) {
|
|
8090
9229
|
this.registry = registry;
|
|
@@ -8136,12 +9275,22 @@ var TypedAthenaClientImpl = class _TypedAthenaClientImpl {
|
|
|
8136
9275
|
backend: input.options?.backend,
|
|
8137
9276
|
client: input.options?.client,
|
|
8138
9277
|
headers: input.options?.headers,
|
|
9278
|
+
forceNoCache: input.options?.forceNoCache,
|
|
9279
|
+
userId: input.options?.userId,
|
|
9280
|
+
organizationId: input.options?.organizationId,
|
|
9281
|
+
auth: input.options?.auth,
|
|
9282
|
+
tenantKeyMap,
|
|
9283
|
+
tenantContext,
|
|
8139
9284
|
experimental: input.options?.experimental
|
|
8140
9285
|
};
|
|
8141
9286
|
this.baseClient = createClient(this.url, this.apiKey, {
|
|
8142
9287
|
backend: this.clientOptions.backend,
|
|
8143
9288
|
client: this.clientOptions.client,
|
|
8144
9289
|
headers: this.tenantHeaderMapper.apply(this.clientOptions.headers, tenantContext),
|
|
9290
|
+
forceNoCache: this.clientOptions.forceNoCache,
|
|
9291
|
+
userId: this.clientOptions.userId,
|
|
9292
|
+
organizationId: this.clientOptions.organizationId,
|
|
9293
|
+
auth: this.clientOptions.auth,
|
|
8145
9294
|
experimental: this.clientOptions.experimental
|
|
8146
9295
|
});
|
|
8147
9296
|
this.db = this.baseClient.db;
|
|
@@ -8159,6 +9308,40 @@ var TypedAthenaClientImpl = class _TypedAthenaClientImpl {
|
|
|
8159
9308
|
verifyConnection(options) {
|
|
8160
9309
|
return this.baseClient.verifyConnection(options);
|
|
8161
9310
|
}
|
|
9311
|
+
withContext(context) {
|
|
9312
|
+
const headers = {
|
|
9313
|
+
...this.clientOptions.headers ?? {},
|
|
9314
|
+
...context?.headers ?? {}
|
|
9315
|
+
};
|
|
9316
|
+
const auth = this.clientOptions.auth || context?.auth ? {
|
|
9317
|
+
...this.clientOptions.auth ?? {},
|
|
9318
|
+
...context?.auth ?? {},
|
|
9319
|
+
headers: this.clientOptions.auth?.headers || context?.auth?.headers ? {
|
|
9320
|
+
...this.clientOptions.auth?.headers ?? {},
|
|
9321
|
+
...context?.auth?.headers ?? {}
|
|
9322
|
+
} : void 0
|
|
9323
|
+
} : void 0;
|
|
9324
|
+
return new _TypedAthenaClientImpl({
|
|
9325
|
+
registry: this.registry,
|
|
9326
|
+
url: this.url,
|
|
9327
|
+
apiKey: this.apiKey,
|
|
9328
|
+
options: {
|
|
9329
|
+
...this.clientOptions,
|
|
9330
|
+
headers: Object.keys(headers).length > 0 ? headers : void 0,
|
|
9331
|
+
auth,
|
|
9332
|
+
tenantKeyMap: this.tenantKeyMap,
|
|
9333
|
+
tenantContext: {
|
|
9334
|
+
...this.tenantContext
|
|
9335
|
+
},
|
|
9336
|
+
...context?.userId !== void 0 ? { userId: context.userId } : {},
|
|
9337
|
+
...context?.organizationId !== void 0 ? { organizationId: context.organizationId } : {},
|
|
9338
|
+
...context?.forceNoCache !== void 0 ? { forceNoCache: context.forceNoCache } : {}
|
|
9339
|
+
}
|
|
9340
|
+
});
|
|
9341
|
+
}
|
|
9342
|
+
withSession(session, options) {
|
|
9343
|
+
return this.withContext(resolveSessionContextOptions2(session, options));
|
|
9344
|
+
}
|
|
8162
9345
|
withTenantContext(context) {
|
|
8163
9346
|
return new _TypedAthenaClientImpl({
|
|
8164
9347
|
registry: this.registry,
|
|
@@ -8219,6 +9402,77 @@ function resolveProviderSchemas(providerConfig) {
|
|
|
8219
9402
|
return [...DEFAULT_POSTGRES_SCHEMAS];
|
|
8220
9403
|
}
|
|
8221
9404
|
|
|
9405
|
+
// src/generator/table-selection.ts
|
|
9406
|
+
function normalizeTableSelector(value) {
|
|
9407
|
+
const trimmed = value.trim();
|
|
9408
|
+
return trimmed.length > 0 ? trimmed : void 0;
|
|
9409
|
+
}
|
|
9410
|
+
function normalizeTableSelection(value) {
|
|
9411
|
+
if (typeof value === "string") {
|
|
9412
|
+
return Array.from(
|
|
9413
|
+
new Set(
|
|
9414
|
+
value.split(",").map(normalizeTableSelector).filter((entry) => Boolean(entry))
|
|
9415
|
+
)
|
|
9416
|
+
);
|
|
9417
|
+
}
|
|
9418
|
+
if (Array.isArray(value)) {
|
|
9419
|
+
return Array.from(
|
|
9420
|
+
new Set(
|
|
9421
|
+
value.map((entry) => typeof entry === "string" ? normalizeTableSelector(entry) : void 0).filter((entry) => Boolean(entry))
|
|
9422
|
+
)
|
|
9423
|
+
);
|
|
9424
|
+
}
|
|
9425
|
+
return [];
|
|
9426
|
+
}
|
|
9427
|
+
function matchesTableSelector(schemaName, tableName, selector) {
|
|
9428
|
+
const separatorIndex = selector.indexOf(".");
|
|
9429
|
+
if (separatorIndex < 0) {
|
|
9430
|
+
return tableName === selector;
|
|
9431
|
+
}
|
|
9432
|
+
const selectorSchema = selector.slice(0, separatorIndex).trim();
|
|
9433
|
+
const selectorTable = selector.slice(separatorIndex + 1).trim();
|
|
9434
|
+
return selectorSchema === schemaName && selectorTable === tableName;
|
|
9435
|
+
}
|
|
9436
|
+
function shouldKeepTable(schemaName, tableName, filter) {
|
|
9437
|
+
const included = filter.includeTables.length === 0 || filter.includeTables.some((selector) => matchesTableSelector(schemaName, tableName, selector));
|
|
9438
|
+
if (!included) {
|
|
9439
|
+
return false;
|
|
9440
|
+
}
|
|
9441
|
+
return !filter.excludeTables.some((selector) => matchesTableSelector(schemaName, tableName, selector));
|
|
9442
|
+
}
|
|
9443
|
+
function hasTableFilters(filter) {
|
|
9444
|
+
return filter.includeTables.length > 0 || filter.excludeTables.length > 0;
|
|
9445
|
+
}
|
|
9446
|
+
function filterIntrospectionSnapshot(snapshot, filter) {
|
|
9447
|
+
if (!hasTableFilters(filter)) {
|
|
9448
|
+
return snapshot;
|
|
9449
|
+
}
|
|
9450
|
+
const schemas = {};
|
|
9451
|
+
for (const [schemaName, schema] of Object.entries(snapshot.schemas)) {
|
|
9452
|
+
const tables = Object.fromEntries(
|
|
9453
|
+
Object.entries(schema.tables).filter(([tableName]) => shouldKeepTable(schemaName, tableName, filter))
|
|
9454
|
+
);
|
|
9455
|
+
if (Object.keys(tables).length === 0) {
|
|
9456
|
+
continue;
|
|
9457
|
+
}
|
|
9458
|
+
schemas[schemaName] = {
|
|
9459
|
+
...schema,
|
|
9460
|
+
tables
|
|
9461
|
+
};
|
|
9462
|
+
}
|
|
9463
|
+
if (Object.keys(schemas).length === 0) {
|
|
9464
|
+
const includeLabel = filter.includeTables.length > 0 ? ` includeTables=${filter.includeTables.join(", ")}` : "";
|
|
9465
|
+
const excludeLabel = filter.excludeTables.length > 0 ? ` excludeTables=${filter.excludeTables.join(", ")}` : "";
|
|
9466
|
+
throw new Error(
|
|
9467
|
+
`Generator table filters matched no tables after schema selection.${includeLabel}${excludeLabel}`
|
|
9468
|
+
);
|
|
9469
|
+
}
|
|
9470
|
+
return {
|
|
9471
|
+
...snapshot,
|
|
9472
|
+
schemas
|
|
9473
|
+
};
|
|
9474
|
+
}
|
|
9475
|
+
|
|
8222
9476
|
// src/generator/env.ts
|
|
8223
9477
|
function readEnvStringValue(key) {
|
|
8224
9478
|
if (typeof process === "undefined" || !process.env) {
|
|
@@ -8877,6 +10131,6 @@ async function runSchemaGenerator(options = {}) {
|
|
|
8877
10131
|
return throwBrowserUnsupported("runSchemaGenerator");
|
|
8878
10132
|
}
|
|
8879
10133
|
|
|
8880
|
-
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 };
|
|
10134
|
+
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, 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, 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, unwrapOne, unwrapRows, verifyAthenaGatewayUrl, withRetry };
|
|
8881
10135
|
//# sourceMappingURL=browser.js.map
|
|
8882
10136
|
//# sourceMappingURL=browser.js.map
|