@esri/hub-common 14.184.0 → 14.184.2
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/esm/content/_internal/computeProps.js +3 -5
- package/dist/esm/content/_internal/computeProps.js.map +1 -1
- package/dist/esm/content/compose.js +10 -12
- package/dist/esm/content/compose.js.map +1 -1
- package/dist/esm/content/hostedServiceUtils.js +4 -1
- package/dist/esm/content/hostedServiceUtils.js.map +1 -1
- package/dist/esm/content/index.js +1 -0
- package/dist/esm/content/index.js.map +1 -1
- package/dist/esm/content/isAGOHostedService.js +30 -0
- package/dist/esm/content/isAGOHostedService.js.map +1 -0
- package/dist/esm/core/_internal/computeItemProps.js +23 -0
- package/dist/esm/core/_internal/computeItemProps.js.map +1 -0
- package/dist/esm/discussions/_internal/computeProps.js +2 -9
- package/dist/esm/discussions/_internal/computeProps.js.map +1 -1
- package/dist/esm/initiative-templates/_internal/computeProps.js +2 -9
- package/dist/esm/initiative-templates/_internal/computeProps.js.map +1 -1
- package/dist/esm/initiatives/_internal/computeProps.js +2 -9
- package/dist/esm/initiatives/_internal/computeProps.js.map +1 -1
- package/dist/esm/pages/_internal/computeProps.js +2 -7
- package/dist/esm/pages/_internal/computeProps.js.map +1 -1
- package/dist/esm/projects/_internal/computeProps.js +2 -9
- package/dist/esm/projects/_internal/computeProps.js.map +1 -1
- package/dist/esm/sites/_internal/computeProps.js +2 -9
- package/dist/esm/sites/_internal/computeProps.js.map +1 -1
- package/dist/esm/surveys/_internal/computeProps.js +3 -9
- package/dist/esm/surveys/_internal/computeProps.js.map +1 -1
- package/dist/esm/templates/_internal/computeProps.js +2 -10
- package/dist/esm/templates/_internal/computeProps.js.map +1 -1
- package/dist/node/content/_internal/computeProps.js +3 -5
- package/dist/node/content/_internal/computeProps.js.map +1 -1
- package/dist/node/content/compose.js +10 -12
- package/dist/node/content/compose.js.map +1 -1
- package/dist/node/content/hostedServiceUtils.js +4 -1
- package/dist/node/content/hostedServiceUtils.js.map +1 -1
- package/dist/node/content/index.js +1 -0
- package/dist/node/content/index.js.map +1 -1
- package/dist/node/content/isAGOHostedService.js +34 -0
- package/dist/node/content/isAGOHostedService.js.map +1 -0
- package/dist/node/core/_internal/computeItemProps.js +27 -0
- package/dist/node/core/_internal/computeItemProps.js.map +1 -0
- package/dist/node/discussions/_internal/computeProps.js +2 -9
- package/dist/node/discussions/_internal/computeProps.js.map +1 -1
- package/dist/node/initiative-templates/_internal/computeProps.js +2 -9
- package/dist/node/initiative-templates/_internal/computeProps.js.map +1 -1
- package/dist/node/initiatives/_internal/computeProps.js +2 -9
- package/dist/node/initiatives/_internal/computeProps.js.map +1 -1
- package/dist/node/pages/_internal/computeProps.js +2 -7
- package/dist/node/pages/_internal/computeProps.js.map +1 -1
- package/dist/node/projects/_internal/computeProps.js +2 -9
- package/dist/node/projects/_internal/computeProps.js.map +1 -1
- package/dist/node/sites/_internal/computeProps.js +2 -9
- package/dist/node/sites/_internal/computeProps.js.map +1 -1
- package/dist/node/surveys/_internal/computeProps.js +3 -9
- package/dist/node/surveys/_internal/computeProps.js.map +1 -1
- package/dist/node/templates/_internal/computeProps.js +4 -12
- package/dist/node/templates/_internal/computeProps.js.map +1 -1
- package/dist/types/content/index.d.ts +1 -0
- package/dist/types/content/isAGOHostedService.d.ts +9 -0
- package/dist/types/core/_internal/{computeBaseProps.d.ts → computeItemProps.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/esm/core/_internal/computeBaseProps.js +0 -15
- package/dist/esm/core/_internal/computeBaseProps.js.map +0 -1
- package/dist/node/core/_internal/computeBaseProps.js +0 -19
- package/dist/node/core/_internal/computeBaseProps.js.map +0 -1
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.computeProps = void 0;
|
|
4
|
-
const utils_1 = require("../../discussions/utils");
|
|
5
4
|
const processEntityFeatures_1 = require("../../permissions/_internal/processEntityFeatures");
|
|
6
5
|
const TemplateBusinessRules_1 = require("./TemplateBusinessRules");
|
|
7
6
|
const computeLinks_1 = require("./computeLinks");
|
|
8
7
|
const objects_1 = require("../../objects");
|
|
9
|
-
const
|
|
10
|
-
const
|
|
8
|
+
const utils_1 = require("../utils");
|
|
9
|
+
const computeItemProps_1 = require("../../core/_internal/computeItemProps");
|
|
11
10
|
/**
|
|
12
11
|
* @private
|
|
13
12
|
* Given a model and a template, set various computed
|
|
@@ -19,23 +18,16 @@ const computeBaseProps_1 = require("../../core/_internal/computeBaseProps");
|
|
|
19
18
|
*/
|
|
20
19
|
function computeProps(model, template, requestOptions) {
|
|
21
20
|
// 1. compute base properties on template
|
|
22
|
-
template =
|
|
21
|
+
template = computeItemProps_1.computeItemProps(model.item, template);
|
|
23
22
|
// 2. compute relevant template links
|
|
24
23
|
template.links = computeLinks_1.computeLinks(model.item, requestOptions);
|
|
25
24
|
// 3. append the template's thumbnail url at the top-level
|
|
26
25
|
template.thumbnailUrl = template.links.thumbnail;
|
|
27
|
-
// 4. compute relevant template dates
|
|
28
|
-
template.createdDate = new Date(model.item.created);
|
|
29
|
-
template.createdDateSource = "item.created";
|
|
30
|
-
template.updatedDate = new Date(model.item.modified);
|
|
31
|
-
template.updatedDateSource = "item.modified";
|
|
32
|
-
// 5. determine whether the template is discussable
|
|
33
|
-
template.isDiscussable = utils_1.isDiscussable(template);
|
|
34
26
|
// 6. process features that can be disabled by the entity owner
|
|
35
27
|
template.features = processEntityFeatures_1.processEntityFeatures(objects_1.getProp(model, "data.settings.features") || {}, TemplateBusinessRules_1.TemplateDefaultFeatures);
|
|
36
28
|
// 7. compute additional template-specific properties
|
|
37
29
|
template.isDeployed = (objects_1.getProp(model, "item.typeKeywords") || []).includes("Deployed");
|
|
38
|
-
template.deployedType =
|
|
30
|
+
template.deployedType = utils_1.getDeployedTemplateType(model.item);
|
|
39
31
|
// 8. cast b/c this takes a partial but returns a full template
|
|
40
32
|
return template;
|
|
41
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeProps.js","sourceRoot":"","sources":["../../../../src/templates/_internal/computeProps.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"computeProps.js","sourceRoot":"","sources":["../../../../src/templates/_internal/computeProps.ts"],"names":[],"mappings":";;;AAEA,6FAA0F;AAE1F,mEAAkE;AAElE,iDAA8C;AAC9C,2CAAwC;AACxC,oCAAmD;AACnD,4EAAyE;AAEzE;;;;;;;;GAQG;AACH,SAAgB,YAAY,CAC1B,KAAa,EACb,QAA+B,EAC/B,cAA+B;IAE/B,yCAAyC;IACzC,QAAQ,GAAG,mCAAgB,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAElD,qCAAqC;IACrC,QAAQ,CAAC,KAAK,GAAG,2BAAY,CAAC,KAAK,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAE1D,0DAA0D;IAC1D,QAAQ,CAAC,YAAY,GAAG,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC;IAEjD,+DAA+D;IAC/D,QAAQ,CAAC,QAAQ,GAAG,6CAAqB,CACvC,iBAAO,CAAC,KAAK,EAAE,wBAAwB,CAAC,IAAI,EAAE,EAC9C,+CAAuB,CACxB,CAAC;IAEF,qDAAqD;IACrD,QAAQ,CAAC,UAAU,GAAG,CAAC,iBAAO,CAAC,KAAK,EAAE,mBAAmB,CAAC,IAAI,EAAE,CAAC,CAAC,QAAQ,CACxE,UAAU,CACX,CAAC;IACF,QAAQ,CAAC,YAAY,GAAG,+BAAuB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE5D,+DAA+D;IAC/D,OAAO,QAAwB,CAAC;AAClC,CAAC;AA5BD,oCA4BC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Used to determine if a service is hosted on ArcGIS Online
|
|
3
|
+
*
|
|
4
|
+
* Includes exlusion logic that prevents (secured) proxied services from returning true
|
|
5
|
+
* as we can't be sure if they are hosted or not
|
|
6
|
+
* @param url
|
|
7
|
+
* @returns true if the url is an ArcGIS Online hosted service
|
|
8
|
+
*/
|
|
9
|
+
export declare function isAGOHostedService(url: string): boolean;
|
|
@@ -6,4 +6,4 @@ import { IHubItemEntity } from "../types";
|
|
|
6
6
|
* @param entity IHubItemEntity
|
|
7
7
|
* @returns
|
|
8
8
|
*/
|
|
9
|
-
export declare function
|
|
9
|
+
export declare function computeItemProps<T extends Partial<IHubItemEntity>>(item: IItem, entity: T): T;
|
package/package.json
CHANGED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { deriveLocationFromItem } from "../../content/_internal/internalContentUtils";
|
|
2
|
-
/**
|
|
3
|
-
* Base property mapping for item backed entity types
|
|
4
|
-
* @param item IItem
|
|
5
|
-
* @param entity IHubItemEntity
|
|
6
|
-
* @returns
|
|
7
|
-
*/
|
|
8
|
-
export function computeBaseProps(item, entity) {
|
|
9
|
-
// TODO: Currently only location is determined for base
|
|
10
|
-
// properties, but all properties that are commonly shared
|
|
11
|
-
// across items should be moved here.
|
|
12
|
-
entity.location = entity.location || deriveLocationFromItem(item);
|
|
13
|
-
return entity;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=computeBaseProps.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"computeBaseProps.js","sourceRoot":"","sources":["../../../../src/core/_internal/computeBaseProps.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AAEtF;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAW,EACX,MAAS;IAET,uDAAuD;IACvD,0DAA0D;IAC1D,qCAAqC;IACrC,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,sBAAsB,CAAC,IAAI,CAAC,CAAC;IAClE,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.computeBaseProps = void 0;
|
|
4
|
-
const internalContentUtils_1 = require("../../content/_internal/internalContentUtils");
|
|
5
|
-
/**
|
|
6
|
-
* Base property mapping for item backed entity types
|
|
7
|
-
* @param item IItem
|
|
8
|
-
* @param entity IHubItemEntity
|
|
9
|
-
* @returns
|
|
10
|
-
*/
|
|
11
|
-
function computeBaseProps(item, entity) {
|
|
12
|
-
// TODO: Currently only location is determined for base
|
|
13
|
-
// properties, but all properties that are commonly shared
|
|
14
|
-
// across items should be moved here.
|
|
15
|
-
entity.location = entity.location || internalContentUtils_1.deriveLocationFromItem(item);
|
|
16
|
-
return entity;
|
|
17
|
-
}
|
|
18
|
-
exports.computeBaseProps = computeBaseProps;
|
|
19
|
-
//# sourceMappingURL=computeBaseProps.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"computeBaseProps.js","sourceRoot":"","sources":["../../../../src/core/_internal/computeBaseProps.ts"],"names":[],"mappings":";;;AAEA,uFAAsF;AAEtF;;;;;GAKG;AACH,SAAgB,gBAAgB,CAC9B,IAAW,EACX,MAAS;IAET,uDAAuD;IACvD,0DAA0D;IAC1D,qCAAqC;IACrC,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,6CAAsB,CAAC,IAAI,CAAC,CAAC;IAClE,OAAO,MAAM,CAAC;AAChB,CAAC;AATD,4CASC"}
|