@openfin/node-adapter 34.78.50 → 34.78.52
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/README.md +11 -11
- package/out/node-adapter-alpha.d.ts +1164 -726
- package/out/node-adapter-beta.d.ts +1164 -726
- package/out/node-adapter-public.d.ts +1164 -726
- package/out/node-adapter.d.ts +1195 -822
- package/out/node-adapter.js +213 -37
- package/package.json +1 -1
package/out/node-adapter.js
CHANGED
@@ -1092,14 +1092,14 @@ _LayoutNode_client = new WeakMap();
|
|
1092
1092
|
/**
|
1093
1093
|
* @ignore
|
1094
1094
|
* @internal
|
1095
|
-
* Encapsulates Api consumption of {@link
|
1095
|
+
* Encapsulates Api consumption of {@link LayoutEntitiesClient} with a relayed dispatch
|
1096
1096
|
* @param client
|
1097
1097
|
* @param controllerId
|
1098
1098
|
* @param identity
|
1099
1099
|
* @returns a new instance of {@link LayoutEntitiesClient} with bound to the controllerId
|
1100
1100
|
*/
|
1101
1101
|
LayoutNode.newLayoutEntitiesClient = async (client, controllerId, identity) => {
|
1102
|
-
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 has been destroyed.');
|
1102
|
+
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.');
|
1103
1103
|
const consumer = new api_exposer_1.ApiConsumer(new api_exposer_1.ChannelsConsumer({ dispatch }));
|
1104
1104
|
return consumer.consume({ id: controllerId });
|
1105
1105
|
};
|
@@ -1409,8 +1409,9 @@ _ColumnOrRow_client = new WeakMap();
|
|
1409
1409
|
var layout_constants = {};
|
1410
1410
|
|
1411
1411
|
Object.defineProperty(layout_constants, "__esModule", { value: true });
|
1412
|
-
layout_constants.LAYOUT_CONTROLLER_ID = void 0;
|
1412
|
+
layout_constants.DEFAULT_LAYOUT_KEY = layout_constants.LAYOUT_CONTROLLER_ID = void 0;
|
1413
1413
|
layout_constants.LAYOUT_CONTROLLER_ID = 'layout-entities';
|
1414
|
+
layout_constants.DEFAULT_LAYOUT_KEY = 'default';
|
1414
1415
|
|
1415
1416
|
var main = {};
|
1416
1417
|
|
@@ -2986,8 +2987,24 @@ function requireInstance$2 () {
|
|
2986
2987
|
this.wire.sendAction('view-get-parent-layout', { ...this.identity }).catch(() => {
|
2987
2988
|
// don't expose
|
2988
2989
|
});
|
2989
|
-
const
|
2990
|
-
|
2990
|
+
const layoutWindow = await this.getCurrentWindow();
|
2991
|
+
try {
|
2992
|
+
const providerChannelClient = await __classPrivateFieldGet(this, _View_providerChannelClient, "f").getValue();
|
2993
|
+
const client = await layout_entities_1.LayoutNode.newLayoutEntitiesClient(providerChannelClient, layout_constants_1.LAYOUT_CONTROLLER_ID, layoutWindow.identity);
|
2994
|
+
const layoutIdentity = await client.getLayoutIdentityForViewOrThrow(this.identity);
|
2995
|
+
return this.fin.Platform.Layout.wrap(layoutIdentity);
|
2996
|
+
}
|
2997
|
+
catch (e) {
|
2998
|
+
const allowedErrors = [
|
2999
|
+
'No action registered at target for',
|
3000
|
+
'getLayoutIdentityForViewOrThrow is not a function'
|
3001
|
+
];
|
3002
|
+
if (!allowedErrors.some((m) => e.message.includes(m))) {
|
3003
|
+
throw e;
|
3004
|
+
}
|
3005
|
+
// fallback logic for missing endpoint
|
3006
|
+
return this.fin.Platform.Layout.wrap(layoutWindow.identity);
|
3007
|
+
}
|
2991
3008
|
};
|
2992
3009
|
/**
|
2993
3010
|
* Gets the View's options.
|
@@ -5419,15 +5436,15 @@ function requireInstance () {
|
|
5419
5436
|
* ```
|
5420
5437
|
* @experimental
|
5421
5438
|
*/
|
5422
|
-
async getLayout() {
|
5439
|
+
async getLayout(layoutIdentity) {
|
5423
5440
|
this.wire.sendAction('window-get-layout', this.identity).catch((e) => {
|
5424
5441
|
// don't expose
|
5425
5442
|
});
|
5426
5443
|
const opts = await this.getOptions();
|
5427
|
-
if (!opts.layout) {
|
5444
|
+
if (!opts.layout || !opts.layoutSnapshot) {
|
5428
5445
|
throw new Error('Window does not have a Layout');
|
5429
5446
|
}
|
5430
|
-
return this.fin.Platform.Layout.wrap(this.identity);
|
5447
|
+
return this.fin.Platform.Layout.wrap(layoutIdentity ?? this.identity);
|
5431
5448
|
}
|
5432
5449
|
/**
|
5433
5450
|
* Gets the current settings of the window.
|
@@ -7419,6 +7436,79 @@ class System extends base_1$j.EmitterBase {
|
|
7419
7436
|
openUrlWithBrowser(url) {
|
7420
7437
|
return this.wire.sendAction('open-url-with-browser', { url }).then(() => undefined);
|
7421
7438
|
}
|
7439
|
+
/**
|
7440
|
+
* Creates a new registry entry under the HKCU root Windows registry key if the given custom protocol name doesn't exist or
|
7441
|
+
* overwrites the existing registry entry if the given custom protocol name already exists.
|
7442
|
+
*
|
7443
|
+
* Note: This method is restricted by default and must be enabled via
|
7444
|
+
* {@link https://developers.openfin.co/docs/api-security API security settings}. It requires RVM 12 or higher version.
|
7445
|
+
*
|
7446
|
+
*
|
7447
|
+
* @remarks These protocols are reserved and cannot be registered:
|
7448
|
+
* - fin
|
7449
|
+
* - fins
|
7450
|
+
* - openfin
|
7451
|
+
* - URI Schemes registered with {@link https://en.wikipedia.org/wiki/List_of_URI_schemes#Official_IANA-registered_schemes IANA}
|
7452
|
+
*
|
7453
|
+
* @throws if a given custom protocol failed to be registered.
|
7454
|
+
* @throws if a manifest URL contains the '%1' string.
|
7455
|
+
* @throws if a manifest URL contains a query string parameter which name equals to the Protocol Launch Request Parameter Name.
|
7456
|
+
* @throws if the full length of the command string that is to be written to the registry exceeds 2048 bytes.
|
7457
|
+
*
|
7458
|
+
* @example
|
7459
|
+
* ```js
|
7460
|
+
* fin.System.registerCustomProtocol({protocolName:'protocol1'}).then(console.log).catch(console.error);
|
7461
|
+
* ```
|
7462
|
+
*/
|
7463
|
+
async registerCustomProtocol(options) {
|
7464
|
+
if (typeof options !== 'object') {
|
7465
|
+
throw new Error('Must provide an object with a `protocolName` property having a string value.');
|
7466
|
+
}
|
7467
|
+
await this.wire.sendAction('register-custom-protocol', options);
|
7468
|
+
}
|
7469
|
+
/**
|
7470
|
+
* Removes the registry entry for a given custom protocol.
|
7471
|
+
*
|
7472
|
+
* Note: This method is restricted by default and must be enabled via
|
7473
|
+
* {@link https://developers.openfin.co/docs/api-security API security settings}. It requires RVM 12 or higher version.
|
7474
|
+
*
|
7475
|
+
*
|
7476
|
+
* @remarks These protocols are reserved and cannot be unregistered:
|
7477
|
+
* - fin
|
7478
|
+
* - fins
|
7479
|
+
* - openfin
|
7480
|
+
* - URI Schemes registered with {@link https://en.wikipedia.org/wiki/List_of_URI_schemes#Official_IANA-registered_schemes IANA}
|
7481
|
+
*
|
7482
|
+
* @throws if a protocol entry failed to be removed in registry.
|
7483
|
+
*
|
7484
|
+
* @example
|
7485
|
+
* ```js
|
7486
|
+
* await fin.System.unregisterCustomProtocol('protocol1');
|
7487
|
+
* ```
|
7488
|
+
*/
|
7489
|
+
async unregisterCustomProtocol(protocolName) {
|
7490
|
+
await this.wire.sendAction('unregister-custom-protocol', { protocolName });
|
7491
|
+
}
|
7492
|
+
/**
|
7493
|
+
* Retrieves the registration state for a given custom protocol.
|
7494
|
+
*
|
7495
|
+
* Note: This method is restricted by default and must be enabled via
|
7496
|
+
* {@link https://developers.openfin.co/docs/api-security API security settings}. It requires RVM 12 or higher version.
|
7497
|
+
*
|
7498
|
+
* @remarks These protocols are reserved and cannot get states for them:
|
7499
|
+
* - fin
|
7500
|
+
* - fins
|
7501
|
+
* - openfin
|
7502
|
+
* - URI Schemes registered with {@link https://en.wikipedia.org/wiki/List_of_URI_schemes#Official_IANA-registered_schemes IANA}
|
7503
|
+
*
|
7504
|
+
*
|
7505
|
+
* @example
|
7506
|
+
* ```js
|
7507
|
+
* const protocolState = await fin.System.getCustomProtocolState('protocol1');
|
7508
|
+
*/
|
7509
|
+
async getCustomProtocolState(protocolName) {
|
7510
|
+
return this.wire.sendAction('get-custom-protocol-state', { protocolName }).then(({ payload }) => payload.data);
|
7511
|
+
}
|
7422
7512
|
/**
|
7423
7513
|
* Removes the process entry for the passed UUID obtained from a prior call
|
7424
7514
|
* of fin.System.launchExternalProcess().
|
@@ -9721,10 +9811,10 @@ _ChannelProvider_connections = new WeakMap(), _ChannelProvider_protectedObj = ne
|
|
9721
9811
|
// static #removalMap = new WeakMap<ChannelProvider, Function>();
|
9722
9812
|
ChannelProvider.removalMap = new WeakMap();
|
9723
9813
|
|
9724
|
-
var messageReceiver = {};
|
9814
|
+
var messageReceiver$1 = {};
|
9725
9815
|
|
9726
|
-
Object.defineProperty(messageReceiver, "__esModule", { value: true });
|
9727
|
-
messageReceiver.MessageReceiver = void 0;
|
9816
|
+
Object.defineProperty(messageReceiver$1, "__esModule", { value: true });
|
9817
|
+
messageReceiver$1.MessageReceiver = void 0;
|
9728
9818
|
const client_1$1 = client;
|
9729
9819
|
const base_1$h = base$1;
|
9730
9820
|
/*
|
@@ -9795,7 +9885,7 @@ class MessageReceiver extends base_1$h.Base {
|
|
9795
9885
|
}
|
9796
9886
|
}
|
9797
9887
|
}
|
9798
|
-
messageReceiver.MessageReceiver = MessageReceiver;
|
9888
|
+
messageReceiver$1.MessageReceiver = MessageReceiver;
|
9799
9889
|
|
9800
9890
|
var protocolManager = {};
|
9801
9891
|
|
@@ -9919,7 +10009,7 @@ const strategy_1 = strategy$2;
|
|
9919
10009
|
const strategy_2 = strategy$1;
|
9920
10010
|
const ice_manager_1 = iceManager;
|
9921
10011
|
const provider_1$1 = provider;
|
9922
|
-
const message_receiver_1 = messageReceiver;
|
10012
|
+
const message_receiver_1 = messageReceiver$1;
|
9923
10013
|
const protocol_manager_1 = protocolManager;
|
9924
10014
|
const strategy_3 = strategy;
|
9925
10015
|
class ConnectionManager extends base_1$g.Base {
|
@@ -11402,6 +11492,8 @@ class GlobalHotkey extends base_1$8.EmitterBase {
|
|
11402
11492
|
* Registers a global hotkey with the operating system.
|
11403
11493
|
* @param hotkey a hotkey string
|
11404
11494
|
* @param listener called when the registered hotkey is pressed by the user.
|
11495
|
+
* @throws If the `hotkey` is reserved, see list below.
|
11496
|
+
* @throws if the `hotkey` is already registered by another application.
|
11405
11497
|
*
|
11406
11498
|
* @remarks The `hotkey` parameter expects an electron compatible [accelerator](https://github.com/electron/electron/blob/master/docs/api/accelerator.md) and the `listener` will be called if the `hotkey` is pressed by the user.
|
11407
11499
|
* If successfull, the hotkey will be 'claimed' by the application, meaning that this register call can be called multiple times from within the same application but will fail if another application has registered the hotkey.
|
@@ -11494,7 +11586,7 @@ class GlobalHotkey extends base_1$8.EmitterBase {
|
|
11494
11586
|
return undefined;
|
11495
11587
|
}
|
11496
11588
|
/**
|
11497
|
-
* Checks if a given hotkey has been registered
|
11589
|
+
* Checks if a given hotkey has been registered by an application within the current runtime.
|
11498
11590
|
* @param hotkey a hotkey string
|
11499
11591
|
*
|
11500
11592
|
* @example
|
@@ -12700,6 +12792,7 @@ class Layout extends base_1$6.Base {
|
|
12700
12792
|
// don't expose
|
12701
12793
|
});
|
12702
12794
|
const client = await this.platform.getClient();
|
12795
|
+
console.log(`Layout::toConfig() called!`);
|
12703
12796
|
return client.dispatch('get-frame-snapshot', {
|
12704
12797
|
target: this.identity
|
12705
12798
|
});
|
@@ -12749,7 +12842,7 @@ class Layout extends base_1$6.Base {
|
|
12749
12842
|
// don't expose
|
12750
12843
|
});
|
12751
12844
|
const client = await __classPrivateFieldGet$5(this, _Layout_layoutClient, "f").getValue();
|
12752
|
-
const root = await client.getRoot();
|
12845
|
+
const root = await client.getRoot(this.identity);
|
12753
12846
|
return layout_entities_1.LayoutNode.getEntity(root, client);
|
12754
12847
|
}
|
12755
12848
|
}
|
@@ -12767,10 +12860,9 @@ var __classPrivateFieldSet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateF
|
|
12767
12860
|
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");
|
12768
12861
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
12769
12862
|
};
|
12770
|
-
var _LayoutModule_layoutInitializationAttempted;
|
12863
|
+
var _LayoutModule_instances, _LayoutModule_layoutInitializationAttempted, _LayoutModule_layoutManager, _LayoutModule_throwIfLayoutManagerNotInitialized;
|
12771
12864
|
Object.defineProperty(Factory$2, "__esModule", { value: true });
|
12772
12865
|
Factory$2.LayoutModule = void 0;
|
12773
|
-
/* eslint-disable no-undef, import/prefer-default-export */
|
12774
12866
|
const base_1$5 = base$1;
|
12775
12867
|
const Instance_1$2 = Instance$1;
|
12776
12868
|
/**
|
@@ -12779,7 +12871,9 @@ const Instance_1$2 = Instance$1;
|
|
12779
12871
|
class LayoutModule extends base_1$5.Base {
|
12780
12872
|
constructor() {
|
12781
12873
|
super(...arguments);
|
12874
|
+
_LayoutModule_instances.add(this);
|
12782
12875
|
_LayoutModule_layoutInitializationAttempted.set(this, false);
|
12876
|
+
_LayoutModule_layoutManager.set(this, null);
|
12783
12877
|
/**
|
12784
12878
|
* Initialize the window's Layout.
|
12785
12879
|
*
|
@@ -12826,10 +12920,43 @@ class LayoutModule extends base_1$5.Base {
|
|
12826
12920
|
throw new Error('Layout.init can only be called from a Window context.');
|
12827
12921
|
}
|
12828
12922
|
else if (__classPrivateFieldGet$4(this, _LayoutModule_layoutInitializationAttempted, "f")) {
|
12829
|
-
throw new Error('Layout
|
12923
|
+
throw new Error('Layout.init was already called, please use Layout.create to add additional layouts.');
|
12830
12924
|
}
|
12831
12925
|
__classPrivateFieldSet$4(this, _LayoutModule_layoutInitializationAttempted, true, "f");
|
12832
|
-
|
12926
|
+
__classPrivateFieldSet$4(this, _LayoutModule_layoutManager, await this.wire.environment.initLayout(this.fin, this.wire, options), "f");
|
12927
|
+
// back-compat ONLY if layoutManagerOverride not provided
|
12928
|
+
if (!options.layoutManagerOverride) {
|
12929
|
+
const layoutInstance = await __classPrivateFieldGet$4(this, _LayoutModule_layoutManager, "f").resolveLayout();
|
12930
|
+
const layout = this.wrapSync(layoutInstance.identity);
|
12931
|
+
// Backward compat - undocumented / not typed layoutInstance as layoutManager
|
12932
|
+
return Object.assign(layout, { layoutManager: layoutInstance });
|
12933
|
+
}
|
12934
|
+
// Warn user if they do not create any layouts in the next 10 seconds
|
12935
|
+
setTimeout(() => {
|
12936
|
+
const layoutSize = Object.keys(__classPrivateFieldGet$4(this, _LayoutModule_layoutManager, "f").getLayouts()).length;
|
12937
|
+
if (layoutSize === 0) {
|
12938
|
+
console.warn(`[Layout.init] Layout.init was called but no layouts have been created yet. Make sure you ` +
|
12939
|
+
`override LayoutManager.applyLayoutSnapshot, and then call fin.Platform.Layout.create()`);
|
12940
|
+
}
|
12941
|
+
}, 10000);
|
12942
|
+
return this.wrapSync(this.fin.me.identity);
|
12943
|
+
};
|
12944
|
+
/**
|
12945
|
+
* Returns the layout manager for the current window
|
12946
|
+
* @returns
|
12947
|
+
*/
|
12948
|
+
this.getCurrentLayoutManagerSync = () => {
|
12949
|
+
__classPrivateFieldGet$4(this, _LayoutModule_instances, "m", _LayoutModule_throwIfLayoutManagerNotInitialized).call(this);
|
12950
|
+
// @ts-expect-error User may have implemented their own snapshot type when overriding LayoutManager
|
12951
|
+
return __classPrivateFieldGet$4(this, _LayoutModule_layoutManager, "f");
|
12952
|
+
};
|
12953
|
+
this.create = async (options) => {
|
12954
|
+
__classPrivateFieldGet$4(this, _LayoutModule_instances, "m", _LayoutModule_throwIfLayoutManagerNotInitialized).call(this);
|
12955
|
+
return this.wire.environment.createLayout(__classPrivateFieldGet$4(this, _LayoutModule_layoutManager, "f"), options);
|
12956
|
+
};
|
12957
|
+
this.destroy = async (layoutIdentity) => {
|
12958
|
+
__classPrivateFieldGet$4(this, _LayoutModule_instances, "m", _LayoutModule_throwIfLayoutManagerNotInitialized).call(this);
|
12959
|
+
return this.wire.environment.destroyLayout(__classPrivateFieldGet$4(this, _LayoutModule_layoutManager, "f"), layoutIdentity);
|
12833
12960
|
};
|
12834
12961
|
}
|
12835
12962
|
/**
|
@@ -12927,7 +13054,11 @@ class LayoutModule extends base_1$5.Base {
|
|
12927
13054
|
}
|
12928
13055
|
}
|
12929
13056
|
Factory$2.LayoutModule = LayoutModule;
|
12930
|
-
_LayoutModule_layoutInitializationAttempted = new WeakMap()
|
13057
|
+
_LayoutModule_layoutInitializationAttempted = new WeakMap(), _LayoutModule_layoutManager = new WeakMap(), _LayoutModule_instances = new WeakSet(), _LayoutModule_throwIfLayoutManagerNotInitialized = function _LayoutModule_throwIfLayoutManagerNotInitialized() {
|
13058
|
+
if (!__classPrivateFieldGet$4(this, _LayoutModule_layoutManager, "f")) {
|
13059
|
+
throw new Error('You must call init before using this API');
|
13060
|
+
}
|
13061
|
+
};
|
12931
13062
|
|
12932
13063
|
(function (exports) {
|
12933
13064
|
/**
|
@@ -16503,7 +16634,7 @@ fin.Fin = Fin;
|
|
16503
16634
|
var wire = {};
|
16504
16635
|
|
16505
16636
|
Object.defineProperty(wire, "__esModule", { value: true });
|
16506
|
-
wire.isInternalConnectConfig = wire.isPortDiscoveryConfig = wire.isNewConnectConfig = wire.isRemoteConfig = wire.isExistingConnectConfig = wire.isExternalConfig = void 0;
|
16637
|
+
wire.isInternalConnectConfig = wire.isPortDiscoveryConfig = wire.isNewConnectConfig = wire.isConfigWithReceiver = wire.isRemoteConfig = wire.isExistingConnectConfig = wire.isExternalConfig = void 0;
|
16507
16638
|
function isExternalConfig(config) {
|
16508
16639
|
if (typeof config.manifestUrl === 'string') {
|
16509
16640
|
return true;
|
@@ -16519,6 +16650,10 @@ function isRemoteConfig(config) {
|
|
16519
16650
|
return isExistingConnectConfig(config) && typeof config.token === 'string';
|
16520
16651
|
}
|
16521
16652
|
wire.isRemoteConfig = isRemoteConfig;
|
16653
|
+
function isConfigWithReceiver(config) {
|
16654
|
+
return typeof config.receiver === 'object' && isRemoteConfig({ ...config, address: '' });
|
16655
|
+
}
|
16656
|
+
wire.isConfigWithReceiver = isConfigWithReceiver;
|
16522
16657
|
function hasUuid(config) {
|
16523
16658
|
return typeof config.uuid === 'string';
|
16524
16659
|
}
|
@@ -17370,6 +17505,12 @@ function requireNodeEnv () {
|
|
17370
17505
|
async initLayout() {
|
17371
17506
|
throw new Error('Method not implemented.');
|
17372
17507
|
}
|
17508
|
+
async createLayout() {
|
17509
|
+
throw new Error('Method not implemented.');
|
17510
|
+
}
|
17511
|
+
async destroyLayout() {
|
17512
|
+
throw new Error('Method not implemented.');
|
17513
|
+
}
|
17373
17514
|
async initPlatform() {
|
17374
17515
|
throw new Error('Method not implemented.');
|
17375
17516
|
}
|
@@ -17520,13 +17661,13 @@ class Transport extends events_1$1.EventEmitter {
|
|
17520
17661
|
}
|
17521
17662
|
getFin() {
|
17522
17663
|
if (!__classPrivateFieldGet(this, _Transport_fin, "f")) {
|
17523
|
-
throw new Error(
|
17664
|
+
throw new Error('No Fin object registered for this transport');
|
17524
17665
|
}
|
17525
17666
|
return __classPrivateFieldGet(this, _Transport_fin, "f");
|
17526
17667
|
}
|
17527
17668
|
registerFin(_fin) {
|
17528
17669
|
if (__classPrivateFieldGet(this, _Transport_fin, "f")) {
|
17529
|
-
throw new Error(
|
17670
|
+
throw new Error('Fin object has already been registered for this transport');
|
17530
17671
|
}
|
17531
17672
|
__classPrivateFieldSet(this, _Transport_fin, _fin, "f");
|
17532
17673
|
}
|
@@ -17535,6 +17676,10 @@ class Transport extends events_1$1.EventEmitter {
|
|
17535
17676
|
return wire.shutdown();
|
17536
17677
|
}
|
17537
17678
|
async connect(config) {
|
17679
|
+
if ((0, wire_1$1.isConfigWithReceiver)(config)) {
|
17680
|
+
await __classPrivateFieldGet(this, _Transport_wire, "f").connect(config.receiver);
|
17681
|
+
return this.authorize(config);
|
17682
|
+
}
|
17538
17683
|
if ((0, wire_1$1.isRemoteConfig)(config)) {
|
17539
17684
|
return this.connectRemote(config);
|
17540
17685
|
}
|
@@ -17548,14 +17693,14 @@ class Transport extends events_1$1.EventEmitter {
|
|
17548
17693
|
return undefined;
|
17549
17694
|
}
|
17550
17695
|
async connectRemote(config) {
|
17551
|
-
await __classPrivateFieldGet(this, _Transport_wire, "f").connect(
|
17696
|
+
await __classPrivateFieldGet(this, _Transport_wire, "f").connect(new (this.environment.getWsConstructor())(config.address));
|
17552
17697
|
return this.authorize(config);
|
17553
17698
|
}
|
17554
17699
|
async connectByPort(config) {
|
17555
17700
|
const { address, uuid } = config;
|
17556
17701
|
const reqAuthPayload = { ...config, type: 'file-token' };
|
17557
17702
|
const wire = __classPrivateFieldGet(this, _Transport_wire, "f");
|
17558
|
-
await wire.connect(
|
17703
|
+
await wire.connect(new (this.environment.getWsConstructor())(config.address));
|
17559
17704
|
const requestExtAuthRet = await this.sendAction('request-external-authorization', {
|
17560
17705
|
uuid,
|
17561
17706
|
type: 'file-token'
|
@@ -17575,7 +17720,9 @@ class Transport extends events_1$1.EventEmitter {
|
|
17575
17720
|
throw new transport_errors_1$1.RuntimeError(requestAuthRet.payload);
|
17576
17721
|
}
|
17577
17722
|
}
|
17578
|
-
sendAction(action, payload = {}, uncorrelated = false
|
17723
|
+
sendAction(action, payload = {}, uncorrelated = false
|
17724
|
+
// specialResponse type is only used for 'requestAuthorization'
|
17725
|
+
) {
|
17579
17726
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
17580
17727
|
let cancel = () => { };
|
17581
17728
|
// We want the callsite from the caller of this function, not from here.
|
@@ -17625,7 +17772,10 @@ class Transport extends events_1$1.EventEmitter {
|
|
17625
17772
|
this.uncorrelatedListener = resolve;
|
17626
17773
|
}
|
17627
17774
|
else if (this.wireListeners.has(id)) {
|
17628
|
-
handleNack({
|
17775
|
+
handleNack({
|
17776
|
+
reason: 'Duplicate handler id',
|
17777
|
+
error: (0, errors_1.errorToPOJO)(new transport_errors_1$1.DuplicateCorrelationError(String(id)))
|
17778
|
+
});
|
17629
17779
|
}
|
17630
17780
|
else {
|
17631
17781
|
this.wireListeners.set(id, { resolve, handleNack });
|
@@ -17685,9 +17835,19 @@ _Transport_wire = new WeakMap(), _Transport_fin = new WeakMap();
|
|
17685
17835
|
|
17686
17836
|
var websocket = {};
|
17687
17837
|
|
17838
|
+
var messageReceiver = {};
|
17839
|
+
|
17840
|
+
Object.defineProperty(messageReceiver, "__esModule", { value: true });
|
17841
|
+
messageReceiver.isOpen = void 0;
|
17842
|
+
function isOpen(receiver) {
|
17843
|
+
return receiver.readyState === 'open' || receiver.readyState === 1;
|
17844
|
+
}
|
17845
|
+
messageReceiver.isOpen = isOpen;
|
17846
|
+
|
17688
17847
|
Object.defineProperty(websocket, "__esModule", { value: true });
|
17689
17848
|
const events_1 = require$$0;
|
17690
17849
|
const transport_errors_1 = transportErrors;
|
17850
|
+
const messageReceiver_1 = messageReceiver;
|
17691
17851
|
/* `READY_STATE` is an instance var set by `constructor` to reference the `WebTransportSocket.READY_STATE` enum.
|
17692
17852
|
* This is syntactic sugar that makes the enum accessible through the `wire` property of the various `fin` singletons.
|
17693
17853
|
* For example, `fin.system.wire.READY_STATE` is a shortcut to `fin.system.wire.wire.constructor.READY_STATE`.
|
@@ -17705,15 +17865,18 @@ var READY_STATE;
|
|
17705
17865
|
class WebSocketTransport extends events_1.EventEmitter {
|
17706
17866
|
constructor(onmessage) {
|
17707
17867
|
super();
|
17708
|
-
this.connect = (
|
17868
|
+
this.connect = (messageReceiver) => {
|
17709
17869
|
return new Promise((resolve, reject) => {
|
17710
|
-
this.wire =
|
17711
|
-
this.wire.addEventListener('open', resolve);
|
17870
|
+
this.wire = messageReceiver;
|
17871
|
+
this.wire.addEventListener('open', () => resolve());
|
17712
17872
|
this.wire.addEventListener('error', reject);
|
17713
17873
|
this.wire.addEventListener('message', (message) => this.onmessage.call(null, JSON.parse(message.data)));
|
17714
17874
|
this.wire.addEventListener('close', () => {
|
17715
17875
|
this.emit('disconnected');
|
17716
17876
|
});
|
17877
|
+
if ((0, messageReceiver_1.isOpen)(this.wire)) {
|
17878
|
+
resolve();
|
17879
|
+
}
|
17717
17880
|
});
|
17718
17881
|
};
|
17719
17882
|
this.connectSync = () => {
|
@@ -17723,7 +17886,7 @@ class WebSocketTransport extends events_1.EventEmitter {
|
|
17723
17886
|
}
|
17724
17887
|
send(data, flags) {
|
17725
17888
|
return new Promise((resolve, reject) => {
|
17726
|
-
if (this.wire
|
17889
|
+
if (!(0, messageReceiver_1.isOpen)(this.wire)) {
|
17727
17890
|
reject(new transport_errors_1.DisconnectedError(READY_STATE[this.wire.readyState]));
|
17728
17891
|
}
|
17729
17892
|
else {
|
@@ -17737,6 +17900,7 @@ class WebSocketTransport extends events_1.EventEmitter {
|
|
17737
17900
|
return Promise.resolve();
|
17738
17901
|
}
|
17739
17902
|
getPort() {
|
17903
|
+
// @ts-expect-error
|
17740
17904
|
return this.wire.url.split(':').slice(-1)[0];
|
17741
17905
|
}
|
17742
17906
|
}
|
@@ -17870,9 +18034,9 @@ var application = {};
|
|
17870
18034
|
* child {@link OpenFin.Window windows} and {@link OpenFin.View views} are defined in the {@link OpenFin.WindowEvents} and
|
17871
18035
|
* {@link OpenFin.ViewEvents} namespaces. For a list of valid string keys for *all* application events, see {@link Application.on Application.on}.
|
17872
18036
|
*
|
17873
|
-
* {@link
|
18037
|
+
* {@link ApplicationSourcedEvent Application-sourced events} (i.e. those that have not propagated from {@link OpenFin.ViewEvents Views}
|
17874
18038
|
* or {@link OpenFin.WindowEvents Windows} re-propagate to {@link OpenFin.SystemEvents System} with their type string prefixed with `application-`.
|
17875
|
-
* {@link
|
18039
|
+
* {@link ApplicationWindowEvent Application events that are tied to Windows but do not propagate from them}
|
17876
18040
|
* are propagated to `System` without any type string prefixing.
|
17877
18041
|
*
|
17878
18042
|
* "Requested" events (e.g. {@link RunRequestedEvent}) do not propagate.
|
@@ -17880,6 +18044,18 @@ var application = {};
|
|
17880
18044
|
* @packageDocumentation
|
17881
18045
|
*/
|
17882
18046
|
Object.defineProperty(application, "__esModule", { value: true });
|
18047
|
+
application.ApplicationWindowEventTypes = void 0;
|
18048
|
+
/**
|
18049
|
+
* Array of valid `type` values for an {@link ApplicationWindowEvent}.
|
18050
|
+
*/
|
18051
|
+
application.ApplicationWindowEventTypes = [
|
18052
|
+
'window-alert-requested',
|
18053
|
+
'window-created',
|
18054
|
+
'window-end-load',
|
18055
|
+
'window-not-responding',
|
18056
|
+
'window-responding',
|
18057
|
+
'window-start-load'
|
18058
|
+
];
|
17883
18059
|
|
17884
18060
|
var base = {};
|
17885
18061
|
|
@@ -17995,7 +18171,7 @@ var window$1 = {};
|
|
17995
18171
|
* propagate from `View` are defined in {@link OpenFin.ViewEvents}. For a list of valid string keys for *all* Window events, see
|
17996
18172
|
* {@link Window.on Window.on}
|
17997
18173
|
*
|
17998
|
-
* {@link OpenFin.WindowEvents.
|
18174
|
+
* {@link OpenFin.WindowEvents.WindowSourcedEvent Window-sourced events} (i.e. those that are not propagated from a
|
17999
18175
|
* {@link OpenFin.ViewEvents View}) propagate to their parent {@link OpenFin.ApplicationEvents Application} and
|
18000
18176
|
* {@link OpenFin.SystemEvents System} with their event types prefixed with `'window-'`).
|
18001
18177
|
*
|
@@ -18040,10 +18216,10 @@ Object.defineProperty(window$1, "__esModule", { value: true });
|
|
18040
18216
|
* finally to the OpenFin runtime itself at the "system" level. For details on propagation semantics, see the namespace for
|
18041
18217
|
* the propagating (or propagated-to) entity.
|
18042
18218
|
*
|
18043
|
-
* If you need the payload type for a specific type of event (especially propagated events), use the emitting topic's `
|
18044
|
-
* (e.g. {@link WindowEvents.
|
18219
|
+
* If you need the payload type for a specific type of event (especially propagated events), use the emitting topic's `Payload` generic
|
18220
|
+
* (e.g. {@link WindowEvents.Payload}) with the event's `type` string. For example, the payload of
|
18045
18221
|
* a {@link ViewEvents.CreatedEvent} after it has propagated to its parent {@link WindowEvents Window} can be found with
|
18046
|
-
* `
|
18222
|
+
* `WindowEvents.Payload<'view-created'>`.
|
18047
18223
|
*
|
18048
18224
|
* @packageDocumentation
|
18049
18225
|
*/
|