@esri/hub-common 14.74.2 → 14.75.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 (209) hide show
  1. package/dist/esm/associations/addAssociation.js +3 -0
  2. package/dist/esm/associations/addAssociation.js.map +1 -1
  3. package/dist/esm/associations/breakAssociation.js +54 -0
  4. package/dist/esm/associations/breakAssociation.js.map +1 -0
  5. package/dist/esm/associations/getAssociatedEntitiesQuery.js +33 -0
  6. package/dist/esm/associations/getAssociatedEntitiesQuery.js.map +1 -0
  7. package/dist/esm/associations/getAssociationStats.js +49 -0
  8. package/dist/esm/associations/getAssociationStats.js.map +1 -0
  9. package/dist/esm/associations/getAvailableToRequestEntitiesQuery.js +65 -0
  10. package/dist/esm/associations/getAvailableToRequestEntitiesQuery.js.map +1 -0
  11. package/dist/esm/associations/getPendingEntitiesQuery.js +41 -0
  12. package/dist/esm/associations/getPendingEntitiesQuery.js.map +1 -0
  13. package/dist/esm/associations/getRequestingEntitiesQuery.js +41 -0
  14. package/dist/esm/associations/getRequestingEntitiesQuery.js.map +1 -0
  15. package/dist/esm/associations/getWellKnownAssociationsCatalog.js +72 -0
  16. package/dist/esm/associations/getWellKnownAssociationsCatalog.js.map +1 -0
  17. package/dist/esm/associations/index.js +12 -0
  18. package/dist/esm/associations/index.js.map +1 -1
  19. package/dist/esm/associations/internal/getAssociationHierarchy.js +33 -0
  20. package/dist/esm/associations/internal/getAssociationHierarchy.js.map +1 -0
  21. package/dist/esm/associations/internal/getIdsFromAssociationGroups.js +25 -0
  22. package/dist/esm/associations/internal/getIdsFromAssociationGroups.js.map +1 -0
  23. package/dist/esm/associations/internal/getIdsFromKeywords.js +22 -0
  24. package/dist/esm/associations/internal/getIdsFromKeywords.js.map +1 -0
  25. package/dist/esm/associations/internal/getIncludesAndReferencesQuery.js +58 -0
  26. package/dist/esm/associations/internal/getIncludesAndReferencesQuery.js.map +1 -0
  27. package/dist/esm/associations/internal/getIncludesDoesNotReferenceQuery.js +58 -0
  28. package/dist/esm/associations/internal/getIncludesDoesNotReferenceQuery.js.map +1 -0
  29. package/dist/esm/associations/internal/getReferencesDoesNotIncludeQuery.js +62 -0
  30. package/dist/esm/associations/internal/getReferencesDoesNotIncludeQuery.js.map +1 -0
  31. package/dist/esm/associations/internal/getTypeByIdsQuery.js +13 -15
  32. package/dist/esm/associations/internal/getTypeByIdsQuery.js.map +1 -1
  33. package/dist/esm/associations/internal/getTypeByNotIdsQuery.js +26 -0
  34. package/dist/esm/associations/internal/getTypeByNotIdsQuery.js.map +1 -0
  35. package/dist/esm/associations/internal/getTypeWithKeywordQuery.js +11 -6
  36. package/dist/esm/associations/internal/getTypeWithKeywordQuery.js.map +1 -1
  37. package/dist/esm/associations/internal/getTypeWithoutKeywordQuery.js +10 -5
  38. package/dist/esm/associations/internal/getTypeWithoutKeywordQuery.js.map +1 -1
  39. package/dist/esm/associations/internal/isAssociationSupported.js +29 -0
  40. package/dist/esm/associations/internal/isAssociationSupported.js.map +1 -0
  41. package/dist/esm/associations/internal/removeAssociationKeyword.js +16 -0
  42. package/dist/esm/associations/internal/removeAssociationKeyword.js.map +1 -0
  43. package/dist/esm/associations/internal/setAssociationKeyword.js +18 -0
  44. package/dist/esm/associations/internal/setAssociationKeyword.js.map +1 -0
  45. package/dist/esm/associations/listAssociations.js +4 -0
  46. package/dist/esm/associations/listAssociations.js.map +1 -1
  47. package/dist/esm/associations/removeAssociation.js +3 -0
  48. package/dist/esm/associations/removeAssociation.js.map +1 -1
  49. package/dist/esm/associations/requestAssociation.js +57 -0
  50. package/dist/esm/associations/requestAssociation.js.map +1 -0
  51. package/dist/esm/associations/types.js +0 -1
  52. package/dist/esm/associations/types.js.map +1 -1
  53. package/dist/esm/core/HubItemEntity.js +9 -0
  54. package/dist/esm/core/HubItemEntity.js.map +1 -1
  55. package/dist/esm/core/_internal/getBasePropertyMap.js +1 -1
  56. package/dist/esm/core/_internal/getBasePropertyMap.js.map +1 -1
  57. package/dist/esm/core/getTypesFromEntityType.js +39 -0
  58. package/dist/esm/core/getTypesFromEntityType.js.map +1 -0
  59. package/dist/esm/core/index.js +1 -0
  60. package/dist/esm/core/index.js.map +1 -1
  61. package/dist/esm/core/processActionLinks.js +1 -1
  62. package/dist/esm/core/processActionLinks.js.map +1 -1
  63. package/dist/esm/core/updateHubEntity.js +4 -0
  64. package/dist/esm/core/updateHubEntity.js.map +1 -1
  65. package/dist/esm/initiatives/HubInitiatives.js +15 -42
  66. package/dist/esm/initiatives/HubInitiatives.js.map +1 -1
  67. package/dist/esm/initiatives/_internal/InitiativeAssociationHierarchies.js +5 -0
  68. package/dist/esm/initiatives/_internal/InitiativeAssociationHierarchies.js.map +1 -0
  69. package/dist/esm/initiatives/_internal/InitiativeBusinessRules.js +29 -0
  70. package/dist/esm/initiatives/_internal/InitiativeBusinessRules.js.map +1 -1
  71. package/dist/esm/projects/_internal/ProjectAssociationHierarchies.js +5 -0
  72. package/dist/esm/projects/_internal/ProjectAssociationHierarchies.js.map +1 -0
  73. package/dist/esm/projects/_internal/ProjectBusinessRules.js +6 -0
  74. package/dist/esm/projects/_internal/ProjectBusinessRules.js.map +1 -1
  75. package/dist/esm/projects/fetch.js +3 -0
  76. package/dist/esm/projects/fetch.js.map +1 -1
  77. package/dist/esm/search/_internal/buildCatalog.js +25 -0
  78. package/dist/esm/search/_internal/buildCatalog.js.map +1 -0
  79. package/dist/esm/search/wellKnownCatalog.js +29 -43
  80. package/dist/esm/search/wellKnownCatalog.js.map +1 -1
  81. package/dist/node/associations/addAssociation.js +3 -0
  82. package/dist/node/associations/addAssociation.js.map +1 -1
  83. package/dist/node/associations/breakAssociation.js +57 -0
  84. package/dist/node/associations/breakAssociation.js.map +1 -0
  85. package/dist/node/associations/getAssociatedEntitiesQuery.js +36 -0
  86. package/dist/node/associations/getAssociatedEntitiesQuery.js.map +1 -0
  87. package/dist/node/associations/getAssociationStats.js +52 -0
  88. package/dist/node/associations/getAssociationStats.js.map +1 -0
  89. package/dist/node/associations/getAvailableToRequestEntitiesQuery.js +68 -0
  90. package/dist/node/associations/getAvailableToRequestEntitiesQuery.js.map +1 -0
  91. package/dist/node/associations/getPendingEntitiesQuery.js +44 -0
  92. package/dist/node/associations/getPendingEntitiesQuery.js.map +1 -0
  93. package/dist/node/associations/getRequestingEntitiesQuery.js +44 -0
  94. package/dist/node/associations/getRequestingEntitiesQuery.js.map +1 -0
  95. package/dist/node/associations/getWellKnownAssociationsCatalog.js +76 -0
  96. package/dist/node/associations/getWellKnownAssociationsCatalog.js.map +1 -0
  97. package/dist/node/associations/index.js +14 -0
  98. package/dist/node/associations/index.js.map +1 -1
  99. package/dist/node/associations/internal/getAssociationHierarchy.js +36 -0
  100. package/dist/node/associations/internal/getAssociationHierarchy.js.map +1 -0
  101. package/dist/node/associations/internal/getIdsFromAssociationGroups.js +28 -0
  102. package/dist/node/associations/internal/getIdsFromAssociationGroups.js.map +1 -0
  103. package/dist/node/associations/internal/getIdsFromKeywords.js +25 -0
  104. package/dist/node/associations/internal/getIdsFromKeywords.js.map +1 -0
  105. package/dist/node/associations/internal/getIncludesAndReferencesQuery.js +61 -0
  106. package/dist/node/associations/internal/getIncludesAndReferencesQuery.js.map +1 -0
  107. package/dist/node/associations/internal/getIncludesDoesNotReferenceQuery.js +61 -0
  108. package/dist/node/associations/internal/getIncludesDoesNotReferenceQuery.js.map +1 -0
  109. package/dist/node/associations/internal/getReferencesDoesNotIncludeQuery.js +65 -0
  110. package/dist/node/associations/internal/getReferencesDoesNotIncludeQuery.js.map +1 -0
  111. package/dist/node/associations/internal/getTypeByIdsQuery.js +13 -15
  112. package/dist/node/associations/internal/getTypeByIdsQuery.js.map +1 -1
  113. package/dist/node/associations/internal/getTypeByNotIdsQuery.js +30 -0
  114. package/dist/node/associations/internal/getTypeByNotIdsQuery.js.map +1 -0
  115. package/dist/node/associations/internal/getTypeWithKeywordQuery.js +11 -6
  116. package/dist/node/associations/internal/getTypeWithKeywordQuery.js.map +1 -1
  117. package/dist/node/associations/internal/getTypeWithoutKeywordQuery.js +10 -5
  118. package/dist/node/associations/internal/getTypeWithoutKeywordQuery.js.map +1 -1
  119. package/dist/node/associations/internal/isAssociationSupported.js +32 -0
  120. package/dist/node/associations/internal/isAssociationSupported.js.map +1 -0
  121. package/dist/node/associations/internal/removeAssociationKeyword.js +20 -0
  122. package/dist/node/associations/internal/removeAssociationKeyword.js.map +1 -0
  123. package/dist/node/associations/internal/setAssociationKeyword.js +22 -0
  124. package/dist/node/associations/internal/setAssociationKeyword.js.map +1 -0
  125. package/dist/node/associations/listAssociations.js +4 -0
  126. package/dist/node/associations/listAssociations.js.map +1 -1
  127. package/dist/node/associations/removeAssociation.js +3 -0
  128. package/dist/node/associations/removeAssociation.js.map +1 -1
  129. package/dist/node/associations/requestAssociation.js +60 -0
  130. package/dist/node/associations/requestAssociation.js.map +1 -0
  131. package/dist/node/associations/types.js +0 -1
  132. package/dist/node/associations/types.js.map +1 -1
  133. package/dist/node/core/HubItemEntity.js +9 -0
  134. package/dist/node/core/HubItemEntity.js.map +1 -1
  135. package/dist/node/core/_internal/getBasePropertyMap.js +1 -1
  136. package/dist/node/core/_internal/getBasePropertyMap.js.map +1 -1
  137. package/dist/node/core/getTypesFromEntityType.js +42 -0
  138. package/dist/node/core/getTypesFromEntityType.js.map +1 -0
  139. package/dist/node/core/index.js +1 -0
  140. package/dist/node/core/index.js.map +1 -1
  141. package/dist/node/core/processActionLinks.js +2 -2
  142. package/dist/node/core/processActionLinks.js.map +1 -1
  143. package/dist/node/core/updateHubEntity.js +4 -0
  144. package/dist/node/core/updateHubEntity.js.map +1 -1
  145. package/dist/node/initiatives/HubInitiatives.js +15 -42
  146. package/dist/node/initiatives/HubInitiatives.js.map +1 -1
  147. package/dist/node/initiatives/_internal/InitiativeAssociationHierarchies.js +8 -0
  148. package/dist/node/initiatives/_internal/InitiativeAssociationHierarchies.js.map +1 -0
  149. package/dist/node/initiatives/_internal/InitiativeBusinessRules.js +29 -0
  150. package/dist/node/initiatives/_internal/InitiativeBusinessRules.js.map +1 -1
  151. package/dist/node/projects/_internal/ProjectAssociationHierarchies.js +8 -0
  152. package/dist/node/projects/_internal/ProjectAssociationHierarchies.js.map +1 -0
  153. package/dist/node/projects/_internal/ProjectBusinessRules.js +6 -0
  154. package/dist/node/projects/_internal/ProjectBusinessRules.js.map +1 -1
  155. package/dist/node/projects/fetch.js +3 -0
  156. package/dist/node/projects/fetch.js.map +1 -1
  157. package/dist/node/search/_internal/buildCatalog.js +29 -0
  158. package/dist/node/search/_internal/buildCatalog.js.map +1 -0
  159. package/dist/node/search/wellKnownCatalog.js +29 -43
  160. package/dist/node/search/wellKnownCatalog.js.map +1 -1
  161. package/dist/types/associations/addAssociation.d.ts +3 -0
  162. package/dist/types/associations/breakAssociation.d.ts +20 -0
  163. package/dist/types/associations/getAssociatedEntitiesQuery.d.ts +21 -0
  164. package/dist/types/associations/getAssociationStats.d.ts +13 -0
  165. package/dist/types/associations/getAvailableToRequestEntitiesQuery.d.ts +21 -0
  166. package/dist/types/associations/getPendingEntitiesQuery.d.ts +26 -0
  167. package/dist/types/associations/getRequestingEntitiesQuery.d.ts +26 -0
  168. package/dist/types/associations/getWellKnownAssociationsCatalog.d.ts +34 -0
  169. package/dist/types/associations/index.d.ts +9 -0
  170. package/dist/types/associations/internal/getAssociationHierarchy.d.ts +15 -0
  171. package/dist/types/associations/internal/getIdsFromAssociationGroups.d.ts +15 -0
  172. package/dist/types/associations/internal/getIdsFromKeywords.d.ts +13 -0
  173. package/dist/types/associations/internal/getIncludesAndReferencesQuery.d.ts +14 -0
  174. package/dist/types/associations/internal/getIncludesDoesNotReferenceQuery.d.ts +14 -0
  175. package/dist/types/associations/internal/getReferencesDoesNotIncludeQuery.d.ts +14 -0
  176. package/dist/types/associations/internal/getTypeByIdsQuery.d.ts +8 -6
  177. package/dist/types/associations/internal/getTypeByNotIdsQuery.d.ts +12 -0
  178. package/dist/types/associations/internal/getTypeWithKeywordQuery.d.ts +8 -5
  179. package/dist/types/associations/internal/getTypeWithoutKeywordQuery.d.ts +8 -5
  180. package/dist/types/associations/internal/isAssociationSupported.d.ts +11 -0
  181. package/dist/types/associations/internal/removeAssociationKeyword.d.ts +12 -0
  182. package/dist/types/associations/internal/setAssociationKeyword.d.ts +12 -0
  183. package/dist/types/associations/listAssociations.d.ts +4 -0
  184. package/dist/types/associations/removeAssociation.d.ts +3 -0
  185. package/dist/types/associations/requestAssociation.d.ts +23 -0
  186. package/dist/types/associations/types.d.ts +53 -0
  187. package/dist/types/core/HubItemEntity.d.ts +9 -0
  188. package/dist/types/core/behaviors/IWIthAssociationBehavior.d.ts +9 -0
  189. package/dist/types/core/getTypesFromEntityType.d.ts +10 -0
  190. package/dist/types/core/index.d.ts +1 -0
  191. package/dist/types/core/traits/IWithAssociations.d.ts +13 -0
  192. package/dist/types/initiatives/HubInitiatives.d.ts +12 -0
  193. package/dist/types/initiatives/_internal/InitiativeAssociationHierarchies.d.ts +2 -0
  194. package/dist/types/initiatives/_internal/InitiativeBusinessRules.d.ts +1 -1
  195. package/dist/types/projects/_internal/ProjectAssociationHierarchies.d.ts +2 -0
  196. package/dist/types/projects/_internal/ProjectBusinessRules.d.ts +1 -1
  197. package/dist/types/projects/fetch.d.ts +3 -0
  198. package/dist/types/search/_internal/buildCatalog.d.ts +12 -0
  199. package/package.json +1 -1
  200. package/dist/esm/associations/internal/getTargetEntityFromAssociationType.js +0 -18
  201. package/dist/esm/associations/internal/getTargetEntityFromAssociationType.js.map +0 -1
  202. package/dist/esm/associations/internal/getTypeFromAssociationType.js +0 -18
  203. package/dist/esm/associations/internal/getTypeFromAssociationType.js.map +0 -1
  204. package/dist/node/associations/internal/getTargetEntityFromAssociationType.js +0 -22
  205. package/dist/node/associations/internal/getTargetEntityFromAssociationType.js.map +0 -1
  206. package/dist/node/associations/internal/getTypeFromAssociationType.js +0 -22
  207. package/dist/node/associations/internal/getTypeFromAssociationType.js.map +0 -1
  208. package/dist/types/associations/internal/getTargetEntityFromAssociationType.d.ts +0 -8
  209. package/dist/types/associations/internal/getTypeFromAssociationType.d.ts +0 -7
