@elqnt/kg 1.0.12 → 2.0.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.
@@ -36,4 +36,4 @@ export {
36
36
  KGRelationshipDirectionIncoming,
37
37
  KGRelationshipDirectionOutgoing
38
38
  };
39
- //# sourceMappingURL=chunk-JUOZ4GSY.mjs.map
39
+ //# sourceMappingURL=chunk-EF7YJ7LL.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../models/kg.ts"],"sourcesContent":["// Code generated by tygo. DO NOT EDIT.\nimport { ResponseMetadata } from \"@elqnt/types\";\n\n//////////\n// source: kg-models.go\n\n/**\n * Graph represents a knowledge graph within an organization\n */\nexport interface Graph {\n id: string;\n name: string;\n description: string;\n isDefault: boolean;\n createdAt: string /* RFC3339 */;\n updatedAt: string /* RFC3339 */;\n}\n/**\n * CreateGraphRequest is the request to create a new graph\n */\nexport interface CreateGraphRequest {\n id?: string; // Optional: if provided, use as graph ID (must be valid UUID)\n name: string;\n description: string;\n}\n/**\n * CreateGraphResult is the response for creating a graph\n */\nexport interface CreateGraphResult {\n graph?: Graph;\n success: boolean;\n error?: string;\n metadata?: ResponseMetadata;\n}\n/**\n * GetGraphResult is the response for getting a single graph\n */\nexport interface GetGraphResult {\n graph?: Graph;\n success: boolean;\n error?: string;\n metadata?: ResponseMetadata;\n}\n/**\n * ListGraphsResult is the response for listing graphs\n */\nexport interface ListGraphsResult {\n graphs?: Graph[];\n success: boolean;\n error?: string;\n metadata?: ResponseMetadata;\n}\n/**\n * UpdateGraphResult is the response for updating a graph\n */\nexport interface UpdateGraphResult {\n graph?: Graph;\n success: boolean;\n error?: string;\n metadata?: ResponseMetadata;\n}\n/**\n * DeleteGraphResult is the response for deleting a graph\n */\nexport interface DeleteGraphResult {\n success: boolean;\n error?: string;\n metadata?: ResponseMetadata;\n}\nexport interface KGNode {\n id: string;\n label: string;\n fields: { [key: string]: any};\n relationships?: KGEdge[];\n score?: number /* float64 */;\n}\nexport interface KGEdge {\n id: string;\n label: string;\n fields: { [key: string]: any};\n from: string;\n to: string;\n}\n/**\n * KGNodeIngestRequest represents a request to ingest a node into the knowledge graph.\n * Note: graphId should be passed via NATS header, not in the body.\n */\nexport interface KGNodeIngestRequest {\n label: string;\n keyField?: string;\n reverseEdgeLabel?: string;\n fields: { [key: string]: any};\n edges?: KGEdgeIngestRequest[];\n duplicatePolicy?: DuplicatePolicy;\n generateEmbeddings?: boolean;\n embeddingsSource?: string;\n embeddingsFields?: string[];\n}\nexport type DuplicatePolicy = string;\nexport const DuplicatePolicyCreateIf: DuplicatePolicy = \"createIfNotExist\";\nexport const DuplicatePolicyIgnore: DuplicatePolicy = \"ignore\";\nexport const DuplicatePolicyReplace: DuplicatePolicy = \"replace\";\nexport const DuplicatePolicyFail: DuplicatePolicy = \"fail\";\nexport const DuplicatePolicyCreate: DuplicatePolicy = \"create\";\nexport interface KGEdgeIngestRequest {\n label: string;\n fields: { [key: string]: any};\n toLabel: string;\n toFieldKey: string;\n toFieldValue: any;\n createReciprocal: boolean;\n reciprocalLabel: string;\n allowEmbeddingsSearch?: boolean;\n}\n/**\n * KGQuery represents a query to the knowledge graph.\n * Note: graphId should be passed via NATS header, not in the body.\n */\nexport interface KGQuery {\n label: string;\n fields: KGFieldQuery[];\n limit: number /* int */;\n depth: number /* int */;\n sortBy: string;\n sortOrder: string;\n edges?: KGEdgeQuery[];\n embeddingsSource?: string;\n skipEmbedding?: boolean;\n summaryOnly?: boolean; // Filter out heavy fields (text, embeddings, etc.) for UI performance\n}\nexport interface KGFieldQuery {\n name: string;\n value: any;\n operator: KGFieldQueryOperator;\n}\nexport type KGFieldQueryOperator = string;\nexport const KGFieldQueryOperatorEqual: KGFieldQueryOperator = \"eq\";\nexport const KGFieldQueryOperatorNotEqual: KGFieldQueryOperator = \"neq\";\nexport const KGFieldQueryOperatorGreater: KGFieldQueryOperator = \"gt\";\nexport const KGFieldQueryOperatorLess: KGFieldQueryOperator = \"lt\";\nexport const KGFieldQueryOperatorGreaterOrEqual: KGFieldQueryOperator = \"gte\";\nexport const KGFieldQueryOperatorLessOrEqual: KGFieldQueryOperator = \"lte\";\nexport const KGFieldQueryOperatorLike: KGFieldQueryOperator = \"like\";\nexport const KGFieldQueryOperatorSimilar: KGFieldQueryOperator = \"similar\";\n/**\n * KGFieldQueryOperatorGreaterOrEqual KGFieldQueryOperator = \"gte\"\n * KGFieldQueryOperatorLessOrEqual KGFieldQueryOperator = \"lte\"\n */\nexport const KGFieldQueryOperatorIn: KGFieldQueryOperator = \"in\";\nexport const KGFieldQueryOperatorArrayContains: KGFieldQueryOperator = \"arrayContains\";\nexport type KGRelationshipDirection = string;\nexport const KGRelationshipDirectionIncoming: KGRelationshipDirection = \"incoming\";\nexport const KGRelationshipDirectionOutgoing: KGRelationshipDirection = \"outgoing\";\nexport interface KGEdgeQuery {\n label: string;\n direction: 'incoming' | 'outgoing';\n fields?: { [key: string]: any};\n /**\n * FromLabel string `json:\"fromLabel\"`\n * FromFieldKey string `json:\"fromFieldKey\"`\n * FromValue interface{} `json:\"fromValue\"`\n */\n toLabel: string;\n toFieldKey: string;\n toFieldValue: any;\n}\nexport interface KGQueryResult {\n nodes: KGNode[];\n edges: KGEdge[];\n}\nexport interface KGLabelInfo {\n label: string;\n count: number /* uint64 */;\n}\nexport interface KGPropertyInfo {\n property: string;\n count: number /* uint64 */;\n}\nexport interface KGPLabelSchema {\n label: string;\n keys: string[];\n}\nexport interface KGArticle {\n id: string;\n title: string;\n content: string;\n lang?: string;\n docUrl?: string;\n paragraphs?: string;\n}\nexport interface KGPropertyFilter {\n property: string;\n value: string;\n}\nexport interface KGPropertyFilterRequest {\n label: string;\n filters: KGPropertyFilter[];\n}\nexport interface DeleteDocumentRequest {\n documentId: string;\n}\nexport interface DeleteDocumentResponse {\n success: boolean;\n deletedNodes: { [key: string]: number /* int */};\n totalDeleted: number /* int */;\n error?: string;\n}\n/**\n * KGSyncJob represents a sync job record in the database\n */\nexport interface KGSyncJob {\n id: string;\n title: string;\n stats: { [key: string]: any};\n startTime: string;\n endTime: string;\n updatedAt?: string;\n}\n/**\n * KGSyncJobUpdateRequest is used to insert or update a sync job\n */\nexport interface KGSyncJobUpdateRequest {\n id: string;\n title: string;\n stats: { [key: string]: any};\n startTime: string;\n endTime: string;\n}\nexport interface KGSyncJobUpdateResponse {\n jobId: string;\n metadata: ResponseMetadata;\n}\nexport interface KGSyncJobListResponse {\n jobs: KGSyncJob[];\n metadata: ResponseMetadata;\n}\n/**\n * KGSyncJobListRequest is used to list sync jobs with filters\n */\nexport interface KGSyncJobListRequest {\n limit?: number /* int */;\n offset?: number /* int */;\n startFrom?: string;\n endTo?: string;\n}\n/**\n * KGSyncIngestResponse is the response for synchronous single node ingestion\n */\nexport interface KGSyncIngestResponse {\n success: boolean;\n nodeId?: string;\n error?: string;\n metadata: ResponseMetadata;\n}\n/**\n * KGBatchSyncIngestResponse is the response for synchronous batch node ingestion\n */\nexport interface KGBatchSyncIngestResponse {\n success: boolean;\n ingestedCount: number /* int */;\n nodeIds?: string[];\n errors?: string[];\n metadata: ResponseMetadata;\n}\n"],"mappings":";AAmGO,IAAM,0BAA2C;AACjD,IAAM,wBAAyC;AAC/C,IAAM,yBAA0C;AAChD,IAAM,sBAAuC;AAC7C,IAAM,wBAAyC;AAiC/C,IAAM,4BAAkD;AACxD,IAAM,+BAAqD;AAC3D,IAAM,8BAAoD;AAC1D,IAAM,2BAAiD;AACvD,IAAM,qCAA2D;AACjE,IAAM,kCAAwD;AAC9D,IAAM,2BAAiD;AACvD,IAAM,8BAAoD;AAK1D,IAAM,yBAA+C;AACrD,IAAM,oCAA0D;AAEhE,IAAM,kCAA2D;AACjE,IAAM,kCAA2D;","names":[]}
@@ -36,4 +36,4 @@ var KGRelationshipDirectionOutgoing = "outgoing";
36
36
 
37
37
 
38
38
  exports.DuplicatePolicyCreateIf = DuplicatePolicyCreateIf; exports.DuplicatePolicyIgnore = DuplicatePolicyIgnore; exports.DuplicatePolicyReplace = DuplicatePolicyReplace; exports.DuplicatePolicyFail = DuplicatePolicyFail; exports.DuplicatePolicyCreate = DuplicatePolicyCreate; exports.KGFieldQueryOperatorEqual = KGFieldQueryOperatorEqual; exports.KGFieldQueryOperatorNotEqual = KGFieldQueryOperatorNotEqual; exports.KGFieldQueryOperatorGreater = KGFieldQueryOperatorGreater; exports.KGFieldQueryOperatorLess = KGFieldQueryOperatorLess; exports.KGFieldQueryOperatorGreaterOrEqual = KGFieldQueryOperatorGreaterOrEqual; exports.KGFieldQueryOperatorLessOrEqual = KGFieldQueryOperatorLessOrEqual; exports.KGFieldQueryOperatorLike = KGFieldQueryOperatorLike; exports.KGFieldQueryOperatorSimilar = KGFieldQueryOperatorSimilar; exports.KGFieldQueryOperatorIn = KGFieldQueryOperatorIn; exports.KGFieldQueryOperatorArrayContains = KGFieldQueryOperatorArrayContains; exports.KGRelationshipDirectionIncoming = KGRelationshipDirectionIncoming; exports.KGRelationshipDirectionOutgoing = KGRelationshipDirectionOutgoing;
