@esri/hub-common 14.182.0 → 14.184.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 (67) hide show
  1. package/dist/esm/core/EntityEditor.js +4 -0
  2. package/dist/esm/core/EntityEditor.js.map +1 -1
  3. package/dist/esm/core/fetchHubEntity.js +2 -5
  4. package/dist/esm/core/fetchHubEntity.js.map +1 -1
  5. package/dist/esm/core/schemas/internal/getEditorSchemas.js +14 -0
  6. package/dist/esm/core/schemas/internal/getEditorSchemas.js.map +1 -1
  7. package/dist/esm/core/schemas/types.js +2 -0
  8. package/dist/esm/core/schemas/types.js.map +1 -1
  9. package/dist/esm/permissions/HubPermissionPolicies.js +8 -0
  10. package/dist/esm/permissions/HubPermissionPolicies.js.map +1 -1
  11. package/dist/esm/permissions/types/Permission.js +1 -0
  12. package/dist/esm/permissions/types/Permission.js.map +1 -1
  13. package/dist/esm/users/HubUser.js +110 -0
  14. package/dist/esm/users/HubUser.js.map +1 -0
  15. package/dist/esm/users/HubUsers.js +25 -4
  16. package/dist/esm/users/HubUsers.js.map +1 -1
  17. package/dist/esm/users/_internal/UserBusinessRules.js +6 -1
  18. package/dist/esm/users/_internal/UserBusinessRules.js.map +1 -1
  19. package/dist/esm/users/_internal/UserSchema.js +41 -0
  20. package/dist/esm/users/_internal/UserSchema.js.map +1 -0
  21. package/dist/esm/users/_internal/UserUiSchemaSettings.js +37 -0
  22. package/dist/esm/users/_internal/UserUiSchemaSettings.js.map +1 -0
  23. package/dist/esm/users/_internal/computeProps.js +37 -0
  24. package/dist/esm/users/_internal/computeProps.js.map +1 -0
  25. package/dist/esm/users/_internal/enrichments.js +5 -0
  26. package/dist/esm/users/_internal/enrichments.js.map +1 -1
  27. package/dist/esm/users/defaults.js +7 -0
  28. package/dist/esm/users/defaults.js.map +1 -0
  29. package/dist/node/core/EntityEditor.js +4 -0
  30. package/dist/node/core/EntityEditor.js.map +1 -1
  31. package/dist/node/core/fetchHubEntity.js +1 -4
  32. package/dist/node/core/fetchHubEntity.js.map +1 -1
  33. package/dist/node/core/schemas/internal/getEditorSchemas.js +14 -0
  34. package/dist/node/core/schemas/internal/getEditorSchemas.js.map +1 -1
  35. package/dist/node/core/schemas/types.js +2 -0
  36. package/dist/node/core/schemas/types.js.map +1 -1
  37. package/dist/node/permissions/HubPermissionPolicies.js +8 -0
  38. package/dist/node/permissions/HubPermissionPolicies.js.map +1 -1
  39. package/dist/node/permissions/types/Permission.js +1 -0
  40. package/dist/node/permissions/types/Permission.js.map +1 -1
  41. package/dist/node/users/HubUser.js +114 -0
  42. package/dist/node/users/HubUser.js.map +1 -0
  43. package/dist/node/users/HubUsers.js +25 -4
  44. package/dist/node/users/HubUsers.js.map +1 -1
  45. package/dist/node/users/_internal/UserBusinessRules.js +6 -1
  46. package/dist/node/users/_internal/UserBusinessRules.js.map +1 -1
  47. package/dist/node/users/_internal/UserSchema.js +44 -0
  48. package/dist/node/users/_internal/UserSchema.js.map +1 -0
  49. package/dist/node/users/_internal/UserUiSchemaSettings.js +40 -0
  50. package/dist/node/users/_internal/UserUiSchemaSettings.js.map +1 -0
  51. package/dist/node/users/_internal/computeProps.js +42 -0
  52. package/dist/node/users/_internal/computeProps.js.map +1 -0
  53. package/dist/node/users/_internal/enrichments.js +5 -0
  54. package/dist/node/users/_internal/enrichments.js.map +1 -1
  55. package/dist/node/users/defaults.js +10 -0
  56. package/dist/node/users/defaults.js.map +1 -0
  57. package/dist/types/core/schemas/types.d.ts +2 -2
  58. package/dist/types/core/types/IHubUser.d.ts +32 -0
  59. package/dist/types/users/HubUser.d.ts +65 -0
  60. package/dist/types/users/HubUsers.d.ts +15 -2
  61. package/dist/types/users/_internal/UserBusinessRules.d.ts +1 -1
  62. package/dist/types/users/_internal/UserSchema.d.ts +7 -0
  63. package/dist/types/users/_internal/UserUiSchemaSettings.d.ts +13 -0
  64. package/dist/types/users/_internal/computeProps.d.ts +20 -0
  65. package/dist/types/users/_internal/enrichments.d.ts +3 -0
  66. package/dist/types/users/defaults.d.ts +6 -0
  67. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ import { IUserHubSettings } from "../../utils/hubUserAppResources";
