@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.cjs
CHANGED
@@ -172,7 +172,7 @@ function getFetchImplementation(userFetch) {
|
|
172
172
|
return fetchImpl;
|
173
173
|
}
|
174
174
|
|
175
|
-
const VERSION = "0.0.0-alpha.
|
175
|
+
const VERSION = "0.0.0-alpha.vf7fccd9";
|
176
176
|
|
177
177
|
class ErrorWithCause extends Error {
|
178
178
|
constructor(message, options) {
|
@@ -1438,20 +1438,25 @@ const _Query = class {
|
|
1438
1438
|
}
|
1439
1439
|
filter(a, b) {
|
1440
1440
|
if (arguments.length === 1) {
|
1441
|
-
const constraints = Object.entries(a ?? {}).map(([column, constraint]) => ({
|
1441
|
+
const constraints = Object.entries(a ?? {}).map(([column, constraint]) => ({
|
1442
|
+
[column]: this.cleanFilterConstraint(column, constraint)
|
1443
|
+
}));
|
1442
1444
|
const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
|
1443
1445
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
|
1444
1446
|
} else {
|
1445
|
-
const constraints = isDefined(a) && isDefined(b) ? [{ [a]: this.
|
1447
|
+
const constraints = isDefined(a) && isDefined(b) ? [{ [a]: this.cleanFilterConstraint(a, b) }] : void 0;
|
1446
1448
|
const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
|
1447
1449
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
|
1448
1450
|
}
|
1449
1451
|
}
|
1450
|
-
|
1452
|
+
cleanFilterConstraint(column, value) {
|
1451
1453
|
const columnType = __privateGet$5(this, _table$1).schema?.columns.find(({ name }) => name === column)?.type;
|
1452
1454
|
if (columnType === "multiple" && (isString(value) || isStringArray(value))) {
|
1453
1455
|
return { $includes: value };
|
1454
1456
|
}
|
1457
|
+
if (columnType === "link" && isObject(value) && isString(value.id)) {
|
1458
|
+
return value.id;
|
1459
|
+
}
|
1455
1460
|
return value;
|
1456
1461
|
}
|
1457
1462
|
sort(column, direction = "asc") {
|