Socket
Socket
Sign inDemoInstall

@esri/hub-discussions

Package Overview
Dependencies
14
Maintainers
43
Versions
276
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 8.20.0 to 8.21.0

17

dist/es2017/utils/request.js

@@ -1,2 +0,2 @@

import { RemoteServerError as _RemoteServerError } from "@esri/hub-common";
import { RemoteServerError as _RemoteServerError, buildUrl, } from "@esri/hub-common";
export class RemoteServerError extends _RemoteServerError {

@@ -46,7 +46,10 @@ constructor(message, url, status, error) {

cache: options.cache,
credentials: options.credentials
credentials: options.credentials,
};
// NOTE: this should default to the prod url once deployed and microservice root URLs
// are normalized: https://github.com/Esri/hub.js/pull/479#discussion_r607866561
const apiBase = options.hubApiUrl || "https://hub.arcgis.com/api/discussions/v1";
const apiBase = buildUrl({
// TODO: we _want_ to use getHubApiUrl(),
// but have to deal w/ the fact that this package overwrites IHubRequestOptions
host: options.hubApiUrl || "https://hub.arcgis.com",
path: "/api/discussions/v1",
});
if (options.params) {

@@ -62,3 +65,3 @@ if (options.httpMethod === "GET") {

const url = [apiBase.replace(/\/$/, ""), route.replace(/^\//, "")].join("/");
return fetch(url, opts).then(res => {
return fetch(url, opts).then((res) => {
if (res.ok) {

@@ -69,3 +72,3 @@ return res.json();

const { statusText, status } = res;
return res.json().then(err => {
return res.json().then((err) => {
throw new RemoteServerError(statusText, url, status, JSON.stringify(err.message));

@@ -72,0 +75,0 @@ });

import { __extends } from "tslib";
import { RemoteServerError as _RemoteServerError } from "@esri/hub-common";
import { RemoteServerError as _RemoteServerError, buildUrl, } from "@esri/hub-common";
var RemoteServerError = /** @class */ (function (_super) {

@@ -51,7 +51,10 @@ __extends(RemoteServerError, _super);

cache: options.cache,
credentials: options.credentials
credentials: options.credentials,
};
// NOTE: this should default to the prod url once deployed and microservice root URLs
// are normalized: https://github.com/Esri/hub.js/pull/479#discussion_r607866561
var apiBase = options.hubApiUrl || "https://hub.arcgis.com/api/discussions/v1";
var apiBase = buildUrl({
// TODO: we _want_ to use getHubApiUrl(),
// but have to deal w/ the fact that this package overwrites IHubRequestOptions
host: options.hubApiUrl || "https://hub.arcgis.com",
path: "/api/discussions/v1",
});
if (options.params) {

@@ -58,0 +61,0 @@ if (options.httpMethod === "GET") {

@@ -51,7 +51,10 @@ "use strict";

cache: options.cache,
credentials: options.credentials
credentials: options.credentials,
};
// NOTE: this should default to the prod url once deployed and microservice root URLs
// are normalized: https://github.com/Esri/hub.js/pull/479#discussion_r607866561
const apiBase = options.hubApiUrl || "https://hub.arcgis.com/api/discussions/v1";
const apiBase = hub_common_1.buildUrl({
// TODO: we _want_ to use getHubApiUrl(),
// but have to deal w/ the fact that this package overwrites IHubRequestOptions
host: options.hubApiUrl || "https://hub.arcgis.com",
path: "/api/discussions/v1",
});
if (options.params) {

@@ -67,3 +70,3 @@ if (options.httpMethod === "GET") {

const url = [apiBase.replace(/\/$/, ""), route.replace(/^\//, "")].join("/");
return fetch(url, opts).then(res => {
return fetch(url, opts).then((res) => {
if (res.ok) {

@@ -74,3 +77,3 @@ return res.json();

const { statusText, status } = res;
return res.json().then(err => {
return res.json().then((err) => {
throw new RemoteServerError(statusText, url, status, JSON.stringify(err.message));

@@ -77,0 +80,0 @@ });

/* @preserve
* @esri/hub-discussions - v8.19.0 - Thu Sep 16 2021 12:32:31 GMT-0700 (Pacific Daylight Time)
* @esri/hub-discussions - v8.20.0 - Fri Sep 17 2021 14:19:17 GMT-0700 (Pacific Daylight Time)
* Copyright (c) 2021 Environmental Systems Research Institute, Inc.

@@ -89,7 +89,10 @@ * Apache-2.0

cache: options.cache,
credentials: options.credentials
credentials: options.credentials,
};
// NOTE: this should default to the prod url once deployed and microservice root URLs
// are normalized: https://github.com/Esri/hub.js/pull/479#discussion_r607866561
var apiBase = options.hubApiUrl || "https://hub.arcgis.com/api/discussions/v1";
var apiBase = hubCommon.buildUrl({
// TODO: we _want_ to use getHubApiUrl(),
// but have to deal w/ the fact that this package overwrites IHubRequestOptions
host: options.hubApiUrl || "https://hub.arcgis.com",
path: "/api/discussions/v1",
});
if (options.params) {

@@ -96,0 +99,0 @@ if (options.httpMethod === "GET") {

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@esri/hub-common")):"function"==typeof define&&define.amd?define(["exports","@esri/hub-common"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).arcgisHub=e.arcgisHub||{},e.arcgisHub)}(this,function(e,a){"use strict";var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};var r,t,o,s,i=(r=a.RemoteServerError,n(t=c,o=r),t.prototype=null===o?Object.create(o):(u.prototype=o.prototype,new u),c);function u(){this.constructor=t}function c(e,t,n,o){n=r.call(this,e,t,n)||this;return n.error=o,n}function p(t,n){return e=n,o=n.token,r=n.authentication,e=function(){return Promise.resolve(o)},(e=r?r.getToken.bind(r,r.portal):e)().then(function(e){return function(e,t,n){var o=new Headers;o.append("Content-Type","application/json"),n&&o.append("Authorization","Bearer "+n),n={headers:o,method:t.httpMethod||"GET",mode:t.mode,cache:t.cache,credentials:t.credentials},o=t.hubApiUrl||"https://hub.arcgis.com/api/discussions/v1",t.params&&("GET"===t.httpMethod?e+="?"+new URLSearchParams(t.params).toString():n.body=JSON.stringify(t.params));var r=[o.replace(/\/$/,""),e.replace(/^\//,"")].join("/");return fetch(r,n).then(function(e){if(e.ok)return e.json();var t=e.statusText,n=e.status;return e.json().then(function(e){throw new i(t,r,n,JSON.stringify(e.message))})})}(t,n,e)});var e,o,r}e.SortOrder=void 0,(s=e.SortOrder||(e.SortOrder={})).ASC="ASC",s.DESC="DESC",e.PostReaction=void 0,(s=e.PostReaction||(e.PostReaction={})).THUMBS_UP="thumbs_up",s.THUMBS_DOWN="thumbs_down",s.THINKING="thinking",s.HEART="heart",s.ONE_HUNDRED="one_hundred",s.SAD="sad",s.LAUGH="laugh",s.SURPRISED="surprised",e.SharingAccess=void 0,(s=e.SharingAccess||(e.SharingAccess={})).PUBLIC="public",s.ORG="org",s.PRIVATE="private",e.PostStatus=void 0,(s=e.PostStatus||(e.PostStatus={})).PENDING="pending",s.APPROVED="approved",s.REJECTED="rejected",s.DELETED="deleted",s.HIDDEN="hidden",e.DiscussionType=void 0,(s=e.DiscussionType||(e.DiscussionType={})).DATASET="dataset",s.ITEM="item",s.GROUP="group",e.DiscussionSource=void 0,(s=e.DiscussionSource||(e.DiscussionSource={})).HUB="hub",s.AGO="ago",s.URBAN="urban",e.PostRelation=void 0,(s=e.PostRelation||(e.PostRelation={})).REPLIES="replies",s.REACTIONS="reactions",s.PARENT="parent",s.CHANNEL="channel",e.ChannelRelation=void 0,(e.ChannelRelation||(e.ChannelRelation={})).SETTINGS="settings",e.ReactionRelation=void 0,(e.ReactionRelation||(e.ReactionRelation={})).POST="post";var h="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},l=function(e,t){if(t=t.split(":")[0],!(e=+e))return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e},f=Object.prototype.hasOwnProperty;function d(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function m(e){try{return encodeURIComponent(e)}catch(e){return null}}var g={stringify:function(e,t){var n,o,r=[];for(o in"string"!=typeof(t=t||"")&&(t="?"),e)f.call(e,o)&&((n=e[o])||null!=n&&!isNaN(n)||(n=""),o=m(o),n=m(n),null!==o&&null!==n&&r.push(o+"="+n));return r.length?t+r.join("&"):""},parse:function(e){for(var t=/([^=?#&]+)=?([^&]*)/g,n={};r=t.exec(e);){var o=d(r[1]),r=d(r[2]);null===o||null===r||o in n||(n[o]=r)}return n}},v=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,y=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,b=/^[a-zA-Z]:/,w=new RegExp("^[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]+");function E(e){return(e||"").toString().replace(w,"")}var P=[["#","hash"],["?","query"],function(e,t){return R(t.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],S={hash:1,query:1};function T(e){var t,n="undefined"!=typeof window?window:void 0!==h?h:"undefined"!=typeof self?self:{},n=n.location||{},o={},n=typeof(e=e||n);if("blob:"===e.protocol)o=new A(unescape(e.pathname),{});else if("string"==n)for(t in o=new A(e,{}),S)delete o[t];else if("object"==n){for(t in e)t in S||(o[t]=e[t]);void 0===o.slashes&&(o.slashes=v.test(e.href))}return o}function R(e){return"file:"===e||"ftp:"===e||"http:"===e||"https:"===e||"ws:"===e||"wss:"===e}function C(e,t){e=E(e),t=t||{};var n,o=y.exec(e),r=o[1]?o[1].toLowerCase():"",s=!!o[2],a=!!o[3],e=0;return s?e=a?(n=o[2]+o[3]+o[4],o[2].length+o[3].length):(n=o[2]+o[4],o[2].length):a?(n=o[3]+o[4],e=o[3].length):n=o[4],"file:"===r?2<=e&&(n=n.slice(2)):R(r)?n=o[4]:r?s&&(n=n.slice(2)):2<=e&&R(t.protocol)&&(n=o[4]),{protocol:r,slashes:s||R(r),slashesCount:e,rest:n}}function A(e,t,n){if(e=E(e),!(this instanceof A))return new A(e,t,n);var o,r,s,a,i,u=P.slice(),c=typeof t,p=this,h=0;for("object"!=c&&"string"!=c&&(n=t,t=null),n&&"function"!=typeof n&&(n=g.parse),o=!(c=C(e||"",t=T(t))).protocol&&!c.slashes,p.slashes=c.slashes||o&&t.slashes,p.protocol=c.protocol||t.protocol||"",e=c.rest,("file:"===c.protocol&&(2!==c.slashesCount||b.test(e))||!c.slashes&&(c.protocol||c.slashesCount<2||!R(p.protocol)))&&(u[3]=[/(.*)/,"pathname"]);h<u.length;h++)"function"!=typeof(s=u[h])?(r=s[0],i=s[1],r!=r?p[i]=e:"string"==typeof r?~(a=e.indexOf(r))&&(e="number"==typeof s[2]?(p[i]=e.slice(0,a),e.slice(a+s[2])):(p[i]=e.slice(a),e.slice(0,a))):(a=r.exec(e))&&(p[i]=a[1],e=e.slice(0,a.index)),p[i]=p[i]||o&&s[3]&&t[i]||"",s[4]&&(p[i]=p[i].toLowerCase())):e=s(e,p);n&&(p.query=n(p.query)),o&&t.slashes&&"/"!==p.pathname.charAt(0)&&(""!==p.pathname||""!==t.pathname)&&(p.pathname=function(e,t){if(""===e)return t;for(var n=(t||"/").split("/").slice(0,-1).concat(e.split("/")),o=n.length,e=n[o-1],r=!1,s=0;o--;)"."===n[o]?n.splice(o,1):".."===n[o]?(n.splice(o,1),s++):s&&(0===o&&(r=!0),n.splice(o,1),s--);return r&&n.unshift(""),"."!==e&&".."!==e||n.push(""),n.join("/")}(p.pathname,t.pathname)),"/"!==p.pathname.charAt(0)&&R(p.protocol)&&(p.pathname="/"+p.pathname),l(p.port,p.protocol)||(p.host=p.hostname,p.port=""),p.username=p.password="",p.auth&&(s=p.auth.split(":"),p.username=s[0]||"",p.password=s[1]||""),p.origin="file:"!==p.protocol&&R(p.protocol)&&p.host?p.protocol+"//"+p.host:"null",p.href=p.toString()}A.prototype={set:function(e,t,n){var o,r=this;switch(e){case"query":"string"==typeof t&&t.length&&(t=(n||g.parse)(t)),r[e]=t;break;case"port":r[e]=t,l(t,r.protocol)?t&&(r.host=r.hostname+":"+t):(r.host=r.hostname,r[e]="");break;case"hostname":r[e]=t,r.port&&(t+=":"+r.port),r.host=t;break;case"host":r[e]=t,/:\d+$/.test(t)?(t=t.split(":"),r.port=t.pop(),r.hostname=t.join(":")):(r.hostname=t,r.port="");break;case"protocol":r.protocol=t.toLowerCase(),r.slashes=!n;break;case"pathname":case"hash":t?(o="pathname"===e?"/":"#",r[e]=t.charAt(0)!==o?o+t:t):r[e]=t;break;default:r[e]=t}for(var s=0;s<P.length;s++){var a=P[s];a[4]&&(r[a[1]]=r[a[1]].toLowerCase())}return r.origin="file:"!==r.protocol&&R(r.protocol)&&r.host?r.protocol+"//"+r.host:"null",r.href=r.toString(),r},toString:function(e){e&&"function"==typeof e||(e=g.stringify);var t=this,n=t.protocol;return n&&":"!==n.charAt(n.length-1)&&(n+=":"),n+=t.slashes||R(t.protocol)?"//":"",t.username&&(n+=t.username,t.password&&(n+=":"+t.password),n+="@"),n+=t.host+t.pathname,(e="object"==typeof t.query?e(t.query):t.query)&&(n+="?"!==e.charAt(0)?"?"+e:e),t.hash&&(n+=t.hash),n}},A.extractProtocol=C,A.location=T,A.trimLeft=E,A.qs=g;var O=Object.freeze(Object.assign(Object.create(null),A,{default:A}));function I(n){return function(e,t){return-1<n.indexOf(t.userMembership.memberType)&&e.push(t.id),e}}function D(e){return"org_admin"===e.role&&!e.roleId}function x(o,r){return function(e,t){var t=t.groups,n=e.groups.reduce(I(o),[]);return t[r?"every":"some"](function(e){return-1<n.indexOf(e)})}}function M(e,t){return 1===e.orgs.length&&-1<e.orgs.indexOf(t.orgId)}function N(e,t){return D(t)&&-1<e.orgs.indexOf(t.orgId)}e.canCreateChannel=function(e,t){return"private"===e.access?x(["owner","admin","member"],!0)(t,e):N(e,t)},e.canCreateReaction=function(e,t){var n=e.allowReaction,e=e.allowedReactions;return!!n&&(!e||-1<e.indexOf(t))},e.canModifyChannel=function(e,t){return"private"===e.access?x(["owner","admin"])(t,e):N(e,t)},e.canPostToChannel=function(e,t){return"private"===e.access?x(["owner","admin","member"])(t,e):"org"===e.access?M(e,t):"anonymous"!==t.username||e.allowAnonymous},e.canReadFromChannel=function(e,t){return"private"===e.access?x(["member","owner","admin"])(t,e):"org"!==e.access||M(e,t)},e.createChannel=function(e){return e.httpMethod="POST",p("/channels",e)},e.createPost=function(e){return e.httpMethod="POST",p("/posts",e)},e.createReaction=function(e){return e.httpMethod="POST",p("/reactions",e)},e.createReply=function(e){var t="/posts/"+e.postId+"/reply";return e.httpMethod="POST",p(t,e)},e.fetchChannel=function(e){return e.httpMethod="GET",p("/channels/"+e.channelId,e)},e.fetchPost=function(e){var t="/posts/"+e.postId;return e.httpMethod="GET",p(t,e)},e.isChannelInclusive=function(t,e){var n,o;if("private"===t.access&&1===t.groups.length?(n="private"===e.access&&e.groups[0]===t.groups[0])||(o="replies to private post must be shared to same team"):"private"===t.access?(n="private"===e.access&&e.groups.every(function(e){return-1<t.groups.indexOf(e)}))||(o="replies to shared post must be shared to subset of same teams"):"org"===t.access&&"org"===e.access?(n=e.orgs.every(function(e){return-1<t.orgs.indexOf(e)}))||(o="replies to org post must be shared to subset of same orgs"):"org"===t.access&&((n="public"!==e.access)||(o="replies to org post cannot be shared to public")),o)throw new Error(o);return n},e.isGroupDiscussable=function(e){return!0},e.isItemDiscussable=function(e){return!0},e.isOrgAdmin=D,e.parseDiscussionURI=function(e){var t,n,o=new URL(e)&&new O(e),r=o.protocol.slice(0,-1),s=o.hostname;return(e=o.pathname.split("/")[1])&&(t=(n=[(t=a.parseDatasetId(e)).itemId,t.layerId])[0],n=n[1]),o=new URLSearchParams(o.query),{source:r,type:s,id:t||null,layer:n||null,features:o.has("id")&&o.get("id").split(",")||null,attribute:o.has("attribute")&&o.get("attribute")||null}},e.reduceByGroupMembership=I,e.removeChannel=function(e){return e.httpMethod="DELETE",p("/channels/"+e.channelId,e)},e.removePost=function(e){var t="/posts/"+e.postId;return e.httpMethod="DELETE",p(t,e)},e.removeReaction=function(e){var t=e.reactionId;return e.httpMethod="DELETE",p("/reactions/"+t,e)},e.searchChannels=function(e){return e.httpMethod="GET",p("/channels",e)},e.searchPosts=function(e){return e.httpMethod="GET",p("/posts",e)},e.updateChannel=function(e){return e.httpMethod="PATCH",p("/channels/"+e.channelId,e)},e.updatePost=function(e){var t="/posts/"+e.postId;return e.httpMethod="PATCH",p(t,e)},e.updatePostSharing=function(e){var t="/posts/"+e.postId+"/sharing";return e.httpMethod="PATCH",p(t,e)},e.updatePostStatus=function(e){var t="/posts/"+e.postId+"/status";return e.httpMethod="PATCH",p(t,e)},Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@esri/hub-common")):"function"==typeof define&&define.amd?define(["exports","@esri/hub-common"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).arcgisHub=e.arcgisHub||{},e.arcgisHub)}(this,function(e,a){"use strict";var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};var r,t,o,s,i=(r=a.RemoteServerError,n(t=c,o=r),t.prototype=null===o?Object.create(o):(u.prototype=o.prototype,new u),c);function u(){this.constructor=t}function c(e,t,n,o){n=r.call(this,e,t,n)||this;return n.error=o,n}function p(t,n){return e=n,o=n.token,r=n.authentication,e=function(){return Promise.resolve(o)},(e=r?r.getToken.bind(r,r.portal):e)().then(function(e){return function(e,t,n){var o=new Headers;o.append("Content-Type","application/json"),n&&o.append("Authorization","Bearer "+n),n={headers:o,method:t.httpMethod||"GET",mode:t.mode,cache:t.cache,credentials:t.credentials},o=a.buildUrl({host:t.hubApiUrl||"https://hub.arcgis.com",path:"/api/discussions/v1"}),t.params&&("GET"===t.httpMethod?e+="?"+new URLSearchParams(t.params).toString():n.body=JSON.stringify(t.params));var r=[o.replace(/\/$/,""),e.replace(/^\//,"")].join("/");return fetch(r,n).then(function(e){if(e.ok)return e.json();var t=e.statusText,n=e.status;return e.json().then(function(e){throw new i(t,r,n,JSON.stringify(e.message))})})}(t,n,e)});var e,o,r}e.SortOrder=void 0,(s=e.SortOrder||(e.SortOrder={})).ASC="ASC",s.DESC="DESC",e.PostReaction=void 0,(s=e.PostReaction||(e.PostReaction={})).THUMBS_UP="thumbs_up",s.THUMBS_DOWN="thumbs_down",s.THINKING="thinking",s.HEART="heart",s.ONE_HUNDRED="one_hundred",s.SAD="sad",s.LAUGH="laugh",s.SURPRISED="surprised",e.SharingAccess=void 0,(s=e.SharingAccess||(e.SharingAccess={})).PUBLIC="public",s.ORG="org",s.PRIVATE="private",e.PostStatus=void 0,(s=e.PostStatus||(e.PostStatus={})).PENDING="pending",s.APPROVED="approved",s.REJECTED="rejected",s.DELETED="deleted",s.HIDDEN="hidden",e.DiscussionType=void 0,(s=e.DiscussionType||(e.DiscussionType={})).DATASET="dataset",s.ITEM="item",s.GROUP="group",e.DiscussionSource=void 0,(s=e.DiscussionSource||(e.DiscussionSource={})).HUB="hub",s.AGO="ago",s.URBAN="urban",e.PostRelation=void 0,(s=e.PostRelation||(e.PostRelation={})).REPLIES="replies",s.REACTIONS="reactions",s.PARENT="parent",s.CHANNEL="channel",e.ChannelRelation=void 0,(e.ChannelRelation||(e.ChannelRelation={})).SETTINGS="settings",e.ReactionRelation=void 0,(e.ReactionRelation||(e.ReactionRelation={})).POST="post";var h="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},l=function(e,t){if(t=t.split(":")[0],!(e=+e))return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e},f=Object.prototype.hasOwnProperty;function d(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function m(e){try{return encodeURIComponent(e)}catch(e){return null}}var g={stringify:function(e,t){var n,o,r=[];for(o in"string"!=typeof(t=t||"")&&(t="?"),e)f.call(e,o)&&((n=e[o])||null!=n&&!isNaN(n)||(n=""),o=m(o),n=m(n),null!==o&&null!==n&&r.push(o+"="+n));return r.length?t+r.join("&"):""},parse:function(e){for(var t=/([^=?#&]+)=?([^&]*)/g,n={};r=t.exec(e);){var o=d(r[1]),r=d(r[2]);null===o||null===r||o in n||(n[o]=r)}return n}},v=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,y=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,b=/^[a-zA-Z]:/,w=new RegExp("^[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]+");function E(e){return(e||"").toString().replace(w,"")}var P=[["#","hash"],["?","query"],function(e,t){return R(t.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],S={hash:1,query:1};function T(e){var t,n="undefined"!=typeof window?window:void 0!==h?h:"undefined"!=typeof self?self:{},n=n.location||{},o={},n=typeof(e=e||n);if("blob:"===e.protocol)o=new A(unescape(e.pathname),{});else if("string"==n)for(t in o=new A(e,{}),S)delete o[t];else if("object"==n){for(t in e)t in S||(o[t]=e[t]);void 0===o.slashes&&(o.slashes=v.test(e.href))}return o}function R(e){return"file:"===e||"ftp:"===e||"http:"===e||"https:"===e||"ws:"===e||"wss:"===e}function C(e,t){e=E(e),t=t||{};var n,o=y.exec(e),r=o[1]?o[1].toLowerCase():"",s=!!o[2],a=!!o[3],e=0;return s?e=a?(n=o[2]+o[3]+o[4],o[2].length+o[3].length):(n=o[2]+o[4],o[2].length):a?(n=o[3]+o[4],e=o[3].length):n=o[4],"file:"===r?2<=e&&(n=n.slice(2)):R(r)?n=o[4]:r?s&&(n=n.slice(2)):2<=e&&R(t.protocol)&&(n=o[4]),{protocol:r,slashes:s||R(r),slashesCount:e,rest:n}}function A(e,t,n){if(e=E(e),!(this instanceof A))return new A(e,t,n);var o,r,s,a,i,u=P.slice(),c=typeof t,p=this,h=0;for("object"!=c&&"string"!=c&&(n=t,t=null),n&&"function"!=typeof n&&(n=g.parse),o=!(c=C(e||"",t=T(t))).protocol&&!c.slashes,p.slashes=c.slashes||o&&t.slashes,p.protocol=c.protocol||t.protocol||"",e=c.rest,("file:"===c.protocol&&(2!==c.slashesCount||b.test(e))||!c.slashes&&(c.protocol||c.slashesCount<2||!R(p.protocol)))&&(u[3]=[/(.*)/,"pathname"]);h<u.length;h++)"function"!=typeof(s=u[h])?(r=s[0],i=s[1],r!=r?p[i]=e:"string"==typeof r?~(a=e.indexOf(r))&&(e="number"==typeof s[2]?(p[i]=e.slice(0,a),e.slice(a+s[2])):(p[i]=e.slice(a),e.slice(0,a))):(a=r.exec(e))&&(p[i]=a[1],e=e.slice(0,a.index)),p[i]=p[i]||o&&s[3]&&t[i]||"",s[4]&&(p[i]=p[i].toLowerCase())):e=s(e,p);n&&(p.query=n(p.query)),o&&t.slashes&&"/"!==p.pathname.charAt(0)&&(""!==p.pathname||""!==t.pathname)&&(p.pathname=function(e,t){if(""===e)return t;for(var n=(t||"/").split("/").slice(0,-1).concat(e.split("/")),o=n.length,e=n[o-1],r=!1,s=0;o--;)"."===n[o]?n.splice(o,1):".."===n[o]?(n.splice(o,1),s++):s&&(0===o&&(r=!0),n.splice(o,1),s--);return r&&n.unshift(""),"."!==e&&".."!==e||n.push(""),n.join("/")}(p.pathname,t.pathname)),"/"!==p.pathname.charAt(0)&&R(p.protocol)&&(p.pathname="/"+p.pathname),l(p.port,p.protocol)||(p.host=p.hostname,p.port=""),p.username=p.password="",p.auth&&(s=p.auth.split(":"),p.username=s[0]||"",p.password=s[1]||""),p.origin="file:"!==p.protocol&&R(p.protocol)&&p.host?p.protocol+"//"+p.host:"null",p.href=p.toString()}A.prototype={set:function(e,t,n){var o,r=this;switch(e){case"query":"string"==typeof t&&t.length&&(t=(n||g.parse)(t)),r[e]=t;break;case"port":r[e]=t,l(t,r.protocol)?t&&(r.host=r.hostname+":"+t):(r.host=r.hostname,r[e]="");break;case"hostname":r[e]=t,r.port&&(t+=":"+r.port),r.host=t;break;case"host":r[e]=t,/:\d+$/.test(t)?(t=t.split(":"),r.port=t.pop(),r.hostname=t.join(":")):(r.hostname=t,r.port="");break;case"protocol":r.protocol=t.toLowerCase(),r.slashes=!n;break;case"pathname":case"hash":t?(o="pathname"===e?"/":"#",r[e]=t.charAt(0)!==o?o+t:t):r[e]=t;break;default:r[e]=t}for(var s=0;s<P.length;s++){var a=P[s];a[4]&&(r[a[1]]=r[a[1]].toLowerCase())}return r.origin="file:"!==r.protocol&&R(r.protocol)&&r.host?r.protocol+"//"+r.host:"null",r.href=r.toString(),r},toString:function(e){e&&"function"==typeof e||(e=g.stringify);var t=this,n=t.protocol;return n&&":"!==n.charAt(n.length-1)&&(n+=":"),n+=t.slashes||R(t.protocol)?"//":"",t.username&&(n+=t.username,t.password&&(n+=":"+t.password),n+="@"),n+=t.host+t.pathname,(e="object"==typeof t.query?e(t.query):t.query)&&(n+="?"!==e.charAt(0)?"?"+e:e),t.hash&&(n+=t.hash),n}},A.extractProtocol=C,A.location=T,A.trimLeft=E,A.qs=g;var O=Object.freeze(Object.assign(Object.create(null),A,{default:A}));function I(n){return function(e,t){return-1<n.indexOf(t.userMembership.memberType)&&e.push(t.id),e}}function D(e){return"org_admin"===e.role&&!e.roleId}function x(o,r){return function(e,t){var t=t.groups,n=e.groups.reduce(I(o),[]);return t[r?"every":"some"](function(e){return-1<n.indexOf(e)})}}function M(e,t){return 1===e.orgs.length&&-1<e.orgs.indexOf(t.orgId)}function N(e,t){return D(t)&&-1<e.orgs.indexOf(t.orgId)}e.canCreateChannel=function(e,t){return"private"===e.access?x(["owner","admin","member"],!0)(t,e):N(e,t)},e.canCreateReaction=function(e,t){var n=e.allowReaction,e=e.allowedReactions;return!!n&&(!e||-1<e.indexOf(t))},e.canModifyChannel=function(e,t){return"private"===e.access?x(["owner","admin"])(t,e):N(e,t)},e.canPostToChannel=function(e,t){return"private"===e.access?x(["owner","admin","member"])(t,e):"org"===e.access?M(e,t):"anonymous"!==t.username||e.allowAnonymous},e.canReadFromChannel=function(e,t){return"private"===e.access?x(["member","owner","admin"])(t,e):"org"!==e.access||M(e,t)},e.createChannel=function(e){return e.httpMethod="POST",p("/channels",e)},e.createPost=function(e){return e.httpMethod="POST",p("/posts",e)},e.createReaction=function(e){return e.httpMethod="POST",p("/reactions",e)},e.createReply=function(e){var t="/posts/"+e.postId+"/reply";return e.httpMethod="POST",p(t,e)},e.fetchChannel=function(e){return e.httpMethod="GET",p("/channels/"+e.channelId,e)},e.fetchPost=function(e){var t="/posts/"+e.postId;return e.httpMethod="GET",p(t,e)},e.isChannelInclusive=function(t,e){var n,o;if("private"===t.access&&1===t.groups.length?(n="private"===e.access&&e.groups[0]===t.groups[0])||(o="replies to private post must be shared to same team"):"private"===t.access?(n="private"===e.access&&e.groups.every(function(e){return-1<t.groups.indexOf(e)}))||(o="replies to shared post must be shared to subset of same teams"):"org"===t.access&&"org"===e.access?(n=e.orgs.every(function(e){return-1<t.orgs.indexOf(e)}))||(o="replies to org post must be shared to subset of same orgs"):"org"===t.access&&((n="public"!==e.access)||(o="replies to org post cannot be shared to public")),o)throw new Error(o);return n},e.isGroupDiscussable=function(e){return!0},e.isItemDiscussable=function(e){return!0},e.isOrgAdmin=D,e.parseDiscussionURI=function(e){var t,n,o=new URL(e)&&new O(e),r=o.protocol.slice(0,-1),s=o.hostname;return(e=o.pathname.split("/")[1])&&(t=(n=[(t=a.parseDatasetId(e)).itemId,t.layerId])[0],n=n[1]),o=new URLSearchParams(o.query),{source:r,type:s,id:t||null,layer:n||null,features:o.has("id")&&o.get("id").split(",")||null,attribute:o.has("attribute")&&o.get("attribute")||null}},e.reduceByGroupMembership=I,e.removeChannel=function(e){return e.httpMethod="DELETE",p("/channels/"+e.channelId,e)},e.removePost=function(e){var t="/posts/"+e.postId;return e.httpMethod="DELETE",p(t,e)},e.removeReaction=function(e){var t=e.reactionId;return e.httpMethod="DELETE",p("/reactions/"+t,e)},e.searchChannels=function(e){return e.httpMethod="GET",p("/channels",e)},e.searchPosts=function(e){return e.httpMethod="GET",p("/posts",e)},e.updateChannel=function(e){return e.httpMethod="PATCH",p("/channels/"+e.channelId,e)},e.updatePost=function(e){var t="/posts/"+e.postId;return e.httpMethod="PATCH",p(t,e)},e.updatePostSharing=function(e){var t="/posts/"+e.postId+"/sharing";return e.httpMethod="PATCH",p(t,e)},e.updatePostStatus=function(e){var t="/posts/"+e.postId+"/status";return e.httpMethod="PATCH",p(t,e)},Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=discussions.umd.min.js.map
{
"name": "@esri/hub-discussions",
"version": "8.20.0",
"version": "8.21.0",
"description": "Module to interact with ArcGIS Hub Discussions API in Node.js and modern browsers.",

@@ -25,3 +25,3 @@ "main": "dist/node/index.js",

"@esri/arcgis-rest-types": "^3.1.1",
"@esri/hub-common": "^8.20.0",
"@esri/hub-common": "^8.21.0",
"@rollup/plugin-commonjs": "^15.0.0",

@@ -73,3 +73,3 @@ "@rollup/plugin-json": "^4.1.0",

"homepage": "https://github.com/Esri/hub.js#readme",
"gitHead": "45888adcf9717a74aa093f27c4ea6a0b9a2509ef",
"gitHead": "007341f92459682987e4b2d765618f32f964c0a7",
"volta": {

@@ -76,0 +76,0 @@ "extends": "../../package.json"

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

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc