@esri/hub-common 9.13.0 → 9.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es2017/ArcGISContext.js +66 -106
- package/dist/es2017/ArcGISContext.js.map +1 -1
- package/dist/es2017/ArcGISContextManager.js +163 -0
- package/dist/es2017/ArcGISContextManager.js.map +1 -0
- package/dist/es2017/content/index.js +12 -3
- package/dist/es2017/content/index.js.map +1 -1
- package/dist/es2017/index.js +1 -0
- package/dist/es2017/index.js.map +1 -1
- package/dist/es2017/search/_searchContent.js +18 -7
- package/dist/es2017/search/_searchContent.js.map +1 -1
- package/dist/es2017/search/_searchGroups.js +1 -11
- package/dist/es2017/search/_searchGroups.js.map +1 -1
- package/dist/es2017/search/utils.js +1 -1
- package/dist/es2017/urls/getHubApiFromPortalUrl.js +21 -0
- package/dist/es2017/urls/getHubApiFromPortalUrl.js.map +1 -0
- package/dist/es2017/urls/getPortalBaseFromOrgUrl.js +25 -0
- package/dist/es2017/urls/getPortalBaseFromOrgUrl.js.map +1 -0
- package/dist/es2017/urls/index.js +2 -0
- package/dist/es2017/urls/index.js.map +1 -1
- package/dist/esm/ArcGISContext.js +66 -139
- package/dist/esm/ArcGISContext.js.map +1 -1
- package/dist/esm/ArcGISContextManager.js +207 -0
- package/dist/esm/ArcGISContextManager.js.map +1 -0
- package/dist/esm/content/index.js +12 -3
- package/dist/esm/content/index.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/search/_searchContent.js +18 -7
- package/dist/esm/search/_searchContent.js.map +1 -1
- package/dist/esm/search/_searchGroups.js +3 -13
- package/dist/esm/search/_searchGroups.js.map +1 -1
- package/dist/esm/search/utils.js +1 -1
- package/dist/esm/urls/getHubApiFromPortalUrl.js +21 -0
- package/dist/esm/urls/getHubApiFromPortalUrl.js.map +1 -0
- package/dist/esm/urls/getPortalBaseFromOrgUrl.js +25 -0
- package/dist/esm/urls/getPortalBaseFromOrgUrl.js.map +1 -0
- package/dist/esm/urls/index.js +2 -0
- package/dist/esm/urls/index.js.map +1 -1
- package/dist/node/ArcGISContext.js +66 -106
- package/dist/node/ArcGISContext.js.map +1 -1
- package/dist/node/ArcGISContextManager.js +167 -0
- package/dist/node/ArcGISContextManager.js.map +1 -0
- package/dist/node/content/index.js +12 -3
- package/dist/node/content/index.js.map +1 -1
- package/dist/node/index.js +1 -0
- package/dist/node/index.js.map +1 -1
- package/dist/node/search/_searchContent.js +17 -6
- package/dist/node/search/_searchContent.js.map +1 -1
- package/dist/node/search/_searchGroups.js +1 -11
- package/dist/node/search/_searchGroups.js.map +1 -1
- package/dist/node/search/utils.js +1 -1
- package/dist/node/urls/getHubApiFromPortalUrl.js +25 -0
- package/dist/node/urls/getHubApiFromPortalUrl.js.map +1 -0
- package/dist/node/urls/getPortalBaseFromOrgUrl.js +29 -0
- package/dist/node/urls/getPortalBaseFromOrgUrl.js.map +1 -0
- package/dist/node/urls/index.js +2 -0
- package/dist/node/urls/index.js.map +1 -1
- package/dist/types/ArcGISContext.d.ts +211 -54
- package/dist/types/ArcGISContextManager.d.ts +116 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/search/utils.d.ts +1 -1
- package/dist/types/urls/getHubApiFromPortalUrl.d.ts +8 -0
- package/dist/types/urls/getPortalBaseFromOrgUrl.d.ts +9 -0
- package/dist/types/urls/index.d.ts +2 -0
- package/dist/umd/common.umd.js +344 -153
- package/dist/umd/common.umd.js.map +1 -1
- package/dist/umd/common.umd.min.js +1 -1
- package/dist/umd/common.umd.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { expandContentFilter, serializeContentFilterForPortal, convertPortalResponseToFacets, } from "./content-utils";
|
|
2
2
|
import { searchItems } from "@esri/arcgis-rest-portal";
|
|
3
3
|
import { expandApi, getNextFunction } from ".";
|
|
4
|
-
import { cloneObject, itemToContent, setContentSiteUrls, } from "..";
|
|
4
|
+
import { cloneObject, getItemThumbnailUrl, itemToContent, setContentSiteUrls, } from "..";
|
|
5
5
|
/**
|
|
6
6
|
* Search for content via the Portal or Hub API
|
|
7
7
|
* @param filter
|
|
@@ -14,13 +14,12 @@ export async function _searchContent(filter, options) {
|
|
|
14
14
|
// API
|
|
15
15
|
const api = expandApi(options.api || "arcgis");
|
|
16
16
|
let searchPromise;
|
|
17
|
-
// map over the apis, depending on the type we issue the queries
|
|
18
|
-
// const searchPromises = apis.map((api) => {
|
|
19
17
|
// Portal Search
|
|
20
18
|
if (api.type === "arcgis") {
|
|
21
19
|
// serialize for portal
|
|
22
20
|
const so = serializeContentFilterForPortal(expanded);
|
|
23
|
-
//
|
|
21
|
+
// if we have auth, pass it forward
|
|
22
|
+
// otherwise set the portal property
|
|
24
23
|
if (options.authentication) {
|
|
25
24
|
so.authentication = options.authentication;
|
|
26
25
|
}
|
|
@@ -33,7 +32,6 @@ export async function _searchContent(filter, options) {
|
|
|
33
32
|
so.countSize = 200;
|
|
34
33
|
}
|
|
35
34
|
// copy over various options
|
|
36
|
-
// TODO: Dry this up - typscript makes this... inconvenient
|
|
37
35
|
if (options.num) {
|
|
38
36
|
so.num = options.num;
|
|
39
37
|
}
|
|
@@ -61,8 +59,6 @@ export async function _searchContent(filter, options) {
|
|
|
61
59
|
},
|
|
62
60
|
});
|
|
63
61
|
}
|
|
64
|
-
// });
|
|
65
|
-
// return for results
|
|
66
62
|
return searchPromise;
|
|
67
63
|
}
|
|
68
64
|
/**
|
|
@@ -74,12 +70,27 @@ export async function _searchContent(filter, options) {
|
|
|
74
70
|
* @returns
|
|
75
71
|
*/
|
|
76
72
|
function searchPortal(searchOptions) {
|
|
73
|
+
var _a;
|
|
74
|
+
const portalUrl = ((_a = searchOptions.authentication) === null || _a === void 0 ? void 0 : _a.portal) || searchOptions.portal;
|
|
75
|
+
let token;
|
|
76
|
+
if (searchOptions.authentication) {
|
|
77
|
+
const us = searchOptions.authentication;
|
|
78
|
+
token = us.token;
|
|
79
|
+
}
|
|
80
|
+
const thumbnailify = (content) => {
|
|
81
|
+
content.thumbnailUrl = getItemThumbnailUrl(content, portalUrl, token);
|
|
82
|
+
return content;
|
|
83
|
+
};
|
|
77
84
|
return searchItems(searchOptions).then((resp) => {
|
|
78
85
|
const hasNext = resp.nextStart > -1;
|
|
86
|
+
// convert items to IHubContent's
|
|
79
87
|
let content = resp.results.map(itemToContent);
|
|
88
|
+
// if we have a site, add those urls
|
|
80
89
|
if (searchOptions.site) {
|
|
81
90
|
content = content.map((entry) => setContentSiteUrls(entry, searchOptions.site));
|
|
82
91
|
}
|
|
92
|
+
// add thumbnailUrl
|
|
93
|
+
content = content.map(thumbnailify);
|
|
83
94
|
// convert aggregations into facets
|
|
84
95
|
const facets = convertPortalResponseToFacets(resp);
|
|
85
96
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_searchContent.js","sourceRoot":"","sources":["../../../src/search/_searchContent.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,+BAA+B,EAC/B,6BAA6B,GAC9B,MAAM,iBAAiB,CAAC;AAOzB,OAAO,EAAkB,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,GAAG,CAAC;AAC/C,OAAO,EACL,WAAW,
|
|
1
|
+
{"version":3,"file":"_searchContent.js","sourceRoot":"","sources":["../../../src/search/_searchContent.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,+BAA+B,EAC/B,6BAA6B,GAC9B,MAAM,iBAAiB,CAAC;AAOzB,OAAO,EAAkB,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,GAAG,CAAC;AAC/C,OAAO,EACL,WAAW,EACX,mBAAmB,EAGnB,aAAa,EACb,kBAAkB,GACnB,MAAM,IAAI,CAAC;AAGZ;;;;GAIG;AACH,MAAM,CAAC,K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ACH;QACD,mBAAmB;QACnB,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QACpC,mCAAmC;QACnC,MAAM,MAAM,GAAG,6BAA6B,CAAC,IAAI,CAAC,CAAC;QACnD,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE,OAAO;YAChB,MAAM;YACN,OAAO;YACP,IAAI,EAAE,eAAe,CACnB,aAAa,EACb,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,KAAK,EACV,YAAY,CACb;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -11,25 +11,20 @@ import { cloneObject, getGroupThumbnailUrl } from "..";
|
|
|
11
11
|
* @returns
|
|
12
12
|
*/
|
|
13
13
|
export async function _searchGroups(filter, options) {
|
|
14
|
-
var _a;
|
|
15
14
|
// expand filter so we can serialize to either api
|
|
16
15
|
const expanded = expandGroupFilter(filter);
|
|
17
16
|
// API
|
|
18
17
|
const api = expandApi(options.api || "arcgis");
|
|
19
18
|
if (api.type === "arcgis") {
|
|
20
19
|
const so = serializeGroupFilterForPortal(expanded);
|
|
21
|
-
let token = "";
|
|
22
20
|
// if we have auth, pass it forward
|
|
23
21
|
// otherwise set the portal property
|
|
24
22
|
if (options.authentication) {
|
|
25
23
|
so.authentication = options.authentication;
|
|
26
|
-
const us = options.authentication;
|
|
27
|
-
token = us.token;
|
|
28
24
|
}
|
|
29
25
|
else {
|
|
30
26
|
so.portal = `${api.url}/sharing/rest`;
|
|
31
27
|
}
|
|
32
|
-
// TODO: Dry this up - typscript makes this... inconvenient
|
|
33
28
|
if (options.num) {
|
|
34
29
|
so.num = options.num;
|
|
35
30
|
}
|
|
@@ -39,10 +34,6 @@ export async function _searchGroups(filter, options) {
|
|
|
39
34
|
if (options.sortOrder) {
|
|
40
35
|
so.sortOrder = options.sortOrder;
|
|
41
36
|
}
|
|
42
|
-
let portalUrl = `${api.url}/sharing/rest`;
|
|
43
|
-
if ((_a = so.authentication) === null || _a === void 0 ? void 0 : _a.portal) {
|
|
44
|
-
portalUrl = so.authentication.portal;
|
|
45
|
-
}
|
|
46
37
|
if (options.site) {
|
|
47
38
|
so.site = cloneObject(options.site);
|
|
48
39
|
}
|
|
@@ -63,8 +54,7 @@ function searchPortalGroups(searchOptions) {
|
|
|
63
54
|
group.siteTeamUrl = `${searchOptions.site.item.url}/teams/${group.id}/about`;
|
|
64
55
|
return group;
|
|
65
56
|
};
|
|
66
|
-
const portalUrl = ((_a = searchOptions.authentication) === null || _a === void 0 ? void 0 : _a.portal) ||
|
|
67
|
-
"https://www.arcgis.com/sharing/rest";
|
|
57
|
+
const portalUrl = ((_a = searchOptions.authentication) === null || _a === void 0 ? void 0 : _a.portal) || searchOptions.portal;
|
|
68
58
|
let token;
|
|
69
59
|
if (searchOptions.authentication) {
|
|
70
60
|
const us = searchOptions.authentication;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_searchGroups.js","sourceRoot":"","sources":["../../../src/search/_searchGroups.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,IAAI,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,GAAG,CAAC;AAC/C,OAAO,EACL,iBAAiB,EACjB,6BAA6B,GAC9B,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAmB,MAAM,IAAI,CAAC;AAMxE;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAAuB,EACvB,OAA0B
|
|
1
|
+
{"version":3,"file":"_searchGroups.js","sourceRoot":"","sources":["../../../src/search/_searchGroups.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,IAAI,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,GAAG,CAAC;AAC/C,OAAO,EACL,i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ACyB,CAAC;IAC/B,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -352,7 +352,7 @@ export function getNextFunction(request, nextStart, total, fn) {
|
|
|
352
352
|
* Construct a the full url to a group thumbnail
|
|
353
353
|
*
|
|
354
354
|
* - If the group has a thumbnail, construct the full url
|
|
355
|
-
* - If the group is not public, append on the token
|
|
355
|
+
* - If the group is not public, append on the token (if passed in)
|
|
356
356
|
* @param portalUrl
|
|
357
357
|
* @param group
|
|
358
358
|
* @param token
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-walk from a portalUrl to the corresponding Hub API Url
|
|
3
|
+
*
|
|
4
|
+
* If the passed url is not recognized, then this will return `undefined`
|
|
5
|
+
* @param portalUrl
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
export function getHubApiFromPortalUrl(portalUrl) {
|
|
9
|
+
let result;
|
|
10
|
+
if (portalUrl.match(/(qaext|\.mapsqa)\.arcgis.com/)) {
|
|
11
|
+
result = "https://hubqa.arcgis.com";
|
|
12
|
+
}
|
|
13
|
+
else if (portalUrl.match(/(devext|\.mapsdevext)\.arcgis.com/)) {
|
|
14
|
+
result = "https://hubdev.arcgis.com";
|
|
15
|
+
}
|
|
16
|
+
else if (portalUrl.match(/(www|\.maps)\.arcgis.com/)) {
|
|
17
|
+
result = "https://hub.arcgis.com";
|
|
18
|
+
}
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=getHubApiFromPortalUrl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getHubApiFromPortalUrl.js","sourceRoot":"","sources":["../../../src/urls/getHubApiFromPortalUrl.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,UAAU,sBAAsB,CAAC,SAAiB;IACtD,IAAI,MAAM,CAAC;IAEX,IAAI,SAAS,CAAC,KAAK,CAAC,8BAA8B,CAAC,EAAE;QACnD,MAAM,GAAG,0BAA0B,CAAC;KACrC;SAAM,IAAI,SAAS,CAAC,KAAK,CAAC,mCAAmC,CAAC,EAAE;QAC/D,MAAM,GAAG,2BAA2B,CAAC;KACtC;SAAM,IAAI,SAAS,CAAC,KAAK,CAAC,0BAA0B,CAAC,EAAE;QACtD,MAAM,GAAG,wBAAwB,CAAC;KACnC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Given an org url, get the portal base url
|
|
3
|
+
*
|
|
4
|
+
* i.e. https://myorg.maps.arcgis.com will return https://www.arcgis.com
|
|
5
|
+
*
|
|
6
|
+
* @param orgUrl
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export function getPortalBaseFromOrgUrl(orgUrl) {
|
|
10
|
+
let result = orgUrl;
|
|
11
|
+
if (orgUrl.match(/(qaext|\.mapsqa)\.arcgis.com/)) {
|
|
12
|
+
result = "https://qaext.arcgis.com";
|
|
13
|
+
}
|
|
14
|
+
else if (orgUrl.match(/(devext|\.mapsdevext)\.arcgis.com/)) {
|
|
15
|
+
result = "https://devext.arcgis.com";
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
/* istanbul ignore else */
|
|
19
|
+
if (orgUrl.match(/(www|\.maps)\.arcgis.com/)) {
|
|
20
|
+
result = "https://www.arcgis.com";
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=getPortalBaseFromOrgUrl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPortalBaseFromOrgUrl.js","sourceRoot":"","sources":["../../../src/urls/getPortalBaseFromOrgUrl.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAc;IACpD,IAAI,MAAM,GAAG,MAAM,CAAC;IAEpB,IAAI,MAAM,CAAC,KAAK,CAAC,8BAA8B,CAAC,EAAE;QAChD,MAAM,GAAG,0BAA0B,CAAC;KACrC;SAAM,IAAI,MAAM,CAAC,KAAK,CAAC,mCAAmC,CAAC,EAAE;QAC5D,MAAM,GAAG,2BAA2B,CAAC;KACtC;SAAM;QACL,0BAA0B;QAC1B,IAAI,MAAM,CAAC,KAAK,CAAC,0BAA0B,CAAC,EAAE;YAC5C,MAAM,GAAG,wBAAwB,CAAC;SACnC;KACF;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -14,6 +14,8 @@ export * from "./get-item-home-url";
|
|
|
14
14
|
export * from "./get-item-api-url";
|
|
15
15
|
export * from "./get-item-data-url";
|
|
16
16
|
export * from "./convert-urls-to-anchor-tags";
|
|
17
|
+
export * from "./getHubApiFromPortalUrl";
|
|
18
|
+
export * from "./getPortalBaseFromOrgUrl";
|
|
17
19
|
const MAP_OR_FEATURE_SERVER_URL_REGEX = /\/(map|feature)server/i;
|
|
18
20
|
/**
|
|
19
21
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/urls/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/urls/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAE1C,MAAM,+BAA+B,GAAG,wBAAwB,CAAC;AAEjE;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,GAAW,EAAE,EAAE;IACrD,OAAO,+BAA+B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACnD,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,GAAW,EAAE,EAAE;IACnD,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACzD,MAAM,YAAY,GAAG,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;IACvC,OAAO,YAAY,IAAI,GAAG,UAAU,CAAC,YAAY,CAAC,UAAU,CAAC;AAC/D,CAAC,CAAC"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { __awaiter, __generator } from "tslib";
|
|
2
|
-
import { getSelf } from "@esri/arcgis-rest-portal";
|
|
3
1
|
import { getProp, getWithDefault } from ".";
|
|
4
2
|
/**
|
|
5
3
|
* Hash of Hub API end points so updates
|
|
@@ -11,116 +9,37 @@ var hubApiEndpoints = {
|
|
|
11
9
|
discussions: "/api/discussions/v1",
|
|
12
10
|
};
|
|
13
11
|
/**
|
|
14
|
-
*
|
|
12
|
+
* Abstraction that holds a `UserSession`, along with
|
|
13
|
+
* getters to streamline access to various platform
|
|
14
|
+
* urls, and common constructs like `IRequestOptions`,
|
|
15
|
+
* `IUserRequestOptions` etc.
|
|
15
16
|
*
|
|
16
|
-
*
|
|
17
|
-
* the `portal/self` and `user/self` responses to
|
|
18
|
-
* provide a central lookup of platform information.
|
|
17
|
+
* Instances are intended to be immutable, but this is not directly enforced.
|
|
19
18
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* `ArcGISContext` is used in conjuction with the `arcgis-app-identity`
|
|
23
|
-
* component to orchestrate oAuth.
|
|
19
|
+
* In most circumstances, this class should be created by
|
|
20
|
+
* the ArcGISContextManager class.
|
|
24
21
|
*/
|
|
25
22
|
var ArcGISContext = /** @class */ (function () {
|
|
26
23
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
24
|
+
* Create a new instance of `ArcGISContext`.
|
|
25
|
+
*
|
|
29
26
|
* @param opts
|
|
30
27
|
*/
|
|
31
28
|
function ArcGISContext(opts) {
|
|
32
29
|
this._portalUrl = "https://www.arcgis.com";
|
|
33
|
-
this.
|
|
34
|
-
|
|
35
|
-
this.
|
|
36
|
-
if (opts.debug) {
|
|
37
|
-
this._debug = opts.debug;
|
|
38
|
-
}
|
|
39
|
-
this.log("ArcGISContext:ctor: Creating " + this.id);
|
|
30
|
+
this.id = opts.id;
|
|
31
|
+
this._portalUrl = opts.portalUrl;
|
|
32
|
+
this._hubUrl = opts.hubUrl;
|
|
40
33
|
if (opts.authentication) {
|
|
41
34
|
this._authentication = opts.authentication;
|
|
42
|
-
this._portalUrl = this._authentication.portal.replace("/sharing/rest", "");
|
|
43
|
-
this._hubUrl = getHubApiFromPortalUrl(this._portalUrl);
|
|
44
35
|
}
|
|
45
|
-
|
|
46
|
-
this.
|
|
47
|
-
this._hubUrl = getHubApiFromPortalUrl(this._portalUrl);
|
|
36
|
+
if (opts.portalSelf) {
|
|
37
|
+
this._portalSelf = opts.portalSelf;
|
|
48
38
|
}
|
|
49
|
-
|
|
50
|
-
this.
|
|
39
|
+
if (opts.currentUser) {
|
|
40
|
+
this._currentUser = opts.currentUser;
|
|
51
41
|
}
|
|
52
42
|
}
|
|
53
|
-
/**
|
|
54
|
-
* Static async Factory
|
|
55
|
-
* @param opts
|
|
56
|
-
* @returns
|
|
57
|
-
*/
|
|
58
|
-
ArcGISContext.create = function (opts) {
|
|
59
|
-
if (opts === void 0) { opts = {}; }
|
|
60
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
61
|
-
var ctx;
|
|
62
|
-
return __generator(this, function (_a) {
|
|
63
|
-
switch (_a.label) {
|
|
64
|
-
case 0:
|
|
65
|
-
ctx = new ArcGISContext(opts);
|
|
66
|
-
return [4 /*yield*/, ctx.initialize()];
|
|
67
|
-
case 1:
|
|
68
|
-
_a.sent();
|
|
69
|
-
return [2 /*return*/, ctx];
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
/**
|
|
75
|
-
* If we have a UserSession, fetch portal/self and
|
|
76
|
-
* store that along with current user
|
|
77
|
-
*/
|
|
78
|
-
ArcGISContext.prototype.initialize = function () {
|
|
79
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
80
|
-
var ps;
|
|
81
|
-
return __generator(this, function (_a) {
|
|
82
|
-
switch (_a.label) {
|
|
83
|
-
case 0:
|
|
84
|
-
if (!this._authentication) return [3 /*break*/, 2];
|
|
85
|
-
this.log("ArcGISContext-" + this.id + ": Initializing");
|
|
86
|
-
return [4 /*yield*/, getSelf({ authentication: this._authentication })];
|
|
87
|
-
case 1:
|
|
88
|
-
ps = _a.sent();
|
|
89
|
-
this._portalSelf = ps;
|
|
90
|
-
this._currentUser = ps.user;
|
|
91
|
-
_a.label = 2;
|
|
92
|
-
case 2: return [2 /*return*/];
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
// Set authentication after the instance is up and running
|
|
98
|
-
ArcGISContext.prototype.setAuthentication = function (auth) {
|
|
99
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
100
|
-
return __generator(this, function (_a) {
|
|
101
|
-
switch (_a.label) {
|
|
102
|
-
case 0:
|
|
103
|
-
this._authentication = auth;
|
|
104
|
-
this._portalUrl = auth.portal.replace("/sharing/rest", "");
|
|
105
|
-
return [4 /*yield*/, this.initialize()];
|
|
106
|
-
case 1:
|
|
107
|
-
_a.sent();
|
|
108
|
-
return [2 /*return*/];
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
};
|
|
113
|
-
/**
|
|
114
|
-
* @internal
|
|
115
|
-
* Log debugging messages to the console
|
|
116
|
-
* @param message
|
|
117
|
-
*/
|
|
118
|
-
ArcGISContext.prototype.log = function (message) {
|
|
119
|
-
if (this._debug) {
|
|
120
|
-
// tslint:disable-next-line:no-console
|
|
121
|
-
console.info(message);
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
43
|
Object.defineProperty(ArcGISContext.prototype, "session", {
|
|
125
44
|
/**
|
|
126
45
|
* Return the UserSession if authenticated
|
|
@@ -189,28 +108,27 @@ var ArcGISContext = /** @class */ (function () {
|
|
|
189
108
|
*/
|
|
190
109
|
get: function () {
|
|
191
110
|
// We may add more logic around what is returned in some corner cases
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
111
|
+
if (this.isAuthenticated) {
|
|
112
|
+
return {
|
|
113
|
+
authentication: this.session,
|
|
114
|
+
isPortal: this.isPortal,
|
|
115
|
+
portalSelf: this.portal,
|
|
116
|
+
hubApiUrl: this.hubUrl,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
198
119
|
},
|
|
199
120
|
enumerable: false,
|
|
200
121
|
configurable: true
|
|
201
122
|
});
|
|
202
123
|
Object.defineProperty(ArcGISContext.prototype, "portalUrl", {
|
|
203
|
-
// ==============================
|
|
204
|
-
// Getters / Computed Properties
|
|
205
|
-
// ==============================
|
|
206
124
|
/**
|
|
207
|
-
* Return the portal url.
|
|
125
|
+
* Return the portal url i.e. https://www.arcgis.com
|
|
208
126
|
*
|
|
209
127
|
* If authenticated @ ArcGIS Online, it will return
|
|
210
128
|
* the https://org.env.arcgis.com
|
|
211
129
|
*
|
|
212
130
|
* If authenticated @ ArcGIS Enterprise, it will return
|
|
213
|
-
* https://portalHostname
|
|
131
|
+
* https://{portalHostname}/{webadaptor}
|
|
214
132
|
*/
|
|
215
133
|
get: function () {
|
|
216
134
|
if (this.isAuthenticated) {
|
|
@@ -230,7 +148,7 @@ var ArcGISContext = /** @class */ (function () {
|
|
|
230
148
|
});
|
|
231
149
|
Object.defineProperty(ArcGISContext.prototype, "sharingApiUrl", {
|
|
232
150
|
/**
|
|
233
|
-
* Returns the url to the sharing api
|
|
151
|
+
* Returns the url to the sharing api composed from portalUrl
|
|
234
152
|
* i.e. https://myorg.maps.arcgis.com/sharing/rest
|
|
235
153
|
*/
|
|
236
154
|
get: function () {
|
|
@@ -240,6 +158,11 @@ var ArcGISContext = /** @class */ (function () {
|
|
|
240
158
|
configurable: true
|
|
241
159
|
});
|
|
242
160
|
Object.defineProperty(ArcGISContext.prototype, "hubUrl", {
|
|
161
|
+
/**
|
|
162
|
+
* Returns the Hub url, based on the portalUrl
|
|
163
|
+
*
|
|
164
|
+
* For ArcGIS Enterprise this will return `undefined`
|
|
165
|
+
*/
|
|
243
166
|
get: function () {
|
|
244
167
|
return this._hubUrl;
|
|
245
168
|
},
|
|
@@ -260,9 +183,9 @@ var ArcGISContext = /** @class */ (function () {
|
|
|
260
183
|
configurable: true
|
|
261
184
|
});
|
|
262
185
|
Object.defineProperty(ArcGISContext.prototype, "discussionsServiceUrl", {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
186
|
+
/**
|
|
187
|
+
* Returns the discussions API URL
|
|
188
|
+
*/
|
|
266
189
|
get: function () {
|
|
267
190
|
if (this._hubUrl) {
|
|
268
191
|
return "" + this._hubUrl + hubApiEndpoints.discussions;
|
|
@@ -272,7 +195,9 @@ var ArcGISContext = /** @class */ (function () {
|
|
|
272
195
|
configurable: true
|
|
273
196
|
});
|
|
274
197
|
Object.defineProperty(ArcGISContext.prototype, "hubSearchServiceUrl", {
|
|
275
|
-
|
|
198
|
+
/**
|
|
199
|
+
* Returns the Hub Search API URL
|
|
200
|
+
*/
|
|
276
201
|
get: function () {
|
|
277
202
|
if (this._hubUrl) {
|
|
278
203
|
return "" + this._hubUrl + hubApiEndpoints.search;
|
|
@@ -282,7 +207,9 @@ var ArcGISContext = /** @class */ (function () {
|
|
|
282
207
|
configurable: true
|
|
283
208
|
});
|
|
284
209
|
Object.defineProperty(ArcGISContext.prototype, "domainServiceUrl", {
|
|
285
|
-
|
|
210
|
+
/**
|
|
211
|
+
* Returns Hub Domain Service URL
|
|
212
|
+
*/
|
|
286
213
|
get: function () {
|
|
287
214
|
if (this._hubUrl) {
|
|
288
215
|
return "" + this._hubUrl + hubApiEndpoints.domains;
|
|
@@ -292,8 +219,11 @@ var ArcGISContext = /** @class */ (function () {
|
|
|
292
219
|
configurable: true
|
|
293
220
|
});
|
|
294
221
|
Object.defineProperty(ArcGISContext.prototype, "eventsConfig", {
|
|
295
|
-
|
|
296
|
-
|
|
222
|
+
/**
|
|
223
|
+
* Returns the Events configuration object from portal/self
|
|
224
|
+
*
|
|
225
|
+
* `{serviceId: '3ef..', publicViewId: 'bc3...'}`
|
|
226
|
+
*/
|
|
297
227
|
get: function () {
|
|
298
228
|
if (this._portalSelf) {
|
|
299
229
|
return getProp(this._portalSelf, "portalProperties.hub.settings.events");
|
|
@@ -316,7 +246,7 @@ var ArcGISContext = /** @class */ (function () {
|
|
|
316
246
|
});
|
|
317
247
|
Object.defineProperty(ArcGISContext.prototype, "communityOrgId", {
|
|
318
248
|
/**
|
|
319
|
-
* Return Hub Community Org Id, if defined
|
|
249
|
+
* Return the Hub Community Org Id, if defined
|
|
320
250
|
*/
|
|
321
251
|
get: function () {
|
|
322
252
|
if (this._portalSelf) {
|
|
@@ -327,6 +257,11 @@ var ArcGISContext = /** @class */ (function () {
|
|
|
327
257
|
configurable: true
|
|
328
258
|
});
|
|
329
259
|
Object.defineProperty(ArcGISContext.prototype, "communityOrgHostname", {
|
|
260
|
+
/**
|
|
261
|
+
* Returns the Hub Community Org Hostname, if defined
|
|
262
|
+
*
|
|
263
|
+
* i.e. c-org.maps.arcgis.com
|
|
264
|
+
*/
|
|
330
265
|
get: function () {
|
|
331
266
|
if (this._portalSelf) {
|
|
332
267
|
return getProp(this._portalSelf, "portalProperties.hub.settings.communityOrg.portalHostname");
|
|
@@ -336,6 +271,11 @@ var ArcGISContext = /** @class */ (function () {
|
|
|
336
271
|
configurable: true
|
|
337
272
|
});
|
|
338
273
|
Object.defineProperty(ArcGISContext.prototype, "communityOrgUrl", {
|
|
274
|
+
/**
|
|
275
|
+
* Returns the Hub Community Org url
|
|
276
|
+
*
|
|
277
|
+
* i.e. https://c-org.maps.arcgis.com
|
|
278
|
+
*/
|
|
339
279
|
get: function () {
|
|
340
280
|
if (this.communityOrgHostname) {
|
|
341
281
|
return "https://" + this.communityOrgHostname;
|
|
@@ -345,8 +285,9 @@ var ArcGISContext = /** @class */ (function () {
|
|
|
345
285
|
configurable: true
|
|
346
286
|
});
|
|
347
287
|
Object.defineProperty(ArcGISContext.prototype, "helperServices", {
|
|
348
|
-
|
|
349
|
-
|
|
288
|
+
/**
|
|
289
|
+
* Returns the hash of helper services from portal self
|
|
290
|
+
*/
|
|
350
291
|
get: function () {
|
|
351
292
|
if (this._portalSelf) {
|
|
352
293
|
return this._portalSelf.helperServices;
|
|
@@ -356,6 +297,9 @@ var ArcGISContext = /** @class */ (function () {
|
|
|
356
297
|
configurable: true
|
|
357
298
|
});
|
|
358
299
|
Object.defineProperty(ArcGISContext.prototype, "currentUser", {
|
|
300
|
+
/**
|
|
301
|
+
* Returns the current user as IUser
|
|
302
|
+
*/
|
|
359
303
|
get: function () {
|
|
360
304
|
return this._currentUser;
|
|
361
305
|
},
|
|
@@ -363,6 +307,9 @@ var ArcGISContext = /** @class */ (function () {
|
|
|
363
307
|
configurable: true
|
|
364
308
|
});
|
|
365
309
|
Object.defineProperty(ArcGISContext.prototype, "portal", {
|
|
310
|
+
/**
|
|
311
|
+
* Returns the portal object as IPortal
|
|
312
|
+
*/
|
|
366
313
|
get: function () {
|
|
367
314
|
return this._portalSelf;
|
|
368
315
|
},
|
|
@@ -372,24 +319,4 @@ var ArcGISContext = /** @class */ (function () {
|
|
|
372
319
|
return ArcGISContext;
|
|
373
320
|
}());
|
|
374
321
|
export { ArcGISContext };
|
|
375
|
-
/**
|
|
376
|
-
* Cross-walk from a portalUrl to the corresponding Hub.
|
|
377
|
-
*
|
|
378
|
-
* If the passed url is not recognized, then this will return `undefined`
|
|
379
|
-
* @param portalUrl
|
|
380
|
-
* @returns
|
|
381
|
-
*/
|
|
382
|
-
function getHubApiFromPortalUrl(portalUrl) {
|
|
383
|
-
var result;
|
|
384
|
-
if (portalUrl.match(/(qaext|\.mapsqa)\.arcgis.com/)) {
|
|
385
|
-
result = "https://hubqa.arcgis.com";
|
|
386
|
-
}
|
|
387
|
-
else if (portalUrl.match(/(devext|\.mapsdevext)\.arcgis.com/)) {
|
|
388
|
-
result = "https://hubdev.arcgis.com";
|
|
389
|
-
}
|
|
390
|
-
else if (portalUrl.match(/(www|\.maps)\.arcgis.com/)) {
|
|
391
|
-
result = "https://hub.arcgis.com";
|
|
392
|
-
}
|
|
393
|
-
return result;
|
|
394
|
-
}
|
|
395
322
|
//# sourceMappingURL=ArcGISContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArcGISContext.js","sourceRoot":"","sources":["../../src/ArcGISContext.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ArcGISContext.js","sourceRoot":"","sources":["../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