@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,215 @@
|
|
|
1
|
+
import { __awaiter, __generator } from "tslib";
|
|
2
|
+
import { getSelf, getUser } from "@esri/arcgis-rest-portal";
|
|
3
|
+
import { ArcGISContext, } from "./ArcGISContext";
|
|
4
|
+
import { cloneObject, Logger, Level } from ".";
|
|
5
|
+
import { getHubApiFromPortalUrl } from "./urls/getHubApiFromPortalUrl";
|
|
6
|
+
import { getPortalBaseFromOrgUrl } from "./urls/getPortalBaseFromOrgUrl";
|
|
7
|
+
/**
|
|
8
|
+
* The manager exposes context (`IArcGISContext`), which combines a `UserSession` with
|
|
9
|
+
* the `portal/self` and `user/self` responses to provide a central lookup for platform
|
|
10
|
+
* information, api urls, and other useful properties for developers such as IRequestOptions
|
|
11
|
+
* IUserRequestOptions, IHubRequestOptions etc.
|
|
12
|
+
*
|
|
13
|
+
* The context is exposed on gthe `.context` property, and as the authentication changes
|
|
14
|
+
* the `.context` is re-created. This is done to allow web frameworks to watch for
|
|
15
|
+
* changes on that single property, instead of having to leverage observers or events
|
|
16
|
+
* for change detection.
|
|
17
|
+
*
|
|
18
|
+
* Please see the [ArcGISContext Guide](/hub.js/guides/context) for additional information.
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
var ArcGISContextManager = /** @class */ (function () {
|
|
22
|
+
/**
|
|
23
|
+
* Private constructor. Use `ArcGISContextManager.create(...)` to
|
|
24
|
+
* instantiate an instance
|
|
25
|
+
* @param opts
|
|
26
|
+
*/
|
|
27
|
+
function ArcGISContextManager(opts) {
|
|
28
|
+
this._portalUrl = "https://www.arcgis.com";
|
|
29
|
+
this._logLevel = Level.error;
|
|
30
|
+
// Having a unique id makes debugging easier
|
|
31
|
+
this.id = new Date().getTime();
|
|
32
|
+
if (opts.logLevel) {
|
|
33
|
+
this._logLevel = opts.logLevel;
|
|
34
|
+
}
|
|
35
|
+
Logger.setLogLevel(this._logLevel);
|
|
36
|
+
Logger.debug("ArcGISContextManager:ctor: Creating " + this.id);
|
|
37
|
+
if (opts.properties) {
|
|
38
|
+
this._properties = opts.properties;
|
|
39
|
+
}
|
|
40
|
+
if (opts.authentication) {
|
|
41
|
+
this._authentication = opts.authentication;
|
|
42
|
+
this._portalUrl = this._authentication.portal.replace("/sharing/rest", "");
|
|
43
|
+
this._hubUrl = getHubApiFromPortalUrl(this._portalUrl);
|
|
44
|
+
}
|
|
45
|
+
else if (opts.portalUrl) {
|
|
46
|
+
this._portalUrl = opts.portalUrl;
|
|
47
|
+
this._hubUrl = getHubApiFromPortalUrl(this._portalUrl);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
this._hubUrl = getHubApiFromPortalUrl(this._portalUrl);
|
|
51
|
+
}
|
|
52
|
+
if (opts.portal) {
|
|
53
|
+
this._portalSelf = cloneObject(opts.portal);
|
|
54
|
+
}
|
|
55
|
+
if (opts.currentUser) {
|
|
56
|
+
this._currentUser = cloneObject(opts.currentUser);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Used to create a new instance of the ArcGISContext class.
|
|
61
|
+
*
|
|
62
|
+
* ```js
|
|
63
|
+
* const ctxMgr = await ArcGISContextManager.create();
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @param opts
|
|
67
|
+
* @returns
|
|
68
|
+
*/
|
|
69
|
+
ArcGISContextManager.create = function (opts) {
|
|
70
|
+
if (opts === void 0) { opts = {}; }
|
|
71
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
72
|
+
var ctx;
|
|
73
|
+
return __generator(this, function (_a) {
|
|
74
|
+
switch (_a.label) {
|
|
75
|
+
case 0:
|
|
76
|
+
ctx = new ArcGISContextManager(opts);
|
|
77
|
+
return [4 /*yield*/, ctx.initialize()];
|
|
78
|
+
case 1:
|
|
79
|
+
_a.sent();
|
|
80
|
+
return [2 /*return*/, ctx];
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Set the Authentication (UserSession) for the context.
|
|
87
|
+
* This should be called when a user signs into a running
|
|
88
|
+
* application.
|
|
89
|
+
* @param auth
|
|
90
|
+
*/
|
|
91
|
+
ArcGISContextManager.prototype.setAuthentication = function (auth) {
|
|
92
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
93
|
+
return __generator(this, function (_a) {
|
|
94
|
+
switch (_a.label) {
|
|
95
|
+
case 0:
|
|
96
|
+
this._authentication = auth;
|
|
97
|
+
this._portalUrl = auth.portal.replace("/sharing/rest", "");
|
|
98
|
+
return [4 /*yield*/, this.initialize()];
|
|
99
|
+
case 1:
|
|
100
|
+
_a.sent();
|
|
101
|
+
return [2 /*return*/];
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Set the properties hash and re-create the context
|
|
108
|
+
* @param properties
|
|
109
|
+
*/
|
|
110
|
+
ArcGISContextManager.prototype.setProperties = function (properties) {
|
|
111
|
+
this._properties = properties;
|
|
112
|
+
this._context = new ArcGISContext(this.contextOpts);
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Clear the Authentication (UserSession). This should be
|
|
116
|
+
* called when a user signs out of an application, but
|
|
117
|
+
* the application continues running
|
|
118
|
+
*/
|
|
119
|
+
ArcGISContextManager.prototype.clearAuthentication = function () {
|
|
120
|
+
// Reset the portalUrl from the org url to the base url
|
|
121
|
+
// for ArcGIS Enterprise, we just leave the _portalUrl as-is
|
|
122
|
+
if (!this._context.isPortal) {
|
|
123
|
+
this._portalUrl = getPortalBaseFromOrgUrl(this._portalUrl);
|
|
124
|
+
}
|
|
125
|
+
// Clear the auth, portalSelf and currentUser props
|
|
126
|
+
this._authentication = null;
|
|
127
|
+
this._portalSelf = null;
|
|
128
|
+
this._currentUser = null;
|
|
129
|
+
this._context = new ArcGISContext(this.contextOpts);
|
|
130
|
+
};
|
|
131
|
+
Object.defineProperty(ArcGISContextManager.prototype, "context", {
|
|
132
|
+
/**
|
|
133
|
+
* Return a reference to the current state.
|
|
134
|
+
* When `.setAuthentication()` or `.clearAuthenentication()` are
|
|
135
|
+
* called, the state will be re-created. This is done so frameworks
|
|
136
|
+
* like React or Ember can detect changes.
|
|
137
|
+
*/
|
|
138
|
+
get: function () {
|
|
139
|
+
return this._context;
|
|
140
|
+
},
|
|
141
|
+
enumerable: false,
|
|
142
|
+
configurable: true
|
|
143
|
+
});
|
|
144
|
+
/**
|
|
145
|
+
* If we have a UserSession, fetch portal/self and
|
|
146
|
+
* store that along with current user
|
|
147
|
+
*/
|
|
148
|
+
ArcGISContextManager.prototype.initialize = function () {
|
|
149
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
150
|
+
var username, requests, _a, portal, user, ex_1, msg;
|
|
151
|
+
return __generator(this, function (_b) {
|
|
152
|
+
switch (_b.label) {
|
|
153
|
+
case 0:
|
|
154
|
+
if (!(this._authentication && (!this._portalSelf || !this._currentUser))) return [3 /*break*/, 4];
|
|
155
|
+
Logger.debug("ArcGISContextManager-" + this.id + ": Initializing");
|
|
156
|
+
username = this._authentication.username;
|
|
157
|
+
requests = [
|
|
158
|
+
getSelf({ authentication: this._authentication }),
|
|
159
|
+
getUser({ username: username, authentication: this._authentication }),
|
|
160
|
+
];
|
|
161
|
+
_b.label = 1;
|
|
162
|
+
case 1:
|
|
163
|
+
_b.trys.push([1, 3, , 4]);
|
|
164
|
+
return [4 /*yield*/, Promise.all(requests)];
|
|
165
|
+
case 2:
|
|
166
|
+
_a = _b.sent(), portal = _a[0], user = _a[1];
|
|
167
|
+
this._portalSelf = portal;
|
|
168
|
+
this._currentUser = user;
|
|
169
|
+
Logger.debug("ArcGISContextManager-" + this.id + ": received portalSelf and currentUser");
|
|
170
|
+
return [3 /*break*/, 4];
|
|
171
|
+
case 3:
|
|
172
|
+
ex_1 = _b.sent();
|
|
173
|
+
msg = "ArcGISContextManager could not fetch portal & user for \"" + this._authentication.username + "\" using " + this._authentication.portal + ".";
|
|
174
|
+
Logger.error(msg);
|
|
175
|
+
// tslint:disable-next-line:no-console
|
|
176
|
+
console.error(msg);
|
|
177
|
+
throw ex_1;
|
|
178
|
+
case 4:
|
|
179
|
+
Logger.debug("ArcGISContextManager-" + this.id + ": updating context");
|
|
180
|
+
// update the context
|
|
181
|
+
this._context = new ArcGISContext(this.contextOpts);
|
|
182
|
+
return [2 /*return*/];
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
};
|
|
187
|
+
Object.defineProperty(ArcGISContextManager.prototype, "contextOpts", {
|
|
188
|
+
/**
|
|
189
|
+
* Getter to streamline the creation of updated Context instances
|
|
190
|
+
*/
|
|
191
|
+
get: function () {
|
|
192
|
+
var contextOpts = {
|
|
193
|
+
id: this.id,
|
|
194
|
+
portalUrl: this._portalUrl,
|
|
195
|
+
hubUrl: this._hubUrl,
|
|
196
|
+
properties: this._properties,
|
|
197
|
+
};
|
|
198
|
+
if (this._authentication) {
|
|
199
|
+
contextOpts.authentication = this._authentication;
|
|
200
|
+
}
|
|
201
|
+
if (this._portalSelf) {
|
|
202
|
+
contextOpts.portalSelf = this._portalSelf;
|
|
203
|
+
}
|
|
204
|
+
if (this._currentUser) {
|
|
205
|
+
contextOpts.currentUser = this._currentUser;
|
|
206
|
+
}
|
|
207
|
+
return contextOpts;
|
|
208
|
+
},
|
|
209
|
+
enumerable: false,
|
|
210
|
+
configurable: true
|
|
211
|
+
});
|
|
212
|
+
return ArcGISContextManager;
|
|
213
|
+
}());
|
|
214
|
+
export { ArcGISContextManager };
|
|
215
|
+
//# sourceMappingURL=ArcGISContextManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArcGISContextManager.js","sourceRoot":"","sources":["../../src/ArcGISContextManager.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAW,MAAM,0BAA0B,CAAC;AAErE,OAAO,EACL,aAAa,GAGd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAqDzE;;;;;;;;;;;;;GAaG;AACH;IAwBE;;;;OAIG;IACH,8BAAoB,IAAkC;QAjB9C,eAAU,GAAW,wBAAwB,CAAC;QAU9C,cAAS,GAAU,KAAK,CAAC,KAAK,CAAC;QAQrC,4CAA4C;QAC5C,IAAI,CAAC,EAAE,GAAG,IAAI,I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S,EAAE,IAAI,CAAC,UAAU;gBAC1B,MAAM,EAAE,IAAI,CAAC,OAAO;gBACpB,UAAU,EAAE,IAAI,CAAC,WAAW;aAC7B,CAAC;YACF,IAAI,IAAI,CAAC,eAAe,EAAE;gBACxB,WAAW,CAAC,cAAc,GAAG,IAAI,CAAC,eAAe,CAAC;aACnD;YACD,IAAI,IAAI,CAAC,WAAW,EAAE;gBACpB,WAAW,CAAC,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC;aAC3C;YACD,IAAI,IAAI,CAAC,YAAY,EAAE;gBACrB,WAAW,CAAC,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC;aAC7C;YACD,OAAO,WAAW,CAAC;QACrB,CAAC;;;OAAA;IACH,2BAAC;AAAD,CAAC,AA1LD,IA0LC"}
|
package/dist/esm/Hub.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { __awaiter, __generator } from "tslib";
|
|
2
|
+
import { ArcGISContextManager, } from "./ArcGISContextManager";
|
|
3
|
+
import { HubProjectManager } from "./projects/HubProjectManager";
|
|
4
|
+
/**
|
|
5
|
+
* Hub class can be used as an entry point to managing
|
|
6
|
+
* content, teams, sites, projects etc, in an organization's Hub.
|
|
7
|
+
*
|
|
8
|
+
* ```js
|
|
9
|
+
* import {Hub} from '@esri/hub-common';
|
|
10
|
+
* // create a Hub instance, authenticating as a specific user
|
|
11
|
+
* // working against arcgis online
|
|
12
|
+
* const myHub = await Hub.create({authOptions: {username: "casey", password: "jones"}});
|
|
13
|
+
*
|
|
14
|
+
* myHub.context.currentUser //=> {username: "casey", ...} as IUser
|
|
15
|
+
*
|
|
16
|
+
* const projectStore = await myHub.getProjectStore();
|
|
17
|
+
*
|
|
18
|
+
* const pavingProject = await projectStore.create({name: "12th Street Paving"});
|
|
19
|
+
* pavingProject.summary = "This is the 2024 planned paving of 12th Street, between 8th and 11th Ave";
|
|
20
|
+
* await projectStore.update(pavingProject);
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* This is a convenience class. Hub Stores can be created
|
|
24
|
+
* directly, or the underlying functions can be imported an used
|
|
25
|
+
* as need for scenarios where these class structures introduce
|
|
26
|
+
* unwanted complexity
|
|
27
|
+
*/
|
|
28
|
+
var Hub = /** @class */ (function () {
|
|
29
|
+
/**
|
|
30
|
+
* Private so we can employ a factory function should we need
|
|
31
|
+
* async work during creation
|
|
32
|
+
* @param contextManager
|
|
33
|
+
*/
|
|
34
|
+
function Hub(contextManager) {
|
|
35
|
+
this._contextManager = contextManager;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Factory function to construct a new HubProjectStore instance.
|
|
39
|
+
*
|
|
40
|
+
* Note: Used so that we could do async actions in the ctor.
|
|
41
|
+
* @param contextManager
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
44
|
+
Hub.create = function (options) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
46
|
+
var opts, mgr;
|
|
47
|
+
return __generator(this, function (_a) {
|
|
48
|
+
switch (_a.label) {
|
|
49
|
+
case 0:
|
|
50
|
+
if (!options.contextManager) return [3 /*break*/, 1];
|
|
51
|
+
return [2 /*return*/, new Hub(options.contextManager)];
|
|
52
|
+
case 1:
|
|
53
|
+
opts = options.managerOptions || {};
|
|
54
|
+
return [4 /*yield*/, ArcGISContextManager.create(opts)];
|
|
55
|
+
case 2:
|
|
56
|
+
mgr = _a.sent();
|
|
57
|
+
return [2 /*return*/, new Hub(mgr)];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
Object.defineProperty(Hub.prototype, "context", {
|
|
63
|
+
/**
|
|
64
|
+
* Getter to abstract the context manager
|
|
65
|
+
*/
|
|
66
|
+
get: function () {
|
|
67
|
+
return this._contextManager.context;
|
|
68
|
+
},
|
|
69
|
+
enumerable: false,
|
|
70
|
+
configurable: true
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(Hub.prototype, "projects", {
|
|
73
|
+
/**
|
|
74
|
+
* Create a Project Store connected to the current Hub
|
|
75
|
+
* @returns
|
|
76
|
+
*/
|
|
77
|
+
get: function () {
|
|
78
|
+
if (!this._projectManager) {
|
|
79
|
+
this._projectManager = HubProjectManager.init(this._contextManager);
|
|
80
|
+
}
|
|
81
|
+
return this._projectManager;
|
|
82
|
+
},
|
|
83
|
+
enumerable: false,
|
|
84
|
+
configurable: true
|
|
85
|
+
});
|
|
86
|
+
return Hub;
|
|
87
|
+
}());
|
|
88
|
+
export { Hub };
|
|
89
|
+
//# sourceMappingURL=Hub.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Hub.js","sourceRoot":"","sources":["../../src/Hub.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,oBAAoB,GAErB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAWjE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH;IAYE;;;;OAIG;IACH,aAAoB,cAAoC;QACtD,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;IACxC,CAAC;IAED;;;;;;OAMG;IACU,UAAM,GAAnB,UAAoB,OAAoB;;;;;;6BAClC,OAAO,CAAC,cAAc,EAAtB,wBAAsB;wBACxB,sBAAO,IAAI,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,EAAC;;wBAEjC,IAAI,GAAG,OAAO,CAAC,cAAc,IAAI,EAAE,CAAC;wBAC9B,qBAAM,oBAAoB,CAAC,MAAM,CAAC,IAAI,CAAC,EAAA;;wBAA7C,GAAG,GAAG,SAAuC;wBACnD,sBAAO,IAAI,GAAG,CAAC,GAAG,CAAC,EAAC;;;;KAEvB;IAKD,sBAAW,wBAAO;QAHlB;;WAEG;aACH;YACE,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC;QACtC,CAAC;;;OAAA;IAMD,sBAAI,yBAAQ;QAJZ;;;WAGG;aACH;YACE,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;gBACzB,IAAI,CAAC,eAAe,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;aACrE;YAED,OAAO,IAAI,CAAC,eAAe,CAAC;QAC9B,CAAC;;;OAAA;IACH,UAAC;AAAD,CAAC,AAxDD,IAwDC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { __extends } from "tslib";
|
|
2
|
+
import { getWithDefault, OperationError } from ".";
|
|
3
|
+
/**
|
|
4
|
+
* Generic Hub Error with an Error stack as well
|
|
5
|
+
* as an optional serialized OperationStack.
|
|
6
|
+
*
|
|
7
|
+
* Also accepts a `rootCause` Error object
|
|
8
|
+
*/
|
|
9
|
+
var HubError = /** @class */ (function (_super) {
|
|
10
|
+
__extends(HubError, _super);
|
|
11
|
+
/**
|
|
12
|
+
* Creates an instance of HubError.
|
|
13
|
+
* @param {string} operation
|
|
14
|
+
* @param {string} [message]
|
|
15
|
+
* @param {Error} [rootCause]
|
|
16
|
+
* @memberof HubError
|
|
17
|
+
*/
|
|
18
|
+
function HubError(operation, message, rootCause) {
|
|
19
|
+
var _this = this;
|
|
20
|
+
message = message || "UNKNOWN_ERROR";
|
|
21
|
+
// if the rootCause has a .rootCause, use that so we don't deeply nest
|
|
22
|
+
rootCause = getWithDefault(rootCause, "rootCause", rootCause);
|
|
23
|
+
/* Skip coverage on super(...) as per:
|
|
24
|
+
https://github.com/Microsoft/TypeScript/issues/13029
|
|
25
|
+
https://github.com/SitePen/remap-istanbul/issues/106
|
|
26
|
+
*/
|
|
27
|
+
/* istanbul ignore next */
|
|
28
|
+
_this = _super.call(this, operation, message, rootCause) || this;
|
|
29
|
+
_this.name = "HubError";
|
|
30
|
+
// if the original error has a stack use it, otherwise create a new
|
|
31
|
+
// stack. Note: a new Stack will make it look like the error origninated
|
|
32
|
+
// in the HubError constructor. This is only an issue in tests but
|
|
33
|
+
// it can be confusing to debug
|
|
34
|
+
_this.stack = getWithDefault(rootCause, "stack", new Error().stack);
|
|
35
|
+
return _this;
|
|
36
|
+
}
|
|
37
|
+
return HubError;
|
|
38
|
+
}(OperationError));
|
|
39
|
+
export default HubError;
|
|
40
|
+
//# sourceMappingURL=HubError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HubError.js","sourceRoot":"","sources":["../../src/HubError.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,GAAG,CAAC;AAEnD;;;;;GAKG;AACH;IAAsC,4BAAc;IAClD;;;;;;OAMG;IACH,kBAAY,SAAiB,EAAE,OAAgB,EAAE,SAAiB;QAAlE,iBAgBC;QAfC,OAAO,GAAG,OAAO,IAAI,eAAe,CAAC;QACrC,sEAAsE;QACtE,SAAS,GAAG,cAAc,CAAC,SAAS,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;QAC9D;;;UAGE;QACF,0BAA0B;QAC1B,QAAA,kBAAM,SAAS,EAAE,OAAO,EAAE,SAAS,CAAC,SAAC;QACrC,KAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,mEAAmE;QACnE,wEAAwE;QACxE,kEAAkE;QAClE,+BAA+B;QAC/B,KAAI,CAAC,KAAK,GAAG,cAAc,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC;;IACrE,CAAC;IACH,eAAC;AAAD,CAAC,AAzBD,CAAsC,cAAc,GAyBnD"}
|
package/dist/esm/collections.js
CHANGED
|
@@ -114,6 +114,29 @@ var other = [
|
|
|
114
114
|
"Workflow Manager Package",
|
|
115
115
|
];
|
|
116
116
|
var site = ["Hub Site Application", "Site Application"];
|
|
117
|
+
/**
|
|
118
|
+
* ```js
|
|
119
|
+
* import { getCollection } from "@esri/hub-common";
|
|
120
|
+
* //
|
|
121
|
+
* getCollection('Feature Layer')
|
|
122
|
+
* > 'dataset'
|
|
123
|
+
* ```
|
|
124
|
+
* Get the Hub collection for a given item type
|
|
125
|
+
* @param itemType The ArcGIS [item type](https://developers.arcgis.com/rest/users-groups-and-items/items-and-item-types.htm).
|
|
126
|
+
* @returns the Hub collection of a given item type.
|
|
127
|
+
*/
|
|
128
|
+
export var getCollection = function (type) {
|
|
129
|
+
if (!type) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
var lowerCaseType = type.toLocaleLowerCase();
|
|
133
|
+
return Object.keys(collections).find(function (key) {
|
|
134
|
+
var collectionTypes = collections[key];
|
|
135
|
+
return collectionTypes.some(function (t) { return t.toLocaleLowerCase() === lowerCaseType; });
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
// TODO: remove this at the next breaking change
|
|
139
|
+
// it's only here to support deprecated categories
|
|
117
140
|
export var collections = {
|
|
118
141
|
app: app,
|
|
119
142
|
dataset: dataset,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collections.js","sourceRoot":"","sources":["../../src/collections.ts"],"names":[],"mappings":"AAAA,IAAM,GAAG,GAAa;IACpB,aAAa;IACb,uBAAuB;IACvB,sBAAsB;IACtB,WAAW;IACX,eAAe;IACf,mBAAmB;IACnB,gBAAgB;IAChB,yBAAyB;IACzB,UAAU;IACV,gBAAgB;IAChB,aAAa;CACd,CAAC;AAEF,IAAM,OAAO,GAAa;IACxB,gBAAgB;IAChB,KAAK;IACL,6BAA6B;IAC7B,oBAAoB;IACpB,eAAe;IACf,iBAAiB;IACjB,kBAAkB;IAClB,SAAS;IACT,SAAS;IACT,gBAAgB;IAChB,KAAK;IACL,iBAAiB;IACjB,cAAc;IACd,WAAW;IACX,gBAAgB;IAChB,OAAO;CACR,CAAC;AAEF,IAAM,QAAQ,GAAa;IACzB,aAAa;IACb,eAAe;IACf,UAAU;IACV,WAAW;IACX,OAAO;IACP,eAAe;IACf,eAAe;IACf,aAAa;IACb,sBAAsB;IACtB,iBAAiB;IACjB,gBAAgB;IAChB,UAAU;IACV,KAAK;IACL,SAAS;IACT,iBAAiB;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,KAAA;IACH,OAAO,SAAA;IACP,QAAQ,UAAA;IACR,KAAK,OAAA;IACL,QAAQ,UAAA;IACR,UAAU,YAAA;IACV,QAAQ,UAAA;IACR,QAAQ,UAAA;IACR,GAAG,KAAA;IACH,KAAK,OAAA;IACL,IAAI,MAAA;CACL,CAAC"}
|
|
1
|
+
{"version":3,"file":"collections.js","sourceRoot":"","sources":["../../src/collections.ts"],"names":[],"mappings":"AAAA,IAAM,GAAG,GAAa;IACpB,aAAa;IACb,uBAAuB;IACvB,sBAAsB;IACtB,WAAW;IACX,eAAe;IACf,mBAAmB;IACnB,gBAAgB;IAChB,yBAAyB;IACzB,UAAU;IACV,gBAAgB;IAChB,aAAa;CACd,CAAC;AAEF,IAAM,OAAO,GAAa;IACxB,gBAAgB;IAChB,KAAK;IACL,6BAA6B;IAC7B,oBAAoB;IACpB,eAAe;IACf,iBAAiB;IACjB,kBAAkB;IAClB,SAAS;IACT,SAAS;IACT,gBAAgB;IAChB,KAAK;IACL,iBAAiB;IACjB,cAAc;IACd,WAAW;IACX,gBAAgB;IAChB,OAAO;CACR,CAAC;AAEF,IAAM,QAAQ,GAAa;IACzB,aAAa;IACb,eAAe;IACf,UAAU;IACV,WAAW;IACX,OAAO;IACP,eAAe;IACf,eAAe;IACf,aAAa;IACb,sBAAsB;IACtB,iBAAiB;IACjB,gBAAgB;IAChB,UAAU;IACV,KAAK;IACL,SAAS;IACT,iBAAiB;CAClB,CAAC;AAEF,IAAM,KAAK,GAAa,CAAC,WAAW,CAAC,CAAC;AAEtC,IAAM,QAAQ,GAAa,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;AAE7D,IAAM,UAAU,GAAa,CAAC,gBAAgB,CAAC,CAAC;AAEhD,IAAM,QAAQ,GAAa,CAAC,UAAU,CAAC,CAAC;AAExC,IAAM,QAAQ,GAAa,CAAC,yBAAyB,CAAC,CAAC;AAEvD,IAAM,GAAG,GAAa;IACpB,kBAAkB;IAClB,eAAe;IACf,mBAAmB;IACn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,aAAa,EAAvC,CAAuC,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,gDAAgD;AAChD,kDAAkD;AAClD,MAAM,CAAC,IAAM,WAAW,GAAgC;IACtD,GAAG,KAAA;IACH,OAAO,SAAA;IACP,QAAQ,UAAA;IACR,KAAK,OAAA;IACL,QAAQ,UAAA;IACR,UAAU,YAAA;IACV,QAAQ,UAAA;IACR,QAAQ,UAAA;IACR,GAAG,KAAA;IACH,KAAK,OAAA;IACL,IAAI,MAAA;CACL,CAAC"}
|
|
@@ -62,4 +62,18 @@ var getContentBoundary = function (content) {
|
|
|
62
62
|
geometry: geometry,
|
|
63
63
|
};
|
|
64
64
|
};
|
|
65
|
+
var MAX_SIZE = 5000000;
|
|
66
|
+
/**
|
|
67
|
+
* Returns whether or not an item is a proxied csv
|
|
68
|
+
*
|
|
69
|
+
* @param item
|
|
70
|
+
* @param requestOptions Hub Request Options (including whether we're in portal)
|
|
71
|
+
* @returns
|
|
72
|
+
*/
|
|
73
|
+
export var isProxiedCSV = function (item, requestOptions) {
|
|
74
|
+
return !requestOptions.isPortal &&
|
|
75
|
+
item.access === "public" &&
|
|
76
|
+
item.type === "CSV" &&
|
|
77
|
+
item.size <= MAX_SIZE;
|
|
78
|
+
};
|
|
65
79
|
//# sourceMappingURL=_internal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_internal.js","sourceRoot":"","sources":["../../../src/content/_internal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;;
|
|
1
|
+
{"version":3,"file":"_internal.js","sourceRoot":"","sources":["../../../src/content/_internal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;;AAUH,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAElD;;;;;GAKG;AACH,MAAM,CAAC,IAAM,kBAAkB,GAAG,UAChC,OAAoB,EACpB,QAA6B;IAE7B,qCAAqC;IACrC,IAAM,UAAU,yB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,IAAI,CAAC;YAC5D,MAAM;QACR,KAAK,MAAM;YACT,QAAQ,GAAG,IAAI,CAAC;YAChB,MAAM;QACR,iCAAiC;KAClC;IACD,iCAAiC;IACjC,OAAO;QACL,UAAU,YAAA;QACV,QAAQ,UAAA;KACT,CAAC;AACJ,CAAC,CAAC;AAEF,IAAM,QAAQ,GAAG,OAAO,CAAC;AAEzB;;;;;;GAMG;AACH,MAAM,CAAC,IAAM,YAAY,GAAG,UAAC,IAAW,EAAE,cAAkC;IAC1E,OAAA,CAAC,cAAc,CAAC,QAAQ;QACxB,IAAI,CAAC,MAAM,KAAK,QAAQ;QACxB,IAAI,CAAC,IAAI,KAAK,KAAK;QACnB,IAAI,CAAC,IAAI,IAAI,QAAQ;AAHrB,CAGqB,CAAC"}
|
|
@@ -6,8 +6,9 @@ import { includes, isGuid } from "../utils";
|
|
|
6
6
|
import { getProp } from "../objects";
|
|
7
7
|
import { getStructuredLicense } from "../items/get-structured-license";
|
|
8
8
|
import { getServiceTypeFromUrl } from "../urls";
|
|
9
|
-
import { setContentExtent } from "./_internal";
|
|
9
|
+
import { setContentExtent, isProxiedCSV } from "./_internal";
|
|
10
10
|
import { camelize } from "../util";
|
|
11
|
+
// private helper functions
|
|
11
12
|
function collectionToFamily(collection) {
|
|
12
13
|
var overrides = {
|
|
13
14
|
other: "content",
|
|
@@ -614,7 +615,7 @@ export function datasetToItem(dataset) {
|
|
|
614
615
|
}
|
|
615
616
|
/**
|
|
616
617
|
* returns a new content that has the specified type and
|
|
617
|
-
* and updated related properties like
|
|
618
|
+
* and updated related properties like, family, etc
|
|
618
619
|
* @param content orignal content
|
|
619
620
|
* @param type new type
|
|
620
621
|
* @returns new content
|
|
@@ -625,9 +626,8 @@ export var setContentType = function (content, type) {
|
|
|
625
626
|
var family = getFamily(normalizedType);
|
|
626
627
|
var contentTypeIcon = getContentTypeIcon(normalizedType);
|
|
627
628
|
var contentTypeLabel = getContentTypeLabel(normalizedType, content.isProxied);
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
family: family,
|
|
629
|
+
var updated = __assign(__assign({}, content), { type: normalizedType, family: family,
|
|
630
|
+
// TODO: remove this at next breaking change now that it has been deprecated
|
|
631
631
|
normalizedType: normalizedType,
|
|
632
632
|
contentTypeIcon: contentTypeIcon,
|
|
633
633
|
contentTypeLabel: contentTypeLabel });
|
|
@@ -638,23 +638,26 @@ export var setContentType = function (content, type) {
|
|
|
638
638
|
});
|
|
639
639
|
};
|
|
640
640
|
/**
|
|
641
|
-
* Compute the content type icon based on the
|
|
642
|
-
* @param
|
|
641
|
+
* Compute the content type icon based on the content type
|
|
642
|
+
* @param content type
|
|
643
643
|
* @returns content type icon
|
|
644
644
|
*/
|
|
645
|
-
export var getContentTypeIcon = function (
|
|
645
|
+
export var getContentTypeIcon = function (contentType) {
|
|
646
646
|
var _a;
|
|
647
|
-
var type = camelize(
|
|
647
|
+
var type = camelize(contentType || "");
|
|
648
648
|
var iconMap = {
|
|
649
649
|
appbuilderExtension: "file",
|
|
650
650
|
appbuilderWidgetPackage: "widgets-source",
|
|
651
651
|
application: "web",
|
|
652
|
+
applicationConfiguration: "app-gear",
|
|
652
653
|
arcgisProMap: "desktop",
|
|
653
654
|
cadDrawing: "file-cad",
|
|
654
655
|
cityEngineWebScene: "urban-model",
|
|
655
656
|
codeAttachment: "file-code",
|
|
657
|
+
codeSample: "file-code",
|
|
656
658
|
colorSet: "palette",
|
|
657
659
|
contentCategorySet: "label",
|
|
660
|
+
csv: "file-csv",
|
|
658
661
|
cSV: "file-csv",
|
|
659
662
|
cSVCollection: "file-csv",
|
|
660
663
|
dashboard: "dashboard",
|
|
@@ -676,8 +679,8 @@ export var getContentTypeIcon = function (normalizedType) {
|
|
|
676
679
|
geoprocessingService: "file",
|
|
677
680
|
globeLayer: "layers",
|
|
678
681
|
globeService: "file",
|
|
679
|
-
hubInitiative: "
|
|
680
|
-
hubInitiativeTemplate: "initiative-template
|
|
682
|
+
hubInitiative: "initiative",
|
|
683
|
+
hubInitiativeTemplate: "initiative-template",
|
|
681
684
|
hubPage: "browser",
|
|
682
685
|
hubSiteApplication: "web",
|
|
683
686
|
image: "file-image",
|
|
@@ -693,6 +696,7 @@ export var getContentTypeIcon = function (normalizedType) {
|
|
|
693
696
|
kMLCollection: "data",
|
|
694
697
|
layer: "layers",
|
|
695
698
|
layerPackage: "layers",
|
|
699
|
+
layerTemplate: "file",
|
|
696
700
|
locatorPackage: "file",
|
|
697
701
|
mapArea: "file",
|
|
698
702
|
mapDocument: "map-contents",
|
|
@@ -715,6 +719,7 @@ export var getContentTypeIcon = function (normalizedType) {
|
|
|
715
719
|
orthoMappingTemplate: "file",
|
|
716
720
|
pDF: "file-pdf",
|
|
717
721
|
quickCaptureProject: "mobile",
|
|
722
|
+
rasterFunctionTemplate: "file",
|
|
718
723
|
rasterLayer: "map",
|
|
719
724
|
realTimeAnalytic: "file",
|
|
720
725
|
relationalDatabaseConnection: "file",
|
|
@@ -723,19 +728,23 @@ export var getContentTypeIcon = function (normalizedType) {
|
|
|
723
728
|
sceneService: "urban-model",
|
|
724
729
|
serviceDefinition: "file",
|
|
725
730
|
shapefile: "data",
|
|
726
|
-
solution: "
|
|
731
|
+
solution: "puzzle-piece",
|
|
727
732
|
sqliteGeodatabase: "file",
|
|
728
733
|
statisticalDataCollection: "file",
|
|
734
|
+
storymap: "tour",
|
|
729
735
|
storyMap: "tour",
|
|
736
|
+
storymapTheme: "palette",
|
|
730
737
|
symbolSet: "file",
|
|
731
738
|
table: "table",
|
|
732
739
|
urbanModel: "urban-model",
|
|
740
|
+
vectorTilePackage: "file-shape",
|
|
733
741
|
vectorTileService: "map",
|
|
734
742
|
visioDocument: "conditional-rules",
|
|
735
743
|
webExperience: "apps",
|
|
736
744
|
webMap: "map",
|
|
737
745
|
webMappingApplication: "apps",
|
|
738
746
|
webScene: "urban-model",
|
|
747
|
+
wfs: "map",
|
|
739
748
|
wFS: "map",
|
|
740
749
|
wMS: "map",
|
|
741
750
|
wMTS: "map",
|
|
@@ -746,12 +755,12 @@ export var getContentTypeIcon = function (normalizedType) {
|
|
|
746
755
|
};
|
|
747
756
|
/**
|
|
748
757
|
* Compute the content type label
|
|
749
|
-
* @param
|
|
758
|
+
* @param contentType
|
|
750
759
|
* @param isProxied
|
|
751
760
|
* @returns content type label
|
|
752
761
|
*/
|
|
753
|
-
export var getContentTypeLabel = function (
|
|
754
|
-
return isProxied ? "CSV" : camelize(
|
|
762
|
+
export var getContentTypeLabel = function (contentType, isProxied) {
|
|
763
|
+
return isProxied ? "CSV" : camelize(contentType || "");
|
|
755
764
|
};
|
|
756
765
|
/**
|
|
757
766
|
* returns a new content that has the specified hubId and updated identifier
|
|
@@ -844,8 +853,8 @@ var getContentRelativeUrl = function (content, siteIdentifier) {
|
|
|
844
853
|
var getSolutionUrl = function (content) {
|
|
845
854
|
var _a;
|
|
846
855
|
var hubUrl;
|
|
847
|
-
var
|
|
848
|
-
if (
|
|
856
|
+
var type = content.type, identifier = content.identifier;
|
|
857
|
+
if (type === "Solution") {
|
|
849
858
|
// NOTE: as per the above spreadsheet,
|
|
850
859
|
// solution types are now in the Template family
|
|
851
860
|
// but we don't send them to the route for initiative templates
|
|
@@ -862,8 +871,23 @@ var getSolutionUrl = function (content) {
|
|
|
862
871
|
// TODO: we check both "Hub Page" and "Site Page" because we don't know whether the site is a portal or not
|
|
863
872
|
// In the future, the site object will have a site.isPortal() function that we can leverage
|
|
864
873
|
// instead of hardcoding the types here.
|
|
865
|
-
// TODO: should this be based on normalizedType instead?
|
|
866
874
|
var isPageContent = function (content) {
|
|
867
875
|
return includes(["Hub Page", "Site Page"], content.type);
|
|
868
876
|
};
|
|
877
|
+
// proxied csv helpers
|
|
878
|
+
/**
|
|
879
|
+
* If an item is a proxied csv, returns the url for the proxying feature layer.
|
|
880
|
+
* If the item is not a proxied csv, returns undefined.
|
|
881
|
+
*
|
|
882
|
+
* @param item
|
|
883
|
+
* @param requestOptions Hub Request Options (including whether we're in portal)
|
|
884
|
+
* @returns
|
|
885
|
+
*/
|
|
886
|
+
export var getProxyUrl = function (item, requestOptions) {
|
|
887
|
+
var result;
|
|
888
|
+
if (isProxiedCSV(item, requestOptions)) {
|
|
889
|
+
result = requestOptions.hubApiUrl + "/datasets/" + item.id + "_0/FeatureServer/0";
|
|
890
|
+
}
|
|
891
|
+
return result;
|
|
892
|
+
};
|
|
869
893
|
//# sourceMappingURL=index.js.map
|