@esri/hub-common 9.45.0 → 9.45.3

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 (69) hide show
  1. package/dist/es2017/content/compose.js +1 -1
  2. package/dist/es2017/content/compose.js.map +1 -1
  3. package/dist/es2017/search/Collection.js +3 -0
  4. package/dist/es2017/search/Collection.js.map +1 -1
  5. package/dist/es2017/search/_internal/ifilter-utils.js.map +1 -1
  6. package/dist/es2017/search/_internal/index.js +1 -0
  7. package/dist/es2017/search/_internal/index.js.map +1 -1
  8. package/dist/es2017/search/_internal/portalSearchGroups.js +1 -56
  9. package/dist/es2017/search/_internal/portalSearchGroups.js.map +1 -1
  10. package/dist/es2017/search/_internal/portalSearchItems.js +1 -87
  11. package/dist/es2017/search/_internal/portalSearchItems.js.map +1 -1
  12. package/dist/es2017/search/_internal/portalSearchUsers.js +0 -43
  13. package/dist/es2017/search/_internal/portalSearchUsers.js.map +1 -1
  14. package/dist/es2017/search/convertCatalog.js +20 -19
  15. package/dist/es2017/search/convertCatalog.js.map +1 -1
  16. package/dist/es2017/search/filter-utils.js +0 -197
  17. package/dist/es2017/search/filter-utils.js.map +1 -1
  18. package/dist/es2017/search/hubSearch.js +9 -38
  19. package/dist/es2017/search/hubSearch.js.map +1 -1
  20. package/dist/esm/content/compose.js +1 -1
  21. package/dist/esm/content/compose.js.map +1 -1
  22. package/dist/esm/search/Collection.js +7 -0
  23. package/dist/esm/search/Collection.js.map +1 -1
  24. package/dist/esm/search/_internal/ifilter-utils.js.map +1 -1
  25. package/dist/esm/search/_internal/index.js +1 -0
  26. package/dist/esm/search/_internal/index.js.map +1 -1
  27. package/dist/esm/search/_internal/portalSearchGroups.js +1 -57
  28. package/dist/esm/search/_internal/portalSearchGroups.js.map +1 -1
  29. package/dist/esm/search/_internal/portalSearchItems.js +1 -88
  30. package/dist/esm/search/_internal/portalSearchItems.js.map +1 -1
  31. package/dist/esm/search/_internal/portalSearchUsers.js +0 -45
  32. package/dist/esm/search/_internal/portalSearchUsers.js.map +1 -1
  33. package/dist/esm/search/convertCatalog.js +20 -19
  34. package/dist/esm/search/convertCatalog.js.map +1 -1
  35. package/dist/esm/search/filter-utils.js +0 -198
  36. package/dist/esm/search/filter-utils.js.map +1 -1
  37. package/dist/esm/search/hubSearch.js +9 -37
  38. package/dist/esm/search/hubSearch.js.map +1 -1
  39. package/dist/node/content/compose.js +1 -1
  40. package/dist/node/content/compose.js.map +1 -1
  41. package/dist/node/search/Collection.js +3 -0
  42. package/dist/node/search/Collection.js.map +1 -1
  43. package/dist/node/search/_internal/ifilter-utils.js.map +1 -1
  44. package/dist/node/search/_internal/index.js +1 -0
  45. package/dist/node/search/_internal/index.js.map +1 -1
  46. package/dist/node/search/_internal/portalSearchGroups.js +1 -57
  47. package/dist/node/search/_internal/portalSearchGroups.js.map +1 -1
  48. package/dist/node/search/_internal/portalSearchItems.js +2 -90
  49. package/dist/node/search/_internal/portalSearchItems.js.map +1 -1
  50. package/dist/node/search/_internal/portalSearchUsers.js +1 -45
  51. package/dist/node/search/_internal/portalSearchUsers.js.map +1 -1
  52. package/dist/node/search/convertCatalog.js +20 -19
  53. package/dist/node/search/convertCatalog.js.map +1 -1
  54. package/dist/node/search/filter-utils.js +1 -200
  55. package/dist/node/search/filter-utils.js.map +1 -1
  56. package/dist/node/search/hubSearch.js +12 -41
  57. package/dist/node/search/hubSearch.js.map +1 -1
  58. package/dist/types/search/Collection.d.ts +2 -1
  59. package/dist/types/search/_internal/index.d.ts +1 -0
  60. package/dist/types/search/_internal/portalSearchGroups.d.ts +1 -10
  61. package/dist/types/search/_internal/portalSearchItems.d.ts +1 -15
  62. package/dist/types/search/_internal/portalSearchUsers.d.ts +1 -9
  63. package/dist/types/search/convertCatalog.d.ts +2 -2
  64. package/dist/types/search/filter-utils.d.ts +0 -17
  65. package/dist/types/search/hubSearch.d.ts +7 -4
  66. package/dist/types/search/types/IHubCatalog.d.ts +48 -3
  67. package/dist/umd/common.umd.js +52 -459
  68. package/dist/umd/common.umd.js.map +1 -1
  69. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /* @preserve
2
- * @esri/hub-common - v9.44.1 - Tue Jun 28 2022 15:39:40 GMT+0000 (Coordinated Universal Time)
2
+ * @esri/hub-common - v9.45.2 - Thu Jun 30 2022 13:33:18 GMT+0000 (Coordinated Universal Time)
3
3
  * Copyright (c) 2022 Environmental Systems Research Institute, Inc.
4
4
  * Apache-2.0
5
5
  */
