@openfin/core 31.74.30 → 31.75.1
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/package.json +1 -1
- package/src/OpenFin.d.ts +57 -13
- package/src/api/application/Instance.js +23 -5
- package/src/api/base.d.ts +1 -2
- package/src/api/base.js +1 -2
- package/src/api/events/system.d.ts +6 -3
- package/src/api/fin.js +1 -2
- package/src/api/interappbus/channel/index.d.ts +1 -0
- package/src/api/interappbus/channel/index.js +47 -47
- package/src/api/interappbus/channel/protocols/classic/strategy.js +24 -6
- package/src/api/interappbus/index.js +1 -1
- package/src/api/interop/InteropClient.d.ts +1 -1
- package/src/api/interop/InteropClient.js +1 -1
- package/src/api/interop/SessionContextGroupBroker.d.ts +1 -1
- package/src/api/interop/SessionContextGroupBroker.js +5 -4
- package/src/api/interop/SessionContextGroupClient.js +1 -1
- package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +1 -1
- package/src/api/interop/fdc3/PrivateChannelProvider.js +1 -8
- package/src/api/interop/fdc3/fdc3-1.2.js +34 -1
- package/src/api/interop/fdc3/utils.js +24 -4
- package/src/api/platform/Factory.d.ts +2 -1
- package/src/api/platform/Instance.d.ts +5 -4
- package/src/api/platform/Instance.js +2 -1
- package/src/api/platform/layout/Factory.js +6 -4
- package/src/api/platform/layout/Instance.js +3 -0
- package/src/api/platform/layout/controllers/layout-entities-controller.d.ts +7 -4
- package/src/api/platform/layout/controllers/layout-entities-controller.js +42 -11
- package/src/api/platform/layout/controllers/tab-drag-controller.d.ts +2 -1
- package/src/api/platform/layout/entities/layout-entities.d.ts +143 -42
- package/src/api/platform/layout/entities/layout-entities.js +151 -43
- package/src/api/platform/layout/utils/layout-traversal.d.ts +1 -0
- package/src/api/platform/layout/utils/layout-traversal.js +11 -11
- package/src/api/platform/provider.d.ts +2 -1
- package/src/api/system/index.d.ts +9 -0
- package/src/api/system/index.js +78 -40
- package/src/api/view/Instance.d.ts +6 -3
- package/src/api/view/Instance.js +9 -7
- package/src/api/webcontents/main.d.ts +2 -22
- package/src/api/webcontents/main.js +2 -1
- package/src/api/window/Instance.d.ts +10 -0
- package/src/api/window/Instance.js +22 -0
- package/src/environment/mockEnvironment.d.ts +27 -0
- package/src/environment/mockEnvironment.js +61 -0
- package/src/mock.js +4 -83
- package/src/shapes/protocol.d.ts +17 -0
- package/src/transport/mockWire.d.ts +11 -0
- package/src/transport/mockWire.js +26 -0
- package/src/transport/transport-errors.d.ts +9 -1
- package/src/transport/transport-errors.js +45 -2
- package/src/transport/transport.d.ts +15 -5
- package/src/transport/transport.js +48 -20
- package/src/util/channel-api-relay.js +11 -1
- package/src/util/errors.d.ts +1 -0
- package/src/util/errors.js +1 -0
- package/src/util/lazy.d.ts +18 -0
- package/src/util/lazy.js +29 -1
- package/src/util/ref-counter.d.ts +1 -1
- package/src/util/ref-counter.js +3 -2
- package/src/transport/fin_store.d.ts +0 -4
- package/src/transport/fin_store.js +0 -16
package/src/api/system/index.js
CHANGED
|
@@ -512,53 +512,62 @@ class System extends base_1.EmitterBase {
|
|
|
512
512
|
* @tutorial System.downloadAsset
|
|
513
513
|
*/
|
|
514
514
|
// incompatible with standalone node process.
|
|
515
|
-
downloadAsset(appAsset, progressListener) {
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
};
|
|
538
|
-
const dlError = (payload) => {
|
|
539
|
-
cleanListeners();
|
|
540
|
-
const { reason, err: error } = payload;
|
|
541
|
-
reject(new transport_errors_1.RuntimeError({ reason, error }));
|
|
542
|
-
};
|
|
543
|
-
const dlComplete = () => {
|
|
544
|
-
cleanListeners();
|
|
545
|
-
resolve();
|
|
515
|
+
async downloadAsset(appAsset, progressListener) {
|
|
516
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/no-empty-function
|
|
517
|
+
const noop = () => { };
|
|
518
|
+
let resolve = noop;
|
|
519
|
+
let reject = noop;
|
|
520
|
+
const downloadCompletePromise = new Promise((y, n) => {
|
|
521
|
+
resolve = y;
|
|
522
|
+
reject = n;
|
|
523
|
+
});
|
|
524
|
+
// node.js environment not supported
|
|
525
|
+
if (this.wire.environment.constructor.name === 'NodeEnvironment') {
|
|
526
|
+
throw new transport_errors_1.NotSupportedError('downloadAsset only supported in an OpenFin Render process');
|
|
527
|
+
}
|
|
528
|
+
const callSite = transport_errors_1.RuntimeError.getCallSite();
|
|
529
|
+
const downloadId = this.wire.environment.getNextMessageId().toString();
|
|
530
|
+
const dlProgressKey = `asset-download-progress-${downloadId}`;
|
|
531
|
+
const dlErrorKey = `asset-download-error-${downloadId}`;
|
|
532
|
+
const dlCompleteKey = `asset-download-complete-${downloadId}`;
|
|
533
|
+
const dlProgress = (progress) => {
|
|
534
|
+
const p = {
|
|
535
|
+
downloadedBytes: progress.downloadedBytes,
|
|
536
|
+
totalBytes: progress.totalBytes
|
|
546
537
|
};
|
|
538
|
+
progressListener(p);
|
|
539
|
+
};
|
|
540
|
+
const cleanListeners = () => {
|
|
547
541
|
// TODO: fix internal types
|
|
548
542
|
// @ts-expect-error
|
|
549
|
-
this.
|
|
543
|
+
this.removeListener(dlProgressKey, dlProgress);
|
|
544
|
+
};
|
|
545
|
+
const dlError = (payload) => {
|
|
546
|
+
cleanListeners();
|
|
547
|
+
const { reason, err: error } = payload;
|
|
548
|
+
reject(new transport_errors_1.RuntimeError({ reason, error }, callSite));
|
|
549
|
+
};
|
|
550
|
+
const dlComplete = () => {
|
|
551
|
+
cleanListeners();
|
|
552
|
+
resolve();
|
|
553
|
+
};
|
|
554
|
+
await Promise.all([
|
|
550
555
|
// TODO: fix internal types
|
|
551
556
|
// @ts-expect-error
|
|
552
|
-
this.
|
|
557
|
+
this.on(dlProgressKey, dlProgress),
|
|
553
558
|
// TODO: fix internal types
|
|
554
559
|
// @ts-expect-error
|
|
555
|
-
this.once(
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
560
|
+
this.once(dlErrorKey, dlError),
|
|
561
|
+
// TODO: fix internal types
|
|
562
|
+
// @ts-expect-error
|
|
563
|
+
this.once(dlCompleteKey, dlComplete)
|
|
564
|
+
]);
|
|
565
|
+
const downloadOptions = Object.assign(appAsset, { downloadId });
|
|
566
|
+
await this.wire.sendAction('download-asset', downloadOptions).catch((err) => {
|
|
567
|
+
cleanListeners();
|
|
568
|
+
throw err;
|
|
561
569
|
});
|
|
570
|
+
return downloadCompletePromise;
|
|
562
571
|
}
|
|
563
572
|
/**
|
|
564
573
|
* Downloads a version of the runtime.
|
|
@@ -568,6 +577,7 @@ class System extends base_1.EmitterBase {
|
|
|
568
577
|
* @tutorial System.downloadRuntime
|
|
569
578
|
*/
|
|
570
579
|
downloadRuntime(options, progressListener) {
|
|
580
|
+
const callsites = transport_errors_1.RuntimeError.getCallSite();
|
|
571
581
|
return new Promise((resolve, reject) => {
|
|
572
582
|
// node.js environment not supported
|
|
573
583
|
if (this.wire.environment.constructor.name === 'NodeEnvironment') {
|
|
@@ -593,7 +603,7 @@ class System extends base_1.EmitterBase {
|
|
|
593
603
|
const dlError = (payload) => {
|
|
594
604
|
cleanListeners();
|
|
595
605
|
const { reason, err: error } = payload;
|
|
596
|
-
reject(new transport_errors_1.RuntimeError({ reason, error }));
|
|
606
|
+
reject(new transport_errors_1.RuntimeError({ reason, error }, callsites));
|
|
597
607
|
};
|
|
598
608
|
const dlComplete = () => {
|
|
599
609
|
cleanListeners();
|
|
@@ -735,6 +745,34 @@ class System extends base_1.EmitterBase {
|
|
|
735
745
|
}
|
|
736
746
|
return this.wire.sendAction('get-system-app-configuration', { name }).then(({ payload }) => payload.data);
|
|
737
747
|
}
|
|
748
|
+
/**
|
|
749
|
+
* Registers a system shutdown handler so user can do some cleanup before system is shutting down.
|
|
750
|
+
* Note: Once system shutdown starts, you are unable to cancel it.
|
|
751
|
+
* @param { SystemShutdownHandler } handler system shutdown handler
|
|
752
|
+
* @return {Promise.<void>}
|
|
753
|
+
* @tutorial System.registerShutdownHandler
|
|
754
|
+
* @experimental
|
|
755
|
+
*/
|
|
756
|
+
async registerShutdownHandler(handler) {
|
|
757
|
+
this.wire.sendAction('system-register-shutdown-handler').catch((e) => {
|
|
758
|
+
// don't expose, analytics-only call
|
|
759
|
+
});
|
|
760
|
+
const SystemShutdownEventName = 'system-shutdown';
|
|
761
|
+
const SystemShutdownHandledEventName = 'system-shutdown-handled';
|
|
762
|
+
const { uuid, name } = this.wire.me;
|
|
763
|
+
const shutdownHandler = (payload) => {
|
|
764
|
+
const proceed = () => {
|
|
765
|
+
// notify core that the app is ready for shutdown
|
|
766
|
+
this.wire.environment.raiseEvent(`application/${SystemShutdownHandledEventName}`, {
|
|
767
|
+
uuid,
|
|
768
|
+
name,
|
|
769
|
+
topic: 'application'
|
|
770
|
+
});
|
|
771
|
+
};
|
|
772
|
+
handler({ proceed });
|
|
773
|
+
};
|
|
774
|
+
this.on(SystemShutdownEventName, shutdownHandler);
|
|
775
|
+
}
|
|
738
776
|
/**
|
|
739
777
|
* Signals the RVM to perform a health check and returns the results as json.
|
|
740
778
|
* @return {Promise.<string[]>}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type * as OpenFin from '../../OpenFin';
|
|
2
2
|
import { Transport } from '../../transport/transport';
|
|
3
|
-
import { ViewEvent } from '../events/view';
|
|
4
3
|
import { WebContents } from '../webcontents/main';
|
|
5
4
|
type UpdatableViewOptions = OpenFin.UpdatableViewOptions;
|
|
5
|
+
type ViewEvent = OpenFin.ViewEvent;
|
|
6
6
|
/**
|
|
7
7
|
* @PORTED
|
|
8
8
|
* @typedef {object} View~options
|
|
@@ -144,6 +144,9 @@ type UpdatableViewOptions = OpenFin.UpdatableViewOptions;
|
|
|
144
144
|
* @property {string} [processAffinity=<application uuid>]
|
|
145
145
|
* A string to attempt to group renderers together. Will only be used if pages are on the same origin.
|
|
146
146
|
*
|
|
147
|
+
* @property {boolean} [spellCheck=false]
|
|
148
|
+
* Enable spell check in input text fields for the view.
|
|
149
|
+
*
|
|
147
150
|
* @property {Identity} [target]
|
|
148
151
|
* The identity of the window this view should be attached to.
|
|
149
152
|
*
|
|
@@ -447,10 +450,10 @@ export declare class View extends WebContents<ViewEvent> {
|
|
|
447
450
|
getCurrentWindow: () => Promise<OpenFin.Window>;
|
|
448
451
|
/**
|
|
449
452
|
* Retrieves the current {@link TabStack} of the view if it belongs to one.
|
|
450
|
-
* @return {Promise<TabStack
|
|
453
|
+
* @return {Promise<TabStack>} The {@link TabStack} this view belongs to.
|
|
451
454
|
* @throws if this view does not belong to a TabStack or if the window has been destroyed.
|
|
452
455
|
*/
|
|
453
|
-
getCurrentStack: () => Promise<OpenFin.TabStack
|
|
456
|
+
getCurrentStack: () => Promise<OpenFin.TabStack>;
|
|
454
457
|
/**
|
|
455
458
|
* Triggers the before-unload handler for the View, if one is set. Returns `true` if the handler is trying to prevent the View from unloading, and `false` if it isn't.
|
|
456
459
|
* Only enabled when setting enableBeforeUnload: true in your View options. If this option is not enabled it will always return false.
|
package/src/api/view/Instance.js
CHANGED
|
@@ -155,6 +155,9 @@ const window_1 = require("../window");
|
|
|
155
155
|
* @property {string} [processAffinity=<application uuid>]
|
|
156
156
|
* A string to attempt to group renderers together. Will only be used if pages are on the same origin.
|
|
157
157
|
*
|
|
158
|
+
* @property {boolean} [spellCheck=false]
|
|
159
|
+
* Enable spell check in input text fields for the view.
|
|
160
|
+
*
|
|
158
161
|
* @property {Identity} [target]
|
|
159
162
|
* The identity of the window this view should be attached to.
|
|
160
163
|
*
|
|
@@ -459,23 +462,22 @@ class View extends main_1.WebContents {
|
|
|
459
462
|
};
|
|
460
463
|
/**
|
|
461
464
|
* Retrieves the current {@link TabStack} of the view if it belongs to one.
|
|
462
|
-
* @return {Promise<TabStack
|
|
465
|
+
* @return {Promise<TabStack>} The {@link TabStack} this view belongs to.
|
|
463
466
|
* @throws if this view does not belong to a TabStack or if the window has been destroyed.
|
|
464
467
|
*/
|
|
465
468
|
this.getCurrentStack = async () => {
|
|
469
|
+
this.wire.sendAction('view-get-current-stack').catch(() => {
|
|
470
|
+
// don't expose
|
|
471
|
+
});
|
|
466
472
|
try {
|
|
467
473
|
const layoutWindow = await this.getCurrentWindow();
|
|
468
474
|
const providerChannelClient = await __classPrivateFieldGet(this, _View_providerChannelClient, "f").getValue();
|
|
469
475
|
const client = await layout_entities_1.LayoutNode.newLayoutEntitiesClient(providerChannelClient, layout_constants_1.LAYOUT_CONTROLLER_ID, layoutWindow.identity);
|
|
470
|
-
const stackDefinition = await client.getStackByView(this.identity);
|
|
476
|
+
const stackDefinition = (await client.getStackByView(this.identity));
|
|
471
477
|
return layout_entities_1.LayoutNode.getEntity(stackDefinition, client);
|
|
472
478
|
}
|
|
473
479
|
catch (error) {
|
|
474
|
-
|
|
475
|
-
// TODO: @pierre to fix
|
|
476
|
-
// @ts-expect-error pending PR !3459 to fix runtime errors
|
|
477
|
-
e.cause = error;
|
|
478
|
-
throw e;
|
|
480
|
+
throw new transport_errors_1.RuntimeError({ reason: 'This view does not belong to a stack.', error });
|
|
479
481
|
}
|
|
480
482
|
};
|
|
481
483
|
/**
|
|
@@ -2,31 +2,11 @@ import type * as OpenFin from '../../OpenFin';
|
|
|
2
2
|
import { EmitterBase } from '../base';
|
|
3
3
|
import { Transport } from '../../transport/transport';
|
|
4
4
|
import { BaseEvent } from '../events/base';
|
|
5
|
-
/**
|
|
6
|
-
* Configuration for page capture.
|
|
7
|
-
*/
|
|
8
|
-
export interface CapturePageOptions {
|
|
9
|
-
/**
|
|
10
|
-
* The area of the window to be captured.
|
|
11
|
-
*/
|
|
12
|
-
area?: OpenFin.Rectangle;
|
|
13
|
-
/**
|
|
14
|
-
* @defaultValue 'png'
|
|
15
|
-
*
|
|
16
|
-
* The format of the captured image. Can be 'png', 'jpg', or 'bmp'.
|
|
17
|
-
*/
|
|
18
|
-
format?: 'bmp' | 'jpg' | 'png';
|
|
19
|
-
/**
|
|
20
|
-
* @defaultValue 100
|
|
21
|
-
*
|
|
22
|
-
* Quality of JPEG image. Between 0 - 100.
|
|
23
|
-
*/
|
|
24
|
-
quality?: number;
|
|
25
|
-
}
|
|
26
5
|
export declare class WebContents<T extends BaseEvent> extends EmitterBase<T> {
|
|
6
|
+
identity: OpenFin.Identity;
|
|
27
7
|
entityType: string;
|
|
28
8
|
constructor(wire: Transport, identity: OpenFin.Identity, entityType: string);
|
|
29
|
-
capturePage(options?: CapturePageOptions): Promise<string>;
|
|
9
|
+
capturePage(options?: OpenFin.CapturePageOptions): Promise<string>;
|
|
30
10
|
executeJavaScript(code: string): Promise<void>;
|
|
31
11
|
getZoomLevel(): Promise<number>;
|
|
32
12
|
setZoomLevel(level: number): Promise<void>;
|
|
@@ -5,6 +5,7 @@ const base_1 = require("../base");
|
|
|
5
5
|
class WebContents extends base_1.EmitterBase {
|
|
6
6
|
constructor(wire, identity, entityType) {
|
|
7
7
|
super(wire, entityType, identity.uuid, identity.name);
|
|
8
|
+
this.identity = identity;
|
|
8
9
|
this.entityType = entityType;
|
|
9
10
|
}
|
|
10
11
|
capturePage(options) {
|
|
@@ -41,7 +42,7 @@ class WebContents extends base_1.EmitterBase {
|
|
|
41
42
|
})
|
|
42
43
|
.then(() => undefined);
|
|
43
44
|
}
|
|
44
|
-
print(options) {
|
|
45
|
+
print(options = {}) {
|
|
45
46
|
return this.wire.sendAction('print', { ...this.identity, options }).then(() => undefined);
|
|
46
47
|
}
|
|
47
48
|
findInPage(searchTerm, options) {
|
|
@@ -334,6 +334,9 @@ import { WebContents } from '../webcontents/main';
|
|
|
334
334
|
* _Note: Caveats of small windows are no Aero Snap and drag to/from maximize._
|
|
335
335
|
* _Windows 10: Requires `maximizable` to be false. Resizing with the mouse is only possible down to 38x39 px._
|
|
336
336
|
*
|
|
337
|
+
* @property {boolean} [spellCheck=false]
|
|
338
|
+
* Enable spell check in input text fields for the window.
|
|
339
|
+
*
|
|
337
340
|
* @property {string} [state="normal"]
|
|
338
341
|
* The visible state of the window on creation.
|
|
339
342
|
* One of:
|
|
@@ -1071,4 +1074,11 @@ export declare class _Window extends WebContents<OpenFin.WindowEvent> {
|
|
|
1071
1074
|
* @tutorial Window.dispatchPopupResult
|
|
1072
1075
|
*/
|
|
1073
1076
|
dispatchPopupResult(data: any): Promise<void>;
|
|
1077
|
+
/**
|
|
1078
|
+
* Prints the contents of the window.
|
|
1079
|
+
*
|
|
1080
|
+
* @param options Configuration for the print task.
|
|
1081
|
+
* @tutorial Window.print
|
|
1082
|
+
*/
|
|
1083
|
+
print(options?: OpenFin.WindowPrintOptions): Promise<void>;
|
|
1074
1084
|
}
|
|
@@ -341,6 +341,9 @@ const view_1 = require("../view");
|
|
|
341
341
|
* _Note: Caveats of small windows are no Aero Snap and drag to/from maximize._
|
|
342
342
|
* _Windows 10: Requires `maximizable` to be false. Resizing with the mouse is only possible down to 38x39 px._
|
|
343
343
|
*
|
|
344
|
+
* @property {boolean} [spellCheck=false]
|
|
345
|
+
* Enable spell check in input text fields for the window.
|
|
346
|
+
*
|
|
344
347
|
* @property {string} [state="normal"]
|
|
345
348
|
* The visible state of the window on creation.
|
|
346
349
|
* One of:
|
|
@@ -1317,5 +1320,24 @@ class _Window extends main_1.WebContents {
|
|
|
1317
1320
|
});
|
|
1318
1321
|
await this.wire.sendAction('dispatch-popup-result', { data, ...this.identity });
|
|
1319
1322
|
}
|
|
1323
|
+
/**
|
|
1324
|
+
* Prints the contents of the window.
|
|
1325
|
+
*
|
|
1326
|
+
* @param options Configuration for the print task.
|
|
1327
|
+
* @tutorial Window.print
|
|
1328
|
+
*/
|
|
1329
|
+
async print(options = { content: 'self' }) {
|
|
1330
|
+
switch (options.content) {
|
|
1331
|
+
case undefined:
|
|
1332
|
+
case 'self':
|
|
1333
|
+
return super.print(options);
|
|
1334
|
+
case 'screenshot':
|
|
1335
|
+
return this.wire.sendAction('print-screenshot', this.identity).then(() => undefined);
|
|
1336
|
+
case 'views':
|
|
1337
|
+
return this.wire.sendAction('print-views', { ...this.identity, options }).then(() => undefined);
|
|
1338
|
+
default:
|
|
1339
|
+
return undefined;
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1320
1342
|
}
|
|
1321
1343
|
exports._Window = _Window;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Environment } from './environment';
|
|
2
|
+
import type * as OpenFin from '../OpenFin';
|
|
3
|
+
import { NewConnectConfig } from '../transport/wire';
|
|
4
|
+
import { EntityType } from '../OpenFin';
|
|
5
|
+
export declare class MockEnvironment implements Environment {
|
|
6
|
+
getDefaultChannelOptions(): {
|
|
7
|
+
create: OpenFin.ChannelCreateOptions;
|
|
8
|
+
connect: OpenFin.ChannelConnectOptions;
|
|
9
|
+
};
|
|
10
|
+
getRtcPeer(): RTCPeerConnection;
|
|
11
|
+
getManagerConstructor(): Promise<any>;
|
|
12
|
+
getProviderInitializer(): Promise<any>;
|
|
13
|
+
observeBounds(): never;
|
|
14
|
+
writeToken(path: string, token: string): Promise<string>;
|
|
15
|
+
retrievePort(config: NewConnectConfig): Promise<number>;
|
|
16
|
+
getNextMessageId(): string;
|
|
17
|
+
getRandomId(): string;
|
|
18
|
+
createChildContent(options: any): Promise<any>;
|
|
19
|
+
getWebWindow(identity: OpenFin.Identity): globalThis.Window;
|
|
20
|
+
getCurrentEntityIdentity(): OpenFin.EntityInfo;
|
|
21
|
+
getCurrentEntityType(): EntityType;
|
|
22
|
+
raiseEvent(eventName: string, eventArgs: any): void;
|
|
23
|
+
getUrl(): string;
|
|
24
|
+
whenReady(): Promise<void>;
|
|
25
|
+
childViews: boolean;
|
|
26
|
+
getWsConstructor(): any;
|
|
27
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MockEnvironment = void 0;
|
|
4
|
+
const me_1 = require("../api/me");
|
|
5
|
+
class MockEnvironment {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.childViews = true;
|
|
8
|
+
}
|
|
9
|
+
getDefaultChannelOptions() {
|
|
10
|
+
throw new Error(me_1.environmentUnsupportedMessage);
|
|
11
|
+
}
|
|
12
|
+
getRtcPeer() {
|
|
13
|
+
throw new Error(me_1.environmentUnsupportedMessage);
|
|
14
|
+
}
|
|
15
|
+
async getManagerConstructor() {
|
|
16
|
+
throw new Error(me_1.environmentUnsupportedMessage);
|
|
17
|
+
}
|
|
18
|
+
async getProviderInitializer() {
|
|
19
|
+
throw new Error(me_1.environmentUnsupportedMessage);
|
|
20
|
+
}
|
|
21
|
+
observeBounds() {
|
|
22
|
+
throw new Error(me_1.environmentUnsupportedMessage);
|
|
23
|
+
}
|
|
24
|
+
writeToken(path, token) {
|
|
25
|
+
throw new Error(me_1.environmentUnsupportedMessage);
|
|
26
|
+
}
|
|
27
|
+
retrievePort(config) {
|
|
28
|
+
throw new Error(me_1.environmentUnsupportedMessage);
|
|
29
|
+
}
|
|
30
|
+
getNextMessageId() {
|
|
31
|
+
throw new Error(me_1.environmentUnsupportedMessage);
|
|
32
|
+
}
|
|
33
|
+
getRandomId() {
|
|
34
|
+
throw new Error(me_1.environmentUnsupportedMessage);
|
|
35
|
+
}
|
|
36
|
+
createChildContent(options) {
|
|
37
|
+
throw new Error(me_1.environmentUnsupportedMessage);
|
|
38
|
+
}
|
|
39
|
+
getWebWindow(identity) {
|
|
40
|
+
throw new Error(me_1.environmentUnsupportedMessage);
|
|
41
|
+
}
|
|
42
|
+
getCurrentEntityIdentity() {
|
|
43
|
+
throw new Error(me_1.environmentUnsupportedMessage);
|
|
44
|
+
}
|
|
45
|
+
getCurrentEntityType() {
|
|
46
|
+
return 'unknown';
|
|
47
|
+
}
|
|
48
|
+
raiseEvent(eventName, eventArgs) {
|
|
49
|
+
throw new Error(me_1.environmentUnsupportedMessage);
|
|
50
|
+
}
|
|
51
|
+
getUrl() {
|
|
52
|
+
throw new Error(me_1.environmentUnsupportedMessage);
|
|
53
|
+
}
|
|
54
|
+
whenReady() {
|
|
55
|
+
throw new Error(me_1.environmentUnsupportedMessage);
|
|
56
|
+
}
|
|
57
|
+
getWsConstructor() {
|
|
58
|
+
throw new Error('Method not implemented.');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.MockEnvironment = MockEnvironment;
|
package/src/mock.js
CHANGED
|
@@ -1,94 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fin = void 0;
|
|
4
|
-
/* eslint-disable import/prefer-default-export */
|
|
5
|
-
/* eslint-disable spaced-comment */
|
|
6
|
-
/* eslint-disable @typescript-eslint/triple-slash-reference */
|
|
7
|
-
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
8
|
-
/* eslint-disable class-methods-use-this */
|
|
9
|
-
const events_1 = require("events");
|
|
10
4
|
const OpenFin = require("./OpenFin");
|
|
11
5
|
const fin_1 = require("./api/fin");
|
|
12
6
|
const transport_1 = require("./transport/transport");
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
connect(address) {
|
|
16
|
-
throw new Error('You are not running in OpenFin.');
|
|
17
|
-
}
|
|
18
|
-
connectSync() {
|
|
19
|
-
throw new Error('You are not running in OpenFin.');
|
|
20
|
-
}
|
|
21
|
-
send(data) {
|
|
22
|
-
throw new Error('You are not running in OpenFin.');
|
|
23
|
-
}
|
|
24
|
-
shutdown() {
|
|
25
|
-
throw new Error('You are not running in OpenFin.');
|
|
26
|
-
}
|
|
27
|
-
getPort() {
|
|
28
|
-
throw new Error('This transport has no port');
|
|
29
|
-
}
|
|
30
|
-
// eslint-disable-next-line no-useless-constructor
|
|
31
|
-
constructor() {
|
|
32
|
-
super();
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
class MockEnvironment {
|
|
36
|
-
constructor() {
|
|
37
|
-
this.childViews = true;
|
|
38
|
-
}
|
|
39
|
-
getDefaultChannelOptions() {
|
|
40
|
-
throw new Error(me_1.environmentUnsupportedMessage);
|
|
41
|
-
}
|
|
42
|
-
getRtcPeer() {
|
|
43
|
-
throw new Error(me_1.environmentUnsupportedMessage);
|
|
44
|
-
}
|
|
45
|
-
getManagerConstructor() {
|
|
46
|
-
throw new Error(me_1.environmentUnsupportedMessage);
|
|
47
|
-
}
|
|
48
|
-
getProviderInitializer() {
|
|
49
|
-
throw new Error(me_1.environmentUnsupportedMessage);
|
|
50
|
-
}
|
|
51
|
-
writeToken(path, token) {
|
|
52
|
-
throw new Error(me_1.environmentUnsupportedMessage);
|
|
53
|
-
}
|
|
54
|
-
retrievePort(config) {
|
|
55
|
-
throw new Error(me_1.environmentUnsupportedMessage);
|
|
56
|
-
}
|
|
57
|
-
getNextMessageId() {
|
|
58
|
-
throw new Error(me_1.environmentUnsupportedMessage);
|
|
59
|
-
}
|
|
60
|
-
getRandomId() {
|
|
61
|
-
throw new Error(me_1.environmentUnsupportedMessage);
|
|
62
|
-
}
|
|
63
|
-
createChildContent(options) {
|
|
64
|
-
throw new Error(me_1.environmentUnsupportedMessage);
|
|
65
|
-
}
|
|
66
|
-
getWebWindow(identity) {
|
|
67
|
-
throw new Error(me_1.environmentUnsupportedMessage);
|
|
68
|
-
}
|
|
69
|
-
getCurrentEntityIdentity() {
|
|
70
|
-
throw new Error(me_1.environmentUnsupportedMessage);
|
|
71
|
-
}
|
|
72
|
-
getCurrentEntityType() {
|
|
73
|
-
return 'unknown';
|
|
74
|
-
}
|
|
75
|
-
raiseEvent(eventName, eventArgs) {
|
|
76
|
-
throw new Error(me_1.environmentUnsupportedMessage);
|
|
77
|
-
}
|
|
78
|
-
getUrl() {
|
|
79
|
-
throw new Error(me_1.environmentUnsupportedMessage);
|
|
80
|
-
}
|
|
81
|
-
whenReady() {
|
|
82
|
-
throw new Error(me_1.environmentUnsupportedMessage);
|
|
83
|
-
}
|
|
84
|
-
getWsConstructor() {
|
|
85
|
-
throw new Error('Method not implemented.');
|
|
86
|
-
}
|
|
87
|
-
}
|
|
7
|
+
const mockEnvironment_1 = require("./environment/mockEnvironment");
|
|
8
|
+
const mockWire_1 = require("./transport/mockWire");
|
|
88
9
|
exports.fin = ((typeof window !== 'undefined' && (window === null || window === void 0 ? void 0 : window.fin)) ||
|
|
89
10
|
(() => {
|
|
90
|
-
const environment = new MockEnvironment();
|
|
91
|
-
const transport = new transport_1.Transport(MockWire, environment, {
|
|
11
|
+
const environment = new mockEnvironment_1.MockEnvironment();
|
|
12
|
+
const transport = new transport_1.Transport(mockWire_1.MockWire, environment, {
|
|
92
13
|
uuid: '',
|
|
93
14
|
name: ''
|
|
94
15
|
});
|
package/src/shapes/protocol.d.ts
CHANGED
|
@@ -37,6 +37,22 @@ export interface ProtocolMap extends ProtocolMapBase {
|
|
|
37
37
|
}>;
|
|
38
38
|
'trigger-before-unload': IdentityCall<{}, boolean>;
|
|
39
39
|
'window-get-views': IdentityCall<{}, OpenFin.Identity[]>;
|
|
40
|
+
'print': {
|
|
41
|
+
request: OpenFin.Identity & {
|
|
42
|
+
options: OpenFin.PrintOptions;
|
|
43
|
+
};
|
|
44
|
+
response: void;
|
|
45
|
+
};
|
|
46
|
+
'print-screenshot': {
|
|
47
|
+
request: OpenFin.Identity;
|
|
48
|
+
response: void;
|
|
49
|
+
};
|
|
50
|
+
'print-views': {
|
|
51
|
+
request: OpenFin.Identity & {
|
|
52
|
+
options: OpenFin.WindowViewsPrintOptions;
|
|
53
|
+
};
|
|
54
|
+
response: void;
|
|
55
|
+
};
|
|
40
56
|
'launch-manifest': {
|
|
41
57
|
request: {
|
|
42
58
|
manifestUrl: string;
|
|
@@ -148,6 +164,7 @@ export interface ProtocolMap extends ProtocolMapBase {
|
|
|
148
164
|
request: void;
|
|
149
165
|
response: OpenFin.PrinterInfo[];
|
|
150
166
|
};
|
|
167
|
+
'system-register-shutdown-handler': VoidCall;
|
|
151
168
|
}
|
|
152
169
|
type ApiCall<Request, Response> = {
|
|
153
170
|
request: Request;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
3
|
+
import { Wire } from './wire';
|
|
4
|
+
export declare class MockWire extends EventEmitter implements Wire {
|
|
5
|
+
connect(address: string): Promise<any>;
|
|
6
|
+
connectSync(): any;
|
|
7
|
+
send(data: any): Promise<any>;
|
|
8
|
+
shutdown(): Promise<void>;
|
|
9
|
+
getPort(): string;
|
|
10
|
+
constructor();
|
|
11
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MockWire = void 0;
|
|
4
|
+
const events_1 = require("events");
|
|
5
|
+
class MockWire extends events_1.EventEmitter {
|
|
6
|
+
connect(address) {
|
|
7
|
+
throw new Error('You are not running in OpenFin.');
|
|
8
|
+
}
|
|
9
|
+
connectSync() {
|
|
10
|
+
throw new Error('You are not running in OpenFin.');
|
|
11
|
+
}
|
|
12
|
+
send(data) {
|
|
13
|
+
throw new Error('You are not running in OpenFin.');
|
|
14
|
+
}
|
|
15
|
+
shutdown() {
|
|
16
|
+
throw new Error('You are not running in OpenFin.');
|
|
17
|
+
}
|
|
18
|
+
getPort() {
|
|
19
|
+
throw new Error('This transport has no port');
|
|
20
|
+
}
|
|
21
|
+
// eslint-disable-next-line no-useless-constructor
|
|
22
|
+
constructor() {
|
|
23
|
+
super();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.MockWire = MockWire;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { ErrorPlainObject } from '../util/errors';
|
|
2
3
|
export type ReadyState = 'CONNECTING' | 'OPEN' | 'CLOSING' | 'CLOSED';
|
|
3
4
|
export declare class DisconnectedError extends Error {
|
|
@@ -18,6 +19,13 @@ export type RuntimeErrorPayload = {
|
|
|
18
19
|
reason: string;
|
|
19
20
|
error?: ErrorPlainObject;
|
|
20
21
|
};
|
|
22
|
+
declare class InternalError<T extends ErrorPlainObject = ErrorPlainObject> extends Error {
|
|
23
|
+
constructor(err: T);
|
|
24
|
+
}
|
|
21
25
|
export declare class RuntimeError extends Error {
|
|
22
|
-
|
|
26
|
+
cause?: InternalError;
|
|
27
|
+
static getCallSite(callsToRemove?: number): NodeJS.CallSite[];
|
|
28
|
+
static prepareStackTrace(err: Error, callSites: NodeJS.CallSite[]): string;
|
|
29
|
+
constructor(payload: RuntimeErrorPayload, callSites?: NodeJS.CallSite[]);
|
|
23
30
|
}
|
|
31
|
+
export {};
|