@esri/solution-common 6.5.0-next.20260209 → 6.5.0-next.20260211
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/deleteSolutionContents.js +12 -2
- package/dist/cjs/deleteHelpers/deleteSolutionFolder.d.ts +2 -1
- package/dist/cjs/deleteHelpers/deleteSolutionFolder.js +3 -2
- package/dist/cjs/deleteHelpers/deleteSolutionItem.d.ts +2 -1
- package/dist/cjs/deleteHelpers/deleteSolutionItem.js +11 -2
- package/dist/cjs/deleteHelpers/removeItems.js +19 -5
- package/dist/cjs/interfaces.d.ts +4 -0
- package/dist/cjs/restHelpers.d.ts +5 -2
- package/dist/cjs/restHelpers.js +16 -2
- package/dist/esm/deleteHelpers/deleteSolutionContents.js +12 -2
- package/dist/esm/deleteHelpers/deleteSolutionFolder.d.ts +2 -1
- package/dist/esm/deleteHelpers/deleteSolutionFolder.js +3 -2
- package/dist/esm/deleteHelpers/deleteSolutionItem.d.ts +2 -1
- package/dist/esm/deleteHelpers/deleteSolutionItem.js +11 -2
- package/dist/esm/deleteHelpers/removeItems.js +19 -5
- package/dist/esm/interfaces.d.ts +4 -0
- package/dist/esm/restHelpers.d.ts +5 -2
- package/dist/esm/restHelpers.js +16 -2
- package/dist/solution.js_commit.txt +8 -5
- package/package.json +2 -2
|
@@ -93,7 +93,12 @@ function deleteSolutionContents(solutionItemId, solutionSummary, authentication,
|
|
|
93
93
|
if (solutionItemId) {
|
|
94
94
|
// 9-5-25: Change in logic to delete solution item regardless if there were any failed deleted items.
|
|
95
95
|
const permanentDelete = !deleteOptions.sendToRecycling;
|
|
96
|
-
|
|
96
|
+
if (deleteOptions.solutionOwner) {
|
|
97
|
+
return deleteSolutionItem.deleteSolutionItem(solutionItemId, authentication, permanentDelete, deleteOptions.solutionOwner);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
return deleteSolutionItem.deleteSolutionItem(solutionItemId, authentication, permanentDelete);
|
|
101
|
+
}
|
|
97
102
|
}
|
|
98
103
|
else {
|
|
99
104
|
return Promise.resolve({ success: true, itemId: "" });
|
|
@@ -104,7 +109,12 @@ function deleteSolutionContents(solutionItemId, solutionSummary, authentication,
|
|
|
104
109
|
if (solutionItemDeleteStatus.success) {
|
|
105
110
|
reportProgress.reportProgress(99, deleteOptions, solutionItemId, interfaces_1.EItemProgressStatus.Finished);
|
|
106
111
|
// Can't delete if folder contains non-solution items
|
|
107
|
-
|
|
112
|
+
if (deleteOptions.solutionOwner) {
|
|
113
|
+
return deleteSolutionFolder.deleteSolutionFolder(solutionIds, solutionSummary.folder, authentication, deleteOptions.solutionOwner);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
return deleteSolutionFolder.deleteSolutionFolder(solutionIds, solutionSummary.folder, authentication);
|
|
117
|
+
}
|
|
108
118
|
}
|
|
109
119
|
else {
|
|
110
120
|
return Promise.resolve(false);
|
|
@@ -23,7 +23,8 @@ import { UserSession } from "../arcgisRestJS";
|
|
|
23
23
|
* @param solutionFolderId Id of the folder of a deployed Solution
|
|
24
24
|
* @param deletedItemIds Ids in the Solution, including the Solution item; used to deal with lagging folder deletion
|
|
25
25
|
* @param authentication Credentials for the request
|
|
26
|
+
* @param solutionOwner Optional. The owner of the solution item if it is not the logged on user
|
|
26
27
|
* @returns Promise that will resolve if deletion was successful and fail if any part of it failed;
|
|
27
28
|
* if the folder has a non-Solution item, it will not be deleted, but the function will return true
|
|
28
29
|
*/
|
|
29
|
-
export declare function deleteSolutionFolder(solutionIds: string[], folderId: string, authentication: UserSession): Promise<boolean>;
|
|
30
|
+
export declare function deleteSolutionFolder(solutionIds: string[], folderId: string, authentication: UserSession, solutionOwner?: string): Promise<boolean>;
|
|
@@ -27,10 +27,11 @@ const arcgisRestJS_1 = require("../arcgisRestJS");
|
|
|
27
27
|
* @param solutionFolderId Id of the folder of a deployed Solution
|
|
28
28
|
* @param deletedItemIds Ids in the Solution, including the Solution item; used to deal with lagging folder deletion
|
|
29
29
|
* @param authentication Credentials for the request
|
|
30
|
+
* @param solutionOwner Optional. The owner of the solution item if it is not the logged on user
|
|
30
31
|
* @returns Promise that will resolve if deletion was successful and fail if any part of it failed;
|
|
31
32
|
* if the folder has a non-Solution item, it will not be deleted, but the function will return true
|
|
32
33
|
*/
|
|
33
|
-
function deleteSolutionFolder(solutionIds, folderId, authentication) {
|
|
34
|
+
function deleteSolutionFolder(solutionIds, folderId, authentication, solutionOwner) {
|
|
34
35
|
// See if the deployment folder is empty and can be deleted; first, we need info about user
|
|
35
36
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
36
37
|
return authentication
|
|
@@ -63,7 +64,7 @@ function deleteSolutionFolder(solutionIds, folderId, authentication) {
|
|
|
63
64
|
// OK to delete the folder
|
|
64
65
|
return (0, arcgisRestJS_1.restRemoveFolder)({
|
|
65
66
|
folderId: folderId,
|
|
66
|
-
owner: authentication.username,
|
|
67
|
+
owner: solutionOwner ?? authentication.username,
|
|
67
68
|
authentication,
|
|
68
69
|
});
|
|
69
70
|
}
|
|
@@ -28,6 +28,7 @@ import { UserSession } from "../arcgisRestJS";
|
|
|
28
28
|
* @param authentication Credentials for the request
|
|
29
29
|
* @param permanentDelete If true (the default), the item is permanently deleted; if false and the item type
|
|
30
30
|
* supports the recycle bin, the item will be put into the recycle bin
|
|
31
|
+
* @param solutionOwner Optional. The owner of the solution item if it is not the logged on user
|
|
31
32
|
* @returns Promise that will resolve with the status of deleting the item
|
|
32
33
|
*/
|
|
33
|
-
export declare function deleteSolutionItem(solutionItemId: string, authentication: UserSession, permanentDelete?: boolean): Promise<IStatusResponse>;
|
|
34
|
+
export declare function deleteSolutionItem(solutionItemId: string, authentication: UserSession, permanentDelete?: boolean, solutionOwner?: string): Promise<IStatusResponse>;
|
|
@@ -27,17 +27,26 @@ const restHelpers_1 = require("../restHelpers");
|
|
|
27
27
|
* @param authentication Credentials for the request
|
|
28
28
|
* @param permanentDelete If true (the default), the item is permanently deleted; if false and the item type
|
|
29
29
|
* supports the recycle bin, the item will be put into the recycle bin
|
|
30
|
+
* @param solutionOwner Optional. The owner of the solution item if it is not the logged on user
|
|
30
31
|
* @returns Promise that will resolve with the status of deleting the item
|
|
31
32
|
*/
|
|
32
|
-
function deleteSolutionItem(solutionItemId, authentication, permanentDelete) {
|
|
33
|
+
function deleteSolutionItem(solutionItemId, authentication, permanentDelete, solutionOwner) {
|
|
33
34
|
const protectOptions = {
|
|
34
35
|
id: solutionItemId,
|
|
35
36
|
authentication,
|
|
36
37
|
};
|
|
38
|
+
if (solutionOwner) {
|
|
39
|
+
protectOptions.owner = solutionOwner;
|
|
40
|
+
}
|
|
37
41
|
return (0, arcgisRestJS_1.unprotectItem)(protectOptions)
|
|
38
42
|
.then((result) => {
|
|
39
43
|
if (result.success) {
|
|
40
|
-
|
|
44
|
+
if (solutionOwner) {
|
|
45
|
+
return (0, restHelpers_1.removeItem)(solutionItemId, authentication, permanentDelete, solutionOwner);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
return (0, restHelpers_1.removeItem)(solutionItemId, authentication, permanentDelete);
|
|
49
|
+
}
|
|
41
50
|
}
|
|
42
51
|
else {
|
|
43
52
|
return Promise.resolve(result);
|
|
@@ -54,10 +54,19 @@ function removeItems(solutionSummary, hubSiteItemIds, authentication, percentDon
|
|
|
54
54
|
// Done with subsequent items in list; now delete the current item
|
|
55
55
|
[solutionDeletedSummary, solutionFailureSummary] = results;
|
|
56
56
|
// Remove any delete protection on item
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
if (deleteOptions.solutionOwner) {
|
|
58
|
+
return (0, arcgisRestJS_1.unprotectItem)({
|
|
59
|
+
id: itemToDelete.id,
|
|
60
|
+
authentication: authentication,
|
|
61
|
+
owner: deleteOptions.solutionOwner,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
return (0, arcgisRestJS_1.unprotectItem)({
|
|
66
|
+
id: itemToDelete.id,
|
|
67
|
+
authentication: authentication,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
61
70
|
})
|
|
62
71
|
.then(async () => {
|
|
63
72
|
// Delete the item
|
|
@@ -71,7 +80,12 @@ function removeItems(solutionSummary, hubSiteItemIds, authentication, percentDon
|
|
|
71
80
|
}
|
|
72
81
|
else {
|
|
73
82
|
const permanentDelete = !deleteOptions.sendToRecycling;
|
|
74
|
-
|
|
83
|
+
if (deleteOptions.solutionOwner) {
|
|
84
|
+
return (0, restHelpers_1.removeItem)(itemToDelete.id, authentication, permanentDelete, deleteOptions.solutionOwner);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
return (0, restHelpers_1.removeItem)(itemToDelete.id, authentication, permanentDelete);
|
|
88
|
+
}
|
|
75
89
|
}
|
|
76
90
|
})
|
|
77
91
|
.then(() => {
|
package/dist/cjs/interfaces.d.ts
CHANGED
|
@@ -450,6 +450,10 @@ export interface IDeleteSolutionOptions {
|
|
|
450
450
|
* delete the item permanently; this flag overrides that behavior.
|
|
451
451
|
*/
|
|
452
452
|
sendToRecycling?: boolean;
|
|
453
|
+
/**
|
|
454
|
+
* The owner of the solution to delete/unprotect/update if it is not logged on user.
|
|
455
|
+
*/
|
|
456
|
+
solutionOwner?: string;
|
|
453
457
|
}
|
|
454
458
|
/**
|
|
455
459
|
* Storage of dependencies.
|
|
@@ -325,9 +325,10 @@ export declare function removeGroup(groupId: string, authentication: UserSession
|
|
|
325
325
|
* @param authentication Credentials for the request to AGO
|
|
326
326
|
* @param permanentDelete If true (the default), the item is permanently deleted; if false and the item type
|
|
327
327
|
* supports the recycle bin, the item will be put into the recycle bin
|
|
328
|
+
* @param solutionOwner Optional. The owner of the solution item if it is not the logged on user
|
|
328
329
|
* @returns A promise that will resolve with the result of the request
|
|
329
330
|
*/
|
|
330
|
-
export declare function removeItem(itemId: string, authentication: UserSession, permanentDelete?: boolean): Promise<IStatusResponse>;
|
|
331
|
+
export declare function removeItem(itemId: string, authentication: UserSession, permanentDelete?: boolean, solutionOwner?: string): Promise<IStatusResponse>;
|
|
331
332
|
/**
|
|
332
333
|
* Removes an item or group from AGO.
|
|
333
334
|
*
|
|
@@ -475,9 +476,11 @@ export declare function updateGroup(groupInfo: IGroup, authentication: UserSessi
|
|
|
475
476
|
* @param authentication Credentials for requests
|
|
476
477
|
* @param thumbnail optional thumbnail to update
|
|
477
478
|
* @param access "public" or "org"
|
|
479
|
+
* @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
|
|
480
|
+
* @param solutionOwner The owner of the solution for rest request
|
|
478
481
|
* @return
|
|
479
482
|
*/
|
|
480
|
-
export declare function updateItemExtended(itemInfo: IItemUpdate, data: any, authentication: UserSession, thumbnail?: File, access?: string | undefined, templateDictionary?: any): Promise<IUpdateItemResponse>;
|
|
483
|
+
export declare function updateItemExtended(itemInfo: IItemUpdate, data: any, authentication: UserSession, thumbnail?: File, access?: string | undefined, templateDictionary?: any, solutionOwner?: string): Promise<IUpdateItemResponse>;
|
|
481
484
|
/**
|
|
482
485
|
* Update an item's base and data using a dictionary.
|
|
483
486
|
*
|
package/dist/cjs/restHelpers.js
CHANGED
|
@@ -1153,9 +1153,10 @@ exports.removeGroup = removeGroup;
|
|
|
1153
1153
|
* @param authentication Credentials for the request to AGO
|
|
1154
1154
|
* @param permanentDelete If true (the default), the item is permanently deleted; if false and the item type
|
|
1155
1155
|
* supports the recycle bin, the item will be put into the recycle bin
|
|
1156
|
+
* @param solutionOwner Optional. The owner of the solution item if it is not the logged on user
|
|
1156
1157
|
* @returns A promise that will resolve with the result of the request
|
|
1157
1158
|
*/
|
|
1158
|
-
function removeItem(itemId, authentication, permanentDelete = true) {
|
|
1159
|
+
function removeItem(itemId, authentication, permanentDelete = true, solutionOwner) {
|
|
1159
1160
|
return new Promise((resolve, reject) => {
|
|
1160
1161
|
const requestOptions = {
|
|
1161
1162
|
id: itemId,
|
|
@@ -1164,6 +1165,9 @@ function removeItem(itemId, authentication, permanentDelete = true) {
|
|
|
1164
1165
|
permanentDelete,
|
|
1165
1166
|
},
|
|
1166
1167
|
};
|
|
1168
|
+
if (solutionOwner) {
|
|
1169
|
+
requestOptions.owner = solutionOwner;
|
|
1170
|
+
}
|
|
1167
1171
|
(0, arcgisRestJS_1.restRemoveItem)(requestOptions).then((result) => (result.success ? resolve(result) : reject(result)), reject);
|
|
1168
1172
|
});
|
|
1169
1173
|
}
|
|
@@ -1457,6 +1461,9 @@ function updateItem(itemInfo, authentication, folderId, additionalParams) {
|
|
|
1457
1461
|
...(additionalParams ?? {}),
|
|
1458
1462
|
},
|
|
1459
1463
|
};
|
|
1464
|
+
if (additionalParams?.solutionOwner) {
|
|
1465
|
+
updateOptions.owner = additionalParams.solutionOwner;
|
|
1466
|
+
}
|
|
1460
1467
|
if (itemInfo?.data instanceof File) {
|
|
1461
1468
|
//updateOptions.file = itemInfo.data;
|
|
1462
1469
|
updateOptions.params.file = itemInfo.data;
|
|
@@ -1499,9 +1506,11 @@ exports.updateGroup = updateGroup;
|
|
|
1499
1506
|
* @param authentication Credentials for requests
|
|
1500
1507
|
* @param thumbnail optional thumbnail to update
|
|
1501
1508
|
* @param access "public" or "org"
|
|
1509
|
+
* @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
|
|
1510
|
+
* @param solutionOwner The owner of the solution for rest request
|
|
1502
1511
|
* @return
|
|
1503
1512
|
*/
|
|
1504
|
-
function updateItemExtended(itemInfo, data, authentication, thumbnail, access, templateDictionary) {
|
|
1513
|
+
function updateItemExtended(itemInfo, data, authentication, thumbnail, access, templateDictionary, solutionOwner) {
|
|
1505
1514
|
return new Promise((resolve, reject) => {
|
|
1506
1515
|
const updateOptions = {
|
|
1507
1516
|
item: itemInfo,
|
|
@@ -1516,6 +1525,11 @@ function updateItemExtended(itemInfo, data, authentication, thumbnail, access, t
|
|
|
1516
1525
|
if ((0, trackingHelpers_1.isTrackingViewTemplate)(undefined, itemInfo) && templateDictionary) {
|
|
1517
1526
|
updateOptions.owner = templateDictionary.locationTracking.owner;
|
|
1518
1527
|
}
|
|
1528
|
+
else {
|
|
1529
|
+
if (solutionOwner) {
|
|
1530
|
+
updateOptions.owner = solutionOwner;
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1519
1533
|
(0, arcgisRestJS_1.restUpdateItem)(updateOptions).then((result) => {
|
|
1520
1534
|
if (access && access !== "private") {
|
|
1521
1535
|
// Set access if it is not AGOL default
|
|
@@ -89,7 +89,12 @@ export function deleteSolutionContents(solutionItemId, solutionSummary, authenti
|
|
|
89
89
|
if (solutionItemId) {
|
|
90
90
|
// 9-5-25: Change in logic to delete solution item regardless if there were any failed deleted items.
|
|
91
91
|
const permanentDelete = !deleteOptions.sendToRecycling;
|
|
92
|
-
|
|
92
|
+
if (deleteOptions.solutionOwner) {
|
|
93
|
+
return deleteSolutionItem.deleteSolutionItem(solutionItemId, authentication, permanentDelete, deleteOptions.solutionOwner);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
return deleteSolutionItem.deleteSolutionItem(solutionItemId, authentication, permanentDelete);
|
|
97
|
+
}
|
|
93
98
|
}
|
|
94
99
|
else {
|
|
95
100
|
return Promise.resolve({ success: true, itemId: "" });
|
|
@@ -100,7 +105,12 @@ export function deleteSolutionContents(solutionItemId, solutionSummary, authenti
|
|
|
100
105
|
if (solutionItemDeleteStatus.success) {
|
|
101
106
|
reportProgress.reportProgress(99, deleteOptions, solutionItemId, EItemProgressStatus.Finished);
|
|
102
107
|
// Can't delete if folder contains non-solution items
|
|
103
|
-
|
|
108
|
+
if (deleteOptions.solutionOwner) {
|
|
109
|
+
return deleteSolutionFolder.deleteSolutionFolder(solutionIds, solutionSummary.folder, authentication, deleteOptions.solutionOwner);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
return deleteSolutionFolder.deleteSolutionFolder(solutionIds, solutionSummary.folder, authentication);
|
|
113
|
+
}
|
|
104
114
|
}
|
|
105
115
|
else {
|
|
106
116
|
return Promise.resolve(false);
|
|
@@ -23,7 +23,8 @@ import { UserSession } from "../arcgisRestJS";
|
|
|
23
23
|
* @param solutionFolderId Id of the folder of a deployed Solution
|
|
24
24
|
* @param deletedItemIds Ids in the Solution, including the Solution item; used to deal with lagging folder deletion
|
|
25
25
|
* @param authentication Credentials for the request
|
|
26
|
+
* @param solutionOwner Optional. The owner of the solution item if it is not the logged on user
|
|
26
27
|
* @returns Promise that will resolve if deletion was successful and fail if any part of it failed;
|
|
27
28
|
* if the folder has a non-Solution item, it will not be deleted, but the function will return true
|
|
28
29
|
*/
|
|
29
|
-
export declare function deleteSolutionFolder(solutionIds: string[], folderId: string, authentication: UserSession): Promise<boolean>;
|
|
30
|
+
export declare function deleteSolutionFolder(solutionIds: string[], folderId: string, authentication: UserSession, solutionOwner?: string): Promise<boolean>;
|
|
@@ -24,10 +24,11 @@ import { restRemoveFolder, restSearchItems, SearchQueryBuilder, } from "../arcgi
|
|
|
24
24
|
* @param solutionFolderId Id of the folder of a deployed Solution
|
|
25
25
|
* @param deletedItemIds Ids in the Solution, including the Solution item; used to deal with lagging folder deletion
|
|
26
26
|
* @param authentication Credentials for the request
|
|
27
|
+
* @param solutionOwner Optional. The owner of the solution item if it is not the logged on user
|
|
27
28
|
* @returns Promise that will resolve if deletion was successful and fail if any part of it failed;
|
|
28
29
|
* if the folder has a non-Solution item, it will not be deleted, but the function will return true
|
|
29
30
|
*/
|
|
30
|
-
export function deleteSolutionFolder(solutionIds, folderId, authentication) {
|
|
31
|
+
export function deleteSolutionFolder(solutionIds, folderId, authentication, solutionOwner) {
|
|
31
32
|
// See if the deployment folder is empty and can be deleted; first, we need info about user
|
|
32
33
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
33
34
|
return authentication
|
|
@@ -60,7 +61,7 @@ export function deleteSolutionFolder(solutionIds, folderId, authentication) {
|
|
|
60
61
|
// OK to delete the folder
|
|
61
62
|
return restRemoveFolder({
|
|
62
63
|
folderId: folderId,
|
|
63
|
-
owner: authentication.username,
|
|
64
|
+
owner: solutionOwner ?? authentication.username,
|
|
64
65
|
authentication,
|
|
65
66
|
});
|
|
66
67
|
}
|
|
@@ -28,6 +28,7 @@ import { UserSession } from "../arcgisRestJS";
|
|
|
28
28
|
* @param authentication Credentials for the request
|
|
29
29
|
* @param permanentDelete If true (the default), the item is permanently deleted; if false and the item type
|
|
30
30
|
* supports the recycle bin, the item will be put into the recycle bin
|
|
31
|
+
* @param solutionOwner Optional. The owner of the solution item if it is not the logged on user
|
|
31
32
|
* @returns Promise that will resolve with the status of deleting the item
|
|
32
33
|
*/
|
|
33
|
-
export declare function deleteSolutionItem(solutionItemId: string, authentication: UserSession, permanentDelete?: boolean): Promise<IStatusResponse>;
|
|
34
|
+
export declare function deleteSolutionItem(solutionItemId: string, authentication: UserSession, permanentDelete?: boolean, solutionOwner?: string): Promise<IStatusResponse>;
|
|
@@ -24,17 +24,26 @@ import { removeItem } from "../restHelpers";
|
|
|
24
24
|
* @param authentication Credentials for the request
|
|
25
25
|
* @param permanentDelete If true (the default), the item is permanently deleted; if false and the item type
|
|
26
26
|
* supports the recycle bin, the item will be put into the recycle bin
|
|
27
|
+
* @param solutionOwner Optional. The owner of the solution item if it is not the logged on user
|
|
27
28
|
* @returns Promise that will resolve with the status of deleting the item
|
|
28
29
|
*/
|
|
29
|
-
export function deleteSolutionItem(solutionItemId, authentication, permanentDelete) {
|
|
30
|
+
export function deleteSolutionItem(solutionItemId, authentication, permanentDelete, solutionOwner) {
|
|
30
31
|
const protectOptions = {
|
|
31
32
|
id: solutionItemId,
|
|
32
33
|
authentication,
|
|
33
34
|
};
|
|
35
|
+
if (solutionOwner) {
|
|
36
|
+
protectOptions.owner = solutionOwner;
|
|
37
|
+
}
|
|
34
38
|
return unprotectItem(protectOptions)
|
|
35
39
|
.then((result) => {
|
|
36
40
|
if (result.success) {
|
|
37
|
-
|
|
41
|
+
if (solutionOwner) {
|
|
42
|
+
return removeItem(solutionItemId, authentication, permanentDelete, solutionOwner);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
return removeItem(solutionItemId, authentication, permanentDelete);
|
|
46
|
+
}
|
|
38
47
|
}
|
|
39
48
|
else {
|
|
40
49
|
return Promise.resolve(result);
|
|
@@ -50,10 +50,19 @@ export function removeItems(solutionSummary, hubSiteItemIds, authentication, per
|
|
|
50
50
|
// Done with subsequent items in list; now delete the current item
|
|
51
51
|
[solutionDeletedSummary, solutionFailureSummary] = results;
|
|
52
52
|
// Remove any delete protection on item
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
if (deleteOptions.solutionOwner) {
|
|
54
|
+
return unprotectItem({
|
|
55
|
+
id: itemToDelete.id,
|
|
56
|
+
authentication: authentication,
|
|
57
|
+
owner: deleteOptions.solutionOwner,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
return unprotectItem({
|
|
62
|
+
id: itemToDelete.id,
|
|
63
|
+
authentication: authentication,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
57
66
|
})
|
|
58
67
|
.then(async () => {
|
|
59
68
|
// Delete the item
|
|
@@ -67,7 +76,12 @@ export function removeItems(solutionSummary, hubSiteItemIds, authentication, per
|
|
|
67
76
|
}
|
|
68
77
|
else {
|
|
69
78
|
const permanentDelete = !deleteOptions.sendToRecycling;
|
|
70
|
-
|
|
79
|
+
if (deleteOptions.solutionOwner) {
|
|
80
|
+
return removeItem(itemToDelete.id, authentication, permanentDelete, deleteOptions.solutionOwner);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
return removeItem(itemToDelete.id, authentication, permanentDelete);
|
|
84
|
+
}
|
|
71
85
|
}
|
|
72
86
|
})
|
|
73
87
|
.then(() => {
|
package/dist/esm/interfaces.d.ts
CHANGED
|
@@ -450,6 +450,10 @@ export interface IDeleteSolutionOptions {
|
|
|
450
450
|
* delete the item permanently; this flag overrides that behavior.
|
|
451
451
|
*/
|
|
452
452
|
sendToRecycling?: boolean;
|
|
453
|
+
/**
|
|
454
|
+
* The owner of the solution to delete/unprotect/update if it is not logged on user.
|
|
455
|
+
*/
|
|
456
|
+
solutionOwner?: string;
|
|
453
457
|
}
|
|
454
458
|
/**
|
|
455
459
|
* Storage of dependencies.
|
|
@@ -325,9 +325,10 @@ export declare function removeGroup(groupId: string, authentication: UserSession
|
|
|
325
325
|
* @param authentication Credentials for the request to AGO
|
|
326
326
|
* @param permanentDelete If true (the default), the item is permanently deleted; if false and the item type
|
|
327
327
|
* supports the recycle bin, the item will be put into the recycle bin
|
|
328
|
+
* @param solutionOwner Optional. The owner of the solution item if it is not the logged on user
|
|
328
329
|
* @returns A promise that will resolve with the result of the request
|
|
329
330
|
*/
|
|
330
|
-
export declare function removeItem(itemId: string, authentication: UserSession, permanentDelete?: boolean): Promise<IStatusResponse>;
|
|
331
|
+
export declare function removeItem(itemId: string, authentication: UserSession, permanentDelete?: boolean, solutionOwner?: string): Promise<IStatusResponse>;
|
|
331
332
|
/**
|
|
332
333
|
* Removes an item or group from AGO.
|
|
333
334
|
*
|
|
@@ -475,9 +476,11 @@ export declare function updateGroup(groupInfo: IGroup, authentication: UserSessi
|
|
|
475
476
|
* @param authentication Credentials for requests
|
|
476
477
|
* @param thumbnail optional thumbnail to update
|
|
477
478
|
* @param access "public" or "org"
|
|
479
|
+
* @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
|
|
480
|
+
* @param solutionOwner The owner of the solution for rest request
|
|
478
481
|
* @return
|
|
479
482
|
*/
|
|
480
|
-
export declare function updateItemExtended(itemInfo: IItemUpdate, data: any, authentication: UserSession, thumbnail?: File, access?: string | undefined, templateDictionary?: any): Promise<IUpdateItemResponse>;
|
|
483
|
+
export declare function updateItemExtended(itemInfo: IItemUpdate, data: any, authentication: UserSession, thumbnail?: File, access?: string | undefined, templateDictionary?: any, solutionOwner?: string): Promise<IUpdateItemResponse>;
|
|
481
484
|
/**
|
|
482
485
|
* Update an item's base and data using a dictionary.
|
|
483
486
|
*
|
package/dist/esm/restHelpers.js
CHANGED
|
@@ -1118,9 +1118,10 @@ export function removeGroup(groupId, authentication) {
|
|
|
1118
1118
|
* @param authentication Credentials for the request to AGO
|
|
1119
1119
|
* @param permanentDelete If true (the default), the item is permanently deleted; if false and the item type
|
|
1120
1120
|
* supports the recycle bin, the item will be put into the recycle bin
|
|
1121
|
+
* @param solutionOwner Optional. The owner of the solution item if it is not the logged on user
|
|
1121
1122
|
* @returns A promise that will resolve with the result of the request
|
|
1122
1123
|
*/
|
|
1123
|
-
export function removeItem(itemId, authentication, permanentDelete = true) {
|
|
1124
|
+
export function removeItem(itemId, authentication, permanentDelete = true, solutionOwner) {
|
|
1124
1125
|
return new Promise((resolve, reject) => {
|
|
1125
1126
|
const requestOptions = {
|
|
1126
1127
|
id: itemId,
|
|
@@ -1129,6 +1130,9 @@ export function removeItem(itemId, authentication, permanentDelete = true) {
|
|
|
1129
1130
|
permanentDelete,
|
|
1130
1131
|
},
|
|
1131
1132
|
};
|
|
1133
|
+
if (solutionOwner) {
|
|
1134
|
+
requestOptions.owner = solutionOwner;
|
|
1135
|
+
}
|
|
1132
1136
|
portalRemoveItem(requestOptions).then((result) => (result.success ? resolve(result) : reject(result)), reject);
|
|
1133
1137
|
});
|
|
1134
1138
|
}
|
|
@@ -1411,6 +1415,9 @@ export function updateItem(itemInfo, authentication, folderId, additionalParams)
|
|
|
1411
1415
|
...(additionalParams ?? {}),
|
|
1412
1416
|
},
|
|
1413
1417
|
};
|
|
1418
|
+
if (additionalParams?.solutionOwner) {
|
|
1419
|
+
updateOptions.owner = additionalParams.solutionOwner;
|
|
1420
|
+
}
|
|
1414
1421
|
if (itemInfo?.data instanceof File) {
|
|
1415
1422
|
//updateOptions.file = itemInfo.data;
|
|
1416
1423
|
updateOptions.params.file = itemInfo.data;
|
|
@@ -1451,9 +1458,11 @@ export function updateGroup(groupInfo, authentication, additionalParams) {
|
|
|
1451
1458
|
* @param authentication Credentials for requests
|
|
1452
1459
|
* @param thumbnail optional thumbnail to update
|
|
1453
1460
|
* @param access "public" or "org"
|
|
1461
|
+
* @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
|
|
1462
|
+
* @param solutionOwner The owner of the solution for rest request
|
|
1454
1463
|
* @return
|
|
1455
1464
|
*/
|
|
1456
|
-
export function updateItemExtended(itemInfo, data, authentication, thumbnail, access, templateDictionary) {
|
|
1465
|
+
export function updateItemExtended(itemInfo, data, authentication, thumbnail, access, templateDictionary, solutionOwner) {
|
|
1457
1466
|
return new Promise((resolve, reject) => {
|
|
1458
1467
|
const updateOptions = {
|
|
1459
1468
|
item: itemInfo,
|
|
@@ -1468,6 +1477,11 @@ export function updateItemExtended(itemInfo, data, authentication, thumbnail, ac
|
|
|
1468
1477
|
if (isTrackingViewTemplate(undefined, itemInfo) && templateDictionary) {
|
|
1469
1478
|
updateOptions.owner = templateDictionary.locationTracking.owner;
|
|
1470
1479
|
}
|
|
1480
|
+
else {
|
|
1481
|
+
if (solutionOwner) {
|
|
1482
|
+
updateOptions.owner = solutionOwner;
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1471
1485
|
portalUpdateItem(updateOptions).then((result) => {
|
|
1472
1486
|
if (access && access !== "private") {
|
|
1473
1487
|
// Set access if it is not AGOL default
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
Built 02/
|
|
1
|
+
Built 02/11/2026 20:42:41.58
|
|
2
2
|
develop
|
|
3
|
-
commit
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
commit 406a1b1934edbf402d77e15df379269227d222cf
|
|
4
|
+
Merge: 94ce0c0a0 b99b26a6d
|
|
5
|
+
Author: Previn Wong <pwong@esri.com>
|
|
6
|
+
Date: Wed Feb 11 16:14:40 2026 -0800
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
Merge pull request #1567 from Esri/prev8048-owner-in-request-options
|
|
9
|
+
|
|
10
|
+
Add solutionOwner to request options
|
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.20260211",
|
|
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": "406a1b1934edbf402d77e15df379269227d222cf"
|
|
100
100
|
}
|