@esri/hub-common 9.26.2 → 9.29.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 (108) hide show
  1. package/dist/es2017/search/_internal/index.js +3 -0
  2. package/dist/es2017/search/_internal/index.js.map +1 -0
  3. package/dist/es2017/search/_internal/searchContentEntities.js +15 -5
  4. package/dist/es2017/search/_internal/searchContentEntities.js.map +1 -1
  5. package/dist/es2017/search/_internal/state.js +147 -0
  6. package/dist/es2017/search/_internal/state.js.map +1 -0
  7. package/dist/es2017/search/_searchContent.js +11 -4
  8. package/dist/es2017/search/_searchContent.js.map +1 -1
  9. package/dist/es2017/search/collectionState.js +60 -0
  10. package/dist/es2017/search/collectionState.js.map +1 -0
  11. package/dist/es2017/search/content-utils.js +14 -7
  12. package/dist/es2017/search/content-utils.js.map +1 -1
  13. package/dist/es2017/search/convertCatalog.js +23 -0
  14. package/dist/es2017/search/convertCatalog.js.map +1 -0
  15. package/dist/es2017/search/index.js +3 -1
  16. package/dist/es2017/search/index.js.map +1 -1
  17. package/dist/es2017/search/types/ICatalog.js +1 -0
  18. package/dist/es2017/search/types/ICatalog.js.map +1 -0
  19. package/dist/es2017/search/types/ICollection.js +1 -0
  20. package/dist/es2017/search/types/ICollection.js.map +1 -0
  21. package/dist/es2017/search/types/IFacet.js +1 -0
  22. package/dist/es2017/search/types/IFacet.js.map +1 -0
  23. package/dist/es2017/search/types/IFacetOption.js +1 -0
  24. package/dist/es2017/search/types/IFacetOption.js.map +1 -0
  25. package/dist/es2017/search/types/index.js +6 -0
  26. package/dist/es2017/search/types/index.js.map +1 -0
  27. package/dist/es2017/search/{types.js → types/types.js} +0 -0
  28. package/dist/{node/search → es2017/search/types}/types.js.map +1 -1
  29. package/dist/es2017/search/utils.js.map +1 -1
  30. package/dist/esm/search/_internal/index.js +3 -0
  31. package/dist/esm/search/_internal/index.js.map +1 -0
  32. package/dist/esm/search/_internal/searchContentEntities.js +15 -6
  33. package/dist/esm/search/_internal/searchContentEntities.js.map +1 -1
  34. package/dist/esm/search/_internal/state.js +147 -0
  35. package/dist/esm/search/_internal/state.js.map +1 -0
  36. package/dist/esm/search/_searchContent.js +12 -5
  37. package/dist/esm/search/_searchContent.js.map +1 -1
  38. package/dist/esm/search/collectionState.js +61 -0
  39. package/dist/esm/search/collectionState.js.map +1 -0
  40. package/dist/esm/search/content-utils.js +15 -7
  41. package/dist/esm/search/content-utils.js.map +1 -1
  42. package/dist/esm/search/convertCatalog.js +23 -0
  43. package/dist/esm/search/convertCatalog.js.map +1 -0
  44. package/dist/esm/search/index.js +3 -1
  45. package/dist/esm/search/index.js.map +1 -1
  46. package/dist/esm/search/types/ICatalog.js +1 -0
  47. package/dist/esm/search/types/ICatalog.js.map +1 -0
  48. package/dist/esm/search/types/ICollection.js +1 -0
  49. package/dist/esm/search/types/ICollection.js.map +1 -0
  50. package/dist/esm/search/types/IFacet.js +1 -0
  51. package/dist/esm/search/types/IFacet.js.map +1 -0
  52. package/dist/esm/search/types/IFacetOption.js +1 -0
  53. package/dist/esm/search/types/IFacetOption.js.map +1 -0
  54. package/dist/esm/search/types/index.js +6 -0
  55. package/dist/esm/search/types/index.js.map +1 -0
  56. package/dist/esm/search/{types.js → types/types.js} +0 -0
  57. package/dist/{es2017/search → esm/search/types}/types.js.map +1 -1
  58. package/dist/esm/search/utils.js.map +1 -1
  59. package/dist/node/search/_internal/index.js +6 -0
  60. package/dist/node/search/_internal/index.js.map +1 -0
  61. package/dist/node/search/_internal/searchContentEntities.js +14 -4
  62. package/dist/node/search/_internal/searchContentEntities.js.map +1 -1
  63. package/dist/node/search/_internal/state.js +158 -0
  64. package/dist/node/search/_internal/state.js.map +1 -0
  65. package/dist/node/search/_searchContent.js +13 -6
  66. package/dist/node/search/_searchContent.js.map +1 -1
  67. package/dist/node/search/collectionState.js +65 -0
  68. package/dist/node/search/collectionState.js.map +1 -0
  69. package/dist/node/search/content-utils.js +14 -7
  70. package/dist/node/search/content-utils.js.map +1 -1
  71. package/dist/node/search/convertCatalog.js +27 -0
  72. package/dist/node/search/convertCatalog.js.map +1 -0
  73. package/dist/node/search/index.js +3 -1
  74. package/dist/node/search/index.js.map +1 -1
  75. package/dist/node/search/types/ICatalog.js +3 -0
  76. package/dist/node/search/types/ICatalog.js.map +1 -0
  77. package/dist/node/search/types/ICollection.js +3 -0
  78. package/dist/node/search/types/ICollection.js.map +1 -0
  79. package/dist/node/search/types/IFacet.js +3 -0
  80. package/dist/node/search/types/IFacet.js.map +1 -0
  81. package/dist/node/search/types/IFacetOption.js +3 -0
  82. package/dist/node/search/types/IFacetOption.js.map +1 -0
  83. package/dist/node/search/types/index.js +9 -0
  84. package/dist/node/search/types/index.js.map +1 -0
  85. package/dist/node/search/{types.js → types/types.js} +0 -0
  86. package/dist/{esm/search → node/search/types}/types.js.map +1 -1
  87. package/dist/node/search/utils.js.map +1 -1
  88. package/dist/types/core/types/IHubEntityManager.d.ts +1 -1
  89. package/dist/types/search/_internal/index.d.ts +2 -0
  90. package/dist/types/search/_internal/searchContentEntities.d.ts +1 -1
  91. package/dist/types/search/_internal/state.d.ts +62 -0
  92. package/dist/types/search/_searchGroups.d.ts +1 -1
  93. package/dist/types/search/collectionState.d.ts +19 -0
  94. package/dist/types/search/content-utils.d.ts +6 -4
  95. package/dist/types/search/convertCatalog.d.ts +6 -0
  96. package/dist/types/search/index.d.ts +3 -1
  97. package/dist/types/search/types/ICatalog.d.ts +76 -0
  98. package/dist/types/search/types/ICollection.d.ts +14 -0
  99. package/dist/types/search/types/IFacet.d.ts +15 -0
  100. package/dist/types/search/types/IFacetOption.d.ts +8 -0
  101. package/dist/types/search/types/index.d.ts +5 -0
  102. package/dist/types/search/{types.d.ts → types/types.d.ts} +23 -86
  103. package/dist/types/search/utils.d.ts +1 -1
  104. package/dist/umd/common.umd.js +256 -17
  105. package/dist/umd/common.umd.js.map +1 -1
  106. package/dist/umd/common.umd.min.js +1 -1
  107. package/dist/umd/common.umd.min.js.map +1 -1
  108. package/package.json +1 -1
