jmapcloud-ng-core-types 2.0.17-qa.4 → 2.0.17-qa.6

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
@@ -89,9 +89,10 @@ export interface JUIService {
89
89
  }
90
90
 
91
91
  export interface JSimpleSearchService {
92
- getInvalidQueryStringCharacters(): string
92
+ getSelectedLayerIds(): JId[]
93
+ setSelectedLayerIds(layerIds: JId[]): void
93
94
  setQueryString(queryString: string): void
94
- getMinimumQueryStringLength(): number
95
+ search(queryString: string, options?: JSimpleSearchOptions): Promise<JSimpleSearchResult[]>
95
96
  }
96
97
 
97
98
  export interface JLibraryService {
@@ -251,7 +252,6 @@ export interface JEventService {
251
252
  Language: JLanguageEventModule
252
253
  Map: JMapEventModule
253
254
  Geocoding: JGeocodingEventModule
254
- SimpleSearch: JSimpleSearchEventModule
255
255
  Project: JProjectEventModule
256
256
  User: JUserEventModule
257
257
  Feature: JFeatureEventModule
@@ -330,13 +330,6 @@ export interface JGeocodingEventModule extends JEventModule {
330
330
  }
331
331
  }
332
332
 
333
- export interface JSimpleSearchEventModule extends JEventModule {
334
- on: {
335
- success(listenerId: string, fn: (params: JSimpleSearchSuccessEventParams) => void): void
336
- error(listenerId: string, fn: (params: JSimpleSearchErrorEventParams) => void): void
337
- }
338
- }
339
-
340
333
  export interface JLayerEventModule extends JEventModule {
341
334
  on: {
342
335
  layersChange(listenerId: string, fn: (params: JLayerEventChangeParams) => void): void
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmapcloud-ng-core-types",
3
- "version": "2.0.17-qa.4",
3
+ "version": "2.0.17-qa.6",
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
@@ -113,7 +113,7 @@ import type { JMouseOverAfterEventParams, JMouseOverBeforeEventParams, JMouseOve
113
113
  import type { JProject, JProjectAllEventParams, JProjectEventParams, JProjectLoadThumbnailsParams } from "./jmap/project.d.ts"
114
114
  import type { JMapSelectionParams, JSelectionSetLayersSelectionParams } from "./jmap/selection.d.ts"
115
115
  import type { JServerAnyIdentityProvider, JServerIdentityProviderById, JServerInfo, JServerInfoReadyEventParams, JServerVersion } from "./jmap/server.d.ts"
116
- import type { JSimpleSearchErrorEventParams, JSimpleSearchSuccessEventParams } from "./jmap/simple-search.d.ts"
116
+ import type { JSimpleSearchOptions, JSimpleSearchResult } from "./jmap/simple-search.d.ts"
117
117
  import type { JTable, JTableData, JTableDataParams } from "./jmap/table.d.ts"
118
118
  import type { JIFramePopupParams } from "./jmap/ui.d.ts"
119
119
  import type { JJMapPasswordPolicyCompliance, JOrganization, JSessionData, JUserEventSessionChangedParams, JUserInfo } from "./jmap/user.d.ts"
@@ -7003,14 +7003,23 @@ export namespace JMap {
7003
7003
  *
7004
7004
  */
7005
7005
  namespace SimpleSearch {
7006
+ /** Returns a copy of the selected layer IDs. Selection lasts until the project changes. */
7007
+ function getSelectedLayerIds(): JId[]
7008
+ /**
7009
+ * Selects indexed layers and all indexed siblings sharing their data sources.
7010
+ * Unknown IDs are ignored. An empty list disables search, including table searches.
7011
+ * The mounted NG search UI re-runs an active query immediately; indexed tables remain included when any layer is selected.
7012
+ * @throws if no project is active or layerIds is not an array.
7013
+ */
7014
+ function setSelectedLayerIds(layerIds: JId[]): void
7006
7015
  /**
7007
7016
  * ***JMap.SimpleSearch.setQueryString***
7008
7017
  *
7009
- * Executes 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.
7018
+ * Updates the simple-search input. While the NG search UI is mounted, it debounces changes for 500ms and searches the selected indexed layers and indexed tables of the current project. See {@link https://opensearch.org/docs/latest/query-dsl/full-text/query-string/#query-string-syntax here} for details.
7010
7019
  *
7011
7020
  * All query_string reserved characters are escaped, and the following characters can't be used: "<>"
7012
7021
  *
7013
- * This method will fetch an array of result object indicating all matches found.
7022
+ * This method only updates state. Requests require the NG search UI to be mounted; results and request status are managed by its React Query hook.
7014
7023
  *
7015
7024
  * @throws if no project is loaded, if the passed search string is not a string or if it contains invalid characters.
7016
7025
  * @param queryString the search string to be used
@@ -7020,31 +7029,21 @@ export namespace JMap {
7020
7029
  */
7021
7030
  function setQueryString(queryString: string): void
7022
7031
  /**
7023
- * **JMap.SimpleSearch.getMinimumQueryStringLength**
7032
+ * ***JMap.SimpleSearch.search***
7024
7033
  *
7025
- * Returns the query string length required to trigger a simple search
7034
+ * Runs one search and resolves with the results, one entry per data source. The input and the
7035
+ * layer selection are not touched.
7026
7036
  *
7027
- * @example
7028
- * ```ts
7029
- * // returns the minimum search string length
7030
- * JMap.SimpleSearch.getMinimumQueryStringLength()
7031
- * // 1
7032
- * ```
7033
- */
7034
- function getMinimumQueryStringLength(): number
7035
- /**
7036
- * **JMap.SimpleSearch.getInvalidQueryStringCharacters**
7037
- *
7038
- * Returns a string composed of all forbidden characters in simple search strings.
7037
+ * `options.layerIds` restricts the search to those indexed layers; indexed tables are always
7038
+ * included. Omit it to search the whole project. An empty list resolves with no results.
7039
7039
  *
7040
+ * @throws if no project is loaded, if queryString is not a string or contains invalid characters, or if options.layerIds is not an array.
7040
7041
  * @example
7041
7042
  * ```ts
7042
- * // returns the invalid characters
7043
- * JMap.SimpleSearch.getInvalidQueryStringCharacters()
7044
- * // "<>"
7043
+ * JMap.SimpleSearch.search("montreal", { layerIds: JMap.SimpleSearch.getSelectedLayerIds() }).then(results => console.log(results))
7045
7044
  * ```
7046
7045
  */
7047
- function getInvalidQueryStringCharacters(): string
7046
+ function search(queryString: string, options?: JSimpleSearchOptions): Promise<JSimpleSearchResult[]>
7048
7047
  }
7049
7048
  /**
7050
7049
  * **JMap.Draw**
@@ -7823,107 +7822,6 @@ export namespace JMap {
7823
7822
  */
7824
7823
  function remove(listenerId: string): void
7825
7824
  }
7826
- /**
7827
- * ***JMap.Event.SimpleSearch***
7828
- *
7829
- * Here you can manage all simple search event listeners.
7830
- *
7831
- * Click to see all events available: ***{@link JMap.Event.SimpleSearch.on}***.
7832
- */
7833
- namespace SimpleSearch {
7834
- /**
7835
- * ***JMap.Event.SimpleSearch.on***
7836
- *
7837
- * Here you have all JMap Cloud NG Core simple search events on which you can attach a listener.
7838
- */
7839
- namespace on {
7840
- /**
7841
- * ***JMap.Event.SimpleSearch.on.success***
7842
- *
7843
- * This event is triggered when a simple search has been completed.
7844
- *
7845
- * @param listenerId Your listener id (must be unique)
7846
- * @param fn Your listener function
7847
- * @example
7848
- * ```ts
7849
- * // log a message in the console once the simple search has been completed
7850
- * JMap.Event.SimpleSearch.on.success(
7851
- * "custom-simple-search-success",
7852
- * params => console.log("A simple search has been completed", params.results)
7853
- * )
7854
- * ```
7855
- */
7856
- function success(listenerId: string, fn: (params: JSimpleSearchSuccessEventParams) => void): void
7857
- /**
7858
- * ***JMap.Event.SimpleSearch.on.error***
7859
- *
7860
- * This event is triggered when a simple search has been processed, but an error occured.
7861
- *
7862
- * @param listenerId Your listener id (must be unique)
7863
- * @param fn Your listener function
7864
- * @example
7865
- * ```ts
7866
- * // log a message in the console if a simple search error occured
7867
- * JMap.Event.SimpleSearch.on.error(
7868
- * "custom-simple-search-error",
7869
- * params => console.log("A simple search has failed", params)
7870
- * )
7871
- * ```
7872
- */
7873
- function error(listenerId: string, fn: (params: JSimpleSearchErrorEventParams) => void): void
7874
- }
7875
- /**
7876
- * ***JMap.Event.SimpleSearch.activate***
7877
- *
7878
- * Activate the listener.
7879
- *
7880
- * If the listener is already active, do nothing.
7881
- *
7882
- * If the listener is inactive, it will be reactivated and will be called again ...
7883
- *
7884
- * @param listenerId The listener id
7885
- * @example
7886
- * ```ts
7887
- * // activate the listener "my-simple-search-listener"
7888
- * JMap.Event.SimpleSearch.activate("my-simple-search-listener")
7889
- * ```
7890
- */
7891
- function activate(listenerId: string): void
7892
- /**
7893
- * ***JMap.Event.SimpleSearch.deactivate***
7894
- *
7895
- * Deactivate the listener.
7896
- *
7897
- * If the listener id doesn't exists or if the listener is already inactive, do nothing.
7898
- *
7899
- * If the listener is active, it will be deactivated and will be ignored ...
7900
- *
7901
- * @param listenerId The listener id
7902
- * @example
7903
- * ```ts
7904
- * // deactivate the listener "my-simple-search-listener"
7905
- * JMap.Event.SimpleSearch.deactivate("my-simple-search-listener")
7906
- * ```
7907
- */
7908
- function deactivate(listenerId: string): void
7909
- /**
7910
- * ***JMap.Event.SimpleSearch.remove***
7911
- *
7912
- * Remove the listener.
7913
- *
7914
- * If the listener doesn't exist, do nothing.
7915
- *
7916
- * Remove the listener from JMap Cloud NG Core library. The listener is deleted and never called again after that.
7917
- *
7918
- * @param listenerId The listener id
7919
- * @example
7920
- * ```ts
7921
- * // remove the listener "my-simple-search-listener"
7922
- * JMap.Event.SimpleSearch.remove("my-simple-search-listener")
7923
- * ```
7924
- */
7925
- function remove(listenerId: string): void
7926
- }
7927
7825
  namespace Server {
7928
7826
  /**
7929
7827
  * ***JMap.Event.Server.on***
@@ -318,10 +318,9 @@ declare global {
318
318
  /** @internal */ type JServerVersion = server.JServerVersion
319
319
  /** @internal */ type JServerInfoReadyEventParams = server.JServerInfoReadyEventParams
320
320
  /** @internal */ type JSimpleSearchQueryString = simplesearch.JSimpleSearchQueryString
321
+ /** @internal */ type JSimpleSearchOptions = simplesearch.JSimpleSearchOptions
321
322
  /** @internal */ type JSimpleSearchResult = simplesearch.JSimpleSearchResult
322
323
  /** @internal */ type JSimpleSearchResultHit = simplesearch.JSimpleSearchResultHit
323
- /** @internal */ type JSimpleSearchSuccessEventParams = simplesearch.JSimpleSearchSuccessEventParams
324
- /** @internal */ type JSimpleSearchErrorEventParams = simplesearch.JSimpleSearchErrorEventParams
325
324
  /** @internal */ type JWindow = startupoptions.JWindow
326
325
  /** @internal */ type JCoreOptions = startupoptions.JCoreOptions
327
326
  /** @internal */ type JTABLE_ATTRIBUTE_TYPES = table.JTABLE_ATTRIBUTE_TYPES
@@ -354,6 +354,7 @@ export interface JLayerAttribute {
354
354
  id: string
355
355
  name: string
356
356
  label: string
357
+ indexed: boolean
357
358
  type: JLAYER_ATTRIBUTE_TYPES
358
359
  }
359
360
 
@@ -8,6 +8,10 @@ export interface JSimpleSearchQueryString {
8
8
  }
9
9
  }
10
10
 
11
+ export interface JSimpleSearchOptions {
12
+ layerIds?: JId[]
13
+ }
14
+
11
15
  export interface JSimpleSearchResult {
12
16
  took: number
13
17
  timedOut: boolean
@@ -39,11 +43,3 @@ export interface JSimpleSearchResultHit {
39
43
  [attributeName: string]: string[]
40
44
  }
41
45
  }
42
-
43
- export interface JSimpleSearchSuccessEventParams {
44
- result: JSimpleSearchResult[]
45
- }
46
-
47
- export interface JSimpleSearchErrorEventParams {
48
- error: any
49
- }
package/public/state.d.ts CHANGED
@@ -69,12 +69,13 @@ export interface JGeocodingState {
69
69
  results: JGeocodingResult[]
70
70
  }
71
71
 
72
+ /**
73
+ * User intent only. The mounted NG search UI manages request state and results with React Query.
74
+ */
72
75
  export interface JSimpleSearchState {
73
- isLoadPending: boolean
74
- isLoading: boolean
75
- hasLoadingError: boolean
76
+ /** The string as typed, updated on every call to `JMap.SimpleSearch.setQueryString`. */
76
77
  queryString: string
77
- results: JSimpleSearchResult[]
78
+ selectedLayerIds: JId[]
78
79
  }
79
80
 
80
81
  export interface JGeolocationState {