@alfresco/aca-playwright-shared 7.4.1 → 7.5.0-24770823677
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AlfrescoApi, SitesApi as SitesApi$1, UploadApi, NodesApi as NodesApi$1, PeopleApi, AdminUsersApi, AdminTenantsApi, GroupsApi, QueriesApi as QueriesApi$1, SearchApi as SearchApi$1, SecurityGroupsApi, SecurityMarksApi, SharedlinksApi, FavoritesApi, TrashcanApi as TrashcanApi$1, CommentsApi, CategoriesApi as CategoriesApi$1, TagsApi as TagsApi$1, ResultSetPaging, SharedLinkPaging, FavoritePaging, Site, SiteMemberEntry } from '@alfresco/js-api';
|
|
1
|
+
import { AlfrescoApi, SitesApi as SitesApi$1, UploadApi, NodesApi as NodesApi$1, PeopleApi, AdminUsersApi, AdminTenantsApi, GroupsApi, QueriesApi as QueriesApi$1, SearchApi as SearchApi$1, SecurityGroupsApi, SecurityMarksApi, ContentClient, SharedlinksApi, FavoritesApi, TrashcanApi as TrashcanApi$1, CommentsApi, CategoriesApi as CategoriesApi$1, TagsApi as TagsApi$1, ResultSetPaging, SharedLinkPaging, FavoritePaging, Site, SiteMemberEntry } from '@alfresco/js-api';
|
|
2
2
|
import { expect, chromium, devices, test as test$1 } from '@playwright/test';
|
|
3
3
|
import * as path from 'path';
|
|
4
4
|
import { resolve } from 'path';
|
|
@@ -4657,9 +4657,6 @@ const config = {
|
|
|
4657
4657
|
class ApiClientFactory {
|
|
4658
4658
|
constructor() {
|
|
4659
4659
|
this.alfrescoApi = new AlfrescoApi(config);
|
|
4660
|
-
}
|
|
4661
|
-
async setUpAcaBackend(userName, password) {
|
|
4662
|
-
await this.login(userName, password);
|
|
4663
4660
|
this.sites = new SitesApi$1(this.alfrescoApi);
|
|
4664
4661
|
this.upload = new UploadApi(this.alfrescoApi);
|
|
4665
4662
|
this.nodes = new NodesApi$1(this.alfrescoApi);
|
|
@@ -4671,6 +4668,7 @@ class ApiClientFactory {
|
|
|
4671
4668
|
this.search = new SearchApi$1(this.alfrescoApi);
|
|
4672
4669
|
this.securityGroupsApi = new SecurityGroupsApi(this.alfrescoApi);
|
|
4673
4670
|
this.securityMarksApi = new SecurityMarksApi(this.alfrescoApi);
|
|
4671
|
+
this.contentClient = new ContentClient(config, '/alfresco');
|
|
4674
4672
|
this.share = new SharedlinksApi(this.alfrescoApi);
|
|
4675
4673
|
this.favorites = new FavoritesApi(this.alfrescoApi);
|
|
4676
4674
|
this.trashCan = new TrashcanApi$1(this.alfrescoApi);
|
|
@@ -4678,6 +4676,9 @@ class ApiClientFactory {
|
|
|
4678
4676
|
this.queriesApi = new QueriesApi$1(this.alfrescoApi);
|
|
4679
4677
|
this.categoriesApi = new CategoriesApi$1(this.alfrescoApi);
|
|
4680
4678
|
this.tagsApi = new TagsApi$1(this.alfrescoApi);
|
|
4679
|
+
}
|
|
4680
|
+
async setUpAcaBackend(userName, password) {
|
|
4681
|
+
await this.login(userName, password);
|
|
4681
4682
|
return this;
|
|
4682
4683
|
}
|
|
4683
4684
|
async tearDown() {
|
|
@@ -4685,26 +4686,30 @@ class ApiClientFactory {
|
|
|
4685
4686
|
return this;
|
|
4686
4687
|
}
|
|
4687
4688
|
async login(userName, password) {
|
|
4688
|
-
const predefinedUserKey = Object.keys(users).find((
|
|
4689
|
+
const predefinedUserKey = Object.keys(users).find((userAlias) => userAlias === userName || users[userAlias].username === userName);
|
|
4689
4690
|
const userToLog = predefinedUserKey ? users[predefinedUserKey] : undefined;
|
|
4690
|
-
let e;
|
|
4691
4691
|
const user = userToLog?.username ?? userName;
|
|
4692
4692
|
const userPassword = userToLog?.password ?? password;
|
|
4693
|
+
if (!userPassword) {
|
|
4694
|
+
throw new Error(`[API Client Factory] No password provided for user ${user}`);
|
|
4695
|
+
}
|
|
4693
4696
|
try {
|
|
4694
|
-
|
|
4697
|
+
await this.alfrescoApi.login(user, userPassword);
|
|
4695
4698
|
}
|
|
4696
4699
|
catch (error) {
|
|
4697
|
-
|
|
4700
|
+
logger.error(`[API Client Factory] Log in user ${user} failed ${error}`);
|
|
4698
4701
|
throw error;
|
|
4699
4702
|
}
|
|
4700
4703
|
}
|
|
4701
4704
|
async loginUser(user) {
|
|
4702
|
-
|
|
4705
|
+
if (!user.username || !user.password) {
|
|
4706
|
+
throw new Error(`[API Client Factory] No username or password provided`);
|
|
4707
|
+
}
|
|
4703
4708
|
try {
|
|
4704
|
-
|
|
4709
|
+
await this.alfrescoApi.login(user.username, user.password);
|
|
4705
4710
|
}
|
|
4706
4711
|
catch (error) {
|
|
4707
|
-
|
|
4712
|
+
logger.error(`[API Client Factory] Log in user ${user.username} failed ${error}`);
|
|
4708
4713
|
throw error;
|
|
4709
4714
|
}
|
|
4710
4715
|
}
|
|
@@ -4712,20 +4717,20 @@ class ApiClientFactory {
|
|
|
4712
4717
|
const person = new Person(user);
|
|
4713
4718
|
const peopleApi = new PeopleApi(this.alfrescoApi);
|
|
4714
4719
|
try {
|
|
4715
|
-
return peopleApi.createPerson(person);
|
|
4720
|
+
return await peopleApi.createPerson(person);
|
|
4716
4721
|
}
|
|
4717
4722
|
catch (error) {
|
|
4718
|
-
|
|
4723
|
+
logger.error(`[API Client Factory] createUser failed: ${error}`);
|
|
4719
4724
|
return null;
|
|
4720
4725
|
}
|
|
4721
4726
|
}
|
|
4722
4727
|
async changePassword(username, newPassword) {
|
|
4723
4728
|
const peopleApi = new PeopleApi(this.alfrescoApi);
|
|
4724
4729
|
try {
|
|
4725
|
-
return peopleApi.updatePerson(username, { password: newPassword });
|
|
4730
|
+
return await peopleApi.updatePerson(username, { password: newPassword });
|
|
4726
4731
|
}
|
|
4727
4732
|
catch (error) {
|
|
4728
|
-
|
|
4733
|
+
logger.error(`[API Client Factory] changePassword failed: ${error}`);
|
|
4729
4734
|
return null;
|
|
4730
4735
|
}
|
|
4731
4736
|
}
|
|
@@ -5119,7 +5124,9 @@ class FileActionsApi {
|
|
|
5119
5124
|
}
|
|
5120
5125
|
catch {
|
|
5121
5126
|
const actual = await apiCall();
|
|
5122
|
-
|
|
5127
|
+
const message = `waitForNodes: Timed out waiting for "${searchTerm}" — expected ${data.expect} nodes, found ${actual}`;
|
|
5128
|
+
logger.error(message);
|
|
5129
|
+
throw new Error(message);
|
|
5123
5130
|
}
|
|
5124
5131
|
}
|
|
5125
5132
|
async queryNodesSearchHighlight(searchTerm) {
|
|
@@ -5164,16 +5171,16 @@ class FileActionsApi {
|
|
|
5164
5171
|
return (await this.queryNodesSearchHighlight(searchTerm)).list.pagination.totalItems;
|
|
5165
5172
|
}
|
|
5166
5173
|
catch (error) {
|
|
5167
|
-
|
|
5174
|
+
logger.warn(`queryNodesSearchHighlight failed for "${searchTerm}": ${error}`);
|
|
5168
5175
|
return 0;
|
|
5169
5176
|
}
|
|
5170
5177
|
};
|
|
5171
5178
|
try {
|
|
5172
5179
|
await waitForApi(apiCall, predicate, 30, 2500);
|
|
5173
|
-
|
|
5180
|
+
logger.log(`waitForNodesSearchHighlight: Found ${data.expect} nodes with search term "${searchTerm}"`);
|
|
5174
5181
|
}
|
|
5175
5182
|
catch (error) {
|
|
5176
|
-
|
|
5183
|
+
logger.error(`Error: ${error}`);
|
|
5177
5184
|
}
|
|
5178
5185
|
}
|
|
5179
5186
|
async updateNodeContent(nodeId, content, majorVersion = true, comment, newName) {
|
|
@@ -5183,10 +5190,10 @@ class FileActionsApi {
|
|
|
5183
5190
|
comment: comment,
|
|
5184
5191
|
name: newName
|
|
5185
5192
|
};
|
|
5186
|
-
return this.apiService.nodes.updateNodeContent(nodeId, content, opts);
|
|
5193
|
+
return await this.apiService.nodes.updateNodeContent(nodeId, content, opts);
|
|
5187
5194
|
}
|
|
5188
5195
|
catch (error) {
|
|
5189
|
-
|
|
5196
|
+
logger.error(`${this.constructor.name} ${this.updateNodeContent.name}: ${error}`);
|
|
5190
5197
|
return Promise.reject(error);
|
|
5191
5198
|
}
|
|
5192
5199
|
}
|
|
@@ -5230,7 +5237,7 @@ class SharedLinksApi {
|
|
|
5230
5237
|
nodeId: id,
|
|
5231
5238
|
expiresAt: expireDate
|
|
5232
5239
|
};
|
|
5233
|
-
return this.apiService.share.createSharedLink(data);
|
|
5240
|
+
return await this.apiService.share.createSharedLink(data);
|
|
5234
5241
|
}
|
|
5235
5242
|
catch (error) {
|
|
5236
5243
|
return null;
|
|
@@ -5242,12 +5249,14 @@ class SharedLinksApi {
|
|
|
5242
5249
|
if (ids && ids.length > 0) {
|
|
5243
5250
|
for (const id of ids) {
|
|
5244
5251
|
const sharedLink = await this.shareFileById(id, expireDate);
|
|
5245
|
-
|
|
5252
|
+
if (sharedLink) {
|
|
5253
|
+
sharedLinks.push(sharedLink);
|
|
5254
|
+
}
|
|
5246
5255
|
}
|
|
5247
5256
|
}
|
|
5248
5257
|
}
|
|
5249
5258
|
catch (error) {
|
|
5250
|
-
|
|
5259
|
+
logger.error(`SharedLinksApi shareFilesByIds : catch : ${error}`);
|
|
5251
5260
|
}
|
|
5252
5261
|
return sharedLinks;
|
|
5253
5262
|
}
|
|
@@ -5256,71 +5265,64 @@ class SharedLinksApi {
|
|
|
5256
5265
|
const opts = {
|
|
5257
5266
|
maxItems
|
|
5258
5267
|
};
|
|
5259
|
-
return this.apiService.share.listSharedLinks(opts);
|
|
5268
|
+
return await this.apiService.share.listSharedLinks(opts);
|
|
5260
5269
|
}
|
|
5261
5270
|
catch (error) {
|
|
5262
|
-
|
|
5271
|
+
logger.error(`SharedLinksApi getSharedLinks : catch : ${error}`);
|
|
5263
5272
|
return new SharedLinkPaging();
|
|
5264
5273
|
}
|
|
5265
5274
|
}
|
|
5266
|
-
async waitForFilesToBeShared(
|
|
5275
|
+
async waitForFilesToBeShared(fileIds) {
|
|
5267
5276
|
try {
|
|
5268
5277
|
const sharedFile = async () => {
|
|
5269
|
-
const sharedFiles = (await this.getSharedLinks()).list
|
|
5270
|
-
const foundItems =
|
|
5271
|
-
if (foundItems) {
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
return Promise.reject(foundItems);
|
|
5278
|
+
const sharedFiles = (await this.getSharedLinks()).list?.entries?.map((link) => link.entry.nodeId) ?? [];
|
|
5279
|
+
const foundItems = fileIds.every((id) => sharedFiles.includes(id));
|
|
5280
|
+
if (!foundItems) {
|
|
5281
|
+
const message = 'Not all files are shared yet';
|
|
5282
|
+
logger.error(message);
|
|
5283
|
+
throw new Error(message);
|
|
5276
5284
|
}
|
|
5277
5285
|
};
|
|
5278
|
-
|
|
5286
|
+
await Utils.retryCall(sharedFile);
|
|
5279
5287
|
}
|
|
5280
5288
|
catch (error) {
|
|
5281
|
-
|
|
5282
|
-
console.error(`\tWait timeout reached waiting for files to be shared`);
|
|
5289
|
+
logger.error(`SharedLinksApi waitForFilesToBeShared : catch : ${error} - Wait timeout reached waiting for files to be shared`);
|
|
5283
5290
|
}
|
|
5284
5291
|
}
|
|
5285
5292
|
async getSharedIdOfNode(fileId) {
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
console.error(`SharedLinksApi getSharedIdOfNode : catch : `, error);
|
|
5293
|
-
return null;
|
|
5293
|
+
const sharedLinksEntries = (await this.getSharedLinks())?.list?.entries ?? [];
|
|
5294
|
+
const found = sharedLinksEntries.find((sharedLink) => sharedLink.entry.nodeId === fileId);
|
|
5295
|
+
if (!found?.entry.id) {
|
|
5296
|
+
const message = `SharedLinksApi getSharedIdOfNode: no shared link found for node ${fileId}`;
|
|
5297
|
+
logger.error(message);
|
|
5298
|
+
throw new Error(message);
|
|
5294
5299
|
}
|
|
5300
|
+
return found.entry.id;
|
|
5295
5301
|
}
|
|
5296
5302
|
async unshareFileById(fileId) {
|
|
5297
5303
|
try {
|
|
5298
5304
|
const sharedId = await this.getSharedIdOfNode(fileId);
|
|
5299
|
-
|
|
5305
|
+
await this.apiService.share.deleteSharedLink(sharedId);
|
|
5300
5306
|
}
|
|
5301
5307
|
catch (error) {
|
|
5302
|
-
|
|
5308
|
+
logger.error(`SharedLinksApi unshareFileById : catch : ${error}`);
|
|
5303
5309
|
}
|
|
5304
5310
|
}
|
|
5305
|
-
async waitForFilesToNotBeShared(
|
|
5311
|
+
async waitForFilesToNotBeShared(fileIds) {
|
|
5306
5312
|
try {
|
|
5307
5313
|
const sharedFile = async () => {
|
|
5308
|
-
const sharedFiles = (await this.getSharedLinks()).list
|
|
5309
|
-
const foundItems =
|
|
5310
|
-
return sharedFiles.includes(id);
|
|
5311
|
-
});
|
|
5314
|
+
const sharedFiles = (await this.getSharedLinks()).list?.entries?.map((link) => link.entry.nodeId) ?? [];
|
|
5315
|
+
const foundItems = fileIds.some((id) => sharedFiles.includes(id));
|
|
5312
5316
|
if (foundItems) {
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
return Promise.resolve(foundItems);
|
|
5317
|
+
const message = 'Some files are still shared';
|
|
5318
|
+
logger.error(message);
|
|
5319
|
+
throw new Error(message);
|
|
5317
5320
|
}
|
|
5318
5321
|
};
|
|
5319
|
-
|
|
5322
|
+
await Utils.retryCall(sharedFile);
|
|
5320
5323
|
}
|
|
5321
5324
|
catch (error) {
|
|
5322
|
-
|
|
5323
|
-
console.error(`\tWait timeout reached waiting for files to no longer be shared`);
|
|
5325
|
+
logger.error(`SharedLinksApi waitForFilesToNotBeShared : catch : ${error} - Wait timeout reached waiting for files to no longer be shared`);
|
|
5324
5326
|
}
|
|
5325
5327
|
}
|
|
5326
5328
|
}
|
|
@@ -5446,7 +5448,7 @@ class FavoritesPageApi {
|
|
|
5446
5448
|
}
|
|
5447
5449
|
}
|
|
5448
5450
|
catch (error) {
|
|
5449
|
-
|
|
5451
|
+
logger.error(`FavoritesApi: removeFavoritesByIds failed: ${error}`);
|
|
5450
5452
|
}
|
|
5451
5453
|
}
|
|
5452
5454
|
}
|
|
@@ -5555,7 +5557,9 @@ class NodesApi {
|
|
|
5555
5557
|
return await this.createNode('cm:folder', name, parentId, title, description, null, author, true, aspectNames);
|
|
5556
5558
|
}
|
|
5557
5559
|
catch (error) {
|
|
5558
|
-
|
|
5560
|
+
const message = `${this.constructor.name} ${this.createFolder.name}: ${error}`;
|
|
5561
|
+
logger.error(message);
|
|
5562
|
+
throw new Error(message);
|
|
5559
5563
|
}
|
|
5560
5564
|
}
|
|
5561
5565
|
async createFile(name, parentId = '-my-', title = '', description = '', author = '', majorVersion = true, aspectNames = []) {
|
|
@@ -5563,7 +5567,9 @@ class NodesApi {
|
|
|
5563
5567
|
return await this.createNode('cm:content', name, parentId, title, description, null, author, majorVersion, aspectNames);
|
|
5564
5568
|
}
|
|
5565
5569
|
catch (error) {
|
|
5566
|
-
|
|
5570
|
+
const message = `${this.constructor.name} ${this.createFile.name}: ${error}`;
|
|
5571
|
+
logger.error(message);
|
|
5572
|
+
throw new Error(message);
|
|
5567
5573
|
}
|
|
5568
5574
|
}
|
|
5569
5575
|
async createFiles(names, relativePath = '/') {
|
|
@@ -5571,7 +5577,9 @@ class NodesApi {
|
|
|
5571
5577
|
return await this.createContent({ files: names }, relativePath);
|
|
5572
5578
|
}
|
|
5573
5579
|
catch (error) {
|
|
5574
|
-
|
|
5580
|
+
const message = `${this.constructor.name} ${this.createFiles.name}: ${error}`;
|
|
5581
|
+
logger.error(message);
|
|
5582
|
+
throw new Error(message);
|
|
5575
5583
|
}
|
|
5576
5584
|
}
|
|
5577
5585
|
async createMultipleFiles(count, parentId = '-my-') {
|
|
@@ -5582,6 +5590,7 @@ class NodesApi {
|
|
|
5582
5590
|
createdFiles.push(file);
|
|
5583
5591
|
}
|
|
5584
5592
|
}
|
|
5593
|
+
logger.info(`${this.constructor.name} ${this.createMultipleFiles.name}: created ${createdFiles.length} of ${count} files in parent "${parentId}"`);
|
|
5585
5594
|
return createdFiles;
|
|
5586
5595
|
}
|
|
5587
5596
|
async createFolders(names, relativePath = '/') {
|
|
@@ -5589,7 +5598,9 @@ class NodesApi {
|
|
|
5589
5598
|
return await this.createContent({ folders: names }, relativePath);
|
|
5590
5599
|
}
|
|
5591
5600
|
catch (error) {
|
|
5592
|
-
|
|
5601
|
+
const message = `${this.constructor.name} ${this.createFolders.name}: ${error}`;
|
|
5602
|
+
logger.error(message);
|
|
5603
|
+
throw new Error(message);
|
|
5593
5604
|
}
|
|
5594
5605
|
}
|
|
5595
5606
|
async deleteDeletedNode(name) {
|
|
@@ -5597,7 +5608,7 @@ class NodesApi {
|
|
|
5597
5608
|
await this.apiService.trashCan.deleteDeletedNode(name);
|
|
5598
5609
|
}
|
|
5599
5610
|
catch (error) {
|
|
5600
|
-
|
|
5611
|
+
logger.error(`${this.constructor.name} ${this.deleteDeletedNode.name}: ${error}`);
|
|
5601
5612
|
}
|
|
5602
5613
|
}
|
|
5603
5614
|
async createNode(nodeType, name, parentId = '-my-', title = '', description = '', imageProps = null, author = '', majorVersion = true, aspectNames = []) {
|
|
@@ -5616,12 +5627,14 @@ class NodesApi {
|
|
|
5616
5627
|
nodeBody.properties = Object.assign(nodeBody.properties, imageProps);
|
|
5617
5628
|
}
|
|
5618
5629
|
try {
|
|
5619
|
-
return this.apiService.nodes.createNode(parentId, nodeBody, {
|
|
5630
|
+
return await this.apiService.nodes.createNode(parentId, nodeBody, {
|
|
5620
5631
|
majorVersion
|
|
5621
5632
|
});
|
|
5622
5633
|
}
|
|
5623
5634
|
catch (error) {
|
|
5624
|
-
|
|
5635
|
+
const message = `${this.constructor.name} ${this.createNode.name}: ${error}`;
|
|
5636
|
+
logger.error(message);
|
|
5637
|
+
throw new Error(message);
|
|
5625
5638
|
}
|
|
5626
5639
|
}
|
|
5627
5640
|
async renameNode(nodeId, newName) {
|
|
@@ -5629,7 +5642,7 @@ class NodesApi {
|
|
|
5629
5642
|
return this.apiService.nodes.updateNode(nodeId, { name: newName });
|
|
5630
5643
|
}
|
|
5631
5644
|
catch (error) {
|
|
5632
|
-
|
|
5645
|
+
logger.error(`${this.constructor.name} ${this.renameNode.name}: ${error}`);
|
|
5633
5646
|
return null;
|
|
5634
5647
|
}
|
|
5635
5648
|
}
|
|
@@ -5643,7 +5656,7 @@ class NodesApi {
|
|
|
5643
5656
|
await this.apiService.nodes.deleteNodes(nodeIds, { permanent });
|
|
5644
5657
|
}
|
|
5645
5658
|
catch (error) {
|
|
5646
|
-
|
|
5659
|
+
logger.error(`${this.constructor.name} ${this.deleteNodes.name}: ${error}`);
|
|
5647
5660
|
}
|
|
5648
5661
|
}
|
|
5649
5662
|
async updateNode(nodeId, nodeBodyUpdate, opts) {
|
|
@@ -5651,7 +5664,7 @@ class NodesApi {
|
|
|
5651
5664
|
return await this.apiService.nodes.updateNode(nodeId, nodeBodyUpdate, opts);
|
|
5652
5665
|
}
|
|
5653
5666
|
catch (error) {
|
|
5654
|
-
|
|
5667
|
+
logger.error(`${this.constructor.name} ${this.updateNode.name}: ${error}`);
|
|
5655
5668
|
return null;
|
|
5656
5669
|
}
|
|
5657
5670
|
}
|
|
@@ -5666,7 +5679,7 @@ class NodesApi {
|
|
|
5666
5679
|
await this.deleteNodes(userNodesIds);
|
|
5667
5680
|
}
|
|
5668
5681
|
catch (error) {
|
|
5669
|
-
|
|
5682
|
+
logger.error(`${this.constructor.name} ${this.deleteCurrentUserNodes.name}: ${error}`);
|
|
5670
5683
|
}
|
|
5671
5684
|
}
|
|
5672
5685
|
async lockNodes(nodeIds, lockType = 'ALLOW_OWNER_CHANGES') {
|
|
@@ -5676,7 +5689,7 @@ class NodesApi {
|
|
|
5676
5689
|
}
|
|
5677
5690
|
}
|
|
5678
5691
|
catch (error) {
|
|
5679
|
-
|
|
5692
|
+
logger.error(`${this.constructor.name} ${this.lockNodes.name}: ${error}`);
|
|
5680
5693
|
}
|
|
5681
5694
|
}
|
|
5682
5695
|
async unlockNodes(nodeIds) {
|
|
@@ -5686,7 +5699,7 @@ class NodesApi {
|
|
|
5686
5699
|
}
|
|
5687
5700
|
}
|
|
5688
5701
|
catch (error) {
|
|
5689
|
-
|
|
5702
|
+
logger.error(`${this.constructor.name} ${this.unlockNodes.name}: ${error}`);
|
|
5690
5703
|
}
|
|
5691
5704
|
}
|
|
5692
5705
|
async createContent(content, relativePath = '/') {
|
|
@@ -5694,7 +5707,9 @@ class NodesApi {
|
|
|
5694
5707
|
return this.apiService.nodes.createNode('-my-', flattenNodeContentTree(content, relativePath));
|
|
5695
5708
|
}
|
|
5696
5709
|
catch (error) {
|
|
5697
|
-
|
|
5710
|
+
const message = `${this.constructor.name} ${this.createContent.name}: ${error}`;
|
|
5711
|
+
logger.error(message);
|
|
5712
|
+
throw new Error(message);
|
|
5698
5713
|
}
|
|
5699
5714
|
}
|
|
5700
5715
|
async getNodeById(id) {
|
|
@@ -5702,7 +5717,9 @@ class NodesApi {
|
|
|
5702
5717
|
return this.apiService.nodes.getNode(id);
|
|
5703
5718
|
}
|
|
5704
5719
|
catch (error) {
|
|
5705
|
-
|
|
5720
|
+
const message = `${this.constructor.name} ${this.getNodeById.name}: ${error}`;
|
|
5721
|
+
logger.error(message);
|
|
5722
|
+
throw new Error(message);
|
|
5706
5723
|
}
|
|
5707
5724
|
}
|
|
5708
5725
|
async getNodeIdFromParent(name, parentId) {
|
|
@@ -5711,7 +5728,7 @@ class NodesApi {
|
|
|
5711
5728
|
return children.find((elem) => elem.entry.name === name)?.entry.id ?? '';
|
|
5712
5729
|
}
|
|
5713
5730
|
catch (error) {
|
|
5714
|
-
|
|
5731
|
+
logger.error(`${this.constructor.name} ${this.getNodeIdFromParent.name}: ${error}`);
|
|
5715
5732
|
return '';
|
|
5716
5733
|
}
|
|
5717
5734
|
}
|
|
@@ -5723,7 +5740,7 @@ class NodesApi {
|
|
|
5723
5740
|
return this.apiService.nodes.listNodeChildren(nodeId, opts);
|
|
5724
5741
|
}
|
|
5725
5742
|
catch (error) {
|
|
5726
|
-
|
|
5743
|
+
logger.error(`${this.constructor.name} ${this.getNodeChildren.name}: ${error}`);
|
|
5727
5744
|
return null;
|
|
5728
5745
|
}
|
|
5729
5746
|
}
|
|
@@ -5732,7 +5749,7 @@ class NodesApi {
|
|
|
5732
5749
|
await this.apiService.nodes.deleteNode(id, { permanent });
|
|
5733
5750
|
}
|
|
5734
5751
|
catch (error) {
|
|
5735
|
-
|
|
5752
|
+
logger.error(`${this.constructor.name} ${this.deleteNodeById.name}: ${error}`);
|
|
5736
5753
|
}
|
|
5737
5754
|
}
|
|
5738
5755
|
async cleanupNodeTemplatesItems(nodeNames) {
|
|
@@ -5744,7 +5761,7 @@ class NodesApi {
|
|
|
5744
5761
|
}
|
|
5745
5762
|
}
|
|
5746
5763
|
catch (error) {
|
|
5747
|
-
|
|
5764
|
+
logger.error(`Admin Actions - cleanupNodeTemplatesItems failed: ${error}`);
|
|
5748
5765
|
}
|
|
5749
5766
|
}
|
|
5750
5767
|
async cleanupSpaceTemplatesItems(nodeNames) {
|
|
@@ -5756,7 +5773,7 @@ class NodesApi {
|
|
|
5756
5773
|
}
|
|
5757
5774
|
}
|
|
5758
5775
|
catch (error) {
|
|
5759
|
-
|
|
5776
|
+
logger.error(`Admin Actions - cleanupSpaceTemplatesFolder failed: ${error}`);
|
|
5760
5777
|
}
|
|
5761
5778
|
}
|
|
5762
5779
|
async getNodeTemplatesFolderId() {
|
|
@@ -5764,7 +5781,7 @@ class NodesApi {
|
|
|
5764
5781
|
return this.getNodeIdFromParent('Node Templates', await this.getDataDictionaryId());
|
|
5765
5782
|
}
|
|
5766
5783
|
catch (error) {
|
|
5767
|
-
|
|
5784
|
+
logger.error(`Admin Actions - getNodeTemplatesFolderId failed: ${error}`);
|
|
5768
5785
|
return '';
|
|
5769
5786
|
}
|
|
5770
5787
|
}
|
|
@@ -5773,13 +5790,13 @@ class NodesApi {
|
|
|
5773
5790
|
return this.getNodeIdFromParent('Space Templates', await this.getDataDictionaryId());
|
|
5774
5791
|
}
|
|
5775
5792
|
catch (error) {
|
|
5776
|
-
|
|
5793
|
+
logger.error(`Admin Actions - getSpaceTemplatesFolderId failed: ${error}`);
|
|
5777
5794
|
return '';
|
|
5778
5795
|
}
|
|
5779
5796
|
}
|
|
5780
5797
|
async getDataDictionaryId() {
|
|
5781
5798
|
return this.getNodeIdFromParent('Data Dictionary', '-root-').catch((error) => {
|
|
5782
|
-
|
|
5799
|
+
logger.error(`Admin Actions - getDataDictionaryId failed: ${error}`);
|
|
5783
5800
|
return '';
|
|
5784
5801
|
});
|
|
5785
5802
|
}
|
|
@@ -5799,7 +5816,7 @@ class NodesApi {
|
|
|
5799
5816
|
return this.apiService.nodes.updateNode(nodeId, data);
|
|
5800
5817
|
}
|
|
5801
5818
|
catch (error) {
|
|
5802
|
-
|
|
5819
|
+
logger.error(`${this.constructor.name} ${this.setGranularPermission.name}: ${error}`);
|
|
5803
5820
|
return null;
|
|
5804
5821
|
}
|
|
5805
5822
|
}
|
|
@@ -5810,7 +5827,7 @@ class NodesApi {
|
|
|
5810
5827
|
return this.setInheritPermissions(nodeId, false);
|
|
5811
5828
|
}
|
|
5812
5829
|
catch (error) {
|
|
5813
|
-
|
|
5830
|
+
logger.error(`Admin Actions - removeUserAccessOnNodeTemplate failed: ${error}`);
|
|
5814
5831
|
return null;
|
|
5815
5832
|
}
|
|
5816
5833
|
}
|
|
@@ -5821,7 +5838,7 @@ class NodesApi {
|
|
|
5821
5838
|
return this.setInheritPermissions(nodeId, false);
|
|
5822
5839
|
}
|
|
5823
5840
|
catch (error) {
|
|
5824
|
-
|
|
5841
|
+
logger.error(`Admin Actions - removeUserAccessOnSpaceTemplate failed: ${error}`);
|
|
5825
5842
|
return null;
|
|
5826
5843
|
}
|
|
5827
5844
|
}
|
|
@@ -5835,7 +5852,7 @@ class NodesApi {
|
|
|
5835
5852
|
return this.apiService.nodes.updateNode(nodeId, data);
|
|
5836
5853
|
}
|
|
5837
5854
|
catch (error) {
|
|
5838
|
-
|
|
5855
|
+
logger.error(`${this.constructor.name} ${this.setInheritPermissions.name}: ${error}`);
|
|
5839
5856
|
return null;
|
|
5840
5857
|
}
|
|
5841
5858
|
}
|
|
@@ -5844,7 +5861,7 @@ class NodesApi {
|
|
|
5844
5861
|
return this.apiService.nodes.updateNode(nodeId, { aspectNames });
|
|
5845
5862
|
}
|
|
5846
5863
|
catch (error) {
|
|
5847
|
-
|
|
5864
|
+
logger.error(`${this.constructor.name} ${this.addAspects.name}: ${error}`);
|
|
5848
5865
|
return null;
|
|
5849
5866
|
}
|
|
5850
5867
|
}
|
|
@@ -5863,7 +5880,7 @@ class NodesApi {
|
|
|
5863
5880
|
return link;
|
|
5864
5881
|
}
|
|
5865
5882
|
catch (error) {
|
|
5866
|
-
|
|
5883
|
+
logger.error(`${this.constructor.name} ${this.createFileLink.name}: ${error}`);
|
|
5867
5884
|
return null;
|
|
5868
5885
|
}
|
|
5869
5886
|
}
|
|
@@ -5885,7 +5902,7 @@ class NodesApi {
|
|
|
5885
5902
|
return link;
|
|
5886
5903
|
}
|
|
5887
5904
|
catch (error) {
|
|
5888
|
-
|
|
5905
|
+
logger.error(`${this.constructor.name} ${this.createFolderLink.name}: ${error}`);
|
|
5889
5906
|
return null;
|
|
5890
5907
|
}
|
|
5891
5908
|
}
|
|
@@ -5896,7 +5913,9 @@ class NodesApi {
|
|
|
5896
5913
|
return this.createFileLink(nodeId, destinationParentId);
|
|
5897
5914
|
}
|
|
5898
5915
|
catch (error) {
|
|
5899
|
-
|
|
5916
|
+
const message = `Admin Actions - createLinkToFileName failed : ${error}`;
|
|
5917
|
+
logger.error(message);
|
|
5918
|
+
throw new Error(message);
|
|
5900
5919
|
}
|
|
5901
5920
|
}
|
|
5902
5921
|
async createLinkToFolderName(originalFolderName, originalFolderParentId, destinationParentId) {
|
|
@@ -5906,7 +5925,9 @@ class NodesApi {
|
|
|
5906
5925
|
return this.createFolderLink(nodeId, destinationParentId);
|
|
5907
5926
|
}
|
|
5908
5927
|
catch (error) {
|
|
5909
|
-
|
|
5928
|
+
const message = `Admin Actions - createLinkToFolderName failed : ${error}`;
|
|
5929
|
+
logger.error(message);
|
|
5930
|
+
throw new Error(message);
|
|
5910
5931
|
}
|
|
5911
5932
|
}
|
|
5912
5933
|
async getNodeProperty(nodeId, property) {
|
|
@@ -5915,7 +5936,9 @@ class NodesApi {
|
|
|
5915
5936
|
return node.entry.properties?.[property] ?? '';
|
|
5916
5937
|
}
|
|
5917
5938
|
catch (error) {
|
|
5918
|
-
|
|
5939
|
+
const message = `${this.constructor.name} ${this.getNodeProperty.name}: ${error}`;
|
|
5940
|
+
logger.error(message);
|
|
5941
|
+
throw new Error(message);
|
|
5919
5942
|
}
|
|
5920
5943
|
}
|
|
5921
5944
|
async isFileShared(nodeId) {
|
|
@@ -5924,7 +5947,9 @@ class NodesApi {
|
|
|
5924
5947
|
return sharedId !== '';
|
|
5925
5948
|
}
|
|
5926
5949
|
catch (error) {
|
|
5927
|
-
|
|
5950
|
+
const message = `${this.constructor.name} ${this.isFileShared.name}: ${error}`;
|
|
5951
|
+
logger.error(message);
|
|
5952
|
+
throw new Error(message);
|
|
5928
5953
|
}
|
|
5929
5954
|
}
|
|
5930
5955
|
async getLockType(nodeId) {
|
|
@@ -5933,7 +5958,9 @@ class NodesApi {
|
|
|
5933
5958
|
return lockType || '';
|
|
5934
5959
|
}
|
|
5935
5960
|
catch (error) {
|
|
5936
|
-
|
|
5961
|
+
const message = `${this.constructor.name} ${this.getLockType.name}: ${error}`;
|
|
5962
|
+
logger.error(message);
|
|
5963
|
+
throw new Error(message);
|
|
5937
5964
|
}
|
|
5938
5965
|
}
|
|
5939
5966
|
async isFileLockedWrite(nodeId) {
|
|
@@ -5941,7 +5968,9 @@ class NodesApi {
|
|
|
5941
5968
|
return (await this.getLockType(nodeId)) === 'WRITE_LOCK';
|
|
5942
5969
|
}
|
|
5943
5970
|
catch (error) {
|
|
5944
|
-
|
|
5971
|
+
const message = `${this.constructor.name} ${this.isFileLockedWrite.name}: ${error}`;
|
|
5972
|
+
logger.error(message);
|
|
5973
|
+
throw new Error(message);
|
|
5945
5974
|
}
|
|
5946
5975
|
}
|
|
5947
5976
|
}
|
|
@@ -5986,22 +6015,28 @@ class SitesApi {
|
|
|
5986
6015
|
id: siteId || title
|
|
5987
6016
|
};
|
|
5988
6017
|
try {
|
|
5989
|
-
return this.apiService.sites.createSite(site);
|
|
6018
|
+
return await this.apiService.sites.createSite(site);
|
|
5990
6019
|
}
|
|
5991
6020
|
catch (error) {
|
|
5992
|
-
|
|
6021
|
+
const message = `SitesApi ${this.createSite.name}: ${error}`;
|
|
6022
|
+
logger.error(message);
|
|
6023
|
+
throw new Error(message);
|
|
5993
6024
|
}
|
|
5994
6025
|
}
|
|
5995
6026
|
async getDocLibId(siteId) {
|
|
5996
6027
|
try {
|
|
5997
6028
|
const id = (await this.apiService.sites.listSiteContainers(siteId)).list?.entries?.[0]?.entry?.id;
|
|
5998
6029
|
if (!id) {
|
|
5999
|
-
|
|
6030
|
+
const message = `Document library not found for site ${siteId}`;
|
|
6031
|
+
logger.error(message);
|
|
6032
|
+
throw new Error(message);
|
|
6000
6033
|
}
|
|
6001
6034
|
return id;
|
|
6002
6035
|
}
|
|
6003
6036
|
catch (error) {
|
|
6004
|
-
|
|
6037
|
+
const message = `Failed to get document library ID for site ${siteId}: ${error}`;
|
|
6038
|
+
logger.error(message);
|
|
6039
|
+
throw new Error(message);
|
|
6005
6040
|
}
|
|
6006
6041
|
}
|
|
6007
6042
|
/**
|
|
@@ -6018,7 +6053,7 @@ class SitesApi {
|
|
|
6018
6053
|
}
|
|
6019
6054
|
}
|
|
6020
6055
|
catch (error) {
|
|
6021
|
-
|
|
6056
|
+
logger.error(`${this.constructor.name} ${this.deleteSites.name}: ${error}`);
|
|
6022
6057
|
}
|
|
6023
6058
|
}
|
|
6024
6059
|
async updateSiteMember(siteId, userId, role) {
|
|
@@ -6026,10 +6061,10 @@ class SitesApi {
|
|
|
6026
6061
|
role: role
|
|
6027
6062
|
};
|
|
6028
6063
|
try {
|
|
6029
|
-
return this.apiService.sites.updateSiteMembership(siteId, userId, siteRole);
|
|
6064
|
+
return await this.apiService.sites.updateSiteMembership(siteId, userId, siteRole);
|
|
6030
6065
|
}
|
|
6031
6066
|
catch (error) {
|
|
6032
|
-
|
|
6067
|
+
logger.error(`SitesApi updateSiteMember : catch : ${error}`);
|
|
6033
6068
|
return new SiteMemberEntry();
|
|
6034
6069
|
}
|
|
6035
6070
|
}
|
|
@@ -6056,7 +6091,9 @@ class SitesApi {
|
|
|
6056
6091
|
return this.apiService.sites.createSiteMembershipRequestForPerson(personId, body);
|
|
6057
6092
|
}
|
|
6058
6093
|
catch (error) {
|
|
6059
|
-
|
|
6094
|
+
const message = `Failed to create site membership request for person ${personId} and site ${siteId}: ${error}`;
|
|
6095
|
+
logger.error(message);
|
|
6096
|
+
throw new Error(message);
|
|
6060
6097
|
}
|
|
6061
6098
|
}
|
|
6062
6099
|
async approveSiteMembershipRequest(siteId, inviteeId) {
|
|
@@ -6064,7 +6101,9 @@ class SitesApi {
|
|
|
6064
6101
|
return this.apiService.sites.approveSiteMembershipRequest(siteId, inviteeId);
|
|
6065
6102
|
}
|
|
6066
6103
|
catch (error) {
|
|
6067
|
-
|
|
6104
|
+
const message = `Failed to approve site membership request for invitee ${inviteeId} and site ${siteId}: ${error}`;
|
|
6105
|
+
logger.error(message);
|
|
6106
|
+
throw new Error(message);
|
|
6068
6107
|
}
|
|
6069
6108
|
}
|
|
6070
6109
|
async hasMembershipRequest(personId, siteId) {
|
|
@@ -6074,7 +6113,9 @@ class SitesApi {
|
|
|
6074
6113
|
return requests.includes(siteId);
|
|
6075
6114
|
}
|
|
6076
6115
|
catch (error) {
|
|
6077
|
-
|
|
6116
|
+
const message = `Failed to check site membership request for person ${personId} and site ${siteId}: ${error}`;
|
|
6117
|
+
logger.error(message);
|
|
6118
|
+
throw new Error(message);
|
|
6078
6119
|
}
|
|
6079
6120
|
}
|
|
6080
6121
|
async deleteSiteMember(siteId, userId) {
|
|
@@ -6082,7 +6123,7 @@ class SitesApi {
|
|
|
6082
6123
|
return this.apiService.sites.deleteSiteMembership(siteId, userId);
|
|
6083
6124
|
}
|
|
6084
6125
|
catch (error) {
|
|
6085
|
-
|
|
6126
|
+
logger.error(`SitesApi deleteSiteMember : catch : ${error}`);
|
|
6086
6127
|
}
|
|
6087
6128
|
}
|
|
6088
6129
|
async getSite(siteId) {
|
|
@@ -6090,7 +6131,9 @@ class SitesApi {
|
|
|
6090
6131
|
return this.apiService.sites.getSite(siteId);
|
|
6091
6132
|
}
|
|
6092
6133
|
catch (error) {
|
|
6093
|
-
|
|
6134
|
+
const message = `Failed to get site ${siteId}: ${error}`;
|
|
6135
|
+
logger.error(message);
|
|
6136
|
+
throw new Error(message);
|
|
6094
6137
|
}
|
|
6095
6138
|
}
|
|
6096
6139
|
}
|
|
@@ -6147,7 +6190,7 @@ class SearchApi {
|
|
|
6147
6190
|
}
|
|
6148
6191
|
}
|
|
6149
6192
|
async getTotalItems(username) {
|
|
6150
|
-
return (await this.querySearchFiles(username)).list
|
|
6193
|
+
return (await this.querySearchFiles(username)).list?.pagination?.totalItems ?? 0;
|
|
6151
6194
|
}
|
|
6152
6195
|
async waitForApi(username, data) {
|
|
6153
6196
|
try {
|
|
@@ -6177,23 +6220,25 @@ class SearchApi {
|
|
|
6177
6220
|
let result;
|
|
6178
6221
|
do {
|
|
6179
6222
|
result = await this.apiService.search.search(query);
|
|
6180
|
-
const currentCount = result.list
|
|
6223
|
+
const currentCount = result.list?.pagination?.count ?? 0;
|
|
6181
6224
|
if (currentCount !== options.nodesExpected) {
|
|
6182
6225
|
retryCount++;
|
|
6183
6226
|
if (retryCount % 30 === 0) {
|
|
6184
|
-
|
|
6227
|
+
logger.info(`waitForFolderPathIndexing: After ${retryCount} seconds, expected ${options.nodesExpected} nodes but found ${currentCount} in folder ${folderId}`);
|
|
6185
6228
|
}
|
|
6186
6229
|
if (retryCount >= retryLimit) {
|
|
6187
|
-
|
|
6230
|
+
const message = `Expected ${options.nodesExpected} nodes but found ${currentCount} after ${retryLimit} retries`;
|
|
6231
|
+
logger.error(message);
|
|
6232
|
+
throw new Error(message);
|
|
6188
6233
|
}
|
|
6189
6234
|
await Utils.delayInSeconds(1);
|
|
6190
6235
|
}
|
|
6191
|
-
} while (result.list
|
|
6192
|
-
|
|
6193
|
-
return result.list
|
|
6236
|
+
} while (result.list?.pagination?.count !== options.nodesExpected);
|
|
6237
|
+
logger.info(`waitForFolderPathIndexing: Found expected ${options.nodesExpected} nodes in folder ${folderId}`);
|
|
6238
|
+
return result.list?.pagination?.count ?? 0;
|
|
6194
6239
|
}
|
|
6195
6240
|
catch (error) {
|
|
6196
|
-
|
|
6241
|
+
logger.error(`waitForFolderPathIndexing failed for folderId "${folderId}": ${error}`);
|
|
6197
6242
|
throw error;
|
|
6198
6243
|
}
|
|
6199
6244
|
}
|
|
@@ -6247,7 +6292,7 @@ class TrashcanApi {
|
|
|
6247
6292
|
}
|
|
6248
6293
|
}
|
|
6249
6294
|
catch (error) {
|
|
6250
|
-
|
|
6295
|
+
logger.error(`User Actions - emptyTrashcan failed: ${error}`);
|
|
6251
6296
|
}
|
|
6252
6297
|
}
|
|
6253
6298
|
}
|
|
@@ -6298,8 +6343,7 @@ class QueriesApi {
|
|
|
6298
6343
|
return await Utils.retryCall(sites);
|
|
6299
6344
|
}
|
|
6300
6345
|
catch (error) {
|
|
6301
|
-
|
|
6302
|
-
console.error(`\tExpected: ${data.expect} items, but found ${error}`);
|
|
6346
|
+
logger.error(`QueriesApi waitForSites : catch : Expected: ${data.expect} items, but found ${error}`);
|
|
6303
6347
|
return null;
|
|
6304
6348
|
}
|
|
6305
6349
|
}
|
|
@@ -6313,7 +6357,7 @@ class QueriesApi {
|
|
|
6313
6357
|
return sites.list.pagination.totalItems;
|
|
6314
6358
|
}
|
|
6315
6359
|
catch (error) {
|
|
6316
|
-
|
|
6360
|
+
logger.error(`QueriesApi findSitesTotalItems : catch : ${error}`);
|
|
6317
6361
|
return null;
|
|
6318
6362
|
}
|
|
6319
6363
|
}
|
|
@@ -6356,20 +6400,20 @@ class CategoriesApi {
|
|
|
6356
6400
|
return this.apiService.categoriesApi.createSubcategories(categoryId, categoryBodyCreate, opts);
|
|
6357
6401
|
}
|
|
6358
6402
|
catch (error) {
|
|
6359
|
-
|
|
6403
|
+
logger.error(`${error}`);
|
|
6360
6404
|
return null;
|
|
6361
6405
|
}
|
|
6362
6406
|
}
|
|
6363
6407
|
async deleteCategory(categoryId) {
|
|
6364
|
-
if (categoryId
|
|
6365
|
-
|
|
6408
|
+
if (!categoryId) {
|
|
6409
|
+
logger.error('categoryId is null, skipping deletion');
|
|
6366
6410
|
return;
|
|
6367
6411
|
}
|
|
6368
6412
|
try {
|
|
6369
6413
|
await this.apiService.categoriesApi.deleteCategory(categoryId);
|
|
6370
6414
|
}
|
|
6371
6415
|
catch (error) {
|
|
6372
|
-
|
|
6416
|
+
logger.error(`${this.constructor.name} ${this.deleteCategory.name}: ${error}`);
|
|
6373
6417
|
}
|
|
6374
6418
|
}
|
|
6375
6419
|
async linkNodeToCategory(nodeId, categoryLinkBodyCreate, opts) {
|
|
@@ -6377,7 +6421,7 @@ class CategoriesApi {
|
|
|
6377
6421
|
return this.apiService.categoriesApi.linkNodeToCategory(nodeId, categoryLinkBodyCreate, opts);
|
|
6378
6422
|
}
|
|
6379
6423
|
catch (error) {
|
|
6380
|
-
|
|
6424
|
+
logger.error(`${this.constructor.name} ${this.linkNodeToCategory.name}: ${error}`);
|
|
6381
6425
|
return null;
|
|
6382
6426
|
}
|
|
6383
6427
|
}
|
|
@@ -6427,12 +6471,16 @@ class TagsApi {
|
|
|
6427
6471
|
else if ('list' in result) {
|
|
6428
6472
|
const firstEntry = result.list?.entries?.[0];
|
|
6429
6473
|
if (!firstEntry) {
|
|
6430
|
-
|
|
6474
|
+
const message = `createTags returned a paging result with no entries for tag "${tag}"`;
|
|
6475
|
+
logger.error(message);
|
|
6476
|
+
throw new Error(message);
|
|
6431
6477
|
}
|
|
6432
6478
|
created = firstEntry;
|
|
6433
6479
|
}
|
|
6434
6480
|
else {
|
|
6435
|
-
|
|
6481
|
+
const message = `createTags returned an unexpected response format for tag "${tag}"`;
|
|
6482
|
+
logger.error(message);
|
|
6483
|
+
throw new Error(message);
|
|
6436
6484
|
}
|
|
6437
6485
|
logger.info(`Tag created: "${created.entry.tag}" (id: ${created.entry.id})`);
|
|
6438
6486
|
results.push(created);
|
|
@@ -6440,15 +6488,19 @@ class TagsApi {
|
|
|
6440
6488
|
return results;
|
|
6441
6489
|
}
|
|
6442
6490
|
catch (error) {
|
|
6443
|
-
|
|
6491
|
+
const message = `Failed to create tags: ${error}`;
|
|
6492
|
+
logger.error(message);
|
|
6493
|
+
throw new Error(message);
|
|
6444
6494
|
}
|
|
6445
6495
|
}
|
|
6446
6496
|
async assignTagToNode(nodeId, tag) {
|
|
6447
6497
|
try {
|
|
6448
|
-
return this.apiService.tagsApi.assignTagToNode(nodeId, tag);
|
|
6498
|
+
return await this.apiService.tagsApi.assignTagToNode(nodeId, tag);
|
|
6449
6499
|
}
|
|
6450
6500
|
catch (error) {
|
|
6451
|
-
|
|
6501
|
+
const message = `Failed to assign tag to node: ${error}`;
|
|
6502
|
+
logger.error(message);
|
|
6503
|
+
throw new Error(message);
|
|
6452
6504
|
}
|
|
6453
6505
|
}
|
|
6454
6506
|
async deleteTags(...tags) {
|
|
@@ -6460,7 +6512,9 @@ class TagsApi {
|
|
|
6460
6512
|
}
|
|
6461
6513
|
}
|
|
6462
6514
|
catch (error) {
|
|
6463
|
-
|
|
6515
|
+
const message = `Failed to delete tags: ${error}`;
|
|
6516
|
+
logger.error(message);
|
|
6517
|
+
throw new Error(message);
|
|
6464
6518
|
}
|
|
6465
6519
|
}
|
|
6466
6520
|
async listTagsForNode(nodeId) {
|
|
@@ -6468,7 +6522,9 @@ class TagsApi {
|
|
|
6468
6522
|
return this.apiService.tagsApi.listTagsForNode(nodeId);
|
|
6469
6523
|
}
|
|
6470
6524
|
catch (error) {
|
|
6471
|
-
|
|
6525
|
+
const message = `Failed to list tags for node: ${error}`;
|
|
6526
|
+
logger.error(message);
|
|
6527
|
+
throw new Error(message);
|
|
6472
6528
|
}
|
|
6473
6529
|
}
|
|
6474
6530
|
async listTags(params) {
|
|
@@ -6476,7 +6532,9 @@ class TagsApi {
|
|
|
6476
6532
|
return this.apiService.tagsApi.listTags(params);
|
|
6477
6533
|
}
|
|
6478
6534
|
catch (error) {
|
|
6479
|
-
|
|
6535
|
+
const message = `Failed to list tags: ${error}`;
|
|
6536
|
+
logger.error(message);
|
|
6537
|
+
throw new Error(message);
|
|
6480
6538
|
}
|
|
6481
6539
|
}
|
|
6482
6540
|
async deleteTagByTagName(tagName) {
|
|
@@ -6486,7 +6544,9 @@ class TagsApi {
|
|
|
6486
6544
|
await this.deleteTags(...tags);
|
|
6487
6545
|
}
|
|
6488
6546
|
catch (error) {
|
|
6489
|
-
|
|
6547
|
+
const message = `Failed to delete tags by tag name: ${error}`;
|
|
6548
|
+
logger.error(message);
|
|
6549
|
+
throw new Error(message);
|
|
6490
6550
|
}
|
|
6491
6551
|
}
|
|
6492
6552
|
}
|