@esri/hub-common 11.0.0-beta.4 → 11.1.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 (123) hide show
  1. package/dist/esm/core/HubItemEntity.js +142 -0
  2. package/dist/esm/core/HubItemEntity.js.map +1 -0
  3. package/dist/esm/core/_internal/getBasePropertyMap.js +53 -0
  4. package/dist/esm/core/_internal/getBasePropertyMap.js.map +1 -0
  5. package/dist/esm/core/traits/IWithCatalog.js +1 -0
  6. package/dist/esm/core/traits/IWithCatalog.js.map +1 -0
  7. package/dist/esm/core/traits/index.js +1 -0
  8. package/dist/esm/core/traits/index.js.map +1 -1
  9. package/dist/esm/core/types/IEntityResource.js +1 -0
  10. package/dist/esm/core/types/IEntityResource.js.map +1 -0
  11. package/dist/esm/core/types/IItemResource.js +1 -0
  12. package/dist/esm/core/types/IItemResource.js.map +1 -0
  13. package/dist/esm/core/types/index.js +0 -2
  14. package/dist/esm/core/types/index.js.map +1 -1
  15. package/dist/esm/index.js +1 -2
  16. package/dist/esm/index.js.map +1 -1
  17. package/dist/esm/initiatives/HubInitiative.js +147 -0
  18. package/dist/esm/initiatives/HubInitiative.js.map +1 -0
  19. package/dist/esm/initiatives/HubInitiatives.js +205 -0
  20. package/dist/esm/initiatives/HubInitiatives.js.map +1 -0
  21. package/dist/esm/initiatives/defaults.js +31 -0
  22. package/dist/esm/initiatives/defaults.js.map +1 -0
  23. package/dist/esm/initiatives/index.js +3 -0
  24. package/dist/esm/initiatives/index.js.map +1 -0
  25. package/dist/esm/projects/HubProject.js +8 -66
  26. package/dist/esm/projects/HubProject.js.map +1 -1
  27. package/dist/esm/projects/HubProjects.js +13 -86
  28. package/dist/esm/projects/HubProjects.js.map +1 -1
  29. package/dist/esm/projects/defaults.js +2 -1
  30. package/dist/esm/projects/defaults.js.map +1 -1
  31. package/dist/esm/search/_internal/index.js +0 -2
  32. package/dist/esm/search/_internal/index.js.map +1 -1
  33. package/dist/esm/sites/HubSites.js +7 -34
  34. package/dist/esm/sites/HubSites.js.map +1 -1
  35. package/dist/node/core/HubItemEntity.js +146 -0
  36. package/dist/node/core/HubItemEntity.js.map +1 -0
  37. package/dist/node/core/_internal/getBasePropertyMap.js +57 -0
  38. package/dist/node/core/_internal/getBasePropertyMap.js.map +1 -0
  39. package/dist/node/core/{types/IHubEntityManager.js → traits/IWithCatalog.js} +1 -1
  40. package/dist/node/core/traits/IWithCatalog.js.map +1 -0
  41. package/dist/node/core/traits/index.js +1 -0
  42. package/dist/node/core/traits/index.js.map +1 -1
  43. package/dist/node/core/types/{IHubItemEntityManager.js → IEntityResource.js} +1 -1
  44. package/dist/node/core/types/IEntityResource.js.map +1 -0
  45. package/dist/node/core/{traits/IWithCatalogDefinition.js → types/IItemResource.js} +1 -1
  46. package/dist/node/core/types/IItemResource.js.map +1 -0
  47. package/dist/node/core/types/index.js +0 -2
  48. package/dist/node/core/types/index.js.map +1 -1
  49. package/dist/node/index.js +1 -2
  50. package/dist/node/index.js.map +1 -1
  51. package/dist/node/initiatives/HubInitiative.js +151 -0
  52. package/dist/node/initiatives/HubInitiative.js.map +1 -0
  53. package/dist/node/initiatives/HubInitiatives.js +214 -0
  54. package/dist/node/initiatives/HubInitiatives.js.map +1 -0
  55. package/dist/node/initiatives/defaults.js +34 -0
  56. package/dist/node/initiatives/defaults.js.map +1 -0
  57. package/dist/node/initiatives/index.js +6 -0
  58. package/dist/node/initiatives/index.js.map +1 -0
  59. package/dist/node/projects/HubProject.js +8 -66
  60. package/dist/node/projects/HubProject.js.map +1 -1
  61. package/dist/node/projects/HubProjects.js +14 -88
  62. package/dist/node/projects/HubProjects.js.map +1 -1
  63. package/dist/node/projects/defaults.js +2 -1
  64. package/dist/node/projects/defaults.js.map +1 -1
  65. package/dist/node/search/_internal/index.js +0 -2
  66. package/dist/node/search/_internal/index.js.map +1 -1
  67. package/dist/node/sites/HubSites.js +9 -37
  68. package/dist/node/sites/HubSites.js.map +1 -1
  69. package/dist/types/content/_internal.d.ts +8 -8
  70. package/dist/types/core/HubItemEntity.d.ts +55 -0
  71. package/dist/types/core/_internal/getBasePropertyMap.d.ts +7 -0
  72. package/dist/types/core/behaviors/IWithStoreBehavior.d.ts +10 -0
  73. package/dist/types/core/traits/{IWithCatalogDefinition.d.ts → IWithCatalog.d.ts} +0 -0
  74. package/dist/types/core/traits/IWithPermissions.d.ts +1 -1
  75. package/dist/types/core/traits/index.d.ts +1 -0
  76. package/dist/types/core/types/IEntityResource.d.ts +21 -0
  77. package/dist/types/core/types/IHubContent.d.ts +1 -1
  78. package/dist/types/core/types/IHubInitiative.d.ts +2 -2
  79. package/dist/types/core/types/IHubItemEntity.d.ts +25 -16
  80. package/dist/types/core/types/IHubProject.d.ts +3 -3
  81. package/dist/types/core/types/IItemResource.d.ts +9 -0
  82. package/dist/types/core/types/index.d.ts +0 -2
  83. package/dist/types/index.d.ts +1 -0
  84. package/dist/types/initiatives/HubInitiative.d.ts +67 -0
  85. package/dist/types/initiatives/HubInitiatives.d.ts +55 -0
  86. package/dist/types/initiatives/defaults.d.ts +11 -0
  87. package/dist/types/initiatives/index.d.ts +2 -0
  88. package/dist/types/projects/HubProject.d.ts +8 -34
  89. package/dist/types/projects/HubProjects.d.ts +2 -12
  90. package/dist/types/search/_internal/index.d.ts +0 -2
  91. package/dist/types/sites/HubSites.d.ts +2 -9
  92. package/package.json +1 -1
  93. package/dist/esm/core/traits/IWithCatalogDefinition.js +0 -1
  94. package/dist/esm/core/traits/IWithCatalogDefinition.js.map +0 -1
  95. package/dist/esm/core/types/IHubEntityManager.js +0 -1
  96. package/dist/esm/core/types/IHubEntityManager.js.map +0 -1
  97. package/dist/esm/core/types/IHubItemEntityManager.js +0 -1
  98. package/dist/esm/core/types/IHubItemEntityManager.js.map +0 -1
  99. package/dist/esm/projects/HubProjectManager.js +0 -241
  100. package/dist/esm/projects/HubProjectManager.js.map +0 -1
  101. package/dist/esm/search/_internal/createQueryFromString.js +0 -22
  102. package/dist/esm/search/_internal/createQueryFromString.js.map +0 -1
  103. package/dist/esm/search/_internal/searchEntities.js +0 -73
  104. package/dist/esm/search/_internal/searchEntities.js.map +0 -1
  105. package/dist/esm/sites/HubSiteManager.js +0 -155
  106. package/dist/esm/sites/HubSiteManager.js.map +0 -1
  107. package/dist/node/core/traits/IWithCatalogDefinition.js.map +0 -1
  108. package/dist/node/core/types/IHubEntityManager.js.map +0 -1
  109. package/dist/node/core/types/IHubItemEntityManager.js.map +0 -1
  110. package/dist/node/projects/HubProjectManager.js +0 -245
  111. package/dist/node/projects/HubProjectManager.js.map +0 -1
  112. package/dist/node/search/_internal/createQueryFromString.js +0 -26
  113. package/dist/node/search/_internal/createQueryFromString.js.map +0 -1
  114. package/dist/node/search/_internal/searchEntities.js +0 -78
  115. package/dist/node/search/_internal/searchEntities.js.map +0 -1
  116. package/dist/node/sites/HubSiteManager.js +0 -159
  117. package/dist/node/sites/HubSiteManager.js.map +0 -1
  118. package/dist/types/core/types/IHubEntityManager.d.ts +0 -46
  119. package/dist/types/core/types/IHubItemEntityManager.d.ts +0 -25
  120. package/dist/types/projects/HubProjectManager.d.ts +0 -153
  121. package/dist/types/search/_internal/createQueryFromString.d.ts +0 -10
  122. package/dist/types/search/_internal/searchEntities.d.ts +0 -23
  123. package/dist/types/sites/HubSiteManager.d.ts +0 -104