@@ -7609,7 +7609,7 @@
7609
7609
  hubInitiative: "initiative",
7610
7610
  hubInitiativeTemplate: "initiative-template",
7611
7611
  hubPage: "browser",
7612
- hubProject: "briefcase",
7612
+ hubProject: "projects",
7613
7613
  hubSiteApplication: "web",
7614
7614
  image: "file-image",
7615
7615
  imageService: "data",
@@ -13548,7 +13548,7 @@
13548
13548
  * @param join
13549
13549
  * @returns
13550
13550
  */
13551
- function mergeSearchOptions$2(so1, so2, join) {
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$2(key, opts) {
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$2("AND", key, opts.exact);
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$2("OR", key, opts.any);
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$2("AND", key, opts.all);
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$2("OR", "-" + key, opts.not);
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$2(key, range) {
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$2(join, key, value) {
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$1(key));
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$1(key));
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$1(key) {
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$2(acc, convertContentFilterToSearchOptions(entry), "OR");
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$2(searchOptions, subFilterOptions, "AND");
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$2(result, serializeMatchOptions$2(key, value), "AND");
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$2(result, serializeDateRange$2(key, value), "AND");
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$2(result, serializeMatchOptions$2(key, value), "AND");
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$2(result, serializeDateRange$2(key, value), "AND");
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$2(result, serializeMatchOptions$2(key, value), "AND");
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$2(result, serializeDateRange$2(key, value), "AND");
14459
+ result = mergeSearchOptions$1(result, serializeDateRange$1(key, value), "AND");
14460
14460
  }
14461
14461
  });
14462
14462
  // disabled is also a top-level property
@@ -14948,226 +14948,33 @@
14948
14948
  * @param original
14949
14949
  */
