@openfin/node-adapter 44.100.62 → 45.100.18
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 +1517 -1312
- package/package.json +5 -5
package/out/node-adapter.js
CHANGED
|
@@ -44,13 +44,13 @@ var system = {};
|
|
|
44
44
|
|
|
45
45
|
var base = {};
|
|
46
46
|
|
|
47
|
-
var __classPrivateFieldSet$
|
|
47
|
+
var __classPrivateFieldSet$i = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
48
48
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
49
49
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
50
50
|
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");
|
|
51
51
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
52
52
|
};
|
|
53
|
-
var __classPrivateFieldGet$
|
|
53
|
+
var __classPrivateFieldGet$j = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
54
54
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
55
55
|
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");
|
|
56
56
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -134,9 +134,9 @@ class EmitterBase extends Base {
|
|
|
134
134
|
this.emit = (eventType, payload, ...args) => {
|
|
135
135
|
return this.hasEmitter() ? this.getOrCreateEmitter().emit(eventType, payload, ...args) : false;
|
|
136
136
|
};
|
|
137
|
-
this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet$
|
|
137
|
+
this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet$j(this, _EmitterBase_emitterAccessor, "f"));
|
|
138
138
|
this.getOrCreateEmitter = () => {
|
|
139
|
-
return this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$
|
|
139
|
+
return this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$j(this, _EmitterBase_emitterAccessor, "f"));
|
|
140
140
|
};
|
|
141
141
|
this.listeners = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(type) : [];
|
|
142
142
|
this.listenerCount = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listenerCount(type) : 0;
|
|
@@ -174,8 +174,8 @@ class EmitterBase extends Base {
|
|
|
174
174
|
// This will only be reached if unsubscribe from event that does not exist but do not want to error here
|
|
175
175
|
return Promise.resolve();
|
|
176
176
|
};
|
|
177
|
-
__classPrivateFieldSet$
|
|
178
|
-
__classPrivateFieldSet$
|
|
177
|
+
__classPrivateFieldSet$i(this, _EmitterBase_emitterAccessor, [topic, ...additionalAccessors], "f");
|
|
178
|
+
__classPrivateFieldSet$i(this, _EmitterBase_deregisterOnceListeners, new WeakMap(), "f");
|
|
179
179
|
}
|
|
180
180
|
/**
|
|
181
181
|
* Adds a listener to the end of the listeners array for the specified event.
|
|
@@ -203,7 +203,7 @@ class EmitterBase extends Base {
|
|
|
203
203
|
*/
|
|
204
204
|
async once(eventType, listener, options) {
|
|
205
205
|
const deregister = () => this.deregisterEventListener(eventType);
|
|
206
|
-
__classPrivateFieldGet$
|
|
206
|
+
__classPrivateFieldGet$j(this, _EmitterBase_deregisterOnceListeners, "f").set(listener, deregister);
|
|
207
207
|
await this.registerEventListener(eventType, options, (emitter) => {
|
|
208
208
|
emitter.once(eventType, deregister);
|
|
209
209
|
emitter.once(eventType, listener);
|
|
@@ -234,7 +234,7 @@ class EmitterBase extends Base {
|
|
|
234
234
|
*/
|
|
235
235
|
async prependOnceListener(eventType, listener, options) {
|
|
236
236
|
const deregister = () => this.deregisterEventListener(eventType);
|
|
237
|
-
__classPrivateFieldGet$
|
|
237
|
+
__classPrivateFieldGet$j(this, _EmitterBase_deregisterOnceListeners, "f").set(listener, deregister);
|
|
238
238
|
await this.registerEventListener(eventType, options, (emitter) => {
|
|
239
239
|
emitter.prependOnceListener(eventType, listener);
|
|
240
240
|
emitter.once(eventType, deregister);
|
|
@@ -253,7 +253,7 @@ class EmitterBase extends Base {
|
|
|
253
253
|
const emitter = await this.deregisterEventListener(eventType, options);
|
|
254
254
|
if (emitter) {
|
|
255
255
|
emitter.removeListener(eventType, listener);
|
|
256
|
-
const deregister = __classPrivateFieldGet$
|
|
256
|
+
const deregister = __classPrivateFieldGet$j(this, _EmitterBase_deregisterOnceListeners, "f").get(listener);
|
|
257
257
|
if (deregister) {
|
|
258
258
|
emitter.removeListener(eventType, deregister);
|
|
259
259
|
}
|
|
@@ -299,7 +299,7 @@ class EmitterBase extends Base {
|
|
|
299
299
|
deleteEmitterIfNothingRegistered(emitter) {
|
|
300
300
|
// TODO: maybe emitterMap should clean up itself..
|
|
301
301
|
if (emitter.eventNames().length === 0) {
|
|
302
|
-
this.wire.eventAggregator.delete(__classPrivateFieldGet$
|
|
302
|
+
this.wire.eventAggregator.delete(__classPrivateFieldGet$j(this, _EmitterBase_emitterAccessor, "f"));
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
305
|
}
|
|
@@ -531,11 +531,11 @@ const handleDeprecatedWarnings = (options) => {
|
|
|
531
531
|
};
|
|
532
532
|
warnings.handleDeprecatedWarnings = handleDeprecatedWarnings;
|
|
533
533
|
|
|
534
|
-
var hasRequiredFactory$
|
|
534
|
+
var hasRequiredFactory$2;
|
|
535
535
|
|
|
536
|
-
function requireFactory$
|
|
537
|
-
if (hasRequiredFactory$
|
|
538
|
-
hasRequiredFactory$
|
|
536
|
+
function requireFactory$2 () {
|
|
537
|
+
if (hasRequiredFactory$2) return Factory$6;
|
|
538
|
+
hasRequiredFactory$2 = 1;
|
|
539
539
|
Object.defineProperty(Factory$6, "__esModule", { value: true });
|
|
540
540
|
Factory$6.ViewModule = void 0;
|
|
541
541
|
const base_1 = base;
|
|
@@ -750,8 +750,8 @@ var main = {};
|
|
|
750
750
|
|
|
751
751
|
Object.defineProperty(main, "__esModule", { value: true });
|
|
752
752
|
main.WebContents = void 0;
|
|
753
|
-
const base_1$
|
|
754
|
-
class WebContents extends base_1$
|
|
753
|
+
const base_1$n = base;
|
|
754
|
+
class WebContents extends base_1$n.EmitterBase {
|
|
755
755
|
/**
|
|
756
756
|
* @param identity The identity of the {@link OpenFin.WebContentsEvents WebContents}.
|
|
757
757
|
* @param entityType The type of the {@link OpenFin.WebContentsEvents WebContents}.
|
|
@@ -1832,11 +1832,11 @@ class WebContents extends base_1$p.EmitterBase {
|
|
|
1832
1832
|
}
|
|
1833
1833
|
main.WebContents = WebContents;
|
|
1834
1834
|
|
|
1835
|
-
var hasRequiredInstance$
|
|
1835
|
+
var hasRequiredInstance$2;
|
|
1836
1836
|
|
|
1837
|
-
function requireInstance$
|
|
1838
|
-
if (hasRequiredInstance$
|
|
1839
|
-
hasRequiredInstance$
|
|
1837
|
+
function requireInstance$2 () {
|
|
1838
|
+
if (hasRequiredInstance$2) return Instance$5;
|
|
1839
|
+
hasRequiredInstance$2 = 1;
|
|
1840
1840
|
var _View_providerChannelClient;
|
|
1841
1841
|
Object.defineProperty(Instance$5, "__esModule", { value: true });
|
|
1842
1842
|
Instance$5.View = void 0;
|
|
@@ -2416,1139 +2416,1160 @@ function requireView () {
|
|
|
2416
2416
|
*
|
|
2417
2417
|
* @packageDocumentation
|
|
2418
2418
|
*/
|
|
2419
|
-
__exportStar(requireFactory$
|
|
2420
|
-
__exportStar(requireInstance$
|
|
2419
|
+
__exportStar(requireFactory$2(), exports);
|
|
2420
|
+
__exportStar(requireInstance$2(), exports);
|
|
2421
2421
|
} (view));
|
|
2422
2422
|
return view;
|
|
2423
2423
|
}
|
|
2424
2424
|
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
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
|
-
|
|
2425
|
+
var hasRequiredInstance$1;
|
|
2426
|
+
|
|
2427
|
+
function requireInstance$1 () {
|
|
2428
|
+
if (hasRequiredInstance$1) return Instance$6;
|
|
2429
|
+
hasRequiredInstance$1 = 1;
|
|
2430
|
+
Object.defineProperty(Instance$6, "__esModule", { value: true });
|
|
2431
|
+
Instance$6.Application = void 0;
|
|
2432
|
+
/* eslint-disable import/prefer-default-export */
|
|
2433
|
+
const base_1 = base;
|
|
2434
|
+
const window_1 = requireWindow();
|
|
2435
|
+
const view_1 = requireView();
|
|
2436
|
+
/**
|
|
2437
|
+
* An object representing an application. Allows the developer to create,
|
|
2438
|
+
* execute, show/close an application as well as listen to {@link OpenFin.ApplicationEvents application events}.
|
|
2439
|
+
*/
|
|
2440
|
+
class Application extends base_1.EmitterBase {
|
|
2441
|
+
/**
|
|
2442
|
+
* @internal
|
|
2443
|
+
*/
|
|
2444
|
+
constructor(wire, identity) {
|
|
2445
|
+
super(wire, 'application', identity.uuid);
|
|
2446
|
+
this.identity = identity;
|
|
2447
|
+
this.window = new window_1._Window(this.wire, {
|
|
2448
|
+
uuid: this.identity.uuid,
|
|
2449
|
+
name: this.identity.uuid
|
|
2450
|
+
});
|
|
2451
|
+
}
|
|
2452
|
+
windowListFromIdentityList(identityList) {
|
|
2453
|
+
const windowList = [];
|
|
2454
|
+
identityList.forEach((identity) => {
|
|
2455
|
+
windowList.push(new window_1._Window(this.wire, {
|
|
2456
|
+
uuid: identity.uuid,
|
|
2457
|
+
name: identity.name
|
|
2458
|
+
}));
|
|
2459
|
+
});
|
|
2460
|
+
return windowList;
|
|
2461
|
+
}
|
|
2462
|
+
/**
|
|
2463
|
+
* Determines if the application is currently running.
|
|
2464
|
+
*
|
|
2465
|
+
* @example
|
|
2466
|
+
*
|
|
2467
|
+
* ```js
|
|
2468
|
+
* async function isAppRunning() {
|
|
2469
|
+
* const app = await fin.Application.getCurrent();
|
|
2470
|
+
* return await app.isRunning();
|
|
2471
|
+
* }
|
|
2472
|
+
* isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
|
|
2473
|
+
* ```
|
|
2474
|
+
*/
|
|
2475
|
+
isRunning() {
|
|
2476
|
+
return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
|
|
2477
|
+
}
|
|
2478
|
+
/**
|
|
2479
|
+
* Closes the application and any child windows created by the application.
|
|
2480
|
+
* Cleans the application from state so it is no longer found in getAllApplications.
|
|
2481
|
+
* @param force Close will be prevented from closing when force is false and
|
|
2482
|
+
* ‘close-requested’ has been subscribed to for application’s main window.
|
|
2483
|
+
*
|
|
2484
|
+
* @example
|
|
2485
|
+
*
|
|
2486
|
+
* ```js
|
|
2487
|
+
* async function closeApp() {
|
|
2488
|
+
* const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
|
|
2489
|
+
* const app = await fin.Application.wrap({uuid: 'app2'});
|
|
2490
|
+
* await app.quit();
|
|
2491
|
+
* const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]
|
|
2492
|
+
*
|
|
2493
|
+
* }
|
|
2494
|
+
* closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
|
|
2495
|
+
* ```
|
|
2496
|
+
*/
|
|
2497
|
+
async quit(force = false) {
|
|
2498
|
+
try {
|
|
2499
|
+
await this._close(force);
|
|
2500
|
+
await this.wire.sendAction('destroy-application', { force, ...this.identity });
|
|
2501
|
+
}
|
|
2502
|
+
catch (error) {
|
|
2503
|
+
const acceptableErrors = ['Remote connection has closed', 'Could not locate the requested application'];
|
|
2504
|
+
if (!acceptableErrors.some((msg) => error.message.includes(msg))) {
|
|
2505
|
+
throw error;
|
|
2506
|
+
}
|
|
2507
|
+
}
|
|
2508
|
+
}
|
|
2509
|
+
async _close(force = false) {
|
|
2510
|
+
try {
|
|
2511
|
+
await this.wire.sendAction('close-application', { force, ...this.identity });
|
|
2512
|
+
}
|
|
2513
|
+
catch (error) {
|
|
2514
|
+
if (!error.message.includes('Remote connection has closed')) {
|
|
2515
|
+
throw error;
|
|
2516
|
+
}
|
|
2517
|
+
}
|
|
2518
|
+
}
|
|
2519
|
+
/**
|
|
2520
|
+
* @deprecated use Application.quit instead
|
|
2521
|
+
* Closes the application and any child windows created by the application.
|
|
2522
|
+
* @param force - Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.
|
|
2523
|
+
* @param callback - called if the method succeeds.
|
|
2524
|
+
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
|
2525
|
+
*
|
|
2526
|
+
* @example
|
|
2527
|
+
*
|
|
2528
|
+
* ```js
|
|
2529
|
+
* async function closeApp() {
|
|
2530
|
+
* const app = await fin.Application.getCurrent();
|
|
2531
|
+
* return await app.close();
|
|
2532
|
+
* }
|
|
2533
|
+
* closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
|
|
2534
|
+
* ```
|
|
2535
|
+
*/
|
|
2536
|
+
close(force = false) {
|
|
2537
|
+
console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
|
|
2538
|
+
this.wire.sendAction('application-close', this.identity).catch((e) => {
|
|
2539
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
2540
|
+
});
|
|
2541
|
+
return this._close(force);
|
|
2542
|
+
}
|
|
2543
|
+
/**
|
|
2544
|
+
* Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
|
|
2545
|
+
*
|
|
2546
|
+
* @example
|
|
2547
|
+
*
|
|
2548
|
+
* ```js
|
|
2549
|
+
* async function getChildWindows() {
|
|
2550
|
+
* const app = await fin.Application.getCurrent();
|
|
2551
|
+
* return await app.getChildWindows();
|
|
2552
|
+
* }
|
|
2553
|
+
*
|
|
2554
|
+
* getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
|
|
2555
|
+
* ```
|
|
2556
|
+
*/
|
|
2557
|
+
getChildWindows() {
|
|
2558
|
+
return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
|
|
2559
|
+
const identityList = [];
|
|
2560
|
+
payload.data.forEach((winName) => {
|
|
2561
|
+
identityList.push({ uuid: this.identity.uuid, name: winName });
|
|
2562
|
+
});
|
|
2563
|
+
return this.windowListFromIdentityList(identityList);
|
|
2564
|
+
});
|
|
2565
|
+
}
|
|
2566
|
+
/**
|
|
2567
|
+
* Retrieves the JSON manifest that was used to create the application. Invokes the error callback
|
|
2568
|
+
* if the application was not created from a manifest.
|
|
2569
|
+
*
|
|
2570
|
+
* @example
|
|
2571
|
+
*
|
|
2572
|
+
* ```js
|
|
2573
|
+
* async function getManifest() {
|
|
2574
|
+
* const app = await fin.Application.getCurrent();
|
|
2575
|
+
* return await app.getManifest();
|
|
2576
|
+
* }
|
|
2577
|
+
*
|
|
2578
|
+
* getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
|
|
2579
|
+
* ```
|
|
2580
|
+
*/
|
|
2581
|
+
getManifest() {
|
|
2582
|
+
return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
|
|
2583
|
+
}
|
|
2584
|
+
/**
|
|
2585
|
+
* Retrieves UUID of the application that launches this application. Invokes the error callback
|
|
2586
|
+
* if the application was created from a manifest.
|
|
2587
|
+
*
|
|
2588
|
+
* @example
|
|
2589
|
+
*
|
|
2590
|
+
* ```js
|
|
2591
|
+
* async function getParentUuid() {
|
|
2592
|
+
* const app = await fin.Application.start({
|
|
2593
|
+
* uuid: 'app-1',
|
|
2594
|
+
* name: 'myApp',
|
|
2595
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
|
|
2596
|
+
* autoShow: true
|
|
2597
|
+
* });
|
|
2598
|
+
* return await app.getParentUuid();
|
|
2599
|
+
* }
|
|
2600
|
+
*
|
|
2601
|
+
* getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
|
|
2602
|
+
* ```
|
|
2603
|
+
*/
|
|
2604
|
+
getParentUuid() {
|
|
2605
|
+
return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
|
|
2606
|
+
}
|
|
2607
|
+
/**
|
|
2608
|
+
* Retrieves current application's shortcut configuration.
|
|
2609
|
+
*
|
|
2610
|
+
* @example
|
|
2611
|
+
*
|
|
2612
|
+
* ```js
|
|
2613
|
+
* async function getShortcuts() {
|
|
2614
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
|
2615
|
+
* return await app.getShortcuts();
|
|
2616
|
+
* }
|
|
2617
|
+
* getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
|
|
2618
|
+
* ```
|
|
2619
|
+
*/
|
|
2620
|
+
getShortcuts() {
|
|
2621
|
+
return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
|
|
2622
|
+
}
|
|
2623
|
+
/**
|
|
2624
|
+
* Retrieves current application's views.
|
|
2625
|
+
* @experimental
|
|
2626
|
+
*
|
|
2627
|
+
* @example
|
|
2628
|
+
*
|
|
2629
|
+
* ```js
|
|
2630
|
+
* async function getViews() {
|
|
2631
|
+
* const app = await fin.Application.getCurrent();
|
|
2632
|
+
* return await app.getViews();
|
|
2633
|
+
* }
|
|
2634
|
+
* getViews().then(views => console.log(views)).catch(err => console.log(err));
|
|
2635
|
+
* ```
|
|
2636
|
+
*/
|
|
2637
|
+
async getViews() {
|
|
2638
|
+
const { payload } = await this.wire.sendAction('application-get-views', this.identity);
|
|
2639
|
+
return payload.data.map((id) => new view_1.View(this.wire, id));
|
|
2640
|
+
}
|
|
2641
|
+
/**
|
|
2642
|
+
* Returns the current zoom level of the application.
|
|
2643
|
+
*
|
|
2644
|
+
* @example
|
|
2645
|
+
*
|
|
2646
|
+
* ```js
|
|
2647
|
+
* async function getZoomLevel() {
|
|
2648
|
+
* const app = await fin.Application.getCurrent();
|
|
2649
|
+
* return await app.getZoomLevel();
|
|
2650
|
+
* }
|
|
2651
|
+
*
|
|
2652
|
+
* getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
|
|
2653
|
+
* ```
|
|
2654
|
+
*/
|
|
2655
|
+
getZoomLevel() {
|
|
2656
|
+
return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
|
|
2657
|
+
}
|
|
2658
|
+
/**
|
|
2659
|
+
* Returns an instance of the main Window of the application
|
|
2660
|
+
*
|
|
2661
|
+
* @example
|
|
2662
|
+
*
|
|
2663
|
+
* ```js
|
|
2664
|
+
* async function getWindow() {
|
|
2665
|
+
* const app = await fin.Application.start({
|
|
2666
|
+
* uuid: 'app-1',
|
|
2667
|
+
* name: 'myApp',
|
|
2668
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
|
|
2669
|
+
* autoShow: true
|
|
2670
|
+
* });
|
|
2671
|
+
* return await app.getWindow();
|
|
2672
|
+
* }
|
|
2673
|
+
*
|
|
2674
|
+
* getWindow().then(win => {
|
|
2675
|
+
* win.showAt(0, 400);
|
|
2676
|
+
* win.flash();
|
|
2677
|
+
* }).catch(err => console.log(err));
|
|
2678
|
+
* ```
|
|
2679
|
+
*/
|
|
2680
|
+
getWindow() {
|
|
2681
|
+
this.wire.sendAction('application-get-window', this.identity).catch((e) => {
|
|
2682
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
2683
|
+
});
|
|
2684
|
+
return Promise.resolve(this.window);
|
|
2685
|
+
}
|
|
2686
|
+
/**
|
|
2687
|
+
* Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
|
|
2688
|
+
* @param userName - username to be passed to the RVM.
|
|
2689
|
+
* @param appName - app name to be passed to the RVM.
|
|
2690
|
+
*
|
|
2691
|
+
* @example
|
|
2692
|
+
*
|
|
2693
|
+
* ```js
|
|
2694
|
+
* async function registerUser() {
|
|
2695
|
+
* const app = await fin.Application.getCurrent();
|
|
2696
|
+
* return await app.registerUser('user', 'myApp');
|
|
2697
|
+
* }
|
|
2698
|
+
*
|
|
2699
|
+
* registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
|
|
2700
|
+
* ```
|
|
2701
|
+
*/
|
|
2702
|
+
registerUser(userName, appName) {
|
|
2703
|
+
return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
|
|
2704
|
+
}
|
|
2705
|
+
/**
|
|
2706
|
+
* Removes the application’s icon from the tray.
|
|
2707
|
+
*
|
|
2708
|
+
* @example
|
|
2709
|
+
*
|
|
2710
|
+
* ```js
|
|
2711
|
+
* async function removeTrayIcon() {
|
|
2712
|
+
* const app = await fin.Application.getCurrent();
|
|
2713
|
+
* return await app.removeTrayIcon();
|
|
2714
|
+
* }
|
|
2715
|
+
*
|
|
2716
|
+
* removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
|
|
2717
|
+
* ```
|
|
2718
|
+
*/
|
|
2719
|
+
removeTrayIcon() {
|
|
2720
|
+
return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
|
|
2721
|
+
}
|
|
2722
|
+
/**
|
|
2723
|
+
* Restarts the application.
|
|
2724
|
+
*
|
|
2725
|
+
* @example
|
|
2726
|
+
*
|
|
2727
|
+
* ```js
|
|
2728
|
+
* async function restartApp() {
|
|
2729
|
+
* const app = await fin.Application.getCurrent();
|
|
2730
|
+
* return await app.restart();
|
|
2731
|
+
* }
|
|
2732
|
+
* restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
|
|
2733
|
+
* ```
|
|
2734
|
+
*/
|
|
2735
|
+
restart() {
|
|
2736
|
+
return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
|
|
2737
|
+
}
|
|
2738
|
+
/**
|
|
2739
|
+
* DEPRECATED method to run the application.
|
|
2740
|
+
* Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
|
|
2741
|
+
*
|
|
2742
|
+
* @example
|
|
2743
|
+
*
|
|
2744
|
+
* ```js
|
|
2745
|
+
* async function run() {
|
|
2746
|
+
* const app = await fin.Application.create({
|
|
2747
|
+
* name: 'myApp',
|
|
2748
|
+
* uuid: 'app-1',
|
|
2749
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.run.html',
|
|
2750
|
+
* autoShow: true
|
|
2751
|
+
* });
|
|
2752
|
+
* await app.run();
|
|
2753
|
+
* }
|
|
2754
|
+
* run().then(() => console.log('Application is running')).catch(err => console.log(err));
|
|
2755
|
+
* ```
|
|
2756
|
+
*
|
|
2757
|
+
* @ignore
|
|
2758
|
+
*/
|
|
2759
|
+
run() {
|
|
2760
|
+
console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
|
|
2761
|
+
this.wire.sendAction('application-run', this.identity).catch((e) => {
|
|
2762
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
2763
|
+
});
|
|
2764
|
+
return this._run();
|
|
2765
|
+
}
|
|
2766
|
+
_run(opts = {}) {
|
|
2767
|
+
return this.wire
|
|
2768
|
+
.sendAction('run-application', {
|
|
2769
|
+
manifestUrl: this._manifestUrl,
|
|
2770
|
+
opts,
|
|
2771
|
+
...this.identity
|
|
2772
|
+
})
|
|
2773
|
+
.then(() => undefined);
|
|
2774
|
+
}
|
|
2775
|
+
/**
|
|
2776
|
+
* Instructs the RVM to schedule one restart of the application.
|
|
2777
|
+
*
|
|
2778
|
+
* @example
|
|
2779
|
+
*
|
|
2780
|
+
* ```js
|
|
2781
|
+
* async function scheduleRestart() {
|
|
2782
|
+
* const app = await fin.Application.getCurrent();
|
|
2783
|
+
* return await app.scheduleRestart();
|
|
2784
|
+
* }
|
|
2785
|
+
*
|
|
2786
|
+
* scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
|
|
2787
|
+
* ```
|
|
2788
|
+
*/
|
|
2789
|
+
scheduleRestart() {
|
|
2790
|
+
return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
|
|
2791
|
+
}
|
|
2792
|
+
/**
|
|
2793
|
+
* Sends a message to the RVM to upload the application's logs. On success,
|
|
2794
|
+
* an object containing logId is returned.
|
|
2795
|
+
*
|
|
2796
|
+
* @example
|
|
2797
|
+
*
|
|
2798
|
+
* ```js
|
|
2799
|
+
* async function sendLog() {
|
|
2800
|
+
* const app = await fin.Application.getCurrent();
|
|
2801
|
+
* return await app.sendApplicationLog();
|
|
2802
|
+
* }
|
|
2803
|
+
*
|
|
2804
|
+
* sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
|
|
2805
|
+
* ```
|
|
2806
|
+
*/
|
|
2807
|
+
async sendApplicationLog() {
|
|
2808
|
+
const { payload } = await this.wire.sendAction('send-application-log', this.identity);
|
|
2809
|
+
return payload.data;
|
|
2810
|
+
}
|
|
2811
|
+
/**
|
|
2812
|
+
* Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
|
|
2813
|
+
* If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
|
|
2814
|
+
*
|
|
2815
|
+
* Note: If the "name" property is omitted it defaults to "tasks".
|
|
2816
|
+
* @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
|
|
2817
|
+
*
|
|
2818
|
+
*
|
|
2819
|
+
* @remarks If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
|
|
2820
|
+
*
|
|
2821
|
+
* The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's
|
|
2822
|
+
* **` shortcut.name `** and uses **` shortcut.company `** as a fallback. Clicking that item will launch the app from its current manifest.
|
|
2823
|
+
*
|
|
2824
|
+
* Note: If the "name" property is omitted it defaults to "tasks".
|
|
2825
|
+
*
|
|
2826
|
+
* Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the
|
|
2827
|
+
* uuid or shortcut.name is changed.
|
|
2828
|
+
*
|
|
2829
|
+
* @example
|
|
2830
|
+
*
|
|
2831
|
+
* ```js
|
|
2832
|
+
* const app = fin.Application.getCurrentSync();
|
|
2833
|
+
* const appName = 'My App';
|
|
2834
|
+
* const jumpListConfig = [ // array of JumpList categories
|
|
2835
|
+
* {
|
|
2836
|
+
* // has no name and no type so `type` is assumed to be "tasks"
|
|
2837
|
+
* items: [ // array of JumpList items
|
|
2838
|
+
* {
|
|
2839
|
+
* type: 'task',
|
|
2840
|
+
* title: `Launch ${appName}`,
|
|
2841
|
+
* description: `Runs ${appName} with the default configuration`,
|
|
2842
|
+
* deepLink: 'fins://path.to/app/manifest.json',
|
|
2843
|
+
* iconPath: 'https://path.to/app/icon.ico',
|
|
2844
|
+
* iconIndex: 0
|
|
2845
|
+
* },
|
|
2846
|
+
* { type: 'separator' },
|
|
2847
|
+
* {
|
|
2848
|
+
* type: 'task',
|
|
2849
|
+
* title: `Restore ${appName}`,
|
|
2850
|
+
* description: 'Restore to last configuration',
|
|
2851
|
+
* deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
|
|
2852
|
+
* iconPath: 'https://path.to/app/icon.ico',
|
|
2853
|
+
* iconIndex: 0
|
|
2854
|
+
* },
|
|
2855
|
+
* ]
|
|
2856
|
+
* },
|
|
2857
|
+
* {
|
|
2858
|
+
* name: 'Tools',
|
|
2859
|
+
* items: [ // array of JumpList items
|
|
2860
|
+
* {
|
|
2861
|
+
* type: 'task',
|
|
2862
|
+
* title: 'Tool A',
|
|
2863
|
+
* description: 'Runs Tool A',
|
|
2864
|
+
* deepLink: 'fins://path.to/tool-a/manifest.json',
|
|
2865
|
+
* iconPath: 'https://path.to/tool-a/icon.ico',
|
|
2866
|
+
* iconIndex: 0
|
|
2867
|
+
* },
|
|
2868
|
+
* {
|
|
2869
|
+
* type: 'task',
|
|
2870
|
+
* title: 'Tool B',
|
|
2871
|
+
* description: 'Runs Tool B',
|
|
2872
|
+
* deepLink: 'fins://path.to/tool-b/manifest.json',
|
|
2873
|
+
* iconPath: 'https://path.to/tool-b/icon.ico',
|
|
2874
|
+
* iconIndex: 0
|
|
2875
|
+
* }]
|
|
2876
|
+
* }
|
|
2877
|
+
* ];
|
|
2878
|
+
*
|
|
2879
|
+
* app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));
|
|
2880
|
+
* ```
|
|
2881
|
+
*
|
|
2882
|
+
* To handle deeplink args:
|
|
2883
|
+
* ```js
|
|
2884
|
+
* function handleUseLastConfiguration() {
|
|
2885
|
+
* // this handler is called when the app is being launched
|
|
2886
|
+
* app.on('run-requested', event => {
|
|
2887
|
+
* if(event.userAppConfigArgs['use-last-configuration']) {
|
|
2888
|
+
* // your logic here
|
|
2889
|
+
* }
|
|
2890
|
+
* });
|
|
2891
|
+
* // this handler is called when the app was already running when the launch was requested
|
|
2892
|
+
* fin.desktop.main(function(args) {
|
|
2893
|
+
* if(args && args['use-last-configuration']) {
|
|
2894
|
+
* // your logic here
|
|
2895
|
+
* }
|
|
2896
|
+
* });
|
|
2897
|
+
* }
|
|
2898
|
+
* ```
|
|
2899
|
+
*/
|
|
2900
|
+
async setJumpList(jumpListCategories) {
|
|
2901
|
+
await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
|
|
2902
|
+
}
|
|
2903
|
+
/**
|
|
2904
|
+
* Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
|
|
2905
|
+
* @param icon Image URL or base64 encoded string to be used as the icon
|
|
2906
|
+
*
|
|
2907
|
+
* @example
|
|
2908
|
+
*
|
|
2909
|
+
* ```js
|
|
2910
|
+
* const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
|
|
2911
|
+
* const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
|
|
2912
|
+
* ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
|
|
2913
|
+
* const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
|
|
2914
|
+
* xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
|
|
2915
|
+
*
|
|
2916
|
+
* async function setTrayIcon(icon) {
|
|
2917
|
+
* const app = await fin.Application.getCurrent();
|
|
2918
|
+
* return await app.setTrayIcon(icon);
|
|
2919
|
+
* }
|
|
2920
|
+
*
|
|
2921
|
+
* // use image url to set tray icon
|
|
2922
|
+
* setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
|
2923
|
+
*
|
|
2924
|
+
* // use base64 encoded string to set tray icon
|
|
2925
|
+
* setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
|
2926
|
+
*
|
|
2927
|
+
* // use a dataURL to set tray icon
|
|
2928
|
+
* setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
|
2929
|
+
* ```
|
|
2930
|
+
*/
|
|
2931
|
+
setTrayIcon(icon) {
|
|
2932
|
+
return this.wire
|
|
2933
|
+
.sendAction('set-tray-icon', {
|
|
2934
|
+
enabledIcon: icon,
|
|
2935
|
+
...this.identity
|
|
2936
|
+
})
|
|
2937
|
+
.then(() => undefined);
|
|
2938
|
+
}
|
|
2939
|
+
/**
|
|
2940
|
+
* Set hover text for this application's system tray icon.
|
|
2941
|
+
* Note: Application must first set a tray icon with {@link Application.setTrayIcon}.
|
|
2942
|
+
* @param toolTip
|
|
2943
|
+
*
|
|
2944
|
+
* @example
|
|
2945
|
+
*
|
|
2946
|
+
* ```js
|
|
2947
|
+
* const app = fin.Application.getCurrentSync();
|
|
2948
|
+
* const iconUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
|
|
2949
|
+
*
|
|
2950
|
+
* await app.setTrayIcon(iconUrl);
|
|
2951
|
+
*
|
|
2952
|
+
* await app.setTrayIconToolTip('My Application');
|
|
2953
|
+
* ```
|
|
2954
|
+
*/
|
|
2955
|
+
async setTrayIconToolTip(toolTip) {
|
|
2956
|
+
await this.wire.sendAction('set-tray-icon-tooltip', { ...this.identity, toolTip });
|
|
2957
|
+
}
|
|
2958
|
+
/**
|
|
2959
|
+
* Sets new application's shortcut configuration. Windows only.
|
|
2960
|
+
* @param config New application's shortcut configuration.
|
|
2961
|
+
*
|
|
2962
|
+
* @remarks Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest
|
|
2963
|
+
* to be able to change shortcut states.
|
|
2964
|
+
*
|
|
2965
|
+
* @example
|
|
2966
|
+
*
|
|
2967
|
+
* ```js
|
|
2968
|
+
* async function setShortcuts(config) {
|
|
2969
|
+
* const app = await fin.Application.getCurrent();
|
|
2970
|
+
* return app.setShortcuts(config);
|
|
2971
|
+
* }
|
|
2972
|
+
*
|
|
2973
|
+
* setShortcuts({
|
|
2974
|
+
* desktop: true,
|
|
2975
|
+
* startMenu: false,
|
|
2976
|
+
* systemStartup: true
|
|
2977
|
+
* }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
|
|
2978
|
+
* ```
|
|
2979
|
+
*/
|
|
2980
|
+
setShortcuts(config) {
|
|
2981
|
+
return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
|
|
2982
|
+
}
|
|
2983
|
+
/**
|
|
2984
|
+
* Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
|
|
2985
|
+
* @param queryString The new query string for this app's shortcuts.
|
|
2986
|
+
*
|
|
2987
|
+
* @example
|
|
2988
|
+
*
|
|
2989
|
+
* ```js
|
|
2990
|
+
* const newQueryArgs = 'arg=true&arg2=false';
|
|
2991
|
+
* const app = await fin.Application.getCurrent();
|
|
2992
|
+
* try {
|
|
2993
|
+
* await app.setShortcutQueryParams(newQueryArgs);
|
|
2994
|
+
* } catch(err) {
|
|
2995
|
+
* console.error(err)
|
|
2996
|
+
* }
|
|
2997
|
+
* ```
|
|
2998
|
+
*/
|
|
2999
|
+
async setShortcutQueryParams(queryString) {
|
|
3000
|
+
await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
|
|
3001
|
+
}
|
|
3002
|
+
/**
|
|
3003
|
+
* Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
|
|
3004
|
+
* larger or smaller to default limits of 300% and 50% of original size, respectively.
|
|
3005
|
+
* @param level The zoom level
|
|
3006
|
+
*
|
|
3007
|
+
* @example
|
|
3008
|
+
*
|
|
3009
|
+
* ```js
|
|
3010
|
+
* async function setZoomLevel(number) {
|
|
3011
|
+
* const app = await fin.Application.getCurrent();
|
|
3012
|
+
* return await app.setZoomLevel(number);
|
|
3013
|
+
* }
|
|
3014
|
+
*
|
|
3015
|
+
* setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
|
|
3016
|
+
* ```
|
|
3017
|
+
*/
|
|
3018
|
+
setZoomLevel(level) {
|
|
3019
|
+
return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
|
|
3020
|
+
}
|
|
3021
|
+
/**
|
|
3022
|
+
* Sets a username to correlate with App Log Management.
|
|
3023
|
+
* @param username Username to correlate with App's Log.
|
|
3024
|
+
*
|
|
3025
|
+
* @example
|
|
3026
|
+
*
|
|
3027
|
+
* ```js
|
|
3028
|
+
* async function setAppLogUser() {
|
|
3029
|
+
* const app = await fin.Application.getCurrent();
|
|
3030
|
+
* return await app.setAppLogUsername('username');
|
|
3031
|
+
* }
|
|
3032
|
+
*
|
|
3033
|
+
* setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
|
|
3034
|
+
*
|
|
3035
|
+
* ```
|
|
3036
|
+
*/
|
|
3037
|
+
async setAppLogUsername(username) {
|
|
3038
|
+
await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
|
|
3039
|
+
}
|
|
3040
|
+
/**
|
|
3041
|
+
* Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
|
|
3042
|
+
* @remarks The only information currently returned is the position and dimensions.
|
|
3043
|
+
*
|
|
3044
|
+
* @example
|
|
3045
|
+
*
|
|
3046
|
+
* ```js
|
|
3047
|
+
* async function getTrayIconInfo() {
|
|
3048
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
|
3049
|
+
* return await app.getTrayIconInfo();
|
|
3050
|
+
* }
|
|
3051
|
+
* getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
|
|
3052
|
+
* ```
|
|
3053
|
+
*/
|
|
3054
|
+
getTrayIconInfo() {
|
|
3055
|
+
return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
|
|
3056
|
+
}
|
|
3057
|
+
/**
|
|
3058
|
+
* Checks if the application has an associated tray icon.
|
|
3059
|
+
*
|
|
3060
|
+
* @example
|
|
3061
|
+
*
|
|
3062
|
+
* ```js
|
|
3063
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
|
3064
|
+
* const hasTrayIcon = await app.hasTrayIcon();
|
|
3065
|
+
* console.log(hasTrayIcon);
|
|
3066
|
+
* ```
|
|
3067
|
+
*/
|
|
3068
|
+
hasTrayIcon() {
|
|
3069
|
+
return this.wire.sendAction('has-tray-icon', this.identity).then(({ payload }) => payload.data);
|
|
3070
|
+
}
|
|
3071
|
+
/**
|
|
3072
|
+
* Closes the application by terminating its process.
|
|
3073
|
+
*
|
|
3074
|
+
* @example
|
|
3075
|
+
*
|
|
3076
|
+
* ```js
|
|
3077
|
+
* async function terminateApp() {
|
|
3078
|
+
* const app = await fin.Application.getCurrent();
|
|
3079
|
+
* return await app.terminate();
|
|
3080
|
+
* }
|
|
3081
|
+
* terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));
|
|
3082
|
+
* ```
|
|
3083
|
+
*/
|
|
3084
|
+
terminate() {
|
|
3085
|
+
return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
|
|
3086
|
+
}
|
|
3087
|
+
/**
|
|
3088
|
+
* Waits for a hanging application. This method can be called in response to an application
|
|
3089
|
+
* "not-responding" to allow the application to continue and to generate another "not-responding"
|
|
3090
|
+
* message after a certain period of time.
|
|
3091
|
+
*
|
|
3092
|
+
* @ignore
|
|
3093
|
+
*/
|
|
3094
|
+
wait() {
|
|
3095
|
+
return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
|
|
3096
|
+
}
|
|
3097
|
+
/**
|
|
3098
|
+
* Retrieves information about the application.
|
|
3099
|
+
*
|
|
3100
|
+
* @remarks If the application was not launched from a manifest, the call will return the closest parent application `manifest`
|
|
3101
|
+
* and `manifestUrl`. `initialOptions` shows the parameters used when launched programmatically, or the `startup_app` options
|
|
3102
|
+
* if launched from manifest. The `parentUuid` will be the uuid of the immediate parent (if applicable).
|
|
3103
|
+
*
|
|
3104
|
+
* @example
|
|
3105
|
+
*
|
|
3106
|
+
* ```js
|
|
3107
|
+
* async function getInfo() {
|
|
3108
|
+
* const app = await fin.Application.getCurrent();
|
|
3109
|
+
* return await app.getInfo();
|
|
3110
|
+
* }
|
|
3111
|
+
*
|
|
3112
|
+
* getInfo().then(info => console.log(info)).catch(err => console.log(err));
|
|
3113
|
+
* ```
|
|
3114
|
+
*/
|
|
3115
|
+
getInfo() {
|
|
3116
|
+
return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
|
|
3117
|
+
}
|
|
3118
|
+
/**
|
|
3119
|
+
* Retrieves all process information for entities (windows and views) associated with an application.
|
|
3120
|
+
*
|
|
3121
|
+
* @example
|
|
3122
|
+
* ```js
|
|
3123
|
+
* const app = await fin.Application.getCurrent();
|
|
3124
|
+
* const processInfo = await app.getProcessInfo();
|
|
3125
|
+
* ```
|
|
3126
|
+
* @experimental
|
|
3127
|
+
*/
|
|
3128
|
+
async getProcessInfo() {
|
|
3129
|
+
const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
|
|
3130
|
+
return data;
|
|
3131
|
+
}
|
|
3132
|
+
/**
|
|
3133
|
+
* Sets file auto download location. It's only allowed in the same application.
|
|
3134
|
+
*
|
|
3135
|
+
* Note: This method is restricted by default and must be enabled via
|
|
3136
|
+
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
|
3137
|
+
* @param downloadLocation file auto download location
|
|
3138
|
+
*
|
|
3139
|
+
* @throws if setting file auto download location on different applications.
|
|
3140
|
+
* @example
|
|
3141
|
+
*
|
|
3142
|
+
* ```js
|
|
3143
|
+
* const downloadLocation = 'C:\\dev\\temp';
|
|
3144
|
+
* const app = await fin.Application.getCurrent();
|
|
3145
|
+
* try {
|
|
3146
|
+
* await app.setFileDownloadLocation(downloadLocation);
|
|
3147
|
+
* console.log('File download location is set');
|
|
3148
|
+
* } catch(err) {
|
|
3149
|
+
* console.error(err)
|
|
3150
|
+
* }
|
|
3151
|
+
* ```
|
|
3152
|
+
*/
|
|
3153
|
+
async setFileDownloadLocation(downloadLocation) {
|
|
3154
|
+
const { name } = this.wire.me;
|
|
3155
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
|
3156
|
+
await this.wire.sendAction('set-file-download-location', { ...entityIdentity, downloadLocation });
|
|
3157
|
+
}
|
|
3158
|
+
/**
|
|
3159
|
+
* Gets file auto download location. It's only allowed in the same application. If file auto download location is not set, it will return the default location.
|
|
3160
|
+
*
|
|
3161
|
+
* Note: This method is restricted by default and must be enabled via
|
|
3162
|
+
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
|
3163
|
+
*
|
|
3164
|
+
* @throws if getting file auto download location on different applications.
|
|
3165
|
+
* @example
|
|
3166
|
+
*
|
|
3167
|
+
* ```js
|
|
3168
|
+
* const app = await fin.Application.getCurrent();
|
|
3169
|
+
* const fileDownloadDir = await app.getFileDownloadLocation();
|
|
3170
|
+
* ```
|
|
3171
|
+
*/
|
|
3172
|
+
async getFileDownloadLocation() {
|
|
3173
|
+
const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
|
|
3174
|
+
return data;
|
|
3175
|
+
}
|
|
3176
|
+
/**
|
|
3177
|
+
* Shows a menu on the tray icon. Use with tray-icon-clicked event.
|
|
3178
|
+
* @param options
|
|
3179
|
+
* @typeParam Data User-defined shape for data returned upon menu item click. Should be a
|
|
3180
|
+
* [union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
|
|
3181
|
+
* of all possible data shapes for the entire menu, and the click handler should process
|
|
3182
|
+
* these with a "reducer" pattern.
|
|
3183
|
+
* @throws if the application has no tray icon set
|
|
3184
|
+
* @throws if the system tray is currently hidden
|
|
3185
|
+
* @example
|
|
3186
|
+
*
|
|
3187
|
+
* ```js
|
|
3188
|
+
* const iconUrl = 'http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png';
|
|
3189
|
+
* const app = fin.Application.getCurrentSync();
|
|
3190
|
+
*
|
|
3191
|
+
* await app.setTrayIcon(iconUrl);
|
|
3192
|
+
*
|
|
3193
|
+
* const template = [
|
|
3194
|
+
* {
|
|
3195
|
+
* label: 'Menu Item 1',
|
|
3196
|
+
* data: 'hello from item 1'
|
|
3197
|
+
* },
|
|
3198
|
+
* { type: 'separator' },
|
|
3199
|
+
* {
|
|
3200
|
+
* label: 'Menu Item 2',
|
|
3201
|
+
* type: 'checkbox',
|
|
3202
|
+
* checked: true,
|
|
3203
|
+
* data: 'The user clicked the checkbox'
|
|
3204
|
+
* },
|
|
3205
|
+
* {
|
|
3206
|
+
* label: 'see more',
|
|
3207
|
+
* enabled: false,
|
|
3208
|
+
* submenu: [
|
|
3209
|
+
* { label: 'submenu 1', data: 'hello from submenu' }
|
|
3210
|
+
* ]
|
|
3211
|
+
* }
|
|
3212
|
+
* ];
|
|
3213
|
+
*
|
|
3214
|
+
* app.addListener('tray-icon-clicked', (event) => {
|
|
3215
|
+
* // right-click
|
|
3216
|
+
* if (event.button === 2) {
|
|
3217
|
+
* app.showTrayIconPopupMenu({ template }).then(r => {
|
|
3218
|
+
* if (r.result === 'closed') {
|
|
3219
|
+
* console.log('nothing happened');
|
|
3220
|
+
* } else {
|
|
3221
|
+
* console.log(r.data);
|
|
3222
|
+
* }
|
|
3223
|
+
* });
|
|
3224
|
+
* }
|
|
3225
|
+
* });
|
|
3226
|
+
* ```
|
|
3227
|
+
*/
|
|
3228
|
+
async showTrayIconPopupMenu(options) {
|
|
3229
|
+
const { name } = this.wire.me;
|
|
3230
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
|
3231
|
+
const { payload } = await this.wire.sendAction('show-tray-icon-popup-menu', { ...entityIdentity, options });
|
|
3232
|
+
return payload.data;
|
|
3233
|
+
}
|
|
3234
|
+
/**
|
|
3235
|
+
* Closes the tray icon menu.
|
|
3236
|
+
*
|
|
3237
|
+
* @throws if the application has no tray icon set
|
|
3238
|
+
* @example
|
|
3239
|
+
*
|
|
3240
|
+
* ```js
|
|
3241
|
+
* const app = fin.Application.getCurrentSync();
|
|
3242
|
+
*
|
|
3243
|
+
* await app.closeTrayIconPopupMenu();
|
|
3244
|
+
* ```
|
|
3245
|
+
*/
|
|
3246
|
+
async closeTrayIconPopupMenu() {
|
|
3247
|
+
const { name } = this.wire.me;
|
|
3248
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
|
3249
|
+
await this.wire.sendAction('close-tray-icon-popup-menu', { ...entityIdentity });
|
|
3250
|
+
}
|
|
3251
|
+
}
|
|
3252
|
+
Instance$6.Application = Application;
|
|
3253
|
+
return Instance$6;
|
|
3246
3254
|
}
|
|
3247
|
-
Instance$6.Application = Application;
|
|
3248
3255
|
|
|
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
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3256
|
+
var hasRequiredFactory$1;
|
|
3257
|
+
|
|
3258
|
+
function requireFactory$1 () {
|
|
3259
|
+
if (hasRequiredFactory$1) return Factory$7;
|
|
3260
|
+
hasRequiredFactory$1 = 1;
|
|
3261
|
+
Object.defineProperty(Factory$7, "__esModule", { value: true });
|
|
3262
|
+
Factory$7.ApplicationModule = void 0;
|
|
3263
|
+
const base_1 = base;
|
|
3264
|
+
const validate_1 = validate;
|
|
3265
|
+
const Instance_1 = requireInstance$1();
|
|
3266
|
+
/**
|
|
3267
|
+
* Static namespace for OpenFin API methods that interact with the {@link Application} class, available under `fin.Application`.
|
|
3268
|
+
*/
|
|
3269
|
+
class ApplicationModule extends base_1.Base {
|
|
3270
|
+
/**
|
|
3271
|
+
* Asynchronously returns an API handle for the given Application identity.
|
|
3272
|
+
*
|
|
3273
|
+
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
|
3274
|
+
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
|
3275
|
+
* for an Application throughout its entire lifecycle.
|
|
3276
|
+
*
|
|
3277
|
+
* @example
|
|
3278
|
+
*
|
|
3279
|
+
* ```js
|
|
3280
|
+
* fin.Application.wrap({ uuid: 'testapp' })
|
|
3281
|
+
* .then(app => app.isRunning())
|
|
3282
|
+
* .then(running => console.log('Application is running: ' + running))
|
|
3283
|
+
* .catch(err => console.log(err));
|
|
3284
|
+
* ```
|
|
3285
|
+
*
|
|
3286
|
+
*/
|
|
3287
|
+
async wrap(identity) {
|
|
3288
|
+
this.wire.sendAction('wrap-application').catch((e) => {
|
|
3289
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
3290
|
+
});
|
|
3291
|
+
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
|
3292
|
+
if (errorMsg) {
|
|
3293
|
+
throw new Error(errorMsg);
|
|
3294
|
+
}
|
|
3295
|
+
return new Instance_1.Application(this.wire, identity);
|
|
3296
|
+
}
|
|
3297
|
+
/**
|
|
3298
|
+
* Synchronously returns an API handle for the given Application identity.
|
|
3299
|
+
*
|
|
3300
|
+
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
|
3301
|
+
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
|
3302
|
+
* for an Aplication throughout its entire lifecycle.
|
|
3303
|
+
*
|
|
3304
|
+
* @example
|
|
3305
|
+
*
|
|
3306
|
+
* ```js
|
|
3307
|
+
* const app = fin.Application.wrapSync({ uuid: 'testapp' });
|
|
3308
|
+
* await app.close();
|
|
3309
|
+
* ```
|
|
3310
|
+
*
|
|
3311
|
+
*/
|
|
3312
|
+
wrapSync(identity) {
|
|
3313
|
+
this.wire.sendAction('wrap-application-sync').catch((e) => {
|
|
3314
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
3315
|
+
});
|
|
3316
|
+
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
|
3317
|
+
if (errorMsg) {
|
|
3318
|
+
throw new Error(errorMsg);
|
|
3319
|
+
}
|
|
3320
|
+
return new Instance_1.Application(this.wire, identity);
|
|
3321
|
+
}
|
|
3322
|
+
async _create(appOptions) {
|
|
3323
|
+
// set defaults:
|
|
3324
|
+
if (appOptions.waitForPageLoad === undefined) {
|
|
3325
|
+
appOptions.waitForPageLoad = false;
|
|
3326
|
+
}
|
|
3327
|
+
if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
|
|
3328
|
+
appOptions.autoShow = true;
|
|
3329
|
+
}
|
|
3330
|
+
await this.wire.sendAction('create-application', appOptions);
|
|
3331
|
+
return this.wrap({ uuid: appOptions.uuid });
|
|
3332
|
+
}
|
|
3333
|
+
/**
|
|
3334
|
+
* DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
|
|
3335
|
+
*
|
|
3336
|
+
* @example
|
|
3337
|
+
*
|
|
3338
|
+
* ```js
|
|
3339
|
+
* async function createApp() {
|
|
3340
|
+
* const app = await fin.Application.create({
|
|
3341
|
+
* name: 'myApp',
|
|
3342
|
+
* uuid: 'app-3',
|
|
3343
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
|
|
3344
|
+
* autoShow: true
|
|
3345
|
+
* });
|
|
3346
|
+
* await app.run();
|
|
3347
|
+
* }
|
|
3348
|
+
*
|
|
3349
|
+
* createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
|
|
3350
|
+
* ```
|
|
3351
|
+
*
|
|
3352
|
+
* @ignore
|
|
3353
|
+
*/
|
|
3354
|
+
create(appOptions) {
|
|
3355
|
+
console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
|
|
3356
|
+
this.wire.sendAction('application-create').catch((e) => {
|
|
3357
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
3358
|
+
});
|
|
3359
|
+
return this._create(appOptions);
|
|
3360
|
+
}
|
|
3361
|
+
/**
|
|
3362
|
+
* Creates and starts a new Application.
|
|
3363
|
+
*
|
|
3364
|
+
* @example
|
|
3365
|
+
*
|
|
3366
|
+
* ```js
|
|
3367
|
+
* async function start() {
|
|
3368
|
+
* return fin.Application.start({
|
|
3369
|
+
* name: 'app-1',
|
|
3370
|
+
* uuid: 'app-1',
|
|
3371
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
|
|
3372
|
+
* autoShow: true
|
|
3373
|
+
* });
|
|
3374
|
+
* }
|
|
3375
|
+
* start().then(() => console.log('Application is running')).catch(err => console.log(err));
|
|
3376
|
+
* ```
|
|
3377
|
+
*
|
|
3378
|
+
*/
|
|
3379
|
+
async start(appOptions) {
|
|
3380
|
+
this.wire.sendAction('start-application').catch((e) => {
|
|
3381
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
3382
|
+
});
|
|
3383
|
+
const app = await this._create(appOptions);
|
|
3384
|
+
await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
|
|
3385
|
+
return app;
|
|
3386
|
+
}
|
|
3387
|
+
/**
|
|
3388
|
+
* Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
|
|
3389
|
+
* Returns once the RVM is finished attempting to launch the applications.
|
|
3390
|
+
* @param opts - Parameters that the RVM will use.
|
|
3391
|
+
*
|
|
3392
|
+
* @example
|
|
3393
|
+
*
|
|
3394
|
+
* ```js
|
|
3395
|
+
*
|
|
3396
|
+
* const applicationInfoArray = [
|
|
3397
|
+
* {
|
|
3398
|
+
* "uuid": 'App-1',
|
|
3399
|
+
* "manifestUrl": 'http://localhost:5555/app1.json',
|
|
3400
|
+
* },
|
|
3401
|
+
* {
|
|
3402
|
+
* "uuid": 'App-2',
|
|
3403
|
+
* "manifestUrl": 'http://localhost:5555/app2.json',
|
|
3404
|
+
* },
|
|
3405
|
+
* {
|
|
3406
|
+
* "uuid": 'App-3',
|
|
3407
|
+
* "manifestUrl": 'http://localhost:5555/app3.json',
|
|
3408
|
+
* }
|
|
3409
|
+
* ]
|
|
3410
|
+
*
|
|
3411
|
+
* fin.Application.startManyManifests(applicationInfoArray)
|
|
3412
|
+
* .then(() => {
|
|
3413
|
+
* console.log('RVM has finished launching the application list.');
|
|
3414
|
+
* })
|
|
3415
|
+
* .catch((err) => {
|
|
3416
|
+
* console.log(err);
|
|
3417
|
+
* })
|
|
3418
|
+
* ```
|
|
3419
|
+
*
|
|
3420
|
+
* @experimental
|
|
3421
|
+
*/
|
|
3422
|
+
async startManyManifests(applications, opts) {
|
|
3423
|
+
return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
|
|
3424
|
+
}
|
|
3425
|
+
/**
|
|
3426
|
+
* Asynchronously returns an Application object that represents the current application
|
|
3427
|
+
*
|
|
3428
|
+
* @example
|
|
3429
|
+
*
|
|
3430
|
+
* ```js
|
|
3431
|
+
* async function isCurrentAppRunning () {
|
|
3432
|
+
* const app = await fin.Application.getCurrent();
|
|
3433
|
+
* return app.isRunning();
|
|
3434
|
+
* }
|
|
3435
|
+
*
|
|
3436
|
+
* isCurrentAppRunning().then(running => {
|
|
3437
|
+
* console.log(`Current app is running: ${running}`);
|
|
3438
|
+
* }).catch(err => {
|
|
3439
|
+
* console.error(err);
|
|
3440
|
+
* });
|
|
3441
|
+
*
|
|
3442
|
+
* ```
|
|
3443
|
+
*/
|
|
3444
|
+
getCurrent() {
|
|
3445
|
+
this.wire.sendAction('get-current-application').catch((e) => {
|
|
3446
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
3447
|
+
});
|
|
3448
|
+
return this.wrap({ uuid: this.wire.me.uuid });
|
|
3449
|
+
}
|
|
3450
|
+
/**
|
|
3451
|
+
* Synchronously returns an Application object that represents the current application
|
|
3452
|
+
*
|
|
3453
|
+
* @example
|
|
3454
|
+
*
|
|
3455
|
+
* ```js
|
|
3456
|
+
* async function isCurrentAppRunning () {
|
|
3457
|
+
* const app = fin.Application.getCurrentSync();
|
|
3458
|
+
* return app.isRunning();
|
|
3459
|
+
* }
|
|
3460
|
+
*
|
|
3461
|
+
* isCurrentAppRunning().then(running => {
|
|
3462
|
+
* console.log(`Current app is running: ${running}`);
|
|
3463
|
+
* }).catch(err => {
|
|
3464
|
+
* console.error(err);
|
|
3465
|
+
* });
|
|
3466
|
+
*
|
|
3467
|
+
* ```
|
|
3468
|
+
*/
|
|
3469
|
+
getCurrentSync() {
|
|
3470
|
+
this.wire.sendAction('get-current-application-sync').catch((e) => {
|
|
3471
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
3472
|
+
});
|
|
3473
|
+
return this.wrapSync({ uuid: this.wire.me.uuid });
|
|
3474
|
+
}
|
|
3475
|
+
/**
|
|
3476
|
+
* Retrieves application's manifest and returns a running instance of the application.
|
|
3477
|
+
* @param manifestUrl - The URL of app's manifest.
|
|
3478
|
+
* @param opts - Parameters that the RVM will use.
|
|
3479
|
+
*
|
|
3480
|
+
* @example
|
|
3481
|
+
*
|
|
3482
|
+
* ```js
|
|
3483
|
+
* fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
|
3484
|
+
*
|
|
3485
|
+
* // For a local manifest file:
|
|
3486
|
+
* fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
|
3487
|
+
* ```
|
|
3488
|
+
*/
|
|
3489
|
+
async startFromManifest(manifestUrl, opts) {
|
|
3490
|
+
this.wire.sendAction('application-start-from-manifest').catch((e) => {
|
|
3491
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
3492
|
+
});
|
|
3493
|
+
const app = await this._createFromManifest(manifestUrl);
|
|
3494
|
+
// @ts-expect-error using private method without warning.
|
|
3495
|
+
await app._run(opts); // eslint-disable-line no-underscore-dangle
|
|
3496
|
+
return app;
|
|
3497
|
+
}
|
|
3498
|
+
/**
|
|
3499
|
+
* @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
|
|
3500
|
+
* Retrieves application's manifest and returns a wrapped application.
|
|
3501
|
+
* @param manifestUrl - The URL of app's manifest.
|
|
3502
|
+
* @param callback - called if the method succeeds.
|
|
3503
|
+
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
|
3504
|
+
*
|
|
3505
|
+
* @example
|
|
3506
|
+
*
|
|
3507
|
+
* ```js
|
|
3508
|
+
* fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
|
|
3509
|
+
* ```
|
|
3510
|
+
* @ignore
|
|
3511
|
+
*/
|
|
3512
|
+
createFromManifest(manifestUrl) {
|
|
3513
|
+
console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
|
|
3514
|
+
this.wire.sendAction('application-create-from-manifest').catch((e) => {
|
|
3515
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
3516
|
+
});
|
|
3517
|
+
return this._createFromManifest(manifestUrl);
|
|
3518
|
+
}
|
|
3519
|
+
_createFromManifest(manifestUrl) {
|
|
3520
|
+
return this.wire
|
|
3521
|
+
.sendAction('get-application-manifest', { manifestUrl })
|
|
3522
|
+
.then(({ payload }) => {
|
|
3523
|
+
const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
|
|
3524
|
+
return this.wrap({ uuid });
|
|
3525
|
+
})
|
|
3526
|
+
.then((app) => {
|
|
3527
|
+
app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
|
|
3528
|
+
return app;
|
|
3529
|
+
});
|
|
3530
|
+
}
|
|
3531
|
+
}
|
|
3532
|
+
Factory$7.ApplicationModule = ApplicationModule;
|
|
3533
|
+
return Factory$7;
|
|
3519
3534
|
}
|
|
3520
|
-
Factory$7.ApplicationModule = ApplicationModule;
|
|
3521
3535
|
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3536
|
+
var hasRequiredApplication;
|
|
3537
|
+
|
|
3538
|
+
function requireApplication () {
|
|
3539
|
+
if (hasRequiredApplication) return application;
|
|
3540
|
+
hasRequiredApplication = 1;
|
|
3541
|
+
(function (exports) {
|
|
3542
|
+
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3543
|
+
if (k2 === undefined) k2 = k;
|
|
3544
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
3545
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
3546
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
3547
|
+
}
|
|
3548
|
+
Object.defineProperty(o, k2, desc);
|
|
3549
|
+
}) : (function(o, m, k, k2) {
|
|
3550
|
+
if (k2 === undefined) k2 = k;
|
|
3551
|
+
o[k2] = m[k];
|
|
3552
|
+
}));
|
|
3553
|
+
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
|
3554
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
3555
|
+
};
|
|
3556
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3557
|
+
/**
|
|
3558
|
+
* Entry points for the OpenFin `Application` API (`fin.Application`).
|
|
3559
|
+
*
|
|
3560
|
+
* * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
|
|
3561
|
+
* * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
|
|
3562
|
+
*
|
|
3563
|
+
* These are separate code entities, and are documented separately. In the [previous version of the API documentation](https://cdn.openfin.co/docs/javascript/32.114.76.10/index.html),
|
|
3564
|
+
* both of these were documented on the same page.
|
|
3565
|
+
*
|
|
3566
|
+
* @packageDocumentation
|
|
3567
|
+
*/
|
|
3568
|
+
__exportStar(requireFactory$1(), exports);
|
|
3569
|
+
__exportStar(requireInstance$1(), exports);
|
|
3570
|
+
} (application));
|
|
3571
|
+
return application;
|
|
3572
|
+
}
|
|
3552
3573
|
|
|
3553
3574
|
var promisifySubscription$1 = {};
|
|
3554
3575
|
|
|
@@ -3592,7 +3613,7 @@ function requireInstance () {
|
|
|
3592
3613
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3593
3614
|
/* eslint-disable no-console */
|
|
3594
3615
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
3595
|
-
const application_1 =
|
|
3616
|
+
const application_1 = requireApplication();
|
|
3596
3617
|
const main_1 = main;
|
|
3597
3618
|
const view_1 = requireView();
|
|
3598
3619
|
const warnings_1 = warnings;
|
|
@@ -5502,6 +5523,11 @@ class System extends base_1$m.EmitterBase {
|
|
|
5502
5523
|
/**
|
|
5503
5524
|
* Returns a unique identifier (UUID) provided by the machine.
|
|
5504
5525
|
*
|
|
5526
|
+
* On Windows, the machine ID is the `MachineGuid` value located in the Windows Registry at:
|
|
5527
|
+
* `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography`.
|
|
5528
|
+
*
|
|
5529
|
+
* On macOS, the machine ID is the hardware UUID of the machine, obtained via native OS APIs.
|
|
5530
|
+
*
|
|
5505
5531
|
* @example
|
|
5506
5532
|
* ```js
|
|
5507
5533
|
* fin.System.getMachineId().then(id => console.log(id)).catch(err => console.log(err));
|
|
@@ -7590,12 +7616,12 @@ class ChannelError extends Error {
|
|
|
7590
7616
|
}
|
|
7591
7617
|
channelError.ChannelError = ChannelError;
|
|
7592
7618
|
|
|
7593
|
-
var __classPrivateFieldGet$
|
|
7619
|
+
var __classPrivateFieldGet$i = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
7594
7620
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
7595
7621
|
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");
|
|
7596
7622
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
7597
7623
|
};
|
|
7598
|
-
var __classPrivateFieldSet$
|
|
7624
|
+
var __classPrivateFieldSet$h = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
7599
7625
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
7600
7626
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
7601
7627
|
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");
|
|
@@ -7639,7 +7665,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
|
7639
7665
|
static closeChannelByEndpointId(id) {
|
|
7640
7666
|
const channel = channelClientsByEndpointId.get(id);
|
|
7641
7667
|
if (channel) {
|
|
7642
|
-
__classPrivateFieldGet$
|
|
7668
|
+
__classPrivateFieldGet$i(channel, _ChannelClient_close, "f").call(channel);
|
|
7643
7669
|
}
|
|
7644
7670
|
}
|
|
7645
7671
|
/**
|
|
@@ -7650,7 +7676,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
|
7650
7676
|
for (const channelClient of channelClientsByEndpointId.values()) {
|
|
7651
7677
|
if (channelClient.providerIdentity.channelId === eventPayload.channelId) {
|
|
7652
7678
|
channelClient.disconnectListener(eventPayload);
|
|
7653
|
-
__classPrivateFieldGet$
|
|
7679
|
+
__classPrivateFieldGet$i(channelClient, _ChannelClient_close, "f").call(channelClient);
|
|
7654
7680
|
}
|
|
7655
7681
|
}
|
|
7656
7682
|
}
|
|
@@ -7665,12 +7691,12 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
|
7665
7691
|
this.processAction = (action, payload, senderIdentity) => super.processAction(action, payload, senderIdentity);
|
|
7666
7692
|
_ChannelClient_close.set(this, () => {
|
|
7667
7693
|
channelClientsByEndpointId.delete(this.endpointId);
|
|
7668
|
-
__classPrivateFieldGet$
|
|
7694
|
+
__classPrivateFieldGet$i(this, _ChannelClient_strategy, "f").close();
|
|
7669
7695
|
});
|
|
7670
|
-
__classPrivateFieldSet$
|
|
7696
|
+
__classPrivateFieldSet$h(this, _ChannelClient_protectedObj, new channel_1$1.ProtectedItems(routingInfo, close), "f");
|
|
7671
7697
|
this.disconnectListener = () => undefined;
|
|
7672
7698
|
this.endpointId = routingInfo.endpointId;
|
|
7673
|
-
__classPrivateFieldSet$
|
|
7699
|
+
__classPrivateFieldSet$h(this, _ChannelClient_strategy, strategy, "f");
|
|
7674
7700
|
channelClientsByEndpointId.set(this.endpointId, this);
|
|
7675
7701
|
strategy.receive(this.processAction);
|
|
7676
7702
|
}
|
|
@@ -7678,7 +7704,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
|
7678
7704
|
* a read-only provider identity
|
|
7679
7705
|
*/
|
|
7680
7706
|
get providerIdentity() {
|
|
7681
|
-
const protectedObj = __classPrivateFieldGet$
|
|
7707
|
+
const protectedObj = __classPrivateFieldGet$i(this, _ChannelClient_protectedObj, "f");
|
|
7682
7708
|
return protectedObj.providerIdentity;
|
|
7683
7709
|
}
|
|
7684
7710
|
/**
|
|
@@ -7707,9 +7733,9 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
|
7707
7733
|
* ```
|
|
7708
7734
|
*/
|
|
7709
7735
|
async dispatch(action, payload) {
|
|
7710
|
-
if (__classPrivateFieldGet$
|
|
7736
|
+
if (__classPrivateFieldGet$i(this, _ChannelClient_strategy, "f").isEndpointConnected(this.providerIdentity.channelId)) {
|
|
7711
7737
|
const callSites = transport_errors_1$3.RuntimeError.getCallSite();
|
|
7712
|
-
return __classPrivateFieldGet$
|
|
7738
|
+
return __classPrivateFieldGet$i(this, _ChannelClient_strategy, "f").send(this.providerIdentity.channelId, action, payload).catch((e) => {
|
|
7713
7739
|
throw new channel_error_1$1.ChannelError(e, action, payload, callSites);
|
|
7714
7740
|
});
|
|
7715
7741
|
}
|
|
@@ -7761,10 +7787,10 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
|
7761
7787
|
*/
|
|
7762
7788
|
async disconnect() {
|
|
7763
7789
|
await this.sendDisconnectAction();
|
|
7764
|
-
__classPrivateFieldGet$
|
|
7790
|
+
__classPrivateFieldGet$i(this, _ChannelClient_close, "f").call(this);
|
|
7765
7791
|
}
|
|
7766
7792
|
async sendDisconnectAction() {
|
|
7767
|
-
const protectedObj = __classPrivateFieldGet$
|
|
7793
|
+
const protectedObj = __classPrivateFieldGet$i(this, _ChannelClient_protectedObj, "f");
|
|
7768
7794
|
await protectedObj.close();
|
|
7769
7795
|
}
|
|
7770
7796
|
/**
|
|
@@ -7797,13 +7823,13 @@ exhaustive.exhaustiveCheck = exhaustiveCheck;
|
|
|
7797
7823
|
|
|
7798
7824
|
var strategy$3 = {};
|
|
7799
7825
|
|
|
7800
|
-
var __classPrivateFieldSet$
|
|
7826
|
+
var __classPrivateFieldSet$g = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
7801
7827
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
7802
7828
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
7803
7829
|
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");
|
|
7804
7830
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7805
7831
|
};
|
|
7806
|
-
var __classPrivateFieldGet$
|
|
7832
|
+
var __classPrivateFieldGet$h = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
7807
7833
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
7808
7834
|
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");
|
|
7809
7835
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -7828,7 +7854,7 @@ class ClassicStrategy {
|
|
|
7828
7854
|
// connection problems occur
|
|
7829
7855
|
_ClassicStrategy_pendingMessagesByEndpointId.set(this, new Map());
|
|
7830
7856
|
this.send = async (endpointId, action, payload) => {
|
|
7831
|
-
const to = __classPrivateFieldGet$
|
|
7857
|
+
const to = __classPrivateFieldGet$h(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
|
|
7832
7858
|
if (!to) {
|
|
7833
7859
|
throw new Error(`Could not locate routing info for endpoint ${endpointId}`);
|
|
7834
7860
|
}
|
|
@@ -7840,13 +7866,13 @@ class ClassicStrategy {
|
|
|
7840
7866
|
}
|
|
7841
7867
|
delete cleanId.isLocalEndpointId;
|
|
7842
7868
|
// grab the promise before awaiting it to save in our pending messages map
|
|
7843
|
-
const p = __classPrivateFieldGet$
|
|
7869
|
+
const p = __classPrivateFieldGet$h(this, _ClassicStrategy_wire, "f").sendAction('send-channel-message', {
|
|
7844
7870
|
...cleanId,
|
|
7845
7871
|
providerIdentity: this.providerIdentity,
|
|
7846
7872
|
action,
|
|
7847
7873
|
payload
|
|
7848
7874
|
});
|
|
7849
|
-
__classPrivateFieldGet$
|
|
7875
|
+
__classPrivateFieldGet$h(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.add(p);
|
|
7850
7876
|
const raw = await p
|
|
7851
7877
|
.catch((error) => {
|
|
7852
7878
|
if ('cause' in error) {
|
|
@@ -7856,16 +7882,16 @@ class ClassicStrategy {
|
|
|
7856
7882
|
})
|
|
7857
7883
|
.finally(() => {
|
|
7858
7884
|
// clean up the pending promise
|
|
7859
|
-
__classPrivateFieldGet$
|
|
7885
|
+
__classPrivateFieldGet$h(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.delete(p);
|
|
7860
7886
|
});
|
|
7861
7887
|
return raw.payload.data.result;
|
|
7862
7888
|
};
|
|
7863
7889
|
this.close = async () => {
|
|
7864
7890
|
this.messageReceiver.removeEndpoint(this.providerIdentity.channelId, this.endpointId);
|
|
7865
|
-
[...__classPrivateFieldGet$
|
|
7866
|
-
__classPrivateFieldSet$
|
|
7891
|
+
[...__classPrivateFieldGet$h(this, _ClassicStrategy_endpointIdentityMap, "f").keys()].forEach((id) => this.closeEndpoint(id));
|
|
7892
|
+
__classPrivateFieldSet$g(this, _ClassicStrategy_endpointIdentityMap, new Map(), "f");
|
|
7867
7893
|
};
|
|
7868
|
-
__classPrivateFieldSet$
|
|
7894
|
+
__classPrivateFieldSet$g(this, _ClassicStrategy_wire, wire, "f");
|
|
7869
7895
|
}
|
|
7870
7896
|
onEndpointDisconnect(endpointId, listener) {
|
|
7871
7897
|
// Never fires for 'classic'.
|
|
@@ -7874,20 +7900,20 @@ class ClassicStrategy {
|
|
|
7874
7900
|
this.messageReceiver.addEndpoint(listener, this.providerIdentity.channelId, this.endpointId);
|
|
7875
7901
|
}
|
|
7876
7902
|
async closeEndpoint(endpointId) {
|
|
7877
|
-
const id = __classPrivateFieldGet$
|
|
7878
|
-
__classPrivateFieldGet$
|
|
7879
|
-
const pendingSet = __classPrivateFieldGet$
|
|
7903
|
+
const id = __classPrivateFieldGet$h(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
|
|
7904
|
+
__classPrivateFieldGet$h(this, _ClassicStrategy_endpointIdentityMap, "f").delete(endpointId);
|
|
7905
|
+
const pendingSet = __classPrivateFieldGet$h(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId);
|
|
7880
7906
|
pendingSet?.forEach((p) => {
|
|
7881
7907
|
const errorMsg = `Channel connection with identity uuid: ${id?.uuid} / name: ${id?.name} / endpointId: ${endpointId} no longer connected.`;
|
|
7882
7908
|
p.cancel(new Error(errorMsg));
|
|
7883
7909
|
});
|
|
7884
7910
|
}
|
|
7885
7911
|
isEndpointConnected(endpointId) {
|
|
7886
|
-
return __classPrivateFieldGet$
|
|
7912
|
+
return __classPrivateFieldGet$h(this, _ClassicStrategy_endpointIdentityMap, "f").has(endpointId);
|
|
7887
7913
|
}
|
|
7888
7914
|
addEndpoint(endpointId, payload) {
|
|
7889
|
-
__classPrivateFieldGet$
|
|
7890
|
-
__classPrivateFieldGet$
|
|
7915
|
+
__classPrivateFieldGet$h(this, _ClassicStrategy_endpointIdentityMap, "f").set(endpointId, payload.endpointIdentity);
|
|
7916
|
+
__classPrivateFieldGet$h(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").set(endpointId, new Set());
|
|
7891
7917
|
}
|
|
7892
7918
|
isValidEndpointPayload(payload) {
|
|
7893
7919
|
return (typeof payload?.endpointIdentity?.endpointId === 'string' ||
|
|
@@ -7922,12 +7948,12 @@ function errorToPOJO(error) {
|
|
|
7922
7948
|
}
|
|
7923
7949
|
errors.errorToPOJO = errorToPOJO;
|
|
7924
7950
|
|
|
7925
|
-
var __classPrivateFieldGet$
|
|
7951
|
+
var __classPrivateFieldGet$g = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
7926
7952
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
7927
7953
|
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");
|
|
7928
7954
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
7929
7955
|
};
|
|
7930
|
-
var __classPrivateFieldSet$
|
|
7956
|
+
var __classPrivateFieldSet$f = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
7931
7957
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
7932
7958
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
7933
7959
|
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");
|
|
@@ -7962,8 +7988,8 @@ class RTCEndpoint {
|
|
|
7962
7988
|
if (this.rtc.rtcClient.connectionState !== 'connected') {
|
|
7963
7989
|
this.rtc.rtcClient.removeEventListener('connectionstatechange', this.connectionStateChangeHandler);
|
|
7964
7990
|
this.close();
|
|
7965
|
-
if (__classPrivateFieldGet$
|
|
7966
|
-
__classPrivateFieldGet$
|
|
7991
|
+
if (__classPrivateFieldGet$g(this, _RTCEndpoint_disconnectListener, "f")) {
|
|
7992
|
+
__classPrivateFieldGet$g(this, _RTCEndpoint_disconnectListener, "f").call(this);
|
|
7967
7993
|
}
|
|
7968
7994
|
}
|
|
7969
7995
|
};
|
|
@@ -8011,9 +8037,9 @@ class RTCEndpoint {
|
|
|
8011
8037
|
data = new TextDecoder().decode(e.data);
|
|
8012
8038
|
}
|
|
8013
8039
|
const { messageId, action, payload } = JSON.parse(data);
|
|
8014
|
-
if (__classPrivateFieldGet$
|
|
8040
|
+
if (__classPrivateFieldGet$g(this, _RTCEndpoint_processAction, "f")) {
|
|
8015
8041
|
try {
|
|
8016
|
-
const res = await __classPrivateFieldGet$
|
|
8042
|
+
const res = await __classPrivateFieldGet$g(this, _RTCEndpoint_processAction, "f").call(this, action, payload, endpointIdentity);
|
|
8017
8043
|
this.rtc.channels.response.send(JSON.stringify({
|
|
8018
8044
|
messageId,
|
|
8019
8045
|
payload: res,
|
|
@@ -8047,25 +8073,25 @@ class RTCEndpoint {
|
|
|
8047
8073
|
datachannel.onclose = (e) => {
|
|
8048
8074
|
[...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.')));
|
|
8049
8075
|
this.close();
|
|
8050
|
-
if (__classPrivateFieldGet$
|
|
8051
|
-
__classPrivateFieldGet$
|
|
8076
|
+
if (__classPrivateFieldGet$g(this, _RTCEndpoint_disconnectListener, "f")) {
|
|
8077
|
+
__classPrivateFieldGet$g(this, _RTCEndpoint_disconnectListener, "f").call(this);
|
|
8052
8078
|
}
|
|
8053
8079
|
};
|
|
8054
8080
|
});
|
|
8055
8081
|
}
|
|
8056
8082
|
onDisconnect(listener) {
|
|
8057
|
-
if (!__classPrivateFieldGet$
|
|
8058
|
-
__classPrivateFieldSet$
|
|
8083
|
+
if (!__classPrivateFieldGet$g(this, _RTCEndpoint_disconnectListener, "f")) {
|
|
8084
|
+
__classPrivateFieldSet$f(this, _RTCEndpoint_disconnectListener, listener, "f");
|
|
8059
8085
|
}
|
|
8060
8086
|
else {
|
|
8061
8087
|
throw new Error('RTCEndpoint disconnectListener cannot be set twice.');
|
|
8062
8088
|
}
|
|
8063
8089
|
}
|
|
8064
8090
|
receive(listener) {
|
|
8065
|
-
if (__classPrivateFieldGet$
|
|
8091
|
+
if (__classPrivateFieldGet$g(this, _RTCEndpoint_processAction, "f")) {
|
|
8066
8092
|
throw new Error('You have already set a listener for this RTC Endpoint.');
|
|
8067
8093
|
}
|
|
8068
|
-
__classPrivateFieldSet$
|
|
8094
|
+
__classPrivateFieldSet$f(this, _RTCEndpoint_processAction, listener, "f");
|
|
8069
8095
|
}
|
|
8070
8096
|
get connected() {
|
|
8071
8097
|
return this.rtc.rtcClient.connectionState === 'connected';
|
|
@@ -8076,12 +8102,12 @@ _RTCEndpoint_processAction = new WeakMap(), _RTCEndpoint_disconnectListener = ne
|
|
|
8076
8102
|
|
|
8077
8103
|
var strategy$1 = {};
|
|
8078
8104
|
|
|
8079
|
-
var __classPrivateFieldGet$
|
|
8105
|
+
var __classPrivateFieldGet$f = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8080
8106
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
8081
8107
|
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");
|
|
8082
8108
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
8083
8109
|
};
|
|
8084
|
-
var __classPrivateFieldSet$
|
|
8110
|
+
var __classPrivateFieldSet$e = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
8085
8111
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
8086
8112
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
8087
8113
|
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");
|
|
@@ -8102,11 +8128,11 @@ class EndpointStrategy {
|
|
|
8102
8128
|
return this.getEndpointById(endpointId).send(action, payload);
|
|
8103
8129
|
};
|
|
8104
8130
|
this.close = async () => {
|
|
8105
|
-
if (__classPrivateFieldGet$
|
|
8106
|
-
__classPrivateFieldGet$
|
|
8107
|
-
__classPrivateFieldSet$
|
|
8131
|
+
if (__classPrivateFieldGet$f(this, _EndpointStrategy_connected, "f")) {
|
|
8132
|
+
__classPrivateFieldGet$f(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.close());
|
|
8133
|
+
__classPrivateFieldSet$e(this, _EndpointStrategy_endpointMap, new Map(), "f");
|
|
8108
8134
|
}
|
|
8109
|
-
__classPrivateFieldSet$
|
|
8135
|
+
__classPrivateFieldSet$e(this, _EndpointStrategy_connected, false, "f");
|
|
8110
8136
|
};
|
|
8111
8137
|
this.isValidEndpointPayload = validateEndpoint;
|
|
8112
8138
|
}
|
|
@@ -8114,39 +8140,39 @@ class EndpointStrategy {
|
|
|
8114
8140
|
this.getEndpointById(endpointId).onDisconnect(listener);
|
|
8115
8141
|
}
|
|
8116
8142
|
receive(listener) {
|
|
8117
|
-
if (__classPrivateFieldGet$
|
|
8143
|
+
if (__classPrivateFieldGet$f(this, _EndpointStrategy_processAction, "f")) {
|
|
8118
8144
|
throw new Error(`You have already set a listener for this ${this.StrategyName} Strategy`);
|
|
8119
8145
|
}
|
|
8120
|
-
__classPrivateFieldSet$
|
|
8146
|
+
__classPrivateFieldSet$e(this, _EndpointStrategy_processAction, listener, "f");
|
|
8121
8147
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
8122
|
-
__classPrivateFieldGet$
|
|
8148
|
+
__classPrivateFieldGet$f(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.receive(__classPrivateFieldGet$f(this, _EndpointStrategy_processAction, "f")));
|
|
8123
8149
|
}
|
|
8124
8150
|
getEndpointById(endpointId) {
|
|
8125
|
-
const endpoint = __classPrivateFieldGet$
|
|
8151
|
+
const endpoint = __classPrivateFieldGet$f(this, _EndpointStrategy_endpointMap, "f").get(endpointId);
|
|
8126
8152
|
if (!endpoint) {
|
|
8127
8153
|
throw new Error(`Client with endpoint id ${endpointId} is not connected`);
|
|
8128
8154
|
}
|
|
8129
8155
|
return endpoint;
|
|
8130
8156
|
}
|
|
8131
8157
|
get connected() {
|
|
8132
|
-
return __classPrivateFieldGet$
|
|
8158
|
+
return __classPrivateFieldGet$f(this, _EndpointStrategy_connected, "f");
|
|
8133
8159
|
}
|
|
8134
8160
|
isEndpointConnected(endpointId) {
|
|
8135
|
-
return __classPrivateFieldGet$
|
|
8161
|
+
return __classPrivateFieldGet$f(this, _EndpointStrategy_endpointMap, "f").has(endpointId);
|
|
8136
8162
|
}
|
|
8137
8163
|
addEndpoint(endpointId, payload) {
|
|
8138
|
-
if (!__classPrivateFieldGet$
|
|
8164
|
+
if (!__classPrivateFieldGet$f(this, _EndpointStrategy_connected, "f")) {
|
|
8139
8165
|
console.warn(`Adding endpoint to disconnected ${this.StrategyName} Strategy`);
|
|
8140
8166
|
return;
|
|
8141
8167
|
}
|
|
8142
8168
|
const clientStrat = new this.EndpointType(payload);
|
|
8143
|
-
if (__classPrivateFieldGet$
|
|
8144
|
-
clientStrat.receive(__classPrivateFieldGet$
|
|
8169
|
+
if (__classPrivateFieldGet$f(this, _EndpointStrategy_processAction, "f")) {
|
|
8170
|
+
clientStrat.receive(__classPrivateFieldGet$f(this, _EndpointStrategy_processAction, "f"));
|
|
8145
8171
|
}
|
|
8146
|
-
__classPrivateFieldGet$
|
|
8172
|
+
__classPrivateFieldGet$f(this, _EndpointStrategy_endpointMap, "f").set(endpointId, clientStrat);
|
|
8147
8173
|
}
|
|
8148
8174
|
async closeEndpoint(endpointId) {
|
|
8149
|
-
__classPrivateFieldGet$
|
|
8175
|
+
__classPrivateFieldGet$f(this, _EndpointStrategy_endpointMap, "f").delete(endpointId);
|
|
8150
8176
|
}
|
|
8151
8177
|
}
|
|
8152
8178
|
strategy$1.EndpointStrategy = EndpointStrategy;
|
|
@@ -8328,12 +8354,12 @@ function runtimeUuidMeetsMinimumRuntimeVersion(runtimeUuid, minVersion) {
|
|
|
8328
8354
|
}
|
|
8329
8355
|
runtimeVersioning.runtimeUuidMeetsMinimumRuntimeVersion = runtimeUuidMeetsMinimumRuntimeVersion;
|
|
8330
8356
|
|
|
8331
|
-
var __classPrivateFieldGet$
|
|
8357
|
+
var __classPrivateFieldGet$e = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8332
8358
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
8333
8359
|
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");
|
|
8334
8360
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
8335
8361
|
};
|
|
8336
|
-
var __classPrivateFieldSet$
|
|
8362
|
+
var __classPrivateFieldSet$d = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
8337
8363
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
8338
8364
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
8339
8365
|
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");
|
|
@@ -8377,19 +8403,19 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
8377
8403
|
* a read-only array containing all the identities of connecting clients.
|
|
8378
8404
|
*/
|
|
8379
8405
|
get connections() {
|
|
8380
|
-
return [...__classPrivateFieldGet$
|
|
8406
|
+
return [...__classPrivateFieldGet$e(this, _ChannelProvider_connections, "f")];
|
|
8381
8407
|
}
|
|
8382
8408
|
static handleClientDisconnection(channel, payload) {
|
|
8383
8409
|
if (payload?.endpointId) {
|
|
8384
8410
|
const { uuid, name, endpointId, isLocalEndpointId } = payload;
|
|
8385
|
-
__classPrivateFieldGet$
|
|
8411
|
+
__classPrivateFieldGet$e(channel, _ChannelProvider_removeEndpoint, "f").call(channel, { uuid, name, endpointId, isLocalEndpointId });
|
|
8386
8412
|
}
|
|
8387
8413
|
else {
|
|
8388
8414
|
// this is here to support older runtimes that did not have endpointId
|
|
8389
8415
|
const multipleRemoves = channel.connections.filter((identity) => {
|
|
8390
8416
|
return identity.uuid === payload.uuid && identity.name === payload.name;
|
|
8391
8417
|
});
|
|
8392
|
-
multipleRemoves.forEach(__classPrivateFieldGet$
|
|
8418
|
+
multipleRemoves.forEach(__classPrivateFieldGet$e(channel, _ChannelProvider_removeEndpoint, "f"));
|
|
8393
8419
|
}
|
|
8394
8420
|
channel.disconnectListener(payload);
|
|
8395
8421
|
}
|
|
@@ -8406,8 +8432,8 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
8406
8432
|
_ChannelProvider_strategy.set(this, void 0);
|
|
8407
8433
|
_ChannelProvider_removeEndpoint.set(this, (identity) => {
|
|
8408
8434
|
const remainingConnections = this.connections.filter((clientIdentity) => clientIdentity.endpointId !== identity.endpointId);
|
|
8409
|
-
__classPrivateFieldGet$
|
|
8410
|
-
__classPrivateFieldSet$
|
|
8435
|
+
__classPrivateFieldGet$e(this, _ChannelProvider_strategy, "f").closeEndpoint(identity.endpointId);
|
|
8436
|
+
__classPrivateFieldSet$d(this, _ChannelProvider_connections, remainingConnections, "f");
|
|
8411
8437
|
});
|
|
8412
8438
|
// Must be bound.
|
|
8413
8439
|
this.processAction = async (action, payload, senderIdentity) => {
|
|
@@ -8421,17 +8447,17 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
8421
8447
|
return super.processAction(action, payload, senderIdentity);
|
|
8422
8448
|
};
|
|
8423
8449
|
_ChannelProvider_close.set(this, () => {
|
|
8424
|
-
__classPrivateFieldGet$
|
|
8450
|
+
__classPrivateFieldGet$e(this, _ChannelProvider_strategy, "f").close();
|
|
8425
8451
|
const remove = ChannelProvider.removalMap.get(this);
|
|
8426
8452
|
if (remove) {
|
|
8427
8453
|
remove();
|
|
8428
8454
|
}
|
|
8429
8455
|
});
|
|
8430
|
-
__classPrivateFieldSet$
|
|
8456
|
+
__classPrivateFieldSet$d(this, _ChannelProvider_protectedObj, new channel_1.ProtectedItems(providerIdentity, close), "f");
|
|
8431
8457
|
this.connectListener = () => undefined;
|
|
8432
8458
|
this.disconnectListener = () => undefined;
|
|
8433
|
-
__classPrivateFieldSet$
|
|
8434
|
-
__classPrivateFieldSet$
|
|
8459
|
+
__classPrivateFieldSet$d(this, _ChannelProvider_connections, [], "f");
|
|
8460
|
+
__classPrivateFieldSet$d(this, _ChannelProvider_strategy, strategy, "f");
|
|
8435
8461
|
strategy.receive(this.processAction);
|
|
8436
8462
|
}
|
|
8437
8463
|
/**
|
|
@@ -8462,16 +8488,16 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
8462
8488
|
*/
|
|
8463
8489
|
dispatch(to, action, payload) {
|
|
8464
8490
|
const endpointId = to.endpointId ?? this.getEndpointIdForOpenFinId(to, action);
|
|
8465
|
-
if (endpointId && __classPrivateFieldGet$
|
|
8491
|
+
if (endpointId && __classPrivateFieldGet$e(this, _ChannelProvider_strategy, "f").isEndpointConnected(endpointId)) {
|
|
8466
8492
|
const callSites = transport_errors_1$2.RuntimeError.getCallSite();
|
|
8467
|
-
return __classPrivateFieldGet$
|
|
8493
|
+
return __classPrivateFieldGet$e(this, _ChannelProvider_strategy, "f").send(endpointId, action, payload).catch((e) => {
|
|
8468
8494
|
throw new channel_error_1.ChannelError(e, action, payload, callSites);
|
|
8469
8495
|
});
|
|
8470
8496
|
}
|
|
8471
8497
|
return Promise.reject(new Error(`Client connection with identity uuid: ${to.uuid} / name: ${to.name} / endpointId: ${endpointId} no longer connected.`));
|
|
8472
8498
|
}
|
|
8473
8499
|
async processConnection(senderId, payload) {
|
|
8474
|
-
__classPrivateFieldGet$
|
|
8500
|
+
__classPrivateFieldGet$e(this, _ChannelProvider_connections, "f").push(senderId);
|
|
8475
8501
|
return this.connectListener(senderId, payload);
|
|
8476
8502
|
}
|
|
8477
8503
|
/**
|
|
@@ -8494,7 +8520,7 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
8494
8520
|
* ```
|
|
8495
8521
|
*/
|
|
8496
8522
|
publish(action, payload) {
|
|
8497
|
-
return this.connections.map((to) => __classPrivateFieldGet$
|
|
8523
|
+
return this.connections.map((to) => __classPrivateFieldGet$e(this, _ChannelProvider_strategy, "f").send(to.endpointId, action, payload));
|
|
8498
8524
|
}
|
|
8499
8525
|
/**
|
|
8500
8526
|
* Register a listener that is called on every new client connection.
|
|
@@ -8568,11 +8594,11 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
8568
8594
|
* ```
|
|
8569
8595
|
*/
|
|
8570
8596
|
async destroy() {
|
|
8571
|
-
const protectedObj = __classPrivateFieldGet$
|
|
8597
|
+
const protectedObj = __classPrivateFieldGet$e(this, _ChannelProvider_protectedObj, "f");
|
|
8572
8598
|
protectedObj.providerIdentity;
|
|
8573
|
-
__classPrivateFieldSet$
|
|
8599
|
+
__classPrivateFieldSet$d(this, _ChannelProvider_connections, [], "f");
|
|
8574
8600
|
await protectedObj.close();
|
|
8575
|
-
__classPrivateFieldGet$
|
|
8601
|
+
__classPrivateFieldGet$e(this, _ChannelProvider_close, "f").call(this);
|
|
8576
8602
|
}
|
|
8577
8603
|
/**
|
|
8578
8604
|
* Returns an array with info on every Client connected to the Provider
|
|
@@ -8642,7 +8668,7 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
8642
8668
|
getEndpointIdForOpenFinId(clientIdentity, action) {
|
|
8643
8669
|
const matchingConnections = this.connections.filter((c) => c.name === clientIdentity.name && c.uuid === clientIdentity.uuid);
|
|
8644
8670
|
if (matchingConnections.length >= 2) {
|
|
8645
|
-
const protectedObj = __classPrivateFieldGet$
|
|
8671
|
+
const protectedObj = __classPrivateFieldGet$e(this, _ChannelProvider_protectedObj, "f");
|
|
8646
8672
|
const { uuid, name } = clientIdentity;
|
|
8647
8673
|
const providerUuid = protectedObj?.providerIdentity.uuid;
|
|
8648
8674
|
const providerName = protectedObj?.providerIdentity.name;
|
|
@@ -8854,13 +8880,13 @@ class CombinedStrategy {
|
|
|
8854
8880
|
}
|
|
8855
8881
|
strategy.default = CombinedStrategy;
|
|
8856
8882
|
|
|
8857
|
-
var __classPrivateFieldSet$
|
|
8883
|
+
var __classPrivateFieldSet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
8858
8884
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
8859
8885
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
8860
8886
|
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");
|
|
8861
8887
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
8862
8888
|
};
|
|
8863
|
-
var __classPrivateFieldGet$
|
|
8889
|
+
var __classPrivateFieldGet$d = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8864
8890
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
8865
8891
|
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");
|
|
8866
8892
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -8909,8 +8935,8 @@ class ConnectionManager extends base_1$j.Base {
|
|
|
8909
8935
|
};
|
|
8910
8936
|
this.providerMap = new Map();
|
|
8911
8937
|
this.protocolManager = new protocol_manager_1.ProtocolManager(this.wire.environment.type === 'node' ? ['classic'] : ['rtc', 'classic']);
|
|
8912
|
-
__classPrivateFieldSet$
|
|
8913
|
-
__classPrivateFieldSet$
|
|
8938
|
+
__classPrivateFieldSet$c(this, _ConnectionManager_messageReceiver, new message_receiver_1.MessageReceiver(wire), "f");
|
|
8939
|
+
__classPrivateFieldSet$c(this, _ConnectionManager_rtcConnectionManager, new ice_manager_1.RTCICEManager(wire), "f");
|
|
8914
8940
|
wire.registerMessageHandler(this.onmessage.bind(this));
|
|
8915
8941
|
}
|
|
8916
8942
|
createProvider(options, providerIdentity) {
|
|
@@ -8921,7 +8947,7 @@ class ConnectionManager extends base_1$j.Base {
|
|
|
8921
8947
|
case 'rtc':
|
|
8922
8948
|
return new strategy_2.RTCStrategy();
|
|
8923
8949
|
case 'classic':
|
|
8924
|
-
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$
|
|
8950
|
+
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$d(this, _ConnectionManager_messageReceiver, "f"),
|
|
8925
8951
|
// Providers do not have an endpointId, use channelId as endpointId in the strategy.
|
|
8926
8952
|
providerIdentity.channelId, providerIdentity);
|
|
8927
8953
|
default:
|
|
@@ -8957,7 +8983,7 @@ class ConnectionManager extends base_1$j.Base {
|
|
|
8957
8983
|
const supportedProtocols = await Promise.all(protocols.map(async (type) => {
|
|
8958
8984
|
switch (type) {
|
|
8959
8985
|
case 'rtc': {
|
|
8960
|
-
const { rtcClient, channels, offer, rtcConnectionId, channelsOpened } = await __classPrivateFieldGet$
|
|
8986
|
+
const { rtcClient, channels, offer, rtcConnectionId, channelsOpened } = await __classPrivateFieldGet$d(this, _ConnectionManager_rtcConnectionManager, "f").startClientOffer();
|
|
8961
8987
|
rtcPacket = { rtcClient, channels, channelsOpened };
|
|
8962
8988
|
return {
|
|
8963
8989
|
type: 'rtc',
|
|
@@ -8984,18 +9010,18 @@ class ConnectionManager extends base_1$j.Base {
|
|
|
8984
9010
|
routingInfo.endpointId = this.wire.environment.getNextMessageId();
|
|
8985
9011
|
// For New Clients connecting to Old Providers. To prevent multi-dispatching and publishing, we delete previously-connected
|
|
8986
9012
|
// clients that are in the same context as the newly-connected client.
|
|
8987
|
-
__classPrivateFieldGet$
|
|
9013
|
+
__classPrivateFieldGet$d(this, _ConnectionManager_messageReceiver, "f").checkForPreviousClientConnection(routingInfo.channelId);
|
|
8988
9014
|
}
|
|
8989
9015
|
const answer = routingInfo.answer ?? {
|
|
8990
9016
|
supportedProtocols: [{ type: 'classic', version: 1 }]
|
|
8991
9017
|
};
|
|
8992
9018
|
const createStrategyFromAnswer = async (protocol) => {
|
|
8993
9019
|
if (protocol.type === 'rtc' && rtcPacket) {
|
|
8994
|
-
await __classPrivateFieldGet$
|
|
9020
|
+
await __classPrivateFieldGet$d(this, _ConnectionManager_rtcConnectionManager, "f").finishClientOffer(rtcPacket.rtcClient, protocol.payload.answer, rtcPacket.channelsOpened);
|
|
8995
9021
|
return new strategy_2.RTCStrategy();
|
|
8996
9022
|
}
|
|
8997
9023
|
if (protocol.type === 'classic') {
|
|
8998
|
-
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$
|
|
9024
|
+
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$d(this, _ConnectionManager_messageReceiver, "f"), routingInfo.endpointId, routingInfo);
|
|
8999
9025
|
}
|
|
9000
9026
|
return null;
|
|
9001
9027
|
};
|
|
@@ -9063,7 +9089,7 @@ class ConnectionManager extends base_1$j.Base {
|
|
|
9063
9089
|
clientAnswer = await overlappingProtocols.reduce(async (accumP, protocolToUse) => {
|
|
9064
9090
|
const answer = await accumP;
|
|
9065
9091
|
if (protocolToUse.type === 'rtc') {
|
|
9066
|
-
const { answer: rtcAnswer, rtcClient, channels } = await __classPrivateFieldGet$
|
|
9092
|
+
const { answer: rtcAnswer, rtcClient, channels } = await __classPrivateFieldGet$d(this, _ConnectionManager_rtcConnectionManager, "f").createProviderAnswer(protocolToUse.payload.rtcConnectionId, protocolToUse.payload.offer);
|
|
9067
9093
|
answer.supportedProtocols.push({
|
|
9068
9094
|
type: 'rtc',
|
|
9069
9095
|
version: strategy_2.RTCInfo.version,
|
|
@@ -9111,13 +9137,13 @@ _ConnectionManager_messageReceiver = new WeakMap(), _ConnectionManager_rtcConnec
|
|
|
9111
9137
|
*
|
|
9112
9138
|
* @packageDocumentation
|
|
9113
9139
|
*/
|
|
9114
|
-
var __classPrivateFieldSet$
|
|
9140
|
+
var __classPrivateFieldSet$b = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
9115
9141
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
9116
9142
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
9117
9143
|
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");
|
|
9118
9144
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
9119
9145
|
};
|
|
9120
|
-
var __classPrivateFieldGet$
|
|
9146
|
+
var __classPrivateFieldGet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9121
9147
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9122
9148
|
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");
|
|
9123
9149
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -9174,11 +9200,11 @@ class Channel extends base_1$i.EmitterBase {
|
|
|
9174
9200
|
client_1.ChannelClient.handleProviderDisconnect(eventPayload);
|
|
9175
9201
|
}),
|
|
9176
9202
|
this.on('connected', (...args) => {
|
|
9177
|
-
__classPrivateFieldGet$
|
|
9203
|
+
__classPrivateFieldGet$c(this, _Channel_internalEmitter, "f").emit('connected', ...args);
|
|
9178
9204
|
})
|
|
9179
9205
|
]).catch(() => new Error('error setting up channel connection listeners'));
|
|
9180
9206
|
}));
|
|
9181
|
-
__classPrivateFieldSet$
|
|
9207
|
+
__classPrivateFieldSet$b(this, _Channel_connectionManager, new connection_manager_1.ConnectionManager(wire), "f");
|
|
9182
9208
|
}
|
|
9183
9209
|
/**
|
|
9184
9210
|
*
|
|
@@ -9253,7 +9279,7 @@ class Channel extends base_1$i.EmitterBase {
|
|
|
9253
9279
|
resolve(true);
|
|
9254
9280
|
}
|
|
9255
9281
|
};
|
|
9256
|
-
__classPrivateFieldGet$
|
|
9282
|
+
__classPrivateFieldGet$c(this, _Channel_internalEmitter, "f").on('connected', connectedListener);
|
|
9257
9283
|
});
|
|
9258
9284
|
try {
|
|
9259
9285
|
if (retryInfo.count > 0) {
|
|
@@ -9285,7 +9311,7 @@ class Channel extends base_1$i.EmitterBase {
|
|
|
9285
9311
|
finally {
|
|
9286
9312
|
retryInfo.count += 1;
|
|
9287
9313
|
// in case of other errors, remove our listener
|
|
9288
|
-
__classPrivateFieldGet$
|
|
9314
|
+
__classPrivateFieldGet$c(this, _Channel_internalEmitter, "f").removeListener('connected', connectedListener);
|
|
9289
9315
|
}
|
|
9290
9316
|
} while (shouldWait); // If we're waiting we retry the above loop
|
|
9291
9317
|
// Should wait was false, no channel was found.
|
|
@@ -9344,12 +9370,12 @@ class Channel extends base_1$i.EmitterBase {
|
|
|
9344
9370
|
async connect(channelName, options = {}) {
|
|
9345
9371
|
// Make sure we don't connect before listeners are set up
|
|
9346
9372
|
// This also errors if we're not in OpenFin, ensuring we don't run unnecessary code
|
|
9347
|
-
await __classPrivateFieldGet$
|
|
9373
|
+
await __classPrivateFieldGet$c(this, _Channel_readyToConnect, "f").getValue();
|
|
9348
9374
|
if (!channelName || typeof channelName !== 'string') {
|
|
9349
9375
|
throw new Error('Please provide a channelName string to connect to a channel.');
|
|
9350
9376
|
}
|
|
9351
9377
|
const opts = { wait: true, ...this.wire.environment.getDefaultChannelOptions().connect, ...options };
|
|
9352
|
-
const { offer, rtc: rtcPacket } = await __classPrivateFieldGet$
|
|
9378
|
+
const { offer, rtc: rtcPacket } = await __classPrivateFieldGet$c(this, _Channel_connectionManager, "f").createClientOffer(opts);
|
|
9353
9379
|
let connectionUrl;
|
|
9354
9380
|
if (this.fin.me.isFrame || this.fin.me.isView || this.fin.me.isWindow) {
|
|
9355
9381
|
connectionUrl = (await this.fin.me.getInfo()).url;
|
|
@@ -9361,7 +9387,7 @@ class Channel extends base_1$i.EmitterBase {
|
|
|
9361
9387
|
connectionUrl
|
|
9362
9388
|
};
|
|
9363
9389
|
const routingInfo = await this.safeConnect(channelName, opts.wait, connectPayload);
|
|
9364
|
-
const strategy = await __classPrivateFieldGet$
|
|
9390
|
+
const strategy = await __classPrivateFieldGet$c(this, _Channel_connectionManager, "f").createClientStrategy(rtcPacket, routingInfo);
|
|
9365
9391
|
const channel = new client_1.ChannelClient(routingInfo, () => client_1.ChannelClient.wireClose(this.wire, routingInfo, routingInfo.endpointId), strategy);
|
|
9366
9392
|
// It is the client's responsibility to handle endpoint disconnection to the provider.
|
|
9367
9393
|
// If the endpoint dies, the client will force a disconnection through the core.
|
|
@@ -9430,7 +9456,7 @@ class Channel extends base_1$i.EmitterBase {
|
|
|
9430
9456
|
throw new Error('Please provide a channelName to create a channel');
|
|
9431
9457
|
}
|
|
9432
9458
|
const { payload: { data: providerIdentity } } = await this.wire.sendAction('create-channel', { channelName });
|
|
9433
|
-
const channel = __classPrivateFieldGet$
|
|
9459
|
+
const channel = __classPrivateFieldGet$c(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
|
|
9434
9460
|
// TODO: fix typing (internal)
|
|
9435
9461
|
// @ts-expect-error
|
|
9436
9462
|
this.on('client-disconnected', (eventPayload) => {
|
|
@@ -10321,13 +10347,13 @@ var Factory$3 = {};
|
|
|
10321
10347
|
|
|
10322
10348
|
var Instance$2 = {};
|
|
10323
10349
|
|
|
10324
|
-
var __classPrivateFieldSet$
|
|
10350
|
+
var __classPrivateFieldSet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
10325
10351
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
10326
10352
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
10327
10353
|
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");
|
|
10328
10354
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
10329
10355
|
};
|
|
10330
|
-
var __classPrivateFieldGet$
|
|
10356
|
+
var __classPrivateFieldGet$b = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
10331
10357
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10332
10358
|
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");
|
|
10333
10359
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -10364,24 +10390,24 @@ class Platform extends base_1$a.EmitterBase {
|
|
|
10364
10390
|
this.wire.sendAction('platform-get-client', this.identity).catch((e) => {
|
|
10365
10391
|
// don't expose
|
|
10366
10392
|
});
|
|
10367
|
-
if (!Platform.clientMap.has(__classPrivateFieldGet$
|
|
10368
|
-
const clientPromise = __classPrivateFieldGet$
|
|
10369
|
-
Platform.clientMap.set(__classPrivateFieldGet$
|
|
10393
|
+
if (!Platform.clientMap.has(__classPrivateFieldGet$b(this, _Platform_channelName, "f"))) {
|
|
10394
|
+
const clientPromise = __classPrivateFieldGet$b(this, _Platform_connectToProvider, "f").call(this);
|
|
10395
|
+
Platform.clientMap.set(__classPrivateFieldGet$b(this, _Platform_channelName, "f"), clientPromise);
|
|
10370
10396
|
}
|
|
10371
10397
|
// we set it above
|
|
10372
10398
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
10373
|
-
return Platform.clientMap.get(__classPrivateFieldGet$
|
|
10399
|
+
return Platform.clientMap.get(__classPrivateFieldGet$b(this, _Platform_channelName, "f"));
|
|
10374
10400
|
};
|
|
10375
10401
|
_Platform_connectToProvider.set(this, async () => {
|
|
10376
10402
|
try {
|
|
10377
|
-
const client = await this._channel.connect(__classPrivateFieldGet$
|
|
10403
|
+
const client = await this._channel.connect(__classPrivateFieldGet$b(this, _Platform_channelName, "f"), { wait: false });
|
|
10378
10404
|
client.onDisconnection(() => {
|
|
10379
|
-
Platform.clientMap.delete(__classPrivateFieldGet$
|
|
10405
|
+
Platform.clientMap.delete(__classPrivateFieldGet$b(this, _Platform_channelName, "f"));
|
|
10380
10406
|
});
|
|
10381
10407
|
return client;
|
|
10382
10408
|
}
|
|
10383
10409
|
catch (e) {
|
|
10384
|
-
Platform.clientMap.delete(__classPrivateFieldGet$
|
|
10410
|
+
Platform.clientMap.delete(__classPrivateFieldGet$b(this, _Platform_channelName, "f"));
|
|
10385
10411
|
throw new Error('The targeted Platform is not currently running. Listen for application-started event for the given Uuid.');
|
|
10386
10412
|
}
|
|
10387
10413
|
});
|
|
@@ -10394,7 +10420,7 @@ class Platform extends base_1$a.EmitterBase {
|
|
|
10394
10420
|
if (errorMsg) {
|
|
10395
10421
|
throw new Error(errorMsg);
|
|
10396
10422
|
}
|
|
10397
|
-
__classPrivateFieldSet$
|
|
10423
|
+
__classPrivateFieldSet$a(this, _Platform_channelName, channelName, "f");
|
|
10398
10424
|
this._channel = this.fin.InterApplicationBus.Channel;
|
|
10399
10425
|
this.identity = { uuid: identity.uuid };
|
|
10400
10426
|
this.Layout = this.fin.Platform.Layout;
|
|
@@ -11450,13 +11476,13 @@ const createRelayedDispatch = (client, target, relayId, relayErrorMsg) => async
|
|
|
11450
11476
|
};
|
|
11451
11477
|
channelApiRelay.createRelayedDispatch = createRelayedDispatch;
|
|
11452
11478
|
|
|
11453
|
-
var __classPrivateFieldSet$
|
|
11479
|
+
var __classPrivateFieldSet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
11454
11480
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
11455
11481
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
11456
11482
|
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");
|
|
11457
11483
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11458
11484
|
};
|
|
11459
|
-
var __classPrivateFieldGet$
|
|
11485
|
+
var __classPrivateFieldGet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
11460
11486
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
11461
11487
|
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");
|
|
11462
11488
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -11510,7 +11536,7 @@ class LayoutNode {
|
|
|
11510
11536
|
* console.log(`The parent ColumnOrRow is root: ${parentIsRoot}`);
|
|
11511
11537
|
* ```
|
|
11512
11538
|
*/
|
|
11513
|
-
this.isRoot = () => __classPrivateFieldGet$
|
|
11539
|
+
this.isRoot = () => __classPrivateFieldGet$a(this, _LayoutNode_client, "f").isRoot(this.entityId);
|
|
11514
11540
|
/**
|
|
11515
11541
|
* Checks if the TabStack or ColumnOrRow exists
|
|
11516
11542
|
*
|
|
@@ -11530,7 +11556,7 @@ class LayoutNode {
|
|
|
11530
11556
|
* console.log(`The entity exists: ${exists}`);
|
|
11531
11557
|
* ```
|
|
11532
11558
|
*/
|
|
11533
|
-
this.exists = () => __classPrivateFieldGet$
|
|
11559
|
+
this.exists = () => __classPrivateFieldGet$a(this, _LayoutNode_client, "f").exists(this.entityId);
|
|
11534
11560
|
/**
|
|
11535
11561
|
* Retrieves the parent of the TabStack or ColumnOrRow
|
|
11536
11562
|
*
|
|
@@ -11551,11 +11577,11 @@ class LayoutNode {
|
|
|
11551
11577
|
* ```
|
|
11552
11578
|
*/
|
|
11553
11579
|
this.getParent = async () => {
|
|
11554
|
-
const parent = await __classPrivateFieldGet$
|
|
11580
|
+
const parent = await __classPrivateFieldGet$a(this, _LayoutNode_client, "f").getParent(this.entityId);
|
|
11555
11581
|
if (!parent) {
|
|
11556
11582
|
return undefined;
|
|
11557
11583
|
}
|
|
11558
|
-
return LayoutNode.getEntity(parent, __classPrivateFieldGet$
|
|
11584
|
+
return LayoutNode.getEntity(parent, __classPrivateFieldGet$a(this, _LayoutNode_client, "f"));
|
|
11559
11585
|
};
|
|
11560
11586
|
/**
|
|
11561
11587
|
* Creates a new TabStack adjacent to the given TabStack or ColumnOrRow. Inputs can be new views to create, or existing views.
|
|
@@ -11606,8 +11632,8 @@ class LayoutNode {
|
|
|
11606
11632
|
* @experimental
|
|
11607
11633
|
*/
|
|
11608
11634
|
this.createAdjacentStack = async (views, options) => {
|
|
11609
|
-
const entityId = await __classPrivateFieldGet$
|
|
11610
|
-
return LayoutNode.getEntity({ entityId, type: 'stack' }, __classPrivateFieldGet$
|
|
11635
|
+
const entityId = await __classPrivateFieldGet$a(this, _LayoutNode_client, "f").createAdjacentStack(this.entityId, views, options);
|
|
11636
|
+
return LayoutNode.getEntity({ entityId, type: 'stack' }, __classPrivateFieldGet$a(this, _LayoutNode_client, "f"));
|
|
11611
11637
|
};
|
|
11612
11638
|
/**
|
|
11613
11639
|
* Retrieves the adjacent TabStacks of the given TabStack or ColumnOrRow.
|
|
@@ -11635,16 +11661,16 @@ class LayoutNode {
|
|
|
11635
11661
|
* @experimental
|
|
11636
11662
|
*/
|
|
11637
11663
|
this.getAdjacentStacks = async (edge) => {
|
|
11638
|
-
const adjacentStacks = await __classPrivateFieldGet$
|
|
11664
|
+
const adjacentStacks = await __classPrivateFieldGet$a(this, _LayoutNode_client, "f").getAdjacentStacks({
|
|
11639
11665
|
targetId: this.entityId,
|
|
11640
11666
|
edge
|
|
11641
11667
|
});
|
|
11642
11668
|
return adjacentStacks.map((stack) => LayoutNode.getEntity({
|
|
11643
11669
|
type: 'stack',
|
|
11644
11670
|
entityId: stack.entityId
|
|
11645
|
-
}, __classPrivateFieldGet$
|
|
11671
|
+
}, __classPrivateFieldGet$a(this, _LayoutNode_client, "f")));
|
|
11646
11672
|
};
|
|
11647
|
-
__classPrivateFieldSet$
|
|
11673
|
+
__classPrivateFieldSet$9(this, _LayoutNode_client, client, "f");
|
|
11648
11674
|
this.entityId = entityId;
|
|
11649
11675
|
}
|
|
11650
11676
|
}
|
|
@@ -11718,7 +11744,7 @@ class TabStack extends LayoutNode {
|
|
|
11718
11744
|
* ```
|
|
11719
11745
|
* @experimental
|
|
11720
11746
|
*/
|
|
11721
|
-
this.getViews = () => __classPrivateFieldGet$
|
|
11747
|
+
this.getViews = () => __classPrivateFieldGet$a(this, _TabStack_client, "f").getStackViews(this.entityId);
|
|
11722
11748
|
/**
|
|
11723
11749
|
* Adds or creates a view in this {@link TabStack}.
|
|
11724
11750
|
*
|
|
@@ -11749,7 +11775,7 @@ class TabStack extends LayoutNode {
|
|
|
11749
11775
|
* ```
|
|
11750
11776
|
* @experimental
|
|
11751
11777
|
*/
|
|
11752
|
-
this.addView = async (view, options = { index: 0 }) => __classPrivateFieldGet$
|
|
11778
|
+
this.addView = async (view, options = { index: 0 }) => __classPrivateFieldGet$a(this, _TabStack_client, "f").addViewToStack(this.entityId, view, options);
|
|
11753
11779
|
/**
|
|
11754
11780
|
* Removes a view from this {@link TabStack}.
|
|
11755
11781
|
*
|
|
@@ -11779,7 +11805,7 @@ class TabStack extends LayoutNode {
|
|
|
11779
11805
|
* ```
|
|
11780
11806
|
*/
|
|
11781
11807
|
this.removeView = async (view) => {
|
|
11782
|
-
await __classPrivateFieldGet$
|
|
11808
|
+
await __classPrivateFieldGet$a(this, _TabStack_client, "f").removeViewFromStack(this.entityId, view);
|
|
11783
11809
|
};
|
|
11784
11810
|
/**
|
|
11785
11811
|
* Sets the active view of the {@link TabStack} without focusing it.
|
|
@@ -11803,9 +11829,9 @@ class TabStack extends LayoutNode {
|
|
|
11803
11829
|
* @experimental
|
|
11804
11830
|
*/
|
|
11805
11831
|
this.setActiveView = async (view) => {
|
|
11806
|
-
await __classPrivateFieldGet$
|
|
11832
|
+
await __classPrivateFieldGet$a(this, _TabStack_client, "f").setStackActiveView(this.entityId, view);
|
|
11807
11833
|
};
|
|
11808
|
-
__classPrivateFieldSet$
|
|
11834
|
+
__classPrivateFieldSet$9(this, _TabStack_client, client, "f");
|
|
11809
11835
|
}
|
|
11810
11836
|
}
|
|
11811
11837
|
layoutEntities.TabStack = TabStack;
|
|
@@ -11844,10 +11870,10 @@ class ColumnOrRow extends LayoutNode {
|
|
|
11844
11870
|
* ```
|
|
11845
11871
|
*/
|
|
11846
11872
|
this.getContent = async () => {
|
|
11847
|
-
const contentItemEntities = await __classPrivateFieldGet$
|
|
11848
|
-
return contentItemEntities.map((entity) => LayoutNode.getEntity(entity, __classPrivateFieldGet$
|
|
11873
|
+
const contentItemEntities = await __classPrivateFieldGet$a(this, _ColumnOrRow_client, "f").getContent(this.entityId);
|
|
11874
|
+
return contentItemEntities.map((entity) => LayoutNode.getEntity(entity, __classPrivateFieldGet$a(this, _ColumnOrRow_client, "f")));
|
|
11849
11875
|
};
|
|
11850
|
-
__classPrivateFieldSet$
|
|
11876
|
+
__classPrivateFieldSet$9(this, _ColumnOrRow_client, client, "f");
|
|
11851
11877
|
this.type = type;
|
|
11852
11878
|
}
|
|
11853
11879
|
}
|
|
@@ -11862,7 +11888,7 @@ layout_constants.LAYOUT_CONTROLLER_ID = 'layout-entities';
|
|
|
11862
11888
|
// TODO: eventually export this somehow
|
|
11863
11889
|
layout_constants.DEFAULT_LAYOUT_KEY = '__default__';
|
|
11864
11890
|
|
|
11865
|
-
var __classPrivateFieldGet$
|
|
11891
|
+
var __classPrivateFieldGet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
11866
11892
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
11867
11893
|
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");
|
|
11868
11894
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -12013,7 +12039,7 @@ class Layout extends base_1$9.Base {
|
|
|
12013
12039
|
* @internal
|
|
12014
12040
|
*/
|
|
12015
12041
|
static getClient(layout) {
|
|
12016
|
-
return __classPrivateFieldGet$
|
|
12042
|
+
return __classPrivateFieldGet$9(layout, _Layout_layoutClient, "f").getValue();
|
|
12017
12043
|
}
|
|
12018
12044
|
/**
|
|
12019
12045
|
* @internal
|
|
@@ -12236,7 +12262,7 @@ class Layout extends base_1$9.Base {
|
|
|
12236
12262
|
this.wire.sendAction('layout-get-root-item').catch(() => {
|
|
12237
12263
|
// don't expose
|
|
12238
12264
|
});
|
|
12239
|
-
const client = await __classPrivateFieldGet$
|
|
12265
|
+
const client = await __classPrivateFieldGet$9(this, _Layout_layoutClient, "f").getValue();
|
|
12240
12266
|
const root = await client.getRoot('layoutName' in this.identity ? this.identity : undefined);
|
|
12241
12267
|
return layout_entities_1.LayoutNode.getEntity(root, client);
|
|
12242
12268
|
}
|
|
@@ -12254,7 +12280,7 @@ class Layout extends base_1$9.Base {
|
|
|
12254
12280
|
this.wire.sendAction('layout-get-stack-by-view').catch(() => {
|
|
12255
12281
|
// don't expose
|
|
12256
12282
|
});
|
|
12257
|
-
const client = await __classPrivateFieldGet$
|
|
12283
|
+
const client = await __classPrivateFieldGet$9(this, _Layout_layoutClient, "f").getValue();
|
|
12258
12284
|
const stack = await client.getStackByView(identity);
|
|
12259
12285
|
if (!stack) {
|
|
12260
12286
|
throw new Error(`No stack found for view: ${identity.uuid}/${identity.name}`);
|
|
@@ -12274,7 +12300,7 @@ class Layout extends base_1$9.Base {
|
|
|
12274
12300
|
this.wire.sendAction('layout-add-view').catch((e) => {
|
|
12275
12301
|
// don't expose
|
|
12276
12302
|
});
|
|
12277
|
-
const { identity } = await __classPrivateFieldGet$
|
|
12303
|
+
const { identity } = await __classPrivateFieldGet$9(this, _Layout_instances, "m", _Layout_forwardLayoutAction).call(this, 'layout-add-view', {
|
|
12278
12304
|
viewOptions,
|
|
12279
12305
|
location,
|
|
12280
12306
|
targetView
|
|
@@ -12292,7 +12318,7 @@ class Layout extends base_1$9.Base {
|
|
|
12292
12318
|
this.wire.sendAction('layout-close-view').catch((e) => {
|
|
12293
12319
|
// don't expose
|
|
12294
12320
|
});
|
|
12295
|
-
await __classPrivateFieldGet$
|
|
12321
|
+
await __classPrivateFieldGet$9(this, _Layout_instances, "m", _Layout_forwardLayoutAction).call(this, 'layout-close-view', { viewIdentity });
|
|
12296
12322
|
}
|
|
12297
12323
|
}
|
|
12298
12324
|
Instance$1.Layout = Layout;
|
|
@@ -12306,12 +12332,12 @@ async function _Layout_forwardLayoutAction(action, payload) {
|
|
|
12306
12332
|
return client.dispatch(action, { target: this.identity, opts: payload });
|
|
12307
12333
|
};
|
|
12308
12334
|
|
|
12309
|
-
var __classPrivateFieldGet$
|
|
12335
|
+
var __classPrivateFieldGet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12310
12336
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
12311
12337
|
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");
|
|
12312
12338
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12313
12339
|
};
|
|
12314
|
-
var __classPrivateFieldSet$
|
|
12340
|
+
var __classPrivateFieldSet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
12315
12341
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
12316
12342
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
12317
12343
|
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");
|
|
@@ -12377,23 +12403,23 @@ class LayoutModule extends base_1$8.Base {
|
|
|
12377
12403
|
if (!this.wire.environment.layoutAllowedInContext(this.fin)) {
|
|
12378
12404
|
throw new Error('Layout.init can only be called from a Window context.');
|
|
12379
12405
|
}
|
|
12380
|
-
if (__classPrivateFieldGet$
|
|
12406
|
+
if (__classPrivateFieldGet$8(this, _LayoutModule_layoutInitializationAttempted, "f")) {
|
|
12381
12407
|
throw new Error('Layout.init was already called, please use Layout.create to add additional layouts.');
|
|
12382
12408
|
}
|
|
12383
12409
|
if (this.wire.environment.type === 'openfin') {
|
|
12384
12410
|
// preload the client
|
|
12385
12411
|
await this.fin.Platform.getCurrentSync().getClient();
|
|
12386
12412
|
}
|
|
12387
|
-
__classPrivateFieldSet$
|
|
12413
|
+
__classPrivateFieldSet$8(this, _LayoutModule_layoutInitializationAttempted, true, "f");
|
|
12388
12414
|
// TODO: rename to createLayoutManager
|
|
12389
|
-
__classPrivateFieldSet$
|
|
12390
|
-
await this.wire.environment.applyLayoutSnapshot(this.fin, __classPrivateFieldGet$
|
|
12415
|
+
__classPrivateFieldSet$8(this, _LayoutModule_layoutManager, await this.wire.environment.initLayoutManager(this.fin, this.wire, options), "f");
|
|
12416
|
+
await this.wire.environment.applyLayoutSnapshot(this.fin, __classPrivateFieldGet$8(this, _LayoutModule_layoutManager, "f"), options);
|
|
12391
12417
|
const meIdentity = { name: this.fin.me.name, uuid: this.fin.me.uuid };
|
|
12392
12418
|
if (!options.layoutManagerOverride) {
|
|
12393
12419
|
// CORE-1081 to be removed when we actually delete the `layoutManager` prop
|
|
12394
12420
|
// in single-layout case, we return the undocumented layoutManager type
|
|
12395
12421
|
const layoutIdentity = { layoutName: layout_constants_1.DEFAULT_LAYOUT_KEY, ...meIdentity };
|
|
12396
|
-
return __classPrivateFieldGet$
|
|
12422
|
+
return __classPrivateFieldGet$8(this, _LayoutModule_getLayoutManagerSpy, "f").call(this, layoutIdentity);
|
|
12397
12423
|
}
|
|
12398
12424
|
return this.wrapSync(meIdentity);
|
|
12399
12425
|
};
|
|
@@ -12422,13 +12448,13 @@ class LayoutModule extends base_1$8.Base {
|
|
|
12422
12448
|
* @returns
|
|
12423
12449
|
*/
|
|
12424
12450
|
this.getCurrentLayoutManagerSync = () => {
|
|
12425
|
-
return __classPrivateFieldGet$
|
|
12451
|
+
return __classPrivateFieldGet$8(this, _LayoutModule_instances, "m", _LayoutModule_getSafeLayoutManager).call(this, `fin.Platform.Layout.getCurrentLayoutManagerSync()`);
|
|
12426
12452
|
};
|
|
12427
12453
|
this.create = async (options) => {
|
|
12428
|
-
return this.wire.environment.createLayout(__classPrivateFieldGet$
|
|
12454
|
+
return this.wire.environment.createLayout(__classPrivateFieldGet$8(this, _LayoutModule_instances, "m", _LayoutModule_getSafeLayoutManager).call(this, `fin.Platform.Layout.create()`), options);
|
|
12429
12455
|
};
|
|
12430
12456
|
this.destroy = async (layoutIdentity) => {
|
|
12431
|
-
return this.wire.environment.destroyLayout(__classPrivateFieldGet$
|
|
12457
|
+
return this.wire.environment.destroyLayout(__classPrivateFieldGet$8(this, _LayoutModule_instances, "m", _LayoutModule_getSafeLayoutManager).call(this, `fin.Platform.Layout.destroy()`), layoutIdentity);
|
|
12432
12458
|
};
|
|
12433
12459
|
}
|
|
12434
12460
|
/**
|
|
@@ -12569,10 +12595,10 @@ class LayoutModule extends base_1$8.Base {
|
|
|
12569
12595
|
}
|
|
12570
12596
|
Factory$2.LayoutModule = LayoutModule;
|
|
12571
12597
|
_LayoutModule_layoutInitializationAttempted = new WeakMap(), _LayoutModule_layoutManager = new WeakMap(), _LayoutModule_getLayoutManagerSpy = new WeakMap(), _LayoutModule_instances = new WeakSet(), _LayoutModule_getSafeLayoutManager = function _LayoutModule_getSafeLayoutManager(method) {
|
|
12572
|
-
if (!__classPrivateFieldGet$
|
|
12598
|
+
if (!__classPrivateFieldGet$8(this, _LayoutModule_layoutManager, "f")) {
|
|
12573
12599
|
throw new Error(`You must call init before using the API ${method}`);
|
|
12574
12600
|
}
|
|
12575
|
-
return __classPrivateFieldGet$
|
|
12601
|
+
return __classPrivateFieldGet$8(this, _LayoutModule_layoutManager, "f");
|
|
12576
12602
|
};
|
|
12577
12603
|
|
|
12578
12604
|
(function (exports) {
|
|
@@ -13537,13 +13563,13 @@ class PrivateChannelProvider {
|
|
|
13537
13563
|
}
|
|
13538
13564
|
PrivateChannelProvider$1.PrivateChannelProvider = PrivateChannelProvider;
|
|
13539
13565
|
|
|
13540
|
-
var __classPrivateFieldSet$
|
|
13566
|
+
var __classPrivateFieldSet$7 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
13541
13567
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
13542
13568
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
13543
13569
|
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");
|
|
13544
13570
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
13545
13571
|
};
|
|
13546
|
-
var __classPrivateFieldGet$
|
|
13572
|
+
var __classPrivateFieldGet$7 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
13547
13573
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13548
13574
|
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");
|
|
13549
13575
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -13734,12 +13760,12 @@ class InteropBroker extends base_1$6.Base {
|
|
|
13734
13760
|
_InteropBroker_contextGroups.set(this, void 0);
|
|
13735
13761
|
_InteropBroker_providerPromise.set(this, void 0);
|
|
13736
13762
|
this.getProvider = () => {
|
|
13737
|
-
return __classPrivateFieldGet$
|
|
13763
|
+
return __classPrivateFieldGet$7(this, _InteropBroker_providerPromise, "f").getValue();
|
|
13738
13764
|
};
|
|
13739
13765
|
this.interopClients = new Map();
|
|
13740
13766
|
this.contextGroupsById = new Map();
|
|
13741
|
-
__classPrivateFieldSet$
|
|
13742
|
-
__classPrivateFieldSet$
|
|
13767
|
+
__classPrivateFieldSet$7(this, _InteropBroker_contextGroups, options.contextGroups ?? [...defaultContextGroups], "f");
|
|
13768
|
+
__classPrivateFieldSet$7(this, _InteropBroker_fdc3Info, options.fdc3Info, "f");
|
|
13743
13769
|
if (options?.logging) {
|
|
13744
13770
|
this.logging = options.logging;
|
|
13745
13771
|
}
|
|
@@ -13747,7 +13773,7 @@ class InteropBroker extends base_1$6.Base {
|
|
|
13747
13773
|
this.lastContextMap = new Map();
|
|
13748
13774
|
this.sessionContextGroupMap = new Map();
|
|
13749
13775
|
this.privateChannelProviderMap = new Map();
|
|
13750
|
-
__classPrivateFieldSet$
|
|
13776
|
+
__classPrivateFieldSet$7(this, _InteropBroker_providerPromise, new lazy_1$1.Lazy(createProvider), "f");
|
|
13751
13777
|
this.setContextGroupMap();
|
|
13752
13778
|
this.setupChannelProvider();
|
|
13753
13779
|
}
|
|
@@ -13919,8 +13945,8 @@ class InteropBroker extends base_1$6.Base {
|
|
|
13919
13945
|
if (!this.getContextGroups().find((contextGroupInfo) => contextGroupInfo.id === contextGroupId)) {
|
|
13920
13946
|
throw new Error(`Attempting to join a context group that does not exist: ${contextGroupId}. You may only join existing context groups.`);
|
|
13921
13947
|
}
|
|
13922
|
-
const
|
|
13923
|
-
if (
|
|
13948
|
+
const previousContextGroupId = clientSubscriptionState.contextGroupId;
|
|
13949
|
+
if (previousContextGroupId !== contextGroupId) {
|
|
13924
13950
|
clientSubscriptionState.contextGroupId = contextGroupId;
|
|
13925
13951
|
await this.setCurrentContextGroupInClientOptions(clientIdentity, contextGroupId);
|
|
13926
13952
|
const contextGroupMap = this.contextGroupsById.get(contextGroupId);
|
|
@@ -13939,6 +13965,13 @@ class InteropBroker extends base_1$6.Base {
|
|
|
13939
13965
|
}
|
|
13940
13966
|
}
|
|
13941
13967
|
}
|
|
13968
|
+
// All settled will suppress uncaught exceptions. We don't want to await this because it could
|
|
13969
|
+
// result in the operation hanging.
|
|
13970
|
+
Promise.allSettled(this.channel.publish('client-changed-context-group', {
|
|
13971
|
+
identity: clientIdentity,
|
|
13972
|
+
contextGroupId,
|
|
13973
|
+
previousContextGroupId: previousContextGroupId || null
|
|
13974
|
+
}));
|
|
13942
13975
|
}
|
|
13943
13976
|
}
|
|
13944
13977
|
// Removes the target from its context group. Similar structure to joinContextGroup.
|
|
@@ -13998,10 +14031,18 @@ class InteropBroker extends base_1$6.Base {
|
|
|
13998
14031
|
// don't expose, analytics-only call
|
|
13999
14032
|
});
|
|
14000
14033
|
const clientState = this.getClientState(clientIdentity);
|
|
14034
|
+
const previousContextGroupId = clientState?.contextGroupId;
|
|
14001
14035
|
if (clientState) {
|
|
14002
14036
|
clientState.contextGroupId = undefined;
|
|
14003
14037
|
}
|
|
14004
14038
|
await this.setCurrentContextGroupInClientOptions(clientIdentity, null);
|
|
14039
|
+
// All settled will suppress uncaught exceptions. We don't want to await this because it could
|
|
14040
|
+
// result in the operation hanging.
|
|
14041
|
+
Promise.allSettled(this.channel.publish('client-changed-context-group', {
|
|
14042
|
+
identity: clientIdentity,
|
|
14043
|
+
contextGroupId: null,
|
|
14044
|
+
previousContextGroupId: previousContextGroupId || null
|
|
14045
|
+
}));
|
|
14005
14046
|
}
|
|
14006
14047
|
// Used by platform windows to know what client groups the provider has declared. Also used internally to access context groups. Overrideable so that the platform developer can modify it.
|
|
14007
14048
|
/**
|
|
@@ -14015,7 +14056,7 @@ class InteropBroker extends base_1$6.Base {
|
|
|
14015
14056
|
// don't expose, analytics-only call
|
|
14016
14057
|
});
|
|
14017
14058
|
// Create copy for immutability
|
|
14018
|
-
return __classPrivateFieldGet$
|
|
14059
|
+
return __classPrivateFieldGet$7(this, _InteropBroker_contextGroups, "f").map((contextGroup) => {
|
|
14019
14060
|
return { ...contextGroup };
|
|
14020
14061
|
});
|
|
14021
14062
|
}
|
|
@@ -14426,7 +14467,7 @@ class InteropBroker extends base_1$6.Base {
|
|
|
14426
14467
|
const { fdc3Version } = payload;
|
|
14427
14468
|
return {
|
|
14428
14469
|
fdc3Version,
|
|
14429
|
-
...__classPrivateFieldGet$
|
|
14470
|
+
...__classPrivateFieldGet$7(this, _InteropBroker_fdc3Info, "f"),
|
|
14430
14471
|
optionalFeatures: {
|
|
14431
14472
|
OriginatingAppMetadata: false,
|
|
14432
14473
|
UserChannelMembershipAPIs: true
|
|
@@ -14811,13 +14852,13 @@ var InteropClient$1 = {};
|
|
|
14811
14852
|
|
|
14812
14853
|
var SessionContextGroupClient$1 = {};
|
|
14813
14854
|
|
|
14814
|
-
var __classPrivateFieldSet$
|
|
14855
|
+
var __classPrivateFieldSet$6 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
14815
14856
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
14816
14857
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
14817
14858
|
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");
|
|
14818
14859
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
14819
14860
|
};
|
|
14820
|
-
var __classPrivateFieldGet$
|
|
14861
|
+
var __classPrivateFieldGet$6 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
14821
14862
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
14822
14863
|
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");
|
|
14823
14864
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -14831,7 +14872,7 @@ class SessionContextGroupClient extends base_1$5.Base {
|
|
|
14831
14872
|
super(wire);
|
|
14832
14873
|
_SessionContextGroupClient_clientPromise.set(this, void 0);
|
|
14833
14874
|
this.id = id;
|
|
14834
|
-
__classPrivateFieldSet$
|
|
14875
|
+
__classPrivateFieldSet$6(this, _SessionContextGroupClient_clientPromise, client, "f");
|
|
14835
14876
|
}
|
|
14836
14877
|
/**
|
|
14837
14878
|
* Sets a context for the session context group.
|
|
@@ -14843,7 +14884,7 @@ class SessionContextGroupClient extends base_1$5.Base {
|
|
|
14843
14884
|
this.wire.sendAction('interop-session-context-group-set-context').catch((e) => {
|
|
14844
14885
|
// don't expose, analytics-only call
|
|
14845
14886
|
});
|
|
14846
|
-
const client = await __classPrivateFieldGet$
|
|
14887
|
+
const client = await __classPrivateFieldGet$6(this, _SessionContextGroupClient_clientPromise, "f");
|
|
14847
14888
|
return client.dispatch(`sessionContextGroup:setContext-${this.id}`, {
|
|
14848
14889
|
sessionContextGroupId: this.id,
|
|
14849
14890
|
context
|
|
@@ -14853,7 +14894,7 @@ class SessionContextGroupClient extends base_1$5.Base {
|
|
|
14853
14894
|
this.wire.sendAction('interop-session-context-group-get-context').catch((e) => {
|
|
14854
14895
|
// don't expose, analytics-only call
|
|
14855
14896
|
});
|
|
14856
|
-
const client = await __classPrivateFieldGet$
|
|
14897
|
+
const client = await __classPrivateFieldGet$6(this, _SessionContextGroupClient_clientPromise, "f");
|
|
14857
14898
|
return client.dispatch(`sessionContextGroup:getContext-${this.id}`, {
|
|
14858
14899
|
sessionContextGroupId: this.id,
|
|
14859
14900
|
type
|
|
@@ -14866,7 +14907,7 @@ class SessionContextGroupClient extends base_1$5.Base {
|
|
|
14866
14907
|
if (typeof contextHandler !== 'function') {
|
|
14867
14908
|
throw new Error("Non-function argument passed to the first parameter 'handler'. Be aware that the argument order does not match the FDC3 standard.");
|
|
14868
14909
|
}
|
|
14869
|
-
const client = await __classPrivateFieldGet$
|
|
14910
|
+
const client = await __classPrivateFieldGet$6(this, _SessionContextGroupClient_clientPromise, "f");
|
|
14870
14911
|
let handlerId;
|
|
14871
14912
|
if (contextType) {
|
|
14872
14913
|
handlerId = `sessionContextHandler:invoke-${this.id}-${contextType}-${(0, utils_1$6.generateId)()}`;
|
|
@@ -14879,7 +14920,7 @@ class SessionContextGroupClient extends base_1$5.Base {
|
|
|
14879
14920
|
return { unsubscribe: await this.createUnsubscribeCb(handlerId) };
|
|
14880
14921
|
}
|
|
14881
14922
|
async createUnsubscribeCb(handlerId) {
|
|
14882
|
-
const client = await __classPrivateFieldGet$
|
|
14923
|
+
const client = await __classPrivateFieldGet$6(this, _SessionContextGroupClient_clientPromise, "f");
|
|
14883
14924
|
return async () => {
|
|
14884
14925
|
client.remove(handlerId);
|
|
14885
14926
|
await client.dispatch(`sessionContextGroup:handlerRemoved-${this.id}`, { handlerId });
|
|
@@ -14897,6 +14938,139 @@ class SessionContextGroupClient extends base_1$5.Base {
|
|
|
14897
14938
|
SessionContextGroupClient$1.default = SessionContextGroupClient;
|
|
14898
14939
|
_SessionContextGroupClient_clientPromise = new WeakMap();
|
|
14899
14940
|
|
|
14941
|
+
var channelEvents = {};
|
|
14942
|
+
|
|
14943
|
+
var __classPrivateFieldSet$5 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
14944
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
14945
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
14946
|
+
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");
|
|
14947
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
14948
|
+
};
|
|
14949
|
+
var __classPrivateFieldGet$5 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
14950
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
14951
|
+
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");
|
|
14952
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
14953
|
+
};
|
|
14954
|
+
var _a, _ChannelEvents_channelClient, _ChannelEvents_isChannelReady, _ChannelEvents_actionsByClient, _ChannelEvents_getActions, _ChannelEvents_createRegistration, _ChannelEvents_getRegistration, _ChannelEvents_getOrCreateRegistration;
|
|
14955
|
+
Object.defineProperty(channelEvents, "__esModule", { value: true });
|
|
14956
|
+
channelEvents.ChannelEvents = void 0;
|
|
14957
|
+
/**
|
|
14958
|
+
* Channel events creates a event like syntax out of a channel action, allowing multiple events to be triggered
|
|
14959
|
+
* from a single action (normally only one callback can be created per action).
|
|
14960
|
+
*
|
|
14961
|
+
* This Class essentially allows us to multiplex channel actions to multiple callbacks.
|
|
14962
|
+
*/
|
|
14963
|
+
class ChannelEvents {
|
|
14964
|
+
constructor(channelClient) {
|
|
14965
|
+
// eslint-disable-next-line
|
|
14966
|
+
_ChannelEvents_channelClient.set(this, void 0);
|
|
14967
|
+
_ChannelEvents_isChannelReady.set(this, false);
|
|
14968
|
+
_ChannelEvents_getActions.set(this, async () => {
|
|
14969
|
+
const channelClient = await __classPrivateFieldGet$5(this, _ChannelEvents_channelClient, "f");
|
|
14970
|
+
let actions = __classPrivateFieldGet$5(ChannelEvents, _a, "f", _ChannelEvents_actionsByClient).get(channelClient);
|
|
14971
|
+
if (!actions) {
|
|
14972
|
+
actions = {};
|
|
14973
|
+
__classPrivateFieldGet$5(ChannelEvents, _a, "f", _ChannelEvents_actionsByClient).set(channelClient, actions);
|
|
14974
|
+
}
|
|
14975
|
+
return actions;
|
|
14976
|
+
});
|
|
14977
|
+
_ChannelEvents_createRegistration.set(this, (actionId) => {
|
|
14978
|
+
const callbacks = [];
|
|
14979
|
+
let registrationPromise;
|
|
14980
|
+
const onChannelAction = (data) => {
|
|
14981
|
+
callbacks.forEach((callback) => callback(data));
|
|
14982
|
+
};
|
|
14983
|
+
return {
|
|
14984
|
+
callbacks,
|
|
14985
|
+
dispose: async (callback) => {
|
|
14986
|
+
const index = callbacks.indexOf(callback);
|
|
14987
|
+
if (index >= 0) {
|
|
14988
|
+
callbacks.splice(index, 1);
|
|
14989
|
+
if (callbacks.length === 0) {
|
|
14990
|
+
const client = await __classPrivateFieldGet$5(this, _ChannelEvents_channelClient, "f");
|
|
14991
|
+
client.remove(actionId);
|
|
14992
|
+
}
|
|
14993
|
+
}
|
|
14994
|
+
},
|
|
14995
|
+
waitForRegistration: async () => {
|
|
14996
|
+
// Use lazy eval to only setup and register the channel on first attempt.
|
|
14997
|
+
if (!registrationPromise) {
|
|
14998
|
+
registrationPromise = (async () => {
|
|
14999
|
+
const client = await __classPrivateFieldGet$5(this, _ChannelEvents_channelClient, "f");
|
|
15000
|
+
await client.register(actionId, onChannelAction);
|
|
15001
|
+
})();
|
|
15002
|
+
}
|
|
15003
|
+
await registrationPromise;
|
|
15004
|
+
}
|
|
15005
|
+
};
|
|
15006
|
+
});
|
|
15007
|
+
_ChannelEvents_getRegistration.set(this, async (actionId) => {
|
|
15008
|
+
const actions = await __classPrivateFieldGet$5(this, _ChannelEvents_getActions, "f").call(this);
|
|
15009
|
+
return actions[actionId];
|
|
15010
|
+
});
|
|
15011
|
+
_ChannelEvents_getOrCreateRegistration.set(this, async (actionId) => {
|
|
15012
|
+
const actions = await __classPrivateFieldGet$5(this, _ChannelEvents_getActions, "f").call(this);
|
|
15013
|
+
const registration = await __classPrivateFieldGet$5(this, _ChannelEvents_getRegistration, "f").call(this, actionId);
|
|
15014
|
+
if (!registration) {
|
|
15015
|
+
actions[actionId] = __classPrivateFieldGet$5(this, _ChannelEvents_createRegistration, "f").call(this, actionId);
|
|
15016
|
+
}
|
|
15017
|
+
return actions[actionId];
|
|
15018
|
+
});
|
|
15019
|
+
/**
|
|
15020
|
+
* Add a listener for the given channel action.
|
|
15021
|
+
*
|
|
15022
|
+
* This will register a handler for the specified channel action if this is the first time we have requested one, or reuse an existing one if it exists.
|
|
15023
|
+
*
|
|
15024
|
+
* Note, only void channel actions are currently supported.
|
|
15025
|
+
*
|
|
15026
|
+
* @param action Action ID, must match the underlying channel action.
|
|
15027
|
+
* @param callback Callback to be called whenever the action is dispatched.
|
|
15028
|
+
*/
|
|
15029
|
+
this.addListener = async (action, callback) => {
|
|
15030
|
+
const event = await __classPrivateFieldGet$5(this, _ChannelEvents_getOrCreateRegistration, "f").call(this, action);
|
|
15031
|
+
event.callbacks.push(callback);
|
|
15032
|
+
// This ensures we only resolve the subscription once the action is registered
|
|
15033
|
+
await event.waitForRegistration();
|
|
15034
|
+
};
|
|
15035
|
+
/**
|
|
15036
|
+
* Removes a callback associated with a given action if it exists.
|
|
15037
|
+
*
|
|
15038
|
+
* If this callback is the last one associated with the specified action, the underlying channel action registration is
|
|
15039
|
+
* also removed.
|
|
15040
|
+
* @param action Action ID to remove
|
|
15041
|
+
* @param callback Callback to remove.
|
|
15042
|
+
*/
|
|
15043
|
+
this.removeListener = async (action, callback) => {
|
|
15044
|
+
if (!__classPrivateFieldGet$5(this, _ChannelEvents_isChannelReady, "f")) {
|
|
15045
|
+
return;
|
|
15046
|
+
}
|
|
15047
|
+
const registration = await __classPrivateFieldGet$5(this, _ChannelEvents_getRegistration, "f").call(this, action);
|
|
15048
|
+
if (registration) {
|
|
15049
|
+
const event = await __classPrivateFieldGet$5(this, _ChannelEvents_getOrCreateRegistration, "f").call(this, action);
|
|
15050
|
+
await event.dispose(callback);
|
|
15051
|
+
}
|
|
15052
|
+
};
|
|
15053
|
+
__classPrivateFieldSet$5(this, _ChannelEvents_channelClient, channelClient, "f");
|
|
15054
|
+
Promise.resolve(channelClient)
|
|
15055
|
+
.then(() => {
|
|
15056
|
+
__classPrivateFieldSet$5(this, _ChannelEvents_isChannelReady, true, "f");
|
|
15057
|
+
})
|
|
15058
|
+
.catch(() => {
|
|
15059
|
+
// eslint-disable-next-line
|
|
15060
|
+
console.warn('Channel Connection error occurred in channel client. Channel-events registrations will fail.');
|
|
15061
|
+
});
|
|
15062
|
+
}
|
|
15063
|
+
}
|
|
15064
|
+
channelEvents.ChannelEvents = ChannelEvents;
|
|
15065
|
+
_a = ChannelEvents, _ChannelEvents_channelClient = new WeakMap(), _ChannelEvents_isChannelReady = new WeakMap(), _ChannelEvents_getActions = new WeakMap(), _ChannelEvents_createRegistration = new WeakMap(), _ChannelEvents_getRegistration = new WeakMap(), _ChannelEvents_getOrCreateRegistration = new WeakMap();
|
|
15066
|
+
/**
|
|
15067
|
+
* Static map of actions by channel client. This ensures we can reuse the same event and keep track of all its callbacks.
|
|
15068
|
+
*
|
|
15069
|
+
* Weak map will also ensure that when a channel is GC'ed we also tear down the actions/callbacks associated
|
|
15070
|
+
* with it.
|
|
15071
|
+
*/
|
|
15072
|
+
_ChannelEvents_actionsByClient = { value: new WeakMap() };
|
|
15073
|
+
|
|
14900
15074
|
var __classPrivateFieldSet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
14901
15075
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
14902
15076
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
@@ -14911,12 +15085,13 @@ var __classPrivateFieldGet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateF
|
|
|
14911
15085
|
var __importDefault$4 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
14912
15086
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14913
15087
|
};
|
|
14914
|
-
var _InteropClient_clientPromise, _InteropClient_sessionContextGroups, _InteropClient_fdc3Factory;
|
|
15088
|
+
var _InteropClient_clientPromise, _InteropClient_sessionContextGroups, _InteropClient_fdc3Factory, _InteropClient_channelEvents;
|
|
14915
15089
|
Object.defineProperty(InteropClient$1, "__esModule", { value: true });
|
|
14916
15090
|
InteropClient$1.InteropClient = void 0;
|
|
14917
15091
|
const base_1$4 = base;
|
|
14918
15092
|
const SessionContextGroupClient_1 = __importDefault$4(SessionContextGroupClient$1);
|
|
14919
15093
|
const utils_1$5 = utils$3;
|
|
15094
|
+
const channel_events_1 = channelEvents;
|
|
14920
15095
|
/**
|
|
14921
15096
|
* The Interop Client API is broken up into two groups:
|
|
14922
15097
|
*
|
|
@@ -14975,13 +15150,43 @@ class InteropClient extends base_1$4.Base {
|
|
|
14975
15150
|
_InteropClient_clientPromise.set(this, void 0);
|
|
14976
15151
|
_InteropClient_sessionContextGroups.set(this, void 0);
|
|
14977
15152
|
_InteropClient_fdc3Factory.set(this, void 0);
|
|
15153
|
+
_InteropClient_channelEvents.set(this, void 0);
|
|
15154
|
+
/*
|
|
15155
|
+
Client APIs
|
|
15156
|
+
*/
|
|
15157
|
+
/**
|
|
15158
|
+
* `addListener` allows the InteropClient to subscribe to events emitted by the connected InteropBroker.
|
|
15159
|
+
* @param type The event type to subscribe to.
|
|
15160
|
+
* @param listener Callback invoked whenever the event occurs.
|
|
15161
|
+
* @returns Promise resolving with void once the listener is registered.
|
|
15162
|
+
*/
|
|
15163
|
+
this.addListener = async (type, listener) => {
|
|
15164
|
+
try {
|
|
15165
|
+
await __classPrivateFieldGet$4(this, _InteropClient_channelEvents, "f").addListener(type, listener);
|
|
15166
|
+
}
|
|
15167
|
+
catch (error) {
|
|
15168
|
+
throw new Error(`An unexpected error occurred when adding a listener to the event ${type}. \n${error.stack}.`);
|
|
15169
|
+
}
|
|
15170
|
+
};
|
|
15171
|
+
/**
|
|
15172
|
+
* `removeListener` removes a registered event listener.
|
|
15173
|
+
* @param type The event type to subscribe to.
|
|
15174
|
+
* @param listener Callback to be removed.
|
|
15175
|
+
* @returns Promise resolving with void even if no callback was found.
|
|
15176
|
+
*/
|
|
15177
|
+
this.removeListener = async (type, listener) => {
|
|
15178
|
+
try {
|
|
15179
|
+
await __classPrivateFieldGet$4(this, _InteropClient_channelEvents, "f").removeListener(type, listener);
|
|
15180
|
+
}
|
|
15181
|
+
catch (error) {
|
|
15182
|
+
throw new Error(`An unexpected error occurred when removing a listener for the event ${type}. \n${error.stack}.`);
|
|
15183
|
+
}
|
|
15184
|
+
};
|
|
14978
15185
|
__classPrivateFieldSet$4(this, _InteropClient_sessionContextGroups, new Map(), "f");
|
|
14979
15186
|
__classPrivateFieldSet$4(this, _InteropClient_clientPromise, clientPromise, "f");
|
|
14980
15187
|
__classPrivateFieldSet$4(this, _InteropClient_fdc3Factory, fdc3Factory, "f");
|
|
15188
|
+
__classPrivateFieldSet$4(this, _InteropClient_channelEvents, new channel_events_1.ChannelEvents(clientPromise), "f");
|
|
14981
15189
|
}
|
|
14982
|
-
/*
|
|
14983
|
-
Client APIs
|
|
14984
|
-
*/
|
|
14985
15190
|
/**
|
|
14986
15191
|
* Sets a context for the context group of the current entity.
|
|
14987
15192
|
*
|
|
@@ -15495,7 +15700,7 @@ class InteropClient extends base_1$4.Base {
|
|
|
15495
15700
|
}
|
|
15496
15701
|
}
|
|
15497
15702
|
InteropClient$1.InteropClient = InteropClient;
|
|
15498
|
-
_InteropClient_clientPromise = new WeakMap(), _InteropClient_sessionContextGroups = new WeakMap(), _InteropClient_fdc3Factory = new WeakMap();
|
|
15703
|
+
_InteropClient_clientPromise = new WeakMap(), _InteropClient_sessionContextGroups = new WeakMap(), _InteropClient_fdc3Factory = new WeakMap(), _InteropClient_channelEvents = new WeakMap();
|
|
15499
15704
|
|
|
15500
15705
|
var overrideCheck$1 = {};
|
|
15501
15706
|
|
|
@@ -17375,7 +17580,7 @@ const events_1$3 = require$$0;
|
|
|
17375
17580
|
// Import from the file rather than the directory in case someone consuming types is using module resolution other than "node"
|
|
17376
17581
|
const index_1 = system;
|
|
17377
17582
|
const index_2 = requireWindow();
|
|
17378
|
-
const index_3 =
|
|
17583
|
+
const index_3 = requireApplication();
|
|
17379
17584
|
const index_4 = interappbus;
|
|
17380
17585
|
const index_5 = clipboard;
|
|
17381
17586
|
const index_6 = externalApplication;
|
|
@@ -18189,7 +18394,7 @@ class NodeEnvironment extends BaseEnvironment_1 {
|
|
|
18189
18394
|
};
|
|
18190
18395
|
}
|
|
18191
18396
|
getAdapterVersionSync() {
|
|
18192
|
-
return "
|
|
18397
|
+
return "45.100.18";
|
|
18193
18398
|
}
|
|
18194
18399
|
observeBounds(element, onChange) {
|
|
18195
18400
|
throw new Error('Method not implemented.');
|