@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
|
@@ -17,13 +17,12 @@ async function _searchContent(filter, options) {
|
|
|
17
17
|
// API
|
|
18
18
|
const api = _1.expandApi(options.api || "arcgis");
|
|
19
19
|
let searchPromise;
|
|
20
|
-
// map over the apis, depending on the type we issue the queries
|
|
21
|
-
// const searchPromises = apis.map((api) => {
|
|
22
20
|
// Portal Search
|
|
23
21
|
if (api.type === "arcgis") {
|
|
24
22
|
// serialize for portal
|
|
25
23
|
const so = content_utils_1.serializeContentFilterForPortal(expanded);
|
|
26
|
-
//
|
|
24
|
+
// if we have auth, pass it forward
|
|
25
|
+
// otherwise set the portal property
|
|
27
26
|
if (options.authentication) {
|
|
28
27
|
so.authentication = options.authentication;
|
|
29
28
|
}
|
|
@@ -36,7 +35,6 @@ async function _searchContent(filter, options) {
|
|
|
36
35
|
so.countSize = 200;
|
|
37
36
|
}
|
|
38
37
|
// copy over various options
|
|
39
|
-
// TODO: Dry this up - typscript makes this... inconvenient
|
|
40
38
|
if (options.num) {
|
|
41
39
|
so.num = options.num;
|
|
42
40
|
}
|
|
@@ -64,8 +62,6 @@ async function _searchContent(filter, options) {
|
|
|
64
62
|
},
|
|
65
63
|
});
|
|
66
64
|
}
|
|
67
|
-
// });
|
|
68
|
-
// return for results
|
|
69
65
|
return searchPromise;
|
|
70
66
|
}
|
|
71
67
|
exports._searchContent = _searchContent;
|
|
@@ -78,12 +74,27 @@ exports._searchContent = _searchContent;
|
|
|
78
74
|
* @returns
|
|
79
75
|
*/
|
|
80
76
|
function searchPortal(searchOptions) {
|
|
77
|
+
var _a;
|
|
78
|
+
const portalUrl = ((_a = searchOptions.authentication) === null || _a === void 0 ? void 0 : _a.portal) || searchOptions.portal;
|
|
79
|
+
let token;
|
|
80
|
+
if (searchOptions.authentication) {
|
|
81
|
+
const us = searchOptions.authentication;
|
|
82
|
+
token = us.token;
|
|
83
|
+
}
|
|
84
|
+
const thumbnailify = (content) => {
|
|
85
|
+
content.thumbnailUrl = __1.getItemThumbnailUrl(content, portalUrl, token);
|
|
86
|
+
return content;
|
|
87
|
+
};
|
|
81
88
|
return arcgis_rest_portal_1.searchItems(searchOptions).then((resp) => {
|
|
82
89
|
const hasNext = resp.nextStart > -1;
|
|
90
|
+
// convert items to IHubContent's
|
|
83
91
|
let content = resp.results.map(__1.itemToContent);
|
|
92
|
+
// if we have a site, add those urls
|
|
84
93
|
if (searchOptions.site) {
|
|
85
94
|
content = content.map((entry) => __1.setContentSiteUrls(entry, searchOptions.site));
|
|
86
95
|
}
|
|
96
|
+
// add thumbnailUrl
|
|
97
|
+
content = content.map(thumbnailify);
|
|
87
98
|
// convert aggregations into facets
|
|
88
99
|
const facets = content_utils_1.convertPortalResponseToFacets(resp);
|
|
89
100
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_searchContent.js","sourceRoot":"","sources":["../../../src/search/_searchContent.ts"],"names":[],"mappings":";;;AAAA,mDAIyB;AAOzB,iEAAuE;AACvE,wBAA+C;AAC/C,
|
|
1
|
+
{"version":3,"file":"_searchContent.js","sourceRoot":"","sources":["../../../src/search/_searchContent.ts"],"names":[],"mappings":";;;AAAA,mDAIyB;AAOzB,iEAAuE;AACvE,wBAA+C;AAC/C,0BAOY;AAGZ;;;;GAIG;AACI,KAAK,UAAU,cAAc,CAClC,MAAyB,EACzB,OAA0B;;IAE1B,kDAAkD;IAClD,MAAM,QAAQ,GAAG,mCAAmB,CAAC,MAAM,CAAC,CAAC;IAE7C,MAAM;IACN,MAAM,GAAG,GAAG,YAAS,CAAC,OAAO,CAAC,GAAG,IAAI,QAAQ,CAAC,CAAC;IAE/C,IAAI,aAAa,CAAC;IAClB,gBAAgB;IAChB,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;QACzB,uBAAuB;QACvB,MAAM,EAAE,GAAG,+CAA+B,CAAC,QAAQ,CAAC,CAAC;QACrD,mCAAmC;QACnC,oCAAoC;QACpC,IAAI,OAAO,CAAC,cAAc,EAAE;YAC1B,EAAE,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;SAC5C;aAAM;YACL,EAAE,CAAC,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,eAAe,CAAC;SACvC;QACD,eAAe;QACf,UAAI,OAAO,CAAC,YAAY,0CAAE,MAAM,EAAE;YAChC,EAAE,CAAC,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,IAA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5C,OAAO,CAAC,YAAY,GAAG,uBAAmB,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QACtE,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;IAEF,OAAO,gCAAW,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;QAC9C,MAAM,OAAO,GAAY,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;QAC7C,iCAAiC;QACjC,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAa,CAAC,CAAC;QAC9C,oCAAoC;QACpC,IAAI,aAAa,CAAC,IAAI,EAAE;YACtB,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAC9B,sBAAkB,CAAC,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,CAC9C,CAAC;SACH;QACD,mBAAmB;QACnB,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QACpC,mCAAmC;QACnC,MAAM,MAAM,GAAG,6CAA6B,CAAC,IAAI,CAAC,CAAC;QACnD,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE,OAAO;YAChB,MAAM;YACN,OAAO;YACP,IAAI,EAAE,kBAAe,CACnB,aAAa,EACb,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,KAAK,EACV,YAAY,CACb;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -14,25 +14,20 @@ const __1 = require("..");
|
|
|
14
14
|
* @returns
|
|
15
15
|
*/
|
|
16
16
|
async function _searchGroups(filter, options) {
|
|
17
|
-
var _a;
|
|
18
17
|
// expand filter so we can serialize to either api
|
|
19
18
|
const expanded = group_utils_1.expandGroupFilter(filter);
|
|
20
19
|
// API
|
|
21
20
|
const api = _1.expandApi(options.api || "arcgis");
|
|
22
21
|
if (api.type === "arcgis") {
|
|
23
22
|
const so = group_utils_1.serializeGroupFilterForPortal(expanded);
|
|
24
|
-
let token = "";
|
|
25
23
|
// if we have auth, pass it forward
|
|
26
24
|
// otherwise set the portal property
|
|
27
25
|
if (options.authentication) {
|
|
28
26
|
so.authentication = options.authentication;
|
|
29
|
-
const us = options.authentication;
|
|
30
|
-
token = us.token;
|
|
31
27
|
}
|
|
32
28
|
else {
|
|
33
29
|
so.portal = `${api.url}/sharing/rest`;
|
|
34
30
|
}
|
|
35
|
-
// TODO: Dry this up - typscript makes this... inconvenient
|
|
36
31
|
if (options.num) {
|
|
37
32
|
so.num = options.num;
|
|
38
33
|
}
|
|
@@ -42,10 +37,6 @@ async function _searchGroups(filter, options) {
|
|
|
42
37
|
if (options.sortOrder) {
|
|
43
38
|
so.sortOrder = options.sortOrder;
|
|
44
39
|
}
|
|
45
|
-
let portalUrl = `${api.url}/sharing/rest`;
|
|
46
|
-
if ((_a = so.authentication) === null || _a === void 0 ? void 0 : _a.portal) {
|
|
47
|
-
portalUrl = so.authentication.portal;
|
|
48
|
-
}
|
|
49
40
|
if (options.site) {
|
|
50
41
|
so.site = __1.cloneObject(options.site);
|
|
51
42
|
}
|
|
@@ -67,8 +58,7 @@ function searchPortalGroups(searchOptions) {
|
|
|
67
58
|
group.siteTeamUrl = `${searchOptions.site.item.url}/teams/${group.id}/about`;
|
|
68
59
|
return group;
|
|
69
60
|
};
|
|
70
|
-
const portalUrl = ((_a = searchOptions.authentication) === null || _a === void 0 ? void 0 : _a.portal) ||
|
|
71
|
-
"https://www.arcgis.com/sharing/rest";
|
|
61
|
+
const portalUrl = ((_a = searchOptions.authentication) === null || _a === void 0 ? void 0 : _a.portal) || searchOptions.portal;
|
|
72
62
|
let token;
|
|
73
63
|
if (searchOptions.authentication) {
|
|
74
64
|
const us = searchOptions.authentication;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_searchGroups.js","sourceRoot":"","sources":["../../../src/search/_searchGroups.ts"],"names":[],"mappings":";;;AAEA,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O;YACL,OAAO;YACP,KAAK,EAAE,QAAQ,CAAC,KAAK;YACrB,OAAO;YACP,IAAI,EAAE,kBAAe,CACnB,aAAa,EACb,QAAQ,CAAC,SAAS,EAClB,QAAQ,CAAC,KAAK,EACd,kBAAkB,CACnB;SACyB,CAAC;IAC/B,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -366,7 +366,7 @@ exports.getNextFunction = getNextFunction;
|
|
|
366
366
|
* Construct a the full url to a group thumbnail
|
|
367
367
|
*
|
|
368
368
|
* - If the group has a thumbnail, construct the full url
|
|
369
|
-
* - If the group is not public, append on the token
|
|
369
|
+
* - If the group is not public, append on the token (if passed in)
|
|
370
370
|
* @param portalUrl
|
|
371
371
|
* @param group
|
|
372
372
|
* @param token
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Cross-walk from a portalUrl to the corresponding Hub API Url
|
|
4
|
+
*
|
|
5
|
+
* If the passed url is not recognized, then this will return `undefined`
|
|
6
|
+
* @param portalUrl
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.getHubApiFromPortalUrl = void 0;
|
|
11
|
+
function getHubApiFromPortalUrl(portalUrl) {
|
|
12
|
+
let result;
|
|
13
|
+
if (portalUrl.match(/(qaext|\.mapsqa)\.arcgis.com/)) {
|
|
14
|
+
result = "https://hubqa.arcgis.com";
|
|
15
|
+
}
|
|
16
|
+
else if (portalUrl.match(/(devext|\.mapsdevext)\.arcgis.com/)) {
|
|
17
|
+
result = "https://hubdev.arcgis.com";
|
|
18
|
+
}
|
|
19
|
+
else if (portalUrl.match(/(www|\.maps)\.arcgis.com/)) {
|
|
20
|
+
result = "https://hub.arcgis.com";
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
exports.getHubApiFromPortalUrl = getHubApiFromPortalUrl;
|
|
25
|
+
//# sourceMappingURL=getHubApiFromPortalUrl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getHubApiFromPortalUrl.js","sourceRoot":"","sources":["../../../src/urls/getHubApiFromPortalUrl.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,SAAgB,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;AAZD,wDAYC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPortalBaseFromOrgUrl = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Given an org url, get the portal base url
|
|
6
|
+
*
|
|
7
|
+
* i.e. https://myorg.maps.arcgis.com will return https://www.arcgis.com
|
|
8
|
+
*
|
|
9
|
+
* @param orgUrl
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
function getPortalBaseFromOrgUrl(orgUrl) {
|
|
13
|
+
let result = orgUrl;
|
|
14
|
+
if (orgUrl.match(/(qaext|\.mapsqa)\.arcgis.com/)) {
|
|
15
|
+
result = "https://qaext.arcgis.com";
|
|
16
|
+
}
|
|
17
|
+
else if (orgUrl.match(/(devext|\.mapsdevext)\.arcgis.com/)) {
|
|
18
|
+
result = "https://devext.arcgis.com";
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
/* istanbul ignore else */
|
|
22
|
+
if (orgUrl.match(/(www|\.maps)\.arcgis.com/)) {
|
|
23
|
+
result = "https://www.arcgis.com";
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
exports.getPortalBaseFromOrgUrl = getPortalBaseFromOrgUrl;
|
|
29
|
+
//# sourceMappingURL=getPortalBaseFromOrgUrl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPortalBaseFromOrgUrl.js","sourceRoot":"","sources":["../../../src/urls/getPortalBaseFromOrgUrl.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,SAAgB,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;AAfD,0DAeC"}
|
package/dist/node/urls/index.js
CHANGED
|
@@ -18,6 +18,8 @@ tslib_1.__exportStar(require("./get-item-home-url"), exports);
|
|
|
18
18
|
tslib_1.__exportStar(require("./get-item-api-url"), exports);
|
|
19
19
|
tslib_1.__exportStar(require("./get-item-data-url"), exports);
|
|
20
20
|
tslib_1.__exportStar(require("./convert-urls-to-anchor-tags"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./getHubApiFromPortalUrl"), exports);
|
|
22
|
+
tslib_1.__exportStar(require("./getPortalBaseFromOrgUrl"), exports);
|
|
21
23
|
const MAP_OR_FEATURE_SERVER_URL_REGEX = /\/(map|feature)server/i;
|
|
22
24
|
/**
|
|
23
25
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/urls/index.ts"],"names":[],"mappings":";;;;AAAA,kCAAqC;AACrC,sDAA4B;AAC5B,qEAA2C;AAC3C,+DAAqC;AACrC,2DAAiC;AACjC,2DAAiC;AACjC,6DAAmC;AACnC,2DAAiC;AACjC,qEAA2C;AAC3C,0DAAgC;AAChC,wEAA8C;AAC9C,oEAA0C;AAC1C,8DAAoC;AACpC,6DAAmC;AACnC,8DAAoC;AACpC,wEAA8C;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/urls/index.ts"],"names":[],"mappings":";;;;AAAA,kCAAqC;AACrC,sDAA4B;AAC5B,qEAA2C;AAC3C,+DAAqC;AACrC,2DAAiC;AACjC,2DAAiC;AACjC,6DAAmC;AACnC,2DAAiC;AACjC,qEAA2C;AAC3C,0DAAgC;AAChC,wEAA8C;AAC9C,oEAA0C;AAC1C,8DAAoC;AACpC,6DAAmC;AACnC,8DAAoC;AACpC,wEAA8C;AAC9C,mEAAyC;AACzC,oEAA0C;AAE1C,MAAM,+BAA+B,GAAG,wBAAwB,CAAC;AAEjE;;;;GAIG;AACU,QAAA,uBAAuB,GAAG,CAAC,GAAW,EAAE,EAAE;IACrD,OAAO,+BAA+B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACnD,CAAC,CAAC;AAEF;;;;;GAKG;AACU,QAAA,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,iBAAU,CAAC,YAAY,CAAC,UAAU,CAAC;AAC/D,CAAC,CAAC"}
|
|
@@ -1,50 +1,188 @@
|
|
|
1
|
-
import { IPortal } from "@esri/arcgis-rest-portal";
|
|
2
1
|
import { IUser, IUserRequestOptions, UserSession } from "@esri/arcgis-rest-auth";
|
|
3
|
-
import {
|
|
2
|
+
import { IPortal } from "@esri/arcgis-rest-portal";
|
|
4
3
|
import { IRequestOptions } from "@esri/arcgis-rest-request";
|
|
4
|
+
import { IHubRequestOptions } from ".";
|
|
5
|
+
/**
|
|
6
|
+
* Defines the properties of the ArcGISContext.
|
|
7
|
+
* Typically components or functions will get an instance
|
|
8
|
+
* of `ArcGISContext` from `ArcGISContetManager`.
|
|
9
|
+
*
|
|
10
|
+
* `ArcGISContext` implements this interface, and uses
|
|
11
|
+
* getters to simplify the derivation of various complex properties.
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
export interface IArcGISContext {
|
|
15
|
+
/**
|
|
16
|
+
* Unique id from the ArcGISContextManager that created
|
|
17
|
+
* this instance. Primarily useful for debugging possible
|
|
18
|
+
* race-conditions that can result in multiple ArcGISContextManager
|
|
19
|
+
* instances being created.
|
|
20
|
+
*/
|
|
21
|
+
id: number;
|
|
22
|
+
/**
|
|
23
|
+
* Return the UserSession if authenticated
|
|
24
|
+
*/
|
|
25
|
+
session: UserSession;
|
|
26
|
+
/**
|
|
27
|
+
* Return boolean indicating if authenticatio is present
|
|
28
|
+
*/
|
|
29
|
+
isAuthenticated: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Return `IUserRequestOptions`, which is used for REST-JS
|
|
32
|
+
* functions which require authentication information.
|
|
33
|
+
*
|
|
34
|
+
* If context is not authenticated, this function will return `undefined`
|
|
35
|
+
*/
|
|
36
|
+
userRequestOptions: IUserRequestOptions;
|
|
37
|
+
/**
|
|
38
|
+
* Return `IRequestOptions`, which is used by REST-JS functions
|
|
39
|
+
* which *may* use authentication information if provided.
|
|
40
|
+
*
|
|
41
|
+
* If context is not authenticated, this function just returns
|
|
42
|
+
* the `portal` property, which informs REST-JS what Sharing API
|
|
43
|
+
* instance to use (i.e. AGO, Enterprise etc)
|
|
44
|
+
*/
|
|
45
|
+
requestOptions: IRequestOptions;
|
|
46
|
+
/**
|
|
47
|
+
* Return a `IHubRequestOptions` object
|
|
48
|
+
*
|
|
49
|
+
* If context is not authenticated, this function will return `undefined`
|
|
50
|
+
*/
|
|
51
|
+
hubRequestOptions: IHubRequestOptions;
|
|
52
|
+
/**
|
|
53
|
+
* Return the portal url.
|
|
54
|
+
*
|
|
55
|
+
* If authenticated @ ArcGIS Online, it will return
|
|
56
|
+
* the https://org.env.arcgis.com
|
|
57
|
+
*
|
|
58
|
+
* If authenticated @ ArcGIS Enterprise, it will return
|
|
59
|
+
* https://{portalHostname}/{webadaptor}
|
|
60
|
+
*/
|
|
61
|
+
portalUrl: string;
|
|
62
|
+
/**
|
|
63
|
+
* Returns the url to the sharing api composed from portalUrl
|
|
64
|
+
* i.e. https://myorg.maps.arcgis.com/sharing/rest
|
|
65
|
+
*/
|
|
66
|
+
sharingApiUrl: string;
|
|
67
|
+
/**
|
|
68
|
+
* Returns the Hub url, based on the portalUrl
|
|
69
|
+
*
|
|
70
|
+
* For ArcGIS Enterprise this will return `undefined`
|
|
71
|
+
*/
|
|
72
|
+
hubUrl: string;
|
|
73
|
+
/**
|
|
74
|
+
* Returns boolean indicating if the backing system
|
|
75
|
+
* is ArcGIS Enterprise (formerly ArcGIS Portal) or not
|
|
76
|
+
*/
|
|
77
|
+
isPortal: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Returns the discussions API URL
|
|
80
|
+
*/
|
|
81
|
+
discussionsServiceUrl: string;
|
|
82
|
+
/**
|
|
83
|
+
* Returns the Hub Search API URL
|
|
84
|
+
*/
|
|
85
|
+
hubSearchServiceUrl: string;
|
|
86
|
+
/**
|
|
87
|
+
* Returns Hub Domain Service URL
|
|
88
|
+
*/
|
|
89
|
+
domainServiceUrl: string;
|
|
90
|
+
/**
|
|
91
|
+
* Returns the Events configuration object from portal/self
|
|
92
|
+
*
|
|
93
|
+
* `{serviceId: '3ef..', publicViewId: 'bc3...'}`
|
|
94
|
+
*/
|
|
95
|
+
eventsConfig: any;
|
|
96
|
+
/**
|
|
97
|
+
* Returns boolean indicating if the current user
|
|
98
|
+
* belongs to an organization that has licensed
|
|
99
|
+
* ArcGIS Hub
|
|
100
|
+
*/
|
|
101
|
+
hubEnabled: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Return Hub Community Org Id, if defined
|
|
104
|
+
*/
|
|
105
|
+
communityOrgId: string;
|
|
106
|
+
/**
|
|
107
|
+
* Returns the Community Org Hostname, if defined
|
|
108
|
+
*/
|
|
109
|
+
communityOrgHostname: string;
|
|
110
|
+
/**
|
|
111
|
+
* Returns the Hub Community Org url
|
|
112
|
+
*
|
|
113
|
+
* i.e. https://c-org.maps.arcgis.com
|
|
114
|
+
*/
|
|
115
|
+
communityOrgUrl: string;
|
|
116
|
+
/**
|
|
117
|
+
* Returns the hash of helper services from portal self
|
|
118
|
+
*/
|
|
119
|
+
helperServices: any;
|
|
120
|
+
/**
|
|
121
|
+
* Returns the current user
|
|
122
|
+
*/
|
|
123
|
+
currentUser: IUser;
|
|
124
|
+
/**
|
|
125
|
+
* Returns the portal object
|
|
126
|
+
*/
|
|
127
|
+
portal: IPortal;
|
|
128
|
+
}
|
|
5
129
|
/**
|
|
6
|
-
* Options
|
|
130
|
+
* Options for the ArcGISContext constructor
|
|
7
131
|
*/
|
|
8
132
|
export interface IArcGISContextOptions {
|
|
9
133
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
134
|
+
* Unique id from the ArcGISContextManager that created
|
|
135
|
+
* this instance. Primarily useful for debugging possible
|
|
136
|
+
* race-conditions that can result in multiple ArcGISContextManager
|
|
137
|
+
* instances being created.
|
|
138
|
+
*/
|
|
139
|
+
id: number;
|
|
140
|
+
/**
|
|
141
|
+
* Portal base url
|
|
142
|
+
* For ArcGIS Online - https://org.env.arcgis.com
|
|
143
|
+
* For ArcGIS Enterprise - https://{portalHostname}/{webadaptor}
|
|
144
|
+
*/
|
|
145
|
+
portalUrl: string;
|
|
146
|
+
/**
|
|
147
|
+
* Hub Url that corresponds to the portal url is appropritate
|
|
148
|
+
*/
|
|
149
|
+
hubUrl: string;
|
|
150
|
+
/**
|
|
151
|
+
* The current UserSession
|
|
12
152
|
*/
|
|
13
153
|
authentication?: UserSession;
|
|
14
154
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* Defaults to `https://www.arcgis.com`
|
|
18
|
-
* For ArcGIS Enterprise, you must include the webadaptor name.
|
|
19
|
-
* i.e. https://gis.mytown.gov/portal
|
|
155
|
+
* If the user is authenticated, the portal should be passed in
|
|
156
|
+
* so various getters can work as expected.
|
|
20
157
|
*
|
|
21
|
-
*
|
|
22
|
-
* used instead of this property.
|
|
158
|
+
* ArcGISContextManager handles this internally
|
|
23
159
|
*/
|
|
24
|
-
|
|
160
|
+
portalSelf?: IPortal;
|
|
25
161
|
/**
|
|
26
|
-
* If
|
|
27
|
-
*
|
|
162
|
+
* If the user is authenticated, the user should be passed in
|
|
163
|
+
* so various getters can work as expected.
|
|
164
|
+
*
|
|
165
|
+
* ArcGISContextManager handles this internally
|
|
28
166
|
*/
|
|
29
|
-
|
|
167
|
+
currentUser?: IUser;
|
|
30
168
|
}
|
|
31
169
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* provide a central lookup of platform information.
|
|
170
|
+
* Abstraction that holds a `UserSession`, along with
|
|
171
|
+
* getters to streamline access to various platform
|
|
172
|
+
* urls, and common constructs like `IRequestOptions`,
|
|
173
|
+
* `IUserRequestOptions` etc.
|
|
37
174
|
*
|
|
38
|
-
*
|
|
175
|
+
* Instances are intended to be immutable, but this is not directly enforced.
|
|
39
176
|
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
177
|
+
* In most circumstances, this class should be created by
|
|
178
|
+
* the ArcGISContextManager class.
|
|
42
179
|
*/
|
|
43
|
-
export declare class ArcGISContext {
|
|
180
|
+
export declare class ArcGISContext implements IArcGISContext {
|
|
44
181
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
182
|
+
* Unique id from the ArcGISContextManager that created
|
|
183
|
+
* this instance. Primarily useful for debugging possible
|
|
184
|
+
* race-conditions that can result in multiple ArcGISContextManager
|
|
185
|
+
* instances being created.
|
|
48
186
|
*/
|
|
49
187
|
id: number;
|
|
50
188
|
private _authentication;
|
|
@@ -52,31 +190,12 @@ export declare class ArcGISContext {
|
|
|
52
190
|
private _hubUrl;
|
|
53
191
|
private _portalSelf;
|
|
54
192
|
private _currentUser;
|
|
55
|
-
private _debug;
|
|
56
|
-
/**
|
|
57
|
-
* Private constructor. Use `ArcGISContext.create(...)` to
|
|
58
|
-
* instantiate an instance
|
|
59
|
-
* @param opts
|
|
60
|
-
*/
|
|
61
|
-
private constructor();
|
|
62
193
|
/**
|
|
63
|
-
*
|
|
194
|
+
* Create a new instance of `ArcGISContext`.
|
|
195
|
+
*
|
|
64
196
|
* @param opts
|
|
65
|
-
* @returns
|
|
66
|
-
*/
|
|
67
|
-
static create(opts?: IArcGISContextOptions): Promise<ArcGISContext>;
|
|
68
|
-
/**
|
|
69
|
-
* If we have a UserSession, fetch portal/self and
|
|
70
|
-
* store that along with current user
|
|
71
|
-
*/
|
|
72
|
-
initialize(): Promise<void>;
|
|
73
|
-
setAuthentication(auth: UserSession): Promise<void>;
|
|
74
|
-
/**
|
|
75
|
-
* @internal
|
|
76
|
-
* Log debugging messages to the console
|
|
77
|
-
* @param message
|
|
78
197
|
*/
|
|
79
|
-
|
|
198
|
+
constructor(opts: IArcGISContextOptions);
|
|
80
199
|
/**
|
|
81
200
|
* Return the UserSession if authenticated
|
|
82
201
|
*/
|
|
@@ -106,29 +225,48 @@ export declare class ArcGISContext {
|
|
|
106
225
|
*/
|
|
107
226
|
get hubRequestOptions(): IHubRequestOptions;
|
|
108
227
|
/**
|
|
109
|
-
* Return the portal url.
|
|
228
|
+
* Return the portal url i.e. https://www.arcgis.com
|
|
110
229
|
*
|
|
111
230
|
* If authenticated @ ArcGIS Online, it will return
|
|
112
231
|
* the https://org.env.arcgis.com
|
|
113
232
|
*
|
|
114
233
|
* If authenticated @ ArcGIS Enterprise, it will return
|
|
115
|
-
* https://portalHostname
|
|
234
|
+
* https://{portalHostname}/{webadaptor}
|
|
116
235
|
*/
|
|
117
236
|
get portalUrl(): string;
|
|
118
237
|
/**
|
|
119
|
-
* Returns the url to the sharing api
|
|
238
|
+
* Returns the url to the sharing api composed from portalUrl
|
|
120
239
|
* i.e. https://myorg.maps.arcgis.com/sharing/rest
|
|
121
240
|
*/
|
|
122
241
|
get sharingApiUrl(): string;
|
|
242
|
+
/**
|
|
243
|
+
* Returns the Hub url, based on the portalUrl
|
|
244
|
+
*
|
|
245
|
+
* For ArcGIS Enterprise this will return `undefined`
|
|
246
|
+
*/
|
|
123
247
|
get hubUrl(): string;
|
|
124
248
|
/**
|
|
125
249
|
* Returns boolean indicating if the backing system
|
|
126
250
|
* is ArcGIS Enterprise (formerly ArcGIS Portal) or not
|
|
127
251
|
*/
|
|
128
252
|
get isPortal(): boolean;
|
|
253
|
+
/**
|
|
254
|
+
* Returns the discussions API URL
|
|
255
|
+
*/
|
|
129
256
|
get discussionsServiceUrl(): string;
|
|
257
|
+
/**
|
|
258
|
+
* Returns the Hub Search API URL
|
|
259
|
+
*/
|
|
130
260
|
get hubSearchServiceUrl(): string;
|
|
261
|
+
/**
|
|
262
|
+
* Returns Hub Domain Service URL
|
|
263
|
+
*/
|
|
131
264
|
get domainServiceUrl(): string;
|
|
265
|
+
/**
|
|
266
|
+
* Returns the Events configuration object from portal/self
|
|
267
|
+
*
|
|
268
|
+
* `{serviceId: '3ef..', publicViewId: 'bc3...'}`
|
|
269
|
+
*/
|
|
132
270
|
get eventsConfig(): any;
|
|
133
271
|
/**
|
|
134
272
|
* Returns boolean indicating if the current user
|
|
@@ -137,12 +275,31 @@ export declare class ArcGISContext {
|
|
|
137
275
|
*/
|
|
138
276
|
get hubEnabled(): boolean;
|
|
139
277
|
/**
|
|
140
|
-
* Return Hub Community Org Id, if defined
|
|
278
|
+
* Return the Hub Community Org Id, if defined
|
|
141
279
|
*/
|
|
142
280
|
get communityOrgId(): string;
|
|
281
|
+
/**
|
|
282
|
+
* Returns the Hub Community Org Hostname, if defined
|
|
283
|
+
*
|
|
284
|
+
* i.e. c-org.maps.arcgis.com
|
|
285
|
+
*/
|
|
143
286
|
get communityOrgHostname(): string;
|
|
287
|
+
/**
|
|
288
|
+
* Returns the Hub Community Org url
|
|
289
|
+
*
|
|
290
|
+
* i.e. https://c-org.maps.arcgis.com
|
|
291
|
+
*/
|
|
144
292
|
get communityOrgUrl(): string;
|
|
293
|
+
/**
|
|
294
|
+
* Returns the hash of helper services from portal self
|
|
295
|
+
*/
|
|
145
296
|
get helperServices(): any;
|
|
297
|
+
/**
|
|
298
|
+
* Returns the current user as IUser
|
|
299
|
+
*/
|
|
146
300
|
get currentUser(): IUser;
|
|
301
|
+
/**
|
|
302
|
+
* Returns the portal object as IPortal
|
|
303
|
+
*/
|
|
147
304
|
get portal(): IPortal;
|
|
148
305
|
}
|