14950
14950
  function convertCatalog(original) {
14951
- var filterGroup = {
14952
- filterType: "item",
14953
- operation: "OR",
14954
- filters: [],
14955
- };
14956
- var groups = getProp(original, "groups");
14957
- if (Array.isArray(groups) && groups.length) {
14958
- filterGroup.filters.push({
14959
- filterType: "item",
14960
- group: groups,
14961
- });
14962
- }
14963
- else if (typeof groups === "string") {
14964
- filterGroup.filters.push({
14965
- filterType: "item",
14966
- group: [groups],
14967
- });
14968
- }
14969
14951
  var catalog = {
14952
+ schemaVersion: 1,
14970
14953
  title: "Default Catalog",
14971
- scope: [filterGroup],
14954
+ scopes: {
14955
+ item: {
14956
+ targetEntity: "item",
14957
+ filters: [],
14958
+ },
14959
+ },
14972
14960
  collections: [],
14973
14961
  };
14974
- return catalog;
14975
- }
14976
-
14977
- // DEPRECATED - REMOVE THIS FILE
14978
- /**
14979
- * Expand a Filter into it's more expressive structure so it can be
14980
- * serialized deterministically.
14981
- *
14982
- * Props with type `string | string[] | MatchOptions` expand into `IMatchOptions`
14983
- * Props relative-dates are expanded into formal date-ranges
14984
- * @param filter
14985
- * @returns
14986
- */
14987
- function expandFilter(filter) {
14988
- var result = {};
14989
- var dateProps = ["created", "modified", "lastlogin"];
14990
- var copyProps = [
14991
- "filterType",
14992
- "term",
14993
- "searchUserAccess",
14994
- "isopendata",
14995
- "searchUserName",
14996
- ];
14997
- var nonMatchOptionsFields = __spreadArrays(dateProps, copyProps);
14998
- // Do the conversion
14999
- Object.entries(filter).forEach(function (_a) {
15000
- var key = _a[0], value = _a[1];
15001
- // Handle MatchOptions fields
15002
- if (!nonMatchOptionsFields.includes(key)) {
15003
- // setProp side-steps typescript complaining
15004
- setProp(key, valueToMatchOptions(value), result);
15005
- }
15006
- // Handle Date fields
15007
- if (dateProps.includes(key)) {
15008
- var dateFieldValue = cloneObject$1(getProp(filter, key));
15009
- if (getProp(filter, key + ".type") === "relative-date") {
15010
- setProp(key, relativeDateToDateRange(dateFieldValue), result);
15011
- }
15012
- else {
15013
- setProp(key, dateFieldValue, result);
15014
- }
15015
- }
15016
- // Handle fields that are just copied forward
15017
- if (copyProps.includes(key) && filter.hasOwnProperty(key)) {
15018
- setProp(key, value, result);
15019
- }
15020
- });
15021
- return result;
15022
- }
15023
- /**
15024
- * Serialize a FilterGroup of any type for Portal
15025
- * @param filterGroups
15026
- * @returns
15027
- */
15028
- function serializeFilterGroupsForPortal(filterGroups) {
15029
- var groupSearchOptions = filterGroups.map(serializeGroup);
15030
- var result = mergeSearchOptions$1(groupSearchOptions, "AND");
15031
- return result;
15032
- }
15033
- /**
15034
- * Serialize the filters in a FitlerGroup into a Portal Query
15035
- * @param filterGroup
15036
- * @returns
15037
- */
15038
- function serializeGroup(filterGroup) {
15039
- var operation = filterGroup.operation || "AND";
15040
- var filters = filterGroup.filters.map(expandFilter);
15041
- var filterSearchOptions = filters.map(serializeFilter$1);
15042
- // combine these searchOptions
15043
- var groupSearchOptions = mergeSearchOptions$1(filterSearchOptions, operation);
15044
- //
15045
- if (filters.length > 1) {
15046
- groupSearchOptions.q = "(" + groupSearchOptions.q + ")";
14962
+ var rawGroups = getProp(original, "groups");
14963
+ var groups = [];
14964
+ if (Array.isArray(rawGroups) && rawGroups.length) {
14965
+ groups = rawGroups;
15047
14966
  }
15048
- return groupSearchOptions;
15049
- }
15050
- /**
15051
- * Serialize a Filter into a Portal Query
15052
- * @param filter
15053
- * @returns
15054
- */
15055
- function serializeFilter$1(filter) {
15056
- var dateProps = ["created", "modified"];
15057
- var boolProps = ["isopendata"];
15058
- var passThroughProps = ["searchUserAccess", "searchUserName"];
15059
- var specialProps = __spreadArrays([
15060
- "filterType",
15061
- "term"
15062
- ], dateProps, boolProps, passThroughProps);
15063
- var qCount = 0;
15064
- // TODO: Look at using reduce vs .map and remove the `.filter`
15065
- var opts = Object.entries(filter)
15066
- .map(function (_a) {
15067
- var key = _a[0], value = _a[1];
15068
- var so = { q: "" };
15069
- if (!specialProps.includes(key)) {
15070
- qCount++;
15071
- so.q = serializeMatchOptions$1(key, value);
15072
- }
15073
- if (dateProps.includes(key)) {
15074
- qCount++;
15075
- so.q = serializeDateRange$1(key, value);
15076
- }
15077
- if (boolProps.includes(key)) {
15078
- qCount++;
15079
- so.q = key + ":" + value;
15080
- }
15081
- if (passThroughProps.includes(key)) {
15082
- so[key] = value;
15083
- }
15084
- if (key === "term") {
15085
- qCount++;
15086
- so.q = value;
15087
- }
15088
- return so;
15089
- })
15090
- .filter(function (e) { return e !== undefined; });
15091
- // merge up all the searchOptions
15092
- var searchOptions = mergeSearchOptions$1(opts, "AND");
15093
- if (qCount > 1) {
15094
- searchOptions.q = "(" + searchOptions.q + ")";
14967
+ else if (typeof rawGroups === "string") {
14968
+ groups = [rawGroups];
15095
14969
  }
15096
- return searchOptions;
15097
- }
15098
- function mergeSearchOptions$1(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
- }
14970
+ if (groups.length) {
14971
+ catalog.scopes.item.filters.push({
14972
+ predicates: [{ group: groups }],
15112
14973
  });
15113
- return acc;
15114
- }, { q: "" });
15115
- return result;
15116
- }
15117
- /**
15118
- * Serialize MatchOptions into portal syntax
15119
- * @param key
15120
- * @param value
15121
- * @returns
15122
- */
15123
- function serializeMatchOptions$1(key, value) {
15124
- var result = "";
15125
- if (value.any) {
15126
- result = "" + serializeStringOrArray$1("OR", key, value.any);
15127
- }
15128
- if (value.all) {
15129
- result =
15130
- (result ? result + " AND " : "") +
15131
- ("" + serializeStringOrArray$1("AND", key, value.all));
15132
- }
15133
- if (value.not) {
15134
- // negate the entries if they are not
15135
- result =
15136
- (result ? result + " AND " : "") +
15137
- ("" + serializeStringOrArray$1("OR", "-" + key, value.not));
15138
- }
15139
- // TODO HANDLE EXACT
15140
- return result;
15141
- }
15142
- /**
15143
- * Serialize a date-range into Portal syntax
15144
- * @param key
15145
- * @param range
15146
- * @returns
15147
- */
15148
- function serializeDateRange$1(key, range) {
15149
- return key + ":[" + range.from + " TO " + range.to + "]";
15150
- }
15151
- /**
15152
- * Serialize a `string` or `string[]` into a string
15153
- * @param join
15154
- * @param key
15155
- * @param value
15156
- * @returns
15157
- */
15158
- function serializeStringOrArray$1(join, key, value) {
15159
- var q = "";
15160
- if (Array.isArray(value)) {
15161
- q = key + ":\"" + value.join("\" " + join + " " + key + ":\"") + "\"";
15162
- if (value.length > 1) {
15163
- q = "(" + q + ")";
15164
- }
15165
14974
  }
15166
- else {
15167
- q = key + ":\"" + value + "\"";
15168
- }
15169
- return q;
14975
+ return catalog;
15170
14976
  }
