@xata.io/client 0.0.0-alpha.vfe896b3 → 0.0.0-alpha.vfe9f27c
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/.turbo/turbo-add-version.log +1 -1
- package/.turbo/turbo-build.log +4 -4
- package/CHANGELOG.md +101 -1
- package/dist/index.cjs +1000 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1457 -349
- package/dist/index.mjs +980 -74
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -3
- package/.eslintrc.cjs +0 -13
- package/rollup.config.mjs +0 -44
- package/tsconfig.json +0 -23
package/dist/index.mjs
CHANGED
@@ -27,8 +27,11 @@ function notEmpty(value) {
|
|
27
27
|
function compact(arr) {
|
28
28
|
return arr.filter(notEmpty);
|
29
29
|
}
|
30
|
+
function compactObject(obj) {
|
31
|
+
return Object.fromEntries(Object.entries(obj).filter(([, value]) => notEmpty(value)));
|
32
|
+
}
|
30
33
|
function isObject(value) {
|
31
|
-
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
34
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value) && !(value instanceof Date);
|
32
35
|
}
|
33
36
|
function isDefined(value) {
|
34
37
|
return value !== null && value !== void 0;
|
@@ -83,6 +86,27 @@ function chunk(array, chunkSize) {
|
|
83
86
|
async function timeout(ms) {
|
84
87
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
85
88
|
}
|
89
|
+
function timeoutWithCancel(ms) {
|
90
|
+
let timeoutId;
|
91
|
+
const promise = new Promise((resolve) => {
|
92
|
+
timeoutId = setTimeout(() => {
|
93
|
+
resolve();
|
94
|
+
}, ms);
|
95
|
+
});
|
96
|
+
return {
|
97
|
+
cancel: () => clearTimeout(timeoutId),
|
98
|
+
promise
|
99
|
+
};
|
100
|
+
}
|
101
|
+
function promiseMap(inputValues, mapper) {
|
102
|
+
const reducer = (acc$, inputValue) => acc$.then(
|
103
|
+
(acc) => mapper(inputValue).then((result) => {
|
104
|
+
acc.push(result);
|
105
|
+
return acc;
|
106
|
+
})
|
107
|
+
);
|
108
|
+
return inputValues.reduce(reducer, Promise.resolve([]));
|
109
|
+
}
|
86
110
|
|
87
111
|
function getEnvironment() {
|
88
112
|
try {
|
@@ -182,7 +206,7 @@ function getAPIKey() {
|
|
182
206
|
function getBranch() {
|
183
207
|
try {
|
184
208
|
const { branch } = getEnvironment();
|
185
|
-
return branch
|
209
|
+
return branch;
|
186
210
|
} catch (err) {
|
187
211
|
return void 0;
|
188
212
|
}
|
@@ -210,6 +234,12 @@ function getPreviewBranch() {
|
|
210
234
|
}
|
211
235
|
}
|
212
236
|
|
237
|
+
var __defProp$8 = Object.defineProperty;
|
238
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
239
|
+
var __publicField$8 = (obj, key, value) => {
|
240
|
+
__defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
|
241
|
+
return value;
|
242
|
+
};
|
213
243
|
var __accessCheck$8 = (obj, member, msg) => {
|
214
244
|
if (!member.has(obj))
|
215
245
|
throw TypeError("Cannot " + msg);
|
@@ -233,6 +263,7 @@ var __privateMethod$4 = (obj, member, method) => {
|
|
233
263
|
return method;
|
234
264
|
};
|
235
265
|
var _fetch, _queue, _concurrency, _enqueue, enqueue_fn;
|
266
|
+
const REQUEST_TIMEOUT = 3e4;
|
236
267
|
function getFetchImplementation(userFetch) {
|
237
268
|
const globalFetch = typeof fetch !== "undefined" ? fetch : void 0;
|
238
269
|
const fetchImpl = userFetch ?? globalFetch;
|
@@ -249,6 +280,8 @@ class ApiRequestPool {
|
|
249
280
|
__privateAdd$8(this, _fetch, void 0);
|
250
281
|
__privateAdd$8(this, _queue, void 0);
|
251
282
|
__privateAdd$8(this, _concurrency, void 0);
|
283
|
+
__publicField$8(this, "running");
|
284
|
+
__publicField$8(this, "started");
|
252
285
|
__privateSet$8(this, _queue, []);
|
253
286
|
__privateSet$8(this, _concurrency, concurrency);
|
254
287
|
this.running = 0;
|
@@ -264,18 +297,22 @@ class ApiRequestPool {
|
|
264
297
|
return __privateGet$8(this, _fetch);
|
265
298
|
}
|
266
299
|
request(url, options) {
|
267
|
-
const start = new Date();
|
268
|
-
const
|
300
|
+
const start = /* @__PURE__ */ new Date();
|
301
|
+
const fetchImpl = this.getFetch();
|
269
302
|
const runRequest = async (stalled = false) => {
|
270
|
-
const
|
303
|
+
const { promise, cancel } = timeoutWithCancel(REQUEST_TIMEOUT);
|
304
|
+
const response = await Promise.race([fetchImpl(url, options), promise.then(() => null)]).finally(cancel);
|
305
|
+
if (!response) {
|
306
|
+
throw new Error("Request timed out");
|
307
|
+
}
|
271
308
|
if (response.status === 429) {
|
272
309
|
const rateLimitReset = parseNumber(response.headers?.get("x-ratelimit-reset")) ?? 1;
|
273
310
|
await timeout(rateLimitReset * 1e3);
|
274
311
|
return await runRequest(true);
|
275
312
|
}
|
276
313
|
if (stalled) {
|
277
|
-
const stalledTime = new Date().getTime() - start.getTime();
|
278
|
-
console.warn(`A request to Xata hit
|
314
|
+
const stalledTime = (/* @__PURE__ */ new Date()).getTime() - start.getTime();
|
315
|
+
console.warn(`A request to Xata hit branch rate limits, was retried and stalled for ${stalledTime}ms`);
|
279
316
|
}
|
280
317
|
return response;
|
281
318
|
};
|
@@ -490,16 +527,26 @@ function defaultOnOpen(response) {
|
|
490
527
|
}
|
491
528
|
}
|
492
529
|
|
493
|
-
const VERSION = "0.
|
530
|
+
const VERSION = "0.26.0";
|
494
531
|
|
532
|
+
var __defProp$7 = Object.defineProperty;
|
533
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
534
|
+
var __publicField$7 = (obj, key, value) => {
|
535
|
+
__defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
|
536
|
+
return value;
|
537
|
+
};
|
495
538
|
class ErrorWithCause extends Error {
|
496
539
|
constructor(message, options) {
|
497
540
|
super(message, options);
|
541
|
+
__publicField$7(this, "cause");
|
498
542
|
}
|
499
543
|
}
|
500
544
|
class FetcherError extends ErrorWithCause {
|
501
545
|
constructor(status, data, requestId) {
|
502
546
|
super(getMessage(data));
|
547
|
+
__publicField$7(this, "status");
|
548
|
+
__publicField$7(this, "requestId");
|
549
|
+
__publicField$7(this, "errors");
|
503
550
|
this.status = status;
|
504
551
|
this.errors = isBulkError(data) ? data.errors : [{ message: getMessage(data), status }];
|
505
552
|
this.requestId = requestId;
|
@@ -566,6 +613,15 @@ function hostHeader(url) {
|
|
566
613
|
const { groups } = pattern.exec(url) ?? {};
|
567
614
|
return groups?.host ? { Host: groups.host } : {};
|
568
615
|
}
|
616
|
+
function parseBody(body, headers) {
|
617
|
+
if (!isDefined(body))
|
618
|
+
return void 0;
|
619
|
+
const { "Content-Type": contentType } = headers ?? {};
|
620
|
+
if (String(contentType).toLowerCase() === "application/json") {
|
621
|
+
return JSON.stringify(body);
|
622
|
+
}
|
623
|
+
return body;
|
624
|
+
}
|
569
625
|
const defaultClientID = generateUUID();
|
570
626
|
async function fetch$1({
|
571
627
|
url: path,
|
@@ -585,7 +641,8 @@ async function fetch$1({
|
|
585
641
|
sessionID,
|
586
642
|
clientName,
|
587
643
|
xataAgentExtra,
|
588
|
-
fetchOptions = {}
|
644
|
+
fetchOptions = {},
|
645
|
+
rawResponse = false
|
589
646
|
}) {
|
590
647
|
pool.setFetch(fetch2);
|
591
648
|
return await trace(
|
@@ -604,7 +661,7 @@ async function fetch$1({
|
|
604
661
|
isDefined(clientName) ? ["service", clientName] : void 0,
|
605
662
|
...Object.entries(xataAgentExtra ?? {})
|
606
663
|
]).map(([key, value]) => `${key}=${value}`).join("; ");
|
607
|
-
const headers = {
|
664
|
+
const headers = compactObject({
|
608
665
|
"Accept-Encoding": "identity",
|
609
666
|
"Content-Type": "application/json",
|
610
667
|
"X-Xata-Client-ID": clientID ?? defaultClientID,
|
@@ -613,11 +670,11 @@ async function fetch$1({
|
|
613
670
|
...customHeaders,
|
614
671
|
...hostHeader(fullUrl),
|
615
672
|
Authorization: `Bearer ${apiKey}`
|
616
|
-
};
|
673
|
+
});
|
617
674
|
const response = await pool.request(url, {
|
618
675
|
...fetchOptions,
|
619
676
|
method: method.toUpperCase(),
|
620
|
-
body: body
|
677
|
+
body: parseBody(body, headers),
|
621
678
|
headers,
|
622
679
|
signal
|
623
680
|
});
|
@@ -630,6 +687,9 @@ async function fetch$1({
|
|
630
687
|
[TraceAttributes.HTTP_HOST]: host,
|
631
688
|
[TraceAttributes.HTTP_SCHEME]: protocol?.replace(":", "")
|
632
689
|
});
|
690
|
+
const message = response.headers?.get("x-xata-message");
|
691
|
+
if (message)
|
692
|
+
console.warn(message);
|
633
693
|
if (response.status === 204) {
|
634
694
|
return {};
|
635
695
|
}
|
@@ -637,7 +697,7 @@ async function fetch$1({
|
|
637
697
|
throw new FetcherError(response.status, "Rate limit exceeded", requestId);
|
638
698
|
}
|
639
699
|
try {
|
640
|
-
const jsonResponse = await response.json();
|
700
|
+
const jsonResponse = rawResponse ? await response.blob() : await response.json();
|
641
701
|
if (response.ok) {
|
642
702
|
return jsonResponse;
|
643
703
|
}
|
@@ -832,6 +892,42 @@ const deleteColumn = (variables, signal) => dataPlaneFetch({
|
|
832
892
|
});
|
833
893
|
const branchTransaction = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/transaction", method: "post", ...variables, signal });
|
834
894
|
const insertRecord = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data", method: "post", ...variables, signal });
|
895
|
+
const getFileItem = (variables, signal) => dataPlaneFetch({
|
896
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}/column/{columnName}/file/{fileId}",
|
897
|
+
method: "get",
|
898
|
+
...variables,
|
899
|
+
signal
|
900
|
+
});
|
901
|
+
const putFileItem = (variables, signal) => dataPlaneFetch({
|
902
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}/column/{columnName}/file/{fileId}",
|
903
|
+
method: "put",
|
904
|
+
...variables,
|
905
|
+
signal
|
906
|
+
});
|
907
|
+
const deleteFileItem = (variables, signal) => dataPlaneFetch({
|
908
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}/column/{columnName}/file/{fileId}",
|
909
|
+
method: "delete",
|
910
|
+
...variables,
|
911
|
+
signal
|
912
|
+
});
|
913
|
+
const getFile = (variables, signal) => dataPlaneFetch({
|
914
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}/column/{columnName}/file",
|
915
|
+
method: "get",
|
916
|
+
...variables,
|
917
|
+
signal
|
918
|
+
});
|
919
|
+
const putFile = (variables, signal) => dataPlaneFetch({
|
920
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}/column/{columnName}/file",
|
921
|
+
method: "put",
|
922
|
+
...variables,
|
923
|
+
signal
|
924
|
+
});
|
925
|
+
const deleteFile = (variables, signal) => dataPlaneFetch({
|
926
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}/column/{columnName}/file",
|
927
|
+
method: "delete",
|
928
|
+
...variables,
|
929
|
+
signal
|
930
|
+
});
|
835
931
|
const getRecord = (variables, signal) => dataPlaneFetch({
|
836
932
|
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
837
933
|
method: "get",
|
@@ -861,12 +957,6 @@ const searchTable = (variables, signal) => dataPlaneFetch({
|
|
861
957
|
...variables,
|
862
958
|
signal
|
863
959
|
});
|
864
|
-
const sqlQuery = (variables, signal) => dataPlaneFetch({
|
865
|
-
url: "/db/{dbBranchName}/sql",
|
866
|
-
method: "post",
|
867
|
-
...variables,
|
868
|
-
signal
|
869
|
-
});
|
870
960
|
const vectorSearchTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/vectorSearch", method: "post", ...variables, signal });
|
871
961
|
const askTable = (variables, signal) => dataPlaneFetch({
|
872
962
|
url: "/db/{dbBranchName}/tables/{tableName}/ask",
|
@@ -874,8 +964,21 @@ const askTable = (variables, signal) => dataPlaneFetch({
|
|
874
964
|
...variables,
|
875
965
|
signal
|
876
966
|
});
|
967
|
+
const askTableSession = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/ask/{sessionId}", method: "post", ...variables, signal });
|
877
968
|
const summarizeTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/summarize", method: "post", ...variables, signal });
|
878
969
|
const aggregateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/aggregate", method: "post", ...variables, signal });
|
970
|
+
const fileAccess = (variables, signal) => dataPlaneFetch({
|
971
|
+
url: "/file/{fileId}",
|
972
|
+
method: "get",
|
973
|
+
...variables,
|
974
|
+
signal
|
975
|
+
});
|
976
|
+
const sqlQuery = (variables, signal) => dataPlaneFetch({
|
977
|
+
url: "/db/{dbBranchName}/sql",
|
978
|
+
method: "post",
|
979
|
+
...variables,
|
980
|
+
signal
|
981
|
+
});
|
879
982
|
const operationsByTag$2 = {
|
880
983
|
branch: {
|
881
984
|
getBranchList,
|
@@ -935,20 +1038,24 @@ const operationsByTag$2 = {
|
|
935
1038
|
deleteRecord,
|
936
1039
|
bulkInsertTableRecords
|
937
1040
|
},
|
1041
|
+
files: { getFileItem, putFileItem, deleteFileItem, getFile, putFile, deleteFile, fileAccess },
|
938
1042
|
searchAndFilter: {
|
939
1043
|
queryTable,
|
940
1044
|
searchBranch,
|
941
1045
|
searchTable,
|
942
|
-
sqlQuery,
|
943
1046
|
vectorSearchTable,
|
944
1047
|
askTable,
|
1048
|
+
askTableSession,
|
945
1049
|
summarizeTable,
|
946
1050
|
aggregateTable
|
947
|
-
}
|
1051
|
+
},
|
1052
|
+
sql: { sqlQuery }
|
948
1053
|
};
|
949
1054
|
|
950
1055
|
const controlPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "controlPlane" });
|
951
1056
|
|
1057
|
+
const getAuthorizationCode = (variables, signal) => controlPlaneFetch({ url: "/oauth/authorize", method: "get", ...variables, signal });
|
1058
|
+
const grantAuthorizationCode = (variables, signal) => controlPlaneFetch({ url: "/oauth/authorize", method: "post", ...variables, signal });
|
952
1059
|
const getUser = (variables, signal) => controlPlaneFetch({
|
953
1060
|
url: "/user",
|
954
1061
|
method: "get",
|
@@ -985,6 +1092,31 @@ const deleteUserAPIKey = (variables, signal) => controlPlaneFetch({
|
|
985
1092
|
...variables,
|
986
1093
|
signal
|
987
1094
|
});
|
1095
|
+
const getUserOAuthClients = (variables, signal) => controlPlaneFetch({
|
1096
|
+
url: "/user/oauth/clients",
|
1097
|
+
method: "get",
|
1098
|
+
...variables,
|
1099
|
+
signal
|
1100
|
+
});
|
1101
|
+
const deleteUserOAuthClient = (variables, signal) => controlPlaneFetch({
|
1102
|
+
url: "/user/oauth/clients/{clientId}",
|
1103
|
+
method: "delete",
|
1104
|
+
...variables,
|
1105
|
+
signal
|
1106
|
+
});
|
1107
|
+
const getUserOAuthAccessTokens = (variables, signal) => controlPlaneFetch({
|
1108
|
+
url: "/user/oauth/tokens",
|
1109
|
+
method: "get",
|
1110
|
+
...variables,
|
1111
|
+
signal
|
1112
|
+
});
|
1113
|
+
const deleteOAuthAccessToken = (variables, signal) => controlPlaneFetch({
|
1114
|
+
url: "/user/oauth/tokens/{token}",
|
1115
|
+
method: "delete",
|
1116
|
+
...variables,
|
1117
|
+
signal
|
1118
|
+
});
|
1119
|
+
const updateOAuthAccessToken = (variables, signal) => controlPlaneFetch({ url: "/user/oauth/tokens/{token}", method: "patch", ...variables, signal });
|
988
1120
|
const getWorkspacesList = (variables, signal) => controlPlaneFetch({
|
989
1121
|
url: "/workspaces",
|
990
1122
|
method: "get",
|
@@ -1043,6 +1175,7 @@ const deleteDatabase = (variables, signal) => controlPlaneFetch({
|
|
1043
1175
|
});
|
1044
1176
|
const getDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "get", ...variables, signal });
|
1045
1177
|
const updateDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "patch", ...variables, signal });
|
1178
|
+
const renameDatabase = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}/rename", method: "post", ...variables, signal });
|
1046
1179
|
const getDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}/github", method: "get", ...variables, signal });
|
1047
1180
|
const updateDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}/github", method: "put", ...variables, signal });
|
1048
1181
|
const deleteDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}/github", method: "delete", ...variables, signal });
|
@@ -1053,6 +1186,15 @@ const listRegions = (variables, signal) => controlPlaneFetch({
|
|
1053
1186
|
signal
|
1054
1187
|
});
|
1055
1188
|
const operationsByTag$1 = {
|
1189
|
+
oAuth: {
|
1190
|
+
getAuthorizationCode,
|
1191
|
+
grantAuthorizationCode,
|
1192
|
+
getUserOAuthClients,
|
1193
|
+
deleteUserOAuthClient,
|
1194
|
+
getUserOAuthAccessTokens,
|
1195
|
+
deleteOAuthAccessToken,
|
1196
|
+
updateOAuthAccessToken
|
1197
|
+
},
|
1056
1198
|
users: { getUser, updateUser, deleteUser },
|
1057
1199
|
authentication: { getUserAPIKeys, createUserAPIKey, deleteUserAPIKey },
|
1058
1200
|
workspaces: {
|
@@ -1078,6 +1220,7 @@ const operationsByTag$1 = {
|
|
1078
1220
|
deleteDatabase,
|
1079
1221
|
getDatabaseMetadata,
|
1080
1222
|
updateDatabaseMetadata,
|
1223
|
+
renameDatabase,
|
1081
1224
|
getDatabaseGithubSettings,
|
1082
1225
|
updateDatabaseGithubSettings,
|
1083
1226
|
deleteDatabaseGithubSettings,
|
@@ -1233,6 +1376,11 @@ class XataApiClient {
|
|
1233
1376
|
__privateGet$7(this, _namespaces).records = new RecordsApi(__privateGet$7(this, _extraProps));
|
1234
1377
|
return __privateGet$7(this, _namespaces).records;
|
1235
1378
|
}
|
1379
|
+
get files() {
|
1380
|
+
if (!__privateGet$7(this, _namespaces).files)
|
1381
|
+
__privateGet$7(this, _namespaces).files = new FilesApi(__privateGet$7(this, _extraProps));
|
1382
|
+
return __privateGet$7(this, _namespaces).files;
|
1383
|
+
}
|
1236
1384
|
get searchAndFilter() {
|
1237
1385
|
if (!__privateGet$7(this, _namespaces).searchAndFilter)
|
1238
1386
|
__privateGet$7(this, _namespaces).searchAndFilter = new SearchAndFilterApi(__privateGet$7(this, _extraProps));
|
@@ -1810,6 +1958,164 @@ class RecordsApi {
|
|
1810
1958
|
});
|
1811
1959
|
}
|
1812
1960
|
}
|
1961
|
+
class FilesApi {
|
1962
|
+
constructor(extraProps) {
|
1963
|
+
this.extraProps = extraProps;
|
1964
|
+
}
|
1965
|
+
getFileItem({
|
1966
|
+
workspace,
|
1967
|
+
region,
|
1968
|
+
database,
|
1969
|
+
branch,
|
1970
|
+
table,
|
1971
|
+
record,
|
1972
|
+
column,
|
1973
|
+
fileId
|
1974
|
+
}) {
|
1975
|
+
return operationsByTag.files.getFileItem({
|
1976
|
+
pathParams: {
|
1977
|
+
workspace,
|
1978
|
+
region,
|
1979
|
+
dbBranchName: `${database}:${branch}`,
|
1980
|
+
tableName: table,
|
1981
|
+
recordId: record,
|
1982
|
+
columnName: column,
|
1983
|
+
fileId
|
1984
|
+
},
|
1985
|
+
...this.extraProps
|
1986
|
+
});
|
1987
|
+
}
|
1988
|
+
putFileItem({
|
1989
|
+
workspace,
|
1990
|
+
region,
|
1991
|
+
database,
|
1992
|
+
branch,
|
1993
|
+
table,
|
1994
|
+
record,
|
1995
|
+
column,
|
1996
|
+
fileId,
|
1997
|
+
file
|
1998
|
+
}) {
|
1999
|
+
return operationsByTag.files.putFileItem({
|
2000
|
+
pathParams: {
|
2001
|
+
workspace,
|
2002
|
+
region,
|
2003
|
+
dbBranchName: `${database}:${branch}`,
|
2004
|
+
tableName: table,
|
2005
|
+
recordId: record,
|
2006
|
+
columnName: column,
|
2007
|
+
fileId
|
2008
|
+
},
|
2009
|
+
// @ts-ignore
|
2010
|
+
body: file,
|
2011
|
+
...this.extraProps
|
2012
|
+
});
|
2013
|
+
}
|
2014
|
+
deleteFileItem({
|
2015
|
+
workspace,
|
2016
|
+
region,
|
2017
|
+
database,
|
2018
|
+
branch,
|
2019
|
+
table,
|
2020
|
+
record,
|
2021
|
+
column,
|
2022
|
+
fileId
|
2023
|
+
}) {
|
2024
|
+
return operationsByTag.files.deleteFileItem({
|
2025
|
+
pathParams: {
|
2026
|
+
workspace,
|
2027
|
+
region,
|
2028
|
+
dbBranchName: `${database}:${branch}`,
|
2029
|
+
tableName: table,
|
2030
|
+
recordId: record,
|
2031
|
+
columnName: column,
|
2032
|
+
fileId
|
2033
|
+
},
|
2034
|
+
...this.extraProps
|
2035
|
+
});
|
2036
|
+
}
|
2037
|
+
getFile({
|
2038
|
+
workspace,
|
2039
|
+
region,
|
2040
|
+
database,
|
2041
|
+
branch,
|
2042
|
+
table,
|
2043
|
+
record,
|
2044
|
+
column
|
2045
|
+
}) {
|
2046
|
+
return operationsByTag.files.getFile({
|
2047
|
+
pathParams: {
|
2048
|
+
workspace,
|
2049
|
+
region,
|
2050
|
+
dbBranchName: `${database}:${branch}`,
|
2051
|
+
tableName: table,
|
2052
|
+
recordId: record,
|
2053
|
+
columnName: column
|
2054
|
+
},
|
2055
|
+
...this.extraProps
|
2056
|
+
});
|
2057
|
+
}
|
2058
|
+
putFile({
|
2059
|
+
workspace,
|
2060
|
+
region,
|
2061
|
+
database,
|
2062
|
+
branch,
|
2063
|
+
table,
|
2064
|
+
record,
|
2065
|
+
column,
|
2066
|
+
file
|
2067
|
+
}) {
|
2068
|
+
return operationsByTag.files.putFile({
|
2069
|
+
pathParams: {
|
2070
|
+
workspace,
|
2071
|
+
region,
|
2072
|
+
dbBranchName: `${database}:${branch}`,
|
2073
|
+
tableName: table,
|
2074
|
+
recordId: record,
|
2075
|
+
columnName: column
|
2076
|
+
},
|
2077
|
+
body: file,
|
2078
|
+
...this.extraProps
|
2079
|
+
});
|
2080
|
+
}
|
2081
|
+
deleteFile({
|
2082
|
+
workspace,
|
2083
|
+
region,
|
2084
|
+
database,
|
2085
|
+
branch,
|
2086
|
+
table,
|
2087
|
+
record,
|
2088
|
+
column
|
2089
|
+
}) {
|
2090
|
+
return operationsByTag.files.deleteFile({
|
2091
|
+
pathParams: {
|
2092
|
+
workspace,
|
2093
|
+
region,
|
2094
|
+
dbBranchName: `${database}:${branch}`,
|
2095
|
+
tableName: table,
|
2096
|
+
recordId: record,
|
2097
|
+
columnName: column
|
2098
|
+
},
|
2099
|
+
...this.extraProps
|
2100
|
+
});
|
2101
|
+
}
|
2102
|
+
fileAccess({
|
2103
|
+
workspace,
|
2104
|
+
region,
|
2105
|
+
fileId,
|
2106
|
+
verify
|
2107
|
+
}) {
|
2108
|
+
return operationsByTag.files.fileAccess({
|
2109
|
+
pathParams: {
|
2110
|
+
workspace,
|
2111
|
+
region,
|
2112
|
+
fileId
|
2113
|
+
},
|
2114
|
+
queryParams: { verify },
|
2115
|
+
...this.extraProps
|
2116
|
+
});
|
2117
|
+
}
|
2118
|
+
}
|
1813
2119
|
class SearchAndFilterApi {
|
1814
2120
|
constructor(extraProps) {
|
1815
2121
|
this.extraProps = extraProps;
|
@@ -1901,6 +2207,21 @@ class SearchAndFilterApi {
|
|
1901
2207
|
...this.extraProps
|
1902
2208
|
});
|
1903
2209
|
}
|
2210
|
+
askTableSession({
|
2211
|
+
workspace,
|
2212
|
+
region,
|
2213
|
+
database,
|
2214
|
+
branch,
|
2215
|
+
table,
|
2216
|
+
sessionId,
|
2217
|
+
message
|
2218
|
+
}) {
|
2219
|
+
return operationsByTag.searchAndFilter.askTableSession({
|
2220
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, sessionId },
|
2221
|
+
body: { message },
|
2222
|
+
...this.extraProps
|
2223
|
+
});
|
2224
|
+
}
|
1904
2225
|
summarizeTable({
|
1905
2226
|
workspace,
|
1906
2227
|
region,
|
@@ -2192,11 +2513,13 @@ class DatabaseApi {
|
|
2192
2513
|
createDatabase({
|
2193
2514
|
workspace,
|
2194
2515
|
database,
|
2195
|
-
data
|
2516
|
+
data,
|
2517
|
+
headers
|
2196
2518
|
}) {
|
2197
2519
|
return operationsByTag.databases.createDatabase({
|
2198
2520
|
pathParams: { workspaceId: workspace, dbName: database },
|
2199
2521
|
body: data,
|
2522
|
+
headers,
|
2200
2523
|
...this.extraProps
|
2201
2524
|
});
|
2202
2525
|
}
|
@@ -2229,6 +2552,17 @@ class DatabaseApi {
|
|
2229
2552
|
...this.extraProps
|
2230
2553
|
});
|
2231
2554
|
}
|
2555
|
+
renameDatabase({
|
2556
|
+
workspace,
|
2557
|
+
database,
|
2558
|
+
newName
|
2559
|
+
}) {
|
2560
|
+
return operationsByTag.databases.renameDatabase({
|
2561
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
2562
|
+
body: { newName },
|
2563
|
+
...this.extraProps
|
2564
|
+
});
|
2565
|
+
}
|
2232
2566
|
getDatabaseGithubSettings({
|
2233
2567
|
workspace,
|
2234
2568
|
database
|
@@ -2275,13 +2609,261 @@ class XataApiPlugin {
|
|
2275
2609
|
class XataPlugin {
|
2276
2610
|
}
|
2277
2611
|
|
2612
|
+
class FilesPlugin extends XataPlugin {
|
2613
|
+
build(pluginOptions) {
|
2614
|
+
return {
|
2615
|
+
download: async (location) => {
|
2616
|
+
const { table, record, column, fileId = "" } = location ?? {};
|
2617
|
+
return await getFileItem({
|
2618
|
+
pathParams: {
|
2619
|
+
workspace: "{workspaceId}",
|
2620
|
+
dbBranchName: "{dbBranch}",
|
2621
|
+
region: "{region}",
|
2622
|
+
tableName: table ?? "",
|
2623
|
+
recordId: record ?? "",
|
2624
|
+
columnName: column ?? "",
|
2625
|
+
fileId
|
2626
|
+
},
|
2627
|
+
...pluginOptions,
|
2628
|
+
rawResponse: true
|
2629
|
+
});
|
2630
|
+
},
|
2631
|
+
upload: async (location, file) => {
|
2632
|
+
const { table, record, column, fileId = "" } = location ?? {};
|
2633
|
+
return await putFileItem({
|
2634
|
+
pathParams: {
|
2635
|
+
workspace: "{workspaceId}",
|
2636
|
+
dbBranchName: "{dbBranch}",
|
2637
|
+
region: "{region}",
|
2638
|
+
tableName: table ?? "",
|
2639
|
+
recordId: record ?? "",
|
2640
|
+
columnName: column ?? "",
|
2641
|
+
fileId
|
2642
|
+
},
|
2643
|
+
body: file,
|
2644
|
+
...pluginOptions
|
2645
|
+
});
|
2646
|
+
},
|
2647
|
+
delete: async (location) => {
|
2648
|
+
const { table, record, column, fileId = "" } = location ?? {};
|
2649
|
+
return await deleteFileItem({
|
2650
|
+
pathParams: {
|
2651
|
+
workspace: "{workspaceId}",
|
2652
|
+
dbBranchName: "{dbBranch}",
|
2653
|
+
region: "{region}",
|
2654
|
+
tableName: table ?? "",
|
2655
|
+
recordId: record ?? "",
|
2656
|
+
columnName: column ?? "",
|
2657
|
+
fileId
|
2658
|
+
},
|
2659
|
+
...pluginOptions
|
2660
|
+
});
|
2661
|
+
}
|
2662
|
+
};
|
2663
|
+
}
|
2664
|
+
}
|
2665
|
+
|
2666
|
+
function buildTransformString(transformations) {
|
2667
|
+
return transformations.flatMap(
|
2668
|
+
(t) => Object.entries(t).map(([key, value]) => {
|
2669
|
+
if (key === "trim") {
|
2670
|
+
const { left = 0, top = 0, right = 0, bottom = 0 } = value;
|
2671
|
+
return `${key}=${[top, right, bottom, left].join(";")}`;
|
2672
|
+
}
|
2673
|
+
if (key === "gravity" && typeof value === "object") {
|
2674
|
+
const { x = 0.5, y = 0.5 } = value;
|
2675
|
+
return `${key}=${[x, y].join("x")}`;
|
2676
|
+
}
|
2677
|
+
return `${key}=${value}`;
|
2678
|
+
})
|
2679
|
+
).join(",");
|
2680
|
+
}
|
2681
|
+
function transformImage(url, ...transformations) {
|
2682
|
+
if (!isDefined(url))
|
2683
|
+
return void 0;
|
2684
|
+
const transformationsString = buildTransformString(transformations);
|
2685
|
+
const { hostname, pathname, search } = new URL(url);
|
2686
|
+
return `https://${hostname}/transform/${transformationsString}${pathname}${search}`;
|
2687
|
+
}
|
2688
|
+
|
2689
|
+
var __defProp$6 = Object.defineProperty;
|
2690
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
2691
|
+
var __publicField$6 = (obj, key, value) => {
|
2692
|
+
__defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
|
2693
|
+
return value;
|
2694
|
+
};
|
2695
|
+
class XataFile {
|
2696
|
+
constructor(file) {
|
2697
|
+
/**
|
2698
|
+
* Name of this file.
|
2699
|
+
*/
|
2700
|
+
__publicField$6(this, "name");
|
2701
|
+
/**
|
2702
|
+
* Media type of this file.
|
2703
|
+
*/
|
2704
|
+
__publicField$6(this, "mediaType");
|
2705
|
+
/**
|
2706
|
+
* Base64 encoded content of this file.
|
2707
|
+
*/
|
2708
|
+
__publicField$6(this, "base64Content");
|
2709
|
+
/**
|
2710
|
+
* Whether to enable public url for this file.
|
2711
|
+
*/
|
2712
|
+
__publicField$6(this, "enablePublicUrl");
|
2713
|
+
/**
|
2714
|
+
* Timeout for the signed url.
|
2715
|
+
*/
|
2716
|
+
__publicField$6(this, "signedUrlTimeout");
|
2717
|
+
/**
|
2718
|
+
* Size of this file.
|
2719
|
+
*/
|
2720
|
+
__publicField$6(this, "size");
|
2721
|
+
/**
|
2722
|
+
* Version of this file.
|
2723
|
+
*/
|
2724
|
+
__publicField$6(this, "version");
|
2725
|
+
/**
|
2726
|
+
* Url of this file.
|
2727
|
+
*/
|
2728
|
+
__publicField$6(this, "url");
|
2729
|
+
/**
|
2730
|
+
* Signed url of this file.
|
2731
|
+
*/
|
2732
|
+
__publicField$6(this, "signedUrl");
|
2733
|
+
/**
|
2734
|
+
* Attributes of this file.
|
2735
|
+
*/
|
2736
|
+
__publicField$6(this, "attributes");
|
2737
|
+
this.name = file.name;
|
2738
|
+
this.mediaType = file.mediaType || "application/octet-stream";
|
2739
|
+
this.base64Content = file.base64Content;
|
2740
|
+
this.enablePublicUrl = file.enablePublicUrl;
|
2741
|
+
this.signedUrlTimeout = file.signedUrlTimeout;
|
2742
|
+
this.size = file.size;
|
2743
|
+
this.version = file.version;
|
2744
|
+
this.url = file.url;
|
2745
|
+
this.signedUrl = file.signedUrl;
|
2746
|
+
this.attributes = file.attributes;
|
2747
|
+
}
|
2748
|
+
static fromBuffer(buffer, options = {}) {
|
2749
|
+
const base64Content = buffer.toString("base64");
|
2750
|
+
return new XataFile({ ...options, base64Content });
|
2751
|
+
}
|
2752
|
+
toBuffer() {
|
2753
|
+
if (!this.base64Content) {
|
2754
|
+
throw new Error(`File content is not available, please select property "base64Content" when querying the file`);
|
2755
|
+
}
|
2756
|
+
return Buffer.from(this.base64Content, "base64");
|
2757
|
+
}
|
2758
|
+
static fromArrayBuffer(arrayBuffer, options = {}) {
|
2759
|
+
const uint8Array = new Uint8Array(arrayBuffer);
|
2760
|
+
return this.fromUint8Array(uint8Array, options);
|
2761
|
+
}
|
2762
|
+
toArrayBuffer() {
|
2763
|
+
if (!this.base64Content) {
|
2764
|
+
throw new Error(`File content is not available, please select property "base64Content" when querying the file`);
|
2765
|
+
}
|
2766
|
+
const binary = atob(this.base64Content);
|
2767
|
+
return new ArrayBuffer(binary.length);
|
2768
|
+
}
|
2769
|
+
static fromUint8Array(uint8Array, options = {}) {
|
2770
|
+
let binary = "";
|
2771
|
+
for (let i = 0; i < uint8Array.byteLength; i++) {
|
2772
|
+
binary += String.fromCharCode(uint8Array[i]);
|
2773
|
+
}
|
2774
|
+
const base64Content = btoa(binary);
|
2775
|
+
return new XataFile({ ...options, base64Content });
|
2776
|
+
}
|
2777
|
+
toUint8Array() {
|
2778
|
+
if (!this.base64Content) {
|
2779
|
+
throw new Error(`File content is not available, please select property "base64Content" when querying the file`);
|
2780
|
+
}
|
2781
|
+
const binary = atob(this.base64Content);
|
2782
|
+
const uint8Array = new Uint8Array(binary.length);
|
2783
|
+
for (let i = 0; i < binary.length; i++) {
|
2784
|
+
uint8Array[i] = binary.charCodeAt(i);
|
2785
|
+
}
|
2786
|
+
return uint8Array;
|
2787
|
+
}
|
2788
|
+
static async fromBlob(file, options = {}) {
|
2789
|
+
const name = options.name ?? file.name;
|
2790
|
+
const mediaType = file.type;
|
2791
|
+
const arrayBuffer = await file.arrayBuffer();
|
2792
|
+
return this.fromArrayBuffer(arrayBuffer, { ...options, name, mediaType });
|
2793
|
+
}
|
2794
|
+
toBlob() {
|
2795
|
+
if (!this.base64Content) {
|
2796
|
+
throw new Error(`File content is not available, please select property "base64Content" when querying the file`);
|
2797
|
+
}
|
2798
|
+
const arrayBuffer = this.toArrayBuffer();
|
2799
|
+
return new Blob([arrayBuffer], { type: this.mediaType });
|
2800
|
+
}
|
2801
|
+
static fromString(string, options = {}) {
|
2802
|
+
const base64Content = btoa(string);
|
2803
|
+
return new XataFile({ ...options, base64Content });
|
2804
|
+
}
|
2805
|
+
toString() {
|
2806
|
+
if (!this.base64Content) {
|
2807
|
+
throw new Error(`File content is not available, please select property "base64Content" when querying the file`);
|
2808
|
+
}
|
2809
|
+
return atob(this.base64Content);
|
2810
|
+
}
|
2811
|
+
static fromBase64(base64Content, options = {}) {
|
2812
|
+
return new XataFile({ ...options, base64Content });
|
2813
|
+
}
|
2814
|
+
toBase64() {
|
2815
|
+
if (!this.base64Content) {
|
2816
|
+
throw new Error(`File content is not available, please select property "base64Content" when querying the file`);
|
2817
|
+
}
|
2818
|
+
return this.base64Content;
|
2819
|
+
}
|
2820
|
+
transform(...options) {
|
2821
|
+
return {
|
2822
|
+
url: transformImage(this.url, ...options),
|
2823
|
+
signedUrl: transformImage(this.signedUrl, ...options)
|
2824
|
+
};
|
2825
|
+
}
|
2826
|
+
}
|
2827
|
+
const parseInputFileEntry = async (entry) => {
|
2828
|
+
if (!isDefined(entry))
|
2829
|
+
return null;
|
2830
|
+
const { id, name, mediaType, base64Content, enablePublicUrl, signedUrlTimeout } = await entry;
|
2831
|
+
return compactObject({ id, name, mediaType, base64Content, enablePublicUrl, signedUrlTimeout });
|
2832
|
+
};
|
2833
|
+
|
2278
2834
|
function cleanFilter(filter) {
|
2279
|
-
if (!filter)
|
2835
|
+
if (!isDefined(filter))
|
2280
2836
|
return void 0;
|
2281
|
-
|
2282
|
-
|
2837
|
+
if (!isObject(filter))
|
2838
|
+
return filter;
|
2839
|
+
const values = Object.fromEntries(
|
2840
|
+
Object.entries(filter).reduce((acc, [key, value]) => {
|
2841
|
+
if (!isDefined(value))
|
2842
|
+
return acc;
|
2843
|
+
if (Array.isArray(value)) {
|
2844
|
+
const clean = value.map((item) => cleanFilter(item)).filter((item) => isDefined(item));
|
2845
|
+
if (clean.length === 0)
|
2846
|
+
return acc;
|
2847
|
+
return [...acc, [key, clean]];
|
2848
|
+
}
|
2849
|
+
if (isObject(value)) {
|
2850
|
+
const clean = cleanFilter(value);
|
2851
|
+
if (!isDefined(clean))
|
2852
|
+
return acc;
|
2853
|
+
return [...acc, [key, clean]];
|
2854
|
+
}
|
2855
|
+
return [...acc, [key, value]];
|
2856
|
+
}, [])
|
2857
|
+
);
|
2858
|
+
return Object.keys(values).length > 0 ? values : void 0;
|
2283
2859
|
}
|
2284
2860
|
|
2861
|
+
var __defProp$5 = Object.defineProperty;
|
2862
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
2863
|
+
var __publicField$5 = (obj, key, value) => {
|
2864
|
+
__defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
2865
|
+
return value;
|
2866
|
+
};
|
2285
2867
|
var __accessCheck$6 = (obj, member, msg) => {
|
2286
2868
|
if (!member.has(obj))
|
2287
2869
|
throw TypeError("Cannot " + msg);
|
@@ -2304,22 +2886,58 @@ var _query, _page;
|
|
2304
2886
|
class Page {
|
2305
2887
|
constructor(query, meta, records = []) {
|
2306
2888
|
__privateAdd$6(this, _query, void 0);
|
2889
|
+
/**
|
2890
|
+
* Page metadata, required to retrieve additional records.
|
2891
|
+
*/
|
2892
|
+
__publicField$5(this, "meta");
|
2893
|
+
/**
|
2894
|
+
* The set of results for this page.
|
2895
|
+
*/
|
2896
|
+
__publicField$5(this, "records");
|
2307
2897
|
__privateSet$6(this, _query, query);
|
2308
2898
|
this.meta = meta;
|
2309
2899
|
this.records = new RecordArray(this, records);
|
2310
2900
|
}
|
2901
|
+
/**
|
2902
|
+
* Retrieves the next page of results.
|
2903
|
+
* @param size Maximum number of results to be retrieved.
|
2904
|
+
* @param offset Number of results to skip when retrieving the results.
|
2905
|
+
* @returns The next page or results.
|
2906
|
+
*/
|
2311
2907
|
async nextPage(size, offset) {
|
2312
2908
|
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, after: this.meta.page.cursor } });
|
2313
2909
|
}
|
2910
|
+
/**
|
2911
|
+
* Retrieves the previous page of results.
|
2912
|
+
* @param size Maximum number of results to be retrieved.
|
2913
|
+
* @param offset Number of results to skip when retrieving the results.
|
2914
|
+
* @returns The previous page or results.
|
2915
|
+
*/
|
2314
2916
|
async previousPage(size, offset) {
|
2315
2917
|
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, before: this.meta.page.cursor } });
|
2316
2918
|
}
|
2919
|
+
/**
|
2920
|
+
* Retrieves the start page of results.
|
2921
|
+
* @param size Maximum number of results to be retrieved.
|
2922
|
+
* @param offset Number of results to skip when retrieving the results.
|
2923
|
+
* @returns The start page or results.
|
2924
|
+
*/
|
2317
2925
|
async startPage(size, offset) {
|
2318
2926
|
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, start: this.meta.page.cursor } });
|
2319
2927
|
}
|
2928
|
+
/**
|
2929
|
+
* Retrieves the end page of results.
|
2930
|
+
* @param size Maximum number of results to be retrieved.
|
2931
|
+
* @param offset Number of results to skip when retrieving the results.
|
2932
|
+
* @returns The end page or results.
|
2933
|
+
*/
|
2320
2934
|
async endPage(size, offset) {
|
2321
2935
|
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, end: this.meta.page.cursor } });
|
2322
2936
|
}
|
2937
|
+
/**
|
2938
|
+
* Shortcut method to check if there will be additional results if the next page of results is retrieved.
|
2939
|
+
* @returns Whether or not there will be additional results in the next page of results.
|
2940
|
+
*/
|
2323
2941
|
hasNextPage() {
|
2324
2942
|
return this.meta.page.more;
|
2325
2943
|
}
|
@@ -2332,7 +2950,7 @@ const PAGINATION_DEFAULT_OFFSET = 0;
|
|
2332
2950
|
function isCursorPaginationOptions(options) {
|
2333
2951
|
return isDefined(options) && (isDefined(options.start) || isDefined(options.end) || isDefined(options.after) || isDefined(options.before));
|
2334
2952
|
}
|
2335
|
-
const _RecordArray = class extends Array {
|
2953
|
+
const _RecordArray = class _RecordArray extends Array {
|
2336
2954
|
constructor(...args) {
|
2337
2955
|
super(..._RecordArray.parseConstructorParams(...args));
|
2338
2956
|
__privateAdd$6(this, _page, void 0);
|
@@ -2360,29 +2978,58 @@ const _RecordArray = class extends Array {
|
|
2360
2978
|
map(callbackfn, thisArg) {
|
2361
2979
|
return this.toArray().map(callbackfn, thisArg);
|
2362
2980
|
}
|
2981
|
+
/**
|
2982
|
+
* Retrieve next page of records
|
2983
|
+
*
|
2984
|
+
* @returns A new array of objects
|
2985
|
+
*/
|
2363
2986
|
async nextPage(size, offset) {
|
2364
2987
|
const newPage = await __privateGet$6(this, _page).nextPage(size, offset);
|
2365
2988
|
return new _RecordArray(newPage);
|
2366
2989
|
}
|
2990
|
+
/**
|
2991
|
+
* Retrieve previous page of records
|
2992
|
+
*
|
2993
|
+
* @returns A new array of objects
|
2994
|
+
*/
|
2367
2995
|
async previousPage(size, offset) {
|
2368
2996
|
const newPage = await __privateGet$6(this, _page).previousPage(size, offset);
|
2369
2997
|
return new _RecordArray(newPage);
|
2370
2998
|
}
|
2999
|
+
/**
|
3000
|
+
* Retrieve start page of records
|
3001
|
+
*
|
3002
|
+
* @returns A new array of objects
|
3003
|
+
*/
|
2371
3004
|
async startPage(size, offset) {
|
2372
3005
|
const newPage = await __privateGet$6(this, _page).startPage(size, offset);
|
2373
3006
|
return new _RecordArray(newPage);
|
2374
3007
|
}
|
3008
|
+
/**
|
3009
|
+
* Retrieve end page of records
|
3010
|
+
*
|
3011
|
+
* @returns A new array of objects
|
3012
|
+
*/
|
2375
3013
|
async endPage(size, offset) {
|
2376
3014
|
const newPage = await __privateGet$6(this, _page).endPage(size, offset);
|
2377
3015
|
return new _RecordArray(newPage);
|
2378
3016
|
}
|
3017
|
+
/**
|
3018
|
+
* @returns Boolean indicating if there is a next page
|
3019
|
+
*/
|
2379
3020
|
hasNextPage() {
|
2380
3021
|
return __privateGet$6(this, _page).meta.page.more;
|
2381
3022
|
}
|
2382
3023
|
};
|
2383
|
-
let RecordArray = _RecordArray;
|
2384
3024
|
_page = new WeakMap();
|
3025
|
+
let RecordArray = _RecordArray;
|
2385
3026
|
|
3027
|
+
var __defProp$4 = Object.defineProperty;
|
3028
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
3029
|
+
var __publicField$4 = (obj, key, value) => {
|
3030
|
+
__defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
3031
|
+
return value;
|
3032
|
+
};
|
2386
3033
|
var __accessCheck$5 = (obj, member, msg) => {
|
2387
3034
|
if (!member.has(obj))
|
2388
3035
|
throw TypeError("Cannot " + msg);
|
@@ -2406,14 +3053,15 @@ var __privateMethod$3 = (obj, member, method) => {
|
|
2406
3053
|
return method;
|
2407
3054
|
};
|
2408
3055
|
var _table$1, _repository, _data, _cleanFilterConstraint, cleanFilterConstraint_fn;
|
2409
|
-
const _Query = class {
|
3056
|
+
const _Query = class _Query {
|
2410
3057
|
constructor(repository, table, data, rawParent) {
|
2411
3058
|
__privateAdd$5(this, _cleanFilterConstraint);
|
2412
3059
|
__privateAdd$5(this, _table$1, void 0);
|
2413
3060
|
__privateAdd$5(this, _repository, void 0);
|
2414
3061
|
__privateAdd$5(this, _data, { filter: {} });
|
2415
|
-
|
2416
|
-
this
|
3062
|
+
// Implements pagination
|
3063
|
+
__publicField$4(this, "meta", { page: { cursor: "start", more: true, size: PAGINATION_DEFAULT_SIZE } });
|
3064
|
+
__publicField$4(this, "records", new RecordArray(this, []));
|
2417
3065
|
__privateSet$5(this, _table$1, table);
|
2418
3066
|
if (repository) {
|
2419
3067
|
__privateSet$5(this, _repository, repository);
|
@@ -2449,18 +3097,38 @@ const _Query = class {
|
|
2449
3097
|
const key = JSON.stringify({ columns, filter, sort, pagination });
|
2450
3098
|
return toBase64(key);
|
2451
3099
|
}
|
3100
|
+
/**
|
3101
|
+
* Builds a new query object representing a logical OR between the given subqueries.
|
3102
|
+
* @param queries An array of subqueries.
|
3103
|
+
* @returns A new Query object.
|
3104
|
+
*/
|
2452
3105
|
any(...queries) {
|
2453
3106
|
const $any = queries.map((query) => query.getQueryOptions().filter ?? {});
|
2454
3107
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $any } }, __privateGet$5(this, _data));
|
2455
3108
|
}
|
3109
|
+
/**
|
3110
|
+
* Builds a new query object representing a logical AND between the given subqueries.
|
3111
|
+
* @param queries An array of subqueries.
|
3112
|
+
* @returns A new Query object.
|
3113
|
+
*/
|
2456
3114
|
all(...queries) {
|
2457
3115
|
const $all = queries.map((query) => query.getQueryOptions().filter ?? {});
|
2458
3116
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
|
2459
3117
|
}
|
3118
|
+
/**
|
3119
|
+
* Builds a new query object representing a logical OR negating each subquery. In pseudo-code: !q1 OR !q2
|
3120
|
+
* @param queries An array of subqueries.
|
3121
|
+
* @returns A new Query object.
|
3122
|
+
*/
|
2460
3123
|
not(...queries) {
|
2461
3124
|
const $not = queries.map((query) => query.getQueryOptions().filter ?? {});
|
2462
3125
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $not } }, __privateGet$5(this, _data));
|
2463
3126
|
}
|
3127
|
+
/**
|
3128
|
+
* Builds a new query object representing a logical AND negating each subquery. In pseudo-code: !q1 AND !q2
|
3129
|
+
* @param queries An array of subqueries.
|
3130
|
+
* @returns A new Query object.
|
3131
|
+
*/
|
2464
3132
|
none(...queries) {
|
2465
3133
|
const $none = queries.map((query) => query.getQueryOptions().filter ?? {});
|
2466
3134
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $none } }, __privateGet$5(this, _data));
|
@@ -2483,6 +3151,11 @@ const _Query = class {
|
|
2483
3151
|
const sort = [...originalSort, { column, direction }];
|
2484
3152
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { sort }, __privateGet$5(this, _data));
|
2485
3153
|
}
|
3154
|
+
/**
|
3155
|
+
* Builds a new query specifying the set of columns to be returned in the query response.
|
3156
|
+
* @param columns Array of column names to be returned by the query.
|
3157
|
+
* @returns A new Query object.
|
3158
|
+
*/
|
2486
3159
|
select(columns) {
|
2487
3160
|
return new _Query(
|
2488
3161
|
__privateGet$5(this, _repository),
|
@@ -2495,6 +3168,12 @@ const _Query = class {
|
|
2495
3168
|
const query = new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), options, __privateGet$5(this, _data));
|
2496
3169
|
return __privateGet$5(this, _repository).query(query);
|
2497
3170
|
}
|
3171
|
+
/**
|
3172
|
+
* Get results in an iterator
|
3173
|
+
*
|
3174
|
+
* @async
|
3175
|
+
* @returns Async interable of results
|
3176
|
+
*/
|
2498
3177
|
async *[Symbol.asyncIterator]() {
|
2499
3178
|
for await (const [record] of this.getIterator({ batchSize: 1 })) {
|
2500
3179
|
yield record;
|
@@ -2555,26 +3234,53 @@ const _Query = class {
|
|
2555
3234
|
);
|
2556
3235
|
return __privateGet$5(this, _repository).summarizeTable(query, summaries, summariesFilter);
|
2557
3236
|
}
|
3237
|
+
/**
|
3238
|
+
* Builds a new query object adding a cache TTL in milliseconds.
|
3239
|
+
* @param ttl The cache TTL in milliseconds.
|
3240
|
+
* @returns A new Query object.
|
3241
|
+
*/
|
2558
3242
|
cache(ttl) {
|
2559
3243
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { cache: ttl }, __privateGet$5(this, _data));
|
2560
3244
|
}
|
3245
|
+
/**
|
3246
|
+
* Retrieve next page of records
|
3247
|
+
*
|
3248
|
+
* @returns A new page object.
|
3249
|
+
*/
|
2561
3250
|
nextPage(size, offset) {
|
2562
3251
|
return this.startPage(size, offset);
|
2563
3252
|
}
|
3253
|
+
/**
|
3254
|
+
* Retrieve previous page of records
|
3255
|
+
*
|
3256
|
+
* @returns A new page object
|
3257
|
+
*/
|
2564
3258
|
previousPage(size, offset) {
|
2565
3259
|
return this.startPage(size, offset);
|
2566
3260
|
}
|
3261
|
+
/**
|
3262
|
+
* Retrieve start page of records
|
3263
|
+
*
|
3264
|
+
* @returns A new page object
|
3265
|
+
*/
|
2567
3266
|
startPage(size, offset) {
|
2568
3267
|
return this.getPaginated({ pagination: { size, offset } });
|
2569
3268
|
}
|
3269
|
+
/**
|
3270
|
+
* Retrieve last page of records
|
3271
|
+
*
|
3272
|
+
* @returns A new page object
|
3273
|
+
*/
|
2570
3274
|
endPage(size, offset) {
|
2571
3275
|
return this.getPaginated({ pagination: { size, offset, before: "end" } });
|
2572
3276
|
}
|
3277
|
+
/**
|
3278
|
+
* @returns Boolean indicating if there is a next page
|
3279
|
+
*/
|
2573
3280
|
hasNextPage() {
|
2574
3281
|
return this.meta.page.more;
|
2575
3282
|
}
|
2576
3283
|
};
|
2577
|
-
let Query = _Query;
|
2578
3284
|
_table$1 = new WeakMap();
|
2579
3285
|
_repository = new WeakMap();
|
2580
3286
|
_data = new WeakMap();
|
@@ -2589,6 +3295,7 @@ cleanFilterConstraint_fn = function(column, value) {
|
|
2589
3295
|
}
|
2590
3296
|
return value;
|
2591
3297
|
};
|
3298
|
+
let Query = _Query;
|
2592
3299
|
function cleanParent(data, parent) {
|
2593
3300
|
if (isCursorPaginationOptions(data.pagination)) {
|
2594
3301
|
return { ...parent, sort: void 0, filter: void 0 };
|
@@ -2596,6 +3303,22 @@ function cleanParent(data, parent) {
|
|
2596
3303
|
return parent;
|
2597
3304
|
}
|
2598
3305
|
|
3306
|
+
const RecordColumnTypes = [
|
3307
|
+
"bool",
|
3308
|
+
"int",
|
3309
|
+
"float",
|
3310
|
+
"string",
|
3311
|
+
"text",
|
3312
|
+
"email",
|
3313
|
+
"multiple",
|
3314
|
+
"link",
|
3315
|
+
"object",
|
3316
|
+
"datetime",
|
3317
|
+
"vector",
|
3318
|
+
"file[]",
|
3319
|
+
"file",
|
3320
|
+
"json"
|
3321
|
+
];
|
2599
3322
|
function isIdentifiable(x) {
|
2600
3323
|
return isObject(x) && isString(x?.id);
|
2601
3324
|
}
|
@@ -2609,7 +3332,11 @@ function isSortFilterString(value) {
|
|
2609
3332
|
return isString(value);
|
2610
3333
|
}
|
2611
3334
|
function isSortFilterBase(filter) {
|
2612
|
-
return isObject(filter) && Object.
|
3335
|
+
return isObject(filter) && Object.entries(filter).every(([key, value]) => {
|
3336
|
+
if (key === "*")
|
3337
|
+
return value === "random";
|
3338
|
+
return value === "asc" || value === "desc";
|
3339
|
+
});
|
2613
3340
|
}
|
2614
3341
|
function isSortFilterObject(filter) {
|
2615
3342
|
return isObject(filter) && !isSortFilterBase(filter) && filter.column !== void 0;
|
@@ -2650,7 +3377,7 @@ var __privateMethod$2 = (obj, member, method) => {
|
|
2650
3377
|
__accessCheck$4(obj, member, "access private method");
|
2651
3378
|
return method;
|
2652
3379
|
};
|
2653
|
-
var _table, _getFetchProps, _db, _cache, _schemaTables$2, _trace, _insertRecordWithoutId, insertRecordWithoutId_fn, _insertRecordWithId, insertRecordWithId_fn, _insertRecords, insertRecords_fn, _updateRecordWithID, updateRecordWithID_fn, _updateRecords, updateRecords_fn, _upsertRecordWithID, upsertRecordWithID_fn, _deleteRecord, deleteRecord_fn, _deleteRecords, deleteRecords_fn, _setCacheQuery, setCacheQuery_fn, _getCacheQuery, getCacheQuery_fn, _getSchemaTables$1, getSchemaTables_fn$1;
|
3380
|
+
var _table, _getFetchProps, _db, _cache, _schemaTables$2, _trace, _insertRecordWithoutId, insertRecordWithoutId_fn, _insertRecordWithId, insertRecordWithId_fn, _insertRecords, insertRecords_fn, _updateRecordWithID, updateRecordWithID_fn, _updateRecords, updateRecords_fn, _upsertRecordWithID, upsertRecordWithID_fn, _deleteRecord, deleteRecord_fn, _deleteRecords, deleteRecords_fn, _setCacheQuery, setCacheQuery_fn, _getCacheQuery, getCacheQuery_fn, _getSchemaTables$1, getSchemaTables_fn$1, _transformObjectToApi, transformObjectToApi_fn;
|
2654
3381
|
const BULK_OPERATION_MAX_SIZE = 1e3;
|
2655
3382
|
class Repository extends Query {
|
2656
3383
|
}
|
@@ -2672,6 +3399,7 @@ class RestRepository extends Query {
|
|
2672
3399
|
__privateAdd$4(this, _setCacheQuery);
|
2673
3400
|
__privateAdd$4(this, _getCacheQuery);
|
2674
3401
|
__privateAdd$4(this, _getSchemaTables$1);
|
3402
|
+
__privateAdd$4(this, _transformObjectToApi);
|
2675
3403
|
__privateAdd$4(this, _table, void 0);
|
2676
3404
|
__privateAdd$4(this, _getFetchProps, void 0);
|
2677
3405
|
__privateAdd$4(this, _db, void 0);
|
@@ -2849,12 +3577,22 @@ class RestRepository extends Query {
|
|
2849
3577
|
return result;
|
2850
3578
|
}
|
2851
3579
|
if (isString(a) && isObject(b)) {
|
3580
|
+
if (a === "")
|
3581
|
+
throw new Error("The id can't be empty");
|
2852
3582
|
const columns = isStringArray(c) ? c : void 0;
|
2853
|
-
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
3583
|
+
return await __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
2854
3584
|
}
|
2855
3585
|
if (isObject(a) && isString(a.id)) {
|
3586
|
+
if (a.id === "")
|
3587
|
+
throw new Error("The id can't be empty");
|
2856
3588
|
const columns = isStringArray(c) ? c : void 0;
|
2857
|
-
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
3589
|
+
return await __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
3590
|
+
}
|
3591
|
+
if (!isDefined(a) && isObject(b)) {
|
3592
|
+
return await this.create(b, c);
|
3593
|
+
}
|
3594
|
+
if (isObject(a) && !isDefined(a.id)) {
|
3595
|
+
return await this.create(a, b);
|
2858
3596
|
}
|
2859
3597
|
throw new Error("Invalid arguments for createOrUpdate method");
|
2860
3598
|
});
|
@@ -2871,12 +3609,22 @@ class RestRepository extends Query {
|
|
2871
3609
|
return result;
|
2872
3610
|
}
|
2873
3611
|
if (isString(a) && isObject(b)) {
|
3612
|
+
if (a === "")
|
3613
|
+
throw new Error("The id can't be empty");
|
2874
3614
|
const columns = isStringArray(c) ? c : void 0;
|
2875
|
-
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: false, ifVersion });
|
3615
|
+
return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: false, ifVersion });
|
2876
3616
|
}
|
2877
3617
|
if (isObject(a) && isString(a.id)) {
|
3618
|
+
if (a.id === "")
|
3619
|
+
throw new Error("The id can't be empty");
|
2878
3620
|
const columns = isStringArray(c) ? c : void 0;
|
2879
|
-
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: false, ifVersion });
|
3621
|
+
return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: false, ifVersion });
|
3622
|
+
}
|
3623
|
+
if (!isDefined(a) && isObject(b)) {
|
3624
|
+
return await this.create(b, c);
|
3625
|
+
}
|
3626
|
+
if (isObject(a) && !isDefined(a.id)) {
|
3627
|
+
return await this.create(a, b);
|
2880
3628
|
}
|
2881
3629
|
throw new Error("Invalid arguments for createOrReplace method");
|
2882
3630
|
});
|
@@ -3043,23 +3791,28 @@ class RestRepository extends Query {
|
|
3043
3791
|
});
|
3044
3792
|
}
|
3045
3793
|
ask(question, options) {
|
3794
|
+
const questionParam = options?.sessionId ? { message: question } : { question };
|
3046
3795
|
const params = {
|
3047
3796
|
pathParams: {
|
3048
3797
|
workspace: "{workspaceId}",
|
3049
3798
|
dbBranchName: "{dbBranch}",
|
3050
3799
|
region: "{region}",
|
3051
|
-
tableName: __privateGet$4(this, _table)
|
3800
|
+
tableName: __privateGet$4(this, _table),
|
3801
|
+
sessionId: options?.sessionId
|
3052
3802
|
},
|
3053
3803
|
body: {
|
3054
|
-
|
3055
|
-
|
3804
|
+
...questionParam,
|
3805
|
+
rules: options?.rules,
|
3806
|
+
searchType: options?.searchType,
|
3807
|
+
search: options?.searchType === "keyword" ? options?.search : void 0,
|
3808
|
+
vectorSearch: options?.searchType === "vector" ? options?.vectorSearch : void 0
|
3056
3809
|
},
|
3057
3810
|
...__privateGet$4(this, _getFetchProps).call(this)
|
3058
3811
|
};
|
3059
3812
|
if (options?.onMessage) {
|
3060
3813
|
fetchSSERequest({
|
3061
3814
|
endpoint: "dataPlane",
|
3062
|
-
url: "/db/{dbBranchName}/tables/{tableName}/ask",
|
3815
|
+
url: "/db/{dbBranchName}/tables/{tableName}/ask/{sessionId}",
|
3063
3816
|
method: "POST",
|
3064
3817
|
onMessage: (message) => {
|
3065
3818
|
options.onMessage?.({ answer: message.text, records: message.records });
|
@@ -3067,7 +3820,7 @@ class RestRepository extends Query {
|
|
3067
3820
|
...params
|
3068
3821
|
});
|
3069
3822
|
} else {
|
3070
|
-
return
|
3823
|
+
return askTableSession(params);
|
3071
3824
|
}
|
3072
3825
|
}
|
3073
3826
|
}
|
@@ -3079,7 +3832,7 @@ _schemaTables$2 = new WeakMap();
|
|
3079
3832
|
_trace = new WeakMap();
|
3080
3833
|
_insertRecordWithoutId = new WeakSet();
|
3081
3834
|
insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
3082
|
-
const record =
|
3835
|
+
const record = await __privateMethod$2(this, _transformObjectToApi, transformObjectToApi_fn).call(this, object);
|
3083
3836
|
const response = await insertRecord({
|
3084
3837
|
pathParams: {
|
3085
3838
|
workspace: "{workspaceId}",
|
@@ -3096,7 +3849,9 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
|
3096
3849
|
};
|
3097
3850
|
_insertRecordWithId = new WeakSet();
|
3098
3851
|
insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { createOnly, ifVersion }) {
|
3099
|
-
|
3852
|
+
if (!recordId)
|
3853
|
+
return null;
|
3854
|
+
const record = await __privateMethod$2(this, _transformObjectToApi, transformObjectToApi_fn).call(this, object);
|
3100
3855
|
const response = await insertRecordWithID({
|
3101
3856
|
pathParams: {
|
3102
3857
|
workspace: "{workspaceId}",
|
@@ -3114,21 +3869,20 @@ insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { crea
|
|
3114
3869
|
};
|
3115
3870
|
_insertRecords = new WeakSet();
|
3116
3871
|
insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
|
3117
|
-
const
|
3118
|
-
|
3119
|
-
|
3120
|
-
|
3121
|
-
|
3122
|
-
);
|
3872
|
+
const operations = await promiseMap(objects, async (object) => {
|
3873
|
+
const record = await __privateMethod$2(this, _transformObjectToApi, transformObjectToApi_fn).call(this, object);
|
3874
|
+
return { insert: { table: __privateGet$4(this, _table), record, createOnly, ifVersion } };
|
3875
|
+
});
|
3876
|
+
const chunkedOperations = chunk(operations, BULK_OPERATION_MAX_SIZE);
|
3123
3877
|
const ids = [];
|
3124
|
-
for (const
|
3878
|
+
for (const operations2 of chunkedOperations) {
|
3125
3879
|
const { results } = await branchTransaction({
|
3126
3880
|
pathParams: {
|
3127
3881
|
workspace: "{workspaceId}",
|
3128
3882
|
dbBranchName: "{dbBranch}",
|
3129
3883
|
region: "{region}"
|
3130
3884
|
},
|
3131
|
-
body: { operations },
|
3885
|
+
body: { operations: operations2 },
|
3132
3886
|
...__privateGet$4(this, _getFetchProps).call(this)
|
3133
3887
|
});
|
3134
3888
|
for (const result of results) {
|
@@ -3143,7 +3897,9 @@ insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
|
|
3143
3897
|
};
|
3144
3898
|
_updateRecordWithID = new WeakSet();
|
3145
3899
|
updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
3146
|
-
|
3900
|
+
if (!recordId)
|
3901
|
+
return null;
|
3902
|
+
const { id: _id, ...record } = await __privateMethod$2(this, _transformObjectToApi, transformObjectToApi_fn).call(this, object);
|
3147
3903
|
try {
|
3148
3904
|
const response = await updateRecordWithID({
|
3149
3905
|
pathParams: {
|
@@ -3168,21 +3924,20 @@ updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
|
|
3168
3924
|
};
|
3169
3925
|
_updateRecords = new WeakSet();
|
3170
3926
|
updateRecords_fn = async function(objects, { ifVersion, upsert }) {
|
3171
|
-
const
|
3172
|
-
|
3173
|
-
|
3174
|
-
|
3175
|
-
|
3176
|
-
);
|
3927
|
+
const operations = await promiseMap(objects, async ({ id, ...object }) => {
|
3928
|
+
const fields = await __privateMethod$2(this, _transformObjectToApi, transformObjectToApi_fn).call(this, object);
|
3929
|
+
return { update: { table: __privateGet$4(this, _table), id, ifVersion, upsert, fields } };
|
3930
|
+
});
|
3931
|
+
const chunkedOperations = chunk(operations, BULK_OPERATION_MAX_SIZE);
|
3177
3932
|
const ids = [];
|
3178
|
-
for (const
|
3933
|
+
for (const operations2 of chunkedOperations) {
|
3179
3934
|
const { results } = await branchTransaction({
|
3180
3935
|
pathParams: {
|
3181
3936
|
workspace: "{workspaceId}",
|
3182
3937
|
dbBranchName: "{dbBranch}",
|
3183
3938
|
region: "{region}"
|
3184
3939
|
},
|
3185
|
-
body: { operations },
|
3940
|
+
body: { operations: operations2 },
|
3186
3941
|
...__privateGet$4(this, _getFetchProps).call(this)
|
3187
3942
|
});
|
3188
3943
|
for (const result of results) {
|
@@ -3197,6 +3952,8 @@ updateRecords_fn = async function(objects, { ifVersion, upsert }) {
|
|
3197
3952
|
};
|
3198
3953
|
_upsertRecordWithID = new WeakSet();
|
3199
3954
|
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
3955
|
+
if (!recordId)
|
3956
|
+
return null;
|
3200
3957
|
const response = await upsertRecordWithID({
|
3201
3958
|
pathParams: {
|
3202
3959
|
workspace: "{workspaceId}",
|
@@ -3214,6 +3971,8 @@ upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
|
|
3214
3971
|
};
|
3215
3972
|
_deleteRecord = new WeakSet();
|
3216
3973
|
deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
3974
|
+
if (!recordId)
|
3975
|
+
return null;
|
3217
3976
|
try {
|
3218
3977
|
const response = await deleteRecord({
|
3219
3978
|
pathParams: {
|
@@ -3238,7 +3997,7 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
|
3238
3997
|
_deleteRecords = new WeakSet();
|
3239
3998
|
deleteRecords_fn = async function(recordIds) {
|
3240
3999
|
const chunkedOperations = chunk(
|
3241
|
-
recordIds.map((id) => ({ delete: { table: __privateGet$4(this, _table), id } })),
|
4000
|
+
compact(recordIds).map((id) => ({ delete: { table: __privateGet$4(this, _table), id } })),
|
3242
4001
|
BULK_OPERATION_MAX_SIZE
|
3243
4002
|
);
|
3244
4003
|
for (const operations of chunkedOperations) {
|
@@ -3255,7 +4014,7 @@ deleteRecords_fn = async function(recordIds) {
|
|
3255
4014
|
};
|
3256
4015
|
_setCacheQuery = new WeakSet();
|
3257
4016
|
setCacheQuery_fn = async function(query, meta, records) {
|
3258
|
-
await __privateGet$4(this, _cache)?.set(`query_${__privateGet$4(this, _table)}:${query.key()}`, { date: new Date(), meta, records });
|
4017
|
+
await __privateGet$4(this, _cache)?.set(`query_${__privateGet$4(this, _table)}:${query.key()}`, { date: /* @__PURE__ */ new Date(), meta, records });
|
3259
4018
|
};
|
3260
4019
|
_getCacheQuery = new WeakSet();
|
3261
4020
|
getCacheQuery_fn = async function(query) {
|
@@ -3281,7 +4040,39 @@ getSchemaTables_fn$1 = async function() {
|
|
3281
4040
|
__privateSet$4(this, _schemaTables$2, schema.tables);
|
3282
4041
|
return schema.tables;
|
3283
4042
|
};
|
3284
|
-
|
4043
|
+
_transformObjectToApi = new WeakSet();
|
4044
|
+
transformObjectToApi_fn = async function(object) {
|
4045
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
4046
|
+
const schema = schemaTables.find((table) => table.name === __privateGet$4(this, _table));
|
4047
|
+
if (!schema)
|
4048
|
+
throw new Error(`Table ${__privateGet$4(this, _table)} not found in schema`);
|
4049
|
+
const result = {};
|
4050
|
+
for (const [key, value] of Object.entries(object)) {
|
4051
|
+
if (key === "xata")
|
4052
|
+
continue;
|
4053
|
+
const type = schema.columns.find((column) => column.name === key)?.type;
|
4054
|
+
switch (type) {
|
4055
|
+
case "link": {
|
4056
|
+
result[key] = isIdentifiable(value) ? value.id : value;
|
4057
|
+
break;
|
4058
|
+
}
|
4059
|
+
case "datetime": {
|
4060
|
+
result[key] = value instanceof Date ? value.toISOString() : value;
|
4061
|
+
break;
|
4062
|
+
}
|
4063
|
+
case `file`:
|
4064
|
+
result[key] = await parseInputFileEntry(value);
|
4065
|
+
break;
|
4066
|
+
case "file[]":
|
4067
|
+
result[key] = await promiseMap(value, (item) => parseInputFileEntry(item));
|
4068
|
+
break;
|
4069
|
+
default:
|
4070
|
+
result[key] = value;
|
4071
|
+
}
|
4072
|
+
}
|
4073
|
+
return result;
|
4074
|
+
};
|
4075
|
+
const removeLinksFromObject = (object) => {
|
3285
4076
|
return Object.entries(object).reduce((acc, [key, value]) => {
|
3286
4077
|
if (key === "xata")
|
3287
4078
|
return acc;
|
@@ -3330,6 +4121,12 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
|
3330
4121
|
}
|
3331
4122
|
break;
|
3332
4123
|
}
|
4124
|
+
case "file":
|
4125
|
+
data[column.name] = isDefined(value) ? new XataFile(value) : null;
|
4126
|
+
break;
|
4127
|
+
case "file[]":
|
4128
|
+
data[column.name] = value?.map((item) => new XataFile(item)) ?? null;
|
4129
|
+
break;
|
3333
4130
|
default:
|
3334
4131
|
data[column.name] = value ?? null;
|
3335
4132
|
if (column.notNull === true && value === null) {
|
@@ -3339,6 +4136,8 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
|
3339
4136
|
}
|
3340
4137
|
}
|
3341
4138
|
const record = { ...data };
|
4139
|
+
const serializable = { xata, ...removeLinksFromObject(data) };
|
4140
|
+
const metadata = xata !== void 0 ? { ...xata, createdAt: new Date(xata.createdAt), updatedAt: new Date(xata.updatedAt) } : void 0;
|
3342
4141
|
record.read = function(columns2) {
|
3343
4142
|
return db[table].read(record["id"], columns2);
|
3344
4143
|
};
|
@@ -3355,14 +4154,15 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
|
3355
4154
|
record.delete = function() {
|
3356
4155
|
return db[table].delete(record["id"]);
|
3357
4156
|
};
|
4157
|
+
record.xata = Object.freeze(metadata);
|
3358
4158
|
record.getMetadata = function() {
|
3359
|
-
return xata;
|
4159
|
+
return record.xata;
|
3360
4160
|
};
|
3361
4161
|
record.toSerializable = function() {
|
3362
|
-
return JSON.parse(JSON.stringify(
|
4162
|
+
return JSON.parse(JSON.stringify(serializable));
|
3363
4163
|
};
|
3364
4164
|
record.toString = function() {
|
3365
|
-
return JSON.stringify(
|
4165
|
+
return JSON.stringify(serializable);
|
3366
4166
|
};
|
3367
4167
|
for (const prop of ["read", "update", "replace", "delete", "getMetadata", "toSerializable", "toString"]) {
|
3368
4168
|
Object.defineProperty(record, prop, { enumerable: false });
|
@@ -3380,11 +4180,7 @@ function extractId(value) {
|
|
3380
4180
|
function isValidColumn(columns, column) {
|
3381
4181
|
if (columns.includes("*"))
|
3382
4182
|
return true;
|
3383
|
-
|
3384
|
-
const linkColumns = columns.filter((item) => item.startsWith(column.name));
|
3385
|
-
return linkColumns.length > 0;
|
3386
|
-
}
|
3387
|
-
return columns.includes(column.name);
|
4183
|
+
return columns.filter((item) => item.startsWith(column.name)).length > 0;
|
3388
4184
|
}
|
3389
4185
|
function parseIfVersion(...args) {
|
3390
4186
|
for (const arg of args) {
|
@@ -3395,6 +4191,12 @@ function parseIfVersion(...args) {
|
|
3395
4191
|
return void 0;
|
3396
4192
|
}
|
3397
4193
|
|
4194
|
+
var __defProp$3 = Object.defineProperty;
|
4195
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
4196
|
+
var __publicField$3 = (obj, key, value) => {
|
4197
|
+
__defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
4198
|
+
return value;
|
4199
|
+
};
|
3398
4200
|
var __accessCheck$3 = (obj, member, msg) => {
|
3399
4201
|
if (!member.has(obj))
|
3400
4202
|
throw TypeError("Cannot " + msg);
|
@@ -3417,6 +4219,8 @@ var _map;
|
|
3417
4219
|
class SimpleCache {
|
3418
4220
|
constructor(options = {}) {
|
3419
4221
|
__privateAdd$3(this, _map, void 0);
|
4222
|
+
__publicField$3(this, "capacity");
|
4223
|
+
__publicField$3(this, "defaultQueryTTL");
|
3420
4224
|
__privateSet$3(this, _map, /* @__PURE__ */ new Map());
|
3421
4225
|
this.capacity = options.max ?? 500;
|
3422
4226
|
this.defaultQueryTTL = options.defaultQueryTTL ?? 60 * 1e3;
|
@@ -3581,6 +4385,7 @@ search_fn = async function(query, options, pluginOptions) {
|
|
3581
4385
|
const { tables, fuzziness, highlight, prefix, page } = options ?? {};
|
3582
4386
|
const { records } = await searchBranch({
|
3583
4387
|
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
4388
|
+
// @ts-ignore https://github.com/xataio/client-ts/issues/313
|
3584
4389
|
body: { tables, query, fuzziness, prefix, highlight, page },
|
3585
4390
|
...pluginOptions
|
3586
4391
|
});
|
@@ -3598,6 +4403,78 @@ getSchemaTables_fn = async function(pluginOptions) {
|
|
3598
4403
|
return schema.tables;
|
3599
4404
|
};
|
3600
4405
|
|
4406
|
+
function escapeElement(elementRepresentation) {
|
4407
|
+
const escaped = elementRepresentation.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
4408
|
+
return '"' + escaped + '"';
|
4409
|
+
}
|
4410
|
+
function arrayString(val) {
|
4411
|
+
let result = "{";
|
4412
|
+
for (let i = 0; i < val.length; i++) {
|
4413
|
+
if (i > 0) {
|
4414
|
+
result = result + ",";
|
4415
|
+
}
|
4416
|
+
if (val[i] === null || typeof val[i] === "undefined") {
|
4417
|
+
result = result + "NULL";
|
4418
|
+
} else if (Array.isArray(val[i])) {
|
4419
|
+
result = result + arrayString(val[i]);
|
4420
|
+
} else if (val[i] instanceof Buffer) {
|
4421
|
+
result += "\\\\x" + val[i].toString("hex");
|
4422
|
+
} else {
|
4423
|
+
result += escapeElement(prepareValue(val[i]));
|
4424
|
+
}
|
4425
|
+
}
|
4426
|
+
result = result + "}";
|
4427
|
+
return result;
|
4428
|
+
}
|
4429
|
+
function prepareValue(value) {
|
4430
|
+
if (!isDefined(value))
|
4431
|
+
return null;
|
4432
|
+
if (value instanceof Date) {
|
4433
|
+
return value.toISOString();
|
4434
|
+
}
|
4435
|
+
if (Array.isArray(value)) {
|
4436
|
+
return arrayString(value);
|
4437
|
+
}
|
4438
|
+
if (isObject(value)) {
|
4439
|
+
return JSON.stringify(value);
|
4440
|
+
}
|
4441
|
+
try {
|
4442
|
+
return value.toString();
|
4443
|
+
} catch (e) {
|
4444
|
+
return value;
|
4445
|
+
}
|
4446
|
+
}
|
4447
|
+
function prepareParams(param1, param2) {
|
4448
|
+
if (isString(param1)) {
|
4449
|
+
return { statement: param1, params: param2?.map((value) => prepareValue(value)) };
|
4450
|
+
}
|
4451
|
+
if (isStringArray(param1)) {
|
4452
|
+
const statement = param1.reduce((acc, curr, index) => {
|
4453
|
+
return acc + curr + (index < (param2?.length ?? 0) ? "$" + (index + 1) : "");
|
4454
|
+
}, "");
|
4455
|
+
return { statement, params: param2?.map((value) => prepareValue(value)) };
|
4456
|
+
}
|
4457
|
+
if (isObject(param1)) {
|
4458
|
+
const { statement, params, consistency } = param1;
|
4459
|
+
return { statement, params: params?.map((value) => prepareValue(value)), consistency };
|
4460
|
+
}
|
4461
|
+
throw new Error("Invalid query");
|
4462
|
+
}
|
4463
|
+
|
4464
|
+
class SQLPlugin extends XataPlugin {
|
4465
|
+
build(pluginOptions) {
|
4466
|
+
return async (param1, ...param2) => {
|
4467
|
+
const { statement, params, consistency } = prepareParams(param1, param2);
|
4468
|
+
const { records, warning } = await sqlQuery({
|
4469
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
4470
|
+
body: { statement, params, consistency },
|
4471
|
+
...pluginOptions
|
4472
|
+
});
|
4473
|
+
return { records, warning };
|
4474
|
+
};
|
4475
|
+
}
|
4476
|
+
}
|
4477
|
+
|
3601
4478
|
class TransactionPlugin extends XataPlugin {
|
3602
4479
|
build(pluginOptions) {
|
3603
4480
|
return {
|
@@ -3613,6 +4490,12 @@ class TransactionPlugin extends XataPlugin {
|
|
3613
4490
|
}
|
3614
4491
|
}
|
3615
4492
|
|
4493
|
+
var __defProp$2 = Object.defineProperty;
|
4494
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
4495
|
+
var __publicField$2 = (obj, key, value) => {
|
4496
|
+
__defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
4497
|
+
return value;
|
4498
|
+
};
|
3616
4499
|
var __accessCheck = (obj, member, msg) => {
|
3617
4500
|
if (!member.has(obj))
|
3618
4501
|
throw TypeError("Cannot " + msg);
|
@@ -3642,6 +4525,11 @@ const buildClient = (plugins) => {
|
|
3642
4525
|
__privateAdd(this, _parseOptions);
|
3643
4526
|
__privateAdd(this, _getFetchProps);
|
3644
4527
|
__privateAdd(this, _options, void 0);
|
4528
|
+
__publicField$2(this, "db");
|
4529
|
+
__publicField$2(this, "search");
|
4530
|
+
__publicField$2(this, "transactions");
|
4531
|
+
__publicField$2(this, "sql");
|
4532
|
+
__publicField$2(this, "files");
|
3645
4533
|
const safeOptions = __privateMethod(this, _parseOptions, parseOptions_fn).call(this, options);
|
3646
4534
|
__privateSet(this, _options, safeOptions);
|
3647
4535
|
const pluginOptions = {
|
@@ -3652,9 +4540,13 @@ const buildClient = (plugins) => {
|
|
3652
4540
|
const db = new SchemaPlugin(schemaTables).build(pluginOptions);
|
3653
4541
|
const search = new SearchPlugin(db, schemaTables).build(pluginOptions);
|
3654
4542
|
const transactions = new TransactionPlugin().build(pluginOptions);
|
4543
|
+
const sql = new SQLPlugin().build(pluginOptions);
|
4544
|
+
const files = new FilesPlugin().build(pluginOptions);
|
3655
4545
|
this.db = db;
|
3656
4546
|
this.search = search;
|
3657
4547
|
this.transactions = transactions;
|
4548
|
+
this.sql = sql;
|
4549
|
+
this.files = files;
|
3658
4550
|
for (const [key, namespace] of Object.entries(plugins ?? {})) {
|
3659
4551
|
if (namespace === void 0)
|
3660
4552
|
continue;
|
@@ -3735,6 +4627,7 @@ const buildClient = (plugins) => {
|
|
3735
4627
|
fetch,
|
3736
4628
|
apiKey,
|
3737
4629
|
apiUrl: "",
|
4630
|
+
// Instead of using workspace and dbBranch, we inject a probably CNAME'd URL
|
3738
4631
|
workspacesApiUrl: (path, params) => {
|
3739
4632
|
const hasBranch = params.dbBranchName ?? params.branch;
|
3740
4633
|
const newPath = path.replace(/^\/db\/[^/]+/, hasBranch !== void 0 ? `:${branch}` : "");
|
@@ -3750,11 +4643,17 @@ const buildClient = (plugins) => {
|
|
3750
4643
|
class BaseClient extends buildClient() {
|
3751
4644
|
}
|
3752
4645
|
|
4646
|
+
var __defProp$1 = Object.defineProperty;
|
4647
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
4648
|
+
var __publicField$1 = (obj, key, value) => {
|
4649
|
+
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
4650
|
+
return value;
|
4651
|
+
};
|
3753
4652
|
const META = "__";
|
3754
4653
|
const VALUE = "___";
|
3755
4654
|
class Serializer {
|
3756
4655
|
constructor() {
|
3757
|
-
this
|
4656
|
+
__publicField$1(this, "classes", {});
|
3758
4657
|
}
|
3759
4658
|
add(clazz) {
|
3760
4659
|
this.classes[clazz.name] = clazz;
|
@@ -3832,12 +4731,19 @@ function buildWorkerRunner(config) {
|
|
3832
4731
|
};
|
3833
4732
|
}
|
3834
4733
|
|
4734
|
+
var __defProp = Object.defineProperty;
|
4735
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
4736
|
+
var __publicField = (obj, key, value) => {
|
4737
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
4738
|
+
return value;
|
4739
|
+
};
|
3835
4740
|
class XataError extends Error {
|
3836
4741
|
constructor(message, status) {
|
3837
4742
|
super(message);
|
4743
|
+
__publicField(this, "status");
|
3838
4744
|
this.status = status;
|
3839
4745
|
}
|
3840
4746
|
}
|
3841
4747
|
|
3842
|
-
export { BaseClient, FetcherError, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Query, RecordArray, Repository, RestRepository, SchemaPlugin, SearchPlugin, Serializer, SimpleCache, XataApiClient, XataApiPlugin, XataError, XataPlugin, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, aggregateTable, applyBranchSchemaEdit, askTable, branchTransaction, buildClient, buildPreviewBranchName, buildProviderString, buildWorkerRunner, bulkInsertTableRecords, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, contains, copyBranch, createBranch, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteDatabaseGithubSettings, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranch, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchSchemaHistory, getBranchStats, getColumn, getDatabaseGithubSettings, getDatabaseList, getDatabaseMetadata, getDatabaseURL, getGitBranchesMapping, getHostUrl, getMigrationRequest, getMigrationRequestIsMerged, getPreviewBranch, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getWorkspace, getWorkspaceMembersList, getWorkspacesList, greaterEquals, greaterThan, greaterThanEquals, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isHostProviderAlias, isHostProviderBuilder, isIdentifiable, isNot, isXataRecord, le, lessEquals, lessThan, lessThanEquals, listMigrationRequestsCommits, listRegions, lt, lte, mergeMigrationRequest, notExists, operationsByTag, parseProviderString, parseWorkspacesUrlParts, pattern, previewBranchSchemaEdit, pushBranchMigrations, queryMigrationRequests, queryTable, removeGitBranchesEntry, removeWorkspaceMember, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, serialize, setTableSchema, sqlQuery, startsWith, summarizeTable, updateBranchMetadata, updateBranchSchema, updateColumn, updateDatabaseGithubSettings, updateDatabaseMetadata, updateMigrationRequest, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID, vectorSearchTable };
|
4748
|
+
export { BaseClient, FetcherError, FilesPlugin, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Query, RecordArray, RecordColumnTypes, Repository, RestRepository, SQLPlugin, SchemaPlugin, SearchPlugin, Serializer, SimpleCache, XataApiClient, XataApiPlugin, XataError, XataFile, XataPlugin, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, aggregateTable, applyBranchSchemaEdit, askTable, askTableSession, branchTransaction, buildClient, buildPreviewBranchName, buildProviderString, buildWorkerRunner, bulkInsertTableRecords, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, contains, copyBranch, createBranch, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteDatabaseGithubSettings, deleteFile, deleteFileItem, deleteOAuthAccessToken, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteUserOAuthClient, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, fileAccess, ge, getAPIKey, getAuthorizationCode, getBranch, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchSchemaHistory, getBranchStats, getColumn, getDatabaseGithubSettings, getDatabaseList, getDatabaseMetadata, getDatabaseURL, getFile, getFileItem, getGitBranchesMapping, getHostUrl, getMigrationRequest, getMigrationRequestIsMerged, getPreviewBranch, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getUserOAuthAccessTokens, getUserOAuthClients, getWorkspace, getWorkspaceMembersList, getWorkspacesList, grantAuthorizationCode, greaterEquals, greaterThan, greaterThanEquals, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isHostProviderAlias, isHostProviderBuilder, isIdentifiable, isNot, isXataRecord, le, lessEquals, lessThan, lessThanEquals, listMigrationRequestsCommits, listRegions, lt, lte, mergeMigrationRequest, notExists, operationsByTag, parseProviderString, parseWorkspacesUrlParts, pattern, previewBranchSchemaEdit, pushBranchMigrations, putFile, putFileItem, queryMigrationRequests, queryTable, removeGitBranchesEntry, removeWorkspaceMember, renameDatabase, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, serialize, setTableSchema, sqlQuery, startsWith, summarizeTable, transformImage, updateBranchMetadata, updateBranchSchema, updateColumn, updateDatabaseGithubSettings, updateDatabaseMetadata, updateMigrationRequest, updateOAuthAccessToken, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID, vectorSearchTable };
|
3843
4749
|
//# sourceMappingURL=index.mjs.map
|