@@ -0,0 +1,26 @@
1
+ import { IQuery } from "../search/types";
2
+ import { HubEntity, HubEntityType } from "../core/types";
3
+ import { IArcGISContext } from "..";
4
+ /**
5
+ * Requesting entities represent "incoming" requests that are
6
+ * awaiting "approval". They imply a one-way "connection"
7
+ * between parent/child.
8
+ *
9
+ * From the parent's perspective:
10
+ * parent: does NOT "include" the child in its association query
11
+ * child: "references" the parent via a typeKeyword of the
12
+ * form ref|<parentType>|<parentID>
13
+ *
14
+ * From the child's perspective:
15
+ * parent: "includes" the child in its association query
16
+ * child: does NOT "reference" the parent via a typeKeyword
17
+ *
18
+ * The following returns a query to view an entity's incoming
19
+ * requests for association with another entity type
20
+ *
21
+ * @param entity - Hub entity
22
+ * @param associationType - entity type to query for
23
+ * @param context - contextual auth and portal information
24
+ * @returns {IQuery}
25
+ */
26
+ export declare const getRequestingEntitiesQuery: (entity: HubEntity, associationType: HubEntityType, context: IArcGISContext) => Promise<IQuery>;
@@ -0,0 +1,34 @@
1
+ import { IArcGISContext } from "../ArcGISContext";
2
+ import { HubEntity, HubEntityType } from "../core/types";
3
+ import { IHubCatalog } from "../search/types";
4
+ /**
5
+ * Supported association catalogs that can be requested.
6
+ * These correspond to a specific IHubCatalog definition
7
+ * that gets returned.
8
+ */
9
+ export declare type WellKnownAssociationCatalog = "associated" | "pending" | "requesting" | "availableToRequest";
10
+ /**
11
+ * There are two primary UI workflows when we consider associations:
12
+ * 1. Viewing associations
13
+ * 2. Forming associations
14
+ *
15
+ * Because associations involve a 2-way agreement between parent
16
+ * and child, when viewing associations, there are 3 gallery states
17
+ * that can be viewed: "associated", "pending", and "requesting"
18
+ * entities. Additionally, when forming associations, we need a
19
+ * picker experience filtered to entities that can still be
20
+ * requested for association.
21
+ *
22
+ * These define the "well-known" association catalogs that this
23
+ * util can return. In turn, these can be passed into the catalog
24
+ * and/or gallery-picker components to render the appropriate
25
+ * UI experience.
26
+ *
27
+ * @param i18nScope - translation scope to be interpolated into the catalog
28
+ * @param catalogName - name of the well-known catalog requested
29
+ * @param entity - primary entity the catalog is being built for
30
+ * @param associationType - type of entity the primary entity wants to view associations for
31
+ * @param context - contextual auth and portal information
32
+ * @returns {IHubCatalog}
33
+ */
34
+ export declare function getWellKnownAssociationsCatalog(i18nScope: string, catalogName: WellKnownAssociationCatalog, entity: HubEntity, associationType: HubEntityType, context: IArcGISContext): Promise<IHubCatalog>;
@@ -1,4 +1,13 @@
1
1
  export * from "./addAssociation";
