Socket
Socket
Sign inDemoInstall

@esri/hub-discussions

Package Overview
Dependencies
Maintainers
41
Versions
284
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@esri/hub-discussions - npm Package Compare versions

Comparing version 1.0.0-beta.9 to 1.0.0-beta.10

7

dist/es2017/utils/request.js

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

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

@@ -62,3 +62,2 @@ constructor(message, url, status, error) {

return fetch(url, opts).then(res => {
debugger;
if (res.ok) {

@@ -68,5 +67,5 @@ return res.json();

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

@@ -73,0 +72,0 @@ }

/* @preserve
* @esri/hub-discussions - v1.0.0-beta.8 - Mon Apr 19 2021 14:14:49 GMT-0400 (Eastern Daylight Time)
* @esri/hub-discussions - v1.0.0-beta.9 - Mon Apr 19 2021 16:58:09 GMT-0400 (Eastern Daylight Time)
* Copyright (c) 2021 Environmental Systems Research Institute, Inc.

@@ -105,3 +105,2 @@ * Apache-2.0

return fetch(url, opts).then(function (res) {
debugger;
if (res.ok) {

@@ -111,5 +110,5 @@ return res.json();

else {
var statusText_1 = res.statusText, status_1 = res.status;
return res.json().then(function (err) {
var message = err.message, statusCode = err.statusCode, error = err.error;
throw new RemoteServerError(message, url, statusCode, error);
throw new RemoteServerError(statusText_1, url, status_1, JSON.stringify(err.message));
});

@@ -116,0 +115,0 @@ }

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

@@ -5,0 +5,0 @@ "main": "dist/node/index.js",

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc