@openfin/core 31.74.6 → 31.74.8
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/package.json +1 -1
- package/src/OpenFin.d.ts +68 -16
- package/src/api/api-exposer/api-consumer.d.ts +28 -0
- package/src/api/api-exposer/api-consumer.js +28 -0
- package/src/api/api-exposer/api-exposer.d.ts +35 -0
- package/src/api/api-exposer/api-exposer.js +38 -0
- package/src/api/api-exposer/decorators.d.ts +10 -0
- package/src/api/api-exposer/decorators.js +18 -0
- package/src/api/api-exposer/index.d.ts +4 -0
- package/src/api/api-exposer/index.js +20 -0
- package/src/api/api-exposer/strategies/index.d.ts +1 -0
- package/src/api/api-exposer/strategies/index.js +17 -0
- package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.d.ts +14 -0
- package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.js +20 -0
- package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.d.ts +20 -0
- package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.js +23 -0
- package/src/api/api-exposer/strategies/openfin-channels/index.d.ts +2 -0
- package/src/api/api-exposer/strategies/openfin-channels/index.js +18 -0
- package/src/api/application/Factory.js +1 -2
- package/src/api/application/Instance.js +23 -5
- package/src/api/base.d.ts +1 -2
- package/src/api/events/base.d.ts +0 -3
- package/src/api/events/system.d.ts +2 -2
- package/src/api/events/view.d.ts +6 -3
- package/src/api/events/webcontents.d.ts +2 -0
- package/src/api/events/window.d.ts +21 -13
- package/src/api/interappbus/channel/index.js +1 -1
- package/src/api/interappbus/channel/protocols/classic/strategy.js +24 -6
- package/src/api/interappbus/index.js +1 -1
- package/src/api/interop/InteropBroker.js +6 -2
- package/src/api/interop/fdc3/PrivateChannelClient.d.ts +1 -0
- package/src/api/interop/fdc3/PrivateChannelClient.js +15 -7
- package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +16 -2
- package/src/api/interop/fdc3/PrivateChannelProvider.js +80 -28
- package/src/api/interop/fdc3/fdc3-1.2.js +53 -5
- package/src/api/interop/fdc3/fdc3-2.0.d.ts +11 -10
- package/src/api/interop/fdc3/fdc3-2.0.js +18 -19
- package/src/api/interop/fdc3/shapes/fdc3v2.d.ts +1 -1
- package/src/api/interop/fdc3/utils.d.ts +17 -0
- package/src/api/interop/fdc3/utils.js +75 -21
- package/src/api/interop/utils.d.ts +0 -1
- package/src/api/interop/utils.js +1 -9
- package/src/api/platform/Factory.d.ts +2 -1
- package/src/api/platform/Factory.js +5 -9
- package/src/api/platform/Instance.d.ts +6 -5
- package/src/api/platform/Instance.js +1 -0
- package/src/api/platform/layout/Factory.js +16 -6
- package/src/api/platform/layout/Instance.d.ts +6 -0
- package/src/api/platform/layout/Instance.js +26 -1
- package/src/api/platform/layout/controllers/layout-content-cache.d.ts +9 -0
- package/src/api/platform/layout/controllers/layout-content-cache.js +54 -0
- package/src/api/platform/layout/controllers/layout-entities-controller.d.ts +117 -0
- package/src/api/platform/layout/controllers/layout-entities-controller.js +270 -0
- package/src/api/platform/layout/controllers/tab-drag-controller.d.ts +2 -1
- package/src/api/platform/layout/entities/layout-entities.d.ts +144 -0
- package/src/api/platform/layout/entities/layout-entities.js +216 -0
- package/src/api/platform/layout/entities/shapes.d.ts +6 -0
- package/src/api/platform/layout/entities/shapes.js +2 -0
- package/src/api/platform/layout/layout.constants.d.ts +1 -0
- package/src/api/platform/layout/layout.constants.js +4 -0
- package/src/api/platform/layout/shapes.d.ts +3 -0
- package/src/api/platform/layout/utils/layout-traversal.d.ts +4 -0
- package/src/api/platform/layout/utils/layout-traversal.js +65 -0
- package/src/api/platform/provider.d.ts +2 -1
- package/src/api/view/Instance.d.ts +13 -3
- package/src/api/view/Instance.js +41 -4
- package/src/api/webcontents/main.d.ts +1 -22
- package/src/mock.d.ts +1 -1
- package/src/mock.js +5 -2
- package/src/transport/transport.d.ts +7 -3
- package/src/transport/transport.js +10 -11
- package/src/transport/wire.d.ts +1 -0
- package/src/util/channel-api-relay.d.ts +13 -0
- package/src/util/channel-api-relay.js +47 -0
- package/src/util/lazy.d.ts +16 -0
- package/src/util/lazy.js +26 -0
- package/src/util/ref-counter.d.ts +1 -1
- package/src/util/ref-counter.js +3 -2
- package/src/util/reversible-map.d.ts +11 -0
- package/src/util/reversible-map.js +49 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createRelayedDispatch = exports.relayChannelClientApi = void 0;
|
|
4
|
+
const EXPECTED_ERRORS = [
|
|
5
|
+
'no longer connected',
|
|
6
|
+
'RTCDataChannel closed unexpectedly',
|
|
7
|
+
'The client you are trying to dispatch from is disconnected from the target provider',
|
|
8
|
+
];
|
|
9
|
+
// Checks possible error messages that we want to trap, client error message can originate
|
|
10
|
+
// from ChannelProvider::dispatch OR ClassicStrategy::closeEndpoint OR RTCEndPoint::dataChannel::onclose
|
|
11
|
+
const isDisconnectedError = (errorMsg) => {
|
|
12
|
+
return EXPECTED_ERRORS.some(e => errorMsg.includes(e));
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
* Create a channel relay for a given channel exposition, allowing a single provider to route
|
|
17
|
+
* actions to the designated clients.
|
|
18
|
+
*
|
|
19
|
+
* Designed to be used in conjunction with @expose
|
|
20
|
+
*
|
|
21
|
+
* @param channelProvider The channel provider to relay the actions on.
|
|
22
|
+
* @param config Determines which actions to relay. Please ensure action prefix matches the exposed api.
|
|
23
|
+
*/
|
|
24
|
+
const relayChannelClientApi = async (channelProvider, relayId) => {
|
|
25
|
+
channelProvider.register(`relay:${relayId}`, ({ action, target, payload }) => {
|
|
26
|
+
return channelProvider.dispatch(target, action, payload);
|
|
27
|
+
});
|
|
28
|
+
await Promise.resolve();
|
|
29
|
+
};
|
|
30
|
+
exports.relayChannelClientApi = relayChannelClientApi;
|
|
31
|
+
const createRelayedDispatch = (client, target, relayId, relayErrorMsg) => async (action, payload) => {
|
|
32
|
+
try {
|
|
33
|
+
return await client.dispatch(`relay:${relayId}`, {
|
|
34
|
+
action,
|
|
35
|
+
payload,
|
|
36
|
+
target
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
if (isDisconnectedError(e.message) && relayErrorMsg) {
|
|
41
|
+
throw new Error(relayErrorMsg);
|
|
42
|
+
}
|
|
43
|
+
;
|
|
44
|
+
throw e;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
exports.createRelayedDispatch = createRelayedDispatch;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handy class for managing asynchronous dependencies of classes.
|
|
3
|
+
*
|
|
4
|
+
* Will call the producer function once and only once when getValue is called,
|
|
5
|
+
* returning the resultant value for every subsequent call.
|
|
6
|
+
*/
|
|
7
|
+
export declare class Lazy<T> {
|
|
8
|
+
private producerFn;
|
|
9
|
+
constructor(producerFn: () => T);
|
|
10
|
+
private value;
|
|
11
|
+
/**
|
|
12
|
+
* Lazily get the value returned by the producer.
|
|
13
|
+
* @returns The value returned from the producer function
|
|
14
|
+
*/
|
|
15
|
+
getValue(): T;
|
|
16
|
+
}
|
package/src/util/lazy.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Lazy = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Handy class for managing asynchronous dependencies of classes.
|
|
6
|
+
*
|
|
7
|
+
* Will call the producer function once and only once when getValue is called,
|
|
8
|
+
* returning the resultant value for every subsequent call.
|
|
9
|
+
*/
|
|
10
|
+
class Lazy {
|
|
11
|
+
// eslint-disable-next-line
|
|
12
|
+
constructor(producerFn) {
|
|
13
|
+
this.producerFn = producerFn;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Lazily get the value returned by the producer.
|
|
17
|
+
* @returns The value returned from the producer function
|
|
18
|
+
*/
|
|
19
|
+
getValue() {
|
|
20
|
+
if (!this.value) {
|
|
21
|
+
this.value = this.producerFn();
|
|
22
|
+
}
|
|
23
|
+
return this.value;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.Lazy = Lazy;
|
package/src/util/ref-counter.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
exports.RefCounter = void 0;
|
|
4
|
+
class RefCounter {
|
|
4
5
|
constructor() {
|
|
5
6
|
this.topicRefMap = new Map();
|
|
6
7
|
}
|
|
@@ -48,4 +49,4 @@ class RefCoutner {
|
|
|
48
49
|
return isLastRef ? lastAction() : nonLastAction();
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
|
-
exports.
|
|
52
|
+
exports.RefCounter = RefCounter;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare class ReversibleMap<TKey extends string | number | symbol, TValue extends Object | string | number> {
|
|
2
|
+
private readonly valueToKey;
|
|
3
|
+
private readonly keyToValue;
|
|
4
|
+
setUnique: (key: TKey, value: TValue) => void;
|
|
5
|
+
getKey: (value: TValue) => TKey;
|
|
6
|
+
getValue(key: TKey): TValue;
|
|
7
|
+
deleteKey: (key: TKey) => TValue | undefined;
|
|
8
|
+
deleteValue: (value: TValue) => TKey | undefined;
|
|
9
|
+
hasKey: (key: TKey) => boolean;
|
|
10
|
+
hasValue: (value: TValue) => boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReversibleMap = void 0;
|
|
4
|
+
class ReversibleMap {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.valueToKey = new Map();
|
|
7
|
+
this.keyToValue = new Map();
|
|
8
|
+
this.setUnique = (key, value) => {
|
|
9
|
+
if (this.hasKey(key) || this.hasValue(value)) {
|
|
10
|
+
throw new Error('Key or value already in the map.');
|
|
11
|
+
}
|
|
12
|
+
this.keyToValue.set(key, value);
|
|
13
|
+
this.valueToKey.set(value, key);
|
|
14
|
+
};
|
|
15
|
+
this.getKey = (value) => {
|
|
16
|
+
const existingKey = this.valueToKey.get(value);
|
|
17
|
+
if (!existingKey) {
|
|
18
|
+
throw new Error('Value not found in the map.');
|
|
19
|
+
}
|
|
20
|
+
return existingKey;
|
|
21
|
+
};
|
|
22
|
+
this.deleteKey = (key) => {
|
|
23
|
+
const value = this.getValue(key);
|
|
24
|
+
this.keyToValue.delete(key);
|
|
25
|
+
this.valueToKey.delete(value);
|
|
26
|
+
return value;
|
|
27
|
+
};
|
|
28
|
+
this.deleteValue = (value) => {
|
|
29
|
+
const key = this.getKey(value);
|
|
30
|
+
this.keyToValue.delete(key);
|
|
31
|
+
this.valueToKey.delete(value);
|
|
32
|
+
return key;
|
|
33
|
+
};
|
|
34
|
+
this.hasKey = (key) => {
|
|
35
|
+
return this.keyToValue.has(key);
|
|
36
|
+
};
|
|
37
|
+
this.hasValue = (value) => {
|
|
38
|
+
return this.valueToKey.has(value);
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
getValue(key) {
|
|
42
|
+
const item = this.keyToValue.get(key);
|
|
43
|
+
if (!item) {
|
|
44
|
+
throw new Error('Key not found in the map.');
|
|
45
|
+
}
|
|
46
|
+
return item;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.ReversibleMap = ReversibleMap;
|