@esri/hub-common 9.42.0 → 9.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es2017/search/_internal/portalSearchItems.js +232 -3
- package/dist/es2017/search/_internal/portalSearchItems.js.map +1 -1
- package/dist/es2017/search/_searchUsers.js +2 -0
- package/dist/es2017/search/_searchUsers.js.map +1 -1
- package/dist/es2017/search/filter-utils.js +30 -0
- package/dist/es2017/search/filter-utils.js.map +1 -1
- package/dist/esm/search/_internal/portalSearchItems.js +233 -5
- package/dist/esm/search/_internal/portalSearchItems.js.map +1 -1
- package/dist/esm/search/_searchUsers.js +2 -0
- package/dist/esm/search/_searchUsers.js.map +1 -1
- package/dist/esm/search/filter-utils.js +30 -0
- package/dist/esm/search/filter-utils.js.map +1 -1
- package/dist/node/search/_internal/portalSearchItems.js +232 -2
- package/dist/node/search/_internal/portalSearchItems.js.map +1 -1
- package/dist/node/search/_searchUsers.js +2 -0
- package/dist/node/search/_searchUsers.js.map +1 -1
- package/dist/node/search/filter-utils.js +33 -1
- package/dist/node/search/filter-utils.js.map +1 -1
- package/dist/types/search/_internal/portalSearchItems.d.ts +35 -1
- package/dist/types/search/_searchUsers.d.ts +2 -0
- package/dist/types/search/filter-utils.d.ts +13 -1
- package/dist/umd/common.umd.js +268 -6
- package/dist/umd/common.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/umd/common.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* @preserve
|
|
2
|
-
* @esri/hub-common - v9.
|
|
2
|
+
* @esri/hub-common - v9.42.0 - Wed Jun 15 2022 18:33:31 GMT+0000 (Coordinated Universal Time)
|
|
3
3
|
* Copyright (c) 2022 Environmental Systems Research Institute, Inc.
|
|
4
4
|
* Apache-2.0
|
|
5
5
|
*/
|
|
@@ -14044,7 +14044,7 @@
|
|
|
14044
14044
|
if (isWellKnownType(entry)) {
|
|
14045
14045
|
// working with dynamic objects in typescript requires some assertions
|
|
14046
14046
|
var key = entry;
|
|
14047
|
-
clone.subFilters = clone.subFilters.concat(lookupTypeFilters(key));
|
|
14047
|
+
clone.subFilters = clone.subFilters.concat(lookupTypeFilters$1(key));
|
|
14048
14048
|
}
|
|
14049
14049
|
else {
|
|
14050
14050
|
acc.push(entry);
|
|
@@ -14054,7 +14054,7 @@
|
|
|
14054
14054
|
}
|
|
14055
14055
|
else if (isWellKnownType(clone.type)) {
|
|
14056
14056
|
var key = clone.type;
|
|
14057
|
-
clone.subFilters = clone.subFilters.concat(lookupTypeFilters(key));
|
|
14057
|
+
clone.subFilters = clone.subFilters.concat(lookupTypeFilters$1(key));
|
|
14058
14058
|
delete clone.type;
|
|
14059
14059
|
}
|
|
14060
14060
|
else ;
|
|
@@ -14077,7 +14077,7 @@
|
|
|
14077
14077
|
}
|
|
14078
14078
|
return result;
|
|
14079
14079
|
}
|
|
14080
|
-
function lookupTypeFilters(key) {
|
|
14080
|
+
function lookupTypeFilters$1(key) {
|
|
14081
14081
|
return ContentFilterExpansions[key];
|
|
14082
14082
|
}
|
|
14083
14083
|
/**
|
|
@@ -14673,6 +14673,8 @@
|
|
|
14673
14673
|
*
|
|
14674
14674
|
* **Note** Authentication is required
|
|
14675
14675
|
*
|
|
14676
|
+
* Trivial comment to force a release
|
|
14677
|
+
*
|
|
14676
14678
|
* Note: in the future, there may be options to search via
|
|
14677
14679
|
* a Hub specific API
|
|
14678
14680
|
* @param filter
|
|
@@ -15166,6 +15168,36 @@
|
|
|
15166
15168
|
}
|
|
15167
15169
|
return q;
|
|
15168
15170
|
}
|
|
15171
|
+
/**
|
|
15172
|
+
* Determine if a Filter is "empty"
|
|
15173
|
+
* @param filter
|
|
15174
|
+
* @returns
|
|
15175
|
+
*/
|
|
15176
|
+
function isEmptyFilter(filter) {
|
|
15177
|
+
// if it has one property, filterType, it's empty
|
|
15178
|
+
return (Object.keys(filter).length === 1 && filter.hasOwnProperty("filterType"));
|
|
15179
|
+
}
|
|
15180
|
+
/**
|
|
15181
|
+
* Determine if a filterGroup is "empty"
|
|
15182
|
+
* @param filterGroup
|
|
15183
|
+
* @returns
|
|
15184
|
+
*/
|
|
15185
|
+
function isEmptyFilterGroup(filterGroup) {
|
|
15186
|
+
// if filters array is empty
|
|
15187
|
+
if (filterGroup.filters.length === 0) {
|
|
15188
|
+
return true;
|
|
15189
|
+
}
|
|
15190
|
+
else {
|
|
15191
|
+
// if all filters are empty
|
|
15192
|
+
var result = filterGroup.filters.reduce(function (acc, entry) {
|
|
15193
|
+
if (acc) {
|
|
15194
|
+
acc = isEmptyFilter(entry);
|
|
15195
|
+
}
|
|
15196
|
+
return acc;
|
|
15197
|
+
}, true);
|
|
15198
|
+
return result;
|
|
15199
|
+
}
|
|
15200
|
+
}
|
|
15169
15201
|
|
|
15170
15202
|
/**
|
|
15171
15203
|
* Generic Hub Error with an Error stack as well
|
|
@@ -17826,12 +17858,13 @@
|
|
|
17826
17858
|
function portalSearchItems(filterGroups, options) {
|
|
17827
17859
|
var _a;
|
|
17828
17860
|
return __awaiter(this, void 0, void 0, function () {
|
|
17829
|
-
var expandedGroups, so, props;
|
|
17861
|
+
var replaced, expandedGroups, so, props;
|
|
17830
17862
|
return __generator(this, function (_b) {
|
|
17831
17863
|
if (!options.requestOptions) {
|
|
17832
17864
|
throw new HubError$1("hubSearch", "requestOptions: IHubRequestOptions is required.");
|
|
17833
17865
|
}
|
|
17834
|
-
|
|
17866
|
+
replaced = applyWellKnownItemFilters(filterGroups);
|
|
17867
|
+
expandedGroups = replaced.map(function (fg) {
|
|
17835
17868
|
fg.filters = fg.filters.map(expandFilter);
|
|
17836
17869
|
return fg;
|
|
17837
17870
|
});
|
|
@@ -17930,6 +17963,233 @@
|
|
|
17930
17963
|
});
|
|
17931
17964
|
});
|
|
17932
17965
|
}
|
|
17966
|
+
var WellKnownItemFilters = {
|
|
17967
|
+
$application: [
|
|
17968
|
+
{
|
|
17969
|
+
filterType: "item",
|
|
17970
|
+
type: {
|
|
17971
|
+
any: [
|
|
17972
|
+
"Web Mapping Application",
|
|
17973
|
+
"Application",
|
|
17974
|
+
"Insights",
|
|
17975
|
+
"Web Experience",
|
|
17976
|
+
],
|
|
17977
|
+
not: ["Insights Theme", "Insights Model"],
|
|
17978
|
+
},
|
|
17979
|
+
typekeywords: {
|
|
17980
|
+
not: ["hubSite", "Story Map"],
|
|
17981
|
+
},
|
|
17982
|
+
},
|
|
17983
|
+
{
|
|
17984
|
+
filterType: "item",
|
|
17985
|
+
type: "Web Mapping Experience",
|
|
17986
|
+
typekeywords: "EXB Experience",
|
|
17987
|
+
},
|
|
17988
|
+
],
|
|
17989
|
+
$dashboard: [
|
|
17990
|
+
{
|
|
17991
|
+
filterType: "item",
|
|
17992
|
+
type: {
|
|
17993
|
+
any: ["Dashboard"],
|
|
17994
|
+
not: ["Operation View"],
|
|
17995
|
+
},
|
|
17996
|
+
typekeywords: {
|
|
17997
|
+
not: ["Extension", "ArcGIS Operation View"],
|
|
17998
|
+
},
|
|
17999
|
+
},
|
|
18000
|
+
],
|
|
18001
|
+
$dataset: [
|
|
18002
|
+
{
|
|
18003
|
+
filterType: "item",
|
|
18004
|
+
type: {
|
|
18005
|
+
any: [
|
|
18006
|
+
"Scene Service",
|
|
18007
|
+
"Feature Collection",
|
|
18008
|
+
"Route Layer",
|
|
18009
|
+
"Layer",
|
|
18010
|
+
"Explorer Layer",
|
|
18011
|
+
"Tile Package",
|
|
18012
|
+
"Vector Tile Package",
|
|
18013
|
+
"Scene Package",
|
|
18014
|
+
"Layer Package",
|
|
18015
|
+
"Feature Service",
|
|
18016
|
+
"Stream Service",
|
|
18017
|
+
"Map Service",
|
|
18018
|
+
"Vector Tile Service",
|
|
18019
|
+
"Image Service",
|
|
18020
|
+
"WMS",
|
|
18021
|
+
"WFS",
|
|
18022
|
+
"WMTS",
|
|
18023
|
+
"KML",
|
|
18024
|
+
"KML Collection",
|
|
18025
|
+
"Globe Service",
|
|
18026
|
+
"CSV",
|
|
18027
|
+
"Shapefile",
|
|
18028
|
+
"GeoJson",
|
|
18029
|
+
"Service Definition",
|
|
18030
|
+
"File Geodatabase",
|
|
18031
|
+
"CAD Drawing",
|
|
18032
|
+
"Relational Database Connection",
|
|
18033
|
+
],
|
|
18034
|
+
not: ["Web Mapping Application", "Geodata Service"],
|
|
18035
|
+
},
|
|
18036
|
+
},
|
|
18037
|
+
{
|
|
18038
|
+
filterType: "item",
|
|
18039
|
+
typekeywords: ["OGC", "Geodata Service"],
|
|
18040
|
+
},
|
|
18041
|
+
],
|
|
18042
|
+
$document: [
|
|
18043
|
+
{
|
|
18044
|
+
filterType: "item",
|
|
18045
|
+
type: [
|
|
18046
|
+
"PDF",
|
|
18047
|
+
"Microsoft Excel",
|
|
18048
|
+
"Microsoft Word",
|
|
18049
|
+
"Microsoft Powerpoint",
|
|
18050
|
+
"iWork Keynote",
|
|
18051
|
+
"iWork Pages",
|
|
18052
|
+
"iWork Numbers",
|
|
18053
|
+
"Visio Document",
|
|
18054
|
+
"Document Link",
|
|
18055
|
+
],
|
|
18056
|
+
},
|
|
18057
|
+
],
|
|
18058
|
+
$initiative: [
|
|
18059
|
+
{
|
|
18060
|
+
filterType: "item",
|
|
18061
|
+
type: "Hub Initiative",
|
|
18062
|
+
},
|
|
18063
|
+
],
|
|
18064
|
+
$experience: [
|
|
18065
|
+
{
|
|
18066
|
+
filterType: "item",
|
|
18067
|
+
type: "Web Experience",
|
|
18068
|
+
},
|
|
18069
|
+
],
|
|
18070
|
+
$feedback: [
|
|
18071
|
+
{
|
|
18072
|
+
filterType: "item",
|
|
18073
|
+
type: "Form",
|
|
18074
|
+
},
|
|
18075
|
+
],
|
|
18076
|
+
$page: [
|
|
18077
|
+
{
|
|
18078
|
+
filterType: "item",
|
|
18079
|
+
typekeywords: "hubPage",
|
|
18080
|
+
},
|
|
18081
|
+
],
|
|
18082
|
+
$site: [
|
|
18083
|
+
{
|
|
18084
|
+
filterType: "item",
|
|
18085
|
+
type: ["Hub Site Application", "Site Application"],
|
|
18086
|
+
},
|
|
18087
|
+
],
|
|
18088
|
+
$storymap: [
|
|
18089
|
+
{
|
|
18090
|
+
filterType: "item",
|
|
18091
|
+
type: "Storymap",
|
|
18092
|
+
},
|
|
18093
|
+
{
|
|
18094
|
+
filterType: "item",
|
|
18095
|
+
type: "Web Mapping Application",
|
|
18096
|
+
typekeywords: "Story Map",
|
|
18097
|
+
},
|
|
18098
|
+
],
|
|
18099
|
+
$template: [
|
|
18100
|
+
{
|
|
18101
|
+
filterType: "item",
|
|
18102
|
+
type: [
|
|
18103
|
+
"Web Mapping Application",
|
|
18104
|
+
"Hub Initiative",
|
|
18105
|
+
"Hub Initiative Template",
|
|
18106
|
+
"Solution",
|
|
18107
|
+
],
|
|
18108
|
+
typekeywords: {
|
|
18109
|
+
any: ["hubInitiativeTemplate", "hubSolutionTemplate", "Template"],
|
|
18110
|
+
not: "Deployed",
|
|
18111
|
+
},
|
|
18112
|
+
},
|
|
18113
|
+
],
|
|
18114
|
+
$webmap: [
|
|
18115
|
+
{
|
|
18116
|
+
filterType: "item",
|
|
18117
|
+
type: {
|
|
18118
|
+
any: ["Web Map", "Web Scene"],
|
|
18119
|
+
not: "Web Mapping Application",
|
|
18120
|
+
},
|
|
18121
|
+
},
|
|
18122
|
+
],
|
|
18123
|
+
};
|
|
18124
|
+
/**
|
|
18125
|
+
* @private
|
|
18126
|
+
* Convert a Filter Group to expand well-known type filters
|
|
18127
|
+
*
|
|
18128
|
+
* The purpose of this function is to allow for the use of short-hand
|
|
18129
|
+
* names for commonly used, complex queries.
|
|
18130
|
+
*
|
|
18131
|
+
* It works by looking for filters using the .type property, the value
|
|
18132
|
+
* of which is a key in the WellKnownItemFilters hash. If found in the
|
|
18133
|
+
* hash, the filters array of the active filterGroup is replaced with the
|
|
18134
|
+
* filters specified in the hash.
|
|
18135
|
+
*
|
|
18136
|
+
* NOTE: Any other properties specified in a filter will be removed
|
|
18137
|
+
*
|
|
18138
|
+
* Only exported to enable extensive testing
|
|
18139
|
+
* @param filterGroups
|
|
18140
|
+
*/
|
|
18141
|
+
function applyWellKnownItemFilters(filterGroups) {
|
|
18142
|
+
var clone = cloneObject$1(filterGroups);
|
|
18143
|
+
// iterate the filterGroups
|
|
18144
|
+
var result = clone.map(function (filterGroup) {
|
|
18145
|
+
filterGroup.filters = filterGroup.filters.reduce(function (updated, filter) {
|
|
18146
|
+
// check if the filter.type is a well-known type
|
|
18147
|
+
if (isWellKnownTypeFilter(filter.type)) {
|
|
18148
|
+
// get the set of filters to replace the current filter with
|
|
18149
|
+
var typeFilters = lookupTypeFilters(filter.type);
|
|
18150
|
+
// Note: At this point we could try to "merge" in the other
|
|
18151
|
+
// props on the filter, into all the filters returned from
|
|
18152
|
+
// the well-known hash. The problem with this is that the
|
|
18153
|
+
// combination may yield unexpected results; For now, if a filter
|
|
18154
|
+
// includes `.type is keyof WellKnownItemFilters` we simply
|
|
18155
|
+
// replace the entire filter with the array of filters returne
|
|
18156
|
+
// from the hash
|
|
18157
|
+
updated = __spreadArrays(updated, typeFilters);
|
|
18158
|
+
}
|
|
18159
|
+
else {
|
|
18160
|
+
// filter does not have a well-known type entry so keep it
|
|
18161
|
+
updated.push(filter);
|
|
18162
|
+
}
|
|
18163
|
+
return updated;
|
|
18164
|
+
}, []);
|
|
18165
|
+
return filterGroup;
|
|
18166
|
+
});
|
|
18167
|
+
return result;
|
|
18168
|
+
}
|
|
18169
|
+
/**
|
|
18170
|
+
* Is the argument a well-known type "key"
|
|
18171
|
+
*
|
|
18172
|
+
* Accepts `string`, `string[]` or `IMatchOptions`
|
|
18173
|
+
* but only string values can possibly be keys
|
|
18174
|
+
* on `WellKnownItemFilters`
|
|
18175
|
+
* @param key
|
|
18176
|
+
* @returns
|
|
18177
|
+
*/
|
|
18178
|
+
function isWellKnownTypeFilter(key) {
|
|
18179
|
+
var result = false;
|
|
18180
|
+
if (typeof key === "string") {
|
|
18181
|
+
result = key in WellKnownItemFilters;
|
|
18182
|
+
}
|
|
18183
|
+
return result;
|
|
18184
|
+
}
|
|
18185
|
+
/**
|
|
18186
|
+
* Fetch the array of fitlers from the well-known hash
|
|
18187
|
+
* @param key
|
|
18188
|
+
* @returns
|
|
18189
|
+
*/
|
|
18190
|
+
function lookupTypeFilters(key) {
|
|
18191
|
+
return WellKnownItemFilters[key];
|
|
18192
|
+
}
|
|
17933
18193
|
|
|
17934
18194
|
// ## ## ####### ######## ########
|
|
17935
18195
|
// ### ## ## ## ## ##
|
|
@@ -20229,6 +20489,8 @@
|
|
|
20229
20489
|
exports.isDomainForLegacySite = isDomainForLegacySite;
|
|
20230
20490
|
exports.isDomainUsedElsewhere = isDomainUsedElsewhere;
|
|
20231
20491
|
exports.isDownloadable = isDownloadable;
|
|
20492
|
+
exports.isEmptyFilter = isEmptyFilter;
|
|
20493
|
+
exports.isEmptyFilterGroup = isEmptyFilterGroup;
|
|
20232
20494
|
exports.isExtentCoordinateArray = isExtentCoordinateArray;
|
|
20233
20495
|
exports.isFeatureService = isFeatureService$1;
|
|
20234
20496
|
exports.isFieldworkerView = isFieldworkerView;
|