@esri/hub-common 9.37.0 → 9.38.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/es2017/content/HubContent.js +68 -0
  2. package/dist/es2017/content/HubContent.js.map +1 -0
  3. package/dist/es2017/content/index.js +1 -0
  4. package/dist/es2017/content/index.js.map +1 -1
  5. package/dist/es2017/groups/HubGroups.js +63 -0
  6. package/dist/es2017/groups/HubGroups.js.map +1 -0
  7. package/dist/es2017/groups/_internal/enrichments.js +99 -0
  8. package/dist/es2017/groups/_internal/enrichments.js.map +1 -0
  9. package/dist/es2017/groups/index.js +2 -0
  10. package/dist/es2017/groups/index.js.map +1 -1
  11. package/dist/es2017/groups/types/IGroupMembershipSummary.js +1 -0
  12. package/dist/es2017/groups/types/IGroupMembershipSummary.js.map +1 -0
  13. package/dist/es2017/groups/types/index.js +2 -0
  14. package/dist/es2017/groups/types/index.js.map +1 -0
  15. package/dist/es2017/index.js +1 -0
  16. package/dist/es2017/index.js.map +1 -1
  17. package/dist/es2017/items/_enrichments.js +9 -1
  18. package/dist/es2017/items/_enrichments.js.map +1 -1
  19. package/dist/es2017/pages/HubPages.js +61 -0
  20. package/dist/es2017/pages/HubPages.js.map +1 -0
  21. package/dist/es2017/pages/index.js +2 -0
  22. package/dist/es2017/pages/index.js.map +1 -0
  23. package/dist/es2017/projects/HubProjects.js +56 -1
  24. package/dist/es2017/projects/HubProjects.js.map +1 -1
  25. package/dist/es2017/search/_internal/hubSearchItems.js +191 -0
  26. package/dist/es2017/search/_internal/hubSearchItems.js.map +1 -0
  27. package/dist/es2017/search/_internal/index.js +3 -0
  28. package/dist/es2017/search/_internal/index.js.map +1 -1
  29. package/dist/es2017/search/_internal/parseInclude.js +27 -0
  30. package/dist/es2017/search/_internal/parseInclude.js.map +1 -0
  31. package/dist/es2017/search/_internal/portalSearchGroups.js +100 -0
  32. package/dist/es2017/search/_internal/portalSearchGroups.js.map +1 -0
  33. package/dist/es2017/search/_internal/portalSearchItems.js +109 -0
  34. package/dist/es2017/search/_internal/portalSearchItems.js.map +1 -0
  35. package/dist/es2017/search/_searchContent.js +3 -0
  36. package/dist/es2017/search/_searchContent.js.map +1 -1
  37. package/dist/es2017/search/_searchGroups.js +3 -1
  38. package/dist/es2017/search/_searchGroups.js.map +1 -1
  39. package/dist/es2017/search/_searchUsers.js +3 -1
  40. package/dist/es2017/search/_searchUsers.js.map +1 -1
  41. package/dist/es2017/search/content-utils.js +36 -4
  42. package/dist/es2017/search/content-utils.js.map +1 -1
  43. package/dist/es2017/search/filter-utils.js +18 -3
  44. package/dist/es2017/search/filter-utils.js.map +1 -1
  45. package/dist/es2017/search/group-utils.js +8 -1
  46. package/dist/es2017/search/group-utils.js.map +1 -1
  47. package/dist/es2017/search/hubSearch.js +48 -0
  48. package/dist/es2017/search/hubSearch.js.map +1 -0
  49. package/dist/es2017/search/index.js +1 -0
  50. package/dist/es2017/search/index.js.map +1 -1
  51. package/dist/es2017/search/user-utils.js +8 -1
  52. package/dist/es2017/search/user-utils.js.map +1 -1
  53. package/dist/es2017/search/utils.js +5 -0
  54. package/dist/es2017/search/utils.js.map +1 -1
  55. package/dist/es2017/sites/HubSites.js +55 -1
  56. package/dist/es2017/sites/HubSites.js.map +1 -1
  57. package/dist/es2017/urls/getGroupHomeUrl.js +12 -0
  58. package/dist/es2017/urls/getGroupHomeUrl.js.map +1 -0
  59. package/dist/es2017/urls/index.js +1 -0
  60. package/dist/es2017/urls/index.js.map +1 -1
  61. package/dist/esm/content/HubContent.js +75 -0
  62. package/dist/esm/content/HubContent.js.map +1 -0
  63. package/dist/esm/content/index.js +1 -0
  64. package/dist/esm/content/index.js.map +1 -1
  65. package/dist/esm/groups/HubGroups.js +70 -0
  66. package/dist/esm/groups/HubGroups.js.map +1 -0
  67. package/dist/esm/groups/_internal/enrichments.js +100 -0
  68. package/dist/esm/groups/_internal/enrichments.js.map +1 -0
  69. package/dist/esm/groups/index.js +2 -0
  70. package/dist/esm/groups/index.js.map +1 -1
  71. package/dist/esm/groups/types/IGroupMembershipSummary.js +1 -0
  72. package/dist/esm/groups/types/IGroupMembershipSummary.js.map +1 -0
  73. package/dist/esm/groups/types/index.js +2 -0
  74. package/dist/esm/groups/types/index.js.map +1 -0
  75. package/dist/esm/index.js +1 -0
  76. package/dist/esm/index.js.map +1 -1
  77. package/dist/esm/items/_enrichments.js +9 -1
  78. package/dist/esm/items/_enrichments.js.map +1 -1
  79. package/dist/esm/pages/HubPages.js +68 -0
  80. package/dist/esm/pages/HubPages.js.map +1 -0
  81. package/dist/esm/pages/index.js +2 -0
  82. package/dist/esm/pages/index.js.map +1 -0
  83. package/dist/esm/projects/HubProjects.js +63 -2
  84. package/dist/esm/projects/HubProjects.js.map +1 -1
  85. package/dist/esm/search/_internal/hubSearchItems.js +204 -0
  86. package/dist/esm/search/_internal/hubSearchItems.js.map +1 -0
  87. package/dist/esm/search/_internal/index.js +3 -0
  88. package/dist/esm/search/_internal/index.js.map +1 -1
  89. package/dist/esm/search/_internal/parseInclude.js +27 -0
  90. package/dist/esm/search/_internal/parseInclude.js.map +1 -0
  91. package/dist/esm/search/_internal/portalSearchGroups.js +114 -0
  92. package/dist/esm/search/_internal/portalSearchGroups.js.map +1 -0
  93. package/dist/esm/search/_internal/portalSearchItems.js +123 -0
  94. package/dist/esm/search/_internal/portalSearchItems.js.map +1 -0
  95. package/dist/esm/search/_searchContent.js +3 -0
  96. package/dist/esm/search/_searchContent.js.map +1 -1
  97. package/dist/esm/search/_searchGroups.js +3 -1
  98. package/dist/esm/search/_searchGroups.js.map +1 -1
  99. package/dist/esm/search/_searchUsers.js +3 -1
  100. package/dist/esm/search/_searchUsers.js.map +1 -1
  101. package/dist/esm/search/content-utils.js +38 -4
  102. package/dist/esm/search/content-utils.js.map +1 -1
  103. package/dist/esm/search/filter-utils.js +16 -3
  104. package/dist/esm/search/filter-utils.js.map +1 -1
  105. package/dist/esm/search/group-utils.js +8 -1
  106. package/dist/esm/search/group-utils.js.map +1 -1
  107. package/dist/esm/search/hubSearch.js +52 -0
  108. package/dist/esm/search/hubSearch.js.map +1 -0
  109. package/dist/esm/search/index.js +1 -0
  110. package/dist/esm/search/index.js.map +1 -1
  111. package/dist/esm/search/user-utils.js +8 -1
  112. package/dist/esm/search/user-utils.js.map +1 -1
  113. package/dist/esm/search/utils.js +5 -0
  114. package/dist/esm/search/utils.js.map +1 -1
  115. package/dist/esm/sites/HubSites.js +62 -2
  116. package/dist/esm/sites/HubSites.js.map +1 -1
  117. package/dist/esm/urls/getGroupHomeUrl.js +12 -0
  118. package/dist/esm/urls/getGroupHomeUrl.js.map +1 -0
  119. package/dist/esm/urls/index.js +1 -0
  120. package/dist/esm/urls/index.js.map +1 -1
  121. package/dist/node/content/HubContent.js +72 -0
  122. package/dist/node/content/HubContent.js.map +1 -0
  123. package/dist/node/content/index.js +1 -0
  124. package/dist/node/content/index.js.map +1 -1
  125. package/dist/node/groups/HubGroups.js +67 -0
  126. package/dist/node/groups/HubGroups.js.map +1 -0
  127. package/dist/node/groups/_internal/enrichments.js +103 -0
  128. package/dist/node/groups/_internal/enrichments.js.map +1 -0
  129. package/dist/node/groups/index.js +2 -0
  130. package/dist/node/groups/index.js.map +1 -1
  131. package/dist/node/groups/types/IGroupMembershipSummary.js +3 -0
  132. package/dist/node/groups/types/IGroupMembershipSummary.js.map +1 -0
  133. package/dist/node/groups/types/index.js +5 -0
  134. package/dist/node/groups/types/index.js.map +1 -0
  135. package/dist/node/index.js +1 -0
  136. package/dist/node/index.js.map +1 -1
  137. package/dist/node/items/_enrichments.js +9 -1
  138. package/dist/node/items/_enrichments.js.map +1 -1
  139. package/dist/node/pages/HubPages.js +65 -0
  140. package/dist/node/pages/HubPages.js.map +1 -0
  141. package/dist/node/pages/index.js +5 -0
  142. package/dist/node/pages/index.js.map +1 -0
  143. package/dist/node/projects/HubProjects.js +57 -1
  144. package/dist/node/projects/HubProjects.js.map +1 -1
  145. package/dist/node/search/_internal/hubSearchItems.js +198 -0
  146. package/dist/node/search/_internal/hubSearchItems.js.map +1 -0
  147. package/dist/node/search/_internal/index.js +3 -0
  148. package/dist/node/search/_internal/index.js.map +1 -1
  149. package/dist/node/search/_internal/parseInclude.js +31 -0
  150. package/dist/node/search/_internal/parseInclude.js.map +1 -0
  151. package/dist/node/search/_internal/portalSearchGroups.js +104 -0
  152. package/dist/node/search/_internal/portalSearchGroups.js.map +1 -0
  153. package/dist/node/search/_internal/portalSearchItems.js +113 -0
  154. package/dist/node/search/_internal/portalSearchItems.js.map +1 -0
  155. package/dist/node/search/_searchContent.js +3 -0
  156. package/dist/node/search/_searchContent.js.map +1 -1
  157. package/dist/node/search/_searchGroups.js +2 -0
  158. package/dist/node/search/_searchGroups.js.map +1 -1
  159. package/dist/node/search/_searchUsers.js +2 -0
  160. package/dist/node/search/_searchUsers.js.map +1 -1
  161. package/dist/node/search/content-utils.js +38 -5
  162. package/dist/node/search/content-utils.js.map +1 -1
  163. package/dist/node/search/filter-utils.js +18 -3
  164. package/dist/node/search/filter-utils.js.map +1 -1
  165. package/dist/node/search/group-utils.js +7 -0
  166. package/dist/node/search/group-utils.js.map +1 -1
  167. package/dist/node/search/hubSearch.js +52 -0
  168. package/dist/node/search/hubSearch.js.map +1 -0
  169. package/dist/node/search/index.js +1 -0
  170. package/dist/node/search/index.js.map +1 -1
  171. package/dist/node/search/user-utils.js +7 -0
  172. package/dist/node/search/user-utils.js.map +1 -1
  173. package/dist/node/search/utils.js +5 -0
  174. package/dist/node/search/utils.js.map +1 -1
  175. package/dist/node/sites/HubSites.js +56 -1
  176. package/dist/node/sites/HubSites.js.map +1 -1
  177. package/dist/node/urls/getGroupHomeUrl.js +16 -0
  178. package/dist/node/urls/getGroupHomeUrl.js.map +1 -0
  179. package/dist/node/urls/index.js +1 -0
  180. package/dist/node/urls/index.js.map +1 -1
  181. package/dist/types/content/HubContent.d.ts +11 -0
  182. package/dist/types/content/index.d.ts +1 -0
  183. package/dist/types/groups/HubGroups.d.ts +11 -0
  184. package/dist/types/groups/_internal/enrichments.d.ts +30 -0
  185. package/dist/types/groups/index.d.ts +2 -0
  186. package/dist/types/groups/types/IGroupMembershipSummary.d.ts +15 -0
  187. package/dist/types/groups/types/index.d.ts +1 -0
  188. package/dist/types/index.d.ts +1 -0
  189. package/dist/types/pages/HubPages.d.ts +11 -0
  190. package/dist/types/pages/index.d.ts +1 -0
  191. package/dist/types/projects/HubProjects.d.ts +10 -1
  192. package/dist/types/search/_internal/hubSearchItems.d.ts +18 -0
  193. package/dist/types/search/_internal/index.d.ts +3 -0
  194. package/dist/types/search/_internal/parseInclude.d.ts +32 -0
  195. package/dist/types/search/_internal/portalSearchGroups.d.ts +9 -0
  196. package/dist/types/search/_internal/portalSearchItems.d.ts +9 -0
  197. package/dist/types/search/content-utils.d.ts +9 -1
  198. package/dist/types/search/hubSearch.d.ts +11 -0
  199. package/dist/types/search/index.d.ts +1 -0
  200. package/dist/types/search/types/ICollection.d.ts +8 -0
  201. package/dist/types/search/types/IHubSearchOptions.d.ts +46 -5
  202. package/dist/types/search/types/IHubSearchResult.d.ts +46 -2
  203. package/dist/types/search/types/types.d.ts +13 -15
  204. package/dist/types/sites/HubSites.d.ts +9 -1
  205. package/dist/types/urls/getGroupHomeUrl.d.ts +10 -0
  206. package/dist/types/urls/index.d.ts +1 -0
  207. package/dist/umd/common.umd.js +8002 -6976
  208. package/dist/umd/common.umd.js.map +1 -1
  209. package/package.json +1 -1
