@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.
Files changed (80) hide show
  1. package/package.json +1 -1
  2. package/src/OpenFin.d.ts +68 -16
  3. package/src/api/api-exposer/api-consumer.d.ts +28 -0
  4. package/src/api/api-exposer/api-consumer.js +28 -0
  5. package/src/api/api-exposer/api-exposer.d.ts +35 -0
  6. package/src/api/api-exposer/api-exposer.js +38 -0
  7. package/src/api/api-exposer/decorators.d.ts +10 -0
  8. package/src/api/api-exposer/decorators.js +18 -0
  9. package/src/api/api-exposer/index.d.ts +4 -0
  10. package/src/api/api-exposer/index.js +20 -0
  11. package/src/api/api-exposer/strategies/index.d.ts +1 -0
  12. package/src/api/api-exposer/strategies/index.js +17 -0
  13. package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.d.ts +14 -0
  14. package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.js +20 -0
  15. package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.d.ts +20 -0
  16. package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.js +23 -0
  17. package/src/api/api-exposer/strategies/openfin-channels/index.d.ts +2 -0
  18. package/src/api/api-exposer/strategies/openfin-channels/index.js +18 -0
  19. package/src/api/application/Factory.js +1 -2
  20. package/src/api/application/Instance.js +23 -5
  21. package/src/api/base.d.ts +1 -2
  22. package/src/api/events/base.d.ts +0 -3
  23. package/src/api/events/system.d.ts +2 -2
  24. package/src/api/events/view.d.ts +6 -3
  25. package/src/api/events/webcontents.d.ts +2 -0
  26. package/src/api/events/window.d.ts +21 -13
  27. package/src/api/interappbus/channel/index.js +1 -1
  28. package/src/api/interappbus/channel/protocols/classic/strategy.js +24 -6
  29. package/src/api/interappbus/index.js +1 -1
  30. package/src/api/interop/InteropBroker.js +6 -2
  31. package/src/api/interop/fdc3/PrivateChannelClient.d.ts +1 -0
  32. package/src/api/interop/fdc3/PrivateChannelClient.js +15 -7
  33. package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +16 -2
  34. package/src/api/interop/fdc3/PrivateChannelProvider.js +80 -28
  35. package/src/api/interop/fdc3/fdc3-1.2.js +53 -5
  36. package/src/api/interop/fdc3/fdc3-2.0.d.ts +11 -10
  37. package/src/api/interop/fdc3/fdc3-2.0.js +18 -19
  38. package/src/api/interop/fdc3/shapes/fdc3v2.d.ts +1 -1
  39. package/src/api/interop/fdc3/utils.d.ts +17 -0
  40. package/src/api/interop/fdc3/utils.js +75 -21
  41. package/src/api/interop/utils.d.ts +0 -1
  42. package/src/api/interop/utils.js +1 -9
  43. package/src/api/platform/Factory.d.ts +2 -1
  44. package/src/api/platform/Factory.js +5 -9
  45. package/src/api/platform/Instance.d.ts +6 -5
  46. package/src/api/platform/Instance.js +1 -0
  47. package/src/api/platform/layout/Factory.js +16 -6
  48. package/src/api/platform/layout/Instance.d.ts +6 -0
  49. package/src/api/platform/layout/Instance.js +26 -1
  50. package/src/api/platform/layout/controllers/layout-content-cache.d.ts +9 -0
  51. package/src/api/platform/layout/controllers/layout-content-cache.js +54 -0
  52. package/src/api/platform/layout/controllers/layout-entities-controller.d.ts +117 -0
  53. package/src/api/platform/layout/controllers/layout-entities-controller.js +270 -0
  54. package/src/api/platform/layout/controllers/tab-drag-controller.d.ts +2 -1
  55. package/src/api/platform/layout/entities/layout-entities.d.ts +144 -0
  56. package/src/api/platform/layout/entities/layout-entities.js +216 -0
  57. package/src/api/platform/layout/entities/shapes.d.ts +6 -0
  58. package/src/api/platform/layout/entities/shapes.js +2 -0
  59. package/src/api/platform/layout/layout.constants.d.ts +1 -0
  60. package/src/api/platform/layout/layout.constants.js +4 -0
  61. package/src/api/platform/layout/shapes.d.ts +3 -0
  62. package/src/api/platform/layout/utils/layout-traversal.d.ts +4 -0
  63. package/src/api/platform/layout/utils/layout-traversal.js +65 -0
  64. package/src/api/platform/provider.d.ts +2 -1
  65. package/src/api/view/Instance.d.ts +13 -3
  66. package/src/api/view/Instance.js +41 -4
  67. package/src/api/webcontents/main.d.ts +1 -22
  68. package/src/mock.d.ts +1 -1
  69. package/src/mock.js +5 -2
  70. package/src/transport/transport.d.ts +7 -3
  71. package/src/transport/transport.js +10 -11
  72. package/src/transport/wire.d.ts +1 -0
  73. package/src/util/channel-api-relay.d.ts +13 -0
  74. package/src/util/channel-api-relay.js +47 -0
  75. package/src/util/lazy.d.ts +16 -0
  76. package/src/util/lazy.js +26 -0
  77. package/src/util/ref-counter.d.ts +1 -1
  78. package/src/util/ref-counter.js +3 -2
  79. package/src/util/reversible-map.d.ts +11 -0
  80. 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
+ }
@@ -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;
@@ -1,4 +1,4 @@
1
- export default class RefCoutner {
1
+ export declare class RefCounter {
2
2
  topicRefMap: Map<any, any>;
3
3
  incRefCount(key: string): number;
4
4
  decRefCount(key: string): number;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- class RefCoutner {
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.default = RefCoutner;
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;