1
2
  import { IHubEntityBase } from "./IHubEntityBase";
2
3
  import { SettableAccessLevel } from "./types";
3
4
  /**
@@ -27,6 +28,21 @@ export interface IHubUser extends IHubEntityBase {
27
28
  * User's own username
28
29
  */
29
30
  owner?: string;
31
+ /**
32
+ * the user's settings
33
+ */
34
+ settings?: IUserHubSettings;
35
+ /**
36
+ * the user's org settings that are configurable from hub
37
+ * IMPT NOTE: this is a TEMPORARY solution and should be used sparingly. We are currently allowing
38
+ * these settings to live on a user entity to allow for updating these settings in the user workspace
39
+ * using the entity-editor. In the long term, we'd want these to be updated in an org-specific
40
+ * workspace, rather than in the user workspace.
41
+ *
42
+ * We do NOT EVER want to rely on reading from these props on the user entity to dictate
43
+ * what an org setting should look like.
44
+ */
45
+ hubOrgSettings?: IHubUserOrgSettings;
30
46
  /**
31
47
  * User configurable tags
32
48
  */
@@ -43,3 +59,19 @@ export interface IHubUser extends IHubEntityBase {
43
59
  */
44
60
  typeKeywords?: string[];
45
61
  }
62
+ /**
63
+ * Defines the properties of a Hub Org's settings stored on a IHubUser.
64
+ *
65
+ * IMPT NOTE: this is a TEMPORARY solution and should be used sparingly. We are currently allowing
66
+ * these settings to live on a user entity to allow for updating these settings in the user workspace
67
+ * using the entity-editor. In the long term, we'd want these to be updated in an org-specific
68
+ * workspace, rather than in the user workspace.
69
+ *
70
+ * We do NOT EVER want to rely on reading from these props on the user entity to dictate
71
+ * what an org setting should look like.
72
+ */
73
+ export interface IHubUserOrgSettings {
74
+ showInformationalBanner?: boolean;
75
+ termsAndConditions?: string;
76
+ signupText?: string;
77
+ }
@@ -0,0 +1,65 @@
1
+ import { IEntityEditorContext, IHubUser } from "../core/types";
2
+ import { IArcGISContext } from "../ArcGISContext";
3
+ import { IEditorConfig } from "../core/schemas/types";
4
+ import { IWithEditorBehavior } from "../core/behaviors/IWithEditorBehavior";
5
+ import { UserEditorType } from "./_internal/UserSchema";
6
+ export declare class HubUser implements IWithEditorBehavior {
7
+ protected context: IArcGISContext;
8
+ protected entity: IHubUser;
9
+ protected isDestroyed: boolean;
10
+ private constructor();
11
+ /**
12
+ * Create an instance from a IHubUser object
13
+ * @param json - JSON object to create a HubProject from
14
+ * @param context - ArcGIS context
15
+ * @returns HubUser
16
+ */
17
+ static fromJson(json: Partial<IHubUser>, context: IArcGISContext): HubUser;
18
+ /**
19
+ * Given a partial user object, apply defaults to it to ensure that a baseline of properties are set
20
+ * @param partialUser
21
+ * @returns IHubUser
22
+ */
23
+ private static applyDefaults;
24
+ /**
25
+ * Method that returns the entity as a JSON object
26
+ * We have this on the EntityItem class, but we don't implement that here
27
+ * @returns IHubUser
28
+ */
29
+ toJson(): IHubUser;
30
+ /**
31
+ * Save the HubUser to the backing store.
32
+ *
33
+ * Note that Hub does not currently support the creation of users,
34
+ * so this function should only be used for updating users.
35
+ *
36
+ * @returns
37
+ */
38
+ save(): Promise<void>;
39
+ /**
40
+ * Delete the HubUser from the store
41
+ * set a flag to indicate that it is destroyed
42
+ *
43
+ * Note that Hub does not currently support the deletion of users,
44
+ * so this function should not be used as of now.
45
+ * @returns
46
+ */
47
+ delete(): Promise<void>;
48
+ /**
49
+ * Get the editor config for the HubUser entity.
50
+ * @param i18nScope translation scope to be interpolated into the uiSchema
51
+ * @param type editor type - corresponds to the returned uiSchema
52
+ */
53
+ getEditorConfig(i18nScope: string, type: UserEditorType): Promise<IEditorConfig>;
54
+ /**
55
+ * Transforms entity values into editor values
56
+ * @param editorContext
57
+ * @param include
58
+ */
59
+ toEditor(editorContext?: IEntityEditorContext, include?: string[]): Promise<IHubUser>;
60
+ /**
61
+ * Transforms editor values into entity values
62
+ * @param editor
63
+ */
64
+ fromEditor(editor: IHubUser): Promise<IHubUser>;
65
+ }
@@ -2,13 +2,26 @@ import { IUser } from "@esri/arcgis-rest-types";
2
2
  import { IHubUser } from "../core/types/IHubUser";
