@openfin/core 25.68.26

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.
Files changed (227) hide show
  1. package/LICENSE +13 -0
  2. package/NOTICE +16 -0
  3. package/OpenFin.d.ts +1340 -0
  4. package/README.md +41 -0
  5. package/docs.README(OLD).md +82 -0
  6. package/fin.d.ts +4 -0
  7. package/package.json +33 -0
  8. package/resources/win/OpenFinRVM.exe +0 -0
  9. package/src/api/application/Factory.d.ts +145 -0
  10. package/src/api/application/Factory.js +229 -0
  11. package/src/api/application/Instance.d.ts +302 -0
  12. package/src/api/application/Instance.js +412 -0
  13. package/src/api/application/index.d.ts +3 -0
  14. package/src/api/application/index.js +15 -0
  15. package/src/api/base.d.ts +43 -0
  16. package/src/api/base.js +177 -0
  17. package/src/api/clipboard/index.d.ts +69 -0
  18. package/src/api/clipboard/index.js +88 -0
  19. package/src/api/events/application.d.ts +69 -0
  20. package/src/api/events/application.js +2 -0
  21. package/src/api/events/base.d.ts +17 -0
  22. package/src/api/events/base.js +2 -0
  23. package/src/api/events/channel.d.ts +10 -0
  24. package/src/api/events/channel.js +2 -0
  25. package/src/api/events/emitterMap.d.ts +11 -0
  26. package/src/api/events/emitterMap.js +35 -0
  27. package/src/api/events/eventAggregator.d.ts +5 -0
  28. package/src/api/events/eventAggregator.js +43 -0
  29. package/src/api/events/externalApplication.d.ts +5 -0
  30. package/src/api/events/externalApplication.js +2 -0
  31. package/src/api/events/frame.d.ts +9 -0
  32. package/src/api/events/frame.js +2 -0
  33. package/src/api/events/globalHotkey.d.ts +10 -0
  34. package/src/api/events/globalHotkey.js +2 -0
  35. package/src/api/events/platform.d.ts +18 -0
  36. package/src/api/events/platform.js +2 -0
  37. package/src/api/events/system.d.ts +22 -0
  38. package/src/api/events/system.js +2 -0
  39. package/src/api/events/view.d.ts +56 -0
  40. package/src/api/events/view.js +2 -0
  41. package/src/api/events/webcontents.d.ts +48 -0
  42. package/src/api/events/webcontents.js +2 -0
  43. package/src/api/events/window.d.ts +169 -0
  44. package/src/api/events/window.js +2 -0
  45. package/src/api/external-application/Factory.d.ts +26 -0
  46. package/src/api/external-application/Factory.js +40 -0
  47. package/src/api/external-application/Instance.d.ts +102 -0
  48. package/src/api/external-application/Instance.js +109 -0
  49. package/src/api/external-application/index.d.ts +3 -0
  50. package/src/api/external-application/index.js +15 -0
  51. package/src/api/fin.d.ts +49 -0
  52. package/src/api/fin.js +43 -0
  53. package/src/api/frame/Factory.d.ts +36 -0
  54. package/src/api/frame/Factory.js +69 -0
  55. package/src/api/frame/Instance.d.ts +121 -0
  56. package/src/api/frame/Instance.js +130 -0
  57. package/src/api/frame/index.d.ts +3 -0
  58. package/src/api/frame/index.js +15 -0
  59. package/src/api/global-hotkey/index.d.ts +38 -0
  60. package/src/api/global-hotkey/index.js +58 -0
  61. package/src/api/interappbus/channel/channel.d.ts +26 -0
  62. package/src/api/interappbus/channel/channel.js +77 -0
  63. package/src/api/interappbus/channel/channels-docs.d.ts +318 -0
  64. package/src/api/interappbus/channel/channels-docs.js +376 -0
  65. package/src/api/interappbus/channel/client.d.ts +22 -0
  66. package/src/api/interappbus/channel/client.js +84 -0
  67. package/src/api/interappbus/channel/connection-manager.d.ts +28 -0
  68. package/src/api/interappbus/channel/connection-manager.js +244 -0
  69. package/src/api/interappbus/channel/index.d.ts +22 -0
  70. package/src/api/interappbus/channel/index.js +121 -0
  71. package/src/api/interappbus/channel/protocols/classic/message-receiver.d.ts +13 -0
  72. package/src/api/interappbus/channel/protocols/classic/message-receiver.js +73 -0
  73. package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +22 -0
  74. package/src/api/interappbus/channel/protocols/classic/strategy.js +84 -0
  75. package/src/api/interappbus/channel/protocols/combined/strategy.d.ts +20 -0
  76. package/src/api/interappbus/channel/protocols/combined/strategy.js +58 -0
  77. package/src/api/interappbus/channel/protocols/index.d.ts +44 -0
  78. package/src/api/interappbus/channel/protocols/index.js +2 -0
  79. package/src/api/interappbus/channel/protocols/protocol-manager.d.ts +10 -0
  80. package/src/api/interappbus/channel/protocols/protocol-manager.js +43 -0
  81. package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +23 -0
  82. package/src/api/interappbus/channel/protocols/rtc/endpoint.js +135 -0
  83. package/src/api/interappbus/channel/protocols/rtc/ice-manager.d.ts +30 -0
  84. package/src/api/interappbus/channel/protocols/rtc/ice-manager.js +131 -0
  85. package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +22 -0
  86. package/src/api/interappbus/channel/protocols/rtc/strategy.js +87 -0
  87. package/src/api/interappbus/channel/protocols/strategy-types.d.ts +13 -0
  88. package/src/api/interappbus/channel/protocols/strategy-types.js +2 -0
  89. package/src/api/interappbus/channel/protocols/strategy.d.ts +15 -0
  90. package/src/api/interappbus/channel/protocols/strategy.js +2 -0
  91. package/src/api/interappbus/channel/provider.d.ts +31 -0
  92. package/src/api/interappbus/channel/provider.js +165 -0
  93. package/src/api/interappbus/index.d.ts +85 -0
  94. package/src/api/interappbus/index.js +175 -0
  95. package/src/api/interop/Factory.d.ts +37 -0
  96. package/src/api/interop/Factory.js +54 -0
  97. package/src/api/interop/InteropBroker.d.ts +363 -0
  98. package/src/api/interop/InteropBroker.js +914 -0
  99. package/src/api/interop/InteropClient.d.ts +268 -0
  100. package/src/api/interop/InteropClient.js +450 -0
  101. package/src/api/interop/SessionContextGroupBroker.d.ts +26 -0
  102. package/src/api/interop/SessionContextGroupBroker.js +107 -0
  103. package/src/api/interop/SessionContextGroupClient.d.ts +20 -0
  104. package/src/api/interop/SessionContextGroupClient.js +85 -0
  105. package/src/api/interop/fdc3/fdc3-1.2.d.ts +187 -0
  106. package/src/api/interop/fdc3/fdc3-1.2.js +385 -0
  107. package/src/api/interop/fdc3/fdc3.js +17 -0
  108. package/src/api/interop/fdc3/utils.d.ts +6 -0
  109. package/src/api/interop/fdc3/utils.js +17 -0
  110. package/src/api/interop/index.d.ts +4 -0
  111. package/src/api/interop/index.js +16 -0
  112. package/src/api/interop/utils.d.ts +11 -0
  113. package/src/api/interop/utils.js +36 -0
  114. package/src/api/me.d.ts +35 -0
  115. package/src/api/me.js +60 -0
  116. package/src/api/platform/Factory.d.ts +109 -0
  117. package/src/api/platform/Factory.js +188 -0
  118. package/src/api/platform/Instance.d.ts +122 -0
  119. package/src/api/platform/Instance.js +299 -0
  120. package/src/api/platform/common-utils.d.ts +6 -0
  121. package/src/api/platform/common-utils.js +16 -0
  122. package/src/api/platform/index.d.ts +3 -0
  123. package/src/api/platform/index.js +15 -0
  124. package/src/api/platform/layout/Factory.d.ts +108 -0
  125. package/src/api/platform/layout/Factory.js +189 -0
  126. package/src/api/platform/layout/Instance.d.ts +48 -0
  127. package/src/api/platform/layout/Instance.js +99 -0
  128. package/src/api/platform/layout/index.d.ts +3 -0
  129. package/src/api/platform/layout/index.js +15 -0
  130. package/src/api/platform/layout/shapes.d.ts +11 -0
  131. package/src/api/platform/layout/shapes.js +2 -0
  132. package/src/api/snapshot-source/Factory.d.ts +36 -0
  133. package/src/api/snapshot-source/Factory.js +65 -0
  134. package/src/api/snapshot-source/Instance.d.ts +30 -0
  135. package/src/api/snapshot-source/Instance.js +134 -0
  136. package/src/api/snapshot-source/index.d.ts +3 -0
  137. package/src/api/snapshot-source/index.js +15 -0
  138. package/src/api/snapshot-source/utils.d.ts +1 -0
  139. package/src/api/snapshot-source/utils.js +5 -0
  140. package/src/api/system/application.d.ts +6 -0
  141. package/src/api/system/application.js +2 -0
  142. package/src/api/system/entity.d.ts +11 -0
  143. package/src/api/system/entity.js +2 -0
  144. package/src/api/system/index.d.ts +957 -0
  145. package/src/api/system/index.js +1241 -0
  146. package/src/api/system/installedApps.d.ts +6 -0
  147. package/src/api/system/installedApps.js +2 -0
  148. package/src/api/system/log.d.ts +11 -0
  149. package/src/api/system/log.js +2 -0
  150. package/src/api/system/process.d.ts +15 -0
  151. package/src/api/system/process.js +2 -0
  152. package/src/api/system/proxy.d.ts +15 -0
  153. package/src/api/system/proxy.js +2 -0
  154. package/src/api/system/queryPermissionTypes.d.ts +1 -0
  155. package/src/api/system/queryPermissionTypes.js +2 -0
  156. package/src/api/system/registry-info.d.ts +7 -0
  157. package/src/api/system/registry-info.js +2 -0
  158. package/src/api/system/window.d.ts +16 -0
  159. package/src/api/system/window.js +2 -0
  160. package/src/api/view/Factory.d.ts +49 -0
  161. package/src/api/view/Factory.js +103 -0
  162. package/src/api/view/Instance.d.ts +379 -0
  163. package/src/api/view/Instance.js +415 -0
  164. package/src/api/view/index.d.ts +3 -0
  165. package/src/api/view/index.js +15 -0
  166. package/src/api/webcontents/main.d.ts +36 -0
  167. package/src/api/webcontents/main.js +82 -0
  168. package/src/api/window/Factory.d.ts +44 -0
  169. package/src/api/window/Factory.js +91 -0
  170. package/src/api/window/Instance.d.ts +966 -0
  171. package/src/api/window/Instance.js +1202 -0
  172. package/src/api/window/bounds-changed.d.ts +10 -0
  173. package/src/api/window/bounds-changed.js +6 -0
  174. package/src/api/window/index.d.ts +5 -0
  175. package/src/api/window/index.js +17 -0
  176. package/src/api/window/shapes.d.ts +13 -0
  177. package/src/api/window/shapes.js +2 -0
  178. package/src/environment/environment.d.ts +28 -0
  179. package/src/environment/environment.js +4 -0
  180. package/src/environment/node-env.d.ts +25 -0
  181. package/src/environment/node-env.js +64 -0
  182. package/src/environment/openfin-env.d.ts +29 -0
  183. package/src/environment/openfin-env.js +105 -0
  184. package/src/mock.d.ts +4 -0
  185. package/src/mock.js +91 -0
  186. package/src/shapes/ERROR_BOX_TYPES.d.ts +6 -0
  187. package/src/shapes/ERROR_BOX_TYPES.js +10 -0
  188. package/src/shapes/EntityType.d.ts +1 -0
  189. package/src/shapes/EntityType.js +2 -0
  190. package/src/shapes/LayoutPresetType.d.ts +1 -0
  191. package/src/shapes/LayoutPresetType.js +2 -0
  192. package/src/shapes/Platform.d.ts +112 -0
  193. package/src/shapes/Platform.js +16 -0
  194. package/src/shapes/WebOptions.d.ts +12 -0
  195. package/src/shapes/WebOptions.js +2 -0
  196. package/src/shapes/WindowOptions.d.ts +42 -0
  197. package/src/shapes/WindowOptions.js +2 -0
  198. package/src/shapes/protocol.d.ts +178 -0
  199. package/src/shapes/protocol.js +2 -0
  200. package/src/transport/fin_store.d.ts +4 -0
  201. package/src/transport/fin_store.js +16 -0
  202. package/src/transport/transport-errors.d.ts +17 -0
  203. package/src/transport/transport-errors.js +39 -0
  204. package/src/transport/transport.d.ts +57 -0
  205. package/src/transport/transport.js +195 -0
  206. package/src/transport/wire.d.ts +76 -0
  207. package/src/transport/wire.js +39 -0
  208. package/src/util/asyncFilter.d.ts +1 -0
  209. package/src/util/asyncFilter.js +7 -0
  210. package/src/util/errors.d.ts +9 -0
  211. package/src/util/errors.js +14 -0
  212. package/src/util/exhaustive.d.ts +1 -0
  213. package/src/util/exhaustive.js +7 -0
  214. package/src/util/http.d.ts +11 -0
  215. package/src/util/http.js +83 -0
  216. package/src/util/normalize-config.d.ts +3 -0
  217. package/src/util/normalize-config.js +47 -0
  218. package/src/util/promises.d.ts +5 -0
  219. package/src/util/promises.js +27 -0
  220. package/src/util/ref-counter.d.ts +7 -0
  221. package/src/util/ref-counter.js +51 -0
  222. package/src/util/runtimeVersioning.d.ts +3 -0
  223. package/src/util/runtimeVersioning.js +25 -0
  224. package/src/util/utilTypes.d.ts +8 -0
  225. package/src/util/utilTypes.js +2 -0
  226. package/src/util/validate.d.ts +3 -0
  227. package/src/util/validate.js +11 -0
