@esri/hub-common 9.13.2 → 9.16.0
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 +215 -158
- package/dist/es2017/ArcGISContext.js.map +1 -1
- package/dist/es2017/ArcGISContextManager.js +171 -0
- package/dist/es2017/ArcGISContextManager.js.map +1 -0
- package/dist/es2017/Hub.js +70 -0
- package/dist/es2017/Hub.js.map +1 -0
- package/dist/es2017/HubError.js +34 -0
- package/dist/es2017/HubError.js.map +1 -0
- package/dist/es2017/collections.js +23 -0
- package/dist/es2017/collections.js.map +1 -1
- package/dist/es2017/content/_internal.js +12 -0
- package/dist/es2017/content/_internal.js.map +1 -1
- package/dist/es2017/content/index.js +42 -18
- package/dist/es2017/content/index.js.map +1 -1
- package/dist/es2017/core/helpers/PropertyMapper.js +95 -0
- package/dist/es2017/core/helpers/PropertyMapper.js.map +1 -0
- package/dist/es2017/core/index.js +3 -0
- package/dist/es2017/core/index.js.map +1 -0
- package/dist/es2017/core/traits/WithBannerImage.js +1 -0
- package/dist/es2017/core/traits/WithBannerImage.js.map +1 -0
- package/dist/es2017/core/traits/WithLayout.js +1 -0
- package/dist/es2017/core/traits/WithLayout.js.map +1 -0
- package/dist/es2017/core/traits/WithSlug.js +1 -0
- package/dist/es2017/core/traits/WithSlug.js.map +1 -0
- package/dist/es2017/core/traits/index.js +4 -0
- package/dist/es2017/core/traits/index.js.map +1 -0
- package/dist/es2017/core/types/IContentEnrichments.js +1 -0
- package/dist/es2017/core/types/IContentEnrichments.js.map +1 -0
- package/dist/es2017/core/types/IHubContent.js +1 -0
- package/dist/es2017/core/types/IHubContent.js.map +1 -0
- package/dist/es2017/core/types/IHubEntityBase.js +1 -0
- package/dist/es2017/core/types/IHubEntityBase.js.map +1 -0
- package/dist/es2017/core/types/IHubEntityManager.js +1 -0
- package/dist/es2017/core/types/IHubEntityManager.js.map +1 -0
- package/dist/es2017/core/types/IHubEvent.js +1 -0
- package/dist/es2017/core/types/IHubEvent.js.map +1 -0
- package/dist/es2017/core/types/IHubImage.js +1 -0
- package/dist/es2017/core/types/IHubImage.js.map +1 -0
- package/dist/es2017/core/types/IHubInitiative.js +1 -0
- package/dist/es2017/core/types/IHubInitiative.js.map +1 -0
- package/dist/es2017/core/types/IHubItemEntity.js +1 -0
- package/dist/es2017/core/types/IHubItemEntity.js.map +1 -0
- package/dist/es2017/core/types/IHubLayout.js +1 -0
- package/dist/es2017/core/types/IHubLayout.js.map +1 -0
- package/dist/es2017/core/types/IHubPage.js +1 -0
- package/dist/es2017/core/types/IHubPage.js.map +1 -0
- package/dist/es2017/core/types/IHubProject.js +1 -0
- package/dist/es2017/core/types/IHubProject.js.map +1 -0
- package/dist/es2017/core/types/IHubSite.js +1 -0
- package/dist/es2017/core/types/IHubSite.js.map +1 -0
- package/dist/es2017/core/types/IHubTimeline.js +1 -0
- package/dist/es2017/core/types/IHubTimeline.js.map +1 -0
- package/dist/es2017/core/types/IItemEnrichments.js +1 -0
- package/dist/es2017/core/types/IItemEnrichments.js.map +1 -0
- package/dist/es2017/core/types/index.js +15 -0
- package/dist/es2017/core/types/index.js.map +1 -0
- package/dist/es2017/index.js +11 -5
- package/dist/es2017/index.js.map +1 -1
- package/dist/es2017/items/fail-safe-update.js +2 -2
- package/dist/es2017/items/fail-safe-update.js.map +1 -1
- package/dist/es2017/items/get-model-from-options.js +2 -2
- package/dist/es2017/items/get-model-from-options.js.map +1 -1
- package/dist/es2017/items/index.js +2 -3
- package/dist/es2017/items/index.js.map +1 -1
- package/dist/es2017/items/slugs.js +92 -0
- package/dist/es2017/items/slugs.js.map +1 -0
- package/dist/es2017/models/index.js +98 -0
- package/dist/es2017/models/index.js.map +1 -0
- package/dist/es2017/{items/serialize-model.js → models/serializeModel.js} +1 -1
- package/dist/es2017/models/serializeModel.js.map +1 -0
- package/dist/es2017/projects/HubProjectManager.js +115 -0
- package/dist/es2017/projects/HubProjectManager.js.map +1 -0
- package/dist/es2017/projects/HubProjects.js +194 -0
- package/dist/es2017/projects/HubProjects.js.map +1 -0
- package/dist/es2017/projects/index.js +3 -0
- package/dist/es2017/projects/index.js.map +1 -0
- 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/es2017/utils/dasherize.js +25 -0
- package/dist/es2017/utils/dasherize.js.map +1 -0
- package/dist/es2017/utils/index.js +1 -0
- package/dist/es2017/utils/index.js.map +1 -1
- package/dist/esm/ArcGISContext.js +299 -200
- package/dist/esm/ArcGISContext.js.map +1 -1
- package/dist/esm/ArcGISContextManager.js +215 -0
- package/dist/esm/ArcGISContextManager.js.map +1 -0
- package/dist/esm/Hub.js +89 -0
- package/dist/esm/Hub.js.map +1 -0
- package/dist/esm/HubError.js +40 -0
- package/dist/esm/HubError.js.map +1 -0
- package/dist/esm/collections.js +23 -0
- package/dist/esm/collections.js.map +1 -1
- package/dist/esm/content/_internal.js +14 -0
- package/dist/esm/content/_internal.js.map +1 -1
- package/dist/esm/content/index.js +42 -18
- package/dist/esm/content/index.js.map +1 -1
- package/dist/esm/core/helpers/PropertyMapper.js +97 -0
- package/dist/esm/core/helpers/PropertyMapper.js.map +1 -0
- package/dist/esm/core/index.js +3 -0
- package/dist/esm/core/index.js.map +1 -0
- package/dist/esm/core/traits/WithBannerImage.js +1 -0
- package/dist/esm/core/traits/WithBannerImage.js.map +1 -0
- package/dist/esm/core/traits/WithLayout.js +1 -0
- package/dist/esm/core/traits/WithLayout.js.map +1 -0
- package/dist/esm/core/traits/WithSlug.js +1 -0
- package/dist/esm/core/traits/WithSlug.js.map +1 -0
- package/dist/esm/core/traits/index.js +4 -0
- package/dist/esm/core/traits/index.js.map +1 -0
- package/dist/esm/core/types/IContentEnrichments.js +1 -0
- package/dist/esm/core/types/IContentEnrichments.js.map +1 -0
- package/dist/esm/core/types/IHubContent.js +1 -0
- package/dist/esm/core/types/IHubContent.js.map +1 -0
- package/dist/esm/core/types/IHubEntityBase.js +1 -0
- package/dist/esm/core/types/IHubEntityBase.js.map +1 -0
- package/dist/esm/core/types/IHubEntityManager.js +1 -0
- package/dist/esm/core/types/IHubEntityManager.js.map +1 -0
- package/dist/esm/core/types/IHubEvent.js +1 -0
- package/dist/esm/core/types/IHubEvent.js.map +1 -0
- package/dist/esm/core/types/IHubImage.js +1 -0
- package/dist/esm/core/types/IHubImage.js.map +1 -0
- package/dist/esm/core/types/IHubInitiative.js +1 -0
- package/dist/esm/core/types/IHubInitiative.js.map +1 -0
- package/dist/esm/core/types/IHubItemEntity.js +1 -0
- package/dist/esm/core/types/IHubItemEntity.js.map +1 -0
- package/dist/esm/core/types/IHubLayout.js +1 -0
- package/dist/esm/core/types/IHubLayout.js.map +1 -0
- package/dist/esm/core/types/IHubPage.js +1 -0
- package/dist/esm/core/types/IHubPage.js.map +1 -0
- package/dist/esm/core/types/IHubProject.js +1 -0
- package/dist/esm/core/types/IHubProject.js.map +1 -0
- package/dist/esm/core/types/IHubSite.js +1 -0
- package/dist/esm/core/types/IHubSite.js.map +1 -0
- package/dist/esm/core/types/IHubTimeline.js +1 -0
- package/dist/esm/core/types/IHubTimeline.js.map +1 -0
- package/dist/esm/core/types/IItemEnrichments.js +1 -0
- package/dist/esm/core/types/IItemEnrichments.js.map +1 -0
- package/dist/esm/core/types/index.js +15 -0
- package/dist/esm/core/types/index.js.map +1 -0
- package/dist/esm/index.js +11 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/items/fail-safe-update.js +2 -2
- package/dist/esm/items/fail-safe-update.js.map +1 -1
- package/dist/esm/items/get-model-from-options.js +2 -2
- package/dist/esm/items/get-model-from-options.js.map +1 -1
- package/dist/esm/items/index.js +2 -3
- package/dist/esm/items/index.js.map +1 -1
- package/dist/esm/items/slugs.js +93 -0
- package/dist/esm/items/slugs.js.map +1 -0
- package/dist/esm/models/index.js +99 -0
- package/dist/esm/models/index.js.map +1 -0
- package/dist/esm/{items/serialize-model.js → models/serializeModel.js} +1 -1
- package/dist/esm/models/serializeModel.js.map +1 -0
- package/dist/esm/projects/HubProjectManager.js +142 -0
- package/dist/esm/projects/HubProjectManager.js.map +1 -0
- package/dist/esm/projects/HubProjects.js +225 -0
- package/dist/esm/projects/HubProjects.js.map +1 -0
- package/dist/esm/projects/index.js +3 -0
- package/dist/esm/projects/index.js.map +1 -0
- 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/esm/utils/dasherize.js +25 -0
- package/dist/esm/utils/dasherize.js.map +1 -0
- package/dist/esm/utils/index.js +1 -0
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/node/ArcGISContext.js +215 -158
- package/dist/node/ArcGISContext.js.map +1 -1
- package/dist/node/ArcGISContextManager.js +175 -0
- package/dist/node/ArcGISContextManager.js.map +1 -0
- package/dist/node/Hub.js +74 -0
- package/dist/node/Hub.js.map +1 -0
- package/dist/node/HubError.js +37 -0
- package/dist/node/HubError.js.map +1 -0
- package/dist/node/collections.js +24 -1
- package/dist/node/collections.js.map +1 -1
- package/dist/node/content/_internal.js +13 -1
- package/dist/node/content/_internal.js.map +1 -1
- package/dist/node/content/index.js +42 -18
- package/dist/node/content/index.js.map +1 -1
- package/dist/node/core/helpers/PropertyMapper.js +101 -0
- package/dist/node/core/helpers/PropertyMapper.js.map +1 -0
- package/dist/node/core/index.js +6 -0
- package/dist/node/core/index.js.map +1 -0
- package/dist/node/core/traits/WithBannerImage.js +3 -0
- package/dist/node/core/traits/WithBannerImage.js.map +1 -0
- package/dist/node/core/traits/WithLayout.js +3 -0
- package/dist/node/core/traits/WithLayout.js.map +1 -0
- package/dist/node/core/traits/WithSlug.js +3 -0
- package/dist/node/core/traits/WithSlug.js.map +1 -0
- package/dist/node/core/traits/index.js +7 -0
- package/dist/node/core/traits/index.js.map +1 -0
- package/dist/node/core/types/IContentEnrichments.js +3 -0
- package/dist/node/core/types/IContentEnrichments.js.map +1 -0
- package/dist/node/core/types/IHubContent.js +3 -0
- package/dist/node/core/types/IHubContent.js.map +1 -0
- package/dist/node/core/types/IHubEntityBase.js +3 -0
- package/dist/node/core/types/IHubEntityBase.js.map +1 -0
- package/dist/node/core/types/IHubEntityManager.js +3 -0
- package/dist/node/core/types/IHubEntityManager.js.map +1 -0
- package/dist/node/core/types/IHubEvent.js +3 -0
- package/dist/node/core/types/IHubEvent.js.map +1 -0
- package/dist/node/core/types/IHubImage.js +3 -0
- package/dist/node/core/types/IHubImage.js.map +1 -0
- package/dist/node/core/types/IHubInitiative.js +3 -0
- package/dist/node/core/types/IHubInitiative.js.map +1 -0
- package/dist/node/core/types/IHubItemEntity.js +3 -0
- package/dist/node/core/types/IHubItemEntity.js.map +1 -0
- package/dist/node/core/types/IHubLayout.js +3 -0
- package/dist/node/core/types/IHubLayout.js.map +1 -0
- package/dist/node/core/types/IHubPage.js +3 -0
- package/dist/node/core/types/IHubPage.js.map +1 -0
- package/dist/node/core/types/IHubProject.js +3 -0
- package/dist/node/core/types/IHubProject.js.map +1 -0
- package/dist/node/core/types/IHubSite.js +3 -0
- package/dist/node/core/types/IHubSite.js.map +1 -0
- package/dist/node/core/types/IHubTimeline.js +3 -0
- package/dist/node/core/types/IHubTimeline.js.map +1 -0
- package/dist/node/core/types/IItemEnrichments.js +3 -0
- package/dist/node/core/types/IItemEnrichments.js.map +1 -0
- package/dist/node/core/types/index.js +18 -0
- package/dist/node/core/types/index.js.map +1 -0
- package/dist/node/index.js +12 -5
- package/dist/node/index.js.map +1 -1
- package/dist/node/items/fail-safe-update.js +3 -3
- package/dist/node/items/fail-safe-update.js.map +1 -1
- package/dist/node/items/get-model-from-options.js +3 -3
- package/dist/node/items/get-model-from-options.js.map +1 -1
- package/dist/node/items/index.js +2 -3
- package/dist/node/items/index.js.map +1 -1
- package/dist/node/items/slugs.js +99 -0
- package/dist/node/items/slugs.js.map +1 -0
- package/dist/node/models/index.js +106 -0
- package/dist/node/models/index.js.map +1 -0
- package/dist/node/{items/serialize-model.js → models/serializeModel.js} +1 -1
- package/dist/node/models/serializeModel.js.map +1 -0
- package/dist/node/projects/HubProjectManager.js +119 -0
- package/dist/node/projects/HubProjectManager.js.map +1 -0
- package/dist/node/projects/HubProjects.js +201 -0
- package/dist/node/projects/HubProjects.js.map +1 -0
- package/dist/node/projects/index.js +6 -0
- package/dist/node/projects/index.js.map +1 -0
- 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/node/utils/dasherize.js +29 -0
- package/dist/node/utils/dasherize.js.map +1 -0
- package/dist/node/utils/index.js +1 -0
- package/dist/node/utils/index.js.map +1 -1
- package/dist/types/ArcGISContext.d.ts +276 -66
- package/dist/types/ArcGISContextManager.d.ts +130 -0
- package/dist/types/Hub.d.ts +72 -0
- package/dist/types/HubError.d.ts +17 -0
- package/dist/types/collections.d.ts +12 -0
- package/dist/types/content/_internal.d.ts +66 -38
- package/dist/types/content/index.d.ts +17 -8
- package/dist/types/core/helpers/PropertyMapper.d.ts +69 -0
- package/dist/types/core/index.d.ts +2 -0
- package/dist/types/core/traits/WithBannerImage.d.ts +30 -0
- package/dist/types/core/traits/WithLayout.d.ts +54 -0
- package/dist/types/core/traits/WithSlug.d.ts +15 -0
- package/dist/types/core/traits/index.d.ts +3 -0
- package/dist/types/core/types/IContentEnrichments.d.ts +10 -0
- package/dist/types/core/types/IHubContent.d.ts +77 -0
- package/dist/types/core/types/IHubEntityBase.d.ts +41 -0
- package/dist/types/core/types/IHubEntityManager.d.ts +33 -0
- package/dist/types/core/types/IHubEvent.d.ts +10 -0
- package/dist/types/core/types/IHubImage.d.ts +25 -0
- package/dist/types/core/types/IHubInitiative.d.ts +8 -0
- package/dist/types/core/types/IHubItemEntity.d.ts +42 -0
- package/dist/types/core/types/IHubLayout.d.ts +20 -0
- package/dist/types/core/types/IHubPage.d.ts +8 -0
- package/dist/types/core/types/IHubProject.d.ts +15 -0
- package/dist/types/core/types/IHubSite.d.ts +11 -0
- package/dist/types/core/types/IHubTimeline.d.ts +41 -0
- package/dist/types/core/types/IItemEnrichments.d.ts +23 -0
- package/dist/types/core/types/index.d.ts +14 -0
- package/dist/types/index.d.ts +11 -5
- package/dist/types/items/index.d.ts +2 -3
- package/dist/types/items/slugs.d.ts +43 -0
- package/dist/types/models/index.d.ts +42 -0
- package/dist/types/{items/serialize-model.d.ts → models/serializeModel.d.ts} +0 -0
- package/dist/types/projects/HubProjectManager.d.ts +81 -0
- package/dist/types/projects/HubProjects.d.ts +31 -0
- package/dist/types/projects/index.d.ts +2 -0
- package/dist/types/search/utils.d.ts +1 -1
- package/dist/types/types.d.ts +2 -92
- 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/types/utils/dasherize.d.ts +17 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/umd/common.umd.js +2119 -1152
- 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
- package/dist/es2017/ArcGISContextState.js +0 -203
- package/dist/es2017/ArcGISContextState.js.map +0 -1
- package/dist/es2017/items/get-model.js +0 -19
- package/dist/es2017/items/get-model.js.map +0 -1
- package/dist/es2017/items/serialize-model.js.map +0 -1
- package/dist/esm/ArcGISContextState.js +0 -285
- package/dist/esm/ArcGISContextState.js.map +0 -1
- package/dist/esm/items/get-model.js +0 -19
- package/dist/esm/items/get-model.js.map +0 -1
- package/dist/esm/items/serialize-model.js.map +0 -1
- package/dist/node/ArcGISContextState.js +0 -207
- package/dist/node/ArcGISContextState.js.map +0 -1
- package/dist/node/items/get-model.js +0 -23
- package/dist/node/items/get-model.js.map +0 -1
- package/dist/node/items/serialize-model.js.map +0 -1
- package/dist/types/ArcGISContextState.d.ts +0 -129
- package/dist/types/items/get-model.d.ts +0 -8
|
@@ -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"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dasherize = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Dasherize a string
|
|
6
|
+
*
|
|
7
|
+
* ```javascript
|
|
8
|
+
* import { dasherize } from '@esri/hub-common';
|
|
9
|
+
* dasherize('innerHTML'); // 'inner-html'
|
|
10
|
+
* dasherize('action_name'); // 'action-name'
|
|
11
|
+
* dasherize('css-class-name'); // 'css-class-name'
|
|
12
|
+
* dasherize('my favorite items'); // 'my-favorite-items'
|
|
13
|
+
* dasherize('privateDocs/ownerInvoice'; // 'private-docs/owner-invoice'
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* Extracted and modified from Ember.js source code - MIT license
|
|
17
|
+
* @param value
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
function dasherize(value) {
|
|
21
|
+
const DECAMELIZE_REGEXP = /([a-z\d])([A-Z])/g;
|
|
22
|
+
const DASHERIZE_REGEXP = /[ _]/g;
|
|
23
|
+
return value
|
|
24
|
+
.replace(DECAMELIZE_REGEXP, "$1_$2")
|
|
25
|
+
.toLowerCase()
|
|
26
|
+
.replace(DASHERIZE_REGEXP, "-");
|
|
27
|
+
}
|
|
28
|
+
exports.dasherize = dasherize;
|
|
29
|
+
//# sourceMappingURL=dasherize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dasherize.js","sourceRoot":"","sources":["../../../src/utils/dasherize.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,SAAS,CAAC,KAAa;IACrC,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;IAC9C,MAAM,gBAAgB,GAAG,OAAO,CAAC;IACjC,OAAO,KAAK;SACT,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC;SACnC,WAAW,EAAE;SACb,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC;AACpC,CAAC;AAPD,8BAOC"}
|
package/dist/node/utils/index.js
CHANGED
|
@@ -19,4 +19,5 @@ tslib_1.__exportStar(require("./logger"), exports);
|
|
|
19
19
|
tslib_1.__exportStar(require("./is-update-group"), exports);
|
|
20
20
|
tslib_1.__exportStar(require("./revertable-tasks"), exports);
|
|
21
21
|
tslib_1.__exportStar(require("./sessionLocalStorage"), exports);
|
|
22
|
+
tslib_1.__exportStar(require("./dasherize"), exports);
|
|
22
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,kDAAwB;AACxB,iEAAuC;AACvC,sEAA4C;AAC5C,sDAA4B;AAC5B,mEAAyC;AACzC,4DAAkC;AAClC,kEAAwC;AACxC,qDAA2B;AAC3B,oDAA0B;AAC1B,mDAAyB;AACzB,oDAA0B;AAC1B,4DAAkC;AAClC,2DAAiC;AACjC,6DAAmC;AACnC,mDAAyB;AACzB,4DAAkC;AAClC,6DAAmC;AACnC,gEAAsC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,kDAAwB;AACxB,iEAAuC;AACvC,sEAA4C;AAC5C,sDAA4B;AAC5B,mEAAyC;AACzC,4DAAkC;AAClC,kEAAwC;AACxC,qDAA2B;AAC3B,oDAA0B;AAC1B,mDAAyB;AACzB,oDAA0B;AAC1B,4DAAkC;AAClC,2DAAiC;AACjC,6DAAmC;AACnC,mDAAyB;AACzB,4DAAkC;AAClC,6DAAmC;AACnC,gEAAsC;AACtC,sDAA4B"}
|
|
@@ -1,110 +1,320 @@
|
|
|
1
|
+
import { IUser, IUserRequestOptions, UserSession } from "@esri/arcgis-rest-auth";
|
|
1
2
|
import { IPortal } from "@esri/arcgis-rest-portal";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
3
|
+
import { IRequestOptions } from "@esri/arcgis-rest-request";
|
|
4
|
+
import { IHubRequestOptions } from ".";
|
|
4
5
|
/**
|
|
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
|
+
*
|
|
6
13
|
*/
|
|
7
|
-
export interface
|
|
14
|
+
export interface IArcGISContext {
|
|
8
15
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
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.
|
|
11
20
|
*/
|
|
12
|
-
|
|
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;
|
|
13
67
|
/**
|
|
14
|
-
*
|
|
15
|
-
* Do not include `/sharing/rest`
|
|
16
|
-
* Defaults to `https://www.arcgis.com`
|
|
17
|
-
* For ArcGIS Enterprise, you must include the webadaptor name.
|
|
18
|
-
* i.e. https://gis.mytown.gov/portal
|
|
68
|
+
* Returns the Hub url, based on the portalUrl
|
|
19
69
|
*
|
|
20
|
-
*
|
|
21
|
-
|
|
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
|
|
22
80
|
*/
|
|
23
|
-
|
|
81
|
+
discussionsServiceUrl: string;
|
|
24
82
|
/**
|
|
25
|
-
*
|
|
26
|
-
* with the UserSession, it will be fetched
|
|
83
|
+
* Returns the Hub Search API URL
|
|
27
84
|
*/
|
|
28
|
-
|
|
85
|
+
hubSearchServiceUrl: string;
|
|
29
86
|
/**
|
|
30
|
-
*
|
|
31
|
-
|
|
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
|
+
/**
|
|
129
|
+
* Additional app-specific context
|
|
130
|
+
*/
|
|
131
|
+
properties: Record<string, any>;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Options for the ArcGISContext constructor
|
|
135
|
+
*/
|
|
136
|
+
export interface IArcGISContextOptions {
|
|
137
|
+
/**
|
|
138
|
+
* Unique id from the ArcGISContextManager that created
|
|
139
|
+
* this instance. Primarily useful for debugging possible
|
|
140
|
+
* race-conditions that can result in multiple ArcGISContextManager
|
|
141
|
+
* instances being created.
|
|
142
|
+
*/
|
|
143
|
+
id: number;
|
|
144
|
+
/**
|
|
145
|
+
* Portal base url
|
|
146
|
+
* For ArcGIS Online - https://org.env.arcgis.com
|
|
147
|
+
* For ArcGIS Enterprise - https://{portalHostname}/{webadaptor}
|
|
148
|
+
*/
|
|
149
|
+
portalUrl: string;
|
|
150
|
+
/**
|
|
151
|
+
* Hub Url that corresponds to the portal url is appropritate
|
|
152
|
+
*/
|
|
153
|
+
hubUrl?: string;
|
|
154
|
+
/**
|
|
155
|
+
* The current UserSession
|
|
156
|
+
*/
|
|
157
|
+
authentication?: UserSession;
|
|
158
|
+
/**
|
|
159
|
+
* If the user is authenticated, the portal should be passed in
|
|
160
|
+
* so various getters can work as expected.
|
|
161
|
+
*
|
|
162
|
+
* ArcGISContextManager handles this internally
|
|
163
|
+
*/
|
|
164
|
+
portalSelf?: IPortal;
|
|
165
|
+
/**
|
|
166
|
+
* If the user is authenticated, the user should be passed in
|
|
167
|
+
* so various getters can work as expected.
|
|
168
|
+
*
|
|
169
|
+
* ArcGISContextManager handles this internally
|
|
32
170
|
*/
|
|
33
171
|
currentUser?: IUser;
|
|
34
172
|
/**
|
|
35
|
-
*
|
|
36
|
-
* Defaults to false.
|
|
173
|
+
* Optional hash of additional context
|
|
37
174
|
*/
|
|
38
|
-
|
|
175
|
+
properties?: Record<string, any>;
|
|
39
176
|
}
|
|
40
177
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* provide a central lookup of platform information.
|
|
178
|
+
* Abstraction that holds a `UserSession`, along with
|
|
179
|
+
* getters to streamline access to various platform
|
|
180
|
+
* urls, and common constructs like `IRequestOptions`,
|
|
181
|
+
* `IUserRequestOptions` etc.
|
|
46
182
|
*
|
|
47
|
-
*
|
|
183
|
+
* Instances are intended to be immutable, but this is not directly enforced.
|
|
48
184
|
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
185
|
+
* In most circumstances, this class should be created by
|
|
186
|
+
* the ArcGISContextManager class.
|
|
51
187
|
*/
|
|
52
|
-
export declare class ArcGISContext {
|
|
188
|
+
export declare class ArcGISContext implements IArcGISContext {
|
|
53
189
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
190
|
+
* Unique id from the ArcGISContextManager that created
|
|
191
|
+
* this instance. Primarily useful for debugging possible
|
|
192
|
+
* race-conditions that can result in multiple ArcGISContextManager
|
|
193
|
+
* instances being created.
|
|
57
194
|
*/
|
|
58
195
|
id: number;
|
|
59
|
-
private _state;
|
|
60
196
|
private _authentication;
|
|
61
197
|
private _portalUrl;
|
|
62
198
|
private _hubUrl;
|
|
63
199
|
private _portalSelf;
|
|
64
200
|
private _currentUser;
|
|
65
|
-
private
|
|
201
|
+
private _properties;
|
|
66
202
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
203
|
+
* Create a new instance of `ArcGISContext`.
|
|
204
|
+
*
|
|
69
205
|
* @param opts
|
|
70
206
|
*/
|
|
71
|
-
|
|
207
|
+
constructor(opts: IArcGISContextOptions);
|
|
72
208
|
/**
|
|
73
|
-
*
|
|
74
|
-
|
|
75
|
-
|
|
209
|
+
* Return the UserSession if authenticated
|
|
210
|
+
*/
|
|
211
|
+
get session(): UserSession;
|
|
212
|
+
/**
|
|
213
|
+
* Return boolean indicating if authenticatio is present
|
|
214
|
+
*/
|
|
215
|
+
get isAuthenticated(): boolean;
|
|
216
|
+
/**
|
|
217
|
+
* Return `IUserRequestOptions`, which is used for REST-JS
|
|
218
|
+
* functions which require authentication information.
|
|
219
|
+
*
|
|
220
|
+
* If context is not authenticated, this function will throw
|
|
221
|
+
*/
|
|
222
|
+
get userRequestOptions(): IUserRequestOptions;
|
|
223
|
+
/**
|
|
224
|
+
* Return `IRequestOptions`, which is used by REST-JS functions
|
|
225
|
+
* which *may* use authentication information if provided.
|
|
226
|
+
*
|
|
227
|
+
* If context is not authenticated, this function just returns
|
|
228
|
+
* the `portal` property, which informs REST-JS what Sharing API
|
|
229
|
+
* instance to use (i.e. AGO, Enterprise etc)
|
|
230
|
+
*/
|
|
231
|
+
get requestOptions(): IRequestOptions;
|
|
232
|
+
/**
|
|
233
|
+
* Return a `IHubRequestOptions` object
|
|
234
|
+
*/
|
|
235
|
+
get hubRequestOptions(): IHubRequestOptions;
|
|
236
|
+
/**
|
|
237
|
+
* Return the portal url i.e. https://www.arcgis.com
|
|
238
|
+
*
|
|
239
|
+
* If authenticated @ ArcGIS Online, it will return
|
|
240
|
+
* the https://org.env.arcgis.com
|
|
241
|
+
*
|
|
242
|
+
* If authenticated @ ArcGIS Enterprise, it will return
|
|
243
|
+
* https://{portalHostname}/{webadaptor}
|
|
244
|
+
*/
|
|
245
|
+
get portalUrl(): string;
|
|
246
|
+
/**
|
|
247
|
+
* Returns the url to the sharing api composed from portalUrl
|
|
248
|
+
* i.e. https://myorg.maps.arcgis.com/sharing/rest
|
|
249
|
+
*/
|
|
250
|
+
get sharingApiUrl(): string;
|
|
251
|
+
/**
|
|
252
|
+
* Returns the Hub url, based on the portalUrl
|
|
253
|
+
*
|
|
254
|
+
* For ArcGIS Enterprise this will return `undefined`
|
|
255
|
+
*/
|
|
256
|
+
get hubUrl(): string;
|
|
257
|
+
/**
|
|
258
|
+
* Returns boolean indicating if the backing system
|
|
259
|
+
* is ArcGIS Enterprise (formerly ArcGIS Portal) or not
|
|
260
|
+
*/
|
|
261
|
+
get isPortal(): boolean;
|
|
262
|
+
/**
|
|
263
|
+
* Returns the discussions API URL
|
|
264
|
+
*/
|
|
265
|
+
get discussionsServiceUrl(): string;
|
|
266
|
+
/**
|
|
267
|
+
* Returns the Hub Search API URL
|
|
76
268
|
*/
|
|
77
|
-
|
|
269
|
+
get hubSearchServiceUrl(): string;
|
|
78
270
|
/**
|
|
79
|
-
*
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
271
|
+
* Returns Hub Domain Service URL
|
|
272
|
+
*/
|
|
273
|
+
get domainServiceUrl(): string;
|
|
274
|
+
/**
|
|
275
|
+
* Returns the Events configuration object from portal/self
|
|
276
|
+
*
|
|
277
|
+
* `{serviceId: '3ef..', publicViewId: 'bc3...'}`
|
|
278
|
+
*/
|
|
279
|
+
get eventsConfig(): any;
|
|
280
|
+
/**
|
|
281
|
+
* Returns boolean indicating if the current user
|
|
282
|
+
* belongs to an organization that has licensed
|
|
283
|
+
* ArcGIS Hub
|
|
284
|
+
*/
|
|
285
|
+
get hubEnabled(): boolean;
|
|
286
|
+
/**
|
|
287
|
+
* Return the Hub Community Org Id, if defined
|
|
288
|
+
*/
|
|
289
|
+
get communityOrgId(): string;
|
|
290
|
+
/**
|
|
291
|
+
* Returns the Hub Community Org Hostname, if defined
|
|
292
|
+
*
|
|
293
|
+
* i.e. c-org.maps.arcgis.com
|
|
294
|
+
*/
|
|
295
|
+
get communityOrgHostname(): string;
|
|
296
|
+
/**
|
|
297
|
+
* Returns the Hub Community Org url
|
|
298
|
+
*
|
|
299
|
+
* i.e. https://c-org.maps.arcgis.com
|
|
83
300
|
*/
|
|
84
|
-
|
|
301
|
+
get communityOrgUrl(): string;
|
|
85
302
|
/**
|
|
86
|
-
*
|
|
87
|
-
* called when a user signs out of an application, but
|
|
88
|
-
* the application continues running
|
|
303
|
+
* Returns the hash of helper services from portal self
|
|
89
304
|
*/
|
|
90
|
-
|
|
305
|
+
get helperServices(): any;
|
|
91
306
|
/**
|
|
92
|
-
*
|
|
93
|
-
* When `.setAuthentication()` or `.clearAuthenentication()` are
|
|
94
|
-
* called, the state will be re-created. This is done so frameworks
|
|
95
|
-
* like React or Ember can detect changes.
|
|
307
|
+
* Returns the current user as IUser
|
|
96
308
|
*/
|
|
97
|
-
get
|
|
309
|
+
get currentUser(): IUser;
|
|
98
310
|
/**
|
|
99
|
-
*
|
|
100
|
-
* Log debugging messages to the console
|
|
101
|
-
* @param message
|
|
311
|
+
* Returns the portal object as IPortal
|
|
102
312
|
*/
|
|
103
|
-
|
|
313
|
+
get portal(): IPortal;
|
|
104
314
|
/**
|
|
105
|
-
*
|
|
106
|
-
*
|
|
315
|
+
* Return the properties hash that was passed in.
|
|
316
|
+
* Useful for app-specific context such as the active
|
|
317
|
+
* Site for ArcGIS Hub
|
|
107
318
|
*/
|
|
108
|
-
|
|
109
|
-
private get stateOpts();
|
|
319
|
+
get properties(): Record<string, any>;
|
|
110
320
|
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { IPortal } from "@esri/arcgis-rest-portal";
|
|
2
|
+
import { IUser, UserSession } from "@esri/arcgis-rest-auth";
|
|
3
|
+
import { IArcGISContext } from "./ArcGISContext";
|
|
4
|
+
import { Level } from ".";
|
|
5
|
+
/**
|
|
6
|
+
* Options that can be passed into `ArcGISContextManager.create`
|
|
7
|
+
*/
|
|
8
|
+
export interface IArcGISContextManagerOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Existing user session, which may be created from Identity Manager
|
|
11
|
+
* `const session = UserSession.fromCredential(idMgr.getCredential());`
|
|
12
|
+
*/
|
|
13
|
+
authentication?: UserSession;
|
|
14
|
+
/**
|
|
15
|
+
* ArcGIS Online or ArcGIS Enterprise portal url.
|
|
16
|
+
* Do not include `/sharing/rest`
|
|
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
|
|
20
|
+
*
|
|
21
|
+
* When Authentication is present, the UserSession.portal value is
|
|
22
|
+
* used instead of this property.
|
|
23
|
+
*/
|
|
24
|
+
portalUrl?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Portal self for the authenticated user. If not passed into `.create`
|
|
27
|
+
* with the UserSession, it will be fetched
|
|
28
|
+
*/
|
|
29
|
+
portal?: IPortal;
|
|
30
|
+
/**
|
|
31
|
+
* Current user as `IUser`. If not passed into `.create` with the UserSession
|
|
32
|
+
* it will be fetched.
|
|
33
|
+
*/
|
|
34
|
+
currentUser?: IUser;
|
|
35
|
+
/**
|
|
36
|
+
* Any additional properties to expose on the context. This allows
|
|
37
|
+
* an application to send additional context into the system.
|
|
38
|
+
* For example, in ArcGIS Hub, many times we want to pass in the
|
|
39
|
+
* active "Hub Site" as additional context, so we will send that in
|
|
40
|
+
* as a node on a properties object.
|
|
41
|
+
*/
|
|
42
|
+
properties?: Record<string, any>;
|
|
43
|
+
/**
|
|
44
|
+
* Logging level
|
|
45
|
+
* off > error > warn > info > debug > all
|
|
46
|
+
* defaults to 'error'
|
|
47
|
+
*/
|
|
48
|
+
logLevel?: Level;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The manager exposes context (`IArcGISContext`), which combines a `UserSession` with
|
|
52
|
+
* the `portal/self` and `user/self` responses to provide a central lookup for platform
|
|
53
|
+
* information, api urls, and other useful properties for developers such as IRequestOptions
|
|
54
|
+
* IUserRequestOptions, IHubRequestOptions etc.
|
|
55
|
+
*
|
|
56
|
+
* The context is exposed on gthe `.context` property, and as the authentication changes
|
|
57
|
+
* the `.context` is re-created. This is done to allow web frameworks to watch for
|
|
58
|
+
* changes on that single property, instead of having to leverage observers or events
|
|
59
|
+
* for change detection.
|
|
60
|
+
*
|
|
61
|
+
* Please see the [ArcGISContext Guide](/hub.js/guides/context) for additional information.
|
|
62
|
+
*
|
|
63
|
+
*/
|
|
64
|
+
export declare class ArcGISContextManager {
|
|
65
|
+
/**
|
|
66
|
+
* Random identifier useful for debugging issues
|
|
67
|
+
* where race-conditions can result in multiple
|
|
68
|
+
* contexts getting created
|
|
69
|
+
*/
|
|
70
|
+
id: number;
|
|
71
|
+
private _context;
|
|
72
|
+
private _authentication;
|
|
73
|
+
private _portalUrl;
|
|
74
|
+
private _properties;
|
|
75
|
+
private _hubUrl;
|
|
76
|
+
private _portalSelf;
|
|
77
|
+
private _currentUser;
|
|
78
|
+
private _logLevel;
|
|
79
|
+
/**
|
|
80
|
+
* Private constructor. Use `ArcGISContextManager.create(...)` to
|
|
81
|
+
* instantiate an instance
|
|
82
|
+
* @param opts
|
|
83
|
+
*/
|
|
84
|
+
private constructor();
|
|
85
|
+
/**
|
|
86
|
+
* Used to create a new instance of the ArcGISContext class.
|
|
87
|
+
*
|
|
88
|
+
* ```js
|
|
89
|
+
* const ctxMgr = await ArcGISContextManager.create();
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* @param opts
|
|
93
|
+
* @returns
|
|
94
|
+
*/
|
|
95
|
+
static create(opts?: IArcGISContextManagerOptions): Promise<ArcGISContextManager>;
|
|
96
|
+
/**
|
|
97
|
+
* Set the Authentication (UserSession) for the context.
|
|
98
|
+
* This should be called when a user signs into a running
|
|
99
|
+
* application.
|
|
100
|
+
* @param auth
|
|
101
|
+
*/
|
|
102
|
+
setAuthentication(auth: UserSession): Promise<void>;
|
|
103
|
+
/**
|
|
104
|
+
* Set the properties hash and re-create the context
|
|
105
|
+
* @param properties
|
|
106
|
+
*/
|
|
107
|
+
setProperties(properties: Record<string, any>): void;
|
|
108
|
+
/**
|
|
109
|
+
* Clear the Authentication (UserSession). This should be
|
|
110
|
+
* called when a user signs out of an application, but
|
|
111
|
+
* the application continues running
|
|
112
|
+
*/
|
|
113
|
+
clearAuthentication(): void;
|
|
114
|
+
/**
|
|
115
|
+
* Return a reference to the current state.
|
|
116
|
+
* When `.setAuthentication()` or `.clearAuthenentication()` are
|
|
117
|
+
* called, the state will be re-created. This is done so frameworks
|
|
118
|
+
* like React or Ember can detect changes.
|
|
119
|
+
*/
|
|
120
|
+
get context(): IArcGISContext;
|
|
121
|
+
/**
|
|
122
|
+
* If we have a UserSession, fetch portal/self and
|
|
123
|
+
* store that along with current user
|
|
124
|
+
*/
|
|
125
|
+
private initialize;
|
|
126
|
+
/**
|
|
127
|
+
* Getter to streamline the creation of updated Context instances
|
|
128
|
+
*/
|
|
129
|
+
private get contextOpts();
|
|
130
|
+
}
|