@xata.io/client 0.0.0-alpha.vf7b5320 → 0.0.0-alpha.vf9819fa
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 +18 -0
- package/dist/index.cjs +12 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +88 -75
- package/dist/index.mjs +12 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
# @xata.io/client
|
2
2
|
|
3
|
+
## 0.10.0
|
4
|
+
|
5
|
+
### Minor Changes
|
6
|
+
|
7
|
+
- [#272](https://github.com/xataio/client-ts/pull/272) [`6d76275`](https://github.com/xataio/client-ts/commit/6d7627555a404a4c2da42f4187df6f8300f9a46f) Thanks [@SferaDev](https://github.com/SferaDev)! - Rename page options to pagination
|
8
|
+
|
9
|
+
* [#270](https://github.com/xataio/client-ts/pull/270) [`1864742`](https://github.com/xataio/client-ts/commit/18647428d8608841de514c3784fb711c39dccc6d) Thanks [@SferaDev](https://github.com/SferaDev)! - Move chunk to options object
|
10
|
+
|
11
|
+
### Patch Changes
|
12
|
+
|
13
|
+
- [#281](https://github.com/xataio/client-ts/pull/281) [`d1ec0df`](https://github.com/xataio/client-ts/commit/d1ec0df14834088a816919bfc68216f3f9b2d9ef) Thanks [@SferaDev](https://github.com/SferaDev)! - Do not send from param on undefined
|
14
|
+
|
15
|
+
* [#282](https://github.com/xataio/client-ts/pull/282) [`1af6f1a`](https://github.com/xataio/client-ts/commit/1af6f1aaa1123e77a895961581c87f06a88db698) Thanks [@SferaDev](https://github.com/SferaDev)! - Do not allow filter/sort with cursor navigation
|
16
|
+
|
17
|
+
- [#284](https://github.com/xataio/client-ts/pull/284) [`be4eda8`](https://github.com/xataio/client-ts/commit/be4eda8f73037d97fef7de28b56d7471dd867875) Thanks [@SferaDev](https://github.com/SferaDev)! - Fix cache ttl with 0 value
|
18
|
+
|
19
|
+
* [#265](https://github.com/xataio/client-ts/pull/265) [`99be734`](https://github.com/xataio/client-ts/commit/99be734827576d888aa12a579ed1983a0a8a8e83) Thanks [@SferaDev](https://github.com/SferaDev)! - Add datetime field type support
|
20
|
+
|
3
21
|
## 0.9.1
|
4
22
|
|
5
23
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
@@ -703,10 +703,10 @@ class BranchApi {
|
|
703
703
|
...this.extraProps
|
704
704
|
});
|
705
705
|
}
|
706
|
-
createBranch(workspace, database, branch, from
|
706
|
+
createBranch(workspace, database, branch, from, options = {}) {
|
707
707
|
return operationsByTag.branch.createBranch({
|
708
708
|
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
709
|
-
queryParams: { from },
|
709
|
+
queryParams: isString(from) ? { from } : void 0,
|
710
710
|
body: options,
|
711
711
|
...this.extraProps
|
712
712
|
});
|
@@ -1052,17 +1052,18 @@ const _Query = class {
|
|
1052
1052
|
return __privateGet$5(this, _repository).query(query);
|
1053
1053
|
}
|
1054
1054
|
async *[Symbol.asyncIterator]() {
|
1055
|
-
for await (const [record] of this.getIterator(1)) {
|
1055
|
+
for await (const [record] of this.getIterator({ batchSize: 1 })) {
|
1056
1056
|
yield record;
|
1057
1057
|
}
|
1058
1058
|
}
|
1059
|
-
async *getIterator(
|
1059
|
+
async *getIterator(options = {}) {
|
1060
|
+
const { batchSize = 1 } = options;
|
1060
1061
|
let offset = 0;
|
1061
1062
|
let end = false;
|
1062
1063
|
while (!end) {
|
1063
|
-
const { records, meta } = await this.getPaginated({ ...options, pagination: { size:
|
1064
|
+
const { records, meta } = await this.getPaginated({ ...options, pagination: { size: batchSize, offset } });
|
1064
1065
|
yield records;
|
1065
|
-
offset +=
|
1066
|
+
offset += batchSize;
|
1066
1067
|
end = !meta.page.more;
|
1067
1068
|
}
|
1068
1069
|
}
|
@@ -1070,9 +1071,10 @@ const _Query = class {
|
|
1070
1071
|
const { records } = await this.getPaginated(options);
|
1071
1072
|
return records;
|
1072
1073
|
}
|
1073
|
-
async getAll(
|
1074
|
+
async getAll(options = {}) {
|
1075
|
+
const { batchSize = PAGINATION_MAX_SIZE, ...rest } = options;
|
1074
1076
|
const results = [];
|
1075
|
-
for await (const page of this.getIterator(
|
1077
|
+
for await (const page of this.getIterator({ ...rest, batchSize })) {
|
1076
1078
|
results.push(...page);
|
1077
1079
|
}
|
1078
1080
|
return results;
|
@@ -1453,8 +1455,8 @@ getCacheQuery_fn = async function(query) {
|
|
1453
1455
|
if (!result)
|
1454
1456
|
return null;
|
1455
1457
|
const { cache: ttl = __privateGet$4(this, _cache).defaultQueryTTL } = query.getQueryOptions();
|
1456
|
-
if (
|
1457
|
-
return
|
1458
|
+
if (ttl < 0)
|
1459
|
+
return null;
|
1458
1460
|
const hasExpired = result.date.getTime() + ttl < Date.now();
|
1459
1461
|
return hasExpired ? null : result;
|
1460
1462
|
};
|