@openfin/core 30.73.23 → 30.73.24

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.
Files changed (77) hide show
  1. package/LICENSE.md +4 -0
  2. package/package.json +2 -2
  3. package/src/OpenFin.d.ts +1678 -188
  4. package/src/api/application/Factory.d.ts +1 -0
  5. package/src/api/application/Factory.js +1 -0
  6. package/src/api/application/Instance.d.ts +2 -1
  7. package/src/api/application/Instance.js +1 -0
  8. package/src/api/base.d.ts +16 -14
  9. package/src/api/base.js +2 -2
  10. package/src/api/clipboard/index.d.ts +1 -0
  11. package/src/api/clipboard/index.js +1 -0
  12. package/src/api/events/application.d.ts +65 -56
  13. package/src/api/events/base.d.ts +33 -15
  14. package/src/api/events/channel.d.ts +13 -8
  15. package/src/api/events/eventAggregator.js +1 -9
  16. package/src/api/events/externalApplication.d.ts +10 -5
  17. package/src/api/events/frame.d.ts +13 -7
  18. package/src/api/events/globalHotkey.d.ts +11 -12
  19. package/src/api/events/platform.d.ts +10 -16
  20. package/src/api/events/system.d.ts +41 -29
  21. package/src/api/events/typedEventEmitter.d.ts +15 -8
  22. package/src/api/events/view.d.ts +37 -54
  23. package/src/api/events/webcontents.d.ts +74 -28
  24. package/src/api/events/window.d.ts +147 -134
  25. package/src/api/external-application/Instance.d.ts +1 -1
  26. package/src/api/frame/Instance.d.ts +1 -1
  27. package/src/api/global-hotkey/index.d.ts +1 -3
  28. package/src/api/global-hotkey/index.js +6 -0
  29. package/src/api/interappbus/channel/channels-docs.d.ts +7 -0
  30. package/src/api/interappbus/channel/channels-docs.js +7 -0
  31. package/src/api/interappbus/channel/client.d.ts +2 -1
  32. package/src/api/interappbus/channel/client.js +12 -5
  33. package/src/api/interappbus/channel/index.d.ts +2 -2
  34. package/src/api/interappbus/channel/index.js +7 -7
  35. package/src/api/interappbus/channel/protocols/index.d.ts +3 -0
  36. package/src/api/interappbus/channel/protocols/rtc/endpoint.js +10 -2
  37. package/src/api/interappbus/channel/protocols/rtc/strategy.js +1 -1
  38. package/src/api/interop/Factory.d.ts +1 -2
  39. package/src/api/interop/Factory.js +20 -4
  40. package/src/api/interop/InteropBroker.d.ts +15 -47
  41. package/src/api/interop/InteropBroker.js +33 -47
  42. package/src/api/interop/InteropClient.d.ts +9 -8
  43. package/src/api/interop/InteropClient.js +9 -8
  44. package/src/api/interop/fdc3/fdc3-1.2.js +8 -8
  45. package/src/api/interop/fdc3/fdc3-2.0.d.ts +1 -1
  46. package/src/api/interop/fdc3/fdc3-2.0.js +15 -7
  47. package/src/api/interop/fdc3/fdc3.d.ts +3 -4
  48. package/src/api/interop/fdc3/overrideCheck.d.ts +4 -0
  49. package/src/api/interop/fdc3/overrideCheck.js +32 -0
  50. package/src/api/interop/fdc3/versions.d.ts +1 -0
  51. package/src/api/interop/fdc3/versions.js +2 -0
  52. package/src/api/platform/Factory.d.ts +5 -0
  53. package/src/api/platform/Factory.js +9 -0
  54. package/src/api/platform/Instance.d.ts +7 -6
  55. package/src/api/platform/Instance.js +6 -3
  56. package/src/api/platform/layout/Factory.d.ts +4 -0
  57. package/src/api/platform/layout/Factory.js +4 -0
  58. package/src/api/platform/provider.d.ts +162 -0
  59. package/src/api/platform/provider.js +2 -0
  60. package/src/api/snapshot-source/Factory.d.ts +1 -0
  61. package/src/api/snapshot-source/Factory.js +1 -0
  62. package/src/api/system/index.d.ts +1 -2
  63. package/src/api/system/index.js +22 -6
  64. package/src/api/view/Instance.d.ts +8 -4
  65. package/src/api/view/Instance.js +7 -4
  66. package/src/api/webcontents/main.d.ts +19 -5
  67. package/src/api/webcontents/main.js +10 -0
  68. package/src/api/window/Instance.d.ts +21 -3
  69. package/src/api/window/Instance.js +22 -0
  70. package/src/namespaces.d.ts +21 -0
  71. package/src/namespaces.js +24 -0
  72. package/src/transport/transport-errors.d.ts +6 -1
  73. package/src/transport/transport-errors.js +1 -2
  74. package/src/transport/transport.d.ts +10 -7
  75. package/src/transport/transport.js +9 -1
  76. package/src/util/inaccessibleObject.d.ts +2 -0
  77. package/src/util/inaccessibleObject.js +49 -0