@@ -20,6 +20,7 @@ tslib_1.__exportStar(require("./get-item-data-url"), exports);
20
20
  tslib_1.__exportStar(require("./convert-urls-to-anchor-tags"), exports);
21
21
  tslib_1.__exportStar(require("./getHubApiFromPortalUrl"), exports);
22
22
  tslib_1.__exportStar(require("./getPortalBaseFromOrgUrl"), exports);
23
+ tslib_1.__exportStar(require("./getGroupHomeUrl"), exports);
23
24
  const MAP_OR_FEATURE_SERVER_URL_REGEX = /\/(map|feature)server/i;
24
25
  /**
25
26
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/urls/index.ts"],"names":[],"mappings":";;;;AAAA,kCAAqC;AACrC,sDAA4B;AAC5B,qEAA2C;AAC3C,+DAAqC;AACrC,2DAAiC;AACjC,2DAAiC;AACjC,6DAAmC;AACnC,2DAAiC;AACjC,qEAA2C;AAC3C,0DAAgC;AAChC,wEAA8C;AAC9C,oEAA0C;AAC1C,8DAAoC;AACpC,6DAAmC;AACnC,8DAAoC;AACpC,wEAA8C;AAC9C,mEAAyC;AACzC,oEAA0C;AAE1C,MAAM,+BAA+B,GAAG,wBAAwB,CAAC;AAEjE;;;;GAIG;AACU,QAAA,uBAAuB,GAAG,CAAC,GAAW,EAAE,EAAE;IACrD,OAAO,+BAA+B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACnD,CAAC,CAAC;AAEF;;;;;GAKG;AACU,QAAA,qBAAqB,GAAG,CAAC,GAAW,EAAE,EAAE;IACnD,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACzD,MAAM,YAAY,GAAG,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;IACvC,OAAO,YAAY,IAAI,GAAG,iBAAU,CAAC,YAAY,CAAC,UAAU,CAAC;AAC/D,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/urls/index.ts"],"names":[],"mappings":";;;;AAAA,kCAAqC;AACrC,sDAA4B;AAC5B,qEAA2C;AAC3C,+DAAqC;AACrC,2DAAiC;AACjC,2DAAiC;AACjC,6DAAmC;AACnC,2DAAiC;AACjC,qEAA2C;AAC3C,0DAAgC;AAChC,wEAA8C;AAC9C,oEAA0C;AAC1C,8DAAoC;AACpC,6DAAmC;AACnC,8DAAoC;AACpC,wEAA8C;AAC9C,mEAAyC;AACzC,oEAA0C;AAC1C,4DAAkC;AAElC,MAAM,+BAA+B,GAAG,wBAAwB,CAAC;AAEjE;;;;GAIG;AACU,QAAA,uBAAuB,GAAG,CAAC,GAAW,EAAE,EAAE;IACrD,OAAO,+BAA+B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACnD,CAAC,CAAC;AAEF;;;;;GAKG;AACU,QAAA,qBAAqB,GAAG,CAAC,GAAW,EAAE,EAAE;IACnD,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACzD,MAAM,YAAY,GAAG,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;IACvC,OAAO,YAAY,IAAI,GAAG,iBAAU,CAAC,YAAY,CAAC,UAAU,CAAC;AAC/D,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { IItem } from "@esri/arcgis-rest-types";
2
+ import { IHubSearchResult } from "../search";
3
+ import { IHubRequestOptions } from "../types";
4
+ /**
5
+ * Enrich a generic search result
6
+ * @param item
7
+ * @param includes
8
+ * @param requestOptions
9
+ * @returns
10
+ */
11
+ export declare function enrichContentSearchResult(item: IItem, include: string[], requestOptions: IHubRequestOptions): Promise<IHubSearchResult>;
@@ -7,6 +7,7 @@ export * from "./get-family";
7
7
  export * from "./slugs";
