@openfin/core 33.76.31 → 33.76.38
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/OpenFin.d.ts +1 -1
- package/README.md +29 -4
- package/fin.d.ts +2 -2
- package/{src → out}/GlobalOpenFin.d.ts +1 -1
- package/out/mock-alpha.d.ts +16112 -0
- package/out/mock-beta.d.ts +16112 -0
- package/out/mock-public.d.ts +16112 -0
- package/out/mock.d.ts +16797 -0
- package/out/mock.js +17104 -0
- package/package.json +30 -23
- package/LICENSE +0 -13
- package/NOTICE +0 -16
- package/openfin-core-33.76.31.tgz +0 -0
- package/src/OpenFin.d.ts +0 -3080
- package/src/OpenFin.js +0 -2
- package/src/api/api-exposer/api-consumer.d.ts +0 -28
- package/src/api/api-exposer/api-consumer.js +0 -28
- package/src/api/api-exposer/api-exposer.d.ts +0 -35
- package/src/api/api-exposer/api-exposer.js +0 -38
- package/src/api/api-exposer/decorators.d.ts +0 -10
- package/src/api/api-exposer/decorators.js +0 -18
- package/src/api/api-exposer/index.d.ts +0 -4
- package/src/api/api-exposer/index.js +0 -20
- package/src/api/api-exposer/strategies/index.d.ts +0 -1
- package/src/api/api-exposer/strategies/index.js +0 -17
- package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.d.ts +0 -14
- package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.js +0 -20
- package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.d.ts +0 -20
- package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.js +0 -23
- package/src/api/api-exposer/strategies/openfin-channels/index.d.ts +0 -2
- package/src/api/api-exposer/strategies/openfin-channels/index.js +0 -18
- package/src/api/application/Factory.d.ts +0 -148
- package/src/api/application/Factory.js +0 -230
- package/src/api/application/Instance.d.ts +0 -321
- package/src/api/application/Instance.js +0 -453
- package/src/api/application/index.d.ts +0 -3
- package/src/api/application/index.js +0 -19
- package/src/api/base.d.ts +0 -48
- package/src/api/base.js +0 -177
- package/src/api/clipboard/index.d.ts +0 -92
- package/src/api/clipboard/index.js +0 -120
- package/src/api/events/application.d.ts +0 -146
- package/src/api/events/application.js +0 -2
- package/src/api/events/base.d.ts +0 -42
- package/src/api/events/base.js +0 -2
- package/src/api/events/channel.d.ts +0 -30
- package/src/api/events/channel.js +0 -2
- package/src/api/events/emitterMap.d.ts +0 -11
- package/src/api/events/emitterMap.js +0 -35
- package/src/api/events/eventAggregator.d.ts +0 -5
- package/src/api/events/eventAggregator.js +0 -35
- package/src/api/events/externalApplication.d.ts +0 -19
- package/src/api/events/externalApplication.js +0 -2
- package/src/api/events/frame.d.ts +0 -30
- package/src/api/events/frame.js +0 -2
- package/src/api/events/globalHotkey.d.ts +0 -20
- package/src/api/events/globalHotkey.js +0 -2
- package/src/api/events/platform.d.ts +0 -26
- package/src/api/events/platform.js +0 -2
- package/src/api/events/system.d.ts +0 -113
- package/src/api/events/system.js +0 -2
- package/src/api/events/typedEventEmitter.d.ts +0 -20
- package/src/api/events/typedEventEmitter.js +0 -2
- package/src/api/events/view.d.ts +0 -82
- package/src/api/events/view.js +0 -2
- package/src/api/events/webcontents.d.ts +0 -266
- package/src/api/events/webcontents.js +0 -2
- package/src/api/events/window.d.ts +0 -352
- package/src/api/events/window.js +0 -2
- package/src/api/external-application/Factory.d.ts +0 -27
- package/src/api/external-application/Factory.js +0 -40
- package/src/api/external-application/Instance.d.ts +0 -102
- package/src/api/external-application/Instance.js +0 -109
- package/src/api/external-application/index.d.ts +0 -3
- package/src/api/external-application/index.js +0 -19
- package/src/api/fin.d.ts +0 -51
- package/src/api/fin.js +0 -42
- package/src/api/frame/Factory.d.ts +0 -37
- package/src/api/frame/Factory.js +0 -69
- package/src/api/frame/Instance.d.ts +0 -123
- package/src/api/frame/Instance.js +0 -130
- package/src/api/frame/index.d.ts +0 -3
- package/src/api/frame/index.js +0 -19
- package/src/api/global-hotkey/index.d.ts +0 -38
- package/src/api/global-hotkey/index.js +0 -64
- package/src/api/interappbus/channel/channel.d.ts +0 -28
- package/src/api/interappbus/channel/channel.js +0 -77
- package/src/api/interappbus/channel/channels-docs.d.ts +0 -340
- package/src/api/interappbus/channel/channels-docs.js +0 -398
- package/src/api/interappbus/channel/client.d.ts +0 -24
- package/src/api/interappbus/channel/client.js +0 -89
- package/src/api/interappbus/channel/connection-manager.d.ts +0 -29
- package/src/api/interappbus/channel/connection-manager.js +0 -246
- package/src/api/interappbus/channel/index.d.ts +0 -25
- package/src/api/interappbus/channel/index.js +0 -169
- package/src/api/interappbus/channel/protocols/classic/message-receiver.d.ts +0 -13
- package/src/api/interappbus/channel/protocols/classic/message-receiver.js +0 -73
- package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +0 -24
- package/src/api/interappbus/channel/protocols/classic/strategy.js +0 -101
- package/src/api/interappbus/channel/protocols/combined/strategy.d.ts +0 -20
- package/src/api/interappbus/channel/protocols/combined/strategy.js +0 -58
- package/src/api/interappbus/channel/protocols/index.d.ts +0 -47
- package/src/api/interappbus/channel/protocols/index.js +0 -2
- package/src/api/interappbus/channel/protocols/protocol-manager.d.ts +0 -10
- package/src/api/interappbus/channel/protocols/protocol-manager.js +0 -43
- package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +0 -25
- package/src/api/interappbus/channel/protocols/rtc/endpoint.js +0 -141
- package/src/api/interappbus/channel/protocols/rtc/ice-manager.d.ts +0 -30
- package/src/api/interappbus/channel/protocols/rtc/ice-manager.js +0 -130
- package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +0 -24
- package/src/api/interappbus/channel/protocols/rtc/strategy.js +0 -85
- package/src/api/interappbus/channel/protocols/strategy-types.d.ts +0 -13
- package/src/api/interappbus/channel/protocols/strategy-types.js +0 -2
- package/src/api/interappbus/channel/protocols/strategy.d.ts +0 -17
- package/src/api/interappbus/channel/protocols/strategy.js +0 -2
- package/src/api/interappbus/channel/provider.d.ts +0 -34
- package/src/api/interappbus/channel/provider.js +0 -166
- package/src/api/interappbus/index.d.ts +0 -85
- package/src/api/interappbus/index.js +0 -175
- package/src/api/interop/Factory.d.ts +0 -37
- package/src/api/interop/Factory.js +0 -76
- package/src/api/interop/InteropBroker.d.ts +0 -437
- package/src/api/interop/InteropBroker.js +0 -1085
- package/src/api/interop/InteropClient.d.ts +0 -278
- package/src/api/interop/InteropClient.js +0 -459
- package/src/api/interop/SessionContextGroupBroker.d.ts +0 -27
- package/src/api/interop/SessionContextGroupBroker.js +0 -108
- package/src/api/interop/SessionContextGroupClient.d.ts +0 -21
- package/src/api/interop/SessionContextGroupClient.js +0 -86
- package/src/api/interop/fdc3/PrivateChannelClient.d.ts +0 -20
- package/src/api/interop/fdc3/PrivateChannelClient.js +0 -90
- package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +0 -55
- package/src/api/interop/fdc3/PrivateChannelProvider.js +0 -276
- package/src/api/interop/fdc3/fdc3-1.2.d.ts +0 -208
- package/src/api/interop/fdc3/fdc3-1.2.js +0 -438
- package/src/api/interop/fdc3/fdc3-2.0.d.ts +0 -301
- package/src/api/interop/fdc3/fdc3-2.0.js +0 -482
- package/src/api/interop/fdc3/fdc3.d.ts +0 -12
- package/src/api/interop/fdc3/fdc3.js +0 -35
- package/src/api/interop/fdc3/overrideCheck.d.ts +0 -4
- package/src/api/interop/fdc3/overrideCheck.js +0 -32
- package/src/api/interop/fdc3/shapes/fdc3v1.d.ts +0 -53
- package/src/api/interop/fdc3/shapes/fdc3v1.js +0 -4
- package/src/api/interop/fdc3/shapes/fdc3v2.d.ts +0 -75
- package/src/api/interop/fdc3/shapes/fdc3v2.js +0 -2
- package/src/api/interop/fdc3/utils.d.ts +0 -45
- package/src/api/interop/fdc3/utils.js +0 -239
- package/src/api/interop/fdc3/versions.d.ts +0 -1
- package/src/api/interop/fdc3/versions.js +0 -2
- package/src/api/interop/index.d.ts +0 -4
- package/src/api/interop/index.js +0 -20
- package/src/api/interop/utils.d.ts +0 -18
- package/src/api/interop/utils.js +0 -61
- package/src/api/me.d.ts +0 -40
- package/src/api/me.js +0 -134
- package/src/api/platform/Factory.d.ts +0 -115
- package/src/api/platform/Factory.js +0 -184
- package/src/api/platform/Instance.d.ts +0 -150
- package/src/api/platform/Instance.js +0 -332
- package/src/api/platform/common-utils.d.ts +0 -7
- package/src/api/platform/common-utils.js +0 -16
- package/src/api/platform/index.d.ts +0 -3
- package/src/api/platform/index.js +0 -19
- package/src/api/platform/layout/Factory.d.ts +0 -114
- package/src/api/platform/layout/Factory.js +0 -174
- package/src/api/platform/layout/Instance.d.ts +0 -57
- package/src/api/platform/layout/Instance.js +0 -126
- package/src/api/platform/layout/controllers/layout-content-cache.d.ts +0 -9
- package/src/api/platform/layout/controllers/layout-content-cache.js +0 -54
- package/src/api/platform/layout/controllers/layout-entities-controller.d.ts +0 -119
- package/src/api/platform/layout/controllers/layout-entities-controller.js +0 -287
- package/src/api/platform/layout/entities/layout-entities.d.ts +0 -235
- package/src/api/platform/layout/entities/layout-entities.js +0 -312
- package/src/api/platform/layout/entities/shapes.d.ts +0 -6
- package/src/api/platform/layout/entities/shapes.js +0 -2
- package/src/api/platform/layout/index.d.ts +0 -2
- package/src/api/platform/layout/index.js +0 -18
- package/src/api/platform/layout/layout.constants.d.ts +0 -1
- package/src/api/platform/layout/layout.constants.js +0 -4
- package/src/api/platform/layout/shapes.d.ts +0 -16
- package/src/api/platform/layout/shapes.js +0 -2
- package/src/api/platform/layout/utils/layout-traversal.d.ts +0 -4
- package/src/api/platform/layout/utils/layout-traversal.js +0 -65
- package/src/api/platform/provider.d.ts +0 -163
- package/src/api/platform/provider.js +0 -2
- package/src/api/snapshot-source/Factory.d.ts +0 -38
- package/src/api/snapshot-source/Factory.js +0 -66
- package/src/api/snapshot-source/Instance.d.ts +0 -31
- package/src/api/snapshot-source/Instance.js +0 -132
- package/src/api/snapshot-source/index.d.ts +0 -3
- package/src/api/snapshot-source/index.js +0 -19
- package/src/api/snapshot-source/utils.d.ts +0 -2
- package/src/api/snapshot-source/utils.js +0 -6
- package/src/api/system/index.d.ts +0 -517
- package/src/api/system/index.js +0 -895
- package/src/api/view/Factory.d.ts +0 -50
- package/src/api/view/Factory.js +0 -103
- package/src/api/view/Instance.d.ts +0 -487
- package/src/api/view/Instance.js +0 -557
- package/src/api/view/index.d.ts +0 -3
- package/src/api/view/index.js +0 -19
- package/src/api/webcontents/main.d.ts +0 -32
- package/src/api/webcontents/main.js +0 -156
- package/src/api/window/Factory.d.ts +0 -45
- package/src/api/window/Factory.js +0 -91
- package/src/api/window/Instance.d.ts +0 -1090
- package/src/api/window/Instance.js +0 -1349
- package/src/api/window/index.d.ts +0 -3
- package/src/api/window/index.js +0 -19
- package/src/browser.d.ts +0 -10
- package/src/browser.js +0 -36
- package/src/environment/browser.d.ts +0 -29
- package/src/environment/browser.js +0 -60
- package/src/environment/environment.d.ts +0 -33
- package/src/environment/environment.js +0 -4
- package/src/environment/mockEnvironment.d.ts +0 -27
- package/src/environment/mockEnvironment.js +0 -61
- package/src/environment/node-env.d.ts +0 -29
- package/src/environment/node-env.js +0 -72
- package/src/fdc3.d.ts +0 -3
- package/src/fdc3.js +0 -9
- package/src/mock.d.ts +0 -3
- package/src/mock.js +0 -18
- package/src/namespaces.d.ts +0 -21
- package/src/namespaces.js +0 -24
- package/src/shapes/ERROR_BOX_TYPES.d.ts +0 -1
- package/src/shapes/ERROR_BOX_TYPES.js +0 -2
- package/src/shapes/WebOptions.d.ts +0 -13
- package/src/shapes/WebOptions.js +0 -2
- package/src/shapes/WindowOptions.d.ts +0 -43
- package/src/shapes/WindowOptions.js +0 -2
- package/src/shapes/protocol.d.ts +0 -200
- package/src/shapes/protocol.js +0 -2
- package/src/transport/mockWire.d.ts +0 -11
- package/src/transport/mockWire.js +0 -26
- package/src/transport/transport-errors.d.ts +0 -31
- package/src/transport/transport-errors.js +0 -79
- package/src/transport/transport.d.ts +0 -73
- package/src/transport/transport.js +0 -219
- package/src/transport/wire.d.ts +0 -77
- package/src/transport/wire.js +0 -36
- package/src/util/asyncFilter.d.ts +0 -1
- package/src/util/asyncFilter.js +0 -7
- package/src/util/channel-api-relay.d.ts +0 -13
- package/src/util/channel-api-relay.js +0 -47
- package/src/util/errors.d.ts +0 -10
- package/src/util/errors.js +0 -12
- package/src/util/exhaustive.d.ts +0 -1
- package/src/util/exhaustive.js +0 -7
- package/src/util/http.d.ts +0 -11
- package/src/util/http.js +0 -90
- package/src/util/inaccessibleObject.d.ts +0 -2
- package/src/util/inaccessibleObject.js +0 -49
- package/src/util/lazy.d.ts +0 -34
- package/src/util/lazy.js +0 -54
- package/src/util/normalize-config.d.ts +0 -3
- package/src/util/normalize-config.js +0 -52
- package/src/util/promises.d.ts +0 -5
- package/src/util/promises.js +0 -27
- package/src/util/ref-counter.d.ts +0 -7
- package/src/util/ref-counter.js +0 -52
- package/src/util/reversible-map.d.ts +0 -11
- package/src/util/reversible-map.js +0 -49
- package/src/util/runtimeVersioning.d.ts +0 -3
- package/src/util/runtimeVersioning.js +0 -25
- package/src/util/utilTypes.d.ts +0 -8
- package/src/util/utilTypes.js +0 -2
- package/src/util/validate.d.ts +0 -3
- package/src/util/validate.js +0 -11
package/src/shapes/protocol.d.ts
DELETED
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import type * as OpenFin from '../OpenFin';
|
|
2
|
-
import { AuthorizationPayload } from '../transport/transport';
|
|
3
|
-
export interface ProtocolMap extends ProtocolMapBase {
|
|
4
|
-
'request-external-authorization': {
|
|
5
|
-
request: any;
|
|
6
|
-
response: void;
|
|
7
|
-
specialResponse: AuthorizationPayload;
|
|
8
|
-
};
|
|
9
|
-
'application-get-views': {
|
|
10
|
-
request: OpenFin.ApplicationIdentity;
|
|
11
|
-
response: OpenFin.Identity[];
|
|
12
|
-
};
|
|
13
|
-
'set-jump-list': {
|
|
14
|
-
request: {
|
|
15
|
-
config: OpenFin.JumpListCategory[] | null;
|
|
16
|
-
} & OpenFin.ApplicationIdentity;
|
|
17
|
-
response: void;
|
|
18
|
-
};
|
|
19
|
-
'clipboard-read-formats': {
|
|
20
|
-
request: {
|
|
21
|
-
type?: OpenFin.ClipboardSelectionType;
|
|
22
|
-
};
|
|
23
|
-
response: Array<string>;
|
|
24
|
-
};
|
|
25
|
-
'clipboard-read-image': {
|
|
26
|
-
request: OpenFin.ReadImageClipboardRequest;
|
|
27
|
-
response: string;
|
|
28
|
-
};
|
|
29
|
-
'clipboard-write-image': {
|
|
30
|
-
request: OpenFin.WriteImageClipboardRequest;
|
|
31
|
-
response: void;
|
|
32
|
-
};
|
|
33
|
-
'clipboard-write': {
|
|
34
|
-
request: OpenFin.WriteAnyRequestType;
|
|
35
|
-
response: void;
|
|
36
|
-
};
|
|
37
|
-
'get-view-window': IdentityCall<{}, OpenFin.Identity>;
|
|
38
|
-
'create-view': IdentityCall<OpenFin.ViewCreationOptions & {
|
|
39
|
-
uuid: string;
|
|
40
|
-
}>;
|
|
41
|
-
'destroy-view': IdentityCall;
|
|
42
|
-
'attach-view': IdentityCall<{
|
|
43
|
-
target: OpenFin.Identity;
|
|
44
|
-
}>;
|
|
45
|
-
'set-view-bounds': IdentityCall<{
|
|
46
|
-
bounds: OpenFin.Bounds;
|
|
47
|
-
}>;
|
|
48
|
-
'get-view-bounds': IdentityCall<{}, OpenFin.Bounds>;
|
|
49
|
-
'get-view-info': IdentityCall<{}, OpenFin.ViewInfo>;
|
|
50
|
-
'get-view-options': IdentityCall<{}, OpenFin.ViewOptions>;
|
|
51
|
-
'hide-view': IdentityCall;
|
|
52
|
-
'show-view': IdentityCall;
|
|
53
|
-
'update-view-options': IdentityCall<{
|
|
54
|
-
options: OpenFin.UpdatableViewOptions;
|
|
55
|
-
}>;
|
|
56
|
-
'trigger-before-unload': IdentityCall<{}, boolean>;
|
|
57
|
-
'window-get-views': IdentityCall<{}, OpenFin.Identity[]>;
|
|
58
|
-
'print': {
|
|
59
|
-
request: OpenFin.Identity & {
|
|
60
|
-
options: OpenFin.PrintOptions;
|
|
61
|
-
};
|
|
62
|
-
response: void;
|
|
63
|
-
};
|
|
64
|
-
'print-screenshot': {
|
|
65
|
-
request: OpenFin.Identity;
|
|
66
|
-
response: void;
|
|
67
|
-
};
|
|
68
|
-
'print-views': {
|
|
69
|
-
request: OpenFin.Identity & {
|
|
70
|
-
options: OpenFin.WindowViewsPrintOptions;
|
|
71
|
-
};
|
|
72
|
-
response: void;
|
|
73
|
-
};
|
|
74
|
-
'launch-manifest': {
|
|
75
|
-
request: {
|
|
76
|
-
manifestUrl: string;
|
|
77
|
-
opts?: Omit<OpenFin.RvmLaunchOptions, 'subscribe'> & {
|
|
78
|
-
appVersionId?: string;
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
response: {
|
|
82
|
-
manifest: OpenFin.Manifest;
|
|
83
|
-
};
|
|
84
|
-
};
|
|
85
|
-
'get-system-app-configuration': {
|
|
86
|
-
request: {
|
|
87
|
-
name: string;
|
|
88
|
-
};
|
|
89
|
-
response: any;
|
|
90
|
-
};
|
|
91
|
-
'show-popup-menu': {
|
|
92
|
-
request: OpenFin.Identity & {
|
|
93
|
-
options: OpenFin.ShowPopupMenuOptions;
|
|
94
|
-
};
|
|
95
|
-
response: OpenFin.MenuResult;
|
|
96
|
-
};
|
|
97
|
-
'enable-native-window-integration-provider': {
|
|
98
|
-
request: {
|
|
99
|
-
permissions: any;
|
|
100
|
-
};
|
|
101
|
-
response: OpenFin.NativeWindowIntegrationProviderAuthorization;
|
|
102
|
-
};
|
|
103
|
-
'get-permissions': GetterCall<any>;
|
|
104
|
-
'get-all-channels': GetterCall<OpenFin.ProviderIdentity[]>;
|
|
105
|
-
'set-file-download-location': {
|
|
106
|
-
request: OpenFin.Identity & {
|
|
107
|
-
downloadLocation: string;
|
|
108
|
-
};
|
|
109
|
-
response: void;
|
|
110
|
-
};
|
|
111
|
-
'get-file-download-location': {
|
|
112
|
-
request: OpenFin.ApplicationIdentity;
|
|
113
|
-
response: string;
|
|
114
|
-
};
|
|
115
|
-
'close-popup-menu': IdentityCall;
|
|
116
|
-
'fdc3-add-context-listener': VoidCall;
|
|
117
|
-
'fdc3-broadcast': VoidCall;
|
|
118
|
-
'fdc3-get-system-channels': VoidCall;
|
|
119
|
-
'fdc3-join-channel': VoidCall;
|
|
120
|
-
'fdc3-leave-current-channel': VoidCall;
|
|
121
|
-
'interop-connect-sync': VoidCall;
|
|
122
|
-
'interop-client-set-context': VoidCall;
|
|
123
|
-
'interop-client-add-context-handler': VoidCall;
|
|
124
|
-
'interop-client-get-context-groups': VoidCall;
|
|
125
|
-
'interop-client-join-context-group': VoidCall;
|
|
126
|
-
'interop-client-remove-from-context-group': VoidCall;
|
|
127
|
-
'interop-client-get-all-clients-in-context-group': VoidCall;
|
|
128
|
-
'interop-client-get-info-for-context-group': VoidCall;
|
|
129
|
-
'interop-broker-add-client-to-context-group': VoidCall;
|
|
130
|
-
'interop-broker-get-all-clients-in-context-group': VoidCall;
|
|
131
|
-
'interop-broker-get-context-groups': VoidCall;
|
|
132
|
-
'interop-broker-get-info-for-context-group': VoidCall;
|
|
133
|
-
'interop-broker-is-action-authorized': VoidCall;
|
|
134
|
-
'interop-broker-is-connection-authorized': VoidCall;
|
|
135
|
-
'interop-broker-join-context-group': VoidCall;
|
|
136
|
-
'interop-broker-remove-client-from-context-group': VoidCall;
|
|
137
|
-
'interop-broker-remove-from-context-group': VoidCall;
|
|
138
|
-
'interop-broker-set-context': VoidCall;
|
|
139
|
-
'query-permission-for-current-context': {
|
|
140
|
-
request: {
|
|
141
|
-
apiName: string;
|
|
142
|
-
identity: OpenFin.Identity;
|
|
143
|
-
};
|
|
144
|
-
response: OpenFin.QueryPermissionResult;
|
|
145
|
-
};
|
|
146
|
-
'try-create-popup-window': {
|
|
147
|
-
request: OpenFin.Identity & {
|
|
148
|
-
options: OpenFin.PopupOptions;
|
|
149
|
-
};
|
|
150
|
-
response: {
|
|
151
|
-
willOpen: boolean;
|
|
152
|
-
options: OpenFin.PopupOptions;
|
|
153
|
-
};
|
|
154
|
-
};
|
|
155
|
-
'show-popup-window': {
|
|
156
|
-
request: OpenFin.Identity & {
|
|
157
|
-
options: OpenFin.PopupOptions;
|
|
158
|
-
};
|
|
159
|
-
response: OpenFin.PopupResult;
|
|
160
|
-
};
|
|
161
|
-
'dispatch-popup-result': IdentityCall<{
|
|
162
|
-
data: any;
|
|
163
|
-
}>;
|
|
164
|
-
'render-overlay': {
|
|
165
|
-
request: {
|
|
166
|
-
bounds: OpenFin.Bounds;
|
|
167
|
-
};
|
|
168
|
-
response: void;
|
|
169
|
-
};
|
|
170
|
-
'set-overlay-style': {
|
|
171
|
-
request: {
|
|
172
|
-
style: Partial<CSSStyleDeclaration>;
|
|
173
|
-
};
|
|
174
|
-
response: void;
|
|
175
|
-
};
|
|
176
|
-
'detach-overlay': VoidCall;
|
|
177
|
-
'set-ignore-all-view-mouse-events': {
|
|
178
|
-
request: {
|
|
179
|
-
enabled: boolean;
|
|
180
|
-
};
|
|
181
|
-
response: void;
|
|
182
|
-
};
|
|
183
|
-
'system-get-printers': GetterCall<OpenFin.PrinterInfo[]>;
|
|
184
|
-
'system-register-shutdown-handler': VoidCall;
|
|
185
|
-
}
|
|
186
|
-
type ApiCall<Request, Response> = {
|
|
187
|
-
request: Request;
|
|
188
|
-
response: Response;
|
|
189
|
-
};
|
|
190
|
-
type VoidCall = ApiCall<void, void>;
|
|
191
|
-
type GetterCall<T> = ApiCall<void, T>;
|
|
192
|
-
type IdentityCall<AdditionalPayload = {}, Response = void> = ApiCall<AdditionalPayload & OpenFin.Identity, Response>;
|
|
193
|
-
interface ProtocolMapBase {
|
|
194
|
-
[action: string]: {
|
|
195
|
-
request: any;
|
|
196
|
-
response: any;
|
|
197
|
-
specialResponse?: any;
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
export {};
|
package/src/shapes/protocol.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { EventEmitter } from 'events';
|
|
3
|
-
import { Wire } from './wire';
|
|
4
|
-
export declare class MockWire extends EventEmitter implements Wire {
|
|
5
|
-
connect(address: string): Promise<any>;
|
|
6
|
-
connectSync(): any;
|
|
7
|
-
send(data: any): Promise<any>;
|
|
8
|
-
shutdown(): Promise<void>;
|
|
9
|
-
getPort(): string;
|
|
10
|
-
constructor();
|
|
11
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MockWire = void 0;
|
|
4
|
-
const events_1 = require("events");
|
|
5
|
-
class MockWire extends events_1.EventEmitter {
|
|
6
|
-
connect(address) {
|
|
7
|
-
throw new Error('You are not running in OpenFin.');
|
|
8
|
-
}
|
|
9
|
-
connectSync() {
|
|
10
|
-
throw new Error('You are not running in OpenFin.');
|
|
11
|
-
}
|
|
12
|
-
send(data) {
|
|
13
|
-
throw new Error('You are not running in OpenFin.');
|
|
14
|
-
}
|
|
15
|
-
shutdown() {
|
|
16
|
-
throw new Error('You are not running in OpenFin.');
|
|
17
|
-
}
|
|
18
|
-
getPort() {
|
|
19
|
-
throw new Error('This transport has no port');
|
|
20
|
-
}
|
|
21
|
-
// eslint-disable-next-line no-useless-constructor
|
|
22
|
-
constructor() {
|
|
23
|
-
super();
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
exports.MockWire = MockWire;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { ErrorPlainObject } from '../util/errors';
|
|
3
|
-
export type ReadyState = 'CONNECTING' | 'OPEN' | 'CLOSING' | 'CLOSED';
|
|
4
|
-
export declare class DisconnectedError extends Error {
|
|
5
|
-
constructor(readyState: ReadyState);
|
|
6
|
-
readyState: ReadyState;
|
|
7
|
-
}
|
|
8
|
-
export declare class UnexpectedActionError extends Error {
|
|
9
|
-
}
|
|
10
|
-
export declare class DuplicateCorrelationError extends Error {
|
|
11
|
-
}
|
|
12
|
-
export declare class NoAckError extends Error {
|
|
13
|
-
}
|
|
14
|
-
export declare class NotImplementedError extends Error {
|
|
15
|
-
}
|
|
16
|
-
export declare class NotSupportedError extends Error {
|
|
17
|
-
}
|
|
18
|
-
export type RuntimeErrorPayload = {
|
|
19
|
-
reason: string;
|
|
20
|
-
error?: ErrorPlainObject;
|
|
21
|
-
};
|
|
22
|
-
declare class InternalError<T extends ErrorPlainObject = ErrorPlainObject> extends Error {
|
|
23
|
-
constructor(err: T);
|
|
24
|
-
}
|
|
25
|
-
export declare class RuntimeError extends Error {
|
|
26
|
-
cause?: InternalError;
|
|
27
|
-
static getCallSite(callsToRemove?: number): NodeJS.CallSite[];
|
|
28
|
-
static prepareStackTrace(err: Error, callSites: NodeJS.CallSite[]): string;
|
|
29
|
-
constructor(payload: RuntimeErrorPayload, callSites?: NodeJS.CallSite[]);
|
|
30
|
-
}
|
|
31
|
-
export {};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RuntimeError = exports.NotSupportedError = exports.NotImplementedError = exports.NoAckError = exports.DuplicateCorrelationError = exports.UnexpectedActionError = exports.DisconnectedError = void 0;
|
|
4
|
-
class DisconnectedError extends Error {
|
|
5
|
-
constructor(readyState) {
|
|
6
|
-
super(`Expected websocket state OPEN but found ${readyState}`);
|
|
7
|
-
this.readyState = readyState;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.DisconnectedError = DisconnectedError;
|
|
11
|
-
class UnexpectedActionError extends Error {
|
|
12
|
-
}
|
|
13
|
-
exports.UnexpectedActionError = UnexpectedActionError;
|
|
14
|
-
class DuplicateCorrelationError extends Error {
|
|
15
|
-
}
|
|
16
|
-
exports.DuplicateCorrelationError = DuplicateCorrelationError;
|
|
17
|
-
class NoAckError extends Error {
|
|
18
|
-
}
|
|
19
|
-
exports.NoAckError = NoAckError;
|
|
20
|
-
class NotImplementedError extends Error {
|
|
21
|
-
}
|
|
22
|
-
exports.NotImplementedError = NotImplementedError;
|
|
23
|
-
class NotSupportedError extends Error {
|
|
24
|
-
}
|
|
25
|
-
exports.NotSupportedError = NotSupportedError;
|
|
26
|
-
class InternalError extends Error {
|
|
27
|
-
constructor(err) {
|
|
28
|
-
const { message, name, stack, ...rest } = err;
|
|
29
|
-
super(message);
|
|
30
|
-
this.name = name || 'Error';
|
|
31
|
-
this.stack = stack !== null && stack !== void 0 ? stack : this.toString();
|
|
32
|
-
Object.keys(rest).forEach(key => {
|
|
33
|
-
this[key] = rest[key];
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
// For documentation of the error methods being used see here: https://v8.dev/docs/stack-trace-api
|
|
38
|
-
class RuntimeError extends Error {
|
|
39
|
-
static getCallSite(callsToRemove = 0) {
|
|
40
|
-
var _a, _b;
|
|
41
|
-
const length = Error.stackTraceLimit;
|
|
42
|
-
const realCallsToRemove = callsToRemove + 1; // remove this call;
|
|
43
|
-
Error.stackTraceLimit = length + realCallsToRemove;
|
|
44
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
45
|
-
const _prepareStackTrace = Error.prepareStackTrace;
|
|
46
|
-
// This will be called when we access the `stack` property
|
|
47
|
-
Error.prepareStackTrace = (_, stack) => stack;
|
|
48
|
-
// stack is optional in non chromium contexts
|
|
49
|
-
const stack = (_b = (_a = new Error().stack) === null || _a === void 0 ? void 0 : _a.slice(realCallsToRemove)) !== null && _b !== void 0 ? _b : [];
|
|
50
|
-
Error.prepareStackTrace = _prepareStackTrace;
|
|
51
|
-
Error.stackTraceLimit = length;
|
|
52
|
-
return stack;
|
|
53
|
-
}
|
|
54
|
-
static prepareStackTrace(err, callSites) {
|
|
55
|
-
if (typeof Error.prepareStackTrace === 'function') {
|
|
56
|
-
return Error.prepareStackTrace(err, callSites);
|
|
57
|
-
}
|
|
58
|
-
let string = "";
|
|
59
|
-
string += err.name || "Error";
|
|
60
|
-
string += `: ${err.message || ""}`;
|
|
61
|
-
for (const callSite of callSites) {
|
|
62
|
-
string += `\n at ${callSite.toString()}`;
|
|
63
|
-
}
|
|
64
|
-
return string;
|
|
65
|
-
}
|
|
66
|
-
;
|
|
67
|
-
constructor(payload, callSites) {
|
|
68
|
-
const { reason, error } = payload;
|
|
69
|
-
super(reason);
|
|
70
|
-
this.name = 'RuntimeError';
|
|
71
|
-
if (error === null || error === void 0 ? void 0 : error.stack) {
|
|
72
|
-
this.cause = new InternalError(error);
|
|
73
|
-
}
|
|
74
|
-
if (callSites) {
|
|
75
|
-
this.stack = RuntimeError.prepareStackTrace(this, callSites);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
exports.RuntimeError = RuntimeError;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import { EventEmitter } from 'events';
|
|
4
|
-
import type * as OpenFin from '../OpenFin';
|
|
5
|
-
import { ExistingConnectConfig, InternalConnectConfig, RemoteConfig, Wire, WireConstructor } from './wire';
|
|
6
|
-
import { Environment } from '../environment/environment';
|
|
7
|
-
import { RuntimeErrorPayload } from './transport-errors';
|
|
8
|
-
import EventAggregator from '../api/events/eventAggregator';
|
|
9
|
-
import { EntityTypeHelpers } from '../api/me';
|
|
10
|
-
import { ProtocolMap } from '../shapes/protocol';
|
|
11
|
-
import { NamedEvent } from '../api/events/base';
|
|
12
|
-
import { ErrorPlainObject } from '../util/errors';
|
|
13
|
-
type EntityType = OpenFin.EntityType;
|
|
14
|
-
type SendActionResponse<T extends keyof ProtocolMap> = Message<{
|
|
15
|
-
data: ProtocolMap[T]['response'];
|
|
16
|
-
} & ProtocolMap[T]['specialResponse']>;
|
|
17
|
-
export type MessageHandler = (data: any) => boolean;
|
|
18
|
-
export type SentMessage<Value> = Promise<Value> & {
|
|
19
|
-
cancel: (reason?: any) => void;
|
|
20
|
-
messageId: ReturnType<Environment['getNextMessageId']>;
|
|
21
|
-
};
|
|
22
|
-
type NackHandler = (payloadOrMessage: RuntimeErrorPayload | string) => void;
|
|
23
|
-
export declare class Transport<MeType extends EntityType = EntityType> extends EventEmitter {
|
|
24
|
-
#private;
|
|
25
|
-
protected wireListeners: Map<number, {
|
|
26
|
-
resolve: Function;
|
|
27
|
-
handleNack: (payload: RuntimeErrorPayload) => void;
|
|
28
|
-
}>;
|
|
29
|
-
protected uncorrelatedListener: Function;
|
|
30
|
-
me: OpenFin.EntityInfo & EntityTypeHelpers<MeType>;
|
|
31
|
-
environment: Environment;
|
|
32
|
-
topicRefMap: Map<string, number>;
|
|
33
|
-
sendRaw: Wire['send'];
|
|
34
|
-
eventAggregator: EventAggregator;
|
|
35
|
-
protected messageHandlers: MessageHandler[];
|
|
36
|
-
constructor(WireType: WireConstructor, environment: Environment, config: OpenFin.Identity);
|
|
37
|
-
getFin(): OpenFin.Fin<MeType>;
|
|
38
|
-
registerFin(_fin: OpenFin.Fin<MeType>): void;
|
|
39
|
-
connectSync: () => void;
|
|
40
|
-
getPort: () => string;
|
|
41
|
-
shutdown(): Promise<void>;
|
|
42
|
-
connect(config: InternalConnectConfig | RemoteConfig): Promise<string | void>;
|
|
43
|
-
private connectRemote;
|
|
44
|
-
connectByPort(config: ExistingConnectConfig): Promise<void>;
|
|
45
|
-
private authorize;
|
|
46
|
-
sendAction<T extends keyof ProtocolMap = string>(action: T, payload?: ProtocolMap[T]['request'], uncorrelated?: boolean): SentMessage<SendActionResponse<T>>;
|
|
47
|
-
protected nackHandler(payloadOrMessage: RuntimeErrorPayload | string, reject: Function, callSites?: NodeJS.CallSite[]): void;
|
|
48
|
-
ferryAction(origData: any): Promise<Message<any>>;
|
|
49
|
-
registerMessageHandler(handler: MessageHandler): void;
|
|
50
|
-
protected addWireListener(id: number, resolve: Function, handleNack: NackHandler, uncorrelated: boolean): void;
|
|
51
|
-
protected onmessage(data: Message<Payload>): void;
|
|
52
|
-
protected handleMessage(data: Message<Payload>): boolean;
|
|
53
|
-
}
|
|
54
|
-
export interface Message<T> {
|
|
55
|
-
action: string;
|
|
56
|
-
payload: T;
|
|
57
|
-
correlationId?: number;
|
|
58
|
-
}
|
|
59
|
-
export interface EventMessage extends Message<NamedEvent> {
|
|
60
|
-
action: 'process-desktop-event';
|
|
61
|
-
payload: NamedEvent;
|
|
62
|
-
}
|
|
63
|
-
export type Payload<Success extends boolean = boolean, Data = any> = {
|
|
64
|
-
success: Success;
|
|
65
|
-
data: Success extends true ? Data : never;
|
|
66
|
-
reason: Success extends false ? string : never;
|
|
67
|
-
error?: Success extends false ? ErrorPlainObject | undefined : never;
|
|
68
|
-
};
|
|
69
|
-
export interface AuthorizationPayload {
|
|
70
|
-
token: string;
|
|
71
|
-
file: string;
|
|
72
|
-
}
|
|
73
|
-
export {};
|
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
-
};
|
|
8
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
-
};
|
|
13
|
-
var _Transport_wire, _Transport_fin;
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.Transport = void 0;
|
|
16
|
-
const events_1 = require("events");
|
|
17
|
-
const wire_1 = require("./wire");
|
|
18
|
-
const transport_errors_1 = require("./transport-errors");
|
|
19
|
-
const eventAggregator_1 = require("../api/events/eventAggregator");
|
|
20
|
-
const me_1 = require("../api/me");
|
|
21
|
-
const errors_1 = require("../util/errors");
|
|
22
|
-
class Transport extends events_1.EventEmitter {
|
|
23
|
-
constructor(WireType, environment, config) {
|
|
24
|
-
super();
|
|
25
|
-
this.wireListeners = new Map();
|
|
26
|
-
this.topicRefMap = new Map();
|
|
27
|
-
this.eventAggregator = new eventAggregator_1.default();
|
|
28
|
-
this.messageHandlers = [this.eventAggregator.dispatchEvent];
|
|
29
|
-
_Transport_wire.set(this, void 0);
|
|
30
|
-
// Typing as unknown to avoid circular dependency, should not be used directly.
|
|
31
|
-
_Transport_fin.set(this, void 0);
|
|
32
|
-
this.connectSync = () => {
|
|
33
|
-
const wire = __classPrivateFieldGet(this, _Transport_wire, "f");
|
|
34
|
-
wire.connectSync();
|
|
35
|
-
};
|
|
36
|
-
// This function is only used in our tests.
|
|
37
|
-
this.getPort = () => {
|
|
38
|
-
const wire = __classPrivateFieldGet(this, _Transport_wire, "f");
|
|
39
|
-
return wire.getPort();
|
|
40
|
-
};
|
|
41
|
-
__classPrivateFieldSet(this, _Transport_wire, new WireType(this.onmessage.bind(this)), "f");
|
|
42
|
-
this.environment = environment;
|
|
43
|
-
this.sendRaw = __classPrivateFieldGet(this, _Transport_wire, "f").send.bind(__classPrivateFieldGet(this, _Transport_wire, "f"));
|
|
44
|
-
this.registerMessageHandler(this.handleMessage.bind(this));
|
|
45
|
-
__classPrivateFieldGet(this, _Transport_wire, "f").on('disconnected', () => {
|
|
46
|
-
for (const [, { handleNack }] of this.wireListeners) {
|
|
47
|
-
handleNack({ reason: 'Remote connection has closed' });
|
|
48
|
-
}
|
|
49
|
-
this.wireListeners.clear();
|
|
50
|
-
this.emit('disconnected');
|
|
51
|
-
});
|
|
52
|
-
const { uuid, name } = config;
|
|
53
|
-
const entityType = this.environment.getCurrentEntityType();
|
|
54
|
-
this.me = (0, me_1.getBaseMe)(entityType, uuid, name);
|
|
55
|
-
}
|
|
56
|
-
getFin() {
|
|
57
|
-
if (!__classPrivateFieldGet(this, _Transport_fin, "f")) {
|
|
58
|
-
throw new Error("No Fin object registered for this transport");
|
|
59
|
-
}
|
|
60
|
-
return __classPrivateFieldGet(this, _Transport_fin, "f");
|
|
61
|
-
}
|
|
62
|
-
registerFin(_fin) {
|
|
63
|
-
if (__classPrivateFieldGet(this, _Transport_fin, "f")) {
|
|
64
|
-
throw new Error("Fin object has already been registered for this transport");
|
|
65
|
-
}
|
|
66
|
-
__classPrivateFieldSet(this, _Transport_fin, _fin, "f");
|
|
67
|
-
}
|
|
68
|
-
shutdown() {
|
|
69
|
-
const wire = __classPrivateFieldGet(this, _Transport_wire, "f");
|
|
70
|
-
return wire.shutdown();
|
|
71
|
-
}
|
|
72
|
-
async connect(config) {
|
|
73
|
-
if ((0, wire_1.isRemoteConfig)(config)) {
|
|
74
|
-
return this.connectRemote(config);
|
|
75
|
-
}
|
|
76
|
-
if ((0, wire_1.isExistingConnectConfig)(config)) {
|
|
77
|
-
return this.connectByPort(config);
|
|
78
|
-
}
|
|
79
|
-
if ((0, wire_1.isNewConnectConfig)(config)) {
|
|
80
|
-
const port = await this.environment.retrievePort(config);
|
|
81
|
-
return this.connectByPort({ ...config, address: `ws://localhost:${port}` });
|
|
82
|
-
}
|
|
83
|
-
return undefined;
|
|
84
|
-
}
|
|
85
|
-
async connectRemote(config) {
|
|
86
|
-
await __classPrivateFieldGet(this, _Transport_wire, "f").connect(config.address, this.environment.getWsConstructor());
|
|
87
|
-
return this.authorize(config);
|
|
88
|
-
}
|
|
89
|
-
async connectByPort(config) {
|
|
90
|
-
const { address, uuid } = config;
|
|
91
|
-
const reqAuthPayload = { ...config, type: 'file-token' };
|
|
92
|
-
const wire = __classPrivateFieldGet(this, _Transport_wire, "f");
|
|
93
|
-
await wire.connect(address, this.environment.getWsConstructor());
|
|
94
|
-
const requestExtAuthRet = await this.sendAction('request-external-authorization', {
|
|
95
|
-
uuid,
|
|
96
|
-
type: 'file-token'
|
|
97
|
-
}, true);
|
|
98
|
-
if (requestExtAuthRet.action !== 'external-authorization-response') {
|
|
99
|
-
throw new transport_errors_1.UnexpectedActionError(requestExtAuthRet.action);
|
|
100
|
-
}
|
|
101
|
-
await this.environment.writeToken(requestExtAuthRet.payload.file, requestExtAuthRet.payload.token);
|
|
102
|
-
return this.authorize(reqAuthPayload);
|
|
103
|
-
}
|
|
104
|
-
async authorize(reqAuthPayload) {
|
|
105
|
-
const requestAuthRet = await this.sendAction('request-authorization', reqAuthPayload, true);
|
|
106
|
-
if (requestAuthRet.action !== 'authorization-response') {
|
|
107
|
-
throw new transport_errors_1.UnexpectedActionError(requestAuthRet.action);
|
|
108
|
-
}
|
|
109
|
-
else if (requestAuthRet.payload.success !== true) {
|
|
110
|
-
throw new transport_errors_1.RuntimeError(requestAuthRet.payload);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
sendAction(action, payload = {}, uncorrelated = false) {
|
|
114
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
115
|
-
let cancel = () => { };
|
|
116
|
-
// We want the callsite from the caller of this function, not from here.
|
|
117
|
-
const callSites = transport_errors_1.RuntimeError.getCallSite(1);
|
|
118
|
-
const messageId = this.environment.getNextMessageId();
|
|
119
|
-
const prom = new Promise((resolve, reject) => {
|
|
120
|
-
cancel = reject;
|
|
121
|
-
const msg = {
|
|
122
|
-
action,
|
|
123
|
-
payload,
|
|
124
|
-
messageId
|
|
125
|
-
};
|
|
126
|
-
const wire = __classPrivateFieldGet(this, _Transport_wire, "f");
|
|
127
|
-
this.addWireListener(messageId, resolve, (payload) => this.nackHandler(payload, reject, callSites), uncorrelated);
|
|
128
|
-
return wire.send(msg).catch(reject);
|
|
129
|
-
});
|
|
130
|
-
return Object.assign(prom, { cancel, messageId });
|
|
131
|
-
}
|
|
132
|
-
nackHandler(payloadOrMessage, reject, callSites) {
|
|
133
|
-
if (typeof payloadOrMessage === 'string') {
|
|
134
|
-
// NOTE: this is for backwards compatibility to support plain string rejections
|
|
135
|
-
reject(payloadOrMessage);
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
reject(new transport_errors_1.RuntimeError(payloadOrMessage, callSites));
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
ferryAction(origData) {
|
|
142
|
-
return new Promise((resolve, reject) => {
|
|
143
|
-
const id = this.environment.getNextMessageId();
|
|
144
|
-
origData.messageId = id;
|
|
145
|
-
const resolver = (data) => {
|
|
146
|
-
resolve(data.payload);
|
|
147
|
-
};
|
|
148
|
-
const wire = __classPrivateFieldGet(this, _Transport_wire, "f");
|
|
149
|
-
return wire
|
|
150
|
-
.send(origData)
|
|
151
|
-
.then(() => this.addWireListener(id, resolver, (payload) => this.nackHandler(payload, reject), false))
|
|
152
|
-
.catch(reject);
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
registerMessageHandler(handler) {
|
|
156
|
-
this.messageHandlers.push(handler);
|
|
157
|
-
}
|
|
158
|
-
addWireListener(id, resolve, handleNack, uncorrelated) {
|
|
159
|
-
if (uncorrelated) {
|
|
160
|
-
this.uncorrelatedListener = resolve;
|
|
161
|
-
}
|
|
162
|
-
else if (this.wireListeners.has(id)) {
|
|
163
|
-
handleNack({ reason: 'Duplicate handler id', error: (0, errors_1.errorToPOJO)(new transport_errors_1.DuplicateCorrelationError(String(id))) });
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
this.wireListeners.set(id, { resolve, handleNack });
|
|
167
|
-
}
|
|
168
|
-
// Timeout and reject()?
|
|
169
|
-
}
|
|
170
|
-
// This method executes message handlers until the _one_ that handles the message (returns truthy) has run
|
|
171
|
-
onmessage(data) {
|
|
172
|
-
for (const h of this.messageHandlers) {
|
|
173
|
-
h.call(null, data);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
handleMessage(data) {
|
|
177
|
-
const id = data.correlationId || NaN;
|
|
178
|
-
if (!('correlationId' in data)) {
|
|
179
|
-
if (this.uncorrelatedListener) {
|
|
180
|
-
this.uncorrelatedListener.call(null, data);
|
|
181
|
-
}
|
|
182
|
-
this.uncorrelatedListener = () => {
|
|
183
|
-
// empty block
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
else if (!this.wireListeners.has(id)) {
|
|
187
|
-
return false;
|
|
188
|
-
}
|
|
189
|
-
else {
|
|
190
|
-
// We just checked for existence above
|
|
191
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
192
|
-
const { resolve, handleNack } = this.wireListeners.get(id);
|
|
193
|
-
if (data.action !== 'ack') {
|
|
194
|
-
handleNack({ reason: 'Did not receive ack action', error: (0, errors_1.errorToPOJO)(new transport_errors_1.NoAckError(data.action)) });
|
|
195
|
-
}
|
|
196
|
-
else if (!('payload' in data)) {
|
|
197
|
-
// I'm not sure when this code would actually run, but passing in something that doeesn't have a reason to the runtimeerror constructor will not end well.
|
|
198
|
-
// @ts-expect-error
|
|
199
|
-
if (typeof data.reason === 'string') {
|
|
200
|
-
handleNack(data);
|
|
201
|
-
}
|
|
202
|
-
else {
|
|
203
|
-
console.warn('Received invalid response from core', data);
|
|
204
|
-
handleNack({ reason: 'invalid response shape' });
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
else if (!data.payload.success) {
|
|
208
|
-
handleNack(data.payload);
|
|
209
|
-
}
|
|
210
|
-
else {
|
|
211
|
-
resolve.call(null, data);
|
|
212
|
-
}
|
|
213
|
-
this.wireListeners.delete(id);
|
|
214
|
-
}
|
|
215
|
-
return true;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
exports.Transport = Transport;
|
|
219
|
-
_Transport_wire = new WeakMap(), _Transport_fin = new WeakMap();
|