jmapcloud-ng-core-types 1.1.10 → 1.1.12

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
@@ -314,3 +314,12 @@ export const ALL_ROLES: ROLES[] = [
314
314
  ]
315
315
 
316
316
  export const ALL_MEMBER_ROLES: MEMBER_ROLES[] = [ROLES.ORG_ADMIN, ROLES.ORG_EDITOR, ROLES.ORG_VIEWER]
317
+
318
+ export const ALL_TABLE_ATTRIBUTE_TYPES: JTABLE_ATTRIBUTE_TYPES[] = [
319
+ JTABLE_ATTRIBUTE_TYPES.BINARY,
320
+ JTABLE_ATTRIBUTE_TYPES.BOOLEAN,
321
+ JTABLE_ATTRIBUTE_TYPES.DATE,
322
+ JTABLE_ATTRIBUTE_TYPES.DATETIME,
323
+ JTABLE_ATTRIBUTE_TYPES.NUMBER,
324
+ JTABLE_ATTRIBUTE_TYPES.STRING
325
+ ]
package/index.ts CHANGED
@@ -146,7 +146,7 @@ export interface JPhotoService {
146
146
  }
147
147
 
148
148
  export interface JFeatureService {
149
- getById(layerId: JId, featureId: JId): Promise<GeoJSON.Feature>
149
+ getById(layerId: JId, featureId: JId, includeAllAttributes?: boolean): Promise<GeoJSON.Feature>
150
150
  getByIds(layerId: JId, featureIds: JId[]): Promise<GeoJSON.Feature[]>
151
151
  getByLayerId(layerId: JId, bbox: JBoundaryBox): Promise<GeoJSON.Feature[]>
152
152
  geometryUpdateById(params: JFeatureGeometryUpdateParams): Promise<GeoJSON.Feature>
@@ -566,8 +566,7 @@ export interface JServerState extends JServerInfo {
566
566
  export type JHistoryListener = (oldValue: string | undefined, newValue: string | undefined) => void
567
567
 
568
568
  export interface JFormJMCService {
569
- getJsonForm(dataSourceId: string): Promise<JJsonFormSchemas>
570
- getForm(layerId: string): Promise<JFormJMC>
569
+ getForm(dataSourceId: string): Promise<JFormJMC | null>
571
570
  }
572
571
 
573
572
  export interface JFormService {
@@ -892,16 +891,17 @@ export interface JLayerService {
892
891
  deleteLayer(layerId: JId): void
893
892
  hasInformationReport(layerId: JId): boolean
894
893
  openInformationReportInNewTab(layerId: JId, featureIds: JId[]): Promise<string>
895
- getDataSourceAttributes(dataSourceId: JId): Promise<JAttribute[]>
894
+ getDataSourceAttributes(layerId: JId): Promise<JDataSourceAttribute[]>
896
895
  }
897
896
 
898
897
  export interface JTableService {
899
898
  getTables(): JTable[]
900
- getTableData(dataSourceId: JId, params: JTableDataParams): Promise<JTableData>
899
+ getTableData(tableId: JId, params: JTableDataParams): Promise<JTableData>
901
900
  getById(tableId: JId): JTable
902
- createRow(dataSourceId: JId, row: { [key: string]: any }): Promise<void>
903
- updateRow(dataSourceId: JId, rowId: number, row: { [key: string]: any }): Promise<void>
904
- deleteRow(dataSourceId: JId, rowId: number): Promise<void>
901
+ createRow(tableId: JId, row: { [key: string]: any }): Promise<void>
902
+ updateRow(tableId: JId, rowId: number, row: { [key: string]: any }): Promise<void>
903
+ deleteRow(tableId: JId, rowId: number): Promise<void>
904
+ getDataSourceAttributes(tableId: JId): Promise<JDataSourceAttribute[]>
905
905
  }
906
906
 
907
907
  export interface JLayerSearchService {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmapcloud-ng-core-types",
3
- "version": "1.1.10",
3
+ "version": "1.1.12",
4
4
  "description": "JMap Cloud specific version of JMap Cloud NG Core types and interfaces",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -25,8 +25,7 @@
25
25
  },
26
26
  "homepage": "https://github.com/k2geospatial/jmapcloud-ng-core-types#readme",
27
27
  "devDependencies": {
28
- "typedoc": "^0.25.13",
29
- "patch-package": "^8.0.0"
28
+ "typedoc": "^0.25.13"
30
29
  },
31
30
  "dependencies": {
32
31
  "@auth0/auth0-spa-js": "^2.1.3",
package/public/core.d.ts CHANGED
@@ -443,6 +443,7 @@ declare namespace JMap {
443
443
  *
444
444
  * @param layerId the JMap layer id
445
445
  * @param featureId the JMap feature id
446
+ * @param includeAllAttributes true to include all the attributes even the one not bounded to the layer
446
447
  * @throws if layer or feature not found
447
448
  * @example
448
449
  * ```ts
@@ -453,7 +454,7 @@ declare namespace JMap {
453
454
  * .catch(error => console.error("An error occured", error))
454
455
  * ```
455
456
  */
456
- function getById(layerId: JId, featureId: JId): Promise<GeoJSON.Feature>
457
+ function getById(layerId: JId, featureId: JId, includeAllAttributes?: boolean): Promise<GeoJSON.Feature>
457
458
 
458
459
  /**
459
460
  * **JMap.Feature.getByLayerId**
@@ -2421,18 +2422,18 @@ declare namespace JMap {
2421
2422
  /**
2422
2423
  * **JMap.Layer.getDataSourceAttributes**
2423
2424
  *
2424
- * Returns attributes, for a given dataSource.
2425
+ * Returns the attributes of the associated datasource, for a given layer.
2425
2426
  *
2426
- * @param dataSourceId the JMap dataSource id
2427
- * @throws if dataSourceId not valid or dataSource not found
2427
+ * @param layerId the JMap layer id
2428
+ * @throws if layerId not valid or dataSource not found
2428
2429
  * @example
2429
2430
  * ```ts
2430
- * // Returns attributes, for dataSource id=3
2431
+ * // Returns datasource attributes, for layer id=3
2431
2432
  * JMap.Layer
2432
2433
  * .getDataSourceAttributes(3)
2433
2434
  * ```
2434
2435
  **/
2435
- function getDataSourceAttributes(dataSourceId: JId): Promise<JAttribute[]>
2436
+ function getDataSourceAttributes(layerId: JId): Promise<JDataSourceAttribute[]>
2436
2437
  }
2437
2438
 
2438
2439
  /**
@@ -5745,8 +5746,8 @@ declare namespace JMap {
5745
5746
  * .getAllProjects()
5746
5747
  * .then(projects => {
5747
5748
  * // Here you can start using the projects
5748
- * console.log(`Projects count = "${projects.length}"`
5749
- * }))
5749
+ * console.log(`Projects count = "${projects.length}"`)
5750
+ * })
5750
5751
  * ```
5751
5752
  */
5752
5753
  function getAllProjects(): Promise<JProject[]>
@@ -9990,45 +9991,24 @@ declare namespace JMap {
9990
9991
  * Here you'll find all form related methods
9991
9992
  */
9992
9993
  namespace FormJMC {
9993
- /**
9994
- * ***JMap.FormJMC.getJsonForm***
9995
- *
9996
- * Returns the jsonForm schema and uiSchema for a data source.
9997
- *
9998
- * fetch the attributes of a data source and then builds and returns the schema and uiSchema required for jsonForms. The schemas will be null if there is no attributes on the data source
9999
- *
10000
- * @param dataSourceId the JMap data source id
10001
- * @example
10002
- * ```ts
10003
- * // returns the schema and uiSchema for data source id=f47ac10b-58cc-4372-a567-0e02b2c3d479
10004
-
10005
-
10006
- * JMap.FormJMC
10007
- * .getJsonForm("f47ac10b-58cc-4372-a567-0e02b2c3d479")
10008
- * .then(schemas => console.log("jsonForms schemas of data source f47ac10b-58cc-4372-a567-0e02b2c3d479", schemas))
10009
- * .catch(error => console.error("An error occurred when getting jsonForm schema", error))
10010
- * ```
10011
- */
10012
- function getJsonForm(dataSourceId: JId): Promise<JJsonFormSchemas>
10013
-
10014
9994
  /**
10015
9995
  * ***JMap.FormJMC.getForm***
10016
9996
  *
10017
- * Returns the form for a layer.
9997
+ * Returns the form for a data source.
10018
9998
  *
10019
- * @param layerId the JMap layer id
9999
+ * @param dataSourceId the JMap data source id
10020
10000
  * @example
10021
10001
  * ```ts
10022
- * // returns the form for layer id=f47ac10b-58cc-4372-a567-0e02b2c3d479
10002
+ * // returns the form for data source id=f47ac10b-58cc-4372-a567-0e02b2c3d479
10023
10003
 
10024
10004
 
10025
10005
  * JMap.FormJMC
10026
10006
  * .getForm("f47ac10b-58cc-4372-a567-0e02b2c3d479")
10027
- * .then(form => console.log("form of layer f47ac10b-58cc-4372-a567-0e02b2c3d479", form))
10028
- * .catch(error => console.error("An error occurred when getting the form for layer f47ac10b-58cc-4372-a567-0e02b2c3d479", error))
10007
+ * .then(form => console.log("form of data source f47ac10b-58cc-4372-a567-0e02b2c3d479", form))
10008
+ * .catch(error => console.error("An error occurred when getting the form for data source f47ac10b-58cc-4372-a567-0e02b2c3d479", error))
10029
10009
  * ```
10030
10010
  */
10031
- function getForm(layerId: JId): Promise<JFormJMC>
10011
+ function getForm(dataSourceId: JId): Promise<JFormJMC | null>
10032
10012
  }
10033
10013
  /**
10034
10014
  * **JMap.Form**
@@ -12493,11 +12473,11 @@ declare namespace JMap {
12493
12473
  /**
12494
12474
  * **JMap.Table.getTableData**
12495
12475
  *
12496
- * Asynchronously retrieves the JMap table data for a specified tabular data source ID.
12476
+ * Asynchronously retrieves the JMap table data for a specified ID.
12497
12477
  *
12498
12478
  * @throws {Error} If no data source is found for the given ID.
12499
12479
  *
12500
- * @param {JId} dataSourceId - The ID of the JMap data source.
12480
+ * @param {JId} tableId - The ID of the JMap Table.
12501
12481
  * @param {JTableDataParams} params - Includes the following optional parameters: startIndex, limit, filter, sort.
12502
12482
  * startIndex: The starting index for data retrieval (zero-based).
12503
12483
  * limit: The maximum number of records to retrieve.
@@ -12516,7 +12496,7 @@ declare namespace JMap {
12516
12496
  * });
12517
12497
  * ```
12518
12498
  */
12519
- function getTableData(dataSourceId: JId, params: JTableDataParams): Promise<JTableData>
12499
+ function getTableData(tableId: JId, params: JTableDataParams): Promise<JTableData>
12520
12500
 
12521
12501
  /**
12522
12502
  * **JMap.Table.getById**
@@ -12538,7 +12518,7 @@ declare namespace JMap {
12538
12518
  *
12539
12519
  * Create a row from a table
12540
12520
  *
12541
- * @param {JId} dataSourceId - The Id of the data source.
12521
+ * @param {JId} tableId - The Id of the table.
12542
12522
  * @param {{ [key: string]: any }} row - the data of the row to be updated.
12543
12523
  *
12544
12524
  * @returns {Promise<void>}
@@ -12549,14 +12529,14 @@ declare namespace JMap {
12549
12529
  * JMap.Table.createRow("be4552e1-d89d-48ec-a417-7b99d14b4d7b", {city: "Montreal", country: "Canada"});
12550
12530
  * ```
12551
12531
  */
12552
- function createRow(dataSourceId: JId, row: { [key: string]: any }): Promise<void>
12532
+ function createRow(tableId: JId, row: { [key: string]: any }): Promise<void>
12553
12533
 
12554
12534
  /**
12555
12535
  * **JMap.Table.updateRow**
12556
12536
  *
12557
12537
  * Update a row from a table
12558
12538
  *
12559
- * @param {JId} dataSourceId - The ID of the data source.
12539
+ * @param {JId} tableId - The ID of the table.
12560
12540
  * @param {number} rowId - Id of the row to be updated.
12561
12541
  * @param {{ [key: string]: any }} row - the data of the row to be updated.
12562
12542
  *
@@ -12568,15 +12548,15 @@ declare namespace JMap {
12568
12548
  * JMap.Table.updateRow("be4552e1-d89d-48ec-a417-7b99d14b4d7b", 3086627, {city: "Montreal", country: "Canada"});
12569
12549
  * ```
12570
12550
  */
12571
- function updateRow(dataSourceId: JId, rowId: number, row: { [key: string]: any }): Promise<void>
12551
+ function updateRow(tableId: JId, rowId: number, row: { [key: string]: any }): Promise<void>
12572
12552
 
12573
12553
  /**
12574
12554
  * **JMap.Table.deleteRow**
12575
12555
  *
12576
12556
  * Delete a row from a table
12577
12557
  *
12578
- * @param {JId} dataSourceId - The ID of the JMap data source.
12579
- * @param {number} rowId - Id of the row to be updated.
12558
+ * @param {JId} tableId - The ID of the table.
12559
+ * @param {number} rowId - Id of the row to be deleted.
12580
12560
  *
12581
12561
  * @returns {Promise<void>}
12582
12562
  *
@@ -12586,6 +12566,21 @@ declare namespace JMap {
12586
12566
  * JMap.Table.deleteRow("be4552e1-d89d-48ec-a417-7b99d14b4d7b", 3086627);
12587
12567
  * ```
12588
12568
  */
12589
- function deleteRow(dataSourceId: JId, rowId: number): Promise<void>
12569
+ function deleteRow(tableId: JId, rowId: number): Promise<void>
12570
+
12571
+ /**
12572
+ * **JMap.Table.getDataSourceAttributes**
12573
+ *
12574
+ * Returns the attributes of the associated datasource, for a given table.
12575
+ *
12576
+ * @param tableId the table
12577
+ * @throws if tableId not valid or dataSource not found
12578
+ * @example
12579
+ * ```ts
12580
+ * // Returns datasource attributes, for table id="be4552e1-d89d-48ec-a417-7b99d14b4d7b"
12581
+ * JMap.Table.getDataSourceAttributes("be4552e1-d89d-48ec-a417-7b99d14b4d7b")
12582
+ * ```
12583
+ **/
12584
+ function getDataSourceAttributes(tableId: JId): Promise<JDataSourceAttribute[]>
12590
12585
  }
12591
12586
  }
@@ -0,0 +1,8 @@
1
+ declare interface JDataSourceAttribute {
2
+ id: string
3
+ name: string
4
+ type: ATTRIBUTE_TYPES
5
+ indexed: boolean
6
+ title: JLocaleTranslation
7
+ valueDomain?: JValueDomain[]
8
+ }
@@ -18,7 +18,7 @@ declare interface JFormSchemaPropertyJMC {
18
18
  default?: any
19
19
  minimum?: number
20
20
  maximum?: number
21
- oneOf?: Array<{ const: string; title: string }>
21
+ oneOf?: Array<{ const: string; title: string | undefined }>
22
22
  }
23
23
 
24
24
  declare const enum FORMSCHEMA_TYPES {
@@ -102,14 +102,14 @@ declare interface FormNodeLayout extends FormNodeBase {
102
102
 
103
103
  declare interface FormNodeVertical extends FormNodeLayout {
104
104
  type: "VerticalLayout"
105
- designComponent: "VerticalLayout"
105
+ designComponent: "Column"
106
106
  isRoot?: boolean
107
107
  translations?: JFormTranslations
108
108
  }
109
109
 
110
110
  declare interface FormNodeHorizontal extends FormNodeLayout {
111
111
  type: "HorizontalLayout"
112
- designComponent: "HorizontalLayout"
112
+ designComponent: "Row"
113
113
  }
114
114
  declare interface FormNodeGroup extends FormNodeLayout {
115
115
  type: "Group"
@@ -314,6 +314,7 @@ declare interface JLayer extends JLayerTreeElement {
314
314
  hasInformationReport: boolean
315
315
  informationReports: JLayerInformationReport[]
316
316
  spatialDataSourceId: string
317
+ spatialDataSourceAttributes: JDataSourceAttribute[] | null
317
318
  selectionStyleId: string
318
319
  dynamicFilter: JDynamicFilter
319
320
  allowClientSideEditing: boolean
@@ -1,14 +1,40 @@
1
+ // ALL_TABLE_ATTRIBUTE_TYPES in all-enum.ts
2
+ declare const enum JTABLE_ATTRIBUTE_TYPES {
3
+ STRING = "string",
4
+ NUMBER = "number",
5
+ DATE = "date",
6
+ DATETIME = "datetime",
7
+ BOOLEAN = "boolean",
8
+ BINARY = "binary"
9
+ }
10
+
11
+ declare interface JServerTable extends Omit<JTable, "permissions"> {
12
+ permissions: keyof JTablePermissions
13
+ }
14
+
1
15
  declare interface JTable {
2
16
  id: string
3
17
  organizationId: string
4
18
  projectId: string
5
19
  name: string
20
+ attributes: JTableAttribute[]
21
+ dataSourceAttributes: JDataSourceAttribute[] | null
22
+ listed: boolean
6
23
  description: JLocaleTranslation
7
24
  dataSourceId: string
8
25
  allowClientSideEditing: boolean
9
26
  permissions: JTablePermissions
10
27
  }
11
28
 
29
+ declare interface JTableAttribute {
30
+ id: string
31
+ name: string
32
+ title: string
33
+ label: string
34
+ type: JTABLE_ATTRIBUTE_TYPES
35
+ indexed: boolean
36
+ }
37
+
12
38
  declare interface JTableData {
13
39
  columns: string[]
14
40
  links: Array<{ href: string; rel: string; title: string; type: string }>