2
+ export * from "./breakAssociation";
2
3
  export * from "./listAssociations";
3
4
  export * from "./removeAssociation";
4
5
  export * from "./types";
6
+ export * from "./getAssociatedEntitiesQuery";
7
+ export * from "./getAssociationStats";
8
+ export * from "./getAvailableToRequestEntitiesQuery";
9
+ export * from "./getPendingEntitiesQuery";
10
+ export * from "./getRequestingEntitiesQuery";
11
+ export * from "./getWellKnownAssociationsCatalog";
12
+ export { requestAssociation } from "./requestAssociation";
13
+ export { requestAssociation as acceptAssociation } from "./requestAssociation";
@@ -0,0 +1,15 @@
1
+ import { HubEntityType } from "../../core/types";
2
+ import { IHubAssociationHierarchy } from "../../associations/types";
3
+ /**
4
+ * associations are hierarchical in nature, e.g.
5
+ * there is always a parent and a child involved
6
+ * in the relationship.
7
+ *
8
+ * given an entity type, this util returns the
9
+ * parent and children entity types that it can
10
+ * associate with
11
+ *
12
+ * @param type - entity type
13
+ * @returns {IHubAssociationHierarchy}
14
+ */
15
+ export declare const getAssociationHierarchy: (type: HubEntityType) => IHubAssociationHierarchy;
@@ -0,0 +1,15 @@
1
+ import { IGroup } from "@esri/arcgis-rest-types";
2
+ import { HubEntityType } from "../../core";
3
+ /**
4
+ * given an array of groups, this util maps over them,
5
+ * and for each, determines if it's an association group
6
+ * by checking if it has a typeKeyword of the form
7
+ * <associationType>|<id>. If so, it extracts and returns
8
+ * the id which corresponds to the parent entity that this
9
+ * association group belongs to
10
+ *
11
+ * @param groups - array of groups
12
+ * @param associationType - entity type to extract ids for
13
+ * @returns {string[]}
14
+ */
15
+ export declare const getIdsFromAssociationGroups: (groups: IGroup[], associationType: HubEntityType) => string[];
@@ -0,0 +1,13 @@
1
+ import { HubEntity, HubEntityType } from "../../core";
2
+ /**
3
+ * given a hub entity, this util maps over its typeKeywords,
4
+ * and for each, determines if it is an association typeKeyword
5
+ * by checking whether it has the form ref|<associationType>|<id>.
6
+ * If so, it extracts and returns the id which correspond to the
7
+ * parent entity that this entity is associated with.
8
+ *
9
+ * @param entity - hub entity to extract ids from
10
+ * @param associationType - entity type to extract ids for
11
+ * @returns {string[]}
12
+ */
13
+ export declare const getIdsFromKeywords: (entity: HubEntity, associationType: HubEntityType) => string[];
@@ -0,0 +1,14 @@
1
+ import { HubEntity, HubEntityType } from "../../core/types";
2
+ import { IQuery } from "../../search/types";
3
+ import { IArcGISContext } from "../../ArcGISContext";
4
+ /**
5
+ * builds a query that will return entities that are
6
+ * "included" AND "referenced"
7
+ *
8
+ * @param entity - Hub entity
9
+ * @param associationType - entity type to query for
10
+ * @param isParent - whether the provided Hub entity is the parent in the association relationship
11
+ * @param context - contextual auth and portal information
12
+ * @returns {IQuery}
13
+ */
14
+ export declare const getIncludesAndReferencesQuery: (entity: HubEntity, associationType: HubEntityType, isParent: boolean, context: IArcGISContext) => Promise<IQuery>;
@@ -0,0 +1,14 @@
1
+ import { HubEntity, HubEntityType } from "../../core/types";
2
+ import { IQuery } from "../../search/types";
3
+ import { IArcGISContext } from "../../ArcGISContext";
4
+ /**
5
+ * builds a query that will return entities that are
6
+ * "included" but NOT "referenced"
7
+ *
8
+ * @param entity - Hub entity
9
+ * @param associationType - entity type to query for
10
+ * @param isParent - whether the provided Hub entity is the parent in the association relationship
11
+ * @param context - contextual auth and portal information
12
+ * @returns {IQuery}
13
+ */
14
+ export declare const getIncludesDoesNotReferenceQuery: (entity: HubEntity, associationType: HubEntityType, isParent: boolean, context: IArcGISContext) => Promise<IQuery>;
@@ -0,0 +1,14 @@
1
+ import { HubEntity, HubEntityType } from "../../core/types";
2
+ import { IQuery } from "../../search/types";
3
+ import { IArcGISContext } from "../../ArcGISContext";
4
+ /**
5
+ * builds a query that will return entities that are
6
+ * "referenced" but NOT "included"
7
+ *
8
+ * @param entity - Hub entity
9
+ * @param associationType - entity type to query for
10
+ * @param isParent - whether the provided Hub entity is the parent in the association relationship
11
+ * @param context - contextual auth and portal information
12
+ * @returns {IQuery}
13
+ */
14
+ export declare const getReferencesDoesNotIncludeQuery: (entity: HubEntity, associationType: HubEntityType, isParent: boolean, context: IArcGISContext) => Promise<IQuery>;
@@ -1,10 +1,12 @@
1
1
  import { IQuery } from "../../search/types/IHubCatalog";