3
3
  import { IHubRequestOptions } from "../types";
4
4
  import { IHubSearchResult } from "../search/types/IHubSearchResult";
5
+ import { IArcGISContext } from "../ArcGISContext";
6
+ /**
7
+ * Converts a IUser object into an IHubUser.
8
+ *
9
+ * @param user
10
+ * @returns IHubUser
11
+ */
5
12
  export declare const convertUserToHubUser: (user: IUser) => IHubUser;
6
13
  /**
7
- * Enrich a User object
14
+ * Enriches an IUser object search result.
8
15
  * @param user
9
16
  * @param includes
10
17
  * @param requestOptions
11
18
  * @returns
12
19
  */
13
20
  export declare function enrichUserSearchResult(user: IUser & Record<string, any>, include: string[], requestOptions: IHubRequestOptions): Promise<IHubSearchResult>;
14
- export declare const fetchHubUser: (username: string, requestOptions?: IHubRequestOptions) => Promise<IHubUser>;
21
+ /**
22
+ * Fetches a hub user by username
23
+ * @param username - hub username. can also be "self"
24
+ * @param context
25
+ * @returns
26
+ */
27
+ export declare const fetchHubUser: (username: string, context?: IArcGISContext) => Promise<IHubUser>;
@@ -4,7 +4,7 @@ import { IPermissionPolicy } from "../../permissions";
4
4
  * These define the requirements any user must meet to perform related actions
5
5
  * @private
6
6
  */
7
- export declare const UserPermissions: readonly ["hub:user", "hub:user:view", "hub:user:edit", "hub:user:owner", "hub:user:workspace", "hub:user:workspace:overview", "hub:user:manage"];
7
+ export declare const UserPermissions: readonly ["hub:user", "hub:user:view", "hub:user:edit", "hub:user:owner", "hub:user:workspace", "hub:user:workspace:overview", "hub:user:workspace:settings", "hub:user:manage"];
8
8
  /**
9
9
  * User permission policies
10
10
  * @private
@@ -0,0 +1,7 @@
1
+ import { IConfigurationSchema } from "../../core/schemas/types";
2
+ export declare type UserEditorType = (typeof UserEditorTypes)[number];
3
+ export declare const UserEditorTypes: readonly ["hub:user:settings"];
4
+ /**
5
+ * Defines the JSON schema for a Hub User's editable fields.
6
+ */
7
+ export declare const UserSchema: IConfigurationSchema;
@@ -0,0 +1,13 @@
1
+ import { IArcGISContext } from "../../ArcGISContext";
2
+ import { IUiSchema } from "../../core/schemas/types";
3
+ /**
4
+ * @private
5
+ * constructs the settings uiSchema for Hub Users.
6
+ * This defines how the schema should be rendered in the
7
+ * user workspace settings pane
8
+ * @param i18nScope - translation scope to be interpolated into the uiSchema
9
+ * @param options - additional options to customize the uiSchema
10
+ * @param context - contextual auth and portal information
11
+ * @returns
12
+ */
13
+ export declare const buildUiSchema: (i18nScope: string, options: any, context: IArcGISContext) => Promise<IUiSchema>;
@@ -0,0 +1,20 @@
1
+ import { IUser } from "@esri/arcgis-rest-types";
2
+ import { IArcGISContext } from "../../ArcGISContext";
3
+ import { IHubUser } from "../../core/types";
4
+ /**
5
+ * Given a model and a user, sets various computed properties that can't be directly mapped.
6
+ * @param model
7
+ * @param user
8
+ * @param context
9
+ * @returns
10
+ */
11
+ export declare function computeProps(model: IUser, user: IHubUser, context: IArcGISContext): Promise<IHubUser>;
12
+ /**
13
+ * Fetches the portal's signin settings by making a request to the
14
+ * ${portalUrl}/portals/self/signinSettings endpoint.
15
+ *
16
+ * Returns a promise that resolves with the signin settings object.
17
+ *
18
+ * @param context
19
+ */
20
+ export declare function getPortalSignInSettings(context: IArcGISContext): Promise<any>;
@@ -11,6 +11,9 @@ export interface IUserEnrichments {
11
11
  */
12
12
  errors?: IEnrichmentErrorInfo[];
13
13
  }
14
+ /**
15
+ * Available enrichments for Users
16
+ */
14
17
  export declare type UserEnrichment = keyof IUserEnrichments;
15
18
  /**
16
19
  * Merging of the Enrichment and the User
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Default user properties
3
+ *
4
+ * TODO: add default user properties as we need them
5
+ */
6
+ export declare const DEFAULT_USER: {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/hub-common",
3
- "version": "14.182.0",
3
+ "version": "14.184.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",