@esri/hub-common 9.45.2 → 9.45.5

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 (70) hide show
  1. package/dist/es2017/search/_internal/index.js +1 -0
  2. package/dist/es2017/search/_internal/index.js.map +1 -1
  3. package/dist/es2017/search/_internal/ipredicate-utils.js +38 -0
  4. package/dist/es2017/search/_internal/ipredicate-utils.js.map +1 -0
  5. package/dist/es2017/search/_internal/portalSearchGroups.js +3 -57
  6. package/dist/es2017/search/_internal/portalSearchGroups.js.map +1 -1
  7. package/dist/es2017/search/_internal/portalSearchItems.js +3 -88
  8. package/dist/es2017/search/_internal/portalSearchItems.js.map +1 -1
  9. package/dist/es2017/search/_internal/portalSearchUsers.js +2 -44
  10. package/dist/es2017/search/_internal/portalSearchUsers.js.map +1 -1
  11. package/dist/es2017/search/filter-utils.js +0 -197
  12. package/dist/es2017/search/filter-utils.js.map +1 -1
  13. package/dist/es2017/search/hubSearch.js +9 -38
  14. package/dist/es2017/search/hubSearch.js.map +1 -1
  15. package/dist/es2017/search/{_internal/ifilter-utils.js → ifilter-utils.js} +2 -37
  16. package/dist/es2017/search/ifilter-utils.js.map +1 -0
  17. package/dist/es2017/search/index.js +1 -0
  18. package/dist/es2017/search/index.js.map +1 -1
  19. package/dist/esm/search/_internal/index.js +1 -0
  20. package/dist/esm/search/_internal/index.js.map +1 -1
  21. package/dist/esm/search/_internal/ipredicate-utils.js +40 -0
  22. package/dist/esm/search/_internal/ipredicate-utils.js.map +1 -0
  23. package/dist/esm/search/_internal/portalSearchGroups.js +3 -58
  24. package/dist/esm/search/_internal/portalSearchGroups.js.map +1 -1
  25. package/dist/esm/search/_internal/portalSearchItems.js +3 -89
  26. package/dist/esm/search/_internal/portalSearchItems.js.map +1 -1
  27. package/dist/esm/search/_internal/portalSearchUsers.js +2 -46
  28. package/dist/esm/search/_internal/portalSearchUsers.js.map +1 -1
  29. package/dist/esm/search/filter-utils.js +0 -198
  30. package/dist/esm/search/filter-utils.js.map +1 -1
  31. package/dist/esm/search/hubSearch.js +9 -37
  32. package/dist/esm/search/hubSearch.js.map +1 -1
  33. package/dist/esm/search/{_internal/ifilter-utils.js → ifilter-utils.js} +2 -38
  34. package/dist/esm/search/ifilter-utils.js.map +1 -0
  35. package/dist/esm/search/index.js +1 -0
  36. package/dist/esm/search/index.js.map +1 -1
  37. package/dist/node/search/_internal/index.js +1 -0
  38. package/dist/node/search/_internal/index.js.map +1 -1
  39. package/dist/node/search/_internal/ipredicate-utils.js +42 -0
  40. package/dist/node/search/_internal/ipredicate-utils.js.map +1 -0
  41. package/dist/node/search/_internal/portalSearchGroups.js +4 -59
  42. package/dist/node/search/_internal/portalSearchGroups.js.map +1 -1
  43. package/dist/node/search/_internal/portalSearchItems.js +5 -92
  44. package/dist/node/search/_internal/portalSearchItems.js.map +1 -1
  45. package/dist/node/search/_internal/portalSearchUsers.js +4 -47
  46. package/dist/node/search/_internal/portalSearchUsers.js.map +1 -1
  47. package/dist/node/search/filter-utils.js +1 -200
  48. package/dist/node/search/filter-utils.js.map +1 -1
  49. package/dist/node/search/hubSearch.js +12 -41
  50. package/dist/node/search/hubSearch.js.map +1 -1
  51. package/dist/node/search/{_internal/ifilter-utils.js → ifilter-utils.js} +4 -40
  52. package/dist/node/search/ifilter-utils.js.map +1 -0
  53. package/dist/node/search/index.js +1 -0
  54. package/dist/node/search/index.js.map +1 -1
  55. package/dist/types/search/_internal/index.d.ts +1 -0
  56. package/dist/types/search/_internal/ipredicate-utils.d.ts +2 -0
  57. package/dist/types/search/_internal/portalSearchGroups.d.ts +1 -10
  58. package/dist/types/search/_internal/portalSearchItems.d.ts +1 -15
  59. package/dist/types/search/_internal/portalSearchUsers.d.ts +1 -9
  60. package/dist/types/search/filter-utils.d.ts +0 -17
  61. package/dist/types/search/hubSearch.d.ts +7 -4
  62. package/dist/types/search/{_internal/ifilter-utils.d.ts → ifilter-utils.d.ts} +1 -2
  63. package/dist/types/search/index.d.ts +1 -0
  64. package/dist/types/search/types/IHubCatalog.d.ts +38 -2
  65. package/dist/umd/common.umd.js +205 -610
  66. package/dist/umd/common.umd.js.map +1 -1
  67. package/package.json +1 -1
  68. package/dist/es2017/search/_internal/ifilter-utils.js.map +0 -1
  69. package/dist/esm/search/_internal/ifilter-utils.js.map +0 -1
  70. package/dist/node/search/_internal/ifilter-utils.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/search/index.ts"],"names":[],"mappings":";;;AAAA,2DAAiC;AACjC,0DAAgC;AAChC,wDAA8B;AAC9B,uDAA6B;AAC7B,kDAAwB;AACxB,2DAAiC;AACjC,0DAAgC;AAChC,yDAA+B;AAC/B,kDAAwB;AACxB,4DAAkC;AAClC,2DAAiC;AACjC,yDAA+B;AAC/B,sDAA4B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/search/index.ts"],"names":[],"mappings":";;;AAAA,2DAAiC;AACjC,0DAAgC;AAChC,wDAA8B;AAC9B,uDAA6B;AAC7B,kDAAwB;AACxB,2DAAiC;AACjC,0DAAgC;AAChC,yDAA+B;AAC/B,kDAAwB;AACxB,4DAAkC;AAClC,2DAAiC;AACjC,yDAA+B;AAC/B,0DAAgC;AAChC,sDAA4B"}
