@esri/hub-common 11.0.0 → 11.1.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/HubItemEntity.js +142 -0
- package/dist/esm/core/HubItemEntity.js.map +1 -0
- package/dist/esm/core/_internal/getBasePropertyMap.js +53 -0
- package/dist/esm/core/_internal/getBasePropertyMap.js.map +1 -0
- package/dist/esm/core/traits/IWithCatalog.js +1 -0
- package/dist/esm/core/traits/IWithCatalog.js.map +1 -0
- package/dist/esm/core/traits/index.js +1 -0
- package/dist/esm/core/traits/index.js.map +1 -1
- package/dist/esm/core/types/IEntityResource.js +1 -0
- package/dist/esm/core/types/IEntityResource.js.map +1 -0
- package/dist/esm/core/types/IItemResource.js +1 -0
- package/dist/esm/core/types/IItemResource.js.map +1 -0
- package/dist/esm/core/types/index.js +0 -2
- package/dist/esm/core/types/index.js.map +1 -1
- package/dist/esm/index.js +1 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/initiatives/HubInitiative.js +147 -0
- package/dist/esm/initiatives/HubInitiative.js.map +1 -0
- package/dist/esm/initiatives/HubInitiatives.js +205 -0
- package/dist/esm/initiatives/HubInitiatives.js.map +1 -0
- package/dist/esm/initiatives/defaults.js +31 -0
- package/dist/esm/initiatives/defaults.js.map +1 -0
- package/dist/esm/initiatives/index.js +3 -0
- package/dist/esm/initiatives/index.js.map +1 -0
- package/dist/esm/projects/HubProject.js +7 -65
- package/dist/esm/projects/HubProject.js.map +1 -1
- package/dist/esm/projects/HubProjects.js +13 -54
- package/dist/esm/projects/HubProjects.js.map +1 -1
- package/dist/esm/projects/defaults.js +2 -1
- package/dist/esm/projects/defaults.js.map +1 -1
- package/dist/node/core/HubItemEntity.js +146 -0
- package/dist/node/core/HubItemEntity.js.map +1 -0
- package/dist/node/core/_internal/getBasePropertyMap.js +57 -0
- package/dist/node/core/_internal/getBasePropertyMap.js.map +1 -0
- package/dist/node/core/{types/IHubEntityManager.js → traits/IWithCatalog.js} +1 -1
- package/dist/node/core/traits/IWithCatalog.js.map +1 -0
- package/dist/node/core/traits/index.js +1 -0
- package/dist/node/core/traits/index.js.map +1 -1
- package/dist/node/core/types/{IHubItemEntityManager.js → IEntityResource.js} +1 -1
- package/dist/node/core/types/IEntityResource.js.map +1 -0
- package/dist/node/core/{traits/IWithCatalogDefinition.js → types/IItemResource.js} +1 -1
- package/dist/node/core/types/IItemResource.js.map +1 -0
- package/dist/node/core/types/index.js +0 -2
- package/dist/node/core/types/index.js.map +1 -1
- package/dist/node/index.js +1 -2
- package/dist/node/index.js.map +1 -1
- package/dist/node/initiatives/HubInitiative.js +151 -0
- package/dist/node/initiatives/HubInitiative.js.map +1 -0
- package/dist/node/initiatives/HubInitiatives.js +214 -0
- package/dist/node/initiatives/HubInitiatives.js.map +1 -0
- package/dist/node/initiatives/defaults.js +34 -0
- package/dist/node/initiatives/defaults.js.map +1 -0
- package/dist/node/initiatives/index.js +6 -0
- package/dist/node/initiatives/index.js.map +1 -0
- package/dist/node/projects/HubProject.js +7 -65
- package/dist/node/projects/HubProject.js.map +1 -1
- package/dist/node/projects/HubProjects.js +13 -54
- package/dist/node/projects/HubProjects.js.map +1 -1
- package/dist/node/projects/defaults.js +2 -1
- package/dist/node/projects/defaults.js.map +1 -1
- package/dist/types/content/_internal.d.ts +8 -8
- package/dist/types/core/HubItemEntity.d.ts +55 -0
- package/dist/types/core/_internal/getBasePropertyMap.d.ts +7 -0
- package/dist/types/core/behaviors/IWithStoreBehavior.d.ts +10 -0
- package/dist/types/core/traits/{IWithCatalogDefinition.d.ts → IWithCatalog.d.ts} +0 -0
- package/dist/types/core/traits/IWithPermissions.d.ts +1 -1
- package/dist/types/core/traits/index.d.ts +1 -0
- package/dist/types/core/types/IEntityResource.d.ts +21 -0
- package/dist/types/core/types/IHubContent.d.ts +1 -1
- package/dist/types/core/types/IHubInitiative.d.ts +2 -2
- package/dist/types/core/types/IHubItemEntity.d.ts +25 -16
- package/dist/types/core/types/IHubProject.d.ts +3 -3
- package/dist/types/core/types/IItemResource.d.ts +9 -0
- package/dist/types/core/types/index.d.ts +0 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/types/initiatives/HubInitiative.d.ts +67 -0
- package/dist/types/initiatives/HubInitiatives.d.ts +55 -0
- package/dist/types/initiatives/defaults.d.ts +11 -0
- package/dist/types/initiatives/index.d.ts +2 -0
- package/dist/types/projects/HubProject.d.ts +7 -33
- package/package.json +1 -1
- package/dist/esm/core/traits/IWithCatalogDefinition.js +0 -1
- package/dist/esm/core/traits/IWithCatalogDefinition.js.map +0 -1
- package/dist/esm/core/types/IHubEntityManager.js +0 -1
- package/dist/esm/core/types/IHubEntityManager.js.map +0 -1
- package/dist/esm/core/types/IHubItemEntityManager.js +0 -1
- package/dist/esm/core/types/IHubItemEntityManager.js.map +0 -1
- package/dist/node/core/traits/IWithCatalogDefinition.js.map +0 -1
- package/dist/node/core/types/IHubEntityManager.js.map +0 -1
- package/dist/node/core/types/IHubItemEntityManager.js.map +0 -1
- package/dist/types/core/types/IHubEntityManager.d.ts +0 -46
- package/dist/types/core/types/IHubItemEntityManager.d.ts +0 -25
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { getUser, setItemAccess, shareItemWithGroup, unshareItemWithGroup, } from "@esri/arcgis-rest-portal";
|
|
2
|
+
import { cloneObject } from "../util";
|
|
3
|
+
import { mapBy } from "../utils";
|
|
4
|
+
import { sharedWith } from "./_internal/sharedWith";
|
|
5
|
+
/**
|
|
6
|
+
* Base class for all Hub Entities backed by items
|
|
7
|
+
*/
|
|
8
|
+
export class HubItemEntity {
|
|
9
|
+
constructor(entity, context) {
|
|
10
|
+
this.isDestroyed = false;
|
|
11
|
+
this.context = context;
|
|
12
|
+
this.entity = entity;
|
|
13
|
+
}
|
|
14
|
+
//#region IWithStoreBehavior
|
|
15
|
+
/**
|
|
16
|
+
* Return the backing entity as an object literal
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
toJson() {
|
|
20
|
+
if (this.isDestroyed) {
|
|
21
|
+
throw new Error("Entity is already destroyed.");
|
|
22
|
+
}
|
|
23
|
+
return cloneObject(this.entity);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Can the current user edit the Entity?
|
|
27
|
+
* In order to edit an item, the user must be the owner of the item
|
|
28
|
+
* or be a member of a shared editing group, to which the item is shared.
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
async canEdit() {
|
|
32
|
+
const user = this.context.currentUser;
|
|
33
|
+
// owner can always edit
|
|
34
|
+
if (user.username === this.entity.owner) {
|
|
35
|
+
return Promise.resolve(true);
|
|
36
|
+
}
|
|
37
|
+
// Fetch the user's groups by fetching the user
|
|
38
|
+
// we do this each time to ensure we have the latest groups
|
|
39
|
+
const u = await getUser(user.username);
|
|
40
|
+
const usersGroups = u.groups;
|
|
41
|
+
if (!usersGroups.length) {
|
|
42
|
+
// if user is not owner and not in any groups they can't have edit access
|
|
43
|
+
return Promise.resolve(false);
|
|
44
|
+
}
|
|
45
|
+
// get the groups the entity is shared to
|
|
46
|
+
const entityGroups = await this.sharedWith();
|
|
47
|
+
// filter to shared edit groups
|
|
48
|
+
const editGroupIds = entityGroups
|
|
49
|
+
.filter((g) => {
|
|
50
|
+
const caps = g.capabilities || [];
|
|
51
|
+
return caps.includes("updateitemcontrol");
|
|
52
|
+
})
|
|
53
|
+
.map((g) => g.id);
|
|
54
|
+
// get the user's groups ids
|
|
55
|
+
const usersGroupsIds = mapBy("id", usersGroups);
|
|
56
|
+
// check for any overlap
|
|
57
|
+
let isMemberOfEditGroup = false;
|
|
58
|
+
for (const id of usersGroupsIds) {
|
|
59
|
+
isMemberOfEditGroup = editGroupIds.includes(id);
|
|
60
|
+
if (isMemberOfEditGroup) {
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return Promise.resolve(isMemberOfEditGroup);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Can the current user delete the Entity?
|
|
68
|
+
* In order to delete an item, the user must be the owner of the item or a full org_admin
|
|
69
|
+
* in the owner's organization.
|
|
70
|
+
* @returns
|
|
71
|
+
*/
|
|
72
|
+
async canDelete() {
|
|
73
|
+
const user = this.context.currentUser;
|
|
74
|
+
// owner can always delete
|
|
75
|
+
if (user.username === this.entity.owner) {
|
|
76
|
+
return Promise.resolve(true);
|
|
77
|
+
}
|
|
78
|
+
// if not owner, check if user is org_admin in same org as owner
|
|
79
|
+
if (user.role === "org_admin" && !user.roleId) {
|
|
80
|
+
// need to get the owner, and see if the orgid matches
|
|
81
|
+
const ownerUser = await getUser({
|
|
82
|
+
username: this.entity.owner,
|
|
83
|
+
authentication: this.context.session,
|
|
84
|
+
});
|
|
85
|
+
// ensure owner orgId is not null and matched current user
|
|
86
|
+
const adminCanDelete = ownerUser.orgId && ownerUser.orgId === user.orgId;
|
|
87
|
+
return Promise.resolve(adminCanDelete);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
// not org admin, can't edit
|
|
91
|
+
return Promise.resolve(false);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
//#endregion IWithStoreBehavior
|
|
95
|
+
//#region IWithSharingBehavior
|
|
96
|
+
/**
|
|
97
|
+
* Share the Entity with the specified group id
|
|
98
|
+
* @param groupId
|
|
99
|
+
*/
|
|
100
|
+
async shareWithGroup(groupId) {
|
|
101
|
+
await shareItemWithGroup({
|
|
102
|
+
id: this.entity.id,
|
|
103
|
+
groupId,
|
|
104
|
+
owner: this.entity.owner,
|
|
105
|
+
authentication: this.context.session,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Unshare the Entity with the specified group id
|
|
110
|
+
* @param groupId
|
|
111
|
+
*/
|
|
112
|
+
async unshareWithGroup(groupId) {
|
|
113
|
+
await unshareItemWithGroup({
|
|
114
|
+
id: this.entity.id,
|
|
115
|
+
groupId,
|
|
116
|
+
owner: this.entity.owner,
|
|
117
|
+
authentication: this.context.session,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Set the access level of the backing item
|
|
122
|
+
* @param access
|
|
123
|
+
*/
|
|
124
|
+
async setAccess(access) {
|
|
125
|
+
await setItemAccess({
|
|
126
|
+
id: this.entity.id,
|
|
127
|
+
access,
|
|
128
|
+
authentication: this.context.session,
|
|
129
|
+
});
|
|
130
|
+
// if this succeeded, update the entity
|
|
131
|
+
this.entity.access = access;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Return a list of groups the Entity is shared to.
|
|
135
|
+
* @returns
|
|
136
|
+
*/
|
|
137
|
+
async sharedWith() {
|
|
138
|
+
// delegate to a util that merges the three arrays returned from the api, into a single array
|
|
139
|
+
return sharedWith(this.entity.id, this.context.requestOptions);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=HubItemEntity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HubItemEntity.js","sourceRoot":"","sources":["../../../src/core/HubItemEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAEP,aAAa,EACb,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAGjC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD;;GAEG;AACH,MAAM,OAAgB,aAAa;IAOjC,YAAY,MAAS,EAAE,OAAuB;QAFpC,gBAAW,GAAY,KAAK,CAAC;QAGrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,4BAA4B;IAE5B;;;OAGG;IACH,MAAM;QACJ,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,MAAM,IAAI,KAAK,CAAC,8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,OAAe;QACpC,MAAM,oBAAoB,CAAC;YACzB,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE;YAClB,OAAO;YACP,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK;YACxB,cAAc,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO;SACrC,CAAC,CAAC;IACL,CAAC;IACD;;;OAGG;IACH,KAAK,CAAC,SAAS,CAAC,MAA2B;QACzC,MAAM,aAAa,CAAC;YAClB,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE;YAClB,MAAM;YACN,cAAc,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO;SACrC,CAAC,CAAC;QACH,uCAAuC;QACvC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,UAAU;QACd,6FAA6F;QAC7F,OAAO,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IACjE,CAAC;CAGF"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns an Array of IPropertyMap objects
|
|
3
|
+
* that define the standard projection of properties from a IModel an entity interface
|
|
4
|
+
* @returns
|
|
5
|
+
*/
|
|
6
|
+
export function getBasePropertyMap() {
|
|
7
|
+
const itemProps = [
|
|
8
|
+
"access",
|
|
9
|
+
"created",
|
|
10
|
+
"culture",
|
|
11
|
+
"description",
|
|
12
|
+
"extent",
|
|
13
|
+
"id",
|
|
14
|
+
"modified",
|
|
15
|
+
"owner",
|
|
16
|
+
"snippet",
|
|
17
|
+
"tags",
|
|
18
|
+
"type",
|
|
19
|
+
"typeKeywords",
|
|
20
|
+
"url",
|
|
21
|
+
];
|
|
22
|
+
const dataProps = ["display", "geometry", "location"];
|
|
23
|
+
const map = [];
|
|
24
|
+
itemProps.forEach((entry) => {
|
|
25
|
+
map.push({ objectKey: entry, modelKey: `item.${entry}` });
|
|
26
|
+
});
|
|
27
|
+
dataProps.forEach((entry) => {
|
|
28
|
+
map.push({ objectKey: entry, modelKey: `data.${entry}` });
|
|
29
|
+
});
|
|
30
|
+
// Deeper mappings
|
|
31
|
+
map.push({
|
|
32
|
+
objectKey: "slug",
|
|
33
|
+
modelKey: "item.properties.slug",
|
|
34
|
+
});
|
|
35
|
+
map.push({
|
|
36
|
+
objectKey: "schemaVersion",
|
|
37
|
+
modelKey: "item.properties.schemaVersion",
|
|
38
|
+
});
|
|
39
|
+
map.push({
|
|
40
|
+
objectKey: "orgUrlKey",
|
|
41
|
+
modelKey: "item.properties.orgUrlKey",
|
|
42
|
+
});
|
|
43
|
+
map.push({
|
|
44
|
+
objectKey: "name",
|
|
45
|
+
modelKey: "item.title",
|
|
46
|
+
});
|
|
47
|
+
map.push({
|
|
48
|
+
objectKey: "boundary",
|
|
49
|
+
modelKey: "item.properties.boundary",
|
|
50
|
+
});
|
|
51
|
+
return map;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=getBasePropertyMap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getBasePropertyMap.js","sourceRoot":"","sources":["../../../../src/core/_internal/getBasePropertyMap.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,UAAU,kBAAkB;IAChC,MAAM,SAAS,GAAG;QAChB,QAAQ;QACR,SAAS;QACT,SAAS;QACT,aAAa;QACb,QAAQ;QACR,IAAI;QACJ,UAAU;QACV,OAAO;QACP,SAAS;QACT,MAAM;QACN,MAAM;QACN,cAAc;QACd,KAAK;KACN,CAAC;IACF,MAAM,SAAS,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;IACtD,MAAM,GAAG,GAAmB,EAAE,CAAC;IAC/B,SAAS,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QAC1B,GAAG,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,KAAK,EAAE,EAAE,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IACH,SAAS,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QAC1B,GAAG,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,KAAK,EAAE,EAAE,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IACH,kBAAkB;IAClB,GAAG,CAAC,IAAI,CAAC;QACP,SAAS,EAAE,MAAM;QACjB,QAAQ,EAAE,sBAAsB;KACjC,CAAC,CAAC;IACH,GAAG,CAAC,IAAI,CAAC;QACP,SAAS,EAAE,eAAe;QAC1B,QAAQ,EAAE,+BAA+B;KAC1C,CAAC,CAAC;IACH,GAAG,CAAC,IAAI,CAAC;QACP,SAAS,EAAE,WAAW;QACtB,QAAQ,EAAE,2BAA2B;KACtC,CAAC,CAAC;IACH,GAAG,CAAC,IAAI,CAAC;QACP,SAAS,EAAE,MAAM;QACjB,QAAQ,EAAE,YAAY;KACvB,CAAC,CAAC;IACH,GAAG,CAAC,IAAI,CAAC;QACP,SAAS,EAAE,UAAU;QACrB,QAAQ,EAAE,0BAA0B;KACrC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=IWithCatalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IWithCatalog.js","sourceRoot":"","sources":["../../../../src/core/traits/IWithCatalog.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/traits/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/traits/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=IEntityResource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEntityResource.js","sourceRoot":"","sources":["../../../../src/core/types/IEntityResource.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=IItemResource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IItemResource.js","sourceRoot":"","sources":["../../../../src/core/types/IItemResource.ts"],"names":[],"mappings":""}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
export * from "./IHubContent";
|
|
2
2
|
export * from "./IHubContentEnrichments";
|
|
3
3
|
export * from "./IHubEntityBase";
|
|
4
|
-
export * from "./IHubEntityManager";
|
|
5
4
|
export * from "./IHubEvent";
|
|
6
5
|
export * from "./IHubImage";
|
|
7
6
|
export * from "./IHubInitiative";
|
|
8
7
|
export * from "./IHubItemEntity";
|
|
9
|
-
export * from "./IHubItemEntityManager";
|
|
10
8
|
export * from "./IHubLayout";
|
|
11
9
|
export * from "./IHubPage";
|
|
12
10
|
export * from "./IHubProject";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AAEjC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AAEjC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -17,6 +17,7 @@ export * from "./items";
|
|
|
17
17
|
export * from "./models";
|
|
18
18
|
export * from "./objects";
|
|
19
19
|
export * from "./projects";
|
|
20
|
+
export * from "./initiatives";
|
|
20
21
|
export * from "./request";
|
|
21
22
|
export * from "./resources";
|
|
22
23
|
export * from "./search";
|
|
@@ -36,6 +37,4 @@ import HubError from "./HubError";
|
|
|
36
37
|
// Re-exports
|
|
37
38
|
export { OperationStack, OperationError, HubError };
|
|
38
39
|
export { btoa, atob } from "abab";
|
|
39
|
-
// This will be moved to another package
|
|
40
|
-
// export * from "./Hub";
|
|
41
40
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;gBACgB;AAChB,0BAA0B;AAE1B,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,C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aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AAExB,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AAExB,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,aAAa;AACb,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { DEFAULT_INITIATIVE } from "./defaults";
|
|
2
|
+
import { PermissionManager, } from "../core";
|
|
3
|
+
import { createInitiative, deleteInitiative, fetchInitiative, updateInitiative, } from "./HubInitiatives";
|
|
4
|
+
import { Catalog } from "../search/Catalog";
|
|
5
|
+
import { HubItemEntity } from "../core/HubItemEntity";
|
|
6
|
+
/**
|
|
7
|
+
* Hub Initiative Class
|
|
8
|
+
*/
|
|
9
|
+
export class HubInitiative extends HubItemEntity {
|
|
10
|
+
/**
|
|
11
|
+
* Private constructor so we don't have `new` all over the place. Allows for
|
|
12
|
+
* more flexibility in how we create the HubInitiativeManager over time.
|
|
13
|
+
* @param context
|
|
14
|
+
*/
|
|
15
|
+
constructor(entity, context) {
|
|
16
|
+
super(entity, context);
|
|
17
|
+
this._catalog = Catalog.fromJson(entity.catalog, this.context);
|
|
18
|
+
this._permissionManager = PermissionManager.fromJson(entity.permissions, this.context);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Catalog instance for this Initiative. Note: Do not hold direct references to this object; always access it from the Initiative.
|
|
22
|
+
* @returns Catalog
|
|
23
|
+
*/
|
|
24
|
+
get catalog() {
|
|
25
|
+
return this._catalog;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* PermissionManager instance for this Initiative. Note: Do not hold direct references to this object; always access it from the Initiative.
|
|
29
|
+
* @returns PermissionManager
|
|
30
|
+
*/
|
|
31
|
+
get permissions() {
|
|
32
|
+
return this._permissionManager;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Create an instance from an IHubInitiative object
|
|
36
|
+
* @param json - JSON object to create a HubInitiative from
|
|
37
|
+
* @param context - ArcGIS context
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
static fromJson(json, context) {
|
|
41
|
+
// merge what we have with the default values
|
|
42
|
+
const pojo = this.applyDefaults(json, context);
|
|
43
|
+
return new HubInitiative(pojo, context);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Create a new HubInitiative, returning a HubInitiative instance.
|
|
47
|
+
* Note: This does not persist the Initiative into the backing store
|
|
48
|
+
* @param partialInitiative
|
|
49
|
+
* @param context
|
|
50
|
+
* @returns
|
|
51
|
+
*/
|
|
52
|
+
static async create(partialInitiative, context, save = false) {
|
|
53
|
+
const pojo = this.applyDefaults(partialInitiative, context);
|
|
54
|
+
// return an instance of HubInitiative
|
|
55
|
+
const instance = HubInitiative.fromJson(pojo, context);
|
|
56
|
+
if (save) {
|
|
57
|
+
await instance.save();
|
|
58
|
+
}
|
|
59
|
+
return instance;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Fetch an Initiative from the backing store and return a HubInitiative instance.
|
|
63
|
+
* @param identifier - slug or item id
|
|
64
|
+
* @param context
|
|
65
|
+
* @returns
|
|
66
|
+
*/
|
|
67
|
+
static async fetch(identifier, context) {
|
|
68
|
+
// fetch by id or slug
|
|
69
|
+
try {
|
|
70
|
+
const entity = await fetchInitiative(identifier, context.requestOptions);
|
|
71
|
+
// create an instance of HubInitiative from the entity
|
|
72
|
+
return HubInitiative.fromJson(entity, context);
|
|
73
|
+
}
|
|
74
|
+
catch (ex) {
|
|
75
|
+
if (ex.message ===
|
|
76
|
+
"CONT_0001: Item does not exist or is inaccessible.") {
|
|
77
|
+
throw new Error(`Initiative not found.`);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
throw ex;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
static applyDefaults(partialInitiative, context) {
|
|
85
|
+
// ensure we have the orgUrlKey
|
|
86
|
+
if (!partialInitiative.orgUrlKey) {
|
|
87
|
+
partialInitiative.orgUrlKey = context.portal.urlKey;
|
|
88
|
+
}
|
|
89
|
+
// extend the partial over the defaults
|
|
90
|
+
const pojo = Object.assign(Object.assign({}, DEFAULT_INITIATIVE), partialInitiative);
|
|
91
|
+
return pojo;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Apply a new state to the instance
|
|
95
|
+
* @param changes
|
|
96
|
+
*/
|
|
97
|
+
update(changes) {
|
|
98
|
+
if (this.isDestroyed) {
|
|
99
|
+
throw new Error("HubInitiative is already destroyed.");
|
|
100
|
+
}
|
|
101
|
+
// merge partial onto existing entity
|
|
102
|
+
this.entity = Object.assign(Object.assign({}, this.entity), changes);
|
|
103
|
+
// update internal instances
|
|
104
|
+
if (changes.catalog) {
|
|
105
|
+
this._catalog = Catalog.fromJson(this.entity.catalog, this.context);
|
|
106
|
+
}
|
|
107
|
+
if (changes.permissions) {
|
|
108
|
+
this._permissionManager = PermissionManager.fromJson(this.entity.permissions, this.context);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Save the HubInitiative to the backing store.
|
|
113
|
+
* Currently Initiatives are stored as Items in Portal
|
|
114
|
+
* @returns
|
|
115
|
+
*/
|
|
116
|
+
async save() {
|
|
117
|
+
if (this.isDestroyed) {
|
|
118
|
+
throw new Error("HubInitiative is already destroyed.");
|
|
119
|
+
}
|
|
120
|
+
// get the catalog, and permission configs
|
|
121
|
+
this.entity.catalog = this._catalog.toJson();
|
|
122
|
+
this.entity.permissions = this._permissionManager.toJson();
|
|
123
|
+
if (this.entity.id) {
|
|
124
|
+
// update it
|
|
125
|
+
this.entity = await updateInitiative(this.entity, this.context.userRequestOptions);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
// create it
|
|
129
|
+
this.entity = await createInitiative(this.entity, this.context.userRequestOptions);
|
|
130
|
+
}
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Delete the HubInitiative from the store
|
|
135
|
+
* set a flag to indicate that it is destroyed
|
|
136
|
+
* @returns
|
|
137
|
+
*/
|
|
138
|
+
async delete() {
|
|
139
|
+
if (this.isDestroyed) {
|
|
140
|
+
throw new Error("HubInitiative is already destroyed.");
|
|
141
|
+
}
|
|
142
|
+
this.isDestroyed = true;
|
|
143
|
+
// Delegate to module fn
|
|
144
|
+
await deleteInitiative(this.entity.id, this.context.userRequestOptions);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=HubInitiative.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HubInitiative.js","sourceRoot":"","sources":["../../../src/initiatives/HubInitiative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,OAAO,EAIL,iBAAiB,GAGlB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD;;GAEG;AACH,MAAM,OAAO,aACX,SAAQ,aAA6B;IASrC;;;;OAIG;IACH,YAAoB,MAAsB,EAAE,OAAuB;QACjE,KAAK,CAAC,MAA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AI,KAAK,CAAC,qCAAqC,CAAC,CAAC;SACxD;QACD,0CAA0C;QAC1C,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;QAC7C,IAAI,CAAC,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAC;QAE3D,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE;YAClB,YAAY;YACZ,IAAI,CAAC,MAAM,GAAG,MAAM,gBAAgB,CAClC,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAChC,CAAC;SACH;aAAM;YACL,YAAY;YACZ,IAAI,CAAC,MAAM,GAAG,MAAM,gBAAgB,CAClC,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAChC,CAAC;SACH;QAED,OAAO;IACT,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,MAAM;QACV,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;SACxD;QACD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,wBAAwB;QACxB,MAAM,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC1E,CAAC;CACF"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
// Note - we separate these imports so we can cleanly spy on things in tests
|
|
2
|
+
import { createModel, fetchModelFromItem, getModel, updateModel, } from "../models";
|
|
3
|
+
import { constructSlug, getItemBySlug, getUniqueSlug, setSlugKeyword, } from "../items/slugs";
|
|
4
|
+
import { isGuid, cloneObject, getItemThumbnailUrl, unique, mapBy, getProp, getFamily, getItemHomeUrl, } from "../index";
|
|
5
|
+
import { removeItem, getItem, } from "@esri/arcgis-rest-portal";
|
|
6
|
+
import { PropertyMapper } from "../core/_internal/PropertyMapper";
|
|
7
|
+
import { parseInclude } from "../search/_internal/parseInclude";
|
|
8
|
+
import { fetchItemEnrichments } from "../items/_enrichments";
|
|
9
|
+
import { getHubRelativeUrl } from "../content/_internal";
|
|
10
|
+
import { DEFAULT_INITIATIVE, DEFAULT_INITIATIVE_MODEL } from "./defaults";
|
|
11
|
+
import { getBasePropertyMap } from "../core/_internal/getBasePropertyMap";
|
|
12
|
+
/**
|
|
13
|
+
* Returns an Array of IPropertyMap objects
|
|
14
|
+
* that define the projection of properties from a IModel to an IHubInitiative
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
function getPropertyMap() {
|
|
18
|
+
const map = getBasePropertyMap();
|
|
19
|
+
// Type specific mappings
|
|
20
|
+
map.push({ objectKey: "catalog", modelKey: "data.catalog" });
|
|
21
|
+
map.push({ objectKey: "permissions", modelKey: "data.permissions" });
|
|
22
|
+
return map;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @private
|
|
26
|
+
* Create a new Hub Initiative item
|
|
27
|
+
*
|
|
28
|
+
* Minimal properties are name and orgUrlKey
|
|
29
|
+
*
|
|
30
|
+
* @param partialInitiative
|
|
31
|
+
* @param requestOptions
|
|
32
|
+
*/
|
|
33
|
+
export async function createInitiative(partialInitiative, requestOptions) {
|
|
34
|
+
// merge incoming with the default
|
|
35
|
+
// this expansion solves the typing somehow
|
|
36
|
+
const initiative = Object.assign(Object.assign({}, DEFAULT_INITIATIVE), partialInitiative);
|
|
37
|
+
// Create a slug from the title if one is not passed in
|
|
38
|
+
if (!initiative.slug) {
|
|
39
|
+
initiative.slug = constructSlug(initiative.name, initiative.orgUrlKey);
|
|
40
|
+
}
|
|
41
|
+
// Ensure slug is unique
|
|
42
|
+
initiative.slug = await getUniqueSlug({ slug: initiative.slug }, requestOptions);
|
|
43
|
+
// add slug to keywords
|
|
44
|
+
initiative.typeKeywords = setSlugKeyword(initiative.typeKeywords, initiative.slug);
|
|
45
|
+
// Map initiative object onto a default initiative Model
|
|
46
|
+
const mapper = new PropertyMapper(getPropertyMap());
|
|
47
|
+
// create model from object, using the default model as a starting point
|
|
48
|
+
let model = mapper.objectToModel(initiative, cloneObject(DEFAULT_INITIATIVE_MODEL));
|
|
49
|
+
// create the item
|
|
50
|
+
model = await createModel(model, requestOptions);
|
|
51
|
+
// map the model back into a IHubInitiative
|
|
52
|
+
let newInitiative = mapper.modelToObject(model, {});
|
|
53
|
+
newInitiative = computeProps(model, newInitiative, requestOptions);
|
|
54
|
+
// and return it
|
|
55
|
+
return newInitiative;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* @private
|
|
59
|
+
* Update a Hub Initiative
|
|
60
|
+
* @param initiative
|
|
61
|
+
* @param requestOptions
|
|
62
|
+
*/
|
|
63
|
+
export async function updateInitiative(initiative, requestOptions) {
|
|
64
|
+
// verify that the slug is unique, excluding the current initiative
|
|
65
|
+
initiative.slug = await getUniqueSlug({ slug: initiative.slug, existingId: initiative.id }, requestOptions);
|
|
66
|
+
// get the backing item & data
|
|
67
|
+
const model = await getModel(initiative.id, requestOptions);
|
|
68
|
+
// create the PropertyMapper
|
|
69
|
+
const mapper = new PropertyMapper(getPropertyMap());
|
|
70
|
+
// Note: Although we are fetching the model, and applying changes onto it,
|
|
71
|
+
// we are not attempting to handle "concurrent edit" conflict resolution
|
|
72
|
+
// but this is where we would apply that sort of logic
|
|
73
|
+
const modelToUpdate = mapper.objectToModel(initiative, model);
|
|
74
|
+
// update the backing item
|
|
75
|
+
const updatedModel = await updateModel(modelToUpdate, requestOptions);
|
|
76
|
+
// now map back into an initiative and return that
|
|
77
|
+
let updatedInitiative = mapper.modelToObject(updatedModel, initiative);
|
|
78
|
+
updatedInitiative = computeProps(model, updatedInitiative, requestOptions);
|
|
79
|
+
// the casting is needed because modelToObject returns a `Partial<T>`
|
|
80
|
+
// where as this function returns a `T`
|
|
81
|
+
return updatedInitiative;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* @private
|
|
85
|
+
* Get a Hub Initiative by id or slug
|
|
86
|
+
* @param identifier item id or slug
|
|
87
|
+
* @param requestOptions
|
|
88
|
+
*/
|
|
89
|
+
export function fetchInitiative(identifier, requestOptions) {
|
|
90
|
+
let getPrms;
|
|
91
|
+
if (isGuid(identifier)) {
|
|
92
|
+
// get item by id
|
|
93
|
+
getPrms = getItem(identifier, requestOptions);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
getPrms = getItemBySlug(identifier, requestOptions);
|
|
97
|
+
}
|
|
98
|
+
return getPrms.then((item) => {
|
|
99
|
+
if (!item)
|
|
100
|
+
return null;
|
|
101
|
+
return convertItemToInitiative(item, requestOptions);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* @private
|
|
106
|
+
* Remove a Hub Initiative
|
|
107
|
+
* @param id
|
|
108
|
+
* @param requestOptions
|
|
109
|
+
*/
|
|
110
|
+
export async function deleteInitiative(id, requestOptions) {
|
|
111
|
+
const ro = Object.assign(Object.assign({}, requestOptions), { id });
|
|
112
|
+
await removeItem(ro);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* @private
|
|
117
|
+
* Convert an Hub Initiative Item into a Hub Initiative, fetching any additional
|
|
118
|
+
* information that may be required
|
|
119
|
+
* @param item
|
|
120
|
+
* @param auth
|
|
121
|
+
* @returns
|
|
122
|
+
*/
|
|
123
|
+
export async function convertItemToInitiative(item, requestOptions) {
|
|
124
|
+
const model = await fetchModelFromItem(item, requestOptions);
|
|
125
|
+
const mapper = new PropertyMapper(getPropertyMap());
|
|
126
|
+
const prj = mapper.modelToObject(model, {});
|
|
127
|
+
return computeProps(model, prj, requestOptions);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Given a model and an initiative, set various computed properties that can't be directly mapped
|
|
131
|
+
* @param model
|
|
132
|
+
* @param initiative
|
|
133
|
+
* @param requestOptions
|
|
134
|
+
* @returns
|
|
135
|
+
*/
|
|
136
|
+
function computeProps(model, initiative, requestOptions) {
|
|
137
|
+
let token;
|
|
138
|
+
if (requestOptions.authentication) {
|
|
139
|
+
const session = requestOptions.authentication;
|
|
140
|
+
token = session.token;
|
|
141
|
+
}
|
|
142
|
+
// thumbnail url
|
|
143
|
+
initiative.thumbnailUrl = getItemThumbnailUrl(model.item, requestOptions, token);
|
|
144
|
+
// Handle Dates
|
|
145
|
+
initiative.createdDate = new Date(model.item.created);
|
|
146
|
+
initiative.createdDateSource = "item.created";
|
|
147
|
+
initiative.updatedDate = new Date(model.item.modified);
|
|
148
|
+
initiative.updatedDateSource = "item.modified";
|
|
149
|
+
// cast b/c this takes a partial but returns a full initiative
|
|
150
|
+
return initiative;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* @private
|
|
154
|
+
* Fetch Initiative specific enrichments
|
|
155
|
+
* @param item
|
|
156
|
+
* @param include
|
|
157
|
+
* @param requestOptions
|
|
158
|
+
* @returns
|
|
159
|
+
*/
|
|
160
|
+
export async function enrichInitiativeSearchResult(item, include, requestOptions) {
|
|
161
|
+
// Create the basic structure
|
|
162
|
+
const result = {
|
|
163
|
+
access: item.access,
|
|
164
|
+
id: item.id,
|
|
165
|
+
type: item.type,
|
|
166
|
+
name: item.title,
|
|
167
|
+
owner: item.owner,
|
|
168
|
+
summary: item.snippet || item.description,
|
|
169
|
+
createdDate: new Date(item.created),
|
|
170
|
+
createdDateSource: "item.created",
|
|
171
|
+
updatedDate: new Date(item.modified),
|
|
172
|
+
updatedDateSource: "item.modified",
|
|
173
|
+
family: getFamily(item.type),
|
|
174
|
+
links: {
|
|
175
|
+
self: "not-implemented",
|
|
176
|
+
siteRelative: "not-implemented",
|
|
177
|
+
thumbnail: "not-implemented",
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
// default includes
|
|
181
|
+
const DEFAULTS = [];
|
|
182
|
+
// merge includes
|
|
183
|
+
include = [...DEFAULTS, ...include].filter(unique);
|
|
184
|
+
// Parse the includes into a valid set of enrichments
|
|
185
|
+
const specs = include.map(parseInclude);
|
|
186
|
+
// Extract out the low-level enrichments needed
|
|
187
|
+
const enrichments = mapBy("enrichment", specs).filter(unique);
|
|
188
|
+
// fetch the enrichments
|
|
189
|
+
let enriched = {};
|
|
190
|
+
if (enrichments.length) {
|
|
191
|
+
// TODO: Look into caching for the requests in fetchItemEnrichments
|
|
192
|
+
enriched = await fetchItemEnrichments(item, enrichments, requestOptions);
|
|
193
|
+
}
|
|
194
|
+
// map the enriched props onto the result
|
|
195
|
+
specs.forEach((spec) => {
|
|
196
|
+
result[spec.prop] = getProp(enriched, spec.path);
|
|
197
|
+
});
|
|
198
|
+
// Handle links
|
|
199
|
+
// TODO: Link handling should be an enrichment
|
|
200
|
+
result.links.thumbnail = getItemThumbnailUrl(item, requestOptions);
|
|
201
|
+
result.links.self = getItemHomeUrl(result.id, requestOptions);
|
|
202
|
+
result.links.siteRelative = getHubRelativeUrl(result.type, result.id, item.typeKeywords);
|
|
203
|
+
return result;
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=HubInitiatives.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HubInitiatives.js","sourceRoot":"","sources":["../../../src/initiatives/HubInitiatives.ts"],"names":[],"mappings":"AAEA,4EAA4E;AAC5E,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,QAAQ,EACR,WAAW,GACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,aAAa,EACb,aAAa,EACb,aAAa,EACb,cAAc,GACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEL,MAAM,EACN,WAAW,EACX,mBAAmB,EACnB,MAAM,EACN,KAAK,EACL,OAAO,EACP,SAAS,EAET,cAAc,GACf,MAAM,UAAU,CAAC;AAClB,OAAO,EAGL,UAAU,EACV,OAAO,GACR,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAgB,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAGhF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