@freehour/supabase-core 2.5.2 → 2.5.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.js +43 -43
- package/dist/postgrest/filter-builder.d.ts +31 -2
- package/dist/postgrest/filter-builder.d.ts.map +1 -1
- package/dist/postgrest/index.d.ts +0 -1
- package/dist/postgrest/index.d.ts.map +1 -1
- package/package.json +10 -10
- package/dist/postgrest/pagination-builder.d.ts +0 -35
- package/dist/postgrest/pagination-builder.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -254,8 +254,42 @@ function T(t, n = [], r = (e) => e) {
|
|
|
254
254
|
};
|
|
255
255
|
}
|
|
256
256
|
//#endregion
|
|
257
|
-
//#region lib/postgrest/
|
|
258
|
-
var E = class
|
|
257
|
+
//#region lib/postgrest/filter-builder.ts
|
|
258
|
+
var E = class t extends r.PostgrestFilterBuilder {
|
|
259
|
+
constructor(e) {
|
|
260
|
+
super(e);
|
|
261
|
+
}
|
|
262
|
+
throwOnError() {
|
|
263
|
+
return super.throwOnError();
|
|
264
|
+
}
|
|
265
|
+
select(e = "*") {
|
|
266
|
+
return new t(super.select(d(e).join(",")));
|
|
267
|
+
}
|
|
268
|
+
where(...t) {
|
|
269
|
+
if (t.length === 0) return this;
|
|
270
|
+
if (t.length === 1) {
|
|
271
|
+
let n = e.value(t[0]);
|
|
272
|
+
if (n.type === "logical") {
|
|
273
|
+
let e = n.args.map((e) => w(e)).join(",");
|
|
274
|
+
return this.url.searchParams.append(n.op, `(${e})`), this;
|
|
275
|
+
}
|
|
276
|
+
return this.filter(n.key, n.op, n.value);
|
|
277
|
+
}
|
|
278
|
+
return this.where({
|
|
279
|
+
type: "logical",
|
|
280
|
+
op: "and",
|
|
281
|
+
args: t
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
paginate(t, n) {
|
|
285
|
+
e(t >= 0, "Page index must be ≥ 0"), e(n >= 0, "Page limit must be ≥ 0");
|
|
286
|
+
let r = t * n, i = r + n - 1;
|
|
287
|
+
return new D(this.range(r, i), {
|
|
288
|
+
page: t,
|
|
289
|
+
limit: n
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
}, D = class e extends E {
|
|
259
293
|
pagination;
|
|
260
294
|
constructor(e, t) {
|
|
261
295
|
super(e), this.pagination = t;
|
|
@@ -336,47 +370,13 @@ var E = class e extends D {
|
|
|
336
370
|
throw e;
|
|
337
371
|
}) : e;
|
|
338
372
|
}
|
|
339
|
-
}, D = class t extends r.PostgrestFilterBuilder {
|
|
340
|
-
constructor(e) {
|
|
341
|
-
super(e);
|
|
342
|
-
}
|
|
343
|
-
throwOnError() {
|
|
344
|
-
return super.throwOnError();
|
|
345
|
-
}
|
|
346
|
-
select(e = "*") {
|
|
347
|
-
return new t(super.select(d(e).join(",")));
|
|
348
|
-
}
|
|
349
|
-
where(...t) {
|
|
350
|
-
if (t.length === 0) return this;
|
|
351
|
-
if (t.length === 1) {
|
|
352
|
-
let n = e.value(t[0]);
|
|
353
|
-
if (n.type === "logical") {
|
|
354
|
-
let e = n.args.map((e) => w(e)).join(",");
|
|
355
|
-
return this.url.searchParams.append(n.op, `(${e})`), this;
|
|
356
|
-
}
|
|
357
|
-
return this.filter(n.key, n.op, n.value);
|
|
358
|
-
}
|
|
359
|
-
return this.where({
|
|
360
|
-
type: "logical",
|
|
361
|
-
op: "and",
|
|
362
|
-
args: t
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
paginate(t, n) {
|
|
366
|
-
e(t >= 0, "Page index must be ≥ 0"), e(n >= 0, "Page limit must be ≥ 0");
|
|
367
|
-
let r = t * n, i = r + n - 1;
|
|
368
|
-
return new E(this.range(r, i), {
|
|
369
|
-
page: t,
|
|
370
|
-
limit: n
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
373
|
}, O = class {
|
|
374
374
|
builder;
|
|
375
375
|
constructor(e) {
|
|
376
376
|
this.builder = e;
|
|
377
377
|
}
|
|
378
378
|
select(e = "*", t) {
|
|
379
|
-
return new
|
|
379
|
+
return new E(this.builder.select(d(e).join(","), t));
|
|
380
380
|
}
|
|
381
381
|
count(e = "exact") {
|
|
382
382
|
return this.select("*", {
|
|
@@ -385,19 +385,19 @@ var E = class e extends D {
|
|
|
385
385
|
});
|
|
386
386
|
}
|
|
387
387
|
insert(e, t) {
|
|
388
|
-
return new
|
|
388
|
+
return new E(this.builder.insert(e, t));
|
|
389
389
|
}
|
|
390
390
|
upsert(e, { onConflict: t, ...n } = {}) {
|
|
391
|
-
return new
|
|
391
|
+
return new E(this.builder.upsert(e, {
|
|
392
392
|
onConflict: d(t).join(","),
|
|
393
393
|
...n
|
|
394
394
|
}));
|
|
395
395
|
}
|
|
396
396
|
update(e, t) {
|
|
397
|
-
return new
|
|
397
|
+
return new E(this.builder.update(e, t));
|
|
398
398
|
}
|
|
399
399
|
delete() {
|
|
400
|
-
return new
|
|
400
|
+
return new E(this.builder.delete());
|
|
401
401
|
}
|
|
402
402
|
}, k = class {
|
|
403
403
|
client;
|
|
@@ -408,7 +408,7 @@ var E = class e extends D {
|
|
|
408
408
|
return new O(this.client.from(e));
|
|
409
409
|
}
|
|
410
410
|
rpc(e, t, n) {
|
|
411
|
-
return new
|
|
411
|
+
return new E(this.client.rpc(e, t, n));
|
|
412
412
|
}
|
|
413
413
|
}, A = class {
|
|
414
414
|
supabase;
|
|
@@ -551,4 +551,4 @@ var N = class {
|
|
|
551
551
|
}
|
|
552
552
|
};
|
|
553
553
|
//#endregion
|
|
554
|
-
export { h as DataService, A as DatabaseService, a as FileNotFoundError, x as FilterNode, y as FilterOp, b as LogicalOp, o as ParseError, k as PostgrestClient, c as PostgrestErrorInterface,
|
|
554
|
+
export { h as DataService, A as DatabaseService, a as FileNotFoundError, x as FilterNode, y as FilterOp, b as LogicalOp, o as ParseError, k as PostgrestClient, c as PostgrestErrorInterface, E as PostgrestFilterBuilder, D as PostgrestPaginationBuilder, O as PostgrestQueryBuilder, s as RecordNotFoundError, N as StorageService, g as TableDataService, i as TracedError, _ as ViewDataService, v as assertCounted, d as coerceArray, w as encodeFilterNode, m as entries, f as groupBy, l as isDatabaseApiError, C as negateFilterNode, S as negateOp, T as parseFilterExpression, p as removeElement, u as splitPath };
|
|
@@ -1,8 +1,25 @@
|
|
|
1
|
+
import { PostgrestResponseSuccess } from '@supabase/postgrest-js';
|
|
2
|
+
import { PostgrestSingleResponse } from '@supabase/supabase-js';
|
|
1
3
|
import { ClientServerOptions, GenericSchema } from '../database';
|
|
2
|
-
import { KeyOfString } from '../utils';
|
|
4
|
+
import { ElementOf, KeyOfString } from '../utils';
|
|
3
5
|
import { FilterNode } from './filter';
|
|
4
|
-
import { PostgrestPaginationBuilder } from './pagination-builder';
|
|
5
6
|
import * as Supabase from '@supabase/postgrest-js';
|
|
7
|
+
/**
|
|
8
|
+
* Defines a pagination range using a page index and a page limit.
|
|
9
|
+
*/
|
|
10
|
+
export interface Pagination {
|
|
11
|
+
page: number;
|
|
12
|
+
limit: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Paginated list of items with pagination info.
|
|
16
|
+
*/
|
|
17
|
+
export interface PaginatedList<Item> extends Pagination {
|
|
18
|
+
items: Item[];
|
|
19
|
+
totalItems: number;
|
|
20
|
+
totalPages: number;
|
|
21
|
+
}
|
|
22
|
+
export type CollectResult<Result, ThrowOnError extends boolean> = ThrowOnError extends true ? PromiseLike<PostgrestResponseSuccess<PaginatedList<ElementOf<Result>>>> : PromiseLike<PostgrestSingleResponse<PaginatedList<ElementOf<Result>>>>;
|
|
6
23
|
export declare class PostgrestFilterBuilder<ClientOptions extends ClientServerOptions, Schema extends GenericSchema, Row extends Record<string, unknown>, Result, RelationName = unknown, Relationships = unknown, Method = unknown, ThrowOnError extends boolean = false> extends Supabase.PostgrestFilterBuilder<ClientOptions, Schema, Row, Result, RelationName, Relationships, Method> {
|
|
7
24
|
constructor(builder: Supabase.PostgrestFilterBuilder<ClientOptions, Schema, Row, Result, RelationName, Relationships, Method>);
|
|
8
25
|
throwOnError(): Supabase.PostgrestBuilder<ClientOptions, Result, true> & PostgrestFilterBuilder<ClientOptions, Schema, Row, Result, RelationName, Relationships, Method, true> & this;
|
|
@@ -20,4 +37,16 @@ export declare class PostgrestFilterBuilder<ClientOptions extends ClientServerOp
|
|
|
20
37
|
*/
|
|
21
38
|
paginate(page: number, limit: number): PostgrestPaginationBuilder<ClientOptions, Schema, Row, Result, RelationName, Relationships, Method, ThrowOnError>;
|
|
22
39
|
}
|
|
40
|
+
export declare class PostgrestPaginationBuilder<ClientOptions extends ClientServerOptions, Schema extends GenericSchema, Row extends Record<string, unknown>, Result, RelationName = unknown, Relationships = unknown, Method = unknown, ThrowOnError extends boolean = false> extends PostgrestFilterBuilder<ClientOptions, Schema, Row, Result, RelationName, Relationships, Method, ThrowOnError> {
|
|
41
|
+
private readonly pagination;
|
|
42
|
+
constructor(builder: PostgrestFilterBuilder<ClientOptions, Schema, Row, Result, RelationName, Relationships, Method, ThrowOnError>, pagination: Pagination);
|
|
43
|
+
select<Query extends (keyof Row)[] | '*' | (string & {}) = '*', ResultOne = Query extends '*' ? Row : Query extends string ? Supabase.UnstableGetResult<Schema, Row, RelationName, Relationships, Query, ClientServerOptions> : Pick<Row, Query[number]>>(columns?: Query): PostgrestPaginationBuilder<ClientOptions, Schema, Row, Method extends 'RPC' ? Result extends unknown[] ? ResultOne[] : ResultOne : ResultOne[], RelationName, Relationships, Method, ThrowOnError>;
|
|
44
|
+
throwOnError(): Supabase.PostgrestBuilder<ClientOptions, Result, true> & PostgrestPaginationBuilder<ClientOptions, Schema, Row, Result, RelationName, Relationships, Method, true> & this;
|
|
45
|
+
/**
|
|
46
|
+
* Collects the results of a pagination query.
|
|
47
|
+
* **Note:** For pagination to work the selection must include a `count`.
|
|
48
|
+
* @returns The paginated list of queried items.
|
|
49
|
+
*/
|
|
50
|
+
collect(): CollectResult<Result, ThrowOnError>;
|
|
51
|
+
}
|
|
23
52
|
//# sourceMappingURL=filter-builder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-builder.d.ts","sourceRoot":"","sources":["../../lib/postgrest/filter-builder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"filter-builder.d.ts","sourceRoot":"","sources":["../../lib/postgrest/filter-builder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAC;AACnD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAI3C;;GAEG;AACH,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,IAAI,CAAE,SAAQ,UAAU;IACnD,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,aAAa,CAAC,MAAM,EAAE,YAAY,SAAS,OAAO,IAAI,YAAY,SAAS,IAAI,GACrF,WAAW,CAAC,wBAAwB,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GACvE,WAAW,CAAC,uBAAuB,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAG7E,qBAAa,sBAAsB,CAC/B,aAAa,SAAS,mBAAmB,EACzC,MAAM,SAAS,aAAa,EAC5B,GAA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M,EACN,GAAG,EACH,MAAM,SAAS,KAAK,GACd,MAAM,SAAS,OAAO,EAAE,GACpB,SAAS,EAAE,GACX,SAAS,GACb,SAAS,EAAE,EACjB,YAAY,EACZ,aAAa,EACb,MAAM,EACN,YAAY,CACf;IAUQ,YAAY,IAAI,QAAQ,CAAC,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,0BAA0B,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,IAAI;IAOlM;;;;OAIG;IACH,OAAO,IAAI,aAAa,CAAC,MAAM,EAAE,YAAY,CAAC;CAmGjD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/postgrest/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/postgrest/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,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": "2.5.
|
|
6
|
+
"version": "2.5.4",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
@@ -31,22 +31,22 @@
|
|
|
31
31
|
"zod": "^4.4.3"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@supabase/postgrest-js": "^2.
|
|
35
|
-
"@supabase/storage-js": "^2.
|
|
36
|
-
"@supabase/supabase-js": "^2.
|
|
34
|
+
"@supabase/postgrest-js": "^2.107.0",
|
|
35
|
+
"@supabase/storage-js": "^2.107.0",
|
|
36
|
+
"@supabase/supabase-js": "^2.107.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@freehour/eslint-rules": "^1.0.19",
|
|
40
|
-
"@supabase/postgrest-js": "^2.
|
|
41
|
-
"@supabase/storage-js": "^2.
|
|
42
|
-
"@supabase/supabase-js": "^2.
|
|
40
|
+
"@supabase/postgrest-js": "^2.107.0",
|
|
41
|
+
"@supabase/storage-js": "^2.107.0",
|
|
42
|
+
"@supabase/supabase-js": "^2.107.0",
|
|
43
43
|
"ajv": "^8.20.0",
|
|
44
44
|
"bun-types": "^1.3.14",
|
|
45
45
|
"eslint": "9.39.4",
|
|
46
|
-
"supabase": "^2.
|
|
46
|
+
"supabase": "^2.104.0",
|
|
47
47
|
"typescript": "^6.0.3",
|
|
48
|
-
"vite": "^8.0.
|
|
49
|
-
"vite-plugin-dts": "^5.0.
|
|
48
|
+
"vite": "^8.0.16",
|
|
49
|
+
"vite-plugin-dts": "^5.0.2"
|
|
50
50
|
},
|
|
51
51
|
"trustedDependencies": [
|
|
52
52
|
"unrs-resolver"
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { PostgrestResponseSuccess } from '@supabase/postgrest-js';
|
|
2
|
-
import { PostgrestSingleResponse } from '@supabase/supabase-js';
|
|
3
|
-
import { ClientServerOptions, GenericSchema } from '../database';
|
|
4
|
-
import { ElementOf } from '../utils';
|
|
5
|
-
import { PostgrestFilterBuilder } from './filter-builder';
|
|
6
|
-
import * as Supabase from '@supabase/postgrest-js';
|
|
7
|
-
/**
|
|
8
|
-
* Defines a pagination range using a page index and a page limit.
|
|
9
|
-
*/
|
|
10
|
-
export interface Pagination {
|
|
11
|
-
page: number;
|
|
12
|
-
limit: number;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Paginated list of items with pagination info.
|
|
16
|
-
*/
|
|
17
|
-
export interface PaginatedList<Item> extends Pagination {
|
|
18
|
-
items: Item[];
|
|
19
|
-
totalItems: number;
|
|
20
|
-
totalPages: number;
|
|
21
|
-
}
|
|
22
|
-
export type CollectResult<Result, ThrowOnError extends boolean> = ThrowOnError extends true ? PromiseLike<PostgrestResponseSuccess<PaginatedList<ElementOf<Result>>>> : PromiseLike<PostgrestSingleResponse<PaginatedList<ElementOf<Result>>>>;
|
|
23
|
-
export declare class PostgrestPaginationBuilder<ClientOptions extends ClientServerOptions, Schema extends GenericSchema, Row extends Record<string, unknown>, Result, RelationName = unknown, Relationships = unknown, Method = unknown, ThrowOnError extends boolean = false> extends PostgrestFilterBuilder<ClientOptions, Schema, Row, Result, RelationName, Relationships, Method, ThrowOnError> {
|
|
24
|
-
private readonly pagination;
|
|
25
|
-
constructor(builder: PostgrestFilterBuilder<ClientOptions, Schema, Row, Result, RelationName, Relationships, Method, ThrowOnError>, pagination: Pagination);
|
|
26
|
-
select<Query extends (keyof Row)[] | '*' | (string & {}) = '*', ResultOne = Query extends '*' ? Row : Query extends string ? Supabase.UnstableGetResult<Schema, Row, RelationName, Relationships, Query, ClientServerOptions> : Pick<Row, Query[number]>>(columns?: Query): PostgrestPaginationBuilder<ClientOptions, Schema, Row, Method extends 'RPC' ? Result extends unknown[] ? ResultOne[] : ResultOne : ResultOne[], RelationName, Relationships, Method, ThrowOnError>;
|
|
27
|
-
throwOnError(): Supabase.PostgrestBuilder<ClientOptions, Result, true> & PostgrestPaginationBuilder<ClientOptions, Schema, Row, Result, RelationName, Relationships, Method, true> & this;
|
|
28
|
-
/**
|
|
29
|
-
* Collects the results of a pagination query.
|
|
30
|
-
* **Note:** For pagination to work the selection must include a `count`.
|
|
31
|
-
* @returns The paginated list of queried items.
|
|
32
|
-
*/
|
|
33
|
-
collect(): CollectResult<Result, ThrowOnError>;
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=pagination-builder.d.ts.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