@esri/hub-common 14.14.0 → 14.15.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 (78) hide show
  1. package/dist/esm/core/HubItemEntity.js +20 -1
  2. package/dist/esm/core/HubItemEntity.js.map +1 -1
  3. package/dist/esm/core/behaviors/IWithFollowersBehavior.js +1 -0
  4. package/dist/esm/core/behaviors/IWithFollowersBehavior.js.map +1 -0
  5. package/dist/esm/core/schemas/internal/getEntityEditorSchemas.js +1 -0
  6. package/dist/esm/core/schemas/internal/getEntityEditorSchemas.js.map +1 -1
  7. package/dist/esm/core/schemas/internal/subsetSchema.js +3 -0
  8. package/dist/esm/core/schemas/internal/subsetSchema.js.map +1 -1
  9. package/dist/esm/core/schemas/shared/HubItemEntitySchema.js +10 -0
  10. package/dist/esm/core/schemas/shared/HubItemEntitySchema.js.map +1 -1
  11. package/dist/esm/sites/HubSite.js +18 -8
  12. package/dist/esm/sites/HubSite.js.map +1 -1
  13. package/dist/esm/sites/HubSites.js +12 -0
  14. package/dist/esm/sites/HubSites.js.map +1 -1
  15. package/dist/esm/sites/_internal/SiteBusinessRules.js +7 -0
  16. package/dist/esm/sites/_internal/SiteBusinessRules.js.map +1 -1
  17. package/dist/esm/sites/_internal/SiteSchema.js +5 -1
  18. package/dist/esm/sites/_internal/SiteSchema.js.map +1 -1
  19. package/dist/esm/sites/_internal/SiteUiSchemaEdit.js +3 -3
  20. package/dist/esm/sites/_internal/SiteUiSchemaFollowers.js +56 -0
  21. package/dist/esm/sites/_internal/SiteUiSchemaFollowers.js.map +1 -0
  22. package/dist/esm/sites/_internal/capabilities/capabilityToFeatureMap.js +31 -0
  23. package/dist/esm/sites/_internal/capabilities/capabilityToFeatureMap.js.map +1 -0
  24. package/dist/esm/sites/_internal/capabilities/convertFeaturesToLegacyCapabilities.js +46 -0
  25. package/dist/esm/sites/_internal/capabilities/convertFeaturesToLegacyCapabilities.js.map +1 -0
  26. package/dist/esm/sites/_internal/capabilities/migrateLegacyCapabilitiesToFeatures.js +34 -0
  27. package/dist/esm/sites/_internal/capabilities/migrateLegacyCapabilitiesToFeatures.js.map +1 -0
  28. package/dist/esm/sites/_internal/capabilities/types.js +1 -0
  29. package/dist/esm/sites/_internal/capabilities/types.js.map +1 -0
  30. package/dist/esm/sites/upgrade-site-schema.js +2 -0
  31. package/dist/esm/sites/upgrade-site-schema.js.map +1 -1
  32. package/dist/node/core/HubItemEntity.js +19 -0
  33. package/dist/node/core/HubItemEntity.js.map +1 -1
  34. package/dist/node/core/behaviors/IWithFollowersBehavior.js +3 -0
  35. package/dist/node/core/behaviors/IWithFollowersBehavior.js.map +1 -0
  36. package/dist/node/core/schemas/internal/getEntityEditorSchemas.js +1 -0
  37. package/dist/node/core/schemas/internal/getEntityEditorSchemas.js.map +1 -1
  38. package/dist/node/core/schemas/internal/subsetSchema.js +3 -0
  39. package/dist/node/core/schemas/internal/subsetSchema.js.map +1 -1
  40. package/dist/node/core/schemas/shared/HubItemEntitySchema.js +10 -0
  41. package/dist/node/core/schemas/shared/HubItemEntitySchema.js.map +1 -1
  42. package/dist/node/sites/HubSite.js +18 -8
  43. package/dist/node/sites/HubSite.js.map +1 -1
  44. package/dist/node/sites/HubSites.js +12 -0
  45. package/dist/node/sites/HubSites.js.map +1 -1
  46. package/dist/node/sites/_internal/SiteBusinessRules.js +7 -0
  47. package/dist/node/sites/_internal/SiteBusinessRules.js.map +1 -1
  48. package/dist/node/sites/_internal/SiteSchema.js +5 -1
  49. package/dist/node/sites/_internal/SiteSchema.js.map +1 -1
  50. package/dist/node/sites/_internal/SiteUiSchemaEdit.js +3 -3
  51. package/dist/node/sites/_internal/SiteUiSchemaFollowers.js +59 -0
  52. package/dist/node/sites/_internal/SiteUiSchemaFollowers.js.map +1 -0
  53. package/dist/node/sites/_internal/capabilities/capabilityToFeatureMap.js +34 -0
  54. package/dist/node/sites/_internal/capabilities/capabilityToFeatureMap.js.map +1 -0
  55. package/dist/node/sites/_internal/capabilities/convertFeaturesToLegacyCapabilities.js +49 -0
  56. package/dist/node/sites/_internal/capabilities/convertFeaturesToLegacyCapabilities.js.map +1 -0
  57. package/dist/node/sites/_internal/capabilities/migrateLegacyCapabilitiesToFeatures.js +37 -0
  58. package/dist/node/sites/_internal/capabilities/migrateLegacyCapabilitiesToFeatures.js.map +1 -0
  59. package/dist/node/sites/_internal/capabilities/types.js +3 -0
  60. package/dist/node/sites/_internal/capabilities/types.js.map +1 -0
  61. package/dist/node/sites/upgrade-site-schema.js +2 -0
  62. package/dist/node/sites/upgrade-site-schema.js.map +1 -1
  63. package/dist/types/content/_internal/internalContentUtils.d.ts +1 -0
  64. package/dist/types/core/HubItemEntity.d.ts +11 -1
  65. package/dist/types/core/behaviors/IWithFollowersBehavior.d.ts +15 -0
  66. package/dist/types/core/schemas/types.d.ts +1 -1
  67. package/dist/types/core/traits/IWithFollowers.d.ts +1 -1
  68. package/dist/types/core/types/IHubItemEntity.d.ts +18 -1
  69. package/dist/types/core/types/IHubSite.d.ts +3 -10
  70. package/dist/types/sites/_internal/SiteBusinessRules.d.ts +1 -1
  71. package/dist/types/sites/_internal/SiteSchema.d.ts +1 -1
  72. package/dist/types/sites/_internal/SiteUiSchemaEdit.d.ts +3 -3
  73. package/dist/types/sites/_internal/SiteUiSchemaFollowers.d.ts +11 -0
  74. package/dist/types/sites/_internal/capabilities/capabilityToFeatureMap.d.ts +14 -0
  75. package/dist/types/sites/_internal/capabilities/convertFeaturesToLegacyCapabilities.d.ts +19 -0
  76. package/dist/types/sites/_internal/capabilities/migrateLegacyCapabilitiesToFeatures.d.ts +12 -0
  77. package/dist/types/sites/_internal/capabilities/types.d.ts +29 -0
  78. package/package.json +1 -1
