@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
@@ -69,23 +69,25 @@ export declare const setContentBoundary: (content: IHubContent, boundary: Geogra
69
69
  viewDefinition?: {
70
70
  definitionExpression?: string;
71
71
  };
72
- thumbnailUrl?: string;
72
+ source?: string;
73
+ summary?: string;
73
74
  owner: string;
74
- description?: string;
75
+ id: string;
76
+ access?: import("../core").AccessLevel;
77
+ url?: string;
75
78
  culture?: string;
79
+ description?: string;
80
+ extent?: number[][];
76
81
  tags: string[];
82
+ thumbnailUrl?: string;
83
+ thumbnail?: string;
77
84
  typeKeywords?: string[];
78
- url?: string;
79
- access?: import("../core").AccessLevel;
80
- id: string;
81
85
  name: string;
82
- summary?: string;
83
86
  createdDate: Date;
84
87
  createdDateSource: string;
85
88
  updatedDate: Date;
86
89
  updatedDateSource: string;
87
90
  type: string;
88
- source?: string;
89
91
  statistics?: any;
90
92
  data?: {
91
93
  [propName: string]: any;
@@ -106,7 +108,6 @@ export declare const setContentBoundary: (content: IHubContent, boundary: Geogra
106
108
  title: string;
107
109
  snippet?: string;
108
110
  documentation?: string;
109
- extent?: number[][];
110
111
  spatialReference?: ISpatialReference;
111
112
  properties?: any;
112
113
  };
@@ -0,0 +1,83 @@
1
+ import { IGroup } from "@esri/arcgis-rest-portal";
2
+ import { IArcGISContext } from "../ArcGISContext";
3
+ import { IWithSharingBehavior, IWithStoreBehavior } from "./behaviors";
4
+ import { IWithThumbnailBehavior } from "./behaviors/IWithThumbnailBehavior";
5
+ import { IHubItemEntity, SettableAccessLevel } from "./types";
6
+ /**
7
+ * Base class for all Hub Entities backed by items
8
+ */
9
+ export declare abstract class HubItemEntity<T extends IHubItemEntity> implements IWithStoreBehavior<T>, IWithSharingBehavior, IWithThumbnailBehavior {
10
+ protected context: IArcGISContext;
11
+ protected entity: T;
12
+ protected isDestroyed: boolean;
13
+ protected thumbnailCache: {
14
+ file: any;
15
+ filename: string;
16
+ };
17
+ constructor(entity: T, context: IArcGISContext);
18
+ /**
19
+ * Return the entity id
20
+ */
21
+ get id(): string;
22
+ /**
23
+ * Return the entity owner
24
+ */
25
+ get owner(): string;
26
+ /**
27
+ * Return the backing entity as an object literal
28
+ * @returns
29
+ */
30
+ toJson(): T;
31
+ abstract update(changes: Partial<T>): void;
32
+ abstract save(): Promise<void>;
33
+ abstract delete(): Promise<void>;
34
+ /**
35
+ * Can the current user edit the Entity?
36
+ * In order to edit an item, the user must be the owner of the item
37
+ * or be a member of a shared editing group, to which the item is shared.
38
+ * @returns
39
+ */
40
+ canEdit(): Promise<boolean>;
41
+ /**
42
+ * Can the current user delete the Entity?
43
+ * In order to delete an item, the user must be the owner of the item or a full org_admin
44
+ * in the owner's organization.
45
+ * @returns
46
+ */
47
+ canDelete(): Promise<boolean>;
48
+ /**
49
+ * Share the Entity with the specified group id
50
+ * @param groupId
51
+ */
52
+ shareWithGroup(groupId: string): Promise<void>;
53
+ /**
54
+ * Unshare the Entity with the specified group id
55
+ * @param groupId
56
+ */
57
+ unshareWithGroup(groupId: string): Promise<void>;
58
+ /**
59
+ * Set the access level of the backing item
60
+ * @param access
61
+ */
62
+ setAccess(access: SettableAccessLevel): Promise<void>;
63
+ /**
64
+ * Return a list of groups the Entity is shared to.
65
+ * @returns
66
+ */
67
+ sharedWith(): Promise<IGroup[]>;
68
+ /**
69
+ * Hook that subclasses should call to invoke shared post-save behavior
70
+ */
71
+ afterSave(): Promise<void>;
72
+ /**
73
+ * Store thumbnail information to be sent with the next `.save()` call
74
+ * @param file
75
+ * @param filename
76
+ */
77
+ setThumbnail(file: any, filename: string): void;
78
+ /**
79
+ * Return the full url to the thumbnail, optionally with a width parameter
80
+ * @param width
81
+ */
82
+ getThumbnailUrl(width?: number): string;
83
+ }
@@ -0,0 +1,7 @@
1
+ import { IPropertyMap } from "./PropertyMapper";
2
+ /**
3
+ * Returns an Array of IPropertyMap objects
4
+ * that define the standard projection of properties from a IModel an entity interface
5
+ * @returns
6
+ */
7
+ export declare function getBasePropertyMap(): IPropertyMap[];
@@ -19,4 +19,14 @@ export interface IWithStoreBehavior<T> {
19
19
  * Delete the class instance from it's backing store
20
20
  */
21
21
  delete(): Promise<void>;
22
+ /**
23
+ * Can the current user edit the Entity?
24
+ * User must be owner, or member of a shared editing group, to which the item is shared
25
+ */
26
+ canEdit(useCache: boolean): Promise<boolean>;
27
+ /**
28
+ * Can the current user delete the Entity?
29
+ * User must own the entiry or be an org admin in the owner's org
30
+ */
31
+ canDelete(useCache: boolean): Promise<boolean>;
22
32
  }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Composable behavior that adds Thumbnail support to an entity class
3
+ */
4
+ export interface IWithThumbnailBehavior {
5
+ /**
6
+ * Set the thumbnail for an item backed entity. This call does not
7
+ * actuall upload the thumbnail until `.save()` is called.
8
+ * @param file
9
+ * @param filename
10
+ */
11
+ setThumbnail(file: any, filename: string): void;
12
+ /**
13
+ * Return the full url to the thumbnail for the item backed entity.
14
+ * Optionally, pass in a width. Default width is 200px, with 1:1.5 aspect ratio.
15
+ * Other widths are: 400px, 800px and 2400px. A request for any other width will
16
+ * snap to the next highest supported width. If the original image dimension is
17
+ * smaller than the size queried, the original image will be returned.
18
+ * @param width
19
+ */
20
+ getThumbnailUrl(width?: number): string;
21
+ }
@@ -2,7 +2,7 @@ import { IHubPermission } from "../types";
2
2
  /**
3
3
  * Adds permissions property to an entity
4
4
  */
5
- export interface IWithPermissionDefinition {
5
+ export interface IWithPermissions {
6
6
  /**
7
7
  * List of permissions for the entity
8
8
  */
@@ -2,3 +2,4 @@ export * from "./IWithBannerImage";
2
2
  export * from "./IWithLayout";
3
3
  export * from "./IWithSlug";
4
4
  export * from "./IWithPermissions";
5
+ export * from "./IWithCatalog";
@@ -0,0 +1,21 @@
1
+ import { IItemResource } from "./IItemResource";
2
+ /**
3
+ * More useful interface for entity resources.
4
+ *
5
+ * @export
6
+ * @interface IEntityResource
7
+ */
8
+ export interface IEntityResource extends IItemResource {
9
+ /**
10
+ * Type of resource
11
+ *
12
+ * @type {SolutionResourceType}
13
+ */
14
+ type: "image" | "thumbnail" | "other";
15
+ /**
16
+ * Url where this can be fetched from; Does not include token.
17
+ *
18
+ * @type {string}
19
+ */
20
+ sourceUrl: string;
21
+ }
@@ -15,7 +15,7 @@ export declare enum PublisherSource {
15
15
  /**
16
16
  * Data model for content
17
17
  */
18
- export interface IHubContent extends IHubItemEntity, IHubContentEnrichments, IItem {
18
+ export interface IHubContent extends Omit<IHubItemEntity, "schemaVersion">, IHubContentEnrichments, IItem {
19
19
  /**
20
20
  * The underlying portal item referenced by this content
21
21
  */
@@ -1,8 +1,8 @@
1
- import { IWithBannerImage } from "../traits/IWithBannerImage";
1
+ import { IWithSlug, IWithPermissions, IWithCatalog } from "../traits";
2
2
  import { IHubItemEntity } from "./IHubItemEntity";
3
3
  /**
4
4
  * DRAFT: Under development and more properties will likely be added
5
5
  * @internal
6
6
  */
7
- export interface IHubInitiative extends IHubItemEntity, IWithBannerImage {
7
+ export interface IHubInitiative extends IHubItemEntity, IWithSlug, IWithCatalog, IWithPermissions {
8
8
  }
@@ -6,17 +6,9 @@ import { AccessLevel } from "./types";
6
6
  */
7
7
  export interface IHubItemEntity extends IHubEntityBase {
8
8
  /**
9
- * Thumbnail Uril (read-only)
10
- */
11
- thumbnailUrl?: string;
12
- /**
13
- * Username of the owner of the item
14
- */
15
- owner: string;
16
- /**
17
- * Description for the item
9
+ * Access level of the item ("private" | "org" | "public")
18
10
  */
19
- description?: string;
11
+ access?: AccessLevel;
20
12
  /**
21
13
  * boundary will default to the item extent
22
14
  * but can be overwritten by enrichments from the Hub API (inline)
@@ -29,19 +21,40 @@ export interface IHubItemEntity extends IHubEntityBase {
29
21
  */
30
22
  culture?: string;
31
23
  /**
32
- * User configurable tags
24
+ * Description for the item
33
25
  */
34
- tags: string[];
26
+ description?: string;
35
27
  /**
36
- * System configurable typekeywords
28
+ * Extent of the Entity
37
29
  */
38
- typeKeywords?: string[];
30
+ extent?: number[][];
31
+ /**
32
+ * Username of the owner of the item
33
+ */
34
+ owner: string;
39
35
  /**
40
36
  * Canonical Url for the Entity
41
37
  */
42
38
  url?: string;
43
39
  /**
44
- * Access level of the item ("private" | "org" | "public")
40
+ * Current schema version. Used to determine what if any
41
+ * schema migrations should be applied when the item is loaded
45
42
  */
46
- access?: AccessLevel;
43
+ schemaVersion: number;
44
+ /**
45
+ * User configurable tags
46
+ */
47
+ tags: string[];
48
+ /**
49
+ * Thumbnail Uril (read-only)
50
+ */
51
+ thumbnailUrl?: string;
52
+ /**
53
+ * Thumbnail (read-only)
54
+ */
55
+ thumbnail?: string;
56
+ /**
57
+ * System configurable typekeywords
58
+ */
59
+ typeKeywords?: string[];
47
60
  }
@@ -1,10 +1,10 @@
1
1
  import { IHubTimeline, IHubItemEntity } from "./index";
2
- import { IWithLayout, IWithPermissionDefinition, IWithSlug } from "../traits/index";
3
- import { IWithCatalog } from "../traits/IWithCatalogDefinition";
2
+ import { IWithLayout, IWithPermissions, IWithSlug } from "../traits/index";
3
+ import { IWithCatalog } from "../traits/IWithCatalog";
4
4
  /**
5
5
  * Defines the properties of a Hub Project object
6
6
  */
7
- export interface IHubProject extends IHubItemEntity, IWithSlug, IWithCatalog, IWithLayout, IWithPermissionDefinition {
7
+ export interface IHubProject extends IHubItemEntity, IWithSlug, IWithCatalog, IWithLayout, IWithPermissions {
8
8
  /**
9
9
  * Timeline for the project
10
10
  */
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Item Resource
3
+ */
4
+ export interface IItemResource {
5
+ access: string;
6
+ created: number;
7
+ resource: string;
8
+ size: number;
9
+ }
@@ -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";
@@ -14,6 +14,7 @@ export * from "./items";
14
14
  export * from "./models";
15
15
  export * from "./objects";
16
16
  export * from "./projects";
17
+ export * from "./initiatives";
17
18
  export * from "./request";
18
19
  export * from "./resources";
19
20
  export * from "./search";
@@ -0,0 +1,67 @@
1
+ import { IHubInitiative, IWithPermissionBehavior, IWithCatalogBehavior, PermissionManager, IWithStoreBehavior, IWithSharingBehavior } from "../core";
2
+ import { Catalog } from "../search/Catalog";
3
+ import { IArcGISContext } from "../ArcGISContext";
4
+ import { HubItemEntity } from "../core/HubItemEntity";
5
+ /**
6
+ * Hub Initiative Class
7
+ */
8
+ export declare class HubInitiative extends HubItemEntity<IHubInitiative> implements IWithStoreBehavior<IHubInitiative>, IWithPermissionBehavior, IWithCatalogBehavior, IWithSharingBehavior {
9
+ private _catalog;
10
+ private _permissionManager;
11
+ /**
12
+ * Private constructor so we don't have `new` all over the place. Allows for
13
+ * more flexibility in how we create the HubInitiativeManager over time.
14
+ * @param context
15
+ */
16
+ private constructor();
17
+ /**
18
+ * Catalog instance for this Initiative. Note: Do not hold direct references to this object; always access it from the Initiative.
19
+ * @returns Catalog
20
+ */
21
+ get catalog(): Catalog;
22
+ /**
23
+ * PermissionManager instance for this Initiative. Note: Do not hold direct references to this object; always access it from the Initiative.
24
+ * @returns PermissionManager
25
+ */
26
+ get permissions(): PermissionManager;
27
+ /**
28
+ * Create an instance from an IHubInitiative object
29
+ * @param json - JSON object to create a HubInitiative from
30
+ * @param context - ArcGIS context
31
+ * @returns
32
+ */
33
+ static fromJson(json: Partial<IHubInitiative>, context: IArcGISContext): HubInitiative;
34
+ /**
35
+ * Create a new HubInitiative, returning a HubInitiative instance.
36
+ * Note: This does not persist the Initiative into the backing store
37
+ * @param partialInitiative
38
+ * @param context
39
+ * @returns
40
+ */
41
+ static create(partialInitiative: Partial<IHubInitiative>, context: IArcGISContext, save?: boolean): Promise<HubInitiative>;
42
+ /**
43
+ * Fetch an Initiative from the backing store and return a HubInitiative instance.
44
+ * @param identifier - slug or item id
45
+ * @param context
46
+ * @returns
47
+ */
48
+ static fetch(identifier: string, context: IArcGISContext): Promise<HubInitiative>;
49
+ private static applyDefaults;
50
+ /**
51
+ * Apply a new state to the instance
52
+ * @param changes
53
+ */
54
+ update(changes: Partial<IHubInitiative>): void;
55
+ /**
56
+ * Save the HubInitiative to the backing store.
57
+ * Currently Initiatives are stored as Items in Portal
58
+ * @returns
59
+ */
60
+ save(): Promise<void>;
61
+ /**
62
+ * Delete the HubInitiative from the store
63
+ * set a flag to indicate that it is destroyed
64
+ * @returns
65
+ */
66
+ delete(): Promise<void>;
67
+ }
@@ -0,0 +1,55 @@
1
+ import { IUserRequestOptions } from "@esri/arcgis-rest-auth";
2
+ import { IHubRequestOptions } from "../index";
3
+ import { IItem } from "@esri/arcgis-rest-portal";
4
+ import { IRequestOptions } from "@esri/arcgis-rest-request";
5
+ import { IHubInitiative } from "../core/types";
6
+ import { IHubSearchResult } from "../search";
7
+ /**
8
+ * @private
9
+ * Create a new Hub Initiative item
10
+ *
11
+ * Minimal properties are name and orgUrlKey
12
+ *
13
+ * @param partialInitiative
14
+ * @param requestOptions
15
+ */
16
+ export declare function createInitiative(partialInitiative: Partial<IHubInitiative>, requestOptions: IUserRequestOptions): Promise<IHubInitiative>;
17
+ /**
18
+ * @private
19
+ * Update a Hub Initiative
20
+ * @param initiative
21
+ * @param requestOptions
22
+ */
23
+ export declare function updateInitiative(initiative: IHubInitiative, requestOptions: IUserRequestOptions): Promise<IHubInitiative>;
24
+ /**
25
+ * @private
26
+ * Get a Hub Initiative by id or slug
27
+ * @param identifier item id or slug
28
+ * @param requestOptions
29
+ */
30
+ export declare function fetchInitiative(identifier: string, requestOptions: IRequestOptions): Promise<IHubInitiative>;
31
+ /**
32
+ * @private
33
+ * Remove a Hub Initiative
34
+ * @param id
35
+ * @param requestOptions
36
+ */
37
+ export declare function deleteInitiative(id: string, requestOptions: IUserRequestOptions): Promise<void>;
38
+ /**
39
+ * @private
40
+ * Convert an Hub Initiative Item into a Hub Initiative, fetching any additional
41
+ * information that may be required
42
+ * @param item
43
+ * @param auth
44
+ * @returns
45
+ */
46
+ export declare function convertItemToInitiative(item: IItem, requestOptions: IRequestOptions): Promise<IHubInitiative>;
47
+ /**
48
+ * @private
49
+ * Fetch Initiative specific enrichments
50
+ * @param item
51
+ * @param include
52
+ * @param requestOptions
53
+ * @returns
54
+ */
55
+ export declare function enrichInitiativeSearchResult(item: IItem, include: string[], requestOptions: IHubRequestOptions): Promise<IHubSearchResult>;
@@ -0,0 +1,11 @@
1
+ import { IHubInitiative } from "../core/types";
2
+ import { IModel } from "../types";
3
+ export declare const HUB_INITIATIVE_ITEM_TYPE = "Hub Initiative";
4
+ /**
5
+ * Default values of a IHubInitiative
6
+ */
7
+ export declare const DEFAULT_INITIATIVE: Partial<IHubInitiative>;
8
+ /**
9
+ * Default values for a new HubInitiative Model
10
+ */
11
+ export declare const DEFAULT_INITIATIVE_MODEL: IModel;
@@ -0,0 +1,2 @@
1
+ export * from "./HubInitiatives";
2
+ export * from "./HubInitiative";
@@ -1,14 +1,11 @@
1
- import { IHubProject, IWithPermissionBehavior, IWithCatalogBehavior, PermissionManager, IWithStoreBehavior, IWithSharingBehavior, SettableAccessLevel } from "../core";
1
+ import { IHubProject, IWithPermissionBehavior, IWithCatalogBehavior, PermissionManager, IWithStoreBehavior, IWithSharingBehavior } from "../core";
2
2
  import { Catalog } from "../search/Catalog";
3
3
  import { IArcGISContext } from "../ArcGISContext";
4
- import { IGroup } from "@esri/arcgis-rest-types";
4
+ import { HubItemEntity } from "../core/HubItemEntity";
5
5
  /**
6
6
  * Hub Project Class
7
7
  */
8
- export declare class HubProject implements IWithStoreBehavior<IHubProject>, IWithPermissionBehavior, IWithCatalogBehavior, IWithSharingBehavior {
9
- private context;
10
- private entity;
11
- private isDestroyed;
8
+ export declare class HubProject extends HubItemEntity<IHubProject> implements IWithStoreBehavior<IHubProject>, IWithPermissionBehavior, IWithCatalogBehavior, IWithSharingBehavior {
12
9
  private _catalog;
13
10
  private _permissionManager;
14
11
  /**
@@ -18,11 +15,13 @@ export declare class HubProject implements IWithStoreBehavior<IHubProject>, IWit
18
15
  */
19
16
  private constructor();
20
17
  /**
21
- * @returns Catalog instance for this project. Note: Do not hold direct references to this object; always access it from the project.
18
+ * Catalog instance for this project. Note: Do not hold direct references to this object; always access it from the project.
19
+ * @returns
22
20
  */
23
21
  get catalog(): Catalog;
24
22
  /**
25
- * @returns PermissionManager instance for this project. Note: Do not hold direct references to this object; always access it from the project.
23
+ * PermissionManager instance for this project. Note: Do not hold direct references to this object; always access it from the project.
24
+ * @returns
26
25
  */
27
26
  get permissions(): PermissionManager;
28
27
  /**
@@ -48,11 +47,6 @@ export declare class HubProject implements IWithStoreBehavior<IHubProject>, IWit
48
47
  */
49
48
  static fetch(identifier: string, context: IArcGISContext): Promise<HubProject>;
50
49
  private static applyDefaults;
51
- /**
52
- * Get the current state of the IHubProject from the instance
53
- * @returns IHubProject POJO
54
- */
55
- toJson(): IHubProject;
56
50
  /**
57
51
  * Apply a new state to the instance
58
52
  * @param changes
@@ -69,24 +63,4 @@ export declare class HubProject implements IWithStoreBehavior<IHubProject>, IWit
69
63
  * @returns
70
64
  */
71
65
  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[]>;
92
66
  }
@@ -0,0 +1,22 @@
1
+ import { IHubRequestOptions } from "../types";
2
+ import { IPortal } from "@esri/arcgis-rest-portal";
3
+ import { IRequestOptions } from "@esri/arcgis-rest-request";
4
+ interface IBuildHubCampaignUrl {
5
+ portal: string | IPortal | IHubRequestOptions | IRequestOptions;
6
+ uri: string;
7
+ meta: any;
8
+ redirectUrl: string;
9
+ }
10
+ /**
11
+ * Builds a Hub "campaign" URL used as a single entry-point into
12
+ * Hub from external links, i.e. push notifications, emails, sms, etc,
13
+ * from which we can capture campaign-related telemetry before redirecting
14
+ * the user off to a provided destination.
15
+ * @param options.portal A string IPortal IHubRequestOptions or IRequestOptions object
16
+ * @param options.uri A URI that provides additional context for how to parse the provide meta
17
+ * @param options.meta An object of metadata for the campaign URL
18
+ * @param options.redirectURL A redirect URL
19
+ * @returns string A campaign URL
20
+ */
21
+ export declare function getCampaignUrl(options: IBuildHubCampaignUrl): string;
22
+ export {};
@@ -17,6 +17,7 @@ export * from "./getHubApiFromPortalUrl";
17
17
  export * from "./getPortalBaseFromOrgUrl";
18
18
  export * from "./getGroupHomeUrl";
19
19
  export * from "./getUserHomeUrl";
20
+ export * from "./get-campaign-url";
20
21
  /**
21
22
  *
22
23
  * @param url
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/hub-common",
3
- "version": "11.0.0",
3
+ "version": "11.3.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",
@@ -1 +0,0 @@
1
- //# sourceMappingURL=IWithCatalogDefinition.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IWithCatalogDefinition.js","sourceRoot":"","sources":["../../../../src/core/traits/IWithCatalogDefinition.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=IHubEntityManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IHubEntityManager.js","sourceRoot":"","sources":["../../../../src/core/types/IHubEntityManager.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=IHubItemEntityManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IHubItemEntityManager.js","sourceRoot":"","sources":["../../../../src/core/types/IHubItemEntityManager.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"IWithCatalogDefinition.js","sourceRoot":"","sources":["../../../../src/core/traits/IWithCatalogDefinition.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"IHubEntityManager.js","sourceRoot":"","sources":["../../../../src/core/types/IHubEntityManager.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"IHubItemEntityManager.js","sourceRoot":"","sources":["../../../../src/core/types/IHubItemEntityManager.ts"],"names":[],"mappings":""}