@esri/hub-common 9.41.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.
Files changed (39) hide show
  1. package/dist/es2017/content/_internal.js +14 -1
  2. package/dist/es2017/content/_internal.js.map +1 -1
  3. package/dist/es2017/core/types/IHubContent.js +1 -0
  4. package/dist/es2017/core/types/IHubContent.js.map +1 -1
  5. package/dist/es2017/search/_internal/portalSearchItems.js +232 -3
  6. package/dist/es2017/search/_internal/portalSearchItems.js.map +1 -1
  7. package/dist/es2017/search/_searchUsers.js +2 -0
  8. package/dist/es2017/search/_searchUsers.js.map +1 -1
  9. package/dist/es2017/search/filter-utils.js +89 -26
  10. package/dist/es2017/search/filter-utils.js.map +1 -1
  11. package/dist/esm/content/_internal.js +14 -1
  12. package/dist/esm/content/_internal.js.map +1 -1
  13. package/dist/esm/core/types/IHubContent.js +1 -0
  14. package/dist/esm/core/types/IHubContent.js.map +1 -1
  15. package/dist/esm/search/_internal/portalSearchItems.js +233 -5
  16. package/dist/esm/search/_internal/portalSearchItems.js.map +1 -1
  17. package/dist/esm/search/_searchUsers.js +2 -0
  18. package/dist/esm/search/_searchUsers.js.map +1 -1
  19. package/dist/esm/search/filter-utils.js +90 -27
  20. package/dist/esm/search/filter-utils.js.map +1 -1
  21. package/dist/node/content/_internal.js +14 -1
  22. package/dist/node/content/_internal.js.map +1 -1
  23. package/dist/node/core/types/IHubContent.js +1 -0
  24. package/dist/node/core/types/IHubContent.js.map +1 -1
  25. package/dist/node/search/_internal/portalSearchItems.js +232 -2
  26. package/dist/node/search/_internal/portalSearchItems.js.map +1 -1
  27. package/dist/node/search/_searchUsers.js +2 -0
  28. package/dist/node/search/_searchUsers.js.map +1 -1
  29. package/dist/node/search/filter-utils.js +92 -27
  30. package/dist/node/search/filter-utils.js.map +1 -1
  31. package/dist/types/content/_internal.d.ts +1 -0
  32. package/dist/types/core/types/IHubContent.d.ts +5 -2
  33. package/dist/types/search/_internal/portalSearchItems.d.ts +35 -1
  34. package/dist/types/search/_searchUsers.d.ts +2 -0
  35. package/dist/types/search/filter-utils.d.ts +13 -1
  36. package/dist/types/search/types/types.d.ts +1 -0
  37. package/dist/umd/common.umd.js +353 -44
  38. package/dist/umd/common.umd.js.map +1 -1
  39. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { ISearchOptions } from "@esri/arcgis-rest-portal";
2
- import { IFilterGroup, FilterType } from "./types";
2
+ import { Filter, IFilterGroup, FilterType } from "./types";
3
3
  /**
4
4
  * Expand a Filter into it's more expressive structure so it can be
5
5
  * serialized deterministically.
@@ -16,3 +16,15 @@ export declare function expandFilter<T>(filter: T): T;
16
16
  * @returns
17
17
  */
18
18
  export declare function serializeFilterGroupsForPortal(filterGroups: Array<IFilterGroup<FilterType>>): ISearchOptions;
