@supabase/postgrest-js 2.108.1-canary.0 → 2.108.1-canary.2

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 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 for the request.
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 */
@@ -543,6 +557,9 @@ var PostgrestBuilder = class {
543
557
  //#endregion
544
558
  //#region src/PostgrestTransformBuilder.ts
545
559
  var PostgrestTransformBuilder = class extends PostgrestBuilder {
560
+ throwOnError() {
561
+ return super.throwOnError();
562
+ }
546
563
  /**
547
564
  * Perform a SELECT on the query result.
548
565
  *
@@ -1167,6 +1184,7 @@ var PostgrestTransformBuilder = class extends PostgrestBuilder {
1167
1184
  * Return `data` as an object in [GeoJSON](https://geojson.org) format.
1168
1185
  *
1169
1186
  * @category Database
1187
+ * @subcategory Using modifiers
1170
1188
  */
1171
1189
  geojson() {
1172
1190
  this.headers.set("Accept", "application/geo+json");
@@ -1283,11 +1301,33 @@ var PostgrestTransformBuilder = class extends PostgrestBuilder {
1283
1301
  else return this;
1284
1302
  }
1285
1303
  /**
1286
- * Rollback the query.
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(...)`).
1287
1315
  *
1288
- * `data` will still be returned, but the query is not committed.
1316
+ * Sets the `Prefer: tx=rollback` header. See PostgREST's docs on transaction
1317
+ * preferences for the underlying mechanism.
1289
1318
  *
1290
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
+ * ```
1291
1331
  */
1292
1332
  rollback() {
1293
1333
  this.headers.append("Prefer", "tx=rollback");
@@ -1342,6 +1382,7 @@ var PostgrestTransformBuilder = class extends PostgrestBuilder {
1342
1382
  * @param rows - The maximum number of rows that can be affected
1343
1383
  *
1344
1384
  * @category Database
1385
+ * @subcategory Using modifiers
1345
1386
  */
1346
1387
  maxAffected(rows) {
1347
1388
  this.headers.append("Prefer", "handling=strict");
@@ -1354,6 +1395,9 @@ var PostgrestTransformBuilder = class extends PostgrestBuilder {
1354
1395
  //#region src/PostgrestFilterBuilder.ts
1355
1396
  const PostgrestReservedCharsRegexp = /* @__PURE__ */ new RegExp("[,()]");
1356
1397
  var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
1398
+ throwOnError() {
1399
+ return super.throwOnError();
1400
+ }
1357
1401
  /**
1358
1402
  * Match only rows where `column` is equal to `value`.
1359
1403
  *