@xata.io/client 0.0.0-alpha.vf7d30cc → 0.0.0-alpha.vf7fccd9
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 +9 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +698 -8
- package/dist/index.mjs +9 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
@@ -150,7 +150,7 @@ function getFetchImplementation(userFetch) {
|
|
150
150
|
return fetchImpl;
|
151
151
|
}
|
152
152
|
|
153
|
-
const VERSION = "0.0.0-alpha.
|
153
|
+
const VERSION = "0.0.0-alpha.vf7fccd9";
|
154
154
|
|
155
155
|
class ErrorWithCause extends Error {
|
156
156
|
constructor(message, options) {
|
@@ -1416,20 +1416,25 @@ const _Query = class {
|
|
1416
1416
|
}
|
1417
1417
|
filter(a, b) {
|
1418
1418
|
if (arguments.length === 1) {
|
1419
|
-
const constraints = Object.entries(a ?? {}).map(([column, constraint]) => ({
|
1419
|
+
const constraints = Object.entries(a ?? {}).map(([column, constraint]) => ({
|
1420
|
+
[column]: this.cleanFilterConstraint(column, constraint)
|
1421
|
+
}));
|
1420
1422
|
const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
|
1421
1423
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
|
1422
1424
|
} else {
|
1423
|
-
const constraints = isDefined(a) && isDefined(b) ? [{ [a]: this.
|
1425
|
+
const constraints = isDefined(a) && isDefined(b) ? [{ [a]: this.cleanFilterConstraint(a, b) }] : void 0;
|
1424
1426
|
const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
|
1425
1427
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
|
1426
1428
|
}
|
1427
1429
|
}
|
1428
|
-
|
1430
|
+
cleanFilterConstraint(column, value) {
|
1429
1431
|
const columnType = __privateGet$5(this, _table$1).schema?.columns.find(({ name }) => name === column)?.type;
|
1430
1432
|
if (columnType === "multiple" && (isString(value) || isStringArray(value))) {
|
1431
1433
|
return { $includes: value };
|
1432
1434
|
}
|
1435
|
+
if (columnType === "link" && isObject(value) && isString(value.id)) {
|
1436
|
+
return value.id;
|
1437
|
+
}
|
1433
1438
|
return value;
|
1434
1439
|
}
|
1435
1440
|
sort(column, direction = "asc") {
|