@openfin/node-adapter 42.100.35 → 42.100.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/node-adapter.js +1277 -1265
- package/package.json +2 -2
package/out/node-adapter.js
CHANGED
@@ -73,13 +73,13 @@ async function promiseMapSerial(arr, func) {
|
|
73
73
|
}
|
74
74
|
promises.promiseMapSerial = promiseMapSerial;
|
75
75
|
|
76
|
-
var __classPrivateFieldSet$
|
76
|
+
var __classPrivateFieldSet$h = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
77
77
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
78
78
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
79
79
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
80
80
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
81
81
|
};
|
82
|
-
var __classPrivateFieldGet$
|
82
|
+
var __classPrivateFieldGet$i = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
83
83
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
84
84
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
85
85
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
@@ -164,7 +164,7 @@ class EmitterBase extends Base {
|
|
164
164
|
this.emit = (eventType, payload, ...args) => {
|
165
165
|
return this.hasEmitter() ? this.getOrCreateEmitter().emit(eventType, payload, ...args) : false;
|
166
166
|
};
|
167
|
-
this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet$
|
167
|
+
this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
|
168
168
|
/**
|
169
169
|
* Cleans up after removal of a listener, e.g. deleting any lingering deregistration handlers for a
|
170
170
|
* `once` subscription.
|
@@ -174,14 +174,14 @@ class EmitterBase extends Base {
|
|
174
174
|
* which would involve less "magic," but would be more-vulnerable to accidental re-introduction of a leak.
|
175
175
|
*/
|
176
176
|
this.cleanUpRemovedListener = (eventType, listener) => {
|
177
|
-
const deregister = __classPrivateFieldGet$
|
177
|
+
const deregister = __classPrivateFieldGet$i(this, _EmitterBase_deregisterOnceListeners, "f").get(listener);
|
178
178
|
if (deregister) {
|
179
|
-
const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$
|
179
|
+
const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
|
180
180
|
emitter.removeListener(eventType, deregister);
|
181
181
|
}
|
182
182
|
};
|
183
183
|
this.getOrCreateEmitter = () => {
|
184
|
-
const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$
|
184
|
+
const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
|
185
185
|
if (!emitter.listeners('removeListener').includes(this.cleanUpRemovedListener)) {
|
186
186
|
emitter.on('removeListener', this.cleanUpRemovedListener);
|
187
187
|
}
|
@@ -223,8 +223,8 @@ class EmitterBase extends Base {
|
|
223
223
|
// This will only be reached if unsubscribe from event that does not exist but do not want to error here
|
224
224
|
return Promise.resolve();
|
225
225
|
};
|
226
|
-
__classPrivateFieldSet$
|
227
|
-
__classPrivateFieldSet$
|
226
|
+
__classPrivateFieldSet$h(this, _EmitterBase_emitterAccessor, [topic, ...additionalAccessors], "f");
|
227
|
+
__classPrivateFieldSet$h(this, _EmitterBase_deregisterOnceListeners, new WeakMap(), "f");
|
228
228
|
this.listeners = (event) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(event) : [];
|
229
229
|
}
|
230
230
|
/**
|
@@ -253,7 +253,7 @@ class EmitterBase extends Base {
|
|
253
253
|
*/
|
254
254
|
async once(eventType, listener, options) {
|
255
255
|
const deregister = () => this.deregisterEventListener(eventType);
|
256
|
-
__classPrivateFieldGet$
|
256
|
+
__classPrivateFieldGet$i(this, _EmitterBase_deregisterOnceListeners, "f").set(listener, deregister);
|
257
257
|
await this.registerEventListener(eventType, options, (emitter) => {
|
258
258
|
emitter.once(eventType, deregister);
|
259
259
|
emitter.once(eventType, listener);
|
@@ -284,7 +284,7 @@ class EmitterBase extends Base {
|
|
284
284
|
*/
|
285
285
|
async prependOnceListener(eventType, listener, options) {
|
286
286
|
const deregister = () => this.deregisterEventListener(eventType);
|
287
|
-
__classPrivateFieldGet$
|
287
|
+
__classPrivateFieldGet$i(this, _EmitterBase_deregisterOnceListeners, "f").set(listener, deregister);
|
288
288
|
await this.registerEventListener(eventType, options, (emitter) => {
|
289
289
|
emitter.prependOnceListener(eventType, listener);
|
290
290
|
emitter.once(eventType, deregister);
|
@@ -344,7 +344,7 @@ class EmitterBase extends Base {
|
|
344
344
|
}
|
345
345
|
deleteEmitterIfNothingRegistered(emitter) {
|
346
346
|
if (emitter.eventNames().every((type) => type === 'removeListener')) {
|
347
|
-
this.wire.eventAggregator.delete(__classPrivateFieldGet$
|
347
|
+
this.wire.eventAggregator.delete(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
|
348
348
|
}
|
349
349
|
}
|
350
350
|
}
|
@@ -576,11 +576,11 @@ const handleDeprecatedWarnings = (options) => {
|
|
576
576
|
};
|
577
577
|
warnings.handleDeprecatedWarnings = handleDeprecatedWarnings;
|
578
578
|
|
579
|
-
var hasRequiredFactory$
|
579
|
+
var hasRequiredFactory$1;
|
580
580
|
|
581
|
-
function requireFactory$
|
582
|
-
if (hasRequiredFactory$
|
583
|
-
hasRequiredFactory$
|
581
|
+
function requireFactory$1 () {
|
582
|
+
if (hasRequiredFactory$1) return Factory$6;
|
583
|
+
hasRequiredFactory$1 = 1;
|
584
584
|
Object.defineProperty(Factory$6, "__esModule", { value: true });
|
585
585
|
Factory$6.ViewModule = void 0;
|
586
586
|
const base_1 = base;
|
@@ -795,8 +795,8 @@ var main = {};
|
|
795
795
|
|
796
796
|
Object.defineProperty(main, "__esModule", { value: true });
|
797
797
|
main.WebContents = void 0;
|
798
|
-
const base_1$
|
799
|
-
class WebContents extends base_1$
|
798
|
+
const base_1$o = base;
|
799
|
+
class WebContents extends base_1$o.EmitterBase {
|
800
800
|
/**
|
801
801
|
* @param identity The identity of the {@link OpenFin.WebContentsEvents WebContents}.
|
802
802
|
* @param entityType The type of the {@link OpenFin.WebContentsEvents WebContents}.
|
@@ -1877,11 +1877,11 @@ class WebContents extends base_1$m.EmitterBase {
|
|
1877
1877
|
}
|
1878
1878
|
main.WebContents = WebContents;
|
1879
1879
|
|
1880
|
-
var hasRequiredInstance$
|
1880
|
+
var hasRequiredInstance$1;
|
1881
1881
|
|
1882
|
-
function requireInstance$
|
1883
|
-
if (hasRequiredInstance$
|
1884
|
-
hasRequiredInstance$
|
1882
|
+
function requireInstance$1 () {
|
1883
|
+
if (hasRequiredInstance$1) return Instance$5;
|
1884
|
+
hasRequiredInstance$1 = 1;
|
1885
1885
|
var _View_providerChannelClient;
|
1886
1886
|
Object.defineProperty(Instance$5, "__esModule", { value: true });
|
1887
1887
|
Instance$5.View = void 0;
|
@@ -2461,1160 +2461,1139 @@ function requireView () {
|
|
2461
2461
|
*
|
2462
2462
|
* @packageDocumentation
|
2463
2463
|
*/
|
2464
|
-
__exportStar(requireFactory$
|
2465
|
-
__exportStar(requireInstance$
|
2464
|
+
__exportStar(requireFactory$1(), exports);
|
2465
|
+
__exportStar(requireInstance$1(), exports);
|
2466
2466
|
} (view));
|
2467
2467
|
return view;
|
2468
2468
|
}
|
2469
2469
|
|
2470
|
-
|
2471
|
-
|
2472
|
-
|
2473
|
-
|
2474
|
-
|
2475
|
-
|
2476
|
-
|
2477
|
-
|
2478
|
-
|
2479
|
-
|
2480
|
-
|
2481
|
-
|
2482
|
-
|
2483
|
-
|
2484
|
-
|
2485
|
-
|
2486
|
-
|
2487
|
-
|
2488
|
-
|
2489
|
-
|
2490
|
-
|
2491
|
-
|
2492
|
-
|
2493
|
-
|
2494
|
-
|
2495
|
-
|
2496
|
-
|
2497
|
-
|
2498
|
-
|
2499
|
-
|
2500
|
-
|
2501
|
-
|
2502
|
-
|
2503
|
-
|
2504
|
-
|
2505
|
-
|
2506
|
-
|
2507
|
-
|
2508
|
-
|
2509
|
-
|
2510
|
-
|
2511
|
-
|
2512
|
-
|
2513
|
-
|
2514
|
-
|
2515
|
-
|
2516
|
-
|
2517
|
-
|
2518
|
-
|
2519
|
-
|
2520
|
-
|
2521
|
-
|
2522
|
-
|
2523
|
-
|
2524
|
-
|
2525
|
-
|
2526
|
-
|
2527
|
-
|
2528
|
-
|
2529
|
-
|
2530
|
-
|
2531
|
-
|
2532
|
-
|
2533
|
-
|
2534
|
-
|
2535
|
-
|
2536
|
-
|
2537
|
-
|
2538
|
-
|
2539
|
-
|
2540
|
-
|
2541
|
-
|
2542
|
-
|
2543
|
-
|
2544
|
-
|
2545
|
-
|
2546
|
-
|
2547
|
-
|
2548
|
-
|
2549
|
-
|
2550
|
-
|
2551
|
-
|
2552
|
-
|
2553
|
-
|
2554
|
-
|
2555
|
-
|
2556
|
-
|
2557
|
-
|
2558
|
-
|
2559
|
-
|
2560
|
-
|
2561
|
-
|
2562
|
-
|
2563
|
-
|
2564
|
-
|
2565
|
-
|
2566
|
-
|
2567
|
-
|
2568
|
-
|
2569
|
-
|
2570
|
-
|
2571
|
-
|
2572
|
-
|
2573
|
-
|
2574
|
-
|
2575
|
-
|
2576
|
-
|
2577
|
-
|
2578
|
-
|
2579
|
-
|
2580
|
-
|
2581
|
-
|
2582
|
-
|
2583
|
-
|
2584
|
-
|
2585
|
-
|
2586
|
-
|
2587
|
-
|
2588
|
-
|
2589
|
-
|
2590
|
-
|
2591
|
-
|
2592
|
-
|
2593
|
-
|
2594
|
-
|
2595
|
-
|
2596
|
-
|
2597
|
-
|
2598
|
-
|
2599
|
-
|
2600
|
-
|
2601
|
-
|
2602
|
-
|
2603
|
-
|
2604
|
-
|
2605
|
-
|
2606
|
-
|
2607
|
-
|
2608
|
-
|
2609
|
-
|
2610
|
-
|
2611
|
-
|
2612
|
-
|
2613
|
-
|
2614
|
-
|
2615
|
-
|
2616
|
-
|
2617
|
-
|
2618
|
-
|
2619
|
-
|
2620
|
-
|
2621
|
-
|
2622
|
-
|
2623
|
-
|
2624
|
-
|
2625
|
-
|
2626
|
-
|
2627
|
-
|
2628
|
-
|
2629
|
-
|
2630
|
-
|
2631
|
-
|
2632
|
-
|
2633
|
-
|
2634
|
-
|
2635
|
-
|
2636
|
-
|
2637
|
-
|
2638
|
-
|
2639
|
-
|
2640
|
-
|
2641
|
-
|
2642
|
-
|
2643
|
-
|
2644
|
-
|
2645
|
-
|
2646
|
-
|
2647
|
-
|
2648
|
-
|
2649
|
-
|
2650
|
-
|
2651
|
-
|
2652
|
-
|
2653
|
-
|
2654
|
-
|
2655
|
-
|
2656
|
-
|
2657
|
-
|
2658
|
-
|
2659
|
-
|
2660
|
-
|
2661
|
-
|
2662
|
-
|
2663
|
-
|
2664
|
-
|
2665
|
-
|
2666
|
-
|
2667
|
-
|
2668
|
-
|
2669
|
-
|
2670
|
-
|
2671
|
-
|
2672
|
-
|
2673
|
-
|
2674
|
-
|
2675
|
-
|
2676
|
-
|
2677
|
-
|
2678
|
-
|
2679
|
-
|
2680
|
-
|
2681
|
-
|
2682
|
-
|
2683
|
-
|
2684
|
-
|
2685
|
-
|
2686
|
-
|
2687
|
-
|
2688
|
-
|
2689
|
-
|
2690
|
-
|
2691
|
-
|
2692
|
-
|
2693
|
-
|
2694
|
-
|
2695
|
-
|
2696
|
-
|
2697
|
-
|
2698
|
-
|
2699
|
-
|
2700
|
-
|
2701
|
-
|
2702
|
-
|
2703
|
-
|
2704
|
-
|
2705
|
-
|
2706
|
-
|
2707
|
-
|
2708
|
-
|
2709
|
-
|
2710
|
-
|
2711
|
-
|
2712
|
-
|
2713
|
-
|
2714
|
-
|
2715
|
-
|
2716
|
-
|
2717
|
-
|
2718
|
-
|
2719
|
-
|
2720
|
-
|
2721
|
-
|
2722
|
-
|
2723
|
-
|
2724
|
-
|
2725
|
-
|
2726
|
-
|
2727
|
-
|
2728
|
-
|
2729
|
-
|
2730
|
-
|
2731
|
-
|
2732
|
-
|
2733
|
-
|
2734
|
-
|
2735
|
-
|
2736
|
-
|
2737
|
-
|
2738
|
-
|
2739
|
-
|
2740
|
-
|
2741
|
-
|
2742
|
-
|
2743
|
-
|
2744
|
-
|
2745
|
-
|
2746
|
-
|
2747
|
-
|
2748
|
-
|
2749
|
-
|
2750
|
-
|
2751
|
-
|
2752
|
-
|
2753
|
-
|
2754
|
-
|
2755
|
-
|
2756
|
-
|
2757
|
-
|
2758
|
-
|
2759
|
-
|
2760
|
-
|
2761
|
-
|
2762
|
-
|
2763
|
-
|
2764
|
-
|
2765
|
-
|
2766
|
-
|
2767
|
-
|
2768
|
-
|
2769
|
-
|
2770
|
-
|
2771
|
-
|
2772
|
-
|
2773
|
-
|
2774
|
-
|
2775
|
-
|
2776
|
-
|
2777
|
-
|
2778
|
-
|
2779
|
-
|
2780
|
-
|
2781
|
-
|
2782
|
-
|
2783
|
-
|
2784
|
-
|
2785
|
-
|
2786
|
-
|
2787
|
-
|
2788
|
-
|
2789
|
-
|
2790
|
-
|
2791
|
-
|
2792
|
-
|
2793
|
-
|
2794
|
-
|
2795
|
-
|
2796
|
-
|
2797
|
-
|
2798
|
-
|
2799
|
-
|
2800
|
-
|
2801
|
-
|
2802
|
-
|
2803
|
-
|
2804
|
-
|
2805
|
-
|
2806
|
-
|
2807
|
-
|
2808
|
-
|
2809
|
-
|
2810
|
-
|
2811
|
-
|
2812
|
-
|
2813
|
-
|
2814
|
-
|
2815
|
-
|
2816
|
-
|
2817
|
-
|
2818
|
-
|
2819
|
-
|
2820
|
-
|
2821
|
-
|
2822
|
-
|
2823
|
-
|
2824
|
-
|
2825
|
-
|
2826
|
-
|
2827
|
-
|
2828
|
-
|
2829
|
-
|
2830
|
-
|
2831
|
-
|
2832
|
-
|
2833
|
-
|
2834
|
-
|
2835
|
-
|
2836
|
-
|
2837
|
-
|
2838
|
-
|
2839
|
-
|
2840
|
-
|
2841
|
-
|
2842
|
-
|
2843
|
-
|
2844
|
-
|
2845
|
-
|
2846
|
-
|
2847
|
-
|
2848
|
-
|
2849
|
-
|
2850
|
-
|
2851
|
-
|
2852
|
-
|
2853
|
-
|
2854
|
-
|
2855
|
-
|
2856
|
-
|
2857
|
-
|
2858
|
-
|
2859
|
-
|
2860
|
-
|
2861
|
-
|
2862
|
-
|
2863
|
-
|
2864
|
-
|
2865
|
-
|
2866
|
-
|
2867
|
-
|
2868
|
-
|
2869
|
-
|
2870
|
-
|
2871
|
-
|
2872
|
-
|
2873
|
-
|
2874
|
-
|
2875
|
-
|
2876
|
-
|
2877
|
-
|
2878
|
-
|
2879
|
-
|
2880
|
-
|
2881
|
-
|
2882
|
-
|
2883
|
-
|
2884
|
-
|
2885
|
-
|
2886
|
-
|
2887
|
-
|
2888
|
-
|
2889
|
-
|
2890
|
-
|
2891
|
-
|
2892
|
-
|
2893
|
-
|
2894
|
-
|
2895
|
-
|
2896
|
-
|
2897
|
-
|
2898
|
-
|
2899
|
-
|
2900
|
-
|
2901
|
-
|
2902
|
-
|
2903
|
-
|
2904
|
-
|
2905
|
-
|
2906
|
-
|
2907
|
-
|
2908
|
-
|
2909
|
-
|
2910
|
-
|
2911
|
-
|
2912
|
-
|
2913
|
-
|
2914
|
-
|
2915
|
-
|
2916
|
-
|
2917
|
-
|
2918
|
-
|
2919
|
-
|
2920
|
-
|
2921
|
-
|
2922
|
-
|
2923
|
-
|
2924
|
-
|
2925
|
-
|
2926
|
-
|
2927
|
-
|
2928
|
-
|
2929
|
-
|
2930
|
-
|
2931
|
-
|
2932
|
-
|
2933
|
-
|
2934
|
-
|
2935
|
-
|
2936
|
-
|
2937
|
-
|
2938
|
-
|
2939
|
-
|
2940
|
-
|
2941
|
-
|
2942
|
-
|
2943
|
-
|
2944
|
-
|
2945
|
-
|
2946
|
-
|
2947
|
-
|
2948
|
-
|
2949
|
-
|
2950
|
-
|
2951
|
-
|
2952
|
-
|
2953
|
-
|
2954
|
-
|
2955
|
-
|
2956
|
-
|
2957
|
-
|
2958
|
-
|
2959
|
-
|
2960
|
-
|
2961
|
-
|
2962
|
-
|
2963
|
-
|
2964
|
-
|
2965
|
-
|
2966
|
-
|
2967
|
-
|
2968
|
-
|
2969
|
-
|
2970
|
-
|
2971
|
-
|
2972
|
-
|
2973
|
-
|
2974
|
-
|
2975
|
-
|
2976
|
-
|
2977
|
-
|
2978
|
-
|
2979
|
-
|
2980
|
-
|
2981
|
-
|
2982
|
-
|
2983
|
-
|
2984
|
-
|
2985
|
-
|
2986
|
-
|
2987
|
-
|
2988
|
-
|
2989
|
-
|
2990
|
-
|
2991
|
-
|
2992
|
-
|
2993
|
-
|
2994
|
-
|
2995
|
-
|
2996
|
-
|
2997
|
-
|
2998
|
-
|
2999
|
-
|
3000
|
-
|
3001
|
-
|
3002
|
-
|
3003
|
-
|
3004
|
-
|
3005
|
-
|
3006
|
-
|
3007
|
-
|
3008
|
-
|
3009
|
-
|
3010
|
-
|
3011
|
-
|
3012
|
-
|
3013
|
-
|
3014
|
-
|
3015
|
-
|
3016
|
-
|
3017
|
-
|
3018
|
-
|
3019
|
-
|
3020
|
-
|
3021
|
-
|
3022
|
-
|
3023
|
-
|
3024
|
-
|
3025
|
-
|
3026
|
-
|
3027
|
-
|
3028
|
-
|
3029
|
-
|
3030
|
-
|
3031
|
-
|
3032
|
-
|
3033
|
-
|
3034
|
-
|
3035
|
-
|
3036
|
-
|
3037
|
-
|
3038
|
-
|
3039
|
-
|
3040
|
-
|
3041
|
-
|
3042
|
-
|
3043
|
-
|
3044
|
-
|
3045
|
-
|
3046
|
-
|
3047
|
-
|
3048
|
-
|
3049
|
-
|
3050
|
-
|
3051
|
-
|
3052
|
-
|
3053
|
-
|
3054
|
-
|
3055
|
-
|
3056
|
-
|
3057
|
-
|
3058
|
-
|
3059
|
-
|
3060
|
-
|
3061
|
-
|
3062
|
-
|
3063
|
-
|
3064
|
-
|
3065
|
-
|
3066
|
-
|
3067
|
-
|
3068
|
-
|
3069
|
-
|
3070
|
-
|
3071
|
-
|
3072
|
-
|
3073
|
-
|
3074
|
-
|
3075
|
-
|
3076
|
-
|
3077
|
-
|
3078
|
-
|
3079
|
-
|
3080
|
-
|
3081
|
-
|
3082
|
-
|
3083
|
-
|
3084
|
-
|
3085
|
-
|
3086
|
-
|
3087
|
-
|
3088
|
-
|
3089
|
-
|
3090
|
-
|
3091
|
-
|
3092
|
-
|
3093
|
-
|
3094
|
-
|
3095
|
-
|
3096
|
-
|
3097
|
-
|
3098
|
-
|
3099
|
-
|
3100
|
-
|
3101
|
-
|
3102
|
-
|
3103
|
-
|
3104
|
-
|
3105
|
-
|
3106
|
-
|
3107
|
-
|
3108
|
-
|
3109
|
-
|
3110
|
-
|
3111
|
-
|
3112
|
-
|
3113
|
-
|
3114
|
-
|
3115
|
-
|
3116
|
-
|
3117
|
-
|
3118
|
-
|
3119
|
-
|
3120
|
-
|
3121
|
-
|
3122
|
-
|
3123
|
-
|
3124
|
-
|
3125
|
-
|
3126
|
-
|
3127
|
-
|
3128
|
-
|
3129
|
-
|
3130
|
-
|
3131
|
-
|
3132
|
-
|
3133
|
-
|
3134
|
-
|
3135
|
-
|
3136
|
-
|
3137
|
-
|
3138
|
-
|
3139
|
-
|
3140
|
-
|
3141
|
-
|
3142
|
-
|
3143
|
-
|
3144
|
-
|
3145
|
-
|
3146
|
-
|
3147
|
-
|
3148
|
-
|
3149
|
-
|
3150
|
-
|
3151
|
-
|
3152
|
-
|
3153
|
-
|
3154
|
-
|
3155
|
-
|
3156
|
-
|
3157
|
-
|
3158
|
-
|
3159
|
-
|
3160
|
-
|
3161
|
-
|
3162
|
-
|
3163
|
-
|
3164
|
-
|
3165
|
-
|
3166
|
-
|
3167
|
-
|
3168
|
-
|
3169
|
-
|
3170
|
-
|
3171
|
-
|
3172
|
-
|
3173
|
-
|
3174
|
-
|
3175
|
-
|
3176
|
-
|
3177
|
-
|
3178
|
-
|
3179
|
-
|
3180
|
-
|
3181
|
-
|
3182
|
-
|
3183
|
-
|
3184
|
-
|
3185
|
-
|
3186
|
-
|
3187
|
-
|
3188
|
-
|
3189
|
-
|
3190
|
-
|
3191
|
-
|
3192
|
-
|
3193
|
-
|
3194
|
-
|
3195
|
-
|
3196
|
-
|
3197
|
-
|
3198
|
-
|
3199
|
-
|
3200
|
-
|
3201
|
-
|
3202
|
-
|
3203
|
-
|
3204
|
-
|
3205
|
-
|
3206
|
-
|
3207
|
-
|
3208
|
-
|
3209
|
-
|
3210
|
-
|
3211
|
-
|
3212
|
-
|
3213
|
-
|
3214
|
-
|
3215
|
-
|
3216
|
-
|
3217
|
-
|
3218
|
-
|
3219
|
-
|
3220
|
-
|
3221
|
-
|
3222
|
-
|
3223
|
-
|
3224
|
-
|
3225
|
-
|
3226
|
-
|
3227
|
-
|
3228
|
-
|
3229
|
-
|
3230
|
-
|
3231
|
-
|
3232
|
-
|
3233
|
-
|
3234
|
-
|
3235
|
-
|
3236
|
-
|
3237
|
-
|
3238
|
-
|
3239
|
-
|
3240
|
-
|
3241
|
-
|
3242
|
-
|
3243
|
-
|
3244
|
-
|
3245
|
-
|
3246
|
-
|
3247
|
-
|
3248
|
-
|
3249
|
-
|
3250
|
-
|
3251
|
-
|
3252
|
-
|
3253
|
-
|
3254
|
-
|
3255
|
-
|
3256
|
-
|
3257
|
-
|
3258
|
-
|
3259
|
-
|
3260
|
-
|
3261
|
-
|
3262
|
-
|
3263
|
-
|
3264
|
-
|
3265
|
-
|
3266
|
-
|
3267
|
-
|
3268
|
-
|
3269
|
-
|
3270
|
-
|
3271
|
-
|
3272
|
-
|
3273
|
-
|
3274
|
-
|
3275
|
-
|
3276
|
-
|
3277
|
-
|
3278
|
-
|
3279
|
-
|
3280
|
-
|
3281
|
-
|
3282
|
-
|
3283
|
-
|
3284
|
-
|
3285
|
-
|
3286
|
-
|
3287
|
-
|
3288
|
-
|
3289
|
-
|
3290
|
-
|
3291
|
-
|
3292
|
-
|
3293
|
-
|
3294
|
-
|
3295
|
-
|
3296
|
-
|
3297
|
-
|
3298
|
-
|
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$n = 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$n.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;
|
3293
|
+
|
3294
|
+
Object.defineProperty(Factory$7, "__esModule", { value: true });
|
3295
|
+
Factory$7.ApplicationModule = void 0;
|
3296
|
+
const base_1$m = 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$m.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
|
+
}
|
3299
3564
|
}
|
3565
|
+
Factory$7.ApplicationModule = ApplicationModule;
|
3300
3566
|
|
3301
|
-
|
3302
|
-
|
3303
|
-
|
3304
|
-
|
3305
|
-
|
3306
|
-
|
3307
|
-
|
3308
|
-
|
3309
|
-
|
3310
|
-
|
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 });
|
3311
3583
|
/**
|
3312
|
-
*
|
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
|
3313
3593
|
*/
|
3314
|
-
|
3315
|
-
|
3316
|
-
|
3317
|
-
*
|
3318
|
-
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
3319
|
-
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
3320
|
-
* for an Application throughout its entire lifecycle.
|
3321
|
-
*
|
3322
|
-
* @example
|
3323
|
-
*
|
3324
|
-
* ```js
|
3325
|
-
* fin.Application.wrap({ uuid: 'testapp' })
|
3326
|
-
* .then(app => app.isRunning())
|
3327
|
-
* .then(running => console.log('Application is running: ' + running))
|
3328
|
-
* .catch(err => console.log(err));
|
3329
|
-
* ```
|
3330
|
-
*
|
3331
|
-
*/
|
3332
|
-
async wrap(identity) {
|
3333
|
-
this.wire.sendAction('wrap-application').catch((e) => {
|
3334
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
3335
|
-
});
|
3336
|
-
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
3337
|
-
if (errorMsg) {
|
3338
|
-
throw new Error(errorMsg);
|
3339
|
-
}
|
3340
|
-
return new Instance_1.Application(this.wire, identity);
|
3341
|
-
}
|
3342
|
-
/**
|
3343
|
-
* Synchronously returns an API handle for the given Application identity.
|
3344
|
-
*
|
3345
|
-
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
3346
|
-
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
3347
|
-
* for an Aplication throughout its entire lifecycle.
|
3348
|
-
*
|
3349
|
-
* @example
|
3350
|
-
*
|
3351
|
-
* ```js
|
3352
|
-
* const app = fin.Application.wrapSync({ uuid: 'testapp' });
|
3353
|
-
* await app.close();
|
3354
|
-
* ```
|
3355
|
-
*
|
3356
|
-
*/
|
3357
|
-
wrapSync(identity) {
|
3358
|
-
this.wire.sendAction('wrap-application-sync').catch((e) => {
|
3359
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
3360
|
-
});
|
3361
|
-
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
3362
|
-
if (errorMsg) {
|
3363
|
-
throw new Error(errorMsg);
|
3364
|
-
}
|
3365
|
-
return new Instance_1.Application(this.wire, identity);
|
3366
|
-
}
|
3367
|
-
async _create(appOptions) {
|
3368
|
-
// set defaults:
|
3369
|
-
if (appOptions.waitForPageLoad === undefined) {
|
3370
|
-
appOptions.waitForPageLoad = false;
|
3371
|
-
}
|
3372
|
-
if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
|
3373
|
-
appOptions.autoShow = true;
|
3374
|
-
}
|
3375
|
-
await this.wire.sendAction('create-application', appOptions);
|
3376
|
-
return this.wrap({ uuid: appOptions.uuid });
|
3377
|
-
}
|
3378
|
-
/**
|
3379
|
-
* DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
|
3380
|
-
*
|
3381
|
-
* @example
|
3382
|
-
*
|
3383
|
-
* ```js
|
3384
|
-
* async function createApp() {
|
3385
|
-
* const app = await fin.Application.create({
|
3386
|
-
* name: 'myApp',
|
3387
|
-
* uuid: 'app-3',
|
3388
|
-
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
|
3389
|
-
* autoShow: true
|
3390
|
-
* });
|
3391
|
-
* await app.run();
|
3392
|
-
* }
|
3393
|
-
*
|
3394
|
-
* createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
|
3395
|
-
* ```
|
3396
|
-
*
|
3397
|
-
* @ignore
|
3398
|
-
*/
|
3399
|
-
create(appOptions) {
|
3400
|
-
console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
|
3401
|
-
this.wire.sendAction('application-create').catch((e) => {
|
3402
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
3403
|
-
});
|
3404
|
-
return this._create(appOptions);
|
3405
|
-
}
|
3406
|
-
/**
|
3407
|
-
* Creates and starts a new Application.
|
3408
|
-
*
|
3409
|
-
* @example
|
3410
|
-
*
|
3411
|
-
* ```js
|
3412
|
-
* async function start() {
|
3413
|
-
* return fin.Application.start({
|
3414
|
-
* name: 'app-1',
|
3415
|
-
* uuid: 'app-1',
|
3416
|
-
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
|
3417
|
-
* autoShow: true
|
3418
|
-
* });
|
3419
|
-
* }
|
3420
|
-
* start().then(() => console.log('Application is running')).catch(err => console.log(err));
|
3421
|
-
* ```
|
3422
|
-
*
|
3423
|
-
*/
|
3424
|
-
async start(appOptions) {
|
3425
|
-
this.wire.sendAction('start-application').catch((e) => {
|
3426
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
3427
|
-
});
|
3428
|
-
const app = await this._create(appOptions);
|
3429
|
-
await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
|
3430
|
-
return app;
|
3431
|
-
}
|
3432
|
-
/**
|
3433
|
-
* Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
|
3434
|
-
* Returns once the RVM is finished attempting to launch the applications.
|
3435
|
-
* @param opts - Parameters that the RVM will use.
|
3436
|
-
*
|
3437
|
-
* @example
|
3438
|
-
*
|
3439
|
-
* ```js
|
3440
|
-
*
|
3441
|
-
* const applicationInfoArray = [
|
3442
|
-
* {
|
3443
|
-
* "uuid": 'App-1',
|
3444
|
-
* "manifestUrl": 'http://localhost:5555/app1.json',
|
3445
|
-
* },
|
3446
|
-
* {
|
3447
|
-
* "uuid": 'App-2',
|
3448
|
-
* "manifestUrl": 'http://localhost:5555/app2.json',
|
3449
|
-
* },
|
3450
|
-
* {
|
3451
|
-
* "uuid": 'App-3',
|
3452
|
-
* "manifestUrl": 'http://localhost:5555/app3.json',
|
3453
|
-
* }
|
3454
|
-
* ]
|
3455
|
-
*
|
3456
|
-
* fin.Application.startManyManifests(applicationInfoArray)
|
3457
|
-
* .then(() => {
|
3458
|
-
* console.log('RVM has finished launching the application list.');
|
3459
|
-
* })
|
3460
|
-
* .catch((err) => {
|
3461
|
-
* console.log(err);
|
3462
|
-
* })
|
3463
|
-
* ```
|
3464
|
-
*
|
3465
|
-
* @experimental
|
3466
|
-
*/
|
3467
|
-
async startManyManifests(applications, opts) {
|
3468
|
-
return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
|
3469
|
-
}
|
3470
|
-
/**
|
3471
|
-
* Asynchronously returns an Application object that represents the current application
|
3472
|
-
*
|
3473
|
-
* @example
|
3474
|
-
*
|
3475
|
-
* ```js
|
3476
|
-
* async function isCurrentAppRunning () {
|
3477
|
-
* const app = await fin.Application.getCurrent();
|
3478
|
-
* return app.isRunning();
|
3479
|
-
* }
|
3480
|
-
*
|
3481
|
-
* isCurrentAppRunning().then(running => {
|
3482
|
-
* console.log(`Current app is running: ${running}`);
|
3483
|
-
* }).catch(err => {
|
3484
|
-
* console.error(err);
|
3485
|
-
* });
|
3486
|
-
*
|
3487
|
-
* ```
|
3488
|
-
*/
|
3489
|
-
getCurrent() {
|
3490
|
-
this.wire.sendAction('get-current-application').catch((e) => {
|
3491
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
3492
|
-
});
|
3493
|
-
return this.wrap({ uuid: this.wire.me.uuid });
|
3494
|
-
}
|
3495
|
-
/**
|
3496
|
-
* Synchronously returns an Application object that represents the current application
|
3497
|
-
*
|
3498
|
-
* @example
|
3499
|
-
*
|
3500
|
-
* ```js
|
3501
|
-
* async function isCurrentAppRunning () {
|
3502
|
-
* const app = fin.Application.getCurrentSync();
|
3503
|
-
* return app.isRunning();
|
3504
|
-
* }
|
3505
|
-
*
|
3506
|
-
* isCurrentAppRunning().then(running => {
|
3507
|
-
* console.log(`Current app is running: ${running}`);
|
3508
|
-
* }).catch(err => {
|
3509
|
-
* console.error(err);
|
3510
|
-
* });
|
3511
|
-
*
|
3512
|
-
* ```
|
3513
|
-
*/
|
3514
|
-
getCurrentSync() {
|
3515
|
-
this.wire.sendAction('get-current-application-sync').catch((e) => {
|
3516
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
3517
|
-
});
|
3518
|
-
return this.wrapSync({ uuid: this.wire.me.uuid });
|
3519
|
-
}
|
3520
|
-
/**
|
3521
|
-
* Retrieves application's manifest and returns a running instance of the application.
|
3522
|
-
* @param manifestUrl - The URL of app's manifest.
|
3523
|
-
* @param opts - Parameters that the RVM will use.
|
3524
|
-
*
|
3525
|
-
* @example
|
3526
|
-
*
|
3527
|
-
* ```js
|
3528
|
-
* fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
3529
|
-
*
|
3530
|
-
* // For a local manifest file:
|
3531
|
-
* fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
3532
|
-
* ```
|
3533
|
-
*/
|
3534
|
-
async startFromManifest(manifestUrl, opts) {
|
3535
|
-
this.wire.sendAction('application-start-from-manifest').catch((e) => {
|
3536
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
3537
|
-
});
|
3538
|
-
const app = await this._createFromManifest(manifestUrl);
|
3539
|
-
// @ts-expect-error using private method without warning.
|
3540
|
-
await app._run(opts); // eslint-disable-line no-underscore-dangle
|
3541
|
-
return app;
|
3542
|
-
}
|
3543
|
-
/**
|
3544
|
-
* @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
|
3545
|
-
* Retrieves application's manifest and returns a wrapped application.
|
3546
|
-
* @param manifestUrl - The URL of app's manifest.
|
3547
|
-
* @param callback - called if the method succeeds.
|
3548
|
-
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
3549
|
-
*
|
3550
|
-
* @example
|
3551
|
-
*
|
3552
|
-
* ```js
|
3553
|
-
* fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
|
3554
|
-
* ```
|
3555
|
-
* @ignore
|
3556
|
-
*/
|
3557
|
-
createFromManifest(manifestUrl) {
|
3558
|
-
console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
|
3559
|
-
this.wire.sendAction('application-create-from-manifest').catch((e) => {
|
3560
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
3561
|
-
});
|
3562
|
-
return this._createFromManifest(manifestUrl);
|
3563
|
-
}
|
3564
|
-
_createFromManifest(manifestUrl) {
|
3565
|
-
return this.wire
|
3566
|
-
.sendAction('get-application-manifest', { manifestUrl })
|
3567
|
-
.then(({ payload }) => {
|
3568
|
-
const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
|
3569
|
-
return this.wrap({ uuid });
|
3570
|
-
})
|
3571
|
-
.then((app) => {
|
3572
|
-
app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
|
3573
|
-
return app;
|
3574
|
-
});
|
3575
|
-
}
|
3576
|
-
}
|
3577
|
-
Factory$7.ApplicationModule = ApplicationModule;
|
3578
|
-
return Factory$7;
|
3579
|
-
}
|
3580
|
-
|
3581
|
-
var hasRequiredApplication;
|
3582
|
-
|
3583
|
-
function requireApplication () {
|
3584
|
-
if (hasRequiredApplication) return application;
|
3585
|
-
hasRequiredApplication = 1;
|
3586
|
-
(function (exports) {
|
3587
|
-
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3588
|
-
if (k2 === undefined) k2 = k;
|
3589
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
3590
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
3591
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
3592
|
-
}
|
3593
|
-
Object.defineProperty(o, k2, desc);
|
3594
|
-
}) : (function(o, m, k, k2) {
|
3595
|
-
if (k2 === undefined) k2 = k;
|
3596
|
-
o[k2] = m[k];
|
3597
|
-
}));
|
3598
|
-
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
3599
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
3600
|
-
};
|
3601
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3602
|
-
/**
|
3603
|
-
* Entry points for the OpenFin `Application` API (`fin.Application`).
|
3604
|
-
*
|
3605
|
-
* * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
|
3606
|
-
* * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
|
3607
|
-
*
|
3608
|
-
* 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),
|
3609
|
-
* both of these were documented on the same page.
|
3610
|
-
*
|
3611
|
-
* @packageDocumentation
|
3612
|
-
*/
|
3613
|
-
__exportStar(requireFactory$1(), exports);
|
3614
|
-
__exportStar(requireInstance$1(), exports);
|
3615
|
-
} (application));
|
3616
|
-
return application;
|
3617
|
-
}
|
3594
|
+
__exportStar(Factory$7, exports);
|
3595
|
+
__exportStar(Instance$6, exports);
|
3596
|
+
} (application));
|
3618
3597
|
|
3619
3598
|
var promisifySubscription$1 = {};
|
3620
3599
|
|
@@ -3658,7 +3637,7 @@ function requireInstance () {
|
|
3658
3637
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
3659
3638
|
/* eslint-disable no-console */
|
3660
3639
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
3661
|
-
const application_1 =
|
3640
|
+
const application_1 = application;
|
3662
3641
|
const main_1 = main;
|
3663
3642
|
const view_1 = requireView();
|
3664
3643
|
const warnings_1 = warnings;
|
@@ -7431,12 +7410,12 @@ class ChannelError extends Error {
|
|
7431
7410
|
}
|
7432
7411
|
channelError.ChannelError = ChannelError;
|
7433
7412
|
|
7434
|
-
var __classPrivateFieldGet$
|
7413
|
+
var __classPrivateFieldGet$h = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
7435
7414
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
7436
7415
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
7437
7416
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
7438
7417
|
};
|
7439
|
-
var __classPrivateFieldSet$
|
7418
|
+
var __classPrivateFieldSet$g = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
7440
7419
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
7441
7420
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
7442
7421
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
@@ -7480,7 +7459,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
7480
7459
|
static closeChannelByEndpointId(id) {
|
7481
7460
|
const channel = channelClientsByEndpointId.get(id);
|
7482
7461
|
if (channel) {
|
7483
|
-
__classPrivateFieldGet$
|
7462
|
+
__classPrivateFieldGet$h(channel, _ChannelClient_close, "f").call(channel);
|
7484
7463
|
}
|
7485
7464
|
}
|
7486
7465
|
/**
|
@@ -7491,7 +7470,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
7491
7470
|
for (const channelClient of channelClientsByEndpointId.values()) {
|
7492
7471
|
if (channelClient.providerIdentity.channelId === eventPayload.channelId) {
|
7493
7472
|
channelClient.disconnectListener(eventPayload);
|
7494
|
-
__classPrivateFieldGet$
|
7473
|
+
__classPrivateFieldGet$h(channelClient, _ChannelClient_close, "f").call(channelClient);
|
7495
7474
|
}
|
7496
7475
|
}
|
7497
7476
|
}
|
@@ -7506,12 +7485,12 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
7506
7485
|
this.processAction = (action, payload, senderIdentity) => super.processAction(action, payload, senderIdentity);
|
7507
7486
|
_ChannelClient_close.set(this, () => {
|
7508
7487
|
channelClientsByEndpointId.delete(this.endpointId);
|
7509
|
-
__classPrivateFieldGet$
|
7488
|
+
__classPrivateFieldGet$h(this, _ChannelClient_strategy, "f").close();
|
7510
7489
|
});
|
7511
|
-
__classPrivateFieldSet$
|
7490
|
+
__classPrivateFieldSet$g(this, _ChannelClient_protectedObj, new channel_1$1.ProtectedItems(routingInfo, close), "f");
|
7512
7491
|
this.disconnectListener = () => undefined;
|
7513
7492
|
this.endpointId = routingInfo.endpointId;
|
7514
|
-
__classPrivateFieldSet$
|
7493
|
+
__classPrivateFieldSet$g(this, _ChannelClient_strategy, strategy, "f");
|
7515
7494
|
channelClientsByEndpointId.set(this.endpointId, this);
|
7516
7495
|
strategy.receive(this.processAction);
|
7517
7496
|
}
|
@@ -7519,7 +7498,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
7519
7498
|
* a read-only provider identity
|
7520
7499
|
*/
|
7521
7500
|
get providerIdentity() {
|
7522
|
-
const protectedObj = __classPrivateFieldGet$
|
7501
|
+
const protectedObj = __classPrivateFieldGet$h(this, _ChannelClient_protectedObj, "f");
|
7523
7502
|
return protectedObj.providerIdentity;
|
7524
7503
|
}
|
7525
7504
|
/**
|
@@ -7548,9 +7527,9 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
7548
7527
|
* ```
|
7549
7528
|
*/
|
7550
7529
|
async dispatch(action, payload) {
|
7551
|
-
if (__classPrivateFieldGet$
|
7530
|
+
if (__classPrivateFieldGet$h(this, _ChannelClient_strategy, "f").isEndpointConnected(this.providerIdentity.channelId)) {
|
7552
7531
|
const callSites = transport_errors_1$3.RuntimeError.getCallSite();
|
7553
|
-
return __classPrivateFieldGet$
|
7532
|
+
return __classPrivateFieldGet$h(this, _ChannelClient_strategy, "f").send(this.providerIdentity.channelId, action, payload).catch((e) => {
|
7554
7533
|
throw new channel_error_1$1.ChannelError(e, action, payload, callSites);
|
7555
7534
|
});
|
7556
7535
|
}
|
@@ -7602,10 +7581,10 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
7602
7581
|
*/
|
7603
7582
|
async disconnect() {
|
7604
7583
|
await this.sendDisconnectAction();
|
7605
|
-
__classPrivateFieldGet$
|
7584
|
+
__classPrivateFieldGet$h(this, _ChannelClient_close, "f").call(this);
|
7606
7585
|
}
|
7607
7586
|
async sendDisconnectAction() {
|
7608
|
-
const protectedObj = __classPrivateFieldGet$
|
7587
|
+
const protectedObj = __classPrivateFieldGet$h(this, _ChannelClient_protectedObj, "f");
|
7609
7588
|
await protectedObj.close();
|
7610
7589
|
}
|
7611
7590
|
/**
|
@@ -7638,13 +7617,13 @@ exhaustive.exhaustiveCheck = exhaustiveCheck;
|
|
7638
7617
|
|
7639
7618
|
var strategy$3 = {};
|
7640
7619
|
|
7641
|
-
var __classPrivateFieldSet$
|
7620
|
+
var __classPrivateFieldSet$f = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
7642
7621
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
7643
7622
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
7644
7623
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
7645
7624
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
7646
7625
|
};
|
7647
|
-
var __classPrivateFieldGet$
|
7626
|
+
var __classPrivateFieldGet$g = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
7648
7627
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
7649
7628
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
7650
7629
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
@@ -7669,7 +7648,7 @@ class ClassicStrategy {
|
|
7669
7648
|
// connection problems occur
|
7670
7649
|
_ClassicStrategy_pendingMessagesByEndpointId.set(this, new Map());
|
7671
7650
|
this.send = async (endpointId, action, payload) => {
|
7672
|
-
const to = __classPrivateFieldGet$
|
7651
|
+
const to = __classPrivateFieldGet$g(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
|
7673
7652
|
if (!to) {
|
7674
7653
|
throw new Error(`Could not locate routing info for endpoint ${endpointId}`);
|
7675
7654
|
}
|
@@ -7681,13 +7660,13 @@ class ClassicStrategy {
|
|
7681
7660
|
}
|
7682
7661
|
delete cleanId.isLocalEndpointId;
|
7683
7662
|
// grab the promise before awaiting it to save in our pending messages map
|
7684
|
-
const p = __classPrivateFieldGet$
|
7663
|
+
const p = __classPrivateFieldGet$g(this, _ClassicStrategy_wire, "f").sendAction('send-channel-message', {
|
7685
7664
|
...cleanId,
|
7686
7665
|
providerIdentity: this.providerIdentity,
|
7687
7666
|
action,
|
7688
7667
|
payload
|
7689
7668
|
});
|
7690
|
-
__classPrivateFieldGet$
|
7669
|
+
__classPrivateFieldGet$g(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.add(p);
|
7691
7670
|
const raw = await p
|
7692
7671
|
.catch((error) => {
|
7693
7672
|
if ('cause' in error) {
|
@@ -7697,16 +7676,16 @@ class ClassicStrategy {
|
|
7697
7676
|
})
|
7698
7677
|
.finally(() => {
|
7699
7678
|
// clean up the pending promise
|
7700
|
-
__classPrivateFieldGet$
|
7679
|
+
__classPrivateFieldGet$g(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.delete(p);
|
7701
7680
|
});
|
7702
7681
|
return raw.payload.data.result;
|
7703
7682
|
};
|
7704
7683
|
this.close = async () => {
|
7705
7684
|
this.messageReceiver.removeEndpoint(this.providerIdentity.channelId, this.endpointId);
|
7706
|
-
[...__classPrivateFieldGet$
|
7707
|
-
__classPrivateFieldSet$
|
7685
|
+
[...__classPrivateFieldGet$g(this, _ClassicStrategy_endpointIdentityMap, "f").keys()].forEach((id) => this.closeEndpoint(id));
|
7686
|
+
__classPrivateFieldSet$f(this, _ClassicStrategy_endpointIdentityMap, new Map(), "f");
|
7708
7687
|
};
|
7709
|
-
__classPrivateFieldSet$
|
7688
|
+
__classPrivateFieldSet$f(this, _ClassicStrategy_wire, wire, "f");
|
7710
7689
|
}
|
7711
7690
|
onEndpointDisconnect(endpointId, listener) {
|
7712
7691
|
// Never fires for 'classic'.
|
@@ -7715,20 +7694,20 @@ class ClassicStrategy {
|
|
7715
7694
|
this.messageReceiver.addEndpoint(listener, this.providerIdentity.channelId, this.endpointId);
|
7716
7695
|
}
|
7717
7696
|
async closeEndpoint(endpointId) {
|
7718
|
-
const id = __classPrivateFieldGet$
|
7719
|
-
__classPrivateFieldGet$
|
7720
|
-
const pendingSet = __classPrivateFieldGet$
|
7697
|
+
const id = __classPrivateFieldGet$g(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
|
7698
|
+
__classPrivateFieldGet$g(this, _ClassicStrategy_endpointIdentityMap, "f").delete(endpointId);
|
7699
|
+
const pendingSet = __classPrivateFieldGet$g(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId);
|
7721
7700
|
pendingSet?.forEach((p) => {
|
7722
7701
|
const errorMsg = `Channel connection with identity uuid: ${id?.uuid} / name: ${id?.name} / endpointId: ${endpointId} no longer connected.`;
|
7723
7702
|
p.cancel(new Error(errorMsg));
|
7724
7703
|
});
|
7725
7704
|
}
|
7726
7705
|
isEndpointConnected(endpointId) {
|
7727
|
-
return __classPrivateFieldGet$
|
7706
|
+
return __classPrivateFieldGet$g(this, _ClassicStrategy_endpointIdentityMap, "f").has(endpointId);
|
7728
7707
|
}
|
7729
7708
|
addEndpoint(endpointId, payload) {
|
7730
|
-
__classPrivateFieldGet$
|
7731
|
-
__classPrivateFieldGet$
|
7709
|
+
__classPrivateFieldGet$g(this, _ClassicStrategy_endpointIdentityMap, "f").set(endpointId, payload.endpointIdentity);
|
7710
|
+
__classPrivateFieldGet$g(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").set(endpointId, new Set());
|
7732
7711
|
}
|
7733
7712
|
isValidEndpointPayload(payload) {
|
7734
7713
|
return (typeof payload?.endpointIdentity?.endpointId === 'string' ||
|
@@ -7763,12 +7742,12 @@ function errorToPOJO(error) {
|
|
7763
7742
|
}
|
7764
7743
|
errors.errorToPOJO = errorToPOJO;
|
7765
7744
|
|
7766
|
-
var __classPrivateFieldGet$
|
7745
|
+
var __classPrivateFieldGet$f = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
7767
7746
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
7768
7747
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
7769
7748
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
7770
7749
|
};
|
7771
|
-
var __classPrivateFieldSet$
|
7750
|
+
var __classPrivateFieldSet$e = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
7772
7751
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
7773
7752
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
7774
7753
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
@@ -7803,8 +7782,8 @@ class RTCEndpoint {
|
|
7803
7782
|
if (this.rtc.rtcClient.connectionState !== 'connected') {
|
7804
7783
|
this.rtc.rtcClient.removeEventListener('connectionstatechange', this.connectionStateChangeHandler);
|
7805
7784
|
this.close();
|
7806
|
-
if (__classPrivateFieldGet$
|
7807
|
-
__classPrivateFieldGet$
|
7785
|
+
if (__classPrivateFieldGet$f(this, _RTCEndpoint_disconnectListener, "f")) {
|
7786
|
+
__classPrivateFieldGet$f(this, _RTCEndpoint_disconnectListener, "f").call(this);
|
7808
7787
|
}
|
7809
7788
|
}
|
7810
7789
|
};
|
@@ -7852,9 +7831,9 @@ class RTCEndpoint {
|
|
7852
7831
|
data = new TextDecoder().decode(e.data);
|
7853
7832
|
}
|
7854
7833
|
const { messageId, action, payload } = JSON.parse(data);
|
7855
|
-
if (__classPrivateFieldGet$
|
7834
|
+
if (__classPrivateFieldGet$f(this, _RTCEndpoint_processAction, "f")) {
|
7856
7835
|
try {
|
7857
|
-
const res = await __classPrivateFieldGet$
|
7836
|
+
const res = await __classPrivateFieldGet$f(this, _RTCEndpoint_processAction, "f").call(this, action, payload, endpointIdentity);
|
7858
7837
|
this.rtc.channels.response.send(JSON.stringify({
|
7859
7838
|
messageId,
|
7860
7839
|
payload: res,
|
@@ -7888,25 +7867,25 @@ class RTCEndpoint {
|
|
7888
7867
|
datachannel.onclose = (e) => {
|
7889
7868
|
[...this.responseMap.values()].forEach((promise) => promise.reject(new Error('RTCDataChannel closed unexpectedly, this is most commonly caused by message size. Note: RTC Channels have a message size limit of ~255kB.')));
|
7890
7869
|
this.close();
|
7891
|
-
if (__classPrivateFieldGet$
|
7892
|
-
__classPrivateFieldGet$
|
7870
|
+
if (__classPrivateFieldGet$f(this, _RTCEndpoint_disconnectListener, "f")) {
|
7871
|
+
__classPrivateFieldGet$f(this, _RTCEndpoint_disconnectListener, "f").call(this);
|
7893
7872
|
}
|
7894
7873
|
};
|
7895
7874
|
});
|
7896
7875
|
}
|
7897
7876
|
onDisconnect(listener) {
|
7898
|
-
if (!__classPrivateFieldGet$
|
7899
|
-
__classPrivateFieldSet$
|
7877
|
+
if (!__classPrivateFieldGet$f(this, _RTCEndpoint_disconnectListener, "f")) {
|
7878
|
+
__classPrivateFieldSet$e(this, _RTCEndpoint_disconnectListener, listener, "f");
|
7900
7879
|
}
|
7901
7880
|
else {
|
7902
7881
|
throw new Error('RTCEndpoint disconnectListener cannot be set twice.');
|
7903
7882
|
}
|
7904
7883
|
}
|
7905
7884
|
receive(listener) {
|
7906
|
-
if (__classPrivateFieldGet$
|
7885
|
+
if (__classPrivateFieldGet$f(this, _RTCEndpoint_processAction, "f")) {
|
7907
7886
|
throw new Error('You have already set a listener for this RTC Endpoint.');
|
7908
7887
|
}
|
7909
|
-
__classPrivateFieldSet$
|
7888
|
+
__classPrivateFieldSet$e(this, _RTCEndpoint_processAction, listener, "f");
|
7910
7889
|
}
|
7911
7890
|
get connected() {
|
7912
7891
|
return this.rtc.rtcClient.connectionState === 'connected';
|
@@ -7917,12 +7896,12 @@ _RTCEndpoint_processAction = new WeakMap(), _RTCEndpoint_disconnectListener = ne
|
|
7917
7896
|
|
7918
7897
|
var strategy$1 = {};
|
7919
7898
|
|
7920
|
-
var __classPrivateFieldGet$
|
7899
|
+
var __classPrivateFieldGet$e = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
7921
7900
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
7922
7901
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
7923
7902
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
7924
7903
|
};
|
7925
|
-
var __classPrivateFieldSet$
|
7904
|
+
var __classPrivateFieldSet$d = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
7926
7905
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
7927
7906
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
7928
7907
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
@@ -7943,11 +7922,11 @@ class EndpointStrategy {
|
|
7943
7922
|
return this.getEndpointById(endpointId).send(action, payload);
|
7944
7923
|
};
|
7945
7924
|
this.close = async () => {
|
7946
|
-
if (__classPrivateFieldGet$
|
7947
|
-
__classPrivateFieldGet$
|
7948
|
-
__classPrivateFieldSet$
|
7925
|
+
if (__classPrivateFieldGet$e(this, _EndpointStrategy_connected, "f")) {
|
7926
|
+
__classPrivateFieldGet$e(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.close());
|
7927
|
+
__classPrivateFieldSet$d(this, _EndpointStrategy_endpointMap, new Map(), "f");
|
7949
7928
|
}
|
7950
|
-
__classPrivateFieldSet$
|
7929
|
+
__classPrivateFieldSet$d(this, _EndpointStrategy_connected, false, "f");
|
7951
7930
|
};
|
7952
7931
|
this.isValidEndpointPayload = validateEndpoint;
|
7953
7932
|
}
|
@@ -7955,39 +7934,39 @@ class EndpointStrategy {
|
|
7955
7934
|
this.getEndpointById(endpointId).onDisconnect(listener);
|
7956
7935
|
}
|
7957
7936
|
receive(listener) {
|
7958
|
-
if (__classPrivateFieldGet$
|
7937
|
+
if (__classPrivateFieldGet$e(this, _EndpointStrategy_processAction, "f")) {
|
7959
7938
|
throw new Error(`You have already set a listener for this ${this.StrategyName} Strategy`);
|
7960
7939
|
}
|
7961
|
-
__classPrivateFieldSet$
|
7940
|
+
__classPrivateFieldSet$d(this, _EndpointStrategy_processAction, listener, "f");
|
7962
7941
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
7963
|
-
__classPrivateFieldGet$
|
7942
|
+
__classPrivateFieldGet$e(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.receive(__classPrivateFieldGet$e(this, _EndpointStrategy_processAction, "f")));
|
7964
7943
|
}
|
7965
7944
|
getEndpointById(endpointId) {
|
7966
|
-
const endpoint = __classPrivateFieldGet$
|
7945
|
+
const endpoint = __classPrivateFieldGet$e(this, _EndpointStrategy_endpointMap, "f").get(endpointId);
|
7967
7946
|
if (!endpoint) {
|
7968
7947
|
throw new Error(`Client with endpoint id ${endpointId} is not connected`);
|
7969
7948
|
}
|
7970
7949
|
return endpoint;
|
7971
7950
|
}
|
7972
7951
|
get connected() {
|
7973
|
-
return __classPrivateFieldGet$
|
7952
|
+
return __classPrivateFieldGet$e(this, _EndpointStrategy_connected, "f");
|
7974
7953
|
}
|
7975
7954
|
isEndpointConnected(endpointId) {
|
7976
|
-
return __classPrivateFieldGet$
|
7955
|
+
return __classPrivateFieldGet$e(this, _EndpointStrategy_endpointMap, "f").has(endpointId);
|
7977
7956
|
}
|
7978
7957
|
addEndpoint(endpointId, payload) {
|
7979
|
-
if (!__classPrivateFieldGet$
|
7958
|
+
if (!__classPrivateFieldGet$e(this, _EndpointStrategy_connected, "f")) {
|
7980
7959
|
console.warn(`Adding endpoint to disconnected ${this.StrategyName} Strategy`);
|
7981
7960
|
return;
|
7982
7961
|
}
|
7983
7962
|
const clientStrat = new this.EndpointType(payload);
|
7984
|
-
if (__classPrivateFieldGet$
|
7985
|
-
clientStrat.receive(__classPrivateFieldGet$
|
7963
|
+
if (__classPrivateFieldGet$e(this, _EndpointStrategy_processAction, "f")) {
|
7964
|
+
clientStrat.receive(__classPrivateFieldGet$e(this, _EndpointStrategy_processAction, "f"));
|
7986
7965
|
}
|
7987
|
-
__classPrivateFieldGet$
|
7966
|
+
__classPrivateFieldGet$e(this, _EndpointStrategy_endpointMap, "f").set(endpointId, clientStrat);
|
7988
7967
|
}
|
7989
7968
|
async closeEndpoint(endpointId) {
|
7990
|
-
__classPrivateFieldGet$
|
7969
|
+
__classPrivateFieldGet$e(this, _EndpointStrategy_endpointMap, "f").delete(endpointId);
|
7991
7970
|
}
|
7992
7971
|
}
|
7993
7972
|
strategy$1.EndpointStrategy = EndpointStrategy;
|
@@ -8169,12 +8148,12 @@ function runtimeUuidMeetsMinimumRuntimeVersion(runtimeUuid, minVersion) {
|
|
8169
8148
|
}
|
8170
8149
|
runtimeVersioning.runtimeUuidMeetsMinimumRuntimeVersion = runtimeUuidMeetsMinimumRuntimeVersion;
|
8171
8150
|
|
8172
|
-
var __classPrivateFieldGet$
|
8151
|
+
var __classPrivateFieldGet$d = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
8173
8152
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
8174
8153
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
8175
8154
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
8176
8155
|
};
|
8177
|
-
var __classPrivateFieldSet$
|
8156
|
+
var __classPrivateFieldSet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
8178
8157
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
8179
8158
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
8180
8159
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
@@ -8218,19 +8197,19 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
8218
8197
|
* a read-only array containing all the identities of connecting clients.
|
8219
8198
|
*/
|
8220
8199
|
get connections() {
|
8221
|
-
return [...__classPrivateFieldGet$
|
8200
|
+
return [...__classPrivateFieldGet$d(this, _ChannelProvider_connections, "f")];
|
8222
8201
|
}
|
8223
8202
|
static handleClientDisconnection(channel, payload) {
|
8224
8203
|
if (payload?.endpointId) {
|
8225
8204
|
const { uuid, name, endpointId, isLocalEndpointId } = payload;
|
8226
|
-
__classPrivateFieldGet$
|
8205
|
+
__classPrivateFieldGet$d(channel, _ChannelProvider_removeEndpoint, "f").call(channel, { uuid, name, endpointId, isLocalEndpointId });
|
8227
8206
|
}
|
8228
8207
|
else {
|
8229
8208
|
// this is here to support older runtimes that did not have endpointId
|
8230
8209
|
const multipleRemoves = channel.connections.filter((identity) => {
|
8231
8210
|
return identity.uuid === payload.uuid && identity.name === payload.name;
|
8232
8211
|
});
|
8233
|
-
multipleRemoves.forEach(__classPrivateFieldGet$
|
8212
|
+
multipleRemoves.forEach(__classPrivateFieldGet$d(channel, _ChannelProvider_removeEndpoint, "f"));
|
8234
8213
|
}
|
8235
8214
|
channel.disconnectListener(payload);
|
8236
8215
|
}
|
@@ -8247,8 +8226,8 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
8247
8226
|
_ChannelProvider_strategy.set(this, void 0);
|
8248
8227
|
_ChannelProvider_removeEndpoint.set(this, (identity) => {
|
8249
8228
|
const remainingConnections = this.connections.filter((clientIdentity) => clientIdentity.endpointId !== identity.endpointId);
|
8250
|
-
__classPrivateFieldGet$
|
8251
|
-
__classPrivateFieldSet$
|
8229
|
+
__classPrivateFieldGet$d(this, _ChannelProvider_strategy, "f").closeEndpoint(identity.endpointId);
|
8230
|
+
__classPrivateFieldSet$c(this, _ChannelProvider_connections, remainingConnections, "f");
|
8252
8231
|
});
|
8253
8232
|
// Must be bound.
|
8254
8233
|
this.processAction = async (action, payload, senderIdentity) => {
|
@@ -8262,17 +8241,17 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
8262
8241
|
return super.processAction(action, payload, senderIdentity);
|
8263
8242
|
};
|
8264
8243
|
_ChannelProvider_close.set(this, () => {
|
8265
|
-
__classPrivateFieldGet$
|
8244
|
+
__classPrivateFieldGet$d(this, _ChannelProvider_strategy, "f").close();
|
8266
8245
|
const remove = ChannelProvider.removalMap.get(this);
|
8267
8246
|
if (remove) {
|
8268
8247
|
remove();
|
8269
8248
|
}
|
8270
8249
|
});
|
8271
|
-
__classPrivateFieldSet$
|
8250
|
+
__classPrivateFieldSet$c(this, _ChannelProvider_protectedObj, new channel_1.ProtectedItems(providerIdentity, close), "f");
|
8272
8251
|
this.connectListener = () => undefined;
|
8273
8252
|
this.disconnectListener = () => undefined;
|
8274
|
-
__classPrivateFieldSet$
|
8275
|
-
__classPrivateFieldSet$
|
8253
|
+
__classPrivateFieldSet$c(this, _ChannelProvider_connections, [], "f");
|
8254
|
+
__classPrivateFieldSet$c(this, _ChannelProvider_strategy, strategy, "f");
|
8276
8255
|
strategy.receive(this.processAction);
|
8277
8256
|
}
|
8278
8257
|
/**
|
@@ -8303,16 +8282,16 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
8303
8282
|
*/
|
8304
8283
|
dispatch(to, action, payload) {
|
8305
8284
|
const endpointId = to.endpointId ?? this.getEndpointIdForOpenFinId(to, action);
|
8306
|
-
if (endpointId && __classPrivateFieldGet$
|
8285
|
+
if (endpointId && __classPrivateFieldGet$d(this, _ChannelProvider_strategy, "f").isEndpointConnected(endpointId)) {
|
8307
8286
|
const callSites = transport_errors_1$2.RuntimeError.getCallSite();
|
8308
|
-
return __classPrivateFieldGet$
|
8287
|
+
return __classPrivateFieldGet$d(this, _ChannelProvider_strategy, "f").send(endpointId, action, payload).catch((e) => {
|
8309
8288
|
throw new channel_error_1.ChannelError(e, action, payload, callSites);
|
8310
8289
|
});
|
8311
8290
|
}
|
8312
8291
|
return Promise.reject(new Error(`Client connection with identity uuid: ${to.uuid} / name: ${to.name} / endpointId: ${endpointId} no longer connected.`));
|
8313
8292
|
}
|
8314
8293
|
async processConnection(senderId, payload) {
|
8315
|
-
__classPrivateFieldGet$
|
8294
|
+
__classPrivateFieldGet$d(this, _ChannelProvider_connections, "f").push(senderId);
|
8316
8295
|
return this.connectListener(senderId, payload);
|
8317
8296
|
}
|
8318
8297
|
/**
|
@@ -8335,7 +8314,7 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
8335
8314
|
* ```
|
8336
8315
|
*/
|
8337
8316
|
publish(action, payload) {
|
8338
|
-
return this.connections.map((to) => __classPrivateFieldGet$
|
8317
|
+
return this.connections.map((to) => __classPrivateFieldGet$d(this, _ChannelProvider_strategy, "f").send(to.endpointId, action, payload));
|
8339
8318
|
}
|
8340
8319
|
/**
|
8341
8320
|
* Register a listener that is called on every new client connection.
|
@@ -8409,11 +8388,11 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
8409
8388
|
* ```
|
8410
8389
|
*/
|
8411
8390
|
async destroy() {
|
8412
|
-
const protectedObj = __classPrivateFieldGet$
|
8391
|
+
const protectedObj = __classPrivateFieldGet$d(this, _ChannelProvider_protectedObj, "f");
|
8413
8392
|
protectedObj.providerIdentity;
|
8414
|
-
__classPrivateFieldSet$
|
8393
|
+
__classPrivateFieldSet$c(this, _ChannelProvider_connections, [], "f");
|
8415
8394
|
await protectedObj.close();
|
8416
|
-
__classPrivateFieldGet$
|
8395
|
+
__classPrivateFieldGet$d(this, _ChannelProvider_close, "f").call(this);
|
8417
8396
|
}
|
8418
8397
|
/**
|
8419
8398
|
* Returns an array with info on every Client connected to the Provider
|
@@ -8483,7 +8462,7 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
8483
8462
|
getEndpointIdForOpenFinId(clientIdentity, action) {
|
8484
8463
|
const matchingConnections = this.connections.filter((c) => c.name === clientIdentity.name && c.uuid === clientIdentity.uuid);
|
8485
8464
|
if (matchingConnections.length >= 2) {
|
8486
|
-
const protectedObj = __classPrivateFieldGet$
|
8465
|
+
const protectedObj = __classPrivateFieldGet$d(this, _ChannelProvider_protectedObj, "f");
|
8487
8466
|
const { uuid, name } = clientIdentity;
|
8488
8467
|
const providerUuid = protectedObj?.providerIdentity.uuid;
|
8489
8468
|
const providerName = protectedObj?.providerIdentity.name;
|
@@ -8695,13 +8674,13 @@ class CombinedStrategy {
|
|
8695
8674
|
}
|
8696
8675
|
strategy.default = CombinedStrategy;
|
8697
8676
|
|
8698
|
-
var __classPrivateFieldSet$
|
8677
|
+
var __classPrivateFieldSet$b = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
8699
8678
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
8700
8679
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
8701
8680
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
8702
8681
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
8703
8682
|
};
|
8704
|
-
var __classPrivateFieldGet$
|
8683
|
+
var __classPrivateFieldGet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
8705
8684
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
8706
8685
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
8707
8686
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
@@ -8750,8 +8729,8 @@ class ConnectionManager extends base_1$i.Base {
|
|
8750
8729
|
};
|
8751
8730
|
this.providerMap = new Map();
|
8752
8731
|
this.protocolManager = new protocol_manager_1.ProtocolManager(this.wire.environment.type === 'node' ? ['classic'] : ['rtc', 'classic']);
|
8753
|
-
__classPrivateFieldSet$
|
8754
|
-
__classPrivateFieldSet$
|
8732
|
+
__classPrivateFieldSet$b(this, _ConnectionManager_messageReceiver, new message_receiver_1.MessageReceiver(wire), "f");
|
8733
|
+
__classPrivateFieldSet$b(this, _ConnectionManager_rtcConnectionManager, new ice_manager_1.RTCICEManager(wire), "f");
|
8755
8734
|
wire.registerMessageHandler(this.onmessage.bind(this));
|
8756
8735
|
}
|
8757
8736
|
createProvider(options, providerIdentity) {
|
@@ -8762,7 +8741,7 @@ class ConnectionManager extends base_1$i.Base {
|
|
8762
8741
|
case 'rtc':
|
8763
8742
|
return new strategy_2.RTCStrategy();
|
8764
8743
|
case 'classic':
|
8765
|
-
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$
|
8744
|
+
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$c(this, _ConnectionManager_messageReceiver, "f"),
|
8766
8745
|
// Providers do not have an endpointId, use channelId as endpointId in the strategy.
|
8767
8746
|
providerIdentity.channelId, providerIdentity);
|
8768
8747
|
default:
|
@@ -8798,7 +8777,7 @@ class ConnectionManager extends base_1$i.Base {
|
|
8798
8777
|
const supportedProtocols = await Promise.all(protocols.map(async (type) => {
|
8799
8778
|
switch (type) {
|
8800
8779
|
case 'rtc': {
|
8801
|
-
const { rtcClient, channels, offer, rtcConnectionId, channelsOpened } = await __classPrivateFieldGet$
|
8780
|
+
const { rtcClient, channels, offer, rtcConnectionId, channelsOpened } = await __classPrivateFieldGet$c(this, _ConnectionManager_rtcConnectionManager, "f").startClientOffer();
|
8802
8781
|
rtcPacket = { rtcClient, channels, channelsOpened };
|
8803
8782
|
return {
|
8804
8783
|
type: 'rtc',
|
@@ -8825,18 +8804,18 @@ class ConnectionManager extends base_1$i.Base {
|
|
8825
8804
|
routingInfo.endpointId = this.wire.environment.getNextMessageId();
|
8826
8805
|
// For New Clients connecting to Old Providers. To prevent multi-dispatching and publishing, we delete previously-connected
|
8827
8806
|
// clients that are in the same context as the newly-connected client.
|
8828
|
-
__classPrivateFieldGet$
|
8807
|
+
__classPrivateFieldGet$c(this, _ConnectionManager_messageReceiver, "f").checkForPreviousClientConnection(routingInfo.channelId);
|
8829
8808
|
}
|
8830
8809
|
const answer = routingInfo.answer ?? {
|
8831
8810
|
supportedProtocols: [{ type: 'classic', version: 1 }]
|
8832
8811
|
};
|
8833
8812
|
const createStrategyFromAnswer = async (protocol) => {
|
8834
8813
|
if (protocol.type === 'rtc' && rtcPacket) {
|
8835
|
-
await __classPrivateFieldGet$
|
8814
|
+
await __classPrivateFieldGet$c(this, _ConnectionManager_rtcConnectionManager, "f").finishClientOffer(rtcPacket.rtcClient, protocol.payload.answer, rtcPacket.channelsOpened);
|
8836
8815
|
return new strategy_2.RTCStrategy();
|
8837
8816
|
}
|
8838
8817
|
if (protocol.type === 'classic') {
|
8839
|
-
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$
|
8818
|
+
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$c(this, _ConnectionManager_messageReceiver, "f"), routingInfo.endpointId, routingInfo);
|
8840
8819
|
}
|
8841
8820
|
return null;
|
8842
8821
|
};
|
@@ -8904,7 +8883,7 @@ class ConnectionManager extends base_1$i.Base {
|
|
8904
8883
|
clientAnswer = await overlappingProtocols.reduce(async (accumP, protocolToUse) => {
|
8905
8884
|
const answer = await accumP;
|
8906
8885
|
if (protocolToUse.type === 'rtc') {
|
8907
|
-
const { answer: rtcAnswer, rtcClient, channels } = await __classPrivateFieldGet$
|
8886
|
+
const { answer: rtcAnswer, rtcClient, channels } = await __classPrivateFieldGet$c(this, _ConnectionManager_rtcConnectionManager, "f").createProviderAnswer(protocolToUse.payload.rtcConnectionId, protocolToUse.payload.offer);
|
8908
8887
|
answer.supportedProtocols.push({
|
8909
8888
|
type: 'rtc',
|
8910
8889
|
version: strategy_2.RTCInfo.version,
|
@@ -8952,13 +8931,13 @@ _ConnectionManager_messageReceiver = new WeakMap(), _ConnectionManager_rtcConnec
|
|
8952
8931
|
*
|
8953
8932
|
* @packageDocumentation
|
8954
8933
|
*/
|
8955
|
-
var __classPrivateFieldSet$
|
8934
|
+
var __classPrivateFieldSet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
8956
8935
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
8957
8936
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
8958
8937
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
8959
8938
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
8960
8939
|
};
|
8961
|
-
var __classPrivateFieldGet$
|
8940
|
+
var __classPrivateFieldGet$b = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
8962
8941
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
8963
8942
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
8964
8943
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
@@ -9015,11 +8994,11 @@ class Channel extends base_1$h.EmitterBase {
|
|
9015
8994
|
client_1.ChannelClient.handleProviderDisconnect(eventPayload);
|
9016
8995
|
}),
|
9017
8996
|
this.on('connected', (...args) => {
|
9018
|
-
__classPrivateFieldGet$
|
8997
|
+
__classPrivateFieldGet$b(this, _Channel_internalEmitter, "f").emit('connected', ...args);
|
9019
8998
|
})
|
9020
8999
|
]).catch(() => new Error('error setting up channel connection listeners'));
|
9021
9000
|
}));
|
9022
|
-
__classPrivateFieldSet$
|
9001
|
+
__classPrivateFieldSet$a(this, _Channel_connectionManager, new connection_manager_1.ConnectionManager(wire), "f");
|
9023
9002
|
}
|
9024
9003
|
/**
|
9025
9004
|
*
|
@@ -9094,7 +9073,7 @@ class Channel extends base_1$h.EmitterBase {
|
|
9094
9073
|
resolve(true);
|
9095
9074
|
}
|
9096
9075
|
};
|
9097
|
-
__classPrivateFieldGet$
|
9076
|
+
__classPrivateFieldGet$b(this, _Channel_internalEmitter, "f").on('connected', connectedListener);
|
9098
9077
|
});
|
9099
9078
|
try {
|
9100
9079
|
if (retryInfo.count > 0) {
|
@@ -9126,7 +9105,7 @@ class Channel extends base_1$h.EmitterBase {
|
|
9126
9105
|
finally {
|
9127
9106
|
retryInfo.count += 1;
|
9128
9107
|
// in case of other errors, remove our listener
|
9129
|
-
__classPrivateFieldGet$
|
9108
|
+
__classPrivateFieldGet$b(this, _Channel_internalEmitter, "f").removeListener('connected', connectedListener);
|
9130
9109
|
}
|
9131
9110
|
} while (shouldWait); // If we're waiting we retry the above loop
|
9132
9111
|
// Should wait was false, no channel was found.
|
@@ -9185,12 +9164,12 @@ class Channel extends base_1$h.EmitterBase {
|
|
9185
9164
|
async connect(channelName, options = {}) {
|
9186
9165
|
// Make sure we don't connect before listeners are set up
|
9187
9166
|
// This also errors if we're not in OpenFin, ensuring we don't run unnecessary code
|
9188
|
-
await __classPrivateFieldGet$
|
9167
|
+
await __classPrivateFieldGet$b(this, _Channel_readyToConnect, "f").getValue();
|
9189
9168
|
if (!channelName || typeof channelName !== 'string') {
|
9190
9169
|
throw new Error('Please provide a channelName string to connect to a channel.');
|
9191
9170
|
}
|
9192
9171
|
const opts = { wait: true, ...this.wire.environment.getDefaultChannelOptions().connect, ...options };
|
9193
|
-
const { offer, rtc: rtcPacket } = await __classPrivateFieldGet$
|
9172
|
+
const { offer, rtc: rtcPacket } = await __classPrivateFieldGet$b(this, _Channel_connectionManager, "f").createClientOffer(opts);
|
9194
9173
|
let connectionUrl;
|
9195
9174
|
if (this.fin.me.isFrame || this.fin.me.isView || this.fin.me.isWindow) {
|
9196
9175
|
connectionUrl = (await this.fin.me.getInfo()).url;
|
@@ -9202,7 +9181,7 @@ class Channel extends base_1$h.EmitterBase {
|
|
9202
9181
|
connectionUrl
|
9203
9182
|
};
|
9204
9183
|
const routingInfo = await this.safeConnect(channelName, opts.wait, connectPayload);
|
9205
|
-
const strategy = await __classPrivateFieldGet$
|
9184
|
+
const strategy = await __classPrivateFieldGet$b(this, _Channel_connectionManager, "f").createClientStrategy(rtcPacket, routingInfo);
|
9206
9185
|
const channel = new client_1.ChannelClient(routingInfo, () => client_1.ChannelClient.wireClose(this.wire, routingInfo, routingInfo.endpointId), strategy);
|
9207
9186
|
// It is the client's responsibility to handle endpoint disconnection to the provider.
|
9208
9187
|
// If the endpoint dies, the client will force a disconnection through the core.
|
@@ -9271,7 +9250,7 @@ class Channel extends base_1$h.EmitterBase {
|
|
9271
9250
|
throw new Error('Please provide a channelName to create a channel');
|
9272
9251
|
}
|
9273
9252
|
const { payload: { data: providerIdentity } } = await this.wire.sendAction('create-channel', { channelName });
|
9274
|
-
const channel = __classPrivateFieldGet$
|
9253
|
+
const channel = __classPrivateFieldGet$b(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
|
9275
9254
|
// TODO: fix typing (internal)
|
9276
9255
|
// @ts-expect-error
|
9277
9256
|
this.on('client-disconnected', (eventPayload) => {
|
@@ -9507,14 +9486,32 @@ var clipboard = {};
|
|
9507
9486
|
*
|
9508
9487
|
* @packageDocumentation
|
9509
9488
|
*/
|
9489
|
+
var __classPrivateFieldGet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
9490
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
9491
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
9492
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
9493
|
+
};
|
9494
|
+
var __classPrivateFieldSet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
9495
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
9496
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
9497
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
9498
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
9499
|
+
};
|
9500
|
+
var _Clipboard_instances, _Clipboard_securedApiWarningCount, _Clipboard_warnSecuredApi;
|
9510
9501
|
Object.defineProperty(clipboard, "__esModule", { value: true });
|
9511
9502
|
clipboard.Clipboard = void 0;
|
9512
9503
|
const base_1$f = base;
|
9504
|
+
const maxSecuredApiWarnings = 10;
|
9513
9505
|
/**
|
9514
9506
|
* The Clipboard API allows reading and writing to the clipboard in multiple formats.
|
9515
9507
|
*
|
9516
9508
|
*/
|
9517
9509
|
class Clipboard extends base_1$f.Base {
|
9510
|
+
constructor() {
|
9511
|
+
super(...arguments);
|
9512
|
+
_Clipboard_instances.add(this);
|
9513
|
+
_Clipboard_securedApiWarningCount.set(this, 0);
|
9514
|
+
}
|
9518
9515
|
/**
|
9519
9516
|
* Writes data into the clipboard as plain text
|
9520
9517
|
* @param writeObj The object for writing data into the clipboard
|
@@ -9527,6 +9524,7 @@ class Clipboard extends base_1$f.Base {
|
|
9527
9524
|
* ```
|
9528
9525
|
*/
|
9529
9526
|
async writeText(writeObj) {
|
9527
|
+
__classPrivateFieldGet$a(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.writeText');
|
9530
9528
|
await this.wire.sendAction('clipboard-write-text', writeObj);
|
9531
9529
|
}
|
9532
9530
|
/**
|
@@ -9539,6 +9537,7 @@ class Clipboard extends base_1$f.Base {
|
|
9539
9537
|
* ```
|
9540
9538
|
*/
|
9541
9539
|
async readText(type) {
|
9540
|
+
__classPrivateFieldGet$a(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.readText');
|
9542
9541
|
// NOTE: When we start supporting linux, we could detect the OS and choose 'selection' automatically for the user
|
9543
9542
|
const { payload } = await this.wire.sendAction('clipboard-read-text', { type });
|
9544
9543
|
return payload.data;
|
@@ -9556,6 +9555,7 @@ class Clipboard extends base_1$f.Base {
|
|
9556
9555
|
* ```
|
9557
9556
|
*/
|
9558
9557
|
async writeImage(writeRequest) {
|
9558
|
+
__classPrivateFieldGet$a(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.writeImage');
|
9559
9559
|
await this.wire.sendAction('clipboard-write-image', writeRequest);
|
9560
9560
|
}
|
9561
9561
|
/**
|
@@ -9591,6 +9591,7 @@ class Clipboard extends base_1$f.Base {
|
|
9591
9591
|
* ```
|
9592
9592
|
*/
|
9593
9593
|
async readImage(readRequest = { format: 'dataURL' }) {
|
9594
|
+
__classPrivateFieldGet$a(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.readImage');
|
9594
9595
|
const { payload } = await this.wire.sendAction('clipboard-read-image', readRequest);
|
9595
9596
|
return payload.data;
|
9596
9597
|
}
|
@@ -9606,6 +9607,7 @@ class Clipboard extends base_1$f.Base {
|
|
9606
9607
|
* ```
|
9607
9608
|
*/
|
9608
9609
|
async writeHtml(writeObj) {
|
9610
|
+
__classPrivateFieldGet$a(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.writeHtml');
|
9609
9611
|
await this.wire.sendAction('clipboard-write-html', writeObj);
|
9610
9612
|
}
|
9611
9613
|
/**
|
@@ -9618,6 +9620,7 @@ class Clipboard extends base_1$f.Base {
|
|
9618
9620
|
* ```
|
9619
9621
|
*/
|
9620
9622
|
async readHtml(type) {
|
9623
|
+
__classPrivateFieldGet$a(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.readHtml');
|
9621
9624
|
const { payload } = await this.wire.sendAction('clipboard-read-html', { type });
|
9622
9625
|
return payload.data;
|
9623
9626
|
}
|
@@ -9633,6 +9636,7 @@ class Clipboard extends base_1$f.Base {
|
|
9633
9636
|
* ```
|
9634
9637
|
*/
|
9635
9638
|
async writeRtf(writeObj) {
|
9639
|
+
__classPrivateFieldGet$a(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.writeRtf');
|
9636
9640
|
await this.wire.sendAction('clipboard-write-rtf', writeObj);
|
9637
9641
|
}
|
9638
9642
|
/**
|
@@ -9653,6 +9657,7 @@ class Clipboard extends base_1$f.Base {
|
|
9653
9657
|
* ```
|
9654
9658
|
*/
|
9655
9659
|
async readRtf(type) {
|
9660
|
+
__classPrivateFieldGet$a(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.readRtf');
|
9656
9661
|
const { payload } = await this.wire.sendAction('clipboard-read-rtf', { type });
|
9657
9662
|
return payload.data;
|
9658
9663
|
}
|
@@ -9676,6 +9681,7 @@ class Clipboard extends base_1$f.Base {
|
|
9676
9681
|
* ```
|
9677
9682
|
*/
|
9678
9683
|
async write(writeObj) {
|
9684
|
+
__classPrivateFieldGet$a(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.write');
|
9679
9685
|
await this.wire.sendAction('clipboard-write', writeObj);
|
9680
9686
|
}
|
9681
9687
|
/**
|
@@ -9693,6 +9699,12 @@ class Clipboard extends base_1$f.Base {
|
|
9693
9699
|
}
|
9694
9700
|
}
|
9695
9701
|
clipboard.Clipboard = Clipboard;
|
9702
|
+
_Clipboard_securedApiWarningCount = new WeakMap(), _Clipboard_instances = new WeakSet(), _Clipboard_warnSecuredApi = async function _Clipboard_warnSecuredApi(apiName) {
|
9703
|
+
if (__classPrivateFieldGet$a(this, _Clipboard_securedApiWarningCount, "f") <= maxSecuredApiWarnings) {
|
9704
|
+
console.warn(`Here's Clipboard APIs will become secured APIs starting in v42. To continue using this API without interruption, make sure to grant explicit API permissions for ${apiName} in the Desktop Owner Settings, and in the Application, Window, View, or Domain Settings. For more information, see https://resources.here.io/docs/core/develop/security/api-security/`);
|
9705
|
+
__classPrivateFieldSet$9(this, _Clipboard_securedApiWarningCount, __classPrivateFieldGet$a(this, _Clipboard_securedApiWarningCount, "f") + 1, "f");
|
9706
|
+
}
|
9707
|
+
};
|
9696
9708
|
|
9697
9709
|
var externalApplication = {};
|
9698
9710
|
|
@@ -16956,7 +16968,7 @@ const events_1$3 = require$$0;
|
|
16956
16968
|
// Import from the file rather than the directory in case someone consuming types is using module resolution other than "node"
|
16957
16969
|
const index_1 = system;
|
16958
16970
|
const index_2 = requireWindow();
|
16959
|
-
const index_3 =
|
16971
|
+
const index_3 = application;
|
16960
16972
|
const index_4 = interappbus;
|
16961
16973
|
const index_5 = clipboard;
|
16962
16974
|
const index_6 = externalApplication;
|
@@ -17757,7 +17769,7 @@ class NodeEnvironment extends BaseEnvironment_1 {
|
|
17757
17769
|
};
|
17758
17770
|
}
|
17759
17771
|
getAdapterVersionSync() {
|
17760
|
-
return "42.100.
|
17772
|
+
return "42.100.40";
|
17761
17773
|
}
|
17762
17774
|
observeBounds(element, onChange) {
|
17763
17775
|
throw new Error('Method not implemented.');
|