@esri/hub-common 13.18.0 → 13.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 (120) hide show
  1. package/dist/esm/capabilities/_internal/checkCapabilityAccess.js.map +1 -1
  2. package/dist/esm/capabilities/checkCapability.js.map +1 -1
  3. package/dist/esm/capabilities/types.js +1 -0
  4. package/dist/esm/capabilities/types.js.map +1 -1
  5. package/dist/esm/core/fetchHubEntity.js +3 -1
  6. package/dist/esm/core/fetchHubEntity.js.map +1 -1
  7. package/dist/esm/core/getTypeFromEntity.js.map +1 -1
  8. package/dist/esm/core/schemas/getEntityEditorSchemas.js +9 -0
  9. package/dist/esm/core/schemas/getEntityEditorSchemas.js.map +1 -1
  10. package/dist/esm/core/updateHubEntity.js +5 -0
  11. package/dist/esm/core/updateHubEntity.js.map +1 -1
  12. package/dist/esm/initiatives/_internal/InitiativeBusinessRules.js +6 -0
  13. package/dist/esm/initiatives/_internal/InitiativeBusinessRules.js.map +1 -1
  14. package/dist/esm/pages/HubPage.js +137 -0
  15. package/dist/esm/pages/HubPage.js.map +1 -0
  16. package/dist/esm/pages/HubPages.js +116 -2
  17. package/dist/esm/pages/HubPages.js.map +1 -1
  18. package/dist/esm/pages/_internal/PageBusinessRules.js +80 -0
  19. package/dist/esm/pages/_internal/PageBusinessRules.js.map +1 -1
  20. package/dist/esm/pages/_internal/PageSchema.js +31 -0
  21. package/dist/esm/pages/_internal/PageSchema.js.map +1 -0
  22. package/dist/esm/pages/_internal/PageUiSchemaEdit.js +100 -0
  23. package/dist/esm/pages/_internal/PageUiSchemaEdit.js.map +1 -0
  24. package/dist/esm/pages/_internal/computeProps.js +31 -0
  25. package/dist/esm/pages/_internal/computeProps.js.map +1 -0
  26. package/dist/esm/pages/_internal/getPropertyMap.js +20 -0
  27. package/dist/esm/pages/_internal/getPropertyMap.js.map +1 -0
  28. package/dist/esm/pages/defaults.js +41 -0
  29. package/dist/esm/pages/defaults.js.map +1 -0
  30. package/dist/esm/pages/index.js +1 -0
  31. package/dist/esm/pages/index.js.map +1 -1
  32. package/dist/esm/permissions/types/Permission.js +2 -0
  33. package/dist/esm/permissions/types/Permission.js.map +1 -1
  34. package/dist/esm/projects/_internal/ProjectBusinessRules.js +6 -0
  35. package/dist/esm/projects/_internal/ProjectBusinessRules.js.map +1 -1
  36. package/dist/esm/sites/HubSites.js +13 -4
  37. package/dist/esm/sites/HubSites.js.map +1 -1
  38. package/dist/esm/sites/_internal/SiteBusinessRules.js +6 -0
  39. package/dist/esm/sites/_internal/SiteBusinessRules.js.map +1 -1
  40. package/dist/esm/sites/_internal/applyCatalogStructureMigration.js +39 -0
  41. package/dist/esm/sites/_internal/applyCatalogStructureMigration.js.map +1 -0
  42. package/dist/esm/sites/_internal/applyDefaultCollectionMigration.js +88 -0
  43. package/dist/esm/sites/_internal/applyDefaultCollectionMigration.js.map +1 -0
  44. package/dist/esm/sites/_internal/computeProps.js +2 -2
  45. package/dist/esm/sites/_internal/computeProps.js.map +1 -1
  46. package/dist/esm/sites/_internal/getPropertyMap.js +1 -6
  47. package/dist/esm/sites/_internal/getPropertyMap.js.map +1 -1
  48. package/dist/node/capabilities/_internal/checkCapabilityAccess.js.map +1 -1
  49. package/dist/node/capabilities/checkCapability.js.map +1 -1
  50. package/dist/node/capabilities/types.js +1 -0
  51. package/dist/node/capabilities/types.js.map +1 -1
  52. package/dist/node/core/fetchHubEntity.js +3 -1
  53. package/dist/node/core/fetchHubEntity.js.map +1 -1
  54. package/dist/node/core/getTypeFromEntity.js.map +1 -1
  55. package/dist/node/core/schemas/getEntityEditorSchemas.js +9 -0
  56. package/dist/node/core/schemas/getEntityEditorSchemas.js.map +1 -1
  57. package/dist/node/core/updateHubEntity.js +5 -0
  58. package/dist/node/core/updateHubEntity.js.map +1 -1
  59. package/dist/node/initiatives/_internal/InitiativeBusinessRules.js +6 -0
  60. package/dist/node/initiatives/_internal/InitiativeBusinessRules.js.map +1 -1
  61. package/dist/node/pages/HubPage.js +141 -0
  62. package/dist/node/pages/HubPage.js.map +1 -0
  63. package/dist/node/pages/HubPages.js +120 -1
  64. package/dist/node/pages/HubPages.js.map +1 -1
  65. package/dist/node/pages/_internal/PageBusinessRules.js +81 -1
  66. package/dist/node/pages/_internal/PageBusinessRules.js.map +1 -1
  67. package/dist/node/pages/_internal/PageSchema.js +34 -0
  68. package/dist/node/pages/_internal/PageSchema.js.map +1 -0
  69. package/dist/node/pages/_internal/PageUiSchemaEdit.js +103 -0
  70. package/dist/node/pages/_internal/PageUiSchemaEdit.js.map +1 -0
  71. package/dist/node/pages/_internal/computeProps.js +35 -0
  72. package/dist/node/pages/_internal/computeProps.js.map +1 -0
  73. package/dist/node/pages/_internal/getPropertyMap.js +24 -0
  74. package/dist/node/pages/_internal/getPropertyMap.js.map +1 -0
  75. package/dist/node/pages/defaults.js +44 -0
  76. package/dist/node/pages/defaults.js.map +1 -0
  77. package/dist/node/pages/index.js +1 -0
  78. package/dist/node/pages/index.js.map +1 -1
  79. package/dist/node/permissions/types/Permission.js +2 -0
  80. package/dist/node/permissions/types/Permission.js.map +1 -1
  81. package/dist/node/projects/_internal/ProjectBusinessRules.js +6 -0
  82. package/dist/node/projects/_internal/ProjectBusinessRules.js.map +1 -1
  83. package/dist/node/sites/HubSites.js +13 -4
  84. package/dist/node/sites/HubSites.js.map +1 -1
  85. package/dist/node/sites/_internal/SiteBusinessRules.js +6 -0
  86. package/dist/node/sites/_internal/SiteBusinessRules.js.map +1 -1
  87. package/dist/node/sites/_internal/applyCatalogStructureMigration.js +43 -0
  88. package/dist/node/sites/_internal/applyCatalogStructureMigration.js.map +1 -0
  89. package/dist/node/sites/_internal/applyDefaultCollectionMigration.js +92 -0
  90. package/dist/node/sites/_internal/applyDefaultCollectionMigration.js.map +1 -0
  91. package/dist/node/sites/_internal/computeProps.js +2 -2
  92. package/dist/node/sites/_internal/computeProps.js.map +1 -1
  93. package/dist/node/sites/_internal/getPropertyMap.js +1 -6
  94. package/dist/node/sites/_internal/getPropertyMap.js.map +1 -1
  95. package/dist/types/capabilities/_internal/checkCapabilityAccess.d.ts +2 -2
  96. package/dist/types/capabilities/checkCapability.d.ts +2 -2
  97. package/dist/types/capabilities/types.d.ts +1 -1
  98. package/dist/types/core/getTypeFromEntity.d.ts +2 -2
  99. package/dist/types/core/schemas/getEntityEditorSchemas.d.ts +1 -1
  100. package/dist/types/core/types/IHubPage.d.ts +2 -2
  101. package/dist/types/pages/HubPage.d.ts +59 -0
  102. package/dist/types/pages/HubPages.d.ts +44 -1
  103. package/dist/types/pages/_internal/PageBusinessRules.d.ts +27 -0
  104. package/dist/types/pages/_internal/PageSchema.d.ts +7 -0
  105. package/dist/types/pages/_internal/PageUiSchemaEdit.d.ts +7 -0
  106. package/dist/types/pages/_internal/computeProps.d.ts +12 -0
  107. package/dist/types/pages/_internal/getPropertyMap.d.ts +8 -0
  108. package/dist/types/pages/defaults.d.ts +13 -0
  109. package/dist/types/pages/index.d.ts +1 -0
  110. package/dist/types/permissions/types/Permission.d.ts +1 -1
  111. package/dist/types/search/types/IHubCatalog.d.ts +10 -0
  112. package/dist/types/sites/HubSites.d.ts +1 -1
  113. package/dist/types/sites/_internal/applyCatalogStructureMigration.d.ts +11 -0
  114. package/dist/types/sites/_internal/applyDefaultCollectionMigration.d.ts +21 -0
  115. package/package.json +1 -1
  116. package/dist/esm/sites/_internal/catalogMigration.js +0 -50
  117. package/dist/esm/sites/_internal/catalogMigration.js.map +0 -1
  118. package/dist/node/sites/_internal/catalogMigration.js +0 -54
  119. package/dist/node/sites/_internal/catalogMigration.js.map +0 -1
  120. package/dist/types/sites/_internal/catalogMigration.d.ts +0 -9
