@esri/hub-common 17.19.0 → 17.20.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 (60) hide show
  1. package/dist/esm/hub-types.js.map +1 -1
  2. package/dist/esm/search/_internal/commonHelpers/getNextPortalCallback.js +22 -0
  3. package/dist/esm/search/_internal/commonHelpers/getNextPortalCallback.js.map +1 -0
  4. package/dist/esm/search/_internal/expandPredicate.js +3 -1
  5. package/dist/esm/search/_internal/expandPredicate.js.map +1 -1
  6. package/dist/esm/search/_internal/hubSearchItems.js +5 -3
  7. package/dist/esm/search/_internal/hubSearchItems.js.map +1 -1
  8. package/dist/esm/search/_internal/hubSearchItemsHelpers/getOgcCollectionUrl.js +1 -2
  9. package/dist/esm/search/_internal/hubSearchItemsHelpers/getOgcCollectionUrl.js.map +1 -1
  10. package/dist/esm/search/_internal/portalSearchGroupMembers.js +2 -2
  11. package/dist/esm/search/_internal/portalSearchGroupMembers.js.map +1 -1
  12. package/dist/esm/search/_internal/portalSearchGroups.js +3 -2
  13. package/dist/esm/search/_internal/portalSearchGroups.js.map +1 -1
  14. package/dist/esm/search/_internal/portalSearchItems.js +4 -25
  15. package/dist/esm/search/_internal/portalSearchItems.js.map +1 -1
  16. package/dist/esm/search/_internal/portalSearchUsers.js +3 -3
  17. package/dist/esm/search/_internal/portalSearchUsers.js.map +1 -1
  18. package/dist/esm/search/hubSearch.js +2 -2
  19. package/dist/esm/search/hubSearch.js.map +1 -1
  20. package/dist/esm/search/utils.js +2 -41
  21. package/dist/esm/search/utils.js.map +1 -1
  22. package/dist/esm/sites/_internal/applyCatalogStructureMigration.js +14 -5
  23. package/dist/esm/sites/_internal/applyCatalogStructureMigration.js.map +1 -1
  24. package/dist/esm/sites/_internal/applyDefaultCollectionMigration.js +10 -3
  25. package/dist/esm/sites/_internal/applyDefaultCollectionMigration.js.map +1 -1
  26. package/dist/node/hub-types.js.map +1 -1
  27. package/dist/node/search/_internal/commonHelpers/getNextPortalCallback.js +26 -0
  28. package/dist/node/search/_internal/commonHelpers/getNextPortalCallback.js.map +1 -0
  29. package/dist/node/search/_internal/expandPredicate.js +3 -1
  30. package/dist/node/search/_internal/expandPredicate.js.map +1 -1
  31. package/dist/node/search/_internal/hubSearchItems.js +5 -3
  32. package/dist/node/search/_internal/hubSearchItems.js.map +1 -1
  33. package/dist/node/search/_internal/hubSearchItemsHelpers/getOgcCollectionUrl.js +1 -2
  34. package/dist/node/search/_internal/hubSearchItemsHelpers/getOgcCollectionUrl.js.map +1 -1
  35. package/dist/node/search/_internal/portalSearchGroupMembers.js +4 -4
  36. package/dist/node/search/_internal/portalSearchGroupMembers.js.map +1 -1
  37. package/dist/node/search/_internal/portalSearchGroups.js +2 -1
  38. package/dist/node/search/_internal/portalSearchGroups.js.map +1 -1
  39. package/dist/node/search/_internal/portalSearchItems.js +4 -26
  40. package/dist/node/search/_internal/portalSearchItems.js.map +1 -1
  41. package/dist/node/search/_internal/portalSearchUsers.js +6 -6
  42. package/dist/node/search/_internal/portalSearchUsers.js.map +1 -1
  43. package/dist/node/search/hubSearch.js +2 -2
  44. package/dist/node/search/hubSearch.js.map +1 -1
  45. package/dist/node/search/utils.js +2 -42
  46. package/dist/node/search/utils.js.map +1 -1
  47. package/dist/node/sites/_internal/applyCatalogStructureMigration.js +14 -5
  48. package/dist/node/sites/_internal/applyCatalogStructureMigration.js.map +1 -1
  49. package/dist/node/sites/_internal/applyDefaultCollectionMigration.js +9 -2
  50. package/dist/node/sites/_internal/applyDefaultCollectionMigration.js.map +1 -1
  51. package/dist/types/content/_internal/internalContentUtils.d.ts +1 -1
  52. package/dist/types/content/get-family.d.ts +1 -1
  53. package/dist/types/hub-types.d.ts +0 -15
  54. package/dist/types/search/_internal/commonHelpers/getNextPortalCallback.d.ts +15 -0
  55. package/dist/types/search/_internal/portalSearchItems.d.ts +0 -11
  56. package/dist/types/search/types/IHubCatalog.d.ts +2 -12
  57. package/dist/types/search/types/IHubSearchResponse.d.ts +1 -1
  58. package/dist/types/search/utils.d.ts +2 -13
  59. package/dist/types/sites/_internal/applyCatalogStructureMigration.d.ts +0 -4
  60. package/package.json +1 -1
