@openfin/remote-adapter 39.83.2 → 39.83.4
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 +1312 -1220
- package/package.json +2 -2
package/out/remote-adapter.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var require$$
|
|
4
|
-
var require$$
|
|
3
|
+
var require$$0 = require('lodash/cloneDeep');
|
|
4
|
+
var require$$3 = require('lodash/isEqual');
|
|
5
|
+
var require$$0$1 = require('events');
|
|
5
6
|
var bridge = require('./bridge-ef11968f.js');
|
|
6
7
|
var crypto = require('crypto');
|
|
7
8
|
var backchannel = require('./backchannel.js');
|
|
@@ -525,9 +526,32 @@ var utils$2 = {};
|
|
|
525
526
|
|
|
526
527
|
var PrivateChannelClient$1 = {};
|
|
527
528
|
|
|
529
|
+
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
530
|
+
if (k2 === undefined) k2 = k;
|
|
531
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
532
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
533
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
534
|
+
}
|
|
535
|
+
Object.defineProperty(o, k2, desc);
|
|
536
|
+
}) : (function(o, m, k, k2) {
|
|
537
|
+
if (k2 === undefined) k2 = k;
|
|
538
|
+
o[k2] = m[k];
|
|
539
|
+
}));
|
|
540
|
+
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
541
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
542
|
+
}) : function(o, v) {
|
|
543
|
+
o["default"] = v;
|
|
544
|
+
});
|
|
545
|
+
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
|
|
546
|
+
if (mod && mod.__esModule) return mod;
|
|
547
|
+
var result = {};
|
|
548
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
549
|
+
__setModuleDefault(result, mod);
|
|
550
|
+
return result;
|
|
551
|
+
};
|
|
528
552
|
Object.defineProperty(PrivateChannelClient$1, "__esModule", { value: true });
|
|
529
553
|
PrivateChannelClient$1.PrivateChannelClient = void 0;
|
|
530
|
-
const utils$1 = utils$3;
|
|
554
|
+
const utils$1 = __importStar(utils$3);
|
|
531
555
|
class PrivateChannelClient {
|
|
532
556
|
constructor(client, id) {
|
|
533
557
|
this.id = id;
|
|
@@ -616,11 +640,14 @@ class PrivateChannelClient {
|
|
|
616
640
|
PrivateChannelClient$1.PrivateChannelClient = PrivateChannelClient;
|
|
617
641
|
|
|
618
642
|
(function (exports) {
|
|
643
|
+
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
644
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
645
|
+
};
|
|
619
646
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
620
647
|
exports.getIntentResolution = exports.isChannel = exports.isContext = exports.connectPrivateChannel = exports.buildAppChannelObject = exports.buildPrivateChannelObject = exports.ChannelError = exports.ResultError = exports.UnsupportedChannelApiError = exports.getUnsupportedChannelApis = void 0;
|
|
621
648
|
const utils_1 = utils$3;
|
|
622
649
|
const PrivateChannelClient_1 = PrivateChannelClient$1;
|
|
623
|
-
const
|
|
650
|
+
const isEqual_1 = __importDefault(require$$3);
|
|
624
651
|
const getUnsupportedChannelApis = (channelType) => {
|
|
625
652
|
return {
|
|
626
653
|
addContextListener: () => {
|
|
@@ -748,7 +775,7 @@ PrivateChannelClient$1.PrivateChannelClient = PrivateChannelClient;
|
|
|
748
775
|
const wrappedHandler = (context, contextMetadata) => {
|
|
749
776
|
if (first) {
|
|
750
777
|
first = false;
|
|
751
|
-
if ((0,
|
|
778
|
+
if ((0, isEqual_1.default)(currentContext, context)) {
|
|
752
779
|
return;
|
|
753
780
|
}
|
|
754
781
|
}
|
|
@@ -870,13 +897,16 @@ function requireFdc3Common () {
|
|
|
870
897
|
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");
|
|
871
898
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
872
899
|
};
|
|
900
|
+
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
901
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
902
|
+
};
|
|
873
903
|
var _FDC3ModuleBase_producer;
|
|
874
904
|
Object.defineProperty(fdc3Common, "__esModule", { value: true });
|
|
875
905
|
fdc3Common.FDC3ModuleBase = void 0;
|
|
876
906
|
const utils_1 = utils$2;
|
|
877
907
|
const utils_2 = utils$3;
|
|
878
908
|
const InteropClient_1 = requireInteropClient();
|
|
879
|
-
const
|
|
909
|
+
const isEqual_1 = __importDefault(require$$3);
|
|
880
910
|
class FDC3ModuleBase {
|
|
881
911
|
get client() {
|
|
882
912
|
return __classPrivateFieldGet(this, _FDC3ModuleBase_producer, "f").call(this);
|
|
@@ -1065,7 +1095,7 @@ function requireFdc3Common () {
|
|
|
1065
1095
|
const wrappedHandler = (context, contextMetadata) => {
|
|
1066
1096
|
if (first) {
|
|
1067
1097
|
first = false;
|
|
1068
|
-
if ((0,
|
|
1098
|
+
if ((0, isEqual_1.default)(currentContext, context)) {
|
|
1069
1099
|
return;
|
|
1070
1100
|
}
|
|
1071
1101
|
}
|
|
@@ -1678,11 +1708,14 @@ function requireInteropClient () {
|
|
|
1678
1708
|
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");
|
|
1679
1709
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
1680
1710
|
};
|
|
1711
|
+
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
1712
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1713
|
+
};
|
|
1681
1714
|
var _InteropClient_clientPromise, _InteropClient_sessionContextGroups;
|
|
1682
1715
|
Object.defineProperty(InteropClient, "__esModule", { value: true });
|
|
1683
1716
|
InteropClient.InteropClient = void 0;
|
|
1684
1717
|
const base_1 = base;
|
|
1685
|
-
const SessionContextGroupClient_1 = SessionContextGroupClient$1;
|
|
1718
|
+
const SessionContextGroupClient_1 = __importDefault(SessionContextGroupClient$1);
|
|
1686
1719
|
const fdc3_1_2_1 = requireFdc31_2();
|
|
1687
1720
|
const fdc3_2_0_1 = requireFdc32_0();
|
|
1688
1721
|
const utils_1 = utils$3;
|
|
@@ -2300,9 +2333,12 @@ var hasRequiredFactory$3;
|
|
|
2300
2333
|
function requireFactory$3 () {
|
|
2301
2334
|
if (hasRequiredFactory$3) return Factory$8;
|
|
2302
2335
|
hasRequiredFactory$3 = 1;
|
|
2336
|
+
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
2337
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2338
|
+
};
|
|
2303
2339
|
Object.defineProperty(Factory$8, "__esModule", { value: true });
|
|
2304
2340
|
Factory$8.InteropModule = void 0;
|
|
2305
|
-
const
|
|
2341
|
+
const cloneDeep_1 = __importDefault(require$$0);
|
|
2306
2342
|
const inaccessibleObject_1 = inaccessibleObject;
|
|
2307
2343
|
const base_1 = base;
|
|
2308
2344
|
const InteropBroker_1 = requireInteropBroker();
|
|
@@ -2339,7 +2375,7 @@ function requireFactory$3 () {
|
|
|
2339
2375
|
// Allows for manifest-level configuration, without having to override. (e.g. specifying custom context groups)
|
|
2340
2376
|
const options = await this.wire.environment.getInteropInfo(this.wire.getFin());
|
|
2341
2377
|
const objectThatThrows = (0, inaccessibleObject_1.createUnusableObject)(BrokerParamAccessError);
|
|
2342
|
-
const warningOptsClone = (0, inaccessibleObject_1.createWarningObject)(BrokerParamAccessError, (0,
|
|
2378
|
+
const warningOptsClone = (0, inaccessibleObject_1.createWarningObject)(BrokerParamAccessError, (0, cloneDeep_1.default)(options));
|
|
2343
2379
|
const getProvider = () => {
|
|
2344
2380
|
return this.fin.InterApplicationBus.Channel.create(`interop-broker-${name}`);
|
|
2345
2381
|
};
|
|
@@ -2905,13 +2941,16 @@ function requireInteropBroker () {
|
|
|
2905
2941
|
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");
|
|
2906
2942
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
2907
2943
|
};
|
|
2944
|
+
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
2945
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2946
|
+
};
|
|
2908
2947
|
var _InteropBroker_fdc3Info, _InteropBroker_contextGroups, _InteropBroker_providerPromise;
|
|
2909
2948
|
Object.defineProperty(InteropBroker, "__esModule", { value: true });
|
|
2910
2949
|
InteropBroker.InteropBroker = void 0;
|
|
2911
2950
|
const base_1 = base;
|
|
2912
|
-
const SessionContextGroupBroker_1 = requireSessionContextGroupBroker();
|
|
2951
|
+
const SessionContextGroupBroker_1 = __importDefault(requireSessionContextGroupBroker());
|
|
2913
2952
|
const utils_1 = utils$3;
|
|
2914
|
-
const
|
|
2953
|
+
const isEqual_1 = __importDefault(require$$3);
|
|
2915
2954
|
const PrivateChannelProvider_1 = requirePrivateChannelProvider();
|
|
2916
2955
|
const lazy_1 = lazy;
|
|
2917
2956
|
const defaultContextGroups = [
|
|
@@ -3109,7 +3148,7 @@ function requireInteropBroker () {
|
|
|
3109
3148
|
constructor(...unused) {
|
|
3110
3149
|
if (unused.length) {
|
|
3111
3150
|
const [_ignore1, ignore2, opts] = unused;
|
|
3112
|
-
if (opts && typeof opts === 'object' && !(0,
|
|
3151
|
+
if (opts && typeof opts === 'object' && !(0, isEqual_1.default)(opts, args[2])) {
|
|
3113
3152
|
// eslint-disable-next-line no-console
|
|
3114
3153
|
console.warn('You have modified the parameters of the InteropOverride constructor. This behavior is deprecated and will be removed in a future version. You can modify these options in your manifest. Please consult our Interop docs for guidance on migrating to the new override scheme.');
|
|
3115
3154
|
super(args[0], args[1], opts);
|
|
@@ -4234,6 +4273,10 @@ Object.defineProperty(baseEnv, "__esModule", { value: true });
|
|
|
4234
4273
|
baseEnv.BaseEnvironment = void 0;
|
|
4235
4274
|
const overrideCheck_1 = requireOverrideCheck();
|
|
4236
4275
|
class BaseEnvironment {
|
|
4276
|
+
async getViewWindowIdentity(fin, viewIdentity) {
|
|
4277
|
+
const { identity } = await fin.View.wrapSync(viewIdentity).getCurrentWindow();
|
|
4278
|
+
return identity;
|
|
4279
|
+
}
|
|
4237
4280
|
async getInteropInfo(fin) {
|
|
4238
4281
|
const appInfo = await fin.Application.getCurrentSync()
|
|
4239
4282
|
.getInfo()
|
|
@@ -4464,7 +4507,7 @@ var emitterMap = {};
|
|
|
4464
4507
|
|
|
4465
4508
|
Object.defineProperty(emitterMap, "__esModule", { value: true });
|
|
4466
4509
|
emitterMap.EmitterMap = void 0;
|
|
4467
|
-
const events_1$6 = require$$0;
|
|
4510
|
+
const events_1$6 = require$$0$1;
|
|
4468
4511
|
class EmitterMap {
|
|
4469
4512
|
constructor() {
|
|
4470
4513
|
this.storage = new Map();
|
|
@@ -4641,7 +4684,9 @@ function requireFactory$2 () {
|
|
|
4641
4684
|
* @experimental
|
|
4642
4685
|
*/
|
|
4643
4686
|
async wrap(identity) {
|
|
4644
|
-
this.wire.sendAction('view-wrap')
|
|
4687
|
+
this.wire.sendAction('view-wrap').catch((e) => {
|
|
4688
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
4689
|
+
});
|
|
4645
4690
|
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
|
4646
4691
|
if (errorMsg) {
|
|
4647
4692
|
throw new Error(errorMsg);
|
|
@@ -4722,902 +4767,238 @@ function requireFactory$2 () {
|
|
|
4722
4767
|
|
|
4723
4768
|
var Instance$7 = {};
|
|
4724
4769
|
|
|
4725
|
-
var
|
|
4726
|
-
|
|
4727
|
-
var apiExposer$1 = {};
|
|
4728
|
-
|
|
4729
|
-
var apiConsumer = {};
|
|
4730
|
-
|
|
4731
|
-
Object.defineProperty(apiConsumer, "__esModule", { value: true });
|
|
4732
|
-
apiConsumer.ApiConsumer = void 0;
|
|
4733
|
-
/**
|
|
4734
|
-
* Consumer for apis exposed with {@see ApiExposer}.
|
|
4735
|
-
*
|
|
4736
|
-
* A strategy that matches the strategy used to expose a target API must be provided.
|
|
4737
|
-
*/
|
|
4738
|
-
class ApiConsumer {
|
|
4739
|
-
// eslint-disable-next-line
|
|
4740
|
-
constructor(strategy) {
|
|
4741
|
-
this.strategy = strategy;
|
|
4742
|
-
/**
|
|
4743
|
-
* Consumes an api exposed using a given transport strategy, and generates a client
|
|
4744
|
-
* for easy, type safe consumption of that client.
|
|
4745
|
-
* @param options Strategy specific consumption options.
|
|
4746
|
-
* @returns An api client matching the given type.
|
|
4747
|
-
*/
|
|
4748
|
-
this.consume = async (options) => {
|
|
4749
|
-
const exposedProperties = await this.strategy.getExposedFunctions(options);
|
|
4750
|
-
return exposedProperties.reduce((client, prop) => ({
|
|
4751
|
-
...client,
|
|
4752
|
-
[prop.key]: this.strategy.createFunction(prop, options)
|
|
4753
|
-
}), {});
|
|
4754
|
-
};
|
|
4755
|
-
}
|
|
4756
|
-
}
|
|
4757
|
-
apiConsumer.ApiConsumer = ApiConsumer;
|
|
4758
|
-
|
|
4759
|
-
var apiExposer = {};
|
|
4760
|
-
|
|
4761
|
-
var decorators = {};
|
|
4762
|
-
|
|
4763
|
-
Object.defineProperty(decorators, "__esModule", { value: true });
|
|
4764
|
-
decorators.expose = decorators.getExposedProperties = void 0;
|
|
4765
|
-
const exposedProperties = Symbol('exposedProperties');
|
|
4766
|
-
const getExposedProperties = (target) => {
|
|
4767
|
-
return target[exposedProperties] || target.prototype[exposedProperties] || [];
|
|
4768
|
-
};
|
|
4769
|
-
decorators.getExposedProperties = getExposedProperties;
|
|
4770
|
-
/**
|
|
4771
|
-
* Indicates that a class member function can be exposed using {@link ApiExposer}.
|
|
4772
|
-
* @param options Options specific to the strategy used in {@link ApiExposer}
|
|
4773
|
-
*/
|
|
4774
|
-
// Returns any as decorator typing is weird.
|
|
4775
|
-
const expose = (options) => (target, key, descriptor) => {
|
|
4776
|
-
target[exposedProperties] = target[exposedProperties] || [];
|
|
4777
|
-
target[exposedProperties].push({ key, descriptor, options });
|
|
4778
|
-
};
|
|
4779
|
-
decorators.expose = expose;
|
|
4770
|
+
var main = {};
|
|
4780
4771
|
|
|
4781
|
-
Object.defineProperty(
|
|
4782
|
-
|
|
4783
|
-
const
|
|
4784
|
-
|
|
4785
|
-
* Exposes api services on the transport of choice.
|
|
4786
|
-
*/
|
|
4787
|
-
class ApiExposer {
|
|
4772
|
+
Object.defineProperty(main, "__esModule", { value: true });
|
|
4773
|
+
main.WebContents = void 0;
|
|
4774
|
+
const base_1$i = base;
|
|
4775
|
+
class WebContents extends base_1$i.EmitterBase {
|
|
4788
4776
|
/**
|
|
4789
|
-
* @param
|
|
4777
|
+
* @param identity The identity of the {@link OpenFin.WebContentsEvents WebContents}.
|
|
4778
|
+
* @param entityType The type of the {@link OpenFin.WebContentsEvents WebContents}.
|
|
4790
4779
|
*/
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
this.
|
|
4794
|
-
|
|
4795
|
-
* Exposes an instance of a given api on
|
|
4796
|
-
* @param instance Instance of a class which has been decorated to indicate which functions can be exposed.
|
|
4797
|
-
* @param instanceOptions Transport strategy specific options to use when exposing.
|
|
4798
|
-
*/
|
|
4799
|
-
this.exposeInstance = async (instance, instanceOptions) => {
|
|
4800
|
-
const exposableProps = (0, decorators_1.getExposedProperties)(instance);
|
|
4801
|
-
const exposedProps = await Promise.all(exposableProps.map(async ({ key, options }) => {
|
|
4802
|
-
const customConsumptionOptions = await this.strategy.exposeFunction(instance[key].bind(instance), {
|
|
4803
|
-
key,
|
|
4804
|
-
options,
|
|
4805
|
-
meta: instanceOptions
|
|
4806
|
-
});
|
|
4807
|
-
return {
|
|
4808
|
-
key,
|
|
4809
|
-
options: customConsumptionOptions
|
|
4810
|
-
};
|
|
4811
|
-
}));
|
|
4812
|
-
await this.strategy.exposeMeta(instanceOptions, exposedProps);
|
|
4813
|
-
};
|
|
4780
|
+
constructor(wire, identity, entityType) {
|
|
4781
|
+
super(wire, entityType, identity.uuid, identity.name);
|
|
4782
|
+
this.identity = identity;
|
|
4783
|
+
this.entityType = entityType;
|
|
4814
4784
|
}
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4785
|
+
/**
|
|
4786
|
+
* Gets a base64 encoded image of all or part of the WebContents.
|
|
4787
|
+
* @param options Options for the capturePage call.
|
|
4788
|
+
*
|
|
4789
|
+
* @example
|
|
4790
|
+
*
|
|
4791
|
+
* View:
|
|
4792
|
+
* ```js
|
|
4793
|
+
* const view = fin.View.getCurrentSync();
|
|
4794
|
+
*
|
|
4795
|
+
* // PNG image of a full visible View
|
|
4796
|
+
* console.log(await view.capturePage());
|
|
4797
|
+
*
|
|
4798
|
+
* // Low-quality JPEG image of a defined visible area of the view
|
|
4799
|
+
* const options = {
|
|
4800
|
+
* area: {
|
|
4801
|
+
* height: 100,
|
|
4802
|
+
* width: 100,
|
|
4803
|
+
* x: 10,
|
|
4804
|
+
* y: 10,
|
|
4805
|
+
* },
|
|
4806
|
+
* format: 'jpg',
|
|
4807
|
+
* quality: 20
|
|
4808
|
+
* }
|
|
4809
|
+
* console.log(await view.capturePage(options));
|
|
4810
|
+
* ```
|
|
4811
|
+
*
|
|
4812
|
+
* Window:
|
|
4813
|
+
* ```js
|
|
4814
|
+
* const wnd = await fin.Window.getCurrent();
|
|
4815
|
+
*
|
|
4816
|
+
* // PNG image of a full visible window
|
|
4817
|
+
* console.log(await wnd.capturePage());
|
|
4818
|
+
*
|
|
4819
|
+
* // Low-quality JPEG image of a defined visible area of the window
|
|
4820
|
+
* const options = {
|
|
4821
|
+
* area: {
|
|
4822
|
+
* height: 100,
|
|
4823
|
+
* width: 100,
|
|
4824
|
+
* x: 10,
|
|
4825
|
+
* y: 10,
|
|
4826
|
+
* },
|
|
4827
|
+
* format: 'jpg',
|
|
4828
|
+
* quality: 20
|
|
4829
|
+
* }
|
|
4830
|
+
* console.log(await wnd.capturePage(options));
|
|
4831
|
+
* ```
|
|
4832
|
+
*
|
|
4833
|
+
* @remarks
|
|
4834
|
+
* `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
|
|
4835
|
+
* We do not expose an explicit superclass for this functionality, but it does have its own
|
|
4836
|
+
* {@link OpenFin.WebContentsEvents event namespace}.
|
|
4837
|
+
*/
|
|
4838
|
+
capturePage(options) {
|
|
4839
|
+
return this.wire.sendAction('capture-page', { options, ...this.identity }).then(({ payload }) => payload.data);
|
|
4840
4840
|
}
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4841
|
+
/**
|
|
4842
|
+
* Executes Javascript on the WebContents, restricted to contents you own or contents owned by
|
|
4843
|
+
* applications you have created.
|
|
4844
|
+
* @param code JavaScript code to be executed on the view.
|
|
4845
|
+
*
|
|
4846
|
+
* @example
|
|
4847
|
+
* View:
|
|
4848
|
+
* ```js
|
|
4849
|
+
* async function executeJavaScript(code) {
|
|
4850
|
+
* const view = await fin.View.wrap({uuid: 'uuid', name: 'view name'});
|
|
4851
|
+
* return await view.executeJavaScript(code);
|
|
4852
|
+
* }
|
|
4853
|
+
*
|
|
4854
|
+
* executeJavaScript(`console.log('Hello, Openfin')`).then(() => console.log('Javascript excuted')).catch(err => console.log(err));
|
|
4855
|
+
* ```
|
|
4856
|
+
*
|
|
4857
|
+
* Window:
|
|
4858
|
+
* ```js
|
|
4859
|
+
* async function executeJavaScript(code) {
|
|
4860
|
+
* const app = await fin.Application.start({
|
|
4861
|
+
* name: 'myApp',
|
|
4862
|
+
* uuid: 'app-1',
|
|
4863
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.executeJavaScript.html',
|
|
4864
|
+
* autoShow: true
|
|
4865
|
+
* });
|
|
4866
|
+
* const win = await app.getWindow();
|
|
4867
|
+
* return await win.executeJavaScript(code);
|
|
4868
|
+
* }
|
|
4869
|
+
*
|
|
4870
|
+
* executeJavaScript(`console.log('Hello, Openfin')`).then(() => console.log('Javascript excuted')).catch(err => console.log(err));
|
|
4871
|
+
* ```
|
|
4872
|
+
* @remarks
|
|
4873
|
+
* `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
|
|
4874
|
+
* We do not expose an explicit superclass for this functionality, but it does have its own
|
|
4875
|
+
* {@link OpenFin.WebContentsEvents event namespace}.
|
|
4876
|
+
*/
|
|
4877
|
+
executeJavaScript(code) {
|
|
4878
|
+
return this.wire
|
|
4879
|
+
.sendAction('execute-javascript-in-window', { ...this.identity, code })
|
|
4880
|
+
.then(({ payload }) => payload.data);
|
|
4866
4881
|
}
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
} (strategies));
|
|
4908
|
-
|
|
4909
|
-
(function (exports) {
|
|
4910
|
-
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4911
|
-
if (k2 === undefined) k2 = k;
|
|
4912
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
4913
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
4914
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
4915
|
-
}
|
|
4916
|
-
Object.defineProperty(o, k2, desc);
|
|
4917
|
-
}) : (function(o, m, k, k2) {
|
|
4918
|
-
if (k2 === undefined) k2 = k;
|
|
4919
|
-
o[k2] = m[k];
|
|
4920
|
-
}));
|
|
4921
|
-
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
|
4922
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
4923
|
-
};
|
|
4924
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4925
|
-
__exportStar(apiConsumer, exports);
|
|
4926
|
-
__exportStar(apiExposer, exports);
|
|
4927
|
-
__exportStar(strategies, exports);
|
|
4928
|
-
__exportStar(decorators, exports);
|
|
4929
|
-
} (apiExposer$1));
|
|
4930
|
-
|
|
4931
|
-
var channelApiRelay = {};
|
|
4932
|
-
|
|
4933
|
-
Object.defineProperty(channelApiRelay, "__esModule", { value: true });
|
|
4934
|
-
channelApiRelay.createRelayedDispatch = channelApiRelay.relayChannelClientApi = void 0;
|
|
4935
|
-
const EXPECTED_ERRORS = [
|
|
4936
|
-
'no longer connected',
|
|
4937
|
-
'RTCDataChannel closed unexpectedly',
|
|
4938
|
-
'The client you are trying to dispatch from is disconnected from the target provider',
|
|
4939
|
-
];
|
|
4940
|
-
// Checks possible error messages that we want to trap, client error message can originate
|
|
4941
|
-
// from ChannelProvider::dispatch OR ClassicStrategy::closeEndpoint OR RTCEndPoint::dataChannel::onclose
|
|
4942
|
-
const isDisconnectedError = (errorMsg) => {
|
|
4943
|
-
return EXPECTED_ERRORS.some(e => errorMsg.includes(e));
|
|
4944
|
-
};
|
|
4945
|
-
/**
|
|
4946
|
-
* @internal
|
|
4947
|
-
* Create a channel relay for a given channel exposition, allowing a single provider to route
|
|
4948
|
-
* actions to the designated clients.
|
|
4949
|
-
*
|
|
4950
|
-
* Designed to be used in conjunction with @expose
|
|
4951
|
-
*
|
|
4952
|
-
* @param channelProvider The channel provider to relay the actions on.
|
|
4953
|
-
* @param config Determines which actions to relay. Please ensure action prefix matches the exposed api.
|
|
4954
|
-
*/
|
|
4955
|
-
const relayChannelClientApi = async (channelProvider, relayId) => {
|
|
4956
|
-
channelProvider.register(`relay:${relayId}`, ({ action, target, payload }) => {
|
|
4957
|
-
return channelProvider.dispatch(target, action, payload);
|
|
4958
|
-
});
|
|
4959
|
-
await Promise.resolve();
|
|
4960
|
-
};
|
|
4961
|
-
channelApiRelay.relayChannelClientApi = relayChannelClientApi;
|
|
4962
|
-
const createRelayedDispatch = (client, target, relayId, relayErrorMsg) => async (action, payload) => {
|
|
4963
|
-
try {
|
|
4964
|
-
return await client.dispatch(`relay:${relayId}`, {
|
|
4965
|
-
action,
|
|
4966
|
-
payload,
|
|
4967
|
-
target
|
|
4968
|
-
});
|
|
4882
|
+
/**
|
|
4883
|
+
* Returns the zoom level of the WebContents.
|
|
4884
|
+
*
|
|
4885
|
+
* @example
|
|
4886
|
+
* View:
|
|
4887
|
+
* ```js
|
|
4888
|
+
* async function getZoomLevel() {
|
|
4889
|
+
* const view = await fin.View.getCurrent();
|
|
4890
|
+
* return await view.getZoomLevel();
|
|
4891
|
+
* }
|
|
4892
|
+
*
|
|
4893
|
+
* getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
|
|
4894
|
+
* ```
|
|
4895
|
+
*
|
|
4896
|
+
* Window:
|
|
4897
|
+
* ```js
|
|
4898
|
+
* async function createWin() {
|
|
4899
|
+
* const app = await fin.Application.start({
|
|
4900
|
+
* name: 'myApp',
|
|
4901
|
+
* uuid: 'app-1',
|
|
4902
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.getZoomLevel.html',
|
|
4903
|
+
* autoShow: true
|
|
4904
|
+
* });
|
|
4905
|
+
* return await app.getWindow();
|
|
4906
|
+
* }
|
|
4907
|
+
*
|
|
4908
|
+
* async function getZoomLevel() {
|
|
4909
|
+
* const win = await createWin();
|
|
4910
|
+
* return await win.getZoomLevel();
|
|
4911
|
+
* }
|
|
4912
|
+
*
|
|
4913
|
+
* getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
|
|
4914
|
+
* ```
|
|
4915
|
+
* @remarks
|
|
4916
|
+
* `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
|
|
4917
|
+
* We do not expose an explicit superclass for this functionality, but it does have its own
|
|
4918
|
+
* {@link OpenFin.WebContentsEvents event namespace}.
|
|
4919
|
+
*/
|
|
4920
|
+
getZoomLevel() {
|
|
4921
|
+
return this.wire.sendAction('get-zoom-level', this.identity).then(({ payload }) => payload.data);
|
|
4969
4922
|
}
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4923
|
+
/**
|
|
4924
|
+
* Sets the zoom level of the WebContents.
|
|
4925
|
+
* @param level The zoom level
|
|
4926
|
+
*
|
|
4927
|
+
* @example
|
|
4928
|
+
* View:
|
|
4929
|
+
* ```js
|
|
4930
|
+
* async function setZoomLevel(number) {
|
|
4931
|
+
* const view = await fin.View.getCurrent();
|
|
4932
|
+
* return await view.setZoomLevel(number);
|
|
4933
|
+
* }
|
|
4934
|
+
*
|
|
4935
|
+
* setZoomLevel(4).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
|
|
4936
|
+
* ```
|
|
4937
|
+
*
|
|
4938
|
+
* Window:
|
|
4939
|
+
* ```js
|
|
4940
|
+
* async function createWin() {
|
|
4941
|
+
* const app = await fin.Application.start({
|
|
4942
|
+
* name: 'myApp',
|
|
4943
|
+
* uuid: 'app-1',
|
|
4944
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.setZoomLevel.html',
|
|
4945
|
+
* autoShow: true
|
|
4946
|
+
* });
|
|
4947
|
+
* return await app.getWindow();
|
|
4948
|
+
* }
|
|
4949
|
+
*
|
|
4950
|
+
* async function setZoomLevel(number) {
|
|
4951
|
+
* const win = await createWin();
|
|
4952
|
+
* return await win.setZoomLevel(number);
|
|
4953
|
+
* }
|
|
4954
|
+
*
|
|
4955
|
+
* setZoomLevel(4).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
|
|
4956
|
+
* ```
|
|
4957
|
+
* @remarks
|
|
4958
|
+
* `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
|
|
4959
|
+
* We do not expose an explicit superclass for this functionality, but it does have its own
|
|
4960
|
+
* {@link OpenFin.WebContentsEvents event namespace}.
|
|
4961
|
+
*/
|
|
4962
|
+
setZoomLevel(level) {
|
|
4963
|
+
return this.wire.sendAction('set-zoom-level', { ...this.identity, level }).then(() => undefined);
|
|
4975
4964
|
}
|
|
4976
|
-
};
|
|
4977
|
-
channelApiRelay.createRelayedDispatch = createRelayedDispatch;
|
|
4978
|
-
|
|
4979
|
-
var __classPrivateFieldSet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
4980
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4981
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4982
|
-
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");
|
|
4983
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
4984
|
-
};
|
|
4985
|
-
var __classPrivateFieldGet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
4986
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4987
|
-
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");
|
|
4988
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
4989
|
-
};
|
|
4990
|
-
var _LayoutNode_client, _TabStack_client, _ColumnOrRow_client;
|
|
4991
|
-
Object.defineProperty(layoutEntities, "__esModule", { value: true });
|
|
4992
|
-
layoutEntities.ColumnOrRow = layoutEntities.TabStack = layoutEntities.LayoutNode = void 0;
|
|
4993
|
-
const api_exposer_1 = apiExposer$1;
|
|
4994
|
-
const channel_api_relay_1 = channelApiRelay;
|
|
4995
|
-
/*
|
|
4996
|
-
This file includes LayoutNode, ColumnOrRow and TabStack classes, which are all closely
|
|
4997
|
-
intertwined, and share members via parent abstract class LayoutNode. To prevent circular
|
|
4998
|
-
refs, we define and export all the classes here.
|
|
4999
|
-
*/
|
|
5000
|
-
/**
|
|
5001
|
-
* @ignore
|
|
5002
|
-
* @internal
|
|
5003
|
-
* Supplies an ApiClient for {@link LayoutEntitiesController} and helper methods
|
|
5004
|
-
* for the entities {@link TabStack} AND {@link ColumnOrRow} to use.
|
|
5005
|
-
*/
|
|
5006
|
-
class LayoutNode {
|
|
5007
4965
|
/**
|
|
5008
|
-
*
|
|
5009
|
-
*
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
* ```js
|
|
5045
|
-
* if (!fin.me.isView) {
|
|
5046
|
-
* throw new Error('Not running in a platform View.');
|
|
5047
|
-
* }
|
|
5048
|
-
*
|
|
5049
|
-
* const stack = await fin.me.getCurrentStack();
|
|
5050
|
-
* // Retrieves the parent ColumnOrRow
|
|
5051
|
-
* const columnOrRow = await stack.getParent();
|
|
5052
|
-
* let exists = await stack.exists();
|
|
5053
|
-
* // or
|
|
5054
|
-
* let exists = await columnOrRow.exists();
|
|
5055
|
-
* // The entity exists: true
|
|
5056
|
-
* console.log(`The entity exists: ${exists}`);
|
|
5057
|
-
* ```
|
|
5058
|
-
*/
|
|
5059
|
-
this.exists = () => __classPrivateFieldGet$c(this, _LayoutNode_client, "f").exists(this.entityId);
|
|
5060
|
-
/**
|
|
5061
|
-
* Retrieves the parent of the TabStack or ColumnOrRow
|
|
5062
|
-
*
|
|
5063
|
-
* @example
|
|
5064
|
-
* ```js
|
|
5065
|
-
* if (!fin.me.isView) {
|
|
5066
|
-
* throw new Error('Not running in a platform View.');
|
|
5067
|
-
* }
|
|
5068
|
-
*
|
|
5069
|
-
* const stack = await fin.me.getCurrentStack();
|
|
5070
|
-
* // Retrieves the parent ColumnOrRow
|
|
5071
|
-
* const columnOrRow = await stack.getParent();
|
|
5072
|
-
*
|
|
5073
|
-
* // undefined if entity is the root item
|
|
5074
|
-
* let parent = await columnOrRow.getParent();
|
|
5075
|
-
* // or
|
|
5076
|
-
* let parent = await stack.getParent();
|
|
5077
|
-
* ```
|
|
5078
|
-
*/
|
|
5079
|
-
this.getParent = async () => {
|
|
5080
|
-
const parent = await __classPrivateFieldGet$c(this, _LayoutNode_client, "f").getParent(this.entityId);
|
|
5081
|
-
if (!parent) {
|
|
5082
|
-
return undefined;
|
|
5083
|
-
}
|
|
5084
|
-
return LayoutNode.getEntity(parent, __classPrivateFieldGet$c(this, _LayoutNode_client, "f"));
|
|
5085
|
-
};
|
|
5086
|
-
/**
|
|
5087
|
-
* Creates a new TabStack adjacent to the given TabStack or ColumnOrRow. Inputs can be new views to create, or existing views.
|
|
5088
|
-
*
|
|
5089
|
-
* Known Issue: If the number of views to add overflows the tab-container, the added views will be set as active
|
|
5090
|
-
* during each render, and then placed at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
|
|
5091
|
-
* This means the views you pass to createAdjacentStack() may not render in the order given by the array.
|
|
5092
|
-
* Until fixed, this problem can be avoided only if your window is wide enough to fit creating all the views in the tabstack.
|
|
5093
|
-
*
|
|
5094
|
-
* @param views The views that will populate the new TabStack.
|
|
5095
|
-
* @param options Additional options that control new TabStack creation.
|
|
5096
|
-
* @returns The newly-created TabStack.
|
|
5097
|
-
*
|
|
5098
|
-
* @example
|
|
5099
|
-
* ```js
|
|
5100
|
-
* if (!fin.me.isView) {
|
|
5101
|
-
* throw new Error('Not running in a platform View.');
|
|
5102
|
-
* }
|
|
5103
|
-
*
|
|
5104
|
-
* const stack = await fin.me.getCurrentStack();
|
|
5105
|
-
* const columnOrRow = await stack.getParent();
|
|
5106
|
-
*
|
|
5107
|
-
* // Create view references by supplying a 'name' and 'url'
|
|
5108
|
-
* const views = [
|
|
5109
|
-
* // if 'name' is undefined, one will be generated
|
|
5110
|
-
* // if 'url' is undefined, it will default the view URL to 'about:blank'
|
|
5111
|
-
* { name: 'google-view', url: 'http://google.com/'},
|
|
5112
|
-
* { name: 'of-developers-view', url: 'http://developers.openfin.co/'},
|
|
5113
|
-
* ];
|
|
5114
|
-
*
|
|
5115
|
-
* // Create a view beforehand to be included in the new tab stack
|
|
5116
|
-
* const outsideView = await fin.View.create({
|
|
5117
|
-
* name: 'outside-bloomberg-view',
|
|
5118
|
-
* url: 'https://bloomberg.com/',
|
|
5119
|
-
* target: fin.me.identity,
|
|
5120
|
-
* });
|
|
5121
|
-
*
|
|
5122
|
-
* // Views to add can be identities, or the reference views mentioned above
|
|
5123
|
-
* const viewsToAdd = [outsideView.identity, ...views];
|
|
5124
|
-
*
|
|
5125
|
-
* // Possible position inputs: 'right' | 'left' | 'top' | 'bottom'
|
|
5126
|
-
* let stackFrom = await columnOrRow.createAdjacentStack(viewsToAdd, { position: 'right' });
|
|
5127
|
-
* // Or
|
|
5128
|
-
* let newStack = await stack.createAdjacentStack(viewsToAdd, { position: 'right' });
|
|
5129
|
-
* console.log(`A new TabStack created to the right has ${newStack.length} views in it`);
|
|
5130
|
-
*
|
|
5131
|
-
* ```
|
|
5132
|
-
* @experimental
|
|
5133
|
-
*/
|
|
5134
|
-
this.createAdjacentStack = async (views, options) => {
|
|
5135
|
-
const entityId = await __classPrivateFieldGet$c(this, _LayoutNode_client, "f").createAdjacentStack(this.entityId, views, options);
|
|
5136
|
-
return LayoutNode.getEntity({ entityId, type: 'stack' }, __classPrivateFieldGet$c(this, _LayoutNode_client, "f"));
|
|
5137
|
-
};
|
|
5138
|
-
/**
|
|
5139
|
-
* Retrieves the adjacent TabStacks of the given TabStack or ColumnOrRow.
|
|
5140
|
-
*
|
|
5141
|
-
* @param edge Edge whose adjacent TabStacks will be returned.
|
|
5142
|
-
*
|
|
5143
|
-
* @example
|
|
5144
|
-
* ```js
|
|
5145
|
-
* if (!fin.me.isView) {
|
|
5146
|
-
* throw new Error('Not running in a platform View.');
|
|
5147
|
-
* }
|
|
5148
|
-
*
|
|
5149
|
-
* const stack = await fin.me.getCurrentStack();
|
|
5150
|
-
* const columnOrRow = await stack.getParent();
|
|
5151
|
-
* // Possible position inputs: 'right' | 'left' | 'top' | 'bottom'
|
|
5152
|
-
* let rightStacks = await columnOrRow.getAdjacentStacks('right');
|
|
5153
|
-
* let leftStacks = await columnOrRow.getAdjacentStacks('left');
|
|
5154
|
-
* // or
|
|
5155
|
-
* let rightStacks = await stack.getAdjacentStacks('right');
|
|
5156
|
-
* let leftStacks = await stack.getAdjacentStacks('left');
|
|
5157
|
-
*
|
|
5158
|
-
* console.log(`The entity has ${rightStacks.length} stacks to the right, and ${leftStacks.length} stacks to the left`);
|
|
5159
|
-
*
|
|
5160
|
-
* ```
|
|
5161
|
-
* @experimental
|
|
5162
|
-
*/
|
|
5163
|
-
this.getAdjacentStacks = async (edge) => {
|
|
5164
|
-
const adjacentStacks = await __classPrivateFieldGet$c(this, _LayoutNode_client, "f").getAdjacentStacks({
|
|
5165
|
-
targetId: this.entityId,
|
|
5166
|
-
edge
|
|
5167
|
-
});
|
|
5168
|
-
return adjacentStacks.map((stack) => LayoutNode.getEntity({
|
|
5169
|
-
type: 'stack',
|
|
5170
|
-
entityId: stack.entityId
|
|
5171
|
-
}, __classPrivateFieldGet$c(this, _LayoutNode_client, "f")));
|
|
5172
|
-
};
|
|
5173
|
-
__classPrivateFieldSet$a(this, _LayoutNode_client, client, "f");
|
|
5174
|
-
this.entityId = entityId;
|
|
5175
|
-
}
|
|
5176
|
-
}
|
|
5177
|
-
layoutEntities.LayoutNode = LayoutNode;
|
|
5178
|
-
_LayoutNode_client = new WeakMap();
|
|
5179
|
-
/**
|
|
5180
|
-
* @ignore
|
|
5181
|
-
* @internal
|
|
5182
|
-
* Encapsulates Api consumption of {@link LayoutEntitiesClient} with a relayed dispatch
|
|
5183
|
-
* @param client
|
|
5184
|
-
* @param controllerId
|
|
5185
|
-
* @param identity
|
|
5186
|
-
* @returns a new instance of {@link LayoutEntitiesClient} with bound to the controllerId
|
|
5187
|
-
*/
|
|
5188
|
-
LayoutNode.newLayoutEntitiesClient = async (client, controllerId, identity) => {
|
|
5189
|
-
const dispatch = (0, channel_api_relay_1.createRelayedDispatch)(client, identity, 'layout-relay', 'You are trying to interact with a layout component on a window that does not exist or has been destroyed.');
|
|
5190
|
-
const consumer = new api_exposer_1.ApiConsumer(new api_exposer_1.ChannelsConsumer({ dispatch }));
|
|
5191
|
-
return consumer.consume({ id: controllerId });
|
|
5192
|
-
};
|
|
5193
|
-
LayoutNode.getEntity = (definition, client) => {
|
|
5194
|
-
const { entityId, type } = definition;
|
|
5195
|
-
switch (type) {
|
|
5196
|
-
case 'column':
|
|
5197
|
-
case 'row':
|
|
5198
|
-
return new ColumnOrRow(client, entityId, type);
|
|
5199
|
-
case 'stack':
|
|
5200
|
-
return new TabStack(client, entityId);
|
|
5201
|
-
default:
|
|
5202
|
-
throw new Error(`Unrecognised Layout Entity encountered ('${JSON.stringify(definition)})`);
|
|
5203
|
-
}
|
|
5204
|
-
};
|
|
5205
|
-
/**
|
|
5206
|
-
* A TabStack is used to manage the state of a stack of tabs within an OpenFin Layout.
|
|
5207
|
-
*/
|
|
5208
|
-
class TabStack extends LayoutNode {
|
|
5209
|
-
/** @internal */
|
|
5210
|
-
constructor(client, entityId) {
|
|
5211
|
-
super(client, entityId);
|
|
5212
|
-
/**
|
|
5213
|
-
* @internal
|
|
5214
|
-
* ApiClient for {@link LayoutEntitiesController}
|
|
5215
|
-
*/
|
|
5216
|
-
_TabStack_client.set(this, void 0);
|
|
5217
|
-
/**
|
|
5218
|
-
* Type of the content item. Always stack, but useful for distinguishing between a {@link TabStack} and {@link ColumnOrRow}.
|
|
5219
|
-
*/
|
|
5220
|
-
this.type = 'stack';
|
|
5221
|
-
/**
|
|
5222
|
-
* Retrieves a list of all views belonging to this {@link TabStack}.
|
|
5223
|
-
*
|
|
5224
|
-
* Known Issue: If adding a view overflows the tab-container width, the added view will be set as active
|
|
5225
|
-
* and rendered at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
|
|
5226
|
-
* If that happens and then getViews() is called, it will return the identities in a different order than
|
|
5227
|
-
* than the currently rendered tab order.
|
|
5228
|
-
*
|
|
5229
|
-
*
|
|
5230
|
-
* @throws If the {@link TabStack} has been destroyed.
|
|
5231
|
-
* @example
|
|
5232
|
-
* ```js
|
|
5233
|
-
* if (!fin.me.isView) {
|
|
5234
|
-
* throw new Error('Not running in a platform View.');
|
|
5235
|
-
* }
|
|
5236
|
-
*
|
|
5237
|
-
* const stack = await fin.me.getCurrentStack();
|
|
5238
|
-
* // Alternatively, you can wrap any view and get the stack from there
|
|
5239
|
-
* // const viewFromSomewhere = fin.View.wrapSync(someView.identity);
|
|
5240
|
-
* // const stack = await viewFromSomewhere.getCurrentStack();
|
|
5241
|
-
* const views = await stack.getViews();
|
|
5242
|
-
* console.log(`Stack contains ${views.length} view(s)`);
|
|
5243
|
-
* ```
|
|
5244
|
-
* @experimental
|
|
5245
|
-
*/
|
|
5246
|
-
this.getViews = () => __classPrivateFieldGet$c(this, _TabStack_client, "f").getStackViews(this.entityId);
|
|
5247
|
-
/**
|
|
5248
|
-
* Adds or creates a view in this {@link TabStack}.
|
|
5249
|
-
*
|
|
5250
|
-
* @remarks Known Issue: If adding a view overflows the tab-container, the added view will be set as active
|
|
5251
|
-
* and rendered at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
|
|
5252
|
-
*
|
|
5253
|
-
* @param view The identity of an existing view to add, or options to create a view.
|
|
5254
|
-
* @param options Optional view options: index number used to insert the view into the stack at that index. Defaults to 0 (front of the stack)
|
|
5255
|
-
* @returns Resolves with the {@link OpenFin.Identity identity} of the added view.
|
|
5256
|
-
* @throws If the view does not exist or fails to create.
|
|
5257
|
-
* @throws If the {@link TabStack} has been destroyed.
|
|
5258
|
-
* @example
|
|
5259
|
-
* ```js
|
|
5260
|
-
* if (!fin.me.isView) {
|
|
5261
|
-
* throw new Error('Not running in a platform View.');
|
|
5262
|
-
* }
|
|
5263
|
-
*
|
|
5264
|
-
* const stack = await fin.me.getCurrentStack();
|
|
5265
|
-
* // Alternatively, you can wrap any view and get the stack from there
|
|
5266
|
-
* // const viewFromSomewhere = fin.View.wrapSync(someView.identity);
|
|
5267
|
-
* // const stack = await viewFromSomewhere.getCurrentStack();
|
|
5268
|
-
* const googleViewIdentity = await stack.addView({ name: 'google-view', url: 'http://google.com/' });
|
|
5269
|
-
* console.log('Identity of the google view just added', { googleViewIdentity });
|
|
5270
|
-
* // pass in { index: number } to set the index in the stack. Here 1 means, end of the stack (defaults to 0)
|
|
5271
|
-
* const appleViewIdentity = await stack.addView({ name: 'apple-view', url: 'http://apple.com/' }, { index: 1 });
|
|
5272
|
-
* console.log('Identity of the apple view just added', { appleViewIdentity });
|
|
5273
|
-
* ```
|
|
5274
|
-
* @experimental
|
|
5275
|
-
*/
|
|
5276
|
-
this.addView = async (view, options = { index: 0 }) => __classPrivateFieldGet$c(this, _TabStack_client, "f").addViewToStack(this.entityId, view, options);
|
|
5277
|
-
/**
|
|
5278
|
-
* Removes a view from this {@link TabStack}.
|
|
5279
|
-
*
|
|
5280
|
-
* @remarks Throws an exception if the view identity does not exist or was already destroyed.
|
|
5281
|
-
*
|
|
5282
|
-
* @param view - Identity of the view to remove.
|
|
5283
|
-
* @throws If the view does not exist or does not belong to the stack.
|
|
5284
|
-
* @throws If the {@link TabStack} has been destroyed.
|
|
5285
|
-
*
|
|
5286
|
-
* @example
|
|
5287
|
-
* ```js
|
|
5288
|
-
* if (!fin.me.isView) {
|
|
5289
|
-
* throw new Error('Not running in a platform View.');
|
|
5290
|
-
* }
|
|
5291
|
-
*
|
|
5292
|
-
* const stack = await fin.me.getCurrentStack();
|
|
5293
|
-
* const googleViewIdentity = await stack.addView({ name: 'google-view', url: 'http://google.com/' });
|
|
5294
|
-
*
|
|
5295
|
-
* await stack.removeView(googleViewIdentity);
|
|
5296
|
-
*
|
|
5297
|
-
* try {
|
|
5298
|
-
* await stack.removeView(googleViewIdentity);
|
|
5299
|
-
* } catch (error) {
|
|
5300
|
-
* // Tried to remove a view ('google-view') which does not belong to the stack.
|
|
5301
|
-
* console.log(error);
|
|
5302
|
-
* }
|
|
5303
|
-
* ```
|
|
5304
|
-
*/
|
|
5305
|
-
this.removeView = async (view) => {
|
|
5306
|
-
await __classPrivateFieldGet$c(this, _TabStack_client, "f").removeViewFromStack(this.entityId, view);
|
|
5307
|
-
};
|
|
5308
|
-
/**
|
|
5309
|
-
* Sets the active view of the {@link TabStack} without focusing it.
|
|
5310
|
-
* @param view - Identity of the view to activate.
|
|
5311
|
-
* @returns Promise which resolves with void once the view has been activated.
|
|
5312
|
-
* @throws If the {@link TabStack} has been destroyed.
|
|
5313
|
-
* @throws If the view does not exist.
|
|
5314
|
-
* @example
|
|
5315
|
-
* Change the active tab of a known View's TabStack:
|
|
5316
|
-
* ```js
|
|
5317
|
-
* const targetView = fin.View.wrapSync({ uuid: 'uuid', name: 'view-name' });
|
|
5318
|
-
* const stack = await targetView.getCurrentStack();
|
|
5319
|
-
* await stack.setActiveView(targetView.identity);
|
|
5320
|
-
* ```
|
|
5321
|
-
*
|
|
5322
|
-
* Set the current View as active within its TabStack:
|
|
5323
|
-
* ```js
|
|
5324
|
-
* const stack = await fin.me.getCurrentStack();
|
|
5325
|
-
* await stack.setActiveView(fin.me.identity);
|
|
5326
|
-
* ```
|
|
5327
|
-
* @experimental
|
|
5328
|
-
*/
|
|
5329
|
-
this.setActiveView = async (view) => {
|
|
5330
|
-
await __classPrivateFieldGet$c(this, _TabStack_client, "f").setStackActiveView(this.entityId, view);
|
|
5331
|
-
};
|
|
5332
|
-
__classPrivateFieldSet$a(this, _TabStack_client, client, "f");
|
|
5333
|
-
}
|
|
5334
|
-
}
|
|
5335
|
-
layoutEntities.TabStack = TabStack;
|
|
5336
|
-
_TabStack_client = new WeakMap();
|
|
5337
|
-
/**
|
|
5338
|
-
* A ColumnOrRow is used to manage the state of Column and Rows within an OpenFin Layout.
|
|
5339
|
-
*/
|
|
5340
|
-
class ColumnOrRow extends LayoutNode {
|
|
5341
|
-
/**
|
|
5342
|
-
* @internal
|
|
5343
|
-
*/
|
|
5344
|
-
constructor(client, entityId, type) {
|
|
5345
|
-
super(client, entityId);
|
|
5346
|
-
/**
|
|
5347
|
-
* @ignore
|
|
5348
|
-
* @internal
|
|
5349
|
-
* ApiClient for {@link LayoutEntitiesController}
|
|
5350
|
-
*/
|
|
5351
|
-
_ColumnOrRow_client.set(this, void 0);
|
|
5352
|
-
/**
|
|
5353
|
-
* Retrieves the content array of the ColumnOrRow
|
|
5354
|
-
*
|
|
5355
|
-
* @example
|
|
5356
|
-
* ```js
|
|
5357
|
-
* if (!fin.me.isView) {
|
|
5358
|
-
* throw new Error('Not running in a platform View.');
|
|
5359
|
-
* }
|
|
5360
|
-
*
|
|
5361
|
-
* const stack = await fin.me.getCurrentStack();
|
|
5362
|
-
* // Retrieves the parent ColumnOrRow
|
|
5363
|
-
* const columnOrRow = await stack.getParent();
|
|
5364
|
-
*
|
|
5365
|
-
* // returns [TabStack]
|
|
5366
|
-
* const contentArray = await columnOrRow.getContent();
|
|
5367
|
-
* console.log(`The ColumnOrRow has ${contentArray.length} item(s)`);
|
|
5368
|
-
* ```
|
|
5369
|
-
*/
|
|
5370
|
-
this.getContent = async () => {
|
|
5371
|
-
const contentItemEntities = await __classPrivateFieldGet$c(this, _ColumnOrRow_client, "f").getContent(this.entityId);
|
|
5372
|
-
return contentItemEntities.map((entity) => LayoutNode.getEntity(entity, __classPrivateFieldGet$c(this, _ColumnOrRow_client, "f")));
|
|
5373
|
-
};
|
|
5374
|
-
__classPrivateFieldSet$a(this, _ColumnOrRow_client, client, "f");
|
|
5375
|
-
this.type = type;
|
|
5376
|
-
}
|
|
5377
|
-
}
|
|
5378
|
-
layoutEntities.ColumnOrRow = ColumnOrRow;
|
|
5379
|
-
_ColumnOrRow_client = new WeakMap();
|
|
5380
|
-
|
|
5381
|
-
var layout_constants = {};
|
|
5382
|
-
|
|
5383
|
-
Object.defineProperty(layout_constants, "__esModule", { value: true });
|
|
5384
|
-
layout_constants.DEFAULT_LAYOUT_KEY = layout_constants.LAYOUT_CONTROLLER_ID = void 0;
|
|
5385
|
-
layout_constants.LAYOUT_CONTROLLER_ID = 'layout-entities';
|
|
5386
|
-
// TODO: eventually export this somehow
|
|
5387
|
-
layout_constants.DEFAULT_LAYOUT_KEY = '__default__';
|
|
5388
|
-
|
|
5389
|
-
var main = {};
|
|
5390
|
-
|
|
5391
|
-
Object.defineProperty(main, "__esModule", { value: true });
|
|
5392
|
-
main.WebContents = void 0;
|
|
5393
|
-
const base_1$i = base;
|
|
5394
|
-
class WebContents extends base_1$i.EmitterBase {
|
|
5395
|
-
/**
|
|
5396
|
-
* @param identity The identity of the {@link OpenFin.WebContentsEvents WebContents}.
|
|
5397
|
-
* @param entityType The type of the {@link OpenFin.WebContentsEvents WebContents}.
|
|
5398
|
-
*/
|
|
5399
|
-
constructor(wire, identity, entityType) {
|
|
5400
|
-
super(wire, entityType, identity.uuid, identity.name);
|
|
5401
|
-
this.identity = identity;
|
|
5402
|
-
this.entityType = entityType;
|
|
5403
|
-
}
|
|
5404
|
-
/**
|
|
5405
|
-
* Gets a base64 encoded image of all or part of the WebContents.
|
|
5406
|
-
* @param options Options for the capturePage call.
|
|
5407
|
-
*
|
|
5408
|
-
* @example
|
|
5409
|
-
*
|
|
5410
|
-
* View:
|
|
5411
|
-
* ```js
|
|
5412
|
-
* const view = fin.View.getCurrentSync();
|
|
5413
|
-
*
|
|
5414
|
-
* // PNG image of a full visible View
|
|
5415
|
-
* console.log(await view.capturePage());
|
|
5416
|
-
*
|
|
5417
|
-
* // Low-quality JPEG image of a defined visible area of the view
|
|
5418
|
-
* const options = {
|
|
5419
|
-
* area: {
|
|
5420
|
-
* height: 100,
|
|
5421
|
-
* width: 100,
|
|
5422
|
-
* x: 10,
|
|
5423
|
-
* y: 10,
|
|
5424
|
-
* },
|
|
5425
|
-
* format: 'jpg',
|
|
5426
|
-
* quality: 20
|
|
5427
|
-
* }
|
|
5428
|
-
* console.log(await view.capturePage(options));
|
|
5429
|
-
* ```
|
|
5430
|
-
*
|
|
5431
|
-
* Window:
|
|
5432
|
-
* ```js
|
|
5433
|
-
* const wnd = await fin.Window.getCurrent();
|
|
5434
|
-
*
|
|
5435
|
-
* // PNG image of a full visible window
|
|
5436
|
-
* console.log(await wnd.capturePage());
|
|
5437
|
-
*
|
|
5438
|
-
* // Low-quality JPEG image of a defined visible area of the window
|
|
5439
|
-
* const options = {
|
|
5440
|
-
* area: {
|
|
5441
|
-
* height: 100,
|
|
5442
|
-
* width: 100,
|
|
5443
|
-
* x: 10,
|
|
5444
|
-
* y: 10,
|
|
5445
|
-
* },
|
|
5446
|
-
* format: 'jpg',
|
|
5447
|
-
* quality: 20
|
|
5448
|
-
* }
|
|
5449
|
-
* console.log(await wnd.capturePage(options));
|
|
5450
|
-
* ```
|
|
5451
|
-
*
|
|
5452
|
-
* @remarks
|
|
5453
|
-
* `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
|
|
5454
|
-
* We do not expose an explicit superclass for this functionality, but it does have its own
|
|
5455
|
-
* {@link OpenFin.WebContentsEvents event namespace}.
|
|
5456
|
-
*/
|
|
5457
|
-
capturePage(options) {
|
|
5458
|
-
return this.wire.sendAction('capture-page', { options, ...this.identity }).then(({ payload }) => payload.data);
|
|
5459
|
-
}
|
|
5460
|
-
/**
|
|
5461
|
-
* Executes Javascript on the WebContents, restricted to contents you own or contents owned by
|
|
5462
|
-
* applications you have created.
|
|
5463
|
-
* @param code JavaScript code to be executed on the view.
|
|
5464
|
-
*
|
|
5465
|
-
* @example
|
|
5466
|
-
* View:
|
|
5467
|
-
* ```js
|
|
5468
|
-
* async function executeJavaScript(code) {
|
|
5469
|
-
* const view = await fin.View.wrap({uuid: 'uuid', name: 'view name'});
|
|
5470
|
-
* return await view.executeJavaScript(code);
|
|
5471
|
-
* }
|
|
5472
|
-
*
|
|
5473
|
-
* executeJavaScript(`console.log('Hello, Openfin')`).then(() => console.log('Javascript excuted')).catch(err => console.log(err));
|
|
5474
|
-
* ```
|
|
5475
|
-
*
|
|
5476
|
-
* Window:
|
|
5477
|
-
* ```js
|
|
5478
|
-
* async function executeJavaScript(code) {
|
|
5479
|
-
* const app = await fin.Application.start({
|
|
5480
|
-
* name: 'myApp',
|
|
5481
|
-
* uuid: 'app-1',
|
|
5482
|
-
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.executeJavaScript.html',
|
|
5483
|
-
* autoShow: true
|
|
5484
|
-
* });
|
|
5485
|
-
* const win = await app.getWindow();
|
|
5486
|
-
* return await win.executeJavaScript(code);
|
|
5487
|
-
* }
|
|
5488
|
-
*
|
|
5489
|
-
* executeJavaScript(`console.log('Hello, Openfin')`).then(() => console.log('Javascript excuted')).catch(err => console.log(err));
|
|
5490
|
-
* ```
|
|
5491
|
-
* @remarks
|
|
5492
|
-
* `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
|
|
5493
|
-
* We do not expose an explicit superclass for this functionality, but it does have its own
|
|
5494
|
-
* {@link OpenFin.WebContentsEvents event namespace}.
|
|
5495
|
-
*/
|
|
5496
|
-
executeJavaScript(code) {
|
|
5497
|
-
return this.wire
|
|
5498
|
-
.sendAction('execute-javascript-in-window', { ...this.identity, code })
|
|
5499
|
-
.then(({ payload }) => payload.data);
|
|
5500
|
-
}
|
|
5501
|
-
/**
|
|
5502
|
-
* Returns the zoom level of the WebContents.
|
|
5503
|
-
*
|
|
5504
|
-
* @example
|
|
5505
|
-
* View:
|
|
5506
|
-
* ```js
|
|
5507
|
-
* async function getZoomLevel() {
|
|
5508
|
-
* const view = await fin.View.getCurrent();
|
|
5509
|
-
* return await view.getZoomLevel();
|
|
5510
|
-
* }
|
|
5511
|
-
*
|
|
5512
|
-
* getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
|
|
5513
|
-
* ```
|
|
5514
|
-
*
|
|
5515
|
-
* Window:
|
|
5516
|
-
* ```js
|
|
5517
|
-
* async function createWin() {
|
|
5518
|
-
* const app = await fin.Application.start({
|
|
5519
|
-
* name: 'myApp',
|
|
5520
|
-
* uuid: 'app-1',
|
|
5521
|
-
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.getZoomLevel.html',
|
|
5522
|
-
* autoShow: true
|
|
5523
|
-
* });
|
|
5524
|
-
* return await app.getWindow();
|
|
5525
|
-
* }
|
|
5526
|
-
*
|
|
5527
|
-
* async function getZoomLevel() {
|
|
5528
|
-
* const win = await createWin();
|
|
5529
|
-
* return await win.getZoomLevel();
|
|
5530
|
-
* }
|
|
5531
|
-
*
|
|
5532
|
-
* getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
|
|
5533
|
-
* ```
|
|
5534
|
-
* @remarks
|
|
5535
|
-
* `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
|
|
5536
|
-
* We do not expose an explicit superclass for this functionality, but it does have its own
|
|
5537
|
-
* {@link OpenFin.WebContentsEvents event namespace}.
|
|
5538
|
-
*/
|
|
5539
|
-
getZoomLevel() {
|
|
5540
|
-
return this.wire.sendAction('get-zoom-level', this.identity).then(({ payload }) => payload.data);
|
|
5541
|
-
}
|
|
5542
|
-
/**
|
|
5543
|
-
* Sets the zoom level of the WebContents.
|
|
5544
|
-
* @param level The zoom level
|
|
5545
|
-
*
|
|
5546
|
-
* @example
|
|
5547
|
-
* View:
|
|
5548
|
-
* ```js
|
|
5549
|
-
* async function setZoomLevel(number) {
|
|
5550
|
-
* const view = await fin.View.getCurrent();
|
|
5551
|
-
* return await view.setZoomLevel(number);
|
|
5552
|
-
* }
|
|
5553
|
-
*
|
|
5554
|
-
* setZoomLevel(4).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
|
|
5555
|
-
* ```
|
|
5556
|
-
*
|
|
5557
|
-
* Window:
|
|
5558
|
-
* ```js
|
|
5559
|
-
* async function createWin() {
|
|
5560
|
-
* const app = await fin.Application.start({
|
|
5561
|
-
* name: 'myApp',
|
|
5562
|
-
* uuid: 'app-1',
|
|
5563
|
-
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.setZoomLevel.html',
|
|
5564
|
-
* autoShow: true
|
|
5565
|
-
* });
|
|
5566
|
-
* return await app.getWindow();
|
|
5567
|
-
* }
|
|
5568
|
-
*
|
|
5569
|
-
* async function setZoomLevel(number) {
|
|
5570
|
-
* const win = await createWin();
|
|
5571
|
-
* return await win.setZoomLevel(number);
|
|
5572
|
-
* }
|
|
5573
|
-
*
|
|
5574
|
-
* setZoomLevel(4).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
|
|
5575
|
-
* ```
|
|
5576
|
-
* @remarks
|
|
5577
|
-
* `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
|
|
5578
|
-
* We do not expose an explicit superclass for this functionality, but it does have its own
|
|
5579
|
-
* {@link OpenFin.WebContentsEvents event namespace}.
|
|
5580
|
-
*/
|
|
5581
|
-
setZoomLevel(level) {
|
|
5582
|
-
return this.wire.sendAction('set-zoom-level', { ...this.identity, level }).then(() => undefined);
|
|
5583
|
-
}
|
|
5584
|
-
/**
|
|
5585
|
-
* Navigates the WebContents to a specified URL.
|
|
5586
|
-
*
|
|
5587
|
-
* Note: The url must contain the protocol prefix such as http:// or https://.
|
|
5588
|
-
* @param url - The URL to navigate the WebContents to.
|
|
5589
|
-
*
|
|
5590
|
-
* @example
|
|
5591
|
-
* View:
|
|
5592
|
-
* ```js
|
|
5593
|
-
* async function createView() {
|
|
5594
|
-
* const me = await fin.Window.getCurrent();
|
|
5595
|
-
* return fin.View.create({
|
|
5596
|
-
* name: 'viewName',
|
|
5597
|
-
* target: me.identity,
|
|
5598
|
-
* bounds: {top: 10, left: 10, width: 200, height: 200}
|
|
5599
|
-
* });
|
|
5600
|
-
* }
|
|
5601
|
-
*
|
|
5602
|
-
* createView()
|
|
5603
|
-
* .then(view => view.navigate('https://example.com'))
|
|
5604
|
-
* .then(() => console.log('navigation complete'))
|
|
5605
|
-
* .catch(err => console.log(err));
|
|
5606
|
-
* ```
|
|
5607
|
-
*
|
|
5608
|
-
* Window:
|
|
5609
|
-
* ```js
|
|
5610
|
-
* async function navigate() {
|
|
5611
|
-
* const win = await fin.Window.getCurrent();
|
|
5612
|
-
* return await win.navigate('https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.navigate.html');
|
|
5613
|
-
* }
|
|
5614
|
-
* navigate().then(() => console.log('Navigate to tutorial')).catch(err => console.log(err));
|
|
5615
|
-
* ```
|
|
5616
|
-
* @experimental
|
|
5617
|
-
* @remarks
|
|
5618
|
-
* `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
|
|
5619
|
-
* We do not expose an explicit superclass for this functionality, but it does have its own
|
|
5620
|
-
* {@link OpenFin.WebContentsEvents event namespace}.
|
|
4966
|
+
* Navigates the WebContents to a specified URL.
|
|
4967
|
+
*
|
|
4968
|
+
* Note: The url must contain the protocol prefix such as http:// or https://.
|
|
4969
|
+
* @param url - The URL to navigate the WebContents to.
|
|
4970
|
+
*
|
|
4971
|
+
* @example
|
|
4972
|
+
* View:
|
|
4973
|
+
* ```js
|
|
4974
|
+
* async function createView() {
|
|
4975
|
+
* const me = await fin.Window.getCurrent();
|
|
4976
|
+
* return fin.View.create({
|
|
4977
|
+
* name: 'viewName',
|
|
4978
|
+
* target: me.identity,
|
|
4979
|
+
* bounds: {top: 10, left: 10, width: 200, height: 200}
|
|
4980
|
+
* });
|
|
4981
|
+
* }
|
|
4982
|
+
*
|
|
4983
|
+
* createView()
|
|
4984
|
+
* .then(view => view.navigate('https://example.com'))
|
|
4985
|
+
* .then(() => console.log('navigation complete'))
|
|
4986
|
+
* .catch(err => console.log(err));
|
|
4987
|
+
* ```
|
|
4988
|
+
*
|
|
4989
|
+
* Window:
|
|
4990
|
+
* ```js
|
|
4991
|
+
* async function navigate() {
|
|
4992
|
+
* const win = await fin.Window.getCurrent();
|
|
4993
|
+
* return await win.navigate('https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.navigate.html');
|
|
4994
|
+
* }
|
|
4995
|
+
* navigate().then(() => console.log('Navigate to tutorial')).catch(err => console.log(err));
|
|
4996
|
+
* ```
|
|
4997
|
+
* @experimental
|
|
4998
|
+
* @remarks
|
|
4999
|
+
* `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
|
|
5000
|
+
* We do not expose an explicit superclass for this functionality, but it does have its own
|
|
5001
|
+
* {@link OpenFin.WebContentsEvents event namespace}.
|
|
5621
5002
|
*/
|
|
5622
5003
|
navigate(url) {
|
|
5623
5004
|
return this.wire.sendAction('navigate-window', { ...this.identity, url }).then(() => undefined);
|
|
@@ -9089,18 +8470,11 @@ var hasRequiredInstance;
|
|
|
9089
8470
|
function requireInstance () {
|
|
9090
8471
|
if (hasRequiredInstance) return Instance$7;
|
|
9091
8472
|
hasRequiredInstance = 1;
|
|
9092
|
-
var __classPrivateFieldGet = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9093
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9094
|
-
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");
|
|
9095
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
9096
|
-
};
|
|
9097
8473
|
var _View_providerChannelClient;
|
|
9098
8474
|
Object.defineProperty(Instance$7, "__esModule", { value: true });
|
|
9099
8475
|
Instance$7.View = void 0;
|
|
9100
8476
|
const transport_errors_1 = transportErrors;
|
|
9101
8477
|
const lazy_1 = lazy;
|
|
9102
|
-
const layout_entities_1 = layoutEntities;
|
|
9103
|
-
const layout_constants_1 = layout_constants;
|
|
9104
8478
|
const main_1 = main;
|
|
9105
8479
|
const window_1 = requireWindow();
|
|
9106
8480
|
/**
|
|
@@ -9418,7 +8792,7 @@ function requireInstance () {
|
|
|
9418
8792
|
return ack.payload.data;
|
|
9419
8793
|
};
|
|
9420
8794
|
/**
|
|
9421
|
-
* Retrieves the
|
|
8795
|
+
* Retrieves the OpenFin.Layout instance for the Window the View is attached to.
|
|
9422
8796
|
*
|
|
9423
8797
|
* @example
|
|
9424
8798
|
* ```js
|
|
@@ -9434,24 +8808,7 @@ function requireInstance () {
|
|
|
9434
8808
|
this.wire.sendAction('view-get-parent-layout', { ...this.identity }).catch(() => {
|
|
9435
8809
|
// don't expose
|
|
9436
8810
|
});
|
|
9437
|
-
|
|
9438
|
-
try {
|
|
9439
|
-
const providerChannelClient = await __classPrivateFieldGet(this, _View_providerChannelClient, "f").getValue();
|
|
9440
|
-
const client = await layout_entities_1.LayoutNode.newLayoutEntitiesClient(providerChannelClient, layout_constants_1.LAYOUT_CONTROLLER_ID, layoutWindow.identity);
|
|
9441
|
-
const layoutIdentity = await client.getLayoutIdentityForViewOrThrow(this.identity);
|
|
9442
|
-
return this.fin.Platform.Layout.wrap(layoutIdentity);
|
|
9443
|
-
}
|
|
9444
|
-
catch (e) {
|
|
9445
|
-
const allowedErrors = [
|
|
9446
|
-
'No action registered at target for',
|
|
9447
|
-
'getLayoutIdentityForViewOrThrow is not a function'
|
|
9448
|
-
];
|
|
9449
|
-
if (!allowedErrors.some((m) => e.message.includes(m))) {
|
|
9450
|
-
throw e;
|
|
9451
|
-
}
|
|
9452
|
-
// fallback logic for missing endpoint
|
|
9453
|
-
return this.fin.Platform.Layout.wrap(layoutWindow.identity);
|
|
9454
|
-
}
|
|
8811
|
+
return this.fin.Platform.Layout.getLayoutByViewIdentity(this.identity);
|
|
9455
8812
|
};
|
|
9456
8813
|
/**
|
|
9457
8814
|
* Gets the View's options.
|
|
@@ -9567,11 +8924,8 @@ function requireInstance () {
|
|
|
9567
8924
|
// don't expose
|
|
9568
8925
|
});
|
|
9569
8926
|
try {
|
|
9570
|
-
const
|
|
9571
|
-
|
|
9572
|
-
const client = await layout_entities_1.LayoutNode.newLayoutEntitiesClient(providerChannelClient, layout_constants_1.LAYOUT_CONTROLLER_ID, layoutWindow.identity);
|
|
9573
|
-
const stackDefinition = (await client.getStackByView(this.identity));
|
|
9574
|
-
return layout_entities_1.LayoutNode.getEntity(stackDefinition, client);
|
|
8927
|
+
const layout = await this.getParentLayout();
|
|
8928
|
+
return layout.getStackByViewIdentity(this.identity);
|
|
9575
8929
|
}
|
|
9576
8930
|
catch (error) {
|
|
9577
8931
|
throw new transport_errors_1.RuntimeError({ reason: 'This view does not belong to a stack.', error });
|
|
@@ -10177,24 +9531,27 @@ function errorToPOJO(error) {
|
|
|
10177
9531
|
}
|
|
10178
9532
|
errors.errorToPOJO = errorToPOJO;
|
|
10179
9533
|
|
|
10180
|
-
var __classPrivateFieldSet$
|
|
9534
|
+
var __classPrivateFieldSet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
10181
9535
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
10182
9536
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
10183
9537
|
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");
|
|
10184
9538
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
10185
9539
|
};
|
|
10186
|
-
var __classPrivateFieldGet$
|
|
9540
|
+
var __classPrivateFieldGet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
10187
9541
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10188
9542
|
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");
|
|
10189
9543
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
10190
9544
|
};
|
|
9545
|
+
var __importDefault$2 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
9546
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9547
|
+
};
|
|
10191
9548
|
var _Transport_wire, _Transport_fin;
|
|
10192
9549
|
Object.defineProperty(transport, "__esModule", { value: true });
|
|
10193
9550
|
var Transport_1 = transport.Transport = void 0;
|
|
10194
|
-
const events_1$5 = require$$0;
|
|
9551
|
+
const events_1$5 = require$$0$1;
|
|
10195
9552
|
const wire_1 = wire;
|
|
10196
9553
|
const transport_errors_1$2 = transportErrors;
|
|
10197
|
-
const eventAggregator_1 = eventAggregator;
|
|
9554
|
+
const eventAggregator_1 = __importDefault$2(eventAggregator);
|
|
10198
9555
|
const me_1$1 = me;
|
|
10199
9556
|
const errors_1$1 = errors;
|
|
10200
9557
|
class Transport extends events_1$5.EventEmitter {
|
|
@@ -10208,19 +9565,19 @@ class Transport extends events_1$5.EventEmitter {
|
|
|
10208
9565
|
// Typing as unknown to avoid circular dependency, should not be used directly.
|
|
10209
9566
|
_Transport_fin.set(this, void 0);
|
|
10210
9567
|
this.connectSync = () => {
|
|
10211
|
-
const wire = __classPrivateFieldGet$
|
|
9568
|
+
const wire = __classPrivateFieldGet$c(this, _Transport_wire, "f");
|
|
10212
9569
|
wire.connectSync();
|
|
10213
9570
|
};
|
|
10214
9571
|
// This function is only used in our tests.
|
|
10215
9572
|
this.getPort = () => {
|
|
10216
|
-
const wire = __classPrivateFieldGet$
|
|
9573
|
+
const wire = __classPrivateFieldGet$c(this, _Transport_wire, "f");
|
|
10217
9574
|
return wire.getPort();
|
|
10218
9575
|
};
|
|
10219
|
-
__classPrivateFieldSet$
|
|
9576
|
+
__classPrivateFieldSet$a(this, _Transport_wire, new WireType(this.onmessage.bind(this)), "f");
|
|
10220
9577
|
this.environment = environment;
|
|
10221
|
-
this.sendRaw = __classPrivateFieldGet$
|
|
9578
|
+
this.sendRaw = __classPrivateFieldGet$c(this, _Transport_wire, "f").send.bind(__classPrivateFieldGet$c(this, _Transport_wire, "f"));
|
|
10222
9579
|
this.registerMessageHandler(this.handleMessage.bind(this));
|
|
10223
|
-
__classPrivateFieldGet$
|
|
9580
|
+
__classPrivateFieldGet$c(this, _Transport_wire, "f").on('disconnected', () => {
|
|
10224
9581
|
for (const [, { handleNack }] of this.wireListeners) {
|
|
10225
9582
|
handleNack({ reason: 'Remote connection has closed' });
|
|
10226
9583
|
}
|
|
@@ -10232,24 +9589,24 @@ class Transport extends events_1$5.EventEmitter {
|
|
|
10232
9589
|
this.me = (0, me_1$1.getBaseMe)(entityType, uuid, name);
|
|
10233
9590
|
}
|
|
10234
9591
|
getFin() {
|
|
10235
|
-
if (!__classPrivateFieldGet$
|
|
9592
|
+
if (!__classPrivateFieldGet$c(this, _Transport_fin, "f")) {
|
|
10236
9593
|
throw new Error('No Fin object registered for this transport');
|
|
10237
9594
|
}
|
|
10238
|
-
return __classPrivateFieldGet$
|
|
9595
|
+
return __classPrivateFieldGet$c(this, _Transport_fin, "f");
|
|
10239
9596
|
}
|
|
10240
9597
|
registerFin(_fin) {
|
|
10241
|
-
if (__classPrivateFieldGet$
|
|
9598
|
+
if (__classPrivateFieldGet$c(this, _Transport_fin, "f")) {
|
|
10242
9599
|
throw new Error('Fin object has already been registered for this transport');
|
|
10243
9600
|
}
|
|
10244
|
-
__classPrivateFieldSet$
|
|
9601
|
+
__classPrivateFieldSet$a(this, _Transport_fin, _fin, "f");
|
|
10245
9602
|
}
|
|
10246
9603
|
shutdown() {
|
|
10247
|
-
const wire = __classPrivateFieldGet$
|
|
9604
|
+
const wire = __classPrivateFieldGet$c(this, _Transport_wire, "f");
|
|
10248
9605
|
return wire.shutdown();
|
|
10249
9606
|
}
|
|
10250
9607
|
async connect(config) {
|
|
10251
9608
|
if ((0, wire_1.isConfigWithReceiver)(config)) {
|
|
10252
|
-
await __classPrivateFieldGet$
|
|
9609
|
+
await __classPrivateFieldGet$c(this, _Transport_wire, "f").connect(config.receiver);
|
|
10253
9610
|
return this.authorize(config);
|
|
10254
9611
|
}
|
|
10255
9612
|
if ((0, wire_1.isRemoteConfig)(config)) {
|
|
@@ -10265,13 +9622,13 @@ class Transport extends events_1$5.EventEmitter {
|
|
|
10265
9622
|
return undefined;
|
|
10266
9623
|
}
|
|
10267
9624
|
async connectRemote(config) {
|
|
10268
|
-
await __classPrivateFieldGet$
|
|
9625
|
+
await __classPrivateFieldGet$c(this, _Transport_wire, "f").connect(new (this.environment.getWsConstructor())(config.address));
|
|
10269
9626
|
return this.authorize(config);
|
|
10270
9627
|
}
|
|
10271
9628
|
async connectByPort(config) {
|
|
10272
9629
|
const { address, uuid } = config;
|
|
10273
9630
|
const reqAuthPayload = { ...config, type: 'file-token' };
|
|
10274
|
-
const wire = __classPrivateFieldGet$
|
|
9631
|
+
const wire = __classPrivateFieldGet$c(this, _Transport_wire, "f");
|
|
10275
9632
|
await wire.connect(new (this.environment.getWsConstructor())(config.address));
|
|
10276
9633
|
const requestExtAuthRet = await this.sendAction('request-external-authorization', {
|
|
10277
9634
|
uuid,
|
|
@@ -10307,7 +9664,7 @@ class Transport extends events_1$5.EventEmitter {
|
|
|
10307
9664
|
payload,
|
|
10308
9665
|
messageId
|
|
10309
9666
|
};
|
|
10310
|
-
const wire = __classPrivateFieldGet$
|
|
9667
|
+
const wire = __classPrivateFieldGet$c(this, _Transport_wire, "f");
|
|
10311
9668
|
this.addWireListener(messageId, resolve, (payload) => this.nackHandler(payload, reject, callSites), uncorrelated);
|
|
10312
9669
|
return wire.send(msg).catch(reject);
|
|
10313
9670
|
});
|
|
@@ -10329,7 +9686,7 @@ class Transport extends events_1$5.EventEmitter {
|
|
|
10329
9686
|
const resolver = (data) => {
|
|
10330
9687
|
resolve(data.payload);
|
|
10331
9688
|
};
|
|
10332
|
-
const wire = __classPrivateFieldGet$
|
|
9689
|
+
const wire = __classPrivateFieldGet$c(this, _Transport_wire, "f");
|
|
10333
9690
|
return wire
|
|
10334
9691
|
.send(origData)
|
|
10335
9692
|
.then(() => this.addWireListener(id, resolver, (payload) => this.nackHandler(payload, reject), false))
|
|
@@ -10408,7 +9765,7 @@ _Transport_wire = new WeakMap(), _Transport_fin = new WeakMap();
|
|
|
10408
9765
|
var websocket = {};
|
|
10409
9766
|
|
|
10410
9767
|
Object.defineProperty(websocket, "__esModule", { value: true });
|
|
10411
|
-
const events_1$4 = require$$0;
|
|
9768
|
+
const events_1$4 = require$$0$1;
|
|
10412
9769
|
const transport_errors_1$1 = transportErrors;
|
|
10413
9770
|
const messageReceiver_1 = bridge.messageReceiver;
|
|
10414
9771
|
/* `READY_STATE` is an instance var set by `constructor` to reference the `WebTransportSocket.READY_STATE` enum.
|
|
@@ -10485,7 +9842,7 @@ system.System = void 0;
|
|
|
10485
9842
|
const base_1$d = base;
|
|
10486
9843
|
const transport_errors_1 = transportErrors;
|
|
10487
9844
|
const window_1 = requireWindow();
|
|
10488
|
-
const events_1$3 = require$$0;
|
|
9845
|
+
const events_1$3 = require$$0$1;
|
|
10489
9846
|
/**
|
|
10490
9847
|
* An object representing the core of OpenFin Runtime. Allows the developer
|
|
10491
9848
|
* to perform system-level actions, such as accessing logs, viewing processes,
|
|
@@ -12740,12 +12097,12 @@ class ChannelBase {
|
|
|
12740
12097
|
}
|
|
12741
12098
|
channel.ChannelBase = ChannelBase;
|
|
12742
12099
|
|
|
12743
|
-
var __classPrivateFieldGet$
|
|
12100
|
+
var __classPrivateFieldGet$b = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12744
12101
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
12745
12102
|
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");
|
|
12746
12103
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12747
12104
|
};
|
|
12748
|
-
var __classPrivateFieldSet$
|
|
12105
|
+
var __classPrivateFieldSet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
12749
12106
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
12750
12107
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
12751
12108
|
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");
|
|
@@ -12787,7 +12144,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
|
12787
12144
|
static closeChannelByEndpointId(id) {
|
|
12788
12145
|
const channel = channelClientsByEndpointId.get(id);
|
|
12789
12146
|
if (channel) {
|
|
12790
|
-
__classPrivateFieldGet$
|
|
12147
|
+
__classPrivateFieldGet$b(channel, _ChannelClient_close, "f").call(channel);
|
|
12791
12148
|
}
|
|
12792
12149
|
}
|
|
12793
12150
|
/**
|
|
@@ -12798,7 +12155,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
|
12798
12155
|
for (const channelClient of channelClientsByEndpointId.values()) {
|
|
12799
12156
|
if (channelClient.providerIdentity.channelId === eventPayload.channelId) {
|
|
12800
12157
|
channelClient.disconnectListener(eventPayload);
|
|
12801
|
-
__classPrivateFieldGet$
|
|
12158
|
+
__classPrivateFieldGet$b(channelClient, _ChannelClient_close, "f").call(channelClient);
|
|
12802
12159
|
}
|
|
12803
12160
|
}
|
|
12804
12161
|
}
|
|
@@ -12813,12 +12170,12 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
|
12813
12170
|
this.processAction = (action, payload, senderIdentity) => super.processAction(action, payload, senderIdentity);
|
|
12814
12171
|
_ChannelClient_close.set(this, () => {
|
|
12815
12172
|
channelClientsByEndpointId.delete(this.endpointId);
|
|
12816
|
-
__classPrivateFieldGet$
|
|
12173
|
+
__classPrivateFieldGet$b(this, _ChannelClient_strategy, "f").close();
|
|
12817
12174
|
});
|
|
12818
|
-
__classPrivateFieldSet$
|
|
12175
|
+
__classPrivateFieldSet$9(this, _ChannelClient_protectedObj, new channel_1$1.ProtectedItems(routingInfo, close), "f");
|
|
12819
12176
|
this.disconnectListener = () => undefined;
|
|
12820
12177
|
this.endpointId = routingInfo.endpointId;
|
|
12821
|
-
__classPrivateFieldSet$
|
|
12178
|
+
__classPrivateFieldSet$9(this, _ChannelClient_strategy, strategy, "f");
|
|
12822
12179
|
channelClientsByEndpointId.set(this.endpointId, this);
|
|
12823
12180
|
strategy.receive(this.processAction);
|
|
12824
12181
|
}
|
|
@@ -12826,7 +12183,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
|
12826
12183
|
* a read-only provider identity
|
|
12827
12184
|
*/
|
|
12828
12185
|
get providerIdentity() {
|
|
12829
|
-
const protectedObj = __classPrivateFieldGet$
|
|
12186
|
+
const protectedObj = __classPrivateFieldGet$b(this, _ChannelClient_protectedObj, "f");
|
|
12830
12187
|
return protectedObj.providerIdentity;
|
|
12831
12188
|
}
|
|
12832
12189
|
/**
|
|
@@ -12855,8 +12212,8 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
|
12855
12212
|
* ```
|
|
12856
12213
|
*/
|
|
12857
12214
|
async dispatch(action, payload) {
|
|
12858
|
-
if (__classPrivateFieldGet$
|
|
12859
|
-
return __classPrivateFieldGet$
|
|
12215
|
+
if (__classPrivateFieldGet$b(this, _ChannelClient_strategy, "f").isEndpointConnected(this.providerIdentity.channelId)) {
|
|
12216
|
+
return __classPrivateFieldGet$b(this, _ChannelClient_strategy, "f").send(this.providerIdentity.channelId, action, payload);
|
|
12860
12217
|
}
|
|
12861
12218
|
throw new Error('The client you are trying to dispatch from is disconnected from the target provider.');
|
|
12862
12219
|
}
|
|
@@ -12906,10 +12263,10 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
|
12906
12263
|
*/
|
|
12907
12264
|
async disconnect() {
|
|
12908
12265
|
await this.sendDisconnectAction();
|
|
12909
|
-
__classPrivateFieldGet$
|
|
12266
|
+
__classPrivateFieldGet$b(this, _ChannelClient_close, "f").call(this);
|
|
12910
12267
|
}
|
|
12911
12268
|
async sendDisconnectAction() {
|
|
12912
|
-
const protectedObj = __classPrivateFieldGet$
|
|
12269
|
+
const protectedObj = __classPrivateFieldGet$b(this, _ChannelClient_protectedObj, "f");
|
|
12913
12270
|
await protectedObj.close();
|
|
12914
12271
|
}
|
|
12915
12272
|
/**
|
|
@@ -12942,13 +12299,13 @@ exhaustive.exhaustiveCheck = exhaustiveCheck;
|
|
|
12942
12299
|
|
|
12943
12300
|
var strategy$3 = {};
|
|
12944
12301
|
|
|
12945
|
-
var __classPrivateFieldSet$
|
|
12302
|
+
var __classPrivateFieldSet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
12946
12303
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
12947
12304
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
12948
12305
|
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");
|
|
12949
12306
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
12950
12307
|
};
|
|
12951
|
-
var __classPrivateFieldGet$
|
|
12308
|
+
var __classPrivateFieldGet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12952
12309
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
12953
12310
|
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");
|
|
12954
12311
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -12973,7 +12330,7 @@ class ClassicStrategy {
|
|
|
12973
12330
|
// connection problems occur
|
|
12974
12331
|
_ClassicStrategy_pendingMessagesByEndpointId.set(this, new Map);
|
|
12975
12332
|
this.send = async (endpointId, action, payload) => {
|
|
12976
|
-
const to = __classPrivateFieldGet$
|
|
12333
|
+
const to = __classPrivateFieldGet$a(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
|
|
12977
12334
|
if (!to) {
|
|
12978
12335
|
throw new Error(`Could not locate routing info for endpoint ${endpointId}`);
|
|
12979
12336
|
}
|
|
@@ -12985,28 +12342,28 @@ class ClassicStrategy {
|
|
|
12985
12342
|
}
|
|
12986
12343
|
delete cleanId.isLocalEndpointId;
|
|
12987
12344
|
// grab the promise before awaiting it to save in our pending messages map
|
|
12988
|
-
const p = __classPrivateFieldGet$
|
|
12345
|
+
const p = __classPrivateFieldGet$a(this, _ClassicStrategy_wire, "f")
|
|
12989
12346
|
.sendAction('send-channel-message', {
|
|
12990
12347
|
...cleanId,
|
|
12991
12348
|
providerIdentity: this.providerIdentity,
|
|
12992
12349
|
action,
|
|
12993
12350
|
payload
|
|
12994
12351
|
});
|
|
12995
|
-
__classPrivateFieldGet$
|
|
12352
|
+
__classPrivateFieldGet$a(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.add(p);
|
|
12996
12353
|
const raw = await p.catch((error) => {
|
|
12997
12354
|
throw new Error(error.message);
|
|
12998
12355
|
}).finally(() => {
|
|
12999
12356
|
// clean up the pending promise
|
|
13000
|
-
__classPrivateFieldGet$
|
|
12357
|
+
__classPrivateFieldGet$a(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.delete(p);
|
|
13001
12358
|
});
|
|
13002
12359
|
return raw.payload.data.result;
|
|
13003
12360
|
};
|
|
13004
12361
|
this.close = async () => {
|
|
13005
12362
|
this.messageReceiver.removeEndpoint(this.providerIdentity.channelId, this.endpointId);
|
|
13006
|
-
[...__classPrivateFieldGet$
|
|
13007
|
-
__classPrivateFieldSet$
|
|
12363
|
+
[...__classPrivateFieldGet$a(this, _ClassicStrategy_endpointIdentityMap, "f").keys()].forEach((id) => this.closeEndpoint(id));
|
|
12364
|
+
__classPrivateFieldSet$8(this, _ClassicStrategy_endpointIdentityMap, new Map(), "f");
|
|
13008
12365
|
};
|
|
13009
|
-
__classPrivateFieldSet$
|
|
12366
|
+
__classPrivateFieldSet$8(this, _ClassicStrategy_wire, wire, "f");
|
|
13010
12367
|
}
|
|
13011
12368
|
onEndpointDisconnect(endpointId, listener) {
|
|
13012
12369
|
// Never fires for 'classic'.
|
|
@@ -13015,20 +12372,20 @@ class ClassicStrategy {
|
|
|
13015
12372
|
this.messageReceiver.addEndpoint(listener, this.providerIdentity.channelId, this.endpointId);
|
|
13016
12373
|
}
|
|
13017
12374
|
async closeEndpoint(endpointId) {
|
|
13018
|
-
const id = __classPrivateFieldGet$
|
|
13019
|
-
__classPrivateFieldGet$
|
|
13020
|
-
const pendingSet = __classPrivateFieldGet$
|
|
12375
|
+
const id = __classPrivateFieldGet$a(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
|
|
12376
|
+
__classPrivateFieldGet$a(this, _ClassicStrategy_endpointIdentityMap, "f").delete(endpointId);
|
|
12377
|
+
const pendingSet = __classPrivateFieldGet$a(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId);
|
|
13021
12378
|
pendingSet?.forEach((p) => {
|
|
13022
12379
|
const errorMsg = `Channel connection with identity uuid: ${id?.uuid} / name: ${id?.name} / endpointId: ${endpointId} no longer connected.`;
|
|
13023
12380
|
p.cancel(new Error(errorMsg));
|
|
13024
12381
|
});
|
|
13025
12382
|
}
|
|
13026
12383
|
isEndpointConnected(endpointId) {
|
|
13027
|
-
return __classPrivateFieldGet$
|
|
12384
|
+
return __classPrivateFieldGet$a(this, _ClassicStrategy_endpointIdentityMap, "f").has(endpointId);
|
|
13028
12385
|
}
|
|
13029
12386
|
addEndpoint(endpointId, payload) {
|
|
13030
|
-
__classPrivateFieldGet$
|
|
13031
|
-
__classPrivateFieldGet$
|
|
12387
|
+
__classPrivateFieldGet$a(this, _ClassicStrategy_endpointIdentityMap, "f").set(endpointId, payload.endpointIdentity);
|
|
12388
|
+
__classPrivateFieldGet$a(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").set(endpointId, new Set());
|
|
13032
12389
|
}
|
|
13033
12390
|
isValidEndpointPayload(payload) {
|
|
13034
12391
|
return (typeof payload?.endpointIdentity?.endpointId === 'string' ||
|
|
@@ -13044,12 +12401,12 @@ var strategy$2 = {};
|
|
|
13044
12401
|
|
|
13045
12402
|
var endpoint = {};
|
|
13046
12403
|
|
|
13047
|
-
var __classPrivateFieldGet$
|
|
12404
|
+
var __classPrivateFieldGet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
13048
12405
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13049
12406
|
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");
|
|
13050
12407
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
13051
12408
|
};
|
|
13052
|
-
var __classPrivateFieldSet$
|
|
12409
|
+
var __classPrivateFieldSet$7 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
13053
12410
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
13054
12411
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
13055
12412
|
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");
|
|
@@ -13084,8 +12441,8 @@ class RTCEndpoint {
|
|
|
13084
12441
|
if (this.rtc.rtcClient.connectionState !== 'connected') {
|
|
13085
12442
|
this.rtc.rtcClient.removeEventListener('connectionstatechange', this.connectionStateChangeHandler);
|
|
13086
12443
|
this.close();
|
|
13087
|
-
if (__classPrivateFieldGet$
|
|
13088
|
-
__classPrivateFieldGet$
|
|
12444
|
+
if (__classPrivateFieldGet$9(this, _RTCEndpoint_disconnectListener, "f")) {
|
|
12445
|
+
__classPrivateFieldGet$9(this, _RTCEndpoint_disconnectListener, "f").call(this);
|
|
13089
12446
|
}
|
|
13090
12447
|
}
|
|
13091
12448
|
};
|
|
@@ -13133,9 +12490,9 @@ class RTCEndpoint {
|
|
|
13133
12490
|
data = new TextDecoder().decode(e.data);
|
|
13134
12491
|
}
|
|
13135
12492
|
const { messageId, action, payload } = JSON.parse(data);
|
|
13136
|
-
if (__classPrivateFieldGet$
|
|
12493
|
+
if (__classPrivateFieldGet$9(this, _RTCEndpoint_processAction, "f")) {
|
|
13137
12494
|
try {
|
|
13138
|
-
const res = await __classPrivateFieldGet$
|
|
12495
|
+
const res = await __classPrivateFieldGet$9(this, _RTCEndpoint_processAction, "f").call(this, action, payload, endpointIdentity);
|
|
13139
12496
|
this.rtc.channels.response.send(JSON.stringify({
|
|
13140
12497
|
messageId,
|
|
13141
12498
|
payload: res,
|
|
@@ -13169,25 +12526,25 @@ class RTCEndpoint {
|
|
|
13169
12526
|
datachannel.onclose = (e) => {
|
|
13170
12527
|
[...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.')));
|
|
13171
12528
|
this.close();
|
|
13172
|
-
if (__classPrivateFieldGet$
|
|
13173
|
-
__classPrivateFieldGet$
|
|
12529
|
+
if (__classPrivateFieldGet$9(this, _RTCEndpoint_disconnectListener, "f")) {
|
|
12530
|
+
__classPrivateFieldGet$9(this, _RTCEndpoint_disconnectListener, "f").call(this);
|
|
13174
12531
|
}
|
|
13175
12532
|
};
|
|
13176
12533
|
});
|
|
13177
12534
|
}
|
|
13178
12535
|
onDisconnect(listener) {
|
|
13179
|
-
if (!__classPrivateFieldGet$
|
|
13180
|
-
__classPrivateFieldSet$
|
|
12536
|
+
if (!__classPrivateFieldGet$9(this, _RTCEndpoint_disconnectListener, "f")) {
|
|
12537
|
+
__classPrivateFieldSet$7(this, _RTCEndpoint_disconnectListener, listener, "f");
|
|
13181
12538
|
}
|
|
13182
12539
|
else {
|
|
13183
12540
|
throw new Error('RTCEndpoint disconnectListener cannot be set twice.');
|
|
13184
12541
|
}
|
|
13185
12542
|
}
|
|
13186
12543
|
receive(listener) {
|
|
13187
|
-
if (__classPrivateFieldGet$
|
|
12544
|
+
if (__classPrivateFieldGet$9(this, _RTCEndpoint_processAction, "f")) {
|
|
13188
12545
|
throw new Error('You have already set a listener for this RTC Endpoint.');
|
|
13189
12546
|
}
|
|
13190
|
-
__classPrivateFieldSet$
|
|
12547
|
+
__classPrivateFieldSet$7(this, _RTCEndpoint_processAction, listener, "f");
|
|
13191
12548
|
}
|
|
13192
12549
|
get connected() {
|
|
13193
12550
|
return this.rtc.rtcClient.connectionState === 'connected';
|
|
@@ -13198,12 +12555,12 @@ _RTCEndpoint_processAction = new WeakMap(), _RTCEndpoint_disconnectListener = ne
|
|
|
13198
12555
|
|
|
13199
12556
|
var strategy$1 = {};
|
|
13200
12557
|
|
|
13201
|
-
var __classPrivateFieldGet$
|
|
12558
|
+
var __classPrivateFieldGet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
13202
12559
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13203
12560
|
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");
|
|
13204
12561
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
13205
12562
|
};
|
|
13206
|
-
var __classPrivateFieldSet$
|
|
12563
|
+
var __classPrivateFieldSet$6 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
13207
12564
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
13208
12565
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
13209
12566
|
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");
|
|
@@ -13224,11 +12581,11 @@ class EndpointStrategy {
|
|
|
13224
12581
|
return this.getEndpointById(endpointId).send(action, payload);
|
|
13225
12582
|
};
|
|
13226
12583
|
this.close = async () => {
|
|
13227
|
-
if (__classPrivateFieldGet$
|
|
13228
|
-
__classPrivateFieldGet$
|
|
13229
|
-
__classPrivateFieldSet$
|
|
12584
|
+
if (__classPrivateFieldGet$8(this, _EndpointStrategy_connected, "f")) {
|
|
12585
|
+
__classPrivateFieldGet$8(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.close());
|
|
12586
|
+
__classPrivateFieldSet$6(this, _EndpointStrategy_endpointMap, new Map(), "f");
|
|
13230
12587
|
}
|
|
13231
|
-
__classPrivateFieldSet$
|
|
12588
|
+
__classPrivateFieldSet$6(this, _EndpointStrategy_connected, false, "f");
|
|
13232
12589
|
};
|
|
13233
12590
|
this.isValidEndpointPayload = validateEndpoint;
|
|
13234
12591
|
}
|
|
@@ -13236,39 +12593,39 @@ class EndpointStrategy {
|
|
|
13236
12593
|
this.getEndpointById(endpointId).onDisconnect(listener);
|
|
13237
12594
|
}
|
|
13238
12595
|
receive(listener) {
|
|
13239
|
-
if (__classPrivateFieldGet$
|
|
12596
|
+
if (__classPrivateFieldGet$8(this, _EndpointStrategy_processAction, "f")) {
|
|
13240
12597
|
throw new Error(`You have already set a listener for this ${this.StrategyName} Strategy`);
|
|
13241
12598
|
}
|
|
13242
|
-
__classPrivateFieldSet$
|
|
12599
|
+
__classPrivateFieldSet$6(this, _EndpointStrategy_processAction, listener, "f");
|
|
13243
12600
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
13244
|
-
__classPrivateFieldGet$
|
|
12601
|
+
__classPrivateFieldGet$8(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.receive(__classPrivateFieldGet$8(this, _EndpointStrategy_processAction, "f")));
|
|
13245
12602
|
}
|
|
13246
12603
|
getEndpointById(endpointId) {
|
|
13247
|
-
const endpoint = __classPrivateFieldGet$
|
|
12604
|
+
const endpoint = __classPrivateFieldGet$8(this, _EndpointStrategy_endpointMap, "f").get(endpointId);
|
|
13248
12605
|
if (!endpoint) {
|
|
13249
12606
|
throw new Error(`Client with endpoint id ${endpointId} is not connected`);
|
|
13250
12607
|
}
|
|
13251
12608
|
return endpoint;
|
|
13252
12609
|
}
|
|
13253
12610
|
get connected() {
|
|
13254
|
-
return __classPrivateFieldGet$
|
|
12611
|
+
return __classPrivateFieldGet$8(this, _EndpointStrategy_connected, "f");
|
|
13255
12612
|
}
|
|
13256
12613
|
isEndpointConnected(endpointId) {
|
|
13257
|
-
return __classPrivateFieldGet$
|
|
12614
|
+
return __classPrivateFieldGet$8(this, _EndpointStrategy_endpointMap, "f").has(endpointId);
|
|
13258
12615
|
}
|
|
13259
12616
|
addEndpoint(endpointId, payload) {
|
|
13260
|
-
if (!__classPrivateFieldGet$
|
|
12617
|
+
if (!__classPrivateFieldGet$8(this, _EndpointStrategy_connected, "f")) {
|
|
13261
12618
|
console.warn(`Adding endpoint to disconnected ${this.StrategyName} Strategy`);
|
|
13262
12619
|
return;
|
|
13263
12620
|
}
|
|
13264
12621
|
const clientStrat = new this.EndpointType(payload);
|
|
13265
|
-
if (__classPrivateFieldGet$
|
|
13266
|
-
clientStrat.receive(__classPrivateFieldGet$
|
|
12622
|
+
if (__classPrivateFieldGet$8(this, _EndpointStrategy_processAction, "f")) {
|
|
12623
|
+
clientStrat.receive(__classPrivateFieldGet$8(this, _EndpointStrategy_processAction, "f"));
|
|
13267
12624
|
}
|
|
13268
|
-
__classPrivateFieldGet$
|
|
12625
|
+
__classPrivateFieldGet$8(this, _EndpointStrategy_endpointMap, "f").set(endpointId, clientStrat);
|
|
13269
12626
|
}
|
|
13270
12627
|
async closeEndpoint(endpointId) {
|
|
13271
|
-
__classPrivateFieldGet$
|
|
12628
|
+
__classPrivateFieldGet$8(this, _EndpointStrategy_endpointMap, "f").delete(endpointId);
|
|
13272
12629
|
}
|
|
13273
12630
|
}
|
|
13274
12631
|
strategy$1.EndpointStrategy = EndpointStrategy;
|
|
@@ -13450,12 +12807,12 @@ function runtimeUuidMeetsMinimumRuntimeVersion(runtimeUuid, minVersion) {
|
|
|
13450
12807
|
}
|
|
13451
12808
|
runtimeVersioning.runtimeUuidMeetsMinimumRuntimeVersion = runtimeUuidMeetsMinimumRuntimeVersion;
|
|
13452
12809
|
|
|
13453
|
-
var __classPrivateFieldGet$
|
|
12810
|
+
var __classPrivateFieldGet$7 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
13454
12811
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13455
12812
|
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");
|
|
13456
12813
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
13457
12814
|
};
|
|
13458
|
-
var __classPrivateFieldSet$
|
|
12815
|
+
var __classPrivateFieldSet$5 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
13459
12816
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
13460
12817
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
13461
12818
|
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");
|
|
@@ -13497,18 +12854,18 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
13497
12854
|
* a read-only array containing all the identities of connecting clients.
|
|
13498
12855
|
*/
|
|
13499
12856
|
get connections() {
|
|
13500
|
-
return [...__classPrivateFieldGet$
|
|
12857
|
+
return [...__classPrivateFieldGet$7(this, _ChannelProvider_connections, "f")];
|
|
13501
12858
|
}
|
|
13502
12859
|
static handleClientDisconnection(channel, payload) {
|
|
13503
12860
|
const removeById = channel.connections.find((identity) => identity.endpointId === payload.endpointId);
|
|
13504
12861
|
if (removeById) {
|
|
13505
|
-
__classPrivateFieldGet$
|
|
12862
|
+
__classPrivateFieldGet$7(channel, _ChannelProvider_removeEndpoint, "f").call(channel, removeById);
|
|
13506
12863
|
}
|
|
13507
12864
|
else {
|
|
13508
12865
|
const multipleRemoves = channel.connections.filter((identity) => {
|
|
13509
12866
|
return identity.uuid === payload.uuid && identity.name === payload.name;
|
|
13510
12867
|
});
|
|
13511
|
-
multipleRemoves.forEach(__classPrivateFieldGet$
|
|
12868
|
+
multipleRemoves.forEach(__classPrivateFieldGet$7(channel, _ChannelProvider_removeEndpoint, "f"));
|
|
13512
12869
|
}
|
|
13513
12870
|
channel.disconnectListener(payload);
|
|
13514
12871
|
}
|
|
@@ -13525,8 +12882,8 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
13525
12882
|
_ChannelProvider_strategy.set(this, void 0);
|
|
13526
12883
|
_ChannelProvider_removeEndpoint.set(this, (identity) => {
|
|
13527
12884
|
const remainingConnections = this.connections.filter((clientIdentity) => clientIdentity.endpointId !== identity.endpointId);
|
|
13528
|
-
__classPrivateFieldGet$
|
|
13529
|
-
__classPrivateFieldSet$
|
|
12885
|
+
__classPrivateFieldGet$7(this, _ChannelProvider_strategy, "f").closeEndpoint(identity.endpointId);
|
|
12886
|
+
__classPrivateFieldSet$5(this, _ChannelProvider_connections, remainingConnections, "f");
|
|
13530
12887
|
});
|
|
13531
12888
|
// Must be bound.
|
|
13532
12889
|
this.processAction = async (action, payload, senderIdentity) => {
|
|
@@ -13540,17 +12897,17 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
13540
12897
|
return super.processAction(action, payload, senderIdentity);
|
|
13541
12898
|
};
|
|
13542
12899
|
_ChannelProvider_close.set(this, () => {
|
|
13543
|
-
__classPrivateFieldGet$
|
|
12900
|
+
__classPrivateFieldGet$7(this, _ChannelProvider_strategy, "f").close();
|
|
13544
12901
|
const remove = ChannelProvider.removalMap.get(this);
|
|
13545
12902
|
if (remove) {
|
|
13546
12903
|
remove();
|
|
13547
12904
|
}
|
|
13548
12905
|
});
|
|
13549
|
-
__classPrivateFieldSet$
|
|
12906
|
+
__classPrivateFieldSet$5(this, _ChannelProvider_protectedObj, new channel_1.ProtectedItems(providerIdentity, close), "f");
|
|
13550
12907
|
this.connectListener = () => undefined;
|
|
13551
12908
|
this.disconnectListener = () => undefined;
|
|
13552
|
-
__classPrivateFieldSet$
|
|
13553
|
-
__classPrivateFieldSet$
|
|
12909
|
+
__classPrivateFieldSet$5(this, _ChannelProvider_connections, [], "f");
|
|
12910
|
+
__classPrivateFieldSet$5(this, _ChannelProvider_strategy, strategy, "f");
|
|
13554
12911
|
strategy.receive(this.processAction);
|
|
13555
12912
|
}
|
|
13556
12913
|
/**
|
|
@@ -13581,13 +12938,13 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
13581
12938
|
*/
|
|
13582
12939
|
dispatch(to, action, payload) {
|
|
13583
12940
|
const endpointId = to.endpointId ?? this.getEndpointIdForOpenFinId(to, action);
|
|
13584
|
-
if (endpointId && __classPrivateFieldGet$
|
|
13585
|
-
return __classPrivateFieldGet$
|
|
12941
|
+
if (endpointId && __classPrivateFieldGet$7(this, _ChannelProvider_strategy, "f").isEndpointConnected(endpointId)) {
|
|
12942
|
+
return __classPrivateFieldGet$7(this, _ChannelProvider_strategy, "f").send(endpointId, action, payload);
|
|
13586
12943
|
}
|
|
13587
12944
|
return Promise.reject(new Error(`Client connection with identity uuid: ${to.uuid} / name: ${to.name} / endpointId: ${endpointId} no longer connected.`));
|
|
13588
12945
|
}
|
|
13589
12946
|
async processConnection(senderId, payload) {
|
|
13590
|
-
__classPrivateFieldGet$
|
|
12947
|
+
__classPrivateFieldGet$7(this, _ChannelProvider_connections, "f").push(senderId);
|
|
13591
12948
|
return this.connectListener(senderId, payload);
|
|
13592
12949
|
}
|
|
13593
12950
|
/**
|
|
@@ -13610,7 +12967,7 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
13610
12967
|
* ```
|
|
13611
12968
|
*/
|
|
13612
12969
|
publish(action, payload) {
|
|
13613
|
-
return this.connections.map((to) => __classPrivateFieldGet$
|
|
12970
|
+
return this.connections.map((to) => __classPrivateFieldGet$7(this, _ChannelProvider_strategy, "f").send(to.endpointId, action, payload));
|
|
13614
12971
|
}
|
|
13615
12972
|
/**
|
|
13616
12973
|
* Register a listener that is called on every new client connection.
|
|
@@ -13684,11 +13041,11 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
13684
13041
|
* ```
|
|
13685
13042
|
*/
|
|
13686
13043
|
async destroy() {
|
|
13687
|
-
const protectedObj = __classPrivateFieldGet$
|
|
13044
|
+
const protectedObj = __classPrivateFieldGet$7(this, _ChannelProvider_protectedObj, "f");
|
|
13688
13045
|
protectedObj.providerIdentity;
|
|
13689
|
-
__classPrivateFieldSet$
|
|
13046
|
+
__classPrivateFieldSet$5(this, _ChannelProvider_connections, [], "f");
|
|
13690
13047
|
await protectedObj.close();
|
|
13691
|
-
__classPrivateFieldGet$
|
|
13048
|
+
__classPrivateFieldGet$7(this, _ChannelProvider_close, "f").call(this);
|
|
13692
13049
|
}
|
|
13693
13050
|
/**
|
|
13694
13051
|
* Returns an array with info on every Client connected to the Provider
|
|
@@ -13758,7 +13115,7 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
13758
13115
|
getEndpointIdForOpenFinId(clientIdentity, action) {
|
|
13759
13116
|
const matchingConnections = this.connections.filter((c) => c.name === clientIdentity.name && c.uuid === clientIdentity.uuid);
|
|
13760
13117
|
if (matchingConnections.length >= 2) {
|
|
13761
|
-
const protectedObj = __classPrivateFieldGet$
|
|
13118
|
+
const protectedObj = __classPrivateFieldGet$7(this, _ChannelProvider_protectedObj, "f");
|
|
13762
13119
|
const { uuid, name } = clientIdentity;
|
|
13763
13120
|
const providerUuid = protectedObj?.providerIdentity.uuid;
|
|
13764
13121
|
const providerName = protectedObj?.providerIdentity.name;
|
|
@@ -13967,17 +13324,20 @@ class CombinedStrategy {
|
|
|
13967
13324
|
}
|
|
13968
13325
|
strategy.default = CombinedStrategy;
|
|
13969
13326
|
|
|
13970
|
-
var __classPrivateFieldSet$
|
|
13327
|
+
var __classPrivateFieldSet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
13971
13328
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
13972
13329
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
13973
13330
|
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");
|
|
13974
13331
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
13975
13332
|
};
|
|
13976
|
-
var __classPrivateFieldGet$
|
|
13333
|
+
var __classPrivateFieldGet$6 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
13977
13334
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13978
13335
|
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");
|
|
13979
13336
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
13980
13337
|
};
|
|
13338
|
+
var __importDefault$1 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
13339
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13340
|
+
};
|
|
13981
13341
|
var _ConnectionManager_messageReceiver, _ConnectionManager_rtcConnectionManager;
|
|
13982
13342
|
Object.defineProperty(connectionManager, "__esModule", { value: true });
|
|
13983
13343
|
connectionManager.ConnectionManager = void 0;
|
|
@@ -13989,7 +13349,7 @@ const ice_manager_1 = iceManager;
|
|
|
13989
13349
|
const provider_1$1 = provider;
|
|
13990
13350
|
const message_receiver_1 = messageReceiver;
|
|
13991
13351
|
const protocol_manager_1 = protocolManager;
|
|
13992
|
-
const strategy_3 = strategy;
|
|
13352
|
+
const strategy_3 = __importDefault$1(strategy);
|
|
13993
13353
|
class ConnectionManager extends base_1$a.Base {
|
|
13994
13354
|
static getProtocolOptionsFromStrings(protocols) {
|
|
13995
13355
|
return protocols.map((protocol) => {
|
|
@@ -14019,8 +13379,8 @@ class ConnectionManager extends base_1$a.Base {
|
|
|
14019
13379
|
};
|
|
14020
13380
|
this.providerMap = new Map();
|
|
14021
13381
|
this.protocolManager = new protocol_manager_1.ProtocolManager(this.wire.environment.type === 'node' ? ['classic'] : ['rtc', 'classic']);
|
|
14022
|
-
__classPrivateFieldSet$
|
|
14023
|
-
__classPrivateFieldSet$
|
|
13382
|
+
__classPrivateFieldSet$4(this, _ConnectionManager_messageReceiver, new message_receiver_1.MessageReceiver(wire), "f");
|
|
13383
|
+
__classPrivateFieldSet$4(this, _ConnectionManager_rtcConnectionManager, new ice_manager_1.RTCICEManager(wire), "f");
|
|
14024
13384
|
wire.registerMessageHandler(this.onmessage.bind(this));
|
|
14025
13385
|
}
|
|
14026
13386
|
createProvider(options, providerIdentity) {
|
|
@@ -14031,7 +13391,7 @@ class ConnectionManager extends base_1$a.Base {
|
|
|
14031
13391
|
case 'rtc':
|
|
14032
13392
|
return new strategy_2.RTCStrategy();
|
|
14033
13393
|
case 'classic':
|
|
14034
|
-
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$
|
|
13394
|
+
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$6(this, _ConnectionManager_messageReceiver, "f"),
|
|
14035
13395
|
// Providers do not have an endpointId, use channelId as endpointId in the strategy.
|
|
14036
13396
|
providerIdentity.channelId, providerIdentity);
|
|
14037
13397
|
default:
|
|
@@ -14067,7 +13427,7 @@ class ConnectionManager extends base_1$a.Base {
|
|
|
14067
13427
|
const supportedProtocols = await Promise.all(protocols.map(async (type) => {
|
|
14068
13428
|
switch (type) {
|
|
14069
13429
|
case 'rtc': {
|
|
14070
|
-
const { rtcClient, channels, offer, rtcConnectionId, channelsOpened } = await __classPrivateFieldGet$
|
|
13430
|
+
const { rtcClient, channels, offer, rtcConnectionId, channelsOpened } = await __classPrivateFieldGet$6(this, _ConnectionManager_rtcConnectionManager, "f").startClientOffer();
|
|
14071
13431
|
rtcPacket = { rtcClient, channels, channelsOpened };
|
|
14072
13432
|
return {
|
|
14073
13433
|
type: 'rtc',
|
|
@@ -14094,18 +13454,18 @@ class ConnectionManager extends base_1$a.Base {
|
|
|
14094
13454
|
routingInfo.endpointId = this.wire.environment.getNextMessageId();
|
|
14095
13455
|
// For New Clients connecting to Old Providers. To prevent multi-dispatching and publishing, we delete previously-connected
|
|
14096
13456
|
// clients that are in the same context as the newly-connected client.
|
|
14097
|
-
__classPrivateFieldGet$
|
|
13457
|
+
__classPrivateFieldGet$6(this, _ConnectionManager_messageReceiver, "f").checkForPreviousClientConnection(routingInfo.channelId);
|
|
14098
13458
|
}
|
|
14099
13459
|
const answer = routingInfo.answer ?? {
|
|
14100
13460
|
supportedProtocols: [{ type: 'classic', version: 1 }]
|
|
14101
13461
|
};
|
|
14102
13462
|
const createStrategyFromAnswer = async (protocol) => {
|
|
14103
13463
|
if (protocol.type === 'rtc' && rtcPacket) {
|
|
14104
|
-
await __classPrivateFieldGet$
|
|
13464
|
+
await __classPrivateFieldGet$6(this, _ConnectionManager_rtcConnectionManager, "f").finishClientOffer(rtcPacket.rtcClient, protocol.payload.answer, rtcPacket.channelsOpened);
|
|
14105
13465
|
return new strategy_2.RTCStrategy();
|
|
14106
13466
|
}
|
|
14107
13467
|
if (protocol.type === 'classic') {
|
|
14108
|
-
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$
|
|
13468
|
+
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$6(this, _ConnectionManager_messageReceiver, "f"), routingInfo.endpointId, routingInfo);
|
|
14109
13469
|
}
|
|
14110
13470
|
return null;
|
|
14111
13471
|
};
|
|
@@ -14173,7 +13533,7 @@ class ConnectionManager extends base_1$a.Base {
|
|
|
14173
13533
|
clientAnswer = await overlappingProtocols.reduce(async (accumP, protocolToUse) => {
|
|
14174
13534
|
const answer = await accumP;
|
|
14175
13535
|
if (protocolToUse.type === 'rtc') {
|
|
14176
|
-
const { answer: rtcAnswer, rtcClient, channels } = await __classPrivateFieldGet$
|
|
13536
|
+
const { answer: rtcAnswer, rtcClient, channels } = await __classPrivateFieldGet$6(this, _ConnectionManager_rtcConnectionManager, "f").createProviderAnswer(protocolToUse.payload.rtcConnectionId, protocolToUse.payload.offer);
|
|
14177
13537
|
answer.supportedProtocols.push({
|
|
14178
13538
|
type: 'rtc',
|
|
14179
13539
|
version: strategy_2.RTCInfo.version,
|
|
@@ -14221,13 +13581,13 @@ _ConnectionManager_messageReceiver = new WeakMap(), _ConnectionManager_rtcConnec
|
|
|
14221
13581
|
*
|
|
14222
13582
|
* @packageDocumentation
|
|
14223
13583
|
*/
|
|
14224
|
-
var __classPrivateFieldSet$
|
|
13584
|
+
var __classPrivateFieldSet$3 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
14225
13585
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
14226
13586
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
14227
13587
|
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");
|
|
14228
13588
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
14229
13589
|
};
|
|
14230
|
-
var __classPrivateFieldGet$
|
|
13590
|
+
var __classPrivateFieldGet$5 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
14231
13591
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
14232
13592
|
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");
|
|
14233
13593
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -14236,7 +13596,7 @@ var _Channel_connectionManager, _Channel_internalEmitter, _Channel_readyToConnec
|
|
|
14236
13596
|
Object.defineProperty(channel$1, "__esModule", { value: true });
|
|
14237
13597
|
channel$1.Channel = void 0;
|
|
14238
13598
|
/* eslint-disable no-console */
|
|
14239
|
-
const events_1$2 = require$$0;
|
|
13599
|
+
const events_1$2 = require$$0$1;
|
|
14240
13600
|
const lazy_1$1 = lazy;
|
|
14241
13601
|
const base_1$9 = base;
|
|
14242
13602
|
const client_1 = client;
|
|
@@ -14284,11 +13644,11 @@ class Channel extends base_1$9.EmitterBase {
|
|
|
14284
13644
|
client_1.ChannelClient.handleProviderDisconnect(eventPayload);
|
|
14285
13645
|
}),
|
|
14286
13646
|
this.on('connected', (...args) => {
|
|
14287
|
-
__classPrivateFieldGet$
|
|
13647
|
+
__classPrivateFieldGet$5(this, _Channel_internalEmitter, "f").emit('connected', ...args);
|
|
14288
13648
|
})
|
|
14289
13649
|
]).catch(() => new Error('error setting up channel connection listeners'));
|
|
14290
13650
|
}));
|
|
14291
|
-
__classPrivateFieldSet$
|
|
13651
|
+
__classPrivateFieldSet$3(this, _Channel_connectionManager, new connection_manager_1.ConnectionManager(wire), "f");
|
|
14292
13652
|
}
|
|
14293
13653
|
/**
|
|
14294
13654
|
*
|
|
@@ -14363,7 +13723,7 @@ class Channel extends base_1$9.EmitterBase {
|
|
|
14363
13723
|
resolve(true);
|
|
14364
13724
|
}
|
|
14365
13725
|
};
|
|
14366
|
-
__classPrivateFieldGet$
|
|
13726
|
+
__classPrivateFieldGet$5(this, _Channel_internalEmitter, "f").on('connected', connectedListener);
|
|
14367
13727
|
});
|
|
14368
13728
|
try {
|
|
14369
13729
|
if (retryInfo.count > 0) {
|
|
@@ -14395,7 +13755,7 @@ class Channel extends base_1$9.EmitterBase {
|
|
|
14395
13755
|
finally {
|
|
14396
13756
|
retryInfo.count += 1;
|
|
14397
13757
|
// in case of other errors, remove our listener
|
|
14398
|
-
__classPrivateFieldGet$
|
|
13758
|
+
__classPrivateFieldGet$5(this, _Channel_internalEmitter, "f").removeListener('connected', connectedListener);
|
|
14399
13759
|
}
|
|
14400
13760
|
} while (shouldWait); // If we're waiting we retry the above loop
|
|
14401
13761
|
// Should wait was false, no channel was found.
|
|
@@ -14454,12 +13814,12 @@ class Channel extends base_1$9.EmitterBase {
|
|
|
14454
13814
|
async connect(channelName, options = {}) {
|
|
14455
13815
|
// Make sure we don't connect before listeners are set up
|
|
14456
13816
|
// This also errors if we're not in OpenFin, ensuring we don't run unnecessary code
|
|
14457
|
-
await __classPrivateFieldGet$
|
|
13817
|
+
await __classPrivateFieldGet$5(this, _Channel_readyToConnect, "f").getValue();
|
|
14458
13818
|
if (!channelName || typeof channelName !== 'string') {
|
|
14459
13819
|
throw new Error('Please provide a channelName string to connect to a channel.');
|
|
14460
13820
|
}
|
|
14461
13821
|
const opts = { wait: true, ...this.wire.environment.getDefaultChannelOptions().connect, ...options };
|
|
14462
|
-
const { offer, rtc: rtcPacket } = await __classPrivateFieldGet$
|
|
13822
|
+
const { offer, rtc: rtcPacket } = await __classPrivateFieldGet$5(this, _Channel_connectionManager, "f").createClientOffer(opts);
|
|
14463
13823
|
let connectionUrl;
|
|
14464
13824
|
if (this.fin.me.isFrame || this.fin.me.isView || this.fin.me.isWindow) {
|
|
14465
13825
|
connectionUrl = (await this.fin.me.getInfo()).url;
|
|
@@ -14471,7 +13831,7 @@ class Channel extends base_1$9.EmitterBase {
|
|
|
14471
13831
|
connectionUrl
|
|
14472
13832
|
};
|
|
14473
13833
|
const routingInfo = await this.safeConnect(channelName, opts.wait, connectPayload);
|
|
14474
|
-
const strategy = await __classPrivateFieldGet$
|
|
13834
|
+
const strategy = await __classPrivateFieldGet$5(this, _Channel_connectionManager, "f").createClientStrategy(rtcPacket, routingInfo);
|
|
14475
13835
|
const channel = new client_1.ChannelClient(routingInfo, () => client_1.ChannelClient.wireClose(this.wire, routingInfo, routingInfo.endpointId), strategy);
|
|
14476
13836
|
// It is the client's responsibility to handle endpoint disconnection to the provider.
|
|
14477
13837
|
// If the endpoint dies, the client will force a disconnection through the core.
|
|
@@ -14540,7 +13900,7 @@ class Channel extends base_1$9.EmitterBase {
|
|
|
14540
13900
|
throw new Error('Please provide a channelName to create a channel');
|
|
14541
13901
|
}
|
|
14542
13902
|
const { payload: { data: providerIdentity } } = await this.wire.sendAction('create-channel', { channelName });
|
|
14543
|
-
const channel = __classPrivateFieldGet$
|
|
13903
|
+
const channel = __classPrivateFieldGet$5(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
|
|
14544
13904
|
// TODO: fix typing (internal)
|
|
14545
13905
|
// @ts-expect-error
|
|
14546
13906
|
this.on('client-disconnected', (eventPayload) => {
|
|
@@ -14563,7 +13923,7 @@ interappbus.InterAppPayload = interappbus.InterApplicationBus = void 0;
|
|
|
14563
13923
|
*
|
|
14564
13924
|
* @packageDocumentation
|
|
14565
13925
|
*/
|
|
14566
|
-
const events_1$1 = require$$0;
|
|
13926
|
+
const events_1$1 = require$$0$1;
|
|
14567
13927
|
const base_1$8 = base;
|
|
14568
13928
|
const ref_counter_1 = refCounter;
|
|
14569
13929
|
const index_1$2 = channel$1;
|
|
@@ -15106,7 +14466,7 @@ var Factory$2 = {};
|
|
|
15106
14466
|
|
|
15107
14467
|
var Instance$2 = {};
|
|
15108
14468
|
|
|
15109
|
-
var __classPrivateFieldGet$
|
|
14469
|
+
var __classPrivateFieldGet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
15110
14470
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
15111
14471
|
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");
|
|
15112
14472
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -15139,7 +14499,7 @@ class Platform extends base_1$5.EmitterBase {
|
|
|
15139
14499
|
const target = identity || this.identity;
|
|
15140
14500
|
const { uuid } = target;
|
|
15141
14501
|
if (!clientMap.has(uuid)) {
|
|
15142
|
-
const clientPromise = __classPrivateFieldGet$
|
|
14502
|
+
const clientPromise = __classPrivateFieldGet$4(this, _Platform_connectToProvider, "f").call(this, uuid);
|
|
15143
14503
|
clientMap.set(uuid, clientPromise);
|
|
15144
14504
|
}
|
|
15145
14505
|
// we set it above
|
|
@@ -15766,181 +15126,845 @@ class Platform extends base_1$5.EmitterBase {
|
|
|
15766
15126
|
return this;
|
|
15767
15127
|
}
|
|
15768
15128
|
/**
|
|
15769
|
-
* Set the context of a host window. The context will be available to the window itself, and to its child Views. It will be saved in any platform snapshots.
|
|
15770
|
-
* It can be retrieved using {@link Platform#getWindowContext getWindowContext}.
|
|
15771
|
-
* @param context - A field where serializable context data can be stored to be saved in platform snapshots.
|
|
15772
|
-
* @param target - A target window or view may optionally be provided. If no target is provided, the update will be applied
|
|
15773
|
-
* to the current window (if called from a Window) or the current host window (if called from a View).
|
|
15774
|
-
*
|
|
15775
|
-
* @remarks The context data must be serializable. This can only be called from a window or view that has been launched into a
|
|
15776
|
-
* platform.
|
|
15777
|
-
* This method can be called from the window itself, or from any child view. Context data is shared by all
|
|
15778
|
-
* entities within a window.
|
|
15779
|
-
*
|
|
15780
|
-
* @example
|
|
15781
|
-
* Setting own context:
|
|
15782
|
-
* ```js
|
|
15783
|
-
* const platform = fin.Platform.getCurrentSync();
|
|
15784
|
-
* const contextData = {
|
|
15785
|
-
* security: 'STOCK',
|
|
15786
|
-
* currentView: 'detailed'
|
|
15787
|
-
* }
|
|
15788
|
-
*
|
|
15789
|
-
* await platform.setWindowContext(contextData);
|
|
15790
|
-
* // Context of current window is now set to `contextData`
|
|
15791
|
-
* ```
|
|
15792
|
-
*
|
|
15793
|
-
* Setting the context of another window or view:
|
|
15794
|
-
* ```js
|
|
15795
|
-
* const platform = fin.Platform.getCurrentSync();
|
|
15796
|
-
* const contextData = {
|
|
15797
|
-
* security: 'STOCK',
|
|
15798
|
-
* currentView: 'detailed'
|
|
15799
|
-
* }
|
|
15800
|
-
*
|
|
15801
|
-
* const windowOrViewIdentity = { uuid: fin.me.uuid, name: 'nameOfWindowOrView' };
|
|
15802
|
-
* await platform.setWindowContext(contextData, windowOrViewIdentity);
|
|
15803
|
-
* // Context of the target window or view is now set to `contextData`
|
|
15804
|
-
* ```
|
|
15805
|
-
*
|
|
15806
|
-
* A view can listen to changes to its host window's context by listening to the `host-context-changed` event.
|
|
15807
|
-
* This event will fire when a host window's context is updated or when the view is reparented to a new window:
|
|
15808
|
-
*
|
|
15809
|
-
* ```js
|
|
15810
|
-
* // From a view
|
|
15811
|
-
* const contextChangeHandler = ({ context }) => {
|
|
15812
|
-
* console.log('Host window\'s context has changed. New context data:', context);
|
|
15813
|
-
* // react to new context data here
|
|
15814
|
-
* }
|
|
15815
|
-
* await fin.me.on('host-context-changed', contextChangeHandler);
|
|
15816
|
-
*
|
|
15817
|
-
* const platform = await fin.Platform.getCurrentSync();
|
|
15818
|
-
* const contextData = {
|
|
15819
|
-
* security: 'STOCK',
|
|
15820
|
-
* currentView: 'detailed'
|
|
15821
|
-
* }
|
|
15822
|
-
* platform.setWindowContext(contextData) // contextChangeHandler will log the new context
|
|
15823
|
-
* ```
|
|
15824
|
-
*
|
|
15825
|
-
* To listen to a window's context updates, use the `context-changed` event:
|
|
15826
|
-
* ```js
|
|
15827
|
-
* // From a window
|
|
15828
|
-
* const contextChangeHandler = ({ context }) => {
|
|
15829
|
-
* console.log('This window\'s context has changed. New context data:', context);
|
|
15830
|
-
* // react to new context data here
|
|
15831
|
-
* }
|
|
15832
|
-
* await fin.me.on('context-changed', contextChangeHandler);
|
|
15833
|
-
*
|
|
15834
|
-
* const platform = await fin.Platform.getCurrentSync();
|
|
15835
|
-
* const contextData = {
|
|
15836
|
-
* security: 'STOCK',
|
|
15837
|
-
* currentView: 'detailed'
|
|
15838
|
-
* }
|
|
15839
|
-
* platform.setWindowContext(contextData) // contextChangeHandler will log the new context
|
|
15840
|
-
* ```
|
|
15841
|
-
* @experimental
|
|
15129
|
+
* Set the context of a host window. The context will be available to the window itself, and to its child Views. It will be saved in any platform snapshots.
|
|
15130
|
+
* It can be retrieved using {@link Platform#getWindowContext getWindowContext}.
|
|
15131
|
+
* @param context - A field where serializable context data can be stored to be saved in platform snapshots.
|
|
15132
|
+
* @param target - A target window or view may optionally be provided. If no target is provided, the update will be applied
|
|
15133
|
+
* to the current window (if called from a Window) or the current host window (if called from a View).
|
|
15134
|
+
*
|
|
15135
|
+
* @remarks The context data must be serializable. This can only be called from a window or view that has been launched into a
|
|
15136
|
+
* platform.
|
|
15137
|
+
* This method can be called from the window itself, or from any child view. Context data is shared by all
|
|
15138
|
+
* entities within a window.
|
|
15139
|
+
*
|
|
15140
|
+
* @example
|
|
15141
|
+
* Setting own context:
|
|
15142
|
+
* ```js
|
|
15143
|
+
* const platform = fin.Platform.getCurrentSync();
|
|
15144
|
+
* const contextData = {
|
|
15145
|
+
* security: 'STOCK',
|
|
15146
|
+
* currentView: 'detailed'
|
|
15147
|
+
* }
|
|
15148
|
+
*
|
|
15149
|
+
* await platform.setWindowContext(contextData);
|
|
15150
|
+
* // Context of current window is now set to `contextData`
|
|
15151
|
+
* ```
|
|
15152
|
+
*
|
|
15153
|
+
* Setting the context of another window or view:
|
|
15154
|
+
* ```js
|
|
15155
|
+
* const platform = fin.Platform.getCurrentSync();
|
|
15156
|
+
* const contextData = {
|
|
15157
|
+
* security: 'STOCK',
|
|
15158
|
+
* currentView: 'detailed'
|
|
15159
|
+
* }
|
|
15160
|
+
*
|
|
15161
|
+
* const windowOrViewIdentity = { uuid: fin.me.uuid, name: 'nameOfWindowOrView' };
|
|
15162
|
+
* await platform.setWindowContext(contextData, windowOrViewIdentity);
|
|
15163
|
+
* // Context of the target window or view is now set to `contextData`
|
|
15164
|
+
* ```
|
|
15165
|
+
*
|
|
15166
|
+
* A view can listen to changes to its host window's context by listening to the `host-context-changed` event.
|
|
15167
|
+
* This event will fire when a host window's context is updated or when the view is reparented to a new window:
|
|
15168
|
+
*
|
|
15169
|
+
* ```js
|
|
15170
|
+
* // From a view
|
|
15171
|
+
* const contextChangeHandler = ({ context }) => {
|
|
15172
|
+
* console.log('Host window\'s context has changed. New context data:', context);
|
|
15173
|
+
* // react to new context data here
|
|
15174
|
+
* }
|
|
15175
|
+
* await fin.me.on('host-context-changed', contextChangeHandler);
|
|
15176
|
+
*
|
|
15177
|
+
* const platform = await fin.Platform.getCurrentSync();
|
|
15178
|
+
* const contextData = {
|
|
15179
|
+
* security: 'STOCK',
|
|
15180
|
+
* currentView: 'detailed'
|
|
15181
|
+
* }
|
|
15182
|
+
* platform.setWindowContext(contextData) // contextChangeHandler will log the new context
|
|
15183
|
+
* ```
|
|
15184
|
+
*
|
|
15185
|
+
* To listen to a window's context updates, use the `context-changed` event:
|
|
15186
|
+
* ```js
|
|
15187
|
+
* // From a window
|
|
15188
|
+
* const contextChangeHandler = ({ context }) => {
|
|
15189
|
+
* console.log('This window\'s context has changed. New context data:', context);
|
|
15190
|
+
* // react to new context data here
|
|
15191
|
+
* }
|
|
15192
|
+
* await fin.me.on('context-changed', contextChangeHandler);
|
|
15193
|
+
*
|
|
15194
|
+
* const platform = await fin.Platform.getCurrentSync();
|
|
15195
|
+
* const contextData = {
|
|
15196
|
+
* security: 'STOCK',
|
|
15197
|
+
* currentView: 'detailed'
|
|
15198
|
+
* }
|
|
15199
|
+
* platform.setWindowContext(contextData) // contextChangeHandler will log the new context
|
|
15200
|
+
* ```
|
|
15201
|
+
* @experimental
|
|
15202
|
+
*/
|
|
15203
|
+
async setWindowContext(context = {}, target) {
|
|
15204
|
+
this.wire.sendAction('platform-set-window-context', this.identity).catch((e) => {
|
|
15205
|
+
// don't expose
|
|
15206
|
+
});
|
|
15207
|
+
if (!context) {
|
|
15208
|
+
throw new Error('Please provide a serializable object or string to set the context.');
|
|
15209
|
+
}
|
|
15210
|
+
const client = await this.getClient();
|
|
15211
|
+
const { entityType } = target ? await this.fin.System.getEntityInfo(target.uuid, target.name) : this.fin.me;
|
|
15212
|
+
await client.dispatch('set-window-context', {
|
|
15213
|
+
context,
|
|
15214
|
+
entityType,
|
|
15215
|
+
target: target || { uuid: this.fin.me.uuid, name: this.fin.me.name }
|
|
15216
|
+
});
|
|
15217
|
+
}
|
|
15218
|
+
/**
|
|
15219
|
+
* Get the context context of a host window that was previously set using {@link Platform#setWindowContext setWindowContext}.
|
|
15220
|
+
* The context will be saved in any platform snapshots. Returns a promise that resolves to the context.
|
|
15221
|
+
* @param target - A target window or view may optionally be provided. If no target is provided, target will be
|
|
15222
|
+
* the current window (if called from a Window) or the current host window (if called from a View).
|
|
15223
|
+
*
|
|
15224
|
+
* @remarks This method can be called from the window itself, or from any child view. Context data is shared
|
|
15225
|
+
* by all entities within a window.
|
|
15226
|
+
*
|
|
15227
|
+
* @example
|
|
15228
|
+
*
|
|
15229
|
+
* Retrieving context from current window:
|
|
15230
|
+
* ```js
|
|
15231
|
+
* const platform = fin.Platform.getCurrentSync();
|
|
15232
|
+
* const customContext = { answer: 42 };
|
|
15233
|
+
* await platform.setWindowContext(customContext);
|
|
15234
|
+
*
|
|
15235
|
+
* const myContext = await platform.getWindowContext();
|
|
15236
|
+
* console.log(myContext); // { answer: 42 }
|
|
15237
|
+
* ```
|
|
15238
|
+
*
|
|
15239
|
+
* Retrieving the context of another window or view:
|
|
15240
|
+
* ```js
|
|
15241
|
+
* const platform = fin.Platform.getCurrentSync();
|
|
15242
|
+
*
|
|
15243
|
+
* const windowOrViewIdentity = { uuid: fin.me.uuid, name: 'nameOfWindowOrView' };
|
|
15244
|
+
*
|
|
15245
|
+
* const targetWindowContext = await platform.getWindowContext(windowOrViewIdentity);
|
|
15246
|
+
* console.log(targetWindowContext); // context of target window
|
|
15247
|
+
* ```
|
|
15248
|
+
* @experimental
|
|
15249
|
+
*/
|
|
15250
|
+
async getWindowContext(target) {
|
|
15251
|
+
this.wire.sendAction('platform-get-window-context', this.identity).catch((e) => {
|
|
15252
|
+
// don't expose
|
|
15253
|
+
});
|
|
15254
|
+
const client = await this.getClient();
|
|
15255
|
+
const { entityType } = target ? await this.fin.System.getEntityInfo(target.uuid, target.name) : this.fin.me;
|
|
15256
|
+
return client.dispatch('get-window-context', {
|
|
15257
|
+
target: target || { uuid: this.fin.me.uuid, name: this.fin.me.name },
|
|
15258
|
+
entityType
|
|
15259
|
+
});
|
|
15260
|
+
}
|
|
15261
|
+
/**
|
|
15262
|
+
* Closes a window. If enableBeforeUnload is enabled in the Platform options, any beforeunload handler set on Views will fire
|
|
15263
|
+
* This behavior can be disabled by setting skipBeforeUnload to false in the options parameter.
|
|
15264
|
+
* @param winId
|
|
15265
|
+
* @param options
|
|
15266
|
+
*
|
|
15267
|
+
* @remarks This method works by setting a `close-requested` handler on the Platform Window. If you have your own `close-requested` handler set on the Platform Window as well,
|
|
15268
|
+
* it is recommended to move that logic over to the [PlatformProvider.closeWindow]{@link PlatformProvider#closeWindow} override to ensure it runs when the Window closes.
|
|
15269
|
+
*
|
|
15270
|
+
* @example
|
|
15271
|
+
*
|
|
15272
|
+
* ```js
|
|
15273
|
+
* // Close the current Window inside a Window context
|
|
15274
|
+
* const platform = await fin.Platform.getCurrent();
|
|
15275
|
+
* platform.closeWindow(fin.me.identity);
|
|
15276
|
+
*
|
|
15277
|
+
* // Close the Window from inside a View context
|
|
15278
|
+
* const platform = await fin.Platform.getCurrent();
|
|
15279
|
+
* const parentWindow = await fin.me.getCurrentWindow();
|
|
15280
|
+
* platform.closeWindow(parentWindow.identity);
|
|
15281
|
+
*
|
|
15282
|
+
* // Close the Window and do not fire the before unload handler on Views
|
|
15283
|
+
* const platform = await fin.Platform.getCurrent();
|
|
15284
|
+
* platform.closeWindow(fin.me.identity, { skipBeforeUnload: true });
|
|
15285
|
+
* ```
|
|
15286
|
+
* @experimental
|
|
15287
|
+
*/
|
|
15288
|
+
async closeWindow(windowId, options = { skipBeforeUnload: false }) {
|
|
15289
|
+
this.wire.sendAction('platform-close-window', this.identity).catch((e) => {
|
|
15290
|
+
// don't expose
|
|
15291
|
+
});
|
|
15292
|
+
const client = await this.getClient();
|
|
15293
|
+
return client.dispatch('close-window', { windowId, options });
|
|
15294
|
+
}
|
|
15295
|
+
}
|
|
15296
|
+
Instance$2.Platform = Platform;
|
|
15297
|
+
_Platform_connectToProvider = new WeakMap();
|
|
15298
|
+
|
|
15299
|
+
var layout = {};
|
|
15300
|
+
|
|
15301
|
+
var Factory$1 = {};
|
|
15302
|
+
|
|
15303
|
+
var Instance$1 = {};
|
|
15304
|
+
|
|
15305
|
+
var layoutEntities = {};
|
|
15306
|
+
|
|
15307
|
+
var apiExposer$1 = {};
|
|
15308
|
+
|
|
15309
|
+
var apiConsumer = {};
|
|
15310
|
+
|
|
15311
|
+
Object.defineProperty(apiConsumer, "__esModule", { value: true });
|
|
15312
|
+
apiConsumer.ApiConsumer = void 0;
|
|
15313
|
+
/**
|
|
15314
|
+
* Consumer for apis exposed with {@see ApiExposer}.
|
|
15315
|
+
*
|
|
15316
|
+
* A strategy that matches the strategy used to expose a target API must be provided.
|
|
15317
|
+
*/
|
|
15318
|
+
class ApiConsumer {
|
|
15319
|
+
// eslint-disable-next-line
|
|
15320
|
+
constructor(strategy) {
|
|
15321
|
+
this.strategy = strategy;
|
|
15322
|
+
/**
|
|
15323
|
+
* Consumes an api exposed using a given transport strategy, and generates a client
|
|
15324
|
+
* for easy, type safe consumption of that client.
|
|
15325
|
+
* @param options Strategy specific consumption options.
|
|
15326
|
+
* @returns An api client matching the given type.
|
|
15327
|
+
*/
|
|
15328
|
+
this.consume = async (options) => {
|
|
15329
|
+
const exposedProperties = await this.strategy.getExposedFunctions(options);
|
|
15330
|
+
return exposedProperties.reduce((client, prop) => ({
|
|
15331
|
+
...client,
|
|
15332
|
+
[prop.key]: this.strategy.createFunction(prop, options)
|
|
15333
|
+
}), {});
|
|
15334
|
+
};
|
|
15335
|
+
}
|
|
15336
|
+
}
|
|
15337
|
+
apiConsumer.ApiConsumer = ApiConsumer;
|
|
15338
|
+
|
|
15339
|
+
var apiExposer = {};
|
|
15340
|
+
|
|
15341
|
+
var decorators = {};
|
|
15342
|
+
|
|
15343
|
+
Object.defineProperty(decorators, "__esModule", { value: true });
|
|
15344
|
+
decorators.expose = decorators.getExposedProperties = void 0;
|
|
15345
|
+
const exposedProperties = Symbol('exposedProperties');
|
|
15346
|
+
const getExposedProperties = (target) => {
|
|
15347
|
+
return target[exposedProperties] || target.prototype[exposedProperties] || [];
|
|
15348
|
+
};
|
|
15349
|
+
decorators.getExposedProperties = getExposedProperties;
|
|
15350
|
+
/**
|
|
15351
|
+
* Indicates that a class member function can be exposed using {@link ApiExposer}.
|
|
15352
|
+
* @param options Options specific to the strategy used in {@link ApiExposer}
|
|
15353
|
+
*/
|
|
15354
|
+
// Returns any as decorator typing is weird.
|
|
15355
|
+
const expose = (options) => (target, key, descriptor) => {
|
|
15356
|
+
target[exposedProperties] = target[exposedProperties] || [];
|
|
15357
|
+
target[exposedProperties].push({ key, descriptor, options });
|
|
15358
|
+
};
|
|
15359
|
+
decorators.expose = expose;
|
|
15360
|
+
|
|
15361
|
+
Object.defineProperty(apiExposer, "__esModule", { value: true });
|
|
15362
|
+
apiExposer.ApiExposer = void 0;
|
|
15363
|
+
const decorators_1 = decorators;
|
|
15364
|
+
/**
|
|
15365
|
+
* Exposes api services on the transport of choice.
|
|
15366
|
+
*/
|
|
15367
|
+
class ApiExposer {
|
|
15368
|
+
/**
|
|
15369
|
+
* @param strategy The expose strategy to use to expose instances.
|
|
15842
15370
|
*/
|
|
15843
|
-
|
|
15844
|
-
|
|
15845
|
-
|
|
15371
|
+
// eslint-disable-next-line
|
|
15372
|
+
constructor(strategy) {
|
|
15373
|
+
this.strategy = strategy;
|
|
15374
|
+
/**
|
|
15375
|
+
* Exposes an instance of a given api on
|
|
15376
|
+
* @param instance Instance of a class which has been decorated to indicate which functions can be exposed.
|
|
15377
|
+
* @param instanceOptions Transport strategy specific options to use when exposing.
|
|
15378
|
+
*/
|
|
15379
|
+
this.exposeInstance = async (instance, instanceOptions) => {
|
|
15380
|
+
const exposableProps = (0, decorators_1.getExposedProperties)(instance);
|
|
15381
|
+
const exposedProps = await Promise.all(exposableProps.map(async ({ key, options }) => {
|
|
15382
|
+
const customConsumptionOptions = await this.strategy.exposeFunction(instance[key].bind(instance), {
|
|
15383
|
+
key,
|
|
15384
|
+
options,
|
|
15385
|
+
meta: instanceOptions
|
|
15386
|
+
});
|
|
15387
|
+
return {
|
|
15388
|
+
key,
|
|
15389
|
+
options: customConsumptionOptions
|
|
15390
|
+
};
|
|
15391
|
+
}));
|
|
15392
|
+
await this.strategy.exposeMeta(instanceOptions, exposedProps);
|
|
15393
|
+
};
|
|
15394
|
+
}
|
|
15395
|
+
;
|
|
15396
|
+
}
|
|
15397
|
+
apiExposer.ApiExposer = ApiExposer;
|
|
15398
|
+
|
|
15399
|
+
var strategies = {};
|
|
15400
|
+
|
|
15401
|
+
var openfinChannels = {};
|
|
15402
|
+
|
|
15403
|
+
var channelsConsumer = {};
|
|
15404
|
+
|
|
15405
|
+
Object.defineProperty(channelsConsumer, "__esModule", { value: true });
|
|
15406
|
+
channelsConsumer.ChannelsConsumer = void 0;
|
|
15407
|
+
class ChannelsConsumer {
|
|
15408
|
+
// eslint-disable-next-line
|
|
15409
|
+
constructor(channel) {
|
|
15410
|
+
this.channel = channel;
|
|
15411
|
+
this.getExposedFunctions = async (options) => {
|
|
15412
|
+
const { id } = options;
|
|
15413
|
+
const { props } = await this.channel.dispatch(`api-meta:${id}`);
|
|
15414
|
+
return props;
|
|
15415
|
+
};
|
|
15416
|
+
this.createFunction = (prop) => (...args) => {
|
|
15417
|
+
const { action } = prop.options;
|
|
15418
|
+
return this.channel.dispatch(action, { args });
|
|
15419
|
+
};
|
|
15420
|
+
}
|
|
15421
|
+
;
|
|
15422
|
+
}
|
|
15423
|
+
channelsConsumer.ChannelsConsumer = ChannelsConsumer;
|
|
15424
|
+
|
|
15425
|
+
var channelsExposer = {};
|
|
15426
|
+
|
|
15427
|
+
Object.defineProperty(channelsExposer, "__esModule", { value: true });
|
|
15428
|
+
channelsExposer.ChannelsExposer = void 0;
|
|
15429
|
+
class ChannelsExposer {
|
|
15430
|
+
// eslint-disable-next-line
|
|
15431
|
+
constructor(channelProviderOrClient) {
|
|
15432
|
+
this.channelProviderOrClient = channelProviderOrClient;
|
|
15433
|
+
this.exposeFunction = async (target, config) => {
|
|
15434
|
+
const { key, options, meta } = config;
|
|
15435
|
+
const { id } = meta;
|
|
15436
|
+
const action = `${id}.${options?.action || key}`;
|
|
15437
|
+
await this.channelProviderOrClient.register(action, async ({ args }) => {
|
|
15438
|
+
return target(...args);
|
|
15439
|
+
});
|
|
15440
|
+
return { action };
|
|
15441
|
+
};
|
|
15442
|
+
this.exposeMeta = async ({ id }, props) => {
|
|
15443
|
+
const action = `api-meta:${id}`;
|
|
15444
|
+
await this.channelProviderOrClient.register(action, () => ({ props }));
|
|
15445
|
+
};
|
|
15446
|
+
}
|
|
15447
|
+
}
|
|
15448
|
+
channelsExposer.ChannelsExposer = ChannelsExposer;
|
|
15449
|
+
|
|
15450
|
+
(function (exports) {
|
|
15451
|
+
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
15452
|
+
if (k2 === undefined) k2 = k;
|
|
15453
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
15454
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15455
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
15456
|
+
}
|
|
15457
|
+
Object.defineProperty(o, k2, desc);
|
|
15458
|
+
}) : (function(o, m, k, k2) {
|
|
15459
|
+
if (k2 === undefined) k2 = k;
|
|
15460
|
+
o[k2] = m[k];
|
|
15461
|
+
}));
|
|
15462
|
+
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
|
15463
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15464
|
+
};
|
|
15465
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15466
|
+
__exportStar(channelsConsumer, exports);
|
|
15467
|
+
__exportStar(channelsExposer, exports);
|
|
15468
|
+
} (openfinChannels));
|
|
15469
|
+
|
|
15470
|
+
(function (exports) {
|
|
15471
|
+
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
15472
|
+
if (k2 === undefined) k2 = k;
|
|
15473
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
15474
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15475
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
15476
|
+
}
|
|
15477
|
+
Object.defineProperty(o, k2, desc);
|
|
15478
|
+
}) : (function(o, m, k, k2) {
|
|
15479
|
+
if (k2 === undefined) k2 = k;
|
|
15480
|
+
o[k2] = m[k];
|
|
15481
|
+
}));
|
|
15482
|
+
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
|
15483
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15484
|
+
};
|
|
15485
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15486
|
+
__exportStar(openfinChannels, exports);
|
|
15487
|
+
} (strategies));
|
|
15488
|
+
|
|
15489
|
+
(function (exports) {
|
|
15490
|
+
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
15491
|
+
if (k2 === undefined) k2 = k;
|
|
15492
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
15493
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15494
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
15495
|
+
}
|
|
15496
|
+
Object.defineProperty(o, k2, desc);
|
|
15497
|
+
}) : (function(o, m, k, k2) {
|
|
15498
|
+
if (k2 === undefined) k2 = k;
|
|
15499
|
+
o[k2] = m[k];
|
|
15500
|
+
}));
|
|
15501
|
+
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
|
15502
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15503
|
+
};
|
|
15504
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15505
|
+
__exportStar(apiConsumer, exports);
|
|
15506
|
+
__exportStar(apiExposer, exports);
|
|
15507
|
+
__exportStar(strategies, exports);
|
|
15508
|
+
__exportStar(decorators, exports);
|
|
15509
|
+
} (apiExposer$1));
|
|
15510
|
+
|
|
15511
|
+
var channelApiRelay = {};
|
|
15512
|
+
|
|
15513
|
+
Object.defineProperty(channelApiRelay, "__esModule", { value: true });
|
|
15514
|
+
channelApiRelay.createRelayedDispatch = channelApiRelay.relayChannelClientApi = void 0;
|
|
15515
|
+
const EXPECTED_ERRORS = [
|
|
15516
|
+
'no longer connected',
|
|
15517
|
+
'RTCDataChannel closed unexpectedly',
|
|
15518
|
+
'The client you are trying to dispatch from is disconnected from the target provider',
|
|
15519
|
+
];
|
|
15520
|
+
// Checks possible error messages that we want to trap, client error message can originate
|
|
15521
|
+
// from ChannelProvider::dispatch OR ClassicStrategy::closeEndpoint OR RTCEndPoint::dataChannel::onclose
|
|
15522
|
+
const isDisconnectedError = (errorMsg) => {
|
|
15523
|
+
return EXPECTED_ERRORS.some(e => errorMsg.includes(e));
|
|
15524
|
+
};
|
|
15525
|
+
/**
|
|
15526
|
+
* @internal
|
|
15527
|
+
* Create a channel relay for a given channel exposition, allowing a single provider to route
|
|
15528
|
+
* actions to the designated clients.
|
|
15529
|
+
*
|
|
15530
|
+
* Designed to be used in conjunction with @expose
|
|
15531
|
+
*
|
|
15532
|
+
* @param channelProvider The channel provider to relay the actions on.
|
|
15533
|
+
* @param config Determines which actions to relay. Please ensure action prefix matches the exposed api.
|
|
15534
|
+
*/
|
|
15535
|
+
const relayChannelClientApi = async (channelProvider, relayId) => {
|
|
15536
|
+
channelProvider.register(`relay:${relayId}`, ({ action, target, payload }) => {
|
|
15537
|
+
return channelProvider.dispatch(target, action, payload);
|
|
15538
|
+
});
|
|
15539
|
+
await Promise.resolve();
|
|
15540
|
+
};
|
|
15541
|
+
channelApiRelay.relayChannelClientApi = relayChannelClientApi;
|
|
15542
|
+
const createRelayedDispatch = (client, target, relayId, relayErrorMsg) => async (action, payload) => {
|
|
15543
|
+
try {
|
|
15544
|
+
return await client.dispatch(`relay:${relayId}`, {
|
|
15545
|
+
action,
|
|
15546
|
+
payload,
|
|
15547
|
+
target
|
|
15846
15548
|
});
|
|
15847
|
-
|
|
15848
|
-
|
|
15549
|
+
}
|
|
15550
|
+
catch (e) {
|
|
15551
|
+
if (isDisconnectedError(e.message) && relayErrorMsg) {
|
|
15552
|
+
throw new Error(relayErrorMsg);
|
|
15849
15553
|
}
|
|
15850
|
-
|
|
15851
|
-
const { entityType } = target ? await this.fin.System.getEntityInfo(target.uuid, target.name) : this.fin.me;
|
|
15852
|
-
await client.dispatch('set-window-context', {
|
|
15853
|
-
context,
|
|
15854
|
-
entityType,
|
|
15855
|
-
target: target || { uuid: this.fin.me.uuid, name: this.fin.me.name }
|
|
15856
|
-
});
|
|
15554
|
+
throw e;
|
|
15857
15555
|
}
|
|
15556
|
+
};
|
|
15557
|
+
channelApiRelay.createRelayedDispatch = createRelayedDispatch;
|
|
15558
|
+
|
|
15559
|
+
var __classPrivateFieldSet$2 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
15560
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
15561
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
15562
|
+
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");
|
|
15563
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
15564
|
+
};
|
|
15565
|
+
var __classPrivateFieldGet$3 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
15566
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
15567
|
+
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");
|
|
15568
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15569
|
+
};
|
|
15570
|
+
var _LayoutNode_client, _TabStack_client, _ColumnOrRow_client;
|
|
15571
|
+
Object.defineProperty(layoutEntities, "__esModule", { value: true });
|
|
15572
|
+
layoutEntities.ColumnOrRow = layoutEntities.TabStack = layoutEntities.LayoutNode = void 0;
|
|
15573
|
+
const api_exposer_1 = apiExposer$1;
|
|
15574
|
+
const channel_api_relay_1 = channelApiRelay;
|
|
15575
|
+
/*
|
|
15576
|
+
This file includes LayoutNode, ColumnOrRow and TabStack classes, which are all closely
|
|
15577
|
+
intertwined, and share members via parent abstract class LayoutNode. To prevent circular
|
|
15578
|
+
refs, we define and export all the classes here.
|
|
15579
|
+
*/
|
|
15580
|
+
/**
|
|
15581
|
+
* @ignore
|
|
15582
|
+
* @internal
|
|
15583
|
+
* Supplies an ApiClient for {@link LayoutEntitiesController} and helper methods
|
|
15584
|
+
* for the entities {@link TabStack} AND {@link ColumnOrRow} to use.
|
|
15585
|
+
*/
|
|
15586
|
+
class LayoutNode {
|
|
15858
15587
|
/**
|
|
15859
|
-
*
|
|
15860
|
-
*
|
|
15861
|
-
* @param target - A target window or view may optionally be provided. If no target is provided, target will be
|
|
15862
|
-
* the current window (if called from a Window) or the current host window (if called from a View).
|
|
15863
|
-
*
|
|
15864
|
-
* @remarks This method can be called from the window itself, or from any child view. Context data is shared
|
|
15865
|
-
* by all entities within a window.
|
|
15866
|
-
*
|
|
15867
|
-
* @example
|
|
15868
|
-
*
|
|
15869
|
-
* Retrieving context from current window:
|
|
15870
|
-
* ```js
|
|
15871
|
-
* const platform = fin.Platform.getCurrentSync();
|
|
15872
|
-
* const customContext = { answer: 42 };
|
|
15873
|
-
* await platform.setWindowContext(customContext);
|
|
15874
|
-
*
|
|
15875
|
-
* const myContext = await platform.getWindowContext();
|
|
15876
|
-
* console.log(myContext); // { answer: 42 }
|
|
15877
|
-
* ```
|
|
15878
|
-
*
|
|
15879
|
-
* Retrieving the context of another window or view:
|
|
15880
|
-
* ```js
|
|
15881
|
-
* const platform = fin.Platform.getCurrentSync();
|
|
15882
|
-
*
|
|
15883
|
-
* const windowOrViewIdentity = { uuid: fin.me.uuid, name: 'nameOfWindowOrView' };
|
|
15884
|
-
*
|
|
15885
|
-
* const targetWindowContext = await platform.getWindowContext(windowOrViewIdentity);
|
|
15886
|
-
* console.log(targetWindowContext); // context of target window
|
|
15887
|
-
* ```
|
|
15888
|
-
* @experimental
|
|
15588
|
+
* @internal
|
|
15589
|
+
* @ignore
|
|
15889
15590
|
*/
|
|
15890
|
-
|
|
15891
|
-
|
|
15892
|
-
|
|
15893
|
-
|
|
15894
|
-
|
|
15895
|
-
|
|
15896
|
-
|
|
15897
|
-
|
|
15898
|
-
|
|
15899
|
-
|
|
15591
|
+
constructor(client, entityId) {
|
|
15592
|
+
/**
|
|
15593
|
+
* @ignore
|
|
15594
|
+
* @internal
|
|
15595
|
+
* ApiClient for {@link LayoutEntitiesController}
|
|
15596
|
+
*/
|
|
15597
|
+
_LayoutNode_client.set(this, void 0);
|
|
15598
|
+
/**
|
|
15599
|
+
* Checks if the TabStack or ColumnOrRow is the root content item
|
|
15600
|
+
*
|
|
15601
|
+
* @example
|
|
15602
|
+
* ```js
|
|
15603
|
+
* if (!fin.me.isView) {
|
|
15604
|
+
* throw new Error('Not running in a platform View.');
|
|
15605
|
+
* }
|
|
15606
|
+
*
|
|
15607
|
+
* const stack = await fin.me.getCurrentStack();
|
|
15608
|
+
* const isRoot = await stack.isRoot();
|
|
15609
|
+
* // The TabStack is root: false
|
|
15610
|
+
* console.log(`The TabStack is root: ${isRoot}`);
|
|
15611
|
+
*
|
|
15612
|
+
* // Retrieves the parent ColumnOrRow
|
|
15613
|
+
* const parent = await stack.getParent();
|
|
15614
|
+
* const parentIsRoot = await parent.isRoot();
|
|
15615
|
+
* // The parent ColumnOrRow is root: true
|
|
15616
|
+
* console.log(`The parent ColumnOrRow is root: ${parentIsRoot}`);
|
|
15617
|
+
* ```
|
|
15618
|
+
*/
|
|
15619
|
+
this.isRoot = () => __classPrivateFieldGet$3(this, _LayoutNode_client, "f").isRoot(this.entityId);
|
|
15620
|
+
/**
|
|
15621
|
+
* Checks if the TabStack or ColumnOrRow exists
|
|
15622
|
+
*
|
|
15623
|
+
* @example
|
|
15624
|
+
* ```js
|
|
15625
|
+
* if (!fin.me.isView) {
|
|
15626
|
+
* throw new Error('Not running in a platform View.');
|
|
15627
|
+
* }
|
|
15628
|
+
*
|
|
15629
|
+
* const stack = await fin.me.getCurrentStack();
|
|
15630
|
+
* // Retrieves the parent ColumnOrRow
|
|
15631
|
+
* const columnOrRow = await stack.getParent();
|
|
15632
|
+
* let exists = await stack.exists();
|
|
15633
|
+
* // or
|
|
15634
|
+
* let exists = await columnOrRow.exists();
|
|
15635
|
+
* // The entity exists: true
|
|
15636
|
+
* console.log(`The entity exists: ${exists}`);
|
|
15637
|
+
* ```
|
|
15638
|
+
*/
|
|
15639
|
+
this.exists = () => __classPrivateFieldGet$3(this, _LayoutNode_client, "f").exists(this.entityId);
|
|
15640
|
+
/**
|
|
15641
|
+
* Retrieves the parent of the TabStack or ColumnOrRow
|
|
15642
|
+
*
|
|
15643
|
+
* @example
|
|
15644
|
+
* ```js
|
|
15645
|
+
* if (!fin.me.isView) {
|
|
15646
|
+
* throw new Error('Not running in a platform View.');
|
|
15647
|
+
* }
|
|
15648
|
+
*
|
|
15649
|
+
* const stack = await fin.me.getCurrentStack();
|
|
15650
|
+
* // Retrieves the parent ColumnOrRow
|
|
15651
|
+
* const columnOrRow = await stack.getParent();
|
|
15652
|
+
*
|
|
15653
|
+
* // undefined if entity is the root item
|
|
15654
|
+
* let parent = await columnOrRow.getParent();
|
|
15655
|
+
* // or
|
|
15656
|
+
* let parent = await stack.getParent();
|
|
15657
|
+
* ```
|
|
15658
|
+
*/
|
|
15659
|
+
this.getParent = async () => {
|
|
15660
|
+
const parent = await __classPrivateFieldGet$3(this, _LayoutNode_client, "f").getParent(this.entityId);
|
|
15661
|
+
if (!parent) {
|
|
15662
|
+
return undefined;
|
|
15663
|
+
}
|
|
15664
|
+
return LayoutNode.getEntity(parent, __classPrivateFieldGet$3(this, _LayoutNode_client, "f"));
|
|
15665
|
+
};
|
|
15666
|
+
/**
|
|
15667
|
+
* Creates a new TabStack adjacent to the given TabStack or ColumnOrRow. Inputs can be new views to create, or existing views.
|
|
15668
|
+
*
|
|
15669
|
+
* Known Issue: If the number of views to add overflows the tab-container, the added views will be set as active
|
|
15670
|
+
* during each render, and then placed at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
|
|
15671
|
+
* This means the views you pass to createAdjacentStack() may not render in the order given by the array.
|
|
15672
|
+
* Until fixed, this problem can be avoided only if your window is wide enough to fit creating all the views in the tabstack.
|
|
15673
|
+
*
|
|
15674
|
+
* @param views The views that will populate the new TabStack.
|
|
15675
|
+
* @param options Additional options that control new TabStack creation.
|
|
15676
|
+
* @returns The newly-created TabStack.
|
|
15677
|
+
*
|
|
15678
|
+
* @example
|
|
15679
|
+
* ```js
|
|
15680
|
+
* if (!fin.me.isView) {
|
|
15681
|
+
* throw new Error('Not running in a platform View.');
|
|
15682
|
+
* }
|
|
15683
|
+
*
|
|
15684
|
+
* const stack = await fin.me.getCurrentStack();
|
|
15685
|
+
* const columnOrRow = await stack.getParent();
|
|
15686
|
+
*
|
|
15687
|
+
* // Create view references by supplying a 'name' and 'url'
|
|
15688
|
+
* const views = [
|
|
15689
|
+
* // if 'name' is undefined, one will be generated
|
|
15690
|
+
* // if 'url' is undefined, it will default the view URL to 'about:blank'
|
|
15691
|
+
* { name: 'google-view', url: 'http://google.com/'},
|
|
15692
|
+
* { name: 'of-developers-view', url: 'http://developers.openfin.co/'},
|
|
15693
|
+
* ];
|
|
15694
|
+
*
|
|
15695
|
+
* // Create a view beforehand to be included in the new tab stack
|
|
15696
|
+
* const outsideView = await fin.View.create({
|
|
15697
|
+
* name: 'outside-bloomberg-view',
|
|
15698
|
+
* url: 'https://bloomberg.com/',
|
|
15699
|
+
* target: fin.me.identity,
|
|
15700
|
+
* });
|
|
15701
|
+
*
|
|
15702
|
+
* // Views to add can be identities, or the reference views mentioned above
|
|
15703
|
+
* const viewsToAdd = [outsideView.identity, ...views];
|
|
15704
|
+
*
|
|
15705
|
+
* // Possible position inputs: 'right' | 'left' | 'top' | 'bottom'
|
|
15706
|
+
* let stackFrom = await columnOrRow.createAdjacentStack(viewsToAdd, { position: 'right' });
|
|
15707
|
+
* // Or
|
|
15708
|
+
* let newStack = await stack.createAdjacentStack(viewsToAdd, { position: 'right' });
|
|
15709
|
+
* console.log(`A new TabStack created to the right has ${newStack.length} views in it`);
|
|
15710
|
+
*
|
|
15711
|
+
* ```
|
|
15712
|
+
* @experimental
|
|
15713
|
+
*/
|
|
15714
|
+
this.createAdjacentStack = async (views, options) => {
|
|
15715
|
+
const entityId = await __classPrivateFieldGet$3(this, _LayoutNode_client, "f").createAdjacentStack(this.entityId, views, options);
|
|
15716
|
+
return LayoutNode.getEntity({ entityId, type: 'stack' }, __classPrivateFieldGet$3(this, _LayoutNode_client, "f"));
|
|
15717
|
+
};
|
|
15718
|
+
/**
|
|
15719
|
+
* Retrieves the adjacent TabStacks of the given TabStack or ColumnOrRow.
|
|
15720
|
+
*
|
|
15721
|
+
* @param edge Edge whose adjacent TabStacks will be returned.
|
|
15722
|
+
*
|
|
15723
|
+
* @example
|
|
15724
|
+
* ```js
|
|
15725
|
+
* if (!fin.me.isView) {
|
|
15726
|
+
* throw new Error('Not running in a platform View.');
|
|
15727
|
+
* }
|
|
15728
|
+
*
|
|
15729
|
+
* const stack = await fin.me.getCurrentStack();
|
|
15730
|
+
* const columnOrRow = await stack.getParent();
|
|
15731
|
+
* // Possible position inputs: 'right' | 'left' | 'top' | 'bottom'
|
|
15732
|
+
* let rightStacks = await columnOrRow.getAdjacentStacks('right');
|
|
15733
|
+
* let leftStacks = await columnOrRow.getAdjacentStacks('left');
|
|
15734
|
+
* // or
|
|
15735
|
+
* let rightStacks = await stack.getAdjacentStacks('right');
|
|
15736
|
+
* let leftStacks = await stack.getAdjacentStacks('left');
|
|
15737
|
+
*
|
|
15738
|
+
* console.log(`The entity has ${rightStacks.length} stacks to the right, and ${leftStacks.length} stacks to the left`);
|
|
15739
|
+
*
|
|
15740
|
+
* ```
|
|
15741
|
+
* @experimental
|
|
15742
|
+
*/
|
|
15743
|
+
this.getAdjacentStacks = async (edge) => {
|
|
15744
|
+
const adjacentStacks = await __classPrivateFieldGet$3(this, _LayoutNode_client, "f").getAdjacentStacks({
|
|
15745
|
+
targetId: this.entityId,
|
|
15746
|
+
edge
|
|
15747
|
+
});
|
|
15748
|
+
return adjacentStacks.map((stack) => LayoutNode.getEntity({
|
|
15749
|
+
type: 'stack',
|
|
15750
|
+
entityId: stack.entityId
|
|
15751
|
+
}, __classPrivateFieldGet$3(this, _LayoutNode_client, "f")));
|
|
15752
|
+
};
|
|
15753
|
+
__classPrivateFieldSet$2(this, _LayoutNode_client, client, "f");
|
|
15754
|
+
this.entityId = entityId;
|
|
15755
|
+
}
|
|
15756
|
+
}
|
|
15757
|
+
layoutEntities.LayoutNode = LayoutNode;
|
|
15758
|
+
_LayoutNode_client = new WeakMap();
|
|
15759
|
+
/**
|
|
15760
|
+
* @ignore
|
|
15761
|
+
* @internal
|
|
15762
|
+
* Encapsulates Api consumption of {@link LayoutEntitiesClient} with a relayed dispatch
|
|
15763
|
+
* @param client
|
|
15764
|
+
* @param controllerId
|
|
15765
|
+
* @param identity
|
|
15766
|
+
* @returns a new instance of {@link LayoutEntitiesClient} with bound to the controllerId
|
|
15767
|
+
*/
|
|
15768
|
+
LayoutNode.newLayoutEntitiesClient = async (client, controllerId, identity) => {
|
|
15769
|
+
const dispatch = (0, channel_api_relay_1.createRelayedDispatch)(client, identity, 'layout-relay', 'You are trying to interact with a layout component on a window that does not exist or has been destroyed.');
|
|
15770
|
+
const consumer = new api_exposer_1.ApiConsumer(new api_exposer_1.ChannelsConsumer({ dispatch }));
|
|
15771
|
+
return consumer.consume({ id: controllerId });
|
|
15772
|
+
};
|
|
15773
|
+
LayoutNode.getEntity = (definition, client) => {
|
|
15774
|
+
const { entityId, type } = definition;
|
|
15775
|
+
switch (type) {
|
|
15776
|
+
case 'column':
|
|
15777
|
+
case 'row':
|
|
15778
|
+
return new ColumnOrRow(client, entityId, type);
|
|
15779
|
+
case 'stack':
|
|
15780
|
+
return new TabStack(client, entityId);
|
|
15781
|
+
default:
|
|
15782
|
+
throw new Error(`Unrecognised Layout Entity encountered ('${JSON.stringify(definition)})`);
|
|
15783
|
+
}
|
|
15784
|
+
};
|
|
15785
|
+
/**
|
|
15786
|
+
* A TabStack is used to manage the state of a stack of tabs within an OpenFin Layout.
|
|
15787
|
+
*/
|
|
15788
|
+
class TabStack extends LayoutNode {
|
|
15789
|
+
/** @internal */
|
|
15790
|
+
constructor(client, entityId) {
|
|
15791
|
+
super(client, entityId);
|
|
15792
|
+
/**
|
|
15793
|
+
* @internal
|
|
15794
|
+
* ApiClient for {@link LayoutEntitiesController}
|
|
15795
|
+
*/
|
|
15796
|
+
_TabStack_client.set(this, void 0);
|
|
15797
|
+
/**
|
|
15798
|
+
* Type of the content item. Always stack, but useful for distinguishing between a {@link TabStack} and {@link ColumnOrRow}.
|
|
15799
|
+
*/
|
|
15800
|
+
this.type = 'stack';
|
|
15801
|
+
/**
|
|
15802
|
+
* Retrieves a list of all views belonging to this {@link TabStack}.
|
|
15803
|
+
*
|
|
15804
|
+
* Known Issue: If adding a view overflows the tab-container width, the added view will be set as active
|
|
15805
|
+
* and rendered at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
|
|
15806
|
+
* If that happens and then getViews() is called, it will return the identities in a different order than
|
|
15807
|
+
* than the currently rendered tab order.
|
|
15808
|
+
*
|
|
15809
|
+
*
|
|
15810
|
+
* @throws If the {@link TabStack} has been destroyed.
|
|
15811
|
+
* @example
|
|
15812
|
+
* ```js
|
|
15813
|
+
* if (!fin.me.isView) {
|
|
15814
|
+
* throw new Error('Not running in a platform View.');
|
|
15815
|
+
* }
|
|
15816
|
+
*
|
|
15817
|
+
* const stack = await fin.me.getCurrentStack();
|
|
15818
|
+
* // Alternatively, you can wrap any view and get the stack from there
|
|
15819
|
+
* // const viewFromSomewhere = fin.View.wrapSync(someView.identity);
|
|
15820
|
+
* // const stack = await viewFromSomewhere.getCurrentStack();
|
|
15821
|
+
* const views = await stack.getViews();
|
|
15822
|
+
* console.log(`Stack contains ${views.length} view(s)`);
|
|
15823
|
+
* ```
|
|
15824
|
+
* @experimental
|
|
15825
|
+
*/
|
|
15826
|
+
this.getViews = () => __classPrivateFieldGet$3(this, _TabStack_client, "f").getStackViews(this.entityId);
|
|
15827
|
+
/**
|
|
15828
|
+
* Adds or creates a view in this {@link TabStack}.
|
|
15829
|
+
*
|
|
15830
|
+
* @remarks Known Issue: If adding a view overflows the tab-container, the added view will be set as active
|
|
15831
|
+
* and rendered at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
|
|
15832
|
+
*
|
|
15833
|
+
* @param view The identity of an existing view to add, or options to create a view.
|
|
15834
|
+
* @param options Optional view options: index number used to insert the view into the stack at that index. Defaults to 0 (front of the stack)
|
|
15835
|
+
* @returns Resolves with the {@link OpenFin.Identity identity} of the added view.
|
|
15836
|
+
* @throws If the view does not exist or fails to create.
|
|
15837
|
+
* @throws If the {@link TabStack} has been destroyed.
|
|
15838
|
+
* @example
|
|
15839
|
+
* ```js
|
|
15840
|
+
* if (!fin.me.isView) {
|
|
15841
|
+
* throw new Error('Not running in a platform View.');
|
|
15842
|
+
* }
|
|
15843
|
+
*
|
|
15844
|
+
* const stack = await fin.me.getCurrentStack();
|
|
15845
|
+
* // Alternatively, you can wrap any view and get the stack from there
|
|
15846
|
+
* // const viewFromSomewhere = fin.View.wrapSync(someView.identity);
|
|
15847
|
+
* // const stack = await viewFromSomewhere.getCurrentStack();
|
|
15848
|
+
* const googleViewIdentity = await stack.addView({ name: 'google-view', url: 'http://google.com/' });
|
|
15849
|
+
* console.log('Identity of the google view just added', { googleViewIdentity });
|
|
15850
|
+
* // pass in { index: number } to set the index in the stack. Here 1 means, end of the stack (defaults to 0)
|
|
15851
|
+
* const appleViewIdentity = await stack.addView({ name: 'apple-view', url: 'http://apple.com/' }, { index: 1 });
|
|
15852
|
+
* console.log('Identity of the apple view just added', { appleViewIdentity });
|
|
15853
|
+
* ```
|
|
15854
|
+
* @experimental
|
|
15855
|
+
*/
|
|
15856
|
+
this.addView = async (view, options = { index: 0 }) => __classPrivateFieldGet$3(this, _TabStack_client, "f").addViewToStack(this.entityId, view, options);
|
|
15857
|
+
/**
|
|
15858
|
+
* Removes a view from this {@link TabStack}.
|
|
15859
|
+
*
|
|
15860
|
+
* @remarks Throws an exception if the view identity does not exist or was already destroyed.
|
|
15861
|
+
*
|
|
15862
|
+
* @param view - Identity of the view to remove.
|
|
15863
|
+
* @throws If the view does not exist or does not belong to the stack.
|
|
15864
|
+
* @throws If the {@link TabStack} has been destroyed.
|
|
15865
|
+
*
|
|
15866
|
+
* @example
|
|
15867
|
+
* ```js
|
|
15868
|
+
* if (!fin.me.isView) {
|
|
15869
|
+
* throw new Error('Not running in a platform View.');
|
|
15870
|
+
* }
|
|
15871
|
+
*
|
|
15872
|
+
* const stack = await fin.me.getCurrentStack();
|
|
15873
|
+
* const googleViewIdentity = await stack.addView({ name: 'google-view', url: 'http://google.com/' });
|
|
15874
|
+
*
|
|
15875
|
+
* await stack.removeView(googleViewIdentity);
|
|
15876
|
+
*
|
|
15877
|
+
* try {
|
|
15878
|
+
* await stack.removeView(googleViewIdentity);
|
|
15879
|
+
* } catch (error) {
|
|
15880
|
+
* // Tried to remove a view ('google-view') which does not belong to the stack.
|
|
15881
|
+
* console.log(error);
|
|
15882
|
+
* }
|
|
15883
|
+
* ```
|
|
15884
|
+
*/
|
|
15885
|
+
this.removeView = async (view) => {
|
|
15886
|
+
await __classPrivateFieldGet$3(this, _TabStack_client, "f").removeViewFromStack(this.entityId, view);
|
|
15887
|
+
};
|
|
15888
|
+
/**
|
|
15889
|
+
* Sets the active view of the {@link TabStack} without focusing it.
|
|
15890
|
+
* @param view - Identity of the view to activate.
|
|
15891
|
+
* @returns Promise which resolves with void once the view has been activated.
|
|
15892
|
+
* @throws If the {@link TabStack} has been destroyed.
|
|
15893
|
+
* @throws If the view does not exist.
|
|
15894
|
+
* @example
|
|
15895
|
+
* Change the active tab of a known View's TabStack:
|
|
15896
|
+
* ```js
|
|
15897
|
+
* const targetView = fin.View.wrapSync({ uuid: 'uuid', name: 'view-name' });
|
|
15898
|
+
* const stack = await targetView.getCurrentStack();
|
|
15899
|
+
* await stack.setActiveView(targetView.identity);
|
|
15900
|
+
* ```
|
|
15901
|
+
*
|
|
15902
|
+
* Set the current View as active within its TabStack:
|
|
15903
|
+
* ```js
|
|
15904
|
+
* const stack = await fin.me.getCurrentStack();
|
|
15905
|
+
* await stack.setActiveView(fin.me.identity);
|
|
15906
|
+
* ```
|
|
15907
|
+
* @experimental
|
|
15908
|
+
*/
|
|
15909
|
+
this.setActiveView = async (view) => {
|
|
15910
|
+
await __classPrivateFieldGet$3(this, _TabStack_client, "f").setStackActiveView(this.entityId, view);
|
|
15911
|
+
};
|
|
15912
|
+
__classPrivateFieldSet$2(this, _TabStack_client, client, "f");
|
|
15900
15913
|
}
|
|
15914
|
+
}
|
|
15915
|
+
layoutEntities.TabStack = TabStack;
|
|
15916
|
+
_TabStack_client = new WeakMap();
|
|
15917
|
+
/**
|
|
15918
|
+
* A ColumnOrRow is used to manage the state of Column and Rows within an OpenFin Layout.
|
|
15919
|
+
*/
|
|
15920
|
+
class ColumnOrRow extends LayoutNode {
|
|
15901
15921
|
/**
|
|
15902
|
-
*
|
|
15903
|
-
* This behavior can be disabled by setting skipBeforeUnload to false in the options parameter.
|
|
15904
|
-
* @param winId
|
|
15905
|
-
* @param options
|
|
15906
|
-
*
|
|
15907
|
-
* @remarks This method works by setting a `close-requested` handler on the Platform Window. If you have your own `close-requested` handler set on the Platform Window as well,
|
|
15908
|
-
* it is recommended to move that logic over to the [PlatformProvider.closeWindow]{@link PlatformProvider#closeWindow} override to ensure it runs when the Window closes.
|
|
15909
|
-
*
|
|
15910
|
-
* @example
|
|
15911
|
-
*
|
|
15912
|
-
* ```js
|
|
15913
|
-
* // Close the current Window inside a Window context
|
|
15914
|
-
* const platform = await fin.Platform.getCurrent();
|
|
15915
|
-
* platform.closeWindow(fin.me.identity);
|
|
15916
|
-
*
|
|
15917
|
-
* // Close the Window from inside a View context
|
|
15918
|
-
* const platform = await fin.Platform.getCurrent();
|
|
15919
|
-
* const parentWindow = await fin.me.getCurrentWindow();
|
|
15920
|
-
* platform.closeWindow(parentWindow.identity);
|
|
15921
|
-
*
|
|
15922
|
-
* // Close the Window and do not fire the before unload handler on Views
|
|
15923
|
-
* const platform = await fin.Platform.getCurrent();
|
|
15924
|
-
* platform.closeWindow(fin.me.identity, { skipBeforeUnload: true });
|
|
15925
|
-
* ```
|
|
15926
|
-
* @experimental
|
|
15922
|
+
* @internal
|
|
15927
15923
|
*/
|
|
15928
|
-
|
|
15929
|
-
|
|
15930
|
-
|
|
15931
|
-
|
|
15932
|
-
|
|
15933
|
-
|
|
15924
|
+
constructor(client, entityId, type) {
|
|
15925
|
+
super(client, entityId);
|
|
15926
|
+
/**
|
|
15927
|
+
* @ignore
|
|
15928
|
+
* @internal
|
|
15929
|
+
* ApiClient for {@link LayoutEntitiesController}
|
|
15930
|
+
*/
|
|
15931
|
+
_ColumnOrRow_client.set(this, void 0);
|
|
15932
|
+
/**
|
|
15933
|
+
* Retrieves the content array of the ColumnOrRow
|
|
15934
|
+
*
|
|
15935
|
+
* @example
|
|
15936
|
+
* ```js
|
|
15937
|
+
* if (!fin.me.isView) {
|
|
15938
|
+
* throw new Error('Not running in a platform View.');
|
|
15939
|
+
* }
|
|
15940
|
+
*
|
|
15941
|
+
* const stack = await fin.me.getCurrentStack();
|
|
15942
|
+
* // Retrieves the parent ColumnOrRow
|
|
15943
|
+
* const columnOrRow = await stack.getParent();
|
|
15944
|
+
*
|
|
15945
|
+
* // returns [TabStack]
|
|
15946
|
+
* const contentArray = await columnOrRow.getContent();
|
|
15947
|
+
* console.log(`The ColumnOrRow has ${contentArray.length} item(s)`);
|
|
15948
|
+
* ```
|
|
15949
|
+
*/
|
|
15950
|
+
this.getContent = async () => {
|
|
15951
|
+
const contentItemEntities = await __classPrivateFieldGet$3(this, _ColumnOrRow_client, "f").getContent(this.entityId);
|
|
15952
|
+
return contentItemEntities.map((entity) => LayoutNode.getEntity(entity, __classPrivateFieldGet$3(this, _ColumnOrRow_client, "f")));
|
|
15953
|
+
};
|
|
15954
|
+
__classPrivateFieldSet$2(this, _ColumnOrRow_client, client, "f");
|
|
15955
|
+
this.type = type;
|
|
15934
15956
|
}
|
|
15935
15957
|
}
|
|
15936
|
-
|
|
15937
|
-
|
|
15938
|
-
|
|
15939
|
-
var layout = {};
|
|
15958
|
+
layoutEntities.ColumnOrRow = ColumnOrRow;
|
|
15959
|
+
_ColumnOrRow_client = new WeakMap();
|
|
15940
15960
|
|
|
15941
|
-
var
|
|
15961
|
+
var layout_constants = {};
|
|
15942
15962
|
|
|
15943
|
-
|
|
15963
|
+
Object.defineProperty(layout_constants, "__esModule", { value: true });
|
|
15964
|
+
layout_constants.DEFAULT_LAYOUT_KEY = layout_constants.LAYOUT_CONTROLLER_ID = void 0;
|
|
15965
|
+
layout_constants.LAYOUT_CONTROLLER_ID = 'layout-entities';
|
|
15966
|
+
// TODO: eventually export this somehow
|
|
15967
|
+
layout_constants.DEFAULT_LAYOUT_KEY = '__default__';
|
|
15944
15968
|
|
|
15945
15969
|
var __classPrivateFieldGet$2 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
15946
15970
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
@@ -16089,6 +16113,12 @@ const layout_constants_1$1 = layout_constants;
|
|
|
16089
16113
|
* ```
|
|
16090
16114
|
*/
|
|
16091
16115
|
class Layout extends base_1$4.Base {
|
|
16116
|
+
/**
|
|
16117
|
+
* @internal
|
|
16118
|
+
*/
|
|
16119
|
+
static getClient(layout) {
|
|
16120
|
+
return __classPrivateFieldGet$2(layout, _Layout_layoutClient, "f").getValue();
|
|
16121
|
+
}
|
|
16092
16122
|
/**
|
|
16093
16123
|
* @internal
|
|
16094
16124
|
*/
|
|
@@ -16313,6 +16343,27 @@ class Layout extends base_1$4.Base {
|
|
|
16313
16343
|
const root = await client.getRoot('layoutName' in this.identity ? this.identity : undefined);
|
|
16314
16344
|
return layout_entities_1.LayoutNode.getEntity(root, client);
|
|
16315
16345
|
}
|
|
16346
|
+
/**
|
|
16347
|
+
* Retrieves the OpenFin.TabStack instance which the View belongs to.
|
|
16348
|
+
*
|
|
16349
|
+
* @example
|
|
16350
|
+
* ```js
|
|
16351
|
+
* const viewIdentity = { uuid: 'uuid', name: 'view-name' };
|
|
16352
|
+
* const stack = await fin.View.wrapSync(viewIdentity).getStackByViewIdentity(viewIdentity);
|
|
16353
|
+
* console.log(await stack.getViews());
|
|
16354
|
+
* ```
|
|
16355
|
+
*/
|
|
16356
|
+
async getStackByViewIdentity(identity) {
|
|
16357
|
+
this.wire.sendAction('layout-get-stack-by-view').catch(() => {
|
|
16358
|
+
// don't expose
|
|
16359
|
+
});
|
|
16360
|
+
const client = await __classPrivateFieldGet$2(this, _Layout_layoutClient, "f").getValue();
|
|
16361
|
+
const stack = await client.getStackByView(identity);
|
|
16362
|
+
if (!stack) {
|
|
16363
|
+
throw new Error(`No stack found for view: ${identity.uuid}/${identity.name}`);
|
|
16364
|
+
}
|
|
16365
|
+
return layout_entities_1.LayoutNode.getEntity(stack, client);
|
|
16366
|
+
}
|
|
16316
16367
|
}
|
|
16317
16368
|
Instance$1.Layout = Layout;
|
|
16318
16369
|
_Layout_layoutClient = new WeakMap();
|
|
@@ -16506,7 +16557,7 @@ class LayoutModule extends base_1$3.Base {
|
|
|
16506
16557
|
this.wire.sendAction('layout-get-current').catch((e) => {
|
|
16507
16558
|
// don't expose
|
|
16508
16559
|
});
|
|
16509
|
-
if (!this.fin.me.isWindow) {
|
|
16560
|
+
if (this.wire.environment.type === 'openfin' && !this.fin.me.isWindow) {
|
|
16510
16561
|
throw new Error('You are not in a Window context. Only Windows can have a Layout.');
|
|
16511
16562
|
}
|
|
16512
16563
|
const { uuid, name } = this.fin.me;
|
|
@@ -16529,12 +16580,50 @@ class LayoutModule extends base_1$3.Base {
|
|
|
16529
16580
|
this.wire.sendAction('layout-get-current-sync').catch((e) => {
|
|
16530
16581
|
// don't expose
|
|
16531
16582
|
});
|
|
16532
|
-
if (!this.fin.me.isWindow) {
|
|
16583
|
+
if (this.wire.environment.type === 'openfin' && !this.fin.me.isWindow) {
|
|
16533
16584
|
throw new Error('You are not in a Window context. Only Windows can have a Layout.');
|
|
16534
16585
|
}
|
|
16535
16586
|
const { uuid, name } = this.fin.me;
|
|
16536
16587
|
return this.wrapSync({ uuid, name });
|
|
16537
16588
|
}
|
|
16589
|
+
/**
|
|
16590
|
+
* Retrieves the OpenFin.Layout instance for the Window the View is attached to.
|
|
16591
|
+
*
|
|
16592
|
+
* @example
|
|
16593
|
+
* ```js
|
|
16594
|
+
* const viewIdentity = { uuid: 'uuid', name: 'view-name' };
|
|
16595
|
+
* const layout = await fin.Platform.Layout.getLayoutByViewIdentity(viewIdentity);
|
|
16596
|
+
* console.log(await layout.getCurrentViews());
|
|
16597
|
+
* ```
|
|
16598
|
+
*/
|
|
16599
|
+
async getLayoutByViewIdentity(viewIdentity) {
|
|
16600
|
+
this.wire.sendAction('layout-get-by-view-identity').catch(() => {
|
|
16601
|
+
// don't expose
|
|
16602
|
+
});
|
|
16603
|
+
const winIdentity = await this.wire.environment.getViewWindowIdentity(this.fin, viewIdentity);
|
|
16604
|
+
let layoutWindowIdentity = winIdentity;
|
|
16605
|
+
// TODO: CORE-1857 - when we tearout active layout or drag a view out of a window, the above identity includes the whole window info.
|
|
16606
|
+
if (layoutWindowIdentity.identity) {
|
|
16607
|
+
layoutWindowIdentity = layoutWindowIdentity.identity;
|
|
16608
|
+
}
|
|
16609
|
+
try {
|
|
16610
|
+
const layoutWindow = this.wrapSync(layoutWindowIdentity);
|
|
16611
|
+
const client = await Instance_1$2.Layout.getClient(layoutWindow);
|
|
16612
|
+
const layoutIdentity = await client.getLayoutIdentityForViewOrThrow(viewIdentity);
|
|
16613
|
+
return this.wrapSync(layoutIdentity);
|
|
16614
|
+
}
|
|
16615
|
+
catch (e) {
|
|
16616
|
+
const allowedErrors = [
|
|
16617
|
+
'No action registered at target for',
|
|
16618
|
+
'getLayoutIdentityForViewOrThrow is not a function'
|
|
16619
|
+
];
|
|
16620
|
+
if (!allowedErrors.some((m) => e.message.includes(m))) {
|
|
16621
|
+
throw e;
|
|
16622
|
+
}
|
|
16623
|
+
// fallback logic for missing endpoint in older runtimes
|
|
16624
|
+
return this.wrapSync(layoutWindowIdentity);
|
|
16625
|
+
}
|
|
16626
|
+
}
|
|
16538
16627
|
}
|
|
16539
16628
|
Factory$1.LayoutModule = LayoutModule;
|
|
16540
16629
|
_LayoutModule_layoutInitializationAttempted = new WeakMap(), _LayoutModule_layoutManager = new WeakMap(), _LayoutModule_getLayoutManagerSpy = new WeakMap(), _LayoutModule_instances = new WeakSet(), _LayoutModule_getSafeLayoutManager = function _LayoutModule_getSafeLayoutManager(method) {
|
|
@@ -17130,7 +17219,7 @@ Factory.SnapshotSourceModule = SnapshotSourceModule;
|
|
|
17130
17219
|
|
|
17131
17220
|
Object.defineProperty(fin$1, "__esModule", { value: true });
|
|
17132
17221
|
var Fin_1 = fin$1.Fin = void 0;
|
|
17133
|
-
const events_1 = require$$0;
|
|
17222
|
+
const events_1 = require$$0$1;
|
|
17134
17223
|
// Import from the file rather than the directory in case someone consuming types is using module resolution other than "node"
|
|
17135
17224
|
const index_1 = system;
|
|
17136
17225
|
const index_2 = requireWindow();
|
|
@@ -17179,12 +17268,15 @@ Fin_1 = fin$1.Fin = Fin;
|
|
|
17179
17268
|
|
|
17180
17269
|
var browser = {};
|
|
17181
17270
|
|
|
17271
|
+
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
17272
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17273
|
+
};
|
|
17182
17274
|
Object.defineProperty(browser, "__esModule", { value: true });
|
|
17183
17275
|
browser.remoteConnectInterop = browser.remoteConnect = getRemoteConnectionPayload_1 = browser.getRemoteConnectionPayload = void 0;
|
|
17184
17276
|
const fin_1 = fin$1;
|
|
17185
17277
|
const browser_1 = browser$1;
|
|
17186
17278
|
const transport_1 = transport;
|
|
17187
|
-
const websocket_1 = websocket;
|
|
17279
|
+
const websocket_1 = __importDefault(websocket);
|
|
17188
17280
|
async function getRemoteConnectionPayload(fin, uuid = `browser-connection-${Math.random().toString().slice(2)}`, interopProviderId = fin.me.uuid) {
|
|
17189
17281
|
const { token } = await fin.System.registerExternalConnection(uuid);
|
|
17190
17282
|
const { port } = await fin.System.getRuntimeInfo();
|