jmapcloud-ng-core-types 1.1.36 → 1.1.37

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.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  /// <reference path="./public/global-aliases.d.ts" />
2
2
  import { Feature, FeatureCollection, LineString, MultiLineString, Point, Polygon } from "geojson"
3
- import { JForm as JFormJMC } from "jmapcloud-types"
3
+ import { JAttribute, JDataSource, JDataSourceType, JForm as JFormJMC } from "jmapcloud-types"
4
+ import type * as maplibregl from "maplibre-gl"
4
5
  import { Action, Store } from "redux"
6
+ import { JDataSourceData, JDataSourceDataParams, JDataSourcePermissions } from "./public/jmap/datasource.ts"
5
7
  import type { JCoreState } from "./public/state.d.ts"
6
8
 
7
9
  export type { JCoreOptions } from "./public/jmap/startup-options.d.ts"
@@ -46,6 +48,7 @@ export interface JCoreService extends JCoreMainService {
46
48
  MapContext: JMapContextService
47
49
  UI: JUIService
48
50
  SimpleSearch: JSimpleSearchService
51
+ DataSource: JDataSourceService
49
52
  Table: JTableService
50
53
  }
51
54
 
@@ -733,7 +736,25 @@ export interface JLayerService {
733
736
  deleteLayer(layerId: JId): void
734
737
  hasInformationReport(layerId: JId): boolean
735
738
  openInformationReportInNewTab(layerId: JId, featureIds: JId[]): Promise<string>
736
- getDataSourceAttributes(layerId: JId): Promise<JDataSourceAttribute[]>
739
+ getDataSourceAttributes(layerId: JId): Promise<JAttribute[]>
740
+ }
741
+
742
+ export interface JDataSourceService {
743
+ getAttributes(dataSourceId: JId): Promise<JAttribute[]>
744
+ getById(dataSourceId: JId): Promise<JDataSource>
745
+ getData(dataSourceId: JId, params: JDataSourceDataParams, dataSourceType?: JDataSourceType): Promise<JDataSourceData>
746
+ getPermissions(dataSourceId: JId): Promise<JDataSourcePermissions>
747
+ createRow(dataSourceId: JId, row: { [key: string]: any }): Promise<{ id: JId; links: any[] }>
748
+ updateRow(dataSourceId: JId, rowId: JId, row: { [key: string]: any }): Promise<void>
749
+ deleteRow(dataSourceId: JId, rowId: JId): Promise<void>
750
+ updateFeatureProperties(
751
+ dataSourceId: JId,
752
+ featureId: JId,
753
+ properties: { [key: string]: any }
754
+ ): Promise<GeoJSON.Feature>
755
+ deleteFeature(dataSourceId: JId, featureId: JId): Promise<JId>
756
+ getFeature(dataSourceId: string, featureId: number): Promise<GeoJSON.Feature>
757
+ getRow(dataSourceId: string, rowId: number): Promise<{ [key: string]: any }>
737
758
  }
738
759
 
