@utaba/deep-memory 0.1.0 → 0.3.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.
@@ -812,6 +812,44 @@ interface ExportManifest {
812
812
  dimensions: number;
813
813
  note: string;
814
814
  };
815
+ /** Legal and copyright metadata — set by the publisher of the archive */
816
+ legal?: ExportLegalMetadata;
817
+ /** Indexing pipeline metadata — present when archive was produced by the indexer */
818
+ pipeline?: ExportPipelineMetadata;
819
+ }
820
+ /** Legal and copyright metadata for an export archive */
821
+ interface ExportLegalMetadata {
822
+ /** Copyright holder (e.g. "© 2026 Caterpillar Inc.") */
823
+ copyright: string;
824
+ /** SPDX license identifier or custom license name (e.g. "Apache-2.0", "LicenseRef-Proprietary") */
825
+ license?: string;
826
+ /** Full license text or URL pointing to license terms */
827
+ licenseUrl?: string;
828
+ /** Human-readable usage terms or restrictions summary */
829
+ terms?: string;
830
+ /** Organization that published this archive */
831
+ publisher?: string;
832
+ /** Contact for licensing questions (e.g. email address) */
833
+ contact?: string;
834
+ }
835
+ /** Pipeline metadata describing how the data was produced */
836
+ interface ExportPipelineMetadata {
837
+ /** LLM model used for extraction (e.g. "claude-sonnet-4-20250514") */
838
+ extractionModel: string;
839
+ /** LLM provider name (e.g. "anthropic", "vllm") */
840
+ extractionProvider?: string;
841
+ /** Embeddings model used (e.g. "Qwen/Qwen3-Embedding-8B") */
842
+ embeddingsModel?: string;
843
+ /** Number of source documents processed */
844
+ sourceCount: number;
845
+ /** Source document names or paths */
846
+ sources: string[];
847
+ /** Extraction parameters used */
848
+ parameters?: {
849
+ chunkSize?: number;
850
+ chunkOverlap?: number;
851
+ maxOutputTokens?: number;
852
+ };
815
853
  }
816
854
  /** A complete repository export archive */
