@utaba/deep-memory 0.9.0 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +11 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2553,7 +2553,7 @@ var MemoryRepository = class {
|
|
|
2553
2553
|
### Step 1 \u2014 Discover before you traverse
|
|
2554
2554
|
|
|
2555
2555
|
Before following relationships from an entity, check that it actually has relationships.
|
|
2556
|
-
|
|
2556
|
+
Graph queries include \`relationshipSummary\` on every returned entity by default
|
|
2557
2557
|
(outbound and inbound counts by type). Inspect this before traversing \u2014 entities with
|
|
2558
2558
|
zero outbound counts for the relationship type you need have no connections to follow.
|
|
2559
2559
|
To skip summaries and reduce response size, set \`includeRelationshipSummary: false\`.
|
|
@@ -2561,7 +2561,7 @@ To skip summaries and reduce response size, set \`includeRelationshipSummary: fa
|
|
|
2561
2561
|
### Step 2 \u2014 Use projection for aggregation
|
|
2562
2562
|
|
|
2563
2563
|
To understand what data exists (e.g. all distinct values of a property, or counts by
|
|
2564
|
-
category), use
|
|
2564
|
+
category), use a graph query with \`projection\` instead of fetching full entities:
|
|
2565
2565
|
\`{ start: { entityType: "..." }, projection: { properties: ["propName"], distinct: true }, limit: 200 }\`
|
|
2566
2566
|
|
|
2567
2567
|
This returns only the aggregated values \u2014 no entity objects \u2014 keeping responses lightweight.
|
|
@@ -2570,23 +2570,23 @@ This returns only the aggregated values \u2014 no entity objects \u2014 keeping
|
|
|
2570
2570
|
|
|
2571
2571
|
- **Omit relationshipTypes** in a traversal step to follow all relationship types at once,
|
|
2572
2572
|
rather than making separate calls per type.
|
|
2573
|
-
- **Use multi-step traversals** for multi-hop patterns. A two-step
|
|
2573
|
+
- **Use multi-step traversals** for multi-hop patterns. A two-step traverse operation
|
|
2574
2574
|
(e.g. Equipment \u2192 Component \u2192 MaintenanceProcedure) is one call, not two sequential calls.
|
|
2575
2575
|
- **Use returnMode "all"** when you need intermediate entities along the path, not just
|
|
2576
2576
|
the terminal nodes.
|
|
2577
2577
|
|
|
2578
2578
|
### Step 4 \u2014 Use semantic search for known-unknowns
|
|
2579
2579
|
|
|
2580
|
-
|
|
2580
|
+
Semantic/concept search is best for finding specific entities when you know roughly
|
|
2581
2581
|
what you're looking for but not the exact label or type. It is not efficient for broad
|
|
2582
|
-
discovery \u2014 use projection or
|
|
2582
|
+
discovery \u2014 use projection or entity finding for that.
|
|
2583
2583
|
|
|
2584
2584
|
### Common anti-patterns to avoid
|
|
2585
2585
|
|
|
2586
2586
|
- **Don't traverse from entities with zero relationship counts.** The \`relationshipSummary\` on each entity tells you what is connected before you traverse.
|
|
2587
|
-
- **Don't split queries by relationship type.** One step with no type filter is better
|
|
2587
|
+
- **Don't split queries by relationship type.** One traverse step with no type filter is better
|
|
2588
2588
|
than three separate single-type calls.
|
|
2589
|
-
- **Don't use sequential single-hop traversals** when a multi-step
|
|
2589
|
+
- **Don't use sequential single-hop traversals** when a multi-step traverse operation achieves the
|
|
2590
2590
|
same result in one call.
|
|
2591
2591
|
- **Don't fetch full entities when you only need property values.** Use projection.`;
|
|
2592
2592
|
}
|
|
@@ -3431,7 +3431,7 @@ var EventBus = class {
|
|
|
3431
3431
|
};
|
|
3432
3432
|
|
|
3433
3433
|
// src/portability/RepositoryExporter.ts
|
|
3434
|
-
var LIBRARY_VERSION = true ? "0.9.
|
|
3434
|
+
var LIBRARY_VERSION = true ? "0.9.2" : "0.1.0";
|
|
3435
3435
|
var RepositoryExporter = class {
|
|
3436
3436
|
storage;
|
|
3437
3437
|
provenance;
|
|
@@ -5225,9 +5225,11 @@ var InMemoryStorageProvider = class {
|
|
|
5225
5225
|
group.relationships.push(rel);
|
|
5226
5226
|
}
|
|
5227
5227
|
nextFrontier.add(connectedEntityId);
|
|
5228
|
-
visited.add(connectedEntityId);
|
|
5229
5228
|
}
|
|
5230
5229
|
}
|
|
5230
|
+
for (const id of nextFrontier) {
|
|
5231
|
+
visited.add(id);
|
|
5232
|
+
}
|
|
5231
5233
|
layers.push(layer);
|
|
5232
5234
|
currentFrontier = nextFrontier;
|
|
5233
5235
|
if (nextFrontier.size === 0) break;
|