@openfin/core 29.72.18 → 29.73.1
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 +40 -23
- package/package.json +1 -1
- package/src/api/application/Factory.js +3 -3
- package/src/api/application/index.js +7 -3
- package/src/api/base.js +18 -20
- package/src/api/external-application/index.js +7 -3
- package/src/api/fin.js +2 -2
- package/src/api/frame/Factory.js +2 -2
- package/src/api/frame/index.js +7 -3
- package/src/api/interappbus/channel/client.js +24 -26
- package/src/api/interappbus/channel/connection-manager.js +24 -26
- package/src/api/interappbus/channel/index.js +16 -18
- package/src/api/interappbus/channel/protocols/classic/strategy.js +21 -22
- package/src/api/interappbus/channel/protocols/rtc/endpoint.js +24 -26
- package/src/api/interappbus/channel/protocols/rtc/strategy.js +29 -31
- package/src/api/interappbus/channel/provider.js +134 -139
- package/src/api/interappbus/index.js +1 -1
- package/src/api/interop/InteropBroker.js +9 -9
- package/src/api/interop/InteropClient.js +38 -40
- package/src/api/interop/SessionContextGroupClient.js +22 -24
- package/src/api/interop/fdc3/PrivateChannelClient.d.ts +17 -0
- package/src/api/interop/fdc3/PrivateChannelClient.js +82 -0
- package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +40 -0
- package/src/api/interop/fdc3/PrivateChannelProvider.js +224 -0
- package/src/api/interop/fdc3/fdc3-1.2.d.ts +0 -1
- package/src/api/interop/fdc3/fdc3-1.2.js +1 -27
- package/src/api/interop/fdc3/fdc3-2.0.d.ts +20 -1
- package/src/api/interop/fdc3/fdc3-2.0.js +29 -4
- package/src/api/interop/fdc3/utils.d.ts +4 -0
- package/src/api/interop/fdc3/utils.js +112 -4
- package/src/api/interop/index.js +7 -3
- package/src/api/interop/utils.js +20 -14
- package/src/api/platform/Factory.js +5 -5
- package/src/api/platform/Instance.js +11 -12
- package/src/api/platform/index.js +7 -3
- package/src/api/platform/layout/Factory.js +18 -20
- package/src/api/platform/layout/Instance.d.ts +1 -1
- package/src/api/platform/layout/Instance.js +2 -2
- package/src/api/platform/layout/controllers/splitter-controller.js +1 -1
- package/src/api/platform/layout/controllers/tab-drag-controller.d.ts +17 -8
- package/src/api/platform/layout/controllers/tab-drag-controller.js +44 -22
- package/src/api/platform/layout/index.js +7 -3
- package/src/api/platform/layout/utils/bounds-observer.js +5 -3
- package/src/api/snapshot-source/Factory.js +1 -1
- package/src/api/snapshot-source/Instance.js +33 -35
- package/src/api/snapshot-source/index.js +7 -3
- package/src/api/snapshot-source/utils.js +2 -1
- package/src/api/view/Factory.js +2 -2
- package/src/api/view/Instance.d.ts +31 -1
- package/src/api/view/Instance.js +31 -1
- package/src/api/view/index.js +7 -3
- package/src/api/window/Factory.js +2 -2
- package/src/api/window/Instance.d.ts +3 -0
- package/src/api/window/Instance.js +3 -0
- package/src/api/window/index.js +7 -3
- package/src/environment/node-env.js +2 -2
- package/src/environment/openfin-env.js +15 -17
- package/src/fdc3.js +1 -1
- package/src/mock.js +1 -2
- package/src/transport/transport.js +26 -28
- package/src/transport/wire.d.ts +9 -7
- package/src/util/http.d.ts +1 -1
- package/src/util/http.js +16 -11
- package/src/util/normalize-config.js +5 -5
package/OpenFin.d.ts
CHANGED
|
@@ -154,6 +154,7 @@ declare namespace OpenFin {
|
|
|
154
154
|
| 'resizable'
|
|
155
155
|
| 'resizeRegion'
|
|
156
156
|
| 'saveWindowState'
|
|
157
|
+
| 'ignoreSavedWindowState'
|
|
157
158
|
| 'shadow'
|
|
158
159
|
| 'showTaskbarIcon'
|
|
159
160
|
| 'smallWindow'
|
|
@@ -283,13 +284,14 @@ declare namespace OpenFin {
|
|
|
283
284
|
defaultTop: number;
|
|
284
285
|
defaultWidth: number;
|
|
285
286
|
height: number;
|
|
286
|
-
layout:
|
|
287
|
+
layout: LayoutOptions;
|
|
287
288
|
modalParentIdentity: Identity;
|
|
288
289
|
name: string;
|
|
289
290
|
permissions: Partial<Permissions>;
|
|
290
291
|
preloadScripts: PreloadScript[];
|
|
291
292
|
processAffinity: string;
|
|
292
293
|
saveWindowState: boolean;
|
|
294
|
+
ignoreSavedWindowState: boolean;
|
|
293
295
|
shadow: boolean;
|
|
294
296
|
smallWindow: boolean;
|
|
295
297
|
state: WindowState;
|
|
@@ -723,35 +725,50 @@ declare namespace OpenFin {
|
|
|
723
725
|
};
|
|
724
726
|
};
|
|
725
727
|
|
|
728
|
+
export type LayoutContent = (LayoutItemConfig | LayoutRow | LayoutColumn | LayoutComponent)[];
|
|
729
|
+
|
|
730
|
+
export type LayoutItemConfig = {
|
|
731
|
+
type: string;
|
|
732
|
+
content?: LayoutContent;
|
|
733
|
+
width?: number;
|
|
734
|
+
height?: number;
|
|
735
|
+
id?: string | string[];
|
|
736
|
+
isClosable?: boolean;
|
|
737
|
+
title?: string;
|
|
738
|
+
};
|
|
739
|
+
|
|
740
|
+
export interface LayoutRow extends LayoutItemConfig {
|
|
741
|
+
type: 'row';
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
export interface LayoutColumn extends LayoutItemConfig {
|
|
745
|
+
type: 'column';
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
export interface LayoutComponent extends LayoutItemConfig {
|
|
749
|
+
componentName: 'view';
|
|
750
|
+
componentState?: Partial<ViewCreationOptions>;
|
|
751
|
+
}
|
|
752
|
+
|
|
726
753
|
export type LayoutOptions = {
|
|
727
|
-
settings
|
|
754
|
+
settings?: {
|
|
728
755
|
popoutWholeStack?: boolean;
|
|
729
756
|
constrainDragToContainer?: boolean;
|
|
730
757
|
showPopoutIcon?: boolean;
|
|
731
758
|
showMaximiseIcon?: boolean;
|
|
732
759
|
showCloseIcon?: boolean;
|
|
733
760
|
constrainDragToHeaders?: boolean;
|
|
761
|
+
hasHeaders?: boolean;
|
|
762
|
+
reorderEnabled?: boolean;
|
|
763
|
+
preventDragOut?: boolean;
|
|
764
|
+
preventDragIn?: boolean;
|
|
734
765
|
};
|
|
735
|
-
content
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
type: 'row';
|
|
742
|
-
content: LayoutContent;
|
|
743
|
-
};
|
|
744
|
-
export type LayoutColumn = {
|
|
745
|
-
type: 'column';
|
|
746
|
-
content: LayoutContent;
|
|
747
|
-
};
|
|
748
|
-
export type LayoutComponent = {
|
|
749
|
-
type: 'component';
|
|
750
|
-
componentName: 'view';
|
|
751
|
-
componentState: {
|
|
752
|
-
name: string;
|
|
753
|
-
url: string;
|
|
754
|
-
title?: string;
|
|
766
|
+
content?: LayoutContent;
|
|
767
|
+
dimensions?: {
|
|
768
|
+
borderWidth?: number;
|
|
769
|
+
minItemHeight?: number;
|
|
770
|
+
minItemWidth?: number;
|
|
771
|
+
headerHeight?: number;
|
|
755
772
|
};
|
|
756
773
|
};
|
|
757
774
|
|
|
@@ -1551,7 +1568,7 @@ declare namespace OpenFin {
|
|
|
1551
1568
|
topic: string,
|
|
1552
1569
|
payload: unknown,
|
|
1553
1570
|
senderIdentity: ProviderIdentity | OpenFin.ClientIdentity
|
|
1554
|
-
) => Promise<unknown> |unknown;
|
|
1571
|
+
) => Promise<unknown> | unknown;
|
|
1555
1572
|
|
|
1556
1573
|
export type ErrorMiddleware = (
|
|
1557
1574
|
topic: string,
|
package/package.json
CHANGED
|
@@ -89,7 +89,7 @@ class ApplicationModule extends base_1.Base {
|
|
|
89
89
|
this.wire.sendAction('wrap-application').catch((e) => {
|
|
90
90
|
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
91
91
|
});
|
|
92
|
-
const errorMsg = validate_1.validateIdentity(identity);
|
|
92
|
+
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
|
93
93
|
if (errorMsg) {
|
|
94
94
|
throw new Error(errorMsg);
|
|
95
95
|
}
|
|
@@ -106,7 +106,7 @@ class ApplicationModule extends base_1.Base {
|
|
|
106
106
|
this.wire.sendAction('wrap-application-sync').catch((e) => {
|
|
107
107
|
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
108
108
|
});
|
|
109
|
-
const errorMsg = validate_1.validateIdentity(identity);
|
|
109
|
+
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
|
110
110
|
if (errorMsg) {
|
|
111
111
|
throw new Error(errorMsg);
|
|
112
112
|
}
|
|
@@ -202,7 +202,7 @@ class ApplicationModule extends base_1.Base {
|
|
|
202
202
|
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
203
203
|
});
|
|
204
204
|
const app = await this._createFromManifest(manifestUrl);
|
|
205
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-
|
|
205
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
206
206
|
// @ts-ignore using private method without warning.
|
|
207
207
|
await app._run(opts); // eslint-disable-line no-underscore-dangle
|
|
208
208
|
return app;
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
8
12
|
}));
|
|
9
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !
|
|
11
|
-
}
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
12
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
17
|
const Factory_1 = require("./Factory");
|
|
14
18
|
__exportStar(require("./Instance"), exports);
|
package/src/api/base.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver,
|
|
3
|
-
if (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return value;
|
|
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;
|
|
8
7
|
};
|
|
9
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver,
|
|
10
|
-
if (!
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return privateMap.get(receiver);
|
|
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);
|
|
14
12
|
};
|
|
15
|
-
var
|
|
13
|
+
var _EmitterBase_emitterAccessor;
|
|
16
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
15
|
exports.Reply = exports.EmitterBase = exports.Base = void 0;
|
|
18
16
|
const promises_1 = require("../util/promises");
|
|
@@ -31,7 +29,7 @@ class Base {
|
|
|
31
29
|
this.wire = wire;
|
|
32
30
|
}
|
|
33
31
|
get fin() {
|
|
34
|
-
return fin_store_1.getFin(this.wire);
|
|
32
|
+
return (0, fin_store_1.getFin)(this.wire);
|
|
35
33
|
}
|
|
36
34
|
get me() {
|
|
37
35
|
return this.wire.me;
|
|
@@ -42,13 +40,13 @@ class EmitterBase extends Base {
|
|
|
42
40
|
constructor(wire, topic, ...additionalAccessors) {
|
|
43
41
|
super(wire);
|
|
44
42
|
this.topic = topic;
|
|
45
|
-
|
|
43
|
+
_EmitterBase_emitterAccessor.set(this, void 0);
|
|
46
44
|
this.eventNames = () => (this.hasEmitter() ? this.getOrCreateEmitter().eventNames() : []);
|
|
47
45
|
this.emit = (eventName, payload, ...args) => {
|
|
48
46
|
return this.hasEmitter() ? this.getOrCreateEmitter().emit(eventName, payload, ...args) : false;
|
|
49
47
|
};
|
|
50
|
-
this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet(this,
|
|
51
|
-
this.getOrCreateEmitter = () => this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet(this,
|
|
48
|
+
this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet(this, _EmitterBase_emitterAccessor, "f"));
|
|
49
|
+
this.getOrCreateEmitter = () => this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet(this, _EmitterBase_emitterAccessor, "f"));
|
|
52
50
|
this.listeners = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(type) : [];
|
|
53
51
|
this.listenerCount = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listenerCount(type) : 0;
|
|
54
52
|
this.registerEventListener = async (eventType, options = {}, applySubscription, undoSubscription) => {
|
|
@@ -87,7 +85,7 @@ class EmitterBase extends Base {
|
|
|
87
85
|
return Promise.resolve();
|
|
88
86
|
};
|
|
89
87
|
this.addListener = this.on;
|
|
90
|
-
__classPrivateFieldSet(this,
|
|
88
|
+
__classPrivateFieldSet(this, _EmitterBase_emitterAccessor, [topic, ...additionalAccessors], "f");
|
|
91
89
|
this.listeners = (event) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(event) : [];
|
|
92
90
|
}
|
|
93
91
|
async on(eventType, listener, options) {
|
|
@@ -163,18 +161,18 @@ class EmitterBase extends Base {
|
|
|
163
161
|
}
|
|
164
162
|
else if (this.hasEmitter()) {
|
|
165
163
|
const events = this.getOrCreateEmitter().eventNames();
|
|
166
|
-
await promises_1.promiseMap(events, removeByEvent);
|
|
164
|
+
await (0, promises_1.promiseMap)(events, removeByEvent);
|
|
167
165
|
}
|
|
168
166
|
return this;
|
|
169
167
|
}
|
|
170
168
|
deleteEmitterIfNothingRegistered(emitter) {
|
|
171
169
|
if (emitter.eventNames().length === 0) {
|
|
172
|
-
this.wire.eventAggregator.delete(__classPrivateFieldGet(this,
|
|
170
|
+
this.wire.eventAggregator.delete(__classPrivateFieldGet(this, _EmitterBase_emitterAccessor, "f"));
|
|
173
171
|
}
|
|
174
172
|
}
|
|
175
173
|
}
|
|
176
174
|
exports.EmitterBase = EmitterBase;
|
|
177
|
-
|
|
175
|
+
_EmitterBase_emitterAccessor = new WeakMap();
|
|
178
176
|
class Reply {
|
|
179
177
|
}
|
|
180
178
|
exports.Reply = Reply;
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
8
12
|
}));
|
|
9
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !
|
|
11
|
-
}
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
12
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
17
|
const Factory_1 = require("./Factory");
|
|
14
18
|
exports.default = Factory_1.default;
|
package/src/api/fin.js
CHANGED
|
@@ -19,7 +19,7 @@ const snapshot_source_1 = require("./snapshot-source");
|
|
|
19
19
|
class Fin extends events_1.EventEmitter {
|
|
20
20
|
constructor(wire) {
|
|
21
21
|
super();
|
|
22
|
-
fin_store_1.registerFin(wire, this);
|
|
22
|
+
(0, fin_store_1.registerFin)(wire, this);
|
|
23
23
|
this.wire = wire;
|
|
24
24
|
this.System = new index_1.default(wire);
|
|
25
25
|
this.Window = new index_2.default(wire);
|
|
@@ -33,7 +33,7 @@ class Fin extends events_1.EventEmitter {
|
|
|
33
33
|
this.View = new index_9.default(wire);
|
|
34
34
|
this.Interop = new interop_1.default(wire);
|
|
35
35
|
this.SnapshotSource = new snapshot_source_1.default(wire);
|
|
36
|
-
this.me = me_1.getMe(wire);
|
|
36
|
+
this.me = (0, me_1.getMe)(wire);
|
|
37
37
|
// Handle disconnect events
|
|
38
38
|
wire.on('disconnected', () => {
|
|
39
39
|
this.emit('disconnected');
|
package/src/api/frame/Factory.js
CHANGED
|
@@ -18,7 +18,7 @@ class _FrameModule extends base_1.Base {
|
|
|
18
18
|
this.wire.sendAction('frame-wrap').catch((e) => {
|
|
19
19
|
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
20
20
|
});
|
|
21
|
-
const errorMsg = validate_1.validateIdentity(identity);
|
|
21
|
+
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
|
22
22
|
if (errorMsg) {
|
|
23
23
|
throw new Error(errorMsg);
|
|
24
24
|
}
|
|
@@ -35,7 +35,7 @@ class _FrameModule extends base_1.Base {
|
|
|
35
35
|
this.wire.sendAction('frame-wrap-sync').catch((e) => {
|
|
36
36
|
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
37
37
|
});
|
|
38
|
-
const errorMsg = validate_1.validateIdentity(identity);
|
|
38
|
+
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
|
39
39
|
if (errorMsg) {
|
|
40
40
|
throw new Error(errorMsg);
|
|
41
41
|
}
|
package/src/api/frame/index.js
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
8
12
|
}));
|
|
9
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !
|
|
11
|
-
}
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
12
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
17
|
const Factory_1 = require("./Factory");
|
|
14
18
|
exports.default = Factory_1.default;
|
|
@@ -1,57 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver,
|
|
3
|
-
if (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return value;
|
|
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;
|
|
8
7
|
};
|
|
9
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver,
|
|
10
|
-
if (!
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return privateMap.get(receiver);
|
|
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);
|
|
14
12
|
};
|
|
15
|
-
var
|
|
13
|
+
var _ChannelClient_protectedObj, _ChannelClient_strategy, _ChannelClient_close;
|
|
16
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
15
|
const channel_1 = require("./channel");
|
|
18
16
|
const channelClientsByEndpointId = new Map();
|
|
19
17
|
class ChannelClient extends channel_1.ChannelBase {
|
|
20
18
|
constructor(routingInfo, wire, strategy) {
|
|
21
19
|
super();
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
_ChannelClient_protectedObj.set(this, void 0);
|
|
21
|
+
_ChannelClient_strategy.set(this, void 0);
|
|
24
22
|
// needs to be bound;
|
|
25
23
|
this.processAction = (action, payload, senderIdentity) => super.processAction(action, payload, senderIdentity);
|
|
26
|
-
|
|
24
|
+
_ChannelClient_close.set(this, () => {
|
|
27
25
|
channelClientsByEndpointId.delete(this.endpointId);
|
|
28
|
-
__classPrivateFieldGet(this,
|
|
26
|
+
__classPrivateFieldGet(this, _ChannelClient_strategy, "f").close();
|
|
29
27
|
});
|
|
30
|
-
__classPrivateFieldSet(this,
|
|
28
|
+
__classPrivateFieldSet(this, _ChannelClient_protectedObj, new channel_1.ProtectedItems(routingInfo, wire), "f");
|
|
31
29
|
this.disconnectListener = () => undefined;
|
|
32
30
|
this.endpointId = routingInfo.endpointId;
|
|
33
|
-
__classPrivateFieldSet(this,
|
|
31
|
+
__classPrivateFieldSet(this, _ChannelClient_strategy, strategy, "f");
|
|
34
32
|
channelClientsByEndpointId.set(this.endpointId, this);
|
|
35
33
|
strategy.receive(this.processAction);
|
|
36
34
|
}
|
|
37
35
|
static closeChannelByEndpointId(id) {
|
|
38
36
|
const channel = channelClientsByEndpointId.get(id);
|
|
39
37
|
if (channel) {
|
|
40
|
-
__classPrivateFieldGet(channel,
|
|
38
|
+
__classPrivateFieldGet(channel, _ChannelClient_close, "f").call(channel);
|
|
41
39
|
}
|
|
42
40
|
}
|
|
43
41
|
// closes the channel and invokes the disconnect listener if an event payload is passed.
|
|
44
42
|
static handleProviderDisconnect(channel, eventPayload) {
|
|
45
43
|
channel.disconnectListener(eventPayload);
|
|
46
|
-
__classPrivateFieldGet(channel,
|
|
44
|
+
__classPrivateFieldGet(channel, _ChannelClient_close, "f").call(channel);
|
|
47
45
|
}
|
|
48
46
|
get providerIdentity() {
|
|
49
|
-
const protectedObj = __classPrivateFieldGet(this,
|
|
47
|
+
const protectedObj = __classPrivateFieldGet(this, _ChannelClient_protectedObj, "f");
|
|
50
48
|
return protectedObj.providerIdentity;
|
|
51
49
|
}
|
|
52
50
|
async dispatch(action, payload) {
|
|
53
|
-
if (__classPrivateFieldGet(this,
|
|
54
|
-
return __classPrivateFieldGet(this,
|
|
51
|
+
if (__classPrivateFieldGet(this, _ChannelClient_strategy, "f").isEndpointConnected(this.providerIdentity.channelId)) {
|
|
52
|
+
return __classPrivateFieldGet(this, _ChannelClient_strategy, "f").send(this.providerIdentity.channelId, action, payload);
|
|
55
53
|
}
|
|
56
54
|
throw new Error('The client you are trying to dispatch from is disconnected from the target provider.');
|
|
57
55
|
}
|
|
@@ -69,7 +67,7 @@ class ChannelClient extends channel_1.ChannelBase {
|
|
|
69
67
|
};
|
|
70
68
|
}
|
|
71
69
|
async disconnect() {
|
|
72
|
-
const protectedObj = __classPrivateFieldGet(this,
|
|
70
|
+
const protectedObj = __classPrivateFieldGet(this, _ChannelClient_protectedObj, "f");
|
|
73
71
|
const { channelName, uuid, name } = protectedObj.providerIdentity;
|
|
74
72
|
await protectedObj.wire.sendAction('disconnect-from-channel', {
|
|
75
73
|
channelName,
|
|
@@ -77,8 +75,8 @@ class ChannelClient extends channel_1.ChannelBase {
|
|
|
77
75
|
name,
|
|
78
76
|
endpointId: this.endpointId
|
|
79
77
|
});
|
|
80
|
-
__classPrivateFieldGet(this,
|
|
78
|
+
__classPrivateFieldGet(this, _ChannelClient_close, "f").call(this);
|
|
81
79
|
}
|
|
82
80
|
}
|
|
83
81
|
exports.default = ChannelClient;
|
|
84
|
-
|
|
82
|
+
_ChannelClient_protectedObj = new WeakMap(), _ChannelClient_strategy = new WeakMap(), _ChannelClient_close = new WeakMap();
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver,
|
|
3
|
-
if (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return value;
|
|
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;
|
|
8
7
|
};
|
|
9
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver,
|
|
10
|
-
if (!
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return privateMap.get(receiver);
|
|
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);
|
|
14
12
|
};
|
|
15
|
-
var
|
|
13
|
+
var _ConnectionManager_messageReceiver, _ConnectionManager_rtcConnectionManager;
|
|
16
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
15
|
exports.ConnectionManager = void 0;
|
|
18
16
|
const exhaustive_1 = require("../../../util/exhaustive");
|
|
@@ -27,8 +25,8 @@ const strategy_3 = require("./protocols/combined/strategy");
|
|
|
27
25
|
class ConnectionManager extends base_1.Base {
|
|
28
26
|
constructor(wire) {
|
|
29
27
|
super(wire);
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
_ConnectionManager_messageReceiver.set(this, void 0);
|
|
29
|
+
_ConnectionManager_rtcConnectionManager.set(this, void 0);
|
|
32
30
|
this.removeChannelFromProviderMap = (channelId) => {
|
|
33
31
|
this.providerMap.delete(channelId);
|
|
34
32
|
};
|
|
@@ -41,8 +39,8 @@ class ConnectionManager extends base_1.Base {
|
|
|
41
39
|
};
|
|
42
40
|
this.providerMap = new Map();
|
|
43
41
|
this.protocolManager = new protocol_manager_1.ProtocolManager(this.isNodeEnvironment() ? ['classic'] : ['rtc', 'classic']);
|
|
44
|
-
__classPrivateFieldSet(this,
|
|
45
|
-
__classPrivateFieldSet(this,
|
|
42
|
+
__classPrivateFieldSet(this, _ConnectionManager_messageReceiver, new message_receiver_1.MessageReceiver(wire), "f");
|
|
43
|
+
__classPrivateFieldSet(this, _ConnectionManager_rtcConnectionManager, new ice_manager_1.RTCICEManager(wire), "f");
|
|
46
44
|
wire.registerMessageHandler(this.onmessage.bind(this));
|
|
47
45
|
}
|
|
48
46
|
static getProtocolOptionsFromStrings(protocols) {
|
|
@@ -53,7 +51,7 @@ class ConnectionManager extends base_1.Base {
|
|
|
53
51
|
case 'classic':
|
|
54
52
|
return strategy_1.ClassicInfo;
|
|
55
53
|
default:
|
|
56
|
-
return exhaustive_1.exhaustiveCheck(protocol, ['rtc', 'classic']);
|
|
54
|
+
return (0, exhaustive_1.exhaustiveCheck)(protocol, ['rtc', 'classic']);
|
|
57
55
|
}
|
|
58
56
|
});
|
|
59
57
|
}
|
|
@@ -65,11 +63,11 @@ class ConnectionManager extends base_1.Base {
|
|
|
65
63
|
case 'rtc':
|
|
66
64
|
return new strategy_2.RTCStrategy();
|
|
67
65
|
case 'classic':
|
|
68
|
-
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet(this,
|
|
66
|
+
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet(this, _ConnectionManager_messageReceiver, "f"),
|
|
69
67
|
// Providers do not have an endpointId, use channelId as endpointId in the strategy.
|
|
70
68
|
providerIdentity.channelId, providerIdentity);
|
|
71
69
|
default:
|
|
72
|
-
return exhaustive_1.exhaustiveCheck(stratType, ['rtc', 'classic']);
|
|
70
|
+
return (0, exhaustive_1.exhaustiveCheck)(stratType, ['rtc', 'classic']);
|
|
73
71
|
}
|
|
74
72
|
};
|
|
75
73
|
const strategies = protocols.map(createSingleStrategy);
|
|
@@ -97,7 +95,7 @@ class ConnectionManager extends base_1.Base {
|
|
|
97
95
|
const supportedProtocols = await Promise.all(protocols.map(async (type) => {
|
|
98
96
|
switch (type) {
|
|
99
97
|
case 'rtc': {
|
|
100
|
-
const { rtcClient, channels, offer, rtcConnectionId, channelsOpened } = await __classPrivateFieldGet(this,
|
|
98
|
+
const { rtcClient, channels, offer, rtcConnectionId, channelsOpened } = await __classPrivateFieldGet(this, _ConnectionManager_rtcConnectionManager, "f").startClientOffer();
|
|
101
99
|
rtcPacket = { rtcClient, channels, channelsOpened };
|
|
102
100
|
return {
|
|
103
101
|
type: 'rtc',
|
|
@@ -108,7 +106,7 @@ class ConnectionManager extends base_1.Base {
|
|
|
108
106
|
case 'classic':
|
|
109
107
|
return { type: 'classic', version: strategy_1.ClassicInfo.version };
|
|
110
108
|
default:
|
|
111
|
-
return exhaustive_1.exhaustiveCheck(type, ['rtc', 'classic']);
|
|
109
|
+
return (0, exhaustive_1.exhaustiveCheck)(type, ['rtc', 'classic']);
|
|
112
110
|
}
|
|
113
111
|
}));
|
|
114
112
|
return {
|
|
@@ -125,18 +123,18 @@ class ConnectionManager extends base_1.Base {
|
|
|
125
123
|
routingInfo.endpointId = this.wire.environment.getNextMessageId();
|
|
126
124
|
// For New Clients connecting to Old Providers. To prevent multi-dispatching and publishing, we delete previously-connected
|
|
127
125
|
// clients that are in the same context as the newly-connected client.
|
|
128
|
-
__classPrivateFieldGet(this,
|
|
126
|
+
__classPrivateFieldGet(this, _ConnectionManager_messageReceiver, "f").checkForPreviousClientConnection(routingInfo.channelId);
|
|
129
127
|
}
|
|
130
128
|
const answer = (_a = routingInfo.answer) !== null && _a !== void 0 ? _a : {
|
|
131
129
|
supportedProtocols: [{ type: 'classic', version: 1 }]
|
|
132
130
|
};
|
|
133
131
|
const createStrategyFromAnswer = async (protocol) => {
|
|
134
132
|
if (protocol.type === 'rtc' && rtcPacket) {
|
|
135
|
-
await __classPrivateFieldGet(this,
|
|
133
|
+
await __classPrivateFieldGet(this, _ConnectionManager_rtcConnectionManager, "f").finishClientOffer(rtcPacket.rtcClient, protocol.payload.answer, rtcPacket.channelsOpened);
|
|
136
134
|
return new strategy_2.RTCStrategy();
|
|
137
135
|
}
|
|
138
136
|
if (protocol.type === 'classic') {
|
|
139
|
-
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet(this,
|
|
137
|
+
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet(this, _ConnectionManager_messageReceiver, "f"), routingInfo.endpointId, routingInfo);
|
|
140
138
|
}
|
|
141
139
|
return null;
|
|
142
140
|
};
|
|
@@ -204,7 +202,7 @@ class ConnectionManager extends base_1.Base {
|
|
|
204
202
|
clientAnswer = await overlappingProtocols.reduce(async (accumP, protocolToUse) => {
|
|
205
203
|
const answer = await accumP;
|
|
206
204
|
if (protocolToUse.type === 'rtc') {
|
|
207
|
-
const { answer: rtcAnswer, rtcClient, channels } = await __classPrivateFieldGet(this,
|
|
205
|
+
const { answer: rtcAnswer, rtcClient, channels } = await __classPrivateFieldGet(this, _ConnectionManager_rtcConnectionManager, "f").createProviderAnswer(protocolToUse.payload.rtcConnectionId, protocolToUse.payload.offer);
|
|
208
206
|
answer.supportedProtocols.push({
|
|
209
207
|
type: 'rtc',
|
|
210
208
|
version: strategy_2.RTCInfo.version,
|
|
@@ -241,4 +239,4 @@ class ConnectionManager extends base_1.Base {
|
|
|
241
239
|
}
|
|
242
240
|
}
|
|
243
241
|
exports.ConnectionManager = ConnectionManager;
|
|
244
|
-
|
|
242
|
+
_ConnectionManager_messageReceiver = new WeakMap(), _ConnectionManager_rtcConnectionManager = new WeakMap();
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver,
|
|
3
|
-
if (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return value;
|
|
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;
|
|
8
7
|
};
|
|
9
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver,
|
|
10
|
-
if (!
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return privateMap.get(receiver);
|
|
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);
|
|
14
12
|
};
|
|
15
|
-
var
|
|
13
|
+
var _Channel_connectionManager;
|
|
16
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
15
|
exports.Channel = void 0;
|
|
18
16
|
/* eslint-disable no-console */
|
|
@@ -25,8 +23,8 @@ const noop = () => { };
|
|
|
25
23
|
class Channel extends base_1.EmitterBase {
|
|
26
24
|
constructor(wire) {
|
|
27
25
|
super(wire, 'channel');
|
|
28
|
-
|
|
29
|
-
__classPrivateFieldSet(this,
|
|
26
|
+
_Channel_connectionManager.set(this, void 0);
|
|
27
|
+
__classPrivateFieldSet(this, _Channel_connectionManager, new connection_manager_1.ConnectionManager(wire), "f");
|
|
30
28
|
}
|
|
31
29
|
async getAllChannels() {
|
|
32
30
|
return this.wire.sendAction('get-all-channels').then(({ payload }) => payload.data);
|
|
@@ -55,7 +53,7 @@ class Channel extends base_1.EmitterBase {
|
|
|
55
53
|
this.on('connected', listener);
|
|
56
54
|
});
|
|
57
55
|
try {
|
|
58
|
-
const { offer, rtc: rtcPacket } = await __classPrivateFieldGet(this,
|
|
56
|
+
const { offer, rtc: rtcPacket } = await __classPrivateFieldGet(this, _Channel_connectionManager, "f").createClientOffer(opts);
|
|
59
57
|
const res = await this.wire.sendAction('connect-to-channel', { channelName, ...opts, offer });
|
|
60
58
|
const { payload: { data: routingInfo } } = res;
|
|
61
59
|
// If there isn't a matching channel, the above sendAction call will error out and go to catch, skipping the logic below.
|
|
@@ -63,7 +61,7 @@ class Channel extends base_1.EmitterBase {
|
|
|
63
61
|
resolver();
|
|
64
62
|
}
|
|
65
63
|
this.removeListener('connected', listener);
|
|
66
|
-
const strategy = await __classPrivateFieldGet(this,
|
|
64
|
+
const strategy = await __classPrivateFieldGet(this, _Channel_connectionManager, "f").createClientStrategy(rtcPacket, routingInfo);
|
|
67
65
|
const channel = new client_1.default(routingInfo, this.wire, strategy);
|
|
68
66
|
// It is the client's responsibility to handle endpoint disconnection to the provider.
|
|
69
67
|
// If the endpoint dies, the client will force a disconnection through the core.
|
|
@@ -106,7 +104,7 @@ class Channel extends base_1.EmitterBase {
|
|
|
106
104
|
throw new Error('Please provide a channelName to create a channel');
|
|
107
105
|
}
|
|
108
106
|
const { payload: { data: providerIdentity } } = await this.wire.sendAction('create-channel', { channelName });
|
|
109
|
-
const channel = __classPrivateFieldGet(this,
|
|
107
|
+
const channel = __classPrivateFieldGet(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
|
|
110
108
|
this.on('client-disconnected', (eventPayload) => {
|
|
111
109
|
if (eventPayload.channelName === channelName) {
|
|
112
110
|
provider_1.ChannelProvider.handleClientDisconnection(channel, eventPayload);
|
|
@@ -116,4 +114,4 @@ class Channel extends base_1.EmitterBase {
|
|
|
116
114
|
}
|
|
117
115
|
}
|
|
118
116
|
exports.Channel = Channel;
|
|
119
|
-
|
|
117
|
+
_Channel_connectionManager = new WeakMap();
|