@@ -4,22 +4,31 @@ exports.applyCatalogStructureMigration = void 0;
4
4
  const get_with_default_1 = require("../../objects/get-with-default");
5
5
  const upgradeCatalogSchema_1 = require("../../search/upgradeCatalogSchema");
6
6
  const util_1 = require("../../util");
7
+ const get_prop_1 = require("../../objects/get-prop");
7
8
  /**
8
9
  * Add the default catalog structure to the Site model
9
- * Note: This in-memory migration is only applies via `fetchSite(..):IHubSite` and not
10
- * the older `getSiteById(...):IModel`. Changes made in this migration will not be
11
- * persisted to AGO until all other parts of the application stop relying on the legacy
12
- * catalog implementation
13
10
  * @param model
14
11
  * @returns
15
12
  */
16
13
  function applyCatalogStructureMigration(model) {
17
- const siteCatalog = get_with_default_1.getWithDefault(model.data, "catalog", {});
14
+ const siteCatalog = get_with_default_1.getWithDefault(model, "data.catalog", {});
18
15
  // This _shouldn't_ happen, but some of our testing sites might have this
19
16
  // migration already persisted in AGO. In that case, we ignore and move on
20
17
  if (!siteCatalog.schemaVersion) {
21
18
  const clonedModel = util_1.cloneObject(model);
22
19
  clonedModel.data.catalog = upgradeCatalogSchema_1.upgradeCatalogSchema(siteCatalog);
20
+ // The umbrella site needs a special predicate added to the catalog to ensure
21
+ // that its item scope only includes results shared to open data groups.
22
+ // We also don't want to include the groups from the site model
23
+ if (get_prop_1.getProp(clonedModel, "data.values.isUmbrella")) {
24
+ clonedModel.data.catalog.scopes.item.filters = [
25
+ {
26
+ predicates: [{ openData: true }],
27
+ },
28
+ ];
29
+ // The umbrella site doesn't have an event scope
30
+ clonedModel.data.catalog.scopes.event.filters = [];
31
+ }
23
32
  // applyCatalogSchema sets the catalog to `Default Catalog` but this fn previously
24
33
  // set it to `Default Site Catalog`. Overriding title to `Default Site Catalog` here
25
34
  // to prevent any potential regressions
@@ -1 +1 @@
1
- {"version":3,"file":"applyCatalogStructureMigration.js","sourceRoot":"","sources":["../../../../src/sites/_internal/applyCatalogStructureMigration.ts"],"names":[],"mappings":";;;AAAA,qEAAgE;AAChE,4EAAyE;AAEzE,qCAAyC;AAEzC;;;;;;;;GAQG;AACH,SAAgB,8BAA8B,CAAC,KAAa;IAC1D,MAAM,WAAW,GAAG,iCAAc,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;IAC9D,yEAAyE;IACzE,0EAA0E;IAC1E,IAAI,CAAC,WAAW,CAAC,aAAa,EAAE;QAC9B,MAAM,WAAW,GAAG,kBAAW,CAAC,KAAK,CAAC,CAAC;QACvC,WAAW,CAAC,IAAI,CAAC,OAAO,GAAG,2CAAoB,CAAC,WAAW,CAAC,CAAC;QAC7D,kFAAkF;QAClF,oFAAoF;QACpF,uCAAuC;QACvC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,sBAAsB,CAAC;QACxD,OAAO,WAAW,CAAC;KACpB;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAdD,wEAcC"}
1
+ {"version":3,"file":"applyCatalogStructureMigration.js","sourceRoot":"","sources":["../../../../src/sites/_internal/applyCatalogStructureMigration.ts"],"names":[],"mappings":";;;AAAA,qEAAgE;AAChE,4EAAyE;AAEzE,qCAAyC;AACzC,qDAAiD;AAGjD;;;;GAIG;AACH,SAAgB,8BAA8B,CAAC,KAAa;IAC1D,MAAM,WAAW,GAAG,iCAAc,CAAC,KAAK,EAAE,cAAc,EAAE,EAAE,CAG3D,CAAC;IACF,yEAAyE;IACzE,0EAA0E;IAC1E,IAAI,CAAC,WAAW,CAAC,aAAa,EAAE;QAC9B,MAAM,WAAW,GAAG,kBAAW,CAAC,KAAK,CAAC,CAAC;QACvC,WAAW,CAAC,IAAI,CAAC,OAAO,GAAG,2CAAoB,CAAC,WAAW,CAAC,CAAC;QAE7D,6EAA6E;QAC7E,wEAAwE;QACxE,+DAA+D;QAC/D,IAAI,kBAAO,CAAC,WAAW,EAAE,wBAAwB,CAAC,EAAE;YACjD,WAAW,CAAC,IAAI,CAAC,OAAuB,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,GAAG;gBAC9D;oBACE,UAAU,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;iBACjC;aACF,CAAC;YACF,gDAAgD;YAC/C,WAAW,CAAC,IAAI,CAAC,OAAuB,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC;SACrE;QAED,kFAAkF;QAClF,oFAAoF;QACpF,uCAAuC;QACtC,WAAW,CAAC,IAAI,CAAC,OAAuB,CAAC,KAAK,GAAG,sBAAsB,CAAC;QACzE,OAAO,WAAW,CAAC;KACpB;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AA/BD,wEA+BC"}
@@ -22,8 +22,15 @@ const searchCategoriesToCollections_1 = require("../searchCategoriesToCollection
22
22
  */
23
23
  function applyDefaultCollectionMigration(model) {
24
24
  const searchCategories = objects_1.getWithDefault(model.data, "values.searchCategories", undefined);
25
- model.data.catalog.collections =
26
- searchCategoriesToCollections_1.searchCategoriesToCollections(searchCategories);
25
+ const collections = searchCategoriesToCollections_1.searchCategoriesToCollections(searchCategories);
26
+ // The umbrella site needs to have every collection visible by default,
27
+ // unlike other sites that have the "site" collection hidden by default.
28
+ if (objects_1.getProp(model, "data.values.isUmbrella")) {
29
+ collections.forEach((c) => {
30
+ c.displayConfig.hidden = false;
31
+ });
32
+ }
33
+ objects_1.setProp("data.catalog.collections", collections, model);
27
34
  return model;
28
35
  }
29
36
  exports.applyDefaultCollectionMigration = applyDefaultCollectionMigration;
@@ -1 +1 @@
1
- {"version":3,"file":"applyDefaultCollectionMigration.js","sourceRoot":"","sources":["../../../../src/sites/_internal/applyDefaultCollectionMigration.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAE/C,oFAAiF;AAEjF;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,+BAA+B,CAAC,KAAa;IAC3D,MAAM,gBAAgB,GAAG,wBAAc,CACrC,KAAK,CAAC,IAAI,EACV,yBAAyB,EACzB,SAAS,CACV,CAAC;IACF,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW;QAC5B,6DAA6B,CAAC,gBAAgB,CAAC,CAAC;IAElD,OAAO,KAAK,CAAC;AACf,CAAC;AAVD,0EAUC"}
1
+ {"version":3,"file":"applyDefaultCollectionMigration.js","sourceRoot":"","sources":["../../../../src/sites/_internal/applyDefaultCollectionMigration.ts"],"names":[],"mappings":";;;AAAA,2CAAiE;AAEjE,oFAAiF;AAIjF;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,+BAA+B,CAAC,KAAa;IAC3D,MAAM,gBAAgB,GAAG,wBAAc,CACrC,KAAK,CAAC,IAAI,EACV,yBAAyB,EACzB,SAAS,CACY,CAAC;IAExB,MAAM,WAAW,GACf,6DAA6B,CAAC,gBAAgB,CAAC,CAAC;IAElD,uEAAuE;IACvE,wEAAwE;IACxE,IAAI,iBAAO,CAAC,KAAK,EAAE,wBAAwB,CAAC,EAAE;QAC5C,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACxB,CAAC,CAAC,aAAa,CAAC,MAAM,GAAG,KAAK,CAAC;QACjC,CAAC,CAAC,CAAC;KACJ;IAED,iBAAO,CAAC,0BAA0B,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;IAExD,OAAO,KAAK,CAAC;AACf,CAAC;AArBD,0EAqBC"}
@@ -44,7 +44,7 @@ export declare const setContentBoundary: (content: IHubContent, boundary: Geogra
44
44
  control?: import("../../hub-types").AccessControl;
45
45
  groups?: import("@esri/arcgis-rest-portal").IGroup[];
46
46
  };
47
- family?: "map" | "template" | "document" | "content" | "initiative" | "project" | "site" | "discussion" | "event" | "organization" | "channel" | "app" | "dataset" | "feedback" | "people" | "team" | "eventAttendee";
47
+ family?: "map" | "template" | "document" | "content" | "initiative" | "project" | "site" | "discussion" | "event" | "organization" | "channel" | "eventAttendee" | "app" | "dataset" | "feedback" | "people" | "team";
48
48
  categories?: string[];
49
49
  isDownloadable: boolean;
50
50
  structuredLicense?: import("../..").IStructuredLicense;
@@ -4,7 +4,7 @@ import { HubFamily } from "../hub-types";
4
4
  * @param type item type
5
5
  * @returns Hub family
6
6
  */
7
- export declare function getFamily(type: string): "map" | "template" | "document" | "content" | "initiative" | "project" | "site" | "discussion" | "event" | "organization" | "channel" | "app" | "dataset" | "feedback" | "people" | "team" | "eventAttendee";
7
+ export declare function getFamily(type: string): "map" | "template" | "document" | "content" | "initiative" | "project" | "site" | "discussion" | "event" | "organization" | "channel" | "eventAttendee" | "app" | "dataset" | "feedback" | "people" | "team";
8
8
  /**
9
9
  * return the types associated with a provided Hub Family
10
10
  * Overrides are provided to match getFamily implementation
@@ -283,21 +283,6 @@ export interface IHubTeam extends IGroup {
283
283
  [key: string]: any;
284
284
  };
285
285
  }
286
- /**
287
- * Defines a generic search response interface with parameterized result type
288
- * for different types of searches
289
- *
290
- * total - total number of results
291
- * results - potentially paginated list of results
292
- * hasNext - boolean flag for if there are any more pages ofresults
293
- * next - invokable function for obtaining next page of results
294
- */
295
- export interface ISearchResponse<T> {
296
- total: number;
297
- results: T[];
298
- hasNext: boolean;
299
- next: (params?: any) => Promise<ISearchResponse<T>>;
300
- }
301
286
  /**
302
287
  * BEGIN CONTENT UPLOAD RELATED TYPES
303
288
  * Please note that the below enum/types are duplicated from the AGO
@@ -0,0 +1,15 @@
1
+ import { IRequestOptions } from "@esri/arcgis-rest-request";
2
+ import { IHubSearchResponse } from "../../types/IHubSearchResponse";
3
+ import { IPagingParams } from "@esri/arcgis-rest-portal";
4
+ declare type ICommonNextOptions = IRequestOptions & IPagingParams;
5
+ /**
6
+ * @private
7
+ * Create a `.next()` function for portal search type
8
+ * @param request
9
+ * @param nextStart
10
+ * @param total
11
+ * @param fn
12
+ * @returns
13
+ */
14
+ export declare function getNextPortalCallback<I extends ICommonNextOptions, O>(request: I, nextStart: number, total: number, fn: (r: I) => Promise<IHubSearchResponse<O>>): () => Promise<IHubSearchResponse<O>>;
15
+ export {};
@@ -48,17 +48,6 @@ interface IWellKnownItemPredicates {
48
48
  $page: IPredicate[];
49
49
  }
50
50
  export declare const WellKnownItemPredicates: IWellKnownItemPredicates;
51
- /**
52
- * @private
53
- * Add filter blocks from a well-known item collection if indicated.
54
- * This is meant to simplify query construction for common use cases.
55
- *
56
- * Only exported for testing.
57
- *
58
- * @param query query to add collection filters to
59
- * @returns a copy of the query with the additional filters
60
- */
61
- export declare function applyWellKnownCollectionFilters(query: IQuery): IQuery;
62
51
  /**
63
52
  * @private
64
53
  * Convert a Filter Group to expand well-known type filters
@@ -1,5 +1,4 @@
1
1
  import { CARD_TITLE_TAGS, CORNERS, DROP_SHADOWS } from "../../core/schemas/shared/enums";
2
- import { WellKnownCollection } from "../wellKnownCatalog";
3
2
  export declare type CatalogType = "content" | "exclusion";
4
3
  export interface IHubCatalog {
5
4
  /**
@@ -38,10 +37,8 @@ export interface IHubCatalog {
38
37
  */
39
38
  displayConfig?: ICatalogDisplayConfig;
40
39
  }
41
- export interface ICatalogScope extends Partial<Record<EntityType, IQuery>> {
42
- }
43
- export interface ICatalogDisplayConfig extends Partial<Record<EntityType, IGalleryDisplayConfig>> {
44
- }
40
+ export declare type ICatalogScope = Partial<Record<EntityType, IQuery>>;
41
+ export declare type ICatalogDisplayConfig = Partial<Record<EntityType, IGalleryDisplayConfig>>;
45
42
  export interface IHubCollection {
46
43
  /**
47
44
  * String to show in the UI. translated.
@@ -91,13 +88,6 @@ export interface IQuery {
91
88
  * ensure we query the correct API
92
89
  */
93
90
  targetEntity: EntityType;
94
- /**
95
- * An id for a well known collection that the query should use.
96
- *
97
- * Note: The collection's filters will be used _in addition_ to
98
- * any existing filters within the IQuery.filters array
99
- */
100
- collection?: WellKnownCollection;
101
91
  /**
102
92
  * Filters that make up the query
103
93
  */
@@ -26,7 +26,7 @@ export interface IHubSearchResponse<T> {
26
26
  /**
27
27
  * Function that fetches the next page of results
28
28
  */
29
- next: (params?: any) => Promise<IHubSearchResponse<T>>;
29
+ next: () => Promise<IHubSearchResponse<T>>;
30
30
  /**
31
31
  * Array of requested aggregations
32
32
  */
@@ -1,7 +1,6 @@
1
- import { IUser, ArcGISIdentityManager } from "@esri/arcgis-rest-request";
2
- import { IGroup, ISearchGroupUsersOptions, ISearchOptions, SearchQueryBuilder } from "@esri/arcgis-rest-portal";
1
+ import { IUser } from "@esri/arcgis-rest-request";
2
+ import { IGroup, SearchQueryBuilder } from "@esri/arcgis-rest-portal";
3
3
  import { IHubSite } from "../core";
4
- import { ISearchResponse } from "../hub-types";
5
4
  import { IHubSearchResult } from "./types";
6
5
  import { IPredicate, IQuery } from "./types/IHubCatalog";
7
6
  import { IMatchOptions, IDateRange, IRelativeDate, IWellKnownApis, IApiDefinition, NamedApis, Kilobyte } from "./types/types";
@@ -41,16 +40,6 @@ export declare function valueToMatchOptions(value: string | string[] | IMatchOpt
41
40
  * @returns
42
41
  */
43
42
  export declare function relativeDateToDateRange(relative: IRelativeDate): IDateRange<number>;
44
- /**
45
- * @private
46
- * Create a `.next()` function for a type
47
- * @param request
48
- * @param nextStart
49
- * @param total
50
- * @param fn
51
- * @returns
52
- */
53
- export declare function getNextFunction<T>(request: ISearchOptions | ISearchGroupUsersOptions, nextStart: number, total: number, fn: (r: any) => Promise<ISearchResponse<T>>): (authentication?: ArcGISIdentityManager) => Promise<ISearchResponse<T>>;
54
43
  /**
55
44
  * Construct a the full url to a group thumbnail
56
45
  *
@@ -1,10 +1,6 @@
1
1
  import { IModel } from "../../hub-types";
2
2
  /**
3
3
  * Add the default catalog structure to the Site model
4
- * Note: This in-memory migration is only applies via `fetchSite(..):IHubSite` and not
5
- * the older `getSiteById(...):IModel`. Changes made in this migration will not be
6
- * persisted to AGO until all other parts of the application stop relying on the legacy
7
- * catalog implementation
8
4
  * @param model
9
5
  * @returns
10
6
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/hub-common",
3
- "version": "17.19.0",
3
+ "version": "17.20.0",
4
4
  "description": "Common TypeScript types and utility functions for @esri/hub.js.",
5
5
  "main": "dist/node/index.js",
6
6
  "module": "dist/esm/index.js",