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