jmapcloud-ng-core-types 1.0.39 → 1.0.40
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/all-enums.ts +30 -1
- package/index.ts +8 -3
- package/package.json +3 -2
- package/public/core.d.ts +22 -51
- package/public/jmap/server.d.ts +21 -14
- package/public/jmap/startup-options.d.ts +50 -4
- package/public/jmap/user.d.ts +52 -20
package/all-enums.ts
CHANGED
|
@@ -275,7 +275,17 @@ export const ALL_MAP_RASTER_SCHEME_TYPES: JMAP_RASTER_SCHEME_TYPES[] = [
|
|
|
275
275
|
JMAP_RASTER_SCHEME_TYPES.XYZ
|
|
276
276
|
]
|
|
277
277
|
|
|
278
|
-
export const
|
|
278
|
+
export const ALL_SERVER_IDENTITY_PROVIDER_TYPES: JSERVER_IDENTITY_PROVIDER_TYPES[] = [
|
|
279
|
+
JSERVER_IDENTITY_PROVIDER_TYPES.AUTH0_SPA,
|
|
280
|
+
JSERVER_IDENTITY_PROVIDER_TYPES.JMAP_CLOUD,
|
|
281
|
+
JSERVER_IDENTITY_PROVIDER_TYPES.ANONYMOUS
|
|
282
|
+
]
|
|
283
|
+
|
|
284
|
+
export const ALL_SERVER_MICRO_SERVICE_STATUSES: JSERVER_MICRO_SERVICE_STATUSES[] = [
|
|
285
|
+
JSERVER_MICRO_SERVICE_STATUSES.STARTING,
|
|
286
|
+
JSERVER_MICRO_SERVICE_STATUSES.UP,
|
|
287
|
+
JSERVER_MICRO_SERVICE_STATUSES.DOWN
|
|
288
|
+
]
|
|
279
289
|
|
|
280
290
|
export const ALL_JORGANIZATION_EXTERNAL_API_KEY_TYPES: JORGANIZATION_EXTERNAL_API_KEY_TYPES[] = [
|
|
281
291
|
JORGANIZATION_EXTERNAL_API_KEY_TYPES.MAPBOX_ACCESS_TOKEN
|
|
@@ -285,3 +295,22 @@ export const ALL_TERRAIN_ILLUMINATION_ANCHOR_TYPES: JTERRAIN_ILLUMINATION_ANCHOR
|
|
|
285
295
|
JTERRAIN_ILLUMINATION_ANCHOR_TYPES.MAP,
|
|
286
296
|
JTERRAIN_ILLUMINATION_ANCHOR_TYPES.VIEWPORT
|
|
287
297
|
]
|
|
298
|
+
|
|
299
|
+
export const ALL_LOGIN_STATUS: LOGIN_STATUS[] = [
|
|
300
|
+
LOGIN_STATUS.LOGGED_IN,
|
|
301
|
+
LOGIN_STATUS.LOGGED_OUT,
|
|
302
|
+
LOGIN_STATUS.LOGGING_IN,
|
|
303
|
+
LOGIN_STATUS.LOGIN_ERROR,
|
|
304
|
+
LOGIN_STATUS.LOGIN_ERROR_INSUFFICIENT_ROLES,
|
|
305
|
+
LOGIN_STATUS.SWITCHING_ORG
|
|
306
|
+
]
|
|
307
|
+
|
|
308
|
+
export const ALL_ROLES: ROLES[] = [
|
|
309
|
+
ROLES.ORG_ADMIN,
|
|
310
|
+
ROLES.ORG_EDITOR,
|
|
311
|
+
ROLES.ORG_VIEWER,
|
|
312
|
+
ROLES.ACCOUNT_MANAGER,
|
|
313
|
+
ROLES.SYS_ADMIN
|
|
314
|
+
]
|
|
315
|
+
|
|
316
|
+
export const ALL_MEMBER_ROLES: MEMBER_ROLES[] = [ROLES.ORG_ADMIN, ROLES.ORG_EDITOR, ROLES.ORG_VIEWER]
|
package/index.ts
CHANGED
|
@@ -565,11 +565,16 @@ export interface JUserState extends JTokenInfo {
|
|
|
565
565
|
isLoggingIn: boolean
|
|
566
566
|
isLoggingIntoOrganization: boolean
|
|
567
567
|
isReloadingSession: boolean
|
|
568
|
-
identity:
|
|
568
|
+
identity: JUser
|
|
569
569
|
currentOrganization: JOrganization // the organization in which the user is currently logged in
|
|
570
570
|
organizationInfos: JOrganizationInfo[] // the info about all organizations the user belongs to
|
|
571
571
|
informations: JUserInfo[]
|
|
572
572
|
changePasswordAllowed: boolean
|
|
573
|
+
identityProviderType: JSERVER_IDENTITY_PROVIDER_TYPES
|
|
574
|
+
// from portal
|
|
575
|
+
loginStatus: LOGIN_STATUS
|
|
576
|
+
loginStatusDetailTranslationKey: string
|
|
577
|
+
callbackAtTokenRefresh: (() => void) | null
|
|
573
578
|
}
|
|
574
579
|
|
|
575
580
|
export interface JLanguageState {
|
|
@@ -948,8 +953,8 @@ export interface JUserService {
|
|
|
948
953
|
removePreference(name: string): Promise<string | null>
|
|
949
954
|
setPreference(name: string, value: string | undefined): Promise<void>
|
|
950
955
|
setToken(token: string, organizationId?: string): Promise<JSessionData>
|
|
951
|
-
login(login
|
|
952
|
-
loginIntoOrganization(organizationId: string): Promise<JSessionData>
|
|
956
|
+
login(login?: string, password?: string): Promise<JSessionData> | Promise<void>
|
|
957
|
+
loginIntoOrganization(organizationId: string): Promise<JSessionData> | Promise<void>
|
|
953
958
|
loginWithIdentityProvider(providerId: string): void
|
|
954
959
|
logout(): Promise<void>
|
|
955
960
|
isLoggedIn(): boolean
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jmapcloud-ng-core-types",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.40",
|
|
4
4
|
"description": "JMap Cloud specific version of JMap Cloud NG Core types and interfaces",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -31,9 +31,10 @@
|
|
|
31
31
|
"typedoc": "^0.25.13"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
+
"@auth0/auth0-spa-js": "^2.1.3",
|
|
34
35
|
"@types/geojson": "^7946.0.14",
|
|
35
36
|
"geojson": "^0.5.0",
|
|
36
37
|
"maplibre-gl": "^4.3.1",
|
|
37
38
|
"redux": "^5.0.1"
|
|
38
39
|
}
|
|
39
|
-
}
|
|
40
|
+
}
|
package/public/core.d.ts
CHANGED
|
@@ -6356,8 +6356,13 @@ declare namespace JMap {
|
|
|
6356
6356
|
/**
|
|
6357
6357
|
* **JMap.User.login**
|
|
6358
6358
|
*
|
|
6359
|
-
* The login function, returns a promise.
|
|
6360
|
-
*
|
|
6359
|
+
* The login function, returns a promise.
|
|
6360
|
+
*
|
|
6361
|
+
* When using the new oAuth2 authentication scheme, no username or password are required. It triggers a redirect to
|
|
6362
|
+
* the identity provider, resolving with not data.
|
|
6363
|
+
*
|
|
6364
|
+
* When using the legacy REST API-based authentication scheme, username and password are mandatory. The method will
|
|
6365
|
+
* make a call to the server and if login is successful resolve the promise providing the user session data.
|
|
6361
6366
|
*
|
|
6362
6367
|
* If an error occurs, 3 differents string message can be returned :
|
|
6363
6368
|
* - ***"user.login.error.credential"*** => Bad username or password
|
|
@@ -6365,8 +6370,8 @@ declare namespace JMap {
|
|
|
6365
6370
|
* - ***"user.login.error.unexpected"*** => Unexpected error client side
|
|
6366
6371
|
*
|
|
6367
6372
|
* @throws Error if bad credentials or server error.
|
|
6368
|
-
* @param login The user's username
|
|
6369
|
-
* @param password The user's password
|
|
6373
|
+
* @param login The user's username (when using {@link JCoreOptions.legacyAuthentication})
|
|
6374
|
+
* @param password The user's password (when using {@link JCoreOptions.legacyAuthentication}
|
|
6370
6375
|
* @example
|
|
6371
6376
|
* ```ts
|
|
6372
6377
|
* const userLogin = "jdo@mycompany.com"
|
|
@@ -6383,14 +6388,15 @@ declare namespace JMap {
|
|
|
6383
6388
|
* })
|
|
6384
6389
|
* ```
|
|
6385
6390
|
*/
|
|
6386
|
-
function login(login
|
|
6391
|
+
function login(login?: string, password?: string): Promise<void> | Promise<JSessionData>
|
|
6387
6392
|
|
|
6388
6393
|
/**
|
|
6389
6394
|
* **JMap.User.loginIntoOrganization**
|
|
6390
6395
|
*
|
|
6391
|
-
*
|
|
6396
|
+
* When using the new oAuth2 authentication setup, will redirect the user to the identity provider and be redirected back. The method resolves with nothing.
|
|
6397
|
+
*
|
|
6398
|
+
* When using the legacy REST API-based authentication method, it sets and returns Session Data specific to a JMap Cloud organization. You need to be previously authenticated via the {@link JMap.User.login} method before calling this method.
|
|
6392
6399
|
*
|
|
6393
|
-
* Sets and returns Session Data specific to a JMap Cloud organization. You need to be previously authenticated via the {@link JMap.User.login} method before calling this method.
|
|
6394
6400
|
* This method can also be used to switch between organizations while a user is already logged in.
|
|
6395
6401
|
*
|
|
6396
6402
|
* @throws Error if user is not authenticated
|
|
@@ -6400,7 +6406,7 @@ declare namespace JMap {
|
|
|
6400
6406
|
* const userLogin = "jdo@mycompany.com"
|
|
6401
6407
|
* const userPassword = "xxx"
|
|
6402
6408
|
*
|
|
6403
|
-
* // Open a new user session, and get back user data from server
|
|
6409
|
+
* // Open a new user session in a REST API-based authentication setup, and get back user data from server
|
|
6404
6410
|
* JMap.User
|
|
6405
6411
|
* .login(userLogin, userPassword)
|
|
6406
6412
|
* .then(sessionData => {
|
|
@@ -6421,13 +6427,16 @@ declare namespace JMap {
|
|
|
6421
6427
|
* })
|
|
6422
6428
|
* ```
|
|
6423
6429
|
*/
|
|
6424
|
-
function loginIntoOrganization(organizationId: string): Promise<JSessionData>
|
|
6430
|
+
function loginIntoOrganization(organizationId: string): Promise<JSessionData> | Promise<void>
|
|
6425
6431
|
|
|
6426
6432
|
/**
|
|
6427
6433
|
* **JMap.User.loginWithIdentityProvider**
|
|
6428
6434
|
*
|
|
6435
|
+
* Not currently supported in JMap Cloud
|
|
6436
|
+
*
|
|
6429
6437
|
* Logs in the user using the specified Identity Provider. See {@link JMap.Server.getAllIdentityProvidersById} for info about Identity providers
|
|
6430
6438
|
*
|
|
6439
|
+
* @deprecated
|
|
6431
6440
|
* @example
|
|
6432
6441
|
* ```ts
|
|
6433
6442
|
* // fetch all Identity Providers
|
|
@@ -6445,7 +6454,7 @@ declare namespace JMap {
|
|
|
6445
6454
|
/**
|
|
6446
6455
|
* **JMap.User.logout**
|
|
6447
6456
|
*
|
|
6448
|
-
* Logout function.
|
|
6457
|
+
* Logout function. Makes a call to the server to invalidate the session.
|
|
6449
6458
|
*
|
|
6450
6459
|
* If an error occurs, 2 differents string message can be returned :
|
|
6451
6460
|
* - ***"user.logout.error.server"*** => Unexpected error while requesting the server
|
|
@@ -6481,37 +6490,13 @@ declare namespace JMap {
|
|
|
6481
6490
|
*
|
|
6482
6491
|
* Sets the user session data. Useful if you want to make a call to our Rest API and set the session token by yourself.
|
|
6483
6492
|
*
|
|
6493
|
+
* Calling this method will acctivate {@link JCoreOptions.legacyAuthentication}
|
|
6484
6494
|
*
|
|
6485
|
-
* This process is a bit different for JMap Server than for JMap CLoud.
|
|
6486
6495
|
*
|
|
6487
|
-
*
|
|
6488
|
-
*
|
|
6489
|
-
* For JMap Cloud, you need to fetch a ***refresh token*** from the JMap Cloud Rest API, and pass this refresh token, along with the the optional organisation Id, to the {@link JMap.User.setToken} method. Beware that a refresh token can only be used once, it is invalidated afterward
|
|
6496
|
+
* You need to fetch a ***refresh token*** from the JMap Cloud Rest API, and pass this refresh token, along with the optional organisation Id, to the {@link JMap.User.setToken} method. Beware that a refresh token can only be used once, it is invalidated afterward
|
|
6490
6497
|
*
|
|
6491
6498
|
* Fetching data from a REST API can be done with the curl command-line tool (https://curl.haxx.se/docs/)
|
|
6492
6499
|
*
|
|
6493
|
-
* a JMap Server example:
|
|
6494
|
-
*
|
|
6495
|
-
* ```sh
|
|
6496
|
-
* # getting a session token from JMap Server
|
|
6497
|
-
* curl -X POST "https://my-jmap-server/services/rest/v2.0/session" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"username\": \"jdo@company.com\", \"password\": \"xxx\", \"type\": \"NG\"}"
|
|
6498
|
-
* ```
|
|
6499
|
-
*
|
|
6500
|
-
* will return something like:
|
|
6501
|
-
*
|
|
6502
|
-
* ```js
|
|
6503
|
-
* {
|
|
6504
|
-
* "message": "The result is a NG session info",
|
|
6505
|
-
* "status": "OK",
|
|
6506
|
-
* "result": {
|
|
6507
|
-
* ...
|
|
6508
|
-
* "sessionId": 23558109, // session id in the Rest API response is the session token.
|
|
6509
|
-
* ...
|
|
6510
|
-
* }
|
|
6511
|
-
* }
|
|
6512
|
-
* ```
|
|
6513
|
-
*
|
|
6514
|
-
* a JMap Cloud example:
|
|
6515
6500
|
*
|
|
6516
6501
|
* ```sh
|
|
6517
6502
|
* # getting a session token from JMap Cloud
|
|
@@ -6544,21 +6529,7 @@ declare namespace JMap {
|
|
|
6544
6529
|
* @param organizationId The JMap Cloud organization id
|
|
6545
6530
|
* @example
|
|
6546
6531
|
* ```ts
|
|
6547
|
-
* // Set the user session token
|
|
6548
|
-
* JMap.User.setToken("23558109")
|
|
6549
|
-
* .then(userData => {
|
|
6550
|
-
* console.log(`Session token = "${userData.accessToken}""`)
|
|
6551
|
-
* console.log(`The session belongs to ${userData.user.fullName}`)
|
|
6552
|
-
* })
|
|
6553
|
-
* .catch(error => {
|
|
6554
|
-
* if (error === "user.token.invalid") {
|
|
6555
|
-
* console.log(`Invalid token`)
|
|
6556
|
-
* } else {
|
|
6557
|
-
* console.log(`Server error`)
|
|
6558
|
-
* }
|
|
6559
|
-
* })
|
|
6560
|
-
*
|
|
6561
|
-
* // Set the user session token for JMap Cloud
|
|
6532
|
+
* // Set the user session token
|
|
6562
6533
|
* JMap.User.setToken("v1.MRq [.....] Rehef72YWws","my-organization-id")
|
|
6563
6534
|
* .then(userData => {
|
|
6564
6535
|
* console.log(`Session token = "${userData.accessToken}""`)
|
package/public/jmap/server.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
//
|
|
2
|
-
declare const enum
|
|
1
|
+
// ALL_SERVER_MICRO_SERVICE_STATUSES in all-enum.ts
|
|
2
|
+
declare const enum JSERVER_MICRO_SERVICE_STATUSES {
|
|
3
3
|
STARTING = "STARTING",
|
|
4
4
|
UP = "UP",
|
|
5
5
|
DOWN = "DOWN"
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
//
|
|
8
|
+
// ALL_SERVER_IDENTITY_PROVIDER_TYPES in all-enum.ts
|
|
9
9
|
declare const enum JSERVER_IDENTITY_PROVIDER_TYPES {
|
|
10
|
-
|
|
10
|
+
ANONYMOUS = "anonymous",
|
|
11
|
+
JMAP_CLOUD = "jmapcloud.io",
|
|
11
12
|
AUTH0_SPA = "auth0-spa"
|
|
12
13
|
}
|
|
13
14
|
|
|
@@ -15,7 +16,7 @@ declare interface JServerIdentityProviderById {
|
|
|
15
16
|
[id: string]: JServerAnyIdentityProvider
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
declare interface
|
|
19
|
+
declare interface JServerMicroServiceById {
|
|
19
20
|
[id: string]: JServerService
|
|
20
21
|
}
|
|
21
22
|
|
|
@@ -23,18 +24,21 @@ declare interface JServerInfo {
|
|
|
23
24
|
identityProviderById: JServerIdentityProviderById
|
|
24
25
|
standardLoginAvailable: boolean
|
|
25
26
|
version: JServerVersion
|
|
26
|
-
serviceById
|
|
27
|
+
serviceById: JServerMicroServiceById
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
declare interface JServerService {
|
|
30
31
|
id: string
|
|
31
32
|
name: string
|
|
32
33
|
version: string
|
|
33
|
-
status:
|
|
34
|
+
status: JSERVER_MICRO_SERVICE_STATUSES
|
|
34
35
|
restBaseUrl: string
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
declare type JServerAnyIdentityProvider =
|
|
38
|
+
declare type JServerAnyIdentityProvider =
|
|
39
|
+
| JServerIdentityProviderAuth0Spa
|
|
40
|
+
| JServerIdentityProviderJMapCloudNative
|
|
41
|
+
| JServerIdentityProviderJMapCloudAnonymous
|
|
38
42
|
|
|
39
43
|
declare interface JServerIdentityProviderBase {
|
|
40
44
|
id: string
|
|
@@ -42,17 +46,20 @@ declare interface JServerIdentityProviderBase {
|
|
|
42
46
|
type: JSERVER_IDENTITY_PROVIDER_TYPES
|
|
43
47
|
}
|
|
44
48
|
|
|
45
|
-
declare interface
|
|
49
|
+
declare interface JServerIdentityProviderAuth0Spa extends JServerIdentityProviderBase {
|
|
46
50
|
type: JSERVER_IDENTITY_PROVIDER_TYPES.AUTH0_SPA
|
|
47
51
|
domain: string
|
|
48
52
|
clientId: string
|
|
49
|
-
|
|
53
|
+
audience: string
|
|
54
|
+
logoutRedirectUrl: string
|
|
50
55
|
}
|
|
51
56
|
|
|
52
|
-
declare interface
|
|
53
|
-
type: JSERVER_IDENTITY_PROVIDER_TYPES.
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
declare interface JServerIdentityProviderJMapCloudNative extends JServerIdentityProviderBase {
|
|
58
|
+
type: JSERVER_IDENTITY_PROVIDER_TYPES.JMAP_CLOUD
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
declare interface JServerIdentityProviderJMapCloudAnonymous extends JServerIdentityProviderBase {
|
|
62
|
+
type: JSERVER_IDENTITY_PROVIDER_TYPES.ANONYMOUS
|
|
56
63
|
}
|
|
57
64
|
|
|
58
65
|
declare interface JServerVersion {
|
|
@@ -230,6 +230,9 @@ declare interface JCoreOptions {
|
|
|
230
230
|
restBaseUrl?: string
|
|
231
231
|
|
|
232
232
|
/**
|
|
233
|
+
*
|
|
234
|
+
* "***anonymous***" must be specified together with a valid {@link JCoreOptions.organizationId}, otherwise it will not be taken into account
|
|
235
|
+
*
|
|
233
236
|
* If the project you access can be accessed anonymously,
|
|
234
237
|
* you are not forced to pass a session token but you have
|
|
235
238
|
* to explicitly tell the JMap Cloud NG library to log as an anonymous
|
|
@@ -247,6 +250,8 @@ declare interface JCoreOptions {
|
|
|
247
250
|
* restBaseUrl: "http://my-jmap-server/services/rest/v2.0",
|
|
248
251
|
* // The anonymous parameter
|
|
249
252
|
* anonymous: true
|
|
253
|
+
* // The organization id
|
|
254
|
+
* organizationId: "some-valid-id"
|
|
250
255
|
* ... // other optional JMAP params
|
|
251
256
|
* }
|
|
252
257
|
* </script>
|
|
@@ -261,11 +266,52 @@ declare interface JCoreOptions {
|
|
|
261
266
|
anonymous?: boolean
|
|
262
267
|
|
|
263
268
|
/**
|
|
264
|
-
* The JMap
|
|
269
|
+
* The default authentication method in NG is now using an oAuth2 setup. This allows sharing session with JMap Cloud's Portal.
|
|
270
|
+
*
|
|
271
|
+
* However, if for technical reasons you need to revert to a REST API-based technique of authentication, you can do it by setting ***legacyAuthentication*** to "true".
|
|
272
|
+
*
|
|
273
|
+
* {@link JCoreOptions.anonymous} has precedence over ***legacyAuthentication***.
|
|
274
|
+
*
|
|
275
|
+
* If you specify a {@link JCoreOptions.token}, ***legacyAuthentication*** will automatically be activated. This may change in the future.
|
|
276
|
+
*
|
|
277
|
+
* ```html
|
|
278
|
+
* <html>
|
|
279
|
+
* ...
|
|
280
|
+
* <body>
|
|
281
|
+
* <script type="text/javascript">
|
|
282
|
+
* window.JMAP_OPTIONS = {
|
|
283
|
+
* // a valid project id
|
|
284
|
+
* projectId: "<project-uuid>",
|
|
285
|
+
* // a valid JMap Cloud Rest url
|
|
286
|
+
* restBaseUrl: "http://my-jmap-server/",
|
|
287
|
+
* // The legacyAuthentication parameter
|
|
288
|
+
* legacyAuthentication: true
|
|
289
|
+
* ... // other optional JMAP params
|
|
290
|
+
* }
|
|
291
|
+
* </script>
|
|
292
|
+
*
|
|
293
|
+
* ... your web page
|
|
294
|
+
*
|
|
295
|
+
* <script defer type="text/javascript" src="https://cdn.jsdelivr.net/npm/jmap-core-js@x.x.x/public/"></script>
|
|
296
|
+
* </body>
|
|
297
|
+
* </html>
|
|
298
|
+
* ```
|
|
299
|
+
*/
|
|
300
|
+
legacyAuthentication?: boolean
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* A JMap user's session refresh token.
|
|
304
|
+
*
|
|
305
|
+
* If you want to open a session automatically without user interaction and you don't use the library anonymously
|
|
306
|
+
* (see the ***{@link JCoreOptions.anonymous}*** parameter in this section), you must provide a JMap Cloud refresh
|
|
307
|
+
* token to the JMap library to initialize the user session.
|
|
308
|
+
*
|
|
309
|
+
* A refresh token can be used only once.
|
|
265
310
|
*
|
|
266
|
-
*
|
|
311
|
+
* Specifying ***token*** will automatically activate {@link JCoreOptions.legacyAuthentication}
|
|
267
312
|
*
|
|
268
|
-
* To get a
|
|
313
|
+
* To get a refresh token, you can use the JMap Rest API on your JMap Cloud Server.
|
|
314
|
+
* See {@link JMap.User.setToken} for detailed examples on how to fetch a token through JMap's REST API.
|
|
269
315
|
*
|
|
270
316
|
* So to start the library using the fetched token you can configure your startup options like this :
|
|
271
317
|
* ```html
|
|
@@ -274,7 +320,7 @@ declare interface JCoreOptions {
|
|
|
274
320
|
* <body>
|
|
275
321
|
* <script type="text/javascript">
|
|
276
322
|
* window.JMAP_OPTIONS = {
|
|
277
|
-
* token: "
|
|
323
|
+
* token: "some-valid-refresh-token"
|
|
278
324
|
* }
|
|
279
325
|
* </script>
|
|
280
326
|
* ...
|
package/public/jmap/user.d.ts
CHANGED
|
@@ -1,54 +1,82 @@
|
|
|
1
|
+
// ALL_LOGIN_STATUS in all-enum.ts
|
|
2
|
+
declare const enum LOGIN_STATUS {
|
|
3
|
+
LOGGING_IN = "LOGGING_IN",
|
|
4
|
+
LOGGED_IN = "LOGGED_IN",
|
|
5
|
+
LOGGED_OUT = "LOGGED_OUT",
|
|
6
|
+
LOGIN_ERROR = "LOGIN_ERROR",
|
|
7
|
+
LOGIN_ERROR_INSUFFICIENT_ROLES = "LOGIN_ERROR_INSUFFICIENT_ROLES",
|
|
8
|
+
SWITCHING_ORG = "SWITCHING_ORG"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// ALL_ROLES in all-enum.ts
|
|
12
|
+
declare const enum ROLES {
|
|
13
|
+
SYS_ADMIN = "SYS_ADMIN",
|
|
14
|
+
ORG_ADMIN = "ORG_ADMIN",
|
|
15
|
+
ORG_EDITOR = "ORG_EDITOR",
|
|
16
|
+
ORG_VIEWER = "ORG_VIEWER",
|
|
17
|
+
ACCOUNT_MANAGER = "ACCOUNT_MANAGER"
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// ALL_MEMBER_ROLES in all-enum.ts
|
|
21
|
+
declare type MEMBER_ROLES = ROLES.ORG_ADMIN | ROLES.ORG_EDITOR | ROLES.ORG_VIEWER
|
|
22
|
+
|
|
1
23
|
declare interface JUserEventSessionChangedParams {
|
|
2
24
|
session: JSessionData
|
|
3
25
|
}
|
|
4
26
|
|
|
5
27
|
declare interface JTokenInfo {
|
|
6
28
|
/**
|
|
7
|
-
* The JMap
|
|
29
|
+
* The JMap Cloud access token.
|
|
8
30
|
*/
|
|
9
31
|
accessToken: string
|
|
32
|
+
|
|
33
|
+
// TODO: remove
|
|
10
34
|
/**
|
|
11
35
|
* The refresh token.
|
|
36
|
+
* @deprecated
|
|
12
37
|
*/
|
|
13
38
|
refreshToken: string
|
|
39
|
+
|
|
40
|
+
// TODO: remove
|
|
14
41
|
/**
|
|
15
42
|
* The access token expiration time in seconds.
|
|
43
|
+
* @deprecated
|
|
16
44
|
*/
|
|
17
45
|
accessTokenExpiration: number
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The access token expiration time in miliseconds.
|
|
49
|
+
*/
|
|
50
|
+
accessTokenExpirationInMSecs: number
|
|
51
|
+
roles: ROLES[]
|
|
52
|
+
organizationId: string
|
|
53
|
+
idToken: import("@auth0/auth0-spa-js").IdToken
|
|
54
|
+
picture: string
|
|
18
55
|
}
|
|
19
56
|
|
|
20
|
-
declare interface JSessionData extends JTokenInfo {
|
|
57
|
+
declare interface JSessionData extends JUser, JTokenInfo {
|
|
21
58
|
/**
|
|
22
59
|
* The user permission to change his password
|
|
60
|
+
* @deprecated
|
|
23
61
|
*/
|
|
24
62
|
changePasswordAllowed: boolean
|
|
63
|
+
|
|
25
64
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* ```ts
|
|
30
|
-
* user: {
|
|
31
|
-
* username: "jdo@company.com",
|
|
32
|
-
* fullName: "John Do",
|
|
33
|
-
* admin: true
|
|
34
|
-
* }
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
user: JUserIdentity
|
|
38
|
-
/**
|
|
39
|
-
* Infos about the user's organizations, only for JMap Cloud servers.
|
|
65
|
+
* Infos about the user's organizations.
|
|
40
66
|
*/
|
|
41
67
|
organizationInfos: JOrganizationInfo[]
|
|
68
|
+
|
|
42
69
|
/**
|
|
43
|
-
* THe JMap Cloud organization in which the user is currently logged in
|
|
70
|
+
* THe JMap Cloud organization in which the user is currently logged in.
|
|
44
71
|
*/
|
|
45
72
|
currentOrganization: JOrganization
|
|
46
73
|
}
|
|
47
74
|
|
|
48
|
-
declare interface
|
|
49
|
-
|
|
50
|
-
fullName: string
|
|
75
|
+
declare interface JUser {
|
|
76
|
+
name: string
|
|
51
77
|
email: string
|
|
78
|
+
organizationInfos: JOrganizationInfo[]
|
|
79
|
+
roles: ROLES[]
|
|
52
80
|
}
|
|
53
81
|
|
|
54
82
|
declare interface JUserInfo {
|
|
@@ -65,6 +93,10 @@ declare interface JOrganizationInfo {
|
|
|
65
93
|
primaryColor: string
|
|
66
94
|
backgroundColor: string
|
|
67
95
|
active: boolean
|
|
96
|
+
createdBy: string
|
|
97
|
+
creationDate: Date
|
|
98
|
+
lastModifiedBy: string
|
|
99
|
+
lastModificationDate: Date
|
|
68
100
|
}
|
|
69
101
|
|
|
70
102
|
declare interface JOrganization extends JOrganizationInfo {
|