@esri/hub-common 14.15.0 → 14.17.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 (183) hide show
  1. package/dist/esm/associations/addAssociation.js +16 -0
  2. package/dist/esm/associations/addAssociation.js.map +1 -0
  3. package/dist/esm/associations/index.js +5 -0
  4. package/dist/esm/associations/index.js.map +1 -0
  5. package/dist/esm/associations/internal/getTargetEntityFromAssociationType.js +18 -0
  6. package/dist/esm/associations/internal/getTargetEntityFromAssociationType.js.map +1 -0
  7. package/dist/esm/associations/internal/getTypeByIdsQuery.js +28 -0
  8. package/dist/esm/associations/internal/getTypeByIdsQuery.js.map +1 -0
  9. package/dist/esm/associations/internal/getTypeFromAssociationType.js +18 -0
  10. package/dist/esm/associations/internal/getTypeFromAssociationType.js.map +1 -0
  11. package/dist/esm/associations/internal/getTypeWithKeywordQuery.js +27 -0
  12. package/dist/esm/associations/internal/getTypeWithKeywordQuery.js.map +1 -0
  13. package/dist/esm/associations/internal/getTypeWithoutKeywordQuery.js +27 -0
  14. package/dist/esm/associations/internal/getTypeWithoutKeywordQuery.js.map +1 -0
  15. package/dist/esm/associations/listAssociations.js +17 -0
  16. package/dist/esm/associations/listAssociations.js.map +1 -0
  17. package/dist/esm/associations/removeAssociation.js +17 -0
  18. package/dist/esm/associations/removeAssociation.js.map +1 -0
  19. package/dist/esm/associations/types.js +2 -0
  20. package/dist/esm/associations/types.js.map +1 -0
  21. package/dist/esm/content/_internal/computeProps.js +4 -4
  22. package/dist/esm/content/_internal/computeProps.js.map +1 -1
  23. package/dist/esm/content/edit.js +8 -5
  24. package/dist/esm/content/edit.js.map +1 -1
  25. package/dist/esm/core/HubItemEntity.js +28 -0
  26. package/dist/esm/core/HubItemEntity.js.map +1 -1
  27. package/dist/esm/core/behaviors/IWIthAssociationBehavior.js +1 -0
  28. package/dist/esm/core/behaviors/IWIthAssociationBehavior.js.map +1 -0
  29. package/dist/esm/core/behaviors/index.js +1 -0
  30. package/dist/esm/core/behaviors/index.js.map +1 -1
  31. package/dist/esm/core/getTypeFromEntity.js +0 -5
  32. package/dist/esm/core/getTypeFromEntity.js.map +1 -1
  33. package/dist/esm/core/schemas/internal/getLocationExtent.js +2 -2
  34. package/dist/esm/core/schemas/internal/getLocationExtent.js.map +1 -1
  35. package/dist/esm/core/schemas/internal/getLocationOptions.js +12 -53
  36. package/dist/esm/core/schemas/internal/getLocationOptions.js.map +1 -1
  37. package/dist/esm/core/traits/IWithAssociations.js +1 -0
  38. package/dist/esm/core/traits/IWithAssociations.js.map +1 -0
  39. package/dist/esm/core/traits/index.js +1 -0
  40. package/dist/esm/core/traits/index.js.map +1 -1
  41. package/dist/esm/discussions/api/types.js.map +1 -1
  42. package/dist/esm/extent.js +6 -6
  43. package/dist/esm/extent.js.map +1 -1
  44. package/dist/esm/groups/HubGroups.js +1 -1
  45. package/dist/esm/groups/HubGroups.js.map +1 -1
  46. package/dist/esm/groups/_internal/computeProps.js +1 -1
  47. package/dist/esm/groups/_internal/computeProps.js.map +1 -1
  48. package/dist/esm/index.js +1 -0
  49. package/dist/esm/index.js.map +1 -1
  50. package/dist/esm/initiatives/HubInitiative.js +1 -1
  51. package/dist/esm/initiatives/HubInitiative.js.map +1 -1
  52. package/dist/esm/initiatives/HubInitiatives.js +129 -0
  53. package/dist/esm/initiatives/HubInitiatives.js.map +1 -1
  54. package/dist/esm/metrics/resolveMetric.js +6 -3
  55. package/dist/esm/metrics/resolveMetric.js.map +1 -1
  56. package/dist/esm/permissions/types/Permission.js +0 -2
  57. package/dist/esm/permissions/types/Permission.js.map +1 -1
  58. package/dist/esm/projects/HubProject.js +1 -1
  59. package/dist/esm/projects/HubProject.js.map +1 -1
  60. package/dist/esm/projects/fetch.js +26 -0
  61. package/dist/esm/projects/fetch.js.map +1 -1
  62. package/dist/esm/search/_internal/combineQueries.js +2 -0
  63. package/dist/esm/search/_internal/combineQueries.js.map +1 -1
  64. package/dist/esm/search/_internal/getEntityTypeFromType.js +21 -0
  65. package/dist/esm/search/_internal/getEntityTypeFromType.js.map +1 -0
  66. package/dist/esm/search/_internal/negateGroupPredicates.js +28 -0
  67. package/dist/esm/search/_internal/negateGroupPredicates.js.map +1 -0
  68. package/dist/esm/search/hubSearch.js +5 -1
  69. package/dist/esm/search/hubSearch.js.map +1 -1
  70. package/dist/esm/search/utils.js +16 -0
  71. package/dist/esm/search/utils.js.map +1 -1
  72. package/dist/esm/users/HubUsers.js +1 -1
  73. package/dist/esm/users/HubUsers.js.map +1 -1
  74. package/dist/esm/utils/memoize.js +2 -4
  75. package/dist/esm/utils/memoize.js.map +1 -1
  76. package/dist/node/associations/addAssociation.js +20 -0
  77. package/dist/node/associations/addAssociation.js.map +1 -0
  78. package/dist/node/associations/index.js +8 -0
  79. package/dist/node/associations/index.js.map +1 -0
  80. package/dist/node/associations/internal/getTargetEntityFromAssociationType.js +22 -0
  81. package/dist/node/associations/internal/getTargetEntityFromAssociationType.js.map +1 -0
  82. package/dist/node/associations/internal/getTypeByIdsQuery.js +32 -0
  83. package/dist/node/associations/internal/getTypeByIdsQuery.js.map +1 -0
  84. package/dist/node/associations/internal/getTypeFromAssociationType.js +22 -0
  85. package/dist/node/associations/internal/getTypeFromAssociationType.js.map +1 -0
  86. package/dist/node/associations/internal/getTypeWithKeywordQuery.js +31 -0
  87. package/dist/node/associations/internal/getTypeWithKeywordQuery.js.map +1 -0
  88. package/dist/node/associations/internal/getTypeWithoutKeywordQuery.js +31 -0
  89. package/dist/node/associations/internal/getTypeWithoutKeywordQuery.js.map +1 -0
  90. package/dist/node/associations/listAssociations.js +21 -0
  91. package/dist/node/associations/listAssociations.js.map +1 -0
  92. package/dist/node/associations/removeAssociation.js +21 -0
  93. package/dist/node/associations/removeAssociation.js.map +1 -0
  94. package/dist/node/associations/types.js +4 -0
  95. package/dist/node/associations/types.js.map +1 -0
  96. package/dist/node/content/_internal/computeProps.js +5 -5
  97. package/dist/node/content/_internal/computeProps.js.map +1 -1
  98. package/dist/node/content/edit.js +8 -5
  99. package/dist/node/content/edit.js.map +1 -1
  100. package/dist/node/core/HubItemEntity.js +28 -0
  101. package/dist/node/core/HubItemEntity.js.map +1 -1
  102. package/dist/node/core/behaviors/IWIthAssociationBehavior.js +3 -0
  103. package/dist/node/core/behaviors/IWIthAssociationBehavior.js.map +1 -0
  104. package/dist/node/core/behaviors/index.js +1 -0
  105. package/dist/node/core/behaviors/index.js.map +1 -1
  106. package/dist/node/core/getTypeFromEntity.js +0 -5
  107. package/dist/node/core/getTypeFromEntity.js.map +1 -1
  108. package/dist/node/core/schemas/internal/getLocationExtent.js +1 -1
  109. package/dist/node/core/schemas/internal/getLocationExtent.js.map +1 -1
  110. package/dist/node/core/schemas/internal/getLocationOptions.js +13 -55
  111. package/dist/node/core/schemas/internal/getLocationOptions.js.map +1 -1
  112. package/dist/node/core/traits/IWithAssociations.js +3 -0
  113. package/dist/node/core/traits/IWithAssociations.js.map +1 -0
  114. package/dist/node/core/traits/index.js +1 -0
  115. package/dist/node/core/traits/index.js.map +1 -1
  116. package/dist/node/discussions/api/types.js.map +1 -1
  117. package/dist/node/extent.js +8 -8
  118. package/dist/node/extent.js.map +1 -1
  119. package/dist/node/groups/HubGroups.js +4 -4
  120. package/dist/node/groups/HubGroups.js.map +1 -1
  121. package/dist/node/groups/_internal/computeProps.js +2 -2
  122. package/dist/node/groups/_internal/computeProps.js.map +1 -1
  123. package/dist/node/index.js +1 -0
  124. package/dist/node/index.js.map +1 -1
  125. package/dist/node/initiatives/HubInitiative.js +3 -3
  126. package/dist/node/initiatives/HubInitiative.js.map +1 -1
  127. package/dist/node/initiatives/HubInitiatives.js +134 -1
  128. package/dist/node/initiatives/HubInitiatives.js.map +1 -1
  129. package/dist/node/metrics/resolveMetric.js +6 -3
  130. package/dist/node/metrics/resolveMetric.js.map +1 -1
  131. package/dist/node/permissions/types/Permission.js +0 -2
  132. package/dist/node/permissions/types/Permission.js.map +1 -1
  133. package/dist/node/projects/HubProject.js +3 -3
  134. package/dist/node/projects/HubProject.js.map +1 -1
  135. package/dist/node/projects/fetch.js +28 -1
  136. package/dist/node/projects/fetch.js.map +1 -1
  137. package/dist/node/search/_internal/combineQueries.js +2 -0
  138. package/dist/node/search/_internal/combineQueries.js.map +1 -1
  139. package/dist/node/search/_internal/getEntityTypeFromType.js +25 -0
  140. package/dist/node/search/_internal/getEntityTypeFromType.js.map +1 -0
  141. package/dist/node/search/_internal/negateGroupPredicates.js +32 -0
  142. package/dist/node/search/_internal/negateGroupPredicates.js.map +1 -0
  143. package/dist/node/search/hubSearch.js +10 -6
  144. package/dist/node/search/hubSearch.js.map +1 -1
  145. package/dist/node/search/utils.js +18 -1
  146. package/dist/node/search/utils.js.map +1 -1
  147. package/dist/node/users/HubUsers.js +4 -4
  148. package/dist/node/users/HubUsers.js.map +1 -1
  149. package/dist/node/utils/memoize.js +2 -4
  150. package/dist/node/utils/memoize.js.map +1 -1
  151. package/dist/types/associations/addAssociation.d.ts +9 -0
  152. package/dist/types/associations/index.d.ts +4 -0
  153. package/dist/types/associations/internal/getTargetEntityFromAssociationType.d.ts +8 -0
  154. package/dist/types/associations/internal/getTypeByIdsQuery.d.ts +10 -0
  155. package/dist/types/associations/internal/getTypeFromAssociationType.d.ts +7 -0
  156. package/dist/types/associations/internal/getTypeWithKeywordQuery.d.ts +10 -0
  157. package/dist/types/associations/internal/getTypeWithoutKeywordQuery.d.ts +10 -0
  158. package/dist/types/associations/listAssociations.d.ts +8 -0
  159. package/dist/types/associations/removeAssociation.d.ts +9 -0
  160. package/dist/types/associations/types.d.ts +19 -0
  161. package/dist/types/content/_internal/computeProps.d.ts +1 -1
  162. package/dist/types/content/_internal/internalContentUtils.d.ts +10 -37
  163. package/dist/types/core/HubItemEntity.d.ts +22 -2
  164. package/dist/types/core/behaviors/IWIthAssociationBehavior.d.ts +23 -0
  165. package/dist/types/core/behaviors/index.d.ts +1 -0
  166. package/dist/types/core/schemas/internal/getLocationOptions.d.ts +0 -1
  167. package/dist/types/core/traits/IWithAssociations.d.ts +4 -0
  168. package/dist/types/core/traits/index.d.ts +1 -0
  169. package/dist/types/core/types/IHubItemEntity.d.ts +2 -1
  170. package/dist/types/discussions/api/types.d.ts +1 -0
  171. package/dist/types/extent.d.ts +1 -1
  172. package/dist/types/groups/HubGroups.d.ts +1 -1
  173. package/dist/types/index.d.ts +1 -0
  174. package/dist/types/initiatives/HubInitiative.d.ts +1 -1
  175. package/dist/types/initiatives/HubInitiatives.d.ts +40 -1
  176. package/dist/types/permissions/types/Permission.d.ts +14 -2
  177. package/dist/types/projects/HubProject.d.ts +1 -1
  178. package/dist/types/projects/fetch.d.ts +14 -0
  179. package/dist/types/search/_internal/getEntityTypeFromType.d.ts +9 -0
  180. package/dist/types/search/_internal/negateGroupPredicates.d.ts +9 -0
  181. package/dist/types/search/utils.d.ts +8 -0
  182. package/dist/types/users/HubUsers.d.ts +1 -1
  183. package/package.json +1 -1
