@esri/hub-common 11.0.0-beta.2 → 11.0.0-beta.5

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 (72) hide show
  1. package/dist/esm/Hub.js +0 -30
  2. package/dist/esm/Hub.js.map +1 -1
  3. package/dist/esm/core/PermissionManager.js +4 -4
  4. package/dist/esm/core/PermissionManager.js.map +1 -1
  5. package/dist/esm/core/behaviors/IWithPermissionBehavior.js +2 -2
  6. package/dist/esm/core/behaviors/IWithPermissionBehavior.js.map +1 -1
  7. package/dist/esm/projects/HubProject.js +9 -174
  8. package/dist/esm/projects/HubProject.js.map +1 -1
  9. package/dist/esm/projects/HubProjects.js +1 -36
  10. package/dist/esm/projects/HubProjects.js.map +1 -1
  11. package/dist/esm/projects/defaults.js +2 -2
  12. package/dist/esm/projects/defaults.js.map +1 -1
  13. package/dist/esm/projects/index.js +0 -1
  14. package/dist/esm/projects/index.js.map +1 -1
  15. package/dist/esm/search/_internal/index.js +0 -2
  16. package/dist/esm/search/_internal/index.js.map +1 -1
  17. package/dist/esm/sites/HubSites.js +7 -34
  18. package/dist/esm/sites/HubSites.js.map +1 -1
  19. package/dist/esm/sites/index.js +0 -1
  20. package/dist/esm/sites/index.js.map +1 -1
  21. package/dist/node/Hub.js +0 -30
  22. package/dist/node/Hub.js.map +1 -1
  23. package/dist/node/core/PermissionManager.js +4 -4
  24. package/dist/node/core/PermissionManager.js.map +1 -1
  25. package/dist/node/core/behaviors/IWithPermissionBehavior.js +2 -2
  26. package/dist/node/core/behaviors/IWithPermissionBehavior.js.map +1 -1
  27. package/dist/node/projects/HubProject.js +9 -174
  28. package/dist/node/projects/HubProject.js.map +1 -1
  29. package/dist/node/projects/HubProjects.js +2 -38
  30. package/dist/node/projects/HubProjects.js.map +1 -1
  31. package/dist/node/projects/defaults.js +2 -2
  32. package/dist/node/projects/defaults.js.map +1 -1
  33. package/dist/node/projects/index.js +0 -1
  34. package/dist/node/projects/index.js.map +1 -1
  35. package/dist/node/search/_internal/index.js +0 -2
  36. package/dist/node/search/_internal/index.js.map +1 -1
  37. package/dist/node/sites/HubSites.js +9 -37
  38. package/dist/node/sites/HubSites.js.map +1 -1
  39. package/dist/node/sites/index.js +0 -1
  40. package/dist/node/sites/index.js.map +1 -1
  41. package/dist/types/Hub.d.ts +0 -18
  42. package/dist/types/core/PermissionManager.d.ts +1 -1
  43. package/dist/types/core/behaviors/IWithPermissionBehavior.d.ts +1 -1
  44. package/dist/types/core/traits/IWithCatalogDefinition.d.ts +2 -2
  45. package/dist/types/core/traits/IWithPermissions.d.ts +1 -1
  46. package/dist/types/core/types/IHubProject.d.ts +2 -2
  47. package/dist/types/projects/HubProjects.d.ts +2 -12
  48. package/dist/types/projects/index.d.ts +0 -1
  49. package/dist/types/search/_internal/index.d.ts +0 -2
  50. package/dist/types/sites/HubSites.d.ts +2 -9
  51. package/dist/types/sites/index.d.ts +0 -1
  52. package/package.json +1 -1
  53. package/dist/esm/projects/HubProjectManager.js +0 -240
  54. package/dist/esm/projects/HubProjectManager.js.map +0 -1
  55. package/dist/esm/search/_internal/createQueryFromString.js +0 -22
  56. package/dist/esm/search/_internal/createQueryFromString.js.map +0 -1
  57. package/dist/esm/search/_internal/searchEntities.js +0 -73
  58. package/dist/esm/search/_internal/searchEntities.js.map +0 -1
  59. package/dist/esm/sites/HubSiteManager.js +0 -155
  60. package/dist/esm/sites/HubSiteManager.js.map +0 -1
  61. package/dist/node/projects/HubProjectManager.js +0 -244
  62. package/dist/node/projects/HubProjectManager.js.map +0 -1
  63. package/dist/node/search/_internal/createQueryFromString.js +0 -26
  64. package/dist/node/search/_internal/createQueryFromString.js.map +0 -1
  65. package/dist/node/search/_internal/searchEntities.js +0 -78
  66. package/dist/node/search/_internal/searchEntities.js.map +0 -1
  67. package/dist/node/sites/HubSiteManager.js +0 -159
  68. package/dist/node/sites/HubSiteManager.js.map +0 -1
  69. package/dist/types/projects/HubProjectManager.d.ts +0 -152
  70. package/dist/types/search/_internal/createQueryFromString.d.ts +0 -10
  71. package/dist/types/search/_internal/searchEntities.d.ts +0 -23
  72. package/dist/types/sites/HubSiteManager.d.ts +0 -104
