@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/index.cjs CHANGED
@@ -132,12 +132,47 @@ function buildAthenaGatewayUrl(baseUrl, path) {
132
132
  return `${baseUrl}${path}`;
133
133
  }
134
134
 
135
+ // src/cookies/cookie-utils.ts
136
+ var SECURE_COOKIE_PREFIX = "__Secure-";
137
+ function parseCookies(cookieHeader) {
138
+ const cookies = cookieHeader.split("; ");
139
+ const cookieMap = /* @__PURE__ */ new Map();
140
+ cookies.forEach((cookie) => {
141
+ const [name, value] = cookie.split(/=(.*)/s);
142
+ cookieMap.set(name, value);
143
+ });
144
+ return cookieMap;
145
+ }
146
+ var getSessionCookie = (request, config) => {
147
+ const cookies = (request instanceof Headers || !("headers" in request) ? request : request.headers).get("cookie");
148
+ if (!cookies) {
149
+ return null;
150
+ }
151
+ const { cookieName = "session_token", cookiePrefix = "athena-auth" } = {};
152
+ const parsedCookie = parseCookies(cookies);
153
+ const getCookie = (name) => parsedCookie.get(name) || parsedCookie.get(`${SECURE_COOKIE_PREFIX}${name}`);
154
+ const sessionToken = getCookie(`${cookiePrefix}.${cookieName}`) || getCookie(`${cookiePrefix}-${cookieName}`);
155
+ if (sessionToken) {
156
+ return sessionToken;
157
+ }
158
+ return null;
159
+ };
160
+
161
+ // package.json
162
+ var package_default = {
163
+ version: "2.4.1"
164
+ };
165
+
166
+ // src/sdk-version.ts
167
+ var PACKAGE_VERSION = package_default.version;
168
+ function buildSdkHeaderValue(sdkName) {
169
+ return `${sdkName} ${PACKAGE_VERSION}`;
170
+ }
171
+
135
172
  // src/gateway/client.ts
136
173
  var DEFAULT_CLIENT = "railway_direct";
137
- var FALLBACK_SDK_VERSION = "1.3.0";
138
174
  var SDK_NAME = "xylex-group/athena";
139
- var SDK_VERSION = typeof process !== "undefined" && process?.env?.npm_package_version ? process.env.npm_package_version : FALLBACK_SDK_VERSION;
140
- var SDK_HEADER_VALUE = `${SDK_NAME} ${SDK_VERSION}`;
175
+ var SDK_HEADER_VALUE = buildSdkHeaderValue(SDK_NAME);
141
176
  function parseResponseBody(rawText, contentType) {
142
177
  if (!rawText) {
143
178
  return { parsed: null, parseFailed: false };
@@ -156,6 +191,37 @@ function parseResponseBody(rawText, contentType) {
156
191
  function normalizeHeaderValue(value) {
157
192
  return value ? value : void 0;
158
193
  }
194
+ function resolveHeaderValue(headers, candidates) {
195
+ for (const candidate of candidates) {
196
+ const direct = normalizeHeaderValue(headers[candidate]);
197
+ if (direct) return direct;
198
+ }
199
+ const loweredCandidates = new Set(candidates.map((candidate) => candidate.toLowerCase()));
200
+ for (const [key, value] of Object.entries(headers)) {
201
+ if (!loweredCandidates.has(key.toLowerCase())) {
202
+ continue;
203
+ }
204
+ const normalized = normalizeHeaderValue(value);
205
+ if (normalized) return normalized;
206
+ }
207
+ return void 0;
208
+ }
209
+ function resolveBearerTokenFromAuthorizationHeader(headers) {
210
+ const authorization = resolveHeaderValue(headers, ["Authorization"]);
211
+ if (!authorization) {
212
+ return void 0;
213
+ }
214
+ const match = authorization.match(/^Bearer\s+(.+)$/i);
215
+ const token = match?.[1]?.trim();
216
+ return token ? token : void 0;
217
+ }
218
+ function resolveSessionTokenFromCookieHeader(headers) {
219
+ const cookie = resolveHeaderValue(headers, ["Cookie"]);
220
+ if (!cookie) {
221
+ return void 0;
222
+ }
223
+ return getSessionCookie(new Headers({ cookie })) ?? void 0;
224
+ }
159
225
  function isRecord(value) {
160
226
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
161
227
  }
@@ -273,7 +339,7 @@ function buildRpcGetEndpoint(payload) {
273
339
  status: 0
274
340
  });
275
341
  }
276
- query.set(filter.column, toRpcFilterQueryValue(filter));
342
+ query.append(filter.column, toRpcFilterQueryValue(filter));
277
343
  }
