@utaba/deep-memory 0.17.0 → 0.18.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-DDTLUcuj.d.ts → StorageProvider-B2p_XThQ.d.ts} +1 -1
- package/dist/{StorageProvider-DGH7bVuK.d.cts → StorageProvider-CadKZ85j.d.cts} +1 -1
- package/dist/index.cjs +51 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +51 -37
- package/dist/index.js.map +1 -1
- package/dist/{portability-Dbm6vCdD.d.cts → portability-CAeyzSCx.d.cts} +15 -5
- package/dist/{portability-Dbm6vCdD.d.ts → portability-CAeyzSCx.d.ts} +15 -5
- package/dist/providers/index.d.cts +4 -4
- package/dist/providers/index.d.ts +4 -4
- package/dist/testing/conformance.cjs +2 -2
- 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 +2 -2
- package/dist/testing/conformance.js.map +1 -1
- package/dist/{traversal-1f35drOx.d.cts → traversal-Dql81Wh4.d.ts} +12 -7
- package/dist/{traversal-OkXViSTI.d.ts → traversal-WLcdLN-Z.d.cts} +12 -7
- package/dist/types/index.d.cts +3 -3
- package/dist/types/index.d.ts +3 -3
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { z as GovernanceConfig, O as MemoryVocabulary, ai as ResolvedVocabulary, e as CreateEntityInput, aL as ValidationResult, aI as UpdateEntityInput, f as CreateRelationshipInput, m as EntityTypeDefinition, aO as VocabularyProposal, aP as VocabularyProposalResult, a0 as ProvenanceContext, $ as Provenance, i as Entity, h as DetailLevel, l as EntitySummary, j as EntityBrief, F as FindEntitiesQuery, T as PaginatedResult, D as DeleteEntitiesResult, a2 as ReembedResult, a3 as Relationship, ab as RemoveRelationshipsResult, Y as PropertyFilter, a6 as RelationshipSummary, I as GraphResult, q as ExploreOptions, P as Neighborhood, W as PathOptions, X as PathResult, C as ConceptSearchOptions, aj as ScoredEntity, aF as TimelineOptions, aH as TimelineResult, af as RepositoryStats, aJ as ValidateEntitiesOptions, p as EntityValidationPage, aK as ValidateRelationshipsOptions, aa as RelationshipValidationPage, ac as RepositoryConfig, aB as StoredRepository, ad as RepositoryFilter, ag as RepositorySummary, ah as RepositoryUpdate, v as ExportOptions, r as ExportArchive, K as ImportOptions, L as ImportResult, x as ExportStreamItem, M as ImportStreamHeader, J as ImportChunk, ay as StoredEntity, au as StorageRepositoryConfig, aC as StoredRepositorySummary, g as DeleteProgressCallback, U as PaginationOptions, aM as VocabularyChangeRecord, az as StoredEntityUpdate, an as StorageFindQuery, aA as StoredRelationship, a5 as RelationshipQueryOptions, am as StorageExploreOptions, ao as StorageNeighborhood, as as StoragePathOptions, at as StoragePathResult, aw as StorageTimelineOptions, ax as StorageTimelineResult, s as ExportChunk, B as BulkImportOptions, d as BulkImportResult, al as SearchOptions, ak as SearchHit } from './portability-
|
|
2
|
-
export { A as AdaptiveConcurrencyAdjustEvent, a as AdaptiveConcurrencyAdjustReason, b as AdaptiveConcurrencyHandle, c as AdaptiveConcurrencyOptions, E as EnrichedRelationship, k as EntityMap, n as EntityTypeInput, o as EntityValidationIssue, t as ExportLegalMetadata, u as ExportManifest, w as ExportPipelineMetadata, G as GetEntitiesOptions, y as GetEntityOptions, H as GovernanceMode, N as ImportWarning, Q as NeighborhoodCenter, R as NeighborhoodGroup, S as NeighborhoodLayer, V as Path, Z as PropertySchema, _ as PropertyType, a1 as ProvenanceFilter, a4 as RelationshipDirection, a7 as RelationshipTypeDefinition, a8 as RelationshipTypeInput, a9 as RelationshipValidationIssue, ae as RepositoryMetadata, ap as StorageNeighborhoodGroup, aq as StorageNeighborhoodLayer, ar as StoragePath, av as StorageTimelineEvent, aD as TimelineEntityRef, aE as TimelineEvent, aG as TimelineRelationshipDetail, aN as VocabularyInput } from './portability-
|
|
1
|
+
import { z as GovernanceConfig, O as MemoryVocabulary, ai as ResolvedVocabulary, e as CreateEntityInput, aL as ValidationResult, aI as UpdateEntityInput, f as CreateRelationshipInput, m as EntityTypeDefinition, aO as VocabularyProposal, aP as VocabularyProposalResult, a0 as ProvenanceContext, $ as Provenance, i as Entity, h as DetailLevel, l as EntitySummary, j as EntityBrief, F as FindEntitiesQuery, T as PaginatedResult, D as DeleteEntitiesResult, a2 as ReembedResult, a3 as Relationship, ab as RemoveRelationshipsResult, Y as PropertyFilter, a6 as RelationshipSummary, I as GraphResult, q as ExploreOptions, P as Neighborhood, W as PathOptions, X as PathResult, C as ConceptSearchOptions, aj as ScoredEntity, aF as TimelineOptions, aH as TimelineResult, af as RepositoryStats, aJ as ValidateEntitiesOptions, p as EntityValidationPage, aK as ValidateRelationshipsOptions, aa as RelationshipValidationPage, ac as RepositoryConfig, aB as StoredRepository, ad as RepositoryFilter, ag as RepositorySummary, ah as RepositoryUpdate, v as ExportOptions, r as ExportArchive, K as ImportOptions, L as ImportResult, x as ExportStreamItem, M as ImportStreamHeader, J as ImportChunk, ay as StoredEntity, au as StorageRepositoryConfig, aC as StoredRepositorySummary, g as DeleteProgressCallback, U as PaginationOptions, aM as VocabularyChangeRecord, az as StoredEntityUpdate, an as StorageFindQuery, aA as StoredRelationship, a5 as RelationshipQueryOptions, am as StorageExploreOptions, ao as StorageNeighborhood, as as StoragePathOptions, at as StoragePathResult, aw as StorageTimelineOptions, ax as StorageTimelineResult, s as ExportChunk, B as BulkImportOptions, d as BulkImportResult, al as SearchOptions, ak as SearchHit } from './portability-CAeyzSCx.cjs';
|
|
2
|
+
export { A as AdaptiveConcurrencyAdjustEvent, a as AdaptiveConcurrencyAdjustReason, b as AdaptiveConcurrencyHandle, c as AdaptiveConcurrencyOptions, E as EnrichedRelationship, k as EntityMap, n as EntityTypeInput, o as EntityValidationIssue, t as ExportLegalMetadata, u as ExportManifest, w as ExportPipelineMetadata, G as GetEntitiesOptions, y as GetEntityOptions, H as GovernanceMode, N as ImportWarning, Q as NeighborhoodCenter, R as NeighborhoodGroup, S as NeighborhoodLayer, V as Path, Z as PropertySchema, _ as PropertyType, a1 as ProvenanceFilter, a4 as RelationshipDirection, a7 as RelationshipTypeDefinition, a8 as RelationshipTypeInput, a9 as RelationshipValidationIssue, ae as RepositoryMetadata, ap as StorageNeighborhoodGroup, aq as StorageNeighborhoodLayer, ar as StoragePath, av as StorageTimelineEvent, aD as TimelineEntityRef, aE as TimelineEvent, aG as TimelineRelationshipDetail, aN as VocabularyInput } from './portability-CAeyzSCx.cjs';
|
|
3
3
|
import { DeepMemoryEventType, EventHandler, Unsubscribe, DeepMemoryEvent, HookResult, EventPayload, UsageSink } from './types/index.cjs';
|
|
4
4
|
export { OperationUsage } from './types/index.cjs';
|
|
5
|
-
import { f as TraversalSpec, d as TraversalResult } from './traversal-
|
|
6
|
-
export { Q as QueryMetadata, T as TraversalAggregation, a as TraversalPath, b as TraversalProjection, c as TraversalRelationship, e as TraversalReturnMode, g as TraversalStart, h as TraversalStep } from './traversal-
|
|
7
|
-
import { S as StorageProvider, E as EnsureSchemaResult, a as EntityReadOptions } from './StorageProvider-
|
|
5
|
+
import { f as TraversalSpec, d as TraversalResult } from './traversal-WLcdLN-Z.cjs';
|
|
6
|
+
export { Q as QueryMetadata, T as TraversalAggregation, a as TraversalPath, b as TraversalProjection, c as TraversalRelationship, e as TraversalReturnMode, g as TraversalStart, h as TraversalStep } from './traversal-WLcdLN-Z.cjs';
|
|
7
|
+
import { S as StorageProvider, E as EnsureSchemaResult, a as EntityReadOptions } from './StorageProvider-CadKZ85j.cjs';
|
|
8
8
|
import { EmbeddingProvider, SearchProvider, EmbeddingProviderFactory, GraphTraversalProvider, LockProvider, SearchableEntity } from './providers/index.cjs';
|
|
9
9
|
export { GraphTraversalCapabilities, LockHandle, LockOptions } from './providers/index.cjs';
|
|
10
10
|
|
|
@@ -366,7 +366,7 @@ declare class MemoryRepository {
|
|
|
366
366
|
removeRelationships(ids: string[]): Promise<RemoveRelationshipsResult>;
|
|
367
367
|
getRelationships(entityId: string, options?: {
|
|
368
368
|
relationshipTypes?: string[];
|
|
369
|
-
direction?: '
|
|
369
|
+
direction?: 'out' | 'in' | 'both';
|
|
370
370
|
limit?: number;
|
|
371
371
|
offset?: number;
|
|
372
372
|
propertyFilters?: PropertyFilter[];
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { z as GovernanceConfig, O as MemoryVocabulary, ai as ResolvedVocabulary, e as CreateEntityInput, aL as ValidationResult, aI as UpdateEntityInput, f as CreateRelationshipInput, m as EntityTypeDefinition, aO as VocabularyProposal, aP as VocabularyProposalResult, a0 as ProvenanceContext, $ as Provenance, i as Entity, h as DetailLevel, l as EntitySummary, j as EntityBrief, F as FindEntitiesQuery, T as PaginatedResult, D as DeleteEntitiesResult, a2 as ReembedResult, a3 as Relationship, ab as RemoveRelationshipsResult, Y as PropertyFilter, a6 as RelationshipSummary, I as GraphResult, q as ExploreOptions, P as Neighborhood, W as PathOptions, X as PathResult, C as ConceptSearchOptions, aj as ScoredEntity, aF as TimelineOptions, aH as TimelineResult, af as RepositoryStats, aJ as ValidateEntitiesOptions, p as EntityValidationPage, aK as ValidateRelationshipsOptions, aa as RelationshipValidationPage, ac as RepositoryConfig, aB as StoredRepository, ad as RepositoryFilter, ag as RepositorySummary, ah as RepositoryUpdate, v as ExportOptions, r as ExportArchive, K as ImportOptions, L as ImportResult, x as ExportStreamItem, M as ImportStreamHeader, J as ImportChunk, ay as StoredEntity, au as StorageRepositoryConfig, aC as StoredRepositorySummary, g as DeleteProgressCallback, U as PaginationOptions, aM as VocabularyChangeRecord, az as StoredEntityUpdate, an as StorageFindQuery, aA as StoredRelationship, a5 as RelationshipQueryOptions, am as StorageExploreOptions, ao as StorageNeighborhood, as as StoragePathOptions, at as StoragePathResult, aw as StorageTimelineOptions, ax as StorageTimelineResult, s as ExportChunk, B as BulkImportOptions, d as BulkImportResult, al as SearchOptions, ak as SearchHit } from './portability-
|
|
2
|
-
export { A as AdaptiveConcurrencyAdjustEvent, a as AdaptiveConcurrencyAdjustReason, b as AdaptiveConcurrencyHandle, c as AdaptiveConcurrencyOptions, E as EnrichedRelationship, k as EntityMap, n as EntityTypeInput, o as EntityValidationIssue, t as ExportLegalMetadata, u as ExportManifest, w as ExportPipelineMetadata, G as GetEntitiesOptions, y as GetEntityOptions, H as GovernanceMode, N as ImportWarning, Q as NeighborhoodCenter, R as NeighborhoodGroup, S as NeighborhoodLayer, V as Path, Z as PropertySchema, _ as PropertyType, a1 as ProvenanceFilter, a4 as RelationshipDirection, a7 as RelationshipTypeDefinition, a8 as RelationshipTypeInput, a9 as RelationshipValidationIssue, ae as RepositoryMetadata, ap as StorageNeighborhoodGroup, aq as StorageNeighborhoodLayer, ar as StoragePath, av as StorageTimelineEvent, aD as TimelineEntityRef, aE as TimelineEvent, aG as TimelineRelationshipDetail, aN as VocabularyInput } from './portability-
|
|
1
|
+
import { z as GovernanceConfig, O as MemoryVocabulary, ai as ResolvedVocabulary, e as CreateEntityInput, aL as ValidationResult, aI as UpdateEntityInput, f as CreateRelationshipInput, m as EntityTypeDefinition, aO as VocabularyProposal, aP as VocabularyProposalResult, a0 as ProvenanceContext, $ as Provenance, i as Entity, h as DetailLevel, l as EntitySummary, j as EntityBrief, F as FindEntitiesQuery, T as PaginatedResult, D as DeleteEntitiesResult, a2 as ReembedResult, a3 as Relationship, ab as RemoveRelationshipsResult, Y as PropertyFilter, a6 as RelationshipSummary, I as GraphResult, q as ExploreOptions, P as Neighborhood, W as PathOptions, X as PathResult, C as ConceptSearchOptions, aj as ScoredEntity, aF as TimelineOptions, aH as TimelineResult, af as RepositoryStats, aJ as ValidateEntitiesOptions, p as EntityValidationPage, aK as ValidateRelationshipsOptions, aa as RelationshipValidationPage, ac as RepositoryConfig, aB as StoredRepository, ad as RepositoryFilter, ag as RepositorySummary, ah as RepositoryUpdate, v as ExportOptions, r as ExportArchive, K as ImportOptions, L as ImportResult, x as ExportStreamItem, M as ImportStreamHeader, J as ImportChunk, ay as StoredEntity, au as StorageRepositoryConfig, aC as StoredRepositorySummary, g as DeleteProgressCallback, U as PaginationOptions, aM as VocabularyChangeRecord, az as StoredEntityUpdate, an as StorageFindQuery, aA as StoredRelationship, a5 as RelationshipQueryOptions, am as StorageExploreOptions, ao as StorageNeighborhood, as as StoragePathOptions, at as StoragePathResult, aw as StorageTimelineOptions, ax as StorageTimelineResult, s as ExportChunk, B as BulkImportOptions, d as BulkImportResult, al as SearchOptions, ak as SearchHit } from './portability-CAeyzSCx.js';
|
|
2
|
+
export { A as AdaptiveConcurrencyAdjustEvent, a as AdaptiveConcurrencyAdjustReason, b as AdaptiveConcurrencyHandle, c as AdaptiveConcurrencyOptions, E as EnrichedRelationship, k as EntityMap, n as EntityTypeInput, o as EntityValidationIssue, t as ExportLegalMetadata, u as ExportManifest, w as ExportPipelineMetadata, G as GetEntitiesOptions, y as GetEntityOptions, H as GovernanceMode, N as ImportWarning, Q as NeighborhoodCenter, R as NeighborhoodGroup, S as NeighborhoodLayer, V as Path, Z as PropertySchema, _ as PropertyType, a1 as ProvenanceFilter, a4 as RelationshipDirection, a7 as RelationshipTypeDefinition, a8 as RelationshipTypeInput, a9 as RelationshipValidationIssue, ae as RepositoryMetadata, ap as StorageNeighborhoodGroup, aq as StorageNeighborhoodLayer, ar as StoragePath, av as StorageTimelineEvent, aD as TimelineEntityRef, aE as TimelineEvent, aG as TimelineRelationshipDetail, aN as VocabularyInput } from './portability-CAeyzSCx.js';
|
|
3
3
|
import { DeepMemoryEventType, EventHandler, Unsubscribe, DeepMemoryEvent, HookResult, EventPayload, UsageSink } from './types/index.js';
|
|
4
4
|
export { OperationUsage } from './types/index.js';
|
|
5
|
-
import { f as TraversalSpec, d as TraversalResult } from './traversal-
|
|
6
|
-
export { Q as QueryMetadata, T as TraversalAggregation, a as TraversalPath, b as TraversalProjection, c as TraversalRelationship, e as TraversalReturnMode, g as TraversalStart, h as TraversalStep } from './traversal-
|
|
7
|
-
import { S as StorageProvider, E as EnsureSchemaResult, a as EntityReadOptions } from './StorageProvider-
|
|
5
|
+
import { f as TraversalSpec, d as TraversalResult } from './traversal-Dql81Wh4.js';
|
|
6
|
+
export { Q as QueryMetadata, T as TraversalAggregation, a as TraversalPath, b as TraversalProjection, c as TraversalRelationship, e as TraversalReturnMode, g as TraversalStart, h as TraversalStep } from './traversal-Dql81Wh4.js';
|
|
7
|
+
import { S as StorageProvider, E as EnsureSchemaResult, a as EntityReadOptions } from './StorageProvider-B2p_XThQ.js';
|
|
8
8
|
import { EmbeddingProvider, SearchProvider, EmbeddingProviderFactory, GraphTraversalProvider, LockProvider, SearchableEntity } from './providers/index.js';
|
|
9
9
|
export { GraphTraversalCapabilities, LockHandle, LockOptions } from './providers/index.js';
|
|
10
10
|
|
|
@@ -366,7 +366,7 @@ declare class MemoryRepository {
|
|
|
366
366
|
removeRelationships(ids: string[]): Promise<RemoveRelationshipsResult>;
|
|
367
367
|
getRelationships(entityId: string, options?: {
|
|
368
368
|
relationshipTypes?: string[];
|
|
369
|
-
direction?: '
|
|
369
|
+
direction?: 'out' | 'in' | 'both';
|
|
370
370
|
limit?: number;
|
|
371
371
|
offset?: number;
|
|
372
372
|
propertyFilters?: PropertyFilter[];
|
package/dist/index.js
CHANGED
|
@@ -1372,13 +1372,36 @@ async function executeFallbackTraversal(repositoryId, storage, spec) {
|
|
|
1372
1372
|
unionFullLength = unionElements.length;
|
|
1373
1373
|
const pageSlice = unionElements.slice(offset, offset + limit);
|
|
1374
1374
|
const pageEntries = [];
|
|
1375
|
+
const pageEntityIds = /* @__PURE__ */ new Set();
|
|
1375
1376
|
for (const element of pageSlice) {
|
|
1376
1377
|
if (element.kind === "entity") {
|
|
1377
|
-
|
|
1378
|
+
if (!pageEntityIds.has(element.entry.entity.id)) {
|
|
1379
|
+
pageEntityIds.add(element.entry.entity.id);
|
|
1380
|
+
pageEntries.push(element.entry);
|
|
1381
|
+
}
|
|
1378
1382
|
} else {
|
|
1379
1383
|
pagedAllRels.push(element.rel);
|
|
1380
1384
|
}
|
|
1381
1385
|
}
|
|
1386
|
+
if (pagedAllRels.length > 0) {
|
|
1387
|
+
const entityIndex = /* @__PURE__ */ new Map();
|
|
1388
|
+
for (const el of unionElements) {
|
|
1389
|
+
if (el.kind === "entity" && !entityIndex.has(el.entry.entity.id)) {
|
|
1390
|
+
entityIndex.set(el.entry.entity.id, el.entry);
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
for (const rel of pagedAllRels) {
|
|
1394
|
+
for (const endpointId of [rel.sourceEntityId, rel.targetEntityId]) {
|
|
1395
|
+
if (!pageEntityIds.has(endpointId)) {
|
|
1396
|
+
const entry = entityIndex.get(endpointId);
|
|
1397
|
+
if (entry) {
|
|
1398
|
+
pageEntityIds.add(endpointId);
|
|
1399
|
+
pageEntries.push(entry);
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1382
1405
|
paged = pageEntries;
|
|
1383
1406
|
total = pageEntries.length + pagedAllRels.length;
|
|
1384
1407
|
} else {
|
|
@@ -1406,13 +1429,13 @@ async function executeFallbackTraversal(repositoryId, storage, spec) {
|
|
|
1406
1429
|
direction: "both",
|
|
1407
1430
|
limit: 1e4
|
|
1408
1431
|
});
|
|
1409
|
-
const summary = {
|
|
1432
|
+
const summary = { out: {}, in: {} };
|
|
1410
1433
|
for (const rel of result.items) {
|
|
1411
1434
|
if (rel.sourceEntityId === entry.entity.id) {
|
|
1412
|
-
summary.
|
|
1435
|
+
summary.out[rel.relationshipType] = (summary.out[rel.relationshipType] ?? 0) + 1;
|
|
1413
1436
|
}
|
|
1414
1437
|
if (rel.targetEntityId === entry.entity.id) {
|
|
1415
|
-
summary.
|
|
1438
|
+
summary.in[rel.relationshipType] = (summary.in[rel.relationshipType] ?? 0) + 1;
|
|
1416
1439
|
}
|
|
1417
1440
|
}
|
|
1418
1441
|
return summary;
|
|
@@ -1475,7 +1498,7 @@ async function executeFallbackTraversal(repositoryId, storage, spec) {
|
|
|
1475
1498
|
type: rel.relationshipType,
|
|
1476
1499
|
sourceEntityId: rel.sourceEntityId,
|
|
1477
1500
|
targetEntityId: rel.targetEntityId,
|
|
1478
|
-
direction: "
|
|
1501
|
+
direction: "out",
|
|
1479
1502
|
properties: rel.properties
|
|
1480
1503
|
}));
|
|
1481
1504
|
} else if (!suppressEntities && spec.returnMode === "path") {
|
|
@@ -1490,7 +1513,7 @@ async function executeFallbackTraversal(repositoryId, storage, spec) {
|
|
|
1490
1513
|
type: rel.relationshipType,
|
|
1491
1514
|
sourceEntityId: rel.sourceEntityId,
|
|
1492
1515
|
targetEntityId: rel.targetEntityId,
|
|
1493
|
-
direction: fromId === rel.sourceEntityId ? "
|
|
1516
|
+
direction: fromId === rel.sourceEntityId ? "out" : "in",
|
|
1494
1517
|
properties: rel.properties
|
|
1495
1518
|
});
|
|
1496
1519
|
}
|
|
@@ -1529,7 +1552,7 @@ async function executeFallbackTraversal(repositoryId, storage, spec) {
|
|
|
1529
1552
|
type: rel.relationshipType,
|
|
1530
1553
|
sourceEntityId: rel.sourceEntityId,
|
|
1531
1554
|
targetEntityId: rel.targetEntityId,
|
|
1532
|
-
direction: fromId === rel.sourceEntityId ? "
|
|
1555
|
+
direction: fromId === rel.sourceEntityId ? "out" : "in",
|
|
1533
1556
|
properties: rel.properties
|
|
1534
1557
|
};
|
|
1535
1558
|
})
|
|
@@ -1558,7 +1581,7 @@ async function executeFallbackTraversal(repositoryId, storage, spec) {
|
|
|
1558
1581
|
};
|
|
1559
1582
|
}
|
|
1560
1583
|
async function executeSingleStep(repositoryId, storage, frontier, step, onStorageCall) {
|
|
1561
|
-
const direction =
|
|
1584
|
+
const direction = step.direction;
|
|
1562
1585
|
const pendingEdges = [];
|
|
1563
1586
|
for (const entry of frontier) {
|
|
1564
1587
|
const rels = await storage.getEntityRelationships(repositoryId, entry.entity.id, {
|
|
@@ -1653,16 +1676,6 @@ async function resolveEntity(repositoryId, storage, idOrSlug) {
|
|
|
1653
1676
|
if (byId) return byId;
|
|
1654
1677
|
return storage.getEntityBySlug(repositoryId, idOrSlug);
|
|
1655
1678
|
}
|
|
1656
|
-
function mapDirection(direction) {
|
|
1657
|
-
switch (direction) {
|
|
1658
|
-
case "out":
|
|
1659
|
-
return "outbound";
|
|
1660
|
-
case "in":
|
|
1661
|
-
return "inbound";
|
|
1662
|
-
case "both":
|
|
1663
|
-
return "both";
|
|
1664
|
-
}
|
|
1665
|
-
}
|
|
1666
1679
|
function getTargetId(rel, currentEntityId) {
|
|
1667
1680
|
if (rel.sourceEntityId === currentEntityId) {
|
|
1668
1681
|
return rel.targetEntityId;
|
|
@@ -1705,6 +1718,12 @@ function buildAllModeUnion(entries) {
|
|
|
1705
1718
|
}
|
|
1706
1719
|
for (let depth = 1; depth <= maxDepth; depth++) {
|
|
1707
1720
|
const bucket = byDepth.get(depth) ?? [];
|
|
1721
|
+
for (const entry of bucket) {
|
|
1722
|
+
if (!seenEntities.has(entry.entity.id)) {
|
|
1723
|
+
seenEntities.add(entry.entity.id);
|
|
1724
|
+
result.push({ kind: "entity", entry });
|
|
1725
|
+
}
|
|
1726
|
+
}
|
|
1708
1727
|
for (const entry of bucket) {
|
|
1709
1728
|
const newRel = entry.relationshipPath[depth - 1];
|
|
1710
1729
|
if (newRel && !seenRels.has(newRel.id)) {
|
|
@@ -1712,12 +1731,6 @@ function buildAllModeUnion(entries) {
|
|
|
1712
1731
|
result.push({ kind: "relationship", rel: newRel });
|
|
1713
1732
|
}
|
|
1714
1733
|
}
|
|
1715
|
-
for (const entry of bucket) {
|
|
1716
|
-
if (!seenEntities.has(entry.entity.id)) {
|
|
1717
|
-
seenEntities.add(entry.entity.id);
|
|
1718
|
-
result.push({ kind: "entity", entry });
|
|
1719
|
-
}
|
|
1720
|
-
}
|
|
1721
1734
|
}
|
|
1722
1735
|
return result;
|
|
1723
1736
|
}
|
|
@@ -1857,7 +1870,7 @@ var GraphTraversal = class {
|
|
|
1857
1870
|
return {
|
|
1858
1871
|
id: rid,
|
|
1859
1872
|
type: r?.type ?? "unknown",
|
|
1860
|
-
direction: r?.sourceEntityId === currentEntityId ? "
|
|
1873
|
+
direction: r?.sourceEntityId === currentEntityId ? "out" : "in",
|
|
1861
1874
|
properties: r?.properties ?? {}
|
|
1862
1875
|
};
|
|
1863
1876
|
})
|
|
@@ -2484,7 +2497,7 @@ var MemoryRepository = class {
|
|
|
2484
2497
|
inbound[rel.relationshipType] = (inbound[rel.relationshipType] ?? 0) + 1;
|
|
2485
2498
|
}
|
|
2486
2499
|
}
|
|
2487
|
-
return { outbound, inbound };
|
|
2500
|
+
return { out: outbound, in: inbound };
|
|
2488
2501
|
}
|
|
2489
2502
|
async getRelationshipsForEntities(entityIds) {
|
|
2490
2503
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -2692,9 +2705,10 @@ var MemoryRepository = class {
|
|
|
2692
2705
|
### Step 1 \u2014 Discover before you traverse
|
|
2693
2706
|
|
|
2694
2707
|
Before following relationships from an entity, check that it actually has relationships.
|
|
2695
|
-
Graph queries include \`relationshipSummary\` on every returned entity by default
|
|
2696
|
-
(
|
|
2697
|
-
zero
|
|
2708
|
+
Graph queries include \`relationshipSummary\` on every returned entity by default \u2014
|
|
2709
|
+
\`out\` (entity is source) and \`in\` (entity is target) counts by relationship type.
|
|
2710
|
+
Inspect this before traversing: entities with zero counts for the relationship type
|
|
2711
|
+
you need have no connections to follow.
|
|
2698
2712
|
To skip summaries and reduce response size, set \`includeRelationshipSummary: false\`.
|
|
2699
2713
|
|
|
2700
2714
|
### Step 2 \u2014 Use projection for aggregation
|
|
@@ -3577,7 +3591,7 @@ var EventBus = class {
|
|
|
3577
3591
|
};
|
|
3578
3592
|
|
|
3579
3593
|
// src/portability/RepositoryExporter.ts
|
|
3580
|
-
var LIBRARY_VERSION = true ? "0.
|
|
3594
|
+
var LIBRARY_VERSION = true ? "0.18.0" : "0.1.0";
|
|
3581
3595
|
var RepositoryExporter = class {
|
|
3582
3596
|
storage;
|
|
3583
3597
|
provenance;
|
|
@@ -4855,8 +4869,8 @@ var GremlinCompiler = class {
|
|
|
4855
4869
|
const branches = [`__.identity().${VERTEX_PROJECT_EXPR}`];
|
|
4856
4870
|
let prefix = "";
|
|
4857
4871
|
for (const { edge, vertex, entityFilters } of compiledSteps) {
|
|
4858
|
-
branches.push(`__${prefix}${edge}.${EDGE_PROJECT_EXPR}`);
|
|
4859
4872
|
branches.push(`__${prefix}${edge}${vertex}${entityFilters}.${VERTEX_PROJECT_EXPR}`);
|
|
4873
|
+
branches.push(`__${prefix}${edge}.${EDGE_PROJECT_EXPR}`);
|
|
4860
4874
|
prefix = `${prefix}${edge}${vertex}`;
|
|
4861
4875
|
estimatedFanOut *= DEFAULT_ESTIMATED_FANOUT_PER_HOP;
|
|
4862
4876
|
}
|
|
@@ -5451,9 +5465,9 @@ var InMemoryStorageProvider = class {
|
|
|
5451
5465
|
const isTarget = rel.targetEntityId === entityId;
|
|
5452
5466
|
const isBidirectionalTarget = rel.bidirectional && isTarget;
|
|
5453
5467
|
switch (direction) {
|
|
5454
|
-
case "
|
|
5468
|
+
case "out":
|
|
5455
5469
|
return isSource || isBidirectionalTarget;
|
|
5456
|
-
case "
|
|
5470
|
+
case "in":
|
|
5457
5471
|
return isTarget || rel.bidirectional && isSource;
|
|
5458
5472
|
case "both":
|
|
5459
5473
|
default:
|
|
@@ -5551,17 +5565,17 @@ var InMemoryStorageProvider = class {
|
|
|
5551
5565
|
const isTarget = rel.targetEntityId === frontierEntityId;
|
|
5552
5566
|
let matchesDirection = false;
|
|
5553
5567
|
let connectedEntityId;
|
|
5554
|
-
if (isSource && (options.direction === "
|
|
5568
|
+
if (isSource && (options.direction === "out" || options.direction === "both")) {
|
|
5555
5569
|
matchesDirection = true;
|
|
5556
5570
|
connectedEntityId = rel.targetEntityId;
|
|
5557
|
-
} else if (isTarget && (options.direction === "
|
|
5571
|
+
} else if (isTarget && (options.direction === "in" || options.direction === "both")) {
|
|
5558
5572
|
matchesDirection = true;
|
|
5559
5573
|
connectedEntityId = rel.sourceEntityId;
|
|
5560
5574
|
} else if (rel.bidirectional) {
|
|
5561
|
-
if (isSource && options.direction === "
|
|
5575
|
+
if (isSource && options.direction === "in") {
|
|
5562
5576
|
matchesDirection = true;
|
|
5563
5577
|
connectedEntityId = rel.targetEntityId;
|
|
5564
|
-
} else if (isTarget && options.direction === "
|
|
5578
|
+
} else if (isTarget && options.direction === "out") {
|
|
5565
5579
|
matchesDirection = true;
|
|
5566
5580
|
connectedEntityId = rel.sourceEntityId;
|
|
5567
5581
|
}
|