@memberjunction/core-entities 6.2.0-edge.1 → 6.2.0-edge.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/.tsbuildinfo +1 -1
- package/dist/custom/MJConversationDetailEntityExtended.d.ts +7 -2
- package/dist/custom/MJConversationDetailEntityExtended.d.ts.map +1 -1
- package/dist/custom/MJConversationDetailEntityExtended.js +27 -17
- package/dist/custom/MJConversationDetailEntityExtended.js.map +1 -1
- package/dist/engines/knowledgeHubMetadata.d.ts +21 -6
- package/dist/engines/knowledgeHubMetadata.d.ts.map +1 -1
- package/dist/engines/knowledgeHubMetadata.js +32 -15
- package/dist/engines/knowledgeHubMetadata.js.map +1 -1
- package/dist/generated/entities/__mj.d.ts +4873 -360
- package/dist/generated/entities/__mj.d.ts.map +1 -1
- package/dist/generated/entities/__mj.js +49907 -44622
- package/dist/generated/entities/__mj.js.map +1 -1
- package/dist/generated/remote_operations.d.ts +423 -3
- package/dist/generated/remote_operations.d.ts.map +1 -1
- package/dist/generated/remote_operations.js +72 -0
- package/dist/generated/remote_operations.js.map +1 -1
- package/package.json +5 -5
|
@@ -34,8 +34,13 @@ export declare class MJConversationDetailEntityExtended extends MJConversationDe
|
|
|
34
34
|
*/
|
|
35
35
|
private dirtyRatingFieldNames;
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
38
|
-
* see
|
|
37
|
+
* Records WHY the write was refused as a NEW `ResultHistory` entry, so callers that read
|
|
38
|
+
* `LatestResult.CompleteMessage` see the reason (issue #4791).
|
|
39
|
+
*
|
|
40
|
+
* It must be a new entry, not an edit of `LatestResult`: on a brand-new record there IS no
|
|
41
|
+
* `LatestResult` yet (nothing has been saved), so editing it silently dropped the denial and
|
|
42
|
+
* every caller logged "unknown error". Appending also leaves an earlier successful save's
|
|
43
|
+
* entry untouched. Mirrors `ReadOnlyExternalBaseEntity.rejectMutation`.
|
|
39
44
|
*/
|
|
40
45
|
private recordDenied;
|
|
41
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MJConversationDetailEntityExtended.d.ts","sourceRoot":"","sources":["../../src/custom/MJConversationDetailEntityExtended.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"MJConversationDetailEntityExtended.d.ts","sourceRoot":"","sources":["../../src/custom/MJConversationDetailEntityExtended.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,mBAAmB,EACnB,iBAAiB,EAGpB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACH,0BAA0B,EAG7B,MAAM,gCAAgC,CAAC;AAcxC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBACa,kCAAmC,SAAQ,0BAA0B;IAC/D,IAAI,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;IAOnD,MAAM,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC;YAOxD,mBAAmB;IA6EjC;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;IAS7B;;;;;;;;OAQG;IACH,OAAO,CAAC,YAAY;CASvB;AAED,6FAA6F;AAC7F,wBAAgB,sCAAsC,IAAI,IAAI,CAE7D"}
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { BaseEntity, LogError } from '@memberjunction/core';
|
|
7
|
+
import { BaseEntity, BaseEntityResult, LogError } from '@memberjunction/core';
|
|
8
8
|
import { RegisterClass, UUIDsEqual } from '@memberjunction/global';
|
|
9
9
|
import { MJConversationDetailEntity } from '../generated/entity_subclasses.js';
|
|
10
10
|
import { ResourcePermissionEngine } from './ResourcePermissions/ResourcePermissionEngine.js';
|
|
@@ -42,18 +42,19 @@ const OWNER_ONLY_RATING_FIELDS = ['UserRating', 'UserFeedback'];
|
|
|
42
42
|
*/
|
|
43
43
|
let MJConversationDetailEntityExtended = class MJConversationDetailEntityExtended extends MJConversationDetailEntity {
|
|
44
44
|
async Save(options) {
|
|
45
|
-
if (!(await this.currentUserMayWrite())) {
|
|
45
|
+
if (!(await this.currentUserMayWrite('save'))) {
|
|
46
46
|
return false;
|
|
47
47
|
}
|
|
48
48
|
return super.Save(options);
|
|
49
49
|
}
|
|
50
50
|
async Delete(options) {
|
|
51
|
-
if (!(await this.currentUserMayWrite())) {
|
|
51
|
+
if (!(await this.currentUserMayWrite('delete'))) {
|
|
52
52
|
return false;
|
|
53
53
|
}
|
|
54
54
|
return super.Delete(options);
|
|
55
55
|
}
|
|
56
|
-
async currentUserMayWrite() {
|
|
56
|
+
async currentUserMayWrite(operation) {
|
|
57
|
+
const resultType = operation === 'delete' ? 'delete' : this.IsSaved ? 'update' : 'create';
|
|
57
58
|
const provider = this.ProviderToUse;
|
|
58
59
|
if (provider?.ProviderType !== 'Database') {
|
|
59
60
|
// Client-side path — trust the enforcement that already ran upstream.
|
|
@@ -80,7 +81,7 @@ let MJConversationDetailEntityExtended = class MJConversationDetailEntityExtende
|
|
|
80
81
|
// and UserFeedback represent the owner's evaluation of an AI
|
|
81
82
|
// message and there is no per-user storage to overwrite.
|
|
82
83
|
if (this.dirtyRatingFieldNames().length > 0) {
|
|
83
|
-
this.recordDenied('Only the conversation owner can set or change the rating and feedback on this message.');
|
|
84
|
+
this.recordDenied('Only the conversation owner can set or change the rating and feedback on this message.', resultType);
|
|
84
85
|
return false;
|
|
85
86
|
}
|
|
86
87
|
const engine = ResourcePermissionEngine.GetProviderInstance(provider, ResourcePermissionEngine);
|
|
@@ -89,20 +90,22 @@ let MJConversationDetailEntityExtended = class MJConversationDetailEntityExtende
|
|
|
89
90
|
.GetUserAvailableResources(user, CONVERSATIONS_RESOURCE_TYPE_ID)
|
|
90
91
|
.find((p) => UUIDsEqual(p.ResourceRecordID, this.ConversationID));
|
|
91
92
|
if (!grant) {
|
|
92
|
-
this.recordDenied('You do not have access to this conversation.');
|
|
93
|
+
this.recordDenied('You do not have access to this conversation.', resultType);
|
|
93
94
|
return false;
|
|
94
95
|
}
|
|
95
96
|
if (grant.PermissionLevel === 'Edit' || grant.PermissionLevel === 'Owner') {
|
|
96
97
|
return true;
|
|
97
98
|
}
|
|
98
99
|
// Only View — block writes.
|
|
99
|
-
this.recordDenied('You have view-only access to this conversation.');
|
|
100
|
+
this.recordDenied('You have view-only access to this conversation.', resultType);
|
|
100
101
|
return false;
|
|
101
102
|
}
|
|
102
103
|
catch (error) {
|
|
103
|
-
|
|
104
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
105
|
+
LogError(`MJConversationDetailEntityExtended.currentUserMayWrite failed ` +
|
|
106
|
+
`(${operation} on conversation ${this.ConversationID}, user ${user.ID}): ${message}`);
|
|
104
107
|
// Fail closed — safer to deny than silently allow a compromised write.
|
|
105
|
-
this.recordDenied('Unable to verify conversation permissions.');
|
|
108
|
+
this.recordDenied('Unable to verify conversation permissions.', resultType);
|
|
106
109
|
return false;
|
|
107
110
|
}
|
|
108
111
|
}
|
|
@@ -121,15 +124,22 @@ let MJConversationDetailEntityExtended = class MJConversationDetailEntityExtende
|
|
|
121
124
|
return matches;
|
|
122
125
|
}
|
|
123
126
|
/**
|
|
124
|
-
*
|
|
125
|
-
* see
|
|
127
|
+
* Records WHY the write was refused as a NEW `ResultHistory` entry, so callers that read
|
|
128
|
+
* `LatestResult.CompleteMessage` see the reason (issue #4791).
|
|
129
|
+
*
|
|
130
|
+
* It must be a new entry, not an edit of `LatestResult`: on a brand-new record there IS no
|
|
131
|
+
* `LatestResult` yet (nothing has been saved), so editing it silently dropped the denial and
|
|
132
|
+
* every caller logged "unknown error". Appending also leaves an earlier successful save's
|
|
133
|
+
* entry untouched. Mirrors `ReadOnlyExternalBaseEntity.rejectMutation`.
|
|
126
134
|
*/
|
|
127
|
-
recordDenied(message) {
|
|
128
|
-
const result =
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
135
|
+
recordDenied(message, type) {
|
|
136
|
+
const result = new BaseEntityResult();
|
|
137
|
+
result.Success = false;
|
|
138
|
+
result.Type = type;
|
|
139
|
+
result.Message = message;
|
|
140
|
+
result.StartedAt = new Date();
|
|
141
|
+
result.EndedAt = new Date();
|
|
142
|
+
this.RegisterResultHistoryEntry(result);
|
|
133
143
|
}
|
|
134
144
|
};
|
|
135
145
|
MJConversationDetailEntityExtended = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MJConversationDetailEntityExtended.js","sourceRoot":"","sources":["../../src/custom/MJConversationDetailEntityExtended.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACH,UAAU,
|
|
1
|
+
{"version":3,"file":"MJConversationDetailEntityExtended.js","sourceRoot":"","sources":["../../src/custom/MJConversationDetailEntityExtended.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACH,UAAU,EACV,gBAAgB,EAIhB,QAAQ,EACX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EACH,0BAA0B,EAG7B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAE1F,uFAAuF;AACvF,MAAM,8BAA8B,GAAG,sCAAsC,CAAC;AAE9E;;;;;GAKG;AACH,MAAM,wBAAwB,GAAG,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEI,IAAM,kCAAkC,GAAxC,MAAM,kCAAmC,SAAQ,0BAA0B;IACrE,KAAK,CAAC,IAAI,CAAC,OAA2B;QAC3C,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,mBAAmB,CAAC,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ine, IMetadataProvider, UserInfo } from "@memberjunction/core";
|
|
2
|
-
import { MJEntityDocumentEntity, MJVectorIndexEntity, MJContentSourceEntity, MJContentTypeEntity, MJContentSourceTypeEntity, MJContentFileTypeEntity } from "../generated/entity_subclasses.js";
|
|
2
|
+
import { MJEntityDocumentEntity, MJVectorIndexEntity, MJContentSourceEntity, MJContentTypeEntity, MJContentSourceTypeEntity, MJContentFileTypeEntity, MJFeaturePipelineTypeEntity } from "../generated/entity_subclasses.js";
|
|
3
3
|
/**
|
|
4
|
-
* Caches Knowledge Hub metadata: entity documents,
|
|
5
|
-
*
|
|
4
|
+
* Caches Knowledge Hub metadata: entity documents, content sources, content types, content source
|
|
5
|
+
* types, content file types, and feature pipeline types.
|
|
6
|
+
*
|
|
7
|
+
* Vector indexes are NOT cached here — `AIEngineBase` (`@memberjunction/ai-engine-base`) owns the single
|
|
8
|
+
* `MJ: Vector Indexes` cache, and {@link VectorIndexes} / {@link GetVectorIndexByID} proxy it.
|
|
6
9
|
* Provides helper methods for lookups and filtering. Uses BaseEngine for automatic
|
|
7
10
|
* caching and entity-event auto-refresh.
|
|
8
11
|
*/
|
|
@@ -15,11 +18,11 @@ export declare class KnowledgeHubMetadataEngine extends BaseEngine<KnowledgeHubM
|
|
|
15
18
|
static get Instance(): KnowledgeHubMetadataEngine;
|
|
16
19
|
protected constructor();
|
|
17
20
|
private _entityDocuments;
|
|
18
|
-
private _vectorIndexes;
|
|
19
21
|
private _contentSources;
|
|
20
22
|
private _contentTypes;
|
|
21
23
|
private _contentSourceTypes;
|
|
22
24
|
private _contentFileTypes;
|
|
25
|
+
private _featurePipelineTypes;
|
|
23
26
|
/**
|
|
24
27
|
* Lazily-built `NormalizeUUID(ID) → row` indexes, one per cached array (keyed by array name),
|
|
25
28
|
* powering the O(1) `Get…ByID` helpers. Cleared wholesale on any {@link DataChange$} emission
|
|
@@ -29,7 +32,14 @@ export declare class KnowledgeHubMetadataEngine extends BaseEngine<KnowledgeHubM
|
|
|
29
32
|
Config(forceRefresh?: boolean, contextUser?: UserInfo, provider?: IMetadataProvider): Promise<void>;
|
|
30
33
|
/** All entity documents in the system (both active and inactive) */
|
|
31
34
|
get EntityDocuments(): MJEntityDocumentEntity[];
|
|
32
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* All vector indexes in the system — a proxy for `AIEngineBase.VectorIndexes`, which owns the cache.
|
|
37
|
+
*
|
|
38
|
+
* Resolved through {@link BaseEngineRegistry} rather than an import because `@memberjunction/ai-engine-base`
|
|
39
|
+
* depends on this package (a direct import would be a circular dependency). Resolved per access, so it
|
|
40
|
+
* always reflects the owner's live array. Empty until `AIEngineBase` has loaded; callers that can import
|
|
41
|
+
* it should use `AIEngineBase.Instance` (or `AIEngine.Instance` server-side) directly.
|
|
42
|
+
*/
|
|
33
43
|
get VectorIndexes(): MJVectorIndexEntity[];
|
|
34
44
|
/** All content sources */
|
|
35
45
|
get ContentSources(): MJContentSourceEntity[];
|
|
@@ -39,6 +49,11 @@ export declare class KnowledgeHubMetadataEngine extends BaseEngine<KnowledgeHubM
|
|
|
39
49
|
get ContentSourceTypes(): MJContentSourceTypeEntity[];
|
|
40
50
|
/** All content file types (.pdf, .html, etc.) */
|
|
41
51
|
get ContentFileTypes(): MJContentFileTypeEntity[];
|
|
52
|
+
/**
|
|
53
|
+
* All feature pipeline types (LLM, and any other registered types), both Active and Disabled.
|
|
54
|
+
* @throws {PermissionConstrainedError} if the engine skipped loading because the user lacks read access.
|
|
55
|
+
*/
|
|
56
|
+
get FeaturePipelineTypes(): MJFeaturePipelineTypeEntity[];
|
|
42
57
|
/** Returns only entity documents with Status = 'Active' */
|
|
43
58
|
GetActiveEntityDocuments(): MJEntityDocumentEntity[];
|
|
44
59
|
/**
|
|
@@ -60,7 +75,7 @@ export declare class KnowledgeHubMetadataEngine extends BaseEngine<KnowledgeHubM
|
|
|
60
75
|
GetContentFileTypeByID(id: string): MJContentFileTypeEntity | undefined;
|
|
61
76
|
/** Find all entity documents for a given entity name (case-insensitive) */
|
|
62
77
|
GetEntityDocumentsForEntity(entityName: string): MJEntityDocumentEntity[];
|
|
63
|
-
/** Find a vector index by ID (case-insensitive UUID comparison).
|
|
78
|
+
/** Find a vector index by ID (case-insensitive UUID comparison). Proxies the `AIEngineBase` cache — see {@link VectorIndexes}. */
|
|
64
79
|
GetVectorIndexByID(id: string): MJVectorIndexEntity | undefined;
|
|
65
80
|
/**
|
|
66
81
|
* Returns distinct entity names that have active entity documents (for dropdowns).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"knowledgeHubMetadata.d.ts","sourceRoot":"","sources":["../../src/engines/knowledgeHubMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"knowledgeHubMetadata.d.ts","sourceRoot":"","sources":["../../src/engines/knowledgeHubMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA4D,iBAAiB,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEzI,OAAO,EACH,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,yBAAyB,EACzB,uBAAuB,EACvB,2BAA2B,EAC9B,MAAM,gCAAgC,CAAC;AAExC;;;;;;;;GAQG;AACH,qBAAa,0BAA2B,SAAQ,UAAU,CAAC,0BAA0B,CAAC;IAClF;;;;OAIG;IACH,WAAkB,QAAQ,IAAI,0BAA0B,CAEvD;IAED,SAAS;IAQT,OAAO,CAAC,gBAAgB,CAAgC;IACxD,OAAO,CAAC,eAAe,CAA+B;IACtD,OAAO,CAAC,aAAa,CAA6B;IAClD,OAAO,CAAC,mBAAmB,CAAmC;IAC9D,OAAO,CAAC,iBAAiB,CAAiC;IAC1D,OAAO,CAAC,qBAAqB,CAAqC;IAElE;;;;OAIG;IACH,OAAO,CAAC,UAAU,CAA8C;IAEnD,MAAM,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,QAAQ,EAA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
|
-
import { NormalizeUUID } from "@memberjunction/global";
|
|
1
|
+
import { BaseEngine, BaseEngineRegistry } from "@memberjunction/core";
|
|
2
|
+
import { NormalizeUUID, UUIDsEqual } from "@memberjunction/global";
|
|
3
3
|
/**
|
|
4
|
-
* Caches Knowledge Hub metadata: entity documents,
|
|
5
|
-
*
|
|
4
|
+
* Caches Knowledge Hub metadata: entity documents, content sources, content types, content source
|
|
5
|
+
* types, content file types, and feature pipeline types.
|
|
6
|
+
*
|
|
7
|
+
* Vector indexes are NOT cached here — `AIEngineBase` (`@memberjunction/ai-engine-base`) owns the single
|
|
8
|
+
* `MJ: Vector Indexes` cache, and {@link VectorIndexes} / {@link GetVectorIndexByID} proxy it.
|
|
6
9
|
* Provides helper methods for lookups and filtering. Uses BaseEngine for automatic
|
|
7
10
|
* caching and entity-event auto-refresh.
|
|
8
11
|
*/
|
|
@@ -18,11 +21,11 @@ export class KnowledgeHubMetadataEngine extends BaseEngine {
|
|
|
18
21
|
constructor() {
|
|
19
22
|
super();
|
|
20
23
|
this._entityDocuments = [];
|
|
21
|
-
this._vectorIndexes = [];
|
|
22
24
|
this._contentSources = [];
|
|
23
25
|
this._contentTypes = [];
|
|
24
26
|
this._contentSourceTypes = [];
|
|
25
27
|
this._contentFileTypes = [];
|
|
28
|
+
this._featurePipelineTypes = [];
|
|
26
29
|
/**
|
|
27
30
|
* Lazily-built `NormalizeUUID(ID) → row` indexes, one per cached array (keyed by array name),
|
|
28
31
|
* powering the O(1) `Get…ByID` helpers. Cleared wholesale on any {@link DataChange$} emission
|
|
@@ -42,12 +45,6 @@ export class KnowledgeHubMetadataEngine extends BaseEngine {
|
|
|
42
45
|
PropertyName: '_entityDocuments',
|
|
43
46
|
CacheLocal: true
|
|
44
47
|
},
|
|
45
|
-
{
|
|
46
|
-
Type: 'entity',
|
|
47
|
-
EntityName: 'MJ: Vector Indexes',
|
|
48
|
-
PropertyName: '_vectorIndexes',
|
|
49
|
-
CacheLocal: true
|
|
50
|
-
},
|
|
51
48
|
{
|
|
52
49
|
Type: 'entity',
|
|
53
50
|
EntityName: 'MJ: Content Sources',
|
|
@@ -71,6 +68,12 @@ export class KnowledgeHubMetadataEngine extends BaseEngine {
|
|
|
71
68
|
EntityName: 'MJ: Content File Types',
|
|
72
69
|
PropertyName: '_contentFileTypes',
|
|
73
70
|
CacheLocal: true
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
Type: 'entity',
|
|
74
|
+
EntityName: 'MJ: Feature Pipeline Types',
|
|
75
|
+
PropertyName: '_featurePipelineTypes',
|
|
76
|
+
CacheLocal: true
|
|
74
77
|
}
|
|
75
78
|
];
|
|
76
79
|
await this.Load(c, provider, forceRefresh, contextUser);
|
|
@@ -82,9 +85,16 @@ export class KnowledgeHubMetadataEngine extends BaseEngine {
|
|
|
82
85
|
get EntityDocuments() {
|
|
83
86
|
return this._entityDocuments;
|
|
84
87
|
}
|
|
85
|
-
/**
|
|
88
|
+
/**
|
|
89
|
+
* All vector indexes in the system — a proxy for `AIEngineBase.VectorIndexes`, which owns the cache.
|
|
90
|
+
*
|
|
91
|
+
* Resolved through {@link BaseEngineRegistry} rather than an import because `@memberjunction/ai-engine-base`
|
|
92
|
+
* depends on this package (a direct import would be a circular dependency). Resolved per access, so it
|
|
93
|
+
* always reflects the owner's live array. Empty until `AIEngineBase` has loaded; callers that can import
|
|
94
|
+
* it should use `AIEngineBase.Instance` (or `AIEngine.Instance` server-side) directly.
|
|
95
|
+
*/
|
|
86
96
|
get VectorIndexes() {
|
|
87
|
-
return
|
|
97
|
+
return BaseEngineRegistry.Instance.TryGetCachedRecords('MJ: Vector Indexes', { unfilteredOnly: true }) ?? [];
|
|
88
98
|
}
|
|
89
99
|
/** All content sources */
|
|
90
100
|
get ContentSources() {
|
|
@@ -102,6 +112,13 @@ export class KnowledgeHubMetadataEngine extends BaseEngine {
|
|
|
102
112
|
get ContentFileTypes() {
|
|
103
113
|
return this._contentFileTypes;
|
|
104
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* All feature pipeline types (LLM, and any other registered types), both Active and Disabled.
|
|
117
|
+
* @throws {PermissionConstrainedError} if the engine skipped loading because the user lacks read access.
|
|
118
|
+
*/
|
|
119
|
+
get FeaturePipelineTypes() {
|
|
120
|
+
return this.GetConfigData('_featurePipelineTypes');
|
|
121
|
+
}
|
|
105
122
|
// ================================================================
|
|
106
123
|
// Helper methods
|
|
107
124
|
// ================================================================
|
|
@@ -166,11 +183,11 @@ export class KnowledgeHubMetadataEngine extends BaseEngine {
|
|
|
166
183
|
const lower = entityName.trim().toLowerCase();
|
|
167
184
|
return this._entityDocuments.filter(d => d.Entity?.trim().toLowerCase() === lower);
|
|
168
185
|
}
|
|
169
|
-
/** Find a vector index by ID (case-insensitive UUID comparison).
|
|
186
|
+
/** Find a vector index by ID (case-insensitive UUID comparison). Proxies the `AIEngineBase` cache — see {@link VectorIndexes}. */
|
|
170
187
|
GetVectorIndexByID(id) {
|
|
171
188
|
if (!id)
|
|
172
189
|
return undefined;
|
|
173
|
-
return this.
|
|
190
|
+
return this.VectorIndexes.find(v => UUIDsEqual(v.ID, id));
|
|
174
191
|
}
|
|
175
192
|
/**
|
|
176
193
|
* Returns distinct entity names that have active entity documents (for dropdowns).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"knowledgeHubMetadata.js","sourceRoot":"","sources":["../../src/engines/knowledgeHubMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAqE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"knowledgeHubMetadata.js","sourceRoot":"","sources":["../../src/engines/knowledgeHubMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAqE,MAAM,sBAAsB,CAAC;AACzI,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAWnE;;;;;;;;GAQG;AACH,MAAM,OAAO,0BAA2B,SAAQ,UAAsC;IAClF;;;;O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