jmapcloud-ng-core-types 1.0.16 → 1.0.19

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
@@ -13,6 +13,7 @@ export interface JCoreService extends JCoreMainService {
13
13
  Geometry: JGeometryService
14
14
  MouseOver: JMouseOverService
15
15
  Form: JFormService
16
+ FormJMC: JFormJMCService
16
17
  Query: JQueryService
17
18
  Event: JEventService
18
19
  History: JHistoryService
@@ -154,6 +155,7 @@ export interface JFeatureService {
154
155
  // TODO: see if the future endpoint will return detail about individual deleted features success or failure
155
156
  // https://k2geospatial.atlassian.net/browse/JMAP8-1589
156
157
  deleteByIds(layerId: JId, featureIds: JId[]): Promise<JId[]>
158
+ geometryCreate(params: JFeatureGeometryCreateParams): Promise<GeoJSON.Feature>
157
159
  }
158
160
 
159
161
  export interface JCoreMainService {
@@ -574,6 +576,10 @@ export interface JServerState extends JServerInfo {
574
576
 
575
577
  export type JHistoryListener = (oldValue: string | undefined, newValue: string | undefined) => void
576
578
 
579
+ export interface JFormJMCService {
580
+ getJsonForm(layerId: string): JJsonFormSchemas
581
+ }
582
+
577
583
  export interface JFormService {
578
584
  // REPO METHODS
579
585
  getFormsMetaDataByLayerId(layerId: JId): Promise<JFormMetaData[]>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmapcloud-ng-core-types",
3
- "version": "1.0.16",
3
+ "version": "1.0.19",
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
@@ -506,7 +506,7 @@ declare namespace JMap {
506
506
  *
507
507
  * Change the feature geometry for the given layer id, feature id and geometry (projection EPSG:4326).
508
508
  *
509
- * @param params contains the JMap layer id, the JMap feature id, and the geojson geometry
509
+ * @param params contains the JMap layer id, the JMap feature id, the geojson geometry, and optionally its attributes
510
510
  * @throws if layer or feature not found, or if feature is invalid (undefined, wrong geometry type, etc ...)
511
511
  * @example
512
512
  * ```ts
@@ -565,6 +565,46 @@ declare namespace JMap {
565
565
  // TODO: see if the future endpoint will return detail about individual deleted features success or failure
566
566
  // https://k2geospatial.atlassian.net/browse/JMAP8-1589
567
567
  function deleteByIds(layerId: JId, featureIds: JId[]): Promise<JId[]>
568
+
569
+ /**
570
+ * **JMap.Feature.geometryCreate**
571
+ *
572
+ * Creates a new Geometry
573
+ *
574
+ * @param params An object containing the parameters for geometry creation.
575
+ * params.layerId: The JMap layer id (string).
576
+ * params.geometry: The GeoJSON geometry object.
577
+ * params.properties: The values of the feature's attributes.
578
+ * params.crs: An object representing the coordinate reference system of the geometry.
579
+ * @throws Will throw an error if the layerId is not found.
580
+ * @returns A promise that resolves with the created GeoJSON feature.
581
+ *
582
+ * @example
583
+ * ```ts
584
+ * // Create a feature
585
+ * JMap.Feature
586
+ * .geometryCreate({
587
+ * layerId: "123e4567-e89b-12d3-a456-426614174000",
588
+ * crs: {
589
+ * type: "EPSG",
590
+ * properties: {
591
+ * code: 4326
592
+ * }
593
+ * },
594
+ * geometry: {
595
+ * type: "Point",
596
+ * coordinates: [-73.56, 45.51]
597
+ * },
598
+ * properties: {
599
+ * property1: "value1",
600
+ * property2: "value2"
601
+ * }
602
+ * })
603
+ * .then(() => console.info("Feature has been created"))
604
+ * .catch(error => console.error("An error occurred", error));
605
+ * ```
606
+ */
607
+ function geometryCreate(params: JFeatureGeometryCreateParams): Promise<GeoJSON.Feature>
568
608
  }
569
609
 
570
610
  /**
@@ -8931,7 +8971,7 @@ declare namespace JMap {
8931
8971
  /**
8932
8972
  * ***JMap.Event.Map.on.mapLoad***
8933
8973
  *
8934
- * This event is triggered when a layer is deleted.
8974
+ * This event is triggered when the map is created and ready.
8935
8975
  *
8936
8976
  * @param listenerId Your listener id (must be unique for all map events)
8937
8977
  * @param fn Your listener function
@@ -10183,6 +10223,33 @@ declare namespace JMap {
10183
10223
  function renderMouseOver(layer: JLayer, feature: GeoJSON.Feature): Array<JExtensionMouseOver | undefined>
10184
10224
  }
10185
10225
 
10226
+ /**
10227
+ * **JMap.FormJMC**
10228
+ *
10229
+ * Here you'll find all form related methods
10230
+ */
10231
+ namespace FormJMC {
10232
+ /**
10233
+ * ***JMap.FormJMC.getJsonForm***
10234
+ *
10235
+ * Returns the jsonForm schema and uiSchema for a layer.
10236
+ *
10237
+ * 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
10238
+ *
10239
+ * @param layerId the JMap layer id
10240
+ * @example
10241
+ * ```ts
10242
+ * // returns the schema and uiSchema for layer id=f47ac10b-58cc-4372-a567-0e02b2c3d479
10243
+
10244
+
10245
+ * JMap.FormJMC
10246
+ * .getJsonForm("f47ac10b-58cc-4372-a567-0e02b2c3d479")
10247
+ * .then(schemas => console.log("jsonForms schemas of layer f47ac10b-58cc-4372-a567-0e02b2c3d479", schemas))
10248
+ * .catch(error => console.error("An error occurred when getting jsonForm schema", error))
10249
+ * ```
10250
+ */
10251
+ function getJsonForm(layerId: JId): JJsonFormSchemas
10252
+ }
10186
10253
  /**
10187
10254
  * **JMap.Form**
10188
10255
  *
@@ -6,6 +6,7 @@ declare interface JFeatureGeometryUpdateParams {
6
6
  layerId: JId
7
7
  featureId: JId
8
8
  geometry: GeoJSON.Geometry
9
+ properties?: JAttributeValueByName
9
10
  }
10
11
 
11
12
  declare interface JFeatureEventGeometryUpdateParams {
@@ -30,3 +31,15 @@ declare interface JFeatureEventCreateParams {
30
31
  featureGeometry: GeoJSON.Geometry
31
32
  featureProperties: JAttributeValueByName
32
33
  }
34
+
35
+ declare interface JFeatureGeometryCreateParams {
36
+ layerId: JId
37
+ geometry: GeoJSON.Geometry
38
+ properties?: JAttributeValueByName
39
+ crs: {
40
+ type: string
41
+ property: {
42
+ code: number
43
+ }
44
+ }
45
+ }
@@ -0,0 +1,28 @@
1
+ declare interface JJsonFormSchemas {
2
+ schema: JJsonFormSchema | null
3
+ uiSchema: JJsonFormUISchema | null
4
+ }
5
+
6
+ declare interface JJsonFormSchema {
7
+ type: "object"
8
+ properties: {
9
+ [key: string]: {
10
+ type: string
11
+ format?: string
12
+ }
13
+ }
14
+ required: string[]
15
+ }
16
+ declare interface JJsonFormControlElement {
17
+ type: "Control"
18
+ scope: string
19
+ label: string
20
+ options?: {
21
+ [key: string]: any
22
+ }
23
+ }
24
+
25
+ declare interface JJsonFormUISchema {
26
+ type: "VerticalLayout"
27
+ elements: JJsonFormControlElement[]
28
+ }
@@ -271,11 +271,11 @@ declare interface JLayerGeometry {
271
271
  }
272
272
 
273
273
  declare interface JLayerPermissions {
274
- ADD: boolean
275
- DELETE: boolean
276
- DUPLICATE: boolean
277
- EDIT_ATTRIBUTE_VALUES: boolean
278
- EDIT_GEOMETRY: boolean
274
+ ADD_FEATURE: boolean
275
+ DELETE_FEATURE: boolean
276
+ EXTRACT_FEATURE: boolean
277
+ EDIT_FEATURE_ATTRIBUTES: boolean
278
+ EDIT_FEATURE_GEOMETRY: boolean
279
279
  EDIT_ONLY_OWN: boolean
280
280
  }
281
281
 
@@ -302,7 +302,6 @@ declare interface JLayer extends JLayerTreeElement {
302
302
  queries: JQuery[]
303
303
  extent: JBoundaryBox | null
304
304
  permissions: JLayerPermissions
305
- canEditGeometry: boolean
306
305
  hasAttributeForm: boolean
307
306
  hasExternalForms: boolean
308
307
  selectable: boolean