@supabase/postgrest-js 2.108.2 → 2.108.3-canary.0

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.mjs CHANGED
@@ -1501,1310 +1501,77 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
1501
1501
  this.url.searchParams.append(column, `neq.${value}`);
1502
1502
  return this;
1503
1503
  }
1504
- /**
1505
- * Match only rows where `column` is greater than `value`.
1506
- *
1507
- * @param column - The column to filter on
1508
- * @param value - The value to filter with
1509
- *
1510
- * @category Database
1511
- * @subcategory Using filters
1512
- *
1513
- * @exampleDescription With `select()`
1514
- * When using [reserved words](https://www.postgresql.org/docs/current/sql-keywords-appendix.html) for column names you need
1515
- * to add double quotes e.g. `.gt('"order"', 2)`
1516
- *
1517
- * @example With `select()`
1518
- * ```ts
1519
- * const { data, error } = await supabase
1520
- * .from('characters')
1521
- * .select()
1522
- * .gt('id', 2)
1523
- * ```
1524
- *
1525
- * @exampleSql With `select()`
1526
- * ```sql
1527
- * create table
1528
- * characters (id int8 primary key, name text);
1529
- *
1530
- * insert into
1531
- * characters (id, name)
1532
- * values
1533
- * (1, 'Luke'),
1534
- * (2, 'Leia'),
1535
- * (3, 'Han');
1536
- * ```
1537
- *
1538
- * @exampleResponse With `select()`
1539
- * ```json
1540
- * {
1541
- * "data": [
1542
- * {
1543
- * "id": 3,
1544
- * "name": "Han"
1545
- * }
1546
- * ],
1547
- * "status": 200,
1548
- * "statusText": "OK"
1549
- * }
1550
- * ```
1551
- */
1552
1504
  gt(column, value) {
1553
1505
  this.url.searchParams.append(column, `gt.${value}`);
1554
1506
  return this;
1555
1507
  }
1556
- /**
1557
- * Match only rows where `column` is greater than or equal to `value`.
1558
- *
1559
- * @param column - The column to filter on
1560
- * @param value - The value to filter with
1561
- *
1562
- * @category Database
1563
- * @subcategory Using filters
1564
- *
1565
- * @example With `select()`
1566
- * ```ts
1567
- * const { data, error } = await supabase
1568
- * .from('characters')
1569
- * .select()
1570
- * .gte('id', 2)
1571
- * ```
1572
- *
1573
- * @exampleSql With `select()`
1574
- * ```sql
1575
- * create table
1576
- * characters (id int8 primary key, name text);
1577
- *
1578
- * insert into
1579
- * characters (id, name)
1580
- * values
1581
- * (1, 'Luke'),
1582
- * (2, 'Leia'),
1583
- * (3, 'Han');
1584
- * ```
1585
- *
1586
- * @exampleResponse With `select()`
1587
- * ```json
1588
- * {
1589
- * "data": [
1590
- * {
1591
- * "id": 2,
1592
- * "name": "Leia"
1593
- * },
1594
- * {
1595
- * "id": 3,
1596
- * "name": "Han"
1597
- * }
1598
- * ],
1599
- * "status": 200,
1600
- * "statusText": "OK"
1601
- * }
1602
- * ```
1603
- */
1604
1508
  gte(column, value) {
1605
1509
  this.url.searchParams.append(column, `gte.${value}`);
1606
1510
  return this;
1607
1511
  }
1608
- /**
1609
- * Match only rows where `column` is less than `value`.
1610
- *
1611
- * @param column - The column to filter on
1612
- * @param value - The value to filter with
1613
- *
1614
- * @category Database
1615
- * @subcategory Using filters
1616
- *
1617
- * @example With `select()`
1618
- * ```ts
1619
- * const { data, error } = await supabase
1620
- * .from('characters')
1621
- * .select()
1622
- * .lt('id', 2)
1623
- * ```
1624
- *
1625
- * @exampleSql With `select()`
1626
- * ```sql
1627
- * create table
1628
- * characters (id int8 primary key, name text);
1629
- *
1630
- * insert into
1631
- * characters (id, name)
1632
- * values
1633
- * (1, 'Luke'),
1634
- * (2, 'Leia'),
1635
- * (3, 'Han');
1636
- * ```
1637
- *
1638
- * @exampleResponse With `select()`
1639
- * ```json
1640
- * {
1641
- * "data": [
1642
- * {
1643
- * "id": 1,
1644
- * "name": "Luke"
1645
- * }
1646
- * ],
1647
- * "status": 200,
1648
- * "statusText": "OK"
1649
- * }
1650
- * ```
1651
- */
1652
1512
  lt(column, value) {
1653
1513
  this.url.searchParams.append(column, `lt.${value}`);
1654
1514
  return this;
1655
1515
  }
1656
- /**
1657
- * Match only rows where `column` is less than or equal to `value`.
1658
- *
1659
- * @param column - The column to filter on
1660
- * @param value - The value to filter with
1661
- *
1662
- * @category Database
1663
- * @subcategory Using filters
1664
- *
1665
- * @example With `select()`
1666
- * ```ts
1667
- * const { data, error } = await supabase
1668
- * .from('characters')
1669
- * .select()
1670
- * .lte('id', 2)
1671
- * ```
1672
- *
1673
- * @exampleSql With `select()`
1674
- * ```sql
1675
- * create table
1676
- * characters (id int8 primary key, name text);
1677
- *
1678
- * insert into
1679
- * characters (id, name)
1680
- * values
1681
- * (1, 'Luke'),
1682
- * (2, 'Leia'),
1683
- * (3, 'Han');
1684
- * ```
1685
- *
1686
- * @exampleResponse With `select()`
1687
- * ```json
1688
- * {
1689
- * "data": [
1690
- * {
1691
- * "id": 1,
1692
- * "name": "Luke"
1693
- * },
1694
- * {
1695
- * "id": 2,
1696
- * "name": "Leia"
1697
- * }
1698
- * ],
1699
- * "status": 200,
1700
- * "statusText": "OK"
1701
- * }
1702
- * ```
1703
- */
1704
1516
  lte(column, value) {
1705
1517
  this.url.searchParams.append(column, `lte.${value}`);
1706
1518
  return this;
1707
1519
  }
