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