39
- //# sourceMappingURL=chunk-RCMHUDQM.js.map
39
+ //# sourceMappingURL=chunk-WEMVDZJ3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/eloquent-packages/eloquent-packages/packages/kg/dist/chunk-WEMVDZJ3.js","../models/kg.ts"],"names":[],"mappings":"AAAA;ACmGO,IAAM,wBAAA,EAA2C,kBAAA;AACjD,IAAM,sBAAA,EAAyC,QAAA;AAC/C,IAAM,uBAAA,EAA0C,SAAA;AAChD,IAAM,oBAAA,EAAuC,MAAA;AAC7C,IAAM,sBAAA,EAAyC,QAAA;AAiC/C,IAAM,0BAAA,EAAkD,IAAA;AACxD,IAAM,6BAAA,EAAqD,KAAA;AAC3D,IAAM,4BAAA,EAAoD,IAAA;AAC1D,IAAM,yBAAA,EAAiD,IAAA;AACvD,IAAM,mCAAA,EAA2D,KAAA;AACjE,IAAM,gCAAA,EAAwD,KAAA;AAC9D,IAAM,yBAAA,EAAiD,MAAA;AACvD,IAAM,4BAAA,EAAoD,SAAA;AAK1D,IAAM,uBAAA,EAA+C,IAAA;AACrD,IAAM,kCAAA,EAA0D,eAAA;AAEhE,IAAM,gCAAA,EAA2D,UAAA;AACjE,IAAM,gCAAA,EAA2D,UAAA;ADtIxE;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,klCAAC","file":"/home/runner/work/eloquent-packages/eloquent-packages/packages/kg/dist/chunk-WEMVDZJ3.js","sourcesContent":[null,"// Code generated by tygo. DO NOT EDIT.\nimport { ResponseMetadata } from \"@elqnt/types\";\n\n//////////\n// source: kg-models.go\n\n/**\n * Graph represents a knowledge graph within an organization\n */\nexport interface Graph {\n id: string;\n name: string;\n description: string;\n isDefault: boolean;\n createdAt: string /* RFC3339 */;\n updatedAt: string /* RFC3339 */;\n}\n/**\n * CreateGraphRequest is the request to create a new graph\n */\nexport interface CreateGraphRequest {\n id?: string; // Optional: if provided, use as graph ID (must be valid UUID)\n name: string;\n description: string;\n}\n/**\n * CreateGraphResult is the response for creating a graph\n */\nexport interface CreateGraphResult {\n graph?: Graph;\n success: boolean;\n error?: string;\n metadata?: ResponseMetadata;\n}\n/**\n * GetGraphResult is the response for getting a single graph\n */\nexport interface GetGraphResult {\n graph?: Graph;\n success: boolean;\n error?: string;\n metadata?: ResponseMetadata;\n}\n/**\n * ListGraphsResult is the response for listing graphs\n */\nexport interface ListGraphsResult {\n graphs?: Graph[];\n success: boolean;\n error?: string;\n metadata?: ResponseMetadata;\n}\n/**\n * UpdateGraphResult is the response for updating a graph\n */\nexport interface UpdateGraphResult {\n graph?: Graph;\n success: boolean;\n error?: string;\n metadata?: ResponseMetadata;\n}\n/**\n * DeleteGraphResult is the response for deleting a graph\n */\nexport interface DeleteGraphResult {\n success: boolean;\n error?: string;\n metadata?: ResponseMetadata;\n}\nexport interface KGNode {\n id: string;\n label: string;\n fields: { [key: string]: any};\n relationships?: KGEdge[];\n score?: number /* float64 */;\n}\nexport interface KGEdge {\n id: string;\n label: string;\n fields: { [key: string]: any};\n from: string;\n to: string;\n}\n/**\n * KGNodeIngestRequest represents a request to ingest a node into the knowledge graph.\n * Note: graphId should be passed via NATS header, not in the body.\n */\nexport interface KGNodeIngestRequest {\n label: string;\n keyField?: string;\n reverseEdgeLabel?: string;\n fields: { [key: string]: any};\n edges?: KGEdgeIngestRequest[];\n duplicatePolicy?: DuplicatePolicy;\n generateEmbeddings?: boolean;\n embeddingsSource?: string;\n embeddingsFields?: string[];\n}\nexport type DuplicatePolicy = string;\nexport const DuplicatePolicyCreateIf: DuplicatePolicy = \"createIfNotExist\";\nexport const DuplicatePolicyIgnore: DuplicatePolicy = \"ignore\";\nexport const DuplicatePolicyReplace: DuplicatePolicy = \"replace\";\nexport const DuplicatePolicyFail: DuplicatePolicy = \"fail\";\nexport const DuplicatePolicyCreate: DuplicatePolicy = \"create\";\nexport interface KGEdgeIngestRequest {\n label: string;\n fields: { [key: string]: any};\n toLabel: string;\n toFieldKey: string;\n toFieldValue: any;\n createReciprocal: boolean;\n reciprocalLabel: string;\n allowEmbeddingsSearch?: boolean;\n}\n/**\n * KGQuery represents a query to the knowledge graph.\n * Note: graphId should be passed via NATS header, not in the body.\n */\nexport interface KGQuery {\n label: string;\n fields: KGFieldQuery[];\n limit: number /* int */;\n depth: number /* int */;\n sortBy: string;\n sortOrder: string;\n edges?: KGEdgeQuery[];\n embeddingsSource?: string;\n skipEmbedding?: boolean;\n summaryOnly?: boolean; // Filter out heavy fields (text, embeddings, etc.) for UI performance\n}\nexport interface KGFieldQuery {\n name: string;\n value: any;\n operator: KGFieldQueryOperator;\n}\nexport type KGFieldQueryOperator = string;\nexport const KGFieldQueryOperatorEqual: KGFieldQueryOperator = \"eq\";\nexport const KGFieldQueryOperatorNotEqual: KGFieldQueryOperator = \"neq\";\nexport const KGFieldQueryOperatorGreater: KGFieldQueryOperator = \"gt\";\nexport const KGFieldQueryOperatorLess: KGFieldQueryOperator = \"lt\";\nexport const KGFieldQueryOperatorGreaterOrEqual: KGFieldQueryOperator = \"gte\";\nexport const KGFieldQueryOperatorLessOrEqual: KGFieldQueryOperator = \"lte\";\nexport const KGFieldQueryOperatorLike: KGFieldQueryOperator = \"like\";\nexport const KGFieldQueryOperatorSimilar: KGFieldQueryOperator = \"similar\";\n/**\n * KGFieldQueryOperatorGreaterOrEqual KGFieldQueryOperator = \"gte\"\n * KGFieldQueryOperatorLessOrEqual KGFieldQueryOperator = \"lte\"\n */\nexport const KGFieldQueryOperatorIn: KGFieldQueryOperator = \"in\";\nexport const KGFieldQueryOperatorArrayContains: KGFieldQueryOperator = \"arrayContains\";\nexport type KGRelationshipDirection = string;\nexport const KGRelationshipDirectionIncoming: KGRelationshipDirection = \"incoming\";\nexport const KGRelationshipDirectionOutgoing: KGRelationshipDirection = \"outgoing\";\nexport interface KGEdgeQuery {\n label: string;\n direction: 'incoming' | 'outgoing';\n fields?: { [key: string]: any};\n /**\n * FromLabel string `json:\"fromLabel\"`\n * FromFieldKey string `json:\"fromFieldKey\"`\n * FromValue interface{} `json:\"fromValue\"`\n */\n toLabel: string;\n toFieldKey: string;\n toFieldValue: any;\n}\nexport interface KGQueryResult {\n nodes: KGNode[];\n edges: KGEdge[];\n}\nexport interface KGLabelInfo {\n label: string;\n count: number /* uint64 */;\n}\nexport interface KGPropertyInfo {\n property: string;\n count: number /* uint64 */;\n}\nexport interface KGPLabelSchema {\n label: string;\n keys: string[];\n}\nexport interface KGArticle {\n id: string;\n title: string;\n content: string;\n lang?: string;\n docUrl?: string;\n paragraphs?: string;\n}\nexport interface KGPropertyFilter {\n property: string;\n value: string;\n}\nexport interface KGPropertyFilterRequest {\n label: string;\n filters: KGPropertyFilter[];\n}\nexport interface DeleteDocumentRequest {\n documentId: string;\n}\nexport interface DeleteDocumentResponse {\n success: boolean;\n deletedNodes: { [key: string]: number /* int */};\n totalDeleted: number /* int */;\n error?: string;\n}\n/**\n * KGSyncJob represents a sync job record in the database\n */\nexport interface KGSyncJob {\n id: string;\n title: string;\n stats: { [key: string]: any};\n startTime: string;\n endTime: string;\n updatedAt?: string;\n}\n/**\n * KGSyncJobUpdateRequest is used to insert or update a sync job\n */\nexport interface KGSyncJobUpdateRequest {\n id: string;\n title: string;\n stats: { [key: string]: any};\n startTime: string;\n endTime: string;\n}\nexport interface KGSyncJobUpdateResponse {\n jobId: string;\n metadata: ResponseMetadata;\n}\nexport interface KGSyncJobListResponse {\n jobs: KGSyncJob[];\n metadata: ResponseMetadata;\n}\n/**\n * KGSyncJobListRequest is used to list sync jobs with filters\n */\nexport interface KGSyncJobListRequest {\n limit?: number /* int */;\n offset?: number /* int */;\n startFrom?: string;\n endTo?: string;\n}\n/**\n * KGSyncIngestResponse is the response for synchronous single node ingestion\n */\nexport interface KGSyncIngestResponse {\n success: boolean;\n nodeId?: string;\n error?: string;\n metadata: ResponseMetadata;\n}\n/**\n * KGBatchSyncIngestResponse is the response for synchronous batch node ingestion\n */\nexport interface KGBatchSyncIngestResponse {\n success: boolean;\n ingestedCount: number /* int */;\n nodeIds?: string[];\n errors?: string[];\n metadata: ResponseMetadata;\n}\n"]}
package/dist/index.d.mts CHANGED
@@ -1,55 +1,7 @@
1
- import { KGNodeIngestRequest, KGQuery, KGQueryResult, KGLabelInfo, KGNode, Graph } from './models/kg.mjs';
2
- export { CreateGraphRequest, CreateGraphResult, DeleteDocumentRequest, DeleteDocumentResponse, DeleteGraphResult, DuplicatePolicy, DuplicatePolicyCreate, DuplicatePolicyCreateIf, DuplicatePolicyFail, DuplicatePolicyIgnore, DuplicatePolicyReplace, GetGraphResult, KGArticle, KGBatchSyncIngestResponse, KGEdge, KGEdgeIngestRequest, KGEdgeQuery, KGFieldQuery, KGFieldQueryOperator, KGFieldQueryOperatorArrayContains, KGFieldQueryOperatorEqual, KGFieldQueryOperatorGreater, KGFieldQueryOperatorGreaterOrEqual, KGFieldQueryOperatorIn, KGFieldQueryOperatorLess, KGFieldQueryOperatorLessOrEqual, KGFieldQueryOperatorLike, KGFieldQueryOperatorNotEqual, KGFieldQueryOperatorSimilar, KGPLabelSchema, KGPropertyFilter, KGPropertyFilterRequest, KGPropertyInfo, KGRelationshipDirection, KGRelationshipDirectionIncoming, KGRelationshipDirectionOutgoing, KGSyncIngestResponse, KGSyncJob, KGSyncJobListRequest, KGSyncJobListResponse, KGSyncJobUpdateRequest, KGSyncJobUpdateResponse, ListGraphsResult, UpdateGraphResult } from './models/kg.mjs';
1
+ export { CreateGraphRequest, CreateGraphResult, DeleteDocumentRequest, DeleteDocumentResponse, DeleteGraphResult, DuplicatePolicy, DuplicatePolicyCreate, DuplicatePolicyCreateIf, DuplicatePolicyFail, DuplicatePolicyIgnore, DuplicatePolicyReplace, GetGraphResult, Graph, KGArticle, KGBatchSyncIngestResponse, KGEdge, KGEdgeIngestRequest, KGEdgeQuery, KGFieldQuery, KGFieldQueryOperator, KGFieldQueryOperatorArrayContains, KGFieldQueryOperatorEqual, KGFieldQueryOperatorGreater, KGFieldQueryOperatorGreaterOrEqual, KGFieldQueryOperatorIn, KGFieldQueryOperatorLess, KGFieldQueryOperatorLessOrEqual, KGFieldQueryOperatorLike, KGFieldQueryOperatorNotEqual, KGFieldQueryOperatorSimilar, KGLabelInfo, KGNode, KGNodeIngestRequest, KGPLabelSchema, KGPropertyFilter, KGPropertyFilterRequest, KGPropertyInfo, KGQuery, KGQueryResult, KGRelationshipDirection, KGRelationshipDirectionIncoming, KGRelationshipDirectionOutgoing, KGSyncIngestResponse, KGSyncJob, KGSyncJobListRequest, KGSyncJobListResponse, KGSyncJobUpdateRequest, KGSyncJobUpdateResponse, ListGraphsResult, UpdateGraphResult } from './models/kg.mjs';
3
2
  export { GraphEdgeDefinition, GraphEdgeRequest, GraphEdgeResponse, GraphNodeDefinition, GraphNodeRequest, GraphNodeResponse, KGDBCreate, KGDesignerEdgeCreate, KGDesignerEdgeDelete, KGDesignerEdgeGet, KGDesignerEdgeList, KGDesignerEdgeUpdate, KGDesignerNodeCreate, KGDesignerNodeDelete, KGDesignerNodeGet, KGDesignerNodeList, KGDesignerNodeUpdate, KGDocumentDelete, KGGraphCreate, KGGraphDelete, KGGraphGet, KGGraphList, KGGraphOptimize, KGGraphUpdate, KGIngestBatchSync, KGIngestNodeSync, KGSyncJobList, KGSyncJobUpdate } from './models/kg-designer.mjs';
4
- import * as react_jsx_runtime from 'react/jsx-runtime';
5
- import * as react from 'react';
6
- import { ReactNode } from 'react';
7
3
  import '@elqnt/types';
8
4
 
9
5
  declare const Test = "hi";
10
6
 
11
- type Success = {
12
- success: boolean;
13
- };
14
- type UseKnowledgeGraphType = {
15
- isLoading: boolean;
16
- ingestNode: (node: KGNodeIngestRequest) => Promise<Success | Error>;
17
- ingestNodes: (node: KGNodeIngestRequest[]) => Promise<Success | Error>;
18
- updateNode: (nodeId: string, label: string, fields: Record<string, any>) => Promise<Success | Error>;
19
- ingestDocs: (urls: string[], mode: "documents" | "entities" | "snippets", brief: string, labels: string[]) => Promise<Success | Error>;
20
- ingestText: (text: string, mode: "entities" | "snippets") => Promise<Success | Error>;
21
- ingestYT: (url: string) => Promise<Success | Error>;
22
- queryGraph: (query: KGQuery) => Promise<KGQueryResult>;
23
- getGraphLabels: () => Promise<KGLabelInfo[] | Error>;
24
- labels: KGLabelInfo[] | undefined;
25
- selectedLabel: string | undefined;
26
- setSelectedLabel: (label: string) => void;
27
- queryResult: KGQueryResult | undefined;
28
- setQueryResult: (res: KGQueryResult) => void;
29
- refreshState: () => void;
30
- selectedNodeId: string | undefined;
31
- setSelectedNodeId: (id: string | undefined) => void;
32
- getNodeById: (id: string) => Promise<KGNode | Error>;
33
- graphs: Graph[];
34
- selectedGraph: Graph | undefined;
35
- selectedGraphId: string | undefined;
36
- graphsLoading: boolean;
37
- graphsError: string | undefined;
38
- selectGraph: (graphId: string | undefined) => void;
39
- refreshGraphs: () => Promise<void>;
40
- };
41
- declare const useKnowledgeGraph: (overrideOrgId?: string) => UseKnowledgeGraphType;
42
-
43
- type UseKnowledgeGraphAnalyticsType = {
44
- isLoading: boolean;
45
- };
46
- declare const useKnowledgeGraphAnalytics: (overrideOrgId?: string) => UseKnowledgeGraphAnalyticsType;
47
-
48
- declare const KnowledgeGraphContext: react.Context<UseKnowledgeGraphType | undefined>;
49
- declare function KnowledgeGraphContextProvider(props: {
50
- children: ReactNode;
51
- overrideOrgId?: string;
52
- }): react_jsx_runtime.JSX.Element;
53
- declare const useKnowledgeGraphContext: () => UseKnowledgeGraphType;
54
-
55
- export { Graph, KGLabelInfo, KGNode, KGNodeIngestRequest, KGQuery, KGQueryResult, KnowledgeGraphContext, KnowledgeGraphContextProvider, Test, type UseKnowledgeGraphAnalyticsType, type UseKnowledgeGraphType, useKnowledgeGraph, useKnowledgeGraphAnalytics, useKnowledgeGraphContext };
7
+ export { Test };
package/dist/index.d.ts CHANGED
@@ -1,55 +1,7 @@
1
- import { KGNodeIngestRequest, KGQuery, KGQueryResult, KGLabelInfo, KGNode, Graph } from './models/kg.js';
2
- export { CreateGraphRequest, CreateGraphResult, DeleteDocumentRequest, DeleteDocumentResponse, DeleteGraphResult, DuplicatePolicy, DuplicatePolicyCreate, DuplicatePolicyCreateIf, DuplicatePolicyFail, DuplicatePolicyIgnore, DuplicatePolicyReplace, GetGraphResult, KGArticle, KGBatchSyncIngestResponse, KGEdge, KGEdgeIngestRequest, KGEdgeQuery, KGFieldQuery, KGFieldQueryOperator, KGFieldQueryOperatorArrayContains, KGFieldQueryOperatorEqual, KGFieldQueryOperatorGreater, KGFieldQueryOperatorGreaterOrEqual, KGFieldQueryOperatorIn, KGFieldQueryOperatorLess, KGFieldQueryOperatorLessOrEqual, KGFieldQueryOperatorLike, KGFieldQueryOperatorNotEqual, KGFieldQueryOperatorSimilar, KGPLabelSchema, KGPropertyFilter, KGPropertyFilterRequest, KGPropertyInfo, KGRelationshipDirection, KGRelationshipDirectionIncoming, KGRelationshipDirectionOutgoing, KGSyncIngestResponse, KGSyncJob, KGSyncJobListRequest, KGSyncJobListResponse, KGSyncJobUpdateRequest, KGSyncJobUpdateResponse, ListGraphsResult, UpdateGraphResult } from './models/kg.js';
1
+ export { CreateGraphRequest, CreateGraphResult, DeleteDocumentRequest, DeleteDocumentResponse, DeleteGraphResult, DuplicatePolicy, DuplicatePolicyCreate, DuplicatePolicyCreateIf, DuplicatePolicyFail, DuplicatePolicyIgnore, DuplicatePolicyReplace, GetGraphResult, Graph, KGArticle, KGBatchSyncIngestResponse, KGEdge, KGEdgeIngestRequest, KGEdgeQuery, KGFieldQuery, KGFieldQueryOperator, KGFieldQueryOperatorArrayContains, KGFieldQueryOperatorEqual, KGFieldQueryOperatorGreater, KGFieldQueryOperatorGreaterOrEqual, KGFieldQueryOperatorIn, KGFieldQueryOperatorLess, KGFieldQueryOperatorLessOrEqual, KGFieldQueryOperatorLike, KGFieldQueryOperatorNotEqual, KGFieldQueryOperatorSimilar, KGLabelInfo, KGNode, KGNodeIngestRequest, KGPLabelSchema, KGPropertyFilter, KGPropertyFilterRequest, KGPropertyInfo, KGQuery, KGQueryResult, KGRelationshipDirection, KGRelationshipDirectionIncoming, KGRelationshipDirectionOutgoing, KGSyncIngestResponse, KGSyncJob, KGSyncJobListRequest, KGSyncJobListResponse, KGSyncJobUpdateRequest, KGSyncJobUpdateResponse, ListGraphsResult, UpdateGraphResult } from './models/kg.js';
3
2
  export { GraphEdgeDefinition, GraphEdgeRequest, GraphEdgeResponse, GraphNodeDefinition, GraphNodeRequest, GraphNodeResponse, KGDBCreate, KGDesignerEdgeCreate, KGDesignerEdgeDelete, KGDesignerEdgeGet, KGDesignerEdgeList, KGDesignerEdgeUpdate, KGDesignerNodeCreate, KGDesignerNodeDelete, KGDesignerNodeGet, KGDesignerNodeList, KGDesignerNodeUpdate, KGDocumentDelete, KGGraphCreate, KGGraphDelete, KGGraphGet, KGGraphList, KGGraphOptimize, KGGraphUpdate, KGIngestBatchSync, KGIngestNodeSync, KGSyncJobList, KGSyncJobUpdate } from './models/kg-designer.js';
4
- import * as react_jsx_runtime from 'react/jsx-runtime';
5
- import * as react from 'react';
6
- import { ReactNode } from 'react';
7
3
  import '@elqnt/types';
8
4
 
9
5
  declare const Test = "hi";
10
6
 
11
- type Success = {
12
- success: boolean;
13
- };
14
- type UseKnowledgeGraphType = {
15
- isLoading: boolean;
16
- ingestNode: (node: KGNodeIngestRequest) => Promise<Success | Error>;
17
- ingestNodes: (node: KGNodeIngestRequest[]) => Promise<Success | Error>;
18
- updateNode: (nodeId: string, label: string, fields: Record<string, any>) => Promise<Success | Error>;
19
- ingestDocs: (urls: string[], mode: "documents" | "entities" | "snippets", brief: string, labels: string[]) => Promise<Success | Error>;
20
- ingestText: (text: string, mode: "entities" | "snippets") => Promise<Success | Error>;
21
- ingestYT: (url: string) => Promise<Success | Error>;
22
- queryGraph: (query: KGQuery) => Promise<KGQueryResult>;
23
- getGraphLabels: () => Promise<KGLabelInfo[] | Error>;
24
- labels: KGLabelInfo[] | undefined;
25
- selectedLabel: string | undefined;
26
- setSelectedLabel: (label: string) => void;
27
- queryResult: KGQueryResult | undefined;
28
- setQueryResult: (res: KGQueryResult) => void;
29
- refreshState: () => void;
30
- selectedNodeId: string | undefined;
31
- setSelectedNodeId: (id: string | undefined) => void;
32
- getNodeById: (id: string) => Promise<KGNode | Error>;
33
- graphs: Graph[];
34
- selectedGraph: Graph | undefined;
35
- selectedGraphId: string | undefined;
36
- graphsLoading: boolean;
37
- graphsError: string | undefined;
38
- selectGraph: (graphId: string | undefined) => void;
39
- refreshGraphs: () => Promise<void>;
40
- };
41
- declare const useKnowledgeGraph: (overrideOrgId?: string) => UseKnowledgeGraphType;
42
-
43
- type UseKnowledgeGraphAnalyticsType = {
44
- isLoading: boolean;
45
- };
46
- declare const useKnowledgeGraphAnalytics: (overrideOrgId?: string) => UseKnowledgeGraphAnalyticsType;
47
-
48
- declare const KnowledgeGraphContext: react.Context<UseKnowledgeGraphType | undefined>;
49
- declare function KnowledgeGraphContextProvider(props: {
50
- children: ReactNode;
51
- overrideOrgId?: string;
52
- }): react_jsx_runtime.JSX.Element;
53
- declare const useKnowledgeGraphContext: () => UseKnowledgeGraphType;
54
-
55
- export { Graph, KGLabelInfo, KGNode, KGNodeIngestRequest, KGQuery, KGQueryResult, KnowledgeGraphContext, KnowledgeGraphContextProvider, Test, type UseKnowledgeGraphAnalyticsType, type UseKnowledgeGraphType, useKnowledgeGraph, useKnowledgeGraphAnalytics, useKnowledgeGraphContext };
7
+ export { Test };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }require('./chunk-RDWVE6B2.js');
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-RDWVE6B2.js');
2
2
 
