@memberjunction/core-entities 5.22.0 → 5.23.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/index.d.ts CHANGED
@@ -21,6 +21,8 @@ export * from './engines/UserViewEngine.js';
21
21
  export * from './engines/FileStorageEngine.js';
22
22
  export * from './engines/MCPEngine.js';
23
23
  export * from './engines/QueryEngine.js';
24
+ export * from './engines/conversations.js';
25
+ export * from './engines/knowledgeHubMetadata.js';
24
26
  export * from './artifact-extraction/artifact-extract-rules.js';
25
27
  export * from './artifact-extraction/artifact-extractor.js';
26
28
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,kCAAkC,CAAA;AAEhD,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,0CAA0C,CAAC;AACzD,cAAc,iCAAiC,CAAC;AAChD,cAAc,sCAAsC,CAAC;AACrD,cAAc,oCAAoC,CAAC;AACnD,cAAc,sCAAsC,CAAC;AACrD,cAAc,mCAAmC,CAAC;AAElD,cAAc,uDAAuD,CAAC;AACtE,cAAc,iEAAiE,CAAC;AAChF,cAAc,2CAA2C,CAAC;AAE1D,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AAEtC,cAAc,8CAA8C,CAAC;AAC7D,cAAc,0CAA0C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,kCAAkC,CAAA;AAEhD,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,0CAA0C,CAAC;AACzD,cAAc,iCAAiC,CAAC;AAChD,cAAc,sCAAsC,CAAC;AACrD,cAAc,oCAAoC,CAAC;AACnD,cAAc,sCAAsC,CAAC;AACrD,cAAc,mCAAmC,CAAC;AAElD,cAAc,uDAAuD,CAAC;AACtE,cAAc,iEAAiE,CAAC;AAChF,cAAc,2CAA2C,CAAC;AAE1D,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAE/C,cAAc,8CAA8C,CAAC;AAC7D,cAAc,0CAA0C,CAAC"}
package/dist/index.js CHANGED
@@ -21,6 +21,8 @@ export * from './engines/UserViewEngine.js';
21
21
  export * from './engines/FileStorageEngine.js';
22
22
  export * from './engines/MCPEngine.js';
23
23
  export * from './engines/QueryEngine.js';
24
+ export * from './engines/conversations.js';
25
+ export * from './engines/knowledgeHubMetadata.js';
24
26
  export * from './artifact-extraction/artifact-extract-rules.js';
25
27
  export * from './artifact-extraction/artifact-extractor.js';
26
28
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,kCAAkC,CAAA;AAEhD,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,0CAA0C,CAA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BAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAE/C,cAAc,8CAA8C,CAAC;AAC7D,cAAc,0CAA0C,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@memberjunction/core-entities",
3
3
  "type": "module",
4
- "version": "5.22.0",
4
+ "version": "5.23.0",
5
5
  "description": "Entity subclasses for the metadata layer of MemberJunction defined in the MJ_CORE schema (usually '__mj'), distributed as part of each release of MemberJunction",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -21,10 +21,10 @@
21
21
  "typescript": "^5.9.3"
22
22
  },
23
23
  "dependencies": {
24
- "@memberjunction/ai": "5.22.0",
25
- "@memberjunction/core": "5.22.0",
26
- "@memberjunction/global": "5.22.0",
27
- "@memberjunction/interactive-component-types": "5.22.0",
24
+ "@memberjunction/ai": "5.23.0",
25
+ "@memberjunction/core": "5.23.0",
26
+ "@memberjunction/global": "5.23.0",
27
+ "@memberjunction/interactive-component-types": "5.23.0",
28
28
  "zod": "~3.24.4"
29
29
  },