739
760
  export interface JTableService {
@@ -743,7 +764,7 @@ export interface JTableService {
743
764
  createRow(tableId: JId, row: { [key: string]: any }): Promise<{ id: JId; links: Array<any> }>
744
765
  updateRow(tableId: JId, rowId: number, row: { [key: string]: any }): Promise<void>
745
766
  deleteRow(tableId: JId, rowId: number): Promise<void>
746
- getDataSourceAttributes(tableId: JId): Promise<JDataSourceAttribute[]>
767
+ getDataSourceAttributes(tableId: JId): Promise<JAttribute[]>
747
768
  setDynamicFilterActive(tableId: JId, filterId: string, isActive: boolean): void
748
769
  }
749
770
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmapcloud-ng-core-types",
3
- "version": "1.1.36",
3
+ "version": "1.1.37",
4
4
  "description": "JMap Cloud specific version of JMap Cloud NG Core types and interfaces",
5
5
  "main": "index.js",
6
6
  "types": "ambient.d.ts",
package/public/core.d.ts CHANGED
@@ -1,7 +1,5 @@
1
- /// <reference path="./global-aliases.d.ts" />
2
-
1
+ import { JAttribute } from "jmapcloud-types"
3
2
  import type { Action, Store } from "redux"
4
- import type { JCoreState } from "./state.d.ts"
5
3
  import type { JRequestConfig } from "./jmap/ajax.d.ts"
6
4
  import type {
7
5
  JAttachment,
@@ -9,7 +7,7 @@ import type {
9
7
  JCreateAttachmentParams,
10
8
  JUpdateAttachmentParams
11
9
  } from "./jmap/attachment.d.ts"
12
- import type { JDataSourceAttribute } from "./jmap/datasource.ts"
10
+ import type { JDataSourceData, JDataSourceDataParams, JDataSourcePermissions } from "./jmap/datasource.ts"
13
11
  import type { JDateFormatParams, JDateLike, JTIME_UNITS } from "./jmap/date.d.ts"
14
12
  import type { JCoreExtension, JExtensionEventParams, JExtensionMouseOver } from "./jmap/extension.d.ts"
15
13
  import type {
@@ -178,6 +176,7 @@ import type {
178
176
  JUserEventSessionChangedParams,
179
177
  JUserInfo
180
178
  } from "./jmap/user.d.ts"
179
+ import type { JCoreState } from "./state.d.ts"
181
180
  export {}
182
181
  /**
183
182
  * This is the JMap Cloud NG Core library API documentation.
@@ -2444,7 +2443,7 @@ export namespace JMap {
2444
2443
  * .getDataSourceAttributes(3)
2445
2444
  * ```
2446
2445
  **/
2447
- function getDataSourceAttributes(layerId: JId): Promise<JDataSourceAttribute[]>
2446
+ function getDataSourceAttributes(layerId: JId): Promise<JAttribute[]>
2448
2447
  }
2449
2448
  /**
2450
2449
  * **JMap.Geometry**
@@ -9822,6 +9821,194 @@ export namespace JMap {
9822
9821
  */
9823
9822
  function previewAttachments(attachment: JAttachmentFile, dataSourceId: string): Promise<void>
9824
9823
  }
9824
+ /**
9825
+ * **JMap.DataSource**
9826
+ *
9827
+ * Here you'll find all dataSource related methods
9828
+ */
9829
+ namespace DataSource {
9830
+ /**
9831
+ * **JMap.DataSource.getAttributes**
9832
+ *
9833
+ * Returns the attributes for a given datasource.
9834
+ *
9835
+ * @param dataSourceId the datasource id
9836
+ * @throws if dataSourceId not valid or dataSource not found
9837
+ * @example
9838
+ * ```ts
9839
+ * // Returns attributes, for dataSource id="be4552e1-d89d-48ec-a417-7b99d14b4d7b"
9840
+ * JMap.DataSource.getAttributes("be4552e1-d89d-48ec-a417-7b99d14b4d7b")
9841
+ * ```
9842
+ **/
9843
+ function getAttributes(dataSourceId: JId): Promise<JAttribute[]>
9844
+
9845
+ /**
9846
+ * **JMap.DataSource.getById**
9847
+ *
9848
+ * Returns the datasource, for a given id.
9849
+ *
9850
+ * @param dataSourceId
9851
+ * @throws if dataSourceId not valid
9852
+ * @example
9853
+ * ```ts
9854
+ * // Returns dataSource, with id="be4552e1-d89d-48ec-a417-7b99d14b4d7b"
9855
+ * JMap.DataSource.getById("be4552e1-d89d-48ec-a417-7b99d14b4d7b")
9856
+ * ```
9857
+ **/
9858
+ function getById(dataSourceId: JId): Promise<any>
9859
+
9860
+ /**
9861
+ * **JMap.DataSource.getData**
9862
+ *
9863
+ * Asynchronously retrieves data for a datasource.
9864
+ *
9865
+ * @throws {Error} If no data source is found for the given ID.
9866
+ *
9867
+ * @param {JId} dataSourceId - The datasource id.
9868
+ * @param {JDataSourceDataParams} params - Includes the following optional parameters: startIndex, limit, filter, sort.
9869
+ * startIndex: The starting index for data retrieval (zero-based).
9870
+ * limit: The maximum number of records to retrieve.
9871
+ * filter: A CQL filter.
9872
+ * sort: A sort model.
9873
+ *
9874
+ * @returns {Promise<JDataSourceData>} A promise that resolves to a `JDataSourceData` object representing the dataSource data.
9875
+ *
9876
+ * @example
9877
+ * ```ts
9878
+ * // Retrieves up to 50 rows from data source ID 3, starting at index 0, sorted in ascending order based on the "ATTRIBUTE_A" attribute
9879
+ * JMap.DataSource.getData(3, {startIndex: 0, limit: 50, sort:"ATTRIBUTE_A ASC"}).then(dataSourceData => {
9880
+ * console.log(dataSourceData);
9881
+ * }).catch(error => {
9882
+ * console.error("Failed to fetch dataSource data:", error);
9883
+ * });
9884
+ * ```
9885
+ */
9886
+ function getData(dataSourceId: JId, params: JDataSourceDataParams, dataSourceType?: any): Promise<JDataSourceData>
9887
+
9888
+ /**
9889
+ * **JMap.DataSource.getPermissions**
9890
+ *
9891
+ * Returns the permissions, for a given dataSource id.
9892
+ *
9893
+ * @param dataSourceId
9894
+ * @throws if dataSourceId not valid
9895
+ * @example
9896
+ * ```ts
9897
+ * // Returns permissions for dataSource with id="be4552e1-d89d-48ec-a417-7b99d14b4d7b"
9898
+ * JMap.DataSource.getPermissions("be4552e1-d89d-48ec-a417-7b99d14b4d7b")
9899
+ * ```
9900
+ **/
9901
+ function getPermissions(dataSourceId: JId): Promise<JDataSourcePermissions>
9902
+
9903
+ /**
9904
+ * **JMap.DataSource.createRow**
9905
+ *
9906
+ * Creates a new row in a tabular datasource.
9907
+ *
9908
+ * @param dataSourceId
9909
+ * @param row
9910
+ * @example
9911
+ * ```ts
9912
+ * JMap.DataSource.createRow("be4552e1-d89d-48ec-a417-7b99d14b4d7b", { NAME: "New row" })
9913
+ * ```
9914
+ **/
9915
+ function createRow(dataSourceId: JId, row: { [key: string]: any }): Promise<{ id: JId; links: any[] }>
9916
+
9917
+ /**
9918
+ * **JMap.DataSource.updateRow**
9919
+ *
9920
+ * Updates a row in a tabular datasource.
9921
+ *
9922
+ * @param dataSourceId
9923
+ * @param rowId
9924
+ * @param row
9925
+ * @example
9926
+ * ```ts
9927
+ * JMap.DataSource.updateRow("be4552e1-d89d-48ec-a417-7b99d14b4d7b", 12, { NAME: "Updated" })
9928
+ * ```
9929
+ **/
9930
+ function updateRow(dataSourceId: JId, rowId: JId, row: { [key: string]: any }): Promise<void>
9931
+
9932
+ /**
9933
+ * **JMap.DataSource.deleteRow**
9934
+ *
9935
+ * Deletes a row from a tabular datasource.
9936
+ *
9937
+ * @param dataSourceId
9938
+ * @param rowId
9939
+ * @example
9940
+ * ```ts
9941
+ * JMap.DataSource.deleteRow("be4552e1-d89d-48ec-a417-7b99d14b4d7b", 12)
9942
+ * ```
9943
+ **/
9944
+ function deleteRow(dataSourceId: JId, rowId: JId): Promise<void>
9945
+
9946
+ /**
9947
+ * **JMap.DataSource.updateFeatureProperties**
9948
+ *
9949
+ * Updates properties for a feature in a spatial datasource.
9950
+ *
9951
+ * @param dataSourceId
9952
+ * @param featureId
9953
+ * @param properties
9954
+ * @example
9955
+ * ```ts
9956
+ * JMap.DataSource.updateFeatureProperties(
9957
+ * "be4552e1-d89d-48ec-a417-7b99d14b4d7b",
9958
+ * 42,
9959
+ * { NAME: "Updated" }
9960
+ * )
9961
+ * ```
9962
+ **/
9963
+ function updateFeatureProperties(
9964
+ dataSourceId: JId,
9965
+ featureId: JId,
9966
+ properties: { [key: string]: any }
9967
+ ): Promise<GeoJSON.Feature>
9968
+
9969
+ /**
9970
+ * **JMap.DataSource.deleteFeature**
9971
+ *
9972
+ * Deletes a spatial feature from a spatial datasource.
9973
+ *
9974
+ * @param dataSourceId
9975
+ * @param featureId
9976
+ * @example
9977
+ * ```ts
9978
+ * JMap.DataSource.deleteFeature("be4552e1-d89d-48ec-a417-7b99d14b4d7b", 42)
9979
+ * ```
9980
+ **/
9981
+ function deleteFeature(dataSourceId: JId, featureId: JId): Promise<JId>
9982
+
9983
+ /**
9984
+ * **JMap.DataSource.getFeature**
9985
+ *
9986
+ * Returns a spatial feature for a datasource.
9987
+ *
9988
+ * @param dataSourceId
9989
+ * @param featureId
9990
+ * @example
9991
+ * ```ts
9992
+ * JMap.DataSource.getFeature("be4552e1-d89d-48ec-a417-7b99d14b4d7b", 42)
9993
+ * ```
9994
+ **/
9995
+ function getFeature(dataSourceId: string, featureId: number): Promise<GeoJSON.Feature>
9996
+
9997
+ /**
9998
+ * **JMap.DataSource.getRow**
9999
+ *
10000
+ * Returns a row for a tabular datasource.
10001
+ *
10002
+ * @param dataSourceId
10003
+ * @param rowId
10004
+ * @example
10005
+ * ```ts
10006
+ * JMap.DataSource.getRow("be4552e1-d89d-48ec-a417-7b99d14b4d7b", 12)
10007
+ * ```
10008
+ **/
10009
+ function getRow(dataSourceId: string, rowId: number): Promise<{ [key: string]: any }>
10010
+ }
10011
+
9825
10012
  /**
9826
10013
  * **JMap.Form**
9827
10014
  *
@@ -12169,12 +12356,13 @@ export namespace JMap {
12169
12356
  *
12170
12357
  * @throws {Error} If no data source is found for the given ID.
12171
12358
  *
12172
- * @param {JId} tableId - The ID of the JMap Table.
12359
+ * @param {JId} tableId - The ID of the JMap Table's dataSource.
12173
12360
  * @param {JTableDataParams} params - Includes the following optional parameters: startIndex, limit, filter, sort.
12174
12361
  * startIndex: The starting index for data retrieval (zero-based).
12175
12362
  * limit: The maximum number of records to retrieve.
12176
12363
  * filter: A CQL filter.
12177
12364
  * sort: A sort model.
12365
+ * columns: the name of the columns to include.
12178
12366
  *
12179
12367
  * @returns {Promise<JTableData>} A promise that resolves to a `JTableData` object representing the table data.
12180
12368
  *
@@ -12282,7 +12470,7 @@ export namespace JMap {
12282
12470
  * JMap.Table.getDataSourceAttributes("be4552e1-d89d-48ec-a417-7b99d14b4d7b")
12283
12471
  * ```
12284
12472
  **/
12285
- function getDataSourceAttributes(tableId: JId): Promise<JDataSourceAttribute[]>
12473
+ function getDataSourceAttributes(tableId: JId): Promise<JAttribute[]>
12286
12474
  /**
12287
12475
  * **JMap.Table.setDynamicFilterActive**
12288
12476
  *
@@ -39,7 +39,10 @@ declare global {
39
39
  /** @internal */ type JCreateAttachmentFileParams = attachment.JCreateAttachmentFileParams
40
40
  /** @internal */ type JCreateAttachmentParams = attachment.JCreateAttachmentParams
41
41
  /** @internal */ type JUpdateAttachmentParams = attachment.JUpdateAttachmentParams
42
- /** @internal */ type JDataSourceAttribute = datasource.JDataSourceAttribute
42
+ /** @internal */ type JDataSourceData = datasource.JDataSourceData
43
+ /** @internal */ type JDataSourceDataParams = datasource.JDataSourceDataParams
44
+ /** @internal */ type JDataSourcePermissions = datasource.JDataSourcePermissions
45
+ /** @internal */ type JDataSourcePermission = datasource.JDataSourcePermission
43
46
  /** @internal */ type JDateLike = date.JDateLike
44
47
  /** @internal */ type JTIME_UNITS = date.JTIME_UNITS
45
48
  /** @internal */ const JTIME_UNITS: typeof date.JTIME_UNITS
@@ -283,10 +286,8 @@ declare global {
283
286
  /** @internal */ type JLayerThematicSetCategoryVisibilityParams = layer.JLayerThematicSetCategoryVisibilityParams
284
287
  /** @internal */ type JLayerThematicSetConditionVisibilityParams = layer.JLayerThematicSetConditionVisibilityParams
285
288
  /** @internal */ type JLayerSetLayerGroupsExpansionParams = layer.JLayerSetLayerGroupsExpansionParams
286
- /** @internal */ type JAttribute = layer.JAttribute
287
289
  /** @internal */ type ATTRIBUTE_TYPES = layer.ATTRIBUTE_TYPES
288
290
  /** @internal */ const ATTRIBUTE_TYPES: typeof layer.ATTRIBUTE_TYPES
289
- /** @internal */ type JValueDomain = layer.JValueDomain
290
291
  /** @internal */ type JOPERATING_SYSTEMS = main.JOPERATING_SYSTEMS
291
292
  /** @internal */ const JOPERATING_SYSTEMS: typeof main.JOPERATING_SYSTEMS
292
293
  /** @internal */ type JFATAL_ERROR_CONTEXTS = main.JFATAL_ERROR_CONTEXTS
@@ -1,11 +1,31 @@
1
- import type { JLocaleTranslation } from "./language.d.ts"
2
- import type { ATTRIBUTE_TYPES, JValueDomain } from "./layer.d.ts"
3
1
  export {}
4
- export interface JDataSourceAttribute {
5
- id: string
6
- name: string
7
- type: ATTRIBUTE_TYPES
8
- indexed: boolean
9
- title: JLocaleTranslation
10
- valueDomain?: JValueDomain[]
2
+ export interface JDataSourceData {
3
+ features: GeoJSON.Feature[]
4
+ links: Array<{ href: string; rel: string; title: string; type: string }>
5
+ numberReturned: number
11
6
  }
7
+
8
+ export interface JDataSourceDataParams {
9
+ startIndex?: number
10
+ limit?: number
11
+ filter?: string
12
+ sort?: string
13
+ attributes?: string[]
14
+ }
15
+
16
+ export type JDataSourcePermissions = Array<JDataSourcePermission>
17
+
18
+ export type JDataSourcePermission =
19
+ | "OWNER"
20
+ | "VIEW"
21
+ | "MODIFY"
22
+ | "CREATE_FEATURE"
23
+ | "EXTRACT_FEATURE"
24
+ | "EDIT_FEATURE_GEOMETRY"
25
+ | "EDIT_FEATURE_ATTRIBUTES"
26
+ | "DELETE_FEATURE"
27
+ | "EXTRACT_RASTER"
28
+ | "EXTRACT_ROW"
29
+ | "CREATE_ROW"
30
+ | "EDIT_ROW"
31
+ | "DELETE_ROW"
@@ -1,8 +1,6 @@
1
- import type { JAnyFilterCondition, JDynamicFilterGraphQL } from "jmapcloud-types"
2
- import type { JDataSourceAttribute } from "./datasource.ts"
1
+ import type { JAnyFilterCondition, JAttribute, JDynamicFilterGraphQL } from "jmapcloud-types"
3
2
  import type { JFORM_TYPES } from "./form.d.ts"
4
3
  import type { JBoundaryBox } from "./geometry.d.ts"
5
- import type { JLocaleTranslation } from "./language.d.ts"
6
4
  import type { JId } from "./main.d.ts"
7
5
  import type { JMapMouseOver } from "./mouseover.d.ts"
8
6
  import type { JTable } from "./table.d.ts"
@@ -323,7 +321,7 @@ export interface JLayer extends JLayerTreeElement {
323
321
  hasInformationReport: boolean
324
322
  informationReports: JLayerInformationReport[]
325
323
  spatialDataSourceId: string
326
- spatialDataSourceAttributes: JDataSourceAttribute[] | null
324
+ spatialDataSourceAttributes: JAttribute[] | null
327
325
  selectionStyleId: string
328
326
  // dynamicFilter: JDynamicFilter
329
327
  // TODO JMAP8-3266 : use a localized type instad of a graphQL one
@@ -612,15 +610,6 @@ export interface JLayerSetLayerGroupsExpansionParams {
612
610
  open: boolean
613
611
  }
614
612
 
615
- export interface JAttribute {
616
- id: string
617
- name: string
618
- type: ATTRIBUTE_TYPES
619
- indexed: boolean
620
- title: JLocaleTranslation
621
- valueDomain?: JValueDomain[]
622
- }
623
-
624
613
  export enum ATTRIBUTE_TYPES {
625
614
  TINYINT = "TINYINT",
626
615
  SMALLINT = "SMALLINT",
@@ -640,13 +629,3 @@ export enum ATTRIBUTE_TYPES {
640
629
  ARRAY = "ARRAY",
641
630
  BOOLEAN = "BOOLEAN"
642
631
  }
643
-
644
- export type JValueDomain =
645
- | {
646
- value: string | number
647
- title: JLocaleTranslation
648
- }
649
- | {
650
- nullValue: true
651
- title: JLocaleTranslation
652
- }
@@ -1,5 +1,4 @@
1
- import type { JAnyFilterCondition, JDynamicFilterGraphQL } from "jmapcloud-types"
2
- import type { JDataSourceAttribute } from "./datasource.ts"
1
+ import type { JAnyFilterCondition, JAttribute, JAttributeType, JDynamicFilterGraphQL } from "jmapcloud-types"
3
2
  import type { JLocaleTranslation } from "./language.d.ts"
4
3
  export {}
5
4
  // ALL_TABLE_ATTRIBUTE_TYPES in all-enum.ts
@@ -21,8 +20,8 @@ export interface JTable {
21
20
  organizationId: string
22
21
  projectId: string
23
22
  name: string
24
- attributes: JTableAttribute[]
25
- dataSourceAttributes: JDataSourceAttribute[] | null
23
+ attributes: JAttribute[]
24
+ dataSourceAttributes: JAttribute[] | null
26
25
  listed: boolean
27
26
  description: JLocaleTranslation
28
27
  dataSourceId: string
@@ -38,7 +37,7 @@ export interface JTableAttribute {
38
37
  name: string
39
38
  title: string
40
39
  label: string
41
- type: JTABLE_ATTRIBUTE_TYPES
40
+ type: JAttributeType
42
41
  indexed: boolean
43
42
  }
44
43
 
@@ -59,6 +58,7 @@ export interface JTableDataParams {
59
58
  limit?: number
60
59
  filter?: JAnyFilterCondition
61
60
  sort?: string
61
+ columns?: string[]
62
62
  }
63
63
 
64
64
  export interface JTablePermissions {