3
3
 
4
4
 
@@ -41,396 +41,17 @@ var _chunk2OYIMLE4js = require('./chunk-2OYIMLE4.js');
41
41
 
42
42
 
43
43
 
44
- var _chunkRCMHUDQMjs = require('./chunk-RCMHUDQM.js');
44
+ var _chunkWEMVDZJ3js = require('./chunk-WEMVDZJ3.js');
45
45
 
46
46
  // consts.ts
47
47
  var Test = "hi";
48
48
 
49
- // hooks/use-knowledge-graph.ts
50
- var _auth = require('@elqnt/auth');
51
- var _nats = require('@elqnt/nats');
52
- var _react = require('react');
53
- var useKnowledgeGraph = (overrideOrgId) => {
54
- const { selectedOrgId } = _auth.useUserContext.call(void 0, );
55
- const [isLoading, setIsLoading] = _react.useState.call(void 0, false);
56
- const { natsConnected, request } = _nats.useNatsContext.call(void 0, );
57
- const [selectedNodeId, setSelectedNodeId] = _react.useState.call(void 0,
58
- void 0
59
- );
60
- const orgId = _nullishCoalesce(overrideOrgId, () => ( selectedOrgId));
61
- const [labels, setLabels] = _react.useState.call(void 0, void 0);
62
- const [selectedLabel, setSelectedLabel] = _react.useState.call(void 0,
63
- void 0
64
- );
65
- const [queryResult, setQueryResult] = _react.useState.call(void 0,
66
- void 0
67
- );
68
- const [stateTrigger, setStateTrigger] = _react.useState.call(void 0, 0);
69
- const [graphs, setGraphs] = _react.useState.call(void 0, []);
70
- const [graphsLoading, setGraphsLoading] = _react.useState.call(void 0, true);
71
- const [graphsError, setGraphsError] = _react.useState.call(void 0, );
72
- const [selectedGraphId, setSelectedGraphId] = _react.useState.call(void 0, );
73
- const selectedGraph = _react.useMemo.call(void 0, () => {
74
- if (!selectedGraphId) {
75
- return graphs.find((g) => g.isDefault) || graphs[0];
76
- }
77
- return graphs.find((g) => g.id === selectedGraphId);
78
- }, [graphs, selectedGraphId]);
79
- function selectGraph(graphId) {
80
- setSelectedGraphId(graphId);
81
- }
82
- async function refreshGraphs() {
83
- if (!orgId || !natsConnected) return;
84
- setGraphsLoading(true);
85
- setGraphsError(void 0);
86
- const data = await request(_chunk2OYIMLE4js.KGGraphList, {}, { orgId });
87
- if (data instanceof Error) {
88
- setGraphsError(data.message);
89
- setGraphsLoading(false);
90
- return;
91
- }
92
- if (data.success !== false) {
93
- const loadedGraphs = data.graphs || [];
94
- setGraphs(loadedGraphs);
95
- setSelectedGraphId((prev) => {
96
- if (!prev && loadedGraphs.length) {
97
- const defaultGraph = loadedGraphs.find((g) => g.isDefault);
98
- return _optionalChain([defaultGraph, 'optionalAccess', _ => _.id]) || _optionalChain([loadedGraphs, 'access', _2 => _2[0], 'optionalAccess', _3 => _3.id]);
99
- }
100
- return prev;
101
- });
102
- } else {
103
- setGraphsError(data.error || "Failed to load graphs");
104
- }
105
- setGraphsLoading(false);
106
- }
107
- _react.useEffect.call(void 0, () => {
108
- if (!natsConnected || !orgId) return;
109
- setSelectedGraphId(void 0);
110
- refreshGraphs();
111
- }, [natsConnected, orgId]);
112
- async function ingestNode(node) {
113
- if (!orgId) {
114
- return new Error("No orgId provided");
115
- }
116
- if (!natsConnected) {
117
- return new Error("Not connected to NATS");
118
- }
119
- setIsLoading(true);
120
- const data = await request(
121
- "kg.ingest.node",
122
- node,
123
- {
124
- orgId
125
- }
126
- );
127
- setIsLoading(false);
128
- if (data instanceof Error) {
129
- console.error(data);
130
- return data;
131
- }
132
- return data;
133
- }
134
- async function ingestNodes(nodes) {
135
- if (!orgId) {
136
- return new Error("No orgId provided");
137
- }
138
- if (!natsConnected) {
139
- return new Error("Not connected to NATS");
140
- }
141
- setIsLoading(true);
142
- const data = await request(
143
- "kg.ingest.nodes",
144
- nodes,
145
- {
146
- orgId
147
- }
148
- );
149
- setIsLoading(false);
150
- if (data instanceof Error) {
151
- console.error(data);
152
- return data;
153
- }
154
- return data;
155
- }
156
- async function updateNode(nodeId, label, fields) {
157
- const nodeRequest = {
158
- label,
159
- keyField: "id",
160
- fields: {
161
- ...fields,
162
- id: nodeId
163
- },
164
- duplicatePolicy: "replace"
165
- };
166
- const result = await ingestNode(nodeRequest);
167
- if (!(result instanceof Error)) {
168
- setTimeout(() => {
169
- optimizeGraph().catch(
170
- (err) => console.error("Failed to optimize graph after node update:", err)
171
- );
172
- }, 2e3);
173
- }
174
- return result;
175
- }
176
- async function optimizeGraph() {
177
- if (!orgId) {
178
- return new Error("No orgId provided");
179
- }
180
- if (!natsConnected) {
181
- return new Error("Not connected to NATS");
182
- }
183
- const data = await request(
184
- "kg.graph.optimize",
185
- {},
186
- {
187
- orgId
188
- }
189
- );
190
- if (data instanceof Error) {
191
- console.error("Graph optimization failed:", data);
192
- return data;
193
- }
194
- console.log("Graph optimized successfully");
195
- return data;
196
- }
197
- async function ingestDocs(urls, mode, brief, labels2) {
198
- if (!orgId) {
199
- return new Error("No orgId provided");
200
- }
201
- if (!natsConnected) {
202
- return new Error("Not connected to NATS");
203
- }
204
- setIsLoading(true);
205
- const data = await request(
206
- "docs.kg.ingest",
207
- { urls, mode, brief, labels: labels2 },
208
- {
209
- orgId
210
- }
211
- );
212
- setIsLoading(false);
213
- if (data instanceof Error) {
214
- console.error(data);
215
- return data;
216
- }
217
- return data;
218
- }
219
- async function ingestText(text, mode) {
220
- if (!orgId) {
221
- return new Error("No orgId provided");
222
- }
223
- if (!natsConnected) {
224
- return new Error("Not connected to NATS");
225
- }
226
- setIsLoading(true);
227
- const data = await request(
228
- "docs.kg.ingestText",
229
- { text, mode },
230
- {
231
- orgId
232
- }
233
- );
234
- setIsLoading(false);
235
- if (data instanceof Error) {
236
- console.error(data);
237
- return data;
238
- }
239
- return data;
240
- }
241
- async function ingestYT(url) {
242
- if (!orgId) {
243
- return new Error("No orgId provided");
244
- }
245
- if (!natsConnected) {
246
- return new Error("Not connected to NATS");
247
- }
248
- setIsLoading(true);
249
- const data = await request(
250
- "docs.kg.ingestYT",
251
- { url },
252
- {
253
- orgId
254
- }
255
- );
256
- setIsLoading(false);
257
- if (data instanceof Error) {
258
- console.error(data);
259
- return data;
260
- }
261
- return data;
262
- }
263
- async function queryGraph(query) {
264
- if (!orgId) {
265
- throw new Error("No orgId provided");
266
- }
267
- if (!natsConnected) {
268
- throw new Error("Not connected to NATS");
269
- }
270
- setIsLoading(true);
271
- const data = await request(
272
- "kg.query.graph",
273
- query,
274
- {
275
- orgId,
276
- graphId: _optionalChain([selectedGraph, 'optionalAccess', _4 => _4.id])
277
- }
278
- );
279
- setIsLoading(false);
280
- if (data instanceof Error) {
281
- console.error(data);
282
- return data;
283
- }
284
- return data;
285
- }
286
- async function getNodeById(id) {
287
- if (!orgId) {
288
- return new Error("No orgId provided");
289
- }
290
- if (!natsConnected) {
291
- return new Error("Not connected to NATS");
292
- }
293
- const data = await request(
294
- "kg.query.nodeById",
295
- { id },
296
- { orgId, graphId: _optionalChain([selectedGraph, 'optionalAccess', _5 => _5.id]) }
297
- );
298
- if (data instanceof Error) {
299
- console.error(data);
300
- return data;
301
- }
302
- return data;
303
- }
304
- async function getGraphLabels() {
305
- if (!orgId) {
306
- return new Error("No orgId provided");
307
- }
308
- if (!natsConnected) {
309
- return new Error("Not connected to NATS");
310
- }
311
- setIsLoading(true);
312
- const data = await request(
313
- "kg.graph.labels",
314
- {},
315
- { orgId, graphId: _optionalChain([selectedGraph, 'optionalAccess', _6 => _6.id]) }
316
- );
317
- setIsLoading(false);
318
- if (data instanceof Error) {
319
- console.error(data);
320
- return data;
321
- }
322
- if (!Array.isArray(data) && typeof data === "object") {
323
- const err = data;
324
- return new Error(_nullishCoalesce(_nullishCoalesce(_optionalChain([err, 'optionalAccess', _7 => _7.message]), () => ( _optionalChain([err, 'optionalAccess', _8 => _8.error]))), () => ( err)));
325
- }
326
- return data;
327
- }
328
- _react.useEffect.call(void 0, () => {
329
- setLabels(void 0);
330
- setSelectedLabel(void 0);
331
- setQueryResult(void 0);
332
- }, [_optionalChain([selectedGraph, 'optionalAccess', _9 => _9.id])]);
333
- _react.useEffect.call(void 0, () => {
334
- if (!natsConnected || !orgId) {
335
- return;
336
- }
337
- async function getLabels() {
338
- const data = await getGraphLabels();
339
- if (data instanceof Error) {
340
- return [];
341
- }
342
- setLabels(data);
343
- return data;
344
- }
345
- getLabels();
346
- }, [natsConnected, orgId, _optionalChain([selectedGraph, 'optionalAccess', _10 => _10.id]), stateTrigger]);
347
- _react.useEffect.call(void 0, () => {
348
- if (!natsConnected || !orgId || !selectedLabel) {
349
- return;
350
- }
351
- async function getGraphQueryResult() {
352
- if (!selectedLabel) return;
353
- const query = {
354
- label: selectedLabel,
355
- fields: [],
356
- limit: 500,
357
- sortBy: "",
358
- sortOrder: "asc",
359
- depth: 2
360
- };
361
- const res = await queryGraph(query);
362
- if (res instanceof Error) {
363
- console.error(res);
364
- return;
365
- }
366
- setQueryResult(res);
367
- }
368
- getGraphQueryResult();
369
- }, [natsConnected, orgId, _optionalChain([selectedGraph, 'optionalAccess', _11 => _11.id]), selectedLabel, stateTrigger]);
370
- function refreshState() {
371
- setStateTrigger(stateTrigger + 1);
372
- }
373
- return {
374
- isLoading,
375
- ingestNode,
376
- ingestNodes,
377
- updateNode,
378
- queryGraph,
379
- getNodeById,
380
- getGraphLabels,
381
- labels,
382
- selectedLabel,
383
- setSelectedLabel,
384
- queryResult,
385
- setQueryResult,
386
- refreshState,
387
- ingestDocs,
388
- ingestText,
389
- selectedNodeId,
390
- setSelectedNodeId,
391
- ingestYT,
392
- // Graph selection
393
- graphs,
394
- selectedGraph,
395
- selectedGraphId: _optionalChain([selectedGraph, 'optionalAccess', _12 => _12.id]),
396
- graphsLoading,
397
- graphsError,
398
- selectGraph,
399
- refreshGraphs
400
- };
401
- };
402
49
 
403
- // hooks/use-knowledge-graph-analytics.ts
404
50
 
405
51
 
406
52
 
407
- var useKnowledgeGraphAnalytics = (overrideOrgId) => {
408
- const { selectedOrgId } = _auth.useUserContext.call(void 0, );
409
- const [isLoading, setIsLoading] = _react.useState.call(void 0, false);
410
- const { natsConnected, request } = _nats.useNatsContext.call(void 0, );
411
- return {
412
- isLoading
413
- };
414
- };
415
53
 
416
- // state/knowledge-graph-context.tsx
417
54
 
418
- var _jsxruntime = require('react/jsx-runtime');
419
- var KnowledgeGraphContext = _react.createContext.call(void 0, void 0);
420
- function KnowledgeGraphContextProvider(props) {
421
- const { children, overrideOrgId } = props;
422
- const useKG = useKnowledgeGraph(overrideOrgId);
423
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, KnowledgeGraphContext.Provider, { value: useKG, children });
424
- }
425
- var useKnowledgeGraphContext = () => {
426
- const context = _react.useContext.call(void 0, KnowledgeGraphContext);
427
- if (context === void 0) {
428
- throw new Error(
429
- "useKnowledgeGraphContext must be used within a KnowledgeGraphContextProvider"
430
- );
431
- }
432
- return context;
433
- };
434
55
 
435
56
 
436
57
 
