@xylex-group/athena 2.12.1 → 2.14.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.
Files changed (96) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +1190 -1184
  3. package/bin/athena-js.js +104 -76
  4. package/dist/admin.cjs +45 -0
  5. package/dist/admin.cjs.map +1 -0
  6. package/dist/admin.d.cts +64 -0
  7. package/dist/admin.d.ts +64 -0
  8. package/dist/admin.js +41 -0
  9. package/dist/admin.js.map +1 -0
  10. package/dist/athena-auth-url-oLux_57a.d.cts +377 -0
  11. package/dist/athena-auth-url-oLux_57a.d.ts +377 -0
  12. package/dist/browser.cjs +580 -96
  13. package/dist/browser.cjs.map +1 -1
  14. package/dist/browser.d.cts +12 -10
  15. package/dist/browser.d.ts +12 -10
  16. package/dist/browser.js +580 -96
  17. package/dist/browser.js.map +1 -1
  18. package/dist/cli/index.cjs +690 -91
  19. package/dist/cli/index.cjs.map +1 -1
  20. package/dist/cli/index.d.cts +14 -5
  21. package/dist/cli/index.d.ts +14 -5
  22. package/dist/cli/index.js +690 -92
  23. package/dist/cli/index.js.map +1 -1
  24. package/dist/{client-CMtx5P4D.d.cts → client-uthENhaf.d.ts} +346 -1488
  25. package/dist/{client-Dre8H24u.d.ts → client-wU2J9yqb.d.cts} +346 -1488
  26. package/dist/cookies.cjs +18 -0
  27. package/dist/cookies.cjs.map +1 -1
  28. package/dist/cookies.d.cts +2 -1
  29. package/dist/cookies.d.ts +2 -1
  30. package/dist/cookies.js +17 -1
  31. package/dist/cookies.js.map +1 -1
  32. package/dist/{index-CVcQCGyG.d.ts → index-CFL9xbFR.d.cts} +2 -0
  33. package/dist/{index-CVcQCGyG.d.cts → index-UKJpunc6.d.ts} +2 -0
  34. package/dist/index.cjs +648 -96
  35. package/dist/index.cjs.map +1 -1
  36. package/dist/index.d.cts +13 -10
  37. package/dist/index.d.ts +13 -10
  38. package/dist/index.js +648 -97
  39. package/dist/index.js.map +1 -1
  40. package/dist/{model-form-DfTi8-D1.d.cts → model-form-BE1_Bmdd.d.cts} +2 -2
  41. package/dist/{model-form-CU0mWrF9.d.ts → model-form-DcH3R7WD.d.ts} +2 -2
  42. package/dist/{module-DBGmbIuh.d.ts → module-Ca3_OQqR.d.ts} +12 -9
  43. package/dist/{module-GoijrBXV.d.cts → module-DFGZXCtt.d.cts} +12 -9
  44. package/dist/next/client.cjs +992 -89
  45. package/dist/next/client.cjs.map +1 -1
  46. package/dist/next/client.d.cts +7 -4
  47. package/dist/next/client.d.ts +7 -4
  48. package/dist/next/client.js +970 -90
  49. package/dist/next/client.js.map +1 -1
  50. package/dist/next/server.cjs +832 -89
  51. package/dist/next/server.cjs.map +1 -1
  52. package/dist/next/server.d.cts +81 -5
  53. package/dist/next/server.d.ts +81 -5
  54. package/dist/next/server.js +820 -90
  55. package/dist/next/server.js.map +1 -1
  56. package/dist/organization.cjs +72 -0
  57. package/dist/organization.cjs.map +1 -0
  58. package/dist/organization.d.cts +43 -0
  59. package/dist/organization.d.ts +43 -0
  60. package/dist/organization.js +70 -0
  61. package/dist/organization.js.map +1 -0
  62. package/dist/payload-BbSCmILD.d.ts +219 -0
  63. package/dist/payload-zXIwKTQf.d.cts +219 -0
  64. package/dist/{pipeline-c7Gdm0qv.d.cts → pipeline-CwQoD5G9.d.cts} +1 -1
  65. package/dist/{pipeline-DrjU2vNA.d.ts → pipeline-DqwehoQV.d.ts} +1 -1
  66. package/dist/react.cjs +2 -13
  67. package/dist/react.cjs.map +1 -1
  68. package/dist/react.d.cts +26 -7
  69. package/dist/react.d.ts +26 -7
  70. package/dist/react.js +2 -13
  71. package/dist/react.js.map +1 -1
  72. package/dist/session-cookie-detection-BqOp9mO6.d.cts +46 -0
  73. package/dist/session-cookie-detection-BqOp9mO6.d.ts +46 -0
  74. package/dist/social-providers.cjs +4198 -0
  75. package/dist/social-providers.cjs.map +1 -0
  76. package/dist/social-providers.d.cts +4948 -0
  77. package/dist/social-providers.d.ts +4948 -0
  78. package/dist/social-providers.js +4126 -0
  79. package/dist/social-providers.js.map +1 -0
  80. package/dist/{types-kPaHUqUa.d.ts → types-6H575ITc.d.cts} +50 -2
  81. package/dist/{types-DRRb0Fd0.d.ts → types-C1swabT5.d.ts} +3 -3
  82. package/dist/{types-Bez4HSbI.d.cts → types-CD6K05JQ.d.ts} +50 -2
  83. package/dist/{types-BRUHGXo2.d.ts → types-YQUR7wu0.d.cts} +3 -3
  84. package/dist/{types-BRUHGXo2.d.cts → types-YQUR7wu0.d.ts} +3 -3
  85. package/dist/{types-BLizCLd1.d.cts → types-dHnjluBC.d.cts} +3 -3
  86. package/dist/types-eAKAh71s.d.cts +1476 -0
  87. package/dist/types-eAKAh71s.d.ts +1476 -0
  88. package/dist/utils.cjs +438 -15
  89. package/dist/utils.cjs.map +1 -1
  90. package/dist/utils.d.cts +76 -11
  91. package/dist/utils.d.ts +76 -11
  92. package/dist/utils.js +390 -16
  93. package/dist/utils.js.map +1 -1
  94. package/package.json +29 -1
  95. package/dist/shared-DZSGAmXs.d.cts +0 -35
  96. package/dist/shared-MMnVBBfy.d.ts +0 -35
@@ -160,7 +160,7 @@ var getSessionCookie = (request2, config) => {
160
160
 
161
161
  // src/utils/athena-request-headers.ts
162
162
  var NO_CACHE_HEADER_VALUE = "no-cache";
163
- var API_KEY_HEADER_CANDIDATES = ["X-Api-Key", "x-api-key", "apikey"];
163
+ var API_KEY_HEADER_CANDIDATES = ["X-Athena-Key", "x-athena-key", "X-Api-Key", "x-api-key", "apikey"];
164
164
  var ATHENA_KEY_HEADER_CANDIDATES = ["X-Athena-Key", "x-athena-key"];
165
165
  var SESSION_TOKEN_HEADER_CANDIDATES = ["X-Athena-Auth-Session-Token"];
166
166
  var BEARER_MIRROR_HEADER_CANDIDATES = ["X-Athena-Auth-Bearer-Token"];
@@ -262,17 +262,6 @@ function buildServiceRequestHeaders(profile, sdkHeaderValue, config, options, ex
262
262
  });
263
263
  }
