@xata.io/client 0.0.0-alpha.vfd1a215 → 0.0.0-alpha.vfd68d20

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,109 @@
1
1
  # @xata.io/client
2
2
 
3
+ ## 0.20.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#737](https://github.com/xataio/client-ts/pull/737) [`6cbeaa0`](https://github.com/xataio/client-ts/commit/6cbeaa00050b5aa99ab7c98052a906487263e026) Thanks [@SferaDev](https://github.com/SferaDev)! - Rename first to start and last to end in pagination
8
+
9
+ ### Patch Changes
10
+
11
+ - [#732](https://github.com/xataio/client-ts/pull/732) [`a5a9aa5`](https://github.com/xataio/client-ts/commit/a5a9aa59987faa1d3d701d7431b8a96031e01ac7) Thanks [@SferaDev](https://github.com/SferaDev)! - [Experimental] Allow passing fetch options in some queries
12
+
13
+ - [#735](https://github.com/xataio/client-ts/pull/735) [`c64b2eb`](https://github.com/xataio/client-ts/commit/c64b2eb9add70e75d419d418ab9608caac0dbfa1) Thanks [@SferaDev](https://github.com/SferaDev)! - Add support for default values
14
+
15
+ - [#730](https://github.com/xataio/client-ts/pull/730) [`485b217`](https://github.com/xataio/client-ts/commit/485b217079c4b2091d697e68622c48eddd130ceb) Thanks [@SferaDev](https://github.com/SferaDev)! - Add more summarize functions
16
+
17
+ - [#730](https://github.com/xataio/client-ts/pull/730) [`4d7499c`](https://github.com/xataio/client-ts/commit/4d7499ccbb135691350334fd8022f7a5da41c5f2) Thanks [@SferaDev](https://github.com/SferaDev)! - Add a check for browser execution
18
+
19
+ ## 0.19.1
20
+
21
+ ### Patch Changes
22
+
23
+ - [#723](https://github.com/xataio/client-ts/pull/723) [`ad5feeb`](https://github.com/xataio/client-ts/commit/ad5feebad5983f724ea4067b884bfae428447470) Thanks [@SferaDev](https://github.com/SferaDev)! - Fix replace operation not hidden
24
+
25
+ ## 0.19.0
26
+
27
+ ### Minor Changes
28
+
29
+ - [#692](https://github.com/xataio/client-ts/pull/692) [`c14f431`](https://github.com/xataio/client-ts/commit/c14f431db020036ab2b059bcc52a5d56b321c8e7) Thanks [@SferaDev](https://github.com/SferaDev)! - Add multi region endpoint support
30
+
31
+ - [#692](https://github.com/xataio/client-ts/pull/692) [`c8def01`](https://github.com/xataio/client-ts/commit/c8def013e9e2d5b634cdb2850f757a0b3e9e0a6d) Thanks [@SferaDev](https://github.com/SferaDev)! - Update OpenAPI spec methods
32
+
33
+ ### Patch Changes
34
+
35
+ - [#667](https://github.com/xataio/client-ts/pull/667) [`f80f051`](https://github.com/xataio/client-ts/commit/f80f05118dd0588861b8229114a469f016ef77ac) Thanks [@SferaDev](https://github.com/SferaDev)! - Allow sending page size to summarize endpoint
36
+
37
+ - [#676](https://github.com/xataio/client-ts/pull/676) [`2e341e5`](https://github.com/xataio/client-ts/commit/2e341e5c6140f9c4ddd74e479049992c26c43ea2) Thanks [@SferaDev](https://github.com/SferaDev)! - Support TS 4.7+
38
+
39
+ - [#709](https://github.com/xataio/client-ts/pull/709) [`f2f749f`](https://github.com/xataio/client-ts/commit/f2f749f4c64246a303da8d4a617773fc55c1d021) Thanks [@SferaDev](https://github.com/SferaDev)! - Add ifVersion flag to insert/update/upsert operations
40
+
41
+ - [#709](https://github.com/xataio/client-ts/pull/709) [`f2f749f`](https://github.com/xataio/client-ts/commit/f2f749f4c64246a303da8d4a617773fc55c1d021) Thanks [@SferaDev](https://github.com/SferaDev)! - Add createOrReplace operation to repository
42
+
43
+ ## 0.18.6
44
+
45
+ ### Patch Changes
46
+
47
+ - [#662](https://github.com/xataio/client-ts/pull/662) [`4a41680`](https://github.com/xataio/client-ts/commit/4a416803761a1c944ef9a76b794020ead6c8f477) Thanks [@SferaDev](https://github.com/SferaDev)! - Remove wildcard columns from sorting and filtering
48
+
49
+ - [#303](https://github.com/xataio/client-ts/pull/303) [`ad0cccb`](https://github.com/xataio/client-ts/commit/ad0cccb11cd4f9bb4bd7e44672d3375821e700fe) Thanks [@gimenete](https://github.com/gimenete)! - Add profiles for host parsing
50
+
51
+ - [#662](https://github.com/xataio/client-ts/pull/662) [`e1d6add`](https://github.com/xataio/client-ts/commit/e1d6addf84c55648bc0d908887b6bd020b429801) Thanks [@SferaDev](https://github.com/SferaDev)! - Add aggregations support to the SDK
52
+
53
+ - [#662](https://github.com/xataio/client-ts/pull/662) [`4a41680`](https://github.com/xataio/client-ts/commit/4a416803761a1c944ef9a76b794020ead6c8f477) Thanks [@SferaDev](https://github.com/SferaDev)! - Add summarize endpoints to SDK
54
+
55
+ ## 0.18.5
56
+
57
+ ### Patch Changes
58
+
59
+ - [#656](https://github.com/xataio/client-ts/pull/656) [`2dc2f5a`](https://github.com/xataio/client-ts/commit/2dc2f5a45529b2ace9127d963fb30214298da2e0) Thanks [@SferaDev](https://github.com/SferaDev)! - Broaden type for AbortSignal
60
+
61
+ ## 0.18.4
62
+
63
+ ### Patch Changes
64
+
65
+ - [#650](https://github.com/xataio/client-ts/pull/650) [`b8d441f`](https://github.com/xataio/client-ts/commit/b8d441f80867322f41989d52c94bba230632782b) Thanks [@xata-bot](https://github.com/xata-bot)! - API: Rename listMigrationRequests to queryMigrationRequests
66
+
67
+ ## 0.18.3
68
+
69
+ ### Patch Changes
70
+
71
+ - [#639](https://github.com/xataio/client-ts/pull/639) [`50fb3c0`](https://github.com/xataio/client-ts/commit/50fb3c0a1cffd03a16cc8b1b21454ea816f2edbb) Thanks [@SferaDev](https://github.com/SferaDev)! - Do not return null for columns not selected
72
+
73
+ ## 0.18.2
74
+
75
+ ### Patch Changes
76
+
77
+ - [#635](https://github.com/xataio/client-ts/pull/635) [`713f9b2`](https://github.com/xataio/client-ts/commit/713f9b2773be99c17d3fcb663e24fe096fa3da48) Thanks [@SferaDev](https://github.com/SferaDev)! - [Search] Add target columns
78
+
79
+ ## 0.18.1
80
+
81
+ ### Patch Changes
82
+
83
+ - [#627](https://github.com/xataio/client-ts/pull/627) [`ad0a5b4`](https://github.com/xataio/client-ts/commit/ad0a5b4bc87b82fdc10008a8ea324a8ca783e678) Thanks [@SferaDev](https://github.com/SferaDev)! - Fix some cases where filters on link and multiple column types are not working
84
+
85
+ ## 0.18.0
86
+
87
+ ### Minor Changes
88
+
89
+ - [#562](https://github.com/xataio/client-ts/pull/562) [`699beb4`](https://github.com/xataio/client-ts/commit/699beb4bbf21cffa001d3f88a03246980e30250b) Thanks [@SferaDev](https://github.com/SferaDev)! - Return null on nullable columns
90
+
91
+ ### Patch Changes
92
+
93
+ - [#583](https://github.com/xataio/client-ts/pull/583) [`330b076`](https://github.com/xataio/client-ts/commit/330b076a0781e3576c82afab76e3fb2a64f2e041) Thanks [@SferaDev](https://github.com/SferaDev)! - Add support for unique columns
94
+
95
+ - [#598](https://github.com/xataio/client-ts/pull/598) [`c3dfb4b`](https://github.com/xataio/client-ts/commit/c3dfb4babc990634b9e9747616ed93223178a2e7) Thanks [@SferaDev](https://github.com/SferaDev)! - API: Add patch database metadata endpoint
96
+
97
+ - [#602](https://github.com/xataio/client-ts/pull/602) [`74b17aa`](https://github.com/xataio/client-ts/commit/74b17aaedc0dbdd79bfdcb182b2e70b61f98f5a5) Thanks [@gimenete](https://github.com/gimenete)! - API: Make workspace slug optional on create
98
+
99
+ - [#615](https://github.com/xataio/client-ts/pull/615) [`83f20cd`](https://github.com/xataio/client-ts/commit/83f20cdbe53706c16016c4db3f318e679b24ec86) Thanks [@SferaDev](https://github.com/SferaDev)! - Make `getMany` return more items than max pagination size
100
+
101
+ - [#562](https://github.com/xataio/client-ts/pull/562) [`addfcc6`](https://github.com/xataio/client-ts/commit/addfcc67fca663defdd340111ea09c9188bad3ab) Thanks [@SferaDev](https://github.com/SferaDev)! - Add `orThrows` methods that instead of returning null, throw an exception.
102
+
103
+ - [#583](https://github.com/xataio/client-ts/pull/583) [`eb7ba59`](https://github.com/xataio/client-ts/commit/eb7ba594be2a1f0ab90956836bbeb912e188a46d) Thanks [@SferaDev](https://github.com/SferaDev)! - Add support for non nullable columns
104
+
105
+ - [#612](https://github.com/xataio/client-ts/pull/612) [`f1a0742`](https://github.com/xataio/client-ts/commit/f1a0742a04e1aefab14f46371a04a41069faec01) Thanks [@xata-bot](https://github.com/xata-bot)! - API: Add summarize table endpoint
106
+
3
107
  ## 0.17.1
4
108
 
5
109
  ### Patch Changes
package/README.md CHANGED
@@ -112,18 +112,18 @@ const user = await xata.db.users.create({
112
112
  });
113
113
  ```
114
114
 
115
- If you want to create a record with a specific ID, you can invoke `insert()`.
115
+ If you want to create a record with a specific ID, you can provide the id as parameter to the `create()` method.
116
116
 
117
117
  ```ts
118
- const user = await xata.db.users.insert('user_admin', {
118
+ const user = await xata.db.users.create('user_admin', {
119
119
  fullName: 'John Smith'
120
120
  });
121
121
  ```
122
122
 
123
- And if you want to create or insert a record with a specific ID, you can invoke `updateOrInsert()`.
123
+ And if you want to create or update a record with a specific ID, you can invoke `createOrUpdate()` with an id parameter.
124
124
 
125
125
  ```ts
126
- const user = await xata.db.users.updateOrInsert('user_admin', {
126
+ const user = await xata.db.users.createOrUpdate('user_admin', {
127
127
  fullName: 'John Smith'
128
128
  });
129
129
  ```
@@ -187,8 +187,8 @@ page.hasNextPage(); // Boolean
187
187
 
188
188
  const nextPage = await page.nextPage(); // Page object
189
189
  const previousPage = await page.previousPage(); // Page object
190
- const firstPage = await page.firstPage(); // Page object
191
- const lastPage = await page.lastPage(); // Page object
190
+ const startPage = await page.startPage(); // Page object
191
+ const endPage = await page.endPage(); // Page object
192
192
  ```
193
193
 
194
194
  If you want to use an iterator, both the Repository and the Query classes implement an `AsyncIterable`. Alternatively you can use `getIterator()` and customize the batch size of the iterator:
@@ -246,8 +246,8 @@ const api = new XataApiClient({ apiKey: process.env.XATA_API_KEY });
246
246
  Once you have initialized the API client, the operations are organized following the same hiearchy as in the [official documentation](https://docs.xata.io). You have different namespaces for each entity (ie. `workspaces`, `databases`, `tables`, `branches`, `users`, `records`...).
247
247
 
248
248
  ```ts
249
- const { id: workspace } = await api.workspaces.createWorkspace({ name: 'example', slug: 'example' });
250
- const { databaseName } = await api.databases.createDatabase(workspace, 'database');
249
+ const { id: workspace } = await api.workspaces.createWorkspace({ name: 'example' });
250
+ const { databaseName } = await api.database.createDatabase(workspace, 'database', { region: 'eu-west-1' });
251
251
 
252
252
  await api.branches.createBranch(workspace, databaseName, 'branch');
253
253
  await api.tables.createTable(workspace, databaseName, 'branch', 'table');
package/Usage.md CHANGED
@@ -41,6 +41,8 @@ To get a collection of records, you can use the `Query` object. It provides the
41
41
  - `getAll()`: returns all the records in the query results by making multiple requests to iterate over all the pages which exist. If the query is not filtered and the table is a large dataset, this operation can affect the performance.
42
42
  - `getMany()`: returns an array with a subset of the first results in the query. The default [pagination](#page) size (20) is used and can be customised by passing a different `{ pagination: { size: number } }` in its options. To learn more about default values, see [helper variables](#helper-variables).
43
43
 
44
+ Both the `getAll()` and `getMany()` will produce multiple requests to the server if the query should return more than the maximum page size. We perform the minimum number of requests to get the desired number of records.
45
+
44
46
  All these methods allow customising its filters, column selection, column ordering, pagination or cache TTL. For example:
45
47
 
46
48
  ```ts
@@ -327,8 +329,8 @@ It contains:
327
329
  - `hasNextPage`: Function that returns a boolean indicating if there is a next page.
328
330
  - `nextPage`: Async function that can be used to get the next page.
329
331
  - `previousPage`: Async function that can be used to get the previous page.
330
- - `firstPage`: Async function that can be used to get the first page.
331
- - `lastPage`: Async function that can be used to get the last page.
332
+ - `startPage`: Async function that can be used to get the start page.
333
+ - `endPage`: Async function that can be used to get the end page.
332
334
  - `meta`: Information about the current page and its cursor.
333
335
 
334
336
  ```ts
@@ -342,14 +344,14 @@ page2.records; // Array of `XataRecord` objects.
342
344
  const page1 = await page2.previousPage();
343
345
  page1.records; // Array of `XataRecord` objects.
344
346
 
345
- const firstPage = await page1.firstPage();
346
- firstPage.records; // Array of `XataRecord` objects.
347
+ const startPage = await page1.startPage();
348
+ startPage.records; // Array of `XataRecord` objects.
347
349
  ```
348
350
 
349
351
  The `Repository` class implements the `Query` interface, so you can use it to paginate the records in the table too.
350
352
 
351
353
  ```ts
352
- const page = await xata.db.users.firstPage();
354
+ const page = await xata.db.users.startPage();
353
355
  page.records; // Array of `XataRecord` objects.
354
356
  ```
355
357