@@ -465,17 +86,5 @@ var useKnowledgeGraphContext = () => {
465
86
 
466
87
 
467
88
 
468
-
469
-
470
-
471
-
472
-
473
-
474
-
475
-
476
-
477
-
478
-
479
-
480
- exports.DuplicatePolicyCreate = _chunkRCMHUDQMjs.DuplicatePolicyCreate; exports.DuplicatePolicyCreateIf = _chunkRCMHUDQMjs.DuplicatePolicyCreateIf; exports.DuplicatePolicyFail = _chunkRCMHUDQMjs.DuplicatePolicyFail; exports.DuplicatePolicyIgnore = _chunkRCMHUDQMjs.DuplicatePolicyIgnore; exports.DuplicatePolicyReplace = _chunkRCMHUDQMjs.DuplicatePolicyReplace; exports.KGDBCreate = _chunk2OYIMLE4js.KGDBCreate; exports.KGDesignerEdgeCreate = _chunk2OYIMLE4js.KGDesignerEdgeCreate; exports.KGDesignerEdgeDelete = _chunk2OYIMLE4js.KGDesignerEdgeDelete; exports.KGDesignerEdgeGet = _chunk2OYIMLE4js.KGDesignerEdgeGet; exports.KGDesignerEdgeList = _chunk2OYIMLE4js.KGDesignerEdgeList; exports.KGDesignerEdgeUpdate = _chunk2OYIMLE4js.KGDesignerEdgeUpdate; exports.KGDesignerNodeCreate = _chunk2OYIMLE4js.KGDesignerNodeCreate; exports.KGDesignerNodeDelete = _chunk2OYIMLE4js.KGDesignerNodeDelete; exports.KGDesignerNodeGet = _chunk2OYIMLE4js.KGDesignerNodeGet; exports.KGDesignerNodeList = _chunk2OYIMLE4js.KGDesignerNodeList; exports.KGDesignerNodeUpdate = _chunk2OYIMLE4js.KGDesignerNodeUpdate; exports.KGDocumentDelete = _chunk2OYIMLE4js.KGDocumentDelete; exports.KGFieldQueryOperatorArrayContains = _chunkRCMHUDQMjs.KGFieldQueryOperatorArrayContains; exports.KGFieldQueryOperatorEqual = _chunkRCMHUDQMjs.KGFieldQueryOperatorEqual; exports.KGFieldQueryOperatorGreater = _chunkRCMHUDQMjs.KGFieldQueryOperatorGreater; exports.KGFieldQueryOperatorGreaterOrEqual = _chunkRCMHUDQMjs.KGFieldQueryOperatorGreaterOrEqual; exports.KGFieldQueryOperatorIn = _chunkRCMHUDQMjs.KGFieldQueryOperatorIn; exports.KGFieldQueryOperatorLess = _chunkRCMHUDQMjs.KGFieldQueryOperatorLess; exports.KGFieldQueryOperatorLessOrEqual = _chunkRCMHUDQMjs.KGFieldQueryOperatorLessOrEqual; exports.KGFieldQueryOperatorLike = _chunkRCMHUDQMjs.KGFieldQueryOperatorLike; exports.KGFieldQueryOperatorNotEqual = _chunkRCMHUDQMjs.KGFieldQueryOperatorNotEqual; exports.KGFieldQueryOperatorSimilar = _chunkRCMHUDQMjs.KGFieldQueryOperatorSimilar; exports.KGGraphCreate = _chunk2OYIMLE4js.KGGraphCreate; exports.KGGraphDelete = _chunk2OYIMLE4js.KGGraphDelete; exports.KGGraphGet = _chunk2OYIMLE4js.KGGraphGet; exports.KGGraphList = _chunk2OYIMLE4js.KGGraphList; exports.KGGraphOptimize = _chunk2OYIMLE4js.KGGraphOptimize; exports.KGGraphUpdate = _chunk2OYIMLE4js.KGGraphUpdate; exports.KGIngestBatchSync = _chunk2OYIMLE4js.KGIngestBatchSync; exports.KGIngestNodeSync = _chunk2OYIMLE4js.KGIngestNodeSync; exports.KGRelationshipDirectionIncoming = _chunkRCMHUDQMjs.KGRelationshipDirectionIncoming; exports.KGRelationshipDirectionOutgoing = _chunkRCMHUDQMjs.KGRelationshipDirectionOutgoing; exports.KGSyncJobList = _chunk2OYIMLE4js.KGSyncJobList; exports.KGSyncJobUpdate = _chunk2OYIMLE4js.KGSyncJobUpdate; exports.KnowledgeGraphContext = KnowledgeGraphContext; exports.KnowledgeGraphContextProvider = KnowledgeGraphContextProvider; exports.Test = Test; exports.useKnowledgeGraph = useKnowledgeGraph; exports.useKnowledgeGraphAnalytics = useKnowledgeGraphAnalytics; exports.useKnowledgeGraphContext = useKnowledgeGraphContext;
89
+ exports.DuplicatePolicyCreate = _chunkWEMVDZJ3js.DuplicatePolicyCreate; exports.DuplicatePolicyCreateIf = _chunkWEMVDZJ3js.DuplicatePolicyCreateIf; exports.DuplicatePolicyFail = _chunkWEMVDZJ3js.DuplicatePolicyFail; exports.DuplicatePolicyIgnore = _chunkWEMVDZJ3js.DuplicatePolicyIgnore; exports.DuplicatePolicyReplace = _chunkWEMVDZJ3js.DuplicatePolicyReplace; exports.KGDBCreate = _chunk2OYIMLE4js.KGDBCreate; exports.KGDesignerEdgeCreate = _chunk2OYIMLE4js.KGDesignerEdgeCreate; exports.KGDesignerEdgeDelete = _chunk2OYIMLE4js.KGDesignerEdgeDelete; exports.KGDesignerEdgeGet = _chunk2OYIMLE4js.KGDesignerEdgeGet; exports.KGDesignerEdgeList = _chunk2OYIMLE4js.KGDesignerEdgeList; exports.KGDesignerEdgeUpdate = _chunk2OYIMLE4js.KGDesignerEdgeUpdate; exports.KGDesignerNodeCreate = _chunk2OYIMLE4js.KGDesignerNodeCreate; exports.KGDesignerNodeDelete = _chunk2OYIMLE4js.KGDesignerNodeDelete; exports.KGDesignerNodeGet = _chunk2OYIMLE4js.KGDesignerNodeGet; exports.KGDesignerNodeList = _chunk2OYIMLE4js.KGDesignerNodeList; exports.KGDesignerNodeUpdate = _chunk2OYIMLE4js.KGDesignerNodeUpdate; exports.KGDocumentDelete = _chunk2OYIMLE4js.KGDocumentDelete; exports.KGFieldQueryOperatorArrayContains = _chunkWEMVDZJ3js.KGFieldQueryOperatorArrayContains; exports.KGFieldQueryOperatorEqual = _chunkWEMVDZJ3js.KGFieldQueryOperatorEqual; exports.KGFieldQueryOperatorGreater = _chunkWEMVDZJ3js.KGFieldQueryOperatorGreater; exports.KGFieldQueryOperatorGreaterOrEqual = _chunkWEMVDZJ3js.KGFieldQueryOperatorGreaterOrEqual; exports.KGFieldQueryOperatorIn = _chunkWEMVDZJ3js.KGFieldQueryOperatorIn; exports.KGFieldQueryOperatorLess = _chunkWEMVDZJ3js.KGFieldQueryOperatorLess; exports.KGFieldQueryOperatorLessOrEqual = _chunkWEMVDZJ3js.KGFieldQueryOperatorLessOrEqual; exports.KGFieldQueryOperatorLike = _chunkWEMVDZJ3js.KGFieldQueryOperatorLike; exports.KGFieldQueryOperatorNotEqual = _chunkWEMVDZJ3js.KGFieldQueryOperatorNotEqual; exports.KGFieldQueryOperatorSimilar = _chunkWEMVDZJ3js.KGFieldQueryOperatorSimilar; exports.KGGraphCreate = _chunk2OYIMLE4js.KGGraphCreate; exports.KGGraphDelete = _chunk2OYIMLE4js.KGGraphDelete; exports.KGGraphGet = _chunk2OYIMLE4js.KGGraphGet; exports.KGGraphList = _chunk2OYIMLE4js.KGGraphList; exports.KGGraphOptimize = _chunk2OYIMLE4js.KGGraphOptimize; exports.KGGraphUpdate = _chunk2OYIMLE4js.KGGraphUpdate; exports.KGIngestBatchSync = _chunk2OYIMLE4js.KGIngestBatchSync; exports.KGIngestNodeSync = _chunk2OYIMLE4js.KGIngestNodeSync; exports.KGRelationshipDirectionIncoming = _chunkWEMVDZJ3js.KGRelationshipDirectionIncoming; exports.KGRelationshipDirectionOutgoing = _chunkWEMVDZJ3js.KGRelationshipDirectionOutgoing; exports.KGSyncJobList = _chunk2OYIMLE4js.KGSyncJobList; exports.KGSyncJobUpdate = _chunk2OYIMLE4js.KGSyncJobUpdate; exports.Test = Test;
481
90
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/eloquent-packages/eloquent-packages/packages/kg/dist/index.js","../consts.ts","../hooks/use-knowledge-graph.ts","../hooks/use-knowledge-graph-analytics.ts","../state/knowledge-graph-context.tsx"],"names":["labels","useUserContext","useState","useNatsContext"],"mappings":"AAAA,gtBAA4B;AAC5B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,sDAA4B;AAC5B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,sDAA4B;AAC5B;AACA;AC7CO,IAAM,KAAA,EAAO,IAAA;AD+CpB;AACA;AE9CA,mCAA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C,CAAS,CAAA;AAEJ,SAAS,6BAAA,CAA8B,KAAA,EAG3C;AACD,EAAA,MAAM,EAAE,QAAA,EAAU,cAAc,EAAA,EAAI,KAAA;AAEpC,EAAA,MAAM,MAAA,EAAQ,iBAAA,CAAkB,aAAa,CAAA;AAE7C,EAAA,uBACE,6BAAA,qBAAC,CAAsB,QAAA,EAAtB,EAA+B,KAAA,EAAO,KAAA,EACpC,SAAA,CACH,CAAA;AAEJ;AAEO,IAAM,yBAAA,EAA2B,CAAA,EAAA,GAAM;AAC5C,EAAA,MAAM,QAAA,EAAU,+BAAA,qBAAgC,CAAA;AAChD,EAAA,GAAA,CAAI,QAAA,IAAY,KAAA,CAAA,EAAW;AACzB,IAAA,MAAM,IAAI,KAAA;AAAA,MACR;AAAA,IACF,CAAA;AAAA,EACF;AACA,EAAA,OAAO,OAAA;AACT,CAAA;AJ8YA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,ugGAAC","file":"/home/runner/work/eloquent-packages/eloquent-packages/packages/kg/dist/index.js","sourcesContent":[null,"export const Test = \"hi\";","\"use client\";\n\nimport { useUserContext } from \"@elqnt/auth\";\nimport { DocsIngestionRequest } from \"@elqnt/docs\";\nimport { useNatsContext } from \"@elqnt/nats\";\nimport { useEffect, useMemo, useState } from \"react\";\nimport {\n Graph,\n KGLabelInfo,\n KGNode,\n KGNodeIngestRequest,\n KGQuery,\n KGQueryResult,\n ListGraphsResult,\n} from \"../models\";\nimport { KGGraphList } from \"../models/kg-designer\";\n\ntype Success = { success: boolean };\n\nexport type UseKnowledgeGraphType = {\n isLoading: boolean;\n ingestNode: (node: KGNodeIngestRequest) => Promise<Success | Error>;\n ingestNodes: (node: KGNodeIngestRequest[]) => Promise<Success | Error>;\n updateNode: (\n nodeId: string,\n label: string,\n fields: Record<string, any>\n ) => Promise<Success | Error>;\n ingestDocs: (\n urls: string[],\n mode: \"documents\" | \"entities\" | \"snippets\",\n brief: string,\n labels: string[]\n ) => Promise<Success | Error>;\n\n ingestText: (\n text: string,\n mode: \"entities\" | \"snippets\"\n ) => Promise<Success | Error>;\n\n ingestYT: (url: string) => Promise<Success | Error>;\n\n queryGraph: (query: KGQuery) => Promise<KGQueryResult>;\n getGraphLabels: () => Promise<KGLabelInfo[] | Error>;\n labels: KGLabelInfo[] | undefined;\n selectedLabel: string | undefined;\n setSelectedLabel: (label: string) => void;\n queryResult: KGQueryResult | undefined;\n setQueryResult: (res: KGQueryResult) => void;\n refreshState: () => void;\n selectedNodeId: string | undefined;\n setSelectedNodeId: (id: string | undefined) => void;\n getNodeById: (id: string) => Promise<KGNode | Error>;\n\n // Graph selection\n graphs: Graph[];\n selectedGraph: Graph | undefined;\n selectedGraphId: string | undefined;\n graphsLoading: boolean;\n graphsError: string | undefined;\n selectGraph: (graphId: string | undefined) => void;\n refreshGraphs: () => Promise<void>;\n};\n\nexport const useKnowledgeGraph = (\n overrideOrgId?: string\n): UseKnowledgeGraphType => {\n const { selectedOrgId } = useUserContext();\n const [isLoading, setIsLoading] = useState(false);\n const { natsConnected, request } = useNatsContext();\n const [selectedNodeId, setSelectedNodeId] = useState<string | undefined>(\n undefined\n );\n\n const orgId = overrideOrgId ?? selectedOrgId;\n\n const [labels, setLabels] = useState<KGLabelInfo[] | undefined>(undefined);\n const [selectedLabel, setSelectedLabel] = useState<string | undefined>(\n undefined\n );\n const [queryResult, setQueryResult] = useState<KGQueryResult | undefined>(\n undefined\n );\n\n const [stateTrigger, setStateTrigger] = useState(0);\n\n // --- Graph selection state ---\n const [graphs, setGraphs] = useState<Graph[]>([]);\n const [graphsLoading, setGraphsLoading] = useState(true);\n const [graphsError, setGraphsError] = useState<string | undefined>();\n const [selectedGraphId, setSelectedGraphId] = useState<string | undefined>();\n\n const selectedGraph = useMemo(() => {\n if (!selectedGraphId) {\n return graphs.find((g) => g.isDefault) || graphs[0];\n }\n return graphs.find((g) => g.id === selectedGraphId);\n }, [graphs, selectedGraphId]);\n\n function selectGraph(graphId: string | undefined) {\n setSelectedGraphId(graphId);\n }\n\n async function refreshGraphs() {\n if (!orgId || !natsConnected) return;\n\n setGraphsLoading(true);\n setGraphsError(undefined);\n\n const data = await request<{}, ListGraphsResult>(KGGraphList, {}, { orgId });\n\n if (data instanceof Error) {\n setGraphsError(data.message);\n setGraphsLoading(false);\n return;\n }\n\n if (data.success !== false) {\n const loadedGraphs = data.graphs || [];\n setGraphs(loadedGraphs);\n\n // Auto-select default graph only if nothing is selected\n setSelectedGraphId((prev) => {\n if (!prev && loadedGraphs.length) {\n const defaultGraph = loadedGraphs.find((g) => g.isDefault);\n return defaultGraph?.id || loadedGraphs[0]?.id;\n }\n return prev;\n });\n } else {\n setGraphsError(data.error || \"Failed to load graphs\");\n }\n\n setGraphsLoading(false);\n }\n\n // Load graphs when NATS connects or org changes\n useEffect(() => {\n if (!natsConnected || !orgId) return;\n setSelectedGraphId(undefined);\n refreshGraphs();\n }, [natsConnected, orgId]);\n\n async function ingestNode(\n node: KGNodeIngestRequest\n ): Promise<Success | Error> {\n if (!orgId) {\n return new Error(\"No orgId provided\");\n }\n\n if (!natsConnected) {\n return new Error(\"Not connected to NATS\");\n }\n\n setIsLoading(true);\n const data = await request<KGNodeIngestRequest, Success>(\n \"kg.ingest.node\",\n node,\n {\n orgId,\n }\n );\n\n setIsLoading(false);\n\n if (data instanceof Error) {\n console.error(data);\n return data;\n }\n\n return data;\n }\n\n async function ingestNodes(\n nodes: KGNodeIngestRequest[]\n ): Promise<Success | Error> {\n if (!orgId) {\n return new Error(\"No orgId provided\");\n }\n\n if (!natsConnected) {\n return new Error(\"Not connected to NATS\");\n }\n\n setIsLoading(true);\n const data = await request<KGNodeIngestRequest[], Success>(\n \"kg.ingest.nodes\",\n nodes,\n {\n orgId,\n }\n );\n\n setIsLoading(false);\n\n if (data instanceof Error) {\n console.error(data);\n return data;\n }\n\n return data;\n }\n\n async function updateNode(\n nodeId: string,\n label: string,\n fields: Record<string, any>\n ): Promise<Success | Error> {\n const nodeRequest: KGNodeIngestRequest = {\n label,\n keyField: \"id\",\n fields: {\n ...fields,\n id: nodeId,\n },\n duplicatePolicy: \"replace\",\n };\n\n const result = await ingestNode(nodeRequest);\n\n // Optimize graph after successful update (non-blocking, with delay)\n if (!(result instanceof Error)) {\n // Wait 2 seconds to ensure node is fully written to ClickHouse\n setTimeout(() => {\n optimizeGraph().catch(err =>\n console.error(\"Failed to optimize graph after node update:\", err)\n );\n }, 2000);\n }\n\n return result;\n }\n\n async function optimizeGraph(): Promise<Success | Error> {\n if (!orgId) {\n return new Error(\"No orgId provided\");\n }\n\n if (!natsConnected) {\n return new Error(\"Not connected to NATS\");\n }\n\n const data = await request<{}, Success>(\n \"kg.graph.optimize\",\n {},\n {\n orgId,\n }\n );\n\n if (data instanceof Error) {\n console.error(\"Graph optimization failed:\", data);\n return data;\n }\n\n console.log(\"Graph optimized successfully\");\n return data;\n }\n\n async function ingestDocs(\n urls: string[],\n mode: \"documents\" | \"entities\" | \"snippets\",\n brief: string,\n labels: string[]\n ): Promise<Success | Error> {\n // todo: implement\n if (!orgId) {\n return new Error(\"No orgId provided\");\n }\n\n if (!natsConnected) {\n return new Error(\"Not connected to NATS\");\n }\n\n setIsLoading(true);\n const data = await request<DocsIngestionRequest, Success>(\n \"docs.kg.ingest\",\n { urls, mode, brief, labels },\n {\n orgId,\n }\n );\n\n setIsLoading(false);\n\n if (data instanceof Error) {\n console.error(data);\n return data;\n }\n\n return data;\n }\n\n async function ingestText(\n text: string,\n mode: \"entities\" | \"snippets\"\n ): Promise<Success | Error> {\n if (!orgId) {\n return new Error(\"No orgId provided\");\n }\n\n if (!natsConnected) {\n return new Error(\"Not connected to NATS\");\n }\n\n setIsLoading(true);\n const data = await request<any, Success>(\n \"docs.kg.ingestText\",\n { text, mode },\n {\n orgId,\n }\n );\n\n setIsLoading(false);\n\n if (data instanceof Error) {\n console.error(data);\n return data;\n }\n\n return data;\n }\n\n async function ingestYT(url: string): Promise<Success | Error> {\n if (!orgId) {\n return new Error(\"No orgId provided\");\n }\n\n if (!natsConnected) {\n return new Error(\"Not connected to NATS\");\n }\n\n setIsLoading(true);\n const data = await request<any, Success>(\n \"docs.kg.ingestYT\",\n { url },\n {\n orgId,\n }\n );\n\n setIsLoading(false);\n\n if (data instanceof Error) {\n console.error(data);\n return data;\n }\n\n return data;\n }\n\n async function queryGraph(query: KGQuery): Promise<KGQueryResult> {\n if (!orgId) {\n throw new Error(\"No orgId provided\");\n }\n\n if (!natsConnected) {\n throw new Error(\"Not connected to NATS\");\n }\n\n setIsLoading(true);\n\n const data = await request<KGQuery, KGQueryResult>(\n \"kg.query.graph\",\n query,\n {\n orgId,\n graphId: selectedGraph?.id,\n }\n );\n\n setIsLoading(false);\n\n if (data instanceof Error) {\n console.error(data);\n return data;\n }\n\n return data;\n }\n\n async function getNodeById(id: string): Promise<KGNode | Error> {\n if (!orgId) {\n return new Error(\"No orgId provided\");\n }\n\n if (!natsConnected) {\n return new Error(\"Not connected to NATS\");\n }\n\n const data = await request<any, KGNode>(\n \"kg.query.nodeById\",\n { id },\n { orgId, graphId: selectedGraph?.id }\n );\n\n if (data instanceof Error) {\n console.error(data);\n return data;\n }\n\n return data;\n }\n\n async function getGraphLabels(): Promise<KGLabelInfo[] | Error> {\n if (!orgId) {\n return new Error(\"No orgId provided\");\n }\n\n if (!natsConnected) {\n return new Error(\"Not connected to NATS\");\n }\n\n // console.log(\"getGraphLabels\", { orgId });\n\n setIsLoading(true);\n\n const data = await request<any, KGLabelInfo[]>(\n \"kg.graph.labels\",\n {},\n { orgId, graphId: selectedGraph?.id }\n );\n\n setIsLoading(false);\n\n if (data instanceof Error) {\n console.error(data);\n return data;\n }\n\n // todo: global error\n if (!Array.isArray(data) && typeof data === \"object\") {\n const err = data as any;\n return new Error(err?.message ?? err?.error ?? err);\n }\n\n return data;\n }\n\n // Reset labels and query state when graph changes\n useEffect(() => {\n setLabels(undefined);\n setSelectedLabel(undefined);\n setQueryResult(undefined);\n }, [selectedGraph?.id]);\n\n useEffect(() => {\n if (!natsConnected || !orgId) {\n return;\n }\n async function getLabels(): Promise<KGLabelInfo[] | Error> {\n const data = await getGraphLabels();\n if (data instanceof Error) {\n // console.error(data);\n return [];\n }\n setLabels(data);\n return data;\n }\n getLabels();\n }, [natsConnected, orgId, selectedGraph?.id, stateTrigger]);\n\n useEffect(() => {\n if (!natsConnected || !orgId || !selectedLabel) {\n return;\n }\n async function getGraphQueryResult() {\n if (!selectedLabel) return;\n\n const query: KGQuery = {\n label: selectedLabel,\n fields: [],\n limit: 5_00,\n sortBy: \"\",\n sortOrder: \"asc\",\n depth: 2,\n };\n\n const res = await queryGraph(query);\n\n if (res instanceof Error) {\n console.error(res);\n return;\n }\n setQueryResult(res);\n }\n getGraphQueryResult();\n }, [natsConnected, orgId, selectedGraph?.id, selectedLabel, stateTrigger]);\n\n function refreshState() {\n setStateTrigger(stateTrigger + 1);\n }\n\n return {\n isLoading,\n ingestNode,\n ingestNodes,\n updateNode,\n queryGraph,\n getNodeById,\n getGraphLabels,\n labels,\n selectedLabel,\n setSelectedLabel,\n queryResult,\n setQueryResult,\n refreshState,\n ingestDocs,\n ingestText,\n selectedNodeId,\n setSelectedNodeId,\n ingestYT,\n\n // Graph selection\n graphs,\n selectedGraph,\n selectedGraphId: selectedGraph?.id,\n graphsLoading,\n graphsError,\n selectGraph,\n refreshGraphs,\n };\n};\n","\"use client\";\n\nimport { useNatsContext } from \"@elqnt/nats\";\nimport { useUserContext } from \"@elqnt/auth\";\nimport { useState } from \"react\";\nexport type UseKnowledgeGraphAnalyticsType = {\n isLoading: boolean;\n};\n\nexport const useKnowledgeGraphAnalytics = (\n overrideOrgId?: string\n): UseKnowledgeGraphAnalyticsType => {\n const { selectedOrgId } = useUserContext();\n const [isLoading, setIsLoading] = useState(false);\n const { natsConnected, request } = useNatsContext();\n\n return {\n isLoading,\n };\n};\n","\"use client\";\n\nimport { ReactNode, createContext, useContext } from \"react\";\nimport {\n UseKnowledgeGraphType,\n useKnowledgeGraph,\n} from \"../hooks/use-knowledge-graph\";\n\nexport const KnowledgeGraphContext = createContext<\n UseKnowledgeGraphType | undefined\n>(undefined);\n\nexport function KnowledgeGraphContextProvider(props: {\n children: ReactNode;\n overrideOrgId?: string;\n}) {\n const { children, overrideOrgId } = props;\n\n const useKG = useKnowledgeGraph(overrideOrgId);\n\n return (\n <KnowledgeGraphContext.Provider value={useKG}>\n {children}\n </KnowledgeGraphContext.Provider>\n );\n}\n\nexport const useKnowledgeGraphContext = () => {\n const context = useContext(KnowledgeGraphContext);\n if (context === undefined) {\n throw new Error(\n \"useKnowledgeGraphContext must be used within a KnowledgeGraphContextProvider\"\n );\n }\n return context;\n};\n"]}
1
+ {"version":3,"sources":["/home/runner/work/eloquent-packages/eloquent-packages/packages/kg/dist/index.js","../consts.ts"],"names":[],"mappings":"AAAA,wGAA4B;AAC5B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,sDAA4B;AAC5B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,sDAA4B;AAC5B;AACA;AC7CO,IAAM,KAAA,EAAO,IAAA;AD+CpB;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,4tFAAC","file":"/home/runner/work/eloquent-packages/eloquent-packages/packages/kg/dist/index.js","sourcesContent":[null,"export const Test = \"hi\";"]}
package/dist/index.mjs CHANGED
@@ -41,396 +41,10 @@ import {
41
41
  KGFieldQueryOperatorSimilar,
42
42
  KGRelationshipDirectionIncoming,
43
43
  KGRelationshipDirectionOutgoing
44
- } from "./chunk-JUOZ4GSY.mjs";
44
+ } from "./chunk-EF7YJ7LL.mjs";
45
45
 
