@supabase/postgrest-js 2.108.1-canary.1 → 2.108.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/dist/index.cjs +41 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -3
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +41 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +41 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/PostgrestBuilder.ts +15 -1
- package/src/PostgrestTransformBuilder.ts +26 -2
- package/src/version.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -167,6 +167,7 @@ var PostgrestBuilder = class {
|
|
|
167
167
|
* {@link https://github.com/supabase/supabase-js/issues/92}
|
|
168
168
|
*
|
|
169
169
|
* @category Database
|
|
170
|
+
* @subcategory Using modifiers
|
|
170
171
|
*/
|
|
171
172
|
throwOnError() {
|
|
172
173
|
this.shouldThrowOnError = true;
|
|
@@ -228,9 +229,20 @@ var PostgrestBuilder = class {
|
|
|
228
229
|
return this;
|
|
229
230
|
}
|
|
230
231
|
/**
|
|
231
|
-
* Set an HTTP header
|
|
232
|
+
* Set an HTTP header on this single PostgREST request, overriding any header
|
|
233
|
+
* with the same name set on the client.
|
|
234
|
+
*
|
|
235
|
+
* This is an advanced escape hatch for one-off needs (passing a custom
|
|
236
|
+
* `Authorization` for a single query, attaching a tracing header, etc.).
|
|
237
|
+
* Most callers do not need it: configure client-wide headers via the
|
|
238
|
+
* `headers` option when constructing the client, and authentication via
|
|
239
|
+
* Supabase Auth.
|
|
240
|
+
*
|
|
241
|
+
* @param name - HTTP header name
|
|
242
|
+
* @param value - HTTP header value
|
|
232
243
|
*
|
|
233
244
|
* @category Database
|
|
245
|
+
* @subcategory Using modifiers
|
|
234
246
|
*/
|
|
235
247
|
setHeader(name, value) {
|
|
236
248
|
this.headers = new Headers(this.headers);
|
|
@@ -239,6 +251,7 @@ var PostgrestBuilder = class {
|
|
|
239
251
|
}
|
|
240
252
|
/**
|
|
241
253
|
* @category Database
|
|
254
|
+
* @subcategory Using modifiers
|
|
242
255
|
*
|
|
243
256
|
* Configure retry behavior for this request.
|
|
244
257
|
*
|
|
@@ -436,6 +449,7 @@ var PostgrestBuilder = class {
|
|
|
436
449
|
* @deprecated Use overrideTypes<yourType, { merge: false }>() method at the end of your call chain instead
|
|
437
450
|
*
|
|
438
451
|
* @category Database
|
|
452
|
+
* @subcategory Using modifiers
|
|
439
453
|
*/
|
|
440
454
|
returns() {
|
|
441
455
|
/* istanbul ignore next */
|
|
@@ -1170,6 +1184,7 @@ var PostgrestTransformBuilder = class extends PostgrestBuilder {
|
|
|
1170
1184
|
* Return `data` as an object in [GeoJSON](https://geojson.org) format.
|
|
1171
1185
|
*
|
|
1172
1186
|
* @category Database
|
|
1187
|
+
* @subcategory Using modifiers
|
|
1173
1188
|
*/
|
|
1174
1189
|
geojson() {
|
|
1175
1190
|
this.headers.set("Accept", "application/geo+json");
|
|
@@ -1286,11 +1301,33 @@ var PostgrestTransformBuilder = class extends PostgrestBuilder {
|
|
|
1286
1301
|
else return this;
|
|
1287
1302
|
}
|
|
1288
1303
|
/**
|
|
1289
|
-
*
|
|
1304
|
+
* Dry-run this request: execute the query but discard the changes.
|
|
1305
|
+
*
|
|
1306
|
+
* Server-side, PostgREST runs the query inside a transaction and rolls it back
|
|
1307
|
+
* instead of committing. The response still contains the data that *would* have
|
|
1308
|
+
* been returned — `RETURNING` clauses execute and RLS, triggers, and constraints
|
|
1309
|
+
* are all evaluated — but no row is actually inserted, updated, or deleted.
|
|
1310
|
+
*
|
|
1311
|
+
* This affects only the single request it is chained to. The JS caller has no
|
|
1312
|
+
* handle on the transaction: supabase-js does not group multiple queries into
|
|
1313
|
+
* one transaction. For multi-statement transactional logic, use a database
|
|
1314
|
+
* function (`supabase.rpc(...)`).
|
|
1290
1315
|
*
|
|
1291
|
-
*
|
|
1316
|
+
* Sets the `Prefer: tx=rollback` header. See PostgREST's docs on transaction
|
|
1317
|
+
* preferences for the underlying mechanism.
|
|
1292
1318
|
*
|
|
1293
1319
|
* @category Database
|
|
1320
|
+
* @subcategory Using modifiers
|
|
1321
|
+
*
|
|
1322
|
+
* @example Validate an insert without persisting
|
|
1323
|
+
* ```ts
|
|
1324
|
+
* const { data, error } = await supabase
|
|
1325
|
+
* .from('countries')
|
|
1326
|
+
* .insert({ name: 'France' })
|
|
1327
|
+
* .select()
|
|
1328
|
+
* .rollback()
|
|
1329
|
+
* // `data` shows what would have been inserted; nothing is saved.
|
|
1330
|
+
* ```
|
|
1294
1331
|
*/
|
|
1295
1332
|
rollback() {
|
|
1296
1333
|
this.headers.append("Prefer", "tx=rollback");
|
|
@@ -1345,6 +1382,7 @@ var PostgrestTransformBuilder = class extends PostgrestBuilder {
|
|
|
1345
1382
|
* @param rows - The maximum number of rows that can be affected
|
|
1346
1383
|
*
|
|
1347
1384
|
* @category Database
|
|
1385
|
+
* @subcategory Using modifiers
|
|
1348
1386
|
*/
|
|
1349
1387
|
maxAffected(rows) {
|
|
1350
1388
|
this.headers.append("Prefer", "handling=strict");
|