8
8
  export * from "./fetch";
9
9
  export * from "./types";
10
+ export * from "./HubContent";
10
11
  /**
11
12
  * ```js
12
13
  * import { getCategory } from "@esri/hub-common";
@@ -0,0 +1,11 @@
1
+ import { IGroup } from "@esri/arcgis-rest-types";
2
+ import { IHubSearchResult } from "../search";
3
+ import { IHubRequestOptions } from "../types";
4
+ /**
5
+ * Enrich a generic search result
6
+ * @param group
7
+ * @param includes
8
+ * @param requestOptions
9
+ * @returns
10
+ */
11
+ export declare function enrichGroupSearchResult(group: IGroup, include: string[], requestOptions: IHubRequestOptions): Promise<IHubSearchResult>;
@@ -0,0 +1,30 @@
1
+ import { IGroup } from "@esri/arcgis-rest-portal";
2
+ import { IGroupMembershipSummary } from "../..";
3
+ import { IEnrichmentErrorInfo, IHubRequestOptions } from "../../types";
4
+ /**
5
+ * Possible additional properties available through enrichments
6
+ */
7
+ export interface IGroupEnrichments {
8
+ contentCount?: number;
9
+ membershipSummary?: IGroupMembershipSummary;
10
+ /**
11
+ * Any errors encountered when fetching enrichments
12
+ * see https://github.com/ArcGIS/hub-indexer/blob/master/docs/errors.md#response-formatting-for-errors
13
+ */
14
+ errors?: IEnrichmentErrorInfo[];
15
+ }
16
+ export declare type GroupEnrichment = keyof IGroupEnrichments;
17
+ /**
18
+ * Merging of the Enrichment and the Group
19
+ */
20
+ export interface IGroupAndEnrichments extends IGroupEnrichments {
21
+ group: IGroup;
22
+ }
23
+ /**
24
+ * Fetch enrichments for Groups
25
+ * @param group
26
+ * @param enrichments
27
+ * @param requestOptions
28
+ * @returns
29
+ */
30
+ export declare function fetchGroupEnrichments(group: IGroup, enrichments: GroupEnrichment[], requestOptions?: IHubRequestOptions): Promise<IGroupAndEnrichments>;
@@ -1,2 +1,4 @@
1
1
  export * from "./_unprotect-and-remove-group";
