@data-loom/postgrest-js 0.0.2-alpha.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/cjs/PostgrestBuilder.d.ts +61 -0
  2. package/dist/cjs/PostgrestBuilder.d.ts.map +1 -0
  3. package/dist/cjs/PostgrestBuilder.js +237 -0
  4. package/dist/cjs/PostgrestBuilder.js.map +1 -0
  5. package/dist/cjs/PostgrestClient.d.ts +72 -0
  6. package/dist/cjs/PostgrestClient.d.ts.map +1 -0
  7. package/dist/cjs/PostgrestClient.js +121 -0
  8. package/dist/cjs/PostgrestClient.js.map +1 -0
  9. package/dist/cjs/PostgrestError.d.ts +17 -0
  10. package/dist/cjs/PostgrestError.d.ts.map +1 -0
  11. package/dist/cjs/PostgrestError.js +18 -0
  12. package/dist/cjs/PostgrestError.js.map +1 -0
  13. package/dist/cjs/PostgrestFilterBuilder.d.ts +105 -0
  14. package/dist/cjs/PostgrestFilterBuilder.d.ts.map +1 -0
  15. package/dist/cjs/PostgrestFilterBuilder.js +381 -0
  16. package/dist/cjs/PostgrestFilterBuilder.js.map +1 -0
  17. package/dist/cjs/PostgrestQueryBuilder.d.ts +117 -0
  18. package/dist/cjs/PostgrestQueryBuilder.d.ts.map +1 -0
  19. package/dist/cjs/PostgrestQueryBuilder.js +271 -0
  20. package/dist/cjs/PostgrestQueryBuilder.js.map +1 -0
  21. package/dist/cjs/PostgrestTransformBuilder.d.ts +149 -0
  22. package/dist/cjs/PostgrestTransformBuilder.d.ts.map +1 -0
  23. package/dist/cjs/PostgrestTransformBuilder.js +222 -0
  24. package/dist/cjs/PostgrestTransformBuilder.js.map +1 -0
  25. package/dist/cjs/constants.d.ts +4 -0
  26. package/dist/cjs/constants.d.ts.map +1 -0
  27. package/dist/cjs/constants.js +6 -0
  28. package/dist/cjs/constants.js.map +1 -0
  29. package/dist/cjs/index.d.ts +19 -0
  30. package/dist/cjs/index.d.ts.map +1 -0
  31. package/dist/cjs/index.js +28 -0
  32. package/dist/cjs/index.js.map +1 -0
  33. package/dist/cjs/select-query-parser/parser.d.ts +261 -0
  34. package/dist/cjs/select-query-parser/parser.d.ts.map +1 -0
  35. package/dist/cjs/select-query-parser/parser.js +5 -0
  36. package/dist/cjs/select-query-parser/parser.js.map +1 -0
  37. package/dist/cjs/select-query-parser/result.d.ts +149 -0
  38. package/dist/cjs/select-query-parser/result.d.ts.map +1 -0
  39. package/dist/cjs/select-query-parser/result.js +3 -0
  40. package/dist/cjs/select-query-parser/result.js.map +1 -0
  41. package/dist/cjs/select-query-parser/types.d.ts +31 -0
  42. package/dist/cjs/select-query-parser/types.d.ts.map +1 -0
  43. package/dist/cjs/select-query-parser/types.js +3 -0
  44. package/dist/cjs/select-query-parser/types.js.map +1 -0
  45. package/dist/cjs/select-query-parser/utils.d.ts +255 -0
  46. package/dist/cjs/select-query-parser/utils.d.ts.map +1 -0
  47. package/dist/cjs/select-query-parser/utils.js +3 -0
  48. package/dist/cjs/select-query-parser/utils.js.map +1 -0
  49. package/dist/cjs/types.d.ts +98 -0
  50. package/dist/cjs/types.d.ts.map +1 -0
  51. package/dist/cjs/types.js +3 -0
  52. package/dist/cjs/types.js.map +1 -0
  53. package/dist/cjs/version.d.ts +2 -0
  54. package/dist/cjs/version.d.ts.map +1 -0
  55. package/dist/cjs/version.js +5 -0
  56. package/dist/cjs/version.js.map +1 -0
  57. package/dist/esm/wrapper.mjs +28 -0
  58. package/package.json +2 -2
