@openfin/remote-adapter 41.103.3 → 42.100.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/out/remote-adapter.js +215 -346
- package/package.json +2 -2
package/out/remote-adapter.js
CHANGED
|
@@ -49,13 +49,13 @@ async function promiseMapSerial(arr, func) {
|
|
|
49
49
|
}
|
|
50
50
|
promises.promiseMapSerial = promiseMapSerial;
|
|
51
51
|
|
|
52
|
-
var __classPrivateFieldSet$
|
|
52
|
+
var __classPrivateFieldSet$g = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
53
53
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
54
54
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
55
55
|
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");
|
|
56
56
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
57
57
|
};
|
|
58
|
-
var __classPrivateFieldGet$
|
|
58
|
+
var __classPrivateFieldGet$h = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
59
59
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
60
60
|
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");
|
|
61
61
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -140,7 +140,7 @@ class EmitterBase extends Base {
|
|
|
140
140
|
this.emit = (eventType, payload, ...args) => {
|
|
141
141
|
return this.hasEmitter() ? this.getOrCreateEmitter().emit(eventType, payload, ...args) : false;
|
|
142
142
|
};
|
|
143
|
-
this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet$
|
|
143
|
+
this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet$h(this, _EmitterBase_emitterAccessor, "f"));
|
|
144
144
|
/**
|
|
145
145
|
* Cleans up after removal of a listener, e.g. deleting any lingering deregistration handlers for a
|
|
146
146
|
* `once` subscription.
|
|
@@ -150,14 +150,14 @@ class EmitterBase extends Base {
|
|
|
150
150
|
* which would involve less "magic," but would be more-vulnerable to accidental re-introduction of a leak.
|
|
151
151
|
*/
|
|
152
152
|
this.cleanUpRemovedListener = (eventType, listener) => {
|
|
153
|
-
const deregister = __classPrivateFieldGet$
|
|
153
|
+
const deregister = __classPrivateFieldGet$h(this, _EmitterBase_deregisterOnceListeners, "f").get(listener);
|
|
154
154
|
if (deregister) {
|
|
155
|
-
const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$
|
|
155
|
+
const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$h(this, _EmitterBase_emitterAccessor, "f"));
|
|
156
156
|
emitter.removeListener(eventType, deregister);
|
|
157
157
|
}
|
|
158
158
|
};
|
|
159
159
|
this.getOrCreateEmitter = () => {
|
|
160
|
-
const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$
|
|
160
|
+
const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$h(this, _EmitterBase_emitterAccessor, "f"));
|
|
161
161
|
if (!emitter.listeners('removeListener').includes(this.cleanUpRemovedListener)) {
|
|
162
162
|
emitter.on('removeListener', this.cleanUpRemovedListener);
|
|
163
163
|
}
|
|
@@ -199,8 +199,8 @@ class EmitterBase extends Base {
|
|
|
199
199
|
// This will only be reached if unsubscribe from event that does not exist but do not want to error here
|
|
200
200
|
return Promise.resolve();
|
|
201
201
|
};
|
|
202
|
-
__classPrivateFieldSet$
|
|
203
|
-
__classPrivateFieldSet$
|
|
202
|
+
__classPrivateFieldSet$g(this, _EmitterBase_emitterAccessor, [topic, ...additionalAccessors], "f");
|
|
203
|
+
__classPrivateFieldSet$g(this, _EmitterBase_deregisterOnceListeners, new WeakMap(), "f");
|
|
204
204
|
this.listeners = (event) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(event) : [];
|
|
205
205
|
}
|
|
206
206
|
/**
|
|
@@ -229,7 +229,7 @@ class EmitterBase extends Base {
|
|
|
229
229
|
*/
|
|
230
230
|
async once(eventType, listener, options) {
|
|
231
231
|
const deregister = () => this.deregisterEventListener(eventType);
|
|
232
|
-
__classPrivateFieldGet$
|
|
232
|
+
__classPrivateFieldGet$h(this, _EmitterBase_deregisterOnceListeners, "f").set(listener, deregister);
|
|
233
233
|
await this.registerEventListener(eventType, options, (emitter) => {
|
|
234
234
|
emitter.once(eventType, deregister);
|
|
235
235
|
emitter.once(eventType, listener);
|
|
@@ -260,7 +260,7 @@ class EmitterBase extends Base {
|
|
|
260
260
|
*/
|
|
261
261
|
async prependOnceListener(eventType, listener, options) {
|
|
262
262
|
const deregister = () => this.deregisterEventListener(eventType);
|
|
263
|
-
__classPrivateFieldGet$
|
|
263
|
+
__classPrivateFieldGet$h(this, _EmitterBase_deregisterOnceListeners, "f").set(listener, deregister);
|
|
264
264
|
await this.registerEventListener(eventType, options, (emitter) => {
|
|
265
265
|
emitter.prependOnceListener(eventType, listener);
|
|
266
266
|
emitter.once(eventType, deregister);
|
|
@@ -320,7 +320,7 @@ class EmitterBase extends Base {
|
|
|
320
320
|
}
|
|
321
321
|
deleteEmitterIfNothingRegistered(emitter) {
|
|
322
322
|
if (emitter.eventNames().every((type) => type === 'removeListener')) {
|
|
323
|
-
this.wire.eventAggregator.delete(__classPrivateFieldGet$
|
|
323
|
+
this.wire.eventAggregator.delete(__classPrivateFieldGet$h(this, _EmitterBase_emitterAccessor, "f"));
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
326
|
}
|
|
@@ -523,7 +523,7 @@ Object.defineProperty(PrivateChannelProvider$1, "__esModule", { value: true });
|
|
|
523
523
|
PrivateChannelProvider$1.PrivateChannelProvider = void 0;
|
|
524
524
|
const utils_1$8 = utils$3;
|
|
525
525
|
class PrivateChannelProvider {
|
|
526
|
-
constructor(provider, id
|
|
526
|
+
constructor(provider, id) {
|
|
527
527
|
this.provider = provider;
|
|
528
528
|
this.id = id;
|
|
529
529
|
this.clients = new Map();
|
|
@@ -531,7 +531,6 @@ class PrivateChannelProvider {
|
|
|
531
531
|
this.contextByContextType = new Map();
|
|
532
532
|
this.lastContext = undefined;
|
|
533
533
|
this.provider.onConnection((clientIdentity) => this.registerNewClient(clientIdentity));
|
|
534
|
-
this.removePrivateChannelProvider = removePrivateChannelProvider;
|
|
535
534
|
this.provider.onDisconnection(async (clientIdentity) => {
|
|
536
535
|
const { endpointId } = clientIdentity;
|
|
537
536
|
if (this.clients.has(endpointId)) {
|
|
@@ -539,7 +538,6 @@ class PrivateChannelProvider {
|
|
|
539
538
|
}
|
|
540
539
|
if ((await this.provider.getAllClientInfo()).length === 0) {
|
|
541
540
|
this.provider.destroy();
|
|
542
|
-
this.removePrivateChannelProvider(this.id);
|
|
543
541
|
}
|
|
544
542
|
});
|
|
545
543
|
}
|
|
@@ -791,8 +789,8 @@ class PrivateChannelProvider {
|
|
|
791
789
|
});
|
|
792
790
|
});
|
|
793
791
|
}
|
|
794
|
-
static init(channelProvider, id
|
|
795
|
-
return new PrivateChannelProvider(channelProvider, id
|
|
792
|
+
static init(channelProvider, id) {
|
|
793
|
+
return new PrivateChannelProvider(channelProvider, id);
|
|
796
794
|
}
|
|
797
795
|
}
|
|
798
796
|
PrivateChannelProvider$1.PrivateChannelProvider = PrivateChannelProvider;
|
|
@@ -853,27 +851,27 @@ class AsyncRetryableLazy {
|
|
|
853
851
|
}
|
|
854
852
|
lazy.AsyncRetryableLazy = AsyncRetryableLazy;
|
|
855
853
|
|
|
856
|
-
var __classPrivateFieldSet$
|
|
854
|
+
var __classPrivateFieldSet$f = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
857
855
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
858
856
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
859
857
|
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");
|
|
860
858
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
861
859
|
};
|
|
862
|
-
var __classPrivateFieldGet$
|
|
860
|
+
var __classPrivateFieldGet$g = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
863
861
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
864
862
|
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");
|
|
865
863
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
866
864
|
};
|
|
867
|
-
var __importDefault$
|
|
865
|
+
var __importDefault$6 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
868
866
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
869
867
|
};
|
|
870
868
|
var _InteropBroker_fdc3Info, _InteropBroker_contextGroups, _InteropBroker_providerPromise;
|
|
871
869
|
Object.defineProperty(InteropBroker$1, "__esModule", { value: true });
|
|
872
870
|
InteropBroker$1.InteropBroker = void 0;
|
|
873
871
|
const base_1$m = base;
|
|
874
|
-
const SessionContextGroupBroker_1 = __importDefault$
|
|
872
|
+
const SessionContextGroupBroker_1 = __importDefault$6(SessionContextGroupBroker$1);
|
|
875
873
|
const utils_1$7 = utils$3;
|
|
876
|
-
const isEqual_1$
|
|
874
|
+
const isEqual_1$1 = __importDefault$6(require$$3);
|
|
877
875
|
const PrivateChannelProvider_1 = PrivateChannelProvider$1;
|
|
878
876
|
const lazy_1$2 = lazy;
|
|
879
877
|
const defaultContextGroups = [
|
|
@@ -1050,20 +1048,19 @@ class InteropBroker extends base_1$m.Base {
|
|
|
1050
1048
|
_InteropBroker_contextGroups.set(this, void 0);
|
|
1051
1049
|
_InteropBroker_providerPromise.set(this, void 0);
|
|
1052
1050
|
this.getProvider = () => {
|
|
1053
|
-
return __classPrivateFieldGet$
|
|
1051
|
+
return __classPrivateFieldGet$g(this, _InteropBroker_providerPromise, "f").getValue();
|
|
1054
1052
|
};
|
|
1055
1053
|
this.interopClients = new Map();
|
|
1056
1054
|
this.contextGroupsById = new Map();
|
|
1057
|
-
__classPrivateFieldSet$
|
|
1058
|
-
__classPrivateFieldSet$
|
|
1055
|
+
__classPrivateFieldSet$f(this, _InteropBroker_contextGroups, options.contextGroups ?? [...defaultContextGroups], "f");
|
|
1056
|
+
__classPrivateFieldSet$f(this, _InteropBroker_fdc3Info, options.fdc3Info, "f");
|
|
1059
1057
|
if (options?.logging) {
|
|
1060
1058
|
this.logging = options.logging;
|
|
1061
1059
|
}
|
|
1062
1060
|
this.intentClientMap = new Map();
|
|
1063
1061
|
this.lastContextMap = new Map();
|
|
1064
1062
|
this.sessionContextGroupMap = new Map();
|
|
1065
|
-
this
|
|
1066
|
-
__classPrivateFieldSet$g(this, _InteropBroker_providerPromise, new lazy_1$2.Lazy(createProvider), "f");
|
|
1063
|
+
__classPrivateFieldSet$f(this, _InteropBroker_providerPromise, new lazy_1$2.Lazy(createProvider), "f");
|
|
1067
1064
|
this.setContextGroupMap();
|
|
1068
1065
|
this.setupChannelProvider();
|
|
1069
1066
|
}
|
|
@@ -1072,7 +1069,7 @@ class InteropBroker extends base_1$m.Base {
|
|
|
1072
1069
|
constructor(...unused) {
|
|
1073
1070
|
if (unused.length) {
|
|
1074
1071
|
const [_ignore1, ignore2, opts] = unused;
|
|
1075
|
-
if (opts && typeof opts === 'object' && !(0, isEqual_1$
|
|
1072
|
+
if (opts && typeof opts === 'object' && !(0, isEqual_1$1.default)(opts, args[2])) {
|
|
1076
1073
|
// eslint-disable-next-line no-console
|
|
1077
1074
|
console.warn('You have modified the parameters of the InteropOverride constructor. This behavior is deprecated and will be removed in a future version. You can modify these options in your manifest. Please consult our Interop docs for guidance on migrating to the new override scheme.');
|
|
1078
1075
|
super(args[0], args[1], opts);
|
|
@@ -1331,7 +1328,7 @@ class InteropBroker extends base_1$m.Base {
|
|
|
1331
1328
|
// don't expose, analytics-only call
|
|
1332
1329
|
});
|
|
1333
1330
|
// Create copy for immutability
|
|
1334
|
-
return __classPrivateFieldGet$
|
|
1331
|
+
return __classPrivateFieldGet$g(this, _InteropBroker_contextGroups, "f").map((contextGroup) => {
|
|
1335
1332
|
return { ...contextGroup };
|
|
1336
1333
|
});
|
|
1337
1334
|
}
|
|
@@ -1742,7 +1739,7 @@ class InteropBroker extends base_1$m.Base {
|
|
|
1742
1739
|
const { fdc3Version } = payload;
|
|
1743
1740
|
return {
|
|
1744
1741
|
fdc3Version,
|
|
1745
|
-
...__classPrivateFieldGet$
|
|
1742
|
+
...__classPrivateFieldGet$g(this, _InteropBroker_fdc3Info, "f"),
|
|
1746
1743
|
optionalFeatures: {
|
|
1747
1744
|
OriginatingAppMetadata: false,
|
|
1748
1745
|
UserChannelMembershipAPIs: true
|
|
@@ -2049,9 +2046,7 @@ class InteropBroker extends base_1$m.Base {
|
|
|
2049
2046
|
});
|
|
2050
2047
|
channel.afterAction((action, payload, clientIdentity) => {
|
|
2051
2048
|
if (this.logging?.afterAction?.enabled) {
|
|
2052
|
-
|
|
2053
|
-
const logArgs = payload ? [action, payload, clientIdentity] : [action, clientIdentity];
|
|
2054
|
-
console.log(...logArgs);
|
|
2049
|
+
console.log(action, payload, clientIdentity);
|
|
2055
2050
|
}
|
|
2056
2051
|
});
|
|
2057
2052
|
// Client functions
|
|
@@ -2083,15 +2078,7 @@ class InteropBroker extends base_1$m.Base {
|
|
|
2083
2078
|
channel.register('createPrivateChannelProvider', async (payload) => {
|
|
2084
2079
|
const { channelId } = payload;
|
|
2085
2080
|
const channelProvider = await this.fin.InterApplicationBus.Channel.create(channelId);
|
|
2086
|
-
|
|
2087
|
-
this.privateChannelProviderMap.delete(channelId);
|
|
2088
|
-
};
|
|
2089
|
-
const privateChannelProvider = PrivateChannelProvider_1.PrivateChannelProvider.init(channelProvider, channelId, removePrivateChannelProvider);
|
|
2090
|
-
this.privateChannelProviderMap.set(channelId, privateChannelProvider);
|
|
2091
|
-
});
|
|
2092
|
-
channel.register('isIdUsedByPrivateChannel', async (payload) => {
|
|
2093
|
-
const { channelId } = payload;
|
|
2094
|
-
return this.privateChannelProviderMap.has(channelId);
|
|
2081
|
+
PrivateChannelProvider_1.PrivateChannelProvider.init(channelProvider, channelId);
|
|
2095
2082
|
});
|
|
2096
2083
|
}
|
|
2097
2084
|
/**
|
|
@@ -5142,37 +5129,6 @@ function requireInstance$1 () {
|
|
|
5142
5129
|
getAllFrames() {
|
|
5143
5130
|
return this.wire.sendAction('get-all-frames', this.identity).then(({ payload }) => payload.data);
|
|
5144
5131
|
}
|
|
5145
|
-
/**
|
|
5146
|
-
* Activates the current window and focuses the child entity if it exists. If this does
|
|
5147
|
-
* not succeed - say the child does not belong to this window, or the identity does not exist -
|
|
5148
|
-
* it will return false.
|
|
5149
|
-
*
|
|
5150
|
-
* @example
|
|
5151
|
-
* ```js
|
|
5152
|
-
* const win = fin.Window.wrapSync({ uuid: 'myApp', name: 'myOtherWindow' });
|
|
5153
|
-
*
|
|
5154
|
-
* win.getCurrentViews()
|
|
5155
|
-
* .then(([view1]) => {
|
|
5156
|
-
* return win.activateAndFocus(view1.identity);
|
|
5157
|
-
* })
|
|
5158
|
-
* .then(success => {
|
|
5159
|
-
* if (success) {
|
|
5160
|
-
* console.log('Window activated and child focused');
|
|
5161
|
-
* } else {
|
|
5162
|
-
* console.log('Window activation failed, focus state unchanged');
|
|
5163
|
-
* }
|
|
5164
|
-
* })
|
|
5165
|
-
* .catch(console.error);
|
|
5166
|
-
* ```
|
|
5167
|
-
*/
|
|
5168
|
-
activateAndFocus(childIdentityToFocus) {
|
|
5169
|
-
return this.wire
|
|
5170
|
-
.sendAction('activate-window-and-focus', {
|
|
5171
|
-
winIdentity: this.identity,
|
|
5172
|
-
focusIdentity: childIdentityToFocus
|
|
5173
|
-
})
|
|
5174
|
-
.then(({ payload }) => payload.data);
|
|
5175
|
-
}
|
|
5176
5132
|
/**
|
|
5177
5133
|
* Gets the current bounds (top, bottom, right, left, width, height) of the window.
|
|
5178
5134
|
*
|
|
@@ -7588,18 +7544,18 @@ function errorToPOJO(error) {
|
|
|
7588
7544
|
}
|
|
7589
7545
|
errors.errorToPOJO = errorToPOJO;
|
|
7590
7546
|
|
|
7591
|
-
var __classPrivateFieldSet$
|
|
7547
|
+
var __classPrivateFieldSet$e = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
7592
7548
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
7593
7549
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
7594
7550
|
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");
|
|
7595
7551
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7596
7552
|
};
|
|
7597
|
-
var __classPrivateFieldGet$
|
|
7553
|
+
var __classPrivateFieldGet$f = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
7598
7554
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
7599
7555
|
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");
|
|
7600
7556
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
7601
7557
|
};
|
|
7602
|
-
var __importDefault$
|
|
7558
|
+
var __importDefault$5 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
7603
7559
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7604
7560
|
};
|
|
7605
7561
|
var _Transport_wire, _Transport_fin;
|
|
@@ -7608,11 +7564,11 @@ var Transport_1 = transport.Transport = void 0;
|
|
|
7608
7564
|
const events_1$5 = require$$0;
|
|
7609
7565
|
const wire_1 = wire;
|
|
7610
7566
|
const transport_errors_1$6 = transportErrors;
|
|
7611
|
-
const eventAggregator_1 = __importDefault$
|
|
7567
|
+
const eventAggregator_1 = __importDefault$5(eventAggregator);
|
|
7612
7568
|
const me_1$1 = me;
|
|
7613
7569
|
const errors_1$2 = errors;
|
|
7614
7570
|
class Transport extends events_1$5.EventEmitter {
|
|
7615
|
-
constructor(
|
|
7571
|
+
constructor(WireType, environment, config) {
|
|
7616
7572
|
super();
|
|
7617
7573
|
this.wireListeners = new Map();
|
|
7618
7574
|
this.topicRefMap = new Map();
|
|
@@ -7622,19 +7578,19 @@ class Transport extends events_1$5.EventEmitter {
|
|
|
7622
7578
|
// Typing as unknown to avoid circular dependency, should not be used directly.
|
|
7623
7579
|
_Transport_fin.set(this, void 0);
|
|
7624
7580
|
this.connectSync = () => {
|
|
7625
|
-
const wire = __classPrivateFieldGet$
|
|
7581
|
+
const wire = __classPrivateFieldGet$f(this, _Transport_wire, "f");
|
|
7626
7582
|
wire.connectSync();
|
|
7627
7583
|
};
|
|
7628
7584
|
// This function is only used in our tests.
|
|
7629
7585
|
this.getPort = () => {
|
|
7630
|
-
const wire = __classPrivateFieldGet$
|
|
7586
|
+
const wire = __classPrivateFieldGet$f(this, _Transport_wire, "f");
|
|
7631
7587
|
return wire.getPort();
|
|
7632
7588
|
};
|
|
7633
|
-
__classPrivateFieldSet$
|
|
7589
|
+
__classPrivateFieldSet$e(this, _Transport_wire, new WireType(this.onmessage.bind(this)), "f");
|
|
7634
7590
|
this.environment = environment;
|
|
7635
|
-
this.sendRaw = __classPrivateFieldGet$
|
|
7591
|
+
this.sendRaw = __classPrivateFieldGet$f(this, _Transport_wire, "f").send.bind(__classPrivateFieldGet$f(this, _Transport_wire, "f"));
|
|
7636
7592
|
this.registerMessageHandler(this.handleMessage.bind(this));
|
|
7637
|
-
__classPrivateFieldGet$
|
|
7593
|
+
__classPrivateFieldGet$f(this, _Transport_wire, "f").on('disconnected', () => {
|
|
7638
7594
|
for (const [, { handleNack }] of this.wireListeners) {
|
|
7639
7595
|
handleNack({ reason: 'Remote connection has closed' });
|
|
7640
7596
|
}
|
|
@@ -7646,24 +7602,24 @@ class Transport extends events_1$5.EventEmitter {
|
|
|
7646
7602
|
this.me = (0, me_1$1.getBaseMe)(entityType, uuid, name);
|
|
7647
7603
|
}
|
|
7648
7604
|
getFin() {
|
|
7649
|
-
if (!__classPrivateFieldGet$
|
|
7605
|
+
if (!__classPrivateFieldGet$f(this, _Transport_fin, "f")) {
|
|
7650
7606
|
throw new Error('No Fin object registered for this transport');
|
|
7651
7607
|
}
|
|
7652
|
-
return __classPrivateFieldGet$
|
|
7608
|
+
return __classPrivateFieldGet$f(this, _Transport_fin, "f");
|
|
7653
7609
|
}
|
|
7654
7610
|
registerFin(_fin) {
|
|
7655
|
-
if (__classPrivateFieldGet$
|
|
7611
|
+
if (__classPrivateFieldGet$f(this, _Transport_fin, "f")) {
|
|
7656
7612
|
throw new Error('Fin object has already been registered for this transport');
|
|
7657
7613
|
}
|
|
7658
|
-
__classPrivateFieldSet$
|
|
7614
|
+
__classPrivateFieldSet$e(this, _Transport_fin, _fin, "f");
|
|
7659
7615
|
}
|
|
7660
7616
|
shutdown() {
|
|
7661
|
-
const wire = __classPrivateFieldGet$
|
|
7617
|
+
const wire = __classPrivateFieldGet$f(this, _Transport_wire, "f");
|
|
7662
7618
|
return wire.shutdown();
|
|
7663
7619
|
}
|
|
7664
7620
|
async connect(config) {
|
|
7665
7621
|
if ((0, wire_1.isConfigWithReceiver)(config)) {
|
|
7666
|
-
await __classPrivateFieldGet$
|
|
7622
|
+
await __classPrivateFieldGet$f(this, _Transport_wire, "f").connect(config.receiver);
|
|
7667
7623
|
return this.authorize(config);
|
|
7668
7624
|
}
|
|
7669
7625
|
if ((0, wire_1.isRemoteConfig)(config)) {
|
|
@@ -7679,13 +7635,13 @@ class Transport extends events_1$5.EventEmitter {
|
|
|
7679
7635
|
return undefined;
|
|
7680
7636
|
}
|
|
7681
7637
|
async connectRemote(config) {
|
|
7682
|
-
await __classPrivateFieldGet$
|
|
7638
|
+
await __classPrivateFieldGet$f(this, _Transport_wire, "f").connect(new (this.environment.getWsConstructor())(config.address));
|
|
7683
7639
|
return this.authorize(config);
|
|
7684
7640
|
}
|
|
7685
7641
|
async connectByPort(config) {
|
|
7686
7642
|
const { address, uuid } = config;
|
|
7687
7643
|
const reqAuthPayload = { ...config, type: 'file-token' };
|
|
7688
|
-
const wire = __classPrivateFieldGet$
|
|
7644
|
+
const wire = __classPrivateFieldGet$f(this, _Transport_wire, "f");
|
|
7689
7645
|
await wire.connect(new (this.environment.getWsConstructor())(config.address));
|
|
7690
7646
|
const requestExtAuthRet = await this.sendAction('request-external-authorization', {
|
|
7691
7647
|
uuid,
|
|
@@ -7721,7 +7677,7 @@ class Transport extends events_1$5.EventEmitter {
|
|
|
7721
7677
|
payload,
|
|
7722
7678
|
messageId
|
|
7723
7679
|
};
|
|
7724
|
-
const wire = __classPrivateFieldGet$
|
|
7680
|
+
const wire = __classPrivateFieldGet$f(this, _Transport_wire, "f");
|
|
7725
7681
|
this.addWireListener(messageId, resolve, (payload) => this.nackHandler(payload, reject, callSites), uncorrelated);
|
|
7726
7682
|
return wire.send(msg).catch(reject);
|
|
7727
7683
|
});
|
|
@@ -7743,7 +7699,7 @@ class Transport extends events_1$5.EventEmitter {
|
|
|
7743
7699
|
const resolver = (data) => {
|
|
7744
7700
|
resolve(data.payload);
|
|
7745
7701
|
};
|
|
7746
|
-
const wire = __classPrivateFieldGet$
|
|
7702
|
+
const wire = __classPrivateFieldGet$f(this, _Transport_wire, "f");
|
|
7747
7703
|
return wire
|
|
7748
7704
|
.send(origData)
|
|
7749
7705
|
.then(() => this.addWireListener(id, resolver, (payload) => this.nackHandler(payload, reject), false))
|
|
@@ -9707,7 +9663,7 @@ class System extends base_1$g.EmitterBase {
|
|
|
9707
9663
|
* ```
|
|
9708
9664
|
*/
|
|
9709
9665
|
async getDomainSettings() {
|
|
9710
|
-
const { payload: { data } } = await this.wire.sendAction('get-domain-settings');
|
|
9666
|
+
const { payload: { data } } = await this.wire.sendAction('get-domain-settings', this.identity);
|
|
9711
9667
|
return data;
|
|
9712
9668
|
}
|
|
9713
9669
|
/**
|
|
@@ -9768,13 +9724,7 @@ class System extends base_1$g.EmitterBase {
|
|
|
9768
9724
|
* ```
|
|
9769
9725
|
*/
|
|
9770
9726
|
async setDomainSettings(domainSettings) {
|
|
9771
|
-
await this.wire.sendAction('set-domain-settings', { domainSettings });
|
|
9772
|
-
}
|
|
9773
|
-
async getCurrentDomainSettings(identity) {
|
|
9774
|
-
return (await this.wire.sendAction('get-current-domain-settings', { identity })).payload.data;
|
|
9775
|
-
}
|
|
9776
|
-
async resolveDomainSettings(url) {
|
|
9777
|
-
return (await this.wire.sendAction('resolve-domain-settings', { url })).payload.data;
|
|
9727
|
+
await this.wire.sendAction('set-domain-settings', { domainSettings, ...this.identity });
|
|
9778
9728
|
}
|
|
9779
9729
|
/**
|
|
9780
9730
|
* Attempts to install and enable extensions for the security realm. Users may want to call this function in response
|
|
@@ -9891,9 +9841,9 @@ class ChannelBase {
|
|
|
9891
9841
|
}
|
|
9892
9842
|
async processAction(topic, payload, senderIdentity) {
|
|
9893
9843
|
try {
|
|
9894
|
-
const
|
|
9895
|
-
|
|
9896
|
-
|
|
9844
|
+
const mainAction = this.subscriptions.has(topic)
|
|
9845
|
+
? this.subscriptions.get(topic)
|
|
9846
|
+
: (currentPayload, id) => (this.defaultAction ?? ChannelBase.defaultAction)(topic, currentPayload, id);
|
|
9897
9847
|
const preActionProcessed = this.preAction ? await this.preAction(topic, payload, senderIdentity) : payload;
|
|
9898
9848
|
const actionProcessed = await mainAction(preActionProcessed, senderIdentity);
|
|
9899
9849
|
return this.postAction ? await this.postAction(topic, actionProcessed, senderIdentity) : actionProcessed;
|
|
@@ -10220,12 +10170,12 @@ class ChannelError extends Error {
|
|
|
10220
10170
|
}
|
|
10221
10171
|
channelError.ChannelError = ChannelError;
|
|
10222
10172
|
|
|
10223
|
-
var __classPrivateFieldGet$
|
|
10173
|
+
var __classPrivateFieldGet$e = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
10224
10174
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10225
10175
|
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");
|
|
10226
10176
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
10227
10177
|
};
|
|
10228
|
-
var __classPrivateFieldSet$
|
|
10178
|
+
var __classPrivateFieldSet$d = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
10229
10179
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
10230
10180
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
10231
10181
|
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");
|
|
@@ -10269,7 +10219,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
|
10269
10219
|
static closeChannelByEndpointId(id) {
|
|
10270
10220
|
const channel = channelClientsByEndpointId.get(id);
|
|
10271
10221
|
if (channel) {
|
|
10272
|
-
__classPrivateFieldGet$
|
|
10222
|
+
__classPrivateFieldGet$e(channel, _ChannelClient_close, "f").call(channel);
|
|
10273
10223
|
}
|
|
10274
10224
|
}
|
|
10275
10225
|
/**
|
|
@@ -10280,7 +10230,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
|
10280
10230
|
for (const channelClient of channelClientsByEndpointId.values()) {
|
|
10281
10231
|
if (channelClient.providerIdentity.channelId === eventPayload.channelId) {
|
|
10282
10232
|
channelClient.disconnectListener(eventPayload);
|
|
10283
|
-
__classPrivateFieldGet$
|
|
10233
|
+
__classPrivateFieldGet$e(channelClient, _ChannelClient_close, "f").call(channelClient);
|
|
10284
10234
|
}
|
|
10285
10235
|
}
|
|
10286
10236
|
}
|
|
@@ -10295,12 +10245,12 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
|
10295
10245
|
this.processAction = (action, payload, senderIdentity) => super.processAction(action, payload, senderIdentity);
|
|
10296
10246
|
_ChannelClient_close.set(this, () => {
|
|
10297
10247
|
channelClientsByEndpointId.delete(this.endpointId);
|
|
10298
|
-
__classPrivateFieldGet$
|
|
10248
|
+
__classPrivateFieldGet$e(this, _ChannelClient_strategy, "f").close();
|
|
10299
10249
|
});
|
|
10300
|
-
__classPrivateFieldSet$
|
|
10250
|
+
__classPrivateFieldSet$d(this, _ChannelClient_protectedObj, new channel_1$1.ProtectedItems(routingInfo, close), "f");
|
|
10301
10251
|
this.disconnectListener = () => undefined;
|
|
10302
10252
|
this.endpointId = routingInfo.endpointId;
|
|
10303
|
-
__classPrivateFieldSet$
|
|
10253
|
+
__classPrivateFieldSet$d(this, _ChannelClient_strategy, strategy, "f");
|
|
10304
10254
|
channelClientsByEndpointId.set(this.endpointId, this);
|
|
10305
10255
|
strategy.receive(this.processAction);
|
|
10306
10256
|
}
|
|
@@ -10308,7 +10258,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
|
10308
10258
|
* a read-only provider identity
|
|
10309
10259
|
*/
|
|
10310
10260
|
get providerIdentity() {
|
|
10311
|
-
const protectedObj = __classPrivateFieldGet$
|
|
10261
|
+
const protectedObj = __classPrivateFieldGet$e(this, _ChannelClient_protectedObj, "f");
|
|
10312
10262
|
return protectedObj.providerIdentity;
|
|
10313
10263
|
}
|
|
10314
10264
|
/**
|
|
@@ -10337,9 +10287,9 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
|
10337
10287
|
* ```
|
|
10338
10288
|
*/
|
|
10339
10289
|
async dispatch(action, payload) {
|
|
10340
|
-
if (__classPrivateFieldGet$
|
|
10290
|
+
if (__classPrivateFieldGet$e(this, _ChannelClient_strategy, "f").isEndpointConnected(this.providerIdentity.channelId)) {
|
|
10341
10291
|
const callSites = transport_errors_1$1.RuntimeError.getCallSite();
|
|
10342
|
-
return __classPrivateFieldGet$
|
|
10292
|
+
return __classPrivateFieldGet$e(this, _ChannelClient_strategy, "f").send(this.providerIdentity.channelId, action, payload).catch((e) => {
|
|
10343
10293
|
throw new channel_error_1$1.ChannelError(e, action, payload, callSites);
|
|
10344
10294
|
});
|
|
10345
10295
|
}
|
|
@@ -10391,10 +10341,10 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
|
10391
10341
|
*/
|
|
10392
10342
|
async disconnect() {
|
|
10393
10343
|
await this.sendDisconnectAction();
|
|
10394
|
-
__classPrivateFieldGet$
|
|
10344
|
+
__classPrivateFieldGet$e(this, _ChannelClient_close, "f").call(this);
|
|
10395
10345
|
}
|
|
10396
10346
|
async sendDisconnectAction() {
|
|
10397
|
-
const protectedObj = __classPrivateFieldGet$
|
|
10347
|
+
const protectedObj = __classPrivateFieldGet$e(this, _ChannelClient_protectedObj, "f");
|
|
10398
10348
|
await protectedObj.close();
|
|
10399
10349
|
}
|
|
10400
10350
|
/**
|
|
@@ -10427,13 +10377,13 @@ exhaustive.exhaustiveCheck = exhaustiveCheck;
|
|
|
10427
10377
|
|
|
10428
10378
|
var strategy$3 = {};
|
|
10429
10379
|
|
|
10430
|
-
var __classPrivateFieldSet$
|
|
10380
|
+
var __classPrivateFieldSet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
10431
10381
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
10432
10382
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
10433
10383
|
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");
|
|
10434
10384
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
10435
10385
|
};
|
|
10436
|
-
var __classPrivateFieldGet$
|
|
10386
|
+
var __classPrivateFieldGet$d = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
10437
10387
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10438
10388
|
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");
|
|
10439
10389
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -10458,7 +10408,7 @@ class ClassicStrategy {
|
|
|
10458
10408
|
// connection problems occur
|
|
10459
10409
|
_ClassicStrategy_pendingMessagesByEndpointId.set(this, new Map());
|
|
10460
10410
|
this.send = async (endpointId, action, payload) => {
|
|
10461
|
-
const to = __classPrivateFieldGet$
|
|
10411
|
+
const to = __classPrivateFieldGet$d(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
|
|
10462
10412
|
if (!to) {
|
|
10463
10413
|
throw new Error(`Could not locate routing info for endpoint ${endpointId}`);
|
|
10464
10414
|
}
|
|
@@ -10470,13 +10420,13 @@ class ClassicStrategy {
|
|
|
10470
10420
|
}
|
|
10471
10421
|
delete cleanId.isLocalEndpointId;
|
|
10472
10422
|
// grab the promise before awaiting it to save in our pending messages map
|
|
10473
|
-
const p = __classPrivateFieldGet$
|
|
10423
|
+
const p = __classPrivateFieldGet$d(this, _ClassicStrategy_wire, "f").sendAction('send-channel-message', {
|
|
10474
10424
|
...cleanId,
|
|
10475
10425
|
providerIdentity: this.providerIdentity,
|
|
10476
10426
|
action,
|
|
10477
10427
|
payload
|
|
10478
10428
|
});
|
|
10479
|
-
__classPrivateFieldGet$
|
|
10429
|
+
__classPrivateFieldGet$d(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.add(p);
|
|
10480
10430
|
const raw = await p
|
|
10481
10431
|
.catch((error) => {
|
|
10482
10432
|
if ('cause' in error) {
|
|
@@ -10486,16 +10436,16 @@ class ClassicStrategy {
|
|
|
10486
10436
|
})
|
|
10487
10437
|
.finally(() => {
|
|
10488
10438
|
// clean up the pending promise
|
|
10489
|
-
__classPrivateFieldGet$
|
|
10439
|
+
__classPrivateFieldGet$d(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.delete(p);
|
|
10490
10440
|
});
|
|
10491
10441
|
return raw.payload.data.result;
|
|
10492
10442
|
};
|
|
10493
10443
|
this.close = async () => {
|
|
10494
10444
|
this.messageReceiver.removeEndpoint(this.providerIdentity.channelId, this.endpointId);
|
|
10495
|
-
[...__classPrivateFieldGet$
|
|
10496
|
-
__classPrivateFieldSet$
|
|
10445
|
+
[...__classPrivateFieldGet$d(this, _ClassicStrategy_endpointIdentityMap, "f").keys()].forEach((id) => this.closeEndpoint(id));
|
|
10446
|
+
__classPrivateFieldSet$c(this, _ClassicStrategy_endpointIdentityMap, new Map(), "f");
|
|
10497
10447
|
};
|
|
10498
|
-
__classPrivateFieldSet$
|
|
10448
|
+
__classPrivateFieldSet$c(this, _ClassicStrategy_wire, wire, "f");
|
|
10499
10449
|
}
|
|
10500
10450
|
onEndpointDisconnect(endpointId, listener) {
|
|
10501
10451
|
// Never fires for 'classic'.
|
|
@@ -10504,20 +10454,20 @@ class ClassicStrategy {
|
|
|
10504
10454
|
this.messageReceiver.addEndpoint(listener, this.providerIdentity.channelId, this.endpointId);
|
|
10505
10455
|
}
|
|
10506
10456
|
async closeEndpoint(endpointId) {
|
|
10507
|
-
const id = __classPrivateFieldGet$
|
|
10508
|
-
__classPrivateFieldGet$
|
|
10509
|
-
const pendingSet = __classPrivateFieldGet$
|
|
10457
|
+
const id = __classPrivateFieldGet$d(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
|
|
10458
|
+
__classPrivateFieldGet$d(this, _ClassicStrategy_endpointIdentityMap, "f").delete(endpointId);
|
|
10459
|
+
const pendingSet = __classPrivateFieldGet$d(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId);
|
|
10510
10460
|
pendingSet?.forEach((p) => {
|
|
10511
10461
|
const errorMsg = `Channel connection with identity uuid: ${id?.uuid} / name: ${id?.name} / endpointId: ${endpointId} no longer connected.`;
|
|
10512
10462
|
p.cancel(new Error(errorMsg));
|
|
10513
10463
|
});
|
|
10514
10464
|
}
|
|
10515
10465
|
isEndpointConnected(endpointId) {
|
|
10516
|
-
return __classPrivateFieldGet$
|
|
10466
|
+
return __classPrivateFieldGet$d(this, _ClassicStrategy_endpointIdentityMap, "f").has(endpointId);
|
|
10517
10467
|
}
|
|
10518
10468
|
addEndpoint(endpointId, payload) {
|
|
10519
|
-
__classPrivateFieldGet$
|
|
10520
|
-
__classPrivateFieldGet$
|
|
10469
|
+
__classPrivateFieldGet$d(this, _ClassicStrategy_endpointIdentityMap, "f").set(endpointId, payload.endpointIdentity);
|
|
10470
|
+
__classPrivateFieldGet$d(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").set(endpointId, new Set());
|
|
10521
10471
|
}
|
|
10522
10472
|
isValidEndpointPayload(payload) {
|
|
10523
10473
|
return (typeof payload?.endpointIdentity?.endpointId === 'string' ||
|
|
@@ -10533,12 +10483,12 @@ var strategy$2 = {};
|
|
|
10533
10483
|
|
|
10534
10484
|
var endpoint = {};
|
|
10535
10485
|
|
|
10536
|
-
var __classPrivateFieldGet$
|
|
10486
|
+
var __classPrivateFieldGet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
10537
10487
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10538
10488
|
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");
|
|
10539
10489
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
10540
10490
|
};
|
|
10541
|
-
var __classPrivateFieldSet$
|
|
10491
|
+
var __classPrivateFieldSet$b = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
10542
10492
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
10543
10493
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
10544
10494
|
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");
|
|
@@ -10573,8 +10523,8 @@ class RTCEndpoint {
|
|
|
10573
10523
|
if (this.rtc.rtcClient.connectionState !== 'connected') {
|
|
10574
10524
|
this.rtc.rtcClient.removeEventListener('connectionstatechange', this.connectionStateChangeHandler);
|
|
10575
10525
|
this.close();
|
|
10576
|
-
if (__classPrivateFieldGet$
|
|
10577
|
-
__classPrivateFieldGet$
|
|
10526
|
+
if (__classPrivateFieldGet$c(this, _RTCEndpoint_disconnectListener, "f")) {
|
|
10527
|
+
__classPrivateFieldGet$c(this, _RTCEndpoint_disconnectListener, "f").call(this);
|
|
10578
10528
|
}
|
|
10579
10529
|
}
|
|
10580
10530
|
};
|
|
@@ -10622,9 +10572,9 @@ class RTCEndpoint {
|
|
|
10622
10572
|
data = new TextDecoder().decode(e.data);
|
|
10623
10573
|
}
|
|
10624
10574
|
const { messageId, action, payload } = JSON.parse(data);
|
|
10625
|
-
if (__classPrivateFieldGet$
|
|
10575
|
+
if (__classPrivateFieldGet$c(this, _RTCEndpoint_processAction, "f")) {
|
|
10626
10576
|
try {
|
|
10627
|
-
const res = await __classPrivateFieldGet$
|
|
10577
|
+
const res = await __classPrivateFieldGet$c(this, _RTCEndpoint_processAction, "f").call(this, action, payload, endpointIdentity);
|
|
10628
10578
|
this.rtc.channels.response.send(JSON.stringify({
|
|
10629
10579
|
messageId,
|
|
10630
10580
|
payload: res,
|
|
@@ -10658,25 +10608,25 @@ class RTCEndpoint {
|
|
|
10658
10608
|
datachannel.onclose = (e) => {
|
|
10659
10609
|
[...this.responseMap.values()].forEach((promise) => promise.reject(new Error('RTCDataChannel closed unexpectedly, this is most commonly caused by message size. Note: RTC Channels have a message size limit of ~255kB.')));
|
|
10660
10610
|
this.close();
|
|
10661
|
-
if (__classPrivateFieldGet$
|
|
10662
|
-
__classPrivateFieldGet$
|
|
10611
|
+
if (__classPrivateFieldGet$c(this, _RTCEndpoint_disconnectListener, "f")) {
|
|
10612
|
+
__classPrivateFieldGet$c(this, _RTCEndpoint_disconnectListener, "f").call(this);
|
|
10663
10613
|
}
|
|
10664
10614
|
};
|
|
10665
10615
|
});
|
|
10666
10616
|
}
|
|
10667
10617
|
onDisconnect(listener) {
|
|
10668
|
-
if (!__classPrivateFieldGet$
|
|
10669
|
-
__classPrivateFieldSet$
|
|
10618
|
+
if (!__classPrivateFieldGet$c(this, _RTCEndpoint_disconnectListener, "f")) {
|
|
10619
|
+
__classPrivateFieldSet$b(this, _RTCEndpoint_disconnectListener, listener, "f");
|
|
10670
10620
|
}
|
|
10671
10621
|
else {
|
|
10672
10622
|
throw new Error('RTCEndpoint disconnectListener cannot be set twice.');
|
|
10673
10623
|
}
|
|
10674
10624
|
}
|
|
10675
10625
|
receive(listener) {
|
|
10676
|
-
if (__classPrivateFieldGet$
|
|
10626
|
+
if (__classPrivateFieldGet$c(this, _RTCEndpoint_processAction, "f")) {
|
|
10677
10627
|
throw new Error('You have already set a listener for this RTC Endpoint.');
|
|
10678
10628
|
}
|
|
10679
|
-
__classPrivateFieldSet$
|
|
10629
|
+
__classPrivateFieldSet$b(this, _RTCEndpoint_processAction, listener, "f");
|
|
10680
10630
|
}
|
|
10681
10631
|
get connected() {
|
|
10682
10632
|
return this.rtc.rtcClient.connectionState === 'connected';
|
|
@@ -10687,12 +10637,12 @@ _RTCEndpoint_processAction = new WeakMap(), _RTCEndpoint_disconnectListener = ne
|
|
|
10687
10637
|
|
|
10688
10638
|
var strategy$1 = {};
|
|
10689
10639
|
|
|
10690
|
-
var __classPrivateFieldGet$
|
|
10640
|
+
var __classPrivateFieldGet$b = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
10691
10641
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10692
10642
|
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");
|
|
10693
10643
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
10694
10644
|
};
|
|
10695
|
-
var __classPrivateFieldSet$
|
|
10645
|
+
var __classPrivateFieldSet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
10696
10646
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
10697
10647
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
10698
10648
|
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");
|
|
@@ -10713,11 +10663,11 @@ class EndpointStrategy {
|
|
|
10713
10663
|
return this.getEndpointById(endpointId).send(action, payload);
|
|
10714
10664
|
};
|
|
10715
10665
|
this.close = async () => {
|
|
10716
|
-
if (__classPrivateFieldGet$
|
|
10717
|
-
__classPrivateFieldGet$
|
|
10718
|
-
__classPrivateFieldSet$
|
|
10666
|
+
if (__classPrivateFieldGet$b(this, _EndpointStrategy_connected, "f")) {
|
|
10667
|
+
__classPrivateFieldGet$b(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.close());
|
|
10668
|
+
__classPrivateFieldSet$a(this, _EndpointStrategy_endpointMap, new Map(), "f");
|
|
10719
10669
|
}
|
|
10720
|
-
__classPrivateFieldSet$
|
|
10670
|
+
__classPrivateFieldSet$a(this, _EndpointStrategy_connected, false, "f");
|
|
10721
10671
|
};
|
|
10722
10672
|
this.isValidEndpointPayload = validateEndpoint;
|
|
10723
10673
|
}
|
|
@@ -10725,39 +10675,39 @@ class EndpointStrategy {
|
|
|
10725
10675
|
this.getEndpointById(endpointId).onDisconnect(listener);
|
|
10726
10676
|
}
|
|
10727
10677
|
receive(listener) {
|
|
10728
|
-
if (__classPrivateFieldGet$
|
|
10678
|
+
if (__classPrivateFieldGet$b(this, _EndpointStrategy_processAction, "f")) {
|
|
10729
10679
|
throw new Error(`You have already set a listener for this ${this.StrategyName} Strategy`);
|
|
10730
10680
|
}
|
|
10731
|
-
__classPrivateFieldSet$
|
|
10681
|
+
__classPrivateFieldSet$a(this, _EndpointStrategy_processAction, listener, "f");
|
|
10732
10682
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
10733
|
-
__classPrivateFieldGet$
|
|
10683
|
+
__classPrivateFieldGet$b(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.receive(__classPrivateFieldGet$b(this, _EndpointStrategy_processAction, "f")));
|
|
10734
10684
|
}
|
|
10735
10685
|
getEndpointById(endpointId) {
|
|
10736
|
-
const endpoint = __classPrivateFieldGet$
|
|
10686
|
+
const endpoint = __classPrivateFieldGet$b(this, _EndpointStrategy_endpointMap, "f").get(endpointId);
|
|
10737
10687
|
if (!endpoint) {
|
|
10738
10688
|
throw new Error(`Client with endpoint id ${endpointId} is not connected`);
|
|
10739
10689
|
}
|
|
10740
10690
|
return endpoint;
|
|
10741
10691
|
}
|
|
10742
10692
|
get connected() {
|
|
10743
|
-
return __classPrivateFieldGet$
|
|
10693
|
+
return __classPrivateFieldGet$b(this, _EndpointStrategy_connected, "f");
|
|
10744
10694
|
}
|
|
10745
10695
|
isEndpointConnected(endpointId) {
|
|
10746
|
-
return __classPrivateFieldGet$
|
|
10696
|
+
return __classPrivateFieldGet$b(this, _EndpointStrategy_endpointMap, "f").has(endpointId);
|
|
10747
10697
|
}
|
|
10748
10698
|
addEndpoint(endpointId, payload) {
|
|
10749
|
-
if (!__classPrivateFieldGet$
|
|
10699
|
+
if (!__classPrivateFieldGet$b(this, _EndpointStrategy_connected, "f")) {
|
|
10750
10700
|
console.warn(`Adding endpoint to disconnected ${this.StrategyName} Strategy`);
|
|
10751
10701
|
return;
|
|
10752
10702
|
}
|
|
10753
10703
|
const clientStrat = new this.EndpointType(payload);
|
|
10754
|
-
if (__classPrivateFieldGet$
|
|
10755
|
-
clientStrat.receive(__classPrivateFieldGet$
|
|
10704
|
+
if (__classPrivateFieldGet$b(this, _EndpointStrategy_processAction, "f")) {
|
|
10705
|
+
clientStrat.receive(__classPrivateFieldGet$b(this, _EndpointStrategy_processAction, "f"));
|
|
10756
10706
|
}
|
|
10757
|
-
__classPrivateFieldGet$
|
|
10707
|
+
__classPrivateFieldGet$b(this, _EndpointStrategy_endpointMap, "f").set(endpointId, clientStrat);
|
|
10758
10708
|
}
|
|
10759
10709
|
async closeEndpoint(endpointId) {
|
|
10760
|
-
__classPrivateFieldGet$
|
|
10710
|
+
__classPrivateFieldGet$b(this, _EndpointStrategy_endpointMap, "f").delete(endpointId);
|
|
10761
10711
|
}
|
|
10762
10712
|
}
|
|
10763
10713
|
strategy$1.EndpointStrategy = EndpointStrategy;
|
|
@@ -10939,12 +10889,12 @@ function runtimeUuidMeetsMinimumRuntimeVersion(runtimeUuid, minVersion) {
|
|
|
10939
10889
|
}
|
|
10940
10890
|
runtimeVersioning.runtimeUuidMeetsMinimumRuntimeVersion = runtimeUuidMeetsMinimumRuntimeVersion;
|
|
10941
10891
|
|
|
10942
|
-
var __classPrivateFieldGet$
|
|
10892
|
+
var __classPrivateFieldGet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
10943
10893
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10944
10894
|
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");
|
|
10945
10895
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
10946
10896
|
};
|
|
10947
|
-
var __classPrivateFieldSet$
|
|
10897
|
+
var __classPrivateFieldSet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
10948
10898
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
10949
10899
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
10950
10900
|
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");
|
|
@@ -10988,19 +10938,19 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
10988
10938
|
* a read-only array containing all the identities of connecting clients.
|
|
10989
10939
|
*/
|
|
10990
10940
|
get connections() {
|
|
10991
|
-
return [...__classPrivateFieldGet$
|
|
10941
|
+
return [...__classPrivateFieldGet$a(this, _ChannelProvider_connections, "f")];
|
|
10992
10942
|
}
|
|
10993
10943
|
static handleClientDisconnection(channel, payload) {
|
|
10994
10944
|
if (payload?.endpointId) {
|
|
10995
10945
|
const { uuid, name, endpointId, isLocalEndpointId } = payload;
|
|
10996
|
-
__classPrivateFieldGet$
|
|
10946
|
+
__classPrivateFieldGet$a(channel, _ChannelProvider_removeEndpoint, "f").call(channel, { uuid, name, endpointId, isLocalEndpointId });
|
|
10997
10947
|
}
|
|
10998
10948
|
else {
|
|
10999
10949
|
// this is here to support older runtimes that did not have endpointId
|
|
11000
10950
|
const multipleRemoves = channel.connections.filter((identity) => {
|
|
11001
10951
|
return identity.uuid === payload.uuid && identity.name === payload.name;
|
|
11002
10952
|
});
|
|
11003
|
-
multipleRemoves.forEach(__classPrivateFieldGet$
|
|
10953
|
+
multipleRemoves.forEach(__classPrivateFieldGet$a(channel, _ChannelProvider_removeEndpoint, "f"));
|
|
11004
10954
|
}
|
|
11005
10955
|
channel.disconnectListener(payload);
|
|
11006
10956
|
}
|
|
@@ -11017,8 +10967,8 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
11017
10967
|
_ChannelProvider_strategy.set(this, void 0);
|
|
11018
10968
|
_ChannelProvider_removeEndpoint.set(this, (identity) => {
|
|
11019
10969
|
const remainingConnections = this.connections.filter((clientIdentity) => clientIdentity.endpointId !== identity.endpointId);
|
|
11020
|
-
__classPrivateFieldGet$
|
|
11021
|
-
__classPrivateFieldSet$
|
|
10970
|
+
__classPrivateFieldGet$a(this, _ChannelProvider_strategy, "f").closeEndpoint(identity.endpointId);
|
|
10971
|
+
__classPrivateFieldSet$9(this, _ChannelProvider_connections, remainingConnections, "f");
|
|
11022
10972
|
});
|
|
11023
10973
|
// Must be bound.
|
|
11024
10974
|
this.processAction = async (action, payload, senderIdentity) => {
|
|
@@ -11032,17 +10982,17 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
11032
10982
|
return super.processAction(action, payload, senderIdentity);
|
|
11033
10983
|
};
|
|
11034
10984
|
_ChannelProvider_close.set(this, () => {
|
|
11035
|
-
__classPrivateFieldGet$
|
|
10985
|
+
__classPrivateFieldGet$a(this, _ChannelProvider_strategy, "f").close();
|
|
11036
10986
|
const remove = ChannelProvider.removalMap.get(this);
|
|
11037
10987
|
if (remove) {
|
|
11038
10988
|
remove();
|
|
11039
10989
|
}
|
|
11040
10990
|
});
|
|
11041
|
-
__classPrivateFieldSet$
|
|
10991
|
+
__classPrivateFieldSet$9(this, _ChannelProvider_protectedObj, new channel_1.ProtectedItems(providerIdentity, close), "f");
|
|
11042
10992
|
this.connectListener = () => undefined;
|
|
11043
10993
|
this.disconnectListener = () => undefined;
|
|
11044
|
-
__classPrivateFieldSet$
|
|
11045
|
-
__classPrivateFieldSet$
|
|
10994
|
+
__classPrivateFieldSet$9(this, _ChannelProvider_connections, [], "f");
|
|
10995
|
+
__classPrivateFieldSet$9(this, _ChannelProvider_strategy, strategy, "f");
|
|
11046
10996
|
strategy.receive(this.processAction);
|
|
11047
10997
|
}
|
|
11048
10998
|
/**
|
|
@@ -11073,16 +11023,16 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
11073
11023
|
*/
|
|
11074
11024
|
dispatch(to, action, payload) {
|
|
11075
11025
|
const endpointId = to.endpointId ?? this.getEndpointIdForOpenFinId(to, action);
|
|
11076
|
-
if (endpointId && __classPrivateFieldGet$
|
|
11026
|
+
if (endpointId && __classPrivateFieldGet$a(this, _ChannelProvider_strategy, "f").isEndpointConnected(endpointId)) {
|
|
11077
11027
|
const callSites = transport_errors_1.RuntimeError.getCallSite();
|
|
11078
|
-
return __classPrivateFieldGet$
|
|
11028
|
+
return __classPrivateFieldGet$a(this, _ChannelProvider_strategy, "f").send(endpointId, action, payload).catch((e) => {
|
|
11079
11029
|
throw new channel_error_1.ChannelError(e, action, payload, callSites);
|
|
11080
11030
|
});
|
|
11081
11031
|
}
|
|
11082
11032
|
return Promise.reject(new Error(`Client connection with identity uuid: ${to.uuid} / name: ${to.name} / endpointId: ${endpointId} no longer connected.`));
|
|
11083
11033
|
}
|
|
11084
11034
|
async processConnection(senderId, payload) {
|
|
11085
|
-
__classPrivateFieldGet$
|
|
11035
|
+
__classPrivateFieldGet$a(this, _ChannelProvider_connections, "f").push(senderId);
|
|
11086
11036
|
return this.connectListener(senderId, payload);
|
|
11087
11037
|
}
|
|
11088
11038
|
/**
|
|
@@ -11105,7 +11055,7 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
11105
11055
|
* ```
|
|
11106
11056
|
*/
|
|
11107
11057
|
publish(action, payload) {
|
|
11108
|
-
return this.connections.map((to) => __classPrivateFieldGet$
|
|
11058
|
+
return this.connections.map((to) => __classPrivateFieldGet$a(this, _ChannelProvider_strategy, "f").send(to.endpointId, action, payload));
|
|
11109
11059
|
}
|
|
11110
11060
|
/**
|
|
11111
11061
|
* Register a listener that is called on every new client connection.
|
|
@@ -11179,11 +11129,11 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
11179
11129
|
* ```
|
|
11180
11130
|
*/
|
|
11181
11131
|
async destroy() {
|
|
11182
|
-
const protectedObj = __classPrivateFieldGet$
|
|
11132
|
+
const protectedObj = __classPrivateFieldGet$a(this, _ChannelProvider_protectedObj, "f");
|
|
11183
11133
|
protectedObj.providerIdentity;
|
|
11184
|
-
__classPrivateFieldSet$
|
|
11134
|
+
__classPrivateFieldSet$9(this, _ChannelProvider_connections, [], "f");
|
|
11185
11135
|
await protectedObj.close();
|
|
11186
|
-
__classPrivateFieldGet$
|
|
11136
|
+
__classPrivateFieldGet$a(this, _ChannelProvider_close, "f").call(this);
|
|
11187
11137
|
}
|
|
11188
11138
|
/**
|
|
11189
11139
|
* Returns an array with info on every Client connected to the Provider
|
|
@@ -11253,7 +11203,7 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
11253
11203
|
getEndpointIdForOpenFinId(clientIdentity, action) {
|
|
11254
11204
|
const matchingConnections = this.connections.filter((c) => c.name === clientIdentity.name && c.uuid === clientIdentity.uuid);
|
|
11255
11205
|
if (matchingConnections.length >= 2) {
|
|
11256
|
-
const protectedObj = __classPrivateFieldGet$
|
|
11206
|
+
const protectedObj = __classPrivateFieldGet$a(this, _ChannelProvider_protectedObj, "f");
|
|
11257
11207
|
const { uuid, name } = clientIdentity;
|
|
11258
11208
|
const providerUuid = protectedObj?.providerIdentity.uuid;
|
|
11259
11209
|
const providerName = protectedObj?.providerIdentity.name;
|
|
@@ -11465,18 +11415,18 @@ class CombinedStrategy {
|
|
|
11465
11415
|
}
|
|
11466
11416
|
strategy.default = CombinedStrategy;
|
|
11467
11417
|
|
|
11468
|
-
var __classPrivateFieldSet$
|
|
11418
|
+
var __classPrivateFieldSet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
11469
11419
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
11470
11420
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
11471
11421
|
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");
|
|
11472
11422
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11473
11423
|
};
|
|
11474
|
-
var __classPrivateFieldGet$
|
|
11424
|
+
var __classPrivateFieldGet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
11475
11425
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
11476
11426
|
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");
|
|
11477
11427
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11478
11428
|
};
|
|
11479
|
-
var __importDefault$
|
|
11429
|
+
var __importDefault$4 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
11480
11430
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11481
11431
|
};
|
|
11482
11432
|
var _ConnectionManager_messageReceiver, _ConnectionManager_rtcConnectionManager;
|
|
@@ -11490,7 +11440,7 @@ const ice_manager_1 = iceManager;
|
|
|
11490
11440
|
const provider_1$1 = provider;
|
|
11491
11441
|
const message_receiver_1 = messageReceiver;
|
|
11492
11442
|
const protocol_manager_1 = protocolManager;
|
|
11493
|
-
const strategy_3 = __importDefault$
|
|
11443
|
+
const strategy_3 = __importDefault$4(strategy);
|
|
11494
11444
|
class ConnectionManager extends base_1$d.Base {
|
|
11495
11445
|
static getProtocolOptionsFromStrings(protocols) {
|
|
11496
11446
|
return protocols.map((protocol) => {
|
|
@@ -11520,8 +11470,8 @@ class ConnectionManager extends base_1$d.Base {
|
|
|
11520
11470
|
};
|
|
11521
11471
|
this.providerMap = new Map();
|
|
11522
11472
|
this.protocolManager = new protocol_manager_1.ProtocolManager(this.wire.environment.type === 'node' ? ['classic'] : ['rtc', 'classic']);
|
|
11523
|
-
__classPrivateFieldSet$
|
|
11524
|
-
__classPrivateFieldSet$
|
|
11473
|
+
__classPrivateFieldSet$8(this, _ConnectionManager_messageReceiver, new message_receiver_1.MessageReceiver(wire), "f");
|
|
11474
|
+
__classPrivateFieldSet$8(this, _ConnectionManager_rtcConnectionManager, new ice_manager_1.RTCICEManager(wire), "f");
|
|
11525
11475
|
wire.registerMessageHandler(this.onmessage.bind(this));
|
|
11526
11476
|
}
|
|
11527
11477
|
createProvider(options, providerIdentity) {
|
|
@@ -11532,7 +11482,7 @@ class ConnectionManager extends base_1$d.Base {
|
|
|
11532
11482
|
case 'rtc':
|
|
11533
11483
|
return new strategy_2.RTCStrategy();
|
|
11534
11484
|
case 'classic':
|
|
11535
|
-
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$
|
|
11485
|
+
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$9(this, _ConnectionManager_messageReceiver, "f"),
|
|
11536
11486
|
// Providers do not have an endpointId, use channelId as endpointId in the strategy.
|
|
11537
11487
|
providerIdentity.channelId, providerIdentity);
|
|
11538
11488
|
default:
|
|
@@ -11568,7 +11518,7 @@ class ConnectionManager extends base_1$d.Base {
|
|
|
11568
11518
|
const supportedProtocols = await Promise.all(protocols.map(async (type) => {
|
|
11569
11519
|
switch (type) {
|
|
11570
11520
|
case 'rtc': {
|
|
11571
|
-
const { rtcClient, channels, offer, rtcConnectionId, channelsOpened } = await __classPrivateFieldGet$
|
|
11521
|
+
const { rtcClient, channels, offer, rtcConnectionId, channelsOpened } = await __classPrivateFieldGet$9(this, _ConnectionManager_rtcConnectionManager, "f").startClientOffer();
|
|
11572
11522
|
rtcPacket = { rtcClient, channels, channelsOpened };
|
|
11573
11523
|
return {
|
|
11574
11524
|
type: 'rtc',
|
|
@@ -11595,18 +11545,18 @@ class ConnectionManager extends base_1$d.Base {
|
|
|
11595
11545
|
routingInfo.endpointId = this.wire.environment.getNextMessageId();
|
|
11596
11546
|
// For New Clients connecting to Old Providers. To prevent multi-dispatching and publishing, we delete previously-connected
|
|
11597
11547
|
// clients that are in the same context as the newly-connected client.
|
|
11598
|
-
__classPrivateFieldGet$
|
|
11548
|
+
__classPrivateFieldGet$9(this, _ConnectionManager_messageReceiver, "f").checkForPreviousClientConnection(routingInfo.channelId);
|
|
11599
11549
|
}
|
|
11600
11550
|
const answer = routingInfo.answer ?? {
|
|
11601
11551
|
supportedProtocols: [{ type: 'classic', version: 1 }]
|
|
11602
11552
|
};
|
|
11603
11553
|
const createStrategyFromAnswer = async (protocol) => {
|
|
11604
11554
|
if (protocol.type === 'rtc' && rtcPacket) {
|
|
11605
|
-
await __classPrivateFieldGet$
|
|
11555
|
+
await __classPrivateFieldGet$9(this, _ConnectionManager_rtcConnectionManager, "f").finishClientOffer(rtcPacket.rtcClient, protocol.payload.answer, rtcPacket.channelsOpened);
|
|
11606
11556
|
return new strategy_2.RTCStrategy();
|
|
11607
11557
|
}
|
|
11608
11558
|
if (protocol.type === 'classic') {
|
|
11609
|
-
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$
|
|
11559
|
+
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$9(this, _ConnectionManager_messageReceiver, "f"), routingInfo.endpointId, routingInfo);
|
|
11610
11560
|
}
|
|
11611
11561
|
return null;
|
|
11612
11562
|
};
|
|
@@ -11674,7 +11624,7 @@ class ConnectionManager extends base_1$d.Base {
|
|
|
11674
11624
|
clientAnswer = await overlappingProtocols.reduce(async (accumP, protocolToUse) => {
|
|
11675
11625
|
const answer = await accumP;
|
|
11676
11626
|
if (protocolToUse.type === 'rtc') {
|
|
11677
|
-
const { answer: rtcAnswer, rtcClient, channels } = await __classPrivateFieldGet$
|
|
11627
|
+
const { answer: rtcAnswer, rtcClient, channels } = await __classPrivateFieldGet$9(this, _ConnectionManager_rtcConnectionManager, "f").createProviderAnswer(protocolToUse.payload.rtcConnectionId, protocolToUse.payload.offer);
|
|
11678
11628
|
answer.supportedProtocols.push({
|
|
11679
11629
|
type: 'rtc',
|
|
11680
11630
|
version: strategy_2.RTCInfo.version,
|
|
@@ -11722,13 +11672,13 @@ _ConnectionManager_messageReceiver = new WeakMap(), _ConnectionManager_rtcConnec
|
|
|
11722
11672
|
*
|
|
11723
11673
|
* @packageDocumentation
|
|
11724
11674
|
*/
|
|
11725
|
-
var __classPrivateFieldSet$
|
|
11675
|
+
var __classPrivateFieldSet$7 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
11726
11676
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
11727
11677
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
11728
11678
|
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");
|
|
11729
11679
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11730
11680
|
};
|
|
11731
|
-
var __classPrivateFieldGet$
|
|
11681
|
+
var __classPrivateFieldGet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
11732
11682
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
11733
11683
|
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");
|
|
11734
11684
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -11785,11 +11735,11 @@ class Channel extends base_1$c.EmitterBase {
|
|
|
11785
11735
|
client_1.ChannelClient.handleProviderDisconnect(eventPayload);
|
|
11786
11736
|
}),
|
|
11787
11737
|
this.on('connected', (...args) => {
|
|
11788
|
-
__classPrivateFieldGet$
|
|
11738
|
+
__classPrivateFieldGet$8(this, _Channel_internalEmitter, "f").emit('connected', ...args);
|
|
11789
11739
|
})
|
|
11790
11740
|
]).catch(() => new Error('error setting up channel connection listeners'));
|
|
11791
11741
|
}));
|
|
11792
|
-
__classPrivateFieldSet$
|
|
11742
|
+
__classPrivateFieldSet$7(this, _Channel_connectionManager, new connection_manager_1.ConnectionManager(wire), "f");
|
|
11793
11743
|
}
|
|
11794
11744
|
/**
|
|
11795
11745
|
*
|
|
@@ -11864,7 +11814,7 @@ class Channel extends base_1$c.EmitterBase {
|
|
|
11864
11814
|
resolve(true);
|
|
11865
11815
|
}
|
|
11866
11816
|
};
|
|
11867
|
-
__classPrivateFieldGet$
|
|
11817
|
+
__classPrivateFieldGet$8(this, _Channel_internalEmitter, "f").on('connected', connectedListener);
|
|
11868
11818
|
});
|
|
11869
11819
|
try {
|
|
11870
11820
|
if (retryInfo.count > 0) {
|
|
@@ -11896,7 +11846,7 @@ class Channel extends base_1$c.EmitterBase {
|
|
|
11896
11846
|
finally {
|
|
11897
11847
|
retryInfo.count += 1;
|
|
11898
11848
|
// in case of other errors, remove our listener
|
|
11899
|
-
__classPrivateFieldGet$
|
|
11849
|
+
__classPrivateFieldGet$8(this, _Channel_internalEmitter, "f").removeListener('connected', connectedListener);
|
|
11900
11850
|
}
|
|
11901
11851
|
} while (shouldWait); // If we're waiting we retry the above loop
|
|
11902
11852
|
// Should wait was false, no channel was found.
|
|
@@ -11955,12 +11905,12 @@ class Channel extends base_1$c.EmitterBase {
|
|
|
11955
11905
|
async connect(channelName, options = {}) {
|
|
11956
11906
|
// Make sure we don't connect before listeners are set up
|
|
11957
11907
|
// This also errors if we're not in OpenFin, ensuring we don't run unnecessary code
|
|
11958
|
-
await __classPrivateFieldGet$
|
|
11908
|
+
await __classPrivateFieldGet$8(this, _Channel_readyToConnect, "f").getValue();
|
|
11959
11909
|
if (!channelName || typeof channelName !== 'string') {
|
|
11960
11910
|
throw new Error('Please provide a channelName string to connect to a channel.');
|
|
11961
11911
|
}
|
|
11962
11912
|
const opts = { wait: true, ...this.wire.environment.getDefaultChannelOptions().connect, ...options };
|
|
11963
|
-
const { offer, rtc: rtcPacket } = await __classPrivateFieldGet$
|
|
11913
|
+
const { offer, rtc: rtcPacket } = await __classPrivateFieldGet$8(this, _Channel_connectionManager, "f").createClientOffer(opts);
|
|
11964
11914
|
let connectionUrl;
|
|
11965
11915
|
if (this.fin.me.isFrame || this.fin.me.isView || this.fin.me.isWindow) {
|
|
11966
11916
|
connectionUrl = (await this.fin.me.getInfo()).url;
|
|
@@ -11972,7 +11922,7 @@ class Channel extends base_1$c.EmitterBase {
|
|
|
11972
11922
|
connectionUrl
|
|
11973
11923
|
};
|
|
11974
11924
|
const routingInfo = await this.safeConnect(channelName, opts.wait, connectPayload);
|
|
11975
|
-
const strategy = await __classPrivateFieldGet$
|
|
11925
|
+
const strategy = await __classPrivateFieldGet$8(this, _Channel_connectionManager, "f").createClientStrategy(rtcPacket, routingInfo);
|
|
11976
11926
|
const channel = new client_1.ChannelClient(routingInfo, () => client_1.ChannelClient.wireClose(this.wire, routingInfo, routingInfo.endpointId), strategy);
|
|
11977
11927
|
// It is the client's responsibility to handle endpoint disconnection to the provider.
|
|
11978
11928
|
// If the endpoint dies, the client will force a disconnection through the core.
|
|
@@ -12041,7 +11991,7 @@ class Channel extends base_1$c.EmitterBase {
|
|
|
12041
11991
|
throw new Error('Please provide a channelName to create a channel');
|
|
12042
11992
|
}
|
|
12043
11993
|
const { payload: { data: providerIdentity } } = await this.wire.sendAction('create-channel', { channelName });
|
|
12044
|
-
const channel = __classPrivateFieldGet$
|
|
11994
|
+
const channel = __classPrivateFieldGet$8(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
|
|
12045
11995
|
// TODO: fix typing (internal)
|
|
12046
11996
|
// @ts-expect-error
|
|
12047
11997
|
this.on('client-disconnected', (eventPayload) => {
|
|
@@ -12277,32 +12227,14 @@ var clipboard = {};
|
|
|
12277
12227
|
*
|
|
12278
12228
|
* @packageDocumentation
|
|
12279
12229
|
*/
|
|
12280
|
-
var __classPrivateFieldGet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12281
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
12282
|
-
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");
|
|
12283
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12284
|
-
};
|
|
12285
|
-
var __classPrivateFieldSet$7 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
12286
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
12287
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
12288
|
-
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");
|
|
12289
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
12290
|
-
};
|
|
12291
|
-
var _Clipboard_instances, _Clipboard_securedApiWarningCount, _Clipboard_warnSecuredApi;
|
|
12292
12230
|
Object.defineProperty(clipboard, "__esModule", { value: true });
|
|
12293
12231
|
clipboard.Clipboard = void 0;
|
|
12294
12232
|
const base_1$a = base;
|
|
12295
|
-
const maxSecuredApiWarnings = 10;
|
|
12296
12233
|
/**
|
|
12297
12234
|
* The Clipboard API allows reading and writing to the clipboard in multiple formats.
|
|
12298
12235
|
*
|
|
12299
12236
|
*/
|
|
12300
12237
|
class Clipboard extends base_1$a.Base {
|
|
12301
|
-
constructor() {
|
|
12302
|
-
super(...arguments);
|
|
12303
|
-
_Clipboard_instances.add(this);
|
|
12304
|
-
_Clipboard_securedApiWarningCount.set(this, 0);
|
|
12305
|
-
}
|
|
12306
12238
|
/**
|
|
12307
12239
|
* Writes data into the clipboard as plain text
|
|
12308
12240
|
* @param writeObj The object for writing data into the clipboard
|
|
@@ -12315,7 +12247,6 @@ class Clipboard extends base_1$a.Base {
|
|
|
12315
12247
|
* ```
|
|
12316
12248
|
*/
|
|
12317
12249
|
async writeText(writeObj) {
|
|
12318
|
-
__classPrivateFieldGet$8(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.writeText');
|
|
12319
12250
|
await this.wire.sendAction('clipboard-write-text', writeObj);
|
|
12320
12251
|
}
|
|
12321
12252
|
/**
|
|
@@ -12328,7 +12259,6 @@ class Clipboard extends base_1$a.Base {
|
|
|
12328
12259
|
* ```
|
|
12329
12260
|
*/
|
|
12330
12261
|
async readText(type) {
|
|
12331
|
-
__classPrivateFieldGet$8(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.readText');
|
|
12332
12262
|
// NOTE: When we start supporting linux, we could detect the OS and choose 'selection' automatically for the user
|
|
12333
12263
|
const { payload } = await this.wire.sendAction('clipboard-read-text', { type });
|
|
12334
12264
|
return payload.data;
|
|
@@ -12346,7 +12276,6 @@ class Clipboard extends base_1$a.Base {
|
|
|
12346
12276
|
* ```
|
|
12347
12277
|
*/
|
|
12348
12278
|
async writeImage(writeRequest) {
|
|
12349
|
-
__classPrivateFieldGet$8(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.writeImage');
|
|
12350
12279
|
await this.wire.sendAction('clipboard-write-image', writeRequest);
|
|
12351
12280
|
}
|
|
12352
12281
|
/**
|
|
@@ -12382,7 +12311,6 @@ class Clipboard extends base_1$a.Base {
|
|
|
12382
12311
|
* ```
|
|
12383
12312
|
*/
|
|
12384
12313
|
async readImage(readRequest = { format: 'dataURL' }) {
|
|
12385
|
-
__classPrivateFieldGet$8(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.readImage');
|
|
12386
12314
|
const { payload } = await this.wire.sendAction('clipboard-read-image', readRequest);
|
|
12387
12315
|
return payload.data;
|
|
12388
12316
|
}
|
|
@@ -12398,7 +12326,6 @@ class Clipboard extends base_1$a.Base {
|
|
|
12398
12326
|
* ```
|
|
12399
12327
|
*/
|
|
12400
12328
|
async writeHtml(writeObj) {
|
|
12401
|
-
__classPrivateFieldGet$8(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.writeHtml');
|
|
12402
12329
|
await this.wire.sendAction('clipboard-write-html', writeObj);
|
|
12403
12330
|
}
|
|
12404
12331
|
/**
|
|
@@ -12411,7 +12338,6 @@ class Clipboard extends base_1$a.Base {
|
|
|
12411
12338
|
* ```
|
|
12412
12339
|
*/
|
|
12413
12340
|
async readHtml(type) {
|
|
12414
|
-
__classPrivateFieldGet$8(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.readHtml');
|
|
12415
12341
|
const { payload } = await this.wire.sendAction('clipboard-read-html', { type });
|
|
12416
12342
|
return payload.data;
|
|
12417
12343
|
}
|
|
@@ -12427,7 +12353,6 @@ class Clipboard extends base_1$a.Base {
|
|
|
12427
12353
|
* ```
|
|
12428
12354
|
*/
|
|
12429
12355
|
async writeRtf(writeObj) {
|
|
12430
|
-
__classPrivateFieldGet$8(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.writeRtf');
|
|
12431
12356
|
await this.wire.sendAction('clipboard-write-rtf', writeObj);
|
|
12432
12357
|
}
|
|
12433
12358
|
/**
|
|
@@ -12448,7 +12373,6 @@ class Clipboard extends base_1$a.Base {
|
|
|
12448
12373
|
* ```
|
|
12449
12374
|
*/
|
|
12450
12375
|
async readRtf(type) {
|
|
12451
|
-
__classPrivateFieldGet$8(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.readRtf');
|
|
12452
12376
|
const { payload } = await this.wire.sendAction('clipboard-read-rtf', { type });
|
|
12453
12377
|
return payload.data;
|
|
12454
12378
|
}
|
|
@@ -12472,7 +12396,6 @@ class Clipboard extends base_1$a.Base {
|
|
|
12472
12396
|
* ```
|
|
12473
12397
|
*/
|
|
12474
12398
|
async write(writeObj) {
|
|
12475
|
-
__classPrivateFieldGet$8(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.write');
|
|
12476
12399
|
await this.wire.sendAction('clipboard-write', writeObj);
|
|
12477
12400
|
}
|
|
12478
12401
|
/**
|
|
@@ -12490,12 +12413,6 @@ class Clipboard extends base_1$a.Base {
|
|
|
12490
12413
|
}
|
|
12491
12414
|
}
|
|
12492
12415
|
clipboard.Clipboard = Clipboard;
|
|
12493
|
-
_Clipboard_securedApiWarningCount = new WeakMap(), _Clipboard_instances = new WeakSet(), _Clipboard_warnSecuredApi = async function _Clipboard_warnSecuredApi(apiName) {
|
|
12494
|
-
if (__classPrivateFieldGet$8(this, _Clipboard_securedApiWarningCount, "f") <= maxSecuredApiWarnings) {
|
|
12495
|
-
console.warn(`Here's Clipboard APIs will become secured APIs starting in v42. To continue using this API without interruption, make sure to grant explicit API permissions for ${apiName} in the Desktop Owner Settings, and in the Application, Window, View, or Domain Settings. For more information, see https://resources.here.io/docs/core/develop/security/api-security/`);
|
|
12496
|
-
__classPrivateFieldSet$7(this, _Clipboard_securedApiWarningCount, __classPrivateFieldGet$8(this, _Clipboard_securedApiWarningCount, "f") + 1, "f");
|
|
12497
|
-
}
|
|
12498
|
-
};
|
|
12499
12416
|
|
|
12500
12417
|
var globalHotkey = {};
|
|
12501
12418
|
|
|
@@ -15348,14 +15265,14 @@ var __classPrivateFieldGet$2 = (commonjsGlobal && commonjsGlobal.__classPrivateF
|
|
|
15348
15265
|
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");
|
|
15349
15266
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15350
15267
|
};
|
|
15351
|
-
var __importDefault$
|
|
15268
|
+
var __importDefault$3 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
15352
15269
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15353
15270
|
};
|
|
15354
15271
|
var _InteropClient_clientPromise, _InteropClient_sessionContextGroups, _InteropClient_fdc3Factory;
|
|
15355
15272
|
Object.defineProperty(InteropClient$1, "__esModule", { value: true });
|
|
15356
15273
|
InteropClient$1.InteropClient = void 0;
|
|
15357
15274
|
const base_1$3 = base;
|
|
15358
|
-
const SessionContextGroupClient_1 = __importDefault$
|
|
15275
|
+
const SessionContextGroupClient_1 = __importDefault$3(SessionContextGroupClient$1);
|
|
15359
15276
|
const utils_1$5 = utils$3;
|
|
15360
15277
|
/**
|
|
15361
15278
|
* The Interop Client API is broken up into two groups:
|
|
@@ -16060,86 +15977,15 @@ class PrivateChannelClient {
|
|
|
16060
15977
|
}
|
|
16061
15978
|
PrivateChannelClient$1.PrivateChannelClient = PrivateChannelClient;
|
|
16062
15979
|
|
|
16063
|
-
var fdc3Channels2_0 = {};
|
|
16064
|
-
|
|
16065
|
-
var fdc3Channels1_2 = {};
|
|
16066
|
-
|
|
16067
|
-
var __importDefault$3 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
16068
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
16069
|
-
};
|
|
16070
|
-
Object.defineProperty(fdc3Channels1_2, "__esModule", { value: true });
|
|
16071
|
-
fdc3Channels1_2.createV1Channel = void 0;
|
|
16072
|
-
const isEqual_1$1 = __importDefault$3(require$$3);
|
|
16073
|
-
const createV1Channel = (sessionContextGroup) => {
|
|
16074
|
-
return {
|
|
16075
|
-
id: sessionContextGroup.id,
|
|
16076
|
-
type: 'app',
|
|
16077
|
-
broadcast: sessionContextGroup.setContext,
|
|
16078
|
-
getCurrentContext: async (contextType) => {
|
|
16079
|
-
const context = await sessionContextGroup.getCurrentContext(contextType);
|
|
16080
|
-
return context === undefined ? null : context;
|
|
16081
|
-
},
|
|
16082
|
-
// @ts-expect-error TODO [CORE-1524]
|
|
16083
|
-
addContextListener: (contextType, handler) => {
|
|
16084
|
-
let realHandler;
|
|
16085
|
-
let realType;
|
|
16086
|
-
if (typeof contextType === 'function') {
|
|
16087
|
-
console.warn('addContextListener(handler) has been deprecated. Please use addContextListener(null, handler)');
|
|
16088
|
-
realHandler = contextType;
|
|
16089
|
-
}
|
|
16090
|
-
else {
|
|
16091
|
-
realHandler = handler;
|
|
16092
|
-
if (typeof contextType === 'string') {
|
|
16093
|
-
realType = contextType;
|
|
16094
|
-
}
|
|
16095
|
-
}
|
|
16096
|
-
const listener = (async () => {
|
|
16097
|
-
let first = true;
|
|
16098
|
-
const currentContext = await sessionContextGroup.getCurrentContext(realType);
|
|
16099
|
-
const wrappedHandler = (context, contextMetadata) => {
|
|
16100
|
-
if (first) {
|
|
16101
|
-
first = false;
|
|
16102
|
-
if ((0, isEqual_1$1.default)(currentContext, context)) {
|
|
16103
|
-
return;
|
|
16104
|
-
}
|
|
16105
|
-
}
|
|
16106
|
-
// eslint-disable-next-line consistent-return
|
|
16107
|
-
return realHandler(context, contextMetadata);
|
|
16108
|
-
};
|
|
16109
|
-
return sessionContextGroup.addContextHandler(wrappedHandler, realType);
|
|
16110
|
-
})();
|
|
16111
|
-
return {
|
|
16112
|
-
...listener,
|
|
16113
|
-
unsubscribe: () => listener.then((l) => l.unsubscribe())
|
|
16114
|
-
};
|
|
16115
|
-
}
|
|
16116
|
-
};
|
|
16117
|
-
};
|
|
16118
|
-
fdc3Channels1_2.createV1Channel = createV1Channel;
|
|
16119
|
-
|
|
16120
|
-
Object.defineProperty(fdc3Channels2_0, "__esModule", { value: true });
|
|
16121
|
-
fdc3Channels2_0.createV2Channel = void 0;
|
|
16122
|
-
const fdc3_channels_1_2_1$1 = fdc3Channels1_2;
|
|
16123
|
-
const createV2Channel = (sessionContextGroup) => {
|
|
16124
|
-
const channel = (0, fdc3_channels_1_2_1$1.createV1Channel)(sessionContextGroup);
|
|
16125
|
-
return {
|
|
16126
|
-
...channel,
|
|
16127
|
-
// @ts-expect-error Type incompatibility on signature.
|
|
16128
|
-
addContextListener: async (...args) => channel.addContextListener(...args)
|
|
16129
|
-
};
|
|
16130
|
-
};
|
|
16131
|
-
fdc3Channels2_0.createV2Channel = createV2Channel;
|
|
16132
|
-
|
|
16133
15980
|
(function (exports) {
|
|
16134
15981
|
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
16135
15982
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
16136
15983
|
};
|
|
16137
15984
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16138
|
-
exports.getIntentResolution = exports.isChannel = exports.isContext = exports.connectPrivateChannel = exports.buildPrivateChannelObject = exports.ChannelError = exports.ResultError = exports.UnsupportedChannelApiError = exports.getUnsupportedChannelApis = void 0;
|
|
15985
|
+
exports.getIntentResolution = exports.isChannel = exports.isContext = exports.connectPrivateChannel = exports.buildAppChannelObject = exports.buildPrivateChannelObject = exports.ChannelError = exports.ResultError = exports.UnsupportedChannelApiError = exports.getUnsupportedChannelApis = void 0;
|
|
16139
15986
|
const utils_1 = utils$3;
|
|
16140
15987
|
const PrivateChannelClient_1 = PrivateChannelClient$1;
|
|
16141
|
-
__importDefault(require$$3);
|
|
16142
|
-
const fdc3_channels_2_0_1 = fdc3Channels2_0;
|
|
15988
|
+
const isEqual_1 = __importDefault(require$$3);
|
|
16143
15989
|
const getUnsupportedChannelApis = (channelType) => {
|
|
16144
15990
|
return {
|
|
16145
15991
|
addContextListener: () => {
|
|
@@ -16238,6 +16084,52 @@ fdc3Channels2_0.createV2Channel = createV2Channel;
|
|
|
16238
16084
|
};
|
|
16239
16085
|
};
|
|
16240
16086
|
exports.buildPrivateChannelObject = buildPrivateChannelObject;
|
|
16087
|
+
const buildAppChannelObject = (sessionContextGroup) => {
|
|
16088
|
+
return {
|
|
16089
|
+
id: sessionContextGroup.id,
|
|
16090
|
+
type: 'app',
|
|
16091
|
+
broadcast: sessionContextGroup.setContext,
|
|
16092
|
+
getCurrentContext: async (contextType) => {
|
|
16093
|
+
const context = await sessionContextGroup.getCurrentContext(contextType);
|
|
16094
|
+
return context === undefined ? null : context;
|
|
16095
|
+
},
|
|
16096
|
+
// @ts-expect-error TODO [CORE-1524]
|
|
16097
|
+
addContextListener: (contextType, handler) => {
|
|
16098
|
+
let realHandler;
|
|
16099
|
+
let realType;
|
|
16100
|
+
if (typeof contextType === 'function') {
|
|
16101
|
+
console.warn('addContextListener(handler) has been deprecated. Please use addContextListener(null, handler)');
|
|
16102
|
+
realHandler = contextType;
|
|
16103
|
+
}
|
|
16104
|
+
else {
|
|
16105
|
+
realHandler = handler;
|
|
16106
|
+
if (typeof contextType === 'string') {
|
|
16107
|
+
realType = contextType;
|
|
16108
|
+
}
|
|
16109
|
+
}
|
|
16110
|
+
const listener = (async () => {
|
|
16111
|
+
let first = true;
|
|
16112
|
+
const currentContext = await sessionContextGroup.getCurrentContext(realType);
|
|
16113
|
+
const wrappedHandler = (context, contextMetadata) => {
|
|
16114
|
+
if (first) {
|
|
16115
|
+
first = false;
|
|
16116
|
+
if ((0, isEqual_1.default)(currentContext, context)) {
|
|
16117
|
+
return;
|
|
16118
|
+
}
|
|
16119
|
+
}
|
|
16120
|
+
// eslint-disable-next-line consistent-return
|
|
16121
|
+
return realHandler(context, contextMetadata);
|
|
16122
|
+
};
|
|
16123
|
+
return sessionContextGroup.addContextHandler(wrappedHandler, realType);
|
|
16124
|
+
})();
|
|
16125
|
+
return {
|
|
16126
|
+
...listener,
|
|
16127
|
+
unsubscribe: () => listener.then((l) => l.unsubscribe())
|
|
16128
|
+
};
|
|
16129
|
+
}
|
|
16130
|
+
};
|
|
16131
|
+
};
|
|
16132
|
+
exports.buildAppChannelObject = buildAppChannelObject;
|
|
16241
16133
|
const connectPrivateChannel = async (channelId) => {
|
|
16242
16134
|
try {
|
|
16243
16135
|
const channelClient = await fin.InterApplicationBus.Channel.connect(channelId);
|
|
@@ -16269,10 +16161,6 @@ fdc3Channels2_0.createV2Channel = createV2Channel;
|
|
|
16269
16161
|
// Generate an ID to make a session context group with. We will pass that ID to the Broker.
|
|
16270
16162
|
// The broker will then setContext on that session context group later with our Intent Result,
|
|
16271
16163
|
const guid = (0, utils_1.generateId)(); // TODO make this undefined in web
|
|
16272
|
-
let isPromiseSettled = false;
|
|
16273
|
-
// Adding the intentResolutionResultId to the intentObj. Because fireIntent only accepts a single arg, we have to slap it in here.
|
|
16274
|
-
const metadata = app ? { target: app, intentResolutionResultId: guid } : { intentResolutionResultId: guid };
|
|
16275
|
-
const intentObj = intent ? { name: intent, context, metadata } : { ...context, metadata };
|
|
16276
16164
|
// Promise we'll use in getResult
|
|
16277
16165
|
const getResultPromise = new Promise((resolve, reject) => {
|
|
16278
16166
|
fin.InterApplicationBus.subscribe({ uuid: '*' }, guid, (intentResult) => {
|
|
@@ -16280,29 +16168,18 @@ fdc3Channels2_0.createV2Channel = createV2Channel;
|
|
|
16280
16168
|
}).catch(() => {
|
|
16281
16169
|
// not supported in web, suppress the error
|
|
16282
16170
|
if (interopModule.wire.environment.type === 'other') {
|
|
16283
|
-
|
|
16171
|
+
return;
|
|
16284
16172
|
}
|
|
16285
16173
|
reject(new Error('getResult is not supported in this environment'));
|
|
16286
16174
|
});
|
|
16287
16175
|
});
|
|
16288
|
-
|
|
16289
|
-
|
|
16290
|
-
|
|
16291
|
-
})
|
|
16292
|
-
.catch(() => {
|
|
16293
|
-
isPromiseSettled = true;
|
|
16294
|
-
});
|
|
16176
|
+
// Adding the intentResolutionResultId to the intentObj. Because fireIntent only accepts a single arg, we have to slap it in here.
|
|
16177
|
+
const metadata = app ? { target: app, intentResolutionResultId: guid } : { intentResolutionResultId: guid };
|
|
16178
|
+
const intentObj = intent ? { name: intent, context, metadata } : { ...context, metadata };
|
|
16295
16179
|
// Set up the getResult call.
|
|
16296
16180
|
const getResult = async () => {
|
|
16297
|
-
// All this mumbo jumbo is needed to make sure that getResult resolves correctly and conforms to the FDC3 spec.
|
|
16298
|
-
if (!isPromiseSettled) {
|
|
16299
|
-
return undefined;
|
|
16300
|
-
}
|
|
16301
16181
|
let intentResult = await getResultPromise;
|
|
16302
|
-
if (
|
|
16303
|
-
return undefined;
|
|
16304
|
-
}
|
|
16305
|
-
if (typeof intentResult !== 'object') {
|
|
16182
|
+
if (!intentResult || typeof intentResult !== 'object') {
|
|
16306
16183
|
throw new Error(ResultError.NoResultReturned);
|
|
16307
16184
|
}
|
|
16308
16185
|
const { error } = intentResult;
|
|
@@ -16318,7 +16195,7 @@ fdc3Channels2_0.createV2Channel = createV2Channel;
|
|
|
16318
16195
|
}
|
|
16319
16196
|
case 'app': {
|
|
16320
16197
|
const sessionContextGroup = await interopModule.joinSessionContextGroup(id);
|
|
16321
|
-
intentResult = (0,
|
|
16198
|
+
intentResult = (0, exports.buildAppChannelObject)(sessionContextGroup);
|
|
16322
16199
|
break;
|
|
16323
16200
|
}
|
|
16324
16201
|
}
|
|
@@ -16428,16 +16305,10 @@ class FDC3ModuleBase {
|
|
|
16428
16305
|
*
|
|
16429
16306
|
* @tutorial fdc3.getOrCreateChannel
|
|
16430
16307
|
*/
|
|
16431
|
-
async getOrCreateChannel(channelId
|
|
16308
|
+
async getOrCreateChannel(channelId) {
|
|
16432
16309
|
this.wire.sendAction('fdc3-get-or-create-channel').catch((e) => {
|
|
16433
16310
|
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16434
16311
|
});
|
|
16435
|
-
const hasChannelIdBeenUsed = await InteropClient_1$2.InteropClient.ferryFdc3Call(this.client, 'isIdUsedByPrivateChannel', {
|
|
16436
|
-
channelId
|
|
16437
|
-
});
|
|
16438
|
-
if (hasChannelIdBeenUsed) {
|
|
16439
|
-
throw new Error(utils_1$4.ChannelError.AccessDenied);
|
|
16440
|
-
}
|
|
16441
16312
|
const systemChannels = await this._getChannels();
|
|
16442
16313
|
const userChannel = systemChannels.find((channel) => channel.id === channelId);
|
|
16443
16314
|
if (userChannel) {
|
|
@@ -16445,7 +16316,7 @@ class FDC3ModuleBase {
|
|
|
16445
16316
|
}
|
|
16446
16317
|
try {
|
|
16447
16318
|
const sessionContextGroup = await this.client.joinSessionContextGroup(channelId);
|
|
16448
|
-
return
|
|
16319
|
+
return (0, utils_1$4.buildAppChannelObject)(sessionContextGroup);
|
|
16449
16320
|
}
|
|
16450
16321
|
catch (error) {
|
|
16451
16322
|
console.error(error.message);
|
|
@@ -16595,7 +16466,6 @@ Object.defineProperty(fdc31_2, "__esModule", { value: true });
|
|
|
16595
16466
|
fdc31_2.Fdc3Module = void 0;
|
|
16596
16467
|
const utils_1$3 = utils$3;
|
|
16597
16468
|
const fdc3_common_1$1 = fdc3Common;
|
|
16598
|
-
const fdc3_channels_1_2_1 = fdc3Channels1_2;
|
|
16599
16469
|
/**
|
|
16600
16470
|
* @version 1.2
|
|
16601
16471
|
* The FDC3 Client Library provides a set APIs to be used for FDC3 compliance,
|
|
@@ -16778,7 +16648,7 @@ class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
|
|
|
16778
16648
|
* @tutorial fdc3.getOrCreateChannel
|
|
16779
16649
|
*/
|
|
16780
16650
|
async getOrCreateChannel(channelId) {
|
|
16781
|
-
return super.getOrCreateChannel(channelId
|
|
16651
|
+
return super.getOrCreateChannel(channelId);
|
|
16782
16652
|
}
|
|
16783
16653
|
/**
|
|
16784
16654
|
* Returns metadata relating to the FDC3 object and its provider, including the supported version of the FDC3 specification and the name of the provider of the implementation.
|
|
@@ -16808,7 +16678,6 @@ const utils_1$2 = utils$3;
|
|
|
16808
16678
|
const InteropClient_1$1 = InteropClient$1;
|
|
16809
16679
|
const utils_2 = utils$2;
|
|
16810
16680
|
const PrivateChannelClient_1 = PrivateChannelClient$1;
|
|
16811
|
-
const fdc3_channels_2_0_1 = fdc3Channels2_0;
|
|
16812
16681
|
/**
|
|
16813
16682
|
* @version 2.0
|
|
16814
16683
|
* The FDC3 Client Library provides a set APIs to be used for FDC3 compliance,
|
|
@@ -17060,7 +16929,7 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
|
|
|
17060
16929
|
* @tutorial fdc3.getOrCreateChannel
|
|
17061
16930
|
*/
|
|
17062
16931
|
async getOrCreateChannel(channelId) {
|
|
17063
|
-
return super.getOrCreateChannel(channelId
|
|
16932
|
+
return super.getOrCreateChannel(channelId);
|
|
17064
16933
|
}
|
|
17065
16934
|
/**
|
|
17066
16935
|
* Returns a Channel with an auto-generated identity that is intended for private communication between applications. Primarily used to create channels that will be returned to other applications via an IntentResolution for a raised intent.
|
|
@@ -17645,7 +17514,10 @@ async function getRemoteConnectionPayload(fin, uuid = `browser-connection-${Math
|
|
|
17645
17514
|
}
|
|
17646
17515
|
var getRemoteConnectionPayload_1 = browser.getRemoteConnectionPayload = getRemoteConnectionPayload;
|
|
17647
17516
|
async function remoteConnect({ uuid, token, address, interopProviderId, withInterop }) {
|
|
17648
|
-
const wire = new transport_1.Transport(
|
|
17517
|
+
const wire = new transport_1.Transport(websocket_1.default, new browser_1.BrowserEnvironment(), {
|
|
17518
|
+
uuid,
|
|
17519
|
+
name: uuid
|
|
17520
|
+
});
|
|
17649
17521
|
await wire.connect({ uuid, address, token });
|
|
17650
17522
|
if (withInterop) {
|
|
17651
17523
|
return remoteConnectInterop(new fin_1.Fin(wire), interopProviderId);
|
|
@@ -17723,10 +17595,7 @@ async function connect(options) {
|
|
|
17723
17595
|
await Promise.all([bridge.initializeMessageReceiver(pipe), backchannel$1.opened]);
|
|
17724
17596
|
const { payload } = await payloadPromise;
|
|
17725
17597
|
const { uuid, token } = payload;
|
|
17726
|
-
const wire = new Transport_1(
|
|
17727
|
-
uuid,
|
|
17728
|
-
name: uuid
|
|
17729
|
-
});
|
|
17598
|
+
const wire = new Transport_1(_default, new BrowserEnvironment_1(), { uuid, name: uuid });
|
|
17730
17599
|
const connectionPayload = { uuid, token, receiver: pipe };
|
|
17731
17600
|
await wire.connect(connectionPayload);
|
|
17732
17601
|
// Casting as unknown rather than expect-error to avoid skipLibCheck: true exceptions
|