30
30
  "repository": {
package/readme.md CHANGED
@@ -34,8 +34,10 @@ flowchart TD
34
34
  AME["ArtifactMetadataEngine"]
35
35
  FE["FileStorageEngine"]
36
36
  EE["EncryptionEngineBase"]
37
+ CE["ConversationEngine"]
37
38
  ME["MCPEngine"]
38
39
  TTC["TypeTablesCache"]
40
+ KHE["KnowledgeHubMetadataEngine"]
39
41
  end
40
42
 
41
43
  subgraph Extraction["Artifact Extraction"]
@@ -119,7 +121,7 @@ A metadata-driven system for extracting structured attributes from artifact cont
119
121
  - **272 strongly-typed entity classes** covering all MemberJunction core schema entities
120
122
  - **Zod runtime validation** with field-level constraints and value list enums
121
123
  - **Extended entity classes** with permission checks, workflow logic, and JSON state parsing
122
- - **9 singleton engine caches** eliminating redundant database queries
124
+ - **10 singleton engine caches** eliminating redundant database queries (including KnowledgeHubMetadataEngine for vector/content metadata)
123
125
  - **Resource permission engine** with role-based access control (View/Edit/Owner levels)
124
126
  - **Dashboard permission engine** with owner/direct/category permission hierarchy
125
127
  - **User view engine** with filter-to-SQL conversion and smart filter AI support
@@ -387,10 +389,80 @@ Every generated entity class provides:
387
389
  | `DeserializeFromStorage(stored)` | Convert stored attributes back to runtime objects |
388
390
  | `GetStandardProperty(attributes, prop)` | Find a standard property value (name/description/etc.) |
389
391
 
392
+ ### ConversationEngine
393
+
394
+ Centralized, reactive cache for conversations, conversation details (messages), and peripheral data such as agent runs. `ConversationEngine` is the single source of truth for conversation data across all UI consumers (chat area, sidebar, overlay, etc.), replacing per-component caching that previously lived in multiple scattered locations.
395
+
396
+ The engine is user-scoped and environment-filtered, so it manages its own caching instead of using `BaseEngine.Load()` bulk-load pattern.
397
+
398
+ ```typescript
399
+ import { ConversationEngine } from '@memberjunction/core-entities';
400
+
401
+ // Initialize once at app startup
402
+ await ConversationEngine.Instance.Config(false, contextUser);
403
+
404
+ // Load conversations for the current user and environment
405
+ await ConversationEngine.Instance.LoadConversations(environmentId, contextUser);
406
+
407
+ // Subscribe to reactive conversation list changes
408
+ ConversationEngine.Instance.Conversations$.subscribe(conversations => {
409
+ console.log(`${conversations.length} conversations loaded`);
410
+ });
411
+
412
+ // Load and cache details (messages) for a specific conversation
413
+ const details = await ConversationEngine.Instance.LoadConversationDetails(conversationId, contextUser);
414
+
415
+ // Instant cache reads (no DB round-trip)
416
+ const cached = ConversationEngine.Instance.GetCachedDetails(conversationId);
417
+
418
+ // CRUD operations that automatically update the reactive list
419
+ await ConversationEngine.Instance.CreateConversation('New Chat', environmentId, contextUser);
420
+ await ConversationEngine.Instance.PinConversation(conversationId, true, contextUser);
421
+ await ConversationEngine.Instance.ArchiveConversation(conversationId, contextUser);
422
+
423
+ // Cache management
424
+ ConversationEngine.Instance.InvalidateConversation(conversationId);
425
+ ConversationEngine.Instance.ClearCache();
426
+ ```
427
+
428
+ Source: [`src/engines/conversations.ts`](src/engines/conversations.ts)
429
+
430
+ ### KnowledgeHubMetadataEngine
431
+
432
+ Caches all Knowledge Hub-related metadata in a single singleton, providing fast lookups for entity documents, vector indexes, vector databases, content sources, content types, content source types, and content file types. Uses `BaseEngine` for automatic caching and entity-event auto-refresh.
433
+
434
+ ```typescript
435
+ import { KnowledgeHubMetadataEngine } from '@memberjunction/core-entities';
436
+
437
+ const khEngine = KnowledgeHubMetadataEngine.Instance;
438
+ await khEngine.Config(false, contextUser);
439
+
440
+ // Cached data access (no DB round-trip)
441
+ const activeDocuments = khEngine.GetActiveEntityDocuments();
442
+ const entitiesWithDocs = khEngine.GetEntitiesWithDocuments(); // For dropdowns
443
+ const doc = khEngine.GetEntityDocumentById(docId);
444
+ const docsForEntity = khEngine.GetEntityDocumentsForEntity('Contacts');
445
+ const vectorIndex = khEngine.GetVectorIndexById(indexId);
446
+ const vectorDB = khEngine.GetVectorDatabaseById(dbId);
447
+
448
+ // Raw cached arrays
449
+ khEngine.EntityDocuments; // All entity documents
450
+ khEngine.VectorIndexes; // All vector indexes
451
+ khEngine.VectorDatabases; // All vector databases
452
+ khEngine.ContentSources; // All content sources
453
+ khEngine.ContentTypes; // All content types
454
+ khEngine.ContentSourceTypes; // All content source types (Web, RSS, etc.)
455
+ khEngine.ContentFileTypes; // All content file types (.pdf, .html, etc.)
456
+ ```
457
+
458
+ Source: [`src/engines/knowledgeHubMetadata.ts`](src/engines/knowledgeHubMetadata.ts)
459
+
390
460
  ### Other Engines
391
461
 
392
462
  | Engine | Purpose |
393
463
  |---|---|
464
+ | `KnowledgeHubMetadataEngine` | Caches entity documents, vector indexes/databases, content sources/types/file types |
465
+ | `ConversationEngine` | Reactive cache for conversations, messages, and agent runs (user-scoped) |
394
466
  | `EncryptionEngineBase` | Caches encryption keys, algorithms, and key sources |
395
467
  | `FileStorageEngine` | Caches file storage accounts and providers |
396
468
  | `MCPEngine` | Caches MCP servers, connections, and tools |