@openfin/core 37.80.38 → 37.81.17
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/mock-alpha.d.ts +295 -460
- package/out/mock-beta.d.ts +295 -460
- package/out/mock-public.d.ts +295 -460
- package/out/mock.d.ts +303 -468
- package/out/mock.js +2089 -904
- package/package.json +3 -28
package/out/mock.js
CHANGED
@@ -299,13 +299,13 @@ async function promiseMapSerial(arr, func) {
|
|
299
299
|
}
|
300
300
|
promises.promiseMapSerial = promiseMapSerial;
|
301
301
|
|
302
|
-
var __classPrivateFieldSet$
|
302
|
+
var __classPrivateFieldSet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
303
303
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
304
304
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
305
305
|
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");
|
306
306
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
307
307
|
};
|
308
|
-
var __classPrivateFieldGet$
|
308
|
+
var __classPrivateFieldGet$e = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
309
309
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
310
310
|
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");
|
311
311
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
@@ -392,8 +392,8 @@ class EmitterBase extends Base {
|
|
392
392
|
this.emit = (eventType, payload, ...args) => {
|
393
393
|
return this.hasEmitter() ? this.getOrCreateEmitter().emit(eventType, payload, ...args) : false;
|
394
394
|
};
|
395
|
-
this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet$
|
396
|
-
this.getOrCreateEmitter = () => this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$
|
395
|
+
this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet$e(this, _EmitterBase_emitterAccessor, "f"));
|
396
|
+
this.getOrCreateEmitter = () => this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$e(this, _EmitterBase_emitterAccessor, "f"));
|
397
397
|
this.listeners = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(type) : [];
|
398
398
|
this.listenerCount = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listenerCount(type) : 0;
|
399
399
|
this.registerEventListener = async (eventType, options = {}, applySubscription, undoSubscription) => {
|
@@ -431,7 +431,7 @@ class EmitterBase extends Base {
|
|
431
431
|
// This will only be reached if unsubscribe from event that does not exist but do not want to error here
|
432
432
|
return Promise.resolve();
|
433
433
|
};
|
434
|
-
__classPrivateFieldSet$
|
434
|
+
__classPrivateFieldSet$c(this, _EmitterBase_emitterAccessor, [topic, ...additionalAccessors], "f");
|
435
435
|
this.listeners = (event) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(event) : [];
|
436
436
|
}
|
437
437
|
/**
|
@@ -549,7 +549,7 @@ class EmitterBase extends Base {
|
|
549
549
|
}
|
550
550
|
deleteEmitterIfNothingRegistered(emitter) {
|
551
551
|
if (emitter.eventNames().length === 0) {
|
552
|
-
this.wire.eventAggregator.delete(__classPrivateFieldGet$
|
552
|
+
this.wire.eventAggregator.delete(__classPrivateFieldGet$e(this, _EmitterBase_emitterAccessor, "f"));
|
553
553
|
}
|
554
554
|
}
|
555
555
|
}
|
@@ -1149,13 +1149,13 @@ const createRelayedDispatch = (client, target, relayId, relayErrorMsg) => async
|
|
1149
1149
|
};
|
1150
1150
|
channelApiRelay.createRelayedDispatch = createRelayedDispatch;
|
1151
1151
|
|
1152
|
-
var __classPrivateFieldSet$
|
1152
|
+
var __classPrivateFieldSet$b = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
1153
1153
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
1154
1154
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
1155
1155
|
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");
|
1156
1156
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
1157
1157
|
};
|
1158
|
-
var __classPrivateFieldGet$
|
1158
|
+
var __classPrivateFieldGet$d = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
1159
1159
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
1160
1160
|
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");
|
1161
1161
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
@@ -1209,7 +1209,7 @@ class LayoutNode {
|
|
1209
1209
|
* console.log(`The parent ColumnOrRow is root: ${parentIsRoot}`);
|
1210
1210
|
* ```
|
1211
1211
|
*/
|
1212
|
-
this.isRoot = () => __classPrivateFieldGet$
|
1212
|
+
this.isRoot = () => __classPrivateFieldGet$d(this, _LayoutNode_client, "f").isRoot(this.entityId);
|
1213
1213
|
/**
|
1214
1214
|
* Checks if the TabStack or ColumnOrRow exists
|
1215
1215
|
*
|
@@ -1229,7 +1229,7 @@ class LayoutNode {
|
|
1229
1229
|
* console.log(`The entity exists: ${exists}`);
|
1230
1230
|
* ```
|
1231
1231
|
*/
|
1232
|
-
this.exists = () => __classPrivateFieldGet$
|
1232
|
+
this.exists = () => __classPrivateFieldGet$d(this, _LayoutNode_client, "f").exists(this.entityId);
|
1233
1233
|
/**
|
1234
1234
|
* Retrieves the parent of the TabStack or ColumnOrRow
|
1235
1235
|
*
|
@@ -1250,11 +1250,11 @@ class LayoutNode {
|
|
1250
1250
|
* ```
|
1251
1251
|
*/
|
1252
1252
|
this.getParent = async () => {
|
1253
|
-
const parent = await __classPrivateFieldGet$
|
1253
|
+
const parent = await __classPrivateFieldGet$d(this, _LayoutNode_client, "f").getParent(this.entityId);
|
1254
1254
|
if (!parent) {
|
1255
1255
|
return undefined;
|
1256
1256
|
}
|
1257
|
-
return LayoutNode.getEntity(parent, __classPrivateFieldGet$
|
1257
|
+
return LayoutNode.getEntity(parent, __classPrivateFieldGet$d(this, _LayoutNode_client, "f"));
|
1258
1258
|
};
|
1259
1259
|
/**
|
1260
1260
|
* Creates a new TabStack adjacent to the given TabStack or ColumnOrRow. Inputs can be new views to create, or existing views.
|
@@ -1305,8 +1305,8 @@ class LayoutNode {
|
|
1305
1305
|
* @experimental
|
1306
1306
|
*/
|
1307
1307
|
this.createAdjacentStack = async (views, options) => {
|
1308
|
-
const entityId = await __classPrivateFieldGet$
|
1309
|
-
return LayoutNode.getEntity({ entityId, type: 'stack' }, __classPrivateFieldGet$
|
1308
|
+
const entityId = await __classPrivateFieldGet$d(this, _LayoutNode_client, "f").createAdjacentStack(this.entityId, views, options);
|
1309
|
+
return LayoutNode.getEntity({ entityId, type: 'stack' }, __classPrivateFieldGet$d(this, _LayoutNode_client, "f"));
|
1310
1310
|
};
|
1311
1311
|
/**
|
1312
1312
|
* Retrieves the adjacent TabStacks of the given TabStack or ColumnOrRow.
|
@@ -1334,16 +1334,16 @@ class LayoutNode {
|
|
1334
1334
|
* @experimental
|
1335
1335
|
*/
|
1336
1336
|
this.getAdjacentStacks = async (edge) => {
|
1337
|
-
const adjacentStacks = await __classPrivateFieldGet$
|
1337
|
+
const adjacentStacks = await __classPrivateFieldGet$d(this, _LayoutNode_client, "f").getAdjacentStacks({
|
1338
1338
|
targetId: this.entityId,
|
1339
1339
|
edge
|
1340
1340
|
});
|
1341
1341
|
return adjacentStacks.map((stack) => LayoutNode.getEntity({
|
1342
1342
|
type: 'stack',
|
1343
1343
|
entityId: stack.entityId
|
1344
|
-
}, __classPrivateFieldGet$
|
1344
|
+
}, __classPrivateFieldGet$d(this, _LayoutNode_client, "f")));
|
1345
1345
|
};
|
1346
|
-
__classPrivateFieldSet$
|
1346
|
+
__classPrivateFieldSet$b(this, _LayoutNode_client, client, "f");
|
1347
1347
|
this.entityId = entityId;
|
1348
1348
|
}
|
1349
1349
|
}
|
@@ -1416,7 +1416,7 @@ class TabStack extends LayoutNode {
|
|
1416
1416
|
* ```
|
1417
1417
|
* @experimental
|
1418
1418
|
*/
|
1419
|
-
this.getViews = () => __classPrivateFieldGet$
|
1419
|
+
this.getViews = () => __classPrivateFieldGet$d(this, _TabStack_client, "f").getStackViews(this.entityId);
|
1420
1420
|
/**
|
1421
1421
|
* Adds or creates a view in this {@link TabStack}.
|
1422
1422
|
*
|
@@ -1446,7 +1446,7 @@ class TabStack extends LayoutNode {
|
|
1446
1446
|
* ```
|
1447
1447
|
* @experimental
|
1448
1448
|
*/
|
1449
|
-
this.addView = async (view, options = { index: 0 }) => __classPrivateFieldGet$
|
1449
|
+
this.addView = async (view, options = { index: 0 }) => __classPrivateFieldGet$d(this, _TabStack_client, "f").addViewToStack(this.entityId, view, options);
|
1450
1450
|
/**
|
1451
1451
|
* Removes a view from this {@link TabStack}.
|
1452
1452
|
*
|
@@ -1476,7 +1476,7 @@ class TabStack extends LayoutNode {
|
|
1476
1476
|
* ```
|
1477
1477
|
*/
|
1478
1478
|
this.removeView = async (view) => {
|
1479
|
-
await __classPrivateFieldGet$
|
1479
|
+
await __classPrivateFieldGet$d(this, _TabStack_client, "f").removeViewFromStack(this.entityId, view);
|
1480
1480
|
};
|
1481
1481
|
/**
|
1482
1482
|
* Sets the active view of the {@link TabStack} without focusing it.
|
@@ -1500,9 +1500,9 @@ class TabStack extends LayoutNode {
|
|
1500
1500
|
* @experimental
|
1501
1501
|
*/
|
1502
1502
|
this.setActiveView = async (view) => {
|
1503
|
-
await __classPrivateFieldGet$
|
1503
|
+
await __classPrivateFieldGet$d(this, _TabStack_client, "f").setStackActiveView(this.entityId, view);
|
1504
1504
|
};
|
1505
|
-
__classPrivateFieldSet$
|
1505
|
+
__classPrivateFieldSet$b(this, _TabStack_client, client, "f");
|
1506
1506
|
}
|
1507
1507
|
}
|
1508
1508
|
layoutEntities.TabStack = TabStack;
|
@@ -1541,10 +1541,10 @@ class ColumnOrRow extends LayoutNode {
|
|
1541
1541
|
* ```
|
1542
1542
|
*/
|
1543
1543
|
this.getContent = async () => {
|
1544
|
-
const contentItemEntities = await __classPrivateFieldGet$
|
1545
|
-
return contentItemEntities.map((entity) => LayoutNode.getEntity(entity, __classPrivateFieldGet$
|
1544
|
+
const contentItemEntities = await __classPrivateFieldGet$d(this, _ColumnOrRow_client, "f").getContent(this.entityId);
|
1545
|
+
return contentItemEntities.map((entity) => LayoutNode.getEntity(entity, __classPrivateFieldGet$d(this, _ColumnOrRow_client, "f")));
|
1546
1546
|
};
|
1547
|
-
__classPrivateFieldSet$
|
1547
|
+
__classPrivateFieldSet$b(this, _ColumnOrRow_client, client, "f");
|
1548
1548
|
this.type = type;
|
1549
1549
|
}
|
1550
1550
|
}
|
@@ -1563,8 +1563,8 @@ var main = {};
|
|
1563
1563
|
|
1564
1564
|
Object.defineProperty(main, "__esModule", { value: true });
|
1565
1565
|
main.WebContents = void 0;
|
1566
|
-
const base_1$
|
1567
|
-
class WebContents extends base_1$
|
1566
|
+
const base_1$j = base;
|
1567
|
+
class WebContents extends base_1$j.EmitterBase {
|
1568
1568
|
/**
|
1569
1569
|
* @param identity The identity of the {@link OpenFin.WebContentsEvents WebContents}.
|
1570
1570
|
* @param entityType The type of the {@link OpenFin.WebContentsEvents WebContents}.
|
@@ -4365,6 +4365,37 @@ function requireApplication () {
|
|
4365
4365
|
return application;
|
4366
4366
|
}
|
4367
4367
|
|
4368
|
+
var promisifySubscription$1 = {};
|
4369
|
+
|
4370
|
+
Object.defineProperty(promisifySubscription$1, "__esModule", { value: true });
|
4371
|
+
promisifySubscription$1.promisifySubscription = void 0;
|
4372
|
+
const promisifySubscription = async (emitter, eventName, predicate = () => true, timeout) => {
|
4373
|
+
let resolve;
|
4374
|
+
let reject;
|
4375
|
+
let timer;
|
4376
|
+
const valuePromise = new Promise((y, n) => {
|
4377
|
+
resolve = y;
|
4378
|
+
reject = n;
|
4379
|
+
});
|
4380
|
+
const listener = (e) => {
|
4381
|
+
if (predicate(e)) {
|
4382
|
+
clearTimeout(timer);
|
4383
|
+
resolve(e);
|
4384
|
+
}
|
4385
|
+
};
|
4386
|
+
await emitter.on(eventName, listener);
|
4387
|
+
if (timeout) {
|
4388
|
+
timer = setTimeout(() => reject(new Error('event timed out')), timeout);
|
4389
|
+
}
|
4390
|
+
valuePromise.finally(() => {
|
4391
|
+
emitter.removeListener(eventName, listener).catch(() => null);
|
4392
|
+
});
|
4393
|
+
return {
|
4394
|
+
getValue: () => valuePromise
|
4395
|
+
};
|
4396
|
+
};
|
4397
|
+
promisifySubscription$1.promisifySubscription = promisifySubscription;
|
4398
|
+
|
4368
4399
|
var hasRequiredInstance;
|
4369
4400
|
|
4370
4401
|
function requireInstance () {
|
@@ -4380,6 +4411,7 @@ function requireInstance () {
|
|
4380
4411
|
const main_1 = main;
|
4381
4412
|
const view_1 = requireView();
|
4382
4413
|
const warnings_1 = warnings;
|
4414
|
+
const promisifySubscription_1 = promisifySubscription$1;
|
4383
4415
|
/**
|
4384
4416
|
* A basic window that wraps a native HTML window. Provides more fine-grained
|
4385
4417
|
* control over the window state such as the ability to minimize, maximize, restore, etc.
|
@@ -4395,79 +4427,60 @@ function requireInstance () {
|
|
4395
4427
|
constructor(wire, identity) {
|
4396
4428
|
super(wire, identity, 'window');
|
4397
4429
|
}
|
4398
|
-
|
4399
|
-
* create a new window
|
4400
|
-
* @internal
|
4401
|
-
*/
|
4402
|
-
createWindow(options) {
|
4430
|
+
async createWindow(options) {
|
4403
4431
|
this.wire.sendAction('window-create-window', this.identity).catch((e) => {
|
4404
4432
|
// we do not want to expose this error, just continue if this analytics-only call fails
|
4405
4433
|
});
|
4406
|
-
|
4407
|
-
|
4408
|
-
|
4409
|
-
|
4410
|
-
|
4411
|
-
|
4412
|
-
|
4413
|
-
|
4414
|
-
|
4415
|
-
|
4416
|
-
|
4417
|
-
|
4418
|
-
|
4419
|
-
|
4420
|
-
|
4421
|
-
|
4422
|
-
|
4423
|
-
|
4424
|
-
|
4425
|
-
|
4426
|
-
|
4427
|
-
|
4428
|
-
|
4429
|
-
|
4430
|
-
|
4431
|
-
|
4432
|
-
|
4433
|
-
|
4434
|
-
|
4435
|
-
|
4436
|
-
|
4437
|
-
|
4438
|
-
|
4439
|
-
|
4440
|
-
|
4441
|
-
|
4442
|
-
|
4443
|
-
|
4444
|
-
|
4445
|
-
|
4446
|
-
|
4447
|
-
|
4448
|
-
|
4449
|
-
|
4450
|
-
|
4451
|
-
|
4452
|
-
|
4453
|
-
|
4454
|
-
|
4455
|
-
|
4456
|
-
try {
|
4457
|
-
// this is to enforce a 5.0 contract that the child's main function
|
4458
|
-
// will not fire before the parent's success callback on creation.
|
4459
|
-
// if the child window is not accessible (CORS) this contract does
|
4460
|
-
// not hold.
|
4461
|
-
const webWindow = this.getWebWindow();
|
4462
|
-
webWindow.fin.__internal_.openerSuccessCBCalled();
|
4463
|
-
}
|
4464
|
-
catch (e) {
|
4465
|
-
// common for main windows, we do not want to expose this error. here just to have a debug target.
|
4466
|
-
// console.error(e);
|
4467
|
-
}
|
4468
|
-
})
|
4469
|
-
.catch(reject);
|
4470
|
-
});
|
4434
|
+
const CONSTRUCTOR_CB_TOPIC = 'fire-constructor-callback';
|
4435
|
+
const responseSubscription = await (0, promisifySubscription_1.promisifySubscription)(this, CONSTRUCTOR_CB_TOPIC);
|
4436
|
+
// set defaults:
|
4437
|
+
if (options.waitForPageLoad === undefined) {
|
4438
|
+
options.waitForPageLoad = false;
|
4439
|
+
}
|
4440
|
+
if (options.autoShow === undefined) {
|
4441
|
+
options.autoShow = true;
|
4442
|
+
}
|
4443
|
+
(0, warnings_1.handleDeprecatedWarnings)(options);
|
4444
|
+
const windowCreation = this.wire.environment.createChildContent({ entityType: 'window', options });
|
4445
|
+
const [response] = await Promise.all([responseSubscription.getValue(), windowCreation]);
|
4446
|
+
let cbPayload;
|
4447
|
+
const { success } = response;
|
4448
|
+
const responseData = response.data;
|
4449
|
+
const { message } = responseData;
|
4450
|
+
if (success) {
|
4451
|
+
cbPayload = {
|
4452
|
+
httpResponseCode: responseData.httpResponseCode,
|
4453
|
+
apiInjected: responseData.apiInjected
|
4454
|
+
};
|
4455
|
+
}
|
4456
|
+
else {
|
4457
|
+
cbPayload = {
|
4458
|
+
message: responseData.message,
|
4459
|
+
networkErrorCode: responseData.networkErrorCode,
|
4460
|
+
stack: responseData.stack
|
4461
|
+
};
|
4462
|
+
}
|
4463
|
+
const pageResolve = {
|
4464
|
+
message,
|
4465
|
+
cbPayload,
|
4466
|
+
success
|
4467
|
+
};
|
4468
|
+
try {
|
4469
|
+
// this is to enforce a 5.0 contract that the child's main function
|
4470
|
+
// will not fire before the parent's success callback on creation.
|
4471
|
+
// if the child window is not accessible (CORS) this contract does
|
4472
|
+
// not hold.
|
4473
|
+
const webWindow = this.getWebWindow();
|
4474
|
+
webWindow.fin.__internal_.openerSuccessCBCalled();
|
4475
|
+
}
|
4476
|
+
catch (e) {
|
4477
|
+
// common for main windows, we do not want to expose this error. here just to have a debug target.
|
4478
|
+
// console.error(e);
|
4479
|
+
}
|
4480
|
+
if (pageResolve.success) {
|
4481
|
+
return this;
|
4482
|
+
}
|
4483
|
+
return Promise.reject(pageResolve);
|
4471
4484
|
}
|
4472
4485
|
/**
|
4473
4486
|
* Retrieves an array of frame info objects representing the main frame and any
|
@@ -5846,7 +5859,7 @@ function requireWindow () {
|
|
5846
5859
|
*/
|
5847
5860
|
Object.defineProperty(system, "__esModule", { value: true });
|
5848
5861
|
system.System = void 0;
|
5849
|
-
const base_1$
|
5862
|
+
const base_1$i = base;
|
5850
5863
|
const transport_errors_1$1 = transportErrors;
|
5851
5864
|
const window_1 = requireWindow();
|
5852
5865
|
const events_1$6 = require$$0;
|
@@ -5856,7 +5869,7 @@ const events_1$6 = require$$0;
|
|
5856
5869
|
* clearing the cache and exiting the runtime as well as listen to {@link OpenFin.SystemEvents system events}.
|
5857
5870
|
*
|
5858
5871
|
*/
|
5859
|
-
class System extends base_1$
|
5872
|
+
class System extends base_1$i.EmitterBase {
|
5860
5873
|
/**
|
5861
5874
|
* @internal
|
5862
5875
|
*/
|
@@ -7762,9 +7775,10 @@ class ProtectedItems {
|
|
7762
7775
|
/**
|
7763
7776
|
* @internal
|
7764
7777
|
*/
|
7765
|
-
|
7778
|
+
// eslint-disable-next-line no-useless-constructor
|
7779
|
+
constructor(providerIdentity, close) {
|
7766
7780
|
this.providerIdentity = providerIdentity;
|
7767
|
-
this.
|
7781
|
+
this.close = close;
|
7768
7782
|
}
|
7769
7783
|
}
|
7770
7784
|
channel.ProtectedItems = ProtectedItems;
|
@@ -8086,12 +8100,12 @@ class ChannelBase {
|
|
8086
8100
|
}
|
8087
8101
|
channel.ChannelBase = ChannelBase;
|
8088
8102
|
|
8089
|
-
var __classPrivateFieldGet$
|
8103
|
+
var __classPrivateFieldGet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
8090
8104
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
8091
8105
|
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");
|
8092
8106
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
8093
8107
|
};
|
8094
|
-
var __classPrivateFieldSet$
|
8108
|
+
var __classPrivateFieldSet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
8095
8109
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
8096
8110
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
8097
8111
|
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");
|
@@ -8133,7 +8147,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
8133
8147
|
static closeChannelByEndpointId(id) {
|
8134
8148
|
const channel = channelClientsByEndpointId.get(id);
|
8135
8149
|
if (channel) {
|
8136
|
-
__classPrivateFieldGet$
|
8150
|
+
__classPrivateFieldGet$c(channel, _ChannelClient_close, "f").call(channel);
|
8137
8151
|
}
|
8138
8152
|
}
|
8139
8153
|
/**
|
@@ -8144,14 +8158,14 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
8144
8158
|
for (const channelClient of channelClientsByEndpointId.values()) {
|
8145
8159
|
if (channelClient.providerIdentity.channelId === eventPayload.channelId) {
|
8146
8160
|
channelClient.disconnectListener(eventPayload);
|
8147
|
-
__classPrivateFieldGet$
|
8161
|
+
__classPrivateFieldGet$c(channelClient, _ChannelClient_close, "f").call(channelClient);
|
8148
8162
|
}
|
8149
8163
|
}
|
8150
8164
|
}
|
8151
8165
|
/**
|
8152
8166
|
* @internal
|
8153
8167
|
*/
|
8154
|
-
constructor(routingInfo,
|
8168
|
+
constructor(routingInfo, close, strategy) {
|
8155
8169
|
super();
|
8156
8170
|
_ChannelClient_protectedObj.set(this, void 0);
|
8157
8171
|
_ChannelClient_strategy.set(this, void 0);
|
@@ -8159,12 +8173,12 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
8159
8173
|
this.processAction = (action, payload, senderIdentity) => super.processAction(action, payload, senderIdentity);
|
8160
8174
|
_ChannelClient_close.set(this, () => {
|
8161
8175
|
channelClientsByEndpointId.delete(this.endpointId);
|
8162
|
-
__classPrivateFieldGet$
|
8176
|
+
__classPrivateFieldGet$c(this, _ChannelClient_strategy, "f").close();
|
8163
8177
|
});
|
8164
|
-
__classPrivateFieldSet$
|
8178
|
+
__classPrivateFieldSet$a(this, _ChannelClient_protectedObj, new channel_1$1.ProtectedItems(routingInfo, close), "f");
|
8165
8179
|
this.disconnectListener = () => undefined;
|
8166
8180
|
this.endpointId = routingInfo.endpointId;
|
8167
|
-
__classPrivateFieldSet$
|
8181
|
+
__classPrivateFieldSet$a(this, _ChannelClient_strategy, strategy, "f");
|
8168
8182
|
channelClientsByEndpointId.set(this.endpointId, this);
|
8169
8183
|
strategy.receive(this.processAction);
|
8170
8184
|
}
|
@@ -8172,7 +8186,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
8172
8186
|
* a read-only provider identity
|
8173
8187
|
*/
|
8174
8188
|
get providerIdentity() {
|
8175
|
-
const protectedObj = __classPrivateFieldGet$
|
8189
|
+
const protectedObj = __classPrivateFieldGet$c(this, _ChannelClient_protectedObj, "f");
|
8176
8190
|
return protectedObj.providerIdentity;
|
8177
8191
|
}
|
8178
8192
|
/**
|
@@ -8201,8 +8215,8 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
8201
8215
|
* ```
|
8202
8216
|
*/
|
8203
8217
|
async dispatch(action, payload) {
|
8204
|
-
if (__classPrivateFieldGet$
|
8205
|
-
return __classPrivateFieldGet$
|
8218
|
+
if (__classPrivateFieldGet$c(this, _ChannelClient_strategy, "f").isEndpointConnected(this.providerIdentity.channelId)) {
|
8219
|
+
return __classPrivateFieldGet$c(this, _ChannelClient_strategy, "f").send(this.providerIdentity.channelId, action, payload);
|
8206
8220
|
}
|
8207
8221
|
throw new Error('The client you are trying to dispatch from is disconnected from the target provider.');
|
8208
8222
|
}
|
@@ -8252,16 +8266,23 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
8252
8266
|
*/
|
8253
8267
|
async disconnect() {
|
8254
8268
|
await this.sendDisconnectAction();
|
8255
|
-
__classPrivateFieldGet$
|
8269
|
+
__classPrivateFieldGet$c(this, _ChannelClient_close, "f").call(this);
|
8256
8270
|
}
|
8257
8271
|
async sendDisconnectAction() {
|
8258
|
-
const protectedObj = __classPrivateFieldGet$
|
8259
|
-
|
8260
|
-
|
8272
|
+
const protectedObj = __classPrivateFieldGet$c(this, _ChannelClient_protectedObj, "f");
|
8273
|
+
await protectedObj.close();
|
8274
|
+
}
|
8275
|
+
/**
|
8276
|
+
* @internal
|
8277
|
+
* Writing this as a static to keep code together, but in environments with a wire, this will be DI'd into the protectedObject class as close.
|
8278
|
+
*/
|
8279
|
+
static async wireClose(wire, providerIdentity, endpointId) {
|
8280
|
+
const { channelName, uuid, name } = providerIdentity;
|
8281
|
+
await wire.sendAction('disconnect-from-channel', {
|
8261
8282
|
channelName,
|
8262
8283
|
uuid,
|
8263
8284
|
name,
|
8264
|
-
endpointId
|
8285
|
+
endpointId
|
8265
8286
|
});
|
8266
8287
|
}
|
8267
8288
|
}
|
@@ -8281,13 +8302,13 @@ exhaustive.exhaustiveCheck = exhaustiveCheck;
|
|
8281
8302
|
|
8282
8303
|
var strategy$3 = {};
|
8283
8304
|
|
8284
|
-
var __classPrivateFieldSet$
|
8305
|
+
var __classPrivateFieldSet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
8285
8306
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
8286
8307
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
8287
8308
|
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");
|
8288
8309
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
8289
8310
|
};
|
8290
|
-
var __classPrivateFieldGet$
|
8311
|
+
var __classPrivateFieldGet$b = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
8291
8312
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
8292
8313
|
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");
|
8293
8314
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
@@ -8312,7 +8333,7 @@ class ClassicStrategy {
|
|
8312
8333
|
// connection problems occur
|
8313
8334
|
_ClassicStrategy_pendingMessagesByEndpointId.set(this, new Map);
|
8314
8335
|
this.send = async (endpointId, action, payload) => {
|
8315
|
-
const to = __classPrivateFieldGet$
|
8336
|
+
const to = __classPrivateFieldGet$b(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
|
8316
8337
|
if (!to) {
|
8317
8338
|
throw new Error(`Could not locate routing info for endpoint ${endpointId}`);
|
8318
8339
|
}
|
@@ -8324,28 +8345,28 @@ class ClassicStrategy {
|
|
8324
8345
|
}
|
8325
8346
|
delete cleanId.isLocalEndpointId;
|
8326
8347
|
// grab the promise before awaiting it to save in our pending messages map
|
8327
|
-
const p = __classPrivateFieldGet$
|
8348
|
+
const p = __classPrivateFieldGet$b(this, _ClassicStrategy_wire, "f")
|
8328
8349
|
.sendAction('send-channel-message', {
|
8329
8350
|
...cleanId,
|
8330
8351
|
providerIdentity: this.providerIdentity,
|
8331
8352
|
action,
|
8332
8353
|
payload
|
8333
8354
|
});
|
8334
|
-
__classPrivateFieldGet$
|
8355
|
+
__classPrivateFieldGet$b(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.add(p);
|
8335
8356
|
const raw = await p.catch((error) => {
|
8336
8357
|
throw new Error(error.message);
|
8337
8358
|
}).finally(() => {
|
8338
8359
|
// clean up the pending promise
|
8339
|
-
__classPrivateFieldGet$
|
8360
|
+
__classPrivateFieldGet$b(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.delete(p);
|
8340
8361
|
});
|
8341
8362
|
return raw.payload.data.result;
|
8342
8363
|
};
|
8343
8364
|
this.close = async () => {
|
8344
8365
|
this.messageReceiver.removeEndpoint(this.providerIdentity.channelId, this.endpointId);
|
8345
|
-
[...__classPrivateFieldGet$
|
8346
|
-
__classPrivateFieldSet$
|
8366
|
+
[...__classPrivateFieldGet$b(this, _ClassicStrategy_endpointIdentityMap, "f").keys()].forEach((id) => this.closeEndpoint(id));
|
8367
|
+
__classPrivateFieldSet$9(this, _ClassicStrategy_endpointIdentityMap, new Map(), "f");
|
8347
8368
|
};
|
8348
|
-
__classPrivateFieldSet$
|
8369
|
+
__classPrivateFieldSet$9(this, _ClassicStrategy_wire, wire, "f");
|
8349
8370
|
}
|
8350
8371
|
onEndpointDisconnect(endpointId, listener) {
|
8351
8372
|
// Never fires for 'classic'.
|
@@ -8354,20 +8375,20 @@ class ClassicStrategy {
|
|
8354
8375
|
this.messageReceiver.addEndpoint(listener, this.providerIdentity.channelId, this.endpointId);
|
8355
8376
|
}
|
8356
8377
|
async closeEndpoint(endpointId) {
|
8357
|
-
const id = __classPrivateFieldGet$
|
8358
|
-
__classPrivateFieldGet$
|
8359
|
-
const pendingSet = __classPrivateFieldGet$
|
8378
|
+
const id = __classPrivateFieldGet$b(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
|
8379
|
+
__classPrivateFieldGet$b(this, _ClassicStrategy_endpointIdentityMap, "f").delete(endpointId);
|
8380
|
+
const pendingSet = __classPrivateFieldGet$b(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId);
|
8360
8381
|
pendingSet?.forEach((p) => {
|
8361
8382
|
const errorMsg = `Channel connection with identity uuid: ${id?.uuid} / name: ${id?.name} / endpointId: ${endpointId} no longer connected.`;
|
8362
8383
|
p.cancel(new Error(errorMsg));
|
8363
8384
|
});
|
8364
8385
|
}
|
8365
8386
|
isEndpointConnected(endpointId) {
|
8366
|
-
return __classPrivateFieldGet$
|
8387
|
+
return __classPrivateFieldGet$b(this, _ClassicStrategy_endpointIdentityMap, "f").has(endpointId);
|
8367
8388
|
}
|
8368
8389
|
addEndpoint(endpointId, payload) {
|
8369
|
-
__classPrivateFieldGet$
|
8370
|
-
__classPrivateFieldGet$
|
8390
|
+
__classPrivateFieldGet$b(this, _ClassicStrategy_endpointIdentityMap, "f").set(endpointId, payload.endpointIdentity);
|
8391
|
+
__classPrivateFieldGet$b(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").set(endpointId, new Set());
|
8371
8392
|
}
|
8372
8393
|
isValidEndpointPayload(payload) {
|
8373
8394
|
return (typeof payload?.endpointIdentity?.endpointId === 'string' ||
|
@@ -8398,12 +8419,12 @@ function errorToPOJO(error) {
|
|
8398
8419
|
}
|
8399
8420
|
errors.errorToPOJO = errorToPOJO;
|
8400
8421
|
|
8401
|
-
var __classPrivateFieldGet$
|
8422
|
+
var __classPrivateFieldGet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
8402
8423
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
8403
8424
|
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");
|
8404
8425
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
8405
8426
|
};
|
8406
|
-
var __classPrivateFieldSet$
|
8427
|
+
var __classPrivateFieldSet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
8407
8428
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
8408
8429
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
8409
8430
|
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");
|
@@ -8438,8 +8459,8 @@ class RTCEndpoint {
|
|
8438
8459
|
if (this.rtc.rtcClient.connectionState !== 'connected') {
|
8439
8460
|
this.rtc.rtcClient.removeEventListener('connectionstatechange', this.connectionStateChangeHandler);
|
8440
8461
|
this.close();
|
8441
|
-
if (__classPrivateFieldGet$
|
8442
|
-
__classPrivateFieldGet$
|
8462
|
+
if (__classPrivateFieldGet$a(this, _RTCEndpoint_disconnectListener, "f")) {
|
8463
|
+
__classPrivateFieldGet$a(this, _RTCEndpoint_disconnectListener, "f").call(this);
|
8443
8464
|
}
|
8444
8465
|
}
|
8445
8466
|
};
|
@@ -8487,9 +8508,9 @@ class RTCEndpoint {
|
|
8487
8508
|
data = new TextDecoder().decode(e.data);
|
8488
8509
|
}
|
8489
8510
|
const { messageId, action, payload } = JSON.parse(data);
|
8490
|
-
if (__classPrivateFieldGet$
|
8511
|
+
if (__classPrivateFieldGet$a(this, _RTCEndpoint_processAction, "f")) {
|
8491
8512
|
try {
|
8492
|
-
const res = await __classPrivateFieldGet$
|
8513
|
+
const res = await __classPrivateFieldGet$a(this, _RTCEndpoint_processAction, "f").call(this, action, payload, endpointIdentity);
|
8493
8514
|
this.rtc.channels.response.send(JSON.stringify({
|
8494
8515
|
messageId,
|
8495
8516
|
payload: res,
|
@@ -8523,25 +8544,25 @@ class RTCEndpoint {
|
|
8523
8544
|
datachannel.onclose = (e) => {
|
8524
8545
|
[...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.')));
|
8525
8546
|
this.close();
|
8526
|
-
if (__classPrivateFieldGet$
|
8527
|
-
__classPrivateFieldGet$
|
8547
|
+
if (__classPrivateFieldGet$a(this, _RTCEndpoint_disconnectListener, "f")) {
|
8548
|
+
__classPrivateFieldGet$a(this, _RTCEndpoint_disconnectListener, "f").call(this);
|
8528
8549
|
}
|
8529
8550
|
};
|
8530
8551
|
});
|
8531
8552
|
}
|
8532
8553
|
onDisconnect(listener) {
|
8533
|
-
if (!__classPrivateFieldGet$
|
8534
|
-
__classPrivateFieldSet$
|
8554
|
+
if (!__classPrivateFieldGet$a(this, _RTCEndpoint_disconnectListener, "f")) {
|
8555
|
+
__classPrivateFieldSet$8(this, _RTCEndpoint_disconnectListener, listener, "f");
|
8535
8556
|
}
|
8536
8557
|
else {
|
8537
8558
|
throw new Error('RTCEndpoint disconnectListener cannot be set twice.');
|
8538
8559
|
}
|
8539
8560
|
}
|
8540
8561
|
receive(listener) {
|
8541
|
-
if (__classPrivateFieldGet$
|
8562
|
+
if (__classPrivateFieldGet$a(this, _RTCEndpoint_processAction, "f")) {
|
8542
8563
|
throw new Error('You have already set a listener for this RTC Endpoint.');
|
8543
8564
|
}
|
8544
|
-
__classPrivateFieldSet$
|
8565
|
+
__classPrivateFieldSet$8(this, _RTCEndpoint_processAction, listener, "f");
|
8545
8566
|
}
|
8546
8567
|
get connected() {
|
8547
8568
|
return this.rtc.rtcClient.connectionState === 'connected';
|
@@ -8552,12 +8573,12 @@ _RTCEndpoint_processAction = new WeakMap(), _RTCEndpoint_disconnectListener = ne
|
|
8552
8573
|
|
8553
8574
|
var strategy$1 = {};
|
8554
8575
|
|
8555
|
-
var __classPrivateFieldGet$
|
8576
|
+
var __classPrivateFieldGet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
8556
8577
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
8557
8578
|
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");
|
8558
8579
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
8559
8580
|
};
|
8560
|
-
var __classPrivateFieldSet$
|
8581
|
+
var __classPrivateFieldSet$7 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
8561
8582
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
8562
8583
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
8563
8584
|
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");
|
@@ -8578,11 +8599,11 @@ class EndpointStrategy {
|
|
8578
8599
|
return this.getEndpointById(endpointId).send(action, payload);
|
8579
8600
|
};
|
8580
8601
|
this.close = async () => {
|
8581
|
-
if (__classPrivateFieldGet$
|
8582
|
-
__classPrivateFieldGet$
|
8583
|
-
__classPrivateFieldSet$
|
8602
|
+
if (__classPrivateFieldGet$9(this, _EndpointStrategy_connected, "f")) {
|
8603
|
+
__classPrivateFieldGet$9(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.close());
|
8604
|
+
__classPrivateFieldSet$7(this, _EndpointStrategy_endpointMap, new Map(), "f");
|
8584
8605
|
}
|
8585
|
-
__classPrivateFieldSet$
|
8606
|
+
__classPrivateFieldSet$7(this, _EndpointStrategy_connected, false, "f");
|
8586
8607
|
};
|
8587
8608
|
this.isValidEndpointPayload = validateEndpoint;
|
8588
8609
|
}
|
@@ -8590,39 +8611,39 @@ class EndpointStrategy {
|
|
8590
8611
|
this.getEndpointById(endpointId).onDisconnect(listener);
|
8591
8612
|
}
|
8592
8613
|
receive(listener) {
|
8593
|
-
if (__classPrivateFieldGet$
|
8614
|
+
if (__classPrivateFieldGet$9(this, _EndpointStrategy_processAction, "f")) {
|
8594
8615
|
throw new Error(`You have already set a listener for this ${this.StrategyName} Strategy`);
|
8595
8616
|
}
|
8596
|
-
__classPrivateFieldSet$
|
8617
|
+
__classPrivateFieldSet$7(this, _EndpointStrategy_processAction, listener, "f");
|
8597
8618
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
8598
|
-
__classPrivateFieldGet$
|
8619
|
+
__classPrivateFieldGet$9(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.receive(__classPrivateFieldGet$9(this, _EndpointStrategy_processAction, "f")));
|
8599
8620
|
}
|
8600
8621
|
getEndpointById(endpointId) {
|
8601
|
-
const endpoint = __classPrivateFieldGet$
|
8622
|
+
const endpoint = __classPrivateFieldGet$9(this, _EndpointStrategy_endpointMap, "f").get(endpointId);
|
8602
8623
|
if (!endpoint) {
|
8603
8624
|
throw new Error(`Client with endpoint id ${endpointId} is not connected`);
|
8604
8625
|
}
|
8605
8626
|
return endpoint;
|
8606
8627
|
}
|
8607
8628
|
get connected() {
|
8608
|
-
return __classPrivateFieldGet$
|
8629
|
+
return __classPrivateFieldGet$9(this, _EndpointStrategy_connected, "f");
|
8609
8630
|
}
|
8610
8631
|
isEndpointConnected(endpointId) {
|
8611
|
-
return __classPrivateFieldGet$
|
8632
|
+
return __classPrivateFieldGet$9(this, _EndpointStrategy_endpointMap, "f").has(endpointId);
|
8612
8633
|
}
|
8613
8634
|
addEndpoint(endpointId, payload) {
|
8614
|
-
if (!__classPrivateFieldGet$
|
8635
|
+
if (!__classPrivateFieldGet$9(this, _EndpointStrategy_connected, "f")) {
|
8615
8636
|
console.warn(`Adding endpoint to disconnected ${this.StrategyName} Strategy`);
|
8616
8637
|
return;
|
8617
8638
|
}
|
8618
8639
|
const clientStrat = new this.EndpointType(payload);
|
8619
|
-
if (__classPrivateFieldGet$
|
8620
|
-
clientStrat.receive(__classPrivateFieldGet$
|
8640
|
+
if (__classPrivateFieldGet$9(this, _EndpointStrategy_processAction, "f")) {
|
8641
|
+
clientStrat.receive(__classPrivateFieldGet$9(this, _EndpointStrategy_processAction, "f"));
|
8621
8642
|
}
|
8622
|
-
__classPrivateFieldGet$
|
8643
|
+
__classPrivateFieldGet$9(this, _EndpointStrategy_endpointMap, "f").set(endpointId, clientStrat);
|
8623
8644
|
}
|
8624
8645
|
async closeEndpoint(endpointId) {
|
8625
|
-
__classPrivateFieldGet$
|
8646
|
+
__classPrivateFieldGet$9(this, _EndpointStrategy_endpointMap, "f").delete(endpointId);
|
8626
8647
|
}
|
8627
8648
|
}
|
8628
8649
|
strategy$1.EndpointStrategy = EndpointStrategy;
|
@@ -8649,11 +8670,11 @@ var iceManager = {};
|
|
8649
8670
|
|
8650
8671
|
Object.defineProperty(iceManager, "__esModule", { value: true });
|
8651
8672
|
iceManager.RTCICEManager = void 0;
|
8652
|
-
const base_1$
|
8673
|
+
const base_1$h = base;
|
8653
8674
|
/*
|
8654
8675
|
Singleton that facilitates Offer and Answer exchange required for establishing RTC connections.
|
8655
8676
|
*/
|
8656
|
-
class RTCICEManager extends base_1$
|
8677
|
+
class RTCICEManager extends base_1$h.EmitterBase {
|
8657
8678
|
constructor(wire) {
|
8658
8679
|
super(wire, 'channel');
|
8659
8680
|
this.ensureChannelOpened = (channel) => {
|
@@ -8804,12 +8825,12 @@ function runtimeUuidMeetsMinimumRuntimeVersion(runtimeUuid, minVersion) {
|
|
8804
8825
|
}
|
8805
8826
|
runtimeVersioning.runtimeUuidMeetsMinimumRuntimeVersion = runtimeUuidMeetsMinimumRuntimeVersion;
|
8806
8827
|
|
8807
|
-
var __classPrivateFieldGet$
|
8828
|
+
var __classPrivateFieldGet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
8808
8829
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
8809
8830
|
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");
|
8810
8831
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
8811
8832
|
};
|
8812
|
-
var __classPrivateFieldSet$
|
8833
|
+
var __classPrivateFieldSet$6 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
8813
8834
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
8814
8835
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
8815
8836
|
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");
|
@@ -8851,18 +8872,18 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
8851
8872
|
* a read-only array containing all the identities of connecting clients.
|
8852
8873
|
*/
|
8853
8874
|
get connections() {
|
8854
|
-
return [...__classPrivateFieldGet$
|
8875
|
+
return [...__classPrivateFieldGet$8(this, _ChannelProvider_connections, "f")];
|
8855
8876
|
}
|
8856
8877
|
static handleClientDisconnection(channel, payload) {
|
8857
8878
|
const removeById = channel.connections.find((identity) => identity.endpointId === payload.endpointId);
|
8858
8879
|
if (removeById) {
|
8859
|
-
__classPrivateFieldGet$
|
8880
|
+
__classPrivateFieldGet$8(channel, _ChannelProvider_removeEndpoint, "f").call(channel, removeById);
|
8860
8881
|
}
|
8861
8882
|
else {
|
8862
8883
|
const multipleRemoves = channel.connections.filter((identity) => {
|
8863
8884
|
return identity.uuid === payload.uuid && identity.name === payload.name;
|
8864
8885
|
});
|
8865
|
-
multipleRemoves.forEach(__classPrivateFieldGet$
|
8886
|
+
multipleRemoves.forEach(__classPrivateFieldGet$8(channel, _ChannelProvider_removeEndpoint, "f"));
|
8866
8887
|
}
|
8867
8888
|
channel.disconnectListener(payload);
|
8868
8889
|
}
|
@@ -8872,15 +8893,15 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
8872
8893
|
/**
|
8873
8894
|
* @internal
|
8874
8895
|
*/
|
8875
|
-
constructor(providerIdentity,
|
8896
|
+
constructor(providerIdentity, close, strategy) {
|
8876
8897
|
super();
|
8877
8898
|
_ChannelProvider_connections.set(this, void 0);
|
8878
8899
|
_ChannelProvider_protectedObj.set(this, void 0);
|
8879
8900
|
_ChannelProvider_strategy.set(this, void 0);
|
8880
8901
|
_ChannelProvider_removeEndpoint.set(this, (identity) => {
|
8881
8902
|
const remainingConnections = this.connections.filter((clientIdentity) => clientIdentity.endpointId !== identity.endpointId);
|
8882
|
-
__classPrivateFieldGet$
|
8883
|
-
__classPrivateFieldSet$
|
8903
|
+
__classPrivateFieldGet$8(this, _ChannelProvider_strategy, "f").closeEndpoint(identity.endpointId);
|
8904
|
+
__classPrivateFieldSet$6(this, _ChannelProvider_connections, remainingConnections, "f");
|
8884
8905
|
});
|
8885
8906
|
// Must be bound.
|
8886
8907
|
this.processAction = async (action, payload, senderIdentity) => {
|
@@ -8894,17 +8915,17 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
8894
8915
|
return super.processAction(action, payload, senderIdentity);
|
8895
8916
|
};
|
8896
8917
|
_ChannelProvider_close.set(this, () => {
|
8897
|
-
__classPrivateFieldGet$
|
8918
|
+
__classPrivateFieldGet$8(this, _ChannelProvider_strategy, "f").close();
|
8898
8919
|
const remove = ChannelProvider.removalMap.get(this);
|
8899
8920
|
if (remove) {
|
8900
8921
|
remove();
|
8901
8922
|
}
|
8902
8923
|
});
|
8903
|
-
__classPrivateFieldSet$
|
8924
|
+
__classPrivateFieldSet$6(this, _ChannelProvider_protectedObj, new channel_1.ProtectedItems(providerIdentity, close), "f");
|
8904
8925
|
this.connectListener = () => undefined;
|
8905
8926
|
this.disconnectListener = () => undefined;
|
8906
|
-
__classPrivateFieldSet$
|
8907
|
-
__classPrivateFieldSet$
|
8927
|
+
__classPrivateFieldSet$6(this, _ChannelProvider_connections, [], "f");
|
8928
|
+
__classPrivateFieldSet$6(this, _ChannelProvider_strategy, strategy, "f");
|
8908
8929
|
strategy.receive(this.processAction);
|
8909
8930
|
}
|
8910
8931
|
/**
|
@@ -8935,13 +8956,13 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
8935
8956
|
*/
|
8936
8957
|
dispatch(to, action, payload) {
|
8937
8958
|
const endpointId = to.endpointId ?? this.getEndpointIdForOpenFinId(to, action);
|
8938
|
-
if (endpointId && __classPrivateFieldGet$
|
8939
|
-
return __classPrivateFieldGet$
|
8959
|
+
if (endpointId && __classPrivateFieldGet$8(this, _ChannelProvider_strategy, "f").isEndpointConnected(endpointId)) {
|
8960
|
+
return __classPrivateFieldGet$8(this, _ChannelProvider_strategy, "f").send(endpointId, action, payload);
|
8940
8961
|
}
|
8941
8962
|
return Promise.reject(new Error(`Client connection with identity uuid: ${to.uuid} / name: ${to.name} / endpointId: ${endpointId} no longer connected.`));
|
8942
8963
|
}
|
8943
8964
|
async processConnection(senderId, payload) {
|
8944
|
-
__classPrivateFieldGet$
|
8965
|
+
__classPrivateFieldGet$8(this, _ChannelProvider_connections, "f").push(senderId);
|
8945
8966
|
return this.connectListener(senderId, payload);
|
8946
8967
|
}
|
8947
8968
|
/**
|
@@ -8964,7 +8985,7 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
8964
8985
|
* ```
|
8965
8986
|
*/
|
8966
8987
|
publish(action, payload) {
|
8967
|
-
return this.connections.map((to) => __classPrivateFieldGet$
|
8988
|
+
return this.connections.map((to) => __classPrivateFieldGet$8(this, _ChannelProvider_strategy, "f").send(to.endpointId, action, payload));
|
8968
8989
|
}
|
8969
8990
|
/**
|
8970
8991
|
* Register a listener that is called on every new client connection.
|
@@ -9038,11 +9059,11 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
9038
9059
|
* ```
|
9039
9060
|
*/
|
9040
9061
|
async destroy() {
|
9041
|
-
const protectedObj = __classPrivateFieldGet$
|
9042
|
-
|
9043
|
-
__classPrivateFieldSet$
|
9044
|
-
await protectedObj.
|
9045
|
-
__classPrivateFieldGet$
|
9062
|
+
const protectedObj = __classPrivateFieldGet$8(this, _ChannelProvider_protectedObj, "f");
|
9063
|
+
protectedObj.providerIdentity;
|
9064
|
+
__classPrivateFieldSet$6(this, _ChannelProvider_connections, [], "f");
|
9065
|
+
await protectedObj.close();
|
9066
|
+
__classPrivateFieldGet$8(this, _ChannelProvider_close, "f").call(this);
|
9046
9067
|
}
|
9047
9068
|
/**
|
9048
9069
|
* Returns an array with info on every Client connected to the Provider
|
@@ -9112,7 +9133,7 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
9112
9133
|
getEndpointIdForOpenFinId(clientIdentity, action) {
|
9113
9134
|
const matchingConnections = this.connections.filter((c) => c.name === clientIdentity.name && c.uuid === clientIdentity.uuid);
|
9114
9135
|
if (matchingConnections.length >= 2) {
|
9115
|
-
const protectedObj = __classPrivateFieldGet$
|
9136
|
+
const protectedObj = __classPrivateFieldGet$8(this, _ChannelProvider_protectedObj, "f");
|
9116
9137
|
const { uuid, name } = clientIdentity;
|
9117
9138
|
const providerUuid = protectedObj?.providerIdentity.uuid;
|
9118
9139
|
const providerName = protectedObj?.providerIdentity.name;
|
@@ -9133,6 +9154,9 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
9133
9154
|
static clientIsMultiRuntime(subscriptionIdentity) {
|
9134
9155
|
return subscriptionIdentity.runtimeUuid !== undefined;
|
9135
9156
|
}
|
9157
|
+
static async wireClose(wire, channelName) {
|
9158
|
+
await wire.sendAction('destroy-channel', { channelName });
|
9159
|
+
}
|
9136
9160
|
}
|
9137
9161
|
provider.ChannelProvider = ChannelProvider;
|
9138
9162
|
_ChannelProvider_connections = new WeakMap(), _ChannelProvider_protectedObj = new WeakMap(), _ChannelProvider_strategy = new WeakMap(), _ChannelProvider_removeEndpoint = new WeakMap(), _ChannelProvider_close = new WeakMap();
|
@@ -9145,13 +9169,13 @@ var messageReceiver = {};
|
|
9145
9169
|
Object.defineProperty(messageReceiver, "__esModule", { value: true });
|
9146
9170
|
messageReceiver.MessageReceiver = void 0;
|
9147
9171
|
const client_1$1 = client;
|
9148
|
-
const base_1$
|
9172
|
+
const base_1$g = base;
|
9149
9173
|
/*
|
9150
9174
|
This is a singleton (per fin object) tasked with routing messages coming off the ipc to the correct endpoint.
|
9151
9175
|
It needs to be a singleton because there can only be one per wire. It tracks both clients and providers' processAction passed in via the strategy.
|
9152
9176
|
If functionality is not about receiving messages, it does not belong here.
|
9153
9177
|
*/
|
9154
|
-
class MessageReceiver extends base_1$
|
9178
|
+
class MessageReceiver extends base_1$g.Base {
|
9155
9179
|
constructor(wire) {
|
9156
9180
|
super(wire);
|
9157
9181
|
this.onmessage = (msg) => {
|
@@ -9318,13 +9342,13 @@ class CombinedStrategy {
|
|
9318
9342
|
}
|
9319
9343
|
strategy.default = CombinedStrategy;
|
9320
9344
|
|
9321
|
-
var __classPrivateFieldSet$
|
9345
|
+
var __classPrivateFieldSet$5 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
9322
9346
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
9323
9347
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
9324
9348
|
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");
|
9325
9349
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
9326
9350
|
};
|
9327
|
-
var __classPrivateFieldGet$
|
9351
|
+
var __classPrivateFieldGet$7 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
9328
9352
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
9329
9353
|
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");
|
9330
9354
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
@@ -9333,7 +9357,7 @@ var _ConnectionManager_messageReceiver, _ConnectionManager_rtcConnectionManager;
|
|
9333
9357
|
Object.defineProperty(connectionManager, "__esModule", { value: true });
|
9334
9358
|
connectionManager.ConnectionManager = void 0;
|
9335
9359
|
const exhaustive_1 = exhaustive;
|
9336
|
-
const base_1$
|
9360
|
+
const base_1$f = base;
|
9337
9361
|
const strategy_1 = strategy$3;
|
9338
9362
|
const strategy_2 = strategy$2;
|
9339
9363
|
const ice_manager_1 = iceManager;
|
@@ -9341,7 +9365,7 @@ const provider_1$1 = provider;
|
|
9341
9365
|
const message_receiver_1 = messageReceiver;
|
9342
9366
|
const protocol_manager_1 = protocolManager;
|
9343
9367
|
const strategy_3 = strategy;
|
9344
|
-
class ConnectionManager extends base_1$
|
9368
|
+
class ConnectionManager extends base_1$f.Base {
|
9345
9369
|
static getProtocolOptionsFromStrings(protocols) {
|
9346
9370
|
return protocols.map((protocol) => {
|
9347
9371
|
switch (protocol) {
|
@@ -9370,8 +9394,8 @@ class ConnectionManager extends base_1$g.Base {
|
|
9370
9394
|
};
|
9371
9395
|
this.providerMap = new Map();
|
9372
9396
|
this.protocolManager = new protocol_manager_1.ProtocolManager(this.wire.environment.type === 'node' ? ['classic'] : ['rtc', 'classic']);
|
9373
|
-
__classPrivateFieldSet$
|
9374
|
-
__classPrivateFieldSet$
|
9397
|
+
__classPrivateFieldSet$5(this, _ConnectionManager_messageReceiver, new message_receiver_1.MessageReceiver(wire), "f");
|
9398
|
+
__classPrivateFieldSet$5(this, _ConnectionManager_rtcConnectionManager, new ice_manager_1.RTCICEManager(wire), "f");
|
9375
9399
|
wire.registerMessageHandler(this.onmessage.bind(this));
|
9376
9400
|
}
|
9377
9401
|
createProvider(options, providerIdentity) {
|
@@ -9382,7 +9406,7 @@ class ConnectionManager extends base_1$g.Base {
|
|
9382
9406
|
case 'rtc':
|
9383
9407
|
return new strategy_2.RTCStrategy();
|
9384
9408
|
case 'classic':
|
9385
|
-
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$
|
9409
|
+
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$7(this, _ConnectionManager_messageReceiver, "f"),
|
9386
9410
|
// Providers do not have an endpointId, use channelId as endpointId in the strategy.
|
9387
9411
|
providerIdentity.channelId, providerIdentity);
|
9388
9412
|
default:
|
@@ -9402,7 +9426,7 @@ class ConnectionManager extends base_1$g.Base {
|
|
9402
9426
|
// Should be impossible.
|
9403
9427
|
throw new Error('failed to combine strategies');
|
9404
9428
|
}
|
9405
|
-
const channel = new provider_1$1.ChannelProvider(providerIdentity, this.wire, strategy);
|
9429
|
+
const channel = new provider_1$1.ChannelProvider(providerIdentity, () => provider_1$1.ChannelProvider.wireClose(this.wire, providerIdentity.channelName), strategy);
|
9406
9430
|
const key = providerIdentity.channelId;
|
9407
9431
|
this.providerMap.set(key, {
|
9408
9432
|
provider: channel,
|
@@ -9418,7 +9442,7 @@ class ConnectionManager extends base_1$g.Base {
|
|
9418
9442
|
const supportedProtocols = await Promise.all(protocols.map(async (type) => {
|
9419
9443
|
switch (type) {
|
9420
9444
|
case 'rtc': {
|
9421
|
-
const { rtcClient, channels, offer, rtcConnectionId, channelsOpened } = await __classPrivateFieldGet$
|
9445
|
+
const { rtcClient, channels, offer, rtcConnectionId, channelsOpened } = await __classPrivateFieldGet$7(this, _ConnectionManager_rtcConnectionManager, "f").startClientOffer();
|
9422
9446
|
rtcPacket = { rtcClient, channels, channelsOpened };
|
9423
9447
|
return {
|
9424
9448
|
type: 'rtc',
|
@@ -9445,18 +9469,18 @@ class ConnectionManager extends base_1$g.Base {
|
|
9445
9469
|
routingInfo.endpointId = this.wire.environment.getNextMessageId();
|
9446
9470
|
// For New Clients connecting to Old Providers. To prevent multi-dispatching and publishing, we delete previously-connected
|
9447
9471
|
// clients that are in the same context as the newly-connected client.
|
9448
|
-
__classPrivateFieldGet$
|
9472
|
+
__classPrivateFieldGet$7(this, _ConnectionManager_messageReceiver, "f").checkForPreviousClientConnection(routingInfo.channelId);
|
9449
9473
|
}
|
9450
9474
|
const answer = routingInfo.answer ?? {
|
9451
9475
|
supportedProtocols: [{ type: 'classic', version: 1 }]
|
9452
9476
|
};
|
9453
9477
|
const createStrategyFromAnswer = async (protocol) => {
|
9454
9478
|
if (protocol.type === 'rtc' && rtcPacket) {
|
9455
|
-
await __classPrivateFieldGet$
|
9479
|
+
await __classPrivateFieldGet$7(this, _ConnectionManager_rtcConnectionManager, "f").finishClientOffer(rtcPacket.rtcClient, protocol.payload.answer, rtcPacket.channelsOpened);
|
9456
9480
|
return new strategy_2.RTCStrategy();
|
9457
9481
|
}
|
9458
9482
|
if (protocol.type === 'classic') {
|
9459
|
-
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$
|
9483
|
+
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$7(this, _ConnectionManager_messageReceiver, "f"), routingInfo.endpointId, routingInfo);
|
9460
9484
|
}
|
9461
9485
|
return null;
|
9462
9486
|
};
|
@@ -9524,7 +9548,7 @@ class ConnectionManager extends base_1$g.Base {
|
|
9524
9548
|
clientAnswer = await overlappingProtocols.reduce(async (accumP, protocolToUse) => {
|
9525
9549
|
const answer = await accumP;
|
9526
9550
|
if (protocolToUse.type === 'rtc') {
|
9527
|
-
const { answer: rtcAnswer, rtcClient, channels } = await __classPrivateFieldGet$
|
9551
|
+
const { answer: rtcAnswer, rtcClient, channels } = await __classPrivateFieldGet$7(this, _ConnectionManager_rtcConnectionManager, "f").createProviderAnswer(protocolToUse.payload.rtcConnectionId, protocolToUse.payload.offer);
|
9528
9552
|
answer.supportedProtocols.push({
|
9529
9553
|
type: 'rtc',
|
9530
9554
|
version: strategy_2.RTCInfo.version,
|
@@ -9572,13 +9596,13 @@ _ConnectionManager_messageReceiver = new WeakMap(), _ConnectionManager_rtcConnec
|
|
9572
9596
|
*
|
9573
9597
|
* @packageDocumentation
|
9574
9598
|
*/
|
9575
|
-
var __classPrivateFieldSet$
|
9599
|
+
var __classPrivateFieldSet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
9576
9600
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
9577
9601
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
9578
9602
|
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");
|
9579
9603
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
9580
9604
|
};
|
9581
|
-
var __classPrivateFieldGet$
|
9605
|
+
var __classPrivateFieldGet$6 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
9582
9606
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
9583
9607
|
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");
|
9584
9608
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
@@ -9589,7 +9613,7 @@ channel$1.Channel = void 0;
|
|
9589
9613
|
/* eslint-disable no-console */
|
9590
9614
|
const events_1$5 = require$$0;
|
9591
9615
|
const lazy_1$1 = lazy;
|
9592
|
-
const base_1$
|
9616
|
+
const base_1$e = base;
|
9593
9617
|
const client_1 = client;
|
9594
9618
|
const connection_manager_1 = connectionManager;
|
9595
9619
|
const provider_1 = provider;
|
@@ -9620,7 +9644,7 @@ function retryDelay(count) {
|
|
9620
9644
|
* * {@link Channel.onChannelConnect onChannelConnect(listener)}
|
9621
9645
|
* * {@link Channel.onChannelDisconnect onChannelDisconnect(listener)}
|
9622
9646
|
*/
|
9623
|
-
class Channel extends base_1$
|
9647
|
+
class Channel extends base_1$e.EmitterBase {
|
9624
9648
|
/**
|
9625
9649
|
* @internal
|
9626
9650
|
*/
|
@@ -9635,11 +9659,11 @@ class Channel extends base_1$f.EmitterBase {
|
|
9635
9659
|
client_1.ChannelClient.handleProviderDisconnect(eventPayload);
|
9636
9660
|
}),
|
9637
9661
|
this.on('connected', (...args) => {
|
9638
|
-
__classPrivateFieldGet$
|
9662
|
+
__classPrivateFieldGet$6(this, _Channel_internalEmitter, "f").emit('connected', ...args);
|
9639
9663
|
})
|
9640
9664
|
]).catch(() => new Error('error setting up channel connection listeners'));
|
9641
9665
|
}));
|
9642
|
-
__classPrivateFieldSet$
|
9666
|
+
__classPrivateFieldSet$4(this, _Channel_connectionManager, new connection_manager_1.ConnectionManager(wire), "f");
|
9643
9667
|
}
|
9644
9668
|
/**
|
9645
9669
|
*
|
@@ -9714,7 +9738,7 @@ class Channel extends base_1$f.EmitterBase {
|
|
9714
9738
|
resolve(true);
|
9715
9739
|
}
|
9716
9740
|
};
|
9717
|
-
__classPrivateFieldGet$
|
9741
|
+
__classPrivateFieldGet$6(this, _Channel_internalEmitter, "f").on('connected', connectedListener);
|
9718
9742
|
});
|
9719
9743
|
try {
|
9720
9744
|
if (retryInfo.count > 0) {
|
@@ -9746,7 +9770,7 @@ class Channel extends base_1$f.EmitterBase {
|
|
9746
9770
|
finally {
|
9747
9771
|
retryInfo.count += 1;
|
9748
9772
|
// in case of other errors, remove our listener
|
9749
|
-
__classPrivateFieldGet$
|
9773
|
+
__classPrivateFieldGet$6(this, _Channel_internalEmitter, "f").removeListener('connected', connectedListener);
|
9750
9774
|
}
|
9751
9775
|
} while (shouldWait); // If we're waiting we retry the above loop
|
9752
9776
|
// Should wait was false, no channel was found.
|
@@ -9805,12 +9829,12 @@ class Channel extends base_1$f.EmitterBase {
|
|
9805
9829
|
async connect(channelName, options = {}) {
|
9806
9830
|
// Make sure we don't connect before listeners are set up
|
9807
9831
|
// This also errors if we're not in OpenFin, ensuring we don't run unnecessary code
|
9808
|
-
await __classPrivateFieldGet$
|
9832
|
+
await __classPrivateFieldGet$6(this, _Channel_readyToConnect, "f").getValue();
|
9809
9833
|
if (!channelName || typeof channelName !== 'string') {
|
9810
9834
|
throw new Error('Please provide a channelName string to connect to a channel.');
|
9811
9835
|
}
|
9812
9836
|
const opts = { wait: true, ...this.wire.environment.getDefaultChannelOptions().connect, ...options };
|
9813
|
-
const { offer, rtc: rtcPacket } = await __classPrivateFieldGet$
|
9837
|
+
const { offer, rtc: rtcPacket } = await __classPrivateFieldGet$6(this, _Channel_connectionManager, "f").createClientOffer(opts);
|
9814
9838
|
let connectionUrl;
|
9815
9839
|
if (this.fin.me.isFrame || this.fin.me.isView || this.fin.me.isWindow) {
|
9816
9840
|
connectionUrl = (await this.fin.me.getInfo()).url;
|
@@ -9822,8 +9846,8 @@ class Channel extends base_1$f.EmitterBase {
|
|
9822
9846
|
connectionUrl
|
9823
9847
|
};
|
9824
9848
|
const routingInfo = await this.safeConnect(channelName, opts.wait, connectPayload);
|
9825
|
-
const strategy = await __classPrivateFieldGet$
|
9826
|
-
const channel = new client_1.ChannelClient(routingInfo, this.wire, strategy);
|
9849
|
+
const strategy = await __classPrivateFieldGet$6(this, _Channel_connectionManager, "f").createClientStrategy(rtcPacket, routingInfo);
|
9850
|
+
const channel = new client_1.ChannelClient(routingInfo, () => client_1.ChannelClient.wireClose(this.wire, routingInfo, routingInfo.endpointId), strategy);
|
9827
9851
|
// It is the client's responsibility to handle endpoint disconnection to the provider.
|
9828
9852
|
// If the endpoint dies, the client will force a disconnection through the core.
|
9829
9853
|
// The provider does not care about endpoint disconnection.
|
@@ -9891,7 +9915,7 @@ class Channel extends base_1$f.EmitterBase {
|
|
9891
9915
|
throw new Error('Please provide a channelName to create a channel');
|
9892
9916
|
}
|
9893
9917
|
const { payload: { data: providerIdentity } } = await this.wire.sendAction('create-channel', { channelName });
|
9894
|
-
const channel = __classPrivateFieldGet$
|
9918
|
+
const channel = __classPrivateFieldGet$6(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
|
9895
9919
|
// TODO: fix typing (internal)
|
9896
9920
|
// @ts-expect-error
|
9897
9921
|
this.on('client-disconnected', (eventPayload) => {
|
@@ -9915,7 +9939,7 @@ interappbus.InterAppPayload = interappbus.InterApplicationBus = void 0;
|
|
9915
9939
|
* @packageDocumentation
|
9916
9940
|
*/
|
9917
9941
|
const events_1$4 = require$$0;
|
9918
|
-
const base_1$
|
9942
|
+
const base_1$d = base;
|
9919
9943
|
const ref_counter_1 = refCounter;
|
9920
9944
|
const index_1$2 = channel$1;
|
9921
9945
|
const validate_1$3 = validate;
|
@@ -9923,7 +9947,7 @@ const validate_1$3 = validate;
|
|
9923
9947
|
* A messaging bus that allows for pub/sub messaging between different applications.
|
9924
9948
|
*
|
9925
9949
|
*/
|
9926
|
-
class InterApplicationBus extends base_1$
|
9950
|
+
class InterApplicationBus extends base_1$d.Base {
|
9927
9951
|
/**
|
9928
9952
|
* @internal
|
9929
9953
|
*/
|
@@ -10129,12 +10153,12 @@ var clipboard = {};
|
|
10129
10153
|
*/
|
10130
10154
|
Object.defineProperty(clipboard, "__esModule", { value: true });
|
10131
10155
|
clipboard.Clipboard = void 0;
|
10132
|
-
const base_1$
|
10156
|
+
const base_1$c = base;
|
10133
10157
|
/**
|
10134
10158
|
* The Clipboard API allows reading and writing to the clipboard in multiple formats.
|
10135
10159
|
*
|
10136
10160
|
*/
|
10137
|
-
class Clipboard extends base_1$
|
10161
|
+
class Clipboard extends base_1$c.Base {
|
10138
10162
|
/**
|
10139
10163
|
* Writes data into the clipboard as plain text
|
10140
10164
|
* @param writeObj The object for writing data into the clipboard
|
@@ -10323,7 +10347,7 @@ var Instance$4 = {};
|
|
10323
10347
|
Object.defineProperty(Instance$4, "__esModule", { value: true });
|
10324
10348
|
Instance$4.ExternalApplication = void 0;
|
10325
10349
|
/* eslint-disable import/prefer-default-export */
|
10326
|
-
const base_1$
|
10350
|
+
const base_1$b = base;
|
10327
10351
|
/**
|
10328
10352
|
* An ExternalApplication object representing native language adapter connections to the runtime. Allows
|
10329
10353
|
* the developer to listen to {@link OpenFin.ExternalApplicationEvents external application events}.
|
@@ -10334,7 +10358,7 @@ const base_1$c = base;
|
|
10334
10358
|
* - Processes started via `System.launchExternalApplication`
|
10335
10359
|
* - Processes monitored via `System.monitorExternalProcess`
|
10336
10360
|
*/
|
10337
|
-
class ExternalApplication extends base_1$
|
10361
|
+
class ExternalApplication extends base_1$b.EmitterBase {
|
10338
10362
|
/**
|
10339
10363
|
* @internal
|
10340
10364
|
*/
|
@@ -10362,12 +10386,12 @@ Instance$4.ExternalApplication = ExternalApplication;
|
|
10362
10386
|
|
10363
10387
|
Object.defineProperty(Factory$5, "__esModule", { value: true });
|
10364
10388
|
Factory$5.ExternalApplicationModule = void 0;
|
10365
|
-
const base_1$
|
10389
|
+
const base_1$a = base;
|
10366
10390
|
const Instance_1$4 = Instance$4;
|
10367
10391
|
/**
|
10368
10392
|
* Static namespace for OpenFin API methods that interact with the {@link ExternalApplication} class, available under `fin.ExternalApplication`.
|
10369
10393
|
*/
|
10370
|
-
class ExternalApplicationModule extends base_1$
|
10394
|
+
class ExternalApplicationModule extends base_1$a.Base {
|
10371
10395
|
/**
|
10372
10396
|
* Asynchronously returns an External Application object that represents an external application.
|
10373
10397
|
* <br>It is possible to wrap a process that does not yet exist, (for example, to listen for startup-related events)
|
@@ -10449,7 +10473,7 @@ var Instance$3 = {};
|
|
10449
10473
|
Object.defineProperty(Instance$3, "__esModule", { value: true });
|
10450
10474
|
Instance$3._Frame = void 0;
|
10451
10475
|
/* eslint-disable import/prefer-default-export */
|
10452
|
-
const base_1$
|
10476
|
+
const base_1$9 = base;
|
10453
10477
|
/**
|
10454
10478
|
* An iframe represents an embedded HTML page within a parent HTML page. Because this embedded page
|
10455
10479
|
* has its own DOM and global JS context (which may or may not be linked to that of the parent depending
|
@@ -10470,7 +10494,7 @@ const base_1$a = base;
|
|
10470
10494
|
* The fin.Frame namespace represents a way to interact with `iframes` and facilitates the discovery of current context
|
10471
10495
|
* (iframe or main window) as well as the ability to listen for {@link OpenFin.FrameEvents frame-specific events}.
|
10472
10496
|
*/
|
10473
|
-
class _Frame extends base_1$
|
10497
|
+
class _Frame extends base_1$9.EmitterBase {
|
10474
10498
|
/**
|
10475
10499
|
* @internal
|
10476
10500
|
*/
|
@@ -10516,13 +10540,13 @@ Instance$3._Frame = _Frame;
|
|
10516
10540
|
|
10517
10541
|
Object.defineProperty(Factory$4, "__esModule", { value: true });
|
10518
10542
|
Factory$4._FrameModule = void 0;
|
10519
|
-
const base_1$
|
10543
|
+
const base_1$8 = base;
|
10520
10544
|
const validate_1$2 = validate;
|
10521
10545
|
const Instance_1$3 = Instance$3;
|
10522
10546
|
/**
|
10523
10547
|
* Static namespace for OpenFin API methods that interact with the {@link _Frame} class, available under `fin.Frame`.
|
10524
10548
|
*/
|
10525
|
-
class _FrameModule extends base_1$
|
10549
|
+
class _FrameModule extends base_1$8.Base {
|
10526
10550
|
/**
|
10527
10551
|
* Asynchronously returns an API handle for the given Frame identity.
|
10528
10552
|
*
|
@@ -10643,12 +10667,12 @@ var globalHotkey = {};
|
|
10643
10667
|
|
10644
10668
|
Object.defineProperty(globalHotkey, "__esModule", { value: true });
|
10645
10669
|
globalHotkey.GlobalHotkey = void 0;
|
10646
|
-
const base_1$
|
10670
|
+
const base_1$7 = base;
|
10647
10671
|
/**
|
10648
10672
|
* The GlobalHotkey module can register/unregister a global hotkeys.
|
10649
10673
|
*
|
10650
10674
|
*/
|
10651
|
-
class GlobalHotkey extends base_1$
|
10675
|
+
class GlobalHotkey extends base_1$7.EmitterBase {
|
10652
10676
|
/**
|
10653
10677
|
* @internal
|
10654
10678
|
*/
|
@@ -10782,7 +10806,7 @@ var Factory$3 = {};
|
|
10782
10806
|
|
10783
10807
|
var Instance$2 = {};
|
10784
10808
|
|
10785
|
-
var __classPrivateFieldGet$
|
10809
|
+
var __classPrivateFieldGet$5 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
10786
10810
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
10787
10811
|
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");
|
10788
10812
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
@@ -10791,7 +10815,7 @@ var _Platform_connectToProvider;
|
|
10791
10815
|
Object.defineProperty(Instance$2, "__esModule", { value: true });
|
10792
10816
|
Instance$2.Platform = void 0;
|
10793
10817
|
/* eslint-disable import/prefer-default-export, no-undef */
|
10794
|
-
const base_1$
|
10818
|
+
const base_1$6 = base;
|
10795
10819
|
const validate_1$1 = validate;
|
10796
10820
|
// Reuse clients to avoid overwriting already-registered client in provider
|
10797
10821
|
const clientMap = new Map();
|
@@ -10800,7 +10824,7 @@ const clientMap = new Map();
|
|
10800
10824
|
* Enables taking snapshots of itself and applying them to restore a previous configuration
|
10801
10825
|
* as well as listen to {@link OpenFin.PlatformEvents platform events}.
|
10802
10826
|
*/
|
10803
|
-
class Platform extends base_1$
|
10827
|
+
class Platform extends base_1$6.EmitterBase {
|
10804
10828
|
/**
|
10805
10829
|
* @internal
|
10806
10830
|
*/
|
@@ -10815,7 +10839,7 @@ class Platform extends base_1$7.EmitterBase {
|
|
10815
10839
|
const target = identity || this.identity;
|
10816
10840
|
const { uuid } = target;
|
10817
10841
|
if (!clientMap.has(uuid)) {
|
10818
|
-
const clientPromise = __classPrivateFieldGet$
|
10842
|
+
const clientPromise = __classPrivateFieldGet$5(this, _Platform_connectToProvider, "f").call(this, uuid);
|
10819
10843
|
clientMap.set(uuid, clientPromise);
|
10820
10844
|
}
|
10821
10845
|
// we set it above
|
@@ -11640,7 +11664,7 @@ function overrideFromComposables(...overrides) {
|
|
11640
11664
|
commonUtils.overrideFromComposables = overrideFromComposables;
|
11641
11665
|
commonUtils.default = { isValidPresetType };
|
11642
11666
|
|
11643
|
-
var __classPrivateFieldGet$
|
11667
|
+
var __classPrivateFieldGet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
11644
11668
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
11645
11669
|
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");
|
11646
11670
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
@@ -11650,7 +11674,7 @@ Object.defineProperty(Instance$1, "__esModule", { value: true });
|
|
11650
11674
|
Instance$1.Layout = void 0;
|
11651
11675
|
const lazy_1 = lazy;
|
11652
11676
|
const validate_1 = validate;
|
11653
|
-
const base_1$
|
11677
|
+
const base_1$5 = base;
|
11654
11678
|
const common_utils_1 = commonUtils;
|
11655
11679
|
const layout_entities_1 = layoutEntities;
|
11656
11680
|
const layout_constants_1$1 = layout_constants;
|
@@ -11786,7 +11810,7 @@ const layout_constants_1$1 = layout_constants;
|
|
11786
11810
|
* }
|
11787
11811
|
* ```
|
11788
11812
|
*/
|
11789
|
-
class Layout extends base_1$
|
11813
|
+
class Layout extends base_1$5.Base {
|
11790
11814
|
/**
|
11791
11815
|
* @internal
|
11792
11816
|
*/
|
@@ -12007,7 +12031,7 @@ class Layout extends base_1$6.Base {
|
|
12007
12031
|
this.wire.sendAction('layout-get-root-item').catch(() => {
|
12008
12032
|
// don't expose
|
12009
12033
|
});
|
12010
|
-
const client = await __classPrivateFieldGet$
|
12034
|
+
const client = await __classPrivateFieldGet$4(this, _Layout_layoutClient, "f").getValue();
|
12011
12035
|
const root = await client.getRoot('layoutName' in this.identity ? this.identity : undefined);
|
12012
12036
|
return layout_entities_1.LayoutNode.getEntity(root, client);
|
12013
12037
|
}
|
@@ -12015,12 +12039,12 @@ class Layout extends base_1$6.Base {
|
|
12015
12039
|
Instance$1.Layout = Layout;
|
12016
12040
|
_Layout_layoutClient = new WeakMap();
|
12017
12041
|
|
12018
|
-
var __classPrivateFieldGet$
|
12042
|
+
var __classPrivateFieldGet$3 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
12019
12043
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
12020
12044
|
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");
|
12021
12045
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
12022
12046
|
};
|
12023
|
-
var __classPrivateFieldSet$
|
12047
|
+
var __classPrivateFieldSet$3 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
12024
12048
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
12025
12049
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
12026
12050
|
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");
|
@@ -12029,13 +12053,13 @@ var __classPrivateFieldSet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateF
|
|
12029
12053
|
var _LayoutModule_instances, _LayoutModule_layoutInitializationAttempted, _LayoutModule_layoutManager, _LayoutModule_getLayoutManagerSpy, _LayoutModule_getSafeLayoutManager;
|
12030
12054
|
Object.defineProperty(Factory$2, "__esModule", { value: true });
|
12031
12055
|
Factory$2.LayoutModule = void 0;
|
12032
|
-
const base_1$
|
12056
|
+
const base_1$4 = base;
|
12033
12057
|
const Instance_1$2 = Instance$1;
|
12034
12058
|
const layout_constants_1 = layout_constants;
|
12035
12059
|
/**
|
12036
12060
|
* Static namespace for OpenFin API methods that interact with the {@link Layout} class, available under `fin.Platform.Layout`.
|
12037
12061
|
*/
|
12038
|
-
class LayoutModule extends base_1$
|
12062
|
+
class LayoutModule extends base_1$4.Base {
|
12039
12063
|
constructor() {
|
12040
12064
|
super(...arguments);
|
12041
12065
|
_LayoutModule_instances.add(this);
|
@@ -12086,19 +12110,19 @@ class LayoutModule extends base_1$5.Base {
|
|
12086
12110
|
if (!this.fin.me.isWindow) {
|
12087
12111
|
throw new Error('Layout.init can only be called from a Window context.');
|
12088
12112
|
}
|
12089
|
-
else if (__classPrivateFieldGet$
|
12113
|
+
else if (__classPrivateFieldGet$3(this, _LayoutModule_layoutInitializationAttempted, "f")) {
|
12090
12114
|
throw new Error('Layout.init was already called, please use Layout.create to add additional layouts.');
|
12091
12115
|
}
|
12092
|
-
__classPrivateFieldSet$
|
12116
|
+
__classPrivateFieldSet$3(this, _LayoutModule_layoutInitializationAttempted, true, "f");
|
12093
12117
|
// preload the client
|
12094
12118
|
await this.fin.Platform.getCurrentSync().getClient();
|
12095
|
-
__classPrivateFieldSet$
|
12096
|
-
await this.wire.environment.applyLayoutSnapshot(this.fin, __classPrivateFieldGet$
|
12119
|
+
__classPrivateFieldSet$3(this, _LayoutModule_layoutManager, await this.wire.environment.initLayoutManager(this.fin, this.wire, options), "f");
|
12120
|
+
await this.wire.environment.applyLayoutSnapshot(this.fin, __classPrivateFieldGet$3(this, _LayoutModule_layoutManager, "f"), options);
|
12097
12121
|
if (!options.layoutManagerOverride) {
|
12098
12122
|
// CORE-1081 to be removed when we actually delete the `layoutManager` prop
|
12099
12123
|
// in single-layout case, we return the undocumented layoutManager type
|
12100
12124
|
const layoutIdentity = { layoutName: layout_constants_1.DEFAULT_LAYOUT_KEY, ...this.fin.me.identity };
|
12101
|
-
return __classPrivateFieldGet$
|
12125
|
+
return __classPrivateFieldGet$3(this, _LayoutModule_getLayoutManagerSpy, "f").call(this, layoutIdentity);
|
12102
12126
|
}
|
12103
12127
|
return this.wrapSync(this.fin.me.identity);
|
12104
12128
|
};
|
@@ -12127,13 +12151,13 @@ class LayoutModule extends base_1$5.Base {
|
|
12127
12151
|
* @returns
|
12128
12152
|
*/
|
12129
12153
|
this.getCurrentLayoutManagerSync = () => {
|
12130
|
-
return __classPrivateFieldGet$
|
12154
|
+
return __classPrivateFieldGet$3(this, _LayoutModule_instances, "m", _LayoutModule_getSafeLayoutManager).call(this, `fin.Platform.Layout.getCurrentLayoutManagerSync()`);
|
12131
12155
|
};
|
12132
12156
|
this.create = async (options) => {
|
12133
|
-
return this.wire.environment.createLayout(__classPrivateFieldGet$
|
12157
|
+
return this.wire.environment.createLayout(__classPrivateFieldGet$3(this, _LayoutModule_instances, "m", _LayoutModule_getSafeLayoutManager).call(this, `fin.Platform.Layout.create()`), options);
|
12134
12158
|
};
|
12135
12159
|
this.destroy = async (layoutIdentity) => {
|
12136
|
-
return this.wire.environment.destroyLayout(__classPrivateFieldGet$
|
12160
|
+
return this.wire.environment.destroyLayout(__classPrivateFieldGet$3(this, _LayoutModule_instances, "m", _LayoutModule_getSafeLayoutManager).call(this, `fin.Platform.Layout.destroy()`), layoutIdentity);
|
12137
12161
|
};
|
12138
12162
|
}
|
12139
12163
|
/**
|
@@ -12232,10 +12256,10 @@ class LayoutModule extends base_1$5.Base {
|
|
12232
12256
|
}
|
12233
12257
|
Factory$2.LayoutModule = LayoutModule;
|
12234
12258
|
_LayoutModule_layoutInitializationAttempted = new WeakMap(), _LayoutModule_layoutManager = new WeakMap(), _LayoutModule_getLayoutManagerSpy = new WeakMap(), _LayoutModule_instances = new WeakSet(), _LayoutModule_getSafeLayoutManager = function _LayoutModule_getSafeLayoutManager(method) {
|
12235
|
-
if (!__classPrivateFieldGet$
|
12259
|
+
if (!__classPrivateFieldGet$3(this, _LayoutModule_layoutManager, "f")) {
|
12236
12260
|
throw new Error(`You must call init before using the API ${method}`);
|
12237
12261
|
}
|
12238
|
-
return __classPrivateFieldGet$
|
12262
|
+
return __classPrivateFieldGet$3(this, _LayoutModule_layoutManager, "f");
|
12239
12263
|
};
|
12240
12264
|
|
12241
12265
|
(function (exports) {
|
@@ -12272,13 +12296,13 @@ _LayoutModule_layoutInitializationAttempted = new WeakMap(), _LayoutModule_layou
|
|
12272
12296
|
|
12273
12297
|
Object.defineProperty(Factory$3, "__esModule", { value: true });
|
12274
12298
|
Factory$3.PlatformModule = void 0;
|
12275
|
-
const base_1$
|
12299
|
+
const base_1$3 = base;
|
12276
12300
|
const Instance_1$1 = Instance$2;
|
12277
12301
|
const index_1$1 = layout;
|
12278
12302
|
/**
|
12279
12303
|
* Static namespace for OpenFin API methods that interact with the {@link Platform} class, available under `fin.Platform`.
|
12280
12304
|
*/
|
12281
|
-
class PlatformModule extends base_1$
|
12305
|
+
class PlatformModule extends base_1$3.Base {
|
12282
12306
|
/**
|
12283
12307
|
* @internal
|
12284
12308
|
*/
|
@@ -12849,7 +12873,7 @@ function requireSessionContextGroupBroker () {
|
|
12849
12873
|
return SessionContextGroupBroker;
|
12850
12874
|
}
|
12851
12875
|
|
12852
|
-
var utils$
|
12876
|
+
var utils$3 = {};
|
12853
12877
|
|
12854
12878
|
(function (exports) {
|
12855
12879
|
Object.defineProperty(exports, "__esModule", { value: true });
|
@@ -12912,7 +12936,7 @@ var utils$1 = {};
|
|
12912
12936
|
};
|
12913
12937
|
};
|
12914
12938
|
exports.wrapIntentHandler = wrapIntentHandler;
|
12915
|
-
} (utils$
|
12939
|
+
} (utils$3));
|
12916
12940
|
|
12917
12941
|
var PrivateChannelProvider = {};
|
12918
12942
|
|
@@ -13215,14 +13239,15 @@ function requireInteropBroker () {
|
|
13215
13239
|
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");
|
13216
13240
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
13217
13241
|
};
|
13218
|
-
var _InteropBroker_fdc3Info, _InteropBroker_contextGroups;
|
13242
|
+
var _InteropBroker_fdc3Info, _InteropBroker_contextGroups, _InteropBroker_providerPromise;
|
13219
13243
|
Object.defineProperty(InteropBroker, "__esModule", { value: true });
|
13220
13244
|
InteropBroker.InteropBroker = void 0;
|
13221
13245
|
const base_1 = base;
|
13222
13246
|
const SessionContextGroupBroker_1 = requireSessionContextGroupBroker();
|
13223
|
-
const utils_1 = utils$
|
13247
|
+
const utils_1 = utils$3;
|
13224
13248
|
const lodash_1 = require$$3;
|
13225
13249
|
const PrivateChannelProvider_1 = requirePrivateChannelProvider();
|
13250
|
+
const lazy_1 = lazy;
|
13226
13251
|
const defaultContextGroups = [
|
13227
13252
|
{
|
13228
13253
|
id: 'green',
|
@@ -13390,12 +13415,15 @@ function requireInteropBroker () {
|
|
13390
13415
|
/**
|
13391
13416
|
* @internal
|
13392
13417
|
*/
|
13393
|
-
constructor(wire,
|
13418
|
+
constructor(wire, createProvider, options) {
|
13394
13419
|
// Tip from Pierre and Michael from the overrideCheck work: Don't use bound methods for overrideable InteropBroker functions.
|
13395
13420
|
super(wire);
|
13396
|
-
this.getProvider = getProvider;
|
13397
13421
|
_InteropBroker_fdc3Info.set(this, void 0);
|
13398
13422
|
_InteropBroker_contextGroups.set(this, void 0);
|
13423
|
+
_InteropBroker_providerPromise.set(this, void 0);
|
13424
|
+
this.getProvider = () => {
|
13425
|
+
return __classPrivateFieldGet(this, _InteropBroker_providerPromise, "f").getValue();
|
13426
|
+
};
|
13399
13427
|
this.interopClients = new Map();
|
13400
13428
|
this.contextGroupsById = new Map();
|
13401
13429
|
__classPrivateFieldSet(this, _InteropBroker_contextGroups, options.contextGroups ?? [...defaultContextGroups], "f");
|
@@ -13406,6 +13434,7 @@ function requireInteropBroker () {
|
|
13406
13434
|
this.intentClientMap = new Map();
|
13407
13435
|
this.lastContextMap = new Map();
|
13408
13436
|
this.sessionContextGroupMap = new Map();
|
13437
|
+
__classPrivateFieldSet(this, _InteropBroker_providerPromise, new lazy_1.Lazy(createProvider), "f");
|
13409
13438
|
this.setContextGroupMap();
|
13410
13439
|
this.setupChannelProvider();
|
13411
13440
|
}
|
@@ -14489,35 +14518,35 @@ function requireInteropBroker () {
|
|
14489
14518
|
}
|
14490
14519
|
};
|
14491
14520
|
InteropBroker.InteropBroker = InteropBroker$1;
|
14492
|
-
_InteropBroker_fdc3Info = new WeakMap(), _InteropBroker_contextGroups = new WeakMap();
|
14521
|
+
_InteropBroker_fdc3Info = new WeakMap(), _InteropBroker_contextGroups = new WeakMap(), _InteropBroker_providerPromise = new WeakMap();
|
14493
14522
|
return InteropBroker;
|
14494
14523
|
}
|
14495
14524
|
|
14496
|
-
var InteropClient
|
14525
|
+
var InteropClient = {};
|
14497
14526
|
|
14498
14527
|
var SessionContextGroupClient$1 = {};
|
14499
14528
|
|
14500
|
-
var __classPrivateFieldSet$
|
14529
|
+
var __classPrivateFieldSet$2 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
14501
14530
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
14502
14531
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
14503
14532
|
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");
|
14504
14533
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
14505
14534
|
};
|
14506
|
-
var __classPrivateFieldGet$
|
14535
|
+
var __classPrivateFieldGet$2 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
14507
14536
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
14508
14537
|
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");
|
14509
14538
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
14510
14539
|
};
|
14511
14540
|
var _SessionContextGroupClient_clientPromise;
|
14512
14541
|
Object.defineProperty(SessionContextGroupClient$1, "__esModule", { value: true });
|
14513
|
-
const base_1$
|
14514
|
-
const utils_1$
|
14515
|
-
class SessionContextGroupClient extends base_1$
|
14542
|
+
const base_1$2 = base;
|
14543
|
+
const utils_1$2 = utils$3;
|
14544
|
+
class SessionContextGroupClient extends base_1$2.Base {
|
14516
14545
|
constructor(wire, client, id) {
|
14517
14546
|
super(wire);
|
14518
14547
|
_SessionContextGroupClient_clientPromise.set(this, void 0);
|
14519
14548
|
this.id = id;
|
14520
|
-
__classPrivateFieldSet$
|
14549
|
+
__classPrivateFieldSet$2(this, _SessionContextGroupClient_clientPromise, client, "f");
|
14521
14550
|
}
|
14522
14551
|
/**
|
14523
14552
|
* Sets a context for the session context group.
|
@@ -14529,7 +14558,7 @@ class SessionContextGroupClient extends base_1$3.Base {
|
|
14529
14558
|
this.wire.sendAction('interop-session-context-group-set-context').catch((e) => {
|
14530
14559
|
// don't expose, analytics-only call
|
14531
14560
|
});
|
14532
|
-
const client = await __classPrivateFieldGet$
|
14561
|
+
const client = await __classPrivateFieldGet$2(this, _SessionContextGroupClient_clientPromise, "f");
|
14533
14562
|
return client.dispatch(`sessionContextGroup:setContext-${this.id}`, {
|
14534
14563
|
sessionContextGroupId: this.id,
|
14535
14564
|
context
|
@@ -14539,7 +14568,7 @@ class SessionContextGroupClient extends base_1$3.Base {
|
|
14539
14568
|
this.wire.sendAction('interop-session-context-group-get-context').catch((e) => {
|
14540
14569
|
// don't expose, analytics-only call
|
14541
14570
|
});
|
14542
|
-
const client = await __classPrivateFieldGet$
|
14571
|
+
const client = await __classPrivateFieldGet$2(this, _SessionContextGroupClient_clientPromise, "f");
|
14543
14572
|
return client.dispatch(`sessionContextGroup:getContext-${this.id}`, {
|
14544
14573
|
sessionContextGroupId: this.id,
|
14545
14574
|
type
|
@@ -14552,20 +14581,20 @@ class SessionContextGroupClient extends base_1$3.Base {
|
|
14552
14581
|
if (typeof contextHandler !== 'function') {
|
14553
14582
|
throw new Error("Non-function argument passed to the first parameter 'handler'. Be aware that the argument order does not match the FDC3 standard.");
|
14554
14583
|
}
|
14555
|
-
const client = await __classPrivateFieldGet$
|
14584
|
+
const client = await __classPrivateFieldGet$2(this, _SessionContextGroupClient_clientPromise, "f");
|
14556
14585
|
let handlerId;
|
14557
14586
|
if (contextType) {
|
14558
|
-
handlerId = `sessionContextHandler:invoke-${this.id}-${contextType}-${(0, utils_1$
|
14587
|
+
handlerId = `sessionContextHandler:invoke-${this.id}-${contextType}-${(0, utils_1$2.generateId)()}`;
|
14559
14588
|
}
|
14560
14589
|
else {
|
14561
14590
|
handlerId = `sessionContextHandler:invoke-${this.id}`;
|
14562
14591
|
}
|
14563
|
-
client.register(handlerId, (0, utils_1$
|
14592
|
+
client.register(handlerId, (0, utils_1$2.wrapContextHandler)(contextHandler, handlerId));
|
14564
14593
|
await client.dispatch(`sessionContextGroup:handlerAdded-${this.id}`, { handlerId, contextType });
|
14565
14594
|
return { unsubscribe: await this.createUnsubscribeCb(handlerId) };
|
14566
14595
|
}
|
14567
14596
|
async createUnsubscribeCb(handlerId) {
|
14568
|
-
const client = await __classPrivateFieldGet$
|
14597
|
+
const client = await __classPrivateFieldGet$2(this, _SessionContextGroupClient_clientPromise, "f");
|
14569
14598
|
return async () => {
|
14570
14599
|
client.remove(handlerId);
|
14571
14600
|
await client.dispatch(`sessionContextGroup:handlerRemoved-${this.id}`, { handlerId });
|
@@ -14574,654 +14603,1810 @@ class SessionContextGroupClient extends base_1$3.Base {
|
|
14574
14603
|
getUserInstance() {
|
14575
14604
|
return {
|
14576
14605
|
id: this.id,
|
14577
|
-
setContext: (0, utils_1$
|
14578
|
-
getCurrentContext: (0, utils_1$
|
14579
|
-
addContextHandler: (0, utils_1$
|
14606
|
+
setContext: (0, utils_1$2.wrapInTryCatch)(this.setContext.bind(this), 'Failed to set context: '),
|
14607
|
+
getCurrentContext: (0, utils_1$2.wrapInTryCatch)(this.getCurrentContext.bind(this), 'Failed to get context: '),
|
14608
|
+
addContextHandler: (0, utils_1$2.wrapInTryCatch)(this.addContextHandler.bind(this), 'Failed to add context handler: ')
|
14580
14609
|
};
|
14581
14610
|
}
|
14582
14611
|
}
|
14583
14612
|
SessionContextGroupClient$1.default = SessionContextGroupClient;
|
14584
14613
|
_SessionContextGroupClient_clientPromise = new WeakMap();
|
14585
14614
|
|
14586
|
-
var
|
14587
|
-
|
14588
|
-
|
14589
|
-
|
14590
|
-
|
14591
|
-
|
14592
|
-
var
|
14593
|
-
|
14594
|
-
|
14595
|
-
|
14596
|
-
|
14597
|
-
|
14598
|
-
|
14599
|
-
|
14600
|
-
|
14601
|
-
|
14602
|
-
const utils_1$2 = utils$1;
|
14603
|
-
/**
|
14604
|
-
* The Interop Client API is broken up into two groups:
|
14605
|
-
*
|
14606
|
-
* **Content Facing APIs** - For Application Developers putting Views into a Platform Window, who care about Context. These are APIs that send out and receive the Context data that flows between applications. Think of this as the Water in the Interop Pipes.
|
14607
|
-
*
|
14608
|
-
* **Context Grouping APIs** - For Platform Developers, to add and remove Views to and from Context Groups. These APIs are utilized under-the-hood in Platforms, so they don't need to be used to participate in Interop. These are the APIs that decide which entities the context data flows between. Think of these as the valves or pipes that control the flow of Context Data for Interop.
|
14609
|
-
*
|
14610
|
-
* ---
|
14611
|
-
*
|
14612
|
-
* All APIs are available at the `fin.me.interop` namespace.
|
14613
|
-
*
|
14614
|
-
* ---
|
14615
|
-
*
|
14616
|
-
* **You only need 2 things to participate in Interop Context Grouping:**
|
14617
|
-
* * A Context Handler for incoming context: {@link InteropClient#addContextHandler addContextHandler(handler, contextType?)}
|
14618
|
-
* * Call setContext on your context group when you want to share context with other group members: {@link InteropClient#setContext setContext(context)}
|
14619
|
-
*
|
14620
|
-
* ---
|
14621
|
-
*
|
14622
|
-
* ##### Constructor
|
14623
|
-
* Returned by {@link Interop.connectSync Interop.connectSync}.
|
14624
|
-
*
|
14625
|
-
* ---
|
14626
|
-
*
|
14627
|
-
* ##### Interop methods intended for Views
|
14628
|
-
*
|
14629
|
-
*
|
14630
|
-
* **Context Groups API**
|
14631
|
-
* * {@link InteropClient#addContextHandler addContextHandler(handler, contextType?)}
|
14632
|
-
* * {@link InteropClient#setContext setContext(context)}
|
14633
|
-
* * {@link InteropClient#getCurrentContext getCurrentContext(contextType?)}
|
14634
|
-
* * {@link InteropClient#joinSessionContextGroup joinSessionContextGroup(sessionContextGroupId)}
|
14635
|
-
*
|
14636
|
-
*
|
14637
|
-
* **Intents API**
|
14638
|
-
* * {@link InteropClient#fireIntent fireIntent(intent)}
|
14639
|
-
* * {@link InteropClient#registerIntentHandler registerIntentHandler(intentHandler, intentName)}
|
14640
|
-
* * {@link InteropClient#getInfoForIntent getInfoForIntent(infoForIntentOptions)}
|
14641
|
-
* * {@link InteropClient#getInfoForIntentsByContext getInfoForIntentsByContext(context)}
|
14642
|
-
* * {@link InteropClient#fireIntentForContext fireIntentForContext(contextForIntent)}
|
14643
|
-
*
|
14644
|
-
* ##### Interop methods intended for Windows
|
14645
|
-
* * {@link InteropClient#getContextGroups getContextGroups()}
|
14646
|
-
* * {@link InteropClient#joinContextGroup joinContextGroup(contextGroupId, target?)}
|
14647
|
-
* * {@link InteropClient#removeFromContextGroup removeFromContextGroup(target?)}
|
14648
|
-
* * {@link InteropClient#getInfoForContextGroup getInfoForContextGroup(contextGroupId)}
|
14649
|
-
* * {@link InteropClient#getAllClientsInContextGroup getAllClientsInContextGroup(contextGroupId)}
|
14650
|
-
*
|
14651
|
-
*/
|
14652
|
-
class InteropClient extends base_1$2.Base {
|
14653
|
-
/**
|
14654
|
-
* @internal
|
14655
|
-
*/
|
14656
|
-
constructor(wire, name, interopConfig = {}) {
|
14657
|
-
super(wire);
|
14658
|
-
_InteropClient_clientPromise.set(this, void 0);
|
14659
|
-
_InteropClient_sessionContextGroups.set(this, void 0);
|
14660
|
-
__classPrivateFieldSet$2(this, _InteropClient_sessionContextGroups, new Map(), "f");
|
14661
|
-
__classPrivateFieldSet$2(this, _InteropClient_clientPromise, this.wire.environment.whenReady().then(() => {
|
14662
|
-
return this.fin.InterApplicationBus.Channel.connect(`interop-broker-${name}`, {
|
14663
|
-
payload: interopConfig
|
14664
|
-
});
|
14665
|
-
}), "f");
|
14615
|
+
var fdc31_2 = {};
|
14616
|
+
|
14617
|
+
var fdc3Common = {};
|
14618
|
+
|
14619
|
+
var utils$2 = {};
|
14620
|
+
|
14621
|
+
var PrivateChannelClient$1 = {};
|
14622
|
+
|
14623
|
+
Object.defineProperty(PrivateChannelClient$1, "__esModule", { value: true });
|
14624
|
+
PrivateChannelClient$1.PrivateChannelClient = void 0;
|
14625
|
+
const utils$1 = utils$3;
|
14626
|
+
class PrivateChannelClient {
|
14627
|
+
constructor(client, id) {
|
14628
|
+
this.id = id;
|
14629
|
+
this.client = client;
|
14630
|
+
this.listeners = new Map();
|
14666
14631
|
}
|
14667
|
-
|
14668
|
-
|
14669
|
-
*/
|
14670
|
-
/**
|
14671
|
-
* Sets a context for the context group of the current entity.
|
14672
|
-
*
|
14673
|
-
* @remarks The entity must be part of a context group in order set a context.
|
14674
|
-
*
|
14675
|
-
* @param context - New context to set.
|
14676
|
-
*
|
14677
|
-
* @example
|
14678
|
-
* ```js
|
14679
|
-
* setInstrumentContext = async (ticker) => {
|
14680
|
-
* fin.me.interop.setContext({type: 'instrument', id: {ticker}})
|
14681
|
-
* }
|
14682
|
-
*
|
14683
|
-
* // The user clicks an instrument of interest. We want to set that Instrument context so that the rest of our workflow updates with information for that instrument
|
14684
|
-
* instrumentElement.on('click', (evt) => {
|
14685
|
-
* setInstrumentContext(evt.ticker)
|
14686
|
-
* })
|
14687
|
-
* ```
|
14688
|
-
*/
|
14689
|
-
async setContext(context) {
|
14690
|
-
this.wire.sendAction('interop-client-set-context').catch((e) => {
|
14691
|
-
// don't expose, analytics-only call
|
14692
|
-
});
|
14693
|
-
const client = await __classPrivateFieldGet$2(this, _InteropClient_clientPromise, "f");
|
14694
|
-
return client.dispatch('setContext', { context });
|
14632
|
+
async broadcast(context) {
|
14633
|
+
return this.client.dispatch('broadcast', { context });
|
14695
14634
|
}
|
14696
|
-
|
14697
|
-
|
14698
|
-
|
14699
|
-
|
14700
|
-
* @param handler - Handler for incoming context.
|
14701
|
-
* @param contextType - The type of context you wish to handle.
|
14702
|
-
*
|
14703
|
-
* @example
|
14704
|
-
* ```js
|
14705
|
-
* function handleIncomingContext(contextInfo) {
|
14706
|
-
* const { type, id } = contextInfo;
|
14707
|
-
* switch (type) {
|
14708
|
-
* case 'instrument':
|
14709
|
-
* handleInstrumentContext(contextInfo);
|
14710
|
-
* break;
|
14711
|
-
* case 'country':
|
14712
|
-
* handleCountryContext(contextInfo);
|
14713
|
-
* break;
|
14714
|
-
*
|
14715
|
-
* default:
|
14716
|
-
* break;
|
14717
|
-
* }
|
14718
|
-
* }
|
14719
|
-
*
|
14720
|
-
*
|
14721
|
-
* function handleInstrumentContext(contextInfo) {
|
14722
|
-
* const { type, id } = contextInfo;
|
14723
|
-
* console.log('contextInfo for instrument', contextInfo)
|
14724
|
-
* }
|
14725
|
-
*
|
14726
|
-
* function handleCountryContext(contextInfo) {
|
14727
|
-
* const { type, id } = contextInfo;
|
14728
|
-
* console.log('contextInfo for country', contextInfo)
|
14729
|
-
* }
|
14730
|
-
*
|
14731
|
-
* fin.me.interop.addContextHandler(handleIncomingContext);
|
14732
|
-
* ```
|
14733
|
-
*
|
14734
|
-
*
|
14735
|
-
* We are also testing the ability to add a context handler for specific contexts. If you would like to use
|
14736
|
-
* this, please make sure you add your context handlers at the top level of your application, on a page that
|
14737
|
-
* does not navigate/reload/re-render, to avoid memory leaks. This feature is experimental:
|
14738
|
-
*
|
14739
|
-
* ```js
|
14740
|
-
* function handleInstrumentContext(contextInfo) {
|
14741
|
-
* const { type, id } = contextInfo;
|
14742
|
-
* console.log('contextInfo for instrument', contextInfo)
|
14743
|
-
* }
|
14744
|
-
*
|
14745
|
-
* function handleCountryContext(contextInfo) {
|
14746
|
-
* const { type, id } = contextInfo;
|
14747
|
-
* console.log('contextInfo for country', contextInfo)
|
14748
|
-
* }
|
14749
|
-
*
|
14750
|
-
*
|
14751
|
-
* fin.me.interop.addContextHandler(handleInstrumentContext, 'instrument')
|
14752
|
-
* fin.me.interop.addContextHandler(handleCountryContext, 'country')
|
14753
|
-
* ```
|
14754
|
-
*/
|
14755
|
-
async addContextHandler(handler, contextType) {
|
14756
|
-
this.wire.sendAction('interop-client-add-context-handler').catch((e) => {
|
14757
|
-
// don't expose, analytics-only call
|
14758
|
-
});
|
14635
|
+
async getCurrentContext(contextType) {
|
14636
|
+
return this.client.dispatch('getCurrentContext', { contextType });
|
14637
|
+
}
|
14638
|
+
async addContextListener(contextType, handler) {
|
14759
14639
|
if (typeof handler !== 'function') {
|
14760
|
-
throw new Error("Non-function argument passed to the
|
14640
|
+
throw new Error("Non-function argument passed to the second parameter 'handler'. Be aware that the argument order does not match the FDC3 standard.");
|
14761
14641
|
}
|
14762
|
-
const client = await __classPrivateFieldGet$2(this, _InteropClient_clientPromise, "f");
|
14763
14642
|
let handlerId;
|
14764
14643
|
if (contextType) {
|
14765
|
-
handlerId = `
|
14766
|
-
console.warn(`Warning: By providing a contextType (${contextType}), you are using the experimental addContextHandler. To avoid issues, make sure you are adding your context handlers at the top level in your application.`);
|
14644
|
+
handlerId = `contextHandler:invoke-${this.id}-${contextType}-${utils$1.generateId()}`;
|
14767
14645
|
}
|
14768
14646
|
else {
|
14769
|
-
handlerId =
|
14647
|
+
handlerId = `contextHandler:invoke-${this.id}-${utils$1.generateId()}`;
|
14770
14648
|
}
|
14771
|
-
|
14772
|
-
|
14773
|
-
|
14774
|
-
|
14775
|
-
|
14776
|
-
|
14777
|
-
|
14778
|
-
|
14649
|
+
this.client.register(handlerId, utils$1.wrapContextHandler(handler, handlerId));
|
14650
|
+
const listener = { unsubscribe: await this.createContextUnsubscribeCb(handlerId) };
|
14651
|
+
this.listeners.set(handlerId, listener);
|
14652
|
+
await this.client.dispatch(`contextHandlerAdded`, { handlerId, contextType });
|
14653
|
+
return listener;
|
14654
|
+
}
|
14655
|
+
createNonStandardUnsubscribeCb(handlerId) {
|
14656
|
+
return async () => {
|
14657
|
+
this.client.remove(handlerId);
|
14658
|
+
this.listeners.delete(handlerId);
|
14659
|
+
await this.client.dispatch('nonStandardHandlerRemoved', { handlerId });
|
14779
14660
|
};
|
14780
14661
|
}
|
14781
|
-
|
14782
|
-
|
14783
|
-
|
14784
|
-
|
14785
|
-
|
14786
|
-
|
14787
|
-
*
|
14788
|
-
* @example
|
14789
|
-
* ```js
|
14790
|
-
* fin.me.interop.getContextGroups()
|
14791
|
-
* .then(contextGroups => {
|
14792
|
-
* contextGroups.forEach(contextGroup => {
|
14793
|
-
* console.log(contextGroup.displayMetadata.name)
|
14794
|
-
* console.log(contextGroup.displayMetadata.color)
|
14795
|
-
* })
|
14796
|
-
* })
|
14797
|
-
* ```
|
14798
|
-
*/
|
14799
|
-
async getContextGroups() {
|
14800
|
-
this.wire.sendAction('interop-client-get-context-groups').catch((e) => {
|
14801
|
-
// don't expose, analytics-only call
|
14802
|
-
});
|
14803
|
-
const client = await __classPrivateFieldGet$2(this, _InteropClient_clientPromise, "f");
|
14804
|
-
return client.dispatch('getContextGroups');
|
14662
|
+
createContextUnsubscribeCb(handlerId) {
|
14663
|
+
return async () => {
|
14664
|
+
this.client.remove(handlerId);
|
14665
|
+
this.listeners.delete(handlerId);
|
14666
|
+
await this.client.dispatch('contextHandlerRemoved', { handlerId });
|
14667
|
+
};
|
14805
14668
|
}
|
14806
|
-
|
14807
|
-
|
14808
|
-
|
14809
|
-
|
14810
|
-
|
14811
|
-
|
14812
|
-
|
14813
|
-
|
14814
|
-
|
14815
|
-
|
14816
|
-
|
14817
|
-
|
14818
|
-
|
14819
|
-
|
14820
|
-
|
14821
|
-
|
14822
|
-
|
14823
|
-
|
14824
|
-
|
14825
|
-
|
14826
|
-
|
14827
|
-
|
14828
|
-
|
14829
|
-
|
14830
|
-
async
|
14831
|
-
this.
|
14832
|
-
|
14669
|
+
onAddContextListener(handler) {
|
14670
|
+
const handlerId = `onContextHandlerAdded:invoke-${this.id}-${utils$1.generateId()}`;
|
14671
|
+
this.client.register(handlerId, handler);
|
14672
|
+
const listener = { unsubscribe: this.createNonStandardUnsubscribeCb(handlerId) };
|
14673
|
+
this.listeners.set(handlerId, listener);
|
14674
|
+
this.client.dispatch(`onAddContextHandlerAdded`, { handlerId });
|
14675
|
+
return listener;
|
14676
|
+
}
|
14677
|
+
onDisconnect(handler) {
|
14678
|
+
const handlerId = `onDisconnect:invoke-${this.id}-${utils$1.generateId()}`;
|
14679
|
+
this.client.register(handlerId, handler);
|
14680
|
+
const listener = { unsubscribe: this.createNonStandardUnsubscribeCb(handlerId) };
|
14681
|
+
this.listeners.set(handlerId, listener);
|
14682
|
+
this.client.dispatch(`onDisconnectHandlerAdded`, { handlerId });
|
14683
|
+
return listener;
|
14684
|
+
}
|
14685
|
+
onUnsubscribe(handler) {
|
14686
|
+
const handlerId = `onUnsubscribe:invoke-${this.id}-${utils$1.generateId()}`;
|
14687
|
+
this.client.register(handlerId, handler);
|
14688
|
+
const listener = { unsubscribe: this.createNonStandardUnsubscribeCb(handlerId) };
|
14689
|
+
this.listeners.set(handlerId, listener);
|
14690
|
+
this.client.dispatch(`onUnsubscribeHandlerAdded`, { handlerId });
|
14691
|
+
return listener;
|
14692
|
+
}
|
14693
|
+
async cleanUpAllSubs() {
|
14694
|
+
const listenerUnsubscribers = Array.from(this.listeners.keys());
|
14695
|
+
listenerUnsubscribers.forEach((handlerId) => {
|
14696
|
+
this.client.remove(handlerId);
|
14697
|
+
this.listeners.delete(handlerId);
|
14833
14698
|
});
|
14834
|
-
|
14835
|
-
|
14836
|
-
|
14699
|
+
}
|
14700
|
+
async disconnect() {
|
14701
|
+
try {
|
14702
|
+
await this.client.dispatch('clientDisconnecting');
|
14703
|
+
await this.cleanUpAllSubs();
|
14704
|
+
await this.client.disconnect();
|
14705
|
+
}
|
14706
|
+
catch (error) {
|
14707
|
+
throw new Error(error.message);
|
14837
14708
|
}
|
14838
|
-
return client.dispatch('joinContextGroup', { contextGroupId, target });
|
14839
|
-
}
|
14840
|
-
/**
|
14841
|
-
* Removes the specified target from a context group.
|
14842
|
-
* If no target is specified, it removes the sender from their context group.
|
14843
|
-
* Used by Platform Windows.
|
14844
|
-
*
|
14845
|
-
* @param target - Identity of the entity you wish to join to a context group.
|
14846
|
-
*
|
14847
|
-
* @example
|
14848
|
-
* ```js
|
14849
|
-
* removeViewFromContextGroup = async (view) => {
|
14850
|
-
* await fin.me.interop.removeFromContextGroup(view);
|
14851
|
-
* }
|
14852
|
-
*
|
14853
|
-
* getLastFocusedView()
|
14854
|
-
* .then(lastFocusedViewIdentity => {
|
14855
|
-
* removeViewFromContextGroup(lastFocusedViewIdentity)
|
14856
|
-
* })
|
14857
|
-
* ```
|
14858
|
-
*/
|
14859
|
-
async removeFromContextGroup(target) {
|
14860
|
-
this.wire.sendAction('interop-client-remove-from-context-group').catch((e) => {
|
14861
|
-
// don't expose, analytics-only call
|
14862
|
-
});
|
14863
|
-
const client = await __classPrivateFieldGet$2(this, _InteropClient_clientPromise, "f");
|
14864
|
-
return client.dispatch('removeFromContextGroup', { target });
|
14865
|
-
}
|
14866
|
-
/**
|
14867
|
-
* Gets all clients for a context group.
|
14868
|
-
*
|
14869
|
-
* @remarks **This is primarily used for platform windows. Views within a platform should not have to use this API.**
|
14870
|
-
*
|
14871
|
-
* Returns the Interop-Broker-defined context groups available for an entity to join.
|
14872
|
-
* @param contextGroupId - The id of context group you wish to get clients for.
|
14873
|
-
*
|
14874
|
-
* @example
|
14875
|
-
* ```js
|
14876
|
-
* fin.me.interop.getAllClientsInContextGroup('red')
|
14877
|
-
* .then(clientsInContextGroup => {
|
14878
|
-
* console.log(clientsInContextGroup)
|
14879
|
-
* })
|
14880
|
-
* ```
|
14881
|
-
*/
|
14882
|
-
async getAllClientsInContextGroup(contextGroupId) {
|
14883
|
-
this.wire.sendAction('interop-client-get-all-clients-in-context-group').catch((e) => {
|
14884
|
-
// don't expose, analytics-only call
|
14885
|
-
});
|
14886
|
-
const client = await __classPrivateFieldGet$2(this, _InteropClient_clientPromise, "f");
|
14887
|
-
if (!contextGroupId) {
|
14888
|
-
throw new Error('No contextGroupId specified for getAllClientsInContextGroup.');
|
14889
|
-
}
|
14890
|
-
return client.dispatch('getAllClientsInContextGroup', { contextGroupId });
|
14891
|
-
}
|
14892
|
-
/**
|
14893
|
-
* Gets display info for a context group
|
14894
|
-
*
|
14895
|
-
* @remarks Used by Platform Windows.
|
14896
|
-
* @param contextGroupId - The id of context group you wish to get display info for.
|
14897
|
-
*
|
14898
|
-
* @example
|
14899
|
-
* ```js
|
14900
|
-
* fin.me.interop.getInfoForContextGroup('red')
|
14901
|
-
* .then(contextGroupInfo => {
|
14902
|
-
* console.log(contextGroupInfo.displayMetadata.name)
|
14903
|
-
* console.log(contextGroupInfo.displayMetadata.color)
|
14904
|
-
* })
|
14905
|
-
* ```
|
14906
|
-
*/
|
14907
|
-
async getInfoForContextGroup(contextGroupId) {
|
14908
|
-
this.wire.sendAction('interop-client-get-info-for-context-group').catch((e) => {
|
14909
|
-
// don't expose, analytics-only call
|
14910
|
-
});
|
14911
|
-
const client = await __classPrivateFieldGet$2(this, _InteropClient_clientPromise, "f");
|
14912
|
-
if (!contextGroupId) {
|
14913
|
-
throw new Error('No contextGroupId specified for getInfoForContextGroup.');
|
14914
|
-
}
|
14915
|
-
return client.dispatch('getInfoForContextGroup', { contextGroupId });
|
14916
|
-
}
|
14917
|
-
/**
|
14918
|
-
* Sends an intent to the Interop Broker to resolve.
|
14919
|
-
* @param intent - The combination of an action and a context that is passed to an application for resolution.
|
14920
|
-
*
|
14921
|
-
* @example
|
14922
|
-
* ```js
|
14923
|
-
* // View wants to fire an Intent after a user clicks on a ticker
|
14924
|
-
* tickerElement.on('click', (element) => {
|
14925
|
-
* const ticker = element.innerText;
|
14926
|
-
* const intent = {
|
14927
|
-
* name: 'ViewChart',
|
14928
|
-
* context: {type: 'fdc3.instrument', id: { ticker }}
|
14929
|
-
* }
|
14930
|
-
*
|
14931
|
-
* fin.me.interop.fireIntent(intent);
|
14932
|
-
* })
|
14933
|
-
* ```
|
14934
|
-
*/
|
14935
|
-
async fireIntent(intent) {
|
14936
|
-
this.wire.sendAction('interop-client-fire-intent').catch((e) => {
|
14937
|
-
// don't expose, this is only for api analytics purposes
|
14938
|
-
});
|
14939
|
-
const client = await __classPrivateFieldGet$2(this, _InteropClient_clientPromise, "f");
|
14940
|
-
return client.dispatch('fireIntent', intent);
|
14941
|
-
}
|
14942
|
-
/**
|
14943
|
-
* Adds an intent handler for incoming intents. The last intent sent of the name subscribed to will be received.
|
14944
|
-
* @param handler - Registered function meant to handle a specific intent type.
|
14945
|
-
* @param intentName - The name of an intent.
|
14946
|
-
*
|
14947
|
-
* @example
|
14948
|
-
* ```js
|
14949
|
-
* const intentHandler = (intent) => {
|
14950
|
-
* const { context } = intent;
|
14951
|
-
* myViewChartHandler(context);
|
14952
|
-
* };
|
14953
|
-
*
|
14954
|
-
* const subscription = await fin.me.interop.registerIntentHandler(intentHandler, 'ViewChart');
|
14955
|
-
*
|
14956
|
-
* function myAppCloseSequence() {
|
14957
|
-
* // to unsubscribe the handler, simply call:
|
14958
|
-
* subscription.unsubscribe();
|
14959
|
-
* }
|
14960
|
-
* ```
|
14961
|
-
*/
|
14962
|
-
async registerIntentHandler(handler, intentName, options) {
|
14963
|
-
this.wire.sendAction('interop-client-register-intent-handler').catch((e) => {
|
14964
|
-
// don't expose, this is only for api analytics purposes
|
14965
|
-
});
|
14966
|
-
const client = await __classPrivateFieldGet$2(this, _InteropClient_clientPromise, "f");
|
14967
|
-
const handlerId = `intent-handler-${intentName}`;
|
14968
|
-
const wrappedHandler = (0, utils_1$2.wrapIntentHandler)(handler, handlerId);
|
14969
|
-
try {
|
14970
|
-
await client.register(handlerId, wrappedHandler);
|
14971
|
-
await client.dispatch('intentHandlerRegistered', { handlerId, ...options });
|
14972
|
-
}
|
14973
|
-
catch (error) {
|
14974
|
-
throw new Error('Unable to register intent handler');
|
14975
|
-
}
|
14976
|
-
return {
|
14977
|
-
unsubscribe: async () => {
|
14978
|
-
client.remove(handlerId);
|
14979
|
-
}
|
14980
|
-
};
|
14981
|
-
}
|
14982
|
-
/**
|
14983
|
-
* Gets the last context of the Context Group currently subscribed to. It takes an optional Context Type and returns the
|
14984
|
-
* last context of that type.
|
14985
|
-
* @param contextType
|
14986
|
-
*
|
14987
|
-
* @example
|
14988
|
-
* ```js
|
14989
|
-
* await fin.me.interop.joinContextGroup('yellow');
|
14990
|
-
* await fin.me.interop.setContext({ type: 'instrument', id: { ticker: 'FOO' }});
|
14991
|
-
* const currentContext = await fin.me.interop.getCurrentContext();
|
14992
|
-
*
|
14993
|
-
* // with a specific context
|
14994
|
-
* await fin.me.interop.joinContextGroup('yellow');
|
14995
|
-
* await fin.me.interop.setContext({ type: 'country', id: { ISOALPHA3: 'US' }});
|
14996
|
-
* await fin.me.interop.setContext({ type: 'instrument', id: { ticker: 'FOO' }});
|
14997
|
-
* const currentContext = await fin.me.interop.getCurrentContext('country');
|
14998
|
-
* ```
|
14999
|
-
*/
|
15000
|
-
async getCurrentContext(contextType) {
|
15001
|
-
this.wire.sendAction('interop-client-get-current-context').catch((e) => {
|
15002
|
-
// don't expose, analytics-only call
|
15003
|
-
});
|
15004
|
-
const client = await __classPrivateFieldGet$2(this, _InteropClient_clientPromise, "f");
|
15005
|
-
return client.dispatch('getCurrentContext', { contextType });
|
15006
|
-
}
|
15007
|
-
/**
|
15008
|
-
* Get information for a particular Intent from the Interop Broker.
|
15009
|
-
*
|
15010
|
-
* @remarks To resolve this info, the function handleInfoForIntent is meant to be overridden in the Interop Broker.
|
15011
|
-
* The format for the response will be determined by the App Provider overriding the function.
|
15012
|
-
*
|
15013
|
-
* @param options
|
15014
|
-
*
|
15015
|
-
* @example
|
15016
|
-
* ```js
|
15017
|
-
* const intentInfo = await fin.me.interop.getInfoForIntent('ViewChart');
|
15018
|
-
* ```
|
15019
|
-
*/
|
15020
|
-
async getInfoForIntent(options) {
|
15021
|
-
this.wire.sendAction('interop-client-get-info-for-intent').catch((e) => {
|
15022
|
-
// don't expose, analytics-only call
|
15023
|
-
});
|
15024
|
-
const client = await __classPrivateFieldGet$2(this, _InteropClient_clientPromise, "f");
|
15025
|
-
return client.dispatch('getInfoForIntent', options);
|
15026
|
-
}
|
15027
|
-
/**
|
15028
|
-
* Get information from the Interop Broker on all Intents that are meant to handle a particular context.
|
15029
|
-
*
|
15030
|
-
* @remarks To resolve this info, the function handleInfoForIntentsByContext is meant to be overridden in the Interop Broker.
|
15031
|
-
* The format for the response will be determined by the App Provider overriding the function.
|
15032
|
-
*
|
15033
|
-
* @param context
|
15034
|
-
*
|
15035
|
-
* @example
|
15036
|
-
* ```js
|
15037
|
-
* tickerElement.on('click', (element) => {
|
15038
|
-
* const ticker = element.innerText;
|
15039
|
-
*
|
15040
|
-
* const context = {
|
15041
|
-
* type: 'fdc3.instrument',
|
15042
|
-
* id: {
|
15043
|
-
* ticker
|
15044
|
-
* }
|
15045
|
-
* }
|
15046
|
-
*
|
15047
|
-
* const intentsInfo = await fin.me.interop.getInfoForIntentByContext(context);
|
15048
|
-
* })
|
15049
|
-
* ```
|
15050
|
-
*/
|
15051
|
-
async getInfoForIntentsByContext(context) {
|
15052
|
-
this.wire.sendAction('interop-client-get-info-for-intents-by-context').catch((e) => {
|
15053
|
-
// don't expose, analytics-only call
|
15054
|
-
});
|
15055
|
-
const client = await __classPrivateFieldGet$2(this, _InteropClient_clientPromise, "f");
|
15056
|
-
return client.dispatch('getInfoForIntentsByContext', context);
|
15057
|
-
}
|
15058
|
-
/**
|
15059
|
-
* Sends a Context that will be resolved to an Intent by the Interop Broker.
|
15060
|
-
* This context accepts a metadata property.
|
15061
|
-
*
|
15062
|
-
* @remarks To resolve this info, the function handleFiredIntentByContext is meant to be overridden in the Interop Broker.
|
15063
|
-
* The format for the response will be determined by the App Provider overriding the function.
|
15064
|
-
*
|
15065
|
-
* @param context
|
15066
|
-
*
|
15067
|
-
* @example
|
15068
|
-
* ```js
|
15069
|
-
* tickerElement.on('click', (element) => {
|
15070
|
-
* const ticker = element.innerText;
|
15071
|
-
*
|
15072
|
-
* const context = {
|
15073
|
-
* type: 'fdc3.instrument',
|
15074
|
-
* id: {
|
15075
|
-
* ticker
|
15076
|
-
* }
|
15077
|
-
* }
|
15078
|
-
*
|
15079
|
-
* const intentResolution = await fin.me.interop.fireIntentForContext(context);
|
15080
|
-
* })
|
15081
|
-
* ```
|
15082
|
-
*/
|
15083
|
-
async fireIntentForContext(context) {
|
15084
|
-
this.wire.sendAction('interop-client-fire-intent-for-context').catch((e) => {
|
15085
|
-
// don't expose, analytics-only call
|
15086
|
-
});
|
15087
|
-
const client = await __classPrivateFieldGet$2(this, _InteropClient_clientPromise, "f");
|
15088
|
-
return client.dispatch('fireIntentForContext', context);
|
15089
|
-
}
|
15090
|
-
/**
|
15091
|
-
* Join the current entity to session context group `sessionContextGroupId` and return a sessionContextGroup instance.
|
15092
|
-
* If the sessionContextGroup doesn't exist, one will get created.
|
15093
|
-
*
|
15094
|
-
* @remarks Session Context Groups do not persist between runs and aren't present on snapshots.
|
15095
|
-
* @param sessionContextGroupId - Id of the context group.
|
15096
|
-
*
|
15097
|
-
* @example
|
15098
|
-
* Say we want to have a Session Context Group that holds UI theme information for all apps to consume:
|
15099
|
-
*
|
15100
|
-
* My color-picker View:
|
15101
|
-
* ```js
|
15102
|
-
* const themeSessionContextGroup = await fin.me.interop.joinSessionContextGroup('theme');
|
15103
|
-
*
|
15104
|
-
* const myColorPickerElement = document.getElementById('color-palette-picker');
|
15105
|
-
* myColorPickerElement.addEventListener('change', event => {
|
15106
|
-
* themeSessionContextGroup.setContext({ type: 'color-palette', selection: event.value });
|
15107
|
-
* });
|
15108
|
-
* ```
|
15109
|
-
*
|
15110
|
-
* In other views:
|
15111
|
-
* ```js
|
15112
|
-
* const themeSessionContextGroup = await fin.me.interop.joinSessionContextGroup('theme');
|
15113
|
-
*
|
15114
|
-
* const changeColorPalette = ({ selection }) => {
|
15115
|
-
* // change the color palette to the selection
|
15116
|
-
* };
|
15117
|
-
*
|
15118
|
-
* // If the context is already set by the time the handler was set, the handler will get invoked immediately with the current context.
|
15119
|
-
* themeSessionContextGroup.addContextHandler(changeColorPalette, 'color-palette');
|
15120
|
-
* ```
|
15121
|
-
*/
|
15122
|
-
async joinSessionContextGroup(sessionContextGroupId) {
|
15123
|
-
try {
|
15124
|
-
const currentSessionContextGroup = __classPrivateFieldGet$2(this, _InteropClient_sessionContextGroups, "f").get(sessionContextGroupId);
|
15125
|
-
if (currentSessionContextGroup) {
|
15126
|
-
return currentSessionContextGroup.getUserInstance();
|
15127
|
-
}
|
15128
|
-
const client = await __classPrivateFieldGet$2(this, _InteropClient_clientPromise, "f");
|
15129
|
-
const { hasConflict } = await client.dispatch('sessionContextGroup:createIfNeeded', {
|
15130
|
-
sessionContextGroupId
|
15131
|
-
});
|
15132
|
-
if (hasConflict) {
|
15133
|
-
console.warn(`A (non-session) context group with the name "${sessionContextGroupId}" already exists. If you are trying to join a Context Group, call joinContextGroup instead.`);
|
15134
|
-
}
|
15135
|
-
const newSessionContextGroup = new SessionContextGroupClient_1.default(this.wire, __classPrivateFieldGet$2(this, _InteropClient_clientPromise, "f"), sessionContextGroupId);
|
15136
|
-
__classPrivateFieldGet$2(this, _InteropClient_sessionContextGroups, "f").set(sessionContextGroupId, newSessionContextGroup);
|
15137
|
-
return newSessionContextGroup.getUserInstance();
|
15138
|
-
}
|
15139
|
-
catch (error) {
|
15140
|
-
console.error(`Error thrown trying to create Session Context Group with id "${sessionContextGroupId}": ${error}`);
|
15141
|
-
throw error;
|
15142
|
-
}
|
15143
|
-
}
|
15144
|
-
/**
|
15145
|
-
* Register a listener that is called when the Interop Client has been disconnected from the Interop Broker.
|
15146
|
-
* Only one listener per Interop Client can be set.
|
15147
|
-
* @param listener
|
15148
|
-
*
|
15149
|
-
* @example
|
15150
|
-
* ```js
|
15151
|
-
* const listener = (event) => {
|
15152
|
-
* const { type, topic, brokerName} = event;
|
15153
|
-
* console.log(`Disconnected from Interop Broker ${brokerName} `);
|
15154
|
-
* }
|
15155
|
-
*
|
15156
|
-
* await fin.me.interop.onDisconnection(listener);
|
15157
|
-
* ```
|
15158
|
-
*/
|
15159
|
-
async onDisconnection(listener) {
|
15160
|
-
this.wire.sendAction('interop-client-add-ondisconnection-listener').catch((e) => {
|
15161
|
-
// don't expose, analytics-only call
|
15162
|
-
});
|
15163
|
-
const client = await __classPrivateFieldGet$2(this, _InteropClient_clientPromise, "f");
|
15164
|
-
return client.onDisconnection((event) => {
|
15165
|
-
const { uuid } = event;
|
15166
|
-
listener({ type: 'interop-broker', topic: 'disconnected', brokerName: uuid });
|
15167
|
-
});
|
15168
|
-
}
|
15169
|
-
/**
|
15170
|
-
* @internal
|
15171
|
-
*
|
15172
|
-
* Used to ferry fdc3-only calls from the fdc3 shim to the Interop Broker
|
15173
|
-
*/
|
15174
|
-
static async ferryFdc3Call(interopClient, action, payload) {
|
15175
|
-
const client = await __classPrivateFieldGet$2(interopClient, _InteropClient_clientPromise, "f");
|
15176
|
-
return client.dispatch(action, payload || null);
|
15177
14709
|
}
|
15178
14710
|
}
|
15179
|
-
|
15180
|
-
|
15181
|
-
|
15182
|
-
|
14711
|
+
PrivateChannelClient$1.PrivateChannelClient = PrivateChannelClient;
|
14712
|
+
|
14713
|
+
(function (exports) {
|
14714
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
14715
|
+
exports.getIntentResolution = exports.isChannel = exports.isContext = exports.connectPrivateChannel = exports.buildAppChannelObject = exports.buildPrivateChannelObject = exports.ChannelError = exports.ResultError = exports.UnsupportedChannelApiError = exports.getUnsupportedChannelApis = void 0;
|
14716
|
+
const utils_1 = utils$3;
|
14717
|
+
const PrivateChannelClient_1 = PrivateChannelClient$1;
|
14718
|
+
const lodash_1 = require$$3;
|
14719
|
+
const getUnsupportedChannelApis = (channelType) => {
|
14720
|
+
return {
|
14721
|
+
addContextListener: () => {
|
14722
|
+
throw new UnsupportedChannelApiError('Channel.addContextListener', channelType);
|
14723
|
+
},
|
14724
|
+
broadcast: () => {
|
14725
|
+
throw new UnsupportedChannelApiError('Channel.broadcast', channelType);
|
14726
|
+
},
|
14727
|
+
getCurrentContext: () => {
|
14728
|
+
throw new UnsupportedChannelApiError('Channel.getCurrentContext', channelType);
|
14729
|
+
}
|
14730
|
+
};
|
14731
|
+
};
|
14732
|
+
exports.getUnsupportedChannelApis = getUnsupportedChannelApis;
|
14733
|
+
class UnsupportedChannelApiError extends Error {
|
14734
|
+
constructor(apiName, channelType = 'System') {
|
14735
|
+
super(apiName);
|
14736
|
+
this.message = `Calling ${apiName} on an instance of a ${channelType} Channel returned by fdc3.get${channelType}Channels is not supported. If you would like to use a ${channelType} Channel, please use fdc3.joinChannel, fdc3.addContextListener, and fdc3.broadcast instead.`;
|
14737
|
+
}
|
14738
|
+
}
|
14739
|
+
exports.UnsupportedChannelApiError = UnsupportedChannelApiError;
|
14740
|
+
var ResultError;
|
14741
|
+
(function (ResultError) {
|
14742
|
+
/** Returned if the `IntentHandler` exited without returning a Promise or that
|
14743
|
+
* Promise was not resolved with a Context or Channel object.
|
14744
|
+
*/
|
14745
|
+
ResultError["NoResultReturned"] = "NoResultReturned";
|
14746
|
+
/** Returned if the `IntentHandler` function processing the raised intent
|
14747
|
+
* throws an error or rejects the Promise it returned.
|
14748
|
+
*/
|
14749
|
+
ResultError["IntentHandlerRejected"] = "IntentHandlerRejected";
|
14750
|
+
})(ResultError = exports.ResultError || (exports.ResultError = {}));
|
14751
|
+
(function (ChannelError) {
|
14752
|
+
/** Returned if the specified channel is not found when attempting to join a
|
14753
|
+
* channel via the `joinUserChannel` function of the DesktopAgent (`fdc3`).
|
14754
|
+
*/
|
14755
|
+
ChannelError["NoChannelFound"] = "NoChannelFound";
|
14756
|
+
/** SHOULD be returned when a request to join a user channel or to a retrieve
|
14757
|
+
* a Channel object via the `joinUserChannel` or `getOrCreateChannel` methods
|
14758
|
+
* of the DesktopAgent (`fdc3`) object is denied.
|
14759
|
+
*/
|
14760
|
+
ChannelError["AccessDenied"] = "AccessDenied";
|
14761
|
+
/** SHOULD be returned when a channel cannot be created or retrieved via the
|
14762
|
+
* `getOrCreateChannel` method of the DesktopAgent (`fdc3`).
|
14763
|
+
*/
|
14764
|
+
ChannelError["CreationFailed"] = "CreationFailed";
|
14765
|
+
})(exports.ChannelError || (exports.ChannelError = {}));
|
14766
|
+
const buildPrivateChannelObject = (privateChannelClient) => {
|
14767
|
+
let clientDisconnected = false;
|
14768
|
+
const checkIfClientDisconnected = () => {
|
14769
|
+
if (clientDisconnected) {
|
14770
|
+
throw new Error('Private Channel Client has been disconnected from the Private Channel');
|
14771
|
+
}
|
14772
|
+
};
|
14773
|
+
return {
|
14774
|
+
id: privateChannelClient.id,
|
14775
|
+
type: 'private',
|
14776
|
+
broadcast: async (context) => {
|
14777
|
+
checkIfClientDisconnected();
|
14778
|
+
return privateChannelClient.broadcast(context);
|
14779
|
+
},
|
14780
|
+
getCurrentContext: async (contextType) => {
|
14781
|
+
checkIfClientDisconnected();
|
14782
|
+
return privateChannelClient.getCurrentContext(contextType);
|
14783
|
+
},
|
14784
|
+
// @ts-expect-error TODO [CORE-1524]
|
14785
|
+
addContextListener: async (contextType, handler) => {
|
14786
|
+
checkIfClientDisconnected();
|
14787
|
+
let handlerInUse = handler;
|
14788
|
+
let contextTypeInUse = contextType;
|
14789
|
+
if (typeof contextType === 'function') {
|
14790
|
+
console.warn('addContextListener(handler) has been deprecated. Please use addContextListener(null, handler)');
|
14791
|
+
handlerInUse = contextType;
|
14792
|
+
contextTypeInUse = null;
|
14793
|
+
}
|
14794
|
+
const listener = privateChannelClient.addContextListener(contextTypeInUse, handlerInUse);
|
14795
|
+
return listener;
|
14796
|
+
},
|
14797
|
+
onAddContextListener: (handler) => {
|
14798
|
+
checkIfClientDisconnected();
|
14799
|
+
return privateChannelClient.onAddContextListener(handler);
|
14800
|
+
},
|
14801
|
+
disconnect: async () => {
|
14802
|
+
checkIfClientDisconnected();
|
14803
|
+
clientDisconnected = true;
|
14804
|
+
return privateChannelClient.disconnect();
|
14805
|
+
},
|
14806
|
+
onDisconnect: (handler) => {
|
14807
|
+
checkIfClientDisconnected();
|
14808
|
+
return privateChannelClient.onDisconnect(handler);
|
14809
|
+
},
|
14810
|
+
onUnsubscribe: (handler) => {
|
14811
|
+
checkIfClientDisconnected();
|
14812
|
+
return privateChannelClient.onUnsubscribe(handler);
|
14813
|
+
}
|
14814
|
+
};
|
14815
|
+
};
|
14816
|
+
exports.buildPrivateChannelObject = buildPrivateChannelObject;
|
14817
|
+
const buildAppChannelObject = (sessionContextGroup) => {
|
14818
|
+
return {
|
14819
|
+
id: sessionContextGroup.id,
|
14820
|
+
type: 'app',
|
14821
|
+
broadcast: sessionContextGroup.setContext,
|
14822
|
+
getCurrentContext: async (contextType) => {
|
14823
|
+
const context = await sessionContextGroup.getCurrentContext(contextType);
|
14824
|
+
return context === undefined ? null : context;
|
14825
|
+
},
|
14826
|
+
// @ts-expect-error TODO [CORE-1524]
|
14827
|
+
addContextListener: (contextType, handler) => {
|
14828
|
+
let realHandler;
|
14829
|
+
let realType;
|
14830
|
+
if (typeof contextType === 'function') {
|
14831
|
+
console.warn('addContextListener(handler) has been deprecated. Please use addContextListener(null, handler)');
|
14832
|
+
realHandler = contextType;
|
14833
|
+
}
|
14834
|
+
else {
|
14835
|
+
realHandler = handler;
|
14836
|
+
if (typeof contextType === 'string') {
|
14837
|
+
realType = contextType;
|
14838
|
+
}
|
14839
|
+
}
|
14840
|
+
const listener = (async () => {
|
14841
|
+
let first = true;
|
14842
|
+
const currentContext = await sessionContextGroup.getCurrentContext(realType);
|
14843
|
+
const wrappedHandler = (context, contextMetadata) => {
|
14844
|
+
if (first) {
|
14845
|
+
first = false;
|
14846
|
+
if ((0, lodash_1.isEqual)(currentContext, context)) {
|
14847
|
+
return;
|
14848
|
+
}
|
14849
|
+
}
|
14850
|
+
// eslint-disable-next-line consistent-return
|
14851
|
+
return realHandler(context, contextMetadata);
|
14852
|
+
};
|
14853
|
+
return sessionContextGroup.addContextHandler(wrappedHandler, realType);
|
14854
|
+
})();
|
14855
|
+
return {
|
14856
|
+
...listener,
|
14857
|
+
unsubscribe: () => listener.then((l) => l.unsubscribe())
|
14858
|
+
};
|
14859
|
+
}
|
14860
|
+
};
|
14861
|
+
};
|
14862
|
+
exports.buildAppChannelObject = buildAppChannelObject;
|
14863
|
+
const connectPrivateChannel = async (channelId) => {
|
14864
|
+
try {
|
14865
|
+
const channelClient = await fin.InterApplicationBus.Channel.connect(channelId);
|
14866
|
+
const privateChannelClient = new PrivateChannelClient_1.PrivateChannelClient(channelClient, channelId);
|
14867
|
+
return (0, exports.buildPrivateChannelObject)(privateChannelClient);
|
14868
|
+
}
|
14869
|
+
catch (error) {
|
14870
|
+
throw new Error(`Private Channel with id: ${channelId} doesn't exist`);
|
14871
|
+
}
|
14872
|
+
};
|
14873
|
+
exports.connectPrivateChannel = connectPrivateChannel;
|
14874
|
+
const isContext = (context) => {
|
14875
|
+
if (context && typeof context === 'object' && 'type' in context) {
|
14876
|
+
const { type } = context;
|
14877
|
+
return typeof type === 'string';
|
14878
|
+
}
|
14879
|
+
return false;
|
14880
|
+
};
|
14881
|
+
exports.isContext = isContext;
|
14882
|
+
const isChannel = (channel) => {
|
14883
|
+
if (channel && typeof channel === 'object' && 'type' in channel && 'id' in channel) {
|
14884
|
+
const { type, id } = channel;
|
14885
|
+
return typeof type === 'string' && typeof id === 'string' && (type === 'app' || type === 'private');
|
14886
|
+
}
|
14887
|
+
return false;
|
14888
|
+
};
|
14889
|
+
exports.isChannel = isChannel;
|
14890
|
+
const getIntentResolution = async (interopModule, context, app, intent) => {
|
14891
|
+
// Generate an ID to make a session context group with. We will pass that ID to the Broker.
|
14892
|
+
// The broker will then setContext on that session context group later with our Intent Result,
|
14893
|
+
const guid = (0, utils_1.generateId)(); // TODO make this undefined in web
|
14894
|
+
// Promise we'll use in getResult
|
14895
|
+
const getResultPromise = new Promise((resolve, reject) => {
|
14896
|
+
fin.InterApplicationBus.subscribe({ uuid: '*' }, guid, (intentResult) => {
|
14897
|
+
resolve(intentResult);
|
14898
|
+
}).catch(() => reject(new Error('getResult is not supported in this environment')));
|
14899
|
+
});
|
14900
|
+
// Adding the intentResolutionResultId to the intentObj. Because fireIntent only accepts a single arg, we have to slap it in here.
|
14901
|
+
const metadata = app ? { target: app, intentResolutionResultId: guid } : { intentResolutionResultId: guid };
|
14902
|
+
const intentObj = intent ? { name: intent, context, metadata } : { ...context, metadata };
|
14903
|
+
// Set up the getResult call.
|
14904
|
+
const getResult = async () => {
|
14905
|
+
let intentResult = await getResultPromise;
|
14906
|
+
if (!intentResult || typeof intentResult !== 'object') {
|
14907
|
+
throw new Error(ResultError.NoResultReturned);
|
14908
|
+
}
|
14909
|
+
const { error } = intentResult;
|
14910
|
+
if (error) {
|
14911
|
+
throw new Error(ResultError.IntentHandlerRejected);
|
14912
|
+
}
|
14913
|
+
if ((0, exports.isChannel)(intentResult)) {
|
14914
|
+
const { id, type } = intentResult;
|
14915
|
+
switch (type) {
|
14916
|
+
case 'private': {
|
14917
|
+
intentResult = await (0, exports.connectPrivateChannel)(id);
|
14918
|
+
break;
|
14919
|
+
}
|
14920
|
+
case 'app': {
|
14921
|
+
const sessionContextGroup = await interopModule.joinSessionContextGroup(id);
|
14922
|
+
intentResult = (0, exports.buildAppChannelObject)(sessionContextGroup);
|
14923
|
+
break;
|
14924
|
+
}
|
14925
|
+
}
|
14926
|
+
}
|
14927
|
+
else if (!(0, exports.isContext)(intentResult)) {
|
14928
|
+
throw new Error(ResultError.NoResultReturned);
|
14929
|
+
}
|
14930
|
+
return intentResult;
|
14931
|
+
};
|
14932
|
+
// Finally fire the intent.
|
14933
|
+
const intentResolutionInfoFromBroker = intent
|
14934
|
+
? await interopModule.fireIntent(intentObj)
|
14935
|
+
: await interopModule.fireIntentForContext(intentObj);
|
14936
|
+
if (typeof intentResolutionInfoFromBroker !== 'object') {
|
14937
|
+
return {
|
14938
|
+
source: {
|
14939
|
+
appId: '',
|
14940
|
+
instanceId: ''
|
14941
|
+
},
|
14942
|
+
intent: '',
|
14943
|
+
version: '2.0',
|
14944
|
+
getResult
|
14945
|
+
};
|
14946
|
+
}
|
14947
|
+
return { ...intentResolutionInfoFromBroker, getResult };
|
14948
|
+
};
|
14949
|
+
exports.getIntentResolution = getIntentResolution;
|
14950
|
+
} (utils$2));
|
14951
|
+
|
14952
|
+
var hasRequiredFdc3Common;
|
14953
|
+
|
14954
|
+
function requireFdc3Common () {
|
14955
|
+
if (hasRequiredFdc3Common) return fdc3Common;
|
14956
|
+
hasRequiredFdc3Common = 1;
|
14957
|
+
var __classPrivateFieldGet = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
14958
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
14959
|
+
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");
|
14960
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
14961
|
+
};
|
14962
|
+
var __classPrivateFieldSet = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
14963
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
14964
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
14965
|
+
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");
|
14966
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
14967
|
+
};
|
14968
|
+
var _FDC3ModuleBase_producer;
|
14969
|
+
Object.defineProperty(fdc3Common, "__esModule", { value: true });
|
14970
|
+
fdc3Common.FDC3ModuleBase = void 0;
|
14971
|
+
const utils_1 = utils$2;
|
14972
|
+
const utils_2 = utils$3;
|
14973
|
+
const InteropClient_1 = requireInteropClient();
|
14974
|
+
const lodash_1 = require$$3;
|
14975
|
+
class FDC3ModuleBase {
|
14976
|
+
get client() {
|
14977
|
+
return __classPrivateFieldGet(this, _FDC3ModuleBase_producer, "f").call(this);
|
14978
|
+
}
|
14979
|
+
get fin() {
|
14980
|
+
return this.wire.getFin();
|
14981
|
+
}
|
14982
|
+
// eslint-disable-next-line no-useless-constructor
|
14983
|
+
constructor(producer, wire) {
|
14984
|
+
this.wire = wire;
|
14985
|
+
_FDC3ModuleBase_producer.set(this, void 0);
|
14986
|
+
__classPrivateFieldSet(this, _FDC3ModuleBase_producer, producer, "f");
|
14987
|
+
}
|
14988
|
+
/**
|
14989
|
+
* Broadcasts a context for the channel of the current entity.
|
14990
|
+
* @param context - New context to set.
|
14991
|
+
*
|
14992
|
+
* @tutorial fdc3.broadcast
|
14993
|
+
* @static
|
14994
|
+
*/
|
14995
|
+
async broadcast(context) {
|
14996
|
+
this.wire.sendAction('fdc3-broadcast').catch((e) => {
|
14997
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
14998
|
+
});
|
14999
|
+
return this.client.setContext(context);
|
15000
|
+
}
|
15001
|
+
/**
|
15002
|
+
* Launches an app with target information, which can either be a string or an AppMetadata object.
|
15003
|
+
* @param app
|
15004
|
+
* @param context
|
15005
|
+
*
|
15006
|
+
* @tutorial fdc3.open
|
15007
|
+
*/
|
15008
|
+
async _open(app, context) {
|
15009
|
+
this.wire.sendAction('fdc3-open').catch((e) => {
|
15010
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
15011
|
+
});
|
15012
|
+
try {
|
15013
|
+
return await InteropClient_1.InteropClient.ferryFdc3Call(this.client, 'fdc3Open', { app, context });
|
15014
|
+
}
|
15015
|
+
catch (error) {
|
15016
|
+
const errorToThrow = error.message === utils_2.BROKER_ERRORS.fdc3Open ? 'ResolverUnavailable' : error.message;
|
15017
|
+
throw new Error(errorToThrow);
|
15018
|
+
}
|
15019
|
+
}
|
15020
|
+
/**
|
15021
|
+
* Returns a Channel object for the specified channel, creating it as an App Channel if it does not exist.
|
15022
|
+
* @param channelId
|
15023
|
+
*
|
15024
|
+
* @tutorial fdc3.getOrCreateChannel
|
15025
|
+
*/
|
15026
|
+
async getOrCreateChannel(channelId) {
|
15027
|
+
this.wire.sendAction('fdc3-get-or-create-channel').catch((e) => {
|
15028
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
15029
|
+
});
|
15030
|
+
const systemChannels = await this.getSystemChannels();
|
15031
|
+
const userChannel = systemChannels.find((channel) => channel.id === channelId);
|
15032
|
+
if (userChannel) {
|
15033
|
+
return { ...userChannel, type: 'system', ...(0, utils_1.getUnsupportedChannelApis)() };
|
15034
|
+
}
|
15035
|
+
try {
|
15036
|
+
const sessionContextGroup = await this.client.joinSessionContextGroup(channelId);
|
15037
|
+
return (0, utils_1.buildAppChannelObject)(sessionContextGroup);
|
15038
|
+
}
|
15039
|
+
catch (error) {
|
15040
|
+
console.error(error.message);
|
15041
|
+
throw new Error(utils_1.ChannelError.CreationFailed);
|
15042
|
+
}
|
15043
|
+
}
|
15044
|
+
/**
|
15045
|
+
* Returns the Interop-Broker-defined context groups available for an entity to join.
|
15046
|
+
*
|
15047
|
+
* @tutorial fdc3.getSystemChannels
|
15048
|
+
* @static
|
15049
|
+
*/
|
15050
|
+
async getSystemChannels() {
|
15051
|
+
this.wire.sendAction('fdc3-get-system-channels').catch((e) => {
|
15052
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
15053
|
+
});
|
15054
|
+
const channels = await this.client.getContextGroups();
|
15055
|
+
// fdc3 implementation of getSystemChannels returns on array of channels, have to decorate over
|
15056
|
+
// this so people know that these APIs are not supported
|
15057
|
+
return channels.map((channel) => {
|
15058
|
+
return { ...channel, type: 'system', ...(0, utils_1.getUnsupportedChannelApis)() };
|
15059
|
+
});
|
15060
|
+
}
|
15061
|
+
/**
|
15062
|
+
* Join all Interop Clients at the given identity to context group `contextGroupId`.
|
15063
|
+
* If no target is specified, it adds the sender to the context group.
|
15064
|
+
* Because multiple Channel connections/Interop Clients can potentially exist at a `uuid`/`name` combo, we currently join all Channel connections/Interop Clients at the given identity to the context group.
|
15065
|
+
* If an `endpointId` is provided (which is unlikely, unless the call is coming from an external adapter), then we only join that single connection to the context group.
|
15066
|
+
* For all intents and purposes, there will only be 1 connection present in Platform and Browser implementations, so this point is more-or-less moot.
|
15067
|
+
* @param channelId - Id of the context group.
|
15068
|
+
*
|
15069
|
+
* @tutorial fdc3.joinChannel
|
15070
|
+
* @static
|
15071
|
+
*/
|
15072
|
+
async joinChannel(channelId) {
|
15073
|
+
this.wire.sendAction('fdc3-join-channel').catch((e) => {
|
15074
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
15075
|
+
});
|
15076
|
+
try {
|
15077
|
+
return await this.client.joinContextGroup(channelId);
|
15078
|
+
}
|
15079
|
+
catch (error) {
|
15080
|
+
if (error.message === utils_2.BROKER_ERRORS.joinSessionContextGroupWithJoinContextGroup) {
|
15081
|
+
console.error('The Channel you have tried to join is an App Channel. Custom Channels can only be defined by the Interop Broker through code or manifest configuration. Please use getOrCreateChannel.');
|
15082
|
+
}
|
15083
|
+
else {
|
15084
|
+
console.error(error.message);
|
15085
|
+
}
|
15086
|
+
if (error.message.startsWith('Attempting to join a context group that does not exist')) {
|
15087
|
+
throw new Error(utils_1.ChannelError.NoChannelFound);
|
15088
|
+
}
|
15089
|
+
throw new Error(utils_1.ChannelError.AccessDenied);
|
15090
|
+
}
|
15091
|
+
}
|
15092
|
+
/**
|
15093
|
+
* Returns the Channel that the entity is subscribed to. Returns null if not joined to a channel.
|
15094
|
+
*
|
15095
|
+
* @tutorial fdc3.getCurrentChannel
|
15096
|
+
*/
|
15097
|
+
async getCurrentChannel() {
|
15098
|
+
this.wire.sendAction('fdc3-get-current-channel').catch((e) => {
|
15099
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
15100
|
+
});
|
15101
|
+
const currentContextGroupInfo = await this.getCurrentContextGroupInfo();
|
15102
|
+
if (!currentContextGroupInfo) {
|
15103
|
+
return null;
|
15104
|
+
}
|
15105
|
+
return this.buildChannelObject(currentContextGroupInfo);
|
15106
|
+
}
|
15107
|
+
/**
|
15108
|
+
* Removes the specified target from a context group.
|
15109
|
+
* If no target is specified, it removes the sender from their context group.
|
15110
|
+
*
|
15111
|
+
* @tutorial fdc3.leaveCurrentChannel
|
15112
|
+
* @static
|
15113
|
+
*/
|
15114
|
+
async leaveCurrentChannel() {
|
15115
|
+
this.wire.sendAction('fdc3-leave-current-channel').catch((e) => {
|
15116
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
15117
|
+
});
|
15118
|
+
return this.client.removeFromContextGroup();
|
15119
|
+
}
|
15120
|
+
// utils
|
15121
|
+
// eslint-disable-next-line class-methods-use-this
|
15122
|
+
async getCurrentContextGroupInfo() {
|
15123
|
+
const contextGroups = await this.client.getContextGroups();
|
15124
|
+
const clientsInCtxGroupsPromise = contextGroups.map(async (ctxGroup) => {
|
15125
|
+
return this.client.getAllClientsInContextGroup(ctxGroup.id);
|
15126
|
+
});
|
15127
|
+
const clientsInCtxGroups = await Promise.all(clientsInCtxGroupsPromise);
|
15128
|
+
const clientIdx = clientsInCtxGroups.findIndex((clientIdentityArr) => {
|
15129
|
+
return clientIdentityArr.some((clientIdentity) => {
|
15130
|
+
const { uuid, name } = clientIdentity;
|
15131
|
+
return this.wire.me.uuid === uuid && this.wire.me.name === name;
|
15132
|
+
});
|
15133
|
+
});
|
15134
|
+
return contextGroups[clientIdx];
|
15135
|
+
}
|
15136
|
+
async buildChannelObject(currentContextGroupInfo) {
|
15137
|
+
// @ts-expect-error
|
15138
|
+
return {
|
15139
|
+
...currentContextGroupInfo,
|
15140
|
+
type: 'system',
|
15141
|
+
addContextListener: (...[contextType, handler]) => {
|
15142
|
+
let realHandler;
|
15143
|
+
let realType;
|
15144
|
+
if (typeof contextType === 'function') {
|
15145
|
+
console.warn('addContextListener(handler) has been deprecated. Please use addContextListener(null, handler)');
|
15146
|
+
realHandler = contextType;
|
15147
|
+
}
|
15148
|
+
else {
|
15149
|
+
realHandler = handler;
|
15150
|
+
if (typeof contextType === 'string') {
|
15151
|
+
realType = contextType;
|
15152
|
+
}
|
15153
|
+
}
|
15154
|
+
const listener = (async () => {
|
15155
|
+
let first = true;
|
15156
|
+
const currentContext = await this.client.getCurrentContext(realType);
|
15157
|
+
const wrappedHandler = (context, contextMetadata) => {
|
15158
|
+
if (first) {
|
15159
|
+
first = false;
|
15160
|
+
if ((0, lodash_1.isEqual)(currentContext, context)) {
|
15161
|
+
return;
|
15162
|
+
}
|
15163
|
+
}
|
15164
|
+
// eslint-disable-next-line consistent-return
|
15165
|
+
return realHandler(context, contextMetadata);
|
15166
|
+
};
|
15167
|
+
return this.client.addContextHandler(wrappedHandler, realType);
|
15168
|
+
})();
|
15169
|
+
// @ts-expect-error TODO [CORE-1524]
|
15170
|
+
return {
|
15171
|
+
...listener,
|
15172
|
+
unsubscribe: () => listener.then((l) => l.unsubscribe())
|
15173
|
+
};
|
15174
|
+
},
|
15175
|
+
broadcast: this.broadcast.bind(this),
|
15176
|
+
// @ts-expect-error Typescript fails to infer the returntype is a Promise
|
15177
|
+
getCurrentContext: async (contextType) => {
|
15178
|
+
const context = await this.client.getCurrentContext(contextType);
|
15179
|
+
// @ts-expect-error Typescript fails to infer the returntype is a Promise
|
15180
|
+
return context === undefined ? null : context;
|
15181
|
+
}
|
15182
|
+
};
|
15183
|
+
}
|
15184
|
+
}
|
15185
|
+
fdc3Common.FDC3ModuleBase = FDC3ModuleBase;
|
15186
|
+
_FDC3ModuleBase_producer = new WeakMap();
|
15187
|
+
return fdc3Common;
|
15188
|
+
}
|
15189
|
+
|
15190
|
+
var hasRequiredFdc31_2;
|
15191
|
+
|
15192
|
+
function requireFdc31_2 () {
|
15193
|
+
if (hasRequiredFdc31_2) return fdc31_2;
|
15194
|
+
hasRequiredFdc31_2 = 1;
|
15195
|
+
Object.defineProperty(fdc31_2, "__esModule", { value: true });
|
15196
|
+
fdc31_2.Fdc3Module = void 0;
|
15197
|
+
const utils_1 = utils$3;
|
15198
|
+
const fdc3_common_1 = requireFdc3Common();
|
15199
|
+
/**
|
15200
|
+
* @version 1.2
|
15201
|
+
* The FDC3 Client Library provides a set APIs to be used for FDC3 compliance,
|
15202
|
+
* while using our Interop API under the hood. In order to use this set of APIs
|
15203
|
+
* you will need to set up your own {@link InteropBroker InteropBroker} or use a Platform application, which does the setup for you. Refer to our documentation on
|
15204
|
+
* our {@link https://developers.openfin.co/of-docs/docs/enable-color-linking Interop API}.
|
15205
|
+
*
|
15206
|
+
* To enable the FDC3 APIs in a {@link Window Window} or {@link View View}, add the fdc3InteropApi
|
15207
|
+
* property to its options:
|
15208
|
+
*
|
15209
|
+
* ```js
|
15210
|
+
* {
|
15211
|
+
* autoShow: false,
|
15212
|
+
* saveWindowState: true,
|
15213
|
+
* url: 'https://openfin.co',
|
15214
|
+
* fdc3InteropApi: '1.2'
|
15215
|
+
* }
|
15216
|
+
* ```
|
15217
|
+
*
|
15218
|
+
* If using a {@link Platform Platform } application, you can set this property in defaultWindowOptions and defaultViewOptions.
|
15219
|
+
*
|
15220
|
+
* In order to ensure that the FDC3 Api is ready before use, you can use the 'fdc3Ready' event fired on the DOM Window object:
|
15221
|
+
*
|
15222
|
+
* ```js
|
15223
|
+
* function fdc3Action() {
|
15224
|
+
* // Make some fdc3 API calls here
|
15225
|
+
* }
|
15226
|
+
*
|
15227
|
+
* if (window.fdc3) {
|
15228
|
+
* fdc3Action();
|
15229
|
+
* } else {
|
15230
|
+
* window.addEventListener('fdc3Ready', fdc3Action);
|
15231
|
+
* }
|
15232
|
+
* ```
|
15233
|
+
*/
|
15234
|
+
class Fdc3Module extends fdc3_common_1.FDC3ModuleBase {
|
15235
|
+
async open(app, context) {
|
15236
|
+
// eslint-disable-next-line no-underscore-dangle
|
15237
|
+
await super._open(app, context);
|
15238
|
+
}
|
15239
|
+
/**
|
15240
|
+
* Add a context handler for incoming context. If an entity is part of a context group, and then sets its context handler, it will receive all of its declared contexts. If you wish to listen for all incoming contexts, pass `null` for the contextType argument.
|
15241
|
+
* @param contextType - The type of context you wish to handle.
|
15242
|
+
* @param handler - Handler for incoming context.
|
15243
|
+
*
|
15244
|
+
* @tutorial fdc3.addContextListener
|
15245
|
+
* @static
|
15246
|
+
*/
|
15247
|
+
// @ts-expect-error TODO [CORE-1524]
|
15248
|
+
addContextListener(contextType, handler) {
|
15249
|
+
this.wire.sendAction('fdc3-add-context-listener').catch((e) => {
|
15250
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
15251
|
+
});
|
15252
|
+
let listener;
|
15253
|
+
if (typeof contextType === 'function') {
|
15254
|
+
console.warn('addContextListener(handler) has been deprecated. Please use addContextListener(null, handler)');
|
15255
|
+
listener = this.client.addContextHandler(contextType);
|
15256
|
+
}
|
15257
|
+
else {
|
15258
|
+
listener = this.client.addContextHandler(handler, contextType === null ? undefined : contextType);
|
15259
|
+
}
|
15260
|
+
return {
|
15261
|
+
...listener,
|
15262
|
+
unsubscribe: () => listener.then((l) => l.unsubscribe())
|
15263
|
+
};
|
15264
|
+
}
|
15265
|
+
/**
|
15266
|
+
* Adds a listener for incoming Intents.
|
15267
|
+
* @param intent - Name of the Intent
|
15268
|
+
* @param handler - Handler for incoming Intent
|
15269
|
+
*
|
15270
|
+
* @tutorial fdc3.addIntentListener
|
15271
|
+
* @static
|
15272
|
+
*/
|
15273
|
+
addIntentListener(intent, handler) {
|
15274
|
+
this.wire.sendAction('fdc3-add-intent-listener').catch((e) => {
|
15275
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
15276
|
+
});
|
15277
|
+
const contextHandler = (raisedIntent) => {
|
15278
|
+
const { context, metadata: intentMetadata } = raisedIntent;
|
15279
|
+
const { metadata } = context;
|
15280
|
+
const intentResolutionResultId = intentMetadata?.intentResolutionResultId || metadata?.intentResolutionResultId;
|
15281
|
+
if (intentResolutionResultId) {
|
15282
|
+
this.fin.InterApplicationBus.publish(intentResolutionResultId, null).catch(() => null);
|
15283
|
+
}
|
15284
|
+
handler(raisedIntent.context);
|
15285
|
+
};
|
15286
|
+
const listener = this.client.registerIntentHandler(contextHandler, intent, {
|
15287
|
+
fdc3Version: '1.2'
|
15288
|
+
});
|
15289
|
+
return {
|
15290
|
+
...listener,
|
15291
|
+
unsubscribe: () => listener.then((l) => l.unsubscribe())
|
15292
|
+
};
|
15293
|
+
}
|
15294
|
+
/**
|
15295
|
+
* Raises a specific intent.
|
15296
|
+
* @param intent Name of the Intent.
|
15297
|
+
* @param context Context associated with the Intent.
|
15298
|
+
* @param app App that will resolve the Intent. This is added as metadata to the Intent. Can be accessed by the app provider in {@link InteropBroker#handleFiredIntent InteropBroker.handleFiredIntent}.
|
15299
|
+
*
|
15300
|
+
* @tutorial fdc3.raiseIntent
|
15301
|
+
* @static
|
15302
|
+
*/
|
15303
|
+
async raiseIntent(intent, context, app) {
|
15304
|
+
this.wire.sendAction('fdc3-raise-intent').catch((e) => {
|
15305
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
15306
|
+
});
|
15307
|
+
const intentObj = app
|
15308
|
+
? { name: intent, context, metadata: { target: app } }
|
15309
|
+
: { name: intent, context };
|
15310
|
+
try {
|
15311
|
+
return await this.client.fireIntent(intentObj);
|
15312
|
+
}
|
15313
|
+
catch (error) {
|
15314
|
+
const errorToThrow = error.message === utils_1.BROKER_ERRORS.fireIntent ? 'ResolverUnavailable' : error.message;
|
15315
|
+
throw new Error(errorToThrow);
|
15316
|
+
}
|
15317
|
+
}
|
15318
|
+
/**
|
15319
|
+
* Find out more information about a particular intent by passing its name, and optionally its context.
|
15320
|
+
* @param intent Name of the Intent
|
15321
|
+
* @param context
|
15322
|
+
*
|
15323
|
+
* @tutorial fdc3.findIntent
|
15324
|
+
*/
|
15325
|
+
async findIntent(intent, context) {
|
15326
|
+
this.wire.sendAction('fdc3-find-intent').catch((e) => {
|
15327
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
15328
|
+
});
|
15329
|
+
try {
|
15330
|
+
return await this.client.getInfoForIntent({ name: intent, context });
|
15331
|
+
}
|
15332
|
+
catch (error) {
|
15333
|
+
const errorToThrow = error.message === utils_1.BROKER_ERRORS.getInfoForIntent ? 'ResolverUnavailable' : error.message;
|
15334
|
+
throw new Error(errorToThrow);
|
15335
|
+
}
|
15336
|
+
}
|
15337
|
+
/**
|
15338
|
+
* Find all the available intents for a particular context.
|
15339
|
+
* @param context
|
15340
|
+
*
|
15341
|
+
* @tutorial fdc3.findIntentsByContext
|
15342
|
+
*/
|
15343
|
+
async findIntentsByContext(context) {
|
15344
|
+
this.wire.sendAction('fdc3-find-intents-by-context').catch((e) => {
|
15345
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
15346
|
+
});
|
15347
|
+
try {
|
15348
|
+
return await this.client.getInfoForIntentsByContext(context);
|
15349
|
+
}
|
15350
|
+
catch (error) {
|
15351
|
+
const errorToThrow = error.message === utils_1.BROKER_ERRORS.getInfoForIntentsByContext ? 'ResolverUnavailable' : error.message;
|
15352
|
+
throw new Error(errorToThrow);
|
15353
|
+
}
|
15354
|
+
}
|
15355
|
+
/**
|
15356
|
+
* Finds and raises an intent against a target app based purely on context data.
|
15357
|
+
* @param context
|
15358
|
+
* @param app
|
15359
|
+
*
|
15360
|
+
* @tutorial fdc3.raiseIntentForContext
|
15361
|
+
*/
|
15362
|
+
async raiseIntentForContext(context, app) {
|
15363
|
+
this.wire.sendAction('fdc3-raise-intent-for-context').catch((e) => {
|
15364
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
15365
|
+
});
|
15366
|
+
try {
|
15367
|
+
return await this.client.fireIntentForContext({ ...context, metadata: { target: app } });
|
15368
|
+
}
|
15369
|
+
catch (error) {
|
15370
|
+
const errorToThrow = error.message === utils_1.BROKER_ERRORS.fireIntentForContext ? 'ResolverUnavailable' : error.message;
|
15371
|
+
throw new Error(errorToThrow);
|
15372
|
+
}
|
15373
|
+
}
|
15374
|
+
/**
|
15375
|
+
* Returns a Channel object for the specified channel, creating it as an App Channel if it does not exist.
|
15376
|
+
* @param channelId
|
15377
|
+
*
|
15378
|
+
* @tutorial fdc3.getOrCreateChannel
|
15379
|
+
*/
|
15380
|
+
async getOrCreateChannel(channelId) {
|
15381
|
+
return super.getOrCreateChannel(channelId);
|
15382
|
+
}
|
15383
|
+
/**
|
15384
|
+
* 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.
|
15385
|
+
*
|
15386
|
+
* @tutorial fdc3.getInfo
|
15387
|
+
*/
|
15388
|
+
getInfo() {
|
15389
|
+
this.wire.sendAction('fdc3-get-info').catch((e) => {
|
15390
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
15391
|
+
});
|
15392
|
+
// @ts-expect-error
|
15393
|
+
const { uuid, fdc3InteropApi } = fin.__internal_.initialOptions;
|
15394
|
+
// @ts-expect-error
|
15395
|
+
const runtimeVersion = fin.desktop.getVersion();
|
15396
|
+
return {
|
15397
|
+
fdc3Version: fdc3InteropApi,
|
15398
|
+
provider: `openfin-${uuid}`,
|
15399
|
+
providerVersion: runtimeVersion
|
15400
|
+
};
|
15401
|
+
}
|
15402
|
+
}
|
15403
|
+
fdc31_2.Fdc3Module = Fdc3Module;
|
15404
|
+
return fdc31_2;
|
15405
|
+
}
|
15406
|
+
|
15407
|
+
var fdc32_0 = {};
|
15408
|
+
|
15409
|
+
var hasRequiredFdc32_0;
|
15410
|
+
|
15411
|
+
function requireFdc32_0 () {
|
15412
|
+
if (hasRequiredFdc32_0) return fdc32_0;
|
15413
|
+
hasRequiredFdc32_0 = 1;
|
15414
|
+
Object.defineProperty(fdc32_0, "__esModule", { value: true });
|
15415
|
+
fdc32_0.Fdc3Module2 = void 0;
|
15416
|
+
const fdc3_common_1 = requireFdc3Common();
|
15417
|
+
const utils_1 = utils$3;
|
15418
|
+
const InteropClient_1 = requireInteropClient();
|
15419
|
+
const utils_2 = utils$2;
|
15420
|
+
const PrivateChannelClient_1 = PrivateChannelClient$1;
|
15421
|
+
/**
|
15422
|
+
* @version 2.0
|
15423
|
+
* The FDC3 Client Library provides a set APIs to be used for FDC3 compliance,
|
15424
|
+
* while using our Interop API under the hood. In order to use this set of APIs
|
15425
|
+
* you will need to set up your own {@link InteropBroker InteropBroker} or use a Platform application, which does the setup for you. Refer to our documentation on
|
15426
|
+
* our {@link https://developers.openfin.co/of-docs/docs/enable-context-sharing Interop API}.
|
15427
|
+
*
|
15428
|
+
* To enable the FDC3 APIs in a {@link Window Window} or {@link View View}, add the fdc3InteropApi
|
15429
|
+
* property to its options:
|
15430
|
+
*
|
15431
|
+
* ```js
|
15432
|
+
* {
|
15433
|
+
* autoShow: false,
|
15434
|
+
* saveWindowState: true,
|
15435
|
+
* url: 'https://openfin.co',
|
15436
|
+
* fdc3InteropApi: '2.0'
|
15437
|
+
* }
|
15438
|
+
* ```
|
15439
|
+
*
|
15440
|
+
* If using a {@link Platform Platform } application, you can set this property in defaultWindowOptions and defaultViewOptions.
|
15441
|
+
*
|
15442
|
+
* In order to ensure that the FDC3 Api is ready before use, you can use the 'fdc3Ready' event fired on the DOM Window object:
|
15443
|
+
*
|
15444
|
+
* ```js
|
15445
|
+
* function fdc3Action() {
|
15446
|
+
* // Make some fdc3 API calls here
|
15447
|
+
* }
|
15448
|
+
*
|
15449
|
+
* if (window.fdc3) {
|
15450
|
+
* fdc3Action();
|
15451
|
+
* } else {
|
15452
|
+
* window.addEventListener('fdc3Ready', fdc3Action);
|
15453
|
+
* }
|
15454
|
+
* ```
|
15455
|
+
*/
|
15456
|
+
class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
|
15457
|
+
/**
|
15458
|
+
* Launches an app, specified via an AppIdentifier object.
|
15459
|
+
* @param app
|
15460
|
+
* @param context
|
15461
|
+
*
|
15462
|
+
* @tutorial fdc3.open
|
15463
|
+
*/
|
15464
|
+
async open(app, context) {
|
15465
|
+
if (typeof app === 'string') {
|
15466
|
+
console.warn('Passing a string as the app parameter is deprecated, please use an AppIdentifier ({ appId: string; instanceId?: string }).');
|
15467
|
+
}
|
15468
|
+
// eslint-disable-next-line no-underscore-dangle
|
15469
|
+
return super._open(app, context);
|
15470
|
+
}
|
15471
|
+
/**
|
15472
|
+
* Find all the available instances for a particular application.
|
15473
|
+
* @param app
|
15474
|
+
*
|
15475
|
+
* @tutorial fdc3v2.findInstances
|
15476
|
+
*/
|
15477
|
+
async findInstances(app) {
|
15478
|
+
this.wire.sendAction('fdc3-find-instances').catch((e) => {
|
15479
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
15480
|
+
});
|
15481
|
+
try {
|
15482
|
+
return await InteropClient_1.InteropClient.ferryFdc3Call(this.client, 'fdc3FindInstances', app);
|
15483
|
+
}
|
15484
|
+
catch (error) {
|
15485
|
+
const errorToThrow = error.message === utils_1.BROKER_ERRORS.fdc3FindInstances ? 'ResolverUnavailable' : error.message;
|
15486
|
+
throw new Error(errorToThrow);
|
15487
|
+
}
|
15488
|
+
}
|
15489
|
+
/**
|
15490
|
+
* Retrieves the AppMetadata for an AppIdentifier, which provides additional metadata (such as icons, a title and description) from the App Directory record for the application, that may be used for display purposes.
|
15491
|
+
* @param app
|
15492
|
+
*
|
15493
|
+
* @tutorial fdc3v2.getAppMetadata
|
15494
|
+
*/
|
15495
|
+
async getAppMetadata(app) {
|
15496
|
+
this.wire.sendAction('fdc3-get-app-metadata').catch((e) => {
|
15497
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
15498
|
+
});
|
15499
|
+
try {
|
15500
|
+
return await InteropClient_1.InteropClient.ferryFdc3Call(this.client, 'fdc3GetAppMetadata', app);
|
15501
|
+
}
|
15502
|
+
catch (error) {
|
15503
|
+
const errorToThrow = error.message === utils_1.BROKER_ERRORS.fdc3GetAppMetadata ? 'ResolverUnavailable' : error.message;
|
15504
|
+
throw new Error(errorToThrow);
|
15505
|
+
}
|
15506
|
+
}
|
15507
|
+
/**
|
15508
|
+
* Add a context handler for incoming context. If an entity is part of a context group, and then sets its context handler, it will receive all of its declared contexts. If you wish to listen for all incoming contexts, pass `null` for the contextType argument.
|
15509
|
+
* @param contextType
|
15510
|
+
* @param handler
|
15511
|
+
*
|
15512
|
+
* @tutorial fdc3.addContextListener
|
15513
|
+
*/
|
15514
|
+
// @ts-expect-error TODO [CORE-1524]
|
15515
|
+
async addContextListener(contextType, handler) {
|
15516
|
+
this.wire.sendAction('fdc3-add-context-listener').catch((e) => {
|
15517
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
15518
|
+
});
|
15519
|
+
// The FDC3 ContextHandler only expects the context and optional ContextMetadata, so we wrap the handler
|
15520
|
+
// here so it only gets passed these parameters
|
15521
|
+
const getWrappedHandler = (handlerToWrap) => {
|
15522
|
+
return (context) => {
|
15523
|
+
const { contextMetadata, ...rest } = context;
|
15524
|
+
const args = contextMetadata ? [{ ...rest }, contextMetadata] : [context, null];
|
15525
|
+
handlerToWrap(...args);
|
15526
|
+
};
|
15527
|
+
};
|
15528
|
+
let actualHandler = handler;
|
15529
|
+
let wrappedHandler = getWrappedHandler(actualHandler);
|
15530
|
+
if (typeof contextType === 'function') {
|
15531
|
+
console.warn('addContextListener(handler) has been deprecated. Please use addContextListener(null, handler)');
|
15532
|
+
actualHandler = contextType;
|
15533
|
+
wrappedHandler = getWrappedHandler(actualHandler);
|
15534
|
+
return this.client.addContextHandler(wrappedHandler);
|
15535
|
+
}
|
15536
|
+
return this.client.addContextHandler(wrappedHandler, contextType === null ? undefined : contextType);
|
15537
|
+
}
|
15538
|
+
/**
|
15539
|
+
* Find out more information about a particular intent by passing its name, and optionally its context and resultType.
|
15540
|
+
* @param intent Name of the Intent
|
15541
|
+
* @param context Context
|
15542
|
+
* @param resultType The type of result returned for any intent specified during resolution.
|
15543
|
+
*
|
15544
|
+
* @tutorial fdc3.findIntent
|
15545
|
+
*/
|
15546
|
+
async findIntent(intent, context, resultType) {
|
15547
|
+
this.wire.sendAction('fdc3-find-intent').catch((e) => {
|
15548
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
15549
|
+
});
|
15550
|
+
try {
|
15551
|
+
return await this.client.getInfoForIntent({ name: intent, context, metadata: { resultType } });
|
15552
|
+
}
|
15553
|
+
catch (error) {
|
15554
|
+
const errorToThrow = error.message === utils_1.BROKER_ERRORS.getInfoForIntent ? 'ResolverUnavailable' : error.message;
|
15555
|
+
throw new Error(errorToThrow);
|
15556
|
+
}
|
15557
|
+
}
|
15558
|
+
/**
|
15559
|
+
* Find all the available intents for a particular context.
|
15560
|
+
* @param context
|
15561
|
+
* @param resultType The type of result returned for any intent specified during resolution.
|
15562
|
+
*
|
15563
|
+
* @tutorial fdc3v2.findIntentsByContext
|
15564
|
+
*/
|
15565
|
+
async findIntentsByContext(context, resultType) {
|
15566
|
+
this.wire.sendAction('fdc3-find-intents-by-context').catch((e) => {
|
15567
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
15568
|
+
});
|
15569
|
+
const payload = resultType ? { context, metadata: { resultType } } : context;
|
15570
|
+
try {
|
15571
|
+
return await InteropClient_1.InteropClient.ferryFdc3Call(this.client, 'fdc3v2FindIntentsByContext', payload);
|
15572
|
+
}
|
15573
|
+
catch (error) {
|
15574
|
+
const errorToThrow = error.message === utils_1.BROKER_ERRORS.getInfoForIntentsByContext ? 'ResolverUnavailable' : error.message;
|
15575
|
+
throw new Error(errorToThrow);
|
15576
|
+
}
|
15577
|
+
}
|
15578
|
+
/**
|
15579
|
+
* Raises a specific intent for resolution against apps registered with the desktop agent.
|
15580
|
+
* @param intent Name of the Intent
|
15581
|
+
* @param context Context associated with the Intent
|
15582
|
+
* @param app
|
15583
|
+
*
|
15584
|
+
* @tutorial fdc3v2.raiseIntent
|
15585
|
+
*/
|
15586
|
+
async raiseIntent(intent, context, app) {
|
15587
|
+
this.wire.sendAction('fdc3-raise-intent').catch((e) => {
|
15588
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
15589
|
+
});
|
15590
|
+
try {
|
15591
|
+
if (typeof app === 'string') {
|
15592
|
+
console.warn('Passing a string as the app parameter is deprecated, please use an AppIdentifier ({ appId: string; instanceId?: string }).');
|
15593
|
+
}
|
15594
|
+
return (0, utils_2.getIntentResolution)(this.client, context, app, intent);
|
15595
|
+
}
|
15596
|
+
catch (error) {
|
15597
|
+
const errorToThrow = error.message === utils_1.BROKER_ERRORS.fireIntent ? 'ResolverUnavailable' : error.message;
|
15598
|
+
throw new Error(errorToThrow);
|
15599
|
+
}
|
15600
|
+
}
|
15601
|
+
/**
|
15602
|
+
* Finds and raises an intent against apps registered with the desktop agent based purely on the type of the context data.
|
15603
|
+
* @param context Context associated with the Intent
|
15604
|
+
* @param app
|
15605
|
+
*
|
15606
|
+
* @tutorial fdc3v2.raiseIntentForContext
|
15607
|
+
*/
|
15608
|
+
async raiseIntentForContext(context, app) {
|
15609
|
+
// TODO: We have to do the same thing we do for raiseIntent here as well.
|
15610
|
+
this.wire.sendAction('fdc3-raise-intent-for-context').catch((e) => {
|
15611
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
15612
|
+
});
|
15613
|
+
try {
|
15614
|
+
if (typeof app === 'string') {
|
15615
|
+
console.warn('Passing a string as the app parameter is deprecated, please use an AppIdentifier ({ appId: string; instanceId?: string }).');
|
15616
|
+
}
|
15617
|
+
return (0, utils_2.getIntentResolution)(this.client, context, app);
|
15618
|
+
}
|
15619
|
+
catch (error) {
|
15620
|
+
const errorToThrow = error.message === utils_1.BROKER_ERRORS.fireIntent ? 'ResolverUnavailable' : error.message;
|
15621
|
+
throw new Error(errorToThrow);
|
15622
|
+
}
|
15623
|
+
}
|
15624
|
+
/**
|
15625
|
+
* Adds a listener for incoming intents.
|
15626
|
+
* @param intent Name of the Intent
|
15627
|
+
* @param handler A callback that handles a context event and may return a promise of a Context or Channel object to be returned to the application that raised the intent.
|
15628
|
+
*
|
15629
|
+
* @tutorial fdc3.addIntentListener
|
15630
|
+
*/
|
15631
|
+
async addIntentListener(intent, handler) {
|
15632
|
+
this.wire.sendAction('fdc3-add-intent-listener').catch((e) => {
|
15633
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
15634
|
+
});
|
15635
|
+
if (typeof intent !== 'string') {
|
15636
|
+
throw new Error('First argument must be an Intent name');
|
15637
|
+
}
|
15638
|
+
// The FDC3 Intenter handler only expects the context and contextMetadata to be passed to the handler,
|
15639
|
+
// so we wrap it here and only pass those paramaters.
|
15640
|
+
const contextHandler = async (raisedIntent) => {
|
15641
|
+
let intentResult;
|
15642
|
+
let intentResultToSend;
|
15643
|
+
const { context, metadata: intentMetadata } = raisedIntent;
|
15644
|
+
const { contextMetadata, metadata, ...rest } = context;
|
15645
|
+
const intentResolutionResultId = intentMetadata?.intentResolutionResultId || metadata?.intentResolutionResultId;
|
15646
|
+
try {
|
15647
|
+
const newContext = metadata ? { metadata, ...rest } : { ...rest };
|
15648
|
+
intentResult = await handler(newContext, contextMetadata);
|
15649
|
+
intentResultToSend = intentResult;
|
15650
|
+
}
|
15651
|
+
catch (error) {
|
15652
|
+
intentResult = error;
|
15653
|
+
intentResultToSend = { error: true };
|
15654
|
+
}
|
15655
|
+
if (intentResolutionResultId) {
|
15656
|
+
this.fin.InterApplicationBus.publish(intentResolutionResultId, intentResultToSend).catch(() => null);
|
15657
|
+
}
|
15658
|
+
if (intentResult instanceof Error) {
|
15659
|
+
throw new Error(intentResult.message);
|
15660
|
+
}
|
15661
|
+
return intentResult;
|
15662
|
+
};
|
15663
|
+
return this.client.registerIntentHandler(contextHandler, intent, { fdc3Version: '2.0' });
|
15664
|
+
}
|
15665
|
+
/**
|
15666
|
+
* Returns a Channel object for the specified channel, creating it as an App Channel if it does not exist.
|
15667
|
+
* @param channelId
|
15668
|
+
*
|
15669
|
+
* @tutorial fdc3.getOrCreateChannel
|
15670
|
+
*/
|
15671
|
+
async getOrCreateChannel(channelId) {
|
15672
|
+
return super.getOrCreateChannel(channelId);
|
15673
|
+
}
|
15674
|
+
/**
|
15675
|
+
* 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.
|
15676
|
+
*
|
15677
|
+
* @tutorial fdc3v2.createPrivateChannel
|
15678
|
+
*/
|
15679
|
+
async createPrivateChannel() {
|
15680
|
+
const channelId = (0, utils_1.generateId)();
|
15681
|
+
await InteropClient_1.InteropClient.ferryFdc3Call(this.client, 'createPrivateChannelProvider', { channelId });
|
15682
|
+
const channelClient = await this.fin.InterApplicationBus.Channel.connect(channelId);
|
15683
|
+
const newPrivateChannelClient = new PrivateChannelClient_1.PrivateChannelClient(channelClient, channelId);
|
15684
|
+
return (0, utils_2.buildPrivateChannelObject)(newPrivateChannelClient);
|
15685
|
+
}
|
15686
|
+
/**
|
15687
|
+
* Retrieves a list of the User Channels available for the app to join.
|
15688
|
+
*
|
15689
|
+
* @tutorial fdc3v2.getUserChannels
|
15690
|
+
*/
|
15691
|
+
async getUserChannels() {
|
15692
|
+
const channels = await this.client.getContextGroups();
|
15693
|
+
// fdc3 implementation of getUserChannels returns on array of channels, have to decorate over
|
15694
|
+
// this so people know that these APIs are not supported
|
15695
|
+
return channels.map((channel) => {
|
15696
|
+
// @ts-expect-error TODO [CORE-1524]
|
15697
|
+
return { ...channel, type: 'user', ...(0, utils_2.getUnsupportedChannelApis)('User') };
|
15698
|
+
});
|
15699
|
+
}
|
15700
|
+
/**
|
15701
|
+
* Retrieves a list of the User Channels available for the app to join.
|
15702
|
+
*
|
15703
|
+
* @deprecated Please use {@link fdc3.getUserChannels fdc3.getUserChannels} instead
|
15704
|
+
* @tutorial fdc3.getSystemChannels
|
15705
|
+
*/
|
15706
|
+
async getSystemChannels() {
|
15707
|
+
console.warn('This API has been deprecated. Please use fdc3.getUserChannels instead.');
|
15708
|
+
return super.getSystemChannels();
|
15709
|
+
}
|
15710
|
+
/**
|
15711
|
+
* Join an app to a specified User channel.
|
15712
|
+
* @param channelId Channel name
|
15713
|
+
*
|
15714
|
+
* @tutorial fdc3v2.joinUserChannel
|
15715
|
+
*/
|
15716
|
+
async joinUserChannel(channelId) {
|
15717
|
+
return super.joinChannel(channelId);
|
15718
|
+
}
|
15719
|
+
/**
|
15720
|
+
* Join an app to a specified User channel.
|
15721
|
+
* @param channelId Channel name
|
15722
|
+
* @deprecated Please use {@link fdc3.joinUserChannel fdc3.joinUserChannel} instead
|
15723
|
+
*
|
15724
|
+
* @tutorial fdc3.joinChannel
|
15725
|
+
*/
|
15726
|
+
async joinChannel(channelId) {
|
15727
|
+
console.warn('This API has been deprecated. Please use fdc3.joinUserChannel instead.');
|
15728
|
+
return super.joinChannel(channelId);
|
15729
|
+
}
|
15730
|
+
/**
|
15731
|
+
* Returns the Channel object for the current User channel membership
|
15732
|
+
*
|
15733
|
+
* @tutorial fdc3.getCurrentChannel
|
15734
|
+
*/
|
15735
|
+
async getCurrentChannel() {
|
15736
|
+
const currentChannel = await super.getCurrentChannel();
|
15737
|
+
if (!currentChannel) {
|
15738
|
+
return null;
|
15739
|
+
}
|
15740
|
+
return {
|
15741
|
+
...currentChannel,
|
15742
|
+
type: 'user',
|
15743
|
+
broadcast: this.broadcast.bind(this)
|
15744
|
+
};
|
15745
|
+
}
|
15746
|
+
/**
|
15747
|
+
* Retrieves information about the FDC3 implementation, including the supported version of the FDC3 specification, the name of the provider of the implementation, its own version number, details of whether optional API features are implemented and the metadata of the calling application according to the desktop agent.
|
15748
|
+
* fdc3HandleGetInfo must be overridden in the InteropBroker so that the ImplementationMetadata will have the appMetadata info.
|
15749
|
+
*
|
15750
|
+
* @tutorial fdc3v2.getInfo
|
15751
|
+
*/
|
15752
|
+
async getInfo() {
|
15753
|
+
return InteropClient_1.InteropClient.ferryFdc3Call(this.client, 'fdc3v2GetInfo', { fdc3Version: '2.0' });
|
15754
|
+
}
|
15755
|
+
}
|
15756
|
+
fdc32_0.Fdc3Module2 = Fdc3Module2;
|
15757
|
+
return fdc32_0;
|
15758
|
+
}
|
15759
|
+
|
15760
|
+
var hasRequiredInteropClient;
|
15761
|
+
|
15762
|
+
function requireInteropClient () {
|
15763
|
+
if (hasRequiredInteropClient) return InteropClient;
|
15764
|
+
hasRequiredInteropClient = 1;
|
15765
|
+
var __classPrivateFieldSet = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
15766
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
15767
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
15768
|
+
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");
|
15769
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
15770
|
+
};
|
15771
|
+
var __classPrivateFieldGet = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
15772
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
15773
|
+
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");
|
15774
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
15775
|
+
};
|
15776
|
+
var _InteropClient_clientPromise, _InteropClient_sessionContextGroups;
|
15777
|
+
Object.defineProperty(InteropClient, "__esModule", { value: true });
|
15778
|
+
InteropClient.InteropClient = void 0;
|
15779
|
+
const base_1 = base;
|
15780
|
+
const SessionContextGroupClient_1 = SessionContextGroupClient$1;
|
15781
|
+
const fdc3_1_2_1 = requireFdc31_2();
|
15782
|
+
const fdc3_2_0_1 = requireFdc32_0();
|
15783
|
+
const utils_1 = utils$3;
|
15784
|
+
/**
|
15785
|
+
* The Interop Client API is broken up into two groups:
|
15786
|
+
*
|
15787
|
+
* **Content Facing APIs** - For Application Developers putting Views into a Platform Window, who care about Context. These are APIs that send out and receive the Context data that flows between applications. Think of this as the Water in the Interop Pipes.
|
15788
|
+
*
|
15789
|
+
* **Context Grouping APIs** - For Platform Developers, to add and remove Views to and from Context Groups. These APIs are utilized under-the-hood in Platforms, so they don't need to be used to participate in Interop. These are the APIs that decide which entities the context data flows between. Think of these as the valves or pipes that control the flow of Context Data for Interop.
|
15790
|
+
*
|
15791
|
+
* ---
|
15792
|
+
*
|
15793
|
+
* All APIs are available at the `fin.me.interop` namespace.
|
15794
|
+
*
|
15795
|
+
* ---
|
15796
|
+
*
|
15797
|
+
* **You only need 2 things to participate in Interop Context Grouping:**
|
15798
|
+
* * A Context Handler for incoming context: {@link InteropClient#addContextHandler addContextHandler(handler, contextType?)}
|
15799
|
+
* * Call setContext on your context group when you want to share context with other group members: {@link InteropClient#setContext setContext(context)}
|
15800
|
+
*
|
15801
|
+
* ---
|
15802
|
+
*
|
15803
|
+
* ##### Constructor
|
15804
|
+
* Returned by {@link Interop.connectSync Interop.connectSync}.
|
15805
|
+
*
|
15806
|
+
* ---
|
15807
|
+
*
|
15808
|
+
* ##### Interop methods intended for Views
|
15809
|
+
*
|
15810
|
+
*
|
15811
|
+
* **Context Groups API**
|
15812
|
+
* * {@link InteropClient#addContextHandler addContextHandler(handler, contextType?)}
|
15813
|
+
* * {@link InteropClient#setContext setContext(context)}
|
15814
|
+
* * {@link InteropClient#getCurrentContext getCurrentContext(contextType?)}
|
15815
|
+
* * {@link InteropClient#joinSessionContextGroup joinSessionContextGroup(sessionContextGroupId)}
|
15816
|
+
*
|
15817
|
+
*
|
15818
|
+
* **Intents API**
|
15819
|
+
* * {@link InteropClient#fireIntent fireIntent(intent)}
|
15820
|
+
* * {@link InteropClient#registerIntentHandler registerIntentHandler(intentHandler, intentName)}
|
15821
|
+
* * {@link InteropClient#getInfoForIntent getInfoForIntent(infoForIntentOptions)}
|
15822
|
+
* * {@link InteropClient#getInfoForIntentsByContext getInfoForIntentsByContext(context)}
|
15823
|
+
* * {@link InteropClient#fireIntentForContext fireIntentForContext(contextForIntent)}
|
15824
|
+
*
|
15825
|
+
* ##### Interop methods intended for Windows
|
15826
|
+
* * {@link InteropClient#getContextGroups getContextGroups()}
|
15827
|
+
* * {@link InteropClient#joinContextGroup joinContextGroup(contextGroupId, target?)}
|
15828
|
+
* * {@link InteropClient#removeFromContextGroup removeFromContextGroup(target?)}
|
15829
|
+
* * {@link InteropClient#getInfoForContextGroup getInfoForContextGroup(contextGroupId)}
|
15830
|
+
* * {@link InteropClient#getAllClientsInContextGroup getAllClientsInContextGroup(contextGroupId)}
|
15831
|
+
*
|
15832
|
+
*/
|
15833
|
+
let InteropClient$1 = class InteropClient extends base_1.Base {
|
15834
|
+
/**
|
15835
|
+
* @internal
|
15836
|
+
*/
|
15837
|
+
constructor(wire, clientPromise) {
|
15838
|
+
super(wire);
|
15839
|
+
_InteropClient_clientPromise.set(this, void 0);
|
15840
|
+
_InteropClient_sessionContextGroups.set(this, void 0);
|
15841
|
+
__classPrivateFieldSet(this, _InteropClient_sessionContextGroups, new Map(), "f");
|
15842
|
+
__classPrivateFieldSet(this, _InteropClient_clientPromise, clientPromise, "f");
|
15843
|
+
}
|
15844
|
+
/*
|
15845
|
+
Client APIs
|
15846
|
+
*/
|
15847
|
+
/**
|
15848
|
+
* Sets a context for the context group of the current entity.
|
15849
|
+
*
|
15850
|
+
* @remarks The entity must be part of a context group in order set a context.
|
15851
|
+
*
|
15852
|
+
* @param context - New context to set.
|
15853
|
+
*
|
15854
|
+
* @example
|
15855
|
+
* ```js
|
15856
|
+
* setInstrumentContext = async (ticker) => {
|
15857
|
+
* fin.me.interop.setContext({type: 'instrument', id: {ticker}})
|
15858
|
+
* }
|
15859
|
+
*
|
15860
|
+
* // The user clicks an instrument of interest. We want to set that Instrument context so that the rest of our workflow updates with information for that instrument
|
15861
|
+
* instrumentElement.on('click', (evt) => {
|
15862
|
+
* setInstrumentContext(evt.ticker)
|
15863
|
+
* })
|
15864
|
+
* ```
|
15865
|
+
*/
|
15866
|
+
async setContext(context) {
|
15867
|
+
this.wire.sendAction('interop-client-set-context').catch((e) => {
|
15868
|
+
// don't expose, analytics-only call
|
15869
|
+
});
|
15870
|
+
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
15871
|
+
return client.dispatch('setContext', { context });
|
15872
|
+
}
|
15873
|
+
/**
|
15874
|
+
* Add a context handler for incoming context. If an entity is part of a context group, and then sets its context handler,
|
15875
|
+
* it will receive all of its declared contexts.
|
15876
|
+
*
|
15877
|
+
* @param handler - Handler for incoming context.
|
15878
|
+
* @param contextType - The type of context you wish to handle.
|
15879
|
+
*
|
15880
|
+
* @example
|
15881
|
+
* ```js
|
15882
|
+
* function handleIncomingContext(contextInfo) {
|
15883
|
+
* const { type, id } = contextInfo;
|
15884
|
+
* switch (type) {
|
15885
|
+
* case 'instrument':
|
15886
|
+
* handleInstrumentContext(contextInfo);
|
15887
|
+
* break;
|
15888
|
+
* case 'country':
|
15889
|
+
* handleCountryContext(contextInfo);
|
15890
|
+
* break;
|
15891
|
+
*
|
15892
|
+
* default:
|
15893
|
+
* break;
|
15894
|
+
* }
|
15895
|
+
* }
|
15896
|
+
*
|
15897
|
+
*
|
15898
|
+
* function handleInstrumentContext(contextInfo) {
|
15899
|
+
* const { type, id } = contextInfo;
|
15900
|
+
* console.log('contextInfo for instrument', contextInfo)
|
15901
|
+
* }
|
15902
|
+
*
|
15903
|
+
* function handleCountryContext(contextInfo) {
|
15904
|
+
* const { type, id } = contextInfo;
|
15905
|
+
* console.log('contextInfo for country', contextInfo)
|
15906
|
+
* }
|
15907
|
+
*
|
15908
|
+
* fin.me.interop.addContextHandler(handleIncomingContext);
|
15909
|
+
* ```
|
15910
|
+
*
|
15911
|
+
*
|
15912
|
+
* We are also testing the ability to add a context handler for specific contexts. If you would like to use
|
15913
|
+
* this, please make sure you add your context handlers at the top level of your application, on a page that
|
15914
|
+
* does not navigate/reload/re-render, to avoid memory leaks. This feature is experimental:
|
15915
|
+
*
|
15916
|
+
* ```js
|
15917
|
+
* function handleInstrumentContext(contextInfo) {
|
15918
|
+
* const { type, id } = contextInfo;
|
15919
|
+
* console.log('contextInfo for instrument', contextInfo)
|
15920
|
+
* }
|
15921
|
+
*
|
15922
|
+
* function handleCountryContext(contextInfo) {
|
15923
|
+
* const { type, id } = contextInfo;
|
15924
|
+
* console.log('contextInfo for country', contextInfo)
|
15925
|
+
* }
|
15926
|
+
*
|
15927
|
+
*
|
15928
|
+
* fin.me.interop.addContextHandler(handleInstrumentContext, 'instrument')
|
15929
|
+
* fin.me.interop.addContextHandler(handleCountryContext, 'country')
|
15930
|
+
* ```
|
15931
|
+
*/
|
15932
|
+
async addContextHandler(handler, contextType) {
|
15933
|
+
this.wire.sendAction('interop-client-add-context-handler').catch((e) => {
|
15934
|
+
// don't expose, analytics-only call
|
15935
|
+
});
|
15936
|
+
if (typeof handler !== 'function') {
|
15937
|
+
throw new Error("Non-function argument passed to the first parameter 'handler'. Be aware that the argument order does not match the FDC3 standard.");
|
15938
|
+
}
|
15939
|
+
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
15940
|
+
let handlerId;
|
15941
|
+
if (contextType) {
|
15942
|
+
handlerId = `invokeContextHandler-${contextType}-${(0, utils_1.generateId)()}`;
|
15943
|
+
console.warn(`Warning: By providing a contextType (${contextType}), you are using the experimental addContextHandler. To avoid issues, make sure you are adding your context handlers at the top level in your application.`);
|
15944
|
+
}
|
15945
|
+
else {
|
15946
|
+
handlerId = 'invokeContextHandler';
|
15947
|
+
}
|
15948
|
+
const wrappedHandler = (0, utils_1.wrapContextHandler)(handler, handlerId);
|
15949
|
+
client.register(handlerId, wrappedHandler);
|
15950
|
+
await client.dispatch('contextHandlerRegistered', { handlerId, contextType });
|
15951
|
+
return {
|
15952
|
+
unsubscribe: async () => {
|
15953
|
+
client.remove(handlerId);
|
15954
|
+
await client.dispatch('removeContextHandler', { handlerId });
|
15955
|
+
}
|
15956
|
+
};
|
15957
|
+
}
|
15958
|
+
/*
|
15959
|
+
Platform Window APIs
|
15960
|
+
*/
|
15961
|
+
/**
|
15962
|
+
* Returns the Interop-Broker-defined context groups available for an entity to join.
|
15963
|
+
* Used by Platform Windows.
|
15964
|
+
*
|
15965
|
+
* @example
|
15966
|
+
* ```js
|
15967
|
+
* fin.me.interop.getContextGroups()
|
15968
|
+
* .then(contextGroups => {
|
15969
|
+
* contextGroups.forEach(contextGroup => {
|
15970
|
+
* console.log(contextGroup.displayMetadata.name)
|
15971
|
+
* console.log(contextGroup.displayMetadata.color)
|
15972
|
+
* })
|
15973
|
+
* })
|
15974
|
+
* ```
|
15975
|
+
*/
|
15976
|
+
async getContextGroups() {
|
15977
|
+
this.wire.sendAction('interop-client-get-context-groups').catch((e) => {
|
15978
|
+
// don't expose, analytics-only call
|
15979
|
+
});
|
15980
|
+
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
15981
|
+
return client.dispatch('getContextGroups');
|
15982
|
+
}
|
15983
|
+
/**
|
15984
|
+
* Join all Interop Clients at the given identity to context group `contextGroupId`.
|
15985
|
+
* If no target is specified, it adds the sender to the context group.
|
15986
|
+
*
|
15987
|
+
* @remarks Because multiple Channel connections/Interop Clients can potentially exist at a `uuid`/`name` combo, we currently join all Channel connections/Interop Clients at the given identity to the context group.
|
15988
|
+
* If an `endpointId` is provided (which is unlikely, unless the call is coming from an external adapter), then we only join that single connection to the context group.
|
15989
|
+
* For all intents and purposes, there will only be 1 connection present in Platform and Browser implmentations, so this point is more-or-less moot.
|
15990
|
+
* Used by Platform Windows.
|
15991
|
+
*
|
15992
|
+
* @param contextGroupId - Id of the context group.
|
15993
|
+
* @param target - Identity of the entity you wish to join to a context group.
|
15994
|
+
*
|
15995
|
+
* @example
|
15996
|
+
* ```js
|
15997
|
+
* joinViewToContextGroup = async (contextGroupId, view) => {
|
15998
|
+
* await fin.me.interop.joinContextGroup(contextGroupId, view);
|
15999
|
+
* }
|
16000
|
+
*
|
16001
|
+
* getLastFocusedView()
|
16002
|
+
* .then(lastFocusedViewIdentity => {
|
16003
|
+
* joinViewToContextGroup('red', lastFocusedViewIdentity)
|
16004
|
+
* })
|
16005
|
+
* ```
|
16006
|
+
*/
|
16007
|
+
async joinContextGroup(contextGroupId, target) {
|
16008
|
+
this.wire.sendAction('interop-client-join-context-group').catch((e) => {
|
16009
|
+
// don't expose, analytics-only call
|
16010
|
+
});
|
16011
|
+
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
16012
|
+
if (!contextGroupId) {
|
16013
|
+
throw new Error('No contextGroupId specified for joinContextGroup.');
|
16014
|
+
}
|
16015
|
+
return client.dispatch('joinContextGroup', { contextGroupId, target });
|
16016
|
+
}
|
16017
|
+
/**
|
16018
|
+
* Removes the specified target from a context group.
|
16019
|
+
* If no target is specified, it removes the sender from their context group.
|
16020
|
+
* Used by Platform Windows.
|
16021
|
+
*
|
16022
|
+
* @param target - Identity of the entity you wish to join to a context group.
|
16023
|
+
*
|
16024
|
+
* @example
|
16025
|
+
* ```js
|
16026
|
+
* removeViewFromContextGroup = async (view) => {
|
16027
|
+
* await fin.me.interop.removeFromContextGroup(view);
|
16028
|
+
* }
|
16029
|
+
*
|
16030
|
+
* getLastFocusedView()
|
16031
|
+
* .then(lastFocusedViewIdentity => {
|
16032
|
+
* removeViewFromContextGroup(lastFocusedViewIdentity)
|
16033
|
+
* })
|
16034
|
+
* ```
|
16035
|
+
*/
|
16036
|
+
async removeFromContextGroup(target) {
|
16037
|
+
this.wire.sendAction('interop-client-remove-from-context-group').catch((e) => {
|
16038
|
+
// don't expose, analytics-only call
|
16039
|
+
});
|
16040
|
+
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
16041
|
+
return client.dispatch('removeFromContextGroup', { target });
|
16042
|
+
}
|
16043
|
+
/**
|
16044
|
+
* Gets all clients for a context group.
|
16045
|
+
*
|
16046
|
+
* @remarks **This is primarily used for platform windows. Views within a platform should not have to use this API.**
|
16047
|
+
*
|
16048
|
+
* Returns the Interop-Broker-defined context groups available for an entity to join.
|
16049
|
+
* @param contextGroupId - The id of context group you wish to get clients for.
|
16050
|
+
*
|
16051
|
+
* @example
|
16052
|
+
* ```js
|
16053
|
+
* fin.me.interop.getAllClientsInContextGroup('red')
|
16054
|
+
* .then(clientsInContextGroup => {
|
16055
|
+
* console.log(clientsInContextGroup)
|
16056
|
+
* })
|
16057
|
+
* ```
|
16058
|
+
*/
|
16059
|
+
async getAllClientsInContextGroup(contextGroupId) {
|
16060
|
+
this.wire.sendAction('interop-client-get-all-clients-in-context-group').catch((e) => {
|
16061
|
+
// don't expose, analytics-only call
|
16062
|
+
});
|
16063
|
+
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
16064
|
+
if (!contextGroupId) {
|
16065
|
+
throw new Error('No contextGroupId specified for getAllClientsInContextGroup.');
|
16066
|
+
}
|
16067
|
+
return client.dispatch('getAllClientsInContextGroup', { contextGroupId });
|
16068
|
+
}
|
16069
|
+
/**
|
16070
|
+
* Gets display info for a context group
|
16071
|
+
*
|
16072
|
+
* @remarks Used by Platform Windows.
|
16073
|
+
* @param contextGroupId - The id of context group you wish to get display info for.
|
16074
|
+
*
|
16075
|
+
* @example
|
16076
|
+
* ```js
|
16077
|
+
* fin.me.interop.getInfoForContextGroup('red')
|
16078
|
+
* .then(contextGroupInfo => {
|
16079
|
+
* console.log(contextGroupInfo.displayMetadata.name)
|
16080
|
+
* console.log(contextGroupInfo.displayMetadata.color)
|
16081
|
+
* })
|
16082
|
+
* ```
|
16083
|
+
*/
|
16084
|
+
async getInfoForContextGroup(contextGroupId) {
|
16085
|
+
this.wire.sendAction('interop-client-get-info-for-context-group').catch((e) => {
|
16086
|
+
// don't expose, analytics-only call
|
16087
|
+
});
|
16088
|
+
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
16089
|
+
if (!contextGroupId) {
|
16090
|
+
throw new Error('No contextGroupId specified for getInfoForContextGroup.');
|
16091
|
+
}
|
16092
|
+
return client.dispatch('getInfoForContextGroup', { contextGroupId });
|
16093
|
+
}
|
16094
|
+
/**
|
16095
|
+
* Sends an intent to the Interop Broker to resolve.
|
16096
|
+
* @param intent - The combination of an action and a context that is passed to an application for resolution.
|
16097
|
+
*
|
16098
|
+
* @example
|
16099
|
+
* ```js
|
16100
|
+
* // View wants to fire an Intent after a user clicks on a ticker
|
16101
|
+
* tickerElement.on('click', (element) => {
|
16102
|
+
* const ticker = element.innerText;
|
16103
|
+
* const intent = {
|
16104
|
+
* name: 'ViewChart',
|
16105
|
+
* context: {type: 'fdc3.instrument', id: { ticker }}
|
16106
|
+
* }
|
16107
|
+
*
|
16108
|
+
* fin.me.interop.fireIntent(intent);
|
16109
|
+
* })
|
16110
|
+
* ```
|
16111
|
+
*/
|
16112
|
+
async fireIntent(intent) {
|
16113
|
+
this.wire.sendAction('interop-client-fire-intent').catch((e) => {
|
16114
|
+
// don't expose, this is only for api analytics purposes
|
16115
|
+
});
|
16116
|
+
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
16117
|
+
return client.dispatch('fireIntent', intent);
|
16118
|
+
}
|
16119
|
+
/**
|
16120
|
+
* Adds an intent handler for incoming intents. The last intent sent of the name subscribed to will be received.
|
16121
|
+
* @param handler - Registered function meant to handle a specific intent type.
|
16122
|
+
* @param intentName - The name of an intent.
|
16123
|
+
*
|
16124
|
+
* @example
|
16125
|
+
* ```js
|
16126
|
+
* const intentHandler = (intent) => {
|
16127
|
+
* const { context } = intent;
|
16128
|
+
* myViewChartHandler(context);
|
16129
|
+
* };
|
16130
|
+
*
|
16131
|
+
* const subscription = await fin.me.interop.registerIntentHandler(intentHandler, 'ViewChart');
|
16132
|
+
*
|
16133
|
+
* function myAppCloseSequence() {
|
16134
|
+
* // to unsubscribe the handler, simply call:
|
16135
|
+
* subscription.unsubscribe();
|
16136
|
+
* }
|
16137
|
+
* ```
|
16138
|
+
*/
|
16139
|
+
async registerIntentHandler(handler, intentName, options) {
|
16140
|
+
this.wire.sendAction('interop-client-register-intent-handler').catch((e) => {
|
16141
|
+
// don't expose, this is only for api analytics purposes
|
16142
|
+
});
|
16143
|
+
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
16144
|
+
const handlerId = `intent-handler-${intentName}`;
|
16145
|
+
const wrappedHandler = (0, utils_1.wrapIntentHandler)(handler, handlerId);
|
16146
|
+
try {
|
16147
|
+
await client.register(handlerId, wrappedHandler);
|
16148
|
+
await client.dispatch('intentHandlerRegistered', { handlerId, ...options });
|
16149
|
+
}
|
16150
|
+
catch (error) {
|
16151
|
+
throw new Error('Unable to register intent handler');
|
16152
|
+
}
|
16153
|
+
return {
|
16154
|
+
unsubscribe: async () => {
|
16155
|
+
client.remove(handlerId);
|
16156
|
+
}
|
16157
|
+
};
|
16158
|
+
}
|
16159
|
+
/**
|
16160
|
+
* Gets the last context of the Context Group currently subscribed to. It takes an optional Context Type and returns the
|
16161
|
+
* last context of that type.
|
16162
|
+
* @param contextType
|
16163
|
+
*
|
16164
|
+
* @example
|
16165
|
+
* ```js
|
16166
|
+
* await fin.me.interop.joinContextGroup('yellow');
|
16167
|
+
* await fin.me.interop.setContext({ type: 'instrument', id: { ticker: 'FOO' }});
|
16168
|
+
* const currentContext = await fin.me.interop.getCurrentContext();
|
16169
|
+
*
|
16170
|
+
* // with a specific context
|
16171
|
+
* await fin.me.interop.joinContextGroup('yellow');
|
16172
|
+
* await fin.me.interop.setContext({ type: 'country', id: { ISOALPHA3: 'US' }});
|
16173
|
+
* await fin.me.interop.setContext({ type: 'instrument', id: { ticker: 'FOO' }});
|
16174
|
+
* const currentContext = await fin.me.interop.getCurrentContext('country');
|
16175
|
+
* ```
|
16176
|
+
*/
|
16177
|
+
async getCurrentContext(contextType) {
|
16178
|
+
this.wire.sendAction('interop-client-get-current-context').catch((e) => {
|
16179
|
+
// don't expose, analytics-only call
|
16180
|
+
});
|
16181
|
+
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
16182
|
+
return client.dispatch('getCurrentContext', { contextType });
|
16183
|
+
}
|
16184
|
+
/**
|
16185
|
+
* Get information for a particular Intent from the Interop Broker.
|
16186
|
+
*
|
16187
|
+
* @remarks To resolve this info, the function handleInfoForIntent is meant to be overridden in the Interop Broker.
|
16188
|
+
* The format for the response will be determined by the App Provider overriding the function.
|
16189
|
+
*
|
16190
|
+
* @param options
|
16191
|
+
*
|
16192
|
+
* @example
|
16193
|
+
* ```js
|
16194
|
+
* const intentInfo = await fin.me.interop.getInfoForIntent('ViewChart');
|
16195
|
+
* ```
|
16196
|
+
*/
|
16197
|
+
async getInfoForIntent(options) {
|
16198
|
+
this.wire.sendAction('interop-client-get-info-for-intent').catch((e) => {
|
16199
|
+
// don't expose, analytics-only call
|
16200
|
+
});
|
16201
|
+
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
16202
|
+
return client.dispatch('getInfoForIntent', options);
|
16203
|
+
}
|
16204
|
+
/**
|
16205
|
+
* Get information from the Interop Broker on all Intents that are meant to handle a particular context.
|
16206
|
+
*
|
16207
|
+
* @remarks To resolve this info, the function handleInfoForIntentsByContext is meant to be overridden in the Interop Broker.
|
16208
|
+
* The format for the response will be determined by the App Provider overriding the function.
|
16209
|
+
*
|
16210
|
+
* @param context
|
16211
|
+
*
|
16212
|
+
* @example
|
16213
|
+
* ```js
|
16214
|
+
* tickerElement.on('click', (element) => {
|
16215
|
+
* const ticker = element.innerText;
|
16216
|
+
*
|
16217
|
+
* const context = {
|
16218
|
+
* type: 'fdc3.instrument',
|
16219
|
+
* id: {
|
16220
|
+
* ticker
|
16221
|
+
* }
|
16222
|
+
* }
|
16223
|
+
*
|
16224
|
+
* const intentsInfo = await fin.me.interop.getInfoForIntentByContext(context);
|
16225
|
+
* })
|
16226
|
+
* ```
|
16227
|
+
*/
|
16228
|
+
async getInfoForIntentsByContext(context) {
|
16229
|
+
this.wire.sendAction('interop-client-get-info-for-intents-by-context').catch((e) => {
|
16230
|
+
// don't expose, analytics-only call
|
16231
|
+
});
|
16232
|
+
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
16233
|
+
return client.dispatch('getInfoForIntentsByContext', context);
|
16234
|
+
}
|
16235
|
+
/**
|
16236
|
+
* Sends a Context that will be resolved to an Intent by the Interop Broker.
|
16237
|
+
* This context accepts a metadata property.
|
16238
|
+
*
|
16239
|
+
* @remarks To resolve this info, the function handleFiredIntentByContext is meant to be overridden in the Interop Broker.
|
16240
|
+
* The format for the response will be determined by the App Provider overriding the function.
|
16241
|
+
*
|
16242
|
+
* @param context
|
16243
|
+
*
|
16244
|
+
* @example
|
16245
|
+
* ```js
|
16246
|
+
* tickerElement.on('click', (element) => {
|
16247
|
+
* const ticker = element.innerText;
|
16248
|
+
*
|
16249
|
+
* const context = {
|
16250
|
+
* type: 'fdc3.instrument',
|
16251
|
+
* id: {
|
16252
|
+
* ticker
|
16253
|
+
* }
|
16254
|
+
* }
|
16255
|
+
*
|
16256
|
+
* const intentResolution = await fin.me.interop.fireIntentForContext(context);
|
16257
|
+
* })
|
16258
|
+
* ```
|
16259
|
+
*/
|
16260
|
+
async fireIntentForContext(context) {
|
16261
|
+
this.wire.sendAction('interop-client-fire-intent-for-context').catch((e) => {
|
16262
|
+
// don't expose, analytics-only call
|
16263
|
+
});
|
16264
|
+
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
16265
|
+
return client.dispatch('fireIntentForContext', context);
|
16266
|
+
}
|
16267
|
+
/**
|
16268
|
+
* Join the current entity to session context group `sessionContextGroupId` and return a sessionContextGroup instance.
|
16269
|
+
* If the sessionContextGroup doesn't exist, one will get created.
|
16270
|
+
*
|
16271
|
+
* @remarks Session Context Groups do not persist between runs and aren't present on snapshots.
|
16272
|
+
* @param sessionContextGroupId - Id of the context group.
|
16273
|
+
*
|
16274
|
+
* @example
|
16275
|
+
* Say we want to have a Session Context Group that holds UI theme information for all apps to consume:
|
16276
|
+
*
|
16277
|
+
* My color-picker View:
|
16278
|
+
* ```js
|
16279
|
+
* const themeSessionContextGroup = await fin.me.interop.joinSessionContextGroup('theme');
|
16280
|
+
*
|
16281
|
+
* const myColorPickerElement = document.getElementById('color-palette-picker');
|
16282
|
+
* myColorPickerElement.addEventListener('change', event => {
|
16283
|
+
* themeSessionContextGroup.setContext({ type: 'color-palette', selection: event.value });
|
16284
|
+
* });
|
16285
|
+
* ```
|
16286
|
+
*
|
16287
|
+
* In other views:
|
16288
|
+
* ```js
|
16289
|
+
* const themeSessionContextGroup = await fin.me.interop.joinSessionContextGroup('theme');
|
16290
|
+
*
|
16291
|
+
* const changeColorPalette = ({ selection }) => {
|
16292
|
+
* // change the color palette to the selection
|
16293
|
+
* };
|
16294
|
+
*
|
16295
|
+
* // If the context is already set by the time the handler was set, the handler will get invoked immediately with the current context.
|
16296
|
+
* themeSessionContextGroup.addContextHandler(changeColorPalette, 'color-palette');
|
16297
|
+
* ```
|
16298
|
+
*/
|
16299
|
+
async joinSessionContextGroup(sessionContextGroupId) {
|
16300
|
+
try {
|
16301
|
+
const currentSessionContextGroup = __classPrivateFieldGet(this, _InteropClient_sessionContextGroups, "f").get(sessionContextGroupId);
|
16302
|
+
if (currentSessionContextGroup) {
|
16303
|
+
return currentSessionContextGroup.getUserInstance();
|
16304
|
+
}
|
16305
|
+
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
16306
|
+
const { hasConflict } = await client.dispatch('sessionContextGroup:createIfNeeded', {
|
16307
|
+
sessionContextGroupId
|
16308
|
+
});
|
16309
|
+
if (hasConflict) {
|
16310
|
+
console.warn(`A (non-session) context group with the name "${sessionContextGroupId}" already exists. If you are trying to join a Context Group, call joinContextGroup instead.`);
|
16311
|
+
}
|
16312
|
+
const newSessionContextGroup = new SessionContextGroupClient_1.default(this.wire, __classPrivateFieldGet(this, _InteropClient_clientPromise, "f"), sessionContextGroupId);
|
16313
|
+
__classPrivateFieldGet(this, _InteropClient_sessionContextGroups, "f").set(sessionContextGroupId, newSessionContextGroup);
|
16314
|
+
return newSessionContextGroup.getUserInstance();
|
16315
|
+
}
|
16316
|
+
catch (error) {
|
16317
|
+
console.error(`Error thrown trying to create Session Context Group with id "${sessionContextGroupId}": ${error}`);
|
16318
|
+
throw error;
|
16319
|
+
}
|
16320
|
+
}
|
16321
|
+
/**
|
16322
|
+
* Register a listener that is called when the Interop Client has been disconnected from the Interop Broker.
|
16323
|
+
* Only one listener per Interop Client can be set.
|
16324
|
+
* @param listener
|
16325
|
+
*
|
16326
|
+
* @example
|
16327
|
+
* ```js
|
16328
|
+
* const listener = (event) => {
|
16329
|
+
* const { type, topic, brokerName} = event;
|
16330
|
+
* console.log(`Disconnected from Interop Broker ${brokerName} `);
|
16331
|
+
* }
|
16332
|
+
*
|
16333
|
+
* await fin.me.interop.onDisconnection(listener);
|
16334
|
+
* ```
|
16335
|
+
*/
|
16336
|
+
async onDisconnection(listener) {
|
16337
|
+
this.wire.sendAction('interop-client-add-ondisconnection-listener').catch((e) => {
|
16338
|
+
// don't expose, analytics-only call
|
16339
|
+
});
|
16340
|
+
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
16341
|
+
return client.onDisconnection((event) => {
|
16342
|
+
const { uuid } = event;
|
16343
|
+
listener({ type: 'interop-broker', topic: 'disconnected', brokerName: uuid });
|
16344
|
+
});
|
16345
|
+
}
|
16346
|
+
getFDC3Sync(version) {
|
16347
|
+
switch (version) {
|
16348
|
+
case '1.2':
|
16349
|
+
return new fdc3_1_2_1.Fdc3Module(() => this, this.wire);
|
16350
|
+
case '2.0':
|
16351
|
+
return new fdc3_2_0_1.Fdc3Module2(() => this, this.wire);
|
16352
|
+
default:
|
16353
|
+
throw new Error(`Invalid FDC3 version provided: ${version}. Must be '1.2' or '2.0'`);
|
16354
|
+
}
|
16355
|
+
}
|
16356
|
+
async getFDC3(version) {
|
16357
|
+
return this.getFDC3Sync(version);
|
16358
|
+
}
|
16359
|
+
/**
|
16360
|
+
* @internal
|
16361
|
+
*
|
16362
|
+
* Used to ferry fdc3-only calls from the fdc3 shim to the Interop Broker
|
16363
|
+
*/
|
16364
|
+
static async ferryFdc3Call(interopClient, action, payload) {
|
16365
|
+
const client = await __classPrivateFieldGet(interopClient, _InteropClient_clientPromise, "f");
|
16366
|
+
return client.dispatch(action, payload || null);
|
16367
|
+
}
|
16368
|
+
};
|
16369
|
+
InteropClient.InteropClient = InteropClient$1;
|
16370
|
+
_InteropClient_clientPromise = new WeakMap(), _InteropClient_sessionContextGroups = new WeakMap();
|
16371
|
+
return InteropClient;
|
16372
|
+
}
|
15183
16373
|
|
15184
|
-
var
|
16374
|
+
var overrideCheck$1 = {};
|
15185
16375
|
|
15186
|
-
|
15187
|
-
|
15188
|
-
|
15189
|
-
|
15190
|
-
|
15191
|
-
|
15192
|
-
|
15193
|
-
|
15194
|
-
|
15195
|
-
|
15196
|
-
|
15197
|
-
|
15198
|
-
|
15199
|
-
|
15200
|
-
|
15201
|
-
|
15202
|
-
|
15203
|
-
|
15204
|
-
|
15205
|
-
|
15206
|
-
|
15207
|
-
|
15208
|
-
|
15209
|
-
|
15210
|
-
|
15211
|
-
|
15212
|
-
|
15213
|
-
|
15214
|
-
|
15215
|
-
|
15216
|
-
|
15217
|
-
|
15218
|
-
console.warn(`WARNING: FDC3 2.0 has been set as a default option for Views in this Platform, but the required InteropBroker APIs for FDC3 2.0 compliance have not all been overridden.\nThe following APIs need to be overridden:\n${notOverridden.join('\n')}`);
|
15219
|
-
}
|
15220
|
-
}
|
15221
|
-
}
|
15222
|
-
overrideCheck.overrideCheck = overrideCheck$1;
|
15223
|
-
return overrideCheck;
|
16376
|
+
Object.defineProperty(overrideCheck$1, "__esModule", { value: true });
|
16377
|
+
overrideCheck$1.overrideCheck = overrideCheck$1.checkFDC32Overrides = overrideCheck$1.getDefaultViewFdc3VersionFromAppInfo = void 0;
|
16378
|
+
const InteropBroker_1 = requireInteropBroker();
|
16379
|
+
function getDefaultViewFdc3VersionFromAppInfo({ manifest, initialOptions }) {
|
16380
|
+
const setVersion = manifest?.platform?.defaultViewOptions?.fdc3InteropApi ?? initialOptions.defaultViewOptions?.fdc3InteropApi;
|
16381
|
+
return ['1.2', '2.0'].includes(setVersion ?? '') ? setVersion : undefined;
|
16382
|
+
}
|
16383
|
+
overrideCheck$1.getDefaultViewFdc3VersionFromAppInfo = getDefaultViewFdc3VersionFromAppInfo;
|
16384
|
+
function checkFDC32Overrides(overriddenBroker) {
|
16385
|
+
// These are the APIs that must be overridden for FDC3 2.0 compliance
|
16386
|
+
const mustOverrideAPIs = [
|
16387
|
+
'fdc3HandleFindInstances',
|
16388
|
+
'handleInfoForIntent',
|
16389
|
+
'handleInfoForIntentsByContext',
|
16390
|
+
'fdc3HandleGetAppMetadata',
|
16391
|
+
'fdc3HandleGetInfo',
|
16392
|
+
'fdc3HandleOpen',
|
16393
|
+
'handleFiredIntent',
|
16394
|
+
'handleFiredIntentForContext'
|
16395
|
+
];
|
16396
|
+
return mustOverrideAPIs.filter((api) => {
|
16397
|
+
return overriddenBroker[api] === InteropBroker_1.InteropBroker.prototype[api];
|
16398
|
+
});
|
16399
|
+
}
|
16400
|
+
overrideCheck$1.checkFDC32Overrides = checkFDC32Overrides;
|
16401
|
+
function overrideCheck(overriddenBroker, fdc3InteropApi) {
|
16402
|
+
if (fdc3InteropApi && fdc3InteropApi === '2.0') {
|
16403
|
+
const notOverridden = checkFDC32Overrides(overriddenBroker);
|
16404
|
+
if (notOverridden.length > 0) {
|
16405
|
+
console.warn(`WARNING: FDC3 2.0 has been set as a default option for Views in this Platform, but the required InteropBroker APIs for FDC3 2.0 compliance have not all been overridden.\nThe following APIs need to be overridden:\n${notOverridden.join('\n')}`);
|
16406
|
+
}
|
16407
|
+
}
|
15224
16408
|
}
|
16409
|
+
overrideCheck$1.overrideCheck = overrideCheck;
|
15225
16410
|
|
15226
16411
|
var hasRequiredFactory;
|
15227
16412
|
|
@@ -15234,8 +16419,8 @@ function requireFactory () {
|
|
15234
16419
|
const inaccessibleObject_1 = inaccessibleObject;
|
15235
16420
|
const base_1 = base;
|
15236
16421
|
const InteropBroker_1 = requireInteropBroker();
|
15237
|
-
const InteropClient_1 =
|
15238
|
-
const overrideCheck_1 =
|
16422
|
+
const InteropClient_1 = requireInteropClient();
|
16423
|
+
const overrideCheck_1 = overrideCheck$1;
|
15239
16424
|
const common_utils_1 = commonUtils;
|
15240
16425
|
const defaultOverride = (Class) => new Class();
|
15241
16426
|
const BrokerParamAccessError = 'You have attempted to use or modify InteropBroker parameters, which is not allowed. You are likely using an older InteropBroker override scheme. Please consult our Interop docs for guidance on migrating to the new override scheme.';
|
@@ -15268,12 +16453,8 @@ function requireFactory () {
|
|
15268
16453
|
const options = await this.wire.environment.getInteropInfo(this.wire.getFin());
|
15269
16454
|
const objectThatThrows = (0, inaccessibleObject_1.createUnusableObject)(BrokerParamAccessError);
|
15270
16455
|
const warningOptsClone = (0, inaccessibleObject_1.createWarningObject)(BrokerParamAccessError, (0, lodash_1.cloneDeep)(options));
|
15271
|
-
let provider;
|
15272
16456
|
const getProvider = () => {
|
15273
|
-
|
15274
|
-
provider = this.fin.InterApplicationBus.Channel.create(`interop-broker-${name}`);
|
15275
|
-
}
|
15276
|
-
return provider;
|
16457
|
+
return this.fin.InterApplicationBus.Channel.create(`interop-broker-${name}`);
|
15277
16458
|
};
|
15278
16459
|
const throwingGetProvider = async () => {
|
15279
16460
|
// eslint-disable-next-line no-console
|
@@ -15319,7 +16500,11 @@ function requireFactory () {
|
|
15319
16500
|
this.wire.sendAction('interop-connect-sync').catch(() => {
|
15320
16501
|
// don't expose, analytics-only call
|
15321
16502
|
});
|
15322
|
-
return new InteropClient_1.InteropClient(this.wire,
|
16503
|
+
return new InteropClient_1.InteropClient(this.wire, this.wire.environment.whenReady().then(() => {
|
16504
|
+
return this.fin.InterApplicationBus.Channel.connect(`interop-broker-${name}`, {
|
16505
|
+
payload: interopConfig
|
16506
|
+
});
|
16507
|
+
}));
|
15323
16508
|
}
|
15324
16509
|
}
|
15325
16510
|
Factory$1.InteropModule = InteropModule;
|
@@ -15356,7 +16541,7 @@ function requireInterop () {
|
|
15356
16541
|
};
|
15357
16542
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15358
16543
|
__exportStar(requireFactory(), exports);
|
15359
|
-
__exportStar(
|
16544
|
+
__exportStar(requireInteropClient(), exports);
|
15360
16545
|
__exportStar(requireInteropBroker(), exports);
|
15361
16546
|
} (interop));
|
15362
16547
|
return interop;
|
@@ -16088,7 +17273,7 @@ class MockEnvironment {
|
|
16088
17273
|
throw new Error(me_1.environmentUnsupportedMessage);
|
16089
17274
|
}
|
16090
17275
|
getNextMessageId() {
|
16091
|
-
|
17276
|
+
return `mock-message-id-${Math.random()}`;
|
16092
17277
|
}
|
16093
17278
|
getRandomId() {
|
16094
17279
|
throw new Error(me_1.environmentUnsupportedMessage);
|