@supabase/postgrest-js 2.87.4-canary.3 → 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.
Files changed (80) hide show
  1. package/dist/index.cjs +1237 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.d.cts +1421 -0
  4. package/dist/index.d.cts.map +1 -0
  5. package/dist/index.d.mts +1421 -0
  6. package/dist/index.d.mts.map +1 -0
  7. package/dist/index.mjs +1229 -0
  8. package/dist/index.mjs.map +1 -0
  9. package/package.json +18 -16
  10. package/src/version.ts +1 -1
  11. package/dist/cjs/PostgrestBuilder.d.ts +0 -85
  12. package/dist/cjs/PostgrestBuilder.d.ts.map +0 -1
  13. package/dist/cjs/PostgrestBuilder.js +0 -250
  14. package/dist/cjs/PostgrestBuilder.js.map +0 -1
  15. package/dist/cjs/PostgrestClient.d.ts +0 -93
  16. package/dist/cjs/PostgrestClient.d.ts.map +0 -1
  17. package/dist/cjs/PostgrestClient.js +0 -140
  18. package/dist/cjs/PostgrestClient.js.map +0 -1
  19. package/dist/cjs/PostgrestError.d.ts +0 -30
  20. package/dist/cjs/PostgrestError.d.ts.map +0 -1
  21. package/dist/cjs/PostgrestError.js +0 -31
  22. package/dist/cjs/PostgrestError.js.map +0 -1
  23. package/dist/cjs/PostgrestFilterBuilder.d.ts +0 -130
  24. package/dist/cjs/PostgrestFilterBuilder.d.ts.map +0 -1
  25. package/dist/cjs/PostgrestFilterBuilder.js +0 -436
  26. package/dist/cjs/PostgrestFilterBuilder.js.map +0 -1
  27. package/dist/cjs/PostgrestQueryBuilder.d.ts +0 -130
  28. package/dist/cjs/PostgrestQueryBuilder.d.ts.map +0 -1
  29. package/dist/cjs/PostgrestQueryBuilder.js +0 -310
  30. package/dist/cjs/PostgrestQueryBuilder.js.map +0 -1
  31. package/dist/cjs/PostgrestTransformBuilder.d.ts +0 -159
  32. package/dist/cjs/PostgrestTransformBuilder.d.ts.map +0 -1
  33. package/dist/cjs/PostgrestTransformBuilder.js +0 -224
  34. package/dist/cjs/PostgrestTransformBuilder.js.map +0 -1
  35. package/dist/cjs/constants.d.ts +0 -4
  36. package/dist/cjs/constants.d.ts.map +0 -1
  37. package/dist/cjs/constants.js +0 -6
  38. package/dist/cjs/constants.js.map +0 -1
  39. package/dist/cjs/index.d.ts +0 -20
  40. package/dist/cjs/index.d.ts.map +0 -1
  41. package/dist/cjs/index.js +0 -26
  42. package/dist/cjs/index.js.map +0 -1
  43. package/dist/cjs/select-query-parser/parser.d.ts +0 -258
  44. package/dist/cjs/select-query-parser/parser.d.ts.map +0 -1
  45. package/dist/cjs/select-query-parser/parser.js +0 -5
  46. package/dist/cjs/select-query-parser/parser.js.map +0 -1
  47. package/dist/cjs/select-query-parser/result.d.ts +0 -160
  48. package/dist/cjs/select-query-parser/result.d.ts.map +0 -1
  49. package/dist/cjs/select-query-parser/result.js +0 -3
  50. package/dist/cjs/select-query-parser/result.js.map +0 -1
  51. package/dist/cjs/select-query-parser/types.d.ts +0 -32
  52. package/dist/cjs/select-query-parser/types.d.ts.map +0 -1
  53. package/dist/cjs/select-query-parser/types.js +0 -3
  54. package/dist/cjs/select-query-parser/types.js.map +0 -1
  55. package/dist/cjs/select-query-parser/utils.d.ts +0 -283
  56. package/dist/cjs/select-query-parser/utils.d.ts.map +0 -1
  57. package/dist/cjs/select-query-parser/utils.js +0 -3
  58. package/dist/cjs/select-query-parser/utils.js.map +0 -1
  59. package/dist/cjs/types/common/common.d.ts +0 -46
  60. package/dist/cjs/types/common/common.d.ts.map +0 -1
  61. package/dist/cjs/types/common/common.js +0 -4
  62. package/dist/cjs/types/common/common.js.map +0 -1
  63. package/dist/cjs/types/common/rpc.d.ts +0 -40
  64. package/dist/cjs/types/common/rpc.d.ts.map +0 -1
  65. package/dist/cjs/types/common/rpc.js +0 -3
  66. package/dist/cjs/types/common/rpc.js.map +0 -1
  67. package/dist/cjs/types/feature-flags.d.ts +0 -7
  68. package/dist/cjs/types/feature-flags.d.ts.map +0 -1
  69. package/dist/cjs/types/feature-flags.js +0 -3
  70. package/dist/cjs/types/feature-flags.js.map +0 -1
  71. package/dist/cjs/types/types.d.ts +0 -69
  72. package/dist/cjs/types/types.d.ts.map +0 -1
  73. package/dist/cjs/types/types.js +0 -3
  74. package/dist/cjs/types/types.js.map +0 -1
  75. package/dist/cjs/version.d.ts +0 -2
  76. package/dist/cjs/version.d.ts.map +0 -1
  77. package/dist/cjs/version.js +0 -11
  78. package/dist/cjs/version.js.map +0 -1
  79. package/dist/esm/wrapper.mjs +0 -28
  80. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -1,310 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const PostgrestFilterBuilder_1 = tslib_1.__importDefault(require("./PostgrestFilterBuilder"));
