@nicia-ai/typegraph 0.29.0 → 0.31.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/README.md +39 -0
- package/dist/backend/postgres/index.cjs +21 -20
- package/dist/backend/postgres/index.d.cts +6 -6
- package/dist/backend/postgres/index.d.ts +6 -6
- package/dist/backend/postgres/index.js +11 -10
- package/dist/backend/postgres/pglite.cjs +16 -15
- package/dist/backend/postgres/pglite.cjs.map +1 -1
- package/dist/backend/postgres/pglite.d.cts +3 -3
- package/dist/backend/postgres/pglite.d.ts +3 -3
- package/dist/backend/postgres/pglite.js +11 -10
- package/dist/backend/postgres/pglite.js.map +1 -1
- package/dist/backend/sqlite/index.cjs +18 -18
- package/dist/backend/sqlite/index.d.cts +12 -7
- package/dist/backend/sqlite/index.d.ts +12 -7
- package/dist/backend/sqlite/index.js +9 -9
- package/dist/backend/sqlite/libsql.cjs +14 -14
- package/dist/backend/sqlite/libsql.d.cts +3 -3
- package/dist/backend/sqlite/libsql.d.ts +3 -3
- package/dist/backend/sqlite/libsql.js +10 -10
- package/dist/backend/sqlite/local.cjs +17 -16
- package/dist/backend/sqlite/local.cjs.map +1 -1
- package/dist/backend/sqlite/local.d.cts +9 -3
- package/dist/backend/sqlite/local.d.ts +9 -3
- package/dist/backend/sqlite/local.js +12 -11
- package/dist/backend/sqlite/local.js.map +1 -1
- package/dist/{chunk-7KLVFWXR.js → chunk-2HZGWCB4.js} +121 -497
- package/dist/chunk-2HZGWCB4.js.map +1 -0
- package/dist/chunk-2YMGNYXY.js +40 -0
- package/dist/chunk-2YMGNYXY.js.map +1 -0
- package/dist/chunk-2ZY4K43M.js +90 -0
- package/dist/chunk-2ZY4K43M.js.map +1 -0
- package/dist/chunk-3EUKJEQ3.js +77 -0
- package/dist/chunk-3EUKJEQ3.js.map +1 -0
- package/dist/chunk-3JBJEYWE.cjs +604 -0
- package/dist/chunk-3JBJEYWE.cjs.map +1 -0
- package/dist/{chunk-A4H6QMV4.js → chunk-4A4GUZTQ.js} +15 -11
- package/dist/chunk-4A4GUZTQ.js.map +1 -0
- package/dist/{chunk-F2Q76CQ4.cjs → chunk-54JVNOAQ.cjs} +5 -37
- package/dist/chunk-54JVNOAQ.cjs.map +1 -0
- package/dist/{chunk-KGAJ5HFO.cjs → chunk-5CN7B4CZ.cjs} +17 -98
- package/dist/chunk-5CN7B4CZ.cjs.map +1 -0
- package/dist/{chunk-XTQHSOIC.cjs → chunk-5DTPBFX5.cjs} +88 -87
- package/dist/chunk-5DTPBFX5.cjs.map +1 -0
- package/dist/chunk-6G35I3VW.cjs +40 -0
- package/dist/chunk-6G35I3VW.cjs.map +1 -0
- package/dist/{chunk-UPBXUOW7.cjs → chunk-6RMLO5O4.cjs} +19 -64
- package/dist/chunk-6RMLO5O4.cjs.map +1 -0
- package/dist/chunk-6SA7UIQJ.cjs +94 -0
- package/dist/chunk-6SA7UIQJ.cjs.map +1 -0
- package/dist/chunk-6ZR4QC3O.cjs +12 -0
- package/dist/{chunk-Q3ZZLU3O.cjs.map → chunk-6ZR4QC3O.cjs.map} +1 -1
- package/dist/chunk-73KASJGO.cjs +52 -0
- package/dist/chunk-73KASJGO.cjs.map +1 -0
- package/dist/{chunk-R2LA6MKR.cjs → chunk-7JGLPAFV.cjs} +8 -8
- package/dist/{chunk-R2LA6MKR.cjs.map → chunk-7JGLPAFV.cjs.map} +1 -1
- package/dist/chunk-A3W7QG7K.js +45 -0
- package/dist/chunk-A3W7QG7K.js.map +1 -0
- package/dist/{chunk-Q5ASTPM4.cjs → chunk-ASYQDPPU.cjs} +19 -19
- package/dist/{chunk-Q5ASTPM4.cjs.map → chunk-ASYQDPPU.cjs.map} +1 -1
- package/dist/{chunk-IE2TPFBT.js → chunk-ATTXBMAX.js} +4 -74
- package/dist/chunk-ATTXBMAX.js.map +1 -0
- package/dist/chunk-AW4A3P5A.cjs +51 -0
- package/dist/chunk-AW4A3P5A.cjs.map +1 -0
- package/dist/{chunk-ZYQEXGYC.cjs → chunk-CIINW6PS.cjs} +92 -87
- package/dist/chunk-CIINW6PS.cjs.map +1 -0
- package/dist/{chunk-UP4QAJND.cjs → chunk-FLOI7QOT.cjs} +66 -65
- package/dist/chunk-FLOI7QOT.cjs.map +1 -0
- package/dist/{chunk-7V335GHG.cjs → chunk-FLRCVI2G.cjs} +12 -2
- package/dist/chunk-FLRCVI2G.cjs.map +1 -0
- package/dist/{chunk-HKN622O4.js → chunk-GKFWM3DS.js} +4 -32
- package/dist/chunk-GKFWM3DS.js.map +1 -0
- package/dist/chunk-HTGDWIDE.cjs +89 -0
- package/dist/chunk-HTGDWIDE.cjs.map +1 -0
- package/dist/{chunk-OGUH56BB.js → chunk-IJORSAC3.js} +6 -42
- package/dist/chunk-IJORSAC3.js.map +1 -0
- package/dist/{chunk-G6P3OVDY.cjs → chunk-JIEJCTDS.cjs} +18 -2
- package/dist/chunk-JIEJCTDS.cjs.map +1 -0
- package/dist/{chunk-NZ5PMBTG.js → chunk-K5P5OZXS.js} +12 -3
- package/dist/chunk-K5P5OZXS.js.map +1 -0
- package/dist/{chunk-HM6XMR3E.cjs → chunk-KTIEB7VH.cjs} +42 -32
- package/dist/chunk-KTIEB7VH.cjs.map +1 -0
- package/dist/chunk-LJLMDDCW.js +282 -0
- package/dist/chunk-LJLMDDCW.js.map +1 -0
- package/dist/{chunk-Z36W5WUM.js → chunk-MAQJYNJR.js} +3 -3
- package/dist/{chunk-Z36W5WUM.js.map → chunk-MAQJYNJR.js.map} +1 -1
- package/dist/{chunk-N3VVQDMA.js → chunk-MXE2U3EX.js} +3 -3
- package/dist/{chunk-N3VVQDMA.js.map → chunk-MXE2U3EX.js.map} +1 -1
- package/dist/{chunk-4K6IHUW6.cjs → chunk-N2MBPTAF.cjs} +14 -14
- package/dist/{chunk-4K6IHUW6.cjs.map → chunk-N2MBPTAF.cjs.map} +1 -1
- package/dist/{chunk-CUZGBWFT.js → chunk-O4VUR6SI.js} +3 -3
- package/dist/{chunk-CUZGBWFT.js.map → chunk-O4VUR6SI.js.map} +1 -1
- package/dist/chunk-RZ4DH4E7.cjs +15832 -0
- package/dist/chunk-RZ4DH4E7.cjs.map +1 -0
- package/dist/chunk-SAJSMR2B.js +35 -0
- package/dist/chunk-SAJSMR2B.js.map +1 -0
- package/dist/{chunk-RU5BBUU2.cjs → chunk-SFFJ2IKN.cjs} +71 -67
- package/dist/chunk-SFFJ2IKN.cjs.map +1 -0
- package/dist/{chunk-Y52UNT66.js → chunk-STP7QVUB.js} +8 -7
- package/dist/chunk-STP7QVUB.js.map +1 -0
- package/dist/chunk-THX25XW6.js +590 -0
- package/dist/chunk-THX25XW6.js.map +1 -0
- package/dist/{chunk-MB363HT5.js → chunk-TQOYM4LN.js} +18 -3
- package/dist/chunk-TQOYM4LN.js.map +1 -0
- package/dist/chunk-UIFEEPME.js +15787 -0
- package/dist/chunk-UIFEEPME.js.map +1 -0
- package/dist/{chunk-GPUNAJFH.js → chunk-UJ4V3YUQ.js} +3 -3
- package/dist/{chunk-GPUNAJFH.js.map → chunk-UJ4V3YUQ.js.map} +1 -1
- package/dist/{chunk-C2RWFIYP.cjs → chunk-V4IQYOQ4.cjs} +127 -511
- package/dist/chunk-V4IQYOQ4.cjs.map +1 -0
- package/dist/chunk-VMEWZU2N.cjs +287 -0
- package/dist/chunk-VMEWZU2N.cjs.map +1 -0
- package/dist/{chunk-3DTLDGIM.js → chunk-VZX2KSY3.js} +14 -9
- package/dist/chunk-VZX2KSY3.js.map +1 -0
- package/dist/{chunk-BMDF2S7S.js → chunk-WYTUF3QO.js} +3 -3
- package/dist/{chunk-BMDF2S7S.js.map → chunk-WYTUF3QO.js.map} +1 -1
- package/dist/{chunk-MRMD7S7E.js → chunk-XKJQQQVR.js} +9 -8
- package/dist/chunk-XKJQQQVR.js.map +1 -0
- package/dist/{chunk-SFNUHFON.js → chunk-YCV72E6L.js} +25 -19
- package/dist/chunk-YCV72E6L.js.map +1 -0
- package/dist/{chunk-VGU26WIU.cjs → chunk-YQGLVWB2.cjs} +4 -4
- package/dist/{chunk-VGU26WIU.cjs.map → chunk-YQGLVWB2.cjs.map} +1 -1
- package/dist/{ddl-BwH00BB6.d.ts → ddl-BJcPrB4L.d.ts} +3 -3
- package/dist/{ddl-D3o-RmsV.d.cts → ddl-CPZ7mB7X.d.cts} +3 -3
- package/dist/{extension-types-CwHV-Uk4.d.ts → extension-types-D1k0inWU.d.cts} +1 -1
- package/dist/{extension-types-CwHV-Uk4.d.cts → extension-types-D1k0inWU.d.ts} +1 -1
- package/dist/graph-extension/index.cjs +19 -19
- package/dist/graph-extension/index.d.cts +5 -16
- package/dist/graph-extension/index.d.ts +5 -16
- package/dist/graph-extension/index.js +4 -4
- package/dist/graph-merge/index.cjs +3822 -0
- package/dist/graph-merge/index.cjs.map +1 -0
- package/dist/graph-merge/index.d.cts +1191 -0
- package/dist/graph-merge/index.d.ts +1191 -0
- package/dist/graph-merge/index.js +3791 -0
- package/dist/graph-merge/index.js.map +1 -0
- package/dist/{index-CapHwi1a.d.ts → index-BEK0VtNB.d.ts} +11 -3
- package/dist/{index-jPPexxM5.d.cts → index-C8sSTErx.d.cts} +11 -3
- package/dist/index.cjs +365 -15732
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -11
- package/dist/index.d.ts +12 -11
- package/dist/index.js +27 -15533
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.cjs +32 -28
- package/dist/indexes/index.d.cts +5 -5
- package/dist/indexes/index.d.ts +5 -5
- package/dist/indexes/index.js +8 -4
- package/dist/interchange/index.cjs +50 -593
- package/dist/interchange/index.cjs.map +1 -1
- package/dist/interchange/index.d.cts +5 -5
- package/dist/interchange/index.d.ts +5 -5
- package/dist/interchange/index.js +3 -589
- package/dist/interchange/index.js.map +1 -1
- package/dist/{manager-BUugwCYz.d.ts → manager-By-WEd8M.d.ts} +3 -3
- package/dist/{manager-DpIpn1HQ.d.cts → manager-Np7VVSlE.d.cts} +3 -3
- package/dist/{materialize-indexes-lkawaDor.d.ts → materialize-indexes-CAGhqPHQ.d.ts} +1 -1
- package/dist/{materialize-indexes-oanE3RU0.d.cts → materialize-indexes-DEYkU-wr.d.cts} +1 -1
- package/dist/{postgres-CQL9UIn2.d.cts → postgres-4J2tmauh.d.cts} +1 -1
- package/dist/{postgres-CcRLaxz0.d.ts → postgres-BdIb7tS_.d.ts} +1 -1
- package/dist/profiler/index.cjs +9 -9
- package/dist/profiler/index.d.cts +7 -7
- package/dist/profiler/index.d.ts +7 -7
- package/dist/profiler/index.js +2 -2
- package/dist/result-DWo6mUVz.d.cts +37 -0
- package/dist/result-DWo6mUVz.d.ts +37 -0
- package/dist/schema/index.cjs +33 -32
- package/dist/schema/index.cjs.map +1 -1
- package/dist/schema/index.d.cts +7 -7
- package/dist/schema/index.d.ts +7 -7
- package/dist/schema/index.js +10 -9
- package/dist/schema/index.js.map +1 -1
- package/dist/{sqlite-Rj3xu4It.d.cts → sqlite-Gatk_iw_.d.cts} +1 -1
- package/dist/{sqlite-CZDFUfHS.d.ts → sqlite-aM_PAz-O.d.ts} +1 -1
- package/dist/{store-B43FpOVX.d.cts → store-DuCbdqsh.d.cts} +84 -44
- package/dist/{store-De0Y33wP.d.ts → store-MloRPwb9.d.ts} +84 -44
- package/dist/{types-DXCSyxac.d.cts → types-BKQljXom.d.ts} +18 -2
- package/dist/{types-CmAT-Z47.d.ts → types-C1CYxWrL.d.cts} +18 -2
- package/dist/{types-Bwlp_yvu.d.cts → types-DoByHGyU.d.cts} +2 -2
- package/dist/{types-B5GSeE3t.d.ts → types-K3vpaJAL.d.ts} +2 -2
- package/dist/{where-CP4qGIHd.d.ts → where-Dt49bvo6.d.ts} +2 -2
- package/dist/{where-2dsyYt3d.d.cts → where-DydZjGOb.d.cts} +2 -2
- package/package.json +6 -1
- package/dist/chunk-3DTLDGIM.js.map +0 -1
- package/dist/chunk-7KLVFWXR.js.map +0 -1
- package/dist/chunk-7V335GHG.cjs.map +0 -1
- package/dist/chunk-A4H6QMV4.js.map +0 -1
- package/dist/chunk-C2RWFIYP.cjs.map +0 -1
- package/dist/chunk-F2Q76CQ4.cjs.map +0 -1
- package/dist/chunk-G6P3OVDY.cjs.map +0 -1
- package/dist/chunk-HKN622O4.js.map +0 -1
- package/dist/chunk-HM6XMR3E.cjs.map +0 -1
- package/dist/chunk-IE2TPFBT.js.map +0 -1
- package/dist/chunk-KGAJ5HFO.cjs.map +0 -1
- package/dist/chunk-MB363HT5.js.map +0 -1
- package/dist/chunk-MRMD7S7E.js.map +0 -1
- package/dist/chunk-NZ5PMBTG.js.map +0 -1
- package/dist/chunk-OGUH56BB.js.map +0 -1
- package/dist/chunk-Q3ZZLU3O.cjs +0 -12
- package/dist/chunk-RU5BBUU2.cjs.map +0 -1
- package/dist/chunk-SFNUHFON.js.map +0 -1
- package/dist/chunk-UP4QAJND.cjs.map +0 -1
- package/dist/chunk-UPBXUOW7.cjs.map +0 -1
- package/dist/chunk-XTQHSOIC.cjs.map +0 -1
- package/dist/chunk-Y52UNT66.js.map +0 -1
- package/dist/chunk-ZYQEXGYC.cjs.map +0 -1
package/README.md
CHANGED
|
@@ -46,6 +46,45 @@ See the repo README for more.
|
|
|
46
46
|
|
|
47
47
|
Examples: [github.com/nicia-ai/typegraph/tree/main/packages/typegraph/examples](https://github.com/nicia-ai/typegraph/tree/main/packages/typegraph/examples)
|
|
48
48
|
|
|
49
|
+
## Graph Merge
|
|
50
|
+
|
|
51
|
+
TypeGraph ships semantic graph merge as a dedicated subpath:
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import { branch, merge } from "@nicia-ai/typegraph/graph-merge";
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`branch()` creates isolated working copies over caller-provided backends, stamped
|
|
58
|
+
with the base graph's schema and content version. `merge()` reconciles those
|
|
59
|
+
branches back into a target graph with deterministic entity resolution, conflict
|
|
60
|
+
reporting, edge repointing, optional ontology type reconciliation, and provenance
|
|
61
|
+
reporting.
|
|
62
|
+
|
|
63
|
+
Use it when several agents, importers, reviewers, or local workers edit graph
|
|
64
|
+
state independently and the application needs one canonical result instead of an
|
|
65
|
+
append-only pile of duplicates. The merge pipeline can:
|
|
66
|
+
|
|
67
|
+
- resolve duplicate entities by exact unique constraints, blocking keys,
|
|
68
|
+
fulltext/custom similarity, or vector/hybrid similarity;
|
|
69
|
+
- preserve branch-specific context by repointing edges to canonical nodes;
|
|
70
|
+
- surface property and delete/modify conflicts (for nodes and edges) in a
|
|
71
|
+
`MergeReport`, three-way merged against base so disjoint edits compose;
|
|
72
|
+
- expose report-only provenance, with optional sidecar persistence you can query.
|
|
73
|
+
|
|
74
|
+
`merge()` is a snapshot merge (all branches forked from the current base);
|
|
75
|
+
`mergeIncremental()` additively folds a new source into a target that has already
|
|
76
|
+
advanced, re-discovering committed entities instead of duplicating them — the
|
|
77
|
+
primitive for continuous ingestion.
|
|
78
|
+
|
|
79
|
+
It lives in the core package because the primitive is defined over TypeGraph
|
|
80
|
+
stores, schemas, indexes, backends, and ontology semantics rather than as a
|
|
81
|
+
separate product surface.
|
|
82
|
+
|
|
83
|
+
Docs: [Graph Merge](https://typegraph.dev/graph-merge)
|
|
84
|
+
|
|
85
|
+
Examples: [FHIR Graph Merge](https://typegraph.dev/examples/fhir-graph-merge)
|
|
86
|
+
· [Incremental Merge](https://typegraph.dev/examples/incremental-merge)
|
|
87
|
+
|
|
49
88
|
## Performance Smoke Check
|
|
50
89
|
|
|
51
90
|
The perf harness lives in `@nicia-ai/typegraph-benchmarks`; these commands delegate to it.
|
|
@@ -1,58 +1,59 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-
|
|
5
|
-
|
|
6
|
-
require('../../chunk-
|
|
3
|
+
var chunkFLOI7QOT_cjs = require('../../chunk-FLOI7QOT.cjs');
|
|
4
|
+
require('../../chunk-5CN7B4CZ.cjs');
|
|
5
|
+
require('../../chunk-HTGDWIDE.cjs');
|
|
6
|
+
var chunkCIINW6PS_cjs = require('../../chunk-CIINW6PS.cjs');
|
|
7
|
+
require('../../chunk-54JVNOAQ.cjs');
|
|
8
|
+
require('../../chunk-VMEWZU2N.cjs');
|
|
9
|
+
require('../../chunk-6G35I3VW.cjs');
|
|
7
10
|
require('../../chunk-RP7YITHX.cjs');
|
|
8
|
-
require('../../chunk-
|
|
9
|
-
require('../../chunk-
|
|
10
|
-
require('../../chunk-
|
|
11
|
-
require('../../chunk-
|
|
12
|
-
require('../../chunk-G6P3OVDY.cjs');
|
|
13
|
-
require('../../chunk-7V335GHG.cjs');
|
|
11
|
+
require('../../chunk-V4IQYOQ4.cjs');
|
|
12
|
+
require('../../chunk-73KASJGO.cjs');
|
|
13
|
+
require('../../chunk-JIEJCTDS.cjs');
|
|
14
|
+
require('../../chunk-FLRCVI2G.cjs');
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
Object.defineProperty(exports, "createPostgresBackend", {
|
|
18
19
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
20
|
+
get: function () { return chunkFLOI7QOT_cjs.createPostgresBackend; }
|
|
20
21
|
});
|
|
21
22
|
Object.defineProperty(exports, "createPostgresTables", {
|
|
22
23
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
24
|
+
get: function () { return chunkCIINW6PS_cjs.createPostgresTables; }
|
|
24
25
|
});
|
|
25
26
|
Object.defineProperty(exports, "edges", {
|
|
26
27
|
enumerable: true,
|
|
27
|
-
get: function () { return
|
|
28
|
+
get: function () { return chunkCIINW6PS_cjs.edges; }
|
|
28
29
|
});
|
|
29
30
|
Object.defineProperty(exports, "fulltext", {
|
|
30
31
|
enumerable: true,
|
|
31
|
-
get: function () { return
|
|
32
|
+
get: function () { return chunkCIINW6PS_cjs.fulltext; }
|
|
32
33
|
});
|
|
33
34
|
Object.defineProperty(exports, "generatePostgresDDL", {
|
|
34
35
|
enumerable: true,
|
|
35
|
-
get: function () { return
|
|
36
|
+
get: function () { return chunkCIINW6PS_cjs.generatePostgresDDL; }
|
|
36
37
|
});
|
|
37
38
|
Object.defineProperty(exports, "generatePostgresMigrationSQL", {
|
|
38
39
|
enumerable: true,
|
|
39
|
-
get: function () { return
|
|
40
|
+
get: function () { return chunkCIINW6PS_cjs.generatePostgresMigrationSQL; }
|
|
40
41
|
});
|
|
41
42
|
Object.defineProperty(exports, "nodes", {
|
|
42
43
|
enumerable: true,
|
|
43
|
-
get: function () { return
|
|
44
|
+
get: function () { return chunkCIINW6PS_cjs.nodes; }
|
|
44
45
|
});
|
|
45
46
|
Object.defineProperty(exports, "schemaVersions", {
|
|
46
47
|
enumerable: true,
|
|
47
|
-
get: function () { return
|
|
48
|
+
get: function () { return chunkCIINW6PS_cjs.schemaVersions; }
|
|
48
49
|
});
|
|
49
50
|
Object.defineProperty(exports, "tables", {
|
|
50
51
|
enumerable: true,
|
|
51
|
-
get: function () { return
|
|
52
|
+
get: function () { return chunkCIINW6PS_cjs.tables; }
|
|
52
53
|
});
|
|
53
54
|
Object.defineProperty(exports, "uniques", {
|
|
54
55
|
enumerable: true,
|
|
55
|
-
get: function () { return
|
|
56
|
+
get: function () { return chunkCIINW6PS_cjs.uniques; }
|
|
56
57
|
});
|
|
57
58
|
//# sourceMappingURL=index.cjs.map
|
|
58
59
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { F as FulltextStrategy, V as VectorStrategy, B as BackendCapabilities, b as AnyPgDatabase, G as GraphBackend } from '../../types-
|
|
2
|
-
import { P as PostgresTables } from '../../postgres-
|
|
3
|
-
export { C as CreatePostgresTablesOptions, a as PostgresTableNames, c as createPostgresTables, e as edges, f as fulltext, n as nodes, s as schemaVersions, t as tables, u as uniques } from '../../postgres-
|
|
4
|
-
export { b as generatePostgresDDL, c as generatePostgresMigrationSQL } from '../../ddl-
|
|
1
|
+
import { F as FulltextStrategy, V as VectorStrategy, B as BackendCapabilities, b as AnyPgDatabase, G as GraphBackend } from '../../types-C1CYxWrL.cjs';
|
|
2
|
+
import { P as PostgresTables } from '../../postgres-4J2tmauh.cjs';
|
|
3
|
+
export { C as CreatePostgresTablesOptions, a as PostgresTableNames, c as createPostgresTables, e as edges, f as fulltext, n as nodes, s as schemaVersions, t as tables, u as uniques } from '../../postgres-4J2tmauh.cjs';
|
|
4
|
+
export { b as generatePostgresDDL, c as generatePostgresMigrationSQL } from '../../ddl-CPZ7mB7X.cjs';
|
|
5
5
|
import 'zod';
|
|
6
|
-
import '../../extension-types-
|
|
6
|
+
import '../../extension-types-D1k0inWU.cjs';
|
|
7
7
|
import 'drizzle-orm';
|
|
8
8
|
import 'drizzle-orm/pg-core';
|
|
9
9
|
import 'drizzle-orm/sqlite-core';
|
|
10
|
-
import '../../sqlite-
|
|
10
|
+
import '../../sqlite-Gatk_iw_.cjs';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Options for creating a PostgreSQL backend.
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { F as FulltextStrategy, V as VectorStrategy, B as BackendCapabilities, b as AnyPgDatabase, G as GraphBackend } from '../../types-
|
|
2
|
-
import { P as PostgresTables } from '../../postgres-
|
|
3
|
-
export { C as CreatePostgresTablesOptions, a as PostgresTableNames, c as createPostgresTables, e as edges, f as fulltext, n as nodes, s as schemaVersions, t as tables, u as uniques } from '../../postgres-
|
|
4
|
-
export { b as generatePostgresDDL, c as generatePostgresMigrationSQL } from '../../ddl-
|
|
1
|
+
import { F as FulltextStrategy, V as VectorStrategy, B as BackendCapabilities, b as AnyPgDatabase, G as GraphBackend } from '../../types-BKQljXom.js';
|
|
2
|
+
import { P as PostgresTables } from '../../postgres-BdIb7tS_.js';
|
|
3
|
+
export { C as CreatePostgresTablesOptions, a as PostgresTableNames, c as createPostgresTables, e as edges, f as fulltext, n as nodes, s as schemaVersions, t as tables, u as uniques } from '../../postgres-BdIb7tS_.js';
|
|
4
|
+
export { b as generatePostgresDDL, c as generatePostgresMigrationSQL } from '../../ddl-BJcPrB4L.js';
|
|
5
5
|
import 'zod';
|
|
6
|
-
import '../../extension-types-
|
|
6
|
+
import '../../extension-types-D1k0inWU.js';
|
|
7
7
|
import 'drizzle-orm';
|
|
8
8
|
import 'drizzle-orm/pg-core';
|
|
9
9
|
import 'drizzle-orm/sqlite-core';
|
|
10
|
-
import '../../sqlite-
|
|
10
|
+
import '../../sqlite-aM_PAz-O.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Options for creating a PostgreSQL backend.
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
export { createPostgresBackend } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export { createPostgresBackend } from '../../chunk-STP7QVUB.js';
|
|
2
|
+
import '../../chunk-ATTXBMAX.js';
|
|
3
|
+
import '../../chunk-3EUKJEQ3.js';
|
|
4
|
+
export { createPostgresTables, edges, fulltext, generatePostgresDDL, generatePostgresMigrationSQL, nodes, schemaVersions, tables, uniques } from '../../chunk-VZX2KSY3.js';
|
|
5
|
+
import '../../chunk-GKFWM3DS.js';
|
|
6
|
+
import '../../chunk-LJLMDDCW.js';
|
|
7
|
+
import '../../chunk-SAJSMR2B.js';
|
|
5
8
|
import '../../chunk-M6OC455F.js';
|
|
6
|
-
import '../../chunk-
|
|
7
|
-
import '../../chunk-
|
|
8
|
-
import '../../chunk-
|
|
9
|
-
import '../../chunk-
|
|
10
|
-
import '../../chunk-MB363HT5.js';
|
|
11
|
-
import '../../chunk-NZ5PMBTG.js';
|
|
9
|
+
import '../../chunk-2HZGWCB4.js';
|
|
10
|
+
import '../../chunk-2YMGNYXY.js';
|
|
11
|
+
import '../../chunk-TQOYM4LN.js';
|
|
12
|
+
import '../../chunk-K5P5OZXS.js';
|
|
12
13
|
//# sourceMappingURL=index.js.map
|
|
13
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-
|
|
5
|
-
|
|
6
|
-
var
|
|
3
|
+
var chunkFLOI7QOT_cjs = require('../../chunk-FLOI7QOT.cjs');
|
|
4
|
+
require('../../chunk-5CN7B4CZ.cjs');
|
|
5
|
+
require('../../chunk-HTGDWIDE.cjs');
|
|
6
|
+
var chunkCIINW6PS_cjs = require('../../chunk-CIINW6PS.cjs');
|
|
7
|
+
require('../../chunk-54JVNOAQ.cjs');
|
|
8
|
+
require('../../chunk-VMEWZU2N.cjs');
|
|
9
|
+
var chunk6G35I3VW_cjs = require('../../chunk-6G35I3VW.cjs');
|
|
7
10
|
require('../../chunk-RP7YITHX.cjs');
|
|
8
|
-
require('../../chunk-
|
|
9
|
-
require('../../chunk-
|
|
10
|
-
require('../../chunk-
|
|
11
|
-
require('../../chunk-
|
|
12
|
-
var chunkG6P3OVDY_cjs = require('../../chunk-G6P3OVDY.cjs');
|
|
13
|
-
require('../../chunk-7V335GHG.cjs');
|
|
11
|
+
require('../../chunk-V4IQYOQ4.cjs');
|
|
12
|
+
require('../../chunk-73KASJGO.cjs');
|
|
13
|
+
var chunkJIEJCTDS_cjs = require('../../chunk-JIEJCTDS.cjs');
|
|
14
|
+
require('../../chunk-FLRCVI2G.cjs');
|
|
14
15
|
var pglite = require('@electric-sql/pglite');
|
|
15
16
|
var pglite$1 = require('drizzle-orm/pglite');
|
|
16
17
|
|
|
@@ -19,7 +20,7 @@ async function loadDefaultPgvectorExtension() {
|
|
|
19
20
|
const module_ = await import('@electric-sql/pglite-pgvector');
|
|
20
21
|
return module_.vector;
|
|
21
22
|
} catch (error) {
|
|
22
|
-
throw new
|
|
23
|
+
throw new chunkJIEJCTDS_cjs.ConfigurationError(
|
|
23
24
|
"createLocalPgliteBackend needs the pgvector extension but `@electric-sql/pglite-pgvector` could not be loaded. Install it (`pnpm add @electric-sql/pglite-pgvector`), pass your own `vector` extension, or set `vector: false` to disable vector support.",
|
|
24
25
|
{ backend: "pglite", dependency: "@electric-sql/pglite-pgvector" },
|
|
25
26
|
{ cause: error }
|
|
@@ -27,21 +28,21 @@ async function loadDefaultPgvectorExtension() {
|
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
async function createLocalPgliteBackend(options = {}) {
|
|
30
|
-
const tables2 = options.tables ??
|
|
31
|
+
const tables2 = options.tables ?? chunkCIINW6PS_cjs.tables;
|
|
31
32
|
const vectorExtension = options.vector === false ? void 0 : options.vector ?? await loadDefaultPgvectorExtension();
|
|
32
33
|
const vectorEnabled = vectorExtension !== void 0;
|
|
33
34
|
const client = await pglite.PGlite.create({
|
|
34
35
|
...options.dataDir === void 0 ? {} : { dataDir: options.dataDir },
|
|
35
36
|
...vectorExtension === void 0 ? {} : { extensions: { vector: vectorExtension } }
|
|
36
37
|
});
|
|
37
|
-
const migrationSql = vectorEnabled ?
|
|
38
|
+
const migrationSql = vectorEnabled ? chunkCIINW6PS_cjs.generatePostgresMigrationSQL(tables2) : chunkCIINW6PS_cjs.generatePostgresDDL(tables2).join("\n\n");
|
|
38
39
|
await client.exec(migrationSql);
|
|
39
40
|
const db = pglite$1.drizzle(client);
|
|
40
|
-
const backend =
|
|
41
|
+
const backend = chunkFLOI7QOT_cjs.createPostgresBackend(db, {
|
|
41
42
|
tables: tables2,
|
|
42
43
|
...vectorEnabled ? {} : { vector: false }
|
|
43
44
|
});
|
|
44
|
-
const managedBackend =
|
|
45
|
+
const managedBackend = chunk6G35I3VW_cjs.wrapWithManagedClose(backend, async () => {
|
|
45
46
|
await client.close();
|
|
46
47
|
});
|
|
47
48
|
return { backend: managedBackend, db, client };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/backend/postgres/pglite.ts"],"names":["ConfigurationError","tables","PGlite","generatePostgresMigrationSQL","generatePostgresDDL","drizzle","createPostgresBackend","wrapWithManagedClose"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/backend/postgres/pglite.ts"],"names":["ConfigurationError","tables","PGlite","generatePostgresMigrationSQL","generatePostgresDDL","drizzle","createPostgresBackend","wrapWithManagedClose"],"mappings":";;;;;;;;;;;;;;;;;AA2HA,eAAe,4BAAA,GAAmD;AAChE,EAAA,IAAI;AACF,IAAA,MAAM,OAAA,GAAU,MAAM,OAAO,+BAA+B,CAAA;AAC5D,IAAA,OAAO,OAAA,CAAQ,MAAA;AAAA,EACjB,SAAS,KAAA,EAAO;AACd,IAAA,MAAM,IAAIA,oCAAA;AAAA,MACR,2PAAA;AAAA,MAIA,EAAE,OAAA,EAAS,QAAA,EAAU,UAAA,EAAY,+BAAA,EAAgC;AAAA,MACjE,EAAE,OAAO,KAAA;AAAM,KACjB;AAAA,EACF;AACF;AAoBA,eAAsB,wBAAA,CACpB,OAAA,GAAqC,EAAC,EACH;AACnC,EAAA,MAAMC,OAAAA,GAAS,QAAQ,MAAA,IAAUA,wBAAA;AAMjC,EAAA,MAAM,eAAA,GACJ,QAAQ,MAAA,KAAW,KAAA,GACjB,SACC,OAAA,CAAQ,MAAA,IAAW,MAAM,4BAAA,EAA6B;AAC3D,EAAA,MAAM,gBAAgB,eAAA,KAAoB,MAAA;AAO1C,EAAA,MAAM,MAAA,GAAS,MAAMC,aAAA,CAAO,MAAA,CAAO;AAAA,IACjC,GAAI,QAAQ,OAAA,KAAY,MAAA,GAAY,EAAC,GAAI,EAAE,OAAA,EAAS,OAAA,CAAQ,OAAA,EAAQ;AAAA,IACpE,GAAI,eAAA,KAAoB,MAAA,GACtB,EAAC,GACD,EAAE,UAAA,EAAY,EAAE,MAAA,EAAQ,eAAA,EAAgB;AAAE,GAC7C,CAAA;AAID,EAAA,MAAM,YAAA,GACJ,gBACEC,8CAAA,CAA6BF,OAAM,IACnCG,qCAAA,CAAoBH,OAAM,CAAA,CAAE,IAAA,CAAK,MAAM,CAAA;AAC3C,EAAA,MAAM,MAAA,CAAO,KAAK,YAAY,CAAA;AAE9B,EAAA,MAAM,EAAA,GAAKI,iBAAQ,MAAM,CAAA;AACzB,EAAA,MAAM,OAAA,GAAUC,wCAAsB,EAAA,EAAI;AAAA,IACxC,MAAA,EAAAL,OAAAA;AAAA,IACA,GAAI,aAAA,GAAgB,EAAC,GAAI,EAAE,QAAQ,KAAA;AAAM,GAC1C,CAAA;AACD,EAAA,MAAM,cAAA,GAAiBM,sCAAA,CAAqB,OAAA,EAAS,YAAY;AAC/D,IAAA,MAAM,OAAO,KAAA,EAAM;AAAA,EACrB,CAAC,CAAA;AAED,EAAA,OAAO,EAAE,OAAA,EAAS,cAAA,EAAgB,EAAA,EAAI,MAAA,EAAO;AAC/C","file":"pglite.cjs","sourcesContent":["/**\n * Local PGlite backend — Postgres-in-WASM, running in-process.\n *\n * [PGlite](https://pglite.dev/) is a full Postgres compiled to WebAssembly\n * that runs inside the Node/Bun/Deno/browser process with no server and no\n * native addon. This is the batteries-included Postgres analog of\n * `createLocalSqliteBackend`: it constructs a PGlite instance, loads the\n * pgvector extension, runs the schema DDL, and returns a ready\n * `{ backend, db }` pair whose `close()` disposes the engine.\n *\n * `@electric-sql/pglite` is an optional peer dependency. Vector support\n * additionally needs `@electric-sql/pglite-pgvector` (PGlite ≥ 0.5 ships\n * pgvector as a separate package). Install what you need:\n *\n * ```bash\n * pnpm add @electric-sql/pglite @electric-sql/pglite-pgvector\n * ```\n *\n * @example In-memory database (default, vector enabled)\n * ```typescript\n * import { createLocalPgliteBackend } from \"@nicia-ai/typegraph/postgres/pglite\";\n *\n * const { backend } = await createLocalPgliteBackend();\n * const store = createStore(graph, backend);\n * ```\n *\n * @example Persistent on-disk database\n * ```typescript\n * const { backend, db } = await createLocalPgliteBackend({ dataDir: \"./pgdata\" });\n * ```\n *\n * @example No vector support (skip the pgvector extension)\n * ```typescript\n * const { backend } = await createLocalPgliteBackend({ vector: false });\n * ```\n *\n * PGlite is single-connection and serial: there is no pooling, so concurrent\n * `store.transaction()` calls queue rather than run in parallel.\n */\nimport { type Extension, PGlite } from \"@electric-sql/pglite\";\nimport { drizzle, type PgliteDatabase } from \"drizzle-orm/pglite\";\n\nimport { ConfigurationError } from \"../../errors\";\nimport {\n generatePostgresDDL,\n generatePostgresMigrationSQL,\n} from \"../drizzle/ddl\";\nimport {\n createPostgresBackend,\n type PostgresTables,\n tables as defaultTables,\n} from \"../drizzle/postgres\";\nimport { type GraphBackend, wrapWithManagedClose } from \"../types\";\n\n// ============================================================\n// Types\n// ============================================================\n\n/**\n * Options for creating a local PGlite backend.\n */\nexport type LocalPgliteBackendOptions = Readonly<{\n /**\n * PGlite data directory. Omit for an in-memory database (the default).\n * Accepts any PGlite data-dir spec: a filesystem path (`\"./pgdata\"`),\n * `\"memory://\"`, or a browser/runtime-specific scheme such as\n * `\"idb://my-db\"`.\n */\n dataDir?: string;\n\n /**\n * Custom table definitions. Defaults to standard TypeGraph table names.\n */\n tables?: PostgresTables;\n\n /**\n * Controls the pgvector stack:\n *\n * - **omitted (default)** — load pgvector from `@electric-sql/pglite-pgvector`\n * and run `CREATE EXTENSION vector`, so embedding fields work out of the\n * box. Throws a {@link ConfigurationError} if the package isn't installed.\n * - **`false`** — skip the extension entirely; the backend advertises no\n * vector capability (mirroring a SQLite connection without sqlite-vec).\n * Use when a graph carries no embeddings, or to avoid the extension dep.\n * - **a PGlite `Extension`** — bring your own pgvector build or custom\n * extension packaging. Decouples this helper from a specific pgvector\n * package version.\n */\n vector?: false | Extension;\n}>;\n\n/**\n * Result of creating a local PGlite backend.\n */\nexport type LocalPgliteBackendResult = Readonly<{\n /**\n * The GraphBackend instance for use with createStore. Its `close()`\n * disposes the underlying PGlite engine.\n */\n backend: GraphBackend;\n\n /**\n * The underlying Drizzle database instance. Useful for direct SQL access.\n */\n db: PgliteDatabase;\n\n /**\n * The raw PGlite instance, for engine-specific operations such as\n * `dumpDataDir()` / `clone()` not surfaced through Drizzle.\n */\n client: PGlite;\n}>;\n\n// ============================================================\n// Vector extension loading\n// ============================================================\n\n/**\n * Dynamically loads the default pgvector extension from\n * `@electric-sql/pglite-pgvector`. Kept as a runtime import so the package\n * stays an optional peer dependency — callers using `vector: false` or\n * supplying their own extension never need it installed.\n */\nasync function loadDefaultPgvectorExtension(): Promise<Extension> {\n try {\n const module_ = await import(\"@electric-sql/pglite-pgvector\");\n return module_.vector;\n } catch (error) {\n throw new ConfigurationError(\n \"createLocalPgliteBackend needs the pgvector extension but \" +\n \"`@electric-sql/pglite-pgvector` could not be loaded. Install it \" +\n \"(`pnpm add @electric-sql/pglite-pgvector`), pass your own `vector` \" +\n \"extension, or set `vector: false` to disable vector support.\",\n { backend: \"pglite\", dependency: \"@electric-sql/pglite-pgvector\" },\n { cause: error },\n );\n }\n}\n\n// ============================================================\n// Factory Function\n// ============================================================\n\n/**\n * Creates a TypeGraph backend backed by an in-process PGlite database.\n *\n * Constructs the PGlite engine (loading pgvector unless disabled), executes\n * the schema DDL, and wires the standard Postgres backend. The returned\n * backend owns the engine: call `backend.close()` to dispose it.\n *\n * For production Postgres, or a PGlite instance you construct yourself,\n * use `createPostgresBackend` directly with your own Drizzle database — the\n * execution fast path detects PGlite and routes it correctly.\n *\n * @param options - Configuration options\n * @returns Backend, Drizzle database, and raw PGlite client\n */\nexport async function createLocalPgliteBackend(\n options: LocalPgliteBackendOptions = {},\n): Promise<LocalPgliteBackendResult> {\n const tables = options.tables ?? defaultTables;\n\n // pgvector lives in the WASM instance, so the extension must be passed at\n // construction — `CREATE EXTENSION vector` alone can't pull it in. An\n // explicitly supplied extension wins; `false` disables; otherwise load the\n // default package.\n const vectorExtension =\n options.vector === false ?\n undefined\n : (options.vector ?? (await loadDefaultPgvectorExtension()));\n const vectorEnabled = vectorExtension !== undefined;\n\n // Construct via the single options-object form (passing `dataDir` as a\n // field), not the positional `create(dataDir, options)` overload: with a\n // leading `undefined` dataDir, that overload silently drops `extensions`\n // (\"extension vector is not available\"). The options form loads them for\n // both the in-memory and on-disk cases.\n const client = await PGlite.create({\n ...(options.dataDir === undefined ? {} : { dataDir: options.dataDir }),\n ...(vectorExtension === undefined ?\n {}\n : { extensions: { vector: vectorExtension } }),\n });\n\n // `exec` runs a multi-statement batch (DDL + the pgvector `CREATE\n // EXTENSION` when enabled) in one round trip.\n const migrationSql =\n vectorEnabled ?\n generatePostgresMigrationSQL(tables)\n : generatePostgresDDL(tables).join(\"\\n\\n\");\n await client.exec(migrationSql);\n\n const db = drizzle(client);\n const backend = createPostgresBackend(db, {\n tables,\n ...(vectorEnabled ? {} : { vector: false }),\n });\n const managedBackend = wrapWithManagedClose(backend, async () => {\n await client.close();\n });\n\n return { backend: managedBackend, db, client };\n}\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Extension, PGlite } from '@electric-sql/pglite';
|
|
2
2
|
import { PgliteDatabase } from 'drizzle-orm/pglite';
|
|
3
|
-
import { G as GraphBackend } from '../../types-
|
|
4
|
-
import { P as PostgresTables } from '../../postgres-
|
|
3
|
+
import { G as GraphBackend } from '../../types-C1CYxWrL.cjs';
|
|
4
|
+
import { P as PostgresTables } from '../../postgres-4J2tmauh.cjs';
|
|
5
5
|
import 'zod';
|
|
6
|
-
import '../../extension-types-
|
|
6
|
+
import '../../extension-types-D1k0inWU.cjs';
|
|
7
7
|
import 'drizzle-orm';
|
|
8
8
|
import 'drizzle-orm/pg-core';
|
|
9
9
|
import 'drizzle-orm/sqlite-core';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Extension, PGlite } from '@electric-sql/pglite';
|
|
2
2
|
import { PgliteDatabase } from 'drizzle-orm/pglite';
|
|
3
|
-
import { G as GraphBackend } from '../../types-
|
|
4
|
-
import { P as PostgresTables } from '../../postgres-
|
|
3
|
+
import { G as GraphBackend } from '../../types-BKQljXom.js';
|
|
4
|
+
import { P as PostgresTables } from '../../postgres-BdIb7tS_.js';
|
|
5
5
|
import 'zod';
|
|
6
|
-
import '../../extension-types-
|
|
6
|
+
import '../../extension-types-D1k0inWU.js';
|
|
7
7
|
import 'drizzle-orm';
|
|
8
8
|
import 'drizzle-orm/pg-core';
|
|
9
9
|
import 'drizzle-orm/sqlite-core';
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { createPostgresBackend } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
1
|
+
import { createPostgresBackend } from '../../chunk-STP7QVUB.js';
|
|
2
|
+
import '../../chunk-ATTXBMAX.js';
|
|
3
|
+
import '../../chunk-3EUKJEQ3.js';
|
|
4
|
+
import { tables, generatePostgresMigrationSQL, generatePostgresDDL } from '../../chunk-VZX2KSY3.js';
|
|
5
|
+
import '../../chunk-GKFWM3DS.js';
|
|
6
|
+
import '../../chunk-LJLMDDCW.js';
|
|
7
|
+
import { wrapWithManagedClose } from '../../chunk-SAJSMR2B.js';
|
|
5
8
|
import '../../chunk-M6OC455F.js';
|
|
6
|
-
import '../../chunk-
|
|
7
|
-
import '../../chunk-
|
|
8
|
-
import '../../chunk-
|
|
9
|
-
import '../../chunk-
|
|
10
|
-
import { ConfigurationError } from '../../chunk-MB363HT5.js';
|
|
11
|
-
import '../../chunk-NZ5PMBTG.js';
|
|
9
|
+
import '../../chunk-2HZGWCB4.js';
|
|
10
|
+
import '../../chunk-2YMGNYXY.js';
|
|
11
|
+
import { ConfigurationError } from '../../chunk-TQOYM4LN.js';
|
|
12
|
+
import '../../chunk-K5P5OZXS.js';
|
|
12
13
|
import { PGlite } from '@electric-sql/pglite';
|
|
13
14
|
import { drizzle } from 'drizzle-orm/pglite';
|
|
14
15
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/backend/postgres/pglite.ts"],"names":["tables"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/backend/postgres/pglite.ts"],"names":["tables"],"mappings":";;;;;;;;;;;;;;;AA2HA,eAAe,4BAAA,GAAmD;AAChE,EAAA,IAAI;AACF,IAAA,MAAM,OAAA,GAAU,MAAM,OAAO,+BAA+B,CAAA;AAC5D,IAAA,OAAO,OAAA,CAAQ,MAAA;AAAA,EACjB,SAAS,KAAA,EAAO;AACd,IAAA,MAAM,IAAI,kBAAA;AAAA,MACR,2PAAA;AAAA,MAIA,EAAE,OAAA,EAAS,QAAA,EAAU,UAAA,EAAY,+BAAA,EAAgC;AAAA,MACjE,EAAE,OAAO,KAAA;AAAM,KACjB;AAAA,EACF;AACF;AAoBA,eAAsB,wBAAA,CACpB,OAAA,GAAqC,EAAC,EACH;AACnC,EAAA,MAAMA,OAAAA,GAAS,QAAQ,MAAA,IAAU,MAAA;AAMjC,EAAA,MAAM,eAAA,GACJ,QAAQ,MAAA,KAAW,KAAA,GACjB,SACC,OAAA,CAAQ,MAAA,IAAW,MAAM,4BAAA,EAA6B;AAC3D,EAAA,MAAM,gBAAgB,eAAA,KAAoB,MAAA;AAO1C,EAAA,MAAM,MAAA,GAAS,MAAM,MAAA,CAAO,MAAA,CAAO;AAAA,IACjC,GAAI,QAAQ,OAAA,KAAY,MAAA,GAAY,EAAC,GAAI,EAAE,OAAA,EAAS,OAAA,CAAQ,OAAA,EAAQ;AAAA,IACpE,GAAI,eAAA,KAAoB,MAAA,GACtB,EAAC,GACD,EAAE,UAAA,EAAY,EAAE,MAAA,EAAQ,eAAA,EAAgB;AAAE,GAC7C,CAAA;AAID,EAAA,MAAM,YAAA,GACJ,gBACE,4BAAA,CAA6BA,OAAM,IACnC,mBAAA,CAAoBA,OAAM,CAAA,CAAE,IAAA,CAAK,MAAM,CAAA;AAC3C,EAAA,MAAM,MAAA,CAAO,KAAK,YAAY,CAAA;AAE9B,EAAA,MAAM,EAAA,GAAK,QAAQ,MAAM,CAAA;AACzB,EAAA,MAAM,OAAA,GAAU,sBAAsB,EAAA,EAAI;AAAA,IACxC,MAAA,EAAAA,OAAAA;AAAA,IACA,GAAI,aAAA,GAAgB,EAAC,GAAI,EAAE,QAAQ,KAAA;AAAM,GAC1C,CAAA;AACD,EAAA,MAAM,cAAA,GAAiB,oBAAA,CAAqB,OAAA,EAAS,YAAY;AAC/D,IAAA,MAAM,OAAO,KAAA,EAAM;AAAA,EACrB,CAAC,CAAA;AAED,EAAA,OAAO,EAAE,OAAA,EAAS,cAAA,EAAgB,EAAA,EAAI,MAAA,EAAO;AAC/C","file":"pglite.js","sourcesContent":["/**\n * Local PGlite backend — Postgres-in-WASM, running in-process.\n *\n * [PGlite](https://pglite.dev/) is a full Postgres compiled to WebAssembly\n * that runs inside the Node/Bun/Deno/browser process with no server and no\n * native addon. This is the batteries-included Postgres analog of\n * `createLocalSqliteBackend`: it constructs a PGlite instance, loads the\n * pgvector extension, runs the schema DDL, and returns a ready\n * `{ backend, db }` pair whose `close()` disposes the engine.\n *\n * `@electric-sql/pglite` is an optional peer dependency. Vector support\n * additionally needs `@electric-sql/pglite-pgvector` (PGlite ≥ 0.5 ships\n * pgvector as a separate package). Install what you need:\n *\n * ```bash\n * pnpm add @electric-sql/pglite @electric-sql/pglite-pgvector\n * ```\n *\n * @example In-memory database (default, vector enabled)\n * ```typescript\n * import { createLocalPgliteBackend } from \"@nicia-ai/typegraph/postgres/pglite\";\n *\n * const { backend } = await createLocalPgliteBackend();\n * const store = createStore(graph, backend);\n * ```\n *\n * @example Persistent on-disk database\n * ```typescript\n * const { backend, db } = await createLocalPgliteBackend({ dataDir: \"./pgdata\" });\n * ```\n *\n * @example No vector support (skip the pgvector extension)\n * ```typescript\n * const { backend } = await createLocalPgliteBackend({ vector: false });\n * ```\n *\n * PGlite is single-connection and serial: there is no pooling, so concurrent\n * `store.transaction()` calls queue rather than run in parallel.\n */\nimport { type Extension, PGlite } from \"@electric-sql/pglite\";\nimport { drizzle, type PgliteDatabase } from \"drizzle-orm/pglite\";\n\nimport { ConfigurationError } from \"../../errors\";\nimport {\n generatePostgresDDL,\n generatePostgresMigrationSQL,\n} from \"../drizzle/ddl\";\nimport {\n createPostgresBackend,\n type PostgresTables,\n tables as defaultTables,\n} from \"../drizzle/postgres\";\nimport { type GraphBackend, wrapWithManagedClose } from \"../types\";\n\n// ============================================================\n// Types\n// ============================================================\n\n/**\n * Options for creating a local PGlite backend.\n */\nexport type LocalPgliteBackendOptions = Readonly<{\n /**\n * PGlite data directory. Omit for an in-memory database (the default).\n * Accepts any PGlite data-dir spec: a filesystem path (`\"./pgdata\"`),\n * `\"memory://\"`, or a browser/runtime-specific scheme such as\n * `\"idb://my-db\"`.\n */\n dataDir?: string;\n\n /**\n * Custom table definitions. Defaults to standard TypeGraph table names.\n */\n tables?: PostgresTables;\n\n /**\n * Controls the pgvector stack:\n *\n * - **omitted (default)** — load pgvector from `@electric-sql/pglite-pgvector`\n * and run `CREATE EXTENSION vector`, so embedding fields work out of the\n * box. Throws a {@link ConfigurationError} if the package isn't installed.\n * - **`false`** — skip the extension entirely; the backend advertises no\n * vector capability (mirroring a SQLite connection without sqlite-vec).\n * Use when a graph carries no embeddings, or to avoid the extension dep.\n * - **a PGlite `Extension`** — bring your own pgvector build or custom\n * extension packaging. Decouples this helper from a specific pgvector\n * package version.\n */\n vector?: false | Extension;\n}>;\n\n/**\n * Result of creating a local PGlite backend.\n */\nexport type LocalPgliteBackendResult = Readonly<{\n /**\n * The GraphBackend instance for use with createStore. Its `close()`\n * disposes the underlying PGlite engine.\n */\n backend: GraphBackend;\n\n /**\n * The underlying Drizzle database instance. Useful for direct SQL access.\n */\n db: PgliteDatabase;\n\n /**\n * The raw PGlite instance, for engine-specific operations such as\n * `dumpDataDir()` / `clone()` not surfaced through Drizzle.\n */\n client: PGlite;\n}>;\n\n// ============================================================\n// Vector extension loading\n// ============================================================\n\n/**\n * Dynamically loads the default pgvector extension from\n * `@electric-sql/pglite-pgvector`. Kept as a runtime import so the package\n * stays an optional peer dependency — callers using `vector: false` or\n * supplying their own extension never need it installed.\n */\nasync function loadDefaultPgvectorExtension(): Promise<Extension> {\n try {\n const module_ = await import(\"@electric-sql/pglite-pgvector\");\n return module_.vector;\n } catch (error) {\n throw new ConfigurationError(\n \"createLocalPgliteBackend needs the pgvector extension but \" +\n \"`@electric-sql/pglite-pgvector` could not be loaded. Install it \" +\n \"(`pnpm add @electric-sql/pglite-pgvector`), pass your own `vector` \" +\n \"extension, or set `vector: false` to disable vector support.\",\n { backend: \"pglite\", dependency: \"@electric-sql/pglite-pgvector\" },\n { cause: error },\n );\n }\n}\n\n// ============================================================\n// Factory Function\n// ============================================================\n\n/**\n * Creates a TypeGraph backend backed by an in-process PGlite database.\n *\n * Constructs the PGlite engine (loading pgvector unless disabled), executes\n * the schema DDL, and wires the standard Postgres backend. The returned\n * backend owns the engine: call `backend.close()` to dispose it.\n *\n * For production Postgres, or a PGlite instance you construct yourself,\n * use `createPostgresBackend` directly with your own Drizzle database — the\n * execution fast path detects PGlite and routes it correctly.\n *\n * @param options - Configuration options\n * @returns Backend, Drizzle database, and raw PGlite client\n */\nexport async function createLocalPgliteBackend(\n options: LocalPgliteBackendOptions = {},\n): Promise<LocalPgliteBackendResult> {\n const tables = options.tables ?? defaultTables;\n\n // pgvector lives in the WASM instance, so the extension must be passed at\n // construction — `CREATE EXTENSION vector` alone can't pull it in. An\n // explicitly supplied extension wins; `false` disables; otherwise load the\n // default package.\n const vectorExtension =\n options.vector === false ?\n undefined\n : (options.vector ?? (await loadDefaultPgvectorExtension()));\n const vectorEnabled = vectorExtension !== undefined;\n\n // Construct via the single options-object form (passing `dataDir` as a\n // field), not the positional `create(dataDir, options)` overload: with a\n // leading `undefined` dataDir, that overload silently drops `extensions`\n // (\"extension vector is not available\"). The options form loads them for\n // both the in-memory and on-disk cases.\n const client = await PGlite.create({\n ...(options.dataDir === undefined ? {} : { dataDir: options.dataDir }),\n ...(vectorExtension === undefined ?\n {}\n : { extensions: { vector: vectorExtension } }),\n });\n\n // `exec` runs a multi-statement batch (DDL + the pgvector `CREATE\n // EXTENSION` when enabled) in one round trip.\n const migrationSql =\n vectorEnabled ?\n generatePostgresMigrationSQL(tables)\n : generatePostgresDDL(tables).join(\"\\n\\n\");\n await client.exec(migrationSql);\n\n const db = drizzle(client);\n const backend = createPostgresBackend(db, {\n tables,\n ...(vectorEnabled ? {} : { vector: false }),\n });\n const managedBackend = wrapWithManagedClose(backend, async () => {\n await client.close();\n });\n\n return { backend: managedBackend, db, client };\n}\n"]}
|
|
@@ -1,53 +1,53 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkSFFJ2IKN_cjs = require('../../chunk-SFFJ2IKN.cjs');
|
|
4
|
+
var chunkCIINW6PS_cjs = require('../../chunk-CIINW6PS.cjs');
|
|
5
|
+
var chunk54JVNOAQ_cjs = require('../../chunk-54JVNOAQ.cjs');
|
|
6
|
+
require('../../chunk-VMEWZU2N.cjs');
|
|
7
|
+
require('../../chunk-6G35I3VW.cjs');
|
|
6
8
|
require('../../chunk-RP7YITHX.cjs');
|
|
7
|
-
require('../../chunk-
|
|
8
|
-
require('../../chunk-
|
|
9
|
-
require('../../chunk-
|
|
10
|
-
require('../../chunk-
|
|
11
|
-
require('../../chunk-G6P3OVDY.cjs');
|
|
12
|
-
require('../../chunk-7V335GHG.cjs');
|
|
9
|
+
require('../../chunk-V4IQYOQ4.cjs');
|
|
10
|
+
require('../../chunk-73KASJGO.cjs');
|
|
11
|
+
require('../../chunk-JIEJCTDS.cjs');
|
|
12
|
+
require('../../chunk-FLRCVI2G.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
Object.defineProperty(exports, "createSqliteBackend", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunkSFFJ2IKN_cjs.createSqliteBackend; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "generateSqliteDDL", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkCIINW6PS_cjs.generateSqliteDDL; }
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "generateSqliteMigrationSQL", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunkCIINW6PS_cjs.generateSqliteMigrationSQL; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, "createSqliteTables", {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunk54JVNOAQ_cjs.createSqliteTables; }
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "edges", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunk54JVNOAQ_cjs.edges; }
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "nodes", {
|
|
37
37
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
38
|
+
get: function () { return chunk54JVNOAQ_cjs.nodes; }
|
|
39
39
|
});
|
|
40
40
|
Object.defineProperty(exports, "schemaVersions", {
|
|
41
41
|
enumerable: true,
|
|
42
|
-
get: function () { return
|
|
42
|
+
get: function () { return chunk54JVNOAQ_cjs.schemaVersions; }
|
|
43
43
|
});
|
|
44
44
|
Object.defineProperty(exports, "tables", {
|
|
45
45
|
enumerable: true,
|
|
46
|
-
get: function () { return
|
|
46
|
+
get: function () { return chunk54JVNOAQ_cjs.tables; }
|
|
47
47
|
});
|
|
48
48
|
Object.defineProperty(exports, "uniques", {
|
|
49
49
|
enumerable: true,
|
|
50
|
-
get: function () { return
|
|
50
|
+
get: function () { return chunk54JVNOAQ_cjs.uniques; }
|
|
51
51
|
});
|
|
52
52
|
//# sourceMappingURL=index.cjs.map
|
|
53
53
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { S as SqliteExecutionProfileHints, F as FulltextStrategy, V as VectorStrategy, A as AnySqliteDatabase, G as GraphBackend } from '../../types-
|
|
2
|
-
export { a as SqliteTransactionMode } from '../../types-
|
|
3
|
-
import { S as SqliteTables } from '../../sqlite-
|
|
4
|
-
export { C as CreateSqliteTablesOptions, a as SqliteTableNames, c as createSqliteTables, e as edges, n as nodes, s as schemaVersions, t as tables, u as uniques } from '../../sqlite-
|
|
5
|
-
export { g as generateSqliteDDL, a as generateSqliteMigrationSQL } from '../../ddl-
|
|
1
|
+
import { S as SqliteExecutionProfileHints, F as FulltextStrategy, V as VectorStrategy, B as BackendCapabilities, A as AnySqliteDatabase, G as GraphBackend } from '../../types-C1CYxWrL.cjs';
|
|
2
|
+
export { a as SqliteTransactionMode } from '../../types-C1CYxWrL.cjs';
|
|
3
|
+
import { S as SqliteTables } from '../../sqlite-Gatk_iw_.cjs';
|
|
4
|
+
export { C as CreateSqliteTablesOptions, a as SqliteTableNames, c as createSqliteTables, e as edges, n as nodes, s as schemaVersions, t as tables, u as uniques } from '../../sqlite-Gatk_iw_.cjs';
|
|
5
|
+
export { g as generateSqliteDDL, a as generateSqliteMigrationSQL } from '../../ddl-CPZ7mB7X.cjs';
|
|
6
6
|
import 'zod';
|
|
7
|
-
import '../../extension-types-
|
|
7
|
+
import '../../extension-types-D1k0inWU.cjs';
|
|
8
8
|
import 'drizzle-orm';
|
|
9
9
|
import 'drizzle-orm/pg-core';
|
|
10
10
|
import 'drizzle-orm/sqlite-core';
|
|
11
|
-
import '../../postgres-
|
|
11
|
+
import '../../postgres-4J2tmauh.cjs';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Options for creating a SQLite backend.
|
|
@@ -43,6 +43,11 @@ type SqliteBackendOptions = Readonly<{
|
|
|
43
43
|
* connections without a vector extension.
|
|
44
44
|
*/
|
|
45
45
|
vector?: VectorStrategy;
|
|
46
|
+
/**
|
|
47
|
+
* Override specific backend capabilities. Useful for custom SQLite builds
|
|
48
|
+
* or tests that need to simulate an engine-level capability gap.
|
|
49
|
+
*/
|
|
50
|
+
capabilities?: Partial<BackendCapabilities>;
|
|
46
51
|
}>;
|
|
47
52
|
declare function createSqliteBackend(db: AnySqliteDatabase, options?: SqliteBackendOptions): GraphBackend;
|
|
48
53
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { S as SqliteExecutionProfileHints, F as FulltextStrategy, V as VectorStrategy, A as AnySqliteDatabase, G as GraphBackend } from '../../types-
|
|
2
|
-
export { a as SqliteTransactionMode } from '../../types-
|
|
3
|
-
import { S as SqliteTables } from '../../sqlite-
|
|
4
|
-
export { C as CreateSqliteTablesOptions, a as SqliteTableNames, c as createSqliteTables, e as edges, n as nodes, s as schemaVersions, t as tables, u as uniques } from '../../sqlite-
|
|
5
|
-
export { g as generateSqliteDDL, a as generateSqliteMigrationSQL } from '../../ddl-
|
|
1
|
+
import { S as SqliteExecutionProfileHints, F as FulltextStrategy, V as VectorStrategy, B as BackendCapabilities, A as AnySqliteDatabase, G as GraphBackend } from '../../types-BKQljXom.js';
|
|
2
|
+
export { a as SqliteTransactionMode } from '../../types-BKQljXom.js';
|
|
3
|
+
import { S as SqliteTables } from '../../sqlite-aM_PAz-O.js';
|
|
4
|
+
export { C as CreateSqliteTablesOptions, a as SqliteTableNames, c as createSqliteTables, e as edges, n as nodes, s as schemaVersions, t as tables, u as uniques } from '../../sqlite-aM_PAz-O.js';
|
|
5
|
+
export { g as generateSqliteDDL, a as generateSqliteMigrationSQL } from '../../ddl-BJcPrB4L.js';
|
|
6
6
|
import 'zod';
|
|
7
|
-
import '../../extension-types-
|
|
7
|
+
import '../../extension-types-D1k0inWU.js';
|
|
8
8
|
import 'drizzle-orm';
|
|
9
9
|
import 'drizzle-orm/pg-core';
|
|
10
10
|
import 'drizzle-orm/sqlite-core';
|
|
11
|
-
import '../../postgres-
|
|
11
|
+
import '../../postgres-BdIb7tS_.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Options for creating a SQLite backend.
|
|
@@ -43,6 +43,11 @@ type SqliteBackendOptions = Readonly<{
|
|
|
43
43
|
* connections without a vector extension.
|
|
44
44
|
*/
|
|
45
45
|
vector?: VectorStrategy;
|
|
46
|
+
/**
|
|
47
|
+
* Override specific backend capabilities. Useful for custom SQLite builds
|
|
48
|
+
* or tests that need to simulate an engine-level capability gap.
|
|
49
|
+
*/
|
|
50
|
+
capabilities?: Partial<BackendCapabilities>;
|
|
46
51
|
}>;
|
|
47
52
|
declare function createSqliteBackend(db: AnySqliteDatabase, options?: SqliteBackendOptions): GraphBackend;
|
|
48
53
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { createSqliteBackend } from '../../chunk-
|
|
2
|
-
export { generateSqliteDDL, generateSqliteMigrationSQL } from '../../chunk-
|
|
3
|
-
export { createSqliteTables, edges, nodes, schemaVersions, tables, uniques } from '../../chunk-
|
|
1
|
+
export { createSqliteBackend } from '../../chunk-4A4GUZTQ.js';
|
|
2
|
+
export { generateSqliteDDL, generateSqliteMigrationSQL } from '../../chunk-VZX2KSY3.js';
|
|
3
|
+
export { createSqliteTables, edges, nodes, schemaVersions, tables, uniques } from '../../chunk-GKFWM3DS.js';
|
|
4
|
+
import '../../chunk-LJLMDDCW.js';
|
|
5
|
+
import '../../chunk-SAJSMR2B.js';
|
|
4
6
|
import '../../chunk-M6OC455F.js';
|
|
5
|
-
import '../../chunk-
|
|
6
|
-
import '../../chunk-
|
|
7
|
-
import '../../chunk-
|
|
8
|
-
import '../../chunk-
|
|
9
|
-
import '../../chunk-MB363HT5.js';
|
|
10
|
-
import '../../chunk-NZ5PMBTG.js';
|
|
7
|
+
import '../../chunk-2HZGWCB4.js';
|
|
8
|
+
import '../../chunk-2YMGNYXY.js';
|
|
9
|
+
import '../../chunk-TQOYM4LN.js';
|
|
10
|
+
import '../../chunk-K5P5OZXS.js';
|
|
11
11
|
//# sourceMappingURL=index.js.map
|
|
12
12
|
//# sourceMappingURL=index.js.map
|