@openfin/cloud-api 0.0.1-alpha.d7ba187 → 0.0.1-alpha.d83fa08
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/LICENSE.md +4 -0
- package/dist/index.cjs +1 -2
- package/dist/index.d.cts +387 -49
- package/dist/index.d.ts +387 -49
- package/dist/index.js +1 -2
- package/package.json +26 -177
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as OpenFin from '@openfin/core';
|
|
2
|
-
import OpenFin__default from '@openfin/core';
|
|
2
|
+
import OpenFin__default, { OpenFin as OpenFin$1 } from '@openfin/core';
|
|
3
3
|
import * as NotificationsTypes from '@openfin/workspace/notifications';
|
|
4
|
+
import { InteropColorChannel } from '@openfin/shared-utils/schemas/interop';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* NotificationsClient is a client for accessing and interacting with the Notifications your application has created.
|
|
@@ -298,40 +299,42 @@ declare function launchSupertab(id: string): Promise<void>;
|
|
|
298
299
|
declare function launchWorkspace(id: string): Promise<void>;
|
|
299
300
|
|
|
300
301
|
/**
|
|
301
|
-
* Function that is called when the Search Agent receives an action from
|
|
302
|
+
* Function that is called when the Search Agent receives an action from HERE's search UI that has been triggered by the user on one of the Agent's search results.
|
|
302
303
|
*
|
|
303
304
|
* @param action The action that was triggered.
|
|
304
305
|
* @param result The search result that the action was triggered on.
|
|
305
306
|
*
|
|
306
|
-
* @returns Result that includes the URL that
|
|
307
|
+
* @returns Result that includes the URL that HERE should navigate to, or `undefined` if no navigation is required.
|
|
307
308
|
*/
|
|
308
|
-
type OnActionListener = (action: SearchAction, result: SearchResult) => SearchResultActionResponse | Promise<SearchResultActionResponse>;
|
|
309
|
+
type OnActionListener = (action: SearchAction$1, result: SearchResult$1) => SearchResultActionResponse$1 | Promise<SearchResultActionResponse$1>;
|
|
309
310
|
/**
|
|
310
|
-
* Function that is called when the Search Agent receives a query from
|
|
311
|
+
* Function that is called when the Search Agent receives a query from HERE's search UI
|
|
311
312
|
*
|
|
312
313
|
* @param request Search request data that includes the query.
|
|
313
314
|
*
|
|
314
315
|
* @returns Search response data that includes the search results.
|
|
315
316
|
*/
|
|
316
|
-
type OnSearchListener = (request: SearchListenerRequest) => SearchResponse | Promise<SearchResponse>;
|
|
317
|
+
type OnSearchListener = (request: SearchListenerRequest$1) => SearchResponse$1 | Promise<SearchResponse$1>;
|
|
317
318
|
/**
|
|
318
319
|
* An action that can be triggered by a user on a search result returned by a Search Agent.
|
|
319
320
|
*
|
|
320
|
-
* Actions are displayed as buttons alongside search results in
|
|
321
|
+
* Actions are displayed as buttons alongside search results in HERE's search UI. That is, except for the first action, which is hidden as it is triggered automatically when the user selects the search result.
|
|
321
322
|
*/
|
|
322
|
-
type SearchAction = {
|
|
323
|
-
/**
|
|
324
|
-
* URL or data URI of an icon that will be displayed within the action button when Here™ is in Light mode.
|
|
325
|
-
*/
|
|
326
|
-
darkIcon?: string;
|
|
323
|
+
type SearchAction$1 = {
|
|
327
324
|
/**
|
|
328
|
-
* A fuller description of the action that will be displayed in
|
|
325
|
+
* A fuller description of the action that will be displayed in HERE's search UI when the user hovers over the action button.
|
|
329
326
|
*/
|
|
330
327
|
description?: string;
|
|
331
328
|
/**
|
|
332
|
-
*
|
|
329
|
+
* Icon that will be displayed within the action button in HERE's search UI.
|
|
330
|
+
*
|
|
331
|
+
* This can be a URL/data URI string (used for both Light and Dark modes),
|
|
332
|
+
* or an object containing separate icons for Light and Dark modes.
|
|
333
333
|
*/
|
|
334
|
-
|
|
334
|
+
icon?: string | {
|
|
335
|
+
dark: string;
|
|
336
|
+
light: string;
|
|
337
|
+
};
|
|
335
338
|
/**
|
|
336
339
|
* Internal identifier for the action which is used to identify the action in the {@link OnActionListener}.
|
|
337
340
|
*/
|
|
@@ -342,7 +345,9 @@ type SearchAction = {
|
|
|
342
345
|
title?: string;
|
|
343
346
|
};
|
|
344
347
|
/**
|
|
345
|
-
* A Search Agent returns search results to
|
|
348
|
+
* A Search Agent returns search results to HERE's search UI in response to user input, and acts on the user's actions regarding those results.
|
|
349
|
+
*
|
|
350
|
+
* @deprecated Use {@link Agent} instead.
|
|
346
351
|
*/
|
|
347
352
|
type SearchAgent = {
|
|
348
353
|
/**
|
|
@@ -351,11 +356,13 @@ type SearchAgent = {
|
|
|
351
356
|
* When a Search Agent is first registered, it will not receive search queries until it is set as ready by calling this function.
|
|
352
357
|
*
|
|
353
358
|
* @param ready Whether the Search Agent is ready to provide search results (defaults to `true`).
|
|
359
|
+
*
|
|
360
|
+
* @deprecated Use {@link Agent.setIsReady} instead.
|
|
354
361
|
*/
|
|
355
362
|
isReady: (ready?: boolean) => Promise<void>;
|
|
356
363
|
};
|
|
357
364
|
/**
|
|
358
|
-
* The Search Agent
|
|
365
|
+
* The Search Agent's configuration data as configured in the HERE Admin Console.
|
|
359
366
|
*
|
|
360
367
|
* @typeParam T Type definition for the `customData` property, containing any custom configuration data specific to the Search Agent.
|
|
361
368
|
*/
|
|
@@ -386,13 +393,13 @@ type SearchAgentConfigurationData<T> = {
|
|
|
386
393
|
*/
|
|
387
394
|
type SearchAgentRegistrationConfig = {
|
|
388
395
|
/**
|
|
389
|
-
* This listener is called when the Search Agent receives an action from
|
|
396
|
+
* This listener is called when the Search Agent receives an action from HERE's search UI that has been triggered by the user on one of the Agent's search results.
|
|
390
397
|
*
|
|
391
|
-
* The listener returns a response back to
|
|
398
|
+
* The listener returns a response back to HERE that includes a URL to navigate to.
|
|
392
399
|
*/
|
|
393
400
|
onAction: OnActionListener;
|
|
394
401
|
/**
|
|
395
|
-
* This listener is called when the Search Agent receives a query from
|
|
402
|
+
* This listener is called when the Search Agent receives a query from HERE's search UI and returns relevant search results.
|
|
396
403
|
*
|
|
397
404
|
* Note: When the Search Agent is not ready this listener will not be called.
|
|
398
405
|
*/
|
|
@@ -401,13 +408,13 @@ type SearchAgentRegistrationConfig = {
|
|
|
401
408
|
/**
|
|
402
409
|
* Search request data provided to the {@link OnSearchListener}.
|
|
403
410
|
*/
|
|
404
|
-
type SearchListenerRequest = {
|
|
411
|
+
type SearchListenerRequest$1 = {
|
|
405
412
|
/**
|
|
406
413
|
* Provides additional context for the search request.
|
|
407
414
|
*/
|
|
408
|
-
context: SearchRequestContext;
|
|
415
|
+
context: SearchRequestContext$1;
|
|
409
416
|
/**
|
|
410
|
-
* The query entered by the user in
|
|
417
|
+
* The query entered by the user in HERE's search UI.
|
|
411
418
|
*/
|
|
412
419
|
query: string;
|
|
413
420
|
/**
|
|
@@ -418,7 +425,7 @@ type SearchListenerRequest = {
|
|
|
418
425
|
/**
|
|
419
426
|
* Context data included with a search request.
|
|
420
427
|
*/
|
|
421
|
-
type SearchRequestContext = {
|
|
428
|
+
type SearchRequestContext$1 = {
|
|
422
429
|
/**
|
|
423
430
|
* The page number of the search results to return.
|
|
424
431
|
*/
|
|
@@ -435,26 +442,26 @@ type SearchRequestContext = {
|
|
|
435
442
|
/**
|
|
436
443
|
* Return type of the {@link OnSearchListener}.
|
|
437
444
|
*/
|
|
438
|
-
type SearchResponse = {
|
|
445
|
+
type SearchResponse$1 = {
|
|
439
446
|
/**
|
|
440
|
-
* The search results to display in
|
|
447
|
+
* The search results to display in HERE's search UI.
|
|
441
448
|
*/
|
|
442
|
-
results: SearchResult[];
|
|
449
|
+
results: SearchResult$1[];
|
|
443
450
|
};
|
|
444
451
|
/**
|
|
445
452
|
* A search result returned by a Search Agent in response to a search request.
|
|
446
453
|
*/
|
|
447
|
-
type SearchResult = {
|
|
454
|
+
type SearchResult$1 = {
|
|
448
455
|
/**
|
|
449
456
|
* Actions that can be triggered by the user against the search result.
|
|
450
457
|
*/
|
|
451
|
-
actions: SearchAction[];
|
|
458
|
+
actions: SearchAction$1[];
|
|
452
459
|
/**
|
|
453
460
|
* Additional data that can be used by the {@link OnActionListener} when an action is triggered.
|
|
454
461
|
*/
|
|
455
462
|
data?: Record<string, unknown>;
|
|
456
463
|
/**
|
|
457
|
-
* URL or data URI of an icon that will be displayed with the search result in
|
|
464
|
+
* URL or data URI of an icon that will be displayed with the search result in HERE's search UI.
|
|
458
465
|
*/
|
|
459
466
|
icon?: string;
|
|
460
467
|
/**
|
|
@@ -462,26 +469,26 @@ type SearchResult = {
|
|
|
462
469
|
*/
|
|
463
470
|
key: string;
|
|
464
471
|
/**
|
|
465
|
-
* Secondary text that will be displayed with the search result in
|
|
472
|
+
* Secondary text that will be displayed with the search result in HERE's search UI.
|
|
466
473
|
*/
|
|
467
474
|
label?: string;
|
|
468
475
|
/**
|
|
469
|
-
* Primary text that will be displayed with the search result in
|
|
476
|
+
* Primary text that will be displayed with the search result in HERE's search UI.
|
|
470
477
|
*/
|
|
471
478
|
title: string;
|
|
472
479
|
};
|
|
473
480
|
/**
|
|
474
481
|
* Return type of the {@link OnActionListener}.
|
|
475
482
|
*/
|
|
476
|
-
type SearchResultActionResponse = {
|
|
483
|
+
type SearchResultActionResponse$1 = {
|
|
477
484
|
/**
|
|
478
|
-
* URL that
|
|
485
|
+
* URL that HERE should navigate to.
|
|
479
486
|
*/
|
|
480
487
|
url: string;
|
|
481
488
|
} | undefined;
|
|
482
489
|
|
|
483
490
|
/**
|
|
484
|
-
* Retrieves the Search Agent
|
|
491
|
+
* Retrieves the Search Agent's configuration data, as has been configured in the HERE Admin Console.
|
|
485
492
|
*
|
|
486
493
|
* @returns A promise that resolves with an object containing properties that match the Search Agent’s configuration.
|
|
487
494
|
*
|
|
@@ -503,7 +510,7 @@ type SearchResultActionResponse = {
|
|
|
503
510
|
*/
|
|
504
511
|
declare function getAgentConfiguration<T extends object>(): Promise<SearchAgentConfigurationData<T>>;
|
|
505
512
|
/**
|
|
506
|
-
* Registers a Search Agent that will provide search results to
|
|
513
|
+
* Registers a Search Agent that will provide search results to HERE's search UI in response to user input and act on the user's actions regarding those results.
|
|
507
514
|
*
|
|
508
515
|
* @param config The configuration for the Search Agent.
|
|
509
516
|
*
|
|
@@ -554,6 +561,10 @@ declare function getAgentConfiguration<T extends object>(): Promise<SearchAgentC
|
|
|
554
561
|
* name: "view-owner",
|
|
555
562
|
* description: `Go to ${ownerName} in My Web App`,
|
|
556
563
|
* title: "View Owner",
|
|
564
|
+
* icon: {
|
|
565
|
+
* dark: "data:image/svg+xml,...",
|
|
566
|
+
* light: "data:image/svg+xml,...",
|
|
567
|
+
* },
|
|
557
568
|
* },
|
|
558
569
|
* ],
|
|
559
570
|
* data: {
|
|
@@ -583,24 +594,351 @@ declare function getAgentConfiguration<T extends object>(): Promise<SearchAgentC
|
|
|
583
594
|
* // Set the Search Agent as ready to receive search requests
|
|
584
595
|
* await searchAgent.isReady();
|
|
585
596
|
* ```
|
|
597
|
+
*
|
|
598
|
+
* @deprecated Use `Agent.register` instead.
|
|
599
|
+
*/
|
|
600
|
+
declare function register$1(config: SearchAgentRegistrationConfig): Promise<SearchAgent>;
|
|
601
|
+
|
|
602
|
+
type index$1_OnActionListener = OnActionListener;
|
|
603
|
+
type index$1_OnSearchListener = OnSearchListener;
|
|
604
|
+
type index$1_SearchAgent = SearchAgent;
|
|
605
|
+
type index$1_SearchAgentConfigurationData<T> = SearchAgentConfigurationData<T>;
|
|
606
|
+
type index$1_SearchAgentRegistrationConfig = SearchAgentRegistrationConfig;
|
|
607
|
+
declare const index$1_getAgentConfiguration: typeof getAgentConfiguration;
|
|
608
|
+
declare namespace index$1 {
|
|
609
|
+
export { type index$1_OnActionListener as OnActionListener, type index$1_OnSearchListener as OnSearchListener, type SearchAction$1 as SearchAction, type index$1_SearchAgent as SearchAgent, type index$1_SearchAgentConfigurationData as SearchAgentConfigurationData, type index$1_SearchAgentRegistrationConfig as SearchAgentRegistrationConfig, type SearchListenerRequest$1 as SearchListenerRequest, type SearchRequestContext$1 as SearchRequestContext, type SearchResponse$1 as SearchResponse, type SearchResult$1 as SearchResult, type SearchResultActionResponse$1 as SearchResultActionResponse, index$1_getAgentConfiguration as getAgentConfiguration, register$1 as register };
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* Function that is called when the Agent receives an action from HERE's search UI that has been triggered by the user on one of the Agent's search results.
|
|
614
|
+
*
|
|
615
|
+
* @param action The action that was triggered.
|
|
616
|
+
* @param result The search result that the action was triggered on.
|
|
617
|
+
*
|
|
618
|
+
* @returns Result that includes the URL that HERE should navigate to, or `undefined` if no navigation is required.
|
|
619
|
+
*/
|
|
620
|
+
type OnSearchActionListener = (action: SearchAction, result: SearchResult) => SearchResultActionResponse | Promise<SearchResultActionResponse>;
|
|
621
|
+
/**
|
|
622
|
+
* Function that is called when the Agent receives a query from HERE's search UI
|
|
623
|
+
*
|
|
624
|
+
* @param request Search request data that includes the query.
|
|
625
|
+
*
|
|
626
|
+
* @returns Search response data that includes the search results.
|
|
627
|
+
*/
|
|
628
|
+
type OnSearchRequestListener = (request: SearchListenerRequest) => SearchResponse | Promise<SearchResponse>;
|
|
629
|
+
/**
|
|
630
|
+
* An action that can be triggered by a user on a search result returned by a Agent.
|
|
631
|
+
*
|
|
632
|
+
* Actions are displayed as buttons alongside search results in HERE's search UI. That is, except for the first action, which is hidden as it is triggered automatically when the user selects the search result.
|
|
633
|
+
*/
|
|
634
|
+
type SearchAction = {
|
|
635
|
+
/**
|
|
636
|
+
* A fuller description of the action that will be displayed in HERE's search UI when the user hovers over the action button.
|
|
637
|
+
*/
|
|
638
|
+
description?: string;
|
|
639
|
+
/**
|
|
640
|
+
* Icon that will be displayed within the action button in HERE's search UI.
|
|
641
|
+
*
|
|
642
|
+
* This can be a URL/data URI string (used for both Light and Dark modes),
|
|
643
|
+
* or an object containing separate icons for Light and Dark modes.
|
|
644
|
+
*/
|
|
645
|
+
icon?: string | {
|
|
646
|
+
dark: string;
|
|
647
|
+
light: string;
|
|
648
|
+
};
|
|
649
|
+
/**
|
|
650
|
+
* Internal identifier for the action which is used to identify the action in the {@link OnSearchActionListener}.
|
|
651
|
+
*/
|
|
652
|
+
name: string;
|
|
653
|
+
/**
|
|
654
|
+
* Compact title of the action displayed within the action button.
|
|
655
|
+
*/
|
|
656
|
+
title?: string;
|
|
657
|
+
};
|
|
658
|
+
/**
|
|
659
|
+
* Search request data provided to the {@link OnSearchRequestListener}.
|
|
660
|
+
*/
|
|
661
|
+
type SearchListenerRequest = {
|
|
662
|
+
/**
|
|
663
|
+
* Provides additional context for the search request.
|
|
664
|
+
*/
|
|
665
|
+
context: SearchRequestContext;
|
|
666
|
+
/**
|
|
667
|
+
* The query entered by the user in HERE's search UI.
|
|
668
|
+
*/
|
|
669
|
+
query: string;
|
|
670
|
+
/**
|
|
671
|
+
* Provide this signal to any `fetch` requests executed in the {@link OnSearchRequestListener} function as a result of this search request, so that they will be automatically cancelled if a new search request is received before they complete.
|
|
672
|
+
*/
|
|
673
|
+
signal: AbortSignal;
|
|
674
|
+
};
|
|
675
|
+
/**
|
|
676
|
+
* Context data included with a search request.
|
|
677
|
+
*/
|
|
678
|
+
type SearchRequestContext = {
|
|
679
|
+
/**
|
|
680
|
+
* Filters to apply to the search results.
|
|
681
|
+
*/
|
|
682
|
+
filters: string[];
|
|
683
|
+
/**
|
|
684
|
+
* The locale of the client.
|
|
685
|
+
*/
|
|
686
|
+
locale: string;
|
|
687
|
+
/**
|
|
688
|
+
* The page number of the search results to return.
|
|
689
|
+
*/
|
|
690
|
+
pageNumber: number;
|
|
691
|
+
/**
|
|
692
|
+
* The number of search results to return per page.
|
|
693
|
+
*/
|
|
694
|
+
pageSize: number;
|
|
695
|
+
/**
|
|
696
|
+
* The unique ID of the query.
|
|
697
|
+
*/
|
|
698
|
+
queryId: string;
|
|
699
|
+
/**
|
|
700
|
+
* The timezone of the client.
|
|
701
|
+
*/
|
|
702
|
+
timeZone: string;
|
|
703
|
+
};
|
|
704
|
+
/**
|
|
705
|
+
* Return type of the {@link OnSearchRequestListener}.
|
|
706
|
+
*/
|
|
707
|
+
type SearchResponse = {
|
|
708
|
+
/**
|
|
709
|
+
* The search results to display in HERE's search UI.
|
|
710
|
+
*/
|
|
711
|
+
results: SearchResult[];
|
|
712
|
+
};
|
|
713
|
+
/**
|
|
714
|
+
* A search result returned by a Agent in response to a search request.
|
|
715
|
+
*/
|
|
716
|
+
type SearchResult = {
|
|
717
|
+
/**
|
|
718
|
+
* Actions that can be triggered by the user against the search result.
|
|
719
|
+
*/
|
|
720
|
+
actions: SearchAction[];
|
|
721
|
+
/**
|
|
722
|
+
* Additional data that can be used by the {@link OnSearchActionListener} when an action is triggered.
|
|
723
|
+
*/
|
|
724
|
+
data?: Record<string, unknown>;
|
|
725
|
+
/**
|
|
726
|
+
* URL or data URI of an icon that will be displayed with the search result in HERE's search UI.
|
|
727
|
+
*/
|
|
728
|
+
icon?: string;
|
|
729
|
+
/**
|
|
730
|
+
* Unique identifier for the search result.
|
|
731
|
+
*/
|
|
732
|
+
key: string;
|
|
733
|
+
/**
|
|
734
|
+
* Secondary text that will be displayed with the search result in HERE's search UI.
|
|
735
|
+
*/
|
|
736
|
+
label?: string;
|
|
737
|
+
/**
|
|
738
|
+
* Primary text that will be displayed with the search result in HERE's search UI.
|
|
739
|
+
*/
|
|
740
|
+
title: string;
|
|
741
|
+
};
|
|
742
|
+
/**
|
|
743
|
+
* Return type of the {@link OnSearchActionListener}.
|
|
744
|
+
*/
|
|
745
|
+
type SearchResultActionResponse = {
|
|
746
|
+
/**
|
|
747
|
+
* URL that HERE should navigate to.
|
|
748
|
+
*/
|
|
749
|
+
url: string;
|
|
750
|
+
} | undefined;
|
|
751
|
+
|
|
752
|
+
type Agent = {
|
|
753
|
+
/**
|
|
754
|
+
* The features supported by the Agent.
|
|
755
|
+
*/
|
|
756
|
+
features: AgentFeatures;
|
|
757
|
+
/**
|
|
758
|
+
* Joins the agent to a specific interop channel.
|
|
759
|
+
*
|
|
760
|
+
* @throws {InteropFeatureNotSupportedError} if the interop feature is not supported by the agent.
|
|
761
|
+
*/
|
|
762
|
+
joinInteropChannel: (channelName: InteropColorChannel) => Promise<void>;
|
|
763
|
+
/**
|
|
764
|
+
* Sets whether or not the Agent is ready.
|
|
765
|
+
*
|
|
766
|
+
* @param ready Whether the Agent is ready (defaults to `true`).
|
|
767
|
+
*/
|
|
768
|
+
setIsReady: (ready?: boolean) => Promise<void>;
|
|
769
|
+
};
|
|
770
|
+
/**
|
|
771
|
+
* The features supported by the Agent.
|
|
772
|
+
*/
|
|
773
|
+
type AgentFeatures = {
|
|
774
|
+
interop?: {
|
|
775
|
+
defaultChannel?: InteropColorChannel;
|
|
776
|
+
fdc3Version: OpenFin$1.FDC3.Version;
|
|
777
|
+
};
|
|
778
|
+
search?: {
|
|
779
|
+
filters?: AgentSearchFilter[];
|
|
780
|
+
supportsPaging: boolean;
|
|
781
|
+
};
|
|
782
|
+
};
|
|
783
|
+
/**
|
|
784
|
+
* Configuration provided when registering a Agent.
|
|
785
|
+
*/
|
|
786
|
+
type AgentRegistrationConfig = {
|
|
787
|
+
/**
|
|
788
|
+
* Search configuration required if the Agent supports search functionality.
|
|
789
|
+
*/
|
|
790
|
+
search?: {
|
|
791
|
+
/**
|
|
792
|
+
* This listener is called when the Agent receives an action from HERE's search UI that has been triggered by the user on one of the Agent's search results.
|
|
793
|
+
*
|
|
794
|
+
* The listener returns a response back to HERE that includes a URL to navigate to.
|
|
795
|
+
*/
|
|
796
|
+
onAction: OnSearchActionListener;
|
|
797
|
+
/**
|
|
798
|
+
* This listener is called when the Agent receives a query from HERE's search UI and returns relevant search results.
|
|
799
|
+
*
|
|
800
|
+
* Note: When the Agent is not ready this listener will not be called.
|
|
801
|
+
*/
|
|
802
|
+
onSearch: OnSearchRequestListener;
|
|
803
|
+
};
|
|
804
|
+
};
|
|
805
|
+
/**
|
|
806
|
+
* A filter that can be applied to the Agent’s search results.
|
|
807
|
+
*/
|
|
808
|
+
type AgentSearchFilter = {
|
|
809
|
+
icon?: string | {
|
|
810
|
+
dark: string;
|
|
811
|
+
light: string;
|
|
812
|
+
};
|
|
813
|
+
id: string;
|
|
814
|
+
title: string;
|
|
815
|
+
};
|
|
816
|
+
|
|
817
|
+
/**
|
|
818
|
+
* Retrieves the Agent's configuration data, as has been configured in the HERE Admin Console.
|
|
819
|
+
*
|
|
820
|
+
* @returns A promise that resolves with an object containing properties that match the Agent’s configuration.
|
|
821
|
+
*
|
|
822
|
+
* @example Retrieving the Agent’s configuration data:
|
|
823
|
+
* ```ts
|
|
824
|
+
* import { Agent } from "@openfin/cloud-api";
|
|
825
|
+
*
|
|
826
|
+
* // Get the configuration data
|
|
827
|
+
* const configData = await Agent.getConfiguration<{ customField1: string, customField2: string }>();
|
|
828
|
+
*
|
|
829
|
+
* // Pick out the standard configuration properties
|
|
830
|
+
* const { customData, description, id, title, url } = configData;
|
|
831
|
+
*
|
|
832
|
+
* // Pick out the custom configuration properties
|
|
833
|
+
* if (customData) {
|
|
834
|
+
* const { customField1, customField2 } = customData;
|
|
835
|
+
* }
|
|
836
|
+
* ```
|
|
837
|
+
*/
|
|
838
|
+
declare const getConfiguration: <T extends Record<string, unknown>>() => Promise<T>;
|
|
839
|
+
/**
|
|
840
|
+
* Registers an Agent.
|
|
841
|
+
*
|
|
842
|
+
* @param config The configuration for the Agent.
|
|
843
|
+
*
|
|
844
|
+
* @returns A promise that resolves with the Agent.
|
|
845
|
+
*
|
|
846
|
+
* @example Registering an Agent that will provide search results:
|
|
847
|
+
* ```ts
|
|
848
|
+
* import { Agent } from "@openfin/cloud-api";
|
|
849
|
+
*
|
|
850
|
+
* // Handle incoming action and return a response that includes the URL to navigate to
|
|
851
|
+
* const onAction: Agent.OnSearchActionListener = (action, result) => {
|
|
852
|
+
* const { name } = action;
|
|
853
|
+
* const { data, key } = result;
|
|
854
|
+
* const { owner, searchResultHostUrl } = data as { owner: { id: string, name: string }, searchResultHostUrl: string };
|
|
855
|
+
* const { id: ownerId } = owner;
|
|
856
|
+
*
|
|
857
|
+
* console.log(`Action "${name}" triggered on search result with key "${key}"`);
|
|
858
|
+
*
|
|
859
|
+
* switch (name) {
|
|
860
|
+
* case "view-owner":
|
|
861
|
+
* return { url: `${searchResultHostUrl}/people/${ownerId}` };
|
|
862
|
+
* case "view-result":
|
|
863
|
+
* return { url: `${searchResultHostUrl}/record/${key}` };
|
|
864
|
+
* default:
|
|
865
|
+
* console.warn(`Unknown action: ${name}`);
|
|
866
|
+
* }
|
|
867
|
+
* };
|
|
868
|
+
*
|
|
869
|
+
* // Handle incoming search request and return relevant search results
|
|
870
|
+
* const onSearch: Agent.OnSearchRequestListener = ({ context, query, signal }) => {
|
|
871
|
+
* const { pageNumber, pageSize } = context;
|
|
872
|
+
* try {
|
|
873
|
+
* let results: Agent.SearchResult[] = [];
|
|
874
|
+
* const url = `https://my-web-app.com/search?q=${query}&page=${pageNumber}&limit=${pageSize}`;
|
|
875
|
+
* const response = await fetch(url, { signal });
|
|
876
|
+
* if (!response.ok) {
|
|
877
|
+
* throw new Error(`Request failed: ${response.status}`);
|
|
878
|
+
* }
|
|
879
|
+
* const { searchResults } = await response.json();
|
|
880
|
+
* results = searchResults.map((result) => {
|
|
881
|
+
* const { iconUrl, id: key, owner, subTitle, title } = result;
|
|
882
|
+
* const { name: ownerName } = owner as { id: string, name: string };
|
|
883
|
+
* return {
|
|
884
|
+
* actions: [
|
|
885
|
+
* {
|
|
886
|
+
* name: "view-result",
|
|
887
|
+
* description: `Go to ${title} in My Web App`,
|
|
888
|
+
* },
|
|
889
|
+
* {
|
|
890
|
+
* name: "view-owner",
|
|
891
|
+
* description: `Go to ${ownerName} in My Web App`,
|
|
892
|
+
* title: "View Owner",
|
|
893
|
+
* icon: {
|
|
894
|
+
* dark: "data:image/svg+xml,...",
|
|
895
|
+
* light: "data:image/svg+xml,...",
|
|
896
|
+
* },
|
|
897
|
+
* },
|
|
898
|
+
* ],
|
|
899
|
+
* data: {
|
|
900
|
+
* owner,
|
|
901
|
+
* searchResultHostUrl: `https://my-web-app.com`,
|
|
902
|
+
* },
|
|
903
|
+
* icon: iconUrl,
|
|
904
|
+
* key,
|
|
905
|
+
* label: subTitle,
|
|
906
|
+
* title,
|
|
907
|
+
* };
|
|
908
|
+
* });
|
|
909
|
+
* console.log("Returning results", results);
|
|
910
|
+
* return { results };
|
|
911
|
+
* } catch (err) {
|
|
912
|
+
* if ((err as Error).name === "AbortError") {
|
|
913
|
+
* // Ignore errors for cancelled requests
|
|
914
|
+
* return { results: [] };
|
|
915
|
+
* }
|
|
916
|
+
* throw err;
|
|
917
|
+
* }
|
|
918
|
+
* };
|
|
919
|
+
*
|
|
920
|
+
* // Register the agent
|
|
921
|
+
* const agent = await Agent.register({ search: { onAction, onSearch } });
|
|
922
|
+
*
|
|
923
|
+
* // Set the Agent as ready to receive requests
|
|
924
|
+
* await agent.isReady();
|
|
925
|
+
* ```
|
|
586
926
|
*/
|
|
587
|
-
declare function register(config:
|
|
927
|
+
declare function register(config: AgentRegistrationConfig): Promise<Agent>;
|
|
588
928
|
|
|
589
|
-
type
|
|
590
|
-
type
|
|
591
|
-
type
|
|
592
|
-
type
|
|
593
|
-
|
|
594
|
-
type
|
|
929
|
+
type index_Agent = Agent;
|
|
930
|
+
type index_AgentFeatures = AgentFeatures;
|
|
931
|
+
type index_AgentRegistrationConfig = AgentRegistrationConfig;
|
|
932
|
+
type index_AgentSearchFilter = AgentSearchFilter;
|
|
933
|
+
declare const index_InteropColorChannel: typeof InteropColorChannel;
|
|
934
|
+
type index_OnSearchActionListener = OnSearchActionListener;
|
|
935
|
+
type index_OnSearchRequestListener = OnSearchRequestListener;
|
|
595
936
|
type index_SearchListenerRequest = SearchListenerRequest;
|
|
596
|
-
type index_SearchRequestContext = SearchRequestContext;
|
|
597
|
-
type index_SearchResponse = SearchResponse;
|
|
598
937
|
type index_SearchResult = SearchResult;
|
|
599
|
-
|
|
600
|
-
declare const index_getAgentConfiguration: typeof getAgentConfiguration;
|
|
938
|
+
declare const index_getConfiguration: typeof getConfiguration;
|
|
601
939
|
declare const index_register: typeof register;
|
|
602
940
|
declare namespace index {
|
|
603
|
-
export { type
|
|
941
|
+
export { type index_Agent as Agent, type index_AgentFeatures as AgentFeatures, type index_AgentRegistrationConfig as AgentRegistrationConfig, type index_AgentSearchFilter as AgentSearchFilter, index_InteropColorChannel as InteropColorChannel, type index_OnSearchActionListener as OnSearchActionListener, type index_OnSearchRequestListener as OnSearchRequestListener, type index_SearchListenerRequest as SearchListenerRequest, type index_SearchResult as SearchResult, index_getConfiguration as getConfiguration, index_register as register };
|
|
604
942
|
}
|
|
605
943
|
|
|
606
944
|
declare global {
|
|
@@ -609,4 +947,4 @@ declare global {
|
|
|
609
947
|
}
|
|
610
948
|
}
|
|
611
949
|
|
|
612
|
-
export { type AppPermissions, type LaunchContentOptions, index as Search, type FlannelChannelProvider as __INTERNAL_FlannelChannelProvider, type FlannelClearNotificationRequest as __INTERNAL_FlannelClearNotificationRequest, type FlannelClearNotificationResponse as __INTERNAL_FlannelClearNotificationResponse, type FlannelCreateNotificationRequest as __INTERNAL_FlannelCreateNotificationRequest, type FlannelCreateNotificationResponse as __INTERNAL_FlannelCreateNotificationResponse, type FlannelUpdateNotificationRequest as __INTERNAL_FlannelUpdateNotificationRequest, type FlannelUpdateNotificationResponse as __INTERNAL_FlannelUpdateNotificationResponse, getAppSettings, getAppUserPermissions, getAppUserSettings, getNotificationsClient, launchContent, launchSupertab, launchWorkspace, setAppUserSettings };
|
|
950
|
+
export { index as Agent, type AppPermissions, type LaunchContentOptions, index$1 as Search, type FlannelChannelProvider as __INTERNAL_FlannelChannelProvider, type FlannelClearNotificationRequest as __INTERNAL_FlannelClearNotificationRequest, type FlannelClearNotificationResponse as __INTERNAL_FlannelClearNotificationResponse, type FlannelCreateNotificationRequest as __INTERNAL_FlannelCreateNotificationRequest, type FlannelCreateNotificationResponse as __INTERNAL_FlannelCreateNotificationResponse, type FlannelUpdateNotificationRequest as __INTERNAL_FlannelUpdateNotificationRequest, type FlannelUpdateNotificationResponse as __INTERNAL_FlannelUpdateNotificationResponse, getAppSettings, getAppUserPermissions, getAppUserSettings, getNotificationsClient, launchContent, launchSupertab, launchWorkspace, setAppUserSettings };
|