@supabase/postgrest-js 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main/PostgrestBuilder.d.ts.map +1 -1
- package/dist/main/PostgrestBuilder.js +17 -3
- package/dist/main/PostgrestBuilder.js.map +1 -1
- package/dist/main/PostgrestClient.d.ts +0 -5
- package/dist/main/PostgrestClient.d.ts.map +1 -1
- package/dist/main/PostgrestClient.js +5 -0
- package/dist/main/PostgrestClient.js.map +1 -1
- package/dist/main/PostgrestFilterBuilder.d.ts +0 -170
- package/dist/main/PostgrestFilterBuilder.d.ts.map +1 -1
- package/dist/main/PostgrestFilterBuilder.js +170 -0
- package/dist/main/PostgrestFilterBuilder.js.map +1 -1
- package/dist/main/PostgrestTransformBuilder.d.ts +0 -16
- package/dist/main/PostgrestTransformBuilder.d.ts.map +1 -1
- package/dist/main/PostgrestTransformBuilder.js +16 -0
- package/dist/main/PostgrestTransformBuilder.js.map +1 -1
- package/dist/main/version.d.ts +1 -1
- package/dist/main/version.js +1 -1
- package/dist/module/PostgrestBuilder.d.ts.map +1 -1
- package/dist/module/PostgrestBuilder.js +17 -3
- package/dist/module/PostgrestBuilder.js.map +1 -1
- package/dist/module/PostgrestClient.d.ts +0 -5
- package/dist/module/PostgrestClient.d.ts.map +1 -1
- package/dist/module/PostgrestClient.js +5 -0
- package/dist/module/PostgrestClient.js.map +1 -1
- package/dist/module/PostgrestFilterBuilder.d.ts +0 -170
- package/dist/module/PostgrestFilterBuilder.d.ts.map +1 -1
- package/dist/module/PostgrestFilterBuilder.js +170 -0
- package/dist/module/PostgrestFilterBuilder.js.map +1 -1
- package/dist/module/PostgrestTransformBuilder.d.ts +0 -16
- package/dist/module/PostgrestTransformBuilder.d.ts.map +1 -1
- package/dist/module/PostgrestTransformBuilder.js +16 -0
- package/dist/module/PostgrestTransformBuilder.js.map +1 -1
- package/dist/module/version.d.ts +1 -1
- package/dist/module/version.js +1 -1
- package/package.json +3 -3
- package/src/PostgrestBuilder.ts +16 -2
- package/src/PostgrestClient.ts +5 -5
- package/src/PostgrestFilterBuilder.ts +72 -72
- package/src/PostgrestTransformBuilder.ts +8 -8
- package/src/version.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PostgrestBuilder.d.ts","sourceRoot":"","sources":["../../src/PostgrestBuilder.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEvD,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,gBAAgB,CAAC,MAAM,CACnD,YAAW,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAEjD,SAAS,CAAC,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAA;IAC9D,SAAS,CAAC,GAAG,EAAE,GAAG,CAAA;IAClB,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACzC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACzB,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;IACxB,SAAS,CAAC,kBAAkB,UAAQ;IACpC,SAAS,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;IAC9B,SAAS,CAAC,KAAK,EAAE,KAAK,CAAA;IACtB,SAAS,CAAC,UAAU,EAAE,OAAO,CAAA;gBAEjB,OAAO,EAAE,gBAAgB,CAAC,MAAM,CAAC;IAmB7C;;;;;OAKG;IACH,YAAY,IAAI,IAAI;IAKpB,IAAI,CAAC,QAAQ,GAAG,iBAAiB,CAAC,MAAM,CAAC,EAAE,QAAQ,GAAG,KAAK,EACzD,WAAW,CAAC,EACR,CAAC,CAAC,KAAK,EAAE,iBAAiB,CAAC,MAAM,CAAC,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GACxE,SAAS,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AC,GACxE,SAAS,GACT,IAAI,EACR,UAAU,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,GAAG,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,GAClF,WAAW,CAAC,QAAQ,GAAG,QAAQ,CAAC;CAiHpC"}
|
|
@@ -100,11 +100,25 @@ class PostgrestBuilder {
|
|
|
100
100
|
const body = yield res.text();
|
|
101
101
|
try {
|
|
102
102
|
error = JSON.parse(body);
|
|
103
|
+
// Workaround for https://github.com/supabase/postgrest-js/issues/295
|
|
104
|
+
if (Array.isArray(error) && res.status === 404) {
|
|
105
|
+
data = [];
|
|
106
|
+
error = null;
|
|
107
|
+
status = 200;
|
|
108
|
+
statusText = 'OK';
|
|
109
|
+
}
|
|
103
110
|
}
|
|
104
111
|
catch (_d) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
112
|
+
// Workaround for https://github.com/supabase/postgrest-js/issues/295
|
|
113
|
+
if (res.status === 404 && body === '') {
|
|
114
|
+
status = 204;
|
|
115
|
+
statusText = 'No Content';
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
error = {
|
|
119
|
+
message: body,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
108
122
|
}
|
|
109
123
|
if (error && this.allowEmpty && ((_c = error === null || error === void 0 ? void 0 : error.details) === null || _c === void 0 ? void 0 : _c.includes('Results contain 0 rows'))) {
|
|
110
124
|
error = null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PostgrestBuilder.js","sourceRoot":"","sources":["../../src/PostgrestBuilder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,8DAAoC;AAIpC,MAA8B,gBAAgB;IAa5C,YAAY,OAAiC;QALnC,uBAAkB,GAAG,KAAK,CAAA;QAMlC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;QAC5B,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,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AAE;iBAC5B;gBACD,IAAI,EAAE,IAAI;gBACV,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE,CAAC;gBACT,UAAU,EAAE,EAAE;aACf,CAAC,CAAC,CAAA;SACJ;QAED,OAAO,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAA;IAC1C,CAAC;CACF;AAlKD,mCAkKC"}
|
|
@@ -30,11 +30,6 @@ export default class PostgrestClient<Database = any, SchemaName extends string &
|
|
|
30
30
|
schema?: SchemaName;
|
|
31
31
|
fetch?: Fetch;
|
|
32
32
|
});
|
|
33
|
-
/**
|
|
34
|
-
* Perform a query on a table or a view.
|
|
35
|
-
*
|
|
36
|
-
* @param relation - The table or view name to query
|
|
37
|
-
*/
|
|
38
33
|
from<TableName extends string & keyof Schema['Tables'], Table extends Schema['Tables'][TableName]>(relation: TableName): PostgrestQueryBuilder<Schema, Table>;
|
|
39
34
|
from<ViewName extends string & keyof Schema['Views'], View extends Schema['Views'][ViewName]>(relation: ViewName): PostgrestQueryBuilder<Schema, View>;
|
|
40
35
|
from(relation: string): PostgrestQueryBuilder<Schema, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PostgrestClient.d.ts","sourceRoot":"","sources":["../../src/PostgrestClient.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,MAAM,yBAAyB,CAAA;AAC3D,OAAO,sBAAsB,MAAM,0BAA0B,CAAA;AAG7D,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE9C;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,OAAO,eAAe,CAClC,QAAQ,GAAG,GAAG,EACd,UAAU,SAAS,MAAM,GAAG,MAAM,QAAQ,GAAG,QAAQ,SAAS,MAAM,QAAQ,GACxE,QAAQ,GACR,MAAM,GAAG,MAAM,QAAQ,EAC3B,MAAM,SAAS,aAAa,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,aAAa,GACrE,QAA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C5B,KAAK,GACP,KAAK,EACT,SAAS,CAAC,SAAS,CAAC,CACrB;CA6BF"}
|
|
@@ -33,6 +33,11 @@ class PostgrestClient {
|
|
|
33
33
|
this.schema = schema;
|
|
34
34
|
this.fetch = fetch;
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Perform a query on a table or a view.
|
|
38
|
+
*
|
|
39
|
+
* @param relation - The table or view name to query
|
|
40
|
+
*/
|
|
36
41
|
from(relation) {
|
|
37
42
|
const url = new URL(`${this.url}/${relation}`);
|
|
38
43
|
return new PostgrestQueryBuilder_1.default(url, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PostgrestClient.js","sourceRoot":"","sources":["../../src/PostgrestClient.ts"],"names":[],"mappings":";;;;;AAAA,oFAA2D;AAC3D,sFAA6D;AAE7D,2CAA6C;AAG7C;;;;;;;;;GASG;AACH,MAAqB,eAAe;IAclC,mEAAmE;IACnE;;;;;;;;OAQG;IACH,YACE,GAAW,EACX,EACE,OAAO,GAAG,EAAE,EACZ,MAAM,EACN,KAAK,MAKH,EAAE;QAEN,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,OAAO,mCAAQ,2BAAe,GAAK,OAAO,CAAE,CAAA;QACjD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;
|
|
1
|
+
{"version":3,"file":"PostgrestClient.js","sourceRoot":"","sources":["../../src/PostgrestClient.ts"],"names":[],"mappings":";;;;;AAAA,oFAA2D;AAC3D,sFAA6D;AAE7D,2CAA6C;AAG7C;;;;;;;;;GASG;AACH,MAAqB,eAAe;IAclC,mEAAmE;IACnE;;;;;;;;OAQG;IACH,YACE,GAAW,EACX,EACE,OAAO,GAAG,EAAE,EACZ,MAAM,EACN,KAAK,MAKH,EAAE;QAEN,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,OAAO,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A;SACrC;QAED,OAAO,IAAI,gCAAsB,CAAC;YAChC,MAAM;YACN,GAAG;YACH,OAAO;YACP,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,IAAI;YACJ,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,UAAU,EAAE,KAAK;SACmC,CAAC,CAAA;IACzD,CAAC;CACF;AAvID,kCAuIC"}
|
|
@@ -2,179 +2,42 @@ import PostgrestTransformBuilder from './PostgrestTransformBuilder';
|
|
|
2
2
|
import { GenericSchema } from './types';
|
|
3
3
|
declare type FilterOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'like' | 'ilike' | 'is' | 'in' | 'cs' | 'cd' | 'sl' | 'sr' | 'nxl' | 'nxr' | 'adj' | 'ov' | 'fts' | 'plfts' | 'phfts' | 'wfts';
|
|
4
4
|
export default class PostgrestFilterBuilder<Schema extends GenericSchema, Row extends Record<string, unknown>, Result> extends PostgrestTransformBuilder<Schema, Row, Result> {
|
|
5
|
-
/**
|
|
6
|
-
* Match only rows where `column` is equal to `value`.
|
|
7
|
-
*
|
|
8
|
-
* To check if the value of `column` is NULL, you should use `.is()` instead.
|
|
9
|
-
*
|
|
10
|
-
* @param column - The column to filter on
|
|
11
|
-
* @param value - The value to filter with
|
|
12
|
-
*/
|
|
13
5
|
eq<ColumnName extends string & keyof Row>(column: ColumnName, value: Row[ColumnName]): this;
|
|
14
6
|
eq(column: string, value: unknown): this;
|
|
15
|
-
/**
|
|
16
|
-
* Match only rows where `column` is not equal to `value`.
|
|
17
|
-
*
|
|
18
|
-
* @param column - The column to filter on
|
|
19
|
-
* @param value - The value to filter with
|
|
20
|
-
*/
|
|
21
7
|
neq<ColumnName extends string & keyof Row>(column: ColumnName, value: Row[ColumnName]): this;
|
|
22
8
|
neq(column: string, value: unknown): this;
|
|
23
|
-
/**
|
|
24
|
-
* Match only rows where `column` is greater than `value`.
|
|
25
|
-
*
|
|
26
|
-
* @param column - The column to filter on
|
|
27
|
-
* @param value - The value to filter with
|
|
28
|
-
*/
|
|
29
9
|
gt<ColumnName extends string & keyof Row>(column: ColumnName, value: Row[ColumnName]): this;
|
|
30
10
|
gt(column: string, value: unknown): this;
|
|
31
|
-
/**
|
|
32
|
-
* Match only rows where `column` is greater than or equal to `value`.
|
|
33
|
-
*
|
|
34
|
-
* @param column - The column to filter on
|
|
35
|
-
* @param value - The value to filter with
|
|
36
|
-
*/
|
|
37
11
|
gte<ColumnName extends string & keyof Row>(column: ColumnName, value: Row[ColumnName]): this;
|
|
38
12
|
gte(column: string, value: unknown): this;
|
|
39
|
-
/**
|
|
40
|
-
* Match only rows where `column` is less than `value`.
|
|
41
|
-
*
|
|
42
|
-
* @param column - The column to filter on
|
|
43
|
-
* @param value - The value to filter with
|
|
44
|
-
*/
|
|
45
13
|
lt<ColumnName extends string & keyof Row>(column: ColumnName, value: Row[ColumnName]): this;
|
|
46
14
|
lt(column: string, value: unknown): this;
|
|
47
|
-
/**
|
|
48
|
-
* Match only rows where `column` is less than or equal to `value`.
|
|
49
|
-
*
|
|
50
|
-
* @param column - The column to filter on
|
|
51
|
-
* @param value - The value to filter with
|
|
52
|
-
*/
|
|
53
15
|
lte<ColumnName extends string & keyof Row>(column: ColumnName, value: Row[ColumnName]): this;
|
|
54
16
|
lte(column: string, value: unknown): this;
|
|
55
|
-
/**
|
|
56
|
-
* Match only rows where `column` matches `pattern` case-sensitively.
|
|
57
|
-
*
|
|
58
|
-
* @param column - The column to filter on
|
|
59
|
-
* @param pattern - The pattern to match with
|
|
60
|
-
*/
|
|
61
17
|
like<ColumnName extends string & keyof Row>(column: ColumnName, pattern: string): this;
|
|
62
18
|
like(column: string, pattern: string): this;
|
|
63
|
-
/**
|
|
64
|
-
* Match only rows where `column` matches `pattern` case-insensitively.
|
|
65
|
-
*
|
|
66
|
-
* @param column - The column to filter on
|
|
67
|
-
* @param pattern - The pattern to match with
|
|
68
|
-
*/
|
|
69
19
|
ilike<ColumnName extends string & keyof Row>(column: ColumnName, pattern: string): this;
|
|
70
20
|
ilike(column: string, pattern: string): this;
|
|
71
|
-
/**
|
|
72
|
-
* Match only rows where `column` IS `value`.
|
|
73
|
-
*
|
|
74
|
-
* For non-boolean columns, this is only relevant for checking if the value of
|
|
75
|
-
* `column` is NULL by setting `value` to `null`.
|
|
76
|
-
*
|
|
77
|
-
* For boolean columns, you can also set `value` to `true` or `false` and it
|
|
78
|
-
* will behave the same way as `.eq()`.
|
|
79
|
-
*
|
|
80
|
-
* @param column - The column to filter on
|
|
81
|
-
* @param value - The value to filter with
|
|
82
|
-
*/
|
|
83
21
|
is<ColumnName extends string & keyof Row>(column: ColumnName, value: Row[ColumnName] & (boolean | null)): this;
|
|
84
22
|
is(column: string, value: boolean | null): this;
|
|
85
|
-
/**
|
|
86
|
-
* Match only rows where `column` is included in the `values` array.
|
|
87
|
-
*
|
|
88
|
-
* @param column - The column to filter on
|
|
89
|
-
* @param values - The values array to filter with
|
|
90
|
-
*/
|
|
91
23
|
in<ColumnName extends string & keyof Row>(column: ColumnName, values: Row[ColumnName][]): this;
|
|
92
24
|
in(column: string, values: unknown[]): this;
|
|
93
|
-
/**
|
|
94
|
-
* Only relevant for jsonb, array, and range columns. Match only rows where
|
|
95
|
-
* `column` contains every element appearing in `value`.
|
|
96
|
-
*
|
|
97
|
-
* @param column - The jsonb, array, or range column to filter on
|
|
98
|
-
* @param value - The jsonb, array, or range value to filter with
|
|
99
|
-
*/
|
|
100
25
|
contains<ColumnName extends string & keyof Row>(column: ColumnName, value: string | Row[ColumnName][] | Record<string, unknown>): this;
|
|
101
26
|
contains(column: string, value: string | unknown[] | Record<string, unknown>): this;
|
|
102
|
-
/**
|
|
103
|
-
* Only relevant for jsonb, array, and range columns. Match only rows where
|
|
104
|
-
* every element appearing in `column` is contained by `value`.
|
|
105
|
-
*
|
|
106
|
-
* @param column - The jsonb, array, or range column to filter on
|
|
107
|
-
* @param value - The jsonb, array, or range value to filter with
|
|
108
|
-
*/
|
|
109
27
|
containedBy<ColumnName extends string & keyof Row>(column: ColumnName, value: string | Row[ColumnName][] | Record<string, unknown>): this;
|
|
110
28
|
containedBy(column: string, value: string | unknown[] | Record<string, unknown>): this;
|
|
111
|
-
/**
|
|
112
|
-
* Only relevant for range columns. Match only rows where every element in
|
|
113
|
-
* `column` is greater than any element in `range`.
|
|
114
|
-
*
|
|
115
|
-
* @param column - The range column to filter on
|
|
116
|
-
* @param range - The range to filter with
|
|
117
|
-
*/
|
|
118
29
|
rangeGt<ColumnName extends string & keyof Row>(column: ColumnName, range: string): this;
|
|
119
30
|
rangeGt(column: string, range: string): this;
|
|
120
|
-
/**
|
|
121
|
-
* Only relevant for range columns. Match only rows where every element in
|
|
122
|
-
* `column` is either contained in `range` or greater than any element in
|
|
123
|
-
* `range`.
|
|
124
|
-
*
|
|
125
|
-
* @param column - The range column to filter on
|
|
126
|
-
* @param range - The range to filter with
|
|
127
|
-
*/
|
|
128
31
|
rangeGte<ColumnName extends string & keyof Row>(column: ColumnName, range: string): this;
|
|
129
32
|
rangeGte(column: string, range: string): this;
|
|
130
|
-
/**
|
|
131
|
-
* Only relevant for range columns. Match only rows where every element in
|
|
132
|
-
* `column` is less than any element in `range`.
|
|
133
|
-
*
|
|
134
|
-
* @param column - The range column to filter on
|
|
135
|
-
* @param range - The range to filter with
|
|
136
|
-
*/
|
|
137
33
|
rangeLt<ColumnName extends string & keyof Row>(column: ColumnName, range: string): this;
|
|
138
34
|
rangeLt(column: string, range: string): this;
|
|
139
|
-
/**
|
|
140
|
-
* Only relevant for range columns. Match only rows where every element in
|
|
141
|
-
* `column` is either contained in `range` or less than any element in
|
|
142
|
-
* `range`.
|
|
143
|
-
*
|
|
144
|
-
* @param column - The range column to filter on
|
|
145
|
-
* @param range - The range to filter with
|
|
146
|
-
*/
|
|
147
35
|
rangeLte<ColumnName extends string & keyof Row>(column: ColumnName, range: string): this;
|
|
148
36
|
rangeLte(column: string, range: string): this;
|
|
149
|
-
/**
|
|
150
|
-
* Only relevant for range columns. Match only rows where `column` is
|
|
151
|
-
* mutually exclusive to `range` and there can be no element between the two
|
|
152
|
-
* ranges.
|
|
153
|
-
*
|
|
154
|
-
* @param column - The range column to filter on
|
|
155
|
-
* @param range - The range to filter with
|
|
156
|
-
*/
|
|
157
37
|
rangeAdjacent<ColumnName extends string & keyof Row>(column: ColumnName, range: string): this;
|
|
158
38
|
rangeAdjacent(column: string, range: string): this;
|
|
159
|
-
/**
|
|
160
|
-
* Only relevant for array and range columns. Match only rows where
|
|
161
|
-
* `column` and `value` have an element in common.
|
|
162
|
-
*
|
|
163
|
-
* @param column - The array or range column to filter on
|
|
164
|
-
* @param value - The array or range value to filter with
|
|
165
|
-
*/
|
|
166
39
|
overlaps<ColumnName extends string & keyof Row>(column: ColumnName, value: string | Row[ColumnName][]): this;
|
|
167
40
|
overlaps(column: string, value: string | unknown[]): this;
|
|
168
|
-
/**
|
|
169
|
-
* Only relevant for text and tsvector columns. Match only rows where
|
|
170
|
-
* `column` matches the query string in `query`.
|
|
171
|
-
*
|
|
172
|
-
* @param column - The text or tsvector column to filter on
|
|
173
|
-
* @param query - The query text to match with
|
|
174
|
-
* @param options - Named parameters
|
|
175
|
-
* @param options.config - The text search configuration to use
|
|
176
|
-
* @param options.type - Change how the `query` text is interpreted
|
|
177
|
-
*/
|
|
178
41
|
textSearch<ColumnName extends string & keyof Row>(column: ColumnName, query: string, options?: {
|
|
179
42
|
config?: string;
|
|
180
43
|
type?: 'plain' | 'phrase' | 'websearch';
|
|
@@ -183,28 +46,8 @@ export default class PostgrestFilterBuilder<Schema extends GenericSchema, Row ex
|
|
|
183
46
|
config?: string;
|
|
184
47
|
type?: 'plain' | 'phrase' | 'websearch';
|
|
185
48
|
}): this;
|
|
186
|
-
/**
|
|
187
|
-
* Match only rows where each column in `query` keys is equal to its
|
|
188
|
-
* associated value. Shorthand for multiple `.eq()`s.
|
|
189
|
-
*
|
|
190
|
-
* @param query - The object to filter with, with column names as keys mapped
|
|
191
|
-
* to their filter values
|
|
192
|
-
*/
|
|
193
49
|
match<ColumnName extends string & keyof Row>(query: Record<ColumnName, Row[ColumnName]>): this;
|
|
194
50
|
match(query: Record<string, unknown>): this;
|
|
195
|
-
/**
|
|
196
|
-
* Match only rows which doesn't satisfy the filter.
|
|
197
|
-
*
|
|
198
|
-
* Unlike most filters, `opearator` and `value` are used as-is and need to
|
|
199
|
-
* follow [PostgREST
|
|
200
|
-
* syntax](https://postgrest.org/en/stable/api.html#operators). You also need
|
|
201
|
-
* to make sure they are properly sanitized.
|
|
202
|
-
*
|
|
203
|
-
* @param column - The column to filter on
|
|
204
|
-
* @param operator - The operator to be negated to filter with, following
|
|
205
|
-
* PostgREST syntax
|
|
206
|
-
* @param value - The value to filter with, following PostgREST syntax
|
|
207
|
-
*/
|
|
208
51
|
not<ColumnName extends string & keyof Row>(column: ColumnName, operator: FilterOperator, value: Row[ColumnName]): this;
|
|
209
52
|
not(column: string, operator: string, value: unknown): this;
|
|
210
53
|
/**
|
|
@@ -223,19 +66,6 @@ export default class PostgrestFilterBuilder<Schema extends GenericSchema, Row ex
|
|
|
223
66
|
or(filters: string, { foreignTable }?: {
|
|
224
67
|
foreignTable?: string;
|
|
225
68
|
}): this;
|
|
226
|
-
/**
|
|
227
|
-
* Match only rows which satisfy the filter. This is an escape hatch - you
|
|
228
|
-
* should use the specific filter methods wherever possible.
|
|
229
|
-
*
|
|
230
|
-
* Unlike most filters, `opearator` and `value` are used as-is and need to
|
|
231
|
-
* follow [PostgREST
|
|
232
|
-
* syntax](https://postgrest.org/en/stable/api.html#operators). You also need
|
|
233
|
-
* to make sure they are properly sanitized.
|
|
234
|
-
*
|
|
235
|
-
* @param column - The column to filter on
|
|
236
|
-
* @param operator - The operator to filter with, following PostgREST syntax
|
|
237
|
-
* @param value - The value to filter with, following PostgREST syntax
|
|
238
|
-
*/
|
|
239
69
|
filter<ColumnName extends string & keyof Row>(column: ColumnName, operator: `${'' | 'not.'}${FilterOperator}`, value: unknown): this;
|
|
240
70
|
filter(column: string, operator: string, value: unknown): this;
|
|
241
71
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PostgrestFilterBuilder.d.ts","sourceRoot":"","sources":["../../src/PostgrestFilterBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,MAAM,6BAA6B,CAAA;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEvC,aAAK,cAAc,GACf,IAAI,GACJ,KAAK,GACL,IAAI,GACJ,KAAK,GACL,IAAI,GACJ,KAAK,GACL,MAAM,GACN,OAAO,GACP,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,KAAK,GACL,KAAK,GACL,IAAI,GACJ,KAAK,GACL,OAAO,GACP,OAAO,GACP,MAAM,CAAA;AAEV,MAAM,CAAC,OAAO,OAAO,sBAAsB,CACzC,MAAM,SAAS,aAAa,EAC5B,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnC,MAAM,CACN,SAAQ,yBAAyB,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC;IACtD
|
|
1
|
+
{"version":3,"file":"PostgrestFilterBuilder.d.ts","sourceRoot":"","sources":["../../src/PostgrestFilterBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,MAAM,6BAA6B,CAAA;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEvC,aAAK,cAAc,GACf,IAAI,GACJ,KAAK,GACL,IAAI,GACJ,KAAK,GACL,IAAI,GACJ,KAAK,GACL,MAAM,GACN,OAAO,GACP,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,KAAK,GACL,KAAK,GACL,IAAI,GACJ,KAAK,GACL,OAAO,GACP,OAAO,GACP,MAAM,CAAA;AAEV,MAAM,CAAC,OAAO,OAAO,sBAAsB,CACzC,MAAM,SAAS,aAAa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AQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAmB3D;;;;;;;;;;;;OAYG;IACH,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,YAAY,EAAE,GAAE;QAAE,YAAY,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,IAAI;IAM3E,MAAM,CAAC,UAAU,SAAS,MAAM,GAAG,MAAM,GAAG,EAC1C,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,GAAG,EAAE,GAAG,MAAM,GAAG,cAAc,EAAE,EAC3C,KAAK,EAAE,OAAO,GACb,IAAI;IACP,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;CAkB/D"}
|
|
@@ -5,42 +5,110 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const PostgrestTransformBuilder_1 = __importDefault(require("./PostgrestTransformBuilder"));
|
|
7
7
|
class PostgrestFilterBuilder extends PostgrestTransformBuilder_1.default {
|
|
8
|
+
/**
|
|
9
|
+
* Match only rows where `column` is equal to `value`.
|
|
10
|
+
*
|
|
11
|
+
* To check if the value of `column` is NULL, you should use `.is()` instead.
|
|
12
|
+
*
|
|
13
|
+
* @param column - The column to filter on
|
|
14
|
+
* @param value - The value to filter with
|
|
15
|
+
*/
|
|
8
16
|
eq(column, value) {
|
|
9
17
|
this.url.searchParams.append(column, `eq.${value}`);
|
|
10
18
|
return this;
|
|
11
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Match only rows where `column` is not equal to `value`.
|
|
22
|
+
*
|
|
23
|
+
* @param column - The column to filter on
|
|
24
|
+
* @param value - The value to filter with
|
|
25
|
+
*/
|
|
12
26
|
neq(column, value) {
|
|
13
27
|
this.url.searchParams.append(column, `neq.${value}`);
|
|
14
28
|
return this;
|
|
15
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Match only rows where `column` is greater than `value`.
|
|
32
|
+
*
|
|
33
|
+
* @param column - The column to filter on
|
|
34
|
+
* @param value - The value to filter with
|
|
35
|
+
*/
|
|
16
36
|
gt(column, value) {
|
|
17
37
|
this.url.searchParams.append(column, `gt.${value}`);
|
|
18
38
|
return this;
|
|
19
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Match only rows where `column` is greater than or equal to `value`.
|
|
42
|
+
*
|
|
43
|
+
* @param column - The column to filter on
|
|
44
|
+
* @param value - The value to filter with
|
|
45
|
+
*/
|
|
20
46
|
gte(column, value) {
|
|
21
47
|
this.url.searchParams.append(column, `gte.${value}`);
|
|
22
48
|
return this;
|
|
23
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Match only rows where `column` is less than `value`.
|
|
52
|
+
*
|
|
53
|
+
* @param column - The column to filter on
|
|
54
|
+
* @param value - The value to filter with
|
|
55
|
+
*/
|
|
24
56
|
lt(column, value) {
|
|
25
57
|
this.url.searchParams.append(column, `lt.${value}`);
|
|
26
58
|
return this;
|
|
27
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Match only rows where `column` is less than or equal to `value`.
|
|
62
|
+
*
|
|
63
|
+
* @param column - The column to filter on
|
|
64
|
+
* @param value - The value to filter with
|
|
65
|
+
*/
|
|
28
66
|
lte(column, value) {
|
|
29
67
|
this.url.searchParams.append(column, `lte.${value}`);
|
|
30
68
|
return this;
|
|
31
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Match only rows where `column` matches `pattern` case-sensitively.
|
|
72
|
+
*
|
|
73
|
+
* @param column - The column to filter on
|
|
74
|
+
* @param pattern - The pattern to match with
|
|
75
|
+
*/
|
|
32
76
|
like(column, pattern) {
|
|
33
77
|
this.url.searchParams.append(column, `like.${pattern}`);
|
|
34
78
|
return this;
|
|
35
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Match only rows where `column` matches `pattern` case-insensitively.
|
|
82
|
+
*
|
|
83
|
+
* @param column - The column to filter on
|
|
84
|
+
* @param pattern - The pattern to match with
|
|
85
|
+
*/
|
|
36
86
|
ilike(column, pattern) {
|
|
37
87
|
this.url.searchParams.append(column, `ilike.${pattern}`);
|
|
38
88
|
return this;
|
|
39
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Match only rows where `column` IS `value`.
|
|
92
|
+
*
|
|
93
|
+
* For non-boolean columns, this is only relevant for checking if the value of
|
|
94
|
+
* `column` is NULL by setting `value` to `null`.
|
|
95
|
+
*
|
|
96
|
+
* For boolean columns, you can also set `value` to `true` or `false` and it
|
|
97
|
+
* will behave the same way as `.eq()`.
|
|
98
|
+
*
|
|
99
|
+
* @param column - The column to filter on
|
|
100
|
+
* @param value - The value to filter with
|
|
101
|
+
*/
|
|
40
102
|
is(column, value) {
|
|
41
103
|
this.url.searchParams.append(column, `is.${value}`);
|
|
42
104
|
return this;
|
|
43
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Match only rows where `column` is included in the `values` array.
|
|
108
|
+
*
|
|
109
|
+
* @param column - The column to filter on
|
|
110
|
+
* @param values - The values array to filter with
|
|
111
|
+
*/
|
|
44
112
|
in(column, values) {
|
|
45
113
|
const cleanedValues = values
|
|
46
114
|
.map((s) => {
|
|
@@ -55,6 +123,13 @@ class PostgrestFilterBuilder extends PostgrestTransformBuilder_1.default {
|
|
|
55
123
|
this.url.searchParams.append(column, `in.(${cleanedValues})`);
|
|
56
124
|
return this;
|
|
57
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Only relevant for jsonb, array, and range columns. Match only rows where
|
|
128
|
+
* `column` contains every element appearing in `value`.
|
|
129
|
+
*
|
|
130
|
+
* @param column - The jsonb, array, or range column to filter on
|
|
131
|
+
* @param value - The jsonb, array, or range value to filter with
|
|
132
|
+
*/
|
|
58
133
|
contains(column, value) {
|
|
59
134
|
if (typeof value === 'string') {
|
|
60
135
|
// range types can be inclusive '[', ']' or exclusive '(', ')' so just
|
|
@@ -71,6 +146,13 @@ class PostgrestFilterBuilder extends PostgrestTransformBuilder_1.default {
|
|
|
71
146
|
}
|
|
72
147
|
return this;
|
|
73
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* Only relevant for jsonb, array, and range columns. Match only rows where
|
|
151
|
+
* every element appearing in `column` is contained by `value`.
|
|
152
|
+
*
|
|
153
|
+
* @param column - The jsonb, array, or range column to filter on
|
|
154
|
+
* @param value - The jsonb, array, or range value to filter with
|
|
155
|
+
*/
|
|
74
156
|
containedBy(column, value) {
|
|
75
157
|
if (typeof value === 'string') {
|
|
76
158
|
// range
|
|
@@ -86,26 +168,71 @@ class PostgrestFilterBuilder extends PostgrestTransformBuilder_1.default {
|
|
|
86
168
|
}
|
|
87
169
|
return this;
|
|
88
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Only relevant for range columns. Match only rows where every element in
|
|
173
|
+
* `column` is greater than any element in `range`.
|
|
174
|
+
*
|
|
175
|
+
* @param column - The range column to filter on
|
|
176
|
+
* @param range - The range to filter with
|
|
177
|
+
*/
|
|
89
178
|
rangeGt(column, range) {
|
|
90
179
|
this.url.searchParams.append(column, `sr.${range}`);
|
|
91
180
|
return this;
|
|
92
181
|
}
|
|
182
|
+
/**
|
|
183
|
+
* Only relevant for range columns. Match only rows where every element in
|
|
184
|
+
* `column` is either contained in `range` or greater than any element in
|
|
185
|
+
* `range`.
|
|
186
|
+
*
|
|
187
|
+
* @param column - The range column to filter on
|
|
188
|
+
* @param range - The range to filter with
|
|
189
|
+
*/
|
|
93
190
|
rangeGte(column, range) {
|
|
94
191
|
this.url.searchParams.append(column, `nxl.${range}`);
|
|
95
192
|
return this;
|
|
96
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* Only relevant for range columns. Match only rows where every element in
|
|
196
|
+
* `column` is less than any element in `range`.
|
|
197
|
+
*
|
|
198
|
+
* @param column - The range column to filter on
|
|
199
|
+
* @param range - The range to filter with
|
|
200
|
+
*/
|
|
97
201
|
rangeLt(column, range) {
|
|
98
202
|
this.url.searchParams.append(column, `sl.${range}`);
|
|
99
203
|
return this;
|
|
100
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* Only relevant for range columns. Match only rows where every element in
|
|
207
|
+
* `column` is either contained in `range` or less than any element in
|
|
208
|
+
* `range`.
|
|
209
|
+
*
|
|
210
|
+
* @param column - The range column to filter on
|
|
211
|
+
* @param range - The range to filter with
|
|
212
|
+
*/
|
|
101
213
|
rangeLte(column, range) {
|
|
102
214
|
this.url.searchParams.append(column, `nxr.${range}`);
|
|
103
215
|
return this;
|
|
104
216
|
}
|
|
217
|
+
/**
|
|
218
|
+
* Only relevant for range columns. Match only rows where `column` is
|
|
219
|
+
* mutually exclusive to `range` and there can be no element between the two
|
|
220
|
+
* ranges.
|
|
221
|
+
*
|
|
222
|
+
* @param column - The range column to filter on
|
|
223
|
+
* @param range - The range to filter with
|
|
224
|
+
*/
|
|
105
225
|
rangeAdjacent(column, range) {
|
|
106
226
|
this.url.searchParams.append(column, `adj.${range}`);
|
|
107
227
|
return this;
|
|
108
228
|
}
|
|
229
|
+
/**
|
|
230
|
+
* Only relevant for array and range columns. Match only rows where
|
|
231
|
+
* `column` and `value` have an element in common.
|
|
232
|
+
*
|
|
233
|
+
* @param column - The array or range column to filter on
|
|
234
|
+
* @param value - The array or range value to filter with
|
|
235
|
+
*/
|
|
109
236
|
overlaps(column, value) {
|
|
110
237
|
if (typeof value === 'string') {
|
|
111
238
|
// range
|
|
@@ -117,6 +244,16 @@ class PostgrestFilterBuilder extends PostgrestTransformBuilder_1.default {
|
|
|
117
244
|
}
|
|
118
245
|
return this;
|
|
119
246
|
}
|
|
247
|
+
/**
|
|
248
|
+
* Only relevant for text and tsvector columns. Match only rows where
|
|
249
|
+
* `column` matches the query string in `query`.
|
|
250
|
+
*
|
|
251
|
+
* @param column - The text or tsvector column to filter on
|
|
252
|
+
* @param query - The query text to match with
|
|
253
|
+
* @param options - Named parameters
|
|
254
|
+
* @param options.config - The text search configuration to use
|
|
255
|
+
* @param options.type - Change how the `query` text is interpreted
|
|
256
|
+
*/
|
|
120
257
|
textSearch(column, query, { config, type } = {}) {
|
|
121
258
|
let typePart = '';
|
|
122
259
|
if (type === 'plain') {
|
|
@@ -132,12 +269,32 @@ class PostgrestFilterBuilder extends PostgrestTransformBuilder_1.default {
|
|
|
132
269
|
this.url.searchParams.append(column, `${typePart}fts${configPart}.${query}`);
|
|
133
270
|
return this;
|
|
134
271
|
}
|
|
272
|
+
/**
|
|
273
|
+
* Match only rows where each column in `query` keys is equal to its
|
|
274
|
+
* associated value. Shorthand for multiple `.eq()`s.
|
|
275
|
+
*
|
|
276
|
+
* @param query - The object to filter with, with column names as keys mapped
|
|
277
|
+
* to their filter values
|
|
278
|
+
*/
|
|
135
279
|
match(query) {
|
|
136
280
|
Object.entries(query).forEach(([column, value]) => {
|
|
137
281
|
this.url.searchParams.append(column, `eq.${value}`);
|
|
138
282
|
});
|
|
139
283
|
return this;
|
|
140
284
|
}
|
|
285
|
+
/**
|
|
286
|
+
* Match only rows which doesn't satisfy the filter.
|
|
287
|
+
*
|
|
288
|
+
* Unlike most filters, `opearator` and `value` are used as-is and need to
|
|
289
|
+
* follow [PostgREST
|
|
290
|
+
* syntax](https://postgrest.org/en/stable/api.html#operators). You also need
|
|
291
|
+
* to make sure they are properly sanitized.
|
|
292
|
+
*
|
|
293
|
+
* @param column - The column to filter on
|
|
294
|
+
* @param operator - The operator to be negated to filter with, following
|
|
295
|
+
* PostgREST syntax
|
|
296
|
+
* @param value - The value to filter with, following PostgREST syntax
|
|
297
|
+
*/
|
|
141
298
|
not(column, operator, value) {
|
|
142
299
|
this.url.searchParams.append(column, `not.${operator}.${value}`);
|
|
143
300
|
return this;
|
|
@@ -160,6 +317,19 @@ class PostgrestFilterBuilder extends PostgrestTransformBuilder_1.default {
|
|
|
160
317
|
this.url.searchParams.append(key, `(${filters})`);
|
|
161
318
|
return this;
|
|
162
319
|
}
|
|
320
|
+
/**
|
|
321
|
+
* Match only rows which satisfy the filter. This is an escape hatch - you
|
|
322
|
+
* should use the specific filter methods wherever possible.
|
|
323
|
+
*
|
|
324
|
+
* Unlike most filters, `opearator` and `value` are used as-is and need to
|
|
325
|
+
* follow [PostgREST
|
|
326
|
+
* syntax](https://postgrest.org/en/stable/api.html#operators). You also need
|
|
327
|
+
* to make sure they are properly sanitized.
|
|
328
|
+
*
|
|
329
|
+
* @param column - The column to filter on
|
|
330
|
+
* @param operator - The operator to filter with, following PostgREST syntax
|
|
331
|
+
* @param value - The value to filter with, following PostgREST syntax
|
|
332
|
+
*/
|
|
163
333
|
filter(column, operator, value) {
|
|
164
334
|
this.url.searchParams.append(column, `${operator}.${value}`);
|
|
165
335
|
return this;
|