2
2
  /**
3
- * Get a query that can be used in a Gallery, and will return the associated
4
- * entities, based on the AssociationType
3
+ * @private
4
+ * Construct an IQuery to fetch a specified set of item id(s)
5
+ * by type(s). Note: if an array of types is provided, they
6
+ * must be the same underlying target entity type.
5
7
  *
6
- * @param entity
7
- * @param type
8
- * @returns
8
+ * @param itemType - a single item type or an array of item types
9
+ * @param ids - an array of ids
10
+ * @returns {IQuery}
9
11
  */
10
- export declare function getTypeByIdsQuery(itemType: string, ids: string[]): IQuery;
12
+ export declare function getTypeByIdsQuery(itemType: string | string[], ids: string[]): IQuery;
@@ -0,0 +1,12 @@
1
+ import { IQuery } from "../../search/types/IHubCatalog";
2
+ /**
3
+ * @private
4
+ * Construct an IQuery to fetch the inverse of a specified set
5
+ * of item id(s) by type(s). Note: if an array of types is provided,
6
+ * they must be the same underlying target entity type.
7
+ *
8
+ * @param itemType - a single item type or an array of item types
9
+ * @param ids - an array of ids
10
+ * @returns {IQuery}
11
+ */
12
+ export declare function getTypeByNotIdsQuery(itemType: string | string[], ids: string[]): IQuery;
@@ -1,10 +1,13 @@
1
1
  import { IQuery } from "../../search/types/IHubCatalog";
