@xylex-group/athena 2.7.0 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +210 -17
- package/dist/browser.cjs +1253 -401
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +8 -7
- package/dist/browser.d.ts +8 -7
- package/dist/browser.js +1247 -402
- package/dist/browser.js.map +1 -1
- package/dist/cli/index.cjs +1285 -451
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.d.cts +3 -3
- package/dist/cli/index.d.ts +3 -3
- package/dist/cli/index.js +1285 -451
- package/dist/cli/index.js.map +1 -1
- package/dist/index.cjs +1921 -698
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.js +1915 -699
- package/dist/index.js.map +1 -1
- package/dist/{model-form-AKYrgede.d.ts → model-form-DMed05gE.d.cts} +347 -82
- package/dist/{model-form-ehfqLuG7.d.cts → model-form-DXPlOnlI.d.ts} +347 -82
- package/dist/{pipeline-BUsR9XlO.d.ts → pipeline-CkMnhwPI.d.ts} +1 -1
- package/dist/{pipeline-BfCWSRYl.d.cts → pipeline-D4sJRKqN.d.cts} +1 -1
- package/dist/{react-email-BQzmXBDE.d.cts → react-email-DZhDDlEl.d.cts} +121 -8
- package/dist/{react-email-BrVRp80B.d.ts → react-email-Lrz9A-BW.d.ts} +121 -8
- package/dist/react.cjs +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +4 -4
- package/dist/react.d.ts +4 -4
- package/dist/react.js +1 -1
- package/dist/react.js.map +1 -1
- package/dist/{types-BSIsyss1.d.cts → types-BzY6fETM.d.ts} +47 -5
- package/dist/{types-t_TVqnmp.d.ts → types-CAtTGGoz.d.cts} +47 -5
- package/dist/{types-BsyRW49r.d.cts → types-vikz9YIO.d.cts} +23 -1
- package/dist/{types-BsyRW49r.d.ts → types-vikz9YIO.d.ts} +23 -1
- package/package.json +3 -2
package/dist/browser.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
1
3
|
// src/gateway/errors.ts
|
|
2
4
|
var AthenaGatewayError = class _AthenaGatewayError extends Error {
|
|
3
5
|
code;
|
|
@@ -798,7 +800,7 @@ var getCookieCache = async (request, config) => {
|
|
|
798
800
|
|
|
799
801
|
// package.json
|
|
800
802
|
var package_default = {
|
|
801
|
-
version: "2.
|
|
803
|
+
version: "2.8.0"
|
|
802
804
|
};
|
|
803
805
|
|
|
804
806
|
// src/sdk-version.ts
|
|
@@ -3115,7 +3117,7 @@ function normalizeAthenaError(resultOrError, context) {
|
|
|
3115
3117
|
const details = resultOrError.errorDetails;
|
|
3116
3118
|
const message2 = messageFromUnknownError(resultOrError.error) ?? details?.message ?? `Athena ${context?.operation ?? operationFromDetails(details) ?? "request"} failed`;
|
|
3117
3119
|
const operation = context?.operation ?? operationFromDetails(details);
|
|
3118
|
-
const
|
|
3120
|
+
const table2 = context?.table ?? extractTable(message2);
|
|
3119
3121
|
const constraint = extractConstraint(message2);
|
|
3120
3122
|
const gatewayCode = details?.code ?? gatewayCodeFromUnknownError(resultOrError.error);
|
|
3121
3123
|
const kind2 = classifyKind(resultOrError.status, gatewayCode, message2);
|
|
@@ -3128,7 +3130,7 @@ function normalizeAthenaError(resultOrError, context) {
|
|
|
3128
3130
|
retryable: isRetryable(kind2, resultOrError.status),
|
|
3129
3131
|
status: resultOrError.status,
|
|
3130
3132
|
constraint,
|
|
3131
|
-
table,
|
|
3133
|
+
table: table2,
|
|
3132
3134
|
operation,
|
|
3133
3135
|
message: message2,
|
|
3134
3136
|
raw: resultOrError.raw
|
|
@@ -3137,7 +3139,7 @@ function normalizeAthenaError(resultOrError, context) {
|
|
|
3137
3139
|
if (isAthenaGatewayError(resultOrError)) {
|
|
3138
3140
|
const details = resultOrError.toDetails();
|
|
3139
3141
|
const operation = context?.operation ?? operationFromDetails(details);
|
|
3140
|
-
const
|
|
3142
|
+
const table2 = context?.table ?? extractTable(resultOrError.message);
|
|
3141
3143
|
const constraint = extractConstraint(resultOrError.message);
|
|
3142
3144
|
const kind2 = classifyKind(resultOrError.status, resultOrError.code, resultOrError.message);
|
|
3143
3145
|
const code = toAthenaErrorCode(kind2, resultOrError.status, resultOrError.code);
|
|
@@ -3149,7 +3151,7 @@ function normalizeAthenaError(resultOrError, context) {
|
|
|
3149
3151
|
retryable: isRetryable(kind2, resultOrError.status),
|
|
3150
3152
|
status: resultOrError.status,
|
|
3151
3153
|
constraint,
|
|
3152
|
-
table,
|
|
3154
|
+
table: table2,
|
|
3153
3155
|
operation,
|
|
3154
3156
|
message: resultOrError.message,
|
|
3155
3157
|
raw: resultOrError
|
|
@@ -3345,23 +3347,24 @@ async function withRetry(config, fn) {
|
|
|
3345
3347
|
// src/db/module.ts
|
|
3346
3348
|
function createDbModule(input) {
|
|
3347
3349
|
const db = {
|
|
3348
|
-
from
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3350
|
+
from: input.from,
|
|
3351
|
+
select(table2, first, second) {
|
|
3352
|
+
if (first && typeof first === "object" && !Array.isArray(first)) {
|
|
3353
|
+
return input.from(table2).select(void 0, first);
|
|
3354
|
+
}
|
|
3355
|
+
return input.from(table2).select(first, second);
|
|
3353
3356
|
},
|
|
3354
|
-
insert(
|
|
3355
|
-
return Array.isArray(values) ? input.from(
|
|
3357
|
+
insert(table2, values, options) {
|
|
3358
|
+
return Array.isArray(values) ? input.from(table2).insert(values, options) : input.from(table2).insert(values, options);
|
|
3356
3359
|
},
|
|
3357
|
-
upsert(
|
|
3358
|
-
return Array.isArray(values) ? input.from(
|
|
3360
|
+
upsert(table2, values, options) {
|
|
3361
|
+
return Array.isArray(values) ? input.from(table2).upsert(values, options) : input.from(table2).upsert(values, options);
|
|
3359
3362
|
},
|
|
3360
|
-
update(
|
|
3361
|
-
return input.from(
|
|
3363
|
+
update(table2, values, options) {
|
|
3364
|
+
return input.from(table2).update(values, options);
|
|
3362
3365
|
},
|
|
3363
|
-
delete(
|
|
3364
|
-
return input.from(
|
|
3366
|
+
delete(table2, options) {
|
|
3367
|
+
return input.from(table2).delete(options);
|
|
3365
3368
|
},
|
|
3366
3369
|
rpc(fn, args, options) {
|
|
3367
3370
|
return input.rpc(fn, args, options);
|
|
@@ -4030,6 +4033,15 @@ function appendQuery(path, query) {
|
|
|
4030
4033
|
function storagePath(path) {
|
|
4031
4034
|
return path;
|
|
4032
4035
|
}
|
|
4036
|
+
function resolveStorageEndpointPath(endpoint, runtimeOptions) {
|
|
4037
|
+
if (!runtimeOptions?.stripBasePath) {
|
|
4038
|
+
return endpoint;
|
|
4039
|
+
}
|
|
4040
|
+
const [pathname, queryText] = String(endpoint).split("?", 2);
|
|
4041
|
+
const trimmedPathname = pathname.startsWith("/storage/") ? pathname.slice("/storage".length) : pathname === "/storage" ? "/" : pathname;
|
|
4042
|
+
const resolvedPath = trimmedPathname.startsWith("/") ? trimmedPathname : `/${trimmedPathname}`;
|
|
4043
|
+
return storagePath(queryText ? `${resolvedPath}?${queryText}` : resolvedPath);
|
|
4044
|
+
}
|
|
4033
4045
|
function withPathParam(path, name, value) {
|
|
4034
4046
|
return path.replace(`{${name}}`, encodeURIComponent(value));
|
|
4035
4047
|
}
|
|
@@ -4068,8 +4080,8 @@ async function callStorageEndpoint(gateway, endpoint, method, envelope, payload,
|
|
|
4068
4080
|
let url;
|
|
4069
4081
|
let headers;
|
|
4070
4082
|
try {
|
|
4071
|
-
const baseUrl = options?.baseUrl ? normalizeAthenaGatewayBaseUrl(options.baseUrl) : gateway.baseUrl;
|
|
4072
|
-
url = buildAthenaGatewayUrl(baseUrl, endpoint);
|
|
4083
|
+
const baseUrl = options?.baseUrl ? normalizeAthenaGatewayBaseUrl(options.baseUrl) : runtimeOptions?.baseUrl ? normalizeAthenaGatewayBaseUrl(runtimeOptions.baseUrl) : gateway.baseUrl;
|
|
4084
|
+
url = buildAthenaGatewayUrl(baseUrl, resolveStorageEndpointPath(endpoint, runtimeOptions));
|
|
4073
4085
|
headers = gateway.buildHeaders(options);
|
|
4074
4086
|
} catch (error) {
|
|
4075
4087
|
return rejectStorageError(
|
|
@@ -4193,8 +4205,8 @@ async function callStorageBinaryEndpoint(gateway, endpoint, method, options, run
|
|
|
4193
4205
|
let url;
|
|
4194
4206
|
let headers;
|
|
4195
4207
|
try {
|
|
4196
|
-
const baseUrl = options?.baseUrl ? normalizeAthenaGatewayBaseUrl(options.baseUrl) : gateway.baseUrl;
|
|
4197
|
-
url = buildAthenaGatewayUrl(baseUrl, endpoint);
|
|
4208
|
+
const baseUrl = options?.baseUrl ? normalizeAthenaGatewayBaseUrl(options.baseUrl) : runtimeOptions?.baseUrl ? normalizeAthenaGatewayBaseUrl(runtimeOptions.baseUrl) : gateway.baseUrl;
|
|
4209
|
+
url = buildAthenaGatewayUrl(baseUrl, resolveStorageEndpointPath(endpoint, runtimeOptions));
|
|
4198
4210
|
headers = gateway.buildHeaders(options);
|
|
4199
4211
|
} catch (error) {
|
|
4200
4212
|
return rejectStorageError(
|
|
@@ -4355,8 +4367,8 @@ async function callStorageUploadBinaryEndpoint(gateway, endpoint, body, options,
|
|
|
4355
4367
|
let url;
|
|
4356
4368
|
let headers;
|
|
4357
4369
|
try {
|
|
4358
|
-
const baseUrl = options?.baseUrl ? normalizeAthenaGatewayBaseUrl(options.baseUrl) : gateway.baseUrl;
|
|
4359
|
-
url = buildAthenaGatewayUrl(baseUrl, endpoint);
|
|
4370
|
+
const baseUrl = options?.baseUrl ? normalizeAthenaGatewayBaseUrl(options.baseUrl) : runtimeOptions?.baseUrl ? normalizeAthenaGatewayBaseUrl(runtimeOptions.baseUrl) : gateway.baseUrl;
|
|
4371
|
+
url = buildAthenaGatewayUrl(baseUrl, resolveStorageEndpointPath(endpoint, runtimeOptions));
|
|
4360
4372
|
headers = gateway.buildHeaders(options);
|
|
4361
4373
|
} catch (error) {
|
|
4362
4374
|
return rejectStorageError(
|
|
@@ -4480,6 +4492,7 @@ async function callStorageUploadBinaryEndpoint(gateway, endpoint, body, options,
|
|
|
4480
4492
|
return parsedBody.parsed.data;
|
|
4481
4493
|
}
|
|
4482
4494
|
function createStorageModule(gateway, runtimeOptions) {
|
|
4495
|
+
const resolvedRuntimeOptions = runtimeOptions;
|
|
4483
4496
|
const callRaw = (path, method, payload, options) => callStorageEndpoint(
|
|
4484
4497
|
gateway,
|
|
4485
4498
|
storagePath(path),
|
|
@@ -4487,7 +4500,7 @@ function createStorageModule(gateway, runtimeOptions) {
|
|
|
4487
4500
|
"raw",
|
|
4488
4501
|
payload,
|
|
4489
4502
|
options,
|
|
4490
|
-
|
|
4503
|
+
resolvedRuntimeOptions
|
|
4491
4504
|
);
|
|
4492
4505
|
const callAthena2 = (path, method, payload, options) => callStorageEndpoint(
|
|
4493
4506
|
gateway,
|
|
@@ -4496,7 +4509,7 @@ function createStorageModule(gateway, runtimeOptions) {
|
|
|
4496
4509
|
"athena",
|
|
4497
4510
|
payload,
|
|
4498
4511
|
options,
|
|
4499
|
-
|
|
4512
|
+
resolvedRuntimeOptions
|
|
4500
4513
|
);
|
|
4501
4514
|
const base = {
|
|
4502
4515
|
listStorageCatalogs(options) {
|
|
@@ -4538,7 +4551,7 @@ function createStorageModule(gateway, runtimeOptions) {
|
|
|
4538
4551
|
withPathParam("/storage/files/{file_id}/proxy", "file_id", fileId),
|
|
4539
4552
|
query
|
|
4540
4553
|
);
|
|
4541
|
-
return callStorageBinaryEndpoint(gateway, storagePath(path), "GET", options,
|
|
4554
|
+
return callStorageBinaryEndpoint(gateway, storagePath(path), "GET", options, resolvedRuntimeOptions);
|
|
4542
4555
|
},
|
|
4543
4556
|
updateStorageFile(fileId, input, options) {
|
|
4544
4557
|
return callAthena2(withPathParam("/storage/files/{file_id}", "file_id", fileId), "PATCH", input, options);
|
|
@@ -4585,7 +4598,7 @@ function createStorageModule(gateway, runtimeOptions) {
|
|
|
4585
4598
|
storagePath(withPathParam("/storage/files/{file_id}/upload", "file_id", fileId)),
|
|
4586
4599
|
body,
|
|
4587
4600
|
options,
|
|
4588
|
-
|
|
4601
|
+
resolvedRuntimeOptions
|
|
4589
4602
|
);
|
|
4590
4603
|
},
|
|
4591
4604
|
search(input, options) {
|
|
@@ -4781,6 +4794,176 @@ function createStorageModule(gateway, runtimeOptions) {
|
|
|
4781
4794
|
};
|
|
4782
4795
|
}
|
|
4783
4796
|
|
|
4797
|
+
// src/client-builder.ts
|
|
4798
|
+
var DEFAULT_BACKEND = { type: "athena" };
|
|
4799
|
+
function toBackendConfig(value) {
|
|
4800
|
+
if (!value) return DEFAULT_BACKEND;
|
|
4801
|
+
return typeof value === "string" ? { type: value } : value;
|
|
4802
|
+
}
|
|
4803
|
+
function mergeHeaders(current, next) {
|
|
4804
|
+
return {
|
|
4805
|
+
...current ?? {},
|
|
4806
|
+
...next
|
|
4807
|
+
};
|
|
4808
|
+
}
|
|
4809
|
+
function mergeAuthClientConfig(current, next) {
|
|
4810
|
+
const merged = {
|
|
4811
|
+
...current ?? {},
|
|
4812
|
+
...next
|
|
4813
|
+
};
|
|
4814
|
+
if (current?.headers || next.headers) {
|
|
4815
|
+
merged.headers = mergeHeaders(current?.headers, next.headers ?? {});
|
|
4816
|
+
}
|
|
4817
|
+
return merged;
|
|
4818
|
+
}
|
|
4819
|
+
function mergeExperimentalOptions(current, next) {
|
|
4820
|
+
const merged = {
|
|
4821
|
+
...current ?? {},
|
|
4822
|
+
...next
|
|
4823
|
+
};
|
|
4824
|
+
if (current?.traceQueries && typeof current.traceQueries === "object" && next.traceQueries && typeof next.traceQueries === "object") {
|
|
4825
|
+
merged.traceQueries = {
|
|
4826
|
+
...current.traceQueries,
|
|
4827
|
+
...next.traceQueries
|
|
4828
|
+
};
|
|
4829
|
+
}
|
|
4830
|
+
if (current?.storage || next.storage) {
|
|
4831
|
+
merged.storage = {
|
|
4832
|
+
...current?.storage ?? {},
|
|
4833
|
+
...next.storage ?? {}
|
|
4834
|
+
};
|
|
4835
|
+
}
|
|
4836
|
+
return merged;
|
|
4837
|
+
}
|
|
4838
|
+
function resolveBuilderReturn(builder, storageEnabled, strictEnabled) {
|
|
4839
|
+
return builder;
|
|
4840
|
+
}
|
|
4841
|
+
var AthenaClientBuilderImpl = class {
|
|
4842
|
+
constructor(buildClient) {
|
|
4843
|
+
this.buildClient = buildClient;
|
|
4844
|
+
}
|
|
4845
|
+
rootUrl;
|
|
4846
|
+
apiKey;
|
|
4847
|
+
backendConfig = DEFAULT_BACKEND;
|
|
4848
|
+
clientName;
|
|
4849
|
+
defaultHeaders;
|
|
4850
|
+
authConfig;
|
|
4851
|
+
dbUrlOverride;
|
|
4852
|
+
gatewayUrlOverride;
|
|
4853
|
+
authUrlOverride;
|
|
4854
|
+
storageUrlOverride;
|
|
4855
|
+
experimentalOptions;
|
|
4856
|
+
url(url) {
|
|
4857
|
+
this.rootUrl = url;
|
|
4858
|
+
return this;
|
|
4859
|
+
}
|
|
4860
|
+
key(apiKey) {
|
|
4861
|
+
this.apiKey = apiKey;
|
|
4862
|
+
return this;
|
|
4863
|
+
}
|
|
4864
|
+
backend(backend) {
|
|
4865
|
+
this.backendConfig = toBackendConfig(backend);
|
|
4866
|
+
return this;
|
|
4867
|
+
}
|
|
4868
|
+
client(clientName) {
|
|
4869
|
+
this.clientName = clientName;
|
|
4870
|
+
return this;
|
|
4871
|
+
}
|
|
4872
|
+
headers(headers) {
|
|
4873
|
+
this.defaultHeaders = headers;
|
|
4874
|
+
return this;
|
|
4875
|
+
}
|
|
4876
|
+
auth(config) {
|
|
4877
|
+
this.authConfig = mergeAuthClientConfig(this.authConfig, config);
|
|
4878
|
+
return this;
|
|
4879
|
+
}
|
|
4880
|
+
experimental(options) {
|
|
4881
|
+
this.experimentalOptions = mergeExperimentalOptions(this.experimentalOptions, options);
|
|
4882
|
+
if (options.athenaStorageBackend && options.typecheckColumns) {
|
|
4883
|
+
return resolveBuilderReturn(this);
|
|
4884
|
+
}
|
|
4885
|
+
if (options.athenaStorageBackend) {
|
|
4886
|
+
return resolveBuilderReturn(this);
|
|
4887
|
+
}
|
|
4888
|
+
if (options.typecheckColumns) {
|
|
4889
|
+
return resolveBuilderReturn(this);
|
|
4890
|
+
}
|
|
4891
|
+
return this;
|
|
4892
|
+
}
|
|
4893
|
+
options(options) {
|
|
4894
|
+
if (options.client !== void 0) {
|
|
4895
|
+
this.clientName = options.client;
|
|
4896
|
+
}
|
|
4897
|
+
if (options.backend !== void 0) {
|
|
4898
|
+
this.backendConfig = toBackendConfig(options.backend);
|
|
4899
|
+
}
|
|
4900
|
+
if (options.headers !== void 0) {
|
|
4901
|
+
this.defaultHeaders = mergeHeaders(this.defaultHeaders, options.headers);
|
|
4902
|
+
}
|
|
4903
|
+
if (options.auth !== void 0) {
|
|
4904
|
+
this.authConfig = mergeAuthClientConfig(this.authConfig, options.auth);
|
|
4905
|
+
}
|
|
4906
|
+
if (options.db?.url !== void 0 && options.db.url !== null) {
|
|
4907
|
+
this.dbUrlOverride = options.db.url;
|
|
4908
|
+
}
|
|
4909
|
+
if (options.gateway?.url !== void 0 && options.gateway.url !== null) {
|
|
4910
|
+
this.gatewayUrlOverride = options.gateway.url;
|
|
4911
|
+
}
|
|
4912
|
+
if (options.dbUrl !== void 0 && options.dbUrl !== null) {
|
|
4913
|
+
this.dbUrlOverride = options.dbUrl;
|
|
4914
|
+
}
|
|
4915
|
+
if (options.gatewayUrl !== void 0 && options.gatewayUrl !== null) {
|
|
4916
|
+
this.gatewayUrlOverride = options.gatewayUrl;
|
|
4917
|
+
}
|
|
4918
|
+
if (options.authUrl !== void 0 && options.authUrl !== null) {
|
|
4919
|
+
this.authUrlOverride = options.authUrl;
|
|
4920
|
+
}
|
|
4921
|
+
if (options.storage?.url !== void 0 && options.storage.url !== null) {
|
|
4922
|
+
this.storageUrlOverride = options.storage.url;
|
|
4923
|
+
}
|
|
4924
|
+
if (options.storageUrl !== void 0 && options.storageUrl !== null) {
|
|
4925
|
+
this.storageUrlOverride = options.storageUrl;
|
|
4926
|
+
}
|
|
4927
|
+
if (options.experimental !== void 0) {
|
|
4928
|
+
this.experimentalOptions = mergeExperimentalOptions(this.experimentalOptions, options.experimental);
|
|
4929
|
+
}
|
|
4930
|
+
if (options.experimental?.athenaStorageBackend && options.experimental.typecheckColumns) {
|
|
4931
|
+
return resolveBuilderReturn(this);
|
|
4932
|
+
}
|
|
4933
|
+
if (options.experimental?.athenaStorageBackend) {
|
|
4934
|
+
return resolveBuilderReturn(this);
|
|
4935
|
+
}
|
|
4936
|
+
if (options.experimental?.typecheckColumns) {
|
|
4937
|
+
return resolveBuilderReturn(this);
|
|
4938
|
+
}
|
|
4939
|
+
return this;
|
|
4940
|
+
}
|
|
4941
|
+
build() {
|
|
4942
|
+
if (!this.rootUrl && !this.dbUrlOverride && !this.gatewayUrlOverride || !this.apiKey) {
|
|
4943
|
+
throw new Error(
|
|
4944
|
+
"AthenaClient requires key plus either .url() or a db/gateway override before .build()"
|
|
4945
|
+
);
|
|
4946
|
+
}
|
|
4947
|
+
return this.buildClient({
|
|
4948
|
+
url: this.rootUrl,
|
|
4949
|
+
key: this.apiKey,
|
|
4950
|
+
client: this.clientName,
|
|
4951
|
+
backend: this.backendConfig,
|
|
4952
|
+
headers: this.defaultHeaders,
|
|
4953
|
+
db: this.dbUrlOverride ? { url: this.dbUrlOverride } : void 0,
|
|
4954
|
+
gateway: this.gatewayUrlOverride ? { url: this.gatewayUrlOverride } : void 0,
|
|
4955
|
+
auth: this.authConfig,
|
|
4956
|
+
authUrl: this.authUrlOverride,
|
|
4957
|
+
storage: this.storageUrlOverride ? { url: this.storageUrlOverride } : void 0,
|
|
4958
|
+
storageUrl: this.storageUrlOverride,
|
|
4959
|
+
experimental: this.experimentalOptions
|
|
4960
|
+
});
|
|
4961
|
+
}
|
|
4962
|
+
};
|
|
4963
|
+
function createAthenaClientBuilder(buildClient) {
|
|
4964
|
+
return new AthenaClientBuilderImpl(buildClient);
|
|
4965
|
+
}
|
|
4966
|
+
|
|
4784
4967
|
// src/query-ast.ts
|
|
4785
4968
|
var UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
4786
4969
|
var FILTER_OPERATORS = /* @__PURE__ */ new Set([
|
|
@@ -5403,161 +5586,258 @@ function createSelectTransportPlan(input) {
|
|
|
5403
5586
|
};
|
|
5404
5587
|
}
|
|
5405
5588
|
|
|
5406
|
-
// src/
|
|
5407
|
-
var
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
function formatResult(response) {
|
|
5421
|
-
const result = {
|
|
5422
|
-
data: response.data ?? null,
|
|
5423
|
-
error: null,
|
|
5424
|
-
errorDetails: response.errorDetails ?? null,
|
|
5425
|
-
status: response.status,
|
|
5426
|
-
statusText: response.statusText ?? null,
|
|
5427
|
-
raw: response.raw
|
|
5589
|
+
// src/query-debug-ast.ts
|
|
5590
|
+
var ATHENA_DEBUG_AST_KEY = "__athenaDebugAst";
|
|
5591
|
+
function cloneConditions(conditions) {
|
|
5592
|
+
return conditions.map((condition) => ({ ...condition }));
|
|
5593
|
+
}
|
|
5594
|
+
function cloneTableBuilderStateAst(state) {
|
|
5595
|
+
return {
|
|
5596
|
+
conditions: cloneConditions(state.conditions),
|
|
5597
|
+
limit: state.limit,
|
|
5598
|
+
offset: state.offset,
|
|
5599
|
+
order: state.order ? { ...state.order } : void 0,
|
|
5600
|
+
currentPage: state.currentPage,
|
|
5601
|
+
pageSize: state.pageSize,
|
|
5602
|
+
totalPages: state.totalPages
|
|
5428
5603
|
};
|
|
5429
|
-
|
|
5430
|
-
|
|
5604
|
+
}
|
|
5605
|
+
function cloneRpcBuilderStateAst(state) {
|
|
5606
|
+
return {
|
|
5607
|
+
filters: state.filters.map((filter) => ({ ...filter })),
|
|
5608
|
+
limit: state.limit,
|
|
5609
|
+
offset: state.offset,
|
|
5610
|
+
order: state.order ? { ...state.order } : void 0
|
|
5611
|
+
};
|
|
5612
|
+
}
|
|
5613
|
+
function toSelectTransportAst(plan) {
|
|
5614
|
+
if (plan.kind === "query") {
|
|
5615
|
+
return {
|
|
5616
|
+
mode: "typed-query",
|
|
5617
|
+
endpoint: "/gateway/query",
|
|
5618
|
+
payload: plan.payload
|
|
5619
|
+
};
|
|
5431
5620
|
}
|
|
5432
|
-
return
|
|
5621
|
+
return {
|
|
5622
|
+
mode: plan.payload.select !== void 0 ? "structured-fetch" : "compiled-fetch",
|
|
5623
|
+
endpoint: "/gateway/fetch",
|
|
5624
|
+
payload: plan.payload
|
|
5625
|
+
};
|
|
5433
5626
|
}
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
baseDelayMs: 100,
|
|
5437
|
-
maxDelayMs: 1e3,
|
|
5438
|
-
backoff: "exponential",
|
|
5439
|
-
jitter: true
|
|
5440
|
-
};
|
|
5441
|
-
function attachNormalizedError(result, normalizedError) {
|
|
5442
|
-
Object.defineProperty(result, ATHENA_NORMALIZED_ERROR_KEY, {
|
|
5443
|
-
value: normalizedError,
|
|
5444
|
-
enumerable: false,
|
|
5445
|
-
configurable: true,
|
|
5446
|
-
writable: false
|
|
5447
|
-
});
|
|
5627
|
+
function resolveDebugTableName(tableName) {
|
|
5628
|
+
return tableName ?? "__unknown_table__";
|
|
5448
5629
|
}
|
|
5449
|
-
function
|
|
5450
|
-
return
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
|
|
5630
|
+
function buildSelectDebugAst(input) {
|
|
5631
|
+
return {
|
|
5632
|
+
version: 1,
|
|
5633
|
+
kind: "select",
|
|
5634
|
+
tableName: input.tableName,
|
|
5635
|
+
input: {
|
|
5636
|
+
columns: input.columns,
|
|
5637
|
+
state: cloneTableBuilderStateAst(input.state)
|
|
5638
|
+
},
|
|
5639
|
+
transport: toSelectTransportAst(input.plan)
|
|
5640
|
+
};
|
|
5641
|
+
}
|
|
5642
|
+
function buildFindManyCompiledDebugAst(input) {
|
|
5643
|
+
return {
|
|
5644
|
+
version: 1,
|
|
5645
|
+
kind: "findMany",
|
|
5646
|
+
tableName: input.tableName,
|
|
5647
|
+
input: {
|
|
5648
|
+
select: input.options.select,
|
|
5649
|
+
where: input.options.where,
|
|
5650
|
+
orderBy: input.options.orderBy,
|
|
5651
|
+
limit: input.options.limit
|
|
5652
|
+
},
|
|
5653
|
+
compiled: {
|
|
5654
|
+
columns: input.compiledColumns,
|
|
5655
|
+
baseState: cloneTableBuilderStateAst(input.baseState),
|
|
5656
|
+
executionState: cloneTableBuilderStateAst(input.executionState)
|
|
5657
|
+
},
|
|
5658
|
+
transport: planToFindManyTransport(input.plan)
|
|
5659
|
+
};
|
|
5660
|
+
}
|
|
5661
|
+
function buildFindManyDirectDebugAst(input) {
|
|
5662
|
+
return {
|
|
5663
|
+
version: 1,
|
|
5664
|
+
kind: "findMany",
|
|
5665
|
+
tableName: input.tableName,
|
|
5666
|
+
input: {
|
|
5667
|
+
select: input.options.select,
|
|
5668
|
+
where: input.options.where,
|
|
5669
|
+
orderBy: input.options.orderBy,
|
|
5670
|
+
limit: input.options.limit
|
|
5671
|
+
},
|
|
5672
|
+
compiled: {
|
|
5673
|
+
columns: input.compiledColumns,
|
|
5674
|
+
baseState: cloneTableBuilderStateAst(input.baseState),
|
|
5675
|
+
executionState: cloneTableBuilderStateAst(input.executionState)
|
|
5676
|
+
},
|
|
5677
|
+
transport: {
|
|
5678
|
+
mode: "direct-ast-fetch",
|
|
5679
|
+
endpoint: "/gateway/fetch",
|
|
5680
|
+
payload: input.payload
|
|
5454
5681
|
}
|
|
5455
|
-
const normalizedError = normalizeAthenaError(
|
|
5456
|
-
{
|
|
5457
|
-
...result,
|
|
5458
|
-
error: response.error ?? response.errorDetails?.message ?? null
|
|
5459
|
-
},
|
|
5460
|
-
context
|
|
5461
|
-
);
|
|
5462
|
-
result.error = createResultError(response, result, normalizedError);
|
|
5463
|
-
attachNormalizedError(result, normalizedError);
|
|
5464
|
-
return result;
|
|
5465
5682
|
};
|
|
5466
5683
|
}
|
|
5467
|
-
|
|
5468
|
-
if (
|
|
5469
|
-
return
|
|
5684
|
+
function planToFindManyTransport(plan) {
|
|
5685
|
+
if (plan.kind === "query") {
|
|
5686
|
+
return {
|
|
5687
|
+
mode: "compiled-query",
|
|
5688
|
+
endpoint: "/gateway/query",
|
|
5689
|
+
payload: plan.payload
|
|
5690
|
+
};
|
|
5470
5691
|
}
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5692
|
+
return {
|
|
5693
|
+
mode: plan.payload.select !== void 0 ? "structured-fetch" : "compiled-fetch",
|
|
5694
|
+
endpoint: "/gateway/fetch",
|
|
5695
|
+
payload: plan.payload
|
|
5696
|
+
};
|
|
5697
|
+
}
|
|
5698
|
+
function buildInsertDebugAst(payload) {
|
|
5699
|
+
return {
|
|
5700
|
+
version: 1,
|
|
5701
|
+
kind: "insert",
|
|
5702
|
+
tableName: payload.table_name,
|
|
5703
|
+
input: {
|
|
5704
|
+
values: payload.insert_body,
|
|
5705
|
+
returning: payload.columns,
|
|
5706
|
+
count: payload.count,
|
|
5707
|
+
head: payload.head,
|
|
5708
|
+
defaultToNull: payload.default_to_null
|
|
5709
|
+
},
|
|
5710
|
+
transport: {
|
|
5711
|
+
mode: "insert",
|
|
5712
|
+
endpoint: "/gateway/insert",
|
|
5713
|
+
payload
|
|
5492
5714
|
}
|
|
5493
|
-
|
|
5494
|
-
}
|
|
5715
|
+
};
|
|
5495
5716
|
}
|
|
5496
|
-
function
|
|
5497
|
-
return
|
|
5717
|
+
function buildUpsertDebugAst(payload) {
|
|
5718
|
+
return {
|
|
5719
|
+
version: 1,
|
|
5720
|
+
kind: "upsert",
|
|
5721
|
+
tableName: payload.table_name,
|
|
5722
|
+
input: {
|
|
5723
|
+
values: payload.insert_body,
|
|
5724
|
+
updateBody: payload.update_body,
|
|
5725
|
+
onConflict: payload.on_conflict,
|
|
5726
|
+
returning: payload.columns,
|
|
5727
|
+
count: payload.count,
|
|
5728
|
+
head: payload.head,
|
|
5729
|
+
defaultToNull: payload.default_to_null
|
|
5730
|
+
},
|
|
5731
|
+
transport: {
|
|
5732
|
+
mode: "upsert",
|
|
5733
|
+
endpoint: "/gateway/insert",
|
|
5734
|
+
payload
|
|
5735
|
+
}
|
|
5736
|
+
};
|
|
5498
5737
|
}
|
|
5499
|
-
function
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5738
|
+
function buildUpdateDebugAst(input) {
|
|
5739
|
+
return {
|
|
5740
|
+
version: 1,
|
|
5741
|
+
kind: "update",
|
|
5742
|
+
tableName: resolveDebugTableName(input.payload.table_name),
|
|
5743
|
+
input: {
|
|
5744
|
+
values: input.payload.set,
|
|
5745
|
+
state: cloneTableBuilderStateAst(input.state),
|
|
5746
|
+
returning: input.payload.columns
|
|
5747
|
+
},
|
|
5748
|
+
transport: {
|
|
5749
|
+
mode: "update",
|
|
5750
|
+
endpoint: "/gateway/update",
|
|
5751
|
+
payload: input.payload
|
|
5503
5752
|
}
|
|
5504
|
-
}
|
|
5505
|
-
return void 0;
|
|
5753
|
+
};
|
|
5506
5754
|
}
|
|
5507
|
-
function
|
|
5508
|
-
|
|
5509
|
-
|
|
5755
|
+
function buildDeleteDebugAst(input) {
|
|
5756
|
+
return {
|
|
5757
|
+
version: 1,
|
|
5758
|
+
kind: "delete",
|
|
5759
|
+
tableName: input.payload.table_name,
|
|
5760
|
+
input: {
|
|
5761
|
+
resourceId: input.payload.resource_id,
|
|
5762
|
+
state: cloneTableBuilderStateAst(input.state),
|
|
5763
|
+
returning: input.payload.columns
|
|
5764
|
+
},
|
|
5765
|
+
transport: {
|
|
5766
|
+
mode: "delete",
|
|
5767
|
+
endpoint: "/gateway/delete",
|
|
5768
|
+
payload: input.payload
|
|
5769
|
+
}
|
|
5770
|
+
};
|
|
5510
5771
|
}
|
|
5511
|
-
function
|
|
5512
|
-
|
|
5513
|
-
|
|
5772
|
+
function buildRpcDebugAst(input) {
|
|
5773
|
+
return {
|
|
5774
|
+
version: 1,
|
|
5775
|
+
kind: "rpc",
|
|
5776
|
+
functionName: input.functionName,
|
|
5777
|
+
input: {
|
|
5778
|
+
args: input.args,
|
|
5779
|
+
select: input.selectedColumns,
|
|
5780
|
+
state: cloneRpcBuilderStateAst(input.state)
|
|
5781
|
+
},
|
|
5782
|
+
transport: {
|
|
5783
|
+
mode: input.endpoint === "/gateway/rpc" ? "rpc-post" : "rpc-get",
|
|
5784
|
+
endpoint: input.endpoint,
|
|
5785
|
+
payload: input.payload
|
|
5786
|
+
}
|
|
5787
|
+
};
|
|
5788
|
+
}
|
|
5789
|
+
function buildRawQueryDebugAst(query) {
|
|
5790
|
+
return {
|
|
5791
|
+
version: 1,
|
|
5792
|
+
kind: "query",
|
|
5793
|
+
input: {
|
|
5794
|
+
query
|
|
5795
|
+
},
|
|
5796
|
+
transport: {
|
|
5797
|
+
mode: "raw-query",
|
|
5798
|
+
endpoint: "/gateway/query",
|
|
5799
|
+
payload: {
|
|
5800
|
+
query
|
|
5801
|
+
}
|
|
5802
|
+
}
|
|
5803
|
+
};
|
|
5804
|
+
}
|
|
5805
|
+
function attachAthenaDebugAst(target, ast) {
|
|
5806
|
+
if (!ast) {
|
|
5807
|
+
return;
|
|
5514
5808
|
}
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
return null;
|
|
5809
|
+
if (!target || typeof target !== "object" && typeof target !== "function") {
|
|
5810
|
+
return;
|
|
5518
5811
|
}
|
|
5519
|
-
|
|
5812
|
+
Object.defineProperty(target, ATHENA_DEBUG_AST_KEY, {
|
|
5813
|
+
value: ast,
|
|
5814
|
+
enumerable: false,
|
|
5815
|
+
configurable: true,
|
|
5816
|
+
writable: false
|
|
5817
|
+
});
|
|
5818
|
+
}
|
|
5819
|
+
function getAthenaDebugAst(value) {
|
|
5820
|
+
if (!value || typeof value !== "object" && typeof value !== "function") {
|
|
5520
5821
|
return null;
|
|
5521
5822
|
}
|
|
5522
|
-
return
|
|
5523
|
-
}
|
|
5524
|
-
function createResultError(response, result, normalized) {
|
|
5525
|
-
const rawRecord = isRecord9(response.raw) ? response.raw : null;
|
|
5526
|
-
const payload = resolveStructuredErrorPayload2(response.raw);
|
|
5527
|
-
const message = firstNonEmptyString2(
|
|
5528
|
-
response.error,
|
|
5529
|
-
payload?.message,
|
|
5530
|
-
payload?.error,
|
|
5531
|
-
payload?.details,
|
|
5532
|
-
response.errorDetails?.message,
|
|
5533
|
-
normalized.message
|
|
5534
|
-
) ?? normalized.message;
|
|
5535
|
-
const statusText = firstNonEmptyString2(response.statusText, rawRecord?.statusText) ?? null;
|
|
5536
|
-
const hint = firstNonEmptyString2(payload?.hint, response.errorDetails?.hint) ?? null;
|
|
5537
|
-
const code = firstNonEmptyString2(payload?.code) ?? normalized.code;
|
|
5538
|
-
const details = resolveStructuredErrorDetails(payload, message) ?? response.errorDetails?.cause ?? null;
|
|
5539
|
-
return {
|
|
5540
|
-
message,
|
|
5541
|
-
code,
|
|
5542
|
-
athenaCode: normalized.code,
|
|
5543
|
-
gatewayCode: response.errorDetails?.code ?? null,
|
|
5544
|
-
kind: normalized.kind,
|
|
5545
|
-
category: normalized.category,
|
|
5546
|
-
retryable: normalized.retryable,
|
|
5547
|
-
details,
|
|
5548
|
-
hint,
|
|
5549
|
-
status: result.status,
|
|
5550
|
-
statusText,
|
|
5551
|
-
constraint: normalized.constraint,
|
|
5552
|
-
table: normalized.table,
|
|
5553
|
-
operation: normalized.operation,
|
|
5554
|
-
endpoint: response.errorDetails?.endpoint,
|
|
5555
|
-
method: response.errorDetails?.method,
|
|
5556
|
-
requestId: response.errorDetails?.requestId,
|
|
5557
|
-
cause: response.errorDetails?.cause,
|
|
5558
|
-
raw: result.raw
|
|
5559
|
-
};
|
|
5823
|
+
return value[ATHENA_DEBUG_AST_KEY] ?? null;
|
|
5560
5824
|
}
|
|
5825
|
+
|
|
5826
|
+
// src/query-tracing.ts
|
|
5827
|
+
var QUERY_TRACE_STACK_SKIP_PATTERNS = [
|
|
5828
|
+
"src\\client.ts",
|
|
5829
|
+
"src/client.ts",
|
|
5830
|
+
"src\\query-tracing.ts",
|
|
5831
|
+
"src/query-tracing.ts",
|
|
5832
|
+
"dist\\client.",
|
|
5833
|
+
"dist/client.",
|
|
5834
|
+
"dist\\query-tracing.",
|
|
5835
|
+
"dist/query-tracing.",
|
|
5836
|
+
"node_modules\\@xylex-group\\athena",
|
|
5837
|
+
"node_modules/@xylex-group/athena",
|
|
5838
|
+
"node:internal",
|
|
5839
|
+
"internal/process"
|
|
5840
|
+
];
|
|
5561
5841
|
function parseQueryTraceCallsiteFrame(frame) {
|
|
5562
5842
|
const trimmed = frame.trim();
|
|
5563
5843
|
if (!trimmed) {
|
|
@@ -5662,6 +5942,7 @@ function createQueryTracer(experimental) {
|
|
|
5662
5942
|
functionName: context.functionName,
|
|
5663
5943
|
sql: context.sql,
|
|
5664
5944
|
payload: context.payload,
|
|
5945
|
+
ast: context.ast,
|
|
5665
5946
|
options: context.options,
|
|
5666
5947
|
callsite,
|
|
5667
5948
|
outcome: {
|
|
@@ -5684,6 +5965,7 @@ function createQueryTracer(experimental) {
|
|
|
5684
5965
|
functionName: context.functionName,
|
|
5685
5966
|
sql: context.sql,
|
|
5686
5967
|
payload: context.payload,
|
|
5968
|
+
ast: context.ast,
|
|
5687
5969
|
options: context.options,
|
|
5688
5970
|
callsite,
|
|
5689
5971
|
thrownError: error
|
|
@@ -5692,20 +5974,196 @@ function createQueryTracer(experimental) {
|
|
|
5692
5974
|
};
|
|
5693
5975
|
}
|
|
5694
5976
|
async function executeWithQueryTrace(tracer, context, runner, callsiteOverride) {
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
}
|
|
5698
|
-
const callsite = callsiteOverride ?? tracer.captureCallsite();
|
|
5699
|
-
const startedAt = Date.now();
|
|
5977
|
+
const callsite = tracer ? callsiteOverride ?? tracer.captureCallsite() : null;
|
|
5978
|
+
const startedAt = tracer ? Date.now() : 0;
|
|
5700
5979
|
try {
|
|
5701
5980
|
const result = await runner();
|
|
5702
|
-
|
|
5981
|
+
attachAthenaDebugAst(result, context.ast);
|
|
5982
|
+
if (tracer) {
|
|
5983
|
+
tracer.publishSuccess(context, result, Date.now() - startedAt, callsite);
|
|
5984
|
+
}
|
|
5985
|
+
return result;
|
|
5986
|
+
} catch (error) {
|
|
5987
|
+
attachAthenaDebugAst(error, context.ast);
|
|
5988
|
+
if (tracer) {
|
|
5989
|
+
tracer.publishFailure(context, error, Date.now() - startedAt, callsite);
|
|
5990
|
+
}
|
|
5991
|
+
throw error;
|
|
5992
|
+
}
|
|
5993
|
+
}
|
|
5994
|
+
|
|
5995
|
+
// src/schema/model-target.ts
|
|
5996
|
+
function normalizeOptionalName(value) {
|
|
5997
|
+
const normalized = value?.trim();
|
|
5998
|
+
return normalized ? normalized : void 0;
|
|
5999
|
+
}
|
|
6000
|
+
function isAthenaModelTarget(value) {
|
|
6001
|
+
if (!value || typeof value !== "object") {
|
|
6002
|
+
return false;
|
|
6003
|
+
}
|
|
6004
|
+
const candidate = value;
|
|
6005
|
+
return Boolean(candidate.meta && Array.isArray(candidate.meta.primaryKey));
|
|
6006
|
+
}
|
|
6007
|
+
function resolveAthenaModelTargetTableName(target, options = {}) {
|
|
6008
|
+
const explicitTableName = normalizeOptionalName(target.meta.tableName);
|
|
6009
|
+
if (explicitTableName) {
|
|
6010
|
+
return explicitTableName;
|
|
6011
|
+
}
|
|
6012
|
+
const schemaName = normalizeOptionalName(target.meta.schema ?? options.fallbackSchema);
|
|
6013
|
+
const modelName = normalizeOptionalName(target.meta.model ?? options.fallbackModel);
|
|
6014
|
+
if (!modelName) {
|
|
6015
|
+
throw new Error(
|
|
6016
|
+
"Athena model target is missing meta.model or meta.tableName. Provide one of those before calling from(model)."
|
|
6017
|
+
);
|
|
6018
|
+
}
|
|
6019
|
+
return schemaName ? `${schemaName}.${modelName}` : modelName;
|
|
6020
|
+
}
|
|
6021
|
+
|
|
6022
|
+
// src/client.ts
|
|
6023
|
+
var DEFAULT_COLUMNS = "*";
|
|
6024
|
+
var SAFE_CAST_PATTERN = /^[a-z_][a-z0-9_]*(?:\[\])?$/i;
|
|
6025
|
+
var ATHENA_NORMALIZED_ERROR_KEY = "__athenaNormalizedError";
|
|
6026
|
+
function formatResult(response) {
|
|
6027
|
+
const result = {
|
|
6028
|
+
data: response.data ?? null,
|
|
6029
|
+
error: null,
|
|
6030
|
+
errorDetails: response.errorDetails ?? null,
|
|
6031
|
+
status: response.status,
|
|
6032
|
+
statusText: response.statusText ?? null,
|
|
6033
|
+
raw: response.raw
|
|
6034
|
+
};
|
|
6035
|
+
if (response.count !== void 0) {
|
|
6036
|
+
result.count = response.count;
|
|
6037
|
+
}
|
|
6038
|
+
return result;
|
|
6039
|
+
}
|
|
6040
|
+
var EXPERIMENTAL_READ_RETRY_CONFIG = {
|
|
6041
|
+
retries: 2,
|
|
6042
|
+
baseDelayMs: 100,
|
|
6043
|
+
maxDelayMs: 1e3,
|
|
6044
|
+
backoff: "exponential",
|
|
6045
|
+
jitter: true
|
|
6046
|
+
};
|
|
6047
|
+
function attachNormalizedError(result, normalizedError) {
|
|
6048
|
+
Object.defineProperty(result, ATHENA_NORMALIZED_ERROR_KEY, {
|
|
6049
|
+
value: normalizedError,
|
|
6050
|
+
enumerable: false,
|
|
6051
|
+
configurable: true,
|
|
6052
|
+
writable: false
|
|
6053
|
+
});
|
|
6054
|
+
}
|
|
6055
|
+
function createResultFormatter(experimental) {
|
|
6056
|
+
return (response, context) => {
|
|
6057
|
+
const result = formatResult(response);
|
|
6058
|
+
if (response.error == null && response.errorDetails == null) {
|
|
6059
|
+
return result;
|
|
6060
|
+
}
|
|
6061
|
+
const normalizedError = normalizeAthenaError(
|
|
6062
|
+
{
|
|
6063
|
+
...result,
|
|
6064
|
+
error: response.error ?? response.errorDetails?.message ?? null
|
|
6065
|
+
},
|
|
6066
|
+
context
|
|
6067
|
+
);
|
|
6068
|
+
result.error = createResultError(response, result, normalizedError);
|
|
6069
|
+
attachNormalizedError(result, normalizedError);
|
|
5703
6070
|
return result;
|
|
6071
|
+
};
|
|
6072
|
+
}
|
|
6073
|
+
async function executeExperimentalRead(experimental, runner) {
|
|
6074
|
+
if (!experimental?.retryReads) {
|
|
6075
|
+
return runner();
|
|
6076
|
+
}
|
|
6077
|
+
let lastRetryableResult;
|
|
6078
|
+
let lastRetrySignal = null;
|
|
6079
|
+
try {
|
|
6080
|
+
return await withRetry(
|
|
6081
|
+
{
|
|
6082
|
+
...EXPERIMENTAL_READ_RETRY_CONFIG,
|
|
6083
|
+
shouldRetry: (error) => error === lastRetrySignal || normalizeAthenaError(error).retryable
|
|
6084
|
+
},
|
|
6085
|
+
async () => {
|
|
6086
|
+
const result = await runner();
|
|
6087
|
+
if (result.error?.retryable) {
|
|
6088
|
+
lastRetryableResult = result;
|
|
6089
|
+
lastRetrySignal = result.error;
|
|
6090
|
+
throw lastRetrySignal;
|
|
6091
|
+
}
|
|
6092
|
+
return result;
|
|
6093
|
+
}
|
|
6094
|
+
);
|
|
5704
6095
|
} catch (error) {
|
|
5705
|
-
|
|
6096
|
+
if (lastRetryableResult && error === lastRetrySignal) {
|
|
6097
|
+
return lastRetryableResult;
|
|
6098
|
+
}
|
|
5706
6099
|
throw error;
|
|
5707
6100
|
}
|
|
5708
6101
|
}
|
|
6102
|
+
function isRecord9(value) {
|
|
6103
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
6104
|
+
}
|
|
6105
|
+
function firstNonEmptyString2(...values) {
|
|
6106
|
+
for (const value of values) {
|
|
6107
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
6108
|
+
return value.trim();
|
|
6109
|
+
}
|
|
6110
|
+
}
|
|
6111
|
+
return void 0;
|
|
6112
|
+
}
|
|
6113
|
+
function resolveStructuredErrorPayload2(raw) {
|
|
6114
|
+
if (!isRecord9(raw)) return null;
|
|
6115
|
+
return isRecord9(raw.error) ? raw.error : raw;
|
|
6116
|
+
}
|
|
6117
|
+
function resolveStructuredErrorDetails(payload, message) {
|
|
6118
|
+
if (!payload || !("details" in payload)) {
|
|
6119
|
+
return null;
|
|
6120
|
+
}
|
|
6121
|
+
const details = payload.details;
|
|
6122
|
+
if (details == null) {
|
|
6123
|
+
return null;
|
|
6124
|
+
}
|
|
6125
|
+
if (typeof details === "string" && details.trim() === message.trim()) {
|
|
6126
|
+
return null;
|
|
6127
|
+
}
|
|
6128
|
+
return details;
|
|
6129
|
+
}
|
|
6130
|
+
function createResultError(response, result, normalized) {
|
|
6131
|
+
const rawRecord = isRecord9(response.raw) ? response.raw : null;
|
|
6132
|
+
const payload = resolveStructuredErrorPayload2(response.raw);
|
|
6133
|
+
const message = firstNonEmptyString2(
|
|
6134
|
+
response.error,
|
|
6135
|
+
payload?.message,
|
|
6136
|
+
payload?.error,
|
|
6137
|
+
payload?.details,
|
|
6138
|
+
response.errorDetails?.message,
|
|
6139
|
+
normalized.message
|
|
6140
|
+
) ?? normalized.message;
|
|
6141
|
+
const statusText = firstNonEmptyString2(response.statusText, rawRecord?.statusText) ?? null;
|
|
6142
|
+
const hint = firstNonEmptyString2(payload?.hint, response.errorDetails?.hint) ?? null;
|
|
6143
|
+
const code = firstNonEmptyString2(payload?.code) ?? normalized.code;
|
|
6144
|
+
const details = resolveStructuredErrorDetails(payload, message) ?? response.errorDetails?.cause ?? null;
|
|
6145
|
+
return {
|
|
6146
|
+
message,
|
|
6147
|
+
code,
|
|
6148
|
+
athenaCode: normalized.code,
|
|
6149
|
+
gatewayCode: response.errorDetails?.code ?? null,
|
|
6150
|
+
kind: normalized.kind,
|
|
6151
|
+
category: normalized.category,
|
|
6152
|
+
retryable: normalized.retryable,
|
|
6153
|
+
details,
|
|
6154
|
+
hint,
|
|
6155
|
+
status: result.status,
|
|
6156
|
+
statusText,
|
|
6157
|
+
constraint: normalized.constraint,
|
|
6158
|
+
table: normalized.table,
|
|
6159
|
+
operation: normalized.operation,
|
|
6160
|
+
endpoint: response.errorDetails?.endpoint,
|
|
6161
|
+
method: response.errorDetails?.method,
|
|
6162
|
+
requestId: response.errorDetails?.requestId,
|
|
6163
|
+
cause: response.errorDetails?.cause,
|
|
6164
|
+
raw: result.raw
|
|
6165
|
+
};
|
|
6166
|
+
}
|
|
5709
6167
|
function toSingleResult(response) {
|
|
5710
6168
|
const payload = response.data;
|
|
5711
6169
|
const singleData = Array.isArray(payload) ? payload.length ? payload[0] : null : payload ?? null;
|
|
@@ -5733,6 +6191,15 @@ function asAthenaJsonObject(value) {
|
|
|
5733
6191
|
function asAthenaJsonObjectArray(values) {
|
|
5734
6192
|
return values;
|
|
5735
6193
|
}
|
|
6194
|
+
function normalizeSelectColumnsInput(columns) {
|
|
6195
|
+
if (columns === void 0) {
|
|
6196
|
+
return void 0;
|
|
6197
|
+
}
|
|
6198
|
+
if (typeof columns === "string") {
|
|
6199
|
+
return columns;
|
|
6200
|
+
}
|
|
6201
|
+
return [...columns];
|
|
6202
|
+
}
|
|
5736
6203
|
function createMutationQuery(executor, defaultColumns = DEFAULT_COLUMNS, tracer, initialCallsite) {
|
|
5737
6204
|
let selectedColumns = defaultColumns === null ? void 0 : defaultColumns;
|
|
5738
6205
|
let selectedOptions;
|
|
@@ -5742,25 +6209,29 @@ function createMutationQuery(executor, defaultColumns = DEFAULT_COLUMNS, tracer,
|
|
|
5742
6209
|
const payloadColumns = columns ?? selectedColumns;
|
|
5743
6210
|
const payloadOptions = options ?? selectedOptions;
|
|
5744
6211
|
if (!promise) {
|
|
5745
|
-
promise = executor(
|
|
6212
|
+
promise = executor(
|
|
6213
|
+
normalizeSelectColumnsInput(payloadColumns),
|
|
6214
|
+
payloadOptions,
|
|
6215
|
+
callsiteStore.resolve(callsite)
|
|
6216
|
+
);
|
|
5746
6217
|
}
|
|
5747
6218
|
return promise;
|
|
5748
6219
|
};
|
|
5749
6220
|
const mutationQuery = {
|
|
5750
|
-
select(columns
|
|
6221
|
+
select(columns, options) {
|
|
5751
6222
|
selectedColumns = columns;
|
|
5752
6223
|
selectedOptions = options ?? selectedOptions;
|
|
5753
6224
|
return run(columns, options, captureTraceCallsite(tracer));
|
|
5754
6225
|
},
|
|
5755
|
-
returning(columns
|
|
6226
|
+
returning(columns, options) {
|
|
5756
6227
|
return mutationQuery.select(columns, options);
|
|
5757
6228
|
},
|
|
5758
|
-
single(columns
|
|
6229
|
+
single(columns, options) {
|
|
5759
6230
|
selectedColumns = columns;
|
|
5760
6231
|
selectedOptions = options ?? selectedOptions;
|
|
5761
6232
|
return run(columns, options, captureTraceCallsite(tracer)).then(toSingleResult);
|
|
5762
6233
|
},
|
|
5763
|
-
maybeSingle(columns
|
|
6234
|
+
maybeSingle(columns, options) {
|
|
5764
6235
|
return mutationQuery.single(columns, options);
|
|
5765
6236
|
},
|
|
5766
6237
|
then(onfulfilled, onrejected) {
|
|
@@ -6317,7 +6788,10 @@ function createFilterMethods(state, addCondition, self) {
|
|
|
6317
6788
|
}
|
|
6318
6789
|
function toRpcSelect(columns) {
|
|
6319
6790
|
if (!columns) return void 0;
|
|
6320
|
-
|
|
6791
|
+
if (typeof columns === "string") {
|
|
6792
|
+
return columns;
|
|
6793
|
+
}
|
|
6794
|
+
return columns.join(",");
|
|
6321
6795
|
}
|
|
6322
6796
|
function createRpcFilterMethods(filters, self) {
|
|
6323
6797
|
const addFilter = (operator, column, value) => {
|
|
@@ -6366,7 +6840,7 @@ function createRpcFilterMethods(filters, self) {
|
|
|
6366
6840
|
}
|
|
6367
6841
|
};
|
|
6368
6842
|
}
|
|
6369
|
-
function createRpcBuilder(functionName, args, baseOptions, client, formatGatewayResult, tracer, initialCallsite) {
|
|
6843
|
+
function createRpcBuilder(functionName, args, baseOptions, client, formatGatewayResult, tracer, initialCallsite, debugAstEnabled = false) {
|
|
6370
6844
|
const state = {
|
|
6371
6845
|
filters: []
|
|
6372
6846
|
};
|
|
@@ -6376,6 +6850,7 @@ function createRpcBuilder(functionName, args, baseOptions, client, formatGateway
|
|
|
6376
6850
|
const callsiteStore = createTraceCallsiteStore(tracer, initialCallsite);
|
|
6377
6851
|
const executeRpc = async (columns, options, callsite) => {
|
|
6378
6852
|
const mergedOptions = mergeOptions(baseOptions, options);
|
|
6853
|
+
const normalizedSelectedColumns = normalizeSelectColumnsInput(columns);
|
|
6379
6854
|
const payload = {
|
|
6380
6855
|
function: functionName,
|
|
6381
6856
|
args,
|
|
@@ -6390,6 +6865,14 @@ function createRpcBuilder(functionName, args, baseOptions, client, formatGateway
|
|
|
6390
6865
|
};
|
|
6391
6866
|
const endpoint = mergedOptions?.get ? `/rpc/${functionName}` : "/gateway/rpc";
|
|
6392
6867
|
const sql = buildRpcDebugSql(payload);
|
|
6868
|
+
const debugAst = debugAstEnabled ? buildRpcDebugAst({
|
|
6869
|
+
functionName,
|
|
6870
|
+
args,
|
|
6871
|
+
selectedColumns: normalizedSelectedColumns,
|
|
6872
|
+
state,
|
|
6873
|
+
payload,
|
|
6874
|
+
endpoint
|
|
6875
|
+
}) : void 0;
|
|
6393
6876
|
return executeWithQueryTrace(
|
|
6394
6877
|
tracer,
|
|
6395
6878
|
{
|
|
@@ -6398,6 +6881,7 @@ function createRpcBuilder(functionName, args, baseOptions, client, formatGateway
|
|
|
6398
6881
|
functionName,
|
|
6399
6882
|
sql,
|
|
6400
6883
|
payload,
|
|
6884
|
+
ast: debugAst,
|
|
6401
6885
|
options: mergedOptions
|
|
6402
6886
|
},
|
|
6403
6887
|
async () => {
|
|
@@ -6418,7 +6902,7 @@ function createRpcBuilder(functionName, args, baseOptions, client, formatGateway
|
|
|
6418
6902
|
const builder = {};
|
|
6419
6903
|
const filterMethods = createRpcFilterMethods(state.filters, builder);
|
|
6420
6904
|
Object.assign(builder, filterMethods, {
|
|
6421
|
-
select(columns
|
|
6905
|
+
select(columns, options) {
|
|
6422
6906
|
selectedColumns = columns;
|
|
6423
6907
|
selectedOptions = options ?? selectedOptions;
|
|
6424
6908
|
return run(columns, options, captureTraceCallsite(tracer));
|
|
@@ -6463,6 +6947,7 @@ function createTableBuilder(tableName, client, formatGatewayResult, tracer, expe
|
|
|
6463
6947
|
const state = {
|
|
6464
6948
|
conditions: []
|
|
6465
6949
|
};
|
|
6950
|
+
const debugAstEnabled = Boolean(experimental?.debugAst);
|
|
6466
6951
|
const addCondition = (operator, column, value, hints) => {
|
|
6467
6952
|
const condition = { operator };
|
|
6468
6953
|
if (column) {
|
|
@@ -6506,15 +6991,27 @@ function createTableBuilder(tableName, client, formatGatewayResult, tracer, expe
|
|
|
6506
6991
|
addCondition,
|
|
6507
6992
|
builder
|
|
6508
6993
|
);
|
|
6509
|
-
const runSelect = async (columns = DEFAULT_COLUMNS, options, executionState = snapshotState(), callsite) => {
|
|
6994
|
+
const runSelect = async (columns = DEFAULT_COLUMNS, options, executionState = snapshotState(), callsite, debugAstFactory) => {
|
|
6995
|
+
const runtimeColumns = normalizeSelectColumnsInput(columns) ?? DEFAULT_COLUMNS;
|
|
6510
6996
|
const resolvedTableName = resolveTableNameForCall(tableName, options?.schema);
|
|
6511
6997
|
const plan = createSelectTransportPlan({
|
|
6512
6998
|
tableName: resolvedTableName,
|
|
6513
|
-
columns,
|
|
6999
|
+
columns: runtimeColumns,
|
|
6514
7000
|
state: executionState,
|
|
6515
7001
|
options,
|
|
6516
7002
|
buildTypedSelectQuery
|
|
6517
7003
|
});
|
|
7004
|
+
const debugAst = debugAstEnabled ? debugAstFactory?.({
|
|
7005
|
+
tableName: resolvedTableName,
|
|
7006
|
+
columns: runtimeColumns,
|
|
7007
|
+
executionState,
|
|
7008
|
+
plan
|
|
7009
|
+
}) ?? buildSelectDebugAst({
|
|
7010
|
+
tableName: resolvedTableName,
|
|
7011
|
+
columns: runtimeColumns,
|
|
7012
|
+
state: executionState,
|
|
7013
|
+
plan
|
|
7014
|
+
}) : void 0;
|
|
6518
7015
|
if (plan.kind === "query") {
|
|
6519
7016
|
return executeExperimentalRead(
|
|
6520
7017
|
experimental,
|
|
@@ -6526,6 +7023,7 @@ function createTableBuilder(tableName, client, formatGatewayResult, tracer, expe
|
|
|
6526
7023
|
table: resolvedTableName,
|
|
6527
7024
|
sql: plan.query,
|
|
6528
7025
|
payload: plan.payload,
|
|
7026
|
+
ast: debugAst,
|
|
6529
7027
|
options
|
|
6530
7028
|
},
|
|
6531
7029
|
async () => {
|
|
@@ -6550,6 +7048,7 @@ function createTableBuilder(tableName, client, formatGatewayResult, tracer, expe
|
|
|
6550
7048
|
table: resolvedTableName,
|
|
6551
7049
|
sql,
|
|
6552
7050
|
payload: plan.payload,
|
|
7051
|
+
ast: debugAst,
|
|
6553
7052
|
options
|
|
6554
7053
|
},
|
|
6555
7054
|
async () => {
|
|
@@ -6563,7 +7062,11 @@ function createTableBuilder(tableName, client, formatGatewayResult, tracer, expe
|
|
|
6563
7062
|
const createSelectChain = (columns, options, initialCallsite) => {
|
|
6564
7063
|
const chain = {};
|
|
6565
7064
|
const callsiteStore = createTraceCallsiteStore(tracer, initialCallsite);
|
|
6566
|
-
const filterMethods2 = createFilterMethods(
|
|
7065
|
+
const filterMethods2 = createFilterMethods(
|
|
7066
|
+
state,
|
|
7067
|
+
addCondition,
|
|
7068
|
+
chain
|
|
7069
|
+
);
|
|
6567
7070
|
Object.assign(chain, filterMethods2, {
|
|
6568
7071
|
async single(cols, opts) {
|
|
6569
7072
|
const r = await runSelect(
|
|
@@ -6650,6 +7153,14 @@ function createTableBuilder(tableName, client, formatGatewayResult, tracer, expe
|
|
|
6650
7153
|
limit: executionState.limit,
|
|
6651
7154
|
order: executionState.order
|
|
6652
7155
|
});
|
|
7156
|
+
const debugAst = debugAstEnabled ? buildFindManyDirectDebugAst({
|
|
7157
|
+
tableName: resolvedTableName,
|
|
7158
|
+
options,
|
|
7159
|
+
compiledColumns: columns,
|
|
7160
|
+
baseState,
|
|
7161
|
+
executionState,
|
|
7162
|
+
payload
|
|
7163
|
+
}) : void 0;
|
|
6653
7164
|
return executeExperimentalRead(
|
|
6654
7165
|
experimental,
|
|
6655
7166
|
() => executeWithQueryTrace(
|
|
@@ -6659,7 +7170,8 @@ function createTableBuilder(tableName, client, formatGatewayResult, tracer, expe
|
|
|
6659
7170
|
endpoint: "/gateway/fetch",
|
|
6660
7171
|
table: resolvedTableName,
|
|
6661
7172
|
sql,
|
|
6662
|
-
payload
|
|
7173
|
+
payload,
|
|
7174
|
+
ast: debugAst
|
|
6663
7175
|
},
|
|
6664
7176
|
async () => {
|
|
6665
7177
|
const response = await client.fetchGateway(
|
|
@@ -6675,7 +7187,15 @@ function createTableBuilder(tableName, client, formatGatewayResult, tracer, expe
|
|
|
6675
7187
|
columns,
|
|
6676
7188
|
void 0,
|
|
6677
7189
|
executionState,
|
|
6678
|
-
callsite
|
|
7190
|
+
callsite,
|
|
7191
|
+
debugAstEnabled ? ({ tableName: resolvedTableName, executionState: tracedState, plan }) => buildFindManyCompiledDebugAst({
|
|
7192
|
+
tableName: resolvedTableName,
|
|
7193
|
+
options,
|
|
7194
|
+
compiledColumns: columns,
|
|
7195
|
+
baseState,
|
|
7196
|
+
executionState: tracedState,
|
|
7197
|
+
plan
|
|
7198
|
+
}) : void 0
|
|
6679
7199
|
);
|
|
6680
7200
|
},
|
|
6681
7201
|
insert(values, options) {
|
|
@@ -6695,6 +7215,7 @@ function createTableBuilder(tableName, client, formatGatewayResult, tracer, expe
|
|
|
6695
7215
|
payload.default_to_null = mergedOptions.defaultToNull;
|
|
6696
7216
|
}
|
|
6697
7217
|
const sql = buildInsertDebugSql(payload);
|
|
7218
|
+
const debugAst = debugAstEnabled ? buildInsertDebugAst(payload) : void 0;
|
|
6698
7219
|
return executeWithQueryTrace(
|
|
6699
7220
|
tracer,
|
|
6700
7221
|
{
|
|
@@ -6703,6 +7224,7 @@ function createTableBuilder(tableName, client, formatGatewayResult, tracer, expe
|
|
|
6703
7224
|
table: resolvedTableName,
|
|
6704
7225
|
sql,
|
|
6705
7226
|
payload,
|
|
7227
|
+
ast: debugAst,
|
|
6706
7228
|
options: mergedOptions
|
|
6707
7229
|
},
|
|
6708
7230
|
async () => {
|
|
@@ -6728,6 +7250,7 @@ function createTableBuilder(tableName, client, formatGatewayResult, tracer, expe
|
|
|
6728
7250
|
payload.default_to_null = mergedOptions.defaultToNull;
|
|
6729
7251
|
}
|
|
6730
7252
|
const sql = buildInsertDebugSql(payload);
|
|
7253
|
+
const debugAst = debugAstEnabled ? buildInsertDebugAst(payload) : void 0;
|
|
6731
7254
|
return executeWithQueryTrace(
|
|
6732
7255
|
tracer,
|
|
6733
7256
|
{
|
|
@@ -6736,6 +7259,7 @@ function createTableBuilder(tableName, client, formatGatewayResult, tracer, expe
|
|
|
6736
7259
|
table: resolvedTableName,
|
|
6737
7260
|
sql,
|
|
6738
7261
|
payload,
|
|
7262
|
+
ast: debugAst,
|
|
6739
7263
|
options: mergedOptions
|
|
6740
7264
|
},
|
|
6741
7265
|
async () => {
|
|
@@ -6766,6 +7290,7 @@ function createTableBuilder(tableName, client, formatGatewayResult, tracer, expe
|
|
|
6766
7290
|
payload.default_to_null = mergedOptions.defaultToNull;
|
|
6767
7291
|
}
|
|
6768
7292
|
const sql = buildInsertDebugSql(payload);
|
|
7293
|
+
const debugAst = debugAstEnabled ? buildUpsertDebugAst(payload) : void 0;
|
|
6769
7294
|
return executeWithQueryTrace(
|
|
6770
7295
|
tracer,
|
|
6771
7296
|
{
|
|
@@ -6774,6 +7299,7 @@ function createTableBuilder(tableName, client, formatGatewayResult, tracer, expe
|
|
|
6774
7299
|
table: resolvedTableName,
|
|
6775
7300
|
sql,
|
|
6776
7301
|
payload,
|
|
7302
|
+
ast: debugAst,
|
|
6777
7303
|
options: mergedOptions
|
|
6778
7304
|
},
|
|
6779
7305
|
async () => {
|
|
@@ -6801,6 +7327,7 @@ function createTableBuilder(tableName, client, formatGatewayResult, tracer, expe
|
|
|
6801
7327
|
payload.default_to_null = mergedOptions.defaultToNull;
|
|
6802
7328
|
}
|
|
6803
7329
|
const sql = buildInsertDebugSql(payload);
|
|
7330
|
+
const debugAst = debugAstEnabled ? buildUpsertDebugAst(payload) : void 0;
|
|
6804
7331
|
return executeWithQueryTrace(
|
|
6805
7332
|
tracer,
|
|
6806
7333
|
{
|
|
@@ -6809,6 +7336,7 @@ function createTableBuilder(tableName, client, formatGatewayResult, tracer, expe
|
|
|
6809
7336
|
table: resolvedTableName,
|
|
6810
7337
|
sql,
|
|
6811
7338
|
payload,
|
|
7339
|
+
ast: debugAst,
|
|
6812
7340
|
options: mergedOptions
|
|
6813
7341
|
},
|
|
6814
7342
|
async () => {
|
|
@@ -6823,7 +7351,8 @@ function createTableBuilder(tableName, client, formatGatewayResult, tracer, expe
|
|
|
6823
7351
|
update(values, options) {
|
|
6824
7352
|
const mutationCallsite = captureTraceCallsite(tracer);
|
|
6825
7353
|
const executeUpdate = async (columns, selectOptions, callsite) => {
|
|
6826
|
-
const
|
|
7354
|
+
const executionState = snapshotState();
|
|
7355
|
+
const filters = executionState.conditions.length ? [...executionState.conditions] : void 0;
|
|
6827
7356
|
const mergedOptions = mergeOptions(options, selectOptions);
|
|
6828
7357
|
const resolvedTableName = resolveTableNameForCall(tableName, mergedOptions?.schema);
|
|
6829
7358
|
const payload = {
|
|
@@ -6832,12 +7361,16 @@ function createTableBuilder(tableName, client, formatGatewayResult, tracer, expe
|
|
|
6832
7361
|
conditions: filters,
|
|
6833
7362
|
strip_nulls: mergedOptions?.stripNulls ?? true
|
|
6834
7363
|
};
|
|
6835
|
-
if (
|
|
6836
|
-
if (
|
|
6837
|
-
if (
|
|
6838
|
-
if (
|
|
7364
|
+
if (executionState.order) payload.sort_by = executionState.order;
|
|
7365
|
+
if (executionState.currentPage !== void 0) payload.current_page = executionState.currentPage;
|
|
7366
|
+
if (executionState.pageSize !== void 0) payload.page_size = executionState.pageSize;
|
|
7367
|
+
if (executionState.totalPages !== void 0) payload.total_pages = executionState.totalPages;
|
|
6839
7368
|
if (columns) payload.columns = columns;
|
|
6840
7369
|
const sql = buildUpdateDebugSql(payload);
|
|
7370
|
+
const debugAst = debugAstEnabled ? buildUpdateDebugAst({
|
|
7371
|
+
state: executionState,
|
|
7372
|
+
payload
|
|
7373
|
+
}) : void 0;
|
|
6841
7374
|
return executeWithQueryTrace(
|
|
6842
7375
|
tracer,
|
|
6843
7376
|
{
|
|
@@ -6846,6 +7379,7 @@ function createTableBuilder(tableName, client, formatGatewayResult, tracer, expe
|
|
|
6846
7379
|
table: resolvedTableName,
|
|
6847
7380
|
sql,
|
|
6848
7381
|
payload,
|
|
7382
|
+
ast: debugAst,
|
|
6849
7383
|
options: mergedOptions
|
|
6850
7384
|
},
|
|
6851
7385
|
async () => {
|
|
@@ -6869,6 +7403,11 @@ function createTableBuilder(tableName, client, formatGatewayResult, tracer, expe
|
|
|
6869
7403
|
}
|
|
6870
7404
|
const mutationCallsite = captureTraceCallsite(tracer);
|
|
6871
7405
|
const executeDelete = async (columns, selectOptions, callsite) => {
|
|
7406
|
+
const executionState = snapshotState();
|
|
7407
|
+
const debugState = {
|
|
7408
|
+
...executionState,
|
|
7409
|
+
conditions: filters ? filters.map((condition) => ({ ...condition })) : []
|
|
7410
|
+
};
|
|
6872
7411
|
const mergedOptions = mergeOptions(options, selectOptions);
|
|
6873
7412
|
const resolvedTableName = resolveTableNameForCall(tableName, mergedOptions?.schema);
|
|
6874
7413
|
const payload = {
|
|
@@ -6876,12 +7415,16 @@ function createTableBuilder(tableName, client, formatGatewayResult, tracer, expe
|
|
|
6876
7415
|
resource_id: resourceId,
|
|
6877
7416
|
conditions: filters
|
|
6878
7417
|
};
|
|
6879
|
-
if (
|
|
6880
|
-
if (
|
|
6881
|
-
if (
|
|
6882
|
-
if (
|
|
7418
|
+
if (executionState.order) payload.sort_by = executionState.order;
|
|
7419
|
+
if (executionState.currentPage !== void 0) payload.current_page = executionState.currentPage;
|
|
7420
|
+
if (executionState.pageSize !== void 0) payload.page_size = executionState.pageSize;
|
|
7421
|
+
if (executionState.totalPages !== void 0) payload.total_pages = executionState.totalPages;
|
|
6883
7422
|
if (columns) payload.columns = columns;
|
|
6884
7423
|
const sql = buildDeleteDebugSql(payload);
|
|
7424
|
+
const debugAst = debugAstEnabled ? buildDeleteDebugAst({
|
|
7425
|
+
state: debugState,
|
|
7426
|
+
payload
|
|
7427
|
+
}) : void 0;
|
|
6885
7428
|
return executeWithQueryTrace(
|
|
6886
7429
|
tracer,
|
|
6887
7430
|
{
|
|
@@ -6890,6 +7433,7 @@ function createTableBuilder(tableName, client, formatGatewayResult, tracer, expe
|
|
|
6890
7433
|
table: resolvedTableName,
|
|
6891
7434
|
sql,
|
|
6892
7435
|
payload,
|
|
7436
|
+
ast: debugAst,
|
|
6893
7437
|
options: mergedOptions
|
|
6894
7438
|
},
|
|
6895
7439
|
async () => {
|
|
@@ -6917,6 +7461,7 @@ function createTableBuilder(tableName, client, formatGatewayResult, tracer, expe
|
|
|
6917
7461
|
return builder;
|
|
6918
7462
|
}
|
|
6919
7463
|
function createQueryBuilder(client, formatGatewayResult, experimental, tracer) {
|
|
7464
|
+
const debugAstEnabled = Boolean(experimental?.debugAst);
|
|
6920
7465
|
return async function query(query, options) {
|
|
6921
7466
|
const normalizedQuery = query.trim();
|
|
6922
7467
|
if (!normalizedQuery) {
|
|
@@ -6933,6 +7478,7 @@ function createQueryBuilder(client, formatGatewayResult, experimental, tracer) {
|
|
|
6933
7478
|
endpoint: "/gateway/query",
|
|
6934
7479
|
sql: normalizedQuery,
|
|
6935
7480
|
payload,
|
|
7481
|
+
ast: debugAstEnabled ? buildRawQueryDebugAst(normalizedQuery) : void 0,
|
|
6936
7482
|
options
|
|
6937
7483
|
},
|
|
6938
7484
|
async () => {
|
|
@@ -6944,6 +7490,63 @@ function createQueryBuilder(client, formatGatewayResult, experimental, tracer) {
|
|
|
6944
7490
|
);
|
|
6945
7491
|
};
|
|
6946
7492
|
}
|
|
7493
|
+
function resolveClientServiceBaseUrl(value, label) {
|
|
7494
|
+
if (value === void 0 || value === null) {
|
|
7495
|
+
return void 0;
|
|
7496
|
+
}
|
|
7497
|
+
return normalizeAthenaGatewayBaseUrl(value, { label });
|
|
7498
|
+
}
|
|
7499
|
+
function appendServicePath(baseUrl, segment) {
|
|
7500
|
+
const normalizedBaseUrl = normalizeAthenaGatewayBaseUrl(baseUrl, { label: "Athena public base URL" });
|
|
7501
|
+
return `${normalizedBaseUrl}/${segment.replace(/^\/+/, "")}`;
|
|
7502
|
+
}
|
|
7503
|
+
function resolveServiceUrlOverride(value, label) {
|
|
7504
|
+
return resolveClientServiceBaseUrl(value, label);
|
|
7505
|
+
}
|
|
7506
|
+
function resolveServiceUrls(config) {
|
|
7507
|
+
const baseUrl = resolveClientServiceBaseUrl(config.url, "Athena public base URL");
|
|
7508
|
+
return {
|
|
7509
|
+
dbUrl: resolveServiceUrlOverride(config.db?.url, "Athena DB base URL") ?? resolveServiceUrlOverride(config.gateway?.url, "Athena gateway base URL") ?? resolveServiceUrlOverride(config.dbUrl, "Athena DB base URL") ?? resolveServiceUrlOverride(config.gatewayUrl, "Athena gateway base URL") ?? (baseUrl ? appendServicePath(baseUrl, "db") : void 0),
|
|
7510
|
+
authUrl: resolveServiceUrlOverride(config.auth?.url, "Athena auth base URL") ?? resolveServiceUrlOverride(config.auth?.baseUrl, "Athena auth base URL") ?? resolveServiceUrlOverride(config.authUrl, "Athena auth base URL") ?? (baseUrl ? appendServicePath(baseUrl, "auth") : void 0),
|
|
7511
|
+
storageUrl: resolveServiceUrlOverride(config.storage?.url, "Athena storage base URL") ?? resolveServiceUrlOverride(config.storageUrl, "Athena storage base URL") ?? (baseUrl ? appendServicePath(baseUrl, "storage") : void 0)
|
|
7512
|
+
};
|
|
7513
|
+
}
|
|
7514
|
+
function normalizeAuthClientConfig(auth, defaultBaseUrl) {
|
|
7515
|
+
if (!auth && defaultBaseUrl === void 0) {
|
|
7516
|
+
return void 0;
|
|
7517
|
+
}
|
|
7518
|
+
const { url, ...rest } = auth ?? {};
|
|
7519
|
+
const normalized = {
|
|
7520
|
+
...rest
|
|
7521
|
+
};
|
|
7522
|
+
const resolvedBaseUrl = resolveClientServiceBaseUrl(
|
|
7523
|
+
url ?? rest.baseUrl ?? defaultBaseUrl,
|
|
7524
|
+
"Athena auth base URL"
|
|
7525
|
+
);
|
|
7526
|
+
if (resolvedBaseUrl !== void 0) {
|
|
7527
|
+
normalized.baseUrl = resolvedBaseUrl;
|
|
7528
|
+
}
|
|
7529
|
+
return normalized;
|
|
7530
|
+
}
|
|
7531
|
+
function resolveCreateClientConfig(config) {
|
|
7532
|
+
const resolvedUrls = resolveServiceUrls(config);
|
|
7533
|
+
if (!resolvedUrls.dbUrl) {
|
|
7534
|
+
throw new Error(
|
|
7535
|
+
"Athena DB base URL is required. Pass createClient(url, key) for a unified root, or set db.url / gateway.url / gatewayUrl explicitly."
|
|
7536
|
+
);
|
|
7537
|
+
}
|
|
7538
|
+
return {
|
|
7539
|
+
baseUrl: resolvedUrls.dbUrl,
|
|
7540
|
+
apiKey: config.key,
|
|
7541
|
+
client: config.client,
|
|
7542
|
+
backend: toBackendConfig(config.backend),
|
|
7543
|
+
headers: config.headers,
|
|
7544
|
+
auth: config.auth,
|
|
7545
|
+
authUrl: resolvedUrls.authUrl,
|
|
7546
|
+
storageUrl: resolvedUrls.storageUrl,
|
|
7547
|
+
experimental: config.experimental
|
|
7548
|
+
};
|
|
7549
|
+
}
|
|
6947
7550
|
function createClientFromConfig(config) {
|
|
6948
7551
|
const gatewayHeaders = {
|
|
6949
7552
|
...config.headers ?? {}
|
|
@@ -6960,14 +7563,31 @@ function createClientFromConfig(config) {
|
|
|
6960
7563
|
});
|
|
6961
7564
|
const formatGatewayResult = createResultFormatter(config.experimental);
|
|
6962
7565
|
const queryTracer = createQueryTracer(config.experimental);
|
|
6963
|
-
const auth = createAuthClient(config.auth);
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
|
|
6967
|
-
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
7566
|
+
const auth = createAuthClient(normalizeAuthClientConfig(config.auth, config.authUrl));
|
|
7567
|
+
function from(tableOrModel, options) {
|
|
7568
|
+
if (isAthenaModelTarget(tableOrModel)) {
|
|
7569
|
+
if (options?.schema !== void 0) {
|
|
7570
|
+
throw new Error(
|
|
7571
|
+
"from(model) does not accept a schema override because the model already defines its target."
|
|
7572
|
+
);
|
|
7573
|
+
}
|
|
7574
|
+
return createTableBuilder(
|
|
7575
|
+
resolveAthenaModelTargetTableName(tableOrModel),
|
|
7576
|
+
gateway,
|
|
7577
|
+
formatGatewayResult,
|
|
7578
|
+
queryTracer,
|
|
7579
|
+
config.experimental
|
|
7580
|
+
);
|
|
7581
|
+
}
|
|
7582
|
+
const resolvedTableName = resolveTableNameForCall(tableOrModel, options?.schema);
|
|
7583
|
+
return createTableBuilder(
|
|
7584
|
+
resolvedTableName,
|
|
7585
|
+
gateway,
|
|
7586
|
+
formatGatewayResult,
|
|
7587
|
+
queryTracer,
|
|
7588
|
+
config.experimental
|
|
7589
|
+
);
|
|
7590
|
+
}
|
|
6971
7591
|
const rpc = (fn, args, options) => {
|
|
6972
7592
|
const normalizedFn = fn.trim();
|
|
6973
7593
|
if (!normalizedFn) {
|
|
@@ -6980,10 +7600,16 @@ function createClientFromConfig(config) {
|
|
|
6980
7600
|
gateway,
|
|
6981
7601
|
formatGatewayResult,
|
|
6982
7602
|
queryTracer,
|
|
6983
|
-
captureTraceCallsite(queryTracer)
|
|
7603
|
+
captureTraceCallsite(queryTracer),
|
|
7604
|
+
Boolean(config.experimental?.debugAst)
|
|
6984
7605
|
);
|
|
6985
7606
|
};
|
|
6986
|
-
const query = createQueryBuilder(
|
|
7607
|
+
const query = createQueryBuilder(
|
|
7608
|
+
gateway,
|
|
7609
|
+
formatGatewayResult,
|
|
7610
|
+
config.experimental,
|
|
7611
|
+
queryTracer
|
|
7612
|
+
);
|
|
6987
7613
|
const db = createDbModule({ from, rpc, query });
|
|
6988
7614
|
const sdkClient = {
|
|
6989
7615
|
from,
|
|
@@ -6996,148 +7622,53 @@ function createClientFromConfig(config) {
|
|
|
6996
7622
|
if (config.experimental?.athenaStorageBackend) {
|
|
6997
7623
|
const storageClient = {
|
|
6998
7624
|
...sdkClient,
|
|
6999
|
-
storage: createStorageModule(gateway,
|
|
7625
|
+
storage: createStorageModule(gateway, {
|
|
7626
|
+
...config.experimental.storage,
|
|
7627
|
+
...config.storageUrl ? {
|
|
7628
|
+
baseUrl: config.storageUrl,
|
|
7629
|
+
stripBasePath: true
|
|
7630
|
+
} : {}
|
|
7631
|
+
})
|
|
7000
7632
|
};
|
|
7001
7633
|
return storageClient;
|
|
7002
7634
|
}
|
|
7003
7635
|
return sdkClient;
|
|
7004
7636
|
}
|
|
7005
|
-
var
|
|
7006
|
-
function toBackendConfig(b) {
|
|
7007
|
-
if (!b) return DEFAULT_BACKEND;
|
|
7008
|
-
return typeof b === "string" ? { type: b } : b;
|
|
7009
|
-
}
|
|
7010
|
-
function mergeAuthClientConfig(current, next) {
|
|
7011
|
-
const merged = {
|
|
7012
|
-
...current ?? {},
|
|
7013
|
-
...next
|
|
7014
|
-
};
|
|
7015
|
-
if (current?.headers || next.headers) {
|
|
7016
|
-
merged.headers = {
|
|
7017
|
-
...current?.headers ?? {},
|
|
7018
|
-
...next.headers ?? {}
|
|
7019
|
-
};
|
|
7020
|
-
}
|
|
7021
|
-
return merged;
|
|
7022
|
-
}
|
|
7023
|
-
function mergeExperimentalOptions(current, next) {
|
|
7024
|
-
const merged = {
|
|
7025
|
-
...current ?? {},
|
|
7026
|
-
...next
|
|
7027
|
-
};
|
|
7028
|
-
if (current?.traceQueries && typeof current.traceQueries === "object" && next.traceQueries && typeof next.traceQueries === "object") {
|
|
7029
|
-
merged.traceQueries = {
|
|
7030
|
-
...current.traceQueries,
|
|
7031
|
-
...next.traceQueries
|
|
7032
|
-
};
|
|
7033
|
-
}
|
|
7034
|
-
if (current?.storage || next.storage) {
|
|
7035
|
-
merged.storage = {
|
|
7036
|
-
...current?.storage ?? {},
|
|
7037
|
-
...next.storage ?? {}
|
|
7038
|
-
};
|
|
7039
|
-
}
|
|
7040
|
-
return merged;
|
|
7041
|
-
}
|
|
7042
|
-
var AthenaClientBuilderImpl = class {
|
|
7043
|
-
baseUrl;
|
|
7044
|
-
apiKey;
|
|
7045
|
-
backendConfig = DEFAULT_BACKEND;
|
|
7046
|
-
clientName;
|
|
7047
|
-
defaultHeaders;
|
|
7048
|
-
authConfig;
|
|
7049
|
-
experimentalOptions;
|
|
7050
|
-
url(url) {
|
|
7051
|
-
this.baseUrl = url;
|
|
7052
|
-
return this;
|
|
7053
|
-
}
|
|
7054
|
-
key(apiKey) {
|
|
7055
|
-
this.apiKey = apiKey;
|
|
7056
|
-
return this;
|
|
7057
|
-
}
|
|
7058
|
-
backend(backend) {
|
|
7059
|
-
this.backendConfig = toBackendConfig(backend);
|
|
7060
|
-
return this;
|
|
7061
|
-
}
|
|
7062
|
-
client(clientName) {
|
|
7063
|
-
this.clientName = clientName;
|
|
7064
|
-
return this;
|
|
7065
|
-
}
|
|
7066
|
-
headers(headers) {
|
|
7067
|
-
this.defaultHeaders = headers;
|
|
7068
|
-
return this;
|
|
7069
|
-
}
|
|
7070
|
-
auth(config) {
|
|
7071
|
-
this.authConfig = mergeAuthClientConfig(this.authConfig, config);
|
|
7072
|
-
return this;
|
|
7073
|
-
}
|
|
7074
|
-
experimental(options) {
|
|
7075
|
-
this.experimentalOptions = mergeExperimentalOptions(this.experimentalOptions, options);
|
|
7076
|
-
return options.athenaStorageBackend ? this : this;
|
|
7077
|
-
}
|
|
7078
|
-
options(options) {
|
|
7079
|
-
if (options.client !== void 0) {
|
|
7080
|
-
this.clientName = options.client;
|
|
7081
|
-
}
|
|
7082
|
-
if (options.backend !== void 0) {
|
|
7083
|
-
this.backendConfig = toBackendConfig(options.backend);
|
|
7084
|
-
}
|
|
7085
|
-
if (options.headers !== void 0) {
|
|
7086
|
-
this.defaultHeaders = {
|
|
7087
|
-
...this.defaultHeaders ?? {},
|
|
7088
|
-
...options.headers
|
|
7089
|
-
};
|
|
7090
|
-
}
|
|
7091
|
-
if (options.auth !== void 0) {
|
|
7092
|
-
this.authConfig = mergeAuthClientConfig(this.authConfig, options.auth);
|
|
7093
|
-
}
|
|
7094
|
-
if (options.experimental !== void 0) {
|
|
7095
|
-
this.experimentalOptions = mergeExperimentalOptions(this.experimentalOptions, options.experimental);
|
|
7096
|
-
}
|
|
7097
|
-
return options.experimental?.athenaStorageBackend ? this : this;
|
|
7098
|
-
}
|
|
7099
|
-
build() {
|
|
7100
|
-
if (!this.baseUrl || !this.apiKey) {
|
|
7101
|
-
throw new Error("AthenaClient requires url and key; call .url() and .key() before .build()");
|
|
7102
|
-
}
|
|
7103
|
-
return createClientFromConfig({
|
|
7104
|
-
baseUrl: this.baseUrl,
|
|
7105
|
-
apiKey: this.apiKey,
|
|
7106
|
-
client: this.clientName,
|
|
7107
|
-
backend: this.backendConfig,
|
|
7108
|
-
headers: this.defaultHeaders,
|
|
7109
|
-
auth: this.authConfig,
|
|
7110
|
-
experimental: this.experimentalOptions
|
|
7111
|
-
});
|
|
7112
|
-
}
|
|
7113
|
-
};
|
|
7114
|
-
var AthenaClient = class _AthenaClient {
|
|
7637
|
+
var AthenaClient = class {
|
|
7115
7638
|
/** Create a fluent builder for a strongly-typed Athena SDK client. */
|
|
7116
7639
|
static builder() {
|
|
7117
|
-
return
|
|
7640
|
+
return createAthenaClientBuilder((config) => createClientFromConfig(resolveCreateClientConfig(config)));
|
|
7118
7641
|
}
|
|
7119
7642
|
/** Build a client from process environment variables. */
|
|
7120
7643
|
static fromEnvironment() {
|
|
7121
|
-
const url = process.env.ATHENA_URL
|
|
7644
|
+
const url = process.env.ATHENA_URL;
|
|
7645
|
+
const gatewayUrl = process.env.ATHENA_DB_URL ?? process.env.ATHENA_GATEWAY_URL;
|
|
7646
|
+
const authUrl = process.env.ATHENA_AUTH_URL;
|
|
7647
|
+
const storageUrl = process.env.ATHENA_STORAGE_URL;
|
|
7122
7648
|
const key = process.env.ATHENA_API_KEY ?? process.env.ATHENA_GATEWAY_API_KEY;
|
|
7123
|
-
if (!url || !key) {
|
|
7649
|
+
if (!url && !gatewayUrl || !key) {
|
|
7124
7650
|
throw new Error(
|
|
7125
|
-
"
|
|
7651
|
+
"ATHENA_API_KEY plus ATHENA_URL or ATHENA_GATEWAY_URL (optionally ATHENA_DB_URL, ATHENA_AUTH_URL, ATHENA_STORAGE_URL) are required"
|
|
7126
7652
|
);
|
|
7127
7653
|
}
|
|
7128
|
-
return
|
|
7654
|
+
return createClient({
|
|
7655
|
+
url,
|
|
7656
|
+
gatewayUrl,
|
|
7657
|
+
authUrl,
|
|
7658
|
+
storageUrl,
|
|
7659
|
+
key
|
|
7660
|
+
});
|
|
7129
7661
|
}
|
|
7130
7662
|
};
|
|
7131
|
-
function createClient(
|
|
7132
|
-
|
|
7133
|
-
|
|
7134
|
-
|
|
7135
|
-
|
|
7136
|
-
|
|
7137
|
-
|
|
7138
|
-
|
|
7139
|
-
|
|
7140
|
-
});
|
|
7663
|
+
function createClient(configOrUrl, apiKey, options) {
|
|
7664
|
+
if (typeof configOrUrl === "string") {
|
|
7665
|
+
return createClientFromConfig(resolveCreateClientConfig({
|
|
7666
|
+
url: configOrUrl,
|
|
7667
|
+
key: apiKey ?? "",
|
|
7668
|
+
...options
|
|
7669
|
+
}));
|
|
7670
|
+
}
|
|
7671
|
+
return createClientFromConfig(resolveCreateClientConfig(configOrUrl));
|
|
7141
7672
|
}
|
|
7142
7673
|
|
|
7143
7674
|
// src/gateway/types.ts
|
|
@@ -7162,6 +7693,379 @@ function defineRegistry(databases) {
|
|
|
7162
7693
|
return databases;
|
|
7163
7694
|
}
|
|
7164
7695
|
|
|
7696
|
+
// src/schema/model-form.ts
|
|
7697
|
+
function resolveNullishValue(mode) {
|
|
7698
|
+
if (mode === "undefined") return void 0;
|
|
7699
|
+
if (mode === "null") return null;
|
|
7700
|
+
return "";
|
|
7701
|
+
}
|
|
7702
|
+
function isRecord10(value) {
|
|
7703
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
7704
|
+
}
|
|
7705
|
+
function isNullableColumn(model, key) {
|
|
7706
|
+
const nullable = model.meta.nullable;
|
|
7707
|
+
return nullable?.[key] === true;
|
|
7708
|
+
}
|
|
7709
|
+
function toModelFormDefaults(model, values, options) {
|
|
7710
|
+
const source = values;
|
|
7711
|
+
if (!isRecord10(source)) {
|
|
7712
|
+
return {};
|
|
7713
|
+
}
|
|
7714
|
+
const mode = options?.nullishMode ?? "empty-string";
|
|
7715
|
+
const nullishValue = resolveNullishValue(mode);
|
|
7716
|
+
const result = {};
|
|
7717
|
+
for (const [key, value] of Object.entries(source)) {
|
|
7718
|
+
if (value === null && isNullableColumn(model, key)) {
|
|
7719
|
+
result[key] = nullishValue;
|
|
7720
|
+
continue;
|
|
7721
|
+
}
|
|
7722
|
+
result[key] = value;
|
|
7723
|
+
}
|
|
7724
|
+
return result;
|
|
7725
|
+
}
|
|
7726
|
+
function toModelPayload(model, formValues, options) {
|
|
7727
|
+
const emptyStringAsNull = options?.emptyStringAsNull ?? true;
|
|
7728
|
+
const stripUndefined = options?.stripUndefined ?? true;
|
|
7729
|
+
const result = {};
|
|
7730
|
+
for (const [key, rawValue] of Object.entries(formValues)) {
|
|
7731
|
+
if (rawValue === void 0 && stripUndefined) {
|
|
7732
|
+
continue;
|
|
7733
|
+
}
|
|
7734
|
+
if (emptyStringAsNull && rawValue === "" && isNullableColumn(model, key)) {
|
|
7735
|
+
result[key] = null;
|
|
7736
|
+
continue;
|
|
7737
|
+
}
|
|
7738
|
+
result[key] = rawValue;
|
|
7739
|
+
}
|
|
7740
|
+
return result;
|
|
7741
|
+
}
|
|
7742
|
+
function createModelFormAdapter(model) {
|
|
7743
|
+
return {
|
|
7744
|
+
model,
|
|
7745
|
+
toDefaults(values, options) {
|
|
7746
|
+
return toModelFormDefaults(model, values, options);
|
|
7747
|
+
},
|
|
7748
|
+
toInsert(values, options) {
|
|
7749
|
+
return toModelPayload(model, values, options);
|
|
7750
|
+
},
|
|
7751
|
+
toUpdate(values, options) {
|
|
7752
|
+
return toModelPayload(model, values, options);
|
|
7753
|
+
}
|
|
7754
|
+
};
|
|
7755
|
+
}
|
|
7756
|
+
|
|
7757
|
+
// src/schema/table-columns.ts
|
|
7758
|
+
var COLUMN_CONFIG = /* @__PURE__ */ Symbol("athena.column.config");
|
|
7759
|
+
function createColumnBuilder(config) {
|
|
7760
|
+
return {
|
|
7761
|
+
[COLUMN_CONFIG]: config,
|
|
7762
|
+
optional() {
|
|
7763
|
+
return createColumnBuilder({
|
|
7764
|
+
...config,
|
|
7765
|
+
nullable: true
|
|
7766
|
+
});
|
|
7767
|
+
},
|
|
7768
|
+
from(columnName) {
|
|
7769
|
+
return createColumnBuilder({
|
|
7770
|
+
...config,
|
|
7771
|
+
columnName
|
|
7772
|
+
});
|
|
7773
|
+
},
|
|
7774
|
+
defaulted() {
|
|
7775
|
+
return createColumnBuilder({
|
|
7776
|
+
...config,
|
|
7777
|
+
hasDefault: true
|
|
7778
|
+
});
|
|
7779
|
+
},
|
|
7780
|
+
generated() {
|
|
7781
|
+
return createColumnBuilder({
|
|
7782
|
+
...config,
|
|
7783
|
+
isGenerated: true
|
|
7784
|
+
});
|
|
7785
|
+
}
|
|
7786
|
+
};
|
|
7787
|
+
}
|
|
7788
|
+
function isColumnBuilder(value) {
|
|
7789
|
+
return value !== null && typeof value === "object" && COLUMN_CONFIG in value;
|
|
7790
|
+
}
|
|
7791
|
+
function getColumnConfig(column) {
|
|
7792
|
+
return column[COLUMN_CONFIG];
|
|
7793
|
+
}
|
|
7794
|
+
function string() {
|
|
7795
|
+
return createColumnBuilder({
|
|
7796
|
+
kind: "string",
|
|
7797
|
+
nullable: false,
|
|
7798
|
+
hasDefault: false,
|
|
7799
|
+
isGenerated: false
|
|
7800
|
+
});
|
|
7801
|
+
}
|
|
7802
|
+
function number() {
|
|
7803
|
+
return createColumnBuilder({
|
|
7804
|
+
kind: "number",
|
|
7805
|
+
nullable: false,
|
|
7806
|
+
hasDefault: false,
|
|
7807
|
+
isGenerated: false
|
|
7808
|
+
});
|
|
7809
|
+
}
|
|
7810
|
+
function boolean() {
|
|
7811
|
+
return createColumnBuilder({
|
|
7812
|
+
kind: "boolean",
|
|
7813
|
+
nullable: false,
|
|
7814
|
+
hasDefault: false,
|
|
7815
|
+
isGenerated: false
|
|
7816
|
+
});
|
|
7817
|
+
}
|
|
7818
|
+
function json(schema) {
|
|
7819
|
+
return createColumnBuilder({
|
|
7820
|
+
kind: "json",
|
|
7821
|
+
nullable: false,
|
|
7822
|
+
hasDefault: false,
|
|
7823
|
+
isGenerated: false,
|
|
7824
|
+
jsonSchema: schema
|
|
7825
|
+
});
|
|
7826
|
+
}
|
|
7827
|
+
function enumeration(values) {
|
|
7828
|
+
if (values.length === 0) {
|
|
7829
|
+
throw new Error("enumeration() requires at least one value");
|
|
7830
|
+
}
|
|
7831
|
+
return createColumnBuilder({
|
|
7832
|
+
kind: "enumeration",
|
|
7833
|
+
nullable: false,
|
|
7834
|
+
hasDefault: false,
|
|
7835
|
+
isGenerated: false,
|
|
7836
|
+
enumValues: values
|
|
7837
|
+
});
|
|
7838
|
+
}
|
|
7839
|
+
|
|
7840
|
+
// src/schema/table-schemas.ts
|
|
7841
|
+
function isScalarFormKind(kind) {
|
|
7842
|
+
return kind === "string" || kind === "number" || kind === "boolean" || kind === "enumeration";
|
|
7843
|
+
}
|
|
7844
|
+
function createBaseSchema(column) {
|
|
7845
|
+
const config = getColumnConfig(column);
|
|
7846
|
+
switch (config.kind) {
|
|
7847
|
+
case "boolean":
|
|
7848
|
+
return z.boolean();
|
|
7849
|
+
case "number":
|
|
7850
|
+
return z.number();
|
|
7851
|
+
case "json":
|
|
7852
|
+
return config.jsonSchema ?? z.unknown();
|
|
7853
|
+
case "enumeration":
|
|
7854
|
+
if (!config.enumValues || config.enumValues.length === 0) {
|
|
7855
|
+
return z.string();
|
|
7856
|
+
}
|
|
7857
|
+
return z.enum(config.enumValues);
|
|
7858
|
+
case "string":
|
|
7859
|
+
default:
|
|
7860
|
+
return z.string();
|
|
7861
|
+
}
|
|
7862
|
+
}
|
|
7863
|
+
function applyNullable(schema, column) {
|
|
7864
|
+
const config = getColumnConfig(column);
|
|
7865
|
+
return config.nullable ? schema.nullable() : schema;
|
|
7866
|
+
}
|
|
7867
|
+
function applyInsertOptional(schema, column) {
|
|
7868
|
+
const config = getColumnConfig(column);
|
|
7869
|
+
return config.nullable || config.hasDefault ? schema.optional() : schema;
|
|
7870
|
+
}
|
|
7871
|
+
function createFormFieldSchema(column) {
|
|
7872
|
+
const config = getColumnConfig(column);
|
|
7873
|
+
const base = createBaseSchema(column);
|
|
7874
|
+
let schema;
|
|
7875
|
+
if (config.nullable && isScalarFormKind(config.kind)) {
|
|
7876
|
+
schema = z.union([base, z.literal("")]).transform((value) => value === "" ? null : value);
|
|
7877
|
+
} else {
|
|
7878
|
+
schema = applyNullable(base, column);
|
|
7879
|
+
}
|
|
7880
|
+
if (config.nullable || config.hasDefault) {
|
|
7881
|
+
schema = schema.optional();
|
|
7882
|
+
}
|
|
7883
|
+
return schema;
|
|
7884
|
+
}
|
|
7885
|
+
function buildTableSchemaBundle(model, columns) {
|
|
7886
|
+
const rowShape = {};
|
|
7887
|
+
const insertShape = {};
|
|
7888
|
+
const updateShape = {};
|
|
7889
|
+
const formShape = {};
|
|
7890
|
+
for (const [columnName, column] of Object.entries(columns)) {
|
|
7891
|
+
const config = getColumnConfig(column);
|
|
7892
|
+
const base = createBaseSchema(column);
|
|
7893
|
+
rowShape[columnName] = applyNullable(base, column);
|
|
7894
|
+
if (config.isGenerated) {
|
|
7895
|
+
continue;
|
|
7896
|
+
}
|
|
7897
|
+
insertShape[columnName] = applyInsertOptional(applyNullable(base, column), column);
|
|
7898
|
+
updateShape[columnName] = applyNullable(base, column).optional();
|
|
7899
|
+
formShape[columnName] = createFormFieldSchema(column);
|
|
7900
|
+
}
|
|
7901
|
+
const rowSchema = z.object(rowShape);
|
|
7902
|
+
const insertSchema = z.object(insertShape);
|
|
7903
|
+
const updateSchema = z.object(updateShape);
|
|
7904
|
+
const formSchema = z.object(formShape).transform((value) => toModelPayload(model, value));
|
|
7905
|
+
return {
|
|
7906
|
+
row: rowSchema,
|
|
7907
|
+
insert: insertSchema,
|
|
7908
|
+
update: updateSchema,
|
|
7909
|
+
form: formSchema
|
|
7910
|
+
};
|
|
7911
|
+
}
|
|
7912
|
+
|
|
7913
|
+
// src/schema/table-builder.ts
|
|
7914
|
+
function assertColumnRecord(columns) {
|
|
7915
|
+
for (const [columnName, column] of Object.entries(columns)) {
|
|
7916
|
+
if (!isColumnBuilder(column)) {
|
|
7917
|
+
throw new Error(`Invalid column definition for "${columnName}"`);
|
|
7918
|
+
}
|
|
7919
|
+
}
|
|
7920
|
+
}
|
|
7921
|
+
function normalizeMappedNameInput(mappedName) {
|
|
7922
|
+
const normalized = mappedName.trim();
|
|
7923
|
+
if (!normalized) {
|
|
7924
|
+
throw new Error("table.from() requires a non-empty table name");
|
|
7925
|
+
}
|
|
7926
|
+
return normalized;
|
|
7927
|
+
}
|
|
7928
|
+
function normalizeSchemaNameInput(schemaName) {
|
|
7929
|
+
const normalized = schemaName.trim();
|
|
7930
|
+
if (!normalized) {
|
|
7931
|
+
throw new Error("table.schema() requires a non-empty schema name");
|
|
7932
|
+
}
|
|
7933
|
+
if (normalized.includes(".")) {
|
|
7934
|
+
throw new Error(
|
|
7935
|
+
'table.schema() expects a schema name without dots. Use .schema("schema").from("table") or .from("schema.table").'
|
|
7936
|
+
);
|
|
7937
|
+
}
|
|
7938
|
+
return normalized;
|
|
7939
|
+
}
|
|
7940
|
+
function resolveTableTarget(logicalName, mappedName, explicitSchemaName) {
|
|
7941
|
+
const physicalName = (mappedName ?? logicalName).trim();
|
|
7942
|
+
if (!physicalName) {
|
|
7943
|
+
throw new Error("table() requires a non-empty name");
|
|
7944
|
+
}
|
|
7945
|
+
const firstDot = physicalName.indexOf(".");
|
|
7946
|
+
const lastDot = physicalName.lastIndexOf(".");
|
|
7947
|
+
if (firstDot > 0 && firstDot === lastDot) {
|
|
7948
|
+
const inlineSchema = physicalName.slice(0, firstDot).trim();
|
|
7949
|
+
const inlineModel = physicalName.slice(firstDot + 1).trim();
|
|
7950
|
+
if (!inlineSchema || !inlineModel) {
|
|
7951
|
+
throw new Error('table.from() schema-qualified names must look like "schema.table"');
|
|
7952
|
+
}
|
|
7953
|
+
if (explicitSchemaName && explicitSchemaName !== inlineSchema) {
|
|
7954
|
+
throw new Error(
|
|
7955
|
+
`table schema "${explicitSchemaName}" conflicts with mapped table "${physicalName}"`
|
|
7956
|
+
);
|
|
7957
|
+
}
|
|
7958
|
+
return {
|
|
7959
|
+
schema: explicitSchemaName ?? inlineSchema,
|
|
7960
|
+
model: inlineModel,
|
|
7961
|
+
qualifiedName: `${explicitSchemaName ?? inlineSchema}.${inlineModel}`
|
|
7962
|
+
};
|
|
7963
|
+
}
|
|
7964
|
+
if (explicitSchemaName) {
|
|
7965
|
+
return {
|
|
7966
|
+
schema: explicitSchemaName,
|
|
7967
|
+
model: physicalName,
|
|
7968
|
+
qualifiedName: `${explicitSchemaName}.${physicalName}`
|
|
7969
|
+
};
|
|
7970
|
+
}
|
|
7971
|
+
return {
|
|
7972
|
+
model: physicalName,
|
|
7973
|
+
qualifiedName: physicalName
|
|
7974
|
+
};
|
|
7975
|
+
}
|
|
7976
|
+
function toColumnMetadata(column) {
|
|
7977
|
+
const config = getColumnConfig(column);
|
|
7978
|
+
return {
|
|
7979
|
+
kind: config.kind,
|
|
7980
|
+
columnName: config.columnName,
|
|
7981
|
+
nullable: config.nullable,
|
|
7982
|
+
hasDefault: config.hasDefault,
|
|
7983
|
+
isGenerated: config.isGenerated,
|
|
7984
|
+
enumValues: config.enumValues
|
|
7985
|
+
};
|
|
7986
|
+
}
|
|
7987
|
+
function buildNullableMap(columns) {
|
|
7988
|
+
return Object.fromEntries(
|
|
7989
|
+
Object.entries(columns).map(([columnName, column]) => [columnName, getColumnConfig(column).nullable])
|
|
7990
|
+
);
|
|
7991
|
+
}
|
|
7992
|
+
function buildColumnMetadataMap(columns) {
|
|
7993
|
+
return Object.fromEntries(
|
|
7994
|
+
Object.entries(columns).map(([columnName, column]) => [columnName, toColumnMetadata(column)])
|
|
7995
|
+
);
|
|
7996
|
+
}
|
|
7997
|
+
function finalizeTable(name, mappedName, schemaName, columns, primaryKey) {
|
|
7998
|
+
const target = resolveTableTarget(name, mappedName, schemaName);
|
|
7999
|
+
const model = defineModel({
|
|
8000
|
+
meta: {
|
|
8001
|
+
schema: target.schema,
|
|
8002
|
+
model: target.model,
|
|
8003
|
+
primaryKey: [...primaryKey],
|
|
8004
|
+
nullable: buildNullableMap(columns),
|
|
8005
|
+
columns: buildColumnMetadataMap(columns)
|
|
8006
|
+
}
|
|
8007
|
+
});
|
|
8008
|
+
const schemas = buildTableSchemaBundle(model, columns);
|
|
8009
|
+
return Object.assign(model, {
|
|
8010
|
+
kind: "table",
|
|
8011
|
+
name,
|
|
8012
|
+
mappedName,
|
|
8013
|
+
schemaName: target.schema,
|
|
8014
|
+
tableName: target.model,
|
|
8015
|
+
qualifiedName: target.qualifiedName,
|
|
8016
|
+
columns,
|
|
8017
|
+
schemas
|
|
8018
|
+
});
|
|
8019
|
+
}
|
|
8020
|
+
function createColumnsBuilder(name, mappedName, schemaName, columns) {
|
|
8021
|
+
assertColumnRecord(columns);
|
|
8022
|
+
return {
|
|
8023
|
+
name,
|
|
8024
|
+
mappedName,
|
|
8025
|
+
schemaName,
|
|
8026
|
+
columns,
|
|
8027
|
+
from(tableName) {
|
|
8028
|
+
const normalizedTableName = normalizeMappedNameInput(tableName);
|
|
8029
|
+
resolveTableTarget(name, normalizedTableName, schemaName);
|
|
8030
|
+
return createColumnsBuilder(name, normalizedTableName, schemaName, columns);
|
|
8031
|
+
},
|
|
8032
|
+
schema(nextSchemaName) {
|
|
8033
|
+
const normalizedSchemaName = normalizeSchemaNameInput(nextSchemaName);
|
|
8034
|
+
resolveTableTarget(name, mappedName, normalizedSchemaName);
|
|
8035
|
+
return createColumnsBuilder(name, mappedName, normalizedSchemaName, columns);
|
|
8036
|
+
},
|
|
8037
|
+
primaryKey(...keys) {
|
|
8038
|
+
return finalizeTable(name, mappedName, schemaName, columns, keys);
|
|
8039
|
+
}
|
|
8040
|
+
};
|
|
8041
|
+
}
|
|
8042
|
+
function createTableBuilder2(name, mappedName, schemaName) {
|
|
8043
|
+
return {
|
|
8044
|
+
name,
|
|
8045
|
+
mappedName,
|
|
8046
|
+
schemaName,
|
|
8047
|
+
from(tableName) {
|
|
8048
|
+
const normalizedTableName = normalizeMappedNameInput(tableName);
|
|
8049
|
+
resolveTableTarget(name, normalizedTableName, schemaName);
|
|
8050
|
+
return createTableBuilder2(name, normalizedTableName, schemaName);
|
|
8051
|
+
},
|
|
8052
|
+
schema(nextSchemaName) {
|
|
8053
|
+
const normalizedSchemaName = normalizeSchemaNameInput(nextSchemaName);
|
|
8054
|
+
resolveTableTarget(name, mappedName, normalizedSchemaName);
|
|
8055
|
+
return createTableBuilder2(name, mappedName, normalizedSchemaName);
|
|
8056
|
+
},
|
|
8057
|
+
columns(columns) {
|
|
8058
|
+
return createColumnsBuilder(name, mappedName, schemaName, columns);
|
|
8059
|
+
}
|
|
8060
|
+
};
|
|
8061
|
+
}
|
|
8062
|
+
function table(name) {
|
|
8063
|
+
if (!name.trim()) {
|
|
8064
|
+
throw new Error("table() requires a non-empty name");
|
|
8065
|
+
}
|
|
8066
|
+
return createTableBuilder2(name, void 0, void 0);
|
|
8067
|
+
}
|
|
8068
|
+
|
|
7165
8069
|
// src/schema/typed-client.ts
|
|
7166
8070
|
var TenantHeaderMapper = class {
|
|
7167
8071
|
constructor(tenantKeyMap) {
|
|
@@ -7201,12 +8105,10 @@ var RegistryNavigator = class {
|
|
|
7201
8105
|
return modelDef;
|
|
7202
8106
|
}
|
|
7203
8107
|
resolveTableName(schema, model, modelDef) {
|
|
7204
|
-
|
|
7205
|
-
|
|
7206
|
-
|
|
7207
|
-
|
|
7208
|
-
const modelName = modelDef.meta.model ?? model;
|
|
7209
|
-
return `${schemaName}.${modelName}`;
|
|
8108
|
+
return resolveAthenaModelTargetTableName(modelDef, {
|
|
8109
|
+
fallbackSchema: schema,
|
|
8110
|
+
fallbackModel: model
|
|
8111
|
+
});
|
|
7210
8112
|
}
|
|
7211
8113
|
};
|
|
7212
8114
|
var TypedAthenaClientImpl = class _TypedAthenaClientImpl {
|
|
@@ -7233,17 +8135,20 @@ var TypedAthenaClientImpl = class _TypedAthenaClientImpl {
|
|
|
7233
8135
|
this.clientOptions = {
|
|
7234
8136
|
backend: input.options?.backend,
|
|
7235
8137
|
client: input.options?.client,
|
|
7236
|
-
headers: input.options?.headers
|
|
8138
|
+
headers: input.options?.headers,
|
|
8139
|
+
experimental: input.options?.experimental
|
|
7237
8140
|
};
|
|
7238
8141
|
this.baseClient = createClient(this.url, this.apiKey, {
|
|
7239
8142
|
backend: this.clientOptions.backend,
|
|
7240
8143
|
client: this.clientOptions.client,
|
|
7241
|
-
headers: this.tenantHeaderMapper.apply(this.clientOptions.headers, tenantContext)
|
|
8144
|
+
headers: this.tenantHeaderMapper.apply(this.clientOptions.headers, tenantContext),
|
|
8145
|
+
experimental: this.clientOptions.experimental
|
|
7242
8146
|
});
|
|
7243
8147
|
this.db = this.baseClient.db;
|
|
7244
8148
|
}
|
|
7245
|
-
from(
|
|
7246
|
-
|
|
8149
|
+
from(tableOrModel, options) {
|
|
8150
|
+
const from = this.baseClient.from;
|
|
8151
|
+
return from(tableOrModel, options);
|
|
7247
8152
|
}
|
|
7248
8153
|
rpc(fn, args, options) {
|
|
7249
8154
|
return this.baseClient.rpc(fn, args, options);
|
|
@@ -7265,7 +8170,8 @@ var TypedAthenaClientImpl = class _TypedAthenaClientImpl {
|
|
|
7265
8170
|
tenantContext: {
|
|
7266
8171
|
...this.tenantContext,
|
|
7267
8172
|
...context ?? {}
|
|
7268
|
-
}
|
|
8173
|
+
},
|
|
8174
|
+
experimental: this.clientOptions.experimental
|
|
7269
8175
|
}
|
|
7270
8176
|
});
|
|
7271
8177
|
}
|
|
@@ -7284,67 +8190,6 @@ function createTypedClient(registry, url, apiKey, options) {
|
|
|
7284
8190
|
});
|
|
7285
8191
|
}
|
|
7286
8192
|
|
|
7287
|
-
// src/schema/model-form.ts
|
|
7288
|
-
function resolveNullishValue(mode) {
|
|
7289
|
-
if (mode === "undefined") return void 0;
|
|
7290
|
-
if (mode === "null") return null;
|
|
7291
|
-
return "";
|
|
7292
|
-
}
|
|
7293
|
-
function isRecord10(value) {
|
|
7294
|
-
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
7295
|
-
}
|
|
7296
|
-
function isNullableColumn(model, key) {
|
|
7297
|
-
const nullable = model.meta.nullable;
|
|
7298
|
-
return nullable?.[key] === true;
|
|
7299
|
-
}
|
|
7300
|
-
function toModelFormDefaults(model, values, options) {
|
|
7301
|
-
const source = values;
|
|
7302
|
-
if (!isRecord10(source)) {
|
|
7303
|
-
return {};
|
|
7304
|
-
}
|
|
7305
|
-
const mode = options?.nullishMode ?? "empty-string";
|
|
7306
|
-
const nullishValue = resolveNullishValue(mode);
|
|
7307
|
-
const result = {};
|
|
7308
|
-
for (const [key, value] of Object.entries(source)) {
|
|
7309
|
-
if (value === null && isNullableColumn(model, key)) {
|
|
7310
|
-
result[key] = nullishValue;
|
|
7311
|
-
continue;
|
|
7312
|
-
}
|
|
7313
|
-
result[key] = value;
|
|
7314
|
-
}
|
|
7315
|
-
return result;
|
|
7316
|
-
}
|
|
7317
|
-
function toModelPayload(model, formValues, options) {
|
|
7318
|
-
const emptyStringAsNull = options?.emptyStringAsNull ?? true;
|
|
7319
|
-
const stripUndefined = options?.stripUndefined ?? true;
|
|
7320
|
-
const result = {};
|
|
7321
|
-
for (const [key, rawValue] of Object.entries(formValues)) {
|
|
7322
|
-
if (rawValue === void 0 && stripUndefined) {
|
|
7323
|
-
continue;
|
|
7324
|
-
}
|
|
7325
|
-
if (emptyStringAsNull && rawValue === "" && isNullableColumn(model, key)) {
|
|
7326
|
-
result[key] = null;
|
|
7327
|
-
continue;
|
|
7328
|
-
}
|
|
7329
|
-
result[key] = rawValue;
|
|
7330
|
-
}
|
|
7331
|
-
return result;
|
|
7332
|
-
}
|
|
7333
|
-
function createModelFormAdapter(model) {
|
|
7334
|
-
return {
|
|
7335
|
-
model,
|
|
7336
|
-
toDefaults(values, options) {
|
|
7337
|
-
return toModelFormDefaults(model, values, options);
|
|
7338
|
-
},
|
|
7339
|
-
toInsert(values, options) {
|
|
7340
|
-
return toModelPayload(model, values, options);
|
|
7341
|
-
},
|
|
7342
|
-
toUpdate(values, options) {
|
|
7343
|
-
return toModelPayload(model, values, options);
|
|
7344
|
-
}
|
|
7345
|
-
};
|
|
7346
|
-
}
|
|
7347
|
-
|
|
7348
8193
|
// src/generator/schema-selection.ts
|
|
7349
8194
|
var DEFAULT_POSTGRES_SCHEMAS = ["public"];
|
|
7350
8195
|
function collectSchemaNames(input) {
|
|
@@ -8032,6 +8877,6 @@ async function runSchemaGenerator(options = {}) {
|
|
|
8032
8877
|
return throwBrowserUnsupported("runSchemaGenerator");
|
|
8033
8878
|
}
|
|
8034
8879
|
|
|
8035
|
-
export { ATHENA_AUTH_BASE_ERROR_CODES, AthenaClient, AthenaError, AthenaErrorCategory, AthenaErrorCode, AthenaErrorKind, AthenaGatewayError, AthenaStorageError, AthenaStorageErrorCode, Backend, DEFAULT_POSTGRES_SCHEMAS, assertInt, athenaAuth, coerceInt, createAthenaStorageError, createAuthClient, createAuthReactEmailInput, createClient, createModelFormAdapter, createPostgresIntrospectionProvider, createTypedClient, defineAthenaAuthConfig, defineAuthEmailTemplate, defineDatabase, defineGeneratorConfig, defineModel, defineRegistry, defineSchema, findGeneratorConfigPath, generateArtifactsFromSnapshot, generatorEnv, identifier, isAthenaGatewayError, isOk, loadGeneratorConfig, normalizeAthenaError, normalizeAthenaGatewayBaseUrl, normalizeGeneratorConfig, normalizeSchemaSelection, parseBooleanFlag2 as parseBooleanFlag, renderAthenaReactEmail, requireAffected, requireSuccess, resolveGeneratorProvider, resolvePostgresColumnType, resolveProviderSchemas, runSchemaGenerator, storageSdkManifest, toModelFormDefaults, toModelPayload, unwrap, unwrapOne, unwrapRows, verifyAthenaGatewayUrl, withRetry };
|
|
8880
|
+
export { ATHENA_AUTH_BASE_ERROR_CODES, AthenaClient, AthenaError, AthenaErrorCategory, AthenaErrorCode, AthenaErrorKind, AthenaGatewayError, AthenaStorageError, AthenaStorageErrorCode, Backend, DEFAULT_POSTGRES_SCHEMAS, assertInt, athenaAuth, boolean, coerceInt, createAthenaStorageError, createAuthClient, createAuthReactEmailInput, createClient, createModelFormAdapter, createPostgresIntrospectionProvider, createTypedClient, defineAthenaAuthConfig, defineAuthEmailTemplate, defineDatabase, defineGeneratorConfig, defineModel, defineRegistry, defineSchema, enumeration, findGeneratorConfigPath, generateArtifactsFromSnapshot, generatorEnv, getAthenaDebugAst, identifier, isAthenaGatewayError, isOk, json, loadGeneratorConfig, normalizeAthenaError, normalizeAthenaGatewayBaseUrl, normalizeGeneratorConfig, normalizeSchemaSelection, number, parseBooleanFlag2 as parseBooleanFlag, renderAthenaReactEmail, requireAffected, requireSuccess, resolveGeneratorProvider, resolvePostgresColumnType, resolveProviderSchemas, runSchemaGenerator, storageSdkManifest, string, table, toModelFormDefaults, toModelPayload, unwrap, unwrapOne, unwrapRows, verifyAthenaGatewayUrl, withRetry };
|
|
8036
8881
|
//# sourceMappingURL=browser.js.map
|
|
8037
8882
|
//# sourceMappingURL=browser.js.map
|