@esri/hub-discussions
Advanced tools
Comparing version 8.12.0 to 8.13.0
@@ -50,3 +50,3 @@ import { RemoteServerError as _RemoteServerError } from "@esri/hub-common"; | ||
// are normalized: https://github.com/Esri/hub.js/pull/479#discussion_r607866561 | ||
const apiBase = options.hubApiUrl || "https://hubqa.arcgis.com/api/discussions/v1"; | ||
const apiBase = options.hubApiUrl || "https://hub.arcgis.com/api/discussions/v1"; | ||
if (options.params) { | ||
@@ -53,0 +53,0 @@ if (options.httpMethod === "GET") { |
@@ -55,3 +55,3 @@ import { __extends } from "tslib"; | ||
// are normalized: https://github.com/Esri/hub.js/pull/479#discussion_r607866561 | ||
var apiBase = options.hubApiUrl || "https://hubqa.arcgis.com/api/discussions/v1"; | ||
var apiBase = options.hubApiUrl || "https://hub.arcgis.com/api/discussions/v1"; | ||
if (options.params) { | ||
@@ -58,0 +58,0 @@ if (options.httpMethod === "GET") { |
@@ -55,3 +55,3 @@ "use strict"; | ||
// are normalized: https://github.com/Esri/hub.js/pull/479#discussion_r607866561 | ||
const apiBase = options.hubApiUrl || "https://hubqa.arcgis.com/api/discussions/v1"; | ||
const apiBase = options.hubApiUrl || "https://hub.arcgis.com/api/discussions/v1"; | ||
if (options.params) { | ||
@@ -58,0 +58,0 @@ if (options.httpMethod === "GET") { |
/* @preserve | ||
* @esri/hub-discussions - v8.11.1 - Mon Jul 26 2021 12:46:55 GMT-0600 (Mountain Daylight Time) | ||
* @esri/hub-discussions - v8.12.0 - Mon Jul 26 2021 14:46:27 GMT-0600 (Mountain Daylight Time) | ||
* Copyright (c) 2021 Environmental Systems Research Institute, Inc. | ||
@@ -93,3 +93,3 @@ * Apache-2.0 | ||
// are normalized: https://github.com/Esri/hub.js/pull/479#discussion_r607866561 | ||
var apiBase = options.hubApiUrl || "https://hubqa.arcgis.com/api/discussions/v1"; | ||
var apiBase = options.hubApiUrl || "https://hub.arcgis.com/api/discussions/v1"; | ||
if (options.params) { | ||
@@ -96,0 +96,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://hubqa.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=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})}); | ||
//# sourceMappingURL=discussions.umd.min.js.map |
{ | ||
"name": "@esri/hub-discussions", | ||
"version": "8.12.0", | ||
"version": "8.13.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.12.0", | ||
"@esri/hub-common": "^8.13.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": "6fa9f9e9f715bf9151d6a6ee7db8013398a28a58", | ||
"gitHead": "2398b876495f67b1508291d70e6e8f90e26c4932", | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
339361