@openfin/node-adapter 42.102.4 → 42.103.1

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 (2) hide show
  1. package/out/node-adapter.js +1179 -1192
  2. package/package.json +2 -2
@@ -44,35 +44,6 @@ var system = {};
44
44
 
45
45
  var base = {};
46
46
 
47
- var promises = {};
48
-
49
- Object.defineProperty(promises, "__esModule", { value: true });
50
- promises.promiseMapSerial = promises.serial = promiseMap_1 = promises.promiseMap = promisify_1 = promises.promisify = void 0;
51
- function promisify(func) {
52
- return (...args) => new Promise((resolve, reject) => {
53
- func(...args, (err, val) => (err ? reject(err) : resolve(val)));
54
- });
55
- }
56
- var promisify_1 = promises.promisify = promisify;
57
- async function promiseMap(arr, asyncF) {
58
- return Promise.all(arr.map(asyncF));
59
- }
60
- var promiseMap_1 = promises.promiseMap = promiseMap;
61
- async function serial(arr) {
62
- const ret = [];
63
- for (const func of arr) {
64
- // eslint-disable-next-line no-await-in-loop
65
- const next = await func();
66
- ret.push(next);
67
- }
68
- return ret;
69
- }
70
- promises.serial = serial;
71
- async function promiseMapSerial(arr, func) {
72
- return serial(arr.map((value, index, array) => () => func(value, index, array)));
73
- }
74
- promises.promiseMapSerial = promiseMapSerial;
75
-
76
47
  var __classPrivateFieldSet$h = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
77
48
  if (kind === "m") throw new TypeError("Private method is not writable");
78
49
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
@@ -87,7 +58,6 @@ var __classPrivateFieldGet$i = (commonjsGlobal && commonjsGlobal.__classPrivateF
87
58
  var _EmitterBase_emitterAccessor, _EmitterBase_deregisterOnceListeners;
88
59
  Object.defineProperty(base, "__esModule", { value: true });
89
60
  base.Reply = base.EmitterBase = base.Base = void 0;
90
- const promises_1 = promises;
91
61
  class Base {
92
62
  /**
93
63
  * @internal
@@ -165,27 +135,8 @@ class EmitterBase extends Base {
165
135
  return this.hasEmitter() ? this.getOrCreateEmitter().emit(eventType, payload, ...args) : false;
166
136
  };
167
137
  this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
168
- /**
169
- * Cleans up after removal of a listener, e.g. deleting any lingering deregistration handlers for a
170
- * `once` subscription.
171
- *
172
- * @remarks Implementing this as a `removeListener` handler ensures that direct removal of a listener
173
- * on the base emitter will not leak additional core handlers. We could do this in the forwarding method,
174
- * which would involve less "magic," but would be more-vulnerable to accidental re-introduction of a leak.
175
- */
176
- this.cleanUpRemovedListener = (eventType, listener) => {
177
- const deregister = __classPrivateFieldGet$i(this, _EmitterBase_deregisterOnceListeners, "f").get(listener);
178
- if (deregister) {
179
- const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
180
- emitter.removeListener(eventType, deregister);
181
- }
182
- };
183
138
  this.getOrCreateEmitter = () => {
184
- const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
185
- if (!emitter.listeners('removeListener').includes(this.cleanUpRemovedListener)) {
186
- emitter.on('removeListener', this.cleanUpRemovedListener);
187
- }
188
- return emitter;
139
+ return this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
189
140
  };
190
141
  this.listeners = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(type) : [];
191
142
  this.listenerCount = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listenerCount(type) : 0;
@@ -225,7 +176,6 @@ class EmitterBase extends Base {
225
176
  };
226
177
  __classPrivateFieldSet$h(this, _EmitterBase_emitterAccessor, [topic, ...additionalAccessors], "f");
227
178
  __classPrivateFieldSet$h(this, _EmitterBase_deregisterOnceListeners, new WeakMap(), "f");
228
- this.listeners = (event) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(event) : [];
229
179
  }
230
180
  /**
231
181
  * Adds a listener to the end of the listeners array for the specified event.
@@ -303,6 +253,10 @@ class EmitterBase extends Base {
303
253
  const emitter = await this.deregisterEventListener(eventType, options);
304
254
  if (emitter) {
305
255
  emitter.removeListener(eventType, listener);
256
+ const deregister = __classPrivateFieldGet$i(this, _EmitterBase_deregisterOnceListeners, "f").get(listener);
257
+ if (deregister) {
258
+ emitter.removeListener(eventType, deregister);
259
+ }
306
260
  this.deleteEmitterIfNothingRegistered(emitter);
307
261
  }
308
262
  return this;
@@ -338,12 +292,13 @@ class EmitterBase extends Base {
338
292
  }
339
293
  else if (this.hasEmitter()) {
340
294
  const events = this.getOrCreateEmitter().eventNames();
341
- await (0, promises_1.promiseMap)(events, removeByEvent);
295
+ await Promise.all(events.map(removeByEvent));
342
296
  }
343
297
  return this;
344
298
  }
345
299
  deleteEmitterIfNothingRegistered(emitter) {
346
- if (emitter.eventNames().every((type) => type === 'removeListener')) {
300
+ // TODO: maybe emitterMap should clean up itself..
301
+ if (emitter.eventNames().length === 0) {
347
302
  this.wire.eventAggregator.delete(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
348
303
  }
349
304
  }
@@ -576,11 +531,11 @@ const handleDeprecatedWarnings = (options) => {
576
531
  };
577
532
  warnings.handleDeprecatedWarnings = handleDeprecatedWarnings;
578
533
 
579
- var hasRequiredFactory$1;
534
+ var hasRequiredFactory$2;
580
535
 
581
- function requireFactory$1 () {
582
- if (hasRequiredFactory$1) return Factory$6;
583
- hasRequiredFactory$1 = 1;
536
+ function requireFactory$2 () {
537
+ if (hasRequiredFactory$2) return Factory$6;
538
+ hasRequiredFactory$2 = 1;
584
539
  Object.defineProperty(Factory$6, "__esModule", { value: true });
585
540
  Factory$6.ViewModule = void 0;
586
541
  const base_1 = base;
@@ -795,8 +750,8 @@ var main = {};
795
750
 
796
751
  Object.defineProperty(main, "__esModule", { value: true });
797
752
  main.WebContents = void 0;
798
- const base_1$p = base;
799
- class WebContents extends base_1$p.EmitterBase {
753
+ const base_1$n = base;
754
+ class WebContents extends base_1$n.EmitterBase {
800
755
  /**
801
756
  * @param identity The identity of the {@link OpenFin.WebContentsEvents WebContents}.
802
757
  * @param entityType The type of the {@link OpenFin.WebContentsEvents WebContents}.
@@ -1877,11 +1832,11 @@ class WebContents extends base_1$p.EmitterBase {
1877
1832
  }
1878
1833
  main.WebContents = WebContents;
1879
1834
 
1880
- var hasRequiredInstance$1;
1835
+ var hasRequiredInstance$2;
1881
1836
 
1882
- function requireInstance$1 () {
1883
- if (hasRequiredInstance$1) return Instance$5;
1884
- hasRequiredInstance$1 = 1;
1837
+ function requireInstance$2 () {
1838
+ if (hasRequiredInstance$2) return Instance$5;
1839
+ hasRequiredInstance$2 = 1;
1885
1840
  var _View_providerChannelClient;
1886
1841
  Object.defineProperty(Instance$5, "__esModule", { value: true });
1887
1842
  Instance$5.View = void 0;
@@ -2461,1139 +2416,1160 @@ function requireView () {
2461
2416
  *
2462
2417
  * @packageDocumentation
2463
2418
  */
2464
- __exportStar(requireFactory$1(), exports);
2465
- __exportStar(requireInstance$1(), exports);
2419
+ __exportStar(requireFactory$2(), exports);
2420
+ __exportStar(requireInstance$2(), exports);
2466
2421
  } (view));
2467
2422
  return view;
2468
2423
  }
2469
2424
 
