jmapcloud-ng-core-types 1.0.49 → 1.0.51

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/index.ts CHANGED
@@ -151,6 +151,7 @@ export interface JFeatureService {
151
151
  getByIds(layerId: JId, featureIds: JId[]): Promise<GeoJSON.Feature[]>
152
152
  getByLayerId(layerId: JId, bbox: JBoundaryBox): Promise<GeoJSON.Feature[]>
153
153
  geometryUpdateById(params: JFeatureGeometryUpdateParams): Promise<GeoJSON.Feature>
154
+ propertiesUpdateById(params: JFeaturePropertiesUpdateParams): Promise<GeoJSON.Feature>
154
155
  deleteById(layerId: JId, featureId: JId): Promise<JId>
155
156
  // deleteByIds(layerId: JId, featureIds: JId[]): Promise<JFeatureDeleteByIdsResult>
156
157
  // TODO: see if the future endpoint will return detail about individual deleted features success or failure
@@ -593,7 +594,7 @@ export interface JServerState extends JServerInfo {
593
594
  export type JHistoryListener = (oldValue: string | undefined, newValue: string | undefined) => void
594
595
 
595
596
  export interface JFormJMCService {
596
- getJsonForm(layerId: string): JJsonFormSchemas
597
+ getJsonForm(dataSourceId: string): Promise<JJsonFormSchemas>
597
598
  getForm(layerId: string): Promise<JFormJMC>
598
599
  }
599
600
 
@@ -924,6 +925,10 @@ export interface JLayerService {
924
925
  export interface JTableService {
925
926
  getTables(): JTable[]
926
927
  getTableData(dataSourceId: JId, params: JTableDataParams): Promise<JTableData>
928
+ getById(tableId: JId): JTable
929
+ createRow(dataSourceId: JId, row: { [key: string]: any }): Promise<void>
930
+ updateRow(dataSourceId: JId, rowId: number, row: { [key: string]: any }): Promise<void>
931
+ deleteRow(dataSourceId: JId, rowId: number): Promise<void>
927
932
  }
928
933
 
929
934
  export interface JLayerSearchService {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmapcloud-ng-core-types",
3
- "version": "1.0.49",
3
+ "version": "1.0.51",
4
4
  "description": "JMap Cloud specific version of JMap Cloud NG Core types and interfaces",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/public/core.d.ts CHANGED
@@ -524,6 +524,29 @@ declare namespace JMap {
524
524
  */
525
525
  function geometryUpdateById(params: JFeatureGeometryUpdateParams): Promise<GeoJSON.Feature>
526
526
 
527
+ /**
528
+ * **JMap.Feature.propertiesUpdateById**
529
+ *
530
+ * Change the feature properties for the given layer id, feature id and properties.
531
+ *
532
+ * @param params contains the JMap layer id, the JMap feature id and its properties
533
+ * @throws if layer or feature not found, or if properties are invalid
534
+ * @example
535
+ * ```ts
536
+ * const newProperties = { ... }
537
+ * // change the properties of feature id="4" on layer id="3"
538
+ * JMap.Feature
539
+ * .propertiesUpdateById({
540
+ * layerId: 3,
541
+ * featureId: 4,
542
+ * properties: newProperties
543
+ * })
544
+ * .then(feature => console.info("Feature properties' have been changed", feature))
545
+ * .catch(error => console.error("An error occured", error))
546
+ * ```
547
+ */
548
+ function propertiesUpdateById(params: JFeaturePropertiesUpdateParams): Promise<GeoJSON.Feature>
549
+
527
550
  /**
528
551
  * **JMap.Feature.deleteById**
529
552
  *
@@ -10262,23 +10285,23 @@ declare namespace JMap {
10262
10285
  /**
10263
10286
  * ***JMap.FormJMC.getJsonForm***
10264
10287
  *
10265
- * Returns the jsonForm schema and uiSchema for a layer.
10288
+ * Returns the jsonForm schema and uiSchema for a data source.
10266
10289
  *
10267
- * fetch the attributes of a layer and then builds and returns the schema and uiSchema required for jsonForms. The schemas will be null if there is no attributes on the layer
10290
+ * 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
10268
10291
  *
10269
- * @param layerId the JMap layer id
10292
+ * @param dataSourceId the JMap data source id
10270
10293
  * @example
10271
10294
  * ```ts
10272
- * // returns the schema and uiSchema for layer id=f47ac10b-58cc-4372-a567-0e02b2c3d479
10295
+ * // returns the schema and uiSchema for data source id=f47ac10b-58cc-4372-a567-0e02b2c3d479
10273
10296
 
10274
10297
 
10275
10298
  * JMap.FormJMC
10276
10299
  * .getJsonForm("f47ac10b-58cc-4372-a567-0e02b2c3d479")
10277
- * .then(schemas => console.log("jsonForms schemas of layer f47ac10b-58cc-4372-a567-0e02b2c3d479", schemas))
10300
+ * .then(schemas => console.log("jsonForms schemas of data source f47ac10b-58cc-4372-a567-0e02b2c3d479", schemas))
10278
10301
  * .catch(error => console.error("An error occurred when getting jsonForm schema", error))
10279
10302
  * ```
10280
10303
  */
10281
- function getJsonForm(layerId: JId): JJsonFormSchemas
10304
+ function getJsonForm(dataSourceId: JId): Promise<JJsonFormSchemas>
10282
10305
 
10283
10306
  /**
10284
10307
  * ***JMap.FormJMC.getForm***
@@ -12786,5 +12809,75 @@ declare namespace JMap {
12786
12809
  * ```
12787
12810
  */
12788
12811
  function getTableData(dataSourceId: JId, params: JTableDataParams): Promise<JTableData>
12812
+
12813
+ /**
12814
+ * **JMap.Table.getById**
12815
+ *
12816
+ * Returns the JMap table having the id.
12817
+ *
12818
+ * @throws Error if no table found for the id
12819
+ * @param tableId The JMap table id
12820
+ * @example
12821
+ * ```ts
12822
+ * // returns the JMap table id=3
12823
+ * JMap.Table.getById(3)
12824
+ * ```
12825
+ */
12826
+ function getById(tableId: JId): JTable
12827
+
12828
+ /**
12829
+ * **JMap.Table.createRow**
12830
+ *
12831
+ * Create a row from a table
12832
+ *
12833
+ * @param {JId} dataSourceId - The Id of the data source.
12834
+ * @param {{ [key: string]: any }} row - the data of the row to be updated.
12835
+ *
12836
+ * @returns {Promise<void>}
12837
+ *
12838
+ * @example
12839
+ * ```ts
12840
+ * // Create a row in the dataSet with id : "be4552e1-d89d-48ec-a417-7b99d14b4d7b" with the data: {city: Montreal, country:Canada}.
12841
+ * JMap.Table.createRow("be4552e1-d89d-48ec-a417-7b99d14b4d7b", {city: "Montreal", country: "Canada"});
12842
+ * ```
12843
+ */
12844
+ function createRow(dataSourceId: JId, row: { [key: string]: any }): Promise<void>
12845
+
12846
+ /**
12847
+ * **JMap.Table.updateRow**
12848
+ *
12849
+ * Update a row from a table
12850
+ *
12851
+ * @param {JId} dataSourceId - The ID of the data source.
12852
+ * @param {number} rowId - Id of the row to be updated.
12853
+ * @param {{ [key: string]: any }} row - the data of the row to be updated.
12854
+ *
12855
+ * @returns {Promise<void>}
12856
+ *
12857
+ * @example
12858
+ * ```ts
12859
+ * // Update the row with an id of 3086627 from the dataSet with id : "be4552e1-d89d-48ec-a417-7b99d14b4d7b".
12860
+ * JMap.Table.updateRow("be4552e1-d89d-48ec-a417-7b99d14b4d7b", 3086627, {city: "Montreal", country: "Canada"});
12861
+ * ```
12862
+ */
12863
+ function updateRow(dataSourceId: JId, rowId: number, row: { [key: string]: any }): Promise<void>
12864
+
12865
+ /**
12866
+ * **JMap.Table.deleteRow**
12867
+ *
12868
+ * Delete a row from a table
12869
+ *
12870
+ * @param {JId} dataSourceId - The ID of the JMap data source.
12871
+ * @param {number} rowId - Id of the row to be updated.
12872
+ *
12873
+ * @returns {Promise<void>}
12874
+ *
12875
+ * @example
12876
+ * ```ts
12877
+ * // Delete the row with an id of 3086627 from the dataSet with id : "be4552e1-d89d-48ec-a417-7b99d14b4d7b"
12878
+ * JMap.Table.deleteRow("be4552e1-d89d-48ec-a417-7b99d14b4d7b", 3086627);
12879
+ * ```
12880
+ */
12881
+ function deleteRow(dataSourceId: JId, rowId: number): Promise<void>
12789
12882
  }
12790
12883
  }
@@ -9,6 +9,12 @@ declare interface JFeatureGeometryUpdateParams {
9
9
  properties?: JAttributeValueByName
10
10
  }
11
11
 
12
+ declare interface JFeaturePropertiesUpdateParams {
13
+ layerId: JId
14
+ featureId: JId
15
+ properties: JAttributeValueByName
16
+ }
17
+
12
18
  declare interface JFeatureEventGeometryUpdateParams {
13
19
  layerId: JId
14
20
  updatedFeature: GeoJSON.Feature
@@ -1,6 +1,6 @@
1
1
  declare interface JJsonFormSchemas {
2
2
  schema: JFormSchemaJMC | null
3
- uiSchema: FormNodeVertical | null
3
+ uiSchema: FormNodeVertical | undefined
4
4
  }
5
5
 
6
6
  declare interface JFormSchemaJMC {
@@ -167,6 +167,7 @@ declare interface JLayerStyleSamplesById {
167
167
  declare interface JLayersConfiguration {
168
168
  metadataSchema: JLayerMetadataSchemaItem[]
169
169
  layerTree: JLayerTree
170
+ tables: JTable[]
170
171
  styleSamples: JLayerStyleSamplesById
171
172
  }
172
173
 
@@ -2,10 +2,11 @@ declare interface JTable {
2
2
  id: string
3
3
  organizationId: string
4
4
  projectId: string
5
- name: JLocaleTranslation
5
+ name: string
6
6
  description: JLocaleTranslation
7
7
  dataSourceId: string
8
8
  allowClientSideEditing: boolean
9
+ permissions: JTablePermissions
9
10
  }
10
11
 
11
12
  declare interface JTableData {
@@ -21,3 +22,10 @@ declare interface JTableDataParams {
21
22
  filter?: string
22
23
  sort?: string
23
24
  }
25
+
26
+ declare interface JTablePermissions {
27
+ EXTRACT_ROW: boolean
28
+ CREATE_ROW: boolean
29
+ EDIT_ROW: boolean
30
+ DELETE_ROW: boolean
31
+ }