@esri/arcgis-rest-portal 4.0.4 → 4.0.6

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,7 +1,7 @@
1
1
  /* @preserve
2
- * @esri/arcgis-rest-portal - v4.0.3 - Apache-2.0
2
+ * @esri/arcgis-rest-portal - v4.0.5 - Apache-2.0
3
3
  * Copyright (c) 2017-2022 Esri, Inc.
4
- * Mon Aug 22 2022 19:56:33 GMT+0000 (Coordinated Universal Time)
4
+ * Thu Sep 22 2022 19:48:13 GMT+0000 (Coordinated Universal Time)
5
5
  */
6
6
  import { cleanUrl, request, appendCustomParams, warn } from '@esri/arcgis-rest-request';
7
7
 
@@ -50,6 +50,25 @@ function determineOwner(requestOptions) {
50
50
  return Promise.reject(new Error("Could not determine the owner of this item. Pass the `owner`, `item.owner`, or `authentication` option."));
51
51
  }
52
52
  }
53
+ /**
54
+ * checks if the extent is a valid BBox (2 element array of coordinate pair arrays)
55
+ * @param extent
56
+ * @returns
57
+ */
58
+ function isBBox(extent) {
59
+ return (Array.isArray(extent) &&
60
+ Array.isArray(extent[0]) &&
61
+ Array.isArray(extent[1]));
62
+ }
63
+ /**
64
+ * Given a Bbox, convert it to a string. Some api endpoints expect a string
65
+ *
66
+ * @param {BBox} extent
67
+ * @return {*} {string}
68
+ */
69
+ function bboxToString(extent) {
70
+ return extent.join(",");
71
+ }
53
72
 
54
73
  /* Copyright (c) 2018 Environmental Systems Research Institute, Inc.
55
74
  * Apache-2.0 */
@@ -79,6 +98,13 @@ function updateItem(requestOptions) {
79
98
  : `${getPortalUrl(requestOptions)}/content/users/${owner}/items/${requestOptions.item.id}/update`;
80
99
  // serialize the item into something Portal will accept
81
100
  requestOptions.params = Object.assign(Object.assign({}, requestOptions.params), requestOptions.item);
101
+ // convert extent, if present, into a string from bbox
102
+ // processParams was previously doing this sort of work,
103
+ // however now we need to let array of arrays through
104
+ // Thus for extents we need to move this logic here
105
+ if (requestOptions.params.extent && isBBox(requestOptions.params.extent)) {
106
+ requestOptions.params.extent = bboxToString(requestOptions.params.extent);
107
+ }
82
108
  return request(url, requestOptions);
83
109
  });
84
110
  }
@@ -349,6 +375,13 @@ function createItemInFolder(requestOptions) {
349
375
  url = `${baseUrl}/${requestOptions.folderId}/addItem`;
350
376
  }
351
377
  requestOptions.params = Object.assign(Object.assign({}, requestOptions.params), requestOptions.item);
378
+ // convert extent, if present, into a string from bbox
379
+ // processParams was previously doing this sort of work,
380
+ // however now we need to let array of arrays through
381
+ // Thus for extents we need to move this logic here
382
+ if (requestOptions.params.extent && isBBox(requestOptions.params.extent)) {
383
+ requestOptions.params.extent = bboxToString(requestOptions.params.extent);
384
+ }
352
385
  // serialize the item into something Portal will accept
353
386
  const options = appendCustomParams(requestOptions, [
354
387
  "owner",
@@ -1351,7 +1384,7 @@ function genericSearch(search, searchType) {
1351
1384
  };
1352
1385
  }
1353
1386
  else {
1354
- // searchUserAccess has one (knonw) valid value: "groupMember"
1387
+ // searchUserAccess has one (known) valid value: "groupMember"
1355
1388
  options = appendCustomParams(search, [
1356
1389
  "q",
1357
1390
  "num",
@@ -1359,7 +1392,12 @@ function genericSearch(search, searchType) {
1359
1392
  "sortField",
1360
1393
  "sortOrder",
1361
1394
  "searchUserAccess",
1362
- "searchUserName"
1395
+ "searchUserName",
1396
+ "filter",
1397
+ "countFields",
1398
+ "countSize",
1399
+ "categories",
1400
+ "categoryFilters"
1363
1401
  ], {
1364
1402
  httpMethod: "GET"
1365
1403
  });
@@ -2815,5 +2853,5 @@ function getPortalSettings(id, requestOptions) {
2815
2853
  return request(url, options);
2816
2854
  }
2817
2855
 
2818
- export { SearchQueryBuilder, acceptInvitation, addGroupUsers, addItemData, addItemPart, addItemRelationship, addItemResource, cancelItemUpload, commitItemUpload, createFolder, createGroup, createGroupNotification, createItem, createItemInFolder, createOrgNotification, declineInvitation, determineOwner, 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, getUserTags, getUserUrl, inviteGroupUsers, isItemOwner, isItemSharedWithGroup, isOrgAdmin, isServiceNameAvailable, joinGroup, leaveGroup, moveItem, protectGroup, protectItem, reassignItem, removeFolder, removeGroup, removeGroupUsers, removeItem, removeItemRelationship, removeItemResource, removeNotification, scrubControlChars, searchGroupContent, searchGroupUsers, searchGroups, searchItems, searchUsers, setItemAccess, shareItemWithGroup, unprotectGroup, unprotectItem, unshareItemWithGroup, updateGroup, updateItem, updateItemInfo, updateItemResource, updateUser, updateUserMemberships };
2856
+ export { SearchQueryBuilder, acceptInvitation, addGroupUsers, addItemData, addItemPart, addItemRelationship, addItemResource, bboxToString, cancelItemUpload, commitItemUpload, createFolder, createGroup, createGroupNotification, createItem, createItemInFolder, createOrgNotification, declineInvitation, determineOwner, 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, getUserTags, getUserUrl, inviteGroupUsers, isBBox, isItemOwner, isItemSharedWithGroup, isOrgAdmin, isServiceNameAvailable, joinGroup, leaveGroup, moveItem, protectGroup, protectItem, reassignItem, removeFolder, removeGroup, removeGroupUsers, removeItem, removeItemRelationship, removeItemResource, removeNotification, scrubControlChars, searchGroupContent, searchGroupUsers, searchGroups, searchItems, searchUsers, setItemAccess, shareItemWithGroup, unprotectGroup, unprotectItem, unshareItemWithGroup, updateGroup, updateItem, updateItemInfo, updateItemResource, updateUser, updateUserMemberships };
2819
2857
  //# sourceMappingURL=portal.esm.js.map