14977
+
15171
14978
  /**
15172
14979
  * Determine if a Filter is "empty"
15173
14980
  * @param filter
@@ -18088,56 +17895,6 @@
18088
17895
  }
18089
17896
  }
18090
17897
 
18091
- /**
18092
- * @private
18093
- * DEPRECATED
18094
- * @param filterGroups
18095
- * @param options
18096
- * @returns
18097
- */
18098
- function portalSearchItemsFilterGroups(filterGroups, options) {
18099
- var _a;
18100
- return __awaiter(this, void 0, void 0, function () {
18101
- var replaced, expandedGroups, so, props;
18102
- return __generator(this, function (_b) {
18103
- if (!options.requestOptions) {
18104
- throw new HubError$1("hubSearch", "requestOptions: IHubRequestOptions is required.");
18105
- }
18106
- replaced = applyWellKnownItemFilterGroups(filterGroups);
18107
- expandedGroups = replaced.map(function (fg) {
18108
- fg.filters = fg.filters.map(expandFilter);
18109
- return fg;
18110
- });
18111
- so = serializeFilterGroupsForPortal(expandedGroups);
18112
- props = [
18113
- "num",
18114
- "sortField",
18115
- "sortOrder",
18116
- "include",
18117
- "start",
18118
- "requestOptions",
18119
- ];
18120
- // copy the props over
18121
- props.forEach(function (prop) {
18122
- if (options.hasOwnProperty(prop)) {
18123
- so[prop] = options[prop];
18124
- }
18125
- });
18126
- if (options.requestOptions.authentication) {
18127
- so.authentication = options.requestOptions.authentication;
18128
- }
18129
- else {
18130
- so.portal = options.requestOptions.portal;
18131
- }
18132
- // Aggregations
18133
- if ((_a = options.aggFields) === null || _a === void 0 ? void 0 : _a.length) {
18134
- so.countFields = options.aggFields.join(",");
18135
- so.countSize = options.aggLimit || 10;
18136
- }
18137
- return [2 /*return*/, searchPortal$2(so)];
18138
- });
18139
- });
18140
- }
18141
17898
  /**
18142
17899
  * @private
18143
17900
  * Portal Search Implementation for Items
@@ -18455,39 +18212,6 @@
18455
18212
  });
18456
18213
  return queryClone;
18457
18214
  }
18458
- /**
18459
- * DEPRECATED
18460
- * @param filterGroups
18461
- * @returns
18462
- */
18463
- function applyWellKnownItemFilterGroups(filterGroups) {
18464
- var clone = cloneObject$1(filterGroups);
18465
- // iterate the filterGroups
18466
- var result = clone.map(function (filterGroup) {
18467
- filterGroup.filters = filterGroup.filters.reduce(function (updated, filter) {
18468
- // check if the filter.type is a well-known type
18469
- if (isWellKnownTypeFilter(filter.type)) {
18470
- // get the set of filters to replace the current filter with
18471
- var typeFilters = lookupTypeFilters(filter.type);
18472
- // Note: At this point we could try to "merge" in the other
18473
- // props on the filter, into all the filters returned from
18474
- // the well-known hash. The problem with this is that the
18475
- // combination may yield unexpected results; For now, if a filter
18476
- // includes `.type is keyof WellKnownItemFilters` we simply
18477
- // replace the entire filter with the array of filters returne
18478
- // from the hash
18479
- updated = __spreadArrays(updated, typeFilters);
18480
- }
18481
- else {
18482
- // filter does not have a well-known type entry so keep it
18483
- updated.push(filter);
18484
- }
18485
- return updated;
18486
- }, []);
18487
- return filterGroup;
18488
- });
18489
- return result;
18490
- }
18491
18215
  /**
18492
18216
  * Is the argument a well-known type "key"
18493
18217
  *
@@ -18505,13 +18229,10 @@
18505
18229
  return result;
18506
18230
  }
18507
18231
  /**
18508
- * Fetch the array of fitlers from the well-known hash
18232
+ * Return the predicates for a well-known type
18509
18233
  * @param key
18510
18234
  * @returns
18511
18235
  */