@@ -0,0 +1,19 @@
1
+ import { ICollection, ICollectionState } from "./types";
2
+ /**
3
+ * Apply ICollectionState to an ICollection
4
+ *
5
+ * Typically used in a Gallery or Catalog component to
6
+ * set the inital state, based on values deserialized
7
+ * from a query string
8
+ * @param collection
9
+ * @param state
10
+ * @returns
11
+ */
12
+ export declare function applyCollectionState(collection: ICollection, state: ICollectionState): ICollection;
13
+ /**
14
+ * Serialize the current state of a collection into a hash that
15
+ * can be converted into a query string
16
+ * @param collection
17
+ * @returns
18
+ */
19
+ export declare function serializeCollectionState(collection: ICollection): ICollectionState;
@@ -1,12 +1,14 @@
1
- import { IGroup, IItem, ISearchOptions, ISearchResult } from "@esri/arcgis-rest-portal";
2
- import { IContentFilter, IContentFilterDefinition, Filter, IFacet } from "./types";
1
+ import { IItem, ISearchOptions, ISearchResult } from "@esri/arcgis-rest-portal";
2
+ import { IContentFilter, IContentFilterDefinition, Filter } from "./types/types";
3
+ import { IFacet } from "./types/IFacet";
3
4
  /**
4
5
  * @private
5
- * Convert portal search response to items
6
+ * Convert portal search response to facets
7
+ * Note: Only applicable to a "content" search
6
8
  * @param response
7
9
  * @returns
8
10
  */
