@openfin/core 40.82.3 → 40.82.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -45,6 +45,15 @@ declare type Accelerator = {
45
45
  zoom: boolean;
46
46
  };
47
47
 
48
+ /**
49
+ * Generated when a View is added to a layout.
50
+ * @interface
51
+ */
52
+ declare type AddedToLayoutEvent = BaseEvent_4 & {
53
+ type: 'added-to-layout';
54
+ layoutIdentity: OpenFin_2.LayoutIdentity;
55
+ };
56
+
48
57
  /**
49
58
  * Options to use when adding a view to a {@link TabStack}.
50
59
  *
@@ -4710,6 +4719,7 @@ declare type ErrorPlainObject = {
4710
4719
  stack?: string;
4711
4720
  message: string;
4712
4721
  name?: string;
4722
+ cause?: Error | ErrorPlainObject;
4713
4723
  toString(): string;
4714
4724
  };
4715
4725
 
@@ -4758,7 +4768,7 @@ declare type Event_3 = ViewEvents.PropagatedEvent<'application'> | WindowEvents.
4758
4768
  */
4759
4769
  declare type Event_4 = (WebContentsEvents.Event<'view'> & {
4760
4770
  target: OpenFin_2.Identity;
4761
- }) | CreatedEvent | DestroyedEvent | HiddenEvent | HotkeyEvent | ShownEvent | TargetChangedEvent | HostContextChangedEvent;
4771
+ }) | CreatedEvent | DestroyedEvent | HiddenEvent | HotkeyEvent | ShownEvent | TargetChangedEvent | HostContextChangedEvent | AddedToLayoutEvent | RemovedFromLayoutEvent;
4762
4772
 
4763
4773
  /**
4764
4774
  * [Union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types) containing events shared by all WebContents elements
@@ -11906,6 +11916,15 @@ declare interface RemoteConfig extends ExistingConnectConfig {
11906
11916
  token: string;
11907
11917
  }
11908
11918
 
11919
+ /**
11920
+ * Generated when a View is removed from a layout.
11921
+ * @interface
11922
+ */
11923
+ declare type RemovedFromLayoutEvent = BaseEvent_4 & {
11924
+ type: 'removed-from-layout';
11925
+ layoutIdentity: OpenFin_2.LayoutIdentity;
11926
+ };
11927
+
11909
11928
  /**
11910
11929
  * @interface
11911
11930
  */
@@ -15156,6 +15175,8 @@ declare namespace ViewEvents {
15156
15175
  BaseEvent_4 as BaseEvent,
15157
15176
  BaseViewEvent,
15158
15177
  TargetChangedEvent,
15178
+ AddedToLayoutEvent,
15179
+ RemovedFromLayoutEvent,
15159
15180
  NonPropagatedViewEvent,
15160
15181
  CreatedEvent,
15161
15182
  DestroyedEvent,
@@ -45,6 +45,15 @@ declare type Accelerator = {
45
45
  zoom: boolean;
46
46
  };
47
47
 
48
+ /**
49
+ * Generated when a View is added to a layout.
50
+ * @interface
51
+ */
52
+ declare type AddedToLayoutEvent = BaseEvent_4 & {
53
+ type: 'added-to-layout';
54
+ layoutIdentity: OpenFin_2.LayoutIdentity;
55
+ };
56
+
48
57
  /**
49
58
  * Options to use when adding a view to a {@link TabStack}.
50
59
  *
@@ -4710,6 +4719,7 @@ declare type ErrorPlainObject = {
4710
4719
  stack?: string;
4711
4720
  message: string;
4712
4721
  name?: string;
4722
+ cause?: Error | ErrorPlainObject;
4713
4723
  toString(): string;
4714
4724
  };
4715
4725
 
@@ -4758,7 +4768,7 @@ declare type Event_3 = ViewEvents.PropagatedEvent<'application'> | WindowEvents.
4758
4768
  */
4759
4769
  declare type Event_4 = (WebContentsEvents.Event<'view'> & {
4760
4770
  target: OpenFin_2.Identity;
4761
- }) | CreatedEvent | DestroyedEvent | HiddenEvent | HotkeyEvent | ShownEvent | TargetChangedEvent | HostContextChangedEvent;
4771
+ }) | CreatedEvent | DestroyedEvent | HiddenEvent | HotkeyEvent | ShownEvent | TargetChangedEvent | HostContextChangedEvent | AddedToLayoutEvent | RemovedFromLayoutEvent;
4762
4772
 
