@esri/hub-common 11.4.1 → 11.6.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 (88) hide show
  1. package/dist/esm/core/HubItemEntity.js.map +1 -1
  2. package/dist/esm/core/behaviors/IWithEditorBehavior.js +1 -0
  3. package/dist/esm/core/behaviors/IWithEditorBehavior.js.map +1 -0
  4. package/dist/esm/core/behaviors/index.js +1 -0
  5. package/dist/esm/core/behaviors/index.js.map +1 -1
  6. package/dist/esm/core/index.js +1 -0
  7. package/dist/esm/core/index.js.map +1 -1
  8. package/dist/esm/core/schemas/hubproject.js +70 -0
  9. package/dist/esm/core/schemas/hubproject.js.map +1 -0
  10. package/dist/esm/core/schemas/index.js +3 -0
  11. package/dist/esm/core/schemas/index.js.map +1 -0
  12. package/dist/esm/core/schemas/internal/applyUiSchemaElementOptions.js +31 -0
  13. package/dist/esm/core/schemas/internal/applyUiSchemaElementOptions.js.map +1 -0
  14. package/dist/esm/core/schemas/internal/filterSchemaToUiSchema.js +14 -0
  15. package/dist/esm/core/schemas/internal/filterSchemaToUiSchema.js.map +1 -0
  16. package/dist/esm/core/schemas/internal/getUiSchemaProps.js +17 -0
  17. package/dist/esm/core/schemas/internal/getUiSchemaProps.js.map +1 -0
  18. package/dist/esm/core/schemas/internal/index.js +5 -0
  19. package/dist/esm/core/schemas/internal/index.js.map +1 -0
  20. package/dist/esm/core/schemas/internal/subsetSchema.js +17 -0
  21. package/dist/esm/core/schemas/internal/subsetSchema.js.map +1 -0
  22. package/dist/esm/core/schemas/types.js +21 -0
  23. package/dist/esm/core/schemas/types.js.map +1 -0
  24. package/dist/esm/initiatives/HubInitiative.js +14 -0
  25. package/dist/esm/initiatives/HubInitiative.js.map +1 -1
  26. package/dist/esm/objects/deepGetPropValues.js +19 -0
  27. package/dist/esm/objects/deepGetPropValues.js.map +1 -0
  28. package/dist/esm/projects/HubProject.js +14 -1
  29. package/dist/esm/projects/HubProject.js.map +1 -1
  30. package/dist/esm/projects/HubProjects.js +37 -1
  31. package/dist/esm/projects/HubProjects.js.map +1 -1
  32. package/dist/esm/urls/index.js +1 -0
  33. package/dist/esm/urls/index.js.map +1 -1
  34. package/dist/esm/urls/is-safe-redirect-url.js +31 -0
  35. package/dist/esm/urls/is-safe-redirect-url.js.map +1 -0
  36. package/dist/node/core/HubItemEntity.js.map +1 -1
  37. package/dist/node/core/behaviors/IWithEditorBehavior.js +3 -0
  38. package/dist/node/core/behaviors/IWithEditorBehavior.js.map +1 -0
  39. package/dist/node/core/behaviors/index.js +1 -0
  40. package/dist/node/core/behaviors/index.js.map +1 -1
  41. package/dist/node/core/index.js +1 -0
  42. package/dist/node/core/index.js.map +1 -1
  43. package/dist/node/core/schemas/hubproject.js +73 -0
  44. package/dist/node/core/schemas/hubproject.js.map +1 -0
  45. package/dist/node/core/schemas/index.js +6 -0
  46. package/dist/node/core/schemas/index.js.map +1 -0
  47. package/dist/node/core/schemas/internal/applyUiSchemaElementOptions.js +35 -0
  48. package/dist/node/core/schemas/internal/applyUiSchemaElementOptions.js.map +1 -0
  49. package/dist/node/core/schemas/internal/filterSchemaToUiSchema.js +18 -0
  50. package/dist/node/core/schemas/internal/filterSchemaToUiSchema.js.map +1 -0
  51. package/dist/node/core/schemas/internal/getUiSchemaProps.js +21 -0
  52. package/dist/node/core/schemas/internal/getUiSchemaProps.js.map +1 -0
  53. package/dist/node/core/schemas/internal/index.js +8 -0
  54. package/dist/node/core/schemas/internal/index.js.map +1 -0
  55. package/dist/node/core/schemas/internal/subsetSchema.js +21 -0
  56. package/dist/node/core/schemas/internal/subsetSchema.js.map +1 -0
  57. package/dist/node/core/schemas/types.js +24 -0
  58. package/dist/node/core/schemas/types.js.map +1 -0
  59. package/dist/node/initiatives/HubInitiative.js +14 -0
  60. package/dist/node/initiatives/HubInitiative.js.map +1 -1
  61. package/dist/node/objects/deepGetPropValues.js +23 -0
  62. package/dist/node/objects/deepGetPropValues.js.map +1 -0
  63. package/dist/node/projects/HubProject.js +13 -0
  64. package/dist/node/projects/HubProject.js.map +1 -1
  65. package/dist/node/projects/HubProjects.js +38 -1
  66. package/dist/node/projects/HubProjects.js.map +1 -1
  67. package/dist/node/urls/index.js +1 -0
  68. package/dist/node/urls/index.js.map +1 -1
  69. package/dist/node/urls/is-safe-redirect-url.js +35 -0
  70. package/dist/node/urls/is-safe-redirect-url.js.map +1 -0
  71. package/dist/types/core/behaviors/IWithEditorBehavior.d.ts +12 -0
  72. package/dist/types/core/behaviors/index.d.ts +1 -0
  73. package/dist/types/core/index.d.ts +1 -0
  74. package/dist/types/core/schemas/hubproject.d.ts +10 -0
  75. package/dist/types/core/schemas/index.d.ts +2 -0
  76. package/dist/types/core/schemas/internal/applyUiSchemaElementOptions.d.ts +10 -0
  77. package/dist/types/core/schemas/internal/filterSchemaToUiSchema.d.ts +8 -0
  78. package/dist/types/core/schemas/internal/getUiSchemaProps.d.ts +9 -0
  79. package/dist/types/core/schemas/internal/index.d.ts +4 -0
  80. package/dist/types/core/schemas/internal/subsetSchema.d.ts +8 -0
  81. package/dist/types/core/schemas/types.d.ts +61 -0
  82. package/dist/types/initiatives/HubInitiative.d.ts +6 -0
  83. package/dist/types/objects/deepGetPropValues.d.ts +6 -0
  84. package/dist/types/projects/HubProject.d.ts +12 -1
  85. package/dist/types/projects/HubProjects.d.ts +9 -1
  86. package/dist/types/urls/index.d.ts +1 -0
  87. package/dist/types/urls/is-safe-redirect-url.d.ts +14 -0
  88. package/package.json +3 -1