18512
- function lookupTypeFilters(key) {
18513
- return WellKnownItemFilters[key];
18514
- }
18515
18236
  function lookupTypePredicates(key) {
18516
18237
  var rawPredicates = WellKnownItemFilters[key];
18517
18238
  // Remove the filterType property as it's not needed in an IPredicate
@@ -18723,61 +18444,6 @@
18723
18444
  return result;
18724
18445
  }
18725
18446
 
18726
- /**
18727
- * @private
18728
- * DEPRECATED: Use `portalSerchGroups`
18729
- * Portal Search Implementation for Groups
18730
- * @param filterGroups
18731
- * @param options
18732
- * @returns
18733
- */
18734
- function portalSearchGroupsFilterGroups(filterGroups, options) {
18735
- return __awaiter(this, void 0, void 0, function () {
18736
- var api, expandedGroups, so, props;
18737
- return __generator(this, function (_a) {
18738
- api = expandApi(options.api || "arcgis");
18739
- if (!options.requestOptions) {
18740
- if (options.authentication) {
18741
- // create minimal requestOptions
18742
- options.requestOptions = {
18743
- authentication: options.authentication,
18744
- portal: options.authentication.portal,
18745
- };
18746
- }
18747
- else {
18748
- options.requestOptions = {
18749
- portal: api.url + "/sharing/rest",
18750
- };
18751
- }
18752
- }
18753
- expandedGroups = filterGroups.map(function (fg) {
18754
- fg.filters = fg.filters.map(expandFilter);
18755
- return fg;
18756
- });
18757
- so = serializeFilterGroupsForPortal(expandedGroups);
18758
- props = [
18759
- "authentication",
18760
- "num",
18761
- "sortField",
18762
- "sortOrder",
18763
- "include",
18764
- "start",
18765
- "requestOptions",
18766
- ];
18767
- // copy the props over
18768
- props.forEach(function (prop) {
18769
- if (options.hasOwnProperty(prop)) {
18770
- so[prop] = options[prop];
18771
- }
18772
- });
18773
- // If we don't have auth, ensure we have .portal
18774
- if (!so.authentication) {
18775
- so.portal = so.requestOptions.portal || api.url + "/sharing/rest";
18776
- }
18777
- return [2 /*return*/, searchPortal$1(so)];
18778
- });
18779
- });
18780
- }
18781
18447
  /**
18782
18448
  * @private
18783
18449
  * Portal Search Implementation for Groups
@@ -18878,50 +18544,6 @@
18878
18544
  });
18879
18545
  }
18880
18546
 
18881
- /**
18882
- * @private
18883
- * DEPRECATED: Use `portalSearchUsers`
18884
- * Portal Search implementation for Users
18885
- * @param filterGroups
18886
- * @param options
18887
- */
18888
- function portalSearchUsersFilterGroups(filterGroups, options) {
18889
- return __awaiter(this, void 0, void 0, function () {
18890
- var expandedGroups, so, props;
18891
- return __generator(this, function (_a) {
18892
- // requestOptions is always required and user must be authd
18893
- if (!options.requestOptions) {
18894
- throw new HubError$1("portalSearchUsers", "requestOptions: IHubRequestOptions is required.");
18895
- }
18896
- if (!options.requestOptions.authentication) {
18897
- throw new HubError$1("portalSearchUsers", "requestOptions must pass authentication.");
18898
- }
18899
- expandedGroups = filterGroups.map(function (fg) {
18900
- fg.filters = fg.filters.map(expandFilter);
18901
- return fg;
18902
- });
18903
- so = serializeFilterGroupsForPortal(expandedGroups);
18904
- props = [
18905
- "num",
18906
- "sortField",
18907
- "sortOrder",
18908
- "include",
18909
- "start",
18910
- "requestOptions",
18911
- ];
18912
- // copy the props over
18913
- props.forEach(function (prop) {
18914
- if (options.hasOwnProperty(prop)) {
18915
- so[prop] = options[prop];
18916
- }
18917
- });
18918
- // Ensure authentication gets sent
18919
- so.authentication = options.requestOptions.authentication;
18920
- // Execute search
18921
- return [2 /*return*/, searchPortal(so)];
18922
- });
18923
- });
18924
- }
18925
18547
  /**
18926
18548
  * @private
18927
18549
  * Portal Search Implementation for Users
@@ -19024,7 +18646,10 @@
19024
18646
  }
19025
18647
 
19026
18648
  /**
19027
- * Main Search function for ArcGIS Hub
18649
+ * @private
18650
+ * TEMPORARY - this function only exists to allow incremental
18651
+ * changes and should be removed as soon as arcgis-hub-gallery
18652
+ * is changed to call `hubSearch(...)` directly
19028
18653
  *
19029
18654
  * Default's to search ArcGIS Portal but can delegate
19030
18655
  * to Hub API when it's available.
@@ -19032,41 +18657,11 @@
19032
18657
  * @param options
19033
18658
  * @returns
19034
18659
  */