19
+ /**
20
+ * Determine if a Filter is "empty"
21
+ * @param filter
22
+ * @returns
23
+ */
24
+ export declare function isEmptyFilter(filter: Filter<FilterType>): boolean;
25
+ /**
26
+ * Determine if a filterGroup is "empty"
27
+ * @param filterGroup
28
+ * @returns
29
+ */
30
+ export declare function isEmptyFilterGroup(filterGroup: IFilterGroup<FilterType>): boolean;
@@ -161,6 +161,7 @@ export interface IGroupFilterDefinition {
161
161
  orgid?: string | string[] | IMatchOptions;
162
162
  owner?: string | string[] | IMatchOptions;
163
163
  searchUserAccess?: "groupMember";
164
+ searchUserName?: string;
164
165
  tags?: string | string[] | IMatchOptions;
165
166
  term?: string;
166
167
  title?: string | string[] | IMatchOptions;
@@ -1,5 +1,5 @@
1
1
  /* @preserve
2
- * @esri/hub-common - v9.40.0 - Fri Jun 10 2022 19:52:59 GMT+0000 (Coordinated Universal Time)
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
  */
@@ -6449,6 +6449,7 @@
6449
6449
  (function (PublisherSource) {
6450
6450
  PublisherSource["CitationContact"] = "metadata.resource.citation.contact";
6451
6451
  PublisherSource["ResourceContact"] = "metadata.resource.contact";
6452
+ PublisherSource["MetadataContact"] = "metadata.contact";
6452
6453
  PublisherSource["ItemOwner"] = "item.owner";
6453
6454
  PublisherSource["None"] = "none";
6454
6455
  })(exports.PublisherSource || (exports.PublisherSource = {}));
@@ -7082,7 +7083,8 @@
7082
7083
  organizationSource: exports.PublisherSource.None,
7083
7084
  };
7084
7085
  var citationContact = extractFirstContact(metadata, "metadata.dataIdInfo.idCitation.citRespParty");
7085
- var resourceContact = extractFirstContact(metadata, "metadata.mdContact");
7086
+ var resourceContact = extractFirstContact(metadata, "metadata.dataIdInfo.idPoC");
7087
+ var metadataContact = extractFirstContact(metadata, "metadata.mdContact");
7086
7088
  // Determine publisher name properties
7087
7089
  var ownerFullName = getProp(ownerUser, "fullName");
7088
7090
  if (citationContact.individualName) {
@@ -7093,6 +7095,10 @@
7093
7095
  result.name = resourceContact.individualName;
7094
7096
  result.nameSource = exports.PublisherSource.ResourceContact;
7095
7097
  }
7098
+ else if (metadataContact.individualName) {
7099
+ result.name = metadataContact.individualName;
7100
+ result.nameSource = exports.PublisherSource.MetadataContact;
7101
+ }
7096
7102
  else if (ownerFullName) {
7097
7103
  result.name = ownerFullName;
7098
7104
  result.username = ownerUser.username;
@@ -7108,11 +7114,19 @@
7108
7114
  result.organization = resourceContact.organizationName;
7109
7115
  result.organizationSource = exports.PublisherSource.ResourceContact;
7110
7116
  }
7117
+ else if (metadataContact.organizationName) {
7118
+ result.organization = metadataContact.organizationName;
7119
+ result.organizationSource = exports.PublisherSource.MetadataContact;
7120
+ }
7111
7121
  else if (orgName) {
7112
7122
  result.organization = orgName;
7113
7123
  result.orgId = getItemOrgId(item, ownerUser);
7114
7124
  result.organizationSource = exports.PublisherSource.ItemOwner;
7115
7125
  }
7126
+ // We assume the item belongs to external org if no org info is available and the item is private
7127
+ result.isExternal =
7128
+ result.organizationSource === exports.PublisherSource.None &&
7129
+ item.access !== "public";
7116
7130
  return result;
7117
7131
  };
7118
7132
 
@@ -13535,7 +13549,7 @@
13535
13549
  * @param join
13536
13550
  * @returns
13537
13551
  */
13538
- function mergeSearchOptions(so1, so2, join) {
13552
+ function mergeSearchOptions$1(so1, so2, join) {
13539
13553
  // TODO: Remove with _searchContent
13540
13554
  Logger.warn("DEPRECATION: mergeSearchOptions will be removed. Work with IFilterGroups<\"group\"> and hubSearch() instead");
13541
13555
  var result = cloneObject$1(so1);
@@ -14030,7 +14044,7 @@
14030
14044
  if (isWellKnownType(entry)) {
14031
14045
  // working with dynamic objects in typescript requires some assertions
14032
14046
  var key = entry;
14033
- clone.subFilters = clone.subFilters.concat(lookupTypeFilters(key));
14047
+ clone.subFilters = clone.subFilters.concat(lookupTypeFilters$1(key));
14034
14048
  }
14035
14049
  else {
14036
14050
  acc.push(entry);
@@ -14040,7 +14054,7 @@
14040
14054
  }
14041
14055
  else if (isWellKnownType(clone.type)) {
14042
14056
  var key = clone.type;
14043
- clone.subFilters = clone.subFilters.concat(lookupTypeFilters(key));
14057
+ clone.subFilters = clone.subFilters.concat(lookupTypeFilters$1(key));
14044
14058
  delete clone.type;
14045
14059
  }
14046
14060
  else ;
@@ -14063,7 +14077,7 @@
14063
14077
  }
14064
14078
  return result;
14065
14079
  }
