@esri/hub-common 10.0.0-next.1 → 10.0.0-next.2

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 (112) hide show
  1. package/dist/es2017/projects/HubProjects.js.map +1 -1
  2. package/dist/es2017/search/_internal/hubSearchItems.js +3 -94
  3. package/dist/es2017/search/_internal/hubSearchItems.js.map +1 -1
  4. package/dist/es2017/search/_internal/portalSearchItems.js +3 -25
  5. package/dist/es2017/search/_internal/portalSearchItems.js.map +1 -1
  6. package/dist/es2017/search/index.js +0 -7
  7. package/dist/es2017/search/index.js.map +1 -1
  8. package/dist/es2017/search/types/index.js +0 -3
  9. package/dist/es2017/search/types/index.js.map +1 -1
  10. package/dist/es2017/search/utils.js +1 -207
  11. package/dist/es2017/search/utils.js.map +1 -1
  12. package/dist/esm/projects/HubProjects.js.map +1 -1
  13. package/dist/esm/search/_internal/hubSearchItems.js +4 -102
  14. package/dist/esm/search/_internal/hubSearchItems.js.map +1 -1
  15. package/dist/esm/search/_internal/portalSearchItems.js +3 -25
  16. package/dist/esm/search/_internal/portalSearchItems.js.map +1 -1
  17. package/dist/esm/search/index.js +0 -7
  18. package/dist/esm/search/index.js.map +1 -1
  19. package/dist/esm/search/types/index.js +0 -3
  20. package/dist/esm/search/types/index.js.map +1 -1
  21. package/dist/esm/search/utils.js +1 -204
  22. package/dist/esm/search/utils.js.map +1 -1
  23. package/dist/node/projects/HubProjects.js.map +1 -1
  24. package/dist/node/search/_internal/hubSearchItems.js +3 -94
  25. package/dist/node/search/_internal/hubSearchItems.js.map +1 -1
  26. package/dist/node/search/_internal/portalSearchItems.js +4 -26
  27. package/dist/node/search/_internal/portalSearchItems.js.map +1 -1
  28. package/dist/node/search/index.js +0 -7
  29. package/dist/node/search/index.js.map +1 -1
  30. package/dist/node/search/types/index.js +0 -3
  31. package/dist/node/search/types/index.js.map +1 -1
  32. package/dist/node/search/utils.js +1 -213
  33. package/dist/node/search/utils.js.map +1 -1
  34. package/dist/types/search/_internal/hubSearchItems.d.ts +3 -3
  35. package/dist/types/search/_internal/portalSearchItems.d.ts +15 -15
  36. package/dist/types/search/index.d.ts +0 -7
  37. package/dist/types/search/types/index.d.ts +0 -3
  38. package/dist/types/search/types/types.d.ts +0 -204
  39. package/dist/types/search/utils.d.ts +2 -58
  40. package/dist/umd/common.umd.js +101 -1459
  41. package/dist/umd/common.umd.js.map +1 -1
  42. package/package.json +1 -1
  43. package/dist/es2017/search/_searchContent.js +0 -112
  44. package/dist/es2017/search/_searchContent.js.map +0 -1
  45. package/dist/es2017/search/_searchGroups.js +0 -88
  46. package/dist/es2017/search/_searchGroups.js.map +0 -1
  47. package/dist/es2017/search/_searchUsers.js +0 -89
  48. package/dist/es2017/search/_searchUsers.js.map +0 -1
  49. package/dist/es2017/search/content-utils.js +0 -390
  50. package/dist/es2017/search/content-utils.js.map +0 -1
  51. package/dist/es2017/search/filter-utils.js +0 -31
  52. package/dist/es2017/search/filter-utils.js.map +0 -1
  53. package/dist/es2017/search/group-utils.js +0 -142
  54. package/dist/es2017/search/group-utils.js.map +0 -1
  55. package/dist/es2017/search/types/ICatalog.js +0 -1
  56. package/dist/es2017/search/types/ICatalog.js.map +0 -1
  57. package/dist/es2017/search/types/ICollection.js +0 -1
  58. package/dist/es2017/search/types/ICollection.js.map +0 -1
  59. package/dist/es2017/search/types/IHubApiSearchRequest.js +0 -1
  60. package/dist/es2017/search/types/IHubApiSearchRequest.js.map +0 -1
  61. package/dist/es2017/search/user-utils.js +0 -139
  62. package/dist/es2017/search/user-utils.js.map +0 -1
  63. package/dist/esm/search/_searchContent.js +0 -114
  64. package/dist/esm/search/_searchContent.js.map +0 -1
  65. package/dist/esm/search/_searchGroups.js +0 -91
  66. package/dist/esm/search/_searchGroups.js.map +0 -1
  67. package/dist/esm/search/_searchUsers.js +0 -92
  68. package/dist/esm/search/_searchUsers.js.map +0 -1
  69. package/dist/esm/search/content-utils.js +0 -394
  70. package/dist/esm/search/content-utils.js.map +0 -1
  71. package/dist/esm/search/filter-utils.js +0 -31
  72. package/dist/esm/search/filter-utils.js.map +0 -1
  73. package/dist/esm/search/group-utils.js +0 -146
  74. package/dist/esm/search/group-utils.js.map +0 -1
  75. package/dist/esm/search/types/ICatalog.js +0 -1
  76. package/dist/esm/search/types/ICatalog.js.map +0 -1
  77. package/dist/esm/search/types/ICollection.js +0 -1
  78. package/dist/esm/search/types/ICollection.js.map +0 -1
  79. package/dist/esm/search/types/IHubApiSearchRequest.js +0 -1
  80. package/dist/esm/search/types/IHubApiSearchRequest.js.map +0 -1
  81. package/dist/esm/search/user-utils.js +0 -143
  82. package/dist/esm/search/user-utils.js.map +0 -1
  83. package/dist/node/search/_searchContent.js +0 -116
  84. package/dist/node/search/_searchContent.js.map +0 -1
  85. package/dist/node/search/_searchGroups.js +0 -92
  86. package/dist/node/search/_searchGroups.js.map +0 -1
  87. package/dist/node/search/_searchUsers.js +0 -93
  88. package/dist/node/search/_searchUsers.js.map +0 -1
  89. package/dist/node/search/content-utils.js +0 -399
  90. package/dist/node/search/content-utils.js.map +0 -1
  91. package/dist/node/search/filter-utils.js +0 -36
  92. package/dist/node/search/filter-utils.js.map +0 -1
  93. package/dist/node/search/group-utils.js +0 -148
  94. package/dist/node/search/group-utils.js.map +0 -1
  95. package/dist/node/search/types/ICatalog.js +0 -3
  96. package/dist/node/search/types/ICatalog.js.map +0 -1
  97. package/dist/node/search/types/ICollection.js +0 -3
  98. package/dist/node/search/types/ICollection.js.map +0 -1
  99. package/dist/node/search/types/IHubApiSearchRequest.js +0 -3
  100. package/dist/node/search/types/IHubApiSearchRequest.js.map +0 -1
  101. package/dist/node/search/user-utils.js +0 -145
  102. package/dist/node/search/user-utils.js.map +0 -1
  103. package/dist/types/search/_searchContent.d.ts +0 -9
  104. package/dist/types/search/_searchGroups.d.ts +0 -13
  105. package/dist/types/search/_searchUsers.d.ts +0 -31
  106. package/dist/types/search/content-utils.d.ts +0 -66
  107. package/dist/types/search/filter-utils.d.ts +0 -13
  108. package/dist/types/search/group-utils.d.ts +0 -36
  109. package/dist/types/search/types/ICatalog.d.ts +0 -82
  110. package/dist/types/search/types/ICollection.d.ts +0 -26
  111. package/dist/types/search/types/IHubApiSearchRequest.d.ts +0 -16
  112. package/dist/types/search/user-utils.d.ts +0 -35