5
- class PostgrestQueryBuilder {
6
- /**
7
- * Creates a query builder scoped to a Postgres table or view.
8
- *
9
- * @example
10
- * ```ts
11
- * import PostgrestQueryBuilder from '@supabase/postgrest-js'
12
- *
13
- * const query = new PostgrestQueryBuilder(
14
- * new URL('https://xyzcompany.supabase.co/rest/v1/users'),
15
- * { headers: { apikey: 'public-anon-key' } }
16
- * )
17
- * ```
18
- */
19
- constructor(url, { headers = {}, schema, fetch, }) {
20
- this.url = url;
21
- this.headers = new Headers(headers);
22
- this.schema = schema;
23
- this.fetch = fetch;
24
- }
25
- /**
26
- * Perform a SELECT query on the table or view.
27
- *
28
- * @param columns - The columns to retrieve, separated by commas. Columns can be renamed when returned with `customName:columnName`
29
- *
30
- * @param options - Named parameters
31
- *
32
- * @param options.head - When set to `true`, `data` will not be returned.
33
- * Useful if you only need the count.
34
- *
35
- * @param options.count - Count algorithm to use to count rows in the table or view.
36
- *
37
- * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
38
- * hood.
39
- *
40
- * `"planned"`: Approximated but fast count algorithm. Uses the Postgres
41
- * statistics under the hood.
42
- *
43
- * `"estimated"`: Uses exact count for low numbers and planned count for high
44
- * numbers.
45
- */
46
- select(columns, options) {
47
- const { head = false, count } = options !== null && options !== void 0 ? options : {};
48
- const method = head ? 'HEAD' : 'GET';
49
- // Remove whitespaces except when quoted
50
- let quoted = false;
51
- const cleanedColumns = (columns !== null && columns !== void 0 ? columns : '*')
52
- .split('')
53
- .map((c) => {
54
- if (/\s/.test(c) && !quoted) {
55
- return '';
56
- }
57
- if (c === '"') {
58
- quoted = !quoted;
59
- }
60
- return c;
61
- })
62
- .join('');
63
- this.url.searchParams.set('select', cleanedColumns);
64
- if (count) {
65
- this.headers.append('Prefer', `count=${count}`);
66
- }
67
- return new PostgrestFilterBuilder_1.default({
68
- method,
69
- url: this.url,
70
- headers: this.headers,
71
- schema: this.schema,
72
- fetch: this.fetch,
73
- });
74
- }
75
- /**
76
- * Perform an INSERT into the table or view.
77
- *
78
- * By default, inserted rows are not returned. To return it, chain the call
79
- * with `.select()`.
80
- *
81
- * @param values - The values to insert. Pass an object to insert a single row
82
- * or an array to insert multiple rows.
83
- *
84
- * @param options - Named parameters
85
- *
86
- * @param options.count - Count algorithm to use to count inserted rows.
87
- *
88
- * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
89
- * hood.
90
- *
91
- * `"planned"`: Approximated but fast count algorithm. Uses the Postgres
92
- * statistics under the hood.
93
- *
94
- * `"estimated"`: Uses exact count for low numbers and planned count for high
95
- * numbers.
96
- *
97
- * @param options.defaultToNull - Make missing fields default to `null`.
98
- * Otherwise, use the default value for the column. Only applies for bulk
99
- * inserts.
100
- */
101
- insert(values, { count, defaultToNull = true, } = {}) {
102
- var _a;
103
- const method = 'POST';
104
- if (count) {
105
- this.headers.append('Prefer', `count=${count}`);
106
- }
107
- if (!defaultToNull) {
108
- this.headers.append('Prefer', `missing=default`);
109
- }
110
- if (Array.isArray(values)) {
111
- const columns = values.reduce((acc, x) => acc.concat(Object.keys(x)), []);
112
- if (columns.length > 0) {
113
- const uniqueColumns = [...new Set(columns)].map((column) => `"${column}"`);
114
- this.url.searchParams.set('columns', uniqueColumns.join(','));
115
- }
116
- }
117
- return new PostgrestFilterBuilder_1.default({
118
- method,
119
- url: this.url,
120
- headers: this.headers,
121
- schema: this.schema,
122
- body: values,
123
- fetch: (_a = this.fetch) !== null && _a !== void 0 ? _a : fetch,
124
- });
125
- }
126
- /**
127
- * Perform an UPSERT on the table or view. Depending on the column(s) passed
128
- * to `onConflict`, `.upsert()` allows you to perform the equivalent of
129
- * `.insert()` if a row with the corresponding `onConflict` columns doesn't
130
- * exist, or if it does exist, perform an alternative action depending on
131
- * `ignoreDuplicates`.
132
- *
133
- * By default, upserted rows are not returned. To return it, chain the call
134
- * with `.select()`.
135
- *
136
- * @param values - The values to upsert with. Pass an object to upsert a
137
- * single row or an array to upsert multiple rows.
138
- *
139
- * @param options - Named parameters
140
- *
141
- * @param options.onConflict - Comma-separated UNIQUE column(s) to specify how
142
- * duplicate rows are determined. Two rows are duplicates if all the
143
- * `onConflict` columns are equal.
144
- *
145
- * @param options.ignoreDuplicates - If `true`, duplicate rows are ignored. If
146
- * `false`, duplicate rows are merged with existing rows.
147
- *
148
- * @param options.count - Count algorithm to use to count upserted rows.
149
- *
150
- * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
151
- * hood.
152
- *
153
- * `"planned"`: Approximated but fast count algorithm. Uses the Postgres
154
- * statistics under the hood.
155
- *
156
- * `"estimated"`: Uses exact count for low numbers and planned count for high
157
- * numbers.
158
- *
159
- * @param options.defaultToNull - Make missing fields default to `null`.
160
- * Otherwise, use the default value for the column. This only applies when
161
- * inserting new rows, not when merging with existing rows under
162
- * `ignoreDuplicates: false`. This also only applies when doing bulk upserts.
163
- *
164
- * @example Upsert a single row using a unique key
165
- * ```ts
166
- * // Upserting a single row, overwriting based on the 'username' unique column
167
- * const { data, error } = await supabase
168
- * .from('users')
169
- * .upsert({ username: 'supabot' }, { onConflict: 'username' })
170
- *
171
- * // Example response:
172
- * // {
173
- * // data: [
174
- * // { id: 4, message: 'bar', username: 'supabot' }
175
- * // ],
176
- * // error: null
177
- * // }
178
- * ```
179
- *
180
- * @example Upsert with conflict resolution and exact row counting
181
- * ```ts
182
- * // Upserting and returning exact count
183
- * const { data, error, count } = await supabase
184
- * .from('users')
185
- * .upsert(
186
- * {
187
- * id: 3,
188
- * message: 'foo',
189
- * username: 'supabot'
190
- * },
191
- * {
192
- * onConflict: 'username',
193
- * count: 'exact'
194
- * }
195
- * )
196
- *
197
- * // Example response:
198
- * // {
199
- * // data: [
200
- * // {
201
- * // id: 42,
202
- * // handle: "saoirse",
203
- * // display_name: "Saoirse"
204
- * // }
205
- * // ],
206
- * // count: 1,
207
- * // error: null
208
- * // }
209
- * ```
210
- */
211
- upsert(values, { onConflict, ignoreDuplicates = false, count, defaultToNull = true, } = {}) {
212
- var _a;
213
- const method = 'POST';
214
- this.headers.append('Prefer', `resolution=${ignoreDuplicates ? 'ignore' : 'merge'}-duplicates`);
215
- if (onConflict !== undefined)
216
- this.url.searchParams.set('on_conflict', onConflict);
217
- if (count) {
218
- this.headers.append('Prefer', `count=${count}`);
219
- }
220
- if (!defaultToNull) {
221
- this.headers.append('Prefer', 'missing=default');
222
- }
223
- if (Array.isArray(values)) {
224
- const columns = values.reduce((acc, x) => acc.concat(Object.keys(x)), []);
225
- if (columns.length > 0) {
226
- const uniqueColumns = [...new Set(columns)].map((column) => `"${column}"`);
227
- this.url.searchParams.set('columns', uniqueColumns.join(','));
228
- }
229
- }
230
- return new PostgrestFilterBuilder_1.default({
231
- method,
232
- url: this.url,
233
- headers: this.headers,
234
- schema: this.schema,
235
- body: values,
236
- fetch: (_a = this.fetch) !== null && _a !== void 0 ? _a : fetch,
237
- });
238
- }
239
- /**
240
- * Perform an UPDATE on the table or view.
241
- *
242
- * By default, updated rows are not returned. To return it, chain the call
243
- * with `.select()` after filters.
244
- *
245
- * @param values - The values to update with
246
- *
247
- * @param options - Named parameters
248
- *
249
- * @param options.count - Count algorithm to use to count updated rows.
250
- *
251
- * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
252
- * hood.
253
- *
254
- * `"planned"`: Approximated but fast count algorithm. Uses the Postgres
255
- * statistics under the hood.
256
- *
257
- * `"estimated"`: Uses exact count for low numbers and planned count for high
258
- * numbers.
259
- */
260
- update(values, { count, } = {}) {
261
- var _a;
262
- const method = 'PATCH';
263
- if (count) {
264
- this.headers.append('Prefer', `count=${count}`);
265
- }
266
- return new PostgrestFilterBuilder_1.default({
267
- method,
268
- url: this.url,
269
- headers: this.headers,
270
- schema: this.schema,
271
- body: values,
272
- fetch: (_a = this.fetch) !== null && _a !== void 0 ? _a : fetch,
273
- });
274
- }
275
- /**
276
- * Perform a DELETE on the table or view.
277
- *
278
- * By default, deleted rows are not returned. To return it, chain the call
279
- * with `.select()` after filters.
280
- *
281
- * @param options - Named parameters
282
- *
283
- * @param options.count - Count algorithm to use to count deleted rows.
284
- *
285
- * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
286
- * hood.
287
- *
288
- * `"planned"`: Approximated but fast count algorithm. Uses the Postgres
289
- * statistics under the hood.
290
- *
291
- * `"estimated"`: Uses exact count for low numbers and planned count for high
292
- * numbers.
293
- */
294
- delete({ count, } = {}) {
295
- var _a;
296
- const method = 'DELETE';
297
- if (count) {
298
- this.headers.append('Prefer', `count=${count}`);
299
- }
300
- return new PostgrestFilterBuilder_1.default({
301
- method,
302
- url: this.url,
303
- headers: this.headers,
304
- schema: this.schema,
305
- fetch: (_a = this.fetch) !== null && _a !== void 0 ? _a : fetch,
306
- });
307
- }
308
- }
309
- exports.default = PostgrestQueryBuilder;
310
- //# sourceMappingURL=PostgrestQueryBuilder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PostgrestQueryBuilder.js","sourceRoot":"","sources":["../../src/PostgrestQueryBuilder.ts"],"names":[],"mappings":";;;AAAA,8FAA6D;AAU7D,MAAqB,qBAAqB;IAaxC;;;;;;;;;;;;OAYG;IACH,YACE,GAAQ,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KAAK,EAAE,CAAC;YACV,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,KAAK,EAAE,CAAC,CAAA;QACjD,CAAC;QAED,OAAO,IAAI,gCAAsB,CAAC;YAChC,MAAM;YACN,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,KAAK,EAAE,MAAA,IAAI,CAAC,KAAK,mCAAI,KAAK;SAC3B,CAAC,CAAA;IACJ,CAAC;CACF;AA7eD,wCA6eC"}
@@ -1,159 +0,0 @@
1
- import PostgrestBuilder from './PostgrestBuilder';
2
- import PostgrestFilterBuilder, { InvalidMethodError } from './PostgrestFilterBuilder';
3
- import { GetResult } from './select-query-parser/result';
4
- import { CheckMatchingArrayTypes } from './types/types';
5
- import { ClientServerOptions, GenericSchema } from './types/common/common';
6
- import type { MaxAffectedEnabled } from './types/feature-flags';
7
- export default class PostgrestTransformBuilder<ClientOptions extends ClientServerOptions, Schema extends GenericSchema, Row extends Record<string, unknown>, Result, RelationName = unknown, Relationships = unknown, Method = unknown> extends PostgrestBuilder<ClientOptions, Result> {
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<Query extends string = '*', NewResultOne = GetResult<Schema, Row, RelationName, Relationships, Query, ClientOptions>>(columns?: Query): PostgrestFilterBuilder<ClientOptions, Schema, Row, Method extends 'RPC' ? Result extends unknown[] ? NewResultOne[] : NewResultOne : NewResultOne[], RelationName, Relationships, Method>;
18
- order<ColumnName extends string & keyof Row>(column: ColumnName, options?: {
19
- ascending?: boolean;
20
- nullsFirst?: boolean;
21
- referencedTable?: undefined;
22
- }): this;
23
- order(column: string, options?: {
24
- ascending?: boolean;
25
- nullsFirst?: boolean;
26
- referencedTable?: string;
27
- }): this;
28
- /**
29
- * @deprecated Use `options.referencedTable` instead of `options.foreignTable`
30
- */
31
- order<ColumnName extends string & keyof Row>(column: ColumnName, options?: {
32
- ascending?: boolean;
33
- nullsFirst?: boolean;
34
- foreignTable?: undefined;
35
- }): this;
36
- /**
37
- * @deprecated Use `options.referencedTable` instead of `options.foreignTable`
38
- */
39
- order(column: string, options?: {
40
- ascending?: boolean;
41
- nullsFirst?: boolean;
42
- foreignTable?: string;
43
- }): this;
44
- /**
45
- * Limit the query result by `count`.
46
- *
47
- * @param count - The maximum number of rows to return
48
- * @param options - Named parameters
49
- * @param options.referencedTable - Set this to limit rows of referenced
50
- * tables instead of the parent table
51
- * @param options.foreignTable - Deprecated, use `options.referencedTable`
52
- * instead
53
- */
54
- limit(count: number, { foreignTable, referencedTable, }?: {
55
- foreignTable?: string;
56
- referencedTable?: string;
57
- }): this;
58
- /**
59
- * Limit the query result by starting at an offset `from` and ending at the offset `to`.
60
- * Only records within this range are returned.
61
- * This respects the query order and if there is no order clause the range could behave unexpectedly.
62
- * The `from` and `to` values are 0-based and inclusive: `range(1, 3)` will include the second, third
63
- * and fourth rows of the query.
64
- *
65
- * @param from - The starting index from which to limit the result
66
- * @param to - The last index to which to limit the result
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
- range(from: number, to: number, { foreignTable, referencedTable, }?: {
74
- foreignTable?: string;
75
- referencedTable?: string;
76
- }): this;
77
- /**
78
- * Set the AbortSignal for the fetch request.
79
- *
80
- * @param signal - The AbortSignal to use for the fetch request
81
- */
82
- abortSignal(signal: AbortSignal): this;
83
- /**
84
- * Return `data` as a single object instead of an array of objects.
85
- *
86
- * Query result must be one row (e.g. using `.limit(1)`), otherwise this
87
- * returns an error.
88
- */
89
- single<ResultOne = Result extends (infer ResultOne)[] ? ResultOne : never>(): PostgrestBuilder<ClientOptions, ResultOne>;
90
- /**
91
- * Return `data` as a single object instead of an array of objects.
92
- *
93
- * Query result must be zero or one row (e.g. using `.limit(1)`), otherwise
94
- * this returns an error.
95
- */
96
- maybeSingle<ResultOne = Result extends (infer ResultOne)[] ? ResultOne : never>(): PostgrestBuilder<ClientOptions, ResultOne | null>;
97
- /**
98
- * Return `data` as a string in CSV format.
99
- */
100
- csv(): PostgrestBuilder<ClientOptions, string>;
101
- /**
102
- * Return `data` as an object in [GeoJSON](https://geojson.org) format.
103
- */
104
- geojson(): PostgrestBuilder<ClientOptions, Record<string, unknown>>;
105
- /**
106
- * Return `data` as the EXPLAIN plan for the query.
107
- *
108
- * You need to enable the
109
- * [db_plan_enabled](https://supabase.com/docs/guides/database/debugging-performance#enabling-explain)
110
- * setting before using this method.
111
- *
112
- * @param options - Named parameters
113
- *
114
- * @param options.analyze - If `true`, the query will be executed and the
115
- * actual run time will be returned
116
- *
117
- * @param options.verbose - If `true`, the query identifier will be returned
118
- * and `data` will include the output columns of the query
119
- *
120
- * @param options.settings - If `true`, include information on configuration
121
- * parameters that affect query planning
122
- *
123
- * @param options.buffers - If `true`, include information on buffer usage
124
- *
125
- * @param options.wal - If `true`, include information on WAL record generation
126
- *
127
- * @param options.format - The format of the output, can be `"text"` (default)
128
- * or `"json"`
129
- */
130
- explain({ analyze, verbose, settings, buffers, wal, format, }?: {
131
- analyze?: boolean;
132
- verbose?: boolean;
133
- settings?: boolean;
134
- buffers?: boolean;
135
- wal?: boolean;
136
- format?: 'json' | 'text';
137
- }): PostgrestBuilder<ClientOptions, string, false> | PostgrestBuilder<ClientOptions, Record<string, unknown>[], false>;
138
- /**
139
- * Rollback the query.
140
- *
141
- * `data` will still be returned, but the query is not committed.
142
- */
143
- rollback(): this;
144
- /**
145
- * Override the type of the returned `data`.
146
- *
147
- * @typeParam NewResult - The new result type to override with
148
- * @deprecated Use overrideTypes<yourType, { merge: false }>() method at the end of your call chain instead
149
- */
150
- returns<NewResult>(): PostgrestTransformBuilder<ClientOptions, Schema, Row, CheckMatchingArrayTypes<Result, NewResult>, RelationName, Relationships, Method>;
151
- /**
152
- * Set the maximum number of rows that can be affected by the query.
153
- * Only available in PostgREST v13+ and only works with PATCH and DELETE methods.
154
- *
155
- * @param value - The maximum number of rows that can be affected
156
- */
157
- maxAffected(value: number): MaxAffectedEnabled<ClientOptions['PostgrestVersion']> extends true ? Method extends 'PATCH' | 'DELETE' | 'RPC' ? this : InvalidMethodError<'maxAffected method only available on update or delete'> : InvalidMethodError<'maxAffected method only available on postgrest 13+'>;
158
- }
159
- //# sourceMappingURL=PostgrestTransformBuilder.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PostgrestTransformBuilder.d.ts","sourceRoot":"","sources":["../../src/PostgrestTransformBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,oBAAoB,CAAA;AACjD,OAAO,sBAAsB,EAAE,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AACrF,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AACvD,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAE/D,MAAM,CAAC,OAAO,OAAO,yBAAyB,CAC5C,aAAa,SAAS,mBAAmB,EACzC,MAAM,SAAS,aAAa,EAC5B,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnC,MAAM,EACN,YAAY,GAAG,OAAO,EACtB,aAAa,GAAG,OAAO,EACvB,MAAM,GAAG,OAAO,CAChB,SAAQ,gBAAgB,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/C;;;;;;;;OAQG;IACH,MAAM,CACJ,KAAK,SAAS,MAAM,GAAG,GAAG,EAC1B,YAAY,GAAG,SAAS,CAAC,MAAM,E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