@xata.io/client 0.20.1 → 0.20.2

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.d.ts CHANGED
@@ -1686,18 +1686,16 @@ declare type AggResponse$1 = (number | null) | {
1686
1686
  * A transaction operation
1687
1687
  */
1688
1688
  declare type TransactionOperation = {
1689
- insert: TransactionInsert;
1689
+ insert: TransactionInsertOp;
1690
1690
  } | {
1691
- update: TransactionUpdate;
1691
+ update: TransactionUpdateOp;
1692
1692
  } | {
1693
- ['delete']: TransactionDelete;
1693
+ ['delete']: TransactionDeleteOp;
1694
1694
  };
1695
1695
  /**
1696
1696
  * Insert operation
1697
- *
1698
- * @x-go-type TxOperation
1699
1697
  */
1700
- declare type TransactionInsert = {
1698
+ declare type TransactionInsertOp = {
1701
1699
  /**
1702
1700
  * The table name
1703
1701
  */
@@ -1726,10 +1724,8 @@ declare type TransactionInsert = {
1726
1724
  };
1727
1725
  /**
1728
1726
  * Update operation
1729
- *
1730
- * @x-go-type TxOperation
1731
1727
  */
1732
- declare type TransactionUpdate = {
1728
+ declare type TransactionUpdateOp = {
1733
1729
  /**
1734
1730
  * The table name
1735
1731
  */
@@ -1752,10 +1748,8 @@ declare type TransactionUpdate = {
1752
1748
  };
1753
1749
  /**
1754
1750
  * A delete operation. The transaction will continue if no record matches the ID.
1755
- *
1756
- * @x-go-type TxOperation
1757
1751
  */
1758
- declare type TransactionDelete = {
1752
+ declare type TransactionDeleteOp = {
1759
1753
  /**
1760
1754
  * The table name
1761
1755
  */
@@ -1766,6 +1760,10 @@ declare type TransactionDelete = {
1766
1760
  * A result from an insert operation.
1767
1761
  */
1768
1762
  declare type TransactionResultInsert = {
1763
+ /**
1764
+ * The type of operation who's result is being returned.
1765
+ */
1766
+ operation: 'insert';
1769
1767
  /**
1770
1768
  * The number of affected rows
1771
1769
  */
@@ -1777,7 +1775,11 @@ declare type TransactionResultInsert = {
1777
1775
  */
1778
1776
  declare type TransactionResultUpdate = {
1779
1777
  /**
1780
- * The number of affected rows
1778
+ * The type of operation who's result is being returned.
1779
+ */
1780
+ operation: 'update';
1781
+ /**
1782
+ * The number of updated rows
1781
1783
  */
1782
1784
  rows: number;
1783
1785
  id: RecordID;
@@ -1787,12 +1789,18 @@ declare type TransactionResultUpdate = {
1787
1789
  */
1788
1790
  declare type TransactionResultDelete = {
1789
1791
  /**
1790
- * The number of affected rows
1792
+ * The type of operation who's result is being returned.
1793
+ */
1794
+ operation: 'delete';
1795
+ /**
1796
+ * The number of deleted rows
1791
1797
  */
1792
1798
  rows: number;
1793
1799
  };
1794
1800
  /**
1795
1801
  * An error message from a failing transaction operation
1802
+ *
1803
+ * @x-go-type xata.ErrTxOp
1796
1804
  */
1797
1805
  declare type TransactionError = {
1798
1806
  /**
@@ -1881,18 +1889,18 @@ declare type SearchResponse = {
1881
1889
  warning?: string;
1882
1890
  };
1883
1891
  /**
1884
- * @x-go-type TxResponse
1892
+ * @x-go-type TxSuccess
1885
1893
  */
1886
- declare type TransactionSucceeded = {
1894
+ declare type TransactionSuccess = {
1887
1895
  /**
1888
1896
  * An ordered array of results from the submitted operations that were executed
1889
1897
  */
1890
1898
  results: (TransactionResultInsert | TransactionResultUpdate | TransactionResultDelete)[];
1891
1899
  };
1892
1900
  /**
1893
- * @x-go-type TxResponse
1901
+ * @x-go-type TxFailure
1894
1902
  */
1895
- declare type TransactionFailed = {
1903
+ declare type TransactionFailure = {
1896
1904
  /**
1897
1905
  * An array of errors from the submitted operations.
1898
1906
  */
@@ -2569,7 +2577,7 @@ declare type BranchTransactionPathParams = {
2569
2577
  };
2570
2578
  declare type BranchTransactionError = ErrorWrapper<{
2571
2579
  status: 400;
2572
- payload: TransactionFailed;
2580
+ payload: TransactionFailure;
2573
2581
  } | {
2574
2582
  status: 401;
2575
2583
  payload: AuthError;
@@ -2584,7 +2592,7 @@ declare type BranchTransactionVariables = {
2584
2592
  body: BranchTransactionRequestBody;
2585
2593
  pathParams: BranchTransactionPathParams;
2586
2594
  } & DataPlaneFetcherExtraProps;
2587
- declare const branchTransaction: (variables: BranchTransactionVariables, signal?: AbortSignal) => Promise<TransactionSucceeded>;
2595
+ declare const branchTransaction: (variables: BranchTransactionVariables, signal?: AbortSignal) => Promise<TransactionSuccess>;
2588
2596
  declare type QueryMigrationRequestsPathParams = {
2589
2597
  /**
2590
2598
  * The Database Name
@@ -4733,7 +4741,7 @@ declare const operationsByTag: {
4733
4741
  resolveBranch: (variables: ResolveBranchVariables, signal?: AbortSignal | undefined) => Promise<ResolveBranchResponse>;
4734
4742
  };
4735
4743
  records: {
4736
- branchTransaction: (variables: BranchTransactionVariables, signal?: AbortSignal | undefined) => Promise<TransactionSucceeded>;
4744
+ branchTransaction: (variables: BranchTransactionVariables, signal?: AbortSignal | undefined) => Promise<TransactionSuccess>;
4737
4745
  insertRecord: (variables: InsertRecordVariables, signal?: AbortSignal | undefined) => Promise<RecordUpdateResponse>;
4738
4746
  getRecord: (variables: GetRecordVariables, signal?: AbortSignal | undefined) => Promise<XataRecord$1>;
4739
4747
  insertRecordWithID: (variables: InsertRecordWithIDVariables, signal?: AbortSignal | undefined) => Promise<RecordUpdateResponse>;
@@ -4855,8 +4863,8 @@ type responses_SchemaUpdateResponse = SchemaUpdateResponse;
4855
4863
  type responses_SummarizeResponse = SummarizeResponse;
4856
4864
  type responses_AggResponse = AggResponse;
4857
4865
  type responses_SearchResponse = SearchResponse;
4858
- type responses_TransactionSucceeded = TransactionSucceeded;
4859
- type responses_TransactionFailed = TransactionFailed;
4866
+ type responses_TransactionSuccess = TransactionSuccess;
4867
+ type responses_TransactionFailure = TransactionFailure;
4860
4868
  declare namespace responses {
4861
4869
  export {
4862
4870
  responses_AuthError as AuthError,
@@ -4873,8 +4881,8 @@ declare namespace responses {
4873
4881
  responses_SummarizeResponse as SummarizeResponse,
4874
4882
  responses_AggResponse as AggResponse,
4875
4883
  responses_SearchResponse as SearchResponse,
4876
- responses_TransactionSucceeded as TransactionSucceeded,
4877
- responses_TransactionFailed as TransactionFailed,
4884
+ responses_TransactionSuccess as TransactionSuccess,
4885
+ responses_TransactionFailure as TransactionFailure,
4878
4886
  };
4879
4887
  }
4880
4888
 
@@ -4953,9 +4961,9 @@ type schemas_RecordID = RecordID;
4953
4961
  type schemas_TableRename = TableRename;
4954
4962
  type schemas_RecordsMetadata = RecordsMetadata;
4955
4963
  type schemas_TransactionOperation = TransactionOperation;
4956
- type schemas_TransactionInsert = TransactionInsert;
4957
- type schemas_TransactionUpdate = TransactionUpdate;
4958
- type schemas_TransactionDelete = TransactionDelete;
4964
+ type schemas_TransactionInsertOp = TransactionInsertOp;
4965
+ type schemas_TransactionUpdateOp = TransactionUpdateOp;
4966
+ type schemas_TransactionDeleteOp = TransactionDeleteOp;
4959
4967
  type schemas_TransactionResultInsert = TransactionResultInsert;
4960
4968
  type schemas_TransactionResultUpdate = TransactionResultUpdate;
4961
4969
  type schemas_TransactionResultDelete = TransactionResultDelete;
@@ -5058,9 +5066,9 @@ declare namespace schemas {
5058
5066
  schemas_RecordsMetadata as RecordsMetadata,
5059
5067
  AggResponse$1 as AggResponse,
5060
5068
  schemas_TransactionOperation as TransactionOperation,
5061
- schemas_TransactionInsert as TransactionInsert,
5062
- schemas_TransactionUpdate as TransactionUpdate,
5063
- schemas_TransactionDelete as TransactionDelete,
5069
+ schemas_TransactionInsertOp as TransactionInsertOp,
5070
+ schemas_TransactionUpdateOp as TransactionUpdateOp,
5071
+ schemas_TransactionDeleteOp as TransactionDeleteOp,
5064
5072
  schemas_TransactionResultInsert as TransactionResultInsert,
5065
5073
  schemas_TransactionResultUpdate as TransactionResultUpdate,
5066
5074
  schemas_TransactionResultDelete as TransactionResultDelete,
@@ -5411,6 +5419,13 @@ declare class RecordsApi {
5411
5419
  records: Record<string, any>[];
5412
5420
  columns?: ColumnsProjection;
5413
5421
  }): Promise<BulkInsertResponse>;
5422
+ branchTransaction({ workspace, region, database, branch, operations }: {
5423
+ workspace: WorkspaceID;
5424
+ region: string;
5425
+ database: DBName;
5426
+ branch: BranchName;
5427
+ operations: TransactionOperation[];
5428
+ }): Promise<TransactionSuccess>;
5414
5429
  }
5415
5430
  declare class SearchAndFilterApi {
5416
5431
  private extraProps;
package/dist/index.mjs CHANGED
@@ -60,6 +60,13 @@ function deepMerge(a, b) {
60
60
  }
61
61
  return result;
62
62
  }
63
+ function chunk(array, chunkSize) {
64
+ const result = [];
65
+ for (let i = 0; i < array.length; i += chunkSize) {
66
+ result.push(array.slice(i, i + chunkSize));
67
+ }
68
+ return result;
69
+ }
63
70
 
64
71
  function getEnvironment() {
65
72
  try {
@@ -183,7 +190,7 @@ function getFetchImplementation(userFetch) {
183
190
  return fetchImpl;
184
191
  }
185
192
 
186
- const VERSION = "0.20.1";
193
+ const VERSION = "0.20.2";
187
194
 
188
195
  class ErrorWithCause extends Error {
189
196
  constructor(message, options) {
@@ -1366,6 +1373,19 @@ class RecordsApi {
1366
1373
  ...this.extraProps
1367
1374
  });
1368
1375
  }
1376
+ branchTransaction({
1377
+ workspace,
1378
+ region,
1379
+ database,
1380
+ branch,
1381
+ operations
1382
+ }) {
1383
+ return operationsByTag.records.branchTransaction({
1384
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
1385
+ body: { operations },
1386
+ ...this.extraProps
1387
+ });
1388
+ }
1369
1389
  }
1370
1390
  class SearchAndFilterApi {
1371
1391
  constructor(extraProps) {
@@ -2131,7 +2151,8 @@ var __privateMethod$2 = (obj, member, method) => {
2131
2151
  __accessCheck$4(obj, member, "access private method");
2132
2152
  return method;
2133
2153
  };
2134
- var _table, _getFetchProps, _db, _cache, _schemaTables$2, _trace, _insertRecordWithoutId, insertRecordWithoutId_fn, _insertRecordWithId, insertRecordWithId_fn, _bulkInsertTableRecords, bulkInsertTableRecords_fn, _updateRecordWithID, updateRecordWithID_fn, _upsertRecordWithID, upsertRecordWithID_fn, _deleteRecord, deleteRecord_fn, _setCacheQuery, setCacheQuery_fn, _getCacheQuery, getCacheQuery_fn, _getSchemaTables$1, getSchemaTables_fn$1;
2154
+ var _table, _getFetchProps, _db, _cache, _schemaTables$2, _trace, _insertRecordWithoutId, insertRecordWithoutId_fn, _insertRecordWithId, insertRecordWithId_fn, _insertRecords, insertRecords_fn, _updateRecordWithID, updateRecordWithID_fn, _updateRecords, updateRecords_fn, _upsertRecordWithID, upsertRecordWithID_fn, _deleteRecord, deleteRecord_fn, _deleteRecords, deleteRecords_fn, _setCacheQuery, setCacheQuery_fn, _getCacheQuery, getCacheQuery_fn, _getSchemaTables$1, getSchemaTables_fn$1;
2155
+ const BULK_OPERATION_MAX_SIZE = 1e3;
2135
2156
  class Repository extends Query {
2136
2157
  }
2137
2158
  class RestRepository extends Query {
@@ -2143,10 +2164,12 @@ class RestRepository extends Query {
2143
2164
  );
2144
2165
  __privateAdd$4(this, _insertRecordWithoutId);
2145
2166
  __privateAdd$4(this, _insertRecordWithId);
2146
- __privateAdd$4(this, _bulkInsertTableRecords);
2167
+ __privateAdd$4(this, _insertRecords);
2147
2168
  __privateAdd$4(this, _updateRecordWithID);
2169
+ __privateAdd$4(this, _updateRecords);
2148
2170
  __privateAdd$4(this, _upsertRecordWithID);
2149
2171
  __privateAdd$4(this, _deleteRecord);
2172
+ __privateAdd$4(this, _deleteRecords);
2150
2173
  __privateAdd$4(this, _setCacheQuery);
2151
2174
  __privateAdd$4(this, _getCacheQuery);
2152
2175
  __privateAdd$4(this, _getSchemaTables$1);
@@ -2180,20 +2203,22 @@ class RestRepository extends Query {
2180
2203
  if (Array.isArray(a)) {
2181
2204
  if (a.length === 0)
2182
2205
  return [];
2183
- const columns = isStringArray(b) ? b : void 0;
2184
- return __privateMethod$2(this, _bulkInsertTableRecords, bulkInsertTableRecords_fn).call(this, a, columns);
2206
+ const ids = await __privateMethod$2(this, _insertRecords, insertRecords_fn).call(this, a, { ifVersion, createOnly: true });
2207
+ const columns = isStringArray(b) ? b : ["*"];
2208
+ const result = await this.read(ids, columns);
2209
+ return result;
2185
2210
  }
2186
2211
  if (isString(a) && isObject(b)) {
2187
2212
  if (a === "")
2188
2213
  throw new Error("The id can't be empty");
2189
2214
  const columns = isStringArray(c) ? c : void 0;
2190
- return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: true, ifVersion });
2215
+ return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: true, ifVersion });
2191
2216
  }
2192
2217
  if (isObject(a) && isString(a.id)) {
2193
2218
  if (a.id === "")
2194
2219
  throw new Error("The id can't be empty");
2195
2220
  const columns = isStringArray(b) ? b : void 0;
2196
- return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: true, ifVersion });
2221
+ return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: true, ifVersion });
2197
2222
  }
2198
2223
  if (isObject(a)) {
2199
2224
  const columns = isStringArray(b) ? b : void 0;
@@ -2268,11 +2293,15 @@ class RestRepository extends Query {
2268
2293
  if (Array.isArray(a)) {
2269
2294
  if (a.length === 0)
2270
2295
  return [];
2271
- if (a.length > 100) {
2272
- console.warn("Bulk update operation is not optimized in the Xata API yet, this request might be slow");
2273
- }
2296
+ const existing = await this.read(a, ["id"]);
2297
+ const updates = a.filter((_item, index) => existing[index] !== null);
2298
+ await __privateMethod$2(this, _updateRecords, updateRecords_fn).call(this, updates, {
2299
+ ifVersion,
2300
+ upsert: false
2301
+ });
2274
2302
  const columns = isStringArray(b) ? b : ["*"];
2275
- return Promise.all(a.map((object) => this.update(object, columns)));
2303
+ const result = await this.read(a, columns);
2304
+ return result;
2276
2305
  }
2277
2306
  if (isString(a) && isObject(b)) {
2278
2307
  const columns = isStringArray(c) ? c : void 0;
@@ -2310,11 +2339,13 @@ class RestRepository extends Query {
2310
2339
  if (Array.isArray(a)) {
2311
2340
  if (a.length === 0)
2312
2341
  return [];
2313
- if (a.length > 100) {
2314
- console.warn("Bulk update operation is not optimized in the Xata API yet, this request might be slow");
2315
- }
2342
+ await __privateMethod$2(this, _updateRecords, updateRecords_fn).call(this, a, {
2343
+ ifVersion,
2344
+ upsert: true
2345
+ });
2316
2346
  const columns = isStringArray(b) ? b : ["*"];
2317
- return Promise.all(a.map((object) => this.createOrUpdate(object, columns)));
2347
+ const result = await this.read(a, columns);
2348
+ return result;
2318
2349
  }
2319
2350
  if (isString(a) && isObject(b)) {
2320
2351
  const columns = isStringArray(c) ? c : void 0;
@@ -2333,8 +2364,10 @@ class RestRepository extends Query {
2333
2364
  if (Array.isArray(a)) {
2334
2365
  if (a.length === 0)
2335
2366
  return [];
2367
+ const ids = await __privateMethod$2(this, _insertRecords, insertRecords_fn).call(this, a, { ifVersion, createOnly: false });
2336
2368
  const columns = isStringArray(b) ? b : ["*"];
2337
- return __privateMethod$2(this, _bulkInsertTableRecords, bulkInsertTableRecords_fn).call(this, a, columns);
2369
+ const result = await this.read(ids, columns);
2370
+ return result;
2338
2371
  }
2339
2372
  if (isString(a) && isObject(b)) {
2340
2373
  const columns = isStringArray(c) ? c : void 0;
@@ -2352,10 +2385,17 @@ class RestRepository extends Query {
2352
2385
  if (Array.isArray(a)) {
2353
2386
  if (a.length === 0)
2354
2387
  return [];
2355
- if (a.length > 100) {
2356
- console.warn("Bulk delete operation is not optimized in the Xata API yet, this request might be slow");
2357
- }
2358
- return Promise.all(a.map((id) => this.delete(id, b)));
2388
+ const ids = a.map((o) => {
2389
+ if (isString(o))
2390
+ return o;
2391
+ if (isString(o.id))
2392
+ return o.id;
2393
+ throw new Error("Invalid arguments for delete method");
2394
+ });
2395
+ const columns = isStringArray(b) ? b : ["*"];
2396
+ const result = await this.read(a, columns);
2397
+ await __privateMethod$2(this, _deleteRecords, deleteRecords_fn).call(this, ids);
2398
+ return result;
2359
2399
  }
2360
2400
  if (isString(a)) {
2361
2401
  return __privateMethod$2(this, _deleteRecord, deleteRecord_fn).call(this, a, b);
@@ -2523,31 +2563,40 @@ insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { crea
2523
2563
  const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
2524
2564
  return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
2525
2565
  };
2526
- _bulkInsertTableRecords = new WeakSet();
2527
- bulkInsertTableRecords_fn = async function(objects, columns = ["*"]) {
2566
+ _insertRecords = new WeakSet();
2567
+ insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
2528
2568
  const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
2529
- const records = objects.map((object) => transformObjectLinks(object));
2530
- const response = await bulkInsertTableRecords({
2531
- pathParams: {
2532
- workspace: "{workspaceId}",
2533
- dbBranchName: "{dbBranch}",
2534
- region: "{region}",
2535
- tableName: __privateGet$4(this, _table)
2536
- },
2537
- queryParams: { columns },
2538
- body: { records },
2539
- ...fetchProps
2540
- });
2541
- if (!isResponseWithRecords(response)) {
2542
- throw new Error("Request included columns but server didn't include them");
2569
+ const chunkedOperations = chunk(
2570
+ objects.map((object) => ({
2571
+ insert: { table: __privateGet$4(this, _table), record: transformObjectLinks(object), createOnly, ifVersion }
2572
+ })),
2573
+ BULK_OPERATION_MAX_SIZE
2574
+ );
2575
+ const ids = [];
2576
+ for (const operations of chunkedOperations) {
2577
+ const { results } = await branchTransaction({
2578
+ pathParams: {
2579
+ workspace: "{workspaceId}",
2580
+ dbBranchName: "{dbBranch}",
2581
+ region: "{region}"
2582
+ },
2583
+ body: { operations },
2584
+ ...fetchProps
2585
+ });
2586
+ for (const result of results) {
2587
+ if (result.operation === "insert") {
2588
+ ids.push(result.id);
2589
+ } else {
2590
+ ids.push(null);
2591
+ }
2592
+ }
2543
2593
  }
2544
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
2545
- return response.records?.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, columns));
2594
+ return ids;
2546
2595
  };
2547
2596
  _updateRecordWithID = new WeakSet();
2548
2597
  updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
2549
2598
  const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
2550
- const record = transformObjectLinks(object);
2599
+ const { id: _id, ...record } = transformObjectLinks(object);
2551
2600
  try {
2552
2601
  const response = await updateRecordWithID({
2553
2602
  pathParams: {
@@ -2570,6 +2619,36 @@ updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
2570
2619
  throw e;
2571
2620
  }
2572
2621
  };
2622
+ _updateRecords = new WeakSet();
2623
+ updateRecords_fn = async function(objects, { ifVersion, upsert }) {
2624
+ const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
2625
+ const chunkedOperations = chunk(
2626
+ objects.map(({ id, ...object }) => ({
2627
+ update: { table: __privateGet$4(this, _table), id, ifVersion, upsert, fields: transformObjectLinks(object) }
2628
+ })),
2629
+ BULK_OPERATION_MAX_SIZE
2630
+ );
2631
+ const ids = [];
2632
+ for (const operations of chunkedOperations) {
2633
+ const { results } = await branchTransaction({
2634
+ pathParams: {
2635
+ workspace: "{workspaceId}",
2636
+ dbBranchName: "{dbBranch}",
2637
+ region: "{region}"
2638
+ },
2639
+ body: { operations },
2640
+ ...fetchProps
2641
+ });
2642
+ for (const result of results) {
2643
+ if (result.operation === "update") {
2644
+ ids.push(result.id);
2645
+ } else {
2646
+ ids.push(null);
2647
+ }
2648
+ }
2649
+ }
2650
+ return ids;
2651
+ };
2573
2652
  _upsertRecordWithID = new WeakSet();
2574
2653
  upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
2575
2654
  const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
@@ -2612,6 +2691,25 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
2612
2691
  throw e;
2613
2692
  }
2614
2693
  };
2694
+ _deleteRecords = new WeakSet();
2695
+ deleteRecords_fn = async function(recordIds) {
2696
+ const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
2697
+ const chunkedOperations = chunk(
2698
+ recordIds.map((id) => ({ delete: { table: __privateGet$4(this, _table), id } })),
2699
+ BULK_OPERATION_MAX_SIZE
2700
+ );
2701
+ for (const operations of chunkedOperations) {
2702
+ await branchTransaction({
2703
+ pathParams: {
2704
+ workspace: "{workspaceId}",
2705
+ dbBranchName: "{dbBranch}",
2706
+ region: "{region}"
2707
+ },
2708
+ body: { operations },
2709
+ ...fetchProps
2710
+ });
2711
+ }
2712
+ };
2615
2713
  _setCacheQuery = new WeakSet();
2616
2714
  setCacheQuery_fn = async function(query, meta, records) {
2617
2715
  await __privateGet$4(this, _cache).set(`query_${__privateGet$4(this, _table)}:${query.key()}`, { date: new Date(), meta, records });
@@ -2722,9 +2820,6 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
2722
2820
  Object.freeze(result);
2723
2821
  return result;
2724
2822
  };
2725
- function isResponseWithRecords(value) {
2726
- return isObject(value) && Array.isArray(value.records);
2727
- }
2728
2823
  function extractId(value) {
2729
2824
  if (isString(value))
2730
2825
  return value;