@xata.io/client 0.24.1 → 0.24.3

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.
@@ -1,4 +1,4 @@
1
1
 
2
- > @xata.io/client@0.24.1 add-version /home/runner/work/client-ts/client-ts/packages/client
2
+ > @xata.io/client@0.24.3 add-version /home/runner/work/client-ts/client-ts/packages/client
3
3
  > node ../../scripts/add-version-file.mjs
4
4
 
@@ -1,5 +1,5 @@
1
1
 
2
- > @xata.io/client@0.24.1 build /home/runner/work/client-ts/client-ts/packages/client
2
+ > @xata.io/client@0.24.3 build /home/runner/work/client-ts/client-ts/packages/client
3
3
  > rimraf dist && rollup -c
4
4
 
5
5
  
@@ -7,7 +7,7 @@
7
7
  created dist/index.cjs in 1.3s
8
8
  
9
9
  src/index.ts → dist/index.mjs...
10
- created dist/index.mjs in 970ms
10
+ created dist/index.mjs in 770ms
11
11
  
12
12
  src/index.ts → dist/index.d.ts...
13
- created dist/index.d.ts in 5.9s
13
+ created dist/index.d.ts in 5.8s
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @xata.io/client
2
2
 
3
+ ## 0.24.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1033](https://github.com/xataio/client-ts/pull/1033) [`f01d1580`](https://github.com/xataio/client-ts/commit/f01d1580fc450cbf06eb8af85d68cf052fbe83a1) Thanks [@xata-bot](https://github.com/xata-bot)! - [OpenAPI] Spec updates for column selection
8
+
9
+ - [#1044](https://github.com/xataio/client-ts/pull/1044) [`52290feb`](https://github.com/xataio/client-ts/commit/52290feb5bba57384cdc14e7722fb5d9883dc581) Thanks [@SferaDev](https://github.com/SferaDev)! - Allow undefined with createOrUpdate/createOrReplace
10
+
11
+ ## 0.24.2
12
+
13
+ ### Patch Changes
14
+
15
+ - [#1038](https://github.com/xataio/client-ts/pull/1038) [`51561b52`](https://github.com/xataio/client-ts/commit/51561b52b56ad5ed9101d8faf12929891419cb2c) Thanks [@SferaDev](https://github.com/SferaDev)! - Show internal columns in filters
16
+
3
17
  ## 0.24.1
4
18
 
5
19
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -492,7 +492,7 @@ function defaultOnOpen(response) {
492
492
  }
493
493
  }
494
494
 
495
- const VERSION = "0.24.1";
495
+ const VERSION = "0.24.3";
496
496
 
497
497
  class ErrorWithCause extends Error {
498
498
  constructor(message, options) {
@@ -3185,12 +3185,22 @@ class RestRepository extends Query {
3185
3185
  return result;
3186
3186
  }
3187
3187
  if (isString(a) && isObject(b)) {
3188
+ if (a === "")
3189
+ throw new Error("The id can't be empty");
3188
3190
  const columns = isStringArray(c) ? c : void 0;
3189
- return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns, { ifVersion });
3191
+ return await __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns, { ifVersion });
3190
3192
  }
3191
3193
  if (isObject(a) && isString(a.id)) {
3194
+ if (a.id === "")
3195
+ throw new Error("The id can't be empty");
3192
3196
  const columns = isStringArray(c) ? c : void 0;
3193
- return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
3197
+ return await __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
3198
+ }
3199
+ if (!isDefined(a) && isObject(b)) {
3200
+ return await this.create(b, c);
3201
+ }
3202
+ if (isObject(a) && !isDefined(a.id)) {
3203
+ return await this.create(a, b);
3194
3204
  }
3195
3205
  throw new Error("Invalid arguments for createOrUpdate method");
3196
3206
  });
@@ -3207,12 +3217,22 @@ class RestRepository extends Query {
3207
3217
  return result;
3208
3218
  }
3209
3219
  if (isString(a) && isObject(b)) {
3220
+ if (a === "")
3221
+ throw new Error("The id can't be empty");
3210
3222
  const columns = isStringArray(c) ? c : void 0;
3211
- return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: false, ifVersion });
3223
+ return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: false, ifVersion });
3212
3224
  }
3213
3225
  if (isObject(a) && isString(a.id)) {
3226
+ if (a.id === "")
3227
+ throw new Error("The id can't be empty");
3214
3228
  const columns = isStringArray(c) ? c : void 0;
3215
- return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: false, ifVersion });
3229
+ return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: false, ifVersion });
3230
+ }
3231
+ if (!isDefined(a) && isObject(b)) {
3232
+ return await this.create(b, c);
3233
+ }
3234
+ if (isObject(a) && !isDefined(a.id)) {
3235
+ return await this.create(a, b);
3216
3236
  }
3217
3237
  throw new Error("Invalid arguments for createOrReplace method");
3218
3238
  });
@@ -3432,6 +3452,8 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
3432
3452
  };
3433
3453
  _insertRecordWithId = new WeakSet();
3434
3454
  insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { createOnly, ifVersion }) {
3455
+ if (!recordId)
3456
+ return null;
3435
3457
  const record = transformObjectLinks(object);
3436
3458
  const response = await insertRecordWithID({
3437
3459
  pathParams: {
@@ -3479,6 +3501,8 @@ insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
3479
3501
  };
3480
3502
  _updateRecordWithID = new WeakSet();
3481
3503
  updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
3504
+ if (!recordId)
3505
+ return null;
3482
3506
  const { id: _id, ...record } = transformObjectLinks(object);
3483
3507
  try {
3484
3508
  const response = await updateRecordWithID({
@@ -3533,6 +3557,8 @@ updateRecords_fn = async function(objects, { ifVersion, upsert }) {
3533
3557
  };
3534
3558
  _upsertRecordWithID = new WeakSet();
3535
3559
  upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
3560
+ if (!recordId)
3561
+ return null;
3536
3562
  const response = await upsertRecordWithID({
3537
3563
  pathParams: {
3538
3564
  workspace: "{workspaceId}",
@@ -3550,6 +3576,8 @@ upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
3550
3576
  };
3551
3577
  _deleteRecord = new WeakSet();
3552
3578
  deleteRecord_fn = async function(recordId, columns = ["*"]) {
3579
+ if (!recordId)
3580
+ return null;
3553
3581
  try {
3554
3582
  const response = await deleteRecord({
3555
3583
  pathParams: {
@@ -3574,7 +3602,7 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
3574
3602
  _deleteRecords = new WeakSet();
3575
3603
  deleteRecords_fn = async function(recordIds) {
3576
3604
  const chunkedOperations = chunk(
3577
- recordIds.map((id) => ({ delete: { table: __privateGet$4(this, _table), id } })),
3605
+ compact(recordIds).map((id) => ({ delete: { table: __privateGet$4(this, _table), id } })),
3578
3606
  BULK_OPERATION_MAX_SIZE
3579
3607
  );
3580
3608
  for (const operations of chunkedOperations) {