@xata.io/client 0.0.0-alpha.vfae42b5 → 0.0.0-alpha.vfafe7e2
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 +326 -0
- package/README.md +85 -70
- package/Usage.md +451 -0
- package/dist/index.cjs +2397 -833
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5472 -1515
- package/dist/index.mjs +2360 -833
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -5
- /package/{rollup.config.js → rollup.config.mjs} +0 -0
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,331 @@
|
|
1
1
|
# @xata.io/client
|
2
2
|
|
3
|
+
## 0.21.5
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [#825](https://github.com/xataio/client-ts/pull/825) [`41c4d29f`](https://github.com/xataio/client-ts/commit/41c4d29f9f9fc7ce87b755e447a2030fe8c10d70) Thanks [@SferaDev](https://github.com/SferaDev)! - Export fetcher error
|
8
|
+
|
9
|
+
## 0.21.4
|
10
|
+
|
11
|
+
### Patch Changes
|
12
|
+
|
13
|
+
- [#816](https://github.com/xataio/client-ts/pull/816) [`a0149435`](https://github.com/xataio/client-ts/commit/a01494358ae3a8dd9d7eba3a276fe6f8b7827a33) Thanks [@SferaDev](https://github.com/SferaDev)! - Improve types for datetime fields accepting strings
|
14
|
+
|
15
|
+
## 0.21.3
|
16
|
+
|
17
|
+
### Patch Changes
|
18
|
+
|
19
|
+
- [#792](https://github.com/xataio/client-ts/pull/792) [`6c96da45`](https://github.com/xataio/client-ts/commit/6c96da4533500ec236547f47310e99461d5457e8) Thanks [@SferaDev](https://github.com/SferaDev)! - Update workers return type helper
|
20
|
+
|
21
|
+
## 0.21.2
|
22
|
+
|
23
|
+
### Patch Changes
|
24
|
+
|
25
|
+
- [#787](https://github.com/xataio/client-ts/pull/787) [`93f5beed`](https://github.com/xataio/client-ts/commit/93f5beed77785b03409c614f5e2c3eca4c69c574) Thanks [@SferaDev](https://github.com/SferaDev)! - Expose consistency options
|
26
|
+
|
27
|
+
- [#784](https://github.com/xataio/client-ts/pull/784) [`cbe0609e`](https://github.com/xataio/client-ts/commit/cbe0609ec9d6650030efbda712a1eb243287525d) Thanks [@SferaDev](https://github.com/SferaDev)! - Update resolveBranch behaviour
|
28
|
+
|
29
|
+
## 0.21.1
|
30
|
+
|
31
|
+
### Patch Changes
|
32
|
+
|
33
|
+
- [#781](https://github.com/xataio/client-ts/pull/781) [`fdfa47de`](https://github.com/xataio/client-ts/commit/fdfa47de93ec772170ff00a4341fc14434347df5) Thanks [@SferaDev](https://github.com/SferaDev)! - Send header to disable encoding
|
34
|
+
|
35
|
+
## 0.21.0
|
36
|
+
|
37
|
+
### Minor Changes
|
38
|
+
|
39
|
+
- [#757](https://github.com/xataio/client-ts/pull/757) [`7da604d2`](https://github.com/xataio/client-ts/commit/7da604d27990e20ecadba6122434fca563e6a8c9) Thanks [@SferaDev](https://github.com/SferaDev)! - Add promise pool for retries
|
40
|
+
|
41
|
+
### Patch Changes
|
42
|
+
|
43
|
+
- [#764](https://github.com/xataio/client-ts/pull/764) [`b131040a`](https://github.com/xataio/client-ts/commit/b131040a2d142c4e71a2e586fbf05cd9295af9a1) Thanks [@SferaDev](https://github.com/SferaDev)! - Fix bun
|
44
|
+
|
45
|
+
- [#759](https://github.com/xataio/client-ts/pull/759) [`7ea810dc`](https://github.com/xataio/client-ts/commit/7ea810dc083ec284447e3bd27bd0465f887481e6) Thanks [@SferaDev](https://github.com/SferaDev)! - Expose new transaction API
|
46
|
+
|
47
|
+
- [#767](https://github.com/xataio/client-ts/pull/767) [`d124cbfb`](https://github.com/xataio/client-ts/commit/d124cbfb93d3d591e79bbe9e94c4b6304d825e71) Thanks [@SferaDev](https://github.com/SferaDev)! - Remove formatVersion from schema
|
48
|
+
|
49
|
+
- [#767](https://github.com/xataio/client-ts/pull/767) [`d124cbfb`](https://github.com/xataio/client-ts/commit/d124cbfb93d3d591e79bbe9e94c4b6304d825e71) Thanks [@SferaDev](https://github.com/SferaDev)! - Fix null value returning on date columns
|
50
|
+
|
51
|
+
- [#775](https://github.com/xataio/client-ts/pull/775) [`fb5ccdf9`](https://github.com/xataio/client-ts/commit/fb5ccdf9fa95c37d54fbc5d9c0bb45872c831609) Thanks [@SferaDev](https://github.com/SferaDev)! - Add missing target field to search
|
52
|
+
|
53
|
+
- [#760](https://github.com/xataio/client-ts/pull/760) [`4ae00036`](https://github.com/xataio/client-ts/commit/4ae00036b53c6c89e02a1fcfdd992f1a3c22892c) Thanks [@SferaDev](https://github.com/SferaDev)! - Add support for filters in boosters
|
54
|
+
|
55
|
+
- [#766](https://github.com/xataio/client-ts/pull/766) [`bdae6668`](https://github.com/xataio/client-ts/commit/bdae6668fb571d29f1b1068a54f6866a80d9b174) Thanks [@SferaDev](https://github.com/SferaDev)! - Remove beta for Workers
|
56
|
+
|
57
|
+
- [#771](https://github.com/xataio/client-ts/pull/771) [`9486bdcc`](https://github.com/xataio/client-ts/commit/9486bdccc0af567bc5f2e8f91592b0143c539c45) Thanks [@SferaDev](https://github.com/SferaDev)! - Add modifier for numeric booster
|
58
|
+
|
59
|
+
- [#771](https://github.com/xataio/client-ts/pull/771) [`9486bdcc`](https://github.com/xataio/client-ts/commit/9486bdccc0af567bc5f2e8f91592b0143c539c45) Thanks [@SferaDev](https://github.com/SferaDev)! - Add pagination to search
|
60
|
+
|
61
|
+
## 0.20.2
|
62
|
+
|
63
|
+
### Patch Changes
|
64
|
+
|
65
|
+
- [#756](https://github.com/xataio/client-ts/pull/756) [`27b73745`](https://github.com/xataio/client-ts/commit/27b737451227cf12774115ccb70649f6bbf76180) Thanks [@SferaDev](https://github.com/SferaDev)! - Fix update method with id in payload
|
66
|
+
|
67
|
+
- [#726](https://github.com/xataio/client-ts/pull/726) [`47a1f878`](https://github.com/xataio/client-ts/commit/47a1f87850a7178dad656a16d2584eee6ce68f29) Thanks [@SferaDev](https://github.com/SferaDev)! - Use transactions API internally for bulk operations
|
68
|
+
|
69
|
+
- [#726](https://github.com/xataio/client-ts/pull/726) [`adde9b10`](https://github.com/xataio/client-ts/commit/adde9b10708182295dee07c203c7bf737806e49e) Thanks [@SferaDev](https://github.com/SferaDev)! - Allow sending bulk operations of more than the limit
|
70
|
+
|
71
|
+
## 0.20.1
|
72
|
+
|
73
|
+
### Patch Changes
|
74
|
+
|
75
|
+
- [#744](https://github.com/xataio/client-ts/pull/744) [`98298ca`](https://github.com/xataio/client-ts/commit/98298ca1312a2256ee3e9d2700a9f3d3e316abe5) Thanks [@xata-bot](https://github.com/xata-bot)! - Add deno entry point
|
76
|
+
|
77
|
+
## 0.20.0
|
78
|
+
|
79
|
+
### Minor Changes
|
80
|
+
|
81
|
+
- [#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
|
82
|
+
|
83
|
+
### Patch Changes
|
84
|
+
|
85
|
+
- [#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
|
86
|
+
|
87
|
+
- [#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
|
88
|
+
|
89
|
+
- [#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
|
90
|
+
|
91
|
+
- [#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
|
92
|
+
|
93
|
+
## 0.19.1
|
94
|
+
|
95
|
+
### Patch Changes
|
96
|
+
|
97
|
+
- [#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
|
98
|
+
|
99
|
+
## 0.19.0
|
100
|
+
|
101
|
+
### Minor Changes
|
102
|
+
|
103
|
+
- [#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
|
104
|
+
|
105
|
+
- [#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
|
106
|
+
|
107
|
+
### Patch Changes
|
108
|
+
|
109
|
+
- [#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
|
110
|
+
|
111
|
+
- [#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+
|
112
|
+
|
113
|
+
- [#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
|
114
|
+
|
115
|
+
- [#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
|
116
|
+
|
117
|
+
## 0.18.6
|
118
|
+
|
119
|
+
### Patch Changes
|
120
|
+
|
121
|
+
- [#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
|
122
|
+
|
123
|
+
- [#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
|
124
|
+
|
125
|
+
- [#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
|
126
|
+
|
127
|
+
- [#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
|
128
|
+
|
129
|
+
## 0.18.5
|
130
|
+
|
131
|
+
### Patch Changes
|
132
|
+
|
133
|
+
- [#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
|
134
|
+
|
135
|
+
## 0.18.4
|
136
|
+
|
137
|
+
### Patch Changes
|
138
|
+
|
139
|
+
- [#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
|
140
|
+
|
141
|
+
## 0.18.3
|
142
|
+
|
143
|
+
### Patch Changes
|
144
|
+
|
145
|
+
- [#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
|
146
|
+
|
147
|
+
## 0.18.2
|
148
|
+
|
149
|
+
### Patch Changes
|
150
|
+
|
151
|
+
- [#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
|
152
|
+
|
153
|
+
## 0.18.1
|
154
|
+
|
155
|
+
### Patch Changes
|
156
|
+
|
157
|
+
- [#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
|
158
|
+
|
159
|
+
## 0.18.0
|
160
|
+
|
161
|
+
### Minor Changes
|
162
|
+
|
163
|
+
- [#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
|
164
|
+
|
165
|
+
### Patch Changes
|
166
|
+
|
167
|
+
- [#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
|
168
|
+
|
169
|
+
- [#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
|
170
|
+
|
171
|
+
- [#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
|
172
|
+
|
173
|
+
- [#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
|
174
|
+
|
175
|
+
- [#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.
|
176
|
+
|
177
|
+
- [#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
|
178
|
+
|
179
|
+
- [#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
|
180
|
+
|
181
|
+
## 0.17.1
|
182
|
+
|
183
|
+
### Patch Changes
|
184
|
+
|
185
|
+
- [#584](https://github.com/xataio/client-ts/pull/584) [`a305072`](https://github.com/xataio/client-ts/commit/a3050726517632b4975f2a2ed5f771dd247e51d5) Thanks [@SferaDev](https://github.com/SferaDev)! - Fix issues with multiple filters
|
186
|
+
|
187
|
+
* [#249](https://github.com/xataio/client-ts/pull/249) [`7812a41`](https://github.com/xataio/client-ts/commit/7812a414b7d99e9515c0ce48a61ad7a8b84d65d0) Thanks [@xata-bot](https://github.com/xata-bot)! - API: Add first endpoints for migration requests and schema compare
|
188
|
+
|
189
|
+
- [#585](https://github.com/xataio/client-ts/pull/585) [`d4a8ced`](https://github.com/xataio/client-ts/commit/d4a8ced9c257058ed7f660e01ee5fd1da154c391) Thanks [@SferaDev](https://github.com/SferaDev)! - Fix problem with some special characters not being URI encoded
|
190
|
+
|
191
|
+
* [#574](https://github.com/xataio/client-ts/pull/574) [`cf85b13`](https://github.com/xataio/client-ts/commit/cf85b13e1ca69e79100fd02f58d79d556012395d) Thanks [@SferaDev](https://github.com/SferaDev)! - Do not allow unknown tables on codegen output
|
192
|
+
|
193
|
+
- [#576](https://github.com/xataio/client-ts/pull/576) [`2350739`](https://github.com/xataio/client-ts/commit/2350739d3f0a176b0f1fc77b0f4f597321349726) Thanks [@SferaDev](https://github.com/SferaDev)! - Allow sending empty, undefined or conditional filters
|
194
|
+
|
195
|
+
* [#581](https://github.com/xataio/client-ts/pull/581) [`a336e61`](https://github.com/xataio/client-ts/commit/a336e6161be04a652e6f0f0a4c2edac10d50c99e) Thanks [@SferaDev](https://github.com/SferaDev)! - Update error codes in tracing
|
196
|
+
|
197
|
+
## 0.17.0
|
198
|
+
|
199
|
+
### Minor Changes
|
200
|
+
|
201
|
+
- [#563](https://github.com/xataio/client-ts/pull/563) [`26e91d1`](https://github.com/xataio/client-ts/commit/26e91d1d84df082dedd7159271fc7c27ec87fefe) Thanks [@SferaDev](https://github.com/SferaDev)! - Return nulls on operations that can fail
|
202
|
+
|
203
|
+
* [#563](https://github.com/xataio/client-ts/pull/563) [`3332d43`](https://github.com/xataio/client-ts/commit/3332d43121367f61c8d87dfb7da2af65bd1c278f) Thanks [@SferaDev](https://github.com/SferaDev)! - Return object on delete operation
|
204
|
+
|
205
|
+
## 0.16.2
|
206
|
+
|
207
|
+
### Patch Changes
|
208
|
+
|
209
|
+
- [#541](https://github.com/xataio/client-ts/pull/541) [`c74467c`](https://github.com/xataio/client-ts/commit/c74467caeff4e3d60d0981a173b462e970c6c1fc) Thanks [@SferaDev](https://github.com/SferaDev)! - Add tracing with open telemetry
|
210
|
+
|
211
|
+
* [#551](https://github.com/xataio/client-ts/pull/551) [`ee72bfe`](https://github.com/xataio/client-ts/commit/ee72bfef34765374ec66c7edaa6b5508c3f8e8dc) Thanks [@SferaDev](https://github.com/SferaDev)! - Fix filter operators and dates
|
212
|
+
|
213
|
+
- [#552](https://github.com/xataio/client-ts/pull/552) [`e88effa`](https://github.com/xataio/client-ts/commit/e88effa00f8c2c0e24ec8cd60fb21859ac236191) Thanks [@SferaDev](https://github.com/SferaDev)! - Update error message for required settings
|
214
|
+
|
215
|
+
* [#551](https://github.com/xataio/client-ts/pull/551) [`33293b3`](https://github.com/xataio/client-ts/commit/33293b3509d984bb9b1af457c96260d43f398efe) Thanks [@SferaDev](https://github.com/SferaDev)! - Add aliases for some operators
|
216
|
+
|
217
|
+
- [#534](https://github.com/xataio/client-ts/pull/534) [`efc09b4`](https://github.com/xataio/client-ts/commit/efc09b420a25253b428662c2eec40ff3bc36ce79) Thanks [@SferaDev](https://github.com/SferaDev)! - Make sort direction optional
|
218
|
+
|
219
|
+
## 0.16.1
|
220
|
+
|
221
|
+
### Patch Changes
|
222
|
+
|
223
|
+
- [#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
|
224
|
+
|
225
|
+
* [#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
|
226
|
+
|
227
|
+
- [#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
|
228
|
+
|
229
|
+
## 0.16.0
|
230
|
+
|
231
|
+
### Minor Changes
|
232
|
+
|
233
|
+
- [#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
|
234
|
+
|
235
|
+
* [#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
|
236
|
+
|
237
|
+
### Patch Changes
|
238
|
+
|
239
|
+
- [#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
|
240
|
+
|
241
|
+
* [#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
|
242
|
+
|
243
|
+
## 0.15.0
|
244
|
+
|
245
|
+
### Patch Changes
|
246
|
+
|
247
|
+
- [#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
|
248
|
+
|
249
|
+
* [#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
|
250
|
+
|
251
|
+
## 0.14.0
|
252
|
+
|
253
|
+
### Minor Changes
|
254
|
+
|
255
|
+
- [#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
|
256
|
+
|
257
|
+
* [#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
|
258
|
+
|
259
|
+
- [#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
|
260
|
+
|
261
|
+
### Patch Changes
|
262
|
+
|
263
|
+
- [#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
|
264
|
+
|
265
|
+
* [#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
|
266
|
+
|
267
|
+
- [#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
|
268
|
+
|
269
|
+
## 0.13.4
|
270
|
+
|
271
|
+
### Patch Changes
|
272
|
+
|
273
|
+
- [#444](https://github.com/xataio/client-ts/pull/444) [`3c3a5af`](https://github.com/xataio/client-ts/commit/3c3a5afb1d5fb3295fd8cf6c2b66709a5c047507) Thanks [@SferaDev](https://github.com/SferaDev)! - Publish xata client on deno.land
|
274
|
+
|
275
|
+
## 0.13.3
|
276
|
+
|
277
|
+
### Patch Changes
|
278
|
+
|
279
|
+
- [#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
|
280
|
+
|
281
|
+
## 0.13.2
|
282
|
+
|
283
|
+
### Patch Changes
|
284
|
+
|
285
|
+
- [#431](https://github.com/xataio/client-ts/pull/431) [`8f62024`](https://github.com/xataio/client-ts/commit/8f62024101028b981dc31a68fb258e89110d45dc) Thanks [@SferaDev](https://github.com/SferaDev)! - Include request ids in the error response
|
286
|
+
|
287
|
+
* [#429](https://github.com/xataio/client-ts/pull/429) [`bb102b4`](https://github.com/xataio/client-ts/commit/bb102b46b722d0a61996c42cda991c9f0080e464) Thanks [@SferaDev](https://github.com/SferaDev)! - Avoid detection of `Buffer` in edge runtime middleware
|
288
|
+
|
289
|
+
- [#428](https://github.com/xataio/client-ts/pull/428) [`06740ca`](https://github.com/xataio/client-ts/commit/06740cad216831216f0be8cf9de7e354c0ef9191) Thanks [@SferaDev](https://github.com/SferaDev)! - Improve selection types to make them more readable
|
290
|
+
|
291
|
+
## 0.13.1
|
292
|
+
|
293
|
+
### Patch Changes
|
294
|
+
|
295
|
+
- [#417](https://github.com/xataio/client-ts/pull/417) [`86a14ec`](https://github.com/xataio/client-ts/commit/86a14eccbca94f572252327c9c0306577a1c3ebd) Thanks [@SferaDev](https://github.com/SferaDev)! - Update User-Agent
|
296
|
+
|
297
|
+
* [#422](https://github.com/xataio/client-ts/pull/422) [`2896418`](https://github.com/xataio/client-ts/commit/289641844e5b2752197dbbbf3a93ef6068b684e4) Thanks [@SferaDev](https://github.com/SferaDev)! - Allow sending link as string id
|
298
|
+
|
299
|
+
- [#420](https://github.com/xataio/client-ts/pull/420) [`301b21f`](https://github.com/xataio/client-ts/commit/301b21f4784f755a8694ca21a0f2fd48e1b16df4) Thanks [@SferaDev](https://github.com/SferaDev)! - Exclude date internal columns in selection
|
300
|
+
|
301
|
+
* [#399](https://github.com/xataio/client-ts/pull/399) [`dd4b2ef`](https://github.com/xataio/client-ts/commit/dd4b2effed2251ac8afbfb2909c21a9deb35bef1) Thanks [@SferaDev](https://github.com/SferaDev)! - Allow create many objects mixed some with ids others without
|
302
|
+
|
303
|
+
- [#425](https://github.com/xataio/client-ts/pull/425) [`00279ff`](https://github.com/xataio/client-ts/commit/00279ff985793020237f8098cba97dfec7738f82) Thanks [@SferaDev](https://github.com/SferaDev)! - Do not send falsy values to query string
|
304
|
+
|
305
|
+
* [#399](https://github.com/xataio/client-ts/pull/399) [`8e66998`](https://github.com/xataio/client-ts/commit/8e6699867a1aa1968d12db4ced80c13d4b951f88) Thanks [@SferaDev](https://github.com/SferaDev)! - Allow passing identifiable objects to `read()` operations
|
306
|
+
|
307
|
+
- [#425](https://github.com/xataio/client-ts/pull/425) [`8a4e019`](https://github.com/xataio/client-ts/commit/8a4e019031e678d946cf9dfb0e4803906fad9b5f) Thanks [@SferaDev](https://github.com/SferaDev)! - Add fallback branch to `api.databases.resolveBranch`
|
308
|
+
|
309
|
+
## 0.13.0
|
310
|
+
|
311
|
+
### Minor Changes
|
312
|
+
|
313
|
+
- [#375](https://github.com/xataio/client-ts/pull/375) [`c9f34ad`](https://github.com/xataio/client-ts/commit/c9f34ad37d75203083a1dec2fac2b03e096521af) Thanks [@SferaDev](https://github.com/SferaDev)! - Change default pagination size to 20
|
314
|
+
|
315
|
+
* [#375](https://github.com/xataio/client-ts/pull/375) [`5f82e43`](https://github.com/xataio/client-ts/commit/5f82e4394010f40dcbf3faf2d0bdb58a6fc1c37a) Thanks [@SferaDev](https://github.com/SferaDev)! - Return a paginable object in getPaginated
|
316
|
+
|
317
|
+
## 0.12.0
|
318
|
+
|
319
|
+
### Minor Changes
|
320
|
+
|
321
|
+
- [#376](https://github.com/xataio/client-ts/pull/376) [`db3c88e`](https://github.com/xataio/client-ts/commit/db3c88e1f2bee6d308afb8d6e95b7c090a87e7a7) Thanks [@SferaDev](https://github.com/SferaDev)! - Hide xata object and expose getMetadata method
|
322
|
+
|
323
|
+
### Patch Changes
|
324
|
+
|
325
|
+
- [#364](https://github.com/xataio/client-ts/pull/364) [`1cde95f`](https://github.com/xataio/client-ts/commit/1cde95f05a6b9fbf0564ea05400140f0cef41a3a) Thanks [@SferaDev](https://github.com/SferaDev)! - Add peer dep of TS 4.5+
|
326
|
+
|
327
|
+
* [#362](https://github.com/xataio/client-ts/pull/362) [`57bf0e2`](https://github.com/xataio/client-ts/commit/57bf0e2e049ed0498683ff42d287983f295342b7) Thanks [@SferaDev](https://github.com/SferaDev)! - Do not show error if date is not defined
|
328
|
+
|
3
329
|
## 0.11.0
|
4
330
|
|
5
331
|
### Minor Changes
|
package/README.md
CHANGED
@@ -1,10 +1,28 @@
|
|
1
1
|
# Xata SDK for TypeScript and JavaScript
|
2
2
|
|
3
|
-
This SDK has zero dependencies, so it can be used in many JavaScript runtimes including Node.js, Cloudflare workers, Deno, Electron, etc.
|
3
|
+
This SDK has zero dependencies, so it can be used in many JavaScript runtimes including Node.js, Cloudflare workers, Deno, Electron, etc. It also works in browsers for the same reason. But this is strongly discouraged because you can easily leak your API keys from browsers.
|
4
4
|
|
5
|
-
|
5
|
+
## Table of Contents
|
6
6
|
|
7
|
-
|
7
|
+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
8
|
+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
9
|
+
|
10
|
+
- [Installation](#installation)
|
11
|
+
- [Usage](#usage)
|
12
|
+
- [Schema-generated Client](#schema-generated-client)
|
13
|
+
- [Schema-less Client](#schema-less-client)
|
14
|
+
- [API Design](#api-design)
|
15
|
+
- [Creating Records](#creating-records)
|
16
|
+
- [Query a Single Record by its ID](#query-a-single-record-by-its-id)
|
17
|
+
- [Querying Multiple Records](#querying-multiple-records)
|
18
|
+
- [Updating Records](#updating-records)
|
19
|
+
- [Deleting Records](#deleting-records)
|
20
|
+
- [API Client](#api-client)
|
21
|
+
- [Deno support](#deno-support)
|
22
|
+
|
23
|
+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
24
|
+
|
25
|
+
## Installation
|
8
26
|
|
9
27
|
```bash
|
10
28
|
npm install @xata.io/client
|
@@ -20,7 +38,7 @@ There are three ways to use the SDK:
|
|
20
38
|
|
21
39
|
### Schema-generated Client
|
22
40
|
|
23
|
-
To use the schema-generated client, you need to run the code generator utility that comes with [our CLI](
|
41
|
+
To use the schema-generated client, you need to run the code generator utility that comes with [our CLI](https://docs.xata.io/cli/getting-started).
|
24
42
|
|
25
43
|
To run it (and assuming you have configured the project with `xata init`):
|
26
44
|
|
@@ -28,19 +46,17 @@ To run it (and assuming you have configured the project with `xata init`):
|
|
28
46
|
xata codegen
|
29
47
|
```
|
30
48
|
|
31
|
-
In a TypeScript file start using the generated code:
|
49
|
+
In a TypeScript file, start using the generated code like this:
|
32
50
|
|
33
51
|
```ts
|
34
|
-
import { XataClient } from './xata';
|
52
|
+
import { XataClient } from './xata'; // or wherever you chose to generate the client
|
35
53
|
|
36
|
-
const xata = new XataClient(
|
37
|
-
fetch: fetchImplementation // Required if your runtime doesn't provide a global `fetch` function.
|
38
|
-
});
|
54
|
+
const xata = new XataClient();
|
39
55
|
```
|
40
56
|
|
41
|
-
The import above will differ if you chose to
|
57
|
+
The import above will differ if you chose to generate the code in a different location.
|
42
58
|
|
43
|
-
The `fetch`
|
59
|
+
The `XataClient` constructor accepts an object with configuration options, like the `fetch` parameter, which is required only if your runtime doesn't provide a global `fetch` function. There's also a `databaseURL` argument that by default will contain a URL pointing to your database (e.g. `https://myworkspace-123abc.xata.sh/db/databasename`). It can be specified in the constructor to overwrite that value if for whatever reason you need to connect to a different workspace or database.
|
44
60
|
|
45
61
|
The code generator will create two TypeScript types for each schema entity. The base one will be an `Identifiable` entity with the internal properties your entity has and the `Record` one will extend it with a set of operations (update, delete, etc...) and some schema metadata (xata version).
|
46
62
|
|
@@ -60,7 +76,7 @@ await admin.update({ email: 'admin@foo.bar' });
|
|
60
76
|
await admin.delete();
|
61
77
|
```
|
62
78
|
|
63
|
-
You will learn more about the available operations below, under the `API Design` section.
|
79
|
+
You will learn more about the available operations below, under the [`API Design`](#api-design) section.
|
64
80
|
|
65
81
|
### Schema-less Client
|
66
82
|
|
@@ -78,15 +94,15 @@ const xata = new BaseClient({
|
|
78
94
|
|
79
95
|
It works the same way as the code-generated `XataClient` but doesn't provide type-safety for your model.
|
80
96
|
|
81
|
-
You can read more on the methods available below,
|
97
|
+
You can read more on the methods available below, in the next section.
|
82
98
|
|
83
99
|
### API Design
|
84
100
|
|
85
|
-
The Xata SDK to create/read/update/delete records follows the repository pattern. Each table will have a repository object available at `xata.db.[table-name]`.
|
101
|
+
The Xata SDK to create/read/update/delete records follows the [repository pattern](https://lyz-code.github.io/blue-book/architecture/repository_pattern/). Each table will have a repository object available at `xata.db.[table-name]`.
|
86
102
|
|
87
|
-
For example if you have a `users` table there'll be a repository at `xata.db.users`. If you're using the schema-less client, you can also use the `xata.db.[table-name]` syntax to access the repository but without TypeScript auto-completion.
|
103
|
+
For example if you have a `users` table, there'll be a repository at `xata.db.users`. If you're using the schema-less client, you can also use the `xata.db.[table-name]` syntax to access the repository but without TypeScript auto-completion.
|
88
104
|
|
89
|
-
|
105
|
+
#### Creating Records
|
90
106
|
|
91
107
|
Invoke the `create()` method in the repository. Example:
|
92
108
|
|
@@ -96,51 +112,53 @@ const user = await xata.db.users.create({
|
|
96
112
|
});
|
97
113
|
```
|
98
114
|
|
99
|
-
If you want to create a record with a specific ID, you can
|
115
|
+
If you want to create a record with a specific ID, you can provide the id as parameter to the `create()` method.
|
100
116
|
|
101
117
|
```ts
|
102
|
-
const user = await xata.db.users.
|
118
|
+
const user = await xata.db.users.create('user_admin', {
|
103
119
|
fullName: 'John Smith'
|
104
120
|
});
|
105
121
|
```
|
106
122
|
|
107
|
-
And if you want to create or
|
123
|
+
And if you want to create or update a record with a specific ID, you can invoke `createOrUpdate()` with an id parameter.
|
108
124
|
|
109
125
|
```ts
|
110
|
-
const user = await
|
126
|
+
const user = await xata.db.users.createOrUpdate('user_admin', {
|
111
127
|
fullName: 'John Smith'
|
112
128
|
});
|
113
129
|
```
|
114
130
|
|
115
|
-
|
131
|
+
#### Query a Single Record by its ID
|
116
132
|
|
117
133
|
```ts
|
118
|
-
// `user` will be null if the
|
134
|
+
// `user` will be null if the record cannot be found
|
119
135
|
const user = await xata.db.users.read('rec_1234abcdef');
|
120
136
|
```
|
121
137
|
|
122
|
-
|
138
|
+
#### Querying Multiple Records
|
123
139
|
|
124
140
|
```ts
|
125
|
-
// Query
|
126
|
-
const
|
141
|
+
// Query records selecting all fields.
|
142
|
+
const page = await xata.db.users.select().getPaginated();
|
127
143
|
const user = await xata.db.users.select().getFirst();
|
128
144
|
|
129
145
|
// You can also use `xata.db.users` directly, since it's an immutable Query too!
|
130
|
-
const
|
146
|
+
const page = await xata.db.users.getPaginated();
|
131
147
|
const user = await xata.db.users.getFirst();
|
132
148
|
|
133
|
-
// Query
|
134
|
-
const
|
149
|
+
// Query records selecting just one or more fields
|
150
|
+
const page = await xata.db.users.select('email', 'profile').getPaginated();
|
135
151
|
|
136
152
|
// Apply constraints
|
137
|
-
const
|
153
|
+
const page = await xata.db.users.filter('email', 'foo@example.com').getPaginated();
|
138
154
|
|
139
155
|
// Sorting
|
140
|
-
const
|
156
|
+
const page = await xata.db.users.sort('full_name', 'asc').getPaginated();
|
141
157
|
```
|
142
158
|
|
143
|
-
Query operations (`select()`, `filter()`, `sort()`) return a `Query` object. These objects are immutable. You can add additional constraints, sort
|
159
|
+
Query operations (`select()`, `filter()`, `sort()`) return a `Query` object. These objects are immutable. You can add additional constraints, `sort`, etc. by calling their methods, and a new query will be returned. In order to finally make a query to the database you'll invoke `getPaginated()`, `getMany()`, `getAll()`, or `getFirst()`.
|
160
|
+
|
161
|
+
To learn the differences between these methods, see the [reference](https://docs.xata.io/sdk/reference#query).
|
144
162
|
|
145
163
|
```ts
|
146
164
|
// Operators that combine multiple conditions can be deconstructed
|
@@ -154,19 +172,26 @@ filter('email', startsWith('username')).not(filter('created_at', gt(somePastDate
|
|
154
172
|
// Queries are immutable objects. This is useful to derive queries from other queries
|
155
173
|
const admins = filter('admin', true);
|
156
174
|
const spaniardsAdmins = admins.filter('country', 'Spain');
|
157
|
-
await admins.
|
175
|
+
await admins.getAll(); // still returns all admins
|
158
176
|
|
159
177
|
// Finally fetch the results of the query
|
160
|
-
const users = await query.
|
178
|
+
const users = await query.getAll();
|
161
179
|
const firstUser = await query.getFirst();
|
180
|
+
```
|
181
|
+
|
182
|
+
The `getPaginated()` method will return a `Page` object. It's a wrapper that internally uses cursor based pagination.
|
162
183
|
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
184
|
+
```ts
|
185
|
+
page.records; // Array of records
|
186
|
+
page.hasNextPage(); // Boolean
|
187
|
+
|
188
|
+
const nextPage = await page.nextPage(); // Page object
|
189
|
+
const previousPage = await page.previousPage(); // Page object
|
190
|
+
const startPage = await page.startPage(); // Page object
|
191
|
+
const endPage = await page.endPage(); // Page object
|
167
192
|
```
|
168
193
|
|
169
|
-
If you want to use an iterator, both the Repository and the Query classes implement an AsyncIterable
|
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:
|
170
195
|
|
171
196
|
```ts
|
172
197
|
for await (const record of xata.db.users) {
|
@@ -182,9 +207,9 @@ for await (const records of xata.db.users.getIterator({ batchSize: 100 })) {
|
|
182
207
|
}
|
183
208
|
```
|
184
209
|
|
185
|
-
|
210
|
+
#### Updating Records
|
186
211
|
|
187
|
-
Updating
|
212
|
+
Updating a record leaves the existing object unchanged, but returns a new object with the updated values.
|
188
213
|
|
189
214
|
```ts
|
190
215
|
// Using an existing object
|
@@ -192,42 +217,25 @@ const updatedUser = await user.update({
|
|
192
217
|
fullName: 'John Smith Jr.'
|
193
218
|
});
|
194
219
|
|
195
|
-
// Using
|
220
|
+
// Using a record id
|
196
221
|
const updatedUser = await xata.db.users.update('rec_1234abcdef', {
|
197
222
|
fullName: 'John Smith Jr.'
|
198
223
|
});
|
199
224
|
```
|
200
225
|
|
201
|
-
|
226
|
+
#### Deleting Records
|
202
227
|
|
203
228
|
```ts
|
204
229
|
// Using an existing object
|
205
230
|
await user.delete();
|
206
231
|
|
207
|
-
// Using
|
232
|
+
// Using a record id
|
208
233
|
await xata.db.users.delete('rec_1234abcdef');
|
209
234
|
```
|
210
235
|
|
211
|
-
#### Deno support
|
212
|
-
|
213
|
-
Right now we are still not publishing the client on deno.land or have support for deno in the codegen.
|
214
|
-
|
215
|
-
However you can already use it with your preferred node CDN with the following import in the auto-generated `xata.ts` file:
|
216
|
-
|
217
|
-
```ts
|
218
|
-
import {
|
219
|
-
BaseClient,
|
220
|
-
Query,
|
221
|
-
Repository,
|
222
|
-
RestRespositoryFactory,
|
223
|
-
XataClientOptions,
|
224
|
-
XataRecord
|
225
|
-
} from 'https://esm.sh/@xata.io/client@<version>/dist/schema?target=deno';
|
226
|
-
```
|
227
|
-
|
228
236
|
### API Client
|
229
237
|
|
230
|
-
One of the main features of the SDK is the ability to interact with the whole Xata API and perform administrative operations such as creating/reading/updating/deleting workspaces, databases, tables, branches...
|
238
|
+
One of the main features of the SDK is the ability to interact with the whole Xata API and perform administrative operations such as creating/reading/updating/deleting [workspaces](https://docs.xata.io/concepts/workspaces), databases, tables, branches...
|
231
239
|
|
232
240
|
To communicate with the SDK we provide a constructor called `XataApiClient` that accepts an API token and an optional fetch implementation method.
|
233
241
|
|
@@ -238,21 +246,28 @@ const api = new XataApiClient({ apiKey: process.env.XATA_API_KEY });
|
|
238
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`...).
|
239
247
|
|
240
248
|
```ts
|
241
|
-
const { id: workspace } = await
|
242
|
-
|
243
|
-
const { databaseName } = await client.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' });
|
244
251
|
|
245
|
-
await
|
246
|
-
await
|
247
|
-
await
|
252
|
+
await api.branches.createBranch(workspace, databaseName, 'branch');
|
253
|
+
await api.tables.createTable(workspace, databaseName, 'branch', 'table');
|
254
|
+
await api.tables.setTableSchema(workspace, databaseName, 'branch', 'table', {
|
248
255
|
columns: [{ name: 'email', type: 'string' }]
|
249
256
|
});
|
250
257
|
|
251
|
-
const { id: recordId } = await
|
258
|
+
const { id: recordId } = await api.records.insertRecord(workspace, databaseName, 'branch', 'table', {
|
252
259
|
email: 'example@foo.bar'
|
253
260
|
});
|
254
261
|
|
255
|
-
const record = await
|
262
|
+
const record = await api.records.getRecord(workspace, databaseName, 'branch', 'table', recordId);
|
256
263
|
|
257
|
-
await
|
264
|
+
await api.workspaces.deleteWorkspace(workspace);
|
265
|
+
```
|
266
|
+
|
267
|
+
## Deno support
|
268
|
+
|
269
|
+
We publish the client on [deno.land](https://deno.land/x/xata). You can use it by changing the import in the auto-generated `xata.ts` file:
|
270
|
+
|
271
|
+
```ts
|
272
|
+
import { buildClient, BaseClientOptions, XataRecord } from 'https://deno.land/x/xata/mod.ts';
|
258
273
|
```
|