1708
- /**
1709
- * Match only rows where `column` matches `pattern` case-sensitively.
1710
- *
1711
- * @param column - The column to filter on
1712
- * @param pattern - The pattern to match with
1713
- *
1714
- * @category Database
1715
- * @subcategory Using filters
1716
- *
1717
- * @example With `select()`
1718
- * ```ts
1719
- * const { data, error } = await supabase
1720
- * .from('characters')
1721
- * .select()
1722
- * .like('name', '%Lu%')
1723
- * ```
1724
- *
1725
- * @exampleSql With `select()`
1726
- * ```sql
1727
- * create table
1728
- * characters (id int8 primary key, name text);
1729
- *
1730
- * insert into
1731
- * characters (id, name)
1732
- * values
1733
- * (1, 'Luke'),
1734
- * (2, 'Leia'),
1735
- * (3, 'Han');
1736
- * ```
1737
- *
1738
- * @exampleResponse With `select()`
1739
- * ```json
1740
- * {
1741
- * "data": [
1742
- * {
1743
- * "id": 1,
1744
- * "name": "Luke"
1745
- * }
1746
- * ],
1747
- * "status": 200,
1748
- * "statusText": "OK"
1749
- * }
1750
- * ```
1751
- */
1752
1520
  like(column, pattern) {
1753
1521
  this.url.searchParams.append(column, `like.${pattern}`);
1754
1522
  return this;
1755
1523
  }
1756
- /**
1757
- * Match only rows where `column` matches all of `patterns` case-sensitively.
1758
- *
1759
- * @param column - The column to filter on
1760
- * @param patterns - The patterns to match with
1761
- *
1762
- * @category Database
1763
- * @subcategory Using filters
1764
- */
1765
1524
  likeAllOf(column, patterns) {
1766
1525
  this.url.searchParams.append(column, `like(all).{${patterns.join(",")}}`);
1767
1526
  return this;
1768
1527
  }
1769
- /**
1770
- * Match only rows where `column` matches any of `patterns` case-sensitively.
1771
- *
1772
- * @param column - The column to filter on
1773
- * @param patterns - The patterns to match with
1774
- *
1775
- * @category Database
1776
- * @subcategory Using filters
1777
- */
1778
1528
  likeAnyOf(column, patterns) {
1779
1529
  this.url.searchParams.append(column, `like(any).{${patterns.join(",")}}`);
1780
1530
  return this;
1781
1531
  }
1782
- /**
1783
- * Match only rows where `column` matches `pattern` case-insensitively.
1784
- *
1785
- * @param column - The column to filter on
1786
- * @param pattern - The pattern to match with
1787
- *
1788
- * @category Database
1789
- * @subcategory Using filters
1790
- *
1791
- * @example With `select()`
1792
- * ```ts
1793
- * const { data, error } = await supabase
1794
- * .from('characters')
1795
- * .select()
1796
- * .ilike('name', '%lu%')
1797
- * ```
1798
- *
1799
- * @exampleSql With `select()`
1800
- * ```sql
1801
- * create table
1802
- * characters (id int8 primary key, name text);
1803
- *
1804
- * insert into
1805
- * characters (id, name)
1806
- * values
1807
- * (1, 'Luke'),
1808
- * (2, 'Leia'),
1809
- * (3, 'Han');
1810
- * ```
1811
- *
1812
- * @exampleResponse With `select()`
1813
- * ```json
1814
- * {
1815
- * "data": [
1816
- * {
1817
- * "id": 1,
1818
- * "name": "Luke"
1819
- * }
1820
- * ],
1821
- * "status": 200,
1822
- * "statusText": "OK"
1823
- * }
1824
- * ```
1825
- */
1826
1532
  ilike(column, pattern) {
1827
1533
  this.url.searchParams.append(column, `ilike.${pattern}`);
1828
1534
  return this;
1829
1535
  }
1830
- /**
1831
- * Match only rows where `column` matches all of `patterns` case-insensitively.
1832
- *
1833
- * @param column - The column to filter on
1834
- * @param patterns - The patterns to match with
1835
- *
1836
- * @category Database
1837
- * @subcategory Using filters
1838
- */
1839
1536
  ilikeAllOf(column, patterns) {
1840
1537
  this.url.searchParams.append(column, `ilike(all).{${patterns.join(",")}}`);
1841
1538
  return this;
1842
1539
  }
1843
- /**
1844
- * Match only rows where `column` matches any of `patterns` case-insensitively.
1845
- *
1846
- * @param column - The column to filter on
1847
- * @param patterns - The patterns to match with
1848
- *
1849
- * @category Database
1850
- * @subcategory Using filters
1851
- */
1852
1540
  ilikeAnyOf(column, patterns) {
1853
1541
  this.url.searchParams.append(column, `ilike(any).{${patterns.join(",")}}`);
1854
1542
  return this;
1855
1543
  }
