@esri/hub-common 9.7.0 → 9.8.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.
- package/dist/es2017/content.js +17 -6
- package/dist/es2017/content.js.map +1 -1
- package/dist/es2017/search/_searchContent.js +66 -53
- package/dist/es2017/search/_searchContent.js.map +1 -1
- package/dist/es2017/search/_searchGroups.js +71 -36
- package/dist/es2017/search/_searchGroups.js.map +1 -1
- package/dist/es2017/search/_searchUsers.js +83 -0
- package/dist/es2017/search/_searchUsers.js.map +1 -0
- package/dist/es2017/search/index.js +2 -0
- package/dist/es2017/search/index.js.map +1 -1
- package/dist/es2017/search/user-utils.js +132 -0
- package/dist/es2017/search/user-utils.js.map +1 -0
- package/dist/es2017/search/utils.js +76 -37
- package/dist/es2017/search/utils.js.map +1 -1
- package/dist/es2017/sites/upgrade-site-schema.js +3 -0
- package/dist/es2017/sites/upgrade-site-schema.js.map +1 -1
- package/dist/es2017/urls/index.js +1 -0
- package/dist/es2017/urls/index.js.map +1 -1
- package/dist/es2017/urls/upgrade-protocol.js +14 -0
- package/dist/es2017/urls/upgrade-protocol.js.map +1 -0
- package/dist/esm/content.js +17 -6
- package/dist/esm/content.js.map +1 -1
- package/dist/esm/search/_searchContent.js +71 -62
- package/dist/esm/search/_searchContent.js.map +1 -1
- package/dist/esm/search/_searchGroups.js +75 -40
- package/dist/esm/search/_searchGroups.js.map +1 -1
- package/dist/esm/search/_searchUsers.js +88 -0
- package/dist/esm/search/_searchUsers.js.map +1 -0
- package/dist/esm/search/index.js +2 -0
- package/dist/esm/search/index.js.map +1 -1
- package/dist/esm/search/user-utils.js +136 -0
- package/dist/esm/search/user-utils.js.map +1 -0
- package/dist/esm/search/utils.js +76 -37
- package/dist/esm/search/utils.js.map +1 -1
- package/dist/esm/sites/upgrade-site-schema.js +3 -0
- package/dist/esm/sites/upgrade-site-schema.js.map +1 -1
- package/dist/esm/urls/index.js +1 -0
- package/dist/esm/urls/index.js.map +1 -1
- package/dist/esm/urls/upgrade-protocol.js +14 -0
- package/dist/esm/urls/upgrade-protocol.js.map +1 -0
- package/dist/node/content.js +18 -7
- package/dist/node/content.js.map +1 -1
- package/dist/node/search/_searchContent.js +65 -52
- package/dist/node/search/_searchContent.js.map +1 -1
- package/dist/node/search/_searchGroups.js +71 -36
- package/dist/node/search/_searchGroups.js.map +1 -1
- package/dist/node/search/_searchUsers.js +87 -0
- package/dist/node/search/_searchUsers.js.map +1 -0
- package/dist/node/search/index.js +2 -0
- package/dist/node/search/index.js.map +1 -1
- package/dist/node/search/user-utils.js +138 -0
- package/dist/node/search/user-utils.js.map +1 -0
- package/dist/node/search/utils.js +81 -39
- package/dist/node/search/utils.js.map +1 -1
- package/dist/node/sites/upgrade-site-schema.js +3 -0
- package/dist/node/sites/upgrade-site-schema.js.map +1 -1
- package/dist/node/urls/index.js +1 -0
- package/dist/node/urls/index.js.map +1 -1
- package/dist/node/urls/upgrade-protocol.js +18 -0
- package/dist/node/urls/upgrade-protocol.js.map +1 -0
- package/dist/types/content.d.ts +11 -0
- package/dist/types/search/_searchContent.d.ts +3 -2
- package/dist/types/search/_searchGroups.d.ts +3 -2
- package/dist/types/search/_searchUsers.d.ts +28 -0
- package/dist/types/search/index.d.ts +2 -0
- package/dist/types/search/types.d.ts +20 -2
- package/dist/types/search/user-utils.d.ts +35 -0
- package/dist/types/search/utils.d.ts +39 -8
- package/dist/types/types.d.ts +17 -0
- package/dist/types/urls/index.d.ts +1 -0
- package/dist/types/urls/upgrade-protocol.d.ts +5 -0
- package/dist/umd/common.umd.js +489 -142
- package/dist/umd/common.umd.js.map +1 -1
- package/dist/umd/common.umd.min.js +1 -1
- package/dist/umd/common.umd.min.js.map +1 -1
- package/package.json +2 -2
|
@@ -105,16 +105,21 @@ export interface IWellKnownContentFilters {
|
|
|
105
105
|
}
|
|
106
106
|
export declare type NamedContentFilter = keyof IWellKnownContentFilters;
|
|
107
107
|
export interface IUserFilterDefinition {
|
|
108
|
+
created?: IDateRange<number> | IRelativeDate;
|
|
108
109
|
disabled?: boolean;
|
|
109
110
|
email?: string | string[] | IMatchOptions;
|
|
110
111
|
firstname?: string | string[] | IMatchOptions;
|
|
111
112
|
fullname?: string | string[] | IMatchOptions;
|
|
112
113
|
groups?: string | string[] | IMatchOptions;
|
|
114
|
+
lastlogin?: IDateRange<number> | IRelativeDate;
|
|
113
115
|
lastname?: string | string[] | IMatchOptions;
|
|
116
|
+
modified?: IDateRange<number> | IRelativeDate;
|
|
117
|
+
role?: string | string[] | IMatchOptions;
|
|
118
|
+
term?: string;
|
|
119
|
+
userlicensetype?: string | string[] | IMatchOptions;
|
|
114
120
|
username?: string | string[] | IMatchOptions;
|
|
115
121
|
}
|
|
116
122
|
export interface IGroupFilterDefinition {
|
|
117
|
-
term?: string;
|
|
118
123
|
access?: string | string[] | IMatchOptions;
|
|
119
124
|
created?: IDateRange<number> | IRelativeDate;
|
|
120
125
|
id?: string | string[] | IMatchOptions;
|
|
@@ -124,6 +129,7 @@ export interface IGroupFilterDefinition {
|
|
|
124
129
|
owner?: string | string[] | IMatchOptions;
|
|
125
130
|
searchUserAccess?: "groupMember";
|
|
126
131
|
tags?: string | string[] | IMatchOptions;
|
|
132
|
+
term?: string;
|
|
127
133
|
title?: string | string[] | IMatchOptions;
|
|
128
134
|
typekeywords?: string | string[] | IMatchOptions;
|
|
129
135
|
}
|
|
@@ -207,6 +213,9 @@ export interface ICatalog {
|
|
|
207
213
|
collections?: ICollection[];
|
|
208
214
|
facets?: IFacet[];
|
|
209
215
|
}
|
|
216
|
+
/**
|
|
217
|
+
* Sort Option to be displayed in a UI
|
|
218
|
+
*/
|
|
210
219
|
export interface ISortOption {
|
|
211
220
|
label: string;
|
|
212
221
|
attribute: string;
|
|
@@ -219,11 +228,18 @@ export interface ICollection {
|
|
|
219
228
|
filter: Filter<FilterType>;
|
|
220
229
|
facets?: IFacet[];
|
|
221
230
|
}
|
|
231
|
+
/**
|
|
232
|
+
* Defines a span of time by specifying a `from` and `to` Date
|
|
233
|
+
* as either a number or a ISO string
|
|
234
|
+
*/
|
|
222
235
|
export interface IDateRange<T> {
|
|
223
236
|
type?: "date-range";
|
|
224
237
|
from: T;
|
|
225
238
|
to: T;
|
|
226
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* Relative Date will be convertd to a `IDateRange` at run-time
|
|
242
|
+
*/
|
|
227
243
|
export interface IRelativeDate {
|
|
228
244
|
type: "relative-date";
|
|
229
245
|
num: number;
|
|
@@ -270,7 +286,7 @@ export interface IHubSearchOptions {
|
|
|
270
286
|
aggregations?: string[];
|
|
271
287
|
bbox?: string;
|
|
272
288
|
fields?: string;
|
|
273
|
-
|
|
289
|
+
api?: NamedApis | IApiDefinition;
|
|
274
290
|
}
|
|
275
291
|
/**
|
|
276
292
|
* searchContent return
|
|
@@ -279,6 +295,8 @@ export interface IContentSearchResult {
|
|
|
279
295
|
total: number;
|
|
280
296
|
results: IHubContent[];
|
|
281
297
|
facets?: IFacet[];
|
|
298
|
+
hasNext: boolean;
|
|
299
|
+
next: (params?: any) => Promise<IContentSearchResult>;
|
|
282
300
|
}
|
|
283
301
|
export interface IWellKnownApis {
|
|
284
302
|
arcgis: IApiDefinition;
|
|
@@ -0,0 +1,35 @@
|
|
|
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;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { IUser } from "@esri/arcgis-rest-auth";
|
|
2
|
+
import { IGroup, ISearchOptions } from "@esri/arcgis-rest-portal";
|
|
3
|
+
import { ISearchResponse } from "..";
|
|
4
|
+
import { IMatchOptions, IDateRange, IRelativeDate, IWellKnownApis, IApiDefinition, NamedApis } from "./types";
|
|
3
5
|
/**
|
|
4
6
|
* Well known APIs
|
|
5
7
|
* Short-forms for specifying common APIs
|
|
@@ -7,20 +9,18 @@ import { IMatchOptions, IDateRange, IRelativeDate, IWellKnownApis, IApiDefinitio
|
|
|
7
9
|
export declare const SEARCH_APIS: IWellKnownApis;
|
|
8
10
|
/**
|
|
9
11
|
* @private
|
|
10
|
-
* Convert api "names" into full ApiDefinitions
|
|
12
|
+
* Convert array of api "names" into full ApiDefinitions
|
|
11
13
|
* @param apis
|
|
12
14
|
* @returns
|
|
13
15
|
*/
|
|
14
16
|
export declare function expandApis(apis: Array<NamedApis | IApiDefinition>): IApiDefinition[];
|
|
15
17
|
/**
|
|
16
18
|
* @private
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* Naieve implementation that just merges arrays
|
|
20
|
-
* @param responses
|
|
19
|
+
* Convert an api "name" into a full ApiDefinition
|
|
20
|
+
* @param api
|
|
21
21
|
* @returns
|
|
22
22
|
*/
|
|
23
|
-
export declare function
|
|
23
|
+
export declare function expandApi(api: NamedApis | IApiDefinition): IApiDefinition;
|
|
24
24
|
/**
|
|
25
25
|
* @private
|
|
26
26
|
* Merge two date ranges by taking the longest span
|
|
@@ -90,3 +90,34 @@ export declare function serializeDateRange(key: string, range: IDateRange<number
|
|
|
90
90
|
* @returns
|
|
91
91
|
*/
|
|
92
92
|
export declare function serializeStringOrArray(join: "AND" | "OR", key: string, value: string | string[]): string;
|
|
93
|
+
/**
|
|
94
|
+
* Create a `.next()` function for a type
|
|
95
|
+
* @param request
|
|
96
|
+
* @param nextStart
|
|
97
|
+
* @param total
|
|
98
|
+
* @param fn
|
|
99
|
+
* @returns
|
|
100
|
+
*/
|
|
101
|
+
export declare function getNextFunction<T>(request: ISearchOptions, nextStart: number, total: number, fn: (r: any) => Promise<ISearchResponse<T>>): () => Promise<ISearchResponse<T>>;
|
|
102
|
+
/**
|
|
103
|
+
* Construct a the full url to a group thumbnail
|
|
104
|
+
*
|
|
105
|
+
* - If the group has a thumbnail, construct the full url
|
|
106
|
+
* - If the group is not public, append on the token
|
|
107
|
+
* @param portalUrl
|
|
108
|
+
* @param group
|
|
109
|
+
* @param token
|
|
110
|
+
* @returns
|
|
111
|
+
*/
|
|
112
|
+
export declare function getGroupThumbnailUrl(portalUrl: string, group: IGroup, token?: string): string;
|
|
113
|
+
/**
|
|
114
|
+
* Construct a the full url to a user thumbnail
|
|
115
|
+
*
|
|
116
|
+
* - If the user has a thumbnail, construct the full url
|
|
117
|
+
* - If the user is not public, append on the token
|
|
118
|
+
* @param portalUrl
|
|
119
|
+
* @param user
|
|
120
|
+
* @param token
|
|
121
|
+
* @returns
|
|
122
|
+
*/
|
|
123
|
+
export declare function getUserThumbnailUrl(portalUrl: string, user: IUser, token?: string): string;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { IPortal, ISearchResult } from "@esri/arcgis-rest-portal";
|
|
|
3
3
|
import { UserSession } from "@esri/arcgis-rest-auth";
|
|
4
4
|
import { IStructuredLicense } from "./items/get-structured-license";
|
|
5
5
|
import { IRequestOptions } from "@esri/arcgis-rest-request";
|
|
6
|
+
import { IFacet } from "./search";
|
|
6
7
|
/**
|
|
7
8
|
* Generic Model, used with all items that have a json
|
|
8
9
|
* `/data` payload
|
|
@@ -395,4 +396,20 @@ export interface IHubTeam extends IGroup {
|
|
|
395
396
|
[key: string]: any;
|
|
396
397
|
};
|
|
397
398
|
}
|
|
399
|
+
/**
|
|
400
|
+
* Defines a generic search response interface with parameterized result type
|
|
401
|
+
* for different types of searches
|
|
402
|
+
*
|
|
403
|
+
* total - total number of results
|
|
404
|
+
* results - potentially paginated list of results
|
|
405
|
+
* hasNext - boolean flag for if there are any more pages ofresults
|
|
406
|
+
* next - invokable function for obtaining next page of results
|
|
407
|
+
*/
|
|
408
|
+
export interface ISearchResponse<T> {
|
|
409
|
+
total: number;
|
|
410
|
+
results: T[];
|
|
411
|
+
hasNext: boolean;
|
|
412
|
+
next: (params?: any) => Promise<ISearchResponse<T>>;
|
|
413
|
+
facets?: IFacet[];
|
|
414
|
+
}
|
|
398
415
|
export {};
|
|
@@ -3,6 +3,7 @@ export * from "./get-hub-locale-asset-url";
|
|
|
3
3
|
export * from "./get-portal-api-url";
|
|
4
4
|
export * from "./get-portal-url";
|
|
5
5
|
export * from "./hub-cdn-urlmap";
|
|
6
|
+
export * from "./upgrade-protocol";
|
|
6
7
|
export * from "./strip-protocol";
|
|
7
8
|
export * from "./_get-http-and-https-uris";
|
|
8
9
|
export * from "./_get-location";
|