@openfin/node-adapter 41.103.2 → 41.103.10
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-alpha.d.ts +1 -0
- package/out/node-adapter-beta.d.ts +1 -0
- package/out/node-adapter-public.d.ts +1 -0
- package/out/node-adapter.d.ts +1 -0
- package/out/node-adapter.js +1320 -1435
- package/package.json +34 -29
- package/resources/darwin/OpenFinRVM.app/Contents/CodeResources +0 -0
- package/resources/darwin/OpenFinRVM.app/Contents/Info.plist +2 -2
- package/resources/darwin/OpenFinRVM.app/Contents/MacOS/OpenFinRVM +0 -0
- package/resources/win/x64/OpenFinRVM.exe +0 -0
- package/resources/win/x86/OpenFinRVM.exe +0 -0
package/out/node-adapter.js
CHANGED
|
@@ -44,35 +44,6 @@ var system = {};
|
|
|
44
44
|
|
|
45
45
|
var base = {};
|
|
46
46
|
|
|
47
|
-
var promises = {};
|
|
48
|
-
|
|
49
|
-
Object.defineProperty(promises, "__esModule", { value: true });
|
|
50
|
-
promises.promiseMapSerial = promises.serial = promiseMap_1 = promises.promiseMap = promisify_1 = promises.promisify = void 0;
|
|
51
|
-
function promisify(func) {
|
|
52
|
-
return (...args) => new Promise((resolve, reject) => {
|
|
53
|
-
func(...args, (err, val) => (err ? reject(err) : resolve(val)));
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
var promisify_1 = promises.promisify = promisify;
|
|
57
|
-
async function promiseMap(arr, asyncF) {
|
|
58
|
-
return Promise.all(arr.map(asyncF));
|
|
59
|
-
}
|
|
60
|
-
var promiseMap_1 = promises.promiseMap = promiseMap;
|
|
61
|
-
async function serial(arr) {
|
|
62
|
-
const ret = [];
|
|
63
|
-
for (const func of arr) {
|
|
64
|
-
// eslint-disable-next-line no-await-in-loop
|
|
65
|
-
const next = await func();
|
|
66
|
-
ret.push(next);
|
|
67
|
-
}
|
|
68
|
-
return ret;
|
|
69
|
-
}
|
|
70
|
-
promises.serial = serial;
|
|
71
|
-
async function promiseMapSerial(arr, func) {
|
|
72
|
-
return serial(arr.map((value, index, array) => () => func(value, index, array)));
|
|
73
|
-
}
|
|
74
|
-
promises.promiseMapSerial = promiseMapSerial;
|
|
75
|
-
|
|
76
47
|
var __classPrivateFieldSet$h = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
77
48
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
78
49
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
@@ -87,7 +58,6 @@ var __classPrivateFieldGet$i = (commonjsGlobal && commonjsGlobal.__classPrivateF
|
|
|
87
58
|
var _EmitterBase_emitterAccessor, _EmitterBase_deregisterOnceListeners;
|
|
88
59
|
Object.defineProperty(base, "__esModule", { value: true });
|
|
89
60
|
base.Reply = base.EmitterBase = base.Base = void 0;
|
|
90
|
-
const promises_1 = promises;
|
|
91
61
|
class Base {
|
|
92
62
|
/**
|
|
93
63
|
* @internal
|
|
@@ -165,27 +135,8 @@ class EmitterBase extends Base {
|
|
|
165
135
|
return this.hasEmitter() ? this.getOrCreateEmitter().emit(eventType, payload, ...args) : false;
|
|
166
136
|
};
|
|
167
137
|
this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
|
|
168
|
-
/**
|
|
169
|
-
* Cleans up after removal of a listener, e.g. deleting any lingering deregistration handlers for a
|
|
170
|
-
* `once` subscription.
|
|
171
|
-
*
|
|
172
|
-
* @remarks Implementing this as a `removeListener` handler ensures that direct removal of a listener
|
|
173
|
-
* on the base emitter will not leak additional core handlers. We could do this in the forwarding method,
|
|
174
|
-
* which would involve less "magic," but would be more-vulnerable to accidental re-introduction of a leak.
|
|
175
|
-
*/
|
|
176
|
-
this.cleanUpRemovedListener = (eventType, listener) => {
|
|
177
|
-
const deregister = __classPrivateFieldGet$i(this, _EmitterBase_deregisterOnceListeners, "f").get(listener);
|
|
178
|
-
if (deregister) {
|
|
179
|
-
const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
|
|
180
|
-
emitter.removeListener(eventType, deregister);
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
138
|
this.getOrCreateEmitter = () => {
|
|
184
|
-
|
|
185
|
-
if (!emitter.listeners('removeListener').includes(this.cleanUpRemovedListener)) {
|
|
186
|
-
emitter.on('removeListener', this.cleanUpRemovedListener);
|
|
187
|
-
}
|
|
188
|
-
return emitter;
|
|
139
|
+
return this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
|
|
189
140
|
};
|
|
190
141
|
this.listeners = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(type) : [];
|
|
191
142
|
this.listenerCount = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listenerCount(type) : 0;
|
|
@@ -225,7 +176,6 @@ class EmitterBase extends Base {
|
|
|
225
176
|
};
|
|
226
177
|
__classPrivateFieldSet$h(this, _EmitterBase_emitterAccessor, [topic, ...additionalAccessors], "f");
|
|
227
178
|
__classPrivateFieldSet$h(this, _EmitterBase_deregisterOnceListeners, new WeakMap(), "f");
|
|
228
|
-
this.listeners = (event) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(event) : [];
|
|
229
179
|
}
|
|
230
180
|
/**
|
|
231
181
|
* Adds a listener to the end of the listeners array for the specified event.
|
|
@@ -303,6 +253,10 @@ class EmitterBase extends Base {
|
|
|
303
253
|
const emitter = await this.deregisterEventListener(eventType, options);
|
|
304
254
|
if (emitter) {
|
|
305
255
|
emitter.removeListener(eventType, listener);
|
|
256
|
+
const deregister = __classPrivateFieldGet$i(this, _EmitterBase_deregisterOnceListeners, "f").get(listener);
|
|
257
|
+
if (deregister) {
|
|
258
|
+
emitter.removeListener(eventType, deregister);
|
|
259
|
+
}
|
|
306
260
|
this.deleteEmitterIfNothingRegistered(emitter);
|
|
307
261
|
}
|
|
308
262
|
return this;
|
|
@@ -338,12 +292,13 @@ class EmitterBase extends Base {
|
|
|
338
292
|
}
|
|
339
293
|
else if (this.hasEmitter()) {
|
|
340
294
|
const events = this.getOrCreateEmitter().eventNames();
|
|
341
|
-
await (
|
|
295
|
+
await Promise.all(events.map(removeByEvent));
|
|
342
296
|
}
|
|
343
297
|
return this;
|
|
344
298
|
}
|
|
345
299
|
deleteEmitterIfNothingRegistered(emitter) {
|
|
346
|
-
|
|
300
|
+
// TODO: maybe emitterMap should clean up itself..
|
|
301
|
+
if (emitter.eventNames().length === 0) {
|
|
347
302
|
this.wire.eventAggregator.delete(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
|
|
348
303
|
}
|
|
349
304
|
}
|
|
@@ -576,11 +531,11 @@ const handleDeprecatedWarnings = (options) => {
|
|
|
576
531
|
};
|
|
577
532
|
warnings.handleDeprecatedWarnings = handleDeprecatedWarnings;
|
|
578
533
|
|
|
579
|
-
var hasRequiredFactory$
|
|
534
|
+
var hasRequiredFactory$2;
|
|
580
535
|
|
|
581
|
-
function requireFactory$
|
|
582
|
-
if (hasRequiredFactory$
|
|
583
|
-
hasRequiredFactory$
|
|
536
|
+
function requireFactory$2 () {
|
|
537
|
+
if (hasRequiredFactory$2) return Factory$6;
|
|
538
|
+
hasRequiredFactory$2 = 1;
|
|
584
539
|
Object.defineProperty(Factory$6, "__esModule", { value: true });
|
|
585
540
|
Factory$6.ViewModule = void 0;
|
|
586
541
|
const base_1 = base;
|
|
@@ -652,9 +607,7 @@ function requireFactory$1 () {
|
|
|
652
607
|
* @experimental
|
|
653
608
|
*/
|
|
654
609
|
async wrap(identity) {
|
|
655
|
-
this.wire.
|
|
656
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
657
|
-
});
|
|
610
|
+
this.wire.recordAnalytic('view-wrap');
|
|
658
611
|
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
|
659
612
|
if (errorMsg) {
|
|
660
613
|
throw new Error(errorMsg);
|
|
@@ -676,9 +629,7 @@ function requireFactory$1 () {
|
|
|
676
629
|
* @experimental
|
|
677
630
|
*/
|
|
678
631
|
wrapSync(identity) {
|
|
679
|
-
this.wire.
|
|
680
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
681
|
-
});
|
|
632
|
+
this.wire.recordAnalytic('view-wrap-sync');
|
|
682
633
|
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
|
683
634
|
if (errorMsg) {
|
|
684
635
|
throw new Error(errorMsg);
|
|
@@ -698,9 +649,7 @@ function requireFactory$1 () {
|
|
|
698
649
|
* @experimental
|
|
699
650
|
*/
|
|
700
651
|
getCurrent() {
|
|
701
|
-
this.wire.
|
|
702
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
703
|
-
});
|
|
652
|
+
this.wire.recordAnalytic('view-get-current');
|
|
704
653
|
if (!this.wire.me.isView) {
|
|
705
654
|
throw new Error('You are not in a View context');
|
|
706
655
|
}
|
|
@@ -719,9 +668,7 @@ function requireFactory$1 () {
|
|
|
719
668
|
* @experimental
|
|
720
669
|
*/
|
|
721
670
|
getCurrentSync() {
|
|
722
|
-
this.wire.
|
|
723
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
724
|
-
});
|
|
671
|
+
this.wire.recordAnalytic('view-get-current-sync');
|
|
725
672
|
if (!this.wire.me.isView) {
|
|
726
673
|
throw new Error('You are not in a View context');
|
|
727
674
|
}
|
|
@@ -795,8 +742,8 @@ var main = {};
|
|
|
795
742
|
|
|
796
743
|
Object.defineProperty(main, "__esModule", { value: true });
|
|
797
744
|
main.WebContents = void 0;
|
|
798
|
-
const base_1$
|
|
799
|
-
class WebContents extends base_1$
|
|
745
|
+
const base_1$m = base;
|
|
746
|
+
class WebContents extends base_1$m.EmitterBase {
|
|
800
747
|
/**
|
|
801
748
|
* @param identity The identity of the {@link OpenFin.WebContentsEvents WebContents}.
|
|
802
749
|
* @param entityType The type of the {@link OpenFin.WebContentsEvents WebContents}.
|
|
@@ -1789,9 +1736,7 @@ class WebContents extends base_1$o.EmitterBase {
|
|
|
1789
1736
|
* {@link OpenFin.WebContentsEvents event namespace}.
|
|
1790
1737
|
*/
|
|
1791
1738
|
async showPopupWindow(options) {
|
|
1792
|
-
this.wire.
|
|
1793
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
1794
|
-
});
|
|
1739
|
+
this.wire.recordAnalytic(`${this.entityType}-show-popup-window`);
|
|
1795
1740
|
if (options?.onPopupReady) {
|
|
1796
1741
|
const readyListener = async ({ popupName }) => {
|
|
1797
1742
|
try {
|
|
@@ -1877,11 +1822,11 @@ class WebContents extends base_1$o.EmitterBase {
|
|
|
1877
1822
|
}
|
|
1878
1823
|
main.WebContents = WebContents;
|
|
1879
1824
|
|
|
1880
|
-
var hasRequiredInstance$
|
|
1825
|
+
var hasRequiredInstance$2;
|
|
1881
1826
|
|
|
1882
|
-
function requireInstance$
|
|
1883
|
-
if (hasRequiredInstance$
|
|
1884
|
-
hasRequiredInstance$
|
|
1827
|
+
function requireInstance$2 () {
|
|
1828
|
+
if (hasRequiredInstance$2) return Instance$5;
|
|
1829
|
+
hasRequiredInstance$2 = 1;
|
|
1885
1830
|
var _View_providerChannelClient;
|
|
1886
1831
|
Object.defineProperty(Instance$5, "__esModule", { value: true });
|
|
1887
1832
|
Instance$5.View = void 0;
|
|
@@ -2217,9 +2162,7 @@ function requireInstance$1 () {
|
|
|
2217
2162
|
* @experimental
|
|
2218
2163
|
*/
|
|
2219
2164
|
this.getParentLayout = async () => {
|
|
2220
|
-
this.wire.
|
|
2221
|
-
// don't expose
|
|
2222
|
-
});
|
|
2165
|
+
this.wire.recordAnalytic('view-get-parent-layout');
|
|
2223
2166
|
return this.fin.Platform.Layout.getLayoutByViewIdentity(this.identity);
|
|
2224
2167
|
};
|
|
2225
2168
|
/**
|
|
@@ -2332,9 +2275,7 @@ function requireInstance$1 () {
|
|
|
2332
2275
|
* ```
|
|
2333
2276
|
*/
|
|
2334
2277
|
this.getCurrentStack = async () => {
|
|
2335
|
-
this.wire.
|
|
2336
|
-
// don't expose
|
|
2337
|
-
});
|
|
2278
|
+
this.wire.recordAnalytic('view-get-current-stack');
|
|
2338
2279
|
try {
|
|
2339
2280
|
const layout = await this.getParentLayout();
|
|
2340
2281
|
return layout.getStackByViewIdentity(this.identity);
|
|
@@ -2461,1139 +2402,1138 @@ function requireView () {
|
|
|
2461
2402
|
*
|
|
2462
2403
|
* @packageDocumentation
|
|
2463
2404
|
*/
|
|
2464
|
-
__exportStar(requireFactory$
|
|
2465
|
-
__exportStar(requireInstance$
|
|
2405
|
+
__exportStar(requireFactory$2(), exports);
|
|
2406
|
+
__exportStar(requireInstance$2(), exports);
|
|
2466
2407
|
} (view));
|
|
2467
2408
|
return view;
|
|
2468
2409
|
}
|
|
2469
2410
|
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
2411
|
+
var hasRequiredInstance$1;
|
|
2412
|
+
|
|
2413
|
+
function requireInstance$1 () {
|
|
2414
|
+
if (hasRequiredInstance$1) return Instance$6;
|
|
2415
|
+
hasRequiredInstance$1 = 1;
|
|
2416
|
+
Object.defineProperty(Instance$6, "__esModule", { value: true });
|
|
2417
|
+
Instance$6.Application = void 0;
|
|
2418
|
+
/* eslint-disable import/prefer-default-export */
|
|
2419
|
+
const base_1 = base;
|
|
2420
|
+
const window_1 = requireWindow();
|
|
2421
|
+
const view_1 = requireView();
|
|
2422
|
+
/**
|
|
2423
|
+
* An object representing an application. Allows the developer to create,
|
|
2424
|
+
* execute, show/close an application as well as listen to {@link OpenFin.ApplicationEvents application events}.
|
|
2425
|
+
*/
|
|
2426
|
+
class Application extends base_1.EmitterBase {
|
|
2427
|
+
/**
|
|
2428
|
+
* @internal
|
|
2429
|
+
*/
|
|
2430
|
+
constructor(wire, identity) {
|
|
2431
|
+
super(wire, 'application', identity.uuid);
|
|
2432
|
+
this.identity = identity;
|
|
2433
|
+
this.window = new window_1._Window(this.wire, {
|
|
2434
|
+
uuid: this.identity.uuid,
|
|
2435
|
+
name: this.identity.uuid
|
|
2436
|
+
});
|
|
2437
|
+
}
|
|
2438
|
+
windowListFromIdentityList(identityList) {
|
|
2439
|
+
const windowList = [];
|
|
2440
|
+
identityList.forEach((identity) => {
|
|
2441
|
+
windowList.push(new window_1._Window(this.wire, {
|
|
2442
|
+
uuid: identity.uuid,
|
|
2443
|
+
name: identity.name
|
|
2444
|
+
}));
|
|
2445
|
+
});
|
|
2446
|
+
return windowList;
|
|
2447
|
+
}
|
|
2448
|
+
/**
|
|
2449
|
+
* Determines if the application is currently running.
|
|
2450
|
+
*
|
|
2451
|
+
* @example
|
|
2452
|
+
*
|
|
2453
|
+
* ```js
|
|
2454
|
+
* async function isAppRunning() {
|
|
2455
|
+
* const app = await fin.Application.getCurrent();
|
|
2456
|
+
* return await app.isRunning();
|
|
2457
|
+
* }
|
|
2458
|
+
* isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
|
|
2459
|
+
* ```
|
|
2460
|
+
*/
|
|
2461
|
+
isRunning() {
|
|
2462
|
+
return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
|
|
2463
|
+
}
|
|
2464
|
+
/**
|
|
2465
|
+
* Closes the application and any child windows created by the application.
|
|
2466
|
+
* Cleans the application from state so it is no longer found in getAllApplications.
|
|
2467
|
+
* @param force Close will be prevented from closing when force is false and
|
|
2468
|
+
* ‘close-requested’ has been subscribed to for application’s main window.
|
|
2469
|
+
*
|
|
2470
|
+
* @example
|
|
2471
|
+
*
|
|
2472
|
+
* ```js
|
|
2473
|
+
* async function closeApp() {
|
|
2474
|
+
* const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
|
|
2475
|
+
* const app = await fin.Application.wrap({uuid: 'app2'});
|
|
2476
|
+
* await app.quit();
|
|
2477
|
+
* const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]
|
|
2478
|
+
*
|
|
2479
|
+
* }
|
|
2480
|
+
* closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
|
|
2481
|
+
* ```
|
|
2482
|
+
*/
|
|
2483
|
+
async quit(force = false) {
|
|
2484
|
+
try {
|
|
2485
|
+
await this._close(force);
|
|
2486
|
+
await this.wire.sendAction('destroy-application', { force, ...this.identity });
|
|
2487
|
+
}
|
|
2488
|
+
catch (error) {
|
|
2489
|
+
const acceptableErrors = ['Remote connection has closed', 'Could not locate the requested application'];
|
|
2490
|
+
if (!acceptableErrors.some((msg) => error.message.includes(msg))) {
|
|
2491
|
+
throw error;
|
|
2492
|
+
}
|
|
2493
|
+
}
|
|
2494
|
+
}
|
|
2495
|
+
async _close(force = false) {
|
|
2496
|
+
try {
|
|
2497
|
+
await this.wire.sendAction('close-application', { force, ...this.identity });
|
|
2498
|
+
}
|
|
2499
|
+
catch (error) {
|
|
2500
|
+
if (!error.message.includes('Remote connection has closed')) {
|
|
2501
|
+
throw error;
|
|
2502
|
+
}
|
|
2503
|
+
}
|
|
2504
|
+
}
|
|
2505
|
+
/**
|
|
2506
|
+
* @deprecated use Application.quit instead
|
|
2507
|
+
* Closes the application and any child windows created by the application.
|
|
2508
|
+
* @param force - Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.
|
|
2509
|
+
* @param callback - called if the method succeeds.
|
|
2510
|
+
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
|
2511
|
+
*
|
|
2512
|
+
* @example
|
|
2513
|
+
*
|
|
2514
|
+
* ```js
|
|
2515
|
+
* async function closeApp() {
|
|
2516
|
+
* const app = await fin.Application.getCurrent();
|
|
2517
|
+
* return await app.close();
|
|
2518
|
+
* }
|
|
2519
|
+
* closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
|
|
2520
|
+
* ```
|
|
2521
|
+
*/
|
|
2522
|
+
close(force = false) {
|
|
2523
|
+
console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
|
|
2524
|
+
this.wire.recordAnalytic('application-close');
|
|
2525
|
+
return this._close(force);
|
|
2526
|
+
}
|
|
2527
|
+
/**
|
|
2528
|
+
* Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
|
|
2529
|
+
*
|
|
2530
|
+
* @example
|
|
2531
|
+
*
|
|
2532
|
+
* ```js
|
|
2533
|
+
* async function getChildWindows() {
|
|
2534
|
+
* const app = await fin.Application.getCurrent();
|
|
2535
|
+
* return await app.getChildWindows();
|
|
2536
|
+
* }
|
|
2537
|
+
*
|
|
2538
|
+
* getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
|
|
2539
|
+
* ```
|
|
2540
|
+
*/
|
|
2541
|
+
getChildWindows() {
|
|
2542
|
+
return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
|
|
2543
|
+
const identityList = [];
|
|
2544
|
+
payload.data.forEach((winName) => {
|
|
2545
|
+
identityList.push({ uuid: this.identity.uuid, name: winName });
|
|
2546
|
+
});
|
|
2547
|
+
return this.windowListFromIdentityList(identityList);
|
|
2548
|
+
});
|
|
2549
|
+
}
|
|
2550
|
+
/**
|
|
2551
|
+
* Retrieves the JSON manifest that was used to create the application. Invokes the error callback
|
|
2552
|
+
* if the application was not created from a manifest.
|
|
2553
|
+
*
|
|
2554
|
+
* @example
|
|
2555
|
+
*
|
|
2556
|
+
* ```js
|
|
2557
|
+
* async function getManifest() {
|
|
2558
|
+
* const app = await fin.Application.getCurrent();
|
|
2559
|
+
* return await app.getManifest();
|
|
2560
|
+
* }
|
|
2561
|
+
*
|
|
2562
|
+
* getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
|
|
2563
|
+
* ```
|
|
2564
|
+
*/
|
|
2565
|
+
getManifest() {
|
|
2566
|
+
return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
|
|
2567
|
+
}
|
|
2568
|
+
/**
|
|
2569
|
+
* Retrieves UUID of the application that launches this application. Invokes the error callback
|
|
2570
|
+
* if the application was created from a manifest.
|
|
2571
|
+
*
|
|
2572
|
+
* @example
|
|
2573
|
+
*
|
|
2574
|
+
* ```js
|
|
2575
|
+
* async function getParentUuid() {
|
|
2576
|
+
* const app = await fin.Application.start({
|
|
2577
|
+
* uuid: 'app-1',
|
|
2578
|
+
* name: 'myApp',
|
|
2579
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
|
|
2580
|
+
* autoShow: true
|
|
2581
|
+
* });
|
|
2582
|
+
* return await app.getParentUuid();
|
|
2583
|
+
* }
|
|
2584
|
+
*
|
|
2585
|
+
* getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
|
|
2586
|
+
* ```
|
|
2587
|
+
*/
|
|
2588
|
+
getParentUuid() {
|
|
2589
|
+
return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
|
|
2590
|
+
}
|
|
2591
|
+
/**
|
|
2592
|
+
* Retrieves current application's shortcut configuration.
|
|
2593
|
+
*
|
|
2594
|
+
* @example
|
|
2595
|
+
*
|
|
2596
|
+
* ```js
|
|
2597
|
+
* async function getShortcuts() {
|
|
2598
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
|
2599
|
+
* return await app.getShortcuts();
|
|
2600
|
+
* }
|
|
2601
|
+
* getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
|
|
2602
|
+
* ```
|
|
2603
|
+
*/
|
|
2604
|
+
getShortcuts() {
|
|
2605
|
+
return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
|
|
2606
|
+
}
|
|
2607
|
+
/**
|
|
2608
|
+
* Retrieves current application's views.
|
|
2609
|
+
* @experimental
|
|
2610
|
+
*
|
|
2611
|
+
* @example
|
|
2612
|
+
*
|
|
2613
|
+
* ```js
|
|
2614
|
+
* async function getViews() {
|
|
2615
|
+
* const app = await fin.Application.getCurrent();
|
|
2616
|
+
* return await app.getViews();
|
|
2617
|
+
* }
|
|
2618
|
+
* getViews().then(views => console.log(views)).catch(err => console.log(err));
|
|
2619
|
+
* ```
|
|
2620
|
+
*/
|
|
2621
|
+
async getViews() {
|
|
2622
|
+
const { payload } = await this.wire.sendAction('application-get-views', this.identity);
|
|
2623
|
+
return payload.data.map((id) => new view_1.View(this.wire, id));
|
|
2624
|
+
}
|
|
2625
|
+
/**
|
|
2626
|
+
* Returns the current zoom level of the application.
|
|
2627
|
+
*
|
|
2628
|
+
* @example
|
|
2629
|
+
*
|
|
2630
|
+
* ```js
|
|
2631
|
+
* async function getZoomLevel() {
|
|
2632
|
+
* const app = await fin.Application.getCurrent();
|
|
2633
|
+
* return await app.getZoomLevel();
|
|
2634
|
+
* }
|
|
2635
|
+
*
|
|
2636
|
+
* getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
|
|
2637
|
+
* ```
|
|
2638
|
+
*/
|
|
2639
|
+
getZoomLevel() {
|
|
2640
|
+
return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
|
|
2641
|
+
}
|
|
2642
|
+
/**
|
|
2643
|
+
* Returns an instance of the main Window of the application
|
|
2644
|
+
*
|
|
2645
|
+
* @example
|
|
2646
|
+
*
|
|
2647
|
+
* ```js
|
|
2648
|
+
* async function getWindow() {
|
|
2649
|
+
* const app = await fin.Application.start({
|
|
2650
|
+
* uuid: 'app-1',
|
|
2651
|
+
* name: 'myApp',
|
|
2652
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
|
|
2653
|
+
* autoShow: true
|
|
2654
|
+
* });
|
|
2655
|
+
* return await app.getWindow();
|
|
2656
|
+
* }
|
|
2657
|
+
*
|
|
2658
|
+
* getWindow().then(win => {
|
|
2659
|
+
* win.showAt(0, 400);
|
|
2660
|
+
* win.flash();
|
|
2661
|
+
* }).catch(err => console.log(err));
|
|
2662
|
+
* ```
|
|
2663
|
+
*/
|
|
2664
|
+
getWindow() {
|
|
2665
|
+
this.wire.recordAnalytic('application-get-window');
|
|
2666
|
+
return Promise.resolve(this.window);
|
|
2667
|
+
}
|
|
2668
|
+
/**
|
|
2669
|
+
* Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
|
|
2670
|
+
* @param userName - username to be passed to the RVM.
|
|
2671
|
+
* @param appName - app name to be passed to the RVM.
|
|
2672
|
+
*
|
|
2673
|
+
* @example
|
|
2674
|
+
*
|
|
2675
|
+
* ```js
|
|
2676
|
+
* async function registerUser() {
|
|
2677
|
+
* const app = await fin.Application.getCurrent();
|
|
2678
|
+
* return await app.registerUser('user', 'myApp');
|
|
2679
|
+
* }
|
|
2680
|
+
*
|
|
2681
|
+
* registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
|
|
2682
|
+
* ```
|
|
2683
|
+
*/
|
|
2684
|
+
registerUser(userName, appName) {
|
|
2685
|
+
return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
|
|
2686
|
+
}
|
|
2687
|
+
/**
|
|
2688
|
+
* Removes the application’s icon from the tray.
|
|
2689
|
+
*
|
|
2690
|
+
* @example
|
|
2691
|
+
*
|
|
2692
|
+
* ```js
|
|
2693
|
+
* async function removeTrayIcon() {
|
|
2694
|
+
* const app = await fin.Application.getCurrent();
|
|
2695
|
+
* return await app.removeTrayIcon();
|
|
2696
|
+
* }
|
|
2697
|
+
*
|
|
2698
|
+
* removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
|
|
2699
|
+
* ```
|
|
2700
|
+
*/
|
|
2701
|
+
removeTrayIcon() {
|
|
2702
|
+
return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
|
|
2703
|
+
}
|
|
2704
|
+
/**
|
|
2705
|
+
* Restarts the application.
|
|
2706
|
+
*
|
|
2707
|
+
* @example
|
|
2708
|
+
*
|
|
2709
|
+
* ```js
|
|
2710
|
+
* async function restartApp() {
|
|
2711
|
+
* const app = await fin.Application.getCurrent();
|
|
2712
|
+
* return await app.restart();
|
|
2713
|
+
* }
|
|
2714
|
+
* restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
|
|
2715
|
+
* ```
|
|
2716
|
+
*/
|
|
2717
|
+
restart() {
|
|
2718
|
+
return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
|
|
2719
|
+
}
|
|
2720
|
+
/**
|
|
2721
|
+
* DEPRECATED method to run the application.
|
|
2722
|
+
* Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
|
|
2723
|
+
*
|
|
2724
|
+
* @example
|
|
2725
|
+
*
|
|
2726
|
+
* ```js
|
|
2727
|
+
* async function run() {
|
|
2728
|
+
* const app = await fin.Application.create({
|
|
2729
|
+
* name: 'myApp',
|
|
2730
|
+
* uuid: 'app-1',
|
|
2731
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.run.html',
|
|
2732
|
+
* autoShow: true
|
|
2733
|
+
* });
|
|
2734
|
+
* await app.run();
|
|
2735
|
+
* }
|
|
2736
|
+
* run().then(() => console.log('Application is running')).catch(err => console.log(err));
|
|
2737
|
+
* ```
|
|
2738
|
+
*
|
|
2739
|
+
* @ignore
|
|
2740
|
+
*/
|
|
2741
|
+
run() {
|
|
2742
|
+
console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
|
|
2743
|
+
this.wire.recordAnalytic('application-run');
|
|
2744
|
+
return this._run();
|
|
2745
|
+
}
|
|
2746
|
+
_run(opts = {}) {
|
|
2747
|
+
return this.wire
|
|
2748
|
+
.sendAction('run-application', {
|
|
2749
|
+
manifestUrl: this._manifestUrl,
|
|
2750
|
+
opts,
|
|
2751
|
+
...this.identity
|
|
2752
|
+
})
|
|
2753
|
+
.then(() => undefined);
|
|
2754
|
+
}
|
|
2755
|
+
/**
|
|
2756
|
+
* Instructs the RVM to schedule one restart of the application.
|
|
2757
|
+
*
|
|
2758
|
+
* @example
|
|
2759
|
+
*
|
|
2760
|
+
* ```js
|
|
2761
|
+
* async function scheduleRestart() {
|
|
2762
|
+
* const app = await fin.Application.getCurrent();
|
|
2763
|
+
* return await app.scheduleRestart();
|
|
2764
|
+
* }
|
|
2765
|
+
*
|
|
2766
|
+
* scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
|
|
2767
|
+
* ```
|
|
2768
|
+
*/
|
|
2769
|
+
scheduleRestart() {
|
|
2770
|
+
return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
|
|
2771
|
+
}
|
|
2772
|
+
/**
|
|
2773
|
+
* Sends a message to the RVM to upload the application's logs. On success,
|
|
2774
|
+
* an object containing logId is returned.
|
|
2775
|
+
*
|
|
2776
|
+
* @example
|
|
2777
|
+
*
|
|
2778
|
+
* ```js
|
|
2779
|
+
* async function sendLog() {
|
|
2780
|
+
* const app = await fin.Application.getCurrent();
|
|
2781
|
+
* return await app.sendApplicationLog();
|
|
2782
|
+
* }
|
|
2783
|
+
*
|
|
2784
|
+
* sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
|
|
2785
|
+
* ```
|
|
2786
|
+
*/
|
|
2787
|
+
async sendApplicationLog() {
|
|
2788
|
+
const { payload } = await this.wire.sendAction('send-application-log', this.identity);
|
|
2789
|
+
return payload.data;
|
|
2790
|
+
}
|
|
2791
|
+
/**
|
|
2792
|
+
* Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
|
|
2793
|
+
* If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
|
|
2794
|
+
*
|
|
2795
|
+
* Note: If the "name" property is omitted it defaults to "tasks".
|
|
2796
|
+
* @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
|
|
2797
|
+
*
|
|
2798
|
+
*
|
|
2799
|
+
* @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).
|
|
2800
|
+
*
|
|
2801
|
+
* The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's
|
|
2802
|
+
* **` shortcut.name `** and uses **` shortcut.company `** as a fallback. Clicking that item will launch the app from its current manifest.
|
|
2803
|
+
*
|
|
2804
|
+
* Note: If the "name" property is omitted it defaults to "tasks".
|
|
2805
|
+
*
|
|
2806
|
+
* Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the
|
|
2807
|
+
* uuid or shortcut.name is changed.
|
|
2808
|
+
*
|
|
2809
|
+
* @example
|
|
2810
|
+
*
|
|
2811
|
+
* ```js
|
|
2812
|
+
* const app = fin.Application.getCurrentSync();
|
|
2813
|
+
* const appName = 'My App';
|
|
2814
|
+
* const jumpListConfig = [ // array of JumpList categories
|
|
2815
|
+
* {
|
|
2816
|
+
* // has no name and no type so `type` is assumed to be "tasks"
|
|
2817
|
+
* items: [ // array of JumpList items
|
|
2818
|
+
* {
|
|
2819
|
+
* type: 'task',
|
|
2820
|
+
* title: `Launch ${appName}`,
|
|
2821
|
+
* description: `Runs ${appName} with the default configuration`,
|
|
2822
|
+
* deepLink: 'fins://path.to/app/manifest.json',
|
|
2823
|
+
* iconPath: 'https://path.to/app/icon.ico',
|
|
2824
|
+
* iconIndex: 0
|
|
2825
|
+
* },
|
|
2826
|
+
* { type: 'separator' },
|
|
2827
|
+
* {
|
|
2828
|
+
* type: 'task',
|
|
2829
|
+
* title: `Restore ${appName}`,
|
|
2830
|
+
* description: 'Restore to last configuration',
|
|
2831
|
+
* deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
|
|
2832
|
+
* iconPath: 'https://path.to/app/icon.ico',
|
|
2833
|
+
* iconIndex: 0
|
|
2834
|
+
* },
|
|
2835
|
+
* ]
|
|
2836
|
+
* },
|
|
2837
|
+
* {
|
|
2838
|
+
* name: 'Tools',
|
|
2839
|
+
* items: [ // array of JumpList items
|
|
2840
|
+
* {
|
|
2841
|
+
* type: 'task',
|
|
2842
|
+
* title: 'Tool A',
|
|
2843
|
+
* description: 'Runs Tool A',
|
|
2844
|
+
* deepLink: 'fins://path.to/tool-a/manifest.json',
|
|
2845
|
+
* iconPath: 'https://path.to/tool-a/icon.ico',
|
|
2846
|
+
* iconIndex: 0
|
|
2847
|
+
* },
|
|
2848
|
+
* {
|
|
2849
|
+
* type: 'task',
|
|
2850
|
+
* title: 'Tool B',
|
|
2851
|
+
* description: 'Runs Tool B',
|
|
2852
|
+
* deepLink: 'fins://path.to/tool-b/manifest.json',
|
|
2853
|
+
* iconPath: 'https://path.to/tool-b/icon.ico',
|
|
2854
|
+
* iconIndex: 0
|
|
2855
|
+
* }]
|
|
2856
|
+
* }
|
|
2857
|
+
* ];
|
|
2858
|
+
*
|
|
2859
|
+
* app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));
|
|
2860
|
+
* ```
|
|
2861
|
+
*
|
|
2862
|
+
* To handle deeplink args:
|
|
2863
|
+
* ```js
|
|
2864
|
+
* function handleUseLastConfiguration() {
|
|
2865
|
+
* // this handler is called when the app is being launched
|
|
2866
|
+
* app.on('run-requested', event => {
|
|
2867
|
+
* if(event.userAppConfigArgs['use-last-configuration']) {
|
|
2868
|
+
* // your logic here
|
|
2869
|
+
* }
|
|
2870
|
+
* });
|
|
2871
|
+
* // this handler is called when the app was already running when the launch was requested
|
|
2872
|
+
* fin.desktop.main(function(args) {
|
|
2873
|
+
* if(args && args['use-last-configuration']) {
|
|
2874
|
+
* // your logic here
|
|
2875
|
+
* }
|
|
2876
|
+
* });
|
|
2877
|
+
* }
|
|
2878
|
+
* ```
|
|
2879
|
+
*/
|
|
2880
|
+
async setJumpList(jumpListCategories) {
|
|
2881
|
+
await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
|
|
2882
|
+
}
|
|
2883
|
+
/**
|
|
2884
|
+
* Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
|
|
2885
|
+
* @param icon Image URL or base64 encoded string to be used as the icon
|
|
2886
|
+
*
|
|
2887
|
+
* @example
|
|
2888
|
+
*
|
|
2889
|
+
* ```js
|
|
2890
|
+
* const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
|
|
2891
|
+
* const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
|
|
2892
|
+
* ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
|
|
2893
|
+
* const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
|
|
2894
|
+
* xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
|
|
2895
|
+
*
|
|
2896
|
+
* async function setTrayIcon(icon) {
|
|
2897
|
+
* const app = await fin.Application.getCurrent();
|
|
2898
|
+
* return await app.setTrayIcon(icon);
|
|
2899
|
+
* }
|
|
2900
|
+
*
|
|
2901
|
+
* // use image url to set tray icon
|
|
2902
|
+
* setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
|
2903
|
+
*
|
|
2904
|
+
* // use base64 encoded string to set tray icon
|
|
2905
|
+
* setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
|
2906
|
+
*
|
|
2907
|
+
* // use a dataURL to set tray icon
|
|
2908
|
+
* setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
|
2909
|
+
* ```
|
|
2910
|
+
*/
|
|
2911
|
+
setTrayIcon(icon) {
|
|
2912
|
+
return this.wire
|
|
2913
|
+
.sendAction('set-tray-icon', {
|
|
2914
|
+
enabledIcon: icon,
|
|
2915
|
+
...this.identity
|
|
2916
|
+
})
|
|
2917
|
+
.then(() => undefined);
|
|
2918
|
+
}
|
|
2919
|
+
/**
|
|
2920
|
+
* Set hover text for this application's system tray icon.
|
|
2921
|
+
* Note: Application must first set a tray icon with {@link Application.setTrayIcon}.
|
|
2922
|
+
* @param toolTip
|
|
2923
|
+
*
|
|
2924
|
+
* @example
|
|
2925
|
+
*
|
|
2926
|
+
* ```js
|
|
2927
|
+
* const app = fin.Application.getCurrentSync();
|
|
2928
|
+
* const iconUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
|
|
2929
|
+
*
|
|
2930
|
+
* await app.setTrayIcon(iconUrl);
|
|
2931
|
+
*
|
|
2932
|
+
* await app.setTrayIconToolTip('My Application');
|
|
2933
|
+
* ```
|
|
2934
|
+
*/
|
|
2935
|
+
async setTrayIconToolTip(toolTip) {
|
|
2936
|
+
await this.wire.sendAction('set-tray-icon-tooltip', { ...this.identity, toolTip });
|
|
2937
|
+
}
|
|
2938
|
+
/**
|
|
2939
|
+
* Sets new application's shortcut configuration. Windows only.
|
|
2940
|
+
* @param config New application's shortcut configuration.
|
|
2941
|
+
*
|
|
2942
|
+
* @remarks Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest
|
|
2943
|
+
* to be able to change shortcut states.
|
|
2944
|
+
*
|
|
2945
|
+
* @example
|
|
2946
|
+
*
|
|
2947
|
+
* ```js
|
|
2948
|
+
* async function setShortcuts(config) {
|
|
2949
|
+
* const app = await fin.Application.getCurrent();
|
|
2950
|
+
* return app.setShortcuts(config);
|
|
2951
|
+
* }
|
|
2952
|
+
*
|
|
2953
|
+
* setShortcuts({
|
|
2954
|
+
* desktop: true,
|
|
2955
|
+
* startMenu: false,
|
|
2956
|
+
* systemStartup: true
|
|
2957
|
+
* }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
|
|
2958
|
+
* ```
|
|
2959
|
+
*/
|
|
2960
|
+
setShortcuts(config) {
|
|
2961
|
+
return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
|
|
2962
|
+
}
|
|
2963
|
+
/**
|
|
2964
|
+
* Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
|
|
2965
|
+
* @param queryString The new query string for this app's shortcuts.
|
|
2966
|
+
*
|
|
2967
|
+
* @example
|
|
2968
|
+
*
|
|
2969
|
+
* ```js
|
|
2970
|
+
* const newQueryArgs = 'arg=true&arg2=false';
|
|
2971
|
+
* const app = await fin.Application.getCurrent();
|
|
2972
|
+
* try {
|
|
2973
|
+
* await app.setShortcutQueryParams(newQueryArgs);
|
|
2974
|
+
* } catch(err) {
|
|
2975
|
+
* console.error(err)
|
|
2976
|
+
* }
|
|
2977
|
+
* ```
|
|
2978
|
+
*/
|
|
2979
|
+
async setShortcutQueryParams(queryString) {
|
|
2980
|
+
await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
|
|
2981
|
+
}
|
|
2982
|
+
/**
|
|
2983
|
+
* Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
|
|
2984
|
+
* larger or smaller to default limits of 300% and 50% of original size, respectively.
|
|
2985
|
+
* @param level The zoom level
|
|
2986
|
+
*
|
|
2987
|
+
* @example
|
|
2988
|
+
*
|
|
2989
|
+
* ```js
|
|
2990
|
+
* async function setZoomLevel(number) {
|
|
2991
|
+
* const app = await fin.Application.getCurrent();
|
|
2992
|
+
* return await app.setZoomLevel(number);
|
|
2993
|
+
* }
|
|
2994
|
+
*
|
|
2995
|
+
* setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
|
|
2996
|
+
* ```
|
|
2997
|
+
*/
|
|
2998
|
+
setZoomLevel(level) {
|
|
2999
|
+
return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
|
|
3000
|
+
}
|
|
3001
|
+
/**
|
|
3002
|
+
* Sets a username to correlate with App Log Management.
|
|
3003
|
+
* @param username Username to correlate with App's Log.
|
|
3004
|
+
*
|
|
3005
|
+
* @example
|
|
3006
|
+
*
|
|
3007
|
+
* ```js
|
|
3008
|
+
* async function setAppLogUser() {
|
|
3009
|
+
* const app = await fin.Application.getCurrent();
|
|
3010
|
+
* return await app.setAppLogUsername('username');
|
|
3011
|
+
* }
|
|
3012
|
+
*
|
|
3013
|
+
* setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
|
|
3014
|
+
*
|
|
3015
|
+
* ```
|
|
3016
|
+
*/
|
|
3017
|
+
async setAppLogUsername(username) {
|
|
3018
|
+
await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
|
|
3019
|
+
}
|
|
3020
|
+
/**
|
|
3021
|
+
* Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
|
|
3022
|
+
* @remarks The only information currently returned is the position and dimensions.
|
|
3023
|
+
*
|
|
3024
|
+
* @example
|
|
3025
|
+
*
|
|
3026
|
+
* ```js
|
|
3027
|
+
* async function getTrayIconInfo() {
|
|
3028
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
|
3029
|
+
* return await app.getTrayIconInfo();
|
|
3030
|
+
* }
|
|
3031
|
+
* getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
|
|
3032
|
+
* ```
|
|
3033
|
+
*/
|
|
3034
|
+
getTrayIconInfo() {
|
|
3035
|
+
return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
|
|
3036
|
+
}
|
|
3037
|
+
/**
|
|
3038
|
+
* Checks if the application has an associated tray icon.
|
|
3039
|
+
*
|
|
3040
|
+
* @example
|
|
3041
|
+
*
|
|
3042
|
+
* ```js
|
|
3043
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
|
3044
|
+
* const hasTrayIcon = await app.hasTrayIcon();
|
|
3045
|
+
* console.log(hasTrayIcon);
|
|
3046
|
+
* ```
|
|
3047
|
+
*/
|
|
3048
|
+
hasTrayIcon() {
|
|
3049
|
+
return this.wire.sendAction('has-tray-icon', this.identity).then(({ payload }) => payload.data);
|
|
3050
|
+
}
|
|
3051
|
+
/**
|
|
3052
|
+
* Closes the application by terminating its process.
|
|
3053
|
+
*
|
|
3054
|
+
* @example
|
|
3055
|
+
*
|
|
3056
|
+
* ```js
|
|
3057
|
+
* async function terminateApp() {
|
|
3058
|
+
* const app = await fin.Application.getCurrent();
|
|
3059
|
+
* return await app.terminate();
|
|
3060
|
+
* }
|
|
3061
|
+
* terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));
|
|
3062
|
+
* ```
|
|
3063
|
+
*/
|
|
3064
|
+
terminate() {
|
|
3065
|
+
return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
|
|
3066
|
+
}
|
|
3067
|
+
/**
|
|
3068
|
+
* Waits for a hanging application. This method can be called in response to an application
|
|
3069
|
+
* "not-responding" to allow the application to continue and to generate another "not-responding"
|
|
3070
|
+
* message after a certain period of time.
|
|
3071
|
+
*
|
|
3072
|
+
* @ignore
|
|
3073
|
+
*/
|
|
3074
|
+
wait() {
|
|
3075
|
+
return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
|
|
3076
|
+
}
|
|
3077
|
+
/**
|
|
3078
|
+
* Retrieves information about the application.
|
|
3079
|
+
*
|
|
3080
|
+
* @remarks If the application was not launched from a manifest, the call will return the closest parent application `manifest`
|
|
3081
|
+
* and `manifestUrl`. `initialOptions` shows the parameters used when launched programmatically, or the `startup_app` options
|
|
3082
|
+
* if launched from manifest. The `parentUuid` will be the uuid of the immediate parent (if applicable).
|
|
3083
|
+
*
|
|
3084
|
+
* @example
|
|
3085
|
+
*
|
|
3086
|
+
* ```js
|
|
3087
|
+
* async function getInfo() {
|
|
3088
|
+
* const app = await fin.Application.getCurrent();
|
|
3089
|
+
* return await app.getInfo();
|
|
3090
|
+
* }
|
|
3091
|
+
*
|
|
3092
|
+
* getInfo().then(info => console.log(info)).catch(err => console.log(err));
|
|
3093
|
+
* ```
|
|
3094
|
+
*/
|
|
3095
|
+
getInfo() {
|
|
3096
|
+
return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
|
|
3097
|
+
}
|
|
3098
|
+
/**
|
|
3099
|
+
* Retrieves all process information for entities (windows and views) associated with an application.
|
|
3100
|
+
*
|
|
3101
|
+
* @example
|
|
3102
|
+
* ```js
|
|
3103
|
+
* const app = await fin.Application.getCurrent();
|
|
3104
|
+
* const processInfo = await app.getProcessInfo();
|
|
3105
|
+
* ```
|
|
3106
|
+
* @experimental
|
|
3107
|
+
*/
|
|
3108
|
+
async getProcessInfo() {
|
|
3109
|
+
const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
|
|
3110
|
+
return data;
|
|
3111
|
+
}
|
|
3112
|
+
/**
|
|
3113
|
+
* Sets file auto download location. It's only allowed in the same application.
|
|
3114
|
+
*
|
|
3115
|
+
* Note: This method is restricted by default and must be enabled via
|
|
3116
|
+
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
|
3117
|
+
* @param downloadLocation file auto download location
|
|
3118
|
+
*
|
|
3119
|
+
* @throws if setting file auto download location on different applications.
|
|
3120
|
+
* @example
|
|
3121
|
+
*
|
|
3122
|
+
* ```js
|
|
3123
|
+
* const downloadLocation = 'C:\\dev\\temp';
|
|
3124
|
+
* const app = await fin.Application.getCurrent();
|
|
3125
|
+
* try {
|
|
3126
|
+
* await app.setFileDownloadLocation(downloadLocation);
|
|
3127
|
+
* console.log('File download location is set');
|
|
3128
|
+
* } catch(err) {
|
|
3129
|
+
* console.error(err)
|
|
3130
|
+
* }
|
|
3131
|
+
* ```
|
|
3132
|
+
*/
|
|
3133
|
+
async setFileDownloadLocation(downloadLocation) {
|
|
3134
|
+
const { name } = this.wire.me;
|
|
3135
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
|
3136
|
+
await this.wire.sendAction('set-file-download-location', { ...entityIdentity, downloadLocation });
|
|
3137
|
+
}
|
|
3138
|
+
/**
|
|
3139
|
+
* 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.
|
|
3140
|
+
*
|
|
3141
|
+
* Note: This method is restricted by default and must be enabled via
|
|
3142
|
+
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
|
3143
|
+
*
|
|
3144
|
+
* @throws if getting file auto download location on different applications.
|
|
3145
|
+
* @example
|
|
3146
|
+
*
|
|
3147
|
+
* ```js
|
|
3148
|
+
* const app = await fin.Application.getCurrent();
|
|
3149
|
+
* const fileDownloadDir = await app.getFileDownloadLocation();
|
|
3150
|
+
* ```
|
|
3151
|
+
*/
|
|
3152
|
+
async getFileDownloadLocation() {
|
|
3153
|
+
const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
|
|
3154
|
+
return data;
|
|
3155
|
+
}
|
|
3156
|
+
/**
|
|
3157
|
+
* Shows a menu on the tray icon. Use with tray-icon-clicked event.
|
|
3158
|
+
* @param options
|
|
3159
|
+
* @typeParam Data User-defined shape for data returned upon menu item click. Should be a
|
|
3160
|
+
* [union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
|
|
3161
|
+
* of all possible data shapes for the entire menu, and the click handler should process
|
|
3162
|
+
* these with a "reducer" pattern.
|
|
3163
|
+
* @throws if the application has no tray icon set
|
|
3164
|
+
* @throws if the system tray is currently hidden
|
|
3165
|
+
* @example
|
|
3166
|
+
*
|
|
3167
|
+
* ```js
|
|
3168
|
+
* const iconUrl = 'http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png';
|
|
3169
|
+
* const app = fin.Application.getCurrentSync();
|
|
3170
|
+
*
|
|
3171
|
+
* await app.setTrayIcon(iconUrl);
|
|
3172
|
+
*
|
|
3173
|
+
* const template = [
|
|
3174
|
+
* {
|
|
3175
|
+
* label: 'Menu Item 1',
|
|
3176
|
+
* data: 'hello from item 1'
|
|
3177
|
+
* },
|
|
3178
|
+
* { type: 'separator' },
|
|
3179
|
+
* {
|
|
3180
|
+
* label: 'Menu Item 2',
|
|
3181
|
+
* type: 'checkbox',
|
|
3182
|
+
* checked: true,
|
|
3183
|
+
* data: 'The user clicked the checkbox'
|
|
3184
|
+
* },
|
|
3185
|
+
* {
|
|
3186
|
+
* label: 'see more',
|
|
3187
|
+
* enabled: false,
|
|
3188
|
+
* submenu: [
|
|
3189
|
+
* { label: 'submenu 1', data: 'hello from submenu' }
|
|
3190
|
+
* ]
|
|
3191
|
+
* }
|
|
3192
|
+
* ];
|
|
3193
|
+
*
|
|
3194
|
+
* app.addListener('tray-icon-clicked', (event) => {
|
|
3195
|
+
* // right-click
|
|
3196
|
+
* if (event.button === 2) {
|
|
3197
|
+
* app.showTrayIconPopupMenu({ template }).then(r => {
|
|
3198
|
+
* if (r.result === 'closed') {
|
|
3199
|
+
* console.log('nothing happened');
|
|
3200
|
+
* } else {
|
|
3201
|
+
* console.log(r.data);
|
|
3202
|
+
* }
|
|
3203
|
+
* });
|
|
3204
|
+
* }
|
|
3205
|
+
* });
|
|
3206
|
+
* ```
|
|
3207
|
+
*/
|
|
3208
|
+
async showTrayIconPopupMenu(options) {
|
|
3209
|
+
const { name } = this.wire.me;
|
|
3210
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
|
3211
|
+
const { payload } = await this.wire.sendAction('show-tray-icon-popup-menu', { ...entityIdentity, options });
|
|
3212
|
+
return payload.data;
|
|
3213
|
+
}
|
|
3214
|
+
/**
|
|
3215
|
+
* Closes the tray icon menu.
|
|
3216
|
+
*
|
|
3217
|
+
* @throws if the application has no tray icon set
|
|
3218
|
+
* @example
|
|
3219
|
+
*
|
|
3220
|
+
* ```js
|
|
3221
|
+
* const app = fin.Application.getCurrentSync();
|
|
3222
|
+
*
|
|
3223
|
+
* await app.closeTrayIconPopupMenu();
|
|
3224
|
+
* ```
|
|
3225
|
+
*/
|
|
3226
|
+
async closeTrayIconPopupMenu() {
|
|
3227
|
+
const { name } = this.wire.me;
|
|
3228
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
|
3229
|
+
await this.wire.sendAction('close-tray-icon-popup-menu', { ...entityIdentity });
|
|
3230
|
+
}
|
|
3231
|
+
}
|
|
3232
|
+
Instance$6.Application = Application;
|
|
3233
|
+
return Instance$6;
|
|
3291
3234
|
}
|
|
3292
|
-
Instance$6.Application = Application;
|
|
3293
3235
|
|
|
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
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
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
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
|
|
3557
|
-
return this.wrap({ uuid });
|
|
3558
|
-
})
|
|
3559
|
-
.then((app) => {
|
|
3560
|
-
app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
|
|
3561
|
-
return app;
|
|
3562
|
-
});
|
|
3563
|
-
}
|
|
3236
|
+
var hasRequiredFactory$1;
|
|
3237
|
+
|
|
3238
|
+
function requireFactory$1 () {
|
|
3239
|
+
if (hasRequiredFactory$1) return Factory$7;
|
|
3240
|
+
hasRequiredFactory$1 = 1;
|
|
3241
|
+
Object.defineProperty(Factory$7, "__esModule", { value: true });
|
|
3242
|
+
Factory$7.ApplicationModule = void 0;
|
|
3243
|
+
const base_1 = base;
|
|
3244
|
+
const validate_1 = validate;
|
|
3245
|
+
const Instance_1 = requireInstance$1();
|
|
3246
|
+
/**
|
|
3247
|
+
* Static namespace for OpenFin API methods that interact with the {@link Application} class, available under `fin.Application`.
|
|
3248
|
+
*/
|
|
3249
|
+
class ApplicationModule extends base_1.Base {
|
|
3250
|
+
/**
|
|
3251
|
+
* Asynchronously returns an API handle for the given Application identity.
|
|
3252
|
+
*
|
|
3253
|
+
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
|
3254
|
+
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
|
3255
|
+
* for an Application throughout its entire lifecycle.
|
|
3256
|
+
*
|
|
3257
|
+
* @example
|
|
3258
|
+
*
|
|
3259
|
+
* ```js
|
|
3260
|
+
* fin.Application.wrap({ uuid: 'testapp' })
|
|
3261
|
+
* .then(app => app.isRunning())
|
|
3262
|
+
* .then(running => console.log('Application is running: ' + running))
|
|
3263
|
+
* .catch(err => console.log(err));
|
|
3264
|
+
* ```
|
|
3265
|
+
*
|
|
3266
|
+
*/
|
|
3267
|
+
async wrap(identity) {
|
|
3268
|
+
this.wire.recordAnalytic('wrap-application');
|
|
3269
|
+
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
|
3270
|
+
if (errorMsg) {
|
|
3271
|
+
throw new Error(errorMsg);
|
|
3272
|
+
}
|
|
3273
|
+
return new Instance_1.Application(this.wire, identity);
|
|
3274
|
+
}
|
|
3275
|
+
/**
|
|
3276
|
+
* Synchronously returns an API handle for the given Application identity.
|
|
3277
|
+
*
|
|
3278
|
+
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
|
3279
|
+
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
|
3280
|
+
* for an Aplication throughout its entire lifecycle.
|
|
3281
|
+
*
|
|
3282
|
+
* @example
|
|
3283
|
+
*
|
|
3284
|
+
* ```js
|
|
3285
|
+
* const app = fin.Application.wrapSync({ uuid: 'testapp' });
|
|
3286
|
+
* await app.close();
|
|
3287
|
+
* ```
|
|
3288
|
+
*
|
|
3289
|
+
*/
|
|
3290
|
+
wrapSync(identity) {
|
|
3291
|
+
this.wire.recordAnalytic('wrap-application-sync');
|
|
3292
|
+
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
|
3293
|
+
if (errorMsg) {
|
|
3294
|
+
throw new Error(errorMsg);
|
|
3295
|
+
}
|
|
3296
|
+
return new Instance_1.Application(this.wire, identity);
|
|
3297
|
+
}
|
|
3298
|
+
async _create(appOptions) {
|
|
3299
|
+
// set defaults:
|
|
3300
|
+
if (appOptions.waitForPageLoad === undefined) {
|
|
3301
|
+
appOptions.waitForPageLoad = false;
|
|
3302
|
+
}
|
|
3303
|
+
if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
|
|
3304
|
+
appOptions.autoShow = true;
|
|
3305
|
+
}
|
|
3306
|
+
await this.wire.sendAction('create-application', appOptions);
|
|
3307
|
+
return this.wrap({ uuid: appOptions.uuid });
|
|
3308
|
+
}
|
|
3309
|
+
/**
|
|
3310
|
+
* DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
|
|
3311
|
+
*
|
|
3312
|
+
* @example
|
|
3313
|
+
*
|
|
3314
|
+
* ```js
|
|
3315
|
+
* async function createApp() {
|
|
3316
|
+
* const app = await fin.Application.create({
|
|
3317
|
+
* name: 'myApp',
|
|
3318
|
+
* uuid: 'app-3',
|
|
3319
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
|
|
3320
|
+
* autoShow: true
|
|
3321
|
+
* });
|
|
3322
|
+
* await app.run();
|
|
3323
|
+
* }
|
|
3324
|
+
*
|
|
3325
|
+
* createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
|
|
3326
|
+
* ```
|
|
3327
|
+
*
|
|
3328
|
+
* @ignore
|
|
3329
|
+
*/
|
|
3330
|
+
create(appOptions) {
|
|
3331
|
+
console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
|
|
3332
|
+
this.wire.recordAnalytic('application-create');
|
|
3333
|
+
return this._create(appOptions);
|
|
3334
|
+
}
|
|
3335
|
+
/**
|
|
3336
|
+
* Creates and starts a new Application.
|
|
3337
|
+
*
|
|
3338
|
+
* @example
|
|
3339
|
+
*
|
|
3340
|
+
* ```js
|
|
3341
|
+
* async function start() {
|
|
3342
|
+
* return fin.Application.start({
|
|
3343
|
+
* name: 'app-1',
|
|
3344
|
+
* uuid: 'app-1',
|
|
3345
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
|
|
3346
|
+
* autoShow: true
|
|
3347
|
+
* });
|
|
3348
|
+
* }
|
|
3349
|
+
* start().then(() => console.log('Application is running')).catch(err => console.log(err));
|
|
3350
|
+
* ```
|
|
3351
|
+
*
|
|
3352
|
+
*/
|
|
3353
|
+
async start(appOptions) {
|
|
3354
|
+
this.wire.recordAnalytic('start-application');
|
|
3355
|
+
const app = await this._create(appOptions);
|
|
3356
|
+
await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
|
|
3357
|
+
return app;
|
|
3358
|
+
}
|
|
3359
|
+
/**
|
|
3360
|
+
* Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
|
|
3361
|
+
* Returns once the RVM is finished attempting to launch the applications.
|
|
3362
|
+
* @param opts - Parameters that the RVM will use.
|
|
3363
|
+
*
|
|
3364
|
+
* @example
|
|
3365
|
+
*
|
|
3366
|
+
* ```js
|
|
3367
|
+
*
|
|
3368
|
+
* const applicationInfoArray = [
|
|
3369
|
+
* {
|
|
3370
|
+
* "uuid": 'App-1',
|
|
3371
|
+
* "manifestUrl": 'http://localhost:5555/app1.json',
|
|
3372
|
+
* },
|
|
3373
|
+
* {
|
|
3374
|
+
* "uuid": 'App-2',
|
|
3375
|
+
* "manifestUrl": 'http://localhost:5555/app2.json',
|
|
3376
|
+
* },
|
|
3377
|
+
* {
|
|
3378
|
+
* "uuid": 'App-3',
|
|
3379
|
+
* "manifestUrl": 'http://localhost:5555/app3.json',
|
|
3380
|
+
* }
|
|
3381
|
+
* ]
|
|
3382
|
+
*
|
|
3383
|
+
* fin.Application.startManyManifests(applicationInfoArray)
|
|
3384
|
+
* .then(() => {
|
|
3385
|
+
* console.log('RVM has finished launching the application list.');
|
|
3386
|
+
* })
|
|
3387
|
+
* .catch((err) => {
|
|
3388
|
+
* console.log(err);
|
|
3389
|
+
* })
|
|
3390
|
+
* ```
|
|
3391
|
+
*
|
|
3392
|
+
* @experimental
|
|
3393
|
+
*/
|
|
3394
|
+
async startManyManifests(applications, opts) {
|
|
3395
|
+
return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
|
|
3396
|
+
}
|
|
3397
|
+
/**
|
|
3398
|
+
* Asynchronously returns an Application object that represents the current application
|
|
3399
|
+
*
|
|
3400
|
+
* @example
|
|
3401
|
+
*
|
|
3402
|
+
* ```js
|
|
3403
|
+
* async function isCurrentAppRunning () {
|
|
3404
|
+
* const app = await fin.Application.getCurrent();
|
|
3405
|
+
* return app.isRunning();
|
|
3406
|
+
* }
|
|
3407
|
+
*
|
|
3408
|
+
* isCurrentAppRunning().then(running => {
|
|
3409
|
+
* console.log(`Current app is running: ${running}`);
|
|
3410
|
+
* }).catch(err => {
|
|
3411
|
+
* console.error(err);
|
|
3412
|
+
* });
|
|
3413
|
+
*
|
|
3414
|
+
* ```
|
|
3415
|
+
*/
|
|
3416
|
+
getCurrent() {
|
|
3417
|
+
this.wire.recordAnalytic('get-current-application');
|
|
3418
|
+
return this.wrap({ uuid: this.wire.me.uuid });
|
|
3419
|
+
}
|
|
3420
|
+
/**
|
|
3421
|
+
* Synchronously returns an Application object that represents the current application
|
|
3422
|
+
*
|
|
3423
|
+
* @example
|
|
3424
|
+
*
|
|
3425
|
+
* ```js
|
|
3426
|
+
* async function isCurrentAppRunning () {
|
|
3427
|
+
* const app = fin.Application.getCurrentSync();
|
|
3428
|
+
* return app.isRunning();
|
|
3429
|
+
* }
|
|
3430
|
+
*
|
|
3431
|
+
* isCurrentAppRunning().then(running => {
|
|
3432
|
+
* console.log(`Current app is running: ${running}`);
|
|
3433
|
+
* }).catch(err => {
|
|
3434
|
+
* console.error(err);
|
|
3435
|
+
* });
|
|
3436
|
+
*
|
|
3437
|
+
* ```
|
|
3438
|
+
*/
|
|
3439
|
+
getCurrentSync() {
|
|
3440
|
+
this.wire.recordAnalytic('get-current-application-sync');
|
|
3441
|
+
return this.wrapSync({ uuid: this.wire.me.uuid });
|
|
3442
|
+
}
|
|
3443
|
+
/**
|
|
3444
|
+
* Retrieves application's manifest and returns a running instance of the application.
|
|
3445
|
+
* @param manifestUrl - The URL of app's manifest.
|
|
3446
|
+
* @param opts - Parameters that the RVM will use.
|
|
3447
|
+
*
|
|
3448
|
+
* @example
|
|
3449
|
+
*
|
|
3450
|
+
* ```js
|
|
3451
|
+
* fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
|
3452
|
+
*
|
|
3453
|
+
* // For a local manifest file:
|
|
3454
|
+
* fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
|
3455
|
+
* ```
|
|
3456
|
+
*/
|
|
3457
|
+
async startFromManifest(manifestUrl, opts) {
|
|
3458
|
+
this.wire.recordAnalytic('application-start-from-manifest');
|
|
3459
|
+
const app = await this._createFromManifest(manifestUrl);
|
|
3460
|
+
// @ts-expect-error using private method without warning.
|
|
3461
|
+
await app._run(opts); // eslint-disable-line no-underscore-dangle
|
|
3462
|
+
return app;
|
|
3463
|
+
}
|
|
3464
|
+
/**
|
|
3465
|
+
* @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
|
|
3466
|
+
* Retrieves application's manifest and returns a wrapped application.
|
|
3467
|
+
* @param manifestUrl - The URL of app's manifest.
|
|
3468
|
+
* @param callback - called if the method succeeds.
|
|
3469
|
+
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
|
3470
|
+
*
|
|
3471
|
+
* @example
|
|
3472
|
+
*
|
|
3473
|
+
* ```js
|
|
3474
|
+
* fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
|
|
3475
|
+
* ```
|
|
3476
|
+
* @ignore
|
|
3477
|
+
*/
|
|
3478
|
+
createFromManifest(manifestUrl) {
|
|
3479
|
+
console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
|
|
3480
|
+
this.wire.recordAnalytic('application-create-from-manifest');
|
|
3481
|
+
return this._createFromManifest(manifestUrl);
|
|
3482
|
+
}
|
|
3483
|
+
_createFromManifest(manifestUrl) {
|
|
3484
|
+
return this.wire
|
|
3485
|
+
.sendAction('get-application-manifest', { manifestUrl })
|
|
3486
|
+
.then(({ payload }) => {
|
|
3487
|
+
const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
|
|
3488
|
+
return this.wrap({ uuid });
|
|
3489
|
+
})
|
|
3490
|
+
.then((app) => {
|
|
3491
|
+
app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
|
|
3492
|
+
return app;
|
|
3493
|
+
});
|
|
3494
|
+
}
|
|
3495
|
+
}
|
|
3496
|
+
Factory$7.ApplicationModule = ApplicationModule;
|
|
3497
|
+
return Factory$7;
|
|
3564
3498
|
}
|
|
3565
|
-
Factory$7.ApplicationModule = ApplicationModule;
|
|
3566
3499
|
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3500
|
+
var hasRequiredApplication;
|
|
3501
|
+
|
|
3502
|
+
function requireApplication () {
|
|
3503
|
+
if (hasRequiredApplication) return application;
|
|
3504
|
+
hasRequiredApplication = 1;
|
|
3505
|
+
(function (exports) {
|
|
3506
|
+
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3507
|
+
if (k2 === undefined) k2 = k;
|
|
3508
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
3509
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
3510
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
3511
|
+
}
|
|
3512
|
+
Object.defineProperty(o, k2, desc);
|
|
3513
|
+
}) : (function(o, m, k, k2) {
|
|
3514
|
+
if (k2 === undefined) k2 = k;
|
|
3515
|
+
o[k2] = m[k];
|
|
3516
|
+
}));
|
|
3517
|
+
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
|
3518
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
3519
|
+
};
|
|
3520
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3521
|
+
/**
|
|
3522
|
+
* Entry points for the OpenFin `Application` API (`fin.Application`).
|
|
3523
|
+
*
|
|
3524
|
+
* * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
|
|
3525
|
+
* * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
|
|
3526
|
+
*
|
|
3527
|
+
* 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),
|
|
3528
|
+
* both of these were documented on the same page.
|
|
3529
|
+
*
|
|
3530
|
+
* @packageDocumentation
|
|
3531
|
+
*/
|
|
3532
|
+
__exportStar(requireFactory$1(), exports);
|
|
3533
|
+
__exportStar(requireInstance$1(), exports);
|
|
3534
|
+
} (application));
|
|
3535
|
+
return application;
|
|
3536
|
+
}
|
|
3597
3537
|
|
|
3598
3538
|
var promisifySubscription$1 = {};
|
|
3599
3539
|
|
|
@@ -3637,7 +3577,7 @@ function requireInstance () {
|
|
|
3637
3577
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3638
3578
|
/* eslint-disable no-console */
|
|
3639
3579
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
3640
|
-
const application_1 =
|
|
3580
|
+
const application_1 = requireApplication();
|
|
3641
3581
|
const main_1 = main;
|
|
3642
3582
|
const view_1 = requireView();
|
|
3643
3583
|
const warnings_1 = warnings;
|
|
@@ -3658,9 +3598,7 @@ function requireInstance () {
|
|
|
3658
3598
|
super(wire, identity, 'window');
|
|
3659
3599
|
}
|
|
3660
3600
|
async createWindow(options) {
|
|
3661
|
-
this.wire.
|
|
3662
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
3663
|
-
});
|
|
3601
|
+
this.wire.recordAnalytic('window-create-window');
|
|
3664
3602
|
const CONSTRUCTOR_CB_TOPIC = 'fire-constructor-callback';
|
|
3665
3603
|
const responseSubscription = await (0, promisifySubscription_1.promisifySubscription)(this, CONSTRUCTOR_CB_TOPIC);
|
|
3666
3604
|
// set defaults:
|
|
@@ -4134,9 +4072,7 @@ function requireInstance () {
|
|
|
4134
4072
|
* @experimental
|
|
4135
4073
|
*/
|
|
4136
4074
|
async getLayout(layoutIdentity) {
|
|
4137
|
-
this.wire.
|
|
4138
|
-
// don't expose
|
|
4139
|
-
});
|
|
4075
|
+
this.wire.recordAnalytic('window-get-layout');
|
|
4140
4076
|
const opts = await this.getOptions();
|
|
4141
4077
|
if (!opts.layout && !opts.layoutSnapshot) {
|
|
4142
4078
|
throw new Error('Window does not have a Layout');
|
|
@@ -4185,9 +4121,7 @@ function requireInstance () {
|
|
|
4185
4121
|
* ```
|
|
4186
4122
|
*/
|
|
4187
4123
|
getParentApplication() {
|
|
4188
|
-
this.wire.
|
|
4189
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
4190
|
-
});
|
|
4124
|
+
this.wire.recordAnalytic('window-get-parent-application');
|
|
4191
4125
|
return Promise.resolve(new application_1.Application(this.wire, this.identity));
|
|
4192
4126
|
}
|
|
4193
4127
|
/**
|
|
@@ -4210,9 +4144,7 @@ function requireInstance () {
|
|
|
4210
4144
|
* ```
|
|
4211
4145
|
*/
|
|
4212
4146
|
getParentWindow() {
|
|
4213
|
-
this.wire.
|
|
4214
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
4215
|
-
});
|
|
4147
|
+
this.wire.recordAnalytic('window-get-parent-window');
|
|
4216
4148
|
return Promise.resolve(new application_1.Application(this.wire, this.identity)).then((app) => app.getWindow());
|
|
4217
4149
|
}
|
|
4218
4150
|
/**
|
|
@@ -4316,9 +4248,7 @@ function requireInstance () {
|
|
|
4316
4248
|
* ```
|
|
4317
4249
|
*/
|
|
4318
4250
|
getWebWindow() {
|
|
4319
|
-
this.wire.
|
|
4320
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
4321
|
-
});
|
|
4251
|
+
this.wire.recordAnalytic('window-get-web-window');
|
|
4322
4252
|
return this.wire.environment.getWebWindow(this.identity);
|
|
4323
4253
|
}
|
|
4324
4254
|
/**
|
|
@@ -4332,9 +4262,7 @@ function requireInstance () {
|
|
|
4332
4262
|
* ```
|
|
4333
4263
|
*/
|
|
4334
4264
|
isMainWindow() {
|
|
4335
|
-
this.wire.
|
|
4336
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
4337
|
-
});
|
|
4265
|
+
this.wire.recordAnalytic('window-is-main-window');
|
|
4338
4266
|
return this.me.uuid === this.me.name;
|
|
4339
4267
|
}
|
|
4340
4268
|
/**
|
|
@@ -4717,6 +4645,9 @@ function requireInstance () {
|
|
|
4717
4645
|
* ```
|
|
4718
4646
|
*/
|
|
4719
4647
|
updateOptions(options) {
|
|
4648
|
+
if ('frame' in options) {
|
|
4649
|
+
console.warn(`Deprecation Warning: Starting with version 45 it will not be possible to change the frame value after window has been created.`);
|
|
4650
|
+
}
|
|
4720
4651
|
return this.wire.sendAction('update-window-options', { options, ...this.identity }).then(() => undefined);
|
|
4721
4652
|
}
|
|
4722
4653
|
/**
|
|
@@ -4853,9 +4784,7 @@ function requireInstance () {
|
|
|
4853
4784
|
* ```
|
|
4854
4785
|
*/
|
|
4855
4786
|
async dispatchPopupResult(data) {
|
|
4856
|
-
this.wire.
|
|
4857
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
4858
|
-
});
|
|
4787
|
+
this.wire.recordAnalytic('window-dispatch-popup-result');
|
|
4859
4788
|
await this.wire.sendAction('dispatch-popup-result', { data, ...this.identity });
|
|
4860
4789
|
}
|
|
4861
4790
|
/**
|
|
@@ -4955,9 +4884,7 @@ function requireFactory () {
|
|
|
4955
4884
|
* ```
|
|
4956
4885
|
*/
|
|
4957
4886
|
async wrap(identity) {
|
|
4958
|
-
this.wire.
|
|
4959
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
4960
|
-
});
|
|
4887
|
+
this.wire.recordAnalytic('window-wrap');
|
|
4961
4888
|
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
|
4962
4889
|
if (errorMsg) {
|
|
4963
4890
|
throw new Error(errorMsg);
|
|
@@ -4987,9 +4914,7 @@ function requireFactory () {
|
|
|
4987
4914
|
* ```
|
|
4988
4915
|
*/
|
|
4989
4916
|
wrapSync(identity) {
|
|
4990
|
-
this.wire.
|
|
4991
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
4992
|
-
});
|
|
4917
|
+
this.wire.recordAnalytic('window-wrap-sync');
|
|
4993
4918
|
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
|
4994
4919
|
if (errorMsg) {
|
|
4995
4920
|
throw new Error(errorMsg);
|
|
@@ -5018,9 +4943,7 @@ function requireFactory () {
|
|
|
5018
4943
|
* ```
|
|
5019
4944
|
*/
|
|
5020
4945
|
create(options) {
|
|
5021
|
-
this.wire.
|
|
5022
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
5023
|
-
});
|
|
4946
|
+
this.wire.recordAnalytic('create-window');
|
|
5024
4947
|
const win = new Instance_1._Window(this.wire, { uuid: this.me.uuid, name: options.name });
|
|
5025
4948
|
return win.createWindow(options);
|
|
5026
4949
|
}
|
|
@@ -5036,9 +4959,7 @@ function requireFactory () {
|
|
|
5036
4959
|
* ```
|
|
5037
4960
|
*/
|
|
5038
4961
|
getCurrent() {
|
|
5039
|
-
this.wire.
|
|
5040
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
5041
|
-
});
|
|
4962
|
+
this.wire.recordAnalytic('get-current-window');
|
|
5042
4963
|
if (!this.wire.me.isWindow) {
|
|
5043
4964
|
throw new Error('You are not in a Window context');
|
|
5044
4965
|
}
|
|
@@ -5057,9 +4978,7 @@ function requireFactory () {
|
|
|
5057
4978
|
* ```
|
|
5058
4979
|
*/
|
|
5059
4980
|
getCurrentSync() {
|
|
5060
|
-
this.wire.
|
|
5061
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
5062
|
-
});
|
|
4981
|
+
this.wire.recordAnalytic('get-current-window-sync');
|
|
5063
4982
|
if (!this.wire.me.isWindow) {
|
|
5064
4983
|
throw new Error('You are not in a Window context');
|
|
5065
4984
|
}
|
|
@@ -5205,13 +5124,15 @@ class System extends base_1$l.EmitterBase {
|
|
|
5205
5124
|
* * cookies: browser [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies)
|
|
5206
5125
|
* * localStorage: browser data that can be used across sessions ([local storage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage))
|
|
5207
5126
|
* * appcache: html5 [application cache](https://developer.mozilla.org/en-US/docs/Web/HTML/Using_the_application_cache)
|
|
5127
|
+
* * windowState: clears data written for windows using `saveWindowState`; after clearing, previously saved bounds and state will not be restored until new state is written
|
|
5208
5128
|
* @example
|
|
5209
5129
|
* ```js
|
|
5210
5130
|
* const clearCacheOptions = {
|
|
5211
5131
|
* appcache: true,
|
|
5212
5132
|
* cache: true,
|
|
5213
5133
|
* cookies: true,
|
|
5214
|
-
* localStorage: true
|
|
5134
|
+
* localStorage: true,
|
|
5135
|
+
* windowState: true
|
|
5215
5136
|
* };
|
|
5216
5137
|
* fin.System.clearCache(clearCacheOptions).then(() => console.log('Cache cleared')).catch(err => console.log(err));
|
|
5217
5138
|
* ```
|
|
@@ -6613,9 +6534,7 @@ class System extends base_1$l.EmitterBase {
|
|
|
6613
6534
|
* @experimental
|
|
6614
6535
|
*/
|
|
6615
6536
|
async registerShutdownHandler(handler) {
|
|
6616
|
-
this.wire.
|
|
6617
|
-
// don't expose, analytics-only call
|
|
6618
|
-
});
|
|
6537
|
+
this.wire.recordAnalytic('system-register-shutdown-handler');
|
|
6619
6538
|
const SystemShutdownEventName = 'system-shutdown';
|
|
6620
6539
|
const SystemShutdownHandledEventName = 'system-shutdown-handled';
|
|
6621
6540
|
const { uuid, name } = this.wire.me;
|
|
@@ -8231,9 +8150,8 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
8231
8150
|
return [...__classPrivateFieldGet$d(this, _ChannelProvider_connections, "f")];
|
|
8232
8151
|
}
|
|
8233
8152
|
static handleClientDisconnection(channel, payload) {
|
|
8234
|
-
if (payload
|
|
8235
|
-
|
|
8236
|
-
__classPrivateFieldGet$d(channel, _ChannelProvider_removeEndpoint, "f").call(channel, { uuid, name, endpointId, isLocalEndpointId });
|
|
8153
|
+
if (payload.endpointId) {
|
|
8154
|
+
__classPrivateFieldGet$d(channel, _ChannelProvider_removeEndpoint, "f").call(channel, { endpointId: payload.endpointId });
|
|
8237
8155
|
}
|
|
8238
8156
|
else {
|
|
8239
8157
|
// this is here to support older runtimes that did not have endpointId
|
|
@@ -8403,7 +8321,9 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
8403
8321
|
* ```
|
|
8404
8322
|
*/
|
|
8405
8323
|
onDisconnection(listener) {
|
|
8406
|
-
this.disconnectListener =
|
|
8324
|
+
this.disconnectListener = (identity) => {
|
|
8325
|
+
listener(identity);
|
|
8326
|
+
};
|
|
8407
8327
|
}
|
|
8408
8328
|
/**
|
|
8409
8329
|
* Destroy the channel, raises `disconnected` events on all connected channel clients.
|
|
@@ -8420,7 +8340,6 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
8420
8340
|
*/
|
|
8421
8341
|
async destroy() {
|
|
8422
8342
|
const protectedObj = __classPrivateFieldGet$d(this, _ChannelProvider_protectedObj, "f");
|
|
8423
|
-
protectedObj.providerIdentity;
|
|
8424
8343
|
__classPrivateFieldSet$c(this, _ChannelProvider_connections, [], "f");
|
|
8425
8344
|
await protectedObj.close();
|
|
8426
8345
|
__classPrivateFieldGet$d(this, _ChannelProvider_close, "f").call(this);
|
|
@@ -8727,7 +8646,7 @@ const base_1$i = base;
|
|
|
8727
8646
|
const strategy_1 = strategy$3;
|
|
8728
8647
|
const strategy_2 = strategy$2;
|
|
8729
8648
|
const ice_manager_1 = iceManager;
|
|
8730
|
-
const provider_1
|
|
8649
|
+
const provider_1 = provider;
|
|
8731
8650
|
const message_receiver_1 = messageReceiver$1;
|
|
8732
8651
|
const protocol_manager_1 = protocolManager;
|
|
8733
8652
|
const strategy_3 = __importDefault$6(strategy);
|
|
@@ -8749,6 +8668,13 @@ class ConnectionManager extends base_1$i.Base {
|
|
|
8749
8668
|
_ConnectionManager_messageReceiver.set(this, void 0);
|
|
8750
8669
|
_ConnectionManager_rtcConnectionManager.set(this, void 0);
|
|
8751
8670
|
this.removeChannelFromProviderMap = (channelId) => {
|
|
8671
|
+
const providerEntry = this.providerMap.get(channelId);
|
|
8672
|
+
if (providerEntry) {
|
|
8673
|
+
const { channelName } = providerEntry.providerIdentity;
|
|
8674
|
+
if (this.providerChannelIdByName.get(channelName) === channelId) {
|
|
8675
|
+
this.providerChannelIdByName.delete(channelName);
|
|
8676
|
+
}
|
|
8677
|
+
}
|
|
8752
8678
|
this.providerMap.delete(channelId);
|
|
8753
8679
|
};
|
|
8754
8680
|
this.onmessage = (msg) => {
|
|
@@ -8759,6 +8685,7 @@ class ConnectionManager extends base_1$i.Base {
|
|
|
8759
8685
|
return false;
|
|
8760
8686
|
};
|
|
8761
8687
|
this.providerMap = new Map();
|
|
8688
|
+
this.providerChannelIdByName = new Map();
|
|
8762
8689
|
this.protocolManager = new protocol_manager_1.ProtocolManager(this.wire.environment.type === 'node' ? ['classic'] : ['rtc', 'classic']);
|
|
8763
8690
|
__classPrivateFieldSet$b(this, _ConnectionManager_messageReceiver, new message_receiver_1.MessageReceiver(wire), "f");
|
|
8764
8691
|
__classPrivateFieldSet$b(this, _ConnectionManager_rtcConnectionManager, new ice_manager_1.RTCICEManager(wire), "f");
|
|
@@ -8792,14 +8719,16 @@ class ConnectionManager extends base_1$i.Base {
|
|
|
8792
8719
|
// Should be impossible.
|
|
8793
8720
|
throw new Error('failed to combine strategies');
|
|
8794
8721
|
}
|
|
8795
|
-
const channel = new provider_1
|
|
8722
|
+
const channel = new provider_1.ChannelProvider(providerIdentity, () => provider_1.ChannelProvider.wireClose(this.wire, providerIdentity.channelName), strategy);
|
|
8796
8723
|
const key = providerIdentity.channelId;
|
|
8797
8724
|
this.providerMap.set(key, {
|
|
8725
|
+
providerIdentity,
|
|
8798
8726
|
provider: channel,
|
|
8799
8727
|
strategy,
|
|
8800
8728
|
supportedProtocols: ConnectionManager.getProtocolOptionsFromStrings(protocols)
|
|
8801
8729
|
});
|
|
8802
|
-
|
|
8730
|
+
this.providerChannelIdByName.set(providerIdentity.channelName, key);
|
|
8731
|
+
provider_1.ChannelProvider.setProviderRemoval(channel, this.removeChannelFromProviderMap.bind(this));
|
|
8803
8732
|
return channel;
|
|
8804
8733
|
}
|
|
8805
8734
|
async createClientOffer(options) {
|
|
@@ -8873,6 +8802,16 @@ class ConnectionManager extends base_1$i.Base {
|
|
|
8873
8802
|
strategy.addEndpoint(routingInfo.channelId, endpointPayload);
|
|
8874
8803
|
return strategy;
|
|
8875
8804
|
}
|
|
8805
|
+
handleClientDisconnection(eventPayload) {
|
|
8806
|
+
const channelId = eventPayload.channelId ?? this.providerChannelIdByName.get(eventPayload.channelName ?? '');
|
|
8807
|
+
if (!channelId) {
|
|
8808
|
+
return;
|
|
8809
|
+
}
|
|
8810
|
+
const providerEntry = this.providerMap.get(channelId);
|
|
8811
|
+
if (providerEntry) {
|
|
8812
|
+
provider_1.ChannelProvider.handleClientDisconnection(providerEntry.provider, eventPayload);
|
|
8813
|
+
}
|
|
8814
|
+
}
|
|
8876
8815
|
async processChannelConnection(msg) {
|
|
8877
8816
|
const { clientIdentity, providerIdentity, ackToSender, payload, offer: clientOffer } = msg.payload;
|
|
8878
8817
|
if (!clientIdentity.endpointId) {
|
|
@@ -8892,7 +8831,7 @@ class ConnectionManager extends base_1$i.Base {
|
|
|
8892
8831
|
}
|
|
8893
8832
|
const { provider, strategy, supportedProtocols } = bus;
|
|
8894
8833
|
try {
|
|
8895
|
-
if (!(provider instanceof provider_1
|
|
8834
|
+
if (!(provider instanceof provider_1.ChannelProvider)) {
|
|
8896
8835
|
throw Error('Cannot connect to a channel client');
|
|
8897
8836
|
}
|
|
8898
8837
|
const offer = clientOffer ?? {
|
|
@@ -8973,7 +8912,7 @@ var __classPrivateFieldGet$b = (commonjsGlobal && commonjsGlobal.__classPrivateF
|
|
|
8973
8912
|
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");
|
|
8974
8913
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
8975
8914
|
};
|
|
8976
|
-
var _Channel_connectionManager, _Channel_internalEmitter, _Channel_readyToConnect;
|
|
8915
|
+
var _Channel_connectionManager, _Channel_internalEmitter, _Channel_readyForProvider, _Channel_readyToConnect;
|
|
8977
8916
|
Object.defineProperty(channel$1, "__esModule", { value: true });
|
|
8978
8917
|
channel$1.Channel = void 0;
|
|
8979
8918
|
/* eslint-disable no-console */
|
|
@@ -8982,7 +8921,6 @@ const lazy_1$2 = lazy;
|
|
|
8982
8921
|
const base_1$h = base;
|
|
8983
8922
|
const client_1 = client;
|
|
8984
8923
|
const connection_manager_1 = connectionManager;
|
|
8985
|
-
const provider_1 = provider;
|
|
8986
8924
|
function retryDelay(count) {
|
|
8987
8925
|
const interval = 500; // base delay
|
|
8988
8926
|
const steps = 10; // How many retries to do before incrementing the delay
|
|
@@ -9018,9 +8956,19 @@ class Channel extends base_1$h.EmitterBase {
|
|
|
9018
8956
|
super(wire, 'channel');
|
|
9019
8957
|
_Channel_connectionManager.set(this, void 0);
|
|
9020
8958
|
_Channel_internalEmitter.set(this, new events_1$5.EventEmitter());
|
|
8959
|
+
// Provider-side disconnect routing setup. This must exist before first create()
|
|
8960
|
+
// so provider onDisconnection callbacks are wired even if connect() is never called.
|
|
8961
|
+
_Channel_readyForProvider.set(this, new lazy_1$2.AsyncRetryableLazy(async () => {
|
|
8962
|
+
// TODO: fix typing (internal)
|
|
8963
|
+
// @ts-expect-error
|
|
8964
|
+
await this.on('client-disconnected', (eventPayload) => {
|
|
8965
|
+
__classPrivateFieldGet$b(this, _Channel_connectionManager, "f").handleClientDisconnection(eventPayload);
|
|
8966
|
+
});
|
|
8967
|
+
}));
|
|
9021
8968
|
// OpenFin API has not been injected at construction time, *must* wait for API to be ready.
|
|
9022
8969
|
_Channel_readyToConnect.set(this, new lazy_1$2.AsyncRetryableLazy(async () => {
|
|
9023
8970
|
await Promise.all([
|
|
8971
|
+
__classPrivateFieldGet$b(this, _Channel_readyForProvider, "f").getValue(),
|
|
9024
8972
|
this.on('disconnected', (eventPayload) => {
|
|
9025
8973
|
client_1.ChannelClient.handleProviderDisconnect(eventPayload);
|
|
9026
8974
|
}),
|
|
@@ -9277,23 +9225,16 @@ class Channel extends base_1$h.EmitterBase {
|
|
|
9277
9225
|
* ```
|
|
9278
9226
|
*/
|
|
9279
9227
|
async create(channelName, options) {
|
|
9228
|
+
await __classPrivateFieldGet$b(this, _Channel_readyForProvider, "f").getValue();
|
|
9280
9229
|
if (!channelName) {
|
|
9281
9230
|
throw new Error('Please provide a channelName to create a channel');
|
|
9282
9231
|
}
|
|
9283
9232
|
const { payload: { data: providerIdentity } } = await this.wire.sendAction('create-channel', { channelName });
|
|
9284
|
-
|
|
9285
|
-
// TODO: fix typing (internal)
|
|
9286
|
-
// @ts-expect-error
|
|
9287
|
-
this.on('client-disconnected', (eventPayload) => {
|
|
9288
|
-
if (eventPayload.channelName === channelName) {
|
|
9289
|
-
provider_1.ChannelProvider.handleClientDisconnection(channel, eventPayload);
|
|
9290
|
-
}
|
|
9291
|
-
});
|
|
9292
|
-
return channel;
|
|
9233
|
+
return __classPrivateFieldGet$b(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
|
|
9293
9234
|
}
|
|
9294
9235
|
}
|
|
9295
9236
|
channel$1.Channel = Channel;
|
|
9296
|
-
_Channel_connectionManager = new WeakMap(), _Channel_internalEmitter = new WeakMap(), _Channel_readyToConnect = new WeakMap();
|
|
9237
|
+
_Channel_connectionManager = new WeakMap(), _Channel_internalEmitter = new WeakMap(), _Channel_readyForProvider = new WeakMap(), _Channel_readyToConnect = new WeakMap();
|
|
9297
9238
|
|
|
9298
9239
|
Object.defineProperty(interappbus, "__esModule", { value: true });
|
|
9299
9240
|
interappbus.InterAppPayload = interappbus.InterApplicationBus = void 0;
|
|
@@ -9319,6 +9260,16 @@ class InterApplicationBus extends base_1$g.Base {
|
|
|
9319
9260
|
*/
|
|
9320
9261
|
constructor(wire) {
|
|
9321
9262
|
super(wire);
|
|
9263
|
+
/**
|
|
9264
|
+
* Event types for the InterApplicationBus.
|
|
9265
|
+
*
|
|
9266
|
+
* @remarks The `subscriber-added` and `subscriber-removed` events are disabled by default.
|
|
9267
|
+
* To re-enable them, launch the runtime with the `--emit-legacy-iab-events` flag.
|
|
9268
|
+
* These events will be removed in a future version. Use {@link Channel} for connection
|
|
9269
|
+
* lifecycle management instead.
|
|
9270
|
+
*
|
|
9271
|
+
* @deprecated Use {@link Channel} `onConnection` / `onDisconnection` instead.
|
|
9272
|
+
*/
|
|
9322
9273
|
this.events = {
|
|
9323
9274
|
subscriberAdded: 'subscriber-added',
|
|
9324
9275
|
subscriberRemoved: 'subscriber-removed'
|
|
@@ -9805,9 +9756,7 @@ class ExternalApplicationModule extends base_1$d.Base {
|
|
|
9805
9756
|
* ```
|
|
9806
9757
|
*/
|
|
9807
9758
|
wrap(uuid) {
|
|
9808
|
-
this.wire.
|
|
9809
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
9810
|
-
});
|
|
9759
|
+
this.wire.recordAnalytic('external-application-wrap');
|
|
9811
9760
|
return Promise.resolve(new Instance_1$4.ExternalApplication(this.wire, { uuid }));
|
|
9812
9761
|
}
|
|
9813
9762
|
/**
|
|
@@ -9824,9 +9773,7 @@ class ExternalApplicationModule extends base_1$d.Base {
|
|
|
9824
9773
|
* ```
|
|
9825
9774
|
*/
|
|
9826
9775
|
wrapSync(uuid) {
|
|
9827
|
-
this.wire.
|
|
9828
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
9829
|
-
});
|
|
9776
|
+
this.wire.recordAnalytic('external-application-wrap-sync');
|
|
9830
9777
|
return new Instance_1$4.ExternalApplication(this.wire, { uuid });
|
|
9831
9778
|
}
|
|
9832
9779
|
}
|
|
@@ -9961,9 +9908,7 @@ class _FrameModule extends base_1$b.Base {
|
|
|
9961
9908
|
* ```
|
|
9962
9909
|
*/
|
|
9963
9910
|
async wrap(identity) {
|
|
9964
|
-
this.wire.
|
|
9965
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
9966
|
-
});
|
|
9911
|
+
this.wire.recordAnalytic('frame-wrap');
|
|
9967
9912
|
const errorMsg = (0, validate_1$2.validateIdentity)(identity);
|
|
9968
9913
|
if (errorMsg) {
|
|
9969
9914
|
throw new Error(errorMsg);
|
|
@@ -9985,9 +9930,7 @@ class _FrameModule extends base_1$b.Base {
|
|
|
9985
9930
|
* ```
|
|
9986
9931
|
*/
|
|
9987
9932
|
wrapSync(identity) {
|
|
9988
|
-
this.wire.
|
|
9989
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
9990
|
-
});
|
|
9933
|
+
this.wire.recordAnalytic('frame-wrap-sync');
|
|
9991
9934
|
const errorMsg = (0, validate_1$2.validateIdentity)(identity);
|
|
9992
9935
|
if (errorMsg) {
|
|
9993
9936
|
throw new Error(errorMsg);
|
|
@@ -10005,9 +9948,7 @@ class _FrameModule extends base_1$b.Base {
|
|
|
10005
9948
|
* ```
|
|
10006
9949
|
*/
|
|
10007
9950
|
getCurrent() {
|
|
10008
|
-
this.wire.
|
|
10009
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
10010
|
-
});
|
|
9951
|
+
this.wire.recordAnalytic('frame-get-current');
|
|
10011
9952
|
return Promise.resolve(new Instance_1$3._Frame(this.wire, this.wire.environment.getCurrentEntityIdentity()));
|
|
10012
9953
|
}
|
|
10013
9954
|
/**
|
|
@@ -10021,9 +9962,7 @@ class _FrameModule extends base_1$b.Base {
|
|
|
10021
9962
|
* ```
|
|
10022
9963
|
*/
|
|
10023
9964
|
getCurrentSync() {
|
|
10024
|
-
this.wire.
|
|
10025
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
10026
|
-
});
|
|
9965
|
+
this.wire.recordAnalytic('frame-get-current-sync');
|
|
10027
9966
|
return new Instance_1$3._Frame(this.wire, this.wire.environment.getCurrentEntityIdentity());
|
|
10028
9967
|
}
|
|
10029
9968
|
}
|
|
@@ -12253,9 +12192,7 @@ class LayoutModule extends base_1$7.Base {
|
|
|
12253
12192
|
* ```
|
|
12254
12193
|
*/
|
|
12255
12194
|
this.init = async (options = {}) => {
|
|
12256
|
-
this.wire.
|
|
12257
|
-
// don't expose
|
|
12258
|
-
});
|
|
12195
|
+
this.wire.recordAnalytic('layout-init');
|
|
12259
12196
|
if (!this.wire.environment.layoutAllowedInContext(this.fin)) {
|
|
12260
12197
|
throw new Error('Layout.init can only be called from a Window context.');
|
|
12261
12198
|
}
|
|
@@ -12333,9 +12270,7 @@ class LayoutModule extends base_1$7.Base {
|
|
|
12333
12270
|
* ```
|
|
12334
12271
|
*/
|
|
12335
12272
|
async wrap(identity) {
|
|
12336
|
-
this.wire.
|
|
12337
|
-
// don't expose
|
|
12338
|
-
});
|
|
12273
|
+
this.wire.recordAnalytic('layout-wrap');
|
|
12339
12274
|
return new Instance_1$2.Layout(identity, this.wire);
|
|
12340
12275
|
}
|
|
12341
12276
|
/**
|
|
@@ -12358,9 +12293,7 @@ class LayoutModule extends base_1$7.Base {
|
|
|
12358
12293
|
* ```
|
|
12359
12294
|
*/
|
|
12360
12295
|
wrapSync(identity) {
|
|
12361
|
-
this.wire.
|
|
12362
|
-
// don't expose
|
|
12363
|
-
});
|
|
12296
|
+
this.wire.recordAnalytic('layout-wrap-sync');
|
|
12364
12297
|
return new Instance_1$2.Layout(identity, this.wire);
|
|
12365
12298
|
}
|
|
12366
12299
|
/**
|
|
@@ -12374,9 +12307,7 @@ class LayoutModule extends base_1$7.Base {
|
|
|
12374
12307
|
* ```
|
|
12375
12308
|
*/
|
|
12376
12309
|
async getCurrent() {
|
|
12377
|
-
this.wire.
|
|
12378
|
-
// don't expose
|
|
12379
|
-
});
|
|
12310
|
+
this.wire.recordAnalytic('layout-get-current');
|
|
12380
12311
|
if (this.wire.environment.type === 'openfin' && !this.fin.me.isWindow) {
|
|
12381
12312
|
throw new Error('You are not in a Window context. Only Windows can have a Layout.');
|
|
12382
12313
|
}
|
|
@@ -12397,9 +12328,7 @@ class LayoutModule extends base_1$7.Base {
|
|
|
12397
12328
|
* ```
|
|
12398
12329
|
*/
|
|
12399
12330
|
getCurrentSync() {
|
|
12400
|
-
this.wire.
|
|
12401
|
-
// don't expose
|
|
12402
|
-
});
|
|
12331
|
+
this.wire.recordAnalytic('layout-get-current-sync');
|
|
12403
12332
|
if (this.wire.environment.type === 'openfin' && !this.fin.me.isWindow) {
|
|
12404
12333
|
throw new Error('You are not in a Window context. Only Windows can have a Layout.');
|
|
12405
12334
|
}
|
|
@@ -12417,9 +12346,7 @@ class LayoutModule extends base_1$7.Base {
|
|
|
12417
12346
|
* ```
|
|
12418
12347
|
*/
|
|
12419
12348
|
async getLayoutByViewIdentity(viewIdentity) {
|
|
12420
|
-
this.wire.
|
|
12421
|
-
// don't expose
|
|
12422
|
-
});
|
|
12349
|
+
this.wire.recordAnalytic('layout-get-by-view-identity');
|
|
12423
12350
|
const winIdentity = await this.wire.environment.getViewWindowIdentity(this.fin, viewIdentity);
|
|
12424
12351
|
let layoutWindowIdentity = winIdentity;
|
|
12425
12352
|
// TODO: CORE-1857 - when we tearout active layout or drag a view out of a window, the above identity includes the whole window info.
|
|
@@ -12581,9 +12508,7 @@ class PlatformModule extends base_1$6.Base {
|
|
|
12581
12508
|
* ```
|
|
12582
12509
|
*/
|
|
12583
12510
|
async wrap(identity) {
|
|
12584
|
-
this.wire.
|
|
12585
|
-
// don't expose
|
|
12586
|
-
});
|
|
12511
|
+
this.wire.recordAnalytic('platform-wrap');
|
|
12587
12512
|
return new Instance_1$1.Platform(this.wire, { uuid: identity.uuid });
|
|
12588
12513
|
}
|
|
12589
12514
|
/**
|
|
@@ -12598,9 +12523,7 @@ class PlatformModule extends base_1$6.Base {
|
|
|
12598
12523
|
* ```
|
|
12599
12524
|
*/
|
|
12600
12525
|
wrapSync(identity) {
|
|
12601
|
-
this.wire.
|
|
12602
|
-
// don't expose
|
|
12603
|
-
});
|
|
12526
|
+
this.wire.recordAnalytic('platform-wrap-sync');
|
|
12604
12527
|
return new Instance_1$1.Platform(this.wire, { uuid: identity.uuid });
|
|
12605
12528
|
}
|
|
12606
12529
|
/**
|
|
@@ -12614,9 +12537,7 @@ class PlatformModule extends base_1$6.Base {
|
|
|
12614
12537
|
* ```
|
|
12615
12538
|
*/
|
|
12616
12539
|
async getCurrent() {
|
|
12617
|
-
this.wire.
|
|
12618
|
-
// don't expose
|
|
12619
|
-
});
|
|
12540
|
+
this.wire.recordAnalytic('platform-get-current');
|
|
12620
12541
|
return this.wrap({ uuid: this.wire.me.uuid });
|
|
12621
12542
|
}
|
|
12622
12543
|
/**
|
|
@@ -12630,9 +12551,7 @@ class PlatformModule extends base_1$6.Base {
|
|
|
12630
12551
|
* ```
|
|
12631
12552
|
*/
|
|
12632
12553
|
getCurrentSync() {
|
|
12633
|
-
this.wire.
|
|
12634
|
-
// don't expose
|
|
12635
|
-
});
|
|
12554
|
+
this.wire.recordAnalytic('platform-get-current-sync');
|
|
12636
12555
|
return this.wrapSync({ uuid: this.wire.me.uuid });
|
|
12637
12556
|
}
|
|
12638
12557
|
/**
|
|
@@ -12660,9 +12579,7 @@ class PlatformModule extends base_1$6.Base {
|
|
|
12660
12579
|
* ```
|
|
12661
12580
|
*/
|
|
12662
12581
|
start(platformOptions) {
|
|
12663
|
-
this.wire.
|
|
12664
|
-
// don't expose
|
|
12665
|
-
});
|
|
12582
|
+
this.wire.recordAnalytic('platform-start');
|
|
12666
12583
|
// eslint-disable-next-line no-async-promise-executor
|
|
12667
12584
|
return new Promise(async (resolve, reject) => {
|
|
12668
12585
|
try {
|
|
@@ -12704,9 +12621,7 @@ class PlatformModule extends base_1$6.Base {
|
|
|
12704
12621
|
* ```
|
|
12705
12622
|
*/
|
|
12706
12623
|
startFromManifest(manifestUrl, opts) {
|
|
12707
|
-
this.wire.
|
|
12708
|
-
// don't expose
|
|
12709
|
-
});
|
|
12624
|
+
this.wire.recordAnalytic('platform-start-from-manifest');
|
|
12710
12625
|
// eslint-disable-next-line no-async-promise-executor
|
|
12711
12626
|
return new Promise(async (resolve, reject) => {
|
|
12712
12627
|
try {
|
|
@@ -15748,7 +15663,6 @@ fdc3Channels2_0.createV2Channel = createV2Channel;
|
|
|
15748
15663
|
// Generate an ID to make a session context group with. We will pass that ID to the Broker.
|
|
15749
15664
|
// The broker will then setContext on that session context group later with our Intent Result,
|
|
15750
15665
|
const guid = (0, utils_1.generateId)(); // TODO make this undefined in web
|
|
15751
|
-
let isPromiseSettled = false;
|
|
15752
15666
|
// Adding the intentResolutionResultId to the intentObj. Because fireIntent only accepts a single arg, we have to slap it in here.
|
|
15753
15667
|
const metadata = app ? { target: app, intentResolutionResultId: guid } : { intentResolutionResultId: guid };
|
|
15754
15668
|
const intentObj = intent ? { name: intent, context, metadata } : { ...context, metadata };
|
|
@@ -15764,21 +15678,11 @@ fdc3Channels2_0.createV2Channel = createV2Channel;
|
|
|
15764
15678
|
reject(new Error('getResult is not supported in this environment'));
|
|
15765
15679
|
});
|
|
15766
15680
|
});
|
|
15767
|
-
getResultPromise
|
|
15768
|
-
.then(() => {
|
|
15769
|
-
isPromiseSettled = true;
|
|
15770
|
-
})
|
|
15771
|
-
.catch(() => {
|
|
15772
|
-
isPromiseSettled = true;
|
|
15773
|
-
});
|
|
15774
15681
|
// Set up the getResult call.
|
|
15775
15682
|
const getResult = async () => {
|
|
15776
|
-
// All this mumbo jumbo is needed to make sure that getResult resolves correctly and conforms to the FDC3 spec.
|
|
15777
|
-
if (!isPromiseSettled) {
|
|
15778
|
-
return undefined;
|
|
15779
|
-
}
|
|
15780
15683
|
let intentResult = await getResultPromise;
|
|
15781
|
-
|
|
15684
|
+
// void / no payload, or web path where subscribe resolves undefined (see getResultPromise above)
|
|
15685
|
+
if (intentResult == null) {
|
|
15782
15686
|
return undefined;
|
|
15783
15687
|
}
|
|
15784
15688
|
if (typeof intentResult !== 'object') {
|
|
@@ -15869,9 +15773,7 @@ class FDC3ModuleBase {
|
|
|
15869
15773
|
* @static
|
|
15870
15774
|
*/
|
|
15871
15775
|
async broadcast(context) {
|
|
15872
|
-
this.wire.
|
|
15873
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
15874
|
-
});
|
|
15776
|
+
this.wire.recordAnalytic('fdc3-broadcast');
|
|
15875
15777
|
return this.client.setContext(context);
|
|
15876
15778
|
}
|
|
15877
15779
|
/**
|
|
@@ -15882,9 +15784,7 @@ class FDC3ModuleBase {
|
|
|
15882
15784
|
* @tutorial fdc3.open
|
|
15883
15785
|
*/
|
|
15884
15786
|
async _open(app, context) {
|
|
15885
|
-
this.wire.
|
|
15886
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
15887
|
-
});
|
|
15787
|
+
this.wire.recordAnalytic('fdc3-open');
|
|
15888
15788
|
try {
|
|
15889
15789
|
return await InteropClient_1$2.InteropClient.ferryFdc3Call(this.client, 'fdc3Open', { app, context });
|
|
15890
15790
|
}
|
|
@@ -15908,9 +15808,7 @@ class FDC3ModuleBase {
|
|
|
15908
15808
|
* @tutorial fdc3.getOrCreateChannel
|
|
15909
15809
|
*/
|
|
15910
15810
|
async getOrCreateChannel(channelId, fdc3Factory) {
|
|
15911
|
-
this.wire.
|
|
15912
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
15913
|
-
});
|
|
15811
|
+
this.wire.recordAnalytic('fdc3-get-or-create-channel');
|
|
15914
15812
|
const hasChannelIdBeenUsed = await InteropClient_1$2.InteropClient.ferryFdc3Call(this.client, 'isIdUsedByPrivateChannel', {
|
|
15915
15813
|
channelId
|
|
15916
15814
|
});
|
|
@@ -15938,9 +15836,7 @@ class FDC3ModuleBase {
|
|
|
15938
15836
|
* @static
|
|
15939
15837
|
*/
|
|
15940
15838
|
async getSystemChannels() {
|
|
15941
|
-
this.wire.
|
|
15942
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
15943
|
-
});
|
|
15839
|
+
this.wire.recordAnalytic('fdc3-get-system-channels');
|
|
15944
15840
|
return this._getChannels();
|
|
15945
15841
|
}
|
|
15946
15842
|
/**
|
|
@@ -15955,9 +15851,7 @@ class FDC3ModuleBase {
|
|
|
15955
15851
|
* @static
|
|
15956
15852
|
*/
|
|
15957
15853
|
async joinChannel(channelId) {
|
|
15958
|
-
this.wire.
|
|
15959
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
15960
|
-
});
|
|
15854
|
+
this.wire.recordAnalytic('fdc3-join-channel');
|
|
15961
15855
|
try {
|
|
15962
15856
|
return await this.client.joinContextGroup(channelId);
|
|
15963
15857
|
}
|
|
@@ -15980,9 +15874,7 @@ class FDC3ModuleBase {
|
|
|
15980
15874
|
* @tutorial fdc3.getCurrentChannel
|
|
15981
15875
|
*/
|
|
15982
15876
|
async getCurrentChannel() {
|
|
15983
|
-
this.wire.
|
|
15984
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
15985
|
-
});
|
|
15877
|
+
this.wire.recordAnalytic('fdc3-get-current-channel');
|
|
15986
15878
|
const currentContextGroupInfo = await this.getCurrentContextGroupInfo();
|
|
15987
15879
|
if (!currentContextGroupInfo) {
|
|
15988
15880
|
return null;
|
|
@@ -15997,9 +15889,7 @@ class FDC3ModuleBase {
|
|
|
15997
15889
|
* @static
|
|
15998
15890
|
*/
|
|
15999
15891
|
async leaveCurrentChannel() {
|
|
16000
|
-
this.wire.
|
|
16001
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16002
|
-
});
|
|
15892
|
+
this.wire.recordAnalytic('fdc3-leave-current-channel');
|
|
16003
15893
|
return this.client.removeFromContextGroup();
|
|
16004
15894
|
}
|
|
16005
15895
|
// utils
|
|
@@ -16125,9 +16015,7 @@ class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
|
|
|
16125
16015
|
*/
|
|
16126
16016
|
// @ts-expect-error TODO [CORE-1524]
|
|
16127
16017
|
addContextListener(contextType, handler) {
|
|
16128
|
-
this.wire.
|
|
16129
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16130
|
-
});
|
|
16018
|
+
this.wire.recordAnalytic('fdc3-add-context-listener');
|
|
16131
16019
|
let listener;
|
|
16132
16020
|
if (typeof contextType === 'function') {
|
|
16133
16021
|
console.warn('addContextListener(handler) has been deprecated. Please use addContextListener(null, handler)');
|
|
@@ -16150,9 +16038,7 @@ class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
|
|
|
16150
16038
|
* @static
|
|
16151
16039
|
*/
|
|
16152
16040
|
addIntentListener(intent, handler) {
|
|
16153
|
-
this.wire.
|
|
16154
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16155
|
-
});
|
|
16041
|
+
this.wire.recordAnalytic('fdc3-add-intent-listener');
|
|
16156
16042
|
const contextHandler = (raisedIntent) => {
|
|
16157
16043
|
const { context, metadata: intentMetadata } = raisedIntent;
|
|
16158
16044
|
const { metadata } = context;
|
|
@@ -16180,9 +16066,7 @@ class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
|
|
|
16180
16066
|
* @static
|
|
16181
16067
|
*/
|
|
16182
16068
|
async raiseIntent(intent, context, app) {
|
|
16183
|
-
this.wire.
|
|
16184
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16185
|
-
});
|
|
16069
|
+
this.wire.recordAnalytic('fdc3-raise-intent');
|
|
16186
16070
|
const intentObj = app
|
|
16187
16071
|
? { name: intent, context, metadata: { target: app } }
|
|
16188
16072
|
: { name: intent, context };
|
|
@@ -16202,9 +16086,7 @@ class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
|
|
|
16202
16086
|
* @tutorial fdc3.findIntent
|
|
16203
16087
|
*/
|
|
16204
16088
|
async findIntent(intent, context) {
|
|
16205
|
-
this.wire.
|
|
16206
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16207
|
-
});
|
|
16089
|
+
this.wire.recordAnalytic('fdc3-find-intent');
|
|
16208
16090
|
try {
|
|
16209
16091
|
return await this.client.getInfoForIntent({ name: intent, context });
|
|
16210
16092
|
}
|
|
@@ -16220,9 +16102,7 @@ class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
|
|
|
16220
16102
|
* @tutorial fdc3.findIntentsByContext
|
|
16221
16103
|
*/
|
|
16222
16104
|
async findIntentsByContext(context) {
|
|
16223
|
-
this.wire.
|
|
16224
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16225
|
-
});
|
|
16105
|
+
this.wire.recordAnalytic('fdc3-find-intents-by-context');
|
|
16226
16106
|
try {
|
|
16227
16107
|
return await this.client.getInfoForIntentsByContext(context);
|
|
16228
16108
|
}
|
|
@@ -16239,9 +16119,7 @@ class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
|
|
|
16239
16119
|
* @tutorial fdc3.raiseIntentForContext
|
|
16240
16120
|
*/
|
|
16241
16121
|
async raiseIntentForContext(context, app) {
|
|
16242
|
-
this.wire.
|
|
16243
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16244
|
-
});
|
|
16122
|
+
this.wire.recordAnalytic('fdc3-raise-intent-for-context');
|
|
16245
16123
|
try {
|
|
16246
16124
|
return await this.client.fireIntentForContext({ ...context, metadata: { target: app } });
|
|
16247
16125
|
}
|
|
@@ -16265,9 +16143,7 @@ class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
|
|
|
16265
16143
|
* @tutorial fdc3.getInfo
|
|
16266
16144
|
*/
|
|
16267
16145
|
getInfo() {
|
|
16268
|
-
this.wire.
|
|
16269
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16270
|
-
});
|
|
16146
|
+
this.wire.recordAnalytic('fdc3-get-info');
|
|
16271
16147
|
const version = this.wire.environment.getAdapterVersionSync();
|
|
16272
16148
|
return {
|
|
16273
16149
|
providerVersion: version,
|
|
@@ -16345,9 +16221,7 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
|
|
|
16345
16221
|
* @tutorial fdc3v2.findInstances
|
|
16346
16222
|
*/
|
|
16347
16223
|
async findInstances(app) {
|
|
16348
|
-
this.wire.
|
|
16349
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16350
|
-
});
|
|
16224
|
+
this.wire.recordAnalytic('fdc3-find-instances');
|
|
16351
16225
|
try {
|
|
16352
16226
|
return await InteropClient_1$1.InteropClient.ferryFdc3Call(this.client, 'fdc3FindInstances', app);
|
|
16353
16227
|
}
|
|
@@ -16363,9 +16237,7 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
|
|
|
16363
16237
|
* @tutorial fdc3v2.getAppMetadata
|
|
16364
16238
|
*/
|
|
16365
16239
|
async getAppMetadata(app) {
|
|
16366
|
-
this.wire.
|
|
16367
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16368
|
-
});
|
|
16240
|
+
this.wire.recordAnalytic('fdc3-get-app-metadata');
|
|
16369
16241
|
try {
|
|
16370
16242
|
return await InteropClient_1$1.InteropClient.ferryFdc3Call(this.client, 'fdc3GetAppMetadata', app);
|
|
16371
16243
|
}
|
|
@@ -16383,9 +16255,7 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
|
|
|
16383
16255
|
*/
|
|
16384
16256
|
// @ts-expect-error TODO [CORE-1524]
|
|
16385
16257
|
async addContextListener(contextType, handler) {
|
|
16386
|
-
this.wire.
|
|
16387
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16388
|
-
});
|
|
16258
|
+
this.wire.recordAnalytic('fdc3-add-context-listener');
|
|
16389
16259
|
// The FDC3 ContextHandler only expects the context and optional ContextMetadata, so we wrap the handler
|
|
16390
16260
|
// here so it only gets passed these parameters
|
|
16391
16261
|
const getWrappedHandler = (handlerToWrap) => {
|
|
@@ -16414,9 +16284,7 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
|
|
|
16414
16284
|
* @tutorial fdc3.findIntent
|
|
16415
16285
|
*/
|
|
16416
16286
|
async findIntent(intent, context, resultType) {
|
|
16417
|
-
this.wire.
|
|
16418
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16419
|
-
});
|
|
16287
|
+
this.wire.recordAnalytic('fdc3-find-intent');
|
|
16420
16288
|
try {
|
|
16421
16289
|
return await this.client.getInfoForIntent({ name: intent, context, metadata: { resultType } });
|
|
16422
16290
|
}
|
|
@@ -16433,9 +16301,7 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
|
|
|
16433
16301
|
* @tutorial fdc3v2.findIntentsByContext
|
|
16434
16302
|
*/
|
|
16435
16303
|
async findIntentsByContext(context, resultType) {
|
|
16436
|
-
this.wire.
|
|
16437
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16438
|
-
});
|
|
16304
|
+
this.wire.recordAnalytic('fdc3-find-intents-by-context');
|
|
16439
16305
|
const payload = resultType ? { context, metadata: { resultType } } : context;
|
|
16440
16306
|
try {
|
|
16441
16307
|
return await InteropClient_1$1.InteropClient.ferryFdc3Call(this.client, 'fdc3v2FindIntentsByContext', payload);
|
|
@@ -16454,9 +16320,7 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
|
|
|
16454
16320
|
* @tutorial fdc3v2.raiseIntent
|
|
16455
16321
|
*/
|
|
16456
16322
|
async raiseIntent(intent, context, app) {
|
|
16457
|
-
this.wire.
|
|
16458
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16459
|
-
});
|
|
16323
|
+
this.wire.recordAnalytic('fdc3-raise-intent');
|
|
16460
16324
|
try {
|
|
16461
16325
|
if (typeof app === 'string') {
|
|
16462
16326
|
console.warn('Passing a string as the app parameter is deprecated, please use an AppIdentifier ({ appId: string; instanceId?: string }).');
|
|
@@ -16477,9 +16341,7 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
|
|
|
16477
16341
|
*/
|
|
16478
16342
|
async raiseIntentForContext(context, app) {
|
|
16479
16343
|
// TODO: We have to do the same thing we do for raiseIntent here as well.
|
|
16480
|
-
this.wire.
|
|
16481
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16482
|
-
});
|
|
16344
|
+
this.wire.recordAnalytic('fdc3-raise-intent-for-context');
|
|
16483
16345
|
try {
|
|
16484
16346
|
if (typeof app === 'string') {
|
|
16485
16347
|
console.warn('Passing a string as the app parameter is deprecated, please use an AppIdentifier ({ appId: string; instanceId?: string }).');
|
|
@@ -16499,9 +16361,7 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
|
|
|
16499
16361
|
* @tutorial fdc3.addIntentListener
|
|
16500
16362
|
*/
|
|
16501
16363
|
async addIntentListener(intent, handler) {
|
|
16502
|
-
this.wire.
|
|
16503
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16504
|
-
});
|
|
16364
|
+
this.wire.recordAnalytic('fdc3-add-intent-listener');
|
|
16505
16365
|
if (typeof intent !== 'string') {
|
|
16506
16366
|
throw new Error('First argument must be an Intent name');
|
|
16507
16367
|
}
|
|
@@ -16678,9 +16538,7 @@ class InteropModule extends base_1$2.Base {
|
|
|
16678
16538
|
* ```
|
|
16679
16539
|
*/
|
|
16680
16540
|
async init(name, override = defaultOverride) {
|
|
16681
|
-
this.wire.
|
|
16682
|
-
// don't expose, analytics-only call
|
|
16683
|
-
});
|
|
16541
|
+
this.wire.recordAnalytic('interop-init');
|
|
16684
16542
|
// Allows for manifest-level configuration, without having to override. (e.g. specifying custom context groups)
|
|
16685
16543
|
const options = await this.wire.environment.getInteropInfo(this.wire.getFin());
|
|
16686
16544
|
const objectThatThrows = (0, inaccessibleObject_1.createUnusableObject)(BrokerParamAccessError);
|
|
@@ -16729,9 +16587,7 @@ class InteropModule extends base_1$2.Base {
|
|
|
16729
16587
|
* ```
|
|
16730
16588
|
*/
|
|
16731
16589
|
connectSync(name, interopConfig) {
|
|
16732
|
-
this.wire.
|
|
16733
|
-
// don't expose, analytics-only call
|
|
16734
|
-
});
|
|
16590
|
+
this.wire.recordAnalytic('interop-connect-sync');
|
|
16735
16591
|
return new InteropClient_1.InteropClient(this.wire, this.wire.environment.whenReady().then(() => {
|
|
16736
16592
|
return this.fin.InterApplicationBus.Channel.connect(`interop-broker-${name}`, {
|
|
16737
16593
|
payload: interopConfig
|
|
@@ -16900,9 +16756,7 @@ class SnapshotSource extends base_1$1.Base {
|
|
|
16900
16756
|
* ```
|
|
16901
16757
|
*/
|
|
16902
16758
|
async ready() {
|
|
16903
|
-
this.wire.
|
|
16904
|
-
// don't expose, analytics-only call
|
|
16905
|
-
});
|
|
16759
|
+
this.wire.recordAnalytic('snapshot-source-ready');
|
|
16906
16760
|
// eslint-disable-next-line no-async-promise-executor
|
|
16907
16761
|
try {
|
|
16908
16762
|
// If getClient was already called before this, do we have a timing issue where the channel might have been created but we missed the event but this still fails?
|
|
@@ -16918,9 +16772,7 @@ class SnapshotSource extends base_1$1.Base {
|
|
|
16918
16772
|
*
|
|
16919
16773
|
*/
|
|
16920
16774
|
async getSnapshot() {
|
|
16921
|
-
this.wire.
|
|
16922
|
-
// don't expose, analytics-only call
|
|
16923
|
-
});
|
|
16775
|
+
this.wire.recordAnalytic('snapshot-source-get-snapshot');
|
|
16924
16776
|
const client = await __classPrivateFieldGet$1(this, _SnapshotSource_getClient, "f").call(this);
|
|
16925
16777
|
const response = (await client.dispatch('get-snapshot'));
|
|
16926
16778
|
return (await response).snapshot;
|
|
@@ -16930,9 +16782,7 @@ class SnapshotSource extends base_1$1.Base {
|
|
|
16930
16782
|
*
|
|
16931
16783
|
*/
|
|
16932
16784
|
async applySnapshot(snapshot) {
|
|
16933
|
-
this.wire.
|
|
16934
|
-
// don't expose, analytics-only call
|
|
16935
|
-
});
|
|
16785
|
+
this.wire.recordAnalytic('snapshot-source-apply-snapshot');
|
|
16936
16786
|
const client = await __classPrivateFieldGet$1(this, _SnapshotSource_getClient, "f").call(this);
|
|
16937
16787
|
return client.dispatch('apply-snapshot', { snapshot });
|
|
16938
16788
|
}
|
|
@@ -16973,9 +16823,7 @@ class SnapshotSourceModule extends base_1.Base {
|
|
|
16973
16823
|
*
|
|
16974
16824
|
*/
|
|
16975
16825
|
async init(provider) {
|
|
16976
|
-
this.wire.
|
|
16977
|
-
// don't expose, analytics-only call
|
|
16978
|
-
});
|
|
16826
|
+
this.wire.recordAnalytic('snapshot-source-init');
|
|
16979
16827
|
if (typeof provider !== 'object' ||
|
|
16980
16828
|
typeof provider.getSnapshot !== 'function' ||
|
|
16981
16829
|
typeof provider.applySnapshot !== 'function') {
|
|
@@ -16999,9 +16847,7 @@ class SnapshotSourceModule extends base_1.Base {
|
|
|
16999
16847
|
* ```
|
|
17000
16848
|
*/
|
|
17001
16849
|
wrapSync(identity) {
|
|
17002
|
-
this.wire.
|
|
17003
|
-
// don't expose, analytics-only call
|
|
17004
|
-
});
|
|
16850
|
+
this.wire.recordAnalytic('snapshot-source-wrap-sync');
|
|
17005
16851
|
return new Instance_1.SnapshotSource(this.wire, identity);
|
|
17006
16852
|
}
|
|
17007
16853
|
/**
|
|
@@ -17015,9 +16861,7 @@ class SnapshotSourceModule extends base_1.Base {
|
|
|
17015
16861
|
* ```
|
|
17016
16862
|
*/
|
|
17017
16863
|
async wrap(identity) {
|
|
17018
|
-
this.wire.
|
|
17019
|
-
// don't expose, analytics-only call
|
|
17020
|
-
});
|
|
16864
|
+
this.wire.recordAnalytic('snapshot-source-wrap');
|
|
17021
16865
|
return this.wrapSync(identity);
|
|
17022
16866
|
}
|
|
17023
16867
|
}
|
|
@@ -17060,7 +16904,7 @@ const events_1$3 = require$$0;
|
|
|
17060
16904
|
// Import from the file rather than the directory in case someone consuming types is using module resolution other than "node"
|
|
17061
16905
|
const index_1 = system;
|
|
17062
16906
|
const index_2 = requireWindow();
|
|
17063
|
-
const index_3 =
|
|
16907
|
+
const index_3 = requireApplication();
|
|
17064
16908
|
const index_4 = interappbus;
|
|
17065
16909
|
const index_5 = clipboard;
|
|
17066
16910
|
const index_6 = externalApplication;
|
|
@@ -17151,6 +16995,17 @@ Object.defineProperty(environment$1, "__esModule", { value: true });
|
|
|
17151
16995
|
var notImplementedEnvErrorMsg = environment$1.notImplementedEnvErrorMsg = void 0;
|
|
17152
16996
|
notImplementedEnvErrorMsg = environment$1.notImplementedEnvErrorMsg = 'Not implemented in this environment';
|
|
17153
16997
|
|
|
16998
|
+
var promises = {};
|
|
16999
|
+
|
|
17000
|
+
Object.defineProperty(promises, "__esModule", { value: true });
|
|
17001
|
+
var promisify_1 = promises.promisify = void 0;
|
|
17002
|
+
function promisify(func) {
|
|
17003
|
+
return (...args) => new Promise((resolve, reject) => {
|
|
17004
|
+
func(...args, (err, val) => (err ? reject(err) : resolve(val)));
|
|
17005
|
+
});
|
|
17006
|
+
}
|
|
17007
|
+
promisify_1 = promises.promisify = promisify;
|
|
17008
|
+
|
|
17154
17009
|
const getProxyVar = () => {
|
|
17155
17010
|
return process.env.HTTPS_PROXY || process.env.https_proxy || process.env.HTTP_PROXY || process.env.http_proxy;
|
|
17156
17011
|
};
|
|
@@ -17270,7 +17125,7 @@ async function rmDir(dirPath, removeSelf = true) {
|
|
|
17270
17125
|
return;
|
|
17271
17126
|
}
|
|
17272
17127
|
if (files.length > 0) {
|
|
17273
|
-
await
|
|
17128
|
+
await Promise.all(files.map(async (f) => {
|
|
17274
17129
|
const filePath = `${dirPath}/${f}`;
|
|
17275
17130
|
const file = await lstat(filePath);
|
|
17276
17131
|
if (file.isFile() || file.isSymbolicLink()) {
|
|
@@ -17279,7 +17134,7 @@ async function rmDir(dirPath, removeSelf = true) {
|
|
|
17279
17134
|
else {
|
|
17280
17135
|
await rmDir(filePath, true);
|
|
17281
17136
|
}
|
|
17282
|
-
});
|
|
17137
|
+
}));
|
|
17283
17138
|
}
|
|
17284
17139
|
if (removeSelf) {
|
|
17285
17140
|
await rmdir(dirPath);
|
|
@@ -17861,7 +17716,7 @@ class NodeEnvironment extends BaseEnvironment_1 {
|
|
|
17861
17716
|
};
|
|
17862
17717
|
}
|
|
17863
17718
|
getAdapterVersionSync() {
|
|
17864
|
-
return "41.103.
|
|
17719
|
+
return "41.103.10";
|
|
17865
17720
|
}
|
|
17866
17721
|
observeBounds(element, onChange) {
|
|
17867
17722
|
throw new Error('Method not implemented.');
|
|
@@ -17995,7 +17850,7 @@ var __classPrivateFieldGet = (commonjsGlobal && commonjsGlobal.__classPrivateFie
|
|
|
17995
17850
|
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
17996
17851
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17997
17852
|
};
|
|
17998
|
-
var _Transport_wire, _Transport_fin;
|
|
17853
|
+
var _Transport_instances, _Transport_wire, _Transport_analyticsEnabled, _Transport_analyticsBuffer, _Transport_analyticsFlushTimeout, _Transport_fin, _Transport_flushAnalytics;
|
|
17999
17854
|
Object.defineProperty(transport, "__esModule", { value: true });
|
|
18000
17855
|
var Transport_1 = transport.Transport = void 0;
|
|
18001
17856
|
const events_1$1 = require$$0;
|
|
@@ -18007,11 +17862,15 @@ const errors_1 = errors;
|
|
|
18007
17862
|
class Transport extends events_1$1.EventEmitter {
|
|
18008
17863
|
constructor(factory, environment, config) {
|
|
18009
17864
|
super();
|
|
17865
|
+
_Transport_instances.add(this);
|
|
18010
17866
|
this.wireListeners = new Map();
|
|
18011
17867
|
this.topicRefMap = new Map();
|
|
18012
17868
|
this.eventAggregator = new eventAggregator_1.default();
|
|
18013
17869
|
this.messageHandlers = [this.eventAggregator.dispatchEvent];
|
|
18014
17870
|
_Transport_wire.set(this, void 0);
|
|
17871
|
+
_Transport_analyticsEnabled.set(this, true);
|
|
17872
|
+
_Transport_analyticsBuffer.set(this, new Map());
|
|
17873
|
+
_Transport_analyticsFlushTimeout.set(this, void 0);
|
|
18015
17874
|
// Typing as unknown to avoid circular dependency, should not be used directly.
|
|
18016
17875
|
_Transport_fin.set(this, void 0);
|
|
18017
17876
|
this.connectSync = () => {
|
|
@@ -18025,6 +17884,7 @@ class Transport extends events_1$1.EventEmitter {
|
|
|
18025
17884
|
};
|
|
18026
17885
|
__classPrivateFieldSet(this, _Transport_wire, factory(this.onmessage.bind(this)), "f");
|
|
18027
17886
|
this.environment = environment;
|
|
17887
|
+
__classPrivateFieldSet(this, _Transport_analyticsEnabled, config.apiDiagnostics !== false, "f");
|
|
18028
17888
|
this.sendRaw = __classPrivateFieldGet(this, _Transport_wire, "f").send.bind(__classPrivateFieldGet(this, _Transport_wire, "f"));
|
|
18029
17889
|
this.registerMessageHandler(this.handleMessage.bind(this));
|
|
18030
17890
|
__classPrivateFieldGet(this, _Transport_wire, "f").on('disconnected', () => {
|
|
@@ -18032,6 +17892,9 @@ class Transport extends events_1$1.EventEmitter {
|
|
|
18032
17892
|
handleNack({ reason: 'Remote connection has closed' });
|
|
18033
17893
|
}
|
|
18034
17894
|
this.wireListeners.clear();
|
|
17895
|
+
clearTimeout(__classPrivateFieldGet(this, _Transport_analyticsFlushTimeout, "f"));
|
|
17896
|
+
__classPrivateFieldSet(this, _Transport_analyticsFlushTimeout, undefined, "f");
|
|
17897
|
+
__classPrivateFieldGet(this, _Transport_analyticsBuffer, "f").clear();
|
|
18035
17898
|
this.emit('disconnected');
|
|
18036
17899
|
});
|
|
18037
17900
|
const { uuid, name } = config;
|
|
@@ -18050,6 +17913,18 @@ class Transport extends events_1$1.EventEmitter {
|
|
|
18050
17913
|
}
|
|
18051
17914
|
__classPrivateFieldSet(this, _Transport_fin, _fin, "f");
|
|
18052
17915
|
}
|
|
17916
|
+
recordAnalytic(action) {
|
|
17917
|
+
if (!__classPrivateFieldGet(this, _Transport_analyticsEnabled, "f"))
|
|
17918
|
+
return;
|
|
17919
|
+
__classPrivateFieldGet(this, _Transport_analyticsBuffer, "f").set(action, (__classPrivateFieldGet(this, _Transport_analyticsBuffer, "f").get(action) ?? 0) + 1);
|
|
17920
|
+
if (__classPrivateFieldGet(this, _Transport_analyticsFlushTimeout, "f") === undefined) {
|
|
17921
|
+
const timeout = setTimeout(() => __classPrivateFieldGet(this, _Transport_instances, "m", _Transport_flushAnalytics).call(this), 30000);
|
|
17922
|
+
if (typeof timeout === 'object' && timeout !== null) {
|
|
17923
|
+
timeout.unref?.();
|
|
17924
|
+
}
|
|
17925
|
+
__classPrivateFieldSet(this, _Transport_analyticsFlushTimeout, timeout, "f");
|
|
17926
|
+
}
|
|
17927
|
+
}
|
|
18053
17928
|
shutdown() {
|
|
18054
17929
|
const wire = __classPrivateFieldGet(this, _Transport_wire, "f");
|
|
18055
17930
|
return wire.shutdown();
|
|
@@ -18213,7 +18088,16 @@ class Transport extends events_1$1.EventEmitter {
|
|
|
18213
18088
|
}
|
|
18214
18089
|
}
|
|
18215
18090
|
Transport_1 = transport.Transport = Transport;
|
|
18216
|
-
_Transport_wire = new WeakMap(), _Transport_fin = new WeakMap()
|
|
18091
|
+
_Transport_wire = new WeakMap(), _Transport_analyticsEnabled = new WeakMap(), _Transport_analyticsBuffer = new WeakMap(), _Transport_analyticsFlushTimeout = new WeakMap(), _Transport_fin = new WeakMap(), _Transport_instances = new WeakSet(), _Transport_flushAnalytics = function _Transport_flushAnalytics() {
|
|
18092
|
+
__classPrivateFieldSet(this, _Transport_analyticsFlushTimeout, undefined, "f");
|
|
18093
|
+
if (__classPrivateFieldGet(this, _Transport_analyticsBuffer, "f").size === 0)
|
|
18094
|
+
return;
|
|
18095
|
+
const counts = Object.fromEntries(__classPrivateFieldGet(this, _Transport_analyticsBuffer, "f"));
|
|
18096
|
+
__classPrivateFieldGet(this, _Transport_analyticsBuffer, "f").clear();
|
|
18097
|
+
this.sendAction('send-analytics-batch', { counts }).catch(() => {
|
|
18098
|
+
// analytics flush failure is non-fatal, counts are already cleared
|
|
18099
|
+
});
|
|
18100
|
+
};
|
|
18217
18101
|
|
|
18218
18102
|
var websocket = {};
|
|
18219
18103
|
|
|
@@ -18334,7 +18218,8 @@ async function connect(config) {
|
|
|
18334
18218
|
const normalized = await validateConfig(config);
|
|
18335
18219
|
const wire = new Transport_1((onmessage) => new _default(onmessage), environment, {
|
|
18336
18220
|
...normalized,
|
|
18337
|
-
name: normalized.name ?? normalized.uuid
|
|
18221
|
+
name: normalized.name ?? normalized.uuid,
|
|
18222
|
+
apiDiagnostics: config.apiDiagnostics
|
|
18338
18223
|
});
|
|
18339
18224
|
await wire.connect(normalized);
|
|
18340
18225
|
// Casting instead of expect-error to avoid skipLibCheck errors.
|