@freehour/supabase-core 1.7.0 → 1.7.2
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/embedding.d.ts +1 -1
- package/dist/embedding.d.ts.map +1 -1
- package/dist/errors.d.ts +24 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/index.js +70 -64
- package/package.json +1 -1
package/dist/embedding.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Json } from './json';
|
|
2
2
|
import { FileRef, StorageLocation } from './storage';
|
|
3
|
-
export type Metadata =
|
|
3
|
+
export type Metadata = Json;
|
|
4
4
|
export type MetadataGeneratorFn = (location: StorageLocation) => Metadata;
|
|
5
5
|
export interface Embedding extends StorageLocation {
|
|
6
6
|
text: string;
|
package/dist/embedding.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embedding.d.ts","sourceRoot":"","sources":["../lib/embedding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAG1D,MAAM,MAAM,QAAQ,GAAG,
|
|
1
|
+
{"version":3,"file":"embedding.d.ts","sourceRoot":"","sources":["../lib/embedding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAG1D,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAC;AAC5B,MAAM,MAAM,mBAAmB,GAAG,CAAC,QAAQ,EAAE,eAAe,KAAK,QAAQ,CAAC;AAG1E,MAAM,WAAW,SAAU,SAAQ,eAAe;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,EAAE,IAAI,CAAC;CACnB;AAED,MAAM,WAAW,+BAA+B;IAC5C,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,IAAI,CAAC;IACd,KAAK,EAAE,IAAI,CAAC;CACf;AAED,MAAM,WAAW,+BAA+B;IAC5C,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,KAAK,CAAC;CAChB;AAED,MAAM,MAAM,8BAA8B,GAAG,+BAA+B,GAAG,+BAA+B,CAAC"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -38,6 +38,30 @@ export declare class FileNotFoundError extends TracedError {
|
|
|
38
38
|
readonly path?: string;
|
|
39
39
|
constructor(message: string, { fileId, bucket, path, }?: FileNotFoundErrorOptions);
|
|
40
40
|
}
|
|
41
|
+
export interface FileNotSupportedErrorOptions extends ErrorOptions {
|
|
42
|
+
/**
|
|
43
|
+
* The name of the file that caused the error.
|
|
44
|
+
*/
|
|
45
|
+
fileName?: string;
|
|
46
|
+
/**
|
|
47
|
+
* The type of the file that is not supported.
|
|
48
|
+
*/
|
|
49
|
+
fileType?: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* An error that indicates that a file is not supported, e.g. due to its MIME type or extension.
|
|
53
|
+
*/
|
|
54
|
+
export declare class FileNotSupportedError extends Error {
|
|
55
|
+
/**
|
|
56
|
+
* The name of the file that caused the error.
|
|
57
|
+
*/
|
|
58
|
+
readonly fileName?: string;
|
|
59
|
+
/**
|
|
60
|
+
* The type of the file that is not supported.
|
|
61
|
+
*/
|
|
62
|
+
readonly fileType?: string;
|
|
63
|
+
constructor(message: string, { fileName, fileType, ...options }?: FileNotSupportedErrorOptions);
|
|
64
|
+
}
|
|
41
65
|
export interface ParseErrorOptions extends ErrorOptions {
|
|
42
66
|
/**
|
|
43
67
|
* The encountered expression that could not be parsed.
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1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OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAED;;;;;GAKG;AACH,qBAAa,mBAAoB,SAAQ,WAAW;IAChD;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;gBAG1B,OAAO,EAAE,MAAM,EACf,EACI,MAAM,EACN,QAAQ,EACR,EAAE,GACL,GAAE,0BAA+B;CAOzC;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;;;iBAgB9B,CAAC;AAEP,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE9E;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,cAAc,GAAG,uBAAuB,CAAC;AAExE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB,CAE5E"}
|
package/dist/index.js
CHANGED
|
@@ -14,54 +14,60 @@ var i = class extends Error {
|
|
|
14
14
|
constructor(e, { fileId: t, bucket: n, path: r } = {}) {
|
|
15
15
|
super(e), this.fileId = t, this.bucket = n, this.path = r;
|
|
16
16
|
}
|
|
17
|
-
}, o = class extends
|
|
17
|
+
}, o = class extends Error {
|
|
18
|
+
fileName;
|
|
19
|
+
fileType;
|
|
20
|
+
constructor(e, { fileName: t, fileType: n, ...r } = {}) {
|
|
21
|
+
super(e, r), this.fileName = t, this.fileType = n;
|
|
22
|
+
}
|
|
23
|
+
}, s = class extends i {
|
|
18
24
|
expression;
|
|
19
25
|
format;
|
|
20
26
|
constructor(e, { expression: t, format: n, ...r } = {}) {
|
|
21
27
|
super(e, r), this.expression = t, this.format = n;
|
|
22
28
|
}
|
|
23
|
-
},
|
|
29
|
+
}, c = class extends i {
|
|
24
30
|
schema;
|
|
25
31
|
relation;
|
|
26
32
|
id;
|
|
27
33
|
constructor(e, { schema: t, relation: n, id: r } = {}) {
|
|
28
34
|
super(e), this.schema = t, this.relation = n, this.id = r;
|
|
29
35
|
}
|
|
30
|
-
},
|
|
36
|
+
}, l = t.object({
|
|
31
37
|
code: t.string(),
|
|
32
38
|
details: t.string().nullable(),
|
|
33
39
|
hint: t.string().nullable(),
|
|
34
40
|
name: t.string().optional(),
|
|
35
41
|
message: t.string().optional()
|
|
36
42
|
});
|
|
37
|
-
function
|
|
38
|
-
return e instanceof n ||
|
|
43
|
+
function u(e) {
|
|
44
|
+
return e instanceof n || l.safeParse(e).success;
|
|
39
45
|
}
|
|
40
46
|
//#endregion
|
|
41
47
|
//#region lib/utils.ts
|
|
42
|
-
function
|
|
48
|
+
function d(e, t = "/") {
|
|
43
49
|
let n = e.lastIndexOf(t);
|
|
44
50
|
return n === -1 ? ["", e] : [e.substring(0, n), e.substring(n + 1)];
|
|
45
51
|
}
|
|
46
|
-
function
|
|
52
|
+
function f(e) {
|
|
47
53
|
return Array.isArray(e) ? e : [e];
|
|
48
54
|
}
|
|
49
|
-
function
|
|
55
|
+
function p(e, t) {
|
|
50
56
|
return e.reduce((e, n) => {
|
|
51
57
|
let r = t(n);
|
|
52
58
|
return (e[r] ??= []).push(n), e;
|
|
53
59
|
}, {});
|
|
54
60
|
}
|
|
55
|
-
function
|
|
61
|
+
function m(e, t) {
|
|
56
62
|
let n = e.findIndex(t);
|
|
57
63
|
return n !== -1 && e.splice(n, 1), e;
|
|
58
64
|
}
|
|
59
|
-
function
|
|
65
|
+
function h(e) {
|
|
60
66
|
return Object.entries(e);
|
|
61
67
|
}
|
|
62
68
|
//#endregion
|
|
63
69
|
//#region lib/data-service.ts
|
|
64
|
-
var
|
|
70
|
+
var g = class {
|
|
65
71
|
database;
|
|
66
72
|
schema;
|
|
67
73
|
relation;
|
|
@@ -69,7 +75,7 @@ var h = class {
|
|
|
69
75
|
this.database = e, this.schema = t, this.relation = n;
|
|
70
76
|
}
|
|
71
77
|
recordNotFoundError(e) {
|
|
72
|
-
return new
|
|
78
|
+
return new c(`Record with id ${e} not found in ${this.schema}.${this.relation}`, {
|
|
73
79
|
schema: this.schema,
|
|
74
80
|
relation: this.relation,
|
|
75
81
|
id: e
|
|
@@ -117,7 +123,7 @@ var h = class {
|
|
|
117
123
|
}
|
|
118
124
|
async upsert(e, { onConflict: t, ...n } = {}) {
|
|
119
125
|
let { data: r } = await this.query.upsert(e, {
|
|
120
|
-
onConflict: t === void 0 ? void 0 :
|
|
126
|
+
onConflict: t === void 0 ? void 0 : f(t).join(","),
|
|
121
127
|
...n
|
|
122
128
|
}).select().single().throwOnError();
|
|
123
129
|
return r;
|
|
@@ -126,7 +132,7 @@ var h = class {
|
|
|
126
132
|
let { data: n } = await this.query.update(t).eq("id", e).select().single().throwOnError();
|
|
127
133
|
return n;
|
|
128
134
|
}
|
|
129
|
-
},
|
|
135
|
+
}, _ = class extends g {
|
|
130
136
|
constructor({ database: e, schema: t, table: n }) {
|
|
131
137
|
super({
|
|
132
138
|
database: e,
|
|
@@ -134,7 +140,7 @@ var h = class {
|
|
|
134
140
|
relation: n
|
|
135
141
|
});
|
|
136
142
|
}
|
|
137
|
-
},
|
|
143
|
+
}, v = class extends g {
|
|
138
144
|
constructor({ database: e, schema: t, view: n }) {
|
|
139
145
|
super({
|
|
140
146
|
database: e,
|
|
@@ -143,13 +149,13 @@ var h = class {
|
|
|
143
149
|
});
|
|
144
150
|
}
|
|
145
151
|
};
|
|
146
|
-
function
|
|
152
|
+
function y(t) {
|
|
147
153
|
if (t.error) throw t.error;
|
|
148
154
|
return e(t.count !== null, "Response does not contain a count. Make sure to set the `count` option in the request."), t;
|
|
149
155
|
}
|
|
150
156
|
//#endregion
|
|
151
157
|
//#region lib/filter.ts
|
|
152
|
-
var
|
|
158
|
+
var b = [
|
|
153
159
|
"eq",
|
|
154
160
|
"neq",
|
|
155
161
|
"gt",
|
|
@@ -175,17 +181,17 @@ var y = [
|
|
|
175
181
|
"nxr",
|
|
176
182
|
"nxl",
|
|
177
183
|
"adj"
|
|
178
|
-
],
|
|
184
|
+
], x = ["and", "or"], S = ",", C = "~", w = (e) => (n = {}) => {
|
|
179
185
|
let r = (e) => n[e] ?? e, i = Object.keys(e.shape);
|
|
180
186
|
return t.string().transform((e, t) => {
|
|
181
187
|
try {
|
|
182
|
-
return
|
|
188
|
+
return A(e, i, r);
|
|
183
189
|
} catch (n) {
|
|
184
190
|
return t.addIssue({
|
|
185
191
|
code: "custom",
|
|
186
192
|
input: e,
|
|
187
193
|
message: n instanceof Error ? n.message : void 0,
|
|
188
|
-
params: n instanceof
|
|
194
|
+
params: n instanceof s ? {
|
|
189
195
|
expression: n.expression,
|
|
190
196
|
format: n.format
|
|
191
197
|
} : void 0
|
|
@@ -193,26 +199,26 @@ var y = [
|
|
|
193
199
|
}
|
|
194
200
|
});
|
|
195
201
|
};
|
|
196
|
-
function
|
|
202
|
+
function T(e) {
|
|
197
203
|
return e.startsWith("not.") ? e.slice(4) : `not.${e}`;
|
|
198
204
|
}
|
|
199
|
-
function
|
|
205
|
+
function E(e) {
|
|
200
206
|
return {
|
|
201
207
|
...e,
|
|
202
|
-
op:
|
|
208
|
+
op: T(e.op)
|
|
203
209
|
};
|
|
204
210
|
}
|
|
205
|
-
function
|
|
211
|
+
function D(e, t = (e) => e) {
|
|
206
212
|
if (e.type === "logical") {
|
|
207
|
-
let n = e.args.map((e) =>
|
|
213
|
+
let n = e.args.map((e) => D(e, t));
|
|
208
214
|
return `${e.op}(${n})`;
|
|
209
215
|
}
|
|
210
216
|
return `${t(e.key)}.${e.op}.${e.value}`;
|
|
211
217
|
}
|
|
212
|
-
function
|
|
213
|
-
return e.map((e) =>
|
|
218
|
+
function O(e, t = (e) => e, n = "~") {
|
|
219
|
+
return e.map((e) => D(e, t)).join(n);
|
|
214
220
|
}
|
|
215
|
-
function
|
|
221
|
+
function k(t, n = [], r = (e) => e) {
|
|
216
222
|
function i(e) {
|
|
217
223
|
let t = [], n = 0, r = "", i = !1;
|
|
218
224
|
for (let a of e) a === "\"" ? (i = !i, r += a) : a === "(" && !i ? (n++, r += a) : a === ")" && !i ? (n--, r += a) : a === "," && n === 0 && !i ? (t.push(r.trim()), r = "") : r += a;
|
|
@@ -222,34 +228,34 @@ function O(t, n = [], r = (e) => e) {
|
|
|
222
228
|
if (t.startsWith("and(")) return {
|
|
223
229
|
type: "logical",
|
|
224
230
|
op: "and",
|
|
225
|
-
args: i(t.slice(4, -1)).map((e) =>
|
|
231
|
+
args: i(t.slice(4, -1)).map((e) => k(e, n, r))
|
|
226
232
|
};
|
|
227
233
|
if (t.startsWith("or(")) return {
|
|
228
234
|
type: "logical",
|
|
229
235
|
op: "or",
|
|
230
|
-
args: i(t.slice(3, -1)).map((e) =>
|
|
236
|
+
args: i(t.slice(3, -1)).map((e) => k(e, n, r))
|
|
231
237
|
};
|
|
232
238
|
if (t.startsWith("not.and(")) return {
|
|
233
239
|
type: "logical",
|
|
234
240
|
op: "not.and",
|
|
235
|
-
args: i(t.slice(8, -1)).map((e) =>
|
|
241
|
+
args: i(t.slice(8, -1)).map((e) => k(e, n, r))
|
|
236
242
|
};
|
|
237
243
|
if (t.startsWith("not.or(")) return {
|
|
238
244
|
type: "logical",
|
|
239
245
|
op: "not.or",
|
|
240
|
-
args: i(t.slice(7, -1)).map((e) =>
|
|
246
|
+
args: i(t.slice(7, -1)).map((e) => k(e, n, r))
|
|
241
247
|
};
|
|
242
248
|
}
|
|
243
|
-
let a = `^(${n.length === 0 ? "[a-zA-Z_][a-zA-Z0-9_]*" : n.join("|")})\\.((?:not\\.)?(?:${
|
|
244
|
-
if (!
|
|
249
|
+
let a = `^(${n.length === 0 ? "[a-zA-Z_][a-zA-Z0-9_]*" : n.join("|")})\\.((?:not\\.)?(?:${b.join("|")}))\\.(.+)$`, o = new RegExp(a).exec(t);
|
|
250
|
+
if (!o) throw new s(`Invalid filter expression '${t}'`, {
|
|
245
251
|
expression: t,
|
|
246
252
|
format: {
|
|
247
253
|
syntax: "key.(not.)op.value",
|
|
248
254
|
keys: n.length === 0 ? "*" : n,
|
|
249
|
-
operators:
|
|
255
|
+
operators: b
|
|
250
256
|
}
|
|
251
257
|
});
|
|
252
|
-
let [, c, l, u] =
|
|
258
|
+
let [, c, l, u] = o;
|
|
253
259
|
return {
|
|
254
260
|
type: "condition",
|
|
255
261
|
key: r(c),
|
|
@@ -257,22 +263,22 @@ function O(t, n = [], r = (e) => e) {
|
|
|
257
263
|
value: e.defined(u)
|
|
258
264
|
};
|
|
259
265
|
}
|
|
260
|
-
function
|
|
261
|
-
return e.length === 0 ? [] : e.split(r).map((e) =>
|
|
266
|
+
function A(e, t = [], n = (e) => e, r = "~") {
|
|
267
|
+
return e.length === 0 ? [] : e.split(r).map((e) => k(e, t, n));
|
|
262
268
|
}
|
|
263
269
|
//#endregion
|
|
264
270
|
//#region lib/postgrest.ts
|
|
265
|
-
var
|
|
271
|
+
var j = class t extends r.PostgrestFilterBuilder {
|
|
266
272
|
pagination;
|
|
267
273
|
constructor(e) {
|
|
268
274
|
super(e);
|
|
269
275
|
}
|
|
270
276
|
select(e = "*") {
|
|
271
|
-
return new t(super.select(
|
|
277
|
+
return new t(super.select(f(e).join(",")));
|
|
272
278
|
}
|
|
273
279
|
where(e) {
|
|
274
280
|
if (e.type === "logical") {
|
|
275
|
-
let t = e.args.map((e) =>
|
|
281
|
+
let t = e.args.map((e) => D(e)).join(",");
|
|
276
282
|
this.url.searchParams.append(e.op, `(${t})`);
|
|
277
283
|
} else this.url.searchParams.append(e.key, `${e.op}.${e.value}`);
|
|
278
284
|
return this;
|
|
@@ -314,75 +320,75 @@ var A = class t extends r.PostgrestFilterBuilder {
|
|
|
314
320
|
};
|
|
315
321
|
});
|
|
316
322
|
}
|
|
317
|
-
},
|
|
323
|
+
}, M = class extends r.PostgrestQueryBuilder {
|
|
318
324
|
constructor(e) {
|
|
319
325
|
super(e.url, e);
|
|
320
326
|
}
|
|
321
327
|
select(e = "*", t) {
|
|
322
|
-
return new
|
|
328
|
+
return new j(super.select(f(e).join(","), t));
|
|
323
329
|
}
|
|
324
330
|
count(e = "exact") {
|
|
325
|
-
return new
|
|
331
|
+
return new j(this.select("*", {
|
|
326
332
|
count: e,
|
|
327
333
|
head: !0
|
|
328
334
|
}));
|
|
329
335
|
}
|
|
330
336
|
insert(e, t) {
|
|
331
|
-
return new
|
|
337
|
+
return new j(super.insert(e, t));
|
|
332
338
|
}
|
|
333
339
|
upsert(e, { onConflict: t, ...n } = {}) {
|
|
334
|
-
return new
|
|
335
|
-
onConflict:
|
|
340
|
+
return new j(super.upsert(e, {
|
|
341
|
+
onConflict: f(t).join(","),
|
|
336
342
|
...n
|
|
337
343
|
}));
|
|
338
344
|
}
|
|
339
345
|
update(e, t) {
|
|
340
|
-
return new
|
|
346
|
+
return new j(super.update(e, t));
|
|
341
347
|
}
|
|
342
348
|
delete() {
|
|
343
|
-
return new
|
|
349
|
+
return new j(super.delete());
|
|
344
350
|
}
|
|
345
|
-
},
|
|
351
|
+
}, N = class {
|
|
346
352
|
client;
|
|
347
353
|
constructor(e) {
|
|
348
354
|
this.client = e;
|
|
349
355
|
}
|
|
350
356
|
from(e) {
|
|
351
|
-
return new
|
|
357
|
+
return new M(this.client.from(e));
|
|
352
358
|
}
|
|
353
359
|
rpc(e, t, n) {
|
|
354
|
-
return new
|
|
360
|
+
return new j(this.client.rpc(e, t, n));
|
|
355
361
|
}
|
|
356
|
-
},
|
|
362
|
+
}, P = class {
|
|
357
363
|
supabase;
|
|
358
364
|
constructor({ supabase: e }) {
|
|
359
365
|
this.supabase = e;
|
|
360
366
|
}
|
|
361
367
|
schema(e) {
|
|
362
|
-
return new
|
|
368
|
+
return new N(this.supabase.schema(e));
|
|
363
369
|
}
|
|
364
370
|
relation(e, t) {
|
|
365
|
-
return new
|
|
371
|
+
return new g({
|
|
366
372
|
database: this,
|
|
367
373
|
schema: e,
|
|
368
374
|
relation: t
|
|
369
375
|
});
|
|
370
376
|
}
|
|
371
377
|
table(e, t) {
|
|
372
|
-
return new
|
|
378
|
+
return new _({
|
|
373
379
|
database: this,
|
|
374
380
|
schema: e,
|
|
375
381
|
table: t
|
|
376
382
|
});
|
|
377
383
|
}
|
|
378
384
|
view(e, t) {
|
|
379
|
-
return new
|
|
385
|
+
return new v({
|
|
380
386
|
database: this,
|
|
381
387
|
schema: e,
|
|
382
388
|
view: t
|
|
383
389
|
});
|
|
384
390
|
}
|
|
385
|
-
},
|
|
391
|
+
}, F = class {
|
|
386
392
|
storage;
|
|
387
393
|
constructor({ storage: e }) {
|
|
388
394
|
this.storage = e;
|
|
@@ -421,15 +427,15 @@ var A = class t extends r.PostgrestFilterBuilder {
|
|
|
421
427
|
};
|
|
422
428
|
//#endregion
|
|
423
429
|
//#region lib/processing.ts
|
|
424
|
-
function
|
|
430
|
+
function I(e) {
|
|
425
431
|
return e.replace(/!\[([^\]]*)\]\([^)]*\)/g, (e, t) => `![${t}]()`);
|
|
426
432
|
}
|
|
427
|
-
function
|
|
433
|
+
function L(e) {
|
|
428
434
|
return e.replace(/\[([^\]]*)\]\([^)]*\)/g, (e, t) => `[${t}]()`);
|
|
429
435
|
}
|
|
430
436
|
//#endregion
|
|
431
437
|
//#region lib/storage-service.ts
|
|
432
|
-
var
|
|
438
|
+
var R = class {
|
|
433
439
|
client;
|
|
434
440
|
database;
|
|
435
441
|
constructor({ client: e, database: t }) {
|
|
@@ -508,7 +514,7 @@ var L = class {
|
|
|
508
514
|
async downloadFile(e) {
|
|
509
515
|
let { fileId: t, bucket: n, path: r, properties: i } = await this.getFileInfo(e), { data: a, error: o } = await this.client.from(n).download(r);
|
|
510
516
|
if (o) throw o;
|
|
511
|
-
let [, s] =
|
|
517
|
+
let [, s] = d(r);
|
|
512
518
|
return {
|
|
513
519
|
fileId: t,
|
|
514
520
|
bucket: n,
|
|
@@ -520,7 +526,7 @@ var L = class {
|
|
|
520
526
|
let n = t.filter((e) => "fileId" in e).map((e) => e.fileId), r = (await this.files.query.select(["bucket_id", "path_tokens"]).containedBy("id", n).throwOnError()).data.map(({ bucket_id: t, path_tokens: n }) => ({
|
|
521
527
|
bucket: e.notNull(t, "bucket_id must not be null"),
|
|
522
528
|
path: e.notNull(n, "path_tokens must not be null").join("/")
|
|
523
|
-
})), i =
|
|
529
|
+
})), i = h(p(t.filter((e) => "path" in e).concat(r), (e) => e.bucket)).map(([e, t]) => ({
|
|
524
530
|
bucket: e,
|
|
525
531
|
paths: t.map((e) => e.path)
|
|
526
532
|
}));
|
|
@@ -535,4 +541,4 @@ var L = class {
|
|
|
535
541
|
}
|
|
536
542
|
};
|
|
537
543
|
//#endregion
|
|
538
|
-
export {
|
|
544
|
+
export { g as DataService, P as DatabaseService, F as EmbeddingService, a as FileNotFoundError, o as FileNotSupportedError, w as Filter, C as FilterChainSeparator, b as FilterOp, x as LogicalOp, S as LogicalOpSeparator, s as ParseError, N as PostgrestClient, l as PostgrestErrorInterface, j as PostgrestFilterBuilder, M as PostgrestQueryBuilder, c as RecordNotFoundError, R as StorageService, _ as TableDataService, i as TracedError, v as ViewDataService, y as assertCounted, f as coerceArray, O as encodeFilter, D as encodeFilterNode, h as entries, p as groupBy, u as isDatabaseApiError, E as negateFilterNode, T as negateOp, k as parseFilterExpression, A as parseFilterExpressionChain, m as removeElement, I as removeImagesFromMarkdown, L as removeLinksFromMarkdown, d as splitPath };
|
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.7.
|
|
6
|
+
"version": "1.7.2",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|