@freehour/supabase-core 1.1.2 → 1.2.1
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/data-service.d.ts +126 -126
- package/dist/data-service.d.ts.map +1 -1
- package/dist/data.d.ts +3 -3
- package/dist/data.d.ts.map +1 -1
- package/dist/database-service.d.ts +65 -9
- package/dist/database-service.d.ts.map +1 -1
- package/dist/database.d.ts +3 -5
- package/dist/database.d.ts.map +1 -1
- package/dist/index.js +32 -37
- package/package.json +1 -1
- package/supabase/migrations/0000_supabase_core.sql +2 -2
- package/supabase/schemas/supabase-core/1_schemas.sql +5 -5
- package/supabase/schemas/supabase-core/3_functions.sql +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-service.d.ts","sourceRoot":"","sources":["../lib/data-service.ts"],"names":[],"mappings":";;AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"data-service.d.ts","sourceRoot":"","sources":["../lib/data-service.ts"],"names":[],"mappings":";;AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,OAAO,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EA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MAAM,SAAS,UAAU,CAAC,QAAQ,CAAC,EACnC,IAAI,SAAS,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CACtE,SAAQ,QAAQ,CAAC,iBAAiB,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,UAAU,CAAC;IAC/D;;OAEG;IACH,IAAI,EAAE,IAAI,CAAC;CACd;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,eAAe,CACxB,QAAQ,SAAS,YAAY,EAC7B,MAAM,SAAS,UAAU,CAAC,QAAQ,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,EAC1D,IAAI,SAAS,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CACtE,SAAQ,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC;gBAEtC,EACR,QAAQ,EACR,MAAM,EACN,IAAI,GACP,EAAE,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC;CAOnD;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAC/B,QAAQ,EAAE,uBAAuB,CAAC,KAAK,CAAC,GACzC,wBAAwB,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAMlE"}
|
package/dist/data.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CoreDatabase } from './database';
|
|
2
2
|
import { ColumnName, RelationName, RelationType, SchemaName } from './relation';
|
|
3
3
|
import { CountMethod } from './select';
|
|
4
4
|
/**
|
|
5
5
|
* Options for fuzzy searching within a database table or view.
|
|
6
6
|
*/
|
|
7
|
-
export interface FuzzySearchParams<Database extends
|
|
7
|
+
export interface FuzzySearchParams<Database extends CoreDatabase, Schema extends SchemaName<Database> = SchemaName<Database>, Type extends RelationType = RelationType, Relation extends RelationName<Database, Schema, Type> = RelationName<Database, Schema, Type>> {
|
|
8
8
|
/**
|
|
9
9
|
* The name of the column to search in.
|
|
10
10
|
*/
|
|
@@ -32,7 +32,7 @@ export interface FuzzySearchParams<Database extends BaseDatabase<Database>, Sche
|
|
|
32
32
|
* Options for upserting data into a database.
|
|
33
33
|
* Upserting means inserting a new row or updating an existing row if it already exists.
|
|
34
34
|
*/
|
|
35
|
-
export interface UpsertOptions<Database extends
|
|
35
|
+
export interface UpsertOptions<Database extends CoreDatabase, Schema extends SchemaName<Database> = SchemaName<Database>, Type extends RelationType = RelationType, Relation extends RelationName<Database, Schema, Type> = RelationName<Database, Schema, Type>> {
|
|
36
36
|
/**
|
|
37
37
|
* The name of the columns to use for conflict resolution.
|
|
38
38
|
* This column is used to determine if a row already exists in the database.
|
package/dist/data.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../lib/data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACrF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAC9B,QAAQ,SAAS,YAAY,
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../lib/data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACrF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAC9B,QAAQ,SAAS,YAAY,EAC7B,MAAM,SAAS,UAAU,CAAC,QAAQ,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,EAC1D,IAAI,SAAS,YAAY,GAAG,YAAY,EACxC,QAAQ,SAAS,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC;IAE5F;;OAEG;IACH,MAAM,EAAE,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;IAErD;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa,CAC1B,QAAQ,SAAS,YAAY,EAC7B,MAAM,SAAS,UAAU,CAAC,QAAQ,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,EAC1D,IAAI,SAAS,YAAY,GAAG,YAAY,EACxC,QAAQ,SAAS,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC;IAE5F;;;;;OAKG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC;IAE5D;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;OAEG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;CAC7B"}
|
|
@@ -1,21 +1,77 @@
|
|
|
1
1
|
import { SupabaseClient } from '@supabase/supabase-js';
|
|
2
2
|
import { DataService, TableDataService, ViewDataService } from './data-service';
|
|
3
|
-
import {
|
|
3
|
+
import { CoreDatabase } from './database';
|
|
4
4
|
import { RelationName, RelationType, SchemaName, TableName, ViewName } from './relation';
|
|
5
|
-
|
|
5
|
+
import { KeyOfString } from './utils';
|
|
6
|
+
import { PostgrestClient } from '@supabase/postgrest-js';
|
|
7
|
+
export interface DatabaseServiceParams<Database extends CoreDatabase = CoreDatabase> {
|
|
6
8
|
supabase: SupabaseClient<Database>;
|
|
7
9
|
}
|
|
8
|
-
|
|
9
|
-
* Service for interacting with a supabase database.
|
|
10
|
-
*/
|
|
11
|
-
export declare class DatabaseService<Database extends BaseDatabase<Database> = CoreDatabase> {
|
|
10
|
+
declare class _DatabaseService<Database extends CoreDatabase> {
|
|
12
11
|
private readonly supabase;
|
|
13
12
|
constructor({ supabase }: DatabaseServiceParams<Database>);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
schema<DynamicSchema extends Exclude<KeyOfString<Database>, '__InternalSupabase'>>(schema: DynamicSchema): PostgrestClient<Database, ("public" extends Exclude<keyof Database, "__InternalSupabase"> ? Exclude<keyof Database, "__InternalSupabase"> & "public" : string & Exclude<keyof Database, "__InternalSupabase">) extends infer T ? T extends ("public" extends Exclude<keyof Database, "__InternalSupabase"> ? Exclude<keyof Database, "__InternalSupabase"> & "public" : string & Exclude<keyof Database, "__InternalSupabase">) ? T extends string & Exclude<keyof Database, "__InternalSupabase"> ? Database extends {
|
|
14
|
+
__InternalSupabase: {
|
|
15
|
+
PostgrestVersion: string;
|
|
16
|
+
};
|
|
17
|
+
} ? Database["__InternalSupabase"] : {
|
|
18
|
+
PostgrestVersion: "12";
|
|
19
|
+
} : T extends {
|
|
20
|
+
PostgrestVersion: string;
|
|
21
|
+
} ? T : never : never : never, DynamicSchema, Database[DynamicSchema] extends {
|
|
22
|
+
Tables: Record<string, {
|
|
23
|
+
Row: Record<string, unknown>;
|
|
24
|
+
Insert: Record<string, unknown>;
|
|
25
|
+
Update: Record<string, unknown>;
|
|
26
|
+
Relationships: {
|
|
27
|
+
foreignKeyName: string;
|
|
28
|
+
columns: string[];
|
|
29
|
+
isOneToOne?: boolean;
|
|
30
|
+
referencedRelation: string;
|
|
31
|
+
referencedColumns: string[];
|
|
32
|
+
}[];
|
|
33
|
+
}>;
|
|
34
|
+
Views: Record<string, {
|
|
35
|
+
Row: Record<string, unknown>;
|
|
36
|
+
Insert: Record<string, unknown>;
|
|
37
|
+
Update: Record<string, unknown>;
|
|
38
|
+
Relationships: {
|
|
39
|
+
foreignKeyName: string;
|
|
40
|
+
columns: string[];
|
|
41
|
+
isOneToOne?: boolean;
|
|
42
|
+
referencedRelation: string;
|
|
43
|
+
referencedColumns: string[];
|
|
44
|
+
}[];
|
|
45
|
+
} | {
|
|
46
|
+
Row: Record<string, unknown>;
|
|
47
|
+
Relationships: {
|
|
48
|
+
foreignKeyName: string;
|
|
49
|
+
columns: string[];
|
|
50
|
+
isOneToOne?: boolean;
|
|
51
|
+
referencedRelation: string;
|
|
52
|
+
referencedColumns: string[];
|
|
53
|
+
}[];
|
|
54
|
+
}>;
|
|
55
|
+
Functions: Record<string, {
|
|
56
|
+
Args: Record<string, unknown> | never;
|
|
57
|
+
Returns: unknown;
|
|
58
|
+
SetofOptions?: {
|
|
59
|
+
isSetofReturn?: boolean | undefined;
|
|
60
|
+
isOneToOne?: boolean | undefined;
|
|
61
|
+
isNotNullable?: boolean | undefined;
|
|
62
|
+
to: string;
|
|
63
|
+
from: string;
|
|
64
|
+
};
|
|
65
|
+
}>;
|
|
66
|
+
} ? Database[DynamicSchema] : any>;
|
|
17
67
|
relation<Schema extends SchemaName<Database>, Relation extends RelationName<Database, Schema>>(schema: Schema, relation: Relation): DataService<Database, Schema, RelationType, Relation>;
|
|
18
68
|
table<Schema extends SchemaName<Database>, Table extends TableName<Database, Schema>>(schema: Schema, table: Table): TableDataService<Database, Schema, Table>;
|
|
19
69
|
view<Schema extends SchemaName<Database>, View extends ViewName<Database, Schema>>(schema: Schema, view: View): ViewDataService<Database, Schema, View>;
|
|
20
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Service for interacting with a supabase database.
|
|
73
|
+
*/
|
|
74
|
+
export type DatabaseService<Database extends CoreDatabase = CoreDatabase> = _DatabaseService<Database> & _DatabaseService<CoreDatabase>;
|
|
75
|
+
export declare const DatabaseService: new <Database extends CoreDatabase = CoreDatabase>(params: DatabaseServiceParams<Database>) => DatabaseService<Database>;
|
|
76
|
+
export {};
|
|
21
77
|
//# sourceMappingURL=database-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database-service.d.ts","sourceRoot":"","sources":["../lib/database-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,KAAK,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"database-service.d.ts","sourceRoot":"","sources":["../lib/database-service.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC9F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG3C,MAAM,WAAW,qBAAqB,CAClC,QAAQ,SAAS,YAAY,GAAG,YAAY;IAE5C,QAAQ,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;CACtC;AAGD,cAAM,gBAAgB,CAClB,QAAQ,SAAS,YAAY;IAE7B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA2B;gBAExC,EAAE,QAAQ,EAAE,EAAE,qBAAqB,CAAC,QAAQ,CAAC;IAIzD,MAA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|
|
2
2
|
import { Json } from './json';
|
|
3
|
-
import { KeyOfString } from './utils';
|
|
4
3
|
export interface GenericRelationship {
|
|
5
4
|
foreignKeyName: string;
|
|
6
5
|
columns: string[];
|
|
@@ -42,7 +41,7 @@ export interface GenericSchema {
|
|
|
42
41
|
Views: Record<string, GenericView>;
|
|
43
42
|
Functions: Record<string, GenericFunction>;
|
|
44
43
|
}
|
|
45
|
-
export type GenericDatabase<K extends string = string> = Record<K, GenericSchema>;
|
|
44
|
+
export type GenericDatabase<K extends string = (string & {})> = Record<K, GenericSchema>;
|
|
46
45
|
export interface StorageObjectsTable extends GenericTable {
|
|
47
46
|
Row: {
|
|
48
47
|
bucket_id: string | null;
|
|
@@ -80,9 +79,8 @@ export interface CoreSchema extends GenericSchema {
|
|
|
80
79
|
fuzzy_search: FuzzySearchFunction;
|
|
81
80
|
};
|
|
82
81
|
}
|
|
83
|
-
export interface CoreDatabase {
|
|
82
|
+
export interface CoreDatabase extends GenericDatabase {
|
|
84
83
|
storage: StorageSchema;
|
|
85
|
-
|
|
84
|
+
core: CoreSchema;
|
|
86
85
|
}
|
|
87
|
-
export type BaseDatabase<Database> = GenericDatabase<KeyOfString<Database>> & CoreDatabase;
|
|
88
86
|
//# sourceMappingURL=database.d.ts.map
|
package/dist/database.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../lib/database.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../lib/database.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAGnC,MAAM,WAAW,mBAAmB;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WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,OAAO,EAAE,IAAI,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,UAAW,SAAQ,aAAa;IAC7C,SAAS,EAAE;QACP,YAAY,EAAE,mBAAmB,CAAC;KACrC,CAAC;CACL;AAED,MAAM,WAAW,YAAa,SAAQ,eAAe;IACjD,OAAO,EAAE,aAAa,CAAC;IACvB,IAAI,EAAE,UAAU,CAAC;CACpB"}
|
package/dist/index.js
CHANGED
|
@@ -90,14 +90,14 @@ const $ = m.object({
|
|
|
90
90
|
name: m.string().optional(),
|
|
91
91
|
message: m.string().optional()
|
|
92
92
|
});
|
|
93
|
-
function
|
|
93
|
+
function H(s) {
|
|
94
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"],
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
192
|
+
function A(s) {
|
|
193
193
|
return Array.isArray(s) ? s : [s];
|
|
194
194
|
}
|
|
195
195
|
function z(s, t) {
|
|
@@ -228,7 +228,7 @@ const w = {
|
|
|
228
228
|
*/
|
|
229
229
|
select: (t, e) => w.filter.enable(
|
|
230
230
|
s.select(
|
|
231
|
-
|
|
231
|
+
A(t).join(","),
|
|
232
232
|
e
|
|
233
233
|
)
|
|
234
234
|
),
|
|
@@ -276,7 +276,7 @@ const w = {
|
|
|
276
276
|
(() => {
|
|
277
277
|
function r(a, n) {
|
|
278
278
|
if (n.type === "logical") {
|
|
279
|
-
const i =
|
|
279
|
+
const i = D(n.args, (c) => c, ",");
|
|
280
280
|
return n.op === "or" ? a.or(i) : n.op === "not.or" ? a.or(i, { referencedTable: "not" }) : r(a, {
|
|
281
281
|
type: "logical",
|
|
282
282
|
op: n.op === "and" ? "not.or" : "or",
|
|
@@ -380,7 +380,7 @@ class F {
|
|
|
380
380
|
minSimilarity: r = 0,
|
|
381
381
|
limit: a = 64
|
|
382
382
|
}) {
|
|
383
|
-
const { data: n } = await this.database.schema("
|
|
383
|
+
const { data: n } = await this.database.schema("core").rpc("fuzzy_search", {
|
|
384
384
|
relation: this.relation,
|
|
385
385
|
schema_name: this.schema,
|
|
386
386
|
column_name: t,
|
|
@@ -512,24 +512,18 @@ class U extends F {
|
|
|
512
512
|
});
|
|
513
513
|
}
|
|
514
514
|
}
|
|
515
|
-
function
|
|
515
|
+
function Y(s) {
|
|
516
516
|
if (s.error)
|
|
517
517
|
throw s.error;
|
|
518
518
|
return l(s.count !== null, "Response does not contain a count. Make sure to set the `count` option in the request."), s;
|
|
519
519
|
}
|
|
520
|
-
class
|
|
520
|
+
class B {
|
|
521
521
|
supabase;
|
|
522
522
|
constructor({ supabase: t }) {
|
|
523
523
|
this.supabase = t;
|
|
524
524
|
}
|
|
525
|
-
|
|
526
|
-
return this.supabase.schema
|
|
527
|
-
}
|
|
528
|
-
get rpc() {
|
|
529
|
-
return this.supabase.rpc.bind(this.supabase);
|
|
530
|
-
}
|
|
531
|
-
get from() {
|
|
532
|
-
return this.supabase.from.bind(this.supabase);
|
|
525
|
+
schema(t) {
|
|
526
|
+
return this.supabase.schema(t);
|
|
533
527
|
}
|
|
534
528
|
relation(t, e) {
|
|
535
529
|
return new F({
|
|
@@ -553,7 +547,8 @@ class Y {
|
|
|
553
547
|
});
|
|
554
548
|
}
|
|
555
549
|
}
|
|
556
|
-
|
|
550
|
+
const K = B;
|
|
551
|
+
class tt {
|
|
557
552
|
preprocesses = [];
|
|
558
553
|
storage;
|
|
559
554
|
constructor({
|
|
@@ -631,7 +626,7 @@ class K {
|
|
|
631
626
|
)).filter((n) => n !== null);
|
|
632
627
|
}
|
|
633
628
|
}
|
|
634
|
-
const
|
|
629
|
+
const et = {
|
|
635
630
|
removeImagesFromMarkdown: {
|
|
636
631
|
name: "removeImagesFromMarkdown",
|
|
637
632
|
run(s, t) {
|
|
@@ -653,7 +648,7 @@ const tt = {
|
|
|
653
648
|
}
|
|
654
649
|
}
|
|
655
650
|
};
|
|
656
|
-
class
|
|
651
|
+
class rt {
|
|
657
652
|
client;
|
|
658
653
|
database;
|
|
659
654
|
constructor({
|
|
@@ -742,7 +737,7 @@ class et {
|
|
|
742
737
|
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
738
|
if (c)
|
|
744
739
|
throw c;
|
|
745
|
-
const [, o] =
|
|
740
|
+
const [, o] = M(a);
|
|
746
741
|
return {
|
|
747
742
|
fileId: e,
|
|
748
743
|
bucket: r,
|
|
@@ -775,35 +770,35 @@ class et {
|
|
|
775
770
|
}
|
|
776
771
|
export {
|
|
777
772
|
F as DataService,
|
|
778
|
-
|
|
779
|
-
|
|
773
|
+
K as DatabaseService,
|
|
774
|
+
tt as EmbeddingService,
|
|
780
775
|
E as FileNotFoundError,
|
|
781
|
-
|
|
776
|
+
X as Filter,
|
|
782
777
|
O as FilterChainSeparator,
|
|
783
778
|
v as FilterOp,
|
|
784
|
-
|
|
785
|
-
|
|
779
|
+
J as LogicalOp,
|
|
780
|
+
Q as LogicalOpSeparator,
|
|
786
781
|
x as ParseError,
|
|
787
782
|
$ as PostgrestErrorInterface,
|
|
788
783
|
_ as RecordNotFoundError,
|
|
789
|
-
|
|
784
|
+
rt as StorageService,
|
|
790
785
|
C as TableDataService,
|
|
791
786
|
k as TracedError,
|
|
792
787
|
I as UnsupportedMimeError,
|
|
793
788
|
U as ViewDataService,
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
789
|
+
Y as assertCounted,
|
|
790
|
+
A as coerceArray,
|
|
791
|
+
D as encodeFilter,
|
|
797
792
|
q as encodeFilterNode,
|
|
798
793
|
W as entries,
|
|
799
794
|
z as groupBy,
|
|
800
|
-
|
|
795
|
+
H as isDatabaseApiError,
|
|
801
796
|
N as negateFilterNode,
|
|
802
797
|
j as negateOp,
|
|
803
798
|
y as parseFilterExpression,
|
|
804
|
-
|
|
799
|
+
L as parseFilterExpressionChain,
|
|
805
800
|
w as postgrestExtensions,
|
|
806
|
-
|
|
801
|
+
et as preprocessingSteps,
|
|
807
802
|
T as removeElement,
|
|
808
|
-
|
|
803
|
+
M as splitPath
|
|
809
804
|
};
|
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.1
|
|
6
|
+
"version": "1.2.1",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
create extension if not exists "pg_trgm" with schema "extensions";
|
|
2
2
|
|
|
3
|
-
create schema if not exists "
|
|
3
|
+
create schema if not exists "core";
|
|
4
4
|
|
|
5
5
|
set check_function_bodies = off;
|
|
6
6
|
|
|
7
|
-
CREATE OR REPLACE FUNCTION
|
|
7
|
+
CREATE OR REPLACE FUNCTION core.fuzzy_search(relation text, column_name text, search_term text, schema_name text DEFAULT 'public'::text, min_similarity double precision DEFAULT 0, limit_results integer DEFAULT 64)
|
|
8
8
|
RETURNS SETOF json
|
|
9
9
|
LANGUAGE plpgsql
|
|
10
10
|
STABLE
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
-- This file includes SQL commands for the
|
|
1
|
+
-- This file includes SQL commands for the core schema.
|
|
2
2
|
-- This schema is used by services of the supabase-core package.
|
|
3
3
|
|
|
4
4
|
-- Ensure the schema exists
|
|
5
|
-
CREATE SCHEMA IF NOT EXISTS
|
|
5
|
+
CREATE SCHEMA IF NOT EXISTS core;
|
|
6
6
|
|
|
7
7
|
-- Grant access privileges
|
|
8
|
-
GRANT USAGE ON SCHEMA
|
|
9
|
-
GRANT USAGE ON SCHEMA
|
|
10
|
-
GRANT USAGE ON SCHEMA
|
|
8
|
+
GRANT USAGE ON SCHEMA core TO "anon";
|
|
9
|
+
GRANT USAGE ON SCHEMA core TO "authenticated";
|
|
10
|
+
GRANT USAGE ON SCHEMA core TO "service_role";
|
|
11
11
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
-- Function to perform a fuzzy search on a specified table and column.
|
|
2
2
|
-- It returns records where the similarity score exceeds a specified threshold (optional).
|
|
3
3
|
-- The results are ordered by similarity score in descending order.
|
|
4
|
-
CREATE OR REPLACE FUNCTION
|
|
4
|
+
CREATE OR REPLACE FUNCTION core.fuzzy_search(
|
|
5
5
|
relation text, -- The name of the table or view to search
|
|
6
6
|
column_name text,
|
|
7
7
|
search_term text,
|