@openfin/workspace-platform 4.3.0 → 4.4.0

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.
Files changed (97) hide show
  1. package/client-api/src/shapes.d.ts +596 -0
  2. package/{index.ts → client-api-platform/index.d.ts} +0 -0
  3. package/client-api-platform/src/api/app-directory.d.ts +7 -0
  4. package/client-api-platform/src/api/browser/browser-module.d.ts +13 -0
  5. package/client-api-platform/src/api/browser/index.d.ts +22 -0
  6. package/client-api-platform/src/api/pages/helper.d.ts +22 -0
  7. package/client-api-platform/src/api/pages/index.d.ts +30 -0
  8. package/client-api-platform/src/api/protocol.d.ts +47 -0
  9. package/client-api-platform/src/api/storage.d.ts +10 -0
  10. package/client-api-platform/src/api/workspace-module.d.ts +3 -0
  11. package/client-api-platform/src/index.d.ts +6 -0
  12. package/client-api-platform/src/init/browser-window-focus.d.ts +19 -0
  13. package/client-api-platform/src/init/cleanup.d.ts +1 -0
  14. package/client-api-platform/src/init/index.d.ts +5 -0
  15. package/client-api-platform/src/init/override-callback.d.ts +3 -0
  16. package/client-api-platform/src/init/utils.d.ts +39 -0
  17. package/{src/shapes.ts → client-api-platform/src/shapes.d.ts} +2 -29
  18. package/client-api-platform/src/umd.d.ts +1 -0
  19. package/common/src/api/pages/attached.d.ts +101 -0
  20. package/common/src/api/pages/idb.d.ts +12 -0
  21. package/common/src/api/pages/index.d.ts +16 -0
  22. package/common/src/api/pages/legacy.d.ts +16 -0
  23. package/common/src/api/pages/shapes.d.ts +77 -0
  24. package/common/src/api/protocol.d.ts +63 -0
  25. package/common/src/api/workspaces/index.d.ts +7 -0
  26. package/common/src/utils/application.d.ts +38 -0
  27. package/common/src/utils/channels.d.ts +8 -0
  28. package/common/src/utils/debounce.d.ts +16 -0
  29. package/common/src/utils/env.d.ts +30 -0
  30. package/common/src/utils/layout.d.ts +52 -0
  31. package/common/src/utils/local-storage-key.d.ts +8 -0
  32. package/common/src/utils/logger/index.d.ts +26 -0
  33. package/common/src/utils/logger/manager.d.ts +35 -0
  34. package/common/src/utils/logger/shapes.d.ts +27 -0
  35. package/common/src/utils/route.d.ts +55 -0
  36. package/common/src/utils/shared-emitter.d.ts +10 -0
  37. package/common/src/utils/snapshot.d.ts +33 -0
  38. package/common/src/utils/strings.d.ts +5 -0
  39. package/common/src/utils/umd.d.ts +2 -0
  40. package/common/src/utils/window.d.ts +146 -0
  41. package/index.d.ts +1 -0
  42. package/index.js +2 -0
  43. package/index.js.map +1 -0
  44. package/package.json +1 -34
  45. package/search-api/src/client/index.d.ts +6 -0
  46. package/search-api/src/client/internal.d.ts +38 -0
  47. package/search-api/src/client/remote/channel-client-factory.d.ts +2 -0
  48. package/search-api/src/client/remote/channel-client.d.ts +9 -0
  49. package/search-api/src/client/remote/data.d.ts +16 -0
  50. package/search-api/src/client/remote/disconnect.d.ts +7 -0
  51. package/search-api/src/client/remote/dispatch.d.ts +9 -0
  52. package/search-api/src/client/remote/requests.d.ts +5 -0
  53. package/search-api/src/client/remote/search-close.d.ts +14 -0
  54. package/search-api/src/common.d.ts +104 -0
  55. package/search-api/src/errors.d.ts +5 -0
  56. package/search-api/src/fin/index.d.ts +6 -0
  57. package/search-api/src/fin/shapes.d.ts +23 -0
  58. package/search-api/src/index.d.ts +7 -0
  59. package/search-api/src/internal-shapes.d.ts +134 -0
  60. package/search-api/src/logger.d.ts +1 -0
  61. package/search-api/src/provider/index.d.ts +8 -0
  62. package/search-api/src/provider/internal.d.ts +33 -0
  63. package/search-api/src/provider/remote/channel-factory.d.ts +6 -0
  64. package/search-api/src/provider/remote/channel.d.ts +23 -0
  65. package/search-api/src/provider/remote/connection.d.ts +20 -0
  66. package/search-api/src/provider/remote/data.d.ts +23 -0
  67. package/search-api/src/provider/remote/deregistration.d.ts +5 -0
  68. package/search-api/src/provider/remote/disconnect.d.ts +1 -0
  69. package/search-api/src/provider/remote/disconnection.d.ts +9 -0
  70. package/search-api/src/provider/remote/dispatch.d.ts +7 -0
  71. package/search-api/src/provider/remote/info.d.ts +5 -0
  72. package/search-api/src/provider/remote/registration.d.ts +23 -0
  73. package/search-api/src/provider/remote/search-close.d.ts +14 -0
  74. package/search-api/src/provider/remote/search.d.ts +8 -0
  75. package/search-api/src/shapes.d.ts +541 -0
  76. package/.eslintignore +0 -1
  77. package/.eslintrc.js +0 -2
  78. package/.prettierrc.js +0 -2
  79. package/babel.config.js +0 -2
  80. package/jest.config.js +0 -2
  81. package/src/api/app-directory.ts +0 -45
  82. package/src/api/browser/browser-module.ts +0 -65
  83. package/src/api/browser/index.ts +0 -46
  84. package/src/api/pages/helper.ts +0 -113
  85. package/src/api/pages/index.ts +0 -164
  86. package/src/api/protocol.ts +0 -60
  87. package/src/api/storage.ts +0 -32
  88. package/src/api/workspace-module.ts +0 -36
  89. package/src/index.ts +0 -35
  90. package/src/init/browser-window-focus.ts +0 -59
  91. package/src/init/cleanup.ts +0 -87
  92. package/src/init/index.ts +0 -42
  93. package/src/init/override-callback.ts +0 -159
  94. package/src/init/utils.ts +0 -164
  95. package/src/umd.ts +0 -5
  96. package/tsconfig.json +0 -13
  97. package/webpack.common.config.js +0 -1