@@ -1,5 +1,5 @@
1
1
  import { Capability, ICapabilityAccessResponse } from "./types";
2
- import { IArcGISContext, HubEntity } from "../index";
2
+ import { IArcGISContext, HubEntity, IHubItemEntity } from "../index";
3
3
  /**
4
4
  * Check if a capability is enabled for a given entity and if the current user has necessary permissions to access it
5
5
  * @param capability
@@ -7,4 +7,4 @@ import { IArcGISContext, HubEntity } from "../index";
7
7
  * @param entity
8
8
  * @returns
9
9
  */
10
- export declare function checkCapability(capability: Capability, context: IArcGISContext, entity: HubEntity): ICapabilityAccessResponse;
10
+ export declare function checkCapability(capability: Capability, context: IArcGISContext, entity: IHubItemEntity | HubEntity): ICapabilityAccessResponse;
@@ -3,7 +3,7 @@ import { IAccessResponse } from "../core/types/IAccessResponse";
3
3
  /**
4
4
  * Hub System Capabilities
5
5
  */
6
- declare const validCapabilities: readonly ["collaboration", "details", "discussions", "events", "followers", "overview", "settings", "teams", "metrics"];
6
+ declare const validCapabilities: readonly ["collaboration", "details", "discussions", "events", "followers", "overview", "settings", "teams", "metrics", "content"];
7
7
  /**
8
8
  * Defines the possible values for Capability
9
9
  */
