@freehour/supabase-langchain 1.2.1 → 1.2.3

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.
@@ -1,5 +1,6 @@
1
- import { JsonObject, StorageLocation } from '@freehour/supabase-core';
1
+ import { StorageLocation } from '@freehour/supabase-core';
2
2
  import { DocumentInterface } from '@langchain/core/documents';
3
+ import { JsonObject } from './json';
3
4
  export interface FileMetadata {
4
5
  name: string;
5
6
  size: number;
@@ -1 +1 @@
1
- {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../lib/document.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAGnE,MAAM,WAAW,YAAY;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,mBAAmB,CAC3B,UAAU,SAAS,MAAM,GAAG,MAAM,EAClC,QAAQ,SAAS,UAAU,GAAG,UAAU,IACxC,CAAC,QAAQ,EAAE,eAAe,CAAC,UAAU,CAAC,KAAK,QAAQ,CAAC;AAExD,MAAM,MAAM,eAAe,CACvB,UAAU,SAAS,MAAM,GAAG,MAAM,EAClC,QAAQ,SAAS,UAAU,GAAG,UAAU,IACxC,iBAAiB,CAAC,eAAe,CAAC,UAAU,CAAC,GAAG,YAAY,GAAG,QAAQ,CAAC,CAAC"}
1
+ {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../lib/document.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAGzC,MAAM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sB;IAClD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA8B;gBAElD,EACR,QAAQ,EACR,UAAU,EACV,SAAgB,EAChB,YAAkB,GACrB,EAAE,sBAAsB,CAAC,QAAQ,EAAE,aAAa,CAAC;IAWlD,OAAO,KAAK,UAAU,GAErB;IAED,OAAO,CAAC,SAAS;IA0CjB,OAAO,CAAC,WAAW;YA6BL,gBAAgB;YA8BhB,gBAAgB;YAYhB,gBAAgB;IAKxB,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,QAAQ,GAAG,mBAAmB,CAAC,UAAU,EAAE,QAAQ,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC,UAAU,EAAE,QAAQ,CAAC,EAAE,CAAC;IAatJ,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,GAAG,mBAAmB,CAAC,UAAU,EAAE,QAAQ,CAAC,GAAG,OAAO,CACrG,oBAAoB,CAChB,eAAe,CAAC,UAAU,EAAE,QAAQ,CAAC,EAAE,CAC1C,EAAE,CACN;IAmBD,SAAS,CAAC,OAAO,EAAE,eAAe,CAAC,UAAU,EAAE,QAAQ,CAAC,GAAG,sBAAsB;CAGpF"}
package/dist/errors.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { TracedError } from '@freehour/supabase-core';
1
+ import { StorageLocation, TracedError } from '@freehour/supabase-core';
2
2
  export interface FileNotSupportedErrorOptions extends ErrorOptions {
3
3
  /**
4
4
  * The name of the file that caused the error.
@@ -23,4 +23,20 @@ export declare class FileNotSupportedError extends TracedError {
23
23
  readonly fileType?: string;
24
24
  constructor(message: string, { fileName, fileType, ...options }?: FileNotSupportedErrorOptions);
25
25
  }
26
+ export interface EmbeddingErrorOptions extends ErrorOptions {
27
+ /**
28
+ * The location of the file that caused the error.
29
+ */
30
+ location: StorageLocation;
31
+ }
32
+ /**
33
+ * An error that indicates that an embedding operation failed, e.g. due to a failure in the embedding model or vector store.
34
+ */
35
+ export declare class EmbeddingError extends TracedError {
36
+ /**
37
+ * The location of the file that caused the error.
38
+ */
39
+ readonly location: StorageLocation;
40
+ constructor(message: string, { location, ...options }: EmbeddingErrorOptions);
41
+ }
26
42
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../lib/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGtD,MAAM,WAAW,4BAA6B,SAAQ,YAAY;IAE9D;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,WAAW;IAElD;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;gBAGvB,OAAO,EAAE,MAAM,EACf,EACI,QAAQ,EACR,QAAQ,EACR,GAAG,OAAO,EACb,GAAE,4BAAiC;CAM3C"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../lib/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGtD,MAAM,WAAW,4BAA6B,SAAQ,YAAY;IAE9D;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,WAAW;IAElD;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;gBAGvB,OAAO,EAAE,MAAM,EACf,EACI,QAAQ,EACR,QAAQ,EACR,GAAG,OAAO,EACb,GAAE,4BAAiC;CAM3C;AAED,MAAM,WAAW,qBAAsB,SAAQ,YAAY;IAEvD;;OAEG;IACH,QAAQ,EAAE,eAAe,CAAC;CAC7B;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,WAAW;IAE3C;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;gBAG/B,OAAO,EAAE,MAAM,EACf,EACI,QAAQ,EACR,GAAG,OAAO,EACb,EAAE,qBAAqB;CAK/B"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export type * from './document';
2
2
  export * from './embedding-service';
3
3
  export * from './errors';
4
+ export type * from './json';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,YAAY,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,YAAY,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,mBAAmB,QAAQ,CAAC"}
package/dist/index.js CHANGED
@@ -11387,11 +11387,11 @@ var am = class {
11387
11387
  super(e, t), this.name = this.constructor.name, Error.captureStackTrace(this, this.constructor);
11388
11388
  }
11389
11389
  }, um = class extends lm {
11390
- fileId;
11390
+ id;
11391
11391
  bucket;
11392
11392
  path;
11393
- constructor(e, { fileId: t, bucket: n, path: r } = {}) {
11394
- super(e), this.fileId = t, this.bucket = n, this.path = r;
11393
+ constructor(e, { id: t, bucket: n, path: r } = {}) {
11394
+ super(e), this.id = t, this.bucket = n, this.path = r;
11395
11395
  }
11396
11396
  }, dm = class extends lm {
11397
11397
  schema;
@@ -11702,7 +11702,7 @@ function Tm(e) {
11702
11702
  return e.bucket !== void 0 && e.path !== void 0;
11703
11703
  }
11704
11704
  function Em(e) {
11705
- return e.fileId !== void 0 && e.bucket !== void 0;
11705
+ return e.id !== void 0 && e.bucket !== void 0;
11706
11706
  }
11707
11707
  var Dm = class {
11708
11708
  client;
@@ -11728,21 +11728,21 @@ var Dm = class {
11728
11728
  if (Tm(e)) {
11729
11729
  let { id: t } = await this.getFileObject(e);
11730
11730
  return {
11731
- fileId: t,
11731
+ id: t,
11732
11732
  ...e
11733
11733
  };
11734
11734
  }
11735
- let { fileId: t } = e, n = await this.files.get(t, ["bucket_id", "path_tokens"]);
11736
- if (n === void 0) throw new um(`File with ID ${t} not found`, { fileId: t });
11735
+ let { id: t } = e, n = await this.files.get(t, ["bucket_id", "path_tokens"]);
11736
+ if (n === void 0) throw new um(`File with ID ${t} not found`, { id: t });
11737
11737
  return {
11738
- fileId: t,
11738
+ id: t,
11739
11739
  bucket: m.notNull(n.bucket_id, "bucket_id must not be null"),
11740
11740
  path: m.notNull(n.path_tokens, "path_tokens must not be null").join("/")
11741
11741
  };
11742
11742
  }
11743
11743
  async getFileInfo(e) {
11744
11744
  let t = await this.getFileStorageLocation(e), { id: n, bucketId: r, metadata: i, ...a } = await this.getFileObject(t);
11745
- return m(n === t.fileId, "file ID from storage client must match file ID from database"), m(r === t.bucket, "bucketId from storage client must match bucket from database"), {
11745
+ return m(n === t.id, "file ID from storage client must match file ID from database"), m(r === t.bucket, "bucketId from storage client must match bucket from database"), {
11746
11746
  ...a,
11747
11747
  ...t,
11748
11748
  metadata: i,
@@ -11773,24 +11773,24 @@ var Dm = class {
11773
11773
  let { data: i, error: a } = await this.client.from(t).upload(`${n}/${e.name}`, e, { upsert: r });
11774
11774
  if (a) throw a;
11775
11775
  return {
11776
- fileId: i.id,
11776
+ id: i.id,
11777
11777
  bucket: t,
11778
11778
  path: i.path
11779
11779
  };
11780
11780
  }
11781
11781
  async downloadFile(e) {
11782
- let { fileId: t, bucket: n, path: r, properties: i } = await this.getFileInfo(e), { data: a, error: o } = await this.client.from(n).download(r);
11782
+ let { id: t, bucket: n, path: r, properties: i } = await this.getFileInfo(e), { data: a, error: o } = await this.client.from(n).download(r);
11783
11783
  if (o) throw o;
11784
11784
  let [, s] = fm(r);
11785
11785
  return {
11786
- fileId: t,
11786
+ id: t,
11787
11787
  bucket: n,
11788
11788
  path: r,
11789
11789
  file: new File([a], s, i)
11790
11790
  };
11791
11791
  }
11792
11792
  async deleteFiles(e) {
11793
- let t = e.filter((e) => "fileId" in e).map((e) => e.fileId), n = (await this.files.query.select(["bucket_id", "path_tokens"]).containedBy("id", t).throwOnError()).data.map(({ bucket_id: e, path_tokens: t }) => ({
11793
+ let t = e.filter((e) => "id" in e).map((e) => e.id), n = (await this.files.query.select(["bucket_id", "path_tokens"]).containedBy("id", t).throwOnError()).data.map(({ bucket_id: e, path_tokens: t }) => ({
11794
11794
  bucket: m.notNull(e, "bucket_id must not be null"),
11795
11795
  path: m.notNull(t, "path_tokens must not be null").join("/")
11796
11796
  })), r = hm(mm(e.filter((e) => Tm(e)).concat(n), (e) => e.bucket)).map(([e, t]) => ({
@@ -11800,7 +11800,7 @@ var Dm = class {
11800
11800
  return (await Promise.all(r.map(async ({ bucket: e, paths: t }) => this.client.from(e).remove(t).then(({ data: n, error: r }) => {
11801
11801
  if (r) throw r;
11802
11802
  return n.map((n, r) => ({
11803
- fileId: m.notNull(n.id, "file id must not be null"),
11803
+ id: m.notNull(n.id, "file id must not be null"),
11804
11804
  bucket: e,
11805
11805
  path: m.defined(t[r], "path must not be null")
11806
11806
  }));
@@ -11812,7 +11812,12 @@ var Dm = class {
11812
11812
  constructor(e, { fileName: t, fileType: n, ...r } = {}) {
11813
11813
  super(e, r), this.fileName = t, this.fileType = n;
11814
11814
  }
11815
- }, km = class {
11815
+ }, km = class extends lm {
11816
+ location;
11817
+ constructor(e, { location: t, ...n }) {
11818
+ super(e, n), this.location = t;
11819
+ }
11820
+ }, Am = class {
11816
11821
  database;
11817
11822
  storage;
11818
11823
  vectorStore;
@@ -11886,7 +11891,7 @@ var Dm = class {
11886
11891
  })));
11887
11892
  return await this.vectorStore.addDocuments(o), o;
11888
11893
  }
11889
- async deleteEmbeddings({ fileId: e }) {
11894
+ async deleteEmbeddings({ id: e }) {
11890
11895
  let { data: t } = await this.embeddings.query.select(["id"]).eq("file_id", e).throwOnError(), n = t.map(({ id: e }) => e);
11891
11896
  return await this.vectorStore.delete({ ids: n }), n;
11892
11897
  }
@@ -11895,14 +11900,19 @@ var Dm = class {
11895
11900
  }
11896
11901
  async ingest(e, t) {
11897
11902
  let n = await this.storage.getFileStorageLocation(e);
11898
- return this.updateEmbeddings(n, typeof t == "function" ? t(n) : t);
11903
+ return this.updateEmbeddings(n, typeof t == "function" ? t(n) : t).catch((e) => {
11904
+ throw new km("Failed to update embedding", {
11905
+ cause: e,
11906
+ location: n
11907
+ });
11908
+ });
11899
11909
  }
11900
11910
  async update(e, t) {
11901
11911
  let { data: n } = await this.database.schema("langchain").rpc("get_outdated_embeddings", { bucket: e }).throwOnError();
11902
11912
  return Promise.allSettled(n.map(async ({ bucket_id: e, path_tokens: n, file_id: r }) => this.ingest({
11903
11913
  bucket: e,
11904
11914
  path: n.join("/"),
11905
- fileId: r
11915
+ id: r
11906
11916
  }, t)));
11907
11917
  }
11908
11918
  retriever(e) {
@@ -11910,4 +11920,4 @@ var Dm = class {
11910
11920
  }
11911
11921
  };
11912
11922
  //#endregion
11913
- export { km as EmbeddingService, Om as FileNotSupportedError };
11923
+ export { km as EmbeddingError, Am as EmbeddingService, Om as FileNotSupportedError };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "private": false,
4
4
  "displayName": "Supabase-Langchain",
5
5
  "description": "Integration package for using LangChain with Supabase",
6
- "version": "1.2.1",
6
+ "version": "1.2.3",
7
7
  "type": "module",
8
8
  "repository": {
9
9
  "type": "git",
@@ -38,14 +38,14 @@
38
38
  "srt-parser-2": "^1.2.3"
39
39
  },
40
40
  "peerDependencies": {
41
- "@freehour/supabase-core": "^2.4.0",
41
+ "@freehour/supabase-core": "^2.5.1",
42
42
  "@supabase/supabase-js": "^2.106.2"
43
43
  },
44
44
  "overrides": {
45
45
  "@browserbasehq/stagehand": "3.2.1"
46
46
  },
47
47
  "devDependencies": {
48
- "@freehour/supabase-core": "^2.5.0",
48
+ "@freehour/supabase-core": "^2.5.1",
49
49
  "@freehour/eslint-rules": "^1.0.19",
50
50
  "@supabase/supabase-js": "^2.106.2",
51
51
  "ajv": "^8.20.0",