4763
4773
  /**
4764
4774
  * [Union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types) containing events shared by all WebContents elements
@@ -11906,6 +11916,15 @@ declare interface RemoteConfig extends ExistingConnectConfig {
11906
11916
  token: string;
11907
11917
  }
11908
11918
 
11919
+ /**
11920
+ * Generated when a View is removed from a layout.
11921
+ * @interface
11922
+ */
11923
+ declare type RemovedFromLayoutEvent = BaseEvent_4 & {
11924
+ type: 'removed-from-layout';
11925
+ layoutIdentity: OpenFin_2.LayoutIdentity;
11926
+ };
11927
+
11909
11928
  /**
11910
11929
  * @interface
11911
11930
  */
@@ -15156,6 +15175,8 @@ declare namespace ViewEvents {
15156
15175
  BaseEvent_4 as BaseEvent,
15157
15176
  BaseViewEvent,
15158
15177
  TargetChangedEvent,
15178
+ AddedToLayoutEvent,
15179
+ RemovedFromLayoutEvent,
15159
15180
  NonPropagatedViewEvent,
15160
15181
  CreatedEvent,
15161
15182
  DestroyedEvent,
@@ -45,6 +45,15 @@ declare type Accelerator = {
45
45
  zoom: boolean;
46
46
  };
47
47
 
48
+ /**
49
+ * Generated when a View is added to a layout.
50
+ * @interface
51
+ */
52
+ declare type AddedToLayoutEvent = BaseEvent_4 & {
53
+ type: 'added-to-layout';
54
+ layoutIdentity: OpenFin_2.LayoutIdentity;
55
+ };
56
+
48
57
  /**
49
58
  * Options to use when adding a view to a {@link TabStack}.
50
59
  *
@@ -4710,6 +4719,7 @@ declare type ErrorPlainObject = {
4710
4719
  stack?: string;
4711
4720
  message: string;
4712
4721
  name?: string;
4722
+ cause?: Error | ErrorPlainObject;
4713
4723
  toString(): string;
4714
4724
  };
4715
4725
 
@@ -4758,7 +4768,7 @@ declare type Event_3 = ViewEvents.PropagatedEvent<'application'> | WindowEvents.
4758
4768
  */
4759
4769
  declare type Event_4 = (WebContentsEvents.Event<'view'> & {
4760
4770
  target: OpenFin_2.Identity;
4761
- }) | CreatedEvent | DestroyedEvent | HiddenEvent | HotkeyEvent | ShownEvent | TargetChangedEvent | HostContextChangedEvent;
4771
+ }) | CreatedEvent | DestroyedEvent | HiddenEvent | HotkeyEvent | ShownEvent | TargetChangedEvent | HostContextChangedEvent | AddedToLayoutEvent | RemovedFromLayoutEvent;
4762
4772
 
4763
4773
  /**
4764
4774
  * [Union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types) containing events shared by all WebContents elements
@@ -11906,6 +11916,15 @@ declare interface RemoteConfig extends ExistingConnectConfig {
11906
11916
  token: string;
11907
11917
  }
11908
11918
 
11919
+ /**
11920
+ * Generated when a View is removed from a layout.
11921
+ * @interface
11922
+ */
11923
+ declare type RemovedFromLayoutEvent = BaseEvent_4 & {
11924
+ type: 'removed-from-layout';
11925
+ layoutIdentity: OpenFin_2.LayoutIdentity;
11926
+ };
11927
+
11909
11928
  /**
11910
11929
  * @interface
11911
11930
  */
@@ -15156,6 +15175,8 @@ declare namespace ViewEvents {
15156
15175
  BaseEvent_4 as BaseEvent,
15157
15176
  BaseViewEvent,
15158
15177
  TargetChangedEvent,
15178
+ AddedToLayoutEvent,
15179
+ RemovedFromLayoutEvent,
15159
15180
  NonPropagatedViewEvent,
15160
15181
  CreatedEvent,
15161
15182
  DestroyedEvent,
package/out/mock.d.ts CHANGED
@@ -45,6 +45,15 @@ declare type Accelerator = {
45
45
  zoom: boolean;
46
46
  };
47
47
 
48
+ /**
49
+ * Generated when a View is added to a layout.
50
+ * @interface
51
+ */
52
+ declare type AddedToLayoutEvent = BaseEvent_4 & {
53
+ type: 'added-to-layout';
54
+ layoutIdentity: OpenFin_2.LayoutIdentity;
55
+ };
56
+
48
57
  /**
49
58
  * Options to use when adding a view to a {@link TabStack}.
50
59
  *
@@ -4774,6 +4783,7 @@ declare type ErrorPlainObject = {
4774
4783
  stack?: string;
4775
4784
  message: string;
4776
4785
  name?: string;
4786
+ cause?: Error | ErrorPlainObject;
4777
4787
  toString(): string;
4778
4788
  };
4779
4789
 
@@ -4822,7 +4832,7 @@ declare type Event_3 = ViewEvents.PropagatedEvent<'application'> | WindowEvents.
4822
4832
  */
4823
4833
  declare type Event_4 = (WebContentsEvents.Event<'view'> & {
4824
4834
  target: OpenFin_2.Identity;
4825
- }) | CreatedEvent | DestroyedEvent | HiddenEvent | HotkeyEvent | ShownEvent | TargetChangedEvent | HostContextChangedEvent;
4835
+ }) | CreatedEvent | DestroyedEvent | HiddenEvent | HotkeyEvent | ShownEvent | TargetChangedEvent | HostContextChangedEvent | AddedToLayoutEvent | RemovedFromLayoutEvent;
4826
4836
 
