jmapserver-ng-core-types 2.0.0 → 2.0.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/all-enums.ts CHANGED
@@ -278,14 +278,6 @@ export const ALL_MAP_RASTER_SCHEME_TYPES: JMAP_RASTER_SCHEME_TYPES[] = [
278
278
  JMAP_RASTER_SCHEME_TYPES.XYZ
279
279
  ]
280
280
 
281
- export const ALL_SERVER_TYPES: JSERVER_TYPES[] = [JSERVER_TYPES.LEGACY, JSERVER_TYPES.SAAS]
282
-
283
- export const ALL_SERVER_SAAS_STATUS: JSERVER_SAAS_STATUS[] = [
284
- JSERVER_SAAS_STATUS.STARTING,
285
- JSERVER_SAAS_STATUS.UP,
286
- JSERVER_SAAS_STATUS.DOWN
287
- ]
288
-
289
281
  export const ALL_JORGANIZATION_EXTERNAL_API_KEY_TYPES: JORGANIZATION_EXTERNAL_API_KEY_TYPES[] = [
290
282
  JORGANIZATION_EXTERNAL_API_KEY_TYPES.MAPBOX_ACCESS_TOKEN
291
283
  ]
package/index.ts CHANGED
@@ -841,6 +841,7 @@ export interface JLayerService {
841
841
  exists(layerId: JId): boolean
842
842
  attributeExists(layerId: JId, attributeName: string): boolean
843
843
  getById(layerId: JId): JLayerTreeElement
844
+ getLayerAttributesWithStatistics(layerId: JId): Promise<JLayerAttribute[]>
844
845
  getSelfOrChildren(layerId: JId): JLayer[]
845
846
  getName(layerId: JId): string
846
847
  getDescription(layerId: JId): string
@@ -892,7 +893,6 @@ export interface JUserService {
892
893
  setPreference(name: string, value: string | undefined): Promise<void>
893
894
  setToken(token: string, organizationId?: string): Promise<JSessionData>
894
895
  login(login: string, password: string): Promise<JSessionData>
895
- loginIntoOrganization(organizationId: string): Promise<JSessionData>
896
896
  loginWithIdentityProvider(providerId: string): void
897
897
  logout(): Promise<void>
898
898
  isLoggedIn(): boolean
@@ -903,9 +903,7 @@ export interface JUserService {
903
903
  changeFullName(newFullName: string): Promise<void>
904
904
  getMinimumPasswordLength(): number
905
905
  isPasswordCompliant(password: string): boolean
906
- getPasswordPolicyCompliance(
907
- password: string
908
- ): JJMapServerPasswordPolicyCompliance | JJMapCloudPasswordPolicyCompliance
906
+ getPasswordPolicyCompliance(password: string): JJMapPasswordPolicyCompliance
909
907
  isPseudoUser(): boolean
910
908
  isSystemUser(): boolean
911
909
  getOrganizationId(): string
@@ -949,10 +947,7 @@ export interface JExtensionService {
949
947
  export interface JServerService {
950
948
  isReady(): boolean
951
949
  getVersion(): JServerVersion
952
- getType(): JSERVER_TYPES
953
- isSaas(): boolean
954
- isLegacy(): boolean
955
- getMinimumVersion(): JMinimumServerVersion
950
+ getMinimumVersion(): JServerVersion
956
951
  isMinimumVersionRespected(serverInfo?: JServerInfo): boolean
957
952
  getShortVersion(): string
958
953
  isStandardLoginAvailable(): boolean
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmapserver-ng-core-types",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "JMap Server specific version of JMap Server NG Core types and interfaces",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/public/core.d.ts CHANGED
@@ -129,48 +129,6 @@ declare namespace JMap {
129
129
  */
130
130
  function getVersion(): JServerVersion
131
131
 
132
- /**
133
- * **JMap.Server.getType**
134
- *
135
- * Returns the server type.
136
- *
137
- * @throws if the server is not ready (info from server has not been fetched). Call JMap.Server.isReady() to know this information.
138
- * @example ```ts
139
- *
140
- * // display the server type, "legacy" (JMap 7) or "saas" (JMap Cloud)
141
- * console.log(`Server type is "${JMap.Server.getType()}"`)
142
- * ```
143
- */
144
- function getType(): JSERVER_TYPES
145
-
146
- /**
147
- * **JMap.Server.isSaas**
148
- *
149
- * Returns true if the server is a JMap Server instance.
150
- *
151
- * @throws if the server is not ready (info from server has not been fetched). Call JMap.Server.isReady() to know this information.
152
- * @example ```ts
153
- *
154
- * // display the type of server
155
- * console.log(`Server type is "${JMap.Server.isSaas() ? 'JMap Cloud' : 'JMap 7'}"`)
156
- * ```
157
- */
158
- function isSaas(): boolean
159
-
160
- /**
161
- * **JMap.Server.isLegacy**
162
- *
163
- * Returns true if the server is a JMap 7 instance.
164
- *
165
- * @throws if the server is not ready (info from server has not been fetched). Call JMap.Server.isReady() to know this information.
166
- * @example ```ts
167
- *
168
- * // display the type of server
169
- * console.log(`Server type is "${JMap.Server.isLegacy() ? 'JMap 7' : 'JMap Cloud'}"`)
170
- * ```
171
- */
172
- function isLegacy(): boolean
173
-
174
132
  /**
175
133
  * **JMap.Server.getMinimumVersion**
176
134
  *
@@ -183,7 +141,7 @@ declare namespace JMap {
183
141
  * JMap.Server.getMinimumVersion()
184
142
  * ```
185
143
  */
186
- function getMinimumVersion(): JMinimumServerVersion
144
+ function getMinimumVersion(): JServerVersion
187
145
 
188
146
  /**
189
147
  * **JMap.Server.isMinimumVersionRespected**
@@ -1831,6 +1789,21 @@ declare namespace JMap {
1831
1789
  */
1832
1790
  function getById(layerId: JId): JLayerTreeElement
1833
1791
 
1792
+ /**
1793
+ * **JMap.Layer.getLayerAttributesWithStatistics**
1794
+ *
1795
+ * Returns the layer's attributes with their statistics.
1796
+ *
1797
+ * @throws Error if no layer found for the id
1798
+ * @param layerId The JMap layer id
1799
+ * @example ```ts
1800
+ *
1801
+ * // returns the attributes of layer id=3 with their statistics
1802
+ * JMap.Layer.getLayerAttributesWithStatistics(3)
1803
+ * ```
1804
+ */
1805
+ function getLayerAttributesWithStatistics(layerId: JId): Promise<JLayerAttribute[]>
1806
+
1834
1807
  /**
1835
1808
  * **JMap.Layer.getSelfOrChildren**
1836
1809
  *
@@ -6155,44 +6128,6 @@ declare namespace JMap {
6155
6128
  */
6156
6129
  function login(login: string, password: string): Promise<JSessionData>
6157
6130
 
6158
- /**
6159
- * **JMap.User.loginIntoOrganization**
6160
- *
6161
- * For JMapCloud only.
6162
- *
6163
- * 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.
6164
- * This method can also be used to switch between organizations while a user is already logged in.
6165
- *
6166
- * @throws Error if user is not authenticated
6167
- * @param organizationId
6168
- * @example ```ts
6169
- *
6170
- * const userLogin = "jdo@mycompany.com"
6171
- * const userPassword = "xxx"
6172
- *
6173
- * // Open a new user session, and get back user data from server
6174
- * JMap.User
6175
- * .login(userLogin, userPassword)
6176
- * .then(sessionData => {
6177
- * console.log(`User ${userLogin} has been authenticated, will login to one of it's organization`)
6178
- * if(sessionData.organizationInfos.length === 0){
6179
- * console.error("User has no organization")
6180
- * }else{
6181
- * const organizationInfo = sessionData.organizationInfos[sessionData.organizationInfos.length - 1]
6182
- * JMap.User
6183
- * .loginIntoOrganization(organizationInfo.id)
6184
- * .then(sessionData2=>{
6185
- * console.log(`User ${userLogin} has been logged into organization "${sessionData2.currentOrganization.name}", his session token is "${sessionData2.accessToken}"`)
6186
- * })
6187
- * }
6188
- * })
6189
- * .catch(error => {
6190
- * console.error(`Cannot loggin ${userLogin}, error: `, error)
6191
- * })
6192
- * ```
6193
- */
6194
- function loginIntoOrganization(organizationId: string): Promise<JSessionData>
6195
-
6196
6131
  /**
6197
6132
  * **JMap.User.loginWithIdentityProvider**
6198
6133
  *
@@ -6462,7 +6397,7 @@ declare namespace JMap {
6462
6397
  /**
6463
6398
  * ***JMap.User.getPasswordPolicyCompliance***
6464
6399
  *
6465
- * Returns an object describing the password compliance with the platform's password policy (JMap Server or JMap Cloud)
6400
+ * Returns an object describing the password compliance with the platform's password policy (JMap Server )
6466
6401
  *
6467
6402
  * @example ```ts
6468
6403
  *
@@ -6479,9 +6414,7 @@ declare namespace JMap {
6479
6414
  * /*
6480
6415
  * ```
6481
6416
  */
6482
- function getPasswordPolicyCompliance(
6483
- password: string
6484
- ): JJMapServerPasswordPolicyCompliance | JJMapCloudPasswordPolicyCompliance
6417
+ function getPasswordPolicyCompliance(password: string): JJMapPasswordPolicyCompliance
6485
6418
 
6486
6419
  /**
6487
6420
  * ***JMap.User.isPseudoUser***
@@ -347,8 +347,18 @@ declare interface JLayerAttribute {
347
347
  name: string
348
348
  label: string
349
349
  type: JLAYER_ATTRIBUTE_TYPES
350
+ attributeStatistics: JLayerAttributeStatistics | null
350
351
  }
351
352
 
353
+ declare interface JLayerAttributeStatistics {
354
+ tooManyUniqueValues: boolean
355
+ uniqueValues?: any[]
356
+ minimumValue?: number
357
+ maximumValue?: number
358
+ sum?: number
359
+ average?: number
360
+ standardDeviation?: number
361
+ }
352
362
  declare interface JLayerTreeElement {
353
363
  id: JId
354
364
  name: string
@@ -1,17 +1,3 @@
1
- // ALL_SERVER_TYPES in all-enum.ts
2
- declare const enum JSERVER_TYPES {
3
- LEGACY = "legacy",
4
- SAAS = "saas"
5
- }
6
-
7
- // ALL_SERVER_SAAS_STATUS in all-enum.ts
8
- declare const enum JSERVER_SAAS_STATUS {
9
- STARTING = "STARTING",
10
- UP = "UP",
11
- DOWN = "DOWN"
12
- }
13
-
14
- // ALL_SERVER_SAAS_STATUS in all-enum.ts
15
1
  declare const enum JSERVER_IDENTITY_PROVIDER_TYPES {
16
2
  SSO = "sso",
17
3
  AUTH0_SPA = "auth0-spa"
@@ -21,24 +7,10 @@ declare interface JServerIdentityProviderById {
21
7
  [id: string]: JServerAnyIdentityProvider
22
8
  }
23
9
 
24
- declare interface JServerSaasServiceById {
25
- [id: string]: JServerSaasService
26
- }
27
-
28
10
  declare interface JServerInfo {
29
11
  identityProviderById: JServerIdentityProviderById
30
12
  standardLoginAvailable: boolean
31
13
  version: JServerVersion
32
- type: JSERVER_TYPES
33
- saasServiceById?: JServerSaasServiceById
34
- }
35
-
36
- declare interface JServerSaasService {
37
- id: string
38
- name: string
39
- version: string
40
- status: JSERVER_SAAS_STATUS
41
- restBaseUrl: string
42
14
  }
43
15
 
44
16
  declare type JServerAnyIdentityProvider = JServerIdentityProviderAuth0Password | JServerIdentityProviderSso
@@ -68,11 +40,6 @@ declare interface JServerVersion {
68
40
  buildNumber: number
69
41
  }
70
42
 
71
- declare interface JMinimumServerVersion {
72
- legacy: JServerVersion
73
- saas: JServerVersion
74
- }
75
-
76
43
  declare interface JServerInfoReadyEventParams {
77
44
  serverInfo: JServerInfo
78
45
  isMinimumVersionRespected: boolean
@@ -7,10 +7,6 @@ declare interface JTokenInfo {
7
7
  * The JMap user session token (legacy) or access token (Saas JMap Cloud).
8
8
  */
9
9
  accessToken: string
10
- /**
11
- * The refresh token.
12
- */
13
- refreshToken: string
14
10
  /**
15
11
  * The access token expiration time in seconds.
16
12
  */
@@ -79,17 +75,10 @@ declare interface JOrganizationExternalApiKey {
79
75
  type: JORGANIZATION_EXTERNAL_API_KEY_TYPES
80
76
  }
81
77
 
82
- declare interface JJMapServerPasswordPolicyCompliance {
78
+ declare interface JJMapPasswordPolicyCompliance {
83
79
  hasMinimumLength: boolean
84
80
  }
85
81
 
86
- declare interface JJMapCloudPasswordPolicyCompliance extends JJMapServerPasswordPolicyCompliance {
87
- hasLowercaseLetters: boolean
88
- hasUppercaseLetters: boolean
89
- hasNumbers: boolean
90
- hasSpecialCharacters: boolean
91
- }
92
-
93
82
  // ALL_JORGANIZATION_EXTERNAL_API_KEY_TYPES in all-enum.ts
94
83
  declare const enum JORGANIZATION_EXTERNAL_API_KEY_TYPES {
95
84
  MAPBOX_ACCESS_TOKEN = "MAPBOX_ACCESS_TOKEN"