@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,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnsupportedChannelApiError = exports.UnsupportedError = void 0;
4
+ class UnsupportedError extends Error {
5
+ constructor(apiName) {
6
+ super(apiName);
7
+ this.message = `${apiName} is not a supported API`;
8
+ }
9
+ }
10
+ exports.UnsupportedError = UnsupportedError;
11
+ class UnsupportedChannelApiError extends Error {
12
+ constructor(apiName) {
13
+ super(apiName);
14
+ this.message = `Calling ${apiName} on an instance of a System Channel returned by fdc3.getSystemChannels is not supported. If you would like to use a System Channel, please use fdc3.joinChannel, fdc3.addContextListener, and fdc3.broadcast instead.`;
15
+ }
16
+ }
17
+ exports.UnsupportedChannelApiError = UnsupportedChannelApiError;
@@ -0,0 +1,4 @@
1
+ import InteropModule from './Factory';
2
+ export default InteropModule;
3
+ export * from './InteropClient';
4
+ export * from './InteropBroker';
@@ -0,0 +1,16 @@
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("./InteropClient"), exports);
16
+ __exportStar(require("./InteropBroker"), exports);
@@ -0,0 +1,11 @@
1
+ export declare const generateId: () => string;
2
+ export declare const wrapInTryCatch: <T>(f: (...args: any[]) => T, prefix?: string) => (...args: any[]) => T;
3
+ export declare const wrapContextHandler: (handler: OpenFin.ContextHandler, handlerId: string) => (context: OpenFin.Context) => Promise<void>;
4
+ export declare const generateOverrideError: (clientApi: string, brokerApi: string) => string;
5
+ export declare const generateOverrideWarning: (interopClientApi: string, fdc3ClientApi: string, brokerApi: string, identity: OpenFin.ClientIdentity) => string;
6
+ export declare const BROKER_ERRORS: {
7
+ fireIntent: string;
8
+ fireIntentForContext: string;
9
+ getInfoForIntent: string;
10
+ getInfoForIntentsByContext: string;
11
+ };
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BROKER_ERRORS = exports.generateOverrideWarning = exports.generateOverrideError = exports.wrapContextHandler = exports.wrapInTryCatch = exports.generateId = void 0;
4
+ exports.generateId = () => `${Math.random()}${Date.now()}`;
5
+ exports.wrapInTryCatch = (f, prefix) => (...args) => {
6
+ try {
7
+ return f(...args);
8
+ }
9
+ catch (e) {
10
+ throw new Error((prefix || '') + e);
11
+ }
12
+ };
13
+ exports.wrapContextHandler = (handler, handlerId) => {
14
+ return async (context) => {
15
+ try {
16
+ await handler(context);
17
+ }
18
+ catch (error) {
19
+ console.error(`Error thrown by handler ${handlerId} for context type ${context.type}: ${error}`);
20
+ throw error;
21
+ }
22
+ };
23
+ };
24
+ exports.generateOverrideError = (clientApi, brokerApi) => {
25
+ return `You have tried to to use ${clientApi} but ${brokerApi} has not been overridden in the Interop Broker. Please override this function. Refer to our documentation for more info.`;
26
+ };
27
+ exports.generateOverrideWarning = (interopClientApi, fdc3ClientApi, brokerApi, identity) => {
28
+ const { uuid, name } = identity;
29
+ return `Entity with identity: ${uuid}/${name} has called ${interopClientApi} or ${fdc3ClientApi} but ${brokerApi} has not been overridden.`;
30
+ };
31
+ exports.BROKER_ERRORS = {
32
+ fireIntent: exports.generateOverrideError('fireIntent', 'handleFiredIntent'),
33
+ fireIntentForContext: exports.generateOverrideError('fireIntentForContext', 'handleFiredIntentForContext'),
34
+ getInfoForIntent: exports.generateOverrideError('getInfoForIntent', 'handleInfoForIntent'),
35
+ getInfoForIntentsByContext: exports.generateOverrideError('getInfoForIntentsByContext', 'handleInfoForIntentsByContext')
36
+ };
@@ -0,0 +1,35 @@
1
+ import { EntityType } from '../shapes/EntityType';
2
+ import Transport from '../transport/transport';
3
+ import type { InteropClient } from './interop';
4
+ export declare type EntityTypeHelpers<T extends EntityType> = T extends 'view' ? {
5
+ isView: true;
6
+ isWindow: false;
7
+ isExternal: false;
8
+ isFrame: false;
9
+ } : T extends 'window' ? {
10
+ isView: false;
11
+ isWindow: true;
12
+ isExternal: false;
13
+ isFrame: false;
14
+ } : T extends 'iframe' ? {
15
+ isView: false;
16
+ isWindow: false;
17
+ isExternal: false;
18
+ isFrame: true;
19
+ } : T extends 'external connection' ? {
20
+ isView: false;
21
+ isWindow: false;
22
+ isExternal: true;
23
+ isFrame: false;
24
+ } : T extends 'unknown' ? {
25
+ isView: false;
26
+ isWindow: false;
27
+ isExternal: false;
28
+ isFrame: false;
29
+ } : never;
30
+ export declare function getBaseMe<T extends EntityType = EntityType>(entityType: T, uuid: string, name: string): OpenFin.EntityInfo & EntityTypeHelpers<T>;
31
+ export interface WithInterop {
32
+ interop: InteropClient;
33
+ }
34
+ export declare type Me<MeType extends EntityType> = OpenFin.EntityInfo & (MeType extends 'view' ? EntityTypeHelpers<'view'> & OpenFin.View & WithInterop : MeType extends 'window' ? EntityTypeHelpers<'window'> & OpenFin.Window & WithInterop : MeType extends 'iframe' ? EntityTypeHelpers<'iframe'> & OpenFin.Frame & WithInterop : EntityTypeHelpers<MeType> & WithInterop);
35
+ export declare function getMe<MeType extends EntityType>(wire: Transport<MeType>): Me<MeType>;
package/src/api/me.js ADDED
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMe = exports.getBaseMe = void 0;
4
+ const view_1 = require("./view");
5
+ const frame_1 = require("./frame");
6
+ const window_1 = require("./window");
7
+ function getBaseMe(entityType, uuid, name) {
8
+ const entityTypeHelpers = {
9
+ isView: entityType === 'view',
10
+ isWindow: entityType === 'window',
11
+ isFrame: entityType === 'iframe',
12
+ isExternal: entityType === 'external connection'
13
+ };
14
+ return { ...entityTypeHelpers, uuid, name, entityType };
15
+ }
16
+ exports.getBaseMe = getBaseMe;
17
+ // We need to do a lot of casting as unknown here because the compiler get's confused about matching types. What matters is that it works on the outside
18
+ function getMe(wire) {
19
+ const { uuid, name, entityType } = wire.me;
20
+ const interopObject = {
21
+ setContext() {
22
+ throw new Error('Interop API has not been instantiated. Either connection has failed or you have not declared interop in your config.');
23
+ },
24
+ addContextHandler() {
25
+ throw new Error('Interop API has not been instantiated. Either connection has failed or you have not declared interop in your config.');
26
+ },
27
+ getContextGroups() {
28
+ throw new Error('Interop API has not been instantiated. Either connection has failed or you have not declared interop in your config.');
29
+ },
30
+ joinContextGroup() {
31
+ throw new Error('Interop API has not been instantiated. Either connection has failed or you have not declared interop in your config.');
32
+ },
33
+ removeFromContextGroup() {
34
+ throw new Error('Interop API has not been instantiated. Either connection has failed or you have not declared interop in your config.');
35
+ },
36
+ getAllClientsInContextGroup() {
37
+ throw new Error('Interop API has not been instantiated. Either connection has failed or you have not declared interop in your config.');
38
+ },
39
+ getInfoForContextGroup() {
40
+ throw new Error('Interop API has not been instantiated. Either connection has failed or you have not declared interop in your config.');
41
+ }
42
+ };
43
+ switch (entityType) {
44
+ case 'view':
45
+ return Object.assign(new view_1.View(wire, { uuid, name }), getBaseMe(entityType, uuid, name), {
46
+ interop: interopObject
47
+ });
48
+ case 'window':
49
+ return Object.assign(new window_1._Window(wire, { uuid, name }), getBaseMe(entityType, uuid, name), {
50
+ interop: interopObject
51
+ });
52
+ case 'iframe':
53
+ return Object.assign(new frame_1._Frame(wire, { uuid, name }), getBaseMe(entityType, uuid, name), {
54
+ interop: interopObject
55
+ });
56
+ default:
57
+ return { ...getBaseMe(entityType, uuid, name) };
58
+ }
59
+ }
60
+ exports.getMe = getMe;
@@ -0,0 +1,109 @@
1
+ import { Base } from '../base';
2
+ import { Channel } from '../interappbus/channel/index';
3
+ import Transport from '../../transport/transport';
4
+ import { LayoutModule } from './layout/index';
5
+ /**
6
+ * InitPlatformOptions interface
7
+ * @typedef { object } InitPlatformOptions
8
+ * @property { OverrideCallback } [overrideCallback] a callback function that can be used to extend or replace default Provider behavior.
9
+ */
10
+ /**
11
+ * @typedef { same | different } ProcessAffinityStrategy
12
+ * @summary Strategy to place views that share a domain into different process affinities or the same process affinity.
13
+ * @property { string } same views in the same domain will have the same process affinity.
14
+ * @property { string } different views in the same domain will have different process affinities.
15
+ */
16
+ /**
17
+ * @typedef { object } PlatformOptions
18
+ * @summary The options object required by {@link Platform#start Platform.start}
19
+ * Any {@link ApplicationOption Application option} is also a valid platform option
20
+ * @property {Array.<Object>} [commands] Configuration for keyboard commands.
21
+ * For details and usage, see [Using Keyboard Commands]{@link https://developers.openfin.co/docs/platform-api#section-5-3-using-keyboard-commands}.
22
+ * @property {DefaultWindowOptions} [defaultWindowOptions] Default window options apply to all platform windows.
23
+ * @property {View~options} [defaultViewOptions] Default view options apply to all platform views.
24
+ * @property {ProcessAffinityStrategy} [viewProcessAffinityStrategy] 'same' | 'different'.
25
+ */
26
+ /**
27
+ * @typedef { object } DefaultWindowOptions
28
+ * @summary Default window options apply to all platform windows.
29
+ * Any {@link Window~options Window option} is also a valid Default Window option
30
+ * used by default in any window that is created in the current platform's scope.
31
+ * Individual window options will override these defaults.
32
+ * @property {string} [stylesheetUrl]
33
+ * Specify a path of a custom CSS file to be injected to all of the platform's windows.
34
+ * _note_: this option is only applied to windows that use the Default OpenFin Window.
35
+ * Windows with a specified url (Custom Windows) will not be affected by this option.
36
+ */
37
+ /**
38
+ * Snapshot interface
39
+ * @typedef { object } Snapshot
40
+ * @property { WindowOption[] } windows The array of window options objects
41
+ */
42
+ /**
43
+ * @lends Platform
44
+ */
45
+ export default class PlatformModule extends Base {
46
+ private _channel;
47
+ Layout: LayoutModule;
48
+ private _initializer;
49
+ constructor(wire: Transport, channel: Channel);
50
+ /**
51
+ * Initializes a Platform. Must be called from the Provider when using a custom provider.
52
+ * @param { InitPlatformOptions } [options] - platform options including a callback function that can be used to extend or replace
53
+ * default Provider behavior.
54
+ * @return {Promise.<void>}
55
+ * @tutorial Platform.init
56
+ * @experimental
57
+ * @static
58
+ */
59
+ init(options?: OpenFin.InitPlatformOptions): Promise<void>;
60
+ /**
61
+ * Asynchronously returns a Platform object that represents an existing platform.
62
+ * @param { Identity } identity
63
+ * @return {Promise.<Platform>}
64
+ * @tutorial Platform.wrap
65
+ * @static
66
+ */
67
+ wrap(identity: OpenFin.ApplicationIdentity): Promise<OpenFin.Platform>;
68
+ /**
69
+ * Synchronously returns a Platform object that represents an existing platform.
70
+ * @param { Identity } identity
71
+ * @return {Platform}
72
+ * @tutorial Platform.wrapSync
73
+ * @static
74
+ */
75
+ wrapSync(identity: OpenFin.ApplicationIdentity): OpenFin.Platform;
76
+ /**
77
+ * Asynchronously returns a Platform object that represents the current platform.
78
+ * @return {Promise.<Platform>}
79
+ * @tutorial Platform.getCurrent
80
+ * @static
81
+ */
82
+ getCurrent(): Promise<OpenFin.Platform>;
83
+ /**
84
+ * Synchronously returns a Platform object that represents the current platform.
85
+ * @return {Platform}
86
+ * @tutorial Platform.getCurrentSync
87
+ * @static
88
+ */
89
+ getCurrentSync(): OpenFin.Platform;
90
+ /**
91
+ * Creates and starts a Platform and returns a wrapped and running Platform instance. The wrapped Platform methods can
92
+ * be used to launch content into the platform. Promise will reject if the platform is already running.
93
+ * @param { PlatformOptions } platformOptions
94
+ * @return {Promise.<Platform>}
95
+ * @tutorial Platform.start
96
+ * @static
97
+ */
98
+ start(platformOptions: OpenFin.PlatformOptions): Promise<OpenFin.Platform>;
99
+ /**
100
+ * Retrieves platforms's manifest and returns a wrapped and running Platform. If there is a snapshot in the manifest,
101
+ * it will be launched into the platform.
102
+ * @param {string} manifestUrl - The URL of platform's manifest.
103
+ * @param {RvmLaunchOptions} [opts] - Parameters that the RVM will use.
104
+ * @return {Promise.<Platform>}
105
+ * @tutorial Platform.startFromManifest
106
+ * @static
107
+ */
108
+ startFromManifest(manifestUrl: string, opts?: OpenFin.RvmLaunchOptions): Promise<OpenFin.Platform>;
109
+ }
@@ -0,0 +1,188 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /* eslint-disable no-undef, no-underscore-dangle */
4
+ const base_1 = require("../base");
5
+ const index_1 = require("./layout/index");
6
+ const Instance_1 = require("./Instance");
7
+ /**
8
+ * InitPlatformOptions interface
9
+ * @typedef { object } InitPlatformOptions
10
+ * @property { OverrideCallback } [overrideCallback] a callback function that can be used to extend or replace default Provider behavior.
11
+ */
12
+ /**
13
+ * @typedef { same | different } ProcessAffinityStrategy
14
+ * @summary Strategy to place views that share a domain into different process affinities or the same process affinity.
15
+ * @property { string } same views in the same domain will have the same process affinity.
16
+ * @property { string } different views in the same domain will have different process affinities.
17
+ */
18
+ /**
19
+ * @typedef { object } PlatformOptions
20
+ * @summary The options object required by {@link Platform#start Platform.start}
21
+ * Any {@link ApplicationOption Application option} is also a valid platform option
22
+ * @property {Array.<Object>} [commands] Configuration for keyboard commands.
23
+ * For details and usage, see [Using Keyboard Commands]{@link https://developers.openfin.co/docs/platform-api#section-5-3-using-keyboard-commands}.
24
+ * @property {DefaultWindowOptions} [defaultWindowOptions] Default window options apply to all platform windows.
25
+ * @property {View~options} [defaultViewOptions] Default view options apply to all platform views.
26
+ * @property {ProcessAffinityStrategy} [viewProcessAffinityStrategy] 'same' | 'different'.
27
+ */
28
+ /**
29
+ * @typedef { object } DefaultWindowOptions
30
+ * @summary Default window options apply to all platform windows.
31
+ * Any {@link Window~options Window option} is also a valid Default Window option
32
+ * used by default in any window that is created in the current platform's scope.
33
+ * Individual window options will override these defaults.
34
+ * @property {string} [stylesheetUrl]
35
+ * Specify a path of a custom CSS file to be injected to all of the platform's windows.
36
+ * _note_: this option is only applied to windows that use the Default OpenFin Window.
37
+ * Windows with a specified url (Custom Windows) will not be affected by this option.
38
+ */
39
+ /**
40
+ * Snapshot interface
41
+ * @typedef { object } Snapshot
42
+ * @property { WindowOption[] } windows The array of window options objects
43
+ */
44
+ /**
45
+ * @lends Platform
46
+ */
47
+ class PlatformModule extends base_1.Base {
48
+ constructor(wire, channel) {
49
+ super(wire);
50
+ this._channel = channel;
51
+ this._initializer = (...args) => this.wire.environment
52
+ .getProviderInitializer()
53
+ .then((initConstructor) => initConstructor(this.wire.environment)(...args));
54
+ /**
55
+ * @namespace
56
+ * @desc Layouts give app providers the ability to embed multiple views in a single window. The Layout namespace
57
+ * enables the initialization and manipulation of a window's Layout. A Layout will
58
+ * <a href="tutorial-Layout.DOMEvents.html">emit events locally</a> on the DOM element representing the layout-container.
59
+ */
60
+ this.Layout = new index_1.LayoutModule(this.wire);
61
+ }
62
+ /**
63
+ * Initializes a Platform. Must be called from the Provider when using a custom provider.
64
+ * @param { InitPlatformOptions } [options] - platform options including a callback function that can be used to extend or replace
65
+ * default Provider behavior.
66
+ * @return {Promise.<void>}
67
+ * @tutorial Platform.init
68
+ * @experimental
69
+ * @static
70
+ */
71
+ async init(options) {
72
+ const overrideCallback = options === null || options === void 0 ? void 0 : options.overrideCallback;
73
+ const interopBroker = await this.fin.Interop.init(this.fin.me.uuid, options === null || options === void 0 ? void 0 : options.interopOverride);
74
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
75
+ // @ts-ignore debugging purposes
76
+ window.interopBroker = interopBroker;
77
+ return this._initializer(overrideCallback, interopBroker);
78
+ }
79
+ /**
80
+ * Asynchronously returns a Platform object that represents an existing platform.
81
+ * @param { Identity } identity
82
+ * @return {Promise.<Platform>}
83
+ * @tutorial Platform.wrap
84
+ * @static
85
+ */
86
+ async wrap(identity) {
87
+ this.wire.sendAction('platform-wrap').catch((e) => {
88
+ // don't expose
89
+ });
90
+ return new Instance_1.Platform({ uuid: identity.uuid }, this._channel);
91
+ }
92
+ /**
93
+ * Synchronously returns a Platform object that represents an existing platform.
94
+ * @param { Identity } identity
95
+ * @return {Platform}
96
+ * @tutorial Platform.wrapSync
97
+ * @static
98
+ */
99
+ wrapSync(identity) {
100
+ this.wire.sendAction('platform-wrap-sync').catch((e) => {
101
+ // don't expose
102
+ });
103
+ return new Instance_1.Platform({ uuid: identity.uuid }, this._channel);
104
+ }
105
+ /**
106
+ * Asynchronously returns a Platform object that represents the current platform.
107
+ * @return {Promise.<Platform>}
108
+ * @tutorial Platform.getCurrent
109
+ * @static
110
+ */
111
+ async getCurrent() {
112
+ this.wire.sendAction('platform-get-current').catch((e) => {
113
+ // don't expose
114
+ });
115
+ return this.wrap({ uuid: this.wire.me.uuid });
116
+ }
117
+ /**
118
+ * Synchronously returns a Platform object that represents the current platform.
119
+ * @return {Platform}
120
+ * @tutorial Platform.getCurrentSync
121
+ * @static
122
+ */
123
+ getCurrentSync() {
124
+ this.wire.sendAction('platform-get-current-sync').catch((e) => {
125
+ // don't expose
126
+ });
127
+ return this.wrapSync({ uuid: this.wire.me.uuid });
128
+ }
129
+ /**
130
+ * Creates and starts a Platform and returns a wrapped and running Platform instance. The wrapped Platform methods can
131
+ * be used to launch content into the platform. Promise will reject if the platform is already running.
132
+ * @param { PlatformOptions } platformOptions
133
+ * @return {Promise.<Platform>}
134
+ * @tutorial Platform.start
135
+ * @static
136
+ */
137
+ start(platformOptions) {
138
+ this.wire.sendAction('platform-start').catch((e) => {
139
+ // don't expose
140
+ });
141
+ // eslint-disable-next-line no-async-promise-executor
142
+ return new Promise(async (resolve, reject) => {
143
+ try {
144
+ const { uuid } = platformOptions;
145
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
146
+ // @ts-ignore using private variable.
147
+ const app = await this.fin.Application._create({ ...platformOptions, isPlatformController: true });
148
+ app.once('platform-api-ready', () => resolve(this.wrapSync({ uuid })));
149
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
150
+ // @ts-ignore using private variable.
151
+ app._run({ uuid });
152
+ }
153
+ catch (e) {
154
+ reject(e);
155
+ }
156
+ });
157
+ }
158
+ /**
159
+ * Retrieves platforms's manifest and returns a wrapped and running Platform. If there is a snapshot in the manifest,
160
+ * it will be launched into the platform.
161
+ * @param {string} manifestUrl - The URL of platform's manifest.
162
+ * @param {RvmLaunchOptions} [opts] - Parameters that the RVM will use.
163
+ * @return {Promise.<Platform>}
164
+ * @tutorial Platform.startFromManifest
165
+ * @static
166
+ */
167
+ startFromManifest(manifestUrl, opts) {
168
+ this.wire.sendAction('platform-start-from-manifest').catch((e) => {
169
+ // don't expose
170
+ });
171
+ // eslint-disable-next-line no-async-promise-executor
172
+ return new Promise(async (resolve, reject) => {
173
+ try {
174
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
175
+ // @ts-ignore using private variable.
176
+ const app = await this.fin.Application._createFromManifest(manifestUrl);
177
+ app.once('platform-api-ready', () => resolve(this.wrapSync({ uuid: app.identity.uuid })));
178
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
179
+ // @ts-ignore using private method without warning.
180
+ app._run(opts);
181
+ }
182
+ catch (e) {
183
+ reject(e);
184
+ }
185
+ });
186
+ }
187
+ }
188
+ exports.default = PlatformModule;
@@ -0,0 +1,122 @@
1
+ import { View } from '../view';
2
+ import { EmitterBase } from '../base';
3
+ import { Channel } from '../interappbus/channel/index';
4
+ import ChannelClient from '../interappbus/channel/client';
5
+ import { LayoutModule } from './layout';
6
+ import { PlatformEvents } from '../events/platform';
7
+ /** Manages the life cycle of windows and views in the application.
8
+ *
9
+ * Enables taking snapshots of itself and applying them to restore a previous configuration
10
+ * as well as listen to <a href="tutorial-Platform.EventEmitter.html">platform events</a>.
11
+ * @namespace
12
+ */
13
+ export declare class Platform extends EmitterBase<PlatformEvents> {
14
+ #private;
15
+ Layout: LayoutModule;
16
+ private _channel;
17
+ Application: OpenFin.Application;
18
+ identity: OpenFin.ApplicationIdentity;
19
+ constructor(identity: OpenFin.ApplicationIdentity, channel: Channel);
20
+ getClient: (identity?: OpenFin.ApplicationIdentity) => Promise<ChannelClient>;
21
+ /**
22
+ * Creates a new view and attaches it to a specified target window.
23
+ * @param { View~options } viewOptions View creation options
24
+ * @param { Identity } [target] The window to which the new view is to be attached. If no target, create a view in a new window.
25
+ * @param { Identity } [targetView] If provided, the new view will be added to the same tabstrip as targetView.
26
+ * @return { Promise<View> }
27
+ * @tutorial Platform.createView
28
+ */
29
+ createView(viewOptions: OpenFin.PlatformViewCreationOptions, target?: OpenFin.Identity, targetView?: OpenFin.Identity): Promise<View>;
30
+ /**
31
+ * Creates a new Window.
32
+ * @param { Window~options } options Window creation options
33
+ * @return { Promise<_Window> }
34
+ * @tutorial Platform.createWindow
35
+ */
36
+ createWindow(options: OpenFin.PlatformWindowCreationOptions): Promise<OpenFin.Window & OpenFin.Identity>;
37
+ /**
38
+ * Closes current platform, all its windows, and their views.
39
+ * @return { Promise<void> }
40
+ * @tutorial Platform.quit
41
+ */
42
+ quit(): Promise<void>;
43
+ /**
44
+ * Closes a specified view in a target window.
45
+ * @param { Identity } viewIdentity View identity
46
+ * @return { Promise<void> }
47
+ * @tutorial Platform.closeView
48
+ */
49
+ closeView(viewIdentity: OpenFin.Identity): Promise<void>;
50
+ /**
51
+ * ***DEPRECATED - please use Platform.createView.***
52
+ * Reparents a specified view in a new target window.
53
+ * @param { Identity } viewIdentity View identity
54
+ * @param { Identity } target new owner window identity
55
+ * @return { Promise<View> }
56
+ * @tutorial Platform.createView
57
+ */
58
+ reparentView(viewIdentity: OpenFin.Identity, target: OpenFin.Identity): Promise<View>;
59
+ /**
60
+ * Returns a snapshot of the platform in its current state.
61
+ *
62
+ * Can be used to restore an application to a previous state.
63
+ * @return { Promise<Snapshot> }
64
+ * @tutorial Platform.getSnapshot
65
+ */
66
+ getSnapshot(): Promise<OpenFin.Snapshot>;
67
+ /**
68
+ * Adds a snapshot to a running Platform.
69
+ * Requested snapshot must be a valid Snapshot object, or a url or filepath to such an object.
70
+ *
71
+ * Can optionally close existing windows and overwrite current platform state with that of a snapshot.
72
+ *
73
+ * The function accepts either a snapshot taken using {@link Platform#getSnapshot getSnapshot},
74
+ * or a url or filepath to a snapshot JSON object.
75
+ * @param { Snapshot | string } requestedSnapshot Snapshot to apply, or a url or filepath.
76
+ * @param { ApplySnapshotOptions } [options] Optional parameters to specify whether existing windows should be closed.
77
+ * @return { Promise<Platform> }
78
+ * @tutorial Platform.applySnapshot
79
+ */
80
+ applySnapshot(requestedSnapshot: OpenFin.Snapshot | string, options?: OpenFin.ApplySnapshotOptions): Promise<Platform>;
81
+ /**
82
+ * Fetches a JSON manifest using the browser process and returns a Javascript object.
83
+ * Can be overwritten using {@link Platform#init Platform.init}.
84
+ * @param { string } manifestUrl The URL of the manifest to fetch.
85
+ * @return { Promise<any> }
86
+ * @tutorial Platform.fetchManifest
87
+ */
88
+ fetchManifest(manifestUrl: string): Promise<any>;
89
+ launchLegacyManifest: (manifestUrl: string) => Promise<Platform>;
90
+ /**
91
+ * Retrieves a manifest by url and launches a legacy application manifest or snapshot into the platform. Returns a promise that
92
+ * resolves to the wrapped Platform.
93
+ * @param {string} manifestUrl - The URL of the manifest that will be launched into the platform. If this app manifest
94
+ * contains a snapshot, that will be launched into the platform. If not, the application described in startup_app options
95
+ * will be launched into the platform. The applicable startup_app options will become {@link View~options View Options}.
96
+ * @return {Promise<Platform>}
97
+ * @tutorial Platform.launchContentManifest
98
+ * @experimental
99
+ */
100
+ launchContentManifest(manifestUrl: string): Promise<Platform>;
101
+ /**
102
+ * Set the context of a host window. The context will be available to the window itself, and to its child Views. It will be saved in any platform snapshots.
103
+ * It can be retrieved using {@link Platform#getWindowContext getWindowContext}.
104
+ * @param {any} context - A field where serializable context data can be stored to be saved in platform snapshots.
105
+ * @param {Identity} [target] - A target window or view may optionally be provided. If no target is provided, the update will be applied
106
+ * to the current window (if called from a Window) or the current host window (if called from a View).
107
+ * @return {Promise<void>}
108
+ * @tutorial Platform.setWindowContext
109
+ * @experimental
110
+ */
111
+ setWindowContext(context?: any, target?: OpenFin.Identity): Promise<void>;
112
+ /**
113
+ * Get the context context of a host window that was previously set using {@link Platform#setWindowContext setWindowContext}.
114
+ * The context will be saved in any platform snapshots. Returns a promise that resolves to the context.
115
+ * @param {Identity} [target] - A target window or view may optionally be provided. If no target is provided, target will be
116
+ * the current window (if called from a Window) or the current host window (if called from a View).
117
+ * @return {Promise<any>}
118
+ * @tutorial Platform.getWindowContext
119
+ * @experimental
120
+ */
121
+ getWindowContext(target?: OpenFin.Identity): Promise<any>;
122
+ }