4827
4837
  /**
4828
4838
  * [Union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types) containing events shared by all WebContents elements
@@ -12299,6 +12309,15 @@ declare interface RemoteConfig extends ExistingConnectConfig {
12299
12309
  token: string;
12300
12310
  }
12301
12311
 
12312
+ /**
12313
+ * Generated when a View is removed from a layout.
12314
+ * @interface
12315
+ */
12316
+ declare type RemovedFromLayoutEvent = BaseEvent_4 & {
12317
+ type: 'removed-from-layout';
12318
+ layoutIdentity: OpenFin_2.LayoutIdentity;
12319
+ };
12320
+
12302
12321
  /**
12303
12322
  * @interface
12304
12323
  */
@@ -15599,6 +15618,8 @@ declare namespace ViewEvents {
15599
15618
  BaseEvent_4 as BaseEvent,
15600
15619
  BaseViewEvent,
15601
15620
  TargetChangedEvent,
15621
+ AddedToLayoutEvent,
15622
+ RemovedFromLayoutEvent,
15602
15623
  NonPropagatedViewEvent,
15603
15624
  CreatedEvent,
15604
15625
  DestroyedEvent,
package/out/mock.js CHANGED
@@ -620,19 +620,57 @@ transportErrors.NotImplementedError = NotImplementedError;
620
620
  class NotSupportedError extends Error {
621
621
  }
622
622
  transportErrors.NotSupportedError = NotSupportedError;
623
- class InternalError extends Error {
623
+ class DeserializedError extends Error {
624
624
  constructor(err) {
625
625
  const { message, name, stack, ...rest } = err;
626
626
  super(message);
627
+ if ('cause' in err && err.cause) {
628
+ this.cause = new DeserializedError(err.cause);
629
+ }
627
630
  this.name = name || 'Error';
628
631
  this.stack = stack ?? this.toString();
629
- Object.keys(rest).forEach(key => {
632
+ Object.keys(rest)
633
+ .filter((k) => k !== 'cause')
634
+ .forEach((key) => {
630
635
  this[key] = rest[key];
631
636
  });
632
637
  }
633
638
  }
634
639
  // For documentation of the error methods being used see here: https://v8.dev/docs/stack-trace-api
635
640
  class RuntimeError extends Error {
641
+ static trimEndCallSites(err, takeUntilRegex) {
642
+ // save original props
643
+ const length = Error.stackTraceLimit;
644
+ // eslint-disable-next-line no-underscore-dangle
645
+ const _prepareStackTrace = Error.prepareStackTrace;
646
+ // This will be called when we access the `stack` property
647
+ Error.prepareStackTrace = (_, stack) => stack;
648
+ // in channel errors, the error was already serialized so we need to handle both string and CallSite[]
649
+ const isString = typeof err.stack === 'string';
650
+ const stack = (isString ? err.stack?.split('\n') : err.stack) ?? [];
651
+ // restore original props
652
+ Error.prepareStackTrace = _prepareStackTrace;
653
+ Error.stackTraceLimit = length;
654
+ // stack is optional in non chromium contexts
655
+ if (stack.length) {
656
+ const newStack = [];
657
+ // remove this call ONLY if it's not a string
658
+ for (const line of isString ? stack : stack.slice(1)) {
659
+ // inclusive take until
660
+ newStack.push(line);
661
+ if (takeUntilRegex.test(line.toString())) {
662
+ break;
663
+ }
664
+ }
665
+ if (isString) {
666
+ // maintain it as a string
667
+ err.stack = newStack.join('\n');
668
+ }
669
+ else {
670
+ err.stack = RuntimeError.prepareStackTrace(err, newStack);
671
+ }
672
+ }
673
+ }
636
674
  static getCallSite(callsToRemove = 0) {
637
675
  const length = Error.stackTraceLimit;
638
676
  const realCallsToRemove = callsToRemove + 1; // remove this call;
@@ -651,21 +689,82 @@ class RuntimeError extends Error {
651
689
  if (typeof Error.prepareStackTrace === 'function') {
652
690
  return Error.prepareStackTrace(err, callSites);
653
691
  }
654
- let string = "";
655
- string += err.name || "Error";
656
- string += `: ${err.message || ""}`;
657
- for (const callSite of callSites) {
658
- string += `\n at ${callSite.toString()}`;
659
- }
660
- return string;
661
- }
662
- ;
692
+ // TODO: this is just a first iteration, we can make this "nicer" at some point
693
+ // const EXCLUSIONS = ['IpcRenderer', 'Object.onMessage', 'Transport.onmessage', 'MessageReceiver.onmessage'];
694
+ let stackTrace = `${err.name || 'Error'}: ${err.message || ''}\n`;
695
+ stackTrace += callSites
696
+ .map((line) => ` at ${line}`)
697
+ // .filter((line) => !EXCLUSIONS.some((l) => line.includes(l)))
698
+ .join('\n');
699
+ return stackTrace;
700
+ }
701
+ /*
702
+
703
+ NON filtered stack trace example from MTP page channel-errors.tsx:
704
+
705
+ Caused by: ChannelError: Error from ch0
706
+ at ChannelClient.dispatch (<anonymous>:3:119560)
707
+ at eval (test-channel-errors.tsx:73:26)
708
+ at ChannelProvider.processAction (<anonymous>:3:116748)
709
+ at ChannelProvider.processAction (<anonymous>:3:149121)
710
+ at MessageReceiver.processChannelMessage (<anonymous>:3:131909)
711
+ at MessageReceiver.onmessage (<anonymous>:3:131232)
712
+ at Transport.onmessage (<anonymous>:3:282049)
713
+ at IpcRenderer.<anonymous> (<anonymous>:3:275150)
714
+ at IpcRenderer.emit (node:electron/js2c/sandbox_bundle:2:34834)
715
+ at Object.onMessage (node:electron/js2c/sandbox_bundle:2:51566)
716
+ Caused by: ChannelError: Error from ch0
717
+ at ChannelClient.dispatch (<anonymous>:3:119560)
718
+ at eval (test-channel-errors.tsx:73:26)
719
+ at ChannelProvider.processAction (<anonymous>:3:116748)
720
+ at ChannelProvider.processAction (<anonymous>:3:149121)
721
+ at MessageReceiver.processChannelMessage (<anonymous>:3:131909)
722
+ at MessageReceiver.onmessage (<anonymous>:3:131232)
723
+ at Transport.onmessage (<anonymous>:3:282049)
724
+ at IpcRenderer.<anonymous> (<anonymous>:3:275150)
725
+ at IpcRenderer.emit (node:electron/js2c/sandbox_bundle:2:34834)
726
+ at Object.onMessage (node:electron/js2c/sandbox_bundle:2:51566)
727
+ Caused by: ChannelError: Error from ch0
728
+ at ChannelClient.dispatch (<anonymous>:3:119560)
729
+ at eval (test-channel-errors.tsx:73:26)
730
+ at ChannelProvider.processAction (<anonymous>:3:116748)
731
+ at ChannelProvider.processAction (<anonymous>:3:149121)
732
+ at MessageReceiver.processChannelMessage (<anonymous>:3:131909)
733
+ at MessageReceiver.onmessage (<anonymous>:3:131232)
734
+ at Transport.onmessage (<anonymous>:3:282049)
735
+ at IpcRenderer.<anonymous> (<anonymous>:3:275150)
736
+ at IpcRenderer.emit (node:electron/js2c/sandbox_bundle:2:34834)
737
+ at Object.onMessage (node:electron/js2c/sandbox_bundle:2:51566)
738
+ Caused by: ChannelError: Error from ch0
739
+ at ChannelClient.dispatch (<anonymous>:3:119560)
740
+ at eval (test-channel-errors.tsx:50:23)
741
+ at ChannelProvider.processAction (<anonymous>:3:116748)
742
+ at ChannelProvider.processAction (<anonymous>:3:149121)
743
+ at MessageReceiver.processChannelMessage (<anonymous>:3:131909)
744
+ at MessageReceiver.onmessage (<anonymous>:3:131232)
745
+ at Transport.onmessage (<anonymous>:3:282049)
746
+ at IpcRenderer.<anonymous> (<anonymous>:3:275150)
747
+ at IpcRenderer.emit (node:electron/js2c/sandbox_bundle:2:34834)
748
+ at Object.onMessage (node:electron/js2c/sandbox_bundle:2:51566)
749
+ Caused by: Error: Error from ch0
750
+ at eval (test-channel-errors.tsx:54:19)
751
+ at ChannelProvider.processAction (<anonymous>:3:116748)
752
+ at ChannelProvider.processAction (<anonymous>:3:149121)
753
+ at MessageReceiver.processChannelMessage (<anonymous>:3:131909)
754
+ at MessageReceiver.onmessage (<anonymous>:3:131232)
755
+ at Transport.onmessage (<anonymous>:3:282049)
756
+ at IpcRenderer.<anonymous> (<anonymous>:3:275150)
757
+ at IpcRenderer.emit (node:electron/js2c/sandbox_bundle:2:34834)
758
+ at Object.onMessage (node:electron/js2c/sandbox_bundle:2:51566)
759
+
760
+
761
+ */
663
762
  constructor(payload, callSites) {
664
763
  const { reason, error } = payload;
665
764
  super(reason);
666
- this.name = 'RuntimeError';
765
+ this.name = this.constructor.name;
667
766
  if (error?.stack) {
668
- this.cause = new InternalError(error);
767
+ this.cause = new DeserializedError(error);
669
768
  }
670
769
  if (callSites) {
671
770
  this.stack = RuntimeError.prepareStackTrace(this, callSites);
@@ -3016,9 +3115,14 @@ function requireInstance$2 () {
3016
3115
  // don't expose
3017
3116
  });
3018
3117
  const layoutWindow = await this.getCurrentWindow();
3118
+ let layoutWindowIdentity = layoutWindow.identity;
3119
+ // TODO: CORE-1857 - when we tearout active layout or drag a view out of a window, the above identity includes the whole window info.
3120
+ if (layoutWindowIdentity.identity) {
3121
+ layoutWindowIdentity = layoutWindowIdentity.identity;
3122
+ }
3019
3123
  try {
3020
3124
  const providerChannelClient = await __classPrivateFieldGet(this, _View_providerChannelClient, "f").getValue();
3021
- const client = await layout_entities_1.LayoutNode.newLayoutEntitiesClient(providerChannelClient, layout_constants_1.LAYOUT_CONTROLLER_ID, layoutWindow.identity);
3125
+ const client = await layout_entities_1.LayoutNode.newLayoutEntitiesClient(providerChannelClient, layout_constants_1.LAYOUT_CONTROLLER_ID, layoutWindowIdentity);
3022
3126
  const layoutIdentity = await client.getLayoutIdentityForViewOrThrow(this.identity);
3023
3127
  return this.fin.Platform.Layout.wrap(layoutIdentity);
3024
3128
  }
@@ -3031,7 +3135,7 @@ function requireInstance$2 () {
3031
3135
  throw e;
3032
3136
  }
3033
3137
  // fallback logic for missing endpoint
3034
- return this.fin.Platform.Layout.wrap(layoutWindow.identity);
3138
+ return this.fin.Platform.Layout.wrap(layoutWindowIdentity);
3035
3139
  }
3036
3140
  };
3037
3141
  /**
@@ -5907,7 +6011,7 @@ function requireWindow () {
5907
6011
  Object.defineProperty(system, "__esModule", { value: true });
5908
6012
  system.System = void 0;
5909
6013
  const base_1$i = base;
5910
- const transport_errors_1$1 = transportErrors;
6014
+ const transport_errors_1$5 = transportErrors;
5911
6015
  const window_1 = requireWindow();
5912
6016
  const events_1$6 = require$$0;
5913
6017
  /**
@@ -6997,9 +7101,9 @@ class System extends base_1$i.EmitterBase {
6997
7101
  });
6998
7102
  // node.js environment not supported
6999
7103
  if (this.wire.environment.type !== 'openfin') {
7000
- throw new transport_errors_1$1.NotSupportedError('downloadAsset only supported in an OpenFin Render process');
7104
+ throw new transport_errors_1$5.NotSupportedError('downloadAsset only supported in an OpenFin Render process');
7001
7105
  }
7002
- const callSite = transport_errors_1$1.RuntimeError.getCallSite();
7106
+ const callSite = transport_errors_1$5.RuntimeError.getCallSite();
7003
7107
  const downloadId = this.wire.environment.getNextMessageId().toString();
7004
7108
  const dlProgressKey = `asset-download-progress-${downloadId}`;
7005
7109
  const dlErrorKey = `asset-download-error-${downloadId}`;
@@ -7019,7 +7123,7 @@ class System extends base_1$i.EmitterBase {
7019
7123
  const dlError = (payload) => {
7020
7124
  cleanListeners();
7021
7125
  const { reason, err: error } = payload;
7022
- reject(new transport_errors_1$1.RuntimeError({ reason, error }, callSite));
7126
+ reject(new transport_errors_1$5.RuntimeError({ reason, error }, callSite));
7023
7127
  };
7024
7128
  const dlComplete = () => {
7025
7129
  cleanListeners();
@@ -7070,11 +7174,11 @@ class System extends base_1$i.EmitterBase {
7070
7174
  * ```
7071
7175
  */
7072
7176
  downloadRuntime(options, progressListener) {
7073
- const callsites = transport_errors_1$1.RuntimeError.getCallSite();
7177
+ const callsites = transport_errors_1$5.RuntimeError.getCallSite();
7074
7178
  return new Promise((resolve, reject) => {
7075
7179
  // node.js environment not supported
7076
7180
  if (this.wire.environment.type !== 'openfin') {
7077
- reject(new transport_errors_1$1.NotSupportedError('downloadRuntime only supported in an OpenFin Render process'));
7181
+ reject(new transport_errors_1$5.NotSupportedError('downloadRuntime only supported in an OpenFin Render process'));
7078
7182
  return;
7079
7183
  }
7080
7184
  const downloadId = this.wire.environment.getNextMessageId().toString();
@@ -7096,7 +7200,7 @@ class System extends base_1$i.EmitterBase {
7096
7200
  const dlError = (payload) => {
7097
7201
  cleanListeners();
7098
7202
  const { reason, err: error } = payload;
7099
- reject(new transport_errors_1$1.RuntimeError({ reason, error }, callsites));
7203
+ reject(new transport_errors_1$5.RuntimeError({ reason, error }, callsites));
7100
7204
  };
7101
7205
  const dlComplete = () => {
7102
7206
  cleanListeners();
@@ -7831,6 +7935,7 @@ var channel = {};
7831
7935
 
7832
7936
  Object.defineProperty(channel, "__esModule", { value: true });
7833
7937
  channel.ChannelBase = channel.ProtectedItems = void 0;
7938
+ const transport_errors_1$4 = transportErrors;
7834
7939
  const resultOrPayload = (func) => async (topic, payload, senderIdentity) => {
7835
7940
  const res = await func(topic, payload, senderIdentity);
7836
7941
  return res === undefined ? payload : res;
@@ -7863,6 +7968,7 @@ class ChannelBase {
7863
7968
  return this.postAction ? await this.postAction(topic, actionProcessed, senderIdentity) : actionProcessed;
7864
7969
  }
7865
7970
  catch (e) {
7971
+ transport_errors_1$4.RuntimeError.trimEndCallSites(e, /Channel.*processAction/);
7866
7972
  if (this.errorMiddleware) {
7867
7973
  return this.errorMiddleware(topic, e, senderIdentity);
7868
7974
  }
@@ -8164,6 +8270,25 @@ class ChannelBase {
8164
8270
  }
8165
8271
  channel.ChannelBase = ChannelBase;
8166
8272
 
8273
+ var channelError = {};
8274
+
8275
+ Object.defineProperty(channelError, "__esModule", { value: true });
8276
+ channelError.ChannelError = void 0;
8277
+ const transport_errors_1$3 = transportErrors;
8278
+ class ChannelError extends Error {
8279
+ constructor(originalError, action, dispatchPayload, callsites) {
8280
+ super(originalError.message);
8281
+ this.action = action;
8282
+ this.dispatchPayload = dispatchPayload;
8283
+ this.name = this.constructor.name;
8284
+ if ('cause' in originalError && originalError.cause instanceof Error) {
8285
+ this.cause = originalError.cause;
8286
+ }
8287
+ this.stack = transport_errors_1$3.RuntimeError.prepareStackTrace(this, callsites);
8288
+ }
8289
+ }
8290
+ channelError.ChannelError = ChannelError;
8291
+
8167
8292
  var __classPrivateFieldGet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8168
8293
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
8169
8294
  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");
@@ -8178,7 +8303,9 @@ var __classPrivateFieldSet$a = (commonjsGlobal && commonjsGlobal.__classPrivateF
8178
8303
  var _ChannelClient_protectedObj, _ChannelClient_strategy, _ChannelClient_close;
8179
8304
  Object.defineProperty(client, "__esModule", { value: true });
8180
8305
  client.ChannelClient = void 0;
8306
+ const transport_errors_1$2 = transportErrors;
8181
8307
  const channel_1$1 = channel;
8308
+ const channel_error_1$1 = channelError;
8182
8309
  const channelClientsByEndpointId = new Map();
8183
8310
  /**
8184
8311
  * Instance created to enable use of a channel as a client. Allows for communication with the
@@ -8280,7 +8407,10 @@ class ChannelClient extends channel_1$1.ChannelBase {
8280
8407
  */
8281
8408
  async dispatch(action, payload) {
8282
8409
  if (__classPrivateFieldGet$c(this, _ChannelClient_strategy, "f").isEndpointConnected(this.providerIdentity.channelId)) {
8283
- return __classPrivateFieldGet$c(this, _ChannelClient_strategy, "f").send(this.providerIdentity.channelId, action, payload);
8410
+ const callSites = transport_errors_1$2.RuntimeError.getCallSite();
8411
+ return __classPrivateFieldGet$c(this, _ChannelClient_strategy, "f").send(this.providerIdentity.channelId, action, payload).catch((e) => {
8412
+ throw new channel_error_1$1.ChannelError(e, action, payload, callSites);
8413
+ });
8284
8414
  }
8285
8415
  throw new Error('The client you are trying to dispatch from is disconnected from the target provider.');
8286
8416
  }
@@ -8395,7 +8525,7 @@ class ClassicStrategy {
8395
8525
  _ClassicStrategy_endpointIdentityMap.set(this, new Map());
8396
8526
  // Store a set of cancellable promises to be able to reject them when client
8397
8527
  // connection problems occur
8398
- _ClassicStrategy_pendingMessagesByEndpointId.set(this, new Map);
8528
+ _ClassicStrategy_pendingMessagesByEndpointId.set(this, new Map());
8399
8529
  this.send = async (endpointId, action, payload) => {
8400
8530
  const to = __classPrivateFieldGet$b(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
8401
8531
  if (!to) {
@@ -8409,17 +8539,21 @@ class ClassicStrategy {
8409
8539
  }
8410
8540
  delete cleanId.isLocalEndpointId;
8411
8541
  // grab the promise before awaiting it to save in our pending messages map
8412
- const p = __classPrivateFieldGet$b(this, _ClassicStrategy_wire, "f")
8413
- .sendAction('send-channel-message', {
8542
+ const p = __classPrivateFieldGet$b(this, _ClassicStrategy_wire, "f").sendAction('send-channel-message', {
8414
8543
  ...cleanId,
8415
8544
  providerIdentity: this.providerIdentity,
8416
8545
  action,
8417
8546
  payload
8418
8547
  });
8419
8548
  __classPrivateFieldGet$b(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.add(p);
8420
- const raw = await p.catch((error) => {
8549
+ const raw = await p
8550
+ .catch((error) => {
8551
+ if ('cause' in error) {
8552
+ throw error;
8553
+ }
8421
8554
  throw new Error(error.message);
8422
- }).finally(() => {
8555
+ })
8556
+ .finally(() => {
8423
8557
  // clean up the pending promise
8424
8558
  __classPrivateFieldGet$b(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.delete(p);
8425
8559
  });
@@ -8473,13 +8607,17 @@ var errors = {};
8473
8607
  Object.defineProperty(errors, "__esModule", { value: true });
8474
8608
  errors.errorToPOJO = void 0;
8475
8609
  function errorToPOJO(error) {
8476
- return {
8610
+ const errorObj = {
8477
8611
  stack: error.stack,
8478
8612
  name: error.name,
8479
8613
  message: error.message,
8480
8614
  // support the case where stack is empty or missing
8481
8615
  toString: () => error.stack || error.toString()
8482
8616
  };
8617
+ if ('cause' in error) {
8618
+ errorObj.cause = errorToPOJO(error.cause);
8619
+ }
8620
+ return errorObj;
8483
8621
  }
8484
8622
  errors.errorToPOJO = errorToPOJO;
8485
8623
 
@@ -8498,7 +8636,7 @@ var _RTCEndpoint_processAction, _RTCEndpoint_disconnectListener;
8498
8636
  Object.defineProperty(endpoint, "__esModule", { value: true });
8499
8637
  endpoint.RTCEndpoint = void 0;
8500
8638
  /* eslint-disable @typescript-eslint/no-unused-vars */
8501
- const errors_1$1 = errors;
8639
+ const errors_1$2 = errors;
8502
8640
  /*
8503
8641
  This handles sending RTC messages between RTC connections over the request and response data channels.
8504
8642
  */
@@ -8587,7 +8725,7 @@ class RTCEndpoint {
8587
8725
  if (this.rtc.channels.response.readyState === 'open') {
8588
8726
  this.rtc.channels.response.send(JSON.stringify({
8589
8727
  messageId,
8590
- error: (0, errors_1$1.errorToPOJO)(error),
8728
+ error: (0, errors_1$2.errorToPOJO)(error),
8591
8729
  success: false
8592
8730
  }));
8593
8731
  }
@@ -8903,8 +9041,10 @@ var __classPrivateFieldSet$6 = (commonjsGlobal && commonjsGlobal.__classPrivateF
8903
9041
  var _ChannelProvider_connections, _ChannelProvider_protectedObj, _ChannelProvider_strategy, _ChannelProvider_removeEndpoint, _ChannelProvider_close;
8904
9042
  Object.defineProperty(provider, "__esModule", { value: true });
8905
9043
  provider.ChannelProvider = void 0;
8906
- const channel_1 = channel;
9044
+ const transport_errors_1$1 = transportErrors;
8907
9045
  const runtimeVersioning_1 = runtimeVersioning;
9046
+ const channel_1 = channel;
9047
+ const channel_error_1 = channelError;
8908
9048
  /**
8909
9049
  * Instance created to enable use of a channel as a provider. Allows for communication with the {@link ChannelClient ChannelClients} by invoking an action on
8910
9050
  * a single client via {@link ChannelProvider#dispatch dispatch} or all clients via {@link ChannelProvider#publish publish}
@@ -9021,7 +9161,10 @@ class ChannelProvider extends channel_1.ChannelBase {
9021
9161
  dispatch(to, action, payload) {
9022
9162
  const endpointId = to.endpointId ?? this.getEndpointIdForOpenFinId(to, action);
9023
9163
  if (endpointId && __classPrivateFieldGet$8(this, _ChannelProvider_strategy, "f").isEndpointConnected(endpointId)) {
9024
- return __classPrivateFieldGet$8(this, _ChannelProvider_strategy, "f").send(endpointId, action, payload);
9164
+ const callSites = transport_errors_1$1.RuntimeError.getCallSite();
9165
+ return __classPrivateFieldGet$8(this, _ChannelProvider_strategy, "f").send(endpointId, action, payload).catch((e) => {
9166
+ throw new channel_error_1.ChannelError(e, action, payload, callSites);
9167
+ });
9025
9168
  }
9026
9169
  return Promise.reject(new Error(`Client connection with identity uuid: ${to.uuid} / name: ${to.name} / endpointId: ${endpointId} no longer connected.`));
9027
9170
  }
@@ -9234,6 +9377,7 @@ Object.defineProperty(messageReceiver, "__esModule", { value: true });
9234
9377
  messageReceiver.MessageReceiver = void 0;
9235
9378
  const client_1$1 = client;
9236
9379
  const base_1$g = base;
9380
+ const errors_1$1 = errors;
9237
9381
  /*
9238
9382
  This is a singleton (per fin object) tasked with routing messages coming off the ipc to the correct endpoint.
9239
9383
  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.
@@ -9262,6 +9406,7 @@ class MessageReceiver extends base_1$g.Base {
9262
9406
  if (!handler) {
9263
9407
  ackToSender.payload.success = false;
9264
9408
  ackToSender.payload.reason = `Client connection with identity uuid: ${this.wire.me.uuid} / name: ${this.wire.me.name} / endpointId: ${key} no longer connected.`;
9409
+ ackToSender.payload.error = (0, errors_1$1.errorToPOJO)(new Error(ackToSender.payload.reason));
9265
9410
  return this.wire.sendRaw(ackToSender);
9266
9411
  }
9267
9412
  try {
@@ -9273,6 +9418,7 @@ class MessageReceiver extends base_1$g.Base {
9273
9418
  catch (e) {
9274
9419
  ackToSender.payload.success = false;
9275
9420
  ackToSender.payload.reason = e.message;
9421
+ ackToSender.payload.error = (0, errors_1$1.errorToPOJO)(e);
9276
9422
  return this.wire.sendRaw(ackToSender);
9277
9423
  }
9278
9424
  }
@@ -17281,7 +17427,10 @@ class Transport extends events_1$1.EventEmitter {
17281
17427
  }
17282
17428
  else {
17283
17429
  console.warn('Received invalid response from core', data);
17284
- handleNack({ reason: 'invalid response shape' });
17430
+ handleNack({
17431
+ reason: 'invalid response shape',
17432
+ error: (0, errors_1.errorToPOJO)(new Error('Invalid response shape'))
17433
+ });
17285
17434
  }
17286
17435
  }
17287
17436
  else if (!data.payload.success) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/core",
3
- "version": "40.82.3",
3
+ "version": "40.82.4",
4
4
  "description": "The core renderer entry point of OpenFin",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "main": "out/mock.js",