2470
- Object.defineProperty(Instance$6, "__esModule", { value: true });
2471
- Instance$6.Application = void 0;
2472
- /* eslint-disable import/prefer-default-export */
2473
- const base_1$o = base;
2474
- const window_1$1 = requireWindow();
2475
- const view_1 = requireView();
2476
- /**
2477
- * An object representing an application. Allows the developer to create,
2478
- * execute, show/close an application as well as listen to {@link OpenFin.ApplicationEvents application events}.
2479
- */
2480
- class Application extends base_1$o.EmitterBase {
2481
- /**
2482
- * @internal
2483
- */
2484
- constructor(wire, identity) {
2485
- super(wire, 'application', identity.uuid);
2486
- this.identity = identity;
2487
- this.window = new window_1$1._Window(this.wire, {
2488
- uuid: this.identity.uuid,
2489
- name: this.identity.uuid
2490
- });
2491
- }
2492
- windowListFromIdentityList(identityList) {
2493
- const windowList = [];
2494
- identityList.forEach((identity) => {
2495
- windowList.push(new window_1$1._Window(this.wire, {
2496
- uuid: identity.uuid,
2497
- name: identity.name
2498
- }));
2499
- });
2500
- return windowList;
2501
- }
2502
- /**
2503
- * Determines if the application is currently running.
2504
- *
2505
- * @example
2506
- *
2507
- * ```js
2508
- * async function isAppRunning() {
2509
- * const app = await fin.Application.getCurrent();
2510
- * return await app.isRunning();
2511
- * }
2512
- * isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
2513
- * ```
2514
- */
2515
- isRunning() {
2516
- return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
2517
- }
2518
- /**
2519
- * Closes the application and any child windows created by the application.
2520
- * Cleans the application from state so it is no longer found in getAllApplications.
2521
- * @param force Close will be prevented from closing when force is false and
2522
- * ‘close-requested’ has been subscribed to for application’s main window.
2523
- *
2524
- * @example
2525
- *
2526
- * ```js
2527
- * async function closeApp() {
2528
- * const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
2529
- * const app = await fin.Application.wrap({uuid: 'app2'});
2530
- * await app.quit();
2531
- * const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]
2532
- *
2533
- * }
2534
- * closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
2535
- * ```
2536
- */
2537
- async quit(force = false) {
2538
- try {
2539
- await this._close(force);
2540
- await this.wire.sendAction('destroy-application', { force, ...this.identity });
2541
- }
2542
- catch (error) {
2543
- const acceptableErrors = ['Remote connection has closed', 'Could not locate the requested application'];
2544
- if (!acceptableErrors.some((msg) => error.message.includes(msg))) {
2545
- throw error;
2546
- }
2547
- }
2548
- }
2549
- async _close(force = false) {
2550
- try {
2551
- await this.wire.sendAction('close-application', { force, ...this.identity });
2552
- }
2553
- catch (error) {
2554
- if (!error.message.includes('Remote connection has closed')) {
2555
- throw error;
2556
- }
2557
- }
2558
- }
2559
- /**
2560
- * @deprecated use Application.quit instead
2561
- * Closes the application and any child windows created by the application.
2562
- * @param force - Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.
2563
- * @param callback - called if the method succeeds.
2564
- * @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
2565
- *
2566
- * @example
2567
- *
2568
- * ```js
2569
- * async function closeApp() {
2570
- * const app = await fin.Application.getCurrent();
2571
- * return await app.close();
2572
- * }
2573
- * closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
2574
- * ```
2575
- */
2576
- close(force = false) {
2577
- console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
2578
- this.wire.sendAction('application-close', this.identity).catch((e) => {
2579
- // we do not want to expose this error, just continue if this analytics-only call fails
2580
- });
2581
- return this._close(force);
2582
- }
2583
- /**
2584
- * Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
2585
- *
2586
- * @example
2587
- *
2588
- * ```js
2589
- * async function getChildWindows() {
2590
- * const app = await fin.Application.getCurrent();
2591
- * return await app.getChildWindows();
2592
- * }
2593
- *
2594
- * getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
2595
- * ```
2596
- */
2597
- getChildWindows() {
2598
- return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
2599
- const identityList = [];
2600
- payload.data.forEach((winName) => {
2601
- identityList.push({ uuid: this.identity.uuid, name: winName });
2602
- });
2603
- return this.windowListFromIdentityList(identityList);
2604
- });
2605
- }
2606
- /**
2607
- * Retrieves the JSON manifest that was used to create the application. Invokes the error callback
2608
- * if the application was not created from a manifest.
2609
- *
2610
- * @example
2611
- *
2612
- * ```js
2613
- * async function getManifest() {
2614
- * const app = await fin.Application.getCurrent();
2615
- * return await app.getManifest();
2616
- * }
2617
- *
2618
- * getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
2619
- * ```
2620
- */
2621
- getManifest() {
2622
- return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
2623
- }
2624
- /**
2625
- * Retrieves UUID of the application that launches this application. Invokes the error callback
2626
- * if the application was created from a manifest.
2627
- *
2628
- * @example
2629
- *
2630
- * ```js
2631
- * async function getParentUuid() {
2632
- * const app = await fin.Application.start({
2633
- * uuid: 'app-1',
2634
- * name: 'myApp',
2635
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
2636
- * autoShow: true
2637
- * });
2638
- * return await app.getParentUuid();
2639
- * }
2640
- *
2641
- * getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
2642
- * ```
2643
- */
2644
- getParentUuid() {
2645
- return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
2646
- }
2647
- /**
2648
- * Retrieves current application's shortcut configuration.
2649
- *
2650
- * @example
2651
- *
2652
- * ```js
2653
- * async function getShortcuts() {
2654
- * const app = await fin.Application.wrap({ uuid: 'testapp' });
2655
- * return await app.getShortcuts();
2656
- * }
2657
- * getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
2658
- * ```
2659
- */
2660
- getShortcuts() {
2661
- return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
2662
- }
2663
- /**
2664
- * Retrieves current application's views.
2665
- * @experimental
2666
- *
2667
- * @example
2668
- *
2669
- * ```js
2670
- * async function getViews() {
2671
- * const app = await fin.Application.getCurrent();
2672
- * return await app.getViews();
2673
- * }
2674
- * getViews().then(views => console.log(views)).catch(err => console.log(err));
2675
- * ```
2676
- */
2677
- async getViews() {
2678
- const { payload } = await this.wire.sendAction('application-get-views', this.identity);
2679
- return payload.data.map((id) => new view_1.View(this.wire, id));
2680
- }
2681
- /**
2682
- * Returns the current zoom level of the application.
2683
- *
2684
- * @example
2685
- *
2686
- * ```js
2687
- * async function getZoomLevel() {
2688
- * const app = await fin.Application.getCurrent();
2689
- * return await app.getZoomLevel();
2690
- * }
2691
- *
2692
- * getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
2693
- * ```
2694
- */
2695
- getZoomLevel() {
2696
- return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
2697
- }
2698
- /**
2699
- * Returns an instance of the main Window of the application
2700
- *
2701
- * @example
2702
- *
2703
- * ```js
2704
- * async function getWindow() {
2705
- * const app = await fin.Application.start({
2706
- * uuid: 'app-1',
2707
- * name: 'myApp',
2708
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
2709
- * autoShow: true
2710
- * });
2711
- * return await app.getWindow();
2712
- * }
2713
- *
2714
- * getWindow().then(win => {
2715
- * win.showAt(0, 400);
2716
- * win.flash();
2717
- * }).catch(err => console.log(err));
2718
- * ```
2719
- */
2720
- getWindow() {
2721
- this.wire.sendAction('application-get-window', this.identity).catch((e) => {
2722
- // we do not want to expose this error, just continue if this analytics-only call fails
2723
- });
2724
- return Promise.resolve(this.window);
2725
- }
2726
- /**
2727
- * Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
2728
- * @param userName - username to be passed to the RVM.
2729
- * @param appName - app name to be passed to the RVM.
2730
- *
2731
- * @example
2732
- *
2733
- * ```js
2734
- * async function registerUser() {
2735
- * const app = await fin.Application.getCurrent();
2736
- * return await app.registerUser('user', 'myApp');
2737
- * }
2738
- *
2739
- * registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
2740
- * ```
2741
- */
2742
- registerUser(userName, appName) {
2743
- return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
2744
- }
2745
- /**
2746
- * Removes the application’s icon from the tray.
2747
- *
2748
- * @example
2749
- *
2750
- * ```js
2751
- * async function removeTrayIcon() {
2752
- * const app = await fin.Application.getCurrent();
2753
- * return await app.removeTrayIcon();
2754
- * }
2755
- *
2756
- * removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
2757
- * ```
2758
- */
2759
- removeTrayIcon() {
2760
- return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
2761
- }
2762
- /**
2763
- * Restarts the application.
2764
- *
2765
- * @example
2766
- *
2767
- * ```js
2768
- * async function restartApp() {
2769
- * const app = await fin.Application.getCurrent();
2770
- * return await app.restart();
2771
- * }
2772
- * restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
2773
- * ```
2774
- */
2775
- restart() {
2776
- return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
2777
- }
2778
- /**
2779
- * DEPRECATED method to run the application.
2780
- * Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
2781
- *
2782
- * @example
2783
- *
2784
- * ```js
2785
- * async function run() {
2786
- * const app = await fin.Application.create({
2787
- * name: 'myApp',
2788
- * uuid: 'app-1',
2789
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.run.html',
2790
- * autoShow: true
2791
- * });
2792
- * await app.run();
2793
- * }
2794
- * run().then(() => console.log('Application is running')).catch(err => console.log(err));
2795
- * ```
2796
- *
2797
- * @ignore
2798
- */
2799
- run() {
2800
- console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
2801
- this.wire.sendAction('application-run', this.identity).catch((e) => {
2802
- // we do not want to expose this error, just continue if this analytics-only call fails
2803
- });
2804
- return this._run();
2805
- }
2806
- _run(opts = {}) {
2807
- return this.wire
2808
- .sendAction('run-application', {
2809
- manifestUrl: this._manifestUrl,
2810
- opts,
2811
- ...this.identity
2812
- })
2813
- .then(() => undefined);
2814
- }
2815
- /**
2816
- * Instructs the RVM to schedule one restart of the application.
2817
- *
2818
- * @example
2819
- *
2820
- * ```js
2821
- * async function scheduleRestart() {
2822
- * const app = await fin.Application.getCurrent();
2823
- * return await app.scheduleRestart();
2824
- * }
2825
- *
2826
- * scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
2827
- * ```
2828
- */
2829
- scheduleRestart() {
2830
- return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
2831
- }
2832
- /**
2833
- * Sends a message to the RVM to upload the application's logs. On success,
2834
- * an object containing logId is returned.
2835
- *
2836
- * @example
2837
- *
2838
- * ```js
2839
- * async function sendLog() {
2840
- * const app = await fin.Application.getCurrent();
2841
- * return await app.sendApplicationLog();
2842
- * }
2843
- *
2844
- * sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
2845
- * ```
2846
- */
2847
- async sendApplicationLog() {
2848
- const { payload } = await this.wire.sendAction('send-application-log', this.identity);
2849
- return payload.data;
2850
- }
2851
- /**
2852
- * Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
2853
- * If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
2854
- *
2855
- * Note: If the "name" property is omitted it defaults to "tasks".
2856
- * @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
2857
- *
2858
- *
2859
- * @remarks If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
2860
- *
2861
- * The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's
2862
- * **` shortcut.name `** and uses **` shortcut.company `** as a fallback. Clicking that item will launch the app from its current manifest.
2863
- *
2864
- * Note: If the "name" property is omitted it defaults to "tasks".
2865
- *
2866
- * Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the
2867
- * uuid or shortcut.name is changed.
2868
- *
2869
- * @example
2870
- *
2871
- * ```js
2872
- * const app = fin.Application.getCurrentSync();
2873
- * const appName = 'My App';
2874
- * const jumpListConfig = [ // array of JumpList categories
2875
- * {
2876
- * // has no name and no type so `type` is assumed to be "tasks"
2877
- * items: [ // array of JumpList items
2878
- * {
2879
- * type: 'task',
2880
- * title: `Launch ${appName}`,
2881
- * description: `Runs ${appName} with the default configuration`,
2882
- * deepLink: 'fins://path.to/app/manifest.json',
2883
- * iconPath: 'https://path.to/app/icon.ico',
2884
- * iconIndex: 0
2885
- * },
2886
- * { type: 'separator' },
2887
- * {
2888
- * type: 'task',
2889
- * title: `Restore ${appName}`,
2890
- * description: 'Restore to last configuration',
2891
- * deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
2892
- * iconPath: 'https://path.to/app/icon.ico',
2893
- * iconIndex: 0
2894
- * },
2895
- * ]
2896
- * },
2897
- * {
2898
- * name: 'Tools',
2899
- * items: [ // array of JumpList items
2900
- * {
2901
- * type: 'task',
2902
- * title: 'Tool A',
2903
- * description: 'Runs Tool A',
2904
- * deepLink: 'fins://path.to/tool-a/manifest.json',
2905
- * iconPath: 'https://path.to/tool-a/icon.ico',
2906
- * iconIndex: 0
2907
- * },
2908
- * {
2909
- * type: 'task',
2910
- * title: 'Tool B',
2911
- * description: 'Runs Tool B',
2912
- * deepLink: 'fins://path.to/tool-b/manifest.json',
2913
- * iconPath: 'https://path.to/tool-b/icon.ico',
2914
- * iconIndex: 0
2915
- * }]
2916
- * }
2917
- * ];
2918
- *
2919
- * app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));
2920
- * ```
2921
- *
2922
- * To handle deeplink args:
2923
- * ```js
2924
- * function handleUseLastConfiguration() {
2925
- * // this handler is called when the app is being launched
2926
- * app.on('run-requested', event => {
2927
- * if(event.userAppConfigArgs['use-last-configuration']) {
2928
- * // your logic here
2929
- * }
2930
- * });
2931
- * // this handler is called when the app was already running when the launch was requested
2932
- * fin.desktop.main(function(args) {
2933
- * if(args && args['use-last-configuration']) {
2934
- * // your logic here
2935
- * }
2936
- * });
2937
- * }
2938
- * ```
2939
- */
2940
- async setJumpList(jumpListCategories) {
2941
- await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
2942
- }
2943
- /**
2944
- * Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
2945
- * @param icon Image URL or base64 encoded string to be used as the icon
2946
- *
2947
- * @example
2948
- *
2949
- * ```js
2950
- * const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
2951
- * const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
2952
- * ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
2953
- * const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
2954
- * xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
2955
- *
2956
- * async function setTrayIcon(icon) {
2957
- * const app = await fin.Application.getCurrent();
2958
- * return await app.setTrayIcon(icon);
2959
- * }
2960
- *
2961
- * // use image url to set tray icon
2962
- * setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
2963
- *
2964
- * // use base64 encoded string to set tray icon
2965
- * setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
2966
- *
2967
- * // use a dataURL to set tray icon
2968
- * setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
2969
- * ```
2970
- */
2971
- setTrayIcon(icon) {
2972
- return this.wire
2973
- .sendAction('set-tray-icon', {
2974
- enabledIcon: icon,
2975
- ...this.identity
2976
- })
2977
- .then(() => undefined);
2978
- }
2979
- /**
2980
- * Set hover text for this application's system tray icon.
2981
- * Note: Application must first set a tray icon with {@link Application.setTrayIcon}.
2982
- * @param toolTip
2983
- *
2984
- * @example
2985
- *
2986
- * ```js
2987
- * const app = fin.Application.getCurrentSync();
2988
- * const iconUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
2989
- *
2990
- * await app.setTrayIcon(iconUrl);
2991
- *
2992
- * await app.setTrayIconToolTip('My Application');
2993
- * ```
2994
- */
2995
- async setTrayIconToolTip(toolTip) {
2996
- await this.wire.sendAction('set-tray-icon-tooltip', { ...this.identity, toolTip });
2997
- }
2998
- /**
2999
- * Sets new application's shortcut configuration. Windows only.
3000
- * @param config New application's shortcut configuration.
3001
- *
3002
- * @remarks Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest
3003
- * to be able to change shortcut states.
3004
- *
3005
- * @example
3006
- *
3007
- * ```js
3008
- * async function setShortcuts(config) {
3009
- * const app = await fin.Application.getCurrent();
3010
- * return app.setShortcuts(config);
3011
- * }
3012
- *
3013
- * setShortcuts({
3014
- * desktop: true,
3015
- * startMenu: false,
3016
- * systemStartup: true
3017
- * }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
3018
- * ```
3019
- */
3020
- setShortcuts(config) {
3021
- return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
3022
- }
3023
- /**
3024
- * Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
3025
- * @param queryString The new query string for this app's shortcuts.
3026
- *
3027
- * @example
3028
- *
3029
- * ```js
3030
- * const newQueryArgs = 'arg=true&arg2=false';
3031
- * const app = await fin.Application.getCurrent();
3032
- * try {
3033
- * await app.setShortcutQueryParams(newQueryArgs);
3034
- * } catch(err) {
3035
- * console.error(err)
3036
- * }
3037
- * ```
3038
- */
3039
- async setShortcutQueryParams(queryString) {
3040
- await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
3041
- }
3042
- /**
3043
- * Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
3044
- * larger or smaller to default limits of 300% and 50% of original size, respectively.
3045
- * @param level The zoom level
3046
- *
3047
- * @example
3048
- *
3049
- * ```js
3050
- * async function setZoomLevel(number) {
3051
- * const app = await fin.Application.getCurrent();
3052
- * return await app.setZoomLevel(number);
3053
- * }
3054
- *
3055
- * setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
3056
- * ```
3057
- */
3058
- setZoomLevel(level) {
3059
- return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
3060
- }
3061
- /**
3062
- * Sets a username to correlate with App Log Management.
3063
- * @param username Username to correlate with App's Log.
3064
- *
3065
- * @example
3066
- *
3067
- * ```js
3068
- * async function setAppLogUser() {
3069
- * const app = await fin.Application.getCurrent();
3070
- * return await app.setAppLogUsername('username');
3071
- * }
3072
- *
3073
- * setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
3074
- *
3075
- * ```
3076
- */
3077
- async setAppLogUsername(username) {
3078
- await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
3079
- }
3080
- /**
3081
- * Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
3082
- * @remarks The only information currently returned is the position and dimensions.
3083
- *
3084
- * @example
3085
- *
3086
- * ```js
3087
- * async function getTrayIconInfo() {
3088
- * const app = await fin.Application.wrap({ uuid: 'testapp' });
3089
- * return await app.getTrayIconInfo();
3090
- * }
3091
- * getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
3092
- * ```
3093
- */
3094
- getTrayIconInfo() {
3095
- return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
3096
- }
3097
- /**
3098
- * Checks if the application has an associated tray icon.
3099
- *
3100
- * @example
3101
- *
3102
- * ```js
3103
- * const app = await fin.Application.wrap({ uuid: 'testapp' });
3104
- * const hasTrayIcon = await app.hasTrayIcon();
3105
- * console.log(hasTrayIcon);
3106
- * ```
3107
- */
3108
- hasTrayIcon() {
3109
- return this.wire.sendAction('has-tray-icon', this.identity).then(({ payload }) => payload.data);
3110
- }
3111
- /**
3112
- * Closes the application by terminating its process.
3113
- *
3114
- * @example
3115
- *
3116
- * ```js
3117
- * async function terminateApp() {
3118
- * const app = await fin.Application.getCurrent();
3119
- * return await app.terminate();
3120
- * }
3121
- * terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));
3122
- * ```
3123
- */
3124
- terminate() {
3125
- return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
3126
- }
3127
- /**
3128
- * Waits for a hanging application. This method can be called in response to an application
3129
- * "not-responding" to allow the application to continue and to generate another "not-responding"
3130
- * message after a certain period of time.
3131
- *
3132
- * @ignore
3133
- */
3134
- wait() {
3135
- return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
3136
- }
3137
- /**
3138
- * Retrieves information about the application.
3139
- *
3140
- * @remarks If the application was not launched from a manifest, the call will return the closest parent application `manifest`
3141
- * and `manifestUrl`. `initialOptions` shows the parameters used when launched programmatically, or the `startup_app` options
3142
- * if launched from manifest. The `parentUuid` will be the uuid of the immediate parent (if applicable).
3143
- *
3144
- * @example
3145
- *
3146
- * ```js
3147
- * async function getInfo() {
3148
- * const app = await fin.Application.getCurrent();
3149
- * return await app.getInfo();
3150
- * }
3151
- *
3152
- * getInfo().then(info => console.log(info)).catch(err => console.log(err));
3153
- * ```
3154
- */
3155
- getInfo() {
3156
- return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
3157
- }
3158
- /**
3159
- * Retrieves all process information for entities (windows and views) associated with an application.
3160
- *
3161
- * @example
3162
- * ```js
3163
- * const app = await fin.Application.getCurrent();
3164
- * const processInfo = await app.getProcessInfo();
3165
- * ```
3166
- * @experimental
3167
- */
3168
- async getProcessInfo() {
3169
- const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
3170
- return data;
3171
- }
3172
- /**
3173
- * Sets file auto download location. It's only allowed in the same application.
3174
- *
3175
- * Note: This method is restricted by default and must be enabled via
3176
- * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
3177
- * @param downloadLocation file auto download location
3178
- *
3179
- * @throws if setting file auto download location on different applications.
3180
- * @example
3181
- *
3182
- * ```js
3183
- * const downloadLocation = 'C:\\dev\\temp';
3184
- * const app = await fin.Application.getCurrent();
3185
- * try {
3186
- * await app.setFileDownloadLocation(downloadLocation);
3187
- * console.log('File download location is set');
3188
- * } catch(err) {
3189
- * console.error(err)
3190
- * }
3191
- * ```
3192
- */
3193
- async setFileDownloadLocation(downloadLocation) {
3194
- const { name } = this.wire.me;
3195
- const entityIdentity = { uuid: this.identity.uuid, name };
3196
- await this.wire.sendAction('set-file-download-location', { ...entityIdentity, downloadLocation });
3197
- }
3198
- /**
3199
- * Gets file auto download location. It's only allowed in the same application. If file auto download location is not set, it will return the default location.
3200
- *
3201
- * Note: This method is restricted by default and must be enabled via
3202
- * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
3203
- *
3204
- * @throws if getting file auto download location on different applications.
3205
- * @example
3206
- *
3207
- * ```js
3208
- * const app = await fin.Application.getCurrent();
3209
- * const fileDownloadDir = await app.getFileDownloadLocation();
3210
- * ```
3211
- */
3212
- async getFileDownloadLocation() {
3213
- const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
3214
- return data;
3215
- }
3216
- /**
3217
- * Shows a menu on the tray icon. Use with tray-icon-clicked event.
3218
- * @param options
3219
- * @typeParam Data User-defined shape for data returned upon menu item click. Should be a
3220
- * [union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
3221
- * of all possible data shapes for the entire menu, and the click handler should process
3222
- * these with a "reducer" pattern.
3223
- * @throws if the application has no tray icon set
3224
- * @throws if the system tray is currently hidden
3225
- * @example
3226
- *
3227
- * ```js
3228
- * const iconUrl = 'http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png';
3229
- * const app = fin.Application.getCurrentSync();
3230
- *
3231
- * await app.setTrayIcon(iconUrl);
3232
- *
3233
- * const template = [
3234
- * {
3235
- * label: 'Menu Item 1',
3236
- * data: 'hello from item 1'
3237
- * },
3238
- * { type: 'separator' },
3239
- * {
3240
- * label: 'Menu Item 2',
3241
- * type: 'checkbox',
3242
- * checked: true,
3243
- * data: 'The user clicked the checkbox'
3244
- * },
3245
- * {
3246
- * label: 'see more',
3247
- * enabled: false,
3248
- * submenu: [
3249
- * { label: 'submenu 1', data: 'hello from submenu' }
3250
- * ]
3251
- * }
3252
- * ];
3253
- *
3254
- * app.addListener('tray-icon-clicked', (event) => {
3255
- * // right-click
3256
- * if (event.button === 2) {
3257
- * app.showTrayIconPopupMenu({ template }).then(r => {
3258
- * if (r.result === 'closed') {
3259
- * console.log('nothing happened');
3260
- * } else {
3261
- * console.log(r.data);
3262
- * }
3263
- * });
3264
- * }
3265
- * });
3266
- * ```
3267
- */
3268
- async showTrayIconPopupMenu(options) {
3269
- const { name } = this.wire.me;
3270
- const entityIdentity = { uuid: this.identity.uuid, name };
3271
- const { payload } = await this.wire.sendAction('show-tray-icon-popup-menu', { ...entityIdentity, options });
3272
- return payload.data;
3273
- }
3274
- /**
3275
- * Closes the tray icon menu.
3276
- *
3277
- * @throws if the application has no tray icon set
3278
- * @example
3279
- *
3280
- * ```js
3281
- * const app = fin.Application.getCurrentSync();
3282
- *
3283
- * await app.closeTrayIconPopupMenu();
3284
- * ```
3285
- */
3286
- async closeTrayIconPopupMenu() {
3287
- const { name } = this.wire.me;
3288
- const entityIdentity = { uuid: this.identity.uuid, name };
3289
- await this.wire.sendAction('close-tray-icon-popup-menu', { ...entityIdentity });
3290
- }
3291
- }
3292
- Instance$6.Application = Application;
2425
+ var hasRequiredInstance$1;
3293
2426
 
