@openfin/remote-adapter 40.104.1 → 40.104.3
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/remote-adapter.js +1301 -1289
- package/package.json +2 -2
package/out/remote-adapter.js
CHANGED
|
@@ -49,13 +49,13 @@ async function promiseMapSerial(arr, func) {
|
|
|
49
49
|
}
|
|
50
50
|
promises.promiseMapSerial = promiseMapSerial;
|
|
51
51
|
|
|
52
|
-
var __classPrivateFieldSet$
|
|
52
|
+
var __classPrivateFieldSet$e = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
53
53
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
54
54
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
55
55
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
56
56
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
57
57
|
};
|
|
58
|
-
var __classPrivateFieldGet$
|
|
58
|
+
var __classPrivateFieldGet$f = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
59
59
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
60
60
|
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");
|
|
61
61
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -140,7 +140,7 @@ class EmitterBase extends Base {
|
|
|
140
140
|
this.emit = (eventType, payload, ...args) => {
|
|
141
141
|
return this.hasEmitter() ? this.getOrCreateEmitter().emit(eventType, payload, ...args) : false;
|
|
142
142
|
};
|
|
143
|
-
this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet$
|
|
143
|
+
this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet$f(this, _EmitterBase_emitterAccessor, "f"));
|
|
144
144
|
/**
|
|
145
145
|
* Cleans up after removal of a listener, e.g. deleting any lingering deregistration handlers for a
|
|
146
146
|
* `once` subscription.
|
|
@@ -150,14 +150,14 @@ class EmitterBase extends Base {
|
|
|
150
150
|
* which would involve less "magic," but would be more-vulnerable to accidental re-introduction of a leak.
|
|
151
151
|
*/
|
|
152
152
|
this.cleanUpRemovedListener = (eventType, listener) => {
|
|
153
|
-
const deregister = __classPrivateFieldGet$
|
|
153
|
+
const deregister = __classPrivateFieldGet$f(this, _EmitterBase_deregisterOnceListeners, "f").get(listener);
|
|
154
154
|
if (deregister) {
|
|
155
|
-
const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$
|
|
155
|
+
const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$f(this, _EmitterBase_emitterAccessor, "f"));
|
|
156
156
|
emitter.removeListener(eventType, deregister);
|
|
157
157
|
}
|
|
158
158
|
};
|
|
159
159
|
this.getOrCreateEmitter = () => {
|
|
160
|
-
const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$
|
|
160
|
+
const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$f(this, _EmitterBase_emitterAccessor, "f"));
|
|
161
161
|
if (!emitter.listeners('removeListener').includes(this.cleanUpRemovedListener)) {
|
|
162
162
|
emitter.on('removeListener', this.cleanUpRemovedListener);
|
|
163
163
|
}
|
|
@@ -199,8 +199,8 @@ class EmitterBase extends Base {
|
|
|
199
199
|
// This will only be reached if unsubscribe from event that does not exist but do not want to error here
|
|
200
200
|
return Promise.resolve();
|
|
201
201
|
};
|
|
202
|
-
__classPrivateFieldSet$
|
|
203
|
-
__classPrivateFieldSet$
|
|
202
|
+
__classPrivateFieldSet$e(this, _EmitterBase_emitterAccessor, [topic, ...additionalAccessors], "f");
|
|
203
|
+
__classPrivateFieldSet$e(this, _EmitterBase_deregisterOnceListeners, new WeakMap(), "f");
|
|
204
204
|
this.listeners = (event) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(event) : [];
|
|
205
205
|
}
|
|
206
206
|
/**
|
|
@@ -229,7 +229,7 @@ class EmitterBase extends Base {
|
|
|
229
229
|
*/
|
|
230
230
|
async once(eventType, listener, options) {
|
|
231
231
|
const deregister = () => this.deregisterEventListener(eventType);
|
|
232
|
-
__classPrivateFieldGet$
|
|
232
|
+
__classPrivateFieldGet$f(this, _EmitterBase_deregisterOnceListeners, "f").set(listener, deregister);
|
|
233
233
|
await this.registerEventListener(eventType, options, (emitter) => {
|
|
234
234
|
emitter.once(eventType, deregister);
|
|
235
235
|
emitter.once(eventType, listener);
|
|
@@ -260,7 +260,7 @@ class EmitterBase extends Base {
|
|
|
260
260
|
*/
|
|
261
261
|
async prependOnceListener(eventType, listener, options) {
|
|
262
262
|
const deregister = () => this.deregisterEventListener(eventType);
|
|
263
|
-
__classPrivateFieldGet$
|
|
263
|
+
__classPrivateFieldGet$f(this, _EmitterBase_deregisterOnceListeners, "f").set(listener, deregister);
|
|
264
264
|
await this.registerEventListener(eventType, options, (emitter) => {
|
|
265
265
|
emitter.prependOnceListener(eventType, listener);
|
|
266
266
|
emitter.once(eventType, deregister);
|
|
@@ -320,7 +320,7 @@ class EmitterBase extends Base {
|
|
|
320
320
|
}
|
|
321
321
|
deleteEmitterIfNothingRegistered(emitter) {
|
|
322
322
|
if (emitter.eventNames().every((type) => type === 'removeListener')) {
|
|
323
|
-
this.wire.eventAggregator.delete(__classPrivateFieldGet$
|
|
323
|
+
this.wire.eventAggregator.delete(__classPrivateFieldGet$f(this, _EmitterBase_emitterAccessor, "f"));
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
326
|
}
|
|
@@ -456,27 +456,27 @@ var utils$3 = {};
|
|
|
456
456
|
exports.wrapIntentHandler = wrapIntentHandler;
|
|
457
457
|
} (utils$3));
|
|
458
458
|
|
|
459
|
-
var __classPrivateFieldSet$
|
|
459
|
+
var __classPrivateFieldSet$d = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
460
460
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
461
461
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
462
462
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
463
463
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
464
464
|
};
|
|
465
|
-
var __classPrivateFieldGet$
|
|
465
|
+
var __classPrivateFieldGet$e = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
466
466
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
467
467
|
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");
|
|
468
468
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
469
469
|
};
|
|
470
470
|
var _SessionContextGroupClient_clientPromise;
|
|
471
471
|
Object.defineProperty(SessionContextGroupClient$1, "__esModule", { value: true });
|
|
472
|
-
const base_1$
|
|
472
|
+
const base_1$l = base;
|
|
473
473
|
const utils_1$2 = utils$3;
|
|
474
|
-
class SessionContextGroupClient extends base_1$
|
|
474
|
+
class SessionContextGroupClient extends base_1$l.Base {
|
|
475
475
|
constructor(wire, client, id) {
|
|
476
476
|
super(wire);
|
|
477
477
|
_SessionContextGroupClient_clientPromise.set(this, void 0);
|
|
478
478
|
this.id = id;
|
|
479
|
-
__classPrivateFieldSet$
|
|
479
|
+
__classPrivateFieldSet$d(this, _SessionContextGroupClient_clientPromise, client, "f");
|
|
480
480
|
}
|
|
481
481
|
/**
|
|
482
482
|
* Sets a context for the session context group.
|
|
@@ -488,7 +488,7 @@ class SessionContextGroupClient extends base_1$j.Base {
|
|
|
488
488
|
this.wire.sendAction('interop-session-context-group-set-context').catch((e) => {
|
|
489
489
|
// don't expose, analytics-only call
|
|
490
490
|
});
|
|
491
|
-
const client = await __classPrivateFieldGet$
|
|
491
|
+
const client = await __classPrivateFieldGet$e(this, _SessionContextGroupClient_clientPromise, "f");
|
|
492
492
|
return client.dispatch(`sessionContextGroup:setContext-${this.id}`, {
|
|
493
493
|
sessionContextGroupId: this.id,
|
|
494
494
|
context
|
|
@@ -498,7 +498,7 @@ class SessionContextGroupClient extends base_1$j.Base {
|
|
|
498
498
|
this.wire.sendAction('interop-session-context-group-get-context').catch((e) => {
|
|
499
499
|
// don't expose, analytics-only call
|
|
500
500
|
});
|
|
501
|
-
const client = await __classPrivateFieldGet$
|
|
501
|
+
const client = await __classPrivateFieldGet$e(this, _SessionContextGroupClient_clientPromise, "f");
|
|
502
502
|
return client.dispatch(`sessionContextGroup:getContext-${this.id}`, {
|
|
503
503
|
sessionContextGroupId: this.id,
|
|
504
504
|
type
|
|
@@ -511,7 +511,7 @@ class SessionContextGroupClient extends base_1$j.Base {
|
|
|
511
511
|
if (typeof contextHandler !== 'function') {
|
|
512
512
|
throw new Error("Non-function argument passed to the first parameter 'handler'. Be aware that the argument order does not match the FDC3 standard.");
|
|
513
513
|
}
|
|
514
|
-
const client = await __classPrivateFieldGet$
|
|
514
|
+
const client = await __classPrivateFieldGet$e(this, _SessionContextGroupClient_clientPromise, "f");
|
|
515
515
|
let handlerId;
|
|
516
516
|
if (contextType) {
|
|
517
517
|
handlerId = `sessionContextHandler:invoke-${this.id}-${contextType}-${(0, utils_1$2.generateId)()}`;
|
|
@@ -524,7 +524,7 @@ class SessionContextGroupClient extends base_1$j.Base {
|
|
|
524
524
|
return { unsubscribe: await this.createUnsubscribeCb(handlerId) };
|
|
525
525
|
}
|
|
526
526
|
async createUnsubscribeCb(handlerId) {
|
|
527
|
-
const client = await __classPrivateFieldGet$
|
|
527
|
+
const client = await __classPrivateFieldGet$e(this, _SessionContextGroupClient_clientPromise, "f");
|
|
528
528
|
return async () => {
|
|
529
529
|
client.remove(handlerId);
|
|
530
530
|
await client.dispatch(`sessionContextGroup:handlerRemoved-${this.id}`, { handlerId });
|
|
@@ -2358,11 +2358,11 @@ function overrideFromComposables(...overrides) {
|
|
|
2358
2358
|
commonUtils.overrideFromComposables = overrideFromComposables;
|
|
2359
2359
|
commonUtils.default = { isValidPresetType };
|
|
2360
2360
|
|
|
2361
|
-
var hasRequiredFactory$
|
|
2361
|
+
var hasRequiredFactory$2;
|
|
2362
2362
|
|
|
2363
|
-
function requireFactory$
|
|
2364
|
-
if (hasRequiredFactory$
|
|
2365
|
-
hasRequiredFactory$
|
|
2363
|
+
function requireFactory$2 () {
|
|
2364
|
+
if (hasRequiredFactory$2) return Factory$8;
|
|
2365
|
+
hasRequiredFactory$2 = 1;
|
|
2366
2366
|
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
2367
2367
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2368
2368
|
};
|
|
@@ -2493,7 +2493,7 @@ function requireInterop () {
|
|
|
2493
2493
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
2494
2494
|
};
|
|
2495
2495
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2496
|
-
__exportStar(requireFactory$
|
|
2496
|
+
__exportStar(requireFactory$2(), exports);
|
|
2497
2497
|
__exportStar(requireInteropClient(), exports);
|
|
2498
2498
|
__exportStar(requireInteropBroker(), exports);
|
|
2499
2499
|
} (interop));
|
|
@@ -4712,11 +4712,11 @@ const handleDeprecatedWarnings = (options) => {
|
|
|
4712
4712
|
};
|
|
4713
4713
|
warnings.handleDeprecatedWarnings = handleDeprecatedWarnings;
|
|
4714
4714
|
|
|
4715
|
-
var hasRequiredFactory$
|
|
4715
|
+
var hasRequiredFactory$1;
|
|
4716
4716
|
|
|
4717
|
-
function requireFactory$
|
|
4718
|
-
if (hasRequiredFactory$
|
|
4719
|
-
hasRequiredFactory$
|
|
4717
|
+
function requireFactory$1 () {
|
|
4718
|
+
if (hasRequiredFactory$1) return Factory$7;
|
|
4719
|
+
hasRequiredFactory$1 = 1;
|
|
4720
4720
|
Object.defineProperty(Factory$7, "__esModule", { value: true });
|
|
4721
4721
|
Factory$7.ViewModule = void 0;
|
|
4722
4722
|
const base_1 = base;
|
|
@@ -4875,8 +4875,8 @@ var main = {};
|
|
|
4875
4875
|
|
|
4876
4876
|
Object.defineProperty(main, "__esModule", { value: true });
|
|
4877
4877
|
main.WebContents = void 0;
|
|
4878
|
-
const base_1$
|
|
4879
|
-
class WebContents extends base_1$
|
|
4878
|
+
const base_1$k = base;
|
|
4879
|
+
class WebContents extends base_1$k.EmitterBase {
|
|
4880
4880
|
/**
|
|
4881
4881
|
* @param identity The identity of the {@link OpenFin.WebContentsEvents WebContents}.
|
|
4882
4882
|
* @param entityType The type of the {@link OpenFin.WebContentsEvents WebContents}.
|
|
@@ -5969,1154 +5969,1133 @@ var Factory$5 = {};
|
|
|
5969
5969
|
|
|
5970
5970
|
var Instance$5 = {};
|
|
5971
5971
|
|
|
5972
|
-
|
|
5973
|
-
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
|
|
6185
|
-
|
|
6186
|
-
|
|
6187
|
-
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
6270
|
-
|
|
6271
|
-
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
|
|
6301
|
-
|
|
6302
|
-
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
|
|
6313
|
-
|
|
6314
|
-
|
|
6315
|
-
|
|
6316
|
-
|
|
6317
|
-
|
|
6318
|
-
|
|
6319
|
-
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
|
|
6336
|
-
|
|
6337
|
-
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
6357
|
-
|
|
6358
|
-
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
|
|
6362
|
-
|
|
6363
|
-
|
|
6364
|
-
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
|
|
6477
|
-
|
|
6478
|
-
|
|
6479
|
-
|
|
6480
|
-
|
|
6481
|
-
|
|
6482
|
-
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
|
|
6503
|
-
|
|
6504
|
-
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
|
|
6541
|
-
|
|
6542
|
-
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
|
|
6552
|
-
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
|
|
6566
|
-
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6683
|
-
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
-
|
|
6707
|
-
|
|
6708
|
-
|
|
6709
|
-
|
|
6710
|
-
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
|
|
6714
|
-
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
|
|
6723
|
-
|
|
6724
|
-
|
|
6725
|
-
|
|
6726
|
-
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
|
|
6735
|
-
|
|
6736
|
-
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
6756
|
-
|
|
6757
|
-
|
|
6758
|
-
|
|
6759
|
-
|
|
6760
|
-
|
|
6761
|
-
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
|
|
6765
|
-
|
|
6766
|
-
|
|
6767
|
-
|
|
6768
|
-
|
|
6769
|
-
|
|
6770
|
-
|
|
6771
|
-
|
|
6772
|
-
|
|
6773
|
-
|
|
6774
|
-
|
|
6775
|
-
|
|
6776
|
-
|
|
6777
|
-
|
|
6778
|
-
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
|
|
6786
|
-
|
|
6787
|
-
|
|
6788
|
-
|
|
6789
|
-
|
|
6790
|
-
|
|
6791
|
-
|
|
6792
|
-
|
|
6793
|
-
async closeTrayIconPopupMenu() {
|
|
6794
|
-
const { name } = this.wire.me;
|
|
6795
|
-
const entityIdentity = { uuid: this.identity.uuid, name };
|
|
6796
|
-
await this.wire.sendAction('close-tray-icon-popup-menu', { ...entityIdentity });
|
|
6797
|
-
}
|
|
6798
|
-
}
|
|
6799
|
-
Instance$5.Application = Application;
|
|
6800
|
-
return Instance$5;
|
|
5972
|
+
Object.defineProperty(Instance$5, "__esModule", { value: true });
|
|
5973
|
+
Instance$5.Application = void 0;
|
|
5974
|
+
/* eslint-disable import/prefer-default-export */
|
|
5975
|
+
const base_1$j = base;
|
|
5976
|
+
const window_1$1 = requireWindow();
|
|
5977
|
+
const view_1 = requireView();
|
|
5978
|
+
/**
|
|
5979
|
+
* An object representing an application. Allows the developer to create,
|
|
5980
|
+
* execute, show/close an application as well as listen to {@link OpenFin.ApplicationEvents application events}.
|
|
5981
|
+
*/
|
|
5982
|
+
class Application extends base_1$j.EmitterBase {
|
|
5983
|
+
/**
|
|
5984
|
+
* @internal
|
|
5985
|
+
*/
|
|
5986
|
+
constructor(wire, identity) {
|
|
5987
|
+
super(wire, 'application', identity.uuid);
|
|
5988
|
+
this.identity = identity;
|
|
5989
|
+
this.window = new window_1$1._Window(this.wire, {
|
|
5990
|
+
uuid: this.identity.uuid,
|
|
5991
|
+
name: this.identity.uuid
|
|
5992
|
+
});
|
|
5993
|
+
}
|
|
5994
|
+
windowListFromIdentityList(identityList) {
|
|
5995
|
+
const windowList = [];
|
|
5996
|
+
identityList.forEach((identity) => {
|
|
5997
|
+
windowList.push(new window_1$1._Window(this.wire, {
|
|
5998
|
+
uuid: identity.uuid,
|
|
5999
|
+
name: identity.name
|
|
6000
|
+
}));
|
|
6001
|
+
});
|
|
6002
|
+
return windowList;
|
|
6003
|
+
}
|
|
6004
|
+
/**
|
|
6005
|
+
* Determines if the application is currently running.
|
|
6006
|
+
*
|
|
6007
|
+
* @example
|
|
6008
|
+
*
|
|
6009
|
+
* ```js
|
|
6010
|
+
* async function isAppRunning() {
|
|
6011
|
+
* const app = await fin.Application.getCurrent();
|
|
6012
|
+
* return await app.isRunning();
|
|
6013
|
+
* }
|
|
6014
|
+
* isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
|
|
6015
|
+
* ```
|
|
6016
|
+
*/
|
|
6017
|
+
isRunning() {
|
|
6018
|
+
return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
|
|
6019
|
+
}
|
|
6020
|
+
/**
|
|
6021
|
+
* Closes the application and any child windows created by the application.
|
|
6022
|
+
* Cleans the application from state so it is no longer found in getAllApplications.
|
|
6023
|
+
* @param force Close will be prevented from closing when force is false and
|
|
6024
|
+
* ‘close-requested’ has been subscribed to for application’s main window.
|
|
6025
|
+
*
|
|
6026
|
+
* @example
|
|
6027
|
+
*
|
|
6028
|
+
* ```js
|
|
6029
|
+
* async function closeApp() {
|
|
6030
|
+
* const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
|
|
6031
|
+
* const app = await fin.Application.wrap({uuid: 'app2'});
|
|
6032
|
+
* await app.quit();
|
|
6033
|
+
* const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]
|
|
6034
|
+
*
|
|
6035
|
+
* }
|
|
6036
|
+
* closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
|
|
6037
|
+
* ```
|
|
6038
|
+
*/
|
|
6039
|
+
async quit(force = false) {
|
|
6040
|
+
try {
|
|
6041
|
+
await this._close(force);
|
|
6042
|
+
await this.wire.sendAction('destroy-application', { force, ...this.identity });
|
|
6043
|
+
}
|
|
6044
|
+
catch (error) {
|
|
6045
|
+
const acceptableErrors = ['Remote connection has closed', 'Could not locate the requested application'];
|
|
6046
|
+
if (!acceptableErrors.some((msg) => error.message.includes(msg))) {
|
|
6047
|
+
throw error;
|
|
6048
|
+
}
|
|
6049
|
+
}
|
|
6050
|
+
}
|
|
6051
|
+
async _close(force = false) {
|
|
6052
|
+
try {
|
|
6053
|
+
await this.wire.sendAction('close-application', { force, ...this.identity });
|
|
6054
|
+
}
|
|
6055
|
+
catch (error) {
|
|
6056
|
+
if (!error.message.includes('Remote connection has closed')) {
|
|
6057
|
+
throw error;
|
|
6058
|
+
}
|
|
6059
|
+
}
|
|
6060
|
+
}
|
|
6061
|
+
/**
|
|
6062
|
+
* @deprecated use Application.quit instead
|
|
6063
|
+
* Closes the application and any child windows created by the application.
|
|
6064
|
+
* @param force - Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.
|
|
6065
|
+
* @param callback - called if the method succeeds.
|
|
6066
|
+
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
|
6067
|
+
*
|
|
6068
|
+
* @example
|
|
6069
|
+
*
|
|
6070
|
+
* ```js
|
|
6071
|
+
* async function closeApp() {
|
|
6072
|
+
* const app = await fin.Application.getCurrent();
|
|
6073
|
+
* return await app.close();
|
|
6074
|
+
* }
|
|
6075
|
+
* closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
|
|
6076
|
+
* ```
|
|
6077
|
+
*/
|
|
6078
|
+
close(force = false) {
|
|
6079
|
+
console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
|
|
6080
|
+
this.wire.sendAction('application-close', this.identity).catch((e) => {
|
|
6081
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
6082
|
+
});
|
|
6083
|
+
return this._close(force);
|
|
6084
|
+
}
|
|
6085
|
+
/**
|
|
6086
|
+
* Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
|
|
6087
|
+
*
|
|
6088
|
+
* @example
|
|
6089
|
+
*
|
|
6090
|
+
* ```js
|
|
6091
|
+
* async function getChildWindows() {
|
|
6092
|
+
* const app = await fin.Application.getCurrent();
|
|
6093
|
+
* return await app.getChildWindows();
|
|
6094
|
+
* }
|
|
6095
|
+
*
|
|
6096
|
+
* getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
|
|
6097
|
+
* ```
|
|
6098
|
+
*/
|
|
6099
|
+
getChildWindows() {
|
|
6100
|
+
return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
|
|
6101
|
+
const identityList = [];
|
|
6102
|
+
payload.data.forEach((winName) => {
|
|
6103
|
+
identityList.push({ uuid: this.identity.uuid, name: winName });
|
|
6104
|
+
});
|
|
6105
|
+
return this.windowListFromIdentityList(identityList);
|
|
6106
|
+
});
|
|
6107
|
+
}
|
|
6108
|
+
/**
|
|
6109
|
+
* Retrieves the JSON manifest that was used to create the application. Invokes the error callback
|
|
6110
|
+
* if the application was not created from a manifest.
|
|
6111
|
+
*
|
|
6112
|
+
* @example
|
|
6113
|
+
*
|
|
6114
|
+
* ```js
|
|
6115
|
+
* async function getManifest() {
|
|
6116
|
+
* const app = await fin.Application.getCurrent();
|
|
6117
|
+
* return await app.getManifest();
|
|
6118
|
+
* }
|
|
6119
|
+
*
|
|
6120
|
+
* getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
|
|
6121
|
+
* ```
|
|
6122
|
+
*/
|
|
6123
|
+
getManifest() {
|
|
6124
|
+
return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
|
|
6125
|
+
}
|
|
6126
|
+
/**
|
|
6127
|
+
* Retrieves UUID of the application that launches this application. Invokes the error callback
|
|
6128
|
+
* if the application was created from a manifest.
|
|
6129
|
+
*
|
|
6130
|
+
* @example
|
|
6131
|
+
*
|
|
6132
|
+
* ```js
|
|
6133
|
+
* async function getParentUuid() {
|
|
6134
|
+
* const app = await fin.Application.start({
|
|
6135
|
+
* uuid: 'app-1',
|
|
6136
|
+
* name: 'myApp',
|
|
6137
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
|
|
6138
|
+
* autoShow: true
|
|
6139
|
+
* });
|
|
6140
|
+
* return await app.getParentUuid();
|
|
6141
|
+
* }
|
|
6142
|
+
*
|
|
6143
|
+
* getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
|
|
6144
|
+
* ```
|
|
6145
|
+
*/
|
|
6146
|
+
getParentUuid() {
|
|
6147
|
+
return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
|
|
6148
|
+
}
|
|
6149
|
+
/**
|
|
6150
|
+
* Retrieves current application's shortcut configuration.
|
|
6151
|
+
*
|
|
6152
|
+
* @example
|
|
6153
|
+
*
|
|
6154
|
+
* ```js
|
|
6155
|
+
* async function getShortcuts() {
|
|
6156
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
|
6157
|
+
* return await app.getShortcuts();
|
|
6158
|
+
* }
|
|
6159
|
+
* getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
|
|
6160
|
+
* ```
|
|
6161
|
+
*/
|
|
6162
|
+
getShortcuts() {
|
|
6163
|
+
return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
|
|
6164
|
+
}
|
|
6165
|
+
/**
|
|
6166
|
+
* Retrieves current application's views.
|
|
6167
|
+
* @experimental
|
|
6168
|
+
*
|
|
6169
|
+
* @example
|
|
6170
|
+
*
|
|
6171
|
+
* ```js
|
|
6172
|
+
* async function getViews() {
|
|
6173
|
+
* const app = await fin.Application.getCurrent();
|
|
6174
|
+
* return await app.getViews();
|
|
6175
|
+
* }
|
|
6176
|
+
* getViews().then(views => console.log(views)).catch(err => console.log(err));
|
|
6177
|
+
* ```
|
|
6178
|
+
*/
|
|
6179
|
+
async getViews() {
|
|
6180
|
+
const { payload } = await this.wire.sendAction('application-get-views', this.identity);
|
|
6181
|
+
return payload.data.map((id) => new view_1.View(this.wire, id));
|
|
6182
|
+
}
|
|
6183
|
+
/**
|
|
6184
|
+
* Returns the current zoom level of the application.
|
|
6185
|
+
*
|
|
6186
|
+
* @example
|
|
6187
|
+
*
|
|
6188
|
+
* ```js
|
|
6189
|
+
* async function getZoomLevel() {
|
|
6190
|
+
* const app = await fin.Application.getCurrent();
|
|
6191
|
+
* return await app.getZoomLevel();
|
|
6192
|
+
* }
|
|
6193
|
+
*
|
|
6194
|
+
* getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
|
|
6195
|
+
* ```
|
|
6196
|
+
*/
|
|
6197
|
+
getZoomLevel() {
|
|
6198
|
+
return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
|
|
6199
|
+
}
|
|
6200
|
+
/**
|
|
6201
|
+
* Returns an instance of the main Window of the application
|
|
6202
|
+
*
|
|
6203
|
+
* @example
|
|
6204
|
+
*
|
|
6205
|
+
* ```js
|
|
6206
|
+
* async function getWindow() {
|
|
6207
|
+
* const app = await fin.Application.start({
|
|
6208
|
+
* uuid: 'app-1',
|
|
6209
|
+
* name: 'myApp',
|
|
6210
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
|
|
6211
|
+
* autoShow: true
|
|
6212
|
+
* });
|
|
6213
|
+
* return await app.getWindow();
|
|
6214
|
+
* }
|
|
6215
|
+
*
|
|
6216
|
+
* getWindow().then(win => {
|
|
6217
|
+
* win.showAt(0, 400);
|
|
6218
|
+
* win.flash();
|
|
6219
|
+
* }).catch(err => console.log(err));
|
|
6220
|
+
* ```
|
|
6221
|
+
*/
|
|
6222
|
+
getWindow() {
|
|
6223
|
+
this.wire.sendAction('application-get-window', this.identity).catch((e) => {
|
|
6224
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
6225
|
+
});
|
|
6226
|
+
return Promise.resolve(this.window);
|
|
6227
|
+
}
|
|
6228
|
+
/**
|
|
6229
|
+
* Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
|
|
6230
|
+
* @param userName - username to be passed to the RVM.
|
|
6231
|
+
* @param appName - app name to be passed to the RVM.
|
|
6232
|
+
*
|
|
6233
|
+
* @example
|
|
6234
|
+
*
|
|
6235
|
+
* ```js
|
|
6236
|
+
* async function registerUser() {
|
|
6237
|
+
* const app = await fin.Application.getCurrent();
|
|
6238
|
+
* return await app.registerUser('user', 'myApp');
|
|
6239
|
+
* }
|
|
6240
|
+
*
|
|
6241
|
+
* registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
|
|
6242
|
+
* ```
|
|
6243
|
+
*/
|
|
6244
|
+
registerUser(userName, appName) {
|
|
6245
|
+
return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
|
|
6246
|
+
}
|
|
6247
|
+
/**
|
|
6248
|
+
* Removes the application’s icon from the tray.
|
|
6249
|
+
*
|
|
6250
|
+
* @example
|
|
6251
|
+
*
|
|
6252
|
+
* ```js
|
|
6253
|
+
* async function removeTrayIcon() {
|
|
6254
|
+
* const app = await fin.Application.getCurrent();
|
|
6255
|
+
* return await app.removeTrayIcon();
|
|
6256
|
+
* }
|
|
6257
|
+
*
|
|
6258
|
+
* removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
|
|
6259
|
+
* ```
|
|
6260
|
+
*/
|
|
6261
|
+
removeTrayIcon() {
|
|
6262
|
+
return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
|
|
6263
|
+
}
|
|
6264
|
+
/**
|
|
6265
|
+
* Restarts the application.
|
|
6266
|
+
*
|
|
6267
|
+
* @example
|
|
6268
|
+
*
|
|
6269
|
+
* ```js
|
|
6270
|
+
* async function restartApp() {
|
|
6271
|
+
* const app = await fin.Application.getCurrent();
|
|
6272
|
+
* return await app.restart();
|
|
6273
|
+
* }
|
|
6274
|
+
* restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
|
|
6275
|
+
* ```
|
|
6276
|
+
*/
|
|
6277
|
+
restart() {
|
|
6278
|
+
return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
|
|
6279
|
+
}
|
|
6280
|
+
/**
|
|
6281
|
+
* DEPRECATED method to run the application.
|
|
6282
|
+
* Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
|
|
6283
|
+
*
|
|
6284
|
+
* @example
|
|
6285
|
+
*
|
|
6286
|
+
* ```js
|
|
6287
|
+
* async function run() {
|
|
6288
|
+
* const app = await fin.Application.create({
|
|
6289
|
+
* name: 'myApp',
|
|
6290
|
+
* uuid: 'app-1',
|
|
6291
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.run.html',
|
|
6292
|
+
* autoShow: true
|
|
6293
|
+
* });
|
|
6294
|
+
* await app.run();
|
|
6295
|
+
* }
|
|
6296
|
+
* run().then(() => console.log('Application is running')).catch(err => console.log(err));
|
|
6297
|
+
* ```
|
|
6298
|
+
*
|
|
6299
|
+
* @ignore
|
|
6300
|
+
*/
|
|
6301
|
+
run() {
|
|
6302
|
+
console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
|
|
6303
|
+
this.wire.sendAction('application-run', this.identity).catch((e) => {
|
|
6304
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
6305
|
+
});
|
|
6306
|
+
return this._run();
|
|
6307
|
+
}
|
|
6308
|
+
_run(opts = {}) {
|
|
6309
|
+
return this.wire
|
|
6310
|
+
.sendAction('run-application', {
|
|
6311
|
+
manifestUrl: this._manifestUrl,
|
|
6312
|
+
opts,
|
|
6313
|
+
...this.identity
|
|
6314
|
+
})
|
|
6315
|
+
.then(() => undefined);
|
|
6316
|
+
}
|
|
6317
|
+
/**
|
|
6318
|
+
* Instructs the RVM to schedule one restart of the application.
|
|
6319
|
+
*
|
|
6320
|
+
* @example
|
|
6321
|
+
*
|
|
6322
|
+
* ```js
|
|
6323
|
+
* async function scheduleRestart() {
|
|
6324
|
+
* const app = await fin.Application.getCurrent();
|
|
6325
|
+
* return await app.scheduleRestart();
|
|
6326
|
+
* }
|
|
6327
|
+
*
|
|
6328
|
+
* scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
|
|
6329
|
+
* ```
|
|
6330
|
+
*/
|
|
6331
|
+
scheduleRestart() {
|
|
6332
|
+
return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
|
|
6333
|
+
}
|
|
6334
|
+
/**
|
|
6335
|
+
* Sends a message to the RVM to upload the application's logs. On success,
|
|
6336
|
+
* an object containing logId is returned.
|
|
6337
|
+
*
|
|
6338
|
+
* @example
|
|
6339
|
+
*
|
|
6340
|
+
* ```js
|
|
6341
|
+
* async function sendLog() {
|
|
6342
|
+
* const app = await fin.Application.getCurrent();
|
|
6343
|
+
* return await app.sendApplicationLog();
|
|
6344
|
+
* }
|
|
6345
|
+
*
|
|
6346
|
+
* sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
|
|
6347
|
+
* ```
|
|
6348
|
+
*/
|
|
6349
|
+
async sendApplicationLog() {
|
|
6350
|
+
const { payload } = await this.wire.sendAction('send-application-log', this.identity);
|
|
6351
|
+
return payload.data;
|
|
6352
|
+
}
|
|
6353
|
+
/**
|
|
6354
|
+
* Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
|
|
6355
|
+
* If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
|
|
6356
|
+
*
|
|
6357
|
+
* Note: If the "name" property is omitted it defaults to "tasks".
|
|
6358
|
+
* @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
|
|
6359
|
+
*
|
|
6360
|
+
*
|
|
6361
|
+
* @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).
|
|
6362
|
+
*
|
|
6363
|
+
* The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's
|
|
6364
|
+
* **` shortcut.name `** and uses **` shortcut.company `** as a fallback. Clicking that item will launch the app from its current manifest.
|
|
6365
|
+
*
|
|
6366
|
+
* Note: If the "name" property is omitted it defaults to "tasks".
|
|
6367
|
+
*
|
|
6368
|
+
* Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the
|
|
6369
|
+
* uuid or shortcut.name is changed.
|
|
6370
|
+
*
|
|
6371
|
+
* @example
|
|
6372
|
+
*
|
|
6373
|
+
* ```js
|
|
6374
|
+
* const app = fin.Application.getCurrentSync();
|
|
6375
|
+
* const appName = 'My App';
|
|
6376
|
+
* const jumpListConfig = [ // array of JumpList categories
|
|
6377
|
+
* {
|
|
6378
|
+
* // has no name and no type so `type` is assumed to be "tasks"
|
|
6379
|
+
* items: [ // array of JumpList items
|
|
6380
|
+
* {
|
|
6381
|
+
* type: 'task',
|
|
6382
|
+
* title: `Launch ${appName}`,
|
|
6383
|
+
* description: `Runs ${appName} with the default configuration`,
|
|
6384
|
+
* deepLink: 'fins://path.to/app/manifest.json',
|
|
6385
|
+
* iconPath: 'https://path.to/app/icon.ico',
|
|
6386
|
+
* iconIndex: 0
|
|
6387
|
+
* },
|
|
6388
|
+
* { type: 'separator' },
|
|
6389
|
+
* {
|
|
6390
|
+
* type: 'task',
|
|
6391
|
+
* title: `Restore ${appName}`,
|
|
6392
|
+
* description: 'Restore to last configuration',
|
|
6393
|
+
* deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
|
|
6394
|
+
* iconPath: 'https://path.to/app/icon.ico',
|
|
6395
|
+
* iconIndex: 0
|
|
6396
|
+
* },
|
|
6397
|
+
* ]
|
|
6398
|
+
* },
|
|
6399
|
+
* {
|
|
6400
|
+
* name: 'Tools',
|
|
6401
|
+
* items: [ // array of JumpList items
|
|
6402
|
+
* {
|
|
6403
|
+
* type: 'task',
|
|
6404
|
+
* title: 'Tool A',
|
|
6405
|
+
* description: 'Runs Tool A',
|
|
6406
|
+
* deepLink: 'fins://path.to/tool-a/manifest.json',
|
|
6407
|
+
* iconPath: 'https://path.to/tool-a/icon.ico',
|
|
6408
|
+
* iconIndex: 0
|
|
6409
|
+
* },
|
|
6410
|
+
* {
|
|
6411
|
+
* type: 'task',
|
|
6412
|
+
* title: 'Tool B',
|
|
6413
|
+
* description: 'Runs Tool B',
|
|
6414
|
+
* deepLink: 'fins://path.to/tool-b/manifest.json',
|
|
6415
|
+
* iconPath: 'https://path.to/tool-b/icon.ico',
|
|
6416
|
+
* iconIndex: 0
|
|
6417
|
+
* }]
|
|
6418
|
+
* }
|
|
6419
|
+
* ];
|
|
6420
|
+
*
|
|
6421
|
+
* app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));
|
|
6422
|
+
* ```
|
|
6423
|
+
*
|
|
6424
|
+
* To handle deeplink args:
|
|
6425
|
+
* ```js
|
|
6426
|
+
* function handleUseLastConfiguration() {
|
|
6427
|
+
* // this handler is called when the app is being launched
|
|
6428
|
+
* app.on('run-requested', event => {
|
|
6429
|
+
* if(event.userAppConfigArgs['use-last-configuration']) {
|
|
6430
|
+
* // your logic here
|
|
6431
|
+
* }
|
|
6432
|
+
* });
|
|
6433
|
+
* // this handler is called when the app was already running when the launch was requested
|
|
6434
|
+
* fin.desktop.main(function(args) {
|
|
6435
|
+
* if(args && args['use-last-configuration']) {
|
|
6436
|
+
* // your logic here
|
|
6437
|
+
* }
|
|
6438
|
+
* });
|
|
6439
|
+
* }
|
|
6440
|
+
* ```
|
|
6441
|
+
*/
|
|
6442
|
+
async setJumpList(jumpListCategories) {
|
|
6443
|
+
await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
|
|
6444
|
+
}
|
|
6445
|
+
/**
|
|
6446
|
+
* Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
|
|
6447
|
+
* @param icon Image URL or base64 encoded string to be used as the icon
|
|
6448
|
+
*
|
|
6449
|
+
* @example
|
|
6450
|
+
*
|
|
6451
|
+
* ```js
|
|
6452
|
+
* const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
|
|
6453
|
+
* const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
|
|
6454
|
+
* ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
|
|
6455
|
+
* const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
|
|
6456
|
+
* xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
|
|
6457
|
+
*
|
|
6458
|
+
* async function setTrayIcon(icon) {
|
|
6459
|
+
* const app = await fin.Application.getCurrent();
|
|
6460
|
+
* return await app.setTrayIcon(icon);
|
|
6461
|
+
* }
|
|
6462
|
+
*
|
|
6463
|
+
* // use image url to set tray icon
|
|
6464
|
+
* setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
|
6465
|
+
*
|
|
6466
|
+
* // use base64 encoded string to set tray icon
|
|
6467
|
+
* setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
|
6468
|
+
*
|
|
6469
|
+
* // use a dataURL to set tray icon
|
|
6470
|
+
* setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
|
6471
|
+
* ```
|
|
6472
|
+
*/
|
|
6473
|
+
setTrayIcon(icon) {
|
|
6474
|
+
return this.wire
|
|
6475
|
+
.sendAction('set-tray-icon', {
|
|
6476
|
+
enabledIcon: icon,
|
|
6477
|
+
...this.identity
|
|
6478
|
+
})
|
|
6479
|
+
.then(() => undefined);
|
|
6480
|
+
}
|
|
6481
|
+
/**
|
|
6482
|
+
* Set hover text for this application's system tray icon.
|
|
6483
|
+
* Note: Application must first set a tray icon with {@link Application.setTrayIcon}.
|
|
6484
|
+
* @param toolTip
|
|
6485
|
+
*
|
|
6486
|
+
* @example
|
|
6487
|
+
*
|
|
6488
|
+
* ```js
|
|
6489
|
+
* const app = fin.Application.getCurrentSync();
|
|
6490
|
+
* const iconUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
|
|
6491
|
+
*
|
|
6492
|
+
* await app.setTrayIcon(iconUrl);
|
|
6493
|
+
*
|
|
6494
|
+
* await app.setTrayIconToolTip('My Application');
|
|
6495
|
+
* ```
|
|
6496
|
+
*/
|
|
6497
|
+
async setTrayIconToolTip(toolTip) {
|
|
6498
|
+
await this.wire.sendAction('set-tray-icon-tooltip', { ...this.identity, toolTip });
|
|
6499
|
+
}
|
|
6500
|
+
/**
|
|
6501
|
+
* Sets new application's shortcut configuration. Windows only.
|
|
6502
|
+
* @param config New application's shortcut configuration.
|
|
6503
|
+
*
|
|
6504
|
+
* @remarks Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest
|
|
6505
|
+
* to be able to change shortcut states.
|
|
6506
|
+
*
|
|
6507
|
+
* @example
|
|
6508
|
+
*
|
|
6509
|
+
* ```js
|
|
6510
|
+
* async function setShortcuts(config) {
|
|
6511
|
+
* const app = await fin.Application.getCurrent();
|
|
6512
|
+
* return app.setShortcuts(config);
|
|
6513
|
+
* }
|
|
6514
|
+
*
|
|
6515
|
+
* setShortcuts({
|
|
6516
|
+
* desktop: true,
|
|
6517
|
+
* startMenu: false,
|
|
6518
|
+
* systemStartup: true
|
|
6519
|
+
* }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
|
|
6520
|
+
* ```
|
|
6521
|
+
*/
|
|
6522
|
+
setShortcuts(config) {
|
|
6523
|
+
return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
|
|
6524
|
+
}
|
|
6525
|
+
/**
|
|
6526
|
+
* Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
|
|
6527
|
+
* @param queryString The new query string for this app's shortcuts.
|
|
6528
|
+
*
|
|
6529
|
+
* @example
|
|
6530
|
+
*
|
|
6531
|
+
* ```js
|
|
6532
|
+
* const newQueryArgs = 'arg=true&arg2=false';
|
|
6533
|
+
* const app = await fin.Application.getCurrent();
|
|
6534
|
+
* try {
|
|
6535
|
+
* await app.setShortcutQueryParams(newQueryArgs);
|
|
6536
|
+
* } catch(err) {
|
|
6537
|
+
* console.error(err)
|
|
6538
|
+
* }
|
|
6539
|
+
* ```
|
|
6540
|
+
*/
|
|
6541
|
+
async setShortcutQueryParams(queryString) {
|
|
6542
|
+
await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
|
|
6543
|
+
}
|
|
6544
|
+
/**
|
|
6545
|
+
* Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
|
|
6546
|
+
* larger or smaller to default limits of 300% and 50% of original size, respectively.
|
|
6547
|
+
* @param level The zoom level
|
|
6548
|
+
*
|
|
6549
|
+
* @example
|
|
6550
|
+
*
|
|
6551
|
+
* ```js
|
|
6552
|
+
* async function setZoomLevel(number) {
|
|
6553
|
+
* const app = await fin.Application.getCurrent();
|
|
6554
|
+
* return await app.setZoomLevel(number);
|
|
6555
|
+
* }
|
|
6556
|
+
*
|
|
6557
|
+
* setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
|
|
6558
|
+
* ```
|
|
6559
|
+
*/
|
|
6560
|
+
setZoomLevel(level) {
|
|
6561
|
+
return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
|
|
6562
|
+
}
|
|
6563
|
+
/**
|
|
6564
|
+
* Sets a username to correlate with App Log Management.
|
|
6565
|
+
* @param username Username to correlate with App's Log.
|
|
6566
|
+
*
|
|
6567
|
+
* @example
|
|
6568
|
+
*
|
|
6569
|
+
* ```js
|
|
6570
|
+
* async function setAppLogUser() {
|
|
6571
|
+
* const app = await fin.Application.getCurrent();
|
|
6572
|
+
* return await app.setAppLogUsername('username');
|
|
6573
|
+
* }
|
|
6574
|
+
*
|
|
6575
|
+
* setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
|
|
6576
|
+
*
|
|
6577
|
+
* ```
|
|
6578
|
+
*/
|
|
6579
|
+
async setAppLogUsername(username) {
|
|
6580
|
+
await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
|
|
6581
|
+
}
|
|
6582
|
+
/**
|
|
6583
|
+
* Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
|
|
6584
|
+
* @remarks The only information currently returned is the position and dimensions.
|
|
6585
|
+
*
|
|
6586
|
+
* @example
|
|
6587
|
+
*
|
|
6588
|
+
* ```js
|
|
6589
|
+
* async function getTrayIconInfo() {
|
|
6590
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
|
6591
|
+
* return await app.getTrayIconInfo();
|
|
6592
|
+
* }
|
|
6593
|
+
* getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
|
|
6594
|
+
* ```
|
|
6595
|
+
*/
|
|
6596
|
+
getTrayIconInfo() {
|
|
6597
|
+
return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
|
|
6598
|
+
}
|
|
6599
|
+
/**
|
|
6600
|
+
* Checks if the application has an associated tray icon.
|
|
6601
|
+
*
|
|
6602
|
+
* @example
|
|
6603
|
+
*
|
|
6604
|
+
* ```js
|
|
6605
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
|
6606
|
+
* const hasTrayIcon = await app.hasTrayIcon();
|
|
6607
|
+
* console.log(hasTrayIcon);
|
|
6608
|
+
* ```
|
|
6609
|
+
*/
|
|
6610
|
+
hasTrayIcon() {
|
|
6611
|
+
return this.wire.sendAction('has-tray-icon', this.identity).then(({ payload }) => payload.data);
|
|
6612
|
+
}
|
|
6613
|
+
/**
|
|
6614
|
+
* Closes the application by terminating its process.
|
|
6615
|
+
*
|
|
6616
|
+
* @example
|
|
6617
|
+
*
|
|
6618
|
+
* ```js
|
|
6619
|
+
* async function terminateApp() {
|
|
6620
|
+
* const app = await fin.Application.getCurrent();
|
|
6621
|
+
* return await app.terminate();
|
|
6622
|
+
* }
|
|
6623
|
+
* terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));
|
|
6624
|
+
* ```
|
|
6625
|
+
*/
|
|
6626
|
+
terminate() {
|
|
6627
|
+
return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
|
|
6628
|
+
}
|
|
6629
|
+
/**
|
|
6630
|
+
* Waits for a hanging application. This method can be called in response to an application
|
|
6631
|
+
* "not-responding" to allow the application to continue and to generate another "not-responding"
|
|
6632
|
+
* message after a certain period of time.
|
|
6633
|
+
*
|
|
6634
|
+
* @ignore
|
|
6635
|
+
*/
|
|
6636
|
+
wait() {
|
|
6637
|
+
return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
|
|
6638
|
+
}
|
|
6639
|
+
/**
|
|
6640
|
+
* Retrieves information about the application.
|
|
6641
|
+
*
|
|
6642
|
+
* @remarks If the application was not launched from a manifest, the call will return the closest parent application `manifest`
|
|
6643
|
+
* and `manifestUrl`. `initialOptions` shows the parameters used when launched programmatically, or the `startup_app` options
|
|
6644
|
+
* if launched from manifest. The `parentUuid` will be the uuid of the immediate parent (if applicable).
|
|
6645
|
+
*
|
|
6646
|
+
* @example
|
|
6647
|
+
*
|
|
6648
|
+
* ```js
|
|
6649
|
+
* async function getInfo() {
|
|
6650
|
+
* const app = await fin.Application.getCurrent();
|
|
6651
|
+
* return await app.getInfo();
|
|
6652
|
+
* }
|
|
6653
|
+
*
|
|
6654
|
+
* getInfo().then(info => console.log(info)).catch(err => console.log(err));
|
|
6655
|
+
* ```
|
|
6656
|
+
*/
|
|
6657
|
+
getInfo() {
|
|
6658
|
+
return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
|
|
6659
|
+
}
|
|
6660
|
+
/**
|
|
6661
|
+
* Retrieves all process information for entities (windows and views) associated with an application.
|
|
6662
|
+
*
|
|
6663
|
+
* @example
|
|
6664
|
+
* ```js
|
|
6665
|
+
* const app = await fin.Application.getCurrent();
|
|
6666
|
+
* const processInfo = await app.getProcessInfo();
|
|
6667
|
+
* ```
|
|
6668
|
+
* @experimental
|
|
6669
|
+
*/
|
|
6670
|
+
async getProcessInfo() {
|
|
6671
|
+
const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
|
|
6672
|
+
return data;
|
|
6673
|
+
}
|
|
6674
|
+
/**
|
|
6675
|
+
* Sets file auto download location. It's only allowed in the same application.
|
|
6676
|
+
*
|
|
6677
|
+
* Note: This method is restricted by default and must be enabled via
|
|
6678
|
+
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
|
6679
|
+
* @param downloadLocation file auto download location
|
|
6680
|
+
*
|
|
6681
|
+
* @throws if setting file auto download location on different applications.
|
|
6682
|
+
* @example
|
|
6683
|
+
*
|
|
6684
|
+
* ```js
|
|
6685
|
+
* const downloadLocation = 'C:\\dev\\temp';
|
|
6686
|
+
* const app = await fin.Application.getCurrent();
|
|
6687
|
+
* try {
|
|
6688
|
+
* await app.setFileDownloadLocation(downloadLocation);
|
|
6689
|
+
* console.log('File download location is set');
|
|
6690
|
+
* } catch(err) {
|
|
6691
|
+
* console.error(err)
|
|
6692
|
+
* }
|
|
6693
|
+
* ```
|
|
6694
|
+
*/
|
|
6695
|
+
async setFileDownloadLocation(downloadLocation) {
|
|
6696
|
+
const { name } = this.wire.me;
|
|
6697
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
|
6698
|
+
await this.wire.sendAction('set-file-download-location', { ...entityIdentity, downloadLocation });
|
|
6699
|
+
}
|
|
6700
|
+
/**
|
|
6701
|
+
* 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.
|
|
6702
|
+
*
|
|
6703
|
+
* Note: This method is restricted by default and must be enabled via
|
|
6704
|
+
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
|
6705
|
+
*
|
|
6706
|
+
* @throws if getting file auto download location on different applications.
|
|
6707
|
+
* @example
|
|
6708
|
+
*
|
|
6709
|
+
* ```js
|
|
6710
|
+
* const app = await fin.Application.getCurrent();
|
|
6711
|
+
* const fileDownloadDir = await app.getFileDownloadLocation();
|
|
6712
|
+
* ```
|
|
6713
|
+
*/
|
|
6714
|
+
async getFileDownloadLocation() {
|
|
6715
|
+
const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
|
|
6716
|
+
return data;
|
|
6717
|
+
}
|
|
6718
|
+
/**
|
|
6719
|
+
* Shows a menu on the tray icon. Use with tray-icon-clicked event.
|
|
6720
|
+
* @param options
|
|
6721
|
+
* @typeParam Data User-defined shape for data returned upon menu item click. Should be a
|
|
6722
|
+
* [union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
|
|
6723
|
+
* of all possible data shapes for the entire menu, and the click handler should process
|
|
6724
|
+
* these with a "reducer" pattern.
|
|
6725
|
+
* @throws if the application has no tray icon set
|
|
6726
|
+
* @throws if the system tray is currently hidden
|
|
6727
|
+
* @example
|
|
6728
|
+
*
|
|
6729
|
+
* ```js
|
|
6730
|
+
* const iconUrl = 'http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png';
|
|
6731
|
+
* const app = fin.Application.getCurrentSync();
|
|
6732
|
+
*
|
|
6733
|
+
* await app.setTrayIcon(iconUrl);
|
|
6734
|
+
*
|
|
6735
|
+
* const template = [
|
|
6736
|
+
* {
|
|
6737
|
+
* label: 'Menu Item 1',
|
|
6738
|
+
* data: 'hello from item 1'
|
|
6739
|
+
* },
|
|
6740
|
+
* { type: 'separator' },
|
|
6741
|
+
* {
|
|
6742
|
+
* label: 'Menu Item 2',
|
|
6743
|
+
* type: 'checkbox',
|
|
6744
|
+
* checked: true,
|
|
6745
|
+
* data: 'The user clicked the checkbox'
|
|
6746
|
+
* },
|
|
6747
|
+
* {
|
|
6748
|
+
* label: 'see more',
|
|
6749
|
+
* enabled: false,
|
|
6750
|
+
* submenu: [
|
|
6751
|
+
* { label: 'submenu 1', data: 'hello from submenu' }
|
|
6752
|
+
* ]
|
|
6753
|
+
* }
|
|
6754
|
+
* ];
|
|
6755
|
+
*
|
|
6756
|
+
* app.addListener('tray-icon-clicked', (event) => {
|
|
6757
|
+
* // right-click
|
|
6758
|
+
* if (event.button === 2) {
|
|
6759
|
+
* app.showTrayIconPopupMenu({ template }).then(r => {
|
|
6760
|
+
* if (r.result === 'closed') {
|
|
6761
|
+
* console.log('nothing happened');
|
|
6762
|
+
* } else {
|
|
6763
|
+
* console.log(r.data);
|
|
6764
|
+
* }
|
|
6765
|
+
* });
|
|
6766
|
+
* }
|
|
6767
|
+
* });
|
|
6768
|
+
* ```
|
|
6769
|
+
*/
|
|
6770
|
+
async showTrayIconPopupMenu(options) {
|
|
6771
|
+
const { name } = this.wire.me;
|
|
6772
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
|
6773
|
+
const { payload } = await this.wire.sendAction('show-tray-icon-popup-menu', { ...entityIdentity, options });
|
|
6774
|
+
return payload.data;
|
|
6775
|
+
}
|
|
6776
|
+
/**
|
|
6777
|
+
* Closes the tray icon menu.
|
|
6778
|
+
*
|
|
6779
|
+
* @throws if the application has no tray icon set
|
|
6780
|
+
* @example
|
|
6781
|
+
*
|
|
6782
|
+
* ```js
|
|
6783
|
+
* const app = fin.Application.getCurrentSync();
|
|
6784
|
+
*
|
|
6785
|
+
* await app.closeTrayIconPopupMenu();
|
|
6786
|
+
* ```
|
|
6787
|
+
*/
|
|
6788
|
+
async closeTrayIconPopupMenu() {
|
|
6789
|
+
const { name } = this.wire.me;
|
|
6790
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
|
6791
|
+
await this.wire.sendAction('close-tray-icon-popup-menu', { ...entityIdentity });
|
|
6792
|
+
}
|
|
6801
6793
|
}
|
|
6794
|
+
Instance$5.Application = Application;
|
|
6802
6795
|
|
|
6803
|
-
|
|
6796
|
+
Object.defineProperty(Factory$5, "__esModule", { value: true });
|
|
6797
|
+
Factory$5.ApplicationModule = void 0;
|
|
6798
|
+
const base_1$i = base;
|
|
6799
|
+
const validate_1$4 = validate;
|
|
6800
|
+
const Instance_1$5 = Instance$5;
|
|
6801
|
+
/**
|
|
6802
|
+
* Static namespace for OpenFin API methods that interact with the {@link Application} class, available under `fin.Application`.
|
|
6803
|
+
*/
|
|
6804
|
+
class ApplicationModule extends base_1$i.Base {
|
|
6805
|
+
/**
|
|
6806
|
+
* Asynchronously returns an API handle for the given Application identity.
|
|
6807
|
+
*
|
|
6808
|
+
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
|
6809
|
+
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
|
6810
|
+
* for an Application throughout its entire lifecycle.
|
|
6811
|
+
*
|
|
6812
|
+
* @example
|
|
6813
|
+
*
|
|
6814
|
+
* ```js
|
|
6815
|
+
* fin.Application.wrap({ uuid: 'testapp' })
|
|
6816
|
+
* .then(app => app.isRunning())
|
|
6817
|
+
* .then(running => console.log('Application is running: ' + running))
|
|
6818
|
+
* .catch(err => console.log(err));
|
|
6819
|
+
* ```
|
|
6820
|
+
*
|
|
6821
|
+
*/
|
|
6822
|
+
async wrap(identity) {
|
|
6823
|
+
this.wire.sendAction('wrap-application').catch((e) => {
|
|
6824
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
6825
|
+
});
|
|
6826
|
+
const errorMsg = (0, validate_1$4.validateIdentity)(identity);
|
|
6827
|
+
if (errorMsg) {
|
|
6828
|
+
throw new Error(errorMsg);
|
|
6829
|
+
}
|
|
6830
|
+
return new Instance_1$5.Application(this.wire, identity);
|
|
6831
|
+
}
|
|
6832
|
+
/**
|
|
6833
|
+
* Synchronously returns an API handle for the given Application identity.
|
|
6834
|
+
*
|
|
6835
|
+
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
|
6836
|
+
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
|
6837
|
+
* for an Aplication throughout its entire lifecycle.
|
|
6838
|
+
*
|
|
6839
|
+
* @example
|
|
6840
|
+
*
|
|
6841
|
+
* ```js
|
|
6842
|
+
* const app = fin.Application.wrapSync({ uuid: 'testapp' });
|
|
6843
|
+
* await app.close();
|
|
6844
|
+
* ```
|
|
6845
|
+
*
|
|
6846
|
+
*/
|
|
6847
|
+
wrapSync(identity) {
|
|
6848
|
+
this.wire.sendAction('wrap-application-sync').catch((e) => {
|
|
6849
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
6850
|
+
});
|
|
6851
|
+
const errorMsg = (0, validate_1$4.validateIdentity)(identity);
|
|
6852
|
+
if (errorMsg) {
|
|
6853
|
+
throw new Error(errorMsg);
|
|
6854
|
+
}
|
|
6855
|
+
return new Instance_1$5.Application(this.wire, identity);
|
|
6856
|
+
}
|
|
6857
|
+
async _create(appOptions) {
|
|
6858
|
+
// set defaults:
|
|
6859
|
+
if (appOptions.waitForPageLoad === undefined) {
|
|
6860
|
+
appOptions.waitForPageLoad = false;
|
|
6861
|
+
}
|
|
6862
|
+
if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
|
|
6863
|
+
appOptions.autoShow = true;
|
|
6864
|
+
}
|
|
6865
|
+
await this.wire.sendAction('create-application', appOptions);
|
|
6866
|
+
return this.wrap({ uuid: appOptions.uuid });
|
|
6867
|
+
}
|
|
6868
|
+
/**
|
|
6869
|
+
* DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
|
|
6870
|
+
*
|
|
6871
|
+
* @example
|
|
6872
|
+
*
|
|
6873
|
+
* ```js
|
|
6874
|
+
* async function createApp() {
|
|
6875
|
+
* const app = await fin.Application.create({
|
|
6876
|
+
* name: 'myApp',
|
|
6877
|
+
* uuid: 'app-3',
|
|
6878
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
|
|
6879
|
+
* autoShow: true
|
|
6880
|
+
* });
|
|
6881
|
+
* await app.run();
|
|
6882
|
+
* }
|
|
6883
|
+
*
|
|
6884
|
+
* createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
|
|
6885
|
+
* ```
|
|
6886
|
+
*
|
|
6887
|
+
* @ignore
|
|
6888
|
+
*/
|
|
6889
|
+
create(appOptions) {
|
|
6890
|
+
console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
|
|
6891
|
+
this.wire.sendAction('application-create').catch((e) => {
|
|
6892
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
6893
|
+
});
|
|
6894
|
+
return this._create(appOptions);
|
|
6895
|
+
}
|
|
6896
|
+
/**
|
|
6897
|
+
* Creates and starts a new Application.
|
|
6898
|
+
*
|
|
6899
|
+
* @example
|
|
6900
|
+
*
|
|
6901
|
+
* ```js
|
|
6902
|
+
* async function start() {
|
|
6903
|
+
* return fin.Application.start({
|
|
6904
|
+
* name: 'app-1',
|
|
6905
|
+
* uuid: 'app-1',
|
|
6906
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
|
|
6907
|
+
* autoShow: true
|
|
6908
|
+
* });
|
|
6909
|
+
* }
|
|
6910
|
+
* start().then(() => console.log('Application is running')).catch(err => console.log(err));
|
|
6911
|
+
* ```
|
|
6912
|
+
*
|
|
6913
|
+
*/
|
|
6914
|
+
async start(appOptions) {
|
|
6915
|
+
this.wire.sendAction('start-application').catch((e) => {
|
|
6916
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
6917
|
+
});
|
|
6918
|
+
const app = await this._create(appOptions);
|
|
6919
|
+
await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
|
|
6920
|
+
return app;
|
|
6921
|
+
}
|
|
6922
|
+
/**
|
|
6923
|
+
* Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
|
|
6924
|
+
* Returns once the RVM is finished attempting to launch the applications.
|
|
6925
|
+
* @param opts - Parameters that the RVM will use.
|
|
6926
|
+
*
|
|
6927
|
+
* @example
|
|
6928
|
+
*
|
|
6929
|
+
* ```js
|
|
6930
|
+
*
|
|
6931
|
+
* const applicationInfoArray = [
|
|
6932
|
+
* {
|
|
6933
|
+
* "uuid": 'App-1',
|
|
6934
|
+
* "manifestUrl": 'http://localhost:5555/app1.json',
|
|
6935
|
+
* },
|
|
6936
|
+
* {
|
|
6937
|
+
* "uuid": 'App-2',
|
|
6938
|
+
* "manifestUrl": 'http://localhost:5555/app2.json',
|
|
6939
|
+
* },
|
|
6940
|
+
* {
|
|
6941
|
+
* "uuid": 'App-3',
|
|
6942
|
+
* "manifestUrl": 'http://localhost:5555/app3.json',
|
|
6943
|
+
* }
|
|
6944
|
+
* ]
|
|
6945
|
+
*
|
|
6946
|
+
* fin.Application.startManyManifests(applicationInfoArray)
|
|
6947
|
+
* .then(() => {
|
|
6948
|
+
* console.log('RVM has finished launching the application list.');
|
|
6949
|
+
* })
|
|
6950
|
+
* .catch((err) => {
|
|
6951
|
+
* console.log(err);
|
|
6952
|
+
* })
|
|
6953
|
+
* ```
|
|
6954
|
+
*
|
|
6955
|
+
* @experimental
|
|
6956
|
+
*/
|
|
6957
|
+
async startManyManifests(applications, opts) {
|
|
6958
|
+
return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
|
|
6959
|
+
}
|
|
6960
|
+
/**
|
|
6961
|
+
* Asynchronously returns an Application object that represents the current application
|
|
6962
|
+
*
|
|
6963
|
+
* @example
|
|
6964
|
+
*
|
|
6965
|
+
* ```js
|
|
6966
|
+
* async function isCurrentAppRunning () {
|
|
6967
|
+
* const app = await fin.Application.getCurrent();
|
|
6968
|
+
* return app.isRunning();
|
|
6969
|
+
* }
|
|
6970
|
+
*
|
|
6971
|
+
* isCurrentAppRunning().then(running => {
|
|
6972
|
+
* console.log(`Current app is running: ${running}`);
|
|
6973
|
+
* }).catch(err => {
|
|
6974
|
+
* console.error(err);
|
|
6975
|
+
* });
|
|
6976
|
+
*
|
|
6977
|
+
* ```
|
|
6978
|
+
*/
|
|
6979
|
+
getCurrent() {
|
|
6980
|
+
this.wire.sendAction('get-current-application').catch((e) => {
|
|
6981
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
6982
|
+
});
|
|
6983
|
+
return this.wrap({ uuid: this.wire.me.uuid });
|
|
6984
|
+
}
|
|
6985
|
+
/**
|
|
6986
|
+
* Synchronously returns an Application object that represents the current application
|
|
6987
|
+
*
|
|
6988
|
+
* @example
|
|
6989
|
+
*
|
|
6990
|
+
* ```js
|
|
6991
|
+
* async function isCurrentAppRunning () {
|
|
6992
|
+
* const app = fin.Application.getCurrentSync();
|
|
6993
|
+
* return app.isRunning();
|
|
6994
|
+
* }
|
|
6995
|
+
*
|
|
6996
|
+
* isCurrentAppRunning().then(running => {
|
|
6997
|
+
* console.log(`Current app is running: ${running}`);
|
|
6998
|
+
* }).catch(err => {
|
|
6999
|
+
* console.error(err);
|
|
7000
|
+
* });
|
|
7001
|
+
*
|
|
7002
|
+
* ```
|
|
7003
|
+
*/
|
|
7004
|
+
getCurrentSync() {
|
|
7005
|
+
this.wire.sendAction('get-current-application-sync').catch((e) => {
|
|
7006
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
7007
|
+
});
|
|
7008
|
+
return this.wrapSync({ uuid: this.wire.me.uuid });
|
|
7009
|
+
}
|
|
7010
|
+
/**
|
|
7011
|
+
* Retrieves application's manifest and returns a running instance of the application.
|
|
7012
|
+
* @param manifestUrl - The URL of app's manifest.
|
|
7013
|
+
* @param opts - Parameters that the RVM will use.
|
|
7014
|
+
*
|
|
7015
|
+
* @example
|
|
7016
|
+
*
|
|
7017
|
+
* ```js
|
|
7018
|
+
* fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
|
7019
|
+
*
|
|
7020
|
+
* // For a local manifest file:
|
|
7021
|
+
* fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
|
7022
|
+
* ```
|
|
7023
|
+
*/
|
|
7024
|
+
async startFromManifest(manifestUrl, opts) {
|
|
7025
|
+
this.wire.sendAction('application-start-from-manifest').catch((e) => {
|
|
7026
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
7027
|
+
});
|
|
7028
|
+
const app = await this._createFromManifest(manifestUrl);
|
|
7029
|
+
// @ts-expect-error using private method without warning.
|
|
7030
|
+
await app._run(opts); // eslint-disable-line no-underscore-dangle
|
|
7031
|
+
return app;
|
|
7032
|
+
}
|
|
7033
|
+
/**
|
|
7034
|
+
* @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
|
|
7035
|
+
* Retrieves application's manifest and returns a wrapped application.
|
|
7036
|
+
* @param manifestUrl - The URL of app's manifest.
|
|
7037
|
+
* @param callback - called if the method succeeds.
|
|
7038
|
+
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
|
7039
|
+
*
|
|
7040
|
+
* @example
|
|
7041
|
+
*
|
|
7042
|
+
* ```js
|
|
7043
|
+
* fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
|
|
7044
|
+
* ```
|
|
7045
|
+
* @ignore
|
|
7046
|
+
*/
|
|
7047
|
+
createFromManifest(manifestUrl) {
|
|
7048
|
+
console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
|
|
7049
|
+
this.wire.sendAction('application-create-from-manifest').catch((e) => {
|
|
7050
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
7051
|
+
});
|
|
7052
|
+
return this._createFromManifest(manifestUrl);
|
|
7053
|
+
}
|
|
7054
|
+
_createFromManifest(manifestUrl) {
|
|
7055
|
+
return this.wire
|
|
7056
|
+
.sendAction('get-application-manifest', { manifestUrl })
|
|
7057
|
+
.then(({ payload }) => {
|
|
7058
|
+
const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
|
|
7059
|
+
return this.wrap({ uuid });
|
|
7060
|
+
})
|
|
7061
|
+
.then((app) => {
|
|
7062
|
+
app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
|
|
7063
|
+
return app;
|
|
7064
|
+
});
|
|
7065
|
+
}
|
|
7066
|
+
}
|
|
7067
|
+
Factory$5.ApplicationModule = ApplicationModule;
|
|
6804
7068
|
|
|
6805
|
-
function
|
|
6806
|
-
|
|
6807
|
-
|
|
6808
|
-
|
|
6809
|
-
|
|
6810
|
-
|
|
6811
|
-
|
|
6812
|
-
|
|
7069
|
+
(function (exports) {
|
|
7070
|
+
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7071
|
+
if (k2 === undefined) k2 = k;
|
|
7072
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7073
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7074
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7075
|
+
}
|
|
7076
|
+
Object.defineProperty(o, k2, desc);
|
|
7077
|
+
}) : (function(o, m, k, k2) {
|
|
7078
|
+
if (k2 === undefined) k2 = k;
|
|
7079
|
+
o[k2] = m[k];
|
|
7080
|
+
}));
|
|
7081
|
+
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
|
7082
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
7083
|
+
};
|
|
7084
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6813
7085
|
/**
|
|
6814
|
-
*
|
|
7086
|
+
* Entry points for the OpenFin `Application` API (`fin.Application`).
|
|
7087
|
+
*
|
|
7088
|
+
* * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
|
|
7089
|
+
* * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
|
|
7090
|
+
*
|
|
7091
|
+
* 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),
|
|
7092
|
+
* both of these were documented on the same page.
|
|
7093
|
+
*
|
|
7094
|
+
* @packageDocumentation
|
|
6815
7095
|
*/
|
|
6816
|
-
|
|
6817
|
-
|
|
6818
|
-
|
|
6819
|
-
*
|
|
6820
|
-
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
|
6821
|
-
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
|
6822
|
-
* for an Application throughout its entire lifecycle.
|
|
6823
|
-
*
|
|
6824
|
-
* @example
|
|
6825
|
-
*
|
|
6826
|
-
* ```js
|
|
6827
|
-
* fin.Application.wrap({ uuid: 'testapp' })
|
|
6828
|
-
* .then(app => app.isRunning())
|
|
6829
|
-
* .then(running => console.log('Application is running: ' + running))
|
|
6830
|
-
* .catch(err => console.log(err));
|
|
6831
|
-
* ```
|
|
6832
|
-
*
|
|
6833
|
-
*/
|
|
6834
|
-
async wrap(identity) {
|
|
6835
|
-
this.wire.sendAction('wrap-application').catch((e) => {
|
|
6836
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
6837
|
-
});
|
|
6838
|
-
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
|
6839
|
-
if (errorMsg) {
|
|
6840
|
-
throw new Error(errorMsg);
|
|
6841
|
-
}
|
|
6842
|
-
return new Instance_1.Application(this.wire, identity);
|
|
6843
|
-
}
|
|
6844
|
-
/**
|
|
6845
|
-
* Synchronously returns an API handle for the given Application identity.
|
|
6846
|
-
*
|
|
6847
|
-
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
|
6848
|
-
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
|
6849
|
-
* for an Aplication throughout its entire lifecycle.
|
|
6850
|
-
*
|
|
6851
|
-
* @example
|
|
6852
|
-
*
|
|
6853
|
-
* ```js
|
|
6854
|
-
* const app = fin.Application.wrapSync({ uuid: 'testapp' });
|
|
6855
|
-
* await app.close();
|
|
6856
|
-
* ```
|
|
6857
|
-
*
|
|
6858
|
-
*/
|
|
6859
|
-
wrapSync(identity) {
|
|
6860
|
-
this.wire.sendAction('wrap-application-sync').catch((e) => {
|
|
6861
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
6862
|
-
});
|
|
6863
|
-
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
|
6864
|
-
if (errorMsg) {
|
|
6865
|
-
throw new Error(errorMsg);
|
|
6866
|
-
}
|
|
6867
|
-
return new Instance_1.Application(this.wire, identity);
|
|
6868
|
-
}
|
|
6869
|
-
async _create(appOptions) {
|
|
6870
|
-
// set defaults:
|
|
6871
|
-
if (appOptions.waitForPageLoad === undefined) {
|
|
6872
|
-
appOptions.waitForPageLoad = false;
|
|
6873
|
-
}
|
|
6874
|
-
if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
|
|
6875
|
-
appOptions.autoShow = true;
|
|
6876
|
-
}
|
|
6877
|
-
await this.wire.sendAction('create-application', appOptions);
|
|
6878
|
-
return this.wrap({ uuid: appOptions.uuid });
|
|
6879
|
-
}
|
|
6880
|
-
/**
|
|
6881
|
-
* DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
|
|
6882
|
-
*
|
|
6883
|
-
* @example
|
|
6884
|
-
*
|
|
6885
|
-
* ```js
|
|
6886
|
-
* async function createApp() {
|
|
6887
|
-
* const app = await fin.Application.create({
|
|
6888
|
-
* name: 'myApp',
|
|
6889
|
-
* uuid: 'app-3',
|
|
6890
|
-
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
|
|
6891
|
-
* autoShow: true
|
|
6892
|
-
* });
|
|
6893
|
-
* await app.run();
|
|
6894
|
-
* }
|
|
6895
|
-
*
|
|
6896
|
-
* createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
|
|
6897
|
-
* ```
|
|
6898
|
-
*
|
|
6899
|
-
* @ignore
|
|
6900
|
-
*/
|
|
6901
|
-
create(appOptions) {
|
|
6902
|
-
console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
|
|
6903
|
-
this.wire.sendAction('application-create').catch((e) => {
|
|
6904
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
6905
|
-
});
|
|
6906
|
-
return this._create(appOptions);
|
|
6907
|
-
}
|
|
6908
|
-
/**
|
|
6909
|
-
* Creates and starts a new Application.
|
|
6910
|
-
*
|
|
6911
|
-
* @example
|
|
6912
|
-
*
|
|
6913
|
-
* ```js
|
|
6914
|
-
* async function start() {
|
|
6915
|
-
* return fin.Application.start({
|
|
6916
|
-
* name: 'app-1',
|
|
6917
|
-
* uuid: 'app-1',
|
|
6918
|
-
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
|
|
6919
|
-
* autoShow: true
|
|
6920
|
-
* });
|
|
6921
|
-
* }
|
|
6922
|
-
* start().then(() => console.log('Application is running')).catch(err => console.log(err));
|
|
6923
|
-
* ```
|
|
6924
|
-
*
|
|
6925
|
-
*/
|
|
6926
|
-
async start(appOptions) {
|
|
6927
|
-
this.wire.sendAction('start-application').catch((e) => {
|
|
6928
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
6929
|
-
});
|
|
6930
|
-
const app = await this._create(appOptions);
|
|
6931
|
-
await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
|
|
6932
|
-
return app;
|
|
6933
|
-
}
|
|
6934
|
-
/**
|
|
6935
|
-
* Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
|
|
6936
|
-
* Returns once the RVM is finished attempting to launch the applications.
|
|
6937
|
-
* @param opts - Parameters that the RVM will use.
|
|
6938
|
-
*
|
|
6939
|
-
* @example
|
|
6940
|
-
*
|
|
6941
|
-
* ```js
|
|
6942
|
-
*
|
|
6943
|
-
* const applicationInfoArray = [
|
|
6944
|
-
* {
|
|
6945
|
-
* "uuid": 'App-1',
|
|
6946
|
-
* "manifestUrl": 'http://localhost:5555/app1.json',
|
|
6947
|
-
* },
|
|
6948
|
-
* {
|
|
6949
|
-
* "uuid": 'App-2',
|
|
6950
|
-
* "manifestUrl": 'http://localhost:5555/app2.json',
|
|
6951
|
-
* },
|
|
6952
|
-
* {
|
|
6953
|
-
* "uuid": 'App-3',
|
|
6954
|
-
* "manifestUrl": 'http://localhost:5555/app3.json',
|
|
6955
|
-
* }
|
|
6956
|
-
* ]
|
|
6957
|
-
*
|
|
6958
|
-
* fin.Application.startManyManifests(applicationInfoArray)
|
|
6959
|
-
* .then(() => {
|
|
6960
|
-
* console.log('RVM has finished launching the application list.');
|
|
6961
|
-
* })
|
|
6962
|
-
* .catch((err) => {
|
|
6963
|
-
* console.log(err);
|
|
6964
|
-
* })
|
|
6965
|
-
* ```
|
|
6966
|
-
*
|
|
6967
|
-
* @experimental
|
|
6968
|
-
*/
|
|
6969
|
-
async startManyManifests(applications, opts) {
|
|
6970
|
-
return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
|
|
6971
|
-
}
|
|
6972
|
-
/**
|
|
6973
|
-
* Asynchronously returns an Application object that represents the current application
|
|
6974
|
-
*
|
|
6975
|
-
* @example
|
|
6976
|
-
*
|
|
6977
|
-
* ```js
|
|
6978
|
-
* async function isCurrentAppRunning () {
|
|
6979
|
-
* const app = await fin.Application.getCurrent();
|
|
6980
|
-
* return app.isRunning();
|
|
6981
|
-
* }
|
|
6982
|
-
*
|
|
6983
|
-
* isCurrentAppRunning().then(running => {
|
|
6984
|
-
* console.log(`Current app is running: ${running}`);
|
|
6985
|
-
* }).catch(err => {
|
|
6986
|
-
* console.error(err);
|
|
6987
|
-
* });
|
|
6988
|
-
*
|
|
6989
|
-
* ```
|
|
6990
|
-
*/
|
|
6991
|
-
getCurrent() {
|
|
6992
|
-
this.wire.sendAction('get-current-application').catch((e) => {
|
|
6993
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
6994
|
-
});
|
|
6995
|
-
return this.wrap({ uuid: this.wire.me.uuid });
|
|
6996
|
-
}
|
|
6997
|
-
/**
|
|
6998
|
-
* Synchronously returns an Application object that represents the current application
|
|
6999
|
-
*
|
|
7000
|
-
* @example
|
|
7001
|
-
*
|
|
7002
|
-
* ```js
|
|
7003
|
-
* async function isCurrentAppRunning () {
|
|
7004
|
-
* const app = fin.Application.getCurrentSync();
|
|
7005
|
-
* return app.isRunning();
|
|
7006
|
-
* }
|
|
7007
|
-
*
|
|
7008
|
-
* isCurrentAppRunning().then(running => {
|
|
7009
|
-
* console.log(`Current app is running: ${running}`);
|
|
7010
|
-
* }).catch(err => {
|
|
7011
|
-
* console.error(err);
|
|
7012
|
-
* });
|
|
7013
|
-
*
|
|
7014
|
-
* ```
|
|
7015
|
-
*/
|
|
7016
|
-
getCurrentSync() {
|
|
7017
|
-
this.wire.sendAction('get-current-application-sync').catch((e) => {
|
|
7018
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
7019
|
-
});
|
|
7020
|
-
return this.wrapSync({ uuid: this.wire.me.uuid });
|
|
7021
|
-
}
|
|
7022
|
-
/**
|
|
7023
|
-
* Retrieves application's manifest and returns a running instance of the application.
|
|
7024
|
-
* @param manifestUrl - The URL of app's manifest.
|
|
7025
|
-
* @param opts - Parameters that the RVM will use.
|
|
7026
|
-
*
|
|
7027
|
-
* @example
|
|
7028
|
-
*
|
|
7029
|
-
* ```js
|
|
7030
|
-
* fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
|
7031
|
-
*
|
|
7032
|
-
* // For a local manifest file:
|
|
7033
|
-
* fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
|
7034
|
-
* ```
|
|
7035
|
-
*/
|
|
7036
|
-
async startFromManifest(manifestUrl, opts) {
|
|
7037
|
-
this.wire.sendAction('application-start-from-manifest').catch((e) => {
|
|
7038
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
7039
|
-
});
|
|
7040
|
-
const app = await this._createFromManifest(manifestUrl);
|
|
7041
|
-
// @ts-expect-error using private method without warning.
|
|
7042
|
-
await app._run(opts); // eslint-disable-line no-underscore-dangle
|
|
7043
|
-
return app;
|
|
7044
|
-
}
|
|
7045
|
-
/**
|
|
7046
|
-
* @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
|
|
7047
|
-
* Retrieves application's manifest and returns a wrapped application.
|
|
7048
|
-
* @param manifestUrl - The URL of app's manifest.
|
|
7049
|
-
* @param callback - called if the method succeeds.
|
|
7050
|
-
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
|
7051
|
-
*
|
|
7052
|
-
* @example
|
|
7053
|
-
*
|
|
7054
|
-
* ```js
|
|
7055
|
-
* fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
|
|
7056
|
-
* ```
|
|
7057
|
-
* @ignore
|
|
7058
|
-
*/
|
|
7059
|
-
createFromManifest(manifestUrl) {
|
|
7060
|
-
console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
|
|
7061
|
-
this.wire.sendAction('application-create-from-manifest').catch((e) => {
|
|
7062
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
7063
|
-
});
|
|
7064
|
-
return this._createFromManifest(manifestUrl);
|
|
7065
|
-
}
|
|
7066
|
-
_createFromManifest(manifestUrl) {
|
|
7067
|
-
return this.wire
|
|
7068
|
-
.sendAction('get-application-manifest', { manifestUrl })
|
|
7069
|
-
.then(({ payload }) => {
|
|
7070
|
-
const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
|
|
7071
|
-
return this.wrap({ uuid });
|
|
7072
|
-
})
|
|
7073
|
-
.then((app) => {
|
|
7074
|
-
app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
|
|
7075
|
-
return app;
|
|
7076
|
-
});
|
|
7077
|
-
}
|
|
7078
|
-
}
|
|
7079
|
-
Factory$5.ApplicationModule = ApplicationModule;
|
|
7080
|
-
return Factory$5;
|
|
7081
|
-
}
|
|
7082
|
-
|
|
7083
|
-
var hasRequiredApplication;
|
|
7084
|
-
|
|
7085
|
-
function requireApplication () {
|
|
7086
|
-
if (hasRequiredApplication) return application;
|
|
7087
|
-
hasRequiredApplication = 1;
|
|
7088
|
-
(function (exports) {
|
|
7089
|
-
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7090
|
-
if (k2 === undefined) k2 = k;
|
|
7091
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7092
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7093
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7094
|
-
}
|
|
7095
|
-
Object.defineProperty(o, k2, desc);
|
|
7096
|
-
}) : (function(o, m, k, k2) {
|
|
7097
|
-
if (k2 === undefined) k2 = k;
|
|
7098
|
-
o[k2] = m[k];
|
|
7099
|
-
}));
|
|
7100
|
-
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
|
7101
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
7102
|
-
};
|
|
7103
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7104
|
-
/**
|
|
7105
|
-
* Entry points for the OpenFin `Application` API (`fin.Application`).
|
|
7106
|
-
*
|
|
7107
|
-
* * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
|
|
7108
|
-
* * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
|
|
7109
|
-
*
|
|
7110
|
-
* 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),
|
|
7111
|
-
* both of these were documented on the same page.
|
|
7112
|
-
*
|
|
7113
|
-
* @packageDocumentation
|
|
7114
|
-
*/
|
|
7115
|
-
__exportStar(requireFactory$1(), exports);
|
|
7116
|
-
__exportStar(requireInstance$2(), exports);
|
|
7117
|
-
} (application));
|
|
7118
|
-
return application;
|
|
7119
|
-
}
|
|
7096
|
+
__exportStar(Factory$5, exports);
|
|
7097
|
+
__exportStar(Instance$5, exports);
|
|
7098
|
+
} (application));
|
|
7120
7099
|
|
|
7121
7100
|
var promisifySubscription$1 = {};
|
|
7122
7101
|
|
|
@@ -7160,7 +7139,7 @@ function requireInstance$1 () {
|
|
|
7160
7139
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
7161
7140
|
/* eslint-disable no-console */
|
|
7162
7141
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
7163
|
-
const application_1 =
|
|
7142
|
+
const application_1 = application;
|
|
7164
7143
|
const main_1 = main;
|
|
7165
7144
|
const view_1 = requireView();
|
|
7166
7145
|
const warnings_1 = warnings;
|
|
@@ -9187,7 +9166,7 @@ function requireView () {
|
|
|
9187
9166
|
*
|
|
9188
9167
|
* @packageDocumentation
|
|
9189
9168
|
*/
|
|
9190
|
-
__exportStar(requireFactory$
|
|
9169
|
+
__exportStar(requireFactory$1(), exports);
|
|
9191
9170
|
__exportStar(requireInstance(), exports);
|
|
9192
9171
|
} (view));
|
|
9193
9172
|
return view;
|
|
@@ -9673,13 +9652,13 @@ function errorToPOJO(error) {
|
|
|
9673
9652
|
}
|
|
9674
9653
|
errors.errorToPOJO = errorToPOJO;
|
|
9675
9654
|
|
|
9676
|
-
var __classPrivateFieldSet$
|
|
9655
|
+
var __classPrivateFieldSet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
9677
9656
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
9678
9657
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
9679
9658
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
9680
9659
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
9681
9660
|
};
|
|
9682
|
-
var __classPrivateFieldGet$
|
|
9661
|
+
var __classPrivateFieldGet$d = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9683
9662
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9684
9663
|
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");
|
|
9685
9664
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -9707,19 +9686,19 @@ class Transport extends events_1$5.EventEmitter {
|
|
|
9707
9686
|
// Typing as unknown to avoid circular dependency, should not be used directly.
|
|
9708
9687
|
_Transport_fin.set(this, void 0);
|
|
9709
9688
|
this.connectSync = () => {
|
|
9710
|
-
const wire = __classPrivateFieldGet$
|
|
9689
|
+
const wire = __classPrivateFieldGet$d(this, _Transport_wire, "f");
|
|
9711
9690
|
wire.connectSync();
|
|
9712
9691
|
};
|
|
9713
9692
|
// This function is only used in our tests.
|
|
9714
9693
|
this.getPort = () => {
|
|
9715
|
-
const wire = __classPrivateFieldGet$
|
|
9694
|
+
const wire = __classPrivateFieldGet$d(this, _Transport_wire, "f");
|
|
9716
9695
|
return wire.getPort();
|
|
9717
9696
|
};
|
|
9718
|
-
__classPrivateFieldSet$
|
|
9697
|
+
__classPrivateFieldSet$c(this, _Transport_wire, new WireType(this.onmessage.bind(this)), "f");
|
|
9719
9698
|
this.environment = environment;
|
|
9720
|
-
this.sendRaw = __classPrivateFieldGet$
|
|
9699
|
+
this.sendRaw = __classPrivateFieldGet$d(this, _Transport_wire, "f").send.bind(__classPrivateFieldGet$d(this, _Transport_wire, "f"));
|
|
9721
9700
|
this.registerMessageHandler(this.handleMessage.bind(this));
|
|
9722
|
-
__classPrivateFieldGet$
|
|
9701
|
+
__classPrivateFieldGet$d(this, _Transport_wire, "f").on('disconnected', () => {
|
|
9723
9702
|
for (const [, { handleNack }] of this.wireListeners) {
|
|
9724
9703
|
handleNack({ reason: 'Remote connection has closed' });
|
|
9725
9704
|
}
|
|
@@ -9731,24 +9710,24 @@ class Transport extends events_1$5.EventEmitter {
|
|
|
9731
9710
|
this.me = (0, me_1$1.getBaseMe)(entityType, uuid, name);
|
|
9732
9711
|
}
|
|
9733
9712
|
getFin() {
|
|
9734
|
-
if (!__classPrivateFieldGet$
|
|
9713
|
+
if (!__classPrivateFieldGet$d(this, _Transport_fin, "f")) {
|
|
9735
9714
|
throw new Error('No Fin object registered for this transport');
|
|
9736
9715
|
}
|
|
9737
|
-
return __classPrivateFieldGet$
|
|
9716
|
+
return __classPrivateFieldGet$d(this, _Transport_fin, "f");
|
|
9738
9717
|
}
|
|
9739
9718
|
registerFin(_fin) {
|
|
9740
|
-
if (__classPrivateFieldGet$
|
|
9719
|
+
if (__classPrivateFieldGet$d(this, _Transport_fin, "f")) {
|
|
9741
9720
|
throw new Error('Fin object has already been registered for this transport');
|
|
9742
9721
|
}
|
|
9743
|
-
__classPrivateFieldSet$
|
|
9722
|
+
__classPrivateFieldSet$c(this, _Transport_fin, _fin, "f");
|
|
9744
9723
|
}
|
|
9745
9724
|
shutdown() {
|
|
9746
|
-
const wire = __classPrivateFieldGet$
|
|
9725
|
+
const wire = __classPrivateFieldGet$d(this, _Transport_wire, "f");
|
|
9747
9726
|
return wire.shutdown();
|
|
9748
9727
|
}
|
|
9749
9728
|
async connect(config) {
|
|
9750
9729
|
if ((0, wire_1.isConfigWithReceiver)(config)) {
|
|
9751
|
-
await __classPrivateFieldGet$
|
|
9730
|
+
await __classPrivateFieldGet$d(this, _Transport_wire, "f").connect(config.receiver);
|
|
9752
9731
|
return this.authorize(config);
|
|
9753
9732
|
}
|
|
9754
9733
|
if ((0, wire_1.isRemoteConfig)(config)) {
|
|
@@ -9764,13 +9743,13 @@ class Transport extends events_1$5.EventEmitter {
|
|
|
9764
9743
|
return undefined;
|
|
9765
9744
|
}
|
|
9766
9745
|
async connectRemote(config) {
|
|
9767
|
-
await __classPrivateFieldGet$
|
|
9746
|
+
await __classPrivateFieldGet$d(this, _Transport_wire, "f").connect(new (this.environment.getWsConstructor())(config.address));
|
|
9768
9747
|
return this.authorize(config);
|
|
9769
9748
|
}
|
|
9770
9749
|
async connectByPort(config) {
|
|
9771
9750
|
const { address, uuid } = config;
|
|
9772
9751
|
const reqAuthPayload = { ...config, type: 'file-token' };
|
|
9773
|
-
const wire = __classPrivateFieldGet$
|
|
9752
|
+
const wire = __classPrivateFieldGet$d(this, _Transport_wire, "f");
|
|
9774
9753
|
await wire.connect(new (this.environment.getWsConstructor())(config.address));
|
|
9775
9754
|
const requestExtAuthRet = await this.sendAction('request-external-authorization', {
|
|
9776
9755
|
uuid,
|
|
@@ -9806,7 +9785,7 @@ class Transport extends events_1$5.EventEmitter {
|
|
|
9806
9785
|
payload,
|
|
9807
9786
|
messageId
|
|
9808
9787
|
};
|
|
9809
|
-
const wire = __classPrivateFieldGet$
|
|
9788
|
+
const wire = __classPrivateFieldGet$d(this, _Transport_wire, "f");
|
|
9810
9789
|
this.addWireListener(messageId, resolve, (payload) => this.nackHandler(payload, reject, callSites), uncorrelated);
|
|
9811
9790
|
return wire.send(msg).catch(reject);
|
|
9812
9791
|
});
|
|
@@ -9828,7 +9807,7 @@ class Transport extends events_1$5.EventEmitter {
|
|
|
9828
9807
|
const resolver = (data) => {
|
|
9829
9808
|
resolve(data.payload);
|
|
9830
9809
|
};
|
|
9831
|
-
const wire = __classPrivateFieldGet$
|
|
9810
|
+
const wire = __classPrivateFieldGet$d(this, _Transport_wire, "f");
|
|
9832
9811
|
return wire
|
|
9833
9812
|
.send(origData)
|
|
9834
9813
|
.then(() => this.addWireListener(id, resolver, (payload) => this.nackHandler(payload, reject), false))
|
|
@@ -12299,12 +12278,12 @@ class ChannelError extends Error {
|
|
|
12299
12278
|
}
|
|
12300
12279
|
channelError.ChannelError = ChannelError;
|
|
12301
12280
|
|
|
12302
|
-
var __classPrivateFieldGet$
|
|
12281
|
+
var __classPrivateFieldGet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12303
12282
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
12304
12283
|
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");
|
|
12305
12284
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12306
12285
|
};
|
|
12307
|
-
var __classPrivateFieldSet$
|
|
12286
|
+
var __classPrivateFieldSet$b = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
12308
12287
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
12309
12288
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
12310
12289
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
@@ -12348,7 +12327,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
|
12348
12327
|
static closeChannelByEndpointId(id) {
|
|
12349
12328
|
const channel = channelClientsByEndpointId.get(id);
|
|
12350
12329
|
if (channel) {
|
|
12351
|
-
__classPrivateFieldGet$
|
|
12330
|
+
__classPrivateFieldGet$c(channel, _ChannelClient_close, "f").call(channel);
|
|
12352
12331
|
}
|
|
12353
12332
|
}
|
|
12354
12333
|
/**
|
|
@@ -12359,7 +12338,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
|
12359
12338
|
for (const channelClient of channelClientsByEndpointId.values()) {
|
|
12360
12339
|
if (channelClient.providerIdentity.channelId === eventPayload.channelId) {
|
|
12361
12340
|
channelClient.disconnectListener(eventPayload);
|
|
12362
|
-
__classPrivateFieldGet$
|
|
12341
|
+
__classPrivateFieldGet$c(channelClient, _ChannelClient_close, "f").call(channelClient);
|
|
12363
12342
|
}
|
|
12364
12343
|
}
|
|
12365
12344
|
}
|
|
@@ -12374,12 +12353,12 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
|
12374
12353
|
this.processAction = (action, payload, senderIdentity) => super.processAction(action, payload, senderIdentity);
|
|
12375
12354
|
_ChannelClient_close.set(this, () => {
|
|
12376
12355
|
channelClientsByEndpointId.delete(this.endpointId);
|
|
12377
|
-
__classPrivateFieldGet$
|
|
12356
|
+
__classPrivateFieldGet$c(this, _ChannelClient_strategy, "f").close();
|
|
12378
12357
|
});
|
|
12379
|
-
__classPrivateFieldSet$
|
|
12358
|
+
__classPrivateFieldSet$b(this, _ChannelClient_protectedObj, new channel_1$1.ProtectedItems(routingInfo, close), "f");
|
|
12380
12359
|
this.disconnectListener = () => undefined;
|
|
12381
12360
|
this.endpointId = routingInfo.endpointId;
|
|
12382
|
-
__classPrivateFieldSet$
|
|
12361
|
+
__classPrivateFieldSet$b(this, _ChannelClient_strategy, strategy, "f");
|
|
12383
12362
|
channelClientsByEndpointId.set(this.endpointId, this);
|
|
12384
12363
|
strategy.receive(this.processAction);
|
|
12385
12364
|
}
|
|
@@ -12387,7 +12366,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
|
12387
12366
|
* a read-only provider identity
|
|
12388
12367
|
*/
|
|
12389
12368
|
get providerIdentity() {
|
|
12390
|
-
const protectedObj = __classPrivateFieldGet$
|
|
12369
|
+
const protectedObj = __classPrivateFieldGet$c(this, _ChannelClient_protectedObj, "f");
|
|
12391
12370
|
return protectedObj.providerIdentity;
|
|
12392
12371
|
}
|
|
12393
12372
|
/**
|
|
@@ -12416,9 +12395,9 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
|
12416
12395
|
* ```
|
|
12417
12396
|
*/
|
|
12418
12397
|
async dispatch(action, payload) {
|
|
12419
|
-
if (__classPrivateFieldGet$
|
|
12398
|
+
if (__classPrivateFieldGet$c(this, _ChannelClient_strategy, "f").isEndpointConnected(this.providerIdentity.channelId)) {
|
|
12420
12399
|
const callSites = transport_errors_1$1.RuntimeError.getCallSite();
|
|
12421
|
-
return __classPrivateFieldGet$
|
|
12400
|
+
return __classPrivateFieldGet$c(this, _ChannelClient_strategy, "f").send(this.providerIdentity.channelId, action, payload).catch((e) => {
|
|
12422
12401
|
throw new channel_error_1$1.ChannelError(e, action, payload, callSites);
|
|
12423
12402
|
});
|
|
12424
12403
|
}
|
|
@@ -12470,10 +12449,10 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
|
12470
12449
|
*/
|
|
12471
12450
|
async disconnect() {
|
|
12472
12451
|
await this.sendDisconnectAction();
|
|
12473
|
-
__classPrivateFieldGet$
|
|
12452
|
+
__classPrivateFieldGet$c(this, _ChannelClient_close, "f").call(this);
|
|
12474
12453
|
}
|
|
12475
12454
|
async sendDisconnectAction() {
|
|
12476
|
-
const protectedObj = __classPrivateFieldGet$
|
|
12455
|
+
const protectedObj = __classPrivateFieldGet$c(this, _ChannelClient_protectedObj, "f");
|
|
12477
12456
|
await protectedObj.close();
|
|
12478
12457
|
}
|
|
12479
12458
|
/**
|
|
@@ -12506,13 +12485,13 @@ exhaustive.exhaustiveCheck = exhaustiveCheck;
|
|
|
12506
12485
|
|
|
12507
12486
|
var strategy$3 = {};
|
|
12508
12487
|
|
|
12509
|
-
var __classPrivateFieldSet$
|
|
12488
|
+
var __classPrivateFieldSet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
12510
12489
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
12511
12490
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
12512
12491
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
12513
12492
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
12514
12493
|
};
|
|
12515
|
-
var __classPrivateFieldGet$
|
|
12494
|
+
var __classPrivateFieldGet$b = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12516
12495
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
12517
12496
|
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");
|
|
12518
12497
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -12537,7 +12516,7 @@ class ClassicStrategy {
|
|
|
12537
12516
|
// connection problems occur
|
|
12538
12517
|
_ClassicStrategy_pendingMessagesByEndpointId.set(this, new Map());
|
|
12539
12518
|
this.send = async (endpointId, action, payload) => {
|
|
12540
|
-
const to = __classPrivateFieldGet$
|
|
12519
|
+
const to = __classPrivateFieldGet$b(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
|
|
12541
12520
|
if (!to) {
|
|
12542
12521
|
throw new Error(`Could not locate routing info for endpoint ${endpointId}`);
|
|
12543
12522
|
}
|
|
@@ -12549,13 +12528,13 @@ class ClassicStrategy {
|
|
|
12549
12528
|
}
|
|
12550
12529
|
delete cleanId.isLocalEndpointId;
|
|
12551
12530
|
// grab the promise before awaiting it to save in our pending messages map
|
|
12552
|
-
const p = __classPrivateFieldGet$
|
|
12531
|
+
const p = __classPrivateFieldGet$b(this, _ClassicStrategy_wire, "f").sendAction('send-channel-message', {
|
|
12553
12532
|
...cleanId,
|
|
12554
12533
|
providerIdentity: this.providerIdentity,
|
|
12555
12534
|
action,
|
|
12556
12535
|
payload
|
|
12557
12536
|
});
|
|
12558
|
-
__classPrivateFieldGet$
|
|
12537
|
+
__classPrivateFieldGet$b(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.add(p);
|
|
12559
12538
|
const raw = await p
|
|
12560
12539
|
.catch((error) => {
|
|
12561
12540
|
if ('cause' in error) {
|
|
@@ -12565,16 +12544,16 @@ class ClassicStrategy {
|
|
|
12565
12544
|
})
|
|
12566
12545
|
.finally(() => {
|
|
12567
12546
|
// clean up the pending promise
|
|
12568
|
-
__classPrivateFieldGet$
|
|
12547
|
+
__classPrivateFieldGet$b(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.delete(p);
|
|
12569
12548
|
});
|
|
12570
12549
|
return raw.payload.data.result;
|
|
12571
12550
|
};
|
|
12572
12551
|
this.close = async () => {
|
|
12573
12552
|
this.messageReceiver.removeEndpoint(this.providerIdentity.channelId, this.endpointId);
|
|
12574
|
-
[...__classPrivateFieldGet$
|
|
12575
|
-
__classPrivateFieldSet$
|
|
12553
|
+
[...__classPrivateFieldGet$b(this, _ClassicStrategy_endpointIdentityMap, "f").keys()].forEach((id) => this.closeEndpoint(id));
|
|
12554
|
+
__classPrivateFieldSet$a(this, _ClassicStrategy_endpointIdentityMap, new Map(), "f");
|
|
12576
12555
|
};
|
|
12577
|
-
__classPrivateFieldSet$
|
|
12556
|
+
__classPrivateFieldSet$a(this, _ClassicStrategy_wire, wire, "f");
|
|
12578
12557
|
}
|
|
12579
12558
|
onEndpointDisconnect(endpointId, listener) {
|
|
12580
12559
|
// Never fires for 'classic'.
|
|
@@ -12583,20 +12562,20 @@ class ClassicStrategy {
|
|
|
12583
12562
|
this.messageReceiver.addEndpoint(listener, this.providerIdentity.channelId, this.endpointId);
|
|
12584
12563
|
}
|
|
12585
12564
|
async closeEndpoint(endpointId) {
|
|
12586
|
-
const id = __classPrivateFieldGet$
|
|
12587
|
-
__classPrivateFieldGet$
|
|
12588
|
-
const pendingSet = __classPrivateFieldGet$
|
|
12565
|
+
const id = __classPrivateFieldGet$b(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
|
|
12566
|
+
__classPrivateFieldGet$b(this, _ClassicStrategy_endpointIdentityMap, "f").delete(endpointId);
|
|
12567
|
+
const pendingSet = __classPrivateFieldGet$b(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId);
|
|
12589
12568
|
pendingSet?.forEach((p) => {
|
|
12590
12569
|
const errorMsg = `Channel connection with identity uuid: ${id?.uuid} / name: ${id?.name} / endpointId: ${endpointId} no longer connected.`;
|
|
12591
12570
|
p.cancel(new Error(errorMsg));
|
|
12592
12571
|
});
|
|
12593
12572
|
}
|
|
12594
12573
|
isEndpointConnected(endpointId) {
|
|
12595
|
-
return __classPrivateFieldGet$
|
|
12574
|
+
return __classPrivateFieldGet$b(this, _ClassicStrategy_endpointIdentityMap, "f").has(endpointId);
|
|
12596
12575
|
}
|
|
12597
12576
|
addEndpoint(endpointId, payload) {
|
|
12598
|
-
__classPrivateFieldGet$
|
|
12599
|
-
__classPrivateFieldGet$
|
|
12577
|
+
__classPrivateFieldGet$b(this, _ClassicStrategy_endpointIdentityMap, "f").set(endpointId, payload.endpointIdentity);
|
|
12578
|
+
__classPrivateFieldGet$b(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").set(endpointId, new Set());
|
|
12600
12579
|
}
|
|
12601
12580
|
isValidEndpointPayload(payload) {
|
|
12602
12581
|
return (typeof payload?.endpointIdentity?.endpointId === 'string' ||
|
|
@@ -12612,12 +12591,12 @@ var strategy$2 = {};
|
|
|
12612
12591
|
|
|
12613
12592
|
var endpoint = {};
|
|
12614
12593
|
|
|
12615
|
-
var __classPrivateFieldGet$
|
|
12594
|
+
var __classPrivateFieldGet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12616
12595
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
12617
12596
|
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");
|
|
12618
12597
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12619
12598
|
};
|
|
12620
|
-
var __classPrivateFieldSet$
|
|
12599
|
+
var __classPrivateFieldSet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
12621
12600
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
12622
12601
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
12623
12602
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
@@ -12652,8 +12631,8 @@ class RTCEndpoint {
|
|
|
12652
12631
|
if (this.rtc.rtcClient.connectionState !== 'connected') {
|
|
12653
12632
|
this.rtc.rtcClient.removeEventListener('connectionstatechange', this.connectionStateChangeHandler);
|
|
12654
12633
|
this.close();
|
|
12655
|
-
if (__classPrivateFieldGet$
|
|
12656
|
-
__classPrivateFieldGet$
|
|
12634
|
+
if (__classPrivateFieldGet$a(this, _RTCEndpoint_disconnectListener, "f")) {
|
|
12635
|
+
__classPrivateFieldGet$a(this, _RTCEndpoint_disconnectListener, "f").call(this);
|
|
12657
12636
|
}
|
|
12658
12637
|
}
|
|
12659
12638
|
};
|
|
@@ -12701,9 +12680,9 @@ class RTCEndpoint {
|
|
|
12701
12680
|
data = new TextDecoder().decode(e.data);
|
|
12702
12681
|
}
|
|
12703
12682
|
const { messageId, action, payload } = JSON.parse(data);
|
|
12704
|
-
if (__classPrivateFieldGet$
|
|
12683
|
+
if (__classPrivateFieldGet$a(this, _RTCEndpoint_processAction, "f")) {
|
|
12705
12684
|
try {
|
|
12706
|
-
const res = await __classPrivateFieldGet$
|
|
12685
|
+
const res = await __classPrivateFieldGet$a(this, _RTCEndpoint_processAction, "f").call(this, action, payload, endpointIdentity);
|
|
12707
12686
|
this.rtc.channels.response.send(JSON.stringify({
|
|
12708
12687
|
messageId,
|
|
12709
12688
|
payload: res,
|
|
@@ -12737,25 +12716,25 @@ class RTCEndpoint {
|
|
|
12737
12716
|
datachannel.onclose = (e) => {
|
|
12738
12717
|
[...this.responseMap.values()].forEach((promise) => promise.reject(new Error('RTCDataChannel closed unexpectedly, this is most commonly caused by message size. Note: RTC Channels have a message size limit of ~255kB.')));
|
|
12739
12718
|
this.close();
|
|
12740
|
-
if (__classPrivateFieldGet$
|
|
12741
|
-
__classPrivateFieldGet$
|
|
12719
|
+
if (__classPrivateFieldGet$a(this, _RTCEndpoint_disconnectListener, "f")) {
|
|
12720
|
+
__classPrivateFieldGet$a(this, _RTCEndpoint_disconnectListener, "f").call(this);
|
|
12742
12721
|
}
|
|
12743
12722
|
};
|
|
12744
12723
|
});
|
|
12745
12724
|
}
|
|
12746
12725
|
onDisconnect(listener) {
|
|
12747
|
-
if (!__classPrivateFieldGet$
|
|
12748
|
-
__classPrivateFieldSet$
|
|
12726
|
+
if (!__classPrivateFieldGet$a(this, _RTCEndpoint_disconnectListener, "f")) {
|
|
12727
|
+
__classPrivateFieldSet$9(this, _RTCEndpoint_disconnectListener, listener, "f");
|
|
12749
12728
|
}
|
|
12750
12729
|
else {
|
|
12751
12730
|
throw new Error('RTCEndpoint disconnectListener cannot be set twice.');
|
|
12752
12731
|
}
|
|
12753
12732
|
}
|
|
12754
12733
|
receive(listener) {
|
|
12755
|
-
if (__classPrivateFieldGet$
|
|
12734
|
+
if (__classPrivateFieldGet$a(this, _RTCEndpoint_processAction, "f")) {
|
|
12756
12735
|
throw new Error('You have already set a listener for this RTC Endpoint.');
|
|
12757
12736
|
}
|
|
12758
|
-
__classPrivateFieldSet$
|
|
12737
|
+
__classPrivateFieldSet$9(this, _RTCEndpoint_processAction, listener, "f");
|
|
12759
12738
|
}
|
|
12760
12739
|
get connected() {
|
|
12761
12740
|
return this.rtc.rtcClient.connectionState === 'connected';
|
|
@@ -12766,12 +12745,12 @@ _RTCEndpoint_processAction = new WeakMap(), _RTCEndpoint_disconnectListener = ne
|
|
|
12766
12745
|
|
|
12767
12746
|
var strategy$1 = {};
|
|
12768
12747
|
|
|
12769
|
-
var __classPrivateFieldGet$
|
|
12748
|
+
var __classPrivateFieldGet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12770
12749
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
12771
12750
|
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");
|
|
12772
12751
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12773
12752
|
};
|
|
12774
|
-
var __classPrivateFieldSet$
|
|
12753
|
+
var __classPrivateFieldSet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
12775
12754
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
12776
12755
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
12777
12756
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
@@ -12792,11 +12771,11 @@ class EndpointStrategy {
|
|
|
12792
12771
|
return this.getEndpointById(endpointId).send(action, payload);
|
|
12793
12772
|
};
|
|
12794
12773
|
this.close = async () => {
|
|
12795
|
-
if (__classPrivateFieldGet$
|
|
12796
|
-
__classPrivateFieldGet$
|
|
12797
|
-
__classPrivateFieldSet$
|
|
12774
|
+
if (__classPrivateFieldGet$9(this, _EndpointStrategy_connected, "f")) {
|
|
12775
|
+
__classPrivateFieldGet$9(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.close());
|
|
12776
|
+
__classPrivateFieldSet$8(this, _EndpointStrategy_endpointMap, new Map(), "f");
|
|
12798
12777
|
}
|
|
12799
|
-
__classPrivateFieldSet$
|
|
12778
|
+
__classPrivateFieldSet$8(this, _EndpointStrategy_connected, false, "f");
|
|
12800
12779
|
};
|
|
12801
12780
|
this.isValidEndpointPayload = validateEndpoint;
|
|
12802
12781
|
}
|
|
@@ -12804,39 +12783,39 @@ class EndpointStrategy {
|
|
|
12804
12783
|
this.getEndpointById(endpointId).onDisconnect(listener);
|
|
12805
12784
|
}
|
|
12806
12785
|
receive(listener) {
|
|
12807
|
-
if (__classPrivateFieldGet$
|
|
12786
|
+
if (__classPrivateFieldGet$9(this, _EndpointStrategy_processAction, "f")) {
|
|
12808
12787
|
throw new Error(`You have already set a listener for this ${this.StrategyName} Strategy`);
|
|
12809
12788
|
}
|
|
12810
|
-
__classPrivateFieldSet$
|
|
12789
|
+
__classPrivateFieldSet$8(this, _EndpointStrategy_processAction, listener, "f");
|
|
12811
12790
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
12812
|
-
__classPrivateFieldGet$
|
|
12791
|
+
__classPrivateFieldGet$9(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.receive(__classPrivateFieldGet$9(this, _EndpointStrategy_processAction, "f")));
|
|
12813
12792
|
}
|
|
12814
12793
|
getEndpointById(endpointId) {
|
|
12815
|
-
const endpoint = __classPrivateFieldGet$
|
|
12794
|
+
const endpoint = __classPrivateFieldGet$9(this, _EndpointStrategy_endpointMap, "f").get(endpointId);
|
|
12816
12795
|
if (!endpoint) {
|
|
12817
12796
|
throw new Error(`Client with endpoint id ${endpointId} is not connected`);
|
|
12818
12797
|
}
|
|
12819
12798
|
return endpoint;
|
|
12820
12799
|
}
|
|
12821
12800
|
get connected() {
|
|
12822
|
-
return __classPrivateFieldGet$
|
|
12801
|
+
return __classPrivateFieldGet$9(this, _EndpointStrategy_connected, "f");
|
|
12823
12802
|
}
|
|
12824
12803
|
isEndpointConnected(endpointId) {
|
|
12825
|
-
return __classPrivateFieldGet$
|
|
12804
|
+
return __classPrivateFieldGet$9(this, _EndpointStrategy_endpointMap, "f").has(endpointId);
|
|
12826
12805
|
}
|
|
12827
12806
|
addEndpoint(endpointId, payload) {
|
|
12828
|
-
if (!__classPrivateFieldGet$
|
|
12807
|
+
if (!__classPrivateFieldGet$9(this, _EndpointStrategy_connected, "f")) {
|
|
12829
12808
|
console.warn(`Adding endpoint to disconnected ${this.StrategyName} Strategy`);
|
|
12830
12809
|
return;
|
|
12831
12810
|
}
|
|
12832
12811
|
const clientStrat = new this.EndpointType(payload);
|
|
12833
|
-
if (__classPrivateFieldGet$
|
|
12834
|
-
clientStrat.receive(__classPrivateFieldGet$
|
|
12812
|
+
if (__classPrivateFieldGet$9(this, _EndpointStrategy_processAction, "f")) {
|
|
12813
|
+
clientStrat.receive(__classPrivateFieldGet$9(this, _EndpointStrategy_processAction, "f"));
|
|
12835
12814
|
}
|
|
12836
|
-
__classPrivateFieldGet$
|
|
12815
|
+
__classPrivateFieldGet$9(this, _EndpointStrategy_endpointMap, "f").set(endpointId, clientStrat);
|
|
12837
12816
|
}
|
|
12838
12817
|
async closeEndpoint(endpointId) {
|
|
12839
|
-
__classPrivateFieldGet$
|
|
12818
|
+
__classPrivateFieldGet$9(this, _EndpointStrategy_endpointMap, "f").delete(endpointId);
|
|
12840
12819
|
}
|
|
12841
12820
|
}
|
|
12842
12821
|
strategy$1.EndpointStrategy = EndpointStrategy;
|
|
@@ -13018,12 +12997,12 @@ function runtimeUuidMeetsMinimumRuntimeVersion(runtimeUuid, minVersion) {
|
|
|
13018
12997
|
}
|
|
13019
12998
|
runtimeVersioning.runtimeUuidMeetsMinimumRuntimeVersion = runtimeUuidMeetsMinimumRuntimeVersion;
|
|
13020
12999
|
|
|
13021
|
-
var __classPrivateFieldGet$
|
|
13000
|
+
var __classPrivateFieldGet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
13022
13001
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13023
13002
|
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");
|
|
13024
13003
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
13025
13004
|
};
|
|
13026
|
-
var __classPrivateFieldSet$
|
|
13005
|
+
var __classPrivateFieldSet$7 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
13027
13006
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
13028
13007
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
13029
13008
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
@@ -13067,19 +13046,19 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
13067
13046
|
* a read-only array containing all the identities of connecting clients.
|
|
13068
13047
|
*/
|
|
13069
13048
|
get connections() {
|
|
13070
|
-
return [...__classPrivateFieldGet$
|
|
13049
|
+
return [...__classPrivateFieldGet$8(this, _ChannelProvider_connections, "f")];
|
|
13071
13050
|
}
|
|
13072
13051
|
static handleClientDisconnection(channel, payload) {
|
|
13073
13052
|
if (payload?.endpointId) {
|
|
13074
13053
|
const { uuid, name, endpointId, isLocalEndpointId } = payload;
|
|
13075
|
-
__classPrivateFieldGet$
|
|
13054
|
+
__classPrivateFieldGet$8(channel, _ChannelProvider_removeEndpoint, "f").call(channel, { uuid, name, endpointId, isLocalEndpointId });
|
|
13076
13055
|
}
|
|
13077
13056
|
else {
|
|
13078
13057
|
// this is here to support older runtimes that did not have endpointId
|
|
13079
13058
|
const multipleRemoves = channel.connections.filter((identity) => {
|
|
13080
13059
|
return identity.uuid === payload.uuid && identity.name === payload.name;
|
|
13081
13060
|
});
|
|
13082
|
-
multipleRemoves.forEach(__classPrivateFieldGet$
|
|
13061
|
+
multipleRemoves.forEach(__classPrivateFieldGet$8(channel, _ChannelProvider_removeEndpoint, "f"));
|
|
13083
13062
|
}
|
|
13084
13063
|
channel.disconnectListener(payload);
|
|
13085
13064
|
}
|
|
@@ -13096,8 +13075,8 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
13096
13075
|
_ChannelProvider_strategy.set(this, void 0);
|
|
13097
13076
|
_ChannelProvider_removeEndpoint.set(this, (identity) => {
|
|
13098
13077
|
const remainingConnections = this.connections.filter((clientIdentity) => clientIdentity.endpointId !== identity.endpointId);
|
|
13099
|
-
__classPrivateFieldGet$
|
|
13100
|
-
__classPrivateFieldSet$
|
|
13078
|
+
__classPrivateFieldGet$8(this, _ChannelProvider_strategy, "f").closeEndpoint(identity.endpointId);
|
|
13079
|
+
__classPrivateFieldSet$7(this, _ChannelProvider_connections, remainingConnections, "f");
|
|
13101
13080
|
});
|
|
13102
13081
|
// Must be bound.
|
|
13103
13082
|
this.processAction = async (action, payload, senderIdentity) => {
|
|
@@ -13111,17 +13090,17 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
13111
13090
|
return super.processAction(action, payload, senderIdentity);
|
|
13112
13091
|
};
|
|
13113
13092
|
_ChannelProvider_close.set(this, () => {
|
|
13114
|
-
__classPrivateFieldGet$
|
|
13093
|
+
__classPrivateFieldGet$8(this, _ChannelProvider_strategy, "f").close();
|
|
13115
13094
|
const remove = ChannelProvider.removalMap.get(this);
|
|
13116
13095
|
if (remove) {
|
|
13117
13096
|
remove();
|
|
13118
13097
|
}
|
|
13119
13098
|
});
|
|
13120
|
-
__classPrivateFieldSet$
|
|
13099
|
+
__classPrivateFieldSet$7(this, _ChannelProvider_protectedObj, new channel_1.ProtectedItems(providerIdentity, close), "f");
|
|
13121
13100
|
this.connectListener = () => undefined;
|
|
13122
13101
|
this.disconnectListener = () => undefined;
|
|
13123
|
-
__classPrivateFieldSet$
|
|
13124
|
-
__classPrivateFieldSet$
|
|
13102
|
+
__classPrivateFieldSet$7(this, _ChannelProvider_connections, [], "f");
|
|
13103
|
+
__classPrivateFieldSet$7(this, _ChannelProvider_strategy, strategy, "f");
|
|
13125
13104
|
strategy.receive(this.processAction);
|
|
13126
13105
|
}
|
|
13127
13106
|
/**
|
|
@@ -13152,16 +13131,16 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
13152
13131
|
*/
|
|
13153
13132
|
dispatch(to, action, payload) {
|
|
13154
13133
|
const endpointId = to.endpointId ?? this.getEndpointIdForOpenFinId(to, action);
|
|
13155
|
-
if (endpointId && __classPrivateFieldGet$
|
|
13134
|
+
if (endpointId && __classPrivateFieldGet$8(this, _ChannelProvider_strategy, "f").isEndpointConnected(endpointId)) {
|
|
13156
13135
|
const callSites = transport_errors_1.RuntimeError.getCallSite();
|
|
13157
|
-
return __classPrivateFieldGet$
|
|
13136
|
+
return __classPrivateFieldGet$8(this, _ChannelProvider_strategy, "f").send(endpointId, action, payload).catch((e) => {
|
|
13158
13137
|
throw new channel_error_1.ChannelError(e, action, payload, callSites);
|
|
13159
13138
|
});
|
|
13160
13139
|
}
|
|
13161
13140
|
return Promise.reject(new Error(`Client connection with identity uuid: ${to.uuid} / name: ${to.name} / endpointId: ${endpointId} no longer connected.`));
|
|
13162
13141
|
}
|
|
13163
13142
|
async processConnection(senderId, payload) {
|
|
13164
|
-
__classPrivateFieldGet$
|
|
13143
|
+
__classPrivateFieldGet$8(this, _ChannelProvider_connections, "f").push(senderId);
|
|
13165
13144
|
return this.connectListener(senderId, payload);
|
|
13166
13145
|
}
|
|
13167
13146
|
/**
|
|
@@ -13184,7 +13163,7 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
13184
13163
|
* ```
|
|
13185
13164
|
*/
|
|
13186
13165
|
publish(action, payload) {
|
|
13187
|
-
return this.connections.map((to) => __classPrivateFieldGet$
|
|
13166
|
+
return this.connections.map((to) => __classPrivateFieldGet$8(this, _ChannelProvider_strategy, "f").send(to.endpointId, action, payload));
|
|
13188
13167
|
}
|
|
13189
13168
|
/**
|
|
13190
13169
|
* Register a listener that is called on every new client connection.
|
|
@@ -13258,11 +13237,11 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
13258
13237
|
* ```
|
|
13259
13238
|
*/
|
|
13260
13239
|
async destroy() {
|
|
13261
|
-
const protectedObj = __classPrivateFieldGet$
|
|
13240
|
+
const protectedObj = __classPrivateFieldGet$8(this, _ChannelProvider_protectedObj, "f");
|
|
13262
13241
|
protectedObj.providerIdentity;
|
|
13263
|
-
__classPrivateFieldSet$
|
|
13242
|
+
__classPrivateFieldSet$7(this, _ChannelProvider_connections, [], "f");
|
|
13264
13243
|
await protectedObj.close();
|
|
13265
|
-
__classPrivateFieldGet$
|
|
13244
|
+
__classPrivateFieldGet$8(this, _ChannelProvider_close, "f").call(this);
|
|
13266
13245
|
}
|
|
13267
13246
|
/**
|
|
13268
13247
|
* Returns an array with info on every Client connected to the Provider
|
|
@@ -13332,7 +13311,7 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
13332
13311
|
getEndpointIdForOpenFinId(clientIdentity, action) {
|
|
13333
13312
|
const matchingConnections = this.connections.filter((c) => c.name === clientIdentity.name && c.uuid === clientIdentity.uuid);
|
|
13334
13313
|
if (matchingConnections.length >= 2) {
|
|
13335
|
-
const protectedObj = __classPrivateFieldGet$
|
|
13314
|
+
const protectedObj = __classPrivateFieldGet$8(this, _ChannelProvider_protectedObj, "f");
|
|
13336
13315
|
const { uuid, name } = clientIdentity;
|
|
13337
13316
|
const providerUuid = protectedObj?.providerIdentity.uuid;
|
|
13338
13317
|
const providerName = protectedObj?.providerIdentity.name;
|
|
@@ -13544,13 +13523,13 @@ class CombinedStrategy {
|
|
|
13544
13523
|
}
|
|
13545
13524
|
strategy.default = CombinedStrategy;
|
|
13546
13525
|
|
|
13547
|
-
var __classPrivateFieldSet$
|
|
13526
|
+
var __classPrivateFieldSet$6 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
13548
13527
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
13549
13528
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
13550
13529
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
13551
13530
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
13552
13531
|
};
|
|
13553
|
-
var __classPrivateFieldGet$
|
|
13532
|
+
var __classPrivateFieldGet$7 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
13554
13533
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13555
13534
|
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");
|
|
13556
13535
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -13599,8 +13578,8 @@ class ConnectionManager extends base_1$a.Base {
|
|
|
13599
13578
|
};
|
|
13600
13579
|
this.providerMap = new Map();
|
|
13601
13580
|
this.protocolManager = new protocol_manager_1.ProtocolManager(this.wire.environment.type === 'node' ? ['classic'] : ['rtc', 'classic']);
|
|
13602
|
-
__classPrivateFieldSet$
|
|
13603
|
-
__classPrivateFieldSet$
|
|
13581
|
+
__classPrivateFieldSet$6(this, _ConnectionManager_messageReceiver, new message_receiver_1.MessageReceiver(wire), "f");
|
|
13582
|
+
__classPrivateFieldSet$6(this, _ConnectionManager_rtcConnectionManager, new ice_manager_1.RTCICEManager(wire), "f");
|
|
13604
13583
|
wire.registerMessageHandler(this.onmessage.bind(this));
|
|
13605
13584
|
}
|
|
13606
13585
|
createProvider(options, providerIdentity) {
|
|
@@ -13611,7 +13590,7 @@ class ConnectionManager extends base_1$a.Base {
|
|
|
13611
13590
|
case 'rtc':
|
|
13612
13591
|
return new strategy_2.RTCStrategy();
|
|
13613
13592
|
case 'classic':
|
|
13614
|
-
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$
|
|
13593
|
+
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$7(this, _ConnectionManager_messageReceiver, "f"),
|
|
13615
13594
|
// Providers do not have an endpointId, use channelId as endpointId in the strategy.
|
|
13616
13595
|
providerIdentity.channelId, providerIdentity);
|
|
13617
13596
|
default:
|
|
@@ -13647,7 +13626,7 @@ class ConnectionManager extends base_1$a.Base {
|
|
|
13647
13626
|
const supportedProtocols = await Promise.all(protocols.map(async (type) => {
|
|
13648
13627
|
switch (type) {
|
|
13649
13628
|
case 'rtc': {
|
|
13650
|
-
const { rtcClient, channels, offer, rtcConnectionId, channelsOpened } = await __classPrivateFieldGet$
|
|
13629
|
+
const { rtcClient, channels, offer, rtcConnectionId, channelsOpened } = await __classPrivateFieldGet$7(this, _ConnectionManager_rtcConnectionManager, "f").startClientOffer();
|
|
13651
13630
|
rtcPacket = { rtcClient, channels, channelsOpened };
|
|
13652
13631
|
return {
|
|
13653
13632
|
type: 'rtc',
|
|
@@ -13674,18 +13653,18 @@ class ConnectionManager extends base_1$a.Base {
|
|
|
13674
13653
|
routingInfo.endpointId = this.wire.environment.getNextMessageId();
|
|
13675
13654
|
// For New Clients connecting to Old Providers. To prevent multi-dispatching and publishing, we delete previously-connected
|
|
13676
13655
|
// clients that are in the same context as the newly-connected client.
|
|
13677
|
-
__classPrivateFieldGet$
|
|
13656
|
+
__classPrivateFieldGet$7(this, _ConnectionManager_messageReceiver, "f").checkForPreviousClientConnection(routingInfo.channelId);
|
|
13678
13657
|
}
|
|
13679
13658
|
const answer = routingInfo.answer ?? {
|
|
13680
13659
|
supportedProtocols: [{ type: 'classic', version: 1 }]
|
|
13681
13660
|
};
|
|
13682
13661
|
const createStrategyFromAnswer = async (protocol) => {
|
|
13683
13662
|
if (protocol.type === 'rtc' && rtcPacket) {
|
|
13684
|
-
await __classPrivateFieldGet$
|
|
13663
|
+
await __classPrivateFieldGet$7(this, _ConnectionManager_rtcConnectionManager, "f").finishClientOffer(rtcPacket.rtcClient, protocol.payload.answer, rtcPacket.channelsOpened);
|
|
13685
13664
|
return new strategy_2.RTCStrategy();
|
|
13686
13665
|
}
|
|
13687
13666
|
if (protocol.type === 'classic') {
|
|
13688
|
-
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$
|
|
13667
|
+
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$7(this, _ConnectionManager_messageReceiver, "f"), routingInfo.endpointId, routingInfo);
|
|
13689
13668
|
}
|
|
13690
13669
|
return null;
|
|
13691
13670
|
};
|
|
@@ -13753,7 +13732,7 @@ class ConnectionManager extends base_1$a.Base {
|
|
|
13753
13732
|
clientAnswer = await overlappingProtocols.reduce(async (accumP, protocolToUse) => {
|
|
13754
13733
|
const answer = await accumP;
|
|
13755
13734
|
if (protocolToUse.type === 'rtc') {
|
|
13756
|
-
const { answer: rtcAnswer, rtcClient, channels } = await __classPrivateFieldGet$
|
|
13735
|
+
const { answer: rtcAnswer, rtcClient, channels } = await __classPrivateFieldGet$7(this, _ConnectionManager_rtcConnectionManager, "f").createProviderAnswer(protocolToUse.payload.rtcConnectionId, protocolToUse.payload.offer);
|
|
13757
13736
|
answer.supportedProtocols.push({
|
|
13758
13737
|
type: 'rtc',
|
|
13759
13738
|
version: strategy_2.RTCInfo.version,
|
|
@@ -13801,13 +13780,13 @@ _ConnectionManager_messageReceiver = new WeakMap(), _ConnectionManager_rtcConnec
|
|
|
13801
13780
|
*
|
|
13802
13781
|
* @packageDocumentation
|
|
13803
13782
|
*/
|
|
13804
|
-
var __classPrivateFieldSet$
|
|
13783
|
+
var __classPrivateFieldSet$5 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
13805
13784
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
13806
13785
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
13807
13786
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
13808
13787
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
13809
13788
|
};
|
|
13810
|
-
var __classPrivateFieldGet$
|
|
13789
|
+
var __classPrivateFieldGet$6 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
13811
13790
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13812
13791
|
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");
|
|
13813
13792
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -13864,11 +13843,11 @@ class Channel extends base_1$9.EmitterBase {
|
|
|
13864
13843
|
client_1.ChannelClient.handleProviderDisconnect(eventPayload);
|
|
13865
13844
|
}),
|
|
13866
13845
|
this.on('connected', (...args) => {
|
|
13867
|
-
__classPrivateFieldGet$
|
|
13846
|
+
__classPrivateFieldGet$6(this, _Channel_internalEmitter, "f").emit('connected', ...args);
|
|
13868
13847
|
})
|
|
13869
13848
|
]).catch(() => new Error('error setting up channel connection listeners'));
|
|
13870
13849
|
}));
|
|
13871
|
-
__classPrivateFieldSet$
|
|
13850
|
+
__classPrivateFieldSet$5(this, _Channel_connectionManager, new connection_manager_1.ConnectionManager(wire), "f");
|
|
13872
13851
|
}
|
|
13873
13852
|
/**
|
|
13874
13853
|
*
|
|
@@ -13943,7 +13922,7 @@ class Channel extends base_1$9.EmitterBase {
|
|
|
13943
13922
|
resolve(true);
|
|
13944
13923
|
}
|
|
13945
13924
|
};
|
|
13946
|
-
__classPrivateFieldGet$
|
|
13925
|
+
__classPrivateFieldGet$6(this, _Channel_internalEmitter, "f").on('connected', connectedListener);
|
|
13947
13926
|
});
|
|
13948
13927
|
try {
|
|
13949
13928
|
if (retryInfo.count > 0) {
|
|
@@ -13975,7 +13954,7 @@ class Channel extends base_1$9.EmitterBase {
|
|
|
13975
13954
|
finally {
|
|
13976
13955
|
retryInfo.count += 1;
|
|
13977
13956
|
// in case of other errors, remove our listener
|
|
13978
|
-
__classPrivateFieldGet$
|
|
13957
|
+
__classPrivateFieldGet$6(this, _Channel_internalEmitter, "f").removeListener('connected', connectedListener);
|
|
13979
13958
|
}
|
|
13980
13959
|
} while (shouldWait); // If we're waiting we retry the above loop
|
|
13981
13960
|
// Should wait was false, no channel was found.
|
|
@@ -14034,12 +14013,12 @@ class Channel extends base_1$9.EmitterBase {
|
|
|
14034
14013
|
async connect(channelName, options = {}) {
|
|
14035
14014
|
// Make sure we don't connect before listeners are set up
|
|
14036
14015
|
// This also errors if we're not in OpenFin, ensuring we don't run unnecessary code
|
|
14037
|
-
await __classPrivateFieldGet$
|
|
14016
|
+
await __classPrivateFieldGet$6(this, _Channel_readyToConnect, "f").getValue();
|
|
14038
14017
|
if (!channelName || typeof channelName !== 'string') {
|
|
14039
14018
|
throw new Error('Please provide a channelName string to connect to a channel.');
|
|
14040
14019
|
}
|
|
14041
14020
|
const opts = { wait: true, ...this.wire.environment.getDefaultChannelOptions().connect, ...options };
|
|
14042
|
-
const { offer, rtc: rtcPacket } = await __classPrivateFieldGet$
|
|
14021
|
+
const { offer, rtc: rtcPacket } = await __classPrivateFieldGet$6(this, _Channel_connectionManager, "f").createClientOffer(opts);
|
|
14043
14022
|
let connectionUrl;
|
|
14044
14023
|
if (this.fin.me.isFrame || this.fin.me.isView || this.fin.me.isWindow) {
|
|
14045
14024
|
connectionUrl = (await this.fin.me.getInfo()).url;
|
|
@@ -14051,7 +14030,7 @@ class Channel extends base_1$9.EmitterBase {
|
|
|
14051
14030
|
connectionUrl
|
|
14052
14031
|
};
|
|
14053
14032
|
const routingInfo = await this.safeConnect(channelName, opts.wait, connectPayload);
|
|
14054
|
-
const strategy = await __classPrivateFieldGet$
|
|
14033
|
+
const strategy = await __classPrivateFieldGet$6(this, _Channel_connectionManager, "f").createClientStrategy(rtcPacket, routingInfo);
|
|
14055
14034
|
const channel = new client_1.ChannelClient(routingInfo, () => client_1.ChannelClient.wireClose(this.wire, routingInfo, routingInfo.endpointId), strategy);
|
|
14056
14035
|
// It is the client's responsibility to handle endpoint disconnection to the provider.
|
|
14057
14036
|
// If the endpoint dies, the client will force a disconnection through the core.
|
|
@@ -14120,7 +14099,7 @@ class Channel extends base_1$9.EmitterBase {
|
|
|
14120
14099
|
throw new Error('Please provide a channelName to create a channel');
|
|
14121
14100
|
}
|
|
14122
14101
|
const { payload: { data: providerIdentity } } = await this.wire.sendAction('create-channel', { channelName });
|
|
14123
|
-
const channel = __classPrivateFieldGet$
|
|
14102
|
+
const channel = __classPrivateFieldGet$6(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
|
|
14124
14103
|
// TODO: fix typing (internal)
|
|
14125
14104
|
// @ts-expect-error
|
|
14126
14105
|
this.on('client-disconnected', (eventPayload) => {
|
|
@@ -14356,14 +14335,32 @@ var clipboard = {};
|
|
|
14356
14335
|
*
|
|
14357
14336
|
* @packageDocumentation
|
|
14358
14337
|
*/
|
|
14338
|
+
var __classPrivateFieldGet$5 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
14339
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
14340
|
+
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");
|
|
14341
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
14342
|
+
};
|
|
14343
|
+
var __classPrivateFieldSet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
14344
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
14345
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
14346
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
14347
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
14348
|
+
};
|
|
14349
|
+
var _Clipboard_instances, _Clipboard_securedApiWarningCount, _Clipboard_warnSecuredApi;
|
|
14359
14350
|
Object.defineProperty(clipboard, "__esModule", { value: true });
|
|
14360
14351
|
clipboard.Clipboard = void 0;
|
|
14361
14352
|
const base_1$7 = base;
|
|
14353
|
+
const maxSecuredApiWarnings = 10;
|
|
14362
14354
|
/**
|
|
14363
14355
|
* The Clipboard API allows reading and writing to the clipboard in multiple formats.
|
|
14364
14356
|
*
|
|
14365
14357
|
*/
|
|
14366
14358
|
class Clipboard extends base_1$7.Base {
|
|
14359
|
+
constructor() {
|
|
14360
|
+
super(...arguments);
|
|
14361
|
+
_Clipboard_instances.add(this);
|
|
14362
|
+
_Clipboard_securedApiWarningCount.set(this, 0);
|
|
14363
|
+
}
|
|
14367
14364
|
/**
|
|
14368
14365
|
* Writes data into the clipboard as plain text
|
|
14369
14366
|
* @param writeObj The object for writing data into the clipboard
|
|
@@ -14376,6 +14373,7 @@ class Clipboard extends base_1$7.Base {
|
|
|
14376
14373
|
* ```
|
|
14377
14374
|
*/
|
|
14378
14375
|
async writeText(writeObj) {
|
|
14376
|
+
__classPrivateFieldGet$5(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.writeText');
|
|
14379
14377
|
await this.wire.sendAction('clipboard-write-text', writeObj);
|
|
14380
14378
|
}
|
|
14381
14379
|
/**
|
|
@@ -14388,6 +14386,7 @@ class Clipboard extends base_1$7.Base {
|
|
|
14388
14386
|
* ```
|
|
14389
14387
|
*/
|
|
14390
14388
|
async readText(type) {
|
|
14389
|
+
__classPrivateFieldGet$5(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.readText');
|
|
14391
14390
|
// NOTE: When we start supporting linux, we could detect the OS and choose 'selection' automatically for the user
|
|
14392
14391
|
const { payload } = await this.wire.sendAction('clipboard-read-text', { type });
|
|
14393
14392
|
return payload.data;
|
|
@@ -14405,6 +14404,7 @@ class Clipboard extends base_1$7.Base {
|
|
|
14405
14404
|
* ```
|
|
14406
14405
|
*/
|
|
14407
14406
|
async writeImage(writeRequest) {
|
|
14407
|
+
__classPrivateFieldGet$5(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.writeImage');
|
|
14408
14408
|
await this.wire.sendAction('clipboard-write-image', writeRequest);
|
|
14409
14409
|
}
|
|
14410
14410
|
/**
|
|
@@ -14440,6 +14440,7 @@ class Clipboard extends base_1$7.Base {
|
|
|
14440
14440
|
* ```
|
|
14441
14441
|
*/
|
|
14442
14442
|
async readImage(readRequest = { format: 'dataURL' }) {
|
|
14443
|
+
__classPrivateFieldGet$5(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.readImage');
|
|
14443
14444
|
const { payload } = await this.wire.sendAction('clipboard-read-image', readRequest);
|
|
14444
14445
|
return payload.data;
|
|
14445
14446
|
}
|
|
@@ -14455,6 +14456,7 @@ class Clipboard extends base_1$7.Base {
|
|
|
14455
14456
|
* ```
|
|
14456
14457
|
*/
|
|
14457
14458
|
async writeHtml(writeObj) {
|
|
14459
|
+
__classPrivateFieldGet$5(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.writeHtml');
|
|
14458
14460
|
await this.wire.sendAction('clipboard-write-html', writeObj);
|
|
14459
14461
|
}
|
|
14460
14462
|
/**
|
|
@@ -14467,6 +14469,7 @@ class Clipboard extends base_1$7.Base {
|
|
|
14467
14469
|
* ```
|
|
14468
14470
|
*/
|
|
14469
14471
|
async readHtml(type) {
|
|
14472
|
+
__classPrivateFieldGet$5(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.readHtml');
|
|
14470
14473
|
const { payload } = await this.wire.sendAction('clipboard-read-html', { type });
|
|
14471
14474
|
return payload.data;
|
|
14472
14475
|
}
|
|
@@ -14482,6 +14485,7 @@ class Clipboard extends base_1$7.Base {
|
|
|
14482
14485
|
* ```
|
|
14483
14486
|
*/
|
|
14484
14487
|
async writeRtf(writeObj) {
|
|
14488
|
+
__classPrivateFieldGet$5(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.writeRtf');
|
|
14485
14489
|
await this.wire.sendAction('clipboard-write-rtf', writeObj);
|
|
14486
14490
|
}
|
|
14487
14491
|
/**
|
|
@@ -14502,6 +14506,7 @@ class Clipboard extends base_1$7.Base {
|
|
|
14502
14506
|
* ```
|
|
14503
14507
|
*/
|
|
14504
14508
|
async readRtf(type) {
|
|
14509
|
+
__classPrivateFieldGet$5(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.readRtf');
|
|
14505
14510
|
const { payload } = await this.wire.sendAction('clipboard-read-rtf', { type });
|
|
14506
14511
|
return payload.data;
|
|
14507
14512
|
}
|
|
@@ -14525,6 +14530,7 @@ class Clipboard extends base_1$7.Base {
|
|
|
14525
14530
|
* ```
|
|
14526
14531
|
*/
|
|
14527
14532
|
async write(writeObj) {
|
|
14533
|
+
__classPrivateFieldGet$5(this, _Clipboard_instances, "m", _Clipboard_warnSecuredApi).call(this, 'Clipboard.write');
|
|
14528
14534
|
await this.wire.sendAction('clipboard-write', writeObj);
|
|
14529
14535
|
}
|
|
14530
14536
|
/**
|
|
@@ -14542,6 +14548,12 @@ class Clipboard extends base_1$7.Base {
|
|
|
14542
14548
|
}
|
|
14543
14549
|
}
|
|
14544
14550
|
clipboard.Clipboard = Clipboard;
|
|
14551
|
+
_Clipboard_securedApiWarningCount = new WeakMap(), _Clipboard_instances = new WeakSet(), _Clipboard_warnSecuredApi = async function _Clipboard_warnSecuredApi(apiName) {
|
|
14552
|
+
if (__classPrivateFieldGet$5(this, _Clipboard_securedApiWarningCount, "f") <= maxSecuredApiWarnings) {
|
|
14553
|
+
console.warn(`Clipboard APIs will be secure-by-default starting in v42. To continue using this API without interruption, make sure to grant explicit API permissions for ${apiName} in the Desktop Owner Settings, and in the Application, Window, View, or Domain Settings. For more information, see https://resources.here.io/docs/core/develop/security/api-security/`);
|
|
14554
|
+
__classPrivateFieldSet$4(this, _Clipboard_securedApiWarningCount, __classPrivateFieldGet$5(this, _Clipboard_securedApiWarningCount, "f") + 1, "f");
|
|
14555
|
+
}
|
|
14556
|
+
};
|
|
14545
14557
|
|
|
14546
14558
|
var globalHotkey = {};
|
|
14547
14559
|
|
|
@@ -17506,7 +17518,7 @@ const events_1 = require$$0$1;
|
|
|
17506
17518
|
// Import from the file rather than the directory in case someone consuming types is using module resolution other than "node"
|
|
17507
17519
|
const index_1 = system;
|
|
17508
17520
|
const index_2 = requireWindow();
|
|
17509
|
-
const index_3 =
|
|
17521
|
+
const index_3 = application;
|
|
17510
17522
|
const index_4 = interappbus;
|
|
17511
17523
|
const index_5 = clipboard;
|
|
17512
17524
|
const index_6 = externalApplication;
|