@esri/hub-common 11.0.0 → 11.3.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.
Files changed (111) hide show
  1. package/dist/esm/core/HubItemEntity.js +202 -0
  2. package/dist/esm/core/HubItemEntity.js.map +1 -0
  3. package/dist/esm/core/_internal/getBasePropertyMap.js +57 -0
  4. package/dist/esm/core/_internal/getBasePropertyMap.js.map +1 -0
  5. package/dist/esm/core/behaviors/IWithThumbnailBehavior.js +1 -0
  6. package/dist/esm/core/behaviors/IWithThumbnailBehavior.js.map +1 -0
  7. package/dist/esm/core/traits/IWithCatalog.js +1 -0
  8. package/dist/esm/core/traits/IWithCatalog.js.map +1 -0
  9. package/dist/esm/core/traits/index.js +1 -0
  10. package/dist/esm/core/traits/index.js.map +1 -1
  11. package/dist/esm/core/types/IEntityResource.js +1 -0
  12. package/dist/esm/core/types/IEntityResource.js.map +1 -0
  13. package/dist/esm/core/types/IItemResource.js +1 -0
  14. package/dist/esm/core/types/IItemResource.js.map +1 -0
  15. package/dist/esm/core/types/index.js +0 -2
  16. package/dist/esm/core/types/index.js.map +1 -1
  17. package/dist/esm/index.js +1 -2
  18. package/dist/esm/index.js.map +1 -1
  19. package/dist/esm/initiatives/HubInitiative.js +149 -0
  20. package/dist/esm/initiatives/HubInitiative.js.map +1 -0
  21. package/dist/esm/initiatives/HubInitiatives.js +205 -0
  22. package/dist/esm/initiatives/HubInitiatives.js.map +1 -0
  23. package/dist/esm/initiatives/defaults.js +31 -0
  24. package/dist/esm/initiatives/defaults.js.map +1 -0
  25. package/dist/esm/initiatives/index.js +3 -0
  26. package/dist/esm/initiatives/index.js.map +1 -0
  27. package/dist/esm/items/setItemThumbnail.js +1 -0
  28. package/dist/esm/items/setItemThumbnail.js.map +1 -1
  29. package/dist/esm/projects/HubProject.js +9 -65
  30. package/dist/esm/projects/HubProject.js.map +1 -1
  31. package/dist/esm/projects/HubProjects.js +13 -54
  32. package/dist/esm/projects/HubProjects.js.map +1 -1
  33. package/dist/esm/projects/defaults.js +2 -1
  34. package/dist/esm/projects/defaults.js.map +1 -1
  35. package/dist/esm/urls/get-campaign-url.js +25 -0
  36. package/dist/esm/urls/get-campaign-url.js.map +1 -0
  37. package/dist/esm/urls/index.js +1 -0
  38. package/dist/esm/urls/index.js.map +1 -1
  39. package/dist/node/core/HubItemEntity.js +206 -0
  40. package/dist/node/core/HubItemEntity.js.map +1 -0
  41. package/dist/node/core/_internal/getBasePropertyMap.js +61 -0
  42. package/dist/node/core/_internal/getBasePropertyMap.js.map +1 -0
  43. package/dist/node/core/{traits/IWithCatalogDefinition.js → behaviors/IWithThumbnailBehavior.js} +1 -1
  44. package/dist/node/core/behaviors/IWithThumbnailBehavior.js.map +1 -0
  45. package/dist/node/core/{types/IHubEntityManager.js → traits/IWithCatalog.js} +1 -1
  46. package/dist/node/core/traits/IWithCatalog.js.map +1 -0
  47. package/dist/node/core/traits/index.js +1 -0
  48. package/dist/node/core/traits/index.js.map +1 -1
  49. package/dist/node/core/types/{IHubItemEntityManager.js → IEntityResource.js} +1 -1
  50. package/dist/node/core/types/IEntityResource.js.map +1 -0
  51. package/dist/node/core/types/IItemResource.js +3 -0
  52. package/dist/node/core/types/IItemResource.js.map +1 -0
  53. package/dist/node/core/types/index.js +0 -2
  54. package/dist/node/core/types/index.js.map +1 -1
  55. package/dist/node/index.js +1 -2
  56. package/dist/node/index.js.map +1 -1
  57. package/dist/node/initiatives/HubInitiative.js +153 -0
  58. package/dist/node/initiatives/HubInitiative.js.map +1 -0
  59. package/dist/node/initiatives/HubInitiatives.js +214 -0
  60. package/dist/node/initiatives/HubInitiatives.js.map +1 -0
  61. package/dist/node/initiatives/defaults.js +34 -0
  62. package/dist/node/initiatives/defaults.js.map +1 -0
  63. package/dist/node/initiatives/index.js +6 -0
  64. package/dist/node/initiatives/index.js.map +1 -0
  65. package/dist/node/items/setItemThumbnail.js +1 -0
  66. package/dist/node/items/setItemThumbnail.js.map +1 -1
  67. package/dist/node/projects/HubProject.js +9 -65
  68. package/dist/node/projects/HubProject.js.map +1 -1
  69. package/dist/node/projects/HubProjects.js +13 -54
  70. package/dist/node/projects/HubProjects.js.map +1 -1
  71. package/dist/node/projects/defaults.js +2 -1
  72. package/dist/node/projects/defaults.js.map +1 -1
  73. package/dist/node/urls/get-campaign-url.js +29 -0
  74. package/dist/node/urls/get-campaign-url.js.map +1 -0
  75. package/dist/node/urls/index.js +1 -0
  76. package/dist/node/urls/index.js.map +1 -1
  77. package/dist/types/content/_internal.d.ts +9 -8
  78. package/dist/types/core/HubItemEntity.d.ts +83 -0
  79. package/dist/types/core/_internal/getBasePropertyMap.d.ts +7 -0
  80. package/dist/types/core/behaviors/IWithStoreBehavior.d.ts +10 -0
  81. package/dist/types/core/behaviors/IWithThumbnailBehavior.d.ts +21 -0
  82. package/dist/types/core/traits/{IWithCatalogDefinition.d.ts → IWithCatalog.d.ts} +0 -0
  83. package/dist/types/core/traits/IWithPermissions.d.ts +1 -1
  84. package/dist/types/core/traits/index.d.ts +1 -0
  85. package/dist/types/core/types/IEntityResource.d.ts +21 -0
  86. package/dist/types/core/types/IHubContent.d.ts +1 -1
  87. package/dist/types/core/types/IHubInitiative.d.ts +2 -2
  88. package/dist/types/core/types/IHubItemEntity.d.ts +29 -16
  89. package/dist/types/core/types/IHubProject.d.ts +3 -3
  90. package/dist/types/core/types/IItemResource.d.ts +9 -0
  91. package/dist/types/core/types/index.d.ts +0 -2
  92. package/dist/types/index.d.ts +1 -0
  93. package/dist/types/initiatives/HubInitiative.d.ts +67 -0
  94. package/dist/types/initiatives/HubInitiatives.d.ts +55 -0
  95. package/dist/types/initiatives/defaults.d.ts +11 -0
  96. package/dist/types/initiatives/index.d.ts +2 -0
  97. package/dist/types/projects/HubProject.d.ts +7 -33
  98. package/dist/types/urls/get-campaign-url.d.ts +22 -0
  99. package/dist/types/urls/index.d.ts +1 -0
  100. package/package.json +1 -1
  101. package/dist/esm/core/traits/IWithCatalogDefinition.js +0 -1
  102. package/dist/esm/core/traits/IWithCatalogDefinition.js.map +0 -1
  103. package/dist/esm/core/types/IHubEntityManager.js +0 -1
  104. package/dist/esm/core/types/IHubEntityManager.js.map +0 -1
  105. package/dist/esm/core/types/IHubItemEntityManager.js +0 -1
  106. package/dist/esm/core/types/IHubItemEntityManager.js.map +0 -1
  107. package/dist/node/core/traits/IWithCatalogDefinition.js.map +0 -1
  108. package/dist/node/core/types/IHubEntityManager.js.map +0 -1
  109. package/dist/node/core/types/IHubItemEntityManager.js.map +0 -1
  110. package/dist/types/core/types/IHubEntityManager.d.ts +0 -46
  111. package/dist/types/core/types/IHubItemEntityManager.d.ts +0 -25