@@ -0,0 +1,61 @@
1
+ import { JSONSchema } from "json-schema-typed";
2
+ import Ajv from "ajv";
3
+ export declare enum UiSchemaRuleEffects {
4
+ SHOW = "SHOW",
5
+ HIDE = "HIDE",
6
+ DISABLE = "DISABLE",
7
+ NONE = ""
8
+ }
9
+ export declare enum UiSchemaElementTypes {
10
+ section = "Section",
11
+ step = "Step",
12
+ control = "Control",
13
+ layout = "Layout",
14
+ slot = "Slot"
15
+ }
16
+ export declare enum UiSchemaSectionTypes {
17
+ accordion = "accordion",
18
+ stepper = "stepper"
19
+ }
20
+ export interface IConfigurationSchema extends JSONSchema {
21
+ type?: "object";
22
+ }
23
+ export interface IConfigurationValues {
24
+ [key: string]: unknown;
25
+ }
26
+ export interface IChangeEventDetail {
27
+ valid: boolean;
28
+ values?: {
29
+ [key: string]: any;
30
+ };
31
+ }
32
+ export interface IValidationResult {
33
+ valid: boolean;
34
+ errors?: Ajv.ErrorObject[];
35
+ }
36
+ export interface IUiSchemaRule {
37
+ effect: UiSchemaRuleEffects;
38
+ condition: {
39
+ scope: string;
40
+ schema: IConfigurationSchema;
41
+ };
42
+ }
43
+ export interface IUiSchemaElement {
44
+ type: string;
45
+ labelKey?: string;
46
+ label?: string;
47
+ options?: {
48
+ [key: string]: any;
49
+ };
50
+ scope?: string;
51
+ rule?: IUiSchemaRule;
52
+ elements?: IUiSchemaElement[];
53
+ tooltip?: string;
54
+ }
55
+ export interface IUiSchema extends IUiSchemaElement {
56
+ elements?: IUiSchema[] | IUiSchemaElement[];
57
+ }
58
+ /**
59
+ * Run-time configuration for UiSchema Elements
60
+ */
61
+ export declare type UiSchemaElementOptions = Pick<IUiSchemaElement, "scope" | "options">;
@@ -46,6 +46,12 @@ export declare class HubInitiative extends HubItemEntity<IHubInitiative> impleme
46
46
  * @returns
47
47
  */
48
48
  static fetch(identifier: string, context: IArcGISContext): Promise<HubInitiative>;
49
+ /**
50
+ * Static method to get the editor config for for the HubProject entity.
51
+ * @param i18nScope Translation scope to be interpolated into the schemas
52
+ * @param type
53
+ * @param options Optional hash of Element component options
54
+ */
49
55
  private static applyDefaults;