@@ -1,153 +0,0 @@
1
- import { IUserRequestOptions } from "@esri/arcgis-rest-auth";
2
- import { IRequestOptions } from "@esri/arcgis-rest-request";
3
- import { ArcGISContextManager } from "../ArcGISContextManager";
4
- import { IArcGISContext, IHubSearchOptions, IHubSearchResponse, IQuery } from "..";
5
- import { IHubEntityManager, IHubProject } from "../core/types";
6
- import { IHubItemEntityManager } from "../core/types/IHubItemEntityManager";
7
- import { IGroup, IItem } from "@esri/arcgis-rest-types";
8
- import { ISharingResponse } from "@esri/arcgis-rest-portal";
9
- /**
10
- * @private
11
- * Centralized functions used to manage IHubProject instances
12
- *
13
- * This class is a convenience wrapper over util functions which
14
- * are also directly accessible for use in scenarios where
15
- * classes are inconvenient.
16
- */
17
- export declare class HubProjectManager implements IHubEntityManager<IHubProject>, IHubItemEntityManager<IHubProject> {
18
- /**
19
- * Hold a context manager, which should be a single instance for
20
- * an application. When authentication changes, the .context
21
- * property on the context manager will be replaced. As long as
22
- * all the fns in this class leverage properties on .context
23
- * everything be kept in sync.
24
- */
25
- private _contextManager;
26
- /**
27
- * Hold context directly. Allows the class to be used in places
28
- * where an `ArcGISContextManager` is not directly available, but
29
- * an `IArcGISContext` is
30
- */
31
- private _context;
32
- /**
33
- * Private so we can employ a factory function should we need
34
- * async work during creation
35
- * @param contextOrManager
36
- */
37
- private constructor();
38
- /**
39
- * Factory function to construct a new HubProjectManager instance.
40
- *
41
- * Note: Used so that we could do async actions in the ctor.
42
- * @param contextOrManager
43
- * @returns
44
- */
45
- static init(contextOrManager: ArcGISContextManager | IArcGISContext): HubProjectManager;
46
- /**
47
- * Getter to abstract how we store the context
48
- */
49
- private get context();
50
- /**
51
- * Create and store new project.
52
- *
53
- * Projects are stored as Items in the Sharing API
54
- * @param project
55
- * @param requestOptions
56
- * @returns
57
- */
58
- create(project: Partial<IHubProject>, requestOptions?: IUserRequestOptions): Promise<IHubProject>;
59
- /**
60
- * Update a project
61
- * @param project
62
- * @param requestOptions
63
- * @returns
64
- */
65
- update(project: IHubProject, requestOptions?: IUserRequestOptions): Promise<IHubProject>;
66
- /**
67
- * Destroy a project.
68
- * This permanently removes the backing Item
69
- * @param id
70
- * @param requestOptions
71
- * @returns
72
- */
73
- delete(id: string, requestOptions?: IUserRequestOptions): Promise<void>;
74
- /**
75
- * Fetch a Project via id or it's slug
76
- *
77
- * This function does not require a user to be
78
- * authenticated, but it does require an `IRequestOptions`
79
- * which contains the portal instance to communicate with
80
- * @param identifier
81
- * @param requestOptions
82
- * @returns
83
- */
84
- fetch(identifier: string, requestOptions?: IRequestOptions): Promise<IHubProject>;
85
- /**
86
- * Search for Projects
87
- *
88
- * @param query
89
- * @param options
90
- */
91
- search(query: string | IQuery, options: IHubSearchOptions): Promise<IHubSearchResponse<IHubProject>>;
92
- /**
93
- * Set the thumbnail for the Project
94
- * @param id
95
- * @param file
96
- * @param filename
97
- * @param requestOptions
98
- * @returns
99
- */
100
- updateThumbnail(project: IHubProject, file: any, filename: string, requestOptions?: IUserRequestOptions): Promise<IHubProject>;
101
- /**
102
- * Convert a Hub Project Item to a IHubProject
103
- * @param item
104
- * @param requestOptions
105
- * @returns
106
- */
107
- fromItem(item: IItem, requestOptions?: IRequestOptions): Promise<IHubProject>;
108
- /**
109
- * Sets the access level of a Hub Project
110
- *
111
- * @param {IHubProject} project
112
- * @param {("public" | "org" | "private")} accessLevel
113
- * @param {IUserRequestOptions} [requestOptions]
114
- * @returns
115
- */
116
- setAccess(project: IHubProject, accessLevel: "public" | "org" | "private", requestOptions?: IUserRequestOptions): Promise<ISharingResponse>;
117
- /**
118
- * Shares a Hub Project to a group
119
- *
120
- * @param {IHubProject} project
121
- * @param {IGroup} group
122
- * @param {IUserRequestOptions} [requestOptions]
123
- * @returns
124
- */
125
- shareToGroup(project: IHubProject, group: IGroup, requestOptions?: IUserRequestOptions): Promise<ISharingResponse>;
126
- /**
127
- * Shares a Hub Project to N Groups.
128
- *
129
- * @param {IHubProject} project
130
- * @param {IGroup[]} groups
131
- * @param {IUserRequestOptions} [requestOptions]
132
- * @returns
133
- */
134
- shareToGroups(project: IHubProject, groups: IGroup[], requestOptions?: IUserRequestOptions): Promise<ISharingResponse[]>;
135
- /**
136
- * Unshares a Hub Project from a group
137
- *
138
- * @param {IHubProject} project
139
- * @param {IGroup} group
140
- * @param {IUserRequestOptions} [requestOptions]
141
- * @returns
142
- */
143
- unshareFromGroup(project: IHubProject, group: IGroup, requestOptions?: IUserRequestOptions): Promise<ISharingResponse>;
144
- /**
145
- * Unshares a Hub Project from N groups.
146
- *
147
- * @param {IHubProject} project
148
- * @param {IGroup[]} groups
149
- * @param {IUserRequestOptions} [requestOptions]
150
- * @returns
151
- */
152
- unshareFromGroups(project: IHubProject, groups: IGroup[], requestOptions?: IUserRequestOptions): Promise<ISharingResponse[]>;
153
- }
@@ -1,10 +0,0 @@
1
- import { EntityType, IQuery } from "../types";
2
- /**
3
- * @private
4
- * Construct a query from a string
5
- * @param value
6
- * @param predicateKey
7
- * @param targetEntity
8
- * @returns
9
- */
10
- export declare function createQueryFromString(value: string, predicateKey: string, targetEntity: EntityType): IQuery;
@@ -1,23 +0,0 @@
1
- import { ISearchOptions } from "@esri/arcgis-rest-portal";
2
- import { IRequestOptions } from "@esri/arcgis-rest-request";
3
- import { IItem } from "@esri/arcgis-rest-types";
4
- import { IHubSearchOptions, IHubSearchResponse, IQuery } from "../types";
5
- /**
6
- * @private
7
- */
8
- export declare type ConversionFunction<T> = (i: IItem, ro?: IRequestOptions) => Promise<T>;
9
- /**
10
- * @private
11
- * Execute a search and convert to a specific entity
12
- * @param query
13
- * @param convertFn
14
- * @param options
15
- * @returns
16
- */
17
- export declare function searchEntities<T>(query: IQuery, convertFn: ConversionFunction<T>, options: IHubSearchOptions): Promise<IHubSearchResponse<T>>;
18
- /**
19
- * @private
20
- * @param convertFn
21
- * @returns
22
- */
23
- export declare function createEntitySearchFn<T>(convertFn: ConversionFunction<T>): (v: ISearchOptions) => Promise<IHubSearchResponse<T>>;
@@ -1,104 +0,0 @@
1
- import { IUserRequestOptions } from "@esri/arcgis-rest-auth";
2
- import { IArcGISContext } from "../ArcGISContext";
3
- import { IHubEntityManager, IHubItemEntityManager, IHubSite } from "../core/types";
4
- import { ArcGISContextManager } from "../ArcGISContextManager";
5
- import { IHubSearchOptions, IQuery } from "../search";
6
- import { IHubRequestOptions, ISearchResponse } from "../types";
7
- import { IItem } from "@esri/arcgis-rest-types";
8
- import { IRequestOptions } from "@esri/arcgis-rest-request";
9
- export declare class HubSiteManager implements IHubEntityManager<IHubSite>, IHubItemEntityManager<IHubSite> {
10
- /**
11
- * Hold a context manager, which should be a single instance for
12
- * an application. When authentication changes, the .context
13
- * property on the context manager will be replaced. As long as
14
- * all the fns in this class leverage properties on .context
15
- * everything be kept in sync.
16
- */
17
- private _contextManager;
18
- /**
19
- * Hold context directly. Allows the class to be used in places
20
- * where an `ArcGISContextManager` is not directly available, but
21
- * an `IArcGISContext` is
22
- */
23
- private _context;
24
- /**
25
- * Private so we can employ a factory function should we need
26
- * async work during creation
27
- * @param contextOrManager
28
- */
29
- private constructor();
30
- /**
31
- * Factory function to construct a new HubProjectManager instance.
32
- *
33
- * Note: Used so that we could do async actions in the ctor.
34
- * @param contextOrManager
35
- * @returns
36
- */
37
- static init(contextOrManager: ArcGISContextManager | IArcGISContext): HubSiteManager;
38
- /**
39
- * Getter to abstract how we store the context
40
- */
41
- private get context();
42
- /**
43
- * Create and store a new Site
44
- *
45
- * This also registers the item for oAuth and
46
- * registers domain names with the hub Domain system
47
- *
48
- * Sites are stored as Items in the Sharing API
49
- * @param site
50
- * @param requestOptions
51
- * @returns
52
- */
53
- create(site: Partial<IHubSite>, requestOptions?: IHubRequestOptions): Promise<IHubSite>;
54
- /**
55
- * Update a Site
56
- * @param site
57
- * @param requestOptions
58
- * @returns
59
- */
60
- update(site: IHubSite, requestOptions?: IHubRequestOptions): Promise<IHubSite>;
61
- /**
62
- * Destroy a Site
63
- * This permanently removes the backing Item,
64
- * and clears the domain entries for it.
65
- * @param id
66
- * @param requestOptions
67
- * @returns
68
- */
69
- delete(id: string, requestOptions?: IHubRequestOptions): Promise<void>;
70
- /**
71
- * Fetch a Site via Id, slug or domain
72
- *
73
- * This function does not require a user to be
74
- * authenticated, but it does require an `IRequestOptions`
75
- * which contains the portal instance to communicate with
76
- * @param identifier
77
- * @param requestOptions
78
- * @returns
79
- */
80
- fetch(identifier: string, requestOptions?: IHubRequestOptions): Promise<IHubSite>;
81
- /**
82
- * Search for Sites
83
- *
84
- * @param filter
85
- * @param opts
86
- */
87
- search(query: string | IQuery, options: IHubSearchOptions): Promise<ISearchResponse<IHubSite>>;
88
- /**
89
- * Set the thumbnail for the Site
90
- * @param id
91
- * @param file
92
- * @param filename
93
- * @param requestOptions
94
- * @returns
95
- */
96
- updateThumbnail(site: IHubSite, file: any, filename: string, requestOptions?: IUserRequestOptions): Promise<IHubSite>;
97
- /**
98
- * Convert a Hub Project Item to a IHubProject
99
- * @param item
100
- * @param requestOptions
101
- * @returns
102
- */
103
- fromItem(item: IItem, requestOptions?: IRequestOptions): Promise<IHubSite>;
104
- }