9
- export declare function convertPortalResponseToFacets(response: ISearchResult<IItem> | ISearchResult<IGroup>): IFacet[];
11
+ export declare function convertPortalResponseToFacets(response: ISearchResult<IItem>, operation?: "OR" | "AND"): IFacet[];
10
12
  /**
11
13
  * Merge `Filter<"content">` objects
12
14
  *
@@ -0,0 +1,6 @@
1
+ import { ICatalog } from "./types";
2
+ /**
3
+ * Convert the original site catalog structure into a formal ICatalog
4
+ * @param original
5
+ */
6
+ export declare function convertCatalog(original: any): ICatalog;
@@ -3,7 +3,9 @@ export * from "./content-utils";
3
3
  export * from "./group-utils";
4
4
  export * from "./user-utils";
5
5
  export * from "./utils";
6
- export * from "./types";
7
6
  export * from "./_searchContent";
8
7
  export * from "./_searchGroups";
9
8
  export * from "./_searchUsers";
9
+ export * from "./types";
10
+ export * from "./collectionState";
11
+ export * from "./convertCatalog";
@@ -0,0 +1,76 @@
1
+ import { ICollection } from "./ICollection";
2
+ import { IFacet } from "./IFacet";
3
+ import { Filter, FilterType, ISortOption } from "./types";
4
+ /**
5
+ * Catalog is the definition which powers what options
6
+ * are available in a Gallery. It controls not only
7
+ * the scoping of the search, but also the options
8
+ * available to the UX.
9
+ *
10
+ * Thus the lower-level `searchContent`, `searchUser`, `searchGroup` functions
11
+ * do not take Catalogs, rather they accept [Filters](../Filter)
12
+ *
13
+ * ```ts
14
+ * const simpleCatalog:Catalog = {
15
+ * title: "Select Map",
16
+ * filter: {
17
+ * filterType: "content",
18
+ * type: "Web Map",
19
+ * owner: "jsmith"
20
+ * }
21
+ * }
22
+ * ```
23
+ *
24
+ * ## Collections
25
+ * The key feature of a Catalog is the ability to defined [Collections](../Collection).
26
+ * These are essentially sub-sets of content, typically organized around
27
+ * generalized content types, i.e. "Datasets", vs "Maps", vs "Documents"
28
+ *
29
+ *
30
+ * ```ts
31
+ * const complex:Catalog = {
32
+ * filter: {
33
+ * type: "content",
34
+ * groups: ["3ef", "bc4"]
35
+ * },
36
+ * collections: [
37
+ * {
38
+ * label: "Documents",
39
+ * filter: {
40
+ * filterType: "content",
41
+ * type: ["Microsoft Word", "PDF", "Microsoft Excel"]
42
+ * }
43
+ * },
44
+ * {
45
+ * label: "Datasets",
46
+ * filter: {
47
+ * filterType: "content",
48
+ * type: ["Feature Layer", "Feature Service", "Map Service", "CSV"]
49
+ * }
50
+ * }
51
+ * ]
52
+ * }
53
+ * ```
54
+ */
55
+ export interface ICatalog {
56
+ /**
57
+ * Title for the Gallery
58
+ */
59
+ title?: string;
60
+ /**
61
+ * Filter defines the "scope" of the Catalog, typically a set of groups or orgids
62
+ */
63
+ filter: Filter<FilterType>;
64
+ /**
65
+ * Sort options to be shown in the Gallery
66
+ */
67
+ sort?: ISortOption[];
68
+ /**
69
+ * Collections within the Catalog
70
+ */
71
+ collections?: ICollection[];
72
+ /**
73
+ * Facets to use with all Collections
74
+ */
75
+ facets?: IFacet[];
76
+ }
@@ -0,0 +1,14 @@
1
+ import { IFacet } from "./IFacet";
2
+ import { Filter, FilterType, ISortOption } from "./types";
3
+ /**
4
+ * A Collection is a subset of a Catalog, but can be used independently
5
+ * in Galleries
6
+ */
7
+ export interface ICollection {
8
+ label: string;
9
+ key: string;
10
+ defaultQuery?: string;
11
+ sortOption: ISortOption;
12
+ filter: Filter<FilterType>;
13
+ facets?: IFacet[];
14
+ }
@@ -0,0 +1,15 @@
1
+ import { IFacetOption } from "./IFacetOption";
2
+ export interface IFacet {
3
+ label: string;
4
+ key: string;
5
+ aggField?: string;
6
+ aggLimit?: number;
7
+ display: "single-select" | "multi-select" | "date-range" | "histogram";
8
+ state?: "open" | "closed";
9
+ options?: IFacetOption[];
10
+ operation?: ("OR" | "AND")[];
11
+ optionLimit?: number;
12
+ accordionClosed?: boolean;
13
+ type?: "single-select" | "multi-select" | "date-range" | "histogram";
14
+ pageSize?: number;
15
+ }
@@ -0,0 +1,8 @@
1
+ import { Filter, FilterType } from "./types";
2
+ export interface IFacetOption {
3
+ label: string;
4
+ key: string;
5
+ count?: number;
6
+ selected: boolean;
7
+ filter: Filter<FilterType>;
8
+ }
@@ -0,0 +1,5 @@
1
+ export * from "./ICatalog";
2
+ export * from "./ICollection";
3
+ export * from "./IFacet";
4
+ export * from "./IFacetOption";
5
+ export * from "./types";
@@ -1,5 +1,6 @@
1
1
  import { UserSession } from "@esri/arcgis-rest-auth";
