jmapcloud-ng-core-types 1.0.35 → 1.0.36

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
@@ -26,6 +26,7 @@ export interface JCoreService extends JCoreMainService {
26
26
  MapContext: JMapContextService
27
27
  UI: JUIService
28
28
  SimpleSearch: JSimpleSearchService
29
+ Table: JTableService
29
30
  }
30
31
 
31
32
  export interface JUIService {
@@ -412,6 +413,7 @@ export interface JCoreState {
412
413
  map: JMapState
413
414
  project: JProjectState
414
415
  layer: JLayerState
416
+ table: JTableState
415
417
  user: JUserState
416
418
  language: JLanguageState
417
419
  photo: JPhotoState
@@ -538,6 +540,12 @@ export interface JLayerState {
538
540
  vectorLayerIds: JId[]
539
541
  }
540
542
 
543
+ export interface JTableState {
544
+ isLoading: boolean
545
+ hasLoadingError: boolean
546
+ tables: JTable[]
547
+ }
548
+
541
549
  export interface JPhotoState {
542
550
  selectedPhotoId: JId | undefined
543
551
  photos: JPhoto[]
@@ -903,6 +911,11 @@ export interface JLayerService {
903
911
  openInformationReportInNewTab(layerId: JId, featureIds: JId[]): Promise<string>
904
912
  }
905
913
 
914
+ export interface JTableService {
915
+ getTables(): JTable[]
916
+ getTableData(dataSourceId: JId, params: JTableDataParams): Promise<JTableData>
917
+ }
918
+
906
919
  export interface JLayerSearchService {
907
920
  byAttribute(params: JLayerSearchByAttributesParams): Promise<Feature[]>
908
921
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmapcloud-ng-core-types",
3
- "version": "1.0.35",
3
+ "version": "1.0.36",
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
@@ -12725,4 +12725,50 @@ declare namespace JMap {
12725
12725
  */
12726
12726
  function getContainerHeight(): number
12727
12727
  }
12728
+ namespace Table {
12729
+ /**
12730
+ * **JMap.Layer.getTables**
12731
+ *
12732
+ * Returns an array of JMap tables available in the current project.
12733
+ *
12734
+ * If no project is loaded, it returns an empty array.
12735
+ *
12736
+ * @returns {JTable[]} An array of `JTable` objects representing the tables in the current project.
12737
+ *
12738
+ * @example
12739
+ * ```ts
12740
+ * // Retrieves all JMap tables
12741
+ * JMap.Layer.getTables();
12742
+ * ```
12743
+ */
12744
+ function getTables(): JTable[]
12745
+
12746
+ /**
12747
+ * **JMap.Table.getTableData**
12748
+ *
12749
+ * Asynchronously retrieves the JMap table data for a specified tabular data source ID.
12750
+ *
12751
+ * @throws {Error} If no data source is found for the given ID.
12752
+ *
12753
+ * @param {JId} dataSourceId - The ID of the JMap data source.
12754
+ * @param {JTableDataParams} params - Includes the following optional parameters: startIndex, limit, filter, sort.
12755
+ * startIndex: The starting index for data retrieval (zero-based).
12756
+ * limit: The maximum number of records to retrieve.
12757
+ * filter: A CQL filter.
12758
+ * sort: A sort model.
12759
+ *
12760
+ * @returns {Promise<JTableData>} A promise that resolves to a `JTableData` object representing the table data.
12761
+ *
12762
+ * @example
12763
+ * ```ts
12764
+ * // Retrieves up to 50 rows from data source ID 3, starting at index 0, sorted in ascending order based on the "ATTRIBUTE_A" attribute
12765
+ * JMap.Table.getTableData(3, {startIndex: 0, limit: 50, sort:"ATTRIBUTE_A ASC"}).then(tableData => {
12766
+ * console.log(tableData);
12767
+ * }).catch(error => {
12768
+ * console.error("Failed to fetch table data:", error);
12769
+ * });
12770
+ * ```
12771
+ */
12772
+ function getTableData(dataSourceId: JId, params: JTableDataParams): Promise<JTableData>
12773
+ }
12728
12774
  }
@@ -0,0 +1,23 @@
1
+ declare interface JTable {
2
+ id: string
3
+ organizationId: string
4
+ projectId: string
5
+ name: JLocaleTranslation
6
+ description: JLocaleTranslation
7
+ dataSourceId: string
8
+ allowClientSideEditing: boolean
9
+ }
10
+
11
+ declare interface JTableData {
12
+ columns: string[]
13
+ links: Array<{ href: string; rel: string; title: string; type: string }>
14
+ numberReturned: number
15
+ rows: []
16
+ }
17
+
18
+ declare interface JTableDataParams {
19
+ startIndex?: number
20
+ limit?: number
21
+ filter?: string
22
+ sort?: string
23
+ }