@esri/hub-common 11.0.0-beta.1 → 11.0.0-beta.4

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 (68) hide show
  1. package/dist/esm/Hub.js +0 -30
  2. package/dist/esm/Hub.js.map +1 -1
  3. package/dist/esm/core/PermissionManager.js +4 -4
  4. package/dist/esm/core/PermissionManager.js.map +1 -1
  5. package/dist/esm/core/_internal/PropertyMapper.js +1 -0
  6. package/dist/esm/core/_internal/PropertyMapper.js.map +1 -1
  7. package/dist/esm/core/_internal/sharedWith.js +14 -0
  8. package/dist/esm/core/_internal/sharedWith.js.map +1 -0
  9. package/dist/esm/core/behaviors/IWithPermissionBehavior.js +2 -2
  10. package/dist/esm/core/behaviors/IWithPermissionBehavior.js.map +1 -1
  11. package/dist/esm/core/behaviors/IWithSharingBehavior.js +1 -0
  12. package/dist/esm/core/behaviors/IWithSharingBehavior.js.map +1 -0
  13. package/dist/esm/core/behaviors/index.js +1 -0
  14. package/dist/esm/core/behaviors/index.js.map +1 -1
  15. package/dist/esm/projects/HubProject.js +57 -174
  16. package/dist/esm/projects/HubProject.js.map +1 -1
  17. package/dist/esm/projects/HubProjectManager.js +1 -0
  18. package/dist/esm/projects/HubProjectManager.js.map +1 -1
  19. package/dist/esm/projects/HubProjects.js +1 -4
  20. package/dist/esm/projects/HubProjects.js.map +1 -1
  21. package/dist/esm/projects/defaults.js +2 -2
  22. package/dist/esm/projects/defaults.js.map +1 -1
  23. package/dist/esm/projects/index.js +0 -1
  24. package/dist/esm/projects/index.js.map +1 -1
  25. package/dist/esm/sites/index.js +0 -1
  26. package/dist/esm/sites/index.js.map +1 -1
  27. package/dist/node/Hub.js +0 -30
  28. package/dist/node/Hub.js.map +1 -1
  29. package/dist/node/core/PermissionManager.js +4 -4
  30. package/dist/node/core/PermissionManager.js.map +1 -1
  31. package/dist/node/core/_internal/PropertyMapper.js +1 -0
  32. package/dist/node/core/_internal/PropertyMapper.js.map +1 -1
  33. package/dist/node/core/_internal/sharedWith.js +18 -0
  34. package/dist/node/core/_internal/sharedWith.js.map +1 -0
  35. package/dist/node/core/behaviors/IWithPermissionBehavior.js +2 -2
  36. package/dist/node/core/behaviors/IWithPermissionBehavior.js.map +1 -1
  37. package/dist/node/core/behaviors/IWithSharingBehavior.js +3 -0
  38. package/dist/node/core/behaviors/IWithSharingBehavior.js.map +1 -0
  39. package/dist/node/core/behaviors/index.js +1 -0
  40. package/dist/node/core/behaviors/index.js.map +1 -1
  41. package/dist/node/projects/HubProject.js +57 -174
  42. package/dist/node/projects/HubProject.js.map +1 -1
  43. package/dist/node/projects/HubProjectManager.js +1 -0
  44. package/dist/node/projects/HubProjectManager.js.map +1 -1
  45. package/dist/node/projects/HubProjects.js +1 -4
  46. package/dist/node/projects/HubProjects.js.map +1 -1
  47. package/dist/node/projects/defaults.js +2 -2
  48. package/dist/node/projects/defaults.js.map +1 -1
  49. package/dist/node/projects/index.js +0 -1
  50. package/dist/node/projects/index.js.map +1 -1
  51. package/dist/node/sites/index.js +0 -1
  52. package/dist/node/sites/index.js.map +1 -1
  53. package/dist/types/Hub.d.ts +0 -18
  54. package/dist/types/core/PermissionManager.d.ts +1 -1
  55. package/dist/types/core/_internal/PropertyMapper.d.ts +1 -0
  56. package/dist/types/core/_internal/sharedWith.d.ts +10 -0
  57. package/dist/types/core/behaviors/IWithPermissionBehavior.d.ts +1 -1
  58. package/dist/types/core/behaviors/IWithSharingBehavior.d.ts +27 -0
  59. package/dist/types/core/behaviors/index.d.ts +1 -0
  60. package/dist/types/core/traits/IWithCatalogDefinition.d.ts +2 -2
  61. package/dist/types/core/traits/IWithPermissions.d.ts +1 -1
  62. package/dist/types/core/types/IHubProject.d.ts +2 -2
  63. package/dist/types/core/types/types.d.ts +5 -1
  64. package/dist/types/projects/HubProject.d.ts +23 -2
  65. package/dist/types/projects/HubProjectManager.d.ts +1 -0
  66. package/dist/types/projects/index.d.ts +0 -1
  67. package/dist/types/sites/index.d.ts +0 -1
  68. package/package.json +1 -1
@@ -0,0 +1,27 @@
1
+ import { IGroup } from "@esri/arcgis-rest-portal";
2
+ import { AccessLevel } from "../types";
3
+ /**
4
+ * Sharing behavior for Item-Backed Entities
5
+ */
6
+ export interface IWithSharingBehavior {
7
+ /**
8
+ * Share the item with the specified group
9
+ * @param groupId
10
+ */
11
+ shareWithGroup(groupId: string): Promise<void>;
12
+ /**
13
+ * Unshare the item with the specified group
14
+ * @param groupId
15
+ */
16
+ unshareWithGroup(groupId: string): Promise<void>;
17
+ /**
18
+ * Set the access level for the item
19
+ * @param access
20
+ */
21
+ setAccess(access: AccessLevel): Promise<void>;
22
+ /**
23
+ * Get the list of groups that the item is shared to.
24
+ * Limited to Groups that the user has access to
25
+ */
26
+ sharedWith(): Promise<IGroup[]>;
27
+ }
@@ -1,3 +1,4 @@
1
1
  export * from "./IWithPermissionBehavior";
