@freehour/supabase-core 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -45,7 +45,7 @@ class x extends k {
45
45
  super(t, a), this.expression = e, this.format = r;
46
46
  }
47
47
  }
48
- class $ extends k {
48
+ class _ extends k {
49
49
  /**
50
50
  * The schema where the record was expected to be found.
51
51
  */
@@ -83,21 +83,21 @@ class I extends Error {
83
83
  super(t, a), this.value = e, this.supported = r;
84
84
  }
85
85
  }
86
- const _ = m.object({
86
+ const $ = m.object({
87
87
  code: m.string(),
88
88
  details: m.string().nullable(),
89
89
  hint: m.string().nullable(),
90
90
  name: m.string().optional(),
91
91
  message: m.string().optional()
92
92
  });
93
- function G(s) {
94
- return s instanceof P || _.safeParse(s).success;
93
+ function H(s) {
94
+ return s instanceof P || $.safeParse(s).success;
95
95
  }
96
- const v = ["eq", "neq", "gt", "gte", "lt", "lte", "like", "ilike", "match", "imatch", "in", "is", "isdistinct", "fts", "plfts", "phfts", "wfts", "cs", "cd", "ov", "sl", "sr", "nxr", "nxl", "adj"], H = ["and", "or"], J = ",", O = "~", Q = (s) => (t = {}) => {
96
+ const v = ["eq", "neq", "gt", "gte", "lt", "lte", "like", "ilike", "match", "imatch", "in", "is", "isdistinct", "fts", "plfts", "phfts", "wfts", "cs", "cd", "ov", "sl", "sr", "nxr", "nxl", "adj"], J = ["and", "or"], Q = ",", O = "~", X = (s) => (t = {}) => {
97
97
  const e = (a) => t[a] ?? a, r = Object.keys(s.shape);
98
98
  return m.string().transform((a, n) => {
99
99
  try {
100
- return M(a, r, e);
100
+ return L(a, r, e);
101
101
  } catch (i) {
102
102
  return n.addIssue({
103
103
  code: "custom",
@@ -127,7 +127,7 @@ function q(s, t = (e) => e) {
127
127
  }
128
128
  return `${t(s.key)}.${s.op}.${s.value}`;
129
129
  }
130
- function L(s, t = (r) => r, e = O) {
130
+ function D(s, t = (r) => r, e = O) {
131
131
  return s.map((r) => q(r, t)).join(e);
132
132
  }
133
133
  function y(s, t = [], e = (r) => r) {
@@ -182,14 +182,14 @@ function y(s, t = [], e = (r) => r) {
182
182
  value: l.defined(d)
183
183
  };
184
184
  }
185
- function M(s, t = [], e = (a) => a, r = O) {
185
+ function L(s, t = [], e = (a) => a, r = O) {
186
186
  return s.length === 0 ? [] : s.split(r).map((a) => y(a, t, e));
187
187
  }
188
- function A(s, t = "/") {
188
+ function M(s, t = "/") {
189
189
  const e = s.lastIndexOf(t);
190
190
  return e === -1 ? ["", s] : [s.substring(0, e), s.substring(e + 1)];
191
191
  }
192
- function D(s) {
192
+ function A(s) {
193
193
  return Array.isArray(s) ? s : [s];
194
194
  }
195
195
  function z(s, t) {
@@ -214,44 +214,47 @@ const w = {
214
214
  * @example
215
215
  * const table = supabase.schema('public').from('my_table');
216
216
  * const {data, error} = await postgrestExtensions.query.enable(table)
217
- * .selectColumns(['id', 'name'])
217
+ * .select(['id', 'name'])
218
218
  * .then(({data}) => console.log(data)); // [{ id: 1, name: 'John' }, ...]
219
219
  */
220
220
  query: {
221
- enable: (s) => Object.assign(s, {
222
- /**
223
- * Selects columns from the relation.
224
- *
225
- * @param columns The array of column names to select, or '*' to select all columns.
226
- * @param options The options for the selection, such as count.
227
- * @returns The PostgREST filter builder with selection applied and filter extension enabled.
228
- */
229
- select: (t, e) => w.filter.enable(
230
- s.select(
231
- D(t).join(","),
232
- e
221
+ enable: (s) => Object.assign(
222
+ s,
223
+ {
224
+ /**
225
+ * Selects columns from the relation.
226
+ *
227
+ * @param columns The array of column names to select, or '*' to select all columns.
228
+ * @param options The options for the selection, such as count.
229
+ * @returns The PostgREST filter builder with selection applied and filter extension enabled.
230
+ */
231
+ select: (t, e) => w.filter.enable(
232
+ s.select(
233
+ A(t).join(","),
234
+ e
235
+ )
236
+ ),
237
+ /**
238
+ * Counts the number of rows in the relation.
239
+ * Does not select any columns, only counts the rows.
240
+ *
241
+ * @param method The counting method to use, defaults to 'exact'.
242
+ * @returns The PostgREST filter builder with counting applied and filter extension enabled.
243
+ */
244
+ count: (t = "exact") => w.filter.enable(
245
+ s.select("*", { count: t, head: !0 })
246
+ ),
247
+ /**
248
+ * Deletes rows from the relation.
249
+ * Returns a filter builder for further filtering before deletion.
250
+ *
251
+ * @returns The PostgREST filter builder with delete applied and filter extension enabled.
252
+ */
253
+ delete: () => w.filter.enable(
254
+ s.delete()
233
255
  )
234
- ),
235
- /**
236
- * Counts the number of rows in the relation.
237
- * Does not select any columns, only counts the rows.
238
- *
239
- * @param method The counting method to use, defaults to 'exact'.
240
- * @returns The PostgREST filter builder with counting applied and filter extension enabled.
241
- */
242
- count: (t = "exact") => w.filter.enable(
243
- s.select("*", { count: t, head: !0 })
244
- ),
245
- /**
246
- * Deletes rows from the relation.
247
- * Returns a filter builder for further filtering before deletion.
248
- *
249
- * @returns The PostgREST filter builder with delete applied and filter extension enabled.
250
- */
251
- delete: () => w.filter.enable(
252
- s.delete()
253
- )
254
- })
256
+ }
257
+ )
255
258
  },
256
259
  /**
257
260
  * Filter extension for PostgREST queries.
@@ -261,78 +264,81 @@ const w = {
261
264
  * @example
262
265
  * const selection = supabase.schema('public').from('my_table').select('*', { count: 'exact' });
263
266
  * const {data, error} = await postgrestExtensions.filter.enable(selection)
264
- * .apply({ key: 'name', op: 'eq', value: 'John' })
267
+ * .filter({ key: 'name', op: 'eq', value: 'John' })
265
268
  * .paginate(1, 10)
266
269
  * .collect();
267
270
  */
268
271
  filter: {
269
- enable: (s, t = {}) => Object.assign(s, {
270
- /**
271
- * Applies a filter to the query.
272
- * A filter is defined as an array of AST filter nodes including conditions and logical operators.
273
- * @param filter The filter to apply.
274
- */
275
- apply: (e) => w.filter.enable(
276
- (() => {
277
- function r(a, n) {
278
- if (n.type === "logical") {
279
- const i = L(n.args, (c) => c, ",");
280
- return n.op === "or" ? a.or(i) : n.op === "not.or" ? a.or(i, { referencedTable: "not" }) : r(a, {
281
- type: "logical",
282
- op: n.op === "and" ? "not.or" : "or",
283
- args: n.args.map(N)
284
- });
272
+ enable: (s, t = {}) => Object.assign(
273
+ s,
274
+ {
275
+ /**
276
+ * Applies a filter to the query.
277
+ * A filter is defined as an AST of filter nodes including conditions and logical operators.
278
+ * @param node The filter to apply.
279
+ */
280
+ filter: (e) => w.filter.enable(
281
+ (() => {
282
+ function r(a, n) {
283
+ if (n.type === "logical") {
284
+ const i = D(n.args, (c) => c, ",");
285
+ return n.op === "or" ? a.or(i) : n.op === "not.or" ? a.or(i, { referencedTable: "not" }) : r(a, {
286
+ type: "logical",
287
+ op: n.op === "and" ? "not.or" : "or",
288
+ args: n.args.map(N)
289
+ });
290
+ }
291
+ return a.filter(n.key, n.op, n.value);
292
+ }
293
+ return r(s, e);
294
+ })(),
295
+ t
296
+ ),
297
+ /**
298
+ * Limits the range of results to a specific page given a page index and limit.
299
+ * @param page The page index (0-based).
300
+ * @param limit The number of items per page.
301
+ * @param count Optional count of total items, if known.
302
+ * If provided, it will be used to check if the pagination range is valid and resolve to an empty range if not.
303
+ */
304
+ paginate: (e, r, a) => w.filter.enable(
305
+ (() => {
306
+ l(e >= 0, "Page index must be ≥ 0"), l(r >= 0, "Page limit must be ≥ 0");
307
+ const n = e * r, i = n + r - 1;
308
+ if (a !== void 0) {
309
+ if (n >= a)
310
+ return s.limit(0);
311
+ if (i >= a)
312
+ return s.range(n, a - 1);
313
+ }
314
+ return s.range(n, i);
315
+ })(),
316
+ {
317
+ ...t,
318
+ pagination: {
319
+ page: e,
320
+ limit: r,
321
+ count: a
285
322
  }
286
- return a.filter(n.key, n.op, n.value);
287
- }
288
- return e.reduce(r, s);
289
- })(),
290
- t
291
- ),
292
- /**
293
- * Limits the range of results to a specific page given a page index and limit.
294
- * @param page The page index (0-based).
295
- * @param limit The number of items per page.
296
- * @param count Optional count of total items, if known.
297
- * If provided, it will be used to check if the pagination range is valid and resolve to an empty range if not.
298
- */
299
- paginate: (e, r, a) => w.filter.enable(
300
- (() => {
301
- l(e >= 0, "Page index must be ≥ 0"), l(r >= 0, "Page limit must be ≥ 0");
302
- const n = e * r, i = n + r - 1;
303
- if (a !== void 0) {
304
- if (n >= a)
305
- return s.limit(0);
306
- if (i >= a)
307
- return s.range(n, a - 1);
308
- }
309
- return s.range(n, i);
310
- })(),
311
- {
312
- ...t,
313
- pagination: {
314
- page: e,
315
- limit: r,
316
- count: a
317
323
  }
318
- }
319
- ),
320
- /**
321
- * Collects the results of a pagination query.
322
- * **Note:** For collect to work, paginate() must be called before collect() and the selection must include a `count`.
323
- * @returns The paginated list of queried items.
324
- */
325
- collect: () => s.throwOnError().then((e) => {
326
- const { data: r, count: a } = e, { page: n, limit: i, ...c } = l.defined(t.pagination, "Pagination context is required for collect(). Make sure to call paginate() before collect()"), o = a ?? c.count;
327
- return l(i > 0, "Page limit must be > 0"), l(Array.isArray(r), "Data must be an array for pagination, make sure to select multiple rows in query"), l(o !== void 0, "Row count is required for pagination, make sure to count in query or pass `count` in paginate()"), {
328
- items: r,
329
- totalItems: o,
330
- page: n,
331
- totalPages: Math.ceil(o / i),
332
- limit: i
333
- };
334
- })
335
- })
324
+ ),
325
+ /**
326
+ * Collects the results of a pagination query.
327
+ * **Note:** For collect to work, paginate() must be called before collect() and the selection must include a `count`.
328
+ * @returns The paginated list of queried items.
329
+ */
330
+ collect: () => s.throwOnError().then((e) => {
331
+ const { data: r, count: a } = e, { page: n, limit: i, ...c } = l.defined(t.pagination, "Pagination context is required for collect(). Make sure to call paginate() before collect()"), o = a ?? c.count;
332
+ return l(i > 0, "Page limit must be > 0"), l(Array.isArray(r), "Data must be an array for pagination, make sure to select multiple rows in query"), l(o !== void 0, "Row count is required for pagination, make sure to count in query or pass `count` in paginate()"), {
333
+ items: r,
334
+ totalItems: o,
335
+ page: n,
336
+ totalPages: Math.ceil(o / i),
337
+ limit: i
338
+ };
339
+ })
340
+ }
341
+ )
336
342
  }
337
343
  };
338
344
  class F {
@@ -353,7 +359,7 @@ class F {
353
359
  this.database = t, this.schema = e, this.relation = r;
354
360
  }
355
361
  recordNotFoundError(t) {
356
- return new $(`Record with id ${t} not found in ${this.schema}.${this.relation}`, {
362
+ return new _(`Record with id ${t} not found in ${this.schema}.${this.relation}`, {
357
363
  schema: this.schema,
358
364
  relation: this.relation,
359
365
  id: t
@@ -512,24 +518,18 @@ class U extends F {
512
518
  });
513
519
  }
514
520
  }
515
- function X(s) {
521
+ function Y(s) {
516
522
  if (s.error)
517
523
  throw s.error;
518
524
  return l(s.count !== null, "Response does not contain a count. Make sure to set the `count` option in the request."), s;
519
525
  }
520
- class Y {
526
+ class B {
521
527
  supabase;
522
528
  constructor({ supabase: t }) {
523
529
  this.supabase = t;
524
530
  }
525
- get schema() {
526
- return this.supabase.schema.bind(this.supabase);
527
- }
528
- get rpc() {
529
- return this.supabase.rpc.bind(this.supabase);
530
- }
531
- get from() {
532
- return this.supabase.from.bind(this.supabase);
531
+ schema(t) {
532
+ return this.supabase.schema(t);
533
533
  }
534
534
  relation(t, e) {
535
535
  return new F({
@@ -553,7 +553,8 @@ class Y {
553
553
  });
554
554
  }
555
555
  }
556
- class K {
556
+ const K = B;
557
+ class tt {
557
558
  preprocesses = [];
558
559
  storage;
559
560
  constructor({
@@ -631,7 +632,7 @@ class K {
631
632
  )).filter((n) => n !== null);
632
633
  }
633
634
  }
634
- const tt = {
635
+ const et = {
635
636
  removeImagesFromMarkdown: {
636
637
  name: "removeImagesFromMarkdown",
637
638
  run(s, t) {
@@ -653,7 +654,7 @@ const tt = {
653
654
  }
654
655
  }
655
656
  };
656
- class et {
657
+ class rt {
657
658
  client;
658
659
  database;
659
660
  constructor({
@@ -742,7 +743,7 @@ class et {
742
743
  const { fileId: e, bucket: r, path: a, properties: n } = await this.getFileInfo(t), { data: i, error: c } = await this.client.from(r).download(a);
743
744
  if (c)
744
745
  throw c;
745
- const [, o] = A(a);
746
+ const [, o] = M(a);
746
747
  return {
747
748
  fileId: e,
748
749
  bucket: r,
@@ -775,35 +776,35 @@ class et {
775
776
  }
776
777
  export {
777
778
  F as DataService,
778
- Y as DatabaseService,
779
- K as EmbeddingService,
779
+ K as DatabaseService,
780
+ tt as EmbeddingService,
780
781
  E as FileNotFoundError,
781
- Q as Filter,
782
+ X as Filter,
782
783
  O as FilterChainSeparator,
783
784
  v as FilterOp,
784
- H as LogicalOp,
785
- J as LogicalOpSeparator,
785
+ J as LogicalOp,
786
+ Q as LogicalOpSeparator,
786
787
  x as ParseError,
787
- _ as PostgrestErrorInterface,
788
- $ as RecordNotFoundError,
789
- et as StorageService,
788
+ $ as PostgrestErrorInterface,
789
+ _ as RecordNotFoundError,
790
+ rt as StorageService,
790
791
  C as TableDataService,
791
792
  k as TracedError,
792
793
  I as UnsupportedMimeError,
793
794
  U as ViewDataService,
794
- X as assertCounted,
795
- D as coerceArray,
796
- L as encodeFilter,
795
+ Y as assertCounted,
796
+ A as coerceArray,
797
+ D as encodeFilter,
797
798
  q as encodeFilterNode,
798
799
  W as entries,
799
800
  z as groupBy,
800
- G as isDatabaseApiError,
801
+ H as isDatabaseApiError,
801
802
  N as negateFilterNode,
802
803
  j as negateOp,
803
804
  y as parseFilterExpression,
804
- M as parseFilterExpressionChain,
805
+ L as parseFilterExpressionChain,
805
806
  w as postgrestExtensions,
806
- tt as preprocessingSteps,
807
+ et as preprocessingSteps,
807
808
  T as removeElement,
808
- A as splitPath
809
+ M as splitPath
809
810
  };
@@ -1,8 +1,8 @@
1
1
  import { PostgrestClientOptions, PostgrestFilterBuilder, PostgrestQueryBuilder, UnstableGetResult } from '@supabase/postgrest-js';
2
2
  import { GenericSchema, GenericTable, GenericView } from './database';
3
- import { Filter } from './filter';
3
+ import { FilterNode } from './filter';
4
4
  import { CountMethod, Select, SelectColumns, SelectOptions } from './select';
5
- import { ElementOf } from './utils';
5
+ import { ElementOf, OmitFrom } from './utils';
6
6
  /**
7
7
  * Paginated list of items with pagination info.
8
8
  */
@@ -31,7 +31,7 @@ interface PostgrestFilterExtensionContext {
31
31
  * @example
32
32
  * const selection = supabase.schema('public').from('my_table').select('*', { count: 'exact' });
33
33
  * const {data, error} = await postgrestExtensions.filter.enable(selection)
34
- * .apply({ key: 'name', op: 'eq', value: 'John' })
34
+ * .filter({ key: 'name', op: 'eq', value: 'John' })
35
35
  * .paginate(1, 10)
36
36
  * .collect();
37
37
  */
@@ -44,13 +44,13 @@ export declare const postgrestExtensions: {
44
44
  * @example
45
45
  * const table = supabase.schema('public').from('my_table');
46
46
  * const {data, error} = await postgrestExtensions.query.enable(table)
47
- * .selectColumns(['id', 'name'])
47
+ * .select(['id', 'name'])
48
48
  * .then(({data}) => console.log(data)); // [{ id: 1, name: 'John' }, ...]
49
49
  */
50
50
  readonly query: {
51
51
  readonly enable: <ClientOptions extends PostgrestClientOptions, Schema extends GenericSchema, Relation extends GenericTable | GenericView, RelationName = unknown, Relationships = Relation extends {
52
52
  Relationships: infer R;
53
- } ? R : unknown>(builder: PostgrestQueryBuilder<ClientOptions, Schema, Relation, RelationName, Relationships>) => PostgrestQueryBuilder<ClientOptions, Schema, Relation, RelationName, Relationships> & {
53
+ } ? R : unknown>(builder: PostgrestQueryBuilder<ClientOptions, Schema, Relation, RelationName, Relationships>) => OmitFrom<PostgrestQueryBuilder<ClientOptions, Schema, Relation, RelationName, Relationships>, "select" | "delete"> & {
54
54
  /**
55
55
  * Selects columns from the relation.
56
56
  *
@@ -58,13 +58,13 @@ export declare const postgrestExtensions: {
58
58
  * @param options The options for the selection, such as count.
59
59
  * @returns The PostgREST filter builder with selection applied and filter extension enabled.
60
60
  */
61
- select: <Columns extends SelectColumns<Relation["Row"]>>(columns: Columns, options?: SelectOptions) => PostgrestFilterBuilder<ClientOptions, Schema, Relation["Row"], Select<Relation["Row"], Columns>[], RelationName, Relationships, "GET"> & {
61
+ select: <Columns extends SelectColumns<Relation["Row"]>>(columns: Columns, options?: SelectOptions) => OmitFrom<PostgrestFilterBuilder<ClientOptions, Schema, Relation["Row"], Select<Relation["Row"], Columns>[], RelationName, Relationships, "GET">, "filter"> & {
62
62
  /**
63
63
  * Applies a filter to the query.
64
- * A filter is defined as an array of AST filter nodes including conditions and logical operators.
65
- * @param filter The filter to apply.
64
+ * A filter is defined as an AST of filter nodes including conditions and logical operators.
65
+ * @param node The filter to apply.
66
66
  */
67
- apply: <K extends string = string>(filter: Filter<K>) => PostgrestFilterBuilder<ClientOptions, Schema, Relation["Row"], Select<Relation["Row"], Columns>[], RelationName, Relationships, "GET"> & /*elided*/ any;
67
+ filter: <K extends string = string>(node: FilterNode<K>) => OmitFrom<PostgrestFilterBuilder<ClientOptions, Schema, Relation["Row"], Select<Relation["Row"], Columns>[], RelationName, Relationships, "GET">, "filter"> & /*elided*/ any;
68
68
  /**
69
69
  * Limits the range of results to a specific page given a page index and limit.
70
70
  * @param page The page index (0-based).
@@ -72,7 +72,7 @@ export declare const postgrestExtensions: {
72
72
  * @param count Optional count of total items, if known.
73
73
  * If provided, it will be used to check if the pagination range is valid and resolve to an empty range if not.
74
74
  */
75
- paginate: (page: number, limit: number, count?: number) => PostgrestFilterBuilder<ClientOptions, Schema, Relation["Row"], Select<Relation["Row"], Columns>[], RelationName, Relationships, "GET"> & /*elided*/ any;
75
+ paginate: (page: number, limit: number, count?: number) => OmitFrom<PostgrestFilterBuilder<ClientOptions, Schema, Relation["Row"], Select<Relation["Row"], Columns>[], RelationName, Relationships, "GET">, "filter"> & /*elided*/ any;
76
76
  /**
77
77
  * Collects the results of a pagination query.
78
78
  * **Note:** For collect to work, paginate() must be called before collect() and the selection must include a `count`.
@@ -87,13 +87,13 @@ export declare const postgrestExtensions: {
87
87
  * @param method The counting method to use, defaults to 'exact'.
88
88
  * @returns The PostgREST filter builder with counting applied and filter extension enabled.
89
89
  */
90
- count: (method?: CountMethod) => PostgrestFilterBuilder<ClientOptions, Schema, Relation["Row"], UnstableGetResult<Schema, Relation["Row"], RelationName, Relationships, "*", ClientOptions>[], RelationName, Relationships, "GET"> & {
90
+ count: (method?: CountMethod) => OmitFrom<PostgrestFilterBuilder<ClientOptions, Schema, Relation["Row"], UnstableGetResult<Schema, Relation["Row"], RelationName, Relationships, "*", ClientOptions>[], RelationName, Relationships, "GET">, "filter"> & {
91
91
  /**
92
92
  * Applies a filter to the query.
93
- * A filter is defined as an array of AST filter nodes including conditions and logical operators.
94
- * @param filter The filter to apply.
93
+ * A filter is defined as an AST of filter nodes including conditions and logical operators.
94
+ * @param node The filter to apply.
95
95
  */
96
- apply: <K extends string = string>(filter: Filter<K>) => PostgrestFilterBuilder<ClientOptions, Schema, Relation["Row"], UnstableGetResult<Schema, Relation["Row"], RelationName, Relationships, "*", ClientOptions>[], RelationName, Relationships, "GET"> & /*elided*/ any;
96
+ filter: <K extends string = string>(node: FilterNode<K>) => OmitFrom<PostgrestFilterBuilder<ClientOptions, Schema, Relation["Row"], UnstableGetResult<Schema, Relation["Row"], RelationName, Relationships, "*", ClientOptions>[], RelationName, Relationships, "GET">, "filter"> & /*elided*/ any;
97
97
  /**
98
98
  * Limits the range of results to a specific page given a page index and limit.
99
99
  * @param page The page index (0-based).
@@ -101,7 +101,7 @@ export declare const postgrestExtensions: {
101
101
  * @param count Optional count of total items, if known.
102
102
  * If provided, it will be used to check if the pagination range is valid and resolve to an empty range if not.
103
103
  */
104
- paginate: (page: number, limit: number, count?: number) => PostgrestFilterBuilder<ClientOptions, Schema, Relation["Row"], UnstableGetResult<Schema, Relation["Row"], RelationName, Relationships, "*", ClientOptions>[], RelationName, Relationships, "GET"> & /*elided*/ any;
104
+ paginate: (page: number, limit: number, count?: number) => OmitFrom<PostgrestFilterBuilder<ClientOptions, Schema, Relation["Row"], UnstableGetResult<Schema, Relation["Row"], RelationName, Relationships, "*", ClientOptions>[], RelationName, Relationships, "GET">, "filter"> & /*elided*/ any;
105
105
  /**
106
106
  * Collects the results of a pagination query.
107
107
  * **Note:** For collect to work, paginate() must be called before collect() and the selection must include a `count`.
@@ -115,13 +115,13 @@ export declare const postgrestExtensions: {
115
115
  *
116
116
  * @returns The PostgREST filter builder with delete applied and filter extension enabled.
117
117
  */
118
- delete: () => PostgrestFilterBuilder<ClientOptions, Schema, Relation["Row"], null, RelationName, Relationships, "DELETE"> & {
118
+ delete: () => OmitFrom<PostgrestFilterBuilder<ClientOptions, Schema, Relation["Row"], null, RelationName, Relationships, "DELETE">, "filter"> & {
119
119
  /**
120
120
  * Applies a filter to the query.
121
- * A filter is defined as an array of AST filter nodes including conditions and logical operators.
122
- * @param filter The filter to apply.
121
+ * A filter is defined as an AST of filter nodes including conditions and logical operators.
122
+ * @param node The filter to apply.
123
123
  */
124
- apply: <K extends string = string>(filter: Filter<K>) => PostgrestFilterBuilder<ClientOptions, Schema, Relation["Row"], null, RelationName, Relationships, "DELETE"> & /*elided*/ any;
124
+ filter: <K extends string = string>(node: FilterNode<K>) => OmitFrom<PostgrestFilterBuilder<ClientOptions, Schema, Relation["Row"], null, RelationName, Relationships, "DELETE">, "filter"> & /*elided*/ any;
125
125
  /**
126
126
  * Limits the range of results to a specific page given a page index and limit.
127
127
  * @param page The page index (0-based).
@@ -129,7 +129,7 @@ export declare const postgrestExtensions: {
129
129
  * @param count Optional count of total items, if known.
130
130
  * If provided, it will be used to check if the pagination range is valid and resolve to an empty range if not.
131
131
  */
132
- paginate: (page: number, limit: number, count?: number) => PostgrestFilterBuilder<ClientOptions, Schema, Relation["Row"], null, RelationName, Relationships, "DELETE"> & /*elided*/ any;
132
+ paginate: (page: number, limit: number, count?: number) => OmitFrom<PostgrestFilterBuilder<ClientOptions, Schema, Relation["Row"], null, RelationName, Relationships, "DELETE">, "filter"> & /*elided*/ any;
133
133
  /**
134
134
  * Collects the results of a pagination query.
135
135
  * **Note:** For collect to work, paginate() must be called before collect() and the selection must include a `count`.
@@ -147,18 +147,18 @@ export declare const postgrestExtensions: {
147
147
  * @example
148
148
  * const selection = supabase.schema('public').from('my_table').select('*', { count: 'exact' });
149
149
  * const {data, error} = await postgrestExtensions.filter.enable(selection)
150
- * .apply({ key: 'name', op: 'eq', value: 'John' })
150
+ * .filter({ key: 'name', op: 'eq', value: 'John' })
151
151
  * .paginate(1, 10)
152
152
  * .collect();
153
153
  */
154
154
  readonly filter: {
155
- readonly enable: <ClientOptions extends PostgrestClientOptions, Schema extends GenericSchema, Row extends Record<string, unknown>, Result, RelationName = unknown, Relationships = unknown, Method = unknown>(builder: PostgrestFilterBuilder<ClientOptions, Schema, Row, Result, RelationName, Relationships, Method>, context?: PostgrestFilterExtensionContext) => PostgrestFilterBuilder<ClientOptions, Schema, Row, Result, RelationName, Relationships, Method> & {
155
+ readonly enable: <ClientOptions extends PostgrestClientOptions, Schema extends GenericSchema, Row extends Record<string, unknown>, Result, RelationName = unknown, Relationships = unknown, Method = unknown>(builder: PostgrestFilterBuilder<ClientOptions, Schema, Row, Result, RelationName, Relationships, Method>, context?: PostgrestFilterExtensionContext) => OmitFrom<PostgrestFilterBuilder<ClientOptions, Schema, Row, Result, RelationName, Relationships, Method>, "filter"> & {
156
156
  /**
157
157
  * Applies a filter to the query.
158
- * A filter is defined as an array of AST filter nodes including conditions and logical operators.
159
- * @param filter The filter to apply.
158
+ * A filter is defined as an AST of filter nodes including conditions and logical operators.
159
+ * @param node The filter to apply.
160
160
  */
161
- apply: <K extends string = string>(filter: Filter<K>) => PostgrestFilterBuilder<ClientOptions, Schema, Row, Result, RelationName, Relationships, Method> & /*elided*/ any;
161
+ filter: <K extends string = string>(node: FilterNode<K>) => OmitFrom<PostgrestFilterBuilder<ClientOptions, Schema, Row, Result, RelationName, Relationships, Method>, "filter"> & /*elided*/ any;
162
162
  /**
163
163
  * Limits the range of results to a specific page given a page index and limit.
164
164
  * @param page The page index (0-based).
@@ -166,7 +166,7 @@ export declare const postgrestExtensions: {
166
166
  * @param count Optional count of total items, if known.
167
167
  * If provided, it will be used to check if the pagination range is valid and resolve to an empty range if not.
168
168
  */
169
- paginate: (page: number, limit: number, count?: number) => PostgrestFilterBuilder<ClientOptions, Schema, Row, Result, RelationName, Relationships, Method> & /*elided*/ any;
169
+ paginate: (page: number, limit: number, count?: number) => OmitFrom<PostgrestFilterBuilder<ClientOptions, Schema, Row, Result, RelationName, Relationships, Method>, "filter"> & /*elided*/ any;
170
170
  /**
171
171
  * Collects the results of a pagination query.
172
172
  * **Note:** For collect to work, paginate() must be called before collect() and the selection must include a `count`.
@@ -1 +1 @@
1
- {"version":3,"file":"postgrest-extensions.d.ts","sourceRoot":"","sources":["../lib/postgrest-extensions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,qBAAqB,EAA4B,MAAM,wBAAwB,CAAC;AAE9I,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC3E,OAAO,KAAK,EAAE,MAAM,EAAc,MAAM,UAAU,CAAC;AAEnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAClF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGzC;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,IAAI;IAC/B,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,UAAU,+BAA+B;IACrC,UAAU,CAAC,EAAE;QACT,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACL;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB;IAC5B;;;;;;;;;;OAUG;;0BAGK,aAAa,SAAS,sBAAsB,EAC5C,MAAM,SAAS,aAAa,EAC5B,QAAQ,SAAS,YAAY,GAAG,WAAW,EAC3C,YAAY,YACZ,aAAa;2BAAqC,MAAM,CAAC;kCAEhD,qBAAqB,CAAC,aAAa,EAAE,MAAM,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;yBACM,CAAC,SAAS,MAAM;gBAgCzB;;;;;;mBAMG;iCACc,MAAM,SAAS,MAAM,UAAU,MAAM;gBA8BtD;;;;mBAIG;;;YAvHH;;;;;eAKG;;gBAoCH;;;;mBAIG;yBACM,CAAC,SAAS,MAAM;gBAgCzB;;;;;;mBAMG;iCACc,MAAM,SAAS,MAAM,UAAU,MAAM;gBA8BtD;;;;mBAIG;;;;;IA1Gf;;;;;;;;;;;OAWG;;0BAGK,aAAa,SAAS,sBAAsB,EAC5C,MAAM,SAAS,aAAa,EAC5B,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnC,MAAM,EACN,YAAY,YACZ,aAAa,YACb,MAAM,qBAEG,sBAAsB,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,CAAC,YAC/F,+BAA+B;YAKpC;;;;eAIG;qBACM,CAAC,SAAS,MAAM,iBAAiB,UAAU,CAAC,CAAC,CAAC;YAgCvD;;;;;;eAMG;6BACc,MAAM,SAAS,MAAM,UAAU,MAAM;YA8BtD;;;;eAIG;;;;CAqBT,CAAC"}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "private": false,
4
4
  "displayName": "Supabase-Core",
5
5
  "description": "Lightweight services for supabase to make it easier to work with databases, tables and storage buckets",
6
- "version": "1.2.0",
6
+ "version": "1.3.0",
7
7
  "type": "module",
8
8
  "repository": {
9
9
  "type": "git",