@@ -0,0 +1,202 @@
1
+ import { getUser, setItemAccess, shareItemWithGroup, unshareItemWithGroup, } from "@esri/arcgis-rest-portal";
2
+ import { setItemThumbnail } from "../items/setItemThumbnail";
3
+ import { getItemThumbnailUrl } from "../resources";
4
+ import { cloneObject } from "../util";
5
+ import { mapBy } from "../utils";
6
+ import { sharedWith } from "./_internal/sharedWith";
7
+ /**
8
+ * Base class for all Hub Entities backed by items
9
+ */
10
+ export class HubItemEntity {
11
+ constructor(entity, context) {
12
+ this.isDestroyed = false;
13
+ this.thumbnailCache = null;
14
+ this.context = context;
15
+ this.entity = entity;
16
+ }
17
+ // Although we don't expose all the properties, we do expose a few for convenience
18
+ /**
19
+ * Return the entity id
20
+ */
21
+ get id() {
22
+ return this.entity.id;
23
+ }
24
+ /**
25
+ * Return the entity owner
26
+ */
27
+ get owner() {
28
+ return this.entity.owner;
29
+ }
30
+ //#region IWithStoreBehavior
31
+ /**
32
+ * Return the backing entity as an object literal
33
+ * @returns
34
+ */
35
+ toJson() {
36
+ if (this.isDestroyed) {
37
+ throw new Error("Entity is already destroyed.");
38
+ }
39
+ return cloneObject(this.entity);
40
+ }
41
+ /**
42
+ * Can the current user edit the Entity?
43
+ * In order to edit an item, the user must be the owner of the item
44
+ * or be a member of a shared editing group, to which the item is shared.
45
+ * @returns
46
+ */
47
+ async canEdit() {
48
+ const user = this.context.currentUser;
49
+ // owner can always edit
50
+ if (user.username === this.entity.owner) {
51
+ return Promise.resolve(true);
52
+ }
53
+ // Fetch the user's groups by fetching the user
54
+ // we do this each time to ensure we have the latest groups
55
+ const u = await getUser(user.username);
56
+ const usersGroups = u.groups;
57
+ if (!usersGroups.length) {
58
+ // if user is not owner and not in any groups they can't have edit access
59
+ return Promise.resolve(false);
60
+ }
61
+ // get the groups the entity is shared to
62
+ const entityGroups = await this.sharedWith();
63
+ // filter to shared edit groups
64
+ const editGroupIds = entityGroups
65
+ .filter((g) => {
66
+ const caps = g.capabilities || [];
67
+ return caps.includes("updateitemcontrol");
68
+ })
69
+ .map((g) => g.id);
70
+ // get the user's groups ids
71
+ const usersGroupsIds = mapBy("id", usersGroups);
72
+ // check for any overlap
73
+ let isMemberOfEditGroup = false;
74
+ for (const id of usersGroupsIds) {
75
+ isMemberOfEditGroup = editGroupIds.includes(id);
76
+ if (isMemberOfEditGroup) {
77
+ break;
78
+ }
79
+ }
80
+ return Promise.resolve(isMemberOfEditGroup);
81
+ }
82
+ /**
83
+ * Can the current user delete the Entity?
84
+ * In order to delete an item, the user must be the owner of the item or a full org_admin
85
+ * in the owner's organization.
86
+ * @returns
87
+ */
88
+ async canDelete() {
89
+ const user = this.context.currentUser;
90
+ // owner can always delete
91
+ if (user.username === this.entity.owner) {
92
+ return Promise.resolve(true);
93
+ }
94
+ // if not owner, check if user is org_admin in same org as owner
95
+ if (user.role === "org_admin" && !user.roleId) {
96
+ // need to get the owner, and see if the orgid matches
97
+ const ownerUser = await getUser({
98
+ username: this.entity.owner,
99
+ authentication: this.context.session,
100
+ });
101
+ // ensure owner orgId is not null and matched current user
102
+ const adminCanDelete = ownerUser.orgId && ownerUser.orgId === user.orgId;
103
+ return Promise.resolve(adminCanDelete);
104
+ }
105
+ else {
106
+ // not org admin, can't edit
107
+ return Promise.resolve(false);
108
+ }
109
+ }
110
+ //#endregion IWithStoreBehavior
111
+ //#region IWithSharingBehavior
112
+ /**
113
+ * Share the Entity with the specified group id
114
+ * @param groupId
115
+ */
116
+ async shareWithGroup(groupId) {
117
+ await shareItemWithGroup({
118
+ id: this.entity.id,
119
+ groupId,
120
+ owner: this.entity.owner,
121
+ authentication: this.context.session,
122
+ });
123
+ }
124
+ /**
125
+ * Unshare the Entity with the specified group id
126
+ * @param groupId
127
+ */
128
+ async unshareWithGroup(groupId) {
129
+ await unshareItemWithGroup({
130
+ id: this.entity.id,
131
+ groupId,
132
+ owner: this.entity.owner,
133
+ authentication: this.context.session,
134
+ });
135
+ }
136
+ /**
137
+ * Set the access level of the backing item
138
+ * @param access
139
+ */
140
+ async setAccess(access) {
141
+ await setItemAccess({
142
+ id: this.entity.id,
143
+ access,
144
+ authentication: this.context.session,
145
+ });
146
+ // if this succeeded, update the entity
147
+ this.entity.access = access;
148
+ }
149
+ /**
150
+ * Return a list of groups the Entity is shared to.
151
+ * @returns
152
+ */
153
+ async sharedWith() {
154
+ // delegate to a util that merges the three arrays returned from the api, into a single array
155
+ return sharedWith(this.entity.id, this.context.requestOptions);
156
+ }
157
+ //#endregion
158
+ /**
159
+ * Hook that subclasses should call to invoke shared post-save behavior
160
+ */
161
+ async afterSave() {
162
+ // Handle Thumbnails
163
+ // check if there is a thumbnail in the cache
164
+ if (this.thumbnailCache) {
165
+ // save the thumbnail
166
+ await setItemThumbnail(this.entity.id, this.thumbnailCache.file, this.thumbnailCache.filename, this.context.userRequestOptions);
167
+ // Note: updating the thumbnail alone does not update the modified date of the item
168
+ // thus we can just set props on the entity w/o re-fetching
169
+ this.entity.thumbnail = `thumbnail/${this.thumbnailCache.filename}`;
170
+ this.entity.thumbnailUrl = this.getThumbnailUrl();
171
+ // clear the thumbnail cache
172
+ this.thumbnailCache = null;
173
+ }
174
+ }
175
+ //#region IWithThumbnailBehavior
176
+ /**
177
+ * Store thumbnail information to be sent with the next `.save()` call
178
+ * @param file
179
+ * @param filename
180
+ */
181
+ setThumbnail(file, filename) {
182
+ // subclass is responsible for handling the implementation during the `.save()` call
183
+ this.thumbnailCache = { file, filename };
184
+ }
185
+ /**
186
+ * Return the full url to the thumbnail, optionally with a width parameter
187
+ * @param width
188
+ */
189
+ getThumbnailUrl(width = 200) {
190
+ const minimalItem = {
191
+ id: this.entity.id,
192
+ access: this.entity.access,
193
+ thumbnail: this.entity.thumbnail,
194
+ };
195
+ const opts = {
196
+ token: this.context.session.token,
197
+ width,
198
+ };
199
+ return getItemThumbnailUrl(minimalItem, this.context.requestOptions, opts);
200
+ }
201
+ }
202
+ //# 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,EAGP,aAAa,EACb,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAqB,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAIjC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD;;GAEG;AACH,MAAM,OAAgB,aAAa;IAWjC,YAAY,MAAS,EAAE,OAAuB;QAHpC,gBAAW,GAAY,KAAK,CAAC;QAC7B,mBAAc,GAAoC,IAAI,CAAC;QAG/D,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,kFAAkF;IAClF;;OAEG;IACH,IAAI,EAAE;QACJ,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;IAC3B,CAAC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AY,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;YAClD,4BAA4B;YAC5B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;SAC5B;IACH,CAAC;IAED,gCAAgC;IAEhC;;;;OAIG;IACH,YAAY,CAAC,IAAS,EAAE,QAAgB;QACtC,oFAAoF;QACpF,IAAI,CAAC,cAAc,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IAC3C,CAAC;IACD;;;OAGG;IACH,eAAe,CAAC,QAAgB,GAAG;QACjC,MAAM,WAAW,GAAG;YAClB,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE;YAClB,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM;YAC1B,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS;SACb,CAAC;QAEtB,MAAM,IAAI,GAAsB;YAC9B,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK;YACjC,KAAK;SACN,CAAC;QAEF,OAAO,mBAAmB,CAAC,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;IAC7E,CAAC;CAEF"}
@@ -0,0 +1,57 @@
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
+ "tags",
17
+ "type",
18
+ "typeKeywords",
19
+ "thumbnail",
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: "summary",
37
+ modelKey: "item.snippet",
38
+ });
39
+ map.push({
40
+ objectKey: "schemaVersion",
41
+ modelKey: "item.properties.schemaVersion",
42
+ });
43
+ map.push({
44
+ objectKey: "orgUrlKey",
45
+ modelKey: "item.properties.orgUrlKey",
46
+ });
47
+ map.push({
48
+ objectKey: "name",
49
+ modelKey: "item.title",
50
+ });
51
+ map.push({
52
+ objectKey: "boundary",
53
+ modelKey: "item.properties.boundary",
54
+ });
55
+ return map;
56
+ }
57
+ //# 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,MAAM;QACN,MAAM;QACN,cAAc;QACd,WAAW;QACX,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,SAAS;QACpB,QAAQ,EAAE,cAAc;KACzB,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=IWithThumbnailBehavior.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IWithThumbnailBehavior.js","sourceRoot":"","sources":["../../../../src/core/behaviors/IWithThumbnailBehavior.ts"],"names":[],"mappings":""}
@@ -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":""}
@@ -2,4 +2,5 @@ export * from "./IWithBannerImage";
2
2
  export * from "./IWithLayout";
3
3
  export * from "./IWithSlug";
4
4
  export * from "./IWithPermissions";
5
+ export * from "./IWithCatalog";
5
6
  //# sourceMappingURL=index.js.map
@@ -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;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,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"}
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
@@ -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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AC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,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,149 @@
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
+ // call the after save hook on superclass
132
+ await super.afterSave();
133
+ return;
134
+ }
135
+ /**
136
+ * Delete the HubInitiative from the store
137
+ * set a flag to indicate that it is destroyed
138
+ * @returns
139
+ */
140
+ async delete() {
141
+ if (this.isDestroyed) {
142
+ throw new Error("HubInitiative is already destroyed.");
143
+ }
144
+ this.isDestroyed = true;
145
+ // Delegate to module fn
146
+ await deleteInitiative(this.entity.id, this.context.userRequestOptions);
147
+ }
148
+ }
149
+ //# 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,M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