2
2
  export * from "./IWithCatalogBehavior";
3
3
  export * from "./IWithStoreBehavior";
4
+ export * from "./IWithSharingBehavior";
@@ -1,7 +1,7 @@
1
1
  import { IHubCatalog } from "../../search";
2
- export interface IWithCatalogDefinition {
2
+ export interface IWithCatalog {
3
3
  /**
4
4
  * Catalog
5
5
  */
6
- catalogDefinition: IHubCatalog;
6
+ catalog: IHubCatalog;
7
7
  }
@@ -6,5 +6,5 @@ export interface IWithPermissionDefinition {
6
6
  /**
7
7
  * List of permissions for the entity
8
8
  */
9
- permissionDefinition: IHubPermission[];
9
+ permissions: IHubPermission[];
10
10
  }
@@ -1,10 +1,10 @@
1
1
  import { IHubTimeline, IHubItemEntity } from "./index";
2
2
  import { IWithLayout, IWithPermissionDefinition, IWithSlug } from "../traits/index";
3
- import { IWithCatalogDefinition } from "../traits/IWithCatalogDefinition";
3
+ import { IWithCatalog } from "../traits/IWithCatalogDefinition";
4
4
  /**
5
5
  * Defines the properties of a Hub Project object
6
6
  */
7
- export interface IHubProject extends IHubItemEntity, IWithSlug, IWithCatalogDefinition, IWithLayout, IWithPermissionDefinition {
7
+ export interface IHubProject extends IHubItemEntity, IWithSlug, IWithCatalog, IWithLayout, IWithPermissionDefinition {
8
8
  /**
9
9
  * Timeline for the project
10
10
  */
@@ -1,4 +1,8 @@
1
+ /**
2
+ * Access levels that can be set on an item
3
+ */
4
+ export declare type SettableAccessLevel = "public" | "org" | "private";
1
5
  /**
2
6
  * Access level for Platform Entities
3
7
  */
4
- export declare type AccessLevel = "public" | "shared" | "org" | "private";
8
+ export declare type AccessLevel = SettableAccessLevel | "shared";
@@ -1,10 +1,11 @@
1
- import { IHubProject, IWithPermissionBehavior, IWithCatalogBehavior, PermissionManager, IWithStoreBehavior } from "../core";
1
+ import { IHubProject, IWithPermissionBehavior, IWithCatalogBehavior, PermissionManager, IWithStoreBehavior, IWithSharingBehavior, SettableAccessLevel } from "../core";
2
2
  import { Catalog } from "../search/Catalog";
3
3
  import { IArcGISContext } from "../ArcGISContext";
4
+ import { IGroup } from "@esri/arcgis-rest-types";
4
5
  /**
5
6
  * Hub Project Class
6
7
  */
7
- export declare class HubProject implements IWithStoreBehavior<IHubProject>, IWithPermissionBehavior, IWithCatalogBehavior {
8
+ export declare class HubProject implements IWithStoreBehavior<IHubProject>, IWithPermissionBehavior, IWithCatalogBehavior, IWithSharingBehavior {
8
9
  private context;
9
10
  private entity;
10
11
  private isDestroyed;
@@ -68,4 +69,24 @@ export declare class HubProject implements IWithStoreBehavior<IHubProject>, IWit
68
69
  * @returns
69
70
  */
70
71
  delete(): Promise<void>;
72
+ /**
73
+ * Share the Project with the specified group id
74
+ * @param groupId
75
+ */
76
+ shareWithGroup(groupId: string): Promise<void>;
77
+ /**
78
+ * Unshare the Project with the specified group id
79
+ * @param groupId
80
+ */
81
+ unshareWithGroup(groupId: string): Promise<void>;
82
+ /**
83
+ * Set the access level of the backing item
84
+ * @param access
85
+ */
86
+ setAccess(access: SettableAccessLevel): Promise<void>;
87
+ /**
88
+ * Return a list of groups the Project is shared to.
89
+ * @returns
90
+ */
91
+ sharedWith(): Promise<IGroup[]>;
71
92
  }
@@ -7,6 +7,7 @@ import { IHubItemEntityManager } from "../core/types/IHubItemEntityManager";
7
7
  import { IGroup, IItem } from "@esri/arcgis-rest-types";
8
8
  import { ISharingResponse } from "@esri/arcgis-rest-portal";
9
9
  /**
10
+ * @private
10
11
  * Centralized functions used to manage IHubProject instances
11
12
  *
12
13
  * This class is a convenience wrapper over util functions which
@@ -1,3 +1,2 @@
1
- export * from "./HubProjectManager";
2
1
  export * from "./HubProjects";
3
2
  export * from "./HubProject";
@@ -3,7 +3,6 @@ export * from "./domains";
3
3
  export * from "./drafts";
4
4
  export * from "./fetchSiteModel";
5
5
  export * from "./get-site-by-id";
6
- export * from "./HubSiteManager";
7
6
  export * from "./HubSites";
8
7
  export * from "./registerSiteAsApplication";
9
8
  export * from "./site-schema-version";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/hub-common",
3
- "version": "11.0.0-beta.1",
3
+ "version": "11.0.0-beta.4",
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",