@esri/solution-common 6.5.0-next.20260212 → 6.5.0-next.20260214
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/deleteHelpers/deleteEmptyGroups.d.ts +2 -1
- package/dist/cjs/deleteHelpers/deleteEmptyGroups.js +14 -5
- package/dist/cjs/deleteHelpers/deleteGroupIfEmpty.d.ts +2 -1
- package/dist/cjs/deleteHelpers/deleteGroupIfEmpty.js +4 -5
- package/dist/cjs/deleteHelpers/deleteSolutionContents.js +12 -3
- package/dist/cjs/deleteHelpers/deleteSolutionFolder.js +1 -1
- package/dist/esm/deleteHelpers/deleteEmptyGroups.d.ts +2 -1
- package/dist/esm/deleteHelpers/deleteEmptyGroups.js +14 -5
- package/dist/esm/deleteHelpers/deleteGroupIfEmpty.d.ts +2 -1
- package/dist/esm/deleteHelpers/deleteGroupIfEmpty.js +4 -5
- package/dist/esm/deleteHelpers/deleteSolutionContents.js +12 -3
- package/dist/esm/deleteHelpers/deleteSolutionFolder.js +1 -1
- package/dist/solution.js_commit.txt +4 -4
- package/package.json +2 -2
|
@@ -19,6 +19,7 @@ import { UserSession } from "../arcgisRestJS";
|
|
|
19
19
|
*
|
|
20
20
|
* @param groups Ids of the groups to be deleted
|
|
21
21
|
* @param authentication Credentials for the request
|
|
22
|
+
* @param solutionOwner Owner of solution if it's not authenticated user
|
|
22
23
|
* @returns Promise that will resolve with the list of successfully deleted groups
|
|
23
24
|
*/
|
|
24
|
-
export declare function deleteEmptyGroups(groups: string[], authentication: UserSession): Promise<string[]>;
|
|
25
|
+
export declare function deleteEmptyGroups(groups: string[], authentication: UserSession, solutionOwner?: string): Promise<string[]>;
|
|
@@ -26,16 +26,25 @@ const deleteGroupIfEmpty_1 = require("./deleteGroupIfEmpty");
|
|
|
26
26
|
*
|
|
27
27
|
* @param groups Ids of the groups to be deleted
|
|
28
28
|
* @param authentication Credentials for the request
|
|
29
|
+
* @param solutionOwner Owner of solution if it's not authenticated user
|
|
29
30
|
* @returns Promise that will resolve with the list of successfully deleted groups
|
|
30
31
|
*/
|
|
31
|
-
function deleteEmptyGroups(groups, authentication) {
|
|
32
|
+
function deleteEmptyGroups(groups, authentication, solutionOwner) {
|
|
32
33
|
if (groups.length === 0) {
|
|
33
34
|
return Promise.resolve([]);
|
|
34
35
|
}
|
|
35
36
|
// Attempt to delete each group
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
if (solutionOwner) {
|
|
38
|
+
return Promise.all(groups.map((groupId) => (0, deleteGroupIfEmpty_1.deleteGroupIfEmpty)(groupId, authentication, solutionOwner))).then((responses) => {
|
|
39
|
+
// Return just the group ids that succeeded
|
|
40
|
+
return groups.filter((groupId, index) => responses[index]);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return Promise.all(groups.map((groupId) => (0, deleteGroupIfEmpty_1.deleteGroupIfEmpty)(groupId, authentication))).then((responses) => {
|
|
45
|
+
// Return just the group ids that succeeded
|
|
46
|
+
return groups.filter((groupId, index) => responses[index]);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
40
49
|
}
|
|
41
50
|
exports.deleteEmptyGroups = deleteEmptyGroups;
|
|
@@ -22,6 +22,7 @@ import { UserSession } from "../arcgisRestJS";
|
|
|
22
22
|
*
|
|
23
23
|
* @param groupId Id of the group to be deleted
|
|
24
24
|
* @param authentication Credentials for the request
|
|
25
|
+
* @param solutionOwner Owner of solution if it's not authenticated user
|
|
25
26
|
* @returns Promise indicating if group was deleted
|
|
26
27
|
*/
|
|
27
|
-
export declare function deleteGroupIfEmpty(groupId: string, authentication: UserSession): Promise<boolean>;
|
|
28
|
+
export declare function deleteGroupIfEmpty(groupId: string, authentication: UserSession, solutionOwner?: string): Promise<boolean>;
|
|
@@ -26,22 +26,21 @@ const arcgisRestJS_1 = require("../arcgisRestJS");
|
|
|
26
26
|
*
|
|
27
27
|
* @param groupId Id of the group to be deleted
|
|
28
28
|
* @param authentication Credentials for the request
|
|
29
|
+
* @param solutionOwner Owner of solution if it's not authenticated user
|
|
29
30
|
* @returns Promise indicating if group was deleted
|
|
30
31
|
*/
|
|
31
|
-
function deleteGroupIfEmpty(groupId, authentication) {
|
|
32
|
-
let username;
|
|
32
|
+
function deleteGroupIfEmpty(groupId, authentication, solutionOwner) {
|
|
33
33
|
let isGroupProtected;
|
|
34
34
|
// Get the owner tied to the authentication
|
|
35
35
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
36
36
|
return authentication
|
|
37
37
|
.getUsername()
|
|
38
|
-
.then((
|
|
39
|
-
username = response;
|
|
38
|
+
.then(() => {
|
|
40
39
|
// We need to know the owner and protection status of the group
|
|
41
40
|
return (0, arcgisRestJS_1.getGroup)(groupId, { authentication });
|
|
42
41
|
})
|
|
43
42
|
.then((group) => {
|
|
44
|
-
if (group.owner !==
|
|
43
|
+
if (solutionOwner && group.owner !== solutionOwner) {
|
|
45
44
|
return Promise.resolve(null); // don't delete a group we don't own
|
|
46
45
|
}
|
|
47
46
|
isGroupProtected = group.protected; // do we need to unprotect before deleting?
|
|
@@ -84,9 +84,18 @@ function deleteSolutionContents(solutionItemId, solutionSummary, authentication,
|
|
|
84
84
|
// Attempt to delete groups; we won't be checking success
|
|
85
85
|
return new Promise((resolve2) => {
|
|
86
86
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
if (deleteOptions.solutionOwner) {
|
|
88
|
+
deleteEmptyGroups
|
|
89
|
+
.deleteEmptyGroups(solutionSummary.groups, authentication, deleteOptions.solutionOwner)
|
|
90
|
+
.then(() => {
|
|
91
|
+
resolve2(results);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
deleteEmptyGroups.deleteEmptyGroups(solutionSummary.groups, authentication).then(() => {
|
|
96
|
+
resolve2(results);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
90
99
|
});
|
|
91
100
|
})
|
|
92
101
|
.then(() => {
|
|
@@ -39,7 +39,7 @@ function deleteSolutionFolder(solutionIds, folderId, authentication, solutionOwn
|
|
|
39
39
|
.then((user) => {
|
|
40
40
|
// And then we need to be sure that the folder is empty
|
|
41
41
|
const query = new arcgisRestJS_1.SearchQueryBuilder()
|
|
42
|
-
.match(authentication.username)
|
|
42
|
+
.match(solutionOwner ?? authentication.username)
|
|
43
43
|
.in("owner")
|
|
44
44
|
.and()
|
|
45
45
|
.match(user.orgId)
|
|
@@ -19,6 +19,7 @@ import { UserSession } from "../arcgisRestJS";
|
|
|
19
19
|
*
|
|
20
20
|
* @param groups Ids of the groups to be deleted
|
|
21
21
|
* @param authentication Credentials for the request
|
|
22
|
+
* @param solutionOwner Owner of solution if it's not authenticated user
|
|
22
23
|
* @returns Promise that will resolve with the list of successfully deleted groups
|
|
23
24
|
*/
|
|
24
|
-
export declare function deleteEmptyGroups(groups: string[], authentication: UserSession): Promise<string[]>;
|
|
25
|
+
export declare function deleteEmptyGroups(groups: string[], authentication: UserSession, solutionOwner?: string): Promise<string[]>;
|
|
@@ -23,15 +23,24 @@ import { deleteGroupIfEmpty } from "./deleteGroupIfEmpty";
|
|
|
23
23
|
*
|
|
24
24
|
* @param groups Ids of the groups to be deleted
|
|
25
25
|
* @param authentication Credentials for the request
|
|
26
|
+
* @param solutionOwner Owner of solution if it's not authenticated user
|
|
26
27
|
* @returns Promise that will resolve with the list of successfully deleted groups
|
|
27
28
|
*/
|
|
28
|
-
export function deleteEmptyGroups(groups, authentication) {
|
|
29
|
+
export function deleteEmptyGroups(groups, authentication, solutionOwner) {
|
|
29
30
|
if (groups.length === 0) {
|
|
30
31
|
return Promise.resolve([]);
|
|
31
32
|
}
|
|
32
33
|
// Attempt to delete each group
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
if (solutionOwner) {
|
|
35
|
+
return Promise.all(groups.map((groupId) => deleteGroupIfEmpty(groupId, authentication, solutionOwner))).then((responses) => {
|
|
36
|
+
// Return just the group ids that succeeded
|
|
37
|
+
return groups.filter((groupId, index) => responses[index]);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
return Promise.all(groups.map((groupId) => deleteGroupIfEmpty(groupId, authentication))).then((responses) => {
|
|
42
|
+
// Return just the group ids that succeeded
|
|
43
|
+
return groups.filter((groupId, index) => responses[index]);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
37
46
|
}
|
|
@@ -22,6 +22,7 @@ import { UserSession } from "../arcgisRestJS";
|
|
|
22
22
|
*
|
|
23
23
|
* @param groupId Id of the group to be deleted
|
|
24
24
|
* @param authentication Credentials for the request
|
|
25
|
+
* @param solutionOwner Owner of solution if it's not authenticated user
|
|
25
26
|
* @returns Promise indicating if group was deleted
|
|
26
27
|
*/
|
|
27
|
-
export declare function deleteGroupIfEmpty(groupId: string, authentication: UserSession): Promise<boolean>;
|
|
28
|
+
export declare function deleteGroupIfEmpty(groupId: string, authentication: UserSession, solutionOwner?: string): Promise<boolean>;
|
|
@@ -23,22 +23,21 @@ import { getGroup, getGroupContent, restRemoveGroup, unprotectGroup, } from "../
|
|
|
23
23
|
*
|
|
24
24
|
* @param groupId Id of the group to be deleted
|
|
25
25
|
* @param authentication Credentials for the request
|
|
26
|
+
* @param solutionOwner Owner of solution if it's not authenticated user
|
|
26
27
|
* @returns Promise indicating if group was deleted
|
|
27
28
|
*/
|
|
28
|
-
export function deleteGroupIfEmpty(groupId, authentication) {
|
|
29
|
-
let username;
|
|
29
|
+
export function deleteGroupIfEmpty(groupId, authentication, solutionOwner) {
|
|
30
30
|
let isGroupProtected;
|
|
31
31
|
// Get the owner tied to the authentication
|
|
32
32
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
33
33
|
return authentication
|
|
34
34
|
.getUsername()
|
|
35
|
-
.then((
|
|
36
|
-
username = response;
|
|
35
|
+
.then(() => {
|
|
37
36
|
// We need to know the owner and protection status of the group
|
|
38
37
|
return getGroup(groupId, { authentication });
|
|
39
38
|
})
|
|
40
39
|
.then((group) => {
|
|
41
|
-
if (group.owner !==
|
|
40
|
+
if (solutionOwner && group.owner !== solutionOwner) {
|
|
42
41
|
return Promise.resolve(null); // don't delete a group we don't own
|
|
43
42
|
}
|
|
44
43
|
isGroupProtected = group.protected; // do we need to unprotect before deleting?
|
|
@@ -80,9 +80,18 @@ export function deleteSolutionContents(solutionItemId, solutionSummary, authenti
|
|
|
80
80
|
// Attempt to delete groups; we won't be checking success
|
|
81
81
|
return new Promise((resolve2) => {
|
|
82
82
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
if (deleteOptions.solutionOwner) {
|
|
84
|
+
deleteEmptyGroups
|
|
85
|
+
.deleteEmptyGroups(solutionSummary.groups, authentication, deleteOptions.solutionOwner)
|
|
86
|
+
.then(() => {
|
|
87
|
+
resolve2(results);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
deleteEmptyGroups.deleteEmptyGroups(solutionSummary.groups, authentication).then(() => {
|
|
92
|
+
resolve2(results);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
86
95
|
});
|
|
87
96
|
})
|
|
88
97
|
.then(() => {
|
|
@@ -36,7 +36,7 @@ export function deleteSolutionFolder(solutionIds, folderId, authentication, solu
|
|
|
36
36
|
.then((user) => {
|
|
37
37
|
// And then we need to be sure that the folder is empty
|
|
38
38
|
const query = new SearchQueryBuilder()
|
|
39
|
-
.match(authentication.username)
|
|
39
|
+
.match(solutionOwner ?? authentication.username)
|
|
40
40
|
.in("owner")
|
|
41
41
|
.and()
|
|
42
42
|
.match(user.orgId)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
Built 02/
|
|
1
|
+
Built 02/14/2026 20:42:24.57
|
|
2
2
|
develop
|
|
3
|
-
commit
|
|
3
|
+
commit 08bf6a96c9df94e17aadb828d241e0a607e54a88
|
|
4
4
|
Author: Ryan Cosby <ryan9313@esri.com>
|
|
5
|
-
Date:
|
|
5
|
+
Date: Fri Feb 13 20:49:24 2026 -0800
|
|
6
6
|
|
|
7
|
-
v6.5.0-next.
|
|
7
|
+
v6.5.0-next.20260213
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@esri/solution-common",
|
|
3
|
-
"version": "6.5.0-next.
|
|
3
|
+
"version": "6.5.0-next.20260214",
|
|
4
4
|
"description": "Provides general helper functions for @esri/solution.js.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"esri",
|
|
97
97
|
"ES6"
|
|
98
98
|
],
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "08bf6a96c9df94e17aadb828d241e0a607e54a88"
|
|
100
100
|
}
|