@danielsimonjr/memoryjs 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +23 -9
- package/dist/cli/index.js.map +1 -1
- package/dist/index.cjs +4 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -19206,7 +19206,7 @@ function registerCommands(program2) {
|
|
|
19206
19206
|
process.exit(1);
|
|
19207
19207
|
}
|
|
19208
19208
|
});
|
|
19209
|
-
entity.command("delete <name>").description("Delete an entity").option("-f, --force", "Skip confirmation").action(async (name,
|
|
19209
|
+
entity.command("delete <name>").description("Delete an entity").option("-f, --force", "Skip confirmation").action(async (name, _opts) => {
|
|
19210
19210
|
const options = getOptions(program2);
|
|
19211
19211
|
const logger2 = createLogger(options);
|
|
19212
19212
|
const ctx = createContext(options);
|
|
@@ -19306,7 +19306,7 @@ function registerCommands(program2) {
|
|
|
19306
19306
|
opts.merge
|
|
19307
19307
|
);
|
|
19308
19308
|
logger2.info(formatSuccess(
|
|
19309
|
-
`Imported ${result.
|
|
19309
|
+
`Imported ${result.entitiesAdded} entities and ${result.relationsAdded} relations`
|
|
19310
19310
|
));
|
|
19311
19311
|
} catch (error) {
|
|
19312
19312
|
logger2.error(formatError(error.message));
|
|
@@ -19337,18 +19337,32 @@ function registerCommands(program2) {
|
|
|
19337
19337
|
const ctx = createContext(options);
|
|
19338
19338
|
try {
|
|
19339
19339
|
const stats = await ctx.analyticsManager.getGraphStats();
|
|
19340
|
+
const graph = await ctx.storage.loadGraph();
|
|
19341
|
+
const observationCount = graph.entities.reduce(
|
|
19342
|
+
(sum, e) => sum + (e.observations?.length || 0),
|
|
19343
|
+
0
|
|
19344
|
+
);
|
|
19345
|
+
const allTags = /* @__PURE__ */ new Set();
|
|
19346
|
+
graph.entities.forEach((e) => {
|
|
19347
|
+
(e.tags || []).forEach((tag) => allTags.add(tag));
|
|
19348
|
+
});
|
|
19349
|
+
const uniqueTagCount = allTags.size;
|
|
19340
19350
|
if (options.format === "json") {
|
|
19341
|
-
console.log(JSON.stringify(
|
|
19351
|
+
console.log(JSON.stringify({
|
|
19352
|
+
...stats,
|
|
19353
|
+
observationCount,
|
|
19354
|
+
uniqueTagCount
|
|
19355
|
+
}, null, 2));
|
|
19342
19356
|
} else {
|
|
19343
19357
|
console.log(`
|
|
19344
19358
|
Knowledge Graph Statistics
|
|
19345
19359
|
==========================
|
|
19346
|
-
Entities:
|
|
19347
|
-
Relations:
|
|
19348
|
-
Entity Types:
|
|
19349
|
-
Relation Types: ${stats.
|
|
19350
|
-
Observations:
|
|
19351
|
-
Tags Used:
|
|
19360
|
+
Entities: ${stats.totalEntities}
|
|
19361
|
+
Relations: ${stats.totalRelations}
|
|
19362
|
+
Entity Types: ${Object.keys(stats.entityTypesCounts).length}
|
|
19363
|
+
Relation Types: ${Object.keys(stats.relationTypesCounts).length}
|
|
19364
|
+
Observations: ${observationCount}
|
|
19365
|
+
Tags Used: ${uniqueTagCount}
|
|
19352
19366
|
`);
|
|
19353
19367
|
}
|
|
19354
19368
|
} catch (error) {
|