2
2
  /**
3
3
  * @private
4
- * Return an `IQuery` for a specific item type, with a specific typekeyword
5
- * This is used internally to build queries for "Connected" entities
6
- * @param itemType
7
- * @param keyword
4
+ * Construct an IQuery to fetch a set of items by type(s)
5
+ * with a specified typeKeyword. Note: if an array of types
6
+ * is provided, they must be the same underlying target
7
+ * entity type.
8
+ *
9
+ * @param itemType - The type(s) of item to fetch
10
+ * @param keyword - The typeKeyword to filter by
8
11
  * @returns
9
12
  */
10
- export declare function getTypeWithKeywordQuery(itemType: string, keyword: string): IQuery;
13
+ export declare function getTypeWithKeywordQuery(itemType: string | string[], keyword: string): IQuery;
@@ -1,10 +1,13 @@
1
1
  import { IQuery } from "../../search/types/IHubCatalog";
2
2
  /**
3
3
  * @private
4
- * Return an `IQuery` for a specific item type, without a specific typekeyword
5
- * This is used internally to build queries for "Not Connected" entities
6
- * @param itemType
7
- * @param keyword
4
+ * Construct an IQuery to fetch a set of items by type(s)
5
+ * withOUT a specified typeKeyword. Note: if an array of
6
+ * types is provided, they must be the same underlying target
7
+ * entity type.
8
+ *
9
+ * @param itemType - The type(s) of item to fetch
10
+ * @param keyword - The typeKeyword to filter by
8
11
  * @returns
9
12
  */
