@supabase/postgrest-js 2.87.4-canary.2 → 2.87.4-canary.4
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 +1237 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1421 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +1421 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +1229 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +18 -16
- package/src/version.ts +1 -1
- package/dist/cjs/PostgrestBuilder.d.ts +0 -85
- package/dist/cjs/PostgrestBuilder.d.ts.map +0 -1
- package/dist/cjs/PostgrestBuilder.js +0 -250
- package/dist/cjs/PostgrestBuilder.js.map +0 -1
- package/dist/cjs/PostgrestClient.d.ts +0 -93
- package/dist/cjs/PostgrestClient.d.ts.map +0 -1
- package/dist/cjs/PostgrestClient.js +0 -140
- package/dist/cjs/PostgrestClient.js.map +0 -1
- package/dist/cjs/PostgrestError.d.ts +0 -30
- package/dist/cjs/PostgrestError.d.ts.map +0 -1
- package/dist/cjs/PostgrestError.js +0 -31
- package/dist/cjs/PostgrestError.js.map +0 -1
- package/dist/cjs/PostgrestFilterBuilder.d.ts +0 -130
- package/dist/cjs/PostgrestFilterBuilder.d.ts.map +0 -1
- package/dist/cjs/PostgrestFilterBuilder.js +0 -436
- package/dist/cjs/PostgrestFilterBuilder.js.map +0 -1
- package/dist/cjs/PostgrestQueryBuilder.d.ts +0 -130
- package/dist/cjs/PostgrestQueryBuilder.d.ts.map +0 -1
- package/dist/cjs/PostgrestQueryBuilder.js +0 -310
- package/dist/cjs/PostgrestQueryBuilder.js.map +0 -1
- package/dist/cjs/PostgrestTransformBuilder.d.ts +0 -159
- package/dist/cjs/PostgrestTransformBuilder.d.ts.map +0 -1
- package/dist/cjs/PostgrestTransformBuilder.js +0 -224
- package/dist/cjs/PostgrestTransformBuilder.js.map +0 -1
- package/dist/cjs/constants.d.ts +0 -4
- package/dist/cjs/constants.d.ts.map +0 -1
- package/dist/cjs/constants.js +0 -6
- package/dist/cjs/constants.js.map +0 -1
- package/dist/cjs/index.d.ts +0 -20
- package/dist/cjs/index.d.ts.map +0 -1
- package/dist/cjs/index.js +0 -26
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/select-query-parser/parser.d.ts +0 -258
- package/dist/cjs/select-query-parser/parser.d.ts.map +0 -1
- package/dist/cjs/select-query-parser/parser.js +0 -5
- package/dist/cjs/select-query-parser/parser.js.map +0 -1
- package/dist/cjs/select-query-parser/result.d.ts +0 -160
- package/dist/cjs/select-query-parser/result.d.ts.map +0 -1
- package/dist/cjs/select-query-parser/result.js +0 -3
- package/dist/cjs/select-query-parser/result.js.map +0 -1
- package/dist/cjs/select-query-parser/types.d.ts +0 -32
- package/dist/cjs/select-query-parser/types.d.ts.map +0 -1
- package/dist/cjs/select-query-parser/types.js +0 -3
- package/dist/cjs/select-query-parser/types.js.map +0 -1
- package/dist/cjs/select-query-parser/utils.d.ts +0 -283
- package/dist/cjs/select-query-parser/utils.d.ts.map +0 -1
- package/dist/cjs/select-query-parser/utils.js +0 -3
- package/dist/cjs/select-query-parser/utils.js.map +0 -1
- package/dist/cjs/types/common/common.d.ts +0 -46
- package/dist/cjs/types/common/common.d.ts.map +0 -1
- package/dist/cjs/types/common/common.js +0 -4
- package/dist/cjs/types/common/common.js.map +0 -1
- package/dist/cjs/types/common/rpc.d.ts +0 -40
- package/dist/cjs/types/common/rpc.d.ts.map +0 -1
- package/dist/cjs/types/common/rpc.js +0 -3
- package/dist/cjs/types/common/rpc.js.map +0 -1
- package/dist/cjs/types/feature-flags.d.ts +0 -7
- package/dist/cjs/types/feature-flags.d.ts.map +0 -1
- package/dist/cjs/types/feature-flags.js +0 -3
- package/dist/cjs/types/feature-flags.js.map +0 -1
- package/dist/cjs/types/types.d.ts +0 -69
- package/dist/cjs/types/types.d.ts.map +0 -1
- package/dist/cjs/types/types.js +0 -3
- package/dist/cjs/types/types.js.map +0 -1
- package/dist/cjs/version.d.ts +0 -2
- package/dist/cjs/version.d.ts.map +0 -1
- package/dist/cjs/version.js +0 -11
- package/dist/cjs/version.js.map +0 -1
- package/dist/esm/wrapper.mjs +0 -28
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,436 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const PostgrestTransformBuilder_1 = tslib_1.__importDefault(require("./PostgrestTransformBuilder"));
|
|
5
|
-
const PostgrestReservedCharsRegexp = new RegExp('[,()]');
|
|
6
|
-
class PostgrestFilterBuilder extends PostgrestTransformBuilder_1.default {
|
|
7
|
-
/**
|
|
8
|
-
* Match only rows where `column` is equal to `value`.
|
|
9
|
-
*
|
|
10
|
-
* To check if the value of `column` is NULL, you should use `.is()` instead.
|
|
11
|
-
*
|
|
12
|
-
* @param column - The column to filter on
|
|
13
|
-
* @param value - The value to filter with
|
|
14
|
-
*/
|
|
15
|
-
eq(column, value) {
|
|
16
|
-
this.url.searchParams.append(column, `eq.${value}`);
|
|
17
|
-
return this;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Match only rows where `column` is not equal to `value`.
|
|
21
|
-
*
|
|
22
|
-
* @param column - The column to filter on
|
|
23
|
-
* @param value - The value to filter with
|
|
24
|
-
*/
|
|
25
|
-
neq(column, value) {
|
|
26
|
-
this.url.searchParams.append(column, `neq.${value}`);
|
|
27
|
-
return this;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Match only rows where `column` is greater than `value`.
|
|
31
|
-
*
|
|
32
|
-
* @param column - The column to filter on
|
|
33
|
-
* @param value - The value to filter with
|
|
34
|
-
*/
|
|
35
|
-
gt(column, value) {
|
|
36
|
-
this.url.searchParams.append(column, `gt.${value}`);
|
|
37
|
-
return this;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Match only rows where `column` is greater than or equal to `value`.
|
|
41
|
-
*
|
|
42
|
-
* @param column - The column to filter on
|
|
43
|
-
* @param value - The value to filter with
|
|
44
|
-
*/
|
|
45
|
-
gte(column, value) {
|
|
46
|
-
this.url.searchParams.append(column, `gte.${value}`);
|
|
47
|
-
return this;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Match only rows where `column` is less than `value`.
|
|
51
|
-
*
|
|
52
|
-
* @param column - The column to filter on
|
|
53
|
-
* @param value - The value to filter with
|
|
54
|
-
*/
|
|
55
|
-
lt(column, value) {
|
|
56
|
-
this.url.searchParams.append(column, `lt.${value}`);
|
|
57
|
-
return this;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Match only rows where `column` is less than or equal to `value`.
|
|
61
|
-
*
|
|
62
|
-
* @param column - The column to filter on
|
|
63
|
-
* @param value - The value to filter with
|
|
64
|
-
*/
|
|
65
|
-
lte(column, value) {
|
|
66
|
-
this.url.searchParams.append(column, `lte.${value}`);
|
|
67
|
-
return this;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Match only rows where `column` matches `pattern` case-sensitively.
|
|
71
|
-
*
|
|
72
|
-
* @param column - The column to filter on
|
|
73
|
-
* @param pattern - The pattern to match with
|
|
74
|
-
*/
|
|
75
|
-
like(column, pattern) {
|
|
76
|
-
this.url.searchParams.append(column, `like.${pattern}`);
|
|
77
|
-
return this;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Match only rows where `column` matches all of `patterns` case-sensitively.
|
|
81
|
-
*
|
|
82
|
-
* @param column - The column to filter on
|
|
83
|
-
* @param patterns - The patterns to match with
|
|
84
|
-
*/
|
|
85
|
-
likeAllOf(column, patterns) {
|
|
86
|
-
this.url.searchParams.append(column, `like(all).{${patterns.join(',')}}`);
|
|
87
|
-
return this;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Match only rows where `column` matches any of `patterns` case-sensitively.
|
|
91
|
-
*
|
|
92
|
-
* @param column - The column to filter on
|
|
93
|
-
* @param patterns - The patterns to match with
|
|
94
|
-
*/
|
|
95
|
-
likeAnyOf(column, patterns) {
|
|
96
|
-
this.url.searchParams.append(column, `like(any).{${patterns.join(',')}}`);
|
|
97
|
-
return this;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Match only rows where `column` matches `pattern` case-insensitively.
|
|
101
|
-
*
|
|
102
|
-
* @param column - The column to filter on
|
|
103
|
-
* @param pattern - The pattern to match with
|
|
104
|
-
*/
|
|
105
|
-
ilike(column, pattern) {
|
|
106
|
-
this.url.searchParams.append(column, `ilike.${pattern}`);
|
|
107
|
-
return this;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Match only rows where `column` matches all of `patterns` case-insensitively.
|
|
111
|
-
*
|
|
112
|
-
* @param column - The column to filter on
|
|
113
|
-
* @param patterns - The patterns to match with
|
|
114
|
-
*/
|
|
115
|
-
ilikeAllOf(column, patterns) {
|
|
116
|
-
this.url.searchParams.append(column, `ilike(all).{${patterns.join(',')}}`);
|
|
117
|
-
return this;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Match only rows where `column` matches any of `patterns` case-insensitively.
|
|
121
|
-
*
|
|
122
|
-
* @param column - The column to filter on
|
|
123
|
-
* @param patterns - The patterns to match with
|
|
124
|
-
*/
|
|
125
|
-
ilikeAnyOf(column, patterns) {
|
|
126
|
-
this.url.searchParams.append(column, `ilike(any).{${patterns.join(',')}}`);
|
|
127
|
-
return this;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Match only rows where `column` matches the PostgreSQL regex `pattern`
|
|
131
|
-
* case-sensitively (using the `~` operator).
|
|
132
|
-
*
|
|
133
|
-
* @param column - The column to filter on
|
|
134
|
-
* @param pattern - The PostgreSQL regular expression pattern to match with
|
|
135
|
-
*/
|
|
136
|
-
regexMatch(column, pattern) {
|
|
137
|
-
this.url.searchParams.append(column, `match.${pattern}`);
|
|
138
|
-
return this;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Match only rows where `column` matches the PostgreSQL regex `pattern`
|
|
142
|
-
* case-insensitively (using the `~*` operator).
|
|
143
|
-
*
|
|
144
|
-
* @param column - The column to filter on
|
|
145
|
-
* @param pattern - The PostgreSQL regular expression pattern to match with
|
|
146
|
-
*/
|
|
147
|
-
regexIMatch(column, pattern) {
|
|
148
|
-
this.url.searchParams.append(column, `imatch.${pattern}`);
|
|
149
|
-
return this;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Match only rows where `column` IS `value`.
|
|
153
|
-
*
|
|
154
|
-
* For non-boolean columns, this is only relevant for checking if the value of
|
|
155
|
-
* `column` is NULL by setting `value` to `null`.
|
|
156
|
-
*
|
|
157
|
-
* For boolean columns, you can also set `value` to `true` or `false` and it
|
|
158
|
-
* will behave the same way as `.eq()`.
|
|
159
|
-
*
|
|
160
|
-
* @param column - The column to filter on
|
|
161
|
-
* @param value - The value to filter with
|
|
162
|
-
*/
|
|
163
|
-
is(column, value) {
|
|
164
|
-
this.url.searchParams.append(column, `is.${value}`);
|
|
165
|
-
return this;
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Match only rows where `column` IS DISTINCT FROM `value`.
|
|
169
|
-
*
|
|
170
|
-
* Unlike `.neq()`, this treats `NULL` as a comparable value. Two `NULL` values
|
|
171
|
-
* are considered equal (not distinct), and comparing `NULL` with any non-NULL
|
|
172
|
-
* value returns true (distinct).
|
|
173
|
-
*
|
|
174
|
-
* @param column - The column to filter on
|
|
175
|
-
* @param value - The value to filter with
|
|
176
|
-
*/
|
|
177
|
-
isDistinct(column, value) {
|
|
178
|
-
this.url.searchParams.append(column, `isdistinct.${value}`);
|
|
179
|
-
return this;
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Match only rows where `column` is included in the `values` array.
|
|
183
|
-
*
|
|
184
|
-
* @param column - The column to filter on
|
|
185
|
-
* @param values - The values array to filter with
|
|
186
|
-
*/
|
|
187
|
-
in(column, values) {
|
|
188
|
-
const cleanedValues = Array.from(new Set(values))
|
|
189
|
-
.map((s) => {
|
|
190
|
-
// handle postgrest reserved characters
|
|
191
|
-
// https://postgrest.org/en/v7.0.0/api.html#reserved-characters
|
|
192
|
-
if (typeof s === 'string' && PostgrestReservedCharsRegexp.test(s))
|
|
193
|
-
return `"${s}"`;
|
|
194
|
-
else
|
|
195
|
-
return `${s}`;
|
|
196
|
-
})
|
|
197
|
-
.join(',');
|
|
198
|
-
this.url.searchParams.append(column, `in.(${cleanedValues})`);
|
|
199
|
-
return this;
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Match only rows where `column` is NOT included in the `values` array.
|
|
203
|
-
*
|
|
204
|
-
* @param column - The column to filter on
|
|
205
|
-
* @param values - The values array to filter with
|
|
206
|
-
*/
|
|
207
|
-
notIn(column, values) {
|
|
208
|
-
const cleanedValues = Array.from(new Set(values))
|
|
209
|
-
.map((s) => {
|
|
210
|
-
// handle postgrest reserved characters
|
|
211
|
-
// https://postgrest.org/en/v7.0.0/api.html#reserved-characters
|
|
212
|
-
if (typeof s === 'string' && PostgrestReservedCharsRegexp.test(s))
|
|
213
|
-
return `"${s}"`;
|
|
214
|
-
else
|
|
215
|
-
return `${s}`;
|
|
216
|
-
})
|
|
217
|
-
.join(',');
|
|
218
|
-
this.url.searchParams.append(column, `not.in.(${cleanedValues})`);
|
|
219
|
-
return this;
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* Only relevant for jsonb, array, and range columns. Match only rows where
|
|
223
|
-
* `column` contains every element appearing in `value`.
|
|
224
|
-
*
|
|
225
|
-
* @param column - The jsonb, array, or range column to filter on
|
|
226
|
-
* @param value - The jsonb, array, or range value to filter with
|
|
227
|
-
*/
|
|
228
|
-
contains(column, value) {
|
|
229
|
-
if (typeof value === 'string') {
|
|
230
|
-
// range types can be inclusive '[', ']' or exclusive '(', ')' so just
|
|
231
|
-
// keep it simple and accept a string
|
|
232
|
-
this.url.searchParams.append(column, `cs.${value}`);
|
|
233
|
-
}
|
|
234
|
-
else if (Array.isArray(value)) {
|
|
235
|
-
// array
|
|
236
|
-
this.url.searchParams.append(column, `cs.{${value.join(',')}}`);
|
|
237
|
-
}
|
|
238
|
-
else {
|
|
239
|
-
// json
|
|
240
|
-
this.url.searchParams.append(column, `cs.${JSON.stringify(value)}`);
|
|
241
|
-
}
|
|
242
|
-
return this;
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* Only relevant for jsonb, array, and range columns. Match only rows where
|
|
246
|
-
* every element appearing in `column` is contained by `value`.
|
|
247
|
-
*
|
|
248
|
-
* @param column - The jsonb, array, or range column to filter on
|
|
249
|
-
* @param value - The jsonb, array, or range value to filter with
|
|
250
|
-
*/
|
|
251
|
-
containedBy(column, value) {
|
|
252
|
-
if (typeof value === 'string') {
|
|
253
|
-
// range
|
|
254
|
-
this.url.searchParams.append(column, `cd.${value}`);
|
|
255
|
-
}
|
|
256
|
-
else if (Array.isArray(value)) {
|
|
257
|
-
// array
|
|
258
|
-
this.url.searchParams.append(column, `cd.{${value.join(',')}}`);
|
|
259
|
-
}
|
|
260
|
-
else {
|
|
261
|
-
// json
|
|
262
|
-
this.url.searchParams.append(column, `cd.${JSON.stringify(value)}`);
|
|
263
|
-
}
|
|
264
|
-
return this;
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Only relevant for range columns. Match only rows where every element in
|
|
268
|
-
* `column` is greater than any element in `range`.
|
|
269
|
-
*
|
|
270
|
-
* @param column - The range column to filter on
|
|
271
|
-
* @param range - The range to filter with
|
|
272
|
-
*/
|
|
273
|
-
rangeGt(column, range) {
|
|
274
|
-
this.url.searchParams.append(column, `sr.${range}`);
|
|
275
|
-
return this;
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* Only relevant for range columns. Match only rows where every element in
|
|
279
|
-
* `column` is either contained in `range` or greater than any element in
|
|
280
|
-
* `range`.
|
|
281
|
-
*
|
|
282
|
-
* @param column - The range column to filter on
|
|
283
|
-
* @param range - The range to filter with
|
|
284
|
-
*/
|
|
285
|
-
rangeGte(column, range) {
|
|
286
|
-
this.url.searchParams.append(column, `nxl.${range}`);
|
|
287
|
-
return this;
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Only relevant for range columns. Match only rows where every element in
|
|
291
|
-
* `column` is less than any element in `range`.
|
|
292
|
-
*
|
|
293
|
-
* @param column - The range column to filter on
|
|
294
|
-
* @param range - The range to filter with
|
|
295
|
-
*/
|
|
296
|
-
rangeLt(column, range) {
|
|
297
|
-
this.url.searchParams.append(column, `sl.${range}`);
|
|
298
|
-
return this;
|
|
299
|
-
}
|
|
300
|
-
/**
|
|
301
|
-
* Only relevant for range columns. Match only rows where every element in
|
|
302
|
-
* `column` is either contained in `range` or less than any element in
|
|
303
|
-
* `range`.
|
|
304
|
-
*
|
|
305
|
-
* @param column - The range column to filter on
|
|
306
|
-
* @param range - The range to filter with
|
|
307
|
-
*/
|
|
308
|
-
rangeLte(column, range) {
|
|
309
|
-
this.url.searchParams.append(column, `nxr.${range}`);
|
|
310
|
-
return this;
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* Only relevant for range columns. Match only rows where `column` is
|
|
314
|
-
* mutually exclusive to `range` and there can be no element between the two
|
|
315
|
-
* ranges.
|
|
316
|
-
*
|
|
317
|
-
* @param column - The range column to filter on
|
|
318
|
-
* @param range - The range to filter with
|
|
319
|
-
*/
|
|
320
|
-
rangeAdjacent(column, range) {
|
|
321
|
-
this.url.searchParams.append(column, `adj.${range}`);
|
|
322
|
-
return this;
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* Only relevant for array and range columns. Match only rows where
|
|
326
|
-
* `column` and `value` have an element in common.
|
|
327
|
-
*
|
|
328
|
-
* @param column - The array or range column to filter on
|
|
329
|
-
* @param value - The array or range value to filter with
|
|
330
|
-
*/
|
|
331
|
-
overlaps(column, value) {
|
|
332
|
-
if (typeof value === 'string') {
|
|
333
|
-
// range
|
|
334
|
-
this.url.searchParams.append(column, `ov.${value}`);
|
|
335
|
-
}
|
|
336
|
-
else {
|
|
337
|
-
// array
|
|
338
|
-
this.url.searchParams.append(column, `ov.{${value.join(',')}}`);
|
|
339
|
-
}
|
|
340
|
-
return this;
|
|
341
|
-
}
|
|
342
|
-
/**
|
|
343
|
-
* Only relevant for text and tsvector columns. Match only rows where
|
|
344
|
-
* `column` matches the query string in `query`.
|
|
345
|
-
*
|
|
346
|
-
* @param column - The text or tsvector column to filter on
|
|
347
|
-
* @param query - The query text to match with
|
|
348
|
-
* @param options - Named parameters
|
|
349
|
-
* @param options.config - The text search configuration to use
|
|
350
|
-
* @param options.type - Change how the `query` text is interpreted
|
|
351
|
-
*/
|
|
352
|
-
textSearch(column, query, { config, type } = {}) {
|
|
353
|
-
let typePart = '';
|
|
354
|
-
if (type === 'plain') {
|
|
355
|
-
typePart = 'pl';
|
|
356
|
-
}
|
|
357
|
-
else if (type === 'phrase') {
|
|
358
|
-
typePart = 'ph';
|
|
359
|
-
}
|
|
360
|
-
else if (type === 'websearch') {
|
|
361
|
-
typePart = 'w';
|
|
362
|
-
}
|
|
363
|
-
const configPart = config === undefined ? '' : `(${config})`;
|
|
364
|
-
this.url.searchParams.append(column, `${typePart}fts${configPart}.${query}`);
|
|
365
|
-
return this;
|
|
366
|
-
}
|
|
367
|
-
/**
|
|
368
|
-
* Match only rows where each column in `query` keys is equal to its
|
|
369
|
-
* associated value. Shorthand for multiple `.eq()`s.
|
|
370
|
-
*
|
|
371
|
-
* @param query - The object to filter with, with column names as keys mapped
|
|
372
|
-
* to their filter values
|
|
373
|
-
*/
|
|
374
|
-
match(query) {
|
|
375
|
-
Object.entries(query).forEach(([column, value]) => {
|
|
376
|
-
this.url.searchParams.append(column, `eq.${value}`);
|
|
377
|
-
});
|
|
378
|
-
return this;
|
|
379
|
-
}
|
|
380
|
-
/**
|
|
381
|
-
* Match only rows which doesn't satisfy the filter.
|
|
382
|
-
*
|
|
383
|
-
* Unlike most filters, `opearator` and `value` are used as-is and need to
|
|
384
|
-
* follow [PostgREST
|
|
385
|
-
* syntax](https://postgrest.org/en/stable/api.html#operators). You also need
|
|
386
|
-
* to make sure they are properly sanitized.
|
|
387
|
-
*
|
|
388
|
-
* @param column - The column to filter on
|
|
389
|
-
* @param operator - The operator to be negated to filter with, following
|
|
390
|
-
* PostgREST syntax
|
|
391
|
-
* @param value - The value to filter with, following PostgREST syntax
|
|
392
|
-
*/
|
|
393
|
-
not(column, operator, value) {
|
|
394
|
-
this.url.searchParams.append(column, `not.${operator}.${value}`);
|
|
395
|
-
return this;
|
|
396
|
-
}
|
|
397
|
-
/**
|
|
398
|
-
* Match only rows which satisfy at least one of the filters.
|
|
399
|
-
*
|
|
400
|
-
* Unlike most filters, `filters` is used as-is and needs to follow [PostgREST
|
|
401
|
-
* syntax](https://postgrest.org/en/stable/api.html#operators). You also need
|
|
402
|
-
* to make sure it's properly sanitized.
|
|
403
|
-
*
|
|
404
|
-
* It's currently not possible to do an `.or()` filter across multiple tables.
|
|
405
|
-
*
|
|
406
|
-
* @param filters - The filters to use, following PostgREST syntax
|
|
407
|
-
* @param options - Named parameters
|
|
408
|
-
* @param options.referencedTable - Set this to filter on referenced tables
|
|
409
|
-
* instead of the parent table
|
|
410
|
-
* @param options.foreignTable - Deprecated, use `referencedTable` instead
|
|
411
|
-
*/
|
|
412
|
-
or(filters, { foreignTable, referencedTable = foreignTable, } = {}) {
|
|
413
|
-
const key = referencedTable ? `${referencedTable}.or` : 'or';
|
|
414
|
-
this.url.searchParams.append(key, `(${filters})`);
|
|
415
|
-
return this;
|
|
416
|
-
}
|
|
417
|
-
/**
|
|
418
|
-
* Match only rows which satisfy the filter. This is an escape hatch - you
|
|
419
|
-
* should use the specific filter methods wherever possible.
|
|
420
|
-
*
|
|
421
|
-
* Unlike most filters, `opearator` and `value` are used as-is and need to
|
|
422
|
-
* follow [PostgREST
|
|
423
|
-
* syntax](https://postgrest.org/en/stable/api.html#operators). You also need
|
|
424
|
-
* to make sure they are properly sanitized.
|
|
425
|
-
*
|
|
426
|
-
* @param column - The column to filter on
|
|
427
|
-
* @param operator - The operator to filter with, following PostgREST syntax
|
|
428
|
-
* @param value - The value to filter with, following PostgREST syntax
|
|
429
|
-
*/
|
|
430
|
-
filter(column, operator, value) {
|
|
431
|
-
this.url.searchParams.append(column, `${operator}.${value}`);
|
|
432
|
-
return this;
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
exports.default = PostgrestFilterBuilder;
|
|
436
|
-
//# sourceMappingURL=PostgrestFilterBuilder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PostgrestFilterBuilder.js","sourceRoot":"","sources":["../../src/PostgrestFilterBuilder.ts"],"names":[],"mappings":";;;AAAA,oGAAmE;AAmCnE,MAAM,4BAA4B,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,CAAA;AA2CxD,MAAqB,sBAQnB,SAAQ,mCAQT;IACC;;;;;;;OAOG;IACH,EAAE,CACA,MAAkB,EAClB,KAOW;QAEX,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,KAAK,EAAE,CAAC,CAAA;QACnD,OAAO,IAAI,CAAA;IACb,CAAC;IAED;;;;;OAKG;IACH,GAAG,CACD,MAAkB,EAClB,KAIW;QAEX,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,KAAK,EAAE,CAAC,CAAA;QACpD,OAAO,IAAI,CAAA;IACb,CAAC;IAID;;;;;OAKG;IACH,EAAE,CAAC,MAAc,EAAE,KAAc;QAC/B,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,KAAK,EAAE,CAAC,CAAA;QACnD,OAAO,IAAI,CAAA;IACb,CAAC;IAID;;;;;OAKG;IACH,GAAG,CAAC,MAAc,EAAE,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G;IACH,EAAE,CACA,OAAe,EACf,EACE,YAAY,EACZ,eAAe,GAAG,YAAY,MACyB,EAAE;QAE3D,MAAM,GAAG,GAAG,eAAe,CAAC,CAAC,CAAC,GAAG,eAAe,KAAK,CAAC,CAAC,CAAC,IAAI,CAAA;QAC5D,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,OAAO,GAAG,CAAC,CAAA;QACjD,OAAO,IAAI,CAAA;IACb,CAAC;IAQD;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,MAAc,EAAE,QAAgB,EAAE,KAAc;QACrD,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,QAAQ,IAAI,KAAK,EAAE,CAAC,CAAA;QAC5D,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAhmBD,yCAgmBC"}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import PostgrestFilterBuilder from './PostgrestFilterBuilder';
|
|
2
|
-
import { GetResult } from './select-query-parser/result';
|
|
3
|
-
import { ClientServerOptions, Fetch, GenericSchema, GenericTable, GenericView } from './types/common/common';
|
|
4
|
-
export default class PostgrestQueryBuilder<ClientOptions extends ClientServerOptions, Schema extends GenericSchema, Relation extends GenericTable | GenericView, RelationName = unknown, Relationships = Relation extends {
|
|
5
|
-
Relationships: infer R;
|
|
6
|
-
} ? R : unknown> {
|
|
7
|
-
url: URL;
|
|
8
|
-
headers: Headers;
|
|
9
|
-
schema?: string;
|
|
10
|
-
signal?: AbortSignal;
|
|
11
|
-
fetch?: Fetch;
|
|
12
|
-
/**
|
|
13
|
-
* Creates a query builder scoped to a Postgres table or view.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```ts
|
|
17
|
-
* import PostgrestQueryBuilder from '@supabase/postgrest-js'
|
|
18
|
-
*
|
|
19
|
-
* const query = new PostgrestQueryBuilder(
|
|
20
|
-
* new URL('https://xyzcompany.supabase.co/rest/v1/users'),
|
|
21
|
-
* { headers: { apikey: 'public-anon-key' } }
|
|
22
|
-
* )
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
constructor(url: URL, { headers, schema, fetch, }: {
|
|
26
|
-
headers?: HeadersInit;
|
|
27
|
-
schema?: string;
|
|
28
|
-
fetch?: Fetch;
|
|
29
|
-
});
|
|
30
|
-
/**
|
|
31
|
-
* Perform a SELECT query on the table or view.
|
|
32
|
-
*
|
|
33
|
-
* @param columns - The columns to retrieve, separated by commas. Columns can be renamed when returned with `customName:columnName`
|
|
34
|
-
*
|
|
35
|
-
* @param options - Named parameters
|
|
36
|
-
*
|
|
37
|
-
* @param options.head - When set to `true`, `data` will not be returned.
|
|
38
|
-
* Useful if you only need the count.
|
|
39
|
-
*
|
|
40
|
-
* @param options.count - Count algorithm to use to count rows in the table or view.
|
|
41
|
-
*
|
|
42
|
-
* `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
|
|
43
|
-
* hood.
|
|
44
|
-
*
|
|
45
|
-
* `"planned"`: Approximated but fast count algorithm. Uses the Postgres
|
|
46
|
-
* statistics under the hood.
|
|
47
|
-
*
|
|
48
|
-
* `"estimated"`: Uses exact count for low numbers and planned count for high
|
|
49
|
-
* numbers.
|
|
50
|
-
*/
|
|
51
|
-
select<Query extends string = '*', ResultOne = GetResult<Schema, Relation['Row'], RelationName, Relationships, Query, ClientOptions>>(columns?: Query, options?: {
|
|
52
|
-
head?: boolean;
|
|
53
|
-
count?: 'exact' | 'planned' | 'estimated';
|
|
54
|
-
}): PostgrestFilterBuilder<ClientOptions, Schema, Relation['Row'], ResultOne[], RelationName, Relationships, 'GET'>;
|
|
55
|
-
insert<Row extends Relation extends {
|
|
56
|
-
Insert: unknown;
|
|
57
|
-
} ? Relation['Insert'] : never>(values: Row, options?: {
|
|
58
|
-
count?: 'exact' | 'planned' | 'estimated';
|
|
59
|
-
}): PostgrestFilterBuilder<ClientOptions, Schema, Relation['Row'], null, RelationName, Relationships, 'POST'>;
|
|
60
|
-
insert<Row extends Relation extends {
|
|
61
|
-
Insert: unknown;
|
|
62
|
-
} ? Relation['Insert'] : never>(values: Row[], options?: {
|
|
63
|
-
count?: 'exact' | 'planned' | 'estimated';
|
|
64
|
-
defaultToNull?: boolean;
|
|
65
|
-
}): PostgrestFilterBuilder<ClientOptions, Schema, Relation['Row'], null, RelationName, Relationships, 'POST'>;
|
|
66
|
-
upsert<Row extends Relation extends {
|
|
67
|
-
Insert: unknown;
|
|
68
|
-
} ? Relation['Insert'] : never>(values: Row, options?: {
|
|
69
|
-
onConflict?: string;
|
|
70
|
-
ignoreDuplicates?: boolean;
|
|
71
|
-
count?: 'exact' | 'planned' | 'estimated';
|
|
72
|
-
}): PostgrestFilterBuilder<ClientOptions, Schema, Relation['Row'], null, RelationName, Relationships, 'POST'>;
|
|
73
|
-
upsert<Row extends Relation extends {
|
|
74
|
-
Insert: unknown;
|
|
75
|
-
} ? Relation['Insert'] : never>(values: Row[], options?: {
|
|
76
|
-
onConflict?: string;
|
|
77
|
-
ignoreDuplicates?: boolean;
|
|
78
|
-
count?: 'exact' | 'planned' | 'estimated';
|
|
79
|
-
defaultToNull?: boolean;
|
|
80
|
-
}): PostgrestFilterBuilder<ClientOptions, Schema, Relation['Row'], null, RelationName, Relationships, 'POST'>;
|
|
81
|
-
/**
|
|
82
|
-
* Perform an UPDATE on the table or view.
|
|
83
|
-
*
|
|
84
|
-
* By default, updated rows are not returned. To return it, chain the call
|
|
85
|
-
* with `.select()` after filters.
|
|
86
|
-
*
|
|
87
|
-
* @param values - The values to update with
|
|
88
|
-
*
|
|
89
|
-
* @param options - Named parameters
|
|
90
|
-
*
|
|
91
|
-
* @param options.count - Count algorithm to use to count updated rows.
|
|
92
|
-
*
|
|
93
|
-
* `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
|
|
94
|
-
* hood.
|
|
95
|
-
*
|
|
96
|
-
* `"planned"`: Approximated but fast count algorithm. Uses the Postgres
|
|
97
|
-
* statistics under the hood.
|
|
98
|
-
*
|
|
99
|
-
* `"estimated"`: Uses exact count for low numbers and planned count for high
|
|
100
|
-
* numbers.
|
|
101
|
-
*/
|
|
102
|
-
update<Row extends Relation extends {
|
|
103
|
-
Update: unknown;
|
|
104
|
-
} ? Relation['Update'] : never>(values: Row, { count, }?: {
|
|
105
|
-
count?: 'exact' | 'planned' | 'estimated';
|
|
106
|
-
}): PostgrestFilterBuilder<ClientOptions, Schema, Relation['Row'], null, RelationName, Relationships, 'PATCH'>;
|
|
107
|
-
/**
|
|
108
|
-
* Perform a DELETE on the table or view.
|
|
109
|
-
*
|
|
110
|
-
* By default, deleted rows are not returned. To return it, chain the call
|
|
111
|
-
* with `.select()` after filters.
|
|
112
|
-
*
|
|
113
|
-
* @param options - Named parameters
|
|
114
|
-
*
|
|
115
|
-
* @param options.count - Count algorithm to use to count deleted rows.
|
|
116
|
-
*
|
|
117
|
-
* `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
|
|
118
|
-
* hood.
|
|
119
|
-
*
|
|
120
|
-
* `"planned"`: Approximated but fast count algorithm. Uses the Postgres
|
|
121
|
-
* statistics under the hood.
|
|
122
|
-
*
|
|
123
|
-
* `"estimated"`: Uses exact count for low numbers and planned count for high
|
|
124
|
-
* numbers.
|
|
125
|
-
*/
|
|
126
|
-
delete({ count, }?: {
|
|
127
|
-
count?: 'exact' | 'planned' | 'estimated';
|
|
128
|
-
}): PostgrestFilterBuilder<ClientOptions, Schema, Relation['Row'], null, RelationName, Relationships, 'DELETE'>;
|
|
129
|
-
}
|
|
130
|
-
//# sourceMappingURL=PostgrestQueryBuilder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PostgrestQueryBuilder.d.ts","sourceRoot":"","sources":["../../src/PostgrestQueryBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B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