@@ -92,6 +92,8 @@ class WebContents extends base_1.EmitterBase {
92
92
  throw new Error(`Something went wrong during onPopupReady execution: ${error}`);
93
93
  }
94
94
  };
95
+ // TODO: fix typing (internal)
96
+ // @ts-expect-error
95
97
  await this.once('popup-ready', readyListener);
96
98
  }
97
99
  const { payload: tryCreatePayload } = await this.wire.sendAction('try-create-popup-window', {
@@ -130,9 +132,17 @@ class WebContents extends base_1.EmitterBase {
130
132
  await options.onPopupResult(normalizePopupResult(payload));
131
133
  };
132
134
  const teardownListener = async () => {
135
+ // TODO: fix typing (internal)
136
+ // @ts-expect-error
133
137
  await this.removeListener('popup-result', dispatchResultListener);
134
138
  };
139
+ // TODO: fix typing (internal)
140
+ // @ts-expect-error
135
141
  await this.on('popup-result', dispatchResultListener);
142
+ // TODO: fix typing (internal)
143
+ // hilariously this does not need a ts-expect-error - this is gap in type soundness
144
+ // should investigate - probably due to `teardownListener` taking a void argument
145
+ // which might play nicely with the `never` type? huh...
136
146
  await this.once('popup-teardown', teardownListener);
137
147
  }
138
148
  const { payload } = await this.wire.sendAction('show-popup-window', {
@@ -1,8 +1,8 @@
1
1
  import type * as OpenFin from '../../OpenFin';
2
2
  import Transport from '../../transport/transport';
3
3
  import { WebContents } from '../webcontents/main';
4
- declare type WindowEvents = OpenFin.WindowEvents;
5
4
  /**
5
+ * @PORTED
6
6
  * @typedef { object } Margins
7
7
  * @property { string } [marginType]
8
8
  * Can be `default`, `none`, `printableArea`, or `custom`. If `custom` is chosen,
@@ -14,11 +14,13 @@ declare type WindowEvents = OpenFin.WindowEvents;
14
14
  * @property { number } [right] The right margin of the printed web page, in pixels.
15
15
  */
16
16
  /**
17
+ * @PORTED
17
18
  * @typedef { object } Dpi
18
19
  * @property { number } [horizontal] The horizontal dpi
19
20
  * @property { number } [vertical] The vertical dpi
20
21
  */
21
22
  /**
23
+ * @PORTED
22
24
  * @typedef { object } PrintOptions
23
25
  * @property { boolean } [silent=false] Don't ask user for print settings.
24
26
  * @property { boolean } [printBackground=false] Prints the background color and image of the web page.
@@ -35,6 +37,7 @@ declare type WindowEvents = OpenFin.WindowEvents;
35
37
  * @property { Dpi } [dpi] Set dpi for the printed web page
36
38
  */
37
39
  /**
40
+ * @REMOVED
38
41
  * PrinterInfo interface
39
42
  * @typedef { object } PrinterInfo
40
43
  * @property { string } name Printer Name
@@ -43,12 +46,14 @@ declare type WindowEvents = OpenFin.WindowEvents;
43
46
  * @property { boolean } isDefault Indicates that system's default printer
44
47
  */
45
48
  /**
49
+ * @REMOVED
46
50
  * SharedWorkerInfo interface
47
51
  * @typedef { object } SharedWorkerInfo
48
52
  * @property { string } id The unique id of the shared worker.
49
53
  * @property { string } url The url of the shared worker.
50
54
  */
51
55
  /**
56
+ * @PORTED
52
57
  * ContentCreationRule interface
53
58
  * @typedef { object } ContentCreationRule
54
59
  * @property { string } behavior 'view' | 'window' | 'browser' | 'block'
@@ -56,6 +61,7 @@ declare type WindowEvents = OpenFin.WindowEvents;
56
61
  * @property { object } options Window creation options or View creation options.
57
62
  */
58
63
  /**
64
+ * @PORTED
59
65
  * @typedef {object} Window~options
60
66
  * @summary Window creation options.
61
67
  * @desc This is the options object required by {@link Window.create Window.create}.
@@ -359,31 +365,37 @@ declare type WindowEvents = OpenFin.WindowEvents;
359
365
  * _Platform Windows Only_. Controls behavior for showing views when they are being resized by the user.
360
366
  */
361
367
  /**
368
+ * @PORTED
362
369
  * @typedef {Object} ViewVisibility _Platform Windows Only_. Controls behavior for showing views when they are being resized by the user.
363
370
  * @property {ShowViewsOnWindowResize} [showViewsOnWindowResize] Enables views to be shown when a Platform Window is being resized by the user.
364
371
  * @property {ShowViewsOnSplitterDrag} [showViewsOnSplitterDrag] Allows views to be shown when they are resized by the user dragging the splitter between layout stacks.
365
372
  * @property {ShowViewsOnTabDrag} [showViewsOnTabDrag] _Supported on Windows Operating Systems only_. Allows views to be shown when the user is dragging a tab around a layout.
366
373
  */
367
374
  /**
375
+ * @PORTED
368
376
  * @typedef {Object} ShowViewsOnWindowResize _Platform Windows Only_. Enables views to be shown when a Platform Window is being resized by the user.
369
377
  * @property {boolean} [enabled=false] Enables or disables showing Views when a Platform Window is being resized.
370
378
  * @property {number} [paintIntervalMs=0] Number of miliseconds to wait between view repaints.
371
379
  */
372
380
  /**
381
+ * @REMOVED
373
382
  * @typedef {Object} ShowViewsOnSplitterDrag _Platform Windows Only_. Allows views to be shown when they are resized by the user dragging the splitter between layout stacks.
374
383
  * @property {boolean} [enabled=false] Enables or disables showing views when the layout splitter is being dragged.
375
384
  */
376
385
  /**
386
+ * @REMOVED
377
387
  * @typedef {Object} ShowViewsOnTabDrag _Platform Windows Only_. Allows views to be shown when the user is manipulating the layout by repositioning a tab.
378
388
  * @property {boolean} [enabled=false] Enables or disables showing views when a tab is being dragged.
379
389
  */
380
390
  /**
391
+ * @PORTED
381
392
  * @typedef {object} CapturePageOptions
382
393
  * @property { Area } [area] The area of the window to be captured.
383
394
  * @property { string } [format='png'] The format of the captured image. Can be 'png', 'jpg', or 'bmp'.
384
395
  * @property { number } [quality=100] Number representing quality of JPEG image only. Between 0 - 100.
385
396
  */
386
397
  /**
398
+ * @PORTED
387
399
  * @typedef { object } Area
388
400
  * @property { number } height Area's height
389
401
  * @property { number } width Area's width
@@ -391,6 +403,7 @@ declare type WindowEvents = OpenFin.WindowEvents;
391
403
  * @property { number } y Y coordinate of area's starting point
392
404
  */
393
405
  /**
406
+ * @PORTED
394
407
  * @typedef {object} FindInPageOptions
395
408
  * @property {boolean} [forward=true] Whether to search forward or backward.
396
409
  * @property {boolean} [findNext=false] Whether to begin a new text finding session. Should be true for first requests, and false for subsequent requests. Defaults to false.
@@ -401,18 +414,21 @@ declare type WindowEvents = OpenFin.WindowEvents;
401
414
  * lowercase or non-letter. Accepts several other intra-word matches.
402
415
  */
403
416
  /**
417
+ * @REMOVED
404
418
  * @typedef {object} Transition
405
419
  * @property {Opacity} opacity - The Opacity transition
406
420
  * @property {Position} position - The Position transition
407
421
  * @property {Size} size - The Size transition
408
422
  */
409
423
  /**
424
+ * @PORTED
410
425
  * @typedef {object} TransitionOptions
411
426
  * @property {boolean} interrupt - This option interrupts the current animation. When false it pushes
412
427
  this animation onto the end of the animation queue.
413
428
  * @property {boolean} relative - Treat 'opacity' as absolute or as a delta. Defaults to false.
414
429
  */
415
430
  /**
431
+ * @PORTED
416
432
  * @typedef {object} Size
417
433
  * @property {number} duration - The total time in milliseconds this transition should take.
418
434
  * @property {boolean} relative - Treat 'opacity' as absolute or as a delta. Defaults to false.
@@ -420,6 +436,7 @@ this animation onto the end of the animation queue.
420
436
  * @property {number} height - Optional if width is present. Defaults to the window's current height.
421
437
  */
422
438
  /**
439
+ * @PORTED
423
440
  * @typedef {object} Position
424
441
  * @property {number} duration - The total time in milliseconds this transition should take.
425
442
  * @property {boolean} relative - Treat 'opacity' as absolute or as a delta. Defaults to false.
@@ -427,12 +444,14 @@ this animation onto the end of the animation queue.
427
444
  * @property {number} top - Defaults to the window's current top position in virtual screen coordinates.
428
445
  */
429
446
  /**
447
+ * @PORTED
430
448
  * @typedef {object} Opacity
431
449
  * @property {number} duration - The total time in milliseconds this transition should take.
432
450
  * @property {boolean} relative - Treat 'opacity' as absolute or as a delta. Defaults to false.
433
451
  * @property {number} opacity - This value is clamped from 0.0 to 1.0.
434
452
  */
435
453
  /**
454
+ * @REMOVED
436
455
  * Bounds is a interface that has the properties of height,
437
456
  * width, left, top which are all numbers
438
457
  * @typedef { object } Bounds
@@ -453,7 +472,7 @@ this animation onto the end of the animation queue.
453
472
  * @alias Window
454
473
  * @hideconstructor
455
474
  */
456
- export declare class _Window extends WebContents<WindowEvents> {
475
+ export declare class _Window extends WebContents<OpenFin.WindowEvent> {
457
476
  identity: OpenFin.Identity;
458
477
  constructor(wire: Transport, identity: OpenFin.Identity);
459
478
  /**
@@ -1053,4 +1072,3 @@ export declare class _Window extends WebContents<WindowEvents> {
1053
1072
  */
1054
1073
  dispatchPopupResult(data: any): Promise<void>;
1055
1074
  }
1056
- export {};
@@ -9,6 +9,7 @@ const application_1 = require("../application");
9
9
  const main_1 = require("../webcontents/main");
10
10
  const view_1 = require("../view");
11
11
  /**
12
+ * @PORTED
12
13
  * @typedef { object } Margins
13
14
  * @property { string } [marginType]
14
15
  * Can be `default`, `none`, `printableArea`, or `custom`. If `custom` is chosen,
@@ -20,11 +21,13 @@ const view_1 = require("../view");
20
21
  * @property { number } [right] The right margin of the printed web page, in pixels.
21
22
  */
22
23
  /**
24
+ * @PORTED
23
25
  * @typedef { object } Dpi
24
26
  * @property { number } [horizontal] The horizontal dpi
25
27
  * @property { number } [vertical] The vertical dpi
26
28
  */
27
29
  /**
30
+ * @PORTED
28
31
  * @typedef { object } PrintOptions
29
32
  * @property { boolean } [silent=false] Don't ask user for print settings.
30
33
  * @property { boolean } [printBackground=false] Prints the background color and image of the web page.
@@ -41,6 +44,7 @@ const view_1 = require("../view");
41
44
  * @property { Dpi } [dpi] Set dpi for the printed web page
42
45
  */
43
46
  /**
47
+ * @REMOVED
44
48
  * PrinterInfo interface
45
49
  * @typedef { object } PrinterInfo
46
50
  * @property { string } name Printer Name
@@ -49,12 +53,14 @@ const view_1 = require("../view");
49
53
  * @property { boolean } isDefault Indicates that system's default printer
50
54
  */
51
55
  /**
56
+ * @REMOVED
52
57
  * SharedWorkerInfo interface
53
58
  * @typedef { object } SharedWorkerInfo
54
59
  * @property { string } id The unique id of the shared worker.
55
60
  * @property { string } url The url of the shared worker.
56
61
  */
57
62
  /**
63
+ * @PORTED
58
64
  * ContentCreationRule interface
59
65
  * @typedef { object } ContentCreationRule
60
66
  * @property { string } behavior 'view' | 'window' | 'browser' | 'block'
@@ -62,6 +68,7 @@ const view_1 = require("../view");
62
68
  * @property { object } options Window creation options or View creation options.
63
69
  */
64
70
  /**
71
+ * @PORTED
65
72
  * @typedef {object} Window~options
66
73
  * @summary Window creation options.
67
74
  * @desc This is the options object required by {@link Window.create Window.create}.
@@ -365,31 +372,37 @@ const view_1 = require("../view");
365
372
  * _Platform Windows Only_. Controls behavior for showing views when they are being resized by the user.
366
373
  */
367
374
  /**
375
+ * @PORTED
368
376
  * @typedef {Object} ViewVisibility _Platform Windows Only_. Controls behavior for showing views when they are being resized by the user.
369
377
  * @property {ShowViewsOnWindowResize} [showViewsOnWindowResize] Enables views to be shown when a Platform Window is being resized by the user.
370
378
  * @property {ShowViewsOnSplitterDrag} [showViewsOnSplitterDrag] Allows views to be shown when they are resized by the user dragging the splitter between layout stacks.
371
379
  * @property {ShowViewsOnTabDrag} [showViewsOnTabDrag] _Supported on Windows Operating Systems only_. Allows views to be shown when the user is dragging a tab around a layout.
372
380
  */
373
381
  /**
382
+ * @PORTED
374
383
  * @typedef {Object} ShowViewsOnWindowResize _Platform Windows Only_. Enables views to be shown when a Platform Window is being resized by the user.
375
384
  * @property {boolean} [enabled=false] Enables or disables showing Views when a Platform Window is being resized.
376
385
  * @property {number} [paintIntervalMs=0] Number of miliseconds to wait between view repaints.
377
386
  */
378
387
  /**
388
+ * @REMOVED
379
389
  * @typedef {Object} ShowViewsOnSplitterDrag _Platform Windows Only_. Allows views to be shown when they are resized by the user dragging the splitter between layout stacks.
380
390
  * @property {boolean} [enabled=false] Enables or disables showing views when the layout splitter is being dragged.
381
391
  */
382
392
  /**
393
+ * @REMOVED
383
394
  * @typedef {Object} ShowViewsOnTabDrag _Platform Windows Only_. Allows views to be shown when the user is manipulating the layout by repositioning a tab.
384
395
  * @property {boolean} [enabled=false] Enables or disables showing views when a tab is being dragged.
385
396
  */
386
397
  /**
398
+ * @PORTED
387
399
  * @typedef {object} CapturePageOptions
388
400
  * @property { Area } [area] The area of the window to be captured.
389
401
  * @property { string } [format='png'] The format of the captured image. Can be 'png', 'jpg', or 'bmp'.
390
402
  * @property { number } [quality=100] Number representing quality of JPEG image only. Between 0 - 100.
391
403
  */
392
404
  /**
405
+ * @PORTED
393
406
  * @typedef { object } Area
394
407
  * @property { number } height Area's height
395
408
  * @property { number } width Area's width
@@ -397,6 +410,7 @@ const view_1 = require("../view");
397
410
  * @property { number } y Y coordinate of area's starting point
398
411
  */
399
412
  /**
413
+ * @PORTED
400
414
  * @typedef {object} FindInPageOptions
401
415
  * @property {boolean} [forward=true] Whether to search forward or backward.
402
416
  * @property {boolean} [findNext=false] Whether to begin a new text finding session. Should be true for first requests, and false for subsequent requests. Defaults to false.
@@ -407,18 +421,21 @@ const view_1 = require("../view");
407
421
  * lowercase or non-letter. Accepts several other intra-word matches.
408
422
  */
409
423
  /**
424
+ * @REMOVED
410
425
  * @typedef {object} Transition
411
426
  * @property {Opacity} opacity - The Opacity transition
412
427
  * @property {Position} position - The Position transition
413
428
  * @property {Size} size - The Size transition
414
429
  */
415
430
  /**
431
+ * @PORTED
416
432
  * @typedef {object} TransitionOptions
417
433
  * @property {boolean} interrupt - This option interrupts the current animation. When false it pushes
418
434
  this animation onto the end of the animation queue.
419
435
  * @property {boolean} relative - Treat 'opacity' as absolute or as a delta. Defaults to false.
420
436
  */
421
437
  /**
438
+ * @PORTED
422
439
  * @typedef {object} Size
423
440
  * @property {number} duration - The total time in milliseconds this transition should take.
424
441
  * @property {boolean} relative - Treat 'opacity' as absolute or as a delta. Defaults to false.
@@ -426,6 +443,7 @@ this animation onto the end of the animation queue.
426
443
  * @property {number} height - Optional if width is present. Defaults to the window's current height.
427
444
  */
428
445
  /**
446
+ * @PORTED
429
447
  * @typedef {object} Position
430
448
  * @property {number} duration - The total time in milliseconds this transition should take.
431
449
  * @property {boolean} relative - Treat 'opacity' as absolute or as a delta. Defaults to false.
@@ -433,12 +451,14 @@ this animation onto the end of the animation queue.
433
451
  * @property {number} top - Defaults to the window's current top position in virtual screen coordinates.
434
452
  */
435
453
  /**
454
+ * @PORTED
436
455
  * @typedef {object} Opacity
437
456
  * @property {number} duration - The total time in milliseconds this transition should take.
438
457
  * @property {boolean} relative - Treat 'opacity' as absolute or as a delta. Defaults to false.
439
458
  * @property {number} opacity - This value is clamped from 0.0 to 1.0.
440
459
  */
441
460
  /**
461
+ * @REMOVED
442
462
  * Bounds is a interface that has the properties of height,
443
463
  * width, left, top which are all numbers
444
464
  * @typedef { object } Bounds
@@ -719,6 +739,8 @@ class _Window extends main_1.WebContents {
719
739
  const CONSTRUCTOR_CB_TOPIC = 'fire-constructor-callback';
720
740
  // need to call pageResponse, otherwise when a child window is created, page is not loaded
721
741
  const pageResponse = new Promise((resolve) => {
742
+ // TODO: fix typing (internal)
743
+ // @ts-expect-error
722
744
  this.on(CONSTRUCTOR_CB_TOPIC, function fireConstructor(response) {
723
745
  let cbPayload;
724
746
  const { success } = response;
@@ -0,0 +1,21 @@
1
+ export * as OpenFin from './OpenFin';
2
+ export * as Application from './api/application';
3
+ export * as ExternalApplication from './api/external-application';
4
+ export * as Frame from './api/frame';
5
+ export * as Interop from './api/interop';
6
+ export * as InteropBroker from './api/interop/InteropBroker';
7
+ export * as InteropClient from './api/interop/InteropClient';
8
+ export * as InterApplicationBus from './api/interappbus';
9
+ export * as Channel from './api/interappbus/channel';
10
+ export * as ChannelProvider from './api/interappbus/channel/provider';
11
+ export * as ChannelClient from './api/interappbus/channel/client';
12
+ export * as Platform from './api/platform';
13
+ export * as PlatformProvider from './api/platform/provider';
14
+ export * as Layout from './api/platform/layout';
15
+ export * as View from './api/view';
16
+ export * as Window from './api/window';
17
+ export * as SnapshotSource from './api/snapshot-source';
18
+ export * as GlobalHotkey from './api/global-hotkey';
19
+ export * as Clipboard from './api/clipboard';
20
+ export * as Fin from './api/fin';
21
+ export * as System from './api/system';
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.System = exports.Fin = exports.Clipboard = exports.GlobalHotkey = exports.SnapshotSource = exports.Window = exports.View = exports.Layout = exports.PlatformProvider = exports.Platform = exports.ChannelClient = exports.ChannelProvider = exports.Channel = exports.InterApplicationBus = exports.InteropClient = exports.InteropBroker = exports.Interop = exports.Frame = exports.ExternalApplication = exports.Application = exports.OpenFin = void 0;
4
+ exports.OpenFin = require("./OpenFin");
5
+ exports.Application = require("./api/application");
6
+ exports.ExternalApplication = require("./api/external-application");
7
+ exports.Frame = require("./api/frame");
8
+ exports.Interop = require("./api/interop");
9
+ exports.InteropBroker = require("./api/interop/InteropBroker");
10
+ exports.InteropClient = require("./api/interop/InteropClient");
11
+ exports.InterApplicationBus = require("./api/interappbus");
12
+ exports.Channel = require("./api/interappbus/channel");
13
+ exports.ChannelProvider = require("./api/interappbus/channel/provider");
14
+ exports.ChannelClient = require("./api/interappbus/channel/client");
15
+ exports.Platform = require("./api/platform");
16
+ exports.PlatformProvider = require("./api/platform/provider");
17
+ exports.Layout = require("./api/platform/layout");
18
+ exports.View = require("./api/view");
19
+ exports.Window = require("./api/window");
20
+ exports.SnapshotSource = require("./api/snapshot-source");
21
+ exports.GlobalHotkey = require("./api/global-hotkey");
22
+ exports.Clipboard = require("./api/clipboard");
23
+ exports.Fin = require("./api/fin");
24
+ exports.System = require("./api/system");
@@ -1,3 +1,4 @@
1
+ import { ErrorPlainObject } from '../util/errors';
1
2
  export declare type ReadyState = 'CONNECTING' | 'OPEN' | 'CLOSING' | 'CLOSED';
2
3
  export declare class DisconnectedError extends Error {
3
4
  constructor(readyState: ReadyState);
@@ -13,6 +14,10 @@ export declare class NotImplementedError extends Error {
13
14
  }
14
15
  export declare class NotSupportedError extends Error {
15
16
  }
17
+ export declare type RuntimeErrorPayload = {
18
+ reason: string;
19
+ error?: ErrorPlainObject;
20
+ };
16
21
  export declare class RuntimeError extends Error {
17
- constructor(data: any);
22
+ constructor(payload: RuntimeErrorPayload);
18
23
  }
@@ -24,8 +24,7 @@ class NotSupportedError extends Error {
24
24
  }
25
25
  exports.NotSupportedError = NotSupportedError;
26
26
  class RuntimeError extends Error {
27
- constructor(data) {
28
- const payload = data.payload || data;
27
+ constructor(payload) {
29
28
  const { reason, error } = payload;
30
29
  super(reason);
31
30
  this.name = 'RuntimeError';
@@ -3,10 +3,11 @@ import { EventEmitter } from 'events';
3
3
  import type * as OpenFin from '../OpenFin';
4
4
  import { ExistingConnectConfig, InternalConnectConfig, RemoteConfig, Wire, WireConstructor } from './wire';
5
5
  import { Environment } from '../environment/environment';
6
- import { RuntimeEvent } from '../api/events/base';
7
6
  import EventAggregator from '../api/events/eventAggregator';
8
7
  import { EntityTypeHelpers } from '../api/me';
9
8
  import { ProtocolMap } from '../shapes/protocol';
9
+ import { NamedEvent } from '../api/events/base';
10
+ import { ErrorPlainObject } from '../util/errors';
10
11
  declare type EntityType = OpenFin.EntityType;
11
12
  export declare type MessageHandler = (data: any) => boolean;
12
13
  declare class Transport<MeType extends EntityType = EntityType> extends EventEmitter {
@@ -45,14 +46,16 @@ export interface Message<T> {
45
46
  payload: T;
46
47
  correlationId?: number;
47
48
  }
48
- export interface EventMessage extends Message<RuntimeEvent> {
49
+ export interface EventMessage extends Message<NamedEvent> {
49
50
  action: 'process-desktop-event';
50
- payload: RuntimeEvent;
51
- }
52
- export interface Payload {
53
- success: boolean;
54
- data: any;
51
+ payload: NamedEvent;
55
52
  }
53
+ export declare type Payload<Success extends boolean = boolean, Data = any> = {
54
+ success: Success;
55
+ data: Success extends true ? Data : never;
56
+ reason: Success extends false ? string : never;
57
+ error?: Success extends false ? ErrorPlainObject | undefined : never;
58
+ };
56
59
  export interface AuthorizationPayload {
57
60
  token: string;
58
61
  file: string;
@@ -168,7 +168,15 @@ class Transport extends events_1.EventEmitter {
168
168
  reject(new transport_errors_1.NoAckError(data.action));
169
169
  }
170
170
  else if (!('payload' in data)) {
171
- reject(new transport_errors_1.RuntimeError(data));
171
+ // 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.
172
+ // @ts-expect-error
173
+ if (typeof data.reason === 'string') {
174
+ reject(new transport_errors_1.RuntimeError(data));
175
+ }
176
+ else {
177
+ console.warn('Received invalid response from core', data);
178
+ reject(new Error('Invalid response'));
179
+ }
172
180
  }
173
181
  else if (!data.payload.success) {
174
182
  reject(new transport_errors_1.RuntimeError(data.payload));
@@ -0,0 +1,2 @@
1
+ export declare function createUnusableObject(message: string): Record<any, never>;
2
+ export declare function createWarningObject<T extends {}>(message: string, obj: T): T;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createWarningObject = exports.createUnusableObject = void 0;
4
+ function createUnusableObject(message) {
5
+ const handle = () => {
6
+ throw new Error(message);
7
+ };
8
+ return new Proxy({}, {
9
+ apply: handle,
10
+ construct: handle,
11
+ defineProperty: handle,
12
+ deleteProperty: handle,
13
+ get: handle,
14
+ getOwnPropertyDescriptor: handle,
15
+ getPrototypeOf: handle,
16
+ has: handle,
17
+ isExtensible: handle,
18
+ ownKeys: handle,
19
+ preventExtensions: handle,
20
+ set: handle,
21
+ setPrototypeOf: handle
22
+ });
23
+ }
24
+ exports.createUnusableObject = createUnusableObject;
25
+ function createWarningObject(message, obj) {
26
+ return new Proxy(obj, {
27
+ get: (...args) => {
28
+ // eslint-disable-next-line no-console
29
+ console.warn(message);
30
+ return Reflect.get(...args);
31
+ },
32
+ set: (...args) => {
33
+ // eslint-disable-next-line no-console
34
+ console.warn(message);
35
+ return Reflect.set(...args);
36
+ },
37
+ getOwnPropertyDescriptor: (...args) => {
38
+ // eslint-disable-next-line no-console
39
+ console.warn(message);
40
+ return Reflect.getOwnPropertyDescriptor(...args);
41
+ },
42
+ ownKeys: (...args) => {
43
+ // eslint-disable-next-line no-console
44
+ console.warn(message);
45
+ return Reflect.ownKeys(...args);
46
+ }
47
+ });
48
+ }
49
+ exports.createWarningObject = createWarningObject;