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