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