@@ -3,3 +3,4 @@ export * from "./state";
3
3
  export * from "./portalSearchItems";
4
4
  export * from "./hubSearchItems";
5
5
  export * from "./portalSearchGroups";
6
+ export * from "./portalSearchUsers";
@@ -0,0 +1,2 @@
1
+ import { IPredicate } from "../types";
2
+ export declare function expandPredicate(predicate: IPredicate): IPredicate;
@@ -1,13 +1,4 @@
1
- import { IFilterGroup, IHubSearchOptions, IHubSearchResponse, IHubSearchResult, IQuery } from "../types";
2
- /**
3
- * @private
4
- * DEPRECATED: Use `portalSerchGroups`
5
- * Portal Search Implementation for Groups
6
- * @param filterGroups
7
- * @param options
8
- * @returns
9
- */
10
- export declare function portalSearchGroupsFilterGroups(filterGroups: Array<IFilterGroup<"group">>, options: IHubSearchOptions): Promise<IHubSearchResponse<IHubSearchResult>>;
1
+ import { IHubSearchOptions, IHubSearchResponse, IHubSearchResult, IQuery } from "../types";
11
2
  /**
12
3
  * @private
13
4
  * Portal Search Implementation for Groups
@@ -1,12 +1,4 @@
1
- import { Filter, IFilterGroup, IHubSearchOptions, IHubSearchResponse, IHubSearchResult, IMatchOptions, IQuery } from "../types";
2
- /**
3
- * @private
4
- * DEPRECATED
5
- * @param filterGroups
6
- * @param options
7
- * @returns
8
- */
9
- export declare function portalSearchItemsFilterGroups(filterGroups: Array<IFilterGroup<"item">>, options: IHubSearchOptions): Promise<IHubSearchResponse<IHubSearchResult>>;
1
+ import { Filter, IHubSearchOptions, IHubSearchResponse, IHubSearchResult, IMatchOptions, IQuery } from "../types";
10
2
  /**
11
3
  * @private
12
4
  * Portal Search Implementation for Items
@@ -48,12 +40,6 @@ export declare const WellKnownItemFilters: IWellKnownItemFilters;
48
40
  * @param filterGroups
49
41
  */
