@esri/hub-common 9.45.1 → 9.45.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/content/compose.js +1 -1
- package/dist/es2017/content/compose.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/ipredicate-utils.js +38 -0
- package/dist/es2017/search/_internal/ipredicate-utils.js.map +1 -0
- package/dist/es2017/search/_internal/portalSearchGroups.js +3 -57
- package/dist/es2017/search/_internal/portalSearchGroups.js.map +1 -1
- package/dist/es2017/search/_internal/portalSearchItems.js +3 -88
- package/dist/es2017/search/_internal/portalSearchItems.js.map +1 -1
- package/dist/es2017/search/_internal/portalSearchUsers.js +2 -44
- 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/es2017/search/{_internal/ifilter-utils.js → ifilter-utils.js} +1 -37
- package/dist/es2017/search/ifilter-utils.js.map +1 -0
- package/dist/es2017/search/index.js +1 -0
- package/dist/es2017/search/index.js.map +1 -1
- package/dist/esm/content/compose.js +1 -1
- package/dist/esm/content/compose.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/ipredicate-utils.js +40 -0
- package/dist/esm/search/_internal/ipredicate-utils.js.map +1 -0
- package/dist/esm/search/_internal/portalSearchGroups.js +3 -58
- package/dist/esm/search/_internal/portalSearchGroups.js.map +1 -1
- package/dist/esm/search/_internal/portalSearchItems.js +3 -89
- package/dist/esm/search/_internal/portalSearchItems.js.map +1 -1
- package/dist/esm/search/_internal/portalSearchUsers.js +2 -46
- 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/esm/search/{_internal/ifilter-utils.js → ifilter-utils.js} +1 -38
- package/dist/esm/search/ifilter-utils.js.map +1 -0
- package/dist/esm/search/index.js +1 -0
- package/dist/esm/search/index.js.map +1 -1
- package/dist/node/content/compose.js +1 -1
- package/dist/node/content/compose.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/ipredicate-utils.js +42 -0
- package/dist/node/search/_internal/ipredicate-utils.js.map +1 -0
- package/dist/node/search/_internal/portalSearchGroups.js +4 -59
- package/dist/node/search/_internal/portalSearchGroups.js.map +1 -1
- package/dist/node/search/_internal/portalSearchItems.js +5 -92
- package/dist/node/search/_internal/portalSearchItems.js.map +1 -1
- package/dist/node/search/_internal/portalSearchUsers.js +4 -47
- 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/node/search/{_internal/ifilter-utils.js → ifilter-utils.js} +3 -40
- package/dist/node/search/ifilter-utils.js.map +1 -0
- package/dist/node/search/index.js +1 -0
- package/dist/node/search/index.js.map +1 -1
- package/dist/types/search/_internal/index.d.ts +1 -0
- package/dist/types/search/_internal/ipredicate-utils.d.ts +2 -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/{_internal/ifilter-utils.d.ts → ifilter-utils.d.ts} +1 -2
- package/dist/types/search/index.d.ts +1 -0
- package/dist/types/search/types/IHubCatalog.d.ts +38 -2
- package/dist/umd/common.umd.js +205 -611
- package/dist/umd/common.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/es2017/search/_internal/ifilter-utils.js.map +0 -1
- package/dist/esm/search/_internal/ifilter-utils.js.map +0 -1
- package/dist/node/search/_internal/ifilter-utils.js.map +0 -1
package/dist/umd/common.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* @preserve
|
|
2
|
-
* @esri/hub-common - v9.45.
|
|
2
|
+
* @esri/hub-common - v9.45.3 - Fri Jul 01 2022 14:51:47 GMT+0000 (Coordinated Universal Time)
|
|
3
3
|
* Copyright (c) 2022 Environmental Systems Research Institute, Inc.
|
|
4
4
|
* Apache-2.0
|
|
5
5
|
*/
|
|
@@ -7609,7 +7609,7 @@
|
|
|
7609
7609
|
hubInitiative: "initiative",
|
|
7610
7610
|
hubInitiativeTemplate: "initiative-template",
|
|
7611
7611
|
hubPage: "browser",
|
|
7612
|
-
hubProject: "
|
|
7612
|
+
hubProject: "projects",
|
|
7613
7613
|
hubSiteApplication: "web",
|
|
7614
7614
|
image: "file-image",
|
|
7615
7615
|
imageService: "data",
|
|
@@ -13548,7 +13548,7 @@
|
|
|
13548
13548
|
* @param join
|
|
13549
13549
|
* @returns
|
|
13550
13550
|
*/
|
|
13551
|
-
function mergeSearchOptions$
|
|
13551
|
+
function mergeSearchOptions$1(so1, so2, join) {
|
|
13552
13552
|
// TODO: Remove with _searchContent
|
|
13553
13553
|
Logger.warn("DEPRECATION: mergeSearchOptions will be removed. Work with IFilterGroups<\"group\"> and hubSearch() instead");
|
|
13554
13554
|
var result = cloneObject$1(so1);
|
|
@@ -13569,7 +13569,7 @@
|
|
|
13569
13569
|
* @param opts
|
|
13570
13570
|
* @returns
|
|
13571
13571
|
*/
|
|
13572
|
-
function serializeMatchOptions$
|
|
13572
|
+
function serializeMatchOptions$1(key, opts) {
|
|
13573
13573
|
var result = {
|
|
13574
13574
|
q: "",
|
|
13575
13575
|
filter: "",
|
|
@@ -13594,7 +13594,7 @@
|
|
|
13594
13594
|
var groupFilterableFields = ["title", "typekeywords", "owner"];
|
|
13595
13595
|
var filterableFields = __spreadArrays(userFilterableFields, itemFilterableFields, groupFilterableFields);
|
|
13596
13596
|
if (filterableFields.includes(key)) {
|
|
13597
|
-
result.filter = serializeStringOrArray$
|
|
13597
|
+
result.filter = serializeStringOrArray$1("AND", key, opts.exact);
|
|
13598
13598
|
}
|
|
13599
13599
|
else {
|
|
13600
13600
|
// Treat it the same as .all
|
|
@@ -13620,18 +13620,18 @@
|
|
|
13620
13620
|
}
|
|
13621
13621
|
// Handle the other props
|
|
13622
13622
|
if (opts.any) {
|
|
13623
|
-
result.q = serializeStringOrArray$
|
|
13623
|
+
result.q = serializeStringOrArray$1("OR", key, opts.any);
|
|
13624
13624
|
}
|
|
13625
13625
|
if (opts.all) {
|
|
13626
13626
|
result.q =
|
|
13627
13627
|
(result.q ? result.q + " AND " : "") +
|
|
13628
|
-
serializeStringOrArray$
|
|
13628
|
+
serializeStringOrArray$1("AND", key, opts.all);
|
|
13629
13629
|
}
|
|
13630
13630
|
if (opts.not) {
|
|
13631
13631
|
// negate the entries if they are not
|
|
13632
13632
|
result.q =
|
|
13633
13633
|
(result.q ? result.q + " AND " : "") +
|
|
13634
|
-
serializeStringOrArray$
|
|
13634
|
+
serializeStringOrArray$1("OR", "-" + key, opts.not);
|
|
13635
13635
|
}
|
|
13636
13636
|
return result;
|
|
13637
13637
|
}
|
|
@@ -13642,7 +13642,7 @@
|
|
|
13642
13642
|
* @param range
|
|
13643
13643
|
* @returns
|
|
13644
13644
|
*/
|
|
13645
|
-
function serializeDateRange$
|
|
13645
|
+
function serializeDateRange$1(key, range) {
|
|
13646
13646
|
return {
|
|
13647
13647
|
q: key + ":[" + range.from + " TO " + range.to + "]",
|
|
13648
13648
|
filter: "",
|
|
@@ -13656,7 +13656,7 @@
|
|
|
13656
13656
|
* @param value
|
|
13657
13657
|
* @returns
|
|
13658
13658
|
*/
|
|
13659
|
-
function serializeStringOrArray$
|
|
13659
|
+
function serializeStringOrArray$1(join, key, value) {
|
|
13660
13660
|
var q = "";
|
|
13661
13661
|
if (Array.isArray(value)) {
|
|
13662
13662
|
q = key + ":\"" + value.join("\" " + join + " " + key + ":\"") + "\"";
|
|
@@ -14043,7 +14043,7 @@
|
|
|
14043
14043
|
if (isWellKnownType(entry)) {
|
|
14044
14044
|
// working with dynamic objects in typescript requires some assertions
|
|
14045
14045
|
var key = entry;
|
|
14046
|
-
clone.subFilters = clone.subFilters.concat(lookupTypeFilters
|
|
14046
|
+
clone.subFilters = clone.subFilters.concat(lookupTypeFilters(key));
|
|
14047
14047
|
}
|
|
14048
14048
|
else {
|
|
14049
14049
|
acc.push(entry);
|
|
@@ -14053,7 +14053,7 @@
|
|
|
14053
14053
|
}
|
|
14054
14054
|
else if (isWellKnownType(clone.type)) {
|
|
14055
14055
|
var key = clone.type;
|
|
14056
|
-
clone.subFilters = clone.subFilters.concat(lookupTypeFilters
|
|
14056
|
+
clone.subFilters = clone.subFilters.concat(lookupTypeFilters(key));
|
|
14057
14057
|
delete clone.type;
|
|
14058
14058
|
}
|
|
14059
14059
|
else ;
|
|
@@ -14076,7 +14076,7 @@
|
|
|
14076
14076
|
}
|
|
14077
14077
|
return result;
|
|
14078
14078
|
}
|
|
14079
|
-
function lookupTypeFilters
|
|
14079
|
+
function lookupTypeFilters(key) {
|
|
14080
14080
|
return ContentFilterExpansions[key];
|
|
14081
14081
|
}
|
|
14082
14082
|
/**
|
|
@@ -14144,12 +14144,12 @@
|
|
|
14144
14144
|
// from hitting the else
|
|
14145
14145
|
/* istanbul ignore else */
|
|
14146
14146
|
if (typeof entry === "object") {
|
|
14147
|
-
acc = mergeSearchOptions$
|
|
14147
|
+
acc = mergeSearchOptions$1(acc, convertContentFilterToSearchOptions(entry), "OR");
|
|
14148
14148
|
}
|
|
14149
14149
|
return acc;
|
|
14150
14150
|
}, { q: "", filter: "" });
|
|
14151
14151
|
// merge with searchOptions using AND
|
|
14152
|
-
searchOptions = mergeSearchOptions$
|
|
14152
|
+
searchOptions = mergeSearchOptions$1(searchOptions, subFilterOptions, "AND");
|
|
14153
14153
|
}
|
|
14154
14154
|
// term is always last, and pre-pended on searchOptions.q
|
|
14155
14155
|
if (filter.term) {
|
|
@@ -14177,11 +14177,11 @@
|
|
|
14177
14177
|
var key = _a[0], value = _a[1];
|
|
14178
14178
|
// MatchOptions may go into either q or filter
|
|
14179
14179
|
if (!specialProps.includes(key)) {
|
|
14180
|
-
result = mergeSearchOptions$
|
|
14180
|
+
result = mergeSearchOptions$1(result, serializeMatchOptions$1(key, value), "AND");
|
|
14181
14181
|
}
|
|
14182
14182
|
// Dates only go into q
|
|
14183
14183
|
if (dateProps.includes(key)) {
|
|
14184
|
-
result = mergeSearchOptions$
|
|
14184
|
+
result = mergeSearchOptions$1(result, serializeDateRange$1(key, value), "AND");
|
|
14185
14185
|
}
|
|
14186
14186
|
});
|
|
14187
14187
|
return result;
|
|
@@ -14312,11 +14312,11 @@
|
|
|
14312
14312
|
var key = _a[0], value = _a[1];
|
|
14313
14313
|
// MatchOptions fields
|
|
14314
14314
|
if (!specialProps.includes(key)) {
|
|
14315
|
-
result = mergeSearchOptions$
|
|
14315
|
+
result = mergeSearchOptions$1(result, serializeMatchOptions$1(key, value), "AND");
|
|
14316
14316
|
}
|
|
14317
14317
|
// Dates only go into q
|
|
14318
14318
|
if (dateProps.includes(key)) {
|
|
14319
|
-
result = mergeSearchOptions$
|
|
14319
|
+
result = mergeSearchOptions$1(result, serializeDateRange$1(key, value), "AND");
|
|
14320
14320
|
}
|
|
14321
14321
|
});
|
|
14322
14322
|
// searchUserAccess is also a top-level property
|
|
@@ -14452,11 +14452,11 @@
|
|
|
14452
14452
|
var key = _a[0], value = _a[1];
|
|
14453
14453
|
// MatchOptions fields
|
|
14454
14454
|
if (!specialProps.includes(key)) {
|
|
14455
|
-
result = mergeSearchOptions$
|
|
14455
|
+
result = mergeSearchOptions$1(result, serializeMatchOptions$1(key, value), "AND");
|
|
14456
14456
|
}
|
|
14457
14457
|
// Dates only go into q
|
|
14458
14458
|
if (dateProps.includes(key)) {
|
|
14459
|
-
result = mergeSearchOptions$
|
|
14459
|
+
result = mergeSearchOptions$1(result, serializeDateRange$1(key, value), "AND");
|
|
14460
14460
|
}
|
|
14461
14461
|
});
|
|
14462
14462
|
// disabled is also a top-level property
|
|
@@ -14975,200 +14975,6 @@
|
|
|
14975
14975
|
return catalog;
|
|
14976
14976
|
}
|
|
14977
14977
|
|
|
14978
|
-
// DEPRECATED - REMOVE THIS FILE
|
|
14979
|
-
/**
|
|
14980
|
-
* Expand a Filter into it's more expressive structure so it can be
|
|
14981
|
-
* serialized deterministically.
|
|
14982
|
-
*
|
|
14983
|
-
* Props with type `string | string[] | MatchOptions` expand into `IMatchOptions`
|
|
14984
|
-
* Props relative-dates are expanded into formal date-ranges
|
|
14985
|
-
* @param filter
|
|
14986
|
-
* @returns
|
|
14987
|
-
*/
|
|
14988
|
-
function expandFilter(filter) {
|
|
14989
|
-
var result = {};
|
|
14990
|
-
var dateProps = ["created", "modified", "lastlogin"];
|
|
14991
|
-
var copyProps = [
|
|
14992
|
-
"filterType",
|
|
14993
|
-
"term",
|
|
14994
|
-
"searchUserAccess",
|
|
14995
|
-
"isopendata",
|
|
14996
|
-
"searchUserName",
|
|
14997
|
-
];
|
|
14998
|
-
var nonMatchOptionsFields = __spreadArrays(dateProps, copyProps);
|
|
14999
|
-
// Do the conversion
|
|
15000
|
-
Object.entries(filter).forEach(function (_a) {
|
|
15001
|
-
var key = _a[0], value = _a[1];
|
|
15002
|
-
// Handle MatchOptions fields
|
|
15003
|
-
if (!nonMatchOptionsFields.includes(key)) {
|
|
15004
|
-
// setProp side-steps typescript complaining
|
|
15005
|
-
setProp(key, valueToMatchOptions(value), result);
|
|
15006
|
-
}
|
|
15007
|
-
// Handle Date fields
|
|
15008
|
-
if (dateProps.includes(key)) {
|
|
15009
|
-
var dateFieldValue = cloneObject$1(getProp(filter, key));
|
|
15010
|
-
if (getProp(filter, key + ".type") === "relative-date") {
|
|
15011
|
-
setProp(key, relativeDateToDateRange(dateFieldValue), result);
|
|
15012
|
-
}
|
|
15013
|
-
else {
|
|
15014
|
-
setProp(key, dateFieldValue, result);
|
|
15015
|
-
}
|
|
15016
|
-
}
|
|
15017
|
-
// Handle fields that are just copied forward
|
|
15018
|
-
if (copyProps.includes(key) && filter.hasOwnProperty(key)) {
|
|
15019
|
-
setProp(key, value, result);
|
|
15020
|
-
}
|
|
15021
|
-
});
|
|
15022
|
-
return result;
|
|
15023
|
-
}
|
|
15024
|
-
/**
|
|
15025
|
-
* Serialize a FilterGroup of any type for Portal
|
|
15026
|
-
* @param filterGroups
|
|
15027
|
-
* @returns
|
|
15028
|
-
*/
|
|
15029
|
-
function serializeFilterGroupsForPortal(filterGroups) {
|
|
15030
|
-
var groupSearchOptions = filterGroups.map(serializeGroup);
|
|
15031
|
-
var result = mergeSearchOptions$1(groupSearchOptions, "AND");
|
|
15032
|
-
return result;
|
|
15033
|
-
}
|
|
15034
|
-
/**
|
|
15035
|
-
* Serialize the filters in a FitlerGroup into a Portal Query
|
|
15036
|
-
* @param filterGroup
|
|
15037
|
-
* @returns
|
|
15038
|
-
*/
|
|
15039
|
-
function serializeGroup(filterGroup) {
|
|
15040
|
-
var operation = filterGroup.operation || "AND";
|
|
15041
|
-
var filters = filterGroup.filters.map(expandFilter);
|
|
15042
|
-
var filterSearchOptions = filters.map(serializeFilter$1);
|
|
15043
|
-
// combine these searchOptions
|
|
15044
|
-
var groupSearchOptions = mergeSearchOptions$1(filterSearchOptions, operation);
|
|
15045
|
-
//
|
|
15046
|
-
if (filters.length > 1) {
|
|
15047
|
-
groupSearchOptions.q = "(" + groupSearchOptions.q + ")";
|
|
15048
|
-
}
|
|
15049
|
-
return groupSearchOptions;
|
|
15050
|
-
}
|
|
15051
|
-
/**
|
|
15052
|
-
* Serialize a Filter into a Portal Query
|
|
15053
|
-
* @param filter
|
|
15054
|
-
* @returns
|
|
15055
|
-
*/
|
|
15056
|
-
function serializeFilter$1(filter) {
|
|
15057
|
-
var dateProps = ["created", "modified"];
|
|
15058
|
-
var boolProps = ["isopendata"];
|
|
15059
|
-
var passThroughProps = ["searchUserAccess", "searchUserName"];
|
|
15060
|
-
var specialProps = __spreadArrays([
|
|
15061
|
-
"filterType",
|
|
15062
|
-
"term"
|
|
15063
|
-
], dateProps, boolProps, passThroughProps);
|
|
15064
|
-
var qCount = 0;
|
|
15065
|
-
// TODO: Look at using reduce vs .map and remove the `.filter`
|
|
15066
|
-
var opts = Object.entries(filter)
|
|
15067
|
-
.map(function (_a) {
|
|
15068
|
-
var key = _a[0], value = _a[1];
|
|
15069
|
-
var so = { q: "" };
|
|
15070
|
-
if (!specialProps.includes(key)) {
|
|
15071
|
-
qCount++;
|
|
15072
|
-
so.q = serializeMatchOptions$1(key, value);
|
|
15073
|
-
}
|
|
15074
|
-
if (dateProps.includes(key)) {
|
|
15075
|
-
qCount++;
|
|
15076
|
-
so.q = serializeDateRange$1(key, value);
|
|
15077
|
-
}
|
|
15078
|
-
if (boolProps.includes(key)) {
|
|
15079
|
-
qCount++;
|
|
15080
|
-
so.q = key + ":" + value;
|
|
15081
|
-
}
|
|
15082
|
-
if (passThroughProps.includes(key)) {
|
|
15083
|
-
so[key] = value;
|
|
15084
|
-
}
|
|
15085
|
-
if (key === "term") {
|
|
15086
|
-
qCount++;
|
|
15087
|
-
so.q = value;
|
|
15088
|
-
}
|
|
15089
|
-
return so;
|
|
15090
|
-
})
|
|
15091
|
-
.filter(function (e) { return e !== undefined; });
|
|
15092
|
-
// merge up all the searchOptions
|
|
15093
|
-
var searchOptions = mergeSearchOptions$1(opts, "AND");
|
|
15094
|
-
if (qCount > 1) {
|
|
15095
|
-
searchOptions.q = "(" + searchOptions.q + ")";
|
|
15096
|
-
}
|
|
15097
|
-
return searchOptions;
|
|
15098
|
-
}
|
|
15099
|
-
function mergeSearchOptions$1(options, operation) {
|
|
15100
|
-
var result = options.reduce(function (acc, entry) {
|
|
15101
|
-
// walk the props
|
|
15102
|
-
Object.entries(entry).forEach(function (_a) {
|
|
15103
|
-
var key = _a[0], value = _a[1];
|
|
15104
|
-
// if prop exists
|
|
15105
|
-
if (acc[key]) {
|
|
15106
|
-
// combine via operation
|
|
15107
|
-
acc[key] = acc[key] + " " + operation + " " + value;
|
|
15108
|
-
}
|
|
15109
|
-
else {
|
|
15110
|
-
// just copy the value
|
|
15111
|
-
acc[key] = value;
|
|
15112
|
-
}
|
|
15113
|
-
});
|
|
15114
|
-
return acc;
|
|
15115
|
-
}, { q: "" });
|
|
15116
|
-
return result;
|
|
15117
|
-
}
|
|
15118
|
-
/**
|
|
15119
|
-
* Serialize MatchOptions into portal syntax
|
|
15120
|
-
* @param key
|
|
15121
|
-
* @param value
|
|
15122
|
-
* @returns
|
|
15123
|
-
*/
|
|
15124
|
-
function serializeMatchOptions$1(key, value) {
|
|
15125
|
-
var result = "";
|
|
15126
|
-
if (value.any) {
|
|
15127
|
-
result = "" + serializeStringOrArray$1("OR", key, value.any);
|
|
15128
|
-
}
|
|
15129
|
-
if (value.all) {
|
|
15130
|
-
result =
|
|
15131
|
-
(result ? result + " AND " : "") +
|
|
15132
|
-
("" + serializeStringOrArray$1("AND", key, value.all));
|
|
15133
|
-
}
|
|
15134
|
-
if (value.not) {
|
|
15135
|
-
// negate the entries if they are not
|
|
15136
|
-
result =
|
|
15137
|
-
(result ? result + " AND " : "") +
|
|
15138
|
-
("" + serializeStringOrArray$1("OR", "-" + key, value.not));
|
|
15139
|
-
}
|
|
15140
|
-
// TODO HANDLE EXACT
|
|
15141
|
-
return result;
|
|
15142
|
-
}
|
|
15143
|
-
/**
|
|
15144
|
-
* Serialize a date-range into Portal syntax
|
|
15145
|
-
* @param key
|
|
15146
|
-
* @param range
|
|
15147
|
-
* @returns
|
|
15148
|
-
*/
|
|
15149
|
-
function serializeDateRange$1(key, range) {
|
|
15150
|
-
return key + ":[" + range.from + " TO " + range.to + "]";
|
|
15151
|
-
}
|
|
15152
|
-
/**
|
|
15153
|
-
* Serialize a `string` or `string[]` into a string
|
|
15154
|
-
* @param join
|
|
15155
|
-
* @param key
|
|
15156
|
-
* @param value
|
|
15157
|
-
* @returns
|
|
15158
|
-
*/
|
|
15159
|
-
function serializeStringOrArray$1(join, key, value) {
|
|
15160
|
-
var q = "";
|
|
15161
|
-
if (Array.isArray(value)) {
|
|
15162
|
-
q = key + ":\"" + value.join("\" " + join + " " + key + ":\"") + "\"";
|
|
15163
|
-
if (value.length > 1) {
|
|
15164
|
-
q = "(" + q + ")";
|
|
15165
|
-
}
|
|
15166
|
-
}
|
|
15167
|
-
else {
|
|
15168
|
-
q = key + ":\"" + value + "\"";
|
|
15169
|
-
}
|
|
15170
|
-
return q;
|
|
15171
|
-
}
|
|
15172
14978
|
/**
|
|
15173
14979
|
* Determine if a Filter is "empty"
|
|
15174
14980
|
* @param filter
|
|
@@ -15200,140 +15006,6 @@
|
|
|
15200
15006
|
}
|
|
15201
15007
|
}
|
|
15202
15008
|
|
|
15203
|
-
/**
|
|
15204
|
-
* Generic Hub Error with an Error stack as well
|
|
15205
|
-
* as an optional serialized OperationStack.
|
|
15206
|
-
*
|
|
15207
|
-
* Also accepts a `rootCause` Error object
|
|
15208
|
-
*/
|
|
15209
|
-
var HubError = /** @class */ (function (_super) {
|
|
15210
|
-
__extends(HubError, _super);
|
|
15211
|
-
/**
|
|
15212
|
-
* Creates an instance of HubError.
|
|
15213
|
-
* @param {string} operation
|
|
15214
|
-
* @param {string} [message]
|
|
15215
|
-
* @param {Error} [rootCause]
|
|
15216
|
-
* @memberof HubError
|
|
15217
|
-
*/
|
|
15218
|
-
function HubError(operation, message, rootCause) {
|
|
15219
|
-
var _this = this;
|
|
15220
|
-
message = message || "UNKNOWN_ERROR";
|
|
15221
|
-
// if the rootCause has a .rootCause, use that so we don't deeply nest
|
|
15222
|
-
rootCause = getWithDefault$1(rootCause, "rootCause", rootCause);
|
|
15223
|
-
/* Skip coverage on super(...) as per:
|
|
15224
|
-
https://github.com/Microsoft/TypeScript/issues/13029
|
|
15225
|
-
https://github.com/SitePen/remap-istanbul/issues/106
|
|
15226
|
-
*/
|
|
15227
|
-
/* istanbul ignore next */
|
|
15228
|
-
_this = _super.call(this, operation, message, rootCause) || this;
|
|
15229
|
-
_this.name = "HubError";
|
|
15230
|
-
// if the original error has a stack use it, otherwise create a new
|
|
15231
|
-
// stack. Note: a new Stack will make it look like the error origninated
|
|
15232
|
-
// in the HubError constructor. This is only an issue in tests but
|
|
15233
|
-
// it can be confusing to debug
|
|
15234
|
-
_this.stack = getWithDefault$1(rootCause, "stack", new Error().stack);
|
|
15235
|
-
return _this;
|
|
15236
|
-
}
|
|
15237
|
-
return HubError;
|
|
15238
|
-
}(OperationError$1));
|
|
15239
|
-
var HubError$1 = HubError;
|
|
15240
|
-
|
|
15241
|
-
/**
|
|
15242
|
-
* Generic search that returns Hub Entity types converted from items
|
|
15243
|
-
* by the passed in `ItemToEntityFunction`
|
|
15244
|
-
*
|
|
15245
|
-
* This abstraction is used to ensure that searching from any of the
|
|
15246
|
-
* entity managers / modules is consistent, and returns the entity
|
|
15247
|
-
* types, instead of `IItem` or `IHubContent`
|
|
15248
|
-
*
|
|
15249
|
-
* @param filter
|
|
15250
|
-
* @param convertFn
|
|
15251
|
-
* @param options
|
|
15252
|
-
* @returns
|
|
15253
|
-
*/
|
|
15254
|
-
function searchContentEntities(filter, convertFn, options) {
|
|
15255
|
-
var _a, _b;
|
|
15256
|
-
// expand filter so we can serialize to either api
|
|
15257
|
-
var expanded = expandContentFilter(filter);
|
|
15258
|
-
var searchOptions = serializeContentFilterForPortal(expanded);
|
|
15259
|
-
// DEPRECATION
|
|
15260
|
-
/* istanbul ignore next */
|
|
15261
|
-
if ((_a = options.aggregations) === null || _a === void 0 ? void 0 : _a.length) {
|
|
15262
|
-
// tslint:disable-next-line:no-console
|
|
15263
|
-
console.warn("IHubSearchOptions.aggregations is deprecated. Please use .aggFields instead.");
|
|
15264
|
-
searchOptions.countFields = options.aggregations.join(",");
|
|
15265
|
-
searchOptions.countSize = options.aggLimit || 10;
|
|
15266
|
-
}
|
|
15267
|
-
// Aggregations
|
|
15268
|
-
if ((_b = options.aggFields) === null || _b === void 0 ? void 0 : _b.length) {
|
|
15269
|
-
searchOptions.countFields = options.aggFields.join(",");
|
|
15270
|
-
searchOptions.countSize = options.aggLimit || 10;
|
|
15271
|
-
}
|
|
15272
|
-
// properties to copy from IHubSearchOptions to the ISearchOptions
|
|
15273
|
-
var props = [
|
|
15274
|
-
"authentication",
|
|
15275
|
-
"num",
|
|
15276
|
-
"sortField",
|
|
15277
|
-
"sortOrder",
|
|
15278
|
-
"site",
|
|
15279
|
-
"start",
|
|
15280
|
-
];
|
|
15281
|
-
// Include "start" here
|
|
15282
|
-
// copy the props over
|
|
15283
|
-
props.forEach(function (prop) {
|
|
15284
|
-
if (options.hasOwnProperty(prop)) {
|
|
15285
|
-
searchOptions[prop] = options[prop];
|
|
15286
|
-
}
|
|
15287
|
-
});
|
|
15288
|
-
// create the entitySearchFn
|
|
15289
|
-
var searchFn = createContentEntitySearchFn(convertFn);
|
|
15290
|
-
// execute the search
|
|
15291
|
-
// Add ArcGIS API
|
|
15292
|
-
if (options.api && !options.authentication) {
|
|
15293
|
-
var expandedApi = expandApi(options.api);
|
|
15294
|
-
searchOptions.portal = expandedApi.url;
|
|
15295
|
-
}
|
|
15296
|
-
return searchFn(searchOptions);
|
|
15297
|
-
}
|
|
15298
|
-
/**
|
|
15299
|
-
* Return a function that holds a closure containing
|
|
15300
|
-
* a hub entity specific conversion function. This
|
|
15301
|
-
* allows the `.next()` function to use the function on
|
|
15302
|
-
* subsequent calls
|
|
15303
|
-
* @param convertFn
|
|
15304
|
-
* @returns
|
|
15305
|
-
*/
|
|
15306
|
-
function createContentEntitySearchFn(convertFn) {
|
|
15307
|
-
// Return a function that does the search, with a closure over the
|
|
15308
|
-
// conversion function. Naming this function is important as it's
|
|
15309
|
-
// referenced in the `next` section below
|
|
15310
|
-
return function searchEntities(searchOptions) {
|
|
15311
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
15312
|
-
var response, entities, facets;
|
|
15313
|
-
return __generator(this, function (_a) {
|
|
15314
|
-
switch (_a.label) {
|
|
15315
|
-
case 0: return [4 /*yield*/, searchItems(searchOptions)];
|
|
15316
|
-
case 1:
|
|
15317
|
-
response = _a.sent();
|
|
15318
|
-
return [4 /*yield*/, Promise.all(response.results.map(function (itm) {
|
|
15319
|
-
return convertFn(itm, searchOptions);
|
|
15320
|
-
}))];
|
|
15321
|
-
case 2:
|
|
15322
|
-
entities = _a.sent();
|
|
15323
|
-
facets = convertPortalResponseToFacets(response);
|
|
15324
|
-
return [2 /*return*/, {
|
|
15325
|
-
total: response.total,
|
|
15326
|
-
results: entities,
|
|
15327
|
-
facets: facets,
|
|
15328
|
-
hasNext: response.nextStart > -1,
|
|
15329
|
-
next: getNextFunction(searchOptions, response.nextStart, response.total, searchEntities),
|
|
15330
|
-
}];
|
|
15331
|
-
}
|
|
15332
|
-
});
|
|
15333
|
-
});
|
|
15334
|
-
};
|
|
15335
|
-
}
|
|
15336
|
-
|
|
15337
15009
|
function expandPredicate(predicate) {
|
|
15338
15010
|
var result = {};
|
|
15339
15011
|
var dateProps = ["created", "modified", "lastlogin"];
|
|
@@ -15369,6 +15041,7 @@
|
|
|
15369
15041
|
});
|
|
15370
15042
|
return result;
|
|
15371
15043
|
}
|
|
15044
|
+
|
|
15372
15045
|
function serializeQueryForPortal(query) {
|
|
15373
15046
|
var filterSearchOptions = query.filters.map(serializeFilter);
|
|
15374
15047
|
var result = mergeSearchOptions(filterSearchOptions, "AND");
|
|
@@ -15509,47 +15182,181 @@
|
|
|
15509
15182
|
if (value.any) {
|
|
15510
15183
|
result = "" + serializeStringOrArray("OR", key, value.any);
|
|
15511
15184
|
}
|
|
15512
|
-
if (value.all) {
|
|
15513
|
-
result =
|
|
15514
|
-
(result ? result + " AND " : "") +
|
|
15515
|
-
("" + serializeStringOrArray("AND", key, value.all));
|
|
15185
|
+
if (value.all) {
|
|
15186
|
+
result =
|
|
15187
|
+
(result ? result + " AND " : "") +
|
|
15188
|
+
("" + serializeStringOrArray("AND", key, value.all));
|
|
15189
|
+
}
|
|
15190
|
+
if (value.not) {
|
|
15191
|
+
// negate the entries if they are not
|
|
15192
|
+
result =
|
|
15193
|
+
(result ? result + " AND " : "") +
|
|
15194
|
+
("" + serializeStringOrArray("OR", "-" + key, value.not));
|
|
15195
|
+
}
|
|
15196
|
+
return result;
|
|
15197
|
+
}
|
|
15198
|
+
/**
|
|
15199
|
+
* Serialize a date-range into Portal syntax
|
|
15200
|
+
* @param key
|
|
15201
|
+
* @param range
|
|
15202
|
+
* @returns
|
|
15203
|
+
*/
|
|
15204
|
+
function serializeDateRange(key, range) {
|
|
15205
|
+
return key + ":[" + range.from + " TO " + range.to + "]";
|
|
15206
|
+
}
|
|
15207
|
+
/**
|
|
15208
|
+
* Serialize a `string` or `string[]` into a string
|
|
15209
|
+
* @param join
|
|
15210
|
+
* @param key
|
|
15211
|
+
* @param value
|
|
15212
|
+
* @returns
|
|
15213
|
+
*/
|
|
15214
|
+
function serializeStringOrArray(join, key, value) {
|
|
15215
|
+
var q = "";
|
|
15216
|
+
if (Array.isArray(value)) {
|
|
15217
|
+
q = key + ":\"" + value.join("\" " + join + " " + key + ":\"") + "\"";
|
|
15218
|
+
if (value.length > 1) {
|
|
15219
|
+
q = "(" + q + ")";
|
|
15220
|
+
}
|
|
15221
|
+
}
|
|
15222
|
+
else {
|
|
15223
|
+
q = key + ":\"" + value + "\"";
|
|
15224
|
+
}
|
|
15225
|
+
return q;
|
|
15226
|
+
}
|
|
15227
|
+
|
|
15228
|
+
/**
|
|
15229
|
+
* Generic Hub Error with an Error stack as well
|
|
15230
|
+
* as an optional serialized OperationStack.
|
|
15231
|
+
*
|
|
15232
|
+
* Also accepts a `rootCause` Error object
|
|
15233
|
+
*/
|
|
15234
|
+
var HubError = /** @class */ (function (_super) {
|
|
15235
|
+
__extends(HubError, _super);
|
|
15236
|
+
/**
|
|
15237
|
+
* Creates an instance of HubError.
|
|
15238
|
+
* @param {string} operation
|
|
15239
|
+
* @param {string} [message]
|
|
15240
|
+
* @param {Error} [rootCause]
|
|
15241
|
+
* @memberof HubError
|
|
15242
|
+
*/
|
|
15243
|
+
function HubError(operation, message, rootCause) {
|
|
15244
|
+
var _this = this;
|
|
15245
|
+
message = message || "UNKNOWN_ERROR";
|
|
15246
|
+
// if the rootCause has a .rootCause, use that so we don't deeply nest
|
|
15247
|
+
rootCause = getWithDefault$1(rootCause, "rootCause", rootCause);
|
|
15248
|
+
/* Skip coverage on super(...) as per:
|
|
15249
|
+
https://github.com/Microsoft/TypeScript/issues/13029
|
|
15250
|
+
https://github.com/SitePen/remap-istanbul/issues/106
|
|
15251
|
+
*/
|
|
15252
|
+
/* istanbul ignore next */
|
|
15253
|
+
_this = _super.call(this, operation, message, rootCause) || this;
|
|
15254
|
+
_this.name = "HubError";
|
|
15255
|
+
// if the original error has a stack use it, otherwise create a new
|
|
15256
|
+
// stack. Note: a new Stack will make it look like the error origninated
|
|
15257
|
+
// in the HubError constructor. This is only an issue in tests but
|
|
15258
|
+
// it can be confusing to debug
|
|
15259
|
+
_this.stack = getWithDefault$1(rootCause, "stack", new Error().stack);
|
|
15260
|
+
return _this;
|
|
15261
|
+
}
|
|
15262
|
+
return HubError;
|
|
15263
|
+
}(OperationError$1));
|
|
15264
|
+
var HubError$1 = HubError;
|
|
15265
|
+
|
|
15266
|
+
/**
|
|
15267
|
+
* Generic search that returns Hub Entity types converted from items
|
|
15268
|
+
* by the passed in `ItemToEntityFunction`
|
|
15269
|
+
*
|
|
15270
|
+
* This abstraction is used to ensure that searching from any of the
|
|
15271
|
+
* entity managers / modules is consistent, and returns the entity
|
|
15272
|
+
* types, instead of `IItem` or `IHubContent`
|
|
15273
|
+
*
|
|
15274
|
+
* @param filter
|
|
15275
|
+
* @param convertFn
|
|
15276
|
+
* @param options
|
|
15277
|
+
* @returns
|
|
15278
|
+
*/
|
|
15279
|
+
function searchContentEntities(filter, convertFn, options) {
|
|
15280
|
+
var _a, _b;
|
|
15281
|
+
// expand filter so we can serialize to either api
|
|
15282
|
+
var expanded = expandContentFilter(filter);
|
|
15283
|
+
var searchOptions = serializeContentFilterForPortal(expanded);
|
|
15284
|
+
// DEPRECATION
|
|
15285
|
+
/* istanbul ignore next */
|
|
15286
|
+
if ((_a = options.aggregations) === null || _a === void 0 ? void 0 : _a.length) {
|
|
15287
|
+
// tslint:disable-next-line:no-console
|
|
15288
|
+
console.warn("IHubSearchOptions.aggregations is deprecated. Please use .aggFields instead.");
|
|
15289
|
+
searchOptions.countFields = options.aggregations.join(",");
|
|
15290
|
+
searchOptions.countSize = options.aggLimit || 10;
|
|
15291
|
+
}
|
|
15292
|
+
// Aggregations
|
|
15293
|
+
if ((_b = options.aggFields) === null || _b === void 0 ? void 0 : _b.length) {
|
|
15294
|
+
searchOptions.countFields = options.aggFields.join(",");
|
|
15295
|
+
searchOptions.countSize = options.aggLimit || 10;
|
|
15516
15296
|
}
|
|
15517
|
-
|
|
15518
|
-
|
|
15519
|
-
|
|
15520
|
-
|
|
15521
|
-
|
|
15297
|
+
// properties to copy from IHubSearchOptions to the ISearchOptions
|
|
15298
|
+
var props = [
|
|
15299
|
+
"authentication",
|
|
15300
|
+
"num",
|
|
15301
|
+
"sortField",
|
|
15302
|
+
"sortOrder",
|
|
15303
|
+
"site",
|
|
15304
|
+
"start",
|
|
15305
|
+
];
|
|
15306
|
+
// Include "start" here
|
|
15307
|
+
// copy the props over
|
|
15308
|
+
props.forEach(function (prop) {
|
|
15309
|
+
if (options.hasOwnProperty(prop)) {
|
|
15310
|
+
searchOptions[prop] = options[prop];
|
|
15311
|
+
}
|
|
15312
|
+
});
|
|
15313
|
+
// create the entitySearchFn
|
|
15314
|
+
var searchFn = createContentEntitySearchFn(convertFn);
|
|
15315
|
+
// execute the search
|
|
15316
|
+
// Add ArcGIS API
|
|
15317
|
+
if (options.api && !options.authentication) {
|
|
15318
|
+
var expandedApi = expandApi(options.api);
|
|
15319
|
+
searchOptions.portal = expandedApi.url;
|
|
15522
15320
|
}
|
|
15523
|
-
return
|
|
15524
|
-
}
|
|
15525
|
-
/**
|
|
15526
|
-
* Serialize a date-range into Portal syntax
|
|
15527
|
-
* @param key
|
|
15528
|
-
* @param range
|
|
15529
|
-
* @returns
|
|
15530
|
-
*/
|
|
15531
|
-
function serializeDateRange(key, range) {
|
|
15532
|
-
return key + ":[" + range.from + " TO " + range.to + "]";
|
|
15321
|
+
return searchFn(searchOptions);
|
|
15533
15322
|
}
|
|
15534
15323
|
/**
|
|
15535
|
-
*
|
|
15536
|
-
*
|
|
15537
|
-
*
|
|
15538
|
-
*
|
|
15324
|
+
* Return a function that holds a closure containing
|
|
15325
|
+
* a hub entity specific conversion function. This
|
|
15326
|
+
* allows the `.next()` function to use the function on
|
|
15327
|
+
* subsequent calls
|
|
15328
|
+
* @param convertFn
|
|
15539
15329
|
* @returns
|
|
15540
15330
|
*/
|
|
15541
|
-
function
|
|
15542
|
-
|
|
15543
|
-
|
|
15544
|
-
|
|
15545
|
-
|
|
15546
|
-
|
|
15547
|
-
|
|
15548
|
-
|
|
15549
|
-
|
|
15550
|
-
|
|
15551
|
-
|
|
15552
|
-
|
|
15331
|
+
function createContentEntitySearchFn(convertFn) {
|
|
15332
|
+
// Return a function that does the search, with a closure over the
|
|
15333
|
+
// conversion function. Naming this function is important as it's
|
|
15334
|
+
// referenced in the `next` section below
|
|
15335
|
+
return function searchEntities(searchOptions) {
|
|
15336
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
15337
|
+
var response, entities, facets;
|
|
15338
|
+
return __generator(this, function (_a) {
|
|
15339
|
+
switch (_a.label) {
|
|
15340
|
+
case 0: return [4 /*yield*/, searchItems(searchOptions)];
|
|
15341
|
+
case 1:
|
|
15342
|
+
response = _a.sent();
|
|
15343
|
+
return [4 /*yield*/, Promise.all(response.results.map(function (itm) {
|
|
15344
|
+
return convertFn(itm, searchOptions);
|
|
15345
|
+
}))];
|
|
15346
|
+
case 2:
|
|
15347
|
+
entities = _a.sent();
|
|
15348
|
+
facets = convertPortalResponseToFacets(response);
|
|
15349
|
+
return [2 /*return*/, {
|
|
15350
|
+
total: response.total,
|
|
15351
|
+
results: entities,
|
|
15352
|
+
facets: facets,
|
|
15353
|
+
hasNext: response.nextStart > -1,
|
|
15354
|
+
next: getNextFunction(searchOptions, response.nextStart, response.total, searchEntities),
|
|
15355
|
+
}];
|
|
15356
|
+
}
|
|
15357
|
+
});
|
|
15358
|
+
});
|
|
15359
|
+
};
|
|
15553
15360
|
}
|
|
15554
15361
|
|
|
15555
15362
|
/**
|
|
@@ -18089,56 +17896,6 @@
|
|
|
18089
17896
|
}
|
|
18090
17897
|
}
|
|
18091
17898
|
|
|
18092
|
-
/**
|
|
18093
|
-
* @private
|
|
18094
|
-
* DEPRECATED
|
|
18095
|
-
* @param filterGroups
|
|
18096
|
-
* @param options
|
|
18097
|
-
* @returns
|
|
18098
|
-
*/
|
|
18099
|
-
function portalSearchItemsFilterGroups(filterGroups, options) {
|
|
18100
|
-
var _a;
|
|
18101
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
18102
|
-
var replaced, expandedGroups, so, props;
|
|
18103
|
-
return __generator(this, function (_b) {
|
|
18104
|
-
if (!options.requestOptions) {
|
|
18105
|
-
throw new HubError$1("hubSearch", "requestOptions: IHubRequestOptions is required.");
|
|
18106
|
-
}
|
|
18107
|
-
replaced = applyWellKnownItemFilterGroups(filterGroups);
|
|
18108
|
-
expandedGroups = replaced.map(function (fg) {
|
|
18109
|
-
fg.filters = fg.filters.map(expandFilter);
|
|
18110
|
-
return fg;
|
|
18111
|
-
});
|
|
18112
|
-
so = serializeFilterGroupsForPortal(expandedGroups);
|
|
18113
|
-
props = [
|
|
18114
|
-
"num",
|
|
18115
|
-
"sortField",
|
|
18116
|
-
"sortOrder",
|
|
18117
|
-
"include",
|
|
18118
|
-
"start",
|
|
18119
|
-
"requestOptions",
|
|
18120
|
-
];
|
|
18121
|
-
// copy the props over
|
|
18122
|
-
props.forEach(function (prop) {
|
|
18123
|
-
if (options.hasOwnProperty(prop)) {
|
|
18124
|
-
so[prop] = options[prop];
|
|
18125
|
-
}
|
|
18126
|
-
});
|
|
18127
|
-
if (options.requestOptions.authentication) {
|
|
18128
|
-
so.authentication = options.requestOptions.authentication;
|
|
18129
|
-
}
|
|
18130
|
-
else {
|
|
18131
|
-
so.portal = options.requestOptions.portal;
|
|
18132
|
-
}
|
|
18133
|
-
// Aggregations
|
|
18134
|
-
if ((_a = options.aggFields) === null || _a === void 0 ? void 0 : _a.length) {
|
|
18135
|
-
so.countFields = options.aggFields.join(",");
|
|
18136
|
-
so.countSize = options.aggLimit || 10;
|
|
18137
|
-
}
|
|
18138
|
-
return [2 /*return*/, searchPortal$2(so)];
|
|
18139
|
-
});
|
|
18140
|
-
});
|
|
18141
|
-
}
|
|
18142
17899
|
/**
|
|
18143
17900
|
* @private
|
|
18144
17901
|
* Portal Search Implementation for Items
|
|
@@ -18456,39 +18213,6 @@
|
|
|
18456
18213
|
});
|
|
18457
18214
|
return queryClone;
|
|
18458
18215
|
}
|
|
18459
|
-
/**
|
|
18460
|
-
* DEPRECATED
|
|
18461
|
-
* @param filterGroups
|
|
18462
|
-
* @returns
|
|
18463
|
-
*/
|
|
18464
|
-
function applyWellKnownItemFilterGroups(filterGroups) {
|
|
18465
|
-
var clone = cloneObject$1(filterGroups);
|
|
18466
|
-
// iterate the filterGroups
|
|
18467
|
-
var result = clone.map(function (filterGroup) {
|
|
18468
|
-
filterGroup.filters = filterGroup.filters.reduce(function (updated, filter) {
|
|
18469
|
-
// check if the filter.type is a well-known type
|
|
18470
|
-
if (isWellKnownTypeFilter(filter.type)) {
|
|
18471
|
-
// get the set of filters to replace the current filter with
|
|
18472
|
-
var typeFilters = lookupTypeFilters(filter.type);
|
|
18473
|
-
// Note: At this point we could try to "merge" in the other
|
|
18474
|
-
// props on the filter, into all the filters returned from
|
|
18475
|
-
// the well-known hash. The problem with this is that the
|
|
18476
|
-
// combination may yield unexpected results; For now, if a filter
|
|
18477
|
-
// includes `.type is keyof WellKnownItemFilters` we simply
|
|
18478
|
-
// replace the entire filter with the array of filters returne
|
|
18479
|
-
// from the hash
|
|
18480
|
-
updated = __spreadArrays(updated, typeFilters);
|
|
18481
|
-
}
|
|
18482
|
-
else {
|
|
18483
|
-
// filter does not have a well-known type entry so keep it
|
|
18484
|
-
updated.push(filter);
|
|
18485
|
-
}
|
|
18486
|
-
return updated;
|
|
18487
|
-
}, []);
|
|
18488
|
-
return filterGroup;
|
|
18489
|
-
});
|
|
18490
|
-
return result;
|
|
18491
|
-
}
|
|
18492
18216
|
/**
|
|
18493
18217
|
* Is the argument a well-known type "key"
|
|
18494
18218
|
*
|
|
@@ -18506,13 +18230,10 @@
|
|
|
18506
18230
|
return result;
|
|
18507
18231
|
}
|
|
18508
18232
|
/**
|
|
18509
|
-
*
|
|
18233
|
+
* Return the predicates for a well-known type
|
|
18510
18234
|
* @param key
|
|
18511
18235
|
* @returns
|
|
18512
18236
|
*/
|
|
18513
|
-
function lookupTypeFilters(key) {
|
|
18514
|
-
return WellKnownItemFilters[key];
|
|
18515
|
-
}
|
|
18516
18237
|
function lookupTypePredicates(key) {
|
|
18517
18238
|
var rawPredicates = WellKnownItemFilters[key];
|
|
18518
18239
|
// Remove the filterType property as it's not needed in an IPredicate
|
|
@@ -18724,61 +18445,6 @@
|
|
|
18724
18445
|
return result;
|
|
18725
18446
|
}
|
|
18726
18447
|
|
|
18727
|
-
/**
|
|
18728
|
-
* @private
|
|
18729
|
-
* DEPRECATED: Use `portalSerchGroups`
|
|
18730
|
-
* Portal Search Implementation for Groups
|
|
18731
|
-
* @param filterGroups
|
|
18732
|
-
* @param options
|
|
18733
|
-
* @returns
|
|
18734
|
-
*/
|
|
18735
|
-
function portalSearchGroupsFilterGroups(filterGroups, options) {
|
|
18736
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
18737
|
-
var api, expandedGroups, so, props;
|
|
18738
|
-
return __generator(this, function (_a) {
|
|
18739
|
-
api = expandApi(options.api || "arcgis");
|
|
18740
|
-
if (!options.requestOptions) {
|
|
18741
|
-
if (options.authentication) {
|
|
18742
|
-
// create minimal requestOptions
|
|
18743
|
-
options.requestOptions = {
|
|
18744
|
-
authentication: options.authentication,
|
|
18745
|
-
portal: options.authentication.portal,
|
|
18746
|
-
};
|
|
18747
|
-
}
|
|
18748
|
-
else {
|
|
18749
|
-
options.requestOptions = {
|
|
18750
|
-
portal: api.url + "/sharing/rest",
|
|
18751
|
-
};
|
|
18752
|
-
}
|
|
18753
|
-
}
|
|
18754
|
-
expandedGroups = filterGroups.map(function (fg) {
|
|
18755
|
-
fg.filters = fg.filters.map(expandFilter);
|
|
18756
|
-
return fg;
|
|
18757
|
-
});
|
|
18758
|
-
so = serializeFilterGroupsForPortal(expandedGroups);
|
|
18759
|
-
props = [
|
|
18760
|
-
"authentication",
|
|
18761
|
-
"num",
|
|
18762
|
-
"sortField",
|
|
18763
|
-
"sortOrder",
|
|
18764
|
-
"include",
|
|
18765
|
-
"start",
|
|
18766
|
-
"requestOptions",
|
|
18767
|
-
];
|
|
18768
|
-
// copy the props over
|
|
18769
|
-
props.forEach(function (prop) {
|
|
18770
|
-
if (options.hasOwnProperty(prop)) {
|
|
18771
|
-
so[prop] = options[prop];
|
|
18772
|
-
}
|
|
18773
|
-
});
|
|
18774
|
-
// If we don't have auth, ensure we have .portal
|
|
18775
|
-
if (!so.authentication) {
|
|
18776
|
-
so.portal = so.requestOptions.portal || api.url + "/sharing/rest";
|
|
18777
|
-
}
|
|
18778
|
-
return [2 /*return*/, searchPortal$1(so)];
|
|
18779
|
-
});
|
|
18780
|
-
});
|
|
18781
|
-
}
|
|
18782
18448
|
/**
|
|
18783
18449
|
* @private
|
|
18784
18450
|
* Portal Search Implementation for Groups
|
|
@@ -18879,50 +18545,6 @@
|
|
|
18879
18545
|
});
|
|
18880
18546
|
}
|
|
18881
18547
|
|
|
18882
|
-
/**
|
|
18883
|
-
* @private
|
|
18884
|
-
* DEPRECATED: Use `portalSearchUsers`
|
|
18885
|
-
* Portal Search implementation for Users
|
|
18886
|
-
* @param filterGroups
|
|
18887
|
-
* @param options
|
|
18888
|
-
*/
|
|
18889
|
-
function portalSearchUsersFilterGroups(filterGroups, options) {
|
|
18890
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
18891
|
-
var expandedGroups, so, props;
|
|
18892
|
-
return __generator(this, function (_a) {
|
|
18893
|
-
// requestOptions is always required and user must be authd
|
|
18894
|
-
if (!options.requestOptions) {
|
|
18895
|
-
throw new HubError$1("portalSearchUsers", "requestOptions: IHubRequestOptions is required.");
|
|
18896
|
-
}
|
|
18897
|
-
if (!options.requestOptions.authentication) {
|
|
18898
|
-
throw new HubError$1("portalSearchUsers", "requestOptions must pass authentication.");
|
|
18899
|
-
}
|
|
18900
|
-
expandedGroups = filterGroups.map(function (fg) {
|
|
18901
|
-
fg.filters = fg.filters.map(expandFilter);
|
|
18902
|
-
return fg;
|
|
18903
|
-
});
|
|
18904
|
-
so = serializeFilterGroupsForPortal(expandedGroups);
|
|
18905
|
-
props = [
|
|
18906
|
-
"num",
|
|
18907
|
-
"sortField",
|
|
18908
|
-
"sortOrder",
|
|
18909
|
-
"include",
|
|
18910
|
-
"start",
|
|
18911
|
-
"requestOptions",
|
|
18912
|
-
];
|
|
18913
|
-
// copy the props over
|
|
18914
|
-
props.forEach(function (prop) {
|
|
18915
|
-
if (options.hasOwnProperty(prop)) {
|
|
18916
|
-
so[prop] = options[prop];
|
|
18917
|
-
}
|
|
18918
|
-
});
|
|
18919
|
-
// Ensure authentication gets sent
|
|
18920
|
-
so.authentication = options.requestOptions.authentication;
|
|
18921
|
-
// Execute search
|
|
18922
|
-
return [2 /*return*/, searchPortal(so)];
|
|
18923
|
-
});
|
|
18924
|
-
});
|
|
18925
|
-
}
|
|
18926
18548
|
/**
|
|
18927
18549
|
* @private
|
|
18928
18550
|
* Portal Search Implementation for Users
|
|
@@ -19025,7 +18647,10 @@
|
|
|
19025
18647
|
}
|
|
19026
18648
|
|
|
19027
18649
|
/**
|
|
19028
|
-
*
|
|
18650
|
+
* @private
|
|
18651
|
+
* TEMPORARY - this function only exists to allow incremental
|
|
18652
|
+
* changes and should be removed as soon as arcgis-hub-gallery
|
|
18653
|
+
* is changed to call `hubSearch(...)` directly
|
|
19029
18654
|
*
|
|
19030
18655
|
* Default's to search ArcGIS Portal but can delegate
|
|
19031
18656
|
* to Hub API when it's available.
|
|
@@ -19033,41 +18658,11 @@
|
|
|
19033
18658
|
* @param options
|
|
19034
18659
|
* @returns
|
|
19035
18660
|
*/
|
|
19036
|
-
function
|
|
18661
|
+
function hubSearchQuery(query, options) {
|
|
19037
18662
|
return __awaiter(this, void 0, void 0, function () {
|
|
19038
|
-
var filterType, apiType, fnHash, fn;
|
|
19039
18663
|
return __generator(this, function (_a) {
|
|
19040
|
-
//
|
|
19041
|
-
|
|
19042
|
-
throw new HubError$1("hubSearch", "FilterGroups are required and must be an array.");
|
|
19043
|
-
}
|
|
19044
|
-
if (!filterGroups.length) {
|
|
19045
|
-
throw new HubError$1("hubSearch", "FilterGrous array must contain at least one entry.");
|
|
19046
|
-
}
|
|
19047
|
-
if (!options.requestOptions) {
|
|
19048
|
-
throw new HubError$1("hubSearch", "requestOptions: IHubRequestOptions is required.");
|
|
19049
|
-
}
|
|
19050
|
-
// Ensure includes is an array
|
|
19051
|
-
if (!options.include) {
|
|
19052
|
-
options.include = [];
|
|
19053
|
-
}
|
|
19054
|
-
filterType = filterGroups[0].filterType;
|
|
19055
|
-
apiType = expandApi(options.api || "arcgis").type;
|
|
19056
|
-
fnHash = {
|
|
19057
|
-
arcgis: {
|
|
19058
|
-
item: portalSearchItemsFilterGroups,
|
|
19059
|
-
group: portalSearchGroupsFilterGroups,
|
|
19060
|
-
user: portalSearchUsersFilterGroups,
|
|
19061
|
-
},
|
|
19062
|
-
"arcgis-hub": {
|
|
19063
|
-
item: hubSearchItems,
|
|
19064
|
-
},
|
|
19065
|
-
};
|
|
19066
|
-
fn = getProp(fnHash, apiType + "." + filterType);
|
|
19067
|
-
if (!fn) {
|
|
19068
|
-
throw new HubError$1("hubSearch", "Search via \"" + filterType + "\" filter against \"" + apiType + "\" api is not implemented");
|
|
19069
|
-
}
|
|
19070
|
-
return [2 /*return*/, fn(cloneObject$1(filterGroups), options)];
|
|
18664
|
+
// delegate
|
|
18665
|
+
return [2 /*return*/, hubSearch(query, options)];
|
|
19071
18666
|
});
|
|
19072
18667
|
});
|
|
19073
18668
|
}
|
|
@@ -19080,7 +18675,7 @@
|
|
|
19080
18675
|
* @param options
|
|
19081
18676
|
* @returns
|
|
19082
18677
|
*/
|
|
19083
|
-
function
|
|
18678
|
+
function hubSearch(query, options) {
|
|
19084
18679
|
return __awaiter(this, void 0, void 0, function () {
|
|
19085
18680
|
var filterType, apiType, fnHash, fn;
|
|
19086
18681
|
return __generator(this, function (_a) {
|
|
@@ -20861,7 +20456,6 @@
|
|
|
20861
20456
|
exports.expandApi = expandApi;
|
|
20862
20457
|
exports.expandApis = expandApis;
|
|
20863
20458
|
exports.expandContentFilter = expandContentFilter;
|
|
20864
|
-
exports.expandFilter = expandFilter;
|
|
20865
20459
|
exports.expandGroupFilter = expandGroupFilter;
|
|
20866
20460
|
exports.expandTypeField = expandTypeField;
|
|
20867
20461
|
exports.expandUserFilter = expandUserFilter;
|
|
@@ -20988,7 +20582,7 @@
|
|
|
20988
20582
|
exports.mergeGroupFilters = mergeGroupFilters;
|
|
20989
20583
|
exports.mergeMatchOptions = mergeMatchOptions;
|
|
20990
20584
|
exports.mergeObjects = mergeObjects;
|
|
20991
|
-
exports.mergeSearchOptions = mergeSearchOptions$
|
|
20585
|
+
exports.mergeSearchOptions = mergeSearchOptions$1;
|
|
20992
20586
|
exports.mergeUserFilters = mergeUserFilters;
|
|
20993
20587
|
exports.normalizeItemType = normalizeItemType;
|
|
20994
20588
|
exports.normalizeSolutionTemplateItem = normalizeSolutionTemplateItem;
|
|
@@ -21013,13 +20607,13 @@
|
|
|
21013
20607
|
exports.searchSites = searchSites;
|
|
21014
20608
|
exports.serializeCollectionState = serializeCollectionState;
|
|
21015
20609
|
exports.serializeContentFilterForPortal = serializeContentFilterForPortal;
|
|
21016
|
-
exports.serializeDateRange = serializeDateRange$
|
|
21017
|
-
exports.serializeFilterGroupsForPortal = serializeFilterGroupsForPortal;
|
|
20610
|
+
exports.serializeDateRange = serializeDateRange$1;
|
|
21018
20611
|
exports.serializeGroupFilterForPortal = serializeGroupFilterForPortal;
|
|
21019
|
-
exports.serializeMatchOptions = serializeMatchOptions$
|
|
20612
|
+
exports.serializeMatchOptions = serializeMatchOptions$1;
|
|
21020
20613
|
exports.serializeModel = serializeModel;
|
|
20614
|
+
exports.serializeQueryForPortal = serializeQueryForPortal;
|
|
21021
20615
|
exports.serializeSpatialReference = serializeSpatialReference;
|
|
21022
|
-
exports.serializeStringOrArray = serializeStringOrArray$
|
|
20616
|
+
exports.serializeStringOrArray = serializeStringOrArray$1;
|
|
21023
20617
|
exports.serializeUserFilterForPortal = serializeUserFilterForPortal;
|
|
21024
20618
|
exports.setContentHubId = setContentHubId;
|
|
21025
20619
|
exports.setContentSiteUrls = setContentSiteUrls;
|