New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@esri/arcgis-rest-portal

Package Overview
Dependencies
Maintainers
6
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@esri/arcgis-rest-portal - npm Package Compare versions

Comparing version 2.10.1 to 2.10.2

4

dist/umd/portal.umd.min.js
/* @preserve
* @esri/arcgis-rest-portal - v2.10.1 - Apache-2.0
* @esri/arcgis-rest-portal - v2.10.2 - Apache-2.0
* Copyright (c) 2017-2020 Esri, Inc.
* Fri Apr 03 2020 10:18:51 GMT-0600 (Mountain Daylight Time)
* Mon Apr 06 2020 12:12:00 GMT-0700 (Pacific Daylight Time)
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@esri/arcgis-rest-request")):"function"==typeof define&&define.amd?define(["exports","@esri/arcgis-rest-request"],e):e((t=t||self).arcgisRest=t.arcgisRest||{},t.arcgisRest)}(this,function(t,i){"use strict";var a=function(){return(a=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function u(t){return void 0===t&&(t={}),t.portal?i.cleanUrl(t.portal):t.authentication?t.authentication.portal:"https://www.arcgis.com/sharing/rest"}function s(t){var e=JSON.parse(JSON.stringify(t));return e.data&&("undefined"!=typeof Blob&&t.data instanceof Blob||"ReadStream"===t.data.constructor.name?e.file=t.data:e.text=t.data,delete e.data),e}function e(t){return t.owner?Promise.resolve(t.owner):t.item&&t.item.owner?Promise.resolve(t.item.owner):t.authentication&&t.authentication.getUsername?t.authentication.getUsername():Promise.reject(new Error("Could not determine the owner of this item. Pass the `owner`, `item.owner`, or `authentication` option."))}function r(r){return e(r).then(function(t){var e=u(r)+"/content/users/"+t+"/items/"+r.item.id+"/update";return r.params=a({},r.params,s(r.item)),i.request(e,r)})}function n(o){return o.file&&!o.multipart?Promise.reject(new Error("The request must be a multipart request for file uploading.")):o.multipart&&!o.filename?Promise.reject(new Error("The file name is required for a multipart request.")):e(o).then(function(t){var e=u(o)+"/content/users/"+t,r=e+"/addItem";o.folderId&&(r=e+"/"+o.folderId+"/addItem"),o.params=a({},o.params,s(o.item));var n=i.appendCustomParams(o,["owner","folderId","file","dataUrl","text","async","multipart","filename","overwrite"],{params:a({},o.params)});return i.request(r,n)})}function o(t,e){var r=u(e)+"/community/groups/"+t,n=a({httpMethod:"GET"},e);return i.request(r,n)}function c(t){var e=t.authentication.username,r=t.owner||e;return u(t)+"/content/users/"+encodeURIComponent(r)+"/items/"+t.id+"/share"}function m(t){var e=t.authentication.username;return(t.owner||e)===e}function p(t){return t.authentication.getUser(t).then(function(t){return!(!t||"org_admin"!==t.role)})}function d(t){return o(t.groupId,t).then(function(t){return t.userMembership.memberType}).catch(function(){return"none"})}var h=(f.prototype.match=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this.termStack=this.termStack.concat(t),this},f.prototype.in=function(t){var e="`in("+(t?'"'+t+'"':"")+")`";return this.hasRange||this.hasTerms?(t&&"*"!==t&&(this.q+=t+":"),this.commit()):(i.warn(e+" was called with no call to `match(...)` or `from(...)`/`to(...)`. Your query was not modified."),this)},f.prototype.startGroup=function(){return this.commit(),0<this.openGroups&&(this.q+=" "),this.openGroups++,this.q+="(",this},f.prototype.endGroup=function(){return this.openGroups<=0?i.warn("`endGroup(...)` was called without calling `startGroup(...)` first. Your query was not modified."):(this.commit(),this.openGroups--,this.q+=")"),this},f.prototype.and=function(){return this.addModifier("and")},f.prototype.or=function(){return this.addModifier("or")},f.prototype.not=function(){return this.addModifier("not")},f.prototype.from=function(t){return this.hasTerms?i.warn("`from(...)` is not allowed after `match(...)` try using `.from(...).to(...).in(...)`. Your query was not modified."):this.rangeStack[0]=t,this},f.prototype.to=function(t){return this.hasTerms?i.warn("`to(...)` is not allowed after `match(...)` try using `.from(...).to(...).in(...)`. Your query was not modified."):this.rangeStack[1]=t,this},f.prototype.boost=function(t){return this.commit(),this.q+="^"+t,this},f.prototype.toParam=function(){return this.commit(),this.cleanup(),this.q},f.prototype.clone=function(){return this.commit(),this.cleanup(),new f(this.q+"")},f.prototype.addModifier=function(t){return this.currentModifer?i.warn("You have called `"+this.currentModifer+"()` after `"+t+"()`. Your current query was not modified."):(this.commit(),""===this.q&&"not"!==t?i.warn("You have called `"+t+"()` without calling another method to modify your query first. Try calling `match()` first."):(this.currentModifer=t,this.q+=""===this.q?"":" ",this.q+=t.toUpperCase()+" ")),this},f.prototype.hasWhiteSpace=function(t){return/\s/g.test(t)},f.prototype.formatTerm=function(t){return t instanceof Date?t.getTime():"string"==typeof t&&this.hasWhiteSpace(t)?'"'+t+'"':t},f.prototype.commit=function(){var e=this;return this.currentModifer=void 0,this.hasRange&&(this.q+="["+this.formatTerm(this.rangeStack[0])+" TO "+this.formatTerm(this.rangeStack[1])+"]",this.rangeStack=[void 0,void 0]),this.hasTerms&&(this.q+=this.termStack.map(function(t){return e.formatTerm(t)}).join(" "),this.termStack=[]),this},Object.defineProperty(f.prototype,"hasTerms",{get:function(){return 0<this.termStack.length},enumerable:!0,configurable:!0}),Object.defineProperty(f.prototype,"hasRange",{get:function(){return this.rangeStack.length&&this.rangeStack[0]&&this.rangeStack[1]},enumerable:!0,configurable:!0}),f.prototype.cleanup=function(){if(0<this.openGroups)for(i.warn("Automatically closing "+this.openGroups+" group(s). You can use `endGroup(...)` to remove this warning.");0<this.openGroups;)this.q+=")",this.openGroups--;var t=this.q;this.q=t.replace(/( AND ?| NOT ?| OR ?)*$/,""),t!==this.q&&i.warn("`startGroup(...)` was called without calling `endGroup(...)` first. Your query was not modified."),this.q=this.q.replace(/(\(\))*/,"")},f);function f(t){void 0===t&&(t=""),this.termStack=[],this.rangeStack=[],this.openGroups=0,this.q=t}function l(r,n){var t,e;e="string"==typeof r||r instanceof h?{httpMethod:"GET",params:{q:r}}:i.appendCustomParams(r,["q","num","start","sortField","sortOrder"],{httpMethod:"GET"});var o="item"===n?"/search":"/community/groups";switch(n){case"item":o="/search";break;case"group":o="/community/groups";break;default:o="/portals/self/users/search"}return t=u(e)+o,i.request(t,e).then(function(e){return e.nextStart&&-1!==e.nextStart&&(e.nextPage=function(){var t;return"string"==typeof r||r instanceof h?t={q:r,start:e.nextStart}:(t=r).start=e.nextStart,l(t,n)}),e})}function g(t){return l(t,"item")}function v(t){var e=t.id,r=u(t)+"/community/groups/"+e+"/addUsers",n=Object.assign({},t,{admins:void 0,users:void 0}),o=y("users",t.users,n).concat(y("admins",t.admins,n)).map(function(t){return function(t,e){return i.request(t,e).catch(function(t){return{errors:[t]}})}(r,t)});return Promise.all(o).then(I)}function y(e,t,r){return!t||t.length<1?[]:function(t,e){if(0===t.length)return[];for(var r=[],n=0;n<t.length;n+=e)r.push(t.slice(n,n+e));return r}(t,25).map(function(t){return function(t,e,r){var n,o;return Object.assign({},r,((n={})[t]=e,n.params=a({},r.params,((o={})[t]=e,o)),n))}(e,t,r)})}function I(t){var e=t.filter(function(t){return t.notAdded}).reduce(function(t,e){return t.concat(e.notAdded)},[]),r=t.filter(function(t){return t.errors}).reduce(function(t,e){return t.concat(e.errors)},[]),n={notAdded:e};return 0<r.length&&(n.errors=r),n}function q(t){var e=u(t)+"/community/groups/"+t.id+"/updateUsers",r={authentication:t.authentication,params:{}};return"admin"===t.newMemberType?r.params.admins=t.users:r.params.users=t.users,i.request(e,r)}function w(t){var e,r={httpMethod:"GET"};if("string"==typeof t)e="https://www.arcgis.com/sharing/rest/community/users/"+t;else{var n=t.username||t.authentication.username;e=u(t)+"/community/users/"+encodeURIComponent(n),r=a({},t,r)}return i.request(e,r)}function T(t,e){return e.params=a({org:!1,everyone:!1},e.params),"private"===e.access&&(e.params.groups=" "),"org"===e.access&&(e.params.org=!0),"public"===e.access&&(e.params.account=!0,e.params.everyone=!0),i.request(t,e)}function b(i){var a=i.authentication.username,u=i.owner||a,s=i.confirmItemControl||!1;return w({username:a,authentication:i.authentication}).then(function(r){var n="org_admin"===r.role,o="share"===i.action?"notSharedWith":"notUnsharedFrom";return U(i).then(function(t){if("share"===i.action&&!0===t||"unshare"===i.action&&!1===t){var e={itemId:i.id,shortcut:!0};return e[o]=[],e}return d(i).then(function(t){if("none"===t&&!n)throw Error("This item can not be "+i.action+"d by "+a+" as they are not a member of the specified group "+i.groupId+".");if(s&&u!==a&&!n)throw Error("This item can not be "+i.action+"d to shared editing group "+i.groupId+" by "+a+" as they not the item owner.");if("unshare"===i.action&&u!==a&&"admin"!==t&&"owner"!==t)throw Error("This item can not be "+i.action+"d from group "+i.groupId+" by "+a+" as they not the item owner, group admin or group owner.");if("share"===i.action&&s&&u!==a&&n)return function(n,o){var i=o.owner;return w({username:i,authentication:o.authentication}).then(function(t){if(n.orgId!==t.orgId)throw Error("User "+i+" is not a member of the same org as "+n.username+". Consequently they can not be added added to group "+o.groupId+" nor can item "+o.id+" be shared to the group.");var e=t.groups||[],r=e.find(function(t){return t.id===o.groupId});if(!r&&511<e.length)throw Error("User "+i+" already has 512 groups, and can not be added to group "+o.groupId+". Consequently item "+o.id+" can not be shared to the group.");return r?"member"===r.userMembership.memberType?q({id:o.groupId,users:[i],newMemberType:"admin",authentication:o.authentication}).then(function(t){return{notAdded:t.results.reduce(function(t,e){return e.success||t.push(e.username),t},[])}}):{notAdded:[]}:v({id:o.groupId,admins:[i],authentication:o.authentication})}).then(function(t){if(t.notAdded.length)throw Error("Error adding user "+i+" to group "+o.groupId+". Consequently item "+o.id+" was not shared to the group.");return G(o)})}(r,i);if("none"!==t)return G(i);throw Error("This item can not be "+i.action+"d by "+a+" as they are not a member of the specified group "+i.groupId+".")}).then(function(t){if(t[o].length)throw Error("Item "+i.id+" could not be "+i.action+"d to group "+i.groupId+".");return t})})})}function G(t){var e=t.authentication.username,r=t.owner||e,n=u(t)+"/content/items/"+t.id+"/"+t.action;return r===e&&(n=u(t)+"/content/users/"+r+"/items/"+t.id+"/"+t.action),t.params={groups:t.groupId,confirmItemControl:t.confirmItemControl},i.request(n,t)}function U(e){return g({q:"id: "+e.id+" AND group: "+e.groupId,start:1,num:10,sortField:"title",authentication:e.authentication,httpMethod:"POST"}).then(function(t){if(0<t.total)return t.results.some(function(t){return t.id===e.id})})}function R(t,e){var r=t||"self",n=u(e)+"/portals/"+r,o=a({httpMethod:"GET"},e);return i.request(n,o)}t.SearchQueryBuilder=h,t.acceptInvitation=function(t){var e=encodeURIComponent(t.authentication.username),r=u(t)+"/community/users/"+e+"/invitations/"+t.invitationId+"/accept",n=a({},t);return i.request(r,n)},t.addGroupUsers=v,t.addItemData=function(t){var e=a({item:{id:t.id,data:t.data}},t);return delete e.id,delete e.data,r(e)},t.addItemPart=function(n){return e(n).then(function(t){var e=u(n)+"/content/users/"+t+"/items/"+n.id+"/addPart",r=i.appendCustomParams(n,["file","partNum"],{params:a({},n.params)});return i.request(e,r)})},t.addItemRelationship=function(n){return e(n).then(function(t){var e=u(n)+"/content/users/"+t+"/addRelationship",r=i.appendCustomParams(n,["originItemId","destinationItemId","relationshipType"],{params:a({},n.params)});return i.request(e,r)})},t.addItemResource=function(r){return e(r).then(function(t){var e=u(r)+"/content/users/"+t+"/items/"+r.id+"/addResources";return r.params=a({file:r.resource,fileName:r.name,resourcesPrefix:r.prefix,text:r.content,access:r.private?"private":"inherit"},r.params),i.request(e,r)})},t.cancelItemUpload=function(r){return e(r).then(function(t){var e=u(r)+"/content/users/"+t+"/items/"+r.id+"/cancel";return i.request(e,r)})},t.commitItemUpload=function(r){return e(r).then(function(t){var e=u(r)+"/content/users/"+t+"/items/"+r.id+"/commit";return i.request(e,r)})},t.createFolder=function(r){return e(r).then(function(t){var e=u(r)+"/content/users/"+t+"/createFolder";return r.params=a({title:r.title},r.params),i.request(e,r)})},t.createGroup=function(t){var e=u(t)+"/community/createGroup";return t.params=a({},t.params,t.group),i.request(e,t)},t.createGroupNotification=function(t){var e=u(t)+"/community/groups/"+t.id+"/createNotification",r=a({params:a({subject:t.subject,message:t.message,users:t.users,notificationChannelType:t.notificationChannelType||"email",clientId:t.clientId,silentNotification:t.silentNotification,notifyAll:!t.users||0===t.users.length},t.params)},t);return i.request(e,r)},t.createItem=function(t){return n(a({folderId:null},t))},t.createItemInFolder=n,t.declineInvitation=function(t){var e=encodeURIComponent(t.authentication.username),r=u(t)+"/community/users/"+e+"/invitations/"+t.invitationId+"/decline",n=a({},t);return i.request(r,n)},t.determineOwner=e,t.getGroup=o,t.getGroupContent=function(t,e){var r=u(e)+"/content/groups/"+t,n=a({httpMethod:"GET"},{params:{start:1,num:100}},e);return e&&e.paging&&(n.params=a({},e.paging)),i.request(r,n)},t.getGroupUsers=function(t,e){var r=u(e)+"/community/groups/"+t+"/users",n=a({httpMethod:"GET"},e);return i.request(r,n)},t.getItem=function(t,e){var r=u(e)+"/content/items/"+t,n=a({httpMethod:"GET"},e);return i.request(r,n)},t.getItemData=function(t,e){var r=u(e)+"/content/items/"+t+"/data",n=a({httpMethod:"GET",params:{}},e);return n.file&&(n.params.f=null),i.request(r,n).catch(function(t){if(!RegExp(/The string did not match the expected pattern|(Unexpected end of (JSON input|data at line 1 column 1))/i).test(t.message))throw t})},t.getItemGroups=function(t,e){var r=u(e)+"/content/items/"+t+"/groups";return i.request(r,e)},t.getItemParts=function(r){return e(r).then(function(t){var e=u(r)+"/content/users/"+t+"/items/"+r.id+"/parts";return i.request(e,r)})},t.getItemResources=function(t,e){var r=u(e)+"/content/items/"+t+"/resources",n=a({},e);return n.params=a({num:1e3},n.params),i.request(r,n)},t.getItemStatus=function(n){return e(n).then(function(t){var e=u(n)+"/content/users/"+t+"/items/"+n.id+"/status",r=i.appendCustomParams(n,["jobId","jobType"],{params:a({},n.params)});return i.request(e,r)})},t.getPortal=R,t.getPortalUrl=u,t.getRelatedItems=function(t){var e=u(t)+"/content/items/"+t.id+"/relatedItems",r=a({httpMethod:"GET",params:{direction:t.direction}},t);return"string"==typeof t.relationshipType?r.params.relationshipType=t.relationshipType:r.params.relationshipTypes=t.relationshipType,delete r.direction,delete r.relationshipType,i.request(e,r)},t.getSelf=function(t){return R(null,t)},t.getSharingUrl=c,t.getUser=w,t.getUserInvitation=function(t){var e=encodeURIComponent(t.authentication.username),r=u(t)+"/community/users/"+e+"/invitations/"+t.invitationId,n={httpMethod:"GET"};return n=a({},t,n),i.request(r,n)},t.getUserInvitations=function(t){var e={httpMethod:"GET"},r=encodeURIComponent(t.authentication.username),n=u(t)+"/community/users/"+r+"/invitations";return e=a({},t,e),i.request(n,e)},t.getUserMembership=d,t.getUserNotifications=function(t){var e={httpMethod:"GET"},r=encodeURIComponent(t.authentication.username),n=u(t)+"/community/users/"+r+"/notifications";return e=a({},t,e),i.request(n,e)},t.getUserTags=function(t){var e=t.username||t.authentication.username,r=u(t)+"/community/users/"+encodeURIComponent(e)+"/tags";return i.request(r,t)},t.getUserUrl=function(t){return u(t)+"/community/users/"+encodeURIComponent(t.username)},t.isItemOwner=m,t.isItemSharedWithGroup=U,t.isOrgAdmin=p,t.joinGroup=function(t){var e=u(t)+"/community/groups/"+t.id+"/join";return i.request(e,t)},t.leaveGroup=function(t){var e=u(t)+"/community/groups/"+t.id+"/leave";return i.request(e,t)},t.moveItem=function(n){return e(n).then(function(t){var e=u(n)+"/content/users/"+t+"/items/"+n.itemId+"/move",r=n.folderId;return r=r||"/",n.params=a({folder:r},n.params),i.request(e,n)})},t.protectGroup=function(t){var e=u(t)+"/community/groups/"+t.id+"/protect";return i.request(e,t)},t.protectItem=function(r){return e(r).then(function(t){var e=u(r)+"/content/users/"+t+"/items/"+r.id+"/protect";return i.request(e,r)})},t.reassignItem=function(n){return p(n).then(function(t){if(!t)throw Error("Item "+n.id+" can not be reassigned because current user is not an organization administrator.");var e=u(n)+"/content/users/"+n.currentOwner+"/items/"+n.id+"/reassign",r={params:{targetUsername:n.targetUsername,targetFolderName:n.targetFolderName},authentication:n.authentication};return i.request(e,r)})},t.removeFolder=function(r){return e(r).then(function(t){var e=u(r)+"/content/users/"+encodeURIComponent(t)+"/"+r.folderId+"/delete";return i.request(e,r)})},t.removeGroup=function(t){var e=u(t)+"/community/groups/"+t.id+"/delete",r=a({},t);return i.request(e,r)},t.removeItem=function(r){return e(r).then(function(t){var e=u(r)+"/content/users/"+t+"/items/"+r.id+"/delete";return i.request(e,r)})},t.removeItemRelationship=function(n){return e(n).then(function(t){var e=u(n)+"/content/users/"+t+"/removeRelationship",r=i.appendCustomParams(n,["originItemId","destinationItemId","relationshipType"],{params:a({},n.params)});return i.request(e,r)})},t.removeItemResource=function(r){return e(r).then(function(t){var e=u(r)+"/content/users/"+t+"/items/"+r.id+"/removeResources";return r.params=a({},r.params,{resource:r.resource}),i.request(e,r)})},t.removeNotification=function(t){var e=encodeURIComponent(t.authentication.username),r=u(t)+"/community/users/"+e+"/notifications/"+t.id+"/delete";return i.request(r,t)},t.searchGroupUsers=function(t,e){var r=u(e)+"/community/groups/"+t+"/userlist",n=i.appendCustomParams(e||{},["name","num","start","sortField","sortOrder","joined","memberType"],{httpMethod:"GET"});return i.request(r,n)},t.searchGroups=function(t){return l(t,"group")},t.searchItems=g,t.searchUsers=function(t){return l(t,"user")},t.serializeItem=s,t.setItemAccess=function(e){var r=c(e);return m(e)?T(r,e):p(e).then(function(t){if(t)return T(r,e);throw Error("This item can not be shared by "+e.authentication.username+". They are neither the item owner nor an organization admin.")})},t.shareItemWithGroup=function(t){return b(a({action:"share"},t))},t.unprotectGroup=function(t){var e=u(t)+"/community/groups/"+t.id+"/unprotect";return i.request(e,t)},t.unprotectItem=function(r){return e(r).then(function(t){var e=u(r)+"/content/users/"+t+"/items/"+r.id+"/unprotect";return i.request(e,r)})},t.unshareItemWithGroup=function(t){return b(a({action:"unshare"},t))},t.updateGroup=function(t){var e=u(t)+"/community/groups/"+t.group.id+"/update";return t.params=a({},t.params,t.group),i.request(e,t)},t.updateItem=r,t.updateItemInfo=function(r){return e(r).then(function(t){var e=u(r)+"/content/users/"+t+"/items/"+r.id+"/updateinfo";return r.params=a({folderName:r.folderName,file:r.file},r.params),i.request(e,r)})},t.updateItemResource=function(r){return e(r).then(function(t){var e=u(r)+"/content/users/"+t+"/items/"+r.id+"/updateResources";return r.params=a({file:r.resource,fileName:r.name,text:r.content},r.params),void 0!==r.private&&(r.params.access=r.private?"private":"inherit"),i.request(e,r)})},t.updateUser=function(t){var e=t.user.username||t.authentication.username,r=u(t)+"/community/users/"+encodeURIComponent(e)+"/update";return t.params=a({},t.user,t.params),delete t.user,i.request(r,t)},t.updateUserMemberships=q,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=portal.umd.min.js.map
{
"name": "@esri/arcgis-rest-portal",
"version": "2.10.1",
"version": "2.10.2",
"description": "ArcGIS Online and Enterprise content and user helpers for @esri/arcgis-rest-request",

@@ -16,8 +16,8 @@ "main": "dist/node/index.js",

"dependencies": {
"@esri/arcgis-rest-types": "^2.10.1",
"@esri/arcgis-rest-types": "^2.10.2",
"tslib": "^1.9.3"
},
"devDependencies": {
"@esri/arcgis-rest-auth": "^2.10.1",
"@esri/arcgis-rest-request": "^2.10.1"
"@esri/arcgis-rest-auth": "^2.10.2",
"@esri/arcgis-rest-request": "^2.10.2"
},

@@ -24,0 +24,0 @@ "peerDependencies": {

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc