@esri/hub-common 14.6.0 → 14.7.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/esm/content/_internal/computeProps.js +12 -1
- package/dist/esm/content/_internal/computeProps.js.map +1 -1
- package/dist/esm/pages/_internal/computeProps.js +12 -1
- package/dist/esm/pages/_internal/computeProps.js.map +1 -1
- package/dist/esm/sites/_internal/computeProps.js +12 -1
- package/dist/esm/sites/_internal/computeProps.js.map +1 -1
- package/dist/node/content/_internal/computeProps.js +12 -1
- package/dist/node/content/_internal/computeProps.js.map +1 -1
- package/dist/node/pages/_internal/computeProps.js +12 -1
- package/dist/node/pages/_internal/computeProps.js.map +1 -1
- package/dist/node/sites/_internal/computeProps.js +12 -1
- package/dist/node/sites/_internal/computeProps.js.map +1 -1
- package/dist/types/content/_internal/computeProps.d.ts +2 -1
- package/dist/types/content/_internal/internalContentUtils.d.ts +8 -0
- package/dist/types/core/types/IHubEntityBase.d.ts +49 -2
- package/dist/types/core/types/IHubItemEntity.d.ts +5 -1
- package/dist/types/pages/_internal/computeProps.d.ts +1 -1
- package/dist/types/search/types/IHubSearchResult.d.ts +0 -40
- package/dist/types/sites/_internal/computeProps.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { getItemThumbnailUrl } from "../../resources";
|
|
2
2
|
import { bBoxToExtent, extentToPolygon, isBBox } from "../../extent";
|
|
3
|
+
import { getItemHomeUrl } from "../../urls/get-item-home-url";
|
|
4
|
+
import { getHubRelativeUrl } from "./internalContentUtils";
|
|
5
|
+
import { getRelativeWorkspaceUrl } from "../../core/getRelativeWorkspaceUrl";
|
|
3
6
|
// if called and valid, set 3 things -- else just return type custom
|
|
4
7
|
export const getItemExtent = (itemExtent) => {
|
|
5
8
|
return isBBox(itemExtent)
|
|
@@ -25,7 +28,15 @@ export function computeProps(model, content, requestOptions) {
|
|
|
25
28
|
token = session.token;
|
|
26
29
|
}
|
|
27
30
|
// thumbnail url
|
|
28
|
-
|
|
31
|
+
const thumbnailUrl = getItemThumbnailUrl(model.item, requestOptions, token);
|
|
32
|
+
// TODO: Remove this once opendata-ui starts using `links.thumbnail` instead
|
|
33
|
+
content.thumbnailUrl = thumbnailUrl;
|
|
34
|
+
content.links = {
|
|
35
|
+
self: getItemHomeUrl(content.id, requestOptions),
|
|
36
|
+
siteRelative: getHubRelativeUrl(content.type, content.slug || content.id, content.typeKeywords),
|
|
37
|
+
workspaceRelative: getRelativeWorkspaceUrl("content", content.id),
|
|
38
|
+
thumbnail: thumbnailUrl,
|
|
39
|
+
};
|
|
29
40
|
content.licenseInfo = model.item.licenseInfo;
|
|
30
41
|
if (!content.location) {
|
|
31
42
|
// build location if one does not exist based off of the boundary and the item's extent
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeProps.js","sourceRoot":"","sources":["../../../../src/content/_internal/computeProps.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"computeProps.js","sourceRoot":"","sources":["../../../../src/content/_internal/computeProps.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGrE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAE7E,oEAAoE;AACpE,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,UAAsB,EAAW,EAAE;IAC/D,OAAO,MAAM,CAAC,UAAU,CAAC;QACvB,CAAC,CAAE,gCAAK,YAAY,CAAC,UAAU,CAAC,KAAE,IAAI,EAAE,QAAQ,GAAyB;QACzE,CAAC,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,EAAE,YAAY;KACxB,CAAC;IACF,OAAO,CAAC,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC;IAE7C,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;QACrB,uFAAuF;QACvF,OAAO,CAAC,QAAQ;YACd,OAAA,KAAK,CAAC,IAAI,CAAC,UAAU,0CAAE,QAAQ,MAAK,MAAM;gBACxC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE;gBAClB,CAAC,CAAC,4BAA4B,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KACvD;IAED,OAAO,OAA8B,CAAC;AACxC,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { getItemThumbnailUrl } from "../../resources";
|
|
2
2
|
import { processEntityFeatures } from "../../permissions/_internal/processEntityFeatures";
|
|
3
3
|
import { PageDefaultFeatures } from "./PageBusinessRules";
|
|
4
|
+
import { getItemHomeUrl } from "../../urls/get-item-home-url";
|
|
5
|
+
import { getRelativeWorkspaceUrl } from "../../core/getRelativeWorkspaceUrl";
|
|
4
6
|
/**
|
|
5
7
|
* Given a model and a page, set various computed properties that can't be directly mapped
|
|
6
8
|
* @private
|
|
@@ -17,7 +19,16 @@ export function computeProps(model, page, requestOptions) {
|
|
|
17
19
|
token = session.token;
|
|
18
20
|
}
|
|
19
21
|
// thumbnail url
|
|
20
|
-
|
|
22
|
+
const thumbnailUrl = getItemThumbnailUrl(model.item, requestOptions, token);
|
|
23
|
+
// TODO: Remove this once opendata-ui starts using `links.thumbnail` instead
|
|
24
|
+
page.thumbnailUrl = thumbnailUrl;
|
|
25
|
+
page.links = {
|
|
26
|
+
self: getItemHomeUrl(page.id, requestOptions),
|
|
27
|
+
siteRelative: `/pages/${page.id}`,
|
|
28
|
+
workspaceRelative: getRelativeWorkspaceUrl("page", page.id),
|
|
29
|
+
layoutRelative: `/pages/${page.id}/edit`,
|
|
30
|
+
thumbnail: thumbnailUrl,
|
|
31
|
+
};
|
|
21
32
|
// Handle Dates
|
|
22
33
|
page.createdDate = new Date(model.item.created);
|
|
23
34
|
page.createdDateSource = "item.created";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeProps.js","sourceRoot":"","sources":["../../../../src/pages/_internal/computeProps.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"computeProps.js","sourceRoot":"","sources":["../../../../src/pages/_internal/computeProps.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAC;AAC1F,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAG9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAE7E;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAC1B,KAAa,EACb,IAAuB,EACvB,cAA+B;;IAE/B,IAAI,KAAa,CAAC;IAClB,IAAI,cAAc,CAAC,cAAc,EAAE;QACjC,MAAM,OAAO,GAAgB,cAAc,CAAC,cAA6B,CAAC;QAC1E,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;KACvB;IACD,gBAAgB;IAChB,MAAM,YAAY,GAAG,mBAAmB,CAAC,KAAK,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,CAAC,CAAC;IAC5E,4EAA4E;IAC5E,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACjC,IAAI,CAAC,KAAK,GAAG;QACX,IAAI,EAAE,cAAc,CAAC,IAAI,CAAC,EAAE,EAAE,cAAc,CAAC;QAC7C,YAAY,EAAE,UAAU,IAAI,CAAC,EAAE,EAAE;QACjC,iBAAiB,EAAE,uBAAuB,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;QAC3D,cAAc,EAAE,UAAU,IAAI,CAAC,EAAE,OAAO;QACxC,SAAS,EAAE,YAAY;KACxB,CAAC;IAEF,eAAe;IACf,IAAI,CAAC,WAAW,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChD,IAAI,CAAC,iBAAiB,GAAG,cAAc,CAAC;IACxC,IAAI,CAAC,WAAW,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjD,IAAI,CAAC,iBAAiB,GAAG,eAAe,CAAC;IAEzC;;;OAGG;IACH,IAAI,CAAC,QAAQ,GAAG,qBAAqB,CACnC,OAAA,KAAK,CAAC,IAAI,CAAC,QAAQ,0CAAE,QAAQ,KAAI,EAAE,EACnC,mBAAmB,CACpB,CAAC;IAEF,wDAAwD;IACxD,OAAO,IAAgB,CAAC;AAC1B,CAAC"}
|
|
@@ -3,6 +3,8 @@ import { upgradeCatalogSchema } from "../../search/upgradeCatalogSchema";
|
|
|
3
3
|
import { isDiscussable } from "../../discussions";
|
|
4
4
|
import { processEntityFeatures } from "../../permissions/_internal/processEntityFeatures";
|
|
5
5
|
import { SiteDefaultFeatures } from "./SiteBusinessRules";
|
|
6
|
+
import { getItemHomeUrl } from "../../urls/get-item-home-url";
|
|
7
|
+
import { getRelativeWorkspaceUrl } from "../../core/getRelativeWorkspaceUrl";
|
|
6
8
|
/**
|
|
7
9
|
* Given a model and a site, set various computed properties that can't be directly mapped
|
|
8
10
|
* @private
|
|
@@ -19,7 +21,16 @@ export function computeProps(model, site, requestOptions) {
|
|
|
19
21
|
token = session.token;
|
|
20
22
|
}
|
|
21
23
|
// thumbnail url
|
|
22
|
-
|
|
24
|
+
const thumbnailUrl = getItemThumbnailUrl(model.item, requestOptions, token);
|
|
25
|
+
// TODO: Remove this once opendata-ui starts using `links.thumbnail` instead
|
|
26
|
+
site.thumbnailUrl = thumbnailUrl;
|
|
27
|
+
site.links = {
|
|
28
|
+
self: getItemHomeUrl(site.id, requestOptions),
|
|
29
|
+
siteRelative: "/",
|
|
30
|
+
workspaceRelative: getRelativeWorkspaceUrl("site", site.id),
|
|
31
|
+
layoutRelative: "/edit",
|
|
32
|
+
thumbnail: thumbnailUrl,
|
|
33
|
+
};
|
|
23
34
|
// Handle Dates
|
|
24
35
|
site.createdDate = new Date(model.item.created);
|
|
25
36
|
site.createdDateSource = "item.created";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeProps.js","sourceRoot":"","sources":["../../../../src/sites/_internal/computeProps.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"computeProps.js","sourceRoot":"","sources":["../../../../src/sites/_internal/computeProps.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAC;AAC1F,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAE7E;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAC1B,KAAa,EACb,IAAuB,EACvB,cAA+B;;IAE/B,IAAI,KAAa,CAAC;IAClB,IAAI,cAAc,CAAC,cAAc,EAAE;QACjC,MAAM,OAAO,GAAgB,cAAc,CAAC,cAA6B,CAAC;QAC1E,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;KACvB;IACD,gBAAgB;IAChB,MAAM,YAAY,GAAG,mBAAmB,CAAC,KAAK,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,CAAC,CAAC;IAC5E,4EAA4E;IAC5E,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACjC,IAAI,CAAC,KAAK,GAAG;QACX,IAAI,EAAE,cAAc,CAAC,IAAI,CAAC,EAAE,EAAE,cAAc,CAAC;QAC7C,YAAY,EAAE,GAAG;QACjB,iBAAiB,EAAE,uBAAuB,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;QAC3D,cAAc,EAAE,OAAO;QACvB,SAAS,EAAE,YAAY;KACxB,CAAC;IAEF,eAAe;IACf,IAAI,CAAC,WAAW,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChD,IAAI,CAAC,iBAAiB,GAAG,cAAc,CAAC;IACxC,IAAI,CAAC,WAAW,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjD,IAAI,CAAC,iBAAiB,GAAG,eAAe,CAAC;IACzC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IACzC;;OAEG;IACH,IAAI,CAAC,QAAQ,GAAG,qBAAqB,CACnC,OAAA,KAAK,CAAC,IAAI,CAAC,QAAQ,0CAAE,QAAQ,KAAI,EAAE,EACnC,mBAAmB,CACpB,CAAC;IAEF,uDAAuD;IACvD,IAAI,CAAC,OAAO,GAAG,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAElD,wDAAwD;IACxD,OAAO,IAAgB,CAAC;AAC1B,CAAC"}
|
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.computeProps = exports.deriveLocationFromItemExtent = exports.getItemExtent = void 0;
|
|
4
4
|
const resources_1 = require("../../resources");
|
|
5
5
|
const extent_1 = require("../../extent");
|
|
6
|
+
const get_item_home_url_1 = require("../../urls/get-item-home-url");
|
|
7
|
+
const internalContentUtils_1 = require("./internalContentUtils");
|
|
8
|
+
const getRelativeWorkspaceUrl_1 = require("../../core/getRelativeWorkspaceUrl");
|
|
6
9
|
// if called and valid, set 3 things -- else just return type custom
|
|
7
10
|
exports.getItemExtent = (itemExtent) => {
|
|
8
11
|
return extent_1.isBBox(itemExtent)
|
|
@@ -29,7 +32,15 @@ function computeProps(model, content, requestOptions) {
|
|
|
29
32
|
token = session.token;
|
|
30
33
|
}
|
|
31
34
|
// thumbnail url
|
|
32
|
-
|
|
35
|
+
const thumbnailUrl = resources_1.getItemThumbnailUrl(model.item, requestOptions, token);
|
|
36
|
+
// TODO: Remove this once opendata-ui starts using `links.thumbnail` instead
|
|
37
|
+
content.thumbnailUrl = thumbnailUrl;
|
|
38
|
+
content.links = {
|
|
39
|
+
self: get_item_home_url_1.getItemHomeUrl(content.id, requestOptions),
|
|
40
|
+
siteRelative: internalContentUtils_1.getHubRelativeUrl(content.type, content.slug || content.id, content.typeKeywords),
|
|
41
|
+
workspaceRelative: getRelativeWorkspaceUrl_1.getRelativeWorkspaceUrl("content", content.id),
|
|
42
|
+
thumbnail: thumbnailUrl,
|
|
43
|
+
};
|
|
33
44
|
content.licenseInfo = model.item.licenseInfo;
|
|
34
45
|
if (!content.location) {
|
|
35
46
|
// build location if one does not exist based off of the boundary and the item's extent
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeProps.js","sourceRoot":"","sources":["../../../../src/content/_internal/computeProps.ts"],"names":[],"mappings":";;;AAEA,+CAAsD;
|
|
1
|
+
{"version":3,"file":"computeProps.js","sourceRoot":"","sources":["../../../../src/content/_internal/computeProps.ts"],"names":[],"mappings":";;;AAEA,+CAAsD;AAEtD,yCAAqE;AAGrE,oEAA8D;AAC9D,iEAA2D;AAG3D,gFAA6E;AAE7E,oEAAoE;AACvD,QAAA,aAAa,GAAG,CAAC,UAAsB,EAAW,EAAE;IAC/D,OAAO,eAAM,CAAC,UAAU,CAAC;QACvB,CAAC,CAAE,gCAAK,qBAAY,CAAC,UAAU,CAAC,KAAE,IAAI,EA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E,OAAO,CAAC,EAAE,CAAC;QACjE,SAAS,EAAE,YAAY;KACxB,CAAC;IACF,OAAO,CAAC,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC;IAE7C,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;QACrB,uFAAuF;QACvF,OAAO,CAAC,QAAQ;YACd,OAAA,KAAK,CAAC,IAAI,CAAC,UAAU,0CAAE,QAAQ,MAAK,MAAM;gBACxC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE;gBAClB,CAAC,CAAC,4BAA4B,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KACvD;IAED,OAAO,OAA8B,CAAC;AACxC,CAAC;AAnCD,oCAmCC"}
|
|
@@ -4,6 +4,8 @@ exports.computeProps = void 0;
|
|
|
4
4
|
const resources_1 = require("../../resources");
|
|
5
5
|
const processEntityFeatures_1 = require("../../permissions/_internal/processEntityFeatures");
|
|
6
6
|
const PageBusinessRules_1 = require("./PageBusinessRules");
|
|
7
|
+
const get_item_home_url_1 = require("../../urls/get-item-home-url");
|
|
8
|
+
const getRelativeWorkspaceUrl_1 = require("../../core/getRelativeWorkspaceUrl");
|
|
7
9
|
/**
|
|
8
10
|
* Given a model and a page, set various computed properties that can't be directly mapped
|
|
9
11
|
* @private
|
|
@@ -20,7 +22,16 @@ function computeProps(model, page, requestOptions) {
|
|
|
20
22
|
token = session.token;
|
|
21
23
|
}
|
|
22
24
|
// thumbnail url
|
|
23
|
-
|
|
25
|
+
const thumbnailUrl = resources_1.getItemThumbnailUrl(model.item, requestOptions, token);
|
|
26
|
+
// TODO: Remove this once opendata-ui starts using `links.thumbnail` instead
|
|
27
|
+
page.thumbnailUrl = thumbnailUrl;
|
|
28
|
+
page.links = {
|
|
29
|
+
self: get_item_home_url_1.getItemHomeUrl(page.id, requestOptions),
|
|
30
|
+
siteRelative: `/pages/${page.id}`,
|
|
31
|
+
workspaceRelative: getRelativeWorkspaceUrl_1.getRelativeWorkspaceUrl("page", page.id),
|
|
32
|
+
layoutRelative: `/pages/${page.id}/edit`,
|
|
33
|
+
thumbnail: thumbnailUrl,
|
|
34
|
+
};
|
|
24
35
|
// Handle Dates
|
|
25
36
|
page.createdDate = new Date(model.item.created);
|
|
26
37
|
page.createdDateSource = "item.created";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeProps.js","sourceRoot":"","sources":["../../../../src/pages/_internal/computeProps.ts"],"names":[],"mappings":";;;AAEA,+CAAsD;
|
|
1
|
+
{"version":3,"file":"computeProps.js","sourceRoot":"","sources":["../../../../src/pages/_internal/computeProps.ts"],"names":[],"mappings":";;;AAEA,+CAAsD;AAGtD,6FAA0F;AAC1F,2DAA0D;AAC1D,oEAA8D;AAG9D,gFAA6E;AAE7E;;;;;;;GAOG;AACH,SAAgB,YAAY,CAC1B,KAAa,EACb,IAAuB,EACvB,cAA+B;;IAE/B,IAAI,KAAa,CAAC;IAClB,IAAI,cAAc,CAAC,cAAc,EAAE;QACjC,MAAM,OAAO,GAAgB,cAAc,CAAC,cAA6B,CAAC;QAC1E,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;KACvB;IACD,gBAAgB;IAChB,MAAM,YAAY,GAAG,+BAAmB,CAAC,KAAK,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,CAAC,CAAC;IAC5E,4EAA4E;IAC5E,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACjC,IAAI,CAAC,KAAK,GAAG;QACX,IAAI,EAAE,kCAAc,CAAC,IAAI,CAAC,EAAE,EAAE,cAAc,CAAC;QAC7C,YAAY,EAAE,UAAU,IAAI,CAAC,EAAE,EAAE;QACjC,iBAAiB,EAAE,iDAAuB,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;QAC3D,cAAc,EAAE,UAAU,IAAI,CAAC,EAAE,OAAO;QACxC,SAAS,EAAE,YAAY;KACxB,CAAC;IAEF,eAAe;IACf,IAAI,CAAC,WAAW,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChD,IAAI,CAAC,iBAAiB,GAAG,cAAc,CAAC;IACxC,IAAI,CAAC,WAAW,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjD,IAAI,CAAC,iBAAiB,GAAG,eAAe,CAAC;IAEzC;;;OAGG;IACH,IAAI,CAAC,QAAQ,GAAG,6CAAqB,CACnC,OAAA,KAAK,CAAC,IAAI,CAAC,QAAQ,0CAAE,QAAQ,KAAI,EAAE,EACnC,uCAAmB,CACpB,CAAC;IAEF,wDAAwD;IACxD,OAAO,IAAgB,CAAC;AAC1B,CAAC;AAvCD,oCAuCC"}
|
|
@@ -6,6 +6,8 @@ const upgradeCatalogSchema_1 = require("../../search/upgradeCatalogSchema");
|
|
|
6
6
|
const discussions_1 = require("../../discussions");
|
|
7
7
|
const processEntityFeatures_1 = require("../../permissions/_internal/processEntityFeatures");
|
|
8
8
|
const SiteBusinessRules_1 = require("./SiteBusinessRules");
|
|
9
|
+
const get_item_home_url_1 = require("../../urls/get-item-home-url");
|
|
10
|
+
const getRelativeWorkspaceUrl_1 = require("../../core/getRelativeWorkspaceUrl");
|
|
9
11
|
/**
|
|
10
12
|
* Given a model and a site, set various computed properties that can't be directly mapped
|
|
11
13
|
* @private
|
|
@@ -22,7 +24,16 @@ function computeProps(model, site, requestOptions) {
|
|
|
22
24
|
token = session.token;
|
|
23
25
|
}
|
|
24
26
|
// thumbnail url
|
|
25
|
-
|
|
27
|
+
const thumbnailUrl = resources_1.getItemThumbnailUrl(model.item, requestOptions, token);
|
|
28
|
+
// TODO: Remove this once opendata-ui starts using `links.thumbnail` instead
|
|
29
|
+
site.thumbnailUrl = thumbnailUrl;
|
|
30
|
+
site.links = {
|
|
31
|
+
self: get_item_home_url_1.getItemHomeUrl(site.id, requestOptions),
|
|
32
|
+
siteRelative: "/",
|
|
33
|
+
workspaceRelative: getRelativeWorkspaceUrl_1.getRelativeWorkspaceUrl("site", site.id),
|
|
34
|
+
layoutRelative: "/edit",
|
|
35
|
+
thumbnail: thumbnailUrl,
|
|
36
|
+
};
|
|
26
37
|
// Handle Dates
|
|
27
38
|
site.createdDate = new Date(model.item.created);
|
|
28
39
|
site.createdDateSource = "item.created";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeProps.js","sourceRoot":"","sources":["../../../../src/sites/_internal/computeProps.ts"],"names":[],"mappings":";;;AAEA,+CAAsD;
|
|
1
|
+
{"version":3,"file":"computeProps.js","sourceRoot":"","sources":["../../../../src/sites/_internal/computeProps.ts"],"names":[],"mappings":";;;AAEA,+CAAsD;AAEtD,4EAAyE;AACzE,mDAAkD;AAClD,6FAA0F;AAC1F,2DAA0D;AAC1D,oEAA8D;AAE9D,gFAA6E;AAE7E;;;;;;;GAOG;AACH,SAAgB,YAAY,CAC1B,KAAa,EACb,IAAuB,EACvB,cAA+B;;IAE/B,IAAI,KAAa,CAAC;IAClB,IAAI,cAAc,CAAC,cAAc,EAAE;QACjC,MAAM,OAAO,GAAgB,cAAc,CAAC,cAA6B,CAAC;QAC1E,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;KACvB;IACD,gBAAgB;IAChB,MAAM,YAAY,GAAG,+BAAmB,CAAC,KAAK,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,CAAC,CAAC;IAC5E,4EAA4E;IAC5E,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACjC,IAAI,CAAC,KAAK,GAAG;QACX,IAAI,EAAE,kCAAc,CAAC,IAAI,CAAC,EAAE,EAAE,cAAc,CAAC;QAC7C,YAAY,EAAE,GAAG;QACjB,iBAAiB,EAAE,iDAAuB,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;QAC3D,cAAc,EAAE,OAAO;QACvB,SAAS,EAAE,YAAY;KACxB,CAAC;IAEF,eAAe;IACf,IAAI,CAAC,WAAW,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChD,IAAI,CAAC,iBAAiB,GAAG,cAAc,CAAC;IACxC,IAAI,CAAC,WAAW,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjD,IAAI,CAAC,iBAAiB,GAAG,eAAe,CAAC;IACzC,IAAI,CAAC,aAAa,GAAG,2BAAa,CAAC,IAAI,CAAC,CAAC;IACzC;;OAEG;IACH,IAAI,CAAC,QAAQ,GAAG,6CAAqB,CACnC,OAAA,KAAK,CAAC,IAAI,CAAC,QAAQ,0CAAE,QAAQ,KAAI,EAAE,EACnC,uCAAmB,CACpB,CAAC;IAEF,uDAAuD;IACvD,IAAI,CAAC,OAAO,GAAG,2CAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAElD,wDAAwD;IACxD,OAAO,IAAgB,CAAC;AAC1B,CAAC;AAzCD,oCAyCC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { IRequestOptions } from "@esri/arcgis-rest-request";
|
|
2
|
-
import { IHubEditableContent, IHubLocation } from "../../core";
|
|
3
2
|
import { IModel } from "../../types";
|
|
4
3
|
import { IExtent } from "@esri/arcgis-rest-types";
|
|
4
|
+
import { IHubLocation } from "../../core/types/IHubLocation";
|
|
5
|
+
import { IHubEditableContent } from "../../core/types/IHubEditableContent";
|
|
5
6
|
export declare const getItemExtent: (itemExtent: number[][]) => IExtent;
|
|
6
7
|
export declare function deriveLocationFromItemExtent(itemExtent?: number[][]): IHubLocation;
|
|
7
8
|
export declare function computeProps(model: IModel, content: Partial<IHubEditableContent>, requestOptions: IRequestOptions): IHubEditableContent;
|
|
@@ -102,6 +102,14 @@ export declare const setContentBoundary: (content: IHubContent, boundary: Geogra
|
|
|
102
102
|
createdDateSource: string;
|
|
103
103
|
updatedDate: Date;
|
|
104
104
|
updatedDateSource: string;
|
|
105
|
+
links?: {
|
|
106
|
+
[key: string]: string | import("../../core").ILink;
|
|
107
|
+
thumbnail?: string;
|
|
108
|
+
self: string;
|
|
109
|
+
siteRelative?: string;
|
|
110
|
+
workspaceRelative?: string;
|
|
111
|
+
layoutRelative?: string;
|
|
112
|
+
};
|
|
105
113
|
features?: import("../..").IFeatureFlags;
|
|
106
114
|
isDiscussable?: boolean;
|
|
107
115
|
statistics?: any;
|
|
@@ -1,7 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple interface for Links
|
|
3
|
+
*/
|
|
4
|
+
export interface ILink {
|
|
5
|
+
/**
|
|
6
|
+
* Link url
|
|
7
|
+
*/
|
|
8
|
+
href: string;
|
|
9
|
+
/**
|
|
10
|
+
* Additional optional properties
|
|
11
|
+
*/
|
|
12
|
+
[key: string]: string;
|
|
13
|
+
}
|
|
1
14
|
/**
|
|
2
15
|
* Base properties for Hub Entities
|
|
3
|
-
* This
|
|
4
|
-
* models that are not backed by items.
|
|
16
|
+
* This includes a subset of `IItem`, that can apply to
|
|
17
|
+
* models that are not backed by items. It also includes
|
|
18
|
+
* properties that can be derived for all entity types,
|
|
19
|
+
* such as `links`
|
|
5
20
|
*/
|
|
6
21
|
export interface IHubEntityBase {
|
|
7
22
|
/**
|
|
@@ -48,4 +63,36 @@ export interface IHubEntityBase {
|
|
|
48
63
|
* result to be attributed to something other than "owner"
|
|
49
64
|
*/
|
|
50
65
|
source?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Links to related things
|
|
68
|
+
*/
|
|
69
|
+
links?: {
|
|
70
|
+
/**
|
|
71
|
+
* Url to Thumbnail. May not include a token
|
|
72
|
+
* TODO: Why should we not include the token?
|
|
73
|
+
*/
|
|
74
|
+
thumbnail?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Url to the entities canonical "self"
|
|
77
|
+
* For Items/Groups/Users, this will be the Home App url
|
|
78
|
+
* For other entities, it will be the canonical url
|
|
79
|
+
*/
|
|
80
|
+
self: string;
|
|
81
|
+
/**
|
|
82
|
+
* Relative url of the entity, within a site
|
|
83
|
+
*/
|
|
84
|
+
siteRelative?: string;
|
|
85
|
+
/**
|
|
86
|
+
* Relative workspace url of the entity, within a site
|
|
87
|
+
*/
|
|
88
|
+
workspaceRelative?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Relative url to the entity's layout editing experience
|
|
91
|
+
*/
|
|
92
|
+
layoutRelative?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Additional urls
|
|
95
|
+
*/
|
|
96
|
+
[key: string]: string | ILink;
|
|
97
|
+
};
|
|
51
98
|
}
|
|
@@ -44,6 +44,9 @@ export interface IHubItemEntity extends IHubEntityBase, IWithPermissions, IWithD
|
|
|
44
44
|
*/
|
|
45
45
|
owner: string;
|
|
46
46
|
/**
|
|
47
|
+
* TODO: change this property to store item.url. Store the
|
|
48
|
+
* canonical url in IHubEntityBase.links.self instead.
|
|
49
|
+
*
|
|
47
50
|
* Canonical Url for the Entity
|
|
48
51
|
*/
|
|
49
52
|
url?: string;
|
|
@@ -57,7 +60,8 @@ export interface IHubItemEntity extends IHubEntityBase, IWithPermissions, IWithD
|
|
|
57
60
|
*/
|
|
58
61
|
tags: string[];
|
|
59
62
|
/**
|
|
60
|
-
*
|
|
63
|
+
* TODO: Deprecate this in favor of IHubEntityBase.links.thumbnail
|
|
64
|
+
* Thumbnail Url (read-only)
|
|
61
65
|
*/
|
|
62
66
|
thumbnailUrl?: string;
|
|
63
67
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IRequestOptions } from "@esri/arcgis-rest-request";
|
|
2
|
-
import { IHubPage } from "../../core";
|
|
3
2
|
import { IModel } from "../../types";
|
|
3
|
+
import { IHubPage } from "../../core/types/IHubPage";
|
|
4
4
|
/**
|
|
5
5
|
* Given a model and a page, set various computed properties that can't be directly mapped
|
|
6
6
|
* @private
|
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
import { AccessLevel, IHubEntityBase } from "../../core";
|
|
2
2
|
import { HubFamily, IHubGeography } from "../../types";
|
|
3
|
-
/**
|
|
4
|
-
* Simple interface for Links
|
|
5
|
-
*/
|
|
6
|
-
export interface ILink {
|
|
7
|
-
/**
|
|
8
|
-
* Link url
|
|
9
|
-
*/
|
|
10
|
-
href: string;
|
|
11
|
-
/**
|
|
12
|
-
* Additional optional properties
|
|
13
|
-
*/
|
|
14
|
-
[key: string]: string;
|
|
15
|
-
}
|
|
16
3
|
/**
|
|
17
4
|
* Standardized light-weight search result structure, applicable to all
|
|
18
5
|
* types of search results - users, groups, content, events etc
|
|
@@ -42,33 +29,6 @@ export interface IHubSearchResult extends IHubEntityBase {
|
|
|
42
29
|
* TypeKeywords; Applies to Items
|
|
43
30
|
*/
|
|
44
31
|
typeKeywords?: string[];
|
|
45
|
-
/**
|
|
46
|
-
* Links to related things
|
|
47
|
-
*/
|
|
48
|
-
links?: {
|
|
49
|
-
/**
|
|
50
|
-
* Url to Thumbnail. Will not include a token
|
|
51
|
-
*/
|
|
52
|
-
thumbnail?: string;
|
|
53
|
-
/**
|
|
54
|
-
* Url to the entities canonical "self"
|
|
55
|
-
* For Items/Groups/Users, this will be the Home App url
|
|
56
|
-
* For other entities, it will be the canonical url
|
|
57
|
-
*/
|
|
58
|
-
self: string;
|
|
59
|
-
/**
|
|
60
|
-
* Relative url of the entity, within a site
|
|
61
|
-
*/
|
|
62
|
-
siteRelative: string;
|
|
63
|
-
/**
|
|
64
|
-
* Relative workspace url of the entity, within a site
|
|
65
|
-
*/
|
|
66
|
-
workspaceRelative?: string;
|
|
67
|
-
/**
|
|
68
|
-
* Additional urls
|
|
69
|
-
*/
|
|
70
|
-
[key: string]: string | ILink;
|
|
71
|
-
};
|
|
72
32
|
/**
|
|
73
33
|
* Geometry connected to this entity
|
|
74
34
|
* For items, it will default to the extent,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IRequestOptions } from "@esri/arcgis-rest-request";
|
|
2
|
-
import { IHubSite } from "../../core";
|
|
3
2
|
import { IModel } from "../../types";
|
|
3
|
+
import { IHubSite } from "../../core/types/IHubSite";
|
|
4
4
|
/**
|
|
5
5
|
* Given a model and a site, set various computed properties that can't be directly mapped
|
|
6
6
|
* @private
|