@xata.io/client 0.18.0 → 0.18.1
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/CHANGELOG.md +6 -0
- package/dist/index.cjs +22 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +697 -10
- package/dist/index.mjs +22 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# @xata.io/client
|
2
2
|
|
3
|
+
## 0.18.1
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [#627](https://github.com/xataio/client-ts/pull/627) [`ad0a5b4`](https://github.com/xataio/client-ts/commit/ad0a5b4bc87b82fdc10008a8ea324a8ca783e678) Thanks [@SferaDev](https://github.com/SferaDev)! - Fix some cases where filters on link and multiple column types are not working
|
8
|
+
|
3
9
|
## 0.18.0
|
4
10
|
|
5
11
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
@@ -172,7 +172,7 @@ function getFetchImplementation(userFetch) {
|
|
172
172
|
return fetchImpl;
|
173
173
|
}
|
174
174
|
|
175
|
-
const VERSION = "0.18.
|
175
|
+
const VERSION = "0.18.1";
|
176
176
|
|
177
177
|
class ErrorWithCause extends Error {
|
178
178
|
constructor(message, options) {
|
@@ -1379,9 +1379,14 @@ var __privateSet$5 = (obj, member, value, setter) => {
|
|
1379
1379
|
setter ? setter.call(obj, value) : member.set(obj, value);
|
1380
1380
|
return value;
|
1381
1381
|
};
|
1382
|
-
var
|
1382
|
+
var __privateMethod$3 = (obj, member, method) => {
|
1383
|
+
__accessCheck$5(obj, member, "access private method");
|
1384
|
+
return method;
|
1385
|
+
};
|
1386
|
+
var _table$1, _repository, _data, _cleanFilterConstraint, cleanFilterConstraint_fn;
|
1383
1387
|
const _Query = class {
|
1384
1388
|
constructor(repository, table, data, rawParent) {
|
1389
|
+
__privateAdd$5(this, _cleanFilterConstraint);
|
1385
1390
|
__privateAdd$5(this, _table$1, void 0);
|
1386
1391
|
__privateAdd$5(this, _repository, void 0);
|
1387
1392
|
__privateAdd$5(this, _data, { filter: {} });
|
@@ -1438,22 +1443,17 @@ const _Query = class {
|
|
1438
1443
|
}
|
1439
1444
|
filter(a, b) {
|
1440
1445
|
if (arguments.length === 1) {
|
1441
|
-
const constraints = Object.entries(a ?? {}).map(([column, constraint]) => ({
|
1446
|
+
const constraints = Object.entries(a ?? {}).map(([column, constraint]) => ({
|
1447
|
+
[column]: __privateMethod$3(this, _cleanFilterConstraint, cleanFilterConstraint_fn).call(this, column, constraint)
|
1448
|
+
}));
|
1442
1449
|
const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
|
1443
1450
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
|
1444
1451
|
} else {
|
1445
|
-
const constraints = isDefined(a) && isDefined(b) ? [{ [a]: this.
|
1452
|
+
const constraints = isDefined(a) && isDefined(b) ? [{ [a]: __privateMethod$3(this, _cleanFilterConstraint, cleanFilterConstraint_fn).call(this, a, b) }] : void 0;
|
1446
1453
|
const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
|
1447
1454
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
|
1448
1455
|
}
|
1449
1456
|
}
|
1450
|
-
defaultFilter(column, value) {
|
1451
|
-
const columnType = __privateGet$5(this, _table$1).schema?.columns.find(({ name }) => name === column)?.type;
|
1452
|
-
if (columnType === "multiple" && (isString(value) || isStringArray(value))) {
|
1453
|
-
return { $includes: value };
|
1454
|
-
}
|
1455
|
-
return value;
|
1456
|
-
}
|
1457
1457
|
sort(column, direction = "asc") {
|
1458
1458
|
const originalSort = [__privateGet$5(this, _data).sort ?? []].flat();
|
1459
1459
|
const sort = [...originalSort, { column, direction }];
|
@@ -1544,6 +1544,17 @@ let Query = _Query;
|
|
1544
1544
|
_table$1 = new WeakMap();
|
1545
1545
|
_repository = new WeakMap();
|
1546
1546
|
_data = new WeakMap();
|
1547
|
+
_cleanFilterConstraint = new WeakSet();
|
1548
|
+
cleanFilterConstraint_fn = function(column, value) {
|
1549
|
+
const columnType = __privateGet$5(this, _table$1).schema?.columns.find(({ name }) => name === column)?.type;
|
1550
|
+
if (columnType === "multiple" && (isString(value) || isStringArray(value))) {
|
1551
|
+
return { $includes: value };
|
1552
|
+
}
|
1553
|
+
if (columnType === "link" && isObject(value) && isString(value.id)) {
|
1554
|
+
return value.id;
|
1555
|
+
}
|
1556
|
+
return value;
|
1557
|
+
};
|
1547
1558
|
function cleanParent(data, parent) {
|
1548
1559
|
if (isCursorPaginationOptions(data.pagination)) {
|
1549
1560
|
return { ...parent, sorting: void 0, filter: void 0 };
|