2
2
  export * from "./add-users-workflow";
3
+ export * from "./types";
4
+ export * from "./HubGroups";
@@ -0,0 +1,15 @@
1
+ import { IUser } from "@esri/arcgis-rest-portal";
2
+ /**
3
+ * Structure of the `membershipSummary` Group enrichment
4
+ */
5
+ export interface IGroupMembershipSummary {
6
+ /**
7
+ * Total number of members
8
+ */
9
+ total: number;
10
+ /**
11
+ * Up to three group members. Used
12
+ * to display subset of avatars in cards.
13
+ */
14
+ users: IUser[];
15
+ }
@@ -0,0 +1 @@
1
+ export * from "./IGroupMembershipSummary";
@@ -24,6 +24,7 @@ export * from "./urls";
24
24
  export * from "./util";
25
25
  export * from "./utils";
26
26
  export * from "./Hub";
27
+ export * from "./pages";
27
28
  import OperationStack from "./OperationStack";
28
29
  import OperationError from "./OperationError";
29
30
  import HubError from "./HubError";
@@ -0,0 +1,11 @@
1
+ import { IItem } from "@esri/arcgis-rest-types";
2
+ import { IHubSearchResult } from "../search";
3
+ import { IHubRequestOptions } from "../types";
4
+ /**
5
+ * Fetch Page specific Enrichments
6
+ * @param item
7
+ * @param include
8
+ * @param requestOptions
9
+ * @returns
10
+ */
11
+ export declare function enrichPageSearchResult(item: IItem, include: string[], requestOptions: IHubRequestOptions): Promise<IHubSearchResult>;
@@ -0,0 +1 @@
1
+ export * from "./HubPages";
@@ -1,8 +1,9 @@
1
1
  import { IUserRequestOptions } from "@esri/arcgis-rest-auth";
