@interopio/search-api 3.1.0 → 3.1.1
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/README.md +243 -243
- package/changelog.md +41 -41
- package/dist/search-api.es.js +1 -1
- package/dist/search-api.umd.js +1 -1
- package/license.md +9 -9
- package/package.json +3 -3
- package/search.d.ts +380 -380
package/search.d.ts
CHANGED
|
@@ -1,381 +1,381 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { IOConnectCore } from "@interopio/core";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @docname Search
|
|
6
|
-
* @intro
|
|
7
|
-
* The Search API offers two distinct functionalities: you can use it to create both search providers and search clients.
|
|
8
|
-
* Search providers are apps that respond to search queries, whereas search clients are apps that initiate searches.
|
|
9
|
-
* For instance, a search provider may return a list of instruments as a response to a search query, and may also support
|
|
10
|
-
* one or more actions - like showing a chart for the selected instrument. Actions may be executed when the user clicks
|
|
11
|
-
* on a result in the UI of a search client app. You may present multiple actions as options to the user via the search
|
|
12
|
-
* client UI, so that they may choose how to handle the search result depending on their current needs.
|
|
13
|
-
* The Search API also enables you to define search types, set debounce time for search queries,
|
|
14
|
-
* set limits for search results and more.
|
|
15
|
-
*
|
|
16
|
-
* The Search API is accessible via the `io.search` object.
|
|
17
|
-
*/
|
|
18
|
-
export namespace IOConnectSearch {
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @ignore
|
|
22
|
-
*/
|
|
23
|
-
export interface Config {} // eslint-disable-line @typescript-eslint/no-empty-interface
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Search API.
|
|
27
|
-
*/
|
|
28
|
-
export interface API {
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Search API version.
|
|
32
|
-
*/
|
|
33
|
-
version: string;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Sets the debounce interval for search queries.
|
|
37
|
-
* @param milliseconds Interval in milliseconds to use as debounce interval.
|
|
38
|
-
*/
|
|
39
|
-
setDebounceMS(milliseconds: number): void;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Retrieves the current debounce interval for search queries.
|
|
43
|
-
*/
|
|
44
|
-
getDebounceMS(): number;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Retrieves a list of all available search providers.
|
|
48
|
-
*/
|
|
49
|
-
listProviders(): Promise<ProviderData[]>;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Retrieves a list of all available search types from all search providers.
|
|
53
|
-
*/
|
|
54
|
-
listTypes(): Promise<SearchType[]>;
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Creates a search query.
|
|
58
|
-
* @param queryConfig Settings for creating a search query.
|
|
59
|
-
*/
|
|
60
|
-
query(queryConfig: QueryConfig): Promise<Query>;
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Registers a search provider.
|
|
64
|
-
* @param config Settings for registering a search provider.
|
|
65
|
-
*/
|
|
66
|
-
registerProvider(config: ProviderRegistrationConfig): Promise<Provider>;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Describes a created search query.
|
|
71
|
-
*/
|
|
72
|
-
export interface Query {
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Cancels the search query.
|
|
76
|
-
*/
|
|
77
|
-
cancel(): Promise<void>;
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Notifies when a batch with results from the search query is received.
|
|
81
|
-
* @param callback Callback function for handling the event. Receives as an argument an object holding
|
|
82
|
-
* a list of the available search result and details about the search provider that has sent the results.
|
|
83
|
-
*/
|
|
84
|
-
onResults(callback: (resultBatch: QueryResultBatch) => void): UnsubscribeFunction;
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Notifies when the search query is completed, i.e. when all search operations
|
|
88
|
-
* in all search providers have been completed.
|
|
89
|
-
* @param callback Callback function for handling the event.
|
|
90
|
-
*/
|
|
91
|
-
onCompleted(callback: () => void): UnsubscribeFunction;
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Notifies when there is an error in the search process.
|
|
95
|
-
* @param callback Callback function for handling the event. Receives as an argument an object holding
|
|
96
|
-
* the error message sent by the search provider and data describing the provider that has sent the error.
|
|
97
|
-
*/
|
|
98
|
-
onError(callback: (error: QueryError) => void): UnsubscribeFunction;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Describes a registered search provider.
|
|
103
|
-
*/
|
|
104
|
-
export interface Provider extends ProviderData {
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Notifies when a search query is received.
|
|
108
|
-
* @param callback Callback function for handling the event. Receives as an argument an object describing the search query.
|
|
109
|
-
*/
|
|
110
|
-
onQuery(callback: (query: ProviderQuery) => void): UnsubscribeFunction;
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Notifies when a search query is canceled.
|
|
114
|
-
* @param callback Callback function for handling the event. Receives as an argument an object with an `id` property
|
|
115
|
-
* holding the ID of the canceled search query.
|
|
116
|
-
*/
|
|
117
|
-
onQueryCancel(callback: (query: { id: string }) => void): UnsubscribeFunction;
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Unregisters the search provider from the framework.
|
|
121
|
-
*/
|
|
122
|
-
unregister(): Promise<void>;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Search provider details.
|
|
127
|
-
*/
|
|
128
|
-
export interface ProviderData {
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Unique ID of the Interop instance of the app.
|
|
132
|
-
*/
|
|
133
|
-
interopId: string;
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Unique app ID within the framework.
|
|
137
|
-
*/
|
|
138
|
-
id: string;
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Name of the search provider.
|
|
142
|
-
*/
|
|
143
|
-
name: string;
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Name of the app that has registered the search provider.
|
|
147
|
-
*/
|
|
148
|
-
appName?: string;
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* List of search types with which the search provider works.
|
|
152
|
-
*/
|
|
153
|
-
types?: SearchType[];
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Settings for creating a search query.
|
|
158
|
-
*/
|
|
159
|
-
export interface QueryConfig {
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* String for which to query the search providers.
|
|
163
|
-
*/
|
|
164
|
-
search: string;
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* List of search providers to query.
|
|
168
|
-
*/
|
|
169
|
-
providers?: ProviderData[];
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* List of search types in which the search client app is interested.
|
|
173
|
-
*/
|
|
174
|
-
types?: SearchType[];
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Specifies the maximum total results and/or the maximum results per search type to return.
|
|
178
|
-
*/
|
|
179
|
-
providerLimits?: ProviderLimits;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Describes the search query received by the search provider and provides methods for responding to it.
|
|
184
|
-
*/
|
|
185
|
-
export interface ProviderQuery extends QueryConfig {
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* ID for the search query (assigned by the framework).
|
|
189
|
-
*/
|
|
190
|
-
id: string;
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Sends individual results back to search clients.
|
|
194
|
-
* @param result Individual search result to send back to search clients.
|
|
195
|
-
*/
|
|
196
|
-
sendResult(result: QueryResult): void;
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Sends errors back to search clients.
|
|
200
|
-
* @param error Error message to send back to search clients.
|
|
201
|
-
*/
|
|
202
|
-
error(error: string): void;
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* Signals the framework that the search operation has been completed.
|
|
206
|
-
*/
|
|
207
|
-
done(): void;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Settings for registering a search provider.
|
|
212
|
-
*/
|
|
213
|
-
export interface ProviderRegistrationConfig {
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Name for the search provider.
|
|
217
|
-
*/
|
|
218
|
-
name: string;
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* Search types with which the provider works.
|
|
222
|
-
*/
|
|
223
|
-
types?: SearchType[];
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* Describes a batch of search results received by search clients.
|
|
228
|
-
*/
|
|
229
|
-
export interface QueryResultBatch {
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* List of individual search results received by search clients.
|
|
233
|
-
*/
|
|
234
|
-
results: QueryResult[];
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* Details about the search provider that has sent the results.
|
|
238
|
-
*/
|
|
239
|
-
provider?: ProviderData;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* Describes a search operation error received by search clients.
|
|
244
|
-
*/
|
|
245
|
-
export interface QueryError {
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Error message.
|
|
249
|
-
*/
|
|
250
|
-
error: string;
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Details about the search provider that has sent the error.
|
|
254
|
-
*/
|
|
255
|
-
provider?: ProviderData;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* Describes the maximum total results and/or the maximum results per search type to return.
|
|
260
|
-
*/
|
|
261
|
-
export interface ProviderLimits {
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* Maximum total results per search operation to return.
|
|
265
|
-
*/
|
|
266
|
-
maxResults?: number;
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* Maximum results per search type to return.
|
|
270
|
-
*/
|
|
271
|
-
maxResultsPerType?: number;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
/**
|
|
275
|
-
* Describes an individual search result received by search clients.
|
|
276
|
-
*/
|
|
277
|
-
export interface QueryResult {
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* The predefined search type of the result.
|
|
281
|
-
*/
|
|
282
|
-
type: SearchType;
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* ID for the search result that can be used by the search client when handling the result.
|
|
286
|
-
*/
|
|
287
|
-
id?: string;
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* Display name for the search result that can be used in a UI.
|
|
291
|
-
*/
|
|
292
|
-
displayName?: string;
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* Description for the search result that can be used in a UI.
|
|
296
|
-
*/
|
|
297
|
-
description?: string;
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* URL pointing to an icon for the search result that can be used in a UI.
|
|
301
|
-
*/
|
|
302
|
-
iconURL?: string;
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* Metadata for the search result that can be used by the search client when handling the result.
|
|
306
|
-
*/
|
|
307
|
-
metadata?: any;
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* A main action that can be used to invoke an already registered Interop method when the user clicks on the search result displayed in a UI.
|
|
311
|
-
* If you need to define multiple actions when handling search results, you can use the `secondaryActions` property instead.
|
|
312
|
-
*/
|
|
313
|
-
action?: MainAction;
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* Secondary actions can be used to invoke different already registered Interop methods if, for example, you want to present the user
|
|
317
|
-
* with a choice of options related to the search result. The `secondaryActions` property can be used independently,
|
|
318
|
-
* without defining a `MainAction` in the `action` property.
|
|
319
|
-
*/
|
|
320
|
-
secondaryActions?: SecondaryAction[];
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
* Describes an already registered Interop method to be assigned as a main action to a search result.
|
|
325
|
-
* This allows search clients to invoke the specified Interop method if, for example, the user clicks on the search result in a UI.
|
|
326
|
-
*/
|
|
327
|
-
export interface MainAction {
|
|
328
|
-
|
|
329
|
-
/**
|
|
330
|
-
* Name of an Interop method to assign as an action for a search result.
|
|
331
|
-
*/
|
|
332
|
-
method: string;
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
* Defines the Interop servers that will be targeted when invoking the specified method. Set to `"all"` to invoke the method on all Interop servers offering it.
|
|
336
|
-
* Alternatively, you can pass the Interop ID of a specific Interop server you want to target.
|
|
337
|
-
*/
|
|
338
|
-
target?: { instance: string } | "all";
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* Arguments to be passed to the specified Interop method when a search client invokes it.
|
|
342
|
-
*/
|
|
343
|
-
params?: any;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
/**
|
|
347
|
-
* Describes an already registered Interop method to be assigned as a secondary action to a search result.
|
|
348
|
-
*/
|
|
349
|
-
export interface SecondaryAction extends MainAction {
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* Name for the assigned action. May be used to differentiate between actions on the client side.
|
|
353
|
-
*/
|
|
354
|
-
name: string;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
/**
|
|
358
|
-
* Describes an entity with which a search provided works.
|
|
359
|
-
*/
|
|
360
|
-
export interface SearchType {
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* Name for the search type.
|
|
364
|
-
*/
|
|
365
|
-
name: string;
|
|
366
|
-
|
|
367
|
-
/**
|
|
368
|
-
* User-friendly name for the search type that can be displayed in UIs.
|
|
369
|
-
*/
|
|
370
|
-
displayName?: string;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
/**
|
|
374
|
-
* Function that can be used to stop receiving notifications about events.
|
|
375
|
-
*/
|
|
376
|
-
type UnsubscribeFunction = () => void;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
export type IOConnectSearchFactoryFunction = (io: IOConnectCore.API, config?: IOConnectSearch.Config) => Promise<void>;
|
|
380
|
-
declare const IOSearch: IOConnectSearchFactoryFunction;
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { IOConnectCore } from "@interopio/core";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @docname Search
|
|
6
|
+
* @intro
|
|
7
|
+
* The Search API offers two distinct functionalities: you can use it to create both search providers and search clients.
|
|
8
|
+
* Search providers are apps that respond to search queries, whereas search clients are apps that initiate searches.
|
|
9
|
+
* For instance, a search provider may return a list of instruments as a response to a search query, and may also support
|
|
10
|
+
* one or more actions - like showing a chart for the selected instrument. Actions may be executed when the user clicks
|
|
11
|
+
* on a result in the UI of a search client app. You may present multiple actions as options to the user via the search
|
|
12
|
+
* client UI, so that they may choose how to handle the search result depending on their current needs.
|
|
13
|
+
* The Search API also enables you to define search types, set debounce time for search queries,
|
|
14
|
+
* set limits for search results and more.
|
|
15
|
+
*
|
|
16
|
+
* The Search API is accessible via the `io.search` object.
|
|
17
|
+
*/
|
|
18
|
+
export namespace IOConnectSearch {
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @ignore
|
|
22
|
+
*/
|
|
23
|
+
export interface Config {} // eslint-disable-line @typescript-eslint/no-empty-interface
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Search API.
|
|
27
|
+
*/
|
|
28
|
+
export interface API {
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Search API version.
|
|
32
|
+
*/
|
|
33
|
+
version: string;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Sets the debounce interval for search queries.
|
|
37
|
+
* @param milliseconds Interval in milliseconds to use as debounce interval.
|
|
38
|
+
*/
|
|
39
|
+
setDebounceMS(milliseconds: number): void;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Retrieves the current debounce interval for search queries.
|
|
43
|
+
*/
|
|
44
|
+
getDebounceMS(): number;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Retrieves a list of all available search providers.
|
|
48
|
+
*/
|
|
49
|
+
listProviders(): Promise<ProviderData[]>;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Retrieves a list of all available search types from all search providers.
|
|
53
|
+
*/
|
|
54
|
+
listTypes(): Promise<SearchType[]>;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Creates a search query.
|
|
58
|
+
* @param queryConfig Settings for creating a search query.
|
|
59
|
+
*/
|
|
60
|
+
query(queryConfig: QueryConfig): Promise<Query>;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Registers a search provider.
|
|
64
|
+
* @param config Settings for registering a search provider.
|
|
65
|
+
*/
|
|
66
|
+
registerProvider(config: ProviderRegistrationConfig): Promise<Provider>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Describes a created search query.
|
|
71
|
+
*/
|
|
72
|
+
export interface Query {
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Cancels the search query.
|
|
76
|
+
*/
|
|
77
|
+
cancel(): Promise<void>;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Notifies when a batch with results from the search query is received.
|
|
81
|
+
* @param callback Callback function for handling the event. Receives as an argument an object holding
|
|
82
|
+
* a list of the available search result and details about the search provider that has sent the results.
|
|
83
|
+
*/
|
|
84
|
+
onResults(callback: (resultBatch: QueryResultBatch) => void): UnsubscribeFunction;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Notifies when the search query is completed, i.e. when all search operations
|
|
88
|
+
* in all search providers have been completed.
|
|
89
|
+
* @param callback Callback function for handling the event.
|
|
90
|
+
*/
|
|
91
|
+
onCompleted(callback: () => void): UnsubscribeFunction;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Notifies when there is an error in the search process.
|
|
95
|
+
* @param callback Callback function for handling the event. Receives as an argument an object holding
|
|
96
|
+
* the error message sent by the search provider and data describing the provider that has sent the error.
|
|
97
|
+
*/
|
|
98
|
+
onError(callback: (error: QueryError) => void): UnsubscribeFunction;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Describes a registered search provider.
|
|
103
|
+
*/
|
|
104
|
+
export interface Provider extends ProviderData {
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Notifies when a search query is received.
|
|
108
|
+
* @param callback Callback function for handling the event. Receives as an argument an object describing the search query.
|
|
109
|
+
*/
|
|
110
|
+
onQuery(callback: (query: ProviderQuery) => void): UnsubscribeFunction;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Notifies when a search query is canceled.
|
|
114
|
+
* @param callback Callback function for handling the event. Receives as an argument an object with an `id` property
|
|
115
|
+
* holding the ID of the canceled search query.
|
|
116
|
+
*/
|
|
117
|
+
onQueryCancel(callback: (query: { id: string }) => void): UnsubscribeFunction;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Unregisters the search provider from the framework.
|
|
121
|
+
*/
|
|
122
|
+
unregister(): Promise<void>;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Search provider details.
|
|
127
|
+
*/
|
|
128
|
+
export interface ProviderData {
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Unique ID of the Interop instance of the app.
|
|
132
|
+
*/
|
|
133
|
+
interopId: string;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Unique app ID within the framework.
|
|
137
|
+
*/
|
|
138
|
+
id: string;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Name of the search provider.
|
|
142
|
+
*/
|
|
143
|
+
name: string;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Name of the app that has registered the search provider.
|
|
147
|
+
*/
|
|
148
|
+
appName?: string;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* List of search types with which the search provider works.
|
|
152
|
+
*/
|
|
153
|
+
types?: SearchType[];
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Settings for creating a search query.
|
|
158
|
+
*/
|
|
159
|
+
export interface QueryConfig {
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* String for which to query the search providers.
|
|
163
|
+
*/
|
|
164
|
+
search: string;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* List of search providers to query.
|
|
168
|
+
*/
|
|
169
|
+
providers?: ProviderData[];
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* List of search types in which the search client app is interested.
|
|
173
|
+
*/
|
|
174
|
+
types?: SearchType[];
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Specifies the maximum total results and/or the maximum results per search type to return.
|
|
178
|
+
*/
|
|
179
|
+
providerLimits?: ProviderLimits;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Describes the search query received by the search provider and provides methods for responding to it.
|
|
184
|
+
*/
|
|
185
|
+
export interface ProviderQuery extends QueryConfig {
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* ID for the search query (assigned by the framework).
|
|
189
|
+
*/
|
|
190
|
+
id: string;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Sends individual results back to search clients.
|
|
194
|
+
* @param result Individual search result to send back to search clients.
|
|
195
|
+
*/
|
|
196
|
+
sendResult(result: QueryResult): void;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Sends errors back to search clients.
|
|
200
|
+
* @param error Error message to send back to search clients.
|
|
201
|
+
*/
|
|
202
|
+
error(error: string): void;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Signals the framework that the search operation has been completed.
|
|
206
|
+
*/
|
|
207
|
+
done(): void;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Settings for registering a search provider.
|
|
212
|
+
*/
|
|
213
|
+
export interface ProviderRegistrationConfig {
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Name for the search provider.
|
|
217
|
+
*/
|
|
218
|
+
name: string;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Search types with which the provider works.
|
|
222
|
+
*/
|
|
223
|
+
types?: SearchType[];
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Describes a batch of search results received by search clients.
|
|
228
|
+
*/
|
|
229
|
+
export interface QueryResultBatch {
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* List of individual search results received by search clients.
|
|
233
|
+
*/
|
|
234
|
+
results: QueryResult[];
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Details about the search provider that has sent the results.
|
|
238
|
+
*/
|
|
239
|
+
provider?: ProviderData;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Describes a search operation error received by search clients.
|
|
244
|
+
*/
|
|
245
|
+
export interface QueryError {
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Error message.
|
|
249
|
+
*/
|
|
250
|
+
error: string;
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Details about the search provider that has sent the error.
|
|
254
|
+
*/
|
|
255
|
+
provider?: ProviderData;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Describes the maximum total results and/or the maximum results per search type to return.
|
|
260
|
+
*/
|
|
261
|
+
export interface ProviderLimits {
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Maximum total results per search operation to return.
|
|
265
|
+
*/
|
|
266
|
+
maxResults?: number;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Maximum results per search type to return.
|
|
270
|
+
*/
|
|
271
|
+
maxResultsPerType?: number;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Describes an individual search result received by search clients.
|
|
276
|
+
*/
|
|
277
|
+
export interface QueryResult {
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* The predefined search type of the result.
|
|
281
|
+
*/
|
|
282
|
+
type: SearchType;
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* ID for the search result that can be used by the search client when handling the result.
|
|
286
|
+
*/
|
|
287
|
+
id?: string;
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Display name for the search result that can be used in a UI.
|
|
291
|
+
*/
|
|
292
|
+
displayName?: string;
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Description for the search result that can be used in a UI.
|
|
296
|
+
*/
|
|
297
|
+
description?: string;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* URL pointing to an icon for the search result that can be used in a UI.
|
|
301
|
+
*/
|
|
302
|
+
iconURL?: string;
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Metadata for the search result that can be used by the search client when handling the result.
|
|
306
|
+
*/
|
|
307
|
+
metadata?: any;
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* A main action that can be used to invoke an already registered Interop method when the user clicks on the search result displayed in a UI.
|
|
311
|
+
* If you need to define multiple actions when handling search results, you can use the `secondaryActions` property instead.
|
|
312
|
+
*/
|
|
313
|
+
action?: MainAction;
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Secondary actions can be used to invoke different already registered Interop methods if, for example, you want to present the user
|
|
317
|
+
* with a choice of options related to the search result. The `secondaryActions` property can be used independently,
|
|
318
|
+
* without defining a `MainAction` in the `action` property.
|
|
319
|
+
*/
|
|
320
|
+
secondaryActions?: SecondaryAction[];
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Describes an already registered Interop method to be assigned as a main action to a search result.
|
|
325
|
+
* This allows search clients to invoke the specified Interop method if, for example, the user clicks on the search result in a UI.
|
|
326
|
+
*/
|
|
327
|
+
export interface MainAction {
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Name of an Interop method to assign as an action for a search result.
|
|
331
|
+
*/
|
|
332
|
+
method: string;
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Defines the Interop servers that will be targeted when invoking the specified method. Set to `"all"` to invoke the method on all Interop servers offering it.
|
|
336
|
+
* Alternatively, you can pass the Interop ID of a specific Interop server you want to target.
|
|
337
|
+
*/
|
|
338
|
+
target?: { instance: string } | "all";
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Arguments to be passed to the specified Interop method when a search client invokes it.
|
|
342
|
+
*/
|
|
343
|
+
params?: any;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Describes an already registered Interop method to be assigned as a secondary action to a search result.
|
|
348
|
+
*/
|
|
349
|
+
export interface SecondaryAction extends MainAction {
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Name for the assigned action. May be used to differentiate between actions on the client side.
|
|
353
|
+
*/
|
|
354
|
+
name: string;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Describes an entity with which a search provided works.
|
|
359
|
+
*/
|
|
360
|
+
export interface SearchType {
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Name for the search type.
|
|
364
|
+
*/
|
|
365
|
+
name: string;
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* User-friendly name for the search type that can be displayed in UIs.
|
|
369
|
+
*/
|
|
370
|
+
displayName?: string;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Function that can be used to stop receiving notifications about events.
|
|
375
|
+
*/
|
|
376
|
+
type UnsubscribeFunction = () => void;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
export type IOConnectSearchFactoryFunction = (io: IOConnectCore.API, config?: IOConnectSearch.Config) => Promise<void>;
|
|
380
|
+
declare const IOSearch: IOConnectSearchFactoryFunction;
|
|
381
381
|
export default IOSearch;
|