50
56
  /**
51
57
  * Apply a new state to the instance
@@ -0,0 +1,6 @@
1
+ /**
2
+ * For a given property name, extract an array of the unique values of that property
3
+ * This was designed to work with string values, so no promises about other types
4
+ * @param obj
5
+ */
6
+ export declare function deepGetPropValues(obj: Record<string, any>, prop: string): string[];
@@ -1,7 +1,8 @@
1
- import { IHubProject, IWithPermissionBehavior, IWithCatalogBehavior, PermissionManager, IWithStoreBehavior, IWithSharingBehavior } from "../core";
1
+ import { IHubProject, IWithPermissionBehavior, IWithCatalogBehavior, PermissionManager, IWithStoreBehavior, IWithSharingBehavior, UiSchemaElementOptions } from "../core";
2
2
  import { Catalog } from "../search/Catalog";
3
3
  import { IArcGISContext } from "../ArcGISContext";
4
4
  import { HubItemEntity } from "../core/HubItemEntity";
5
+ import { EditorConfigType, IEditorConfig } from "../core/behaviors/IWithEditorBehavior";
5
6
  /**
6
7
  * Hub Project Class
7
8
  */
@@ -46,6 +47,16 @@ export declare class HubProject extends HubItemEntity<IHubProject> implements IW
46
47
  * @returns
47
48
  */
48
49
  static fetch(identifier: string, context: IArcGISContext): Promise<HubProject>;
50
+ /**
51
+ * Static method to get the editor config for for the HubProject entity.
52
+ * @param i18nScope Translation scope to be interpolated into the schemas
53
+ * @param type
54
+ * @param options Optional hash of uiSchema element option overrides
55
+ * Note: typescript does not have a means to specify static methods in interfaces
56
+ * so while this is the implementation of IWithEditorBehavior, it is not enforced
57
+ * by the compiler.
58
+ */
59
+ static getEditorConfig(i18nScope: string, type: EditorConfigType, options?: UiSchemaElementOptions[]): Promise<IEditorConfig>;
49
60
  private static applyDefaults;
50
61
  /**
51
62
  * Apply a new state to the instance
@@ -1,5 +1,5 @@
1
1
  import { IUserRequestOptions } from "@esri/arcgis-rest-auth";
2
- import { IHubRequestOptions } from "../index";
2
+ import { IHubRequestOptions, EditorConfigType, UiSchemaElementOptions, IEditorConfig } from "../index";
3
3
  import { IItem } from "@esri/arcgis-rest-portal";
4
4
  import { IRequestOptions } from "@esri/arcgis-rest-request";
5
5
  import { IHubProject } from "../core/types";
@@ -53,3 +53,11 @@ export declare function convertItemToProject(item: IItem, requestOptions: IReque
53
53
  * @returns
54
54
  */
55
55
  export declare function enrichProjectSearchResult(item: IItem, include: string[], requestOptions: IHubRequestOptions): Promise<IHubSearchResult>;
56
+ /**
57
+ * Get the editor config for for the HubProject entity.
58
+ * @param i18nScope Translation scope to be interpolated into the schemas
59
+ * @param type
60
+ * @param options Optional hash of Element component options
61
+ * @returns
62
+ */
63
+ export declare function getHubProjectEditorConfig(i18nScope: string, type: EditorConfigType, options?: UiSchemaElementOptions[]): Promise<IEditorConfig>;
@@ -18,6 +18,7 @@ export * from "./getPortalBaseFromOrgUrl";
18
18
  export * from "./getGroupHomeUrl";
19
19
  export * from "./getUserHomeUrl";
20
20
  export * from "./get-campaign-url";
21
+ export * from "./is-safe-redirect-url";
21
22
  /**
22
23
  *
23
24
  * @param url
@@ -0,0 +1,14 @@
1
+ import { IHubRequestOptions } from "../types";
2
+ interface IIsSafeRedirectUrlOptions extends IHubRequestOptions {
3
+ url: string;
4
+ }
5
+ /**
6
+ * Determines if a given URL is safe to redirect to.
7
+ * All URLs to *.esri.com and *.arcgis.com are considered
8
+ * safe. Non esri/arcgis domains must have a domain record.
9
+ * @param options.url url A URL
10
+ * @param ...options An IHubRequestOptions object
11
+ * @returns a promise that resolves a boolean
12
+ */
13
+ export declare function isSafeRedirectUrl(options: IIsSafeRedirectUrlOptions): Promise<boolean>;
14
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/hub-common",
3
- "version": "11.4.1",
3
+ "version": "11.6.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",
@@ -14,8 +14,10 @@
14
14
  "dependencies": {
15
15
  "abab": "^2.0.5",
16
16
  "adlib": "^3.0.7",
17
+ "ajv": "^6.12.6",
17
18
  "fast-xml-parser": "^3.21.0",
18
19
  "jsonapi-typescript": "^0.1.3",
20
+ "json-schema-typed": "^7.0.3",
19
21
  "tslib": "^1.13.0"
20
22
  },
21
23
  "peerDependencies": {