2
- import { Filter, IHubSearchOptions, ISearchResponse } from "..";
2
+ import { Filter, IHubSearchOptions, ISearchResponse, IHubRequestOptions } from "..";
3
3
  import { IItem } from "@esri/arcgis-rest-portal";
4
4
  import { IRequestOptions } from "@esri/arcgis-rest-request";
5
5
  import { IHubProject } from "../core/types";
6
+ import { IHubSearchResult } from "../search";
6
7
  export declare const HUB_PROJECT_ITEM_TYPE = "Hub Project";
7
8
  /**
8
9
  * Create a new Hub Project item
@@ -49,3 +50,11 @@ export declare function searchProjects(filter: Filter<"content">, options: IHubS
49
50
  * @returns
50
51
  */
51
52
  export declare function convertItemToProject(item: IItem, requestOptions: IRequestOptions): Promise<IHubProject>;
53
+ /**
54
+ * Fetch project specific enrichments
55
+ * @param item
56
+ * @param include
57
+ * @param requestOptions
58
+ * @returns
59
+ */
60
+ export declare function enrichProjectSearchResult(item: IItem, include: string[], requestOptions: IHubRequestOptions): Promise<IHubSearchResult>;
@@ -0,0 +1,18 @@
1
+ import { IHubContent } from "../..";
2
+ import { IFilterGroup, IHubSearchOptions, IHubSearchResponse, IHubSearchResult, IFacet } from "../types";
3
+ /**
4
+ * Execute item search against the Hub API
5
+ * @param filter
6
+ * @param options
7
+ * @returns
8
+ */
9
+ export declare function hubSearchItems(filters: Array<IFilterGroup<"item">>, options: IHubSearchOptions): Promise<IHubSearchResponse<IHubSearchResult>>;
10
+ /**
11
+ * Re-structure a jsonApi data entry into a flat object cast into
12
+ * IHubContent
13
+ * @param data
14
+ * @returns
15
+ */
16
+ export declare function jsonApiToHubContent(data: Record<string, any>): IHubContent;
17
+ export declare function hubContentToSearchResult(content: IHubContent): Promise<IHubSearchResult>;
18
+ export declare function convertHubResponseToFacets(response: any, operation?: "OR" | "AND"): IFacet[];
@@ -1,2 +1,5 @@
1
1
  export * from "./searchContentEntities";
2
2
  export * from "./state";
3
+ export * from "./portalSearchItems";
4
+ export * from "./hubSearchItems";
5
+ export * from "./portalSearchGroups";
@@ -0,0 +1,32 @@
1
+ import { ItemOrServerEnrichment } from "../../items/_enrichments";
2
+ /**
3
+ * @private
4
+ */
5
+ export interface IIncludeSpec {
6
+ /**
7
+ * The backing enrichment to fetch - group, data, metadata etc
8
+ */
9
+ enrichment: ItemOrServerEnrichment;
10
+ /**
11
+ * The Path in the backing entity to pluck out
12
+ * If not specified, the entire entity will be returned
13
+ */
14
+ path: string;
15
+ /**
16
+ * Property name to use when attaching the information
17
+ * to the search result object
18
+ */
19
+ prop?: string;
20
+ }
21
+ /**
22
+ * Parse an IncludeSpec from the include string
23
+ * Include String structure:
24
+ * - `enrichment{.deep.path} AS propertyName`
25
+ *
26
+ * Examples
27
+ * - `server.layers.0.name as layerName` -> use the `server` enrichment, extract the name of the first layer and attach that as `layerName`
28
+ * - `server.layers` -> use the `server` enrichment, attach the `layers` array as `layers`
29
+ * @param include
30
+ * @returns
31
+ */
32
+ export declare function parseInclude(include: string): IIncludeSpec;
@@ -0,0 +1,9 @@
1
+ import { IFilterGroup, IHubSearchOptions, IHubSearchResponse, IHubSearchResult } from "../types";
2
+ /**
3
+ * @private
4
+ * Portal Search Implementation for Items
5
+ * @param filterGroups
6
+ * @param options
7
+ * @returns
8
+ */
9
+ export declare function portalSearchGroups(filterGroups: Array<IFilterGroup<"group">>, options: IHubSearchOptions): Promise<IHubSearchResponse<IHubSearchResult>>;
@@ -0,0 +1,9 @@
1
+ import { IFilterGroup, IHubSearchOptions, IHubSearchResponse, IHubSearchResult } from "../types";
2
+ /**
3
+ * @private
4
+ * Portal Search Implementation for Items
5
+ * @param filterGroups
6
+ * @param options
7
+ * @returns
8
+ */
9
+ export declare function portalSearchItems(filterGroups: Array<IFilterGroup<"item">>, options: IHubSearchOptions): Promise<IHubSearchResponse<IHubSearchResult>>;
@@ -4,11 +4,19 @@ import { IFacet } from "./types/IFacet";
4
4
  /**
5
5
  * @private
6
6
  * Convert portal search response to facets
7
- * Note: Only applicable to a "content" search
7
+ * Note: Only applicable to an item search
8
8
  * @param response
9
9
  * @returns
10
10
  */