2
- import { IHubContent, IModel } from "..";
2
+ import { IHubContent, IModel } from "../..";
3
+ import { IFacet } from "./IFacet";
3
4
  /**
4
5
  * Generic filter used with various search functions.
5
6
  *
@@ -139,82 +140,6 @@ export interface IEventFilterDefinition {
139
140
  orgid?: string | string[] | IMatchOptions;
140
141
  title?: string | string[] | IMatchOptions;
141
142
  }
142
- export interface IFacet {
143
- label: string;
144
- attribute?: string;
145
- type: "single-select" | "multi-select" | "date-range" | "histogram";
146
- options?: IFacetOption[];
147
- accordionClosed?: boolean;
148
- pageSize?: number;
149
- }
150
- export interface IFacetOption {
151
- label: string;
152
- value: string;
153
- count?: number;
154
- selected: boolean;
155
- filter: Filter<FilterType>;
156
- }
157
- /**
158
- * Catalog is the definition which powers what options
159
- * are available in a Gallery. It controls not only
160
- * the scoping of the search, but also the options
161
- * available to the UX.
162
- *
163
- * Thus the lower-level `searchContent`, `searchUser`, `searchGroup` functions
164
- * do not take Catalogs, rather they accept [Filters](../Filter)
165
- *
166
- * ```ts
167
- * const simpleCatalog:Catalog = {
168
- * title: "Select Map",
169
- * filter: {
170
- * filterType: "content",
171
- * type: "Web Map",
172
- * owner: "jsmith"
173
- * }
174
- * }
175
- * ```
176
- *
177
- * ## Collections
178
- * The key feature of a Catalog is the ability to defined [Collections](../Collection).
179
- * These are essentially sub-sets of content, typically organized around
180
- * generalized content types, i.e. "Datasets", vs "Maps", vs "Documents"
181
- *
182
- *
183
- * ```ts
184
- * const complex:Catalog = {
185
- * filter: {
186
- * type: "content",
187
- * groups: ["3ef", "bc4"]
188
- * },
189
- * collections: [
190
- * {
191
- * label: "Documents",
192
- * filter: {
193
- * filterType: "content",
194
- * type: ["Microsoft Word", "PDF", "Microsoft Excel"]
195
- * }
196
- * },
197
- * {
198
- * label: "Datasets",
199
- * filter: {
200
- * filterType: "content",
201
- * type: ["Feature Layer", "Feature Service", "Map Service", "CSV"]
202
- * }
203
- * }
204
- * ]
205
- * }
206
- * ```
207
- */
208
- export interface ICatalog {
209
- /**
210
- * Title for the Gallery
211
- */
212
- title?: string;
213
- filter: Filter<FilterType>;
214
- sort?: ISortOption[];
215
- collections?: ICollection[];
216
- facets?: IFacet[];
217
- }
218
143
  /**
219
144
  * Sort Option to be displayed in a UI
220
145
  */