278
344
  }
279
345
  const endpoint = `/rpc/${encodeURIComponent(functionName)}`;
@@ -319,6 +385,20 @@ function buildHeaders(config, options) {
319
385
  headers["apikey"] = finalApiKey;
320
386
  headers["x-api-key"] = headers["x-api-key"] ?? finalApiKey;
321
387
  }
388
+ const explicitSessionToken = resolveHeaderValue(extraHeaders, [
389
+ "X-Athena-Auth-Session-Token"
390
+ ]);
391
+ const derivedSessionToken = explicitSessionToken ?? resolveSessionTokenFromCookieHeader(extraHeaders);
392
+ if (derivedSessionToken) {
393
+ headers["X-Athena-Auth-Session-Token"] = derivedSessionToken;
394
+ }
395
+ const explicitBearerToken = resolveHeaderValue(extraHeaders, [
396
+ "X-Athena-Auth-Bearer-Token"
397
+ ]);
398
+ const derivedBearerToken = explicitBearerToken ?? resolveBearerTokenFromAuthorizationHeader(extraHeaders);
399
+ if (derivedBearerToken) {
400
+ headers["X-Athena-Auth-Bearer-Token"] = derivedBearerToken;
401
+ }
322
402
  const athenaClientKeys = ["x-athena-client", "X-Athena-Client"];