3294
- Object.defineProperty(Factory$7, "__esModule", { value: true });
3295
- Factory$7.ApplicationModule = void 0;
3296
- const base_1$n = base;
3297
- const validate_1$4 = validate;
3298
- const Instance_1$5 = Instance$6;
3299
- /**
3300
- * Static namespace for OpenFin API methods that interact with the {@link Application} class, available under `fin.Application`.
3301
- */
3302
- class ApplicationModule extends base_1$n.Base {
3303
- /**
3304
- * Asynchronously returns an API handle for the given Application identity.
3305
- *
3306
- * @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
3307
- * returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
3308
- * for an Application throughout its entire lifecycle.
3309
- *
3310
- * @example
3311
- *
3312
- * ```js
3313
- * fin.Application.wrap({ uuid: 'testapp' })
3314
- * .then(app => app.isRunning())
3315
- * .then(running => console.log('Application is running: ' + running))
3316
- * .catch(err => console.log(err));
3317
- * ```
3318
- *
3319
- */
3320
- async wrap(identity) {
3321
- this.wire.sendAction('wrap-application').catch((e) => {
3322
- // we do not want to expose this error, just continue if this analytics-only call fails
3323
- });
3324
- const errorMsg = (0, validate_1$4.validateIdentity)(identity);
3325
- if (errorMsg) {
3326
- throw new Error(errorMsg);
3327
- }
3328
- return new Instance_1$5.Application(this.wire, identity);
3329
- }
3330
- /**
3331
- * Synchronously returns an API handle for the given Application identity.
3332
- *
3333
- * @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
3334
- * returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
3335
- * for an Aplication throughout its entire lifecycle.
3336
- *
3337
- * @example
3338
- *
3339
- * ```js
3340
- * const app = fin.Application.wrapSync({ uuid: 'testapp' });
3341
- * await app.close();
3342
- * ```
3343
- *
3344
- */
3345
- wrapSync(identity) {
3346
- this.wire.sendAction('wrap-application-sync').catch((e) => {
3347
- // we do not want to expose this error, just continue if this analytics-only call fails
3348
- });
3349
- const errorMsg = (0, validate_1$4.validateIdentity)(identity);
3350
- if (errorMsg) {
3351
- throw new Error(errorMsg);
3352
- }
3353
- return new Instance_1$5.Application(this.wire, identity);
3354
- }
3355
- async _create(appOptions) {
3356
- // set defaults:
3357
- if (appOptions.waitForPageLoad === undefined) {
3358
- appOptions.waitForPageLoad = false;
3359
- }
3360
- if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
3361
- appOptions.autoShow = true;
3362
- }
3363
- await this.wire.sendAction('create-application', appOptions);
3364
- return this.wrap({ uuid: appOptions.uuid });
3365
- }
3366
- /**
3367
- * DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
3368
- *
3369
- * @example
3370
- *
3371
- * ```js
3372
- * async function createApp() {
3373
- * const app = await fin.Application.create({
3374
- * name: 'myApp',
3375
- * uuid: 'app-3',
3376
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
3377
- * autoShow: true
3378
- * });
3379
- * await app.run();
3380
- * }
3381
- *
3382
- * createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
3383
- * ```
3384
- *
3385
- * @ignore
3386
- */
3387
- create(appOptions) {
3388
- console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
3389
- this.wire.sendAction('application-create').catch((e) => {
3390
- // we do not want to expose this error, just continue if this analytics-only call fails
3391
- });
3392
- return this._create(appOptions);
3393
- }
3394
- /**
3395
- * Creates and starts a new Application.
3396
- *
3397
- * @example
3398
- *
3399
- * ```js
3400
- * async function start() {
3401
- * return fin.Application.start({
3402
- * name: 'app-1',
3403
- * uuid: 'app-1',
3404
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
3405
- * autoShow: true
3406
- * });
3407
- * }
3408
- * start().then(() => console.log('Application is running')).catch(err => console.log(err));
3409
- * ```
3410
- *
3411
- */
3412
- async start(appOptions) {
3413
- this.wire.sendAction('start-application').catch((e) => {
3414
- // we do not want to expose this error, just continue if this analytics-only call fails
3415
- });
3416
- const app = await this._create(appOptions);
3417
- await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
3418
- return app;
3419
- }
3420
- /**
3421
- * Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
3422
- * Returns once the RVM is finished attempting to launch the applications.
3423
- * @param opts - Parameters that the RVM will use.
3424
- *
3425
- * @example
3426
- *
3427
- * ```js
3428
- *
3429
- * const applicationInfoArray = [
3430
- * {
3431
- * "uuid": 'App-1',
3432
- * "manifestUrl": 'http://localhost:5555/app1.json',
3433
- * },
3434
- * {
3435
- * "uuid": 'App-2',
3436
- * "manifestUrl": 'http://localhost:5555/app2.json',
3437
- * },
3438
- * {
3439
- * "uuid": 'App-3',
3440
- * "manifestUrl": 'http://localhost:5555/app3.json',
3441
- * }
3442
- * ]
3443
- *
3444
- * fin.Application.startManyManifests(applicationInfoArray)
3445
- * .then(() => {
3446
- * console.log('RVM has finished launching the application list.');
3447
- * })
3448
- * .catch((err) => {
3449
- * console.log(err);
3450
- * })
3451
- * ```
3452
- *
3453
- * @experimental
3454
- */
3455
- async startManyManifests(applications, opts) {
3456
- return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
3457
- }
3458
- /**
3459
- * Asynchronously returns an Application object that represents the current application
3460
- *
3461
- * @example
3462
- *
3463
- * ```js
3464
- * async function isCurrentAppRunning () {
3465
- * const app = await fin.Application.getCurrent();
3466
- * return app.isRunning();
3467
- * }
3468
- *
3469
- * isCurrentAppRunning().then(running => {
3470
- * console.log(`Current app is running: ${running}`);
3471
- * }).catch(err => {
3472
- * console.error(err);
3473
- * });
3474
- *
3475
- * ```
3476
- */
3477
- getCurrent() {
3478
- this.wire.sendAction('get-current-application').catch((e) => {
3479
- // we do not want to expose this error, just continue if this analytics-only call fails
3480
- });
3481
- return this.wrap({ uuid: this.wire.me.uuid });
3482
- }
3483
- /**
3484
- * Synchronously returns an Application object that represents the current application
3485
- *
3486
- * @example
3487
- *
3488
- * ```js
3489
- * async function isCurrentAppRunning () {
3490
- * const app = fin.Application.getCurrentSync();
3491
- * return app.isRunning();
3492
- * }
3493
- *
3494
- * isCurrentAppRunning().then(running => {
3495
- * console.log(`Current app is running: ${running}`);
3496
- * }).catch(err => {
3497
- * console.error(err);
3498
- * });
3499
- *
3500
- * ```
3501
- */
3502
- getCurrentSync() {
3503
- this.wire.sendAction('get-current-application-sync').catch((e) => {
3504
- // we do not want to expose this error, just continue if this analytics-only call fails
3505
- });
3506
- return this.wrapSync({ uuid: this.wire.me.uuid });
3507
- }
3508
- /**
3509
- * Retrieves application's manifest and returns a running instance of the application.
3510
- * @param manifestUrl - The URL of app's manifest.
3511
- * @param opts - Parameters that the RVM will use.
3512
- *
3513
- * @example
3514
- *
3515
- * ```js
3516
- * fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
3517
- *
3518
- * // For a local manifest file:
3519
- * fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
3520
- * ```
3521
- */
3522
- async startFromManifest(manifestUrl, opts) {
3523
- this.wire.sendAction('application-start-from-manifest').catch((e) => {
3524
- // we do not want to expose this error, just continue if this analytics-only call fails
3525
- });
3526
- const app = await this._createFromManifest(manifestUrl);
3527
- // @ts-expect-error using private method without warning.
3528
- await app._run(opts); // eslint-disable-line no-underscore-dangle
3529
- return app;
3530
- }
3531
- /**
3532
- * @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
3533
- * Retrieves application's manifest and returns a wrapped application.
3534
- * @param manifestUrl - The URL of app's manifest.
3535
- * @param callback - called if the method succeeds.
3536
- * @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
3537
- *
3538
- * @example
3539
- *
3540
- * ```js
3541
- * fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
3542
- * ```
3543
- * @ignore
3544
- */
3545
- createFromManifest(manifestUrl) {
3546
- console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
3547
- this.wire.sendAction('application-create-from-manifest').catch((e) => {
3548
- // we do not want to expose this error, just continue if this analytics-only call fails
3549
- });
3550
- return this._createFromManifest(manifestUrl);
3551
- }
3552
- _createFromManifest(manifestUrl) {
3553
- return this.wire
3554
- .sendAction('get-application-manifest', { manifestUrl })
3555
- .then(({ payload }) => {
3556
- const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
3557
- return this.wrap({ uuid });
3558
- })
3559
- .then((app) => {
3560
- app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
3561
- return app;
3562
- });
3563
- }
2427
+ function requireInstance$1 () {
2428
+ if (hasRequiredInstance$1) return Instance$6;
2429
+ hasRequiredInstance$1 = 1;
2430
+ Object.defineProperty(Instance$6, "__esModule", { value: true });
2431
+ Instance$6.Application = void 0;
2432
+ /* eslint-disable import/prefer-default-export */
2433
+ const base_1 = base;
2434
+ const window_1 = requireWindow();
2435
+ const view_1 = requireView();
2436
+ /**
2437
+ * An object representing an application. Allows the developer to create,
2438
+ * execute, show/close an application as well as listen to {@link OpenFin.ApplicationEvents application events}.
2439
+ */
2440
+ class Application extends base_1.EmitterBase {
2441
+ /**
2442
+ * @internal
2443
+ */
2444
+ constructor(wire, identity) {
2445
+ super(wire, 'application', identity.uuid);
2446
+ this.identity = identity;
2447
+ this.window = new window_1._Window(this.wire, {
2448
+ uuid: this.identity.uuid,
2449
+ name: this.identity.uuid
2450
+ });
2451
+ }
2452
+ windowListFromIdentityList(identityList) {
2453
+ const windowList = [];
2454
+ identityList.forEach((identity) => {
2455
+ windowList.push(new window_1._Window(this.wire, {
2456
+ uuid: identity.uuid,
2457
+ name: identity.name
2458
+ }));
2459
+ });
2460
+ return windowList;
2461
+ }
2462
+ /**
2463
+ * Determines if the application is currently running.
2464
+ *
2465
+ * @example
2466
+ *
2467
+ * ```js
2468
+ * async function isAppRunning() {
2469
+ * const app = await fin.Application.getCurrent();
2470
+ * return await app.isRunning();
2471
+ * }
2472
+ * isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
2473
+ * ```
2474
+ */
2475
+ isRunning() {
2476
+ return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
2477
+ }
2478
+ /**
2479
+ * Closes the application and any child windows created by the application.
2480
+ * Cleans the application from state so it is no longer found in getAllApplications.
2481
+ * @param force Close will be prevented from closing when force is false and
2482
+ * ‘close-requested’ has been subscribed to for application’s main window.
2483
+ *
2484
+ * @example
2485
+ *
2486
+ * ```js
2487
+ * async function closeApp() {
2488
+ * const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
2489
+ * const app = await fin.Application.wrap({uuid: 'app2'});
2490
+ * await app.quit();
2491
+ * const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]
2492
+ *
2493
+ * }
2494
+ * closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
2495
+ * ```
2496
+ */
2497
+ async quit(force = false) {
2498
+ try {
2499
+ await this._close(force);
2500
+ await this.wire.sendAction('destroy-application', { force, ...this.identity });
2501
+ }
2502
+ catch (error) {
2503
+ const acceptableErrors = ['Remote connection has closed', 'Could not locate the requested application'];
2504
+ if (!acceptableErrors.some((msg) => error.message.includes(msg))) {
2505
+ throw error;
2506
+ }
2507
+ }
2508
+ }
2509
+ async _close(force = false) {
2510
+ try {
2511
+ await this.wire.sendAction('close-application', { force, ...this.identity });
2512
+ }
2513
+ catch (error) {
2514
+ if (!error.message.includes('Remote connection has closed')) {
2515
+ throw error;
2516
+ }
2517
+ }
2518
+ }
2519
+ /**
2520
+ * @deprecated use Application.quit instead
2521
+ * Closes the application and any child windows created by the application.
2522
+ * @param force - Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.
2523
+ * @param callback - called if the method succeeds.
2524
+ * @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
2525
+ *
2526
+ * @example
2527
+ *
2528
+ * ```js
2529
+ * async function closeApp() {
2530
+ * const app = await fin.Application.getCurrent();
2531
+ * return await app.close();
2532
+ * }
2533
+ * closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
2534
+ * ```
2535
+ */
2536
+ close(force = false) {
2537
+ console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
2538
+ this.wire.sendAction('application-close', this.identity).catch((e) => {
2539
+ // we do not want to expose this error, just continue if this analytics-only call fails
2540
+ });
2541
+ return this._close(force);
2542
+ }
2543
+ /**
2544
+ * Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
2545
+ *
2546
+ * @example
2547
+ *
2548
+ * ```js
2549
+ * async function getChildWindows() {
2550
+ * const app = await fin.Application.getCurrent();
2551
+ * return await app.getChildWindows();
2552
+ * }
2553
+ *
2554
+ * getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
2555
+ * ```
2556
+ */
2557
+ getChildWindows() {
2558
+ return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
2559
+ const identityList = [];
2560
+ payload.data.forEach((winName) => {
2561
+ identityList.push({ uuid: this.identity.uuid, name: winName });
2562
+ });
2563
+ return this.windowListFromIdentityList(identityList);
2564
+ });
2565
+ }
2566
+ /**
2567
+ * Retrieves the JSON manifest that was used to create the application. Invokes the error callback
2568
+ * if the application was not created from a manifest.
2569
+ *
2570
+ * @example
2571
+ *
2572
+ * ```js
2573
+ * async function getManifest() {
2574
+ * const app = await fin.Application.getCurrent();
2575
+ * return await app.getManifest();
2576
+ * }
2577
+ *
2578
+ * getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
2579
+ * ```
2580
+ */
2581
+ getManifest() {
2582
+ return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
2583
+ }
2584
+ /**
2585
+ * Retrieves UUID of the application that launches this application. Invokes the error callback
2586
+ * if the application was created from a manifest.
2587
+ *
2588
+ * @example
2589
+ *
2590
+ * ```js
2591
+ * async function getParentUuid() {
2592
+ * const app = await fin.Application.start({
2593
+ * uuid: 'app-1',
2594
+ * name: 'myApp',
2595
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
2596
+ * autoShow: true
2597
+ * });
2598
+ * return await app.getParentUuid();
2599
+ * }
2600
+ *
2601
+ * getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
2602
+ * ```
2603
+ */
2604
+ getParentUuid() {
2605
+ return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
2606
+ }
2607
+ /**
2608
+ * Retrieves current application's shortcut configuration.
2609
+ *
2610
+ * @example
2611
+ *
2612
+ * ```js
2613
+ * async function getShortcuts() {
2614
+ * const app = await fin.Application.wrap({ uuid: 'testapp' });
2615
+ * return await app.getShortcuts();
2616
+ * }
2617
+ * getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
2618
+ * ```
2619
+ */
2620
+ getShortcuts() {
2621
+ return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
2622
+ }
2623
+ /**
2624
+ * Retrieves current application's views.
2625
+ * @experimental
2626
+ *
2627
+ * @example
2628
+ *
2629
+ * ```js
2630
+ * async function getViews() {
2631
+ * const app = await fin.Application.getCurrent();
2632
+ * return await app.getViews();
2633
+ * }
2634
+ * getViews().then(views => console.log(views)).catch(err => console.log(err));
2635
+ * ```
2636
+ */
2637
+ async getViews() {
2638
+ const { payload } = await this.wire.sendAction('application-get-views', this.identity);
2639
+ return payload.data.map((id) => new view_1.View(this.wire, id));
2640
+ }
2641
+ /**
2642
+ * Returns the current zoom level of the application.
2643
+ *
2644
+ * @example
2645
+ *
2646
+ * ```js
2647
+ * async function getZoomLevel() {
2648
+ * const app = await fin.Application.getCurrent();
2649
+ * return await app.getZoomLevel();
2650
+ * }
2651
+ *
2652
+ * getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
2653
+ * ```
2654
+ */
2655
+ getZoomLevel() {
2656
+ return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
2657
+ }
2658
+ /**
2659
+ * Returns an instance of the main Window of the application
2660
+ *
2661
+ * @example
2662
+ *
2663
+ * ```js
2664
+ * async function getWindow() {
2665
+ * const app = await fin.Application.start({
2666
+ * uuid: 'app-1',
2667
+ * name: 'myApp',
2668
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
2669
+ * autoShow: true
2670
+ * });
2671
+ * return await app.getWindow();
2672
+ * }
2673
+ *
2674
+ * getWindow().then(win => {
2675
+ * win.showAt(0, 400);
2676
+ * win.flash();
2677
+ * }).catch(err => console.log(err));
2678
+ * ```
2679
+ */
2680
+ getWindow() {
2681
+ this.wire.sendAction('application-get-window', this.identity).catch((e) => {
2682
+ // we do not want to expose this error, just continue if this analytics-only call fails
2683
+ });
2684
+ return Promise.resolve(this.window);
2685
+ }
2686
+ /**
2687
+ * Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
2688
+ * @param userName - username to be passed to the RVM.
2689
+ * @param appName - app name to be passed to the RVM.
2690
+ *
2691
+ * @example
2692
+ *
2693
+ * ```js
2694
+ * async function registerUser() {
2695
+ * const app = await fin.Application.getCurrent();
2696
+ * return await app.registerUser('user', 'myApp');
2697
+ * }
2698
+ *
2699
+ * registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
2700
+ * ```
2701
+ */
2702
+ registerUser(userName, appName) {
2703
+ return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
2704
+ }
2705
+ /**
2706
+ * Removes the application’s icon from the tray.
2707
+ *
2708
+ * @example
2709
+ *
2710
+ * ```js
2711
+ * async function removeTrayIcon() {
2712
+ * const app = await fin.Application.getCurrent();
2713
+ * return await app.removeTrayIcon();
2714
+ * }
2715
+ *
2716
+ * removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
2717
+ * ```
2718
+ */
2719
+ removeTrayIcon() {
2720
+ return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
2721
+ }
2722
+ /**
2723
+ * Restarts the application.
2724
+ *
2725
+ * @example
2726
+ *
2727
+ * ```js
2728
+ * async function restartApp() {
2729
+ * const app = await fin.Application.getCurrent();
2730
+ * return await app.restart();
2731
+ * }
2732
+ * restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
2733
+ * ```
2734
+ */
2735
+ restart() {
2736
+ return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
2737
+ }
2738
+ /**
2739
+ * DEPRECATED method to run the application.
2740
+ * Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
2741
+ *
2742
+ * @example
2743
+ *
2744
+ * ```js
2745
+ * async function run() {
2746
+ * const app = await fin.Application.create({
2747
+ * name: 'myApp',
2748
+ * uuid: 'app-1',
2749
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.run.html',
2750
+ * autoShow: true
2751
+ * });
2752
+ * await app.run();
2753
+ * }
2754
+ * run().then(() => console.log('Application is running')).catch(err => console.log(err));
2755
+ * ```
2756
+ *
2757
+ * @ignore
2758
+ */
2759
+ run() {
2760
+ console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
2761
+ this.wire.sendAction('application-run', this.identity).catch((e) => {
2762
+ // we do not want to expose this error, just continue if this analytics-only call fails
2763
+ });
2764
+ return this._run();
2765
+ }
2766
+ _run(opts = {}) {
2767
+ return this.wire
2768
+ .sendAction('run-application', {
2769
+ manifestUrl: this._manifestUrl,
2770
+ opts,
2771
+ ...this.identity
2772
+ })
2773
+ .then(() => undefined);
2774
+ }
2775
+ /**
2776
+ * Instructs the RVM to schedule one restart of the application.
2777
+ *
2778
+ * @example
2779
+ *
2780
+ * ```js
2781
+ * async function scheduleRestart() {
2782
+ * const app = await fin.Application.getCurrent();
2783
+ * return await app.scheduleRestart();
2784
+ * }
2785
+ *
2786
+ * scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
2787
+ * ```
2788
+ */
2789
+ scheduleRestart() {
2790
+ return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
2791
+ }
2792
+ /**
2793
+ * Sends a message to the RVM to upload the application's logs. On success,
2794
+ * an object containing logId is returned.
2795
+ *
2796
+ * @example
2797
+ *
2798
+ * ```js
2799
+ * async function sendLog() {
2800
+ * const app = await fin.Application.getCurrent();
2801
+ * return await app.sendApplicationLog();
2802
+ * }
2803
+ *
2804
+ * sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
2805
+ * ```
2806
+ */
2807
+ async sendApplicationLog() {
2808
+ const { payload } = await this.wire.sendAction('send-application-log', this.identity);
2809
+ return payload.data;
2810
+ }
2811
+ /**
2812
+ * Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
2813
+ * If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
2814
+ *
2815
+ * Note: If the "name" property is omitted it defaults to "tasks".
2816
+ * @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
2817
+ *
2818
+ *
2819
+ * @remarks If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
2820
+ *
2821
+ * The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's
2822
+ * **` shortcut.name `** and uses **` shortcut.company `** as a fallback. Clicking that item will launch the app from its current manifest.
2823
+ *
2824
+ * Note: If the "name" property is omitted it defaults to "tasks".
2825
+ *
2826
+ * Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the
2827
+ * uuid or shortcut.name is changed.
2828
+ *
2829
+ * @example
2830
+ *
2831
+ * ```js
2832
+ * const app = fin.Application.getCurrentSync();
2833
+ * const appName = 'My App';
2834
+ * const jumpListConfig = [ // array of JumpList categories
2835
+ * {
2836
+ * // has no name and no type so `type` is assumed to be "tasks"
2837
+ * items: [ // array of JumpList items
2838
+ * {
2839
+ * type: 'task',
2840
+ * title: `Launch ${appName}`,
2841
+ * description: `Runs ${appName} with the default configuration`,
2842
+ * deepLink: 'fins://path.to/app/manifest.json',
2843
+ * iconPath: 'https://path.to/app/icon.ico',
2844
+ * iconIndex: 0
2845
+ * },
2846
+ * { type: 'separator' },
2847
+ * {
2848
+ * type: 'task',
2849
+ * title: `Restore ${appName}`,
2850
+ * description: 'Restore to last configuration',
2851
+ * deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
2852
+ * iconPath: 'https://path.to/app/icon.ico',
2853
+ * iconIndex: 0
2854
+ * },
2855
+ * ]
2856
+ * },
2857
+ * {
2858
+ * name: 'Tools',
2859
+ * items: [ // array of JumpList items
2860
+ * {
2861
+ * type: 'task',
2862
+ * title: 'Tool A',
2863
+ * description: 'Runs Tool A',
2864
+ * deepLink: 'fins://path.to/tool-a/manifest.json',
2865
+ * iconPath: 'https://path.to/tool-a/icon.ico',
2866
+ * iconIndex: 0
2867
+ * },
2868
+ * {
2869
+ * type: 'task',
2870
+ * title: 'Tool B',
2871
+ * description: 'Runs Tool B',
2872
+ * deepLink: 'fins://path.to/tool-b/manifest.json',
2873
+ * iconPath: 'https://path.to/tool-b/icon.ico',
2874
+ * iconIndex: 0
2875
+ * }]
2876
+ * }
2877
+ * ];
2878
+ *
2879
+ * app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));
2880
+ * ```
2881
+ *
2882
+ * To handle deeplink args:
2883
+ * ```js
2884
+ * function handleUseLastConfiguration() {
2885
+ * // this handler is called when the app is being launched
2886
+ * app.on('run-requested', event => {
2887
+ * if(event.userAppConfigArgs['use-last-configuration']) {
2888
+ * // your logic here
2889
+ * }
2890
+ * });
2891
+ * // this handler is called when the app was already running when the launch was requested
2892
+ * fin.desktop.main(function(args) {
2893
+ * if(args && args['use-last-configuration']) {
2894
+ * // your logic here
2895
+ * }
2896
+ * });
2897
+ * }
2898
+ * ```
2899
+ */
2900
+ async setJumpList(jumpListCategories) {
2901
+ await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
2902
+ }
2903
+ /**
2904
+ * Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
2905
+ * @param icon Image URL or base64 encoded string to be used as the icon
2906
+ *
2907
+ * @example
2908
+ *
2909
+ * ```js
2910
+ * const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
2911
+ * const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
2912
+ * ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
2913
+ * const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
2914
+ * xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
2915
+ *
2916
+ * async function setTrayIcon(icon) {
2917
+ * const app = await fin.Application.getCurrent();
2918
+ * return await app.setTrayIcon(icon);
2919
+ * }
2920
+ *
2921
+ * // use image url to set tray icon
2922
+ * setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
2923
+ *
2924
+ * // use base64 encoded string to set tray icon
2925
+ * setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
2926
+ *
2927
+ * // use a dataURL to set tray icon
2928
+ * setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
2929
+ * ```
2930
+ */
2931
+ setTrayIcon(icon) {
2932
+ return this.wire
2933
+ .sendAction('set-tray-icon', {
2934
+ enabledIcon: icon,
2935
+ ...this.identity
2936
+ })
2937
+ .then(() => undefined);
2938
+ }
2939
+ /**
2940
+ * Set hover text for this application's system tray icon.
2941
+ * Note: Application must first set a tray icon with {@link Application.setTrayIcon}.
2942
+ * @param toolTip
2943
+ *
2944
+ * @example
2945
+ *
2946
+ * ```js
2947
+ * const app = fin.Application.getCurrentSync();
2948
+ * const iconUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
2949
+ *
2950
+ * await app.setTrayIcon(iconUrl);
2951
+ *
2952
+ * await app.setTrayIconToolTip('My Application');
2953
+ * ```
2954
+ */
2955
+ async setTrayIconToolTip(toolTip) {
2956
+ await this.wire.sendAction('set-tray-icon-tooltip', { ...this.identity, toolTip });
2957
+ }
2958
+ /**
2959
+ * Sets new application's shortcut configuration. Windows only.
2960
+ * @param config New application's shortcut configuration.
2961
+ *
2962
+ * @remarks Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest
2963
+ * to be able to change shortcut states.
2964
+ *
2965
+ * @example
2966
+ *
2967
+ * ```js
2968
+ * async function setShortcuts(config) {
2969
+ * const app = await fin.Application.getCurrent();
2970
+ * return app.setShortcuts(config);
2971
+ * }
2972
+ *
2973
+ * setShortcuts({
2974
+ * desktop: true,
2975
+ * startMenu: false,
2976
+ * systemStartup: true
2977
+ * }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
2978
+ * ```
2979
+ */
2980
+ setShortcuts(config) {
2981
+ return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
2982
+ }
2983
+ /**
2984
+ * Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
2985
+ * @param queryString The new query string for this app's shortcuts.
2986
+ *
2987
+ * @example
2988
+ *
2989
+ * ```js
2990
+ * const newQueryArgs = 'arg=true&arg2=false';
2991
+ * const app = await fin.Application.getCurrent();
2992
+ * try {
2993
+ * await app.setShortcutQueryParams(newQueryArgs);
2994
+ * } catch(err) {
2995
+ * console.error(err)
2996
+ * }
2997
+ * ```
2998
+ */
2999
+ async setShortcutQueryParams(queryString) {
3000
+ await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
3001
+ }
3002
+ /**
3003
+ * Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
3004
+ * larger or smaller to default limits of 300% and 50% of original size, respectively.
3005
+ * @param level The zoom level
3006
+ *
3007
+ * @example
3008
+ *
3009
+ * ```js
3010
+ * async function setZoomLevel(number) {
3011
+ * const app = await fin.Application.getCurrent();
3012
+ * return await app.setZoomLevel(number);
3013
+ * }
3014
+ *
3015
+ * setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
3016
+ * ```
3017
+ */
3018
+ setZoomLevel(level) {
3019
+ return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
3020
+ }
3021
+ /**
3022
+ * Sets a username to correlate with App Log Management.
3023
+ * @param username Username to correlate with App's Log.
3024
+ *
3025
+ * @example
3026
+ *
3027
+ * ```js
3028
+ * async function setAppLogUser() {
3029
+ * const app = await fin.Application.getCurrent();
3030
+ * return await app.setAppLogUsername('username');
3031
+ * }
3032
+ *
3033
+ * setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
3034
+ *
3035
+ * ```
3036
+ */
3037
+ async setAppLogUsername(username) {
3038
+ await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
3039
+ }
3040
+ /**
3041
+ * Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
3042
+ * @remarks The only information currently returned is the position and dimensions.
3043
+ *
3044
+ * @example
3045
+ *
3046
+ * ```js
3047
+ * async function getTrayIconInfo() {
3048
+ * const app = await fin.Application.wrap({ uuid: 'testapp' });
3049
+ * return await app.getTrayIconInfo();
3050
+ * }
3051
+ * getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
3052
+ * ```
3053
+ */
3054
+ getTrayIconInfo() {
3055
+ return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
3056
+ }
3057
+ /**
3058
+ * Checks if the application has an associated tray icon.
3059
+ *
3060
+ * @example
3061
+ *
3062
+ * ```js
3063
+ * const app = await fin.Application.wrap({ uuid: 'testapp' });
3064
+ * const hasTrayIcon = await app.hasTrayIcon();
3065
+ * console.log(hasTrayIcon);
3066
+ * ```
3067
+ */
3068
+ hasTrayIcon() {
3069
+ return this.wire.sendAction('has-tray-icon', this.identity).then(({ payload }) => payload.data);
3070
+ }
3071
+ /**
3072
+ * Closes the application by terminating its process.
3073
+ *
3074
+ * @example
3075
+ *
3076
+ * ```js
3077
+ * async function terminateApp() {
3078
+ * const app = await fin.Application.getCurrent();
3079
+ * return await app.terminate();
3080
+ * }
3081
+ * terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));
3082
+ * ```
3083
+ */
3084
+ terminate() {
3085
+ return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
3086
+ }
3087
+ /**
3088
+ * Waits for a hanging application. This method can be called in response to an application
3089
+ * "not-responding" to allow the application to continue and to generate another "not-responding"
3090
+ * message after a certain period of time.
3091
+ *
3092
+ * @ignore
3093
+ */
3094
+ wait() {
3095
+ return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
3096
+ }
3097
+ /**
3098
+ * Retrieves information about the application.
3099
+ *
3100
+ * @remarks If the application was not launched from a manifest, the call will return the closest parent application `manifest`
3101
+ * and `manifestUrl`. `initialOptions` shows the parameters used when launched programmatically, or the `startup_app` options
3102
+ * if launched from manifest. The `parentUuid` will be the uuid of the immediate parent (if applicable).
3103
+ *
3104
+ * @example
3105
+ *
3106
+ * ```js
3107
+ * async function getInfo() {
3108
+ * const app = await fin.Application.getCurrent();
3109
+ * return await app.getInfo();
3110
+ * }
3111
+ *
3112
+ * getInfo().then(info => console.log(info)).catch(err => console.log(err));
3113
+ * ```
3114
+ */
3115
+ getInfo() {
3116
+ return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
3117
+ }
3118
+ /**
3119
+ * Retrieves all process information for entities (windows and views) associated with an application.
3120
+ *
3121
+ * @example
3122
+ * ```js
3123
+ * const app = await fin.Application.getCurrent();
3124
+ * const processInfo = await app.getProcessInfo();
3125
+ * ```
3126
+ * @experimental
3127
+ */
3128
+ async getProcessInfo() {
3129
+ const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
3130
+ return data;
3131
+ }
3132
+ /**
3133
+ * Sets file auto download location. It's only allowed in the same application.
3134
+ *
3135
+ * Note: This method is restricted by default and must be enabled via
3136
+ * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
3137
+ * @param downloadLocation file auto download location
3138
+ *
3139
+ * @throws if setting file auto download location on different applications.
3140
+ * @example
3141
+ *
3142
+ * ```js
3143
+ * const downloadLocation = 'C:\\dev\\temp';
3144
+ * const app = await fin.Application.getCurrent();
3145
+ * try {
3146
+ * await app.setFileDownloadLocation(downloadLocation);
3147
+ * console.log('File download location is set');
3148
+ * } catch(err) {
3149
+ * console.error(err)
3150
+ * }
3151
+ * ```
3152
+ */
3153
+ async setFileDownloadLocation(downloadLocation) {
3154
+ const { name } = this.wire.me;
3155
+ const entityIdentity = { uuid: this.identity.uuid, name };
3156
+ await this.wire.sendAction('set-file-download-location', { ...entityIdentity, downloadLocation });
3157
+ }
3158
+ /**
3159
+ * Gets file auto download location. It's only allowed in the same application. If file auto download location is not set, it will return the default location.
3160
+ *
3161
+ * Note: This method is restricted by default and must be enabled via
3162
+ * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
3163
+ *
3164
+ * @throws if getting file auto download location on different applications.
3165
+ * @example
3166
+ *
3167
+ * ```js
3168
+ * const app = await fin.Application.getCurrent();
3169
+ * const fileDownloadDir = await app.getFileDownloadLocation();
3170
+ * ```
3171
+ */
3172
+ async getFileDownloadLocation() {
3173
+ const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
3174
+ return data;
3175
+ }
3176
+ /**
3177
+ * Shows a menu on the tray icon. Use with tray-icon-clicked event.
3178
+ * @param options
3179
+ * @typeParam Data User-defined shape for data returned upon menu item click. Should be a
3180
+ * [union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
3181
+ * of all possible data shapes for the entire menu, and the click handler should process
3182
+ * these with a "reducer" pattern.
3183
+ * @throws if the application has no tray icon set
3184
+ * @throws if the system tray is currently hidden
3185
+ * @example
3186
+ *
3187
+ * ```js
3188
+ * const iconUrl = 'http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png';
3189
+ * const app = fin.Application.getCurrentSync();
3190
+ *
3191
+ * await app.setTrayIcon(iconUrl);
3192
+ *
3193
+ * const template = [
3194
+ * {
3195
+ * label: 'Menu Item 1',
3196
+ * data: 'hello from item 1'
3197
+ * },
3198
+ * { type: 'separator' },
3199
+ * {
3200
+ * label: 'Menu Item 2',
3201
+ * type: 'checkbox',
3202
+ * checked: true,
3203
+ * data: 'The user clicked the checkbox'
3204
+ * },
3205
+ * {
3206
+ * label: 'see more',
3207
+ * enabled: false,
3208
+ * submenu: [
3209
+ * { label: 'submenu 1', data: 'hello from submenu' }
3210
+ * ]
3211
+ * }
3212
+ * ];
3213
+ *
3214
+ * app.addListener('tray-icon-clicked', (event) => {
3215
+ * // right-click
3216
+ * if (event.button === 2) {
3217
+ * app.showTrayIconPopupMenu({ template }).then(r => {
3218
+ * if (r.result === 'closed') {
3219
+ * console.log('nothing happened');
3220
+ * } else {
3221
+ * console.log(r.data);
3222
+ * }
3223
+ * });
3224
+ * }
3225
+ * });
3226
+ * ```
3227
+ */
3228
+ async showTrayIconPopupMenu(options) {
3229
+ const { name } = this.wire.me;
3230
+ const entityIdentity = { uuid: this.identity.uuid, name };
3231
+ const { payload } = await this.wire.sendAction('show-tray-icon-popup-menu', { ...entityIdentity, options });
3232
+ return payload.data;
3233
+ }
3234
+ /**
3235
+ * Closes the tray icon menu.
3236
+ *
3237
+ * @throws if the application has no tray icon set
3238
+ * @example
3239
+ *
3240
+ * ```js
3241
+ * const app = fin.Application.getCurrentSync();
3242
+ *
3243
+ * await app.closeTrayIconPopupMenu();
3244
+ * ```
3245
+ */
3246
+ async closeTrayIconPopupMenu() {
3247
+ const { name } = this.wire.me;
3248
+ const entityIdentity = { uuid: this.identity.uuid, name };
3249
+ await this.wire.sendAction('close-tray-icon-popup-menu', { ...entityIdentity });
3250
+ }
3251
+ }
3252
+ Instance$6.Application = Application;
3253
+ return Instance$6;
3564
3254
  }