10
- export declare function getTypeWithoutKeywordQuery(itemType: string, keyword: string): IQuery;
13
+ export declare function getTypeWithoutKeywordQuery(itemType: string | string[], keyword: string): IQuery;
@@ -0,0 +1,11 @@
1
+ import { HubEntityType } from "../../core/types";
2
+ /**
3
+ * given two entity types, this util returns
4
+ * whether or not associations are supported
5
+ * between the two
6
+ *
7
+ * @param type1 - first entity type
8
+ * @param type2 - second entity type
9
+ * @returns {boolean}
10
+ */
11
+ export declare const isAssociationSupported: (type1: HubEntityType, type2: HubEntityType) => boolean;
@@ -0,0 +1,12 @@
1
+ import { HubEntityType } from "../../core/types";
2
+ /**
3
+ * when a child decides it wants to "disconnect" itself from
4
+ * an existing association, the child removes the typeKeyword
5
+ * (ref|<type>|<id>) that "references" the parent
6
+ *
7
+ * @param typeKeywords - the child entity's typeKeywords
8
+ * @param type - the parent entity's type
9
+ * @param id - the parent entity's id
10
+ * @returns {string[]}
11
+ */
12
+ export declare function removeAssociationKeyword(typeKeywords: string[], type: HubEntityType, id: string): string[];
@@ -0,0 +1,12 @@
1
+ import { HubEntityType } from "../../core/types";
2
+ /**
3
+ * when a child sends an "outgoing" request or accepts an
4
+ * "incoming" request for association, the child "references"
5
+ * the parent via a typeKeyword (ref|<type>|<id>)
6
+ *
7
+ * @param typeKeywords - the child entity's typeKeywords
8
+ * @param type - the parent entity's type
9
+ * @param id - the parent entity's id
10
+ * @returns {string[]}
11
+ */
12
+ export declare function setAssociationKeyword(typeKeywords: string[], type: HubEntityType, id: string): string[];
@@ -1,6 +1,10 @@
1
1
  import { IWithAssociations } from "../core/traits/IWithAssociations";
2
2
  import { AssociationType, IAssociationInfo } from "./types";
3
3
  /**
4
+ * ** DEPRECATED: please use getAssociatedEntitiesQuery
5
+ * to get a query for an entity's associations instead.
6
+ * This will be removed in the next breaking version **
7
+ *
4
8
  * Return a list of all associations on an entity for a type
5
9
  * @param entity
6
10
  * @returns
@@ -1,6 +1,9 @@
1
1
  import { IWithAssociations } from "../core/traits/IWithAssociations";
2
2
  import { IAssociationInfo } from "./types";
3
3
  /**
4
+ * ** DEPRECATED: please use breakAssociation instead.
5
+ * This will be removed in the next breaking version **
6
+ *
4
7
  * Remove an association from an entity
5
8
  * @param info
6
9
  * @param entity
@@ -0,0 +1,23 @@
1
+ import { IArcGISContext } from "../ArcGISContext";
2
+ import { HubEntity, HubEntityType } from "../core/types";
3
+ /**
4
+ * When an entity sends an "outgoing" association request
5
+ * or accepts an "incoming" association request, half of
6
+ * the association "connection" is made.
7
+ *
8
+ * from the parent's perspective: the parent "includes"
9
+ * the child in its association group
10
+ *
11
+ * From the child's perspective: the child "references"
12
+ * the parent via a typeKeyword of the form ref|<parentType>|<parentId>
13
+ *
14
+ * Note: we export this function under 2 names - requestAssociation
15
+ * and acceptAssociation. These actions are functionally equivalent,
16
+ * but we want to make the intent more clear to the consumer.
17
+ *
18
+ * @param entity - entity requesting association
19
+ * @param type - type of the entity the requesting entity wants to associate with
20
+ * @param id - id of the entity the requesting entity wants to associate with
21
+ * @param context - contextual portal and auth information
22
+ */
23
+ export declare const requestAssociation: (entity: HubEntity, associationType: HubEntityType, id: string, context: IArcGISContext) => Promise<void>;
@@ -1,4 +1,54 @@
1
+ import { HubEntityType } from "../core";
2
+ import { IQuery } from "../search";
1
3
  /**
4
+ * associations are hierarchical in nature e.g.
5
+ * there is always a parent and a child in the
6
+ * relationship. This interface allows us to
7
+ * define these hierarchies on an entity-by-entity
8
+ * basis
9
+ */
10
+ export interface IHubAssociationHierarchy {
11
+ children: HubEntityType[];
12
+ parents: HubEntityType[];
13
+ }
14
+ /**
15
+ * association rules stored on the parent entity
16
+ * that define what is "included" by the parent
17
+ *
18
+ * For now, the query will define an association
19
+ * group, and "included" simply means it has
20
+ * been shared with the association group. In
21
+ * the future, the query may contain additional
22
+ * conditions
23
+ */
24
+ export interface IHubAssociationRules {
25
+ /** schema version for migration purposes */
26
+ schemaVersion: number;
27
+ /** query that defines what's "included" by a parent */
28
+ query: IQuery;
29
+ }
30
+ /**
31
+ * associations involve a 2-way agreement between
32
+ * parent and child. This interface allows us to
33
+ * keep track of an entity's association stats with
34
+ * another entity
35
+ */
36
+ export interface IAssociationStats {
37
+ /** number of full associations */
38
+ associated: number;
39
+ /** number of outgoing association requests */
40
+ pending: number;
41
+ /** number of incoming association requests */
42
+ requesting: number;
43
+ /** number of entity's the child references = associated + pending */
44
+ referenced?: number;
45
+ /** number of entities included by the parent = associated + pending */
46
+ included?: number;
47
+ }
48
+ /**
49
+ * ** DEPRECATED: This will be removed in the next
50
+ * breaking version **
51
+ *
2
52
  * Definition of an Association
3
53
  * This will be persisted in the item's typekeywords
4
54
  * as `type|id`
@@ -14,6 +64,9 @@ export interface IAssociationInfo {
14
64
  id: string;
15
65
  }
16
66
  /**
67
+ * ** DEPRECATED: This will be removed in the next
68
+ * breaking version **
69
+ *
17
70
  * Association type
18
71
  */
19
72
  export declare type AssociationType = "initiative";
@@ -148,6 +148,9 @@ export declare abstract class HubItemEntity<T extends IHubItemEntity> implements
148
148
  */
149
149
  updateIsDiscussable(isDiscussable: boolean): void;
150
150
  /**
151
+ * ** DEPRECATED: This will be removed in the next
152
+ * breaking version **
153
+ *
151
154
  * Return a list of IAssociationInfo objects representing
152
155
  * the associations this entity has, to the specified type
153
156
  * @param type
@@ -155,12 +158,18 @@ export declare abstract class HubItemEntity<T extends IHubItemEntity> implements
155
158
  */
