@openfin/node-adapter 36.78.13 → 36.78.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.
@@ -4946,7 +4946,7 @@ declare class EmitterBase<EmitterEvent extends BaseEvent, EmitterEventType exten
4946
4946
  private getOrCreateEmitter;
4947
4947
  listeners: (type: string | symbol) => Function[];
4948
4948
  listenerCount: (type: string | symbol) => number;
4949
- protected registerEventListener: (eventType: EmitterEventType, options: OpenFin.SubscriptionOptions, applySubscription: (emitter: EventEmitter) => void, undoSubscription: (emitter: EventEmitter) => void) => Promise<void>;
4949
+ protected registerEventListener: (eventType: EmitterEventType, options: OpenFin.SubscriptionOptions | undefined, applySubscription: (emitter: EventEmitter) => void, undoSubscription: (emitter: EventEmitter) => void) => Promise<void>;
4950
4950
  protected deregisterEventListener: (eventType: EmitterEventType, options?: OpenFin.SubscriptionOptions) => Promise<void | EventEmitter>;
4951
4951
  /**
4952
4952
  * Adds a listener to the end of the listeners array for the specified event.
@@ -6465,7 +6465,7 @@ declare type Hotkey = {
6465
6465
  * @remarks For reference on keyboard event properties see [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent).
6466
6466
  * @interface
6467
6467
  */
6468
- declare type HotkeyEvent = BaseEvent_4 & {
6468
+ declare type HotkeyEvent = InputEvent_2 & BaseEvent_4 & {
6469
6469
  type: 'hotkey';
6470
6470
  };
6471
6471
 
@@ -9652,7 +9652,7 @@ declare type MutableWindowOptions = {
9652
9652
  showTaskbarIcon: boolean;
9653
9653
  interop: InteropConfig;
9654
9654
  /* Excluded from this release type: _internalWorkspaceData */
9655
- workspacePlatform: unknown;
9655
+ /* Excluded from this release type: workspacePlatform */
9656
9656
  };
9657
9657
 
9658
9658
  declare type NackHandler = (payloadOrMessage: RuntimeErrorPayload | string) => void;
@@ -18150,7 +18150,7 @@ declare class _Window extends WebContents<OpenFin.WindowEvent> {
18150
18150
  * })
18151
18151
  * ```
18152
18152
  *
18153
- * Overriding the built in context menu (ote that this can be done per element or document wide):
18153
+ * Overriding the built in context menu (note: that this can be done per element or document wide):
18154
18154
  * ```js
