mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
[ACS-8688] export playwright shared lib (#4068)
* [ACS-8688] export playwright shared lib * [ACS-8688] changes name * [ACS-8688] changes name * [ACS-8688] add lint file and fix lint issue * [ACS-8688] test fix * added ng package file
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ApiClientFactory } from './api-client-factory';
|
||||
@@ -40,7 +40,7 @@ export class CategoriesApi {
|
||||
|
||||
async createCategory(categoryId: string, categoryBodyCreate: CategoryBody[], opts?: CategoryQuery): Promise<CategoryPaging | CategoryEntry> {
|
||||
try {
|
||||
return await this.apiService.categoriesApi.createSubcategories(categoryId, categoryBodyCreate, opts);
|
||||
return this.apiService.categoriesApi.createSubcategories(categoryId, categoryBodyCreate, opts);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return null;
|
||||
@@ -49,7 +49,7 @@ export class CategoriesApi {
|
||||
|
||||
async deleteCategory(categoryId: string): Promise<void> {
|
||||
if (categoryId === null) {
|
||||
console.log('categoryId is null, skipping deletion');
|
||||
console.error('categoryId is null, skipping deletion');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ export class CategoriesApi {
|
||||
opts?: CategoryQuery
|
||||
): Promise<CategoryPaging | CategoryEntry> {
|
||||
try {
|
||||
return await this.apiService.categoriesApi.linkNodeToCategory(nodeId, categoryLinkBodyCreate, opts);
|
||||
return this.apiService.categoriesApi.linkNodeToCategory(nodeId, categoryLinkBodyCreate, opts);
|
||||
} catch (error) {
|
||||
console.error(`${this.constructor.name} ${this.linkNodeToCategory.name}: ${error}`);
|
||||
return null;
|
||||
|
@@ -19,7 +19,7 @@
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ApiClientFactory } from './api-client-factory';
|
||||
@@ -38,7 +38,7 @@ export class FavoritesPageApi {
|
||||
return classObj;
|
||||
}
|
||||
async addFavoriteById(nodeType: 'file' | 'folder' | 'site', id: string): Promise<FavoriteEntry> {
|
||||
let guid = nodeType === 'site' ? (await this.apiService.sites.getSite(id)).entry.guid : id;
|
||||
const guid = nodeType === 'site' ? (await this.apiService.sites.getSite(id)).entry.guid : id;
|
||||
const data = {
|
||||
target: {
|
||||
[nodeType]: {
|
||||
@@ -46,7 +46,7 @@ export class FavoritesPageApi {
|
||||
}
|
||||
}
|
||||
};
|
||||
return await this.apiService.favorites.createFavorite('-me-', data);
|
||||
return this.apiService.favorites.createFavorite('-me-', data);
|
||||
}
|
||||
|
||||
async addFavoritesByIds(nodeType: 'file' | 'folder' | 'site', ids: string[]): Promise<FavoriteEntry[]> {
|
||||
@@ -64,7 +64,7 @@ export class FavoritesPageApi {
|
||||
|
||||
private async getFavorites(username: string): Promise<FavoritePaging> {
|
||||
try {
|
||||
return await this.apiService.favorites.listFavorites(username);
|
||||
return this.apiService.favorites.listFavorites(username);
|
||||
} catch {
|
||||
return new FavoritePaging();
|
||||
}
|
||||
@@ -89,7 +89,7 @@ export class FavoritesPageApi {
|
||||
return Promise.resolve(isFavorite);
|
||||
}
|
||||
};
|
||||
return await Utils.retryCall(favorite);
|
||||
return Utils.retryCall(favorite);
|
||||
} catch (error) {}
|
||||
return isFavorite;
|
||||
}
|
||||
@@ -112,7 +112,7 @@ export class FavoritesPageApi {
|
||||
return Promise.resolve(totalItems);
|
||||
}
|
||||
};
|
||||
return await Utils.retryCall(favoriteFiles);
|
||||
return Utils.retryCall(favoriteFiles);
|
||||
} catch {}
|
||||
}
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import * as fs from 'fs';
|
||||
@@ -43,7 +43,7 @@ export class FileActionsApi {
|
||||
|
||||
async uploadFile(fileLocation: string, fileName: string, parentFolderId: string): Promise<NodeEntry> {
|
||||
const file = fs.createReadStream(fileLocation);
|
||||
return await this.apiService.upload.uploadFile(file, '', parentFolderId, null, {
|
||||
return this.apiService.upload.uploadFile(file, '', parentFolderId, null, {
|
||||
name: fileName,
|
||||
nodeType: 'cm:content',
|
||||
renditions: 'doclib'
|
||||
@@ -71,7 +71,7 @@ export class FileActionsApi {
|
||||
};
|
||||
|
||||
try {
|
||||
return await this.apiService.upload.uploadFile(file, '', parentId, nodeProps, opts);
|
||||
return this.apiService.upload.uploadFile(file, '', parentId, nodeProps, opts);
|
||||
} catch (error) {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
@@ -87,7 +87,7 @@ export class FileActionsApi {
|
||||
|
||||
async getNodeById(id: string): Promise<NodeEntry | null> {
|
||||
try {
|
||||
return await this.apiService.nodes.getNode(id);
|
||||
return this.apiService.nodes.getNode(id);
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
@@ -126,7 +126,7 @@ export class FileActionsApi {
|
||||
return Promise.resolve(isLocked);
|
||||
}
|
||||
};
|
||||
return await Utils.retryCall(locked, data.retry);
|
||||
return Utils.retryCall(locked, data.retry);
|
||||
} catch {}
|
||||
return isLocked;
|
||||
}
|
||||
@@ -141,7 +141,7 @@ export class FileActionsApi {
|
||||
};
|
||||
|
||||
try {
|
||||
return await this.apiService.search.search(data);
|
||||
return this.apiService.search.search(data);
|
||||
} catch {
|
||||
return new ResultSetPaging();
|
||||
}
|
||||
@@ -172,7 +172,7 @@ export class FileActionsApi {
|
||||
comment: comment,
|
||||
name: newName
|
||||
};
|
||||
return await this.apiService.nodes.updateNodeContent(nodeId, content, opts);
|
||||
return this.apiService.nodes.updateNodeContent(nodeId, content, opts);
|
||||
} catch (error) {
|
||||
console.error(`${this.constructor.name} ${this.updateNodeContent.name}`, error);
|
||||
return Promise.reject(error);
|
||||
|
@@ -19,7 +19,7 @@
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { NodeBodyCreate } from '@alfresco/js-api';
|
||||
@@ -41,9 +41,8 @@ export function flattenNodeContentTree(content: NodeContentTree, relativePath: s
|
||||
const { name, files, folders, title, description } = content;
|
||||
const aspectNames: string[] = ['cm:versionable'];
|
||||
let data: NodeBodyCreate[] = [];
|
||||
let properties: any;
|
||||
|
||||
properties = {
|
||||
const properties = {
|
||||
[NODE_TITLE]: title,
|
||||
[NODE_DESCRIPTION]: description
|
||||
};
|
||||
|
@@ -19,7 +19,7 @@
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ApiClientFactory } from './api-client-factory';
|
||||
@@ -48,7 +48,7 @@ export class NodesApi {
|
||||
aspectNames: string[] = null
|
||||
): Promise<NodeEntry | null> {
|
||||
try {
|
||||
return await this.createNode('cm:folder', name, parentId, title, description, null, author, null, aspectNames);
|
||||
return this.createNode('cm:folder', name, parentId, title, description, null, author, null, aspectNames);
|
||||
} catch (error) {
|
||||
console.error(`${this.constructor.name} ${this.createFolder.name}`, error);
|
||||
return null;
|
||||
@@ -65,7 +65,7 @@ export class NodesApi {
|
||||
aspectNames: string[] = null
|
||||
): Promise<NodeEntry> {
|
||||
try {
|
||||
return await this.createNode('cm:content', name, parentId, title, description, null, author, majorVersion, aspectNames);
|
||||
return this.createNode('cm:content', name, parentId, title, description, null, author, majorVersion, aspectNames);
|
||||
} catch (error) {
|
||||
console.error(`${this.constructor.name} ${this.createFile.name}`, error);
|
||||
return null;
|
||||
@@ -74,7 +74,7 @@ export class NodesApi {
|
||||
|
||||
async createFiles(names: string[], relativePath = '/'): Promise<NodePaging> {
|
||||
try {
|
||||
return await this.createContent({ files: names }, relativePath);
|
||||
return this.createContent({ files: names }, relativePath);
|
||||
} catch (error) {
|
||||
console.error(`${this.constructor.name} ${this.createFiles.name}: ${error}`);
|
||||
return null;
|
||||
@@ -83,7 +83,7 @@ export class NodesApi {
|
||||
|
||||
async createFolders(names: string[], relativePath = '/'): Promise<NodePaging> {
|
||||
try {
|
||||
return await this.createContent({ folders: names }, relativePath);
|
||||
return this.createContent({ folders: names }, relativePath);
|
||||
} catch (error) {
|
||||
console.error(`${this.constructor.name} ${this.createFolders.name}: ${error}`);
|
||||
return null;
|
||||
@@ -128,7 +128,7 @@ export class NodesApi {
|
||||
}
|
||||
|
||||
try {
|
||||
return await this.apiService.nodes.createNode(parentId, nodeBody, {
|
||||
return this.apiService.nodes.createNode(parentId, nodeBody, {
|
||||
majorVersion
|
||||
});
|
||||
} catch (error) {
|
||||
@@ -139,7 +139,7 @@ export class NodesApi {
|
||||
|
||||
async renameNode(nodeId: string, newName: string): Promise<NodeEntry | null> {
|
||||
try {
|
||||
return await this.apiService.nodes.updateNode(nodeId, { name: newName });
|
||||
return this.apiService.nodes.updateNode(nodeId, { name: newName });
|
||||
} catch (error) {
|
||||
console.error(`${this.constructor.name} ${this.renameNode.name}`, error);
|
||||
return null;
|
||||
@@ -195,7 +195,7 @@ export class NodesApi {
|
||||
|
||||
async createContent(content: NodeContentTree, relativePath: string = '/'): Promise<NodePaging> {
|
||||
try {
|
||||
return await this.apiService.nodes.createNode('-my-', flattenNodeContentTree(content, relativePath) as any);
|
||||
return this.apiService.nodes.createNode('-my-', flattenNodeContentTree(content, relativePath) as any);
|
||||
} catch (error) {
|
||||
console.error(`${this.constructor.name} ${this.createContent.name}`, error);
|
||||
return null;
|
||||
@@ -204,7 +204,7 @@ export class NodesApi {
|
||||
|
||||
async getNodeById(id: string): Promise<NodeEntry | null> {
|
||||
try {
|
||||
return await this.apiService.nodes.getNode(id);
|
||||
return this.apiService.nodes.getNode(id);
|
||||
} catch (error) {
|
||||
console.error(`${this.constructor.name} ${this.getNodeById.name}`, error);
|
||||
return null;
|
||||
@@ -226,7 +226,7 @@ export class NodesApi {
|
||||
const opts = {
|
||||
include: ['properties']
|
||||
};
|
||||
return await this.apiService.nodes.listNodeChildren(nodeId, opts);
|
||||
return this.apiService.nodes.listNodeChildren(nodeId, opts);
|
||||
} catch (error) {
|
||||
console.error(`${this.constructor.name} ${this.getNodeChildren.name}`, error);
|
||||
return null;
|
||||
@@ -304,7 +304,7 @@ export class NodesApi {
|
||||
};
|
||||
|
||||
try {
|
||||
return await this.apiService.nodes.updateNode(nodeId, data);
|
||||
return this.apiService.nodes.updateNode(nodeId, data);
|
||||
} catch (error) {
|
||||
console.error(`${this.constructor.name} ${this.setGranularPermission.name}`, error);
|
||||
return null;
|
||||
@@ -343,7 +343,7 @@ export class NodesApi {
|
||||
};
|
||||
|
||||
try {
|
||||
return await this.apiService.nodes.updateNode(nodeId, data);
|
||||
return this.apiService.nodes.updateNode(nodeId, data);
|
||||
} catch (error) {
|
||||
console.error(`${this.constructor.name} ${this.setInheritPermissions.name}`, error);
|
||||
return null;
|
||||
@@ -352,7 +352,7 @@ export class NodesApi {
|
||||
|
||||
private async addAspects(nodeId: string, aspectNames: string[]): Promise<NodeEntry> {
|
||||
try {
|
||||
return await this.apiService.nodes.updateNode(nodeId, { aspectNames });
|
||||
return this.apiService.nodes.updateNode(nodeId, { aspectNames });
|
||||
} catch (error) {
|
||||
console.error(`${this.constructor.name} ${this.addAspects.name}`, error);
|
||||
return null;
|
||||
|
@@ -19,7 +19,7 @@
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export interface PersonModel {
|
||||
|
@@ -19,7 +19,7 @@
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { FindQuery } from '@alfresco/js-api';
|
||||
@@ -50,7 +50,7 @@ export class QueriesApi {
|
||||
}
|
||||
};
|
||||
|
||||
return await Utils.retryCall(sites);
|
||||
return Utils.retryCall(sites);
|
||||
} catch (error) {
|
||||
console.error(`QueriesApi waitForSites : catch : `);
|
||||
console.error(`\tExpected: ${data.expect} items, but found ${error}`);
|
||||
|
@@ -53,7 +53,7 @@ export class RulesApi {
|
||||
async createRandomRule(folderId: string, ruleName: string): Promise<Rule> {
|
||||
const randomActionsIndex = crypto.randomInt(0, ActionTypes.actions.length);
|
||||
const randomAction = ActionTypes.actions[randomActionsIndex];
|
||||
return await this.createRule(folderId, {
|
||||
return this.createRule(folderId, {
|
||||
name: ruleName,
|
||||
isEnabled: true,
|
||||
actions: [randomAction]
|
||||
@@ -66,13 +66,13 @@ export class RulesApi {
|
||||
}
|
||||
const randomActionsIndex = crypto.randomInt(0, ActionTypes.actions.length);
|
||||
const randomAction = ActionTypes.actions[randomActionsIndex];
|
||||
let conditionsArray = [];
|
||||
const conditionsArray = [];
|
||||
for (let i = 0; i < numOfConditions; i++) {
|
||||
const randomIndex = crypto.randomInt(0, ConditionsTypes.conditions.length);
|
||||
const randomCondition = ConditionsTypes.conditions[randomIndex];
|
||||
conditionsArray.push(randomCondition);
|
||||
}
|
||||
return await this.createRule(folderId, {
|
||||
return this.createRule(folderId, {
|
||||
name: ruleName,
|
||||
isEnabled: true,
|
||||
actions: [randomAction],
|
||||
@@ -88,24 +88,30 @@ export class RulesApi {
|
||||
if (numOfActions > ActionTypes.actions.length) {
|
||||
numOfActions = ActionTypes.actions.length;
|
||||
}
|
||||
let actionsArray = [];
|
||||
const actionsArray = [];
|
||||
for (let i = 0; i < numOfActions; i++) {
|
||||
const randomIndex = crypto.randomInt(0, ActionTypes.actions.length);
|
||||
const randomAction = ActionTypes.actions[randomIndex];
|
||||
actionsArray.push(randomAction);
|
||||
}
|
||||
return await this.createRule(folderId, {
|
||||
return this.createRule(folderId, {
|
||||
name: ruleName,
|
||||
isEnabled: true,
|
||||
actions: actionsArray
|
||||
});
|
||||
}
|
||||
|
||||
async createRandomComplexRule(folderId: string, ruleName: string, numOfConditions: number, numOfActions: number, ruleDescription?: string): Promise<Rule> {
|
||||
async createRandomComplexRule(
|
||||
folderId: string,
|
||||
ruleName: string,
|
||||
numOfConditions: number,
|
||||
numOfActions: number,
|
||||
ruleDescription?: string
|
||||
): Promise<Rule> {
|
||||
if (numOfConditions > ConditionsTypes.conditions.length) {
|
||||
numOfConditions = ConditionsTypes.conditions.length;
|
||||
}
|
||||
let conditionsArray = [];
|
||||
const conditionsArray = [];
|
||||
for (let i = 0; i < numOfConditions; i++) {
|
||||
const randomIndex = crypto.randomInt(0, ConditionsTypes.conditions.length);
|
||||
const randomCondition = ConditionsTypes.conditions[randomIndex];
|
||||
@@ -114,13 +120,13 @@ export class RulesApi {
|
||||
if (numOfActions > ActionTypes.actions.length) {
|
||||
numOfActions = ActionTypes.actions.length;
|
||||
}
|
||||
let actionsArray = [];
|
||||
const actionsArray = [];
|
||||
for (let i = 0; i < numOfActions; i++) {
|
||||
const randomIndex = crypto.randomInt(0, ActionTypes.actions.length);
|
||||
const randomAction = ActionTypes.actions[randomIndex];
|
||||
actionsArray.push(randomAction);
|
||||
}
|
||||
return await this.createRule(folderId, {
|
||||
return this.createRule(folderId, {
|
||||
name: ruleName,
|
||||
description: ruleDescription,
|
||||
isEnabled: true,
|
||||
@@ -134,7 +140,7 @@ export class RulesApi {
|
||||
}
|
||||
|
||||
async createRuleWithRandomAspects(folderId: string, ruleName: string): Promise<Rule> {
|
||||
return await this.createRule(folderId, {
|
||||
return this.createRule(folderId, {
|
||||
name: ruleName,
|
||||
isEnabled: true,
|
||||
actions: [
|
||||
@@ -166,7 +172,7 @@ export class RulesApi {
|
||||
actionType: 'move' | 'copy' | 'import',
|
||||
destinationFolderId: string
|
||||
): Promise<Rule> {
|
||||
return await this.createRule(folderId, {
|
||||
return this.createRule(folderId, {
|
||||
name: ruleName,
|
||||
isEnabled: true,
|
||||
actions: [
|
||||
|
@@ -19,7 +19,7 @@
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ApiClientFactory } from './api-client-factory';
|
||||
@@ -52,7 +52,7 @@ export class SearchPageApi {
|
||||
};
|
||||
|
||||
try {
|
||||
return await this.apiService.search.search(data);
|
||||
return this.apiService.search.search(data);
|
||||
} catch {
|
||||
return new ResultSetPaging();
|
||||
}
|
||||
@@ -73,7 +73,7 @@ export class SearchPageApi {
|
||||
}
|
||||
};
|
||||
|
||||
return await Utils.retryCall(searchFiles);
|
||||
return Utils.retryCall(searchFiles);
|
||||
} catch {}
|
||||
}
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ApiClientFactory } from './api-client-factory';
|
||||
@@ -44,7 +44,7 @@ export class SharedLinksApi {
|
||||
nodeId: id,
|
||||
expiresAt: expireDate
|
||||
};
|
||||
return await this.apiService.share.createSharedLink(data);
|
||||
return this.apiService.share.createSharedLink(data);
|
||||
} catch (error) {
|
||||
return null;
|
||||
}
|
||||
@@ -70,7 +70,7 @@ export class SharedLinksApi {
|
||||
const opts = {
|
||||
maxItems
|
||||
};
|
||||
return await this.apiService.share.listSharedLinks(opts);
|
||||
return this.apiService.share.listSharedLinks(opts);
|
||||
} catch (error) {
|
||||
console.error(`SharedLinksApi getSharedLinks : catch : `, error);
|
||||
return new SharedLinkPaging();
|
||||
@@ -89,7 +89,7 @@ export class SharedLinksApi {
|
||||
}
|
||||
};
|
||||
|
||||
return await Utils.retryCall(sharedFile);
|
||||
return Utils.retryCall(sharedFile);
|
||||
} catch (error) {
|
||||
console.error(`SharedLinksApi waitForFilesToBeShared : catch : ${error}`);
|
||||
console.error(`\tWait timeout reached waiting for files to be shared`);
|
||||
@@ -110,7 +110,7 @@ export class SharedLinksApi {
|
||||
async unshareFileById(fileId: string): Promise<void> {
|
||||
try {
|
||||
const sharedId = await this.getSharedIdOfNode(fileId);
|
||||
return await this.apiService.share.deleteSharedLink(sharedId);
|
||||
return this.apiService.share.deleteSharedLink(sharedId);
|
||||
} catch (error) {
|
||||
console.error(`SharedLinksApi unshareFileById : catch : `, error);
|
||||
}
|
||||
@@ -132,7 +132,7 @@ export class SharedLinksApi {
|
||||
}
|
||||
};
|
||||
|
||||
return await Utils.retryCall(sharedFile);
|
||||
return Utils.retryCall(sharedFile);
|
||||
} catch (error) {
|
||||
console.error(`SharedLinksApi waitForFilesToNotBeShared : catch : ${error}`);
|
||||
console.error(`\tWait timeout reached waiting for files to no longer be shared`);
|
||||
|
@@ -19,7 +19,7 @@
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ApiClientFactory } from './api-client-factory';
|
||||
@@ -55,7 +55,7 @@ export class SitesApi {
|
||||
} as SiteBodyCreate;
|
||||
|
||||
try {
|
||||
return await this.apiService.sites.createSite(site);
|
||||
return this.apiService.sites.createSite(site);
|
||||
} catch (error) {
|
||||
console.error(`SitesApi createSite : catch : `, error);
|
||||
return null;
|
||||
@@ -94,7 +94,7 @@ export class SitesApi {
|
||||
} as SiteMembershipBodyUpdate;
|
||||
|
||||
try {
|
||||
return await this.apiService.sites.updateSiteMembership(siteId, userId, siteRole);
|
||||
return this.apiService.sites.updateSiteMembership(siteId, userId, siteRole);
|
||||
} catch (error) {
|
||||
console.error(`SitesApi updateSiteMember : catch : `, error);
|
||||
return new SiteMemberEntry();
|
||||
@@ -108,7 +108,7 @@ export class SitesApi {
|
||||
} as SiteMembershipBodyCreate;
|
||||
|
||||
try {
|
||||
return await this.apiService.sites.createSiteMembership(siteId, memberBody);
|
||||
return this.apiService.sites.createSiteMembership(siteId, memberBody);
|
||||
} catch (error) {
|
||||
if (error.status === 409) {
|
||||
return this.updateSiteMember(siteId, userId, role);
|
||||
@@ -125,7 +125,7 @@ export class SitesApi {
|
||||
} as SiteMembershipRequestBodyCreate;
|
||||
|
||||
try {
|
||||
return await this.apiService.sites.createSiteMembershipRequestForPerson(personId, body);
|
||||
return this.apiService.sites.createSiteMembershipRequestForPerson(personId, body);
|
||||
} catch (error) {
|
||||
console.error(`SitesApi createSiteMembershipRequestForPerson : catch : `, error);
|
||||
return null;
|
||||
@@ -134,7 +134,7 @@ export class SitesApi {
|
||||
|
||||
async approveSiteMembershipRequest(siteId: string, inviteeId: string): Promise<SiteMemberEntry> {
|
||||
try {
|
||||
return await this.apiService.sites.approveSiteMembershipRequest(siteId, inviteeId);
|
||||
return this.apiService.sites.approveSiteMembershipRequest(siteId, inviteeId);
|
||||
} catch (error) {
|
||||
console.error(`SitesApi approveSiteMembershipRequest : catch : `, error);
|
||||
return null;
|
||||
@@ -153,7 +153,7 @@ export class SitesApi {
|
||||
|
||||
async deleteSiteMember(siteId: string, userId: string) {
|
||||
try {
|
||||
return await this.apiService.sites.deleteSiteMembership(siteId, userId);
|
||||
return this.apiService.sites.deleteSiteMembership(siteId, userId);
|
||||
} catch (error) {
|
||||
console.error(`SitesApi deleteSiteMember : catch : `, error);
|
||||
}
|
||||
@@ -161,7 +161,7 @@ export class SitesApi {
|
||||
|
||||
async getSite(siteId: string): Promise<SiteEntry> {
|
||||
try {
|
||||
return await this.apiService.sites.getSite(siteId);
|
||||
return this.apiService.sites.getSite(siteId);
|
||||
} catch (error) {
|
||||
console.error(`SitesApi getSite : catch : `, error);
|
||||
return null;
|
||||
|
@@ -19,7 +19,7 @@
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { TagBody, TagEntry } from '@alfresco/js-api';
|
||||
@@ -40,7 +40,7 @@ export class TagsApi {
|
||||
|
||||
async createTags(tags: TagBody[]): Promise<TagEntry[]> {
|
||||
try {
|
||||
return await this.apiService.tagsApi.createTags(tags);
|
||||
return this.apiService.tagsApi.createTags(tags);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return null;
|
||||
@@ -49,7 +49,7 @@ export class TagsApi {
|
||||
|
||||
async assignTagToNode(nodeId: string, tag: TagBody): Promise<TagEntry> {
|
||||
try {
|
||||
return await this.apiService.tagsApi.assignTagToNode(nodeId, tag);
|
||||
return this.apiService.tagsApi.assignTagToNode(nodeId, tag);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return null;
|
||||
@@ -58,7 +58,7 @@ export class TagsApi {
|
||||
|
||||
async deleteTag(tagId: string): Promise<void> {
|
||||
try {
|
||||
return await this.apiService.tagsApi.deleteTag(tagId);
|
||||
return this.apiService.tagsApi.deleteTag(tagId);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ApiClientFactory } from './api-client-factory';
|
||||
@@ -33,25 +33,24 @@ export class TrashcanApi {
|
||||
return classObj;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Empties the trashcan. Uses multiple batches 1000 nodes each.
|
||||
*/
|
||||
async emptyTrashcan(): Promise<void> {
|
||||
try {
|
||||
const nodes = await this.apiService.trashCan.listDeletedNodes({
|
||||
maxItems: 1000
|
||||
});
|
||||
async emptyTrashcan(): Promise<void> {
|
||||
try {
|
||||
const nodes = await this.apiService.trashCan.listDeletedNodes({
|
||||
maxItems: 1000
|
||||
});
|
||||
|
||||
if (nodes?.list?.entries?.length > 0) {
|
||||
const ids = nodes.list.entries.map((entries) => entries.entry.id);
|
||||
if (nodes?.list?.entries?.length > 0) {
|
||||
const ids = nodes.list.entries.map((entries) => entries.entry.id);
|
||||
|
||||
for (const nodeId of ids) {
|
||||
await this.apiService.trashCan.deleteDeletedNode(nodeId);
|
||||
}
|
||||
for (const nodeId of ids) {
|
||||
await this.apiService.trashCan.deleteDeletedNode(nodeId);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('User Actions - emptyTrashcan failed : ', error);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('User Actions - emptyTrashcan failed : ', error);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user