@@ -76,43 +76,6 @@ export declare const setContentBoundary: (content: IHubContent, boundary: Geogra
76
76
  viewDefinition?: {
77
77
  definitionExpression?: string;
78
78
  };
79
- source?: string;
80
- summary?: string;
81
- view?: import("../../core").IWithViewSettings;
82
- owner: string;
83
- url?: string;
84
- id: string;
85
- canEdit: boolean;
86
- access?: import("../../core").AccessLevel;
87
- culture?: string;
88
- description?: string;
89
- extent?: number[][];
90
- itemControl: string;
91
- tags: string[];
92
- thumbnailUrl?: string;
93
- thumbnail?: string;
94
- typeKeywords?: string[];
95
- canDelete: boolean;
96
- location?: import("../../core").IHubLocation;
97
- orgId?: string;
98
- protected?: boolean;
99
- name: string;
100
- createdDate: Date;
101
- createdDateSource: string;
102
- updatedDate: Date;
103
- updatedDateSource: string;
104
- type: string;
105
- links?: {
106
- [key: string]: string | import("../../core").ILink;
107
- thumbnail?: string;
108
- self: string;
109
- siteRelative?: string;
110
- workspaceRelative?: string;
111
- layoutRelative?: string;
112
- };
113
- features?: import("../..").IFeatureFlags;
114
- isDiscussable?: boolean;
115
- followersGroupId?: string;
116
79
  statistics?: any;
117
80
  data?: {
118
81
  [propName: string]: any;
@@ -126,15 +89,25 @@ export declare const setContentBoundary: (content: IHubContent, boundary: Geogra
126
89
  layers?: Partial<ILayerDefinition>[];
127
90
  recordCount?: number;
128
91
  servicesDirectoryDisabled?: boolean;
92
+ id: string;
93
+ owner: string;
94
+ tags: string[];
129
95
  created: number;
130
96
  modified: number;
131
97
  numViews: number;
132
98
  size: number;
99
+ protected?: boolean;
133
100
  title: string;
101
+ type: string;
102
+ typeKeywords?: string[];
103
+ description?: string;
134
104
  snippet?: string;
135
105
  documentation?: string;
106
+ extent?: number[][];
136
107
  spatialReference?: ISpatialReference;
108
+ culture?: string;
137
109
  properties?: any;
110
+ url?: string;
138
111
  };
139
112
  /**
140
113
  * get a content's boundary based on the item's boundary property
@@ -1,15 +1,16 @@
1
1
  import { IGroup } from "@esri/arcgis-rest-portal";
2
2
  import { IArcGISContext } from "../ArcGISContext";
3
3
  import { IPermissionAccessResponse, IEntityPermissionPolicy, Permission } from "../permissions";
4
- import { IWithSharingBehavior, IWithStoreBehavior, IWithFeaturedImageBehavior, IWithPermissionBehavior } from "./behaviors";
4
+ import { IWithSharingBehavior, IWithStoreBehavior, IWithFeaturedImageBehavior, IWithPermissionBehavior, IWithAssociationBehavior } from "./behaviors";
5
5
  import { IWithThumbnailBehavior } from "./behaviors/IWithThumbnailBehavior";
6
6
  import { IHubItemEntity, SettableAccessLevel } from "./types";
7
7
  import { IWithDiscussionsBehavior } from "./behaviors/IWithDiscussionsBehavior";
8
8
  import { IWithFollowersBehavior } from "./behaviors/IWithFollowersBehavior";
9
+ import { AssociationType, IAssociationInfo } from "../associations/types";
9
10
  /**
10
11
  * Base class for all Hub Entities backed by items
11
12
  */
12
- export declare abstract class HubItemEntity<T extends IHubItemEntity> implements IWithStoreBehavior<T>, IWithSharingBehavior, IWithThumbnailBehavior, IWithFeaturedImageBehavior, IWithPermissionBehavior, IWithDiscussionsBehavior, IWithFollowersBehavior {
13
+ export declare abstract class HubItemEntity<T extends IHubItemEntity> implements IWithStoreBehavior<T>, IWithSharingBehavior, IWithThumbnailBehavior, IWithFeaturedImageBehavior, IWithPermissionBehavior, IWithDiscussionsBehavior, IWithFollowersBehavior, IWithAssociationBehavior {
13
14
  protected context: IArcGISContext;
14
15
  protected entity: T;
15
16
  protected isDestroyed: boolean;
@@ -141,4 +142,23 @@ export declare abstract class HubItemEntity<T extends IHubItemEntity> implements
141
142
  * @param isDiscussable whether to enable or disable discussions
142
143
  */
143
144
  updateIsDiscussable(isDiscussable: boolean): void;
145
+ /**
146
+ * Return a list of IAssociationInfo objects representing
147
+ * the associations this entity has, to the specified type
148
+ * @param type
149
+ * @returns
150
+ */
151
+ listAssociations(type: AssociationType): IAssociationInfo[];
152
+ /**
153
+ * Add an association to this entity
154
+ * @param info
155
+ * @returns
156
+ */
157
+ addAssociation(info: IAssociationInfo): void;
158
+ /**
159
+ * Remove an association from this entity
160
+ * @param info
161
+ * @returns
162
+ */
163
+ removeAssociation(info: IAssociationInfo): void;
144
164
  }
@@ -0,0 +1,23 @@
1
+ import { AssociationType, IAssociationInfo } from "../../associations/types";
2
+ /**
3
+ * Composable behavior that adds permissions to an entity
4
+ */
5
+ export interface IWithAssociationBehavior {
6
+ /**
7
+ * Get a list of the associations for an AssociationType
8
+ * @param type
9
+ */
10
+ listAssociations(type: AssociationType): IAssociationInfo[];
11
+ /**
12
+ * Add an association to the entity.
13
+ * Entity needs to be saved after calling this method
14
+ * @param info
15
+ */
16
+ addAssociation(info: IAssociationInfo): void;
17
+ /**
18
+ * Remove an association to the entity.
19
+ * Entity needs to be saved after calling this method
20
+ * @param info
21
+ */
22
+ removeAssociation(info: IAssociationInfo): void;
23
+ }
@@ -6,3 +6,4 @@ export * from "./IWithEditorBehavior";
6
6
  export * from "./IWithFeaturedImageBehavior";
7
7
  export * from "./IWithVersioningBehavior";
8
8
  export * from "./IWithCardBehavior";
9
+ export * from "./IWIthAssociationBehavior";
@@ -14,4 +14,3 @@ import { IHubLocationOption } from "../../types/IHubLocation";
14
14
  * location
15
15
  */
16
16
  export declare function getLocationOptions(entity: ConfigurableEntity, portalName: string, hubRequestOptions: IHubRequestOptions): Promise<IHubLocationOption[]>;
17
- export declare function getDefaultLocationOptions(entity: ConfigurableEntity, portalName: string, hubRequestOptions: IHubRequestOptions): Promise<IHubLocationOption[]>;
@@ -0,0 +1,4 @@
1
+ export interface IWithAssociations {
2
+ typeKeywords?: string[];
3
+ [key: string]: any;
4
+ }
@@ -1,3 +1,4 @@
1
+ export * from "./IWithAssociations";
1
2
  export * from "./IWithBannerImage";
2
3
  export * from "./IWithLayout";
3
4
  export * from "./IWithSlug";
@@ -4,10 +4,11 @@ import { AccessLevel } from "./types";
4
4
  import { IWithPermissions, IWithViewSettings, IWithDiscussions } from "../traits";
5
5
  import { IHubLocation } from "./IHubLocation";
6
6
  import { IWithFollowers } from "../traits/IWithFollowers";
7
+ import { IWithAssociations } from "../traits/IWithAssociations";
7
8
  /**
8
9
  * Properties exposed by Entities that are backed by Items
9
10
  */
10
- export interface IHubItemEntity extends IHubEntityBase, IWithPermissions, IWithDiscussions, IWithFollowers {
11
+ export interface IHubItemEntity extends IHubEntityBase, IWithPermissions, IWithDiscussions, IWithFollowers, IWithAssociations {
11
12
  /**
12
13
  * Access level of the item ("private" | "org" | "public")
13
14
  */
@@ -735,6 +735,7 @@ export interface ICreateChannelPermissions {
735
735
  export interface IUpdateChannelPermissions {
736
736
  access?: SharingAccess;
737
737
  allowAnonymous?: boolean;
738
+ groups?: string[];
738
739
  }
739
740
  /**
740
741
  * permissions and settings options for creating a channel
@@ -24,7 +24,7 @@ export declare const GLOBAL_EXTENT: IExtent;
24
24
  * Gets the geographic extent for an org
25
25
  * @param hubRequestOptions
26
26
  */
27
- export declare function getGeographicOrgExtent(hubRequestOptions: IHubRequestOptions): Promise<IExtent>;
27
+ export declare function orgExtent(hubRequestOptions: IHubRequestOptions): Promise<IExtent>;
28
28
  /**
29
29
  * Get the default org extent as a bbox for use on item.extent
30
30
  * @param {IHubRequestOptions} hubRequestOptions
@@ -1,9 +1,9 @@
1
1
  import { IGroup } from "@esri/arcgis-rest-types";
2
- import { IHubSearchResult } from "../search";
3
2
  import { IHubRequestOptions } from "../types";
4
3
  import { IRequestOptions } from "@esri/arcgis-rest-request";
5
4
  import { IHubGroup } from "../core/types/IHubGroup";
6
5
  import { IUserRequestOptions } from "@esri/arcgis-rest-auth";
6
+ import { IHubSearchResult } from "../search/types/IHubSearchResult";
7
7
  /**
8
8
  * Enrich a generic search result
9
9
  * @param group
@@ -1,3 +1,4 @@
1
+ export * from "./associations";
1
2
  export * from "./access";
2
3
  export * from "./api";
3
4
  export * from "./ArcGISContext";
@@ -1,5 +1,5 @@
1
1
  import { IEntityEditorContext } from "../core/types/HubEntityEditor";
2
- import { Catalog } from "../search";
2
+ import { Catalog } from "../search/Catalog";
3
3
  import { IArcGISContext } from "../ArcGISContext";
4
4
  import { HubItemEntity } from "../core/HubItemEntity";
5
5
  import { InitiativeEditorType } from "./_internal/InitiativeSchema";
@@ -1,8 +1,9 @@
1
1
  import { IUserRequestOptions } from "@esri/arcgis-rest-auth";
2
2
  import { IHubRequestOptions } from "../index";
3
+ import { IQuery } from "../search/types/IHubCatalog";
3
4
  import { IItem } from "@esri/arcgis-rest-portal";
4
5
  import { IRequestOptions } from "@esri/arcgis-rest-request";
5
- import { IHubInitiative } from "../core/types";
6
+ import { IEntityInfo, IHubInitiative } from "../core/types";
6
7
  import { IHubSearchResult } from "../search";
7
8
  /**
8
9
  * @private
@@ -53,3 +54,41 @@ export declare function convertItemToInitiative(item: IItem, requestOptions: IRe
53
54
  * @returns
54
55
  */
55
56
  export declare function enrichInitiativeSearchResult(item: IItem, include: string[], requestOptions: IHubRequestOptions): Promise<IHubSearchResult>;
57
+ /**
58
+ * Fetch the Projects that are "Accepted" with an Initiative.
59
+ * This is a subset of the "Associated" projects, limited
60
+ * to those included in the Initiative's Catalog.
61
+ * @param initiative
62
+ * @param requestOptions
63
+ * @param query: Optional `IQuery` to further filter the results
64
+ * @returns
65
+ */
66
+ export declare function fetchAcceptedProjects(initiative: IHubInitiative, requestOptions: IHubRequestOptions, query?: IQuery): Promise<IEntityInfo[]>;
67
+ /**
68
+ * Fetch the Projects that are "Associated" to the Initiative but are not
69
+ * "Accepted", meaning they have the keyword but are not included in the Initiative's Catalog.
70
+ * This is how we can get the list of Projects awaiting Acceptance
71
+ * @param initiative
72
+ * @param requestOptions
73
+ * @param query
74
+ * @returns
75
+ */
76
+ export declare function fetchPendingProjects(initiative: IHubInitiative, requestOptions: IHubRequestOptions, query?: IQuery): Promise<IEntityInfo[]>;
77
+ /**
78
+ * Associated projects are those with the Initiative id in the typekeywords
79
+ * and is included in the Initiative's catalog.
80
+ * This is passed into the Gallery showing "Approved Projects"
81
+ * @param initiative
82
+ * @returns
83
+ */
84
+ export declare function getAcceptedProjectsQuery(initiative: IHubInitiative): IQuery;
85
+ /**
86
+ * Related Projects are those that have the Initiative id in the
87
+ * typekeywords but NOT in the catalog. We use this query to show
88
+ * Projects which want to be associated but are not yet included in
89
+ * the catalog
90
+ * This is passed into the Gallery showing "Pending Projects"
91
+ * @param initiative
92
+ * @returns
93
+ */
94
+ export declare function getPendingProjectsQuery(initiative: IHubInitiative): IQuery;
@@ -1,8 +1,20 @@
1
- declare const validPermissions: readonly string[];
1
+ import { ProjectPermissions } from "../../projects/_internal/ProjectBusinessRules";
2
+ import { SitePermissions } from "../../sites/_internal/SiteBusinessRules";
3
+ import { InitiativePermissions } from "../../initiatives/_internal/InitiativeBusinessRules";
4
+ import { ContentPermissions } from "../../content/_internal/ContentBusinessRules";
5
+ import { GroupPermissions } from "../../groups/_internal/GroupBusinessRules";
6
+ import { PagePermissions } from "../../pages/_internal/PageBusinessRules";
7
+ import { PlatformPermissions } from "../PlatformPermissionPolicies";
8
+ /**
9
+ * Defines the values for Permissions
10
+ * It's critical that the arrays defined in the modules use `as const`
11
+ * otherwise Permission devolves into just a string type
12
+ */
13
+ declare const TempPermissions: string[];
2
14
  /**
3
15
  * Defines the possible values for Permissions
4
16
  */
5
- export declare type Permission = (typeof validPermissions)[number];
17
+ export declare type Permission = (typeof SitePermissions)[number] | (typeof ProjectPermissions)[number] | (typeof InitiativePermissions)[number] | (typeof ContentPermissions)[number] | (typeof GroupPermissions)[number] | (typeof PagePermissions)[number] | (typeof PlatformPermissions)[number] | (typeof TempPermissions)[number];
6
18
  /**
7
19
  * Validate a Permission
8
20
  * @param permission
@@ -1,5 +1,5 @@
1
1
  import { IHubProject, IWithCatalogBehavior, IWithStoreBehavior, IWithSharingBehavior, IResolvedMetric, IWithCardBehavior, IHubProjectEditor, IEntityEditorContext } from "../core";
2
- import { Catalog } from "../search";
2
+ import { Catalog } from "../search/Catalog";
3
3
  import { IArcGISContext } from "../ArcGISContext";
4
4
  import { HubItemEntity } from "../core/HubItemEntity";
5
5
  import { IEditorConfig, IWithEditorBehavior } from "../core/behaviors/IWithEditorBehavior";
@@ -2,6 +2,7 @@ import { IRequestOptions } from "@esri/arcgis-rest-request";
2
2
  import { IItem } from "@esri/arcgis-rest-portal";
3
3
  import { IHubProject } from "../core/types";
4
4
  import { IHubSearchResult } from "../search";
5
+ import { IQuery } from "../search/types/IHubCatalog";
5
6
  import { IHubRequestOptions } from "../types";
6
7
  /**
7
8
  * @private
@@ -28,3 +29,16 @@ export declare function convertItemToProject(item: IItem, requestOptions: IReque
28
29
  * @returns
29
30
  */
30
31
  export declare function enrichProjectSearchResult(item: IItem, include: string[], requestOptions: IHubRequestOptions): Promise<IHubSearchResult>;
32
+ /**
33
+ * Get a query that will fetch all the initiatives which the project has
34
+ * chosen to connect to. If project has not defined any associations
35
+ * to any Initiatives, will return `null`.
36
+ * Currently, we have not implemented a means to get the list of initiatives that have
37
+ * "Accepted" the Project via inclusion in it's catalog.
38
+ *
39
+ * If needed, this could be done by getting all the groups the project is shared into
40
+ * then cross-walking that into the catalogs of all the Associated Initiatives
41
+ * @param project
42
+ * @returns
43
+ */
44
+ export declare function getAssociatedInitiativesQuery(project: IHubProject): IQuery;
@@ -0,0 +1,9 @@
1
+ import { EntityType } from "../types";
2
+ /**
3
+ * @private
4
+ * Given a type (e.g. Hub Site Application) return the appropriate entity type
5
+ * that can be used as a `targetEntity` in an `IQuery`
6
+ * @param type
7
+ * @returns
8
+ */
9
+ export declare function getEntityTypeFromType(type: string): EntityType;
@@ -0,0 +1,9 @@
1
+ import { IQuery } from "../types/IHubCatalog";
2
+ /**
3
+ * @private
4
+ * Helper function that locates group predicates and "negates" them
5
+ * so we get a query that is `not in groups ...` vs `in groups ...`
6
+ * @param query
7
+ * @returns
8
+ */
9
+ export declare function negateGroupPredicates(query: IQuery): IQuery;
@@ -85,6 +85,7 @@ export declare function getUserThumbnailUrl(portalUrl: string, user: IUser, toke
85
85
  */
86
86
  export declare function migrateToCollectionKey(collectionOrSearchCategory: LegacySearchCategory | WellKnownCollection): WellKnownCollection;
87
87
  /**
88
+ * DEPRECATED: Please use `getGroupPredicate`
88
89
  * Searches through a catalog scope and retrieves the predicate responsible
89
90
  * for determining group sharing requirements.
90
91
  *
@@ -92,6 +93,13 @@ export declare function migrateToCollectionKey(collectionOrSearchCategory: Legac
92
93
  * @returns The first predicate with a `group` field (if present)
93
94
  */
94
95
  export declare function getScopeGroupPredicate(scope: IQuery): IPredicate;
96
+ /**
97
+ * Searches through an `IQuery` and retrieves the predicate with a `group` definition.
98
+ * If there is no group predicate, returns `null`
99
+ * @param query IQuery to search
100
+ * @returns
101
+ */
102
+ export declare function getGroupPredicate(query: IQuery): IPredicate;
95
103
  /**
96
104
  * Determines the canonical siteRelative link for a search result.
97
105
  *
@@ -1,6 +1,6 @@
1
1
  import { IUser } from "@esri/arcgis-rest-types";
2
- import { IHubSearchResult } from "../search";
3
2
  import { IHubRequestOptions } from "../types";
3
+ import { IHubSearchResult } from "../search/types/IHubSearchResult";
4
4
  /**
5
5
  * Enrich a User object
6
6
  * @param user
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/hub-common",
3
- "version": "14.15.0",
3
+ "version": "14.17.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",