18155
18155
  * document.addEventListener('contextmenu', e => {
18156
18156
  * e.preventDefault();
@@ -4946,7 +4946,7 @@ declare class EmitterBase<EmitterEvent extends BaseEvent, EmitterEventType exten
4946
4946
  private getOrCreateEmitter;
4947
4947
  listeners: (type: string | symbol) => Function[];
4948
4948
  listenerCount: (type: string | symbol) => number;
4949
- protected registerEventListener: (eventType: EmitterEventType, options: OpenFin.SubscriptionOptions, applySubscription: (emitter: EventEmitter) => void, undoSubscription: (emitter: EventEmitter) => void) => Promise<void>;
4949
+ protected registerEventListener: (eventType: EmitterEventType, options: OpenFin.SubscriptionOptions | undefined, applySubscription: (emitter: EventEmitter) => void, undoSubscription: (emitter: EventEmitter) => void) => Promise<void>;
4950
4950
  protected deregisterEventListener: (eventType: EmitterEventType, options?: OpenFin.SubscriptionOptions) => Promise<void | EventEmitter>;
4951
4951
  /**
4952
4952
  * Adds a listener to the end of the listeners array for the specified event.
@@ -6465,7 +6465,7 @@ declare type Hotkey = {
6465
6465
  * @remarks For reference on keyboard event properties see [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent).
6466
6466
  * @interface
6467
6467
  */
6468
- declare type HotkeyEvent = BaseEvent_4 & {
6468
+ declare type HotkeyEvent = InputEvent_2 & BaseEvent_4 & {
6469
6469
  type: 'hotkey';
6470
6470
  };
6471
6471
 
@@ -9652,7 +9652,7 @@ declare type MutableWindowOptions = {
9652
9652
  showTaskbarIcon: boolean;
9653
9653
  interop: InteropConfig;
9654
9654
  /* Excluded from this release type: _internalWorkspaceData */
9655
- workspacePlatform: unknown;
9655
+ /* Excluded from this release type: workspacePlatform */
9656
9656
  };
9657
9657
 
9658
9658
  declare type NackHandler = (payloadOrMessage: RuntimeErrorPayload | string) => void;
@@ -18150,7 +18150,7 @@ declare class _Window extends WebContents<OpenFin.WindowEvent> {
18150
18150
  * })
18151
18151
  * ```
18152
18152
  *
18153
- * Overriding the built in context menu (ote that this can be done per element or document wide):
18153
+ * Overriding the built in context menu (note: that this can be done per element or document wide):
18154
18154
  * ```js
18155
18155
  * document.addEventListener('contextmenu', e => {
18156
18156
  * e.preventDefault();
@@ -4946,7 +4946,7 @@ declare class EmitterBase<EmitterEvent extends BaseEvent, EmitterEventType exten
4946
4946
  private getOrCreateEmitter;
4947
4947
  listeners: (type: string | symbol) => Function[];
4948
4948
  listenerCount: (type: string | symbol) => number;
4949
- protected registerEventListener: (eventType: EmitterEventType, options: OpenFin.SubscriptionOptions, applySubscription: (emitter: EventEmitter) => void, undoSubscription: (emitter: EventEmitter) => void) => Promise<void>;
4949
+ protected registerEventListener: (eventType: EmitterEventType, options: OpenFin.SubscriptionOptions | undefined, applySubscription: (emitter: EventEmitter) => void, undoSubscription: (emitter: EventEmitter) => void) => Promise<void>;
4950
4950
  protected deregisterEventListener: (eventType: EmitterEventType, options?: OpenFin.SubscriptionOptions) => Promise<void | EventEmitter>;
4951
4951
  /**
4952
4952
  * Adds a listener to the end of the listeners array for the specified event.
@@ -6465,7 +6465,7 @@ declare type Hotkey = {
6465
6465
  * @remarks For reference on keyboard event properties see [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent).
6466
6466
  * @interface
6467
6467
  */
6468
- declare type HotkeyEvent = BaseEvent_4 & {
6468
+ declare type HotkeyEvent = InputEvent_2 & BaseEvent_4 & {
6469
6469
  type: 'hotkey';
6470
6470
  };
6471
6471
 
@@ -9652,7 +9652,7 @@ declare type MutableWindowOptions = {
9652
9652
  showTaskbarIcon: boolean;
9653
9653
  interop: InteropConfig;
9654
9654
  /* Excluded from this release type: _internalWorkspaceData */
9655
- workspacePlatform: unknown;
9655
+ /* Excluded from this release type: workspacePlatform */
9656
9656
  };
9657
9657
 
9658
9658
  declare type NackHandler = (payloadOrMessage: RuntimeErrorPayload | string) => void;
@@ -18150,7 +18150,7 @@ declare class _Window extends WebContents<OpenFin.WindowEvent> {
18150
18150
  * })
18151
18151
  * ```
18152
18152
  *
18153
- * Overriding the built in context menu (ote that this can be done per element or document wide):
18153
+ * Overriding the built in context menu (note: that this can be done per element or document wide):
18154
18154
  * ```js
18155
18155
  * document.addEventListener('contextmenu', e => {
18156
18156
  * e.preventDefault();
@@ -4994,7 +4994,7 @@ declare class EmitterBase<EmitterEvent extends BaseEvent, EmitterEventType exten
4994
4994
  private getOrCreateEmitter;
4995
4995
  listeners: (type: string | symbol) => Function[];
4996
4996
  listenerCount: (type: string | symbol) => number;
4997
- protected registerEventListener: (eventType: EmitterEventType, options: OpenFin.SubscriptionOptions, applySubscription: (emitter: EventEmitter) => void, undoSubscription: (emitter: EventEmitter) => void) => Promise<void>;
4997
+ protected registerEventListener: (eventType: EmitterEventType, options: OpenFin.SubscriptionOptions | undefined, applySubscription: (emitter: EventEmitter) => void, undoSubscription: (emitter: EventEmitter) => void) => Promise<void>;
4998
4998
  protected deregisterEventListener: (eventType: EmitterEventType, options?: OpenFin.SubscriptionOptions) => Promise<void | EventEmitter>;
4999
4999
  /**
5000
5000
  * Adds a listener to the end of the listeners array for the specified event.
@@ -6562,7 +6562,7 @@ declare type Hotkey = {
6562
6562
  * @remarks For reference on keyboard event properties see [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent).
6563
6563
  * @interface
6564
6564
  */
6565
- declare type HotkeyEvent = BaseEvent_4 & {
6565
+ declare type HotkeyEvent = InputEvent_2 & BaseEvent_4 & {
6566
6566
  type: 'hotkey';
6567
6567
  };
6568
6568
 
@@ -9959,7 +9959,11 @@ declare type MutableWindowOptions = {
9959
9959
  * Used by Workspace to store custom data. Overwriting or modifying this field may impact the functionality of Workspace
9960
9960
  */
9961
9961
  _internalWorkspaceData: any;
9962
- workspacePlatform: unknown;
9962
+ /**
9963
+ * @internal
9964
+ * Used by workspace to stork platform specific options. Overwriting or modifying this field may impact the functionality of Workspace
9965
+ */
9966
+ workspacePlatform: WorkspacePlatformOptions;
9963
9967
  };
9964
9968
 
9965
9969
  declare type NackHandler = (payloadOrMessage: RuntimeErrorPayload | string) => void;
@@ -18602,7 +18606,7 @@ declare class _Window extends WebContents<OpenFin.WindowEvent> {
18602
18606
  * })
18603
18607
  * ```
18604
18608
  *
18605
- * Overriding the built in context menu (ote that this can be done per element or document wide):
18609
+ * Overriding the built in context menu (note: that this can be done per element or document wide):
18606
18610
  * ```js
18607
18611
  * document.addEventListener('contextmenu', e => {
18608
18612
  * e.preventDefault();
@@ -5254,7 +5254,7 @@ function requireInstance () {
5254
5254
  * })
5255
5255
  * ```
5256
5256
  *
5257
- * Overriding the built in context menu (ote that this can be done per element or document wide):
5257
+ * Overriding the built in context menu (note: that this can be done per element or document wide):
5258
5258
  * ```js
5259
5259
  * document.addEventListener('contextmenu', e => {
5260
5260
  * e.preventDefault();
@@ -15472,16 +15472,29 @@ var http = {};
15472
15472
  return options;
15473
15473
  };
15474
15474
  exports.getRequestOptions = getRequestOptions;
15475
+ function protocolFromUrl(url) {
15476
+ const parsed = (0, node_url_1.parse)(url);
15477
+ if (!parsed.protocol) {
15478
+ throw new Error(`Invalid protocol for url ${url}`);
15479
+ }
15480
+ return parsed.protocol.slice(0, -1) === 'http' ? 'http' : 'https';
15481
+ }
15475
15482
  const fetch = async (url) => {
15476
15483
  var _a;
15477
- const requestUrl = getProxyVar() ? getProxyVar() : url;
15478
- const proto = (0, node_url_1.parse)(requestUrl).protocol.slice(0, -1) === 'http' ? 'http' : 'https';
15479
- const fetcher = await (_a = proto, Promise.resolve().then(() => require(_a)));
15484
+ const requestUrl = getProxyVar() ?? url;
15485
+ const proto = protocolFromUrl(requestUrl);
15486
+ const fetcher = (await (_a = proto, Promise.resolve().then(() => require(_a))));
15480
15487
  return new Promise((resolve, reject) => {
15481
15488
  const options = (0, exports.getRequestOptions)(url);
15482
15489
  const request = fetcher.get(options, (response) => {
15490
+ if (!response) {
15491
+ reject(new Error(`Failed to load url: ${url}, no response`));
15492
+ return;
15493
+ }
15494
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
15483
15495
  if (response.statusCode < 200 || response.statusCode > 299) {
15484
15496
  reject(new Error(`Failed to load url: ${url}, status code:${response.statusCode}`));
15497
+ return;
15485
15498
  }
15486
15499
  const body = [];
15487
15500
  response.on('data', (chunk) => {
@@ -15497,8 +15510,8 @@ var http = {};
15497
15510
  exports.fetch = fetch;
15498
15511
  const downloadFile = async (url, writeLocation) => {
15499
15512
  var _a;
15500
- const requestUrl = getProxyVar() ? getProxyVar() : url;
15501
- const proto = (0, node_url_1.parse)(requestUrl).protocol.slice(0, -1) === 'http' ? 'http' : 'https';
15513
+ const requestUrl = getProxyVar() ?? url;
15514
+ const proto = protocolFromUrl(requestUrl);
15502
15515
  const fetcher = await (_a = proto, Promise.resolve().then(() => require(_a)));
15503
15516
  return new Promise((resolve, reject) => {
15504
15517
  try {
@@ -15650,6 +15663,7 @@ function launchRVM(config, manifestLocation, namedPipeName, rvm) {
15650
15663
  return (0, child_process_1.spawn)(rvm, rvmArgs, { stdio: ['pipe', 'ignore', 'pipe'], detached: true });
15651
15664
  }
15652
15665
  async function checkRvmPath() {
15666
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
15653
15667
  let rvmPath = path.resolve(process.env.LOCALAPPDATA, 'OpenFin', 'OpenFinRVM.exe');
15654
15668
  if (!(await (0, util_1.exists)(rvmPath))) {
15655
15669
  rvmPath = path.join(__dirname, '..', 'resources', 'win', 'OpenFinRVM.exe');
@@ -15744,7 +15758,7 @@ function requireNixLaunch () {
15744
15758
  const url = getUrl(version, osConfig.urlPath);
15745
15759
  const tmp = 'tmp';
15746
15760
  await (0, util_1.rmDir)(folder, false);
15747
- await mkdir(path.join(folder, tmp)).catch((e) => {
15761
+ await mkdir(path.join(folder, tmp)).catch(() => {
15748
15762
  // empty block
15749
15763
  });
15750
15764
  const file = path.join(folder, tmp, 'tmp');
@@ -15760,6 +15774,7 @@ function requireNixLaunch () {
15760
15774
  }
15761
15775
  const versionPath = ['OpenFin', 'Runtime', version];
15762
15776
  const { HOME } = process.env;
15777
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
15763
15778
  return (0, util_1.resolveDir)(HOME, versionPath);
15764
15779
  }
15765
15780
  nixLaunch.getRuntimePath = getRuntimePath;
@@ -15777,7 +15792,7 @@ function requireNixLaunch () {
15777
15792
  downloads[version] = download(version, rtFolder, osConfig);
15778
15793
  }
15779
15794
  await downloads[version];
15780
- downloads[version] = undefined;
15795
+ delete downloads[version];
15781
15796
  }
15782
15797
  catch (err) {
15783
15798
  console.error(`Failed to download, attempting to empty ${rtFolder}`);
@@ -16061,7 +16076,7 @@ function requirePortDiscovery () {
16061
16076
  openfin.on('error', (err) => {
16062
16077
  throw err;
16063
16078
  });
16064
- if (this.savedConfig.runtime.verboseLogging) {
16079
+ if (this.savedConfig.runtime.verboseLogging && openfin.stdout && openfin.stderr) {
16065
16080
  openfin.stdout.pipe(process.stdout);
16066
16081
  openfin.stderr.pipe(process.stderr);
16067
16082
  }
@@ -16073,17 +16088,13 @@ function requirePortDiscovery () {
16073
16088
  })(),
16074
16089
  mPromise
16075
16090
  ]);
16076
- if (matchRuntimeInstance(this.savedConfig, msg)) {
16077
- this.cleanup();
16078
- return msg.port;
16079
- }
16080
- console.warn('Port Discovery did not match runtime instance');
16091
+ this.cleanup();
16092
+ return msg.port;
16081
16093
  }
16082
16094
  catch (reason) {
16083
16095
  this.cleanup();
16084
16096
  throw reason;
16085
16097
  }
16086
- return undefined;
16087
16098
  }
16088
16099
  createDiscoveryNamedPipe() {
16089
16100
  return new Promise((resolve, reject) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/node-adapter",
3
- "version": "36.78.13",
3
+ "version": "36.78.17",
4
4
  "description": "See README.md",
5
5
  "main": "out/node-adapter.js",
6
6
  "types": "out/node-adapter.d.ts",