@esri/hub-common 13.22.1 → 13.24.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 (130) hide show
  1. package/dist/esm/capabilities/types.js +1 -0
  2. package/dist/esm/capabilities/types.js.map +1 -1
  3. package/dist/esm/core/EntityEditor.js +39 -0
  4. package/dist/esm/core/EntityEditor.js.map +1 -0
  5. package/dist/esm/core/HubItemEntity.js +14 -0
  6. package/dist/esm/core/HubItemEntity.js.map +1 -1
  7. package/dist/esm/core/index.js.map +1 -1
  8. package/dist/esm/core/schemas/getEntityEditorSchemas.js +7 -1
  9. package/dist/esm/core/schemas/getEntityEditorSchemas.js.map +1 -1
  10. package/dist/esm/core/schemas/internal/getCategoryItems.js +34 -0
  11. package/dist/esm/core/schemas/internal/getCategoryItems.js.map +1 -0
  12. package/dist/esm/core/schemas/internal/getFeaturedContentCatalogs.js +21 -0
  13. package/dist/esm/core/schemas/internal/getFeaturedContentCatalogs.js.map +1 -0
  14. package/dist/esm/core/schemas/internal/getFeaturedImageUrl.js +9 -0
  15. package/dist/esm/core/schemas/internal/getFeaturedImageUrl.js.map +1 -0
  16. package/dist/esm/core/schemas/internal/getLocationExtent.js +11 -0
  17. package/dist/esm/core/schemas/internal/getLocationExtent.js.map +1 -0
  18. package/dist/esm/core/schemas/internal/getLocationOptions.js +56 -0
  19. package/dist/esm/core/schemas/internal/getLocationOptions.js.map +1 -0
  20. package/dist/esm/core/schemas/internal/getSharableGroupsComboBoxItems.js +27 -0
  21. package/dist/esm/core/schemas/internal/getSharableGroupsComboBoxItems.js.map +1 -0
  22. package/dist/esm/core/schemas/internal/getTagItems.js +37 -0
  23. package/dist/esm/core/schemas/internal/getTagItems.js.map +1 -0
  24. package/dist/esm/core/types/HubEntityEditor.js +1 -0
  25. package/dist/esm/core/types/HubEntityEditor.js.map +1 -0
  26. package/dist/esm/core/types/IHubProject.js.map +1 -1
  27. package/dist/esm/core/types/index.js +5 -4
  28. package/dist/esm/core/types/index.js.map +1 -1
  29. package/dist/esm/index.js +1 -0
  30. package/dist/esm/index.js.map +1 -1
  31. package/dist/esm/pages/_internal/PageBusinessRules.js +6 -0
  32. package/dist/esm/pages/_internal/PageBusinessRules.js.map +1 -1
  33. package/dist/esm/projects/HubProject.js +92 -13
  34. package/dist/esm/projects/HubProject.js.map +1 -1
  35. package/dist/esm/projects/_internal/ProjectBusinessRules.js +13 -0
  36. package/dist/esm/projects/_internal/ProjectBusinessRules.js.map +1 -1
  37. package/dist/esm/projects/_internal/ProjectSchema.js +3 -3
  38. package/dist/esm/projects/_internal/ProjectSchema.js.map +1 -1
  39. package/dist/esm/projects/_internal/ProjectUiSchemaCreate.js +1 -1
  40. package/dist/esm/projects/_internal/ProjectUiSchemaCreate.js.map +1 -1
  41. package/dist/esm/projects/_internal/getProjectEditorConfigOptions.js +63 -0
  42. package/dist/esm/projects/_internal/getProjectEditorConfigOptions.js.map +1 -0
  43. package/dist/esm/projects/edit.js +23 -7
  44. package/dist/esm/projects/edit.js.map +1 -1
  45. package/dist/esm/sites/HubSites.js +12 -26
  46. package/dist/esm/sites/HubSites.js.map +1 -1
  47. package/dist/esm/sites/_internal/SiteBusinessRules.js +6 -0
  48. package/dist/esm/sites/_internal/SiteBusinessRules.js.map +1 -1
  49. package/dist/esm/urls/cacheBustUrl.js +13 -0
  50. package/dist/esm/urls/cacheBustUrl.js.map +1 -0
  51. package/dist/esm/urls/index.js +1 -0
  52. package/dist/esm/urls/index.js.map +1 -1
  53. package/dist/node/capabilities/types.js +1 -0
  54. package/dist/node/capabilities/types.js.map +1 -1
  55. package/dist/node/core/EntityEditor.js +43 -0
  56. package/dist/node/core/EntityEditor.js.map +1 -0
  57. package/dist/node/core/HubItemEntity.js +14 -0
  58. package/dist/node/core/HubItemEntity.js.map +1 -1
  59. package/dist/node/core/index.js.map +1 -1
  60. package/dist/node/core/schemas/getEntityEditorSchemas.js +7 -1
  61. package/dist/node/core/schemas/getEntityEditorSchemas.js.map +1 -1
  62. package/dist/node/core/schemas/internal/getCategoryItems.js +38 -0
  63. package/dist/node/core/schemas/internal/getCategoryItems.js.map +1 -0
  64. package/dist/node/core/schemas/internal/getFeaturedContentCatalogs.js +25 -0
  65. package/dist/node/core/schemas/internal/getFeaturedContentCatalogs.js.map +1 -0
  66. package/dist/node/core/schemas/internal/getFeaturedImageUrl.js +13 -0
  67. package/dist/node/core/schemas/internal/getFeaturedImageUrl.js.map +1 -0
  68. package/dist/node/core/schemas/internal/getLocationExtent.js +15 -0
  69. package/dist/node/core/schemas/internal/getLocationExtent.js.map +1 -0
  70. package/dist/node/core/schemas/internal/getLocationOptions.js +60 -0
  71. package/dist/node/core/schemas/internal/getLocationOptions.js.map +1 -0
  72. package/dist/node/core/schemas/internal/getSharableGroupsComboBoxItems.js +31 -0
  73. package/dist/node/core/schemas/internal/getSharableGroupsComboBoxItems.js.map +1 -0
  74. package/dist/node/core/schemas/internal/getTagItems.js +41 -0
  75. package/dist/node/core/schemas/internal/getTagItems.js.map +1 -0
  76. package/dist/node/core/types/HubEntityEditor.js +3 -0
  77. package/dist/node/core/types/HubEntityEditor.js.map +1 -0
  78. package/dist/node/core/types/IHubProject.js.map +1 -1
  79. package/dist/node/core/types/index.js +5 -4
  80. package/dist/node/core/types/index.js.map +1 -1
  81. package/dist/node/index.js +1 -0
  82. package/dist/node/index.js.map +1 -1
  83. package/dist/node/pages/_internal/PageBusinessRules.js +6 -0
  84. package/dist/node/pages/_internal/PageBusinessRules.js.map +1 -1
  85. package/dist/node/projects/HubProject.js +93 -14
  86. package/dist/node/projects/HubProject.js.map +1 -1
  87. package/dist/node/projects/_internal/ProjectBusinessRules.js +13 -0
  88. package/dist/node/projects/_internal/ProjectBusinessRules.js.map +1 -1
  89. package/dist/node/projects/_internal/ProjectSchema.js +5 -5
  90. package/dist/node/projects/_internal/ProjectSchema.js.map +1 -1
  91. package/dist/node/projects/_internal/ProjectUiSchemaCreate.js +1 -1
  92. package/dist/node/projects/_internal/ProjectUiSchemaCreate.js.map +1 -1
  93. package/dist/node/projects/_internal/getProjectEditorConfigOptions.js +67 -0
  94. package/dist/node/projects/_internal/getProjectEditorConfigOptions.js.map +1 -0
  95. package/dist/node/projects/edit.js +24 -7
  96. package/dist/node/projects/edit.js.map +1 -1
  97. package/dist/node/sites/HubSites.js +12 -27
  98. package/dist/node/sites/HubSites.js.map +1 -1
  99. package/dist/node/sites/_internal/SiteBusinessRules.js +6 -0
  100. package/dist/node/sites/_internal/SiteBusinessRules.js.map +1 -1
  101. package/dist/node/urls/cacheBustUrl.js +16 -0
  102. package/dist/node/urls/cacheBustUrl.js.map +1 -0
  103. package/dist/node/urls/index.js +1 -0
  104. package/dist/node/urls/index.js.map +1 -1
  105. package/dist/types/capabilities/types.d.ts +1 -1
  106. package/dist/types/core/EntityEditor.d.ts +13 -0
  107. package/dist/types/core/behaviors/IWithEditorBehavior.d.ts +23 -9
  108. package/dist/types/core/schemas/internal/getCategoryItems.d.ts +11 -0
  109. package/dist/types/core/schemas/internal/getFeaturedContentCatalogs.d.ts +9 -0
  110. package/dist/types/core/schemas/internal/getFeaturedImageUrl.d.ts +3 -0
  111. package/dist/types/core/schemas/internal/getLocationExtent.d.ts +7 -0
  112. package/dist/types/core/schemas/internal/getLocationOptions.d.ts +16 -0
  113. package/dist/types/core/schemas/internal/getSharableGroupsComboBoxItems.d.ts +7 -0
  114. package/dist/types/core/schemas/internal/getTagItems.d.ts +12 -0
  115. package/dist/types/core/schemas/types.d.ts +6 -0
  116. package/dist/types/core/types/HubEntityEditor.d.ts +11 -0
  117. package/dist/types/core/types/IHubLocation.d.ts +12 -0
  118. package/dist/types/core/types/IHubProject.d.ts +10 -0
  119. package/dist/types/core/types/index.d.ts +5 -4
  120. package/dist/types/index.d.ts +1 -0
  121. package/dist/types/permissions/types/Permission.d.ts +1 -1
  122. package/dist/types/projects/HubProject.d.ts +21 -13
  123. package/dist/types/projects/_internal/ProjectBusinessRules.d.ts +1 -1
  124. package/dist/types/projects/_internal/ProjectSchema.d.ts +2 -2
  125. package/dist/types/projects/_internal/getProjectEditorConfigOptions.d.ts +10 -0
  126. package/dist/types/projects/edit.d.ts +12 -7
  127. package/dist/types/sites/HubSites.d.ts +0 -8
  128. package/dist/types/urls/cacheBustUrl.d.ts +5 -0
  129. package/dist/types/urls/index.d.ts +1 -0
  130. package/package.json +1 -1