3565
- Factory$7.ApplicationModule = ApplicationModule;
3566
3255
 
3567
- (function (exports) {
3568
- var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3569
- if (k2 === undefined) k2 = k;
3570
- var desc = Object.getOwnPropertyDescriptor(m, k);
3571
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
3572
- desc = { enumerable: true, get: function() { return m[k]; } };
3573
- }
3574
- Object.defineProperty(o, k2, desc);
3575
- }) : (function(o, m, k, k2) {
3576
- if (k2 === undefined) k2 = k;
3577
- o[k2] = m[k];
3578
- }));
3579
- var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
3580
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
3581
- };
3582
- Object.defineProperty(exports, "__esModule", { value: true });
3256
+ var hasRequiredFactory$1;
3257
+
3258
+ function requireFactory$1 () {
3259
+ if (hasRequiredFactory$1) return Factory$7;
3260
+ hasRequiredFactory$1 = 1;
3261
+ Object.defineProperty(Factory$7, "__esModule", { value: true });
3262
+ Factory$7.ApplicationModule = void 0;
3263
+ const base_1 = base;
3264
+ const validate_1 = validate;
3265
+ const Instance_1 = requireInstance$1();
3583
3266
  /**
3584
- * Entry points for the OpenFin `Application` API (`fin.Application`).
3585
- *
3586
- * * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
3587
- * * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
3588
- *
3589
- * These are separate code entities, and are documented separately. In the [previous version of the API documentation](https://cdn.openfin.co/docs/javascript/32.114.76.10/index.html),
3590
- * both of these were documented on the same page.
3591
- *
3592
- * @packageDocumentation
3267
+ * Static namespace for OpenFin API methods that interact with the {@link Application} class, available under `fin.Application`.
3593
3268
  */
3594
- __exportStar(Factory$7, exports);
3595
- __exportStar(Instance$6, exports);
3596
- } (application));
3269
+ class ApplicationModule extends base_1.Base {
3270
+ /**
3271
+ * Asynchronously returns an API handle for the given Application identity.
3272
+ *
3273
+ * @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
3274
+ * returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
3275
+ * for an Application throughout its entire lifecycle.
3276
+ *
3277
+ * @example
3278
+ *
3279
+ * ```js
3280
+ * fin.Application.wrap({ uuid: 'testapp' })
3281
+ * .then(app => app.isRunning())
3282
+ * .then(running => console.log('Application is running: ' + running))
3283
+ * .catch(err => console.log(err));
3284
+ * ```
3285
+ *
3286
+ */
3287
+ async wrap(identity) {
3288
+ this.wire.sendAction('wrap-application').catch((e) => {
3289
+ // we do not want to expose this error, just continue if this analytics-only call fails
3290
+ });
3291
+ const errorMsg = (0, validate_1.validateIdentity)(identity);
3292
+ if (errorMsg) {
3293
+ throw new Error(errorMsg);
3294
+ }
3295
+ return new Instance_1.Application(this.wire, identity);
3296
+ }
3297
+ /**
3298
+ * Synchronously returns an API handle for the given Application identity.
3299
+ *
3300
+ * @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
3301
+ * returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
3302
+ * for an Aplication throughout its entire lifecycle.
3303
+ *
3304
+ * @example
3305
+ *
3306
+ * ```js
3307
+ * const app = fin.Application.wrapSync({ uuid: 'testapp' });
3308
+ * await app.close();
3309
+ * ```
3310
+ *
3311
+ */
3312
+ wrapSync(identity) {
3313
+ this.wire.sendAction('wrap-application-sync').catch((e) => {
3314
+ // we do not want to expose this error, just continue if this analytics-only call fails
3315
+ });
3316
+ const errorMsg = (0, validate_1.validateIdentity)(identity);
3317
+ if (errorMsg) {
3318
+ throw new Error(errorMsg);
3319
+ }
3320
+ return new Instance_1.Application(this.wire, identity);
3321
+ }
3322
+ async _create(appOptions) {
3323
+ // set defaults:
3324
+ if (appOptions.waitForPageLoad === undefined) {
3325
+ appOptions.waitForPageLoad = false;
3326
+ }
3327
+ if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
3328
+ appOptions.autoShow = true;
3329
+ }
3330
+ await this.wire.sendAction('create-application', appOptions);
3331
+ return this.wrap({ uuid: appOptions.uuid });
3332
+ }
3333
+ /**
3334
+ * DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
3335
+ *
3336
+ * @example
3337
+ *
3338
+ * ```js
3339
+ * async function createApp() {
3340
+ * const app = await fin.Application.create({
3341
+ * name: 'myApp',
3342
+ * uuid: 'app-3',
3343
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
3344
+ * autoShow: true
3345
+ * });
3346
+ * await app.run();
3347
+ * }
3348
+ *
3349
+ * createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
3350
+ * ```
3351
+ *
3352
+ * @ignore
3353
+ */
3354
+ create(appOptions) {
3355
+ console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
3356
+ this.wire.sendAction('application-create').catch((e) => {
3357
+ // we do not want to expose this error, just continue if this analytics-only call fails
3358
+ });
3359
+ return this._create(appOptions);
3360
+ }
3361
+ /**
3362
+ * Creates and starts a new Application.
3363
+ *
3364
+ * @example
3365
+ *
3366
+ * ```js
3367
+ * async function start() {
3368
+ * return fin.Application.start({
3369
+ * name: 'app-1',
3370
+ * uuid: 'app-1',
3371
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
3372
+ * autoShow: true
3373
+ * });
3374
+ * }
3375
+ * start().then(() => console.log('Application is running')).catch(err => console.log(err));
3376
+ * ```
3377
+ *
3378
+ */
3379
+ async start(appOptions) {
3380
+ this.wire.sendAction('start-application').catch((e) => {
3381
+ // we do not want to expose this error, just continue if this analytics-only call fails
3382
+ });
3383
+ const app = await this._create(appOptions);
3384
+ await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
3385
+ return app;
3386
+ }
3387
+ /**
3388
+ * Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
3389
+ * Returns once the RVM is finished attempting to launch the applications.
3390
+ * @param opts - Parameters that the RVM will use.
3391
+ *
3392
+ * @example
3393
+ *
3394
+ * ```js
3395
+ *
3396
+ * const applicationInfoArray = [
3397
+ * {
3398
+ * "uuid": 'App-1',
3399
+ * "manifestUrl": 'http://localhost:5555/app1.json',
3400
+ * },
3401
+ * {
3402
+ * "uuid": 'App-2',
3403
+ * "manifestUrl": 'http://localhost:5555/app2.json',
3404
+ * },
3405
+ * {
3406
+ * "uuid": 'App-3',
3407
+ * "manifestUrl": 'http://localhost:5555/app3.json',
3408
+ * }
3409
+ * ]
3410
+ *
3411
+ * fin.Application.startManyManifests(applicationInfoArray)
3412
+ * .then(() => {
3413
+ * console.log('RVM has finished launching the application list.');
3414
+ * })
3415
+ * .catch((err) => {
3416
+ * console.log(err);
3417
+ * })
3418
+ * ```
3419
+ *
3420
+ * @experimental
3421
+ */
3422
+ async startManyManifests(applications, opts) {
3423
+ return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
3424
+ }
3425
+ /**
3426
+ * Asynchronously returns an Application object that represents the current application
3427
+ *
3428
+ * @example
3429
+ *
3430
+ * ```js
3431
+ * async function isCurrentAppRunning () {
3432
+ * const app = await fin.Application.getCurrent();
3433
+ * return app.isRunning();
3434
+ * }
3435
+ *
3436
+ * isCurrentAppRunning().then(running => {
3437
+ * console.log(`Current app is running: ${running}`);
3438
+ * }).catch(err => {
3439
+ * console.error(err);
3440
+ * });
3441
+ *
3442
+ * ```
3443
+ */
3444
+ getCurrent() {
3445
+ this.wire.sendAction('get-current-application').catch((e) => {
3446
+ // we do not want to expose this error, just continue if this analytics-only call fails
3447
+ });
3448
+ return this.wrap({ uuid: this.wire.me.uuid });
3449
+ }
3450
+ /**
3451
+ * Synchronously returns an Application object that represents the current application
3452
+ *
3453
+ * @example
3454
+ *
3455
+ * ```js
3456
+ * async function isCurrentAppRunning () {
3457
+ * const app = fin.Application.getCurrentSync();
3458
+ * return app.isRunning();
3459
+ * }
3460
+ *
3461
+ * isCurrentAppRunning().then(running => {
3462
+ * console.log(`Current app is running: ${running}`);
3463
+ * }).catch(err => {
3464
+ * console.error(err);
3465
+ * });
3466
+ *
3467
+ * ```
3468
+ */
3469
+ getCurrentSync() {
3470
+ this.wire.sendAction('get-current-application-sync').catch((e) => {
3471
+ // we do not want to expose this error, just continue if this analytics-only call fails
3472
+ });
3473
+ return this.wrapSync({ uuid: this.wire.me.uuid });
3474
+ }
3475
+ /**
3476
+ * Retrieves application's manifest and returns a running instance of the application.
3477
+ * @param manifestUrl - The URL of app's manifest.
3478
+ * @param opts - Parameters that the RVM will use.
3479
+ *
3480
+ * @example
3481
+ *
3482
+ * ```js
3483
+ * fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
3484
+ *
3485
+ * // For a local manifest file:
3486
+ * fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
3487
+ * ```
3488
+ */
3489
+ async startFromManifest(manifestUrl, opts) {
3490
+ this.wire.sendAction('application-start-from-manifest').catch((e) => {
3491
+ // we do not want to expose this error, just continue if this analytics-only call fails
3492
+ });
3493
+ const app = await this._createFromManifest(manifestUrl);
3494
+ // @ts-expect-error using private method without warning.
3495
+ await app._run(opts); // eslint-disable-line no-underscore-dangle
3496
+ return app;
3497
+ }
3498
+ /**
3499
+ * @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
3500
+ * Retrieves application's manifest and returns a wrapped application.
3501
+ * @param manifestUrl - The URL of app's manifest.
3502
+ * @param callback - called if the method succeeds.
3503
+ * @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
3504
+ *
3505
+ * @example
3506
+ *
3507
+ * ```js
3508
+ * fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
3509
+ * ```
3510
+ * @ignore
3511
+ */
3512
+ createFromManifest(manifestUrl) {
3513
+ console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
3514
+ this.wire.sendAction('application-create-from-manifest').catch((e) => {
3515
+ // we do not want to expose this error, just continue if this analytics-only call fails
3516
+ });
3517
+ return this._createFromManifest(manifestUrl);
3518
+ }
3519
+ _createFromManifest(manifestUrl) {
3520
+ return this.wire
3521
+ .sendAction('get-application-manifest', { manifestUrl })
3522
+ .then(({ payload }) => {
3523
+ const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
3524
+ return this.wrap({ uuid });
3525
+ })
3526
+ .then((app) => {
3527
+ app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
3528
+ return app;
3529
+ });
3530
+ }
3531
+ }
3532
+ Factory$7.ApplicationModule = ApplicationModule;
3533
+ return Factory$7;
3534
+ }
3535
+
3536
+ var hasRequiredApplication;
3537
+
3538
+ function requireApplication () {
3539
+ if (hasRequiredApplication) return application;
3540
+ hasRequiredApplication = 1;
3541
+ (function (exports) {
3542
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3543
+ if (k2 === undefined) k2 = k;
3544
+ var desc = Object.getOwnPropertyDescriptor(m, k);
3545
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
3546
+ desc = { enumerable: true, get: function() { return m[k]; } };
3547
+ }
3548
+ Object.defineProperty(o, k2, desc);
3549
+ }) : (function(o, m, k, k2) {
3550
+ if (k2 === undefined) k2 = k;
3551
+ o[k2] = m[k];
3552
+ }));
3553
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
3554
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
3555
+ };
3556
+ Object.defineProperty(exports, "__esModule", { value: true });
3557
+ /**
3558
+ * Entry points for the OpenFin `Application` API (`fin.Application`).
3559
+ *
3560
+ * * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
3561
+ * * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
3562
+ *
3563
+ * These are separate code entities, and are documented separately. In the [previous version of the API documentation](https://cdn.openfin.co/docs/javascript/32.114.76.10/index.html),
3564
+ * both of these were documented on the same page.
3565
+ *
3566
+ * @packageDocumentation
3567
+ */
3568
+ __exportStar(requireFactory$1(), exports);
3569
+ __exportStar(requireInstance$1(), exports);
3570
+ } (application));
3571
+ return application;
3572
+ }
3597
3573
 