@@ -1,159 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HubSiteManager = void 0;
4
- const HubError_1 = require("../HubError");
5
- // Node has issues if this is not directly imported
6
- const ArcGISContextManager_1 = require("../ArcGISContextManager");
7
- const HubSites_1 = require("./HubSites");
8
- const setItemThumbnail_1 = require("../items/setItemThumbnail");
9
- class HubSiteManager {
10
- /**
11
- * Private so we can employ a factory function should we need
12
- * async work during creation
13
- * @param contextOrManager
14
- */
15
- constructor(contextOrManager) {
16
- if (contextOrManager instanceof ArcGISContextManager_1.ArcGISContextManager) {
17
- this._contextManager = contextOrManager;
18
- }
19
- else {
20
- this._context = contextOrManager;
21
- }
22
- }
23
- /**
24
- * Factory function to construct a new HubProjectManager instance.
25
- *
26
- * Note: Used so that we could do async actions in the ctor.
27
- * @param contextOrManager
28
- * @returns
29
- */
30
- static init(contextOrManager) {
31
- return new HubSiteManager(contextOrManager);
32
- }
33
- /**
34
- * Getter to abstract how we store the context
35
- */
36
- get context() {
37
- if (this._contextManager) {
38
- return this._contextManager.context;
39
- }
40
- else {
41
- return this._context;
42
- }
43
- }
44
- /**
45
- * Create and store a new Site
46
- *
47
- * This also registers the item for oAuth and
48
- * registers domain names with the hub Domain system
49
- *
50
- * Sites are stored as Items in the Sharing API
51
- * @param site
52
- * @param requestOptions
53
- * @returns
54
- */
55
- async create(site, requestOptions) {
56
- if (requestOptions || this.context.isAuthenticated) {
57
- // ammend in the orgUrlKey
58
- if (!site.orgUrlKey) {
59
- site.orgUrlKey = this.context.portal.urlKey;
60
- }
61
- return HubSites_1.createSite(site, requestOptions || this.context.hubRequestOptions);
62
- }
63
- else {
64
- throw new HubError_1.default("Create Site", "Creating Hub Sites requires authentication.");
65
- }
66
- }
67
- /**
68
- * Update a Site
69
- * @param site
70
- * @param requestOptions
71
- * @returns
72
- */
73
- async update(site, requestOptions) {
74
- if (requestOptions || this.context.isAuthenticated) {
75
- return HubSites_1.updateSite(site, requestOptions || this.context.hubRequestOptions);
76
- }
77
- else {
78
- throw new HubError_1.default("Update Site", "Updating a Hub Site requires authentication.");
79
- }
80
- }
81
- /**
82
- * Destroy a Site
83
- * This permanently removes the backing Item,
84
- * and clears the domain entries for it.
85
- * @param id
86
- * @param requestOptions
87
- * @returns
88
- */
89
- async delete(id, requestOptions) {
90
- if (requestOptions || this.context.isAuthenticated) {
91
- return HubSites_1.destroySite(id, requestOptions || this.context.hubRequestOptions);
92
- }
93
- else {
94
- throw new HubError_1.default("Destroy Site", "Destroying Hub Sites requires authentication.");
95
- }
96
- }
97
- /**
98
- * Fetch a Site via Id, slug or domain
99
- *
100
- * This function does not require a user to be
101
- * authenticated, but it does require an `IRequestOptions`
102
- * which contains the portal instance to communicate with
103
- * @param identifier
104
- * @param requestOptions
105
- * @returns
106
- */
107
- async fetch(identifier, requestOptions) {
108
- try {
109
- if (requestOptions || this.context.hubRequestOptions) {
110
- return HubSites_1._fetchSite(identifier, requestOptions || this.context.hubRequestOptions);
111
- }
112
- else {
113
- throw new HubError_1.default("Fetch Site", "Can not retrieve context.hubRequestOptions from Context Manager. HubSiteManager is configured incorrectly.");
114
- }
115
- }
116
- catch (ex) {
117
- throw new HubError_1.default("Fetch Site", "Can not retrieve context.hubRequestOptions from Context Manager. HubSiteManager is configured incorrectly.", ex);
118
- }
119
- }
120
- /**
121
- * Search for Sites
122
- *
123
- * @param filter
124
- * @param opts
125
- */
126
- async search(query, options) {
127
- // if we were not passed auth, and we have a session, use it
128
- if (!options.authentication && this.context.session) {
129
- options.authentication = this.context.session;
130
- }
131
- return HubSites_1.searchSites(query, options);
132
- }
133
- /**
134
- * Set the thumbnail for the Site
135
- * @param id
136
- * @param file
137
- * @param filename
138
- * @param requestOptions
139
- * @returns
140
- */
141
- async updateThumbnail(site, file, filename, requestOptions) {
142
- const ro = requestOptions || this.context.userRequestOptions;
143
- await setItemThumbnail_1.setItemThumbnail(site.id, file, filename, ro);
144
- // get the item so we have updated props and timestamps
145
- return this.fetch(site.id, requestOptions);
146
- }
147
- /**
148
- * Convert a Hub Project Item to a IHubProject
149
- * @param item
150
- * @param requestOptions
151
- * @returns
152
- */
153
- async fromItem(item, requestOptions) {
154
- const ro = requestOptions || this.context.userRequestOptions;
155
- return HubSites_1.convertItemToSite(item, ro);
156
- }
157
- }
158
- exports.HubSiteManager = HubSiteManager;
159
- //# sourceMappingURL=HubSiteManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HubSiteManager.js","sourceRoot":"","sources":["../../../src/sites/HubSiteManager.ts"],"names":[],"mappings":"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"}
@@ -1,152 +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
- * Centralized functions used to manage IHubProject instances
11
- *
12
- * This class is a convenience wrapper over util functions which
13
- * are also directly accessible for use in scenarios where
14
- * classes are inconvenient.
15
- */
16
- export declare class HubProjectManager implements IHubEntityManager<IHubProject>, IHubItemEntityManager<IHubProject> {
17
- /**
18
- * Hold a context manager, which should be a single instance for
19
- * an application. When authentication changes, the .context
20
- * property on the context manager will be replaced. As long as
21
- * all the fns in this class leverage properties on .context
22
- * everything be kept in sync.
23
- */
24
- private _contextManager;
25
- /**
26
- * Hold context directly. Allows the class to be used in places
27
- * where an `ArcGISContextManager` is not directly available, but
28
- * an `IArcGISContext` is
29
- */
30
- private _context;
31
- /**
32
- * Private so we can employ a factory function should we need
33
- * async work during creation
34
- * @param contextOrManager
35
- */
36
- private constructor();
37
- /**
38
- * Factory function to construct a new HubProjectManager instance.
39
- *
40
- * Note: Used so that we could do async actions in the ctor.
41
- * @param contextOrManager
42
- * @returns
43
- */
44
- static init(contextOrManager: ArcGISContextManager | IArcGISContext): HubProjectManager;
45
- /**
46
- * Getter to abstract how we store the context
47
- */
48
- private get context();
49
- /**
50
- * Create and store new project.
51
- *
52
- * Projects are stored as Items in the Sharing API
53
- * @param project
54
- * @param requestOptions
55
- * @returns
56
- */
57
- create(project: Partial<IHubProject>, requestOptions?: IUserRequestOptions): Promise<IHubProject>;
58
- /**
59
- * Update a project
60
- * @param project
61
- * @param requestOptions
62
- * @returns
63
- */
64
- update(project: IHubProject, requestOptions?: IUserRequestOptions): Promise<IHubProject>;
65
- /**
66
- * Destroy a project.
67
- * This permanently removes the backing Item
68
- * @param id
69
- * @param requestOptions
70
- * @returns
71
- */
72
- delete(id: string, requestOptions?: IUserRequestOptions): Promise<void>;
73
- /**
74
- * Fetch a Project via id or it's slug
75
- *
76
- * This function does not require a user to be
77
- * authenticated, but it does require an `IRequestOptions`
78
- * which contains the portal instance to communicate with
79
- * @param identifier
80
- * @param requestOptions
81
- * @returns
82
- */
83
- fetch(identifier: string, requestOptions?: IRequestOptions): Promise<IHubProject>;
84
- /**
85
- * Search for Projects
86
- *
87
- * @param query
88
- * @param options
89
- */
90
- search(query: string | IQuery, options: IHubSearchOptions): Promise<IHubSearchResponse<IHubProject>>;
91
- /**
92
- * Set the thumbnail for the Project
93
- * @param id
94
- * @param file
95
- * @param filename
96
- * @param requestOptions
97
- * @returns
98
- */
99
- updateThumbnail(project: IHubProject, file: any, filename: string, requestOptions?: IUserRequestOptions): Promise<IHubProject>;
100
- /**
101
- * Convert a Hub Project Item to a IHubProject
102
- * @param item
103
- * @param requestOptions
104
- * @returns
105
- */
106
- fromItem(item: IItem, requestOptions?: IRequestOptions): Promise<IHubProject>;
107
- /**
108
- * Sets the access level of a Hub Project
109
- *
110
- * @param {IHubProject} project
111
- * @param {("public" | "org" | "private")} accessLevel
112
- * @param {IUserRequestOptions} [requestOptions]
113
- * @returns
114
- */
115
- setAccess(project: IHubProject, accessLevel: "public" | "org" | "private", requestOptions?: IUserRequestOptions): Promise<ISharingResponse>;
116
- /**
117
- * Shares a Hub Project to a group
118
- *
119
- * @param {IHubProject} project
120
- * @param {IGroup} group
121
- * @param {IUserRequestOptions} [requestOptions]
122
- * @returns
123
- */
124
- shareToGroup(project: IHubProject, group: IGroup, requestOptions?: IUserRequestOptions): Promise<ISharingResponse>;
125
- /**
126
- * Shares a Hub Project to N Groups.
127
- *
128
- * @param {IHubProject} project
129
- * @param {IGroup[]} groups
130
- * @param {IUserRequestOptions} [requestOptions]
131
- * @returns
132
- */
133
- shareToGroups(project: IHubProject, groups: IGroup[], requestOptions?: IUserRequestOptions): Promise<ISharingResponse[]>;
134
- /**
135
- * Unshares a Hub Project from a group
136
- *
137
- * @param {IHubProject} project
138
- * @param {IGroup} group
139
- * @param {IUserRequestOptions} [requestOptions]
140
- * @returns
141
- */
142
- unshareFromGroup(project: IHubProject, group: IGroup, requestOptions?: IUserRequestOptions): Promise<ISharingResponse>;
143
- /**
144
- * Unshares a Hub Project from N groups.
145
- *
146
- * @param {IHubProject} project
147
- * @param {IGroup[]} groups
148
- * @param {IUserRequestOptions} [requestOptions]
149
- * @returns
150
- */
151
- unshareFromGroups(project: IHubProject, groups: IGroup[], requestOptions?: IUserRequestOptions): Promise<ISharingResponse[]>;
152
- }
@@ -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
- }