@esri/arcgis-rest-portal 4.6.2 → 4.7.0
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/bundled/portal.esm.js +44 -4
- package/dist/bundled/portal.esm.js.map +1 -1
- package/dist/bundled/portal.esm.min.js +3 -3
- package/dist/bundled/portal.esm.min.js.map +1 -1
- package/dist/bundled/portal.umd.js +44 -3
- package/dist/bundled/portal.umd.js.map +1 -1
- package/dist/bundled/portal.umd.min.js +3 -3
- package/dist/bundled/portal.umd.min.js.map +1 -1
- package/dist/cjs/items/get.js +11 -1
- package/dist/cjs/items/get.js.map +1 -1
- package/dist/cjs/items/helpers.js +22 -1
- package/dist/cjs/items/helpers.js.map +1 -1
- package/dist/cjs/items/update.js +10 -0
- package/dist/cjs/items/update.js.map +1 -1
- package/dist/esm/items/get.js +12 -2
- package/dist/esm/items/get.js.map +1 -1
- package/dist/esm/items/helpers.d.ts +10 -0
- package/dist/esm/items/helpers.js +20 -0
- package/dist/esm/items/helpers.js.map +1 -1
- package/dist/esm/items/update.js +11 -1
- package/dist/esm/items/update.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @preserve
|
|
2
|
-
* @esri/arcgis-rest-portal - v4.6.
|
|
2
|
+
* @esri/arcgis-rest-portal - v4.6.2 - Apache-2.0
|
|
3
3
|
* Copyright (c) 2017-2025 Esri, Inc.
|
|
4
|
-
*
|
|
4
|
+
* Mon Sep 22 2025 18:12:03 GMT+0000 (Coordinated Universal Time)
|
|
5
5
|
*/
|
|
6
6
|
import { cleanUrl, request, appendCustomParams, warn } from '@esri/arcgis-rest-request';
|
|
7
7
|
|
|
@@ -69,6 +69,26 @@ function isBBox(extent) {
|
|
|
69
69
|
function bboxToString(extent) {
|
|
70
70
|
return extent.join(",");
|
|
71
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Returns the full thumbnail URL for an item.
|
|
74
|
+
*
|
|
75
|
+
* @param item - The item to decorate
|
|
76
|
+
* @param portal - The portal URL
|
|
77
|
+
* @param token - Optional token to append if the item is private
|
|
78
|
+
* @returns The item with decorated thumbnail
|
|
79
|
+
*/
|
|
80
|
+
function decorateThumbnail(item, portal, token) {
|
|
81
|
+
if (!item)
|
|
82
|
+
return item;
|
|
83
|
+
let thumbnailUrl = null;
|
|
84
|
+
if (typeof item.thumbnail === "string") {
|
|
85
|
+
thumbnailUrl = `${portal}/content/items/${item.id}/info/${item.thumbnail}`;
|
|
86
|
+
if (thumbnailUrl && item.access !== "public" && token) {
|
|
87
|
+
thumbnailUrl += `?${token}`;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return Object.assign(Object.assign({}, item), (thumbnailUrl ? { thumbnailUrl } : {}));
|
|
91
|
+
}
|
|
72
92
|
|
|
73
93
|
/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.
|
|
74
94
|
* Apache-2.0 */
|
|
@@ -105,6 +125,16 @@ function updateItem(requestOptions) {
|
|
|
105
125
|
if (requestOptions.params.extent && isBBox(requestOptions.params.extent)) {
|
|
106
126
|
requestOptions.params.extent = bboxToString(requestOptions.params.extent);
|
|
107
127
|
}
|
|
128
|
+
const portal = getPortalUrl(requestOptions);
|
|
129
|
+
const decoratedThumbnail = decorateThumbnail(Object.assign(Object.assign({}, requestOptions.item), { access: requestOptions.item.access }), portal);
|
|
130
|
+
const paramsThumbnailUrl = requestOptions.params.thumbnailUrl;
|
|
131
|
+
if (typeof decoratedThumbnail.thumbnailUrl === "string" &&
|
|
132
|
+
typeof paramsThumbnailUrl === "string") {
|
|
133
|
+
if (decoratedThumbnail.thumbnailUrl.split("?")[0] ===
|
|
134
|
+
paramsThumbnailUrl.split("?")[0]) {
|
|
135
|
+
delete requestOptions.params.thumbnailUrl;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
108
138
|
return request(url, requestOptions);
|
|
109
139
|
});
|
|
110
140
|
}
|
|
@@ -497,7 +527,17 @@ function getItem(id, requestOptions) {
|
|
|
497
527
|
const url = getItemBaseUrl(id, requestOptions);
|
|
498
528
|
// default to a GET request
|
|
499
529
|
const options = Object.assign({ httpMethod: "GET" }, requestOptions);
|
|
500
|
-
return request(url, options)
|
|
530
|
+
return request(url, options).then(async (item) => {
|
|
531
|
+
const portal = (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.portal) || getPortalUrl(requestOptions);
|
|
532
|
+
let token;
|
|
533
|
+
// if authentication is provided and it’s an authentication manager and the item is not public then request a token for secure access
|
|
534
|
+
if ((requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.authentication) &&
|
|
535
|
+
typeof requestOptions.authentication !== "string" &&
|
|
536
|
+
item.access !== "public") {
|
|
537
|
+
token = await requestOptions.authentication.getToken(url);
|
|
538
|
+
}
|
|
539
|
+
return decorateThumbnail(item, portal, token);
|
|
540
|
+
});
|
|
501
541
|
}
|
|
502
542
|
/**
|
|
503
543
|
* Get the fully qualified base URL to the REST end point for an item.
|
|
@@ -2970,5 +3010,5 @@ function getPortalSettings(id, requestOptions) {
|
|
|
2970
3010
|
return request(url, options);
|
|
2971
3011
|
}
|
|
2972
3012
|
|
|
2973
|
-
export { SearchQueryBuilder, acceptInvitation, addGroupUsers, addItemData, addItemPart, addItemRelationship, addItemResource, bboxToString, cancelItemUpload, commitItemUpload, createFolder, createGroup, createGroupNotification, createItem, createItemInFolder, createOrgNotification, declineInvitation, determineOwner, determineUsername, ensureMembership, exportItem, getGroup, getGroupCategorySchema, getGroupContent, getGroupUsers, getItem, getItemBaseUrl, getItemData, getItemGroups, getItemInfo, getItemMetadata, getItemParts, getItemResource, getItemResources, getItemStatus, getPortal, getPortalSettings, getPortalUrl, getRelatedItems, getSelf, getSharingUrl, getUniqueServiceName, getUser, getUserContent, getUserInvitation, getUserInvitations, getUserMembership, getUserNotifications, getUserProperties, getUserTags, getUserUrl, inviteGroupUsers, isBBox, isItemOwner, isItemSharedWithGroup, isOrgAdmin, isServiceNameAvailable, joinGroup, leaveGroup, moveItem, protectGroup, protectItem, reassignItem, removeFolder, removeGroup, removeGroupUsers, removeItem, removeItemRelationship, removeItemResource, removeItemThumbnail, removeNotification, scrubControlChars, searchCommunityUsers, searchGroupContent, searchGroupUsers, searchGroups, searchItems, searchUsers, setItemAccess, setUserProperties, shareItemWithGroup, unprotectGroup, unprotectItem, unshareItemWithGroup, updateGroup, updateItem, updateItemInfo, updateItemResource, updateUser, updateUserMemberships };
|
|
3013
|
+
export { SearchQueryBuilder, acceptInvitation, addGroupUsers, addItemData, addItemPart, addItemRelationship, addItemResource, bboxToString, cancelItemUpload, commitItemUpload, createFolder, createGroup, createGroupNotification, createItem, createItemInFolder, createOrgNotification, declineInvitation, decorateThumbnail, determineOwner, determineUsername, ensureMembership, exportItem, getGroup, getGroupCategorySchema, getGroupContent, getGroupUsers, getItem, getItemBaseUrl, getItemData, getItemGroups, getItemInfo, getItemMetadata, getItemParts, getItemResource, getItemResources, getItemStatus, getPortal, getPortalSettings, getPortalUrl, getRelatedItems, getSelf, getSharingUrl, getUniqueServiceName, getUser, getUserContent, getUserInvitation, getUserInvitations, getUserMembership, getUserNotifications, getUserProperties, getUserTags, getUserUrl, inviteGroupUsers, isBBox, isItemOwner, isItemSharedWithGroup, isOrgAdmin, isServiceNameAvailable, joinGroup, leaveGroup, moveItem, protectGroup, protectItem, reassignItem, removeFolder, removeGroup, removeGroupUsers, removeItem, removeItemRelationship, removeItemResource, removeItemThumbnail, removeNotification, scrubControlChars, searchCommunityUsers, searchGroupContent, searchGroupUsers, searchGroups, searchItems, searchUsers, setItemAccess, setUserProperties, shareItemWithGroup, unprotectGroup, unprotectItem, unshareItemWithGroup, updateGroup, updateItem, updateItemInfo, updateItemResource, updateUser, updateUserMemberships };
|
|
2974
3014
|
//# sourceMappingURL=portal.esm.js.map
|