@openfin/core 33.76.36 → 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.36.tgz +0 -0
- package/src/OpenFin.d.ts +0 -3091
- 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 -196
- package/src/api/application/Factory.js +0 -278
- package/src/api/application/Instance.d.ts +0 -692
- package/src/api/application/Instance.js +0 -821
- package/src/api/application/index.d.ts +0 -12
- package/src/api/application/index.js +0 -28
- package/src/api/base.d.ts +0 -117
- package/src/api/base.js +0 -246
- package/src/api/clipboard/index.d.ts +0 -172
- package/src/api/clipboard/index.js +0 -200
- package/src/api/events/application.d.ts +0 -158
- package/src/api/events/application.js +0 -14
- 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 -35
- package/src/api/events/channel.js +0 -7
- 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 -24
- package/src/api/events/externalApplication.js +0 -7
- package/src/api/events/frame.d.ts +0 -35
- package/src/api/events/frame.js +0 -2
- package/src/api/events/globalHotkey.d.ts +0 -25
- package/src/api/events/globalHotkey.js +0 -2
- package/src/api/events/platform.d.ts +0 -34
- package/src/api/events/platform.js +0 -10
- package/src/api/events/system.d.ts +0 -126
- package/src/api/events/system.js +0 -15
- 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 -92
- package/src/api/events/view.js +0 -12
- package/src/api/events/webcontents.d.ts +0 -277
- package/src/api/events/webcontents.js +0 -13
- package/src/api/events/window.d.ts +0 -421
- package/src/api/events/window.js +0 -12
- package/src/api/external-application/Factory.d.ts +0 -34
- package/src/api/external-application/Factory.js +0 -47
- package/src/api/external-application/Instance.d.ts +0 -110
- package/src/api/external-application/Instance.js +0 -117
- package/src/api/external-application/index.d.ts +0 -12
- package/src/api/external-application/index.js +0 -28
- package/src/api/fin.d.ts +0 -54
- package/src/api/fin.js +0 -45
- package/src/api/frame/Factory.d.ts +0 -54
- package/src/api/frame/Factory.js +0 -86
- package/src/api/frame/Instance.d.ts +0 -136
- package/src/api/frame/Instance.js +0 -143
- package/src/api/frame/index.d.ts +0 -14
- package/src/api/frame/index.js +0 -30
- package/src/api/global-hotkey/index.d.ts +0 -106
- package/src/api/global-hotkey/index.js +0 -132
- package/src/api/interappbus/channel/channel.d.ts +0 -285
- package/src/api/interappbus/channel/channel.js +0 -334
- package/src/api/interappbus/channel/channels-docs.d.ts +0 -342
- package/src/api/interappbus/channel/channels-docs.js +0 -401
- package/src/api/interappbus/channel/client.d.ts +0 -117
- package/src/api/interappbus/channel/client.js +0 -181
- 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 -189
- package/src/api/interappbus/channel/index.js +0 -333
- 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 -206
- package/src/api/interappbus/channel/provider.js +0 -338
- package/src/api/interappbus/index.d.ts +0 -120
- package/src/api/interappbus/index.js +0 -210
- package/src/api/interop/Factory.d.ts +0 -57
- package/src/api/interop/Factory.js +0 -96
- package/src/api/interop/InteropBroker.d.ts +0 -665
- package/src/api/interop/InteropBroker.js +0 -1313
- package/src/api/interop/InteropClient.d.ts +0 -502
- package/src/api/interop/InteropClient.js +0 -683
- 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/documentationStub.d.ts +0 -14
- package/src/api/interop/fdc3/documentationStub.js +0 -17
- package/src/api/interop/fdc3/fdc3-1.2.d.ts +0 -205
- package/src/api/interop/fdc3/fdc3-1.2.js +0 -435
- package/src/api/interop/fdc3/fdc3-2.0.d.ts +0 -298
- package/src/api/interop/fdc3/fdc3-2.0.js +0 -479
- 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 -12
- package/src/api/interop/index.js +0 -28
- 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 -171
- package/src/api/platform/Factory.js +0 -240
- package/src/api/platform/Instance.d.ts +0 -653
- package/src/api/platform/Instance.js +0 -834
- 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 -12
- package/src/api/platform/index.js +0 -28
- package/src/api/platform/layout/Factory.d.ts +0 -91
- package/src/api/platform/layout/Factory.js +0 -151
- package/src/api/platform/layout/Instance.d.ts +0 -192
- package/src/api/platform/layout/Instance.js +0 -224
- 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 -427
- package/src/api/platform/layout/entities/layout-entities.js +0 -504
- 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 -11
- package/src/api/platform/layout/index.js +0 -27
- 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 -510
- package/src/api/platform/provider.js +0 -2
- package/src/api/snapshot-source/Factory.d.ts +0 -53
- package/src/api/snapshot-source/Factory.js +0 -81
- package/src/api/snapshot-source/Instance.d.ts +0 -53
- package/src/api/snapshot-source/Instance.js +0 -154
- package/src/api/snapshot-source/index.d.ts +0 -12
- package/src/api/snapshot-source/index.js +0 -28
- 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 -1468
- package/src/api/system/index.js +0 -1851
- package/src/api/view/Factory.d.ts +0 -88
- package/src/api/view/Factory.js +0 -141
- package/src/api/view/Instance.d.ts +0 -601
- package/src/api/view/Instance.js +0 -671
- package/src/api/view/index.d.ts +0 -12
- package/src/api/view/index.js +0 -28
- package/src/api/webcontents/main.d.ts +0 -922
- package/src/api/webcontents/main.js +0 -1046
- package/src/api/window/Factory.d.ts +0 -96
- package/src/api/window/Factory.js +0 -142
- package/src/api/window/Instance.d.ts +0 -1598
- package/src/api/window/Instance.js +0 -1851
- package/src/api/window/index.d.ts +0 -14
- package/src/api/window/index.js +0 -30
- 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 -22
- package/src/namespaces.js +0 -26
- 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 -204
- 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
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InterAppPayload = void 0;
|
|
4
|
-
const events_1 = require("events");
|
|
5
|
-
const base_1 = require("../base");
|
|
6
|
-
const ref_counter_1 = require("../../util/ref-counter");
|
|
7
|
-
const index_1 = require("./channel/index");
|
|
8
|
-
const validate_1 = require("../../util/validate");
|
|
9
|
-
/**
|
|
10
|
-
* A messaging bus that allows for pub/sub messaging between different applications.
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
|
-
class InterApplicationBus extends base_1.Base {
|
|
14
|
-
/**
|
|
15
|
-
* @internal
|
|
16
|
-
*/
|
|
17
|
-
constructor(wire) {
|
|
18
|
-
super(wire);
|
|
19
|
-
this.events = {
|
|
20
|
-
subscriberAdded: 'subscriber-added',
|
|
21
|
-
subscriberRemoved: 'subscriber-removed'
|
|
22
|
-
};
|
|
23
|
-
this.refCounter = new ref_counter_1.RefCounter();
|
|
24
|
-
this.Channel = new index_1.Channel(wire);
|
|
25
|
-
this.emitter = new events_1.EventEmitter();
|
|
26
|
-
wire.registerMessageHandler(this.onmessage.bind(this));
|
|
27
|
-
this.on = this.emitter.on.bind(this.emitter);
|
|
28
|
-
this.removeAllListeners = this.emitter.removeAllListeners.bind(this.emitter);
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Publishes a message to all applications running on OpenFin Runtime that
|
|
32
|
-
* are subscribed to the specified topic.
|
|
33
|
-
* @param topic The topic on which the message is sent
|
|
34
|
-
* @param message The message to be published. Can be either a primitive
|
|
35
|
-
* data type (string, number, or boolean) or composite data type (object, array)
|
|
36
|
-
* that is composed of other primitive or composite data types
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* ```js
|
|
40
|
-
* fin.InterApplicationBus.publish('topic', 'hello').then(() => console.log('Published')).catch(err => console.log(err));
|
|
41
|
-
* ```
|
|
42
|
-
*/
|
|
43
|
-
publish(topic, message) {
|
|
44
|
-
return this.wire
|
|
45
|
-
.sendAction('publish-message', {
|
|
46
|
-
topic,
|
|
47
|
-
message,
|
|
48
|
-
sourceWindowName: this.me.name
|
|
49
|
-
})
|
|
50
|
-
.then(() => undefined);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Sends a message to a specific application on a specific topic.
|
|
54
|
-
* @param destination The identity of the application to which the message is sent
|
|
55
|
-
* @param topic The topic on which the message is sent
|
|
56
|
-
* @param message The message to be sent. Can be either a primitive data
|
|
57
|
-
* type (string, number, or boolean) or composite data type (object, array) that
|
|
58
|
-
* is composed of other primitive or composite data types
|
|
59
|
-
*
|
|
60
|
-
* @example
|
|
61
|
-
* ```js
|
|
62
|
-
* fin.InterApplicationBus.send(fin.me, 'topic', 'Hello there!').then(() => console.log('Message sent')).catch(err => console.log(err));
|
|
63
|
-
* ```
|
|
64
|
-
*/
|
|
65
|
-
async send(destination, topic, message) {
|
|
66
|
-
const errorMsg = (0, validate_1.validateIdentity)(destination);
|
|
67
|
-
if (errorMsg) {
|
|
68
|
-
throw new Error(errorMsg);
|
|
69
|
-
}
|
|
70
|
-
await this.wire.sendAction('send-message', {
|
|
71
|
-
destinationUuid: destination.uuid,
|
|
72
|
-
destinationWindowName: destination.name,
|
|
73
|
-
topic,
|
|
74
|
-
message,
|
|
75
|
-
sourceWindowName: this.me.name
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Subscribes to messages from the specified application on the specified topic.
|
|
80
|
-
* @param source This object is described in the Identity in the typedef
|
|
81
|
-
* @param topic The topic on which the message is sent
|
|
82
|
-
* @param listener A function that is called when a message has
|
|
83
|
-
* been received. It is passed the message, uuid and name of the sending application.
|
|
84
|
-
* The message can be either a primitive data type (string, number, or boolean) or
|
|
85
|
-
* composite data type (object, array) that is composed of other primitive or composite
|
|
86
|
-
* data types
|
|
87
|
-
*
|
|
88
|
-
* @example
|
|
89
|
-
* ```js
|
|
90
|
-
* // subscribe to a specified application
|
|
91
|
-
* fin.InterApplicationBus.subscribe(fin.me, 'topic', sub_msg => console.log(sub_msg)).then(() => console.log('Subscribed to the specified application')).catch(err => console.log(err));
|
|
92
|
-
*
|
|
93
|
-
* // subscribe to wildcard
|
|
94
|
-
* fin.InterApplicationBus.subscribe({ uuid: '*' }, 'topic', sub_msg => console.log(sub_msg)).then(() => console.log('Subscribed to *')).catch(err => console.log(err));
|
|
95
|
-
* ```
|
|
96
|
-
*/
|
|
97
|
-
subscribe(source, topic, listener) {
|
|
98
|
-
const subKey = this.createSubscriptionKey(source.uuid, source.name || '*', topic);
|
|
99
|
-
const sendSubscription = () => {
|
|
100
|
-
return this.wire.sendAction('subscribe', {
|
|
101
|
-
sourceUuid: source.uuid,
|
|
102
|
-
sourceWindowName: source.name || '*',
|
|
103
|
-
topic,
|
|
104
|
-
destinationWindowName: this.me.name
|
|
105
|
-
});
|
|
106
|
-
};
|
|
107
|
-
const alreadySubscribed = () => {
|
|
108
|
-
return Promise.resolve();
|
|
109
|
-
};
|
|
110
|
-
this.emitter.on(subKey, listener);
|
|
111
|
-
return this.refCounter.actOnFirst(subKey, sendSubscription, alreadySubscribed);
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Unsubscribes to messages from the specified application on the specified topic.
|
|
115
|
-
*
|
|
116
|
-
* @remarks If you are listening to all apps on a topic, (i.e you passed `{ uuid:'*' }` to the subscribe function)
|
|
117
|
-
* then you need to pass `{ uuid:'*' }` to unsubscribe as well. If you are listening to a specific application,
|
|
118
|
-
* (i.e you passed `{ uuid:'some_app' }` to the subscribe function) then you need to provide the same identifier to
|
|
119
|
-
* unsubscribe, unsubscribing to `*` on that same topic will not unhook your initial listener otherwise.
|
|
120
|
-
*
|
|
121
|
-
* @param source This object is described in the Identity in the typedef
|
|
122
|
-
* @param topic The topic on which the message is sent
|
|
123
|
-
* @param listener A callback previously registered with subscribe()
|
|
124
|
-
*
|
|
125
|
-
* @example
|
|
126
|
-
* ```js
|
|
127
|
-
* const listener = console.log;
|
|
128
|
-
*
|
|
129
|
-
* // If any application publishes a message on topic `foo`, our listener will be called.
|
|
130
|
-
* await fin.InterApplicationBus.subscribe({ uuid:'*' }, 'foo', listener)
|
|
131
|
-
*
|
|
132
|
-
* // When you want to unsubscribe, you need to specify the uuid of the app you'd like to
|
|
133
|
-
* // unsubscribe from (or `*`) and provide the same function you gave the subscribe function
|
|
134
|
-
* await fin.InterApplicationBus.unsubscribe({ uuid:'*' }, 'foo', listener)
|
|
135
|
-
* ```
|
|
136
|
-
*/
|
|
137
|
-
unsubscribe(source, topic, listener) {
|
|
138
|
-
const sourceWindowName = source.name || '*';
|
|
139
|
-
const subKey = this.createSubscriptionKey(source.uuid, sourceWindowName, topic);
|
|
140
|
-
const sendUnsubscription = () => {
|
|
141
|
-
return this.wire.sendAction('unsubscribe', {
|
|
142
|
-
sourceUuid: source.uuid,
|
|
143
|
-
sourceWindowName,
|
|
144
|
-
topic,
|
|
145
|
-
destinationWindowName: this.me.name
|
|
146
|
-
});
|
|
147
|
-
};
|
|
148
|
-
const dontSendUnsubscription = () => {
|
|
149
|
-
return new Promise((r) => r).then(() => undefined);
|
|
150
|
-
};
|
|
151
|
-
this.emitter.removeListener(subKey, listener);
|
|
152
|
-
return this.refCounter.actOnLast(subKey, sendUnsubscription, dontSendUnsubscription);
|
|
153
|
-
}
|
|
154
|
-
processMessage(message) {
|
|
155
|
-
const { payload: { message: payloadMessage, sourceWindowName, sourceUuid, topic } } = message;
|
|
156
|
-
const keys = [
|
|
157
|
-
this.createSubscriptionKey(sourceUuid, sourceWindowName, topic),
|
|
158
|
-
this.createSubscriptionKey(sourceUuid, '*', topic),
|
|
159
|
-
this.createSubscriptionKey('*', '*', topic)
|
|
160
|
-
];
|
|
161
|
-
const idOfSender = { uuid: sourceUuid, name: sourceWindowName };
|
|
162
|
-
keys.forEach((key) => {
|
|
163
|
-
this.emitter.emit(key, payloadMessage, idOfSender);
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
emitSubscriverEvent(type, message) {
|
|
167
|
-
const { payload: { targetName: name, uuid, topic } } = message;
|
|
168
|
-
const payload = { name, uuid, topic };
|
|
169
|
-
this.emitter.emit(type, payload);
|
|
170
|
-
}
|
|
171
|
-
// eslint-disable-next-line class-methods-use-this
|
|
172
|
-
createSubscriptionKey(uuid, name, topic) {
|
|
173
|
-
const n = name || '*';
|
|
174
|
-
if (!(uuid && n && topic)) {
|
|
175
|
-
throw new Error('Missing uuid, name, or topic string');
|
|
176
|
-
}
|
|
177
|
-
return createKey(uuid, n, topic);
|
|
178
|
-
}
|
|
179
|
-
onmessage(message) {
|
|
180
|
-
const { action } = message;
|
|
181
|
-
switch (action) {
|
|
182
|
-
case 'process-message':
|
|
183
|
-
this.processMessage(message);
|
|
184
|
-
break;
|
|
185
|
-
case this.events.subscriberAdded:
|
|
186
|
-
this.emitSubscriverEvent(this.events.subscriberAdded, message);
|
|
187
|
-
break;
|
|
188
|
-
case this.events.subscriberRemoved:
|
|
189
|
-
this.emitSubscriverEvent(this.events.subscriberRemoved, message);
|
|
190
|
-
break;
|
|
191
|
-
default:
|
|
192
|
-
break;
|
|
193
|
-
}
|
|
194
|
-
return true;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
exports.default = InterApplicationBus;
|
|
198
|
-
/**
|
|
199
|
-
* @internal
|
|
200
|
-
*/
|
|
201
|
-
class InterAppPayload {
|
|
202
|
-
}
|
|
203
|
-
exports.InterAppPayload = InterAppPayload;
|
|
204
|
-
function createKey(...toHash) {
|
|
205
|
-
return toHash
|
|
206
|
-
.map((item) => {
|
|
207
|
-
return Buffer.from(`${item}`).toString('base64');
|
|
208
|
-
})
|
|
209
|
-
.join('/');
|
|
210
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type * as OpenFin from '../../OpenFin';
|
|
2
|
-
import { Base } from '../base';
|
|
3
|
-
import { InteropBroker } from './InteropBroker';
|
|
4
|
-
import { InteropClient } from './InteropClient';
|
|
5
|
-
/**
|
|
6
|
-
* @PORTED
|
|
7
|
-
* @typedef { object } InteropConfig
|
|
8
|
-
* @summary Information relevant to the Interop Broker.
|
|
9
|
-
* @property {string} [currentContextGroup] Context Group for the client. (green, yellow, red, etc.)
|
|
10
|
-
* @property {string} [providerId] When provided, automatically connects the client to the specified provider uuid
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* Manages creation of Interop Brokers and Interop Clients. These APIs are called under-the-hood in Platforms.
|
|
14
|
-
*
|
|
15
|
-
*/
|
|
16
|
-
export default class InteropModule extends Base {
|
|
17
|
-
/**
|
|
18
|
-
* Initializes an Interop Broker. This is called under-the-hood for Platforms.
|
|
19
|
-
*
|
|
20
|
-
* @remarks For Platforms, this is set up automatically. We advise to only create your own Interop Broker
|
|
21
|
-
* when not using a Platform app. You can override functions in the Interop Broker. More info {@link InteropBroker here}.
|
|
22
|
-
*
|
|
23
|
-
* @param name - Name of the Interop Broker.
|
|
24
|
-
* @param override - A callback function that can be used to extend or replace default Interop Broker behavior.
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ``` js
|
|
28
|
-
* const interopBroker = await fin.Interop.init('openfin');
|
|
29
|
-
* const contextGroups = await interopBroker.getContextGroups();
|
|
30
|
-
* console.log(contextGroups);
|
|
31
|
-
* ```
|
|
32
|
-
* @static
|
|
33
|
-
*/
|
|
34
|
-
init(name: string, override?: OpenFin.OverrideCallback<InteropBroker>): Promise<InteropBroker>;
|
|
35
|
-
/**
|
|
36
|
-
* Connects a client to an Interop broker. This is called under-the-hood for Views in a Platform.
|
|
37
|
-
*
|
|
38
|
-
* @remarks
|
|
39
|
-
* @param name - The name of the Interop Broker to connect to. For Platforms, this will default to the uuid of the Platform.
|
|
40
|
-
* @param interopConfig - Information relevant to the Interop Broker. Typically a declaration of
|
|
41
|
-
* what context(s) the entity wants to subscribe to, and the current Context Group of the entity.
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```js
|
|
45
|
-
* const interopConfig = {
|
|
46
|
-
* currentContextGroup: 'green'
|
|
47
|
-
* }
|
|
48
|
-
*
|
|
49
|
-
* const interopBroker = await fin.Interop.init('openfin');
|
|
50
|
-
* const client = await fin.Interop.connectSync('openfin', interopConfig);
|
|
51
|
-
* const contextGroupInfo = await client.getInfoForContextGroup();
|
|
52
|
-
* console.log(contextGroupInfo);
|
|
53
|
-
* ```
|
|
54
|
-
* @static
|
|
55
|
-
*/
|
|
56
|
-
connectSync(name: string, interopConfig?: OpenFin.InteropConfig): InteropClient;
|
|
57
|
-
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const lodash_1 = require("lodash");
|
|
4
|
-
const inaccessibleObject_1 = require("../../util/inaccessibleObject");
|
|
5
|
-
const base_1 = require("../base");
|
|
6
|
-
const InteropBroker_1 = require("./InteropBroker");
|
|
7
|
-
const InteropClient_1 = require("./InteropClient");
|
|
8
|
-
const overrideCheck_1 = require("./fdc3/overrideCheck");
|
|
9
|
-
const defaultOverride = (Class) => new Class();
|
|
10
|
-
const BrokerParamAccessError = 'You have attempted to use or modify InteropBroker parameters, which is not allowed. You are likely using an older InteropBroker override scheme. Please consult our Interop docs for guidance on migrating to the new override scheme.';
|
|
11
|
-
/**
|
|
12
|
-
* @PORTED
|
|
13
|
-
* @typedef { object } InteropConfig
|
|
14
|
-
* @summary Information relevant to the Interop Broker.
|
|
15
|
-
* @property {string} [currentContextGroup] Context Group for the client. (green, yellow, red, etc.)
|
|
16
|
-
* @property {string} [providerId] When provided, automatically connects the client to the specified provider uuid
|
|
17
|
-
*/
|
|
18
|
-
/**
|
|
19
|
-
* Manages creation of Interop Brokers and Interop Clients. These APIs are called under-the-hood in Platforms.
|
|
20
|
-
*
|
|
21
|
-
*/
|
|
22
|
-
class InteropModule extends base_1.Base {
|
|
23
|
-
/**
|
|
24
|
-
* Initializes an Interop Broker. This is called under-the-hood for Platforms.
|
|
25
|
-
*
|
|
26
|
-
* @remarks For Platforms, this is set up automatically. We advise to only create your own Interop Broker
|
|
27
|
-
* when not using a Platform app. You can override functions in the Interop Broker. More info {@link InteropBroker here}.
|
|
28
|
-
*
|
|
29
|
-
* @param name - Name of the Interop Broker.
|
|
30
|
-
* @param override - A callback function that can be used to extend or replace default Interop Broker behavior.
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ``` js
|
|
34
|
-
* const interopBroker = await fin.Interop.init('openfin');
|
|
35
|
-
* const contextGroups = await interopBroker.getContextGroups();
|
|
36
|
-
* console.log(contextGroups);
|
|
37
|
-
* ```
|
|
38
|
-
* @static
|
|
39
|
-
*/
|
|
40
|
-
async init(name, override = defaultOverride) {
|
|
41
|
-
var _a;
|
|
42
|
-
this.wire.sendAction('interop-init').catch((e) => {
|
|
43
|
-
// don't expose, analytics-only call
|
|
44
|
-
});
|
|
45
|
-
// Allows for manifest-level configuration, without having to override. (e.g. specifying custom context groups)
|
|
46
|
-
const options = await this.fin.Application.getCurrentSync().getInfo();
|
|
47
|
-
const opts = (_a = options.initialOptions.interopBrokerConfiguration) !== null && _a !== void 0 ? _a : {};
|
|
48
|
-
const objectThatThrows = (0, inaccessibleObject_1.createUnusableObject)(BrokerParamAccessError);
|
|
49
|
-
const warningOptsClone = (0, inaccessibleObject_1.createWarningObject)(BrokerParamAccessError, (0, lodash_1.cloneDeep)(opts));
|
|
50
|
-
let provider;
|
|
51
|
-
const getProvider = () => {
|
|
52
|
-
if (!provider) {
|
|
53
|
-
provider = this.fin.InterApplicationBus.Channel.create(`interop-broker-${name}`);
|
|
54
|
-
}
|
|
55
|
-
return provider;
|
|
56
|
-
};
|
|
57
|
-
const throwingGetProvider = async () => {
|
|
58
|
-
// eslint-disable-next-line no-console
|
|
59
|
-
throw new Error(BrokerParamAccessError);
|
|
60
|
-
};
|
|
61
|
-
const OverrideableBroker = InteropBroker_1.InteropBroker.createClosedConstructor(this.wire, getProvider, opts);
|
|
62
|
-
// We need to use these objects because removing them entirely would be a breaking change and we want an informative error
|
|
63
|
-
// @ts-expect-error
|
|
64
|
-
const broker = await override(OverrideableBroker, objectThatThrows, throwingGetProvider, warningOptsClone);
|
|
65
|
-
(0, overrideCheck_1.overrideCheck)(broker, (0, overrideCheck_1.getDefaultViewFdc3VersionFromAppInfo)(options));
|
|
66
|
-
return broker;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Connects a client to an Interop broker. This is called under-the-hood for Views in a Platform.
|
|
70
|
-
*
|
|
71
|
-
* @remarks
|
|
72
|
-
* @param name - The name of the Interop Broker to connect to. For Platforms, this will default to the uuid of the Platform.
|
|
73
|
-
* @param interopConfig - Information relevant to the Interop Broker. Typically a declaration of
|
|
74
|
-
* what context(s) the entity wants to subscribe to, and the current Context Group of the entity.
|
|
75
|
-
*
|
|
76
|
-
* @example
|
|
77
|
-
* ```js
|
|
78
|
-
* const interopConfig = {
|
|
79
|
-
* currentContextGroup: 'green'
|
|
80
|
-
* }
|
|
81
|
-
*
|
|
82
|
-
* const interopBroker = await fin.Interop.init('openfin');
|
|
83
|
-
* const client = await fin.Interop.connectSync('openfin', interopConfig);
|
|
84
|
-
* const contextGroupInfo = await client.getInfoForContextGroup();
|
|
85
|
-
* console.log(contextGroupInfo);
|
|
86
|
-
* ```
|
|
87
|
-
* @static
|
|
88
|
-
*/
|
|
89
|
-
connectSync(name, interopConfig) {
|
|
90
|
-
this.wire.sendAction('interop-connect-sync').catch((e) => {
|
|
91
|
-
// don't expose, analytics-only call
|
|
92
|
-
});
|
|
93
|
-
return new InteropClient_1.InteropClient(this.wire, name, interopConfig);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
exports.default = InteropModule;
|