50
42
  export declare function applyWellKnownItemPredicates(query: IQuery): IQuery;
51
- /**
52
- * DEPRECATED
53
- * @param filterGroups
54
- * @returns
55
- */
56
- export declare function applyWellKnownItemFilterGroups(filterGroups: Array<IFilterGroup<"item">>): Array<IFilterGroup<"item">>;
57
43
  /**
58
44
  * Is the argument a well-known type "key"
59
45
  *
@@ -1,12 +1,4 @@
1
- import { IFilterGroup, IHubSearchOptions, IHubSearchResponse, IHubSearchResult, IQuery } from "../types";
2
- /**
3
- * @private
4
- * DEPRECATED: Use `portalSearchUsers`
5
- * Portal Search implementation for Users
6
- * @param filterGroups
7
- * @param options
8
- */
9
- export declare function portalSearchUsersFilterGroups(filterGroups: Array<IFilterGroup<"user">>, options: IHubSearchOptions): Promise<IHubSearchResponse<IHubSearchResult>>;
1
+ import { IHubSearchOptions, IHubSearchResponse, IHubSearchResult, IQuery } from "../types";
10
2
  /**
11
3
  * @private
12
4
  * Portal Search Implementation for Users
@@ -1,21 +1,4 @@
1
- import { ISearchOptions } from "@esri/arcgis-rest-portal";
2
1
  import { Filter, IFilterGroup, FilterType } from "./types";
3
- /**
4
- * Expand a Filter into it's more expressive structure so it can be
5
- * serialized deterministically.
6
- *
7
- * Props with type `string | string[] | MatchOptions` expand into `IMatchOptions`
8
- * Props relative-dates are expanded into formal date-ranges
9
- * @param filter
10
- * @returns
11
- */
12
- export declare function expandFilter<T>(filter: T): T;
13
- /**
14
- * Serialize a FilterGroup of any type for Portal
15
- * @param filterGroups
16
- * @returns
17
- */
18
- export declare function serializeFilterGroupsForPortal(filterGroups: Array<IFilterGroup<FilterType>>): ISearchOptions;
19
2
  /**
20
3
  * Determine if a Filter is "empty"
21
4
  * @param filter
@@ -1,6 +1,9 @@
1
- import { IFilterGroup, FilterType, IHubSearchOptions, IHubSearchResponse, IHubSearchResult, IQuery } from "./types";
1
+ import { IHubSearchOptions, IHubSearchResponse, IHubSearchResult, IQuery } from "./types";
2
2
  /**
3
- * Main Search function for ArcGIS Hub
3
+ * @private
4
+ * TEMPORARY - this function only exists to allow incremental
5
+ * changes and should be removed as soon as arcgis-hub-gallery
6
+ * is changed to call `hubSearch(...)` directly
4
7
  *
5
8
  * Default's to search ArcGIS Portal but can delegate
6
9
  * to Hub API when it's available.
@@ -8,7 +11,7 @@ import { IFilterGroup, FilterType, IHubSearchOptions, IHubSearchResponse, IHubSe
8
11
  * @param options
9
12
  * @returns
10
13
  */
