@xata.io/client 0.14.0 → 0.16.1

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,37 @@
1
1
  # @xata.io/client
2
2
 
3
+ ## 0.16.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#531](https://github.com/xataio/client-ts/pull/531) [`e33d8fb`](https://github.com/xataio/client-ts/commit/e33d8fbca264d3ab1597ed698d5e79484dcba8a3) Thanks [@xata-bot](https://github.com/xata-bot)! - Add new method to list database metadata in the API client
8
+
9
+ * [#524](https://github.com/xataio/client-ts/pull/524) [`a3b1044`](https://github.com/xataio/client-ts/commit/a3b1044038c4ae73b4aacaa112818e69b7d380e1) Thanks [@SferaDev](https://github.com/SferaDev)! - Expose internal config information
10
+
11
+ - [#525](https://github.com/xataio/client-ts/pull/525) [`5f0f2c2`](https://github.com/xataio/client-ts/commit/5f0f2c2bb42da360e810f0a61ce360f8f8b07a04) Thanks [@xata-bot](https://github.com/xata-bot)! - Update dependencies
12
+
13
+ ## 0.16.0
14
+
15
+ ### Minor Changes
16
+
17
+ - [#485](https://github.com/xataio/client-ts/pull/485) [`a9cbb26`](https://github.com/xataio/client-ts/commit/a9cbb263fbca47cb91a827db252d95a5bb4079a6) Thanks [@SferaDev](https://github.com/SferaDev)! - Allow selecting columns with record operations
18
+
19
+ * [#485](https://github.com/xataio/client-ts/pull/485) [`7e04a3d`](https://github.com/xataio/client-ts/commit/7e04a3d1c51958a44f687a0036ead8bb3f5a2dfb) Thanks [@SferaDev](https://github.com/SferaDev)! - Remove record cache
20
+
21
+ ### Patch Changes
22
+
23
+ - [#503](https://github.com/xataio/client-ts/pull/503) [`6a96ea5`](https://github.com/xataio/client-ts/commit/6a96ea5da4c5b7ca9a99b57ebbce8d6766b5d4d8) Thanks [@xata-bot](https://github.com/xata-bot)! - Update API response types for create of tables and branches
24
+
25
+ * [#421](https://github.com/xataio/client-ts/pull/421) [`43f2560`](https://github.com/xataio/client-ts/commit/43f25605ddd0d2fd514a1542a14389d28955c500) Thanks [@SferaDev](https://github.com/SferaDev)! - Add search boosters and allow prefix search
26
+
27
+ ## 0.15.0
28
+
29
+ ### Patch Changes
30
+
31
+ - [#496](https://github.com/xataio/client-ts/pull/496) [`e923d11`](https://github.com/xataio/client-ts/commit/e923d11fe357519dc4ca3ae722670e6e70ccd1c6) Thanks [@gimenete](https://github.com/gimenete)! - Ignore git output in Xata client
32
+
33
+ * [#481](https://github.com/xataio/client-ts/pull/481) [`599b52c`](https://github.com/xataio/client-ts/commit/599b52c3090222eedef85d1ad1e907874cd3e801) Thanks [@xata-bot](https://github.com/xata-bot)! - Add updateWorkspaceMemberInvite API method
34
+
3
35
  ## 0.14.0
4
36
 
5
37
  ### Minor Changes
package/Usage.md CHANGED
@@ -155,6 +155,13 @@ const user = await xata.db.users.read(object1);
155
155
  const users = await xata.db.users.read([object1, object2]);
156
156
  ```
157
157
 
158
+ By default an object with the first level properties is returned. If you want to reduce or expand its columns, you can pass an array of columns to the `read()` method.
159
+
160
+ ```ts
161
+ const user = await xata.db.users.read('rec_1234abcdef', ['fullName', 'team.name']);
162
+ const users = await xata.db.users.read(['rec_1234abcdef', 'rec_5678defgh'], ['fullName', 'team.name']);
163
+ ```
164
+
158
165
  ### Creating Records
159
166
 
160
167
  Both the `create()` and `createOrUpdate()` methods can be used to create a new record.
@@ -202,6 +209,19 @@ const users = await xata.db.users.createOrUpdate([
202
209
  ]);
203
210
  ```
204
211
 
212
+ By default, the `create` and `createOrUpdate` methods will return the created record with the first level properties. If you want to reduce or expand its columns, you can pass an array of columns to the `create` or `createOrUpdate` method.
213
+
214
+ ```ts
215
+ const user = await xata.db.users.create('user_admin', { fullName: 'John Smith' }, ['fullName', 'team.name']);
216
+ const users = await xata.db.users.createOrUpdate(
217
+ [
218
+ { id: 'user_admin', fullName: 'John Smith' },
219
+ { id: 'user_manager', fullName: 'Jane Doe' }
220
+ ],
221
+ ['fullName', 'team.name']
222
+ );
223
+ ```
224
+
205
225
  ### Updating records
206
226
 
207
227
  The `update()` method can be used to update an existing record. It will throw an `Error` if the record cannot be found.
@@ -225,6 +245,12 @@ const users = await xata.db.users.update([
225
245
  ]);
226
246
  ```
227
247
 
248
+ By default, the `update` method will return the updated record with the first level properties. If you want to reduce or expand its columns, you can pass an array of columns to the `update` method.
249
+
250
+ ```ts
251
+ const user = await xata.db.users.update('rec_1234abcdef', { fullName: 'John Smith' }, ['fullName', 'team.name']);
252
+ ```
253
+
228
254
  ### Deleting Records
229
255
 
230
256
  The `delete()` method can be used to delete an existing record. It will throw an `Error` if the record cannot be found.
@@ -373,6 +399,13 @@ user?.update({ fullName: 'John Doe' }); // Partially updates the record
373
399
  user?.delete(); // Deletes the record
374
400
  ```
375
401
 
402
+ The `read` and `update` methods return the updated record with the first level properties. If you want to reduce or expand its columns, you can pass an array of columns to the `read` and `update` methods.
403
+
404
+ ```ts
405
+ const user = await xata.db.users.read('rec_1234abcdef');
406
+ user?.read(['fullName', 'team.name']); // Reads the record again with the `fullName` and `team.name` columns
407
+ ```
408
+
376
409
  If the table contains a link property, it will be represented as a `Link` object containing its `id` property and methods to read again or update the linked record.
377
410
 
378
411
  ```ts