@esri/hub-common 9.42.0 → 9.43.2
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/_fetch.js +4 -2
- package/dist/es2017/content/_fetch.js.map +1 -1
- package/dist/es2017/content/fetch.js +10 -4
- package/dist/es2017/content/fetch.js.map +1 -1
- package/dist/es2017/resources/_internal/_validate-url-helpers.js +3 -12
- package/dist/es2017/resources/_internal/_validate-url-helpers.js.map +1 -1
- 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/content/_fetch.js +4 -2
- package/dist/esm/content/_fetch.js.map +1 -1
- package/dist/esm/content/fetch.js +4 -3
- package/dist/esm/content/fetch.js.map +1 -1
- package/dist/esm/resources/_internal/_validate-url-helpers.js +3 -12
- package/dist/esm/resources/_internal/_validate-url-helpers.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/content/_fetch.js +4 -2
- package/dist/node/content/_fetch.js.map +1 -1
- package/dist/node/content/fetch.js +10 -4
- package/dist/node/content/fetch.js.map +1 -1
- package/dist/node/resources/_internal/_validate-url-helpers.js +3 -12
- package/dist/node/resources/_internal/_validate-url-helpers.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/content/_fetch.d.ts +2 -0
- package/dist/types/core/types/IServerEnrichments.d.ts +1 -1
- package/dist/types/resources/_internal/_validate-url-helpers.d.ts +3 -12
- 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 +279 -23
- 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.43.1 - Wed Jun 22 2022 18:24:40 GMT+0000 (Coordinated Universal Time)
|
|
3
3
|
* Copyright (c) 2022 Environmental Systems Research Institute, Inc.
|
|
4
4
|
* Apache-2.0
|
|
5
5
|
*/
|
|
@@ -10340,7 +10340,8 @@
|
|
|
10340
10340
|
var opts = cloneObject$1(requestOptions);
|
|
10341
10341
|
opts.params = __assign(__assign({}, opts.params), {
|
|
10342
10342
|
// TODO: we should fetch errors too
|
|
10343
|
-
|
|
10343
|
+
// TODO: stop fetching recordCount at next breaking change
|
|
10344
|
+
"fields[datasets]": "slug,boundary,extent,recordCount,searchDescription,statistics" });
|
|
10344
10345
|
if (slug) {
|
|
10345
10346
|
opts.params["filter[slug]"] = slug;
|
|
10346
10347
|
}
|
|
@@ -10350,13 +10351,14 @@
|
|
|
10350
10351
|
var getDatasetEnrichments = function (dataset) {
|
|
10351
10352
|
var _a = parseDatasetId(dataset.id), itemId = _a.itemId, layerIdString = _a.layerId;
|
|
10352
10353
|
var layerId = layerIdString && parseInt(layerIdString, 10);
|
|
10353
|
-
var _b = dataset.attributes, slug = _b.slug, boundary = _b.boundary, extent = _b.extent, searchDescription = _b.searchDescription, statistics = _b.statistics;
|
|
10354
|
+
var _b = dataset.attributes, slug = _b.slug, boundary = _b.boundary, extent = _b.extent, recordCount = _b.recordCount, searchDescription = _b.searchDescription, statistics = _b.statistics;
|
|
10354
10355
|
return {
|
|
10355
10356
|
itemId: itemId,
|
|
10356
10357
|
layerId: layerId,
|
|
10357
10358
|
slug: slug,
|
|
10358
10359
|
boundary: boundary,
|
|
10359
10360
|
extent: extent,
|
|
10361
|
+
recordCount: recordCount,
|
|
10360
10362
|
searchDescription: searchDescription,
|
|
10361
10363
|
statistics: statistics,
|
|
10362
10364
|
};
|
|
@@ -10577,7 +10579,7 @@
|
|
|
10577
10579
|
* ```
|
|
10578
10580
|
*/
|
|
10579
10581
|
var fetchContent = function (identifier, options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
10580
|
-
var content, _a, layer, type, _b, _c;
|
|
10582
|
+
var content, _a, layer, type, canQuery, _b, _c;
|
|
10581
10583
|
return __generator(this, function (_d) {
|
|
10582
10584
|
switch (_d.label) {
|
|
10583
10585
|
case 0:
|
|
@@ -10593,14 +10595,15 @@
|
|
|
10593
10595
|
case 4:
|
|
10594
10596
|
content = _a;
|
|
10595
10597
|
layer = content.layer, type = content.type;
|
|
10598
|
+
canQuery = !!layer && hasFeatures(type);
|
|
10596
10599
|
_b = content;
|
|
10597
|
-
if (!(
|
|
10600
|
+
if (!(canQuery && (isNil(content.recordCount) || content.viewDefinition))) return [3 /*break*/, 6];
|
|
10598
10601
|
return [4 /*yield*/, fetchContentRecordCount(content, options)];
|
|
10599
10602
|
case 5:
|
|
10600
10603
|
_c = _d.sent();
|
|
10601
10604
|
return [3 /*break*/, 7];
|
|
10602
10605
|
case 6:
|
|
10603
|
-
_c =
|
|
10606
|
+
_c = content.recordCount;
|
|
10604
10607
|
_d.label = 7;
|
|
10605
10608
|
case 7:
|
|
10606
10609
|
_b.recordCount = _c;
|
|
@@ -11821,18 +11824,9 @@
|
|
|
11821
11824
|
* Gets item info out of a feature layer item.
|
|
11822
11825
|
*
|
|
11823
11826
|
* @export
|
|
11824
|
-
* @param
|
|
11825
|
-
* @param
|
|
11826
|
-
*
|
|
11827
|
-
* description: string,
|
|
11828
|
-
* extent: any
|
|
11829
|
-
* }} body Item body.
|
|
11830
|
-
* @return {*} {{
|
|
11831
|
-
* title: string,
|
|
11832
|
-
* description: string,
|
|
11833
|
-
* extent: any,
|
|
11834
|
-
* url: string
|
|
11835
|
-
* }}
|
|
11827
|
+
* @param url Item URL
|
|
11828
|
+
* @param body Item body.
|
|
11829
|
+
* @return Item info (title, description, extent, url)
|
|
11836
11830
|
*/
|
|
11837
11831
|
function getFeatureLayerItem(url, body) {
|
|
11838
11832
|
return {
|
|
@@ -14044,7 +14038,7 @@
|
|
|
14044
14038
|
if (isWellKnownType(entry)) {
|
|
14045
14039
|
// working with dynamic objects in typescript requires some assertions
|
|
14046
14040
|
var key = entry;
|
|
14047
|
-
clone.subFilters = clone.subFilters.concat(lookupTypeFilters(key));
|
|
14041
|
+
clone.subFilters = clone.subFilters.concat(lookupTypeFilters$1(key));
|
|
14048
14042
|
}
|
|
14049
14043
|
else {
|
|
14050
14044
|
acc.push(entry);
|
|
@@ -14054,7 +14048,7 @@
|
|
|
14054
14048
|
}
|
|
14055
14049
|
else if (isWellKnownType(clone.type)) {
|
|
14056
14050
|
var key = clone.type;
|
|
14057
|
-
clone.subFilters = clone.subFilters.concat(lookupTypeFilters(key));
|
|
14051
|
+
clone.subFilters = clone.subFilters.concat(lookupTypeFilters$1(key));
|
|
14058
14052
|
delete clone.type;
|
|
14059
14053
|
}
|
|
14060
14054
|
else ;
|
|
@@ -14077,7 +14071,7 @@
|
|
|
14077
14071
|
}
|
|
14078
14072
|
return result;
|
|
14079
14073
|
}
|
|
14080
|
-
function lookupTypeFilters(key) {
|
|
14074
|
+
function lookupTypeFilters$1(key) {
|
|
14081
14075
|
return ContentFilterExpansions[key];
|
|
14082
14076
|
}
|
|
14083
14077
|
/**
|
|
@@ -14673,6 +14667,8 @@
|
|
|
14673
14667
|
*
|
|
14674
14668
|
* **Note** Authentication is required
|
|
14675
14669
|
*
|
|
14670
|
+
* Another trivial comment to force a release
|
|
14671
|
+
*
|
|
14676
14672
|
* Note: in the future, there may be options to search via
|
|
14677
14673
|
* a Hub specific API
|
|
14678
14674
|
* @param filter
|
|
@@ -15166,6 +15162,36 @@
|
|
|
15166
15162
|
}
|
|
15167
15163
|
return q;
|
|
15168
15164
|
}
|
|
15165
|
+
/**
|
|
15166
|
+
* Determine if a Filter is "empty"
|
|
15167
|
+
* @param filter
|
|
15168
|
+
* @returns
|
|
15169
|
+
*/
|
|
15170
|
+
function isEmptyFilter(filter) {
|
|
15171
|
+
// if it has one property, filterType, it's empty
|
|
15172
|
+
return (Object.keys(filter).length === 1 && filter.hasOwnProperty("filterType"));
|
|
15173
|
+
}
|
|
15174
|
+
/**
|
|
15175
|
+
* Determine if a filterGroup is "empty"
|
|
15176
|
+
* @param filterGroup
|
|
15177
|
+
* @returns
|
|
15178
|
+
*/
|
|
15179
|
+
function isEmptyFilterGroup(filterGroup) {
|
|
15180
|
+
// if filters array is empty
|
|
15181
|
+
if (filterGroup.filters.length === 0) {
|
|
15182
|
+
return true;
|
|
15183
|
+
}
|
|
15184
|
+
else {
|
|
15185
|
+
// if all filters are empty
|
|
15186
|
+
var result = filterGroup.filters.reduce(function (acc, entry) {
|
|
15187
|
+
if (acc) {
|
|
15188
|
+
acc = isEmptyFilter(entry);
|
|
15189
|
+
}
|
|
15190
|
+
return acc;
|
|
15191
|
+
}, true);
|
|
15192
|
+
return result;
|
|
15193
|
+
}
|
|
15194
|
+
}
|
|
15169
15195
|
|
|
15170
15196
|
/**
|
|
15171
15197
|
* Generic Hub Error with an Error stack as well
|
|
@@ -17826,12 +17852,13 @@
|
|
|
17826
17852
|
function portalSearchItems(filterGroups, options) {
|
|
17827
17853
|
var _a;
|
|
17828
17854
|
return __awaiter(this, void 0, void 0, function () {
|
|
17829
|
-
var expandedGroups, so, props;
|
|
17855
|
+
var replaced, expandedGroups, so, props;
|
|
17830
17856
|
return __generator(this, function (_b) {
|
|
17831
17857
|
if (!options.requestOptions) {
|
|
17832
17858
|
throw new HubError$1("hubSearch", "requestOptions: IHubRequestOptions is required.");
|
|
17833
17859
|
}
|
|
17834
|
-
|
|
17860
|
+
replaced = applyWellKnownItemFilters(filterGroups);
|
|
17861
|
+
expandedGroups = replaced.map(function (fg) {
|
|
17835
17862
|
fg.filters = fg.filters.map(expandFilter);
|
|
17836
17863
|
return fg;
|
|
17837
17864
|
});
|
|
@@ -17930,6 +17957,233 @@
|
|
|
17930
17957
|
});
|
|
17931
17958
|
});
|
|
17932
17959
|
}
|
|
17960
|
+
var WellKnownItemFilters = {
|
|
17961
|
+
$application: [
|
|
17962
|
+
{
|
|
17963
|
+
filterType: "item",
|
|
17964
|
+
type: {
|
|
17965
|
+
any: [
|
|
17966
|
+
"Web Mapping Application",
|
|
17967
|
+
"Application",
|
|
17968
|
+
"Insights",
|
|
17969
|
+
"Web Experience",
|
|
17970
|
+
],
|
|
17971
|
+
not: ["Insights Theme", "Insights Model"],
|
|
17972
|
+
},
|
|
17973
|
+
typekeywords: {
|
|
17974
|
+
not: ["hubSite", "Story Map"],
|
|
17975
|
+
},
|
|
17976
|
+
},
|
|
17977
|
+
{
|
|
17978
|
+
filterType: "item",
|
|
17979
|
+
type: "Web Mapping Experience",
|
|
17980
|
+
typekeywords: "EXB Experience",
|
|
17981
|
+
},
|
|
17982
|
+
],
|
|
17983
|
+
$dashboard: [
|
|
17984
|
+
{
|
|
17985
|
+
filterType: "item",
|
|
17986
|
+
type: {
|
|
17987
|
+
any: ["Dashboard"],
|
|
17988
|
+
not: ["Operation View"],
|
|
17989
|
+
},
|
|
17990
|
+
typekeywords: {
|
|
17991
|
+
not: ["Extension", "ArcGIS Operation View"],
|
|
17992
|
+
},
|
|
17993
|
+
},
|
|
17994
|
+
],
|
|
17995
|
+
$dataset: [
|
|
17996
|
+
{
|
|
17997
|
+
filterType: "item",
|
|
17998
|
+
type: {
|
|
17999
|
+
any: [
|
|
18000
|
+
"Scene Service",
|
|
18001
|
+
"Feature Collection",
|
|
18002
|
+
"Route Layer",
|
|
18003
|
+
"Layer",
|
|
18004
|
+
"Explorer Layer",
|
|
18005
|
+
"Tile Package",
|
|
18006
|
+
"Vector Tile Package",
|
|
18007
|
+
"Scene Package",
|
|
18008
|
+
"Layer Package",
|
|
18009
|
+
"Feature Service",
|
|
18010
|
+
"Stream Service",
|
|
18011
|
+
"Map Service",
|
|
18012
|
+
"Vector Tile Service",
|
|
18013
|
+
"Image Service",
|
|
18014
|
+
"WMS",
|
|
18015
|
+
"WFS",
|
|
18016
|
+
"WMTS",
|
|
18017
|
+
"KML",
|
|
18018
|
+
"KML Collection",
|
|
18019
|
+
"Globe Service",
|
|
18020
|
+
"CSV",
|
|
18021
|
+
"Shapefile",
|
|
18022
|
+
"GeoJson",
|
|
18023
|
+
"Service Definition",
|
|
18024
|
+
"File Geodatabase",
|
|
18025
|
+
"CAD Drawing",
|
|
18026
|
+
"Relational Database Connection",
|
|
18027
|
+
],
|
|
18028
|
+
not: ["Web Mapping Application", "Geodata Service"],
|
|
18029
|
+
},
|
|
18030
|
+
},
|
|
18031
|
+
{
|
|
18032
|
+
filterType: "item",
|
|
18033
|
+
typekeywords: ["OGC", "Geodata Service"],
|
|
18034
|
+
},
|
|
18035
|
+
],
|
|
18036
|
+
$document: [
|
|
18037
|
+
{
|
|
18038
|
+
filterType: "item",
|
|
18039
|
+
type: [
|
|
18040
|
+
"PDF",
|
|
18041
|
+
"Microsoft Excel",
|
|
18042
|
+
"Microsoft Word",
|
|
18043
|
+
"Microsoft Powerpoint",
|
|
18044
|
+
"iWork Keynote",
|
|
18045
|
+
"iWork Pages",
|
|
18046
|
+
"iWork Numbers",
|
|
18047
|
+
"Visio Document",
|
|
18048
|
+
"Document Link",
|
|
18049
|
+
],
|
|
18050
|
+
},
|
|
18051
|
+
],
|
|
18052
|
+
$initiative: [
|
|
18053
|
+
{
|
|
18054
|
+
filterType: "item",
|
|
18055
|
+
type: "Hub Initiative",
|
|
18056
|
+
},
|
|
18057
|
+
],
|
|
18058
|
+
$experience: [
|
|
18059
|
+
{
|
|
18060
|
+
filterType: "item",
|
|
18061
|
+
type: "Web Experience",
|
|
18062
|
+
},
|
|
18063
|
+
],
|
|
18064
|
+
$feedback: [
|
|
18065
|
+
{
|
|
18066
|
+
filterType: "item",
|
|
18067
|
+
type: "Form",
|
|
18068
|
+
},
|
|
18069
|
+
],
|
|
18070
|
+
$page: [
|
|
18071
|
+
{
|
|
18072
|
+
filterType: "item",
|
|
18073
|
+
typekeywords: "hubPage",
|
|
18074
|
+
},
|
|
18075
|
+
],
|
|
18076
|
+
$site: [
|
|
18077
|
+
{
|
|
18078
|
+
filterType: "item",
|
|
18079
|
+
type: ["Hub Site Application", "Site Application"],
|
|
18080
|
+
},
|
|
18081
|
+
],
|
|
18082
|
+
$storymap: [
|
|
18083
|
+
{
|
|
18084
|
+
filterType: "item",
|
|
18085
|
+
type: "Storymap",
|
|
18086
|
+
},
|
|
18087
|
+
{
|
|
18088
|
+
filterType: "item",
|
|
18089
|
+
type: "Web Mapping Application",
|
|
18090
|
+
typekeywords: "Story Map",
|
|
18091
|
+
},
|
|
18092
|
+
],
|
|
18093
|
+
$template: [
|
|
18094
|
+
{
|
|
18095
|
+
filterType: "item",
|
|
18096
|
+
type: [
|
|
18097
|
+
"Web Mapping Application",
|
|
18098
|
+
"Hub Initiative",
|
|
18099
|
+
"Hub Initiative Template",
|
|
18100
|
+
"Solution",
|
|
18101
|
+
],
|
|
18102
|
+
typekeywords: {
|
|
18103
|
+
any: ["hubInitiativeTemplate", "hubSolutionTemplate", "Template"],
|
|
18104
|
+
not: "Deployed",
|
|
18105
|
+
},
|
|
18106
|
+
},
|
|
18107
|
+
],
|
|
18108
|
+
$webmap: [
|
|
18109
|
+
{
|
|
18110
|
+
filterType: "item",
|
|
18111
|
+
type: {
|
|
18112
|
+
any: ["Web Map", "Web Scene"],
|
|
18113
|
+
not: "Web Mapping Application",
|
|
18114
|
+
},
|
|
18115
|
+
},
|
|
18116
|
+
],
|
|
18117
|
+
};
|
|
18118
|
+
/**
|
|
18119
|
+
* @private
|
|
18120
|
+
* Convert a Filter Group to expand well-known type filters
|
|
18121
|
+
*
|
|
18122
|
+
* The purpose of this function is to allow for the use of short-hand
|
|
18123
|
+
* names for commonly used, complex queries.
|
|
18124
|
+
*
|
|
18125
|
+
* It works by looking for filters using the .type property, the value
|
|
18126
|
+
* of which is a key in the WellKnownItemFilters hash. If found in the
|
|
18127
|
+
* hash, the filters array of the active filterGroup is replaced with the
|
|
18128
|
+
* filters specified in the hash.
|
|
18129
|
+
*
|
|
18130
|
+
* NOTE: Any other properties specified in a filter will be removed
|
|
18131
|
+
*
|
|
18132
|
+
* Only exported to enable extensive testing
|
|
18133
|
+
* @param filterGroups
|
|
18134
|
+
*/
|
|
18135
|
+
function applyWellKnownItemFilters(filterGroups) {
|
|
18136
|
+
var clone = cloneObject$1(filterGroups);
|
|
18137
|
+
// iterate the filterGroups
|
|
18138
|
+
var result = clone.map(function (filterGroup) {
|
|
18139
|
+
filterGroup.filters = filterGroup.filters.reduce(function (updated, filter) {
|
|
18140
|
+
// check if the filter.type is a well-known type
|
|
18141
|
+
if (isWellKnownTypeFilter(filter.type)) {
|
|
18142
|
+
// get the set of filters to replace the current filter with
|
|
18143
|
+
var typeFilters = lookupTypeFilters(filter.type);
|
|
18144
|
+
// Note: At this point we could try to "merge" in the other
|
|
18145
|
+
// props on the filter, into all the filters returned from
|
|
18146
|
+
// the well-known hash. The problem with this is that the
|
|
18147
|
+
// combination may yield unexpected results; For now, if a filter
|
|
18148
|
+
// includes `.type is keyof WellKnownItemFilters` we simply
|
|
18149
|
+
// replace the entire filter with the array of filters returne
|
|
18150
|
+
// from the hash
|
|
18151
|
+
updated = __spreadArrays(updated, typeFilters);
|
|
18152
|
+
}
|
|
18153
|
+
else {
|
|
18154
|
+
// filter does not have a well-known type entry so keep it
|
|
18155
|
+
updated.push(filter);
|
|
18156
|
+
}
|
|
18157
|
+
return updated;
|
|
18158
|
+
}, []);
|
|
18159
|
+
return filterGroup;
|
|
18160
|
+
});
|
|
18161
|
+
return result;
|
|
18162
|
+
}
|
|
18163
|
+
/**
|
|
18164
|
+
* Is the argument a well-known type "key"
|
|
18165
|
+
*
|
|
18166
|
+
* Accepts `string`, `string[]` or `IMatchOptions`
|
|
18167
|
+
* but only string values can possibly be keys
|
|
18168
|
+
* on `WellKnownItemFilters`
|
|
18169
|
+
* @param key
|
|
18170
|
+
* @returns
|
|
18171
|
+
*/
|
|
18172
|
+
function isWellKnownTypeFilter(key) {
|
|
18173
|
+
var result = false;
|
|
18174
|
+
if (typeof key === "string") {
|
|
18175
|
+
result = key in WellKnownItemFilters;
|
|
18176
|
+
}
|
|
18177
|
+
return result;
|
|
18178
|
+
}
|
|
18179
|
+
/**
|
|
18180
|
+
* Fetch the array of fitlers from the well-known hash
|
|
18181
|
+
* @param key
|
|
18182
|
+
* @returns
|
|
18183
|
+
*/
|
|
18184
|
+
function lookupTypeFilters(key) {
|
|
18185
|
+
return WellKnownItemFilters[key];
|
|
18186
|
+
}
|
|
17933
18187
|
|
|
17934
18188
|
// ## ## ####### ######## ########
|
|
17935
18189
|
// ### ## ## ## ## ##
|
|
@@ -20229,6 +20483,8 @@
|
|
|
20229
20483
|
exports.isDomainForLegacySite = isDomainForLegacySite;
|
|
20230
20484
|
exports.isDomainUsedElsewhere = isDomainUsedElsewhere;
|
|
20231
20485
|
exports.isDownloadable = isDownloadable;
|
|
20486
|
+
exports.isEmptyFilter = isEmptyFilter;
|
|
20487
|
+
exports.isEmptyFilterGroup = isEmptyFilterGroup;
|
|
20232
20488
|
exports.isExtentCoordinateArray = isExtentCoordinateArray;
|
|
20233
20489
|
exports.isFeatureService = isFeatureService$1;
|
|
20234
20490
|
exports.isFieldworkerView = isFieldworkerView;
|