3598
3574
  var promisifySubscription$1 = {};
3599
3575
 
@@ -3637,7 +3613,7 @@ function requireInstance () {
3637
3613
  /* eslint-disable @typescript-eslint/no-unused-vars */
3638
3614
  /* eslint-disable no-console */
3639
3615
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
3640
- const application_1 = application;
3616
+ const application_1 = requireApplication();
3641
3617
  const main_1 = main;
3642
3618
  const view_1 = requireView();
3643
3619
  const warnings_1 = warnings;
@@ -17234,7 +17210,7 @@ const events_1$3 = require$$0;
17234
17210
  // Import from the file rather than the directory in case someone consuming types is using module resolution other than "node"
17235
17211
  const index_1 = system;
17236
17212
  const index_2 = requireWindow();
17237
- const index_3 = application;
17213
+ const index_3 = requireApplication();
17238
17214
  const index_4 = interappbus;
17239
17215
  const index_5 = clipboard;
17240
17216
  const index_6 = externalApplication;
@@ -17327,6 +17303,17 @@ Object.defineProperty(environment$1, "__esModule", { value: true });
17327
17303
  var notImplementedEnvErrorMsg = environment$1.notImplementedEnvErrorMsg = void 0;
17328
17304
  notImplementedEnvErrorMsg = environment$1.notImplementedEnvErrorMsg = 'Not implemented in this environment';
17329
17305
 
17306
+ var promises = {};
17307
+
17308
+ Object.defineProperty(promises, "__esModule", { value: true });
17309
+ var promisify_1 = promises.promisify = void 0;
17310
+ function promisify(func) {
17311
+ return (...args) => new Promise((resolve, reject) => {
17312
+ func(...args, (err, val) => (err ? reject(err) : resolve(val)));
17313
+ });
17314
+ }
17315
+ promisify_1 = promises.promisify = promisify;
17316
+
17330
17317
  const getProxyVar = () => {
17331
17318
  return process.env.HTTPS_PROXY || process.env.https_proxy || process.env.HTTP_PROXY || process.env.http_proxy;
17332
17319
  };
@@ -17446,7 +17433,7 @@ async function rmDir(dirPath, removeSelf = true) {
17446
17433
  return;
17447
17434
  }
17448
17435
  if (files.length > 0) {
17449
- await promiseMap_1(files, async (f) => {
17436
+ await Promise.all(files.map(async (f) => {
17450
17437
  const filePath = `${dirPath}/${f}`;
17451
17438
  const file = await lstat(filePath);
17452
17439
  if (file.isFile() || file.isSymbolicLink()) {
@@ -17455,7 +17442,7 @@ async function rmDir(dirPath, removeSelf = true) {
17455
17442
  else {
17456
17443
  await rmDir(filePath, true);
17457
17444
  }
17458
- });
17445
+ }));
17459
17446
  }
17460
17447
  if (removeSelf) {
17461
17448
  await rmdir(dirPath);
@@ -18037,7 +18024,7 @@ class NodeEnvironment extends BaseEnvironment_1 {
18037
18024
  };
18038
18025
  }
18039
18026
  getAdapterVersionSync() {
18040
- return "42.102.4";
18027
+ return "42.103.1";
18041
18028
  }
18042
18029
  observeBounds(element, onChange) {
18043
18030
  throw new Error('Method not implemented.');