11
- export declare function hubSearch(filterGroups: Array<IFilterGroup<FilterType>>, options: IHubSearchOptions): Promise<IHubSearchResponse<IHubSearchResult>>;
14
+ export declare function hubSearchQuery(query: IQuery, options: IHubSearchOptions): Promise<IHubSearchResponse<IHubSearchResult>>;
12
15
  /**
13
16
  * Main entrypoint for searching via Hub
14
17
  *
@@ -18,4 +21,4 @@ export declare function hubSearch(filterGroups: Array<IFilterGroup<FilterType>>,
18
21
  * @param options
19
22
  * @returns
20
23
  */
21
- export declare function hubSearchQuery(query: IQuery, options: IHubSearchOptions): Promise<IHubSearchResponse<IHubSearchResult>>;
24
+ export declare function hubSearch(query: IQuery, options: IHubSearchOptions): Promise<IHubSearchResponse<IHubSearchResult>>;
@@ -1,4 +1,3 @@
1
1
  import { ISearchOptions } from "@esri/arcgis-rest-portal";
2
- import { IPredicate, IQuery } from "../types";
3
- export declare function expandPredicate(predicate: IPredicate): IPredicate;
2
+ import { IQuery } from "./types";
4
3
  export declare function serializeQueryForPortal(query: IQuery): ISearchOptions;
@@ -10,4 +10,5 @@ export * from "./types";
10
10
  export * from "./collectionState";
11
11
  export * from "./convertCatalog";
12
12
  export * from "./filter-utils";
13
+ export * from "./ifilter-utils";
13
14
  export * from "./hubSearch";
@@ -50,6 +50,12 @@ export interface IHubCollection {
50
50
  targetEntity: EntityType;
51
51
  }
52
52
  export declare type EntityType = "item" | "group" | "user" | "groupMember" | "event";
53
+ /**
54
+ * IQuery is the fundamental unit used to execute a search. By composing
55
+ * `Filter`'s and `IPredicate`s, we can express very complex queries
56
+ *
57
+ * The [Hub Search Guide](/hub.js/guides/hub-search) contains many examples.
58
+ */
53
59
  export interface IQuery {
54
60
  /**
55
61
  * What entity is this query targeting. This is used internally to
@@ -66,15 +72,45 @@ export interface IQuery {
66
72
  */
67
73
  properties?: Record<string, any>;
68
74
  }
75
+ /**
76
+ * Queries are composed from a set of `IFilter` objects.
77
+ * All Filters are combined via `AND`, but the predicates
78
+ * that make up a filter are combined using the specified `operation`
79
+ * thereby allowing queries to be composed dynamically and deterministically.
80
+ *
81
+ * The [Hub Search Guide](/hub.js/guides/hub-search) contains many examples.
82
+ */
69
83
  export interface IFilter {
70
84
  /**
71
85
  * Operation used to combine the predicates
72
86
  */
73
87
  operation?: "AND" | "OR";
74
88
  /**
75
- * Predicates
89
+ * Predicates which specify the properties and values to match in the search
76
90
  */
77
91
  predicates: IPredicate[];
78
92
  }
79
- export interface IPredicate extends Record<string, any> {
93
+ /**
94
+ * An `IPredicate` is a set of key/value pairs
95
+ * that can be evaluated into a boolean value in a search system.
96
+ *
97
+ * For example, a predicate like
98
+ * ```js
99
+ * const p = { type: "Web Map"}
100
+ * ```
101
+ * equates to a search `where type = "Web Map"`
102
+ *
103
+ * Properties can be `string`, `string[]`, `IMatchOption`,
104
+ * `IDateRange<number>` or `IRelativeDate`. Some properties are booleans
105
+ * and other properties have a limited set of values that can be passed.
106
+ *
107
+ * The [Hub Search Guide](/hub.js/guides/hub-search) contains a list
108
+ * of properties that can be sent to the ArcGIS Portal API.
109
+ */
110
+ export interface IPredicate {
111
+ /**
112
+ * This is intentionally loosely typed to allow flexibility
113
+ * in implementation without constantly updates to this interface
114
+ */
115
+ [key: string]: any;
80
116
  }