@@ -0,0 +1,10 @@
1
+ import { Reply } from '../base';
2
+ export default class BoundsChangedReply extends Reply<'window', 'bounds-changed'> {
3
+ changeType: BoundsChangeType;
4
+ deferred: boolean;
5
+ height: number;
6
+ width: number;
7
+ top: number;
8
+ left: number;
9
+ }
10
+ export declare type BoundsChangeType = 'position' | 'size' | 'position_and_size';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const base_1 = require("../base");
4
+ class BoundsChangedReply extends base_1.Reply {
5
+ }
6
+ exports.default = BoundsChangedReply;
@@ -0,0 +1,5 @@
1
+ import _WindowModule from './Factory';
2
+ export default _WindowModule;
3
+ export * from './shapes';
4
+ export * from './Instance';
5
+ export * from './bounds-changed';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
11
+ }
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ const Factory_1 = require("./Factory");
14
+ exports.default = Factory_1.default;
15
+ __exportStar(require("./shapes"), exports);
16
+ __exportStar(require("./Instance"), exports);
17
+ __exportStar(require("./bounds-changed"), exports);
@@ -0,0 +1,13 @@
1
+ export interface CloseEventShape {
2
+ name: string;
3
+ uuid: string;
4
+ type: string;
5
+ topic: string;
6
+ }
7
+ export interface WindowInfo {
8
+ canNavigateBack: boolean;
9
+ canNavigateForward: boolean;
10
+ preloadScripts: Array<any>;
11
+ title: string;
12
+ url: string;
13
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,28 @@
1
+ import { NewConnectConfig } from '../transport/wire';
2
+ import { EntityType } from '../shapes/EntityType';
3
+ export interface Environment {
4
+ getManagerConstructor(): Promise<any>;
5
+ getProviderInitializer(): Promise<any>;
6
+ writeToken(path: string, token: string): Promise<string>;
7
+ retrievePort(config: NewConnectConfig): Promise<number>;
8
+ getNextMessageId(): any;
9
+ getRandomId(): string;
10
+ createChildContent(options: ChildContentOptions): Promise<any>;
11
+ getWebWindow(identity: OpenFin.Identity): Window;
12
+ getCurrentEntityIdentity(): OpenFin.EntityInfo;
13
+ getCurrentEntityType(): EntityType;
14
+ raiseEvent(eventName: string, eventArgs: any): void;
15
+ childViews: boolean;
16
+ getUrl(): string;
17
+ getDefaultChannelOptions(): {
18
+ create: OpenFin.ChannelCreateOptions;
19
+ connect: OpenFin.ChannelConnectOptions;
20
+ };
21
+ getRtcPeer(): RTCPeerConnection;
22
+ whenReady(): Promise<void>;
23
+ }
24
+ export interface ChildContentOptions {
25
+ options: any;
26
+ entityType: EntityType;
27
+ }
28
+ export declare const notImplementedEnvErrorMsg = "Not implemented in this environment";
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.notImplementedEnvErrorMsg = void 0;
4
+ exports.notImplementedEnvErrorMsg = 'Not implemented in this environment';
@@ -0,0 +1,25 @@
1
+ import { Environment, ChildContentOptions } from './environment';
2
+ import { NewConnectConfig } from '../transport/wire';
3
+ import { EntityType } from '../shapes/EntityType';
4
+ export default class NodeEnvironment implements Environment {
5
+ getDefaultChannelOptions(): {
6
+ create: OpenFin.ChannelCreateOptions;
7
+ connect: OpenFin.ChannelConnectOptions;
8
+ };
9
+ getRtcPeer(): RTCPeerConnection;
10
+ private messageCounter;
11
+ childViews: boolean;
12
+ getManagerConstructor(): Promise<any>;
13
+ getProviderInitializer(): Promise<any>;
14
+ whenReady(): Promise<void>;
15
+ writeToken: (path: string, token: string) => Promise<string>;
16
+ retrievePort: (config: NewConnectConfig) => Promise<number>;
17
+ getNextMessageId: () => any;
18
+ getRandomId: () => string;
19
+ createChildContent(options: ChildContentOptions): Promise<any>;
20
+ getWebWindow: (identity: OpenFin.Identity) => Window;
21
+ getCurrentEntityIdentity: () => OpenFin.EntityInfo;
22
+ getCurrentEntityType: () => EntityType;
23
+ raiseEvent: (eventName: string, eventArgs: any) => void;
24
+ getUrl: () => string;
25
+ }
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /* eslint-disable class-methods-use-this */
4
+ const fs_1 = require("fs");
5
+ const crypto_1 = require("crypto");
6
+ const environment_1 = require("./environment");
7
+ const port_discovery_1 = require("../transport/port-discovery");
8
+ const transport_errors_1 = require("../transport/transport-errors");
9
+ class NodeEnvironment {
10
+ constructor() {
11
+ this.messageCounter = 0;
12
+ this.childViews = false;
13
+ this.writeToken = (path, token) => {
14
+ return new Promise((resolve) => {
15
+ fs_1.writeFile(path, token, () => resolve(token));
16
+ });
17
+ };
18
+ this.retrievePort = (config) => {
19
+ const pd = new port_discovery_1.default(config, this);
20
+ return pd.retrievePort();
21
+ };
22
+ this.getNextMessageId = () => {
23
+ // eslint-disable-next-line no-plusplus
24
+ return this.messageCounter++;
25
+ };
26
+ this.getRandomId = () => {
27
+ return crypto_1.randomBytes(16).toString('hex');
28
+ };
29
+ this.getWebWindow = (identity) => {
30
+ throw new transport_errors_1.NotSupportedError('Not supported outside of OpenFin web context');
31
+ };
32
+ this.getCurrentEntityIdentity = () => {
33
+ throw new transport_errors_1.NotImplementedError(environment_1.notImplementedEnvErrorMsg);
34
+ };
35
+ this.getCurrentEntityType = () => {
36
+ return 'external connection';
37
+ };
38
+ this.raiseEvent = (eventName, eventArgs) => {
39
+ throw new transport_errors_1.NotImplementedError(environment_1.notImplementedEnvErrorMsg);
40
+ };
41
+ this.getUrl = () => {
42
+ throw new transport_errors_1.NotImplementedError('Not Implemented');
43
+ };
44
+ }
45
+ getDefaultChannelOptions() {
46
+ return { create: {}, connect: {} };
47
+ }
48
+ getRtcPeer() {
49
+ throw new Error('Method not implemented.');
50
+ }
51
+ async getManagerConstructor() {
52
+ throw new Error('Method not implemented.');
53
+ }
54
+ async getProviderInitializer() {
55
+ throw new Error('Method not implemented.');
56
+ }
57
+ whenReady() {
58
+ return Promise.resolve();
59
+ }
60
+ createChildContent(options) {
61
+ throw new transport_errors_1.NotImplementedError('Not Implemented');
62
+ }
63
+ }
64
+ exports.default = NodeEnvironment;
@@ -0,0 +1,29 @@
1
+ import { Environment, ChildContentOptions } from './environment';
2
+ import { NewConnectConfig } from '../transport/wire';
3
+ import { EntityType } from '../shapes/EntityType';
4
+ export default class OpenFinEnvironment implements Environment {
5
+ #private;
6
+ private raiseEventAsync;
7
+ childViews: boolean;
8
+ constructor();
9
+ getDefaultChannelOptions(): {
10
+ create: OpenFin.ChannelCreateOptions;
11
+ connect: OpenFin.ChannelConnectOptions;
12
+ };
13
+ getRtcPeer(): RTCPeerConnection;
14
+ getManagerConstructor(): Promise<any>;
15
+ getProviderInitializer(): Promise<any>;
16
+ writeToken: (path: string, token: string) => Promise<string>;
17
+ retrievePort: (config: NewConnectConfig) => Promise<number>;
18
+ getNextMessageId: () => any;
19
+ createChildContent: ({ options, entityType }: ChildContentOptions) => Promise<unknown>;
20
+ private normalizeOptions;
21
+ getRandomId: () => string;
22
+ private resolveUrl;
23
+ getWebWindow: (identity: OpenFin.Identity) => Window;
24
+ getCurrentEntityIdentity: () => OpenFin.EntityInfo;
25
+ getCurrentEntityType: () => EntityType;
26
+ raiseEvent: (eventName: string, eventArgs: any) => void;
27
+ getUrl: () => string;
28
+ whenReady(): Promise<void>;
29
+ }
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
3
+ if (!privateMap.has(receiver)) {
4
+ throw new TypeError("attempted to set private field on non-instance");
5
+ }
6
+ privateMap.set(receiver, value);
7
+ return value;
8
+ };
9
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
10
+ if (!privateMap.has(receiver)) {
11
+ throw new TypeError("attempted to get private field on non-instance");
12
+ }
13
+ return privateMap.get(receiver);
14
+ };
15
+ var _ready;
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ const transport_errors_1 = require("../transport/transport-errors");
18
+ class OpenFinEnvironment {
19
+ constructor() {
20
+ _ready.set(this, void 0);
21
+ this.writeToken = (path, token) => {
22
+ throw new transport_errors_1.NotImplementedError('Not Implemented');
23
+ };
24
+ this.retrievePort = (config) => {
25
+ throw new transport_errors_1.NotImplementedError('Not Implemented');
26
+ };
27
+ this.getNextMessageId = () => {
28
+ return fin.desktop.getUuid();
29
+ };
30
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
31
+ this.createChildContent = async ({ options, entityType }) => {
32
+ const opts = this.normalizeOptions(options);
33
+ return new Promise((y, n) => fin.__internal_.createChildContent({ entityType, options: opts }, y, n));
34
+ };
35
+ this.normalizeOptions = (options) => {
36
+ const { uuid: parentUuid } = fin.__internal_.initialOptions;
37
+ const opts = JSON.parse(JSON.stringify(options));
38
+ const ABOUT_BLANK = 'about:blank';
39
+ opts.uuid = opts.uuid || parentUuid;
40
+ opts.url = opts.url || ABOUT_BLANK;
41
+ if (opts.url !== ABOUT_BLANK) {
42
+ opts.url = this.resolveUrl(opts.url);
43
+ }
44
+ return opts;
45
+ };
46
+ this.getRandomId = () => {
47
+ const intArray = new Uint32Array(1);
48
+ return window.crypto.getRandomValues(intArray)[0].toString(32);
49
+ };
50
+ this.getWebWindow = (identity) => {
51
+ return fin.__internal_.getWebWindow(identity.name);
52
+ };
53
+ this.getCurrentEntityIdentity = () => {
54
+ return fin.__internal_.entityInfo;
55
+ };
56
+ this.getCurrentEntityType = () => {
57
+ return this.getCurrentEntityIdentity().entityType || 'unknown';
58
+ };
59
+ this.raiseEvent = (eventName, eventArgs) => {
60
+ this.raiseEventAsync(eventName, eventArgs);
61
+ };
62
+ this.getUrl = () => {
63
+ return location.href;
64
+ };
65
+ this.raiseEventAsync = fin.__internal_.raiseEventAsync;
66
+ delete fin.__internal_.raiseEventAsync;
67
+ this.childViews = fin.__internal_.childViews;
68
+ __classPrivateFieldSet(this, _ready, new Promise((resolve) => {
69
+ fin.desktop.main(resolve);
70
+ }));
71
+ }
72
+ getDefaultChannelOptions() {
73
+ var _a, _b;
74
+ return {
75
+ create: {},
76
+ connect: {},
77
+ ...((_b = (_a = fin.__internal_.initialOptions.experimental) === null || _a === void 0 ? void 0 : _a.defaultChannelOptions) !== null && _b !== void 0 ? _b : {})
78
+ };
79
+ }
80
+ getRtcPeer() {
81
+ return new RTCPeerConnection();
82
+ }
83
+ async getManagerConstructor() {
84
+ const ManagerConstructor = (await Promise.resolve().then(() => require(
85
+ /* webpackChunkName: 'layout' */
86
+ '../api/platform/renderer/openfin-layout'))).default;
87
+ return ManagerConstructor;
88
+ }
89
+ async getProviderInitializer() {
90
+ const providerInitializer = (await Promise.resolve().then(() => require(
91
+ /* webpackChunkName: 'provider' */
92
+ '../api/platform/renderer/platform-provider'))).default;
93
+ return providerInitializer;
94
+ }
95
+ // eslint-disable-next-line class-methods-use-this
96
+ resolveUrl(url) {
97
+ const newUrl = new URL(url, location.href);
98
+ return newUrl.href;
99
+ }
100
+ whenReady() {
101
+ return __classPrivateFieldGet(this, _ready);
102
+ }
103
+ }
104
+ exports.default = OpenFinEnvironment;
105
+ _ready = new WeakMap();
package/src/mock.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ /// <reference path="../OpenFin.d.ts" />
2
+ export declare const fin: import("./api/fin").FinApi<"window" | "iframe" | "view">;
3
+ export declare const inOpenFin: boolean;
4
+ export default OpenFin;
package/src/mock.js ADDED
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.inOpenFin = exports.fin = void 0;
5
+ /* eslint-disable import/prefer-default-export */
6
+ /* eslint-disable spaced-comment */
7
+ /* eslint-disable @typescript-eslint/triple-slash-reference */
8
+ /* eslint-disable @typescript-eslint/explicit-function-return-type */
9
+ /* eslint-disable class-methods-use-this */
10
+ /// <reference path="../OpenFin.d.ts"/>
11
+ const events_1 = require("events");
12
+ const fin_1 = require("./api/fin");
13
+ const transport_1 = require("./transport/transport");
14
+ class MockWire extends events_1.EventEmitter {
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
+ // eslint-disable-next-line no-useless-constructor
28
+ constructor() {
29
+ super();
30
+ }
31
+ }
32
+ class MockEnvironment {
33
+ constructor() {
34
+ this.childViews = true;
35
+ }
36
+ getDefaultChannelOptions() {
37
+ throw new Error('Method not implemented.');
38
+ }
39
+ getRtcPeer() {
40
+ throw new Error('Method not implemented.');
41
+ }
42
+ getManagerConstructor() {
43
+ throw new Error('Method not implemented.');
44
+ }
45
+ getProviderInitializer() {
46
+ throw new Error('Method not implemented.');
47
+ }
48
+ writeToken(path, token) {
49
+ throw new Error('Method not implemented.');
50
+ }
51
+ retrievePort(config) {
52
+ throw new Error('Method not implemented.');
53
+ }
54
+ getNextMessageId() {
55
+ throw new Error('Method not implemented.');
56
+ }
57
+ getRandomId() {
58
+ throw new Error('Method not implemented.');
59
+ }
60
+ createChildContent(options) {
61
+ throw new Error('Method not implemented.');
62
+ }
63
+ getWebWindow(identity) {
64
+ throw new Error('Method not implemented.');
65
+ }
66
+ getCurrentEntityIdentity() {
67
+ throw new Error('Method not implemented.');
68
+ }
69
+ getCurrentEntityType() {
70
+ return 'unknown';
71
+ }
72
+ raiseEvent(eventName, eventArgs) {
73
+ throw new Error('Method not implemented.');
74
+ }
75
+ getUrl() {
76
+ throw new Error('Method not implemented.');
77
+ }
78
+ whenReady() {
79
+ throw new Error('Method not implemented.');
80
+ }
81
+ }
82
+ exports.fin = ((typeof window !== 'undefined' && ((_a = window) === null || _a === void 0 ? void 0 : _a.fin)) ||
83
+ (() => {
84
+ const environment = new MockEnvironment();
85
+ const transport = new transport_1.default(MockWire, environment, {
86
+ uuid: '',
87
+ name: ''
88
+ });
89
+ return new fin_1.default(transport);
90
+ })());
91
+ exports.inOpenFin = typeof window !== 'undefined' && typeof window.fin === 'object';
@@ -0,0 +1,6 @@
1
+ declare enum ERROR_BOX_TYPES {
2
+ APP_INITIALIZATION = "OF_error_box:app_initialization",
3
+ MAIN_PROCESS = "OF_error_box:main_process",
4
+ RENDERER_CRASH = "OF_error_box:renderer_crash"
5
+ }
6
+ export default ERROR_BOX_TYPES;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // Error types
4
+ var ERROR_BOX_TYPES;
5
+ (function (ERROR_BOX_TYPES) {
6
+ ERROR_BOX_TYPES["APP_INITIALIZATION"] = "OF_error_box:app_initialization";
7
+ ERROR_BOX_TYPES["MAIN_PROCESS"] = "OF_error_box:main_process";
8
+ ERROR_BOX_TYPES["RENDERER_CRASH"] = "OF_error_box:renderer_crash";
9
+ })(ERROR_BOX_TYPES || (ERROR_BOX_TYPES = {}));
10
+ exports.default = ERROR_BOX_TYPES;
@@ -0,0 +1 @@
1
+ export declare type EntityType = 'window' | 'iframe' | 'external connection' | 'view' | 'unknown';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export declare type LayoutPresetType = 'columns' | 'grid' | 'rows' | 'tabs';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,112 @@
1
+ import type { WindowOptionsChangedEvent } from '../api/events/window';
2
+ export declare enum HostContextChangedReasons {
3
+ updated = "updated",
4
+ reparented = "reparented"
5
+ }
6
+ export declare enum WindowCreationReason {
7
+ Tearout = "tearout",
8
+ CreateViewWithoutTarget = "create-view-without-target",
9
+ APICall = "api-call",
10
+ AppCreation = "app-creation",
11
+ Restore = "restore"
12
+ }
13
+ export interface PlatformProvider {
14
+ /**
15
+ * Handles requests to create a window in the current platform.
16
+ * @param { WindowOption } payload Window options for the window to be created.
17
+ * @param { Identity } [identity] If {@link Platform#createWindow Platform.createWindow} was called, the identity of the caller will be here.
18
+ * If `createWindow` was called as part of applying a snapshot or creating a view without a target window, `identity` will be undefined.
19
+ */
20
+ createWindow(options: OpenFin.PlatformWindowCreationOptions, identity?: OpenFin.Identity): Promise<OpenFin.Window>;
21
+ /**
22
+ * Gets the current state of windows and their views and returns a snapshot object containing that info.
23
+ * @param { undefined } payload Undefined unless you've defined a custom `getSnapshot` protocol.
24
+ * @param { Identity } identity Identity of the entity that called {@link Platform#getSnapshot Platform.getSnapshot}.
25
+ * @return { Promise<Snapshot> } Snapshot of current platform state.
26
+ */
27
+ getSnapshot(payload: undefined, identity: OpenFin.Identity): Promise<OpenFin.Snapshot>;
28
+ /**
29
+ * Called when a snapshot is being applied and some windows in that snapshot would be fully or partially off-screen.
30
+ * Returns an array of windows with modified positions, such that any off-screen windows are positioned in the top left
31
+ * corner of the main monitor.
32
+ * @param { Snapshot } snapshot The snapshot to be applied.
33
+ * @param { WindowOptions[] } outOfBoundsWindows An array of WindowOptions for any windows that would be off-screen.
34
+ * @return { Promise<WindowOptions[]> } An array of WindowOptions with their position modified to fit on screen.
35
+ */
36
+ positionOutOfBoundsWindows(snapshot: OpenFin.Snapshot, outOfBoundsWindows: OpenFin.WindowCreationOptions[]): Promise<OpenFin.WindowCreationOptions[]>;
37
+ /**
38
+ * Handles requests to apply a snapshot to the current Platform.
39
+ * @param { ApplySnapshotPayload } payload Payload containing the snapshot to be applied, as well as any options.
40
+ * @param { Identity } [identity] Identity of the entity that called {@link Platform#applySnapshot Platform.applySnapshot}.
41
+ * Undefined if called internally (e.g. when opening the initial snapshot).
42
+ * @return { Promise<void> }
43
+ */
44
+ applySnapshot(payload: OpenFin.ApplySnapshotPayload, identity?: OpenFin.Identity): Promise<void>;
45
+ /**
46
+ * Closes the current Platform and all child windows and views.
47
+ * @param { undefined } payload Undefined unless you have implemented a custom quite protocol.
48
+ * @param { Identity } identity Identity of the entity that called {@link Platform#quit Platform.quit}.
49
+ * @return { Promise<void> }
50
+ */
51
+ quit(payload: undefined, identity: OpenFin.Identity): Promise<void>;
52
+ /**
53
+ * Closes a view
54
+ * @param { CloseViewPayload } payload Specifies the `target` view to be closed.
55
+ * @param { Identity } identity Identity of the entity that called {@link Platform#closeView Platform.closeView}.
56
+ */
57
+ closeView(payload: OpenFin.CloseViewPayload, identity?: OpenFin.Identity): Promise<any>;
58
+ /**
59
+ * Creates a new view and attaches it to a specified target window.
60
+ * @param { CreateViewPayload } payload Creation options for the new view.
61
+ * @param { Identity } identity Identity of the entity that called {@link Platform#createView Platform.createView}.
62
+ * @return { Promise<void> }
63
+ */
64
+ createView(payload: OpenFin.CreateViewPayload, identity: OpenFin.Identity): Promise<OpenFin.View>;
65
+ /** Handles requests to fetch manifests in the current platform.
66
+ * @param { FetchManifestPayload } payload Payload containing the manifestUrl to be fetched.
67
+ * @param { Identity } callerIdentity If {@link Platform#fetchManifest Platform.fetchManifest}
68
+ * was called, the identity of the caller will be here.
69
+ * If `fetchManifest` was called internally, `callerIdentity` will be the provider's identity.
70
+ */
71
+ fetchManifest(payload: OpenFin.FetchManifestPayload, callerIdentity: OpenFin.Identity): Promise<any>;
72
+ /**
73
+ * Replaces a Platform window's layout with a new layout. Any views that were in the old layout but not the new layout will be destroyed.
74
+ * @param { ReplaceLayoutPayload } payload Contains the `target` window and an `opts` object with a `layout` property to apply.
75
+ * @param { Identity } [identity] Identity of the entity that called {@link Platform#replaceLayout Platform.replaceLayout}.
76
+ * Undefined if `replaceLayout` is called internally (e.g. while applying a snapshot).
77
+ * @return { Promise<void> }
78
+ */
79
+ replaceLayout(payload: OpenFin.ReplaceLayoutPayload, identity?: OpenFin.Identity): Promise<void>;
80
+ replaceView(payload: OpenFin.ReplaceViewPayload, identity?: OpenFin.Identity): Promise<void>;
81
+ launchIntoPlatform(payload: OpenFin.LaunchIntoPlatformPayload): Promise<void>;
82
+ /**
83
+ * Handles requests to set a window's context. `target` may be a window or a view.
84
+ * If it is a window, that window's `customContext` will be updated.
85
+ * If it is a view, the `customContext` of that view's current host window will be updated.
86
+ * @param { SetWindowContextPayload } payload Object containing the requested `context` update,
87
+ * the `target`'s identity, and the target's `entityType`.
88
+ * @param { Identity } [identity] Identity of the entity that called {@link Platform#setWindowContext Platform.setWindowContext}.
89
+ * Undefined if `setWindowContext` is called internally (e.g. while applying a snapshot).
90
+ * @return { Promise<any> } The new context.
91
+ */
92
+ setWindowContext(payload: OpenFin.SetWindowContextPayload, identity?: OpenFin.Identity): Promise<any>;
93
+ /**
94
+ * Handles requests to get a window's context. `target` may be a window or a view.
95
+ * If it is a window, that window's `customContext` will be returned.
96
+ * If it is a view, the `customContext` of that view's current host window will be returned.
97
+ * @param { GetWindowContextPayload } payload Object containing the requested `context` update,
98
+ * the `target`'s identity, and the target's `entityType`.
99
+ * @param { Identity } [identity] Identity of the entity that called {@link Platform#getWindowContext Platform.getWindowContext}.
100
+ * Undefined when `getWindowContext` is called internally
101
+ * (e.g. when getting a window's context for the purpose of raising a "host-context-changed" event on a reparented view).
102
+ * @return { Promise<any> } The new context.
103
+ */
104
+ getWindowContext(payload: OpenFin.GetWindowContextPayload, identity?: OpenFin.Identity): Promise<any>;
105
+ /**
106
+ * Called when a window's `customContext` is updated. Responsible for raising the `host-context-updated` event on that window's child views.
107
+ * @param { WindowOptionsChangedEvent<'window', 'options-changed'> } payload The event payload for the window whose context has changed.
108
+ * The new context will be contained as `payload.diff.customContext.newVal`.
109
+ * @return { Promise<HostContextChangedPayload> } The event that it raised.
110
+ */
111
+ onWindowContextUpdated(payload: WindowOptionsChangedEvent<'window', 'options-changed'>): Promise<OpenFin.HostContextChangedPayload | undefined>;
112
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WindowCreationReason = exports.HostContextChangedReasons = void 0;
4
+ var HostContextChangedReasons;
5
+ (function (HostContextChangedReasons) {
6
+ HostContextChangedReasons["updated"] = "updated";
7
+ HostContextChangedReasons["reparented"] = "reparented";
8
+ })(HostContextChangedReasons = exports.HostContextChangedReasons || (exports.HostContextChangedReasons = {}));
9
+ var WindowCreationReason;
10
+ (function (WindowCreationReason) {
11
+ WindowCreationReason["Tearout"] = "tearout";
12
+ WindowCreationReason["CreateViewWithoutTarget"] = "create-view-without-target";
13
+ WindowCreationReason["APICall"] = "api-call";
14
+ WindowCreationReason["AppCreation"] = "app-creation";
15
+ WindowCreationReason["Restore"] = "restore";
16
+ })(WindowCreationReason = exports.WindowCreationReason || (exports.WindowCreationReason = {}));
@@ -0,0 +1,12 @@
1
+ export interface WebOptions {
2
+ preloadScripts?: OpenFin.PreloadScript[];
3
+ uuid: string;
4
+ name: string;
5
+ contentCreation?: OpenFin.ContentCreationOptions;
6
+ contentRedirect?: Partial<OpenFin.ContentRedirect>;
7
+ customContext?: any;
8
+ experimental?: any;
9
+ processAffinity?: string;
10
+ backgroundThrottling?: boolean;
11
+ interop?: OpenFin.InteropConfig;
12
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,42 @@
1
+ import ERROR_BOX_TYPES from './ERROR_BOX_TYPES';
2
+ import { WebOptions } from './WebOptions';
3
+ export interface WindowOptions extends Partial<OpenFin.WindowOptions>, Partial<WindowInternalOptions> {
4
+ name: string;
5
+ uuid: string;
6
+ }
7
+ export interface WindowInternalOptions extends WebOptions {
8
+ 'alwaysOnBottom': boolean;
9
+ 'appLogFlushInterval': number;
10
+ 'center': boolean;
11
+ 'description': string;
12
+ 'disableIabSecureLogging': boolean;
13
+ 'draggable': boolean;
14
+ 'enableAppLogging': boolean;
15
+ 'enable-plugins': boolean;
16
+ 'enableLargerThanScreen': boolean;
17
+ 'exitOnClose': boolean;
18
+ 'experimental': any;
19
+ 'hasLoaded': boolean;
20
+ 'hideOnBlur': boolean;
21
+ 'hideOnClose': boolean;
22
+ 'hideWhileChildrenVisible': boolean;
23
+ 'isRawWindowOpen': boolean;
24
+ 'launchExternal': string;
25
+ 'loadErrorMessage': string;
26
+ 'nonPersistent': boolean;
27
+ 'nonPersistant': boolean;
28
+ 'plugins': boolean;
29
+ 'preload': string | OpenFin.PreloadScript[];
30
+ 'resize': boolean;
31
+ 'show': boolean;
32
+ 'skipTaskbar': boolean;
33
+ 'taskbarIcon': string;
34
+ 'title': string;
35
+ 'toShowOnRun': boolean;
36
+ 'transparent': boolean;
37
+ '_type': ERROR_BOX_TYPES;
38
+ 'webPreferences': {
39
+ nodeIntegration: boolean;
40
+ plugins: boolean;
41
+ };
42
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });