@esri/hub-common 9.41.1 → 9.43.1

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 (38) 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 +30 -0
  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 +30 -0
  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 +33 -1
  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/umd/common.umd.js +283 -7
  37. package/dist/umd/common.umd.js.map +1 -1
  38. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /* @preserve
2
- * @esri/hub-common - v9.41.0 - Mon Jun 13 2022 14:36:13 GMT+0000 (Coordinated Universal Time)
2
+ * @esri/hub-common - v9.43.0 - Wed Jun 15 2022 19:01:13 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
 
@@ -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
  /**
@@ -14659,6 +14673,8 @@
14659
14673
  *
14660
14674
  * **Note** Authentication is required
14661
14675
  *
14676
+ * Another 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
@@ -15152,6 +15168,36 @@
15152
15168
  }
15153
15169
  return q;
15154
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
+ }
15155
15201
 
15156
15202
  /**
15157
15203
  * Generic Hub Error with an Error stack as well
@@ -17812,12 +17858,13 @@
17812
17858
  function portalSearchItems(filterGroups, options) {
17813
17859
  var _a;
17814
17860
  return __awaiter(this, void 0, void 0, function () {
17815
- var expandedGroups, so, props;
17861
+ var replaced, expandedGroups, so, props;
17816
17862
  return __generator(this, function (_b) {
17817
17863
  if (!options.requestOptions) {
17818
17864
  throw new HubError$1("hubSearch", "requestOptions: IHubRequestOptions is required.");
17819
17865
  }
17820
- expandedGroups = filterGroups.map(function (fg) {
17866
+ replaced = applyWellKnownItemFilters(filterGroups);
17867
+ expandedGroups = replaced.map(function (fg) {
17821
17868
  fg.filters = fg.filters.map(expandFilter);
17822
17869
  return fg;
17823
17870
  });
@@ -17916,6 +17963,233 @@
17916
17963
  });
17917
17964
  });
17918
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
+ }
17919
18193
 
17920
18194
  // ## ## ####### ######## ########
17921
18195
  // ### ## ## ## ## ##
@@ -20215,6 +20489,8 @@
20215
20489
  exports.isDomainForLegacySite = isDomainForLegacySite;
20216
20490
  exports.isDomainUsedElsewhere = isDomainUsedElsewhere;
20217
20491
  exports.isDownloadable = isDownloadable;
20492
+ exports.isEmptyFilter = isEmptyFilter;
20493
+ exports.isEmptyFilterGroup = isEmptyFilterGroup;
20218
20494
  exports.isExtentCoordinateArray = isExtentCoordinateArray;
20219
20495
  exports.isFeatureService = isFeatureService$1;
20220
20496
  exports.isFieldworkerView = isFieldworkerView;