Skip to content

Commit

Permalink
Merge branch '12182/events-can-set-thumbnail' of https://github.com/E…
Browse files Browse the repository at this point in the history
…sri/hub.js into 12182/events-can-set-thumbnail
  • Loading branch information
juliannaeapicella committed Jan 31, 2025
2 parents a7bdb82 + 5401935 commit 61da070
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 5 deletions.
14 changes: 14 additions & 0 deletions packages/common/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## @esri/hub-common [15.25.1](https://github.com/Esri/hub.js/compare/@esri/[email protected]...@esri/[email protected]) (2025-01-31)


### Bug Fixes

* **hub-common:** update spatial element from default dcat us template ([#1788](https://github.com/Esri/hub.js/issues/1788)) ([064deea](https://github.com/Esri/hub.js/commit/064deea7d18175c6d13848cc9026740e59d322f1))

# @esri/hub-common [15.25.0](https://github.com/Esri/hub.js/compare/@esri/[email protected]...@esri/[email protected]) (2025-01-30)


### Features

* **hub-common:** add hub:feature:catalogs:edit:advanced permission for controlling catalog editing ([#1785](https://github.com/Esri/hub.js/issues/1785)) ([d3fd836](https://github.com/Esri/hub.js/commit/d3fd8361e11133d62293dd76e1e45316791e3126))

# @esri/hub-common [15.24.0](https://github.com/Esri/hub.js/compare/@esri/[email protected]...@esri/[email protected]) (2025-01-29)


Expand Down
4 changes: 2 additions & 2 deletions packages/common/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@esri/hub-common",
"version": "15.24.0",
"version": "15.25.1",
"description": "Common TypeScript types and utility functions for @esri/hub.js.",
"main": "dist/node/index.js",
"module": "dist/esm/index.js",
Expand Down
13 changes: 13 additions & 0 deletions packages/common/src/permissions/HubPermissionPolicies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,19 @@ const SystemPermissionPolicies: IPermissionPolicy[] = [
environments: ["qaext"],
availability: ["alpha"],
},
// TODO: Remove this permission once all catalog configuration features are supported by sites
{
permission: "hub:feature:catalogs:edit:advanced",
dependencies: ["hub:feature:catalogs"],
entityEdit: true,
assertions: [
{
property: "entity:type",
type: "neq",
value: "Hub Site Application",
},
],
},
{
// Enable inline-workspace for Entity Views
// limited to devext alpha so we have to pass as a flag to enable
Expand Down
2 changes: 2 additions & 0 deletions packages/common/src/permissions/types/Permission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ const SystemPermissions = [
"hub:feature:newentityview",
"hub:feature:history",
"hub:feature:catalogs",
/** remove once sites support all catalog configuration features */
"hub:feature:catalogs:edit:advanced",
"hub:feature:inline-workspace",
"hub:feature:pagescatalog",
"hub:license:hub-premium",
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/sites/feeds/_internal/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const DCAT_US_1X_DEFAULT = {
fn: "{{owner}}",
hasEmail: "{{orgContactEmail}}",
},
spatial: "{{extent}}",
spatial: "{{extent:computeSpatialProperty}}",
};

const DCAT_US_3X_DEFAULT = {
Expand Down
15 changes: 14 additions & 1 deletion packages/common/src/sites/feeds/getFeedTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,20 @@ function getDcatApConfig(feedsConfig: IFeedsConfiguration, version: string) {

function getDcatUsConfig(feedsConfig: IFeedsConfiguration, version: string) {
if (getMajorVersion(version) === "1") {
return feedsConfig.dcatUS1X || feedsConfig.dcatUS11;
const dcatUsConfig = feedsConfig.dcatUS1X || feedsConfig.dcatUS11;
// Some sites may have dcat us config with invalid
// extent value for spatial property i.e. '{{extent}}'
//
// Following fixes that by replacing invalid default extent
// value to valid one i.e. '{{{extent:computeSpatialProperty}}'
if (
dcatUsConfig &&
typeof dcatUsConfig.spatial === "string" &&
dcatUsConfig.spatial.replace(/\s/g, "") === "{{extent}}"
) {
dcatUsConfig.spatial = "{{extent:computeSpatialProperty}}";
}
return dcatUsConfig;
}

if (getMajorVersion(version) === "3") {
Expand Down
16 changes: 16 additions & 0 deletions packages/common/test/sites/feeds/getFeedTemplate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,22 @@ describe("getFeedTemplate", () => {
const chk = getFeedTemplate({ feedsConfig, format, version });
expect(chk).toEqual(dcatUsConfig);
});
it("gets DCAT US configuration containing spatial field with valid extent value", async () => {
const dcatUsConfig = {
title: "{{title}}",
spatial: " {{ extent }} ",
};
const feedsConfig: IFeedsConfiguration = {
dcatUS1X: dcatUsConfig,
};
const format: FeedFormat = "dcat-us";
const version = "1.1";
const chk = getFeedTemplate({ feedsConfig, format, version });
expect(chk).toEqual(dcatUsConfig);
expect(chk).toBeDefined();
expect(chk.spatial).toEqual("{{extent:computeSpatialProperty}}");
expect(chk.title).toEqual("{{title}}");
});
it("throws error if DCAT US version is not supported", async () => {
const dcatUsConfig = {
title: "{{title}}",
Expand Down

0 comments on commit 61da070

Please sign in to comment.