@esri/hub-common 9.45.2 → 9.45.3
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/search/_internal/ifilter-utils.js.map +1 -1
- package/dist/es2017/search/_internal/index.js +1 -0
- package/dist/es2017/search/_internal/index.js.map +1 -1
- package/dist/es2017/search/_internal/portalSearchGroups.js +1 -56
- package/dist/es2017/search/_internal/portalSearchGroups.js.map +1 -1
- package/dist/es2017/search/_internal/portalSearchItems.js +1 -87
- package/dist/es2017/search/_internal/portalSearchItems.js.map +1 -1
- package/dist/es2017/search/_internal/portalSearchUsers.js +0 -43
- package/dist/es2017/search/_internal/portalSearchUsers.js.map +1 -1
- package/dist/es2017/search/filter-utils.js +0 -197
- package/dist/es2017/search/filter-utils.js.map +1 -1
- package/dist/es2017/search/hubSearch.js +9 -38
- package/dist/es2017/search/hubSearch.js.map +1 -1
- package/dist/esm/search/_internal/ifilter-utils.js.map +1 -1
- package/dist/esm/search/_internal/index.js +1 -0
- package/dist/esm/search/_internal/index.js.map +1 -1
- package/dist/esm/search/_internal/portalSearchGroups.js +1 -57
- package/dist/esm/search/_internal/portalSearchGroups.js.map +1 -1
- package/dist/esm/search/_internal/portalSearchItems.js +1 -88
- package/dist/esm/search/_internal/portalSearchItems.js.map +1 -1
- package/dist/esm/search/_internal/portalSearchUsers.js +0 -45
- package/dist/esm/search/_internal/portalSearchUsers.js.map +1 -1
- package/dist/esm/search/filter-utils.js +0 -198
- package/dist/esm/search/filter-utils.js.map +1 -1
- package/dist/esm/search/hubSearch.js +9 -37
- package/dist/esm/search/hubSearch.js.map +1 -1
- package/dist/node/search/_internal/ifilter-utils.js.map +1 -1
- package/dist/node/search/_internal/index.js +1 -0
- package/dist/node/search/_internal/index.js.map +1 -1
- package/dist/node/search/_internal/portalSearchGroups.js +1 -57
- package/dist/node/search/_internal/portalSearchGroups.js.map +1 -1
- package/dist/node/search/_internal/portalSearchItems.js +2 -90
- package/dist/node/search/_internal/portalSearchItems.js.map +1 -1
- package/dist/node/search/_internal/portalSearchUsers.js +1 -45
- package/dist/node/search/_internal/portalSearchUsers.js.map +1 -1
- package/dist/node/search/filter-utils.js +1 -200
- package/dist/node/search/filter-utils.js.map +1 -1
- package/dist/node/search/hubSearch.js +12 -41
- package/dist/node/search/hubSearch.js.map +1 -1
- package/dist/types/search/_internal/index.d.ts +1 -0
- package/dist/types/search/_internal/portalSearchGroups.d.ts +1 -10
- package/dist/types/search/_internal/portalSearchItems.d.ts +1 -15
- package/dist/types/search/_internal/portalSearchUsers.d.ts +1 -9
- package/dist/types/search/filter-utils.d.ts +0 -17
- package/dist/types/search/hubSearch.d.ts +7 -4
- package/dist/types/search/types/IHubCatalog.d.ts +38 -2
- package/dist/umd/common.umd.js +33 -441
- package/dist/umd/common.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.hubSearch = exports.hubSearchQuery = void 0;
|
|
4
4
|
const HubError_1 = require("../HubError");
|
|
5
5
|
const objects_1 = require("../objects");
|
|
6
6
|
const util_1 = require("../util");
|
|
7
7
|
const utils_1 = require("./utils");
|
|
8
8
|
const _internal_1 = require("./_internal");
|
|
9
|
-
const portalSearchUsers_1 = require("./_internal/portalSearchUsers");
|
|
10
9
|
/**
|
|
11
|
-
*
|
|
10
|
+
* @private
|
|
11
|
+
* TEMPORARY - this function only exists to allow incremental
|
|
12
|
+
* changes and should be removed as soon as arcgis-hub-gallery
|
|
13
|
+
* is changed to call `hubSearch(...)` directly
|
|
12
14
|
*
|
|
13
15
|
* Default's to search ArcGIS Portal but can delegate
|
|
14
16
|
* to Hub API when it's available.
|
|
@@ -16,42 +18,11 @@ const portalSearchUsers_1 = require("./_internal/portalSearchUsers");
|
|
|
16
18
|
* @param options
|
|
17
19
|
* @returns
|
|
18
20
|
*/
|
|
19
|
-
async function
|
|
20
|
-
//
|
|
21
|
-
|
|
22
|
-
throw new HubError_1.default("hubSearch", "FilterGroups are required and must be an array.");
|
|
23
|
-
}
|
|
24
|
-
if (!filterGroups.length) {
|
|
25
|
-
throw new HubError_1.default("hubSearch", "FilterGrous array must contain at least one entry.");
|
|
26
|
-
}
|
|
27
|
-
if (!options.requestOptions) {
|
|
28
|
-
throw new HubError_1.default("hubSearch", "requestOptions: IHubRequestOptions is required.");
|
|
29
|
-
}
|
|
30
|
-
// Ensure includes is an array
|
|
31
|
-
if (!options.include) {
|
|
32
|
-
options.include = [];
|
|
33
|
-
}
|
|
34
|
-
// Get the type of the first filterGroup
|
|
35
|
-
const filterType = filterGroups[0].filterType;
|
|
36
|
-
// get the API
|
|
37
|
-
const apiType = utils_1.expandApi(options.api || "arcgis").type;
|
|
38
|
-
const fnHash = {
|
|
39
|
-
arcgis: {
|
|
40
|
-
item: _internal_1.portalSearchItemsFilterGroups,
|
|
41
|
-
group: _internal_1.portalSearchGroupsFilterGroups,
|
|
42
|
-
user: portalSearchUsers_1.portalSearchUsersFilterGroups,
|
|
43
|
-
},
|
|
44
|
-
"arcgis-hub": {
|
|
45
|
-
item: _internal_1.hubSearchItems,
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
const fn = objects_1.getProp(fnHash, `${apiType}.${filterType}`);
|
|
49
|
-
if (!fn) {
|
|
50
|
-
throw new HubError_1.default(`hubSearch`, `Search via "${filterType}" filter against "${apiType}" api is not implemented`);
|
|
51
|
-
}
|
|
52
|
-
return fn(util_1.cloneObject(filterGroups), options);
|
|
21
|
+
async function hubSearchQuery(query, options) {
|
|
22
|
+
// delegate
|
|
23
|
+
return hubSearch(query, options);
|
|
53
24
|
}
|
|
54
|
-
exports.
|
|
25
|
+
exports.hubSearchQuery = hubSearchQuery;
|
|
55
26
|
/**
|
|
56
27
|
* Main entrypoint for searching via Hub
|
|
57
28
|
*
|
|
@@ -61,7 +32,7 @@ exports.hubSearch = hubSearch;
|
|
|
61
32
|
* @param options
|
|
62
33
|
* @returns
|
|
63
34
|
*/
|
|
64
|
-
async function
|
|
35
|
+
async function hubSearch(query, options) {
|
|
65
36
|
// Validate inputs
|
|
66
37
|
if (!query) {
|
|
67
38
|
throw new HubError_1.default("hubSearch", "Query is required.");
|
|
@@ -84,7 +55,7 @@ async function hubSearchQuery(query, options) {
|
|
|
84
55
|
arcgis: {
|
|
85
56
|
item: _internal_1.portalSearchItems,
|
|
86
57
|
group: _internal_1.portalSearchGroups,
|
|
87
|
-
user:
|
|
58
|
+
user: _internal_1.portalSearchUsers,
|
|
88
59
|
},
|
|
89
60
|
"arcgis-hub": {
|
|
90
61
|
item: _internal_1.hubSearchItems,
|
|
@@ -96,5 +67,5 @@ async function hubSearchQuery(query, options) {
|
|
|
96
67
|
}
|
|
97
68
|
return fn(util_1.cloneObject(query), options);
|
|
98
69
|
}
|
|
99
|
-
exports.
|
|
70
|
+
exports.hubSearch = hubSearch;
|
|
100
71
|
//# sourceMappingURL=hubSearch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hubSearch.js","sourceRoot":"","sources":["../../../src/search/hubSearch.ts"],"names":[],"mappings":";;;AAAA,0CAAmC;AACnC,wCAAqC;AACrC,kCAAsC;
|
|
1
|
+
{"version":3,"file":"hubSearch.js","sourceRoot":"","sources":["../../../src/search/hubSearch.ts"],"names":[],"mappings":";;;AAAA,0CAAmC;AACnC,wCAAqC;AACrC,kCAAsC;AAQtC,mCAAoC;AACpC,2CAKqB;AAErB;;;;;;;;;;;GAWG;AACI,KAAK,UAAU,cAAc,CAClC,KAAa,EACb,OAA0B;IAE1B,WAAW;IACX,OAAO,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACnC,CAAC;AAND,wCAMC;AAED;;;;;;;;GAQG;AACI,KAAK,UAAU,SAAS,CAC7B,KAAa,EACb,OAA0B;IAE1B,kBAAkB;IAClB,IAAI,CAAC,KAAK,EAAE;QACV,MAAM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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,
|
|
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 {
|
|
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 {
|
|
1
|
+
import { IHubSearchOptions, IHubSearchResponse, IHubSearchResult, IQuery } from "./types";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
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
|
|
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
|
|
24
|
+
export declare function hubSearch(query: IQuery, options: IHubSearchOptions): Promise<IHubSearchResponse<IHubSearchResult>>;
|
|
@@ -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
|
-
|
|
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
|
}
|