@supabase/postgrest-js 2.99.2 → 2.99.3
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 +2475 -130
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1055 -3
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1055 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2475 -130
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/PostgrestBuilder.ts +93 -1
- package/src/PostgrestClient.ts +165 -1
- package/src/PostgrestFilterBuilder.ts +1382 -3
- package/src/PostgrestQueryBuilder.ts +112 -1
- package/src/PostgrestTransformBuilder.ts +603 -0
- package/src/version.ts +1 -1
|
@@ -27,7 +27,19 @@ export default class PostgrestQueryBuilder<
|
|
|
27
27
|
*
|
|
28
28
|
* @example
|
|
29
29
|
* ```ts
|
|
30
|
-
* import PostgrestQueryBuilder from '@supabase/postgrest-js'
|
|
30
|
+
* import { PostgrestQueryBuilder } from '@supabase/postgrest-js'
|
|
31
|
+
*
|
|
32
|
+
* const query = new PostgrestQueryBuilder(
|
|
33
|
+
* new URL('https://xyzcompany.supabase.co/rest/v1/users'),
|
|
34
|
+
* { headers: { apikey: 'public-anon-key' } }
|
|
35
|
+
* )
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @category Database
|
|
39
|
+
*
|
|
40
|
+
* @example Example 1
|
|
41
|
+
* ```ts
|
|
42
|
+
* import { PostgrestQueryBuilder } from '@supabase/postgrest-js'
|
|
31
43
|
*
|
|
32
44
|
* const query = new PostgrestQueryBuilder(
|
|
33
45
|
* new URL('https://xyzcompany.supabase.co/rest/v1/users'),
|
|
@@ -1581,6 +1593,105 @@ export default class PostgrestQueryBuilder<
|
|
|
1581
1593
|
*
|
|
1582
1594
|
* `"estimated"`: Uses exact count for low numbers and planned count for high
|
|
1583
1595
|
* numbers.
|
|
1596
|
+
*
|
|
1597
|
+
* @category Database
|
|
1598
|
+
*
|
|
1599
|
+
* @remarks
|
|
1600
|
+
* - `delete()` should always be combined with [filters](/docs/reference/javascript/using-filters) to target the item(s) you wish to delete.
|
|
1601
|
+
* - If you use `delete()` with filters and you have
|
|
1602
|
+
* [RLS](/docs/learn/auth-deep-dive/auth-row-level-security) enabled, only
|
|
1603
|
+
* rows visible through `SELECT` policies are deleted. Note that by default
|
|
1604
|
+
* no rows are visible, so you need at least one `SELECT`/`ALL` policy that
|
|
1605
|
+
* makes the rows visible.
|
|
1606
|
+
* - When using `delete().in()`, specify an array of values to target multiple rows with a single query. This is particularly useful for batch deleting entries that share common criteria, such as deleting users by their IDs. Ensure that the array you provide accurately represents all records you intend to delete to avoid unintended data removal.
|
|
1607
|
+
*
|
|
1608
|
+
* @example Delete a single record
|
|
1609
|
+
* ```ts
|
|
1610
|
+
* const response = await supabase
|
|
1611
|
+
* .from('countries')
|
|
1612
|
+
* .delete()
|
|
1613
|
+
* .eq('id', 1)
|
|
1614
|
+
* ```
|
|
1615
|
+
*
|
|
1616
|
+
* @exampleSql Delete a single record
|
|
1617
|
+
* ```sql
|
|
1618
|
+
* create table
|
|
1619
|
+
* countries (id int8 primary key, name text);
|
|
1620
|
+
*
|
|
1621
|
+
* insert into
|
|
1622
|
+
* countries (id, name)
|
|
1623
|
+
* values
|
|
1624
|
+
* (1, 'Mordor');
|
|
1625
|
+
* ```
|
|
1626
|
+
*
|
|
1627
|
+
* @exampleResponse Delete a single record
|
|
1628
|
+
* ```json
|
|
1629
|
+
* {
|
|
1630
|
+
* "status": 204,
|
|
1631
|
+
* "statusText": "No Content"
|
|
1632
|
+
* }
|
|
1633
|
+
* ```
|
|
1634
|
+
*
|
|
1635
|
+
* @example Delete a record and return it
|
|
1636
|
+
* ```ts
|
|
1637
|
+
* const { data, error } = await supabase
|
|
1638
|
+
* .from('countries')
|
|
1639
|
+
* .delete()
|
|
1640
|
+
* .eq('id', 1)
|
|
1641
|
+
* .select()
|
|
1642
|
+
* ```
|
|
1643
|
+
*
|
|
1644
|
+
* @exampleSql Delete a record and return it
|
|
1645
|
+
* ```sql
|
|
1646
|
+
* create table
|
|
1647
|
+
* countries (id int8 primary key, name text);
|
|
1648
|
+
*
|
|
1649
|
+
* insert into
|
|
1650
|
+
* countries (id, name)
|
|
1651
|
+
* values
|
|
1652
|
+
* (1, 'Mordor');
|
|
1653
|
+
* ```
|
|
1654
|
+
*
|
|
1655
|
+
* @exampleResponse Delete a record and return it
|
|
1656
|
+
* ```json
|
|
1657
|
+
* {
|
|
1658
|
+
* "data": [
|
|
1659
|
+
* {
|
|
1660
|
+
* "id": 1,
|
|
1661
|
+
* "name": "Mordor"
|
|
1662
|
+
* }
|
|
1663
|
+
* ],
|
|
1664
|
+
* "status": 200,
|
|
1665
|
+
* "statusText": "OK"
|
|
1666
|
+
* }
|
|
1667
|
+
* ```
|
|
1668
|
+
*
|
|
1669
|
+
* @example Delete multiple records
|
|
1670
|
+
* ```ts
|
|
1671
|
+
* const response = await supabase
|
|
1672
|
+
* .from('countries')
|
|
1673
|
+
* .delete()
|
|
1674
|
+
* .in('id', [1, 2, 3])
|
|
1675
|
+
* ```
|
|
1676
|
+
*
|
|
1677
|
+
* @exampleSql Delete multiple records
|
|
1678
|
+
* ```sql
|
|
1679
|
+
* create table
|
|
1680
|
+
* countries (id int8 primary key, name text);
|
|
1681
|
+
*
|
|
1682
|
+
* insert into
|
|
1683
|
+
* countries (id, name)
|
|
1684
|
+
* values
|
|
1685
|
+
* (1, 'Rohan'), (2, 'The Shire'), (3, 'Mordor');
|
|
1686
|
+
* ```
|
|
1687
|
+
*
|
|
1688
|
+
* @exampleResponse Delete multiple records
|
|
1689
|
+
* ```json
|
|
1690
|
+
* {
|
|
1691
|
+
* "status": 204,
|
|
1692
|
+
* "statusText": "No Content"
|
|
1693
|
+
* }
|
|
1694
|
+
* ```
|
|
1584
1695
|
*/
|
|
1585
1696
|
delete({
|
|
1586
1697
|
count,
|