@@ -1,7 +1,7 @@
1
- import { HubEntity, HubEntityType } from "./types";
1
+ import { HubEntity, IHubItemEntity, HubEntityType } from "./types";
2
2
  /**
3
3
  * Given a HubEntity, return it's HubEntityType
4
4
  * @param entity
5
5
  * @returns
6
6
  */
7
- export declare function getTypeFromEntity(entity: HubEntity): HubEntityType;
7
+ export declare function getTypeFromEntity(entity: IHubItemEntity | HubEntity): HubEntityType;
@@ -5,7 +5,7 @@ import { UiSchemaElementOptions } from "./types";
5
5
  * to the supported/defined uiSchema configurations
6
6
  */
7
7
  export declare type EditorType = (typeof validEditorTypes)[number];
8
- export declare const validEditorTypes: readonly ["hub:project:create", "hub:project:edit", "hub:initiative:edit", "hub:site:edit", "hub:discussion:edit", "hub:discussion:create"];
8
+ export declare const validEditorTypes: readonly ["hub:project:create", "hub:project:edit", "hub:initiative:edit", "hub:site:edit", "hub:discussion:edit", "hub:discussion:create", "hub:page:edit"];
9
9
  /**
10
10
  * get the editor schema and uiSchema defined for an entity.
11
11
  * The schema and uiSchema that are returned can be used to
@@ -1,8 +1,8 @@
1
- import { IWithLayout } from "../traits/IWithLayout";
2
1
  import { IHubItemEntity } from "./IHubItemEntity";
2
+ import { IWithLayout, IWithPermissions, IWithSlug } from "../traits";
3
3
  /**
4
4
  * DRAFT: Under development and more properties will likely be added
5
5
  * @internal
6
6
  */
