@xylex-group/athena 2.4.0 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/browser.cjs CHANGED
@@ -127,12 +127,47 @@ function buildAthenaGatewayUrl(baseUrl, path) {
127
127
  return `${baseUrl}${path}`;
128
128
  }
129
129
 
130
+ // src/cookies/cookie-utils.ts
131
+ var SECURE_COOKIE_PREFIX = "__Secure-";
132
+ function parseCookies(cookieHeader) {
133
+ const cookies = cookieHeader.split("; ");
134
+ const cookieMap = /* @__PURE__ */ new Map();
135
+ cookies.forEach((cookie) => {
136
+ const [name, value] = cookie.split(/=(.*)/s);
137
+ cookieMap.set(name, value);
138
+ });
139
+ return cookieMap;
140
+ }
141
+ var getSessionCookie = (request, config) => {
142
+ const cookies = (request instanceof Headers || !("headers" in request) ? request : request.headers).get("cookie");
143
+ if (!cookies) {
144
+ return null;
145
+ }
146
+ const { cookieName = "session_token", cookiePrefix = "athena-auth" } = {};
147
+ const parsedCookie = parseCookies(cookies);
148
+ const getCookie = (name) => parsedCookie.get(name) || parsedCookie.get(`${SECURE_COOKIE_PREFIX}${name}`);
149
+ const sessionToken = getCookie(`${cookiePrefix}.${cookieName}`) || getCookie(`${cookiePrefix}-${cookieName}`);
150
+ if (sessionToken) {
151
+ return sessionToken;
152
+ }
153
+ return null;
154
+ };
155
+
156
+ // package.json
157
+ var package_default = {
158
+ version: "2.4.1"
159
+ };
160
+
161
+ // src/sdk-version.ts
162
+ var PACKAGE_VERSION = package_default.version;
163
+ function buildSdkHeaderValue(sdkName) {
164
+ return `${sdkName} ${PACKAGE_VERSION}`;
165
+ }
166
+
130
167
  // src/gateway/client.ts
131
168
  var DEFAULT_CLIENT = "railway_direct";
132
- var FALLBACK_SDK_VERSION = "1.3.0";
133
169
  var SDK_NAME = "xylex-group/athena";
134
- var SDK_VERSION = typeof process !== "undefined" && process?.env?.npm_package_version ? process.env.npm_package_version : FALLBACK_SDK_VERSION;
135
- var SDK_HEADER_VALUE = `${SDK_NAME} ${SDK_VERSION}`;
170
+ var SDK_HEADER_VALUE = buildSdkHeaderValue(SDK_NAME);
136
171
  function parseResponseBody(rawText, contentType) {
137
172
  if (!rawText) {
138
173
  return { parsed: null, parseFailed: false };
@@ -151,6 +186,37 @@ function parseResponseBody(rawText, contentType) {
151
186
  function normalizeHeaderValue(value) {
152
187
  return value ? value : void 0;
153
188
  }
189
+ function resolveHeaderValue(headers, candidates) {
190
+ for (const candidate of candidates) {
191
+ const direct = normalizeHeaderValue(headers[candidate]);
192
+ if (direct) return direct;
193
+ }
194
+ const loweredCandidates = new Set(candidates.map((candidate) => candidate.toLowerCase()));
195
+ for (const [key, value] of Object.entries(headers)) {
196
+ if (!loweredCandidates.has(key.toLowerCase())) {
197
+ continue;
198
+ }
199
+ const normalized = normalizeHeaderValue(value);
200
+ if (normalized) return normalized;
201
+ }
202
+ return void 0;
203
+ }
204
+ function resolveBearerTokenFromAuthorizationHeader(headers) {
205
+ const authorization = resolveHeaderValue(headers, ["Authorization"]);
206
+ if (!authorization) {
207
+ return void 0;
208
+ }
209
+ const match = authorization.match(/^Bearer\s+(.+)$/i);
210
+ const token = match?.[1]?.trim();
211
+ return token ? token : void 0;
212
+ }
213
+ function resolveSessionTokenFromCookieHeader(headers) {
214
+ const cookie = resolveHeaderValue(headers, ["Cookie"]);
215
+ if (!cookie) {
216
+ return void 0;
217
+ }
218
+ return getSessionCookie(new Headers({ cookie })) ?? void 0;
219
+ }
154
220
  function isRecord(value) {
155
221
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
156
222
  }
@@ -268,7 +334,7 @@ function buildRpcGetEndpoint(payload) {
268
334
  status: 0
269
335
  });
270
336
  }
271
- query.set(filter.column, toRpcFilterQueryValue(filter));
337
+ query.append(filter.column, toRpcFilterQueryValue(filter));
272
338
  }