@@ -1,145 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.serializeUserFilterForPortal = exports.expandUserFilter = exports.mergeUserFilters = void 0;
4
- const __1 = require("..");
5
- // TODO: Remove with _searchContent
6
- /**
7
- *
8
- * Merge `Filter<"user">` objects
9
- *
10
- * Useful in components which may get partial filters from a variety of
11
- * sub-components, which are then combined into a single filter prior
12
- * to executing the search.
13
- * @param filters
14
- * @returns
15
- */
16
- function mergeUserFilters(filters) {
17
- // TODO: Remove with _searchContent
18
- __1.Logger.warn(`DEPRECATION: mergeUserFilters will be removed. Work with IFilterGroups<"user"> and hubSearch() instead`);
19
- // expand all the filters so all prop types are consistent
20
- const expanded = filters.map(expandUserFilter);
21
- // now we can merge based on fields
22
- const dateFields = ["created", "modified", "lastlogin"];
23
- const specialFields = ["disabled", "term", "filterType", ...dateFields];
24
- // acc is initialized as Filter<group> but also needs it
25
- // in the function signature... for reasons?!
26
- const result = expanded.reduce((acc, entry) => {
27
- // process fields
28
- Object.entries(entry).forEach(([key, value]) => {
29
- // Note: getProp/setProp are used to get around
30
- // typescript issues with string indexing
31
- if (acc.hasOwnProperty(key)) {
32
- const existingValue = __1.getProp(acc, key);
33
- // if the key is not to a special field
34
- if (!specialFields.includes(key)) {
35
- // treat as an IMatchOptions
36
- __1.setProp(key, __1.mergeMatchOptions(existingValue, value), acc);
37
- }
38
- else if (dateFields.includes(key)) {
39
- // treat as IDateRange
40
- __1.setProp(key, __1.mergeDateRange(existingValue, value), acc);
41
- }
42
- else if (key === "term") {
43
- // append terms
44
- acc[key] = `${acc[key]} ${value}`;
45
- }
46
- }
47
- else {
48
- // Acc does not have an entry for this yet
49
- // so just clone it
50
- __1.setProp(key, __1.cloneObject(value), acc);
51
- }
52
- });
53
- return acc;
54
- }, {
55
- filterType: "user",
56
- });
57
- return result;
58
- }
59
- exports.mergeUserFilters = mergeUserFilters;
60
- /**
61
- * Prior to serialization into the query syntax for the backing APIs, we first expand [Filters](../Filter)
62
- *
63
- * Filter's can express their intent in a very terse form, but to ensure consistent structures
64
- * we expand them into their more verbose form.
65
- *
66
- * i.e. `firstname: "John"` expands into `firstname: { any: ["John"]}`
67
- *
68
- * - Fields defined as `string | string[] | MatchOptions` will be converted to a `MatchOptions`
69
- * - RelativeDate fields are converted to DateRange<number>
70
- * @param filter
71
- * @returns
72
- */
73
- function expandUserFilter(filter) {
74
- // TODO: Remove with _searchContent
75
- __1.Logger.warn(`DEPRECATION: expandUserFilter will be removed. Work with IFilterGroups<"user"> and hubSearch() instead`);
76
- const result = {};
77
- const dateProps = ["created", "modified", "lastlogin"];
78
- const specialProps = ["disabled", "term", ...dateProps];
79
- Object.entries(filter).forEach(([key, value]) => {
80
- // handle Matchish fields
81
- if (!specialProps.includes(key)) {
82
- // setProp side-steps typescript complaining
83
- __1.setProp(key, __1.valueToMatchOptions(value), result);
84
- }
85
- // Handle date fields
86
- if (dateProps.includes(key)) {
87
- const dateFieldValue = __1.cloneObject(__1.getProp(filter, key));
88
- if (__1.getProp(filter, `${key}.type`) === "relative-date") {
89
- __1.setProp(key, __1.relativeDateToDateRange(dateFieldValue), result);
90
- }
91
- else {
92
- __1.setProp(key, dateFieldValue, result);
93
- }
94
- }
95
- });
96
- // disabled is boolean, so we check if the prop exists
97
- // vs checking if the value is truthy
98
- if (filter.hasOwnProperty("disabled")) {
99
- result.disabled = filter.disabled;
100
- }
101
- if (filter.term) {
102
- result.term = filter.term;
103
- }
104
- return result;
105
- }
106
- exports.expandUserFilter = expandUserFilter;
107
- /**
108
- * @private
109
- * Serialize an `IUserFilterDefinition` into an `ISearchOptions` for use
110
- * with `searchUsers`
111
- * @param filter
112
- * @returns
113
- */
114
- function serializeUserFilterForPortal(filter) {
115
- // TODO: Remove with _searchContent
116
- __1.Logger.warn(`DEPRECATION: serializeUserFilterForPortal will be removed. Work with IFilterGroups<"user"> and hubSearch() instead`);
117
- let result = {
118
- q: "",
119
- filter: "",
120
- };
121
- const dateProps = ["created", "modified", "lastlogin"];
122
- const specialProps = ["term", "filterType", ...dateProps];
123
- Object.entries(filter).forEach(([key, value]) => {
124
- // MatchOptions fields
125
- if (!specialProps.includes(key)) {
126
- result = __1.mergeSearchOptions(result, __1.serializeMatchOptions(key, value), "AND");
127
- }
128
- // Dates only go into q
129
- if (dateProps.includes(key)) {
130
- result = __1.mergeSearchOptions(result, __1.serializeDateRange(key, value), "AND");
131
- }
132
- });
133
- // disabled is also a top-level property
134
- if (filter.hasOwnProperty("disabled")) {
135
- result.disabled = filter.disabled;
136
- }
137
- // add the term
138
- if (filter.term) {
139
- // Note: this is slightly different from other types
140
- result.q = `(${filter.term}) ${result.q}`.trim();
141
- }
142
- return result;
143
- }
144
- exports.serializeUserFilterForPortal = serializeUserFilterForPortal;
145
- //# sourceMappingURL=user-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"user-utils.js","sourceRoot":"","sources":["../../../src/search/user-utils.ts"],"names":[],"mappings":";;;AACA,0BAcY;AAEZ,mCAAmC;AACnC;;;;;;;;;GASG;AACH,SAAgB,gBAAgB,CAC9B,OAA8B;IAE9B,mCAAmC;IACnC,UAAM,CAAC,IAAI,CACT,wGAAwG,CACzG,CAAC;IACF,0DAA0D;IAC1D,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC/C,mCAAmC;IACnC,MAAM,UAAU,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;IACxD,MAAM,aAAa,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,UAAU,CAAC,CAAC;IAExE,wDAAwD;IACxD,6CAA6C;IAC7C,MAA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import { Filter, IHubSearchOptions } from "./types";
2
- import { IHubContent, ISearchResponse } from "..";
3
- /**
4
- * @private
5
- * Search for content via the Portal or Hub API
6
- * @param filter
7
- * @param options
8
- */
9
- export declare function _searchContent(filter: Filter<"content">, options: IHubSearchOptions): Promise<ISearchResponse<IHubContent>>;
@@ -1,13 +0,0 @@
1
- import { IGroup } from "@esri/arcgis-rest-portal";
2
- import { Filter, IHubSearchOptions } from "./types";
3
- import { ISearchResponse } from "..";
4
- /**
5
- * @private
6
- * Search Groups using Filter<"group">
7
- *
8
- * Currently just returns ISearchResult<IGroup>
9
- * @param filter
10
- * @param options
11
- * @returns
12
- */
13
- export declare function _searchGroups(filter: Filter<"group">, options: IHubSearchOptions): Promise<ISearchResponse<IGroup>>;
@@ -1,31 +0,0 @@
1
- import { IUser, UserSession } from "@esri/arcgis-rest-auth";
2
- import { Filter, IHubSearchOptions, ISearchResponse } from "..";
3
- /**
4
- * Extends IHubSearchOptions to make auth mandatory
5
- */
6
- export interface IAuthenticatedHubSearchOptions extends IHubSearchOptions {
7
- authentication: UserSession;
8
- }
9
- /**
10
- * Extends `IUser` with url optional props for the user's
11
- * profile and thumbnail
12
- */
13
- export interface IHubUser extends IUser {
14
- profileUrl?: string;
15
- thumbnailUrl?: string;
16
- }
17
- /**
18
- * @private
19
- * Search for Users via the Portal API.
20
- *
21
- * **Note** Authentication is required
22
- *
23
- * Another trivial comment to force a release
24
- *
25
- * Note: in the future, there may be options to search via
26
- * a Hub specific API
27
- * @param filter
28
- * @param options
29
- * @returns
30
- */
31
- export declare function _searchUsers(filter: Filter<"user">, options: IAuthenticatedHubSearchOptions): Promise<ISearchResponse<IHubUser>>;
@@ -1,66 +0,0 @@
1
- import { ISearchOptions } from "@esri/arcgis-rest-portal";
2
- import { IContentFilter, IContentFilterDefinition, Filter } from "./types/types";
3
- /**
4
- * Merge `Filter<"content">` objects
5
- *
6
- * Useful in components which may get partial filters from a variety of
7
- * sub-components, which are then combined into a single filter prior
8
- * to executing the search.
9
- * @param filters
10
- * @returns
11
- */
12
- export declare function mergeContentFilter(filters: Array<Filter<"content">>): Filter<"content">;
13
- /**
14
- * Prior to serialization into the query syntax for the backing APIs, we first expand [Filters](../Filter)
15
- *
16
- * Filter's can express their intent in a very terse form, but to ensure consistent structures
17
- * we expand them into their more verbose form.
18
- *
19
- * i.e. `title: "Water"` expands into `title: { any: ["Water"]}`
20
- *
21
- * - "well known" type values are expanded
22
- * - i.e. `type: "$storymap"` expands into two `subFilter` entries
23
- * - Fields defined as `string | string[] | MatchOptions` will be converted to a `MatchOptions`
24
- * - RelativeDate fields are converted to DateRange<number>
25
- *
26
- * @param filter
27
- * @returns
28
- */
29
- export declare function expandContentFilter(filter: Filter<"content">): IContentFilter;
30
- /**
31
- * @private
32
- * Expand from a well-known "type" into it's longer form
33
- *
34
- * i.e. `type: "$storymap"` expands into two subFilters entries
35
- *
36
- * @param filter
37
- * @returns
38
- */
39
- export declare function expandTypeField(filter: Filter<"content">): Filter<"content">;
40
- /**
41
- * @private
42
- * Convert a `ContentFilterDefinition` to a `ContentFilter`
43
- *
44
- * ContentFilter is a narrower version of ContentFilterDefinition, without
45
- * the union types. Using a ContentFilter makes working with the structure
46
- * in typescript much easier.
47
- *
48
- * @param filter
49
- * @returns
50
- */
51
- export declare function convertContentDefinitionToFilter(filter: IContentFilterDefinition): IContentFilter;
52
- /**
53
- * @private
54
- * Serialize a `ContentFilter` into an `ISearchOptions` for use with `searchItems`
55
- * @param filter
56
- * @returns
57
- */
58
- export declare function serializeContentFilterForPortal(filter: IContentFilter): ISearchOptions;
59
- /**
60
- * @private
61
- * Convert a ContentFilter to a SearchOptions
62
- *
63
- * @param filter
64
- * @returns
65
- */
66
- export declare function convertContentFilterToSearchOptions(filter: IContentFilter): ISearchOptions;
@@ -1,13 +0,0 @@
1
- import { Filter, IFilterGroup, FilterType } from "./types";
2
- /**
3
- * Determine if a Filter is "empty"
4
- * @param filter
5
- * @returns
6
- */
7
- export declare function isEmptyFilter(filter: Filter<FilterType>): boolean;
8
- /**
9
- * Determine if a filterGroup is "empty"
10
- * @param filterGroup
11
- * @returns
12
- */
13
- export declare function isEmptyFilterGroup(filterGroup: IFilterGroup<FilterType>): boolean;
@@ -1,36 +0,0 @@
1
- import { ISearchOptions } from "@esri/arcgis-rest-portal";
2
- import { Filter, IGroupFilterDefinition } from ".";
3
- /**
4
- *
5
- * Merge `Filter<"group">` objects
6
- *
7
- * Useful in components which may get partial filters from a variety of
8
- * sub-components, which are then combined into a single filter prior
9
- * to executing the search.
10
- * @param filters
11
- * @returns
12
- */
13
- export declare function mergeGroupFilters(filters: Array<Filter<"group">>): Filter<"group">;
14
- /**
15
- * Prior to serialization into the query syntax for the backing APIs, we first expand [Filters](../Filter)
16
- *
17
- * Filter's can express their intent in a very terse form, but to ensure consistent structures
18
- * we expand them into their more verbose form.
19
- *
20
- * i.e. `title: "Water"` expands into `title: { any: ["Water"]}`
21
- *
22
- * - Fields defined as `string | string[] | MatchOptions` will be converted to a `MatchOptions`
23
- * - RelativeDate fields are converted to DateRange<number>
24
- *
25
- * @param filter
26
- * @returns
27
- */
28
- export declare function expandGroupFilter(filter: Filter<"group">): IGroupFilterDefinition;
29
- /**
30
- * @private
31
- * Serialize an `IGroupFilterDefinition` into an `ISearchOptions` for use
32
- * with `searchGroups`
33
- * @param filter
34
- * @returns
35
- */
36
- export declare function serializeGroupFilterForPortal(filter: IGroupFilterDefinition): ISearchOptions;
@@ -1,82 +0,0 @@
1
- import { ICollection } from "./ICollection";
2
- import { Filter, FilterType, IFilterGroup, ISortOption } from "./types";
3
- /**
4
- * Catalog is the definition which powers what options
5
- * are available in a Gallery. It controls not only
6
- * the scoping of the search, but also the options
7
- * available to the UX.
8
- *
9
- * Thus the lower-level `searchContent`, `searchUser`, `searchGroup` functions
10
- * do not take Catalogs, rather they accept [Filters](../Filter)
11
- *
12
- * ```ts
13
- * const simpleCatalog:Catalog = {
14
- * title: "Select Map",
15
- * filters: [
16
- * {
17
- * fitlerType: "item",
18
- * operation: "AND",
19
- * fitlers
20
- * filterType: "content",
21
- * type: "Web Map",
22
- * owner: "jsmith"
23
- * }
24
- * }
25
- * ```
26
- *
27
- * ## Collections
28
- * The key feature of a Catalog is the ability to defined [Collections](../Collection).
29
- * These are essentially sub-sets of content, typically organized around
30
- * generalized content types, i.e. "Datasets", vs "Maps", vs "Documents"
31
- *
32
- *
33
- * ```ts
34
- * const complex:Catalog = {
35
- * filter: {
36
- * type: "content",
37
- * groups: ["3ef", "bc4"]
38
- * },
39
- * collections: [
40
- * {
41
- * label: "Documents",
42
- * filter: {
43
- * filterType: "content",
44
- * type: ["Microsoft Word", "PDF", "Microsoft Excel"]
45
- * }
46
- * },
47
- * {
48
- * label: "Datasets",
49
- * filter: {
50
- * filterType: "content",
51
- * type: ["Feature Layer", "Feature Service", "Map Service", "CSV"]
52
- * }
53
- * }
54
- * ]
55
- * }
56
- * ```
57
- */
58
- export interface ICatalog {
59
- /**
60
- * Title for the Gallery
61
- */
62
- title?: string;
63
- /**
64
- * Scope is a set of FilterGroups which define the limits of the Catalog.
65
- * Typically it is just a set of group ids, but it may be arbitrarily complex.
66
- * If one was to "search a catalog", this is the description of what would be returned.
67
- */
68
- scope?: Array<IFilterGroup<FilterType>>;
69
- /**
70
- * Filter defines the "scope" of the Catalog, typically a set of groups or orgids
71
- * DEPRECATED: Use `scope`
72
- */
73
- filter?: Filter<FilterType>;
74
- /**
75
- * Sort options to be shown in the Gallery
76
- */
77
- sort?: ISortOption[];
78
- /**
79
- * Collections within the Catalog
80
- */
81
- collections?: ICollection[];
82
- }
@@ -1,26 +0,0 @@
1
- import { Filter, FilterType, IFilterGroup, ISortOption } from "./types";
2
- /**
3
- * A Collection is a subset of a Catalog, but can be used independently
4
- * in Galleries
5
- */
6
- export interface ICollection {
7
- label: string;
8
- key: string;
9
- /**
10
- * Filter Type used in this collection
11
- */
12
- filterType?: FilterType;
13
- /**
14
- * Scope is a set of FilterGroups which define the limits of the Collection.
15
- * Typically it is just a set of group ids, but it may be arbitrarily complex.
16
- * If one was to "search the collection", this is the description of what would be returned.
17
- */
18
- scope?: Array<IFilterGroup<FilterType>>;
19
- /**
20
- * Specify the includes to be requested when working with this collection
21
- */
22
- include?: string[];
23
- sortOption: ISortOption;
24
- filter?: Filter<FilterType>;
25
- defaultQuery?: string;
26
- }
@@ -1,16 +0,0 @@
1
- import { Filter, IFilterGroup, FilterType } from "./types";
2
- import { IHubSearchOptions } from "./IHubSearchOptions";
3
- /**
4
- * Structure for making Hub API Search Requests
5
- */
6
- export interface IHubApiSearchRequest {
7
- /**
8
- * Can be a string like `term:"water"`, a single filter like `{ filterType: "item", term: "water" }`
9
- * or an array of IFilterGroups, which allows for complex queries.
10
- */
11
- q: string | Filter<FilterType> | Array<IFilterGroup<FilterType>>;
12
- /**
13
- * Search options like the number of results to return, sorting, aggregations etc
14
- */
15
- options: IHubSearchOptions;
16
- }
@@ -1,35 +0,0 @@
1
- import { ISearchOptions } from "@esri/arcgis-rest-portal";
2
- import { Filter, IUserFilterDefinition } from "..";
3
- /**
4
- *
5
- * Merge `Filter<"user">` objects
6
- *
7
- * Useful in components which may get partial filters from a variety of
8
- * sub-components, which are then combined into a single filter prior
9
- * to executing the search.
10
- * @param filters
11
- * @returns
12
- */
13
- export declare function mergeUserFilters(filters: Array<Filter<"user">>): Filter<"user">;
14
- /**
15
- * Prior to serialization into the query syntax for the backing APIs, we first expand [Filters](../Filter)
16
- *
17
- * Filter's can express their intent in a very terse form, but to ensure consistent structures
18
- * we expand them into their more verbose form.
19
- *
20
- * i.e. `firstname: "John"` expands into `firstname: { any: ["John"]}`
21
- *
22
- * - Fields defined as `string | string[] | MatchOptions` will be converted to a `MatchOptions`
23
- * - RelativeDate fields are converted to DateRange<number>
24
- * @param filter
25
- * @returns
26
- */
27
- export declare function expandUserFilter(filter: Filter<"user">): IUserFilterDefinition;
28
- /**
29
- * @private
30
- * Serialize an `IUserFilterDefinition` into an `ISearchOptions` for use
31
- * with `searchUsers`
32
- * @param filter
33
- * @returns
34
- */
35
- export declare function serializeUserFilterForPortal(filter: IUserFilterDefinition): ISearchOptions;