323
403
  Object.entries(extraHeaders).forEach(([key, value]) => {
324
404
  if (athenaClientKeys.includes(key)) return;
@@ -1014,10 +1094,8 @@ async function resolveReactEmailPayloadFields(input, fields, options) {
1014
1094
 
1015
1095
  // src/auth/client.ts
1016
1096
  var DEFAULT_AUTH_BASE_URL = "http://localhost:3001/api/auth";
1017
- var FALLBACK_SDK_VERSION2 = "1.0.0";
1018
1097
  var SDK_NAME2 = "xylex-group/athena-auth";
1019
- var SDK_VERSION2 = typeof process !== "undefined" && process?.env?.npm_package_version ? process.env.npm_package_version : FALLBACK_SDK_VERSION2;
1020
- var SDK_HEADER_VALUE2 = `${SDK_NAME2} ${SDK_VERSION2}`;
1098
+ var SDK_HEADER_VALUE2 = buildSdkHeaderValue(SDK_NAME2);
1021
1099
  function normalizeBaseUrl(baseUrl) {
1022
1100
  return (baseUrl ?? DEFAULT_AUTH_BASE_URL).replace(/\/$/, "");
1023
1101
  }
@@ -3002,7 +3080,7 @@ function buildStructuredWhere(conditions) {
3002
3080
  if (!condition.column) {
3003
3081
  return null;
3004
3082
  }
3005
- if (condition.column_cast !== void 0 || condition.value_cast !== void 0) {
3083
+ if (condition.value_cast !== void 0) {
3006
3084
  return null;
3007
3085
  }
3008
3086
  const operand = condition.value;
@@ -3081,6 +3159,104 @@ function toFindManyAstOrder(order) {
3081
3159
  ascending: order.direction !== "descending"
3082
3160
  };
3083
3161
  }
3162
+ function isRecord6(value) {
3163
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
3164
+ }
3165
+ function normalizeFindManyAstColumnPredicate(value) {
3166
+ if (!isRecord6(value)) {
3167
+ return {
3168
+ eq: value
3169
+ };
3170
+ }
3171
+ const normalized = {};
3172
+ for (const [key, operand] of Object.entries(value)) {
3173
+ if (operand !== void 0) {
3174
+ normalized[key] = operand;
3175
+ }
3176
+ }
3177
+ return normalized;
3178
+ }
3179
+ function normalizeFindManyAstBooleanOperand(clause) {
3180
+ const normalized = {};
3181
+ for (const [column, value] of Object.entries(clause)) {
3182
+ if (value === void 0) {
3183
+ continue;
3184
+ }
3185
+ normalized[column] = normalizeFindManyAstColumnPredicate(value);
3186
+ }
3187
+ return normalized;
3188
+ }
3189
+ function normalizeFindManyAstWhere(where) {
3190
+ if (!where || !isRecord6(where)) {
3191
+ return where;
3192
+ }
3193
+ const normalized = {};
3194
+ for (const [key, value] of Object.entries(where)) {
3195
+ if (value === void 0) {
3196
+ continue;
3197
+ }
3198
+ if (key === "or" && Array.isArray(value)) {
3199
+ normalized.or = value.map(
3200
+ (clause) => normalizeFindManyAstBooleanOperand(clause)
3201
+ );
3202
+ continue;
3203
+ }
3204
+ if (key === "not" && isRecord6(value)) {
3205
+ normalized.not = normalizeFindManyAstBooleanOperand(
3206
+ value
3207
+ );
3208
+ continue;
3209
+ }
3210
+ normalized[key] = normalizeFindManyAstColumnPredicate(value);
3211
+ }
3212
+ return normalized;
3213
+ }
3214
+ function predicateRequiresUuidQueryFallback(column, value) {
3215
+ if (!isRecord6(value)) {
3216
+ return shouldUseUuidTextComparison(column, value);
3217
+ }
3218
+ const eqValue = value.eq;
3219
+ return eqValue !== void 0 && shouldUseUuidTextComparison(column, eqValue);
3220
+ }
3221
+ function booleanOperandRequiresUuidQueryFallback(clause) {
3222
+ for (const [column, value] of Object.entries(clause)) {
3223
+ if (value === void 0) {
3224
+ continue;
3225
+ }
3226
+ if (predicateRequiresUuidQueryFallback(column, value)) {
3227
+ return true;
3228
+ }
3229
+ }
3230
+ return false;
3231
+ }
3232
+ function findManyAstWhereRequiresLegacyTransport(where) {
3233
+ if (!where || !isRecord6(where)) {
3234
+ return false;
3235
+ }
3236
+ for (const [key, value] of Object.entries(where)) {
3237
+ if (value === void 0) {
3238
+ continue;
3239
+ }
3240
+ if (key === "or" && Array.isArray(value)) {
3241
+ if (value.some(
3242
+ (clause) => booleanOperandRequiresUuidQueryFallback(clause)
3243
+ )) {
3244
+ return true;
3245
+ }
3246
+ continue;
3247
+ }
3248
+ if (key === "not" && isRecord6(value)) {
3249
+ if (booleanOperandRequiresUuidQueryFallback(value)) {
3250
+ return true;
3251
+ }
3252
+ continue;
3253
+ }
3254
+ if (predicateRequiresUuidQueryFallback(key, value)) {
3255
+ return true;
3256
+ }
3257
+ }
3258
+ return false;
3259
+ }
3084
3260
  function resolvePagination(input) {
3085
3261
  let limit = input.limit;
3086
3262
  let offset = input.offset;
@@ -3099,25 +3275,6 @@ function hasTypedEqualityComparison(conditions) {
3099
3275
  }
3100
3276
  function createSelectTransportPlan(input) {
3101
3277
  const conditions = input.state.conditions.length ? input.state.conditions.map((condition) => ({ ...condition })) : void 0;
3102
- if (hasTypedEqualityComparison(conditions) && !input.options?.head && !input.options?.count && conditions) {
3103
- const query = input.buildTypedSelectQuery({
3104
- tableName: input.tableName,
3105
- columns: input.columns,
3106
- conditions,
3107
- limit: input.state.limit,
3108
- offset: input.state.offset,
3109
- currentPage: input.state.currentPage,
3110
- pageSize: input.state.pageSize,
3111
- order: input.state.order
3112
- });
3113
- if (query) {
3114
- return {
3115
- kind: "query",
3116
- query,
3117
- payload: { query }
3118
- };
3119
- }
3120
- }
3121
3278
  const pagination = resolvePagination({
3122
3279
  limit: input.state.limit,
3123
3280
  offset: input.state.offset,
@@ -3153,6 +3310,25 @@ function createSelectTransportPlan(input) {
3153
3310
  }
3154
3311
  };
3155
3312
  }
3313
+ if (hasTypedEqualityComparison(conditions) && !input.options?.head && !input.options?.count && conditions) {
3314
+ const query = input.buildTypedSelectQuery({
3315
+ tableName: input.tableName,
3316
+ columns: input.columns,
3317
+ conditions,
3318
+ limit: input.state.limit,
3319
+ offset: input.state.offset,
3320
+ currentPage: input.state.currentPage,
3321
+ pageSize: input.state.pageSize,
3322
+ order: input.state.order
3323
+ });
3324
+ if (query) {
3325
+ return {
3326
+ kind: "query",
3327
+ query,
3328
+ payload: { query }
3329
+ };
3330
+ }
3331
+ }
3156
3332
  return {
3157
3333
  kind: "fetch",
3158
3334
  payload: {
@@ -3209,6 +3385,13 @@ function formatResult(response) {
3209
3385
  }
3210
3386
  return result;
3211
3387
  }
3388
+ var EXPERIMENTAL_READ_RETRY_CONFIG = {
3389
+ retries: 2,
3390
+ baseDelayMs: 100,
3391
+ maxDelayMs: 1e3,
3392
+ backoff: "exponential",
3393
+ jitter: true
3394
+ };
3212
3395
  function attachNormalizedError(result, normalizedError) {
3213
3396
  Object.defineProperty(result, ATHENA_NORMALIZED_ERROR_KEY, {
3214
3397
  value: normalizedError,
@@ -3235,7 +3418,36 @@ function createResultFormatter(experimental) {
3235
3418
  return result;
3236
3419
  };
3237
3420
  }
3238
- function isRecord6(value) {
3421
+ async function executeExperimentalRead(experimental, runner) {
3422
+ if (!experimental?.retryReads) {
3423
+ return runner();
3424
+ }
3425
+ let lastRetryableResult;
3426
+ let lastRetrySignal = null;
3427
+ try {
3428
+ return await withRetry(
3429
+ {
3430
+ ...EXPERIMENTAL_READ_RETRY_CONFIG,
3431
+ shouldRetry: (error) => error === lastRetrySignal || normalizeAthenaError(error).retryable
3432
+ },
3433
+ async () => {
3434
+ const result = await runner();
3435
+ if (result.error?.retryable) {
3436
+ lastRetryableResult = result;
3437
+ lastRetrySignal = result.error;
3438
+ throw lastRetrySignal;
3439
+ }
3440
+ return result;
3441
+ }
3442
+ );
3443
+ } catch (error) {
3444
+ if (lastRetryableResult && error === lastRetrySignal) {
3445
+ return lastRetryableResult;
3446
+ }
3447
+ throw error;
3448
+ }
3449
+ }
3450
+ function isRecord7(value) {
3239
3451
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
3240
3452
  }
3241
3453
  function firstNonEmptyString2(...values) {
@@ -3247,8 +3459,8 @@ function firstNonEmptyString2(...values) {
3247
3459
  return void 0;
3248
3460
  }
3249
3461
  function resolveStructuredErrorPayload2(raw) {
3250
- if (!isRecord6(raw)) return null;
3251
- return isRecord6(raw.error) ? raw.error : raw;
3462
+ if (!isRecord7(raw)) return null;
3463
+ return isRecord7(raw.error) ? raw.error : raw;
3252
3464
  }
3253
3465
  function resolveStructuredErrorDetails(payload, message) {
3254
3466
  if (!payload || !("details" in payload)) {
@@ -3264,7 +3476,7 @@ function resolveStructuredErrorDetails(payload, message) {
3264
3476
  return details;
3265
3477
  }
3266
3478
  function createResultError(response, result, normalized) {
3267
- const rawRecord = isRecord6(response.raw) ? response.raw : null;
3479
+ const rawRecord = isRecord7(response.raw) ? response.raw : null;
3268
3480
  const payload = resolveStructuredErrorPayload2(response.raw);
3269
3481
  const message = firstNonEmptyString2(
3270
3482
  response.error,
@@ -3459,7 +3671,14 @@ function toSingleResult(response) {
3459
3671
  function mergeOptions(...options) {
3460
3672
  return options.reduce((acc, next) => {
3461
3673
  if (!next) return acc;
3462
- return { ...acc, ...next };
3674
+ const merged = { ...acc ?? {}, ...next };
3675
+ if (acc?.headers || next.headers) {
3676
+ merged.headers = {
3677
+ ...acc?.headers ?? {},
3678
+ ...next.headers ?? {}
3679
+ };
3680
+ }
3681
+ return merged;
3463
3682
  }, void 0);
3464
3683
  }
3465
3684
  function asAthenaJsonObject(value) {
@@ -4251,42 +4470,48 @@ function createTableBuilder(tableName, client, formatGatewayResult, tracer, expe
4251
4470
  buildTypedSelectQuery
4252
4471
  });
4253
4472
  if (plan.kind === "query") {
4254
- return executeWithQueryTrace(
4473
+ return executeExperimentalRead(
4474
+ experimental,
4475
+ () => executeWithQueryTrace(
4476
+ tracer,
4477
+ {
4478
+ operation: "select",
4479
+ endpoint: "/gateway/query",
4480
+ table: resolvedTableName,
4481
+ sql: plan.query,
4482
+ payload: plan.payload,
4483
+ options
4484
+ },
4485
+ async () => {
4486
+ const queryResponse = await client.queryGateway(plan.payload, options);
4487
+ return formatGatewayResult(queryResponse, { table: resolvedTableName, operation: "select" });
4488
+ },
4489
+ callsite
4490
+ )
4491
+ );
4492
+ }
4493
+ const sql = buildDebugSelectQuery({
4494
+ tableName: resolvedTableName,
4495
+ ...plan.debug
4496
+ });
4497
+ return executeExperimentalRead(
4498
+ experimental,
4499
+ () => executeWithQueryTrace(
4255
4500
  tracer,
4256
4501
  {
4257
4502
  operation: "select",
4258
- endpoint: "/gateway/query",
4503
+ endpoint: "/gateway/fetch",
4259
4504
  table: resolvedTableName,
4260
- sql: plan.query,
4505
+ sql,
4261
4506
  payload: plan.payload,
4262
4507
  options
4263
4508
  },
4264
4509
  async () => {
4265
- const queryResponse = await client.queryGateway(plan.payload, options);
4266
- return formatGatewayResult(queryResponse, { table: resolvedTableName, operation: "select" });
4510
+ const response = await client.fetchGateway(plan.payload, options);
4511
+ return formatGatewayResult(response, { table: resolvedTableName, operation: "select" });
4267
4512
  },
4268
4513
  callsite
4269
- );
4270
- }
4271
- const sql = buildDebugSelectQuery({
4272
- tableName: resolvedTableName,
4273
- ...plan.debug
4274
- });
4275
- return executeWithQueryTrace(
4276
- tracer,
4277
- {
4278
- operation: "select",
4279
- endpoint: "/gateway/fetch",
4280
- table: resolvedTableName,
4281
- sql,
4282
- payload: plan.payload,
4283
- options
4284
- },
4285
- async () => {
4286
- const response = await client.fetchGateway(plan.payload, options);
4287
- return formatGatewayResult(response, { table: resolvedTableName, operation: "select" });
4288
- },
4289
- callsite
4514
+ )
4290
4515
  );
4291
4516
  };
4292
4517
  const createSelectChain = (columns, options, initialCallsite) => {
@@ -4356,14 +4581,14 @@ function createTableBuilder(tableName, client, formatGatewayResult, tracer, expe
4356
4581
  if (options.limit !== void 0) {
4357
4582
  executionState.limit = options.limit;
4358
4583
  }
4359
- if (experimental?.findManyAst && canUseFindManyAstTransport(baseState) && !selectShapeUsesRelationSchema(options.select)) {
4584
+ if (experimental?.findManyAst && canUseFindManyAstTransport(baseState) && !selectShapeUsesRelationSchema(options.select) && !findManyAstWhereRequiresLegacyTransport(options.where)) {
4360
4585
  const resolvedTableName = resolveTableNameForCall(tableName, void 0);
4361
4586
  const payload = {
4362
4587
  table_name: resolvedTableName,
4363
4588
  select: options.select
4364
4589
  };
4365
4590
  if (options.where !== void 0) {
4366
- payload.where = options.where;
4591
+ payload.where = normalizeFindManyAstWhere(options.where);
4367
4592
  }
4368
4593
  const astOrder = toFindManyAstOrder(executionState.order);
4369
4594
  if (astOrder !== void 0) {
@@ -4379,22 +4604,25 @@ function createTableBuilder(tableName, client, formatGatewayResult, tracer, expe
4379
4604
  limit: executionState.limit,
4380
4605
  order: executionState.order
4381
4606
  });
4382
- return executeWithQueryTrace(
4383
- tracer,
4384
- {
4385
- operation: "select",
4386
- endpoint: "/gateway/fetch",
4387
- table: resolvedTableName,
4388
- sql,
4389
- payload
4390
- },
4391
- async () => {
4392
- const response = await client.fetchGateway(
4607
+ return executeExperimentalRead(
4608
+ experimental,
4609
+ () => executeWithQueryTrace(
4610
+ tracer,
4611
+ {
4612
+ operation: "select",
4613
+ endpoint: "/gateway/fetch",
4614
+ table: resolvedTableName,
4615
+ sql,
4393
4616
  payload
4394
- );
4395
- return formatGatewayResult(response, { table: resolvedTableName, operation: "select" });
4396
- },
4397
- callsite
4617
+ },
4618
+ async () => {
4619
+ const response = await client.fetchGateway(
4620
+ payload
4621
+ );
4622
+ return formatGatewayResult(response, { table: resolvedTableName, operation: "select" });
4623
+ },
4624
+ callsite
4625
+ )
4398
4626
  );
4399
4627
  }
4400
4628
  return runSelect(
@@ -4642,7 +4870,7 @@ function createTableBuilder(tableName, client, formatGatewayResult, tracer, expe
4642
4870
  });
4643
4871
  return builder;
4644
4872
  }
4645
- function createQueryBuilder(client, formatGatewayResult, tracer) {
4873
+ function createQueryBuilder(client, formatGatewayResult, experimental, tracer) {
4646
4874
  return async function query(query, options) {
4647
4875
  const normalizedQuery = query.trim();
4648
4876
  if (!normalizedQuery) {
@@ -4650,30 +4878,39 @@ function createQueryBuilder(client, formatGatewayResult, tracer) {
4650
4878
  }
4651
4879
  const payload = { query: normalizedQuery };
4652
4880
  const callsite = captureTraceCallsite(tracer);
4653
- return executeWithQueryTrace(
4654
- tracer,
4655
- {
4656
- operation: "query",
4657
- endpoint: "/gateway/query",
4658
- sql: normalizedQuery,
4659
- payload,
4660
- options
4661
- },
4662
- async () => {
4663
- const response = await client.queryGateway(payload, options);
4664
- return formatGatewayResult(response, { operation: "query" });
4665
- },
4666
- callsite
4881
+ return executeExperimentalRead(
4882
+ experimental,
4883
+ () => executeWithQueryTrace(
4884
+ tracer,
4885
+ {
4886
+ operation: "query",
4887
+ endpoint: "/gateway/query",
4888
+ sql: normalizedQuery,
4889
+ payload,
4890
+ options
4891
+ },
4892
+ async () => {
4893
+ const response = await client.queryGateway(payload, options);
4894
+ return formatGatewayResult(response, { operation: "query" });
4895
+ },
4896
+ callsite
4897
+ )
4667
4898
  );
4668
4899
  };
4669
4900
  }
4670
4901
  function createClientFromConfig(config) {
4902
+ const gatewayHeaders = {
4903
+ ...config.headers ?? {}
4904
+ };
4905
+ if (config.auth?.bearerToken && gatewayHeaders["X-Athena-Auth-Bearer-Token"] === void 0 && gatewayHeaders["x-athena-auth-bearer-token"] === void 0) {
4906
+ gatewayHeaders["X-Athena-Auth-Bearer-Token"] = config.auth.bearerToken;
4907
+ }
4671
4908
  const gateway = createAthenaGatewayClient({
4672
4909
  baseUrl: config.baseUrl,
4673
4910
  apiKey: config.apiKey,
4674
4911
  client: config.client,
4675
4912
  backend: config.backend,
4676
- headers: config.headers
4913
+ headers: gatewayHeaders
4677
4914
  });
4678
4915
  const formatGatewayResult = createResultFormatter(config.experimental);
4679
4916
  const queryTracer = createQueryTracer(config.experimental);
@@ -4700,7 +4937,7 @@ function createClientFromConfig(config) {
4700
4937
  captureTraceCallsite(queryTracer)
4701
4938
  );
4702
4939
  };
4703
- const query = createQueryBuilder(gateway, formatGatewayResult, queryTracer);
4940
+ const query = createQueryBuilder(gateway, formatGatewayResult, config.experimental, queryTracer);
4704
4941
  const db = createDbModule({ from, rpc, query });
4705
4942
  return {
4706
4943
  from,
@@ -4750,7 +4987,6 @@ var AthenaClientBuilderImpl = class {
4750
4987
  defaultHeaders;
4751
4988
  authConfig;
4752
4989
  experimentalOptions;
4753
- isHealthTrackingEnabled = false;
4754
4990
  url(url) {
4755
4991
  this.baseUrl = url;
4756
4992
  return this;
@@ -4800,10 +5036,6 @@ var AthenaClientBuilderImpl = class {
4800
5036
  }
4801
5037
  return this;
4802
5038
  }
4803
- healthTracking(enabled) {
4804
- this.isHealthTrackingEnabled = enabled;
4805
- return this;
4806
- }
4807
5039
  build() {
4808
5040
  if (!this.baseUrl || !this.apiKey) {
4809
5041
  throw new Error("AthenaClient requires url and key; call .url() and .key() before .build()");
@@ -4814,7 +5046,6 @@ var AthenaClientBuilderImpl = class {
4814
5046
  client: this.clientName,
4815
5047
  backend: this.backendConfig,
4816
5048
  headers: this.defaultHeaders,
4817
- healthTracking: this.isHealthTrackingEnabled,
4818
5049
  auth: this.authConfig,
4819
5050
  experimental: this.experimentalOptions
4820
5051
  });
@@ -5434,7 +5665,7 @@ function resolveNullishValue(mode) {
5434
5665
  if (mode === "null") return null;
5435
5666
  return "";
5436
5667
  }
5437
- function isRecord7(value) {
5668
+ function isRecord8(value) {
5438
5669
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
5439
5670
  }
5440
5671
  function isNullableColumn(model, key) {
@@ -5443,7 +5674,7 @@ function isNullableColumn(model, key) {
5443
5674
  }
5444
5675
  function toModelFormDefaults(model, values, options) {
5445
5676
  const source = values;
5446
- if (!isRecord7(source)) {
5677
+ if (!isRecord8(source)) {
5447
5678
  return {};
5448
5679
  }
5449
5680
  const mode = options?.nullishMode ?? "empty-string";