@esri/hub-common 14.74.1 → 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 (214) 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 +33 -10
  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/_internal/computeProps.js +4 -2
  76. package/dist/esm/projects/_internal/computeProps.js.map +1 -1
  77. package/dist/esm/projects/fetch.js +3 -0
  78. package/dist/esm/projects/fetch.js.map +1 -1
  79. package/dist/esm/search/_internal/buildCatalog.js +25 -0
  80. package/dist/esm/search/_internal/buildCatalog.js.map +1 -0
  81. package/dist/esm/search/wellKnownCatalog.js +29 -43
  82. package/dist/esm/search/wellKnownCatalog.js.map +1 -1
  83. package/dist/node/associations/addAssociation.js +3 -0
  84. package/dist/node/associations/addAssociation.js.map +1 -1
  85. package/dist/node/associations/breakAssociation.js +57 -0
  86. package/dist/node/associations/breakAssociation.js.map +1 -0
  87. package/dist/node/associations/getAssociatedEntitiesQuery.js +36 -0
  88. package/dist/node/associations/getAssociatedEntitiesQuery.js.map +1 -0
  89. package/dist/node/associations/getAssociationStats.js +52 -0
  90. package/dist/node/associations/getAssociationStats.js.map +1 -0
  91. package/dist/node/associations/getAvailableToRequestEntitiesQuery.js +68 -0
  92. package/dist/node/associations/getAvailableToRequestEntitiesQuery.js.map +1 -0
  93. package/dist/node/associations/getPendingEntitiesQuery.js +44 -0
  94. package/dist/node/associations/getPendingEntitiesQuery.js.map +1 -0
  95. package/dist/node/associations/getRequestingEntitiesQuery.js +44 -0
  96. package/dist/node/associations/getRequestingEntitiesQuery.js.map +1 -0
  97. package/dist/node/associations/getWellKnownAssociationsCatalog.js +76 -0
  98. package/dist/node/associations/getWellKnownAssociationsCatalog.js.map +1 -0
  99. package/dist/node/associations/index.js +14 -0
  100. package/dist/node/associations/index.js.map +1 -1
  101. package/dist/node/associations/internal/getAssociationHierarchy.js +36 -0
  102. package/dist/node/associations/internal/getAssociationHierarchy.js.map +1 -0
  103. package/dist/node/associations/internal/getIdsFromAssociationGroups.js +28 -0
  104. package/dist/node/associations/internal/getIdsFromAssociationGroups.js.map +1 -0
  105. package/dist/node/associations/internal/getIdsFromKeywords.js +25 -0
  106. package/dist/node/associations/internal/getIdsFromKeywords.js.map +1 -0
  107. package/dist/node/associations/internal/getIncludesAndReferencesQuery.js +61 -0
  108. package/dist/node/associations/internal/getIncludesAndReferencesQuery.js.map +1 -0
  109. package/dist/node/associations/internal/getIncludesDoesNotReferenceQuery.js +61 -0
  110. package/dist/node/associations/internal/getIncludesDoesNotReferenceQuery.js.map +1 -0
  111. package/dist/node/associations/internal/getReferencesDoesNotIncludeQuery.js +65 -0
  112. package/dist/node/associations/internal/getReferencesDoesNotIncludeQuery.js.map +1 -0
  113. package/dist/node/associations/internal/getTypeByIdsQuery.js +13 -15
  114. package/dist/node/associations/internal/getTypeByIdsQuery.js.map +1 -1
  115. package/dist/node/associations/internal/getTypeByNotIdsQuery.js +30 -0
  116. package/dist/node/associations/internal/getTypeByNotIdsQuery.js.map +1 -0
  117. package/dist/node/associations/internal/getTypeWithKeywordQuery.js +11 -6
  118. package/dist/node/associations/internal/getTypeWithKeywordQuery.js.map +1 -1
  119. package/dist/node/associations/internal/getTypeWithoutKeywordQuery.js +10 -5
  120. package/dist/node/associations/internal/getTypeWithoutKeywordQuery.js.map +1 -1
  121. package/dist/node/associations/internal/isAssociationSupported.js +32 -0
  122. package/dist/node/associations/internal/isAssociationSupported.js.map +1 -0
  123. package/dist/node/associations/internal/removeAssociationKeyword.js +20 -0
  124. package/dist/node/associations/internal/removeAssociationKeyword.js.map +1 -0
  125. package/dist/node/associations/internal/setAssociationKeyword.js +22 -0
  126. package/dist/node/associations/internal/setAssociationKeyword.js.map +1 -0
  127. package/dist/node/associations/listAssociations.js +4 -0
  128. package/dist/node/associations/listAssociations.js.map +1 -1
  129. package/dist/node/associations/removeAssociation.js +3 -0
  130. package/dist/node/associations/removeAssociation.js.map +1 -1
  131. package/dist/node/associations/requestAssociation.js +60 -0
  132. package/dist/node/associations/requestAssociation.js.map +1 -0
  133. package/dist/node/associations/types.js +0 -1
  134. package/dist/node/associations/types.js.map +1 -1
  135. package/dist/node/core/HubItemEntity.js +33 -10
  136. package/dist/node/core/HubItemEntity.js.map +1 -1
  137. package/dist/node/core/_internal/getBasePropertyMap.js +1 -1
  138. package/dist/node/core/_internal/getBasePropertyMap.js.map +1 -1
  139. package/dist/node/core/getTypesFromEntityType.js +42 -0
  140. package/dist/node/core/getTypesFromEntityType.js.map +1 -0
  141. package/dist/node/core/index.js +1 -0
  142. package/dist/node/core/index.js.map +1 -1
  143. package/dist/node/core/processActionLinks.js +2 -2
  144. package/dist/node/core/processActionLinks.js.map +1 -1
  145. package/dist/node/core/updateHubEntity.js +4 -0
  146. package/dist/node/core/updateHubEntity.js.map +1 -1
  147. package/dist/node/initiatives/HubInitiatives.js +15 -42
  148. package/dist/node/initiatives/HubInitiatives.js.map +1 -1
  149. package/dist/node/initiatives/_internal/InitiativeAssociationHierarchies.js +8 -0
  150. package/dist/node/initiatives/_internal/InitiativeAssociationHierarchies.js.map +1 -0
  151. package/dist/node/initiatives/_internal/InitiativeBusinessRules.js +29 -0
  152. package/dist/node/initiatives/_internal/InitiativeBusinessRules.js.map +1 -1
  153. package/dist/node/projects/_internal/ProjectAssociationHierarchies.js +8 -0
  154. package/dist/node/projects/_internal/ProjectAssociationHierarchies.js.map +1 -0
  155. package/dist/node/projects/_internal/ProjectBusinessRules.js +6 -0
  156. package/dist/node/projects/_internal/ProjectBusinessRules.js.map +1 -1
  157. package/dist/node/projects/_internal/computeProps.js +4 -2
  158. package/dist/node/projects/_internal/computeProps.js.map +1 -1
  159. package/dist/node/projects/fetch.js +3 -0
  160. package/dist/node/projects/fetch.js.map +1 -1
  161. package/dist/node/search/_internal/buildCatalog.js +29 -0
  162. package/dist/node/search/_internal/buildCatalog.js.map +1 -0
  163. package/dist/node/search/wellKnownCatalog.js +29 -43
  164. package/dist/node/search/wellKnownCatalog.js.map +1 -1
  165. package/dist/types/associations/addAssociation.d.ts +3 -0
  166. package/dist/types/associations/breakAssociation.d.ts +20 -0
  167. package/dist/types/associations/getAssociatedEntitiesQuery.d.ts +21 -0
  168. package/dist/types/associations/getAssociationStats.d.ts +13 -0
  169. package/dist/types/associations/getAvailableToRequestEntitiesQuery.d.ts +21 -0
  170. package/dist/types/associations/getPendingEntitiesQuery.d.ts +26 -0
  171. package/dist/types/associations/getRequestingEntitiesQuery.d.ts +26 -0
  172. package/dist/types/associations/getWellKnownAssociationsCatalog.d.ts +34 -0
  173. package/dist/types/associations/index.d.ts +9 -0
  174. package/dist/types/associations/internal/getAssociationHierarchy.d.ts +15 -0
  175. package/dist/types/associations/internal/getIdsFromAssociationGroups.d.ts +15 -0
  176. package/dist/types/associations/internal/getIdsFromKeywords.d.ts +13 -0
  177. package/dist/types/associations/internal/getIncludesAndReferencesQuery.d.ts +14 -0
  178. package/dist/types/associations/internal/getIncludesDoesNotReferenceQuery.d.ts +14 -0
  179. package/dist/types/associations/internal/getReferencesDoesNotIncludeQuery.d.ts +14 -0
  180. package/dist/types/associations/internal/getTypeByIdsQuery.d.ts +8 -6
  181. package/dist/types/associations/internal/getTypeByNotIdsQuery.d.ts +12 -0
  182. package/dist/types/associations/internal/getTypeWithKeywordQuery.d.ts +8 -5
  183. package/dist/types/associations/internal/getTypeWithoutKeywordQuery.d.ts +8 -5
  184. package/dist/types/associations/internal/isAssociationSupported.d.ts +11 -0
  185. package/dist/types/associations/internal/removeAssociationKeyword.d.ts +12 -0
  186. package/dist/types/associations/internal/setAssociationKeyword.d.ts +12 -0
  187. package/dist/types/associations/listAssociations.d.ts +4 -0
  188. package/dist/types/associations/removeAssociation.d.ts +3 -0
  189. package/dist/types/associations/requestAssociation.d.ts +23 -0
  190. package/dist/types/associations/types.d.ts +53 -0
  191. package/dist/types/core/HubItemEntity.d.ts +10 -1
  192. package/dist/types/core/behaviors/IWIthAssociationBehavior.d.ts +9 -0
  193. package/dist/types/core/behaviors/IWithFeaturedImageBehavior.d.ts +2 -2
  194. package/dist/types/core/getTypesFromEntityType.d.ts +10 -0
  195. package/dist/types/core/index.d.ts +1 -0
  196. package/dist/types/core/traits/IWithAssociations.d.ts +13 -0
  197. package/dist/types/initiatives/HubInitiatives.d.ts +12 -0
  198. package/dist/types/initiatives/_internal/InitiativeAssociationHierarchies.d.ts +2 -0
  199. package/dist/types/initiatives/_internal/InitiativeBusinessRules.d.ts +1 -1
  200. package/dist/types/projects/_internal/ProjectAssociationHierarchies.d.ts +2 -0
  201. package/dist/types/projects/_internal/ProjectBusinessRules.d.ts +1 -1
  202. package/dist/types/projects/fetch.d.ts +3 -0
  203. package/dist/types/search/_internal/buildCatalog.d.ts +12 -0
  204. package/package.json +1 -1
  205. package/dist/esm/associations/internal/getTargetEntityFromAssociationType.js +0 -18
  206. package/dist/esm/associations/internal/getTargetEntityFromAssociationType.js.map +0 -1
  207. package/dist/esm/associations/internal/getTypeFromAssociationType.js +0 -18
  208. package/dist/esm/associations/internal/getTypeFromAssociationType.js.map +0 -1
  209. package/dist/node/associations/internal/getTargetEntityFromAssociationType.js +0 -22
  210. package/dist/node/associations/internal/getTargetEntityFromAssociationType.js.map +0 -1
  211. package/dist/node/associations/internal/getTypeFromAssociationType.js +0 -22
  212. package/dist/node/associations/internal/getTypeFromAssociationType.js.map +0 -1
  213. package/dist/types/associations/internal/getTargetEntityFromAssociationType.d.ts +0 -8
  214. package/dist/types/associations/internal/getTypeFromAssociationType.d.ts +0 -7
