@xata.io/client 0.0.0-alpha.vfde9dcf → 0.0.0-alpha.vfee45b2
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/dist/index.cjs +16 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +27 -11
- package/dist/index.mjs +16 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
@@ -77,7 +77,12 @@ function getFetchImplementation(userFetch) {
|
|
77
77
|
return fetchImpl;
|
78
78
|
}
|
79
79
|
|
80
|
-
class
|
80
|
+
class ErrorWithCause extends Error {
|
81
|
+
constructor(message, options) {
|
82
|
+
super(message, options);
|
83
|
+
}
|
84
|
+
}
|
85
|
+
class FetcherError extends ErrorWithCause {
|
81
86
|
constructor(status, data) {
|
82
87
|
super(getMessage(data));
|
83
88
|
this.status = status;
|
@@ -994,7 +999,7 @@ var __privateSet$4 = (obj, member, value, setter) => {
|
|
994
999
|
};
|
995
1000
|
var _table$1, _repository, _data;
|
996
1001
|
const _Query = class {
|
997
|
-
constructor(repository, table, data,
|
1002
|
+
constructor(repository, table, data, rawParent) {
|
998
1003
|
__privateAdd$5(this, _table$1, void 0);
|
999
1004
|
__privateAdd$5(this, _repository, void 0);
|
1000
1005
|
__privateAdd$5(this, _data, { filter: {} });
|
@@ -1006,6 +1011,7 @@ const _Query = class {
|
|
1006
1011
|
} else {
|
1007
1012
|
__privateSet$4(this, _repository, this);
|
1008
1013
|
}
|
1014
|
+
const parent = cleanParent(data, rawParent);
|
1009
1015
|
__privateGet$5(this, _data).filter = data.filter ?? parent?.filter ?? {};
|
1010
1016
|
__privateGet$5(this, _data).filter.$any = data.filter?.$any ?? parent?.filter?.$any;
|
1011
1017
|
__privateGet$5(this, _data).filter.$all = data.filter?.$all ?? parent?.filter?.$all;
|
@@ -1125,6 +1131,12 @@ let Query = _Query;
|
|
1125
1131
|
_table$1 = new WeakMap();
|
1126
1132
|
_repository = new WeakMap();
|
1127
1133
|
_data = new WeakMap();
|
1134
|
+
function cleanParent(data, parent) {
|
1135
|
+
if (isCursorPaginationOptions(data.pagination)) {
|
1136
|
+
return { ...parent, sorting: void 0, filter: void 0 };
|
1137
|
+
}
|
1138
|
+
return parent;
|
1139
|
+
}
|
1128
1140
|
|
1129
1141
|
function isIdentifiable(x) {
|
1130
1142
|
return isObject(x) && isString(x?.id);
|
@@ -1332,12 +1344,9 @@ class RestRepository extends Query {
|
|
1332
1344
|
if (cacheQuery)
|
1333
1345
|
return new Page(query, cacheQuery.meta, cacheQuery.records);
|
1334
1346
|
const data = query.getQueryOptions();
|
1335
|
-
const filter = Object.values(data.filter ?? {}).some(Boolean) ? data.filter : void 0;
|
1336
|
-
const sort = data.sort !== void 0 ? buildSortFilter(data.sort) : void 0;
|
1337
|
-
const isCursorPagination = isCursorPaginationOptions(data.pagination);
|
1338
1347
|
const body = {
|
1339
|
-
filter:
|
1340
|
-
sort:
|
1348
|
+
filter: Object.values(data.filter ?? {}).some(Boolean) ? data.filter : void 0,
|
1349
|
+
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
1341
1350
|
page: data.pagination,
|
1342
1351
|
columns: data.columns
|
1343
1352
|
};
|