@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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @xata.io/client
2
2
 
3
+ ## 0.13.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#434](https://github.com/xataio/client-ts/pull/434) [`b82383d`](https://github.com/xataio/client-ts/commit/b82383d7541d19ae71ad7e047fd100901981f28b) Thanks [@SferaDev](https://github.com/SferaDev)! - Fix problem with SSR `RecordArray` in Next.js
8
+
3
9
  ## 0.13.2
4
10
 
5
11
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -78,7 +78,7 @@ function getFetchImplementation(userFetch) {
78
78
  return fetchImpl;
79
79
  }
80
80
 
81
- const VERSION = "0.13.2";
81
+ const VERSION = "0.13.3";
82
82
 
83
83
  class ErrorWithCause extends Error {
84
84
  constructor(message, options) {
@@ -995,10 +995,20 @@ function isCursorPaginationOptions(options) {
995
995
  }
996
996
  const _RecordArray = class extends Array {
997
997
  constructor(page, overrideRecords) {
998
- super(...overrideRecords ?? page.records);
998
+ super(..._RecordArray.parseConstructorParams(page, overrideRecords));
999
999
  __privateAdd$6(this, _page, void 0);
1000
1000
  __privateSet$5(this, _page, page);
1001
1001
  }
1002
+ static parseConstructorParams(...args) {
1003
+ if (args.length === 1 && typeof args[0] === "number") {
1004
+ return new Array(args[0]);
1005
+ }
1006
+ if (args.length <= 2 && isObject(args[0]?.meta) && Array.isArray(args[1] ?? [])) {
1007
+ const result = args[1] ?? args[0].records ?? [];
1008
+ return new Array(...result);
1009
+ }
1010
+ return new Array(...args);
1011
+ }
1002
1012
  async nextPage(size, offset) {
1003
1013
  const newPage = await __privateGet$6(this, _page).nextPage(size, offset);
1004
1014
  return new _RecordArray(newPage);