@xylex-group/athena 3.0.3 → 3.3.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 (86) hide show
  1. package/README.md +1 -1
  2. package/dist/admin.cjs +55 -1
  3. package/dist/admin.cjs.map +1 -1
  4. package/dist/admin.d.cts +32 -8
  5. package/dist/admin.d.ts +32 -8
  6. package/dist/admin.js +54 -2
  7. package/dist/admin.js.map +1 -1
  8. package/dist/athena-auth-url-C1FbVmN6.d.cts +200 -0
  9. package/dist/athena-auth-url-C1FbVmN6.d.ts +200 -0
  10. package/dist/{athena-request-headers-C7Jy-c_D.d.ts → athena-request-headers-DzimbvOA.d.ts} +48 -200
  11. package/dist/{athena-request-headers-DujFFyMU.d.cts → athena-request-headers-Lr_m8xCV.d.cts} +48 -200
  12. package/dist/billing.cjs +1 -1
  13. package/dist/billing.cjs.map +1 -1
  14. package/dist/billing.js +1 -1
  15. package/dist/billing.js.map +1 -1
  16. package/dist/browser.cjs +912 -5
  17. package/dist/browser.cjs.map +1 -1
  18. package/dist/browser.d.cts +8 -7
  19. package/dist/browser.d.ts +8 -7
  20. package/dist/browser.js +881 -6
  21. package/dist/browser.js.map +1 -1
  22. package/dist/cli/index.cjs +7909 -7061
  23. package/dist/cli/index.cjs.map +1 -1
  24. package/dist/cli/index.d.cts +17 -10
  25. package/dist/cli/index.d.ts +17 -10
  26. package/dist/cli/index.js +7911 -7063
  27. package/dist/cli/index.js.map +1 -1
  28. package/dist/env.cjs +130 -0
  29. package/dist/env.cjs.map +1 -0
  30. package/dist/env.d.cts +70 -0
  31. package/dist/env.d.ts +70 -0
  32. package/dist/env.js +122 -0
  33. package/dist/env.js.map +1 -0
  34. package/dist/index.cjs +1570 -98
  35. package/dist/index.cjs.map +1 -1
  36. package/dist/index.d.cts +31 -8
  37. package/dist/index.d.ts +31 -8
  38. package/dist/index.js +1532 -100
  39. package/dist/index.js.map +1 -1
  40. package/dist/model-form-3Gr8rkdT.d.cts +281 -0
  41. package/dist/model-form-CotpEL7z.d.ts +281 -0
  42. package/dist/{module-CPG3ULxQ.d.cts → module-CQmOaDzP.d.cts} +4 -4
  43. package/dist/{module-BruTcxe0.d.ts → module-CWkUTcUc.d.ts} +4 -4
  44. package/dist/next/client.cjs +123 -7
  45. package/dist/next/client.cjs.map +1 -1
  46. package/dist/next/client.d.cts +4 -3
  47. package/dist/next/client.d.ts +4 -3
  48. package/dist/next/client.js +123 -7
  49. package/dist/next/client.js.map +1 -1
  50. package/dist/next/server.cjs +1130 -364
  51. package/dist/next/server.cjs.map +1 -1
  52. package/dist/next/server.d.cts +121 -8
  53. package/dist/next/server.d.ts +121 -8
  54. package/dist/next/server.js +1120 -365
  55. package/dist/next/server.js.map +1 -1
  56. package/dist/pipeline-BnRKO_Pd.d.cts +93 -0
  57. package/dist/pipeline-sWCmlFqu.d.ts +93 -0
  58. package/dist/{proxy-request-headers-m4D2Tduy.d.ts → proxy-request-headers-CttlcuRb.d.ts} +1 -1
  59. package/dist/{proxy-request-headers-DGxdoyA0.d.cts → proxy-request-headers-pIBSn1Fw.d.cts} +1 -1
  60. package/dist/react.cjs +672 -16
  61. package/dist/react.cjs.map +1 -1
  62. package/dist/react.d.cts +123 -8
  63. package/dist/react.d.ts +123 -8
  64. package/dist/react.js +671 -17
  65. package/dist/react.js.map +1 -1
  66. package/dist/schema-handlers-BtT_IQFi.d.cts +138 -0
  67. package/dist/schema-handlers-VjFDhIMw.d.ts +138 -0
  68. package/dist/social-providers.d.cts +1 -1
  69. package/dist/social-providers.d.ts +1 -1
  70. package/dist/{types-D6tZ9aoq.d.ts → types-BDX8zS7w.d.ts} +40 -1
  71. package/dist/{types-AOY-GLu8.d.cts → types-BVKpQmfY.d.cts} +11 -0
  72. package/dist/{types-AOY-GLu8.d.ts → types-BVKpQmfY.d.ts} +11 -0
  73. package/dist/{types-DFr2cL1N.d.cts → types-D-Am7YSd.d.cts} +40 -1
  74. package/dist/utils.cjs +30 -0
  75. package/dist/utils.cjs.map +1 -1
  76. package/dist/utils.d.cts +3 -2
  77. package/dist/utils.d.ts +3 -2
  78. package/dist/utils.js +30 -1
  79. package/dist/utils.js.map +1 -1
  80. package/dist/{v3-client-CWfZHcKL.d.cts → v3-client-G1SLeHRa.d.cts} +23 -1
  81. package/dist/{v3-client-DZp2NEhK.d.ts → v3-client-ao8BWQ8v.d.ts} +23 -1
  82. package/package.json +16 -2
  83. package/dist/model-form-Dh0sisdL.d.ts +0 -97
  84. package/dist/model-form-oOAJUVd4.d.cts +0 -97
  85. package/dist/pipeline-CIzV9f7b.d.cts +0 -8
  86. package/dist/pipeline-DNlc8Ayn.d.ts +0 -8
