@esri/arcgis-rest-portal
Advanced tools
Comparing version 2.4.0 to 2.5.0
@@ -77,2 +77,2 @@ import { IRequestOptions } from "@esri/arcgis-rest-request"; | ||
*/ | ||
export declare function searchGroupUsers(id: string, searchOptions: ISearchGroupUsersOptions): Promise<ISearchGroupUsersResult>; | ||
export declare function searchGroupUsers(id: string, searchOptions?: ISearchGroupUsersOptions): Promise<ISearchGroupUsersResult>; |
@@ -70,3 +70,3 @@ /* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc. | ||
var url = getPortalUrl(searchOptions) + "/community/groups/" + id + "/userlist"; | ||
var options = appendCustomParams(searchOptions, ["name", "num", "start", "sortField", "sortOrder", "joined", "memberType"], { | ||
var options = appendCustomParams(searchOptions || {}, ["name", "num", "start", "sortField", "sortOrder", "joined", "memberType"], { | ||
httpMethod: "GET" | ||
@@ -73,0 +73,0 @@ }); |
@@ -9,2 +9,3 @@ export * from "./items/add"; | ||
export * from "./items/helpers"; | ||
export * from "./items/upload"; | ||
export * from "./groups/add-users"; | ||
@@ -11,0 +12,0 @@ export * from "./groups/create"; |
@@ -11,2 +11,3 @@ /* Copyright (c) 2018-2019 Environmental Systems Research Institute, Inc. | ||
export * from "./items/helpers"; | ||
export * from "./items/upload"; | ||
export * from "./groups/add-users"; | ||
@@ -13,0 +14,0 @@ export * from "./groups/create"; |
@@ -69,3 +69,4 @@ /* Copyright (c) 2018 Environmental Systems Research Institute, Inc. | ||
"multipart", | ||
"filename" | ||
"filename", | ||
"overwrite" | ||
], { | ||
@@ -72,0 +73,0 @@ params: tslib_1.__assign({}, requestOptions.params) |
@@ -98,2 +98,6 @@ import { IRequestOptions } from "@esri/arcgis-rest-request"; | ||
filename?: string; | ||
/** | ||
* If true, overwrite the existing file. | ||
*/ | ||
overwrite?: boolean; | ||
} | ||
@@ -100,0 +104,0 @@ export interface IItemDataOptions extends IRequestOptions { |
@@ -75,3 +75,3 @@ "use strict"; | ||
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", "joined", "memberType"], { | ||
var options = arcgis_rest_request_1.appendCustomParams(searchOptions || {}, ["name", "num", "start", "sortField", "sortOrder", "joined", "memberType"], { | ||
httpMethod: "GET" | ||
@@ -78,0 +78,0 @@ }); |
@@ -14,2 +14,3 @@ "use strict"; | ||
tslib_1.__exportStar(require("./items/helpers"), exports); | ||
tslib_1.__exportStar(require("./items/upload"), exports); | ||
tslib_1.__exportStar(require("./groups/add-users"), exports); | ||
@@ -16,0 +17,0 @@ tslib_1.__exportStar(require("./groups/create"), exports); |
@@ -72,3 +72,4 @@ "use strict"; | ||
"multipart", | ||
"filename" | ||
"filename", | ||
"overwrite" | ||
], { | ||
@@ -75,0 +76,0 @@ params: tslib_1.__assign({}, requestOptions.params) |
/* @preserve | ||
* @esri/arcgis-rest-portal - v2.4.0 - Apache-2.0 | ||
* @esri/arcgis-rest-portal - v2.5.0 - Apache-2.0 | ||
* Copyright (c) 2017-2019 Esri, Inc. | ||
* Thu Aug 29 2019 09:33:08 GMT-0600 (Mountain Daylight Time) | ||
* Tue Oct 15 2019 15:09:44 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,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 i(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 a(t){return t.owner?t.owner:t.item&&t.item.owner?t.item.owner:t.authentication.username}function r(t){var e=a(t),r=c(t)+"/content/users/"+e+"/items/"+t.item.id+"/update";return t.params=u({},t.params,i(t.item)),s.request(r,t)}function e(t){if(t.file&&!t.multipart)return Promise.reject(new Error("The request must be a multipart request for file uploading."));if(t.multipart&&!t.filename)return Promise.reject(new Error("The file name is required for a multipart request."));var e=a(t),r=c(t)+"/content/users/"+e,n=r+"/addItem";t.folderId&&(n=r+"/"+t.folderId+"/addItem"),t.params=u({},t.params,i(t.item));var o=s.appendCustomParams(t,["owner","folderId","file","dataUrl","text","async","multipart","filename"],{params:u({},t.params)});return s.request(n,o)}var o=(n.prototype.match=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this.termStack=this.termStack.concat(t),this},n.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)},n.prototype.startGroup=function(){return this.commit(),0<this.openGroups&&(this.q+=" "),this.openGroups++,this.q+="(",this},n.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},n.prototype.and=function(){return this.addModifier("and")},n.prototype.or=function(){return this.addModifier("or")},n.prototype.not=function(){return this.addModifier("not")},n.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},n.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},n.prototype.boost=function(t){return this.commit(),this.q+="^"+t,this},n.prototype.toParam=function(){return this.commit(),this.cleanup(),this.q},n.prototype.clone=function(){return this.commit(),this.cleanup(),new n(this.q+"")},n.prototype.addModifier=function(t){return this.currentModifer?s.warn("You have called `"+this.currentModifer+"()` after `"+t+"()`. Your current query was not modified."):(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},n.prototype.hasWhiteSpace=function(t){return/\s/g.test(t)},n.prototype.formatTerm=function(t){return t instanceof Date?t.getTime():"string"==typeof t&&this.hasWhiteSpace(t)?'"'+t+'"':t},n.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(n.prototype,"hasTerms",{get:function(){return 0<this.termStack.length},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"hasRange",{get:function(){return this.rangeStack.length&&this.rangeStack[0]&&this.rangeStack[1]},enumerable:!0,configurable:!0}),n.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(/(\(\))*/,"")},n);function n(t){void 0===t&&(t=""),this.termStack=[],this.rangeStack=[],this.openGroups=0,this.q=t}function m(r,n){var t,e;return t=c(e="string"==typeof r||r instanceof o?{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 o?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 h(t,e){var r=c(e)+"/community/groups/"+t,n=u({httpMethod:"GET"},e);return s.request(r,n)}function f(t){var e=t.authentication.username,r=t.owner||e;return c(t)+"/content/users/"+encodeURIComponent(r)+"/items/"+t.id+"/share"}function l(t){var e=t.authentication.username;return(t.owner||e)===e}function g(t){return t.authentication.getUser(t).then(function(t){return!(!t||"org_admin"!==t.role)})}function v(t){return h(t.groupId,t).then(function(t){return t.userMembership.memberType}).catch(function(){return"nonmember"})}function y(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.account=!0,e.params.everyone=!0),s.request(t,e)}function q(o){var i=o.authentication.username,a=o.owner||i;return g(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 v(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 I(t,e){var r=t||"self",n=c(e)+"/portals/"+r,o=u({httpMethod:"GET"},e);return s.request(n,o)}t.SearchQueryBuilder=o,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){a(t);var e=u({item:{id:t.id,data:t.data}},t);return delete e.id,delete e.data,r(e)},t.addItemPart=function(t){var e=a(t),r=c(t)+"/content/users/"+e+"/items/"+t.id+"/addPart",n=s.appendCustomParams(t,["file","partNum"],{params:u({},t.params)});return s.request(r,n)},t.addItemRelationship=function(t){var e=a(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=a(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=a(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=a,t.getGroup=h,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.getItemParts=function(t){var e=a(t),r=c(t)+"/content/users/"+e+"/items/"+t.id+"/parts";return s.request(r,t)},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.getItemStatus=function(t){var e=a(t),r=c(t)+"/content/users/"+e+"/items/"+t.id+"/status",n=s.appendCustomParams(t,["jobId","jobType"],{params:u({},t.params)});return s.request(r,n)},t.getPortal=I,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 I(null,t)},t.getSharingUrl=f,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=v,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.getUserTags=function(t){var e=t.username||t.authentication.username,r=c(t)+"/community/users/"+encodeURIComponent(e)+"/tags";return s.request(r,t)},t.getUserUrl=function(t){return c(t)+"/community/users/"+encodeURIComponent(t.username)},t.isItemOwner=l,t.isOrgAdmin=g,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=a(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=a(t),r=c(t)+"/content/users/"+e+"/items/"+t.id+"/protect";return s.request(r,t)},t.removeFolder=function(t){var e=a(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=a(t),r=c(t)+"/content/users/"+e+"/items/"+t.id+"/delete";return s.request(r,t)},t.removeItemRelationship=function(t){var e=a(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=a(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","joined","memberType"],{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=i,t.setItemAccess=function(e){var r=f(e);return l(e)?y(r,e):g(e).then(function(t){if(t)return y(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 q(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=a(t),r=c(t)+"/content/users/"+e+"/items/"+t.id+"/unprotect";return s.request(r,t)},t.unshareItemWithGroup=function(t){return q(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=a(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 i(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 a(t){return t.owner?t.owner:t.item&&t.item.owner?t.item.owner:t.authentication.username}function r(t){var e=a(t),r=c(t)+"/content/users/"+e+"/items/"+t.item.id+"/update";return t.params=u({},t.params,i(t.item)),s.request(r,t)}function e(t){if(t.file&&!t.multipart)return Promise.reject(new Error("The request must be a multipart request for file uploading."));if(t.multipart&&!t.filename)return Promise.reject(new Error("The file name is required for a multipart request."));var e=a(t),r=c(t)+"/content/users/"+e,n=r+"/addItem";t.folderId&&(n=r+"/"+t.folderId+"/addItem"),t.params=u({},t.params,i(t.item));var o=s.appendCustomParams(t,["owner","folderId","file","dataUrl","text","async","multipart","filename","overwrite"],{params:u({},t.params)});return s.request(n,o)}var o=(n.prototype.match=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this.termStack=this.termStack.concat(t),this},n.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)},n.prototype.startGroup=function(){return this.commit(),0<this.openGroups&&(this.q+=" "),this.openGroups++,this.q+="(",this},n.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},n.prototype.and=function(){return this.addModifier("and")},n.prototype.or=function(){return this.addModifier("or")},n.prototype.not=function(){return this.addModifier("not")},n.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},n.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},n.prototype.boost=function(t){return this.commit(),this.q+="^"+t,this},n.prototype.toParam=function(){return this.commit(),this.cleanup(),this.q},n.prototype.clone=function(){return this.commit(),this.cleanup(),new n(this.q+"")},n.prototype.addModifier=function(t){return this.currentModifer?s.warn("You have called `"+this.currentModifer+"()` after `"+t+"()`. Your current query was not modified."):(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},n.prototype.hasWhiteSpace=function(t){return/\s/g.test(t)},n.prototype.formatTerm=function(t){return t instanceof Date?t.getTime():"string"==typeof t&&this.hasWhiteSpace(t)?'"'+t+'"':t},n.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(n.prototype,"hasTerms",{get:function(){return 0<this.termStack.length},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"hasRange",{get:function(){return this.rangeStack.length&&this.rangeStack[0]&&this.rangeStack[1]},enumerable:!0,configurable:!0}),n.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(/(\(\))*/,"")},n);function n(t){void 0===t&&(t=""),this.termStack=[],this.rangeStack=[],this.openGroups=0,this.q=t}function m(r,n){var t,e;return t=c(e="string"==typeof r||r instanceof o?{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 o?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 h(t,e){var r=c(e)+"/community/groups/"+t,n=u({httpMethod:"GET"},e);return s.request(r,n)}function f(t){var e=t.authentication.username,r=t.owner||e;return c(t)+"/content/users/"+encodeURIComponent(r)+"/items/"+t.id+"/share"}function l(t){var e=t.authentication.username;return(t.owner||e)===e}function g(t){return t.authentication.getUser(t).then(function(t){return!(!t||"org_admin"!==t.role)})}function v(t){return h(t.groupId,t).then(function(t){return t.userMembership.memberType}).catch(function(){return"nonmember"})}function y(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.account=!0,e.params.everyone=!0),s.request(t,e)}function q(o){var i=o.authentication.username,a=o.owner||i;return g(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 v(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 I(t,e){var r=t||"self",n=c(e)+"/portals/"+r,o=u({httpMethod:"GET"},e);return s.request(n,o)}t.SearchQueryBuilder=o,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){a(t);var e=u({item:{id:t.id,data:t.data}},t);return delete e.id,delete e.data,r(e)},t.addItemPart=function(t){var e=a(t),r=c(t)+"/content/users/"+e+"/items/"+t.id+"/addPart",n=s.appendCustomParams(t,["file","partNum"],{params:u({},t.params)});return s.request(r,n)},t.addItemRelationship=function(t){var e=a(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=a(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.cancelItemUpload=function(t){var e=a(t),r=c(t)+"/content/users/"+e+"/items/"+t.id+"/cancel";return s.request(r,t)},t.commitItemUpload=function(t){var e=a(t),r=c(t)+"/content/users/"+e+"/items/"+t.id+"/commit";return s.request(r,t)},t.createFolder=function(t){var e=a(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=a,t.getGroup=h,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.getItemParts=function(t){var e=a(t),r=c(t)+"/content/users/"+e+"/items/"+t.id+"/parts";return s.request(r,t)},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.getItemStatus=function(t){var e=a(t),r=c(t)+"/content/users/"+e+"/items/"+t.id+"/status",n=s.appendCustomParams(t,["jobId","jobType"],{params:u({},t.params)});return s.request(r,n)},t.getPortal=I,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 I(null,t)},t.getSharingUrl=f,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=v,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.getUserTags=function(t){var e=t.username||t.authentication.username,r=c(t)+"/community/users/"+encodeURIComponent(e)+"/tags";return s.request(r,t)},t.getUserUrl=function(t){return c(t)+"/community/users/"+encodeURIComponent(t.username)},t.isItemOwner=l,t.isOrgAdmin=g,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=a(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=a(t),r=c(t)+"/content/users/"+e+"/items/"+t.id+"/protect";return s.request(r,t)},t.removeFolder=function(t){var e=a(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=a(t),r=c(t)+"/content/users/"+e+"/items/"+t.id+"/delete";return s.request(r,t)},t.removeItemRelationship=function(t){var e=a(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=a(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","joined","memberType"],{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=i,t.setItemAccess=function(e){var r=f(e);return l(e)?y(r,e):g(e).then(function(t){if(t)return y(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 q(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=a(t),r=c(t)+"/content/users/"+e+"/items/"+t.id+"/unprotect";return s.request(r,t)},t.unshareItemWithGroup=function(t){return q(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=a(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.4.0", | ||
"version": "2.5.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.4.0", | ||
"@esri/arcgis-rest-types": "^2.5.0", | ||
"tslib": "^1.9.3" | ||
}, | ||
"devDependencies": { | ||
"@esri/arcgis-rest-auth": "^2.4.0", | ||
"@esri/arcgis-rest-request": "^2.4.0" | ||
"@esri/arcgis-rest-auth": "^2.5.0", | ||
"@esri/arcgis-rest-request": "^2.5.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 not supported yet
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 not supported yet
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
651889
181
7953