@openfin/remote-adapter 40.82.4 → 40.82.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/remote-adapter.js +46 -195
- package/package.json +2 -2
package/out/remote-adapter.js
CHANGED
|
@@ -4404,57 +4404,19 @@ transportErrors.NotImplementedError = NotImplementedError;
|
|
|
4404
4404
|
class NotSupportedError extends Error {
|
|
4405
4405
|
}
|
|
4406
4406
|
transportErrors.NotSupportedError = NotSupportedError;
|
|
4407
|
-
class
|
|
4407
|
+
class InternalError extends Error {
|
|
4408
4408
|
constructor(err) {
|
|
4409
4409
|
const { message, name, stack, ...rest } = err;
|
|
4410
4410
|
super(message);
|
|
4411
|
-
if ('cause' in err && err.cause) {
|
|
4412
|
-
this.cause = new DeserializedError(err.cause);
|
|
4413
|
-
}
|
|
4414
4411
|
this.name = name || 'Error';
|
|
4415
4412
|
this.stack = stack ?? this.toString();
|
|
4416
|
-
Object.keys(rest)
|
|
4417
|
-
.filter((k) => k !== 'cause')
|
|
4418
|
-
.forEach((key) => {
|
|
4413
|
+
Object.keys(rest).forEach(key => {
|
|
4419
4414
|
this[key] = rest[key];
|
|
4420
4415
|
});
|
|
4421
4416
|
}
|
|
4422
4417
|
}
|
|
4423
4418
|
// For documentation of the error methods being used see here: https://v8.dev/docs/stack-trace-api
|
|
4424
4419
|
class RuntimeError extends Error {
|
|
4425
|
-
static trimEndCallSites(err, takeUntilRegex) {
|
|
4426
|
-
// save original props
|
|
4427
|
-
const length = Error.stackTraceLimit;
|
|
4428
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
4429
|
-
const _prepareStackTrace = Error.prepareStackTrace;
|
|
4430
|
-
// This will be called when we access the `stack` property
|
|
4431
|
-
Error.prepareStackTrace = (_, stack) => stack;
|
|
4432
|
-
// in channel errors, the error was already serialized so we need to handle both string and CallSite[]
|
|
4433
|
-
const isString = typeof err.stack === 'string';
|
|
4434
|
-
const stack = (isString ? err.stack?.split('\n') : err.stack) ?? [];
|
|
4435
|
-
// restore original props
|
|
4436
|
-
Error.prepareStackTrace = _prepareStackTrace;
|
|
4437
|
-
Error.stackTraceLimit = length;
|
|
4438
|
-
// stack is optional in non chromium contexts
|
|
4439
|
-
if (stack.length) {
|
|
4440
|
-
const newStack = [];
|
|
4441
|
-
// remove this call ONLY if it's not a string
|
|
4442
|
-
for (const line of isString ? stack : stack.slice(1)) {
|
|
4443
|
-
// inclusive take until
|
|
4444
|
-
newStack.push(line);
|
|
4445
|
-
if (takeUntilRegex.test(line.toString())) {
|
|
4446
|
-
break;
|
|
4447
|
-
}
|
|
4448
|
-
}
|
|
4449
|
-
if (isString) {
|
|
4450
|
-
// maintain it as a string
|
|
4451
|
-
err.stack = newStack.join('\n');
|
|
4452
|
-
}
|
|
4453
|
-
else {
|
|
4454
|
-
err.stack = RuntimeError.prepareStackTrace(err, newStack);
|
|
4455
|
-
}
|
|
4456
|
-
}
|
|
4457
|
-
}
|
|
4458
4420
|
static getCallSite(callsToRemove = 0) {
|
|
4459
4421
|
const length = Error.stackTraceLimit;
|
|
4460
4422
|
const realCallsToRemove = callsToRemove + 1; // remove this call;
|
|
@@ -4473,82 +4435,21 @@ class RuntimeError extends Error {
|
|
|
4473
4435
|
if (typeof Error.prepareStackTrace === 'function') {
|
|
4474
4436
|
return Error.prepareStackTrace(err, callSites);
|
|
4475
4437
|
}
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
/*
|
|
4486
|
-
|
|
4487
|
-
NON filtered stack trace example from MTP page channel-errors.tsx:
|
|
4488
|
-
|
|
4489
|
-
Caused by: ChannelError: Error from ch0
|
|
4490
|
-
at ChannelClient.dispatch (<anonymous>:3:119560)
|
|
4491
|
-
at eval (test-channel-errors.tsx:73:26)
|
|
4492
|
-
at ChannelProvider.processAction (<anonymous>:3:116748)
|
|
4493
|
-
at ChannelProvider.processAction (<anonymous>:3:149121)
|
|
4494
|
-
at MessageReceiver.processChannelMessage (<anonymous>:3:131909)
|
|
4495
|
-
at MessageReceiver.onmessage (<anonymous>:3:131232)
|
|
4496
|
-
at Transport.onmessage (<anonymous>:3:282049)
|
|
4497
|
-
at IpcRenderer.<anonymous> (<anonymous>:3:275150)
|
|
4498
|
-
at IpcRenderer.emit (node:electron/js2c/sandbox_bundle:2:34834)
|
|
4499
|
-
at Object.onMessage (node:electron/js2c/sandbox_bundle:2:51566)
|
|
4500
|
-
Caused by: ChannelError: Error from ch0
|
|
4501
|
-
at ChannelClient.dispatch (<anonymous>:3:119560)
|
|
4502
|
-
at eval (test-channel-errors.tsx:73:26)
|
|
4503
|
-
at ChannelProvider.processAction (<anonymous>:3:116748)
|
|
4504
|
-
at ChannelProvider.processAction (<anonymous>:3:149121)
|
|
4505
|
-
at MessageReceiver.processChannelMessage (<anonymous>:3:131909)
|
|
4506
|
-
at MessageReceiver.onmessage (<anonymous>:3:131232)
|
|
4507
|
-
at Transport.onmessage (<anonymous>:3:282049)
|
|
4508
|
-
at IpcRenderer.<anonymous> (<anonymous>:3:275150)
|
|
4509
|
-
at IpcRenderer.emit (node:electron/js2c/sandbox_bundle:2:34834)
|
|
4510
|
-
at Object.onMessage (node:electron/js2c/sandbox_bundle:2:51566)
|
|
4511
|
-
Caused by: ChannelError: Error from ch0
|
|
4512
|
-
at ChannelClient.dispatch (<anonymous>:3:119560)
|
|
4513
|
-
at eval (test-channel-errors.tsx:73:26)
|
|
4514
|
-
at ChannelProvider.processAction (<anonymous>:3:116748)
|
|
4515
|
-
at ChannelProvider.processAction (<anonymous>:3:149121)
|
|
4516
|
-
at MessageReceiver.processChannelMessage (<anonymous>:3:131909)
|
|
4517
|
-
at MessageReceiver.onmessage (<anonymous>:3:131232)
|
|
4518
|
-
at Transport.onmessage (<anonymous>:3:282049)
|
|
4519
|
-
at IpcRenderer.<anonymous> (<anonymous>:3:275150)
|
|
4520
|
-
at IpcRenderer.emit (node:electron/js2c/sandbox_bundle:2:34834)
|
|
4521
|
-
at Object.onMessage (node:electron/js2c/sandbox_bundle:2:51566)
|
|
4522
|
-
Caused by: ChannelError: Error from ch0
|
|
4523
|
-
at ChannelClient.dispatch (<anonymous>:3:119560)
|
|
4524
|
-
at eval (test-channel-errors.tsx:50:23)
|
|
4525
|
-
at ChannelProvider.processAction (<anonymous>:3:116748)
|
|
4526
|
-
at ChannelProvider.processAction (<anonymous>:3:149121)
|
|
4527
|
-
at MessageReceiver.processChannelMessage (<anonymous>:3:131909)
|
|
4528
|
-
at MessageReceiver.onmessage (<anonymous>:3:131232)
|
|
4529
|
-
at Transport.onmessage (<anonymous>:3:282049)
|
|
4530
|
-
at IpcRenderer.<anonymous> (<anonymous>:3:275150)
|
|
4531
|
-
at IpcRenderer.emit (node:electron/js2c/sandbox_bundle:2:34834)
|
|
4532
|
-
at Object.onMessage (node:electron/js2c/sandbox_bundle:2:51566)
|
|
4533
|
-
Caused by: Error: Error from ch0
|
|
4534
|
-
at eval (test-channel-errors.tsx:54:19)
|
|
4535
|
-
at ChannelProvider.processAction (<anonymous>:3:116748)
|
|
4536
|
-
at ChannelProvider.processAction (<anonymous>:3:149121)
|
|
4537
|
-
at MessageReceiver.processChannelMessage (<anonymous>:3:131909)
|
|
4538
|
-
at MessageReceiver.onmessage (<anonymous>:3:131232)
|
|
4539
|
-
at Transport.onmessage (<anonymous>:3:282049)
|
|
4540
|
-
at IpcRenderer.<anonymous> (<anonymous>:3:275150)
|
|
4541
|
-
at IpcRenderer.emit (node:electron/js2c/sandbox_bundle:2:34834)
|
|
4542
|
-
at Object.onMessage (node:electron/js2c/sandbox_bundle:2:51566)
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
*/
|
|
4438
|
+
let string = "";
|
|
4439
|
+
string += err.name || "Error";
|
|
4440
|
+
string += `: ${err.message || ""}`;
|
|
4441
|
+
for (const callSite of callSites) {
|
|
4442
|
+
string += `\n at ${callSite.toString()}`;
|
|
4443
|
+
}
|
|
4444
|
+
return string;
|
|
4445
|
+
}
|
|
4446
|
+
;
|
|
4546
4447
|
constructor(payload, callSites) {
|
|
4547
4448
|
const { reason, error } = payload;
|
|
4548
4449
|
super(reason);
|
|
4549
|
-
this.name =
|
|
4450
|
+
this.name = 'RuntimeError';
|
|
4550
4451
|
if (error?.stack) {
|
|
4551
|
-
this.cause = new
|
|
4452
|
+
this.cause = new InternalError(error);
|
|
4552
4453
|
}
|
|
4553
4454
|
if (callSites) {
|
|
4554
4455
|
this.stack = RuntimeError.prepareStackTrace(this, callSites);
|
|
@@ -9534,14 +9435,9 @@ function requireInstance () {
|
|
|
9534
9435
|
// don't expose
|
|
9535
9436
|
});
|
|
9536
9437
|
const layoutWindow = await this.getCurrentWindow();
|
|
9537
|
-
let layoutWindowIdentity = layoutWindow.identity;
|
|
9538
|
-
// TODO: CORE-1857 - when we tearout active layout or drag a view out of a window, the above identity includes the whole window info.
|
|
9539
|
-
if (layoutWindowIdentity.identity) {
|
|
9540
|
-
layoutWindowIdentity = layoutWindowIdentity.identity;
|
|
9541
|
-
}
|
|
9542
9438
|
try {
|
|
9543
9439
|
const providerChannelClient = await __classPrivateFieldGet(this, _View_providerChannelClient, "f").getValue();
|
|
9544
|
-
const client = await layout_entities_1.LayoutNode.newLayoutEntitiesClient(providerChannelClient, layout_constants_1.LAYOUT_CONTROLLER_ID,
|
|
9440
|
+
const client = await layout_entities_1.LayoutNode.newLayoutEntitiesClient(providerChannelClient, layout_constants_1.LAYOUT_CONTROLLER_ID, layoutWindow.identity);
|
|
9545
9441
|
const layoutIdentity = await client.getLayoutIdentityForViewOrThrow(this.identity);
|
|
9546
9442
|
return this.fin.Platform.Layout.wrap(layoutIdentity);
|
|
9547
9443
|
}
|
|
@@ -9554,7 +9450,7 @@ function requireInstance () {
|
|
|
9554
9450
|
throw e;
|
|
9555
9451
|
}
|
|
9556
9452
|
// fallback logic for missing endpoint
|
|
9557
|
-
return this.fin.Platform.Layout.wrap(
|
|
9453
|
+
return this.fin.Platform.Layout.wrap(layoutWindow.identity);
|
|
9558
9454
|
}
|
|
9559
9455
|
};
|
|
9560
9456
|
/**
|
|
@@ -10271,17 +10167,13 @@ var errors = {};
|
|
|
10271
10167
|
Object.defineProperty(errors, "__esModule", { value: true });
|
|
10272
10168
|
errors.errorToPOJO = void 0;
|
|
10273
10169
|
function errorToPOJO(error) {
|
|
10274
|
-
|
|
10170
|
+
return {
|
|
10275
10171
|
stack: error.stack,
|
|
10276
10172
|
name: error.name,
|
|
10277
10173
|
message: error.message,
|
|
10278
10174
|
// support the case where stack is empty or missing
|
|
10279
10175
|
toString: () => error.stack || error.toString()
|
|
10280
10176
|
};
|
|
10281
|
-
if ('cause' in error) {
|
|
10282
|
-
errorObj.cause = errorToPOJO(error.cause);
|
|
10283
|
-
}
|
|
10284
|
-
return errorObj;
|
|
10285
10177
|
}
|
|
10286
10178
|
errors.errorToPOJO = errorToPOJO;
|
|
10287
10179
|
|
|
@@ -10301,10 +10193,10 @@ Object.defineProperty(transport, "__esModule", { value: true });
|
|
|
10301
10193
|
var Transport_1 = transport.Transport = void 0;
|
|
10302
10194
|
const events_1$5 = require$$0;
|
|
10303
10195
|
const wire_1 = wire;
|
|
10304
|
-
const transport_errors_1$
|
|
10196
|
+
const transport_errors_1$2 = transportErrors;
|
|
10305
10197
|
const eventAggregator_1 = eventAggregator;
|
|
10306
10198
|
const me_1$1 = me;
|
|
10307
|
-
const errors_1$
|
|
10199
|
+
const errors_1$1 = errors;
|
|
10308
10200
|
class Transport extends events_1$5.EventEmitter {
|
|
10309
10201
|
constructor(WireType, environment, config) {
|
|
10310
10202
|
super();
|
|
@@ -10386,7 +10278,7 @@ class Transport extends events_1$5.EventEmitter {
|
|
|
10386
10278
|
type: 'file-token'
|
|
10387
10279
|
}, true);
|
|
10388
10280
|
if (requestExtAuthRet.action !== 'external-authorization-response') {
|
|
10389
|
-
throw new transport_errors_1$
|
|
10281
|
+
throw new transport_errors_1$2.UnexpectedActionError(requestExtAuthRet.action);
|
|
10390
10282
|
}
|
|
10391
10283
|
await this.environment.writeToken(requestExtAuthRet.payload.file, requestExtAuthRet.payload.token);
|
|
10392
10284
|
return this.authorize(reqAuthPayload);
|
|
@@ -10394,10 +10286,10 @@ class Transport extends events_1$5.EventEmitter {
|
|
|
10394
10286
|
async authorize(reqAuthPayload) {
|
|
10395
10287
|
const requestAuthRet = await this.sendAction('request-authorization', reqAuthPayload, true);
|
|
10396
10288
|
if (requestAuthRet.action !== 'authorization-response') {
|
|
10397
|
-
throw new transport_errors_1$
|
|
10289
|
+
throw new transport_errors_1$2.UnexpectedActionError(requestAuthRet.action);
|
|
10398
10290
|
}
|
|
10399
10291
|
else if (requestAuthRet.payload.success !== true) {
|
|
10400
|
-
throw new transport_errors_1$
|
|
10292
|
+
throw new transport_errors_1$2.RuntimeError(requestAuthRet.payload);
|
|
10401
10293
|
}
|
|
10402
10294
|
}
|
|
10403
10295
|
sendAction(action, payload = {}, uncorrelated = false
|
|
@@ -10406,7 +10298,7 @@ class Transport extends events_1$5.EventEmitter {
|
|
|
10406
10298
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
10407
10299
|
let cancel = () => { };
|
|
10408
10300
|
// We want the callsite from the caller of this function, not from here.
|
|
10409
|
-
const callSites = transport_errors_1$
|
|
10301
|
+
const callSites = transport_errors_1$2.RuntimeError.getCallSite(1);
|
|
10410
10302
|
const messageId = this.environment.getNextMessageId();
|
|
10411
10303
|
const prom = new Promise((resolve, reject) => {
|
|
10412
10304
|
cancel = reject;
|
|
@@ -10427,7 +10319,7 @@ class Transport extends events_1$5.EventEmitter {
|
|
|
10427
10319
|
reject(payloadOrMessage);
|
|
10428
10320
|
}
|
|
10429
10321
|
else {
|
|
10430
|
-
reject(new transport_errors_1$
|
|
10322
|
+
reject(new transport_errors_1$2.RuntimeError(payloadOrMessage, callSites));
|
|
10431
10323
|
}
|
|
10432
10324
|
}
|
|
10433
10325
|
ferryAction(origData) {
|
|
@@ -10454,7 +10346,7 @@ class Transport extends events_1$5.EventEmitter {
|
|
|
10454
10346
|
else if (this.wireListeners.has(id)) {
|
|
10455
10347
|
handleNack({
|
|
10456
10348
|
reason: 'Duplicate handler id',
|
|
10457
|
-
error: (0, errors_1$
|
|
10349
|
+
error: (0, errors_1$1.errorToPOJO)(new transport_errors_1$2.DuplicateCorrelationError(String(id)))
|
|
10458
10350
|
});
|
|
10459
10351
|
}
|
|
10460
10352
|
else {
|
|
@@ -10486,7 +10378,7 @@ class Transport extends events_1$5.EventEmitter {
|
|
|
10486
10378
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
10487
10379
|
const { resolve, handleNack } = this.wireListeners.get(id);
|
|
10488
10380
|
if (data.action !== 'ack') {
|
|
10489
|
-
handleNack({ reason: 'Did not receive ack action', error: (0, errors_1$
|
|
10381
|
+
handleNack({ reason: 'Did not receive ack action', error: (0, errors_1$1.errorToPOJO)(new transport_errors_1$2.NoAckError(data.action)) });
|
|
10490
10382
|
}
|
|
10491
10383
|
else if (!('payload' in data)) {
|
|
10492
10384
|
// I'm not sure when this code would actually run, but passing in something that doeesn't have a reason to the runtimeerror constructor will not end well.
|
|
@@ -10496,10 +10388,7 @@ class Transport extends events_1$5.EventEmitter {
|
|
|
10496
10388
|
}
|
|
10497
10389
|
else {
|
|
10498
10390
|
console.warn('Received invalid response from core', data);
|
|
10499
|
-
handleNack({
|
|
10500
|
-
reason: 'invalid response shape',
|
|
10501
|
-
error: (0, errors_1$2.errorToPOJO)(new Error('Invalid response shape'))
|
|
10502
|
-
});
|
|
10391
|
+
handleNack({ reason: 'invalid response shape' });
|
|
10503
10392
|
}
|
|
10504
10393
|
}
|
|
10505
10394
|
else if (!data.payload.success) {
|
|
@@ -10520,7 +10409,7 @@ var websocket = {};
|
|
|
10520
10409
|
|
|
10521
10410
|
Object.defineProperty(websocket, "__esModule", { value: true });
|
|
10522
10411
|
const events_1$4 = require$$0;
|
|
10523
|
-
const transport_errors_1$
|
|
10412
|
+
const transport_errors_1$1 = transportErrors;
|
|
10524
10413
|
const messageReceiver_1 = bridge.messageReceiver;
|
|
10525
10414
|
/* `READY_STATE` is an instance var set by `constructor` to reference the `WebTransportSocket.READY_STATE` enum.
|
|
10526
10415
|
* This is syntactic sugar that makes the enum accessible through the `wire` property of the various `fin` singletons.
|
|
@@ -10554,14 +10443,14 @@ class WebSocketTransport extends events_1$4.EventEmitter {
|
|
|
10554
10443
|
});
|
|
10555
10444
|
};
|
|
10556
10445
|
this.connectSync = () => {
|
|
10557
|
-
throw new transport_errors_1$
|
|
10446
|
+
throw new transport_errors_1$1.NotImplementedError('Not Implemented');
|
|
10558
10447
|
};
|
|
10559
10448
|
this.onmessage = onmessage;
|
|
10560
10449
|
}
|
|
10561
10450
|
send(data, flags) {
|
|
10562
10451
|
return new Promise((resolve, reject) => {
|
|
10563
10452
|
if (!(0, messageReceiver_1.isOpen)(this.wire)) {
|
|
10564
|
-
reject(new transport_errors_1$
|
|
10453
|
+
reject(new transport_errors_1$1.DisconnectedError(READY_STATE[this.wire.readyState]));
|
|
10565
10454
|
}
|
|
10566
10455
|
else {
|
|
10567
10456
|
// @ts-expect-error
|
|
@@ -10594,7 +10483,7 @@ var system = {};
|
|
|
10594
10483
|
Object.defineProperty(system, "__esModule", { value: true });
|
|
10595
10484
|
system.System = void 0;
|
|
10596
10485
|
const base_1$d = base;
|
|
10597
|
-
const transport_errors_1
|
|
10486
|
+
const transport_errors_1 = transportErrors;
|
|
10598
10487
|
const window_1 = requireWindow();
|
|
10599
10488
|
const events_1$3 = require$$0;
|
|
10600
10489
|
/**
|
|
@@ -11684,9 +11573,9 @@ class System extends base_1$d.EmitterBase {
|
|
|
11684
11573
|
});
|
|
11685
11574
|
// node.js environment not supported
|
|
11686
11575
|
if (this.wire.environment.type !== 'openfin') {
|
|
11687
|
-
throw new transport_errors_1
|
|
11576
|
+
throw new transport_errors_1.NotSupportedError('downloadAsset only supported in an OpenFin Render process');
|
|
11688
11577
|
}
|
|
11689
|
-
const callSite = transport_errors_1
|
|
11578
|
+
const callSite = transport_errors_1.RuntimeError.getCallSite();
|
|
11690
11579
|
const downloadId = this.wire.environment.getNextMessageId().toString();
|
|
11691
11580
|
const dlProgressKey = `asset-download-progress-${downloadId}`;
|
|
11692
11581
|
const dlErrorKey = `asset-download-error-${downloadId}`;
|
|
@@ -11706,7 +11595,7 @@ class System extends base_1$d.EmitterBase {
|
|
|
11706
11595
|
const dlError = (payload) => {
|
|
11707
11596
|
cleanListeners();
|
|
11708
11597
|
const { reason, err: error } = payload;
|
|
11709
|
-
reject(new transport_errors_1
|
|
11598
|
+
reject(new transport_errors_1.RuntimeError({ reason, error }, callSite));
|
|
11710
11599
|
};
|
|
11711
11600
|
const dlComplete = () => {
|
|
11712
11601
|
cleanListeners();
|
|
@@ -11757,11 +11646,11 @@ class System extends base_1$d.EmitterBase {
|
|
|
11757
11646
|
* ```
|
|
11758
11647
|
*/
|
|
11759
11648
|
downloadRuntime(options, progressListener) {
|
|
11760
|
-
const callsites = transport_errors_1
|
|
11649
|
+
const callsites = transport_errors_1.RuntimeError.getCallSite();
|
|
11761
11650
|
return new Promise((resolve, reject) => {
|
|
11762
11651
|
// node.js environment not supported
|
|
11763
11652
|
if (this.wire.environment.type !== 'openfin') {
|
|
11764
|
-
reject(new transport_errors_1
|
|
11653
|
+
reject(new transport_errors_1.NotSupportedError('downloadRuntime only supported in an OpenFin Render process'));
|
|
11765
11654
|
return;
|
|
11766
11655
|
}
|
|
11767
11656
|
const downloadId = this.wire.environment.getNextMessageId().toString();
|
|
@@ -11783,7 +11672,7 @@ class System extends base_1$d.EmitterBase {
|
|
|
11783
11672
|
const dlError = (payload) => {
|
|
11784
11673
|
cleanListeners();
|
|
11785
11674
|
const { reason, err: error } = payload;
|
|
11786
|
-
reject(new transport_errors_1
|
|
11675
|
+
reject(new transport_errors_1.RuntimeError({ reason, error }, callsites));
|
|
11787
11676
|
};
|
|
11788
11677
|
const dlComplete = () => {
|
|
11789
11678
|
cleanListeners();
|
|
@@ -12518,7 +12407,6 @@ var channel = {};
|
|
|
12518
12407
|
|
|
12519
12408
|
Object.defineProperty(channel, "__esModule", { value: true });
|
|
12520
12409
|
channel.ChannelBase = channel.ProtectedItems = void 0;
|
|
12521
|
-
const transport_errors_1$3 = transportErrors;
|
|
12522
12410
|
const resultOrPayload = (func) => async (topic, payload, senderIdentity) => {
|
|
12523
12411
|
const res = await func(topic, payload, senderIdentity);
|
|
12524
12412
|
return res === undefined ? payload : res;
|
|
@@ -12551,7 +12439,6 @@ class ChannelBase {
|
|
|
12551
12439
|
return this.postAction ? await this.postAction(topic, actionProcessed, senderIdentity) : actionProcessed;
|
|
12552
12440
|
}
|
|
12553
12441
|
catch (e) {
|
|
12554
|
-
transport_errors_1$3.RuntimeError.trimEndCallSites(e, /Channel.*processAction/);
|
|
12555
12442
|
if (this.errorMiddleware) {
|
|
12556
12443
|
return this.errorMiddleware(topic, e, senderIdentity);
|
|
12557
12444
|
}
|
|
@@ -12853,25 +12740,6 @@ class ChannelBase {
|
|
|
12853
12740
|
}
|
|
12854
12741
|
channel.ChannelBase = ChannelBase;
|
|
12855
12742
|
|
|
12856
|
-
var channelError = {};
|
|
12857
|
-
|
|
12858
|
-
Object.defineProperty(channelError, "__esModule", { value: true });
|
|
12859
|
-
channelError.ChannelError = void 0;
|
|
12860
|
-
const transport_errors_1$2 = transportErrors;
|
|
12861
|
-
class ChannelError extends Error {
|
|
12862
|
-
constructor(originalError, action, dispatchPayload, callsites) {
|
|
12863
|
-
super(originalError.message);
|
|
12864
|
-
this.action = action;
|
|
12865
|
-
this.dispatchPayload = dispatchPayload;
|
|
12866
|
-
this.name = this.constructor.name;
|
|
12867
|
-
if ('cause' in originalError && originalError.cause instanceof Error) {
|
|
12868
|
-
this.cause = originalError.cause;
|
|
12869
|
-
}
|
|
12870
|
-
this.stack = transport_errors_1$2.RuntimeError.prepareStackTrace(this, callsites);
|
|
12871
|
-
}
|
|
12872
|
-
}
|
|
12873
|
-
channelError.ChannelError = ChannelError;
|
|
12874
|
-
|
|
12875
12743
|
var __classPrivateFieldGet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12876
12744
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
12877
12745
|
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");
|
|
@@ -12886,9 +12754,7 @@ var __classPrivateFieldSet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateF
|
|
|
12886
12754
|
var _ChannelClient_protectedObj, _ChannelClient_strategy, _ChannelClient_close;
|
|
12887
12755
|
Object.defineProperty(client, "__esModule", { value: true });
|
|
12888
12756
|
client.ChannelClient = void 0;
|
|
12889
|
-
const transport_errors_1$1 = transportErrors;
|
|
12890
12757
|
const channel_1$1 = channel;
|
|
12891
|
-
const channel_error_1$1 = channelError;
|
|
12892
12758
|
const channelClientsByEndpointId = new Map();
|
|
12893
12759
|
/**
|
|
12894
12760
|
* Instance created to enable use of a channel as a client. Allows for communication with the
|
|
@@ -12990,10 +12856,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
|
12990
12856
|
*/
|
|
12991
12857
|
async dispatch(action, payload) {
|
|
12992
12858
|
if (__classPrivateFieldGet$a(this, _ChannelClient_strategy, "f").isEndpointConnected(this.providerIdentity.channelId)) {
|
|
12993
|
-
|
|
12994
|
-
return __classPrivateFieldGet$a(this, _ChannelClient_strategy, "f").send(this.providerIdentity.channelId, action, payload).catch((e) => {
|
|
12995
|
-
throw new channel_error_1$1.ChannelError(e, action, payload, callSites);
|
|
12996
|
-
});
|
|
12859
|
+
return __classPrivateFieldGet$a(this, _ChannelClient_strategy, "f").send(this.providerIdentity.channelId, action, payload);
|
|
12997
12860
|
}
|
|
12998
12861
|
throw new Error('The client you are trying to dispatch from is disconnected from the target provider.');
|
|
12999
12862
|
}
|
|
@@ -13108,7 +12971,7 @@ class ClassicStrategy {
|
|
|
13108
12971
|
_ClassicStrategy_endpointIdentityMap.set(this, new Map());
|
|
13109
12972
|
// Store a set of cancellable promises to be able to reject them when client
|
|
13110
12973
|
// connection problems occur
|
|
13111
|
-
_ClassicStrategy_pendingMessagesByEndpointId.set(this, new Map
|
|
12974
|
+
_ClassicStrategy_pendingMessagesByEndpointId.set(this, new Map);
|
|
13112
12975
|
this.send = async (endpointId, action, payload) => {
|
|
13113
12976
|
const to = __classPrivateFieldGet$9(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
|
|
13114
12977
|
if (!to) {
|
|
@@ -13122,21 +12985,17 @@ class ClassicStrategy {
|
|
|
13122
12985
|
}
|
|
13123
12986
|
delete cleanId.isLocalEndpointId;
|
|
13124
12987
|
// grab the promise before awaiting it to save in our pending messages map
|
|
13125
|
-
const p = __classPrivateFieldGet$9(this, _ClassicStrategy_wire, "f")
|
|
12988
|
+
const p = __classPrivateFieldGet$9(this, _ClassicStrategy_wire, "f")
|
|
12989
|
+
.sendAction('send-channel-message', {
|
|
13126
12990
|
...cleanId,
|
|
13127
12991
|
providerIdentity: this.providerIdentity,
|
|
13128
12992
|
action,
|
|
13129
12993
|
payload
|
|
13130
12994
|
});
|
|
13131
12995
|
__classPrivateFieldGet$9(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.add(p);
|
|
13132
|
-
const raw = await p
|
|
13133
|
-
.catch((error) => {
|
|
13134
|
-
if ('cause' in error) {
|
|
13135
|
-
throw error;
|
|
13136
|
-
}
|
|
12996
|
+
const raw = await p.catch((error) => {
|
|
13137
12997
|
throw new Error(error.message);
|
|
13138
|
-
})
|
|
13139
|
-
.finally(() => {
|
|
12998
|
+
}).finally(() => {
|
|
13140
12999
|
// clean up the pending promise
|
|
13141
13000
|
__classPrivateFieldGet$9(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.delete(p);
|
|
13142
13001
|
});
|
|
@@ -13200,7 +13059,7 @@ var _RTCEndpoint_processAction, _RTCEndpoint_disconnectListener;
|
|
|
13200
13059
|
Object.defineProperty(endpoint, "__esModule", { value: true });
|
|
13201
13060
|
endpoint.RTCEndpoint = void 0;
|
|
13202
13061
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
13203
|
-
const errors_1
|
|
13062
|
+
const errors_1 = errors;
|
|
13204
13063
|
/*
|
|
13205
13064
|
This handles sending RTC messages between RTC connections over the request and response data channels.
|
|
13206
13065
|
*/
|
|
@@ -13289,7 +13148,7 @@ class RTCEndpoint {
|
|
|
13289
13148
|
if (this.rtc.channels.response.readyState === 'open') {
|
|
13290
13149
|
this.rtc.channels.response.send(JSON.stringify({
|
|
13291
13150
|
messageId,
|
|
13292
|
-
error: (0, errors_1
|
|
13151
|
+
error: (0, errors_1.errorToPOJO)(error),
|
|
13293
13152
|
success: false
|
|
13294
13153
|
}));
|
|
13295
13154
|
}
|
|
@@ -13605,10 +13464,8 @@ var __classPrivateFieldSet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateF
|
|
|
13605
13464
|
var _ChannelProvider_connections, _ChannelProvider_protectedObj, _ChannelProvider_strategy, _ChannelProvider_removeEndpoint, _ChannelProvider_close;
|
|
13606
13465
|
Object.defineProperty(provider, "__esModule", { value: true });
|
|
13607
13466
|
provider.ChannelProvider = void 0;
|
|
13608
|
-
const transport_errors_1 = transportErrors;
|
|
13609
|
-
const runtimeVersioning_1 = runtimeVersioning;
|
|
13610
13467
|
const channel_1 = channel;
|
|
13611
|
-
const
|
|
13468
|
+
const runtimeVersioning_1 = runtimeVersioning;
|
|
13612
13469
|
/**
|
|
13613
13470
|
* Instance created to enable use of a channel as a provider. Allows for communication with the {@link ChannelClient ChannelClients} by invoking an action on
|
|
13614
13471
|
* a single client via {@link ChannelProvider#dispatch dispatch} or all clients via {@link ChannelProvider#publish publish}
|
|
@@ -13725,10 +13582,7 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
13725
13582
|
dispatch(to, action, payload) {
|
|
13726
13583
|
const endpointId = to.endpointId ?? this.getEndpointIdForOpenFinId(to, action);
|
|
13727
13584
|
if (endpointId && __classPrivateFieldGet$6(this, _ChannelProvider_strategy, "f").isEndpointConnected(endpointId)) {
|
|
13728
|
-
|
|
13729
|
-
return __classPrivateFieldGet$6(this, _ChannelProvider_strategy, "f").send(endpointId, action, payload).catch((e) => {
|
|
13730
|
-
throw new channel_error_1.ChannelError(e, action, payload, callSites);
|
|
13731
|
-
});
|
|
13585
|
+
return __classPrivateFieldGet$6(this, _ChannelProvider_strategy, "f").send(endpointId, action, payload);
|
|
13732
13586
|
}
|
|
13733
13587
|
return Promise.reject(new Error(`Client connection with identity uuid: ${to.uuid} / name: ${to.name} / endpointId: ${endpointId} no longer connected.`));
|
|
13734
13588
|
}
|
|
@@ -13941,7 +13795,6 @@ Object.defineProperty(messageReceiver, "__esModule", { value: true });
|
|
|
13941
13795
|
messageReceiver.MessageReceiver = void 0;
|
|
13942
13796
|
const client_1$1 = client;
|
|
13943
13797
|
const base_1$b = base;
|
|
13944
|
-
const errors_1 = errors;
|
|
13945
13798
|
/*
|
|
13946
13799
|
This is a singleton (per fin object) tasked with routing messages coming off the ipc to the correct endpoint.
|
|
13947
13800
|
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.
|
|
@@ -13970,7 +13823,6 @@ class MessageReceiver extends base_1$b.Base {
|
|
|
13970
13823
|
if (!handler) {
|
|
13971
13824
|
ackToSender.payload.success = false;
|
|
13972
13825
|
ackToSender.payload.reason = `Client connection with identity uuid: ${this.wire.me.uuid} / name: ${this.wire.me.name} / endpointId: ${key} no longer connected.`;
|
|
13973
|
-
ackToSender.payload.error = (0, errors_1.errorToPOJO)(new Error(ackToSender.payload.reason));
|
|
13974
13826
|
return this.wire.sendRaw(ackToSender);
|
|
13975
13827
|
}
|
|
13976
13828
|
try {
|
|
@@ -13982,7 +13834,6 @@ class MessageReceiver extends base_1$b.Base {
|
|
|
13982
13834
|
catch (e) {
|
|
13983
13835
|
ackToSender.payload.success = false;
|
|
13984
13836
|
ackToSender.payload.reason = e.message;
|
|
13985
|
-
ackToSender.payload.error = (0, errors_1.errorToPOJO)(e);
|
|
13986
13837
|
return this.wire.sendRaw(ackToSender);
|
|
13987
13838
|
}
|
|
13988
13839
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfin/remote-adapter",
|
|
3
|
-
"version": "40.82.
|
|
3
|
+
"version": "40.82.5",
|
|
4
4
|
"description": "Establish intermachine runtime connections using webRTC.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"private": false,
|
|
@@ -19,6 +19,6 @@
|
|
|
19
19
|
"author": "OpenFin",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"lodash": "^4.17.21",
|
|
22
|
-
"@openfin/core": "40.82.
|
|
22
|
+
"@openfin/core": "40.82.5"
|
|
23
23
|
}
|
|
24
24
|
}
|