[ACS-12037] Remove Knowledge Discovery from ADF (#12042)

* [ACS-12037] Remove Knowledge Discovery from ADF

* [ACS-12037] Resolve Copilot CR comments

* [ACS-12037] Complete cleanup, revert i18n changes

* [ACS-12037] Cleanup features and APIs related to hxiconnector

* [ACS-12037] Update docs
This commit is contained in:
Grzegorz Jaśkowski
2026-07-10 15:37:24 +02:00
committed by GitHub
parent 0b35118dee
commit b86e41515e
63 changed files with 11 additions and 2261 deletions
@@ -1,18 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './public-api';
@@ -1,18 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './services/agent.service';
@@ -1,67 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { TestBed } from '@angular/core/testing';
import { AgentService } from './agent.service';
import { Agent, AgentPaging } from '@alfresco/js-api';
const agent1: Agent = {
id: '1',
name: 'HR Agent',
description: 'Your Claims Doc Agent streamlines the extraction, analysis, and management of data from insurance claims documents.',
avatarUrl: ''
};
const agent2: Agent = {
id: '2',
name: 'Policy Agent',
description: 'Your Claims Doc Agent streamlines the extraction, analysis, and management of data from insurance claims documents.',
avatarUrl: ''
};
const agentPagingObjectMock: AgentPaging = {
list: {
entries: [
{
entry: agent1
},
{
entry: agent2
}
]
}
};
const agentListMock: Agent[] = [agent1, agent2];
describe('AgentService', () => {
let agentService: AgentService;
beforeEach(() => {
agentService = TestBed.inject(AgentService);
});
it('should load agents', (done) => {
spyOn(agentService.agentsApi, 'getAgents').and.returnValue(Promise.resolve(agentPagingObjectMock));
agentService.getAgents().subscribe((pagingResponse) => {
expect(pagingResponse).toEqual(agentListMock);
expect(agentService.agentsApi.getAgents).toHaveBeenCalled();
done();
});
});
});
@@ -1,58 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Injectable, inject } from '@angular/core';
import { Agent, AgentsApi, LazyApi } from '@alfresco/js-api';
import { BehaviorSubject, from, Observable, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { AlfrescoApiService } from '../../services';
@Injectable({
providedIn: 'root'
})
export class AgentService {
private readonly apiService = inject(AlfrescoApiService);
private readonly agents = new BehaviorSubject<Agent[]>([]);
@LazyApi((self: AgentService) => new AgentsApi(self.apiService.getInstance()))
declare readonly agentsApi: AgentsApi;
agents$ = this.agents.asObservable();
/**
* Gets all agents from cache. If cache is empty, fetches agents from backend.
*
* @returns Agent[] list containing agents.
*/
getAgents(): Observable<Agent[]> {
return this.agents$.pipe(
switchMap((agentsList) => {
if (agentsList.length) {
return of(agentsList);
}
return from(this.agentsApi.getAgents()).pipe(
map((paging) => {
const agentEntries = paging.list.entries.map((agentEntry) => agentEntry.entry);
this.agents.next(agentEntries);
return agentEntries;
})
);
})
);
}
}
@@ -729,14 +729,6 @@
"JOIN_REQUESTED": "Request sent to join this library"
}
},
"KNOWLEDGE_RETRIEVAL": {
"SEARCH": {
"WARNINGS": {
"TOO_MANY_FILES_SELECTED": "Please select no more than {{ maxFiles }} files.",
"FOLDER_SELECTED": "Folders are not compatible with AI Agents."
}
}
},
"NODE_FAVORITE_DIRECTIVE": {
"MESSAGES": {
"NODE_ADDED": "Added {{ name }} to favorites",
@@ -1,18 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './public-api';
@@ -1,18 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './services';
@@ -1,18 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './prediction.service';
@@ -1,53 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { PredictionService } from './prediction.service';
import { TestBed } from '@angular/core/testing';
import { Prediction, PredictionEntry, PredictionPaging, PredictionPagingList, ReviewStatus } from '@alfresco/js-api';
describe('PredictionService', () => {
let service: PredictionService;
const mockPredictionPaging = (): PredictionPaging => {
const prediction = new Prediction();
prediction.id = 'test id';
const predictionEntry = new PredictionEntry({ entry: prediction });
const predictionPagingList = new PredictionPagingList({ entries: [predictionEntry] });
return new PredictionPaging({ list: predictionPagingList });
};
beforeEach(() => {
TestBed.configureTestingModule({
imports: []
});
service = TestBed.inject(PredictionService);
});
it('should call getPredictions on PredictionsApi with nodeId', () => {
spyOn(service.predictionsApi, 'getPredictions').and.returnValue(Promise.resolve(mockPredictionPaging()));
service.getPredictions('test id');
expect(service.predictionsApi.getPredictions).toHaveBeenCalledWith('test id');
});
it('should call reviewPrediction on PredictionsApi with predictionId and reviewStatus', () => {
spyOn(service.predictionsApi, 'reviewPrediction').and.returnValue(Promise.resolve());
service.reviewPrediction('test id', ReviewStatus.CONFIRMED);
expect(service.predictionsApi.reviewPrediction).toHaveBeenCalledWith('test id', ReviewStatus.CONFIRMED);
});
});
@@ -1,50 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Injectable, inject } from '@angular/core';
import { PredictionsApi, PredictionPaging, ReviewStatus, LazyApi } from '@alfresco/js-api';
import { from, Observable } from 'rxjs';
import { AlfrescoApiService } from '../../services/alfresco-api.service';
@Injectable({ providedIn: 'root' })
export class PredictionService {
private readonly apiService = inject(AlfrescoApiService);
@LazyApi((self: PredictionService) => new PredictionsApi(self.apiService.getInstance()))
declare readonly predictionsApi: PredictionsApi;
/**
* Get predictions for a given node
*
* @param nodeId The identifier of node.
* @returns Observable<PredictionPaging>
*/
getPredictions(nodeId: string): Observable<PredictionPaging> {
return from(this.predictionsApi.getPredictions(nodeId));
}
/**
* Review a prediction
*
* @param predictionId The identifier of prediction.
* @param reviewStatus Review status to apply.
* @returns Observable<void>
*/
reviewPrediction(predictionId: string, reviewStatus: ReviewStatus): Observable<void> {
return from(this.predictionsApi.reviewPrediction(predictionId, reviewStatus));
}
}
@@ -1,18 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './public-api';
@@ -1,22 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export interface SearchAiInputState {
active: boolean;
selectedAgentId?: string;
searchTerm?: string;
}
@@ -1,19 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './services/search-ai.service';
export * from './models/search-ai-input-state';
@@ -1,246 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { TestBed } from '@angular/core/testing';
import { AiAnswerEntry, KnowledgeRetrievalConfigEntry, Node, QuestionModel, QuestionRequest } from '@alfresco/js-api';
import { SearchAiService } from './search-ai.service';
import { SearchAiInputState } from '../models/search-ai-input-state';
import { TranslateService } from '@ngx-translate/core';
describe('SearchAiService', () => {
let service: SearchAiService;
beforeEach(() => {
TestBed.configureTestingModule({
imports: []
});
service = TestBed.inject(SearchAiService);
});
describe('ask', () => {
it('should load information about question', (done) => {
const question: QuestionModel = {
question: 'some question',
questionId: 'some id',
restrictionQuery: { nodesIds: ['nodeId1', 'nodeId2'] }
};
spyOn(service.searchAiApi, 'ask').and.returnValue(Promise.resolve(question));
const questionRequest: QuestionRequest = {
question: 'some question',
nodeIds: ['nodeId1', 'nodeId2'],
agentId: 'some id'
};
service.ask(questionRequest).subscribe((questionResponse) => {
expect(questionResponse).toBe(question);
expect(service.searchAiApi.ask).toHaveBeenCalledWith([questionRequest]);
done();
});
});
});
describe('getAnswer', () => {
it('should load information about question', (done) => {
const questionId = 'some id';
const answer: AiAnswerEntry = {
entry: {
answer: 'Some answer 1',
complete: true,
question: 'Some question',
objectReferences: [
{
objectId: 'some id 1',
references: [
{
referenceId: 'some reference id 1',
rank: 1,
rankScore: 0.005
},
{
referenceId: 'some reference id 2',
rank: 2,
rankScore: 0.004
}
]
},
{
objectId: 'some id 2',
references: [
{
referenceId: 'some reference id 3',
rank: 1,
rankScore: 0.005
},
{
referenceId: 'some reference id 4',
rank: 2,
rankScore: 0.004
}
]
}
]
}
};
spyOn(service.searchAiApi, 'getAnswer').and.returnValue(Promise.resolve(answer));
service.getAnswer(questionId).subscribe((answerResponse) => {
expect(answerResponse).toBe(answer);
expect(service.searchAiApi.getAnswer).toHaveBeenCalledWith(questionId);
done();
});
});
});
describe('getConfig', () => {
it('should load knowledge retrieval configuration', (done) => {
const config: KnowledgeRetrievalConfigEntry = {
entry: {
knowledgeRetrievalUrl: 'https://some-url'
}
};
spyOn(service.searchAiApi, 'getConfig').and.returnValue(Promise.resolve(config));
service.getConfig().subscribe((configResponse) => {
expect(configResponse).toBe(config);
expect(service.searchAiApi.getConfig).toHaveBeenCalled();
done();
});
});
});
describe('updateSearchAiInputState', () => {
it('should trigger toggleSearchAiInput$', () => {
const state: SearchAiInputState = {
active: true,
selectedAgentId: 'some id'
};
service.updateSearchAiInputState(state);
service.toggleSearchAiInput$.subscribe((receivedState) => {
expect(receivedState).toBe(state);
});
});
});
describe('checkSearchAvailability', () => {
let translateService: TranslateService;
const tooManyFilesSelectedError = 'Please select no more than 100 files.';
const folderSelectedError = 'Folders are not compatible with AI Agents.';
beforeEach(() => {
translateService = TestBed.inject(TranslateService);
spyOn(translateService, 'instant').and.callFake((key) => {
switch (key) {
case 'KNOWLEDGE_RETRIEVAL.SEARCH.WARNINGS.TOO_MANY_FILES_SELECTED':
return tooManyFilesSelectedError;
case 'KNOWLEDGE_RETRIEVAL.SEARCH.WARNINGS.FOLDER_SELECTED':
return folderSelectedError;
default:
return '';
}
});
});
it('should not return error if user did not select any files', () => {
expect(
service.checkSearchAvailability({
count: 0,
nodes: [],
libraries: [],
isEmpty: true
})
).toEqual('');
});
it('should return error for too many files selected', () => {
expect(
service.checkSearchAvailability({
count: 101,
nodes: [],
libraries: [],
isEmpty: false
})
).toBe(tooManyFilesSelectedError);
expect(translateService.instant).toHaveBeenCalledWith('KNOWLEDGE_RETRIEVAL.SEARCH.WARNINGS.TOO_MANY_FILES_SELECTED', {
maxFiles: 100,
key: 'KNOWLEDGE_RETRIEVAL.SEARCH.WARNINGS.TOO_MANY_FILES_SELECTED'
});
});
it('should return error for folder selected', () => {
expect(
service.checkSearchAvailability({
count: 1,
nodes: [
{
entry: {
isFolder: true
} as Node
}
],
libraries: [],
isEmpty: false
})
).toBe(folderSelectedError);
});
it('should return error for folder and if non text mime type node is selected', () => {
expect(
service.checkSearchAvailability({
count: 1,
nodes: [
{
entry: {
isFolder: true,
content: {
mimeType: 'some mime type',
mimeTypeName: 'some mime type',
sizeInBytes: 100
}
} as Node
}
],
libraries: [],
isEmpty: false
})
).toBe(folderSelectedError);
});
it('should return more than one error if more validators detected issues', () => {
expect(
service.checkSearchAvailability({
count: 101,
nodes: [
{
entry: {
isFolder: true,
content: {
mimeType: 'image/jpeg',
mimeTypeName: 'image/jpeg',
sizeInBytes: 100
}
} as Node
}
],
libraries: [],
isEmpty: false
})
).toBe(`${tooManyFilesSelectedError} ${folderSelectedError}`);
});
});
});
@@ -1,105 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Injectable, inject } from '@angular/core';
import { AiAnswerEntry, KnowledgeRetrievalConfigEntry, LazyApi, QuestionModel, QuestionRequest, SearchAiApi } from '@alfresco/js-api';
import { BehaviorSubject, from, Observable } from 'rxjs';
import { SelectionState } from '@alfresco/adf-extensions';
import { TranslateService } from '@ngx-translate/core';
import { SearchAiInputState } from '../models/search-ai-input-state';
import { AlfrescoApiService } from '../../services';
@Injectable({
providedIn: 'root'
})
export class SearchAiService {
private readonly apiService = inject(AlfrescoApiService);
private readonly translateService = inject(TranslateService);
private readonly toggleSearchAiInput = new BehaviorSubject<SearchAiInputState>({
active: false
});
@LazyApi((self: SearchAiService) => new SearchAiApi(self.apiService.getInstance()))
declare readonly searchAiApi: SearchAiApi;
toggleSearchAiInput$ = this.toggleSearchAiInput.asObservable();
/**
* Update the state of the search AI input.
*
* @param state The new state of the search AI input.
*/
updateSearchAiInputState(state: SearchAiInputState): void {
this.toggleSearchAiInput.next(state);
}
/**
* Ask a question to the AI.
*
* @param question The question to ask.
* @returns QuestionModel object containing information about questions.
*/
ask(question: QuestionRequest): Observable<QuestionModel> {
return from(this.searchAiApi.ask([question]));
}
/**
* Get an answer to specific question.
*
* @param questionId The ID of the question to get an answer for.
* @returns AiAnswerEntry object containing the answer.
*/
getAnswer(questionId: string): Observable<AiAnswerEntry> {
return from(this.searchAiApi.getAnswer(questionId));
}
/**
* Get the knowledge retrieval configuration.
*
* @returns KnowledgeRetrievalConfigEntry object containing the configuration.
*/
getConfig(): Observable<KnowledgeRetrievalConfigEntry> {
return from(this.searchAiApi.getConfig());
}
/**
* Check if using of search is possible (if all conditions are met).
*
* @param selectedNodesState information about selected nodes.
* @param maxSelectedNodes max number of selected nodes. Default 100.
* @returns string with error if any condition is not met, empty string otherwise.
*/
checkSearchAvailability(selectedNodesState: SelectionState, maxSelectedNodes = 100): string {
const messages: {
key: string;
[parameter: string]: number | string;
}[] = [];
if (selectedNodesState.count > maxSelectedNodes) {
messages.push({
key: 'KNOWLEDGE_RETRIEVAL.SEARCH.WARNINGS.TOO_MANY_FILES_SELECTED',
maxFiles: maxSelectedNodes
});
}
if (selectedNodesState.nodes.some((node) => node.entry.isFolder)) {
messages.push({
key: 'KNOWLEDGE_RETRIEVAL.SEARCH.WARNINGS.FOLDER_SELECTED'
});
}
return messages.map((message) => this.translateService.instant(message.key, message)).join(' ');
}
}
-3
View File
@@ -44,12 +44,9 @@ export * from './lib/security/index';
export * from './lib/api-factories';
export * from './lib/services/index';
export * from './lib/infinite-scroll-datasource';
export * from './lib/prediction/index';
export * from './lib/legal-hold/index';
export * from './lib/api-factories';
export * from './lib/mock/alfresco-api.service.mock';
export * from './lib/agent/index';
export * from './lib/search-ai/index';
export * from './lib/content.module';
export * from './lib/material.module';
-1
View File
@@ -24,7 +24,6 @@ export * from './src/api/auth-rest-api/index';
export * from './src/api/activiti-rest-api/index';
export * from './src/api/search-rest-api/index';
export * from './src/api/model-rest-api/index';
export * from './src/api/hxi-connector-api/index';
export * from './src/api/content-custom-api/api/content.api';
export * from './src/authentication/contentAuth';
-13
View File
@@ -38,7 +38,6 @@ export class AlfrescoApi extends AlfrescoApiClient implements AlfrescoApiType {
discoveryClient: ContentClient;
gsClient: ContentClient;
authClient: ContentClient;
hxiConnectorClient: ContentClient;
oauth2Auth: Oauth2Auth;
processAuth: ProcessAuth;
contentAuth: ContentAuth;
@@ -190,12 +189,6 @@ export class AlfrescoApi extends AlfrescoApiClient implements AlfrescoApiType {
} else {
this.processClient.setConfig(this.config);
}
if (!this.hxiConnectorClient) {
this.hxiConnectorClient = new ContentClient(this.config, `/api/${this.config.tenant}/private/hxi/versions/1`, this.httpClient);
} else {
this.hxiConnectorClient.setConfig(this.config, `/api/${this.config.tenant}/private/hxi/versions/1`);
}
}
/**@private? */
@@ -207,7 +200,6 @@ export class AlfrescoApi extends AlfrescoApiClient implements AlfrescoApiType {
this.searchClient.off('error', () => {});
this.discoveryClient.off('error', () => {});
this.gsClient.off('error', () => {});
this.hxiConnectorClient.off('error', () => {});
this.contentClient.on('error', (error: any) => {
this.errorHandler(error);
@@ -236,10 +228,6 @@ export class AlfrescoApi extends AlfrescoApiClient implements AlfrescoApiType {
this.gsClient.on('error', (error: any) => {
this.errorHandler(error);
});
this.hxiConnectorClient.on('error', (error: any) => {
this.errorHandler(error);
});
}
ticketMismatchListeners() {
@@ -370,7 +358,6 @@ export class AlfrescoApi extends AlfrescoApiClient implements AlfrescoApiType {
this.searchClient.setAuthentications(authECM);
this.discoveryClient.setAuthentications(authECM);
this.gsClient.setAuthentications(authECM);
this.hxiConnectorClient.setAuthentications(authECM);
}
/**
@@ -1,35 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AgentPaging } from '../model/agentPaging';
import { BaseApi } from '../../hxi-connector-api/api/base.api';
/**
* Agents Api.
* In order to use this api, you need to have the HX Insights Connector (additional ACS module) installed.
*/
export class AgentsApi extends BaseApi {
/**
* Gets all agents.
* @returns AgentPaging object containing the agents.
*/
getAgents(): Promise<AgentPaging> {
return this.get({
path: '/agents'
});
}
}
@@ -18,7 +18,6 @@
export * from './types';
export * from './actions.api';
export * from './activities.api';
export * from './agents.api';
export * from './audit.api';
export * from './categories.api';
export * from './comments.api';
@@ -33,7 +32,6 @@ export * from './probes.api';
export * from './queries.api';
export * from './ratings.api';
export * from './renditions.api';
export * from './search-ai.api';
export * from './sharedlinks.api';
export * from './sites.api';
export * from './tags.api';
@@ -1,61 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { QuestionModel, QuestionRequest, AiAnswerEntry, KnowledgeRetrievalConfigEntry } from '../model';
import { BaseApi } from '../../hxi-connector-api/api/base.api';
/**
* Search AI API.
*/
export class SearchAiApi extends BaseApi {
/**
* Ask a question to the AI.
* @param questions QuestionRequest array containing questions to ask.
* @returns QuestionModel object containing information about questions.
*/
ask(questions: QuestionRequest[]): Promise<QuestionModel> {
const agentId = questions[0].agentId;
return this.post({
path: `agents/${agentId}/questions`,
bodyParam: questions.map((questionRequest) => ({
question: questionRequest.question,
restrictionQuery: { nodesIds: questionRequest.nodeIds }
}))
}).then((response) => response.entry);
}
/**
* Get an answer to specific question.
* @param questionId The ID of the question to get an answer for.
* @returns AiAnswerEntry object containing the answer.
*/
getAnswer(questionId: string): Promise<AiAnswerEntry> {
return this.get({
path: `questions/${questionId}/answers/-default-`
});
}
/**
* Get the knowledge retrieval configuration.
* @returns KnowledgeRetrievalConfigEntry object containing the configuration.
*/
getConfig(): Promise<KnowledgeRetrievalConfigEntry> {
return this.get({
path: '/config/-default-'
});
}
}
@@ -1,87 +0,0 @@
# AgentsApi
| Method | HTTP request | Description |
|-----------------------------------|----------------------------------------------|--------------------------|
| [getAgents](#getAgents) | **GET** /agents | Gets all agents. |
## getAgents
Gets all agents.
A paginated list is returned in the response body. For example:
```json
{
"list": {
"pagination": {
"count": 2,
"hasMoreItems": false,
"totalItems": 2,
"skipCount": 0,
"maxItems": 100
},
"entries": [
{
"entry": {
"id": "Some id",
"name": "Some name",
"description": "Some description",
"avatarUrl": "Some avatar url"
}
}
]
}
}
```
**Example**
```javascript
import { AlfrescoApi, AgentsApi } from '@alfresco/js-api';
const alfrescoApi = new AlfrescoApi(/*..*/);
const agentsApi = new AgentsApi(alfrescoApi);
agentsApi.getAgents().then((agents) => {
console.log('API called successfully. Returned data: ' + agents);
});
```
**Return type**: [AgentPaging](#AgentPaging)
# Models
## AgentPaging
**Properties**
| Name | Type |
|------|-------------------------------------|
| list | [AgentPagingList](#AgentPagingList) |
## AgentPagingList
**Properties**
| Name | Type |
|----------------|-----------------------------|
| **pagination** | [Pagination](Pagination.md) |
| **entries** | [AgentEntry[]](#AgentEntry) |
## AgentEntry
**Properties**
| Name | Type |
|-----------|-----------------|
| **entry** | [Agent](#Agent) |
## Agent
**Properties**
| Name | Type | Description |
|-----------------|-----------|-------------------------------|
| **id** | string | Agent id |
| **name** | string | Agent name |
| **description** | string | Agent description |
| **avatarUrl** | string | (optional) Agent avatar image |
@@ -1,215 +0,0 @@
# SearchAiApi
| Method | HTTP request | Description |
|-------------------------|----------------------------|--------------------------------------------|
| [ask](#ask) | **GET** /questions | Ask a question to the AI. |
| [getAnswer](#getAnswer) | **GET** /answers/-default- | Get an answer to specific question. |
| [getConfig](#getConfig) | **GET** /config/-default- | Get the knowledge retrieval configuration. |
## ask
Ask a question to the AI.
A list is returned in the response body. For example:
```json
[
{
"question": "Some question",
"questionId": "Some question id",
"restrictionQuery": "Some restriction query"
}
]
```
**Example**
```javascript
import { AlfrescoApi, AgentsApi } from '@alfresco/js-api';
const alfrescoApi = new AlfrescoApi(/*..*/);
const searchAiApi = new SearchAiApi(alfrescoApi);
searchAiApi.ask([{
question: 'Some question',
restrictionQuery: 'Some restriction query',
agentId: 'Some agent id'
}]).then((questionInformation) => {
console.log('API called successfully. Returned data: ' + questionInformation);
});
```
**Parameters**
| Name | Type | Description |
|---------------|---------------------------------------|-----------------------|
| **questions** | [QuestionRequest](#QuestionRequest)[] | The questions to ask. |
**Return type**: [QuestionModel](#QuestionModel)[]
## getAnswer
Get an answer to specific question.
A paginated list is returned in the response body. For example:
```json
{
"entry": {
"answer": "Some answer",
"question": "Some question",
"complete": true,
"objectReferences": [
{
"objectId": "some-object-id",
"references": [
{
"referenceId": "some-reference-id1",
"rankScore": 0.031,
"rank": 2
},
{
"referenceId": "some-reference-id2",
"rankScore": 0.031,
"rank": 1
},
{
"referenceId": "some-reference-id3",
"rankScore": 0.028,
"rank": 3
}
]
}
]
}
}
```
**Example**
```javascript
import { AlfrescoApi, AgentsApi } from '@alfresco/js-api';
const alfrescoApi = new AlfrescoApi(/*..*/);
const searchAiApi = new SearchAiApi(alfrescoApi);
searchAiApi.getAnswer('some question id').then((answer) => {
console.log('API called successfully. Returned data: ' + answer);
});
```
**Parameters**
| Name | Type | Description |
|----------------|--------|----------------------------------------------|
| **questionId** | string | The ID of the question to get an answer for. |
**Return type**: [AiAnswerEntry](#AiAnswerEntry)
## getConfig
Get the knowledge retrieval configuration. For example:
```json
{
"entry": {
"knowledgeRetrievalUrl": "https://some-url"
}
}
```
**Example**
```javascript
import { AlfrescoApi, AgentsApi } from '@alfresco/js-api';
const alfrescoApi = new AlfrescoApi(/*..*/);
const searchAiApi = new SearchAiApi(alfrescoApi);
searchAiApi.getConfig().then((answer) => {
console.log('API called successfully. Returned data: ', answer.entry.knowledgeRetrievalUrl);
});
```
**Return type**: [KnowledgeRetrievalConfigEntry](#KnowledgeRetrievalConfigEntry)
# Models
## AiAnswerEntry
**Properties**
| Name | Type |
|-----------|-----------------------|
| **entry** | [AiAnswer](#AiAnswer) |
## AiAnswer
**Properties**
| Name | Type |
|----------------------|-------------------------------------------------------|
| **answer** | string |
| **question** | string |
| **complete** | boolean |
| **objectReferences** | [AiAnswerObjectReference](#AiAnswerObjectReference)[] |
## AiAnswerObjectReference
**Properties**
| Name | Type |
|----------------|-------------------------------------------|
| **objectId** | string |
| nodeId | string |
| **references** | [AiAnswerReference](#AiAnswerReference)[] |
## AiAnswerReference
**Properties**
| Name | Type |
|-----------------|--------|
| **referenceId** | string |
| **rankScore** | number |
| **rank** | number |
## QuestionModel
**Properties**
| Name | Type |
|----------------------|------------------|
| **question** | string |
| **questionId** | string |
| **restrictionQuery** | RestrictionQuery |
## RestrictionQuery
**Properties**
| Name | Type |
|--------------|----------|
| **nodesIds** | string[] |
## QuestionRequest
**Properties**
| Name | Type |
|--------------|----------|
| **question** | string |
| **nodeIds** | string[] |
| **agentId** | string |
## KnowledgeRetrievalConfigEntry
**Properties**
| Name | Type |
|-------|-------------------------------------------------------|
| entry | [KnowledgeRetrievalConfig](#KnowledgeRetrievalConfig) |
## KnowledgeRetrievalConfig
**Properties**
| Name | Type |
|-----------------------|--------|
| knowledgeRetrievalUrl | string |
@@ -1,23 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export interface Agent {
id: string;
name: string;
description: string;
avatarUrl?: string;
}
@@ -1,22 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Agent } from './agent';
export interface AgentEntry {
entry: Agent;
}
@@ -1,22 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AgentPagingList } from './agentPagingList';
export interface AgentPaging {
list?: AgentPagingList;
}
@@ -1,24 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Pagination } from './pagination';
import { AgentEntry } from './agentEntry';
export interface AgentPagingList {
entries?: AgentEntry[];
pagination?: Pagination;
}
@@ -1,25 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AiAnswerObjectReference } from './aiAnswerObjectReference';
export interface AiAnswer {
answer?: string;
question: string;
complete: boolean;
objectReferences: AiAnswerObjectReference[];
}
@@ -1,22 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AiAnswer } from './aiAnswer';
export interface AiAnswerEntry {
entry: AiAnswer;
}
@@ -1,24 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AiAnswerReference } from './aiAnswerReference';
export interface AiAnswerObjectReference {
objectId: string;
nodeId?: string;
references: AiAnswerReference[];
}
@@ -1,22 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export interface AiAnswerReference {
referenceId: string;
rankScore: number;
rank: number;
}
@@ -27,14 +27,6 @@ export * from './activity';
export * from './activityEntry';
export * from './activityPaging';
export * from './activityPagingList';
export * from './agent';
export * from './agentEntry';
export * from './agentPaging';
export * from './agentPagingList';
export * from './aiAnswer';
export * from './aiAnswerEntry';
export * from './aiAnswerReference';
export * from './aiAnswerObjectReference';
export * from './association';
export * from './associationBody';
export * from './associationEntry';
@@ -99,8 +91,6 @@ export * from './groupMemberPagingList';
export * from './groupMembershipBodyCreate';
export * from './groupPaging';
export * from './groupPagingList';
export * from './knowledgeRetrievalConfig';
export * from './knowledgeRetrievalConfigEntry';
export * from './modelError';
export * from './networkQuota';
export * from './node';
@@ -143,8 +133,6 @@ export * from './preferencePagingList';
export * from './probeEntry';
export * from './probeEntryEntry';
export * from './property';
export * from './questionModel';
export * from './questionRequest';
export * from './rating';
export * from './ratingAggregate';
export * from './ratingBody';
@@ -1,20 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export interface KnowledgeRetrievalConfig {
knowledgeRetrievalUrl: string;
}
@@ -1,22 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { KnowledgeRetrievalConfig } from './knowledgeRetrievalConfig';
export interface KnowledgeRetrievalConfigEntry {
entry: KnowledgeRetrievalConfig;
}
@@ -1,24 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { RestrictionQuery } from './restrictionQuery';
export interface QuestionModel {
questionId: string;
question: string;
restrictionQuery: RestrictionQuery;
}
@@ -1,22 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export interface QuestionRequest {
question: string;
nodeIds: string[];
agentId: string;
}
@@ -1,20 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export interface RestrictionQuery {
nodesIds: string[];
}
@@ -1,19 +0,0 @@
**HX Insights Connector API**
Provides access to the HX Insights connector API endpoints.
## Documentation for API Endpoints
All URIs are relative to *https://localhost/alfresco/api/-default-/private/hxi/versions/1*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*.PredictionsApi* | [**getPredictions**](docs/PredictionsApi.md#getPredictions) | **GET** /nodes/{nodeId}/predictions | Get predictions for a node.
## Documentation for Models
- [PredicitonsApi](docs/PredictionsApi.md)
- [Prediciton](docs/Prediction.md)
- [PredicitonEntry](docs/PredictionEntry.md)
- [PredicitonPagingList](docs/PredictionPagingList.md)
- [PredicitonPaging](docs/PredictionPaging.md)
@@ -1,25 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ApiClient } from '../../../api-clients/api-client';
import { LegacyHttpClient } from '../../../api-clients/http-client.interface';
export abstract class BaseApi extends ApiClient {
override get apiClient(): LegacyHttpClient {
return this.alfrescoApi.hxiConnectorClient;
}
}
@@ -1,18 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './predictions.api';
@@ -1,63 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { BaseApi } from './base.api';
import { throwIfNotDefined } from '../../../assert';
import { PredictionPaging, ReviewStatus } from '../model';
export class PredictionsApi extends BaseApi {
/**
* List of predictions for a node
* @param nodeId The identifier of a node.
* @returns Promise<PredictionPaging>
*/
getPredictions(nodeId: string): Promise<PredictionPaging> {
throwIfNotDefined(nodeId, 'nodeId');
const pathParams = {
nodeId
};
return this.get({
path: '/nodes/{nodeId}/predictions',
pathParams,
returnType: PredictionPaging
});
}
/**
* Confirm or reject a prediction
* @param predictionId The identifier of a prediction.
* @param reviewStatus New status to apply for prediction. Can be either 'confirmed' or 'rejected'.
* @returns Promise<void>
*/
reviewPrediction(predictionId: string, reviewStatus: ReviewStatus): Promise<void> {
throwIfNotDefined(predictionId, 'predictionId');
throwIfNotDefined(reviewStatus, 'reviewStatus');
const pathParams = {
predictionId,
reviewStatus
};
return this.post({
path: '/predictions/{predictionId}/review',
pathParams,
returnType: Promise<void>
});
}
}
@@ -1,14 +0,0 @@
# Prediction
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **string** | Identifier of a prediction |
**modelId** | **string** | Identifier of a model that made the prediction |
**confidenceLevel** | **number** | Prediction confidence level |
**predictionDateTime** | **Date** | Prediction creation date |
**property** | **string** | Name of the property that prediction was made for |
**previousValue** | any | Previous property value |
**predictionValue** | any | Predicted value |
**updateType** | [**UpdateType**](../model/prediction.ts) | Update type |
**reviewStatus** | [**ReviewStatus**](../model/prediction.ts) | Prediction review status |
@@ -1,8 +0,0 @@
# PredictionEntry
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**entry** | [**Prediction**](Prediction.md) | |
@@ -1,8 +0,0 @@
# PredictionPaging
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**list** | [**PredictionPagingList**](PredictionPagingList.md) | |
@@ -1,9 +0,0 @@
# PredictionPagingList
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**pagination** | [**Pagination**](../../content-rest-api/docs/Pagination.md) | |
**entries** | [**PredictionEntry[]**](PredictionEntry.md) | |
@@ -1,42 +0,0 @@
# PredictionsApi
All URIs are relative to *https://localhost/alfresco/api/-default-/private/hxi/versions/1*
Method | HTTP request | Description
------------- | ------------- | -------------
[**getPredictions**](PredictionsApi.md#getPredictions) | **GET** /nodes/{nodeId}/predictions | Get predictions for node.
[**reviewPrediction**](PredictionsApi.md#reviewPrediction) | **POST** /predictions/{predictionId}/review | Reject or confirm prediction.
<a name="getPredictions"></a>
# **getPredictions**
> PredictionPaging getPredictions(nodeId)
Get predictions for a node.
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**nodeId** | **string** | The identifier of a node. |
### Return type
[**PredictionPaging**](PredictionPaging.md)
<a name="reviewPrediction"></a>
# **reviewPrediction**
> Promise\<void\> reviewPrediction(predictionId, reviewStatus)
Confirm or reject a prediction.
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**predictionId** | **string** | The identifier of a prediction. |
**reviewStatus** | **ReviewStatus** | Review status for prediction. Can be confirmed or rejected. |
### Return type
**Promise\<void\>**
@@ -1,19 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './api';
export * from './model';
@@ -1,21 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './prediction';
export * from './predictionEntry';
export * from './predictionPaging';
export * from './predictionPagingList';
@@ -1,47 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { DateAlfresco } from '../../content-custom-api';
export class Prediction {
id: string;
modelId: string;
confidenceLevel: number;
predictionDateTime: Date;
property: string;
previousValue: any;
predictionValue: any;
updateType: UpdateType;
reviewStatus: ReviewStatus;
constructor(input?: Partial<Prediction>) {
if (input) {
Object.assign(this, input);
this.predictionDateTime = input.predictionDateTime ? DateAlfresco.parseDate(input.predictionDateTime) : undefined;
}
}
}
export type UpdateType = 'AUTOFILL' | 'AUTOCORRECT';
export const ReviewStatus = {
UNREVIEWED: 'UNREVIEWED',
CONFIRMED: 'CONFIRMED',
REJECTED: 'REJECTED'
} as const;
export type ReviewStatus = (typeof ReviewStatus)[keyof typeof ReviewStatus];
@@ -1,29 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Prediction } from './prediction';
export class PredictionEntry {
entry: Prediction;
constructor(input?: Partial<PredictionEntry>) {
if (input) {
Object.assign(this, input);
this.entry = input.entry ? new Prediction(input.entry) : undefined;
}
}
}
@@ -1,29 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { PredictionPagingList } from './predictionPagingList';
export class PredictionPaging {
list?: PredictionPagingList;
constructor(input?: Partial<PredictionPaging>) {
if (input) {
Object.assign(this, input);
this.list = input.list ? new PredictionPagingList(input.list) : undefined;
}
}
}
@@ -1,34 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Pagination } from '../../content-rest-api/model/pagination';
import { PredictionEntry } from './predictionEntry';
export class PredictionPagingList {
pagination?: Pagination;
entries?: PredictionEntry[];
constructor(input?: Partial<PredictionPagingList>) {
if (input) {
Object.assign(this, input);
this.pagination = input.pagination ? new Pagination(input.pagination) : undefined;
if (input.entries) {
this.entries = input.entries.map((item) => new PredictionEntry(item));
}
}
}
}
-1
View File
@@ -24,7 +24,6 @@ export * from './api/auth-rest-api';
export * from './api/activiti-rest-api';
export * from './api/search-rest-api';
export * from './api/model-rest-api';
export * from './api/hxi-connector-api';
export * from './api/content-custom-api/api/content.api';
export * from './authentication/contentAuth';
@@ -34,7 +34,6 @@ export interface AlfrescoApiType {
gsClient: LegacyHttpClient;
authClient: LegacyHttpClient;
processAuth: LegacyHttpClient;
hxiConnectorClient: LegacyHttpClient;
setConfig(config: AlfrescoApiConfig): void;
changeWithCredentialsConfig(withCredentials: boolean): void;
@@ -1,71 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AgentMock, EcmAuthMock } from '../mockObjects';
import { AgentsApi, AlfrescoApi } from '../../src';
import assert from 'assert';
describe('AgentsApi', () => {
let agentMock: AgentMock;
let agentsApi: AgentsApi;
beforeEach((done) => {
const hostEcm = 'https://127.0.0.1:8080';
const authResponseMock = new EcmAuthMock(hostEcm);
agentMock = new AgentMock(hostEcm);
authResponseMock.get201Response();
const alfrescoJsApi = new AlfrescoApi({
hostEcm
});
alfrescoJsApi.login('admin', 'admin').then(() => done());
agentsApi = new AgentsApi(alfrescoJsApi);
});
describe('getAgents', () => {
it('should load list of agents', (done) => {
agentMock.mockGetAgents200Response();
agentsApi.getAgents().then((paging) => {
assert.deepStrictEqual(paging, {
list: {
pagination: {
count: 2,
hasMoreItems: false,
skipCount: 0,
maxItems: 100
},
entries: [
{
entry: {
id: 'some id 1',
name: 'some name 1'
}
},
{
entry: {
id: 'some id 2',
name: 'some name 2'
}
}
]
}
});
done();
});
});
});
});
@@ -1,126 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AlfrescoApi, SearchAiApi } from '../../src';
import { EcmAuthMock, SearchAiMock } from '../mockObjects';
import assert from 'assert';
describe('SearchAiApi', () => {
let searchAiApi: SearchAiApi;
let searchAiMock: SearchAiMock;
beforeEach((done) => {
const hostEcm = 'https://127.0.0.1:8080';
const authResponseMock = new EcmAuthMock(hostEcm);
searchAiMock = new SearchAiMock(hostEcm);
authResponseMock.get201Response();
const alfrescoJsApi = new AlfrescoApi({
hostEcm
});
alfrescoJsApi.login('admin', 'admin').then(() => done());
searchAiApi = new SearchAiApi(alfrescoJsApi);
});
describe('ask', () => {
it('should load question information', (done) => {
searchAiMock.mockGetAsk200Response();
searchAiApi
.ask([
{
question: 'some question 1',
nodeIds: ['some node id 1'],
agentId: 'id1'
}
])
.then((questions) => {
assert.deepStrictEqual(questions, {
questionId: 'some id 1',
question: 'some question 1',
restrictionQuery: {
nodesIds: ['some node id 1']
}
});
done();
});
});
});
describe('getAnswer', () => {
it('should load question answer', (done) => {
searchAiMock.mockGetAnswer200Response();
searchAiApi.getAnswer('id1').then((answer) => {
assert.deepStrictEqual(answer, {
entry: {
answer: 'Some answer 1',
complete: true,
question: 'Some question',
objectReferences: [
{
objectId: 'some id 1',
references: [
{
referenceId: 'some reference id 1',
rank: 1,
rankScore: 0.005
},
{
referenceId: 'some reference id 2',
rank: 2,
rankScore: 0.004
}
]
},
{
objectId: 'some id 2',
references: [
{
referenceId: 'some reference id 3',
rank: 1,
rankScore: 0.005
},
{
referenceId: 'some reference id 4',
rank: 2,
rankScore: 0.004
}
]
}
]
}
});
done();
});
});
});
describe('getConfig', () => {
it('should load knowledge retrieval configuration', (done) => {
searchAiMock.mockGetConfig200Response();
searchAiApi.getConfig().then((config) => {
assert.deepStrictEqual(config, {
entry: {
knowledgeRetrievalUrl: 'https://some-url'
}
});
done();
});
});
});
});
@@ -1,49 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { BaseMock } from '../base.mock';
export class AgentMock extends BaseMock {
mockGetAgents200Response(): void {
this.mock()
.get('/alfresco/api/-default-/private/hxi/versions/1/agents')
.reply(200, {
list: {
pagination: {
count: 2,
hasMoreItems: false,
skipCount: 0,
maxItems: 100
},
entries: [
{
entry: {
id: 'some id 1',
name: 'some name 1'
}
},
{
entry: {
id: 'some id 2',
name: 'some name 2'
}
}
]
}
});
}
}
@@ -1,95 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { BaseMock } from '../base.mock';
export class SearchAiMock extends BaseMock {
mockGetAsk200Response(): void {
this.mock()
.post('/alfresco/api/-default-/private/hxi/versions/1/agents/id1/questions', [
{
question: 'some question 1',
restrictionQuery: {
nodesIds: ['some node id 1']
}
}
])
.reply(200, {
entry: {
question: 'some question 1',
questionId: 'some id 1',
restrictionQuery: {
nodesIds: ['some node id 1']
}
}
});
}
mockGetAnswer200Response(): void {
this.mock()
.get('/alfresco/api/-default-/private/hxi/versions/1/questions/id1/answers/-default-')
.reply(200, {
entry: {
answer: 'Some answer 1',
complete: true,
question: 'Some question',
objectReferences: [
{
objectId: 'some id 1',
references: [
{
referenceId: 'some reference id 1',
rank: 1,
rankScore: 0.005
},
{
referenceId: 'some reference id 2',
rank: 2,
rankScore: 0.004
}
]
},
{
objectId: 'some id 2',
references: [
{
referenceId: 'some reference id 3',
rank: 1,
rankScore: 0.005
},
{
referenceId: 'some reference id 4',
rank: 2,
rankScore: 0.004
}
]
}
]
}
});
}
mockGetConfig200Response(): void {
this.mock()
.get('/alfresco/api/-default-/private/hxi/versions/1/config/-default-')
.reply(200, {
entry: {
knowledgeRetrievalUrl: 'https://some-url'
}
});
}
}
-2
View File
@@ -15,7 +15,6 @@
* limitations under the License.
*/
export * from './content-services/agent.mock';
export * from './content-services/categories.mock';
export * from './content-services/comment.mock';
export * from './content-services/ecm-auth.mock';
@@ -27,7 +26,6 @@ export * from './content-services/groups.mock';
export * from './content-services/find-nodes.mock';
export * from './content-services/rendition.mock';
export * from './content-services/search.mock';
export * from './content-services/search-ai.mock';
export * from './content-services/tag.mock';
export * from './content-services/upload.mock';
export * from './content-services/version.mock';