@esri/hub-common 9.14.1 → 9.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es2017/ArcGISContext.js +11 -0
- package/dist/es2017/ArcGISContext.js.map +1 -1
- package/dist/es2017/ArcGISContextManager.js +13 -5
- 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 +35 -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 +30 -15
- 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 +15 -0
- package/dist/esm/ArcGISContext.js.map +1 -1
- package/dist/esm/ArcGISContextManager.js +13 -5
- 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 +41 -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 +30 -15
- 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 +11 -0
- package/dist/node/ArcGISContext.js.map +1 -1
- package/dist/node/ArcGISContextManager.js +13 -5
- 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 +38 -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 +30 -15
- 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 +16 -1
- package/dist/types/ArcGISContextManager.d.ts +14 -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 -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 +4588 -3687
- 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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HubProjectManager.js","sourceRoot":"","sources":["../../../src/projects/HubProjectManager.ts"],"names":[],"mappings":";;;AAEA,+CAKuB;AACvB,mDAAmD;AACnD,kEAA+D;AAC/D,0BAA8C;AAG9C;;;;;;GAMG;AACH,MAAa,iBAAiB;IAgB5B;;;;OAIG;IACH,YAAoB,gBAAuD;QACzE,IAAI,gBAAgB,YAAY,2CAAoB,EAAE;YACpD,IAAI,CAAC,eAAe,GAAG,gBAAgB,CAAC;SACzC;aAAM;YACL,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC;SAClC;IACH,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,CACT,gBAAuD;QAEvD,OAAO,IAAI,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IACjD,CAAC;IAED;;OAEG;IACH,IAAY,OAAO;QACjB,IAAI,IAAI,CAAC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C,KAAK,CACT,UAAkB,EAClB,cAAgC;QAEhC,IAAI,cAAc,IAAI,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE;YACjD,OAAO,wBAAU,CACf,UAAU,EACV,cAAc,IAAI,IAAI,CAAC,OAAO,CAAC,cAAc,CAC9C,CAAC;SACH;aAAM;YACL,MAAM,IAAI,YAAQ,CAChB,aAAa,EACb,4GAA4G,CAC7G,CAAC;SACH;IACH,CAAC;CAgBF;AAzKD,8CAyKC"}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.destroyProject = exports.getProject = exports.updateProject = exports.createProject = exports.HUB_PROJECT_ITEM_TYPE = void 0;
|
|
4
|
+
// Note - we separate these imports so we can cleanly spy on things in tests
|
|
5
|
+
const models_1 = require("../models");
|
|
6
|
+
const slugs_1 = require("../items/slugs");
|
|
7
|
+
const __1 = require("..");
|
|
8
|
+
const arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
|
|
9
|
+
const PropertyMapper_1 = require("../core/helpers/PropertyMapper");
|
|
10
|
+
exports.HUB_PROJECT_ITEM_TYPE = "Web Mapping Application";
|
|
11
|
+
/**
|
|
12
|
+
* Default values of a IHubProject
|
|
13
|
+
*/
|
|
14
|
+
const DEFAULT_PROJECT = {
|
|
15
|
+
name: "No title provided",
|
|
16
|
+
tags: [],
|
|
17
|
+
typeKeywords: ["IHubProject", "HubProject"],
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Default values for a new HubProject Model
|
|
21
|
+
*/
|
|
22
|
+
const DEFAULT_PROJECT_MODEL = {
|
|
23
|
+
item: {
|
|
24
|
+
type: exports.HUB_PROJECT_ITEM_TYPE,
|
|
25
|
+
title: "No Title Provided",
|
|
26
|
+
description: "No Description Provided",
|
|
27
|
+
snippet: "",
|
|
28
|
+
tags: [],
|
|
29
|
+
typeKeywords: [],
|
|
30
|
+
properties: {
|
|
31
|
+
slug: "",
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
data: {
|
|
35
|
+
display: "about",
|
|
36
|
+
timeline: {},
|
|
37
|
+
org: {},
|
|
38
|
+
status: "inactive",
|
|
39
|
+
contacts: [],
|
|
40
|
+
schemaVersion: 1,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Returns an Array of IPropertyMap objects
|
|
45
|
+
* We could define these directly, but since the
|
|
46
|
+
* properties of IHubProject map directly to properties
|
|
47
|
+
* on item or data, it's slightly less verbose to
|
|
48
|
+
* generate the structure.
|
|
49
|
+
* @returns
|
|
50
|
+
*/
|
|
51
|
+
function getProjectPropertyMap() {
|
|
52
|
+
const itemProps = [
|
|
53
|
+
"created",
|
|
54
|
+
"culture",
|
|
55
|
+
"description",
|
|
56
|
+
"extent",
|
|
57
|
+
"id",
|
|
58
|
+
"modified",
|
|
59
|
+
"owner",
|
|
60
|
+
"snippet",
|
|
61
|
+
"tags",
|
|
62
|
+
"typeKeywords",
|
|
63
|
+
"url",
|
|
64
|
+
"type",
|
|
65
|
+
];
|
|
66
|
+
const dataProps = [
|
|
67
|
+
"contacts",
|
|
68
|
+
"display",
|
|
69
|
+
"geometry",
|
|
70
|
+
"headerImage",
|
|
71
|
+
"layout",
|
|
72
|
+
"location",
|
|
73
|
+
"status",
|
|
74
|
+
];
|
|
75
|
+
const map = [];
|
|
76
|
+
itemProps.forEach((entry) => {
|
|
77
|
+
map.push({ objectKey: entry, modelKey: `item.${entry}` });
|
|
78
|
+
});
|
|
79
|
+
dataProps.forEach((entry) => {
|
|
80
|
+
map.push({ objectKey: entry, modelKey: `data.${entry}` });
|
|
81
|
+
});
|
|
82
|
+
// Deeper mappings
|
|
83
|
+
map.push({
|
|
84
|
+
objectKey: "slug",
|
|
85
|
+
modelKey: "item.properties.slug",
|
|
86
|
+
});
|
|
87
|
+
map.push({
|
|
88
|
+
objectKey: "orgUrlKey",
|
|
89
|
+
modelKey: "item.properties.orgUrlKey",
|
|
90
|
+
});
|
|
91
|
+
map.push({
|
|
92
|
+
objectKey: "name",
|
|
93
|
+
modelKey: "item.title",
|
|
94
|
+
});
|
|
95
|
+
return map;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Create a new Hub Project item
|
|
99
|
+
*
|
|
100
|
+
* Minimal properties are name and org
|
|
101
|
+
*
|
|
102
|
+
* @param project
|
|
103
|
+
* @param requestOptions
|
|
104
|
+
*/
|
|
105
|
+
async function createProject(partialProject, requestOptions) {
|
|
106
|
+
// merge incoming with the default
|
|
107
|
+
// this expansion solves the typing somehow
|
|
108
|
+
const project = Object.assign(Object.assign({}, DEFAULT_PROJECT), partialProject);
|
|
109
|
+
// Create a slug from the title if one is not passed in
|
|
110
|
+
if (!project.slug) {
|
|
111
|
+
project.slug = slugs_1.constructSlug(project.name, project.orgUrlKey);
|
|
112
|
+
}
|
|
113
|
+
// Ensure slug is unique
|
|
114
|
+
project.slug = await slugs_1.getUniqueSlug(project.slug, requestOptions);
|
|
115
|
+
// add slug to keywords
|
|
116
|
+
project.typeKeywords = slugs_1.setSlugKeyword(project.typeKeywords, project.slug);
|
|
117
|
+
// Map project object onto a default project Model
|
|
118
|
+
const mapper = new PropertyMapper_1.PropertyMapper(getProjectPropertyMap());
|
|
119
|
+
// create model from object, using the default model as a starting point
|
|
120
|
+
let model = mapper.objectToModel(project, __1.cloneObject(DEFAULT_PROJECT_MODEL));
|
|
121
|
+
// create the item
|
|
122
|
+
model = await models_1.createModel(model, requestOptions);
|
|
123
|
+
// map the model back into a IHubProject
|
|
124
|
+
const newProject = mapper.modelToObject(model, {});
|
|
125
|
+
// and return it
|
|
126
|
+
return newProject;
|
|
127
|
+
}
|
|
128
|
+
exports.createProject = createProject;
|
|
129
|
+
/**
|
|
130
|
+
* Update a Hub Project
|
|
131
|
+
* @param project
|
|
132
|
+
* @param requestOptions
|
|
133
|
+
*/
|
|
134
|
+
async function updateProject(project, requestOptions) {
|
|
135
|
+
// verify that the slug is unique
|
|
136
|
+
// TODO: if the slug has not changed, we don't want to do this because
|
|
137
|
+
// the existing item will cause this to increment
|
|
138
|
+
project.slug = await slugs_1.getUniqueSlug(project.slug, requestOptions);
|
|
139
|
+
// get the backing item & data
|
|
140
|
+
const model = await models_1.getModel(project.id, requestOptions);
|
|
141
|
+
// create the PropertyMapper
|
|
142
|
+
const mapper = new PropertyMapper_1.PropertyMapper(getProjectPropertyMap());
|
|
143
|
+
// Note: Although we are fetching the model, and applying changes onto it,
|
|
144
|
+
// we are not attempting to handle "concurrent edit" conflict resolution
|
|
145
|
+
// but this is where we would apply that sort of logic
|
|
146
|
+
const modelToUpdate = mapper.objectToModel(project, model);
|
|
147
|
+
// update the backing item
|
|
148
|
+
const updatedModel = await models_1.updateModel(modelToUpdate, requestOptions);
|
|
149
|
+
// now map back into a project and return that
|
|
150
|
+
const updatedProject = mapper.modelToObject(updatedModel, project);
|
|
151
|
+
// the casting is needed because modelToObject returns a `Partial<T>`
|
|
152
|
+
// where as this function returns a `T`
|
|
153
|
+
return updatedProject;
|
|
154
|
+
}
|
|
155
|
+
exports.updateProject = updateProject;
|
|
156
|
+
/**
|
|
157
|
+
* Get a Hub Project by id or slug
|
|
158
|
+
* @param identifier item id or slug
|
|
159
|
+
* @param requestOptions
|
|
160
|
+
*/
|
|
161
|
+
function getProject(identifier, requestOptions) {
|
|
162
|
+
let getPrms;
|
|
163
|
+
if (__1.isGuid(identifier)) {
|
|
164
|
+
// get item by id
|
|
165
|
+
getPrms = models_1.getModel(identifier, requestOptions);
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
// search for item using filter=typekeywords:slug|identifier
|
|
169
|
+
getPrms = models_1.getModelBySlug(identifier, requestOptions);
|
|
170
|
+
}
|
|
171
|
+
return getPrms.then((model) => {
|
|
172
|
+
// transform the model into a HubProject
|
|
173
|
+
const mapper = new PropertyMapper_1.PropertyMapper(getProjectPropertyMap());
|
|
174
|
+
const project = mapper.modelToObject(model, {});
|
|
175
|
+
return project;
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
exports.getProject = getProject;
|
|
179
|
+
/**
|
|
180
|
+
* Remove a Hub Project
|
|
181
|
+
* @param id
|
|
182
|
+
* @param requestOptions
|
|
183
|
+
*/
|
|
184
|
+
async function destroyProject(id, requestOptions) {
|
|
185
|
+
const ro = Object.assign(Object.assign({}, requestOptions), { id });
|
|
186
|
+
await arcgis_rest_portal_1.removeItem(ro);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
exports.destroyProject = destroyProject;
|
|
190
|
+
// WIP: Need to resolve how best to execute this
|
|
191
|
+
// i.e. delegate to searchContent or just do an item search
|
|
192
|
+
// and convert to IHubProject objects.
|
|
193
|
+
//
|
|
194
|
+
// export async function searchProjects(
|
|
195
|
+
// filter: Filter<"content">,
|
|
196
|
+
// opts: IHubSearchOptions
|
|
197
|
+
// ): Promise<ISearchResponse<IHubProject>> {
|
|
198
|
+
// return _searchContent(filter, opts).then((results) => {
|
|
199
|
+
// })
|
|
200
|
+
// }
|
|
201
|
+
//# sourceMappingURL=HubProjects.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HubProjects.js","sourceRoot":"","sources":["../../../src/projects/HubProjects.ts"],"names":[],"mappings":";;;AAEA,4EAA4E;AAC5E,sCAA+E;AAC/E,0CAA8E;AAC9E,0BAQY;AACZ,iEAAwE;AAGxE,mEAA8E;AAGjE,QAAA,qBAAqB,GAAG,yBAAyB,CAAC;AAE/D;;GAEG;AACH,MAAM,eAAe,GAAyB;IAC5C,IAAI,EAAE,mBAAmB;IACzB,IAAI,EAAE,EAAE;IACR,YAAY,EAAE,CAAC,aAAa,EAAE,YAAY,CAAC;CAG5C,CAAC;AAEF;;GAEG;AACH,MAAM,qBAAqB,GAAG;IAC5B,IAAI,EAAE;QACJ,IAAI,EAAE,6BAAqB;QAC3B,KAAK,EAAE,mBAAmB;QAC1B,WAAW,EAAE,yBAAyB;QACtC,OAA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,CAAC;AApBD,gCAoBC;AAED;;;;GAIG;AACI,KAAK,UAAU,cAAc,CAClC,EAAU,EACV,cAAmC;IAEnC,MAAM,EAAE,GAAG,gCAAK,cAAc,GAAK,EAAE,EAAE,EAAE,CAAsB,CAAC;IAChE,MAAM,+BAAU,CAAC,EAAE,CAAC,CAAC;IACrB,OAAO;AACT,CAAC;AAPD,wCAOC;AAED,gDAAgD;AAChD,2DAA2D;AAC3D,sCAAsC;AACtC,EAAE;AACF,wCAAwC;AACxC,+BAA+B;AAC/B,4BAA4B;AAC5B,6CAA6C;AAC7C,4DAA4D;AAE5D,OAAO;AACP,IAAI"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./HubProjectManager"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./HubProjects"), exports);
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/projects/index.ts"],"names":[],"mappings":";;;AAAA,8DAAoC;AACpC,wDAA8B"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dasherize = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Dasherize a string
|
|
6
|
+
*
|
|
7
|
+
* ```javascript
|
|
8
|
+
* import { dasherize } from '@esri/hub-common';
|
|
9
|
+
* dasherize('innerHTML'); // 'inner-html'
|
|
10
|
+
* dasherize('action_name'); // 'action-name'
|
|
11
|
+
* dasherize('css-class-name'); // 'css-class-name'
|
|
12
|
+
* dasherize('my favorite items'); // 'my-favorite-items'
|
|
13
|
+
* dasherize('privateDocs/ownerInvoice'; // 'private-docs/owner-invoice'
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* Extracted and modified from Ember.js source code - MIT license
|
|
17
|
+
* @param value
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
function dasherize(value) {
|
|
21
|
+
const DECAMELIZE_REGEXP = /([a-z\d])([A-Z])/g;
|
|
22
|
+
const DASHERIZE_REGEXP = /[ _]/g;
|
|
23
|
+
return value
|
|
24
|
+
.replace(DECAMELIZE_REGEXP, "$1_$2")
|
|
25
|
+
.toLowerCase()
|
|
26
|
+
.replace(DASHERIZE_REGEXP, "-");
|
|
27
|
+
}
|
|
28
|
+
exports.dasherize = dasherize;
|
|
29
|
+
//# sourceMappingURL=dasherize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dasherize.js","sourceRoot":"","sources":["../../../src/utils/dasherize.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,SAAS,CAAC,KAAa;IACrC,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;IAC9C,MAAM,gBAAgB,GAAG,OAAO,CAAC;IACjC,OAAO,KAAK;SACT,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC;SACnC,WAAW,EAAE;SACb,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC;AACpC,CAAC;AAPD,8BAOC"}
|
package/dist/node/utils/index.js
CHANGED
|
@@ -19,4 +19,5 @@ tslib_1.__exportStar(require("./logger"), exports);
|
|
|
19
19
|
tslib_1.__exportStar(require("./is-update-group"), exports);
|
|
20
20
|
tslib_1.__exportStar(require("./revertable-tasks"), exports);
|
|
21
21
|
tslib_1.__exportStar(require("./sessionLocalStorage"), exports);
|
|
22
|
+
tslib_1.__exportStar(require("./dasherize"), exports);
|
|
22
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,kDAAwB;AACxB,iEAAuC;AACvC,sEAA4C;AAC5C,sDAA4B;AAC5B,mEAAyC;AACzC,4DAAkC;AAClC,kEAAwC;AACxC,qDAA2B;AAC3B,oDAA0B;AAC1B,mDAAyB;AACzB,oDAA0B;AAC1B,4DAAkC;AAClC,2DAAiC;AACjC,6DAAmC;AACnC,mDAAyB;AACzB,4DAAkC;AAClC,6DAAmC;AACnC,gEAAsC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,kDAAwB;AACxB,iEAAuC;AACvC,sEAA4C;AAC5C,sDAA4B;AAC5B,mEAAyC;AACzC,4DAAkC;AAClC,kEAAwC;AACxC,qDAA2B;AAC3B,oDAA0B;AAC1B,mDAAyB;AACzB,oDAA0B;AAC1B,4DAAkC;AAClC,2DAAiC;AACjC,6DAAmC;AACnC,mDAAyB;AACzB,4DAAkC;AAClC,6DAAmC;AACnC,gEAAsC;AACtC,sDAA4B"}
|
|
@@ -125,6 +125,10 @@ export interface IArcGISContext {
|
|
|
125
125
|
* Returns the portal object
|
|
126
126
|
*/
|
|
127
127
|
portal: IPortal;
|
|
128
|
+
/**
|
|
129
|
+
* Additional app-specific context
|
|
130
|
+
*/
|
|
131
|
+
properties: Record<string, any>;
|
|
128
132
|
}
|
|
129
133
|
/**
|
|
130
134
|
* Options for the ArcGISContext constructor
|
|
@@ -146,7 +150,7 @@ export interface IArcGISContextOptions {
|
|
|
146
150
|
/**
|
|
147
151
|
* Hub Url that corresponds to the portal url is appropritate
|
|
148
152
|
*/
|
|
149
|
-
hubUrl
|
|
153
|
+
hubUrl?: string;
|
|
150
154
|
/**
|
|
151
155
|
* The current UserSession
|
|
152
156
|
*/
|
|
@@ -165,6 +169,10 @@ export interface IArcGISContextOptions {
|
|
|
165
169
|
* ArcGISContextManager handles this internally
|
|
166
170
|
*/
|
|
167
171
|
currentUser?: IUser;
|
|
172
|
+
/**
|
|
173
|
+
* Optional hash of additional context
|
|
174
|
+
*/
|
|
175
|
+
properties?: Record<string, any>;
|
|
168
176
|
}
|
|
169
177
|
/**
|
|
170
178
|
* Abstraction that holds a `UserSession`, along with
|
|
@@ -190,6 +198,7 @@ export declare class ArcGISContext implements IArcGISContext {
|
|
|
190
198
|
private _hubUrl;
|
|
191
199
|
private _portalSelf;
|
|
192
200
|
private _currentUser;
|
|
201
|
+
private _properties;
|
|
193
202
|
/**
|
|
194
203
|
* Create a new instance of `ArcGISContext`.
|
|
195
204
|
*
|
|
@@ -302,4 +311,10 @@ export declare class ArcGISContext implements IArcGISContext {
|
|
|
302
311
|
* Returns the portal object as IPortal
|
|
303
312
|
*/
|
|
304
313
|
get portal(): IPortal;
|
|
314
|
+
/**
|
|
315
|
+
* Return the properties hash that was passed in.
|
|
316
|
+
* Useful for app-specific context such as the active
|
|
317
|
+
* Site for ArcGIS Hub
|
|
318
|
+
*/
|
|
319
|
+
get properties(): Record<string, any>;
|
|
305
320
|
}
|
|
@@ -32,6 +32,14 @@ export interface IArcGISContextManagerOptions {
|
|
|
32
32
|
* it will be fetched.
|
|
33
33
|
*/
|
|
34
34
|
currentUser?: IUser;
|
|
35
|
+
/**
|
|
36
|
+
* Any additional properties to expose on the context. This allows
|
|
37
|
+
* an application to send additional context into the system.
|
|
38
|
+
* For example, in ArcGIS Hub, many times we want to pass in the
|
|
39
|
+
* active "Hub Site" as additional context, so we will send that in
|
|
40
|
+
* as a node on a properties object.
|
|
41
|
+
*/
|
|
42
|
+
properties?: Record<string, any>;
|
|
35
43
|
/**
|
|
36
44
|
* Logging level
|
|
37
45
|
* off > error > warn > info > debug > all
|
|
@@ -63,6 +71,7 @@ export declare class ArcGISContextManager {
|
|
|
63
71
|
private _context;
|
|
64
72
|
private _authentication;
|
|
65
73
|
private _portalUrl;
|
|
74
|
+
private _properties;
|
|
66
75
|
private _hubUrl;
|
|
67
76
|
private _portalSelf;
|
|
68
77
|
private _currentUser;
|
|
@@ -91,6 +100,11 @@ export declare class ArcGISContextManager {
|
|
|
91
100
|
* @param auth
|
|
92
101
|
*/
|
|
93
102
|
setAuthentication(auth: UserSession): Promise<void>;
|
|
103
|
+
/**
|
|
104
|
+
* Set the properties hash and re-create the context
|
|
105
|
+
* @param properties
|
|
106
|
+
*/
|
|
107
|
+
setProperties(properties: Record<string, any>): void;
|
|
94
108
|
/**
|
|
95
109
|
* Clear the Authentication (UserSession). This should be
|
|
96
110
|
* called when a user signs out of an application, but
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { ArcGISContextManager, IArcGISContextManagerOptions } from "./ArcGISContextManager";
|
|
2
|
+
import { HubProjectManager } from "./projects/HubProjectManager";
|
|
3
|
+
/**
|
|
4
|
+
* Options for instantiating a Hub instance
|
|
5
|
+
*/
|
|
6
|
+
export interface IHubOptions {
|
|
7
|
+
contextManager?: ArcGISContextManager;
|
|
8
|
+
managerOptions?: IArcGISContextManagerOptions;
|
|
9
|
+
authOptions?: {
|
|
10
|
+
usename: string;
|
|
11
|
+
password: string;
|
|
12
|
+
portalUrl?: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Hub class can be used as an entry point to managing
|
|
17
|
+
* content, teams, sites, projects etc, in an organization's Hub.
|
|
18
|
+
*
|
|
19
|
+
* ```js
|
|
20
|
+
* import {Hub} from '@esri/hub-common';
|
|
21
|
+
* // create a Hub instance, authenticating as a specific user
|
|
22
|
+
* // working against arcgis online
|
|
23
|
+
* const myHub = await Hub.create({authOptions: {username: "casey", password: "jones"}});
|
|
24
|
+
*
|
|
25
|
+
* myHub.context.currentUser //=> {username: "casey", ...} as IUser
|
|
26
|
+
*
|
|
27
|
+
* const projectStore = await myHub.getProjectStore();
|
|
28
|
+
*
|
|
29
|
+
* const pavingProject = await projectStore.create({name: "12th Street Paving"});
|
|
30
|
+
* pavingProject.summary = "This is the 2024 planned paving of 12th Street, between 8th and 11th Ave";
|
|
31
|
+
* await projectStore.update(pavingProject);
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* This is a convenience class. Hub Stores can be created
|
|
35
|
+
* directly, or the underlying functions can be imported an used
|
|
36
|
+
* as need for scenarios where these class structures introduce
|
|
37
|
+
* unwanted complexity
|
|
38
|
+
*/
|
|
39
|
+
export declare class Hub {
|
|
40
|
+
/**
|
|
41
|
+
* Hold a context manager, which should be a single instance for
|
|
42
|
+
* an application. When authentication changes, the .context
|
|
43
|
+
* property on the context manager will be replaced. As long as
|
|
44
|
+
* all the fns in this class leverage properties on .context
|
|
45
|
+
* everything be kept in sync.
|
|
46
|
+
*/
|
|
47
|
+
private _contextManager;
|
|
48
|
+
private _projectManager;
|
|
49
|
+
/**
|
|
50
|
+
* Private so we can employ a factory function should we need
|
|
51
|
+
* async work during creation
|
|
52
|
+
* @param contextManager
|
|
53
|
+
*/
|
|
54
|
+
private constructor();
|
|
55
|
+
/**
|
|
56
|
+
* Factory function to construct a new HubProjectStore instance.
|
|
57
|
+
*
|
|
58
|
+
* Note: Used so that we could do async actions in the ctor.
|
|
59
|
+
* @param contextManager
|
|
60
|
+
* @returns
|
|
61
|
+
*/
|
|
62
|
+
static create(options: IHubOptions): Promise<Hub>;
|
|
63
|
+
/**
|
|
64
|
+
* Getter to abstract the context manager
|
|
65
|
+
*/
|
|
66
|
+
get context(): import("./ArcGISContext").IArcGISContext;
|
|
67
|
+
/**
|
|
68
|
+
* Create a Project Store connected to the current Hub
|
|
69
|
+
* @returns
|
|
70
|
+
*/
|
|
71
|
+
get projects(): HubProjectManager;
|
|
72
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import OperationError from "./OperationError";
|
|
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: string, message?: string, rootCause?: Error);
|
|
17
|
+
}
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { getCollection } from "@esri/hub-common";
|
|
4
|
+
* //
|
|
5
|
+
* getCollection('Feature Layer')
|
|
6
|
+
* > 'dataset'
|
|
7
|
+
* ```
|
|
8
|
+
* Get the Hub collection for a given item type
|
|
9
|
+
* @param itemType The ArcGIS [item type](https://developers.arcgis.com/rest/users-groups-and-items/items-and-item-types.htm).
|
|
10
|
+
* @returns the Hub collection of a given item type.
|
|
11
|
+
*/
|
|
12
|
+
export declare const getCollection: (type?: string) => string;
|
|
1
13
|
export declare const collections: {
|
|
2
14
|
[key: string]: string[];
|
|
3
15
|
};
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* It's probably a good pattern to add functions here first and then
|
|
9
9
|
* move them to index.ts only when they are needed by a consumer.
|
|
10
10
|
*/
|
|
11
|
-
import {
|
|
11
|
+
import { IItem } from "@esri/arcgis-rest-types/dist/types/item";
|
|
12
|
+
import { BBox, IHubContent, IHubGeography, GeographyProvenance, IHubRequestOptions } from "..";
|
|
12
13
|
/**
|
|
13
14
|
* Create a new content with updated boundary properties
|
|
14
15
|
* @param content original content
|
|
@@ -17,70 +18,89 @@ import { BBox, IHubContent, IHubGeography, GeographyProvenance } from "../types"
|
|
|
17
18
|
*/
|
|
18
19
|
export declare const setContentBoundary: (content: IHubContent, boundary: GeographyProvenance) => {
|
|
19
20
|
boundary: IHubGeography;
|
|
20
|
-
item:
|
|
21
|
+
item: {
|
|
22
|
+
properties: any;
|
|
23
|
+
id: string;
|
|
24
|
+
owner: string;
|
|
25
|
+
tags: string[];
|
|
26
|
+
created: number;
|
|
27
|
+
modified: number;
|
|
28
|
+
numViews: number;
|
|
29
|
+
size: number;
|
|
30
|
+
protected?: boolean;
|
|
31
|
+
title: string;
|
|
32
|
+
type: string;
|
|
33
|
+
typeKeywords?: string[];
|
|
34
|
+
description?: string;
|
|
35
|
+
snippet?: string;
|
|
36
|
+
documentation?: string;
|
|
37
|
+
extent?: number[][];
|
|
38
|
+
categories?: string[];
|
|
39
|
+
spatialReference?: import("@esri/arcgis-rest-types").ISpatialReference;
|
|
40
|
+
culture?: string;
|
|
41
|
+
url?: string;
|
|
42
|
+
};
|
|
43
|
+
slug?: string;
|
|
21
44
|
hubId?: string;
|
|
45
|
+
identifier: string;
|
|
22
46
|
permissions: {
|
|
23
47
|
visibility: "private" | "public" | "org";
|
|
24
|
-
control?: import("
|
|
48
|
+
control?: import("..").AccessControl;
|
|
25
49
|
groups?: import("@esri/arcgis-rest-types").IGroup[];
|
|
26
50
|
};
|
|
27
|
-
family?: import("
|
|
28
|
-
|
|
29
|
-
|
|
51
|
+
family?: import("..").HubFamily;
|
|
52
|
+
categories?: string[];
|
|
53
|
+
isDownloadable: boolean;
|
|
54
|
+
structuredLicense?: import("..").IStructuredLicense;
|
|
30
55
|
publishedDate: Date;
|
|
31
56
|
publishedDateSource?: string;
|
|
32
57
|
updateFrequency?: string;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
metrics?: {
|
|
36
|
-
visibility: "private" | "public" | "org" | "updateGroups";
|
|
37
|
-
};
|
|
38
|
-
slug?: string;
|
|
58
|
+
portalHomeUrl?: string;
|
|
59
|
+
portalApiUrl?: string;
|
|
39
60
|
portalDataUrl?: string;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
data?: {
|
|
43
|
-
[propName: string]: any;
|
|
44
|
-
};
|
|
45
|
-
server?: Partial<import("@esri/arcgis-rest-types").IFeatureServiceDefinition>;
|
|
46
|
-
layers?: Partial<import("@esri/arcgis-rest-types").ILayerDefinition>[];
|
|
61
|
+
actionLinks?: import("..").IActionLink[];
|
|
62
|
+
hubActions?: object;
|
|
47
63
|
layer?: Partial<import("@esri/arcgis-rest-types").ILayerDefinition>;
|
|
48
|
-
|
|
64
|
+
itemCategories?: string[];
|
|
65
|
+
normalizedType?: string;
|
|
49
66
|
orgId?: string;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
67
|
+
thumbnailUrl?: string;
|
|
68
|
+
owner: string;
|
|
69
|
+
description?: string;
|
|
70
|
+
culture?: string;
|
|
71
|
+
tags: string[];
|
|
72
|
+
typeKeywords?: string[];
|
|
73
|
+
url?: string;
|
|
74
|
+
id: string;
|
|
53
75
|
name: string;
|
|
54
76
|
summary?: string;
|
|
55
|
-
hubType: import("../types").HubType;
|
|
56
77
|
createdDate: Date;
|
|
57
|
-
createdDateSource
|
|
78
|
+
createdDateSource: string;
|
|
58
79
|
updatedDate: Date;
|
|
59
|
-
updatedDateSource
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
80
|
+
updatedDateSource: string;
|
|
81
|
+
type: string;
|
|
82
|
+
server?: Partial<import("@esri/arcgis-rest-types").IFeatureServiceDefinition>;
|
|
83
|
+
layers?: Partial<import("@esri/arcgis-rest-types").ILayerDefinition>[];
|
|
84
|
+
recordCount?: number;
|
|
85
|
+
data?: {
|
|
86
|
+
[propName: string]: any;
|
|
87
|
+
};
|
|
63
88
|
metadata?: any;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
89
|
+
groupIds?: string[];
|
|
90
|
+
ownerUser?: import("@esri/arcgis-rest-types").IUser;
|
|
91
|
+
org?: Partial<import("@esri/arcgis-rest-portal").IPortal>;
|
|
92
|
+
errors?: import("..").IEnrichmentErrorInfo[];
|
|
67
93
|
created: number;
|
|
68
94
|
modified: number;
|
|
69
95
|
numViews: number;
|
|
70
96
|
size: number;
|
|
71
97
|
protected?: boolean;
|
|
72
98
|
title: string;
|
|
73
|
-
type: string;
|
|
74
|
-
typeKeywords?: string[];
|
|
75
|
-
description?: string;
|
|
76
99
|
snippet?: string;
|
|
77
100
|
documentation?: string;
|
|
78
101
|
extent?: number[][];
|
|
79
|
-
categories?: string[];
|
|
80
102
|
spatialReference?: import("@esri/arcgis-rest-types").ISpatialReference;
|
|
81
|
-
culture?: string;
|
|
82
103
|
properties?: any;
|
|
83
|
-
url?: string;
|
|
84
104
|
};
|
|
85
105
|
/**
|
|
86
106
|
* Create a new content with updated extent and derived properties like boundary
|
|
@@ -89,3 +109,11 @@ export declare const setContentBoundary: (content: IHubContent, boundary: Geogra
|
|
|
89
109
|
* @returns a new content with the updated extent and boundary
|
|
90
110
|
*/
|
|
91
111
|
export declare const setContentExtent: (content: IHubContent, extent: BBox) => IHubContent;
|
|
112
|
+
/**
|
|
113
|
+
* Returns whether or not an item is a proxied csv
|
|
114
|
+
*
|
|
115
|
+
* @param item
|
|
116
|
+
* @param requestOptions Hub Request Options (including whether we're in portal)
|
|
117
|
+
* @returns
|
|
118
|
+
*/
|
|
119
|
+
export declare const isProxiedCSV: (item: IItem, requestOptions: IHubRequestOptions) => boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ResourceObject } from "jsonapi-typescript";
|
|
2
2
|
import { IItem } from "@esri/arcgis-rest-portal";
|
|
3
|
-
import { HubType, HubFamily } from "../types";
|
|
4
|
-
import { IHubContent
|
|
3
|
+
import { HubType, HubFamily, IModel, IHubRequestOptions } from "../types";
|
|
4
|
+
import { IHubContent } from "..";
|
|
5
5
|
/**
|
|
6
6
|
* JSONAPI dataset resource returned by the Hub API
|
|
7
7
|
*/
|
|
@@ -204,25 +204,25 @@ export declare function datasetToContent(dataset: DatasetResource): IHubContent;
|
|
|
204
204
|
export declare function datasetToItem(dataset: DatasetResource): IItem;
|
|
205
205
|
/**
|
|
206
206
|
* returns a new content that has the specified type and
|
|
207
|
-
* and updated related properties like
|
|
207
|
+
* and updated related properties like, family, etc
|
|
208
208
|
* @param content orignal content
|
|
209
209
|
* @param type new type
|
|
210
210
|
* @returns new content
|
|
211
211
|
*/
|
|
212
212
|
export declare const setContentType: (content: IHubContent, type: string) => IHubContent;
|
|
213
213
|
/**
|
|
214
|
-
* Compute the content type icon based on the
|
|
215
|
-
* @param
|
|
214
|
+
* Compute the content type icon based on the content type
|
|
215
|
+
* @param content type
|
|
216
216
|
* @returns content type icon
|
|
217
217
|
*/
|
|
218
|
-
export declare const getContentTypeIcon: (
|
|
218
|
+
export declare const getContentTypeIcon: (contentType: string) => any;
|
|
219
219
|
/**
|
|
220
220
|
* Compute the content type label
|
|
221
|
-
* @param
|
|
221
|
+
* @param contentType
|
|
222
222
|
* @param isProxied
|
|
223
223
|
* @returns content type label
|
|
224
224
|
*/
|
|
225
|
-
export declare const getContentTypeLabel: (
|
|
225
|
+
export declare const getContentTypeLabel: (contentType: string, isProxied: boolean) => string;
|
|
226
226
|
/**
|
|
227
227
|
* returns a new content that has the specified hubId and updated identifier
|
|
228
228
|
* @param content orignal content
|
|
@@ -249,3 +249,12 @@ export declare const getContentSiteUrls: (content: IHubContent, siteModel: IMode
|
|
|
249
249
|
* @returns
|
|
250
250
|
*/
|
|
251
251
|
export declare const setContentSiteUrls: (content: IHubContent, siteModel: IModel) => IHubContent;
|
|
252
|
+
/**
|
|
253
|
+
* If an item is a proxied csv, returns the url for the proxying feature layer.
|
|
254
|
+
* If the item is not a proxied csv, returns undefined.
|
|
255
|
+
*
|
|
256
|
+
* @param item
|
|
257
|
+
* @param requestOptions Hub Request Options (including whether we're in portal)
|
|
258
|
+
* @returns
|
|
259
|
+
*/
|
|
260
|
+
export declare const getProxyUrl: (item: IItem, requestOptions: IHubRequestOptions) => string;
|