@xata.io/client 0.21.0 → 0.21.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/dist/index.mjs CHANGED
@@ -295,7 +295,7 @@ enqueue_fn = function(task) {
295
295
  return promise;
296
296
  };
297
297
 
298
- const VERSION = "0.21.0";
298
+ const VERSION = "0.21.1";
299
299
 
300
300
  class ErrorWithCause extends Error {
301
301
  constructor(message, options) {
@@ -411,6 +411,7 @@ async function fetch$1({
411
411
  method: method.toUpperCase(),
412
412
  body: body ? JSON.stringify(body) : void 0,
413
413
  headers: {
414
+ "Accept-Encoding": "identity",
414
415
  "Content-Type": "application/json",
415
416
  "X-Xata-Client-ID": clientID ?? "",
416
417
  "X-Xata-Session-ID": sessionID ?? "",
@@ -2420,13 +2421,19 @@ class RestRepository extends Query {
2420
2421
  const result = await this.read(a, columns);
2421
2422
  return result;
2422
2423
  }
2423
- if (isString(a) && isObject(b)) {
2424
- const columns = isStringArray(c) ? c : void 0;
2425
- return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns, { ifVersion });
2426
- }
2427
- if (isObject(a) && isString(a.id)) {
2428
- const columns = isStringArray(b) ? b : void 0;
2429
- return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
2424
+ try {
2425
+ if (isString(a) && isObject(b)) {
2426
+ const columns = isStringArray(c) ? c : void 0;
2427
+ return await __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns, { ifVersion });
2428
+ }
2429
+ if (isObject(a) && isString(a.id)) {
2430
+ const columns = isStringArray(b) ? b : void 0;
2431
+ return await __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
2432
+ }
2433
+ } catch (error) {
2434
+ if (error.status === 422)
2435
+ return null;
2436
+ throw error;
2430
2437
  }
2431
2438
  throw new Error("Invalid arguments for update method");
2432
2439
  });