@@ -112,6 +112,7 @@ export declare const setContentBoundary: (content: IHubContent, boundary: Geogra
112
112
  };
113
113
  features?: import("../..").IFeatureFlags;
114
114
  isDiscussable?: boolean;
115
+ followersGroupId?: string;
115
116
  statistics?: any;
116
117
  data?: {
117
118
  [propName: string]: any;
@@ -5,10 +5,11 @@ import { IWithSharingBehavior, IWithStoreBehavior, IWithFeaturedImageBehavior, I
5
5
  import { IWithThumbnailBehavior } from "./behaviors/IWithThumbnailBehavior";
6
6
  import { IHubItemEntity, SettableAccessLevel } from "./types";
7
7
  import { IWithDiscussionsBehavior } from "./behaviors/IWithDiscussionsBehavior";
8
+ import { IWithFollowersBehavior } from "./behaviors/IWithFollowersBehavior";
8
9
  /**
9
10
  * Base class for all Hub Entities backed by items
10
11
  */
11
- export declare abstract class HubItemEntity<T extends IHubItemEntity> implements IWithStoreBehavior<T>, IWithSharingBehavior, IWithThumbnailBehavior, IWithFeaturedImageBehavior, IWithPermissionBehavior, IWithDiscussionsBehavior {
12
+ export declare abstract class HubItemEntity<T extends IHubItemEntity> implements IWithStoreBehavior<T>, IWithSharingBehavior, IWithThumbnailBehavior, IWithFeaturedImageBehavior, IWithPermissionBehavior, IWithDiscussionsBehavior, IWithFollowersBehavior {
12
13
  protected context: IArcGISContext;
13
14
  protected entity: T;
14
15
  protected isDestroyed: boolean;
@@ -92,6 +93,15 @@ export declare abstract class HubItemEntity<T extends IHubItemEntity> implements
92
93
  * @param access
93
94
  */
94
95
  setAccess(access: SettableAccessLevel): Promise<void>;
96
+ /**
97
+ * Returns the followers group
98
+ */
99
+ getFollowersGroup(): Promise<IGroup>;
100
+ /**
101
+ * Sets the access level of the followers group
102
+ * @param access
103
+ */
104
+ setFollowersGroupAccess(access: SettableAccessLevel): Promise<void>;
95
105
  /**
96
106
  * Return a list of groups the Entity is shared to.
97
107
  * @returns
@@ -0,0 +1,15 @@
1
+ import { IGroup } from "@esri/arcgis-rest-types";
2
+ import { SettableAccessLevel } from "../types";
3
+ /**
4
+ * Followers behavior for Item-Backed Entities
5
+ */
6
+ export interface IWithFollowersBehavior {
7
+ /**
8
+ * Get the followers group
9
+ */
10
+ getFollowersGroup(): Promise<IGroup>;
11
+ /**
12
+ * Set the access level of the followers group
13
+ */
14
+ setFollowersGroupAccess(access: SettableAccessLevel): Promise<void>;
15
+ }
@@ -5,7 +5,7 @@ import Ajv from "ajv";
5
5
  * to the supported/defined uiSchema configurations
6
6
  */
7
7
  export declare type EditorType = (typeof validEditorTypes)[number];
8
- export declare const validEditorTypes: readonly ["hub:project:create", "hub:project:edit", "hub:content:edit", "hub:content:settings", "hub:initiative:edit", "hub:initiative:create", "hub:site:edit", "hub:site:create", "hub:discussion:edit", "hub:discussion:create", "hub:page:edit", "hub:group:edit", "hub:group:settings"];
8
+ export declare const validEditorTypes: readonly ["hub:project:create", "hub:project:edit", "hub:content:edit", "hub:content:settings", "hub:initiative:edit", "hub:initiative:create", "hub:site:edit", "hub:site:create", "hub:site:followers", "hub:discussion:edit", "hub:discussion:create", "hub:page:edit", "hub:group:edit", "hub:group:settings"];
9
9
  export declare enum UiSchemaRuleEffects {
10
10
  SHOW = "SHOW",
11
11
  HIDE = "HIDE",
@@ -3,5 +3,5 @@
3
3
  */
4
4
  export interface IWithFollowers {
5
5
  /** followers group id */
6
- followersGroupId: string;
6
+ followersGroupId?: string;
7
7
  }
@@ -3,10 +3,11 @@ import { IHubGeography } from "../../types";
3
3
  import { AccessLevel } from "./types";
4
4
  import { IWithPermissions, IWithViewSettings, IWithDiscussions } from "../traits";
5
5
  import { IHubLocation } from "./IHubLocation";
6
+ import { IWithFollowers } from "../traits/IWithFollowers";
6
7
  /**
7
8
  * Properties exposed by Entities that are backed by Items
8
9
  */
9
- export interface IHubItemEntity extends IHubEntityBase, IWithPermissions, IWithDiscussions {
10
+ export interface IHubItemEntity extends IHubEntityBase, IWithPermissions, IWithDiscussions, IWithFollowers {
10
11
  /**
11
12
  * Access level of the item ("private" | "org" | "public")
12
13
  */
@@ -101,3 +102,19 @@ export interface IHubItemEntity extends IHubEntityBase, IWithPermissions, IWithD
101
102
  */
102
103
  protected?: boolean;
103
104
  }
105
+ export declare type IHubItemEntityEditor<T> = Omit<T, "extent"> & {
106
+ /**
107
+ * Thumbnail image. This is only used on the Editor and is
108
+ * persisted in the fromEditor method on the Class
109
+ */
110
+ _thumbnail?: any;
111
+ /**
112
+ * Follower group settings. These settings are only used in the
113
+ * Editor and is persisted appropriately in the fromEditor
114
+ * method on the Class
115
+ */
116
+ _followers?: {
117
+ groupAccess?: AccessLevel;
118
+ showFollowAction?: boolean;
119
+ };
120
+ };
@@ -1,13 +1,12 @@
1
1
  import { IExtent } from "@esri/arcgis-rest-feature-layer";
2
2
  import { IWithVersioningBehavior } from "../behaviors";
3
3
  import { IWithCatalog, IWithLayout, IWithPermissions, IWithSlug } from "../traits/index";
4
- import { IHubItemEntity } from "./IHubItemEntity";
5
- import { IWithFollowers } from "../traits/IWithFollowers";
4
+ import { IHubItemEntity, IHubItemEntityEditor } from "./IHubItemEntity";
6
5
  /**
7
6
  * DRAFT: Under development and more properties will likely be added
8
7
  * @internal
9
8
  */
10
- export interface IHubSite extends IHubItemEntity, IWithSlug, IWithCatalog, IWithLayout, IWithPermissions, IWithVersioningBehavior, IWithFollowers {
9
+ export interface IHubSite extends IHubItemEntity, IWithSlug, IWithCatalog, IWithLayout, IWithPermissions, IWithVersioningBehavior {
11
10
  /**
12
11
  * Array of minimal page objects
13
12
  */
@@ -70,10 +69,4 @@ export interface IHubSite extends IHubItemEntity, IWithSlug, IWithCatalog, IWith
70
69
  /** Legacy teams - list of ids */
71
70
  legacyTeams: string[];
72
71
  }
73
- export declare type IHubSiteEditor = Omit<IHubSite, "extent"> & {
74
- /**
75
- * Thumbnail image. This is only used on the Editor and is
76
- * persisted in the fromEditor method on the Class
77
- */
78
- _thumbnail?: any;
79
- };
72
+ export declare type IHubSiteEditor = IHubItemEntityEditor<IHubSite> & {};
@@ -7,7 +7,7 @@ export declare const SiteDefaultFeatures: IFeatureFlags;
7
7
  * Site Permissions
8
8
  * This feeds into the Permissions type
9
9
  */
10
- export declare const SitePermissions: readonly ["hub:site", "hub:site:create", "hub:site:delete", "hub:site:edit", "hub:site:view", "hub:site:owner", "hub:site:events", "hub:site:content", "hub:site:discussions", "hub:site:workspace:overview", "hub:site:workspace:dashboard", "hub:site:workspace:details", "hub:site:workspace:settings", "hub:site:workspace:collaborators", "hub:site:workspace:content", "hub:site:workspace:metrics", "hub:site:workspace:followers", "hub:site:workspace:followers:member", "hub:site:workspace:followers:manager", "hub:site:manage"];
10
+ export declare const SitePermissions: readonly ["hub:site", "hub:site:create", "hub:site:delete", "hub:site:edit", "hub:site:view", "hub:site:owner", "hub:site:events", "hub:site:content", "hub:site:discussions", "hub:site:feature:follow", "hub:site:workspace:overview", "hub:site:workspace:dashboard", "hub:site:workspace:details", "hub:site:workspace:settings", "hub:site:workspace:collaborators", "hub:site:workspace:content", "hub:site:workspace:metrics", "hub:site:workspace:followers", "hub:site:workspace:followers:member", "hub:site:workspace:followers:manager", "hub:site:manage"];
11
11
  /**
12
12
  * Site permission policies
13
13
  * @private
@@ -1,6 +1,6 @@
1
1
  import { IConfigurationSchema } from "../../core";
2
2
  export declare type SiteEditorType = (typeof SiteEditorTypes)[number];
3
- export declare const SiteEditorTypes: readonly ["hub:site:edit", "hub:site:create"];
3
+ export declare const SiteEditorTypes: readonly ["hub:site:edit", "hub:site:create", "hub:site:followers"];
4
4
  /**
5
5
  * defines the JSON schema for a Hub Site's editable fields
6
6
  */
@@ -3,8 +3,8 @@ import { IUiSchema } from "../../core/schemas/types";
3
3
  import { IHubSite } from "../../core/types";
4
4
  /**
5
5
  * @private
6
- * construct edit uiSchema for Hub Projects - this defines
7
- * how the schema properties should be rendered in the
8
- * project editing experience
6
+ * constructs the edit uiSchema for Hub Sites.
7
+ * This defines how the schema properties should
8
+ * be rendered in the site editing experience
9
9
  */
10
10
  export declare const buildUiSchema: (i18nScope: string, entity: IHubSite, context: IArcGISContext) => Promise<IUiSchema>;
@@ -0,0 +1,11 @@
1
+ import { IArcGISContext } from "../../ArcGISContext";
2
+ import { IUiSchema } from "../../core/schemas/types";
3
+ import { IHubSite } from "../../core/types";
4
+ /**
5
+ * @private
6
+ * constructs the followers uiSchema for Hub Sites.
7
+ * This defines how the schema properties should
8
+ * be rendered in the site followers > settings
9
+ * experience
10
+ */
11
+ export declare const buildUiSchema: (i18nScope: string, entity: IHubSite, context: IArcGISContext) => Promise<IUiSchema>;
@@ -0,0 +1,14 @@
1
+ import { ICapabilityToFeatureMap } from "./types";
2
+ /**
3
+ * Returns an array of ICapabilityToFeatureMap objects
4
+ * that define the projection of legacy capabilities
5
+ * to permission features.
6
+ *
7
+ * We use this map to manage foward and backard conversions
8
+ * and migration of legacy capablities to features when a
9
+ * site is fetched or updated
10
+ *
11
+ * NOTE: if you are porting a legacy capability over to
12
+ * workspaces, add it to this map
13
+ */
14
+ export declare const capabilityToFeatureMap: ICapabilityToFeatureMap[];
@@ -0,0 +1,19 @@
1
+ import { IModel } from "../../../types";
2
+ /**
3
+ * Site capabilities are currently saved as an array on the
4
+ * site.data.values.capabilities. We want to migragte these
5
+ * legacy capabilities over to features in the new permissions
6
+ * system; however, we must continue persisting updates to
7
+ * these features in the legacy capabilities array until the
8
+ * existing site capabilities in our application are plumbed
9
+ * to work off of permissions
10
+ *
11
+ * This function is called within updateSite to ensure
12
+ * the legacy capabilities array is kept up-to-date
13
+ *
14
+ * TODO: Remove once site capabilities use permissions
15
+ *
16
+ * @param modelToUpdate
17
+ * @param currentModel
18
+ */
19
+ export declare const convertFeaturesToLegacyCapabilities: (modelToUpdate: IModel, currentModel: IModel) => IModel;
@@ -0,0 +1,12 @@
1
+ import { IModel } from "../../../types";
2
+ /**
3
+ * Site capabilities are currently saved as an array on the
4
+ * site.data.values.capabilities. We want to migragte these
5
+ * legacy capabilities over to features in the new permissions
6
+ * system and expose them on the entity
7
+ *
8
+ * This function is called within fetchSite to ensure all
9
+ * sites have features that are kept up-to-date with the
10
+ * legacy capabilities array
11
+ */
12
+ export declare const migrateLegacyCapabilitiesToFeatures: (model: IModel) => IModel;
@@ -0,0 +1,29 @@
1
+ import { SitePermissions } from "../SiteBusinessRules";
2
+ /**
3
+ * legacy site capabilities
4
+ */
5
+ export declare type LegacyCapability = "hideFollow";
6
+ /**
7
+ * representation of legacy site capabilities as
8
+ * feature flags
9
+ */
10
+ export interface ILegacyCapabilityFeatureFlags extends Partial<Record<LegacyCapability, boolean>> {
11
+ }
12
+ /**
13
+ * capability to feature map entry that provides a
14
+ * "cross-walk" between a legacy site capability
15
+ * and site feature (using the new permissions
16
+ * system)
17
+ *
18
+ * This enables us to convert/migrate capabilities
19
+ * to features when sites are fetched and updated
20
+ */
21
+ export interface ICapabilityToFeatureMap {
22
+ capability: LegacyCapability;
23
+ feature: (typeof SitePermissions)[number];
24
+ /**
25
+ * whether to apply a ! when converting between the
26
+ * capability and feature
27
+ */
28
+ negate?: boolean;
29
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/hub-common",
3
- "version": "14.14.0",
3
+ "version": "14.15.0",
4
4
  "description": "Common TypeScript types and utility functions for @esri/hub.js.",
5
5
  "main": "dist/node/index.js",
6
6
  "module": "dist/esm/index.js",