@esri/hub-common 10.0.0-next.1 → 10.0.0-next.4
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/categories.js +4 -2
- package/dist/es2017/categories.js.map +1 -1
- package/dist/es2017/collections.js +3 -8
- package/dist/es2017/collections.js.map +1 -1
- package/dist/es2017/content/compose.js +1 -18
- package/dist/es2017/content/compose.js.map +1 -1
- package/dist/es2017/content/get-family.js +1 -3
- package/dist/es2017/content/get-family.js.map +1 -1
- package/dist/es2017/content/index.js +8 -71
- package/dist/es2017/content/index.js.map +1 -1
- package/dist/es2017/extent.js +1 -14
- package/dist/es2017/extent.js.map +1 -1
- package/dist/es2017/index.js +1 -0
- package/dist/es2017/index.js.map +1 -1
- package/dist/es2017/projects/HubProjectManager.js +0 -8
- package/dist/es2017/projects/HubProjectManager.js.map +1 -1
- package/dist/es2017/projects/HubProjects.js.map +1 -1
- package/dist/es2017/search/_internal/hubSearchItems.js +3 -94
- package/dist/es2017/search/_internal/hubSearchItems.js.map +1 -1
- package/dist/es2017/search/_internal/portalSearchItems.js +3 -25
- package/dist/es2017/search/_internal/portalSearchItems.js.map +1 -1
- package/dist/es2017/search/hubSearch.js +0 -16
- package/dist/es2017/search/hubSearch.js.map +1 -1
- package/dist/es2017/search/index.js +0 -8
- package/dist/es2017/search/index.js.map +1 -1
- package/dist/es2017/search/types/index.js +0 -3
- package/dist/es2017/search/types/index.js.map +1 -1
- package/dist/es2017/search/upgradeCatalogSchema.js +0 -8
- package/dist/es2017/search/upgradeCatalogSchema.js.map +1 -1
- package/dist/es2017/search/utils.js +1 -207
- package/dist/es2017/search/utils.js.map +1 -1
- package/dist/es2017/sites/fetchSiteModel.js +0 -9
- package/dist/es2017/sites/fetchSiteModel.js.map +1 -1
- package/dist/es2017/types.js.map +1 -1
- package/dist/esm/categories.js +4 -2
- package/dist/esm/categories.js.map +1 -1
- package/dist/esm/collections.js +3 -8
- package/dist/esm/collections.js.map +1 -1
- package/dist/esm/content/compose.js +1 -18
- package/dist/esm/content/compose.js.map +1 -1
- package/dist/esm/content/get-family.js +1 -3
- package/dist/esm/content/get-family.js.map +1 -1
- package/dist/esm/content/index.js +8 -71
- package/dist/esm/content/index.js.map +1 -1
- package/dist/esm/extent.js +1 -14
- package/dist/esm/extent.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/projects/HubProjectManager.js +0 -12
- package/dist/esm/projects/HubProjectManager.js.map +1 -1
- package/dist/esm/projects/HubProjects.js.map +1 -1
- package/dist/esm/search/_internal/hubSearchItems.js +4 -102
- package/dist/esm/search/_internal/hubSearchItems.js.map +1 -1
- package/dist/esm/search/_internal/portalSearchItems.js +3 -25
- package/dist/esm/search/_internal/portalSearchItems.js.map +1 -1
- package/dist/esm/search/hubSearch.js +0 -20
- package/dist/esm/search/hubSearch.js.map +1 -1
- package/dist/esm/search/index.js +0 -8
- package/dist/esm/search/index.js.map +1 -1
- package/dist/esm/search/types/index.js +0 -3
- package/dist/esm/search/types/index.js.map +1 -1
- package/dist/esm/search/upgradeCatalogSchema.js +0 -8
- package/dist/esm/search/upgradeCatalogSchema.js.map +1 -1
- package/dist/esm/search/utils.js +1 -204
- package/dist/esm/search/utils.js.map +1 -1
- package/dist/esm/sites/fetchSiteModel.js +0 -9
- package/dist/esm/sites/fetchSiteModel.js.map +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/node/categories.js +4 -2
- package/dist/node/categories.js.map +1 -1
- package/dist/node/collections.js +3 -8
- package/dist/node/collections.js.map +1 -1
- package/dist/node/content/compose.js +1 -18
- package/dist/node/content/compose.js.map +1 -1
- package/dist/node/content/get-family.js +1 -3
- package/dist/node/content/get-family.js.map +1 -1
- package/dist/node/content/index.js +9 -73
- package/dist/node/content/index.js.map +1 -1
- package/dist/node/extent.js +2 -16
- package/dist/node/extent.js.map +1 -1
- package/dist/node/index.js +1 -0
- package/dist/node/index.js.map +1 -1
- package/dist/node/projects/HubProjectManager.js +0 -8
- package/dist/node/projects/HubProjectManager.js.map +1 -1
- package/dist/node/projects/HubProjects.js.map +1 -1
- package/dist/node/search/_internal/hubSearchItems.js +3 -94
- package/dist/node/search/_internal/hubSearchItems.js.map +1 -1
- package/dist/node/search/_internal/portalSearchItems.js +4 -26
- package/dist/node/search/_internal/portalSearchItems.js.map +1 -1
- package/dist/node/search/hubSearch.js +1 -18
- package/dist/node/search/hubSearch.js.map +1 -1
- package/dist/node/search/index.js +0 -8
- package/dist/node/search/index.js.map +1 -1
- package/dist/node/search/types/index.js +0 -3
- package/dist/node/search/types/index.js.map +1 -1
- package/dist/node/search/upgradeCatalogSchema.js +1 -10
- package/dist/node/search/upgradeCatalogSchema.js.map +1 -1
- package/dist/node/search/utils.js +1 -213
- package/dist/node/search/utils.js.map +1 -1
- package/dist/node/sites/fetchSiteModel.js +1 -11
- package/dist/node/sites/fetchSiteModel.js.map +1 -1
- package/dist/node/types.js.map +1 -1
- package/dist/types/collections.d.ts +1 -6
- package/dist/types/content/_internal.d.ts +0 -3
- package/dist/types/content/get-family.d.ts +1 -1
- package/dist/types/content/index.d.ts +3 -36
- package/dist/types/core/types/IHubContent.d.ts +0 -3
- package/dist/types/core/types/IServerEnrichments.d.ts +0 -2
- package/dist/types/extent.d.ts +0 -2
- package/dist/types/projects/HubProjectManager.d.ts +0 -1
- package/dist/types/search/_internal/hubSearchItems.d.ts +3 -3
- package/dist/types/search/_internal/portalSearchItems.d.ts +15 -15
- package/dist/types/search/hubSearch.d.ts +0 -13
- package/dist/types/search/index.d.ts +0 -8
- package/dist/types/search/types/IHubSearchOptions.d.ts +1 -17
- package/dist/types/search/types/IHubSearchResult.d.ts +0 -39
- package/dist/types/search/types/index.d.ts +0 -3
- package/dist/types/search/types/types.d.ts +0 -204
- package/dist/types/search/upgradeCatalogSchema.d.ts +0 -5
- package/dist/types/search/utils.d.ts +2 -58
- package/dist/types/sites/fetchSiteModel.d.ts +2 -6
- package/dist/types/types.d.ts +0 -68
- package/package.json +1 -2
- package/dist/es2017/search/_searchContent.js +0 -112
- package/dist/es2017/search/_searchContent.js.map +0 -1
- package/dist/es2017/search/_searchGroups.js +0 -88
- package/dist/es2017/search/_searchGroups.js.map +0 -1
- package/dist/es2017/search/_searchUsers.js +0 -89
- package/dist/es2017/search/_searchUsers.js.map +0 -1
- package/dist/es2017/search/content-utils.js +0 -390
- package/dist/es2017/search/content-utils.js.map +0 -1
- package/dist/es2017/search/filter-utils.js +0 -31
- package/dist/es2017/search/filter-utils.js.map +0 -1
- package/dist/es2017/search/group-utils.js +0 -142
- package/dist/es2017/search/group-utils.js.map +0 -1
- package/dist/es2017/search/hub-api-search.js +0 -19
- package/dist/es2017/search/hub-api-search.js.map +0 -1
- package/dist/es2017/search/types/ICatalog.js +0 -1
- package/dist/es2017/search/types/ICatalog.js.map +0 -1
- package/dist/es2017/search/types/ICollection.js +0 -1
- package/dist/es2017/search/types/ICollection.js.map +0 -1
- package/dist/es2017/search/types/IHubApiSearchRequest.js +0 -1
- package/dist/es2017/search/types/IHubApiSearchRequest.js.map +0 -1
- package/dist/es2017/search/user-utils.js +0 -139
- package/dist/es2017/search/user-utils.js.map +0 -1
- package/dist/esm/search/_searchContent.js +0 -114
- package/dist/esm/search/_searchContent.js.map +0 -1
- package/dist/esm/search/_searchGroups.js +0 -91
- package/dist/esm/search/_searchGroups.js.map +0 -1
- package/dist/esm/search/_searchUsers.js +0 -92
- package/dist/esm/search/_searchUsers.js.map +0 -1
- package/dist/esm/search/content-utils.js +0 -394
- package/dist/esm/search/content-utils.js.map +0 -1
- package/dist/esm/search/filter-utils.js +0 -31
- package/dist/esm/search/filter-utils.js.map +0 -1
- package/dist/esm/search/group-utils.js +0 -146
- package/dist/esm/search/group-utils.js.map +0 -1
- package/dist/esm/search/hub-api-search.js +0 -20
- package/dist/esm/search/hub-api-search.js.map +0 -1
- package/dist/esm/search/types/ICatalog.js +0 -1
- package/dist/esm/search/types/ICatalog.js.map +0 -1
- package/dist/esm/search/types/ICollection.js +0 -1
- package/dist/esm/search/types/ICollection.js.map +0 -1
- package/dist/esm/search/types/IHubApiSearchRequest.js +0 -1
- package/dist/esm/search/types/IHubApiSearchRequest.js.map +0 -1
- package/dist/esm/search/user-utils.js +0 -143
- package/dist/esm/search/user-utils.js.map +0 -1
- package/dist/node/search/_searchContent.js +0 -116
- package/dist/node/search/_searchContent.js.map +0 -1
- package/dist/node/search/_searchGroups.js +0 -92
- package/dist/node/search/_searchGroups.js.map +0 -1
- package/dist/node/search/_searchUsers.js +0 -93
- package/dist/node/search/_searchUsers.js.map +0 -1
- package/dist/node/search/content-utils.js +0 -399
- package/dist/node/search/content-utils.js.map +0 -1
- package/dist/node/search/filter-utils.js +0 -36
- package/dist/node/search/filter-utils.js.map +0 -1
- package/dist/node/search/group-utils.js +0 -148
- package/dist/node/search/group-utils.js.map +0 -1
- package/dist/node/search/hub-api-search.js +0 -23
- package/dist/node/search/hub-api-search.js.map +0 -1
- package/dist/node/search/types/ICatalog.js +0 -3
- package/dist/node/search/types/ICatalog.js.map +0 -1
- package/dist/node/search/types/ICollection.js +0 -3
- package/dist/node/search/types/ICollection.js.map +0 -1
- package/dist/node/search/types/IHubApiSearchRequest.js +0 -3
- package/dist/node/search/types/IHubApiSearchRequest.js.map +0 -1
- package/dist/node/search/user-utils.js +0 -145
- package/dist/node/search/user-utils.js.map +0 -1
- package/dist/types/search/_searchContent.d.ts +0 -9
- package/dist/types/search/_searchGroups.d.ts +0 -13
- package/dist/types/search/_searchUsers.d.ts +0 -31
- package/dist/types/search/content-utils.d.ts +0 -66
- package/dist/types/search/filter-utils.d.ts +0 -13
- package/dist/types/search/group-utils.d.ts +0 -36
- package/dist/types/search/hub-api-search.d.ts +0 -10
- package/dist/types/search/types/ICatalog.d.ts +0 -82
- package/dist/types/search/types/ICollection.d.ts +0 -26
- package/dist/types/search/types/IHubApiSearchRequest.d.ts +0 -16
- package/dist/types/search/user-utils.d.ts +0 -35
- package/dist/umd/common.umd.js +0 -21037
- package/dist/umd/common.umd.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IUser } from "@esri/arcgis-rest-auth";
|
|
1
|
+
import { IUser, UserSession } from "@esri/arcgis-rest-auth";
|
|
2
2
|
import { IGroup, ISearchOptions } from "@esri/arcgis-rest-portal";
|
|
3
3
|
import { ISearchResponse } from "../types";
|
|
4
4
|
import { IMatchOptions, IDateRange, IRelativeDate, IWellKnownApis, IApiDefinition, NamedApis } from "./types/types";
|
|
@@ -22,25 +22,6 @@ export declare function expandApis(apis: Array<NamedApis | IApiDefinition>): IAp
|
|
|
22
22
|
* @returns
|
|
23
23
|
*/
|
|
24
24
|
export declare function expandApi(api: NamedApis | IApiDefinition): IApiDefinition;
|
|
25
|
-
/**
|
|
26
|
-
* @private
|
|
27
|
-
* Merge two date ranges by taking the longest span
|
|
28
|
-
* @param dr1
|
|
29
|
-
* @param dr2
|
|
30
|
-
* @returns
|
|
31
|
-
*/
|
|
32
|
-
export declare function mergeDateRange(dr1: IDateRange<number>, dr2: IDateRange<number>): IDateRange<number>;
|
|
33
|
-
/**
|
|
34
|
-
* @private
|
|
35
|
-
* Merge two [`MatchOptions`](../MatchOptions)
|
|
36
|
-
*
|
|
37
|
-
* Currently a naieve implementation where the arrays are simply merged
|
|
38
|
-
*
|
|
39
|
-
* @param mo1
|
|
40
|
-
* @param mo2
|
|
41
|
-
* @returns
|
|
42
|
-
*/
|
|
43
|
-
export declare function mergeMatchOptions(mo1: IMatchOptions, mo2: IMatchOptions): IMatchOptions;
|
|
44
25
|
/**
|
|
45
26
|
* @private
|
|
46
27
|
* Convert a field value into a MatchOptions if it's not already one
|
|
@@ -55,43 +36,6 @@ export declare function valueToMatchOptions(value: string | string[] | IMatchOpt
|
|
|
55
36
|
* @returns
|
|
56
37
|
*/
|
|
57
38
|
export declare function relativeDateToDateRange(relative: IRelativeDate): IDateRange<number>;
|
|
58
|
-
/**
|
|
59
|
-
* @private
|
|
60
|
-
* As a final `ISearchOptions` object gets created, many such objects are created, and
|
|
61
|
-
* need to be systematically "merged" so as to return consistently structured `q` and `filter`
|
|
62
|
-
* values.
|
|
63
|
-
* @param so1
|
|
64
|
-
* @param so2
|
|
65
|
-
* @param join
|
|
66
|
-
* @returns
|
|
67
|
-
*/
|
|
68
|
-
export declare function mergeSearchOptions(so1: ISearchOptions, so2: ISearchOptions, join: "AND" | "OR"): ISearchOptions;
|
|
69
|
-
/**
|
|
70
|
-
* @private
|
|
71
|
-
* Serialize a `MatchOptions` into `q` or `filter` on an `ISearchOptions`
|
|
72
|
-
* DEPRECATED: Serialization should be handled in filter-utils.ts
|
|
73
|
-
* @param key
|
|
74
|
-
* @param opts
|
|
75
|
-
* @returns
|
|
76
|
-
*/
|
|
77
|
-
export declare function serializeMatchOptions(key: string, opts: IMatchOptions): ISearchOptions;
|
|
78
|
-
/**
|
|
79
|
-
* @private
|
|
80
|
-
* Serialize a DateRange<number> into a Portal Query string
|
|
81
|
-
* @param key
|
|
82
|
-
* @param range
|
|
83
|
-
* @returns
|
|
84
|
-
*/
|
|
85
|
-
export declare function serializeDateRange(key: string, range: IDateRange<number>): ISearchOptions;
|
|
86
|
-
/**
|
|
87
|
-
* @private
|
|
88
|
-
* Serialize a `string` or `string[]` into a string
|
|
89
|
-
* @param join
|
|
90
|
-
* @param key
|
|
91
|
-
* @param value
|
|
92
|
-
* @returns
|
|
93
|
-
*/
|
|
94
|
-
export declare function serializeStringOrArray(join: "AND" | "OR", key: string, value: string | string[]): string;
|
|
95
39
|
/**
|
|
96
40
|
* Create a `.next()` function for a type
|
|
97
41
|
* @param request
|
|
@@ -100,7 +44,7 @@ export declare function serializeStringOrArray(join: "AND" | "OR", key: string,
|
|
|
100
44
|
* @param fn
|
|
101
45
|
* @returns
|
|
102
46
|
*/
|
|
103
|
-
export declare function getNextFunction<T>(request: ISearchOptions, nextStart: number, total: number, fn: (r: any) => Promise<ISearchResponse<T>>): () => Promise<ISearchResponse<T>>;
|
|
47
|
+
export declare function getNextFunction<T>(request: ISearchOptions, nextStart: number, total: number, fn: (r: any) => Promise<ISearchResponse<T>>): (authentication?: UserSession) => Promise<ISearchResponse<T>>;
|
|
104
48
|
/**
|
|
105
49
|
* Construct a the full url to a group thumbnail
|
|
106
50
|
*
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import { IHubRequestOptions
|
|
1
|
+
import { IHubRequestOptions } from "..";
|
|
2
2
|
/**
|
|
3
3
|
* Returns site model given various kinds of identifier
|
|
4
4
|
*
|
|
5
5
|
* @param identifier - a site item ID, site hostname, enterprise site slug, or full site URL
|
|
6
6
|
* @param hubRequestOptions
|
|
7
7
|
*/
|
|
8
|
-
export declare function fetchSiteModel(identifier: string, hubRequestOptions: IHubRequestOptions): Promise<IModel>;
|
|
9
|
-
/**
|
|
10
|
-
* @private // keep out of docs
|
|
11
|
-
*/
|
|
12
|
-
export declare function fetchSite(identifier: string, hubRequestOptions: IHubRequestOptions): Promise<IModel>;
|
|
8
|
+
export declare function fetchSiteModel(identifier: string, hubRequestOptions: IHubRequestOptions): Promise<import("..").IModel>;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -105,7 +105,6 @@ export interface IItemResource {
|
|
|
105
105
|
name: string;
|
|
106
106
|
}
|
|
107
107
|
export declare type BBox = number[][];
|
|
108
|
-
export declare type IBBox = number[][];
|
|
109
108
|
export declare type IBatch = any[];
|
|
110
109
|
export declare type IBatchTransform = (value: any) => any;
|
|
111
110
|
export interface IGetSurveyModelsResponse {
|
|
@@ -128,11 +127,6 @@ export interface IRevertableTaskFailed {
|
|
|
128
127
|
error: Error;
|
|
129
128
|
}
|
|
130
129
|
export declare type IRevertableTaskResult = IRevertableTaskSuccess | IRevertableTaskFailed;
|
|
131
|
-
/**
|
|
132
|
-
* Types of Hub resources
|
|
133
|
-
* DEPRECATED: Use HubFamily instead
|
|
134
|
-
*/
|
|
135
|
-
export declare type HubType = "member" | "team" | "event" | "dataset" | "document" | "map" | "app" | "site" | "initiative" | "template" | "organization";
|
|
136
130
|
export declare type HubFamily = "app" | "content" | "dataset" | "document" | "event" | "feedback" | "initiative" | "map" | "people" | "site" | "team" | "template" | "project";
|
|
137
131
|
/**
|
|
138
132
|
* Visibility levels of a Hub resource
|
|
@@ -166,53 +160,6 @@ export interface IHubGeography {
|
|
|
166
160
|
}
|
|
167
161
|
export declare type SearchableType = IItem | IGroup | IUser;
|
|
168
162
|
export declare type SearchFunction = (...args: any[]) => Promise<ISearchResult<SearchableType>>;
|
|
169
|
-
/**
|
|
170
|
-
* DEPRECATED: Use IHubEntityBase instead.
|
|
171
|
-
* Properties that are common to Hub content, community, members, etc
|
|
172
|
-
*
|
|
173
|
-
* @export
|
|
174
|
-
* @interface IHubResource
|
|
175
|
-
*/
|
|
176
|
-
export interface IHubResource {
|
|
177
|
-
/** Generic term for the primary label (title, fullname, username, etc.) */
|
|
178
|
-
name: string;
|
|
179
|
-
/** Content snippet or other summary */
|
|
180
|
-
summary?: string;
|
|
181
|
-
/** Type of Hub resource */
|
|
182
|
-
hubType: HubType;
|
|
183
|
-
/** Date the item was created */
|
|
184
|
-
createdDate: Date;
|
|
185
|
-
/**
|
|
186
|
-
* description of what was used for this attribute
|
|
187
|
-
* the item key, e.g. `item.created` or `item.metadata.created_date`
|
|
188
|
-
*/
|
|
189
|
-
createdDateSource?: string;
|
|
190
|
-
/** Date the item was last updated */
|
|
191
|
-
updatedDate: Date;
|
|
192
|
-
/**
|
|
193
|
-
* description of what was used for this attribute
|
|
194
|
-
* the item key, e.g. `item.modified` or `item.metadata.modified_date`
|
|
195
|
-
*/
|
|
196
|
-
updatedDateSource?: string;
|
|
197
|
-
/** URL of the resource"s page in the Portal Home application */
|
|
198
|
-
portalHomeUrl?: string;
|
|
199
|
-
/** URL of the Portal API endpoint for the resource */
|
|
200
|
-
portalApiUrl?: string;
|
|
201
|
-
/** Fully qualified URL for the item"s thumbnail, including current user"s token if authenticated and required */
|
|
202
|
-
thumbnailUrl?: string;
|
|
203
|
-
/**
|
|
204
|
-
* boundary will default to the item extent
|
|
205
|
-
* but can be overwritten by enrichments from the Hub API (inline)
|
|
206
|
-
* or fetched from a location such as /resources/boundary.json
|
|
207
|
-
*/
|
|
208
|
-
boundary?: IHubGeography;
|
|
209
|
-
/**
|
|
210
|
-
* Additional metadata from a metadata document using a formal or custom schema.
|
|
211
|
-
* For example, [item metadata in ArcGIS Online](https://doc.arcgis.com/en/arcgis-online/manage-data/metadata.htm)
|
|
212
|
-
* Metadata stored in XML format is parsed into JSON.
|
|
213
|
-
*/
|
|
214
|
-
metadata?: any;
|
|
215
|
-
}
|
|
216
163
|
/**
|
|
217
164
|
* Information about an error that occurred while indexing or composing content
|
|
218
165
|
*/
|
|
@@ -302,21 +249,6 @@ export interface IDomainEntry {
|
|
|
302
249
|
sslOnly: boolean;
|
|
303
250
|
updatedAt?: string;
|
|
304
251
|
}
|
|
305
|
-
/**
|
|
306
|
-
* The catalog object found on Hub Site Application items.
|
|
307
|
-
* It defines a selection of content to show up in the site"s
|
|
308
|
-
* search context.
|
|
309
|
-
*/
|
|
310
|
-
export interface ISiteCatalog {
|
|
311
|
-
/**
|
|
312
|
-
* A list of groups containing searchable content.
|
|
313
|
-
*/
|
|
314
|
-
groups: string[];
|
|
315
|
-
/**
|
|
316
|
-
* An org to limit searching to.
|
|
317
|
-
*/
|
|
318
|
-
orgId: string;
|
|
319
|
-
}
|
|
320
252
|
export interface IHubTeam extends IGroup {
|
|
321
253
|
properties: {
|
|
322
254
|
[key: string]: any;
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@esri/hub-common",
|
|
3
|
-
"version": "10.0.0-next.
|
|
3
|
+
"version": "10.0.0-next.4",
|
|
4
4
|
"description": "Common TypeScript types and utility functions for @esri/hub.js.",
|
|
5
5
|
"main": "dist/node/index.js",
|
|
6
|
-
"unpkg": "dist/umd/common.umd.js",
|
|
7
6
|
"module": "dist/esm/index.js",
|
|
8
7
|
"es2017": "dist/es2017/index.js",
|
|
9
8
|
"sideEffects": false,
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { expandContentFilter, serializeContentFilterForPortal, } from "./content-utils";
|
|
2
|
-
import { searchItems } from "@esri/arcgis-rest-portal";
|
|
3
|
-
import { expandApi, getNextFunction } from "./utils";
|
|
4
|
-
import { getItemThumbnailUrl, itemToContent, setContentSiteUrls, } from "..";
|
|
5
|
-
import { Logger } from "../utils";
|
|
6
|
-
// TODO: Remove with _searchContent
|
|
7
|
-
/**
|
|
8
|
-
* @private
|
|
9
|
-
* Search for content via the Portal or Hub API
|
|
10
|
-
* @param filter
|
|
11
|
-
* @param options
|
|
12
|
-
*/
|
|
13
|
-
export async function _searchContent(filter, options) {
|
|
14
|
-
var _a, _b;
|
|
15
|
-
Logger.warn(`DEPRECATION: _searchContent will be removed; switch to hubSearch(...)`);
|
|
16
|
-
// expand filter so we can serialize to either api
|
|
17
|
-
const expanded = expandContentFilter(filter);
|
|
18
|
-
// API
|
|
19
|
-
const api = expandApi(options.api || "arcgis");
|
|
20
|
-
let searchPromise;
|
|
21
|
-
// Portal Search
|
|
22
|
-
if (api.type === "arcgis") {
|
|
23
|
-
// serialize for portal
|
|
24
|
-
const so = serializeContentFilterForPortal(expanded);
|
|
25
|
-
// Array of properties we want to copy from IHubSearchOptions
|
|
26
|
-
// to the ISearchOptions
|
|
27
|
-
const props = [
|
|
28
|
-
"authentication",
|
|
29
|
-
"num",
|
|
30
|
-
"sortField",
|
|
31
|
-
"sortOrder",
|
|
32
|
-
"site",
|
|
33
|
-
"start",
|
|
34
|
-
];
|
|
35
|
-
// copy the props over
|
|
36
|
-
props.forEach((prop) => {
|
|
37
|
-
if (options.hasOwnProperty(prop)) {
|
|
38
|
-
so[prop] = options[prop];
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
// If we don't have auth, ensure we have .portal
|
|
42
|
-
if (!so.authentication) {
|
|
43
|
-
so.portal = `${api.url}/sharing/rest`;
|
|
44
|
-
}
|
|
45
|
-
// DEPRECATION
|
|
46
|
-
if ((_a = options.aggregations) === null || _a === void 0 ? void 0 : _a.length) {
|
|
47
|
-
// tslint:disable-next-line:no-console
|
|
48
|
-
console.warn(`IHubSearchOptions.aggregations is deprecated. Please use .aggFields instead.`);
|
|
49
|
-
so.countFields = options.aggregations.join(",");
|
|
50
|
-
so.countSize = options.aggLimit || 10;
|
|
51
|
-
}
|
|
52
|
-
// Aggregations
|
|
53
|
-
if ((_b = options.aggFields) === null || _b === void 0 ? void 0 : _b.length) {
|
|
54
|
-
so.countFields = options.aggFields.join(",");
|
|
55
|
-
so.countSize = options.aggLimit || 10;
|
|
56
|
-
}
|
|
57
|
-
searchPromise = searchPortal(so);
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
// Hub API Search
|
|
61
|
-
// TODO: Implement hub api content search
|
|
62
|
-
searchPromise = Promise.resolve({
|
|
63
|
-
total: 0,
|
|
64
|
-
results: [],
|
|
65
|
-
hasNext: false,
|
|
66
|
-
next: () => {
|
|
67
|
-
// tslint:disable-next-line
|
|
68
|
-
Promise.resolve(null);
|
|
69
|
-
},
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
return searchPromise;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Internal portal search, which then converts items to Content, and
|
|
76
|
-
* if a Site was passed, also sets urls
|
|
77
|
-
*
|
|
78
|
-
* @param searchOptions
|
|
79
|
-
* @param site
|
|
80
|
-
* @returns
|
|
81
|
-
*/
|
|
82
|
-
function searchPortal(searchOptions) {
|
|
83
|
-
var _a;
|
|
84
|
-
const portalUrl = ((_a = searchOptions.authentication) === null || _a === void 0 ? void 0 : _a.portal) || searchOptions.portal;
|
|
85
|
-
let token;
|
|
86
|
-
if (searchOptions.authentication) {
|
|
87
|
-
const us = searchOptions.authentication;
|
|
88
|
-
token = us.token;
|
|
89
|
-
}
|
|
90
|
-
const thumbnailify = (content) => {
|
|
91
|
-
content.thumbnailUrl = getItemThumbnailUrl(content, portalUrl, token);
|
|
92
|
-
return content;
|
|
93
|
-
};
|
|
94
|
-
return searchItems(searchOptions).then((resp) => {
|
|
95
|
-
const hasNext = resp.nextStart > -1;
|
|
96
|
-
// convert items to IHubContent's
|
|
97
|
-
let content = resp.results.map(itemToContent);
|
|
98
|
-
// if we have a site, add those urls
|
|
99
|
-
if (searchOptions.site) {
|
|
100
|
-
content = content.map((entry) => setContentSiteUrls(entry, searchOptions.site));
|
|
101
|
-
}
|
|
102
|
-
// add thumbnailUrl
|
|
103
|
-
content = content.map(thumbnailify);
|
|
104
|
-
return {
|
|
105
|
-
total: resp.total,
|
|
106
|
-
results: content,
|
|
107
|
-
hasNext,
|
|
108
|
-
next: getNextFunction(searchOptions, resp.nextStart, resp.total, searchPortal),
|
|
109
|
-
};
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
//# sourceMappingURL=_searchContent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_searchContent.js","sourceRoot":"","sources":["../../../src/search/_searchContent.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,+BAA+B,GAChC,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAkB,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EACL,mBAAmB,EAGnB,aAAa,EACb,kBAAkB,GACnB,MAAM,IAAI,CAAC;AAEZ,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,mCAAmC;AAEnC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAAyB,EACzB,OAA0B;;IAE1B,MAAM,CAAC,IAAI,CACT,uEAAuE,CACxE,CAAC;IACF,kDAAkD;IAClD,MAAM,QAAQ,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAE7C,MAAM;IACN,MAAM,GAAG,GAAG,SAAS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C,CAAC;SACH;QACD,mBAAmB;QACnB,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAEpC,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE,OAAO;YAChB,OAAO;YACP,IAAI,EAAE,eAAe,CACnB,aAAa,EACb,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,KAAK,EACV,YAAY,CACb;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { searchGroups as portalGroupSearch } from "@esri/arcgis-rest-portal";
|
|
2
|
-
import { expandApi, getNextFunction } from ".";
|
|
3
|
-
import { expandGroupFilter, serializeGroupFilterForPortal, } from "./group-utils";
|
|
4
|
-
import { getGroupThumbnailUrl, Logger } from "..";
|
|
5
|
-
// TODO: Remove with _searchContent
|
|
6
|
-
/**
|
|
7
|
-
* @private
|
|
8
|
-
* Search Groups using Filter<"group">
|
|
9
|
-
*
|
|
10
|
-
* Currently just returns ISearchResult<IGroup>
|
|
11
|
-
* @param filter
|
|
12
|
-
* @param options
|
|
13
|
-
* @returns
|
|
14
|
-
*/
|
|
15
|
-
export async function _searchGroups(filter, options) {
|
|
16
|
-
Logger.warn(`DEPRECATION: _searchGroups will be removed; switch to hubSearch(...)`);
|
|
17
|
-
// expand filter so we can serialize to either api
|
|
18
|
-
const expanded = expandGroupFilter(filter);
|
|
19
|
-
// API
|
|
20
|
-
const api = expandApi(options.api || "arcgis");
|
|
21
|
-
if (api.type === "arcgis") {
|
|
22
|
-
const so = serializeGroupFilterForPortal(expanded);
|
|
23
|
-
// Array of properties we want to copy from IHubSearchOptions
|
|
24
|
-
// to the ISearchOptions
|
|
25
|
-
const props = [
|
|
26
|
-
"authentication",
|
|
27
|
-
"num",
|
|
28
|
-
"sortField",
|
|
29
|
-
"sortOrder",
|
|
30
|
-
"site",
|
|
31
|
-
"start",
|
|
32
|
-
];
|
|
33
|
-
// copy the props over
|
|
34
|
-
props.forEach((prop) => {
|
|
35
|
-
if (options.hasOwnProperty(prop)) {
|
|
36
|
-
so[prop] = options[prop];
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
// If we don't have auth, ensure we have .portal
|
|
40
|
-
if (!so.authentication) {
|
|
41
|
-
so.portal = `${api.url}/sharing/rest`;
|
|
42
|
-
}
|
|
43
|
-
return searchPortalGroups(so);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
throw new Error("_searchGroups is not implemented for non-arcgis apis");
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Internal function that searches for groups using the ArcGIS Portal API
|
|
51
|
-
* @param searchOptions
|
|
52
|
-
* @returns
|
|
53
|
-
*/
|
|
54
|
-
function searchPortalGroups(searchOptions) {
|
|
55
|
-
var _a;
|
|
56
|
-
const teamLinkify = (group) => {
|
|
57
|
-
group.siteTeamUrl = `${searchOptions.site.item.url}/teams/${group.id}/about`;
|
|
58
|
-
return group;
|
|
59
|
-
};
|
|
60
|
-
const portalUrl = ((_a = searchOptions.authentication) === null || _a === void 0 ? void 0 : _a.portal) || searchOptions.portal;
|
|
61
|
-
let token;
|
|
62
|
-
if (searchOptions.authentication) {
|
|
63
|
-
const us = searchOptions.authentication;
|
|
64
|
-
token = us.token;
|
|
65
|
-
}
|
|
66
|
-
const thumbnailify = (group) => {
|
|
67
|
-
group.thumbnailUrl = getGroupThumbnailUrl(portalUrl, group, token);
|
|
68
|
-
return group;
|
|
69
|
-
};
|
|
70
|
-
// execute the search
|
|
71
|
-
return portalGroupSearch(searchOptions).then((response) => {
|
|
72
|
-
var _a, _b;
|
|
73
|
-
const hasNext = response.nextStart > -1;
|
|
74
|
-
// upgrade thumbnail url
|
|
75
|
-
let results = response.results.map(thumbnailify);
|
|
76
|
-
// generate the site team url if site url is provided
|
|
77
|
-
if ((_b = (_a = searchOptions.site) === null || _a === void 0 ? void 0 : _a.item) === null || _b === void 0 ? void 0 : _b.url) {
|
|
78
|
-
results = response.results.map(teamLinkify);
|
|
79
|
-
}
|
|
80
|
-
return {
|
|
81
|
-
hasNext,
|
|
82
|
-
total: response.total,
|
|
83
|
-
results,
|
|
84
|
-
next: getNextFunction(searchOptions, response.nextStart, response.total, searchPortalGroups),
|
|
85
|
-
};
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
//# sourceMappingURL=_searchGroups.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_searchGroups.js","sourceRoot":"","sources":["../../../src/search/_searchGroups.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,IAAI,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,GAAG,CAAC;AAC/C,OAAO,EACL,iBAAiB,EACjB,6BAA6B,GAC9B,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,oBAAoB,EAAmB,MAAM,EAAE,MAAM,IAAI,CAAC;AAEnE,mCAAmC;AAEnC;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAAuB,EACvB,OAA0B;IAE1B,MAAM,CAAC,IAAI,CACT,sEAAsE,CACvE,CAAC;IACF,kDAAkD;IAClD,MAAM,QAAQ,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAE3C,MAAM;IACN,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,QAAQ,CAAC,CAAC;IAE/C,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;QACzB,MAAM,EAAE,GAAG,6BAA6B,CAAC,QAAQ,CAAC,CAAC;QAEnD,6DAA6D;QAC7D,wBAAwB;QACxB,MAAM,KAAK,GAAmC;YAC5C,gBAAgB;YAChB,KAAK;YACL,WAAW;YACX,WAAW;YACX,MAAM;YACN,OAAO;SACR,CAAC;QACF,sBAAsB;QACtB,KAAK,CAAC,OAAO,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,QAAQ,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;QAEjD,wBAAwB;QACxB,IAAI,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QACjD,qDAAqD;QACrD,gBAAI,aAAa,CAAC,IAAI,0CAAE,IAAI,0CAAE,GAAG,EAAE;YACjC,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;SAC7C;QAED,OAAO;YACL,OAAO;YACP,KAAK,EAAE,QAAQ,CAAC,KAAK;YACrB,OAAO;YACP,IAAI,EAAE,eAAe,CACnB,aAAa,EACb,QAAQ,CAAC,SAAS,EAClB,QAAQ,CAAC,KAAK,EACd,kBAAkB,CACnB;SACyB,CAAC;IAC/B,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { expandApi, expandUserFilter, getNextFunction, getUserThumbnailUrl, Logger, serializeUserFilterForPortal, } from "..";
|
|
2
|
-
import { searchUsers as portalUserSearch, } from "@esri/arcgis-rest-portal";
|
|
3
|
-
// TODO: Remove with _searchContent
|
|
4
|
-
/**
|
|
5
|
-
* @private
|
|
6
|
-
* Search for Users via the Portal API.
|
|
7
|
-
*
|
|
8
|
-
* **Note** Authentication is required
|
|
9
|
-
*
|
|
10
|
-
* Another trivial comment to force a release
|
|
11
|
-
*
|
|
12
|
-
* Note: in the future, there may be options to search via
|
|
13
|
-
* a Hub specific API
|
|
14
|
-
* @param filter
|
|
15
|
-
* @param options
|
|
16
|
-
* @returns
|
|
17
|
-
*/
|
|
18
|
-
export async function _searchUsers(filter, options) {
|
|
19
|
-
Logger.warn(`DEPRECATION: _searchUsers will be removed; switch to hubSearch(...)`);
|
|
20
|
-
// JS Clients may not pass in authentication
|
|
21
|
-
if (!options.authentication) {
|
|
22
|
-
throw new Error("Authentication required to search for users.");
|
|
23
|
-
}
|
|
24
|
-
// expand filter so we can serialize to either api
|
|
25
|
-
const expanded = expandUserFilter(filter);
|
|
26
|
-
// API
|
|
27
|
-
const api = expandApi(options.api || "arcgis");
|
|
28
|
-
if (api.type === "arcgis") {
|
|
29
|
-
const searchOptions = serializeUserFilterForPortal(expanded);
|
|
30
|
-
// Array of properties we want to copy from IHubSearchOptions
|
|
31
|
-
// to the ISearchOptions
|
|
32
|
-
const props = [
|
|
33
|
-
"authentication",
|
|
34
|
-
"num",
|
|
35
|
-
"sortField",
|
|
36
|
-
"sortOrder",
|
|
37
|
-
"site",
|
|
38
|
-
"start",
|
|
39
|
-
];
|
|
40
|
-
// copy the props over
|
|
41
|
-
props.forEach((prop) => {
|
|
42
|
-
if (options.hasOwnProperty(prop)) {
|
|
43
|
-
searchOptions[prop] = options[prop];
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
return searchPortalUsers(searchOptions);
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
throw new Error("_searchUsers is not implemented for non-arcgis apis");
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Internal function that executes the user search along with
|
|
54
|
-
* some simple enrichments
|
|
55
|
-
* @param searchOptions
|
|
56
|
-
* @returns
|
|
57
|
-
*/
|
|
58
|
-
function searchPortalUsers(searchOptions) {
|
|
59
|
-
const portalUrl = searchOptions.authentication.portal;
|
|
60
|
-
const token = searchOptions.authentication.token;
|
|
61
|
-
// Partially applied functions for mapping over the results
|
|
62
|
-
const userLinkify = (user) => {
|
|
63
|
-
user.profileUrl = `${searchOptions.site.item.url}/people/${user.username}/profile`;
|
|
64
|
-
return user;
|
|
65
|
-
};
|
|
66
|
-
const thumbnailify = (user) => {
|
|
67
|
-
if (user.thumbnail) {
|
|
68
|
-
user.thumbnailUrl = getUserThumbnailUrl(portalUrl, user, token);
|
|
69
|
-
}
|
|
70
|
-
return user;
|
|
71
|
-
};
|
|
72
|
-
return portalUserSearch(searchOptions).then((response) => {
|
|
73
|
-
var _a, _b;
|
|
74
|
-
const hasNext = response.nextStart > -1;
|
|
75
|
-
// upgrade thumbnail url
|
|
76
|
-
let results = response.results.map(thumbnailify);
|
|
77
|
-
// generate the site team url if site url is provided
|
|
78
|
-
if ((_b = (_a = searchOptions.site) === null || _a === void 0 ? void 0 : _a.item) === null || _b === void 0 ? void 0 : _b.url) {
|
|
79
|
-
results = response.results.map(userLinkify);
|
|
80
|
-
}
|
|
81
|
-
return {
|
|
82
|
-
hasNext,
|
|
83
|
-
total: response.total,
|
|
84
|
-
results,
|
|
85
|
-
next: getNextFunction(searchOptions, response.nextStart, response.total, searchPortalUsers),
|
|
86
|
-
};
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
//# sourceMappingURL=_searchUsers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_searchUsers.js","sourceRoot":"","sources":["../../../src/search/_searchUsers.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,gBAAgB,EAEhB,eAAe,EACf,mBAAmB,EAGnB,MAAM,EACN,4BAA4B,GAC7B,MAAM,IAAI,CAAC;AACZ,OAAO,EAEL,WAAW,IAAI,gBAAgB,GAChC,MAAM,0BAA0B,CAAC;AAkBlC,mCAAmC;AACnC;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAAsB,EACtB,OAAuC;IAEvC,MAAM,CAAC,IAAI,CACT,qEAAqE,CACtE,CAAC;IAEF,4CAA4C;IAC5C,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE;QAC3B,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;KACjE;IACD,kDAAkD;IAClD,MAAM,QAAQ,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAE1C,MAAM;IACN,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,QAAQ,CAAC,CAAC;IAE/C,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;QACzB,MAAM,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