273
339
  }
274
340
  const endpoint = `/rpc/${encodeURIComponent(functionName)}`;
@@ -314,6 +380,20 @@ function buildHeaders(config, options) {
314
380
  headers["apikey"] = finalApiKey;
315
381
  headers["x-api-key"] = headers["x-api-key"] ?? finalApiKey;
316
382
  }
383
+ const explicitSessionToken = resolveHeaderValue(extraHeaders, [
384
+ "X-Athena-Auth-Session-Token"
385
+ ]);
386
+ const derivedSessionToken = explicitSessionToken ?? resolveSessionTokenFromCookieHeader(extraHeaders);
387
+ if (derivedSessionToken) {
388
+ headers["X-Athena-Auth-Session-Token"] = derivedSessionToken;
389
+ }
390
+ const explicitBearerToken = resolveHeaderValue(extraHeaders, [
391
+ "X-Athena-Auth-Bearer-Token"
392
+ ]);
393
+ const derivedBearerToken = explicitBearerToken ?? resolveBearerTokenFromAuthorizationHeader(extraHeaders);
394
+ if (derivedBearerToken) {
395
+ headers["X-Athena-Auth-Bearer-Token"] = derivedBearerToken;
396
+ }
317
397
  const athenaClientKeys = ["x-athena-client", "X-Athena-Client"];
