@utaba/deep-memory 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{StorageProvider-DqW-zpd0.d.ts → StorageProvider-CBhwqavV.d.cts} +4 -4
- package/dist/{StorageProvider-CSbaIY6X.d.cts → StorageProvider-ynfpc5wz.d.ts} +4 -4
- package/dist/index.cjs +69 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -12
- package/dist/index.d.ts +12 -12
- package/dist/index.js +69 -54
- package/dist/index.js.map +1 -1
- package/dist/{portability-1KBMVBGJ.d.cts → portability-B-8J4nQQ.d.cts} +18 -18
- package/dist/{portability-1KBMVBGJ.d.ts → portability-B-8J4nQQ.d.ts} +18 -18
- package/dist/providers/index.d.cts +5 -5
- package/dist/providers/index.d.ts +5 -5
- package/dist/testing/conformance.cjs +4 -4
- package/dist/testing/conformance.cjs.map +1 -1
- package/dist/testing/conformance.d.cts +2 -2
- package/dist/testing/conformance.d.ts +2 -2
- package/dist/testing/conformance.js +4 -4
- package/dist/testing/conformance.js.map +1 -1
- package/dist/{traversal-B4SUysM-.d.ts → traversal-BdmDLMxV.d.ts} +1 -1
- package/dist/{traversal-DQynd-to.d.cts → traversal-Llalk03r.d.cts} +1 -1
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.cts +3 -3
- package/dist/types/index.d.ts +3 -3
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { G as GovernanceConfig, M as MemoryVocabulary, x as ResolvedVocabulary, C as CreateEntityInput, U as UpdateEntityInput, y as CreateRelationshipInput, z as EntityTypeDefinition, A as VocabularyProposal, F as VocabularyProposalResult, H as ProvenanceContext, J as Provenance, E as Entity, D as DetailLevel, a as EntitySummary, b as EntityBrief, K as FindEntitiesQuery, e as PaginatedResult, L as ReembedResult, N as Relationship, P as PropertyFilter, R as RelationshipSummary, O as GraphResult, Q as ExploreOptions, T as
|
|
2
|
-
export { aa as EnrichedRelationship, ab as EntityMap, ac as EntityTypeInput, ad as ExportLegalMetadata, ae as ExportManifest, af as ExportPipelineMetadata, ag as GetEntitiesOptions, ah as GetEntityOptions, ai as GovernanceMode, aj as ImportWarning, ak as
|
|
1
|
+
import { G as GovernanceConfig, M as MemoryVocabulary, x as ResolvedVocabulary, C as CreateEntityInput, U as UpdateEntityInput, y as CreateRelationshipInput, z as EntityTypeDefinition, A as VocabularyProposal, F as VocabularyProposalResult, H as ProvenanceContext, J as Provenance, E as Entity, D as DetailLevel, a as EntitySummary, b as EntityBrief, K as FindEntitiesQuery, e as PaginatedResult, L as ReembedResult, N as Relationship, P as PropertyFilter, R as RelationshipSummary, O as GraphResult, Q as ExploreOptions, T as Neighborhood, W as PathOptions, X as PathResult, Y as ConceptSearchOptions, Z as ScoredEntity, _ as TimelineOptions, $ as TimelineResult, i as RepositoryStats, a0 as RepositoryConfig, d as RepositoryFilter, a1 as RepositorySummary, g as RepositoryUpdate, c as StoredRepository, a2 as ExportOptions, a3 as ExportArchive, a4 as ImportOptions, a5 as ImportResult, a6 as ExportStreamItem, a7 as ImportStreamHeader, I as ImportChunk, S as StorageRepositoryConfig, f as StoredRepositorySummary, h as DeleteProgressCallback, j as PaginationOptions, V as VocabularyChangeRecord, k as StoredEntity, l as StoredEntityUpdate, m as StorageFindQuery, n as StoredRelationship, o as RelationshipQueryOptions, p as StorageExploreOptions, q as StorageNeighborhood, r as StoragePathOptions, s as StoragePathResult, t as StorageTimelineOptions, u as StorageTimelineResult, v as ExportChunk, B as BulkImportOptions, w as BulkImportResult, a8 as SearchOptions, a9 as SearchHit } from './portability-B-8J4nQQ.cjs';
|
|
2
|
+
export { aa as EnrichedRelationship, ab as EntityMap, ac as EntityTypeInput, ad as ExportLegalMetadata, ae as ExportManifest, af as ExportPipelineMetadata, ag as GetEntitiesOptions, ah as GetEntityOptions, ai as GovernanceMode, aj as ImportWarning, ak as NeighborhoodCenter, al as NeighborhoodGroup, am as NeighborhoodLayer, an as Path, ao as PropertySchema, ap as PropertyType, aq as ProvenanceFilter, ar as RelationshipDirection, as as RelationshipTypeDefinition, at as RelationshipTypeInput, au as RepositoryMetadata, av as StorageNeighborhoodGroup, aw as StorageNeighborhoodLayer, ax as StoragePath, ay as StorageTimelineEvent, az as TimelineEntityRef, aA as TimelineEvent, aB as TimelineRelationshipDetail, aC as VocabularyInput } from './portability-B-8J4nQQ.cjs';
|
|
3
3
|
import { DeepMemoryEventType, EventHandler, Unsubscribe, DeepMemoryEvent, HookResult, EventPayload } from './types/index.cjs';
|
|
4
|
-
import { T as TraversalSpec, a as TraversalResult } from './traversal-
|
|
5
|
-
export { Q as QueryMetadata, b as TraversalAggregation, c as TraversalPath, d as TraversalProjection, e as TraversalRelationship, f as TraversalReturnMode, g as TraversalStart, h as TraversalStep } from './traversal-
|
|
6
|
-
import { S as StorageProvider, E as EnsureSchemaResult } from './StorageProvider-
|
|
4
|
+
import { T as TraversalSpec, a as TraversalResult } from './traversal-Llalk03r.cjs';
|
|
5
|
+
export { Q as QueryMetadata, b as TraversalAggregation, c as TraversalPath, d as TraversalProjection, e as TraversalRelationship, f as TraversalReturnMode, g as TraversalStart, h as TraversalStep } from './traversal-Llalk03r.cjs';
|
|
6
|
+
import { S as StorageProvider, E as EnsureSchemaResult } from './StorageProvider-CBhwqavV.cjs';
|
|
7
7
|
import { EmbeddingProvider, SearchProvider, GraphTraversalProvider, LockProvider, SearchableEntity } from './providers/index.cjs';
|
|
8
8
|
export { GraphTraversalCapabilities, LockHandle, LockOptions } from './providers/index.cjs';
|
|
9
9
|
|
|
@@ -292,7 +292,7 @@ declare class MemoryRepository {
|
|
|
292
292
|
offset?: number;
|
|
293
293
|
detailLevel?: DetailLevel;
|
|
294
294
|
}): Promise<GraphResult>;
|
|
295
|
-
|
|
295
|
+
exploreNeighborhood(entityId: string, options?: ExploreOptions): Promise<Neighborhood>;
|
|
296
296
|
findPaths(sourceId: string, targetId: string, options?: PathOptions): Promise<PathResult>;
|
|
297
297
|
traverse(spec: TraversalSpec): Promise<TraversalResult>;
|
|
298
298
|
executeNativeQuery(query: string, params?: Record<string, unknown>): Promise<TraversalResult>;
|
|
@@ -341,10 +341,10 @@ declare class DeepMemory {
|
|
|
341
341
|
private readonly graphTraversalProvider?;
|
|
342
342
|
private readonly provenance;
|
|
343
343
|
private readonly globalEventBus;
|
|
344
|
-
private
|
|
344
|
+
private initialized;
|
|
345
345
|
constructor(config: DeepMemoryConfig);
|
|
346
|
-
/**
|
|
347
|
-
private
|
|
346
|
+
/** Initialize the storage provider and optional providers (call once before use) */
|
|
347
|
+
private ensureInitialized;
|
|
348
348
|
/** Create or migrate the storage schema. Call once at deployment / startup, not per-request. */
|
|
349
349
|
ensureSchema(): Promise<EnsureSchemaResult>;
|
|
350
350
|
private validateRepositoryId;
|
|
@@ -420,7 +420,7 @@ declare class CypherCompiler implements TraversalCompiler {
|
|
|
420
420
|
declare class InMemoryStorageProvider implements StorageProvider {
|
|
421
421
|
private stores;
|
|
422
422
|
private getStore;
|
|
423
|
-
|
|
423
|
+
initialize(): Promise<void>;
|
|
424
424
|
dispose(): Promise<void>;
|
|
425
425
|
createRepository(config: StorageRepositoryConfig): Promise<StoredRepository>;
|
|
426
426
|
getRepository(repositoryId: string): Promise<StoredRepository | null>;
|
|
@@ -453,7 +453,7 @@ declare class InMemoryStorageProvider implements StorageProvider {
|
|
|
453
453
|
deleteRelationshipsByType(repositoryId: string, relationshipType: string): Promise<{
|
|
454
454
|
deletedRelationships: number;
|
|
455
455
|
}>;
|
|
456
|
-
|
|
456
|
+
exploreNeighborhood(repositoryId: string, entityId: string, options: StorageExploreOptions): Promise<StorageNeighborhood>;
|
|
457
457
|
findPaths(repositoryId: string, sourceId: string, targetId: string, options: StoragePathOptions): Promise<StoragePathResult>;
|
|
458
458
|
getTimeline(repositoryId: string, entityId: string, options: StorageTimelineOptions): Promise<StorageTimelineResult>;
|
|
459
459
|
exportAll(repositoryId: string): AsyncIterable<ExportChunk>;
|
|
@@ -476,4 +476,4 @@ declare class NoOpEmbeddingProvider implements EmbeddingProvider {
|
|
|
476
476
|
modelId(): string;
|
|
477
477
|
}
|
|
478
478
|
|
|
479
|
-
export { BulkImportOptions, BulkImportResult, type CompiledQuery, ConceptSearchOptions, CreateEntityInput, CreateRelationshipInput, CypherCompiler, DeepMemory, type DeepMemoryConfig, DeepMemoryError, type DeepMemoryErrorCode, DeepMemoryEvent, DeepMemoryEventType, DeleteProgressCallback, DetailLevel, DuplicateEntityError, DuplicateRelationshipError, DuplicateRepositoryError, EmbeddingProvider, EmbeddingProviderRequiredError, EnsureSchemaResult, Entity, EntityBrief, EntityNotFoundError, EntitySummary, EntityTypeDefinition, EventHandler, EventPayload, ExploreOptions, ExportArchive, ExportChunk, ExportError, ExportOptions, ExportStreamItem, FindEntitiesQuery, GovernanceConfig, GovernanceDeniedError, GraphResult, GraphTraversalProvider, GraphTraversalProviderRequiredError, GremlinCompiler, HookResult, ImportChunk, ImportError, ImportOptions, ImportResult, ImportStreamHeader, InMemorySearchProvider, InMemoryStorageProvider, InvalidInputError, LockProvider, MemoryRepository, MemoryVocabulary,
|
|
479
|
+
export { BulkImportOptions, BulkImportResult, type CompiledQuery, ConceptSearchOptions, CreateEntityInput, CreateRelationshipInput, CypherCompiler, DeepMemory, type DeepMemoryConfig, DeepMemoryError, type DeepMemoryErrorCode, DeepMemoryEvent, DeepMemoryEventType, DeleteProgressCallback, DetailLevel, DuplicateEntityError, DuplicateRelationshipError, DuplicateRepositoryError, EmbeddingProvider, EmbeddingProviderRequiredError, EnsureSchemaResult, Entity, EntityBrief, EntityNotFoundError, EntitySummary, EntityTypeDefinition, EventHandler, EventPayload, ExploreOptions, ExportArchive, ExportChunk, ExportError, ExportOptions, ExportStreamItem, FindEntitiesQuery, GovernanceConfig, GovernanceDeniedError, GraphResult, GraphTraversalProvider, GraphTraversalProviderRequiredError, GremlinCompiler, HookResult, ImportChunk, ImportError, ImportOptions, ImportResult, ImportStreamHeader, InMemorySearchProvider, InMemoryStorageProvider, InvalidInputError, LockProvider, MemoryRepository, MemoryVocabulary, Neighborhood, NoOpEmbeddingProvider, OperationCancelledError, PaginatedResult, PaginationOptions, PathOptions, PathResult, PropertyFilter, Provenance, ProvenanceContext, ProviderError, ReembedResult, Relationship, RelationshipConstraintError, RelationshipNotFoundError, RelationshipQueryOptions, RelationshipSummary, RepositoryConfig, RepositoryFilter, RepositoryNotFoundError, RepositoryStats, RepositorySummary, RepositoryUpdate, ResolvedVocabulary, ScoredEntity, SearchHit, SearchOptions, SearchProvider, SearchableEntity, StorageExploreOptions, StorageFindQuery, StorageNeighborhood, StoragePathOptions, StoragePathResult, StorageProvider, StorageRepositoryConfig, StorageTimelineOptions, StorageTimelineResult, StoredEntity, StoredEntityUpdate, StoredRelationship, StoredRepository, StoredRepositorySummary, TimelineOptions, TimelineResult, type TraversalCompiler, TraversalResult, TraversalSpec, TraversalTimeoutError, TraversalValidationError, TraversalVocabularyError, Unsubscribe, UpdateEntityInput, VocabularyChangeRecord, VocabularyProposal, VocabularyProposalResult, VocabularyValidationError, generateId, isValidUuid, matchesPropertyFilters };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { G as GovernanceConfig, M as MemoryVocabulary, x as ResolvedVocabulary, C as CreateEntityInput, U as UpdateEntityInput, y as CreateRelationshipInput, z as EntityTypeDefinition, A as VocabularyProposal, F as VocabularyProposalResult, H as ProvenanceContext, J as Provenance, E as Entity, D as DetailLevel, a as EntitySummary, b as EntityBrief, K as FindEntitiesQuery, e as PaginatedResult, L as ReembedResult, N as Relationship, P as PropertyFilter, R as RelationshipSummary, O as GraphResult, Q as ExploreOptions, T as
|
|
2
|
-
export { aa as EnrichedRelationship, ab as EntityMap, ac as EntityTypeInput, ad as ExportLegalMetadata, ae as ExportManifest, af as ExportPipelineMetadata, ag as GetEntitiesOptions, ah as GetEntityOptions, ai as GovernanceMode, aj as ImportWarning, ak as
|
|
1
|
+
import { G as GovernanceConfig, M as MemoryVocabulary, x as ResolvedVocabulary, C as CreateEntityInput, U as UpdateEntityInput, y as CreateRelationshipInput, z as EntityTypeDefinition, A as VocabularyProposal, F as VocabularyProposalResult, H as ProvenanceContext, J as Provenance, E as Entity, D as DetailLevel, a as EntitySummary, b as EntityBrief, K as FindEntitiesQuery, e as PaginatedResult, L as ReembedResult, N as Relationship, P as PropertyFilter, R as RelationshipSummary, O as GraphResult, Q as ExploreOptions, T as Neighborhood, W as PathOptions, X as PathResult, Y as ConceptSearchOptions, Z as ScoredEntity, _ as TimelineOptions, $ as TimelineResult, i as RepositoryStats, a0 as RepositoryConfig, d as RepositoryFilter, a1 as RepositorySummary, g as RepositoryUpdate, c as StoredRepository, a2 as ExportOptions, a3 as ExportArchive, a4 as ImportOptions, a5 as ImportResult, a6 as ExportStreamItem, a7 as ImportStreamHeader, I as ImportChunk, S as StorageRepositoryConfig, f as StoredRepositorySummary, h as DeleteProgressCallback, j as PaginationOptions, V as VocabularyChangeRecord, k as StoredEntity, l as StoredEntityUpdate, m as StorageFindQuery, n as StoredRelationship, o as RelationshipQueryOptions, p as StorageExploreOptions, q as StorageNeighborhood, r as StoragePathOptions, s as StoragePathResult, t as StorageTimelineOptions, u as StorageTimelineResult, v as ExportChunk, B as BulkImportOptions, w as BulkImportResult, a8 as SearchOptions, a9 as SearchHit } from './portability-B-8J4nQQ.js';
|
|
2
|
+
export { aa as EnrichedRelationship, ab as EntityMap, ac as EntityTypeInput, ad as ExportLegalMetadata, ae as ExportManifest, af as ExportPipelineMetadata, ag as GetEntitiesOptions, ah as GetEntityOptions, ai as GovernanceMode, aj as ImportWarning, ak as NeighborhoodCenter, al as NeighborhoodGroup, am as NeighborhoodLayer, an as Path, ao as PropertySchema, ap as PropertyType, aq as ProvenanceFilter, ar as RelationshipDirection, as as RelationshipTypeDefinition, at as RelationshipTypeInput, au as RepositoryMetadata, av as StorageNeighborhoodGroup, aw as StorageNeighborhoodLayer, ax as StoragePath, ay as StorageTimelineEvent, az as TimelineEntityRef, aA as TimelineEvent, aB as TimelineRelationshipDetail, aC as VocabularyInput } from './portability-B-8J4nQQ.js';
|
|
3
3
|
import { DeepMemoryEventType, EventHandler, Unsubscribe, DeepMemoryEvent, HookResult, EventPayload } from './types/index.js';
|
|
4
|
-
import { T as TraversalSpec, a as TraversalResult } from './traversal-
|
|
5
|
-
export { Q as QueryMetadata, b as TraversalAggregation, c as TraversalPath, d as TraversalProjection, e as TraversalRelationship, f as TraversalReturnMode, g as TraversalStart, h as TraversalStep } from './traversal-
|
|
6
|
-
import { S as StorageProvider, E as EnsureSchemaResult } from './StorageProvider-
|
|
4
|
+
import { T as TraversalSpec, a as TraversalResult } from './traversal-BdmDLMxV.js';
|
|
5
|
+
export { Q as QueryMetadata, b as TraversalAggregation, c as TraversalPath, d as TraversalProjection, e as TraversalRelationship, f as TraversalReturnMode, g as TraversalStart, h as TraversalStep } from './traversal-BdmDLMxV.js';
|
|
6
|
+
import { S as StorageProvider, E as EnsureSchemaResult } from './StorageProvider-ynfpc5wz.js';
|
|
7
7
|
import { EmbeddingProvider, SearchProvider, GraphTraversalProvider, LockProvider, SearchableEntity } from './providers/index.js';
|
|
8
8
|
export { GraphTraversalCapabilities, LockHandle, LockOptions } from './providers/index.js';
|
|
9
9
|
|
|
@@ -292,7 +292,7 @@ declare class MemoryRepository {
|
|
|
292
292
|
offset?: number;
|
|
293
293
|
detailLevel?: DetailLevel;
|
|
294
294
|
}): Promise<GraphResult>;
|
|
295
|
-
|
|
295
|
+
exploreNeighborhood(entityId: string, options?: ExploreOptions): Promise<Neighborhood>;
|
|
296
296
|
findPaths(sourceId: string, targetId: string, options?: PathOptions): Promise<PathResult>;
|
|
297
297
|
traverse(spec: TraversalSpec): Promise<TraversalResult>;
|
|
298
298
|
executeNativeQuery(query: string, params?: Record<string, unknown>): Promise<TraversalResult>;
|
|
@@ -341,10 +341,10 @@ declare class DeepMemory {
|
|
|
341
341
|
private readonly graphTraversalProvider?;
|
|
342
342
|
private readonly provenance;
|
|
343
343
|
private readonly globalEventBus;
|
|
344
|
-
private
|
|
344
|
+
private initialized;
|
|
345
345
|
constructor(config: DeepMemoryConfig);
|
|
346
|
-
/**
|
|
347
|
-
private
|
|
346
|
+
/** Initialize the storage provider and optional providers (call once before use) */
|
|
347
|
+
private ensureInitialized;
|
|
348
348
|
/** Create or migrate the storage schema. Call once at deployment / startup, not per-request. */
|
|
349
349
|
ensureSchema(): Promise<EnsureSchemaResult>;
|
|
350
350
|
private validateRepositoryId;
|
|
@@ -420,7 +420,7 @@ declare class CypherCompiler implements TraversalCompiler {
|
|
|
420
420
|
declare class InMemoryStorageProvider implements StorageProvider {
|
|
421
421
|
private stores;
|
|
422
422
|
private getStore;
|
|
423
|
-
|
|
423
|
+
initialize(): Promise<void>;
|
|
424
424
|
dispose(): Promise<void>;
|
|
425
425
|
createRepository(config: StorageRepositoryConfig): Promise<StoredRepository>;
|
|
426
426
|
getRepository(repositoryId: string): Promise<StoredRepository | null>;
|
|
@@ -453,7 +453,7 @@ declare class InMemoryStorageProvider implements StorageProvider {
|
|
|
453
453
|
deleteRelationshipsByType(repositoryId: string, relationshipType: string): Promise<{
|
|
454
454
|
deletedRelationships: number;
|
|
455
455
|
}>;
|
|
456
|
-
|
|
456
|
+
exploreNeighborhood(repositoryId: string, entityId: string, options: StorageExploreOptions): Promise<StorageNeighborhood>;
|
|
457
457
|
findPaths(repositoryId: string, sourceId: string, targetId: string, options: StoragePathOptions): Promise<StoragePathResult>;
|
|
458
458
|
getTimeline(repositoryId: string, entityId: string, options: StorageTimelineOptions): Promise<StorageTimelineResult>;
|
|
459
459
|
exportAll(repositoryId: string): AsyncIterable<ExportChunk>;
|
|
@@ -476,4 +476,4 @@ declare class NoOpEmbeddingProvider implements EmbeddingProvider {
|
|
|
476
476
|
modelId(): string;
|
|
477
477
|
}
|
|
478
478
|
|
|
479
|
-
export { BulkImportOptions, BulkImportResult, type CompiledQuery, ConceptSearchOptions, CreateEntityInput, CreateRelationshipInput, CypherCompiler, DeepMemory, type DeepMemoryConfig, DeepMemoryError, type DeepMemoryErrorCode, DeepMemoryEvent, DeepMemoryEventType, DeleteProgressCallback, DetailLevel, DuplicateEntityError, DuplicateRelationshipError, DuplicateRepositoryError, EmbeddingProvider, EmbeddingProviderRequiredError, EnsureSchemaResult, Entity, EntityBrief, EntityNotFoundError, EntitySummary, EntityTypeDefinition, EventHandler, EventPayload, ExploreOptions, ExportArchive, ExportChunk, ExportError, ExportOptions, ExportStreamItem, FindEntitiesQuery, GovernanceConfig, GovernanceDeniedError, GraphResult, GraphTraversalProvider, GraphTraversalProviderRequiredError, GremlinCompiler, HookResult, ImportChunk, ImportError, ImportOptions, ImportResult, ImportStreamHeader, InMemorySearchProvider, InMemoryStorageProvider, InvalidInputError, LockProvider, MemoryRepository, MemoryVocabulary,
|
|
479
|
+
export { BulkImportOptions, BulkImportResult, type CompiledQuery, ConceptSearchOptions, CreateEntityInput, CreateRelationshipInput, CypherCompiler, DeepMemory, type DeepMemoryConfig, DeepMemoryError, type DeepMemoryErrorCode, DeepMemoryEvent, DeepMemoryEventType, DeleteProgressCallback, DetailLevel, DuplicateEntityError, DuplicateRelationshipError, DuplicateRepositoryError, EmbeddingProvider, EmbeddingProviderRequiredError, EnsureSchemaResult, Entity, EntityBrief, EntityNotFoundError, EntitySummary, EntityTypeDefinition, EventHandler, EventPayload, ExploreOptions, ExportArchive, ExportChunk, ExportError, ExportOptions, ExportStreamItem, FindEntitiesQuery, GovernanceConfig, GovernanceDeniedError, GraphResult, GraphTraversalProvider, GraphTraversalProviderRequiredError, GremlinCompiler, HookResult, ImportChunk, ImportError, ImportOptions, ImportResult, ImportStreamHeader, InMemorySearchProvider, InMemoryStorageProvider, InvalidInputError, LockProvider, MemoryRepository, MemoryVocabulary, Neighborhood, NoOpEmbeddingProvider, OperationCancelledError, PaginatedResult, PaginationOptions, PathOptions, PathResult, PropertyFilter, Provenance, ProvenanceContext, ProviderError, ReembedResult, Relationship, RelationshipConstraintError, RelationshipNotFoundError, RelationshipQueryOptions, RelationshipSummary, RepositoryConfig, RepositoryFilter, RepositoryNotFoundError, RepositoryStats, RepositorySummary, RepositoryUpdate, ResolvedVocabulary, ScoredEntity, SearchHit, SearchOptions, SearchProvider, SearchableEntity, StorageExploreOptions, StorageFindQuery, StorageNeighborhood, StoragePathOptions, StoragePathResult, StorageProvider, StorageRepositoryConfig, StorageTimelineOptions, StorageTimelineResult, StoredEntity, StoredEntityUpdate, StoredRelationship, StoredRepository, StoredRepositorySummary, TimelineOptions, TimelineResult, type TraversalCompiler, TraversalResult, TraversalSpec, TraversalTimeoutError, TraversalValidationError, TraversalVocabularyError, Unsubscribe, UpdateEntityInput, VocabularyChangeRecord, VocabularyProposal, VocabularyProposalResult, VocabularyValidationError, generateId, isValidUuid, matchesPropertyFilters };
|
package/dist/index.js
CHANGED
|
@@ -277,6 +277,12 @@ var EntityManager = class {
|
|
|
277
277
|
this.storage = storage;
|
|
278
278
|
this.embedding = embedding;
|
|
279
279
|
}
|
|
280
|
+
repositoryId;
|
|
281
|
+
vocabularyEngine;
|
|
282
|
+
provenanceTracker;
|
|
283
|
+
eventBus;
|
|
284
|
+
storage;
|
|
285
|
+
embedding;
|
|
280
286
|
/** Create one or more entities with vocabulary validation, ID generation, provenance, and events */
|
|
281
287
|
async create(inputs) {
|
|
282
288
|
const results = [];
|
|
@@ -640,7 +646,7 @@ function jaroWinklerSimilarity(a, b, scalingFactor = 0.1) {
|
|
|
640
646
|
}
|
|
641
647
|
return jaro + commonPrefix * Math.min(scalingFactor, 0.25) * (1 - jaro);
|
|
642
648
|
}
|
|
643
|
-
function
|
|
649
|
+
function normalizeTypeName(name) {
|
|
644
650
|
return name.toLowerCase().trim().replace(/[-\s.]+/g, "_").replace(/[^a-z0-9_]/g, "");
|
|
645
651
|
}
|
|
646
652
|
function toScreamingSnakeCase(name) {
|
|
@@ -656,6 +662,11 @@ var RelationshipManager = class {
|
|
|
656
662
|
this.eventBus = eventBus;
|
|
657
663
|
this.storage = storage;
|
|
658
664
|
}
|
|
665
|
+
repositoryId;
|
|
666
|
+
vocabularyEngine;
|
|
667
|
+
provenanceTracker;
|
|
668
|
+
eventBus;
|
|
669
|
+
storage;
|
|
659
670
|
/** Create one or more relationships with vocabulary validation, provenance, and events */
|
|
660
671
|
async create(inputs) {
|
|
661
672
|
const results = [];
|
|
@@ -1590,8 +1601,12 @@ var GraphTraversal = class {
|
|
|
1590
1601
|
this.graphTraversalProvider = graphTraversalProvider;
|
|
1591
1602
|
this.vocabularyEngine = vocabularyEngine;
|
|
1592
1603
|
}
|
|
1593
|
-
|
|
1594
|
-
|
|
1604
|
+
repositoryId;
|
|
1605
|
+
storage;
|
|
1606
|
+
graphTraversalProvider;
|
|
1607
|
+
vocabularyEngine;
|
|
1608
|
+
/** BFS neighborhood exploration from a center entity */
|
|
1609
|
+
async exploreNeighborhood(entityId, options) {
|
|
1595
1610
|
const storageOptions = {
|
|
1596
1611
|
depth: options?.depth ?? 1,
|
|
1597
1612
|
relationshipTypes: options?.relationshipTypes,
|
|
@@ -1601,13 +1616,13 @@ var GraphTraversal = class {
|
|
|
1601
1616
|
offsetPerType: options?.offsetPerType ?? 0,
|
|
1602
1617
|
relationshipPropertyFilters: options?.relationshipPropertyFilters
|
|
1603
1618
|
};
|
|
1604
|
-
const storageResult = await this.storage.
|
|
1619
|
+
const storageResult = await this.storage.exploreNeighborhood(
|
|
1605
1620
|
this.repositoryId,
|
|
1606
1621
|
entityId,
|
|
1607
1622
|
storageOptions
|
|
1608
1623
|
);
|
|
1609
|
-
const
|
|
1610
|
-
if (!
|
|
1624
|
+
const centerEntity = await this.storage.getEntity(this.repositoryId, entityId);
|
|
1625
|
+
if (!centerEntity) {
|
|
1611
1626
|
throw new EntityNotFoundError(entityId);
|
|
1612
1627
|
}
|
|
1613
1628
|
const detailLevel = options?.detailLevel ?? "summary";
|
|
@@ -1631,11 +1646,11 @@ var GraphTraversal = class {
|
|
|
1631
1646
|
return layer;
|
|
1632
1647
|
});
|
|
1633
1648
|
return {
|
|
1634
|
-
|
|
1635
|
-
id:
|
|
1636
|
-
slug:
|
|
1637
|
-
entityType:
|
|
1638
|
-
label:
|
|
1649
|
+
center: {
|
|
1650
|
+
id: centerEntity.id,
|
|
1651
|
+
slug: centerEntity.slug,
|
|
1652
|
+
entityType: centerEntity.entityType,
|
|
1653
|
+
label: centerEntity.label
|
|
1639
1654
|
},
|
|
1640
1655
|
layers,
|
|
1641
1656
|
statistics: {
|
|
@@ -2189,8 +2204,8 @@ var MemoryRepository = class {
|
|
|
2189
2204
|
};
|
|
2190
2205
|
}
|
|
2191
2206
|
// ─── Graph Traversal ───────────────────────────────────────────────
|
|
2192
|
-
async
|
|
2193
|
-
return this.graphTraversal.
|
|
2207
|
+
async exploreNeighborhood(entityId, options) {
|
|
2208
|
+
return this.graphTraversal.exploreNeighborhood(entityId, options);
|
|
2194
2209
|
}
|
|
2195
2210
|
async findPaths(sourceId, targetId, options) {
|
|
2196
2211
|
return this.graphTraversal.findPaths(sourceId, targetId, options);
|
|
@@ -2220,7 +2235,7 @@ var MemoryRepository = class {
|
|
|
2220
2235
|
storageOptions
|
|
2221
2236
|
);
|
|
2222
2237
|
const entity = await this.storage.getEntity(this.repositoryId, entityId);
|
|
2223
|
-
const
|
|
2238
|
+
const centerRef = {
|
|
2224
2239
|
id: entityId,
|
|
2225
2240
|
slug: entity?.slug ?? entityId,
|
|
2226
2241
|
label: entity?.label ?? entityId
|
|
@@ -2266,7 +2281,7 @@ var MemoryRepository = class {
|
|
|
2266
2281
|
timestamp: e.timestamp,
|
|
2267
2282
|
eventType: e.eventType,
|
|
2268
2283
|
description: `${rel.type} relationship created ${direction} ${otherRef.label}`,
|
|
2269
|
-
relatedEntities: [
|
|
2284
|
+
relatedEntities: [centerRef, otherRef],
|
|
2270
2285
|
relationship: relDetail
|
|
2271
2286
|
};
|
|
2272
2287
|
}
|
|
@@ -2274,13 +2289,13 @@ var MemoryRepository = class {
|
|
|
2274
2289
|
return {
|
|
2275
2290
|
timestamp: e.timestamp,
|
|
2276
2291
|
eventType: e.eventType,
|
|
2277
|
-
description: `${
|
|
2278
|
-
relatedEntities: [
|
|
2292
|
+
description: `${centerRef.label} ${action}`,
|
|
2293
|
+
relatedEntities: [centerRef]
|
|
2279
2294
|
};
|
|
2280
2295
|
});
|
|
2281
2296
|
return {
|
|
2282
2297
|
id: entityId,
|
|
2283
|
-
slug:
|
|
2298
|
+
slug: centerRef.slug,
|
|
2284
2299
|
totalEvents: storageResult.total,
|
|
2285
2300
|
returned: events.length,
|
|
2286
2301
|
events
|
|
@@ -2363,14 +2378,14 @@ var SemanticDeduplicator = class {
|
|
|
2363
2378
|
/**
|
|
2364
2379
|
* Check whether a proposed type name is a duplicate of an existing type.
|
|
2365
2380
|
* Uses embedding similarity if an EmbeddingProvider is available, otherwise falls back
|
|
2366
|
-
* to Jaro-Winkler string similarity on
|
|
2381
|
+
* to Jaro-Winkler string similarity on normalized type names.
|
|
2367
2382
|
*/
|
|
2368
2383
|
async checkDuplicate(proposedType, proposedDescription, existingTypes) {
|
|
2369
2384
|
if (existingTypes.length === 0) {
|
|
2370
2385
|
return { isDuplicate: false, matches: [] };
|
|
2371
2386
|
}
|
|
2372
|
-
const normProposed =
|
|
2373
|
-
const exactMatch = existingTypes.find((t) =>
|
|
2387
|
+
const normProposed = normalizeTypeName(proposedType);
|
|
2388
|
+
const exactMatch = existingTypes.find((t) => normalizeTypeName(t.type) === normProposed);
|
|
2374
2389
|
if (exactMatch) {
|
|
2375
2390
|
return {
|
|
2376
2391
|
isDuplicate: true,
|
|
@@ -2406,10 +2421,10 @@ var SemanticDeduplicator = class {
|
|
|
2406
2421
|
};
|
|
2407
2422
|
}
|
|
2408
2423
|
checkWithStringSimilarity(proposedType, existingTypes) {
|
|
2409
|
-
const normProposed =
|
|
2424
|
+
const normProposed = normalizeTypeName(proposedType);
|
|
2410
2425
|
const matches = [];
|
|
2411
2426
|
for (const existing of existingTypes) {
|
|
2412
|
-
const normExisting =
|
|
2427
|
+
const normExisting = normalizeTypeName(existing.type);
|
|
2413
2428
|
const similarity = jaroWinklerSimilarity(normProposed, normExisting);
|
|
2414
2429
|
if (similarity >= this.threshold) {
|
|
2415
2430
|
matches.push({
|
|
@@ -2570,7 +2585,7 @@ function canPropose(governanceConfig, _proposal) {
|
|
|
2570
2585
|
case "locked":
|
|
2571
2586
|
return {
|
|
2572
2587
|
allowed: false,
|
|
2573
|
-
reason: "Vocabulary is locked. Only
|
|
2588
|
+
reason: "Vocabulary is locked. Only organization admins can modify the vocabulary via the admin API."
|
|
2574
2589
|
};
|
|
2575
2590
|
case "managed":
|
|
2576
2591
|
case "open":
|
|
@@ -3010,9 +3025,9 @@ function validateEntityUpdate(input, entityTypeDef) {
|
|
|
3010
3025
|
return ok();
|
|
3011
3026
|
}
|
|
3012
3027
|
function validateRelationship(input, vocabulary, sourceEntityType, targetEntityType) {
|
|
3013
|
-
const
|
|
3028
|
+
const normalizedType = toScreamingSnakeCase(input.relationshipType);
|
|
3014
3029
|
const relTypeDef = vocabulary.relationshipTypes.find(
|
|
3015
|
-
(rt) => rt.type ===
|
|
3030
|
+
(rt) => rt.type === normalizedType
|
|
3016
3031
|
);
|
|
3017
3032
|
if (!relTypeDef) {
|
|
3018
3033
|
const closest = findClosestType(input.relationshipType, vocabulary.relationshipTypes);
|
|
@@ -3337,7 +3352,7 @@ var EventBus = class {
|
|
|
3337
3352
|
};
|
|
3338
3353
|
|
|
3339
3354
|
// src/portability/RepositoryExporter.ts
|
|
3340
|
-
var LIBRARY_VERSION = true ? "0.
|
|
3355
|
+
var LIBRARY_VERSION = true ? "0.4.0" : "0.1.0";
|
|
3341
3356
|
var RepositoryExporter = class {
|
|
3342
3357
|
storage;
|
|
3343
3358
|
provenance;
|
|
@@ -3553,7 +3568,7 @@ function diffArrays(from, to) {
|
|
|
3553
3568
|
// src/portability/MigrationEngine.ts
|
|
3554
3569
|
var MigrationEngine = class {
|
|
3555
3570
|
/**
|
|
3556
|
-
*
|
|
3571
|
+
* Analyze and migrate vocabulary differences between source and target.
|
|
3557
3572
|
*
|
|
3558
3573
|
* @param sourceVocabulary - vocabulary from the export archive
|
|
3559
3574
|
* @param targetVocabulary - vocabulary in the target repository
|
|
@@ -3993,7 +4008,7 @@ var DeepMemory = class {
|
|
|
3993
4008
|
graphTraversalProvider;
|
|
3994
4009
|
provenance;
|
|
3995
4010
|
globalEventBus;
|
|
3996
|
-
|
|
4011
|
+
initialized = false;
|
|
3997
4012
|
constructor(config) {
|
|
3998
4013
|
this.storage = config.storage;
|
|
3999
4014
|
this.search = config.search;
|
|
@@ -4003,16 +4018,16 @@ var DeepMemory = class {
|
|
|
4003
4018
|
this.provenance = new ProvenanceTracker(config.provenance);
|
|
4004
4019
|
this.globalEventBus = new EventBus(config.provenance);
|
|
4005
4020
|
}
|
|
4006
|
-
/**
|
|
4007
|
-
async
|
|
4008
|
-
if (!this.
|
|
4009
|
-
if (this.storage.
|
|
4010
|
-
await this.storage.
|
|
4021
|
+
/** Initialize the storage provider and optional providers (call once before use) */
|
|
4022
|
+
async ensureInitialized() {
|
|
4023
|
+
if (!this.initialized) {
|
|
4024
|
+
if (this.storage.initialize) {
|
|
4025
|
+
await this.storage.initialize();
|
|
4011
4026
|
}
|
|
4012
|
-
if (this.graphTraversalProvider?.
|
|
4013
|
-
await this.graphTraversalProvider.
|
|
4027
|
+
if (this.graphTraversalProvider?.initialize) {
|
|
4028
|
+
await this.graphTraversalProvider.initialize();
|
|
4014
4029
|
}
|
|
4015
|
-
this.
|
|
4030
|
+
this.initialized = true;
|
|
4016
4031
|
}
|
|
4017
4032
|
}
|
|
4018
4033
|
/** Create or migrate the storage schema. Call once at deployment / startup, not per-request. */
|
|
@@ -4024,15 +4039,15 @@ var DeepMemory = class {
|
|
|
4024
4039
|
schemaVersion: 0
|
|
4025
4040
|
};
|
|
4026
4041
|
try {
|
|
4027
|
-
await this.
|
|
4042
|
+
await this.ensureInitialized();
|
|
4028
4043
|
} catch {
|
|
4029
4044
|
}
|
|
4030
4045
|
let result = noOpResult;
|
|
4031
4046
|
if (this.storage.ensureSchema) {
|
|
4032
4047
|
result = await this.storage.ensureSchema();
|
|
4033
4048
|
}
|
|
4034
|
-
if (!this.
|
|
4035
|
-
await this.
|
|
4049
|
+
if (!this.initialized) {
|
|
4050
|
+
await this.ensureInitialized();
|
|
4036
4051
|
}
|
|
4037
4052
|
return result;
|
|
4038
4053
|
}
|
|
@@ -4047,7 +4062,7 @@ var DeepMemory = class {
|
|
|
4047
4062
|
}
|
|
4048
4063
|
/** Create a new memory repository */
|
|
4049
4064
|
async createRepository(config) {
|
|
4050
|
-
await this.
|
|
4065
|
+
await this.ensureInitialized();
|
|
4051
4066
|
const repositoryId = config.repositoryId ?? generateId();
|
|
4052
4067
|
this.validateRepositoryId(repositoryId);
|
|
4053
4068
|
const context = this.provenance.getContext();
|
|
@@ -4104,7 +4119,7 @@ var DeepMemory = class {
|
|
|
4104
4119
|
}
|
|
4105
4120
|
/** Open an existing repository */
|
|
4106
4121
|
async openRepository(repositoryId) {
|
|
4107
|
-
await this.
|
|
4122
|
+
await this.ensureInitialized();
|
|
4108
4123
|
this.validateRepositoryId(repositoryId);
|
|
4109
4124
|
const storedRepo = await this.storage.getRepository(repositoryId);
|
|
4110
4125
|
if (!storedRepo) {
|
|
@@ -4133,7 +4148,7 @@ var DeepMemory = class {
|
|
|
4133
4148
|
}
|
|
4134
4149
|
/** List all repositories */
|
|
4135
4150
|
async listRepositories(filter) {
|
|
4136
|
-
await this.
|
|
4151
|
+
await this.ensureInitialized();
|
|
4137
4152
|
const result = await this.storage.listRepositories(filter);
|
|
4138
4153
|
return {
|
|
4139
4154
|
items: result.items.map((stored) => ({
|
|
@@ -4151,7 +4166,7 @@ var DeepMemory = class {
|
|
|
4151
4166
|
}
|
|
4152
4167
|
/** Update repository metadata and settings */
|
|
4153
4168
|
async updateRepository(repositoryId, updates) {
|
|
4154
|
-
await this.
|
|
4169
|
+
await this.ensureInitialized();
|
|
4155
4170
|
this.validateRepositoryId(repositoryId);
|
|
4156
4171
|
const updated = await this.storage.updateRepository(repositoryId, updates);
|
|
4157
4172
|
await this.globalEventBus.emit("repository:updated", { repositoryId });
|
|
@@ -4159,7 +4174,7 @@ var DeepMemory = class {
|
|
|
4159
4174
|
}
|
|
4160
4175
|
/** Delete a repository */
|
|
4161
4176
|
async deleteRepository(repositoryId) {
|
|
4162
|
-
await this.
|
|
4177
|
+
await this.ensureInitialized();
|
|
4163
4178
|
this.validateRepositoryId(repositoryId);
|
|
4164
4179
|
const stats = await this.storage.getRepositoryStats(repositoryId);
|
|
4165
4180
|
await this.globalEventBus.emit("delete:started", {
|
|
@@ -4180,7 +4195,7 @@ var DeepMemory = class {
|
|
|
4180
4195
|
}
|
|
4181
4196
|
/** Delete all entities and relationships in a repository, preserving the repository and vocabulary */
|
|
4182
4197
|
async deleteAllContents(repositoryId) {
|
|
4183
|
-
await this.
|
|
4198
|
+
await this.ensureInitialized();
|
|
4184
4199
|
this.validateRepositoryId(repositoryId);
|
|
4185
4200
|
const stats = await this.storage.getRepositoryStats(repositoryId);
|
|
4186
4201
|
await this.globalEventBus.emit("delete:started", {
|
|
@@ -4201,7 +4216,7 @@ var DeepMemory = class {
|
|
|
4201
4216
|
}
|
|
4202
4217
|
/** Export a repository to a portable archive */
|
|
4203
4218
|
async exportRepository(repositoryId, options) {
|
|
4204
|
-
await this.
|
|
4219
|
+
await this.ensureInitialized();
|
|
4205
4220
|
const stats = await this.storage.getRepositoryStats(repositoryId);
|
|
4206
4221
|
await this.globalEventBus.emit("export:started", {
|
|
4207
4222
|
repositoryId,
|
|
@@ -4223,7 +4238,7 @@ var DeepMemory = class {
|
|
|
4223
4238
|
}
|
|
4224
4239
|
/** Import a repository from a portable archive */
|
|
4225
4240
|
async importRepository(archive, options) {
|
|
4226
|
-
await this.
|
|
4241
|
+
await this.ensureInitialized();
|
|
4227
4242
|
await this.globalEventBus.emit("import:started", { repositoryId: options.target.repositoryId });
|
|
4228
4243
|
const importer = new RepositoryImporter({
|
|
4229
4244
|
storage: this.storage,
|
|
@@ -4251,7 +4266,7 @@ var DeepMemory = class {
|
|
|
4251
4266
|
* Use for large repositories to avoid loading everything into memory.
|
|
4252
4267
|
*/
|
|
4253
4268
|
async *exportRepositoryStream(repositoryId, options) {
|
|
4254
|
-
await this.
|
|
4269
|
+
await this.ensureInitialized();
|
|
4255
4270
|
const exporter = new RepositoryExporter({
|
|
4256
4271
|
storage: this.storage,
|
|
4257
4272
|
provenance: this.provenance.getContext(),
|
|
@@ -4308,7 +4323,7 @@ var DeepMemory = class {
|
|
|
4308
4323
|
* Use for large repositories to avoid loading everything into memory.
|
|
4309
4324
|
*/
|
|
4310
4325
|
async importRepositoryStream(header, chunks, options) {
|
|
4311
|
-
await this.
|
|
4326
|
+
await this.ensureInitialized();
|
|
4312
4327
|
const importer = new RepositoryImporter({
|
|
4313
4328
|
storage: this.storage,
|
|
4314
4329
|
actorId: this.provenance.getContext().actorId,
|
|
@@ -4348,7 +4363,7 @@ var DeepMemory = class {
|
|
|
4348
4363
|
if (this.storage.dispose) {
|
|
4349
4364
|
await this.storage.dispose();
|
|
4350
4365
|
}
|
|
4351
|
-
this.
|
|
4366
|
+
this.initialized = false;
|
|
4352
4367
|
}
|
|
4353
4368
|
};
|
|
4354
4369
|
|
|
@@ -4363,7 +4378,7 @@ var InMemoryStorageProvider = class {
|
|
|
4363
4378
|
return store;
|
|
4364
4379
|
}
|
|
4365
4380
|
// ─── Lifecycle ─────────────────────────────────────────────────────
|
|
4366
|
-
async
|
|
4381
|
+
async initialize() {
|
|
4367
4382
|
}
|
|
4368
4383
|
async dispose() {
|
|
4369
4384
|
this.stores.clear();
|
|
@@ -4680,7 +4695,7 @@ var InMemoryStorageProvider = class {
|
|
|
4680
4695
|
return { deletedRelationships };
|
|
4681
4696
|
}
|
|
4682
4697
|
// ─── Graph Traversal ───────────────────────────────────────────────
|
|
4683
|
-
async
|
|
4698
|
+
async exploreNeighborhood(repositoryId, entityId, options) {
|
|
4684
4699
|
const store = this.getStore(repositoryId);
|
|
4685
4700
|
if (!store.entities.has(entityId)) {
|
|
4686
4701
|
throw new EntityNotFoundError(entityId);
|
|
@@ -4746,7 +4761,7 @@ var InMemoryStorageProvider = class {
|
|
|
4746
4761
|
if (nextFrontier.size === 0) break;
|
|
4747
4762
|
}
|
|
4748
4763
|
return {
|
|
4749
|
-
|
|
4764
|
+
centerId: entityId,
|
|
4750
4765
|
layers
|
|
4751
4766
|
};
|
|
4752
4767
|
}
|