@@ -1,4 +1,7 @@
1
1
  /**
2
+ * ** DEPRECATED: please use requestAssociation instead.
3
+ * This will be removed in the next breaking version **
4
+ *
2
5
  * Add an association to an entity
3
6
  * Persisted into the entity's `.typeKeywords` array
4
7
  * @param info
@@ -1 +1 @@
1
- {"version":3,"file":"addAssociation.js","sourceRoot":"","sources":["../../../src/associations/addAssociation.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAyB,EACzB,IAAsB;IAEtB,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE;QACxB,MAAM,CAAC,YAAY,GAAG,EAAE,CAAC;KAC1B;IACD,MAAM,WAAW,GAAG,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC;IAC9C,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE;QAC9C,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;KACvC;AACH,CAAC"}
1
+ {"version":3,"file":"addAssociation.js","sourceRoot":"","sources":["../../../src/associations/addAssociation.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAyB,EACzB,IAAsB;IAEtB,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE;QACxB,MAAM,CAAC,YAAY,GAAG,EAAE,CAAC;KAC1B;IACD,MAAM,WAAW,GAAG,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC;IAC9C,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE;QAC9C,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;KACvC;AACH,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { unshareItemWithGroup } from "@esri/arcgis-rest-portal";
2
+ import { getProp } from "../objects";
3
+ import { fetchHubEntity } from "../core";
4
+ import { getTypeFromEntity } from "../core/getTypeFromEntity";
5
+ import { updateHubEntity } from "../core/updateHubEntity";
6
+ import { getAssociationHierarchy } from "./internal/getAssociationHierarchy";
7
+ import { isAssociationSupported } from "./internal/isAssociationSupported";
8
+ import { removeAssociationKeyword } from "./internal/removeAssociationKeyword";
9
+ /**
10
+ * When an entity decides it wants to "disconnect" itself
11
+ * from an existing association, half of the association
12
+ * "connection" is broken.
13
+ *
14
+ * from the parent's perspective: the parent removes
15
+ * the child from its association group
16
+ *
17
+ * From the child's perspective: the child removes
18
+ * the parent reference (ref|<parentType>|<parentID>)
19
+ * from its typeKeywords
20
+ *
21
+ * @param entity - entity initiating the disconnection
22
+ * @param type - type of the entity the initiating entity wants to disconnect from
23
+ * @param id - id of the entity the initiating entity wants to disconnect from
24
+ * @param context - contextual portal and auth information
25
+ */
26
+ export const breakAssociation = async (entity, associationType, id, context) => {
27
+ const entityType = getTypeFromEntity(entity);
28
+ const isSupported = isAssociationSupported(entityType, associationType);
29
+ if (!isSupported) {
30
+ throw new Error(`breakAssociation: Association between ${entityType} and ${associationType} is not supported.`);
31
+ }
32
+ const associationHierarchy = getAssociationHierarchy(entityType);
33
+ const isParent = associationHierarchy.children.includes(associationType);
34
+ if (isParent) {
35
+ const associationGroupId = getProp(entity, "associations.groupId");
36
+ const { owner } = await fetchHubEntity(associationType, id, context);
37
+ try {
38
+ await unshareItemWithGroup({
39
+ id,
40
+ groupId: associationGroupId,
41
+ authentication: context.session,
42
+ owner,
43
+ });
44
+ }
45
+ catch (error) {
46
+ throw new Error(`breakAssociation: there was an error unsharing ${id} from ${associationGroupId}: ${error}`);
47
+ }
48
+ }
49
+ else {
50
+ entity.typeKeywords = removeAssociationKeyword(entity.typeKeywords, associationType, id);
51
+ await updateHubEntity(entityType, entity, context);
52
+ }
53
+ };
54
+ //# sourceMappingURL=breakAssociation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"breakAssociation.js","sourceRoot":"","sources":["../../../src/associations/breakAssociation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAE/E;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EACnC,MAAiB,EACjB,eAA8B,EAC9B,EAAU,EACV,OAAuB,EACR,EAAE;IACjB,MAAM,UAAU,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,WAAW,GAAG,sBAAsB,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;IAExE,IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,IAAI,KAAK,CACb,yCAAyC,UAAU,QAAQ,eAAe,oBAAoB,CAC/F,CAAC;KACH;IAED,MAAM,oBAAoB,GAAG,uBAAuB,CAAC,UAAU,CAAC,CAAC;IACjE,MAAM,QAAQ,GAAG,oBAAoB,CAAC,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;IAEzE,IAAI,QAAQ,EAAE;QACZ,MAAM,kBAAkB,GAAG,OAAO,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;QACnE,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,cAAc,CAAC,eAAe,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;QACrE,IAAI;YACF,MAAM,oBAAoB,CAAC;gBACzB,EAAE;gBACF,OAAO,EAAE,kBAAkB;gBAC3B,cAAc,EAAE,OAAO,CAAC,OAAO;gBAC/B,KAAK;aACN,CAAC,CAAC;SACJ;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,KAAK,CACb,kDAAkD,EAAE,SAAS,kBAAkB,KAAK,KAAK,EAAE,CAC5F,CAAC;SACH;KACF;SAAM;QACL,MAAM,CAAC,YAAY,GAAG,wBAAwB,CAC5C,MAAM,CAAC,YAAY,EACnB,eAAe,EACf,EAAE,CACH,CAAC;QACF,MAAM,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;KACpD;AACH,CAAC,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { getTypeFromEntity } from "../core/getTypeFromEntity";
2
+ import { getAssociationHierarchy } from "./internal/getAssociationHierarchy";
3
+ import { isAssociationSupported } from "./internal/isAssociationSupported";
4
+ import { getIncludesAndReferencesQuery } from "./internal/getIncludesAndReferencesQuery";
5
+ /**
6
+ * Associated entities are those which have mutually
7
+ * "agreed" to be connected with one another. They
8
+ * require a two-way "connection" between parent/child:
9
+ *
10
+ * parent: "includes" the child in its association query
11
+ * child: "references" the parent via a typeKeyword of
12
+ * the form ref|<parentType>|<parentID>
13
+ *
14
+ * The following returns a query to view an entity's
15
+ * associations with another entity type
16
+ *
17
+ * @param entity - Hub entity
18
+ * @param associationType - entity type to query for
19
+ * @param context - contextual auth and portal information
20
+ * @returns {IQuery}
21
+ */
22
+ export const getAssociatedEntitiesQuery = async (entity, associationType, context) => {
23
+ const entityType = getTypeFromEntity(entity);
24
+ const isSupported = isAssociationSupported(entityType, associationType);
25
+ if (!isSupported) {
26
+ throw new Error(`getAssociatedEntitiesQuery: Association between ${entityType} and ${associationType} is not supported.`);
27
+ }
28
+ const associationHierarchy = getAssociationHierarchy(entityType);
29
+ const isParent = associationHierarchy.children.includes(associationType);
30
+ const query = await getIncludesAndReferencesQuery(entity, associationType, isParent, context);
31
+ return query;
32
+ };
33
+ //# sourceMappingURL=getAssociatedEntitiesQuery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAssociatedEntitiesQuery.js","sourceRoot":"","sources":["../../../src/associations/getAssociatedEntitiesQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAG9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AAGzF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,EAC7C,MAAiB,EACjB,eAA8B,EAC9B,OAAuB,EACN,EAAE;IACnB,MAAM,UAAU,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,WAAW,GAAG,sBAAsB,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;IAExE,IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,IAAI,KAAK,CACb,mDAAmD,UAAU,QAAQ,eAAe,oBAAoB,CACzG,CAAC;KACH;IAED,MAAM,oBAAoB,GAAG,uBAAuB,CAAC,UAAU,CAAC,CAAC;IACjE,MAAM,QAAQ,GAAG,oBAAoB,CAAC,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;IAEzE,MAAM,KAAK,GAAG,MAAM,6BAA6B,CAC/C,MAAM,EACN,eAAe,EACf,QAAQ,EACR,OAAO,CACR,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
@@ -0,0 +1,49 @@
1
+ import { getTypeFromEntity } from "../core/getTypeFromEntity";
2
+ import { hubSearch } from "../search/hubSearch";
3
+ import { getAssociatedEntitiesQuery } from "./getAssociatedEntitiesQuery";
4
+ import { getPendingEntitiesQuery } from "./getPendingEntitiesQuery";
5
+ import { getRequestingEntitiesQuery } from "./getRequestingEntitiesQuery";
6
+ import { getAssociationHierarchy } from "./internal/getAssociationHierarchy";
7
+ import { isAssociationSupported } from "./internal/isAssociationSupported";
8
+ /**
9
+ * get an entity's association stats - # of associated, pending,
10
+ * requesting, included/referenced entities
11
+ *
12
+ * @param entity - Hub entity
13
+ * @param associationType - entity type to query for
14
+ * @param context - contextual auth and portal information
15
+ * @returns
16
+ */
17
+ export const getAssociationStats = async (entity, associationType, context) => {
18
+ let stats;
19
+ const entityType = getTypeFromEntity(entity);
20
+ const isSupported = isAssociationSupported(entityType, associationType);
21
+ if (!isSupported) {
22
+ throw new Error(`getAssociationStats: Association between ${entityType} and ${associationType} is not supported.`);
23
+ }
24
+ const associationHierarchy = getAssociationHierarchy(entityType);
25
+ const isParent = associationHierarchy.children.includes(associationType);
26
+ stats = Object.assign({ associated: 0, pending: 0, requesting: 0 }, (isParent ? { included: 0 } : { referenced: 0 }));
27
+ try {
28
+ const queries = await Promise.all([
29
+ getAssociatedEntitiesQuery(entity, associationType, context),
30
+ getPendingEntitiesQuery(entity, associationType, context),
31
+ getRequestingEntitiesQuery(entity, associationType, context),
32
+ ]);
33
+ const [{ total: associated }, { total: pending }, { total: requesting }] = await Promise.all(queries.map((query) => {
34
+ return hubSearch(query, {
35
+ requestOptions: context.hubRequestOptions,
36
+ });
37
+ }));
38
+ stats = Object.assign({ associated,
39
+ pending,
40
+ requesting }, (isParent
41
+ ? { included: associated + pending }
42
+ : { referenced: associated + pending }));
43
+ }
44
+ catch (error) {
45
+ return stats;
46
+ }
47
+ return stats;
48
+ };
49
+ //# sourceMappingURL=getAssociationStats.js.map
@@ -0,0 +1 @@
1
+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AAO,CAAC,GAAG,CAAC;YAChC,0BAA0B,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,CAAC;YAC5D,uBAAuB,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,CAAC;YACzD,0BAA0B,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,CAAC;SAC7D,CAAC,CAAC;QAEH,MAAM,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,GACtE,MAAM,OAAO,CAAC,GAAG,CACf,OAAO,CAAC,GAAG,CAAC,CAAC,KAAa,EAAE,EAAE;YAC5B,OAAO,SAAS,CAAC,KAAK,EAAE;gBACtB,cAAc,EAAE,OAAO,CAAC,iBAAiB;aAC1C,CAAC,CAAC;QACL,CAAC,CAAC,CACH,CAAC;QAEJ,KAAK,mBACH,UAAU;YACV,OAAO;YACP,UAAU,IACP,CAAC,QAAQ;YACV,CAAC,CAAC,EAAE,QAAQ,EAAE,UAAU,GAAG,OAAO,EAAE;YACpC,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,EAAE,CAAC,CAC1C,CAAC;KACH;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,KAAK,CAAC;KACd;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
@@ -0,0 +1,65 @@
1
+ import { getTypeFromEntity } from "../core/getTypeFromEntity";
2
+ import { getAssociationHierarchy } from "./internal/getAssociationHierarchy";
3
+ import { isAssociationSupported } from "./internal/isAssociationSupported";
4
+ import { getProp } from "../objects/get-prop";
5
+ import { getTypesFromEntityType } from "../core/getTypesFromEntityType";
6
+ import { getIdsFromKeywords } from "./internal/getIdsFromKeywords";
7
+ import { getTypeByNotIdsQuery } from "./internal/getTypeByNotIdsQuery";
8
+ import { negateGroupPredicates } from "../search/_internal/negateGroupPredicates";
9
+ import { getTypeByIdsQuery } from "./internal/getTypeByIdsQuery";
10
+ import { combineQueries } from "../search/_internal/combineQueries";
11
+ /**
12
+ * An entity can send an "outgoing" request to associate
13
+ * itself with another entity. The following query returns
14
+ * a set of entities that the requesting entity can still
15
+ * request:
16
+ *
17
+ * from a parent perspective: returns a set of children
18
+ * that are NOT "included" in the parent's association group
19
+ *
20
+ * from a child perspective: returns a set of parents that
21
+ * the child does not "reference" with via a typeKeyword of
22
+ * the form ref|<parentType>|<parentID>
23
+ *
24
+ * @param entity - entity requesting association
25
+ * @param associationType - type of entity the requesting entity wants to associate with
26
+ * @param context - contextual auth and portal information
27
+ * @returns {IQuery}
28
+ */
29
+ export const getAvailableToRequestEntitiesQuery = (entity, associationType) => {
30
+ let query;
31
+ const entityType = getTypeFromEntity(entity);
32
+ const isSupported = isAssociationSupported(entityType, associationType);
33
+ if (!isSupported) {
34
+ throw new Error(`getAvailableToRequestEntitiesQuery: Association between ${entityType} and ${associationType} is not supported.`);
35
+ }
36
+ const associationHierarchy = getAssociationHierarchy(entityType);
37
+ const isParent = associationHierarchy.children.includes(associationType);
38
+ if (isParent) {
39
+ /** 1. build query that returns child entities */
40
+ const childType = getTypesFromEntityType(associationType);
41
+ const childTypeQuery = getTypeByIdsQuery(childType, []);
42
+ /**
43
+ * 2. grab the parent's association query and negate
44
+ * the group predicate
45
+ */
46
+ const notIncludedQuery = negateGroupPredicates(getProp(entity, "associations.rules.query"));
47
+ /** 3. combine queries - will remove null/undefined entries */
48
+ query = combineQueries([notIncludedQuery, childTypeQuery]);
49
+ }
50
+ else {
51
+ /**
52
+ * 1. iterate over the child's typeKeywords and grab the parent
53
+ * ids it references (typeKeyword = <associationType>|<id>)
54
+ */
55
+ const ids = getIdsFromKeywords(entity, associationType);
56
+ /**
57
+ * 2. build query that returns parent entities NOT
58
+ * "referenced" by the child
59
+ */
60
+ const type = getTypesFromEntityType(associationType);
61
+ query = getTypeByNotIdsQuery(type, ids);
62
+ }
63
+ return query;
64
+ };
65
+ //# sourceMappingURL=getAvailableToRequestEntitiesQuery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAvailableToRequestEntitiesQuery.js","sourceRoot":"","sources":["../../../src/associations/getAvailableToRequestEntitiesQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAG9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEpE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAChD,MAAiB,EACjB,eAA8B,EACtB,EAAE;IACV,IAAI,KAAa,CAAC;IAClB,MAAM,UAAU,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,WAAW,GAAG,sBAAsB,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;IAExE,IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,IAAI,KAAK,CACb,2DAA2D,UAAU,QAAQ,eAAe,oBAAoB,CACjH,CAAC;KACH;IAED,MAAM,oBAAoB,GAAG,uBAAuB,CAAC,UAAU,CAAC,CAAC;IACjE,MAAM,QAAQ,GAAG,oBAAoB,CAAC,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;IAEzE,IAAI,QAAQ,EAAE;QACZ,iDAAiD;QACjD,MAAM,SAAS,GAAG,sBAAsB,CAAC,eAAe,CAAC,CAAC;QAC1D,MAAM,cAAc,GAAG,iBAAiB,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QAExD;;;WAGG;QACH,MAAM,gBAAgB,GAAG,qBAAqB,CAC5C,OAAO,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAC5C,CAAC;QAEF,8DAA8D;QAC9D,KAAK,GAAG,cAAc,CAAC,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC,CAAC;KAC5D;SAAM;QACL;;;WAGG;QACH,MAAM,GAAG,GAAG,kBAAkB,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;QAExD;;;WAGG;QACH,MAAM,IAAI,GAAG,sBAAsB,CAAC,eAAe,CAAC,CAAC;QACrD,KAAK,GAAG,oBAAoB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;KACzC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { getTypeFromEntity } from "../core/getTypeFromEntity";
2
+ import { getAssociationHierarchy } from "./internal/getAssociationHierarchy";
3
+ import { getReferencesDoesNotIncludeQuery } from "./internal/getReferencesDoesNotIncludeQuery";
4
+ import { getIncludesDoesNotReferenceQuery } from "./internal/getIncludesDoesNotReferenceQuery";
5
+ import { isAssociationSupported } from "./internal/isAssociationSupported";
6
+ /**
7
+ * Pending entities represent "outgoing" requests that are
8
+ * awaiting "approval". They imply a one-way "connection"
9
+ * between parent/child.
10
+ *
11
+ * From the parent's perspective:
12
+ * parent: "includes" the child in its association query
13
+ * child: does NOT "reference" the parent via a typeKeyword
14
+ *
15
+ * From the child's perspective:
16
+ * parent: does NOT "include" the child in its association query
17
+ * child: "references" the parent via a typeKeyword of the
18
+ * form ref|<parentType>|<parentID>
19
+ *
20
+ * The following returns a query to view an entity's outgoing
21
+ * requests for association with another entity type
22
+ *
23
+ * @param entity - Hub entity
24
+ * @param associationType - entity type to query for
25
+ * @param context - contextual auth and portal information
26
+ * @returns {IQuery}
27
+ */
28
+ export const getPendingEntitiesQuery = async (entity, associationType, context) => {
29
+ const entityType = getTypeFromEntity(entity);
30
+ const isSupported = isAssociationSupported(entityType, associationType);
31
+ if (!isSupported) {
32
+ throw new Error(`getPendingEntitiesQuery: Association between ${entityType} and ${associationType} is not supported.`);
33
+ }
34
+ const associationHierarchy = getAssociationHierarchy(entityType);
35
+ const isParent = associationHierarchy.children.includes(associationType);
36
+ const query = isParent
37
+ ? await getIncludesDoesNotReferenceQuery(entity, associationType, isParent, context)
38
+ : await getReferencesDoesNotIncludeQuery(entity, associationType, isParent, context);
39
+ return query;
40
+ };
41
+ //# sourceMappingURL=getPendingEntitiesQuery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPendingEntitiesQuery.js","sourceRoot":"","sources":["../../../src/associations/getPendingEntitiesQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAG9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,gCAAgC,EAAE,MAAM,6CAA6C,CAAC;AAC/F,OAAO,EAAE,gCAAgC,EAAE,MAAM,6CAA6C,CAAC;AAC/F,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAG3E;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,KAAK,EAC1C,MAAiB,EACjB,eAA8B,EAC9B,OAAuB,EACN,EAAE;IACnB,MAAM,UAAU,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,WAAW,GAAG,sBAAsB,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;IAExE,IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,IAAI,KAAK,CACb,gDAAgD,UAAU,QAAQ,eAAe,oBAAoB,CACtG,CAAC;KACH;IAED,MAAM,oBAAoB,GAAG,uBAAuB,CAAC,UAAU,CAAC,CAAC;IACjE,MAAM,QAAQ,GAAG,oBAAoB,CAAC,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;IAEzE,MAAM,KAAK,GAAG,QAAQ;QACpB,CAAC,CAAC,MAAM,gCAAgC,CACpC,MAAM,EACN,eAAe,EACf,QAAQ,EACR,OAAO,CACR;QACH,CAAC,CAAC,MAAM,gCAAgC,CACpC,MAAM,EACN,eAAe,EACf,QAAQ,EACR,OAAO,CACR,CAAC;IAEN,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { getTypeFromEntity } from "../core/getTypeFromEntity";
2
+ import { getAssociationHierarchy } from "./internal/getAssociationHierarchy";
3
+ import { getReferencesDoesNotIncludeQuery } from "./internal/getReferencesDoesNotIncludeQuery";
4
+ import { getIncludesDoesNotReferenceQuery } from "./internal/getIncludesDoesNotReferenceQuery";
5
+ import { isAssociationSupported } from "./internal/isAssociationSupported";
6
+ /**
7
+ * Requesting entities represent "incoming" requests that are
8
+ * awaiting "approval". They imply a one-way "connection"
9
+ * between parent/child.
10
+ *
11
+ * From the parent's perspective:
12
+ * parent: does NOT "include" the child in its association query
13
+ * child: "references" the parent via a typeKeyword of the
14
+ * form ref|<parentType>|<parentID>
15
+ *
16
+ * From the child's perspective:
17
+ * parent: "includes" the child in its association query
18
+ * child: does NOT "reference" the parent via a typeKeyword
19
+ *
20
+ * The following returns a query to view an entity's incoming
21
+ * requests for association with another entity type
22
+ *
23
+ * @param entity - Hub entity
24
+ * @param associationType - entity type to query for
25
+ * @param context - contextual auth and portal information
26
+ * @returns {IQuery}
27
+ */
28
+ export const getRequestingEntitiesQuery = async (entity, associationType, context) => {
29
+ const entityType = getTypeFromEntity(entity);
30
+ const isSupported = isAssociationSupported(entityType, associationType);
31
+ if (!isSupported) {
32
+ throw new Error(`getRequestingEntitiesQuery: Association between ${entityType} and ${associationType} is not supported.`);
33
+ }
34
+ const associationHierarchy = getAssociationHierarchy(entityType);
35
+ const isParent = associationHierarchy.children.includes(associationType);
36
+ const query = isParent
37
+ ? await getReferencesDoesNotIncludeQuery(entity, associationType, isParent, context)
38
+ : await getIncludesDoesNotReferenceQuery(entity, associationType, isParent, context);
39
+ return query;
40
+ };
41
+ //# sourceMappingURL=getRequestingEntitiesQuery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getRequestingEntitiesQuery.js","sourceRoot":"","sources":["../../../src/associations/getRequestingEntitiesQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAG9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,gCAAgC,EAAE,MAAM,6CAA6C,CAAC;AAC/F,OAAO,EAAE,gCAAgC,EAAE,MAAM,6CAA6C,CAAC;AAC/F,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAG3E;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,EAC7C,MAAiB,EACjB,eAA8B,EAC9B,OAAuB,EACN,EAAE;IACnB,MAAM,UAAU,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,WAAW,GAAG,sBAAsB,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;IAExE,IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,IAAI,KAAK,CACb,mDAAmD,UAAU,QAAQ,eAAe,oBAAoB,CACzG,CAAC;KACH;IAED,MAAM,oBAAoB,GAAG,uBAAuB,CAAC,UAAU,CAAC,CAAC;IACjE,MAAM,QAAQ,GAAG,oBAAoB,CAAC,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;IAEzE,MAAM,KAAK,GAAG,QAAQ;QACpB,CAAC,CAAC,MAAM,gCAAgC,CACpC,MAAM,EACN,eAAe,EACf,QAAQ,EACR,OAAO,CACR;QACH,CAAC,CAAC,MAAM,gCAAgC,CACpC,MAAM,EACN,eAAe,EACf,QAAQ,EACR,OAAO,CACR,CAAC;IAEN,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
@@ -0,0 +1,72 @@
1
+ import { getTypeFromEntity } from "../core";
2
+ import { buildCatalog } from "../search/_internal/buildCatalog";
3
+ import { getEntityTypeFromType } from "../search/_internal/getEntityTypeFromType";
4
+ import { getAssociatedEntitiesQuery } from "./getAssociatedEntitiesQuery";
5
+ import { getPendingEntitiesQuery } from "./getPendingEntitiesQuery";
6
+ import { getAvailableToRequestEntitiesQuery } from "./getAvailableToRequestEntitiesQuery";
7
+ import { getRequestingEntitiesQuery } from "./getRequestingEntitiesQuery";
8
+ import { isAssociationSupported } from "./internal/isAssociationSupported";
9
+ import { dotifyString, getWellknownCollection, } from "../search/wellKnownCatalog";
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 async function getWellKnownAssociationsCatalog(i18nScope, catalogName, entity, associationType, context) {
35
+ let catalog;
36
+ const entityType = getTypeFromEntity(entity);
37
+ const isSupported = isAssociationSupported(entityType, associationType);
38
+ if (!isSupported) {
39
+ throw new Error(`getWellKnownAssociationsCatalog: Association between ${entityType} and ${associationType} is not supported.`);
40
+ }
41
+ i18nScope = dotifyString(i18nScope);
42
+ const targetEntity = getEntityTypeFromType(entity.type);
43
+ /** 1. build a collection based on the provided associationType */
44
+ const collections = [
45
+ getWellknownCollection(i18nScope, targetEntity, associationType),
46
+ ];
47
+ /** 2. build a query based on the provided catalogName */
48
+ let query;
49
+ switch (catalogName) {
50
+ case "associated":
51
+ query = await getAssociatedEntitiesQuery(entity, associationType, context);
52
+ break;
53
+ case "pending":
54
+ query = await getPendingEntitiesQuery(entity, associationType, context);
55
+ break;
56
+ case "requesting":
57
+ query = await getRequestingEntitiesQuery(entity, associationType, context);
58
+ break;
59
+ case "availableToRequest":
60
+ query = getAvailableToRequestEntitiesQuery(entity, associationType);
61
+ break;
62
+ }
63
+ /** 3. build the well-known catalog */
64
+ // if query filters are undefined (e.g. query = null), we assume
65
+ // an empty state, and we need to construct a default query
66
+ // filter that will return no results
67
+ const filters = (query === null || query === void 0 ? void 0 : query.filters) ? query.filters
68
+ : [{ predicates: [{ type: ["Code Attachment"] }] }];
69
+ catalog = buildCatalog(i18nScope, catalogName, filters, collections, targetEntity);
70
+ return catalog;
71
+ }
72
+ //# sourceMappingURL=getWellKnownAssociationsCatalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getWellKnownAssociationsCatalog.js","sourceRoot":"","sources":["../../../src/associations/getWellKnownAssociationsCatalog.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAA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C;IACtC,gEAAgE;IAChE,2DAA2D;IAC3D,qCAAqC;IACrC,MAAM,OAAO,GAAG,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,EAC5B,CAAC,CAAC,KAAK,CAAC,OAAO;QACf,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,iBAAiB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACtD,OAAO,GAAG,YAAY,CACpB,SAAS,EACT,WAAW,EACX,OAAO,EACP,WAAW,EACX,YAAY,CACb,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -1,5 +1,17 @@
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
+ // Note: we expose "requestAssociation" under 2 names.
13
+ // These actions are functionally equivalent, but we want
14
+ // to make the intent more clear to the consumer.
15
+ export { requestAssociation } from "./requestAssociation";
16
+ export { requestAssociation as acceptAssociation } from "./requestAssociation";
5
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/associations/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/associations/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,SAAS,CAAC;AACxB,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sCAAsC,CAAC;AACrD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC;AAClD,sDAAsD;AACtD,yDAAyD;AACzD,iDAAiD;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,IAAI,iBAAiB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { ProjectAssociationHierarchies } from "../../projects/_internal/ProjectAssociationHierarchies";
2
+ import { InitiativeAssociationHierarchies } from "../../initiatives/_internal/InitiativeAssociationHierarchies";
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 const getAssociationHierarchy = (type) => {
16
+ let hierarchy = {
17
+ children: [],
18
+ parents: [],
19
+ };
20
+ switch (type) {
21
+ case "initiative":
22
+ hierarchy = InitiativeAssociationHierarchies;
23
+ break;
24
+ case "project":
25
+ hierarchy = ProjectAssociationHierarchies;
26
+ break;
27
+ // as we support more entity associations, we'll need to extend this
28
+ default:
29
+ throw new Error(`getAssociationHierarchy: Invalid type for associations: ${type}.`);
30
+ }
31
+ return hierarchy;
32
+ };
33
+ //# sourceMappingURL=getAssociationHierarchy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAssociationHierarchy.js","sourceRoot":"","sources":["../../../../src/associations/internal/getAssociationHierarchy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,6BAA6B,EAAE,MAAM,wDAAwD,CAAC;AACvG,OAAO,EAAE,gCAAgC,EAAE,MAAM,8DAA8D,CAAC;AAEhH;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,IAAmB,EACO,EAAE;IAC5B,IAAI,SAAS,GAA6B;QACxC,QAAQ,EAAE,EAAE;QACZ,OAAO,EAAE,EAAE;KACZ,CAAC;IACF,QAAQ,IAAI,EAAE;QACZ,KAAK,YAAY;YACf,SAAS,GAAG,gCAAgC,CAAC;YAC7C,MAAM;QACR,KAAK,SAAS;YACZ,SAAS,GAAG,6BAA6B,CAAC;YAC1C,MAAM;QACR,oEAAoE;QACpE;YACE,MAAM,IAAI,KAAK,CACb,2DAA2D,IAAI,GAAG,CACnE,CAAC;KACL;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * given an array of groups, this util maps over them,
3
+ * and for each, determines if it's an association group
4
+ * by checking if it has a typeKeyword of the form
5
+ * <associationType>|<id>. If so, it extracts and returns
6
+ * the id which corresponds to the parent entity that this
7
+ * association group belongs to
8
+ *
9
+ * @param groups - array of groups
10
+ * @param associationType - entity type to extract ids for
11
+ * @returns {string[]}
12
+ */
13
+ export const getIdsFromAssociationGroups = (groups, associationType) => {
14
+ return groups.reduce((ids, group) => {
15
+ // 1. determine if the group is an association group
16
+ const associationTypeKeyword = group.typeKeywords.find((keyword) => keyword.startsWith(`${associationType}|`));
17
+ // 2. if so, store the parent id from the typeKeyword to return
18
+ if (associationTypeKeyword) {
19
+ const id = associationTypeKeyword.split("|")[1];
20
+ ids.push(id);
21
+ }
22
+ return ids;
23
+ }, []);
24
+ };
25
+ //# sourceMappingURL=getIdsFromAssociationGroups.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getIdsFromAssociationGroups.js","sourceRoot":"","sources":["../../../../src/associations/internal/getIdsFromAssociationGroups.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CACzC,MAAgB,EAChB,eAA8B,EACpB,EAAE;IACZ,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,GAAa,EAAE,KAAa,EAAE,EAAE;QACpD,oDAAoD;QACpD,MAAM,sBAAsB,GAAG,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,OAAe,EAAE,EAAE,CACzE,OAAO,CAAC,UAAU,CAAC,GAAG,eAAe,GAAG,CAAC,CAC1C,CAAC;QAEF,+DAA+D;QAC/D,IAAI,sBAAsB,EAAE;YAC1B,MAAM,EAAE,GAAG,sBAAsB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAChD,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SACd;QAED,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { getProp } from "../../objects";
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 const getIdsFromKeywords = (entity, associationType) => {
14
+ return getProp(entity, "typeKeywords").reduce((ids, keyword) => {
15
+ if (keyword.startsWith(`ref|${associationType}|`)) {
16
+ const id = keyword.split("|")[2];
17
+ ids.push(id);
18
+ }
19
+ return ids;
20
+ }, []);
21
+ };
22
+ //# sourceMappingURL=getIdsFromKeywords.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getIdsFromKeywords.js","sourceRoot":"","sources":["../../../../src/associations/internal/getIdsFromKeywords.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,MAAiB,EACjB,eAA8B,EACpB,EAAE;IACZ,OAAO,OAAO,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,MAAM,CAC3C,CAAC,GAAa,EAAE,OAAe,EAAE,EAAE;QACjC,IAAI,OAAO,CAAC,UAAU,CAAC,OAAO,eAAe,GAAG,CAAC,EAAE;YACjD,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YACjC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SACd;QACD,OAAO,GAAG,CAAC;IACb,CAAC,EACD,EAAE,CACH,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,58 @@
1
+ import { getItemGroups } from "@esri/arcgis-rest-portal";
2
+ import { getTypesFromEntityType } from "../../core/getTypesFromEntityType";
3
+ import { getProp } from "../../objects/get-prop";
4
+ import { combineQueries } from "../../search/_internal/combineQueries";
5
+ import { getTypeWithKeywordQuery } from "./getTypeWithKeywordQuery";
6
+ import { getTypeByIdsQuery } from "./getTypeByIdsQuery";
7
+ import { getTypeFromEntity } from "../../core/getTypeFromEntity";
8
+ import { getIdsFromKeywords } from "./getIdsFromKeywords";
9
+ import { getIdsFromAssociationGroups } from "./getIdsFromAssociationGroups";
10
+ /**
11
+ * builds a query that will return entities that are
12
+ * "included" AND "referenced"
13
+ *
14
+ * @param entity - Hub entity
15
+ * @param associationType - entity type to query for
16
+ * @param isParent - whether the provided Hub entity is the parent in the association relationship
17
+ * @param context - contextual auth and portal information
18
+ * @returns {IQuery}
19
+ */
20
+ export const getIncludesAndReferencesQuery = async (entity, associationType, isParent, context) => {
21
+ if (isParent) {
22
+ /**
23
+ * 1. build query that returns child entities WITH a
24
+ * typeKeyword reference to the parent
25
+ */
26
+ const parentType = getTypeFromEntity(entity);
27
+ const referencedQuery = getTypeWithKeywordQuery(getTypesFromEntityType(associationType), `ref|${parentType}|${entity.id}`);
28
+ /** 2. grab the parent's association query */
29
+ const includedQuery = getProp(entity, "associations.rules.query");
30
+ /** 3. combine queries - will remove null/undefined entries */
31
+ return combineQueries([referencedQuery, includedQuery]);
32
+ }
33
+ else {
34
+ /** 1. fetch the groups a child has been shared with */
35
+ const { admin, member, other } = await getItemGroups(entity.id, context.requestOptions);
36
+ const groupsChildIsSharedWith = [...admin, ...member, ...other];
37
+ /**
38
+ * 2. filter the child's groups down to association groups
39
+ * (by checking if they have a typeKeyword of the form
40
+ * <associationType>|<id>) and extract parent ids
41
+ */
42
+ const parentIdsThatIncludeChild = getIdsFromAssociationGroups(groupsChildIsSharedWith, associationType);
43
+ /**
44
+ * 3. iterate over the child's typeKeywords and grab the parent
45
+ * ids it references (typeKeyword = <associationType>|<id>)
46
+ */
47
+ const parentIdsChildReferences = getIdsFromKeywords(entity, associationType);
48
+ /**
49
+ * 4. filter the parent ids down to those that include
50
+ * the child AND that the child references
51
+ */
52
+ const parentIds = parentIdsThatIncludeChild.filter((id) => parentIdsChildReferences.includes(id));
53
+ /** 5. return a query for the filtered parent ids */
54
+ const type = getTypesFromEntityType(associationType);
55
+ return parentIds.length ? getTypeByIdsQuery(type, parentIds) : null;
56
+ }
57
+ };
58
+ //# sourceMappingURL=getIncludesAndReferencesQuery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getIncludesAndReferencesQuery.js","sourceRoot":"","sources":["../../../../src/associations/internal/getIncludesAndReferencesQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,O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