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