-
Notifications
You must be signed in to change notification settings - Fork 132
/
BrowserTypes.ts
5167 lines (4759 loc) · 195 KB
/
BrowserTypes.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// To parse this data:
//
// import { Convert, AppRequestMessage, AgentResponseMessage, AgentEventMessage, AddContextListenerRequest, AddContextListenerResponse, AddIntentListenerRequest, AddIntentListenerResponse, BroadcastEvent, BroadcastRequest, BroadcastResponse, ChannelChangedEvent, ContextListenerUnsubscribeRequest, ContextListenerUnsubscribeResponse, CreatePrivateChannelRequest, CreatePrivateChannelResponse, FindInstancesRequest, FindInstancesResponse, FindIntentRequest, FindIntentResponse, FindIntentsByContextRequest, FindIntentsByContextsByContextResponse, GetAppMetadataRequest, GetAppMetadataResponse, GetCurrentChannelRequest, GetCurrentChannelResponse, GetCurrentContextRequest, GetCurrentContextResponse, GetInfoRequest, GetInfoResponse, GetOrCreateChannelRequest, GetOrCreateChannelResponse, GetUserChannelsRequest, GetUserChannelsResponse, IframeChannelDrag, IframeChannelResize, IframeChannels, IframeChannelSelected, IframeHandshake, IframeHello, IframeMessage, IframeResolve, IframeResolveAction, IntentEvent, IntentListenerUnsubscribeRequest, IntentListenerUnsubscribeResponse, JoinUserChannelRequest, JoinUserChannelResponse, LeaveCurrentChannelRequest, LeaveCurrentChannelResponse, OpenRequest, OpenResponse, PrivateChannelAddEventListenerRequest, PrivateChannelAddEventListenerResponse, PrivateChannelDisconnectRequest, PrivateChannelDisconnectResponse, PrivateChannelOnAddContextListenerEvent, PrivateChannelOnDisconnectEvent, PrivateChannelOnUnsubscribeEventEvent, PrivateChannelUnsubscribeEventListenerRequest, PrivateChannelUnsubscribeEventListenerResponse, RaiseIntentForContextRequest, RaiseIntentForContextResponse, RaiseIntentRequest, RaiseIntentResponse, RaiseIntentResultResponse, WebConnectionProtocol1Hello, WebConnectionProtocol2LoadURL, WebConnectionProtocol3Handshake, WebConnectionProtocol4ValidateAppIdentity, WebConnectionProtocol5ValidateAppIdentityFailedResponse, WebConnectionProtocol5ValidateAppIdentitySuccessResponse, WebConnectionProtocolMessage } from "./file";
//
// const fDC3DesktopAgentAPISchemas = Convert.toFDC3DesktopAgentAPISchemas(json);
// const commonDefinitions = Convert.toCommonDefinitions(json);
// const appRequestMessage = Convert.toAppRequestMessage(json);
// const agentResponseMessage = Convert.toAgentResponseMessage(json);
// const agentEventMessage = Convert.toAgentEventMessage(json);
// const addContextListenerRequest = Convert.toAddContextListenerRequest(json);
// const addContextListenerResponse = Convert.toAddContextListenerResponse(json);
// const addIntentListenerRequest = Convert.toAddIntentListenerRequest(json);
// const addIntentListenerResponse = Convert.toAddIntentListenerResponse(json);
// const broadcastEvent = Convert.toBroadcastEvent(json);
// const broadcastRequest = Convert.toBroadcastRequest(json);
// const broadcastResponse = Convert.toBroadcastResponse(json);
// const channelChangedEvent = Convert.toChannelChangedEvent(json);
// const contextListenerUnsubscribeRequest = Convert.toContextListenerUnsubscribeRequest(json);
// const contextListenerUnsubscribeResponse = Convert.toContextListenerUnsubscribeResponse(json);
// const createPrivateChannelRequest = Convert.toCreatePrivateChannelRequest(json);
// const createPrivateChannelResponse = Convert.toCreatePrivateChannelResponse(json);
// const findInstancesRequest = Convert.toFindInstancesRequest(json);
// const findInstancesResponse = Convert.toFindInstancesResponse(json);
// const findIntentRequest = Convert.toFindIntentRequest(json);
// const findIntentResponse = Convert.toFindIntentResponse(json);
// const findIntentsByContextRequest = Convert.toFindIntentsByContextRequest(json);
// const findIntentsByContextsByContextResponse = Convert.toFindIntentsByContextsByContextResponse(json);
// const getAppMetadataRequest = Convert.toGetAppMetadataRequest(json);
// const getAppMetadataResponse = Convert.toGetAppMetadataResponse(json);
// const getCurrentChannelRequest = Convert.toGetCurrentChannelRequest(json);
// const getCurrentChannelResponse = Convert.toGetCurrentChannelResponse(json);
// const getCurrentContextRequest = Convert.toGetCurrentContextRequest(json);
// const getCurrentContextResponse = Convert.toGetCurrentContextResponse(json);
// const getInfoRequest = Convert.toGetInfoRequest(json);
// const getInfoResponse = Convert.toGetInfoResponse(json);
// const getOrCreateChannelRequest = Convert.toGetOrCreateChannelRequest(json);
// const getOrCreateChannelResponse = Convert.toGetOrCreateChannelResponse(json);
// const getUserChannelsRequest = Convert.toGetUserChannelsRequest(json);
// const getUserChannelsResponse = Convert.toGetUserChannelsResponse(json);
// const iframeChannelDrag = Convert.toIframeChannelDrag(json);
// const iframeChannelResize = Convert.toIframeChannelResize(json);
// const iframeChannels = Convert.toIframeChannels(json);
// const iframeChannelSelected = Convert.toIframeChannelSelected(json);
// const iframeHandshake = Convert.toIframeHandshake(json);
// const iframeHello = Convert.toIframeHello(json);
// const iframeMessage = Convert.toIframeMessage(json);
// const iframeResolve = Convert.toIframeResolve(json);
// const iframeResolveAction = Convert.toIframeResolveAction(json);
// const intentEvent = Convert.toIntentEvent(json);
// const intentListenerUnsubscribeRequest = Convert.toIntentListenerUnsubscribeRequest(json);
// const intentListenerUnsubscribeResponse = Convert.toIntentListenerUnsubscribeResponse(json);
// const joinUserChannelRequest = Convert.toJoinUserChannelRequest(json);
// const joinUserChannelResponse = Convert.toJoinUserChannelResponse(json);
// const leaveCurrentChannelRequest = Convert.toLeaveCurrentChannelRequest(json);
// const leaveCurrentChannelResponse = Convert.toLeaveCurrentChannelResponse(json);
// const openRequest = Convert.toOpenRequest(json);
// const openResponse = Convert.toOpenResponse(json);
// const privateChannelAddEventListenerRequest = Convert.toPrivateChannelAddEventListenerRequest(json);
// const privateChannelAddEventListenerResponse = Convert.toPrivateChannelAddEventListenerResponse(json);
// const privateChannelDisconnectRequest = Convert.toPrivateChannelDisconnectRequest(json);
// const privateChannelDisconnectResponse = Convert.toPrivateChannelDisconnectResponse(json);
// const privateChannelOnAddContextListenerEvent = Convert.toPrivateChannelOnAddContextListenerEvent(json);
// const privateChannelOnDisconnectEvent = Convert.toPrivateChannelOnDisconnectEvent(json);
// const privateChannelOnUnsubscribeEventEvent = Convert.toPrivateChannelOnUnsubscribeEventEvent(json);
// const privateChannelUnsubscribeEventListenerRequest = Convert.toPrivateChannelUnsubscribeEventListenerRequest(json);
// const privateChannelUnsubscribeEventListenerResponse = Convert.toPrivateChannelUnsubscribeEventListenerResponse(json);
// const raiseIntentForContextRequest = Convert.toRaiseIntentForContextRequest(json);
// const raiseIntentForContextResponse = Convert.toRaiseIntentForContextResponse(json);
// const raiseIntentRequest = Convert.toRaiseIntentRequest(json);
// const raiseIntentResponse = Convert.toRaiseIntentResponse(json);
// const raiseIntentResultResponse = Convert.toRaiseIntentResultResponse(json);
// const webConnectionProtocol1Hello = Convert.toWebConnectionProtocol1Hello(json);
// const webConnectionProtocol2LoadURL = Convert.toWebConnectionProtocol2LoadURL(json);
// const webConnectionProtocol3Handshake = Convert.toWebConnectionProtocol3Handshake(json);
// const webConnectionProtocol4ValidateAppIdentity = Convert.toWebConnectionProtocol4ValidateAppIdentity(json);
// const webConnectionProtocol5ValidateAppIdentityFailedResponse = Convert.toWebConnectionProtocol5ValidateAppIdentityFailedResponse(json);
// const webConnectionProtocol5ValidateAppIdentitySuccessResponse = Convert.toWebConnectionProtocol5ValidateAppIdentitySuccessResponse(json);
// const webConnectionProtocolMessage = Convert.toWebConnectionProtocolMessage(json);
//
// These functions will throw an error if the JSON doesn't
// match the expected interface, even if the JSON is valid.
/**
* A request message from an FDC3-enabled app to a Desktop Agent.
*/
export interface AppRequestMessage {
/**
* Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent.
*/
meta: AppRequestMessageMeta;
/**
* The message payload typically contains the arguments to FDC3 API functions.
*/
payload: { [key: string]: any };
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Request' appended.
*/
type: RequestMessageType;
}
/**
* Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent.
*/
export interface AppRequestMessageMeta {
requestUuid: string;
/**
* Field that represents the source application that a request or response was received
* from. Please note that this may be set by an app or Desktop Agent proxy for debugging
* purposes but a Desktop Agent should make its own determination of the source of a message
* to avoid spoofing.
*/
source?: AppIdentifier;
timestamp: Date;
}
/**
* Field that represents the source application that a request or response was received
* from. Please note that this may be set by an app or Desktop Agent proxy for debugging
* purposes but a Desktop Agent should make its own determination of the source of a message
* to avoid spoofing.
*
* Identifies an application, or instance of an application, and is used to target FDC3 API
* calls, such as `fdc3.open` or `fdc3.raiseIntent` at specific applications or application
* instances.
*
* Will always include at least an `appId` field, which uniquely identifies a specific app.
*
* If the `instanceId` field is set then the `AppMetadata` object represents a specific
* instance of the application that may be addressed using that Id.
*
* Field that represents the source application that the request being responded to was
* received from, for debugging purposes.
*
* The App resolution option chosen
*
* Details of the application instance that raised the intent
*
* Identifier for the app instance that was selected (or started) to resolve the intent.
* `source.instanceId` MUST be set, indicating the specific app instance that
* received the intent.
*/
export interface AppIdentifier {
/**
* The unique application identifier located within a specific application directory
* instance. An example of an appId might be 'app@sub.root'
*/
appId: string;
/**
* The Desktop Agent that the app is available on. Used in Desktop Agent Bridging to
* identify the Desktop Agent to target.
*/
desktopAgent?: string;
/**
* An optional instance identifier, indicating that this object represents a specific
* instance of the application described.
*/
instanceId?: string;
[property: string]: any;
}
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Request' appended.
*/
export type RequestMessageType = "addContextListenerRequest" | "addIntentListenerRequest" | "broadcastRequest" | "contextListenerUnsubscribeRequest" | "createPrivateChannelRequest" | "findInstancesRequest" | "findIntentRequest" | "findIntentsByContextRequest" | "getAppMetadataRequest" | "getCurrentChannelRequest" | "getCurrentContextRequest" | "getInfoRequest" | "getOrCreateChannelRequest" | "getUserChannelsRequest" | "intentListenerUnsubscribeRequest" | "joinUserChannelRequest" | "leaveCurrentChannelRequest" | "openRequest" | "privateChannelAddEventListenerRequest" | "privateChannelDisconnectRequest" | "privateChannelUnsubscribeEventListenerRequest" | "raiseIntentForContextRequest" | "raiseIntentRequest";
/**
* A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the
* payload contains an `error` property, the request was unsuccessful.
*/
export interface AgentResponseMessage {
/**
* Metadata for messages sent by a Desktop Agent to an App in response to an API call
*/
meta: AgentResponseMessageMeta;
/**
* A payload for a response to an API call that will contain any return values or an `error`
* property containing a standardized error message indicating that the request was
* unsuccessful.
*/
payload: AgentResponseMessageResponsePayload;
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Response' appended.
*/
type: ResponseMessageType;
}
/**
* Metadata for messages sent by a Desktop Agent to an App in response to an API call
*/
export interface AgentResponseMessageMeta {
requestUuid: string;
responseUuid: string;
/**
* Field that represents the source application that the request being responded to was
* received from, for debugging purposes.
*/
source?: AppIdentifier;
timestamp: Date;
}
/**
* A payload for a response to an API call that will contain any return values or an `error`
* property containing a standardized error message indicating that the request was
* unsuccessful.
*/
export interface AgentResponseMessageResponsePayload {
error?: ResponsePayloadError;
[property: string]: any;
}
/**
* Constants representing the errors that can be encountered when calling the `open` method
* on the DesktopAgent object (`fdc3`).
*
* Constants representing the errors that can be encountered when calling the `findIntent`,
* `findIntentsByContext`, `raiseIntent` or `raiseIntentForContext` methods on the
* DesktopAgent (`fdc3`).
*/
export type ResponsePayloadError = "AccessDenied" | "CreationFailed" | "MalformedContext" | "NoChannelFound" | "AppNotFound" | "AppTimeout" | "DesktopAgentNotFound" | "ErrorOnLaunch" | "ResolverUnavailable" | "IntentDeliveryFailed" | "NoAppsFound" | "ResolverTimeout" | "TargetAppUnavailable" | "TargetInstanceUnavailable" | "UserCancelledResolution" | "IntentHandlerRejected" | "NoResultReturned" | "AgentDisconnected" | "NotConnectedToBridge" | "ResponseToBridgeTimedOut" | "MalformedMessage";
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Response' appended.
*/
export type ResponseMessageType = "addContextListenerResponse" | "addIntentListenerResponse" | "broadcastResponse" | "contextListenerUnsubscribeResponse" | "createPrivateChannelResponse" | "findInstancesResponse" | "findIntentResponse" | "findIntentsByContextResponse" | "getAppMetadataResponse" | "getCurrentChannelResponse" | "getCurrentContextResponse" | "getInfoResponse" | "getOrCreateChannelResponse" | "getUserChannelsResponse" | "intentListenerUnsubscribeResponse" | "joinUserChannelResponse" | "leaveCurrentChannelResponse" | "openResponse" | "privateChannelAddEventListenerResponse" | "privateChannelDisconnectResponse" | "privateChannelUnsubscribeEventListenerResponse" | "raiseIntentForContextResponse" | "raiseIntentResponse" | "raiseIntentResultResponse";
/**
* A message from a Desktop Agent to an FDC3-enabled app representing an event.
*/
export interface AgentEventMessage {
/**
* Metadata for messages sent by a Desktop Agent to an App notifying it of an event.
*/
meta: AgentEventMessageMeta;
/**
* The message payload contains details of the event that the app is being notified about.
*/
payload: { [key: string]: any };
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Response' appended.
*/
type: EventMessageType;
}
/**
* Metadata for messages sent by a Desktop Agent to an App notifying it of an event.
*/
export interface AgentEventMessageMeta {
eventUuid: string;
timestamp: Date;
}
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Response' appended.
*/
export type EventMessageType = "intentEvent" | "broadcastEvent" | "channelChangedEvent" | "privateChannelOnAddContextListenerEvent" | "privateChannelOnDisconnectEvent" | "privateChannelOnUnsubscribeEvent";
/**
* A request to add a context listener to a specified Channel OR to the current user
* channel.
*
* A request message from an FDC3-enabled app to a Desktop Agent.
*/
export interface AddContextListenerRequest {
/**
* Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent.
*/
meta: AddContextListenerRequestMeta;
/**
* The message payload typically contains the arguments to FDC3 API functions.
*/
payload: AddContextListenerRequestPayload;
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Request' appended.
*/
type: "addContextListenerRequest";
}
/**
* Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent.
*/
export interface AddContextListenerRequestMeta {
requestUuid: string;
/**
* Field that represents the source application that a request or response was received
* from. Please note that this may be set by an app or Desktop Agent proxy for debugging
* purposes but a Desktop Agent should make its own determination of the source of a message
* to avoid spoofing.
*/
source?: AppIdentifier;
timestamp: Date;
}
/**
* The message payload typically contains the arguments to FDC3 API functions.
*/
export interface AddContextListenerRequestPayload {
/**
* The id of the channel to add the listener to or `null` indicating that it should listen
* to the current user channel (at the time of broadcast).
*/
channelId: null | string;
/**
* The type of context to listen for OR `null` indicating that it should listen to all
* context types.
*/
contextType: null | string;
}
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Request' appended.
*/
/**
* A response to a addContextListener request.
*
* A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the
* payload contains an `error` property, the request was unsuccessful.
*/
export interface AddContextListenerResponse {
/**
* Metadata for messages sent by a Desktop Agent to an App in response to an API call
*/
meta: AddContextListenerResponseMeta;
/**
* A payload for a response to an API call that will contain any return values or an `error`
* property containing a standardized error message indicating that the request was
* unsuccessful.
*/
payload: AddContextListenerResponsePayload;
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Response' appended.
*/
type: "addContextListenerResponse";
}
/**
* Metadata for messages sent by a Desktop Agent to an App in response to an API call
*/
export interface AddContextListenerResponseMeta {
requestUuid: string;
responseUuid: string;
/**
* Field that represents the source application that the request being responded to was
* received from, for debugging purposes.
*/
source?: AppIdentifier;
timestamp: Date;
}
/**
* A payload for a response to an API call that will contain any return values or an `error`
* property containing a standardized error message indicating that the request was
* unsuccessful.
*/
export interface AddContextListenerResponsePayload {
error?: PurpleError;
listenerUUID?: string;
}
/**
* Constants representing the errors that can be encountered when calling the `open` method
* on the DesktopAgent object (`fdc3`).
*
* Constants representing the errors that can be encountered when calling the `findIntent`,
* `findIntentsByContext`, `raiseIntent` or `raiseIntentForContext` methods on the
* DesktopAgent (`fdc3`).
*/
export type PurpleError = "AccessDenied" | "CreationFailed" | "MalformedContext" | "NoChannelFound";
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Response' appended.
*/
/**
* A request to add an Intent listener for a specified intent type.
*
* A request message from an FDC3-enabled app to a Desktop Agent.
*/
export interface AddIntentListenerRequest {
/**
* Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent.
*/
meta: AddContextListenerRequestMeta;
/**
* The message payload typically contains the arguments to FDC3 API functions.
*/
payload: AddIntentListenerRequestPayload;
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Request' appended.
*/
type: "addIntentListenerRequest";
}
/**
* The message payload typically contains the arguments to FDC3 API functions.
*/
export interface AddIntentListenerRequestPayload {
/**
* The name of the intent to listen for.
*/
intent: string;
}
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Request' appended.
*/
/**
* A response to a addIntentListener request.
*
* A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the
* payload contains an `error` property, the request was unsuccessful.
*/
export interface AddIntentListenerResponse {
/**
* Metadata for messages sent by a Desktop Agent to an App in response to an API call
*/
meta: AddContextListenerResponseMeta;
/**
* A payload for a response to an API call that will contain any return values or an `error`
* property containing a standardized error message indicating that the request was
* unsuccessful.
*/
payload: AddIntentListenerResponsePayload;
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Response' appended.
*/
type: "addIntentListenerResponse";
}
/**
* A payload for a response to an API call that will contain any return values or an `error`
* property containing a standardized error message indicating that the request was
* unsuccessful.
*/
export interface AddIntentListenerResponsePayload {
error?: FluffyError;
listenerUUID?: string;
[property: string]: any;
}
/**
* Constants representing the errors that can be encountered when calling the `open` method
* on the DesktopAgent object (`fdc3`).
*
* Constants representing the errors that can be encountered when calling the `findIntent`,
* `findIntentsByContext`, `raiseIntent` or `raiseIntentForContext` methods on the
* DesktopAgent (`fdc3`).
*/
export type FluffyError = "MalformedContext" | "DesktopAgentNotFound" | "ResolverUnavailable" | "IntentDeliveryFailed" | "NoAppsFound" | "ResolverTimeout" | "TargetAppUnavailable" | "TargetInstanceUnavailable" | "UserCancelledResolution";
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Response' appended.
*/
/**
* An event message from the Desktop Agent to an app indicating that context has been
* broadcast on a channel it is listening to.
*
* A message from a Desktop Agent to an FDC3-enabled app representing an event.
*/
export interface BroadcastEvent {
/**
* Metadata for messages sent by a Desktop Agent to an App notifying it of an event.
*/
meta: BroadcastEventMeta;
/**
* The message payload contains details of the event that the app is being notified about.
*/
payload: BroadcastEventPayload;
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Response' appended.
*/
type: "broadcastEvent";
}
/**
* Metadata for messages sent by a Desktop Agent to an App notifying it of an event.
*/
export interface BroadcastEventMeta {
eventUuid: string;
timestamp: Date;
}
/**
* The message payload contains details of the event that the app is being notified about.
*/
export interface BroadcastEventPayload {
/**
* The Id of the channel that the broadcast was sent on.
*/
channelId: string;
/**
* The context object that was broadcast.
*/
context: Context;
}
/**
* The context object that was broadcast.
*
* The context object that is to be broadcast.
*
* The context object passed with the raised intent.
*
* The `fdc3.context` type defines the basic contract or "shape" for all data exchanged by
* FDC3 operations. As such, it is not really meant to be used on its own, but is imported
* by more specific type definitions (standardized or custom) to provide the structure and
* properties shared by all FDC3 context data types.
*
* The key element of FDC3 context types is their mandatory `type` property, which is used
* to identify what type of data the object represents, and what shape it has.
*
* The FDC3 context type, and all derived types, define the minimum set of fields a context
* data object of a particular type can be expected to have, but this can always be extended
* with custom fields as appropriate.
*/
export interface Context {
/**
* Context data objects may include a set of equivalent key-value pairs that can be used to
* help applications identify and look up the context type they receive in their own domain.
* The idea behind this design is that applications can provide as many equivalent
* identifiers to a target application as possible, e.g. an instrument may be represented by
* an ISIN, CUSIP or Bloomberg identifier.
*
* Identifiers do not make sense for all types of data, so the `id` property is therefore
* optional, but some derived types may choose to require at least one identifier.
* Identifier values SHOULD always be of type string.
*/
id?: { [key: string]: any };
/**
* Context data objects may include a name property that can be used for more information,
* or display purposes. Some derived types may require the name object as mandatory,
* depending on use case.
*/
name?: string;
/**
* The type property is the only _required_ part of the FDC3 context data schema. The FDC3
* [API](https://fdc3.finos.org/docs/api/spec) relies on the `type` property being present
* to route shared context data appropriately.
*
* FDC3 [Intents](https://fdc3.finos.org/docs/intents/spec) also register the context data
* types they support in an FDC3 [App
* Directory](https://fdc3.finos.org/docs/app-directory/overview), used for intent discovery
* and routing.
*
* Standardized FDC3 context types have well-known `type` properties prefixed with the
* `fdc3` namespace, e.g. `fdc3.instrument`. For non-standard types, e.g. those defined and
* used by a particular organization, the convention is to prefix them with an
* organization-specific namespace, e.g. `blackrock.fund`.
*
* See the [Context Data Specification](https://fdc3.finos.org/docs/context/spec) for more
* information about context data types.
*/
type: string;
[property: string]: any;
}
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Response' appended.
*/
/**
* A request to broadcast context on a channel.
*
* A request message from an FDC3-enabled app to a Desktop Agent.
*/
export interface BroadcastRequest {
/**
* Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent.
*/
meta: AddContextListenerRequestMeta;
/**
* The message payload typically contains the arguments to FDC3 API functions.
*/
payload: BroadcastRequestPayload;
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Request' appended.
*/
type: "broadcastRequest";
}
/**
* The message payload typically contains the arguments to FDC3 API functions.
*/
export interface BroadcastRequestPayload {
/**
* The Id of the Channel that the broadcast was sent on
*/
channelId: string;
/**
* The context object that is to be broadcast.
*/
context: Context;
}
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Request' appended.
*/
/**
* A response to a request to broadcast context on a channel.
*
* A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the
* payload contains an `error` property, the request was unsuccessful.
*/
export interface BroadcastResponse {
/**
* Metadata for messages sent by a Desktop Agent to an App in response to an API call
*/
meta: AddContextListenerResponseMeta;
/**
* A payload for a response to an API call that will contain any return values or an `error`
* property containing a standardized error message indicating that the request was
* unsuccessful.
*/
payload: BroadcastResponseResponsePayload;
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Response' appended.
*/
type: "broadcastResponse";
}
/**
* A payload for a response to an API call that will contain any return values or an `error`
* property containing a standardized error message indicating that the request was
* unsuccessful.
*/
export interface BroadcastResponseResponsePayload {
error?: ResponsePayloadError;
[property: string]: any;
}
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Response' appended.
*/
/**
* An event message from the Desktop Agent to an app indicating that its current user
* channel has changed.
*
* A message from a Desktop Agent to an FDC3-enabled app representing an event.
*/
export interface ChannelChangedEvent {
/**
* Metadata for messages sent by a Desktop Agent to an App notifying it of an event.
*/
meta: BroadcastEventMeta;
/**
* The message payload contains details of the event that the app is being notified about.
*/
payload: ChannelChangedEventPayload;
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Response' appended.
*/
type: "channelChangedEvent";
}
/**
* The message payload contains details of the event that the app is being notified about.
*/
export interface ChannelChangedEventPayload {
/**
* The Id of the channel that the app was added to or `null` if it was removed from a
* channel.
*/
newChannelId: null | string;
}
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Response' appended.
*/
/**
* A request to unsubscribe a context listener.
*
* A request message from an FDC3-enabled app to a Desktop Agent.
*/
export interface ContextListenerUnsubscribeRequest {
/**
* Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent.
*/
meta: AddContextListenerRequestMeta;
/**
* The message payload typically contains the arguments to FDC3 API functions.
*/
payload: ContextListenerUnsubscribeRequestPayload;
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Request' appended.
*/
type: "contextListenerUnsubscribeRequest";
}
/**
* The message payload typically contains the arguments to FDC3 API functions.
*/
export interface ContextListenerUnsubscribeRequestPayload {
listenerUUID: string;
}
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Request' appended.
*/
/**
* A response to a request to a contextListenerUnsubscribe request.
*
* A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the
* payload contains an `error` property, the request was unsuccessful.
*/
export interface ContextListenerUnsubscribeResponse {
/**
* Metadata for messages sent by a Desktop Agent to an App in response to an API call
*/
meta: AddContextListenerResponseMeta;
/**
* A payload for a response to an API call that will contain any return values or an `error`
* property containing a standardized error message indicating that the request was
* unsuccessful.
*/
payload: BroadcastResponseResponsePayload;
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Response' appended.
*/
type: "contextListenerUnsubscribeResponse";
}
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Response' appended.
*/
/**
* Request to return a Channel with an auto-generated identity that is intended for private
* communication between applications.
*
* A request message from an FDC3-enabled app to a Desktop Agent.
*/
export interface CreatePrivateChannelRequest {
/**
* Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent.
*/
meta: AddContextListenerRequestMeta;
/**
* The message payload typically contains the arguments to FDC3 API functions.
*/
payload: CreatePrivateChannelRequestPayload;
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Request' appended.
*/
type: "createPrivateChannelRequest";
}
/**
* The message payload typically contains the arguments to FDC3 API functions.
*/
export interface CreatePrivateChannelRequestPayload {
}
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Request' appended.
*/
/**
* A response to a createPrivateChannel request.
*
* A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the
* payload contains an `error` property, the request was unsuccessful.
*/
export interface CreatePrivateChannelResponse {
/**
* Metadata for messages sent by a Desktop Agent to an App in response to an API call
*/
meta: AddContextListenerResponseMeta;
/**
* A payload for a response to an API call that will contain any return values or an `error`
* property containing a standardized error message indicating that the request was
* unsuccessful.
*/
payload: CreatePrivateChannelResponsePayload;
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Response' appended.
*/
type: "createPrivateChannelResponse";
}
/**
* A payload for a response to an API call that will contain any return values or an `error`
* property containing a standardized error message indicating that the request was
* unsuccessful.
*/
export interface CreatePrivateChannelResponsePayload {
error?: PurpleError;
privateChannel?: Channel;
}
/**
* Represents a context channel that applications can use to send and receive
* context data.
*
* Please note that There are differences in behavior when you interact with a
* User channel via the `DesktopAgent` interface and the `Channel` interface.
* Specifically, when 'joining' a User channel or adding a context listener
* when already joined to a channel via the `DesktopAgent` interface, existing
* context (matching the type of the context listener) on the channel is
* received by the context listener immediately. Whereas, when a context
* listener is added via the Channel interface, context is not received
* automatically, but may be retrieved manually via the `getCurrentContext()`
* function.
*/
export interface Channel {
/**
* Channels may be visualized and selectable by users. DisplayMetadata may be used to
* provide hints on how to see them.
* For App channels, displayMetadata would typically not be present.
*/
displayMetadata?: DisplayMetadata;
/**
* Constant that uniquely identifies this channel.
*/
id: string;
/**
* Uniquely defines each channel type.
* Can be "user", "app" or "private".
*/
type: Type;
}
/**
* Channels may be visualized and selectable by users. DisplayMetadata may be used to
* provide hints on how to see them.
* For App channels, displayMetadata would typically not be present.
*
* A system channel will be global enough to have a presence across many apps. This gives us
* some hints
* to render them in a standard way. It is assumed it may have other properties too, but if
* it has these,
* this is their meaning.
*/
export interface DisplayMetadata {
/**
* The color that should be associated within this channel when displaying this channel in a
* UI, e.g: `0xFF0000`.
*/
color?: string;
/**
* A URL of an image that can be used to display this channel
*/
glyph?: string;
/**
* A user-readable name for this channel, e.g: `"Red"`
*/
name?: string;
}
/**
* Uniquely defines each channel type.
* Can be "user", "app" or "private".
*/
export type Type = "app" | "private" | "user";
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Response' appended.
*/
/**
* A request for details of instances of a particular app.
*
* A request message from an FDC3-enabled app to a Desktop Agent.
*/
export interface FindInstancesRequest {
/**
* Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent.
*/
meta: AddContextListenerRequestMeta;
/**
* The message payload typically contains the arguments to FDC3 API functions.
*/
payload: FindInstancesRequestPayload;
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Request' appended.
*/
type: "findInstancesRequest";
}
/**
* The message payload typically contains the arguments to FDC3 API functions.
*/
export interface FindInstancesRequestPayload {
app: AppIdentifier;
}
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Request' appended.
*/
/**
* A response to a findInstances request.
*
* A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the
* payload contains an `error` property, the request was unsuccessful.
*/
export interface FindInstancesResponse {
/**
* Metadata for messages sent by a Desktop Agent to an App in response to an API call
*/
meta: AddContextListenerResponseMeta;
/**
* A payload for a response to an API call that will contain any return values or an `error`
* property containing a standardized error message indicating that the request was
* unsuccessful.
*/
payload: FindInstancesResponsePayload;
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Response' appended.
*/
type: "findInstancesResponse";
}
/**
* A payload for a response to an API call that will contain any return values or an `error`
* property containing a standardized error message indicating that the request was
* unsuccessful.
*
* The message payload contains a flag indicating whether the API call was successful, plus
* any return values for the FDC3 API function called, or indicating that the request
* resulted in an error and including a standardized error message.
*/
export interface FindInstancesResponsePayload {
error?: FindInstancesErrors;
appIdentifiers?: AppMetadata[];
}
/**
* Extends an `AppIdentifier`, describing an application or instance of an application, with
* additional descriptive metadata that is usually provided by an FDC3 App Directory that
* the desktop agent connects to.
*
* The additional information from an app directory can aid in rendering UI elements, such
* as a launcher menu or resolver UI. This includes a title, description, tooltip and icon
* and screenshot URLs.
*
* Note that as `AppMetadata` instances are also `AppIdentifiers` they may be passed to the
* `app` argument of `fdc3.open`, `fdc3.raiseIntent` etc.
*
* The calling application instance's own metadata, according to the Desktop Agent (MUST
* include at least the `appId` and `instanceId`).
*/
export interface AppMetadata {
/**
* The unique application identifier located within a specific application directory
* instance. An example of an appId might be 'app@sub.root'
*/
appId: string;
/**
* A longer, multi-paragraph description for the application that could include markup
*/
description?: string;
/**
* The Desktop Agent that the app is available on. Used in Desktop Agent Bridging to
* identify the Desktop Agent to target.
*/
desktopAgent?: string;
/**
* A list of icon URLs for the application that can be used to render UI elements
*/
icons?: Icon[];
/**