817
855
  interface ExportArchive {
@@ -845,6 +883,11 @@ type ExportStreamItem = {
845
883
  sequence: number;
846
884
  isLast: boolean;
847
885
  };
886
+ /** Options for exporting a repository */
887
+ interface ExportOptions {
888
+ /** Legal/copyright metadata to embed in the export manifest */
889
+ legal?: ExportLegalMetadata;
890
+ }
848
891
  /** Options for importing a repository archive */
849
892
  interface ImportOptions {
850
893
  /** How to handle the target repository */
@@ -868,6 +911,24 @@ interface ImportChunk {
868
911
  entities?: StoredEntity[];
869
912
  relationships?: StoredRelationship[];
870
913
  }
914
+ /** Options for bulk import operations at the storage provider level */
915
+ interface BulkImportOptions {
916
+ /**
917
+ * Skip existence checks before inserting.
918
+ * When true, the provider assumes items do not already exist and uses direct
919
+ * inserts instead of upserts. This is safe for freshly created repositories
920
+ * and significantly faster for providers that must otherwise check each item.
921
+ * Default: false (upsert behavior — check existence, then create or update).
922
+ */
923
+ skipExistenceCheck?: boolean;
924
+ }
925
+ /** Progress callback for delete operations */
926
+ type DeleteProgressCallback = (progress: {
927
+ entitiesDeleted: number;
928
+ relationshipsDeleted: number;
929
+ totalEntities: number;
930
+ totalRelationships: number;
931
+ }) => void | Promise<void>;
871
932
  /** Header for streaming import — sent before data chunks */
872
933
  interface ImportStreamHeader {
873
934
  manifest: ExportManifest;
@@ -894,4 +955,4 @@ interface ImportResult {
894
955
  warnings: ImportWarning[];
895
956
  }
896
957
 
897
- export type { RepositorySummary as $, ReembedResult as A, BulkImportResult as B, CreateEntityInput as C, DetailLevel as D, ExportChunk as E, FindEntitiesQuery as F, GovernanceConfig as G, Relationship as H, ImportChunk as I, PropertyFilter as J, RelationshipSummary as K, GraphResult as L, MemoryVocabulary as M, ExploreOptions as N, Neighbourhood as O, PaginatedResult as P, PathOptions as Q, RepositoryFilter as R, StorageRepositoryConfig as S, PathResult as T, UpdateEntityInput as U, VocabularyChangeRecord as V, ConceptSearchOptions as W, ScoredEntity as X, TimelineOptions as Y, TimelineResult as Z, RepositoryConfig as _, StoredRepository as a, ExportArchive as a0, ImportOptions as a1, ImportResult as a2, ExportStreamItem as a3, ImportStreamHeader as a4, SearchOptions as a5, SearchHit as a6, EnrichedRelationship as a7, EntityMap as a8, EntityTypeInput as a9, ExportManifest as aa, GetEntitiesOptions as ab, GetEntityOptions as ac, GovernanceMode as ad, ImportWarning as ae, NeighbourhoodCentre as af, NeighbourhoodGroup as ag, NeighbourhoodLayer as ah, Path as ai, PropertySchema as aj, PropertyType as ak, ProvenanceFilter as al, RelationshipDirection as am, RelationshipTypeDefinition as an, RelationshipTypeInput as ao, RepositoryMetadata as ap, StorageNeighbourhoodGroup as aq, StorageNeighbourhoodLayer as ar, StoragePath as as, StorageTimelineEvent as at, TimelineEntityRef as au, TimelineEvent as av, TimelineRelationshipDetail as aw, VocabularyInput as ax, StoredRepositorySummary as b, RepositoryUpdate as c, RepositoryStats as d, PaginationOptions as e, StoredEntity as f, StoredEntityUpdate as g, StorageFindQuery as h, StoredRelationship as i, RelationshipQueryOptions as j, StorageExploreOptions as k, StorageNeighbourhood as l, StoragePathOptions as m, StoragePathResult as n, StorageTimelineOptions as o, StorageTimelineResult as p, ResolvedVocabulary as q, CreateRelationshipInput as r, EntityTypeDefinition as s, VocabularyProposal as t, VocabularyProposalResult as u, ProvenanceContext as v, Provenance as w, Entity as x, EntitySummary as y, EntityBrief as z };
958
+ export type { TimelineResult as $, VocabularyProposal as A, BulkImportOptions as B, CreateEntityInput as C, DetailLevel as D, Entity as E, VocabularyProposalResult as F, GovernanceConfig as G, ProvenanceContext as H, ImportChunk as I, Provenance as J, FindEntitiesQuery as K, ReembedResult as L, MemoryVocabulary as M, Relationship as N, GraphResult as O, PropertyFilter as P, ExploreOptions as Q, RelationshipSummary as R, StorageRepositoryConfig as S, Neighbourhood as T, UpdateEntityInput as U, VocabularyChangeRecord as V, PathOptions as W, PathResult as X, ConceptSearchOptions as Y, ScoredEntity as Z, TimelineOptions as _, EntitySummary as a, RepositoryConfig as a0, RepositorySummary as a1, ExportOptions as a2, ExportArchive as a3, ImportOptions as a4, ImportResult as a5, ExportStreamItem as a6, ImportStreamHeader as a7, SearchOptions as a8, SearchHit as a9, TimelineEvent as aA, TimelineRelationshipDetail as aB, VocabularyInput as aC, EnrichedRelationship as aa, EntityMap as ab, EntityTypeInput as ac, ExportLegalMetadata as ad, ExportManifest as ae, ExportPipelineMetadata as af, GetEntitiesOptions as ag, GetEntityOptions as ah, GovernanceMode as ai, ImportWarning as aj, NeighbourhoodCentre as ak, NeighbourhoodGroup as al, NeighbourhoodLayer as am, Path as an, PropertySchema as ao, PropertyType as ap, ProvenanceFilter as aq, RelationshipDirection as ar, RelationshipTypeDefinition as as, RelationshipTypeInput as at, RepositoryMetadata as au, StorageNeighbourhoodGroup as av, StorageNeighbourhoodLayer as aw, StoragePath as ax, StorageTimelineEvent as ay, TimelineEntityRef as az, EntityBrief as b, StoredRepository as c, RepositoryFilter as d, PaginatedResult as e, StoredRepositorySummary as f, RepositoryUpdate as g, DeleteProgressCallback as h, RepositoryStats as i, PaginationOptions as j, StoredEntity as k, StoredEntityUpdate as l, StorageFindQuery as m, StoredRelationship as n, RelationshipQueryOptions as o, StorageExploreOptions as p, StorageNeighbourhood as q, StoragePathOptions as r, StoragePathResult as s, StorageTimelineOptions as t, StorageTimelineResult as u, ExportChunk as v, BulkImportResult as w, ResolvedVocabulary as x, CreateRelationshipInput as y, EntityTypeDefinition as z };
@@ -812,6 +812,44 @@ interface ExportManifest {
812
812
  dimensions: number;
813
813
  note: string;
814
814
  };
815
+ /** Legal and copyright metadata — set by the publisher of the archive */
816
+ legal?: ExportLegalMetadata;
817
+ /** Indexing pipeline metadata — present when archive was produced by the indexer */
818
+ pipeline?: ExportPipelineMetadata;
819
+ }
820
+ /** Legal and copyright metadata for an export archive */
821
+ interface ExportLegalMetadata {
822
+ /** Copyright holder (e.g. "© 2026 Caterpillar Inc.") */
823
+ copyright: string;
824
+ /** SPDX license identifier or custom license name (e.g. "Apache-2.0", "LicenseRef-Proprietary") */
825
+ license?: string;
826
+ /** Full license text or URL pointing to license terms */
827
+ licenseUrl?: string;
828
+ /** Human-readable usage terms or restrictions summary */
829
+ terms?: string;
830
+ /** Organization that published this archive */
831
+ publisher?: string;
832
+ /** Contact for licensing questions (e.g. email address) */
833
+ contact?: string;
834
+ }
835
+ /** Pipeline metadata describing how the data was produced */
836
+ interface ExportPipelineMetadata {
837
+ /** LLM model used for extraction (e.g. "claude-sonnet-4-20250514") */
838
+ extractionModel: string;
839
+ /** LLM provider name (e.g. "anthropic", "vllm") */
840
+ extractionProvider?: string;
841
+ /** Embeddings model used (e.g. "Qwen/Qwen3-Embedding-8B") */
842
+ embeddingsModel?: string;
843
+ /** Number of source documents processed */
844
+ sourceCount: number;
845
+ /** Source document names or paths */
846
+ sources: string[];
847
+ /** Extraction parameters used */
848
+ parameters?: {
849
+ chunkSize?: number;
850
+ chunkOverlap?: number;
851
+ maxOutputTokens?: number;
852
+ };
815
853
  }
816
854
  /** A complete repository export archive */
817
855
  interface ExportArchive {
@@ -845,6 +883,11 @@ type ExportStreamItem = {
845
883
  sequence: number;
846
884
  isLast: boolean;
847
885
  };
886
+ /** Options for exporting a repository */
887
+ interface ExportOptions {
888
+ /** Legal/copyright metadata to embed in the export manifest */
889
+ legal?: ExportLegalMetadata;
890
+ }
848
891
  /** Options for importing a repository archive */
849
892
  interface ImportOptions {
850
893
  /** How to handle the target repository */
@@ -868,6 +911,24 @@ interface ImportChunk {
868
911
  entities?: StoredEntity[];
869
912
  relationships?: StoredRelationship[];
870
913
  }
914
+ /** Options for bulk import operations at the storage provider level */
915
+ interface BulkImportOptions {
916
+ /**
917
+ * Skip existence checks before inserting.
918
+ * When true, the provider assumes items do not already exist and uses direct
919
+ * inserts instead of upserts. This is safe for freshly created repositories
920
+ * and significantly faster for providers that must otherwise check each item.
921
+ * Default: false (upsert behavior — check existence, then create or update).
922
+ */
923
+ skipExistenceCheck?: boolean;
924
+ }
925
+ /** Progress callback for delete operations */
926
+ type DeleteProgressCallback = (progress: {
927
+ entitiesDeleted: number;
928
+ relationshipsDeleted: number;
929
+ totalEntities: number;
930
+ totalRelationships: number;
931
+ }) => void | Promise<void>;
871
932
  /** Header for streaming import — sent before data chunks */
872
933
  interface ImportStreamHeader {
873
934
  manifest: ExportManifest;
@@ -894,4 +955,4 @@ interface ImportResult {
894
955
  warnings: ImportWarning[];
895
956
  }
896
957
 
897
- export type { RepositorySummary as $, ReembedResult as A, BulkImportResult as B, CreateEntityInput as C, DetailLevel as D, ExportChunk as E, FindEntitiesQuery as F, GovernanceConfig as G, Relationship as H, ImportChunk as I, PropertyFilter as J, RelationshipSummary as K, GraphResult as L, MemoryVocabulary as M, ExploreOptions as N, Neighbourhood as O, PaginatedResult as P, PathOptions as Q, RepositoryFilter as R, StorageRepositoryConfig as S, PathResult as T, UpdateEntityInput as U, VocabularyChangeRecord as V, ConceptSearchOptions as W, ScoredEntity as X, TimelineOptions as Y, TimelineResult as Z, RepositoryConfig as _, StoredRepository as a, ExportArchive as a0, ImportOptions as a1, ImportResult as a2, ExportStreamItem as a3, ImportStreamHeader as a4, SearchOptions as a5, SearchHit as a6, EnrichedRelationship as a7, EntityMap as a8, EntityTypeInput as a9, ExportManifest as aa, GetEntitiesOptions as ab, GetEntityOptions as ac, GovernanceMode as ad, ImportWarning as ae, NeighbourhoodCentre as af, NeighbourhoodGroup as ag, NeighbourhoodLayer as ah, Path as ai, PropertySchema as aj, PropertyType as ak, ProvenanceFilter as al, RelationshipDirection as am, RelationshipTypeDefinition as an, RelationshipTypeInput as ao, RepositoryMetadata as ap, StorageNeighbourhoodGroup as aq, StorageNeighbourhoodLayer as ar, StoragePath as as, StorageTimelineEvent as at, TimelineEntityRef as au, TimelineEvent as av, TimelineRelationshipDetail as aw, VocabularyInput as ax, StoredRepositorySummary as b, RepositoryUpdate as c, RepositoryStats as d, PaginationOptions as e, StoredEntity as f, StoredEntityUpdate as g, StorageFindQuery as h, StoredRelationship as i, RelationshipQueryOptions as j, StorageExploreOptions as k, StorageNeighbourhood as l, StoragePathOptions as m, StoragePathResult as n, StorageTimelineOptions as o, StorageTimelineResult as p, ResolvedVocabulary as q, CreateRelationshipInput as r, EntityTypeDefinition as s, VocabularyProposal as t, VocabularyProposalResult as u, ProvenanceContext as v, Provenance as w, Entity as x, EntitySummary as y, EntityBrief as z };
958
+ export type { TimelineResult as $, VocabularyProposal as A, BulkImportOptions as B, CreateEntityInput as C, DetailLevel as D, Entity as E, VocabularyProposalResult as F, GovernanceConfig as G, ProvenanceContext as H, ImportChunk as I, Provenance as J, FindEntitiesQuery as K, ReembedResult as L, MemoryVocabulary as M, Relationship as N, GraphResult as O, PropertyFilter as P, ExploreOptions as Q, RelationshipSummary as R, StorageRepositoryConfig as S, Neighbourhood as T, UpdateEntityInput as U, VocabularyChangeRecord as V, PathOptions as W, PathResult as X, ConceptSearchOptions as Y, ScoredEntity as Z, TimelineOptions as _, EntitySummary as a, RepositoryConfig as a0, RepositorySummary as a1, ExportOptions as a2, ExportArchive as a3, ImportOptions as a4, ImportResult as a5, ExportStreamItem as a6, ImportStreamHeader as a7, SearchOptions as a8, SearchHit as a9, TimelineEvent as aA, TimelineRelationshipDetail as aB, VocabularyInput as aC, EnrichedRelationship as aa, EntityMap as ab, EntityTypeInput as ac, ExportLegalMetadata as ad, ExportManifest as ae, ExportPipelineMetadata as af, GetEntitiesOptions as ag, GetEntityOptions as ah, GovernanceMode as ai, ImportWarning as aj, NeighbourhoodCentre as ak, NeighbourhoodGroup as al, NeighbourhoodLayer as am, Path as an, PropertySchema as ao, PropertyType as ap, ProvenanceFilter as aq, RelationshipDirection as ar, RelationshipTypeDefinition as as, RelationshipTypeInput as at, RepositoryMetadata as au, StorageNeighbourhoodGroup as av, StorageNeighbourhoodLayer as aw, StoragePath as ax, StorageTimelineEvent as ay, TimelineEntityRef as az, EntityBrief as b, StoredRepository as c, RepositoryFilter as d, PaginatedResult as e, StoredRepositorySummary as f, RepositoryUpdate as g, DeleteProgressCallback as h, RepositoryStats as i, PaginationOptions as j, StoredEntity as k, StoredEntityUpdate as l, StorageFindQuery as m, StoredRelationship as n, RelationshipQueryOptions as o, StorageExploreOptions as p, StorageNeighbourhood as q, StoragePathOptions as r, StoragePathResult as s, StorageTimelineOptions as t, StorageTimelineResult as u, ExportChunk as v, BulkImportResult as w, ResolvedVocabulary as x, CreateRelationshipInput as y, EntityTypeDefinition as z };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/providers/index.ts"],"sourcesContent":["// Provider interface re-exports — @utaba/deep-memory/providers\n\nexport type { StorageProvider } from './StorageProvider.js';\nexport type { EmbeddingProvider } from './EmbeddingProvider.js';\nexport type {\n SearchProvider,\n SearchableEntity,\n} from './SearchProvider.js';\nexport type {\n LockProvider,\n LockOptions,\n LockHandle,\n} from './LockProvider.js';\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../src/providers/index.ts"],"sourcesContent":["// Provider interface re-exports — @utaba/deep-memory/providers\n\nexport type { StorageProvider, EnsureSchemaResult } from './StorageProvider.js';\nexport type { EmbeddingProvider } from './EmbeddingProvider.js';\nexport type {\n SearchProvider,\n SearchableEntity,\n} from './SearchProvider.js';\nexport type {\n LockProvider,\n LockOptions,\n LockHandle,\n} from './LockProvider.js';\nexport type {\n GraphTraversalProvider,\n GraphTraversalCapabilities,\n} from './GraphTraversalProvider.js';\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -1,5 +1,6 @@
1
- export { S as StorageProvider } from '../StorageProvider-CkFjdboX.cjs';
2
- import { a5 as SearchOptions, P as PaginatedResult, a6 as SearchHit } from '../portability-DdlNYXGX.cjs';
1
+ export { E as EnsureSchemaResult, S as StorageProvider } from '../StorageProvider-CSbaIY6X.cjs';
2
+ import { a8 as SearchOptions, e as PaginatedResult, a9 as SearchHit } from '../portability-1KBMVBGJ.cjs';
3
+ import { T as TraversalSpec, a as TraversalResult } from '../traversal-DQynd-to.cjs';
3
4
 
4
5
  /**
5
6
  * EmbeddingProvider — enables semantic search and vocabulary deduplication.
@@ -72,4 +73,62 @@ interface LockHandle {
72
73
  extend(additionalMs: number): Promise<void>;
73
74
  }
74
75
 
75
- export type { EmbeddingProvider, LockHandle, LockOptions, LockProvider, SearchProvider, SearchableEntity };
76
+ /**
77
+ * Optional provider for native graph traversal.
78
+ * When registered, enables multi-hop traversal queries and native graph
79
+ * query pass-through. When absent, the library falls back to application-level
80
+ * BFS over StorageProvider for structured traversals.
81
+ */
82
+ interface GraphTraversalProvider {
83
+ /**
84
+ * Execute a structured traversal compiled from a TraversalSpec.
85
+ * The library may pass both the spec and a pre-compiled query string.
86
+ * The provider can use either — the compiled query is a suggestion,
87
+ * not a requirement.
88
+ */
89
+ traverse(repositoryId: string, spec: TraversalSpec, compiledQuery?: string): Promise<TraversalResult>;
90
+ /**
91
+ * Execute a native graph query (Gremlin, Cypher, etc.).
92
+ * The library passes the query string through without modification.
93
+ * The provider is responsible for execution and result mapping.
94
+ *
95
+ * Implementers decide whether to expose this to agents.
96
+ * The library does not add safety guards — that is the implementer's
97
+ * responsibility.
98
+ */
99
+ executeNativeQuery(repositoryId: string, query: string, params?: Record<string, unknown>): Promise<TraversalResult>;
100
+ /**
101
+ * Report provider capabilities so the library can adapt
102
+ * DSL compilation and validate traversal specs accordingly.
103
+ */
104
+ getCapabilities(): GraphTraversalCapabilities;
105
+ /** Optional lifecycle hooks, matching StorageProvider pattern. */
106
+ initialise?(): Promise<void>;
107
+ dispose?(): Promise<void>;
108
+ }
109
+ interface GraphTraversalCapabilities {
110
+ /** Whether executeNativeQuery() is implemented. */
111
+ supportsNativeQuery: boolean;
112
+ /** The native query language, for DSL compilation targeting. */
113
+ nativeQueryLanguage: 'gremlin' | 'cypher' | 'sql' | 'other';
114
+ /** Maximum traversal depth the provider supports. */
115
+ maxTraversalDepth: number;
116
+ /** Whether the provider supports property filters on relationships during traversal. */
117
+ supportsRelationshipPropertyFilters: boolean;
118
+ /** Whether the provider supports property filters on entities during traversal. */
119
+ supportsEntityPropertyFilters: boolean;
120
+ /** Whether the provider supports aggregation (count, sum, avg) on terminal results. */
121
+ supportsAggregation: boolean;
122
+ /** Whether the provider supports repeat/loop traversal steps. */
123
+ supportsRepeat: boolean;
124
+ /** Whether the provider supports dedup across traversal results. */
125
+ supportsDedup: boolean;
126
+ /**
127
+ * Whether the provider can return relationship summaries (outbound/inbound
128
+ * counts by type) natively in a single traversal query.
129
+ * When false, the library falls back to a batch fetch + local computation.
130
+ */
131
+ supportsRelationshipSummary: boolean;
132
+ }
133
+
134
+ export type { EmbeddingProvider, GraphTraversalCapabilities, GraphTraversalProvider, LockHandle, LockOptions, LockProvider, SearchProvider, SearchableEntity };
@@ -1,5 +1,6 @@
1
- export { S as StorageProvider } from '../StorageProvider-CJjz8uBY.js';
2
- import { a5 as SearchOptions, P as PaginatedResult, a6 as SearchHit } from '../portability-DdlNYXGX.js';
1
+ export { E as EnsureSchemaResult, S as StorageProvider } from '../StorageProvider-DqW-zpd0.js';
2
+ import { a8 as SearchOptions, e as PaginatedResult, a9 as SearchHit } from '../portability-1KBMVBGJ.js';
3
+ import { T as TraversalSpec, a as TraversalResult } from '../traversal-B4SUysM-.js';
3
4
 
4
5
  /**
5
6
  * EmbeddingProvider — enables semantic search and vocabulary deduplication.
@@ -72,4 +73,62 @@ interface LockHandle {
72
73
  extend(additionalMs: number): Promise<void>;
73
74
  }
74
75
 
75
- export type { EmbeddingProvider, LockHandle, LockOptions, LockProvider, SearchProvider, SearchableEntity };
76
+ /**
77
+ * Optional provider for native graph traversal.
78
+ * When registered, enables multi-hop traversal queries and native graph
79
+ * query pass-through. When absent, the library falls back to application-level
80
+ * BFS over StorageProvider for structured traversals.
81
+ */
82
+ interface GraphTraversalProvider {
83
+ /**
84
+ * Execute a structured traversal compiled from a TraversalSpec.
85
+ * The library may pass both the spec and a pre-compiled query string.
86
+ * The provider can use either — the compiled query is a suggestion,
87
+ * not a requirement.
88
+ */
89
+ traverse(repositoryId: string, spec: TraversalSpec, compiledQuery?: string): Promise<TraversalResult>;
90
+ /**
91
+ * Execute a native graph query (Gremlin, Cypher, etc.).
92
+ * The library passes the query string through without modification.
93
+ * The provider is responsible for execution and result mapping.
94
+ *
95
+ * Implementers decide whether to expose this to agents.
96
+ * The library does not add safety guards — that is the implementer's
97
+ * responsibility.
98
+ */
99
+ executeNativeQuery(repositoryId: string, query: string, params?: Record<string, unknown>): Promise<TraversalResult>;
100
+ /**
101
+ * Report provider capabilities so the library can adapt
102
+ * DSL compilation and validate traversal specs accordingly.
103
+ */
104
+ getCapabilities(): GraphTraversalCapabilities;
105
+ /** Optional lifecycle hooks, matching StorageProvider pattern. */
106
+ initialise?(): Promise<void>;
107
+ dispose?(): Promise<void>;
108
+ }
109
+ interface GraphTraversalCapabilities {
110
+ /** Whether executeNativeQuery() is implemented. */
111
+ supportsNativeQuery: boolean;
112
+ /** The native query language, for DSL compilation targeting. */
113
+ nativeQueryLanguage: 'gremlin' | 'cypher' | 'sql' | 'other';
114
+ /** Maximum traversal depth the provider supports. */
115
+ maxTraversalDepth: number;
116
+ /** Whether the provider supports property filters on relationships during traversal. */
117
+ supportsRelationshipPropertyFilters: boolean;
118
+ /** Whether the provider supports property filters on entities during traversal. */
119
+ supportsEntityPropertyFilters: boolean;
120
+ /** Whether the provider supports aggregation (count, sum, avg) on terminal results. */
121
+ supportsAggregation: boolean;
122
+ /** Whether the provider supports repeat/loop traversal steps. */
123
+ supportsRepeat: boolean;
124
+ /** Whether the provider supports dedup across traversal results. */
125
+ supportsDedup: boolean;
126
+ /**
127
+ * Whether the provider can return relationship summaries (outbound/inbound
128
+ * counts by type) natively in a single traversal query.
129
+ * When false, the library falls back to a batch fetch + local computation.
130
+ */
131
+ supportsRelationshipSummary: boolean;
132
+ }
133
+
134
+ export type { EmbeddingProvider, GraphTraversalCapabilities, GraphTraversalProvider, LockHandle, LockOptions, LockProvider, SearchProvider, SearchableEntity };
@@ -334,6 +334,28 @@ function runStorageProviderConformanceTests(factory) {
334
334
  (0, import_vitest.expect)(e).not.toBeNull();
335
335
  });
336
336
  });
337
+ (0, import_vitest.describe)("deleteAllContents", () => {
338
+ (0, import_vitest.it)("deletes all entities and relationships but preserves the repository", async () => {
339
+ await provider.createEntity(repoId, makeEntity("e1", "alpha"));
340
+ await provider.createEntity(repoId, makeEntity("e2", "beta"));
341
+ await provider.createRelationship(repoId, makeRelationship("r1", "links", "e1", "e2"));
342
+ const result = await provider.deleteAllContents(repoId);
343
+ (0, import_vitest.expect)(result.deletedEntities).toBe(2);
344
+ (0, import_vitest.expect)(result.deletedRelationships).toBe(1);
345
+ const repo = await provider.getRepository(repoId);
346
+ (0, import_vitest.expect)(repo).not.toBeNull();
347
+ const vocab = await provider.getVocabulary(repoId);
348
+ (0, import_vitest.expect)(vocab).toBeDefined();
349
+ const stats = await provider.getRepositoryStats(repoId);
350
+ (0, import_vitest.expect)(stats.entityCount).toBe(0);
351
+ (0, import_vitest.expect)(stats.relationshipCount).toBe(0);
352
+ });
353
+ (0, import_vitest.it)("returns zero counts on an empty repository", async () => {
354
+ const result = await provider.deleteAllContents(repoId);
355
+ (0, import_vitest.expect)(result.deletedEntities).toBe(0);
356
+ (0, import_vitest.expect)(result.deletedRelationships).toBe(0);
357
+ });
358
+ });
337
359
  (0, import_vitest.describe)("stats reflect data", () => {
338
360
  (0, import_vitest.it)("counts entities and relationships", async () => {
339
361
  await provider.createEntity(repoId, makeEntity("e1", "alpha"));
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/providers-builtin/conformance.ts"],"sourcesContent":["// Provider Conformance Test Suite\n// Any StorageProvider implementer can import and run these tests to verify conformance.\n//\n// Usage:\n// import { runStorageProviderConformanceTests } from '@utaba/deep-memory';\n// runStorageProviderConformanceTests(() => new MyStorageProvider());\n\nimport { describe, it, expect, beforeEach } from 'vitest';\nimport type { StorageProvider } from '../providers/StorageProvider.js';\nimport type { StoredEntity } from '../types/entities.js';\nimport type { StoredRelationship } from '../types/relationships.js';\nimport type { Provenance } from '../types/provenance.js';\n\nfunction makeProvenance(): Provenance {\n const now = new Date().toISOString();\n return {\n createdBy: 'conformance-test',\n createdByType: 'agent',\n createdAt: now,\n modifiedBy: 'conformance-test',\n modifiedByType: 'agent',\n modifiedAt: now,\n };\n}\n\nfunction makeEntity(id: string, type = 'test-type', label?: string): StoredEntity {\n return {\n id,\n slug: `${type}:${(label ?? id).toLowerCase().replace(/[^a-z0-9]+/g, '-')}`,\n entityType: type,\n label: label ?? id,\n summary: `Summary for ${id}`,\n properties: { key: 'value' },\n provenance: makeProvenance(),\n };\n}\n\nfunction makeRelationship(\n id: string,\n type: string,\n sourceId: string,\n targetId: string,\n bidirectional = false,\n): StoredRelationship {\n return {\n id,\n relationshipType: type,\n sourceEntityId: sourceId,\n targetEntityId: targetId,\n properties: {},\n bidirectional,\n provenance: makeProvenance(),\n };\n}\n\n/**\n * Run the full StorageProvider conformance test suite.\n *\n * @param factory - A function that creates a fresh, empty StorageProvider instance.\n * Called before each test to ensure isolation.\n */\nexport function runStorageProviderConformanceTests(\n factory: () => StorageProvider | Promise<StorageProvider>,\n): void {\n // Use a stable GUID so external cleanup scripts can target it\n const repoId = '40000000-0000-4000-a000-000000000001';\n\n let provider: StorageProvider;\n\n async function setup(): Promise<void> {\n provider = await factory();\n if (provider.initialise) await provider.initialise();\n\n await provider.createRepository({\n repositoryId: repoId,\n label: 'Conformance Test',\n governanceConfig: { mode: 'open' },\n createdAt: new Date().toISOString(),\n createdBy: 'conformance-test',\n });\n }\n\n describe('StorageProvider Conformance Tests', () => {\n beforeEach(async () => {\n await setup();\n });\n\n // ─── Repository ─────────────────────────────────────────\n\n describe('repository operations', () => {\n it('creates a repository', async () => {\n const repo = await provider.getRepository(repoId);\n expect(repo).not.toBeNull();\n expect(repo!.repositoryId).toBe(repoId);\n expect(repo!.label).toBe('Conformance Test');\n });\n\n it('returns null for non-existent repository', async () => {\n const repo = await provider.getRepository('ffffffff-ffff-4fff-afff-ffffffffffff');\n expect(repo).toBeNull();\n });\n\n it('lists repositories', async () => {\n const list = await provider.listRepositories();\n expect(list.items.length).toBeGreaterThanOrEqual(1);\n expect(list.items.some((r) => r.repositoryId === repoId)).toBe(true);\n });\n\n it('updates a repository', async () => {\n const updated = await provider.updateRepository(repoId, {\n label: 'Updated Label',\n description: 'Updated description',\n governanceConfig: { mode: 'open', defaultSimilarityThreshold: 0.4 },\n });\n expect(updated.label).toBe('Updated Label');\n expect(updated.description).toBe('Updated description');\n expect(updated.governanceConfig.defaultSimilarityThreshold).toBe(0.4);\n\n // Verify persistence\n const fetched = await provider.getRepository(repoId);\n expect(fetched!.label).toBe('Updated Label');\n expect(fetched!.governanceConfig.defaultSimilarityThreshold).toBe(0.4);\n });\n\n it('deletes a repository', async () => {\n await provider.deleteRepository(repoId);\n expect(await provider.getRepository(repoId)).toBeNull();\n });\n\n it('returns repository stats', async () => {\n const stats = await provider.getRepositoryStats(repoId);\n expect(stats.entityCount).toBe(0);\n expect(stats.relationshipCount).toBe(0);\n expect(typeof stats.vocabularyVersion).toBe('string');\n });\n });\n\n // ─── Vocabulary ─────────────────────────────────────────\n\n describe('vocabulary operations', () => {\n it('gets and saves vocabulary', async () => {\n const vocab = await provider.getVocabulary(repoId);\n expect(vocab).toBeDefined();\n expect(typeof vocab.version).toBe('string');\n\n const updated = { ...vocab, version: '1.0.0' };\n await provider.saveVocabulary(repoId, updated);\n\n const fetched = await provider.getVocabulary(repoId);\n expect(fetched.version).toBe('1.0.0');\n });\n\n it('returns vocabulary change log', async () => {\n const log = await provider.getVocabularyChangeLog(repoId);\n expect(Array.isArray(log.items)).toBe(true);\n });\n });\n\n // ─── Entities ───────────────────────────────────────────\n\n describe('entity operations', () => {\n it('creates and retrieves an entity', async () => {\n const entity = makeEntity('e1');\n await provider.createEntity(repoId, entity);\n\n const retrieved = await provider.getEntity(repoId, 'e1');\n expect(retrieved).not.toBeNull();\n expect(retrieved!.id).toBe('e1');\n expect(retrieved!.label).toBe('e1');\n });\n\n it('retrieves an entity by slug', async () => {\n const entity = makeEntity('e1', 'test-type', 'Alpha');\n await provider.createEntity(repoId, entity);\n\n const retrieved = await provider.getEntityBySlug(repoId, entity.slug);\n expect(retrieved).not.toBeNull();\n expect(retrieved!.id).toBe('e1');\n expect(retrieved!.slug).toBe(entity.slug);\n });\n\n it('returns null for non-existent entity', async () => {\n const result = await provider.getEntity(repoId, 'nonexistent');\n expect(result).toBeNull();\n });\n\n it('returns null for non-existent slug', async () => {\n const result = await provider.getEntityBySlug(repoId, 'nonexistent:slug');\n expect(result).toBeNull();\n });\n\n it('batch retrieves entities', async () => {\n await provider.createEntity(repoId, makeEntity('e1'));\n await provider.createEntity(repoId, makeEntity('e2'));\n\n const map = await provider.getEntities(repoId, ['e1', 'e2', 'missing']);\n expect(map.size).toBe(2);\n expect(map.has('e1')).toBe(true);\n expect(map.has('e2')).toBe(true);\n expect(map.has('missing')).toBe(false);\n });\n\n it('updates an entity', async () => {\n await provider.createEntity(repoId, makeEntity('e1'));\n const updated = await provider.updateEntity(repoId, 'e1', {\n label: 'Updated Label',\n provenance: makeProvenance(),\n });\n expect(updated.label).toBe('Updated Label');\n\n const fetched = await provider.getEntity(repoId, 'e1');\n expect(fetched!.label).toBe('Updated Label');\n });\n\n it('deletes an entity', async () => {\n await provider.createEntity(repoId, makeEntity('e1'));\n await provider.deleteEntity(repoId, 'e1');\n expect(await provider.getEntity(repoId, 'e1')).toBeNull();\n });\n\n it('finds entities by search term', async () => {\n await provider.createEntity(repoId, makeEntity('e1', 'test-type', 'Alpha'));\n await provider.createEntity(repoId, makeEntity('e2', 'test-type', 'Beta'));\n\n const result = await provider.findEntities(repoId, {\n searchTerm: 'alpha',\n limit: 10,\n offset: 0,\n });\n expect(result.items).toHaveLength(1);\n expect(result.items[0]!.label).toBe('Alpha');\n });\n\n it('finds entities by type filter', async () => {\n await provider.createEntity(repoId, makeEntity('e1', 'type-a', 'A'));\n await provider.createEntity(repoId, makeEntity('e2', 'type-b', 'B'));\n\n const result = await provider.findEntities(repoId, {\n entityTypes: ['type-a'],\n limit: 10,\n offset: 0,\n });\n expect(result.items).toHaveLength(1);\n expect(result.items[0]!.entityType).toBe('type-a');\n });\n\n it('paginates find results', async () => {\n await provider.createEntity(repoId, makeEntity('e1'));\n await provider.createEntity(repoId, makeEntity('e2'));\n await provider.createEntity(repoId, makeEntity('e3'));\n\n const page1 = await provider.findEntities(repoId, { limit: 2, offset: 0 });\n expect(page1.items).toHaveLength(2);\n expect(page1.hasMore).toBe(true);\n\n const page2 = await provider.findEntities(repoId, { limit: 2, offset: 2 });\n expect(page2.items).toHaveLength(1);\n expect(page2.hasMore).toBe(false);\n });\n });\n\n // ─── Relationships ──────────────────────────────────────\n\n describe('relationship operations', () => {\n beforeEach(async () => {\n await provider.createEntity(repoId, makeEntity('a'));\n await provider.createEntity(repoId, makeEntity('b'));\n await provider.createEntity(repoId, makeEntity('c'));\n });\n\n it('creates and retrieves a relationship', async () => {\n const rel = makeRelationship('r1', 'connects', 'a', 'b');\n await provider.createRelationship(repoId, rel);\n\n const retrieved = await provider.getRelationship(repoId, 'r1');\n expect(retrieved).not.toBeNull();\n expect(retrieved!.sourceEntityId).toBe('a');\n expect(retrieved!.targetEntityId).toBe('b');\n });\n\n it('returns null for non-existent relationship', async () => {\n expect(await provider.getRelationship(repoId, 'nonexistent')).toBeNull();\n });\n\n it('gets entity relationships', async () => {\n await provider.createRelationship(repoId, makeRelationship('r1', 'connects', 'a', 'b'));\n await provider.createRelationship(repoId, makeRelationship('r2', 'connects', 'c', 'a'));\n\n const result = await provider.getEntityRelationships(repoId, 'a');\n expect(result.items).toHaveLength(2);\n });\n\n it('filters relationships by direction', async () => {\n await provider.createRelationship(repoId, makeRelationship('r1', 'connects', 'a', 'b'));\n await provider.createRelationship(repoId, makeRelationship('r2', 'connects', 'c', 'a'));\n\n const outbound = await provider.getEntityRelationships(repoId, 'a', { direction: 'outbound' });\n expect(outbound.items).toHaveLength(1);\n expect(outbound.items[0]!.targetEntityId).toBe('b');\n\n const inbound = await provider.getEntityRelationships(repoId, 'a', { direction: 'inbound' });\n expect(inbound.items).toHaveLength(1);\n expect(inbound.items[0]!.sourceEntityId).toBe('c');\n });\n\n it('deletes a relationship', async () => {\n await provider.createRelationship(repoId, makeRelationship('r1', 'connects', 'a', 'b'));\n await provider.deleteRelationship(repoId, 'r1');\n expect(await provider.getRelationship(repoId, 'r1')).toBeNull();\n });\n });\n\n // ─── Graph Traversal ────────────────────────────────────\n\n describe('graph traversal', () => {\n beforeEach(async () => {\n await provider.createEntity(repoId, makeEntity('a', 'node', 'A'));\n await provider.createEntity(repoId, makeEntity('b', 'node', 'B'));\n await provider.createEntity(repoId, makeEntity('c', 'node', 'C'));\n await provider.createRelationship(repoId, makeRelationship('r1', 'links', 'a', 'b'));\n await provider.createRelationship(repoId, makeRelationship('r2', 'links', 'b', 'c'));\n });\n\n it('explores neighbourhood at depth 1', async () => {\n const result = await provider.exploreNeighbourhood(repoId, 'a', {\n depth: 1,\n direction: 'both',\n limitPerType: 10,\n offsetPerType: 0,\n });\n expect(result.centreId).toBe('a');\n expect(result.layers).toHaveLength(1);\n });\n\n it('finds paths between connected entities', async () => {\n const result = await provider.findPaths(repoId, 'a', 'c', {\n maxDepth: 3,\n limit: 5,\n offset: 0,\n });\n expect(result.paths.length).toBeGreaterThanOrEqual(1);\n const firstPath = result.paths[0]!;\n expect(firstPath.entityIds[0]).toBe('a');\n expect(firstPath.entityIds[firstPath.entityIds.length - 1]).toBe('c');\n });\n\n it('returns empty paths when no connection', async () => {\n await provider.createEntity(repoId, makeEntity('isolated', 'node', 'Isolated'));\n const result = await provider.findPaths(repoId, 'a', 'isolated', {\n maxDepth: 3,\n limit: 5,\n offset: 0,\n });\n expect(result.paths).toHaveLength(0);\n });\n\n it('finds paths through non-bidirectional inbound edges', async () => {\n // Graph: a → b ← d (both edges are non-bidirectional)\n // Path from a to d should traverse: a →(outbound) b ←(inbound) d\n await provider.createEntity(repoId, makeEntity('d', 'node', 'D'));\n await provider.createRelationship(repoId, makeRelationship('r3', 'links', 'd', 'b'));\n const result = await provider.findPaths(repoId, 'a', 'd', {\n maxDepth: 3,\n limit: 5,\n offset: 0,\n });\n expect(result.paths.length).toBeGreaterThanOrEqual(1);\n const firstPath = result.paths[0]!;\n expect(firstPath.entityIds[0]).toBe('a');\n expect(firstPath.entityIds[firstPath.entityIds.length - 1]).toBe('d');\n });\n });\n\n // ─── Timeline ───────────────────────────────────────────\n\n describe('timeline', () => {\n it('returns timeline events', async () => {\n await provider.createEntity(repoId, makeEntity('e1'));\n const result = await provider.getTimeline(repoId, 'e1', {\n limit: 10,\n offset: 0,\n });\n expect(result.events.length).toBeGreaterThanOrEqual(1);\n });\n });\n\n // ─── Bulk Operations ────────────────────────────────────\n\n describe('bulk operations', () => {\n it('exports data', async () => {\n await provider.createEntity(repoId, makeEntity('e1'));\n\n const chunks = [];\n for await (const chunk of provider.exportAll(repoId)) {\n chunks.push(chunk);\n }\n expect(chunks.length).toBeGreaterThanOrEqual(1);\n });\n\n it('imports data', async () => {\n const result = await provider.importBulk(repoId, [\n { entities: [makeEntity('imported-1'), makeEntity('imported-2')] },\n { relationships: [makeRelationship('ir1', 'links', 'imported-1', 'imported-2')] },\n ]);\n expect(result.entitiesImported).toBe(2);\n expect(result.relationshipsImported).toBe(1);\n\n // Verify imported data is accessible\n const e = await provider.getEntity(repoId, 'imported-1');\n expect(e).not.toBeNull();\n });\n });\n\n // ─── Stats after data ───────────────────────────────────\n\n describe('stats reflect data', () => {\n it('counts entities and relationships', async () => {\n await provider.createEntity(repoId, makeEntity('e1', 'alpha'));\n await provider.createEntity(repoId, makeEntity('e2', 'alpha'));\n await provider.createEntity(repoId, makeEntity('e3', 'beta'));\n await provider.createRelationship(repoId, makeRelationship('r1', 'links', 'e1', 'e2'));\n\n const stats = await provider.getRepositoryStats(repoId);\n expect(stats.entityCount).toBe(3);\n expect(stats.relationshipCount).toBe(1);\n expect(stats.entityTypeBreakdown['alpha']).toBe(2);\n expect(stats.entityTypeBreakdown['beta']).toBe(1);\n expect(stats.relationshipTypeBreakdown['links']).toBe(1);\n });\n });\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,oBAAiD;AAMjD,SAAS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cAAM,SAAS,aAAa,QAAQ,WAAW,MAAM,MAAM,CAAC;AAC5D,cAAM,SAAS,mBAAmB,QAAQ,iBAAiB,MAAM,SAAS,MAAM,IAAI,CAAC;AAErF,cAAM,QAAQ,MAAM,SAAS,mBAAmB,MAAM;AACtD,kCAAO,MAAM,WAAW,EAAE,KAAK,CAAC;AAChC,kCAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC;AACtC,kCAAO,MAAM,oBAAoB,OAAO,CAAC,EAAE,KAAK,CAAC;AACjD,kCAAO,MAAM,oBAAoB,MAAM,CAAC,EAAE,KAAK,CAAC;AAChD,kCAAO,MAAM,0BAA0B,OAAO,CAAC,EAAE,KAAK,CAAC;AAAA,MACzD,CAAC;AAAA,IACH,CAAC;AAAA,EACH,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../../src/providers-builtin/conformance.ts"],"sourcesContent":["// Provider Conformance Test Suite\n// Any StorageProvider implementer can import and run these tests to verify conformance.\n//\n// Usage:\n// import { runStorageProviderConformanceTests } from '@utaba/deep-memory';\n// runStorageProviderConformanceTests(() => new MyStorageProvider());\n\nimport { describe, it, expect, beforeEach } from 'vitest';\nimport type { StorageProvider } from '../providers/StorageProvider.js';\nimport type { StoredEntity } from '../types/entities.js';\nimport type { StoredRelationship } from '../types/relationships.js';\nimport type { Provenance } from '../types/provenance.js';\n\nfunction makeProvenance(): Provenance {\n const now = new Date().toISOString();\n return {\n createdBy: 'conformance-test',\n createdByType: 'agent',\n createdAt: now,\n modifiedBy: 'conformance-test',\n modifiedByType: 'agent',\n modifiedAt: now,\n };\n}\n\nfunction makeEntity(id: string, type = 'test-type', label?: string): StoredEntity {\n return {\n id,\n slug: `${type}:${(label ?? id).toLowerCase().replace(/[^a-z0-9]+/g, '-')}`,\n entityType: type,\n label: label ?? id,\n summary: `Summary for ${id}`,\n properties: { key: 'value' },\n provenance: makeProvenance(),\n };\n}\n\nfunction makeRelationship(\n id: string,\n type: string,\n sourceId: string,\n targetId: string,\n bidirectional = false,\n): StoredRelationship {\n return {\n id,\n relationshipType: type,\n sourceEntityId: sourceId,\n targetEntityId: targetId,\n properties: {},\n bidirectional,\n provenance: makeProvenance(),\n };\n}\n\n/**\n * Run the full StorageProvider conformance test suite.\n *\n * @param factory - A function that creates a fresh, empty StorageProvider instance.\n * Called before each test to ensure isolation.\n */\nexport function runStorageProviderConformanceTests(\n factory: () => StorageProvider | Promise<StorageProvider>,\n): void {\n // Use a stable GUID so external cleanup scripts can target it\n const repoId = '40000000-0000-4000-a000-000000000001';\n\n let provider: StorageProvider;\n\n async function setup(): Promise<void> {\n provider = await factory();\n if (provider.initialise) await provider.initialise();\n\n await provider.createRepository({\n repositoryId: repoId,\n label: 'Conformance Test',\n governanceConfig: { mode: 'open' },\n createdAt: new Date().toISOString(),\n createdBy: 'conformance-test',\n });\n }\n\n describe('StorageProvider Conformance Tests', () => {\n beforeEach(async () => {\n await setup();\n });\n\n // ─── Repository ─────────────────────────────────────────\n\n describe('repository operations', () => {\n it('creates a repository', async () => {\n const repo = await provider.getRepository(repoId);\n expect(repo).not.toBeNull();\n expect(repo!.repositoryId).toBe(repoId);\n expect(repo!.label).toBe('Conformance Test');\n });\n\n it('returns null for non-existent repository', async () => {\n const repo = await provider.getRepository('ffffffff-ffff-4fff-afff-ffffffffffff');\n expect(repo).toBeNull();\n });\n\n it('lists repositories', async () => {\n const list = await provider.listRepositories();\n expect(list.items.length).toBeGreaterThanOrEqual(1);\n expect(list.items.some((r) => r.repositoryId === repoId)).toBe(true);\n });\n\n it('updates a repository', async () => {\n const updated = await provider.updateRepository(repoId, {\n label: 'Updated Label',\n description: 'Updated description',\n governanceConfig: { mode: 'open', defaultSimilarityThreshold: 0.4 },\n });\n expect(updated.label).toBe('Updated Label');\n expect(updated.description).toBe('Updated description');\n expect(updated.governanceConfig.defaultSimilarityThreshold).toBe(0.4);\n\n // Verify persistence\n const fetched = await provider.getRepository(repoId);\n expect(fetched!.label).toBe('Updated Label');\n expect(fetched!.governanceConfig.defaultSimilarityThreshold).toBe(0.4);\n });\n\n it('deletes a repository', async () => {\n await provider.deleteRepository(repoId);\n expect(await provider.getRepository(repoId)).toBeNull();\n });\n\n it('returns repository stats', async () => {\n const stats = await provider.getRepositoryStats(repoId);\n expect(stats.entityCount).toBe(0);\n expect(stats.relationshipCount).toBe(0);\n expect(typeof stats.vocabularyVersion).toBe('string');\n });\n });\n\n // ─── Vocabulary ─────────────────────────────────────────\n\n describe('vocabulary operations', () => {\n it('gets and saves vocabulary', async () => {\n const vocab = await provider.getVocabulary(repoId);\n expect(vocab).toBeDefined();\n expect(typeof vocab.version).toBe('string');\n\n const updated = { ...vocab, version: '1.0.0' };\n await provider.saveVocabulary(repoId, updated);\n\n const fetched = await provider.getVocabulary(repoId);\n expect(fetched.version).toBe('1.0.0');\n });\n\n it('returns vocabulary change log', async () => {\n const log = await provider.getVocabularyChangeLog(repoId);\n expect(Array.isArray(log.items)).toBe(true);\n });\n });\n\n // ─── Entities ───────────────────────────────────────────\n\n describe('entity operations', () => {\n it('creates and retrieves an entity', async () => {\n const entity = makeEntity('e1');\n await provider.createEntity(repoId, entity);\n\n const retrieved = await provider.getEntity(repoId, 'e1');\n expect(retrieved).not.toBeNull();\n expect(retrieved!.id).toBe('e1');\n expect(retrieved!.label).toBe('e1');\n });\n\n it('retrieves an entity by slug', async () => {\n const entity = makeEntity('e1', 'test-type', 'Alpha');\n await provider.createEntity(repoId, entity);\n\n const retrieved = await provider.getEntityBySlug(repoId, entity.slug);\n expect(retrieved).not.toBeNull();\n expect(retrieved!.id).toBe('e1');\n expect(retrieved!.slug).toBe(entity.slug);\n });\n\n it('returns null for non-existent entity', async () => {\n const result = await provider.getEntity(repoId, 'nonexistent');\n expect(result).toBeNull();\n });\n\n it('returns null for non-existent slug', async () => {\n const result = await provider.getEntityBySlug(repoId, 'nonexistent:slug');\n expect(result).toBeNull();\n });\n\n it('batch retrieves entities', async () => {\n await provider.createEntity(repoId, makeEntity('e1'));\n await provider.createEntity(repoId, makeEntity('e2'));\n\n const map = await provider.getEntities(repoId, ['e1', 'e2', 'missing']);\n expect(map.size).toBe(2);\n expect(map.has('e1')).toBe(true);\n expect(map.has('e2')).toBe(true);\n expect(map.has('missing')).toBe(false);\n });\n\n it('updates an entity', async () => {\n await provider.createEntity(repoId, makeEntity('e1'));\n const updated = await provider.updateEntity(repoId, 'e1', {\n label: 'Updated Label',\n provenance: makeProvenance(),\n });\n expect(updated.label).toBe('Updated Label');\n\n const fetched = await provider.getEntity(repoId, 'e1');\n expect(fetched!.label).toBe('Updated Label');\n });\n\n it('deletes an entity', async () => {\n await provider.createEntity(repoId, makeEntity('e1'));\n await provider.deleteEntity(repoId, 'e1');\n expect(await provider.getEntity(repoId, 'e1')).toBeNull();\n });\n\n it('finds entities by search term', async () => {\n await provider.createEntity(repoId, makeEntity('e1', 'test-type', 'Alpha'));\n await provider.createEntity(repoId, makeEntity('e2', 'test-type', 'Beta'));\n\n const result = await provider.findEntities(repoId, {\n searchTerm: 'alpha',\n limit: 10,\n offset: 0,\n });\n expect(result.items).toHaveLength(1);\n expect(result.items[0]!.label).toBe('Alpha');\n });\n\n it('finds entities by type filter', async () => {\n await provider.createEntity(repoId, makeEntity('e1', 'type-a', 'A'));\n await provider.createEntity(repoId, makeEntity('e2', 'type-b', 'B'));\n\n const result = await provider.findEntities(repoId, {\n entityTypes: ['type-a'],\n limit: 10,\n offset: 0,\n });\n expect(result.items).toHaveLength(1);\n expect(result.items[0]!.entityType).toBe('type-a');\n });\n\n it('paginates find results', async () => {\n await provider.createEntity(repoId, makeEntity('e1'));\n await provider.createEntity(repoId, makeEntity('e2'));\n await provider.createEntity(repoId, makeEntity('e3'));\n\n const page1 = await provider.findEntities(repoId, { limit: 2, offset: 0 });\n expect(page1.items).toHaveLength(2);\n expect(page1.hasMore).toBe(true);\n\n const page2 = await provider.findEntities(repoId, { limit: 2, offset: 2 });\n expect(page2.items).toHaveLength(1);\n expect(page2.hasMore).toBe(false);\n });\n });\n\n // ─── Relationships ──────────────────────────────────────\n\n describe('relationship operations', () => {\n beforeEach(async () => {\n await provider.createEntity(repoId, makeEntity('a'));\n await provider.createEntity(repoId, makeEntity('b'));\n await provider.createEntity(repoId, makeEntity('c'));\n });\n\n it('creates and retrieves a relationship', async () => {\n const rel = makeRelationship('r1', 'connects', 'a', 'b');\n await provider.createRelationship(repoId, rel);\n\n const retrieved = await provider.getRelationship(repoId, 'r1');\n expect(retrieved).not.toBeNull();\n expect(retrieved!.sourceEntityId).toBe('a');\n expect(retrieved!.targetEntityId).toBe('b');\n });\n\n it('returns null for non-existent relationship', async () => {\n expect(await provider.getRelationship(repoId, 'nonexistent')).toBeNull();\n });\n\n it('gets entity relationships', async () => {\n await provider.createRelationship(repoId, makeRelationship('r1', 'connects', 'a', 'b'));\n await provider.createRelationship(repoId, makeRelationship('r2', 'connects', 'c', 'a'));\n\n const result = await provider.getEntityRelationships(repoId, 'a');\n expect(result.items).toHaveLength(2);\n });\n\n it('filters relationships by direction', async () => {\n await provider.createRelationship(repoId, makeRelationship('r1', 'connects', 'a', 'b'));\n await provider.createRelationship(repoId, makeRelationship('r2', 'connects', 'c', 'a'));\n\n const outbound = await provider.getEntityRelationships(repoId, 'a', { direction: 'outbound' });\n expect(outbound.items).toHaveLength(1);\n expect(outbound.items[0]!.targetEntityId).toBe('b');\n\n const inbound = await provider.getEntityRelationships(repoId, 'a', { direction: 'inbound' });\n expect(inbound.items).toHaveLength(1);\n expect(inbound.items[0]!.sourceEntityId).toBe('c');\n });\n\n it('deletes a relationship', async () => {\n await provider.createRelationship(repoId, makeRelationship('r1', 'connects', 'a', 'b'));\n await provider.deleteRelationship(repoId, 'r1');\n expect(await provider.getRelationship(repoId, 'r1')).toBeNull();\n });\n });\n\n // ─── Graph Traversal ────────────────────────────────────\n\n describe('graph traversal', () => {\n beforeEach(async () => {\n await provider.createEntity(repoId, makeEntity('a', 'node', 'A'));\n await provider.createEntity(repoId, makeEntity('b', 'node', 'B'));\n await provider.createEntity(repoId, makeEntity('c', 'node', 'C'));\n await provider.createRelationship(repoId, makeRelationship('r1', 'links', 'a', 'b'));\n await provider.createRelationship(repoId, makeRelationship('r2', 'links', 'b', 'c'));\n });\n\n it('explores neighbourhood at depth 1', async () => {\n const result = await provider.exploreNeighbourhood(repoId, 'a', {\n depth: 1,\n direction: 'both',\n limitPerType: 10,\n offsetPerType: 0,\n });\n expect(result.centreId).toBe('a');\n expect(result.layers).toHaveLength(1);\n });\n\n it('finds paths between connected entities', async () => {\n const result = await provider.findPaths(repoId, 'a', 'c', {\n maxDepth: 3,\n limit: 5,\n offset: 0,\n });\n expect(result.paths.length).toBeGreaterThanOrEqual(1);\n const firstPath = result.paths[0]!;\n expect(firstPath.entityIds[0]).toBe('a');\n expect(firstPath.entityIds[firstPath.entityIds.length - 1]).toBe('c');\n });\n\n it('returns empty paths when no connection', async () => {\n await provider.createEntity(repoId, makeEntity('isolated', 'node', 'Isolated'));\n const result = await provider.findPaths(repoId, 'a', 'isolated', {\n maxDepth: 3,\n limit: 5,\n offset: 0,\n });\n expect(result.paths).toHaveLength(0);\n });\n\n it('finds paths through non-bidirectional inbound edges', async () => {\n // Graph: a → b ← d (both edges are non-bidirectional)\n // Path from a to d should traverse: a →(outbound) b ←(inbound) d\n await provider.createEntity(repoId, makeEntity('d', 'node', 'D'));\n await provider.createRelationship(repoId, makeRelationship('r3', 'links', 'd', 'b'));\n const result = await provider.findPaths(repoId, 'a', 'd', {\n maxDepth: 3,\n limit: 5,\n offset: 0,\n });\n expect(result.paths.length).toBeGreaterThanOrEqual(1);\n const firstPath = result.paths[0]!;\n expect(firstPath.entityIds[0]).toBe('a');\n expect(firstPath.entityIds[firstPath.entityIds.length - 1]).toBe('d');\n });\n });\n\n // ─── Timeline ───────────────────────────────────────────\n\n describe('timeline', () => {\n it('returns timeline events', async () => {\n await provider.createEntity(repoId, makeEntity('e1'));\n const result = await provider.getTimeline(repoId, 'e1', {\n limit: 10,\n offset: 0,\n });\n expect(result.events.length).toBeGreaterThanOrEqual(1);\n });\n });\n\n // ─── Bulk Operations ────────────────────────────────────\n\n describe('bulk operations', () => {\n it('exports data', async () => {\n await provider.createEntity(repoId, makeEntity('e1'));\n\n const chunks = [];\n for await (const chunk of provider.exportAll(repoId)) {\n chunks.push(chunk);\n }\n expect(chunks.length).toBeGreaterThanOrEqual(1);\n });\n\n it('imports data', async () => {\n const result = await provider.importBulk(repoId, [\n { entities: [makeEntity('imported-1'), makeEntity('imported-2')] },\n { relationships: [makeRelationship('ir1', 'links', 'imported-1', 'imported-2')] },\n ]);\n expect(result.entitiesImported).toBe(2);\n expect(result.relationshipsImported).toBe(1);\n\n // Verify imported data is accessible\n const e = await provider.getEntity(repoId, 'imported-1');\n expect(e).not.toBeNull();\n });\n });\n\n // ─── Delete All Contents ───────────────────────────────\n\n describe('deleteAllContents', () => {\n it('deletes all entities and relationships but preserves the repository', async () => {\n await provider.createEntity(repoId, makeEntity('e1', 'alpha'));\n await provider.createEntity(repoId, makeEntity('e2', 'beta'));\n await provider.createRelationship(repoId, makeRelationship('r1', 'links', 'e1', 'e2'));\n\n const result = await provider.deleteAllContents(repoId);\n expect(result.deletedEntities).toBe(2);\n expect(result.deletedRelationships).toBe(1);\n\n // Repository still exists\n const repo = await provider.getRepository(repoId);\n expect(repo).not.toBeNull();\n\n // Vocabulary still exists\n const vocab = await provider.getVocabulary(repoId);\n expect(vocab).toBeDefined();\n\n // Contents are gone\n const stats = await provider.getRepositoryStats(repoId);\n expect(stats.entityCount).toBe(0);\n expect(stats.relationshipCount).toBe(0);\n });\n\n it('returns zero counts on an empty repository', async () => {\n const result = await provider.deleteAllContents(repoId);\n expect(result.deletedEntities).toBe(0);\n expect(result.deletedRelationships).toBe(0);\n });\n });\n\n // ─── Stats after data ───────────────────────────────────\n\n describe('stats reflect data', () => {\n it('counts entities and relationships', async () => {\n await provider.createEntity(repoId, makeEntity('e1', 'alpha'));\n await provider.createEntity(repoId, makeEntity('e2', 'alpha'));\n await provider.createEntity(repoId, makeEntity('e3', 'beta'));\n await provider.createRelationship(repoId, makeRelationship('r1', 'links', 'e1', 'e2'));\n\n const stats = await provider.getRepositoryStats(repoId);\n expect(stats.entityCount).toBe(3);\n expect(stats.relationshipCount).toBe(1);\n expect(stats.entityTypeBreakdown['alpha']).toBe(2);\n expect(stats.entityTypeBreakdown['beta']).toBe(1);\n expect(stats.relationshipTypeBreakdown['links']).toBe(1);\n });\n });\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,oBAAiD;AAMjD,SAAS,iBAA6B;AACpC,QAAM,OAAM,oBAAI,KAAK,GAAE,YAAY;AACnC,SAAO;AAAA,IACL,WAAW;AAAA,IACX,eAAe;AAAA,IACf,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,gBAAgB;AAAA,IAChB,YAAY;AAAA,EACd;AACF;AAEA,SAAS,WAAW,IAAY,OAAO,aAAa,OAA8B;AAChF,SAAO;AAAA,IACL;AAAA,IACA,MAAM,GAAG,IAAI,KAAK,SAAS,IAAI,YAAY,EAAE,QAAQ,eAAe,GAAG,CAAC;AAAA,IACxE,YAAY;AAAA,IACZ,OAAO,SAAS;AAAA,IAChB,SAAS,eAAe,EAAE;AAAA,IAC1B,YAAY,EAAE,KAAK,QAAQ;AAAA,IAC3B,YAAY,eAAe;AAAA,EAC7B;AACF;AAEA,SAAS,iBACP,IACA,MACA,UACA,UACA,gBAAgB,OACI;AACpB,SAAO;AAAA,IACL;AAAA,IACA,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,IAChB,YAAY,CAAC;AAAA,IACb;AAAA,IACA,YAAY,eAAe;AAAA,EAC7B;AACF;AAQO,SAAS,mCACd,SACM;AAEN,QAAM,SAAS;AAEf,MAAI;AAEJ,iBAAe,QAAuB;AACpC,eAAW,MAAM,QAAQ;AACzB,QAAI,SAAS,WAAY,OAAM,SAAS,WAAW;AAEnD,UAAM,SAAS,iBAAiB;AAAA,MAC9B,c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M,SAAS,aAAa,QAAQ,WAAW,MAAM,MAAM,CAAC;AAC5D,cAAM,SAAS,mBAAmB,QAAQ,iBAAiB,MAAM,SAAS,MAAM,IAAI,CAAC;AAErF,cAAM,QAAQ,MAAM,SAAS,mBAAmB,MAAM;AACtD,kCAAO,MAAM,WAAW,EAAE,KAAK,CAAC;AAChC,kCAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC;AACtC,kCAAO,MAAM,oBAAoB,OAAO,CAAC,EAAE,KAAK,CAAC;AACjD,kCAAO,MAAM,oBAAoB,MAAM,CAAC,EAAE,KAAK,CAAC;AAChD,kCAAO,MAAM,0BAA0B,OAAO,CAAC,EAAE,KAAK,CAAC;AAAA,MACzD,CAAC;AAAA,IACH,CAAC;AAAA,EACH,CAAC;AACH;","names":[]}
@@ -1,5 +1,5 @@
1
- import { S as StorageProvider } from '../StorageProvider-CkFjdboX.cjs';
2
- import '../portability-DdlNYXGX.cjs';
1
+ import { S as StorageProvider } from '../StorageProvider-CSbaIY6X.cjs';
2
+ import '../portability-1KBMVBGJ.cjs';
3
3
 
4
4
  /**
5
5
  * Run the full StorageProvider conformance test suite.
@@ -1,5 +1,5 @@
1
- import { S as StorageProvider } from '../StorageProvider-CJjz8uBY.js';
2
- import '../portability-DdlNYXGX.js';
1
+ import { S as StorageProvider } from '../StorageProvider-DqW-zpd0.js';
2
+ import '../portability-1KBMVBGJ.js';
3
3
 
4
4
  /**
5
5
  * Run the full StorageProvider conformance test suite.
@@ -310,6 +310,28 @@ function runStorageProviderConformanceTests(factory) {
310
310
  expect(e).not.toBeNull();
311
311
  });
312
312
  });
313
+ describe("deleteAllContents", () => {
314
+ it("deletes all entities and relationships but preserves the repository", async () => {
315
+ await provider.createEntity(repoId, makeEntity("e1", "alpha"));
316
+ await provider.createEntity(repoId, makeEntity("e2", "beta"));
317
+ await provider.createRelationship(repoId, makeRelationship("r1", "links", "e1", "e2"));
318
+ const result = await provider.deleteAllContents(repoId);
319
+ expect(result.deletedEntities).toBe(2);
320
+ expect(result.deletedRelationships).toBe(1);
321
+ const repo = await provider.getRepository(repoId);
322
+ expect(repo).not.toBeNull();
323
+ const vocab = await provider.getVocabulary(repoId);
324
+ expect(vocab).toBeDefined();
325
+ const stats = await provider.getRepositoryStats(repoId);
326
+ expect(stats.entityCount).toBe(0);
327
+ expect(stats.relationshipCount).toBe(0);
328
+ });
329
+ it("returns zero counts on an empty repository", async () => {
330
+ const result = await provider.deleteAllContents(repoId);
331
+ expect(result.deletedEntities).toBe(0);
332
+ expect(result.deletedRelationships).toBe(0);
333
+ });
334
+ });
313
335
  describe("stats reflect data", () => {
314
336
  it("counts entities and relationships", async () => {
315
337
  await provider.createEntity(repoId, makeEntity("e1", "alpha"));