264
264
  function applyAthenaApiKeyHeaders(headers, apiKey, athenaKey) {
265
- if (apiKey) {
266
- if (!hasHeaderIgnoreCase(headers, "apikey")) {
267
- headers.apikey = apiKey;
268
- }
269
- if (!Object.hasOwn(headers, "x-api-key")) {
270
- headers["x-api-key"] = apiKey;
271
- }
272
- if (!Object.hasOwn(headers, "X-Api-Key")) {
273
- headers["X-Api-Key"] = apiKey;
274
- }
275
- }
276
265
  const resolvedAthenaKey = normalizeHeaderValue(athenaKey) ?? normalizeHeaderValue(apiKey);
277
266
  if (resolvedAthenaKey && !hasHeaderIgnoreCase(headers, "X-Athena-Key")) {
278
267
  headers["X-Athena-Key"] = resolvedAthenaKey;
@@ -398,7 +387,7 @@ function buildAthenaRequestHeaders(input) {
398
387
 
399
388
  // package.json
400
389
  var package_default = {
401
- version: "2.12.1"
390
+ version: "2.14.0"
402
391
  };
403
392
 
404
393
  // src/sdk-version.ts
@@ -2827,39 +2816,224 @@ async function withRetry(config, fn) {
2827
2816
  throw new Error("withRetry reached an unexpected state");
2828
2817
  }
2829
2818
 
2830
- // src/db/module.ts
2831
- function createDbModule(input) {
2832
- const db = {
2833
- from: input.from,
2834
- select(table, first, second) {
2835
- if (first && typeof first === "object" && !Array.isArray(first)) {
2836
- return input.from(table).select(void 0, first);
2819
+ // src/storage/direct-upload.ts
2820
+ var SERVICE = "s3";
2821
+ var TERMINATOR = "aws4_request";
2822
+ async function putDirectStorageUploadBody(config, bucket, storageKey, body, uploadHeaders, signal, onProgress) {
2823
+ if (config.bucket && bucket && config.bucket !== bucket) {
2824
+ throw new Error(
2825
+ `athena.storage.file.upload direct mode bucket mismatch: configured ${config.bucket} but Athena returned ${bucket}`
2826
+ );
2827
+ }
2828
+ const target = createDirectUploadTarget(config, bucket, storageKey);
2829
+ const bytes = await bodyToArrayBuffer(body);
2830
+ const payloadHash = await sha256Hex(bytes);
2831
+ const headers = new Headers(uploadHeaders);
2832
+ if (isBlobBody(body) && body.type && !headers.has("Content-Type")) {
2833
+ headers.set("Content-Type", body.type);
2834
+ }
2835
+ const signed = await signDirectUploadRequest(config, target, headers, payloadHash);
2836
+ if (typeof XMLHttpRequest !== "undefined") {
2837
+ return putWithXhr(target.toString(), signed, body, signal, onProgress);
2838
+ }
2839
+ onProgress({ loaded: 0 });
2840
+ const response = await fetch(target, {
2841
+ method: "PUT",
2842
+ headers: signed.requestHeaders,
2843
+ body,
2844
+ signal
2845
+ });
2846
+ if (!response.ok) {
2847
+ throw new Error(`athena.storage.file.upload failed with status ${response.status}`);
2848
+ }
2849
+ onProgress({ loaded: bytes.byteLength });
2850
+ return response;
2851
+ }
2852
+ function createDirectUploadTarget(config, bucket, storageKey) {
2853
+ const resolvedBucket = config.bucket ?? bucket;
2854
+ if (!resolvedBucket?.trim()) {
2855
+ throw new Error(
2856
+ "athena.storage.file.upload direct mode requires a bucket in experimental.directStorageUpload or the server upload response"
2857
+ );
2858
+ }
2859
+ if (!storageKey.trim()) {
2860
+ throw new Error("athena.storage.file.upload direct mode requires a storage key");
2861
+ }
2862
+ let endpoint;
2863
+ try {
2864
+ endpoint = new URL(config.endpoint);
2865
+ } catch (error) {
2866
+ throw new Error(
2867
+ `athena.storage.file.upload direct mode received an invalid endpoint: ${error instanceof Error ? error.message : String(error)}`
2868
+ );
2869
+ }
2870
+ if (endpoint.search || endpoint.hash) {
2871
+ throw new Error("athena.storage.file.upload direct mode endpoint must not contain a query or hash");
2872
+ }
2873
+ const endpointPath = endpoint.pathname.replace(/\/+$/, "");
2874
+ const pathParts = config.forcePathStyle === false ? [endpointPath, storageKey] : [endpointPath, resolvedBucket, storageKey];
2875
+ if (config.forcePathStyle === false) {
2876
+ endpoint.hostname = `${resolvedBucket}.${endpoint.hostname}`;
2877
+ }
2878
+ endpoint.pathname = pathParts.filter(Boolean).flatMap((part) => part.split("/")).map(awsEncode).join("/").replace(/^([^/])/, "/$1");
2879
+ return endpoint;
2880
+ }
2881
+ async function signDirectUploadRequest(config, target, inputHeaders, payloadHash) {
2882
+ const accessKeyId = config.accessKeyId.trim();
2883
+ const secretAccessKey = config.secretAccessKey.trim();
2884
+ if (!accessKeyId || !secretAccessKey) {
2885
+ throw new Error(
2886
+ "athena.storage.file.upload direct mode requires accessKeyId and secretAccessKey"
2887
+ );
2888
+ }
2889
+ const now = /* @__PURE__ */ new Date();
2890
+ const amzDate = formatAmzDate(now);
2891
+ const shortDate = amzDate.slice(0, 8);
2892
+ const region = config.region?.trim() || "auto";
2893
+ const headers = {};
2894
+ inputHeaders.forEach((value, key) => {
2895
+ if (key.toLowerCase() !== "authorization" && key.toLowerCase() !== "host") {
2896
+ headers[key.toLowerCase()] = value.trim().replace(/\s+/g, " ");
2897
+ }
2898
+ });
2899
+ headers["x-amz-content-sha256"] = payloadHash;
2900
+ headers["x-amz-date"] = amzDate;
2901
+ if (config.sessionToken?.trim()) {
2902
+ headers["x-amz-security-token"] = config.sessionToken.trim();
2903
+ }
2904
+ const canonicalHeaders = Object.keys(headers).sort().map((key) => `${key}:${headers[key]}
2905
+ `).join("");
2906
+ const signedHeaders = Object.keys(headers).sort().join(";");
2907
+ const canonicalRequest = [
2908
+ "PUT",
2909
+ target.pathname,
2910
+ "",
2911
+ `host:${target.host}
2912
+ ${canonicalHeaders}`,
2913
+ `host;${signedHeaders}`,
2914
+ payloadHash
2915
+ ].join("\n");
2916
+ const credentialScope = `${shortDate}/${region}/${SERVICE}/${TERMINATOR}`;
2917
+ const stringToSign = [
2918
+ "AWS4-HMAC-SHA256",
2919
+ amzDate,
2920
+ credentialScope,
2921
+ await sha256Hex(canonicalRequest)
2922
+ ].join("\n");
2923
+ const dateKey = await hmac(`AWS4${secretAccessKey}`, shortDate);
2924
+ const regionKey = await hmac(dateKey, region);
2925
+ const serviceKey = await hmac(regionKey, SERVICE);
2926
+ const signingKey = await hmac(serviceKey, TERMINATOR);
2927
+ const signature = await hmacHex(signingKey, stringToSign);
2928
+ headers.authorization = `AWS4-HMAC-SHA256 Credential=${accessKeyId}/${credentialScope}, SignedHeaders=host;${signedHeaders}, Signature=${signature}`;
2929
+ return { requestHeaders: headers };
2930
+ }
2931
+ async function putWithXhr(url, signed, body, signal, onProgress) {
2932
+ const Xhr = XMLHttpRequest;
2933
+ if (Xhr === void 0) {
2934
+ return Promise.reject(new Error("athena.storage.file.upload direct mode requires XMLHttpRequest in this runtime"));
2935
+ }
2936
+ return new Promise((resolve, reject) => {
2937
+ const xhr = new Xhr();
2938
+ const abort = () => xhr.abort();
2939
+ xhr.open("PUT", url);
2940
+ Object.entries(signed.requestHeaders).forEach(([key, value]) => xhr.setRequestHeader(key, value));
2941
+ xhr.upload.onprogress = (event) => onProgress({ loaded: event.loaded });
2942
+ xhr.onload = () => {
2943
+ signal?.removeEventListener("abort", abort);
2944
+ if (xhr.status < 200 || xhr.status >= 300) {
2945
+ reject(new Error(`athena.storage.file.upload failed with status ${xhr.status}`));
2946
+ return;
2837
2947
  }
2838
- return input.from(table).select(first, second);
2839
- },
2840
- insert(table, values, options) {
2841
- return Array.isArray(values) ? input.from(table).insert(values, options) : input.from(table).insert(values, options);
2842
- },
2843
- upsert(table, values, options) {
2844
- return Array.isArray(values) ? input.from(table).upsert(values, options) : input.from(table).upsert(values, options);
2845
- },
2846
- update(table, values, options) {
2847
- return input.from(table).update(values, options);
2848
- },
2849
- delete(table, options) {
2850
- return input.from(table).delete(options);
2851
- },
2852
- rpc(fn, args, options) {
2853
- return input.rpc(fn, args, options);
2854
- },
2855
- query(query, options) {
2856
- return input.query(query, options);
2948
+ onProgress({ loaded: bodySize(body) });
2949
+ resolve(new Response(xhr.response, {
2950
+ status: xhr.status,
2951
+ statusText: xhr.statusText,
2952
+ headers: parseXhrHeaders(xhr.getAllResponseHeaders())
2953
+ }));
2954
+ };
2955
+ xhr.onerror = () => {
2956
+ signal?.removeEventListener("abort", abort);
2957
+ reject(new Error("athena.storage.file.upload failed with a network error"));
2958
+ };
2959
+ xhr.onabort = () => {
2960
+ signal?.removeEventListener("abort", abort);
2961
+ reject(new DOMException("Upload aborted", "AbortError"));
2962
+ };
2963
+ if (signal) {
2964
+ if (signal.aborted) {
2965
+ abort();
2966
+ return;
2967
+ }
2968
+ signal.addEventListener("abort", abort, { once: true });
2857
2969
  }
2858
- };
2859
- return db;
2970
+ xhr.send(body);
2971
+ });
2972
+ }
2973
+ function isBlobBody(body) {
2974
+ return typeof Blob !== "undefined" && body instanceof Blob;
2975
+ }
2976
+ async function bodyToArrayBuffer(body) {
2977
+ if (isBlobBody(body)) return body.arrayBuffer();
2978
+ if (body instanceof ArrayBuffer) return body;
2979
+ if (ArrayBuffer.isView(body)) {
2980
+ return body.buffer.slice(body.byteOffset, body.byteOffset + body.byteLength);
2981
+ }
2982
+ throw new Error("athena.storage.file.upload direct mode does not support ReadableStream bodies");
2983
+ }
2984
+ function bodySize(body) {
2985
+ if (isBlobBody(body)) return body.size;
2986
+ if (body instanceof ArrayBuffer) return body.byteLength;
2987
+ if (ArrayBuffer.isView(body)) return body.byteLength;
2988
+ return 0;
2989
+ }
2990
+ function awsEncode(value) {
2991
+ return encodeURIComponent(value).replace(/[!'()*]/g, (character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`);
2992
+ }
2993
+ function formatAmzDate(date) {
2994
+ return date.toISOString().replace(/[:-]|\.\d{3}/g, "");
2995
+ }
2996
+ async function sha256Hex(value) {
2997
+ const bytes = typeof value === "string" ? new TextEncoder().encode(value) : value;
2998
+ const digest = await crypto.subtle.digest("SHA-256", bytes);
2999
+ return toHex(new Uint8Array(digest));
3000
+ }
3001
+ async function hmac(key, value) {
3002
+ const keyBytes = typeof key === "string" ? new TextEncoder().encode(key) : key;
3003
+ const cryptoKey = await crypto.subtle.importKey(
3004
+ "raw",
3005
+ keyBytes,
3006
+ { name: "HMAC", hash: "SHA-256" },
3007
+ false,
3008
+ ["sign"]
3009
+ );
3010
+ return crypto.subtle.sign("HMAC", cryptoKey, new TextEncoder().encode(value));
3011
+ }
3012
+ async function hmacHex(key, value) {
3013
+ return toHex(new Uint8Array(await hmac(key, value)));
3014
+ }
3015
+ function toHex(bytes) {
3016
+ return Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
3017
+ }
3018
+ function parseXhrHeaders(rawHeaders) {
3019
+ const headers = new Headers();
3020
+ rawHeaders.trim().split(/[\r\n]+/).forEach((line) => {
3021
+ const separator = line.indexOf(":");
3022
+ if (separator > 0) {
3023
+ headers.set(line.slice(0, separator).trim(), line.slice(separator + 1).trim());
3024
+ }
3025
+ });
3026
+ return headers;
2860
3027
  }
2861
3028
 
2862
3029
  // src/storage/file.ts
3030
+ function mergeUploadHeaders(serverHeaders, inputHeaders) {
3031
+ const headers = { ...serverHeaders };
3032
+ new Headers(inputHeaders).forEach((value, key) => {
3033
+ headers[key] = value;
3034
+ });
3035
+ return headers;
3036
+ }
2863
3037
  function createStorageFileModule(base, config = {}) {
2864
3038
  const upload = async (input, options) => {
2865
3039
  const sources = normalizeUploadSources(input);
@@ -2895,16 +3069,25 @@ function createStorageFileModule(base, config = {}) {
2895
3069
  for (let index = 0; index < uploadRequests.length; index += 1) {
2896
3070
  const request2 = uploadRequests[index];
2897
3071
  const uploadUrl = uploadUrls[index];
2898
- const response = await putUploadBody(
3072
+ const aggregateProgress = (progress) => {
3073
+ aggregateLoaded[index] = progress.loaded;
3074
+ input.onProgress?.(createProgressSnapshot("uploading", sources, index, progress.loaded, sum(aggregateLoaded)));
3075
+ };
3076
+ const response = config.directUpload ? await putDirectStorageUploadBody(
3077
+ config.directUpload,
3078
+ uploadUrl.upload.bucket,
3079
+ uploadUrl.upload.storage_key,
3080
+ request2.source.source,
3081
+ mergeUploadHeaders(uploadUrl.upload.headers ?? {}, input.uploadHeaders),
3082
+ options?.signal,
3083
+ aggregateProgress
3084
+ ) : await putUploadBody(
2899
3085
  uploadUrl.upload.url,
2900
3086
  uploadUrl.upload.headers ?? {},
2901
3087
  request2.source,
2902
3088
  input,
2903
3089
  options,
2904
- (progress) => {
2905
- aggregateLoaded[index] = progress.loaded;
2906
- input.onProgress?.(createProgressSnapshot("uploading", sources, index, progress.loaded, sum(aggregateLoaded)));
2907
- }
3090
+ aggregateProgress
2908
3091
  );
2909
3092
  uploaded.push({
2910
3093
  file: uploadUrl.file,
@@ -3055,7 +3238,7 @@ function putUploadBodyWithXhr(url, source, headers, options, onProgress) {
3055
3238
  resolve(new Response(xhr.response, {
3056
3239
  status: xhr.status,
3057
3240
  statusText: xhr.statusText,
3058
- headers: parseXhrHeaders(xhr.getAllResponseHeaders())
3241
+ headers: parseXhrHeaders2(xhr.getAllResponseHeaders())
3059
3242
  }));
3060
3243
  };
3061
3244
  xhr.onerror = () => {
@@ -3193,7 +3376,7 @@ function createProgressSnapshot(phase, sources, fileIndex, loaded, aggregateLoad
3193
3376
  function sum(values) {
3194
3377
  return values.reduce((total, value) => total + value, 0);
3195
3378
  }
3196
- function parseXhrHeaders(raw) {
3379
+ function parseXhrHeaders2(raw) {
3197
3380
  const headers = new Headers();
3198
3381
  for (const line of raw.trim().split(/[\r\n]+/)) {
3199
3382
  const index = line.indexOf(":");
@@ -3210,6 +3393,230 @@ function isRecord5(value) {
3210
3393
  return Boolean(value) && typeof value === "object";
3211
3394
  }
3212
3395
 
3396
+ // src/storage/backup.ts
3397
+ function backupError(message, status, endpoint, method, cause, raw) {
3398
+ const error = new Error(message);
3399
+ error.name = "AthenaStorageError";
3400
+ error.code = status === 0 ? "NETWORK_ERROR" : "HTTP_ERROR";
3401
+ error.status = status;
3402
+ error.endpoint = endpoint;
3403
+ error.method = method;
3404
+ error.cause = cause;
3405
+ error.raw = raw;
3406
+ throw error;
3407
+ }
3408
+ function isRecord6(value) {
3409
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
3410
+ }
3411
+ function asPath(path) {
3412
+ return path;
3413
+ }
3414
+ function appendQuery(path, query) {
3415
+ if (!query) return path;
3416
+ const params = new URLSearchParams();
3417
+ for (const [key, value] of Object.entries(query)) {
3418
+ if (value === void 0 || value === null || value === "") continue;
3419
+ params.set(key, String(value));
3420
+ }
3421
+ const text = params.toString();
3422
+ return text ? `${path}?${text}` : path;
3423
+ }
3424
+ function unwrapAthenaData(payload) {
3425
+ if (isRecord6(payload) && "data" in payload) {
3426
+ return payload.data;
3427
+ }
3428
+ return payload;
3429
+ }
3430
+ function requireKey(key) {
3431
+ const trimmed = key.trim();
3432
+ if (!trimmed || trimmed === "undefined" || trimmed === "null") {
3433
+ backupError("Backup object key is required", 400, "/admin/backups/{key}", "DELETE");
3434
+ }
3435
+ return trimmed;
3436
+ }
3437
+ function resolveMessage(payload, fallback) {
3438
+ if (isRecord6(payload)) {
3439
+ const message = payload.message ?? payload.error ?? payload.details;
3440
+ if (typeof message === "string" && message.trim()) return message.trim();
3441
+ }
3442
+ if (typeof payload === "string" && payload.trim()) return payload.trim();
3443
+ return fallback;
3444
+ }
3445
+ async function callBackupEndpoint(gateway, path, method, payload, options, runtime) {
3446
+ const endpoint = asPath(path);
3447
+ const baseUrl = options?.baseUrl ? normalizeAthenaGatewayBaseUrl(options.baseUrl) : gateway.baseUrl;
3448
+ const url = buildAthenaGatewayUrl(baseUrl, endpoint);
3449
+ const headers = gateway.buildHeaders(options);
3450
+ const init = {
3451
+ method,
3452
+ headers,
3453
+ signal: options?.signal
3454
+ };
3455
+ if (payload !== void 0 && method !== "GET") {
3456
+ init.body = JSON.stringify(payload);
3457
+ }
3458
+ let response;
3459
+ try {
3460
+ response = await fetch(url, init);
3461
+ } catch (error) {
3462
+ backupError(
3463
+ error instanceof Error ? error.message : "Backup network error",
3464
+ 0,
3465
+ path,
3466
+ method,
3467
+ error
3468
+ );
3469
+ }
3470
+ const rawText = await response.text();
3471
+ let parsed = null;
3472
+ if (rawText) {
3473
+ try {
3474
+ parsed = JSON.parse(rawText);
3475
+ } catch {
3476
+ parsed = rawText;
3477
+ }
3478
+ }
3479
+ if (!response.ok) {
3480
+ backupError(
3481
+ resolveMessage(parsed, `Backup ${method} ${path} failed (${response.status})`),
3482
+ response.status,
3483
+ path,
3484
+ method,
3485
+ void 0,
3486
+ parsed
3487
+ );
3488
+ }
3489
+ return unwrapAthenaData(parsed);
3490
+ }
3491
+ function createStorageBackupModule(gateway, runtimeOptions) {
3492
+ const resolvedBaseUrl = () => String(gateway.baseUrl ?? "").replace(/\/+$/, "");
3493
+ return {
3494
+ async list(query, options) {
3495
+ const path = appendQuery("/admin/backups", {
3496
+ limit: query?.limit ?? 10,
3497
+ client_name: query?.client_name,
3498
+ cursor: query?.cursor ?? void 0
3499
+ });
3500
+ const data = await callBackupEndpoint(gateway, path, "GET", void 0, options);
3501
+ const backups = (data?.backups ?? []).map((row) => ({
3502
+ ...row,
3503
+ key: row.key ?? row.s3_key
3504
+ }));
3505
+ return {
3506
+ backups,
3507
+ next_cursor: data?.next_cursor ?? null
3508
+ };
3509
+ },
3510
+ async create(input, options) {
3511
+ const data = await callBackupEndpoint(gateway, "/admin/backups", "POST", input, options);
3512
+ return {
3513
+ job_id: Number(data?.job_id ?? 0),
3514
+ client_name: String(data?.client_name ?? input.client_name),
3515
+ status: String(data?.status ?? "pending")
3516
+ };
3517
+ },
3518
+ async restore(key, input, options) {
3519
+ const backupKey = requireKey(key);
3520
+ const path = `/admin/backups/${encodeURIComponent(backupKey)}/restore`;
3521
+ const data = await callBackupEndpoint(gateway, path, "POST", input, options);
3522
+ return {
3523
+ job_id: Number(data?.job_id ?? 0),
3524
+ client_name: String(data?.client_name ?? input.client_name),
3525
+ status: String(data?.status ?? "pending"),
3526
+ key: String(data?.key ?? backupKey)
3527
+ };
3528
+ },
3529
+ async delete(key, options) {
3530
+ const backupKey = requireKey(key);
3531
+ await callBackupEndpoint(
3532
+ gateway,
3533
+ `/admin/backups/${encodeURIComponent(backupKey)}`,
3534
+ "DELETE",
3535
+ void 0,
3536
+ options);
3537
+ },
3538
+ downloadUrl(key, options) {
3539
+ const backupKey = requireKey(key);
3540
+ const base = `${resolvedBaseUrl()}/admin/backups/${encodeURIComponent(backupKey)}/download`;
3541
+ return options?.apiKey ? `${base}?api_key=${encodeURIComponent(options.apiKey)}` : base;
3542
+ },
3543
+ jobs: {
3544
+ async list(query, options) {
3545
+ const path = appendQuery("/admin/backups/jobs", query ?? {});
3546
+ const data = await callBackupEndpoint(gateway, path, "GET", void 0, options);
3547
+ if (Array.isArray(data)) return data;
3548
+ if (isRecord6(data) && Array.isArray(data.jobs)) return data.jobs;
3549
+ return [];
3550
+ },
3551
+ async get(jobId, options) {
3552
+ return callBackupEndpoint(
3553
+ gateway,
3554
+ `/admin/backups/jobs/${encodeURIComponent(String(jobId))}`,
3555
+ "GET",
3556
+ void 0,
3557
+ options);
3558
+ },
3559
+ async cancel(jobId, options) {
3560
+ return callBackupEndpoint(
3561
+ gateway,
3562
+ `/admin/backups/jobs/${encodeURIComponent(String(jobId))}/cancel`,
3563
+ "POST",
3564
+ {},
3565
+ options);
3566
+ },
3567
+ async delete(jobId, options) {
3568
+ await callBackupEndpoint(
3569
+ gateway,
3570
+ `/admin/backups/jobs/${encodeURIComponent(String(jobId))}`,
3571
+ "DELETE",
3572
+ void 0,
3573
+ options);
3574
+ },
3575
+ async openObjectUrl(jobId, options) {
3576
+ const data = await callBackupEndpoint(
3577
+ gateway,
3578
+ `/admin/backups/jobs/${encodeURIComponent(String(jobId))}/s3-open`,
3579
+ "GET",
3580
+ void 0,
3581
+ options);
3582
+ return String(data?.url ?? "");
3583
+ }
3584
+ },
3585
+ schedules: {
3586
+ async list(options) {
3587
+ const data = await callBackupEndpoint(gateway, "/admin/backups/schedules", "GET", void 0, options);
3588
+ if (Array.isArray(data)) return data;
3589
+ if (isRecord6(data) && Array.isArray(data.schedules)) return data.schedules;
3590
+ return [];
3591
+ },
3592
+ async create(input, options) {
3593
+ return callBackupEndpoint(
3594
+ gateway,
3595
+ "/admin/backups/schedules",
3596
+ "POST",
3597
+ input,
3598
+ options);
3599
+ },
3600
+ async update(id, input, options) {
3601
+ return callBackupEndpoint(
3602
+ gateway,
3603
+ `/admin/backups/schedules/${encodeURIComponent(String(id))}`,
3604
+ "PATCH",
3605
+ input,
3606
+ options);
3607
+ },
3608
+ async delete(id, options) {
3609
+ await callBackupEndpoint(
3610
+ gateway,
3611
+ `/admin/backups/schedules/${encodeURIComponent(String(id))}`,
3612
+ "DELETE",
3613
+ void 0,
3614
+ options);
3615
+ }
3616
+ }
3617
+ };
3618
+ }
3619
+
3213
3620
  // src/storage/module.ts
3214
3621
  var storageSdkManifest = {
3215
3622
  methods: [
@@ -3252,6 +3659,53 @@ var storageSdkManifest = {
3252
3659
  responseEnvelope: "raw",
3253
3660
  responseType: "{ data: S3CredentialListItem[] }"
3254
3661
  },
3662
+ {
3663
+ name: "backup.list",
3664
+ method: "GET",
3665
+ path: "/admin/backups",
3666
+ responseEnvelope: "athena",
3667
+ responseType: "StorageBackupListPage",
3668
+ note: "Admin backup archives on server S3/R2 profile"
3669
+ },
3670
+ {
3671
+ name: "backup.create",
3672
+ method: "POST",
3673
+ path: "/admin/backups",
3674
+ requestType: "StorageBackupCreateRequest",
3675
+ responseEnvelope: "athena",
3676
+ responseType: "StorageBackupQueuedJob"
3677
+ },
3678
+ {
3679
+ name: "backup.restore",
3680
+ method: "POST",
3681
+ path: "/admin/backups/{key}/restore",
3682
+ pathParams: ["key"],
3683
+ requestType: "StorageBackupRestoreRequest",
3684
+ responseEnvelope: "athena",
3685
+ responseType: "StorageBackupQueuedJob"
3686
+ },
3687
+ {
3688
+ name: "backup.delete",
3689
+ method: "DELETE",
3690
+ path: "/admin/backups/{key}",
3691
+ pathParams: ["key"],
3692
+ responseEnvelope: "athena",
3693
+ responseType: "void"
3694
+ },
3695
+ {
3696
+ name: "backup.jobs.list",
3697
+ method: "GET",
3698
+ path: "/admin/backups/jobs",
3699
+ responseEnvelope: "athena",
3700
+ responseType: "StorageBackupJob[]"
3701
+ },
3702
+ {
3703
+ name: "backup.schedules.list",
3704
+ method: "GET",
3705
+ path: "/admin/backups/schedules",
3706
+ responseEnvelope: "athena",
3707
+ responseType: "StorageBackupSchedule[]"
3708
+ },
3255
3709
  {
3256
3710
  name: "createStorageUploadUrl",
3257
3711
  method: "POST",
@@ -3899,7 +4353,7 @@ var AthenaStorageError = class extends Error {
3899
4353
  };
3900
4354
  }
3901
4355
  };
3902
- function isRecord6(value) {
4356
+ function isRecord7(value) {
3903
4357
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
3904
4358
  }
3905
4359
  function causeToString(cause) {
@@ -3997,7 +4451,7 @@ function parseResponseBody3(rawText, contentType) {
3997
4451
  return { parsed: rawText, parseFailed: true };
3998
4452
  }
3999
4453
  }
4000
- function appendQuery(path, query) {
4454
+ function appendQuery2(path, query) {
4001
4455
  if (!query) return path;
4002
4456
  const params = new URLSearchParams();
4003
4457
  for (const [key, value] of Object.entries(query)) {
@@ -4023,7 +4477,7 @@ function withPathParam(path, name, value) {
4023
4477
  return path.replace(`{${name}}`, encodeURIComponent(value));
4024
4478
  }
4025
4479
  function resolveErrorMessage3(payload, fallback) {
4026
- if (isRecord6(payload)) {
4480
+ if (isRecord7(payload)) {
4027
4481
  const message = payload.message ?? payload.error ?? payload.details;
4028
4482
  if (typeof message === "string" && message.trim()) {
4029
4483
  return message.trim();
@@ -4035,12 +4489,12 @@ function resolveErrorMessage3(payload, fallback) {
4035
4489
  return fallback;
4036
4490
  }
4037
4491
  function resolveErrorHint2(payload) {
4038
- if (!isRecord6(payload)) return void 0;
4492
+ if (!isRecord7(payload)) return void 0;
4039
4493
  const hint = payload.hint ?? payload.suggestion;
4040
4494
  return typeof hint === "string" && hint.trim() ? hint.trim() : void 0;
4041
4495
  }
4042
4496
  function resolveErrorCause(payload) {
4043
- if (!isRecord6(payload)) return void 0;
4497
+ if (!isRecord7(payload)) return void 0;
4044
4498
  const cause = payload.cause ?? payload.reason;
4045
4499
  return typeof cause === "string" && cause.trim() ? cause.trim() : void 0;
4046
4500
  }
@@ -4159,7 +4613,7 @@ async function callStorageEndpoint(gateway, endpoint, method, envelope, payload,
4159
4613
  );
4160
4614
  }
4161
4615
  if (envelope === "athena") {
4162
- if (!isRecord6(parsedBody.parsed) || !("data" in parsedBody.parsed)) {
4616
+ if (!isRecord7(parsedBody.parsed) || !("data" in parsedBody.parsed)) {
4163
4617
  return rejectStorageError(
4164
4618
  {
4165
4619
  code: "INVALID_ATHENA_ENVELOPE",
@@ -4267,7 +4721,7 @@ async function callStorageBinaryEndpoint(gateway, endpoint, method, options, run
4267
4721
  runtimeOptions
4268
4722
  );
4269
4723
  }
4270
- function isBlobBody(body) {
4724
+ function isBlobBody2(body) {
4271
4725
  return typeof Blob !== "undefined" && body instanceof Blob;
4272
4726
  }
4273
4727
  function isReadableStreamBody(body) {
@@ -4276,7 +4730,7 @@ function isReadableStreamBody(body) {
4276
4730
  async function putPresignedUploadBody(uploadUrl, uploadHeaders, body, options) {
4277
4731
  const headers = new Headers(uploadHeaders);
4278
4732
  Object.entries(options?.headers ?? {}).forEach(([key, value]) => headers.set(key, value));
4279
- if (!headers.has("Content-Type") && isBlobBody(body) && body.type) {
4733
+ if (!headers.has("Content-Type") && isBlobBody2(body) && body.type) {
4280
4734
  headers.set("Content-Type", body.type);
4281
4735
  }
4282
4736
  const init = {
@@ -4371,7 +4825,7 @@ async function callStorageUploadBinaryEndpoint(gateway, endpoint, body, options,
4371
4825
  }
4372
4826
  delete headers["Content-Type"];
4373
4827
  delete headers["content-type"];
4374
- if (isBlobBody(body) && body.type) {
4828
+ if (isBlobBody2(body) && body.type) {
4375
4829
  headers["Content-Type"] = body.type;
4376
4830
  }
4377
4831
  const requestInit = {
@@ -4456,7 +4910,7 @@ async function callStorageUploadBinaryEndpoint(gateway, endpoint, body, options,
4456
4910
  runtimeOptions
4457
4911
  );
4458
4912
  }
4459
- if (!isRecord6(parsedBody.parsed) || !("data" in parsedBody.parsed)) {
4913
+ if (!isRecord7(parsedBody.parsed) || !("data" in parsedBody.parsed)) {
4460
4914
  return rejectStorageError(
4461
4915
  {
4462
4916
  code: "INVALID_ATHENA_ENVELOPE",
@@ -4528,14 +4982,14 @@ function createStorageModule(gateway, runtimeOptions) {
4528
4982
  return callAthena2(withPathParam("/storage/files/{file_id}", "file_id", fileId), "GET", void 0, options);
4529
4983
  },
4530
4984
  getStorageFileUrl(fileId, query, options) {
4531
- const path = appendQuery(
4985
+ const path = appendQuery2(
4532
4986
  withPathParam("/storage/files/{file_id}/url", "file_id", fileId),
4533
4987
  query
4534
4988
  );
4535
4989
  return callAthena2(path, "GET", void 0, options);
4536
4990
  },
4537
4991
  getStorageFileProxy(fileId, query, options) {
4538
- const path = appendQuery(
4992
+ const path = appendQuery2(
4539
4993
  withPathParam("/storage/files/{file_id}/proxy", "file_id", fileId),
4540
4994
  query
4541
4995
  );
@@ -4559,7 +5013,7 @@ function createStorageModule(gateway, runtimeOptions) {
4559
5013
  };
4560
5014
  const fileFacade = createStorageFileModule(base, runtimeOptions);
4561
5015
  const fileUpload = ((input, options) => {
4562
- if (isRecord6(input) && "files" in input) {
5016
+ if (isRecord7(input) && "files" in input) {
4563
5017
  return fileFacade.upload(input, options);
4564
5018
  }
4565
5019
  return base.createStorageUploadUrl(
@@ -4621,7 +5075,7 @@ function createStorageModule(gateway, runtimeOptions) {
4621
5075
  return callAthena2(withPathParam("/storage/files/{file_id}/public-url", "file_id", fileId), "GET", void 0, options);
4622
5076
  },
4623
5077
  proxyUrl(fileId, query, options) {
4624
- const path = appendQuery(
5078
+ const path = appendQuery2(
4625
5079
  withPathParam("/storage/files/{file_id}/proxy-url", "file_id", fileId),
4626
5080
  query
4627
5081
  );
@@ -4659,7 +5113,7 @@ function createStorageModule(gateway, runtimeOptions) {
4659
5113
  },
4660
5114
  retention: {
4661
5115
  get(fileId, query, options) {
4662
- const path = appendQuery(
5116
+ const path = appendQuery2(
4663
5117
  withPathParam("/storage/files/{file_id}/retention", "file_id", fileId),
4664
5118
  query
4665
5119
  );
@@ -4861,6 +5315,7 @@ function createStorageModule(gateway, runtimeOptions) {
4861
5315
  return callAthena2("/storage/audit/list", "POST", input, options);
4862
5316
  }
4863
5317
  };
5318
+ const backup = createStorageBackupModule(gateway);
4864
5319
  return {
4865
5320
  ...base,
4866
5321
  credentials,
@@ -4872,6 +5327,7 @@ function createStorageModule(gateway, runtimeOptions) {
4872
5327
  bucket,
4873
5328
  multipart,
4874
5329
  audit,
5330
+ backup,
4875
5331
  delete: file.delete
4876
5332
  };
4877
5333
  }
@@ -4921,7 +5377,7 @@ function normalizeWsUrl(value, label) {
4921
5377
  parsed.pathname = parsed.pathname.replace(/\/+$/, "");
4922
5378
  return parsed.toString().replace(/\/$/, "");
4923
5379
  }
4924
- function isRecord7(value) {
5380
+ function isRecord8(value) {
4925
5381
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
4926
5382
  }
4927
5383
  function parseResponseBody4(rawText, contentType) {
@@ -4943,7 +5399,7 @@ function resolveRequestId3(headers) {
4943
5399
  return headers.get("x-request-id") ?? headers.get("x-correlation-id") ?? headers.get("x-athena-request-id") ?? void 0;
4944
5400
  }
4945
5401
  function resolveErrorMessage4(payload, fallback) {
4946
- if (isRecord7(payload)) {
5402
+ if (isRecord8(payload)) {
4947
5403
  for (const candidate of [payload.error, payload.message, payload.details]) {
4948
5404
  if (typeof candidate === "string" && candidate.trim().length > 0) {
4949
5405
  return candidate.trim();
@@ -5557,7 +6013,7 @@ var BOOLEAN_SAFE_OPERATORS = /* @__PURE__ */ new Set([
5557
6013
  "ilike",
5558
6014
  "is"
5559
6015
  ]);
5560
- function isRecord8(value) {
6016
+ function isRecord9(value) {
5561
6017
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
5562
6018
  }
5563
6019
  function isUuidString(value) {
@@ -5570,7 +6026,7 @@ function shouldUseUuidTextComparison(column, value) {
5570
6026
  return typeof value === "string" && isUuidString(value) && isUuidIdentifierColumn(column);
5571
6027
  }
5572
6028
  function isRelationSelectNode(value) {
5573
- return isRecord8(value) && isRecord8(value.select);
6029
+ return isRecord9(value) && isRecord9(value.select);
5574
6030
  }
5575
6031
  function normalizeIdentifier(value, label) {
5576
6032
  const normalized = value.trim();
@@ -5626,7 +6082,7 @@ function compileRelationToken(key, node) {
5626
6082
  return `${prefix}${relationToken}(${nested})`;
5627
6083
  }
5628
6084
  function compileSelectShape(select) {
5629
- if (!isRecord8(select)) {
6085
+ if (!isRecord9(select)) {
5630
6086
  throw new Error("findMany select must be an object");
5631
6087
  }
5632
6088
  const tokens = [];
@@ -5650,7 +6106,7 @@ function compileSelectShape(select) {
5650
6106
  return tokens.join(",");
5651
6107
  }
5652
6108
  function selectShapeUsesRelationSchema(select) {
5653
- if (!isRecord8(select)) {
6109
+ if (!isRecord9(select)) {
5654
6110
  return false;
5655
6111
  }
5656
6112
  for (const rawValue of Object.values(select)) {
@@ -5668,7 +6124,7 @@ function selectShapeUsesRelationSchema(select) {
5668
6124
  }
5669
6125
  function compileColumnWhere(column, input) {
5670
6126
  const normalizedColumn = normalizeIdentifier(column, "where column");
5671
- if (!isRecord8(input)) {
6127
+ if (!isRecord9(input)) {
5672
6128
  return [buildGatewayCondition("eq", normalizedColumn, input)];
5673
6129
  }
5674
6130
  const conditions = [];
@@ -5696,7 +6152,7 @@ function compileColumnWhere(column, input) {
5696
6152
  return conditions;
5697
6153
  }
5698
6154
  function compileBooleanExpressionTerms(clause, label) {
5699
- if (!isRecord8(clause)) {
6155
+ if (!isRecord9(clause)) {
5700
6156
  throw new Error(`findMany where.${label} clauses must be objects`);
5701
6157
  }
5702
6158
  const entries = Object.entries(clause).filter(([, value]) => value !== void 0);
@@ -5705,7 +6161,7 @@ function compileBooleanExpressionTerms(clause, label) {
5705
6161
  }
5706
6162
  const [rawColumn, rawValue] = entries[0];
5707
6163
  const column = normalizeIdentifier(rawColumn, `where.${label} column`);
5708
- if (!isRecord8(rawValue)) {
6164
+ if (!isRecord9(rawValue)) {
5709
6165
  return [`${column}.eq.${stringifyFilterValue(rawValue)}`];
5710
6166
  }
5711
6167
  const operatorEntries = Object.entries(rawValue).filter(([, value]) => value !== void 0);
@@ -5729,7 +6185,7 @@ function compileWhere(where) {
5729
6185
  if (where === void 0) {
5730
6186
  return void 0;
5731
6187
  }
5732
- if (!isRecord8(where)) {
6188
+ if (!isRecord9(where)) {
5733
6189
  throw new Error("findMany where must be an object");
5734
6190
  }
5735
6191
  const conditions = [];
@@ -5779,7 +6235,7 @@ function compileOrderBy(orderBy) {
5779
6235
  if (orderBy === void 0) {
5780
6236
  return void 0;
5781
6237
  }
5782
- if (!isRecord8(orderBy)) {
6238
+ if (!isRecord9(orderBy)) {
5783
6239
  throw new Error("findMany orderBy must be an object");
5784
6240
  }
5785
6241
  if ("column" in orderBy) {
@@ -5954,11 +6410,11 @@ function toFindManyAstOrder(order) {
5954
6410
  ascending: order.direction !== "descending"
5955
6411
  };
5956
6412
  }
5957
- function isRecord9(value) {
6413
+ function isRecord10(value) {
5958
6414
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
5959
6415
  }
5960
6416
  function normalizeFindManyAstColumnPredicate(value) {
5961
- if (!isRecord9(value)) {
6417
+ if (!isRecord10(value)) {
5962
6418
  return {
5963
6419
  eq: value
5964
6420
  };
@@ -5982,7 +6438,7 @@ function normalizeFindManyAstBooleanOperand(clause) {
5982
6438
  return normalized;
5983
6439
  }
5984
6440
  function normalizeFindManyAstWhere(where) {
5985
- if (!where || !isRecord9(where)) {
6441
+ if (!where || !isRecord10(where)) {
5986
6442
  return where;
5987
6443
  }
5988
6444
  const normalized = {};
@@ -5996,7 +6452,7 @@ function normalizeFindManyAstWhere(where) {
5996
6452
  );
5997
6453
  continue;
5998
6454
  }
5999
- if (key === "not" && isRecord9(value)) {
6455
+ if (key === "not" && isRecord10(value)) {
6000
6456
  normalized.not = normalizeFindManyAstBooleanOperand(
6001
6457
  value
6002
6458
  );
@@ -6007,7 +6463,7 @@ function normalizeFindManyAstWhere(where) {
6007
6463
  return normalized;
6008
6464
  }
6009
6465
  function predicateRequiresUuidQueryFallback(column, value) {
6010
- if (!isRecord9(value)) {
6466
+ if (!isRecord10(value)) {
6011
6467
  return shouldUseUuidTextComparison(column, value);
6012
6468
  }
6013
6469
  const eqValue = value.eq;
@@ -6025,7 +6481,7 @@ function booleanOperandRequiresUuidQueryFallback(clause) {
6025
6481
  return false;
6026
6482
  }
6027
6483
  function findManyAstWhereRequiresLegacyTransport(where) {
6028
- if (!where || !isRecord9(where)) {
6484
+ if (!where || !isRecord10(where)) {
6029
6485
  return false;
6030
6486
  }
6031
6487
  for (const [key, value] of Object.entries(where)) {
@@ -6040,7 +6496,7 @@ function findManyAstWhereRequiresLegacyTransport(where) {
6040
6496
  }
6041
6497
  continue;
6042
6498
  }
6043
- if (key === "not" && isRecord9(value)) {
6499
+ if (key === "not" && isRecord10(value)) {
6044
6500
  if (booleanOperandRequiresUuidQueryFallback(value)) {
6045
6501
  return true;
6046
6502
  }
@@ -6660,7 +7116,7 @@ async function executeExperimentalRead(experimental, runner) {
6660
7116
  throw error;
6661
7117
  }
6662
7118
  }
6663
- function isRecord10(value) {
7119
+ function isRecord11(value) {
6664
7120
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
6665
7121
  }
6666
7122
  function firstNonEmptyString2(...values) {
@@ -6672,8 +7128,8 @@ function firstNonEmptyString2(...values) {
6672
7128
  return void 0;
6673
7129
  }
6674
7130
  function resolveStructuredErrorPayload2(raw) {
6675
- if (!isRecord10(raw)) return null;
6676
- return isRecord10(raw.error) ? raw.error : raw;
7131
+ if (!isRecord11(raw)) return null;
7132
+ return isRecord11(raw.error) ? raw.error : raw;
6677
7133
  }
6678
7134
  function resolveStructuredErrorDetails(payload, message) {
6679
7135
  if (!payload || !("details" in payload)) {
@@ -6689,7 +7145,7 @@ function resolveStructuredErrorDetails(payload, message) {
6689
7145
  return details;
6690
7146
  }
6691
7147
  function createResultError(response, result, normalized) {
6692
- const rawRecord = isRecord10(response.raw) ? response.raw : null;
7148
+ const rawRecord = isRecord11(response.raw) ? response.raw : null;
6693
7149
  const payload = resolveStructuredErrorPayload2(response.raw);
6694
7150
  const message = firstNonEmptyString2(
6695
7151
  response.error,
@@ -8437,7 +8893,30 @@ function createClientFromConfig(config, sourceConfig) {
8437
8893
  config.experimental,
8438
8894
  queryTracer
8439
8895
  );
8440
- const db = createDbModule({ from, rpc, query });
8896
+ const untypedDbFrom = from;
8897
+ const db = {
8898
+ from,
8899
+ select(table, first, second) {
8900
+ if (first && typeof first === "object" && !Array.isArray(first)) {
8901
+ return untypedDbFrom(table).select(void 0, first);
8902
+ }
8903
+ return untypedDbFrom(table).select(first, second);
8904
+ },
8905
+ insert(table, values, options) {
8906
+ return Array.isArray(values) ? untypedDbFrom(table).insert(values, options) : untypedDbFrom(table).insert(values, options);
8907
+ },
8908
+ upsert(table, values, options) {
8909
+ return Array.isArray(values) ? untypedDbFrom(table).upsert(values, options) : untypedDbFrom(table).upsert(values, options);
8910
+ },
8911
+ update(table, values, options) {
8912
+ return untypedDbFrom(table).update(values, options);
8913
+ },
8914
+ delete(table, options) {
8915
+ return untypedDbFrom(table).delete(options);
8916
+ },
8917
+ rpc,
8918
+ query
8919
+ };
8441
8920
  const chat = createChatModule({
8442
8921
  baseUrl: config.chatUrl,
8443
8922
  apiKey: config.apiKey,
@@ -8575,6 +9054,7 @@ function createClientFromConfig(config, sourceConfig) {
8575
9054
  withOptions: storageWithOptions,
8576
9055
  storage: createStorageModule(gateway, {
8577
9056
  ...config.experimental.storage,
9057
+ ...config.experimental.directStorageUpload ? { directUpload: config.experimental.directStorageUpload } : {},
8578
9058
  ...config.storageUrl ? {
8579
9059
  baseUrl: config.storageUrl,
8580
9060
  stripBasePath: true
@@ -8588,7 +9068,9 @@ function createClientFromConfig(config, sourceConfig) {
8588
9068
  var AthenaClient = class {
8589
9069
  /** Create a fluent builder for a strongly-typed Athena SDK client. */
8590
9070
  static builder() {
8591
- return createAthenaClientBuilder((config) => createClientFromInput(config));
9071
+ return createAthenaClientBuilder(
9072
+ (config) => createClientFromInput(config)
9073
+ );
8592
9074
  }
8593
9075
  static fromEnvironment(options = {}) {
8594
9076
  const env = options.env ?? process.env;
@@ -8619,11 +9101,12 @@ var AthenaClient = class {
8619
9101
  });
8620
9102
  }
8621
9103
  };
8622
- function createClient(configOrUrl, apiKey, options) {
9104
+ function createClient(...args) {
9105
+ const [configOrUrl, apiKey, options] = args;
8623
9106
  if (typeof configOrUrl === "string" || configOrUrl === null || configOrUrl === void 0) {
8624
9107
  return createClientFromInput({
8625
9108
  url: configOrUrl,
8626
- key: "",
9109
+ key: apiKey ?? "",
8627
9110
  ...options
8628
9111
  });
8629
9112
  }
@@ -8667,6 +9150,403 @@ function createAdapterClient(options, context) {
8667
9150
  return client;
8668
9151
  }
8669
9152
 
9153
+ // src/next/session-bridge/constants.ts
9154
+ var ATHENA_AUTH_SESSION_BRIDGE_ROUTE = "/api/athena-auth/session";
9155
+ var ATHENA_AUTH_SESSION_COOKIE_NAME = "athena-auth.session-token";
9156
+ var ATHENA_AUTH_SESSION_COOKIE_NAMES = [
9157
+ ATHENA_AUTH_SESSION_COOKIE_NAME,
9158
+ "athena-auth.session_token"
9159
+ ];
9160
+
9161
+ // src/next/session-bridge/client.ts
9162
+ var JSON_CONTENT_TYPE = "application/json";
9163
+ function isBrowserRuntime() {
9164
+ return typeof globalThis !== "undefined" && "window" in globalThis;
9165
+ }
9166
+ async function persistAthenaAuthSessionOnAppHost(payload, options) {
9167
+ if (!(payload && isBrowserRuntime())) {
9168
+ return;
9169
+ }
9170
+ const route = options?.route ?? ATHENA_AUTH_SESSION_BRIDGE_ROUTE;
9171
+ const fetchImpl = options?.fetch ?? fetch;
9172
+ const response = await fetchImpl(route, {
9173
+ body: JSON.stringify(payload),
9174
+ credentials: "same-origin",
9175
+ headers: {
9176
+ "Content-Type": JSON_CONTENT_TYPE
9177
+ },
9178
+ method: "POST"
9179
+ });
9180
+ if (!response.ok) {
9181
+ throw new Error("Failed to persist the Athena Auth session on the app host");
9182
+ }
9183
+ }
9184
+ async function clearAthenaAuthSessionOnAppHost(options) {
9185
+ if (!isBrowserRuntime()) {
9186
+ return;
9187
+ }
9188
+ const route = options?.route ?? ATHENA_AUTH_SESSION_BRIDGE_ROUTE;
9189
+ const fetchImpl = options?.fetch ?? fetch;
9190
+ const response = await fetchImpl(route, {
9191
+ credentials: "same-origin",
9192
+ method: "DELETE"
9193
+ });
9194
+ if (!response.ok) {
9195
+ throw new Error("Failed to clear the Athena Auth session on the app host");
9196
+ }
9197
+ }
9198
+
9199
+ // src/next/session-bridge/payload.ts
9200
+ function resolveSessionBridgePayload(payload) {
9201
+ const token = payload?.session?.token ?? payload?.token;
9202
+ if (typeof token !== "string") {
9203
+ return null;
9204
+ }
9205
+ const normalizedToken = token.trim();
9206
+ if (!normalizedToken) {
9207
+ return null;
9208
+ }
9209
+ return {
9210
+ token: normalizedToken,
9211
+ expiresAt: typeof payload?.session?.expiresAt === "string" ? payload.session.expiresAt : void 0
9212
+ };
9213
+ }
9214
+
9215
+ // src/utils/hostname.ts
9216
+ var LOCAL_IPV4_PATTERN = /^127(?:\.\d{1,3}){3}$/;
9217
+ function isLocalHostname(hostname) {
9218
+ const normalized = hostname.trim().replace(/\.$/, "").toLowerCase();
9219
+ if (!normalized) {
9220
+ return false;
9221
+ }
9222
+ if (normalized === "localhost" || normalized.endsWith(".localhost")) {
9223
+ return true;
9224
+ }
9225
+ if (normalized === "127.0.0.1" || LOCAL_IPV4_PATTERN.test(normalized) || normalized === "::1" || normalized === "[::1]" || normalized === "0:0:0:0:0:0:0:1") {
9226
+ return true;
9227
+ }
9228
+ return false;
9229
+ }
9230
+
9231
+ // src/utils/auth-cookies.ts
9232
+ var ATHENA_AUTH_COOKIE_PREFIXES = [
9233
+ "athena-auth",
9234
+ "__Secure-athena-auth",
9235
+ "better-auth",
9236
+ "__Secure-better-auth"
9237
+ ];
9238
+ function extractCookieNames(cookieHeader) {
9239
+ const names = /* @__PURE__ */ new Set();
9240
+ for (const rawCookie of cookieHeader.split(";")) {
9241
+ const trimmed = rawCookie.trim();
9242
+ if (!trimmed) continue;
9243
+ const eqPos = trimmed.indexOf("=");
9244
+ const name = (eqPos > -1 ? trimmed.slice(0, eqPos) : trimmed).trim();
9245
+ if (name) {
9246
+ names.add(name);
9247
+ }
9248
+ }
9249
+ return Array.from(names);
9250
+ }
9251
+ function buildCookieDomainCandidates(hostname) {
9252
+ const normalized = hostname.trim().replace(/\.$/, "").toLowerCase();
9253
+ if (!normalized || isLocalHostname(normalized)) {
9254
+ return [];
9255
+ }
9256
+ const labels = normalized.split(".").filter(Boolean);
9257
+ if (labels.length < 2) {
9258
+ return [normalized, `.${normalized}`];
9259
+ }
9260
+ const domains = /* @__PURE__ */ new Set();
9261
+ for (let index = 0; index <= labels.length - 2; index += 1) {
9262
+ const domain = labels.slice(index).join(".");
9263
+ domains.add(domain);
9264
+ domains.add(`.${domain}`);
9265
+ }
9266
+ return Array.from(domains);
9267
+ }
9268
+ function getCookieStore() {
9269
+ const candidate = globalThis.document;
9270
+ if (!candidate || typeof candidate.cookie !== "string") {
9271
+ return null;
9272
+ }
9273
+ return candidate;
9274
+ }
9275
+ function getRuntimeHostname() {
9276
+ const fromWindow = globalThis.window?.location?.hostname;
9277
+ if (typeof fromWindow === "string") {
9278
+ return fromWindow;
9279
+ }
9280
+ const fromLocation = globalThis.location?.hostname;
9281
+ if (typeof fromLocation === "string") {
9282
+ return fromLocation;
9283
+ }
9284
+ return "";
9285
+ }
9286
+ function writeExpiredCookie(cookieStore, name, path, domain) {
9287
+ const domainClause = domain ? ` domain=${domain};` : "";
9288
+ cookieStore.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; Max-Age=0; path=${path};${domainClause}`;
9289
+ }
9290
+ function clearAuthCookies(options = {}) {
9291
+ const cookieStore = getCookieStore();
9292
+ if (!cookieStore) {
9293
+ return [];
9294
+ }
9295
+ const cookieHeader = options.cookieHeader ?? cookieStore.cookie;
9296
+ if (!cookieHeader?.trim()) {
9297
+ return [];
9298
+ }
9299
+ const prefixes = options.prefixes?.length ? options.prefixes : [...ATHENA_AUTH_COOKIE_PREFIXES];
9300
+ const cookieNames = extractCookieNames(cookieHeader);
9301
+ const namesToClear = cookieNames.filter(
9302
+ (name) => prefixes.some((prefix) => name.startsWith(prefix))
9303
+ );
9304
+ if (namesToClear.length === 0) {
9305
+ return [];
9306
+ }
9307
+ const path = options.path?.trim() || "/";
9308
+ const hostname = options.hostname ?? getRuntimeHostname();
9309
+ const domainCandidates = buildCookieDomainCandidates(hostname);
9310
+ for (const name of namesToClear) {
9311
+ writeExpiredCookie(cookieStore, name, path);
9312
+ for (const domain of domainCandidates) {
9313
+ writeExpiredCookie(cookieStore, name, path, domain);
9314
+ }
9315
+ }
9316
+ return namesToClear;
9317
+ }
9318
+
9319
+ // src/utils/auth-routes.ts
9320
+ var AUTH_DEFAULT_VIEW = "sign-in";
9321
+ var AUTH_VIEW_BY_SEGMENT = {
9322
+ "accept-invitation": "accept-invitation",
9323
+ "check-email": "check-email",
9324
+ "forget-password": "forgot-password",
9325
+ "forgot-password": "forgot-password",
9326
+ logout: "logout",
9327
+ "reset-email-sent": "reset-email-sent",
9328
+ "reset-password": "reset-password",
9329
+ "sign-in": "sign-in",
9330
+ "sign-up": "sign-up"
9331
+ };
9332
+ var AUTHENTICATED_REDIRECT_VIEW_SET = /* @__PURE__ */ new Set([
9333
+ "sign-in",
9334
+ "sign-up",
9335
+ "forgot-password"
9336
+ ]);
9337
+ function resolveAuthViewFromSegment(segment) {
9338
+ if (!segment) {
9339
+ return AUTH_DEFAULT_VIEW;
9340
+ }
9341
+ return AUTH_VIEW_BY_SEGMENT[segment] ?? null;
9342
+ }
9343
+ function shouldRedirectAuthenticatedAuthView(view) {
9344
+ return AUTHENTICATED_REDIRECT_VIEW_SET.has(view);
9345
+ }
9346
+ var AUTH_ROUTES = {
9347
+ acceptInvitation: "/auth/accept-invitation",
9348
+ appHome: "/",
9349
+ checkEmail: "/auth/check-email",
9350
+ forgotPassword: "/auth/forgot-password",
9351
+ logout: "/auth/logout",
9352
+ resetEmailSent: "/auth/reset-email-sent",
9353
+ resetPassword: "/auth/reset-password",
9354
+ signIn: "/auth/sign-in",
9355
+ signUp: "/auth/sign-up",
9356
+ socialCallback: "/auth/social-callback"
9357
+ };
9358
+ function createAuthModeRedirects(routes = AUTH_ROUTES) {
9359
+ return {
9360
+ "forgot-password": routes.forgotPassword,
9361
+ login: routes.signIn,
9362
+ logout: routes.logout,
9363
+ "reset-password": routes.resetPassword,
9364
+ signup: routes.signUp
9365
+ };
9366
+ }
9367
+ var AUTH_MODE_REDIRECTS = createAuthModeRedirects();
9368
+ new Set(Object.keys(AUTH_MODE_REDIRECTS));
9369
+
9370
+ // src/utils/athena-auth-url.ts
9371
+ var ATHENA_AUTH_PATH = "/api/auth";
9372
+ var LOCAL_DEV_ORIGIN = "http://localhost:3000";
9373
+ var DEFAULT_ATHENA_AUTH_ORIGIN = "https://auth.athena-auth.com";
9374
+ var ATHENA_AUTH_UPSTREAM_ENV_KEYS = [
9375
+ "ATHENA_AUTH_UPSTREAM_URL",
9376
+ "ATHENA_AUTH_URL",
9377
+ "NEXT_PUBLIC_ATHENA_AUTH_UPSTREAM_URL",
9378
+ "NEXT_PUBLIC_ATHENA_AUTH_URL"
9379
+ ];
9380
+ var ATHENA_AUTH_UPSTREAM_URL_ENV_NAMES = ATHENA_AUTH_UPSTREAM_ENV_KEYS;
9381
+ var LEADING_SLASHES_REGEX = /^\/+/;
9382
+ function stripTrailingSlashes(value) {
9383
+ return value.replace(/\/+$/g, "");
9384
+ }
9385
+ function ensureLeadingSlash(value) {
9386
+ return value.startsWith("/") ? value : `/${value}`;
9387
+ }
9388
+ function ensureAthenaAuthPath(pathname) {
9389
+ const normalizedPath = stripTrailingSlashes(
9390
+ ensureLeadingSlash(pathname.trim())
9391
+ );
9392
+ if (!normalizedPath || normalizedPath === "/") {
9393
+ return ATHENA_AUTH_PATH;
9394
+ }
9395
+ if (normalizedPath.endsWith(ATHENA_AUTH_PATH)) {
9396
+ return normalizedPath;
9397
+ }
9398
+ return `${normalizedPath}${ATHENA_AUTH_PATH}`;
9399
+ }
9400
+ function stripAthenaAuthPath(pathname) {
9401
+ const normalizedPath = stripTrailingSlashes(
9402
+ ensureLeadingSlash(pathname.trim())
9403
+ );
9404
+ if (!normalizedPath || normalizedPath === "/") {
9405
+ return "/";
9406
+ }
9407
+ if (normalizedPath === ATHENA_AUTH_PATH) {
9408
+ return "/";
9409
+ }
9410
+ if (normalizedPath.endsWith(ATHENA_AUTH_PATH)) {
9411
+ const withoutAuthPath = normalizedPath.slice(0, -ATHENA_AUTH_PATH.length);
9412
+ return withoutAuthPath ? ensureLeadingSlash(withoutAuthPath) : "/";
9413
+ }
9414
+ return normalizedPath;
9415
+ }
9416
+ function readProcessEnv2() {
9417
+ try {
9418
+ const maybeProcess = globalThis.process;
9419
+ return maybeProcess?.env;
9420
+ } catch {
9421
+ return void 0;
9422
+ }
9423
+ }
9424
+ function getBrowserOrigin() {
9425
+ try {
9426
+ const origin = globalThis.window?.location?.origin;
9427
+ return typeof origin === "string" && origin.length > 0 ? origin : void 0;
9428
+ } catch {
9429
+ return void 0;
9430
+ }
9431
+ }
9432
+ function isAbsoluteUrl(value) {
9433
+ const trimmed = value.trim();
9434
+ return trimmed.startsWith("http://") || trimmed.startsWith("https://");
9435
+ }
9436
+ function readAthenaAuthUpstreamUrlFromEnv(env) {
9437
+ for (const key of ATHENA_AUTH_UPSTREAM_ENV_KEYS) {
9438
+ const value = env[key]?.trim();
9439
+ if (value) {
9440
+ return value;
9441
+ }
9442
+ }
9443
+ return void 0;
9444
+ }
9445
+ function resolveConfiguredAthenaAuthUpstreamUrl(rawUpstreamUrl) {
9446
+ if (typeof rawUpstreamUrl === "string") {
9447
+ const trimmed = rawUpstreamUrl.trim();
9448
+ return trimmed || void 0;
9449
+ }
9450
+ if (rawUpstreamUrl) {
9451
+ return readAthenaAuthUpstreamUrlFromEnv(rawUpstreamUrl);
9452
+ }
9453
+ const processEnv = readProcessEnv2();
9454
+ return processEnv ? readAthenaAuthUpstreamUrlFromEnv(processEnv) : void 0;
9455
+ }
9456
+ function normalizeAthenaAuthBaseUrl(urlOrPath) {
9457
+ const trimmed = urlOrPath.trim();
9458
+ if (!trimmed) {
9459
+ return ATHENA_AUTH_PATH;
9460
+ }
9461
+ if (isAbsoluteUrl(trimmed)) {
9462
+ const url = new URL(trimmed);
9463
+ url.pathname = ensureAthenaAuthPath(url.pathname);
9464
+ url.search = "";
9465
+ url.hash = "";
9466
+ return stripTrailingSlashes(url.toString());
9467
+ }
9468
+ return ensureAthenaAuthPath(trimmed);
9469
+ }
9470
+ function resolveAthenaAuthUpstreamUrl(rawUpstreamUrl) {
9471
+ const configuredUpstream = resolveConfiguredAthenaAuthUpstreamUrl(rawUpstreamUrl) || DEFAULT_ATHENA_AUTH_ORIGIN;
9472
+ if (isAbsoluteUrl(configuredUpstream)) {
9473
+ const upstreamUrl = new URL(configuredUpstream);
9474
+ upstreamUrl.pathname = stripAthenaAuthPath(upstreamUrl.pathname);
9475
+ upstreamUrl.search = "";
9476
+ upstreamUrl.hash = "";
9477
+ return stripTrailingSlashes(upstreamUrl.toString());
9478
+ }
9479
+ const normalizedPath = stripAthenaAuthPath(configuredUpstream);
9480
+ return stripTrailingSlashes(
9481
+ new URL(normalizedPath, LOCAL_DEV_ORIGIN).toString()
9482
+ );
9483
+ }
9484
+ function resolveBrowserFacingOrigin(rawUpstreamUrl) {
9485
+ if (resolveConfiguredAthenaAuthUpstreamUrl(rawUpstreamUrl)) {
9486
+ return `${resolveAthenaAuthUpstreamUrl(rawUpstreamUrl)}/`;
9487
+ }
9488
+ const browserOrigin = getBrowserOrigin();
9489
+ if (browserOrigin) {
9490
+ return `${browserOrigin}/`;
9491
+ }
9492
+ return `${LOCAL_DEV_ORIGIN}/`;
9493
+ }
9494
+ function resolvePreservedAthenaAuthBaseUrl(configuredAuthBaseUrl, rawUpstreamUrl) {
9495
+ const trimmed = configuredAuthBaseUrl.trim();
9496
+ const preservedConfiguredBaseUrl = trimmed || ATHENA_AUTH_PATH;
9497
+ if (isAbsoluteUrl(preservedConfiguredBaseUrl)) {
9498
+ return stripTrailingSlashes(preservedConfiguredBaseUrl);
9499
+ }
9500
+ return stripTrailingSlashes(
9501
+ new URL(
9502
+ ensureLeadingSlash(preservedConfiguredBaseUrl),
9503
+ resolveBrowserFacingOrigin(rawUpstreamUrl)
9504
+ ).toString()
9505
+ );
9506
+ }
9507
+ function resolveAthenaAuthClientBaseUrl(configuredAuthBaseUrl, rawUpstreamUrl, options = {}) {
9508
+ let baseInput;
9509
+ if (typeof configuredAuthBaseUrl === "string") {
9510
+ baseInput = configuredAuthBaseUrl;
9511
+ } else if (configuredAuthBaseUrl) {
9512
+ baseInput = readAthenaAuthUpstreamUrlFromEnv(configuredAuthBaseUrl) ?? ATHENA_AUTH_PATH;
9513
+ } else {
9514
+ const fromEnv = resolveConfiguredAthenaAuthUpstreamUrl(rawUpstreamUrl);
9515
+ baseInput = fromEnv ?? ATHENA_AUTH_PATH;
9516
+ }
9517
+ if (options.appendAuthPath === false) {
9518
+ return resolvePreservedAthenaAuthBaseUrl(baseInput, rawUpstreamUrl);
9519
+ }
9520
+ const normalizedConfiguredBaseUrl = normalizeAthenaAuthBaseUrl(baseInput);
9521
+ if (isAbsoluteUrl(normalizedConfiguredBaseUrl)) {
9522
+ return normalizedConfiguredBaseUrl;
9523
+ }
9524
+ const browserOrigin = getBrowserOrigin();
9525
+ if (browserOrigin) {
9526
+ return stripTrailingSlashes(
9527
+ new URL(normalizedConfiguredBaseUrl, browserOrigin).toString()
9528
+ );
9529
+ }
9530
+ if (resolveConfiguredAthenaAuthUpstreamUrl(rawUpstreamUrl)) {
9531
+ const upstream = resolveAthenaAuthUpstreamUrl(rawUpstreamUrl);
9532
+ return stripTrailingSlashes(
9533
+ new URL(ATHENA_AUTH_PATH, `${upstream}/`).toString()
9534
+ );
9535
+ }
9536
+ return stripTrailingSlashes(
9537
+ new URL(normalizedConfiguredBaseUrl, LOCAL_DEV_ORIGIN).toString()
9538
+ );
9539
+ }
9540
+ function resolveAthenaAuthRequestUrl(path, rawBaseUrl) {
9541
+ const normalizedPath = path.replace(LEADING_SLASHES_REGEX, "");
9542
+ const base = resolveAthenaAuthClientBaseUrl(rawBaseUrl);
9543
+ return new URL(normalizedPath, `${base}/`).toString();
9544
+ }
9545
+ var ATHENA_AUTH_VERIFY_EMAIL_PATH = "verify-email";
9546
+ function resolveEmailVerificationCallbackUrl(rawBaseUrl) {
9547
+ return resolveAthenaAuthRequestUrl(ATHENA_AUTH_VERIFY_EMAIL_PATH, rawBaseUrl);
9548
+ }
9549
+
8670
9550
  // src/next/client.ts
8671
9551
  var cachedBrowserClient = null;
8672
9552
  function createAthenaBrowserClient(options) {
@@ -8680,6 +9560,6 @@ function createAthenaBrowserClient(options) {
8680
9560
  return createAdapterClient(options);
8681
9561
  }
8682
9562
 
8683
- export { createAthenaBrowserClient };
9563
+ export { ATHENA_AUTH_COOKIE_PREFIXES, ATHENA_AUTH_PATH, ATHENA_AUTH_SESSION_BRIDGE_ROUTE, ATHENA_AUTH_SESSION_COOKIE_NAME, ATHENA_AUTH_SESSION_COOKIE_NAMES, ATHENA_AUTH_UPSTREAM_ENV_KEYS, ATHENA_AUTH_UPSTREAM_URL_ENV_NAMES, AUTH_DEFAULT_VIEW, AUTH_ROUTES, AUTH_VIEW_BY_SEGMENT, DEFAULT_ATHENA_AUTH_ORIGIN, clearAthenaAuthSessionOnAppHost, clearAuthCookies, createAthenaBrowserClient, isAbsoluteUrl, normalizeAthenaAuthBaseUrl, persistAthenaAuthSessionOnAppHost, resolveAthenaAuthClientBaseUrl, resolveAthenaAuthRequestUrl, resolveAthenaAuthUpstreamUrl, resolveAuthViewFromSegment, resolveEmailVerificationCallbackUrl, resolveSessionBridgePayload, shouldRedirectAuthenticatedAuthView };
8684
9564
  //# sourceMappingURL=client.js.map
8685
9565
  //# sourceMappingURL=client.js.map