@@ -1,15 +1,15 @@
1
- import { IHubProject, IWithCatalogBehavior, IWithStoreBehavior, IWithSharingBehavior, UiSchemaElementOptions, IResolvedMetric, IWithCardBehavior } from "../core";
1
+ import { IHubProject, IWithCatalogBehavior, IWithStoreBehavior, IWithSharingBehavior, IResolvedMetric, IWithCardBehavior, IHubProjectEditor, IEntityEditorContext } from "../core";
2
+ import { EditorType } from "../core/schemas/getEntityEditorSchemas";
2
3
  import { Catalog } from "../search";
3
4
  import { IArcGISContext } from "../ArcGISContext";
4
5
  import { HubItemEntity } from "../core/HubItemEntity";
5
- import { IEditorConfig } from "../core/behaviors/IWithEditorBehavior";
6
- import { ProjectEditorType } from "./_internal/ProjectSchema";
6
+ import { IEditorConfig, IWithEditorBehavior } from "../core/behaviors/IWithEditorBehavior";
7
7
  import { IWithMetricsBehavior } from "../core/behaviors/IWithMetricsBehavior";
8
8
  import { IConvertToCardModelOpts, IHubCardViewModel } from "../core/types/IHubCardViewModel";
9
9
  /**
10
10
  * Hub Project Class
11
11
  */
