jmapcloud-ng-core-types 1.0.1 → 1.0.1002

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
@@ -25,6 +25,7 @@ export interface JCoreService extends JCoreMainService {
25
25
  Projection: JProjectionService
26
26
  MapContext: JMapContextService
27
27
  UI: JUIService
28
+ SimpleSearch: JSimpleSearchService
28
29
  }
29
30
 
30
31
  export interface JUIService {
@@ -35,6 +36,12 @@ export interface JUIService {
35
36
  getContainerHeight(): number
36
37
  }
37
38
 
39
+ export interface JSimpleSearchService {
40
+ getInvalidQueryStringCharacters(): string
41
+ setQueryString(queryString: string): void
42
+ getMinimumQueryStringLength(): number
43
+ }
44
+
38
45
  export interface JLibraryService {
39
46
  maplibregl(): any
40
47
  html2canvas(): any
@@ -196,6 +203,7 @@ export interface JEventService {
196
203
  Language: JLanguageEventModule
197
204
  Map: JMapEventModule
198
205
  Geocoding: JGeocodingEventModule
206
+ SimpleSearch: JSimpleSearchEventModule
199
207
  Photo: JPhotoEventModule
200
208
  Project: JProjectEventModule
201
209
  User: JUserEventModule
@@ -296,6 +304,13 @@ export interface JGeocodingEventModule extends JEventModule {
296
304
  }
297
305
  }
298
306
 
307
+ export interface JSimpleSearchEventModule extends JEventModule {
308
+ on: {
309
+ success(listenerId: string, fn: (params: JSimpleSearchSuccessEventParams) => void): void
310
+ error(listenerId: string, fn: (params: JSimpleSearchErrorEventParams) => void): void
311
+ }
312
+ }
313
+
299
314
  export interface JLayerEventModule extends JEventModule {
300
315
  on: {
301
316
  layersChange(listenerId: string, fn: (params: JLayerEventChangeParams) => void): void
@@ -396,6 +411,7 @@ export interface JCoreState {
396
411
  photo: JPhotoState
397
412
  query: JQueryState
398
413
  geocoding: JGeocodingState
414
+ simpleSearch: JSimpleSearchState
399
415
  geolocation: JGeolocationState
400
416
  form: JFormState
401
417
  server: JServerState
@@ -448,6 +464,14 @@ export interface JGeocodingState {
448
464
  results: JGeocodingResult[]
449
465
  }
450
466
 
467
+ export interface JSimpleSearchState {
468
+ isLoadPending: boolean
469
+ isLoading: boolean
470
+ hasLoadingError: boolean
471
+ queryString: string
472
+ results: JSimpleSearchResult
473
+ }
474
+
451
475
  export interface JGeolocationState {
452
476
  isLocationDisplayed: boolean
453
477
  isEnabled: boolean
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmapcloud-ng-core-types",
3
- "version": "1.0.1",
3
+ "version": "1.0.1002",
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
@@ -6789,6 +6789,62 @@ declare namespace JMap {
6789
6789
  function getDateFnsDateFormat(): string
6790
6790
  }
6791
6791
 
6792
+ /**
6793
+ * **JMap.SimpleSearch**
6794
+ *
6795
+ * A search mecanism that let the user find features on any layer that has been indexed.
6796
+ *
6797
+ * The JMap Cloud administrator is responsible to specify which attributes of which spatial data sources are indexed. Once set, a global search can be made over a whole project to find features based on those indexed attributes.
6798
+ *
6799
+ * JMap Cloud implements the OpenSearch standard. For more details, see {@link https://opensearch.org/docs/latest/ the official documentation}
6800
+ *
6801
+ */
6802
+
6803
+ namespace SimpleSearch {
6804
+ /**
6805
+ * ***JMap.SimpleSearch.setQueryString***
6806
+ *
6807
+ * execute a "query string" search on all layers of the current project using the passed string as the query. See {@link https://opensearch.org/docs/latest/query-dsl/full-text/query-string/#query-string-syntax here} for details
6808
+ *
6809
+ * This method will fetch a result object indicating all matches found.
6810
+ *
6811
+ * @throws if no project is loaded
6812
+ * @param queryString the search string to be used
6813
+ * @example ```ts
6814
+ *
6815
+ * ```
6816
+ */
6817
+ function setQueryString(queryString: string): void
6818
+
6819
+ /**
6820
+ * **JMap.SimpleSearch.getMinimumQueryStringLength**
6821
+ *
6822
+ * Returns the query string length required to trigger a simple search
6823
+ *
6824
+ * @example ```ts
6825
+ *
6826
+ * // returns the minimum search string length
6827
+ * JMap.SimpleSearch.getMinimumQueryStringLength()
6828
+ * // 3
6829
+ * ```
6830
+ */
6831
+ function getMinimumQueryStringLength(): number
6832
+
6833
+ /**
6834
+ * **JMap.SimpleSearch.getInvalidQueryStringCharacters**
6835
+ *
6836
+ * Returns a string composed of all forbiden characters in simple search strings
6837
+ *
6838
+ * @example ```ts
6839
+ *
6840
+ * // returns the invalid characters
6841
+ * JMap.SimpleSearch.getInvalidQueryStringCharacters()
6842
+ * // ";"
6843
+ * ```
6844
+ */
6845
+ function getInvalidQueryStringCharacters(): string
6846
+ }
6847
+
6792
6848
  /**
6793
6849
  * **JMap.Query**
6794
6850
  *
@@ -7348,6 +7404,112 @@ declare namespace JMap {
7348
7404
  function remove(listenerId: string): void
7349
7405
  }
7350
7406
 
7407
+ /**
7408
+ * ***JMap.Event.SimpleSearch***
7409
+ *
7410
+ * Here you can manage all simple search event listeners.
7411
+ *
7412
+ * Click to see all events available: ***{@link JMap.Event.SimpleSearch.on}***.
7413
+ */
7414
+ namespace SimpleSearch {
7415
+ /**
7416
+ * ***JMap.Event.SimpleSearch.on***
7417
+ *
7418
+ * Here you have all JMap Cloud NG Core simple search events on which you can attach a listener.
7419
+ */
7420
+ namespace on {
7421
+ /**
7422
+ * ***JMap.Event.SimpleSearch.on.success***
7423
+ *
7424
+ * This event is triggered when a simple search has been completed.
7425
+ *
7426
+ * @param listenerId Your listener id (must be unique)
7427
+ * @param fn Your listener function
7428
+ * @example ```ts
7429
+ *
7430
+ * // log a message in the console once the simple search has been completed
7431
+ * JMap.Event.SimpleSearch.on.success(
7432
+ * "custom-simple-search-success",
7433
+ * params => console.log("A simple search has been completed", params.results)
7434
+ * )
7435
+ * ```
7436
+ */
7437
+ function success(listenerId: string, fn: (params: JSimpleSearchSuccessEventParams) => void): void
7438
+
7439
+ /**
7440
+ * ***JMap.Event.SimpleSearch.on.error***
7441
+ *
7442
+ * This event is triggered when a simple search has been processed, but an error occured.
7443
+ *
7444
+ * @param listenerId Your listener id (must be unique)
7445
+ * @param fn Your listener function
7446
+ * @example ```ts
7447
+ *
7448
+ * // log a message in the console if a simple search error occured
7449
+ * JMap.Event.SimpleSearch.on.error(
7450
+ * "custom-simple-search-error",
7451
+ * params => console.log("A simple search has failed", params)
7452
+ * )
7453
+ * ```
7454
+ */
7455
+ function error(listenerId: string, fn: (params: JSimpleSearchErrorEventParams) => void): void
7456
+ }
7457
+
7458
+ /**
7459
+ * ***JMap.Event.SimpleSearch.activate***
7460
+ *
7461
+ * Activate the listener.
7462
+ *
7463
+ * If the listener is already active, do nothing.
7464
+ *
7465
+ * If the listener is inactive, it will be reactivated and will be called again ...
7466
+ *
7467
+ * @param listenerId The listener id
7468
+ * @example ```ts
7469
+ *
7470
+ * // activate the listener "my-simple-search-listener"
7471
+ * JMap.Event.SimpleSearch.activate("my-simple-search-listener")
7472
+ * ```
7473
+ */
7474
+ function activate(listenerId: string): void
7475
+
7476
+ /**
7477
+ * ***JMap.Event.SimpleSearch.deactivate***
7478
+ *
7479
+ * Deactivate the listener.
7480
+ *
7481
+ * If the listener id doesn't exists or if the listener is already inactive, do nothing.
7482
+ *
7483
+ * If the listener is active, it will be deactivated and will be ignored ...
7484
+ *
7485
+ * @param listenerId The listener id
7486
+ * @example ```ts
7487
+ *
7488
+ * // deactivate the listener "my-simple-search-listener"
7489
+ * JMap.Event.SimpleSearch.deactivate("my-simple-search-listener")
7490
+ * ```
7491
+ */
7492
+ function deactivate(listenerId: string): void
7493
+
7494
+ /**
7495
+ * ***JMap.Event.SimpleSearch.remove***
7496
+ *
7497
+ * Remove the listener.
7498
+ *
7499
+ * If the listener doesn't exist, do nothing.
7500
+ *
7501
+ * Remove the listener from JMap Cloud NG Core library. The listener is deleted and never called again after that.
7502
+ *
7503
+ * @param listenerId The listener id
7504
+ * @example ```ts
7505
+ *
7506
+ * // remove the listener "my-simple-search-listener"
7507
+ * JMap.Event.SimpleSearch.remove("my-simple-search-listener")
7508
+ * ```
7509
+ */
7510
+ function remove(listenerId: string): void
7511
+ }
7512
+
7351
7513
  namespace Server {
7352
7514
  /**
7353
7515
  * ***JMap.Event.Server.on***
@@ -0,0 +1,42 @@
1
+ declare interface JSimpleSearchQueryString {
2
+ query: {
3
+ query_string: {
4
+ query: string
5
+ }
6
+ }
7
+ }
8
+
9
+ declare interface JSimpleSearchResult {
10
+ took: number
11
+ timedOut: boolean
12
+ shards: {
13
+ total: number
14
+ successful: number
15
+ skipped: number
16
+ failed: number
17
+ }
18
+ hits: {
19
+ total: {
20
+ value: number
21
+ relation: string
22
+ }
23
+ maxScore: number
24
+ hits: JSimpleSearchResultHit[]
25
+ }
26
+ }
27
+
28
+ declare interface JSimpleSearchResultHit {
29
+ _index: string
30
+ _source: { spatialDataSourceId: string } & { [attributeName: string]: any }
31
+ _id: JId
32
+ _score: number
33
+ highlight?: { [attributeName: string]: string[] }
34
+ }
35
+
36
+ declare interface JSimpleSearchSuccessEventParams {
37
+ result: JSimpleSearchResult
38
+ }
39
+
40
+ declare interface JSimpleSearchErrorEventParams {
41
+ error: any
42
+ }