19035
- function hubSearch(filterGroups, options) {
18660
+ function hubSearchQuery(query, options) {
19036
18661
  return __awaiter(this, void 0, void 0, function () {
19037
- var filterType, apiType, fnHash, fn;
19038
18662
  return __generator(this, function (_a) {
19039
- // Validate inputs
19040
- if (!filterGroups || !Array.isArray(filterGroups)) {
19041
- throw new HubError$1("hubSearch", "FilterGroups are required and must be an array.");
19042
- }
19043
- if (!filterGroups.length) {
19044
- throw new HubError$1("hubSearch", "FilterGrous array must contain at least one entry.");
19045
- }
19046
- if (!options.requestOptions) {
19047
- throw new HubError$1("hubSearch", "requestOptions: IHubRequestOptions is required.");
19048
- }
19049
- // Ensure includes is an array
19050
- if (!options.include) {
19051
- options.include = [];
19052
- }
19053
- filterType = filterGroups[0].filterType;
19054
- apiType = expandApi(options.api || "arcgis").type;
19055
- fnHash = {
19056
- arcgis: {
19057
- item: portalSearchItemsFilterGroups,
19058
- group: portalSearchGroupsFilterGroups,
19059
- user: portalSearchUsersFilterGroups,
19060
- },
19061
- "arcgis-hub": {
19062
- item: hubSearchItems,
19063
- },
19064
- };
19065
- fn = getProp(fnHash, apiType + "." + filterType);
19066
- if (!fn) {
19067
- throw new HubError$1("hubSearch", "Search via \"" + filterType + "\" filter against \"" + apiType + "\" api is not implemented");
19068
- }
19069
- return [2 /*return*/, fn(cloneObject$1(filterGroups), options)];
18663
+ // delegate
18664
+ return [2 /*return*/, hubSearch(query, options)];
19070
18665
  });
19071
18666
  });
19072
18667
  }
@@ -19079,7 +18674,7 @@
19079
18674
  * @param options
19080
18675
  * @returns
19081
18676
  */
19082
- function hubSearchQuery(query, options) {
18677
+ function hubSearch(query, options) {
19083
18678
  return __awaiter(this, void 0, void 0, function () {
19084
18679
  var filterType, apiType, fnHash, fn;
19085
18680
  return __generator(this, function (_a) {
@@ -20860,7 +20455,6 @@
20860
20455
  exports.expandApi = expandApi;
20861
20456
  exports.expandApis = expandApis;
20862
20457
  exports.expandContentFilter = expandContentFilter;
20863
- exports.expandFilter = expandFilter;
20864
20458
  exports.expandGroupFilter = expandGroupFilter;
20865
20459
  exports.expandTypeField = expandTypeField;
20866
20460
  exports.expandUserFilter = expandUserFilter;
@@ -20987,7 +20581,7 @@
20987
20581
  exports.mergeGroupFilters = mergeGroupFilters;
20988
20582
  exports.mergeMatchOptions = mergeMatchOptions;
20989
20583
  exports.mergeObjects = mergeObjects;
20990
- exports.mergeSearchOptions = mergeSearchOptions$2;
20584
+ exports.mergeSearchOptions = mergeSearchOptions$1;
20991
20585
  exports.mergeUserFilters = mergeUserFilters;
20992
20586
  exports.normalizeItemType = normalizeItemType;
20993
20587
  exports.normalizeSolutionTemplateItem = normalizeSolutionTemplateItem;
@@ -21012,13 +20606,12 @@
21012
20606
  exports.searchSites = searchSites;
21013
20607
  exports.serializeCollectionState = serializeCollectionState;
21014
20608
  exports.serializeContentFilterForPortal = serializeContentFilterForPortal;
21015
- exports.serializeDateRange = serializeDateRange$2;
21016
- exports.serializeFilterGroupsForPortal = serializeFilterGroupsForPortal;
20609
+ exports.serializeDateRange = serializeDateRange$1;
21017
20610
  exports.serializeGroupFilterForPortal = serializeGroupFilterForPortal;
21018
- exports.serializeMatchOptions = serializeMatchOptions$2;
20611
+ exports.serializeMatchOptions = serializeMatchOptions$1;
21019
20612
  exports.serializeModel = serializeModel;
21020
20613
  exports.serializeSpatialReference = serializeSpatialReference;
21021
- exports.serializeStringOrArray = serializeStringOrArray$2;
20614
+ exports.serializeStringOrArray = serializeStringOrArray$1;
21022
20615
  exports.serializeUserFilterForPortal = serializeUserFilterForPortal;
21023
20616
  exports.setContentHubId = setContentHubId;
21024
20617
  exports.setContentSiteUrls = setContentSiteUrls;