[PRODENG-211] integrate JS-API with monorepo (part 1) (#9081)

* integrate JS-API with monorepo

* [ci:force] fix token issue

[ci:force] migrate docs folder

[ci:force] clean personal tokens

* [ci:force] gha workflow support

* [ci:force] npm publish target

* fix js-api test linting

* [ci:force] fix test linting, mocks, https scheme

* [ci:force] fix https scheme

* [ci:force] typescript mappings

* [ci:force] update scripts

* lint fixes

* linting fixes

* fix linting

* [ci:force] linting fixes

* linting fixes

* [ci:force] remove js-api upstream and corresponding scripts

* [ci:force] jsdoc fixes

* fix jsdoc linting

* [ci:force] jsdoc fixes

* [ci:force] jsdoc fixes

* jsdoc fixes

* jsdoc fixes

* jsdoc fixes

* [ci:force] fix jsdoc

* [ci:force] reduce code duplication

* replace 'chai' expect with node.js assert

* replace 'chai' expect with node.js assert

* [ci:force] remove chai and chai-spies for js-api testing

* [ci:force] cleanup and fix imports

* [ci:force] fix linting

* [ci:force] fix unit test

* [ci:force] fix sonar linting findings

* [ci:force] switch activiti api models to interfaces (-2.5% reduction of bundle)

* [ci:force] switch activiti api models to interfaces

* [ci:force] switch AGS api models to interfaces

* [ci:force] switch AGS api models to interfaces

* [ci:force] switch search api models to interfaces

* [ci:force] switch content api models to interfaces where applicable
This commit is contained in:
Denys Vuika
2023-11-21 10:27:51 +00:00
committed by GitHub
parent 804fa2ffd4
commit ea2c0ce229
1334 changed files with 82605 additions and 1068 deletions

View File

@@ -0,0 +1,68 @@
/*!
* @license
* Copyright © 2005-2023 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 nock from 'nock';
import { BaseMock } from '../base.mock';
export class BpmAuthMock extends BaseMock {
username: string;
password: string;
constructor(host?: string, username?: string, password?: string) {
super(host);
this.username = username || 'admin';
this.password = password || 'admin';
}
get200Response(): void {
nock(this.host, { encodedQueryParams: true })
.post(
'/activiti-app/app/authentication',
'j_username=' + this.username + '&j_password=' + this.password + '&_spring_security_remember_me=true&submit=Login'
)
.reply(200);
}
get200ResponseLogout(): void {
nock(this.host, { encodedQueryParams: true }).get('/activiti-app/app/logout', {}).reply(200);
}
get401Response(): void {
nock(this.host, { encodedQueryParams: true })
.post('/activiti-app/app/authentication', 'j_username=wrong&j_password=name&_spring_security_remember_me=true&submit=Login')
.reply(401, {
error: {
message: 'This request requires HTTP authentication.',
statusCode: 401
}
});
}
get403Response(): void {
nock(this.host, { encodedQueryParams: true })
.post('/activiti-app/app/authentication', 'j_username=wrong&j_password=name&_spring_security_remember_me=true&submit=Login')
.reply(403, {
error: {
errorKey: 'Login failed',
statusCode: 403,
briefSummary: '05150009 Login failed',
stackTrace: 'For security reasons the stack trace is no longer displayed, but the property is kept for previous versions.',
descriptionURL: 'https://api-explorer.alfresco.com'
}
});
}
}

View File

@@ -0,0 +1,155 @@
/*!
* @license
* Copyright © 2005-2023 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 nock from 'nock';
import { BaseMock } from '../base.mock';
export class ModelJsonBpmMock extends BaseMock {
get200EditorDisplayJsonClient(): void {
nock(this.host, { encodedQueryParams: true })
.get('/activiti-app/app/rest/models/1/model-json')
.reply(200, {
elements: [
{
id: 'startEvent1',
name: null,
x: 100,
y: 163,
width: 30,
height: 30,
type: 'StartEvent',
properties: []
},
{
id: 'sid-8B04E151-6B46-4F48-B49E-F719057353AD',
name: null,
x: 175,
y: 138,
width: 100,
height: 80,
type: 'UserTask',
properties: [{ name: 'Assignee', value: '$INITIATOR' }]
},
{
id: 'sid-8F6A225D-91AC-4FE3-8DDF-7DF034A37C44',
name: null,
x: 320,
y: 164,
width: 28,
height: 28,
type: 'EndEvent',
properties: []
}
],
flows: [
{
id: 'sid-BC321EAF-BF83-4343-91C4-C0E7C4E10133',
type: 'sequenceFlow',
sourceRef: 'startEvent1',
targetRef: 'sid-8B04E151-6B46-4F48-B49E-F719057353AD',
waypoints: [
{ x: 130, y: 178 },
{ x: 175, y: 178 }
],
properties: []
},
{
id: 'sid-CA38A1B7-1BFC-44C1-B20D-86748AE7AAA0',
type: 'sequenceFlow',
sourceRef: 'sid-8B04E151-6B46-4F48-B49E-F719057353AD',
targetRef: 'sid-8F6A225D-91AC-4FE3-8DDF-7DF034A37C44',
waypoints: [
{ x: 275, y: 178 },
{ x: 320, y: 178 }
],
properties: []
}
],
diagramBeginX: 115,
diagramBeginY: 138,
diagramWidth: 348,
diagramHeight: 218
});
}
get200HistoricEditorDisplayJsonClient(): void {
nock('https://127.0.0.1:9999', { encodedQueryParams: true })
.get('/activiti-app/app/rest/models/1/history/1/model-json')
.reply(200, {
elements: [
{
id: 'startEvent1',
name: null,
x: 100,
y: 163,
width: 30,
height: 30,
type: 'StartEvent',
properties: []
},
{
id: 'sid-8B04E151-6B46-4F48-B49E-F719057353AD',
name: null,
x: 175,
y: 138,
width: 100,
height: 80,
type: 'UserTask',
properties: [{ name: 'Assignee', value: '$INITIATOR' }]
},
{
id: 'sid-8F6A225D-91AC-4FE3-8DDF-7DF034A37C44',
name: null,
x: 320,
y: 164,
width: 28,
height: 28,
type: 'EndEvent',
properties: []
}
],
flows: [
{
id: 'sid-BC321EAF-BF83-4343-91C4-C0E7C4E10133',
type: 'sequenceFlow',
sourceRef: 'startEvent1',
targetRef: 'sid-8B04E151-6B46-4F48-B49E-F719057353AD',
waypoints: [
{ x: 130, y: 178 },
{ x: 175, y: 178 }
],
properties: []
},
{
id: 'sid-CA38A1B7-1BFC-44C1-B20D-86748AE7AAA0',
type: 'sequenceFlow',
sourceRef: 'sid-8B04E151-6B46-4F48-B49E-F719057353AD',
targetRef: 'sid-8F6A225D-91AC-4FE3-8DDF-7DF034A37C44',
waypoints: [
{ x: 275, y: 178 },
{ x: 320, y: 178 }
],
properties: []
}
],
diagramBeginX: 115,
diagramBeginY: 138,
diagramWidth: 348,
diagramHeight: 218
});
}
}

View File

@@ -0,0 +1,53 @@
/*!
* @license
* Copyright © 2005-2023 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 nock from 'nock';
import { BaseMock } from '../base.mock';
export class ModelsMock extends BaseMock {
get200getModels(): void {
nock(this.host, { encodedQueryParams: true })
.get('/activiti-app/api/enterprise/models')
.query({ filter: 'myReusableForms', modelType: '2' })
.reply(200, {
size: 1,
total: 1,
start: 0,
data: [
{
id: 1,
name: 'Metadata',
description: '',
createdBy: 1,
createdByFullName: ' Administrator',
lastUpdatedBy: 1,
lastUpdatedByFullName: ' Administrator',
lastUpdated: '2016-08-05T17:39:22.750+0000',
latestVersion: true,
version: 2,
comment: null,
stencilSet: null,
referenceId: null,
modelType: 2,
favorite: null,
permission: 'write',
tenantId: 1
}
]
});
}
}

View File

@@ -0,0 +1,110 @@
/*!
* @license
* Copyright © 2005-2023 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 nock from 'nock';
import { BaseMock } from '../base.mock';
const fakeVariable1 = {
name: 'variable1',
value: 'Value 123',
scope: 'global'
};
const fakeVariable2 = {
name: 'variable2',
value: 'Value 456',
scope: 'local'
};
const fakeVariablesList = [fakeVariable1, fakeVariable2];
export class ProcessInstanceVariablesMock extends BaseMock {
addListProcessInstanceVariables200Response(processInstanceId: string): void {
nock(this.host, { encodedQueryParams: true })
.get('/activiti-app/api/enterprise/process-instances/' + processInstanceId + '/variables')
.reply(200, fakeVariablesList);
}
addListProcessInstanceVariables500Response(processInstanceId: string): void {
nock(this.host, { encodedQueryParams: true })
.get('/activiti-app/api/enterprise/process-instances/' + processInstanceId + '/variables')
.reply(500, {
messageKey: 'UNKNOWN',
message: 'Unknown error'
});
}
addPutProcessInstanceVariables200Response(processInstanceId: string): void {
nock(this.host, { encodedQueryParams: true })
.put('/activiti-app/api/enterprise/process-instances/' + processInstanceId + '/variables')
.reply(200, fakeVariablesList);
}
addPutProcessInstanceVariables500Response(processInstanceId: string): void {
nock(this.host, { encodedQueryParams: true })
.put('/activiti-app/api/enterprise/process-instances/' + processInstanceId + '/variables')
.reply(500, {
messageKey: 'UNKNOWN',
message: 'Unknown error'
});
}
addGetProcessInstanceVariable200Response(processInstanceId: string, variableName: string): void {
nock(this.host, { encodedQueryParams: true })
.get('/activiti-app/api/enterprise/process-instances/' + processInstanceId + '/variables/' + variableName)
.reply(200, fakeVariable1);
}
addGetProcessInstanceVariable500Response(processInstanceId: string, variableName: string): void {
nock(this.host, { encodedQueryParams: true })
.get('/activiti-app/api/enterprise/process-instances/' + processInstanceId + '/variables/' + variableName)
.reply(500, {
messageKey: 'UNKNOWN',
message: 'Unknown error'
});
}
addUpdateProcessInstanceVariable200Response(processInstanceId: string, variableName: string): void {
nock(this.host, { encodedQueryParams: true })
.put('/activiti-app/api/enterprise/process-instances/' + processInstanceId + '/variables/' + variableName)
.reply(200, fakeVariable1);
}
addUpdateProcessInstanceVariable500Response(processInstanceId: string, variableName: string): void {
nock(this.host, { encodedQueryParams: true })
.put('/activiti-app/api/enterprise/process-instances/' + processInstanceId + '/variables/' + variableName)
.reply(500, {
messageKey: 'UNKNOWN',
message: 'Unknown error'
});
}
addDeleteProcessInstanceVariable200Response(processInstanceId: string, variableName: string): void {
nock(this.host, { encodedQueryParams: true })
.delete('/activiti-app/api/enterprise/process-instances/' + processInstanceId + '/variables/' + variableName)
.reply(200);
}
addDeleteProcessInstanceVariable500Response(processInstanceId: string, variableName: string): void {
nock(this.host, { encodedQueryParams: true })
.delete('/activiti-app/api/enterprise/process-instances/' + processInstanceId + '/variables/' + variableName)
.reply(500, {
messageKey: 'UNKNOWN',
message: 'Unknown error'
});
}
}

View File

@@ -0,0 +1,160 @@
/*!
* @license
* Copyright © 2005-2023 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 nock from 'nock';
import { BaseMock } from '../base.mock';
export class ProcessMock extends BaseMock {
get200Response(): void {
nock(this.host, { encodedQueryParams: true })
.post('/activiti-app/api/enterprise/process-instances/query')
.reply(200, {
size: 2,
total: 2,
start: 0,
data: [
{
id: '39',
name: 'Process Test Api - July 26th 2016',
businessKey: null,
processDefinitionId: 'ProcessTestApi:1:32',
tenantId: 'tenant_1',
started: '2016-07-26T15:31:00.414+0000',
ended: null,
startedBy: {
id: 1,
firstName: null,
lastName: 'Administrator',
email: 'admin@app.activiti.com'
},
processDefinitionName: 'Process Test Api',
processDefinitionDescription: null,
processDefinitionKey: 'ProcessTestApi',
processDefinitionCategory: 'https://www.activiti.org/processdef',
processDefinitionVersion: 1,
processDefinitionDeploymentId: '29',
graphicalNotationDefined: true,
startFormDefined: false,
suspended: false,
variables: []
},
{
id: '33',
name: 'Process Test Api - July 26th 2016',
businessKey: null,
processDefinitionId: 'ProcessTestApi:1:32',
tenantId: 'tenant_1',
started: '2016-07-26T15:30:58.367+0000',
ended: null,
startedBy: {
id: 1,
firstName: null,
lastName: 'Administrator',
email: 'admin@app.activiti.com'
},
processDefinitionName: 'Process Test Api',
processDefinitionDescription: null,
processDefinitionKey: 'ProcessTestApi',
processDefinitionCategory: 'https://www.activiti.org/processdef',
processDefinitionVersion: 1,
processDefinitionDeploymentId: '29',
graphicalNotationDefined: true,
startFormDefined: false,
suspended: false,
variables: []
}
]
});
}
get200getProcessDefinitionStartForm(): void {
nock(this.host, { encodedQueryParams: true })
.get('/activiti-app/api/enterprise/process-definitions/testProcess%3A1%3A7504/start-form')
.reply(200, {
id: 2002,
processDefinitionId: 'testProcess:1:7504',
processDefinitionName: 'test process',
processDefinitionKey: 'testProcess',
tabs: [],
fields: [
{
fieldType: 'DynamicTableRepresentation',
id: 'label',
name: 'Label',
type: 'dynamic-table',
value: null,
required: false,
readOnly: false,
overrideId: false,
colspan: 1,
placeholder: null,
minLength: 0,
maxLength: 0,
minValue: null,
maxValue: null,
regexPattern: null,
optionType: null,
hasEmptyValue: null,
options: null,
restUrl: null,
restResponsePath: null,
restIdProperty: null,
restLabelProperty: null,
tab: null,
className: null,
params: { existingColspan: 1, maxColspan: 1 },
layout: { row: -1, column: -1, colspan: 2 },
sizeX: 2,
sizeY: 2,
row: -1,
col: -1,
visibilityCondition: null,
columnDefinitions: [
{
id: 'user',
name: 'User',
type: 'Dropdown',
value: null,
optionType: 'rest',
options: [{ id: null, name: 'Option 1' }],
restResponsePath: null,
restUrl: 'https://jsonplaceholder.typicode.com/users',
restIdProperty: 'id',
restLabelProperty: 'name',
amountCurrency: null,
amountEnableFractions: false,
required: true,
editable: true,
sortable: true,
visible: true,
endpoint: null,
requestHeaders: null
}
]
}
],
outcomes: [],
javascriptEvents: [],
className: '',
style: '',
customFieldTemplates: {},
metadata: {},
variables: [],
gridsterForm: false
});
}
}

View File

@@ -0,0 +1,103 @@
/*!
* @license
* Copyright © 2005-2023 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 nock from 'nock';
import { BaseMock } from '../base.mock';
export class ProfileMock extends BaseMock {
get200getProfile(): void {
nock(this.host, { encodedQueryParams: true })
.get('/activiti-app/api/enterprise/profile')
.reply(200, {
id: 1,
firstName: null,
lastName: 'Administrator',
email: 'admin',
externalId: null,
company: null,
pictureId: null,
fullname: ' Administrator',
password: null,
type: 'enterprise',
status: 'active',
created: '2016-10-21T13:32:54.886+0000',
lastUpdate: '2016-10-23T22:16:48.252+0000',
tenantId: 1,
latestSyncTimeStamp: null,
groups: [
{
id: 1,
name: 'analytics-users',
externalId: null,
status: 'active',
tenantId: 1,
type: 0,
parentGroupId: null,
lastSyncTimeStamp: null,
userCount: null,
users: null,
capabilities: null,
groups: null,
manager: null
},
{
id: 2,
name: 'kickstart-users',
externalId: null,
status: 'active',
tenantId: 1,
type: 0,
parentGroupId: null,
lastSyncTimeStamp: null,
userCount: null,
users: null,
capabilities: null,
groups: null,
manager: null
},
{
id: 3,
name: 'Superusers',
externalId: null,
status: 'active',
tenantId: 1,
type: 0,
parentGroupId: null,
lastSyncTimeStamp: null,
userCount: null,
users: null,
capabilities: null,
groups: null,
manager: null
}
],
capabilities: null,
apps: [],
primaryGroup: null,
tenantPictureId: null,
tenantName: 'test'
});
}
get401getProfile(): void {
nock(this.host, { encodedQueryParams: true }).get('/activiti-app/api/enterprise/profile').reply(401);
}
get200getProfilePicture(): void {
nock(this.host, { encodedQueryParams: true }).get('/activiti-app/api/enterprise/profile-picture').reply(200, 'BUFFERSIZE');
}
}

View File

@@ -0,0 +1,212 @@
/*!
* @license
* Copyright © 2005-2023 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 nock from 'nock';
import { BaseMock } from '../base.mock';
const fakeReportList = [
{ id: 11011, name: 'Process definition heat map' },
{ id: 11012, name: 'Process definition overview' },
{ id: 11013, name: 'Process instances overview' },
{ id: 11014, name: 'Task overview' },
{ id: 11015, name: 'Task service level agreement' }
];
const fakeReportParams = {
id: 11013,
name: 'Process instances overview',
created: '2016-12-07T13:26:40.095+0000',
definition:
'{"parameters":[{"id":"processDefinitionId","name":null,"nameKey":"REPORTING.DEFAULT-REPORTS.PROCESS-INSTANCES-OVERVIEW.PROCESS-DEFINITION","type":"processDefinition","value":null,"dependsOn":null},' +
'{"id":"dateRange","name":null,"nameKey":"REPORTING.DEFAULT-REPORTS.PROCESS-INSTANCES-OVERVIEW.DATE-RANGE","type":"dateRange","value":null,"dependsOn":null},' +
'{"id":"slowProcessInstanceInteger","name":null,"nameKey":"REPORTING.DEFAULT-REPORTS.PROCESS-INSTANCES-OVERVIEW.SLOW-PROC-INST-NUMBER","type":"integer","value":10,"dependsOn":null},' +
'{"id":"status","name":null,"nameKey":"REPORTING.PROCESS-STATUS","type":"status","value":null,"dependsOn":null}' +
']}'
};
const fakeChartReports = {
elements: [
{
id: 'id10889073739455',
type: 'table',
rows: [
['__KEY_REPORTING.DEFAULT-REPORTS.PROCESS-DEFINITION-OVERVIEW.GENERAL-TABLE-TOTAL-PROCESS-DEFINITIONS', '10'],
['__KEY_REPORTING.DEFAULT-REPORTS.PROCESS-DEFINITION-OVERVIEW.GENERAL-TABLE-TOTAL-PROCESS-INSTANCES', '63'],
['__KEY_REPORTING.DEFAULT-REPORTS.PROCESS-DEFINITION-OVERVIEW.GENERAL-TABLE-ACTIVE-PROCESS-INSTANCES', '5'],
['__KEY_REPORTING.DEFAULT-REPORTS.PROCESS-DEFINITION-OVERVIEW.GENERAL-TABLE-COMPLETED-PROCESS-INSTANCES', '52']
],
collapseable: false,
collapsed: false,
showRowIndex: false
},
{
id: 'id10889073934509',
type: 'pieChart',
title: 'Total process instances overview',
titleKey: 'REPORTING.DEFAULT-REPORTS.PROCESS-DEFINITION-OVERVIEW.PROC-INST-CHART-TITLE',
values: [
{ key: 'Activiti', y: 13, keyAndValue: ['Activiti', '13'] },
{
key: 'Second Process',
y: 5,
keyAndValue: ['Second Process', '5']
},
{ key: 'Process Custom Name', y: 3, keyAndValue: ['Process Custom Name', '3'] },
{
key: 'Simple process',
y: 29,
keyAndValue: ['Simple process', '29']
},
{ key: 'Third Process', y: 7, keyAndValue: ['Third Process', '7'] }
]
},
{
id: 'id10889074082883',
type: 'table',
title: 'Process definition details',
titleKey: 'REPORTING.DEFAULT-REPORTS.PROCESS-DEFINITION-OVERVIEW.DETAIL-TABLE',
columnNames: ['Process definition', 'Total', 'Active', 'Completed'],
columnNameKeys: [
'REPORTING.DEFAULT-REPORTS.PROCESS-DEFINITION-OVERVIEW.DETAIL-TABLE-PROCESS',
'REPORTING.DEFAULT-REPORTS.PROCESS-DEFINITION-OVERVIEW.DETAIL-TABLE-TOTAL',
'REPORTING.DEFAULT-REPORTS.PROCESS-DEFINITION-OVERVIEW.DETAIL-TABLE-ACTIVE',
'REPORTING.DEFAULT-REPORTS.PROCESS-DEFINITION-OVERVIEW.DETAIL-TABLE-COMPLETED'
],
columnsCentered: [false, false, false, false],
rows: [
['Activiti', '13', '3', '10'],
['Process Custom Name', '3', '0', '3'],
['Second Process', '5', '1', '4'],
['Simple process', '29', '1', '28'],
['Third Process', '7', '0', '7']
],
collapseable: false,
collapsed: false,
showRowIndex: true
}
]
};
const fakeProcessDefinitionsNoApp: any[] = [
{
id: 'Process_sid-0FF10DA3-E2BD-4E6A-9013-6D66FC8A4716:1:30004',
name: 'Fake Process Name 1',
description: null,
key: 'Process_sid-0FF10DA3-E2BD-4E6A-9013-6D66FC8A4716',
category: 'https://www.activiti.org/processdef',
version: 1,
deploymentId: '30001',
tenantId: 'tenant_1',
metaDataValues: [],
hasStartForm: false
},
{
id: 'SecondProcess:1:15027',
name: 'Fake Process Name 2',
description: 'fdsdf',
key: 'SecondProcess',
category: 'https://www.activiti.org/processdef',
version: 1,
deploymentId: '15024',
tenantId: 'tenant_1',
metaDataValues: [],
hasStartForm: false
},
{
id: 'Simpleprocess:15:10004',
name: 'Fake Process Name 3',
description: null,
key: 'Simpleprocess',
category: 'https://www.activiti.org/processdef',
version: 15,
deploymentId: '10001',
tenantId: 'tenant_1',
metaDataValues: [],
hasStartForm: false
},
{
id: 'fruitorderprocess:5:42530',
name: 'Fake Process Name 4',
description: null,
key: 'fruitorderprocess',
category: 'https://www.activiti.org/processdef',
version: 5,
deploymentId: '42527',
tenantId: 'tenant_1',
metaDataValues: [],
hasStartForm: false
}
];
export class ReportsMock extends BaseMock {
get200ResponseCreateDefaultReport(): void {
nock(this.host, { encodedQueryParams: true }).post('/activiti-app/app/rest/reporting/default-reports').reply(200);
}
get200ResponseTasksByProcessDefinitionId(reportId: string, processDefinitionId: string): void {
nock(this.host, { encodedQueryParams: true })
.get('/activiti-app/app/rest/reporting/report-params/' + reportId + '/tasks')
.query({ processDefinitionId })
.reply(200, ['Fake Task 1', 'Fake Task 2', 'Fake Task 3']);
}
get200ResponseReportList(): void {
nock(this.host, { encodedQueryParams: true }).get('/activiti-app/app/rest/reporting/reports').reply(200, fakeReportList);
}
get200ResponseReportParams(reportId: string): void {
nock(this.host, { encodedQueryParams: true })
.get('/activiti-app/app/rest/reporting/report-params/' + reportId)
.reply(200, fakeReportParams);
}
get200ResponseReportsByParams(reportId: string, paramsQuery: { status: string }): void {
nock(this.host, { encodedQueryParams: true })
.post('/activiti-app/app/rest/reporting/report-params/' + reportId, paramsQuery)
.reply(200, fakeChartReports);
}
get200ResponseProcessDefinitions(): void {
nock(this.host, { encodedQueryParams: true })
.get('/activiti-app/app/rest/reporting/process-definitions')
.reply(200, fakeProcessDefinitionsNoApp);
}
get200ResponseUpdateReport(reportId: string): void {
nock(this.host, { encodedQueryParams: true })
.put('/activiti-app/app/rest/reporting/reports/' + reportId)
.reply(200);
}
get200ResponseExportReport(reportId: string): void {
nock(this.host, { encodedQueryParams: true })
.post('/activiti-app/app/rest/reporting/reports/' + reportId + '/export-to-csv')
.reply(200, 'CSV');
}
get200ResponseSaveReport(reportId: string): void {
nock(this.host, { encodedQueryParams: true })
.post('/activiti-app/app/rest/reporting/reports/' + reportId)
.reply(200);
}
get200ResponseDeleteReport(reportId: string): void {
nock(this.host, { encodedQueryParams: true })
.delete('/activiti-app/app/rest/reporting/reports/' + reportId)
.reply(200);
}
}

View File

@@ -0,0 +1,56 @@
/*!
* @license
* Copyright © 2005-2023 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 nock from 'nock';
import { BaseMock } from '../base.mock';
export class TaskFormMock extends BaseMock {
get200getTaskFormVariables(): void {
nock(this.host, { encodedQueryParams: true })
.get('/activiti-app/api/enterprise/task-forms/5028/variables')
.reply(
200,
[{ id: 'initiator', type: 'string', value: '1001' }],
[
'Server',
'Apache-Coyote/1.1',
'set-cookie',
'ACTIVITI_REMEMBER_ME=NjdOdGwvcUtFTkVEczQyMGh4WFp5QT09OmpUL1UwdFVBTC94QTJMTFFUVFgvdFE9PQ',
'X-Content-Type-Options',
'nosniff',
'X-XSS-Protection',
'1; mode=block',
'Cache-Control',
'no-cache, no-store, max-age=0, must-revalidate',
'Pragma',
'no-cache',
'Expires',
'0',
'X-Frame-Options',
'SAMEORIGIN',
'Content-Type',
'application/json',
'Transfer-Encoding',
'chunked',
'Date',
'Tue, 01 Nov 2016 19:43:36 GMT',
'Connection',
'close'
]
);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,66 @@
/*!
* @license
* Copyright © 2005-2023 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 nock from 'nock';
import { BaseMock } from '../base.mock';
export class UserFiltersMock extends BaseMock {
get200getUserTaskFilters(): void {
nock(this.host, { encodedQueryParams: true })
.get('/activiti-app/api/enterprise/filters/tasks')
.query({ appId: '1' })
.reply(200, {
size: 4,
total: 4,
start: 0,
data: [
{
id: 2,
name: 'Involved Tasks',
appId: 1,
recent: true,
icon: 'glyphicon-align-left',
filter: { sort: 'created-desc', name: '', state: 'open', assignment: 'involved' }
},
{
id: 4,
name: 'My Tasks',
appId: 1,
recent: false,
icon: 'glyphicon-inbox',
filter: { sort: 'created-desc', name: '', state: 'open', assignment: 'assignee' }
},
{
id: 1,
name: 'Queued Tasks',
appId: 1,
recent: false,
icon: 'glyphicon-record',
filter: { sort: 'created-desc', name: '', state: 'open', assignment: 'candidate' }
},
{
id: 3,
name: 'Completed Tasks',
appId: 1,
recent: false,
icon: 'glyphicon-ok-sign',
filter: { sort: 'created-desc', name: '', state: 'completed', assignment: 'involved' }
}
]
});
}
}