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