@xata.io/client 0.0.0-alpha.vf95371f → 0.0.0-alpha.vf9d4e41

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.mjs CHANGED
@@ -1077,7 +1077,7 @@ const _Query = class {
1077
1077
  }
1078
1078
  async getFirst(options = {}) {
1079
1079
  const records = await this.getMany({ ...options, pagination: { size: 1 } });
1080
- return records[0] || null;
1080
+ return records[0] ?? null;
1081
1081
  }
1082
1082
  cache(ttl) {
1083
1083
  return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { cache: ttl }, __privateGet$5(this, _data));
@@ -1307,7 +1307,7 @@ class RestRepository extends Query {
1307
1307
  const data = query.getQueryOptions();
1308
1308
  const body = {
1309
1309
  filter: Object.values(data.filter ?? {}).some(Boolean) ? data.filter : void 0,
1310
- sort: data.sort ? buildSortFilter(data.sort) : void 0,
1310
+ sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
1311
1311
  page: data.pagination,
1312
1312
  columns: data.columns
1313
1313
  };
@@ -1497,7 +1497,7 @@ const initObject = (db, schema, table, object) => {
1497
1497
  const linkTable = column.link?.table;
1498
1498
  if (!linkTable) {
1499
1499
  console.error(`Failed to parse link for field ${column.name}`);
1500
- } else if (value && isObject(value)) {
1500
+ } else if (isObject(value)) {
1501
1501
  result[column.name] = initObject(db, schema, linkTable, value);
1502
1502
  }
1503
1503
  break;
@@ -1623,7 +1623,7 @@ class SchemaPlugin extends XataPlugin {
1623
1623
  get: (_target, table) => {
1624
1624
  if (!isString(table))
1625
1625
  throw new Error("Invalid table name");
1626
- if (!__privateGet$2(this, _tables)[table]) {
1626
+ if (__privateGet$2(this, _tables)[table] === void 0) {
1627
1627
  __privateGet$2(this, _tables)[table] = new RestRepository({ db, pluginOptions, table });
1628
1628
  }
1629
1629
  return __privateGet$2(this, _tables)[table];
@@ -1838,7 +1838,7 @@ const buildClient = (plugins) => {
1838
1838
  this.db = db;
1839
1839
  this.search = search;
1840
1840
  for (const [key, namespace] of Object.entries(plugins ?? {})) {
1841
- if (!namespace)
1841
+ if (namespace === void 0)
1842
1842
  continue;
1843
1843
  const result = namespace.build(pluginOptions);
1844
1844
  if (result instanceof Promise) {
@@ -1855,7 +1855,7 @@ const buildClient = (plugins) => {
1855
1855
  const databaseURL = options?.databaseURL || getDatabaseURL();
1856
1856
  const apiKey = options?.apiKey || getAPIKey();
1857
1857
  const cache = options?.cache ?? new SimpleCache({ cacheRecords: false, defaultQueryTTL: 0 });
1858
- const branch = async () => options?.branch ? await __privateMethod(this, _evaluateBranch, evaluateBranch_fn).call(this, options.branch) : await getCurrentBranchName({ apiKey, databaseURL, fetchImpl: options?.fetch });
1858
+ const branch = async () => options?.branch !== void 0 ? await __privateMethod(this, _evaluateBranch, evaluateBranch_fn).call(this, options.branch) : await getCurrentBranchName({ apiKey, databaseURL, fetchImpl: options?.fetch });
1859
1859
  if (!databaseURL || !apiKey) {
1860
1860
  throw new Error("Options databaseURL and apiKey are required");
1861
1861
  }
@@ -1882,7 +1882,7 @@ const buildClient = (plugins) => {
1882
1882
  }, _evaluateBranch = new WeakSet(), evaluateBranch_fn = async function(param) {
1883
1883
  if (__privateGet(this, _branch))
1884
1884
  return __privateGet(this, _branch);
1885
- if (!param)
1885
+ if (param === void 0)
1886
1886
  return void 0;
1887
1887
  const strategies = Array.isArray(param) ? [...param] : [param];
1888
1888
  const evaluateBranch = async (strategy) => {