14066
- function lookupTypeFilters(key) {
14080
+ function lookupTypeFilters$1(key) {
14067
14081
  return ContentFilterExpansions[key];
14068
14082
  }
14069
14083
  /**
@@ -14131,12 +14145,12 @@
14131
14145
  // from hitting the else
14132
14146
  /* istanbul ignore else */
14133
14147
  if (typeof entry === "object") {
14134
- acc = mergeSearchOptions(acc, convertContentFilterToSearchOptions(entry), "OR");
14148
+ acc = mergeSearchOptions$1(acc, convertContentFilterToSearchOptions(entry), "OR");
14135
14149
  }
14136
14150
  return acc;
14137
14151
  }, { q: "", filter: "" });
14138
14152
  // merge with searchOptions using AND
14139
- searchOptions = mergeSearchOptions(searchOptions, subFilterOptions, "AND");
14153
+ searchOptions = mergeSearchOptions$1(searchOptions, subFilterOptions, "AND");
14140
14154
  }
14141
14155
  // term is always last, and pre-pended on searchOptions.q
14142
14156
  if (filter.term) {
@@ -14164,11 +14178,11 @@
14164
14178
  var key = _a[0], value = _a[1];
14165
14179
  // MatchOptions may go into either q or filter
14166
14180
  if (!specialProps.includes(key)) {
14167
- result = mergeSearchOptions(result, serializeMatchOptions$1(key, value), "AND");
14181
+ result = mergeSearchOptions$1(result, serializeMatchOptions$1(key, value), "AND");
14168
14182
  }
14169
14183
  // Dates only go into q
14170
14184
  if (dateProps.includes(key)) {
14171
- result = mergeSearchOptions(result, serializeDateRange$1(key, value), "AND");
14185
+ result = mergeSearchOptions$1(result, serializeDateRange$1(key, value), "AND");
14172
14186
  }
14173
14187
  });
14174
14188
  return result;
@@ -14299,11 +14313,11 @@
14299
14313
  var key = _a[0], value = _a[1];
14300
14314
  // MatchOptions fields
14301
14315
  if (!specialProps.includes(key)) {
14302
- result = mergeSearchOptions(result, serializeMatchOptions$1(key, value), "AND");
14316
+ result = mergeSearchOptions$1(result, serializeMatchOptions$1(key, value), "AND");
14303
14317
  }
14304
14318
  // Dates only go into q
14305
14319
  if (dateProps.includes(key)) {
14306
- result = mergeSearchOptions(result, serializeDateRange$1(key, value), "AND");
14320
+ result = mergeSearchOptions$1(result, serializeDateRange$1(key, value), "AND");
14307
14321
  }
14308
14322
  });
14309
14323
  // searchUserAccess is also a top-level property
@@ -14439,11 +14453,11 @@
14439
14453
  var key = _a[0], value = _a[1];
14440
14454
  // MatchOptions fields
14441
14455
  if (!specialProps.includes(key)) {
14442
- result = mergeSearchOptions(result, serializeMatchOptions$1(key, value), "AND");
14456
+ result = mergeSearchOptions$1(result, serializeMatchOptions$1(key, value), "AND");
14443
14457
  }
14444
14458
  // Dates only go into q
14445
14459
  if (dateProps.includes(key)) {
14446
- result = mergeSearchOptions(result, serializeDateRange$1(key, value), "AND");
14460
+ result = mergeSearchOptions$1(result, serializeDateRange$1(key, value), "AND");
14447
14461
  }
14448
14462
  });
14449
14463
  // disabled is also a top-level property
@@ -14659,6 +14673,8 @@
14659
14673
  *
14660
14674
  * **Note** Authentication is required
14661
14675
  *
14676
+ * Trivial comment to force a release
14677
+ *
14662
14678
  * Note: in the future, there may be options to search via
