@esri/hub-common 18.13.0 → 19.0.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/core/_internal/PropertyMapper.js +1 -1
- package/dist/esm/core/_internal/PropertyMapper.js.map +1 -1
- package/dist/esm/core/_internal/hubItemEntityFromEditor.js +99 -0
- package/dist/esm/core/_internal/hubItemEntityFromEditor.js.map +1 -0
- package/dist/esm/core/schemas/internal/buildCatalogSetupUiSchemaElement.js +95 -0
- package/dist/esm/core/schemas/internal/buildCatalogSetupUiSchemaElement.js.map +1 -0
- package/dist/esm/core/schemas/internal/metrics/setMetricAndDisplay.js.map +1 -1
- package/dist/esm/core/schemas/shared/HubItemEntitySchema.js +31 -25
- package/dist/esm/core/schemas/shared/HubItemEntitySchema.js.map +1 -1
- package/dist/esm/core/schemas/shared/subschemas.js +33 -0
- package/dist/esm/core/schemas/shared/subschemas.js.map +1 -1
- package/dist/esm/discussions/HubDiscussion.js +45 -11
- package/dist/esm/discussions/HubDiscussion.js.map +1 -1
- package/dist/esm/events/HubEvent.js +15 -3
- package/dist/esm/events/HubEvent.js.map +1 -1
- package/dist/esm/events/_internal/EventSchemaCreate.js +3 -2
- package/dist/esm/events/_internal/EventSchemaCreate.js.map +1 -1
- package/dist/esm/events/_internal/EventUiSchemaCreate.js +2 -0
- package/dist/esm/events/_internal/EventUiSchemaCreate.js.map +1 -1
- package/dist/esm/events/edit.js +1 -0
- package/dist/esm/events/edit.js.map +1 -1
- package/dist/esm/initiative-templates/HubInitiativeTemplate.js +10 -20
- package/dist/esm/initiative-templates/HubInitiativeTemplate.js.map +1 -1
- package/dist/esm/initiatives/HubInitiative.js +43 -59
- package/dist/esm/initiatives/HubInitiative.js.map +1 -1
- package/dist/esm/initiatives/HubInitiatives.js +2 -64
- package/dist/esm/initiatives/HubInitiatives.js.map +1 -1
- package/dist/esm/initiatives/_internal/InitiativeUiSchemaCreate2.js +3 -1
- package/dist/esm/initiatives/_internal/InitiativeUiSchemaCreate2.js.map +1 -1
- package/dist/esm/pages/HubPage.js +10 -23
- package/dist/esm/pages/HubPage.js.map +1 -1
- package/dist/esm/projects/HubProject.js +16 -54
- package/dist/esm/projects/HubProject.js.map +1 -1
- package/dist/esm/projects/_internal/ProjectUiSchemaCreate2.js +3 -1
- package/dist/esm/projects/_internal/ProjectUiSchemaCreate2.js.map +1 -1
- package/dist/esm/projects/edit.js +2 -34
- package/dist/esm/projects/edit.js.map +1 -1
- package/dist/esm/search/initCatalogOnEntityCreate.js +40 -0
- package/dist/esm/search/initCatalogOnEntityCreate.js.map +1 -0
- package/dist/esm/search/types/types.js +10 -0
- package/dist/esm/search/types/types.js.map +1 -1
- package/dist/esm/search/upgradeCatalogSchema.js +2 -1
- package/dist/esm/search/upgradeCatalogSchema.js.map +1 -1
- package/dist/esm/sites/HubSite.js +17 -27
- package/dist/esm/sites/HubSite.js.map +1 -1
- package/dist/esm/sites/_internal/SiteUiSchemaCreate.js +2 -0
- package/dist/esm/sites/_internal/SiteUiSchemaCreate.js.map +1 -1
- package/dist/esm/templates/HubTemplate.js +11 -21
- package/dist/esm/templates/HubTemplate.js.map +1 -1
- package/dist/esm/utils/get-hub-product.js.map +1 -1
- package/dist/node/core/_internal/PropertyMapper.js +3 -3
- package/dist/node/core/_internal/PropertyMapper.js.map +1 -1
- package/dist/node/core/_internal/hubItemEntityFromEditor.js +102 -0
- package/dist/node/core/_internal/hubItemEntityFromEditor.js.map +1 -0
- package/dist/node/core/schemas/internal/buildCatalogSetupUiSchemaElement.js +99 -0
- package/dist/node/core/schemas/internal/buildCatalogSetupUiSchemaElement.js.map +1 -0
- package/dist/node/core/schemas/internal/metrics/setMetricAndDisplay.js.map +1 -1
- package/dist/node/core/schemas/shared/HubItemEntitySchema.js +30 -24
- package/dist/node/core/schemas/shared/HubItemEntitySchema.js.map +1 -1
- package/dist/node/core/schemas/shared/subschemas.js +34 -1
- package/dist/node/core/schemas/shared/subschemas.js.map +1 -1
- package/dist/node/discussions/HubDiscussion.js +45 -11
- package/dist/node/discussions/HubDiscussion.js.map +1 -1
- package/dist/node/events/HubEvent.js +15 -3
- package/dist/node/events/HubEvent.js.map +1 -1
- package/dist/node/events/_internal/EventSchemaCreate.js +1 -0
- package/dist/node/events/_internal/EventSchemaCreate.js.map +1 -1
- package/dist/node/events/_internal/EventUiSchemaCreate.js +2 -0
- package/dist/node/events/_internal/EventUiSchemaCreate.js.map +1 -1
- package/dist/node/events/edit.js +1 -0
- package/dist/node/events/edit.js.map +1 -1
- package/dist/node/initiative-templates/HubInitiativeTemplate.js +10 -20
- package/dist/node/initiative-templates/HubInitiativeTemplate.js.map +1 -1
- package/dist/node/initiatives/HubInitiative.js +40 -56
- package/dist/node/initiatives/HubInitiative.js.map +1 -1
- package/dist/node/initiatives/HubInitiatives.js +1 -64
- package/dist/node/initiatives/HubInitiatives.js.map +1 -1
- package/dist/node/initiatives/_internal/InitiativeUiSchemaCreate2.js +3 -1
- package/dist/node/initiatives/_internal/InitiativeUiSchemaCreate2.js.map +1 -1
- package/dist/node/pages/HubPage.js +10 -23
- package/dist/node/pages/HubPage.js.map +1 -1
- package/dist/node/projects/HubProject.js +14 -52
- package/dist/node/projects/HubProject.js.map +1 -1
- package/dist/node/projects/_internal/ProjectUiSchemaCreate2.js +3 -1
- package/dist/node/projects/_internal/ProjectUiSchemaCreate2.js.map +1 -1
- package/dist/node/projects/edit.js +1 -34
- package/dist/node/projects/edit.js.map +1 -1
- package/dist/node/search/initCatalogOnEntityCreate.js +43 -0
- package/dist/node/search/initCatalogOnEntityCreate.js.map +1 -0
- package/dist/node/search/types/types.js +11 -0
- package/dist/node/search/types/types.js.map +1 -1
- package/dist/node/search/upgradeCatalogSchema.js +4 -3
- package/dist/node/search/upgradeCatalogSchema.js.map +1 -1
- package/dist/node/sites/HubSite.js +17 -27
- package/dist/node/sites/HubSite.js.map +1 -1
- package/dist/node/sites/_internal/SiteUiSchemaCreate.js +2 -0
- package/dist/node/sites/_internal/SiteUiSchemaCreate.js.map +1 -1
- package/dist/node/templates/HubTemplate.js +10 -20
- package/dist/node/templates/HubTemplate.js.map +1 -1
- package/dist/node/utils/get-hub-product.js.map +1 -1
- package/dist/types/core/_internal/hubItemEntityFromEditor.d.ts +18 -0
- package/dist/types/core/schemas/internal/buildCatalogSetupUiSchemaElement.d.ts +12 -0
- package/dist/types/core/schemas/internal/metrics/setMetricAndDisplay.d.ts +2 -2
- package/dist/types/core/schemas/shared/subschemas.d.ts +1 -0
- package/dist/types/core/types/IHubItemEntity.d.ts +7 -0
- package/dist/types/initiatives/HubInitiatives.d.ts +1 -9
- package/dist/types/initiatives/_internal/InitiativeUiSchemaCreate2.d.ts +1 -1
- package/dist/types/projects/HubProject.d.ts +6 -4
- package/dist/types/projects/_internal/ProjectUiSchemaCreate2.d.ts +1 -1
- package/dist/types/projects/edit.d.ts +1 -9
- package/dist/types/search/initCatalogOnEntityCreate.d.ts +12 -0
- package/dist/types/search/types/types.d.ts +15 -0
- package/dist/types/search/upgradeCatalogSchema.d.ts +1 -0
- package/package.json +1 -1
- package/dist/esm/core/schemas/internal/metrics/editorToEntity.js +0 -37
- package/dist/esm/core/schemas/internal/metrics/editorToEntity.js.map +0 -1
- package/dist/node/core/schemas/internal/metrics/editorToEntity.js +0 -41
- package/dist/node/core/schemas/internal/metrics/editorToEntity.js.map +0 -1
- package/dist/types/core/schemas/internal/metrics/editorToEntity.d.ts +0 -10
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initCatalogOnEntityCreate = void 0;
|
|
4
|
+
const getWellKnownGroup_1 = require("../groups/getWellKnownGroup");
|
|
5
|
+
const HubGroups_1 = require("../groups/HubGroups");
|
|
6
|
+
const upgradeCatalogSchema_1 = require("./upgradeCatalogSchema");
|
|
7
|
+
/**
|
|
8
|
+
* Initializes an returns a catalog to persist on Hub item
|
|
9
|
+
* entity upon creation based on user-configured options.
|
|
10
|
+
*
|
|
11
|
+
* @param entity - Hub item entity
|
|
12
|
+
* @param catalogSetup - options for initializing the catalog
|
|
13
|
+
* @param context - contextual portal & auth information
|
|
14
|
+
*/
|
|
15
|
+
exports.initCatalogOnEntityCreate = async (entity, catalogSetup, context) => {
|
|
16
|
+
var _a;
|
|
17
|
+
// If a user elects to initialize the entity with an
|
|
18
|
+
// existing group, we grab the id of the group they've
|
|
19
|
+
// selected.
|
|
20
|
+
let groupId = (_a = catalogSetup.groupId) === null || _a === void 0 ? void 0 : _a[0];
|
|
21
|
+
// If a user elects to initialize the catalog with a
|
|
22
|
+
// new group, we create the new group
|
|
23
|
+
if (catalogSetup.type === "newGroup") {
|
|
24
|
+
const partialGroup = Object.assign(Object.assign({}, getWellKnownGroup_1.getWellKnownGroup("hubViewGroup", context)), { name: `${entity.name} Content` });
|
|
25
|
+
const group = await HubGroups_1.createHubGroup(partialGroup, context.userRequestOptions);
|
|
26
|
+
groupId = group.id;
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
schemaVersion: upgradeCatalogSchema_1.CATALOG_SCHEMA_VERSION,
|
|
30
|
+
scopes: {
|
|
31
|
+
item: {
|
|
32
|
+
targetEntity: "item",
|
|
33
|
+
filters: [{ predicates: [{ group: [groupId] }] }],
|
|
34
|
+
},
|
|
35
|
+
event: {
|
|
36
|
+
targetEntity: "event",
|
|
37
|
+
filters: [{ predicates: [{ group: [groupId] }] }],
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
collections: [],
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=initCatalogOnEntityCreate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initCatalogOnEntityCreate.js","sourceRoot":"","sources":["../../../src/search/initCatalogOnEntityCreate.ts"],"names":[],"mappings":";;;AACA,mEAAgE;AAChE,mDAAqD;AAGrD,iEAAgE;AAEhE;;;;;;;GAOG;AACU,QAAA,yBAAyB,GAAG,KAAK,EAC5C,MAAsB,EACtB,YAA2B,EAC3B,OAAuB,EACD,EAAE;;IACxB,oDAAoD;IACpD,sDAAsD;IACtD,YAAY;IACZ,IAAI,OAAO,SAAG,YAAY,CAAC,OAAO,0CAAG,CAAC,CAAC,CAAC;IAExC,oDAAoD;IACpD,qCAAqC;IACrC,IAAI,YAAY,CAAC,IAAI,KAAK,UAAU,EAAE;QACpC,MAAM,YAAY,mCACb,qCAAiB,CAAC,cAAc,EAAE,OAAO,CAAC,KAC7C,IAAI,EAAE,GAAG,MAAM,CAAC,IAAI,UAAU,GAC/B,CAAC;QACF,MAAM,KAAK,GAAG,MAAM,0BAAc,CAChC,YAAY,EACZ,OAAO,CAAC,kBAAkB,CAC3B,CAAC;QACF,OAAO,GAAG,KAAK,CAAC,EAAE,CAAC;KACpB;IAED,OAAO;QACL,aAAa,EAAE,6CAAsB;QACrC,MAAM,EAAE;YACN,IAAI,EAAE;gBACJ,YAAY,EAAE,MAAM;gBACpB,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC;aAClD;YACD,KAAK,EAAE;gBACL,YAAY,EAAE,OAAO;gBACrB,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC;aAClD;SACF;QACD,WAAW,EAAE,EAAE;KAChB,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CATALOG_SETUP_TYPES = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* When creating an entity, an editor can elect to initialize
|
|
6
|
+
* the entity's catalog with a new group or an existing group.
|
|
7
|
+
* The following types enumerate these options.
|
|
8
|
+
*/
|
|
9
|
+
exports.CATALOG_SETUP_TYPES = [
|
|
10
|
+
"blank",
|
|
11
|
+
"newGroup",
|
|
12
|
+
"existingGroup",
|
|
13
|
+
];
|
|
3
14
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/search/types/types.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/search/types/types.ts"],"names":[],"mappings":";;;AAuMA;;;;GAIG;AACU,QAAA,mBAAmB,GAAG;IACjC,OAAO;IACP,UAAU;IACV,eAAe;CACP,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.upgradeCatalogSchema = void 0;
|
|
3
|
+
exports.upgradeCatalogSchema = exports.CATALOG_SCHEMA_VERSION = void 0;
|
|
4
4
|
const objects_1 = require("../objects");
|
|
5
5
|
const util_1 = require("../util");
|
|
6
|
-
|
|
6
|
+
// The current catalog schema version
|
|
7
|
+
exports.CATALOG_SCHEMA_VERSION = 1.0;
|
|
7
8
|
const getAgoEntityOrgIdPredicates = (orgId) => [
|
|
8
9
|
// Portal uses `orgid` instead of `orgId`, so we comply.
|
|
9
10
|
// While `orgid` is valid field for search, it does not count
|
|
@@ -35,7 +36,7 @@ const ORG_ID_PREDICATE_FNS_BY_ENTITY_TYPE = {
|
|
|
35
36
|
* @returns
|
|
36
37
|
*/
|
|
37
38
|
function upgradeCatalogSchema(catalog) {
|
|
38
|
-
if (objects_1.getProp(catalog, "schemaVersion") === CATALOG_SCHEMA_VERSION) {
|
|
39
|
+
if (objects_1.getProp(catalog, "schemaVersion") === exports.CATALOG_SCHEMA_VERSION) {
|
|
39
40
|
return catalog;
|
|
40
41
|
}
|
|
41
42
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgradeCatalogSchema.js","sourceRoot":"","sources":["../../../src/search/upgradeCatalogSchema.ts"],"names":[],"mappings":";;;AAAA,wCAAqC;AACrC,kCAAsC;AAStC,
|
|
1
|
+
{"version":3,"file":"upgradeCatalogSchema.js","sourceRoot":"","sources":["../../../src/search/upgradeCatalogSchema.ts"],"names":[],"mappings":";;;AAAA,wCAAqC;AACrC,kCAAsC;AAStC,qCAAqC;AACxB,QAAA,sBAAsB,GAAG,GAAG,CAAC;AAE1C,MAAM,2BAA2B,GAAG,CAAC,KAAa,EAAgB,EAAE,CAAC;IACnE,wDAAwD;IACxD,6DAA6D;IAC7D,+DAA+D;IAC/D,EAAE,KAAK,EAAE,CAAC,KAAK,CAAC,EAAE;IAClB,6DAA6D;IAC7D,+DAA+D;IAC/D,gEAAgE;IAChE,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,EAAE,EAAE;CACvC,CAAC;AAEF,MAAM,6BAA6B,GAAG,CAAC,KAAa,EAAgB,EAAE,CAAC;IACrE,EAAE,KAAK,EAAE;CACV,CAAC;AAEF,MAAM,6BAA6B,GAAG,CAAC,KAAa,EAAgB,EAAE,CAAC;IACrE,EAAE,KAAK,EAAE,KAAK,EAAE;CACjB,CAAC;AAEF,MAAM,4BAA4B,GAAG,CAAC,KAAa,EAAgB,EAAE,CAAC;IACpE,EAAE,KAAK,EAAE,KAAK,EAAE;CACjB,CAAC;AAEF,MAAM,mCAAmC,GAErC;IACF,IAAI,EAAE,2BAA2B;IACjC,KAAK,EAAE,6BAA6B;IACpC,KAAK,EAAE,6BAA6B;IACpC,IAAI,EAAE,4BAA4B;CACnC,CAAC;AAEF;;;;GAIG;AACH,SAAgB,oBAAoB,CAAC,OAAY;IAC/C,IAAI,iBAAO,CAAC,OAAO,EAAE,eAAe,CAAC,KAAK,8BAAsB,EAAE;QAChE,OAAO,OAAO,CAAC;KAChB;SAAM;QACL,IAAI,KAAK,GAAG,kBAAW,CAAC,OAAO,CAAC,CAAC;QAEjC,4BAA4B;QAC5B,KAAK,GAAG,kBAAkB,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,EAAE,CACH,CAAC;SACH;QAED,0DAA0D;QAC1D,2DAA2D;QAC3D,MAAM,KAAK,GAAG,iBAAO,CAAC,QAAQ,EAAE,OAAO,CAAW,CAAC;QACnD,IAAI,KAAK,EAAE;YACT,uDAAuD;YACvD,+DAA+D;YAC/D,OAAO,CAAC,MAAM,CAAC,IAAI,GAAG;gBACpB,YAAY,EAAE,MAAM;gBACpB,OAAO,EAAE,EAAE;aACZ,CAAC;YACF,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG;gBACrB,YAAY,EAAE,OAAO;gBACrB,OAAO,EAAE,EAAE;aACZ,CAAC;YACF,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG;gBACrB,YAAY,EAAE,OAAO;gBACrB,OAAO,EAAE,EAAE;aACZ,CAAC;YACF,OAAO,CAAC,MAAM,CAAC,IAAI,GAAG;gBACpB,YAAY,EAAE,MAAM;gBACpB,OAAO,EAAE,EAAE;aACZ,CAAC;YAEF,oDAAoD;YACpD,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CACpD,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;gBACb,MAAM,UAAU,GAAe,KAAK,CAAC,CAAC,CAAe,CAAC;gBACtD,MAAM,KAAK,GAAW,KAAK,CAAC,CAAC,CAAC,CAAC;gBAC/B,uCACK,GAAG,KACN,CAAC,UAAU,CAAC,kCACP,KAAK,KACR,OAAO,EAAE;4BACP;gCACE,SAAS,EAAE,KAAK;gCAChB,UAAU,EACR,mCAAmC,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC;6BACzD;yBACF,OAEH;YACJ,CAAC,EACD,EAAE,CACH,CAAC;SACH;QAED,OAAO,OAAO,CAAC;KAChB;AACH,CAAC"}
|
|
@@ -13,8 +13,9 @@ const util_1 = require("../util");
|
|
|
13
13
|
const PropertyMapper_1 = require("../core/_internal/PropertyMapper");
|
|
14
14
|
const getPropertyMap_1 = require("./_internal/getPropertyMap");
|
|
15
15
|
const index_1 = require("../index");
|
|
16
|
+
const utils_1 = require("../discussions/utils");
|
|
16
17
|
const getEditorSlug_1 = require("../core/_internal/getEditorSlug");
|
|
17
|
-
const
|
|
18
|
+
const hubItemEntityFromEditor_1 = require("../core/_internal/hubItemEntityFromEditor");
|
|
18
19
|
/**
|
|
19
20
|
* Hub Site Class
|
|
20
21
|
* NOTE: This is a minimal implementation. Create operations are not supported at this time
|
|
@@ -303,7 +304,7 @@ class HubSite extends HubItemEntity_1.HubItemEntity {
|
|
|
303
304
|
index_1.setProp("_followers.showFollowAction", this.entity.features["hub:site:feature:follow"], editor);
|
|
304
305
|
editor._slug = getEditorSlug_1.getEditorSlug(this.entity);
|
|
305
306
|
const followersGroup = await this.getFollowersGroup();
|
|
306
|
-
index_1.setProp("_followers.isDiscussable",
|
|
307
|
+
index_1.setProp("_followers.isDiscussable", utils_1.isDiscussable(followersGroup), editor);
|
|
307
308
|
editor._discussions = this.entity.features["hub:site:feature:discussions"];
|
|
308
309
|
// used by the site URL composite field
|
|
309
310
|
if (!editor._urlInfo) {
|
|
@@ -322,39 +323,28 @@ class HubSite extends HubItemEntity_1.HubItemEntity {
|
|
|
322
323
|
* @returns
|
|
323
324
|
*/
|
|
324
325
|
async fromEditor(editor) {
|
|
325
|
-
// 1. Perform any pre-save operations e.g. storing
|
|
326
|
-
// image resources on the item, setting access, etc.
|
|
327
326
|
var _a, _b, _c;
|
|
328
|
-
//
|
|
329
|
-
//
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
this.thumbnailCache = {
|
|
340
|
-
clear: true,
|
|
341
|
-
};
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
delete editor._thumbnail;
|
|
345
|
-
// set whether or not the followers group is discussable
|
|
327
|
+
// 1. delegate to an item-specific fromEditor util to
|
|
328
|
+
// handle shared "fromEditor" logic
|
|
329
|
+
const res = await hubItemEntityFromEditor_1.hubItemEntityFromEditor(editor, this.context);
|
|
330
|
+
const entity = res.entity;
|
|
331
|
+
// iterate over the res object keys and set the values
|
|
332
|
+
// on the HubSite instance
|
|
333
|
+
Object.entries(res).forEach(([key, value]) => {
|
|
334
|
+
index_1.setProp(key, value, this);
|
|
335
|
+
});
|
|
336
|
+
// 2. handle site-specific operations
|
|
337
|
+
// a. set whether or not the followers group is discussable
|
|
346
338
|
if ((_a = editor._followers) === null || _a === void 0 ? void 0 : _a.isDiscussable) {
|
|
347
339
|
await this.setFollowersGroupIsDiscussable(editor._followers.isDiscussable);
|
|
348
340
|
}
|
|
349
|
-
// set the followers group access
|
|
341
|
+
// b. set the followers group access
|
|
350
342
|
if ((_b = editor._followers) === null || _b === void 0 ? void 0 : _b.groupAccess) {
|
|
351
343
|
await this.setFollowersGroupAccess(editor._followers.groupAccess);
|
|
352
344
|
}
|
|
353
|
-
//
|
|
354
|
-
// any reverse transforms used in the toEditor method
|
|
355
|
-
const entity = editorToEntity_1.editorToEntity(editor, this.context.portal);
|
|
345
|
+
// c. set site feature flags
|
|
356
346
|
entity.features = Object.assign(Object.assign({}, entity.features), { "hub:site:feature:follow": (_c = editor._followers) === null || _c === void 0 ? void 0 : _c.showFollowAction, "hub:site:feature:discussions": editor._discussions });
|
|
357
|
-
// site URL info
|
|
347
|
+
// d. handle site URL info
|
|
358
348
|
const { url, subdomain, defaultHostname } = editor._urlInfo;
|
|
359
349
|
entity.url = url;
|
|
360
350
|
entity.subdomain = subdomain;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HubSite.js","sourceRoot":"","sources":["../../../src/sites/HubSite.ts"],"names":[],"mappings":";;;AASA,+CAA4C;AAE5C,yDAAsD;AACtD,qEAAkE;AAClE,uDAAoD;AAGpD,yCAA0C;AAC1C,yCAOoB;AAGpB,iEAA8D;AAE9D,8CAUuB;AAEvB,kCAAsC;AAEtC,qEAAkE;AACl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0BA4bC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildUiSchema = void 0;
|
|
4
|
+
const buildCatalogSetupUiSchemaElement_1 = require("../../core/schemas/internal/buildCatalogSetupUiSchemaElement");
|
|
4
5
|
/**
|
|
5
6
|
* @private
|
|
6
7
|
* constructs the minimal create uiSchema for Hub Sites.
|
|
@@ -62,6 +63,7 @@ exports.buildUiSchema = async (i18nScope, options, context) => {
|
|
|
62
63
|
],
|
|
63
64
|
},
|
|
64
65
|
},
|
|
66
|
+
...buildCatalogSetupUiSchemaElement_1.buildCatalogSetupUiSchemaElement(i18nScope, context),
|
|
65
67
|
],
|
|
66
68
|
};
|
|
67
69
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SiteUiSchemaCreate.js","sourceRoot":"","sources":["../../../../src/sites/_internal/SiteUiSchemaCreate.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"SiteUiSchemaCreate.js","sourceRoot":"","sources":["../../../../src/sites/_internal/SiteUiSchemaCreate.ts"],"names":[],"mappings":";;;AAGA,mHAAgH;AAEhH;;;;;;;;GAQG;AACU,QAAA,aAAa,GAAG,KAAK,EAChC,SAAiB,EACjB,OAA0B,EAC1B,OAAuB,EACH,EAAE;IACtB,gDAAgD;IAChD,sDAAsD;IACtD,8CAA8C;IAC9C,MAAM,SAAS,GAAI,OAAoB,CAAC,SAAS,CAAC;IAClD,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE;YACR;gBACE,QAAQ,EAAE,GAAG,SAAS,oBAAoB;gBAC1C,KAAK,EAAE,kBAAkB;gBACzB,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE;oBACP,QAAQ,EAAE;wBACR;4BACE,IAAI,EAAE,OAAO;4BACb,OAAO,EAAE,UAAU;4BACnB,IAAI,EAAE,IAAI;4BACV,QAAQ,EAAE,GAAG,SAAS,4BAA4B;yBACnD;wBACD;4BACE,IAAI,EAAE,OAAO;4BACb,OAAO,EAAE,WAAW;4BACpB,IAAI,EAAE,IAAI;4BACV,QAAQ,EAAE,GAAG,SAAS,6BAA6B;yBACpD;wBACD;4BACE,IAAI,EAAE,OAAO;4BACb,OAAO,EAAE,QAAQ;4BACjB,IAAI,EAAE,IAAI;4BACV,QAAQ,EAAE,GAAG,SAAS,4CAA4C;yBACnE;qBACF;iBACF;aACF;YACD;gBACE,KAAK,EAAE,sBAAsB;gBAC7B,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE;oBACP,IAAI,EAAE,SAAS;oBACf,OAAO,EAAE,8BAA8B;oBACvC,SAAS;oBACT,QAAQ,EAAE;wBACR;4BACE,IAAI,EAAE,OAAO;4BACb,OAAO,EAAE,gBAAgB;4BACzB,QAAQ,EAAE,GAAG,SAAS,+BAA+B;4BACrD,IAAI,EAAE,IAAI;yBACX;qBACF;iBACF;aACF;YACD,GAAG,mEAAgC,CAAC,SAAS,EAAE,OAAO,CAAC;SACxD;KACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -8,6 +8,8 @@ const edit_1 = require("./edit");
|
|
|
8
8
|
const fetch_1 = require("./fetch");
|
|
9
9
|
const enrichEntity_1 = require("../core/enrichEntity");
|
|
10
10
|
const util_1 = require("../util");
|
|
11
|
+
const objects_1 = require("../objects");
|
|
12
|
+
const hubItemEntityFromEditor_1 = require("../core/_internal/hubItemEntityFromEditor");
|
|
11
13
|
/**
|
|
12
14
|
* Hub Template Class - this class encapsulates the standard
|
|
13
15
|
* operations for a "Solution" item despite the Hub team not
|
|
@@ -119,27 +121,15 @@ class HubTemplate extends HubItemEntity_1.HubItemEntity {
|
|
|
119
121
|
* @param editor
|
|
120
122
|
*/
|
|
121
123
|
async fromEditor(editor) {
|
|
122
|
-
//
|
|
123
|
-
//
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
clear: false,
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
this.thumbnailCache = {
|
|
135
|
-
clear: true,
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
delete editor._thumbnail;
|
|
140
|
-
const entity = edit_1.editorToTemplate(editor, this.context.portal);
|
|
124
|
+
// delegate to an item-specific fromEditor util to
|
|
125
|
+
// handle shared "fromEditor" logic
|
|
126
|
+
const res = await hubItemEntityFromEditor_1.hubItemEntityFromEditor(editor, this.context);
|
|
127
|
+
// iterate over the res object keys and set the values
|
|
128
|
+
// on the HubTemplate instance
|
|
129
|
+
Object.entries(res).forEach(([key, value]) => {
|
|
130
|
+
objects_1.setProp(key, value, this);
|
|
131
|
+
});
|
|
141
132
|
// save, which will also create
|
|
142
|
-
this.entity = entity;
|
|
143
133
|
await this.save();
|
|
144
134
|
return this.entity;
|
|
145
135
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HubTemplate.js","sourceRoot":"","sources":["../../../src/templates/HubTemplate.ts"],"names":[],"mappings":";;;AACA,qEAAkE;AAElE,yDAAsD;AAGtD,yCAA8C;AAC9C,
|
|
1
|
+
{"version":3,"file":"HubTemplate.js","sourceRoot":"","sources":["../../../src/templates/HubTemplate.ts"],"names":[],"mappings":";;;AACA,qEAAkE;AAElE,yDAAsD;AAGtD,yCAA8C;AAC9C,iCAAwE;AACxE,mCAAwC;AAExC,uDAAoD;AACpD,kCAAsC;AACtC,wCAAqC;AACrC,uFAAoF;AAEpF;;;;;GAKG;AACH,MAAa,WAAY,SAAQ,6BAA2B;IAC1D;;;;;OAKG;IACH,YAAoB,QAAsB,EAAE,OAAuB;QACjE,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC3B,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CACb,IAA2B,EAC3B,OAAuB;QAEvB,6CAA6C;QAC7C,MAAM,IAA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,KAAK,CAAC,mCAAmC,CAAC,CAAC;SACtD;QAED,IAAI,CAAC,MAAM,mCAAQ,IAAI,CAAC,MAAM,GAAK,OAAO,CAAE,CAAC;IAC/C,CAAC;IAED,gDAAgD;IAChD,KAAK,CAAC,IAAI;QACR,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;SACtD;QAED,2DAA2D;QAC3D,0DAA0D;QAC1D,sDAAsD;QACtD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE;YAC1B,CAAC,CAAC,MAAM,qBAAc,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC;YACpE,CAAC,CAAC,MAAM,qBAAc,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAEvE,0DAA0D;QAC1D,MAAM,KAAK,CAAC,SAAS,EAAE,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,MAAM;QACV,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;SACtD;QAED,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,MAAM,qBAAc,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACxE,CAAC;CACF;AApMD,kCAoMC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-hub-product.js","sourceRoot":"","sources":["../../../src/utils/get-hub-product.ts"],"names":[],"mappings":";;;AAAA,kDAA8C;AAI9C;;;GAGG;AACH,SAAgB,aAAa,CAAC,MAAgC;IAC5D,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"get-hub-product.js","sourceRoot":"","sources":["../../../src/utils/get-hub-product.ts"],"names":[],"mappings":";;;AAAA,kDAA8C;AAI9C;;;GAGG;AACH,SAAgB,aAAa,CAAC,MAAgC;IAC5D,MAAM,SAAS,GACZ,kBAAO,CAAC,MAAM,EAAE,8BAA8B,CAAa,IAAI,KAAK,CAAC;IACxE,IAAI,OAAO,GAAe,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;IAC1D,qDAAqD;IACrD,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,UAAU,KAAK,cAAc,EAAE;QAC3D,OAAO,GAAG,QAAQ,CAAC;KACpB;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AATD,sCASC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Catalog } from "../../search/Catalog";
|
|
2
|
+
import { IArcGISContext } from "../../types";
|
|
3
|
+
import { IHubItemEntity, IHubItemEntityEditor } from "../types";
|
|
4
|
+
/**
|
|
5
|
+
* Convert editor values back into an IHubItemEntity,
|
|
6
|
+
* performing any pre-save operations/XHRs/transforms.
|
|
7
|
+
* @param editor - the editor object to convert
|
|
8
|
+
* @param context - contextual portal & auth information
|
|
9
|
+
*/
|
|
10
|
+
export declare const hubItemEntityFromEditor: (editor: IHubItemEntityEditor<IHubItemEntity>, context: IArcGISContext) => Promise<{
|
|
11
|
+
entity: IHubItemEntity;
|
|
12
|
+
_catalog?: Catalog;
|
|
13
|
+
thumbnailCache?: {
|
|
14
|
+
file?: Blob;
|
|
15
|
+
filename?: string;
|
|
16
|
+
clear: boolean;
|
|
17
|
+
};
|
|
18
|
+
}>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IArcGISContext } from "../../../types/IArcGISContext";
|
|
2
|
+
import { IUiSchemaElement } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* When creating an entity, an editor can elect to initialize
|
|
5
|
+
* the entity's catalog with a new group or an existing group.
|
|
6
|
+
* The following util builds the UiSchema elements to render
|
|
7
|
+
* this configuration in various creation flows.
|
|
8
|
+
*
|
|
9
|
+
* @param i18nScope intl - scope for translations
|
|
10
|
+
* @param context contextual - portal & auth information
|
|
11
|
+
*/
|
|
12
|
+
export declare function buildCatalogSetupUiSchemaElement(i18nScope: string, context: IArcGISContext): IUiSchemaElement[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IHubItemEntity } from "../../../types/IHubItemEntity";
|
|
2
2
|
import { IMetric, IMetricDisplayConfig } from "../../../types/Metrics";
|
|
3
3
|
/**
|
|
4
4
|
* Sets a given metric and metricDisplayConfig on an entity's metric and view.metricDisplays props.
|
|
@@ -10,4 +10,4 @@ import { IMetric, IMetricDisplayConfig } from "../../../types/Metrics";
|
|
|
10
10
|
* Right now, this just accepts a HubProject; in the future as more entities support metrics,
|
|
11
11
|
* other entities can be allowed.
|
|
12
12
|
*/
|
|
13
|
-
export declare function setMetricAndDisplay(entity:
|
|
13
|
+
export declare function setMetricAndDisplay(entity: IHubItemEntity, metric: IMetric, displayConfig: IMetricDisplayConfig): IHubItemEntity;
|
|
@@ -9,6 +9,7 @@ import { IWithPermissions } from "../traits/IWithPermissions";
|
|
|
9
9
|
import { IWithDiscussions } from "../traits/IWithDiscussions";
|
|
10
10
|
import { IWithViewSettings } from "../traits/IWithViewSettings";
|
|
11
11
|
import { IWithAssistant } from "../traits/IWithAssistant";
|
|
12
|
+
import { ICatalogSetup } from "../../search/types";
|
|
12
13
|
/**
|
|
13
14
|
* Properties exposed by Entities that are backed by Items
|
|
14
15
|
*/
|
|
@@ -153,4 +154,10 @@ export declare type IHubItemEntityEditor<T> = Omit<T, "extent"> & {
|
|
|
153
154
|
* (i.e. w/o the orgUrlKey prefix)
|
|
154
155
|
*/
|
|
155
156
|
_slug?: string;
|
|
157
|
+
/**
|
|
158
|
+
* catalog setup settings: when creating an entity,
|
|
159
|
+
* an editor can elect to initialize the entity's
|
|
160
|
+
* catalog with a new group or an existing group.
|
|
161
|
+
*/
|
|
162
|
+
_catalogSetup?: ICatalogSetup;
|
|
156
163
|
};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { IUserRequestOptions } from "@esri/arcgis-rest-request";
|
|
2
|
-
import { IHubRequestOptions
|
|
2
|
+
import { IHubRequestOptions } from "../index";
|
|
3
3
|
import { IQuery } from "../search/types/IHubCatalog";
|
|
4
4
|
import { IItem } from "@esri/arcgis-rest-portal";
|
|
5
5
|
import { IRequestOptions } from "@esri/arcgis-rest-request";
|
|
6
6
|
import { IHubInitiative } from "../core/types";
|
|
7
7
|
import { IHubSearchResult } from "../search";
|
|
8
|
-
import type { IArcGISContext } from "../types/IArcGISContext";
|
|
9
8
|
/**
|
|
10
9
|
* @private
|
|
11
10
|
* Create a new Hub Initiative item
|
|
@@ -16,13 +15,6 @@ import type { IArcGISContext } from "../types/IArcGISContext";
|
|
|
16
15
|
* @param requestOptions
|
|
17
16
|
*/
|
|
18
17
|
export declare function createInitiative(partialInitiative: Partial<IHubInitiative>, requestOptions: IUserRequestOptions): Promise<IHubInitiative>;
|
|
19
|
-
/**
|
|
20
|
-
* Convert a IHubInitiativeEditor back to an IHubInitiative
|
|
21
|
-
* @param editor
|
|
22
|
-
* @param portal
|
|
23
|
-
* @returns
|
|
24
|
-
*/
|
|
25
|
-
export declare function editorToInitiative(editor: IHubInitiativeEditor, context: IArcGISContext): Promise<IHubInitiative>;
|
|
26
18
|
/**
|
|
27
19
|
* @private
|
|
28
20
|
* Update a Hub Initiative
|
|
@@ -7,4 +7,4 @@ import { IHubInitiative } from "../../core/types";
|
|
|
7
7
|
* This defines how the schema properties should be rendered
|
|
8
8
|
* in the initiative creation experience
|
|
9
9
|
*/
|
|
10
|
-
export declare const buildUiSchema: (i18nScope: string,
|
|
10
|
+
export declare const buildUiSchema: (i18nScope: string, _options: Partial<IHubInitiative>, context: IArcGISContext) => Promise<IUiSchema>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IWithCatalogBehavior, IWithStoreBehavior, IWithSharingBehavior, IWithCardBehavior } from "../core/behaviors";
|
|
2
|
+
import { IHubProject, IHubProjectEditor, IEntityEditorContext, IResolvedMetric } from "../core/types";
|
|
2
3
|
import { Catalog } from "../search/Catalog";
|
|
3
4
|
import type { IArcGISContext } from "../types/IArcGISContext";
|
|
4
5
|
import { HubItemEntity } from "../core/HubItemEntity";
|
|
@@ -67,9 +68,10 @@ export declare class HubProject extends HubItemEntity<IHubProject> implements IW
|
|
|
67
68
|
*/
|
|
68
69
|
toEditor(editorContext?: IEntityEditorContext, include?: string[]): Promise<IHubProjectEditor>;
|
|
69
70
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* @
|
|
71
|
+
* Convert editor values back into a HubProject entity,
|
|
72
|
+
* performing any necessary pre-save operations/transforms.
|
|
73
|
+
* @param editor - the editor object to convert
|
|
74
|
+
* @param _editorContext - optional editor context
|
|
73
75
|
*/
|
|
74
76
|
fromEditor(editor: IHubProjectEditor, _editorContext?: IEntityEditorContext): Promise<IHubProject>;
|
|
75
77
|
/**
|
|
@@ -7,4 +7,4 @@ import { IHubProject } from "../../core/types";
|
|
|
7
7
|
* This defines how the schema properties should be rendered
|
|
8
8
|
* in the project creation experience
|
|
9
9
|
*/
|
|
10
|
-
export declare const buildUiSchema: (i18nScope: string,
|
|
10
|
+
export declare const buildUiSchema: (i18nScope: string, _options: Partial<IHubProject>, context: IArcGISContext) => Promise<IUiSchema>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { IUserRequestOptions } from "@esri/arcgis-rest-request";
|
|
2
|
-
import {
|
|
3
|
-
import { IHubProject, IHubProjectEditor } from "../core/types";
|
|
2
|
+
import { IHubProject } from "../core/types";
|
|
4
3
|
/**
|
|
5
4
|
* @private
|
|
6
5
|
* Create a new Hub Project item
|
|
@@ -11,13 +10,6 @@ import { IHubProject, IHubProjectEditor } from "../core/types";
|
|
|
11
10
|
* @param requestOptions
|
|
12
11
|
*/
|
|
13
12
|
export declare function createProject(partialProject: Partial<IHubProject>, requestOptions: IUserRequestOptions): Promise<IHubProject>;
|
|
14
|
-
/**
|
|
15
|
-
* Convert a IHubProjectEditor back to an IHubProject
|
|
16
|
-
* @param editor
|
|
17
|
-
* @param portal
|
|
18
|
-
* @returns
|
|
19
|
-
*/
|
|
20
|
-
export declare function editorToProject(editor: IHubProjectEditor, portal: IPortal): IHubProject;
|
|
21
13
|
/**
|
|
22
14
|
* @private
|
|
23
15
|
* Update a Hub Project
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IHubItemEntity } from "../core/types/IHubItemEntity";
|
|
2
|
+
import { IArcGISContext } from "../types/IArcGISContext";
|
|
3
|
+
import { ICatalogSetup, IHubCatalog } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* Initializes an returns a catalog to persist on Hub item
|
|
6
|
+
* entity upon creation based on user-configured options.
|
|
7
|
+
*
|
|
8
|
+
* @param entity - Hub item entity
|
|
9
|
+
* @param catalogSetup - options for initializing the catalog
|
|
10
|
+
* @param context - contextual portal & auth information
|
|
11
|
+
*/
|
|
12
|
+
export declare const initCatalogOnEntityCreate: (entity: IHubItemEntity, catalogSetup: ICatalogSetup, context: IArcGISContext) => Promise<IHubCatalog>;
|
|
@@ -156,3 +156,18 @@ export interface ISearchAssociatedContentOptions {
|
|
|
156
156
|
*/
|
|
157
157
|
num?: number;
|
|
158
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* When creating an entity, an editor can elect to initialize
|
|
161
|
+
* the entity's catalog with a new group or an existing group.
|
|
162
|
+
* The following types enumerate these options.
|
|
163
|
+
*/
|
|
164
|
+
export declare const CATALOG_SETUP_TYPES: readonly ["blank", "newGroup", "existingGroup"];
|
|
165
|
+
export declare type CatalogSetupType = (typeof CATALOG_SETUP_TYPES)[number];
|
|
166
|
+
/**
|
|
167
|
+
* Interface for configuring the catalog of an entity
|
|
168
|
+
* when it is created.
|
|
169
|
+
*/
|
|
170
|
+
export interface ICatalogSetup {
|
|
171
|
+
type: CatalogSetupType;
|
|
172
|
+
groupId?: string[];
|
|
173
|
+
}
|
package/package.json
CHANGED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { cloneObject } from "../../../../util";
|
|
2
|
-
import { truncateSlug } from "../../../../items/_internal/slugs";
|
|
3
|
-
// NOTE: this is covered by pre-existing tests for project to entity
|
|
4
|
-
/**
|
|
5
|
-
* extract the common ephemeral properties from the editor
|
|
6
|
-
* and then clone into an entity that has all common properties
|
|
7
|
-
* @param editor
|
|
8
|
-
* @param portal
|
|
9
|
-
* @returns
|
|
10
|
-
*/
|
|
11
|
-
export function editorToEntity(editor, portal) {
|
|
12
|
-
var _a;
|
|
13
|
-
// 1. remove the ephemeral props we graft onto the editor
|
|
14
|
-
const _slug = editor._slug;
|
|
15
|
-
delete editor._slug;
|
|
16
|
-
// convert back to an entity. Apply any reverse transforms used in
|
|
17
|
-
// of the toEditor method
|
|
18
|
-
const entity = cloneObject(editor);
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
20
|
-
entity.orgUrlKey = editor.orgUrlKey
|
|
21
|
-
? editor.orgUrlKey
|
|
22
|
-
: portal.urlKey || "";
|
|
23
|
-
// copy the location extent up one level
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
25
|
-
entity.extent = (_a = editor.location) === null || _a === void 0 ? void 0 : _a.extent;
|
|
26
|
-
if (_slug) {
|
|
27
|
-
// ensure the slug is truncated
|
|
28
|
-
entity.slug = truncateSlug(_slug, entity.orgUrlKey);
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
// if no slug is passed in, save an empty string as the slug, so that
|
|
32
|
-
// it is not saved as the orgUrlKey truncated with an empty string
|
|
33
|
-
entity.slug = "";
|
|
34
|
-
}
|
|
35
|
-
return entity;
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=editorToEntity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"editorToEntity.js","sourceRoot":"","sources":["../../../../../../src/core/schemas/internal/metrics/editorToEntity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAM/C,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEjE,oEAAoE;AACpE;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,MAA4C,EAC5C,MAAe;;IAEf,yDAAyD;IACzD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAC3B,OAAO,MAAM,CAAC,KAAK,CAAC;IAEpB,kEAAkE;IAClE,yBAAyB;IACzB,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAmB,CAAC;IACrD,mEAAmE;IACnE,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS;QACjC,CAAC,CAAC,MAAM,CAAC,SAAS;QAClB,CAAC,CAAC,MAAM,CAAC,MAAM,IAAK,EAAa,CAAC;IAEpC,wCAAwC;IACxC,mEAAmE;IACnE,MAAM,CAAC,MAAM,SAAI,MAAM,CAAC,QAAyB,0CAAE,MAAM,CAAC;IAE1D,IAAI,KAAK,EAAE;QACT,+BAA+B;QAC/B,MAAM,CAAC,IAAI,GAAG,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;KACrD;SAAM;QACL,qEAAqE;QACrE,kEAAkE;QAClE,MAAM,CAAC,IAAI,GAAG,EAAE,CAAC;KAClB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.editorToEntity = void 0;
|
|
4
|
-
const util_1 = require("../../../../util");
|
|
5
|
-
const slugs_1 = require("../../../../items/_internal/slugs");
|
|
6
|
-
// NOTE: this is covered by pre-existing tests for project to entity
|
|
7
|
-
/**
|
|
8
|
-
* extract the common ephemeral properties from the editor
|
|
9
|
-
* and then clone into an entity that has all common properties
|
|
10
|
-
* @param editor
|
|
11
|
-
* @param portal
|
|
12
|
-
* @returns
|
|
13
|
-
*/
|
|
14
|
-
function editorToEntity(editor, portal) {
|
|
15
|
-
var _a;
|
|
16
|
-
// 1. remove the ephemeral props we graft onto the editor
|
|
17
|
-
const _slug = editor._slug;
|
|
18
|
-
delete editor._slug;
|
|
19
|
-
// convert back to an entity. Apply any reverse transforms used in
|
|
20
|
-
// of the toEditor method
|
|
21
|
-
const entity = util_1.cloneObject(editor);
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
23
|
-
entity.orgUrlKey = editor.orgUrlKey
|
|
24
|
-
? editor.orgUrlKey
|
|
25
|
-
: portal.urlKey || "";
|
|
26
|
-
// copy the location extent up one level
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
28
|
-
entity.extent = (_a = editor.location) === null || _a === void 0 ? void 0 : _a.extent;
|
|
29
|
-
if (_slug) {
|
|
30
|
-
// ensure the slug is truncated
|
|
31
|
-
entity.slug = slugs_1.truncateSlug(_slug, entity.orgUrlKey);
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
// if no slug is passed in, save an empty string as the slug, so that
|
|
35
|
-
// it is not saved as the orgUrlKey truncated with an empty string
|
|
36
|
-
entity.slug = "";
|
|
37
|
-
}
|
|
38
|
-
return entity;
|
|
39
|
-
}
|
|
40
|
-
exports.editorToEntity = editorToEntity;
|
|
41
|
-
//# sourceMappingURL=editorToEntity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"editorToEntity.js","sourceRoot":"","sources":["../../../../../../src/core/schemas/internal/metrics/editorToEntity.ts"],"names":[],"mappings":";;;AACA,2CAA+C;AAM/C,6DAAiE;AAEjE,oEAAoE;AACpE;;;;;;GAMG;AACH,SAAgB,cAAc,CAC5B,MAA4C,EAC5C,MAAe;;IAEf,yDAAyD;IACzD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAC3B,OAAO,MAAM,CAAC,KAAK,CAAC;IAEpB,kEAAkE;IAClE,yBAAyB;IACzB,MAAM,MAAM,GAAG,kBAAW,CAAC,MAAM,CAAmB,CAAC;IACrD,mEAAmE;IACnE,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS;QACjC,CAAC,CAAC,MAAM,CAAC,SAAS;QAClB,CAAC,CAAC,MAAM,CAAC,MAAM,IAAK,EAAa,CAAC;IAEpC,wCAAwC;IACxC,mEAAmE;IACnE,MAAM,CAAC,MAAM,SAAI,MAAM,CAAC,QAAyB,0CAAE,MAAM,CAAC;IAE1D,IAAI,KAAK,EAAE;QACT,+BAA+B;QAC/B,MAAM,CAAC,IAAI,GAAG,oBAAY,CAAC,KAAK,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;KACrD;SAAM;QACL,qEAAqE;QACrE,kEAAkE;QAClE,MAAM,CAAC,IAAI,GAAG,EAAE,CAAC;KAClB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AA9BD,wCA8BC"}
|