318
398
  Object.entries(extraHeaders).forEach(([key, value]) => {
319
399
  if (athenaClientKeys.includes(key)) return;
@@ -1009,10 +1089,8 @@ async function resolveReactEmailPayloadFields(input, fields, options) {
1009
1089
 
1010
1090
  // src/auth/client.ts
1011
1091
  var DEFAULT_AUTH_BASE_URL = "http://localhost:3001/api/auth";
1012
- var FALLBACK_SDK_VERSION2 = "1.0.0";
1013
1092
  var SDK_NAME2 = "xylex-group/athena-auth";
1014
- var SDK_VERSION2 = typeof process !== "undefined" && process?.env?.npm_package_version ? process.env.npm_package_version : FALLBACK_SDK_VERSION2;
1015
- var SDK_HEADER_VALUE2 = `${SDK_NAME2} ${SDK_VERSION2}`;
1093
+ var SDK_HEADER_VALUE2 = buildSdkHeaderValue(SDK_NAME2);
1016
1094
  function normalizeBaseUrl(baseUrl) {
1017
1095
  return (baseUrl ?? DEFAULT_AUTH_BASE_URL).replace(/\/$/, "");
1018
1096
  }
@@ -2997,7 +3075,7 @@ function buildStructuredWhere(conditions) {
2997
3075
  if (!condition.column) {
2998
3076
  return null;
2999
3077
  }
3000
- if (condition.column_cast !== void 0 || condition.value_cast !== void 0) {
3078
+ if (condition.value_cast !== void 0) {
3001
3079
  return null;
3002
3080
  }
3003
3081
  const operand = condition.value;
@@ -3076,6 +3154,104 @@ function toFindManyAstOrder(order) {
3076
3154
  ascending: order.direction !== "descending"
3077
3155
  };
3078
3156
  }
3157
+ function isRecord6(value) {
3158
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
3159
+ }
3160
+ function normalizeFindManyAstColumnPredicate(value) {
3161
+ if (!isRecord6(value)) {
3162
+ return {
3163
+ eq: value
3164
+ };
3165
+ }
3166
+ const normalized = {};
3167
+ for (const [key, operand] of Object.entries(value)) {
3168
+ if (operand !== void 0) {
3169
+ normalized[key] = operand;
3170
+ }
3171
+ }
3172
+ return normalized;
3173
+ }
3174
+ function normalizeFindManyAstBooleanOperand(clause) {
3175
+ const normalized = {};
3176
+ for (const [column, value] of Object.entries(clause)) {
3177
+ if (value === void 0) {
3178
+ continue;
3179
+ }
3180
+ normalized[column] = normalizeFindManyAstColumnPredicate(value);
3181
+ }
3182
+ return normalized;
3183
+ }
3184
+ function normalizeFindManyAstWhere(where) {
3185
+ if (!where || !isRecord6(where)) {
3186
+ return where;
3187
+ }
3188
+ const normalized = {};
3189
+ for (const [key, value] of Object.entries(where)) {
3190
+ if (value === void 0) {
3191
+ continue;
3192
+ }
3193
+ if (key === "or" && Array.isArray(value)) {
3194
+ normalized.or = value.map(
3195
+ (clause) => normalizeFindManyAstBooleanOperand(clause)
3196
+ );
3197
+ continue;
3198
+ }
3199
+ if (key === "not" && isRecord6(value)) {
3200
+ normalized.not = normalizeFindManyAstBooleanOperand(
3201
+ value
3202
+ );
3203
+ continue;
3204
+ }
3205
+ normalized[key] = normalizeFindManyAstColumnPredicate(value);
3206
+ }
3207
+ return normalized;
3208
+ }
3209
+ function predicateRequiresUuidQueryFallback(column, value) {
3210
+ if (!isRecord6(value)) {
3211
+ return shouldUseUuidTextComparison(column, value);
3212
+ }
3213
+ const eqValue = value.eq;
3214
+ return eqValue !== void 0 && shouldUseUuidTextComparison(column, eqValue);
3215
+ }
3216
+ function booleanOperandRequiresUuidQueryFallback(clause) {
3217
+ for (const [column, value] of Object.entries(clause)) {
3218
+ if (value === void 0) {
3219
+ continue;
3220
+ }
3221
+ if (predicateRequiresUuidQueryFallback(column, value)) {
3222
+ return true;
3223
+ }
3224
+ }
3225
+ return false;
3226
+ }
3227
+ function findManyAstWhereRequiresLegacyTransport(where) {
3228
+ if (!where || !isRecord6(where)) {
3229
+ return false;
3230
+ }
3231
+ for (const [key, value] of Object.entries(where)) {
3232
+ if (value === void 0) {
3233
+ continue;
3234
+ }
3235
+ if (key === "or" && Array.isArray(value)) {
3236
+ if (value.some(
3237
+ (clause) => booleanOperandRequiresUuidQueryFallback(clause)
3238
+ )) {
3239
+ return true;
3240
+ }
3241
+ continue;
3242
+ }
3243
+ if (key === "not" && isRecord6(value)) {
3244
+ if (booleanOperandRequiresUuidQueryFallback(value)) {
3245
+ return true;
3246
+ }
3247
+ continue;
3248
+ }
3249
+ if (predicateRequiresUuidQueryFallback(key, value)) {
3250
+ return true;
3251
+ }
3252
+ }
3253
+ return false;
3254
+ }
3079
3255
  function resolvePagination(input) {
3080
3256
  let limit = input.limit;
3081
3257
  let offset = input.offset;
@@ -3094,25 +3270,6 @@ function hasTypedEqualityComparison(conditions) {
3094
3270
  }
3095
3271
  function createSelectTransportPlan(input) {
3096
3272
  const conditions = input.state.conditions.length ? input.state.conditions.map((condition) => ({ ...condition })) : void 0;
3097
- if (hasTypedEqualityComparison(conditions) && !input.options?.head && !input.options?.count && conditions) {
3098
- const query = input.buildTypedSelectQuery({
3099
- tableName: input.tableName,
3100
- columns: input.columns,
3101
- conditions,
3102
- limit: input.state.limit,
3103
- offset: input.state.offset,
3104
- currentPage: input.state.currentPage,
3105
- pageSize: input.state.pageSize,
3106
- order: input.state.order
3107
- });
3108
- if (query) {
3109
- return {
3110
- kind: "query",
3111
- query,
3112
- payload: { query }
3113
- };
3114
- }
3115
- }
3116
3273
  const pagination = resolvePagination({
3117
3274
  limit: input.state.limit,
3118
3275
  offset: input.state.offset,
@@ -3148,6 +3305,25 @@ function createSelectTransportPlan(input) {
3148
3305
  }
3149
3306
  };
3150
3307
  }
3308
+ if (hasTypedEqualityComparison(conditions) && !input.options?.head && !input.options?.count && conditions) {
3309
+ const query = input.buildTypedSelectQuery({
3310
+ tableName: input.tableName,
3311
+ columns: input.columns,
3312
+ conditions,
3313
+ limit: input.state.limit,
3314
+ offset: input.state.offset,
3315
+ currentPage: input.state.currentPage,
3316
+ pageSize: input.state.pageSize,
3317
+ order: input.state.order
3318
+ });
3319
+ if (query) {
3320
+ return {
3321
+ kind: "query",
3322
+ query,
3323
+ payload: { query }
3324
+ };
3325
+ }
3326
+ }
3151
3327
  return {
3152
3328
  kind: "fetch",
3153
3329
  payload: {
@@ -3204,6 +3380,13 @@ function formatResult(response) {
3204
3380
  }
3205
3381
  return result;
3206
3382
  }
3383
+ var EXPERIMENTAL_READ_RETRY_CONFIG = {
3384
+ retries: 2,
3385
+ baseDelayMs: 100,
3386
+ maxDelayMs: 1e3,
3387
+ backoff: "exponential",
3388
+ jitter: true
3389
+ };
3207
3390
  function attachNormalizedError(result, normalizedError) {
3208
3391
  Object.defineProperty(result, ATHENA_NORMALIZED_ERROR_KEY, {
3209
3392
  value: normalizedError,
@@ -3230,7 +3413,36 @@ function createResultFormatter(experimental) {
3230
3413
  return result;
3231
3414
  };
3232
3415
  }
3233
- function isRecord6(value) {
3416
+ async function executeExperimentalRead(experimental, runner) {
3417
+ if (!experimental?.retryReads) {
3418
+ return runner();
3419
+ }
3420
+ let lastRetryableResult;
3421
+ let lastRetrySignal = null;
3422
+ try {
3423
+ return await withRetry(
3424
+ {
3425
+ ...EXPERIMENTAL_READ_RETRY_CONFIG,
3426
+ shouldRetry: (error) => error === lastRetrySignal || normalizeAthenaError(error).retryable
3427
+ },
3428
+ async () => {
3429
+ const result = await runner();
3430
+ if (result.error?.retryable) {
3431
+ lastRetryableResult = result;
3432
+ lastRetrySignal = result.error;
3433
+ throw lastRetrySignal;
3434
+ }
3435
+ return result;
3436
+ }
3437
+ );
3438
+ } catch (error) {
3439
+ if (lastRetryableResult && error === lastRetrySignal) {
3440
+ return lastRetryableResult;
3441
+ }
3442
+ throw error;
3443
+ }
3444
+ }
3445
+ function isRecord7(value) {
3234
3446
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
3235
3447
  }
3236
3448
  function firstNonEmptyString2(...values) {
@@ -3242,8 +3454,8 @@ function firstNonEmptyString2(...values) {
3242
3454
  return void 0;
3243
3455
  }
3244
3456
  function resolveStructuredErrorPayload2(raw) {
3245
- if (!isRecord6(raw)) return null;
3246
- return isRecord6(raw.error) ? raw.error : raw;
3457
+ if (!isRecord7(raw)) return null;
3458
+ return isRecord7(raw.error) ? raw.error : raw;
3247
3459
  }
3248
3460
  function resolveStructuredErrorDetails(payload, message) {
3249
3461
  if (!payload || !("details" in payload)) {
@@ -3259,7 +3471,7 @@ function resolveStructuredErrorDetails(payload, message) {
3259
3471
  return details;
3260
3472
  }
3261
3473
  function createResultError(response, result, normalized) {
3262
- const rawRecord = isRecord6(response.raw) ? response.raw : null;
3474
+ const rawRecord = isRecord7(response.raw) ? response.raw : null;
3263
3475
  const payload = resolveStructuredErrorPayload2(response.raw);
3264
3476
  const message = firstNonEmptyString2(
3265
3477
  response.error,
@@ -3454,7 +3666,14 @@ function toSingleResult(response) {
3454
3666
  function mergeOptions(...options) {
3455
3667
  return options.reduce((acc, next) => {
3456
3668
  if (!next) return acc;
3457
- return { ...acc, ...next };
3669
+ const merged = { ...acc ?? {}, ...next };
3670
+ if (acc?.headers || next.headers) {
3671
+ merged.headers = {
3672
+ ...acc?.headers ?? {},
3673
+ ...next.headers ?? {}
3674
+ };
3675
+ }
3676
+ return merged;
3458
3677
  }, void 0);
3459
3678
  }
3460
3679
  function asAthenaJsonObject(value) {
@@ -4246,42 +4465,48 @@ function createTableBuilder(tableName, client, formatGatewayResult, tracer, expe
4246
4465
  buildTypedSelectQuery
4247
4466
  });
4248
4467
  if (plan.kind === "query") {
4249
- return executeWithQueryTrace(
4468
+ return executeExperimentalRead(
4469
+ experimental,
4470
+ () => executeWithQueryTrace(
4471
+ tracer,
4472
+ {
4473
+ operation: "select",
4474
+ endpoint: "/gateway/query",
4475
+ table: resolvedTableName,
4476
+ sql: plan.query,
4477
+ payload: plan.payload,
4478
+ options
4479
+ },
4480
+ async () => {
4481
+ const queryResponse = await client.queryGateway(plan.payload, options);
4482
+ return formatGatewayResult(queryResponse, { table: resolvedTableName, operation: "select" });
4483
+ },
4484
+ callsite
4485
+ )
4486
+ );
4487
+ }
4488
+ const sql = buildDebugSelectQuery({
4489
+ tableName: resolvedTableName,
4490
+ ...plan.debug
4491
+ });
4492
+ return executeExperimentalRead(
4493
+ experimental,
4494
+ () => executeWithQueryTrace(
4250
4495
  tracer,
4251
4496
  {
4252
4497
  operation: "select",
4253
- endpoint: "/gateway/query",
4498
+ endpoint: "/gateway/fetch",
4254
4499
  table: resolvedTableName,
4255
- sql: plan.query,
4500
+ sql,
4256
4501
  payload: plan.payload,
4257
4502
  options
4258
4503
  },
4259
4504
  async () => {
4260
- const queryResponse = await client.queryGateway(plan.payload, options);
4261
- return formatGatewayResult(queryResponse, { table: resolvedTableName, operation: "select" });
4505
+ const response = await client.fetchGateway(plan.payload, options);
4506
+ return formatGatewayResult(response, { table: resolvedTableName, operation: "select" });
4262
4507
  },
4263
4508
  callsite
4264
- );
4265
- }
4266
- const sql = buildDebugSelectQuery({
4267
- tableName: resolvedTableName,
4268
- ...plan.debug
4269
- });
4270
- return executeWithQueryTrace(
4271
- tracer,
4272
- {
4273
- operation: "select",
4274
- endpoint: "/gateway/fetch",
4275
- table: resolvedTableName,
4276
- sql,
4277
- payload: plan.payload,
4278
- options
4279
- },
4280
- async () => {
4281
- const response = await client.fetchGateway(plan.payload, options);
4282
- return formatGatewayResult(response, { table: resolvedTableName, operation: "select" });
4283
- },
4284
- callsite
4509
+ )
4285
4510
  );
4286
4511
  };
4287
4512
  const createSelectChain = (columns, options, initialCallsite) => {
@@ -4351,14 +4576,14 @@ function createTableBuilder(tableName, client, formatGatewayResult, tracer, expe
4351
4576
  if (options.limit !== void 0) {
4352
4577
  executionState.limit = options.limit;
4353
4578
  }
4354
- if (experimental?.findManyAst && canUseFindManyAstTransport(baseState) && !selectShapeUsesRelationSchema(options.select)) {
4579
+ if (experimental?.findManyAst && canUseFindManyAstTransport(baseState) && !selectShapeUsesRelationSchema(options.select) && !findManyAstWhereRequiresLegacyTransport(options.where)) {
4355
4580
  const resolvedTableName = resolveTableNameForCall(tableName, void 0);
4356
4581
  const payload = {
4357
4582
  table_name: resolvedTableName,
4358
4583
  select: options.select
4359
4584
  };
4360
4585
  if (options.where !== void 0) {
4361
- payload.where = options.where;
4586
+ payload.where = normalizeFindManyAstWhere(options.where);
4362
4587
  }
4363
4588
  const astOrder = toFindManyAstOrder(executionState.order);
4364
4589
  if (astOrder !== void 0) {
@@ -4374,22 +4599,25 @@ function createTableBuilder(tableName, client, formatGatewayResult, tracer, expe
4374
4599
  limit: executionState.limit,
4375
4600
  order: executionState.order
4376
4601
  });
4377
- return executeWithQueryTrace(
4378
- tracer,
4379
- {
4380
- operation: "select",
4381
- endpoint: "/gateway/fetch",
4382
- table: resolvedTableName,
4383
- sql,
4384
- payload
4385
- },
4386
- async () => {
4387
- const response = await client.fetchGateway(
4602
+ return executeExperimentalRead(
4603
+ experimental,
4604
+ () => executeWithQueryTrace(
4605
+ tracer,
4606
+ {
4607
+ operation: "select",
4608
+ endpoint: "/gateway/fetch",
4609
+ table: resolvedTableName,
4610
+ sql,
4388
4611
  payload
4389
- );
4390
- return formatGatewayResult(response, { table: resolvedTableName, operation: "select" });
4391
- },
4392
- callsite
4612
+ },
4613
+ async () => {
4614
+ const response = await client.fetchGateway(
4615
+ payload
4616
+ );
4617
+ return formatGatewayResult(response, { table: resolvedTableName, operation: "select" });
4618
+ },
4619
+ callsite
4620
+ )
4393
4621
  );
4394
4622
  }
4395
4623
  return runSelect(
@@ -4637,7 +4865,7 @@ function createTableBuilder(tableName, client, formatGatewayResult, tracer, expe
4637
4865
  });
4638
4866
  return builder;
4639
4867
  }
4640
- function createQueryBuilder(client, formatGatewayResult, tracer) {
4868
+ function createQueryBuilder(client, formatGatewayResult, experimental, tracer) {
4641
4869
  return async function query(query, options) {
4642
4870
  const normalizedQuery = query.trim();
4643
4871
  if (!normalizedQuery) {
@@ -4645,30 +4873,39 @@ function createQueryBuilder(client, formatGatewayResult, tracer) {
4645
4873
  }
4646
4874
  const payload = { query: normalizedQuery };
4647
4875
  const callsite = captureTraceCallsite(tracer);
4648
- return executeWithQueryTrace(
4649
- tracer,
4650
- {
4651
- operation: "query",
4652
- endpoint: "/gateway/query",
4653
- sql: normalizedQuery,
4654
- payload,
4655
- options
4656
- },
4657
- async () => {
4658
- const response = await client.queryGateway(payload, options);
4659
- return formatGatewayResult(response, { operation: "query" });
4660
- },
4661
- callsite
4876
+ return executeExperimentalRead(
4877
+ experimental,
4878
+ () => executeWithQueryTrace(
4879
+ tracer,
4880
+ {
4881
+ operation: "query",
4882
+ endpoint: "/gateway/query",
4883
+ sql: normalizedQuery,
4884
+ payload,
4885
+ options
4886
+ },
4887
+ async () => {
4888
+ const response = await client.queryGateway(payload, options);
4889
+ return formatGatewayResult(response, { operation: "query" });
4890
+ },
4891
+ callsite
4892
+ )
4662
4893
  );
4663
4894
  };
4664
4895
  }
4665
4896
  function createClientFromConfig(config) {
4897
+ const gatewayHeaders = {
4898
+ ...config.headers ?? {}
4899
+ };
4900
+ if (config.auth?.bearerToken && gatewayHeaders["X-Athena-Auth-Bearer-Token"] === void 0 && gatewayHeaders["x-athena-auth-bearer-token"] === void 0) {
4901
+ gatewayHeaders["X-Athena-Auth-Bearer-Token"] = config.auth.bearerToken;
4902
+ }
4666
4903
  const gateway = createAthenaGatewayClient({
4667
4904
  baseUrl: config.baseUrl,
4668
4905
  apiKey: config.apiKey,
4669
4906
  client: config.client,
4670
4907
  backend: config.backend,
4671
- headers: config.headers
4908
+ headers: gatewayHeaders
4672
4909
  });
4673
4910
  const formatGatewayResult = createResultFormatter(config.experimental);
4674
4911
  const queryTracer = createQueryTracer(config.experimental);
@@ -4695,7 +4932,7 @@ function createClientFromConfig(config) {
4695
4932
  captureTraceCallsite(queryTracer)
4696
4933
  );
4697
4934
  };
4698
- const query = createQueryBuilder(gateway, formatGatewayResult, queryTracer);
4935
+ const query = createQueryBuilder(gateway, formatGatewayResult, config.experimental, queryTracer);
4699
4936
  const db = createDbModule({ from, rpc, query });
4700
4937
  return {
4701
4938
  from,
@@ -4745,7 +4982,6 @@ var AthenaClientBuilderImpl = class {
4745
4982
  defaultHeaders;
4746
4983
  authConfig;
4747
4984
  experimentalOptions;
4748
- isHealthTrackingEnabled = false;
4749
4985
  url(url) {
4750
4986
  this.baseUrl = url;
4751
4987
  return this;
@@ -4795,10 +5031,6 @@ var AthenaClientBuilderImpl = class {
4795
5031
  }
4796
5032
  return this;
4797
5033
  }
4798
- healthTracking(enabled) {
4799
- this.isHealthTrackingEnabled = enabled;
4800
- return this;
4801
- }
4802
5034
  build() {
4803
5035
  if (!this.baseUrl || !this.apiKey) {
4804
5036
  throw new Error("AthenaClient requires url and key; call .url() and .key() before .build()");
@@ -4809,7 +5041,6 @@ var AthenaClientBuilderImpl = class {
4809
5041
  client: this.clientName,
4810
5042
  backend: this.backendConfig,
4811
5043
  headers: this.defaultHeaders,
4812
- healthTracking: this.isHealthTrackingEnabled,
4813
5044
  auth: this.authConfig,
4814
5045
  experimental: this.experimentalOptions
4815
5046
  });
@@ -4994,7 +5225,7 @@ function resolveNullishValue(mode) {
4994
5225
  if (mode === "null") return null;
4995
5226
  return "";
4996
5227
  }
4997
- function isRecord7(value) {
5228
+ function isRecord8(value) {
4998
5229
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
4999
5230
  }
5000
5231
  function isNullableColumn(model, key) {
@@ -5003,7 +5234,7 @@ function isNullableColumn(model, key) {
5003
5234
  }
5004
5235
  function toModelFormDefaults(model, values, options) {
5005
5236
  const source = values;
5006
- if (!isRecord7(source)) {
5237
+ if (!isRecord8(source)) {
5007
5238
  return {};
5008
5239
  }
5009
5240
  const mode = options?.nullishMode ?? "empty-string";