@xata.io/client 0.13.2 → 0.13.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.
package/dist/index.d.ts CHANGED
@@ -3382,6 +3382,7 @@ declare function isCursorPaginationOptions(options: Record<string, unknown> | un
3382
3382
  declare class RecordArray<Result extends XataRecord> extends Array<Result> {
3383
3383
  #private;
3384
3384
  constructor(page: Paginable<any, Result>, overrideRecords?: Result[]);
3385
+ static parseConstructorParams(...args: any[]): any[];
3385
3386
  /**
3386
3387
  * Retrieve next page of records
3387
3388
  *
package/dist/index.mjs CHANGED
@@ -74,7 +74,7 @@ function getFetchImplementation(userFetch) {
74
74
  return fetchImpl;
75
75
  }
76
76
 
77
- const VERSION = "0.13.2";
77
+ const VERSION = "0.13.3";
78
78
 
79
79
  class ErrorWithCause extends Error {
80
80
  constructor(message, options) {
@@ -991,10 +991,20 @@ function isCursorPaginationOptions(options) {
991
991
  }
992
992
  const _RecordArray = class extends Array {
993
993
  constructor(page, overrideRecords) {
994
- super(...overrideRecords ?? page.records);
994
+ super(..._RecordArray.parseConstructorParams(page, overrideRecords));
995
995
  __privateAdd$6(this, _page, void 0);
996
996
  __privateSet$5(this, _page, page);
997
997
  }
998
+ static parseConstructorParams(...args) {
999
+ if (args.length === 1 && typeof args[0] === "number") {
1000
+ return new Array(args[0]);
1001
+ }
1002
+ if (args.length <= 2 && isObject(args[0]?.meta) && Array.isArray(args[1] ?? [])) {
1003
+ const result = args[1] ?? args[0].records ?? [];
1004
+ return new Array(...result);
1005
+ }
1006
+ return new Array(...args);
1007
+ }
998
1008
  async nextPage(size, offset) {
999
1009
  const newPage = await __privateGet$6(this, _page).nextPage(size, offset);
1000
1010
  return new _RecordArray(newPage);