@esri/hub-common 9.14.0 → 9.17.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 +72 -26
- package/dist/es2017/ArcGISContext.js.map +1 -1
- package/dist/es2017/ArcGISContextManager.js +20 -9
- package/dist/es2017/ArcGISContextManager.js.map +1 -1
- 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 -6
- 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/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 +76 -26
- package/dist/esm/ArcGISContext.js.map +1 -1
- package/dist/esm/ArcGISContextManager.js +20 -9
- package/dist/esm/ArcGISContextManager.js.map +1 -1
- 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 -6
- 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/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 +72 -26
- package/dist/node/ArcGISContext.js.map +1 -1
- package/dist/node/ArcGISContextManager.js +20 -9
- package/dist/node/ArcGISContextManager.js.map +1 -1
- 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 -6
- 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/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 +197 -13
- package/dist/types/ArcGISContextManager.d.ts +21 -4
- 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 -6
- 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/types.d.ts +2 -0
- package/dist/types/types.d.ts +2 -92
- package/dist/types/utils/dasherize.d.ts +17 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/umd/common.umd.js +2062 -1114
- 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/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/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/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/items/get-model.d.ts +0 -8
|
@@ -9,18 +9,22 @@ const hubApiEndpoints = {
|
|
|
9
9
|
discussions: "/api/discussions/v1",
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* Abstraction that holds a UserSession, along with
|
|
12
|
+
* Abstraction that holds a `UserSession`, along with
|
|
15
13
|
* getters to streamline access to various platform
|
|
16
|
-
* urls, and common constructs like IRequestOptions
|
|
14
|
+
* urls, and common constructs like `IRequestOptions`,
|
|
15
|
+
* `IUserRequestOptions` etc.
|
|
17
16
|
*
|
|
18
|
-
*
|
|
17
|
+
* Instances are intended to be immutable, but this is not directly enforced.
|
|
19
18
|
*
|
|
20
|
-
*
|
|
21
|
-
* the ArcGISContextManager class
|
|
19
|
+
* In most circumstances, this class should be created by
|
|
20
|
+
* the ArcGISContextManager class.
|
|
22
21
|
*/
|
|
23
22
|
export class ArcGISContext {
|
|
23
|
+
/**
|
|
24
|
+
* Create a new instance of `ArcGISContext`.
|
|
25
|
+
*
|
|
26
|
+
* @param opts
|
|
27
|
+
*/
|
|
24
28
|
constructor(opts) {
|
|
25
29
|
this._portalUrl = "https://www.arcgis.com";
|
|
26
30
|
this.id = opts.id;
|
|
@@ -35,6 +39,9 @@ export class ArcGISContext {
|
|
|
35
39
|
if (opts.currentUser) {
|
|
36
40
|
this._currentUser = opts.currentUser;
|
|
37
41
|
}
|
|
42
|
+
if (opts.properties) {
|
|
43
|
+
this._properties = opts.properties;
|
|
44
|
+
}
|
|
38
45
|
}
|
|
39
46
|
/**
|
|
40
47
|
* Return the UserSession if authenticated
|
|
@@ -87,21 +94,23 @@ export class ArcGISContext {
|
|
|
87
94
|
*/
|
|
88
95
|
get hubRequestOptions() {
|
|
89
96
|
// We may add more logic around what is returned in some corner cases
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
97
|
+
if (this.isAuthenticated) {
|
|
98
|
+
return {
|
|
99
|
+
authentication: this.session,
|
|
100
|
+
isPortal: this.isPortal,
|
|
101
|
+
portalSelf: this.portal,
|
|
102
|
+
hubApiUrl: this.hubUrl,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
96
105
|
}
|
|
97
106
|
/**
|
|
98
|
-
* Return the portal url.
|
|
107
|
+
* Return the portal url i.e. https://www.arcgis.com
|
|
99
108
|
*
|
|
100
109
|
* If authenticated @ ArcGIS Online, it will return
|
|
101
110
|
* the https://org.env.arcgis.com
|
|
102
111
|
*
|
|
103
112
|
* If authenticated @ ArcGIS Enterprise, it will return
|
|
104
|
-
* https://portalHostname
|
|
113
|
+
* https://{portalHostname}/{webadaptor}
|
|
105
114
|
*/
|
|
106
115
|
get portalUrl() {
|
|
107
116
|
if (this.isAuthenticated) {
|
|
@@ -117,12 +126,17 @@ export class ArcGISContext {
|
|
|
117
126
|
}
|
|
118
127
|
}
|
|
119
128
|
/**
|
|
120
|
-
* Returns the url to the sharing api
|
|
129
|
+
* Returns the url to the sharing api composed from portalUrl
|
|
121
130
|
* i.e. https://myorg.maps.arcgis.com/sharing/rest
|
|
122
131
|
*/
|
|
123
132
|
get sharingApiUrl() {
|
|
124
133
|
return `${this.portalUrl}/sharing/rest`;
|
|
125
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* Returns the Hub url, based on the portalUrl
|
|
137
|
+
*
|
|
138
|
+
* For ArcGIS Enterprise this will return `undefined`
|
|
139
|
+
*/
|
|
126
140
|
get hubUrl() {
|
|
127
141
|
return this._hubUrl;
|
|
128
142
|
}
|
|
@@ -135,28 +149,35 @@ export class ArcGISContext {
|
|
|
135
149
|
? this._portalSelf.isPortal
|
|
136
150
|
: this._portalUrl.indexOf("arcgis.com") === -1;
|
|
137
151
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
152
|
+
/**
|
|
153
|
+
* Returns the discussions API URL
|
|
154
|
+
*/
|
|
141
155
|
get discussionsServiceUrl() {
|
|
142
156
|
if (this._hubUrl) {
|
|
143
157
|
return `${this._hubUrl}${hubApiEndpoints.discussions}`;
|
|
144
158
|
}
|
|
145
159
|
}
|
|
146
|
-
|
|
160
|
+
/**
|
|
161
|
+
* Returns the Hub Search API URL
|
|
162
|
+
*/
|
|
147
163
|
get hubSearchServiceUrl() {
|
|
148
164
|
if (this._hubUrl) {
|
|
149
165
|
return `${this._hubUrl}${hubApiEndpoints.search}`;
|
|
150
166
|
}
|
|
151
167
|
}
|
|
152
|
-
|
|
168
|
+
/**
|
|
169
|
+
* Returns Hub Domain Service URL
|
|
170
|
+
*/
|
|
153
171
|
get domainServiceUrl() {
|
|
154
172
|
if (this._hubUrl) {
|
|
155
173
|
return `${this._hubUrl}${hubApiEndpoints.domains}`;
|
|
156
174
|
}
|
|
157
175
|
}
|
|
158
|
-
|
|
159
|
-
|
|
176
|
+
/**
|
|
177
|
+
* Returns the Events configuration object from portal/self
|
|
178
|
+
*
|
|
179
|
+
* `{serviceId: '3ef..', publicViewId: 'bc3...'}`
|
|
180
|
+
*/
|
|
160
181
|
get eventsConfig() {
|
|
161
182
|
if (this._portalSelf) {
|
|
162
183
|
return getProp(this._portalSelf, "portalProperties.hub.settings.events");
|
|
@@ -171,35 +192,60 @@ export class ArcGISContext {
|
|
|
171
192
|
return getWithDefault(this._portalSelf, "portalProperties.hub.enabled", false);
|
|
172
193
|
}
|
|
173
194
|
/**
|
|
174
|
-
* Return Hub Community Org Id, if defined
|
|
195
|
+
* Return the Hub Community Org Id, if defined
|
|
175
196
|
*/
|
|
176
197
|
get communityOrgId() {
|
|
177
198
|
if (this._portalSelf) {
|
|
178
199
|
return getProp(this._portalSelf, "portalProperties.hub.settings.communityOrg.orgId");
|
|
179
200
|
}
|
|
180
201
|
}
|
|
202
|
+
/**
|
|
203
|
+
* Returns the Hub Community Org Hostname, if defined
|
|
204
|
+
*
|
|
205
|
+
* i.e. c-org.maps.arcgis.com
|
|
206
|
+
*/
|
|
181
207
|
get communityOrgHostname() {
|
|
182
208
|
if (this._portalSelf) {
|
|
183
209
|
return getProp(this._portalSelf, "portalProperties.hub.settings.communityOrg.portalHostname");
|
|
184
210
|
}
|
|
185
211
|
}
|
|
212
|
+
/**
|
|
213
|
+
* Returns the Hub Community Org url
|
|
214
|
+
*
|
|
215
|
+
* i.e. https://c-org.maps.arcgis.com
|
|
216
|
+
*/
|
|
186
217
|
get communityOrgUrl() {
|
|
187
218
|
if (this.communityOrgHostname) {
|
|
188
219
|
return `https://${this.communityOrgHostname}`;
|
|
189
220
|
}
|
|
190
221
|
}
|
|
191
|
-
|
|
192
|
-
|
|
222
|
+
/**
|
|
223
|
+
* Returns the hash of helper services from portal self
|
|
224
|
+
*/
|
|
193
225
|
get helperServices() {
|
|
194
226
|
if (this._portalSelf) {
|
|
195
227
|
return this._portalSelf.helperServices;
|
|
196
228
|
}
|
|
197
229
|
}
|
|
230
|
+
/**
|
|
231
|
+
* Returns the current user as IUser
|
|
232
|
+
*/
|
|
198
233
|
get currentUser() {
|
|
199
234
|
return this._currentUser;
|
|
200
235
|
}
|
|
236
|
+
/**
|
|
237
|
+
* Returns the portal object as IPortal
|
|
238
|
+
*/
|
|
201
239
|
get portal() {
|
|
202
240
|
return this._portalSelf;
|
|
203
241
|
}
|
|
242
|
+
/**
|
|
243
|
+
* Return the properties hash that was passed in.
|
|
244
|
+
* Useful for app-specific context such as the active
|
|
245
|
+
* Site for ArcGIS Hub
|
|
246
|
+
*/
|
|
247
|
+
get properties() {
|
|
248
|
+
return this._properties;
|
|
249
|
+
}
|
|
204
250
|
}
|
|
205
251
|
//# sourceMappingURL=ArcGISContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArcGISContext.js","sourceRoot":"","sources":["../../src/ArcGISContext.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAsB,MAAM,GAAG,CAAC;AAEhE;;;GAGG;AACH,MAAM,eAAe,GAAG;IACtB,OAAO,EAAE,iBAAiB;IAC1B,MAAM,EAAE,kBAAkB;IAC1B,WAAW,EAAE,qBAAqB;CACnC,CAAC;
|
|
1
|
+
{"version":3,"file":"ArcGISContext.js","sourceRoot":"","sources":["../../src/ArcGISContext.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAsB,MAAM,GAAG,CAAC;AAEhE;;;GAGG;AACH,MAAM,eAAe,GAAG;IACtB,OAAO,EAAE,iBAAiB;IAC1B,MAAM,EAAE,kBAAkB;IAC1B,WAAW,EAAE,qBAAqB;CACnC,CAAC;AAmLF;;;;;;;;;;GAUG;AACH,MAAM,OAAO,aAAa;IAoBxB;;;;OAIG;IACH,YAAY,IAA2B;QAf/B,eAAU,GAAW,wBAAwB,CAAC;QAgBpD,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QAClB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC;QACjC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC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iFromPortalUrl } from "./urls/getHubApiFromPortalUrl";
|
|
5
5
|
import { getPortalBaseFromOrgUrl } from "./urls/getPortalBaseFromOrgUrl";
|
|
6
6
|
/**
|
|
7
|
-
* ArcGIS Context Manager
|
|
8
|
-
*
|
|
9
7
|
* The manager exposes context (`IArcGISContext`), which combines a `UserSession` with
|
|
10
8
|
* the `portal/self` and `user/self` responses to provide a central lookup for platform
|
|
11
9
|
* information, api urls, and other useful properties for developers such as IRequestOptions
|
|
@@ -16,7 +14,7 @@ import { getPortalBaseFromOrgUrl } from "./urls/getPortalBaseFromOrgUrl";
|
|
|
16
14
|
* changes on that single property, instead of having to leverage observers or events
|
|
17
15
|
* for change detection.
|
|
18
16
|
*
|
|
19
|
-
*
|
|
17
|
+
* Please see the [ArcGISContext Guide](/hub.js/guides/context) for additional information.
|
|
20
18
|
*
|
|
21
19
|
*/
|
|
22
20
|
export class ArcGISContextManager {
|
|
@@ -35,6 +33,9 @@ export class ArcGISContextManager {
|
|
|
35
33
|
}
|
|
36
34
|
Logger.setLogLevel(this._logLevel);
|
|
37
35
|
Logger.debug(`ArcGISContextManager:ctor: Creating ${this.id}`);
|
|
36
|
+
if (opts.properties) {
|
|
37
|
+
this._properties = opts.properties;
|
|
38
|
+
}
|
|
38
39
|
if (opts.authentication) {
|
|
39
40
|
this._authentication = opts.authentication;
|
|
40
41
|
this._portalUrl = this._authentication.portal.replace("/sharing/rest", "");
|
|
@@ -55,7 +56,12 @@ export class ArcGISContextManager {
|
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
/**
|
|
58
|
-
*
|
|
59
|
+
* Used to create a new instance of the ArcGISContext class.
|
|
60
|
+
*
|
|
61
|
+
* ```js
|
|
62
|
+
* const ctxMgr = await ArcGISContextManager.create();
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
59
65
|
* @param opts
|
|
60
66
|
* @returns
|
|
61
67
|
*/
|
|
@@ -75,6 +81,14 @@ export class ArcGISContextManager {
|
|
|
75
81
|
this._portalUrl = auth.portal.replace("/sharing/rest", "");
|
|
76
82
|
await this.initialize();
|
|
77
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Set the properties hash and re-create the context
|
|
86
|
+
* @param properties
|
|
87
|
+
*/
|
|
88
|
+
setProperties(properties) {
|
|
89
|
+
this._properties = properties;
|
|
90
|
+
this._context = new ArcGISContext(this.contextOpts);
|
|
91
|
+
}
|
|
78
92
|
/**
|
|
79
93
|
* Clear the Authentication (UserSession). This should be
|
|
80
94
|
* called when a user signs out of an application, but
|
|
@@ -90,11 +104,7 @@ export class ArcGISContextManager {
|
|
|
90
104
|
this._authentication = null;
|
|
91
105
|
this._portalSelf = null;
|
|
92
106
|
this._currentUser = null;
|
|
93
|
-
this._context = new ArcGISContext(
|
|
94
|
-
id: this.id,
|
|
95
|
-
portalUrl: this._portalUrl,
|
|
96
|
-
hubUrl: this._hubUrl,
|
|
97
|
-
});
|
|
107
|
+
this._context = new ArcGISContext(this.contextOpts);
|
|
98
108
|
}
|
|
99
109
|
/**
|
|
100
110
|
* Return a reference to the current state.
|
|
@@ -144,6 +154,7 @@ export class ArcGISContextManager {
|
|
|
144
154
|
id: this.id,
|
|
145
155
|
portalUrl: this._portalUrl,
|
|
146
156
|
hubUrl: this._hubUrl,
|
|
157
|
+
properties: this._properties,
|
|
147
158
|
};
|
|
148
159
|
if (this._authentication) {
|
|
149
160
|
contextOpts.authentication = this._authentication;
|
|
@@ -1 +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,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;aACH;YAAC,OAAO,EAAE,EAAE;gBACX,MAAM,GAAG,GAAG,2DAA2D,IAAI,CAAC,eAAe,CAAC,QAAQ,WAAW,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC;gBAC9I,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBAClB,sCAAsC;gBACtC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACnB,MAAM,EAAE,CAAC;aACV;SACF;QACD,MAAM,CAAC,KAAK,CAAC,wBAAwB,IAAI,CAAC,EAAE,oBAAoB,CAAC,CAAC;QAClE,qBAAqB;QACrB,IAAI,CAAC,QAAQ,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACtD,CAAC;IAED;;OAEG;IACH,IAAY,WAAW;QACrB,MAAM,WAAW,GAA0B;YACzC,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,SAAS,EAAE,IAAI,CAAC,UAAU;YAC1B,MAAM,EAAE,IAAI,CAAC,OAAO;YACpB,UAAU,EAAE,IAAI,CAAC,WAAW;SAC7B,CAAC;QACF,IAAI,IAAI,CAAC,eAAe,EAAE;YACxB,WAAW,CAAC,cAAc,GAAG,IAAI,CAAC,eAAe,CAAC;SACnD;QACD,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,WAAW,CAAC,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC;SAC3C;QACD,IAAI,IAAI,CAAC,YAAY,EAAE;YACrB,WAAW,CAAC,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC;SAC7C;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ArcGISContextManager, } from "./ArcGISContextManager";
|
|
2
|
+
import { HubProjectManager } from "./projects/HubProjectManager";
|
|
3
|
+
/**
|
|
4
|
+
* Hub class can be used as an entry point to managing
|
|
5
|
+
* content, teams, sites, projects etc, in an organization's Hub.
|
|
6
|
+
*
|
|
7
|
+
* ```js
|
|
8
|
+
* import {Hub} from '@esri/hub-common';
|
|
9
|
+
* // create a Hub instance, authenticating as a specific user
|
|
10
|
+
* // working against arcgis online
|
|
11
|
+
* const myHub = await Hub.create({authOptions: {username: "casey", password: "jones"}});
|
|
12
|
+
*
|
|
13
|
+
* myHub.context.currentUser //=> {username: "casey", ...} as IUser
|
|
14
|
+
*
|
|
15
|
+
* const projectStore = await myHub.getProjectStore();
|
|
16
|
+
*
|
|
17
|
+
* const pavingProject = await projectStore.create({name: "12th Street Paving"});
|
|
18
|
+
* pavingProject.summary = "This is the 2024 planned paving of 12th Street, between 8th and 11th Ave";
|
|
19
|
+
* await projectStore.update(pavingProject);
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* This is a convenience class. Hub Stores can be created
|
|
23
|
+
* directly, or the underlying functions can be imported an used
|
|
24
|
+
* as need for scenarios where these class structures introduce
|
|
25
|
+
* unwanted complexity
|
|
26
|
+
*/
|
|
27
|
+
export class Hub {
|
|
28
|
+
/**
|
|
29
|
+
* Private so we can employ a factory function should we need
|
|
30
|
+
* async work during creation
|
|
31
|
+
* @param contextManager
|
|
32
|
+
*/
|
|
33
|
+
constructor(contextManager) {
|
|
34
|
+
this._contextManager = contextManager;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Factory function to construct a new HubProjectStore instance.
|
|
38
|
+
*
|
|
39
|
+
* Note: Used so that we could do async actions in the ctor.
|
|
40
|
+
* @param contextManager
|
|
41
|
+
* @returns
|
|
42
|
+
*/
|
|
43
|
+
static async create(options) {
|
|
44
|
+
if (options.contextManager) {
|
|
45
|
+
return new Hub(options.contextManager);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
const opts = options.managerOptions || {};
|
|
49
|
+
const mgr = await ArcGISContextManager.create(opts);
|
|
50
|
+
return new Hub(mgr);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Getter to abstract the context manager
|
|
55
|
+
*/
|
|
56
|
+
get context() {
|
|
57
|
+
return this._contextManager.context;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Create a Project Store connected to the current Hub
|
|
61
|
+
* @returns
|
|
62
|
+
*/
|
|
63
|
+
get projects() {
|
|
64
|
+
if (!this._projectManager) {
|
|
65
|
+
this._projectManager = HubProjectManager.init(this._contextManager);
|
|
66
|
+
}
|
|
67
|
+
return this._projectManager;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# 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,MAAM,OAAO,GAAG;IAYd;;;;OAIG;IACH,YAAoB,cAAoC;QACtD,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;IACxC,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAoB;QACtC,IAAI,OAAO,CAAC,cAAc,EAAE;YAC1B,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;SACxC;aAAM;YACL,MAAM,IAAI,GAAG,OAAO,CAAC,cAAc,IAAI,EAAE,CAAC;YAC1C,MAAM,GAAG,GAAG,MAAM,oBAAoB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YACpD,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;SACrB;IACH,CAAC;IAED;;OAEG;IACH,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC;IACtC,CAAC;IAED;;;OAGG;IACH,IAAI,QAAQ;QACV,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;YACzB,IAAI,CAAC,eAAe,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;SACrE;QAED,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;CACF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { getWithDefault, OperationError } from ".";
|
|
2
|
+
/**
|
|
3
|
+
* Generic Hub Error with an Error stack as well
|
|
4
|
+
* as an optional serialized OperationStack.
|
|
5
|
+
*
|
|
6
|
+
* Also accepts a `rootCause` Error object
|
|
7
|
+
*/
|
|
8
|
+
export default class HubError extends OperationError {
|
|
9
|
+
/**
|
|
10
|
+
* Creates an instance of HubError.
|
|
11
|
+
* @param {string} operation
|
|
12
|
+
* @param {string} [message]
|
|
13
|
+
* @param {Error} [rootCause]
|
|
14
|
+
* @memberof HubError
|
|
15
|
+
*/
|
|
16
|
+
constructor(operation, message, rootCause) {
|
|
17
|
+
message = message || "UNKNOWN_ERROR";
|
|
18
|
+
// if the rootCause has a .rootCause, use that so we don't deeply nest
|
|
19
|
+
rootCause = getWithDefault(rootCause, "rootCause", rootCause);
|
|
20
|
+
/* Skip coverage on super(...) as per:
|
|
21
|
+
https://github.com/Microsoft/TypeScript/issues/13029
|
|
22
|
+
https://github.com/SitePen/remap-istanbul/issues/106
|
|
23
|
+
*/
|
|
24
|
+
/* istanbul ignore next */
|
|
25
|
+
super(operation, message, rootCause);
|
|
26
|
+
this.name = "HubError";
|
|
27
|
+
// if the original error has a stack use it, otherwise create a new
|
|
28
|
+
// stack. Note: a new Stack will make it look like the error origninated
|
|
29
|
+
// in the HubError constructor. This is only an issue in tests but
|
|
30
|
+
// it can be confusing to debug
|
|
31
|
+
this.stack = getWithDefault(rootCause, "stack", new Error().stack);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# 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,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,cAAc;IAClD;;;;;;OAMG;IACH,YAAY,SAAiB,EAAE,OAAgB,EAAE,SAAiB;QAChE,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,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;QACrC,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,mEAAmE;QACnE,wEAAwE;QACxE,kEAAkE;QAClE,+BAA+B;QAC/B,IAAI,CAAC,KAAK,GAAG,cAAc,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC;IACrE,CAAC;CACF"}
|
|
@@ -114,6 +114,29 @@ const other = [
|
|
|
114
114
|
"Workflow Manager Package",
|
|
115
115
|
];
|
|
116
116
|
const 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 const getCollection = (type) => {
|
|
129
|
+
if (!type) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const lowerCaseType = type.toLocaleLowerCase();
|
|
133
|
+
return Object.keys(collections).find((key) => {
|
|
134
|
+
const collectionTypes = collections[key];
|
|
135
|
+
return collectionTypes.some((t) => 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 const collections = {
|
|
118
141
|
app,
|
|
119
142
|
dataset,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collections.js","sourceRoot":"","sources":["../../src/collections.ts"],"names":[],"mappings":"AAAA,MAAM,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,MAAM,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,MAAM,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,MAAM,KAAK,GAAa,CAAC,WAAW,CAAC,CAAC;AAEtC,MAAM,QAAQ,GAAa,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;AAE7D,MAAM,UAAU,GAAa,CAAC,gBAAgB,CAAC,CAAC;AAEhD,MAAM,QAAQ,GAAa,CAAC,UAAU,CAAC,CAAC;AAExC,MAAM,QAAQ,GAAa,CAAC,yBAAyB,CAAC,CAAC;AAEvD,MAAM,GAAG,GAAa;IACpB,kBAAkB;IAClB,eAAe;IACf,mBAAmB;IACnB,aAAa;IACb,eAAe;IACf,aAAa;IACb,qBAAqB;IACrB,iBAAiB;IACjB,sBAAsB;IACtB,SAAS;IACT,WAAW;IACX,KAAK;IACL,KAAK;IACL,MAAM;CACP,CAAC;AAEF,MAAM,KAAK,GAAa;IACtB,mBAAmB;IACnB,2BAA2B;IAC3B,2BAA2B;IAC3B,gBAAgB;IAChB,iBAAiB;IACjB,aAAa;IACb,gBAAgB;IAChB,8BAA8B;IAC9B,qBAAqB;IACrB,eAAe;IACf,iBAAiB;IACjB,gBAAgB;IAChB,mBAAmB;IACnB,kBAAkB;IAClB,uBAAuB;IACvB,sBAAsB;IACtB,uBAAuB;IACvB,YAAY;IACZ,eAAe;IACf,gBAAgB;IAChB,OAAO;IACP,QAAQ;IACR,iBAAiB;IACjB,UAAU;IACV,cAAc;IACd,aAAa;IACb,wBAAwB;IACxB,cAAc;IACd,oBAAoB;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,0BAA0B;IAC1B,6BAA6B;IAC7B,iBAAiB;IACjB,kBAAkB;IAClB,0BAA0B;IAC1B,cAAc;IACd,eAAe;IACf,oBAAoB;IACpB,oBAAoB;IACpB,OAAO;IACP,cAAc;IACd,qBAAqB;IACrB,0BAA0B;CAC3B,CAAC;AAEF,MAAM,IAAI,GAAa,CAAC,sBAAsB,EAAE,kBAAkB,CAAC,CAAC;AAEpE,MAAM,CAAC,MAAM,WAAW,GAAgC;IACtD,GAAG;IACH,OAAO;IACP,QAAQ;IACR,KAAK;IACL,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,GAAG;IACH,KAAK;IACL,IAAI;CACL,CAAC"}
|
|
1
|
+
{"version":3,"file":"collections.js","sourceRoot":"","sources":["../../src/collections.ts"],"names":[],"mappings":"AAAA,MAAM,GAAG,GAAa;IACpB,aAAa;IACb,uBAAuB;IACvB,sBAAsB;IACtB,WAAW;IACX,eAAe;IACf,mBAAmB;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62
62
|
};
|
|
63
63
|
};
|
|
64
|
+
const MAX_SIZE = 5000000;
|
|
65
|
+
/**
|
|
66
|
+
* Returns whether or not an item is a proxied csv
|
|
67
|
+
*
|
|
68
|
+
* @param item
|
|
69
|
+
* @param requestOptions Hub Request Options (including whether we're in portal)
|
|
70
|
+
* @returns
|
|
71
|
+
*/
|
|
72
|
+
export const isProxiedCSV = (item, requestOptions) => !requestOptions.isPortal &&
|
|
73
|
+
item.access === "public" &&
|
|
74
|
+
item.type === "CSV" &&
|
|
75
|
+
item.size <= MAX_SIZE;
|
|
64
76
|
//# 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,MAAM,kBAAkB,GAAG,CAChC,OAAoB,EACpB,QAA6B,EAC7B,EAAE;IACF,qCAAqC;IACrC,MAAM,UAAU,mCAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,IAAI,EAAE,CAAC,KAAE,QAAQ,GAAE,CAAC;IACpE,MAAM,IAAI,mCAAQ,OAAO,CAAC,IAAI,KAAE,UAAU,GAAE,CAAC;IAC7C,MAAM,OAAO,mCAAQ,OAAO,KAAE,IAAI,GAAE,CAAC;IACrC,uCAAY,OAAO,KAAE,QAAQ,EAAE,kBAAkB,CAAC,OAAO,CAAC,IAAG;AAC/D,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,OAAoB,EACpB,MAAY,EACC,EAAE;IACf,mCAAmC;IACnC,MAAM,IAAI,mCAAQ,OAAO,C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|
|
@@ -5,8 +5,9 @@ import { includes, isGuid } from "../utils";
|
|
|
5
5
|
import { getProp } from "../objects";
|
|
6
6
|
import { getStructuredLicense } from "../items/get-structured-license";
|
|
7
7
|
import { getServiceTypeFromUrl } from "../urls";
|
|
8
|
-
import { setContentExtent } from "./_internal";
|
|
8
|
+
import { setContentExtent, isProxiedCSV } from "./_internal";
|
|
9
9
|
import { camelize } from "../util";
|
|
10
|
+
// private helper functions
|
|
10
11
|
function collectionToFamily(collection) {
|
|
11
12
|
const overrides = {
|
|
12
13
|
other: "content",
|
|
@@ -606,7 +607,7 @@ export function datasetToItem(dataset) {
|
|
|
606
607
|
}
|
|
607
608
|
/**
|
|
608
609
|
* returns a new content that has the specified type and
|
|
609
|
-
* and updated related properties like
|
|
610
|
+
* and updated related properties like, family, etc
|
|
610
611
|
* @param content orignal content
|
|
611
612
|
* @param type new type
|
|
612
613
|
* @returns new content
|
|
@@ -617,9 +618,8 @@ export const setContentType = (content, type) => {
|
|
|
617
618
|
const family = getFamily(normalizedType);
|
|
618
619
|
const contentTypeIcon = getContentTypeIcon(normalizedType);
|
|
619
620
|
const contentTypeLabel = getContentTypeLabel(normalizedType, content.isProxied);
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
family,
|
|
621
|
+
const updated = Object.assign(Object.assign({}, content), { type: normalizedType, family,
|
|
622
|
+
// TODO: remove this at next breaking change now that it has been deprecated
|
|
623
623
|
normalizedType,
|
|
624
624
|
contentTypeIcon,
|
|
625
625
|
contentTypeLabel });
|
|
@@ -630,23 +630,26 @@ export const setContentType = (content, type) => {
|
|
|
630
630
|
});
|
|
631
631
|
};
|
|
632
632
|
/**
|
|
633
|
-
* Compute the content type icon based on the
|
|
634
|
-
* @param
|
|
633
|
+
* Compute the content type icon based on the content type
|
|
634
|
+
* @param content type
|
|
635
635
|
* @returns content type icon
|
|
636
636
|
*/
|
|
637
|
-
export const getContentTypeIcon = (
|
|
637
|
+
export const getContentTypeIcon = (contentType) => {
|
|
638
638
|
var _a;
|
|
639
|
-
const type = camelize(
|
|
639
|
+
const type = camelize(contentType || "");
|
|
640
640
|
const iconMap = {
|
|
641
641
|
appbuilderExtension: "file",
|
|
642
642
|
appbuilderWidgetPackage: "widgets-source",
|
|
643
643
|
application: "web",
|
|
644
|
+
applicationConfiguration: "app-gear",
|
|
644
645
|
arcgisProMap: "desktop",
|
|
645
646
|
cadDrawing: "file-cad",
|
|
646
647
|
cityEngineWebScene: "urban-model",
|
|
647
648
|
codeAttachment: "file-code",
|
|
649
|
+
codeSample: "file-code",
|
|
648
650
|
colorSet: "palette",
|
|
649
651
|
contentCategorySet: "label",
|
|
652
|
+
csv: "file-csv",
|
|
650
653
|
cSV: "file-csv",
|
|
651
654
|
cSVCollection: "file-csv",
|
|
652
655
|
dashboard: "dashboard",
|
|
@@ -668,8 +671,8 @@ export const getContentTypeIcon = (normalizedType) => {
|
|
|
668
671
|
geoprocessingService: "file",
|
|
669
672
|
globeLayer: "layers",
|
|
670
673
|
globeService: "file",
|
|
671
|
-
hubInitiative: "
|
|
672
|
-
hubInitiativeTemplate: "initiative-template
|
|
674
|
+
hubInitiative: "initiative",
|
|
675
|
+
hubInitiativeTemplate: "initiative-template",
|
|
673
676
|
hubPage: "browser",
|
|
674
677
|
hubSiteApplication: "web",
|
|
675
678
|
image: "file-image",
|
|
@@ -685,6 +688,7 @@ export const getContentTypeIcon = (normalizedType) => {
|
|
|
685
688
|
kMLCollection: "data",
|
|
686
689
|
layer: "layers",
|
|
687
690
|
layerPackage: "layers",
|
|
691
|
+
layerTemplate: "file",
|
|
688
692
|
locatorPackage: "file",
|
|
689
693
|
mapArea: "file",
|
|
690
694
|
mapDocument: "map-contents",
|
|
@@ -707,6 +711,7 @@ export const getContentTypeIcon = (normalizedType) => {
|
|
|
707
711
|
orthoMappingTemplate: "file",
|
|
708
712
|
pDF: "file-pdf",
|
|
709
713
|
quickCaptureProject: "mobile",
|
|
714
|
+
rasterFunctionTemplate: "file",
|
|
710
715
|
rasterLayer: "map",
|
|
711
716
|
realTimeAnalytic: "file",
|
|
712
717
|
relationalDatabaseConnection: "file",
|
|
@@ -715,19 +720,23 @@ export const getContentTypeIcon = (normalizedType) => {
|
|
|
715
720
|
sceneService: "urban-model",
|
|
716
721
|
serviceDefinition: "file",
|
|
717
722
|
shapefile: "data",
|
|
718
|
-
solution: "
|
|
723
|
+
solution: "puzzle-piece",
|
|
719
724
|
sqliteGeodatabase: "file",
|
|
720
725
|
statisticalDataCollection: "file",
|
|
726
|
+
storymap: "tour",
|
|
721
727
|
storyMap: "tour",
|
|
728
|
+
storymapTheme: "palette",
|
|
722
729
|
symbolSet: "file",
|
|
723
730
|
table: "table",
|
|
724
731
|
urbanModel: "urban-model",
|
|
732
|
+
vectorTilePackage: "file-shape",
|
|
725
733
|
vectorTileService: "map",
|
|
726
734
|
visioDocument: "conditional-rules",
|
|
727
735
|
webExperience: "apps",
|
|
728
736
|
webMap: "map",
|
|
729
737
|
webMappingApplication: "apps",
|
|
730
738
|
webScene: "urban-model",
|
|
739
|
+
wfs: "map",
|
|
731
740
|
wFS: "map",
|
|
732
741
|
wMS: "map",
|
|
733
742
|
wMTS: "map",
|
|
@@ -738,12 +747,12 @@ export const getContentTypeIcon = (normalizedType) => {
|
|
|
738
747
|
};
|
|
739
748
|
/**
|
|
740
749
|
* Compute the content type label
|
|
741
|
-
* @param
|
|
750
|
+
* @param contentType
|
|
742
751
|
* @param isProxied
|
|
743
752
|
* @returns content type label
|
|
744
753
|
*/
|
|
745
|
-
export const getContentTypeLabel = (
|
|
746
|
-
return isProxied ? "CSV" : camelize(
|
|
754
|
+
export const getContentTypeLabel = (contentType, isProxied) => {
|
|
755
|
+
return isProxied ? "CSV" : camelize(contentType || "");
|
|
747
756
|
};
|
|
748
757
|
/**
|
|
749
758
|
* returns a new content that has the specified hubId and updated identifier
|
|
@@ -836,8 +845,8 @@ const getContentRelativeUrl = (content, siteIdentifier) => {
|
|
|
836
845
|
const getSolutionUrl = (content) => {
|
|
837
846
|
var _a;
|
|
838
847
|
let hubUrl;
|
|
839
|
-
const {
|
|
840
|
-
if (
|
|
848
|
+
const { type, identifier } = content;
|
|
849
|
+
if (type === "Solution") {
|
|
841
850
|
// NOTE: as per the above spreadsheet,
|
|
842
851
|
// solution types are now in the Template family
|
|
843
852
|
// but we don't send them to the route for initiative templates
|
|
@@ -854,6 +863,21 @@ const getSolutionUrl = (content) => {
|
|
|
854
863
|
// TODO: we check both "Hub Page" and "Site Page" because we don't know whether the site is a portal or not
|
|
855
864
|
// In the future, the site object will have a site.isPortal() function that we can leverage
|
|
856
865
|
// instead of hardcoding the types here.
|
|
857
|
-
// TODO: should this be based on normalizedType instead?
|
|
858
866
|
const isPageContent = (content) => includes(["Hub Page", "Site Page"], content.type);
|
|
867
|
+
// proxied csv helpers
|
|
868
|
+
/**
|
|
869
|
+
* If an item is a proxied csv, returns the url for the proxying feature layer.
|
|
870
|
+
* If the item is not a proxied csv, returns undefined.
|
|
871
|
+
*
|
|
872
|
+
* @param item
|
|
873
|
+
* @param requestOptions Hub Request Options (including whether we're in portal)
|
|
874
|
+
* @returns
|
|
875
|
+
*/
|
|
876
|
+
export const getProxyUrl = (item, requestOptions) => {
|
|
877
|
+
let result;
|
|
878
|
+
if (isProxiedCSV(item, requestOptions)) {
|
|
879
|
+
result = `${requestOptions.hubApiUrl}/datasets/${item.id}_0/FeatureServer/0`;
|
|
880
|
+
}
|
|
881
|
+
return result;
|
|
882
|
+
};
|
|
859
883
|
//# sourceMappingURL=index.js.map
|