46
46
  // consts.ts
47
47
  var Test = "hi";
48
-
49
- // hooks/use-knowledge-graph.ts
50
- import { useUserContext } from "@elqnt/auth";
51
- import { useNatsContext } from "@elqnt/nats";
52
- import { useEffect, useMemo, useState } from "react";
53
- var useKnowledgeGraph = (overrideOrgId) => {
54
- const { selectedOrgId } = useUserContext();
55
- const [isLoading, setIsLoading] = useState(false);
56
- const { natsConnected, request } = useNatsContext();
57
- const [selectedNodeId, setSelectedNodeId] = useState(
58
- void 0
59
- );
60
- const orgId = overrideOrgId ?? selectedOrgId;
61
- const [labels, setLabels] = useState(void 0);
62
- const [selectedLabel, setSelectedLabel] = useState(
63
- void 0
64
- );
65
- const [queryResult, setQueryResult] = useState(
66
- void 0
67
- );
68
- const [stateTrigger, setStateTrigger] = useState(0);
69
- const [graphs, setGraphs] = useState([]);
70
- const [graphsLoading, setGraphsLoading] = useState(true);
71
- const [graphsError, setGraphsError] = useState();
72
- const [selectedGraphId, setSelectedGraphId] = useState();
73
- const selectedGraph = useMemo(() => {
74
- if (!selectedGraphId) {
75
- return graphs.find((g) => g.isDefault) || graphs[0];
76
- }
77
- return graphs.find((g) => g.id === selectedGraphId);
78
- }, [graphs, selectedGraphId]);
79
- function selectGraph(graphId) {
80
- setSelectedGraphId(graphId);
81
- }
82
- async function refreshGraphs() {
83
- if (!orgId || !natsConnected) return;
84
- setGraphsLoading(true);
85
- setGraphsError(void 0);
86
- const data = await request(KGGraphList, {}, { orgId });
87
- if (data instanceof Error) {
88
- setGraphsError(data.message);
89
- setGraphsLoading(false);
90
- return;
91
- }
92
- if (data.success !== false) {
93
- const loadedGraphs = data.graphs || [];
94
- setGraphs(loadedGraphs);
95
- setSelectedGraphId((prev) => {
96
- if (!prev && loadedGraphs.length) {
97
- const defaultGraph = loadedGraphs.find((g) => g.isDefault);
98
- return defaultGraph?.id || loadedGraphs[0]?.id;
99
- }
100
- return prev;
101
- });
102
- } else {
103
- setGraphsError(data.error || "Failed to load graphs");
104
- }
105
- setGraphsLoading(false);
106
- }
107
- useEffect(() => {
108
- if (!natsConnected || !orgId) return;
109
- setSelectedGraphId(void 0);
110
- refreshGraphs();
111
- }, [natsConnected, orgId]);
112
- async function ingestNode(node) {
113
- if (!orgId) {
114
- return new Error("No orgId provided");
115
- }
116
- if (!natsConnected) {
117
- return new Error("Not connected to NATS");
118
- }
119
- setIsLoading(true);
120
- const data = await request(
121
- "kg.ingest.node",
122
- node,
123
- {
124
- orgId
125
- }
126
- );
127
- setIsLoading(false);
128
- if (data instanceof Error) {
129
- console.error(data);
130
- return data;
131
- }
132
- return data;
133
- }
134
- async function ingestNodes(nodes) {
135
- if (!orgId) {
136
- return new Error("No orgId provided");
137
- }
138
- if (!natsConnected) {
139
- return new Error("Not connected to NATS");
140
- }
141
- setIsLoading(true);
142
- const data = await request(
143
- "kg.ingest.nodes",
144
- nodes,
145
- {
146
- orgId
147
- }
148
- );
149
- setIsLoading(false);
150
- if (data instanceof Error) {
151
- console.error(data);
152
- return data;
153
- }
154
- return data;
155
- }
156
- async function updateNode(nodeId, label, fields) {
157
- const nodeRequest = {
158
- label,
159
- keyField: "id",
160
- fields: {
161
- ...fields,
162
- id: nodeId
163
- },
164
- duplicatePolicy: "replace"
165
- };
166
- const result = await ingestNode(nodeRequest);
167
- if (!(result instanceof Error)) {
168
- setTimeout(() => {
169
- optimizeGraph().catch(
170
- (err) => console.error("Failed to optimize graph after node update:", err)
171
- );
172
- }, 2e3);
173
- }
174
- return result;
175
- }
176
- async function optimizeGraph() {
177
- if (!orgId) {
178
- return new Error("No orgId provided");
179
- }
180
- if (!natsConnected) {
181
- return new Error("Not connected to NATS");
182
- }
183
- const data = await request(
184
- "kg.graph.optimize",
185
- {},
186
- {
187
- orgId
188
- }
189
- );
190
- if (data instanceof Error) {
191
- console.error("Graph optimization failed:", data);
192
- return data;
193
- }
194
- console.log("Graph optimized successfully");
195
- return data;
196
- }
197
- async function ingestDocs(urls, mode, brief, labels2) {
198
- if (!orgId) {
199
- return new Error("No orgId provided");
200
- }
201
- if (!natsConnected) {
202
- return new Error("Not connected to NATS");
203
- }
204
- setIsLoading(true);
205
- const data = await request(
206
- "docs.kg.ingest",
207
- { urls, mode, brief, labels: labels2 },
208
- {
209
- orgId
210
- }
211
- );
212
- setIsLoading(false);
213
- if (data instanceof Error) {
214
- console.error(data);
215
- return data;
216
- }
217
- return data;
218
- }
219
- async function ingestText(text, mode) {
220
- if (!orgId) {
221
- return new Error("No orgId provided");
222
- }
223
- if (!natsConnected) {
224
- return new Error("Not connected to NATS");
225
- }
226
- setIsLoading(true);
227
- const data = await request(
228
- "docs.kg.ingestText",
229
- { text, mode },
230
- {
231
- orgId
232
- }
233
- );
234
- setIsLoading(false);
235
- if (data instanceof Error) {
236
- console.error(data);
237
- return data;
238
- }
239
- return data;
240
- }
241
- async function ingestYT(url) {
242
- if (!orgId) {
243
- return new Error("No orgId provided");
244
- }
245
- if (!natsConnected) {
246
- return new Error("Not connected to NATS");
247
- }
248
- setIsLoading(true);
249
- const data = await request(
250
- "docs.kg.ingestYT",
251
- { url },
252
- {
253
- orgId
254
- }
255
- );
256
- setIsLoading(false);
257
- if (data instanceof Error) {
258
- console.error(data);
259
- return data;
260
- }
261
- return data;
262
- }
263
- async function queryGraph(query) {
264
- if (!orgId) {
265
- throw new Error("No orgId provided");
266
- }
267
- if (!natsConnected) {
268
- throw new Error("Not connected to NATS");
269
- }
270
- setIsLoading(true);
271
- const data = await request(
272
- "kg.query.graph",
273
- query,
274
- {
275
- orgId,
276
- graphId: selectedGraph?.id
277
- }
278
- );
279
- setIsLoading(false);
280
- if (data instanceof Error) {
281
- console.error(data);
282
- return data;
283
- }
284
- return data;
285
- }
286
- async function getNodeById(id) {
287
- if (!orgId) {
288
- return new Error("No orgId provided");
289
- }
290
- if (!natsConnected) {
291
- return new Error("Not connected to NATS");
292
- }
293
- const data = await request(
294
- "kg.query.nodeById",
295
- { id },
296
- { orgId, graphId: selectedGraph?.id }
297
- );
298
- if (data instanceof Error) {
299
- console.error(data);
300
- return data;
301
- }
302
- return data;
303
- }
304
- async function getGraphLabels() {
305
- if (!orgId) {
306
- return new Error("No orgId provided");
307
- }
308
- if (!natsConnected) {
309
- return new Error("Not connected to NATS");
310
- }
311
- setIsLoading(true);
312
- const data = await request(
313
- "kg.graph.labels",
314
- {},
315
- { orgId, graphId: selectedGraph?.id }
316
- );
317
- setIsLoading(false);
318
- if (data instanceof Error) {
319
- console.error(data);
320
- return data;
321
- }
322
- if (!Array.isArray(data) && typeof data === "object") {
323
- const err = data;
324
- return new Error(err?.message ?? err?.error ?? err);
325
- }
326
- return data;
327
- }
328
- useEffect(() => {
329
- setLabels(void 0);
330
- setSelectedLabel(void 0);
331
- setQueryResult(void 0);
332
- }, [selectedGraph?.id]);
333
- useEffect(() => {
334
- if (!natsConnected || !orgId) {
335
- return;
336
- }
337
- async function getLabels() {
338
- const data = await getGraphLabels();
339
- if (data instanceof Error) {
340
- return [];
341
- }
342
- setLabels(data);
343
- return data;
344
- }
345
- getLabels();
346
- }, [natsConnected, orgId, selectedGraph?.id, stateTrigger]);
347
- useEffect(() => {
348
- if (!natsConnected || !orgId || !selectedLabel) {
349
- return;
350
- }
351
- async function getGraphQueryResult() {
352
- if (!selectedLabel) return;
353
- const query = {
354
- label: selectedLabel,
355
- fields: [],
356
- limit: 500,
357
- sortBy: "",
358
- sortOrder: "asc",
359
- depth: 2
360
- };
361
- const res = await queryGraph(query);
362
- if (res instanceof Error) {
363
- console.error(res);
364
- return;
365
- }
366
- setQueryResult(res);
367
- }
368
- getGraphQueryResult();
369
- }, [natsConnected, orgId, selectedGraph?.id, selectedLabel, stateTrigger]);
370
- function refreshState() {
371
- setStateTrigger(stateTrigger + 1);
372
- }
373
- return {
374
- isLoading,
375
- ingestNode,
376
- ingestNodes,
377
- updateNode,
378
- queryGraph,
379
- getNodeById,
380
- getGraphLabels,
381
- labels,
382
- selectedLabel,
383
- setSelectedLabel,
384
- queryResult,
385
- setQueryResult,
386
- refreshState,
387
- ingestDocs,
388
- ingestText,
389
- selectedNodeId,
390
- setSelectedNodeId,
391
- ingestYT,
392
- // Graph selection
393
- graphs,
394
- selectedGraph,
395
- selectedGraphId: selectedGraph?.id,
396
- graphsLoading,
397
- graphsError,
398
- selectGraph,
399
- refreshGraphs
400
- };
401
- };
402
-
403
- // hooks/use-knowledge-graph-analytics.ts
404
- import { useNatsContext as useNatsContext2 } from "@elqnt/nats";
405
- import { useUserContext as useUserContext2 } from "@elqnt/auth";
406
- import { useState as useState2 } from "react";
407
- var useKnowledgeGraphAnalytics = (overrideOrgId) => {
408
- const { selectedOrgId } = useUserContext2();
409
- const [isLoading, setIsLoading] = useState2(false);
410
- const { natsConnected, request } = useNatsContext2();
411
- return {
412
- isLoading
413
- };
414
- };
415
-
416
- // state/knowledge-graph-context.tsx
417
- import { createContext, useContext } from "react";
418
- import { jsx } from "react/jsx-runtime";
419
- var KnowledgeGraphContext = createContext(void 0);
420
- function KnowledgeGraphContextProvider(props) {
421
- const { children, overrideOrgId } = props;
422
- const useKG = useKnowledgeGraph(overrideOrgId);
423
- return /* @__PURE__ */ jsx(KnowledgeGraphContext.Provider, { value: useKG, children });
424
- }
425
- var useKnowledgeGraphContext = () => {
426
- const context = useContext(KnowledgeGraphContext);
427
- if (context === void 0) {
428
- throw new Error(
429
- "useKnowledgeGraphContext must be used within a KnowledgeGraphContextProvider"
430
- );
431
- }
432
- return context;
433
- };
434
48
  export {
435
49
  DuplicatePolicyCreate,
436
50
  DuplicatePolicyCreateIf,
@@ -471,11 +85,6 @@ export {
471
85
  KGRelationshipDirectionOutgoing,
472
86
  KGSyncJobList,
473
87
  KGSyncJobUpdate,
474
- KnowledgeGraphContext,
475
- KnowledgeGraphContextProvider,
476
- Test,
477
- useKnowledgeGraph,
478
- useKnowledgeGraphAnalytics,
479
- useKnowledgeGraphContext
88
+ Test
480
89
  };
481
90
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../consts.ts","../hooks/use-knowledge-graph.ts","../hooks/use-knowledge-graph-analytics.ts","../state/knowledge-graph-context.tsx"],"sourcesContent":["export const Test = \"hi\";","\"use client\";\n\nimport { useUserContext } from \"@elqnt/auth\";\nimport { DocsIngestionRequest } from \"@elqnt/docs\";\nimport { useNatsContext } from \"@elqnt/nats\";\nimport { useEffect, useMemo, useState } from \"react\";\nimport {\n Graph,\n KGLabelInfo,\n KGNode,\n KGNodeIngestRequest,\n KGQuery,\n KGQueryResult,\n ListGraphsResult,\n} from \"../models\";\nimport { KGGraphList } from \"../models/kg-designer\";\n\ntype Success = { success: boolean };\n\nexport type UseKnowledgeGraphType = {\n isLoading: boolean;\n ingestNode: (node: KGNodeIngestRequest) => Promise<Success | Error>;\n ingestNodes: (node: KGNodeIngestRequest[]) => Promise<Success | Error>;\n updateNode: (\n nodeId: string,\n label: string,\n fields: Record<string, any>\n ) => Promise<Success | Error>;\n ingestDocs: (\n urls: string[],\n mode: \"documents\" | \"entities\" | \"snippets\",\n brief: string,\n labels: string[]\n ) => Promise<Success | Error>;\n\n ingestText: (\n text: string,\n mode: \"entities\" | \"snippets\"\n ) => Promise<Success | Error>;\n\n ingestYT: (url: string) => Promise<Success | Error>;\n\n queryGraph: (query: KGQuery) => Promise<KGQueryResult>;\n getGraphLabels: () => Promise<KGLabelInfo[] | Error>;\n labels: KGLabelInfo[] | undefined;\n selectedLabel: string | undefined;\n setSelectedLabel: (label: string) => void;\n queryResult: KGQueryResult | undefined;\n setQueryResult: (res: KGQueryResult) => void;\n refreshState: () => void;\n selectedNodeId: string | undefined;\n setSelectedNodeId: (id: string | undefined) => void;\n getNodeById: (id: string) => Promise<KGNode | Error>;\n\n // Graph selection\n graphs: Graph[];\n selectedGraph: Graph | undefined;\n selectedGraphId: string | undefined;\n graphsLoading: boolean;\n graphsError: string | undefined;\n selectGraph: (graphId: string | undefined) => void;\n refreshGraphs: () => Promise<void>;\n};\n\nexport const useKnowledgeGraph = (\n overrideOrgId?: string\n): UseKnowledgeGraphType => {\n const { selectedOrgId } = useUserContext();\n const [isLoading, setIsLoading] = useState(false);\n const { natsConnected, request } = useNatsContext();\n const [selectedNodeId, setSelectedNodeId] = useState<string | undefined>(\n undefined\n );\n\n const orgId = overrideOrgId ?? selectedOrgId;\n\n const [labels, setLabels] = useState<KGLabelInfo[] | undefined>(undefined);\n const [selectedLabel, setSelectedLabel] = useState<string | undefined>(\n undefined\n );\n const [queryResult, setQueryResult] = useState<KGQueryResult | undefined>(\n undefined\n );\n\n const [stateTrigger, setStateTrigger] = useState(0);\n\n // --- Graph selection state ---\n const [graphs, setGraphs] = useState<Graph[]>([]);\n const [graphsLoading, setGraphsLoading] = useState(true);\n const [graphsError, setGraphsError] = useState<string | undefined>();\n const [selectedGraphId, setSelectedGraphId] = useState<string | undefined>();\n\n const selectedGraph = useMemo(() => {\n if (!selectedGraphId) {\n return graphs.find((g) => g.isDefault) || graphs[0];\n }\n return graphs.find((g) => g.id === selectedGraphId);\n }, [graphs, selectedGraphId]);\n\n function selectGraph(graphId: string | undefined) {\n setSelectedGraphId(graphId);\n }\n\n async function refreshGraphs() {\n if (!orgId || !natsConnected) return;\n\n setGraphsLoading(true);\n setGraphsError(undefined);\n\n const data = await request<{}, ListGraphsResult>(KGGraphList, {}, { orgId });\n\n if (data instanceof Error) {\n setGraphsError(data.message);\n setGraphsLoading(false);\n return;\n }\n\n if (data.success !== false) {\n const loadedGraphs = data.graphs || [];\n setGraphs(loadedGraphs);\n\n // Auto-select default graph only if nothing is selected\n setSelectedGraphId((prev) => {\n if (!prev && loadedGraphs.length) {\n const defaultGraph = loadedGraphs.find((g) => g.isDefault);\n return defaultGraph?.id || loadedGraphs[0]?.id;\n }\n return prev;\n });\n } else {\n setGraphsError(data.error || \"Failed to load graphs\");\n }\n\n setGraphsLoading(false);\n }\n\n // Load graphs when NATS connects or org changes\n useEffect(() => {\n if (!natsConnected || !orgId) return;\n setSelectedGraphId(undefined);\n refreshGraphs();\n }, [natsConnected, orgId]);\n\n async function ingestNode(\n node: KGNodeIngestRequest\n ): Promise<Success | Error> {\n if (!orgId) {\n return new Error(\"No orgId provided\");\n }\n\n if (!natsConnected) {\n return new Error(\"Not connected to NATS\");\n }\n\n setIsLoading(true);\n const data = await request<KGNodeIngestRequest, Success>(\n \"kg.ingest.node\",\n node,\n {\n orgId,\n }\n );\n\n setIsLoading(false);\n\n if (data instanceof Error) {\n console.error(data);\n return data;\n }\n\n return data;\n }\n\n async function ingestNodes(\n nodes: KGNodeIngestRequest[]\n ): Promise<Success | Error> {\n if (!orgId) {\n return new Error(\"No orgId provided\");\n }\n\n if (!natsConnected) {\n return new Error(\"Not connected to NATS\");\n }\n\n setIsLoading(true);\n const data = await request<KGNodeIngestRequest[], Success>(\n \"kg.ingest.nodes\",\n nodes,\n {\n orgId,\n }\n );\n\n setIsLoading(false);\n\n if (data instanceof Error) {\n console.error(data);\n return data;\n }\n\n return data;\n }\n\n async function updateNode(\n nodeId: string,\n label: string,\n fields: Record<string, any>\n ): Promise<Success | Error> {\n const nodeRequest: KGNodeIngestRequest = {\n label,\n keyField: \"id\",\n fields: {\n ...fields,\n id: nodeId,\n },\n duplicatePolicy: \"replace\",\n };\n\n const result = await ingestNode(nodeRequest);\n\n // Optimize graph after successful update (non-blocking, with delay)\n if (!(result instanceof Error)) {\n // Wait 2 seconds to ensure node is fully written to ClickHouse\n setTimeout(() => {\n optimizeGraph().catch(err =>\n console.error(\"Failed to optimize graph after node update:\", err)\n );\n }, 2000);\n }\n\n return result;\n }\n\n async function optimizeGraph(): Promise<Success | Error> {\n if (!orgId) {\n return new Error(\"No orgId provided\");\n }\n\n if (!natsConnected) {\n return new Error(\"Not connected to NATS\");\n }\n\n const data = await request<{}, Success>(\n \"kg.graph.optimize\",\n {},\n {\n orgId,\n }\n );\n\n if (data instanceof Error) {\n console.error(\"Graph optimization failed:\", data);\n return data;\n }\n\n console.log(\"Graph optimized successfully\");\n return data;\n }\n\n async function ingestDocs(\n urls: string[],\n mode: \"documents\" | \"entities\" | \"snippets\",\n brief: string,\n labels: string[]\n ): Promise<Success | Error> {\n // todo: implement\n if (!orgId) {\n return new Error(\"No orgId provided\");\n }\n\n if (!natsConnected) {\n return new Error(\"Not connected to NATS\");\n }\n\n setIsLoading(true);\n const data = await request<DocsIngestionRequest, Success>(\n \"docs.kg.ingest\",\n { urls, mode, brief, labels },\n {\n orgId,\n }\n );\n\n setIsLoading(false);\n\n if (data instanceof Error) {\n console.error(data);\n return data;\n }\n\n return data;\n }\n\n async function ingestText(\n text: string,\n mode: \"entities\" | \"snippets\"\n ): Promise<Success | Error> {\n if (!orgId) {\n return new Error(\"No orgId provided\");\n }\n\n if (!natsConnected) {\n return new Error(\"Not connected to NATS\");\n }\n\n setIsLoading(true);\n const data = await request<any, Success>(\n \"docs.kg.ingestText\",\n { text, mode },\n {\n orgId,\n }\n );\n\n setIsLoading(false);\n\n if (data instanceof Error) {\n console.error(data);\n return data;\n }\n\n return data;\n }\n\n async function ingestYT(url: string): Promise<Success | Error> {\n if (!orgId) {\n return new Error(\"No orgId provided\");\n }\n\n if (!natsConnected) {\n return new Error(\"Not connected to NATS\");\n }\n\n setIsLoading(true);\n const data = await request<any, Success>(\n \"docs.kg.ingestYT\",\n { url },\n {\n orgId,\n }\n );\n\n setIsLoading(false);\n\n if (data instanceof Error) {\n console.error(data);\n return data;\n }\n\n return data;\n }\n\n async function queryGraph(query: KGQuery): Promise<KGQueryResult> {\n if (!orgId) {\n throw new Error(\"No orgId provided\");\n }\n\n if (!natsConnected) {\n throw new Error(\"Not connected to NATS\");\n }\n\n setIsLoading(true);\n\n const data = await request<KGQuery, KGQueryResult>(\n \"kg.query.graph\",\n query,\n {\n orgId,\n graphId: selectedGraph?.id,\n }\n );\n\n setIsLoading(false);\n\n if (data instanceof Error) {\n console.error(data);\n return data;\n }\n\n return data;\n }\n\n async function getNodeById(id: string): Promise<KGNode | Error> {\n if (!orgId) {\n return new Error(\"No orgId provided\");\n }\n\n if (!natsConnected) {\n return new Error(\"Not connected to NATS\");\n }\n\n const data = await request<any, KGNode>(\n \"kg.query.nodeById\",\n { id },\n { orgId, graphId: selectedGraph?.id }\n );\n\n if (data instanceof Error) {\n console.error(data);\n return data;\n }\n\n return data;\n }\n\n async function getGraphLabels(): Promise<KGLabelInfo[] | Error> {\n if (!orgId) {\n return new Error(\"No orgId provided\");\n }\n\n if (!natsConnected) {\n return new Error(\"Not connected to NATS\");\n }\n\n // console.log(\"getGraphLabels\", { orgId });\n\n setIsLoading(true);\n\n const data = await request<any, KGLabelInfo[]>(\n \"kg.graph.labels\",\n {},\n { orgId, graphId: selectedGraph?.id }\n );\n\n setIsLoading(false);\n\n if (data instanceof Error) {\n console.error(data);\n return data;\n }\n\n // todo: global error\n if (!Array.isArray(data) && typeof data === \"object\") {\n const err = data as any;\n return new Error(err?.message ?? err?.error ?? err);\n }\n\n return data;\n }\n\n // Reset labels and query state when graph changes\n useEffect(() => {\n setLabels(undefined);\n setSelectedLabel(undefined);\n setQueryResult(undefined);\n }, [selectedGraph?.id]);\n\n useEffect(() => {\n if (!natsConnected || !orgId) {\n return;\n }\n async function getLabels(): Promise<KGLabelInfo[] | Error> {\n const data = await getGraphLabels();\n if (data instanceof Error) {\n // console.error(data);\n return [];\n }\n setLabels(data);\n return data;\n }\n getLabels();\n }, [natsConnected, orgId, selectedGraph?.id, stateTrigger]);\n\n useEffect(() => {\n if (!natsConnected || !orgId || !selectedLabel) {\n return;\n }\n async function getGraphQueryResult() {\n if (!selectedLabel) return;\n\n const query: KGQuery = {\n label: selectedLabel,\n fields: [],\n limit: 5_00,\n sortBy: \"\",\n sortOrder: \"asc\",\n depth: 2,\n };\n\n const res = await queryGraph(query);\n\n if (res instanceof Error) {\n console.error(res);\n return;\n }\n setQueryResult(res);\n }\n getGraphQueryResult();\n }, [natsConnected, orgId, selectedGraph?.id, selectedLabel, stateTrigger]);\n\n function refreshState() {\n setStateTrigger(stateTrigger + 1);\n }\n\n return {\n isLoading,\n ingestNode,\n ingestNodes,\n updateNode,\n queryGraph,\n getNodeById,\n getGraphLabels,\n labels,\n selectedLabel,\n setSelectedLabel,\n queryResult,\n setQueryResult,\n refreshState,\n ingestDocs,\n ingestText,\n selectedNodeId,\n setSelectedNodeId,\n ingestYT,\n\n // Graph selection\n graphs,\n selectedGraph,\n selectedGraphId: selectedGraph?.id,\n graphsLoading,\n graphsError,\n selectGraph,\n refreshGraphs,\n };\n};\n","\"use client\";\n\nimport { useNatsContext } from \"@elqnt/nats\";\nimport { useUserContext } from \"@elqnt/auth\";\nimport { useState } from \"react\";\nexport type UseKnowledgeGraphAnalyticsType = {\n isLoading: boolean;\n};\n\nexport const useKnowledgeGraphAnalytics = (\n overrideOrgId?: string\n): UseKnowledgeGraphAnalyticsType => {\n const { selectedOrgId } = useUserContext();\n const [isLoading, setIsLoading] = useState(false);\n const { natsConnected, request } = useNatsContext();\n\n return {\n isLoading,\n };\n};\n","\"use client\";\n\nimport { ReactNode, createContext, useContext } from \"react\";\nimport {\n UseKnowledgeGraphType,\n useKnowledgeGraph,\n} from \"../hooks/use-knowledge-graph\";\n\nexport const KnowledgeGraphContext = createContext<\n UseKnowledgeGraphType | undefined\n>(undefined);\n\nexport function KnowledgeGraphContextProvider(props: {\n children: ReactNode;\n overrideOrgId?: string;\n}) {\n const { children, overrideOrgId } = props;\n\n const useKG = useKnowledgeGraph(overrideOrgId);\n\n return (\n <KnowledgeGraphContext.Provider value={useKG}>\n {children}\n </KnowledgeGraphContext.Provider>\n );\n}\n\nexport const useKnowledgeGraphContext = () => {\n const context = useContext(KnowledgeGraphContext);\n if (context === undefined) {\n throw new Error(\n \"useKnowledgeGraphContext must be used within a KnowledgeGraphContextProvider\"\n );\n }\n return context;\n};\n"],"mappings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/B,SAAS,kBAAAC,uBAAsB;AAC/B,SAAS,YAAAC,iBAAgB;AAKlB,IAAM,6BAA6B,CACxC,kBACmC;AACnC,QAAM,EAAE,cAAc,IAAID,gBAAe;AACzC,QAAM,CAAC,WAAW,YAAY,IAAIC,UAAS,KAAK;AAChD,QAAM,EAAE,eAAe,QAAQ,IAAIF,gBAAe;AAElD,SAAO;AAAA,IACL;AAAA,EACF;AACF;;;ACjBA,SAAoB,eAAe,kBAAkB;AAmBjD;AAbG,IAAM,wBAAwB,cAEnC,MAAS;AAEJ,SAAS,8BAA8B,OAG3C;AACD,QAAM,EAAE,UAAU,cAAc,IAAI;AAEpC,QAAM,QAAQ,kBAAkB,aAAa;AAE7C,SACE,oBAAC,sBAAsB,UAAtB,EAA+B,OAAO,OACpC,UACH;AAEJ;AAEO,IAAM,2BAA2B,MAAM;AAC5C,QAAM,UAAU,WAAW,qBAAqB;AAChD,MAAI,YAAY,QAAW;AACzB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;","names":["labels","useNatsContext","useUserContext","useState"]}
1
+ {"version":3,"sources":["../consts.ts"],"sourcesContent":["export const Test = \"hi\";"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,IAAM,OAAO;","names":[]}
@@ -41,7 +41,7 @@ var _chunk2OYIMLE4js = require('../chunk-2OYIMLE4.js');
41
41
 
42
42
 
43
43
 
44
- var _chunkRCMHUDQMjs = require('../chunk-RCMHUDQM.js');
44
+ var _chunkWEMVDZJ3js = require('../chunk-WEMVDZJ3.js');
45
45
 
46
46
 
47
47
 
@@ -82,5 +82,5 @@ var _chunkRCMHUDQMjs = require('../chunk-RCMHUDQM.js');
82
82
 
83
83
 
84
84
 
85
- exports.DuplicatePolicyCreate = _chunkRCMHUDQMjs.DuplicatePolicyCreate; exports.DuplicatePolicyCreateIf = _chunkRCMHUDQMjs.DuplicatePolicyCreateIf; exports.DuplicatePolicyFail = _chunkRCMHUDQMjs.DuplicatePolicyFail; exports.DuplicatePolicyIgnore = _chunkRCMHUDQMjs.DuplicatePolicyIgnore; exports.DuplicatePolicyReplace = _chunkRCMHUDQMjs.DuplicatePolicyReplace; exports.KGDBCreate = _chunk2OYIMLE4js.KGDBCreate; exports.KGDesignerEdgeCreate = _chunk2OYIMLE4js.KGDesignerEdgeCreate; exports.KGDesignerEdgeDelete = _chunk2OYIMLE4js.KGDesignerEdgeDelete; exports.KGDesignerEdgeGet = _chunk2OYIMLE4js.KGDesignerEdgeGet; exports.KGDesignerEdgeList = _chunk2OYIMLE4js.KGDesignerEdgeList; exports.KGDesignerEdgeUpdate = _chunk2OYIMLE4js.KGDesignerEdgeUpdate; exports.KGDesignerNodeCreate = _chunk2OYIMLE4js.KGDesignerNodeCreate; exports.KGDesignerNodeDelete = _chunk2OYIMLE4js.KGDesignerNodeDelete; exports.KGDesignerNodeGet = _chunk2OYIMLE4js.KGDesignerNodeGet; exports.KGDesignerNodeList = _chunk2OYIMLE4js.KGDesignerNodeList; exports.KGDesignerNodeUpdate = _chunk2OYIMLE4js.KGDesignerNodeUpdate; exports.KGDocumentDelete = _chunk2OYIMLE4js.KGDocumentDelete; exports.KGFieldQueryOperatorArrayContains = _chunkRCMHUDQMjs.KGFieldQueryOperatorArrayContains; exports.KGFieldQueryOperatorEqual = _chunkRCMHUDQMjs.KGFieldQueryOperatorEqual; exports.KGFieldQueryOperatorGreater = _chunkRCMHUDQMjs.KGFieldQueryOperatorGreater; exports.KGFieldQueryOperatorGreaterOrEqual = _chunkRCMHUDQMjs.KGFieldQueryOperatorGreaterOrEqual; exports.KGFieldQueryOperatorIn = _chunkRCMHUDQMjs.KGFieldQueryOperatorIn; exports.KGFieldQueryOperatorLess = _chunkRCMHUDQMjs.KGFieldQueryOperatorLess; exports.KGFieldQueryOperatorLessOrEqual = _chunkRCMHUDQMjs.KGFieldQueryOperatorLessOrEqual; exports.KGFieldQueryOperatorLike = _chunkRCMHUDQMjs.KGFieldQueryOperatorLike; exports.KGFieldQueryOperatorNotEqual = _chunkRCMHUDQMjs.KGFieldQueryOperatorNotEqual; exports.KGFieldQueryOperatorSimilar = _chunkRCMHUDQMjs.KGFieldQueryOperatorSimilar; exports.KGGraphCreate = _chunk2OYIMLE4js.KGGraphCreate; exports.KGGraphDelete = _chunk2OYIMLE4js.KGGraphDelete; exports.KGGraphGet = _chunk2OYIMLE4js.KGGraphGet; exports.KGGraphList = _chunk2OYIMLE4js.KGGraphList; exports.KGGraphOptimize = _chunk2OYIMLE4js.KGGraphOptimize; exports.KGGraphUpdate = _chunk2OYIMLE4js.KGGraphUpdate; exports.KGIngestBatchSync = _chunk2OYIMLE4js.KGIngestBatchSync; exports.KGIngestNodeSync = _chunk2OYIMLE4js.KGIngestNodeSync; exports.KGRelationshipDirectionIncoming = _chunkRCMHUDQMjs.KGRelationshipDirectionIncoming; exports.KGRelationshipDirectionOutgoing = _chunkRCMHUDQMjs.KGRelationshipDirectionOutgoing; exports.KGSyncJobList = _chunk2OYIMLE4js.KGSyncJobList; exports.KGSyncJobUpdate = _chunk2OYIMLE4js.KGSyncJobUpdate;
85
+ exports.DuplicatePolicyCreate = _chunkWEMVDZJ3js.DuplicatePolicyCreate; exports.DuplicatePolicyCreateIf = _chunkWEMVDZJ3js.DuplicatePolicyCreateIf; exports.DuplicatePolicyFail = _chunkWEMVDZJ3js.DuplicatePolicyFail; exports.DuplicatePolicyIgnore = _chunkWEMVDZJ3js.DuplicatePolicyIgnore; exports.DuplicatePolicyReplace = _chunkWEMVDZJ3js.DuplicatePolicyReplace; exports.KGDBCreate = _chunk2OYIMLE4js.KGDBCreate; exports.KGDesignerEdgeCreate = _chunk2OYIMLE4js.KGDesignerEdgeCreate; exports.KGDesignerEdgeDelete = _chunk2OYIMLE4js.KGDesignerEdgeDelete; exports.KGDesignerEdgeGet = _chunk2OYIMLE4js.KGDesignerEdgeGet; exports.KGDesignerEdgeList = _chunk2OYIMLE4js.KGDesignerEdgeList; exports.KGDesignerEdgeUpdate = _chunk2OYIMLE4js.KGDesignerEdgeUpdate; exports.KGDesignerNodeCreate = _chunk2OYIMLE4js.KGDesignerNodeCreate; exports.KGDesignerNodeDelete = _chunk2OYIMLE4js.KGDesignerNodeDelete; exports.KGDesignerNodeGet = _chunk2OYIMLE4js.KGDesignerNodeGet; exports.KGDesignerNodeList = _chunk2OYIMLE4js.KGDesignerNodeList; exports.KGDesignerNodeUpdate = _chunk2OYIMLE4js.KGDesignerNodeUpdate; exports.KGDocumentDelete = _chunk2OYIMLE4js.KGDocumentDelete; exports.KGFieldQueryOperatorArrayContains = _chunkWEMVDZJ3js.KGFieldQueryOperatorArrayContains; exports.KGFieldQueryOperatorEqual = _chunkWEMVDZJ3js.KGFieldQueryOperatorEqual; exports.KGFieldQueryOperatorGreater = _chunkWEMVDZJ3js.KGFieldQueryOperatorGreater; exports.KGFieldQueryOperatorGreaterOrEqual = _chunkWEMVDZJ3js.KGFieldQueryOperatorGreaterOrEqual; exports.KGFieldQueryOperatorIn = _chunkWEMVDZJ3js.KGFieldQueryOperatorIn; exports.KGFieldQueryOperatorLess = _chunkWEMVDZJ3js.KGFieldQueryOperatorLess; exports.KGFieldQueryOperatorLessOrEqual = _chunkWEMVDZJ3js.KGFieldQueryOperatorLessOrEqual; exports.KGFieldQueryOperatorLike = _chunkWEMVDZJ3js.KGFieldQueryOperatorLike; exports.KGFieldQueryOperatorNotEqual = _chunkWEMVDZJ3js.KGFieldQueryOperatorNotEqual; exports.KGFieldQueryOperatorSimilar = _chunkWEMVDZJ3js.KGFieldQueryOperatorSimilar; exports.KGGraphCreate = _chunk2OYIMLE4js.KGGraphCreate; exports.KGGraphDelete = _chunk2OYIMLE4js.KGGraphDelete; exports.KGGraphGet = _chunk2OYIMLE4js.KGGraphGet; exports.KGGraphList = _chunk2OYIMLE4js.KGGraphList; exports.KGGraphOptimize = _chunk2OYIMLE4js.KGGraphOptimize; exports.KGGraphUpdate = _chunk2OYIMLE4js.KGGraphUpdate; exports.KGIngestBatchSync = _chunk2OYIMLE4js.KGIngestBatchSync; exports.KGIngestNodeSync = _chunk2OYIMLE4js.KGIngestNodeSync; exports.KGRelationshipDirectionIncoming = _chunkWEMVDZJ3js.KGRelationshipDirectionIncoming; exports.KGRelationshipDirectionOutgoing = _chunkWEMVDZJ3js.KGRelationshipDirectionOutgoing; exports.KGSyncJobList = _chunk2OYIMLE4js.KGSyncJobList; exports.KGSyncJobUpdate = _chunk2OYIMLE4js.KGSyncJobUpdate;
86
86
  //# sourceMappingURL=index.js.map
@@ -41,7 +41,7 @@ import {
41
41
  KGFieldQueryOperatorSimilar,
42
42
  KGRelationshipDirectionIncoming,
43
43
  KGRelationshipDirectionOutgoing
44
- } from "../chunk-JUOZ4GSY.mjs";
44
+ } from "../chunk-EF7YJ7LL.mjs";
45
45
  export {
46
46
  DuplicatePolicyCreate,
47
47
  DuplicatePolicyCreateIf,
@@ -130,6 +130,7 @@ interface KGQuery {
130
130
  edges?: KGEdgeQuery[];
131
131
  embeddingsSource?: string;
132
132
  skipEmbedding?: boolean;
133
+ summaryOnly?: boolean;
133
134
  }
134
135
  interface KGFieldQuery {
135
136
  name: string;
@@ -130,6 +130,7 @@ interface KGQuery {
130
130
  edges?: KGEdgeQuery[];
131
131
  embeddingsSource?: string;
132
132
  skipEmbedding?: boolean;
133
+ summaryOnly?: boolean;
133
134
  }
134
135
  interface KGFieldQuery {
135
136
  name: string;
package/dist/models/kg.js CHANGED
@@ -16,7 +16,7 @@
16
16
 
17
17
 
18
18
 
19
- var _chunkRCMHUDQMjs = require('../chunk-RCMHUDQM.js');
19
+ var _chunkWEMVDZJ3js = require('../chunk-WEMVDZJ3.js');
20
20
 
21
21
 
22
22
 
@@ -35,5 +35,5 @@ var _chunkRCMHUDQMjs = require('../chunk-RCMHUDQM.js');
35
35
 
36
36
 
37
37
 
38
- exports.DuplicatePolicyCreate = _chunkRCMHUDQMjs.DuplicatePolicyCreate; exports.DuplicatePolicyCreateIf = _chunkRCMHUDQMjs.DuplicatePolicyCreateIf; exports.DuplicatePolicyFail = _chunkRCMHUDQMjs.DuplicatePolicyFail; exports.DuplicatePolicyIgnore = _chunkRCMHUDQMjs.DuplicatePolicyIgnore; exports.DuplicatePolicyReplace = _chunkRCMHUDQMjs.DuplicatePolicyReplace; exports.KGFieldQueryOperatorArrayContains = _chunkRCMHUDQMjs.KGFieldQueryOperatorArrayContains; exports.KGFieldQueryOperatorEqual = _chunkRCMHUDQMjs.KGFieldQueryOperatorEqual; exports.KGFieldQueryOperatorGreater = _chunkRCMHUDQMjs.KGFieldQueryOperatorGreater; exports.KGFieldQueryOperatorGreaterOrEqual = _chunkRCMHUDQMjs.KGFieldQueryOperatorGreaterOrEqual; exports.KGFieldQueryOperatorIn = _chunkRCMHUDQMjs.KGFieldQueryOperatorIn; exports.KGFieldQueryOperatorLess = _chunkRCMHUDQMjs.KGFieldQueryOperatorLess; exports.KGFieldQueryOperatorLessOrEqual = _chunkRCMHUDQMjs.KGFieldQueryOperatorLessOrEqual; exports.KGFieldQueryOperatorLike = _chunkRCMHUDQMjs.KGFieldQueryOperatorLike; exports.KGFieldQueryOperatorNotEqual = _chunkRCMHUDQMjs.KGFieldQueryOperatorNotEqual; exports.KGFieldQueryOperatorSimilar = _chunkRCMHUDQMjs.KGFieldQueryOperatorSimilar; exports.KGRelationshipDirectionIncoming = _chunkRCMHUDQMjs.KGRelationshipDirectionIncoming; exports.KGRelationshipDirectionOutgoing = _chunkRCMHUDQMjs.KGRelationshipDirectionOutgoing;
38
+ exports.DuplicatePolicyCreate = _chunkWEMVDZJ3js.DuplicatePolicyCreate; exports.DuplicatePolicyCreateIf = _chunkWEMVDZJ3js.DuplicatePolicyCreateIf; exports.DuplicatePolicyFail = _chunkWEMVDZJ3js.DuplicatePolicyFail; exports.DuplicatePolicyIgnore = _chunkWEMVDZJ3js.DuplicatePolicyIgnore; exports.DuplicatePolicyReplace = _chunkWEMVDZJ3js.DuplicatePolicyReplace; exports.KGFieldQueryOperatorArrayContains = _chunkWEMVDZJ3js.KGFieldQueryOperatorArrayContains; exports.KGFieldQueryOperatorEqual = _chunkWEMVDZJ3js.KGFieldQueryOperatorEqual; exports.KGFieldQueryOperatorGreater = _chunkWEMVDZJ3js.KGFieldQueryOperatorGreater; exports.KGFieldQueryOperatorGreaterOrEqual = _chunkWEMVDZJ3js.KGFieldQueryOperatorGreaterOrEqual; exports.KGFieldQueryOperatorIn = _chunkWEMVDZJ3js.KGFieldQueryOperatorIn; exports.KGFieldQueryOperatorLess = _chunkWEMVDZJ3js.KGFieldQueryOperatorLess; exports.KGFieldQueryOperatorLessOrEqual = _chunkWEMVDZJ3js.KGFieldQueryOperatorLessOrEqual; exports.KGFieldQueryOperatorLike = _chunkWEMVDZJ3js.KGFieldQueryOperatorLike; exports.KGFieldQueryOperatorNotEqual = _chunkWEMVDZJ3js.KGFieldQueryOperatorNotEqual; exports.KGFieldQueryOperatorSimilar = _chunkWEMVDZJ3js.KGFieldQueryOperatorSimilar; exports.KGRelationshipDirectionIncoming = _chunkWEMVDZJ3js.KGRelationshipDirectionIncoming; exports.KGRelationshipDirectionOutgoing = _chunkWEMVDZJ3js.KGRelationshipDirectionOutgoing;
39
39
  //# sourceMappingURL=kg.js.map
@@ -16,7 +16,7 @@ import {
16
16
  KGFieldQueryOperatorSimilar,
17
17
  KGRelationshipDirectionIncoming,
18
18
  KGRelationshipDirectionOutgoing
19
- } from "../chunk-JUOZ4GSY.mjs";
19
+ } from "../chunk-EF7YJ7LL.mjs";
20
20
  export {
21
21
  DuplicatePolicyCreate,
22
22
  DuplicatePolicyCreateIf,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elqnt/kg",
3
- "version": "1.0.12",
3
+ "version": "2.0.0",
4
4
  "description": "Knowledge graph functionality for Eloquent platform",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -40,10 +40,7 @@
40
40
  "directory": "packages/kg"
41
41
  },
42
42
  "dependencies": {
43
- "@elqnt/auth": "^1.0.0",
44
- "@elqnt/docs": "^1.0.0",
45
- "@elqnt/nats": "^1.0.0",
46
- "@elqnt/types": "^1.0.0"
43
+ "@elqnt/types": "^2.0.0"
47
44
  },
48
45
  "peerDependencies": {
49
46
  "react": "^18.0.0 || ^19.0.0"
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../models/kg.ts"],"sourcesContent":["// Code generated by tygo. DO NOT EDIT.\nimport { ResponseMetadata } from \"@elqnt/types\";\n\n//////////\n// source: kg-models.go\n\n/**\n * Graph represents a knowledge graph within an organization\n */\nexport interface Graph {\n id: string;\n name: string;\n description: string;\n isDefault: boolean;\n createdAt: string /* RFC3339 */;\n updatedAt: string /* RFC3339 */;\n}\n/**\n * CreateGraphRequest is the request to create a new graph\n */\nexport interface CreateGraphRequest {\n id?: string; // Optional: if provided, use as graph ID (must be valid UUID)\n name: string;\n description: string;\n}\n/**\n * CreateGraphResult is the response for creating a graph\n */\nexport interface CreateGraphResult {\n graph?: Graph;\n success: boolean;\n error?: string;\n metadata?: ResponseMetadata;\n}\n/**\n * GetGraphResult is the response for getting a single graph\n */\nexport interface GetGraphResult {\n graph?: Graph;\n success: boolean;\n error?: string;\n metadata?: ResponseMetadata;\n}\n/**\n * ListGraphsResult is the response for listing graphs\n */\nexport interface ListGraphsResult {\n graphs?: Graph[];\n success: boolean;\n error?: string;\n metadata?: ResponseMetadata;\n}\n/**\n * UpdateGraphResult is the response for updating a graph\n */\nexport interface UpdateGraphResult {\n graph?: Graph;\n success: boolean;\n error?: string;\n metadata?: ResponseMetadata;\n}\n/**\n * DeleteGraphResult is the response for deleting a graph\n */\nexport interface DeleteGraphResult {\n success: boolean;\n error?: string;\n metadata?: ResponseMetadata;\n}\nexport interface KGNode {\n id: string;\n label: string;\n fields: { [key: string]: any};\n relationships?: KGEdge[];\n score?: number /* float64 */;\n}\nexport interface KGEdge {\n id: string;\n label: string;\n fields: { [key: string]: any};\n from: string;\n to: string;\n}\n/**\n * KGNodeIngestRequest represents a request to ingest a node into the knowledge graph.\n * Note: graphId should be passed via NATS header, not in the body.\n */\nexport interface KGNodeIngestRequest {\n label: string;\n keyField?: string;\n reverseEdgeLabel?: string;\n fields: { [key: string]: any};\n edges?: KGEdgeIngestRequest[];\n duplicatePolicy?: DuplicatePolicy;\n generateEmbeddings?: boolean;\n embeddingsSource?: string;\n embeddingsFields?: string[];\n}\nexport type DuplicatePolicy = string;\nexport const DuplicatePolicyCreateIf: DuplicatePolicy = \"createIfNotExist\";\nexport const DuplicatePolicyIgnore: DuplicatePolicy = \"ignore\";\nexport const DuplicatePolicyReplace: DuplicatePolicy = \"replace\";\nexport const DuplicatePolicyFail: DuplicatePolicy = \"fail\";\nexport const DuplicatePolicyCreate: DuplicatePolicy = \"create\";\nexport interface KGEdgeIngestRequest {\n label: string;\n fields: { [key: string]: any};\n toLabel: string;\n toFieldKey: string;\n toFieldValue: any;\n createReciprocal: boolean;\n reciprocalLabel: string;\n allowEmbeddingsSearch?: boolean;\n}\n/**\n * KGQuery represents a query to the knowledge graph.\n * Note: graphId should be passed via NATS header, not in the body.\n */\nexport interface KGQuery {\n label: string;\n fields: KGFieldQuery[];\n limit: number /* int */;\n depth: number /* int */;\n sortBy: string;\n sortOrder: string;\n edges?: KGEdgeQuery[];\n embeddingsSource?: string;\n skipEmbedding?: boolean;\n}\nexport interface KGFieldQuery {\n name: string;\n value: any;\n operator: KGFieldQueryOperator;\n}\nexport type KGFieldQueryOperator = string;\nexport const KGFieldQueryOperatorEqual: KGFieldQueryOperator = \"eq\";\nexport const KGFieldQueryOperatorNotEqual: KGFieldQueryOperator = \"neq\";\nexport const KGFieldQueryOperatorGreater: KGFieldQueryOperator = \"gt\";\nexport const KGFieldQueryOperatorLess: KGFieldQueryOperator = \"lt\";\nexport const KGFieldQueryOperatorGreaterOrEqual: KGFieldQueryOperator = \"gte\";\nexport const KGFieldQueryOperatorLessOrEqual: KGFieldQueryOperator = \"lte\";\nexport const KGFieldQueryOperatorLike: KGFieldQueryOperator = \"like\";\nexport const KGFieldQueryOperatorSimilar: KGFieldQueryOperator = \"similar\";\n/**\n * KGFieldQueryOperatorGreaterOrEqual KGFieldQueryOperator = \"gte\"\n * KGFieldQueryOperatorLessOrEqual KGFieldQueryOperator = \"lte\"\n */\nexport const KGFieldQueryOperatorIn: KGFieldQueryOperator = \"in\";\nexport const KGFieldQueryOperatorArrayContains: KGFieldQueryOperator = \"arrayContains\";\nexport type KGRelationshipDirection = string;\nexport const KGRelationshipDirectionIncoming: KGRelationshipDirection = \"incoming\";\nexport const KGRelationshipDirectionOutgoing: KGRelationshipDirection = \"outgoing\";\nexport interface KGEdgeQuery {\n label: string;\n direction: 'incoming' | 'outgoing';\n fields?: { [key: string]: any};\n /**\n * FromLabel string `json:\"fromLabel\"`\n * FromFieldKey string `json:\"fromFieldKey\"`\n * FromValue interface{} `json:\"fromValue\"`\n */\n toLabel: string;\n toFieldKey: string;\n toFieldValue: any;\n}\nexport interface KGQueryResult {\n nodes: KGNode[];\n edges: KGEdge[];\n}\nexport interface KGLabelInfo {\n label: string;\n count: number /* uint64 */;\n}\nexport interface KGPropertyInfo {\n property: string;\n count: number /* uint64 */;\n}\nexport interface KGPLabelSchema {\n label: string;\n keys: string[];\n}\nexport interface KGArticle {\n id: string;\n title: string;\n content: string;\n lang?: string;\n docUrl?: string;\n paragraphs?: string;\n}\nexport interface KGPropertyFilter {\n property: string;\n value: string;\n}\nexport interface KGPropertyFilterRequest {\n label: string;\n filters: KGPropertyFilter[];\n}\nexport interface DeleteDocumentRequest {\n documentId: string;\n}\nexport interface DeleteDocumentResponse {\n success: boolean;\n deletedNodes: { [key: string]: number /* int */};\n totalDeleted: number /* int */;\n error?: string;\n}\n/**\n * KGSyncJob represents a sync job record in the database\n */\nexport interface KGSyncJob {\n id: string;\n title: string;\n stats: { [key: string]: any};\n startTime: string;\n endTime: string;\n updatedAt?: string;\n}\n/**\n * KGSyncJobUpdateRequest is used to insert or update a sync job\n */\nexport interface KGSyncJobUpdateRequest {\n id: string;\n title: string;\n stats: { [key: string]: any};\n startTime: string;\n endTime: string;\n}\nexport interface KGSyncJobUpdateResponse {\n jobId: string;\n metadata: ResponseMetadata;\n}\nexport interface KGSyncJobListResponse {\n jobs: KGSyncJob[];\n metadata: ResponseMetadata;\n}\n/**\n * KGSyncJobListRequest is used to list sync jobs with filters\n */\nexport interface KGSyncJobListRequest {\n limit?: number /* int */;\n offset?: number /* int */;\n startFrom?: string;\n endTo?: string;\n}\n/**\n * KGSyncIngestResponse is the response for synchronous single node ingestion\n */\nexport interface KGSyncIngestResponse {\n success: boolean;\n nodeId?: string;\n error?: string;\n metadata: ResponseMetadata;\n}\n/**\n * KGBatchSyncIngestResponse is the response for synchronous batch node ingestion\n */\nexport interface KGBatchSyncIngestResponse {\n success: boolean;\n ingestedCount: number /* int */;\n nodeIds?: string[];\n errors?: string[];\n metadata: ResponseMetadata;\n}\n"],"mappings":";AAmGO,IAAM,0BAA2C;AACjD,IAAM,wBAAyC;AAC/C,IAAM,yBAA0C;AAChD,IAAM,sBAAuC;AAC7C,IAAM,wBAAyC;AAgC/C,IAAM,4BAAkD;AACxD,IAAM,+BAAqD;AAC3D,IAAM,8BAAoD;AAC1D,IAAM,2BAAiD;AACvD,IAAM,qCAA2D;AACjE,IAAM,kCAAwD;AAC9D,IAAM,2BAAiD;AACvD,IAAM,8BAAoD;AAK1D,IAAM,yBAA+C;AACrD,IAAM,oCAA0D;AAEhE,IAAM,kCAA2D;AACjE,IAAM,kCAA2D;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/work/eloquent-packages/eloquent-packages/packages/kg/dist/chunk-RCMHUDQM.js","../models/kg.ts"],"names":[],"mappings":"AAAA;ACmGO,IAAM,wBAAA,EAA2C,kBAAA;AACjD,IAAM,sBAAA,EAAyC,QAAA;AAC/C,IAAM,uBAAA,EAA0C,SAAA;AAChD,IAAM,oBAAA,EAAuC,MAAA;AAC7C,IAAM,sBAAA,EAAyC,QAAA;AAgC/C,IAAM,0BAAA,EAAkD,IAAA;AACxD,IAAM,6BAAA,EAAqD,KAAA;AAC3D,IAAM,4BAAA,EAAoD,IAAA;AAC1D,IAAM,yBAAA,EAAiD,IAAA;AACvD,IAAM,mCAAA,EAA2D,KAAA;AACjE,IAAM,gCAAA,EAAwD,KAAA;AAC9D,IAAM,yBAAA,EAAiD,MAAA;AACvD,IAAM,4BAAA,EAAoD,SAAA;AAK1D,IAAM,uBAAA,EAA+C,IAAA;AACrD,IAAM,kCAAA,EAA0D,eAAA;AAEhE,IAAM,gCAAA,EAA2D,UAAA;AACjE,IAAM,gCAAA,EAA2D,UAAA;ADrIxE;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,klCAAC","file":"/home/runner/work/eloquent-packages/eloquent-packages/packages/kg/dist/chunk-RCMHUDQM.js","sourcesContent":[null,"// Code generated by tygo. DO NOT EDIT.\nimport { ResponseMetadata } from \"@elqnt/types\";\n\n//////////\n// source: kg-models.go\n\n/**\n * Graph represents a knowledge graph within an organization\n */\nexport interface Graph {\n id: string;\n name: string;\n description: string;\n isDefault: boolean;\n createdAt: string /* RFC3339 */;\n updatedAt: string /* RFC3339 */;\n}\n/**\n * CreateGraphRequest is the request to create a new graph\n */\nexport interface CreateGraphRequest {\n id?: string; // Optional: if provided, use as graph ID (must be valid UUID)\n name: string;\n description: string;\n}\n/**\n * CreateGraphResult is the response for creating a graph\n */\nexport interface CreateGraphResult {\n graph?: Graph;\n success: boolean;\n error?: string;\n metadata?: ResponseMetadata;\n}\n/**\n * GetGraphResult is the response for getting a single graph\n */\nexport interface GetGraphResult {\n graph?: Graph;\n success: boolean;\n error?: string;\n metadata?: ResponseMetadata;\n}\n/**\n * ListGraphsResult is the response for listing graphs\n */\nexport interface ListGraphsResult {\n graphs?: Graph[];\n success: boolean;\n error?: string;\n metadata?: ResponseMetadata;\n}\n/**\n * UpdateGraphResult is the response for updating a graph\n */\nexport interface UpdateGraphResult {\n graph?: Graph;\n success: boolean;\n error?: string;\n metadata?: ResponseMetadata;\n}\n/**\n * DeleteGraphResult is the response for deleting a graph\n */\nexport interface DeleteGraphResult {\n success: boolean;\n error?: string;\n metadata?: ResponseMetadata;\n}\nexport interface KGNode {\n id: string;\n label: string;\n fields: { [key: string]: any};\n relationships?: KGEdge[];\n score?: number /* float64 */;\n}\nexport interface KGEdge {\n id: string;\n label: string;\n fields: { [key: string]: any};\n from: string;\n to: string;\n}\n/**\n * KGNodeIngestRequest represents a request to ingest a node into the knowledge graph.\n * Note: graphId should be passed via NATS header, not in the body.\n */\nexport interface KGNodeIngestRequest {\n label: string;\n keyField?: string;\n reverseEdgeLabel?: string;\n fields: { [key: string]: any};\n edges?: KGEdgeIngestRequest[];\n duplicatePolicy?: DuplicatePolicy;\n generateEmbeddings?: boolean;\n embeddingsSource?: string;\n embeddingsFields?: string[];\n}\nexport type DuplicatePolicy = string;\nexport const DuplicatePolicyCreateIf: DuplicatePolicy = \"createIfNotExist\";\nexport const DuplicatePolicyIgnore: DuplicatePolicy = \"ignore\";\nexport const DuplicatePolicyReplace: DuplicatePolicy = \"replace\";\nexport const DuplicatePolicyFail: DuplicatePolicy = \"fail\";\nexport const DuplicatePolicyCreate: DuplicatePolicy = \"create\";\nexport interface KGEdgeIngestRequest {\n label: string;\n fields: { [key: string]: any};\n toLabel: string;\n toFieldKey: string;\n toFieldValue: any;\n createReciprocal: boolean;\n reciprocalLabel: string;\n allowEmbeddingsSearch?: boolean;\n}\n/**\n * KGQuery represents a query to the knowledge graph.\n * Note: graphId should be passed via NATS header, not in the body.\n */\nexport interface KGQuery {\n label: string;\n fields: KGFieldQuery[];\n limit: number /* int */;\n depth: number /* int */;\n sortBy: string;\n sortOrder: string;\n edges?: KGEdgeQuery[];\n embeddingsSource?: string;\n skipEmbedding?: boolean;\n}\nexport interface KGFieldQuery {\n name: string;\n value: any;\n operator: KGFieldQueryOperator;\n}\nexport type KGFieldQueryOperator = string;\nexport const KGFieldQueryOperatorEqual: KGFieldQueryOperator = \"eq\";\nexport const KGFieldQueryOperatorNotEqual: KGFieldQueryOperator = \"neq\";\nexport const KGFieldQueryOperatorGreater: KGFieldQueryOperator = \"gt\";\nexport const KGFieldQueryOperatorLess: KGFieldQueryOperator = \"lt\";\nexport const KGFieldQueryOperatorGreaterOrEqual: KGFieldQueryOperator = \"gte\";\nexport const KGFieldQueryOperatorLessOrEqual: KGFieldQueryOperator = \"lte\";\nexport const KGFieldQueryOperatorLike: KGFieldQueryOperator = \"like\";\nexport const KGFieldQueryOperatorSimilar: KGFieldQueryOperator = \"similar\";\n/**\n * KGFieldQueryOperatorGreaterOrEqual KGFieldQueryOperator = \"gte\"\n * KGFieldQueryOperatorLessOrEqual KGFieldQueryOperator = \"lte\"\n */\nexport const KGFieldQueryOperatorIn: KGFieldQueryOperator = \"in\";\nexport const KGFieldQueryOperatorArrayContains: KGFieldQueryOperator = \"arrayContains\";\nexport type KGRelationshipDirection = string;\nexport const KGRelationshipDirectionIncoming: KGRelationshipDirection = \"incoming\";\nexport const KGRelationshipDirectionOutgoing: KGRelationshipDirection = \"outgoing\";\nexport interface KGEdgeQuery {\n label: string;\n direction: 'incoming' | 'outgoing';\n fields?: { [key: string]: any};\n /**\n * FromLabel string `json:\"fromLabel\"`\n * FromFieldKey string `json:\"fromFieldKey\"`\n * FromValue interface{} `json:\"fromValue\"`\n */\n toLabel: string;\n toFieldKey: string;\n toFieldValue: any;\n}\nexport interface KGQueryResult {\n nodes: KGNode[];\n edges: KGEdge[];\n}\nexport interface KGLabelInfo {\n label: string;\n count: number /* uint64 */;\n}\nexport interface KGPropertyInfo {\n property: string;\n count: number /* uint64 */;\n}\nexport interface KGPLabelSchema {\n label: string;\n keys: string[];\n}\nexport interface KGArticle {\n id: string;\n title: string;\n content: string;\n lang?: string;\n docUrl?: string;\n paragraphs?: string;\n}\nexport interface KGPropertyFilter {\n property: string;\n value: string;\n}\nexport interface KGPropertyFilterRequest {\n label: string;\n filters: KGPropertyFilter[];\n}\nexport interface DeleteDocumentRequest {\n documentId: string;\n}\nexport interface DeleteDocumentResponse {\n success: boolean;\n deletedNodes: { [key: string]: number /* int */};\n totalDeleted: number /* int */;\n error?: string;\n}\n/**\n * KGSyncJob represents a sync job record in the database\n */\nexport interface KGSyncJob {\n id: string;\n title: string;\n stats: { [key: string]: any};\n startTime: string;\n endTime: string;\n updatedAt?: string;\n}\n/**\n * KGSyncJobUpdateRequest is used to insert or update a sync job\n */\nexport interface KGSyncJobUpdateRequest {\n id: string;\n title: string;\n stats: { [key: string]: any};\n startTime: string;\n endTime: string;\n}\nexport interface KGSyncJobUpdateResponse {\n jobId: string;\n metadata: ResponseMetadata;\n}\nexport interface KGSyncJobListResponse {\n jobs: KGSyncJob[];\n metadata: ResponseMetadata;\n}\n/**\n * KGSyncJobListRequest is used to list sync jobs with filters\n */\nexport interface KGSyncJobListRequest {\n limit?: number /* int */;\n offset?: number /* int */;\n startFrom?: string;\n endTo?: string;\n}\n/**\n * KGSyncIngestResponse is the response for synchronous single node ingestion\n */\nexport interface KGSyncIngestResponse {\n success: boolean;\n nodeId?: string;\n error?: string;\n metadata: ResponseMetadata;\n}\n/**\n * KGBatchSyncIngestResponse is the response for synchronous batch node ingestion\n */\nexport interface KGBatchSyncIngestResponse {\n success: boolean;\n ingestedCount: number /* int */;\n nodeIds?: string[];\n errors?: string[];\n metadata: ResponseMetadata;\n}\n"]}