1856
- /**
1857
- * Match only rows where `column` matches the PostgreSQL regex `pattern`
1858
- * case-sensitively (using the `~` operator).
1859
- *
1860
- * @param column - The column to filter on
1861
- * @param pattern - The PostgreSQL regular expression pattern to match with
1862
- */
1863
- regexMatch(column, pattern) {
1864
- this.url.searchParams.append(column, `match.${pattern}`);
1865
- return this;
1866
- }
1867
- /**
1868
- * Match only rows where `column` matches the PostgreSQL regex `pattern`
1869
- * case-insensitively (using the `~*` operator).
1870
- *
1871
- * @param column - The column to filter on
1872
- * @param pattern - The PostgreSQL regular expression pattern to match with
1873
- */
1874
- regexIMatch(column, pattern) {
1875
- this.url.searchParams.append(column, `imatch.${pattern}`);
1876
- return this;
1877
- }
1878
- /**
1879
- * Match only rows where `column` IS `value`.
1880
- *
1881
- * For non-boolean columns, this is only relevant for checking if the value of
1882
- * `column` is NULL by setting `value` to `null`.
1883
- *
1884
- * For boolean columns, you can also set `value` to `true` or `false` and it
1885
- * will behave the same way as `.eq()`.
1886
- *
1887
- * @param column - The column to filter on
1888
- * @param value - The value to filter with
1889
- *
1890
- * @category Database
1891
- * @subcategory Using filters
1892
- *
1893
- * @exampleDescription Checking for nullness, true or false
1894
- * Using the `eq()` filter doesn't work when filtering for `null`.
1895
- *
1896
- * Instead, you need to use `is()`.
1897
- *
1898
- * @example Checking for nullness, true or false
1899
- * ```ts
1900
- * const { data, error } = await supabase
1901
- * .from('countries')
1902
- * .select()
1903
- * .is('name', null)
1904
- * ```
1905
- *
1906
- * @exampleSql Checking for nullness, true or false
1907
- * ```sql
1908
- * create table
1909
- * countries (id int8 primary key, name text);
1910
- *
1911
- * insert into
1912
- * countries (id, name)
1913
- * values
1914
- * (1, 'null'),
1915
- * (2, null);
1916
- * ```
1917
- *
1918
- * @exampleResponse Checking for nullness, true or false
1919
- * ```json
1920
- * {
1921
- * "data": [
1922
- * {
1923
- * "id": 2,
1924
- * "name": "null"
1925
- * }
1926
- * ],
1927
- * "status": 200,
1928
- * "statusText": "OK"
1929
- * }
1930
- * ```
1931
- */
1932
- is(column, value) {
1933
- this.url.searchParams.append(column, `is.${value}`);
1934
- return this;
1935
- }
1936
- /**
1937
- * Match only rows where `column` IS DISTINCT FROM `value`.
1938
- *
1939
- * Unlike `.neq()`, this treats `NULL` as a comparable value. Two `NULL` values
1940
- * are considered equal (not distinct), and comparing `NULL` with any non-NULL
1941
- * value returns true (distinct).
1942
- *
1943
- * @param column - The column to filter on
1944
- * @param value - The value to filter with
1945
- */
1946
- isDistinct(column, value) {
1947
- this.url.searchParams.append(column, `isdistinct.${value}`);
1948
- return this;
1949
- }
1950
- /**
1951
- * Match only rows where `column` is included in the `values` array.
1952
- *
1953
- * @param column - The column to filter on
1954
- * @param values - The values array to filter with
1955
- *
1956
- * @category Database
1957
- * @subcategory Using filters
1958
- *
1959
- * @example With `select()`
1960
- * ```ts
1961
- * const { data, error } = await supabase
1962
- * .from('characters')
1963
- * .select()
1964
- * .in('name', ['Leia', 'Han'])
1965
- * ```
1966
- *
1967
- * @exampleSql With `select()`
1968
- * ```sql
1969
- * create table
1970
- * characters (id int8 primary key, name text);
1971
- *
1972
- * insert into
1973
- * characters (id, name)
1974
- * values
1975
- * (1, 'Luke'),
1976
- * (2, 'Leia'),
1977
- * (3, 'Han');
1978
- * ```
1979
- *
1980
- * @exampleResponse With `select()`
1981
- * ```json
1982
- * {
1983
- * "data": [
1984
- * {
1985
- * "id": 2,
1986
- * "name": "Leia"
1987
- * },
1988
- * {
1989
- * "id": 3,
1990
- * "name": "Han"
1991
- * }
1992
- * ],
1993
- * "status": 200,
1994
- * "statusText": "OK"
1995
- * }
1996
- * ```
1997
- */
1998
- in(column, values) {
1999
- const cleanedValues = Array.from(new Set(values)).map((s) => {
2000
- if (typeof s === "string" && PostgrestReservedCharsRegexp.test(s)) return `"${s}"`;
2001
- else return `${s}`;
2002
- }).join(",");
2003
- this.url.searchParams.append(column, `in.(${cleanedValues})`);
2004
- return this;
2005
- }
2006
- /**
2007
- * Match only rows where `column` is NOT included in the `values` array.
2008
- *
2009
- * @param column - The column to filter on
2010
- * @param values - The values array to filter with
2011
- */
2012
- notIn(column, values) {
2013
- const cleanedValues = Array.from(new Set(values)).map((s) => {
2014
- if (typeof s === "string" && PostgrestReservedCharsRegexp.test(s)) return `"${s}"`;
2015
- else return `${s}`;
2016
- }).join(",");
2017
- this.url.searchParams.append(column, `not.in.(${cleanedValues})`);
2018
- return this;
2019
- }
2020
- /**
2021
- * Only relevant for jsonb, array, and range columns. Match only rows where
2022
- * `column` contains every element appearing in `value`.
2023
- *
2024
- * @param column - The jsonb, array, or range column to filter on
2025
- * @param value - The jsonb, array, or range value to filter with
2026
- *
2027
- * @category Database
2028
- * @subcategory Using filters
2029
- *
2030
- * @example On array columns
2031
- * ```ts
2032
- * const { data, error } = await supabase
2033
- * .from('issues')
2034
- * .select()
2035
- * .contains('tags', ['is:open', 'priority:low'])
2036
- * ```
2037
- *
2038
- * @exampleSql On array columns
2039
- * ```sql
2040
- * create table
2041
- * issues (
2042
- * id int8 primary key,
2043
- * title text,
2044
- * tags text[]
2045
- * );
2046
- *
2047
- * insert into
2048
- * issues (id, title, tags)
2049
- * values
2050
- * (1, 'Cache invalidation is not working', array['is:open', 'severity:high', 'priority:low']),
2051
- * (2, 'Use better names', array['is:open', 'severity:low', 'priority:medium']);
2052
- * ```
2053
- *
2054
- * @exampleResponse On array columns
2055
- * ```json
2056
- * {
2057
- * "data": [
2058
- * {
2059
- * "title": "Cache invalidation is not working"
2060
- * }
2061
- * ],
2062
- * "status": 200,
2063
- * "statusText": "OK"
2064
- * }
2065
- * ```
2066
- *
2067
- * @exampleDescription On range columns
2068
- * Postgres supports a number of [range
2069
- * types](https://www.postgresql.org/docs/current/rangetypes.html). You
2070
- * can filter on range columns using the string representation of range
2071
- * values.
2072
- *
2073
- * @example On range columns
2074
- * ```ts
2075
- * const { data, error } = await supabase
2076
- * .from('reservations')
2077
- * .select()
2078
- * .contains('during', '[2000-01-01 13:00, 2000-01-01 13:30)')
2079
- * ```
2080
- *
2081
- * @exampleSql On range columns
2082
- * ```sql
2083
- * create table
2084
- * reservations (
2085
- * id int8 primary key,
2086
- * room_name text,
2087
- * during tsrange
2088
- * );
2089
- *
2090
- * insert into
2091
- * reservations (id, room_name, during)
2092
- * values
2093
- * (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),
2094
- * (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');
2095
- * ```
2096
- *
2097
- * @exampleResponse On range columns
2098
- * ```json
2099
- * {
2100
- * "data": [
2101
- * {
2102
- * "id": 1,
2103
- * "room_name": "Emerald",
2104
- * "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")"
2105
- * }
2106
- * ],
2107
- * "status": 200,
2108
- * "statusText": "OK"
2109
- * }
2110
- * ```
2111
- *
2112
- * @example On `jsonb` columns
2113
- * ```ts
2114
- * const { data, error } = await supabase
2115
- * .from('users')
2116
- * .select('name')
2117
- * .contains('address', { postcode: 90210 })
2118
- * ```
2119
- *
2120
- * @exampleSql On `jsonb` columns
2121
- * ```sql
2122
- * create table
2123
- * users (
2124
- * id int8 primary key,
2125
- * name text,
2126
- * address jsonb
2127
- * );
2128
- *
2129
- * insert into
2130
- * users (id, name, address)
2131
- * values
2132
- * (1, 'Michael', '{ "postcode": 90210, "street": "Melrose Place" }'),
2133
- * (2, 'Jane', '{}');
2134
- * ```
2135
- *
2136
- * @exampleResponse On `jsonb` columns
2137
- * ```json
2138
- * {
2139
- * "data": [
2140
- * {
2141
- * "name": "Michael"
2142
- * }
2143
- * ],
2144
- * "status": 200,
2145
- * "statusText": "OK"
2146
- * }
2147
- * ```
2148
- */
2149
- contains(column, value) {
2150
- if (typeof value === "string") this.url.searchParams.append(column, `cs.${value}`);
2151
- else if (Array.isArray(value)) this.url.searchParams.append(column, `cs.{${value.join(",")}}`);
2152
- else this.url.searchParams.append(column, `cs.${JSON.stringify(value)}`);
2153
- return this;
2154
- }
2155
- /**
2156
- * Only relevant for jsonb, array, and range columns. Match only rows where
2157
- * every element appearing in `column` is contained by `value`.
2158
- *
2159
- * @param column - The jsonb, array, or range column to filter on
2160
- * @param value - The jsonb, array, or range value to filter with
2161
- *
2162
- * @category Database
2163
- * @subcategory Using filters
2164
- *
2165
- * @example On array columns
2166
- * ```ts
2167
- * const { data, error } = await supabase
2168
- * .from('classes')
2169
- * .select('name')
2170
- * .containedBy('days', ['monday', 'tuesday', 'wednesday', 'friday'])
2171
- * ```
2172
- *
2173
- * @exampleSql On array columns
2174
- * ```sql
2175
- * create table
2176
- * classes (
2177
- * id int8 primary key,
2178
- * name text,
2179
- * days text[]
2180
- * );
2181
- *
2182
- * insert into
2183
- * classes (id, name, days)
2184
- * values
2185
- * (1, 'Chemistry', array['monday', 'friday']),
2186
- * (2, 'History', array['monday', 'wednesday', 'thursday']);
2187
- * ```
2188
- *
2189
- * @exampleResponse On array columns
2190
- * ```json
2191
- * {
2192
- * "data": [
2193
- * {
2194
- * "name": "Chemistry"
2195
- * }
2196
- * ],
2197
- * "status": 200,
2198
- * "statusText": "OK"
2199
- * }
2200
- * ```
2201
- *
2202
- * @exampleDescription On range columns
2203
- * Postgres supports a number of [range
2204
- * types](https://www.postgresql.org/docs/current/rangetypes.html). You
2205
- * can filter on range columns using the string representation of range
2206
- * values.
2207
- *
2208
- * @example On range columns
2209
- * ```ts
2210
- * const { data, error } = await supabase
2211
- * .from('reservations')
2212
- * .select()
2213
- * .containedBy('during', '[2000-01-01 00:00, 2000-01-01 23:59)')
2214
- * ```
2215
- *
2216
- * @exampleSql On range columns
2217
- * ```sql
2218
- * create table
2219
- * reservations (
2220
- * id int8 primary key,
2221
- * room_name text,
2222
- * during tsrange
2223
- * );
2224
- *
2225
- * insert into
2226
- * reservations (id, room_name, during)
2227
- * values
2228
- * (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),
2229
- * (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');
2230
- * ```
2231
- *
2232
- * @exampleResponse On range columns
2233
- * ```json
2234
- * {
2235
- * "data": [
2236
- * {
2237
- * "id": 1,
2238
- * "room_name": "Emerald",
2239
- * "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")"
2240
- * }
2241
- * ],
2242
- * "status": 200,
2243
- * "statusText": "OK"
2244
- * }
2245
- * ```
2246
- *
2247
- * @example On `jsonb` columns
2248
- * ```ts
2249
- * const { data, error } = await supabase
2250
- * .from('users')
2251
- * .select('name')
2252
- * .containedBy('address', {})
2253
- * ```
2254
- *
2255
- * @exampleSql On `jsonb` columns
2256
- * ```sql
2257
- * create table
2258
- * users (
2259
- * id int8 primary key,
2260
- * name text,
2261
- * address jsonb
2262
- * );
2263
- *
2264
- * insert into
2265
- * users (id, name, address)
2266
- * values
2267
- * (1, 'Michael', '{ "postcode": 90210, "street": "Melrose Place" }'),
2268
- * (2, 'Jane', '{}');
2269
- * ```
2270
- *
2271
- * @exampleResponse On `jsonb` columns
2272
- * ```json
2273
- * {
2274
- * "data": [
2275
- * {
2276
- * "name": "Jane"
2277
- * }
2278
- * ],
2279
- * "status": 200,
2280
- * "statusText": "OK"
2281
- * }
2282
- *
2283
- * ```
2284
- */
2285
- containedBy(column, value) {
2286
- if (typeof value === "string") this.url.searchParams.append(column, `cd.${value}`);
2287
- else if (Array.isArray(value)) this.url.searchParams.append(column, `cd.{${value.join(",")}}`);
2288
- else this.url.searchParams.append(column, `cd.${JSON.stringify(value)}`);
2289
- return this;
2290
- }
2291
- /**
2292
- * Only relevant for range columns. Match only rows where every element in
2293
- * `column` is greater than any element in `range`.
2294
- *
2295
- * @param column - The range column to filter on
2296
- * @param range - The range to filter with
2297
- *
2298
- * @category Database
2299
- * @subcategory Using filters
2300
- *
2301
- * @exampleDescription With `select()`
2302
- * Postgres supports a number of [range
2303
- * types](https://www.postgresql.org/docs/current/rangetypes.html). You
2304
- * can filter on range columns using the string representation of range
2305
- * values.
2306
- *
2307
- * @example With `select()`
2308
- * ```ts
2309
- * const { data, error } = await supabase
2310
- * .from('reservations')
2311
- * .select()
2312
- * .rangeGt('during', '[2000-01-02 08:00, 2000-01-02 09:00)')
2313
- * ```
2314
- *
2315
- * @exampleSql With `select()`
2316
- * ```sql
2317
- * create table
2318
- * reservations (
2319
- * id int8 primary key,
2320
- * room_name text,
2321
- * during tsrange
2322
- * );
2323
- *
2324
- * insert into
2325
- * reservations (id, room_name, during)
2326
- * values
2327
- * (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),
2328
- * (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');
2329
- * ```
2330
- *
2331
- * @exampleResponse With `select()`
2332
- * ```json
2333
- * {
2334
- * "data": [
2335
- * {
2336
- * "id": 2,
2337
- * "room_name": "Topaz",
2338
- * "during": "[\"2000-01-02 09:00:00\",\"2000-01-02 10:00:00\")"
2339
- * }
2340
- * ],
2341
- * "status": 200,
2342
- * "statusText": "OK"
2343
- * }
2344
- *
2345
- * ```
2346
- */
2347
- rangeGt(column, range) {
2348
- this.url.searchParams.append(column, `sr.${range}`);
2349
- return this;
2350
- }
2351
- /**
2352
- * Only relevant for range columns. Match only rows where every element in
2353
- * `column` is either contained in `range` or greater than any element in
2354
- * `range`.
2355
- *
2356
- * @param column - The range column to filter on
2357
- * @param range - The range to filter with
2358
- *
2359
- * @category Database
2360
- * @subcategory Using filters
2361
- *
2362
- * @exampleDescription With `select()`
2363
- * Postgres supports a number of [range
2364
- * types](https://www.postgresql.org/docs/current/rangetypes.html). You
2365
- * can filter on range columns using the string representation of range
2366
- * values.
2367
- *
2368
- * @example With `select()`
2369
- * ```ts
2370
- * const { data, error } = await supabase
2371
- * .from('reservations')
2372
- * .select()
2373
- * .rangeGte('during', '[2000-01-02 08:30, 2000-01-02 09:30)')
2374
- * ```
2375
- *
2376
- * @exampleSql With `select()`
2377
- * ```sql
2378
- * create table
2379
- * reservations (
2380
- * id int8 primary key,
2381
- * room_name text,
2382
- * during tsrange
2383
- * );
2384
- *
2385
- * insert into
2386
- * reservations (id, room_name, during)
2387
- * values
2388
- * (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),
2389
- * (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');
2390
- * ```
2391
- *
2392
- * @exampleResponse With `select()`
2393
- * ```json
2394
- * {
2395
- * "data": [
2396
- * {
2397
- * "id": 2,
2398
- * "room_name": "Topaz",
2399
- * "during": "[\"2000-01-02 09:00:00\",\"2000-01-02 10:00:00\")"
2400
- * }
2401
- * ],
2402
- * "status": 200,
2403
- * "statusText": "OK"
2404
- * }
2405
- *
2406
- * ```
2407
- */
2408
- rangeGte(column, range) {
2409
- this.url.searchParams.append(column, `nxl.${range}`);
2410
- return this;
2411
- }
2412
- /**
2413
- * Only relevant for range columns. Match only rows where every element in
2414
- * `column` is less than any element in `range`.
2415
- *
2416
- * @param column - The range column to filter on
2417
- * @param range - The range to filter with
2418
- *
2419
- * @category Database
2420
- * @subcategory Using filters
2421
- *
2422
- * @exampleDescription With `select()`
2423
- * Postgres supports a number of [range
2424
- * types](https://www.postgresql.org/docs/current/rangetypes.html). You
2425
- * can filter on range columns using the string representation of range
2426
- * values.
2427
- *
2428
- * @example With `select()`
2429
- * ```ts
2430
- * const { data, error } = await supabase
2431
- * .from('reservations')
2432
- * .select()
2433
- * .rangeLt('during', '[2000-01-01 15:00, 2000-01-01 16:00)')
2434
- * ```
2435
- *
2436
- * @exampleSql With `select()`
2437
- * ```sql
2438
- * create table
2439
- * reservations (
2440
- * id int8 primary key,
2441
- * room_name text,
2442
- * during tsrange
2443
- * );
2444
- *
2445
- * insert into
2446
- * reservations (id, room_name, during)
2447
- * values
2448
- * (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),
2449
- * (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');
2450
- * ```
2451
- *
2452
- * @exampleResponse With `select()`
2453
- * ```json
2454
- * {
2455
- * "data": [
2456
- * {
2457
- * "id": 1,
2458
- * "room_name": "Emerald",
2459
- * "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")"
2460
- * }
2461
- * ],
2462
- * "status": 200,
2463
- * "statusText": "OK"
2464
- * }
2465
- * ```
2466
- */
2467
- rangeLt(column, range) {
2468
- this.url.searchParams.append(column, `sl.${range}`);
2469
- return this;
2470
- }
2471
- /**
2472
- * Only relevant for range columns. Match only rows where every element in
2473
- * `column` is either contained in `range` or less than any element in
2474
- * `range`.
2475
- *
2476
- * @param column - The range column to filter on
2477
- * @param range - The range to filter with
2478
- *
2479
- * @category Database
2480
- * @subcategory Using filters
2481
- *
2482
- * @exampleDescription With `select()`
2483
- * Postgres supports a number of [range
2484
- * types](https://www.postgresql.org/docs/current/rangetypes.html). You
2485
- * can filter on range columns using the string representation of range
2486
- * values.
2487
- *
2488
- * @example With `select()`
2489
- * ```ts
2490
- * const { data, error } = await supabase
2491
- * .from('reservations')
2492
- * .select()
2493
- * .rangeLte('during', '[2000-01-01 14:00, 2000-01-01 16:00)')
2494
- * ```
2495
- *
2496
- * @exampleSql With `select()`
2497
- * ```sql
2498
- * create table
2499
- * reservations (
2500
- * id int8 primary key,
2501
- * room_name text,
2502
- * during tsrange
2503
- * );
2504
- *
2505
- * insert into
2506
- * reservations (id, room_name, during)
2507
- * values
2508
- * (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),
2509
- * (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');
2510
- * ```
2511
- *
2512
- * @exampleResponse With `select()`
2513
- * ```json
2514
- * {
2515
- * "data": [
2516
- * {
2517
- * "id": 1,
2518
- * "room_name": "Emerald",
2519
- * "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")"
2520
- * }
2521
- * ],
2522
- * "status": 200,
2523
- * "statusText": "OK"
2524
- * }
2525
- *
2526
- * ```
2527
- */
2528
- rangeLte(column, range) {
2529
- this.url.searchParams.append(column, `nxr.${range}`);
2530
- return this;
2531
- }
2532
- /**
2533
- * Only relevant for range columns. Match only rows where `column` is
2534
- * mutually exclusive to `range` and there can be no element between the two
2535
- * ranges.
2536
- *
2537
- * @param column - The range column to filter on
2538
- * @param range - The range to filter with
2539
- *
2540
- * @category Database
2541
- * @subcategory Using filters
2542
- *
2543
- * @exampleDescription With `select()`
2544
- * Postgres supports a number of [range
2545
- * types](https://www.postgresql.org/docs/current/rangetypes.html). You
2546
- * can filter on range columns using the string representation of range
2547
- * values.
2548
- *
2549
- * @example With `select()`
2550
- * ```ts
2551
- * const { data, error } = await supabase
2552
- * .from('reservations')
2553
- * .select()
2554
- * .rangeAdjacent('during', '[2000-01-01 12:00, 2000-01-01 13:00)')
2555
- * ```
2556
- *
2557
- * @exampleSql With `select()`
2558
- * ```sql
2559
- * create table
2560
- * reservations (
2561
- * id int8 primary key,
2562
- * room_name text,
2563
- * during tsrange
2564
- * );
2565
- *
2566
- * insert into
2567
- * reservations (id, room_name, during)
2568
- * values
2569
- * (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),
2570
- * (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');
2571
- * ```
2572
- *
2573
- * @exampleResponse With `select()`
2574
- * ```json
2575
- * {
2576
- * "data": [
2577
- * {
2578
- * "id": 1,
2579
- * "room_name": "Emerald",
2580
- * "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")"
2581
- * }
2582
- * ],
2583
- * "status": 200,
2584
- * "statusText": "OK"
2585
- * }
2586
- * ```
2587
- */
2588
- rangeAdjacent(column, range) {
2589
- this.url.searchParams.append(column, `adj.${range}`);
2590
- return this;
2591
- }
2592
- /**
2593
- * Only relevant for array and range columns. Match only rows where
2594
- * `column` and `value` have an element in common.
2595
- *
2596
- * @param column - The array or range column to filter on
2597
- * @param value - The array or range value to filter with
2598
- *
2599
- * @category Database
2600
- * @subcategory Using filters
2601
- *
2602
- * @example On array columns
2603
- * ```ts
2604
- * const { data, error } = await supabase
2605
- * .from('issues')
2606
- * .select('title')
2607
- * .overlaps('tags', ['is:closed', 'severity:high'])
2608
- * ```
2609
- *
2610
- * @exampleSql On array columns
2611
- * ```sql
2612
- * create table
2613
- * issues (
2614
- * id int8 primary key,
2615
- * title text,
2616
- * tags text[]
2617
- * );
2618
- *
2619
- * insert into
2620
- * issues (id, title, tags)
2621
- * values
2622
- * (1, 'Cache invalidation is not working', array['is:open', 'severity:high', 'priority:low']),
2623
- * (2, 'Use better names', array['is:open', 'severity:low', 'priority:medium']);
2624
- * ```
2625
- *
2626
- * @exampleResponse On array columns
2627
- * ```json
2628
- * {
2629
- * "data": [
2630
- * {
2631
- * "title": "Cache invalidation is not working"
2632
- * }
2633
- * ],
2634
- * "status": 200,
2635
- * "statusText": "OK"
2636
- * }
2637
- * ```
2638
- *
2639
- * @exampleDescription On range columns
2640
- * Postgres supports a number of [range
2641
- * types](https://www.postgresql.org/docs/current/rangetypes.html). You
2642
- * can filter on range columns using the string representation of range
2643
- * values.
2644
- *
2645
- * @example On range columns
2646
- * ```ts
2647
- * const { data, error } = await supabase
2648
- * .from('reservations')
2649
- * .select()
2650
- * .overlaps('during', '[2000-01-01 12:45, 2000-01-01 13:15)')
2651
- * ```
2652
- *
2653
- * @exampleSql On range columns
2654
- * ```sql
2655
- * create table
2656
- * reservations (
2657
- * id int8 primary key,
2658
- * room_name text,
2659
- * during tsrange
2660
- * );
2661
- *
2662
- * insert into
2663
- * reservations (id, room_name, during)
2664
- * values
2665
- * (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),
2666
- * (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');
2667
- * ```
2668
- *
2669
- * @exampleResponse On range columns
2670
- * ```json
2671
- * {
2672
- * "data": [
2673
- * {
2674
- * "id": 1,
2675
- * "room_name": "Emerald",
2676
- * "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")"
2677
- * }
2678
- * ],
2679
- * "status": 200,
2680
- * "statusText": "OK"
2681
- * }
2682
- * ```
2683
- */
2684
- overlaps(column, value) {
2685
- if (typeof value === "string") this.url.searchParams.append(column, `ov.${value}`);
2686
- else this.url.searchParams.append(column, `ov.{${value.join(",")}}`);
1544
+ regexMatch(column, pattern) {
1545
+ this.url.searchParams.append(column, `match.${pattern}`);
1546
+ return this;
1547
+ }
1548
+ regexIMatch(column, pattern) {
1549
+ this.url.searchParams.append(column, `imatch.${pattern}`);
1550
+ return this;
1551
+ }
1552
+ is(column, value) {
1553
+ this.url.searchParams.append(column, `is.${value}`);
2687
1554
  return this;
2688
1555
  }
2689
1556
  /**
2690
- * Only relevant for text and tsvector columns. Match only rows where
2691
- * `column` matches the query string in `query`.
2692
- *
2693
- * @param column - The text or tsvector column to filter on
2694
- * @param query - The query text to match with
2695
- * @param options - Named parameters
2696
- * @param options.config - The text search configuration to use
2697
- * @param options.type - Change how the `query` text is interpreted
2698
- *
2699
- * @category Database
2700
- * @subcategory Using filters
2701
- *
2702
- * @remarks
2703
- * - For more information, see [Postgres full text search](/docs/guides/database/full-text-search).
2704
- *
2705
- * @example Text search
2706
- * ```ts
2707
- * const result = await supabase
2708
- * .from("texts")
2709
- * .select("content")
2710
- * .textSearch("content", `'eggs' & 'ham'`, {
2711
- * config: "english",
2712
- * });
2713
- * ```
2714
- *
2715
- * @exampleSql Text search
2716
- * ```sql
2717
- * create table texts (
2718
- * id bigint
2719
- * primary key
2720
- * generated always as identity,
2721
- * content text
2722
- * );
2723
- *
2724
- * insert into texts (content) values
2725
- * ('Four score and seven years ago'),
2726
- * ('The road goes ever on and on'),
2727
- * ('Green eggs and ham')
2728
- * ;
2729
- * ```
2730
- *
2731
- * @exampleResponse Text search
2732
- * ```json
2733
- * {
2734
- * "data": [
2735
- * {
2736
- * "content": "Green eggs and ham"
2737
- * }
2738
- * ],
2739
- * "status": 200,
2740
- * "statusText": "OK"
2741
- * }
2742
- * ```
2743
- *
2744
- * @exampleDescription Basic normalization
2745
- * Uses PostgreSQL's `plainto_tsquery` function.
2746
- *
2747
- * @example Basic normalization
2748
- * ```ts
2749
- * const { data, error } = await supabase
2750
- * .from('quotes')
2751
- * .select('catchphrase')
2752
- * .textSearch('catchphrase', `'fat' & 'cat'`, {
2753
- * type: 'plain',
2754
- * config: 'english'
2755
- * })
2756
- * ```
2757
- *
2758
- * @exampleDescription Full normalization
2759
- * Uses PostgreSQL's `phraseto_tsquery` function.
2760
- *
2761
- * @example Full normalization
2762
- * ```ts
2763
- * const { data, error } = await supabase
2764
- * .from('quotes')
2765
- * .select('catchphrase')
2766
- * .textSearch('catchphrase', `'fat' & 'cat'`, {
2767
- * type: 'phrase',
2768
- * config: 'english'
2769
- * })
2770
- * ```
2771
- *
2772
- * @exampleDescription Websearch
2773
- * Uses PostgreSQL's `websearch_to_tsquery` function.
2774
- * This function will never raise syntax errors, which makes it possible to use raw user-supplied input for search, and can be used
2775
- * with advanced operators.
1557
+ * Match only rows where `column` IS DISTINCT FROM `value`.
2776
1558
  *
2777
- * - `unquoted text`: text not inside quote marks will be converted to terms separated by & operators, as if processed by plainto_tsquery.
2778
- * - `"quoted text"`: text inside quote marks will be converted to terms separated by `<->` operators, as if processed by phraseto_tsquery.
2779
- * - `OR`: the word “or” will be converted to the | operator.
2780
- * - `-`: a dash will be converted to the ! operator.
1559
+ * Unlike `.neq()`, this treats `NULL` as a comparable value. Two `NULL` values
1560
+ * are considered equal (not distinct), and comparing `NULL` with any non-NULL
1561
+ * value returns true (distinct).
2781
1562
  *
2782
- * @example Websearch
2783
- * ```ts
2784
- * const { data, error } = await supabase
2785
- * .from('quotes')
2786
- * .select('catchphrase')
2787
- * .textSearch('catchphrase', `'fat or cat'`, {
2788
- * type: 'websearch',
2789
- * config: 'english'
2790
- * })
2791
- * ```
1563
+ * @param column - The column to filter on
1564
+ * @param value - The value to filter with
2792
1565
  */
2793
- textSearch(column, query, { config, type } = {}) {
2794
- let typePart = "";
2795
- if (type === "plain") typePart = "pl";
2796
- else if (type === "phrase") typePart = "ph";
2797
- else if (type === "websearch") typePart = "w";
2798
- const configPart = config === void 0 ? "" : `(${config})`;
2799
- this.url.searchParams.append(column, `${typePart}fts${configPart}.${query}`);
1566
+ isDistinct(column, value) {
1567
+ this.url.searchParams.append(column, `isdistinct.${value}`);
2800
1568
  return this;
2801
1569
  }
2802
1570
  /**
2803
- * Match only rows where each column in `query` keys is equal to its
2804
- * associated value. Shorthand for multiple `.eq()`s.
1571
+ * Match only rows where `column` is included in the `values` array.
2805
1572
  *
2806
- * @param query - The object to filter with, with column names as keys mapped
2807
- * to their filter values
1573
+ * @param column - The column to filter on
1574
+ * @param values - The values array to filter with
2808
1575
  *
2809
1576
  * @category Database
2810
1577
  * @subcategory Using filters
@@ -2813,8 +1580,8 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
2813
1580
  * ```ts
2814
1581
  * const { data, error } = await supabase
2815
1582
  * .from('characters')
2816
- * .select('name')
2817
- * .match({ id: 2, name: 'Leia' })
1583
+ * .select()
1584
+ * .in('name', ['Leia', 'Han'])
2818
1585
  * ```
2819
1586
  *
2820
1587
  * @exampleSql With `select()`
@@ -2835,7 +1602,12 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
2835
1602
  * {
2836
1603
  * "data": [
2837
1604
  * {
1605
+ * "id": 2,
2838
1606
  * "name": "Leia"
1607
+ * },
1608
+ * {
1609
+ * "id": 3,
1610
+ * "name": "Han"
2839
1611
  * }
2840
1612
  * ],
2841
1613
  * "status": 200,
@@ -2843,6 +1615,74 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
2843
1615
  * }
2844
1616
  * ```
2845
1617
  */
1618
+ in(column, values) {
1619
+ const cleanedValues = Array.from(new Set(values)).map((s) => {
1620
+ if (typeof s === "string" && PostgrestReservedCharsRegexp.test(s)) return `"${s}"`;
1621
+ else return `${s}`;
1622
+ }).join(",");
1623
+ this.url.searchParams.append(column, `in.(${cleanedValues})`);
1624
+ return this;
1625
+ }
1626
+ /**
1627
+ * Match only rows where `column` is NOT included in the `values` array.
1628
+ *
1629
+ * @param column - The column to filter on
1630
+ * @param values - The values array to filter with
1631
+ */
1632
+ notIn(column, values) {
1633
+ const cleanedValues = Array.from(new Set(values)).map((s) => {
1634
+ if (typeof s === "string" && PostgrestReservedCharsRegexp.test(s)) return `"${s}"`;
1635
+ else return `${s}`;
1636
+ }).join(",");
1637
+ this.url.searchParams.append(column, `not.in.(${cleanedValues})`);
1638
+ return this;
1639
+ }
1640
+ contains(column, value) {
1641
+ if (typeof value === "string") this.url.searchParams.append(column, `cs.${value}`);
1642
+ else if (Array.isArray(value)) this.url.searchParams.append(column, `cs.{${value.join(",")}}`);
1643
+ else this.url.searchParams.append(column, `cs.${JSON.stringify(value)}`);
1644
+ return this;
1645
+ }
1646
+ containedBy(column, value) {
1647
+ if (typeof value === "string") this.url.searchParams.append(column, `cd.${value}`);
1648
+ else if (Array.isArray(value)) this.url.searchParams.append(column, `cd.{${value.join(",")}}`);
1649
+ else this.url.searchParams.append(column, `cd.${JSON.stringify(value)}`);
1650
+ return this;
1651
+ }
1652
+ rangeGt(column, range) {
1653
+ this.url.searchParams.append(column, `sr.${range}`);
1654
+ return this;
1655
+ }
1656
+ rangeGte(column, range) {
1657
+ this.url.searchParams.append(column, `nxl.${range}`);
1658
+ return this;
1659
+ }
1660
+ rangeLt(column, range) {
1661
+ this.url.searchParams.append(column, `sl.${range}`);
1662
+ return this;
1663
+ }
1664
+ rangeLte(column, range) {
1665
+ this.url.searchParams.append(column, `nxr.${range}`);
1666
+ return this;
1667
+ }
1668
+ rangeAdjacent(column, range) {
1669
+ this.url.searchParams.append(column, `adj.${range}`);
1670
+ return this;
1671
+ }
1672
+ overlaps(column, value) {
1673
+ if (typeof value === "string") this.url.searchParams.append(column, `ov.${value}`);
1674
+ else this.url.searchParams.append(column, `ov.{${value.join(",")}}`);
1675
+ return this;
1676
+ }
1677
+ textSearch(column, query, { config, type } = {}) {
1678
+ let typePart = "";
1679
+ if (type === "plain") typePart = "pl";
1680
+ else if (type === "phrase") typePart = "ph";
1681
+ else if (type === "websearch") typePart = "w";
1682
+ const configPart = config === void 0 ? "" : `(${config})`;
1683
+ this.url.searchParams.append(column, `${typePart}fts${configPart}.${query}`);
1684
+ return this;
1685
+ }
2846
1686
  match(query) {
2847
1687
  Object.entries(query).filter(([_, value]) => value !== void 0).forEach(([column, value]) => {
2848
1688
  this.url.searchParams.append(column, `eq.${value}`);
@@ -3068,119 +1908,6 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
3068
1908
  this.url.searchParams.append(key, `(${filters})`);
3069
1909
  return this;
3070
1910
  }
3071
- /**
3072
- * Match only rows which satisfy the filter. This is an escape hatch - you
3073
- * should use the specific filter methods wherever possible.
3074
- *
3075
- * Unlike most filters, `opearator` and `value` are used as-is and need to
3076
- * follow [PostgREST
3077
- * syntax](https://postgrest.org/en/stable/api.html#operators). You also need
3078
- * to make sure they are properly sanitized.
3079
- *
3080
- * @param column - The column to filter on
3081
- * @param operator - The operator to filter with, following PostgREST syntax
3082
- * @param value - The value to filter with, following PostgREST syntax
3083
- *
3084
- * @category Database
3085
- * @subcategory Using filters
3086
- *
3087
- * @remarks
3088
- * filter() expects you to use the raw PostgREST syntax for the filter values.
3089
- *
3090
- * ```ts
3091
- * .filter('id', 'in', '(5,6,7)') // Use `()` for `in` filter
3092
- * .filter('arraycol', 'cs', '{"a","b"}') // Use `cs` for `contains()`, `{}` for array values
3093
- * ```
3094
- *
3095
- * @example With `select()`
3096
- * ```ts
3097
- * const { data, error } = await supabase
3098
- * .from('characters')
3099
- * .select()
3100
- * .filter('name', 'in', '("Han","Yoda")')
3101
- * ```
3102
- *
3103
- * @exampleSql With `select()`
3104
- * ```sql
3105
- * create table
3106
- * characters (id int8 primary key, name text);
3107
- *
3108
- * insert into
3109
- * characters (id, name)
3110
- * values
3111
- * (1, 'Luke'),
3112
- * (2, 'Leia'),
3113
- * (3, 'Han');
3114
- * ```
3115
- *
3116
- * @exampleResponse With `select()`
3117
- * ```json
3118
- * {
3119
- * "data": [
3120
- * {
3121
- * "id": 3,
3122
- * "name": "Han"
3123
- * }
3124
- * ],
3125
- * "status": 200,
3126
- * "statusText": "OK"
3127
- * }
3128
- * ```
3129
- *
3130
- * @example On a referenced table
3131
- * ```ts
3132
- * const { data, error } = await supabase
3133
- * .from('orchestral_sections')
3134
- * .select(`
3135
- * name,
3136
- * instruments!inner (
3137
- * name
3138
- * )
3139
- * `)
3140
- * .filter('instruments.name', 'eq', 'flute')
3141
- * ```
3142
- *
3143
- * @exampleSql On a referenced table
3144
- * ```sql
3145
- * create table
3146
- * orchestral_sections (id int8 primary key, name text);
3147
- * create table
3148
- * instruments (
3149
- * id int8 primary key,
3150
- * section_id int8 not null references orchestral_sections,
3151
- * name text
3152
- * );
3153
- *
3154
- * insert into
3155
- * orchestral_sections (id, name)
3156
- * values
3157
- * (1, 'strings'),
3158
- * (2, 'woodwinds');
3159
- * insert into
3160
- * instruments (id, section_id, name)
3161
- * values
3162
- * (1, 2, 'flute'),
3163
- * (2, 1, 'violin');
3164
- * ```
3165
- *
3166
- * @exampleResponse On a referenced table
3167
- * ```json
3168
- * {
3169
- * "data": [
3170
- * {
3171
- * "name": "woodwinds",
3172
- * "instruments": [
3173
- * {
3174
- * "name": "flute"
3175
- * }
3176
- * ]
3177
- * }
3178
- * ],
3179
- * "status": 200,
3180
- * "statusText": "OK"
3181
- * }
3182
- * ```
3183
- */
3184
1911
  filter(column, operator, value) {
3185
1912
  this.url.searchParams.append(column, `${operator}.${value}`);
3186
1913
  return this;
@@ -4909,13 +3636,6 @@ var PostgrestClient = class PostgrestClient {
4909
3636
  else this.fetch = originalFetch;
4910
3637
  this.retry = retry;
4911
3638
  }
4912
- /**
4913
- * Perform a query on a table or a view.
4914
- *
4915
- * @param relation - The table or view name to query
4916
- *
4917
- * @category Database
4918
- */
4919
3639
  from(relation) {
4920
3640
  if (!relation || typeof relation !== "string" || relation.trim() === "") throw new Error("Invalid relation name: relation must be a non-empty string.");
4921
3641
  return new PostgrestQueryBuilder(new URL(`${this.url}/${relation}`), {