@@ -224,14 +149,6 @@ export interface ISortOption {
224
149
  defaultOrder: string;
225
150
  order: string;
226
151
  }
227
- /**
228
- * A Filter that defines a subset of a Catalog, aka a Collection
229
- */
230
- export interface ICollection {
231
- label: string;
232
- filter: Filter<FilterType>;
233
- facets?: IFacet[];
234
- }
235
152
  /**
236
153
  * Defines a span of time by specifying a `from` and `to` Date
237
154
  * as either a number or a ISO string
@@ -288,10 +205,12 @@ export interface IHubSearchOptions {
288
205
  page?: string;
289
206
  start?: number;
290
207
  num?: number;
291
- aggregations?: string[];
208
+ aggFields?: string[];
209
+ aggLimit?: number;
292
210
  bbox?: string;
293
211
  fields?: string;
294
212
  api?: NamedApis | IApiDefinition;
213
+ aggregations?: string[];
295
214
  }
296
215
  /**
297
216
  * searchContent return
@@ -318,3 +237,21 @@ export interface IApiDefinition {
318
237
  type: "arcgis" | "arcgis-hub";
319
238
  authentication?: UserSession;
320
239
  }
240
+ export interface IFacetState {
241
+ [key: string]: string;
242
+ }
243
+ export interface ICollectionState {
244
+ query?: string;
245
+ sort?: string;
246
+ [key: string]: string;
247
+ }
248
+ export interface ICatalogState {
249
+ collection: string;
250
+ collectionState?: ICollectionState;
251
+ }
252
+ /**
253
+ * Generic key/value type for storing component state
254
+ */
255
+ export interface IComponentState {
256
+ [key: string]: string;
257
+ }
@@ -1,7 +1,7 @@
1
1
  import { IUser } from "@esri/arcgis-rest-auth";
2
2
  import { IGroup, ISearchOptions } from "@esri/arcgis-rest-portal";
3
3
  import { ISearchResponse } from "../types";
4
- import { IMatchOptions, IDateRange, IRelativeDate, IWellKnownApis, IApiDefinition, NamedApis } from "./types";
4
+ import { IMatchOptions, IDateRange, IRelativeDate, IWellKnownApis, IApiDefinition, NamedApis } from "./types/types";
5
5
  /**
6
6
  * Well known APIs
7
7
  * Short-forms for specifying common APIs