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
7
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.1.1 to 2.2.0

30

dist/esm/groups/get.d.ts
import { IRequestOptions } from "@esri/arcgis-rest-request";
import { IPagingParams, IGroup, IItem } from "@esri/arcgis-rest-types";
import { IPagingParams, IGroup, IItem, IUser } from "@esri/arcgis-rest-types";
export interface IGetGroupContentOptions extends IRequestOptions {

@@ -48,1 +48,29 @@ paging: IPagingParams;

export declare function getGroupUsers(id: string, requestOptions?: IRequestOptions): Promise<IGroupUsersResult>;
export interface ISearchGroupUsersOptions extends IRequestOptions, IPagingParams {
name?: string;
sortField?: string;
sortOrder?: string;
[key: string]: any;
}
export interface ISearchGroupUsersResult {
total: number;
start: number;
num: number;
nextStart: number;
owner: IUser;
users: any[];
}
/**
* ```js
* import { searchGroupUsers } from "@esri/arcgis-rest-portal";
* //
* searchGroupUsers('abc123')
* .then(response)
* ```
* Search the users in a group. See the [REST Documentation](https://developers.arcgis.com/rest/users-groups-and-items/group-users-list.htm) for more information.
*
* @param id - The group id
* @param searchOptions - Options for the request, including paging parameters.
* @returns A Promise that will resolve with the data from the response.
*/
export declare function searchGroupUsers(id: string, searchOptions: ISearchGroupUsersOptions): Promise<ISearchGroupUsersResult>;
/* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc.
* Apache-2.0 */
import * as tslib_1 from "tslib";
import { request } from "@esri/arcgis-rest-request";
import { request, appendCustomParams } from "@esri/arcgis-rest-request";
import { getPortalUrl } from "../util/get-portal-url";

@@ -55,2 +55,22 @@ /**

}
/**
* ```js
* import { searchGroupUsers } from "@esri/arcgis-rest-portal";
* //
* searchGroupUsers('abc123')
* .then(response)
* ```
* Search the users in a group. See the [REST Documentation](https://developers.arcgis.com/rest/users-groups-and-items/group-users-list.htm) for more information.
*
* @param id - The group id
* @param searchOptions - Options for the request, including paging parameters.
* @returns A Promise that will resolve with the data from the response.
*/
export function searchGroupUsers(id, searchOptions) {
var url = getPortalUrl(searchOptions) + "/community/groups/" + id + "/userlist";
var options = appendCustomParams(searchOptions, ["name", "num", "start", "sortField", "sortOrder"], {
httpMethod: "GET"
});
return request(url, options);
}
//# sourceMappingURL=get.js.map

@@ -60,2 +60,23 @@ "use strict";

exports.getGroupUsers = getGroupUsers;
/**
* ```js
* import { searchGroupUsers } from "@esri/arcgis-rest-portal";
* //
* searchGroupUsers('abc123')
* .then(response)
* ```
* Search the users in a group. See the [REST Documentation](https://developers.arcgis.com/rest/users-groups-and-items/group-users-list.htm) for more information.
*
* @param id - The group id
* @param searchOptions - Options for the request, including paging parameters.
* @returns A Promise that will resolve with the data from the response.
*/
function searchGroupUsers(id, searchOptions) {
var url = get_portal_url_1.getPortalUrl(searchOptions) + "/community/groups/" + id + "/userlist";
var options = arcgis_rest_request_1.appendCustomParams(searchOptions, ["name", "num", "start", "sortField", "sortOrder"], {
httpMethod: "GET"
});
return arcgis_rest_request_1.request(url, options);
}
exports.searchGroupUsers = searchGroupUsers;
//# sourceMappingURL=get.js.map

6

dist/umd/portal.umd.min.js
/* @preserve
* @esri/arcgis-rest-portal - v2.1.1 - Apache-2.0
* @esri/arcgis-rest-portal - v2.2.0 - Apache-2.0
* Copyright (c) 2017-2019 Esri, Inc.
* Mon Jul 15 2019 11:50:34 GMT-0700 (PDT)
* Thu Jul 18 2019 14:52:40 GMT-0700 (PDT)
*/
!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,s){"use strict";var u=function(){return(u=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 c(t){return void 0===t&&(t={}),t.portal?s.cleanUrl(t.portal):t.authentication?t.authentication.portal:"https://www.arcgis.com/sharing/rest"}function o(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 i(t){return t.owner?t.owner:t.item&&t.item.owner?t.item.owner:t.authentication.username}function r(t){var e=i(t),r=c(t)+"/content/users/"+e+"/items/"+t.item.id+"/update";return t.params=u({},t.params,o(t.item)),s.request(r,t)}function e(t){var e=i(t),r=c(t)+"/content/users/"+e,n=r+"/addItem";return t.folderId&&(n=r+"/"+t.folderId+"/addItem"),t.params=u({},t.params,o(t.item)),s.request(n,t)}var a=function(){function t(t){void 0===t&&(t=""),this.termStack=[],this.rangeStack=[],this.openGroups=0,this.q=t}return t.prototype.match=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this.termStack=this.termStack.concat(t),this},t.prototype.in=function(t){var e="`in("+(t?'"'+t+'"':"")+")`";return this.hasRange||this.hasTerms?(t&&"*"!==t&&(this.q+=t+":"),this.commit()):(s.warn(e+" was called with no call to `match(...)` or `from(...)`/`to(...)`. Your query was not modified."),this)},t.prototype.startGroup=function(){return this.commit(),0<this.openGroups&&(this.q+=" "),this.openGroups++,this.q+="(",this},t.prototype.endGroup=function(){return this.openGroups<=0?s.warn("`endGroup(...)` was called without calling `startGroup(...)` first. Your query was not modified."):(this.commit(),this.openGroups--,this.q+=")"),this},t.prototype.and=function(){return this.addModifier("and")},t.prototype.or=function(){return this.addModifier("or")},t.prototype.not=function(){return this.addModifier("not")},t.prototype.from=function(t){return this.hasTerms?s.warn("`from(...)` is not allowed after `match(...)` try using `.from(...).to(...).in(...)`. Your query was not modified."):this.rangeStack[0]=t,this},t.prototype.to=function(t){return this.hasTerms?s.warn("`to(...)` is not allowed after `match(...)` try using `.from(...).to(...).in(...)`. Your query was not modified."):this.rangeStack[1]=t,this},t.prototype.boost=function(t){return this.commit(),this.q+="^"+t,this},t.prototype.toParam=function(){return this.commit(),this.cleanup(),this.q},t.prototype.clone=function(){return this.commit(),this.cleanup(),new t(this.q+"")},t.prototype.addModifier=function(t){return this.currentModifer?(s.warn("You have called `"+this.currentModifer+"()` after `"+t+"()`. Your current query was not modified."),this):(this.commit(),""===this.q&&"not"!==t?s.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)},t.prototype.hasWhiteSpace=function(t){return/\s/g.test(t)},t.prototype.formatTerm=function(t){return t instanceof Date?t.getTime():"string"==typeof t&&this.hasWhiteSpace(t)?'"'+t+'"':t},t.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(t.prototype,"hasTerms",{get:function(){return 0<this.termStack.length},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasRange",{get:function(){return this.rangeStack.length&&this.rangeStack[0]&&this.rangeStack[1]},enumerable:!0,configurable:!0}),t.prototype.cleanup=function(){if(0<this.openGroups)for(s.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&&s.warn("`startGroup(...)` was called without calling `endGroup(...)` first. Your query was not modified."),this.q=this.q.replace(/(\(\))*/,"")},t}();function m(r,n){var t,e;return t=c(e="string"==typeof r||r instanceof a?{httpMethod:"GET",params:{q:r}}:s.appendCustomParams(r,["q","num","start","sortField","sortOrder"],{httpMethod:"GET"}))+("item"===n?"/search":"/community/groups"),s.request(t,e).then(function(e){return e.nextStart&&-1!==e.nextStart&&(e.nextPage=function(){var t;return"string"==typeof r||r instanceof a?t={q:r,start:e.nextStart}:(t=r).start=e.nextStart,m(t,n)}),e})}function p(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=u({},r.params,((o={})[t]=e,o)),n))}(e,t,r)})}function d(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 n(t,e){var r=c(e)+"/community/groups/"+t,n=u({httpMethod:"GET"},e);return s.request(r,n)}function h(t){var e=t.authentication.username,r=t.owner||e;return c(t)+"/content/users/"+encodeURIComponent(r)+"/items/"+t.id+"/share"}function f(t){var e=t.authentication.username;return(t.owner||e)===e}function l(t){return t.authentication.getUser(t).then(function(t){return!(!t||"org_admin"!==t.role)})}function g(t){return n(t.groupId,t).then(function(t){return t.userMembership.memberType}).catch(function(){return"nonmember"})}function v(t,e){return e.params=u({org:!1,everyone:!1},e.params),"private"===e.access&&(e.params.groups=" "),"org"===e.access&&(e.params.org=!0),"public"===e.access&&(e.params.org=!0,e.params.everyone=!0),s.request(t,e)}function y(o){var i=o.authentication.username,a=o.owner||i;return l(o).then(function(r){var n="share"===o.action?"notSharedWith":"notUnsharedFrom";return function(n){var t={q:"id: "+n.id+" AND group: "+n.groupId,start:1,num:10,sortField:"title"},e=u({},n,{rawResponse:!1});e.params=u({},t,n.params);var r=c(e)+"/search";return s.request(r,e).then(function(t){return 0!==t.total&&(t.results.some(function(t){var e=t.id===n.id;return e&&(r=t),e}),!!r);var r})}(o).then(function(t){if("share"===o.action&&!0===t||"unshare"===o.action&&!1===t){var e={itemId:o.id,shortcut:!0};return e[n]=[],e}return g(o).then(function(t){if("nonmember"===t)throw Error("This item can not be "+o.action+"d by "+i+" as they are not a member of the specified group "+o.groupId+".");if(a===i)return c(o)+"/content/users/"+a+"/items/"+o.id+"/"+o.action;if("admin"===t||"owner"===t||r)return c(o)+"/content/items/"+o.id+"/"+o.action;throw Error("This item can not be "+o.action+"d by "+i+" as they are neither the owner, a groupAdmin of "+o.groupId+", nor an org_admin.")}).then(function(t){return o.params={groups:o.groupId,confirmItemControl:o.confirmItemControl},s.request(t,o)}).then(function(t){if(t[n].length)throw Error("Item "+o.id+" could not be "+o.action+"d to group "+o.groupId+".");return t})})})}function q(t,e){var r=t||"self",n=c(e)+"/portals/"+r,o=u({httpMethod:"GET"},e);return s.request(n,o)}t.SearchQueryBuilder=a,t.acceptInvitation=function(t){var e=encodeURIComponent(t.authentication.username),r=c(t)+"/community/users/"+e+"/invitations/"+t.invitationId+"/accept",n=u({},t);return s.request(r,n)},t.addGroupUsers=function(t){var e=t.id,r=c(t)+"/community/groups/"+e+"/addUsers",n=Object.assign({},t,{admins:void 0,users:void 0}),o=p("users",t.users,n).concat(p("admins",t.admins,n)).map(function(t){return function(t,e){return s.request(t,e).catch(function(t){return{errors:[t]}})}(r,t)});return Promise.all(o).then(d)},t.addItemData=function(t){i(t);var e=u({item:{id:t.id,data:t.data}},t);return delete e.id,delete e.data,r(e)},t.addItemRelationship=function(t){var e=i(t),r=c(t)+"/content/users/"+e+"/addRelationship",n=s.appendCustomParams(t,["originItemId","destinationItemId","relationshipType"],{params:u({},t.params)});return s.request(r,n)},t.addItemResource=function(t){var e=i(t),r=c(t)+"/content/users/"+e+"/items/"+t.id+"/addResources";return t.params=u({file:t.resource,fileName:t.name,text:t.content,access:t.private?"private":"inherit"},t.params),s.request(r,t)},t.createFolder=function(t){var e=i(t),r=c(t)+"/content/users/"+e+"/createFolder";return t.params=u({title:t.title},t.params),s.request(r,t)},t.createGroup=function(t){var e=c(t)+"/community/createGroup";return t.params=u({},t.params,t.group),s.request(e,t)},t.createGroupNotification=function(t){var e=c(t)+"/community/groups/"+t.id+"/createNotification",r=u({params:u({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 s.request(e,r)},t.createItem=function(t){return e(u({folderId:null},t))},t.createItemInFolder=e,t.declineInvitation=function(t){var e=encodeURIComponent(t.authentication.username),r=c(t)+"/community/users/"+e+"/invitations/"+t.invitationId+"/decline",n=u({},t);return s.request(r,n)},t.determineOwner=i,t.getGroup=n,t.getGroupContent=function(t,e){var r=c(e)+"/content/groups/"+t,n=u({httpMethod:"GET"},{params:{start:1,num:100}},e);return e&&e.paging&&(n.params=u({},e.paging)),s.request(r,n)},t.getGroupUsers=function(t,e){var r=c(e)+"/community/groups/"+t+"/users",n=u({httpMethod:"GET"},e);return s.request(r,n)},t.getItem=function(t,e){var r=c(e)+"/content/items/"+t,n=u({httpMethod:"GET"},e);return s.request(r,n)},t.getItemData=function(t,e){var r=c(e)+"/content/items/"+t+"/data",n=u({httpMethod:"GET",params:{}},e);return n.file&&(n.params.f=null),s.request(r,n).catch(function(t){if(!RegExp(/Unexpected end of (JSON input|data at line 1 column 1)/i).test(t.message))throw t})},t.getItemGroups=function(t,e){var r=c(e)+"/content/items/"+t+"/groups";return s.request(r,e)},t.getItemResources=function(t,e){var r=c(e)+"/content/items/"+t+"/resources";return e.params=u({},e.params,{num:1e3}),s.request(r,e)},t.getPortal=q,t.getPortalUrl=c,t.getRelatedItems=function(t){var e=c(t)+"/content/items/"+t.id+"/relatedItems",r=u({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,s.request(e,r)},t.getSelf=function(t){return q(null,t)},t.getSharingUrl=h,t.getUser=function(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=c(t)+"/community/users/"+encodeURIComponent(n),r=u({},t,r)}return s.request(e,r)},t.getUserInvitation=function(t){var e=encodeURIComponent(t.authentication.username),r=c(t)+"/community/users/"+e+"/invitations/"+t.invitationId,n={httpMethod:"GET"};return n=u({},t,n),s.request(r,n)},t.getUserInvitations=function(t){var e={httpMethod:"GET"},r=encodeURIComponent(t.authentication.username),n=c(t)+"/community/users/"+r+"/invitations";return e=u({},t,e),s.request(n,e)},t.getUserMembership=g,t.getUserNotifications=function(t){var e={httpMethod:"GET"},r=encodeURIComponent(t.authentication.username),n=c(t)+"/community/users/"+r+"/notifications";return e=u({},t,e),s.request(n,e)},t.getUserUrl=function(t){return c(t)+"/community/users/"+encodeURIComponent(t.username)},t.isItemOwner=f,t.isOrgAdmin=l,t.joinGroup=function(t){var e=c(t)+"/community/groups/"+t.id+"/join";return s.request(e,t)},t.leaveGroup=function(t){var e=c(t)+"/community/groups/"+t.id+"/leave";return s.request(e,t)},t.moveItem=function(t){var e=i(t),r=c(t)+"/content/users/"+e+"/items/"+t.itemId+"/move",n=t.folderId;return n||(n="/"),t.params=u({folder:n},t.params),s.request(r,t)},t.protectGroup=function(t){var e=c(t)+"/community/groups/"+t.id+"/protect";return s.request(e,t)},t.protectItem=function(t){var e=i(t),r=c(t)+"/content/users/"+e+"/items/"+t.id+"/protect";return s.request(r,t)},t.removeFolder=function(t){var e=i(t),r=c(t)+"/content/users/"+encodeURIComponent(e)+"/"+t.folderId+"/delete";return s.request(r,t)},t.removeGroup=function(t){var e=c(t)+"/community/groups/"+t.id+"/delete",r=u({},t);return s.request(e,r)},t.removeItem=function(t){var e=i(t),r=c(t)+"/content/users/"+e+"/items/"+t.id+"/delete";return s.request(r,t)},t.removeItemRelationship=function(t){var e=i(t),r=c(t)+"/content/users/"+e+"/removeRelationship",n=s.appendCustomParams(t,["originItemId","destinationItemId","relationshipType"],{params:u({},t.params)});return s.request(r,n)},t.removeItemResource=function(t){var e=i(t),r=c(t)+"/content/users/"+e+"/items/"+t.id+"/removeResources";return t.params=u({},t.params,{resource:t.resource}),s.request(r,t)},t.removeNotification=function(t){var e=encodeURIComponent(t.authentication.username),r=c(t)+"/community/users/"+e+"/notifications/"+t.id+"/delete";return s.request(r,t)},t.searchGroups=function(t){return m(t,"group")},t.searchItems=function(t){return m(t,"item")},t.serializeItem=o,t.setItemAccess=function(e){var r=h(e);return f(e)?v(r,e):l(e).then(function(t){if(t)return v(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 y(u({action:"share"},t))},t.unprotectGroup=function(t){var e=c(t)+"/community/groups/"+t.id+"/unprotect";return s.request(e,t)},t.unprotectItem=function(t){var e=i(t),r=c(t)+"/content/users/"+e+"/items/"+t.id+"/unprotect";return s.request(r,t)},t.unshareItemWithGroup=function(t){return y(u({action:"unshare"},t))},t.updateGroup=function(t){var e=c(t)+"/community/groups/"+t.group.id+"/update";return t.params=u({},t.params,t.group),s.request(e,t)},t.updateItem=r,t.updateItemResource=function(t){var e=i(t),r=c(t)+"/content/users/"+e+"/items/"+t.id+"/updateResources";return t.params=u({file:t.resource,fileName:t.name,text:t.content},t.params),void 0!==t.private&&(t.params.access=t.private?"private":"inherit"),s.request(r,t)},t.updateUser=function(t){var e=t.user.username||t.authentication.username,r=c(t)+"/community/users/"+encodeURIComponent(e)+"/update";return t.params=u({},t.user,t.params),delete t.user,s.request(r,t)},Object.defineProperty(t,"__esModule",{value:!0})});
!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,s){"use strict";var u=function(){return(u=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 c(t){return void 0===t&&(t={}),t.portal?s.cleanUrl(t.portal):t.authentication?t.authentication.portal:"https://www.arcgis.com/sharing/rest"}function o(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 i(t){return t.owner?t.owner:t.item&&t.item.owner?t.item.owner:t.authentication.username}function r(t){var e=i(t),r=c(t)+"/content/users/"+e+"/items/"+t.item.id+"/update";return t.params=u({},t.params,o(t.item)),s.request(r,t)}function e(t){var e=i(t),r=c(t)+"/content/users/"+e,n=r+"/addItem";return t.folderId&&(n=r+"/"+t.folderId+"/addItem"),t.params=u({},t.params,o(t.item)),s.request(n,t)}var a=function(){function t(t){void 0===t&&(t=""),this.termStack=[],this.rangeStack=[],this.openGroups=0,this.q=t}return t.prototype.match=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this.termStack=this.termStack.concat(t),this},t.prototype.in=function(t){var e="`in("+(t?'"'+t+'"':"")+")`";return this.hasRange||this.hasTerms?(t&&"*"!==t&&(this.q+=t+":"),this.commit()):(s.warn(e+" was called with no call to `match(...)` or `from(...)`/`to(...)`. Your query was not modified."),this)},t.prototype.startGroup=function(){return this.commit(),0<this.openGroups&&(this.q+=" "),this.openGroups++,this.q+="(",this},t.prototype.endGroup=function(){return this.openGroups<=0?s.warn("`endGroup(...)` was called without calling `startGroup(...)` first. Your query was not modified."):(this.commit(),this.openGroups--,this.q+=")"),this},t.prototype.and=function(){return this.addModifier("and")},t.prototype.or=function(){return this.addModifier("or")},t.prototype.not=function(){return this.addModifier("not")},t.prototype.from=function(t){return this.hasTerms?s.warn("`from(...)` is not allowed after `match(...)` try using `.from(...).to(...).in(...)`. Your query was not modified."):this.rangeStack[0]=t,this},t.prototype.to=function(t){return this.hasTerms?s.warn("`to(...)` is not allowed after `match(...)` try using `.from(...).to(...).in(...)`. Your query was not modified."):this.rangeStack[1]=t,this},t.prototype.boost=function(t){return this.commit(),this.q+="^"+t,this},t.prototype.toParam=function(){return this.commit(),this.cleanup(),this.q},t.prototype.clone=function(){return this.commit(),this.cleanup(),new t(this.q+"")},t.prototype.addModifier=function(t){return this.currentModifer?(s.warn("You have called `"+this.currentModifer+"()` after `"+t+"()`. Your current query was not modified."),this):(this.commit(),""===this.q&&"not"!==t?s.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)},t.prototype.hasWhiteSpace=function(t){return/\s/g.test(t)},t.prototype.formatTerm=function(t){return t instanceof Date?t.getTime():"string"==typeof t&&this.hasWhiteSpace(t)?'"'+t+'"':t},t.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(t.prototype,"hasTerms",{get:function(){return 0<this.termStack.length},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasRange",{get:function(){return this.rangeStack.length&&this.rangeStack[0]&&this.rangeStack[1]},enumerable:!0,configurable:!0}),t.prototype.cleanup=function(){if(0<this.openGroups)for(s.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&&s.warn("`startGroup(...)` was called without calling `endGroup(...)` first. Your query was not modified."),this.q=this.q.replace(/(\(\))*/,"")},t}();function m(r,n){var t,e;return t=c(e="string"==typeof r||r instanceof a?{httpMethod:"GET",params:{q:r}}:s.appendCustomParams(r,["q","num","start","sortField","sortOrder"],{httpMethod:"GET"}))+("item"===n?"/search":"/community/groups"),s.request(t,e).then(function(e){return e.nextStart&&-1!==e.nextStart&&(e.nextPage=function(){var t;return"string"==typeof r||r instanceof a?t={q:r,start:e.nextStart}:(t=r).start=e.nextStart,m(t,n)}),e})}function p(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=u({},r.params,((o={})[t]=e,o)),n))}(e,t,r)})}function d(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 n(t,e){var r=c(e)+"/community/groups/"+t,n=u({httpMethod:"GET"},e);return s.request(r,n)}function h(t){var e=t.authentication.username,r=t.owner||e;return c(t)+"/content/users/"+encodeURIComponent(r)+"/items/"+t.id+"/share"}function f(t){var e=t.authentication.username;return(t.owner||e)===e}function l(t){return t.authentication.getUser(t).then(function(t){return!(!t||"org_admin"!==t.role)})}function g(t){return n(t.groupId,t).then(function(t){return t.userMembership.memberType}).catch(function(){return"nonmember"})}function v(t,e){return e.params=u({org:!1,everyone:!1},e.params),"private"===e.access&&(e.params.groups=" "),"org"===e.access&&(e.params.org=!0),"public"===e.access&&(e.params.org=!0,e.params.everyone=!0),s.request(t,e)}function y(o){var i=o.authentication.username,a=o.owner||i;return l(o).then(function(r){var n="share"===o.action?"notSharedWith":"notUnsharedFrom";return function(n){var t={q:"id: "+n.id+" AND group: "+n.groupId,start:1,num:10,sortField:"title"},e=u({},n,{rawResponse:!1});e.params=u({},t,n.params);var r=c(e)+"/search";return s.request(r,e).then(function(t){return 0!==t.total&&(t.results.some(function(t){var e=t.id===n.id;return e&&(r=t),e}),!!r);var r})}(o).then(function(t){if("share"===o.action&&!0===t||"unshare"===o.action&&!1===t){var e={itemId:o.id,shortcut:!0};return e[n]=[],e}return g(o).then(function(t){if("nonmember"===t)throw Error("This item can not be "+o.action+"d by "+i+" as they are not a member of the specified group "+o.groupId+".");if(a===i)return c(o)+"/content/users/"+a+"/items/"+o.id+"/"+o.action;if("admin"===t||"owner"===t||r)return c(o)+"/content/items/"+o.id+"/"+o.action;throw Error("This item can not be "+o.action+"d by "+i+" as they are neither the owner, a groupAdmin of "+o.groupId+", nor an org_admin.")}).then(function(t){return o.params={groups:o.groupId,confirmItemControl:o.confirmItemControl},s.request(t,o)}).then(function(t){if(t[n].length)throw Error("Item "+o.id+" could not be "+o.action+"d to group "+o.groupId+".");return t})})})}function q(t,e){var r=t||"self",n=c(e)+"/portals/"+r,o=u({httpMethod:"GET"},e);return s.request(n,o)}t.SearchQueryBuilder=a,t.acceptInvitation=function(t){var e=encodeURIComponent(t.authentication.username),r=c(t)+"/community/users/"+e+"/invitations/"+t.invitationId+"/accept",n=u({},t);return s.request(r,n)},t.addGroupUsers=function(t){var e=t.id,r=c(t)+"/community/groups/"+e+"/addUsers",n=Object.assign({},t,{admins:void 0,users:void 0}),o=p("users",t.users,n).concat(p("admins",t.admins,n)).map(function(t){return function(t,e){return s.request(t,e).catch(function(t){return{errors:[t]}})}(r,t)});return Promise.all(o).then(d)},t.addItemData=function(t){i(t);var e=u({item:{id:t.id,data:t.data}},t);return delete e.id,delete e.data,r(e)},t.addItemRelationship=function(t){var e=i(t),r=c(t)+"/content/users/"+e+"/addRelationship",n=s.appendCustomParams(t,["originItemId","destinationItemId","relationshipType"],{params:u({},t.params)});return s.request(r,n)},t.addItemResource=function(t){var e=i(t),r=c(t)+"/content/users/"+e+"/items/"+t.id+"/addResources";return t.params=u({file:t.resource,fileName:t.name,text:t.content,access:t.private?"private":"inherit"},t.params),s.request(r,t)},t.createFolder=function(t){var e=i(t),r=c(t)+"/content/users/"+e+"/createFolder";return t.params=u({title:t.title},t.params),s.request(r,t)},t.createGroup=function(t){var e=c(t)+"/community/createGroup";return t.params=u({},t.params,t.group),s.request(e,t)},t.createGroupNotification=function(t){var e=c(t)+"/community/groups/"+t.id+"/createNotification",r=u({params:u({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 s.request(e,r)},t.createItem=function(t){return e(u({folderId:null},t))},t.createItemInFolder=e,t.declineInvitation=function(t){var e=encodeURIComponent(t.authentication.username),r=c(t)+"/community/users/"+e+"/invitations/"+t.invitationId+"/decline",n=u({},t);return s.request(r,n)},t.determineOwner=i,t.getGroup=n,t.getGroupContent=function(t,e){var r=c(e)+"/content/groups/"+t,n=u({httpMethod:"GET"},{params:{start:1,num:100}},e);return e&&e.paging&&(n.params=u({},e.paging)),s.request(r,n)},t.getGroupUsers=function(t,e){var r=c(e)+"/community/groups/"+t+"/users",n=u({httpMethod:"GET"},e);return s.request(r,n)},t.getItem=function(t,e){var r=c(e)+"/content/items/"+t,n=u({httpMethod:"GET"},e);return s.request(r,n)},t.getItemData=function(t,e){var r=c(e)+"/content/items/"+t+"/data",n=u({httpMethod:"GET",params:{}},e);return n.file&&(n.params.f=null),s.request(r,n).catch(function(t){if(!RegExp(/Unexpected end of (JSON input|data at line 1 column 1)/i).test(t.message))throw t})},t.getItemGroups=function(t,e){var r=c(e)+"/content/items/"+t+"/groups";return s.request(r,e)},t.getItemResources=function(t,e){var r=c(e)+"/content/items/"+t+"/resources";return e.params=u({},e.params,{num:1e3}),s.request(r,e)},t.getPortal=q,t.getPortalUrl=c,t.getRelatedItems=function(t){var e=c(t)+"/content/items/"+t.id+"/relatedItems",r=u({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,s.request(e,r)},t.getSelf=function(t){return q(null,t)},t.getSharingUrl=h,t.getUser=function(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=c(t)+"/community/users/"+encodeURIComponent(n),r=u({},t,r)}return s.request(e,r)},t.getUserInvitation=function(t){var e=encodeURIComponent(t.authentication.username),r=c(t)+"/community/users/"+e+"/invitations/"+t.invitationId,n={httpMethod:"GET"};return n=u({},t,n),s.request(r,n)},t.getUserInvitations=function(t){var e={httpMethod:"GET"},r=encodeURIComponent(t.authentication.username),n=c(t)+"/community/users/"+r+"/invitations";return e=u({},t,e),s.request(n,e)},t.getUserMembership=g,t.getUserNotifications=function(t){var e={httpMethod:"GET"},r=encodeURIComponent(t.authentication.username),n=c(t)+"/community/users/"+r+"/notifications";return e=u({},t,e),s.request(n,e)},t.getUserUrl=function(t){return c(t)+"/community/users/"+encodeURIComponent(t.username)},t.isItemOwner=f,t.isOrgAdmin=l,t.joinGroup=function(t){var e=c(t)+"/community/groups/"+t.id+"/join";return s.request(e,t)},t.leaveGroup=function(t){var e=c(t)+"/community/groups/"+t.id+"/leave";return s.request(e,t)},t.moveItem=function(t){var e=i(t),r=c(t)+"/content/users/"+e+"/items/"+t.itemId+"/move",n=t.folderId;return n||(n="/"),t.params=u({folder:n},t.params),s.request(r,t)},t.protectGroup=function(t){var e=c(t)+"/community/groups/"+t.id+"/protect";return s.request(e,t)},t.protectItem=function(t){var e=i(t),r=c(t)+"/content/users/"+e+"/items/"+t.id+"/protect";return s.request(r,t)},t.removeFolder=function(t){var e=i(t),r=c(t)+"/content/users/"+encodeURIComponent(e)+"/"+t.folderId+"/delete";return s.request(r,t)},t.removeGroup=function(t){var e=c(t)+"/community/groups/"+t.id+"/delete",r=u({},t);return s.request(e,r)},t.removeItem=function(t){var e=i(t),r=c(t)+"/content/users/"+e+"/items/"+t.id+"/delete";return s.request(r,t)},t.removeItemRelationship=function(t){var e=i(t),r=c(t)+"/content/users/"+e+"/removeRelationship",n=s.appendCustomParams(t,["originItemId","destinationItemId","relationshipType"],{params:u({},t.params)});return s.request(r,n)},t.removeItemResource=function(t){var e=i(t),r=c(t)+"/content/users/"+e+"/items/"+t.id+"/removeResources";return t.params=u({},t.params,{resource:t.resource}),s.request(r,t)},t.removeNotification=function(t){var e=encodeURIComponent(t.authentication.username),r=c(t)+"/community/users/"+e+"/notifications/"+t.id+"/delete";return s.request(r,t)},t.searchGroupUsers=function(t,e){var r=c(e)+"/community/groups/"+t+"/userlist",n=s.appendCustomParams(e,["name","num","start","sortField","sortOrder"],{httpMethod:"GET"});return s.request(r,n)},t.searchGroups=function(t){return m(t,"group")},t.searchItems=function(t){return m(t,"item")},t.serializeItem=o,t.setItemAccess=function(e){var r=h(e);return f(e)?v(r,e):l(e).then(function(t){if(t)return v(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 y(u({action:"share"},t))},t.unprotectGroup=function(t){var e=c(t)+"/community/groups/"+t.id+"/unprotect";return s.request(e,t)},t.unprotectItem=function(t){var e=i(t),r=c(t)+"/content/users/"+e+"/items/"+t.id+"/unprotect";return s.request(r,t)},t.unshareItemWithGroup=function(t){return y(u({action:"unshare"},t))},t.updateGroup=function(t){var e=c(t)+"/community/groups/"+t.group.id+"/update";return t.params=u({},t.params,t.group),s.request(e,t)},t.updateItem=r,t.updateItemResource=function(t){var e=i(t),r=c(t)+"/content/users/"+e+"/items/"+t.id+"/updateResources";return t.params=u({file:t.resource,fileName:t.name,text:t.content},t.params),void 0!==t.private&&(t.params.access=t.private?"private":"inherit"),s.request(r,t)},t.updateUser=function(t){var e=t.user.username||t.authentication.username,r=c(t)+"/community/users/"+encodeURIComponent(e)+"/update";return t.params=u({},t.user,t.params),delete t.user,s.request(r,t)},Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=portal.umd.min.js.map
{
"name": "@esri/arcgis-rest-portal",
"version": "2.1.1",
"version": "2.2.0",
"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.1.1",
"@esri/arcgis-rest-types": "^2.2.0",
"tslib": "^1.9.3"
},
"devDependencies": {
"@esri/arcgis-rest-auth": "^2.1.1",
"@esri/arcgis-rest-request": "^2.1.1"
"@esri/arcgis-rest-auth": "^2.2.0",
"@esri/arcgis-rest-request": "^2.2.0"
},

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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