@esri/hub-common 9.45.2 → 9.45.5
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/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} +2 -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/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} +2 -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/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} +4 -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 -610
- 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.4 - Fri Jul 01 2022 18:05:06 GMT+0000 (Coordinated Universal Time)
|
|
3
3
|
* Copyright (c) 2022 Environmental Systems Research Institute, Inc.
|
|
4
4
|
* Apache-2.0
|
|
5
5
|
*/
|
|
@@ -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");
|
|
@@ -15453,6 +15126,7 @@
|
|
|
15453
15126
|
"snippet",
|
|
15454
15127
|
"tags",
|
|
15455
15128
|
"term",
|
|
15129
|
+
"title",
|
|
15456
15130
|
"type",
|
|
15457
15131
|
"typekeywords",
|
|
15458
15132
|
"userlicensetype",
|
|
@@ -15509,47 +15183,181 @@
|
|
|
15509
15183
|
if (value.any) {
|
|
15510
15184
|
result = "" + serializeStringOrArray("OR", key, value.any);
|
|
15511
15185
|
}
|
|
15512
|
-
if (value.all) {
|
|
15513
|
-
result =
|
|
15514
|
-
(result ? result + " AND " : "") +
|
|
15515
|
-
("" + serializeStringOrArray("AND", key, value.all));
|
|
15186
|
+
if (value.all) {
|
|
15187
|
+
result =
|
|
15188
|
+
(result ? result + " AND " : "") +
|
|
15189
|
+
("" + serializeStringOrArray("AND", key, value.all));
|
|
15190
|
+
}
|
|
15191
|
+
if (value.not) {
|
|
15192
|
+
// negate the entries if they are not
|
|
15193
|
+
result =
|
|
15194
|
+
(result ? result + " AND " : "") +
|
|
15195
|
+
("" + serializeStringOrArray("OR", "-" + key, value.not));
|
|
15196
|
+
}
|
|
15197
|
+
return result;
|
|
15198
|
+
}
|
|
15199
|
+
/**
|
|
15200
|
+
* Serialize a date-range into Portal syntax
|
|
15201
|
+
* @param key
|
|
15202
|
+
* @param range
|
|
15203
|
+
* @returns
|
|
15204
|
+
*/
|
|
15205
|
+
function serializeDateRange(key, range) {
|
|
15206
|
+
return key + ":[" + range.from + " TO " + range.to + "]";
|
|
15207
|
+
}
|
|
15208
|
+
/**
|
|
15209
|
+
* Serialize a `string` or `string[]` into a string
|
|
15210
|
+
* @param join
|
|
15211
|
+
* @param key
|
|
15212
|
+
* @param value
|
|
15213
|
+
* @returns
|
|
15214
|
+
*/
|
|
15215
|
+
function serializeStringOrArray(join, key, value) {
|
|
15216
|
+
var q = "";
|
|
15217
|
+
if (Array.isArray(value)) {
|
|
15218
|
+
q = key + ":\"" + value.join("\" " + join + " " + key + ":\"") + "\"";
|
|
15219
|
+
if (value.length > 1) {
|
|
15220
|
+
q = "(" + q + ")";
|
|
15221
|
+
}
|
|
15222
|
+
}
|
|
15223
|
+
else {
|
|
15224
|
+
q = key + ":\"" + value + "\"";
|
|
15225
|
+
}
|
|
15226
|
+
return q;
|
|
15227
|
+
}
|
|
15228
|
+
|
|
15229
|
+
/**
|
|
15230
|
+
* Generic Hub Error with an Error stack as well
|
|
15231
|
+
* as an optional serialized OperationStack.
|
|
15232
|
+
*
|
|
15233
|
+
* Also accepts a `rootCause` Error object
|
|
15234
|
+
*/
|
|
15235
|
+
var HubError = /** @class */ (function (_super) {
|
|
15236
|
+
__extends(HubError, _super);
|
|
15237
|
+
/**
|
|
15238
|
+
* Creates an instance of HubError.
|
|
15239
|
+
* @param {string} operation
|
|
15240
|
+
* @param {string} [message]
|
|
15241
|
+
* @param {Error} [rootCause]
|
|
15242
|
+
* @memberof HubError
|
|
15243
|
+
*/
|
|
15244
|
+
function HubError(operation, message, rootCause) {
|
|
15245
|
+
var _this = this;
|
|
15246
|
+
message = message || "UNKNOWN_ERROR";
|
|
15247
|
+
// if the rootCause has a .rootCause, use that so we don't deeply nest
|
|
15248
|
+
rootCause = getWithDefault$1(rootCause, "rootCause", rootCause);
|
|
15249
|
+
/* Skip coverage on super(...) as per:
|
|
15250
|
+
https://github.com/Microsoft/TypeScript/issues/13029
|
|
15251
|
+
https://github.com/SitePen/remap-istanbul/issues/106
|
|
15252
|
+
*/
|
|
15253
|
+
/* istanbul ignore next */
|
|
15254
|
+
_this = _super.call(this, operation, message, rootCause) || this;
|
|
15255
|
+
_this.name = "HubError";
|
|
15256
|
+
// if the original error has a stack use it, otherwise create a new
|
|
15257
|
+
// stack. Note: a new Stack will make it look like the error origninated
|
|
15258
|
+
// in the HubError constructor. This is only an issue in tests but
|
|
15259
|
+
// it can be confusing to debug
|
|
15260
|
+
_this.stack = getWithDefault$1(rootCause, "stack", new Error().stack);
|
|
15261
|
+
return _this;
|
|
15262
|
+
}
|
|
15263
|
+
return HubError;
|
|
15264
|
+
}(OperationError$1));
|
|
15265
|
+
var HubError$1 = HubError;
|
|
15266
|
+
|
|
15267
|
+
/**
|
|
15268
|
+
* Generic search that returns Hub Entity types converted from items
|
|
15269
|
+
* by the passed in `ItemToEntityFunction`
|
|
15270
|
+
*
|
|
15271
|
+
* This abstraction is used to ensure that searching from any of the
|
|
15272
|
+
* entity managers / modules is consistent, and returns the entity
|
|
15273
|
+
* types, instead of `IItem` or `IHubContent`
|
|
15274
|
+
*
|
|
15275
|
+
* @param filter
|
|
15276
|
+
* @param convertFn
|
|
15277
|
+
* @param options
|
|
15278
|
+
* @returns
|
|
15279
|
+
*/
|
|
15280
|
+
function searchContentEntities(filter, convertFn, options) {
|
|
15281
|
+
var _a, _b;
|
|
15282
|
+
// expand filter so we can serialize to either api
|
|
15283
|
+
var expanded = expandContentFilter(filter);
|
|
15284
|
+
var searchOptions = serializeContentFilterForPortal(expanded);
|
|
15285
|
+
// DEPRECATION
|
|
15286
|
+
/* istanbul ignore next */
|
|
15287
|
+
if ((_a = options.aggregations) === null || _a === void 0 ? void 0 : _a.length) {
|
|
15288
|
+
// tslint:disable-next-line:no-console
|
|
15289
|
+
console.warn("IHubSearchOptions.aggregations is deprecated. Please use .aggFields instead.");
|
|
15290
|
+
searchOptions.countFields = options.aggregations.join(",");
|
|
15291
|
+
searchOptions.countSize = options.aggLimit || 10;
|
|
15292
|
+
}
|
|
15293
|
+
// Aggregations
|
|
15294
|
+
if ((_b = options.aggFields) === null || _b === void 0 ? void 0 : _b.length) {
|
|
15295
|
+
searchOptions.countFields = options.aggFields.join(",");
|
|
15296
|
+
searchOptions.countSize = options.aggLimit || 10;
|
|
15516
15297
|
}
|
|
15517
|
-
|
|
15518
|
-
|
|
15519
|
-
|
|
15520
|
-
|
|
15521
|
-
|
|
15298
|
+
// properties to copy from IHubSearchOptions to the ISearchOptions
|
|
15299
|
+
var props = [
|
|
15300
|
+
"authentication",
|
|
15301
|
+
"num",
|
|
15302
|
+
"sortField",
|
|
15303
|
+
"sortOrder",
|
|
15304
|
+
"site",
|
|
15305
|
+
"start",
|
|
15306
|
+
];
|
|
15307
|
+
// Include "start" here
|
|
15308
|
+
// copy the props over
|
|
15309
|
+
props.forEach(function (prop) {
|
|
15310
|
+
if (options.hasOwnProperty(prop)) {
|
|
15311
|
+
searchOptions[prop] = options[prop];
|
|
15312
|
+
}
|
|
15313
|
+
});
|
|
15314
|
+
// create the entitySearchFn
|
|
15315
|
+
var searchFn = createContentEntitySearchFn(convertFn);
|
|
15316
|
+
// execute the search
|
|
15317
|
+
// Add ArcGIS API
|
|
15318
|
+
if (options.api && !options.authentication) {
|
|
15319
|
+
var expandedApi = expandApi(options.api);
|
|
15320
|
+
searchOptions.portal = expandedApi.url;
|
|
15522
15321
|
}
|
|
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 + "]";
|
|
15322
|
+
return searchFn(searchOptions);
|
|
15533
15323
|
}
|
|
15534
15324
|
/**
|
|
15535
|
-
*
|
|
15536
|
-
*
|
|
15537
|
-
*
|
|
15538
|
-
*
|
|
15325
|
+
* Return a function that holds a closure containing
|
|
15326
|
+
* a hub entity specific conversion function. This
|
|
15327
|
+
* allows the `.next()` function to use the function on
|
|
15328
|
+
* subsequent calls
|
|
15329
|
+
* @param convertFn
|
|
15539
15330
|
* @returns
|
|
15540
15331
|
*/
|
|
15541
|
-
function
|
|
15542
|
-
|
|
15543
|
-
|
|
15544
|
-
|
|
15545
|
-
|
|
15546
|
-
|
|
15547
|
-
|
|
15548
|
-
|
|
15549
|
-
|
|
15550
|
-
|
|
15551
|
-
|
|
15552
|
-
|
|
15332
|
+
function createContentEntitySearchFn(convertFn) {
|
|
15333
|
+
// Return a function that does the search, with a closure over the
|
|
15334
|
+
// conversion function. Naming this function is important as it's
|
|
15335
|
+
// referenced in the `next` section below
|
|
15336
|
+
return function searchEntities(searchOptions) {
|
|
15337
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
15338
|
+
var response, entities, facets;
|
|
15339
|
+
return __generator(this, function (_a) {
|
|
15340
|
+
switch (_a.label) {
|
|
15341
|
+
case 0: return [4 /*yield*/, searchItems(searchOptions)];
|
|
15342
|
+
case 1:
|
|
15343
|
+
response = _a.sent();
|
|
15344
|
+
return [4 /*yield*/, Promise.all(response.results.map(function (itm) {
|
|
15345
|
+
return convertFn(itm, searchOptions);
|
|
15346
|
+
}))];
|
|
15347
|
+
case 2:
|
|
15348
|
+
entities = _a.sent();
|
|
15349
|
+
facets = convertPortalResponseToFacets(response);
|
|
15350
|
+
return [2 /*return*/, {
|
|
15351
|
+
total: response.total,
|
|
15352
|
+
results: entities,
|
|
15353
|
+
facets: facets,
|
|
15354
|
+
hasNext: response.nextStart > -1,
|
|
15355
|
+
next: getNextFunction(searchOptions, response.nextStart, response.total, searchEntities),
|
|
15356
|
+
}];
|
|
15357
|
+
}
|
|
15358
|
+
});
|
|
15359
|
+
});
|
|
15360
|
+
};
|
|
15553
15361
|
}
|
|
15554
15362
|
|
|
15555
15363
|
/**
|
|
@@ -18089,56 +17897,6 @@
|
|
|
18089
17897
|
}
|
|
18090
17898
|
}
|
|
18091
17899
|
|
|
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
17900
|
/**
|
|
18143
17901
|
* @private
|
|
18144
17902
|
* Portal Search Implementation for Items
|
|
@@ -18456,39 +18214,6 @@
|
|
|
18456
18214
|
});
|
|
18457
18215
|
return queryClone;
|
|
18458
18216
|
}
|
|
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
18217
|
/**
|
|
18493
18218
|
* Is the argument a well-known type "key"
|
|
18494
18219
|
*
|
|
@@ -18506,13 +18231,10 @@
|
|
|
18506
18231
|
return result;
|
|
18507
18232
|
}
|
|
18508
18233
|
/**
|
|
18509
|
-
*
|
|
18234
|
+
* Return the predicates for a well-known type
|
|
18510
18235
|
* @param key
|
|
18511
18236
|
* @returns
|
|
18512
18237
|
*/
|
|
18513
|
-
function lookupTypeFilters(key) {
|
|
18514
|
-
return WellKnownItemFilters[key];
|
|
18515
|
-
}
|
|
18516
18238
|
function lookupTypePredicates(key) {
|
|
18517
18239
|
var rawPredicates = WellKnownItemFilters[key];
|
|
18518
18240
|
// Remove the filterType property as it's not needed in an IPredicate
|
|
@@ -18724,61 +18446,6 @@
|
|
|
18724
18446
|
return result;
|
|
18725
18447
|
}
|
|
18726
18448
|
|
|
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
18449
|
/**
|
|
18783
18450
|
* @private
|
|
18784
18451
|
* Portal Search Implementation for Groups
|
|
@@ -18879,50 +18546,6 @@
|
|
|
18879
18546
|
});
|
|
18880
18547
|
}
|
|
18881
18548
|
|
|
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
18549
|
/**
|
|
18927
18550
|
* @private
|
|
18928
18551
|
* Portal Search Implementation for Users
|
|
@@ -19025,7 +18648,10 @@
|
|
|
19025
18648
|
}
|
|
19026
18649
|
|
|
19027
18650
|
/**
|
|
19028
|
-
*
|
|
18651
|
+
* @private
|
|
18652
|
+
* TEMPORARY - this function only exists to allow incremental
|
|
18653
|
+
* changes and should be removed as soon as arcgis-hub-gallery
|
|
18654
|
+
* is changed to call `hubSearch(...)` directly
|
|
19029
18655
|
*
|
|
19030
18656
|
* Default's to search ArcGIS Portal but can delegate
|
|
19031
18657
|
* to Hub API when it's available.
|
|
@@ -19033,41 +18659,11 @@
|
|
|
19033
18659
|
* @param options
|
|
19034
18660
|
* @returns
|
|
19035
18661
|
*/
|
|
19036
|
-
function
|
|
18662
|
+
function hubSearchQuery(query, options) {
|
|
19037
18663
|
return __awaiter(this, void 0, void 0, function () {
|
|
19038
|
-
var filterType, apiType, fnHash, fn;
|
|
19039
18664
|
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)];
|
|
18665
|
+
// delegate
|
|
18666
|
+
return [2 /*return*/, hubSearch(query, options)];
|
|
19071
18667
|
});
|
|
19072
18668
|
});
|
|
19073
18669
|
}
|
|
@@ -19080,7 +18676,7 @@
|
|
|
19080
18676
|
* @param options
|
|
19081
18677
|
* @returns
|
|
19082
18678
|
*/
|
|
19083
|
-
function
|
|
18679
|
+
function hubSearch(query, options) {
|
|
19084
18680
|
return __awaiter(this, void 0, void 0, function () {
|
|
19085
18681
|
var filterType, apiType, fnHash, fn;
|
|
19086
18682
|
return __generator(this, function (_a) {
|
|
@@ -20861,7 +20457,6 @@
|
|
|
20861
20457
|
exports.expandApi = expandApi;
|
|
20862
20458
|
exports.expandApis = expandApis;
|
|
20863
20459
|
exports.expandContentFilter = expandContentFilter;
|
|
20864
|
-
exports.expandFilter = expandFilter;
|
|
20865
20460
|
exports.expandGroupFilter = expandGroupFilter;
|
|
20866
20461
|
exports.expandTypeField = expandTypeField;
|
|
20867
20462
|
exports.expandUserFilter = expandUserFilter;
|
|
@@ -20988,7 +20583,7 @@
|
|
|
20988
20583
|
exports.mergeGroupFilters = mergeGroupFilters;
|
|
20989
20584
|
exports.mergeMatchOptions = mergeMatchOptions;
|
|
20990
20585
|
exports.mergeObjects = mergeObjects;
|
|
20991
|
-
exports.mergeSearchOptions = mergeSearchOptions$
|
|
20586
|
+
exports.mergeSearchOptions = mergeSearchOptions$1;
|
|
20992
20587
|
exports.mergeUserFilters = mergeUserFilters;
|
|
20993
20588
|
exports.normalizeItemType = normalizeItemType;
|
|
20994
20589
|
exports.normalizeSolutionTemplateItem = normalizeSolutionTemplateItem;
|
|
@@ -21013,13 +20608,13 @@
|
|
|
21013
20608
|
exports.searchSites = searchSites;
|
|
21014
20609
|
exports.serializeCollectionState = serializeCollectionState;
|
|
21015
20610
|
exports.serializeContentFilterForPortal = serializeContentFilterForPortal;
|
|
21016
|
-
exports.serializeDateRange = serializeDateRange$
|
|
21017
|
-
exports.serializeFilterGroupsForPortal = serializeFilterGroupsForPortal;
|
|
20611
|
+
exports.serializeDateRange = serializeDateRange$1;
|
|
21018
20612
|
exports.serializeGroupFilterForPortal = serializeGroupFilterForPortal;
|
|
21019
|
-
exports.serializeMatchOptions = serializeMatchOptions$
|
|
20613
|
+
exports.serializeMatchOptions = serializeMatchOptions$1;
|
|
21020
20614
|
exports.serializeModel = serializeModel;
|
|
20615
|
+
exports.serializeQueryForPortal = serializeQueryForPortal;
|
|
21021
20616
|
exports.serializeSpatialReference = serializeSpatialReference;
|
|
21022
|
-
exports.serializeStringOrArray = serializeStringOrArray$
|
|
20617
|
+
exports.serializeStringOrArray = serializeStringOrArray$1;
|
|
21023
20618
|
exports.serializeUserFilterForPortal = serializeUserFilterForPortal;
|
|
21024
20619
|
exports.setContentHubId = setContentHubId;
|
|
21025
20620
|
exports.setContentSiteUrls = setContentSiteUrls;
|