@xata.io/client 0.0.0-alpha.vf27674a → 0.0.0-alpha.vf3081bb
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/.eslintrc.cjs +1 -2
- package/CHANGELOG.md +54 -0
- package/README.md +265 -1
- package/dist/index.cjs +170 -71
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +287 -55
- package/dist/index.mjs +168 -71
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -2
- package/tsconfig.json +1 -0
package/dist/index.cjs
CHANGED
@@ -11,8 +11,11 @@ function compact(arr) {
|
|
11
11
|
function isObject(value) {
|
12
12
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
13
13
|
}
|
14
|
+
function isDefined(value) {
|
15
|
+
return value !== null && value !== void 0;
|
16
|
+
}
|
14
17
|
function isString(value) {
|
15
|
-
return value
|
18
|
+
return isDefined(value) && typeof value === "string";
|
16
19
|
}
|
17
20
|
function toBase64(value) {
|
18
21
|
try {
|
@@ -74,7 +77,12 @@ function getFetchImplementation(userFetch) {
|
|
74
77
|
return fetchImpl;
|
75
78
|
}
|
76
79
|
|
77
|
-
class
|
80
|
+
class ErrorWithCause extends Error {
|
81
|
+
constructor(message, options) {
|
82
|
+
super(message, options);
|
83
|
+
}
|
84
|
+
}
|
85
|
+
class FetcherError extends ErrorWithCause {
|
78
86
|
constructor(status, data) {
|
79
87
|
super(getMessage(data));
|
80
88
|
this.status = status;
|
@@ -370,6 +378,11 @@ const queryTable = (variables) => fetch$1({
|
|
370
378
|
method: "post",
|
371
379
|
...variables
|
372
380
|
});
|
381
|
+
const searchTable = (variables) => fetch$1({
|
382
|
+
url: "/db/{dbBranchName}/tables/{tableName}/search",
|
383
|
+
method: "post",
|
384
|
+
...variables
|
385
|
+
});
|
373
386
|
const searchBranch = (variables) => fetch$1({
|
374
387
|
url: "/db/{dbBranchName}/search",
|
375
388
|
method: "post",
|
@@ -433,6 +446,7 @@ const operationsByTag = {
|
|
433
446
|
getRecord,
|
434
447
|
bulkInsertTableRecords,
|
435
448
|
queryTable,
|
449
|
+
searchTable,
|
436
450
|
searchBranch
|
437
451
|
}
|
438
452
|
};
|
@@ -888,6 +902,13 @@ class RecordsApi {
|
|
888
902
|
...this.extraProps
|
889
903
|
});
|
890
904
|
}
|
905
|
+
searchTable(workspace, database, branch, tableName, query) {
|
906
|
+
return operationsByTag.records.searchTable({
|
907
|
+
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
908
|
+
body: query,
|
909
|
+
...this.extraProps
|
910
|
+
});
|
911
|
+
}
|
891
912
|
searchBranch(workspace, database, branch, query) {
|
892
913
|
return operationsByTag.records.searchBranch({
|
893
914
|
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
@@ -925,13 +946,13 @@ var __privateSet$5 = (obj, member, value, setter) => {
|
|
925
946
|
setter ? setter.call(obj, value) : member.set(obj, value);
|
926
947
|
return value;
|
927
948
|
};
|
928
|
-
var _query;
|
949
|
+
var _query, _page;
|
929
950
|
class Page {
|
930
951
|
constructor(query, meta, records = []) {
|
931
952
|
__privateAdd$6(this, _query, void 0);
|
932
953
|
__privateSet$5(this, _query, query);
|
933
954
|
this.meta = meta;
|
934
|
-
this.records = records;
|
955
|
+
this.records = new RecordArray(this, records);
|
935
956
|
}
|
936
957
|
async nextPage(size, offset) {
|
937
958
|
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, after: this.meta.page.cursor } });
|
@@ -951,9 +972,40 @@ class Page {
|
|
951
972
|
}
|
952
973
|
_query = new WeakMap();
|
953
974
|
const PAGINATION_MAX_SIZE = 200;
|
954
|
-
const PAGINATION_DEFAULT_SIZE =
|
975
|
+
const PAGINATION_DEFAULT_SIZE = 20;
|
955
976
|
const PAGINATION_MAX_OFFSET = 800;
|
956
977
|
const PAGINATION_DEFAULT_OFFSET = 0;
|
978
|
+
function isCursorPaginationOptions(options) {
|
979
|
+
return isDefined(options) && (isDefined(options.first) || isDefined(options.last) || isDefined(options.after) || isDefined(options.before));
|
980
|
+
}
|
981
|
+
const _RecordArray = class extends Array {
|
982
|
+
constructor(page, overrideRecords) {
|
983
|
+
super(...overrideRecords ?? page.records);
|
984
|
+
__privateAdd$6(this, _page, void 0);
|
985
|
+
__privateSet$5(this, _page, page);
|
986
|
+
}
|
987
|
+
async nextPage(size, offset) {
|
988
|
+
const newPage = await __privateGet$6(this, _page).nextPage(size, offset);
|
989
|
+
return new _RecordArray(newPage);
|
990
|
+
}
|
991
|
+
async previousPage(size, offset) {
|
992
|
+
const newPage = await __privateGet$6(this, _page).previousPage(size, offset);
|
993
|
+
return new _RecordArray(newPage);
|
994
|
+
}
|
995
|
+
async firstPage(size, offset) {
|
996
|
+
const newPage = await __privateGet$6(this, _page).firstPage(size, offset);
|
997
|
+
return new _RecordArray(newPage);
|
998
|
+
}
|
999
|
+
async lastPage(size, offset) {
|
1000
|
+
const newPage = await __privateGet$6(this, _page).lastPage(size, offset);
|
1001
|
+
return new _RecordArray(newPage);
|
1002
|
+
}
|
1003
|
+
hasNextPage() {
|
1004
|
+
return __privateGet$6(this, _page).meta.page.more;
|
1005
|
+
}
|
1006
|
+
};
|
1007
|
+
let RecordArray = _RecordArray;
|
1008
|
+
_page = new WeakMap();
|
957
1009
|
|
958
1010
|
var __accessCheck$5 = (obj, member, msg) => {
|
959
1011
|
if (!member.has(obj))
|
@@ -975,18 +1027,19 @@ var __privateSet$4 = (obj, member, value, setter) => {
|
|
975
1027
|
};
|
976
1028
|
var _table$1, _repository, _data;
|
977
1029
|
const _Query = class {
|
978
|
-
constructor(repository, table, data,
|
1030
|
+
constructor(repository, table, data, rawParent) {
|
979
1031
|
__privateAdd$5(this, _table$1, void 0);
|
980
1032
|
__privateAdd$5(this, _repository, void 0);
|
981
1033
|
__privateAdd$5(this, _data, { filter: {} });
|
982
1034
|
this.meta = { page: { cursor: "start", more: true } };
|
983
|
-
this.records = [];
|
1035
|
+
this.records = new RecordArray(this, []);
|
984
1036
|
__privateSet$4(this, _table$1, table);
|
985
1037
|
if (repository) {
|
986
1038
|
__privateSet$4(this, _repository, repository);
|
987
1039
|
} else {
|
988
1040
|
__privateSet$4(this, _repository, this);
|
989
1041
|
}
|
1042
|
+
const parent = cleanParent(data, rawParent);
|
990
1043
|
__privateGet$5(this, _data).filter = data.filter ?? parent?.filter ?? {};
|
991
1044
|
__privateGet$5(this, _data).filter.$any = data.filter?.$any ?? parent?.filter?.$any;
|
992
1045
|
__privateGet$5(this, _data).filter.$all = data.filter?.$all ?? parent?.filter?.$all;
|
@@ -1058,18 +1111,21 @@ const _Query = class {
|
|
1058
1111
|
}
|
1059
1112
|
async *getIterator(options = {}) {
|
1060
1113
|
const { batchSize = 1 } = options;
|
1061
|
-
let
|
1062
|
-
let
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1114
|
+
let page = await this.getPaginated({ ...options, pagination: { size: batchSize, offset: 0 } });
|
1115
|
+
let more = page.hasNextPage();
|
1116
|
+
yield page.records;
|
1117
|
+
while (more) {
|
1118
|
+
page = await page.nextPage();
|
1119
|
+
more = page.hasNextPage();
|
1120
|
+
yield page.records;
|
1068
1121
|
}
|
1069
1122
|
}
|
1070
1123
|
async getMany(options = {}) {
|
1071
|
-
const
|
1072
|
-
|
1124
|
+
const page = await this.getPaginated(options);
|
1125
|
+
if (page.hasNextPage() && options.pagination?.size === void 0) {
|
1126
|
+
console.trace("Calling getMany does not return all results. Paginate to get all results or call getAll.");
|
1127
|
+
}
|
1128
|
+
return page.records;
|
1073
1129
|
}
|
1074
1130
|
async getAll(options = {}) {
|
1075
1131
|
const { batchSize = PAGINATION_MAX_SIZE, ...rest } = options;
|
@@ -1081,7 +1137,7 @@ const _Query = class {
|
|
1081
1137
|
}
|
1082
1138
|
async getFirst(options = {}) {
|
1083
1139
|
const records = await this.getMany({ ...options, pagination: { size: 1 } });
|
1084
|
-
return records[0]
|
1140
|
+
return records[0] ?? null;
|
1085
1141
|
}
|
1086
1142
|
cache(ttl) {
|
1087
1143
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { cache: ttl }, __privateGet$5(this, _data));
|
@@ -1106,12 +1162,20 @@ let Query = _Query;
|
|
1106
1162
|
_table$1 = new WeakMap();
|
1107
1163
|
_repository = new WeakMap();
|
1108
1164
|
_data = new WeakMap();
|
1165
|
+
function cleanParent(data, parent) {
|
1166
|
+
if (isCursorPaginationOptions(data.pagination)) {
|
1167
|
+
return { ...parent, sorting: void 0, filter: void 0 };
|
1168
|
+
}
|
1169
|
+
return parent;
|
1170
|
+
}
|
1109
1171
|
|
1110
1172
|
function isIdentifiable(x) {
|
1111
1173
|
return isObject(x) && isString(x?.id);
|
1112
1174
|
}
|
1113
1175
|
function isXataRecord(x) {
|
1114
|
-
|
1176
|
+
const record = x;
|
1177
|
+
const metadata = record?.getMetadata();
|
1178
|
+
return isIdentifiable(x) && isObject(metadata) && typeof metadata.version === "number";
|
1115
1179
|
}
|
1116
1180
|
|
1117
1181
|
function isSortFilterString(value) {
|
@@ -1188,6 +1252,8 @@ class RestRepository extends Query {
|
|
1188
1252
|
}
|
1189
1253
|
async create(a, b) {
|
1190
1254
|
if (Array.isArray(a)) {
|
1255
|
+
if (a.length === 0)
|
1256
|
+
return [];
|
1191
1257
|
const records = await __privateMethod$2(this, _bulkInsertTableRecords, bulkInsertTableRecords_fn).call(this, a);
|
1192
1258
|
await Promise.all(records.map((record) => __privateMethod$2(this, _setCacheRecord, setCacheRecord_fn).call(this, record)));
|
1193
1259
|
return records;
|
@@ -1213,27 +1279,36 @@ class RestRepository extends Query {
|
|
1213
1279
|
}
|
1214
1280
|
throw new Error("Invalid arguments for create method");
|
1215
1281
|
}
|
1216
|
-
async read(
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
const
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1282
|
+
async read(a) {
|
1283
|
+
if (Array.isArray(a)) {
|
1284
|
+
if (a.length === 0)
|
1285
|
+
return [];
|
1286
|
+
return this.getAll({ filter: { id: { $any: a } } });
|
1287
|
+
}
|
1288
|
+
if (isString(a)) {
|
1289
|
+
const cacheRecord = await __privateMethod$2(this, _getCacheRecord, getCacheRecord_fn).call(this, a);
|
1290
|
+
if (cacheRecord)
|
1291
|
+
return cacheRecord;
|
1292
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1293
|
+
try {
|
1294
|
+
const response = await getRecord({
|
1295
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table), recordId: a },
|
1296
|
+
...fetchProps
|
1297
|
+
});
|
1298
|
+
const schema = await __privateMethod$2(this, _getSchema$1, getSchema_fn$1).call(this);
|
1299
|
+
return initObject(this.db, schema, __privateGet$4(this, _table), response);
|
1300
|
+
} catch (e) {
|
1301
|
+
if (isObject(e) && e.status === 404) {
|
1302
|
+
return null;
|
1303
|
+
}
|
1304
|
+
throw e;
|
1231
1305
|
}
|
1232
|
-
throw e;
|
1233
1306
|
}
|
1234
1307
|
}
|
1235
1308
|
async update(a, b) {
|
1236
1309
|
if (Array.isArray(a)) {
|
1310
|
+
if (a.length === 0)
|
1311
|
+
return [];
|
1237
1312
|
if (a.length > 100) {
|
1238
1313
|
console.warn("Bulk update operation is not optimized in the Xata API yet, this request might be slow");
|
1239
1314
|
}
|
@@ -1255,6 +1330,8 @@ class RestRepository extends Query {
|
|
1255
1330
|
}
|
1256
1331
|
async createOrUpdate(a, b) {
|
1257
1332
|
if (Array.isArray(a)) {
|
1333
|
+
if (a.length === 0)
|
1334
|
+
return [];
|
1258
1335
|
if (a.length > 100) {
|
1259
1336
|
console.warn("Bulk update operation is not optimized in the Xata API yet, this request might be slow");
|
1260
1337
|
}
|
@@ -1276,6 +1353,8 @@ class RestRepository extends Query {
|
|
1276
1353
|
}
|
1277
1354
|
async delete(a) {
|
1278
1355
|
if (Array.isArray(a)) {
|
1356
|
+
if (a.length === 0)
|
1357
|
+
return;
|
1279
1358
|
if (a.length > 100) {
|
1280
1359
|
console.warn("Bulk delete operation is not optimized in the Xata API yet, this request might be slow");
|
1281
1360
|
}
|
@@ -1296,9 +1375,14 @@ class RestRepository extends Query {
|
|
1296
1375
|
}
|
1297
1376
|
async search(query, options = {}) {
|
1298
1377
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1299
|
-
const { records } = await
|
1300
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
1301
|
-
body: {
|
1378
|
+
const { records } = await searchTable({
|
1379
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table) },
|
1380
|
+
body: {
|
1381
|
+
query,
|
1382
|
+
fuzziness: options.fuzziness,
|
1383
|
+
highlight: options.highlight,
|
1384
|
+
filter: options.filter
|
1385
|
+
},
|
1302
1386
|
...fetchProps
|
1303
1387
|
});
|
1304
1388
|
const schema = await __privateMethod$2(this, _getSchema$1, getSchema_fn$1).call(this);
|
@@ -1311,7 +1395,7 @@ class RestRepository extends Query {
|
|
1311
1395
|
const data = query.getQueryOptions();
|
1312
1396
|
const body = {
|
1313
1397
|
filter: Object.values(data.filter ?? {}).some(Boolean) ? data.filter : void 0,
|
1314
|
-
sort: data.sort ? buildSortFilter(data.sort) : void 0,
|
1398
|
+
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
1315
1399
|
page: data.pagination,
|
1316
1400
|
columns: data.columns
|
1317
1401
|
};
|
@@ -1481,7 +1565,8 @@ const transformObjectLinks = (object) => {
|
|
1481
1565
|
};
|
1482
1566
|
const initObject = (db, schema, table, object) => {
|
1483
1567
|
const result = {};
|
1484
|
-
|
1568
|
+
const { xata, ...rest } = object ?? {};
|
1569
|
+
Object.assign(result, rest);
|
1485
1570
|
const { columns } = schema.tables.find(({ name }) => name === table) ?? {};
|
1486
1571
|
if (!columns)
|
1487
1572
|
console.error(`Table ${table} not found in schema`);
|
@@ -1489,10 +1574,10 @@ const initObject = (db, schema, table, object) => {
|
|
1489
1574
|
const value = result[column.name];
|
1490
1575
|
switch (column.type) {
|
1491
1576
|
case "datetime": {
|
1492
|
-
const date = new Date(value);
|
1493
|
-
if (isNaN(date.getTime())) {
|
1577
|
+
const date = value !== void 0 ? new Date(value) : void 0;
|
1578
|
+
if (date && isNaN(date.getTime())) {
|
1494
1579
|
console.error(`Failed to parse date ${value} for field ${column.name}`);
|
1495
|
-
} else {
|
1580
|
+
} else if (date) {
|
1496
1581
|
result[column.name] = date;
|
1497
1582
|
}
|
1498
1583
|
break;
|
@@ -1501,7 +1586,7 @@ const initObject = (db, schema, table, object) => {
|
|
1501
1586
|
const linkTable = column.link?.table;
|
1502
1587
|
if (!linkTable) {
|
1503
1588
|
console.error(`Failed to parse link for field ${column.name}`);
|
1504
|
-
} else if (
|
1589
|
+
} else if (isObject(value)) {
|
1505
1590
|
result[column.name] = initObject(db, schema, linkTable, value);
|
1506
1591
|
}
|
1507
1592
|
break;
|
@@ -1517,7 +1602,10 @@ const initObject = (db, schema, table, object) => {
|
|
1517
1602
|
result.delete = function() {
|
1518
1603
|
return db[table].delete(result["id"]);
|
1519
1604
|
};
|
1520
|
-
|
1605
|
+
result.getMetadata = function() {
|
1606
|
+
return xata;
|
1607
|
+
};
|
1608
|
+
for (const prop of ["read", "update", "delete", "getMetadata"]) {
|
1521
1609
|
Object.defineProperty(result, prop, { enumerable: false });
|
1522
1610
|
}
|
1523
1611
|
Object.freeze(result);
|
@@ -1627,7 +1715,7 @@ class SchemaPlugin extends XataPlugin {
|
|
1627
1715
|
get: (_target, table) => {
|
1628
1716
|
if (!isString(table))
|
1629
1717
|
throw new Error("Invalid table name");
|
1630
|
-
if (
|
1718
|
+
if (__privateGet$2(this, _tables)[table] === void 0) {
|
1631
1719
|
__privateGet$2(this, _tables)[table] = new RestRepository({ db, pluginOptions, table });
|
1632
1720
|
}
|
1633
1721
|
return __privateGet$2(this, _tables)[table];
|
@@ -1699,10 +1787,10 @@ _schema = new WeakMap();
|
|
1699
1787
|
_search = new WeakSet();
|
1700
1788
|
search_fn = async function(query, options, getFetchProps) {
|
1701
1789
|
const fetchProps = await getFetchProps();
|
1702
|
-
const { tables, fuzziness } = options ?? {};
|
1790
|
+
const { tables, fuzziness, highlight } = options ?? {};
|
1703
1791
|
const { records } = await searchBranch({
|
1704
1792
|
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
1705
|
-
body: { tables, query, fuzziness },
|
1793
|
+
body: { tables, query, fuzziness, highlight },
|
1706
1794
|
...fetchProps
|
1707
1795
|
});
|
1708
1796
|
return records;
|
@@ -1730,30 +1818,39 @@ const envBranchNames = [
|
|
1730
1818
|
"CF_PAGES_BRANCH",
|
1731
1819
|
"BRANCH"
|
1732
1820
|
];
|
1733
|
-
const defaultBranch = "main";
|
1734
1821
|
async function getCurrentBranchName(options) {
|
1735
1822
|
const env = getBranchByEnvVariable();
|
1736
|
-
if (env)
|
1737
|
-
|
1738
|
-
|
1739
|
-
|
1740
|
-
|
1741
|
-
|
1742
|
-
|
1743
|
-
|
1744
|
-
return void 0;
|
1823
|
+
if (env) {
|
1824
|
+
const details = await getDatabaseBranch(env, options);
|
1825
|
+
if (details)
|
1826
|
+
return env;
|
1827
|
+
console.warn(`Branch ${env} not found in Xata. Ignoring...`);
|
1828
|
+
}
|
1829
|
+
const gitBranch = await getGitBranch();
|
1830
|
+
return resolveXataBranch(gitBranch, options);
|
1745
1831
|
}
|
1746
1832
|
async function getCurrentBranchDetails(options) {
|
1747
|
-
const
|
1748
|
-
|
1749
|
-
|
1750
|
-
|
1751
|
-
|
1752
|
-
|
1753
|
-
|
1754
|
-
|
1755
|
-
|
1756
|
-
|
1833
|
+
const branch = await getCurrentBranchName(options);
|
1834
|
+
return getDatabaseBranch(branch, options);
|
1835
|
+
}
|
1836
|
+
async function resolveXataBranch(gitBranch, options) {
|
1837
|
+
const databaseURL = options?.databaseURL || getDatabaseURL();
|
1838
|
+
const apiKey = options?.apiKey || getAPIKey();
|
1839
|
+
if (!databaseURL)
|
1840
|
+
throw new Error("A databaseURL was not defined. Either set the XATA_DATABASE_URL env variable or pass the argument explicitely");
|
1841
|
+
if (!apiKey)
|
1842
|
+
throw new Error("An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely");
|
1843
|
+
const [protocol, , host, , dbName] = databaseURL.split("/");
|
1844
|
+
const [workspace] = host.split(".");
|
1845
|
+
const { branch } = await resolveBranch({
|
1846
|
+
apiKey,
|
1847
|
+
apiUrl: databaseURL,
|
1848
|
+
fetchImpl: getFetchImplementation(options?.fetchImpl),
|
1849
|
+
workspacesApiUrl: `${protocol}//${host}`,
|
1850
|
+
pathParams: { dbName, workspace },
|
1851
|
+
queryParams: { gitBranch, fallbackBranch: getEnvVariable("XATA_FALLBACK_BRANCH") }
|
1852
|
+
});
|
1853
|
+
return branch;
|
1757
1854
|
}
|
1758
1855
|
async function getDatabaseBranch(branch, options) {
|
1759
1856
|
const databaseURL = options?.databaseURL || getDatabaseURL();
|
@@ -1842,7 +1939,7 @@ const buildClient = (plugins) => {
|
|
1842
1939
|
this.db = db;
|
1843
1940
|
this.search = search;
|
1844
1941
|
for (const [key, namespace] of Object.entries(plugins ?? {})) {
|
1845
|
-
if (
|
1942
|
+
if (namespace === void 0)
|
1846
1943
|
continue;
|
1847
1944
|
const result = namespace.build(pluginOptions);
|
1848
1945
|
if (result instanceof Promise) {
|
@@ -1859,7 +1956,7 @@ const buildClient = (plugins) => {
|
|
1859
1956
|
const databaseURL = options?.databaseURL || getDatabaseURL();
|
1860
1957
|
const apiKey = options?.apiKey || getAPIKey();
|
1861
1958
|
const cache = options?.cache ?? new SimpleCache({ cacheRecords: false, defaultQueryTTL: 0 });
|
1862
|
-
const branch = async () => options?.branch ? await __privateMethod(this, _evaluateBranch, evaluateBranch_fn).call(this, options.branch) : await getCurrentBranchName({ apiKey, databaseURL, fetchImpl: options?.fetch })
|
1959
|
+
const branch = async () => options?.branch !== void 0 ? await __privateMethod(this, _evaluateBranch, evaluateBranch_fn).call(this, options.branch) : await getCurrentBranchName({ apiKey, databaseURL, fetchImpl: options?.fetch });
|
1863
1960
|
if (!databaseURL || !apiKey) {
|
1864
1961
|
throw new Error("Options databaseURL and apiKey are required");
|
1865
1962
|
}
|
@@ -1886,7 +1983,7 @@ const buildClient = (plugins) => {
|
|
1886
1983
|
}, _evaluateBranch = new WeakSet(), evaluateBranch_fn = async function(param) {
|
1887
1984
|
if (__privateGet(this, _branch))
|
1888
1985
|
return __privateGet(this, _branch);
|
1889
|
-
if (
|
1986
|
+
if (param === void 0)
|
1890
1987
|
return void 0;
|
1891
1988
|
const strategies = Array.isArray(param) ? [...param] : [param];
|
1892
1989
|
const evaluateBranch = async (strategy) => {
|
@@ -1919,6 +2016,7 @@ exports.PAGINATION_MAX_OFFSET = PAGINATION_MAX_OFFSET;
|
|
1919
2016
|
exports.PAGINATION_MAX_SIZE = PAGINATION_MAX_SIZE;
|
1920
2017
|
exports.Page = Page;
|
1921
2018
|
exports.Query = Query;
|
2019
|
+
exports.RecordArray = RecordArray;
|
1922
2020
|
exports.Repository = Repository;
|
1923
2021
|
exports.RestRepository = RestRepository;
|
1924
2022
|
exports.SchemaPlugin = SchemaPlugin;
|
@@ -1940,7 +2038,6 @@ exports.createDatabase = createDatabase;
|
|
1940
2038
|
exports.createTable = createTable;
|
1941
2039
|
exports.createUserAPIKey = createUserAPIKey;
|
1942
2040
|
exports.createWorkspace = createWorkspace;
|
1943
|
-
exports.defaultBranch = defaultBranch;
|
1944
2041
|
exports.deleteBranch = deleteBranch;
|
1945
2042
|
exports.deleteColumn = deleteColumn;
|
1946
2043
|
exports.deleteDatabase = deleteDatabase;
|
@@ -1984,6 +2081,7 @@ exports.insertRecord = insertRecord;
|
|
1984
2081
|
exports.insertRecordWithID = insertRecordWithID;
|
1985
2082
|
exports.inviteWorkspaceMember = inviteWorkspaceMember;
|
1986
2083
|
exports.is = is;
|
2084
|
+
exports.isCursorPaginationOptions = isCursorPaginationOptions;
|
1987
2085
|
exports.isIdentifiable = isIdentifiable;
|
1988
2086
|
exports.isNot = isNot;
|
1989
2087
|
exports.isXataRecord = isXataRecord;
|
@@ -1999,6 +2097,7 @@ exports.removeWorkspaceMember = removeWorkspaceMember;
|
|
1999
2097
|
exports.resendWorkspaceMemberInvite = resendWorkspaceMemberInvite;
|
2000
2098
|
exports.resolveBranch = resolveBranch;
|
2001
2099
|
exports.searchBranch = searchBranch;
|
2100
|
+
exports.searchTable = searchTable;
|
2002
2101
|
exports.setTableSchema = setTableSchema;
|
2003
2102
|
exports.startsWith = startsWith;
|
2004
2103
|
exports.updateBranchMetadata = updateBranchMetadata;
|