11
11
  export declare function convertPortalResponseToFacets(response: ISearchResult<IItem>, operation?: "OR" | "AND"): IFacet[];
12
+ /**
13
+ * @private
14
+ * Convert portal search response to facets
15
+ * Note: Only applicable to an item search
16
+ * @param response
17
+ * @returns
18
+ */
19
+ export declare function convertPortalItemResponseToFacets(response: ISearchResult<IItem>, operation?: "OR" | "AND", optionProp?: "filter" | "filters"): IFacet[];
12
20
  /**
13
21
  * Merge `Filter<"content">` objects
14
22
  *
@@ -0,0 +1,11 @@
1
+ import { IFilterGroup, FilterType, IHubSearchOptions, IHubSearchResponse, IHubSearchResult } from "./types";
2
+ /**
3
+ * Main Search function for ArcGIS Hub
4
+ *
5
+ * Default's to search ArcGIS Portal but can delegate
6
+ * to Hub API when it's available.
7
+ * @param filterGroups
8
+ * @param options
9
+ * @returns
10
+ */
11
+ export declare function hubSearch(filterGroups: Array<IFilterGroup<FilterType>>, options: IHubSearchOptions): Promise<IHubSearchResponse<IHubSearchResult>>;
@@ -10,3 +10,4 @@ export * from "./types";
10
10
  export * from "./collectionState";
11
11
  export * from "./convertCatalog";
12
12
  export * from "./filter-utils";
