@esri/hub-common 9.11.0 → 9.13.2
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.
- package/dist/es2017/ArcGISContext.js +194 -0
- package/dist/es2017/ArcGISContext.js.map +1 -0
- package/dist/es2017/ArcGISContextState.js +203 -0
- package/dist/es2017/ArcGISContextState.js.map +1 -0
- package/dist/es2017/content/index.js +124 -1
- package/dist/es2017/content/index.js.map +1 -1
- package/dist/es2017/index.js +1 -0
- package/dist/es2017/index.js.map +1 -1
- package/dist/es2017/utils/index.js +1 -0
- package/dist/es2017/utils/index.js.map +1 -1
- package/dist/es2017/utils/sessionLocalStorage.js +47 -0
- package/dist/es2017/utils/sessionLocalStorage.js.map +1 -0
- package/dist/esm/ArcGISContext.js +238 -0
- package/dist/esm/ArcGISContext.js.map +1 -0
- package/dist/esm/ArcGISContextState.js +285 -0
- package/dist/esm/ArcGISContextState.js.map +1 -0
- package/dist/esm/content/index.js +124 -1
- package/dist/esm/content/index.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/index.js +1 -0
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/sessionLocalStorage.js +50 -0
- package/dist/esm/utils/sessionLocalStorage.js.map +1 -0
- package/dist/node/ArcGISContext.js +198 -0
- package/dist/node/ArcGISContext.js.map +1 -0
- package/dist/node/ArcGISContextState.js +207 -0
- package/dist/node/ArcGISContextState.js.map +1 -0
- package/dist/node/content/index.js +125 -2
- package/dist/node/content/index.js.map +1 -1
- package/dist/node/index.js +1 -0
- package/dist/node/index.js.map +1 -1
- package/dist/node/utils/index.js +1 -0
- package/dist/node/utils/index.js.map +1 -1
- package/dist/node/utils/sessionLocalStorage.js +53 -0
- package/dist/node/utils/sessionLocalStorage.js.map +1 -0
- package/dist/types/ArcGISContext.d.ts +110 -0
- package/dist/types/ArcGISContextState.d.ts +129 -0
- package/dist/types/content/index.d.ts +13 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/types.d.ts +5 -2
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/sessionLocalStorage.d.ts +23 -0
- package/dist/umd/common.umd.js +3421 -2695
- package/dist/umd/common.umd.js.map +1 -1
- package/dist/umd/common.umd.min.js +1 -1
- package/dist/umd/common.umd.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { IUser, IUserRequestOptions, UserSession } from "@esri/arcgis-rest-auth";
|
|
2
|
+
import { IPortal } from "@esri/arcgis-rest-portal";
|
|
3
|
+
import { IRequestOptions } from "@esri/arcgis-rest-request";
|
|
4
|
+
import { IHubRequestOptions } from ".";
|
|
5
|
+
/**
|
|
6
|
+
* Defined the properties of the ArcGISContext.state
|
|
7
|
+
* object. This wll be a class instance, and when authentication
|
|
8
|
+
* changes, the instance will be replaced. This is done to allow
|
|
9
|
+
* frameworks like React or Ember to bind into the .state property
|
|
10
|
+
* and react when it changes.
|
|
11
|
+
*/
|
|
12
|
+
export interface IArcGISContextState {
|
|
13
|
+
id: number;
|
|
14
|
+
session: UserSession;
|
|
15
|
+
isAuthenticated: boolean;
|
|
16
|
+
userRequestOptions: IUserRequestOptions;
|
|
17
|
+
requestOptions: IRequestOptions;
|
|
18
|
+
hubRequestOptions: IHubRequestOptions;
|
|
19
|
+
portalUrl: string;
|
|
20
|
+
sharingApiUrl: string;
|
|
21
|
+
hubUrl: string;
|
|
22
|
+
isPortal: boolean;
|
|
23
|
+
discussionsServiceUrl: string;
|
|
24
|
+
hubSearchServiceUrl: string;
|
|
25
|
+
domainServiceUrl: string;
|
|
26
|
+
eventsConfig: any;
|
|
27
|
+
hubEnabled: boolean;
|
|
28
|
+
communityOrgId: string;
|
|
29
|
+
communityOrgHostname: string;
|
|
30
|
+
communityOrgUrl: string;
|
|
31
|
+
helperServices: any;
|
|
32
|
+
currentUser: IUser;
|
|
33
|
+
portal: IPortal;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
export interface IArcGISContextStateOptions {
|
|
39
|
+
id: number;
|
|
40
|
+
portalUrl: string;
|
|
41
|
+
hubUrl: string;
|
|
42
|
+
authentication?: UserSession;
|
|
43
|
+
portalSelf?: IPortal;
|
|
44
|
+
currentUser?: IUser;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* @internal
|
|
48
|
+
* Thin class just used to enable getters
|
|
49
|
+
*
|
|
50
|
+
* This class should not be used by anything other than
|
|
51
|
+
* the ArcGISContext class
|
|
52
|
+
*/
|
|
53
|
+
export declare class ArcGISContextState implements IArcGISContextState {
|
|
54
|
+
id: number;
|
|
55
|
+
private _authentication;
|
|
56
|
+
private _portalUrl;
|
|
57
|
+
private _hubUrl;
|
|
58
|
+
private _portalSelf;
|
|
59
|
+
private _currentUser;
|
|
60
|
+
constructor(opts: IArcGISContextStateOptions);
|
|
61
|
+
/**
|
|
62
|
+
* Return the UserSession if authenticated
|
|
63
|
+
*/
|
|
64
|
+
get session(): UserSession;
|
|
65
|
+
/**
|
|
66
|
+
* Return boolean indicating if authenticatio is present
|
|
67
|
+
*/
|
|
68
|
+
get isAuthenticated(): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Return `IUserRequestOptions`, which is used for REST-JS
|
|
71
|
+
* functions which require authentication information.
|
|
72
|
+
*
|
|
73
|
+
* If context is not authenticated, this function will throw
|
|
74
|
+
*/
|
|
75
|
+
get userRequestOptions(): IUserRequestOptions;
|
|
76
|
+
/**
|
|
77
|
+
* Return `IRequestOptions`, which is used by REST-JS functions
|
|
78
|
+
* which *may* use authentication information if provided.
|
|
79
|
+
*
|
|
80
|
+
* If context is not authenticated, this function just returns
|
|
81
|
+
* the `portal` property, which informs REST-JS what Sharing API
|
|
82
|
+
* instance to use (i.e. AGO, Enterprise etc)
|
|
83
|
+
*/
|
|
84
|
+
get requestOptions(): IRequestOptions;
|
|
85
|
+
/**
|
|
86
|
+
* Return a `IHubRequestOptions` object
|
|
87
|
+
*/
|
|
88
|
+
get hubRequestOptions(): IHubRequestOptions;
|
|
89
|
+
/**
|
|
90
|
+
* Return the portal url.
|
|
91
|
+
*
|
|
92
|
+
* If authenticated @ ArcGIS Online, it will return
|
|
93
|
+
* the https://org.env.arcgis.com
|
|
94
|
+
*
|
|
95
|
+
* If authenticated @ ArcGIS Enterprise, it will return
|
|
96
|
+
* https://portalHostname, which includes the web adaptor
|
|
97
|
+
*/
|
|
98
|
+
get portalUrl(): string;
|
|
99
|
+
/**
|
|
100
|
+
* Returns the url to the sharing api
|
|
101
|
+
* i.e. https://myorg.maps.arcgis.com/sharing/rest
|
|
102
|
+
*/
|
|
103
|
+
get sharingApiUrl(): string;
|
|
104
|
+
get hubUrl(): string;
|
|
105
|
+
/**
|
|
106
|
+
* Returns boolean indicating if the backing system
|
|
107
|
+
* is ArcGIS Enterprise (formerly ArcGIS Portal) or not
|
|
108
|
+
*/
|
|
109
|
+
get isPortal(): boolean;
|
|
110
|
+
get discussionsServiceUrl(): string;
|
|
111
|
+
get hubSearchServiceUrl(): string;
|
|
112
|
+
get domainServiceUrl(): string;
|
|
113
|
+
get eventsConfig(): any;
|
|
114
|
+
/**
|
|
115
|
+
* Returns boolean indicating if the current user
|
|
116
|
+
* belongs to an organization that has licensed
|
|
117
|
+
* ArcGIS Hub
|
|
118
|
+
*/
|
|
119
|
+
get hubEnabled(): boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Return Hub Community Org Id, if defined
|
|
122
|
+
*/
|
|
123
|
+
get communityOrgId(): string;
|
|
124
|
+
get communityOrgHostname(): string;
|
|
125
|
+
get communityOrgUrl(): string;
|
|
126
|
+
get helperServices(): any;
|
|
127
|
+
get currentUser(): IUser;
|
|
128
|
+
get portal(): IPortal;
|
|
129
|
+
}
|
|
@@ -210,6 +210,19 @@ export declare function datasetToItem(dataset: DatasetResource): IItem;
|
|
|
210
210
|
* @returns new content
|
|
211
211
|
*/
|
|
212
212
|
export declare const setContentType: (content: IHubContent, type: string) => IHubContent;
|
|
213
|
+
/**
|
|
214
|
+
* Compute the content type icon based on the normalizedType
|
|
215
|
+
* @param normalizedType
|
|
216
|
+
* @returns content type icon
|
|
217
|
+
*/
|
|
218
|
+
export declare const getContentTypeIcon: (normalizedType: string) => any;
|
|
219
|
+
/**
|
|
220
|
+
* Compute the content type label
|
|
221
|
+
* @param normalizedType
|
|
222
|
+
* @param isProxied
|
|
223
|
+
* @returns content type label
|
|
224
|
+
*/
|
|
225
|
+
export declare const getContentTypeLabel: (normalizedType: string, isProxied: boolean) => string;
|
|
213
226
|
/**
|
|
214
227
|
* returns a new content that has the specified hubId and updated identifier
|
|
215
228
|
* @param content orignal content
|
package/dist/types/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export * from "./utils";
|
|
|
18
18
|
export * from "./i18n";
|
|
19
19
|
export * from "./request";
|
|
20
20
|
export * from "./surveys";
|
|
21
|
+
export * from "./ArcGISContext";
|
|
21
22
|
import OperationStack from "./OperationStack";
|
|
22
23
|
import OperationError from "./OperationError";
|
|
23
24
|
export { OperationStack, OperationError };
|
package/dist/types/types.d.ts
CHANGED
|
@@ -82,7 +82,11 @@ export interface ISolutionTemplate extends IModel {
|
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
84
|
export declare type GenericAsyncFunc = (...args: any) => Promise<any>;
|
|
85
|
-
|
|
85
|
+
/**
|
|
86
|
+
* @internal
|
|
87
|
+
* This just adds user to the IPortal interface
|
|
88
|
+
*/
|
|
89
|
+
export interface IHubRequestOptionsPortalSelf extends IPortal {
|
|
86
90
|
user?: IUser;
|
|
87
91
|
}
|
|
88
92
|
export interface IHubRequestOptions extends IRequestOptions {
|
|
@@ -415,4 +419,3 @@ export interface ISearchResponse<T> {
|
|
|
415
419
|
next: (params?: any) => Promise<ISearchResponse<T>>;
|
|
416
420
|
facets?: IFacet[];
|
|
417
421
|
}
|
|
418
|
-
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { UserSession } from "@esri/arcgis-rest-auth";
|
|
2
|
+
/**
|
|
3
|
+
* Remove any serialized sessions associated with the passed clientId
|
|
4
|
+
* from a browser's local storage
|
|
5
|
+
* @param clientId oAuth Client Id
|
|
6
|
+
* @param win optional window (used for testing)
|
|
7
|
+
*/
|
|
8
|
+
export declare function clearSession(clientId: string, win?: any): void;
|
|
9
|
+
/**
|
|
10
|
+
* Re-hydrate a UserSession from a browser's local storage.
|
|
11
|
+
* If not found,
|
|
12
|
+
* @param clientId oAuth Client Id
|
|
13
|
+
* @param win optional window (used for testing)
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
export declare function getSession(clientId: string, win?: any): UserSession | null;
|
|
17
|
+
/**
|
|
18
|
+
* Serialize a UserSession into a browser's local storage
|
|
19
|
+
* @param clientId oAuth Client Id
|
|
20
|
+
* @param session UserSession
|
|
21
|
+
* @param win optional window (used for testing)
|
|
22
|
+
*/
|
|
23
|
+
export declare function saveSession(clientId: string, session: UserSession, win?: any): void;
|