@esri/arcgis-rest-portal
Advanced tools
Comparing version 2.17.0 to 2.18.0
import { IRequestOptions } from "@esri/arcgis-rest-request"; | ||
import { IItem, IGroup } from "@esri/arcgis-rest-types"; | ||
import { IItemDataOptions, IItemRelationshipOptions, IUserItemOptions } from "./helpers"; | ||
import { IItemDataOptions, IItemRelationshipOptions, IUserItemOptions, FetchReadMethodName } from "./helpers"; | ||
/** | ||
@@ -22,2 +22,9 @@ * ``` | ||
/** | ||
* Get the fully qualified base URL to the REST end point for an item. | ||
* @param id Item Id | ||
* @param portalUrlOrRequestOptions a portal URL or request options | ||
* @returns URL to the item's REST end point, defaults to `https://www.arcgis.com/sharing/rest/content/items/{id}` | ||
*/ | ||
export declare const getItemBaseUrl: (id: string, portalUrlOrRequestOptions?: string | IRequestOptions) => string; | ||
/** | ||
* ``` | ||
@@ -140,1 +147,45 @@ * import { getItemData } from "@esri/arcgis-rest-portal"; | ||
export declare function getItemParts(requestOptions: IUserItemOptions): Promise<IGetItemPartsResponse>; | ||
export interface IGetItemInfoOptions extends IRequestOptions { | ||
/** | ||
* Name of the info file, optionally including the folder path | ||
*/ | ||
fileName?: string; | ||
/** | ||
* How the fetch response should be read, see: | ||
* https://developer.mozilla.org/en-US/docs/Web/API/Body#Methods | ||
*/ | ||
readAs?: FetchReadMethodName; | ||
} | ||
/** | ||
* ``` | ||
* import { getItemInfo } from "@esri/arcgis-rest-portal"; | ||
* // get the "Info Card" for the item | ||
* getItemInfo("ae7") | ||
* .then(itemInfoXml) // XML document as a string | ||
* // or get the contents of a specific file | ||
* getItemInfo("ae7", { fileName: "form.json", readAs: "json", authentication }) | ||
* .then(formJson) // JSON document as JSON | ||
* ``` | ||
* Get an info file for an item. See the [REST Documentation](https://developers.arcgis.com/rest/users-groups-and-items/item-info-file.htm) for more information. | ||
* @param id - Item Id | ||
* @param requestOptions - Options for the request, including the file name which defaults to `iteminfo.xml`. | ||
* If the file is not a text file (XML, HTML, etc) you will need to specify the `readAs` parameter | ||
* @returns A Promise that will resolve with the contents of the info file for the item. | ||
*/ | ||
export declare function getItemInfo(id: string, requestOptions?: IGetItemInfoOptions): Promise<any>; | ||
/** | ||
* ``` | ||
* import { getItemMetadata } from "@esri/arcgis-rest-portal"; | ||
* // get the metadata for the item | ||
* getItemMetadata("ae7") | ||
* .then(itemMetadataXml) // XML document as a string | ||
* // or with additional request options | ||
* getItemMetadata("ae7", { authentication }) | ||
* .then(itemMetadataXml) // XML document as a string | ||
* ``` | ||
* Get the standard formal metadata XML file for an item (`/info/metadata/metadata.xml`) | ||
* @param id - Item Id | ||
* @param requestOptions - Options for the request | ||
* @returns A Promise that will resolve with the contents of the metadata file for the item as a string. | ||
*/ | ||
export declare function getItemMetadata(id: string, requestOptions?: IRequestOptions): Promise<any>; |
@@ -24,3 +24,3 @@ /* Copyright (c) 2018 Environmental Systems Research Institute, Inc. | ||
export function getItem(id, requestOptions) { | ||
var url = getPortalUrl(requestOptions) + "/content/items/" + id; | ||
var url = getItemBaseUrl(id, requestOptions); | ||
// default to a GET request | ||
@@ -31,2 +31,14 @@ var options = __assign({ httpMethod: "GET" }, requestOptions); | ||
/** | ||
* Get the fully qualified base URL to the REST end point for an item. | ||
* @param id Item Id | ||
* @param portalUrlOrRequestOptions a portal URL or request options | ||
* @returns URL to the item's REST end point, defaults to `https://www.arcgis.com/sharing/rest/content/items/{id}` | ||
*/ | ||
export var getItemBaseUrl = function (id, portalUrlOrRequestOptions) { | ||
var portalUrl = typeof portalUrlOrRequestOptions === "string" | ||
? portalUrlOrRequestOptions | ||
: getPortalUrl(portalUrlOrRequestOptions); | ||
return portalUrl + "/content/items/" + id; | ||
}; | ||
/** | ||
* ``` | ||
@@ -47,3 +59,3 @@ * import { getItemData } from "@esri/arcgis-rest-portal"; | ||
export function getItemData(id, requestOptions) { | ||
var url = getPortalUrl(requestOptions) + "/content/items/" + id + "/data"; | ||
var url = getItemBaseUrl(id, requestOptions) + "/data"; | ||
// default to a GET request | ||
@@ -82,3 +94,3 @@ var options = __assign({ httpMethod: "GET", params: {} }, requestOptions); | ||
export function getRelatedItems(requestOptions) { | ||
var url = getPortalUrl(requestOptions) + "/content/items/" + requestOptions.id + "/relatedItems"; | ||
var url = getItemBaseUrl(requestOptions.id, requestOptions) + "/relatedItems"; | ||
var options = __assign({ httpMethod: "GET", params: { | ||
@@ -104,3 +116,3 @@ direction: requestOptions.direction | ||
export function getItemResources(id, requestOptions) { | ||
var url = getPortalUrl(requestOptions) + "/content/items/" + id + "/resources"; | ||
var url = getItemBaseUrl(id, requestOptions) + "/resources"; | ||
// Mix in num:1000 with any user supplied params | ||
@@ -128,3 +140,3 @@ // Key thing - we don't want to mutate the passed in requestOptions | ||
export function getItemGroups(id, requestOptions) { | ||
var url = getPortalUrl(requestOptions) + "/content/items/" + id + "/groups"; | ||
var url = getItemBaseUrl(id, requestOptions) + "/groups"; | ||
return request(url, requestOptions); | ||
@@ -177,2 +189,61 @@ } | ||
} | ||
/** | ||
* ``` | ||
* import { getItemInfo } from "@esri/arcgis-rest-portal"; | ||
* // get the "Info Card" for the item | ||
* getItemInfo("ae7") | ||
* .then(itemInfoXml) // XML document as a string | ||
* // or get the contents of a specific file | ||
* getItemInfo("ae7", { fileName: "form.json", readAs: "json", authentication }) | ||
* .then(formJson) // JSON document as JSON | ||
* ``` | ||
* Get an info file for an item. See the [REST Documentation](https://developers.arcgis.com/rest/users-groups-and-items/item-info-file.htm) for more information. | ||
* @param id - Item Id | ||
* @param requestOptions - Options for the request, including the file name which defaults to `iteminfo.xml`. | ||
* If the file is not a text file (XML, HTML, etc) you will need to specify the `readAs` parameter | ||
* @returns A Promise that will resolve with the contents of the info file for the item. | ||
*/ | ||
export function getItemInfo(id, requestOptions) { | ||
var _a = requestOptions || {}, _b = _a.fileName, fileName = _b === void 0 ? "iteminfo.xml" : _b, _c = _a.readAs, readAs = _c === void 0 ? "text" : _c; | ||
var options = __assign({ httpMethod: "GET" }, requestOptions); | ||
return getItemFile(id, "/info/" + fileName, readAs, options); | ||
} | ||
/** | ||
* ``` | ||
* import { getItemMetadata } from "@esri/arcgis-rest-portal"; | ||
* // get the metadata for the item | ||
* getItemMetadata("ae7") | ||
* .then(itemMetadataXml) // XML document as a string | ||
* // or with additional request options | ||
* getItemMetadata("ae7", { authentication }) | ||
* .then(itemMetadataXml) // XML document as a string | ||
* ``` | ||
* Get the standard formal metadata XML file for an item (`/info/metadata/metadata.xml`) | ||
* @param id - Item Id | ||
* @param requestOptions - Options for the request | ||
* @returns A Promise that will resolve with the contents of the metadata file for the item as a string. | ||
*/ | ||
export function getItemMetadata(id, requestOptions) { | ||
var options = __assign(__assign({}, requestOptions), { fileName: "metadata/metadata.xml" }); | ||
return getItemInfo(id, options); | ||
} | ||
// overrides request()'s default behavior for reading the response | ||
// which is based on `params.f` and defaults to JSON | ||
function getItemFile(id, | ||
// NOTE: fileName should include any folder/subfolders | ||
fileName, readMethod, requestOptions) { | ||
var url = "" + getItemBaseUrl(id, requestOptions) + fileName; | ||
// preserve escape hatch to let the consumer read the response | ||
// and ensure the f param is not appended to the query string | ||
var options = __assign({ params: {} }, requestOptions); | ||
var justReturnResponse = options.rawResponse; | ||
options.rawResponse = true; | ||
options.params.f = null; | ||
return request(url, options).then(function (response) { | ||
if (justReturnResponse) { | ||
return response; | ||
} | ||
return response[readMethod](); | ||
}); | ||
} | ||
//# sourceMappingURL=get.js.map |
@@ -28,2 +28,7 @@ import { IRequestOptions } from "@esri/arcgis-rest-request"; | ||
export declare type ItemRelationshipType = "Map2Service" | "WMA2Code" | "Map2FeatureCollection" | "MobileApp2Code" | "Service2Data" | "Service2Service" | "Map2AppConfig" | "Item2Attachment" | "Item2Report" | "Listed2Provisioned" | "Style2Style" | "Service2Style" | "Survey2Service" | "Survey2Data" | "Service2Route" | "Area2Package" | "Map2Area" | "Service2Layer" | "Area2CustomPackage" | "TrackView2Map" | "SurveyAddIn2Data"; | ||
/** | ||
* Names of methods for reading the body of a fetch response, see: | ||
* https://developer.mozilla.org/en-US/docs/Web/API/Body#Methods | ||
*/ | ||
export declare type FetchReadMethodName = "arrayBuffer" | "blob" | "formData" | "json" | "text"; | ||
export interface IItemRelationshipOptions extends IRequestOptions { | ||
@@ -30,0 +35,0 @@ /** |
@@ -34,3 +34,4 @@ /* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc. | ||
} | ||
else if (requestOptions.authentication && requestOptions.authentication.getUsername) { | ||
else if (requestOptions.authentication && | ||
requestOptions.authentication.getUsername) { | ||
return requestOptions.authentication.getUsername(); | ||
@@ -37,0 +38,0 @@ } |
@@ -23,4 +23,4 @@ import { IParamBuilder } from "@esri/arcgis-rest-request"; | ||
* | ||
* searchItems(query).then((results) => { | ||
* console.log(request); | ||
* searchItems(query).then((res) => { | ||
* console.log(res.results); | ||
* }); | ||
@@ -27,0 +27,0 @@ * ``` |
@@ -23,4 +23,4 @@ import { warn } from "@esri/arcgis-rest-request"; | ||
* | ||
* searchItems(query).then((results) => { | ||
* console.log(request); | ||
* searchItems(query).then((res) => { | ||
* console.log(res.results); | ||
* }); | ||
@@ -27,0 +27,0 @@ * ``` |
@@ -5,3 +5,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getItemParts = exports.getItemStatus = exports.getItemGroups = exports.getItemResources = exports.getRelatedItems = exports.getItemData = exports.getItem = void 0; | ||
exports.getItemMetadata = exports.getItemInfo = exports.getItemParts = exports.getItemStatus = exports.getItemGroups = exports.getItemResources = exports.getRelatedItems = exports.getItemData = exports.getItemBaseUrl = exports.getItem = void 0; | ||
var tslib_1 = require("tslib"); | ||
@@ -28,3 +28,3 @@ var arcgis_rest_request_1 = require("@esri/arcgis-rest-request"); | ||
function getItem(id, requestOptions) { | ||
var url = get_portal_url_1.getPortalUrl(requestOptions) + "/content/items/" + id; | ||
var url = exports.getItemBaseUrl(id, requestOptions); | ||
// default to a GET request | ||
@@ -36,2 +36,14 @@ var options = tslib_1.__assign({ httpMethod: "GET" }, requestOptions); | ||
/** | ||
* Get the fully qualified base URL to the REST end point for an item. | ||
* @param id Item Id | ||
* @param portalUrlOrRequestOptions a portal URL or request options | ||
* @returns URL to the item's REST end point, defaults to `https://www.arcgis.com/sharing/rest/content/items/{id}` | ||
*/ | ||
exports.getItemBaseUrl = function (id, portalUrlOrRequestOptions) { | ||
var portalUrl = typeof portalUrlOrRequestOptions === "string" | ||
? portalUrlOrRequestOptions | ||
: get_portal_url_1.getPortalUrl(portalUrlOrRequestOptions); | ||
return portalUrl + "/content/items/" + id; | ||
}; | ||
/** | ||
* ``` | ||
@@ -52,3 +64,3 @@ * import { getItemData } from "@esri/arcgis-rest-portal"; | ||
function getItemData(id, requestOptions) { | ||
var url = get_portal_url_1.getPortalUrl(requestOptions) + "/content/items/" + id + "/data"; | ||
var url = exports.getItemBaseUrl(id, requestOptions) + "/data"; | ||
// default to a GET request | ||
@@ -88,3 +100,3 @@ var options = tslib_1.__assign({ httpMethod: "GET", params: {} }, requestOptions); | ||
function getRelatedItems(requestOptions) { | ||
var url = get_portal_url_1.getPortalUrl(requestOptions) + "/content/items/" + requestOptions.id + "/relatedItems"; | ||
var url = exports.getItemBaseUrl(requestOptions.id, requestOptions) + "/relatedItems"; | ||
var options = tslib_1.__assign({ httpMethod: "GET", params: { | ||
@@ -111,3 +123,3 @@ direction: requestOptions.direction | ||
function getItemResources(id, requestOptions) { | ||
var url = get_portal_url_1.getPortalUrl(requestOptions) + "/content/items/" + id + "/resources"; | ||
var url = exports.getItemBaseUrl(id, requestOptions) + "/resources"; | ||
// Mix in num:1000 with any user supplied params | ||
@@ -136,3 +148,3 @@ // Key thing - we don't want to mutate the passed in requestOptions | ||
function getItemGroups(id, requestOptions) { | ||
var url = get_portal_url_1.getPortalUrl(requestOptions) + "/content/items/" + id + "/groups"; | ||
var url = exports.getItemBaseUrl(id, requestOptions) + "/groups"; | ||
return arcgis_rest_request_1.request(url, requestOptions); | ||
@@ -188,2 +200,63 @@ } | ||
exports.getItemParts = getItemParts; | ||
/** | ||
* ``` | ||
* import { getItemInfo } from "@esri/arcgis-rest-portal"; | ||
* // get the "Info Card" for the item | ||
* getItemInfo("ae7") | ||
* .then(itemInfoXml) // XML document as a string | ||
* // or get the contents of a specific file | ||
* getItemInfo("ae7", { fileName: "form.json", readAs: "json", authentication }) | ||
* .then(formJson) // JSON document as JSON | ||
* ``` | ||
* Get an info file for an item. See the [REST Documentation](https://developers.arcgis.com/rest/users-groups-and-items/item-info-file.htm) for more information. | ||
* @param id - Item Id | ||
* @param requestOptions - Options for the request, including the file name which defaults to `iteminfo.xml`. | ||
* If the file is not a text file (XML, HTML, etc) you will need to specify the `readAs` parameter | ||
* @returns A Promise that will resolve with the contents of the info file for the item. | ||
*/ | ||
function getItemInfo(id, requestOptions) { | ||
var _a = requestOptions || {}, _b = _a.fileName, fileName = _b === void 0 ? "iteminfo.xml" : _b, _c = _a.readAs, readAs = _c === void 0 ? "text" : _c; | ||
var options = tslib_1.__assign({ httpMethod: "GET" }, requestOptions); | ||
return getItemFile(id, "/info/" + fileName, readAs, options); | ||
} | ||
exports.getItemInfo = getItemInfo; | ||
/** | ||
* ``` | ||
* import { getItemMetadata } from "@esri/arcgis-rest-portal"; | ||
* // get the metadata for the item | ||
* getItemMetadata("ae7") | ||
* .then(itemMetadataXml) // XML document as a string | ||
* // or with additional request options | ||
* getItemMetadata("ae7", { authentication }) | ||
* .then(itemMetadataXml) // XML document as a string | ||
* ``` | ||
* Get the standard formal metadata XML file for an item (`/info/metadata/metadata.xml`) | ||
* @param id - Item Id | ||
* @param requestOptions - Options for the request | ||
* @returns A Promise that will resolve with the contents of the metadata file for the item as a string. | ||
*/ | ||
function getItemMetadata(id, requestOptions) { | ||
var options = tslib_1.__assign(tslib_1.__assign({}, requestOptions), { fileName: "metadata/metadata.xml" }); | ||
return getItemInfo(id, options); | ||
} | ||
exports.getItemMetadata = getItemMetadata; | ||
// overrides request()'s default behavior for reading the response | ||
// which is based on `params.f` and defaults to JSON | ||
function getItemFile(id, | ||
// NOTE: fileName should include any folder/subfolders | ||
fileName, readMethod, requestOptions) { | ||
var url = "" + exports.getItemBaseUrl(id, requestOptions) + fileName; | ||
// preserve escape hatch to let the consumer read the response | ||
// and ensure the f param is not appended to the query string | ||
var options = tslib_1.__assign({ params: {} }, requestOptions); | ||
var justReturnResponse = options.rawResponse; | ||
options.rawResponse = true; | ||
options.params.f = null; | ||
return arcgis_rest_request_1.request(url, options).then(function (response) { | ||
if (justReturnResponse) { | ||
return response; | ||
} | ||
return response[readMethod](); | ||
}); | ||
} | ||
//# sourceMappingURL=get.js.map |
@@ -38,3 +38,4 @@ "use strict"; | ||
} | ||
else if (requestOptions.authentication && requestOptions.authentication.getUsername) { | ||
else if (requestOptions.authentication && | ||
requestOptions.authentication.getUsername) { | ||
return requestOptions.authentication.getUsername(); | ||
@@ -41,0 +42,0 @@ } |
@@ -26,4 +26,4 @@ "use strict"; | ||
* | ||
* searchItems(query).then((results) => { | ||
* console.log(request); | ||
* searchItems(query).then((res) => { | ||
* console.log(res.results); | ||
* }); | ||
@@ -30,0 +30,0 @@ * ``` |
/* @preserve | ||
* @esri/arcgis-rest-portal - v2.17.0 - Apache-2.0 | ||
* @esri/arcgis-rest-portal - v2.18.0 - Apache-2.0 | ||
* Copyright (c) 2017-2020 Esri, Inc. | ||
* Thu Sep 03 2020 14:14:49 GMT-0400 (Eastern Daylight Time) | ||
* Fri Sep 11 2020 12:22:01 GMT-0700 (Pacific Daylight Time) | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@esri/arcgis-rest-request")):"function"==typeof define&&define.amd?define(["exports","@esri/arcgis-rest-request"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).arcgisRest=e.arcgisRest||{},e.arcgisRest)}(this,function(e,s){"use strict";var c=function(){return(c=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function m(e){return void 0===e&&(e={}),e.portal?s.cleanUrl(e.portal):e.authentication?e.authentication.portal:"https://www.arcgis.com/sharing/rest"}function i(e){var t=JSON.parse(JSON.stringify(e));return t.data&&("undefined"!=typeof Blob&&e.data instanceof Blob||"ReadStream"===e.data.constructor.name?t.file=e.data:t.text=e.data,delete t.data),t}function p(e){return e.owner?Promise.resolve(e.owner):e.item&&e.item.owner?Promise.resolve(e.item.owner):e.authentication&&e.authentication.getUsername?e.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 p(r).then(function(e){var t=r.folderId?m(r)+"/content/users/"+e+"/"+r.folderId+"/items/"+r.item.id+"/update":m(r)+"/content/users/"+e+"/items/"+r.item.id+"/update";return r.params=c(c({},r.params),i(r.item)),s.request(t,r)})}function t(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.")):p(o).then(function(e){var t=m(o)+"/content/users/"+e,r=t+"/addItem";o.folderId&&(r=t+"/"+o.folderId+"/addItem"),o.params=c(c({},o.params),i(o.item));var n=s.appendCustomParams(o,["owner","folderId","file","dataUrl","text","async","multipart","filename","overwrite"],{params:c({},o.params)});return s.request(r,n)})}function n(e,t){var r=m(t)+"/community/groups/"+e,n=c({httpMethod:"GET"},t);return s.request(r,n)}function o(e){var t=e.authentication.username,r=e.owner||t;return m(e)+"/content/users/"+encodeURIComponent(r)+"/items/"+e.id+"/share"}function u(e){var t=e.authentication.username;return(e.owner||t)===t}function a(e){return e.authentication.getUser(e).then(function(e){return e&&"org_admin"===e.role&&!e.roleId})}function d(e){return n(e.groupId,e).then(function(e){return e.userMembership.memberType}).catch(function(){return"none"})}var h=(f.prototype.match=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.termStack=this.termStack.concat(e),this},f.prototype.in=function(e){var t="`in("+(e?'"'+e+'"':"")+")`";return this.hasRange||this.hasTerms?(e&&"*"!==e&&(this.q+=e+":"),this.commit()):(s.warn(t+" 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?s.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(e){return this.hasTerms?s.warn("`from(...)` is not allowed after `match(...)` try using `.from(...).to(...).in(...)`. Your query was not modified."):this.rangeStack[0]=e,this},f.prototype.to=function(e){return this.hasTerms?s.warn("`to(...)` is not allowed after `match(...)` try using `.from(...).to(...).in(...)`. Your query was not modified."):this.rangeStack[1]=e,this},f.prototype.boost=function(e){return this.commit(),this.q+="^"+e,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(e){return this.currentModifer?(s.warn("You have called `"+this.currentModifer+"()` after `"+e+"()`. Your current query was not modified."),this):(this.commit(),""===this.q&&"not"!==e?s.warn("You have called `"+e+"()` without calling another method to modify your query first. Try calling `match()` first."):(this.currentModifer=e,this.q+=""===this.q?"":" ",this.q+=e.toUpperCase()+" "),this)},f.prototype.hasWhiteSpace=function(e){return/\s/g.test(e)},f.prototype.formatTerm=function(e){return e instanceof Date?e.getTime():"string"==typeof e&&this.hasWhiteSpace(e)?'"'+e+'"':e},f.prototype.commit=function(){var t=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(e){return t.formatTerm(e)}).join(" "),this.termStack=[]),this},Object.defineProperty(f.prototype,"hasTerms",{get:function(){return 0<this.termStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"hasRange",{get:function(){return this.rangeStack.length&&this.rangeStack[0]&&this.rangeStack[1]},enumerable:!1,configurable:!0}),f.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 e=this.q;this.q=e.replace(/( AND ?| NOT ?| OR ?)*$/,""),e!==this.q&&s.warn("`startGroup(...)` was called without calling `endGroup(...)` first. Your query was not modified."),this.q=this.q.replace(/(\(\))*/,"")},f);function f(e){void 0===e&&(e=""),this.termStack=[],this.rangeStack=[],this.openGroups=0,this.q=e}function l(r,n){var e,t,o="string"==typeof r||r instanceof h?{httpMethod:"GET",params:{q:r}}:s.appendCustomParams(r,["q","num","start","sortField","sortOrder"],{httpMethod:"GET"});switch(n){case"item":t="/search";break;case"group":t="/community/groups";break;case"groupContent":if("string"==typeof r||r instanceof h||!r.groupId)return Promise.reject(new Error("you must pass a `groupId` option to `searchGroupContent`"));t="/content/groups/"+r.groupId+"/search";break;default:t="/portals/self/users/search"}return e=m(o)+t,s.request(e,o).then(function(t){return t.nextStart&&-1!==t.nextStart&&(t.nextPage=function(){var e;return"string"==typeof r||r instanceof h?e={q:r,start:t.nextStart}:(e=r).start=t.nextStart,l(e,n)}),t})}function g(e){return l(e,"item")}function v(e,t){if(0===e.length)return[];for(var r=[],n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r}function y(e){var t=e.id,n=m(e)+"/community/groups/"+t+"/addUsers",r=Object.assign({},e,{admins:void 0,users:void 0}),o=function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var n=Array(e),o=0,t=0;t<r;t++)for(var i=arguments[t],u=0,a=i.length;u<a;u++,o++)n[o]=i[u];return n}(I("users",e.users,r),I("admins",e.admins,r)).map(function(e){return t=n,r=e,s.request(t,r).catch(function(e){return{errors:[e]}});var t,r});return Promise.all(o).then(q)}function I(u,e,a){return!e||e.length<1?[]:v(e,25).map(function(e){return t=u,r=e,n=a,Object.assign({},n,((o={})[t]=r,o.params=c(c({},n.params),((i={})[t]=r,i)),o));var t,r,n,o,i})}function q(e){var t=e.filter(function(e){return e.notAdded}).reduce(function(e,t){return e.concat(t.notAdded)},[]),r=e.filter(function(e){return e.errors}).reduce(function(e,t){return e.concat(t.errors)},[]),n={notAdded:t};return 0<r.length&&(n.errors=r),n}function w(n){var e=n.id,t=n.users,o=m(n)+"/community/groups/"+e+"/removeUsers",r=v(t,25).map(function(e){return t=e,r=c(c({},n),{users:t,params:{users:t}}),s.request(o,r).catch(function(e){return{errors:[e]}});var t,r});return Promise.all(r).then(function(e){function t(r){return e.filter(function(e){return e[r]}).reduce(function(e,t){return e.concat(t[r])},[])}var r=t("errors"),n={notRemoved:t("notRemoved")};return r.length?c(c({},n),{errors:r}):n})}function b(e){var t=e.every(function(e){return e.success}),r=e.reduce(function(e,t){return e.concat(t.errors||[])},[]),n={success:t};return 0<r.length&&(n.errors=r),n}function T(e){var t=m(e)+"/community/groups/"+e.id+"/updateUsers",r={authentication:e.authentication,params:{}};return"admin"===e.newMemberType?r.params.admins=e.users:r.params.users=e.users,s.request(t,r)}function G(e){var t=e.every(function(e){return e.success}),r=e.reduce(function(e,t){return e.concat(t.errors||[])},[]),n={success:t};return 0<r.length&&(n.errors=r),n}function U(e){var t,r,n={httpMethod:"GET"};return"string"==typeof e?r="https://www.arcgis.com/sharing/rest/community/users/"+e:(t=e.username||e.authentication.username,r=m(e)+"/community/users/"+encodeURIComponent(t),n=c(c({},e),n)),s.request(r,n)}function P(e,t){return t.params=c({org:!1,everyone:!1},t.params),"private"===t.access&&(t.params.groups=" "),"org"===t.access&&(t.params.org=!0),"public"===t.access&&(t.params.account=!0,t.params.everyone=!0),s.request(e,t)}function C(t){return g({q:"id: "+t.id+" AND group: "+t.groupId,start:1,num:10,sortField:"title",authentication:t.authentication,httpMethod:"POST"}).then(function(e){if(0<e.total)return e.results.some(function(e){return e.id===t.id})})}function S(e){var t=e.authentication.username,r=e.owner||t,n=m(e)+"/content/items/"+e.id+"/share";return r===t&&(n=m(e)+"/content/users/"+r+"/items/"+e.id+"/share"),e.params={groups:e.groupId,confirmItemControl:e.confirmItemControl},s.request(n,e)}function E(e,t,r,n,o){var i,u,a,s,c=t.groups||[],m=c.find(function(e){return e.id===o.groupId});if(e.orgId!==t.orgId)throw Error("User "+t.username+" is not a member of the same org as "+e.username+". Consequently they can not be added added to group "+o.groupId+" nor can item "+o.id+" be shared to the group.");if(!m&&511<c.length)throw Error("User "+t.username+" 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 s=m?r&&"member"===m.userMembership.memberType?(a=T({id:o.groupId,users:[t.username],newMemberType:"admin",authentication:o.authentication}).then(function(e){var t=e.results.reduce(function(e,t){return t.success||e.push(t.username),e},[]);return Promise.resolve({notAdded:t})}).catch(function(){return{notAdded:[t.username]}}),function(e){return T({id:o.groupId,users:[t.username],newMemberType:"member",authentication:o.authentication}).then(function(){return e}).catch(function(){return e})}):(a=Promise.resolve({notAdded:[]}),function(e){return Promise.resolve(e)}):(u=r?"admins":"users",a=y(((i={id:o.groupId})[u]=[t.username],i.authentication=o.authentication,i)).then(function(e){if(e.errors&&e.errors.length)throw e.errors[0];return e}).catch(function(){return{notAdded:[t.username]}}),function(e){return w({id:o.groupId,users:[t.username],authentication:o.authentication}).then(function(){return e})}),{promise:a.then(function(e){if(e.notAdded.length)throw new Error(n);return e}),revert:s}}function M(e,t){var r=e||"self",n=m(t)+"/portals/"+r,o=c({httpMethod:"GET"},t);return s.request(n,o)}e.SearchQueryBuilder=h,e.acceptInvitation=function(e){var t=encodeURIComponent(e.authentication.username),r=m(e)+"/community/users/"+t+"/invitations/"+e.invitationId+"/accept",n=c({},e);return s.request(r,n)},e.addGroupUsers=y,e.addItemData=function(e){var t=c({item:{id:e.id,data:e.data}},e);return delete t.id,delete t.data,r(t)},e.addItemPart=function(n){return p(n).then(function(e){var t=m(n)+"/content/users/"+e+"/items/"+n.id+"/addPart",r=s.appendCustomParams(n,["file","partNum"],{params:c({},n.params)});return s.request(t,r)})},e.addItemRelationship=function(n){return p(n).then(function(e){var t=m(n)+"/content/users/"+e+"/addRelationship",r=s.appendCustomParams(n,["originItemId","destinationItemId","relationshipType"],{params:c({},n.params)});return s.request(t,r)})},e.addItemResource=function(r){return p(r).then(function(e){var t=m(r)+"/content/users/"+e+"/items/"+r.id+"/addResources";return r.params=c({file:r.resource,fileName:r.name,resourcesPrefix:r.prefix,text:r.content,access:r.private?"private":"inherit"},r.params),s.request(t,r)})},e.cancelItemUpload=function(r){return p(r).then(function(e){var t=m(r)+"/content/users/"+e+"/items/"+r.id+"/cancel";return s.request(t,r)})},e.commitItemUpload=function(r){return p(r).then(function(e){var t=m(r)+"/content/users/"+e+"/items/"+r.id+"/commit";return s.request(t,r)})},e.createFolder=function(r){return p(r).then(function(e){var t=m(r)+"/content/users/"+e+"/createFolder";return r.params=c({title:r.title},r.params),s.request(t,r)})},e.createGroup=function(e){var t=m(e)+"/community/createGroup";return e.params=c(c({},e.params),e.group),s.request(t,e)},e.createGroupNotification=function(e){var t=m(e)+"/community/groups/"+e.id+"/createNotification",r=c({params:c({subject:e.subject,message:e.message,users:e.users,notificationChannelType:e.notificationChannelType||"email",clientId:e.clientId,silentNotification:e.silentNotification,notifyAll:!e.users||0===e.users.length},e.params)},e);return s.request(t,r)},e.createItem=function(e){return t(c({folderId:null},e))},e.createItemInFolder=t,e.createOrgNotification=function(e){var o,n=m(e)+"/portals/self/createNotification",t=v((o=e).users,o.batchSize||25).map(function(e){return t=e,r=o,(n=Object.assign({},r)).params=c(c({},n.params),{users:t,subject:r.subject,message:r.message,notificationChannelType:n.notificationChannelType}),n;var t,r,n}).map(function(e){return t=n,r=e,s.request(t,r).catch(function(e){return{errors:[e]}});var t,r});return Promise.all(t).then(G)},e.declineInvitation=function(e){var t=encodeURIComponent(e.authentication.username),r=m(e)+"/community/users/"+t+"/invitations/"+e.invitationId+"/decline",n=c({},e);return s.request(r,n)},e.determineOwner=p,e.ensureMembership=E,e.exportItem=function(t){var r=t.authentication,n=t.id,o=t.title,i=t.exportFormat,u=t.exportParameters;return p(t).then(function(e){return m(t)+"/content/users/"+e+"/export"}).then(function(e){return s.request(e,{httpMethod:"POST",authentication:r,params:{itemId:n,title:o,exportFormat:i,exportParameters:u}})})},e.getGroup=n,e.getGroupCategorySchema=function(e,t){var r=m(t)+"/community/groups/"+e+"/categorySchema",n=c({httpMethod:"GET"},t);return s.request(r,n)},e.getGroupContent=function(e,t){var r=m(t)+"/content/groups/"+e,n=c(c({httpMethod:"GET"},{params:{start:1,num:100}}),t);return t&&t.paging&&(n.params=c({},t.paging)),s.request(r,n)},e.getGroupUsers=function(e,t){var r=m(t)+"/community/groups/"+e+"/users",n=c({httpMethod:"GET"},t);return s.request(r,n)},e.getItem=function(e,t){var r=m(t)+"/content/items/"+e,n=c({httpMethod:"GET"},t);return s.request(r,n)},e.getItemData=function(e,t){var r=m(t)+"/content/items/"+e+"/data",n=c({httpMethod:"GET",params:{}},t);return n.file&&(n.params.f=null),s.request(r,n).catch(function(e){if(!RegExp(/The string did not match the expected pattern|(Unexpected end of (JSON input|data at line 1 column 1))/i).test(e.message))throw e})},e.getItemGroups=function(e,t){var r=m(t)+"/content/items/"+e+"/groups";return s.request(r,t)},e.getItemParts=function(r){return p(r).then(function(e){var t=m(r)+"/content/users/"+e+"/items/"+r.id+"/parts";return s.request(t,r)})},e.getItemResources=function(e,t){var r=m(t)+"/content/items/"+e+"/resources",n=c({},t);return n.params=c({num:1e3},n.params),s.request(r,n)},e.getItemStatus=function(n){return p(n).then(function(e){var t=m(n)+"/content/users/"+e+"/items/"+n.id+"/status",r=s.appendCustomParams(n,["jobId","jobType"],{params:c({},n.params)});return s.request(t,r)})},e.getPortal=M,e.getPortalSettings=function(e,t){var r=e||"self",n=m(t)+"/portals/"+r+"/settings",o=c({httpMethod:"GET"},t);return s.request(n,o)},e.getPortalUrl=m,e.getRelatedItems=function(e){var t=m(e)+"/content/items/"+e.id+"/relatedItems",r=c({httpMethod:"GET",params:{direction:e.direction}},e);return"string"==typeof e.relationshipType?r.params.relationshipType=e.relationshipType:r.params.relationshipTypes=e.relationshipType,delete r.direction,delete r.relationshipType,s.request(t,r)},e.getSelf=function(e){return M(null,e)},e.getSharingUrl=o,e.getUser=U,e.getUserContent=function(t){var e=t.folderId,r=t.start,n=void 0===r?1:r,o=t.num,i=void 0===o?10:o,u=t.authentication,a=e?"/"+e:"";return p(t).then(function(e){return m(t)+"/content/users/"+e+a}).then(function(e){return s.request(e,{httpMethod:"GET",authentication:u,params:{start:n,num:i}})})},e.getUserInvitation=function(e){var t=encodeURIComponent(e.authentication.username),r=m(e)+"/community/users/"+t+"/invitations/"+e.invitationId,n={httpMethod:"GET"},n=c(c({},e),n);return s.request(r,n)},e.getUserInvitations=function(e){var t={httpMethod:"GET"},r=encodeURIComponent(e.authentication.username),n=m(e)+"/community/users/"+r+"/invitations",t=c(c({},e),t);return s.request(n,t)},e.getUserMembership=d,e.getUserNotifications=function(e){var t={httpMethod:"GET"},r=encodeURIComponent(e.authentication.username),n=m(e)+"/community/users/"+r+"/notifications",t=c(c({},e),t);return s.request(n,t)},e.getUserTags=function(e){var t=e.username||e.authentication.username,r=m(e)+"/community/users/"+encodeURIComponent(t)+"/tags";return s.request(r,e)},e.getUserUrl=function(e){return m(e)+"/community/users/"+encodeURIComponent(e.username)},e.inviteGroupUsers=function(e){var o,t=e.id,n=m(e)+"/community/groups/"+t+"/invite",r=v((o=e).users,25).map(function(e){return t=e,r=o,(n=Object.assign({},r)).params=c(c({},n.params),{users:t,role:n.role,expiration:n.expiration}),n;var t,r,n}).map(function(e){return t=n,r=e,s.request(t,r).catch(function(e){return{errors:[e]}});var t,r});return Promise.all(r).then(b)},e.isItemOwner=u,e.isItemSharedWithGroup=C,e.isOrgAdmin=a,e.joinGroup=function(e){var t=m(e)+"/community/groups/"+e.id+"/join";return s.request(t,e)},e.leaveGroup=function(e){var t=m(e)+"/community/groups/"+e.id+"/leave";return s.request(t,e)},e.moveItem=function(n){return p(n).then(function(e){var t=m(n)+"/content/users/"+e+"/items/"+n.itemId+"/move",r=(r=n.folderId)||"/";return n.params=c({folder:r},n.params),s.request(t,n)})},e.protectGroup=function(e){var t=m(e)+"/community/groups/"+e.id+"/protect";return s.request(t,e)},e.protectItem=function(r){return p(r).then(function(e){var t=m(r)+"/content/users/"+e+"/items/"+r.id+"/protect";return s.request(t,r)})},e.reassignItem=function(n){return a(n).then(function(e){if(!e)throw Error("Item "+n.id+" can not be reassigned because current user is not an organization administrator.");var t=m(n)+"/content/users/"+n.currentOwner+"/items/"+n.id+"/reassign",r={params:{targetUsername:n.targetUsername,targetFolderName:n.targetFolderName},authentication:n.authentication};return s.request(t,r)})},e.removeFolder=function(r){return p(r).then(function(e){var t=m(r)+"/content/users/"+encodeURIComponent(e)+"/"+r.folderId+"/delete";return s.request(t,r)})},e.removeGroup=function(e){var t=m(e)+"/community/groups/"+e.id+"/delete",r=c({},e);return s.request(t,r)},e.removeGroupUsers=w,e.removeItem=function(r){return p(r).then(function(e){var t=m(r)+"/content/users/"+e+"/items/"+r.id+"/delete";return s.request(t,r)})},e.removeItemRelationship=function(n){return p(n).then(function(e){var t=m(n)+"/content/users/"+e+"/deleteRelationship",r=s.appendCustomParams(n,["originItemId","destinationItemId","relationshipType"],{params:c({},n.params)});return s.request(t,r)})},e.removeItemResource=function(r){return p(r).then(function(e){var t=m(r)+"/content/users/"+e+"/items/"+r.id+"/removeResources";return r.params=c(c({},r.params),{resource:r.resource}),s.request(t,r)})},e.removeNotification=function(e){var t=encodeURIComponent(e.authentication.username),r=m(e)+"/community/users/"+t+"/notifications/"+e.id+"/delete";return s.request(r,e)},e.searchGroupContent=function(e){return l(e,"groupContent")},e.searchGroupUsers=function(e,t){var r=m(t)+"/community/groups/"+e+"/userlist",n=s.appendCustomParams(t||{},["name","num","start","sortField","sortOrder","joined","memberType"],{httpMethod:"GET"});return s.request(r,n)},e.searchGroups=function(e){return l(e,"group")},e.searchItems=g,e.searchUsers=function(e){return l(e,"user")},e.serializeItem=i,e.setItemAccess=function(t){var r=o(t);return u(t)?P(r,t):a(t).then(function(e){if(e)return P(r,t);throw Error("This item can not be shared by "+t.authentication.username+". They are neither the item owner nor an organization admin.")})},e.shareItemWithGroup=function(i){return C(i).then(function(e){if(e)return{itemId:i.id,shortcut:!0,notSharedWith:[]};var t=i.authentication.username,r=i.owner,o=i.confirmItemControl,n=r||t;return n!==t?Promise.all([U({username:t,authentication:i.authentication}),U({username:n,authentication:i.authentication}),d(i)]).then(function(e){var t=e[0],r=e[1],n=e[2];return function(e,t,r,n,o,i){var u=[];if(t){if(!n)throw Error("This item can not be shared to shared editing group "+i.groupId+" by "+e.username+" as they not the item owner or org admin.");u.push(E(e,e,!1,"Error adding "+e.username+" as member to edit group "+i.groupId+". Consequently item "+i.id+" was not shared to the group.",i),E(e,o,!0,"none"===r?"Error adding user "+o.username+" to edit group "+i.groupId+". Consequently item "+i.id+" was not shared to the group.":"Error promoting user "+o.username+" to admin in edit group "+i.groupId+". Consequently item "+i.id+" was not shared to the group.",i))}else if(n)u.push(E(e,e,!1,"Error adding "+e.username+" as member to view group "+i.groupId+". Consequently item "+i.id+" was not shared to the group.",i));else if("none"===r)throw new Error("This item can not be shared by "+e.username+" as they are not a member of the specified group "+i.groupId+".");return u}(t,!!o,n,"org_admin"===t.role&&!t.roleId,r,i)}).then(function(e){var t=e[0],r=(void 0===t?{promise:Promise.resolve({notAdded:[]}),revert:function(e){return Promise.resolve(e)}}:t).revert;return Promise.all(e.map(function(e){return e.promise})).then(function(){return S(i)}).then(function(e){return r(e)})}):S(i)}).then(function(e){if(e.notSharedWith.length)throw Error("Item "+i.id+" could not be shared to group "+i.groupId+".");return e})},e.unprotectGroup=function(e){var t=m(e)+"/community/groups/"+e.id+"/unprotect";return s.request(t,e)},e.unprotectItem=function(r){return p(r).then(function(e){var t=m(r)+"/content/users/"+e+"/items/"+r.id+"/unprotect";return s.request(t,r)})},e.unshareItemWithGroup=function(a){return C(a).then(function(e){if(!e)return Promise.resolve({itemId:a.id,shortcut:!0,notUnsharedFrom:[]});var i=a.authentication.username,u=a.owner;return Promise.all([d(a),U({username:i,authentication:a.authentication})]).then(function(e){var t=e[0],r=e[1],n=(u||i)===i,o="org_admin"===r.role&&!r.roleId;if(!n&&!o&&["admin","owner"].indexOf(t)<0)throw Error("This item can not be unshared from group "+a.groupId+" by "+i+" as they not the item owner, an org admin, group admin or group owner.");return function(e){var t=e.authentication.username,r=e.owner||t,n=m(e)+"/content/items/"+e.id+"/unshare";r===t&&(n=m(e)+"/content/users/"+r+"/items/"+e.id+"/unshare");return e.params={groups:e.groupId},s.request(n,e)}(a)}).then(function(e){if(e.notUnsharedFrom.length)throw Error("Item "+a.id+" could not be unshared to group "+a.groupId);return e})})},e.updateGroup=function(e){var t=m(e)+"/community/groups/"+e.group.id+"/update";return e.params=c(c({},e.params),e.group),s.request(t,e)},e.updateItem=r,e.updateItemInfo=function(r){return p(r).then(function(e){var t=m(r)+"/content/users/"+e+"/items/"+r.id+"/updateinfo";return r.params=c({folderName:r.folderName,file:r.file},r.params),s.request(t,r)})},e.updateItemResource=function(r){return p(r).then(function(e){var t=m(r)+"/content/users/"+e+"/items/"+r.id+"/updateResources";return r.params=c({file:r.resource,fileName:r.name,text:r.content},r.params),void 0!==r.private&&(r.params.access=r.private?"private":"inherit"),s.request(t,r)})},e.updateUser=function(e){var t=e.user.username||e.authentication.username,r=m(e)+"/community/users/"+encodeURIComponent(t)+"/update";return e.params=c(c({},e.user),e.params),delete e.user,s.request(r,e)},e.updateUserMemberships=T,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@esri/arcgis-rest-request")):"function"==typeof define&&define.amd?define(["exports","@esri/arcgis-rest-request"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).arcgisRest=e.arcgisRest||{},e.arcgisRest)}(this,function(e,f){"use strict";var l=function(){return(l=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function s(e){return void 0===e&&(e={}),e.portal?f.cleanUrl(e.portal):e.authentication?e.authentication.portal:"https://www.arcgis.com/sharing/rest"}function i(e){var t=JSON.parse(JSON.stringify(e));return t.data&&("undefined"!=typeof Blob&&e.data instanceof Blob||"ReadStream"===e.data.constructor.name?t.file=e.data:t.text=e.data,delete t.data),t}function c(e){return e.owner?Promise.resolve(e.owner):e.item&&e.item.owner?Promise.resolve(e.item.owner):e.authentication&&e.authentication.getUsername?e.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 c(r).then(function(e){var t=r.folderId?s(r)+"/content/users/"+e+"/"+r.folderId+"/items/"+r.item.id+"/update":s(r)+"/content/users/"+e+"/items/"+r.item.id+"/update";return r.params=l(l({},r.params),i(r.item)),f.request(t,r)})}function t(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.")):c(o).then(function(e){var t=s(o)+"/content/users/"+e,r=t+"/addItem";o.folderId&&(r=t+"/"+o.folderId+"/addItem"),o.params=l(l({},o.params),i(o.item));var n=f.appendCustomParams(o,["owner","folderId","file","dataUrl","text","async","multipart","filename","overwrite"],{params:l({},o.params)});return f.request(r,n)})}var g=function(e,t){return("string"==typeof t?t:s(t))+"/content/items/"+e};function n(e,t){var r,n,o,i,u,a,s=t||{},c=s.fileName,m=void 0===c?"iteminfo.xml":c,p=s.readAs,d=void 0===p?"text":p,h=l({httpMethod:"GET"},t);return r="/info/"+m,n=d,i=""+g(e,o=h)+r,u=l({params:{}},o),a=u.rawResponse,u.rawResponse=!0,u.params.f=null,f.request(i,u).then(function(e){return a?e:e[n]()})}function o(e,t){var r=s(t)+"/community/groups/"+e,n=l({httpMethod:"GET"},t);return f.request(r,n)}function u(e){var t=e.authentication.username,r=e.owner||t;return s(e)+"/content/users/"+encodeURIComponent(r)+"/items/"+e.id+"/share"}function a(e){var t=e.authentication.username;return(e.owner||t)===t}function m(e){return e.authentication.getUser(e).then(function(e){return e&&"org_admin"===e.role&&!e.roleId})}function p(e){return o(e.groupId,e).then(function(e){return e.userMembership.memberType}).catch(function(){return"none"})}var d=(h.prototype.match=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.termStack=this.termStack.concat(e),this},h.prototype.in=function(e){var t="`in("+(e?'"'+e+'"':"")+")`";return this.hasRange||this.hasTerms?(e&&"*"!==e&&(this.q+=e+":"),this.commit()):(f.warn(t+" was called with no call to `match(...)` or `from(...)`/`to(...)`. Your query was not modified."),this)},h.prototype.startGroup=function(){return this.commit(),0<this.openGroups&&(this.q+=" "),this.openGroups++,this.q+="(",this},h.prototype.endGroup=function(){return this.openGroups<=0?f.warn("`endGroup(...)` was called without calling `startGroup(...)` first. Your query was not modified."):(this.commit(),this.openGroups--,this.q+=")"),this},h.prototype.and=function(){return this.addModifier("and")},h.prototype.or=function(){return this.addModifier("or")},h.prototype.not=function(){return this.addModifier("not")},h.prototype.from=function(e){return this.hasTerms?f.warn("`from(...)` is not allowed after `match(...)` try using `.from(...).to(...).in(...)`. Your query was not modified."):this.rangeStack[0]=e,this},h.prototype.to=function(e){return this.hasTerms?f.warn("`to(...)` is not allowed after `match(...)` try using `.from(...).to(...).in(...)`. Your query was not modified."):this.rangeStack[1]=e,this},h.prototype.boost=function(e){return this.commit(),this.q+="^"+e,this},h.prototype.toParam=function(){return this.commit(),this.cleanup(),this.q},h.prototype.clone=function(){return this.commit(),this.cleanup(),new h(this.q+"")},h.prototype.addModifier=function(e){return this.currentModifer?(f.warn("You have called `"+this.currentModifer+"()` after `"+e+"()`. Your current query was not modified."),this):(this.commit(),""===this.q&&"not"!==e?f.warn("You have called `"+e+"()` without calling another method to modify your query first. Try calling `match()` first."):(this.currentModifer=e,this.q+=""===this.q?"":" ",this.q+=e.toUpperCase()+" "),this)},h.prototype.hasWhiteSpace=function(e){return/\s/g.test(e)},h.prototype.formatTerm=function(e){return e instanceof Date?e.getTime():"string"==typeof e&&this.hasWhiteSpace(e)?'"'+e+'"':e},h.prototype.commit=function(){var t=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(e){return t.formatTerm(e)}).join(" "),this.termStack=[]),this},Object.defineProperty(h.prototype,"hasTerms",{get:function(){return 0<this.termStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"hasRange",{get:function(){return this.rangeStack.length&&this.rangeStack[0]&&this.rangeStack[1]},enumerable:!1,configurable:!0}),h.prototype.cleanup=function(){if(0<this.openGroups)for(f.warn("Automatically closing "+this.openGroups+" group(s). You can use `endGroup(...)` to remove this warning.");0<this.openGroups;)this.q+=")",this.openGroups--;var e=this.q;this.q=e.replace(/( AND ?| NOT ?| OR ?)*$/,""),e!==this.q&&f.warn("`startGroup(...)` was called without calling `endGroup(...)` first. Your query was not modified."),this.q=this.q.replace(/(\(\))*/,"")},h);function h(e){void 0===e&&(e=""),this.termStack=[],this.rangeStack=[],this.openGroups=0,this.q=e}function v(r,n){var e,t,o="string"==typeof r||r instanceof d?{httpMethod:"GET",params:{q:r}}:f.appendCustomParams(r,["q","num","start","sortField","sortOrder"],{httpMethod:"GET"});switch(n){case"item":t="/search";break;case"group":t="/community/groups";break;case"groupContent":if("string"==typeof r||r instanceof d||!r.groupId)return Promise.reject(new Error("you must pass a `groupId` option to `searchGroupContent`"));t="/content/groups/"+r.groupId+"/search";break;default:t="/portals/self/users/search"}return e=s(o)+t,f.request(e,o).then(function(t){return t.nextStart&&-1!==t.nextStart&&(t.nextPage=function(){var e;return"string"==typeof r||r instanceof d?e={q:r,start:t.nextStart}:(e=r).start=t.nextStart,v(e,n)}),t})}function y(e){return v(e,"item")}function I(e,t){if(0===e.length)return[];for(var r=[],n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r}function q(e){var t=e.id,n=s(e)+"/community/groups/"+t+"/addUsers",r=Object.assign({},e,{admins:void 0,users:void 0}),o=function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var n=Array(e),o=0,t=0;t<r;t++)for(var i=arguments[t],u=0,a=i.length;u<a;u++,o++)n[o]=i[u];return n}(w("users",e.users,r),w("admins",e.admins,r)).map(function(e){return t=n,r=e,f.request(t,r).catch(function(e){return{errors:[e]}});var t,r});return Promise.all(o).then(b)}function w(u,e,a){return!e||e.length<1?[]:I(e,25).map(function(e){return t=u,r=e,n=a,Object.assign({},n,((o={})[t]=r,o.params=l(l({},n.params),((i={})[t]=r,i)),o));var t,r,n,o,i})}function b(e){var t=e.filter(function(e){return e.notAdded}).reduce(function(e,t){return e.concat(t.notAdded)},[]),r=e.filter(function(e){return e.errors}).reduce(function(e,t){return e.concat(t.errors)},[]),n={notAdded:t};return 0<r.length&&(n.errors=r),n}function T(n){var e=n.id,t=n.users,o=s(n)+"/community/groups/"+e+"/removeUsers",r=I(t,25).map(function(e){return t=e,r=l(l({},n),{users:t,params:{users:t}}),f.request(o,r).catch(function(e){return{errors:[e]}});var t,r});return Promise.all(r).then(function(e){function t(r){return e.filter(function(e){return e[r]}).reduce(function(e,t){return e.concat(t[r])},[])}var r=t("errors"),n={notRemoved:t("notRemoved")};return r.length?l(l({},n),{errors:r}):n})}function G(e){var t=e.every(function(e){return e.success}),r=e.reduce(function(e,t){return e.concat(t.errors||[])},[]),n={success:t};return 0<r.length&&(n.errors=r),n}function U(e){var t=s(e)+"/community/groups/"+e.id+"/updateUsers",r={authentication:e.authentication,params:{}};return"admin"===e.newMemberType?r.params.admins=e.users:r.params.users=e.users,f.request(t,r)}function P(e){var t=e.every(function(e){return e.success}),r=e.reduce(function(e,t){return e.concat(t.errors||[])},[]),n={success:t};return 0<r.length&&(n.errors=r),n}function C(e){var t,r,n={httpMethod:"GET"};return"string"==typeof e?r="https://www.arcgis.com/sharing/rest/community/users/"+e:(t=e.username||e.authentication.username,r=s(e)+"/community/users/"+encodeURIComponent(t),n=l(l({},e),n)),f.request(r,n)}function M(e,t){return t.params=l({org:!1,everyone:!1},t.params),"private"===t.access&&(t.params.groups=" "),"org"===t.access&&(t.params.org=!0),"public"===t.access&&(t.params.account=!0,t.params.everyone=!0),f.request(e,t)}function S(t){return y({q:"id: "+t.id+" AND group: "+t.groupId,start:1,num:10,sortField:"title",authentication:t.authentication,httpMethod:"POST"}).then(function(e){if(0<e.total)return e.results.some(function(e){return e.id===t.id})})}function E(e){var t=e.authentication.username,r=e.owner||t,n=s(e)+"/content/items/"+e.id+"/share";return r===t&&(n=s(e)+"/content/users/"+r+"/items/"+e.id+"/share"),e.params={groups:e.groupId,confirmItemControl:e.confirmItemControl},f.request(n,e)}function R(e,t,r,n,o){var i,u,a,s,c=t.groups||[],m=c.find(function(e){return e.id===o.groupId});if(e.orgId!==t.orgId)throw Error("User "+t.username+" is not a member of the same org as "+e.username+". Consequently they can not be added added to group "+o.groupId+" nor can item "+o.id+" be shared to the group.");if(!m&&511<c.length)throw Error("User "+t.username+" 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 s=m?r&&"member"===m.userMembership.memberType?(a=U({id:o.groupId,users:[t.username],newMemberType:"admin",authentication:o.authentication}).then(function(e){var t=e.results.reduce(function(e,t){return t.success||e.push(t.username),e},[]);return Promise.resolve({notAdded:t})}).catch(function(){return{notAdded:[t.username]}}),function(e){return U({id:o.groupId,users:[t.username],newMemberType:"member",authentication:o.authentication}).then(function(){return e}).catch(function(){return e})}):(a=Promise.resolve({notAdded:[]}),function(e){return Promise.resolve(e)}):(u=r?"admins":"users",a=q(((i={id:o.groupId})[u]=[t.username],i.authentication=o.authentication,i)).then(function(e){if(e.errors&&e.errors.length)throw e.errors[0];return e}).catch(function(){return{notAdded:[t.username]}}),function(e){return T({id:o.groupId,users:[t.username],authentication:o.authentication}).then(function(){return e})}),{promise:a.then(function(e){if(e.notAdded.length)throw new Error(n);return e}),revert:s}}function x(e,t){var r=e||"self",n=s(t)+"/portals/"+r,o=l({httpMethod:"GET"},t);return f.request(n,o)}e.SearchQueryBuilder=d,e.acceptInvitation=function(e){var t=encodeURIComponent(e.authentication.username),r=s(e)+"/community/users/"+t+"/invitations/"+e.invitationId+"/accept",n=l({},e);return f.request(r,n)},e.addGroupUsers=q,e.addItemData=function(e){var t=l({item:{id:e.id,data:e.data}},e);return delete t.id,delete t.data,r(t)},e.addItemPart=function(n){return c(n).then(function(e){var t=s(n)+"/content/users/"+e+"/items/"+n.id+"/addPart",r=f.appendCustomParams(n,["file","partNum"],{params:l({},n.params)});return f.request(t,r)})},e.addItemRelationship=function(n){return c(n).then(function(e){var t=s(n)+"/content/users/"+e+"/addRelationship",r=f.appendCustomParams(n,["originItemId","destinationItemId","relationshipType"],{params:l({},n.params)});return f.request(t,r)})},e.addItemResource=function(r){return c(r).then(function(e){var t=s(r)+"/content/users/"+e+"/items/"+r.id+"/addResources";return r.params=l({file:r.resource,fileName:r.name,resourcesPrefix:r.prefix,text:r.content,access:r.private?"private":"inherit"},r.params),f.request(t,r)})},e.cancelItemUpload=function(r){return c(r).then(function(e){var t=s(r)+"/content/users/"+e+"/items/"+r.id+"/cancel";return f.request(t,r)})},e.commitItemUpload=function(r){return c(r).then(function(e){var t=s(r)+"/content/users/"+e+"/items/"+r.id+"/commit";return f.request(t,r)})},e.createFolder=function(r){return c(r).then(function(e){var t=s(r)+"/content/users/"+e+"/createFolder";return r.params=l({title:r.title},r.params),f.request(t,r)})},e.createGroup=function(e){var t=s(e)+"/community/createGroup";return e.params=l(l({},e.params),e.group),f.request(t,e)},e.createGroupNotification=function(e){var t=s(e)+"/community/groups/"+e.id+"/createNotification",r=l({params:l({subject:e.subject,message:e.message,users:e.users,notificationChannelType:e.notificationChannelType||"email",clientId:e.clientId,silentNotification:e.silentNotification,notifyAll:!e.users||0===e.users.length},e.params)},e);return f.request(t,r)},e.createItem=function(e){return t(l({folderId:null},e))},e.createItemInFolder=t,e.createOrgNotification=function(e){var o,n=s(e)+"/portals/self/createNotification",t=I((o=e).users,o.batchSize||25).map(function(e){return t=e,r=o,(n=Object.assign({},r)).params=l(l({},n.params),{users:t,subject:r.subject,message:r.message,notificationChannelType:n.notificationChannelType}),n;var t,r,n}).map(function(e){return t=n,r=e,f.request(t,r).catch(function(e){return{errors:[e]}});var t,r});return Promise.all(t).then(P)},e.declineInvitation=function(e){var t=encodeURIComponent(e.authentication.username),r=s(e)+"/community/users/"+t+"/invitations/"+e.invitationId+"/decline",n=l({},e);return f.request(r,n)},e.determineOwner=c,e.ensureMembership=R,e.exportItem=function(t){var r=t.authentication,n=t.id,o=t.title,i=t.exportFormat,u=t.exportParameters;return c(t).then(function(e){return s(t)+"/content/users/"+e+"/export"}).then(function(e){return f.request(e,{httpMethod:"POST",authentication:r,params:{itemId:n,title:o,exportFormat:i,exportParameters:u}})})},e.getGroup=o,e.getGroupCategorySchema=function(e,t){var r=s(t)+"/community/groups/"+e+"/categorySchema",n=l({httpMethod:"GET"},t);return f.request(r,n)},e.getGroupContent=function(e,t){var r=s(t)+"/content/groups/"+e,n=l(l({httpMethod:"GET"},{params:{start:1,num:100}}),t);return t&&t.paging&&(n.params=l({},t.paging)),f.request(r,n)},e.getGroupUsers=function(e,t){var r=s(t)+"/community/groups/"+e+"/users",n=l({httpMethod:"GET"},t);return f.request(r,n)},e.getItem=function(e,t){var r=g(e,t),n=l({httpMethod:"GET"},t);return f.request(r,n)},e.getItemBaseUrl=g,e.getItemData=function(e,t){var r=g(e,t)+"/data",n=l({httpMethod:"GET",params:{}},t);return n.file&&(n.params.f=null),f.request(r,n).catch(function(e){if(!RegExp(/The string did not match the expected pattern|(Unexpected end of (JSON input|data at line 1 column 1))/i).test(e.message))throw e})},e.getItemGroups=function(e,t){var r=g(e,t)+"/groups";return f.request(r,t)},e.getItemInfo=n,e.getItemMetadata=function(e,t){return n(e,l(l({},t),{fileName:"metadata/metadata.xml"}))},e.getItemParts=function(r){return c(r).then(function(e){var t=s(r)+"/content/users/"+e+"/items/"+r.id+"/parts";return f.request(t,r)})},e.getItemResources=function(e,t){var r=g(e,t)+"/resources",n=l({},t);return n.params=l({num:1e3},n.params),f.request(r,n)},e.getItemStatus=function(n){return c(n).then(function(e){var t=s(n)+"/content/users/"+e+"/items/"+n.id+"/status",r=f.appendCustomParams(n,["jobId","jobType"],{params:l({},n.params)});return f.request(t,r)})},e.getPortal=x,e.getPortalSettings=function(e,t){var r=e||"self",n=s(t)+"/portals/"+r+"/settings",o=l({httpMethod:"GET"},t);return f.request(n,o)},e.getPortalUrl=s,e.getRelatedItems=function(e){var t=g(e.id,e)+"/relatedItems",r=l({httpMethod:"GET",params:{direction:e.direction}},e);return"string"==typeof e.relationshipType?r.params.relationshipType=e.relationshipType:r.params.relationshipTypes=e.relationshipType,delete r.direction,delete r.relationshipType,f.request(t,r)},e.getSelf=function(e){return x(null,e)},e.getSharingUrl=u,e.getUser=C,e.getUserContent=function(t){var e=t.folderId,r=t.start,n=void 0===r?1:r,o=t.num,i=void 0===o?10:o,u=t.authentication,a=e?"/"+e:"";return c(t).then(function(e){return s(t)+"/content/users/"+e+a}).then(function(e){return f.request(e,{httpMethod:"GET",authentication:u,params:{start:n,num:i}})})},e.getUserInvitation=function(e){var t=encodeURIComponent(e.authentication.username),r=s(e)+"/community/users/"+t+"/invitations/"+e.invitationId,n={httpMethod:"GET"},n=l(l({},e),n);return f.request(r,n)},e.getUserInvitations=function(e){var t={httpMethod:"GET"},r=encodeURIComponent(e.authentication.username),n=s(e)+"/community/users/"+r+"/invitations",t=l(l({},e),t);return f.request(n,t)},e.getUserMembership=p,e.getUserNotifications=function(e){var t={httpMethod:"GET"},r=encodeURIComponent(e.authentication.username),n=s(e)+"/community/users/"+r+"/notifications",t=l(l({},e),t);return f.request(n,t)},e.getUserTags=function(e){var t=e.username||e.authentication.username,r=s(e)+"/community/users/"+encodeURIComponent(t)+"/tags";return f.request(r,e)},e.getUserUrl=function(e){return s(e)+"/community/users/"+encodeURIComponent(e.username)},e.inviteGroupUsers=function(e){var o,t=e.id,n=s(e)+"/community/groups/"+t+"/invite",r=I((o=e).users,25).map(function(e){return t=e,r=o,(n=Object.assign({},r)).params=l(l({},n.params),{users:t,role:n.role,expiration:n.expiration}),n;var t,r,n}).map(function(e){return t=n,r=e,f.request(t,r).catch(function(e){return{errors:[e]}});var t,r});return Promise.all(r).then(G)},e.isItemOwner=a,e.isItemSharedWithGroup=S,e.isOrgAdmin=m,e.joinGroup=function(e){var t=s(e)+"/community/groups/"+e.id+"/join";return f.request(t,e)},e.leaveGroup=function(e){var t=s(e)+"/community/groups/"+e.id+"/leave";return f.request(t,e)},e.moveItem=function(n){return c(n).then(function(e){var t=s(n)+"/content/users/"+e+"/items/"+n.itemId+"/move",r=(r=n.folderId)||"/";return n.params=l({folder:r},n.params),f.request(t,n)})},e.protectGroup=function(e){var t=s(e)+"/community/groups/"+e.id+"/protect";return f.request(t,e)},e.protectItem=function(r){return c(r).then(function(e){var t=s(r)+"/content/users/"+e+"/items/"+r.id+"/protect";return f.request(t,r)})},e.reassignItem=function(n){return m(n).then(function(e){if(!e)throw Error("Item "+n.id+" can not be reassigned because current user is not an organization administrator.");var t=s(n)+"/content/users/"+n.currentOwner+"/items/"+n.id+"/reassign",r={params:{targetUsername:n.targetUsername,targetFolderName:n.targetFolderName},authentication:n.authentication};return f.request(t,r)})},e.removeFolder=function(r){return c(r).then(function(e){var t=s(r)+"/content/users/"+encodeURIComponent(e)+"/"+r.folderId+"/delete";return f.request(t,r)})},e.removeGroup=function(e){var t=s(e)+"/community/groups/"+e.id+"/delete",r=l({},e);return f.request(t,r)},e.removeGroupUsers=T,e.removeItem=function(r){return c(r).then(function(e){var t=s(r)+"/content/users/"+e+"/items/"+r.id+"/delete";return f.request(t,r)})},e.removeItemRelationship=function(n){return c(n).then(function(e){var t=s(n)+"/content/users/"+e+"/deleteRelationship",r=f.appendCustomParams(n,["originItemId","destinationItemId","relationshipType"],{params:l({},n.params)});return f.request(t,r)})},e.removeItemResource=function(r){return c(r).then(function(e){var t=s(r)+"/content/users/"+e+"/items/"+r.id+"/removeResources";return r.params=l(l({},r.params),{resource:r.resource}),f.request(t,r)})},e.removeNotification=function(e){var t=encodeURIComponent(e.authentication.username),r=s(e)+"/community/users/"+t+"/notifications/"+e.id+"/delete";return f.request(r,e)},e.searchGroupContent=function(e){return v(e,"groupContent")},e.searchGroupUsers=function(e,t){var r=s(t)+"/community/groups/"+e+"/userlist",n=f.appendCustomParams(t||{},["name","num","start","sortField","sortOrder","joined","memberType"],{httpMethod:"GET"});return f.request(r,n)},e.searchGroups=function(e){return v(e,"group")},e.searchItems=y,e.searchUsers=function(e){return v(e,"user")},e.serializeItem=i,e.setItemAccess=function(t){var r=u(t);return a(t)?M(r,t):m(t).then(function(e){if(e)return M(r,t);throw Error("This item can not be shared by "+t.authentication.username+". They are neither the item owner nor an organization admin.")})},e.shareItemWithGroup=function(i){return S(i).then(function(e){if(e)return{itemId:i.id,shortcut:!0,notSharedWith:[]};var t=i.authentication.username,r=i.owner,o=i.confirmItemControl,n=r||t;return n!==t?Promise.all([C({username:t,authentication:i.authentication}),C({username:n,authentication:i.authentication}),p(i)]).then(function(e){var t=e[0],r=e[1],n=e[2];return function(e,t,r,n,o,i){var u=[];if(t){if(!n)throw Error("This item can not be shared to shared editing group "+i.groupId+" by "+e.username+" as they not the item owner or org admin.");u.push(R(e,e,!1,"Error adding "+e.username+" as member to edit group "+i.groupId+". Consequently item "+i.id+" was not shared to the group.",i),R(e,o,!0,"none"===r?"Error adding user "+o.username+" to edit group "+i.groupId+". Consequently item "+i.id+" was not shared to the group.":"Error promoting user "+o.username+" to admin in edit group "+i.groupId+". Consequently item "+i.id+" was not shared to the group.",i))}else if(n)u.push(R(e,e,!1,"Error adding "+e.username+" as member to view group "+i.groupId+". Consequently item "+i.id+" was not shared to the group.",i));else if("none"===r)throw new Error("This item can not be shared by "+e.username+" as they are not a member of the specified group "+i.groupId+".");return u}(t,!!o,n,"org_admin"===t.role&&!t.roleId,r,i)}).then(function(e){var t=e[0],r=(void 0===t?{promise:Promise.resolve({notAdded:[]}),revert:function(e){return Promise.resolve(e)}}:t).revert;return Promise.all(e.map(function(e){return e.promise})).then(function(){return E(i)}).then(function(e){return r(e)})}):E(i)}).then(function(e){if(e.notSharedWith.length)throw Error("Item "+i.id+" could not be shared to group "+i.groupId+".");return e})},e.unprotectGroup=function(e){var t=s(e)+"/community/groups/"+e.id+"/unprotect";return f.request(t,e)},e.unprotectItem=function(r){return c(r).then(function(e){var t=s(r)+"/content/users/"+e+"/items/"+r.id+"/unprotect";return f.request(t,r)})},e.unshareItemWithGroup=function(a){return S(a).then(function(e){if(!e)return Promise.resolve({itemId:a.id,shortcut:!0,notUnsharedFrom:[]});var i=a.authentication.username,u=a.owner;return Promise.all([p(a),C({username:i,authentication:a.authentication})]).then(function(e){var t=e[0],r=e[1],n=(u||i)===i,o="org_admin"===r.role&&!r.roleId;if(!n&&!o&&["admin","owner"].indexOf(t)<0)throw Error("This item can not be unshared from group "+a.groupId+" by "+i+" as they not the item owner, an org admin, group admin or group owner.");return function(e){var t=e.authentication.username,r=e.owner||t,n=s(e)+"/content/items/"+e.id+"/unshare";r===t&&(n=s(e)+"/content/users/"+r+"/items/"+e.id+"/unshare");return e.params={groups:e.groupId},f.request(n,e)}(a)}).then(function(e){if(e.notUnsharedFrom.length)throw Error("Item "+a.id+" could not be unshared to group "+a.groupId);return e})})},e.updateGroup=function(e){var t=s(e)+"/community/groups/"+e.group.id+"/update";return e.params=l(l({},e.params),e.group),f.request(t,e)},e.updateItem=r,e.updateItemInfo=function(r){return c(r).then(function(e){var t=s(r)+"/content/users/"+e+"/items/"+r.id+"/updateinfo";return r.params=l({folderName:r.folderName,file:r.file},r.params),f.request(t,r)})},e.updateItemResource=function(r){return c(r).then(function(e){var t=s(r)+"/content/users/"+e+"/items/"+r.id+"/updateResources";return r.params=l({file:r.resource,fileName:r.name,text:r.content},r.params),void 0!==r.private&&(r.params.access=r.private?"private":"inherit"),f.request(t,r)})},e.updateUser=function(e){var t=e.user.username||e.authentication.username,r=s(e)+"/community/users/"+encodeURIComponent(t)+"/update";return e.params=l(l({},e.user),e.params),delete e.user,f.request(r,e)},e.updateUserMemberships=U,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=portal.umd.min.js.map |
{ | ||
"name": "@esri/arcgis-rest-portal", | ||
"version": "2.17.0", | ||
"version": "2.18.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.17.0", | ||
"@esri/arcgis-rest-types": "^2.18.0", | ||
"tslib": "^1.13.0" | ||
}, | ||
"devDependencies": { | ||
"@esri/arcgis-rest-auth": "^2.17.0", | ||
"@esri/arcgis-rest-request": "^2.17.0" | ||
"@esri/arcgis-rest-auth": "^2.18.0", | ||
"@esri/arcgis-rest-request": "^2.18.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 too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
923889
10944
0