13
+ export * from "./hubSearch";
@@ -7,6 +7,14 @@ import { Filter, FilterType, ISortOption } from "./types";
7
7
  export interface ICollection {
8
8
  label: string;
9
9
  key: string;
10
+ /**
11
+ * Filter Type used in this collection
12
+ */
13
+ filterType?: FilterType;
14
+ /**
15
+ * Specify the includes to be requested when working with this collection
16
+ */
17
+ include?: string[];
10
18
  defaultQuery?: string;
11
19
  sortOption: ISortOption;
12
20
  filter: Filter<FilterType>;
@@ -1,26 +1,67 @@
1
1
  import { UserSession } from "@esri/arcgis-rest-auth";
2
- import { IModel } from "../..";
2
+ import { IHubRequestOptions, IModel } from "../..";
3
3
  import { NamedApis, IApiDefinition } from "./types";
4
- /**
5
- * Requestable Enrichments
6
- */
7
4
  export declare type Enrichments = "data" | "metadata" | "org" | "service" | "layers";
8
5
  /**
9
6
  * Search Options
10
7
  */
11
8
  export interface IHubSearchOptions {
9
+ /**
10
+ * Fields to return aggregations on
11
+ */
12
12
  aggFields?: string[];
13
+ /**
14
+ * Maximum number of aggregations to return
15
+ * Portal API only supports a single value
16
+ */
13
17
  aggLimit?: number;
18
+ /**
19
+ * Deprecate in favor of context
20
+ */
14
21
  api?: NamedApis | IApiDefinition;
22
+ /**
23
+ * TODO: Deprecate in requestOptions
24
+ */
15
25
  authentication?: UserSession;
26
+ /**
27
+ * While hubSearch requires requestOptions, it is not marked
28
+ * required because that is a breaking change to this
29
+ * interface, which is still required while we implement
30
+ * hubSearch
31
+ */
32
+ requestOptions?: IHubRequestOptions;
16
33
  bbox?: string;
34
+ /**
35
+ * Objects or fields to include
36
+ * e.g. `server.layers AS serverLayers`
37
+ */
38
+ include?: string[];
39
+ /**
40
+ * Enrichments
41
+ * Deprecated in favor of `include`
42
+ */
17
43
  enrichments?: Enrichments[];
18
- fields?: string;
44
+ /**
45
+ * Maximum number of results to return, per-page
46
+ */
19
47
  num?: number;
48
+ /**
49
+ * What page of results to return
50
+ */
20
51
  page?: string;
52
+ /**
53
+ * What field should the results be sorted on
54
+ */
21
55
  sortField?: string;
56
+ /**
57
+ * Sort direction
58
+ */
22
59
  sortOrder?: "desc" | "asc";
60
+ /**
61
+ * TODO: Determine if this is used or can be removed
62
+ */
23
63
  start?: number;
24
64
  aggregations?: string[];
25
65
  site?: IModel;
66
+ fields?: string;
26
67
  }
@@ -1,5 +1,18 @@
1
1
  import { HubFamily, IHubGeography } from "../..";
2
2
  import { AccessLevel, IHubEntityBase } from "../../core";
3
+ /**
4
+ * Simple interface for Links
5
+ */
6
+ export interface ILink {
7
+ /**
8
+ * Link url
9
+ */
10
+ href: string;
11
+ /**
12
+ * Additional optional properties
13
+ */
14
+ [key: string]: string;
15
+ }
3
16
  /**
4
17
  * Standardized light-weight search result structure, applicable to all
5
18
  * types of search results - users, groups, content, events etc
@@ -18,20 +31,24 @@ export interface IHubSearchResult extends IHubEntityBase {
18
31
  */
19
32
  owner?: string;
20
33
  /**
34
+ * DEPRECATED use links.thumbnail
21
35
  * Fully qualified thumbnail url for items, groups, users
22
36
  * Will not have the token appended. Consuming app needs to
23
37
  * check the value of `access` and apply the token as needed
24
38
  */
25
- thumbnailUrl: string;
39
+ thumbnailUrl?: string;
26
40
  /**
41
+ * DEPRECATED - use links
27
42
  * Hash of pre-computed urls
28
43
  */
29
- urls: {
44
+ urls?: {
30
45
  /**
46
+ * DEPRECATED - use links
31
47
  * Canononical ArcGIS Online Url for this entity (if applicable)
32
48
  */
33
49
  portalHome?: string;
34
50
  /**
51
+ * DEPRECATED - use links
35
52
  * Relative url, which can be appended to a Site's root Url
36
53
  * e.g. /datasets/3ef8c7a, or /events/june-meeting
37
54
  * This is much easier than passing a Site into the search
@@ -39,11 +56,35 @@ export interface IHubSearchResult extends IHubEntityBase {
39
56
  */
40
57
  relative: string;
41
58
  /**
59
+ * DEPRECATED - use links
42
60
  * Allow for arbitrary other urls, including `.customUrl` which
43
61
  * can ben generated client-side in the gallery via a callback
44
62
  */
45
63
  [key: string]: string;
46
64
  };
65
+ /**
66
+ * Links to related things
67
+ */
68
+ links?: {
69
+ /**
70
+ * Url to Thumbnail. Will not include a token
71
+ */
72
+ thumbnail?: string;
73
+ /**
74
+ * Url to the entities canonical "self"
75
+ * For Items/Groups/Users, this will be the Home App url
76
+ * For other entities, it will be the canonical url
77
+ */
78
+ self: string;
79
+ /**
80
+ * Relative url of the entity, within a site
81
+ */
82
+ siteRelative: string;
83
+ /**
84
+ * Additional urls
85
+ */
86
+ [key: string]: string | ILink;
87
+ };
47
88
  /**
48
89
  * Geometry connected to this entity
49
90
  * For items, it will default to the extent,
@@ -52,9 +93,12 @@ export interface IHubSearchResult extends IHubEntityBase {
52
93
  */
53
94
  geometry?: IHubGeography;
54
95
  /**
96
+ * DEPRECATED - includes/enrichments are directly attached
55
97
  * Optional metadata hash
56
98
  * Any specified enrichments will be attached in here, as well
57
99
  * as tags, typekeywords and culture
58
100
  */
59
101
  metadata?: Record<string, any>;
102
+ /** Allow any additional properties to be added */
103
+ [key: string]: any;
60
104
  }
@@ -6,8 +6,7 @@ import { IFacet } from "./IFacet";
6
6
  *
7
7
  * `Filter<T extends FilterType>` [FilterType](../FilterType) is constrained to
8
8
  *
9
- * - `Filter<"any">` [IAnyFilterDefinition](../IAnyFilterDefinition)
10
- * - `Filter<"content">` [IContentFilterDefinition](../IContentFilterDefinition)
9
+ * - `Filter<"item">` [IContentFilterDefinition](../IContentFilterDefinition)
11
10
  * - `Filter<"user">` [IUserFilterDefinition](../IUserFilterDefinition)
12
11
  * - `Filter<"group">` [IGroupFilterDefinition](../IGroupFilterDefinition)
13
12
  *
@@ -15,8 +14,8 @@ import { IFacet } from "./IFacet";
15
14
  * and it must be `keyof` [FilterTypeMap](../FilterTypeMap)
16
15
  *
17
16
  * ```ts
18
- * const f:Filter<"content"> = {
19
- * filterType: "content" // must match the FilterType
17
+ * const f:Filter<"item"> = {
18
+ * filterType: "item" // must match the FilterType
20
19
  * term: "water"
21
20
  * }
22
21
  * ```
@@ -24,15 +23,12 @@ import { IFacet } from "./IFacet";
24
23
  export declare type Filter<T extends FilterType> = IFilterTypeMap[T] & {
25
24
  filterType: T;
26
25
  };
27
- export interface IFilterGroup<T extends FilterType> {
28
- operation?: "AND" | "OR";
29
- filters: Array<Filter<T>>;
30
- }
31
26
  /**
32
27
  * Groups of filters with an operation specifying how the
33
28
  * filters should be connected when serialized
34
29
  */
35
30
  export interface IFilterGroup<T extends FilterType> {
31
+ filterType: T;
36
32
  operation?: "AND" | "OR";
37
33
  filters: Array<Filter<T>>;
38
34
  }
@@ -42,23 +38,21 @@ export interface IFilterGroup<T extends FilterType> {
42
38
  */
43
39
  export interface IFilterTypeMap {
44
40
  item: IItemFilter;
41
+ user: IUserFilterDefinition;
42
+ group: IGroupFilterDefinition;
43
+ event: IEventFilterDefinition;
45
44
  /**
46
45
  * DEPRECATED use item
46
+ * // TODO: Remove with _searchContent
47
47
  */
48
48
  content: IContentFilterDefinition;
49
- user: IUserFilterDefinition;
50
- group: IGroupFilterDefinition;
51
- event: IEventFilterDefinition;
52
49
  }
53
50
  export declare type FilterType = keyof IFilterTypeMap;
54
- /**
55
- * Common set of fields that are reasonable to apply at the
56
- * top level of a Catalog
57
- */
58
51
  export interface IItemFilter {
59
52
  access?: AccessLevel | AccessLevel[] | IMatchOptions;
60
53
  owner?: string | string[] | IMatchOptions;
61
54
  tags?: string | string[] | IMatchOptions;
55
+ categories?: string | string[] | IMatchOptions;
62
56
  created?: IDateRange<number> | IRelativeDate;
63
57
  description?: string | string[] | IMatchOptions;
64
58
  snippet?: string | string[] | IMatchOptions;
@@ -74,11 +68,13 @@ export interface IItemFilter {
74
68
  }
75
69
  /**
76
70
  * Fields related to Content based searches
71
+ * // TODO: Remove with _searchContent
77
72
  */
78
73
  export interface IContentFilterDefinition {
79
74
  access?: string | string[] | IMatchOptions;
80
75
  owner?: string | string[] | IMatchOptions;
81
76
  tags?: string | string[] | IMatchOptions;
77
+ categories?: string | string[] | IMatchOptions;
82
78
  created?: IDateRange<number> | IRelativeDate;
83
79
  description?: string | string[] | IMatchOptions;
84
80
  snippet?: string | string[] | IMatchOptions;
@@ -153,6 +149,7 @@ export interface IGroupFilterDefinition {
153
149
  term?: string;
154
150
  title?: string | string[] | IMatchOptions;
155
151
  typekeywords?: string | string[] | IMatchOptions;
152
+ isopendata?: boolean;
156
153
  }
157
154
  export interface IEventFilterDefinition {
158
155
  created?: IDateRange<number> | IRelativeDate;
@@ -216,6 +213,7 @@ export interface IMatchOptions {
216
213
  }
217
214
  /**
218
215
  * searchContent return
216
+ * // TODO: Remove with _searchContent
219
217
  */
220
218
  export interface IContentSearchResult {
221
219
  total: number;
@@ -1,5 +1,5 @@
1
1
  import { IItem } from "@esri/arcgis-rest-portal";
2
- import { Filter, IHubRequestOptions, IHubSearchOptions, IHubSite, ISearchResponse } from "..";
2
+ import { Filter, IHubRequestOptions, IHubSearchOptions, IHubSearchResult, IHubSite, ISearchResponse } from "..";
3
3
  import { IRequestOptions } from "@esri/arcgis-rest-request";
4
4
  export declare const HUB_SITE_ITEM_TYPE = "Hub Site Application";
5
5
  export declare const ENTERPRISE_SITE_ITEM_TYPE = "Site Application";
@@ -54,3 +54,11 @@ export declare function convertItemToSite(item: IItem, requestOptions: IRequestO
54
54
  * @returns
55
55
  */
56
56
  export declare function searchSites(filter: Filter<"content">, options: IHubSearchOptions): Promise<ISearchResponse<IHubSite>>;
57
+ /**
58
+ * Fetch Site specific enrichments
59
+ * @param item
60
+ * @param include
61
+ * @param requestOptions
62
+ * @returns
63
+ */
64
+ export declare function enrichSiteSearchResult(item: IItem, include: string[], requestOptions: IHubRequestOptions): Promise<IHubSearchResult>;
@@ -0,0 +1,10 @@
1
+ import { IRequestOptions } from "@esri/arcgis-rest-request";
2
+ import { IPortal } from "@esri/arcgis-rest-portal";
3
+ import { IHubRequestOptions } from "../types";
4
+ /**
5
+ * Return the URL of the group's page in the Portal Home application
6
+ * @param groupId The group's ID
7
+ * @param portalUrlOrObject a portal base or API URL, a portal object, or request options containing either of those
8
+ * @returns URL to the groups's url, defaults to `https://www.arcgis.com/home/group.html?id={group.id}`
9
+ */
10
+ export declare function getGroupHomeUrl(groupId: string, portalUrlOrObject?: string | IPortal | IHubRequestOptions | IRequestOptions): string;
@@ -15,6 +15,7 @@ export * from "./get-item-data-url";
15
15
  export * from "./convert-urls-to-anchor-tags";
16
16
  export * from "./getHubApiFromPortalUrl";
17
17
  export * from "./getPortalBaseFromOrgUrl";
18
+ export * from "./getGroupHomeUrl";
18
19
  /**
19
20
  *
20
21
  * @param url