@utaba/deep-memory 0.8.1 → 0.9.1
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 +21 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -2
- package/dist/index.d.ts +14 -2
- package/dist/index.js +20 -8
- package/dist/index.js.map +1 -1
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.cts +54 -1
- package/dist/types/index.d.ts +54 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -49,6 +49,7 @@ __export(src_exports, {
|
|
|
49
49
|
TraversalValidationError: () => TraversalValidationError,
|
|
50
50
|
TraversalVocabularyError: () => TraversalVocabularyError,
|
|
51
51
|
VocabularyValidationError: () => VocabularyValidationError,
|
|
52
|
+
createSafeSink: () => createSafeSink,
|
|
52
53
|
generateId: () => generateId,
|
|
53
54
|
isValidUuid: () => isValidUuid,
|
|
54
55
|
matchesPropertyFilters: () => matchesPropertyFilters,
|
|
@@ -2611,7 +2612,7 @@ var MemoryRepository = class {
|
|
|
2611
2612
|
### Step 1 \u2014 Discover before you traverse
|
|
2612
2613
|
|
|
2613
2614
|
Before following relationships from an entity, check that it actually has relationships.
|
|
2614
|
-
|
|
2615
|
+
Graph queries include \`relationshipSummary\` on every returned entity by default
|
|
2615
2616
|
(outbound and inbound counts by type). Inspect this before traversing \u2014 entities with
|
|
2616
2617
|
zero outbound counts for the relationship type you need have no connections to follow.
|
|
2617
2618
|
To skip summaries and reduce response size, set \`includeRelationshipSummary: false\`.
|
|
@@ -2619,7 +2620,7 @@ To skip summaries and reduce response size, set \`includeRelationshipSummary: fa
|
|
|
2619
2620
|
### Step 2 \u2014 Use projection for aggregation
|
|
2620
2621
|
|
|
2621
2622
|
To understand what data exists (e.g. all distinct values of a property, or counts by
|
|
2622
|
-
category), use
|
|
2623
|
+
category), use a graph query with \`projection\` instead of fetching full entities:
|
|
2623
2624
|
\`{ start: { entityType: "..." }, projection: { properties: ["propName"], distinct: true }, limit: 200 }\`
|
|
2624
2625
|
|
|
2625
2626
|
This returns only the aggregated values \u2014 no entity objects \u2014 keeping responses lightweight.
|
|
@@ -2628,23 +2629,23 @@ This returns only the aggregated values \u2014 no entity objects \u2014 keeping
|
|
|
2628
2629
|
|
|
2629
2630
|
- **Omit relationshipTypes** in a traversal step to follow all relationship types at once,
|
|
2630
2631
|
rather than making separate calls per type.
|
|
2631
|
-
- **Use multi-step traversals** for multi-hop patterns. A two-step
|
|
2632
|
+
- **Use multi-step traversals** for multi-hop patterns. A two-step traverse operation
|
|
2632
2633
|
(e.g. Equipment \u2192 Component \u2192 MaintenanceProcedure) is one call, not two sequential calls.
|
|
2633
2634
|
- **Use returnMode "all"** when you need intermediate entities along the path, not just
|
|
2634
2635
|
the terminal nodes.
|
|
2635
2636
|
|
|
2636
2637
|
### Step 4 \u2014 Use semantic search for known-unknowns
|
|
2637
2638
|
|
|
2638
|
-
|
|
2639
|
+
Semantic/concept search is best for finding specific entities when you know roughly
|
|
2639
2640
|
what you're looking for but not the exact label or type. It is not efficient for broad
|
|
2640
|
-
discovery \u2014 use projection or
|
|
2641
|
+
discovery \u2014 use projection or entity finding for that.
|
|
2641
2642
|
|
|
2642
2643
|
### Common anti-patterns to avoid
|
|
2643
2644
|
|
|
2644
2645
|
- **Don't traverse from entities with zero relationship counts.** The \`relationshipSummary\` on each entity tells you what is connected before you traverse.
|
|
2645
|
-
- **Don't split queries by relationship type.** One step with no type filter is better
|
|
2646
|
+
- **Don't split queries by relationship type.** One traverse step with no type filter is better
|
|
2646
2647
|
than three separate single-type calls.
|
|
2647
|
-
- **Don't use sequential single-hop traversals** when a multi-step
|
|
2648
|
+
- **Don't use sequential single-hop traversals** when a multi-step traverse operation achieves the
|
|
2648
2649
|
same result in one call.
|
|
2649
2650
|
- **Don't fetch full entities when you only need property values.** Use projection.`;
|
|
2650
2651
|
}
|
|
@@ -3489,7 +3490,7 @@ var EventBus = class {
|
|
|
3489
3490
|
};
|
|
3490
3491
|
|
|
3491
3492
|
// src/portability/RepositoryExporter.ts
|
|
3492
|
-
var LIBRARY_VERSION = true ? "0.
|
|
3493
|
+
var LIBRARY_VERSION = true ? "0.9.1" : "0.1.0";
|
|
3493
3494
|
var RepositoryExporter = class {
|
|
3494
3495
|
storage;
|
|
3495
3496
|
provenance;
|
|
@@ -4544,6 +4545,17 @@ var DeepMemory = class {
|
|
|
4544
4545
|
}
|
|
4545
4546
|
};
|
|
4546
4547
|
|
|
4548
|
+
// src/usage/safeSink.ts
|
|
4549
|
+
function createSafeSink(sink) {
|
|
4550
|
+
if (!sink) return void 0;
|
|
4551
|
+
return (usage) => {
|
|
4552
|
+
try {
|
|
4553
|
+
sink(usage);
|
|
4554
|
+
} catch {
|
|
4555
|
+
}
|
|
4556
|
+
};
|
|
4557
|
+
}
|
|
4558
|
+
|
|
4547
4559
|
// src/relationships/compilers/GremlinCompiler.ts
|
|
4548
4560
|
var DEFAULT_ESTIMATED_FANOUT_PER_HOP = 10;
|
|
4549
4561
|
var GremlinCompiler = class {
|
|
@@ -5619,6 +5631,7 @@ var NoOpEmbeddingProvider = class {
|
|
|
5619
5631
|
TraversalValidationError,
|
|
5620
5632
|
TraversalVocabularyError,
|
|
5621
5633
|
VocabularyValidationError,
|
|
5634
|
+
createSafeSink,
|
|
5622
5635
|
generateId,
|
|
5623
5636
|
isValidUuid,
|
|
5624
5637
|
matchesPropertyFilters,
|