@@ -0,0 +1,541 @@
1
+ import type { Fin as BaseFin, Identity as AdapterIdentity } from 'openfin-adapter';
2
+ import type { EntityType } from 'openfin-adapter/src/shapes/EntityType';
3
+ /**
4
+ * Create a topic.
5
+ * If the OpenFin identity creating the topic is running in a platform, the search topic will be sandboxed to the platform.
6
+ * In order to subscribe to a sandboxed search topic, the UUID of the platform must be specified explicitly or the subscribing OpenFin identity must be running in the platform.
7
+ * @param req the topic create request.
8
+ */
9
+ export declare const create: (request?: SearchTopicCreateRequest | string) => Promise<SearchTopic>;
10
+ /**
11
+ * Subscribe to an existing search topic.
12
+ * @param req the subscribe request.
13
+ */
14
+ export declare const subscribe: (request: SearchTopicSubscribeRequest) => Promise<SearchTopicClient>;
15
+ /**
16
+ * Search API object that is injected in the window.
17
+ */
18
+ export declare type SearchAPI = {
19
+ create: typeof create;
20
+ subscribe: typeof subscribe;
21
+ };
22
+ /**
23
+ * Extended Fin object with `fin.Search` namespace.
24
+ *
25
+ * ```js
26
+ * const searchTopic = fin.Search.create({ topic: "my search topic" });
27
+ * ```
28
+ */
29
+ export declare type Fin<T extends EntityType> = BaseFin<T> & {
30
+ Search: SearchAPI;
31
+ };
32
+ /**
33
+ * An object that represents a unique OpenFin identity.
34
+ */
35
+ export declare type Identity = AdapterIdentity;
36
+ /**
37
+ * A response to a search from a search provider.
38
+ */
39
+ export interface SearchProviderResponse {
40
+ /**
41
+ * The search provider that responded with the search results.
42
+ */
43
+ provider: SearchProviderInfo;
44
+ /**
45
+ * If the search result succeeds for this provider, results of the search will be set.
46
+ */
47
+ results?: SearchResult[];
48
+ /**
49
+ * A context with custom data to pass through search
50
+ */
51
+ context?: any;
52
+ /**
53
+ * If the search failed for this provider, error will be set.
54
+ */
55
+ error?: Error;
56
+ }
57
+ /**
58
+ * The search request.
59
+ */
60
+ export interface SearchRequest {
61
+ /**
62
+ * The search query.
63
+ */
64
+ query: string;
65
+ /**
66
+ * Additional custom context that can be used for searching.
67
+ */
68
+ context?: any;
69
+ /**
70
+ * A list of search provider names to execute the search request against.
71
+ */
72
+ targets?: string[];
73
+ }
74
+ /**
75
+ * A generator that returns search responses from all providers that have currently responded.
76
+ *
77
+ * More documentation on Javascript Generators can be found [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator).
78
+ */
79
+ export declare type SearchProviderResponseGenerator = AsyncGenerator<SearchProviderResponse[], SearchProviderResponse[], SearchProviderResponse[]>;
80
+ /**
81
+ * Describes the state of the search response generator.
82
+ */
83
+ export declare enum SearchProviderResponseGeneratorState {
84
+ /**
85
+ * The generator is in the process of fetching the initial set of results from search providers.
86
+ */
87
+ Fetching = "fetching",
88
+ /**
89
+ * The generator has fetched all initial results, and is now waiting for search providers with
90
+ * open {@link SearchListenerResponse} streams to push new or updated search results.
91
+ */
92
+ Fetched = "fetched",
93
+ /**
94
+ * All open {@link SearchListenerResponse} streams have closed, completing the request.
95
+ * In this state, the set of responses returned by `generator.next()` are final.
96
+ */
97
+ Complete = "complete"
98
+ }
99
+ /**
100
+ * Extended search provider response generator with additional properties about the search request.
101
+ */
102
+ export interface SearchProviderResponseGeneratorExtended extends SearchProviderResponseGenerator {
103
+ /**
104
+ * The id of the search request.
105
+ */
106
+ id: string;
107
+ /**
108
+ * The state of the search provider response generator.
109
+ */
110
+ state: SearchProviderResponseGeneratorState;
111
+ /**
112
+ * Notifies all search providers related to this search request
113
+ * that the search requester is no longer listening for new or updated search results.
114
+ * @experimental
115
+ */
116
+ close: () => void;
117
+ }
118
+ /**
119
+ * Called when a remote OpenFin identity, such as a view, attempts to connect
120
+ * to the search topic.
121
+ *
122
+ * Returning false will reject said request.
123
+ *
124
+ * ```js
125
+ * const allowedHosts = ["www.company.com"];
126
+ * searchTopic.onSubscription(identity => {
127
+ * const info = await fin.View.wrapSync(identity).getInfo();
128
+ * const url = new URL(info.url);
129
+ *
130
+ * return allowedHosts.includes(url.host);
131
+ * });
132
+ * ```
133
+ */
134
+ export declare type SubscriptionListener = (identity: Identity) => Promise<boolean>;
135
+ /**
136
+ * Called when a remote OpenFin identity, such as a view, disconnects from a Search topic.
137
+ */
138
+ export declare type DisconnectListener = (identity: Identity) => Promise<void>;
139
+ /**
140
+ * Called when search provider deregisters from SearchTopic
141
+ */
142
+ export declare type DeregisterListener = () => void;
143
+ /**
144
+ * Called when search provider registers to SearchTopic
145
+ */
146
+ export declare type RegisterListener = () => void;
147
+ /**
148
+ * The client returned from subscribing as a secondary node to a search topic, which is managed by a primary node.
149
+ * Can be used to interact with a search topic.
150
+ */
151
+ export interface SearchTopicClient {
152
+ /**
153
+ * Obtain information about all search providers listening in on the topic.
154
+ */
155
+ getAllProviders(): Promise<SearchProviderInfo[]>;
156
+ /**
157
+ * Execute a search on the search topic.
158
+ *
159
+ * The generator returned by this function can be called multiple times, returning the current list of search provider responses.
160
+ * As more search providers respond to the search request the returned list of responses will grow in length.
161
+ *
162
+ * When all the search providers have responded to the search request, the generator will return the final
163
+ * set of search response under the `value` attribute and set the 'done' attribute set to true.
164
+ *
165
+ * If no targets are included in request, will search against all search providers.
166
+ * @param request the request object that contains parameters to base the search on.
167
+ *
168
+ * @experimental
169
+ */
170
+ search(request: SearchRequest): Promise<SearchProviderResponseGeneratorExtended>;
171
+ /**
172
+ * Register a search provider.
173
+ * @param provider the search provider to register.
174
+ */
175
+ register(provider: SearchProvider): Promise<void>;
176
+ /**
177
+ * Deregister a search provider by its name.
178
+ * @param name the name of the search provider to deregister
179
+ */
180
+ deregister(name: string): Promise<void>;
181
+ /**
182
+ * Dispatch a search result back to the search provider.
183
+ * It is then the search providers duty to perform what ever action was chosen.
184
+ * @param providerId the id of the search provider to send the search result back to.
185
+ * @param result the search result to send back to the search provider.
186
+ * @param action the action for the search provider to perform with the search result.
187
+ */
188
+ dispatch(providerId: string, result: SearchResult, action: Action): Promise<any>;
189
+ /**
190
+ * Disconnect from the search topic.
191
+ * NOTE: All search providers registered by this search client will be deregistered.
192
+ */
193
+ disconnect(): Promise<void>;
194
+ }
195
+ /**
196
+ * A search topic created by the primary node.
197
+ */
198
+ export interface SearchTopic extends SearchTopicClient {
199
+ /**
200
+ * Add a subscription listener that will be called when ever a search client subscribes
201
+ * to this topic.
202
+ *
203
+ * Returning false in said listener will reject the request.
204
+ * @param listener the listener to add.
205
+ */
206
+ onSubscription(listener: SubscriptionListener): void;
207
+ /**
208
+ * Remove a listener.
209
+ * @param listener the listener to remove.
210
+ */
211
+ removeListener(listener: (...args: any[]) => any): void;
212
+ /**
213
+ * Add a listener that will be called when ever a search client disconnects from this topic.
214
+ * @param listener the listener to add.
215
+ */
216
+ onDisconnect(listener: DisconnectListener): void;
217
+ /**
218
+ * Add a listener that will be called whenever a search provider registers
219
+ * @param listener the listener to add
220
+ */
221
+ onRegister(listener: RegisterListener): void;
222
+ /**
223
+ * Add a listener that will be called whenever a search provider deregisters
224
+ * @param listener the listener to add.
225
+ */
226
+ onDeregister(listener: DeregisterListener): void;
227
+ }
228
+ /**
229
+ * Information about a search provider.
230
+ */
231
+ export interface SearchProviderInfo {
232
+ /**
233
+ * A unique ID used to identify the search provider.
234
+ */
235
+ id: string;
236
+ /**
237
+ * A UI friendly title for the search provider.
238
+ */
239
+ title: string;
240
+ /**
241
+ * The OpenFin identity that registered this search provider.
242
+ */
243
+ identity?: Identity;
244
+ /**
245
+ * The order to sort the score in. The default is `ascending`.
246
+ * @experimental
247
+ */
248
+ scoreOrder?: ScoreOrder;
249
+ /**
250
+ * A keycode that can be used to interact with this Search Provider.
251
+ */
252
+ commandCode?: string;
253
+ /**
254
+ * A short description of the Search Provider.
255
+ */
256
+ description?: string;
257
+ /**
258
+ * An icon that a UI can display for the Search Provider.
259
+ */
260
+ icon: string;
261
+ /**
262
+ * A flag to indicate this provider will not be displayed as a command.
263
+ */
264
+ hidden?: boolean;
265
+ /**
266
+ * A title to display above the result list in a UI when targeting this specific Search Provider.
267
+ */
268
+ listTitle?: string;
269
+ /**
270
+ * The placeholder string to be displayed in a UI when targeting this specific Search Provider.
271
+ */
272
+ inputPlaceholder?: string;
273
+ /**
274
+ * Logo to show render when targeting this specific Search Provider.
275
+ */
276
+ logoUrl?: string;
277
+ }
278
+ /**
279
+ * The order to sort scored search results in.
280
+ */
281
+ export declare type ScoreOrder = 'ascending' | 'descending';
282
+ /**
283
+ * Each action is defined by its title and a hotkey
284
+ */
285
+ export declare type Action = {
286
+ name: string;
287
+ hotkey?: string;
288
+ };
289
+ export declare enum SearchTagBackground {
290
+ Active = "active",
291
+ Default = "default"
292
+ }
293
+ export interface SearchTag {
294
+ name: string;
295
+ background: SearchTagBackground;
296
+ }
297
+ /**
298
+ * Common properties of a {@link SearchResult | search result}.
299
+ */
300
+ export interface SearchResult<A extends Action = Action> {
301
+ /**
302
+ * A unique ID for the search result.
303
+ * Can be used to update a previously returned search result by calling
304
+ * `searchRequestContext.respond(result)` with the same search result key.
305
+ */
306
+ key: string;
307
+ /**
308
+ * UI friendly name for the search result.
309
+ */
310
+ title: string;
311
+ /**
312
+ * Unused.
313
+ * @experimental
314
+ */
315
+ description?: string;
316
+ /**
317
+ * Unused.
318
+ * @experimental
319
+ */
320
+ shortDescription?: string;
321
+ /**
322
+ * An optional icon that can be used when displaying the search result in a UI.
323
+ */
324
+ icon?: string;
325
+ /**
326
+ * Used when sorting a list of search results for a single provider.
327
+ * @experimental
328
+ */
329
+ score?: number;
330
+ /**
331
+ * Additional custom metadata about the search result.
332
+ * Can be used when actioning the search result.
333
+ */
334
+ data?: any;
335
+ /**
336
+ * Actions that can be performed with this search result.
337
+ * Used when dispatching search results back to the respective provider.
338
+ */
339
+ actions: A[];
340
+ /**
341
+ * Tags associated with the search result.
342
+ */
343
+ tags?: SearchTag[];
344
+ /**
345
+ * A label to render with the search result.
346
+ */
347
+ label?: string;
348
+ }
349
+ /**
350
+ * Representation of a search request passed as a parameter to a {@link SearchProvider | SearchProvider's} `onUserInput` listener function.
351
+ *
352
+ * ```js
353
+ * const provider = {
354
+ * name: "my-provider",
355
+ * title: "My Provider",
356
+ * onUserInput: (request) => {
357
+ * const query = request.query;
358
+ * return getMyResults(query);
359
+ * }
360
+ * };
361
+ * ```
362
+ */
363
+ export interface SearchListenerRequest extends SearchRequest {
364
+ /**
365
+ * The ID of the topic the search request was dispatched on.
366
+ */
367
+ topic: string;
368
+ /**
369
+ * The ID of the search request.
370
+ * Can be used to tie related search requests together between providers.
371
+ */
372
+ id: string;
373
+ /**
374
+ * Registers a listener that is called when the search request is
375
+ * closed by the search requester.
376
+ *
377
+ * Can be used to cleanup pending queries:
378
+ * ```js
379
+ * async function onUserInput(request) {
380
+ * const myQuery = makeQuery(request.query);
381
+ *
382
+ * request.onClose(() => {
383
+ * myQuery.cancel();
384
+ * });
385
+ *
386
+ * const results = await myQuery.getResults();
387
+ * return { results };
388
+ * }
389
+ * ```
390
+ *
391
+ * @param listener the listener to call when the request is closed.
392
+ */
393
+ onClose(listener: () => void): void;
394
+ /**
395
+ * Remove a registered listener.
396
+ * @param listener the listener to remove.
397
+ */
398
+ removeListener(listener: () => void): void;
399
+ }
400
+ /**
401
+ * Representation of a search response from a specific invocation of a {@link SearchProvider | SearchProvider's} `onUserInput` listener function.
402
+ * Can optionally be used to push search results to the requester.
403
+ *
404
+ * ```js
405
+ * function onUserInput(searchListenerRequest, searchListenerResponse) {
406
+ * searchListenerResponse.open();
407
+ *
408
+ * const myLongRunningQuery = makeMyLongRunningQuery(searchListenerRequest.query);
409
+ * myLongRunningQuery.onNewResults(myNewResults => {
410
+ * searchListenerResponse.respond(myNewResults);
411
+ * });
412
+ *
413
+ * searchListenerRequest.onClose(() => {
414
+ * myLongRunningQuery.close();
415
+ * });
416
+ * }
417
+ * ```
418
+ */
419
+ export interface SearchListenerResponse {
420
+ /**
421
+ * Open the response stream, notifying the search requester that
422
+ * there are new or updated search results that have yet to be pushed
423
+ * by the current provider.
424
+ * @experimental
425
+ */
426
+ open(): void;
427
+ /**
428
+ * Close the response stream.
429
+ * This notifies the requester that the current search provider is done sending results.
430
+ * @experimental
431
+ */
432
+ close(): void;
433
+ /**
434
+ * Respond to the search request with new or updated search results.
435
+ * @param results new or updated search results to respond with.
436
+ * @experimental
437
+ */
438
+ respond(results: SearchResult[]): void;
439
+ /**
440
+ * Remove a search result from the list of responded search results.
441
+ * @param resultKeys the keys of the search results to revoke.
442
+ * @experimental
443
+ */
444
+ revoke(...resultKeys: string[]): void;
445
+ }
446
+ /**
447
+ * An object resolved from 'onUserInput' function containing results and optional context
448
+ */
449
+ export interface SearchResponse {
450
+ results: SearchResult[];
451
+ context?: any;
452
+ }
453
+ /**
454
+ * A function that listens for search requests on a search topic.
455
+ * Returns a set of search results based on arguments provided.
456
+ * @param request - The search request coming in
457
+ * @param response - EXPERIMENTAL - streaming response
458
+ */
459
+ export declare type UserInputListener = (request: SearchListenerRequest, response: SearchListenerResponse) => Promise<SearchResponse>;
460
+ /**
461
+ * A search result that has been dispatched back to the {@link SearchProvider | SearchProvider's} `onResultDispatch` listener function.
462
+ * Contains the action that should be performed by the search provider.
463
+ *
464
+ * ```js
465
+ * const provider = {
466
+ * name: "my-provider",
467
+ * title: "My Provider",
468
+ * onUserInput: myOnUserInput,
469
+ * onResultDispatch: (dispatchedSearchResult) => {
470
+ * if (dispatchedSearchResult.action.name === "my-action") {
471
+ * doMyAction(dispatchedSearchResult);
472
+ * }
473
+ * }
474
+ * };
475
+ * ```
476
+ */
477
+ export interface DispatchedSearchResult extends SearchResult {
478
+ /**
479
+ * The selected action for the search provider to perform.
480
+ */
481
+ action: Action;
482
+ /**
483
+ * The OpenFin identity that dispatched this search result.
484
+ */
485
+ dispatcherIdentity: Identity;
486
+ }
487
+ /**
488
+ * A listener called when a search result generated by this provider is dispatched.
489
+ *
490
+ * ```js
491
+ * searchTopic.dispatch("My Provider Name", searchResult, "My Action");
492
+ * ```
493
+ */
494
+ export declare type ResultDispatchListener = (result: DispatchedSearchResult) => void;
495
+ /**
496
+ * A search provider listens for search requests on a search topic and returns search results.
497
+ * It optionally can also perform custom actions when a search result is dispatched back to the provider.
498
+ */
499
+ export interface SearchProvider extends SearchProviderInfo {
500
+ /**
501
+ * The search listener for the search provider.
502
+ *
503
+ * When a search is requested on the subscribed search topic, this
504
+ * listener will be called and have the opportunity to return search results.
505
+ */
506
+ onUserInput: UserInputListener;
507
+ /**
508
+ * An optional listener for actioning search results.
509
+ *
510
+ * When this search provider returns search results via its `onUserInput` listener,
511
+ * the receiver of the results can select and dispatch a single result back to the provider.
512
+ *
513
+ * It is then up to the search provider to perform the custom requested action.
514
+ */
515
+ onResultDispatch?: ResultDispatchListener;
516
+ }
517
+ /**
518
+ * Request for creating a search topic.
519
+ */
520
+ export interface SearchTopicCreateRequest {
521
+ /**
522
+ * The search topic to subscribe to.
523
+ *
524
+ * Default is `all`
525
+ */
526
+ topic?: string;
527
+ }
528
+ /**
529
+ * An object that contains options for subscribing to a search topic.
530
+ */
531
+ export interface SearchTopicSubscribeRequest {
532
+ topic?: string;
533
+ /**
534
+ * If a search topic is created from a platform, it will be sandboxed to said platform.
535
+ * By configuring this UUID, an OpenFin app can subscribe to a platform sandboxed search topic by the platform's UUID.
536
+ *
537
+ * By default, this is configured to the UUID of the current platform if the current OpenFin identity is a view.
538
+ * If the current OpenFin identity is not a view, this field is left empty.
539
+ */
540
+ uuid?: string;
541
+ }
package/.eslintignore DELETED
@@ -1 +0,0 @@
1
- out/
package/.eslintrc.js DELETED
@@ -1,2 +0,0 @@
1
- const config = require('@openfin/common/.eslintrc');
2
- module.exports = config;
package/.prettierrc.js DELETED
@@ -1,2 +0,0 @@
1
- const config = require('@openfin/common/.prettierrc');
2
- module.exports = config;
package/babel.config.js DELETED
@@ -1,2 +0,0 @@
1
- const config = require('@openfin/common/babel.config');
2
- module.exports = config;
package/jest.config.js DELETED
@@ -1,2 +0,0 @@
1
- const config = require('@openfin/common/jest.config');
2
- module.exports = config;
@@ -1,45 +0,0 @@
1
- import { App, AppManifestType } from '@client/shapes';
2
-
3
- import type { LaunchAppPayload } from '../shapes';
4
-
5
- async function launchView(app: App, dispatcherIdentity: OpenFin.EntityInfo) {
6
- const platform = fin.Platform.getCurrentSync();
7
-
8
- if (dispatcherIdentity.entityType === 'view') {
9
- const view = fin.View.wrapSync(dispatcherIdentity);
10
- const layout = await view.getParentLayout();
11
- await layout.replaceView(dispatcherIdentity, {
12
- manifestUrl: app.manifest,
13
- url: undefined,
14
- target: undefined
15
- });
16
-
17
- return view.destroy();
18
- }
19
-
20
- return platform.createView({
21
- name: undefined,
22
- url: undefined,
23
- manifestUrl: app.manifest,
24
- target: undefined
25
- });
26
- }
27
-
28
- /**
29
- * Launch the app described by an App Directory entry.
30
- * @param app the app directory entry.
31
- * @param opts launch options.
32
- */
33
- export async function launchApp({ app, target }: LaunchAppPayload) {
34
- const platform = fin.Platform.getCurrentSync();
35
- switch (app.manifestType) {
36
- case AppManifestType.Snapshot:
37
- return platform.applySnapshot(app.manifest);
38
- case AppManifestType.View:
39
- return launchView(app, target);
40
- case AppManifestType.External:
41
- return fin.System.launchExternalProcess({ path: app.manifest, uuid: app.appId });
42
- default:
43
- return fin.Application.startFromManifest(app.manifest);
44
- }
45
- }
@@ -1,65 +0,0 @@
1
- import type { AttachedPage, Page } from '@common/api/pages/shapes';
2
-
3
- import { ChannelAction, getChannelClient } from '../protocol';
4
-
5
- export const getBrowserModule = (identity: OpenFin.Identity) => ({
6
- identity,
7
- openfinWindow: fin.Window.wrapSync(identity),
8
- getPages: async (): Promise<AttachedPage[]> => {
9
- const client = await getChannelClient(identity);
10
- return client.dispatch(ChannelAction.GetPagesForWindow, identity);
11
- },
12
- getPage: async (pageId: string): Promise<AttachedPage> => {
13
- const client = await getChannelClient(identity);
14
- return client.dispatch(ChannelAction.GetPageForWindow, { identity, pageId });
15
- },
16
- addPage: async (page: Page): Promise<void> => {
17
- const client = await getChannelClient(identity);
18
-
19
- // check if a page has a title
20
- if (!page?.title) {
21
- page.title = await client.dispatch(ChannelAction.GetUniquePageTitle, undefined);
22
- }
23
-
24
- // check if an page with same id or title is already attached to a browser window
25
- const allPages: AttachedPage[] = await client.dispatch(ChannelAction.GetOpenPages, undefined);
26
- const pageWithSameIdOrTitle: AttachedPage = allPages.find(
27
- (pg) => pg.pageId === page.pageId || pg.title === page.title
28
- );
29
- if (pageWithSameIdOrTitle) {
30
- if (pageWithSameIdOrTitle.pageId === page.pageId) {
31
- throw new Error(
32
- `page with id ${page.pageId} is already attached to a browser window ${pageWithSameIdOrTitle.parentIdentity.name}`
33
- );
34
- } else {
35
- throw new Error(
36
- `page with title ${page.title} is already attached to a browser window ${pageWithSameIdOrTitle.parentIdentity.name}`
37
- );
38
- }
39
- }
40
-
41
- const payload = {
42
- identity,
43
- pages: [page]
44
- };
45
- return client.dispatch(ChannelAction.AttachPagesToWindow, payload);
46
- },
47
- removePage: async (id: Page['pageId']): Promise<void> => {
48
- const client = await getChannelClient(identity);
49
- return client.dispatch(ChannelAction.DetachPagesFromWindow, { identity, pageIds: [id] });
50
- },
51
- setActivePage: async (id: Page['pageId']): Promise<void> => {
52
- const client = await getChannelClient(identity);
53
- return client.dispatch(ChannelAction.SetActivePageForWindow, { identity, pageId: id });
54
- },
55
- updatePage: async (req) => {
56
- const client = await getChannelClient(identity);
57
- req.identity = identity;
58
- return client.dispatch(ChannelAction.UpdatePageForWindow, req);
59
- },
60
- reorderPages: async (req) => {
61
- const client = await getChannelClient(identity);
62
- req.identity = identity;
63
- return client.dispatch(ChannelAction.ReorderPagesForWindow, req);
64
- }
65
- });