12
- export declare class HubProject extends HubItemEntity<IHubProject> implements IWithStoreBehavior<IHubProject>, IWithCatalogBehavior, IWithMetricsBehavior, IWithSharingBehavior, IWithCardBehavior {
12
+ export declare class HubProject extends HubItemEntity<IHubProject> implements IWithStoreBehavior<IHubProject>, IWithCatalogBehavior, IWithMetricsBehavior, IWithSharingBehavior, IWithCardBehavior, IWithEditorBehavior {
13
13
  private _catalog;
14
14
  /**
15
15
  * Private constructor so we don't have `new` all over the place. Allows for
@@ -45,16 +45,11 @@ export declare class HubProject extends HubItemEntity<IHubProject> implements IW
45
45
  */
46
46
  static fetch(identifier: string, context: IArcGISContext): Promise<HubProject>;
47
47
  /**
48
- * Static method to get the editor config for the HubProject entity.
49
- * @param i18nScope translation scope to be interpolated into the uiSchema
50
- * @param type editor type - corresonds to the returned uiSchema
51
- * @param options optional hash of dynamic uiSchema element options
52
- *
53
- * Note: typescript does not have a means to specify static methods in interfaces
54
- * so while this is the implementation of IWithEditorBehavior, it is not enforced
55
- * by the compiler.
48
+ * Given a partial project, apply defaults to it to ensure that a baseline of properties are set
49
+ * @param partialProject
50
+ * @param context
51
+ * @returns
56
52
  */
57
- static getEditorConfig(i18nScope: string, type: ProjectEditorType, options?: UiSchemaElementOptions[]): Promise<IEditorConfig>;
58
53
  private static applyDefaults;
59
54
  /**
60
55
  * Convert the project entity into a card view model that can
@@ -63,6 +58,19 @@ export declare class HubProject extends HubItemEntity<IHubProject> implements IW
63
58
  * @param opts view model options
64
59
  */
65
60
  convertToCardModel(opts?: IConvertToCardModelOpts): IHubCardViewModel;
61
+ getEditorConfig(i18nScope: string, type: EditorType): Promise<IEditorConfig>;
62
+ /**
63
+ * Return the project as an editor object
64
+ * @param editorContext
65
+ * @returns
66
+ */
67
+ toEditor(editorContext?: IEntityEditorContext): IHubProjectEditor;
68
+ /**
69
+ * Load the project from the editor object
70
+ * @param editor
71
+ * @returns
72
+ */
73
+ fromEditor(editor: IHubProjectEditor): Promise<IHubProject>;
66
74
  /**
67
75
  * Apply a new state to the instance
68
76
  * @param changes
@@ -19,7 +19,7 @@ export declare const ProjectCapabilityPermissions: ICapabilityPermission[];
19
19
  * These define the requirements any user must meet to perform related actions
20
20
  * @private
21
21
  */
22
- export declare const ProjectPermissions: readonly ["hub:project:create", "hub:project:delete", "hub:project:edit", "hub:project:view", "hub:project:owner"];
22
+ export declare const ProjectPermissions: readonly ["hub:project:create", "hub:project:delete", "hub:project:edit", "hub:project:view", "hub:project:owner", "hub:project:share"];
23
23
  /**
24
24
  * Project permission policies
25
25
  * @private
@@ -1,7 +1,7 @@
1
- import { IConfigurationSchema } from "../../core";
1
+ import { IConfigurationSchema } from "../../core/schemas/types";
2
2
  export declare type ProjectEditorType = (typeof ProjectEditorTypes)[number];
3
3
  export declare const ProjectEditorTypes: readonly ["hub:project:create", "hub:project:edit"];
4
4
  /**
5
- * defines the JSON schema for a Hub Project's editable fields
5
+ * Defines the JSON schema for a Hub Project's editable fields
6
6
  */
7
7
  export declare const ProjectSchema: IConfigurationSchema;
@@ -0,0 +1,10 @@
1
+ import { IArcGISContext } from "../../ArcGISContext";
2
+ import { UiSchemaElementOptions } from "../../core/schemas/types";
3
+ import { IHubProject } from "../../core/types/IHubProject";
4
+ /**
5
+ * Construct the Project Editor configuration options
6
+ * @param entity
7
+ * @param context
8
+ * @returns
9
+ */
10
+ export declare function getProjectEditorConfigOptions(entity: IHubProject, context: IArcGISContext): Promise<UiSchemaElementOptions[]>;
@@ -1,7 +1,9 @@
1
1
  import { IUserRequestOptions } from "@esri/arcgis-rest-auth";
2
- import { IHubProject } from "../core/types";
2
+ import { IPortal } from "@esri/arcgis-rest-portal";
3
+ import { IHubProject, IHubProjectEditor } from "../core/types";
4
+ import { ProjectEditorType } from "./_internal/ProjectSchema";
3
5
  import { UiSchemaElementOptions } from "../core/schemas";
4
- import { EditorConfigType, IEditorConfig } from "../core/behaviors/IWithEditorBehavior";
6
+ import { IEditorConfig } from "../core/behaviors/IWithEditorBehavior";
5
7
  /**
6
8
  * @private
7
9
  * Create a new Hub Project item
@@ -12,6 +14,13 @@ import { EditorConfigType, IEditorConfig } from "../core/behaviors/IWithEditorBe
12
14
  * @param requestOptions
13
15
  */
14
16
  export declare function createProject(partialProject: Partial<IHubProject>, requestOptions: IUserRequestOptions): Promise<IHubProject>;
17
+ /**
18
+ * Convert a IHubProjectEditor back to an IHubProject
19
+ * @param editor
20
+ * @param portal
21
+ * @returns
22
+ */
23
+ export declare function editorToProject(editor: IHubProjectEditor, portal: IPortal): IHubProject;
15
24
  /**
16
25
  * @private
17
26
  * Update a Hub Project
@@ -27,13 +36,9 @@ export declare function updateProject(project: IHubProject, requestOptions: IUse
27
36
  */
28
37
  export declare function deleteProject(id: string, requestOptions: IUserRequestOptions): Promise<void>;
29
38
  /**
30
- * DEPRECATED: the following will be removed at next breaking version
31
- * use the getEntityEditorSchemas function instead (which this function
32
- * has already been refactored to consume)
33
- *
34
39
  * Get the editor config for for the HubProject entity.
35
40
  * @param i18nScope translation scope to be interpolated into the uiSchema
36
41
  * @param type editor type - corresonds to the returned uiSchema
37
42
  * @param options optional hash of dynamic uiSchema element options
38
43
  */
39
- export declare function getHubProjectEditorConfig(i18nScope: string, type: EditorConfigType, options?: UiSchemaElementOptions[]): Promise<IEditorConfig>;
44
+ export declare function getHubProjectEditorConfig(i18nScope: string, type: ProjectEditorType, options?: UiSchemaElementOptions[]): Promise<IEditorConfig>;
@@ -49,14 +49,6 @@ export declare function fetchSite(identifier: string, requestOptions: IHubReques
49
49
  * @returns
50
50
  */
51
51
  export declare function convertModelToSite(model: IModel, requestOptions: IRequestOptions): IHubSite;
52
- /**
53
- * @internal
54
- * Convert an IHubSite into an IModel
55
- * @param site
56
- * @param requestOptions
57
- * @returns
58
- */
59
- export declare function convertSiteToModel(site: IHubSite, _requestOptions: IRequestOptions): IModel;
60
52
  /**
61
53
  * Convert a Hub Site Application item into a Hub Site, fetching any
62
54
  * additional information that may be required
@@ -0,0 +1,5 @@
1
+ /**
2
+ * artifically update a query param associated with a url to force
3
+ * the browser to load it from file rather than from cache
4
+ */
5
+ export declare const cacheBustUrl: (url: string, param?: string) => string;
@@ -19,6 +19,7 @@ export * from "./getGroupHomeUrl";
19
19
  export * from "./getUserHomeUrl";
20
20
  export * from "./get-campaign-url";
21
21
  export * from "./is-safe-redirect-url";
22
+ export * from "./cacheBustUrl";
22
23
  /**
23
24
  *
24
25
  * @param url
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/hub-common",
3
- "version": "13.22.1",
3
+ "version": "13.24.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",