package/dist/browser.js CHANGED
@@ -2003,7 +2003,7 @@ function buildAthenaGatewayUrl(baseUrl, path) {
2003
2003
 
2004
2004
  // package.json
2005
2005
  var package_default = {
2006
- version: "3.0.3"
2006
+ version: "3.3.0"
2007
2007
  };
2008
2008
 
2009
2009
  // src/sdk-version.ts
@@ -4763,6 +4763,14 @@ function createAuthModule(config = {}, runtimeOptions = {}) {
4763
4763
  changeEmailVerify: (input, options) => getWithQuery("/change-email/verify", input, options),
4764
4764
  deleteUserVerify: (input, options) => getWithQuery("/delete-user/verify", input, options),
4765
4765
  changePassword: (input, options) => postGeneric("/change-password", input, options),
4766
+ // Better Auth UI flat method aliases (also nested under session/account/social/user).
4767
+ listSessions: (input, options) => getGeneric("/list-sessions", input, options),
4768
+ revokeSession: sessionRevokeBinding,
4769
+ revokeOtherSessions,
4770
+ listAccounts: (input, options) => getGeneric("/list-accounts", input, options),
4771
+ unlinkAccount: (input, options) => postGeneric("/unlink-account", input, options),
4772
+ linkSocial: (input, options) => postGeneric("/link-social", input, options),
4773
+ updateUser: (input, options) => postGeneric("/update-user", input, options),
4766
4774
  user: {
4767
4775
  update: (input, options) => postGeneric("/update-user", input, options),
4768
4776
  delete: (input, options) => postGeneric("/delete-user", input, options),
@@ -10572,6 +10580,82 @@ function mergeAthenaRequestContexts(base, override) {
10572
10580
  };
10573
10581
  }
10574
10582
 
10583
+ // src/diagnostics.ts
10584
+ function readProcessEnv2() {
10585
+ try {
10586
+ return globalThis.process?.env ?? {};
10587
+ } catch {
10588
+ return {};
10589
+ }
10590
+ }
10591
+ function isTruthyEnv(value) {
10592
+ if (!value) return false;
10593
+ const normalized = value.trim().toLowerCase();
10594
+ return normalized === "1" || normalized === "true" || normalized === "yes" || normalized === "on";
10595
+ }
10596
+ function isQuietAthenaDiagnosticsEnvironment(env = readProcessEnv2()) {
10597
+ const nodeEnv = env.NODE_ENV?.trim().toLowerCase();
10598
+ if (nodeEnv === "production") {
10599
+ return true;
10600
+ }
10601
+ if (isTruthyEnv(env.OPENNEXT_BUILD)) {
10602
+ return true;
10603
+ }
10604
+ const nextPhase = env.NEXT_PHASE?.trim();
10605
+ if (nextPhase === "phase-production-build") {
10606
+ return true;
10607
+ }
10608
+ if (isTruthyEnv(env.CI) && nodeEnv !== "test") {
10609
+ if (nodeEnv === "production" || isTruthyEnv(env.OPENNEXT_BUILD)) {
10610
+ return true;
10611
+ }
10612
+ }
10613
+ return false;
10614
+ }
10615
+ function resolveBooleanFlag(explicit, mode, quiet) {
10616
+ if (typeof explicit === "boolean") {
10617
+ return explicit;
10618
+ }
10619
+ if (mode === true) {
10620
+ return true;
10621
+ }
10622
+ if (mode === false) {
10623
+ return false;
10624
+ }
10625
+ if (mode === "auto") {
10626
+ return false;
10627
+ }
10628
+ return false;
10629
+ }
10630
+ function resolveAthenaClientDiagnostics(input) {
10631
+ const env = input.env ?? readProcessEnv2();
10632
+ const quiet = isQuietAthenaDiagnosticsEnvironment(env);
10633
+ const mode = input.diagnostics;
10634
+ const effectiveMode = mode === "auto" && quiet ? false : mode;
10635
+ const debugAst = resolveBooleanFlag(input.debugAst, effectiveMode);
10636
+ const findManyAst = resolveBooleanFlag(input.findManyAst, effectiveMode);
10637
+ let traceQueries;
10638
+ if (input.traceQueries !== void 0) {
10639
+ if (typeof input.traceQueries === "boolean") {
10640
+ traceQueries = input.traceQueries;
10641
+ } else if (effectiveMode === false || mode === "auto" && quiet) {
10642
+ const enabled = input.traceQueries.enabled;
10643
+ traceQueries = typeof enabled === "boolean" ? enabled ? input.traceQueries : false : false;
10644
+ } else {
10645
+ traceQueries = input.traceQueries;
10646
+ }
10647
+ } else if (effectiveMode === true) {
10648
+ traceQueries = true;
10649
+ } else {
10650
+ traceQueries = false;
10651
+ }
10652
+ return {
10653
+ debugAst,
10654
+ findManyAst,
10655
+ traceQueries
10656
+ };
10657
+ }
10658
+
10575
10659
  // src/v3-client.ts
10576
10660
  var ENV_URL_KEYS = ["ATHENA_URL", "NEXT_PUBLIC_ATHENA_URL"];
10577
10661
  var ENV_DB_URL_KEYS = ["ATHENA_DB_URL", "ATHENA_GATEWAY_URL", "NEXT_PUBLIC_ATHENA_DB_API_URL"];
@@ -10580,7 +10664,13 @@ var ENV_CHAT_URL_KEYS = ["ATHENA_CHAT_URL", "NEXT_PUBLIC_ATHENA_CHAT_URL"];
10580
10664
  var ENV_CHAT_WS_URL_KEYS = ["ATHENA_CHAT_WS_URL", "NEXT_PUBLIC_ATHENA_CHAT_WS_URL"];
10581
10665
  var ENV_STORAGE_URL_KEYS = ["ATHENA_STORAGE_URL", "NEXT_PUBLIC_ATHENA_STORAGE_URL"];
10582
10666
  var ENV_KEY_KEYS = ["ATHENA_API_KEY", "NEXT_PUBLIC_ATHENA_API_KEY", "ATHENA_GATEWAY_API_KEY", "X_API_KEY"];
10583
- var ENV_CLIENT_KEYS = ["ATHENA_CLIENT", "NEXT_PUBLIC_ATHENA_CLIENT"];
10667
+ var ENV_CLIENT_KEYS = [
10668
+ "ATHENA_CLIENT",
10669
+ "ATHENA_GATEWAY_CLIENT",
10670
+ "ATHENA_GENERATOR_CLIENT",
10671
+ "NEXT_PUBLIC_ATHENA_CLIENT",
10672
+ "NEXT_PUBLIC_ATHENA_GATEWAY_CLIENT"
10673
+ ];
10584
10674
  var MISSING_DB_SENTINEL = "https://athena.invalid/db";
10585
10675
  function readFirstEnv(env, keys) {
10586
10676
  for (const key of keys) {
@@ -10655,6 +10745,13 @@ function createInternalConfig(core) {
10655
10745
  const { config, urls } = core;
10656
10746
  const { url: _authUrl, ...authOptions } = config.auth ?? {};
10657
10747
  const { url: _storageUrl, directUpload, ...storageOptions } = config.storage ?? {};
10748
+ const diagnostics = resolveAthenaClientDiagnostics({
10749
+ diagnostics: config.diagnostics,
10750
+ debugAst: config.debugAst,
10751
+ findManyAst: config.findManyAst,
10752
+ traceQueries: config.traceQueries,
10753
+ env: config.env
10754
+ });
10658
10755
  return {
10659
10756
  baseUrl: urls.db ?? MISSING_DB_SENTINEL,
10660
10757
  apiKey: core.key,
@@ -10671,9 +10768,9 @@ function createInternalConfig(core) {
10671
10768
  models: config.models,
10672
10769
  behavior: {
10673
10770
  retryReads: config.retryReads,
10674
- traceQueries: config.traceQueries,
10675
- debugAst: config.debugAst,
10676
- findManyAst: config.findManyAst
10771
+ traceQueries: diagnostics.traceQueries,
10772
+ debugAst: diagnostics.debugAst,
10773
+ findManyAst: diagnostics.findManyAst
10677
10774
  },
10678
10775
  storage: {
10679
10776
  ...storageOptions,
@@ -10747,11 +10844,30 @@ function createClientView(core, viewContext) {
10747
10844
  return resolved.verifyConnection(options);
10748
10845
  },
10749
10846
  withContext(context) {
10847
+ warnIfEmptyRequestContext(context);
10750
10848
  return createClientView(core, mergeAthenaRequestContexts(viewContext, context));
10751
10849
  }
10752
10850
  };
10753
10851
  return Object.freeze(client);
10754
10852
  }
10853
+ function isEmptyAthenaRequestContext(context) {
10854
+ if (!context) return true;
10855
+ const hasHeaders = context.headers != null && Object.keys(context.headers).length > 0;
10856
+ return context.userId == null && context.organizationId == null && !normalizeOptionalContextString(context.cookie) && !normalizeOptionalContextString(context.bearerToken) && !normalizeOptionalContextString(context.sessionToken) && !context.forceNoCache && !hasHeaders;
10857
+ }
10858
+ function normalizeOptionalContextString(value) {
10859
+ const trimmed = value?.trim();
10860
+ return trimmed || void 0;
10861
+ }
10862
+ function warnIfEmptyRequestContext(context) {
10863
+ if (!isEmptyAthenaRequestContext(context)) return;
10864
+ if (typeof process !== "undefined" && process.env?.NODE_ENV === "production") {
10865
+ return;
10866
+ }
10867
+ console.warn(
10868
+ "[athena] withContext({}) has no userId, organizationId, cookie, bearerToken, sessionToken, headers, or forceNoCache. Gateway scope headers will not change. Pass identity fields, or use createAthenaServerClient({ session, scope })."
10869
+ );
10870
+ }
10755
10871
  function createClient(config) {
10756
10872
  return createClientView(resolveCore(config));
10757
10873
  }
@@ -11881,6 +11997,765 @@ function athenaAuth(config) {
11881
11997
  return auth;
11882
11998
  }
11883
11999
 
12000
+ // src/query/read-query.ts
12001
+ function normalizeAthenaReadQueryOrderBy(orderBy) {
12002
+ if (!orderBy) {
12003
+ return [];
12004
+ }
12005
+ const list = Array.isArray(orderBy) ? orderBy : [orderBy];
12006
+ return list.filter(
12007
+ (entry) => entry && typeof entry.column === "string" && entry.column.trim().length > 0
12008
+ );
12009
+ }
12010
+ function isRecord14(value) {
12011
+ return typeof value === "object" && value !== null && !Array.isArray(value);
12012
+ }
12013
+ function flattenAthenaRowValue(row, column) {
12014
+ if (!column.relation) {
12015
+ return row[column.column];
12016
+ }
12017
+ const relationValue = row[column.relation.name];
12018
+ if (Array.isArray(relationValue)) {
12019
+ return relationValue.map((entry) => isRecord14(entry) ? entry[column.column] : void 0).filter((entry) => entry !== void 0);
12020
+ }
12021
+ if (isRecord14(relationValue)) {
12022
+ return relationValue[column.column];
12023
+ }
12024
+ return void 0;
12025
+ }
12026
+ function resolveFlatRowKey(row, index, preferredKey) {
12027
+ const preferredValue = preferredKey && preferredKey in row ? row[preferredKey] : void 0;
12028
+ if (preferredValue !== void 0 && preferredValue !== null && `${preferredValue}`.trim().length > 0) {
12029
+ return String(preferredValue);
12030
+ }
12031
+ for (const [key, value] of Object.entries(row)) {
12032
+ if (key === "__rowKey") {
12033
+ continue;
12034
+ }
12035
+ if (value === void 0 || value === null) {
12036
+ continue;
12037
+ }
12038
+ if (Array.isArray(value)) {
12039
+ if (value.length > 0) {
12040
+ return `${key}-${value.join("-")}`;
12041
+ }
12042
+ continue;
12043
+ }
12044
+ const nextValue = String(value).trim();
12045
+ if (nextValue.length > 0) {
12046
+ return nextValue;
12047
+ }
12048
+ }
12049
+ return `row-${index + 1}`;
12050
+ }
12051
+ function flattenAthenaReadQueryRows(rows, columns, preferredKey) {
12052
+ return rows.map((entry, index) => {
12053
+ const sourceRow = isRecord14(entry) ? entry : {};
12054
+ const flatRow = columns.reduce(
12055
+ (currentRow, column) => {
12056
+ currentRow[column.key] = flattenAthenaRowValue(sourceRow, column);
12057
+ return currentRow;
12058
+ },
12059
+ { __rowKey: "" }
12060
+ );
12061
+ flatRow.__rowKey = resolveFlatRowKey(flatRow, index, preferredKey);
12062
+ return flatRow;
12063
+ });
12064
+ }
12065
+ var flattenAthenaRows = flattenAthenaReadQueryRows;
12066
+ function buildAthenaReadQuerySelectString(columns) {
12067
+ const baseColumns = columns.filter((column) => !column.relation).map((column) => column.column);
12068
+ const relationGroups = /* @__PURE__ */ new Map();
12069
+ for (const column of columns) {
12070
+ if (!column.relation) {
12071
+ continue;
12072
+ }
12073
+ const groupKey = [
12074
+ column.relation.name,
12075
+ column.relation.schema ?? "",
12076
+ column.relation.table
12077
+ ].join(":");
12078
+ const existingGroup = relationGroups.get(groupKey);
12079
+ if (existingGroup) {
12080
+ if (!existingGroup.columns.includes(column.column)) {
12081
+ existingGroup.columns.push(column.column);
12082
+ }
12083
+ continue;
12084
+ }
12085
+ relationGroups.set(groupKey, {
12086
+ columns: [column.column],
12087
+ relation: column.relation
12088
+ });
12089
+ }
12090
+ const relationColumns = [...relationGroups.values()].map(
12091
+ ({ columns: relationColumns2, relation }) => {
12092
+ const relationTarget = relation.schema ? `${relation.schema}.${relation.table}` : relation.table;
12093
+ return `${relation.name}:${relationTarget}(${relationColumns2.join(",")})`;
12094
+ }
12095
+ );
12096
+ return [...baseColumns, ...relationColumns].join(",");
12097
+ }
12098
+ var buildAthenaTableSelectString = buildAthenaReadQuerySelectString;
12099
+ function buildAthenaReadQueryFindManySelect(columns) {
12100
+ const select = {};
12101
+ for (const column of columns) {
12102
+ if (!column.relation) {
12103
+ select[column.column] = true;
12104
+ continue;
12105
+ }
12106
+ const existingRelation = select[column.relation.name];
12107
+ if (existingRelation && existingRelation !== true && isRecord14(existingRelation.select)) {
12108
+ existingRelation.select[column.column] = true;
12109
+ continue;
12110
+ }
12111
+ select[column.relation.name] = {
12112
+ ...column.relation.schema ? { schema: column.relation.schema } : {},
12113
+ select: {
12114
+ [column.column]: true
12115
+ }
12116
+ };
12117
+ }
12118
+ return select;
12119
+ }
12120
+ var buildAthenaTableFindManySelect = buildAthenaReadQueryFindManySelect;
12121
+ function buildAthenaReadQueryFindManyWhere(filters) {
12122
+ if (!filters?.length) {
12123
+ return;
12124
+ }
12125
+ return filters.reduce(
12126
+ (where, filter) => {
12127
+ const operator = filter.operator ?? "eq";
12128
+ where[filter.column] = operator === "eq" ? filter.value : { [operator]: filter.value };
12129
+ return where;
12130
+ },
12131
+ {}
12132
+ );
12133
+ }
12134
+ var buildAthenaTableFindManyWhere = buildAthenaReadQueryFindManyWhere;
12135
+ function buildAthenaReadQueryFindManyOrderBy(orderBy) {
12136
+ const normalized = normalizeAthenaReadQueryOrderBy(orderBy);
12137
+ if (normalized.length === 0) {
12138
+ return;
12139
+ }
12140
+ if (normalized.length === 1) {
12141
+ const primary = normalized[0];
12142
+ if (!primary) {
12143
+ return;
12144
+ }
12145
+ return {
12146
+ ascending: primary.direction !== "desc",
12147
+ column: primary.column
12148
+ };
12149
+ }
12150
+ return Object.fromEntries(
12151
+ normalized.map((entry) => [
12152
+ entry.column,
12153
+ entry.direction === "desc" ? "desc" : "asc"
12154
+ ])
12155
+ );
12156
+ }
12157
+ var buildAthenaTableFindManyOrderBy = buildAthenaReadQueryFindManyOrderBy;
12158
+ var normalizeAthenaTableOrderBy = normalizeAthenaReadQueryOrderBy;
12159
+ function applyAthenaReadQueryFilters(queryBuilder, filters) {
12160
+ if (!filters?.length) {
12161
+ return queryBuilder;
12162
+ }
12163
+ return filters.reduce((currentBuilder, filter) => {
12164
+ const operator = filter.operator ?? "eq";
12165
+ const builderMethod = currentBuilder[operator];
12166
+ if (typeof builderMethod !== "function") {
12167
+ return currentBuilder;
12168
+ }
12169
+ return builderMethod.call(currentBuilder, filter.column, filter.value);
12170
+ }, queryBuilder);
12171
+ }
12172
+ var applyAthenaTableFilters = applyAthenaReadQueryFilters;
12173
+ function applyAthenaReadQuerySelectOrder(queryBuilder, orderBy) {
12174
+ const normalized = normalizeAthenaReadQueryOrderBy(orderBy);
12175
+ if (normalized.length === 0) {
12176
+ return queryBuilder;
12177
+ }
12178
+ return normalized.reduce(
12179
+ (builder, entry) => builder.order(entry.column, {
12180
+ ascending: entry.direction !== "desc"
12181
+ }),
12182
+ queryBuilder
12183
+ );
12184
+ }
12185
+ var applyAthenaTableSelectOrder = applyAthenaReadQuerySelectOrder;
12186
+ function applyAthenaReadQuerySelectLimit(queryBuilder, limit) {
12187
+ if (!limit || limit < 1) {
12188
+ return queryBuilder;
12189
+ }
12190
+ return queryBuilder.limit(limit);
12191
+ }
12192
+ var applyAthenaTableSelectLimit = applyAthenaReadQuerySelectLimit;
12193
+ function clampAthenaReadQueryTotalItems(totalItems, limit) {
12194
+ if (!limit || limit < 1) {
12195
+ return totalItems;
12196
+ }
12197
+ return Math.min(totalItems, limit);
12198
+ }
12199
+ var clampAthenaTableTotalItems = clampAthenaReadQueryTotalItems;
12200
+ function resolveCountValue(...candidates) {
12201
+ for (const candidate of candidates) {
12202
+ if (typeof candidate === "number" && Number.isFinite(candidate)) {
12203
+ return Math.max(0, Math.trunc(candidate));
12204
+ }
12205
+ }
12206
+ return 0;
12207
+ }
12208
+ function resolveTotalItemsFromPage({
12209
+ countCandidates,
12210
+ limit,
12211
+ page,
12212
+ pageSize,
12213
+ rowCount
12214
+ }) {
12215
+ const exactCount = resolveCountValue(...countCandidates);
12216
+ if (exactCount > 0) {
12217
+ return clampAthenaReadQueryTotalItems(exactCount, limit);
12218
+ }
12219
+ if (rowCount > 0) {
12220
+ const base = (page - 1) * pageSize + rowCount;
12221
+ const synthetic = rowCount >= pageSize ? base + 1 : base;
12222
+ return clampAthenaReadQueryTotalItems(synthetic, limit);
12223
+ }
12224
+ return clampAthenaReadQueryTotalItems(exactCount, limit);
12225
+ }
12226
+ function resolveAthenaReadQueryPageFetch({
12227
+ page,
12228
+ pageSize,
12229
+ limit
12230
+ }) {
12231
+ const safePage = Math.max(1, Math.trunc(page) || 1);
12232
+ const safePageSize = Math.max(1, Math.trunc(pageSize) || 1);
12233
+ if (!limit || limit < 1) {
12234
+ return { page: safePage, pageSize: safePageSize, shouldFetch: true };
12235
+ }
12236
+ const totalCap = Math.trunc(limit);
12237
+ const offset = (safePage - 1) * safePageSize;
12238
+ if (offset >= totalCap) {
12239
+ return { page: safePage, pageSize: safePageSize, shouldFetch: false };
12240
+ }
12241
+ return {
12242
+ page: safePage,
12243
+ pageSize: Math.min(safePageSize, totalCap - offset),
12244
+ shouldFetch: true
12245
+ };
12246
+ }
12247
+ async function executeAthenaReadQuery({
12248
+ client,
12249
+ page,
12250
+ pageSize,
12251
+ query
12252
+ }) {
12253
+ const db = client.db;
12254
+ const baseBuilder = db.from(query.table, {
12255
+ schema: query.schema
12256
+ });
12257
+ const countBuilder = applyAthenaReadQueryFilters(
12258
+ db.from(query.table, { schema: query.schema }),
12259
+ query.filters
12260
+ );
12261
+ const countResult = await countBuilder.select(query.countColumn, {
12262
+ count: "exact",
12263
+ head: true
12264
+ });
12265
+ const pageFetch = resolveAthenaReadQueryPageFetch({
12266
+ limit: query.limit,
12267
+ page,
12268
+ pageSize
12269
+ });
12270
+ if (!pageFetch.shouldFetch) {
12271
+ return {
12272
+ rows: [],
12273
+ totalItems: resolveTotalItemsFromPage({
12274
+ countCandidates: [countResult.count],
12275
+ limit: query.limit,
12276
+ page: pageFetch.page,
12277
+ pageSize,
12278
+ rowCount: 0
12279
+ })
12280
+ };
12281
+ }
12282
+ if ((query.mode ?? "findMany") === "select") {
12283
+ const selectBuilder = applyAthenaReadQuerySelectOrder(
12284
+ applyAthenaReadQueryFilters(baseBuilder, query.filters),
12285
+ query.orderBy
12286
+ );
12287
+ const result2 = await selectBuilder.currentPage(pageFetch.page).pageSize(pageFetch.pageSize).select(buildAthenaReadQuerySelectString(query.columns), {
12288
+ count: "exact"
12289
+ });
12290
+ const rows2 = flattenAthenaReadQueryRows(
12291
+ Array.isArray(result2.data) ? result2.data : [],
12292
+ query.columns,
12293
+ query.rowKey
12294
+ );
12295
+ return {
12296
+ debugAst: getAthenaDebugAst(result2) ?? void 0,
12297
+ rows: rows2,
12298
+ totalItems: resolveTotalItemsFromPage({
12299
+ countCandidates: [countResult.count, result2.count],
12300
+ limit: query.limit,
12301
+ page: pageFetch.page,
12302
+ pageSize,
12303
+ rowCount: rows2.length
12304
+ })
12305
+ };
12306
+ }
12307
+ const findManyOrderBy = buildAthenaReadQueryFindManyOrderBy(query.orderBy);
12308
+ const findManyOptions = {
12309
+ ...findManyOrderBy ? { orderBy: findManyOrderBy } : {},
12310
+ select: buildAthenaReadQueryFindManySelect(query.columns),
12311
+ ...query.filters?.length ? { where: buildAthenaReadQueryFindManyWhere(query.filters) } : {}
12312
+ };
12313
+ const result = await baseBuilder.currentPage(pageFetch.page).pageSize(pageFetch.pageSize).findMany(findManyOptions);
12314
+ const rows = flattenAthenaReadQueryRows(
12315
+ Array.isArray(result.data) ? result.data : [],
12316
+ query.columns,
12317
+ query.rowKey
12318
+ );
12319
+ return {
12320
+ debugAst: getAthenaDebugAst(result) ?? void 0,
12321
+ rows,
12322
+ totalItems: resolveTotalItemsFromPage({
12323
+ countCandidates: [countResult.count, result.count],
12324
+ limit: query.limit,
12325
+ page: pageFetch.page,
12326
+ pageSize,
12327
+ rowCount: rows.length
12328
+ })
12329
+ };
12330
+ }
12331
+ var executeAthenaTableQuery = executeAthenaReadQuery;
12332
+
12333
+ // src/tables/catalog.ts
12334
+ var POSTGRES_CATALOG_SQL = {
12335
+ columns: `
12336
+ SELECT
12337
+ n.nspname AS schema_name,
12338
+ c.relname AS table_name,
12339
+ a.attname AS column_name,
12340
+ format_type(a.atttypid, a.atttypmod) AS data_type,
12341
+ NOT a.attnotnull AS is_nullable
12342
+ FROM pg_attribute a
12343
+ JOIN pg_class c ON c.oid = a.attrelid
12344
+ JOIN pg_namespace n ON n.oid = c.relnamespace
12345
+ WHERE c.relkind IN ('r', 'p')
12346
+ AND a.attnum > 0
12347
+ AND NOT a.attisdropped
12348
+ AND n.nspname = ANY($1::text[])
12349
+ ORDER BY n.nspname, c.relname, a.attnum;
12350
+ `,
12351
+ foreignKeys: `
12352
+ SELECT
12353
+ sn.nspname AS source_schema,
12354
+ sc.relname AS source_table,
12355
+ con.conname AS constraint_name,
12356
+ ARRAY_AGG(sa.attname ORDER BY cols.ordinality) AS source_columns,
12357
+ tn.nspname AS target_schema,
12358
+ tc.relname AS target_table,
12359
+ ARRAY_AGG(ta.attname ORDER BY cols.ordinality) AS target_columns,
12360
+ EXISTS (
12361
+ SELECT 1
12362
+ FROM pg_constraint uq
12363
+ WHERE uq.conrelid = con.conrelid
12364
+ AND uq.contype IN ('p', 'u')
12365
+ AND uq.conkey = con.conkey
12366
+ ) AS source_is_unique
12367
+ FROM pg_constraint con
12368
+ JOIN pg_class sc ON sc.oid = con.conrelid
12369
+ JOIN pg_namespace sn ON sn.oid = sc.relnamespace
12370
+ JOIN pg_class tc ON tc.oid = con.confrelid
12371
+ JOIN pg_namespace tn ON tn.oid = tc.relnamespace
12372
+ JOIN unnest(con.conkey, con.confkey) WITH ORDINALITY AS cols(source_attnum, target_attnum, ordinality) ON TRUE
12373
+ JOIN pg_attribute sa ON sa.attrelid = con.conrelid AND sa.attnum = cols.source_attnum
12374
+ JOIN pg_attribute ta ON ta.attrelid = con.confrelid AND ta.attnum = cols.target_attnum
12375
+ WHERE con.contype = 'f'
12376
+ AND sn.nspname = ANY($1::text[])
12377
+ AND tn.nspname = ANY($1::text[])
12378
+ GROUP BY
12379
+ sn.nspname,
12380
+ sc.relname,
12381
+ con.conname,
12382
+ tn.nspname,
12383
+ tc.relname,
12384
+ con.conkey,
12385
+ con.conrelid
12386
+ ORDER BY sn.nspname, sc.relname, con.conname;
12387
+ `,
12388
+ primaryKeys: `
12389
+ SELECT
12390
+ n.nspname AS schema_name,
12391
+ c.relname AS table_name,
12392
+ ARRAY_AGG(a.attname ORDER BY ck.ordinality) AS columns
12393
+ FROM pg_constraint con
12394
+ JOIN pg_class c ON c.oid = con.conrelid
12395
+ JOIN pg_namespace n ON n.oid = c.relnamespace
12396
+ JOIN unnest(con.conkey) WITH ORDINALITY AS ck(attnum, ordinality) ON TRUE
12397
+ JOIN pg_attribute a ON a.attrelid = c.oid AND a.attnum = ck.attnum
12398
+ WHERE con.contype = 'p'
12399
+ AND n.nspname = ANY($1::text[])
12400
+ GROUP BY n.nspname, c.relname
12401
+ ORDER BY n.nspname, c.relname;
12402
+ `
12403
+ };
12404
+ function parseAthenaTableSchemaScope(value) {
12405
+ return value.split(",").map((entry) => entry.trim()).filter(
12406
+ (entry, index, values) => entry.length > 0 && values.indexOf(entry) === index
12407
+ );
12408
+ }
12409
+ function escapeSqlLiteral(value) {
12410
+ return value.replace(/'/g, "''");
12411
+ }
12412
+ function buildSchemaArrayLiteral(schemas) {
12413
+ const literals = schemas.map((schema) => `'${escapeSqlLiteral(schema)}'`).join(", ");
12414
+ return `ARRAY[${literals}]`;
12415
+ }
12416
+ function inlineSchemaLiteral(sql, schemas) {
12417
+ return sql.replace(
12418
+ /\$1::text\[\]/g,
12419
+ `${buildSchemaArrayLiteral(schemas)}::text[]`
12420
+ );
12421
+ }
12422
+ function buildAthenaTableCatalogQueries(schemas) {
12423
+ return {
12424
+ columns: inlineSchemaLiteral(POSTGRES_CATALOG_SQL.columns, schemas),
12425
+ foreignKeys: inlineSchemaLiteral(POSTGRES_CATALOG_SQL.foreignKeys, schemas),
12426
+ primaryKeys: inlineSchemaLiteral(POSTGRES_CATALOG_SQL.primaryKeys, schemas)
12427
+ };
12428
+ }
12429
+ function tableKey(schema, table2) {
12430
+ return `${schema}.${table2}`;
12431
+ }
12432
+ function relationKey(...parts) {
12433
+ const base = parts.join("_").replace(/[^A-Za-z0-9_]+/g, "_").replace(/^_+|_+$/g, "");
12434
+ return base.length > 0 ? base : "relation";
12435
+ }
12436
+ function parsePostgresArrayLiteral(text) {
12437
+ const body = text.slice(1, -1).trim();
12438
+ if (!body) {
12439
+ return [];
12440
+ }
12441
+ const values = [];
12442
+ let current = "";
12443
+ let inQuotes = false;
12444
+ let escaped = false;
12445
+ for (const char of body) {
12446
+ if (escaped) {
12447
+ current += char;
12448
+ escaped = false;
12449
+ continue;
12450
+ }
12451
+ if (char === "\\") {
12452
+ escaped = true;
12453
+ continue;
12454
+ }
12455
+ if (char === '"') {
12456
+ inQuotes = !inQuotes;
12457
+ continue;
12458
+ }
12459
+ if (char === "," && !inQuotes) {
12460
+ values.push(current);
12461
+ current = "";
12462
+ continue;
12463
+ }
12464
+ current += char;
12465
+ }
12466
+ values.push(current);
12467
+ return values.map((value) => value.trim()).filter((value) => value.length > 0);
12468
+ }
12469
+ function coerceStringArray(value) {
12470
+ if (value == null) {
12471
+ return [];
12472
+ }
12473
+ if (Array.isArray(value)) {
12474
+ return value.map((entry) => entry.trim()).filter(Boolean);
12475
+ }
12476
+ if (typeof value !== "string") {
12477
+ return [];
12478
+ }
12479
+ const trimmedValue = value.trim();
12480
+ if (!trimmedValue) {
12481
+ return [];
12482
+ }
12483
+ if (trimmedValue.startsWith("{") && trimmedValue.endsWith("}")) {
12484
+ return parsePostgresArrayLiteral(trimmedValue);
12485
+ }
12486
+ return trimmedValue.split(",").map((entry) => entry.trim()).filter(Boolean);
12487
+ }
12488
+ function createTableCatalog() {
12489
+ const tables = /* @__PURE__ */ new Map();
12490
+ const ensureTable = (schema, name) => {
12491
+ const id = tableKey(schema, name);
12492
+ const existingTable = tables.get(id);
12493
+ if (existingTable) {
12494
+ return existingTable;
12495
+ }
12496
+ const nextTable = {
12497
+ columns: [],
12498
+ id,
12499
+ name,
12500
+ primaryKey: [],
12501
+ relationMap: /* @__PURE__ */ new Map(),
12502
+ schema
12503
+ };
12504
+ tables.set(id, nextTable);
12505
+ return nextTable;
12506
+ };
12507
+ const upsertRelation = (table2, key, relation) => {
12508
+ table2.relationMap.set(key, relation);
12509
+ };
12510
+ return {
12511
+ addColumnRows(columnRows) {
12512
+ for (const row of columnRows) {
12513
+ const table2 = ensureTable(row.schema_name, row.table_name);
12514
+ table2.columns.push({
12515
+ dataType: row.data_type,
12516
+ isNullable: row.is_nullable,
12517
+ isPrimaryKey: false,
12518
+ name: row.column_name
12519
+ });
12520
+ }
12521
+ },
12522
+ addForeignKeyRows(foreignKeyRows) {
12523
+ for (const row of foreignKeyRows) {
12524
+ const sourceTable = ensureTable(row.source_schema, row.source_table);
12525
+ const targetTable = ensureTable(row.target_schema, row.target_table);
12526
+ upsertRelation(
12527
+ sourceTable,
12528
+ relationKey(row.constraint_name, row.target_table),
12529
+ {
12530
+ name: row.constraint_name,
12531
+ targetSchema: row.target_schema,
12532
+ targetTable: row.target_table
12533
+ }
12534
+ );
12535
+ upsertRelation(targetTable, relationKey(row.source_table), {
12536
+ name: relationKey(row.source_table, row.constraint_name),
12537
+ targetSchema: row.source_schema,
12538
+ targetTable: row.source_table
12539
+ });
12540
+ }
12541
+ },
12542
+ addManyToManyRows(foreignKeyRows) {
12543
+ const foreignKeysBySourceTable = /* @__PURE__ */ new Map();
12544
+ for (const foreignKey of foreignKeyRows) {
12545
+ const key = tableKey(foreignKey.source_schema, foreignKey.source_table);
12546
+ const current = foreignKeysBySourceTable.get(key) ?? {
12547
+ foreignKeys: [],
12548
+ schema: foreignKey.source_schema,
12549
+ table: foreignKey.source_table
12550
+ };
12551
+ current.foreignKeys.push(foreignKey);
12552
+ foreignKeysBySourceTable.set(key, current);
12553
+ }
12554
+ for (const candidate of foreignKeysBySourceTable.values()) {
12555
+ const bridgeTable = tables.get(
12556
+ tableKey(candidate.schema, candidate.table)
12557
+ );
12558
+ if (!bridgeTable || candidate.foreignKeys.length !== 2) {
12559
+ continue;
12560
+ }
12561
+ const combinedForeignColumns = Array.from(
12562
+ new Set(
12563
+ candidate.foreignKeys.flatMap(
12564
+ (foreignKey) => coerceStringArray(foreignKey.source_columns)
12565
+ )
12566
+ )
12567
+ );
12568
+ if (bridgeTable.primaryKey.length === 0 || combinedForeignColumns.length !== bridgeTable.primaryKey.length || !bridgeTable.primaryKey.every(
12569
+ (column) => combinedForeignColumns.includes(column)
12570
+ )) {
12571
+ continue;
12572
+ }
12573
+ const [firstForeignKey, secondForeignKey] = candidate.foreignKeys;
12574
+ const firstTarget = tables.get(
12575
+ tableKey(firstForeignKey.target_schema, firstForeignKey.target_table)
12576
+ );
12577
+ const secondTarget = tables.get(
12578
+ tableKey(
12579
+ secondForeignKey.target_schema,
12580
+ secondForeignKey.target_table
12581
+ )
12582
+ );
12583
+ if (!(firstTarget && secondTarget)) {
12584
+ continue;
12585
+ }
12586
+ upsertRelation(
12587
+ firstTarget,
12588
+ relationKey(candidate.table, secondForeignKey.target_table),
12589
+ {
12590
+ name: relationKey(
12591
+ candidate.table,
12592
+ secondForeignKey.constraint_name
12593
+ ),
12594
+ targetSchema: secondForeignKey.target_schema,
12595
+ targetTable: secondForeignKey.target_table
12596
+ }
12597
+ );
12598
+ upsertRelation(
12599
+ secondTarget,
12600
+ relationKey(candidate.table, firstForeignKey.target_table),
12601
+ {
12602
+ name: relationKey(candidate.table, firstForeignKey.constraint_name),
12603
+ targetSchema: firstForeignKey.target_schema,
12604
+ targetTable: firstForeignKey.target_table
12605
+ }
12606
+ );
12607
+ }
12608
+ },
12609
+ addPrimaryKeyRows(primaryKeyRows) {
12610
+ for (const row of primaryKeyRows) {
12611
+ const table2 = ensureTable(row.schema_name, row.table_name);
12612
+ const primaryKey = coerceStringArray(row.columns);
12613
+ table2.primaryKey = primaryKey;
12614
+ for (const columnName of primaryKey) {
12615
+ const column = table2.columns.find(
12616
+ (candidate) => candidate.name === columnName
12617
+ );
12618
+ if (column) {
12619
+ column.isPrimaryKey = true;
12620
+ }
12621
+ }
12622
+ }
12623
+ },
12624
+ toResponse(database) {
12625
+ return {
12626
+ database,
12627
+ generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
12628
+ tables: [...tables.values()].map((table2) => ({
12629
+ columns: [...table2.columns].sort(
12630
+ (left, right) => left.name.localeCompare(right.name)
12631
+ ),
12632
+ id: table2.id,
12633
+ name: table2.name,
12634
+ primaryKey: [...table2.primaryKey],
12635
+ relations: [...table2.relationMap.values()].map((relation) => ({
12636
+ columns: tables.get(
12637
+ tableKey(relation.targetSchema, relation.targetTable)
12638
+ )?.columns ?? [],
12639
+ name: relation.name,
12640
+ targetSchema: relation.targetSchema,
12641
+ targetTable: relation.targetTable
12642
+ })).sort(
12643
+ (left, right) => left.name.localeCompare(right.name)
12644
+ ),
12645
+ schema: table2.schema
12646
+ })).sort(
12647
+ (left, right) => left.id.localeCompare(right.id)
12648
+ )
12649
+ };
12650
+ }
12651
+ };
12652
+ }
12653
+ async function queryRows(client, query) {
12654
+ const result = await client.query(query);
12655
+ if (result.error || result.status < 200 || result.status >= 300) {
12656
+ const errorMessage = typeof result.error === "string" ? result.error : result.error && typeof result.error === "object" && "message" in result.error && typeof result.error.message === "string" ? result.error.message : `Athena gateway query failed with status ${result.status}.`;
12657
+ throw new Error(errorMessage);
12658
+ }
12659
+ return Array.isArray(result.data) ? result.data : [];
12660
+ }
12661
+ function isAthenaTableSchemaConfig(value) {
12662
+ if (typeof value !== "object" || value === null) {
12663
+ return false;
12664
+ }
12665
+ const config = value;
12666
+ return typeof config.gatewayUrl === "string" && typeof config.gatewayKey === "string" && typeof config.gatewayDatabase === "string" && typeof config.schemaScope === "string" && typeof config.clientName === "string";
12667
+ }
12668
+ function hasAthenaTableSchemaCredentials(config) {
12669
+ return config.gatewayUrl.trim().length > 0 && config.gatewayKey.trim().length > 0 && config.gatewayDatabase.trim().length > 0;
12670
+ }
12671
+ async function fetchAthenaTableCatalog(config, options = {}) {
12672
+ const schemas = parseAthenaTableSchemaScope(config.schemaScope);
12673
+ if (schemas.length === 0) {
12674
+ return {
12675
+ database: config.gatewayDatabase,
12676
+ generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
12677
+ tables: []
12678
+ };
12679
+ }
12680
+ const queries = buildAthenaTableCatalogQueries(schemas);
12681
+ const client = options.client ?? createClient({
12682
+ url: config.gatewayUrl.trim(),
12683
+ key: config.gatewayKey.trim(),
12684
+ client: config.clientName.trim() || void 0
12685
+ });
12686
+ const [columnRows, primaryKeyRows, foreignKeyRows] = await Promise.all([
12687
+ queryRows(client, queries.columns),
12688
+ queryRows(client, queries.primaryKeys),
12689
+ queryRows(client, queries.foreignKeys)
12690
+ ]);
12691
+ const catalog = createTableCatalog();
12692
+ catalog.addColumnRows(columnRows);
12693
+ catalog.addPrimaryKeyRows(primaryKeyRows);
12694
+ catalog.addForeignKeyRows(foreignKeyRows);
12695
+ catalog.addManyToManyRows(foreignKeyRows);
12696
+ return catalog.toResponse(config.gatewayDatabase);
12697
+ }
12698
+ var fetchTableCatalog = fetchAthenaTableCatalog;
12699
+
12700
+ // src/tables/schema-handlers.ts
12701
+ var ATHENA_TABLE_SCHEMA_ROUTE = "/api/tables/schema";
12702
+ function json2(body, init) {
12703
+ const headers = new Headers(init?.headers);
12704
+ if (!headers.has("content-type")) {
12705
+ headers.set("content-type", "application/json; charset=utf-8");
12706
+ }
12707
+ return new Response(JSON.stringify(body), {
12708
+ status: init?.status ?? 200,
12709
+ headers
12710
+ });
12711
+ }
12712
+ async function handleAthenaTableSchemaPost(request2, options) {
12713
+ const payload = await request2.json().catch(() => null);
12714
+ let config = isAthenaTableSchemaConfig(
12715
+ payload?.config
12716
+ ) ? payload.config : null;
12717
+ if (config && options?.resolveConfig) {
12718
+ config = await options.resolveConfig(config, request2);
12719
+ }
12720
+ if (!config || !isAthenaTableSchemaConfig(config)) {
12721
+ return json2(
12722
+ {
12723
+ error: "The Athena tables showcase config is invalid."
12724
+ },
12725
+ { status: 400 }
12726
+ );
12727
+ }
12728
+ if (!hasAthenaTableSchemaCredentials(config)) {
12729
+ return json2(
12730
+ {
12731
+ error: "Gateway URL, API key, and database are required for schema introspection."
12732
+ },
12733
+ { status: 400 }
12734
+ );
12735
+ }
12736
+ try {
12737
+ const response = await fetchAthenaTableCatalog(
12738
+ config,
12739
+ {
12740
+ client: options?.client
12741
+ }
12742
+ );
12743
+ return json2(response);
12744
+ } catch (error) {
12745
+ return json2(
12746
+ {
12747
+ error: error instanceof Error ? error.message : "Athena schema introspection failed."
12748
+ },
12749
+ { status: 500 }
12750
+ );
12751
+ }
12752
+ }
12753
+ function createAthenaTableSchemaHandlers(options) {
12754
+ return {
12755
+ POST: (request2) => handleAthenaTableSchemaPost(request2, options)
12756
+ };
12757
+ }
12758
+
11884
12759
  // src/browser.ts
11885
12760
  function throwBrowserUnsupported(apiName) {
11886
12761
  throw new Error(
@@ -11912,6 +12787,6 @@ async function runSchemaGenerator(options = {}) {
11912
12787
  return throwBrowserUnsupported("runSchemaGenerator");
11913
12788
  }
11914
12789
 
11915
- 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, AthenaBillingError, AthenaChatError, AthenaConfigurationError, AthenaError, AthenaErrorCategory, AthenaErrorCode, AthenaErrorKind, AthenaGatewayError, AthenaStorageError, AthenaStorageErrorCode, Backend, DEFAULT_POSTGRES_SCHEMAS, assertInt, athenaAuth, billingSdkManifest, boolean, chatSdkManifest, coerceInt, createAthenaStorageError, createAuthReactEmailInput, createBillingModule, createClient, createModelFormAdapter, createPostgresIntrospectionProvider, defineAthenaAuthConfig, defineAuthEmailTemplate, defineDatabase, defineGeneratorConfig, defineModel, defineRegistry, defineSchema, enumeration, filterIntrospectionSnapshot, findGeneratorConfigPath, generateArtifactsFromSnapshot, generatorEnv, getAthenaDebugAst, identifier, isAthenaGatewayError, isOk, json, loadGeneratorConfig, normalizeAthenaError, normalizeAthenaGatewayBaseUrl, normalizeGeneratorConfig, normalizeSchemaSelection, normalizeTableSelection, number, parseBooleanFlag2 as parseBooleanFlag, renderAthenaReactEmail, requireAffected, requireSuccess, resolveGeneratorProvider, resolvePostgresColumnType, resolveProviderSchemas, runSchemaGenerator, storageSdkManifest, string, table, toModelFormDefaults, toModelPayload, unwrap, unwrapChatMessage, unwrapChatRoom, unwrapOne, unwrapRows, verifyAthenaGatewayUrl, withRetry };
12790
+ 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, ATHENA_TABLE_SCHEMA_ROUTE, AthenaBillingError, AthenaChatError, AthenaConfigurationError, AthenaError, AthenaErrorCategory, AthenaErrorCode, AthenaErrorKind, AthenaGatewayError, AthenaStorageError, AthenaStorageErrorCode, Backend, DEFAULT_POSTGRES_SCHEMAS, applyAthenaReadQueryFilters, applyAthenaReadQuerySelectLimit, applyAthenaReadQuerySelectOrder, applyAthenaTableFilters, applyAthenaTableSelectLimit, applyAthenaTableSelectOrder, assertInt, athenaAuth, billingSdkManifest, boolean, buildAthenaReadQueryFindManyOrderBy, buildAthenaReadQueryFindManySelect, buildAthenaReadQueryFindManyWhere, buildAthenaReadQuerySelectString, buildAthenaTableCatalogQueries, buildAthenaTableFindManyOrderBy, buildAthenaTableFindManySelect, buildAthenaTableFindManyWhere, buildAthenaTableSelectString, chatSdkManifest, clampAthenaReadQueryTotalItems, clampAthenaTableTotalItems, coerceInt, createAthenaStorageError, createAthenaTableSchemaHandlers, createAuthReactEmailInput, createBillingModule, createClient, createModelFormAdapter, createPostgresIntrospectionProvider, defineAthenaAuthConfig, defineAuthEmailTemplate, defineDatabase, defineGeneratorConfig, defineModel, defineRegistry, defineSchema, enumeration, executeAthenaReadQuery, executeAthenaTableQuery, fetchAthenaTableCatalog, fetchTableCatalog, filterIntrospectionSnapshot, findGeneratorConfigPath, flattenAthenaReadQueryRows, flattenAthenaRows, generateArtifactsFromSnapshot, generatorEnv, getAthenaDebugAst, handleAthenaTableSchemaPost, hasAthenaTableSchemaCredentials, identifier, isAthenaGatewayError, isAthenaTableSchemaConfig, isOk, json, loadGeneratorConfig, normalizeAthenaError, normalizeAthenaGatewayBaseUrl, normalizeAthenaReadQueryOrderBy, normalizeAthenaTableOrderBy, normalizeGeneratorConfig, normalizeSchemaSelection, normalizeTableSelection, number, parseAthenaTableSchemaScope, parseBooleanFlag2 as parseBooleanFlag, renderAthenaReactEmail, requireAffected, requireSuccess, resolveAthenaReadQueryPageFetch, resolveGeneratorProvider, resolvePostgresColumnType, resolveProviderSchemas, runSchemaGenerator, storageSdkManifest, string, table, toModelFormDefaults, toModelPayload, unwrap, unwrapChatMessage, unwrapChatRoom, unwrapOne, unwrapRows, verifyAthenaGatewayUrl, withRetry };
11916
12791
  //# sourceMappingURL=browser.js.map
11917
12792
  //# sourceMappingURL=browser.js.map