@anvia/neo4j 1.1.5 → 1.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,106 +1,3 @@
1
- import {
2
- retrieveGraphContext
3
- } from "./chunk-QTIUFXDY.js";
4
- import {
5
- exploreGraph
6
- } from "./chunk-V33PR5HS.js";
7
- import {
8
- ManagedNeo4jKnowledgeGraph,
9
- Neo4jKnowledgeGraph,
10
- defineNeo4jGraphSchema,
11
- neo4jTenantScope
12
- } from "./chunk-IVKNAFKG.js";
13
-
14
- // src/client.ts
15
- import { createHash } from "crypto";
16
- import { auth, driver as createDriver } from "neo4j-driver";
17
- var Neo4jClient = class {
18
- driver;
19
- ownsDriver;
20
- closed = false;
21
- database;
22
- constructor(options) {
23
- this.database = options.database;
24
- if ("driver" in options) {
25
- this.driver = options.driver;
26
- this.ownsDriver = false;
27
- } else {
28
- if (typeof options.uri !== "string" || options.uri.length === 0) {
29
- throw new TypeError("Neo4jClient uri must be a non-empty string.");
30
- }
31
- if (typeof options.auth.username !== "string" || options.auth.username.length === 0 || typeof options.auth.password !== "string") {
32
- throw new TypeError("Neo4jClient requires explicit username and password credentials.");
33
- }
34
- this.driver = createDriver(
35
- options.uri,
36
- auth.basic(options.auth.username, options.auth.password)
37
- );
38
- this.ownsDriver = true;
39
- }
40
- }
41
- managedKnowledgeGraph(options) {
42
- this.assertOpen();
43
- return new ManagedNeo4jKnowledgeGraph(this, options);
44
- }
45
- tenant(tenantId) {
46
- this.assertOpen();
47
- return new Neo4jTenant(this, neo4jTenantScope(tenantNamespace(tenantId)));
48
- }
49
- knowledgeGraph(options) {
50
- this.assertOpen();
51
- return new Neo4jKnowledgeGraph(this, options);
52
- }
53
- nativeDriver() {
54
- this.assertOpen();
55
- return this.driver;
56
- }
57
- async close() {
58
- if (this.closed) return;
59
- this.closed = true;
60
- if (this.ownsDriver) await this.driver.close();
61
- }
62
- [Symbol.asyncDispose]() {
63
- return this.close();
64
- }
65
- assertOpen() {
66
- if (this.closed) throw new Error("Neo4jClient is closed.");
67
- }
68
- };
69
- var Neo4jTenant = class {
70
- constructor(owner, scope) {
71
- this.owner = owner;
72
- this.scope = scope;
73
- }
74
- owner;
75
- scope;
76
- get namespace() {
77
- return this.scope.namespace;
78
- }
79
- managedKnowledgeGraph(options) {
80
- this.owner.nativeDriver();
81
- return new ManagedNeo4jKnowledgeGraph(this.owner, options, this.scope);
82
- }
83
- };
84
- function tenantNamespace(tenantId) {
85
- if (typeof tenantId !== "string" || tenantId.trim().length === 0)
86
- throw new TypeError("Neo4j tenant id must be a non-empty string.");
87
- return createHash("sha256").update(tenantId).digest("hex");
88
- }
89
-
90
- // src/extract.ts
91
- import { extractGraphFacts as extractSharedGraphFacts, GraphFactConflictError } from "@anvia/graph";
92
- async function extractGraphFacts(options) {
93
- return extractSharedGraphFacts(options);
94
- }
95
- export {
96
- GraphFactConflictError,
97
- ManagedNeo4jKnowledgeGraph,
98
- Neo4jClient,
99
- Neo4jKnowledgeGraph,
100
- Neo4jTenant,
101
- defineNeo4jGraphSchema,
102
- exploreGraph,
103
- extractGraphFacts,
104
- retrieveGraphContext
105
- };
106
- //# sourceMappingURL=index.js.map
1
+ import { a as exploreGraph, c as Neo4jTenant, i as extractGraphFacts, r as GraphFactConflictError, s as Neo4jClient, t as retrieveGraphContext } from "./src-CxFXzoZ7.js";
2
+ import { m as defineNeo4jGraphSchema, n as Neo4jKnowledgeGraph, t as ManagedNeo4jKnowledgeGraph } from "./graph-8BTZ0V9h.js";
3
+ export { GraphFactConflictError, ManagedNeo4jKnowledgeGraph, Neo4jClient, Neo4jKnowledgeGraph, Neo4jTenant, defineNeo4jGraphSchema, exploreGraph, extractGraphFacts, retrieveGraphContext };