@xata.io/client 0.13.4 → 0.16.0

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,45 @@
1
1
  # @xata.io/client
2
2
 
3
+ ## 0.16.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#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
8
+
9
+ * [#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
10
+
11
+ ### Patch Changes
12
+
13
+ - [#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
14
+
15
+ * [#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
16
+
17
+ ## 0.15.0
18
+
19
+ ### Patch Changes
20
+
21
+ - [#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
22
+
23
+ * [#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
24
+
25
+ ## 0.14.0
26
+
27
+ ### Minor Changes
28
+
29
+ - [#409](https://github.com/xataio/client-ts/pull/409) [`8812380`](https://github.com/xataio/client-ts/commit/881238062b5eeac2dc8b9ba156720e0acc22c5c5) Thanks [@SferaDev](https://github.com/SferaDev)! - Infer types from schema in codegen
30
+
31
+ * [#457](https://github.com/xataio/client-ts/pull/457) [`0584a5b`](https://github.com/xataio/client-ts/commit/0584a5b207a21dbc36ddc1d44b276f1d5bb60dc5) Thanks [@SferaDev](https://github.com/SferaDev)! - Load env variables so that code analysis detects them
32
+
33
+ - [#469](https://github.com/xataio/client-ts/pull/469) [`8d8a912`](https://github.com/xataio/client-ts/commit/8d8a9129e36452266c4c12fe35b421f66e572498) Thanks [@gimenete](https://github.com/gimenete)! - Treat branch name specified with third party env variables as git branches in the resolution algorithm
34
+
35
+ ### Patch Changes
36
+
37
+ - [#462](https://github.com/xataio/client-ts/pull/462) [`7547b7e`](https://github.com/xataio/client-ts/commit/7547b7edbc9a95c6620784cc5348316f27502c73) Thanks [@SferaDev](https://github.com/SferaDev)! - Fix bug with RecordArray.map
38
+
39
+ * [#472](https://github.com/xataio/client-ts/pull/472) [`e99010c`](https://github.com/xataio/client-ts/commit/e99010c9ab9d355abadcfbcf98b5a3fcc80c307a) Thanks [@SferaDev](https://github.com/SferaDev)! - Add id as entity property
40
+
41
+ - [#443](https://github.com/xataio/client-ts/pull/443) [`c4be404`](https://github.com/xataio/client-ts/commit/c4be404a3ecb34df9b1ef4501c92f5bdc221f19c) Thanks [@SferaDev](https://github.com/SferaDev)! - Improve performance with `create([])` operation
42
+
3
43
  ## 0.13.4
4
44
 
5
45
  ### Patch 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