14663
14679
  * a Hub specific API
14664
14680
  * @param filter
@@ -14971,7 +14987,13 @@
14971
14987
  function expandFilter(filter) {
14972
14988
  var result = {};
14973
14989
  var dateProps = ["created", "modified", "lastlogin"];
14974
- var copyProps = ["filterType", "term", "searchUserAccess", "isopendata"];
14990
+ var copyProps = [
14991
+ "filterType",
14992
+ "term",
14993
+ "searchUserAccess",
14994
+ "isopendata",
14995
+ "searchUserName",
14996
+ ];
14975
14997
  var nonMatchOptionsFields = __spreadArrays(dateProps, copyProps);
14976
14998
  // Do the conversion
14977
14999
  Object.entries(filter).forEach(function (_a) {
@@ -15004,27 +15026,26 @@
15004
15026
  * @returns
15005
15027
  */
15006
15028
  function serializeFilterGroupsForPortal(filterGroups) {
15007
- var result = {
15008
- q: "",
15009
- filter: "",
15010
- };
15011
- result.q = filterGroups.map(serializeGroup).join(" AND ");
15029
+ var groupSearchOptions = filterGroups.map(serializeGroup);
15030
+ var result = mergeSearchOptions(groupSearchOptions, "AND");
15012
15031
  return result;
15013
15032
  }
15014
15033
  /**
15015
15034
  * Serialize the filters in a FitlerGroup into a Portal Query
15016
- * @param group
15035
+ * @param filterGroup
15017
15036
  * @returns
15018
15037
  */
15019
- function serializeGroup(group) {
15020
- var operation = group.operation || "AND";
15021
- var filters = group.filters.map(expandFilter);
15022
- var q = filters.map(serializeFilter).join(" " + operation + " ");
15023
- // Wrap in parens if there is more than one filter
15038
+ function serializeGroup(filterGroup) {
15039
+ var operation = filterGroup.operation || "AND";
15040
+ var filters = filterGroup.filters.map(expandFilter);
15041
+ var filterSearchOptions = filters.map(serializeFilter);
15042
+ // combine these searchOptions
15043
+ var groupSearchOptions = mergeSearchOptions(filterSearchOptions, operation);
15044
+ //
15024
15045
  if (filters.length > 1) {
15025
- q = "(" + q + ")";
15046
+ groupSearchOptions.q = "(" + groupSearchOptions.q + ")";
15026
15047
  }
15027
- return q;
15048
+ return groupSearchOptions;
15028
15049
  }
15029
15050
  /**
15030
15051
  * Serialize a Filter into a Portal Query
@@ -15034,36 +15055,64 @@
15034
15055
  function serializeFilter(filter) {
15035
15056
  var dateProps = ["created", "modified"];
15036
15057
  var boolProps = ["isopendata"];
15058
+ var passThroughProps = ["searchUserAccess", "searchUserName"];
15037
15059
  var specialProps = __spreadArrays([
15038
15060
  "filterType",
15039
- "searchUserAccess",
15040
15061
  "term"
15041
- ], dateProps, boolProps);
15062
+ ], dateProps, boolProps, passThroughProps);
15063
+ var qCount = 0;
15042
15064
  // TODO: Look at using reduce vs .map and remove the `.filter`
15043
- var stringFilters = Object.entries(filter)
15065
+ var opts = Object.entries(filter)
15044
15066
  .map(function (_a) {
15045
15067
  var key = _a[0], value = _a[1];
15068
+ var so = { q: "" };
15046
15069
  if (!specialProps.includes(key)) {
15047
- return serializeMatchOptions(key, value);
15070
+ qCount++;
15071
+ so.q = serializeMatchOptions(key, value);
15048
15072
  }
15049
15073
  if (dateProps.includes(key)) {
15050
- return serializeDateRange(key, value);
15074
+ qCount++;
15075
+ so.q = serializeDateRange(key, value);
15051
15076
  }
15052
15077
  if (boolProps.includes(key)) {
15053
- return key + ":" + value;
15078
+ qCount++;
15079
+ so.q = key + ":" + value;
15080
+ }
15081
+ if (passThroughProps.includes(key)) {
15082
+ so[key] = value;
15054
15083
  }
15055
15084
  if (key === "term") {
15056
- return value;
15085
+ qCount++;
15086
+ so.q = value;
15057
15087
  }
15088
+ return so;
15058
15089
  })
15059
15090
  .filter(function (e) { return e !== undefined; });
15060
- // eslint-disable-next-line unicorn/prefer-ternary
15061
- if (stringFilters.length > 1) {
15062
- return "(" + stringFilters.join(" AND ") + ")";
15063
- }
15064
- else {
15065
- return stringFilters[0];
15091
+ // merge up all the searchOptions
15092
+ var searchOptions = mergeSearchOptions(opts, "AND");
15093
+ if (qCount > 1) {
15094
+ searchOptions.q = "(" + searchOptions.q + ")";
15066
15095
  }
15096
+ return searchOptions;
15097
+ }
15098
+ function mergeSearchOptions(options, operation) {
15099
+ var result = options.reduce(function (acc, entry) {
15100
+ // walk the props
15101
+ Object.entries(entry).forEach(function (_a) {
15102
+ var key = _a[0], value = _a[1];
15103
+ // if prop exists
15104
+ if (acc[key]) {
15105
+ // combine via operation
15106
+ acc[key] = acc[key] + " " + operation + " " + value;
15107
+ }
15108
+ else {
15109
+ // just copy the value
15110
+ acc[key] = value;
15111
+ }
15112
+ });
15113
+ return acc;
15114
+ }, { q: "" });
15115
+ return result;
15067
15116
  }
15068
15117
  /**
15069
15118
  * Serialize MatchOptions into portal syntax
@@ -15119,6 +15168,36 @@
15119
15168
  }
15120
15169
  return q;
15121
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
+ }
15122
15201
 
15123
15202
  /**
15124
15203
  * Generic Hub Error with an Error stack as well
@@ -17779,12 +17858,13 @@
17779
17858
  function portalSearchItems(filterGroups, options) {
17780
17859
  var _a;
17781
17860
  return __awaiter(this, void 0, void 0, function () {
17782
- var expandedGroups, so, props;
17861
+ var replaced, expandedGroups, so, props;
17783
17862
  return __generator(this, function (_b) {
17784
17863
  if (!options.requestOptions) {
17785
17864
  throw new HubError$1("hubSearch", "requestOptions: IHubRequestOptions is required.");
17786
17865
  }
17787
- expandedGroups = filterGroups.map(function (fg) {
17866
+ replaced = applyWellKnownItemFilters(filterGroups);
17867
+ expandedGroups = replaced.map(function (fg) {
17788
17868
  fg.filters = fg.filters.map(expandFilter);
17789
17869
  return fg;
17790
17870
  });
@@ -17883,6 +17963,233 @@
17883
17963
  });
17884
17964
  });
17885
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
+ }
17886
18193
 
17887
18194
  // ## ## ####### ######## ########
17888
18195
  // ### ## ## ## ## ##
@@ -20182,6 +20489,8 @@
20182
20489
  exports.isDomainForLegacySite = isDomainForLegacySite;
20183
20490
  exports.isDomainUsedElsewhere = isDomainUsedElsewhere;
20184
20491
  exports.isDownloadable = isDownloadable;
20492
+ exports.isEmptyFilter = isEmptyFilter;
20493
+ exports.isEmptyFilterGroup = isEmptyFilterGroup;
20185
20494
  exports.isExtentCoordinateArray = isExtentCoordinateArray;
20186
20495
  exports.isFeatureService = isFeatureService$1;
20187
20496
  exports.isFieldworkerView = isFieldworkerView;
@@ -20205,7 +20514,7 @@
20205
20514
  exports.mergeGroupFilters = mergeGroupFilters;
20206
20515
  exports.mergeMatchOptions = mergeMatchOptions;
20207
20516
  exports.mergeObjects = mergeObjects;
20208
- exports.mergeSearchOptions = mergeSearchOptions;
20517
+ exports.mergeSearchOptions = mergeSearchOptions$1;
20209
20518
  exports.mergeUserFilters = mergeUserFilters;
20210
20519
  exports.normalizeItemType = normalizeItemType;
20211
20520
  exports.normalizeSolutionTemplateItem = normalizeSolutionTemplateItem;