@@ -0,0 +1,271 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const PostgrestFilterBuilder_1 = __importDefault(require("./PostgrestFilterBuilder"));
7
+ class PostgrestQueryBuilder {
8
+ constructor(url, { headers = {}, schema, fetch, }) {
9
+ this.url = url;
10
+ this.headers = headers;
11
+ this.schema = schema;
12
+ this.fetch = fetch;
13
+ }
14
+ /**
15
+ * Perform a SELECT query on the table or view.
16
+ *
17
+ * @param columns - The columns to retrieve, separated by commas. Columns can be renamed when returned with `customName:columnName`
18
+ *
19
+ * @param options - Named parameters
20
+ *
21
+ * @param options.head - When set to `true`, `data` will not be returned.
22
+ * Useful if you only need the count.
23
+ *
24
+ * @param options.count - Count algorithm to use to count rows in the table or view.
25
+ *
26
+ * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
27
+ * hood.
28
+ *
29
+ * `"planned"`: Approximated but fast count algorithm. Uses the Postgres
30
+ * statistics under the hood.
31
+ *
32
+ * `"estimated"`: Uses exact count for low numbers and planned count for high
33
+ * numbers.
34
+ */
35
+ select(columns, { head = false, count, } = {}) {
36
+ const method = 'GET';
37
+ // Remove whitespaces except when quoted
38
+ let quoted = false;
39
+ const cleanedColumns = (columns !== null && columns !== void 0 ? columns : '*')
40
+ .split('')
41
+ .map((c) => {
42
+ if (/\s/.test(c) && !quoted) {
43
+ return '';
44
+ }
45
+ if (c === '"') {
46
+ quoted = !quoted;
47
+ }
48
+ return c;
49
+ })
50
+ .join('');
51
+ this.url.searchParams.set('select', cleanedColumns);
52
+ if (count) {
53
+ this.headers['Prefer'] = `count=${count}`;
54
+ }
55
+ return new PostgrestFilterBuilder_1.default({
56
+ method,
57
+ url: this.url,
58
+ headers: this.headers,
59
+ schema: this.schema,
60
+ fetch: this.fetch,
61
+ allowEmpty: false,
62
+ });
63
+ }
64
+ /**
65
+ * Perform an INSERT into the table or view.
66
+ *
67
+ * By default, inserted rows are not returned. To return it, chain the call
68
+ * with `.select()`.
69
+ *
70
+ * @param values - The values to insert. Pass an object to insert a single row
71
+ * or an array to insert multiple rows.
72
+ *
73
+ * @param options - Named parameters
74
+ *
75
+ * @param options.count - Count algorithm to use to count inserted rows.
76
+ *
77
+ * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
78
+ * hood.
79
+ *
80
+ * `"planned"`: Approximated but fast count algorithm. Uses the Postgres
81
+ * statistics under the hood.
82
+ *
83
+ * `"estimated"`: Uses exact count for low numbers and planned count for high
84
+ * numbers.
85
+ *
86
+ * @param options.defaultToNull - Make missing fields default to `null`.
87
+ * Otherwise, use the default value for the column. Only applies for bulk
88
+ * inserts.
89
+ */
90
+ insert(values, { count, defaultToNull = true, } = {}) {
91
+ const method = 'POST';
92
+ const prefersHeaders = [];
93
+ if (this.headers['Prefer']) {
94
+ prefersHeaders.push(this.headers['Prefer']);
95
+ }
96
+ if (count) {
97
+ prefersHeaders.push(`count=${count}`);
98
+ }
99
+ if (!defaultToNull) {
100
+ prefersHeaders.push('missing=default');
101
+ }
102
+ this.headers['Prefer'] = prefersHeaders.join(',');
103
+ if (Array.isArray(values)) {
104
+ const columns = values.reduce((acc, x) => acc.concat(Object.keys(x)), []);
105
+ if (columns.length > 0) {
106
+ const uniqueColumns = [...new Set(columns)].map((column) => `"${column}"`);
107
+ this.url.searchParams.set('columns', uniqueColumns.join(','));
108
+ }
109
+ }
110
+ return new PostgrestFilterBuilder_1.default({
111
+ method,
112
+ url: this.url,
113
+ headers: this.headers,
114
+ schema: this.schema,
115
+ body: values,
116
+ fetch: this.fetch,
117
+ allowEmpty: false,
118
+ });
119
+ }
120
+ /**
121
+ * Perform an UPSERT on the table or view. Depending on the column(s) passed
122
+ * to `onConflict`, `.upsert()` allows you to perform the equivalent of
123
+ * `.insert()` if a row with the corresponding `onConflict` columns doesn't
124
+ * exist, or if it does exist, perform an alternative action depending on
125
+ * `ignoreDuplicates`.
126
+ *
127
+ * By default, upserted rows are not returned. To return it, chain the call
128
+ * with `.select()`.
129
+ *
130
+ * @param values - The values to upsert with. Pass an object to upsert a
131
+ * single row or an array to upsert multiple rows.
132
+ *
133
+ * @param options - Named parameters
134
+ *
135
+ * @param options.onConflict - Comma-separated UNIQUE column(s) to specify how
136
+ * duplicate rows are determined. Two rows are duplicates if all the
137
+ * `onConflict` columns are equal.
138
+ *
139
+ * @param options.ignoreDuplicates - If `true`, duplicate rows are ignored. If
140
+ * `false`, duplicate rows are merged with existing rows.
141
+ *
142
+ * @param options.count - Count algorithm to use to count upserted rows.
143
+ *
144
+ * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
145
+ * hood.
146
+ *
147
+ * `"planned"`: Approximated but fast count algorithm. Uses the Postgres
148
+ * statistics under the hood.
149
+ *
150
+ * `"estimated"`: Uses exact count for low numbers and planned count for high
151
+ * numbers.
152
+ *
153
+ * @param options.defaultToNull - Make missing fields default to `null`.
154
+ * Otherwise, use the default value for the column. This only applies when
155
+ * inserting new rows, not when merging with existing rows under
156
+ * `ignoreDuplicates: false`. This also only applies when doing bulk upserts.
157
+ */
158
+ upsert(values, { onConflict, ignoreDuplicates = false, count, defaultToNull = true, } = {}) {
159
+ const method = 'POST';
160
+ const prefersHeaders = [`resolution=${ignoreDuplicates ? 'ignore' : 'merge'}-duplicates`];
161
+ if (onConflict !== undefined)
162
+ this.url.searchParams.set('on_conflict', onConflict);
163
+ if (this.headers['Prefer']) {
164
+ prefersHeaders.push(this.headers['Prefer']);
165
+ }
166
+ if (count) {
167
+ prefersHeaders.push(`count=${count}`);
168
+ }
169
+ if (!defaultToNull) {
170
+ prefersHeaders.push('missing=default');
171
+ }
172
+ this.headers['Prefer'] = prefersHeaders.join(',');
173
+ if (Array.isArray(values)) {
174
+ const columns = values.reduce((acc, x) => acc.concat(Object.keys(x)), []);
175
+ if (columns.length > 0) {
176
+ const uniqueColumns = [...new Set(columns)].map((column) => `"${column}"`);
177
+ this.url.searchParams.set('columns', uniqueColumns.join(','));
178
+ }
179
+ }
180
+ return new PostgrestFilterBuilder_1.default({
181
+ method,
182
+ url: this.url,
183
+ headers: this.headers,
184
+ schema: this.schema,
185
+ body: values,
186
+ fetch: this.fetch,
187
+ allowEmpty: false,
188
+ });
189
+ }
190
+ /**
191
+ * Perform an UPDATE on the table or view.
192
+ *
193
+ * By default, updated rows are not returned. To return it, chain the call
194
+ * with `.select()` after filters.
195
+ *
196
+ * @param values - The values to update with
197
+ *
198
+ * @param options - Named parameters
199
+ *
200
+ * @param options.count - Count algorithm to use to count updated rows.
201
+ *
202
+ * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
203
+ * hood.
204
+ *
205
+ * `"planned"`: Approximated but fast count algorithm. Uses the Postgres
206
+ * statistics under the hood.
207
+ *
208
+ * `"estimated"`: Uses exact count for low numbers and planned count for high
209
+ * numbers.
210
+ */
211
+ update(values, { count, } = {}) {
212
+ const method = 'PATCH';
213
+ const prefersHeaders = [];
214
+ if (this.headers['Prefer']) {
215
+ prefersHeaders.push(this.headers['Prefer']);
216
+ }
217
+ if (count) {
218
+ prefersHeaders.push(`count=${count}`);
219
+ }
220
+ this.headers['Prefer'] = prefersHeaders.join(',');
221
+ return new PostgrestFilterBuilder_1.default({
222
+ method,
223
+ url: this.url,
224
+ headers: this.headers,
225
+ schema: this.schema,
226
+ body: values,
227
+ fetch: this.fetch,
228
+ allowEmpty: false,
229
+ });
230
+ }
231
+ /**
232
+ * Perform a DELETE on the table or view.
233
+ *
234
+ * By default, deleted rows are not returned. To return it, chain the call
235
+ * with `.select()` after filters.
236
+ *
237
+ * @param options - Named parameters
238
+ *
239
+ * @param options.count - Count algorithm to use to count deleted rows.
240
+ *
241
+ * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
242
+ * hood.
243
+ *
244
+ * `"planned"`: Approximated but fast count algorithm. Uses the Postgres
245
+ * statistics under the hood.
246
+ *
247
+ * `"estimated"`: Uses exact count for low numbers and planned count for high
248
+ * numbers.
249
+ */
250
+ delete({ count, } = {}) {
251
+ const method = 'DELETE';
252
+ const prefersHeaders = [];
253
+ if (count) {
254
+ prefersHeaders.push(`count=${count}`);
255
+ }
256
+ if (this.headers['Prefer']) {
257
+ prefersHeaders.unshift(this.headers['Prefer']);
258
+ }
259
+ this.headers['Prefer'] = prefersHeaders.join(',');
260
+ return new PostgrestFilterBuilder_1.default({
261
+ method,
262
+ url: this.url,
263
+ headers: this.headers,
264
+ schema: this.schema,
265
+ fetch: this.fetch,
266
+ allowEmpty: false,
267
+ });
268
+ }
269
+ }
270
+ exports.default = PostgrestQueryBuilder;
271
+ //# sourceMappingURL=PostgrestQueryBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PostgrestQueryBuilder.js","sourceRoot":"","sources":["../../src/PostgrestQueryBuilder.ts"],"names":[],"mappings":";;;;;AACA,sFAA6D;AAI7D,MAAqB,qBAAqB;IAYxC,YACE,GAAQ,EACR,EACE,OAAO,GAAG,EAAE,EACZ,MAAM,EACN,KAAK,GAKN;QAED,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,MAAM,CAIJ,OAAe,EACf,EACE,IAAI,GAAG,KAAK,EACZ,KAAK,MAIH,EAAE;QAEN,MAAM,MAAM,GAAG,KAAK,CAAA;QACpB,wCAAwC;QACxC,IAAI,MAAM,GAAG,KAAK,CAAA;QAClB,MAAM,cAAc,GAAG,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,GAAG,CAAC;aACpC,KAAK,CAAC,EAAE,CAAC;aACT,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YACT,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE;gBAC3B,OAAO,EAAE,CAAA;aACV;YACD,IAAI,CAAC,KAAK,GAAG,EAAE;gBACb,MAAM,GAAG,CAAC,MAAM,CAAA;aACjB;YACD,OAAO,CAAC,CAAA;QACV,CAAC,CAAC;aACD,IAAI,CAAC,EAAE,CAAC,CAAA;QACX,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,cAAc,CAAC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-0,0 +1,149 @@
1
+ import PostgrestBuilder from './PostgrestBuilder';
2
+ import { GetResult } from './select-query-parser/result';
3
+ import { GenericSchema, CheckMatchingArrayTypes } from './types';
4
+ export default class PostgrestTransformBuilder<Schema extends GenericSchema, Row extends Record<string, unknown>, Result, RelationName = unknown, Relationships = unknown> extends PostgrestBuilder<Result> {
5
+ /**
6
+ * Perform a SELECT on the query result.
7
+ *
8
+ * By default, `.insert()`, `.update()`, `.upsert()`, and `.delete()` do not
9
+ * return modified rows. By calling this method, modified rows are returned in
10
+ * `data`.
11
+ *
12
+ * @param columns - The columns to retrieve, separated by commas
13
+ */
14
+ select<Query extends string = '*', NewResultOne = GetResult<Schema, Row, RelationName, Relationships, Query>>(columns?: Query): PostgrestTransformBuilder<Schema, Row, NewResultOne[], RelationName, Relationships>;
15
+ order<ColumnName extends string & keyof Row>(column: ColumnName, options?: {
16
+ ascending?: boolean;
17
+ nullsFirst?: boolean;
18
+ referencedTable?: undefined;
19
+ }): this;
20
+ order(column: string, options?: {
21
+ ascending?: boolean;
22
+ nullsFirst?: boolean;
23
+ referencedTable?: string;
24
+ }): this;
25
+ /**
26
+ * @deprecated Use `options.referencedTable` instead of `options.foreignTable`
27
+ */
28
+ order<ColumnName extends string & keyof Row>(column: ColumnName, options?: {
29
+ ascending?: boolean;
30
+ nullsFirst?: boolean;
31
+ foreignTable?: undefined;
32
+ }): this;
33
+ /**
34
+ * @deprecated Use `options.referencedTable` instead of `options.foreignTable`
35
+ */
36
+ order(column: string, options?: {
37
+ ascending?: boolean;
38
+ nullsFirst?: boolean;
39
+ foreignTable?: string;
40
+ }): this;
41
+ /**
42
+ * Limit the query result by `count`.
43
+ *
44
+ * @param count - The maximum number of rows to return
45
+ * @param options - Named parameters
46
+ * @param options.referencedTable - Set this to limit rows of referenced
47
+ * tables instead of the parent table
48
+ * @param options.foreignTable - Deprecated, use `options.referencedTable`
49
+ * instead
50
+ */
51
+ limit(count: number, { foreignTable, referencedTable, }?: {
52
+ foreignTable?: string;
53
+ referencedTable?: string;
54
+ }): this;
55
+ /**
56
+ * Limit the query result by starting at an offset `from` and ending at the offset `to`.
57
+ * Only records within this range are returned.
58
+ * This respects the query order and if there is no order clause the range could behave unexpectedly.
59
+ * The `from` and `to` values are 0-based and inclusive: `range(1, 3)` will include the second, third
60
+ * and fourth rows of the query.
61
+ *
62
+ * @param from - The starting index from which to limit the result
63
+ * @param to - The last index to which to limit the result
64
+ * @param options - Named parameters
65
+ * @param options.referencedTable - Set this to limit rows of referenced
66
+ * tables instead of the parent table
67
+ * @param options.foreignTable - Deprecated, use `options.referencedTable`
68
+ * instead
69
+ */
70
+ range(from: number, to: number, { foreignTable, referencedTable, }?: {
71
+ foreignTable?: string;
72
+ referencedTable?: string;
73
+ }): this;
74
+ /**
75
+ * Set the AbortSignal for the fetch request.
76
+ *
77
+ * @param signal - The AbortSignal to use for the fetch request
78
+ */
79
+ abortSignal(signal: AbortSignal): this;
80
+ /**
81
+ * Return `data` as a single object instead of an array of objects.
82
+ *
83
+ * Query result must be one row (e.g. using `.limit(1)`), otherwise this
84
+ * returns an error.
85
+ */
86
+ single<ResultOne = Result extends (infer ResultOne)[] ? ResultOne : never>(): PostgrestBuilder<ResultOne>;
87
+ /**
88
+ * Return `data` as a single object instead of an array of objects.
89
+ *
90
+ * Query result must be zero or one row (e.g. using `.limit(1)`), otherwise
91
+ * this returns an error.
92
+ */
93
+ maybeSingle<ResultOne = Result extends (infer ResultOne)[] ? ResultOne : never>(): PostgrestBuilder<ResultOne | null>;
94
+ /**
95
+ * Return `data` as a string in CSV format.
96
+ */
97
+ csv(): PostgrestBuilder<string>;
98
+ /**
99
+ * Return `data` as an object in [GeoJSON](https://geojson.org) format.
100
+ */
101
+ geojson(): PostgrestBuilder<Record<string, unknown>>;
102
+ /**
103
+ * Return `data` as the EXPLAIN plan for the query.
104
+ *
105
+ * You need to enable the
106
+ * [db_plan_enabled](https://supabase.com/docs/guides/database/debugging-performance#enabling-explain)
107
+ * setting before using this method.
108
+ *
109
+ * @param options - Named parameters
110
+ *
111
+ * @param options.analyze - If `true`, the query will be executed and the
112
+ * actual run time will be returned
113
+ *
114
+ * @param options.verbose - If `true`, the query identifier will be returned
115
+ * and `data` will include the output columns of the query
116
+ *
117
+ * @param options.settings - If `true`, include information on configuration
118
+ * parameters that affect query planning
119
+ *
120
+ * @param options.buffers - If `true`, include information on buffer usage
121
+ *
122
+ * @param options.wal - If `true`, include information on WAL record generation
123
+ *
124
+ * @param options.format - The format of the output, can be `"text"` (default)
125
+ * or `"json"`
126
+ */
127
+ explain({ analyze, verbose, settings, buffers, wal, format, }?: {
128
+ analyze?: boolean;
129
+ verbose?: boolean;
130
+ settings?: boolean;
131
+ buffers?: boolean;
132
+ wal?: boolean;
133
+ format?: 'json' | 'text';
134
+ }): PostgrestBuilder<Record<string, unknown>[]> | PostgrestBuilder<string>;
135
+ /**
136
+ * Rollback the query.
137
+ *
138
+ * `data` will still be returned, but the query is not committed.
139
+ */
140
+ rollback(): this;
141
+ /**
142
+ * Override the type of the returned `data`.
143
+ *
144
+ * @typeParam NewResult - The new result type to override with
145
+ * @deprecated Use overrideTypes<yourType, { merge: false }>() method at the end of your call chain instead
146
+ */
147
+ returns<NewResult>(): PostgrestTransformBuilder<Schema, Row, CheckMatchingArrayTypes<Result, NewResult>, RelationName, Relationships>;
148
+ }
149
+ //# sourceMappingURL=PostgrestTransformBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PostgrestTransformBuilder.d.ts","sourceRoot":"","sources":["../../src/PostgrestTransformBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAEhE,MAAM,CAAC,OAAO,OAAO,yBAAyB,CAC5C,MAAM,SAAS,aAAa,EAC5B,GAAG,SAAS,MAAM,CAAC,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AAC,EAAE,OAAO,CAAA;QACb,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KACpB,GAAG,gBAAgB,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,GAAG,gBAAgB,CAAC,MAAM,CAAC;IAmB/E;;;;OAIG;IACH,QAAQ,IAAI,IAAI;IAShB;;;;;OAKG;IACH,OAAO,CAAC,SAAS,KAAK,yBAAyB,CAC7C,MAAM,EACN,GAAG,EACH,uBAAuB,CAAC,MAAM,EAAE,SAAS,CAAC,EAC1C,YAAY,EACZ,aAAa,CACd;CASF"}
@@ -0,0 +1,222 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const PostgrestBuilder_1 = __importDefault(require("./PostgrestBuilder"));
7
+ class PostgrestTransformBuilder extends PostgrestBuilder_1.default {
8
+ /**
9
+ * Perform a SELECT on the query result.
10
+ *
11
+ * By default, `.insert()`, `.update()`, `.upsert()`, and `.delete()` do not
12
+ * return modified rows. By calling this method, modified rows are returned in
13
+ * `data`.
14
+ *
15
+ * @param columns - The columns to retrieve, separated by commas
16
+ */
17
+ select(columns) {
18
+ // Remove whitespaces except when quoted
19
+ let quoted = false;
20
+ const cleanedColumns = (columns !== null && columns !== void 0 ? columns : '*')
21
+ .split('')
22
+ .map((c) => {
23
+ if (/\s/.test(c) && !quoted) {
24
+ return '';
25
+ }
26
+ if (c === '"') {
27
+ quoted = !quoted;
28
+ }
29
+ return c;
30
+ })
31
+ .join('');
32
+ this.url.searchParams.set('select', cleanedColumns);
33
+ if (this.headers['Prefer']) {
34
+ this.headers['Prefer'] += ',';
35
+ }
36
+ this.headers['Prefer'] += 'return=representation';
37
+ return this;
38
+ }
39
+ /**
40
+ * Order the query result by `column`.
41
+ *
42
+ * You can call this method multiple times to order by multiple columns.
43
+ *
44
+ * You can order referenced tables, but it only affects the ordering of the
45
+ * parent table if you use `!inner` in the query.
46
+ *
47
+ * @param column - The column to order by
48
+ * @param options - Named parameters
49
+ * @param options.ascending - If `true`, the result will be in ascending order
50
+ * @param options.nullsFirst - If `true`, `null`s appear first. If `false`,
51
+ * `null`s appear last.
52
+ * @param options.referencedTable - Set this to order a referenced table by
53
+ * its columns
54
+ * @param options.foreignTable - Deprecated, use `options.referencedTable`
55
+ * instead
56
+ */
57
+ order(column, { ascending = true, nullsFirst, foreignTable, referencedTable = foreignTable, } = {}) {
58
+ const key = referencedTable ? `${referencedTable}.order` : 'order';
59
+ const existingOrder = this.url.searchParams.get(key);
60
+ this.url.searchParams.set(key, `${existingOrder ? `${existingOrder},` : ''}${column}.${ascending ? 'asc' : 'desc'}${nullsFirst === undefined ? '' : nullsFirst ? '.nullsfirst' : '.nullslast'}`);
61
+ return this;
62
+ }
63
+ /**
64
+ * Limit the query result by `count`.
65
+ *
66
+ * @param count - The maximum number of rows to return
67
+ * @param options - Named parameters
68
+ * @param options.referencedTable - Set this to limit rows of referenced
69
+ * tables instead of the parent table
70
+ * @param options.foreignTable - Deprecated, use `options.referencedTable`
71
+ * instead
72
+ */
73
+ limit(count, { foreignTable, referencedTable = foreignTable, } = {}) {
74
+ const key = typeof referencedTable === 'undefined' ? 'limit' : `${referencedTable}.limit`;
75
+ this.url.searchParams.set(key, `${count}`);
76
+ return this;
77
+ }
78
+ /**
79
+ * Limit the query result by starting at an offset `from` and ending at the offset `to`.
80
+ * Only records within this range are returned.
81
+ * This respects the query order and if there is no order clause the range could behave unexpectedly.
82
+ * The `from` and `to` values are 0-based and inclusive: `range(1, 3)` will include the second, third
83
+ * and fourth rows of the query.
84
+ *
85
+ * @param from - The starting index from which to limit the result
86
+ * @param to - The last index to which to limit the result
87
+ * @param options - Named parameters
88
+ * @param options.referencedTable - Set this to limit rows of referenced
89
+ * tables instead of the parent table
90
+ * @param options.foreignTable - Deprecated, use `options.referencedTable`
91
+ * instead
92
+ */
93
+ range(from, to, { foreignTable, referencedTable = foreignTable, } = {}) {
94
+ const keyOffset = typeof referencedTable === 'undefined' ? 'offset' : `${referencedTable}.offset`;
95
+ const keyLimit = typeof referencedTable === 'undefined' ? 'limit' : `${referencedTable}.limit`;
96
+ this.url.searchParams.set(keyOffset, `${from}`);
97
+ // Range is inclusive, so add 1
98
+ this.url.searchParams.set(keyLimit, `${to - from + 1}`);
99
+ return this;
100
+ }
101
+ /**
102
+ * Set the AbortSignal for the fetch request.
103
+ *
104
+ * @param signal - The AbortSignal to use for the fetch request
105
+ */
106
+ abortSignal(signal) {
107
+ this.signal = signal;
108
+ return this;
109
+ }
110
+ /**
111
+ * Return `data` as a single object instead of an array of objects.
112
+ *
113
+ * Query result must be one row (e.g. using `.limit(1)`), otherwise this
114
+ * returns an error.
115
+ */
116
+ single() {
117
+ this.headers['Accept'] = 'application/vnd.pgrst.object+json';
118
+ return this;
119
+ }
120
+ /**
121
+ * Return `data` as a single object instead of an array of objects.
122
+ *
123
+ * Query result must be zero or one row (e.g. using `.limit(1)`), otherwise
124
+ * this returns an error.
125
+ */
126
+ maybeSingle() {
127
+ // Temporary partial fix for https://github.com/supabase/postgrest-js/issues/361
128
+ // Issue persists e.g. for `.insert([...]).select().maybeSingle()`
129
+ if (this.method === 'GET') {
130
+ this.headers['Accept'] = 'application/json';
131
+ }
132
+ else {
133
+ this.headers['Accept'] = 'application/vnd.pgrst.object+json';
134
+ }
135
+ this.isMaybeSingle = true;
136
+ return this;
137
+ }
138
+ /**
139
+ * Return `data` as a string in CSV format.
140
+ */
141
+ csv() {
142
+ this.headers['Accept'] = 'text/csv';
143
+ return this;
144
+ }
145
+ /**
146
+ * Return `data` as an object in [GeoJSON](https://geojson.org) format.
147
+ */
148
+ geojson() {
149
+ this.headers['Accept'] = 'application/geo+json';
150
+ return this;
151
+ }
152
+ /**
153
+ * Return `data` as the EXPLAIN plan for the query.
154
+ *
155
+ * You need to enable the
156
+ * [db_plan_enabled](https://supabase.com/docs/guides/database/debugging-performance#enabling-explain)
157
+ * setting before using this method.
158
+ *
159
+ * @param options - Named parameters
160
+ *
161
+ * @param options.analyze - If `true`, the query will be executed and the
162
+ * actual run time will be returned
163
+ *
164
+ * @param options.verbose - If `true`, the query identifier will be returned
165
+ * and `data` will include the output columns of the query
166
+ *
167
+ * @param options.settings - If `true`, include information on configuration
168
+ * parameters that affect query planning
169
+ *
170
+ * @param options.buffers - If `true`, include information on buffer usage
171
+ *
172
+ * @param options.wal - If `true`, include information on WAL record generation
173
+ *
174
+ * @param options.format - The format of the output, can be `"text"` (default)
175
+ * or `"json"`
176
+ */
177
+ explain({ analyze = false, verbose = false, settings = false, buffers = false, wal = false, format = 'text', } = {}) {
178
+ var _a;
179
+ const options = [
180
+ analyze ? 'analyze' : null,
181
+ verbose ? 'verbose' : null,
182
+ settings ? 'settings' : null,
183
+ buffers ? 'buffers' : null,
184
+ wal ? 'wal' : null,
185
+ ]
186
+ .filter(Boolean)
187
+ .join('|');
188
+ // An Accept header can carry multiple media types but postgrest-js always sends one
189
+ const forMediatype = (_a = this.headers['Accept']) !== null && _a !== void 0 ? _a : 'application/json';
190
+ this.headers['Accept'] = `application/vnd.pgrst.plan+${format}; for="${forMediatype}"; options=${options};`;
191
+ if (format === 'json')
192
+ return this;
193
+ else
194
+ return this;
195
+ }
196
+ /**
197
+ * Rollback the query.
198
+ *
199
+ * `data` will still be returned, but the query is not committed.
200
+ */
201
+ rollback() {
202
+ var _a;
203
+ if (((_a = this.headers['Prefer']) !== null && _a !== void 0 ? _a : '').trim().length > 0) {
204
+ this.headers['Prefer'] += ',tx=rollback';
205
+ }
206
+ else {
207
+ this.headers['Prefer'] = 'tx=rollback';
208
+ }
209
+ return this;
210
+ }
211
+ /**
212
+ * Override the type of the returned `data`.
213
+ *
214
+ * @typeParam NewResult - The new result type to override with
215
+ * @deprecated Use overrideTypes<yourType, { merge: false }>() method at the end of your call chain instead
216
+ */
217
+ returns() {
218
+ return this;
219
+ }
220
+ }
221
+ exports.default = PostgrestTransformBuilder;
222
+ //# sourceMappingURL=PostgrestTransformBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PostgrestTransformBuilder.js","sourceRoot":"","sources":["../../src/PostgrestTransformBuilder.ts"],"names":[],"mappings":";;;;;AAAA,0EAAiD;AAIjD,MAAqB,yBAMnB,SAAQ,0BAAwB;IAChC;;;;;;;;OAQG;IACH,MAAM,CAIJ,OAAe;QAEf,wCAAwC;QACxC,IAAI,MAAM,GAAG,KAAK,CAAA;QAClB,MAAM,cAAc,GAAG,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,GAAG,CAAC;aACpC,KAAK,CAAC,EAAE,CAAC;aACT,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YACT,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE;gBAC3B,OAAO,EAAE,CAAA;aACV;YACD,IAAI,CAAC,KAAK,GAAG,EAAE;gBACb,MAAM,GAAG,CAAC,MAAM,CAAA;aACjB;YACD,OAAO,CAAC,CAAA;QACV,CAAC,CAAC;aACD,IAAI,CAAC,EAAE,CAAC,CAAA;QACX,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAA;QACnD,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC1B,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAA;SAC9B;QACD,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,uBAAuB,CAAA;QACjD,OAAO,IAMN,CAAA;IACH,CAAC;IAwBD;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CACH,MAAc,EACd,EACE,SAAS,GAAG,IAAI,EAChB,UAAU,EACV,YAAY,EACZ,eAAe,GAAG,YAAY,MAM5B,EAAE;QAEN,MAAM,GAAG,GAAG,eAAe,CAAC,CAAC,CAAC,GAAG,eAAe,QAAQ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.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,eAAe;;CAAiD,CAAA"}