7
- export interface IHubPage extends IHubItemEntity, IWithLayout {
7
+ export interface IHubPage extends IHubItemEntity, IWithLayout, IWithPermissions, IWithSlug {
8
8
  }
@@ -0,0 +1,59 @@
1
+ import { IHubPage, IWithStoreBehavior, IWithSharingBehavior, UiSchemaElementOptions } from "../core";
2
+ import { IArcGISContext } from "../ArcGISContext";
3
+ import { HubItemEntity } from "../core/HubItemEntity";
4
+ import { IEditorConfig } from "../core/behaviors/IWithEditorBehavior";
5
+ import { PageEditorType } from "./_internal/PageSchema";
6
+ /**
7
+ * Hub Page Class
8
+ * NOTE: This is a minimal implementation.
9
+ */
10
+ export declare class HubPage extends HubItemEntity<IHubPage> implements IWithStoreBehavior<IHubPage>, IWithSharingBehavior {
11
+ /**
12
+ * Private constructor so we don't have `new` all over the place. Allows for
13
+ * more flexibility in how we create the HubPageManager over time.
14
+ * @param context
15
+ */
16
+ private constructor();
17
+ /**
18
+ * Create an instance from an IHubPage object
19
+ * @param json - JSON object to create a HubPage from
20
+ * @param context - ArcGIS context
21
+ * @returns
22
+ */
23
+ static fromJson(json: Partial<IHubPage>, context: IArcGISContext): HubPage;
24
+ /**
25
+ *
26
+ * Create a new HubPage, returning a HubPage instance.
27
+ * By default, this does not save the page to the backing store.
28
+ * @param partialPage
29
+ * @param context
30
+ * @returns
31
+ */
32
+ static create(partialPage: Partial<IHubPage>, context: IArcGISContext, save?: boolean): Promise<HubPage>;
33
+ /**
34
+ * Fetch a Page from the backing store and return a HubPage instance.
35
+ * @param identifier - Identifier of the page to load
36
+ * @param context
37
+ * @returns
38
+ */
39
+ static fetch(identifier: string, context: IArcGISContext): Promise<HubPage>;
40
+ static getEditorConfig(i18nScope: string, type: PageEditorType, options?: UiSchemaElementOptions[]): Promise<IEditorConfig>;
41
+ private static applyDefaults;
42
+ /**
43
+ * Apply a new state to the instance
44
+ * @param changes
45
+ */
46
+ update(changes: Partial<IHubPage>): void;
47
+ /**
48
+ * Save the HubPage to the backing store.
49
+ * Currently Pages are stored as Items in Portal
50
+ * @returns
51
+ */
52
+ save(): Promise<void>;
53
+ /**
54
+ * Delete the HubPage from the store
55
+ * set a flag to indicate that it is destroyed
56
+ * @returns
57
+ */
58
+ delete(): Promise<void>;
59
+ }
@@ -1,6 +1,49 @@
1
- import { IItem } from "@esri/arcgis-rest-types";
2
1
  import { IHubSearchResult } from "../search";
3
2
  import { IHubRequestOptions } from "../types";
3
+ import { IRequestOptions } from "@esri/arcgis-rest-request";
4
+ import { IItem } from "@esri/arcgis-rest-portal";
5
+ import { IHubPage } from "../core";
6
+ import { IUserRequestOptions } from "@esri/arcgis-rest-auth";
7
+ /**
8
+ * @private
9
+ * Create a new Hub Page item
10
+ *
11
+ * Minimal properties are name and org
12
+ *
13
+ * @param partialPage
14
+ * @param requestOptions
15
+ */
16
+ export declare function createPage(partialPage: Partial<IHubPage>, requestOptions: IUserRequestOptions): Promise<IHubPage>;
17
+ /**
18
+ * @private
19
+ * Update a Hub Page
20
+ * @param page
21
+ * @param requestOptions
22
+ */
23
+ export declare function updatePage(page: IHubPage, requestOptions: IUserRequestOptions): Promise<IHubPage>;
24
+ /**
25
+ * @private
26
+ * Get a Hub Page by id or slug
27
+ * @param identifier item id or slug
28
+ * @param requestOptions
29
+ */
30
+ export declare function fetchPage(identifier: string, requestOptions: IRequestOptions): Promise<IHubPage>;
31
+ /**
32
+ * @private
33
+ * Convert an Hub Page Item into a Hub Page, fetching any additional
34
+ * information that may be required
35
+ * @param item
36
+ * @param auth
37
+ * @returns
38
+ */
39
+ export declare function convertItemToPage(item: IItem, requestOptions: IRequestOptions): Promise<IHubPage>;
40
+ /**
41
+ * @private
42
+ * Remove a Hub Page
43
+ * @param id
44
+ * @param requestOptions
45
+ */
46
+ export declare function deletePage(id: string, requestOptions: IUserRequestOptions): Promise<void>;
4
47
  /**
5
48
  * Fetch Page specific Enrichments
6
49
  * @param item
@@ -1,3 +1,30 @@
1
+ import { EntityCapabilities, ICapabilityPermission } from "../../capabilities";
2
+ import { IPermissionPolicy } from "../../permissions";
3
+ /**
4
+ * Default capabilities for a Page. If not listed here, the capability will not be available
5
+ * This hash is combined with the capabilities hash stored in the item data. Regardless of what
6
+ * properties are defined in the item data, only the capabilities defined here will be available
7
+ * @private
8
+ */
9
+ export declare const PageDefaultCapabilities: EntityCapabilities;
10
+ /**
11
+ * List of all the Page Capability Permissions
12
+ * These are considered Hub Business Rules and are not intended
13
+ * to be modified by consumers
14
+ * @private
15
+ */
16
+ export declare const PageCapabilityPermissions: ICapabilityPermission[];
17
+ /**
18
+ * Page Permission Policies
19
+ * These define the requirements any user must meet to perform related actions
20
+ * @private
21
+ */
22
+ export declare const PagePermissions: readonly ["hub:page:create", "hub:page:delete", "hub:page:edit", "hub:page:view"];
23
+ /**
24
+ * Page permission policies
25
+ * @private
26
+ */
27
+ export declare const PagePermissionPolicies: IPermissionPolicy[];
1
28
  /**
2
29
  * Page versioning include list
3
30
  */
@@ -0,0 +1,7 @@
1
+ import { IConfigurationSchema } from "../../core";
2
+ export declare const PageEditorTypes: readonly ["hub:page:edit"];
3
+ export declare type PageEditorType = (typeof PageEditorTypes)[number];
4
+ /**
5
+ * defines the JSON schema for a Hub Site's editable fields
6
+ */
7
+ export declare const PageSchema: IConfigurationSchema;
@@ -0,0 +1,7 @@
1
+ import { IUiSchema } from "../../core";
2
+ /**
3
+ * complete edit uiSchema for Hub Projects - this defines
4
+ * how the schema properties should be rendered in the
5
+ * project editing experience
6
+ */
7
+ export declare const uiSchema: IUiSchema;
@@ -0,0 +1,12 @@
1
+ import { IRequestOptions } from "@esri/arcgis-rest-request";
2
+ import { IHubPage } from "../../core";
3
+ import { IModel } from "../../types";
4
+ /**
5
+ * Given a model and a page, set various computed properties that can't be directly mapped
6
+ * @private
7
+ * @param model
8
+ * @param page
9
+ * @param requestOptions
10
+ * @returns
11
+ */
12
+ export declare function computeProps(model: IModel, page: Partial<IHubPage>, requestOptions: IRequestOptions): IHubPage;
@@ -0,0 +1,8 @@
1
+ import { IPropertyMap } from "../../core/_internal/PropertyMapper";
2
+ /**
3
+ * Returns an Array of IPropertyMap objects
4
+ * that define the projection of properties from a IModel to an IHubPage
5
+ * @returns
6
+ * @private
7
+ */
8
+ export declare function getPropertyMap(): IPropertyMap[];
@@ -0,0 +1,13 @@
1
+ import { IHubPage } from "../core";
2
+ import { IModel } from "../types";
3
+ export declare const HUB_PAGE_ITEM_TYPE = "Hub Page";
4
+ export declare const ENTERPRISE_PAGE_ITEM_TYPE = "Site Page";
5
+ export declare const PAGE_TYPE_KEYWORD = "hubPage";
6
+ /**
7
+ * Default values of a IHubPage
8
+ */
9
+ export declare const DEFAULT_PAGE: Partial<IHubPage>;
10
+ /**
11
+ * Default values for a new HubPage Model
12
+ */
13
+ export declare const DEFAULT_PAGE_MODEL: IModel;
@@ -1 +1,2 @@
1
1
  export * from "./HubPages";
2
+ export * from "./HubPage";
@@ -3,7 +3,7 @@
3
3
  * It's critical that the arrays defined in the modules use `as const`
4
4
  * otherwise Permission devolves into just a string type
5
5
  */
6
- declare const validPermissions: readonly ["hub:site:create", "hub:site:delete", "hub:site:edit", "hub:site:view", "hub:project:create", "hub:project:delete", "hub:project:edit", "hub:project:view", "hub:project:owner", "hub:initiative:create", "hub:initiative:delete", "hub:initiative:edit", "hub:initiative:view", "hub:discussion:create", "hub:discussion:delete", "hub:discussion:edit", "hub:discussion:view", "hub:content:create", "hub:content:edit", "hub:content:view"];
6
+ declare const validPermissions: readonly ["hub:site:create", "hub:site:delete", "hub:site:edit", "hub:site:view", "hub:project:create", "hub:project:delete", "hub:project:edit", "hub:project:view", "hub:project:owner", "hub:initiative:create", "hub:initiative:delete", "hub:initiative:edit", "hub:initiative:view", "hub:discussion:create", "hub:discussion:delete", "hub:discussion:edit", "hub:discussion:view", "hub:content:create", "hub:content:edit", "hub:content:view", "hub:page:create", "hub:page:delete", "hub:page:edit", "hub:page:view"];
7
7
  /**
8
8
  * Defines the possible values for Permissions
9
9
  */
@@ -50,6 +50,16 @@ export interface IHubCollection {
50
50
  */
51
51
  targetEntity: EntityType;
52
52
  }
53
+ /**
54
+ * @private
55
+ *
56
+ * This interface wraps IHubCollection and provides additional fields
57
+ * for collection configuration. It is the actual interface used when
58
+ * when storing an entity's catalog collections.
59
+ */
60
+ export interface IHubCollectionPersistance extends IHubCollection {
61
+ hidden?: boolean;
62
+ }
53
63
  export declare type EntityType = "item" | "group" | "user" | "groupMember" | "event";
54
64
  /**
55
65
  * IQuery is the fundamental unit used to execute a search. By composing
@@ -56,7 +56,7 @@ export declare function convertModelToSite(model: IModel, requestOptions: IReque
56
56
  * @param requestOptions
57
57
  * @returns
58
58
  */
59
- export declare function convertSiteToModel(site: IHubSite, requestOptions: IRequestOptions): IModel;
59
+ export declare function convertSiteToModel(site: IHubSite, _requestOptions: IRequestOptions): IModel;
60
60
  /**
61
61
  * Convert a Hub Site Application item into a Hub Site, fetching any
62
62
  * additional information that may be required
@@ -0,0 +1,11 @@
1
+ import { IModel } from "../../types";
2
+ /**
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
+ * @param model
9
+ * @returns
10
+ */
11
+ export declare function applyCatalogStructureMigration(model: IModel): IModel;
@@ -0,0 +1,21 @@
1
+ import { IModel } from "../../types";
2
+ /**
3
+ * In-Memory migration that adds default collections to site models that have the
4
+ * new catalog structure. These default collections will have the same names and
5
+ * display order found in `site.data.values.searchCategories`
6
+ *
7
+ * This migration simplifies display logic, as consuming components no longer
8
+ * have to merge `catalog.collections` with the default collection definitions.
9
+ *
10
+ * This migration also lays the foundation for customization, since editors will
11
+ * be able to modify these persisted default objects. For example, editors can
12
+ * change the default labels, display order, or mark a default as "hidden" so the
13
+ * public can't see it.
14
+ *
15
+ * NOTE: The changes made in this migration will not be persisted to AGO at this time
16
+ *
17
+ * @param model site model to migrate
18
+ * @returns a migrated model with default `IHubCollectionPersistance` objects added
19
+ * to the catalog
20
+ */
21
+ export declare function applyDefaultCollectionMigration(model: IModel): IModel;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/hub-common",
3
- "version": "13.18.0",
3
+ "version": "13.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",
@@ -1,50 +0,0 @@
1
- import { getProp } from "../../objects/get-prop";
2
- /**
3
- * Add the default catalog and collections to the Site model
4
- * Note: This migration is only applies via `fetchSite(..):IHubSite` and not
5
- * the older `getSiteById(...):IModel`
6
- * @param model
7
- * @returns
8
- */
9
- export function catalogMigration(model) {
10
- if (getProp(model, "item.properties.schemaVersion") >= 1.7) {
11
- return model;
12
- }
13
- else {
14
- let siteCatalog = model.data.catalog || {};
15
- if (!siteCatalog.hasOwnProperty("schemaVersion")) {
16
- const groups = siteCatalog.groups || [];
17
- siteCatalog = {
18
- schemaVersion: 1,
19
- title: "Default Site Catalog",
20
- scopes: {
21
- item: {
22
- targetEntity: "item",
23
- filters: [],
24
- },
25
- },
26
- collections: [],
27
- };
28
- // groups are used to set the item scope for the whole catalog
29
- siteCatalog.scopes.item.filters.push({
30
- predicates: [
31
- {
32
- group: [...groups],
33
- },
34
- ],
35
- });
36
- // in order to not break existing code, we need store the
37
- // new catalog on `data.catalogv2` and leave old catalog on `data.catalog`
38
- // The property mapper will expose this as `catalog` on the IHubSite
39
- // and re-map it back to `data.catalogv2` when saving
40
- // This is only done if the data.catalog does not have `schemaVersion`
41
- // property. At some point we will deprecate the old catalog
42
- // remove the mappings, and save the catalog directly to `data.catalog`
43
- model.data.catalogv2 = siteCatalog;
44
- }
45
- // set the schema version
46
- model.item.properties.schemaVersion = 1.7;
47
- return model;
48
- }
49
- }
50
- //# sourceMappingURL=catalogMigration.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"catalogMigration.js","sourceRoot":"","sources":["../../../../src/sites/_internal/catalogMigration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAIjD;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,IAAI,OAAO,CAAC,KAAK,EAAE,+BAA+B,CAAC,IAAI,GAAG,EAAE;QAC1D,OAAO,KAAK,CAAC;KACd;SAAM;QACL,IAAI,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;QAC3C,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE;YAChD,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,IAAI,EAAE,CAAC;YACxC,WAAW,GAAG;gBACZ,aAAa,EAAE,CAAC;gBAChB,KAAK,EAAE,sBAAsB;gBAC7B,MAAM,EAAE;oBACN,IAAI,EAAE;wBACJ,YAAY,EAAE,MAAM;wBACpB,OAAO,EAAE,EAAE;qBACZ;iBACF;gBACD,WAAW,EAAE,EAAE;aACD,CAAC;YAEjB,8DAA8D;YAC9D,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;gBACnC,UAAU,EAAE;oBACV;wBACE,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC;qBACnB;iBACF;aACF,CAAC,CAAC;YACH,yDAAyD;YACzD,0EAA0E;YAC1E,oEAAoE;YACpE,qDAAqD;YACrD,sEAAsE;YACtE,4DAA4D;YAC5D,uEAAuE;YACvE,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,WAAW,CAAC;SACpC;QACD,yBAAyB;QACzB,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,GAAG,GAAG,CAAC;QAE1C,OAAO,KAAK,CAAC;KACd;AACH,CAAC"}
@@ -1,54 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.catalogMigration = void 0;
4
- const get_prop_1 = require("../../objects/get-prop");
5
- /**
6
- * Add the default catalog and collections to the Site model
7
- * Note: This migration is only applies via `fetchSite(..):IHubSite` and not
8
- * the older `getSiteById(...):IModel`
9
- * @param model
10
- * @returns
11
- */
12
- function catalogMigration(model) {
13
- if (get_prop_1.getProp(model, "item.properties.schemaVersion") >= 1.7) {
14
- return model;
15
- }
16
- else {
17
- let siteCatalog = model.data.catalog || {};
18
- if (!siteCatalog.hasOwnProperty("schemaVersion")) {
19
- const groups = siteCatalog.groups || [];
20
- siteCatalog = {
21
- schemaVersion: 1,
22
- title: "Default Site Catalog",
23
- scopes: {
24
- item: {
25
- targetEntity: "item",
26
- filters: [],
27
- },
28
- },
29
- collections: [],
30
- };
31
- // groups are used to set the item scope for the whole catalog
32
- siteCatalog.scopes.item.filters.push({
33
- predicates: [
34
- {
35
- group: [...groups],
36
- },
37
- ],
38
- });
39
- // in order to not break existing code, we need store the
40
- // new catalog on `data.catalogv2` and leave old catalog on `data.catalog`
41
- // The property mapper will expose this as `catalog` on the IHubSite
42
- // and re-map it back to `data.catalogv2` when saving
43
- // This is only done if the data.catalog does not have `schemaVersion`
44
- // property. At some point we will deprecate the old catalog
45
- // remove the mappings, and save the catalog directly to `data.catalog`
46
- model.data.catalogv2 = siteCatalog;
47
- }
48
- // set the schema version
49
- model.item.properties.schemaVersion = 1.7;
50
- return model;
51
- }
52
- }
53
- exports.catalogMigration = catalogMigration;
54
- //# sourceMappingURL=catalogMigration.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"catalogMigration.js","sourceRoot":"","sources":["../../../../src/sites/_internal/catalogMigration.ts"],"names":[],"mappings":";;;AAAA,qDAAiD;AAIjD;;;;;;GAMG;AACH,SAAgB,gBAAgB,CAAC,KAAa;IAC5C,IAAI,kBAAO,CAAC,KAAK,EAAE,+BAA+B,CAAC,IAAI,GAAG,EAAE;QAC1D,OAAO,KAAK,CAAC;KACd;SAAM;QACL,IAAI,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;QAC3C,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE;YAChD,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,IAAI,EAAE,CAAC;YACxC,WAAW,GAAG;gBACZ,aAAa,EAAE,CAAC;gBAChB,KAAK,EAAE,sBAAsB;gBAC7B,MAAM,EAAE;oBACN,IAAI,EAAE;wBACJ,YAAY,EAAE,MAAM;wBACpB,OAAO,EAAE,EAAE;qBACZ;iBACF;gBACD,WAAW,EAAE,EAAE;aACD,CAAC;YAEjB,8DAA8D;YAC9D,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;gBACnC,UAAU,EAAE;oBACV;wBACE,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC;qBACnB;iBACF;aACF,CAAC,CAAC;YACH,yDAAyD;YACzD,0EAA0E;YAC1E,oEAAoE;YACpE,qDAAqD;YACrD,sEAAsE;YACtE,4DAA4D;YAC5D,uEAAuE;YACvE,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,WAAW,CAAC;SACpC;QACD,yBAAyB;QACzB,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,GAAG,GAAG,CAAC;QAE1C,OAAO,KAAK,CAAC;KACd;AACH,CAAC;AAzCD,4CAyCC"}
@@ -1,9 +0,0 @@
1
- import { IModel } from "../../types";
2
- /**
3
- * Add the default catalog and collections to the Site model
4
- * Note: This migration is only applies via `fetchSite(..):IHubSite` and not
5
- * the older `getSiteById(...):IModel`
6
- * @param model
7
- * @returns
8
- */
9
- export declare function catalogMigration(model: IModel): IModel;