156
159
  listAssociations(type: AssociationType): IAssociationInfo[];
157
160
  /**
161
+ * ** DEPRECATED: please use requestAssociation instead.
162
+ * This will be removed in the next breaking version **
163
+ *
158
164
  * Add an association to this entity
159
165
  * @param info
160
166
  * @returns
161
167
  */
162
168
  addAssociation(info: IAssociationInfo): void;
163
169
  /**
170
+ * ** DEPRECATED: please use breakAssociation instead.
171
+ * This will be removed in the next breaking version **
172
+ *
164
173
  * Remove an association from this entity
165
174
  * @param info
166
175
  * @returns
@@ -4,17 +4,26 @@ import { AssociationType, IAssociationInfo } from "../../associations/types";
4
4
  */
5
5
  export interface IWithAssociationBehavior {
6
6
  /**
7
+ * ** DEPRECATED: This will be removed in the next
8
+ * breaking version **
9
+ *
7
10
  * Get a list of the associations for an AssociationType
8
11
  * @param type
9
12
  */
10
13
  listAssociations(type: AssociationType): IAssociationInfo[];
11
14
  /**
15
+ * ** DEPRECATED: please use requestAssociation directly.
16
+ * This will be removed in the next breaking version **
17
+ *
12
18
  * Add an association to the entity.
13
19
  * Entity needs to be saved after calling this method
14
20
  * @param info
15
21
  */
16
22
  addAssociation(info: IAssociationInfo): void;
17
23
  /**
24
+ * ** DEPRECATED: please use breakAssociation directly.
25
+ * This will be removed in the next breaking version **
26
+ *
18
27
  * Remove an association to the entity.
19
28
  * Entity needs to be saved after calling this method
20
29
  * @param info
@@ -0,0 +1,10 @@
1
+ import { HubEntityType } from "./types";
2
+ /**
3
+ * return the item type(s) associated with a provided
4
+ * Hub entity type. This is effectively the reverse of
5
+ * getTypeFromEntity
6
+ *
7
+ * @param entityType - the hub entity type
8
+ * @returns {string[]}
9
+ */
10
+ export declare const getTypesFromEntityType: (entityType: HubEntityType) => string[];
@@ -5,6 +5,7 @@ export * from "./schemas";
5
5
  export * from "./fetchHubEntity";
6
6
  export * from "./getEntityDefaultWorkspacePane";
7
7
  export * from "./getTypeFromEntity";
8
+ export * from "./getTypesFromEntityType";
8
9
  export * from "./getRelativeWorkspaceUrl";
9
10
  export * from "./isValidEntityType";
10
11
  export * from "./processActionLinks";
@@ -1,4 +1,17 @@
1
+ import { IHubAssociationRules } from "../../associations";
2
+ /** properties for entities with associations */
1
3
  export interface IWithAssociations {
4
+ associations?: {
5
+ /**
6
+ * association group id - this is exposed as
7
+ * its own property for convenience. It is
8
+ * also included in the association rules
9
+ * query as a group predicate.
10
+ */
11
+ groupId: string;
12
+ /** association rules */
13
+ rules: IHubAssociationRules;
14
+ };
2
15
  typeKeywords?: string[];
3
16
  [key: string]: any;
4
17
  }
@@ -62,6 +62,9 @@ export declare function convertItemToInitiative(item: IItem, requestOptions: IRe
62
62
  */
63
63
  export declare function enrichInitiativeSearchResult(item: IItem, include: string[], requestOptions: IHubRequestOptions): Promise<IHubSearchResult>;
64
64
  /**
65
+ * ** DEPRECATED: Please use the association methods directly.
66
+ * This will be removed in the next breaking version **
67
+ *
65
68
  * Fetch the Projects that are "Accepted" with an Initiative.
66
69
  * This is a subset of the "Associated" projects, limited
67
70
  * to those included in the Initiative's Catalog.
@@ -72,6 +75,9 @@ export declare function enrichInitiativeSearchResult(item: IItem, include: strin
72
75
  */
73
76
  export declare function fetchAcceptedProjects(initiative: IHubInitiative, requestOptions: IHubRequestOptions, query?: IQuery): Promise<IEntityInfo[]>;
74
77
  /**
78
+ * ** DEPRECATED: Please use the association methods directly.
79
+ * This will be removed in the next breaking version **
80
+ *
75
81
  * Fetch the Projects that are "Associated" to the Initiative but are not
76
82
  * "Accepted", meaning they have the keyword but are not included in the Initiative's Catalog.
77
83
  * This is how we can get the list of Projects awaiting Acceptance
@@ -82,6 +88,9 @@ export declare function fetchAcceptedProjects(initiative: IHubInitiative, reques
82
88
  */
83
89
  export declare function fetchPendingProjects(initiative: IHubInitiative, requestOptions: IHubRequestOptions, query?: IQuery): Promise<IEntityInfo[]>;
84
90
  /**
91
+ * ** DEPRECATED: Please use the association methods directly.
92
+ * This will be removed in the next breaking version **
93
+ *
85
94
  * Associated projects are those with the Initiative id in the typekeywords
86
95
  * and is included in the Initiative's catalog.
87
96
  * This is passed into the Gallery showing "Approved Projects"
@@ -90,6 +99,9 @@ export declare function fetchPendingProjects(initiative: IHubInitiative, request
90
99
  */
91
100
  export declare function getAcceptedProjectsQuery(initiative: IHubInitiative): IQuery;
92
101
  /**
102
+ * ** DEPRECATED: Please use the association methods directly.
103
+ * This will be removed in the next breaking version **
104
+ *
93
105
  * Related Projects are those that have the Initiative id in the
94
106
  * typekeywords but NOT in the catalog. We use this query to show
95
107
  * Projects which want to be associated but are not yet included in
@@ -0,0 +1,2 @@
1
+ import { IHubAssociationHierarchy } from "../../associations/types";
2
+ export declare const InitiativeAssociationHierarchies: IHubAssociationHierarchy;
@@ -8,7 +8,7 @@ export declare const InitiativeDefaultFeatures: IFeatureFlags;
8
8
  * These define the requirements any user must meet to perform related actions
9
9
  * @private
10
10
  */
11
- export declare const InitiativePermissions: readonly ["hub:initiative", "hub:initiative:create", "hub:initiative:delete", "hub:initiative:edit", "hub:initiative:view", "hub:initiative:events", "hub:initiative:content", "hub:initiative:discussions", "hub:initiative:workspace", "hub:initiative:workspace:overview", "hub:initiative:workspace:dashboard", "hub:initiative:workspace:details", "hub:initiative:workspace:settings", "hub:initiative:workspace:collaborators", "hub:initiative:workspace:content", "hub:initiative:workspace:metrics", "hub:initiative:manage"];
11
+ export declare const InitiativePermissions: readonly ["hub:initiative", "hub:initiative:create", "hub:initiative:delete", "hub:initiative:edit", "hub:initiative:view", "hub:initiative:events", "hub:initiative:content", "hub:initiative:discussions", "hub:initiative:workspace", "hub:initiative:workspace:overview", "hub:initiative:workspace:dashboard", "hub:initiative:workspace:details", "hub:initiative:workspace:projects", "hub:initiative:workspace:projects:member", "hub:initiative:workspace:projects:manager", "hub:initiative:workspace:settings", "hub:initiative:workspace:collaborators", "hub:initiative:workspace:content", "hub:initiative:workspace:metrics", "hub:initiative:manage"];
12
12
  /**
13
13
  * Initiative permission policies
14
14
  * @private
@@ -0,0 +1,2 @@
1
+ import { IHubAssociationHierarchy } from "../../associations/types";
2
+ export declare const ProjectAssociationHierarchies: IHubAssociationHierarchy;
@@ -8,7 +8,7 @@ export declare const ProjectDefaultFeatures: IFeatureFlags;
8
8
  * These define the requirements any user must meet to perform related actions
9
9
  * @private
10
10
  */
11
- export declare const ProjectPermissions: readonly ["hub:project", "hub:project:create", "hub:project:delete", "hub:project:edit", "hub:project:view", "hub:project:owner", "hub:project:events", "hub:project:content", "hub:project:discussions", "hub:project:workspace", "hub:project:workspace:overview", "hub:project:workspace:dashboard", "hub:project:workspace:details", "hub:project:workspace:settings", "hub:project:workspace:collaborators", "hub:project:workspace:content", "hub:project:workspace:metrics", "hub:project:workspace:metrics-coming-soon", "hub:project:manage"];
11
+ export declare const ProjectPermissions: readonly ["hub:project", "hub:project:create", "hub:project:delete", "hub:project:edit", "hub:project:view", "hub:project:owner", "hub:project:events", "hub:project:content", "hub:project:discussions", "hub:project:workspace", "hub:project:workspace:overview", "hub:project:workspace:dashboard", "hub:project:workspace:details", "hub:project:workspace:initiatives", "hub:project:workspace:settings", "hub:project:workspace:collaborators", "hub:project:workspace:content", "hub:project:workspace:metrics", "hub:project:workspace:metrics-coming-soon", "hub:project:manage"];
12
12
  /**
13
13
  * Project permission policies
14
14
  * @private
@@ -30,6 +30,9 @@ export declare function convertItemToProject(item: IItem, requestOptions: IReque
30
30
  */
31
31
  export declare function enrichProjectSearchResult(item: IItem, include: string[], requestOptions: IHubRequestOptions): Promise<IHubSearchResult>;
32
32
  /**
33
+ * ** DEPRECATED: Please use the association methods directly.
34
+ * This will be removed in the next breaking version **
35
+ *
33
36
  * Get a query that will fetch all the initiatives which the project has
34
37
  * chosen to connect to. If project has not defined any associations
35
38
  * to any Initiatives, will return `null`.
@@ -0,0 +1,12 @@
1
+ import { EntityType, IFilter, IHubCatalog, IHubCollection } from "../types";
2
+ /**
3
+ * Build an IHubCatalog definition JSON object based on a
4
+ * well-known catalog name, scope filters, and collections
5
+ *
6
+ * @param i18nScope - i18n scope for the catalog title
7
+ * @param catalogName - well known catalog name
8
+ * @param filters - filters to build the catalog scope
9
+ * @param collections - collections to include in the catalog
10
+ * @returns {IHubCatalog}
11
+ */
12
+ export declare function buildCatalog(i18nScope: string, catalogName: string, filters: IFilter[], collections: IHubCollection[], targetEntity: EntityType): IHubCatalog;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/hub-common",
3
- "version": "14.74.2",
3
+ "version": "14.75.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,18 +0,0 @@
1
- /**
2
- * Get the entity item type for an association type
3
- * @param type
4
- * @returns
5
- */
6
- export function getTargetEntityFromAssociationType(type) {
7
- let entityType = "item";
8
- switch (type) {
9
- case "initiative":
10
- entityType = "item";
11
- break;
12
- // as we add more association types we need to extend this hash
13
- default:
14
- throw new Error(`getTargetEntityFromAssociationType: Invalid association type ${type}.`);
15
- }
16
- return entityType;
17
- }
18
- //# sourceMappingURL=getTargetEntityFromAssociationType.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getTargetEntityFromAssociationType.js","sourceRoot":"","sources":["../../../../src/associations/internal/getTargetEntityFromAssociationType.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,UAAU,kCAAkC,CAChD,IAAqB;IAErB,IAAI,UAAU,GAAe,MAAM,CAAC;IAEpC,QAAQ,IAAI,EAAE;QACZ,KAAK,YAAY;YACf,UAAU,GAAG,MAAM,CAAC;YACpB,MAAM;QACR,+DAA+D;QAC/D;YACE,MAAM,IAAI,KAAK,CACb,gEAAgE,IAAI,GAAG,CACxE,CAAC;KACL;IACD,OAAO,UAAU,CAAC;AACpB,CAAC"}