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.7 to 1.0.0-beta.8

6

dist/es2017/utils/request.js

@@ -41,3 +41,5 @@ /**

};
const apiBase = options.hubApiUrl;
// 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://ingress.eks.qa.hub.geocloud.com/api/v1";
if (options.params) {

@@ -52,4 +54,4 @@ if (options.httpMethod === "GET") {

}
return fetch([apiBase, url.replace(/^\//, "")].join("/"), opts).then(res => res.json());
return fetch([apiBase.replace(/\/$/, ""), url.replace(/^\//, "")].join("/"), opts).then(res => res.json());
}
//# sourceMappingURL=request.js.map

@@ -41,3 +41,5 @@ /**

};
var apiBase = options.hubApiUrl;
// 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://ingress.eks.qa.hub.geocloud.com/api/v1";
if (options.params) {

@@ -52,6 +54,4 @@ if (options.httpMethod === "GET") {

}
return fetch([apiBase, url.replace(/^\//, "")].join("/"), opts).then(function (res) {
return res.json();
});
return fetch([apiBase.replace(/\/$/, ""), url.replace(/^\//, "")].join("/"), opts).then(function (res) { return res.json(); });
}
//# sourceMappingURL=request.js.map

@@ -44,3 +44,5 @@ "use strict";

};
const apiBase = options.hubApiUrl;
// 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://ingress.eks.qa.hub.geocloud.com/api/v1";
if (options.params) {

@@ -55,5 +57,5 @@ if (options.httpMethod === "GET") {

}
return fetch([apiBase, url.replace(/^\//, "")].join("/"), opts).then(res => res.json());
return fetch([apiBase.replace(/\/$/, ""), url.replace(/^\//, "")].join("/"), opts).then(res => res.json());
}
exports.apiRequest = apiRequest;
//# sourceMappingURL=request.js.map

@@ -376,3 +376,3 @@ import { IHubRequestOptions as _IHubRequestOptions } from "@esri/hub-common";

*/
export interface ICreateChannel extends IWithSettings, IWithSharing {
export interface ICreateChannel extends Partial<IWithSettings>, IWithSharing {
}

@@ -379,0 +379,0 @@ /**

/* @preserve
* @esri/hub-discussions - v1.0.0-beta.7 - Fri Mar 26 2021 14:14:26 GMT-0400 (Eastern Daylight Time)
* @esri/hub-discussions - v1.0.0-beta.8 - Fri Apr 09 2021 17:52:39 GMT-0400 (Eastern Daylight Time)
* Copyright (c) 2021 Environmental Systems Research Institute, Inc.

@@ -53,3 +53,5 @@ * Apache-2.0

};
var apiBase = options.hubApiUrl;
// 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://ingress.eks.qa.hub.geocloud.com/api/v1";
if (options.params) {

@@ -64,5 +66,3 @@ if (options.httpMethod === "GET") {

}
return fetch([apiBase, url.replace(/^\//, "")].join("/"), opts).then(function (res) {
return res.json();
});
return fetch([apiBase.replace(/\/$/, ""), url.replace(/^\//, "")].join("/"), opts).then(function (res) { return res.json(); });
}

@@ -69,0 +69,0 @@

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).arcgisHub=e.arcgisHub||{})}(this,function(e){"use strict";function r(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;return t.params&&("GET"===t.httpMethod?e+="?"+new URLSearchParams(t.params).toString():o.body=JSON.stringify(t.params)),fetch([s,e.replace(/^\//,"")].join("/"),o).then(function(e){return e.json()})}(t,n,e)})}var t,n,o,s,a,i,c;(t=e.SortOrder||(e.SortOrder={})).ASC="ASC",t.DESC="DESC",(n=e.PostReaction||(e.PostReaction={})).THUMBS_UP="thumbs_up",n.THUMBS_DOWN="thumbs_down",n.THINKING="thinking",n.HEART="heart",n.ONE_HUNDRED="one_hundred",n.SAD="sad",n.LAUGH="laugh",n.SURPRISED="surprised",(o=e.SharingAccess||(e.SharingAccess={})).PUBLIC="public",o.ORG="org",o.PRIVATE="private",(s=e.PostStatus||(e.PostStatus={})).PENDING="pending",s.APPROVED="approved",s.REJECTED="rejected",s.DELETED="deleted",s.HIDDEN="hidden",(a=e.DiscussionType||(e.DiscussionType={})).DATASET="dataset",a.ITEM="item",a.GROUP="group",(i=e.DiscussionSource||(e.DiscussionSource={})).HUB="hub",i.AGO="ago",i.URBAN="urban",(c=e.PostRelation||(e.PostRelation={})).REPLIES="replies",c.REACTIONS="reactions",c.PARENT="parent",c.CHANNEL="channel",(e.ChannelRelation||(e.ChannelRelation={})).SETTINGS="settings",(e.ReactionRelation||(e.ReactionRelation={})).POST="post";var u="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},d=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},h=Object.prototype.hasOwnProperty;function p(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function l(e){try{return encodeURIComponent(e)}catch(e){return null}}var f={stringify:function(e,t){t=t||"";var n,r,o=[];for(r in"string"!=typeof t&&(t="?"),e)if(h.call(e,r)){if((n=e[r])||null!=n&&!isNaN(n)||(n=""),r=l(r),n=l(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=p(t[1]),s=p(t[2]);null===o||null===s||o in r||(r[o]=s)}return r}},m=/^[A-Za-z][A-Za-z0-9+-.]*:[\\/]+/,g=/^([a-z][a-z0-9.+-]*:)?([\\/]{1,})?([\S\s]*)/i,y=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 v(e){return(e||"").toString().replace(y,"")}var b=[["#","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]],w={hash:1,query:1};function I(e){var t,n=("undefined"!=typeof window?window:void 0!==u?u:"undefined"!=typeof self?self:{}).location||{},r={},o=typeof(e=e||n);if("blob:"===e.protocol)r=new E(unescape(e.pathname),{});else if("string"==o)for(t in r=new E(e,{}),w)delete r[t];else if("object"==o){for(t in e)t in w||(r[t]=e[t]);void 0===r.slashes&&(r.slashes=m.test(e.href))}return r}function P(e){e=v(e);var t=g.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 E(e,t,n){if(e=v(e),!(this instanceof E))return new E(e,t,n);var r,o,s,a,i,c,u=b.slice(),h=typeof t,p=this,l=0;for("object"!=h&&"string"!=h&&(n=t,t=null),n&&"function"!=typeof n&&(n=f.parse),t=I(t),r=!(o=P(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),d(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()}E.prototype={set:function(e,t,n){var r=this;switch(e){case"query":"string"==typeof t&&t.length&&(t=(n||f.parse)(t)),r[e]=t;break;case"port":r[e]=t,d(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<b.length;s++){var a=b[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=f.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}},E.extractProtocol=P,E.location=I,E.trimLeft=v,E.qs=f;var T=E,O=Object.freeze(Object.assign(Object.create(null),T,{default:T}));function S(n){return function(e,t){return-1<n.indexOf(t.userMembership.memberType)&&e.push(t.id),e}}function R(e){return"org_admin"===e.role&&!e.roleId}function A(o,s){return function(e,t){var n=t.groups,r=e.groups.reduce(S(o),[]);return n[s?"every":"some"](function(e){return-1<r.indexOf(e)})}}function C(e,t){return 1===e.orgs.length&&-1<e.orgs.indexOf(t.orgId)}function D(e,t){return R(t)&&-1<e.orgs.indexOf(t.orgId)}e.canCreateChannel=function(e,t){return"private"===e.access?A(["owner","admin","member"],!0)(t,e):D(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?A(["owner","admin"])(t,e):D(e,t)},e.canPostToChannel=function(e,t){return"private"===e.access?A(["owner","admin","member"])(t,e):"org"===e.access?C(e,t):"anonymous"!==t.username||e.allowAnonymous},e.canReadFromChannel=function(e,t){return"private"===e.access?A(["member","owner","admin"])(t,e):"org"!==e.access||C(e,t)},e.createChannel=function(e){return e.httpMethod="POST",r("/channels",e)},e.createPost=function(e){var t="/posts";return e.hasOwnProperty("channelId")&&(t="/channels/"+e.channelId+t),e.httpMethod="POST",r(t,e)},e.createReaction=function(e){var t=e.postId;return e.httpMethod="POST",r("/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",r(t,e)},e.fetchChannel=function(e){return e.httpMethod="GET",r("/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",r(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=R,e.parseDiscussionURI=function(e){var t=new URL(e)&&new O(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=S,e.removeChannel=function(e){return e.httpMethod="DELETE",r("/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",r(t,e)},e.removeReaction=function(e){var t=e.postId,n=e.reactionId;return e.httpMethod="DELETE",r("/posts/"+t+"/reactions/"+n,e)},e.searchChannels=function(e){return e.httpMethod="GET",r("/channels",e)},e.searchPosts=function(e){var t="/posts";return e.hasOwnProperty("channelId")&&(t="/channels/"+e.channelId+t),e.httpMethod="GET",r(t,e)},e.updateChannel=function(e){return e.httpMethod="PATCH",r("/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",r(t,e)},e.updatePostSharing=function(e){var t="/posts/"+e.postId+"/sharing";return e.hasOwnProperty("channelId")&&(t="/channels/"+e.channelId+t),e.httpMethod="PATCH",r(t,e)},e.updatePostStatus=function(e){var t="/posts/"+e.postId+"/status";return e.hasOwnProperty("channelId")&&(t="/channels/"+e.channelId+t),e.httpMethod="PATCH",r(t,e)},Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).arcgisHub=e.arcgisHub||{})}(this,function(e){"use strict";function r(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";return t.params&&("GET"===t.httpMethod?e+="?"+new URLSearchParams(t.params).toString():o.body=JSON.stringify(t.params)),fetch([s.replace(/\/$/,""),e.replace(/^\//,"")].join("/"),o).then(function(e){return e.json()})}(t,n,e)})}var t,n,o,s,a,c,i;(t=e.SortOrder||(e.SortOrder={})).ASC="ASC",t.DESC="DESC",(n=e.PostReaction||(e.PostReaction={})).THUMBS_UP="thumbs_up",n.THUMBS_DOWN="thumbs_down",n.THINKING="thinking",n.HEART="heart",n.ONE_HUNDRED="one_hundred",n.SAD="sad",n.LAUGH="laugh",n.SURPRISED="surprised",(o=e.SharingAccess||(e.SharingAccess={})).PUBLIC="public",o.ORG="org",o.PRIVATE="private",(s=e.PostStatus||(e.PostStatus={})).PENDING="pending",s.APPROVED="approved",s.REJECTED="rejected",s.DELETED="deleted",s.HIDDEN="hidden",(a=e.DiscussionType||(e.DiscussionType={})).DATASET="dataset",a.ITEM="item",a.GROUP="group",(c=e.DiscussionSource||(e.DiscussionSource={})).HUB="hub",c.AGO="ago",c.URBAN="urban",(i=e.PostRelation||(e.PostRelation={})).REPLIES="replies",i.REACTIONS="reactions",i.PARENT="parent",i.CHANNEL="channel",(e.ChannelRelation||(e.ChannelRelation={})).SETTINGS="settings",(e.ReactionRelation||(e.ReactionRelation={})).POST="post";var u="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},d=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},h=Object.prototype.hasOwnProperty;function p(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function l(e){try{return encodeURIComponent(e)}catch(e){return null}}var f={stringify:function(e,t){t=t||"";var n,r,o=[];for(r in"string"!=typeof t&&(t="?"),e)if(h.call(e,r)){if((n=e[r])||null!=n&&!isNaN(n)||(n=""),r=l(r),n=l(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=p(t[1]),s=p(t[2]);null===o||null===s||o in r||(r[o]=s)}return r}},m=/^[A-Za-z][A-Za-z0-9+-.]*:[\\/]+/,g=/^([a-z][a-z0-9.+-]*:)?([\\/]{1,})?([\S\s]*)/i,v=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 y(e){return(e||"").toString().replace(v,"")}var b=[["#","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]],w={hash:1,query:1};function I(e){var t,n=("undefined"!=typeof window?window:void 0!==u?u:"undefined"!=typeof self?self:{}).location||{},r={},o=typeof(e=e||n);if("blob:"===e.protocol)r=new E(unescape(e.pathname),{});else if("string"==o)for(t in r=new E(e,{}),w)delete r[t];else if("object"==o){for(t in e)t in w||(r[t]=e[t]);void 0===r.slashes&&(r.slashes=m.test(e.href))}return r}function P(e){e=y(e);var t=g.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 E(e,t,n){if(e=y(e),!(this instanceof E))return new E(e,t,n);var r,o,s,a,c,i,u=b.slice(),h=typeof t,p=this,l=0;for("object"!=h&&"string"!=h&&(n=t,t=null),n&&"function"!=typeof n&&(n=f.parse),t=I(t),r=!(o=P(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),d(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()}E.prototype={set:function(e,t,n){var r=this;switch(e){case"query":"string"==typeof t&&t.length&&(t=(n||f.parse)(t)),r[e]=t;break;case"port":r[e]=t,d(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<b.length;s++){var a=b[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=f.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}},E.extractProtocol=P,E.location=I,E.trimLeft=y,E.qs=f;var T=E,O=Object.freeze(Object.assign(Object.create(null),T,{default:T}));function S(n){return function(e,t){return-1<n.indexOf(t.userMembership.memberType)&&e.push(t.id),e}}function R(e){return"org_admin"===e.role&&!e.roleId}function A(o,s){return function(e,t){var n=t.groups,r=e.groups.reduce(S(o),[]);return n[s?"every":"some"](function(e){return-1<r.indexOf(e)})}}function C(e,t){return 1===e.orgs.length&&-1<e.orgs.indexOf(t.orgId)}function D(e,t){return R(t)&&-1<e.orgs.indexOf(t.orgId)}e.canCreateChannel=function(e,t){return"private"===e.access?A(["owner","admin","member"],!0)(t,e):D(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?A(["owner","admin"])(t,e):D(e,t)},e.canPostToChannel=function(e,t){return"private"===e.access?A(["owner","admin","member"])(t,e):"org"===e.access?C(e,t):"anonymous"!==t.username||e.allowAnonymous},e.canReadFromChannel=function(e,t){return"private"===e.access?A(["member","owner","admin"])(t,e):"org"!==e.access||C(e,t)},e.createChannel=function(e){return e.httpMethod="POST",r("/channels",e)},e.createPost=function(e){var t="/posts";return e.hasOwnProperty("channelId")&&(t="/channels/"+e.channelId+t),e.httpMethod="POST",r(t,e)},e.createReaction=function(e){var t=e.postId;return e.httpMethod="POST",r("/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",r(t,e)},e.fetchChannel=function(e){return e.httpMethod="GET",r("/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",r(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=R,e.parseDiscussionURI=function(e){var t=new URL(e)&&new O(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=S,e.removeChannel=function(e){return e.httpMethod="DELETE",r("/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",r(t,e)},e.removeReaction=function(e){var t=e.postId,n=e.reactionId;return e.httpMethod="DELETE",r("/posts/"+t+"/reactions/"+n,e)},e.searchChannels=function(e){return e.httpMethod="GET",r("/channels",e)},e.searchPosts=function(e){var t="/posts";return e.hasOwnProperty("channelId")&&(t="/channels/"+e.channelId+t),e.httpMethod="GET",r(t,e)},e.updateChannel=function(e){return e.httpMethod="PATCH",r("/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",r(t,e)},e.updatePostSharing=function(e){var t="/posts/"+e.postId+"/sharing";return e.hasOwnProperty("channelId")&&(t="/channels/"+e.channelId+t),e.httpMethod="PATCH",r(t,e)},e.updatePostStatus=function(e){var t="/posts/"+e.postId+"/status";return e.hasOwnProperty("channelId")&&(t="/channels/"+e.channelId+t),e.httpMethod="PATCH",r(t,e)},Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=discussions.umd.min.js.map
{
"name": "@esri/hub-discussions",
"version": "1.0.0-beta.7",
"version": "1.0.0-beta.8",
"description": "Module to interact with ArcGIS Hub Discussions API in Node.js and modern browsers.",

@@ -17,4 +17,4 @@ "main": "dist/node/index.js",

"peerDependencies": {
"@esri/arcgis-rest-auth": "^2.13.0",
"@esri/arcgis-rest-request": "^2.13.0",
"@esri/arcgis-rest-auth": "^2.13.0 || 3",
"@esri/arcgis-rest-request": "^2.13.0 || 3",
"@esri/hub-common": "^7.0.1"

@@ -43,2 +43,3 @@ },

"prepare": "npm run build",
"commit_this_build": "npm run build:node && npm run build:esm",
"build": "npm run build:node && npm run build:esm && npm run build:es2017 && npm run build:umd",

@@ -71,3 +72,6 @@ "build:esm": "tsc --module es2015 --target es5 --outDir ./dist/esm --declaration --declarationDir ./dist/types",

"homepage": "https://github.com/Esri/hub.js#readme",
"gitHead": "37f3a4e0e1c26399f6597697601d115d727540d9"
"gitHead": "37f3a4e0e1c26399f6597697601d115d727540d9",
"volta": {
"extends": "../../package.json"
}
}

@@ -18,3 +18,3 @@ [![npm version][npm-img]][npm-url]

> Module to interact with ArcGIS Hub Annotations in Node.js and modern browsers.
> Module to interact with ArcGIS Hub Discussions API in Node.js and modern browsers.

@@ -21,0 +21,0 @@ ### Example

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc