@xata.io/client 0.0.0-alpha.vf9f8ac6 → 0.0.0-alpha.vf9f8d99

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/.eslintrc.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  module.exports = {
2
- ignorePatterns: ["dist"],
2
+ ignorePatterns: ['dist'],
3
3
  parserOptions: {
4
4
  ecmaVersion: 2020,
5
5
  sourceType: 'module',
@@ -7,6 +7,7 @@ module.exports = {
7
7
  },
8
8
  rules: {
9
9
  '@typescript-eslint/no-floating-promises': 'error',
10
- "@typescript-eslint/strict-boolean-expressions": ["error", { allowNullableString: true, allowNullableObject: true }],
10
+ '@typescript-eslint/strict-boolean-expressions': ['error', { allowNullableString: true, allowNullableObject: true }],
11
+ "@typescript-eslint/ban-types": "off",
11
12
  }
12
13
  };
@@ -0,0 +1,4 @@
1
+
2
+ > @xata.io/client@0.22.3 add-version /home/runner/work/client-ts/client-ts/packages/client
3
+ > node ../../scripts/add-version-file.mjs
4
+
@@ -0,0 +1,13 @@
1
+
2
+ > @xata.io/client@0.22.3 build /home/runner/work/client-ts/client-ts/packages/client
3
+ > rimraf dist && rollup -c
4
+
5
+ 
6
+ src/index.ts → dist/index.cjs...
7
+ created dist/index.cjs in 1.1s
8
+ 
9
+ src/index.ts → dist/index.mjs...
10
+ created dist/index.mjs in 887ms
11
+ 
12
+ src/index.ts → dist/index.d.ts...
13
+ created dist/index.d.ts in 5.5s
package/CHANGELOG.md CHANGED
@@ -1,5 +1,269 @@
1
1
  # @xata.io/client
2
2
 
3
+ ## 0.0.0-alpha.vf9f8d99
4
+
5
+ ### Patch Changes
6
+
7
+ - Force canary build
8
+
9
+ - [#921](https://github.com/xataio/client-ts/pull/921) [`07fc879d`](https://github.com/xataio/client-ts/commit/07fc879d3f778536e39588e66d7a18b5a9d52ebe) Thanks [@SferaDev](https://github.com/SferaDev)! - Remove git branch resolution
10
+
11
+ - [#925](https://github.com/xataio/client-ts/pull/925) [`58a1c24e`](https://github.com/xataio/client-ts/commit/58a1c24e5d30025dce243eecce44f09d4f65ed66) Thanks [@xata-bot](https://github.com/xata-bot)! - Add new methods to API client
12
+
13
+ ## 0.22.3
14
+
15
+ ### Patch Changes
16
+
17
+ - [#917](https://github.com/xataio/client-ts/pull/917) [`4210b8c3`](https://github.com/xataio/client-ts/commit/4210b8c3c4169ba781a56deed7ba09c99788db1f) Thanks [@xata-bot](https://github.com/xata-bot)! - [OpenAPI] Spec updates to add better types to Record input
18
+
19
+ ## 0.22.2
20
+
21
+ ### Patch Changes
22
+
23
+ - [#898](https://github.com/xataio/client-ts/pull/898) [`72e13bf9`](https://github.com/xataio/client-ts/commit/72e13bf99d0ebefef91c984a995a28b0e8ca2a8f) Thanks [@SferaDev](https://github.com/SferaDev)! - Add methods for vector type
24
+
25
+ ## 0.22.1
26
+
27
+ ### Patch Changes
28
+
29
+ - [#885](https://github.com/xataio/client-ts/pull/885) [`4cafde72`](https://github.com/xataio/client-ts/commit/4cafde728e4e9e5e83812d475d9980397ae78362) Thanks [@SferaDev](https://github.com/SferaDev)! - Update body of compareBranchSchemas
30
+
31
+ - [#890](https://github.com/xataio/client-ts/pull/890) [`639710a5`](https://github.com/xataio/client-ts/commit/639710a52132f260bf3a26560a21ae2193abb71d) Thanks [@SferaDev](https://github.com/SferaDev)! - Expose consistency settings in summarize
32
+
33
+ ## 0.22.0
34
+
35
+ ### Minor Changes
36
+
37
+ - [#852](https://github.com/xataio/client-ts/pull/852) [`b2a4def4`](https://github.com/xataio/client-ts/commit/b2a4def4baf3eb18cd323895635e0bccb7f876f4) Thanks [@SferaDev](https://github.com/SferaDev)! - [BREAKING CHANGE] Reduce column selection depth
38
+
39
+ ### Patch Changes
40
+
41
+ - [#835](https://github.com/xataio/client-ts/pull/835) [`379e6144`](https://github.com/xataio/client-ts/commit/379e61446b21e7cbadd7fc59267736c6845ec566) Thanks [@SferaDev](https://github.com/SferaDev)! - Add helper methods `toSerializable` and `toString`
42
+
43
+ ## 0.21.6
44
+
45
+ ### Patch Changes
46
+
47
+ - [#828](https://github.com/xataio/client-ts/pull/828) [`039e35bf`](https://github.com/xataio/client-ts/commit/039e35bf9f01149f39bca39e1867908ca3468bb5) Thanks [@SferaDev](https://github.com/SferaDev)! - Fix enableBrowser with Deno
48
+
49
+ - [#828](https://github.com/xataio/client-ts/pull/828) [`039e35bf`](https://github.com/xataio/client-ts/commit/039e35bf9f01149f39bca39e1867908ca3468bb5) Thanks [@SferaDev](https://github.com/SferaDev)! - Add branded types to serializer
50
+
51
+ ## 0.21.5
52
+
53
+ ### Patch Changes
54
+
55
+ - [#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
56
+
57
+ ## 0.21.4
58
+
59
+ ### Patch Changes
60
+
61
+ - [#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
62
+
63
+ ## 0.21.3
64
+
65
+ ### Patch Changes
66
+
67
+ - [#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
68
+
69
+ ## 0.21.2
70
+
71
+ ### Patch Changes
72
+
73
+ - [#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
74
+
75
+ - [#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
76
+
77
+ ## 0.21.1
78
+
79
+ ### Patch Changes
80
+
81
+ - [#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
82
+
83
+ ## 0.21.0
84
+
85
+ ### Minor Changes
86
+
87
+ - [#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
88
+
89
+ ### Patch Changes
90
+
91
+ - [#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
92
+
93
+ - [#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
94
+
95
+ - [#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
96
+
97
+ - [#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
98
+
99
+ - [#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
100
+
101
+ - [#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
102
+
103
+ - [#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
104
+
105
+ - [#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
106
+
107
+ - [#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
108
+
109
+ ## 0.20.2
110
+
111
+ ### Patch Changes
112
+
113
+ - [#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
114
+
115
+ - [#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
116
+
117
+ - [#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
118
+
119
+ ## 0.20.1
120
+
121
+ ### Patch Changes
122
+
123
+ - [#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
124
+
125
+ ## 0.20.0
126
+
127
+ ### Minor Changes
128
+
129
+ - [#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
130
+
131
+ ### Patch Changes
132
+
133
+ - [#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
134
+
135
+ - [#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
136
+
137
+ - [#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
138
+
139
+ - [#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
140
+
141
+ ## 0.19.1
142
+
143
+ ### Patch Changes
144
+
145
+ - [#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
146
+
147
+ ## 0.19.0
148
+
149
+ ### Minor Changes
150
+
151
+ - [#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
152
+
153
+ - [#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
154
+
155
+ ### Patch Changes
156
+
157
+ - [#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
158
+
159
+ - [#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+
160
+
161
+ - [#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
162
+
163
+ - [#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
164
+
165
+ ## 0.18.6
166
+
167
+ ### Patch Changes
168
+
169
+ - [#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
170
+
171
+ - [#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
172
+
173
+ - [#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
174
+
175
+ - [#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
176
+
177
+ ## 0.18.5
178
+
179
+ ### Patch Changes
180
+
181
+ - [#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
182
+
183
+ ## 0.18.4
184
+
185
+ ### Patch Changes
186
+
187
+ - [#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
188
+
189
+ ## 0.18.3
190
+
191
+ ### Patch Changes
192
+
193
+ - [#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
194
+
195
+ ## 0.18.2
196
+
197
+ ### Patch Changes
198
+
199
+ - [#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
200
+
201
+ ## 0.18.1
202
+
203
+ ### Patch Changes
204
+
205
+ - [#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
206
+
207
+ ## 0.18.0
208
+
209
+ ### Minor Changes
210
+
211
+ - [#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
212
+
213
+ ### Patch Changes
214
+
215
+ - [#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
216
+
217
+ - [#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
218
+
219
+ - [#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
220
+
221
+ - [#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
222
+
223
+ - [#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.
224
+
225
+ - [#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
226
+
227
+ - [#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
228
+
229
+ ## 0.17.1
230
+
231
+ ### Patch Changes
232
+
233
+ - [#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
234
+
235
+ * [#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
236
+
237
+ - [#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
238
+
239
+ * [#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
240
+
241
+ - [#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
242
+
243
+ * [#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
244
+
245
+ ## 0.17.0
246
+
247
+ ### Minor Changes
248
+
249
+ - [#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
250
+
251
+ * [#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
252
+
253
+ ## 0.16.2
254
+
255
+ ### Patch Changes
256
+
257
+ - [#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
258
+
259
+ * [#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
260
+
261
+ - [#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
262
+
263
+ * [#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
264
+
265
+ - [#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
266
+
3
267
  ## 0.16.1
4
268
 
5
269
  ### Patch Changes
package/README.md CHANGED
@@ -1,271 +1,7 @@
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. It also works in browsers for the same reason. But this is strongly discouraged because you can easily leak your API keys from browsers.
3
+ The Xata SDK supports typescript definitions for your Xata database schema. It also works with JavaScript.
4
4
 
5
- ## Table of Contents
5
+ It has zero dependencies and runs in Node.js, V8, Deno and Bun.
6
6
 
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 Objects](#creating-objects)
16
- - [Query a Single Object by its ID](#query-a-single-object-by-its-id)
17
- - [Querying Multiple Objects](#querying-multiple-objects)
18
- - [Updating Objects](#updating-objects)
19
- - [Deleting Objects](#deleting-objects)
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
26
-
27
- ```bash
28
- npm install @xata.io/client
29
- ```
30
-
31
- ## Usage
32
-
33
- There are three ways to use the SDK:
34
-
35
- - **Schema-generated Client**: SDK to create/read/update/delete records in a given database following a schema file (with type-safety).
36
- - **Schema-less Client**: SDK to create/read/update/delete records in any database without schema validation (with partial type-safety).
37
- - **API Client**: SDK to interact with the whole Xata API and all its endpoints.
38
-
39
- ### Schema-generated Client
40
-
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).
42
-
43
- To run it (and assuming you have configured the project with `xata init`):
44
-
45
- ```bash
46
- xata codegen
47
- ```
48
-
49
- In a TypeScript file, start using the generated code like this:
50
-
51
- ```ts
52
- import { XataClient } from './xata'; // or wherever you chose to generate the client
53
-
54
- const xata = new XataClient();
55
- ```
56
-
57
- The import above will differ if you chose to generate the code in a different location.
58
-
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.
60
-
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).
62
-
63
- ```ts
64
- interface User extends Identifiable {
65
- email?: string | null;
66
- }
67
-
68
- type UserRecord = User & XataRecord;
69
-
70
- async function initializeDatabase(admin: User): Promise<UserRecord> {
71
- return xata.db.users.create(admin);
72
- }
73
-
74
- const admin = await initializeDatabase({ email: 'admin@example.com' });
75
- await admin.update({ email: 'admin@foo.bar' });
76
- await admin.delete();
77
- ```
78
-
79
- You will learn more about the available operations below, under the [`API Design`](#api-design) section.
80
-
81
- ### Schema-less Client
82
-
83
- If you don't have a schema file, or you are building a generic way to interact with Xata, you can use the `BaseClient` class without schema validation.
84
-
85
- ```ts
86
- import { BaseClient } from '@xata.io/client';
87
-
88
- const xata = new BaseClient({
89
- branch: 'branchname',
90
- apiKey: 'xau_1234abcdef',
91
- fetch: fetchImplementation // Required if your runtime doesn't provide a global `fetch` function.
92
- });
93
- ```
94
-
95
- It works the same way as the code-generated `XataClient` but doesn't provide type-safety for your model.
96
-
97
- You can read more on the methods available below, in the next section.
98
-
99
- ### API Design
100
-
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]`.
102
-
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.
104
-
105
- #### Creating Objects
106
-
107
- Invoke the `create()` method in the repository. Example:
108
-
109
- ```ts
110
- const user = await xata.db.users.create({
111
- fullName: 'John Smith'
112
- });
113
- ```
114
-
115
- If you want to create a record with a specific ID, you can invoke `insert()`.
116
-
117
- ```ts
118
- const user = await xata.db.users.insert('user_admin', {
119
- fullName: 'John Smith'
120
- });
121
- ```
122
-
123
- And if you want to create or insert a record with a specific ID, you can invoke `updateOrInsert()`.
124
-
125
- ```ts
126
- const user = await client.db.users.updateOrInsert('user_admin', {
127
- fullName: 'John Smith'
128
- });
129
- ```
130
-
131
- #### Query a Single Object by its ID
132
-
133
- ```ts
134
- // `user` will be null if the object cannot be found
135
- const user = await xata.db.users.read('rec_1234abcdef');
136
- ```
137
-
138
- #### Querying Multiple Objects
139
-
140
- ```ts
141
- // Query objects selecting all fields.
142
- const page = await xata.db.users.select().getPaginated();
143
- const user = await xata.db.users.select().getFirst();
144
-
145
- // You can also use `xata.db.users` directly, since it's an immutable Query too!
146
- const page = await xata.db.users.getPaginated();
147
- const user = await xata.db.users.getFirst();
148
-
149
- // Query objects selecting just one or more fields
150
- const page = await xata.db.users.select('email', 'profile').getPaginated();
151
-
152
- // Apply constraints
153
- const page = await xata.db.users.filter('email', 'foo@example.com').getPaginated();
154
-
155
- // Sorting
156
- const page = await xata.db.users.sort('full_name', 'asc').getPaginated();
157
- ```
158
-
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
- ```ts
162
- // Operators that combine multiple conditions can be deconstructed
163
- const { filter, any, all, not, sort } = xata.db.users;
164
- const query = filter('email', 'foo@example.com');
165
-
166
- // Single-column operators are imported directly from the package
167
- import { gt, includes, startsWith } from '@xata.io/client';
168
- filter('email', startsWith('username')).not(filter('created_at', gt(somePastDate)));
169
-
170
- // Queries are immutable objects. This is useful to derive queries from other queries
171
- const admins = filter('admin', true);
172
- const spaniardsAdmins = admins.filter('country', 'Spain');
173
- await admins.getAll(); // still returns all admins
174
-
175
- // Finally fetch the results of the query
176
- const users = await query.getAll();
177
- const firstUser = await query.getFirst();
178
- ```
179
-
180
- The `getPaginated()` method will return a `Page` object. It's a wrapper that internally uses cursor based pagination.
181
-
182
- ```ts
183
- page.records; // Array of records
184
- page.hasNextPage(); // Boolean
185
-
186
- const nextPage = await page.nextPage(); // Page object
187
- const previousPage = await page.previousPage(); // Page object
188
- const firstPage = await page.firstPage(); // Page object
189
- const lastPage = await page.lastPage(); // Page object
190
- ```
191
-
192
- 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:
193
-
194
- ```ts
195
- for await (const record of xata.db.users) {
196
- console.log(record);
197
- }
198
-
199
- for await (const record of xata.db.users.filter('team.id', teamId)) {
200
- console.log(record);
201
- }
202
-
203
- for await (const records of xata.db.users.getIterator({ batchSize: 100 })) {
204
- console.log(records);
205
- }
206
- ```
207
-
208
- #### Updating Objects
209
-
210
- Updating an object leaves the existing instance unchanged, but returns a new object with the updated values.
211
-
212
- ```ts
213
- // Using an existing object
214
- const updatedUser = await user.update({
215
- fullName: 'John Smith Jr.'
216
- });
217
-
218
- // Using an object's id
219
- const updatedUser = await xata.db.users.update('rec_1234abcdef', {
220
- fullName: 'John Smith Jr.'
221
- });
222
- ```
223
-
224
- #### Deleting Objects
225
-
226
- ```ts
227
- // Using an existing object
228
- await user.delete();
229
-
230
- // Using an object's id
231
- await xata.db.users.delete('rec_1234abcdef');
232
- ```
233
-
234
- ### API Client
235
-
236
- 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...
237
-
238
- To communicate with the SDK we provide a constructor called `XataApiClient` that accepts an API token and an optional fetch implementation method.
239
-
240
- ```ts
241
- const api = new XataApiClient({ apiKey: process.env.XATA_API_KEY });
242
- ```
243
-
244
- 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`...).
245
-
246
- ```ts
247
- const { id: workspace } = await client.workspaces.createWorkspace({ name: 'example', slug: 'example' });
248
- const { databaseName } = await client.databases.createDatabase(workspace, 'database');
249
-
250
- await client.branches.createBranch(workspace, databaseName, 'branch');
251
- await client.tables.createTable(workspace, databaseName, 'branch', 'table');
252
- await client.tables.setTableSchema(workspace, databaseName, 'branch', 'table', {
253
- columns: [{ name: 'email', type: 'string' }]
254
- });
255
-
256
- const { id: recordId } = await client.records.insertRecord(workspace, databaseName, 'branch', 'table', {
257
- email: 'example@foo.bar'
258
- });
259
-
260
- const record = await client.records.getRecord(workspace, databaseName, 'branch', 'table', recordId);
261
-
262
- await client.workspaces.deleteWorkspace(workspace);
263
- ```
264
-
265
- ## Deno support
266
-
267
- 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:
268
-
269
- ```ts
270
- import { buildClient, BaseClientOptions, XataRecord } from 'https://deno.land/x/xata/mod.ts';
271
- ```
7
+ You can find the SDK documentation [here](https://xata.io/docs/typescript-client/overview).