diff --git a/types/openfin/_v2/api/application/application.d.ts b/types/openfin/_v2/api/application/application.d.ts index 616501834d..37263a9a63 100644 --- a/types/openfin/_v2/api/application/application.d.ts +++ b/types/openfin/_v2/api/application/application.d.ts @@ -1,10 +1,12 @@ -import { EmitterBase, Base, Reply, RuntimeEvent } from '../base'; +import { EmitterBase, Base, Reply } from '../base'; import { Identity } from '../../identity'; import { _Window } from '../window/window'; import { Point } from '../system/point'; import { MonitorInfo } from '../system/monitor'; import Transport from '../../transport/transport'; import Bounds from '../window/bounds'; +import { ApplicationEvents } from '../events/application'; +import { ApplicationOption } from './applicationOption'; export interface TrayIconClickReply extends Point, Reply<'application', 'tray-icon-clicked'> { button: number; monitorInfo: MonitorInfo; @@ -21,7 +23,7 @@ export declare class NavigationRejectedReply extends Reply<'window-navigation-re sourceName: string; url: string; } -export interface ConfigInterface { +export interface ShortCutConfig { desktop?: boolean; startMenu?: boolean; systemStartup?: boolean; @@ -32,32 +34,54 @@ export interface TrayInfo { x: number; y: number; } +/** + * @lends Application + */ export default class ApplicationModule extends Base { /** - * Returns an Application object that represents an existing application. - * @param { Identity } indentity + * Asynchronously returns an Application object that represents an existing application. + * @param { Identity } identity * @return {Promise.} * @tutorial Application.wrap + * @static */ wrap(identity: Identity): Promise; + /** + * Synchronously returns an Application object that represents an existing application. + * @param { Identity } identity + * @return {Application} + * @tutorial Application.wrapSync + * @static + */ + wrapSync(identity: Identity): Application; /** * Creates a new Application. - * @param {*} appOptions + * @param { ApplicationOption } appOptions * @return {Promise.} * @tutorial Application.create + * @static */ - create(appOptions: any): Promise; + create(appOptions: ApplicationOption): Promise; /** - * Returns an Application object that represents the current application + * Asynchronously returns an Application object that represents the current application * @return {Promise.} * @tutorial Application.getCurrent + * @static */ getCurrent(): Promise; + /** + * Synchronously returns an Application object that represents the current application + * @return {Application} + * @tutorial Application.getCurrentSync + * @static + */ + getCurrentSync(): Application; /** * Retrieves application's manifest and returns a wrapped application. * @param {string} manifestUrl - The URL of app's manifest. * @return {Promise.} * @tutorial Application.createFromManifest + * @static */ createFromManifest(manifestUrl: string): Promise; } @@ -66,12 +90,11 @@ export default class ApplicationModule extends Base { * execute, show/close an application as well as listen to application events. * @class */ -export declare class Application extends EmitterBase { +export declare class Application extends EmitterBase { identity: Identity; _manifestUrl?: string; private window; constructor(wire: Transport, identity: Identity); - protected runtimeEventComparator: (listener: RuntimeEvent) => boolean; private windowListFromIdentityList; /** * Determines if the application is currently running. @@ -116,10 +139,16 @@ export declare class Application extends EmitterBase { getParentUuid(): Promise; /** * Retrieves current application's shortcut configuration. - * @return {Promise.} + * @return {Promise.} * @tutorial Application.getShortcuts */ - getShortcuts(): Promise; + getShortcuts(): Promise; + /** + * Returns the current zoom level of the application. + * @return {Promise.} + * @tutorial Application.getZoomLevel + */ + getZoomLevel(): Promise; /** * Returns an instance of the main Window of the application * @return {Promise.<_Window>} @@ -174,7 +203,15 @@ export declare class Application extends EmitterBase { * @return {Promise.} * @tutorial Application.setShortcuts */ - setShortcuts(config: ConfigInterface): Promise; + setShortcuts(config: ShortCutConfig): Promise; + /** + * Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20% + * larger or smaller to default limits of 300% and 50% of original size, respectively. + * @param { number } level The zoom level + * @return {Promise.} + * @tutorial Application.setZoomLevel + */ + setZoomLevel(level: number): Promise; /** * @summary Retrieves information about the system tray. * @desc The only information currently returned is the position and dimensions. @@ -203,21 +240,3 @@ export declare class Application extends EmitterBase { */ getInfo(): Promise; } -export interface Application { - on(type: 'closed', listener: (data: Reply<'application', 'closed'>) => void): Promise; - on(type: 'initialized', listener: (data: Reply<'application', 'initialized'>) => void): Promise; - on(type: 'connected', listener: (data: Reply<'application', 'connected'>) => void): Promise; - on(type: 'crashed', listener: (data: Reply<'application', 'crashed'>) => void): Promise; - on(type: 'error', listener: (data: Reply<'application', 'error'>) => void): Promise; - on(type: 'not-responding', listener: (data: Reply<'application', 'not-responding'>) => void): Promise; - on(type: 'out-of-memory', listener: (data: Reply<'application', 'out-of-memory'>) => void): Promise; - on(type: 'responding', listener: (data: Reply<'application', 'responding'>) => void): Promise; - on(type: 'started', listener: (data: Reply<'application', 'started'>) => void): Promise; - on(type: 'run-requested', listener: (data: Reply<'application', 'run-requested'>) => void): Promise; - on(type: 'window-navigation-rejected', listener: (data: NavigationRejectedReply) => void): Promise; - on(type: 'window-created', listener: (data: Reply<'application', 'window-created'>) => void): Promise; - on(type: 'window-closed', listener: (data: Reply<'application', 'window-closed'>) => void): Promise; - on(type: 'tray-icon-clicked', listener: (data: TrayIconClickReply) => void): Promise; - on(type: 'removeListener', listener: (eventType: string) => void): Promise; - on(type: 'newListener', listener: (eventType: string) => void): Promise; -} diff --git a/types/openfin/_v2/api/application/applicationOption.d.ts b/types/openfin/_v2/api/application/applicationOption.d.ts new file mode 100644 index 0000000000..134e4482d6 --- /dev/null +++ b/types/openfin/_v2/api/application/applicationOption.d.ts @@ -0,0 +1,50 @@ +import { WindowOption, CustomRequestHeaders } from '../window/windowOption'; +import { DownloadPreloadOption } from '../system/download-preload'; +export interface ApplicationOption { + disableIabSecureLogging?: boolean; + loadErrorMessage?: string; + mainWindowOptions?: WindowOption; + name?: string; + nonPersistent?: boolean; + plugins?: boolean; + spellCheck?: boolean; + url?: string; + uuid: string; + webSecurity?: boolean; + accelerator?: object; + alwaysOnTop?: boolean; + api?: object; + aspectRatio?: number; + autoShow?: boolean; + backgroundColor?: string; + contentNavigation?: object; + contextMenu?: boolean; + cornerRounding?: object; + customData?: string; + customRequestHeaders?: Array; + defaultCentered?: boolean; + defaultHeight?: number; + defaultLeft?: number; + defaultTop?: number; + defaultWidth?: number; + frame?: boolean; + hideOnClose?: boolean; + icon?: string; + maxHeight?: number; + maximizable?: boolean; + maxWidth?: number; + minHeight?: number; + minimizable?: boolean; + minWidth?: number; + opacity?: number; + preloadScripts?: Array; + resizable?: boolean; + resizeRegion?: object; + saveWindowState?: boolean; + shadow?: boolean; + showTaskbarIcon?: boolean; + smallWindow?: boolean; + state?: string; + taskbarIconGroup?: string; + waitForPageLoad?: boolean; +} diff --git a/types/openfin/_v2/api/base.d.ts b/types/openfin/_v2/api/base.d.ts index 1f17e1f24f..5cbb8658a7 100644 --- a/types/openfin/_v2/api/base.d.ts +++ b/types/openfin/_v2/api/base.d.ts @@ -1,10 +1,11 @@ /// -import Transport, { Message } from '../transport/transport'; +import Transport from '../transport/transport'; import { Identity } from '../identity'; import { EventEmitter } from 'events'; -export interface RuntimeEvent extends Identity { - topic: string; - type: string | symbol; +import { EmitterAccessor } from './events/emitterMap'; +import { BaseEventMap } from './events/base'; +interface SubOptions { + timestamp?: number; } export declare class Base { wire: Transport; @@ -14,26 +15,27 @@ export declare class Base { readonly me: Identity; protected isNodeEnvironment: () => boolean; protected isOpenFinEnvironment: () => boolean; - protected runtimeEventComparator: (listener: RuntimeEvent) => boolean; } -export declare class EmitterBase extends Base { +export declare class EmitterBase extends Base { + private emitterAccessor; protected identity: Identity; - protected emitter: EventEmitter; - listeners: (event: string | symbol) => Function[]; + constructor(wire: Transport, emitterAccessor: EmitterAccessor); + eventNames: () => (string | symbol)[]; + emit: >(eventName: E, payload: E extends Extract ? EventTypes[E] : any, ...args: any[]) => boolean; + private hasEmitter; + private getEmitter; + listeners: (type: string | symbol) => Function[]; listenerCount: (type: string | symbol) => number; - constructor(wire: Transport); - emit: (eventName: string | symbol, ...args: any[]) => void; - protected onmessage: (message: Message) => boolean; - protected registerEventListener: (listener: RuntimeEvent) => Promise>; - protected deregisterEventListener: (listener: RuntimeEvent) => Promise>; - on(eventType: string, listener: (...args: any[]) => void): Promise; - addListener: (eventType: string, listener: (...args: any[]) => void) => Promise; - once(eventType: string, listener: (...args: any[]) => void): Promise; - prependListener(eventType: string, listener: (...args: any[]) => void): Promise; - prependOnceListener(eventType: string, listener: (...args: any[]) => void): Promise; - removeListener(eventType: string, listener: (...args: any[]) => void): Promise; - protected deregisterAllListeners: (eventType: string | symbol) => Promise>; - removeAllListeners(eventType?: string): Promise; + protected registerEventListener: (eventType: string | symbol | Extract, options?: SubOptions) => Promise; + protected deregisterEventListener: (eventType: string | symbol | Extract, options?: SubOptions) => Promise; + on | string | symbol>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions): Promise; + addListener: >(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions) => Promise; + once | string | symbol>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions): Promise; + prependListener | string | symbol>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions): Promise; + prependOnceListener | string | symbol>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions): Promise; + removeListener | string | symbol>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions): Promise; + protected deregisterAllListeners: (eventType: string | symbol | Extract) => Promise; + removeAllListeners(eventType?: Extract | string | symbol): Promise; } export declare class Reply implements Identity { topic: TOPIC; @@ -41,3 +43,4 @@ export declare class Reply imp uuid: string; name?: string; } +export {}; diff --git a/types/openfin/_v2/api/events/application.d.ts b/types/openfin/_v2/api/events/application.d.ts new file mode 100644 index 0000000000..444d358cbd --- /dev/null +++ b/types/openfin/_v2/api/events/application.d.ts @@ -0,0 +1,56 @@ +import { WindowEvent, BaseEventMap, ApplicationEvent } from './base'; +import { WindowAlertRequestedEvent, WindowAuthRequestedEvent, WindowEndLoadEvent, PropagatedWindowEvents } from './window'; +export interface CrashedEvent { + reason: 'normal-termination' | 'abnormal-termination' | 'killed' | 'crashed' | 'still-running' | 'launch-failed' | 'out-of-memory'; +} +export interface RunRequestedEvent extends ApplicationEvent { + userAppConfigArgs: any; +} +export interface TrayIconClicked extends ApplicationEvent { + button: 0 | 1 | 2; + x: number; + y: number; + monitorInfo: any; +} +export interface ApplicationEventMapping extends BaseEventMap { + 'closed': ApplicationEvent; + 'connected': ApplicationEvent; + 'crashed': CrashedEvent & ApplicationEvent; + 'initialized': ApplicationEvent; + 'manifest-changed': ApplicationEvent; + 'not-responding': ApplicationEvent; + 'responding': ApplicationEvent; + 'run-requested': RunRequestedEvent; + 'started': ApplicationEvent; + 'tray-icon-clicked': TrayIconClicked; + 'window-alert-requested': WindowAlertRequestedEvent; + 'window-auth-requested': WindowAuthRequestedEvent; + 'window-created': WindowEvent; + 'window-end-load': WindowEndLoadEvent; + 'window-not-responding': WindowEvent; + 'window-responding': WindowEvent; + 'window-show-requested': WindowEvent; + 'window-start-load': WindowEvent; +} +export interface PropagatedApplicationEventMapping { + 'application-closed': ApplicationEvent; + 'application-connected': ApplicationEvent; + 'application-crashed': CrashedEvent & ApplicationEvent; + 'application-initialized': ApplicationEvent; + 'application-manifest-changed': ApplicationEvent; + 'application-not-responding': ApplicationEvent; + 'application-responding': ApplicationEvent; + 'application-started': ApplicationEvent; + 'application-tray-icon-clicked': TrayIconClicked; + 'window-created': WindowEvent; + 'window-end-load': WindowEndLoadEvent; + 'window-not-responding': WindowEvent; + 'window-responding': WindowEvent; + 'window-start-load': WindowEvent; +} +export declare type ApplicationEvents = PropagatedWindowEvents<'application'> & { + [Type in keyof ApplicationEventMapping]: ApplicationEventMapping<'application', Type>[Type]; +}; +export declare type PropagatedApplicationEvents = { + [Type in keyof PropagatedApplicationEventMapping]: PropagatedApplicationEventMapping[Type]; +}; diff --git a/types/openfin/_v2/api/events/base.d.ts b/types/openfin/_v2/api/events/base.d.ts new file mode 100644 index 0000000000..700f82679b --- /dev/null +++ b/types/openfin/_v2/api/events/base.d.ts @@ -0,0 +1,18 @@ +import { FrameEvent } from './frame'; +export declare type RuntimeEvent = Topic extends 'window' ? WindowEvent : Topic extends 'frame' ? FrameEvent : Topic extends 'application' ? ApplicationEvent : BaseEvent; +export interface BaseEvent { + topic: Topic; + type: Type; +} +export interface ApplicationEvent extends BaseEvent { + uuid: string; +} +export interface WindowEvent extends ApplicationEvent { + name: string; +} +export declare function getTopic(e: RuntimeEvent): string; +export interface BaseEventMap { + [name: string]: any; + 'newListener': string; + 'listenerRemoved': string; +} diff --git a/types/openfin/_v2/api/events/channel.d.ts b/types/openfin/_v2/api/events/channel.d.ts new file mode 100644 index 0000000000..3c448071cb --- /dev/null +++ b/types/openfin/_v2/api/events/channel.d.ts @@ -0,0 +1,10 @@ +import { BaseEventMap, ApplicationEvent } from './base'; +export interface ChannelEvent extends ApplicationEvent<'channel', Type> { + channelName: string; + channelId: string; + name?: string; +} +export interface ChannelEvents extends BaseEventMap { + 'connected': ChannelEvent<'connected'>; + 'disconnected': ChannelEvent<'disconnected'>; +} diff --git a/types/openfin/_v2/api/events/emitterMap.d.ts b/types/openfin/_v2/api/events/emitterMap.d.ts new file mode 100644 index 0000000000..aa3fb498e8 --- /dev/null +++ b/types/openfin/_v2/api/events/emitterMap.d.ts @@ -0,0 +1,15 @@ +/// +import { EventEmitter } from 'events'; +export declare class EmitterMap { + private storage; + constructor(); + private hashKeys; + get(keys: EmitterAccessor): EventEmitter; + has(keys: EmitterAccessor): boolean; + delete(keys: EmitterAccessor): boolean; +} +export declare type SystemEmitterAccessor = ['system']; +export declare type ApplicationEmitterAccessor = ['application', string]; +export declare type WindowEmitterAccessor = ['window', string, string]; +export declare type HotkeyEmitterAccessor = ['global-hotkey']; +export declare type EmitterAccessor = SystemEmitterAccessor | ApplicationEmitterAccessor | WindowEmitterAccessor | HotkeyEmitterAccessor | string[]; diff --git a/types/openfin/_v2/api/events/eventAggregator.d.ts b/types/openfin/_v2/api/events/eventAggregator.d.ts new file mode 100644 index 0000000000..ac7b7ca1b2 --- /dev/null +++ b/types/openfin/_v2/api/events/eventAggregator.d.ts @@ -0,0 +1,5 @@ +import { Message } from '../../transport/transport'; +import { EmitterMap } from './emitterMap'; +export declare class EventAggregator extends EmitterMap { + dispatchEvent: (message: Message) => boolean; +} diff --git a/types/openfin/_v2/api/events/externalApplication.d.ts b/types/openfin/_v2/api/events/externalApplication.d.ts new file mode 100644 index 0000000000..f7cd85f45d --- /dev/null +++ b/types/openfin/_v2/api/events/externalApplication.d.ts @@ -0,0 +1,5 @@ +import { RuntimeEvent, BaseEventMap } from './base'; +export interface ExternalApplicationEvents extends BaseEventMap { + connected: RuntimeEvent<'externalapplication', 'connected'>; + disconnected: RuntimeEvent<'externalapplication', 'disconnected'>; +} diff --git a/types/openfin/_v2/api/events/frame.d.ts b/types/openfin/_v2/api/events/frame.d.ts new file mode 100644 index 0000000000..c31933e557 --- /dev/null +++ b/types/openfin/_v2/api/events/frame.d.ts @@ -0,0 +1,9 @@ +import { BaseEventMap, WindowEvent } from './base'; +export interface FrameEvent extends WindowEvent<'frame', Type> { + entityType: 'iframe'; + frameName: string; +} +export interface FrameEvents extends BaseEventMap { + connected: FrameEvent<'connected'>; + disconnected: FrameEvent<'disconnected'>; +} diff --git a/types/openfin/_v2/api/events/globalHotkey.d.ts b/types/openfin/_v2/api/events/globalHotkey.d.ts new file mode 100644 index 0000000000..561baba446 --- /dev/null +++ b/types/openfin/_v2/api/events/globalHotkey.d.ts @@ -0,0 +1,11 @@ +import { RuntimeEvent, BaseEventMap } from './base'; +import { Identity } from '../../identity'; +import { nonHotkeyEvents } from '../global-hotkey'; +export interface GlobalHotkeyEvent extends RuntimeEvent<'global-hotkey', Type> { + identity: Identity; + hotkey: string; +} +export interface GlobalHotkeyEvents extends BaseEventMap { + [nonHotkeyEvents.REGISTERED]: GlobalHotkeyEvent; + [nonHotkeyEvents.UNREGISTERED]: GlobalHotkeyEvent; +} diff --git a/types/openfin/_v2/api/events/notifications.d.ts b/types/openfin/_v2/api/events/notifications.d.ts new file mode 100644 index 0000000000..a269817222 --- /dev/null +++ b/types/openfin/_v2/api/events/notifications.d.ts @@ -0,0 +1,8 @@ +import { RuntimeEvent, BaseEventMap } from './base'; +export interface NotificationEvents extends BaseEventMap { + show: RuntimeEvent<'notification', 'show'>; + close: RuntimeEvent<'notification', 'close'>; + error: RuntimeEvent<'notification', 'error'>; + click: RuntimeEvent<'notification', 'click'>; + message: RuntimeEvent<'notification', 'message'>; +} diff --git a/types/openfin/_v2/api/events/system.d.ts b/types/openfin/_v2/api/events/system.d.ts new file mode 100644 index 0000000000..20285a8862 --- /dev/null +++ b/types/openfin/_v2/api/events/system.d.ts @@ -0,0 +1,22 @@ +import { BaseEvent, ApplicationEvent, BaseEventMap } from './base'; +import { MonitorInfo } from '../system/monitor'; +import { PropagatedWindowEvents } from './window'; +import { PropagatedApplicationEvents } from './application'; +export interface IdleEvent extends BaseEvent { + elapsedTime: number; + isIdle: boolean; +} +export declare type MonitorEvent = MonitorInfo & BaseEvent; +export interface SessionChangedEvent extends BaseEvent { + reason: 'lock' | 'unlock' | 'remote-connect' | 'remote-disconnect' | 'unknown'; +} +export interface SystemEventMapping extends BaseEventMap { + 'application-created': ApplicationEvent; + 'desktop-icon-clicked': ApplicationEvent; + 'idle-state-changed': IdleEvent; + 'monitor-info-changed': MonitorEvent; + 'session-changed': SessionChangedEvent; +} +export declare type SystemEvents = PropagatedWindowEvents<'system'> & PropagatedApplicationEvents<'system'> & { + [Type in keyof SystemEventMapping]: SystemEventMapping<'system', Type>[Type]; +}; diff --git a/types/openfin/_v2/api/events/window.d.ts b/types/openfin/_v2/api/events/window.d.ts new file mode 100644 index 0000000000..85d4d553f0 --- /dev/null +++ b/types/openfin/_v2/api/events/window.d.ts @@ -0,0 +1,176 @@ +import { CrashedEvent } from './application'; +import { WindowEvent, BaseEventMap } from './base'; +export declare type SpecificWindowEvent = WindowEvent<'window', Type>; +export interface WindowAlertRequestedEvent extends WindowEvent { + message: string; + url: string; +} +export interface WindowAuthRequestedEvent extends WindowEvent { + authInfo: { + host: string; + isProxy: boolean; + port: number; + realm: string; + scheme: string; + }; +} +export interface WindowEndLoadEvent extends WindowEvent { + documentName: string; + isMain: boolean; +} +export interface WindowNavigationRejectedEvent extends WindowEvent { + sourceName: string; + url: string; +} +export interface WindowReloadedEvent extends WindowEvent { + url: string; +} +export interface WindowExternalProcessExitedEvent extends WindowEvent { + processUuid: string; + exitCode: number; +} +export interface WindowExternalProcessStartedEvent extends WindowEvent { + processUuid: string; +} +export interface WindowHiddenEvent extends WindowEvent { + reason: 'closing' | 'hide' | 'hide-on-close'; +} +export interface PreloadScriptInfoRunning { + state: 'load-started' | // started loading preload script + 'load-failed' | // preload script failed to load + 'load-succeeded' | // preload script is loaded and ready to be eval'ed + 'failed' | // preload script failed to eval + 'succeeded'; +} +export interface PreloadScriptInfo { + state: 'load-failed' | // preload script failed to load + 'failed' | // preload script failed to eval + 'succeeded'; +} +export interface WindowPreloadScriptsStateChangeEvent extends WindowEvent { + preloadScripts: (PreloadScriptInfoRunning & any)[]; +} +export interface WindowPreloadScriptsStateChangedEvent extends WindowEvent { + preloadScripts: (PreloadScriptInfoRunning & any)[]; +} +export interface WindowPreloadScriptsStateChangedEvent extends WindowEvent { + preloadScripts: (PreloadScriptInfo & any)[]; +} +export interface WindowResourceLoadFailedEvent extends WindowEvent { + errorCode: number; + errorDescription: string; + validatedURL: string; + isMainFrame: boolean; +} +export interface WindowResourceResponseReceivedEvent extends WindowEvent { + status: boolean; + newUrl: string; + originalUrl: string; + httpResponseCode: number; + requestMethod: string; + referrer: string; + headers: any; + resourceType: 'mainFrame' | 'subFrame' | 'styleSheet' | 'script' | 'image' | 'object' | 'xhr' | 'other'; +} +export interface WindowBeginBoundsChangingEvent extends WindowEvent { + height: number; + left: number; + top: number; + width: number; + windowState: 'minimized' | 'normal' | 'maximized'; +} +export interface WindowBoundsChange extends WindowEvent { + changeType: 0 | 1 | 2; + deferred: boolean; + height: number; + left: number; + top: number; + width: number; +} +export interface WindowGroupChanged extends WindowEvent { + memberOf: 'source' | 'target' | 'nothing'; + reason: 'leave' | 'join' | 'merge' | 'disband'; + sourceGroup: { + appUuid: string; + windowName: string; + }[]; + sourceWindowAppUuid: string; + sourceWindowName: string; + targetGroup: { + appUuid: string; + windowName: string; + }[]; + targetWindowAppUuid: string; + targetWindowName: string; +} +export interface WindowEventMapping extends BaseEventMap { + 'auth-requested': WindowAuthRequestedEvent; + 'begin-user-bounds-changing': WindowBeginBoundsChangingEvent; + 'blurred': WindowEvent; + 'bounds-changed': WindowBoundsChange; + 'bounds-changing': WindowBoundsChange; + 'close-requested': WindowEvent; + 'closed': WindowEvent; + 'closing': WindowEvent; + 'crashed': CrashedEvent & WindowEvent; + 'disabled-frame-bounds-changed': WindowBoundsChange; + 'disabled-frame-bounds-changing': WindowBoundsChange; + 'embedded': WindowEvent; + 'end-user-bounds-changing': WindowBeginBoundsChangingEvent; + 'external-process-exited': WindowExternalProcessExitedEvent; + 'external-process-started': WindowExternalProcessStartedEvent; + 'focused': WindowEvent; + 'frame-disabled': WindowEvent; + 'frame-enabled': WindowEvent; + 'group-changed': WindowGroupChanged; + 'hidden': WindowHiddenEvent; + 'initialized': WindowEvent; + 'maximized': WindowEvent; + 'minimized': WindowEvent; + 'navigation-rejected': WindowNavigationRejectedEvent; + 'preload-scripts-state-changed': WindowPreloadScriptsStateChangeEvent; + 'preload-scripts-state-changing': WindowPreloadScriptsStateChangeEvent; + 'resource-load-failed': WindowResourceLoadFailedEvent; + 'resource-response-received': WindowResourceResponseReceivedEvent; + 'reloaded': WindowReloadedEvent; + 'restored': WindowEvent; + 'show-requested': WindowEvent; + 'shown': WindowEvent; +} +export interface PropagatedWindowEventMapping extends BaseEventMap { + 'window-begin-user-bounds-changing': WindowBeginBoundsChangingEvent; + 'window-blurred': WindowEvent; + 'window-bounds-changed': WindowBoundsChange; + 'window-bounds-changing': WindowBoundsChange; + 'window-closed': WindowEvent; + 'window-closing': WindowEvent; + 'window-crashed': CrashedEvent & WindowEvent; + 'window-disabled-frame-bounds-changed': WindowBoundsChange; + 'window-disabled-frame-bounds-changing': WindowBoundsChange; + 'window-embedded': WindowEvent; + 'window-end-user-bounds-changing': WindowBeginBoundsChangingEvent; + 'window-external-process-exited': WindowExternalProcessExitedEvent; + 'window-external-process-started': WindowExternalProcessStartedEvent; + 'window-focused': WindowEvent; + 'window-frame-disabled': WindowEvent; + 'window-frame-enabled': WindowEvent; + 'window-group-changed': WindowGroupChanged; + 'window-hidden': WindowHiddenEvent; + 'window-initialized': WindowEvent; + 'window-maximized': WindowEvent; + 'window-minimized': WindowEvent; + 'window-navigation-rejected': WindowNavigationRejectedEvent; + 'window-preload-scripts-state-changed': WindowPreloadScriptsStateChangeEvent; + 'window-preload-scripts-state-changing': WindowPreloadScriptsStateChangedEvent; + 'window-resource-load-failed': WindowResourceLoadFailedEvent; + 'window-resource-response-received': WindowResourceResponseReceivedEvent; + 'window-reloaded': WindowReloadedEvent; + 'window-restored': WindowEvent; + 'window-shown': WindowEvent; +} +export declare type WindowEvents = { + [Type in keyof WindowEventMapping]: WindowEventMapping<'window', Type>[Type]; +}; +export declare type PropagatedWindowEvents = { + [Type in keyof PropagatedWindowEventMapping]: PropagatedWindowEventMapping[Type]; +}; diff --git a/types/openfin/_v2/api/external-application/external-application.d.ts b/types/openfin/_v2/api/external-application/external-application.d.ts index 2d1f46e0f3..a4f44851e9 100644 --- a/types/openfin/_v2/api/external-application/external-application.d.ts +++ b/types/openfin/_v2/api/external-application/external-application.d.ts @@ -1,16 +1,30 @@ -import { Base, EmitterBase, Reply } from '../base'; +import { Base, EmitterBase } from '../base'; import { Identity } from '../../identity'; import Transport from '../../transport/transport'; +import { ExternalApplicationEvents } from '../events/externalApplication'; export interface ExternalApplicationInfo { parent: Identity; } +/** + * @lends ExternalApplication + */ export default class ExternalApplicationModule extends Base { /** - * Returns an External Application object that represents an existing external application. + * Asynchronously returns an External Application object that represents an existing external application. * @param {string} uuid The UUID of the external application to be wrapped * @return {Promise.} + * @tutorial ExternalApplication.wrap + * @static */ wrap(uuid: string): Promise; + /** + * Synchronously returns an External Application object that represents an existing external application. + * @param {string} uuid The UUID of the external application to be wrapped + * @return {ExternalApplication} + * @tutorial ExternalApplication.wrapSync + * @static + */ + wrapSync(uuid: string): ExternalApplication; } /** * @classdesc An ExternalApplication object representing an application. Allows @@ -18,7 +32,7 @@ export default class ExternalApplicationModule extends Base { * well as listen to application events. * @class */ -export declare class ExternalApplication extends EmitterBase { +export declare class ExternalApplication extends EmitterBase { identity: Identity; constructor(wire: Transport, identity: Identity); /** @@ -28,9 +42,3 @@ export declare class ExternalApplication extends EmitterBase { */ getInfo(): Promise; } -export interface ExternalApplication { - on(type: 'connected', listener: (data: Reply<'externalapplication', 'connected'>) => void): Promise; - on(type: 'disconnected', listener: (data: Reply<'externalapplication', 'disconnected'>) => void): Promise; - on(type: 'removeListener', listener: (eventType: string) => void): Promise; - on(type: 'newListener', listener: (eventType: string) => void): Promise; -} diff --git a/types/openfin/_v2/api/frame/frame.d.ts b/types/openfin/_v2/api/frame/frame.d.ts index 4a5ab971de..8795ae190b 100644 --- a/types/openfin/_v2/api/frame/frame.d.ts +++ b/types/openfin/_v2/api/frame/frame.d.ts @@ -1,6 +1,7 @@ import { Base, EmitterBase } from '../base'; import { Identity } from '../../identity'; import Transport from '../../transport/transport'; +import { FrameEvents } from '../events/frame'; export declare type EntityType = 'window' | 'iframe' | 'external connection' | 'unknown'; export interface FrameInfo { uuid: string; @@ -8,19 +9,40 @@ export interface FrameInfo { entityType: EntityType; parent: Identity; } +/** + * @lends Frame + */ export default class _FrameModule extends Base { /** - * Gets a reference to the specified frame. The frame does not have to exist - * @param {string} uuid - uuid of the frame you want to wrap - * @param {string} name - name of the frame you want to wrap + * Asynchronously returns a reference to the specified frame. The frame does not have to exist + * @param {Identity} identity - the identity of the frame you want to wrap * @return {Promise.<_Frame>} + * @tutorial Frame.wrap + * @static */ - wrap(uuid: string, name: string): Promise<_Frame>; + wrap(identity: Identity): Promise<_Frame>; /** - * Get a reference to the current frame + * Synchronously returns a reference to the specified frame. The frame does not have to exist + * @param {Identity} identity - the identity of the frame you want to wrap + * @return {_Frame} + * @tutorial Frame.wrapSync + * @static + */ + wrapSync(identity: Identity): _Frame; + /** + * Asynchronously returns a reference to the current frame * @return {Promise.<_Frame>} + * @tutorial Frame.getCurrent + * @static */ getCurrent(): Promise<_Frame>; + /** + * Synchronously returns a reference to the current frame + * @return {_Frame} + * @tutorial Frame.getCurrentSync + * @static + */ + getCurrentSync(): _Frame; } /** * @classdesc Represents a way to interact with `iframes`. Facilitates discovery of current context @@ -28,7 +50,7 @@ export default class _FrameModule extends Base { * @class * @alias Frame */ -export declare class _Frame extends EmitterBase { +export declare class _Frame extends EmitterBase { identity: Identity; constructor(wire: Transport, identity: Identity); /** @@ -45,7 +67,3 @@ export declare class _Frame extends EmitterBase { */ getParentWindow(): Promise; } -export interface _Frame { - on(type: 'connected', listener: (eventType: string) => void): Promise; - on(type: 'disconnected', listener: (eventType: string) => void): Promise; -} diff --git a/types/openfin/_v2/api/global-hotkey/index.d.ts b/types/openfin/_v2/api/global-hotkey/index.d.ts index 148ddff7e9..7aa08d6f20 100644 --- a/types/openfin/_v2/api/global-hotkey/index.d.ts +++ b/types/openfin/_v2/api/global-hotkey/index.d.ts @@ -1,10 +1,15 @@ import { EmitterBase } from '../base'; import Transport from '../../transport/transport'; +import { GlobalHotkeyEvents } from '../events/globalHotkey'; +export declare const enum nonHotkeyEvents { + REGISTERED = "registered", + UNREGISTERED = "unregistered" +} /** * The GlobalHotkey module can register/unregister a global hotkeys. * @namespace */ -export default class GlobalHotkey extends EmitterBase { +export default class GlobalHotkey extends EmitterBase { constructor(wire: Transport); /** * Registers a global hotkey with the operating system. diff --git a/types/openfin/_v2/api/interappbus/channel/index.d.ts b/types/openfin/_v2/api/interappbus/channel/index.d.ts index 1297d2c5ea..2b2d963932 100644 --- a/types/openfin/_v2/api/interappbus/channel/index.d.ts +++ b/types/openfin/_v2/api/interappbus/channel/index.d.ts @@ -4,30 +4,29 @@ import { ChannelProvider } from './provider'; import { EmitterBase } from '../../base'; import Transport, { Message, Payload } from '../../../transport/transport'; import { ProviderIdentity } from './channel'; -export interface Options { +import { ChannelEvents } from '../../events/channel'; +export interface ConnectOptions { wait?: boolean; - uuid: string; - name?: string; payload?: any; } export interface ChannelPayload { payload: Payload; } -export interface ChannelMessage { +export interface ChannelMessage extends Message { senderIdentity: Identity; ackToSender: any; - providerIdentity: Identity; + providerIdentity: ProviderIdentity; connectAction: boolean; } -export declare class Channel extends EmitterBase { +export declare class Channel extends EmitterBase { private channelMap; constructor(wire: Transport); getAllChannels(): Promise; - onChannelConnect(listener: Function): Promise; - onChannelDisconnect(listener: Function): Promise; - connect(options: Options): Promise; - create(channelName?: string): Promise; - onmessage: (msg: Message) => boolean; + onChannelConnect(listener: (...args: any[]) => void): Promise; + onChannelDisconnect(listener: (...args: any[]) => void): Promise; + connect(channelName: string, options?: ConnectOptions): Promise; + create(channelName: string): Promise; + onmessage: (msg: ChannelMessage) => boolean; private processChannelMessage; private processChannelConnection; } diff --git a/types/openfin/_v2/api/interappbus/channel/provider.d.ts b/types/openfin/_v2/api/interappbus/channel/provider.d.ts index a869928ac2..4b978c2781 100644 --- a/types/openfin/_v2/api/interappbus/channel/provider.d.ts +++ b/types/openfin/_v2/api/interappbus/channel/provider.d.ts @@ -1,13 +1,15 @@ import { ChannelBase, ProviderIdentity } from './channel'; import Transport from '../../../transport/transport'; -export declare type ConnectionListener = (adapterIdentity: ProviderIdentity, connectionMessage?: any) => any; +import { Identity } from '../../../main'; +export declare type ConnectionListener = (identity: Identity, connectionMessage?: any) => any; export declare class ChannelProvider extends ChannelBase { private connectListener; private disconnectListener; - connections: ProviderIdentity[]; + connections: Identity[]; constructor(providerIdentity: ProviderIdentity, send: Transport['sendAction']); - dispatch(to: ProviderIdentity, action: string, payload: any): Promise; - processConnection(senderId: ProviderIdentity, payload: any): Promise; + dispatch(to: Identity, action: string, payload: any): Promise; + processConnection(senderId: Identity, payload: any): Promise; publish(action: string, payload: any): Promise[]; onConnection(listener: ConnectionListener): void; + onDisconnection(listener: ConnectionListener): void; } diff --git a/types/openfin/_v2/api/notification/notification.d.ts b/types/openfin/_v2/api/notification/notification.d.ts index 8deec180ba..9a6bee7076 100644 --- a/types/openfin/_v2/api/notification/notification.d.ts +++ b/types/openfin/_v2/api/notification/notification.d.ts @@ -1,6 +1,7 @@ import { Base, EmitterBase } from '../base'; import { Identity } from '../../identity'; import Transport from '../../transport/transport'; +import { NotificationEvents } from '../events/notifications'; export declare class NotificationOptions { url: string; message: string; @@ -22,14 +23,12 @@ export interface NotificationCallback { * @class * @alias Notification */ -export declare class _Notification extends EmitterBase { +export declare class _Notification extends EmitterBase { private listenerList; private unhookAllListeners; - private buildLocalPayload; protected options: NotificationOptions; protected generalListener: (msg: any) => void; protected notificationId: number; - protected onmessage: (message: any) => boolean; constructor(wire: Transport, options: NotificationOptions); url: string; timeout: number | string; diff --git a/types/openfin/_v2/api/system/application.d.ts b/types/openfin/_v2/api/system/application.d.ts index 9d7ea09b67..0e14602942 100644 --- a/types/openfin/_v2/api/system/application.d.ts +++ b/types/openfin/_v2/api/system/application.d.ts @@ -1,4 +1,5 @@ export interface ApplicationInfo { isRunning: boolean; uuid: string; + parentUuid?: string; } diff --git a/types/openfin/_v2/api/system/external-process.d.ts b/types/openfin/_v2/api/system/external-process.d.ts index 8a68f1eae3..624c93ea18 100644 --- a/types/openfin/_v2/api/system/external-process.d.ts +++ b/types/openfin/_v2/api/system/external-process.d.ts @@ -1,7 +1,17 @@ export interface ExternalProcessRequestType { - path: string; - arguments: string; - listener: LaunchExternalProcessListener; + path?: string; + alias?: string; + arguments?: string; + listener?: LaunchExternalProcessListener; + lifetime?: string; + certificate?: CertificationInfo; +} +export interface CertificationInfo { + serial?: string; + subject?: string; + publickey?: string; + thumbprint?: string; + trusted?: boolean; } export interface ExitCode { topic: string; @@ -20,3 +30,7 @@ export interface ExternalConnection { token: string; uuid: string; } +export interface ExternalProcessInfo { + pid: number; + listener?: LaunchExternalProcessListener; +} diff --git a/types/openfin/_v2/api/system/host-specs.d.ts b/types/openfin/_v2/api/system/host-specs.d.ts index 2c5a134aea..dfd3e665fd 100644 --- a/types/openfin/_v2/api/system/host-specs.d.ts +++ b/types/openfin/_v2/api/system/host-specs.d.ts @@ -14,9 +14,11 @@ export interface GpuInfo { name: string; } export interface HostSpecs { - cpu: CpuInfo[]; - memory: number; + aeroGlassEnabled?: boolean; arch: string; - name: string; + cpus: CpuInfo[]; gpu: GpuInfo; + memory: number; + name: string; + screenSaver?: boolean; } diff --git a/types/openfin/_v2/api/system/process.d.ts b/types/openfin/_v2/api/system/process.d.ts index 8a513ceecd..98901db137 100644 --- a/types/openfin/_v2/api/system/process.d.ts +++ b/types/openfin/_v2/api/system/process.d.ts @@ -1,15 +1,15 @@ export interface ProcessInfo { - cpuUsage: number; - name: string; - nonPagedPoolUsage: number; - pageFaultCount: number; - pagedPoolUsage: number; - pagefileUsage: number; - peakNonPagedPoolUsage: number; - peakPagedPoolUsage: number; - peakPagefileUsage: number; - peakWorkingSetSize: number; - processId: number; - uuid: string; - workingSetSize: number; + cpuUsage?: number; + name?: string; + nonPagedPoolUsage?: number; + pageFaultCount?: number; + pagedPoolUsage?: number; + pagefileUsage?: number; + peakNonPagedPoolUsage?: number; + peakPagedPoolUsage?: number; + peakPagefileUsage?: number; + peakWorkingSetSize?: number; + processId?: number; + uuid?: string; + workingSetSize?: number; } diff --git a/types/openfin/_v2/api/system/proxy.d.ts b/types/openfin/_v2/api/system/proxy.d.ts index 597afa6548..2f8a945903 100644 --- a/types/openfin/_v2/api/system/proxy.d.ts +++ b/types/openfin/_v2/api/system/proxy.d.ts @@ -1,14 +1,15 @@ export interface ProxyInfo { config: ProxyConfig; - system: { - autoConfigUrl: string; - bypass: ''; - enabled: boolean; - proxy: string; - }; + system: ProxySystemInfo; } export interface ProxyConfig { proxyAddress: string; proxyPort: number; type: string; } +export interface ProxySystemInfo { + autoConfigUrl: string; + bypass: string; + enabled: boolean; + proxy: string; +} diff --git a/types/openfin/_v2/api/system/rvm.d.ts b/types/openfin/_v2/api/system/rvm.d.ts index 42fc0b94db..fb8737a081 100644 --- a/types/openfin/_v2/api/system/rvm.d.ts +++ b/types/openfin/_v2/api/system/rvm.d.ts @@ -1,5 +1,8 @@ export interface RVMInfo { action: string; + appLogDirectory: string; + path: string; 'start-time': string; version: string; + 'working-dir': string; } diff --git a/types/openfin/_v2/api/system/system.d.ts b/types/openfin/_v2/api/system/system.d.ts index 8c0bc7d3b6..76f244cabf 100644 --- a/types/openfin/_v2/api/system/system.d.ts +++ b/types/openfin/_v2/api/system/system.d.ts @@ -12,13 +12,14 @@ import { RVMInfo } from './rvm'; import { RuntimeInfo } from './runtime-info'; import { Entity, EntityInfo } from './entity'; import { HostSpecs } from './host-specs'; -import { ExternalProcessRequestType, TerminateExternalRequestType, ExternalConnection } from './external-process'; +import { ExternalProcessRequestType, TerminateExternalRequestType, ExternalConnection, ExternalProcessInfo } from './external-process'; import Transport from '../../transport/transport'; import { CookieInfo, CookieOption } from './cookie'; import { RegistryInfo } from './registry-info'; import { DownloadPreloadOption, DownloadPreloadInfo } from './download-preload'; import { ClearCacheOption } from './clearCacheOption'; import { CrashReporterOption } from './crashReporterOption'; +import { SystemEvents } from '../events/system'; /** * AppAssetInfo interface * @typedef { Object } AppAssetInfo @@ -35,6 +36,23 @@ import { CrashReporterOption } from './crashReporterOption'; * @typedef { Object } AppAssetRequest * @property { string } alias The name of the asset */ +/** + * ApplicationInfo interface + * @typedef { Object } ApplicationInfo + * @property { boolean } isRunning true when the application is running + * @property { string } uuid uuid of the application + * @property { string } parentUuid uuid of the application that launches this application + */ +/** + * @typedef { Object } ClearCacheOption + * @summary Clear cache options. + * @desc These are the options required by the clearCache function. + * + * @property {boolean} appcache html5 application cache + * @property {boolean} cache browser data cache for html files and images + * @property {boolean} cookies browser cookies + * @property {boolean} localStorage browser data that can be used across sessions + */ /** * CookieInfo interface * @typedef { Object } CookieInfo @@ -48,18 +66,33 @@ import { CrashReporterOption } from './crashReporterOption'; * @property { string } name The name of the cookie */ /** - * ExternalConnection interface - * @typedef { Object } ExternalConnection - * @property { string } token The token to broker an external connection - * @property { string } uuid The uuid of the external connection + * CpuInfo interface + * @typedef { Object } CpuInfo + * @property { string } model The model of the cpu + * @property { number } speed The number in MHz + * @property { Time } times The numbers of milliseconds the CPU has spent in different modes. */ /** -* ExternalProcessRequestType interface -* @typedef { Object } ExternalProcessRequestType -* @property { string } path The file path to where the running application resides -* @property { string } arguments The argument passed to the running application -* @property { Object } listener This is described in the {LaunchExternalProcessListner} type definition +* CrashReporterOption interface +* @typedef { Object } CrashReporterOption +* @property { boolean } diagnosticMode In diagnostic mode the crash reporter will send diagnostic logs to +* the OpenFin reporting service on runtime shutdown +* @property { boolean } isRunning check if it's running */ +/** + * DownloadPreloadInfo interface + * @typedef { Object } DownloadPreloadInfo + * @desc downloadPreloadScripts function return value + * @property { string } url url to the preload script + * @property { string } error error during preload script acquisition + * @property { boolean } succeess download operation success + */ +/** + * DownloadPreloadOption interface + * @typedef { Object } DownloadPreloadOption + * @desc These are the options object required by the downloadPreloadScripts function + * @property { string } url url to the preload script + */ /** * Entity interface * @typedef { Object } Entity @@ -75,18 +108,54 @@ import { CrashReporterOption } from './crashReporterOption'; * @property { string } entityType The type of the entity */ /** -* GetLogRequestType interface -* @typedef { Object } GetLogRequestType -* @property { string } name The name of the running application -* @property { number } endFile The file length of the log file -* @property { number } sizeLimit The set size limit of the log file -*/ + * ExternalConnection interface + * @typedef { Object } ExternalConnection + * @property { string } token The token to broker an external connection + * @property { string } uuid The uuid of the external connection + */ +/** + * ExternalProcessRequestType interface + * @typedef { Object } ExternalProcessRequestType + * @property { string } path The file path to where the running application resides + * @property { string } arguments The argument passed to the running application + * @property { Object } listener This is described in the {LaunchExternalProcessListner} type definition + */ +/** + * GetLogRequestType interface + * @typedef { Object } GetLogRequestType + * @property { string } name The name of the running application + * @property { number } endFile The file length of the log file + * @property { number } sizeLimit The set size limit of the log file + */ +/** + * GpuInfo interface + * @typedef { Object } GpuInfo + * @property { string } name The graphics card name + */ +/** + * HostSpecs interface + * @typedef { Object } HostSpecs + * @property { boolean } aeroGlassEnabled Value to check if Aero Glass theme is supported on Windows platforms + * @property { string } arch "x86" for 32-bit or "x86_64" for 64-bit + * @property { Array } cpus The same payload as Node's os.cpus() + * @property { GpuInfo } gpu The graphics card name + * @property { number } memory The same payload as Node's os.totalmem() + * @property { string } name The OS name and version/edition + * @property { boolean } screenSaver Value to check if screensaver is running. Supported on Windows only + */ /** * Identity interface * @typedef { Object } Identity * @property { string } name The name of the application * @property { string } uuid The uuid of the application */ +/** + * LogInfo interface + * @typedef { Object } LogInfo + * @property { string } name The filename of the log + * @property { number } size The size of the log in bytes + * @property { string } date The unix time at which the log was created "Thu Jan 08 2015 14:40:30 GMT-0500 (Eastern Standard Time)"" + */ /** * @typedef { verbose | info | warning | error | fatal } LogLevel * @summary Log verbosity levels. @@ -98,12 +167,49 @@ import { CrashReporterOption } from './crashReporterOption'; * @property { string } error error and above * @property { string } fatal fatal only, indicates a crash is imminent */ +/** + * PointTopLeft interface + * @typedef { Object } PointTopLeft + * @property { number } top The mouse top position in virtual screen coordinates + * @property { number } left The mouse left position in virtual screen coordinates + */ +/** + * ProcessInfo interface + * @typedef { Object } ProcessInfo + * @property { numder } cpuUsage The percentage of total CPU usage + * @property { string } name The application name + * @property { number } nonPagedPoolUsage The current nonpaged pool usage in bytes + * @property { number } pageFaultCount The number of page faults + * @property { number } pagedPoolUsage The current paged pool usage in bytes + * @property { number } pagefileUsage The total amount of memory in bytes that the memory manager has committed + * @property { number } peakNonPagedPoolUsage The peak nonpaged pool usage in bytes + * @property { number } peakPagedPoolUsage The peak paged pool usage in bytes + * @property { number } peakPagefileUsage The peak value in bytes of pagefileUsage during the lifetime of this process + * @property { number } peakWorkingSetSize The peak working set size in bytes + * @property { number } processId The native process identifier + * @property { string } uuid The application UUID + * @property { nubmer } workingSetSize The current working set size (both shared and private data) in bytes + */ /** * ProxyConfig interface * @typedef { Object } ProxyConfig - * @property { numder } proxyPort The port number of the running application - * @property { string } proxyAddress The address of the running application - * @property { string } type + * @property { string } proxyAddress The configured proxy address + * @property { numder } proxyPort The configured proxy port + * @property { string } type The proxy Type + */ +/** + * ProxyInfo interface + * @typedef { Object } ProxyInfo + * @property { ProxyConfig } config The proxy config + * @property { ProxySystemInfo } system The proxy system info + */ +/** + * ProxySystemInfo interface + * @typedef { Object } ProxySystemInfo + * @property { string } autoConfigUrl The auto configuration url + * @property { string } bypass The proxy bypass info + * @property { boolean } enabled Value to check if a proxy is enabled + * @property { string } proxy The proxy info */ /** * RegistryInfo interface @@ -120,6 +226,16 @@ import { CrashReporterOption } from './crashReporterOption'; * @desc These are the options object required by the downloadRuntime function. * @property { string } version The given version to download */ +/** + * RVMInfo interface + * @typedef { Object } RVMInfo + * @property { string } action The name of action: "get-rvm-info" + * @property { string } appLogDirectory The app log directory + * @property { string } path The path of OpenfinRVM.exe + * @property { string } 'start-time' The start time of RVM + * @property { string } version The version of RVM + * @property { string } 'working-dir' The working directory + */ /** * TerminateExternalRequestType interface * @typedef { Object } TerminateExternalRequestType @@ -128,43 +244,41 @@ import { CrashReporterOption } from './crashReporterOption'; * @property { boolean } killtree Value to terminate the running application */ /** - * DownloadPreloadOption interface - * @typedef { Object } DownloadPreloadOption - * @desc These are the options object required by the downloadPreloadScripts function - * @property { string } url url to the preload script + * Time interface + * @typedef { Object } Time + * @property { number } user The number of milliseconds the CPU has spent in user mode + * @property { number } nice The number of milliseconds the CPU has spent in nice mode + * @property { number } sys The number of milliseconds the CPU has spent in sys mode + * @property { number } idle The number of milliseconds the CPU has spent in idle mode + * @property { number } irq The number of milliseconds the CPU has spent in irq mode */ /** - * DownloadPreloadInfo interface - * @typedef { Object } DownloadPreloadInfo - * @desc downloadPreloadScripts function return value - * @property { string } url url to the preload script - * @property { string } error error during preload script acquisition - * @property { boolean } succeess download operation success + * WindowDetail interface + * @typedef { Object } WindowDetail + * @property { number } bottom The bottom-most coordinate of the window + * @property { number } height The height of the window + * @property { boolean } isShowing Value to check if the window is showing + * @property { number } left The left-most coordinate of the window + * @property { string } name The name of the window + * @property { number } right The right-most coordinate of the window + * @property { string } state The window state + * @property { number } top The top-most coordinate of the window + * @property { number } width The width of the window */ /** - * @typedef { Object } ClearCacheOption - * @summary Clear cache options. - * @desc These are the options required by the clearCache function. - * - * @property {boolean} appcache html5 application cache - * @property {boolean} cache browser data cache for html files and images - * @property {boolean} cookies browser cookies - * @property {boolean} localStorage browser data that can be used across sessions + * WindowInfo interface + * @typedef { Object } WindowInfo + * @property { Array } childWindows The array of child windows details + * @property { WindowDetail } mainWindow The main window detail + * @property { string } uuid The uuid of the application */ -/** -* CrashReporterOption interface -* @typedef { Object } CrashReporterOption -* @property { boolean } diagnosticMode In diagnostic mode the crash reporter will send diagnostic logs to -* the OpenFin reporting service on runtime shutdown -* @property { boolean } isRunning check if it's running -*/ /** * An object representing the core of OpenFin Runtime. Allows the developer * to perform system-level actions, such as accessing logs, viewing processes, * clearing the cache and exiting the runtime. * @namespace */ -export default class System extends EmitterBase { +export default class System extends EmitterBase { constructor(wire: Transport); /** * Returns the version of the runtime. The version contains the major, minor, @@ -224,13 +338,6 @@ export default class System extends EmitterBase { * @tutorial System.getCrashReporterState */ getCrashReporterState(): Promise; - /** - * Returns a unique identifier (UUID) for the machine (SHA256 hash of the system's MAC address). - * This call will return the same value on subsequent calls on the same machine(host). - * The values will be different on different machines, and should be considered globally unique. - * @return {Promise.} - * @tutorial System.getDeviceId - */ getDeviceId(): Promise; /** * Start the crash reporter for the browser process if not already running. @@ -275,6 +382,12 @@ export default class System extends EmitterBase { * @tutorial System.getLog */ getLog(options: GetLogRequestType): Promise; + /** + * Returns a unique identifier (UUID) provided by the machine. + * @return {Promise.} + * @tutorial System.getMachineId + */ + getMachineId(): Promise; /** * Returns the minimum (inclusive) logging level that is currently being written to the log. * @return {Promise.} @@ -328,7 +441,7 @@ export default class System extends EmitterBase { getRvmInfo(): Promise; /** * Retrieves system information. - * @return {Promise.} + * @return {Promise.} * @tutorial System.getHostSpecs */ getHostSpecs(): Promise; @@ -341,11 +454,11 @@ export default class System extends EmitterBase { launchExternalProcess(options: ExternalProcessRequestType): Promise; /** * Monitors a running process. - * @param { number } pid See tutorial for more details + * @param { ExternalProcessInfo } options See tutorial for more details * @return {Promise.} * @tutorial System.monitorExternalProcess */ - monitorExternalProcess(pid: number): Promise; + monitorExternalProcess(options: ExternalProcessInfo): Promise; /** * Writes the passed message into both the log file and the console. * @param { string } level The log level for the entry. Can be either "info", "warning" or "error" diff --git a/types/openfin/_v2/api/system/window.d.ts b/types/openfin/_v2/api/system/window.d.ts index 886084fad6..7b2a3b858b 100644 --- a/types/openfin/_v2/api/system/window.d.ts +++ b/types/openfin/_v2/api/system/window.d.ts @@ -1,14 +1,16 @@ export interface WindowInfo { - uuid: string; - mainWindow: WindowDetail; childWindows: Array; + mainWindow: WindowDetail; + uuid: string; } export interface WindowDetail { - name: string; - top: number; - right: number; bottom: number; height: number; - width: number; + isShowing: boolean; left: number; + name: string; + right: number; + state: string; + top: number; + width: number; } diff --git a/types/openfin/_v2/api/window/anchor-type.d.ts b/types/openfin/_v2/api/window/anchor-type.d.ts new file mode 100644 index 0000000000..4e09af40ab --- /dev/null +++ b/types/openfin/_v2/api/window/anchor-type.d.ts @@ -0,0 +1 @@ +export declare type AnchorType = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'; diff --git a/types/openfin/_v2/api/window/window.d.ts b/types/openfin/_v2/api/window/window.d.ts index 8d597a6446..fcefc4fa5d 100644 --- a/types/openfin/_v2/api/window/window.d.ts +++ b/types/openfin/_v2/api/window/window.d.ts @@ -1,32 +1,54 @@ -import { Base, EmitterBase, RuntimeEvent } from '../base'; +import { Base, EmitterBase } from '../base'; import { Identity } from '../../identity'; import Bounds from './bounds'; -import BoundsChangedReply from './bounds-changed'; import { Transition, TransitionOptions } from './transition'; import { Application } from '../application/application'; import Transport from '../../transport/transport'; +import { WindowEvents } from '../events/window'; +import { AnchorType } from './anchor-type'; +import { WindowOption } from './windowOption'; +/** + * @lends Window + */ export default class _WindowModule extends Base { - private instance; /** - * Returns a Window object that represents an existing window. - * @param { Identity } indentity + * Asynchronously returns a Window object that represents an existing window. + * @param { Identity } identity * @return {Promise.<_Window>} * @tutorial Window.wrap + * @static */ wrap(identity: Identity): Promise<_Window>; + /** + * Synchronously returns a Window object that represents an existing window. + * @param { Identity } identity + * @return {_Window} + * @tutorial Window.wrapSync + * @static + */ + wrapSync(identity: Identity): _Window; /** * Creates a new Window. - * @param { * } options - Window creation options + * @param { WindowOption } options - Window creation options * @return {Promise.<_Window>} * @tutorial Window.create + * @static */ - create(options: any): Promise<_Window>; + create(options: WindowOption): Promise<_Window>; /** - * Returns a Window object that represents the current window - * @return {Promise.} - * @tutorial window.getCurrent + * Asynchronously returns a Window object that represents the current window + * @return {Promise.<_Window>} + * @tutorial Window.getCurrent + * @static */ getCurrent(): Promise<_Window>; + /** + * Synchronously returns a Window object that represents the current window + * @return {_Window} + * @tutorial Window.getCurrentSync + * @static + */ + getCurrentSync(): _Window; } export interface CloseEventShape { name: string; @@ -47,6 +69,19 @@ export interface FrameInfo { entityType: string; parent?: Identity; } +export interface Area { + height: number; + width: number; + x: number; + y: number; +} +/** + * @typedef { Object } Area + * @property { number } height Area's height + * @property { number } width Area's width + * @property { number } x X coordinate of area's starting point + * @property { number } y Y coordinate of area's starting point + */ /** * @typedef {object} Transition * @property {Opacity} opacity - The Opacity transition @@ -98,7 +133,7 @@ this animation onto the end of the animation queue. * @class * @alias Window */ -export declare class _Window extends EmitterBase { +export declare class _Window extends EmitterBase { identity: Identity; /** * Raised when a window within this application requires credentials from the user. @@ -425,10 +460,8 @@ export declare class _Window extends EmitterBase { * @property {string} state - The preload script state: "load-failed", "failed", "succeeded" */ - private nativeWindow; constructor(wire: Transport, identity: Identity); - createWindow(options: any): Promise<_Window>; - protected runtimeEventComparator: (listener: RuntimeEvent) => boolean; + createWindow(options: WindowOption): Promise<_Window>; private windowListFromNameList; /** * Retrieves an array of frame info objects representing the main frame and any @@ -443,12 +476,6 @@ export declare class _Window extends EmitterBase { * @tutorial Window.getBounds */ getBounds(): Promise; - /** - * Returns the native JavaScript "window" object for the window. - * @return {Promise.} - * @tutorial Window.getNativeWindow - */ - getNativeWindow(): Promise; /** * Gives focus to the window. * @return {Promise.} @@ -561,11 +588,13 @@ export declare class _Window extends EmitterBase { */ getParentWindow(): Promise<_Window>; /** - * Gets a base64 encoded PNG snapshot of the window. + * Gets a base64 encoded PNG snapshot of the window or just part a of it. + * @param { Area } [area] The area of the window to be captured. + * Omitting it will capture the whole visible window. * @return {Promise.} * @tutorial Window.getSnapshot */ - getSnapshot(): Promise; + getSnapshot(area?: Area): Promise; /** * Gets the current state ("minimized", "maximized", or "restored") of the window. * @return {Promise.} @@ -636,24 +665,24 @@ export declare class _Window extends EmitterBase { * Resizes the window by a specified amount. * @param { number } deltaWidth The change in the width of the window * @param { number } deltaHeight The change in the height of the window - * @param { string } anchor Specifies a corner to remain fixed during the resize. - * Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right." + * @param { AnchorType } anchor Specifies a corner to remain fixed during the resize. + * Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right". * If undefined, the default is "top-left" * @return {Promise.} * @tutorial Window.resizeBy */ - resizeBy(deltaWidth: number, deltaHeight: number, anchor: string): Promise; + resizeBy(deltaWidth: number, deltaHeight: number, anchor: AnchorType): Promise; /** * Resizes the window to the specified dimensions. * @param { number } width The change in the width of the window * @param { number } height The change in the height of the window - * @param { string } anchor Specifies a corner to remain fixed during the resize. - * Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right." + * @param { AnchorType } anchor Specifies a corner to remain fixed during the resize. + * Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right". * If undefined, the default is "top-left" * @return {Promise.} * @tutorial Window.resizeTo */ - resizeTo(width: number, height: number, anchor: string): Promise; + resizeTo(width: number, height: number, anchor: AnchorType): Promise; /** * Restores the window to its normal state (i.e., unminimized, unmaximized). * @return {Promise.} @@ -747,13 +776,3 @@ export declare class _Window extends EmitterBase { */ stopNavigation(): Promise; } -export interface _Window { - on(type: 'focused', listener: Function): Promise; - on(type: 'initialized', listener: Function): Promise; - on(type: 'bounds-changed', listener: (data: BoundsChangedReply) => void): Promise; - on(type: 'hidden', listener: Function): Promise; - on(type: 'removeListener', listener: (eventType: string | symbol) => void): Promise; - on(type: 'newListener', listener: (eventType: string | symbol) => void): Promise; - on(type: 'closed', listener: (eventType: CloseEventShape) => void): Promise; - on(type: 'fire-constructor-callback', listener: Function): Promise; -} diff --git a/types/openfin/_v2/api/window/windowOption.d.ts b/types/openfin/_v2/api/window/windowOption.d.ts new file mode 100644 index 0000000000..faab275187 --- /dev/null +++ b/types/openfin/_v2/api/window/windowOption.d.ts @@ -0,0 +1,46 @@ +import { DownloadPreloadOption } from '../system/download-preload'; +export interface WindowOption { + accelerator?: object; + alwaysOnTop?: boolean; + api?: object; + aspectRatio?: number; + autoShow?: boolean; + backgroundColor?: string; + contentNavigation?: object; + contextMenu?: boolean; + cornerRounding?: object; + customData?: string; + customRequestHeaders?: Array; + defaultCentered?: boolean; + defaultHeight?: number; + defaultLeft?: number; + defaultTop?: number; + defaultWidth?: number; + frame?: boolean; + hideOnClose?: boolean; + icon?: string; + maxHeight?: number; + maximizable?: boolean; + maxWidth?: number; + minHeight?: number; + minimizable?: boolean; + minWidth?: number; + name?: string; + opacity?: number; + preloadScripts?: Array; + resizable?: boolean; + resizeRegion?: object; + saveWindowState?: boolean; + shadow?: boolean; + showTaskbarIcon?: boolean; + smallWindow?: boolean; + state?: string; + taskbarIconGroup?: string; + url?: string; + uuid?: string; + waitForPageLoad?: boolean; +} +export interface CustomRequestHeaders { + urlPatterns: Array; + headers: Array; +} diff --git a/types/openfin/_v2/transport/transport.d.ts b/types/openfin/_v2/transport/transport.d.ts index fb7b967240..519562de95 100644 --- a/types/openfin/_v2/transport/transport.d.ts +++ b/types/openfin/_v2/transport/transport.d.ts @@ -3,6 +3,8 @@ import { Wire, WireConstructor, READY_STATE, ExistingConnectConfig, ConnectConfi import { Identity } from '../identity'; import { EventEmitter } from 'events'; import { Environment } from '../environment/environment'; +import { RuntimeEvent } from '../api/events/base'; +import { EventAggregator } from '../api/events/eventAggregator'; export declare type MessageHandler = (data: any) => boolean; declare class Transport extends EventEmitter { protected wireListeners: Map; protected uncorrelatedListener: Function; - protected messageHandlers: MessageHandler[]; me: Identity; protected wire: Wire; environment: Environment; topicRefMap: Map; sendRaw: Wire['send']; + eventAggregator: EventAggregator; + protected messageHandlers: MessageHandler[]; constructor(wireType: WireConstructor, environment: Environment); connectSync: (config: ConnectConfig) => any; connect(config: InternalConnectConfig): Promise; @@ -38,6 +41,20 @@ export declare class Message { payload: T; correlationId?: number; } +export declare class EventMessage implements Message { + action: 'process-desktop-event'; + payload: RuntimeEvent; +} +export declare class NotificationEventMessage implements Message { + action: 'process-notification-event'; + payload: NotificationEvent; +} +export interface NotificationEvent { + payload: { + notificationId: string; + }; + type: string | symbol; +} export declare class Payload { success: boolean; data: any; diff --git a/types/openfin/index.d.ts b/types/openfin/index.d.ts index fe34f0b630..41e35c0c45 100644 --- a/types/openfin/index.d.ts +++ b/types/openfin/index.d.ts @@ -1,12 +1,13 @@ -// Type definitions for OpenFin API 34.0 +// Type definitions for OpenFin API 37.0 // Project: https://openfin.co/ // Definitions by: Chris Barker // Ricardo de Pena // Roma +// Li Cui // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.9 -// based on v9.61.34.22 +// based on v9.61.37.14 // see https://openfin.co/support/technical-faq/#what-do-the-numbers-in-the-runtime-version-mean /** @@ -23,16 +24,45 @@ * When running within the OpenFin Runtime your web applications have access to the "fin" namespace and all the modules within the API * without the need to include additional source files. You can treat the "fin" namespace as you would the "window", "navigator" or "documennt" objects. */ +import { Identity } from './_v2/identity'; +import { ApplicationInfo as LaunchInfo, ShortCutConfig, TrayInfo } from './_v2/api/application/application'; +import { ApplicationOption } from './_v2/api/application/applicationOption'; +import { ExternalApplicationInfo } from './_v2/api/external-application/external-application'; +import { ApplicationInfo } from './_v2/api/system/application'; +import { ClearCacheOption } from './_v2/api/system/clearCacheOption'; +import { CookieInfo, CookieOption } from './_v2/api/system/cookie'; +import { AppAssetInfo, AppAssetRequest, RuntimeDownloadOptions, RuntimeDownloadProgress } from './_v2/api/system/download-asset'; +import { DownloadPreloadInfo, DownloadPreloadOption } from './_v2/api/system/download-preload'; +import { EntityInfo } from './_v2/api/system/entity'; +import { ExternalProcessRequestType, ExternalProcessInfo } from './_v2/api/system/external-process'; +import { HostSpecs } from './_v2/api/system/host-specs'; +import { LogInfo } from './_v2/api/system/log'; +import { MonitorInfo } from './_v2/api/system/monitor'; +import { PointTopLeft } from './_v2/api/system/point'; +import { ProcessInfo } from './_v2/api/system/process'; +import { ProxyInfo } from './_v2/api/system/proxy'; +import { RegistryInfo } from './_v2/api/system/registry-info'; +import { RVMInfo} from './_v2/api/system/rvm'; +import { WindowDetail, WindowInfo } from './_v2/api/system/window'; +import { AnchorType } from './_v2/api/window/anchor-type'; +import Bounds from './_v2/api/window/bounds'; +import { Transition, TransitionOptions } from './_v2/api/window/transition'; +import { WindowOption } from './_v2/api/window/windowOption'; + +// tslint:disable-next-line:export-just-namespace +export = fin; +export as namespace fin; + declare namespace fin { - var Application: import('./_v2/api/application/application').default - var Clipboard: import('./_v2/api/clipboard/clipboard').default + var Application: import('./_v2/api/application/application').default; + var Clipboard: import('./_v2/api/clipboard/clipboard').default; var ExternalApplication: import('./_v2/api/external-application/external-application').default - var Frame: import('./_v2/api/frame/frame').default - var GlobalHotkey: import('./_v2/api/global-hotkey/index').default - var InterApplicationBus: import('./_v2/api/interappbus/interappbus').default - var Notification: import('./_v2/api/notification/notification').default - var System: import('./_v2/api/system/system').default - var Window: import('./_v2/api/window/window').default + var Frame: import('./_v2/api/frame/frame').default; + var GlobalHotkey: import('./_v2/api/global-hotkey/index').default; + var InterApplicationBus: import('./_v2/api/interappbus/interappbus').default; + var Notification: import('./_v2/api/notification/notification').default; + var System: import('./_v2/api/system/system').default; + var Window: import('./_v2/api/window/window').default; const desktop: OpenFinDesktop; @@ -53,7 +83,7 @@ declare namespace fin { * An object representing an application. Allows the developer to create, execute, show/close an application as well as listen to application events. */ new ( - options: ApplicationOptions, + options: ApplicationOption, callback?: (successObj: { httpResponseCode: number }) => void, errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): OpenFinApplication; /** @@ -124,7 +154,7 @@ declare namespace fin { /** * Retrieves information about the system tray. */ - getTrayIconInfo(callback?: (trayInfo: TrayIconInfo) => void, errorCallback?: (reason: string) => void): void; + getTrayIconInfo(callback?: (trayInfo: TrayInfo) => void, errorCallback?: (reason: string) => void): void; /** * Determines if the application is currently running. */ @@ -188,21 +218,6 @@ declare namespace fin { uuid: string; } - interface ShortCutConfig { - /** - * application has a shortcut on the desktop - */ - desktop?: boolean; - /** - * application has no shortcut in the start menu - */ - startMenu?: boolean; - /** - * application will be launched on system startup - */ - systemStartup?: boolean; - } - interface SuccessObj { httpResponseCode: number; } @@ -216,192 +231,6 @@ declare namespace fin { message: string; } - interface ApplicationOptions { - /** - * The name of the application. - */ - name?: string; - /** - * The url to the application. - */ - url?: string; - /** - * The UUID of the application, unique within the set of all other applications running in the OpenFin Runtime. name and uuid must match. - */ - uuid?: string; - /** - * Enable Flash at the application level. Default: false. - */ - plugins?: boolean; - /** - * The options of the main window of the application. - */ - mainWindowOptions?: WindowOptions; - } - - interface WindowOptions { - /** - * Enable keyboard shortcuts for devtools and zoom. Default: false for both. - */ - accelerator?: { - devtools?: boolean, - zoom?: boolean, - reload?: boolean, - reloadIgnoreCache?: boolean, - }; - /** - * A flag to always position the window at the top of the window stack. Default: false. - * Updatable - */ - alwaysOnTop?: boolean; - /** - * A flag to automatically show the Window when it is created. Default: false. - */ - autoShow?: boolean; - /** - * A flag to show the context menu when right-clicking on a window. Gives access to the Developer Console for the Window. Default: true - * Updatable - */ - contextMenu?: boolean; - /** - * This defines and applies rounded corners for a frameless window. Default for both width and height: 0. - * Updatable - */ - cornerRounding?: { - width?: number; - height?: number; - }; - /** - * A field that the user can attach serializable data to to be ferried around with the window options. Default: ''. - */ - customData?: any; - /** - * Specifies that the window will be positioned in the center of the primary monitor when loaded for the first time on a machine. - * When the window corresponding to that id is loaded again, the position from before the window was closed is used. - * This option overrides defaultLeft and defaultTop. Default: false. - */ - defaultCentered?: boolean; - /** - * The default height of the window. Specifies the height of the window when loaded for the first time on a machine. - * When the window corresponding to that id is loaded again, the height is taken to be the last height of the window before it was closed. Default: 500. - */ - defaultHeight?: number; - /** - * The default left position of the window. Specifies the position of the left of the window when loaded for the first time on a machine. - * When the window corresponding to that id is loaded again, the value of left is taken to be the last value before the window was closed. Default: 100. - */ - defaultWidth?: number; - /** - * The default top position of the window. Specifies the position of the top of the window when loaded for the first time on a machine. - * When the window corresponding to that id is loaded again, the value of top is taken to be the last value before the window was closed. Default: 100. - */ - defaultTop?: number; - /** - * The default width of the window. Specifies the width of the window when loaded for the first time on a machine. - * When the window corresponding to that id is loaded again, the width is taken to be the last width of the window before it was closed. Default: 800. - */ - defaultLeft?: number; - /** - * A flag to show the frame. Default: true. - * Updatable - */ - frame?: boolean; - /** - * A flag to allow a window to be hidden when the close button is clicked.Default: false. - * Updatable - */ - hideOnClose?: boolean; - /** - * A URL for the icon to be shown in the window title bar and the taskbar.Default: The parent application's applicationIcon. - * Updatable - */ - icon?: string; - /** - * The maximum height of a window.Will default to the OS defined value if set to - 1. Default: -1. - * Updatable - */ - maxHeight?: number; - /** - * A flag that lets the window be maximized.Default: true. - * Updatable - */ - maximizable?: boolean; - /** - * The maximum width of a window.Will default to the OS defined value if set to - 1. Default: -1. - * Updatable - */ - maxWidth?: number; - /** - * The minimum height of a window.Default: 0. - * Updatable - */ - minHeight?: number; - /** - * A flag that lets the window be minimized.Default: true. - */ - minimizable?: boolean; - /** - * The minimum width of a window.Default: 0. - */ - minWidth?: number; - /** - * The name for the window which must be unique within the context of the invoking Application. - */ - name?: string; - /** - * A flag that specifies how transparent the window will be.This value is clamped between 0.0 and 1.0.Default: 1.0. - * Updatable - */ - opacity?: number; - /** - * A flag to drop to allow the user to resize the window.Default: true. - * Updatable - */ - resizable?: boolean; - /** - * Defines a region in pixels that will respond to user mouse interaction for resizing a frameless window. - * Updatable - */ - resizeRegion?: { - /** - * The size in pixels (Default: 2), - */ - size?: number; - /** - * The size in pixels of an additional - * square resizable region located at the - * bottom right corner of a - * frameless window. (Default: 4) - */ - bottomRightCorner?: number; - }; - /** - * A flag to show the Window's icon in the taskbar. Default: true. - */ - showTaskbarIcon?: boolean; - /** - * A flag to cache the location of the window or not. Default: true. - */ - saveWindowState?: boolean; - /** - * Specify a taskbar group for the window. Default: app's uuid. - */ - taskbarIconGroup?: string; - /** - * A string that sets the window to be "minimized", "maximized", or "normal" on creation. Default: "normal". - */ - state?: string; - /** - * The URL of the window. Default: "about:blank". - */ - url?: string; - /** - * When set to false, the window will render before the "load" event is fired on the content's window. - * Caution, when false you will see an initial empty white window. Default: true. - */ - waitForPageLoad?: boolean; - } - /** * Clipboard * Clipboard API allows reading and writting to the clipboard in multiple formats. @@ -637,7 +466,7 @@ declare namespace fin { * Clears cached data containing window state/positions, * application resource files (images, HTML, JavaScript files), cookies, and items stored in the Local Storage. */ - clearCache(options: CacheOptions, callback?: () => void, errorCallback?: (reason: string) => void): void; + clearCache(options: ClearCacheOption, callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Clears all cached data when OpenFin Runtime exits. */ @@ -679,11 +508,11 @@ declare namespace fin { /** * Retrieves an array of data (name, ids, bounds) for all application windows. */ - getAllWindows(callback?: (windowInfoList: WindowDetails[]) => void, errorCallback?: (reason: string) => void): void; + getAllWindows(callback?: (windowInfoList: WindowInfo[]) => void, errorCallback?: (reason: string) => void): void; /** * Returns information about the app asset. */ - getAppAssetInfo(options: AppAssetOptions, callback?: (appAssetInfo: AppAssetInfo) => void, errorCallback?: (reason: string) => void): void; + getAppAssetInfo(options: AppAssetRequest, callback?: (appAssetInfo: AppAssetInfo) => void, errorCallback?: (reason: string) => void): void; /** * Get additional info of cookies. */ @@ -715,7 +544,7 @@ declare namespace fin { /** * Retrieves system information. */ - getHostSpecs(callback?: (info: HostSpecInfo) => void, errorCallback?: (reason: string) => void): void; + getHostSpecs(callback?: (info: HostSpecs) => void, errorCallback?: (reason: string) => void): void; /** * Retrieves the contents of the log with the specified filename. */ @@ -735,7 +564,7 @@ declare namespace fin { /** * Returns the mouse in virtual screen coordinates (left, top). */ - getMousePosition(callback?: (mousePosition: VirtualScreenCoordinates) => void, errorCallback?: (reason: string) => void): void; + getMousePosition(callback?: (mousePosition: PointTopLeft) => void, errorCallback?: (reason: string) => void): void; /** * Retrieves an array of all of the runtime processes that are currently running. * Each element in the array is an object containing the uuid and the name of the application to which the process belongs. @@ -748,7 +577,7 @@ declare namespace fin { /** * Returns information about the running RVM in an object. */ - getRvmInfo(callback?: (rvmInfo: RvmInfo) => void, errorCallback?: (reason: string) => void): void; + getRvmInfo(callback?: (rvmInfo: RVMInfo) => void, errorCallback?: (reason: string) => void): void; /** * Returns the version of the runtime. The version contains the major, minor, build and revision numbers. */ @@ -756,7 +585,7 @@ declare namespace fin { /** * Runs an executable or batch file. */ - launchExternalProcess(options: ExternalProcessLaunchInfo, callback?: (payload: { uuid: string }) => void, errorCallback?: (reason: string) => void): void; + launchExternalProcess(options: ExternalProcessRequestType, callback?: (payload: { uuid: string }) => void, errorCallback?: (reason: string) => void): void; /** * Writes the passed message into both the log file and the console. */ @@ -829,340 +658,6 @@ declare namespace fin { updateProxySettings(type: string, address: string, port: number, callback?: () => void, errorCallback?: (reason: string) => void): void; } - interface CacheOptions { - cache?: boolean; - cookies?: boolean; - localStorage?: boolean; - appcache?: boolean; - userData?: boolean; - } - - interface AppAssetInfo { - src?: string; - alias?: string; - version?: string; - target?: string; - args?: string; - mandatory?: boolean; - } - - interface AppAssetOptions { - alias: string; - } - - interface ApplicationInfo { - /** - * true when the application is running. - */ - isRunning?: boolean; - /** - * uuid of the application. - */ - uuid?: string; - /** - * uuid of the application that launches this application. - */ - parentUuid?: string; - } - - interface Identity { - uuid: string; - name: string; - } - - interface EntityInfo { - name: string; - uuid: string; - parent: Identity; - entityType: string; - } - - interface DownloadPreloadOption { - url: string; - } - - interface DownloadPreloadInfo { - success: boolean; - url?: string; - error: string; - } - - interface CookieInfo { - name: string; - // expirationDate: Date; - domain: string; - path: string; - } - - interface CookieOption { - name: string; - } - - interface RegistryInfo { - data: any; - rootKey: string; - subkey: string; - type: string; - value: string; - } - - interface RuntimeDownloadOptions { - version: string; - } - - interface RuntimeDownloadProgress { - downloadedBytes: number; - totalBytes: number; - } - - interface WindowDetails { - uuid?: string; - mainWindow?: WindowInfo; - childWindows?: WindowInfo[]; - } - - interface WindowInfo { - /** - * name of the child window - */ - name?: string; - /** - * top-most coordinate of the child window - */ - top?: number; - /** - * right-most coordinate of the child window - */ - right?: number; - /** - * bottom-most coordinate of the child window - */ - bottom?: number; - /** - * left-most coordinate of the child window - */ - left?: number; - } - - interface HostSpecInfo { - /** - * "x86" for 32-bit or "x86_64" for 64-bit - */ - arch: string; - /** - * Same payload as Node's os.cpus() - */ - cpus: NodeCpuInfo[]; - gpu: { - /** - * Graphics card name - */ - name: string; - }; - /** - * Same payload as Node's os.totalmem() - */ - memory: number; - /** - * OS name and version/edition - */ - name: string; - } - - interface NodeCpuInfo { - model: string; - /** - * in MHz - */ - speed: number; - times: { - /** - * The number of milliseconds the CPU has spent in user mode. - */ - user: number; - /** - * The number of milliseconds the CPU has spent in nice mode. - */ - nice: number; - /** - * The number of milliseconds the CPU has spent in sys mode. - */ - sys: number; - /** - * The number of milliseconds the CPU has spent in idle mode. - */ - idle: number; - /** - * The number of milliseconds the CPU has spent in irq mode. - */ - irq: number; - }; - } - - interface LogInfo { - /** - * the filename of the log - */ - name?: string; - /** - * the size of the log in bytes - */ - size?: number; - /** - * the unix time at which the log was created "Thu Jan 08 2015 14:40:30 GMT-0500 (Eastern Standard Time)" - */ - date?: string; - } - - interface ProcessInfo { - /** - * the percentage of total CPU usage - */ - cpuUsage?: number; - /** - * the application name - */ - name?: string; - /** - * the current nonpaged pool usage in bytes - */ - nonPagedPoolUsage?: number; - /** - * the number of page faults - */ - pageFaultCount?: number; - /** - * the current paged pool usage in bytes - */ - pagedPoolUsage?: number; - /** - * the total amount of memory in bytes that the memory manager has committed - */ - pagefileUsage?: number; - /** - * the peak nonpaged pool usage in bytes - */ - peakNonPagedPoolUsage?: number; - /** - * the peak paged pool usage in bytes - */ - peakPagedPoolUsage?: number; - /** - * the peak value in bytes of pagefileUsage during the lifetime of this process - */ - peakPagefileUsage?: number; - /** - * the peak working set size in bytes - */ - peakWorkingSetSize?: number; - /** - * the native process identifier - */ - processId?: number; - /** - * the application UUID - */ - uuid?: string; - /** - * the current working set size (both shared and private data) in bytes - */ - workingSetSize?: number; - } - - interface ProxyInfo { - /** - * the configured Proxy Address - */ - proxyAddress?: string; - /** - * the configured Proxy port - */ - proxyPort?: number; - /** - * Proxy Type - */ - type?: string; - } - - interface RvmInfo { - version?: string; - "start-time"?: string; - } - - interface ExternalProcessLaunchInfo { - path?: string; - /** - * Additionally note that the executable found in the zip file specified in appAssets - * will default to the one mentioned by appAssets.target - * If the the path below refers to a specific path it will override this default - */ - alias?: string; - /** - * When using alias; if no arguments are passed then the arguments (if any) - * are taken from the 'app.json' file, from the 'args' parameter - * of the 'appAssets' Object with the relevant 'alias'. - * If 'arguments' is passed as a parameter it takes precedence - * over any 'args' set in the 'app.json'. - */ - arguments?: string; - listener?(result: { - /** - * "Exited" Or "released" on a call to releaseExternalProcess - */ - topic?: string; - /** - * The mapped UUID which identifies the launched process - */ - uuid?: string; - /* - * Process exit code - */ - exitCode?: number; - }): void; - certificate?: CertificationInfo; - } - - interface CertificationInfo { - /** - * A hex string with or without spaces - */ - serial?: string; - /** - * An internally tokenized and comma delimited string allowing partial or full checks of the subject fields - */ - subject?: string; - /** - * A hex string with or without spaces - */ - publickey?: string; - /** - * A hex string with or without spaces - */ - thumbprint?: string; - /** - * A boolean indicating that the certificate is trusted and not revoked - */ - trusted?: boolean; - } - - interface ExternalProcessInfo { - pid?: number; - listener?(result: { - /** - * "Exited" Or "released" on a call to releaseExternalProcess - */ - topic?: string; - /** - * The mapped UUID which identifies the launched process - */ - uuid?: string; - /* - * Process exit code - */ - exitCode?: number; - }): void; - } - interface OpenFinWindowStatic { /** * Class: Window @@ -1179,7 +674,7 @@ declare namespace fin { * @param [callback.successObj] - httpResponseCode */ new ( - options: WindowOptions, + options: WindowOption, callback?: (successObj: { httpResponseCode: number }) => void, errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): OpenFinWindow; /** @@ -1242,7 +737,7 @@ declare namespace fin { /** * Performs the specified window transitions */ - animate(transitions: AnimationTransition, options: AnimationOptions, callback?: (event: any) => void, errorCallback?: (reason: string) => void): void; + animate(transitions: Transition, options: TransitionOptions, callback?: (event: any) => void, errorCallback?: (reason: string) => void): void; /** * Provides credentials to authentication requests */ @@ -1287,7 +782,7 @@ declare namespace fin { /** * Gets the current bounds (top, left, width, height) of the window. */ - getBounds(callback?: (bounds: WindowBounds) => void, errorCallback?: (reason: string) => void): void; + getBounds(callback?: (bounds: Bounds) => void, errorCallback?: (reason: string) => void): void; /** * Retrieves an array containing wrapped fin.desktop.Windows that are grouped with this window. If a window is not in a group an empty array is returned. * Please note that calling window is included in the result array. @@ -1296,7 +791,7 @@ declare namespace fin { /** * Gets the current settings of the window. */ - getOptions(callback?: (options: WindowOptions) => void, errorCallback?: (reason: string) => void): void; + getOptions(callback?: (options: WindowOption) => void, errorCallback?: (reason: string) => void): void; /** * Gets a base64 encoded PNG snapshot of the window. */ @@ -1363,11 +858,11 @@ declare namespace fin { /** * Resizes the window by a specified amount. */ - resizeBy(deltaWidth: number, deltaHeight: number, anchor: OpenFinAnchor, callback?: () => void, errorCallback?: (reason: string) => void): void; + resizeBy(deltaWidth: number, deltaHeight: number, anchor: AnchorType, callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Resizes the window by a specified amount. */ - resizeTo(width: number, height: number, anchor: OpenFinAnchor, callback?: () => void, errorCallback?: (reason: string) => void): void; + resizeTo(width: number, height: number, anchor: AnchorType, callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Restores the window to its normal state (i.e., unminimized, unmaximized). */ @@ -1400,7 +895,7 @@ declare namespace fin { /** * Updates the window using the passed options */ - updateOptions(options: WindowOptions, callback?: () => void, errorCallback?: (reason: string) => void): void; + updateOptions(options: WindowOption, callback?: () => void, errorCallback?: (reason: string) => void): void; } interface OpenFinFrameStatic { @@ -1469,51 +964,6 @@ declare namespace fin { type: "monitor-info-changed"; } - interface MonitorInfo { - nonPrimaryMonitors: MonitorInfoDetail[]; - primaryMonitor: MonitorInfoDetail; - reason: string; - taskbar: { - edge: "left" | "right" | "top" | "bottom", - rect: MontiorCoordinates - }; - topic: "system"; - type: "monitor-info-changed"; - virtualScreen: MontiorCoordinates; - } - - interface TrayIconInfo { - x: number; - y: number; - bounds: { - x: number; - y: number; - width: number; - height: number; - }; - monitorInfo: MonitorInfo; - } - - interface MonitorInfoDetail { - availableRect: MontiorCoordinates; - deviceId: string; - displayDeviceActive: boolean; - monitorRect: MontiorCoordinates; - name: string; - } - - interface MontiorCoordinates { - bottom: number; - left: number; - right: number; - top: number; - } - - interface VirtualScreenCoordinates { - left: number; - top: number; - } - interface SystemBaseEvent { topic: string; type: OpenFinSystemEventType; @@ -1713,96 +1163,6 @@ declare namespace fin { uuid: string; } - interface AnimationTransition { - opacity?: { - /** - * This value is clamped from 0.0 to 1.0 - */ - opacity?: number; - /** - * The total time in milliseconds this transition should take. - */ - duration?: number; - /** - * Treat 'opacity' as absolute or as a delta. Defaults to false. - */ - relative?: boolean; - }; - position?: { - /** - * Defaults to the window's current left position in virtual screen coordinates. - */ - left?: number; - /** - * Defaults to the window's current top position in virtual screen coordinates. - */ - top?: number; - /** - * The total time in milliseconds this transition should take. - */ - duration?: number; - /** - * Treat 'left' and 'top' as absolute or as deltas. Defaults to false. - */ - relative?: boolean; - }; - size?: { - /** - * Optional if height is present. Defaults to the window's current width. - */ - width?: number; - /** - * Optional if width is present. Defaults to the window's current height. - */ - height?: number; - /** - * The total time in milliseconds this transition should take. - */ - duration?: number; - /** - * Treat 'width' and 'height' as absolute or as deltas. Defaults to false. - */ - relative?: boolean; - }; - } - - interface AnimationOptions { - /** - * This option interrupts the current animation. When false it pushes this animation onto the end of the animation queue. - */ - interrupt?: boolean; - /** - * Transition effect. Defaults to 'ease-in-out'. - */ - tween?: OpenFinTweenType; - } - - interface WindowBounds { - /** - * the height of the window. - */ - height?: number; - /** - * left-most coordinate of the window. - */ - left?: number; - /** - * top-most coordinate of the window. - */ - top?: number; - /** - * the width of the window. - */ - width?: number; - } - - interface ExternalApplicationInfo { - parent: { - uuid: string; - name: string; - }; - } - interface SessionChangedEvent { /** * the action that triggered this event: @@ -1816,34 +1176,6 @@ declare namespace fin { type: "session-changed"; } - interface LaunchInfo { - launchMode: "fin-protocol" - | "fins-protocol" - | "shortcut" - | "command-line" - | "adapter" - | "other" - | string; - } - - type OpenFinTweenType = "linear" - | "ease-in" - | "ease-out" - | "ease-in-out" - | "ease-in-quad" - | "ease-out-quad" - | "ease-in-out-quad" - | "ease-in-cubic" - | "ease-out-cubic" - | "ease-in-out-cubic" - | "ease-out-bounce" - | "ease-in-back" - | "ease-out-back" - | "ease-in-out-back" - | "ease-in-elastic" - | "ease-out-elastic" - | "ease-in-out-elastic"; - type OpenFinApplicationEventType = "closed" | "connected" | "crashed" @@ -1899,9 +1231,4 @@ declare namespace fin { | "restored" | "show-requested" | "shown"; - - type OpenFinAnchor = "top-left" - | "top-right" - | "bottom-left" - | "bottom-right"; } diff --git a/types/openfin/openfin-tests.ts b/types/openfin/openfin-tests.ts index 6059f54de7..167a6c86be 100644 --- a/types/openfin/openfin-tests.ts +++ b/types/openfin/openfin-tests.ts @@ -78,8 +78,8 @@ function test_application() { }); // getTrayIconInfo application.getTrayIconInfo(info => { - console.log(info.x, info.y, info.bounds.x, info.bounds.y, info.bounds.height, info.bounds.width, - info.monitorInfo.type, info.monitorInfo.reason); + console.log(info.x, info.y, info.bounds.left, info.bounds.top, info.bounds.height, info.bounds.width, + info.monitorInfo.reason); }); // isRunning application.isRunning(running => { @@ -235,8 +235,7 @@ function test_system() { cache: true, cookies: true, localStorage: true, - appcache: true, - userData: true + appcache: true }); // deleteCacheOnExit fin.desktop.System.deleteCacheOnExit(() => { diff --git a/types/openfin/tsconfig.json b/types/openfin/tsconfig.json index 2a2c9d108b..a7f3e48849 100644 --- a/types/openfin/tsconfig.json +++ b/types/openfin/tsconfig.json @@ -21,6 +21,7 @@ "index.d.ts", "openfin-tests.ts", "_v2/api/application/application.d.ts", + "_v2/api/application/applicationOption.d.ts", "_v2/api/base.d.ts", "_v2/api/clipboard/clipboard.d.ts", "_v2/api/clipboard/write-request.d.ts", @@ -53,10 +54,12 @@ "_v2/api/system/rvm.d.ts", "_v2/api/system/system.d.ts", "_v2/api/system/window.d.ts", + "_v2/api/window/anchor-type.d.ts", "_v2/api/window/bounds-changed.d.ts", "_v2/api/window/bounds.d.ts", "_v2/api/window/transition.d.ts", "_v2/api/window/window.d.ts", + "_v2/api/window/windowOption.d.ts", "_v2/environment/environment.d.ts", "_v2/environment/node-env.d.ts", "_v2/environment/openfin-env.d.ts", diff --git a/types/openfin/v34/_v2/api/application/application.d.ts b/types/openfin/v34/_v2/api/application/application.d.ts new file mode 100644 index 0000000000..616501834d --- /dev/null +++ b/types/openfin/v34/_v2/api/application/application.d.ts @@ -0,0 +1,223 @@ +import { EmitterBase, Base, Reply, RuntimeEvent } from '../base'; +import { Identity } from '../../identity'; +import { _Window } from '../window/window'; +import { Point } from '../system/point'; +import { MonitorInfo } from '../system/monitor'; +import Transport from '../../transport/transport'; +import Bounds from '../window/bounds'; +export interface TrayIconClickReply extends Point, Reply<'application', 'tray-icon-clicked'> { + button: number; + monitorInfo: MonitorInfo; +} +export interface ApplicationInfo { + initialOptions: object; + launchMode: string; + manifest: object; + manifestUrl: string; + parentUuid?: string; + runtime: object; +} +export declare class NavigationRejectedReply extends Reply<'window-navigation-rejected', void> { + sourceName: string; + url: string; +} +export interface ConfigInterface { + desktop?: boolean; + startMenu?: boolean; + systemStartup?: boolean; +} +export interface TrayInfo { + bounds: Bounds; + monitorInfo: MonitorInfo; + x: number; + y: number; +} +export default class ApplicationModule extends Base { + /** + * Returns an Application object that represents an existing application. + * @param { Identity } indentity + * @return {Promise.} + * @tutorial Application.wrap + */ + wrap(identity: Identity): Promise; + /** + * Creates a new Application. + * @param {*} appOptions + * @return {Promise.} + * @tutorial Application.create + */ + create(appOptions: any): Promise; + /** + * Returns an Application object that represents the current application + * @return {Promise.} + * @tutorial Application.getCurrent + */ + getCurrent(): Promise; + /** + * Retrieves application's manifest and returns a wrapped application. + * @param {string} manifestUrl - The URL of app's manifest. + * @return {Promise.} + * @tutorial Application.createFromManifest + */ + createFromManifest(manifestUrl: string): Promise; +} +/** + * @classdesc An object representing an application. Allows the developer to create, + * execute, show/close an application as well as listen to application events. + * @class + */ +export declare class Application extends EmitterBase { + identity: Identity; + _manifestUrl?: string; + private window; + constructor(wire: Transport, identity: Identity); + protected runtimeEventComparator: (listener: RuntimeEvent) => boolean; + private windowListFromIdentityList; + /** + * Determines if the application is currently running. + * @return {Promise.} + * @tutorial Application.isRunning + */ + isRunning(): Promise; + /** + * Closes the application and any child windows created by the application. + * @param { boolean } [force = false] Close will be prevented from closing when force is false and + * ‘close-requested’ has been subscribed to for application’s main window. + * @return {Promise.} + * @tutorial Application.close + */ + close(force?: boolean): Promise; + /** + * Retrieves an array of wrapped fin.Windows for each of the application’s child windows. + * @return {Promise.Array.<_Window>} + * @tutorial Application.getChildWindows + */ + getChildWindows(): Promise>; + /** + * Retrieves an array of active window groups for all of the application's windows. Each group is + * represented as an array of wrapped fin.Windows. + * @return {Promise.Array.Array.<_Window>} + * @tutorial Application.getGroups + */ + getGroups(): Promise>>; + /** + * Retrieves the JSON manifest that was used to create the application. Invokes the error callback + * if the application was not created from a manifest. + * @return {Promise.} + * @tutorial Application.getManifest + */ + getManifest(): Promise; + /** + * Retrieves UUID of the application that launches this application. Invokes the error callback + * if the application was created from a manifest. + * @return {Promise.} + * @tutorial Application.getParentUuid + */ + getParentUuid(): Promise; + /** + * Retrieves current application's shortcut configuration. + * @return {Promise.} + * @tutorial Application.getShortcuts + */ + getShortcuts(): Promise; + /** + * Returns an instance of the main Window of the application + * @return {Promise.<_Window>} + * @tutorial Application.getWindow + */ + getWindow(): Promise<_Window>; + /** + * Manually registers a user with the licensing service. The only data sent by this call is userName and appName. + * @param { string } userName - username to be passed to the RVM. + * @param { string } appName - app name to be passed to the RVM. + * @return {Promise.} + * @tutorial Application.registerUser + */ + registerUser(userName: string, appName: string): Promise; + /** + * Removes the application’s icon from the tray. + * @return {Promise.} + * @tutorial Application.removeTrayIcon + */ + removeTrayIcon(): Promise; + /** + * Restarts the application. + * @return {Promise.} + * @tutorial Application.restart + */ + restart(): Promise; + /** + * Runs the application. When the application is created, run must be called. + * @return {Promise.} + * @tutorial Application.run + */ + run(): Promise; + /** + * Instructs the RVM to schedule one restart of the application. + * @return {Promise.} + * @tutorial Application.scheduleRestart + */ + scheduleRestart(): Promise; + /** + * Adds a customizable icon in the system tray and notifies the application when clicked. + * @param { string } iconUrl Image URL to be used as the icon + * @return {Promise.} + * @tutorial Application.setTrayIcon + */ + setTrayIcon(iconUrl: string): Promise; + /** + * Sets new application's shortcut configuration. + * @param { Object } config New application's shortcut configuration. + * @param {Boolean} [config.desktop] - Enable/disable desktop shortcut. + * @param {Boolean} [config.startMenu] - Enable/disable start menu shortcut. + * @param {Boolean} [config.systemStartup] - Enable/disable system startup shortcut. + * @return {Promise.} + * @tutorial Application.setShortcuts + */ + setShortcuts(config: ConfigInterface): Promise; + /** + * @summary Retrieves information about the system tray. + * @desc The only information currently returned is the position and dimensions. + * @return {Promise.} + * @tutorial Application.getTrayIconInfo + */ + getTrayIconInfo(): Promise; + /** + * Closes the application by terminating its process. + * @return {Promise.} + * @tutorial Application.terminate + */ + terminate(): Promise; + /** + * Waits for a hanging application. This method can be called in response to an application + * "not-responding" to allow the application to continue and to generate another "not-responding" + * message after a certain period of time. + * @return {Promise.} + * @ignore + */ + wait(): Promise; + /** + * Retrieves information about the application. + * @return {Promise.} + * @tutorial Application.getInfo + */ + getInfo(): Promise; +} +export interface Application { + on(type: 'closed', listener: (data: Reply<'application', 'closed'>) => void): Promise; + on(type: 'initialized', listener: (data: Reply<'application', 'initialized'>) => void): Promise; + on(type: 'connected', listener: (data: Reply<'application', 'connected'>) => void): Promise; + on(type: 'crashed', listener: (data: Reply<'application', 'crashed'>) => void): Promise; + on(type: 'error', listener: (data: Reply<'application', 'error'>) => void): Promise; + on(type: 'not-responding', listener: (data: Reply<'application', 'not-responding'>) => void): Promise; + on(type: 'out-of-memory', listener: (data: Reply<'application', 'out-of-memory'>) => void): Promise; + on(type: 'responding', listener: (data: Reply<'application', 'responding'>) => void): Promise; + on(type: 'started', listener: (data: Reply<'application', 'started'>) => void): Promise; + on(type: 'run-requested', listener: (data: Reply<'application', 'run-requested'>) => void): Promise; + on(type: 'window-navigation-rejected', listener: (data: NavigationRejectedReply) => void): Promise; + on(type: 'window-created', listener: (data: Reply<'application', 'window-created'>) => void): Promise; + on(type: 'window-closed', listener: (data: Reply<'application', 'window-closed'>) => void): Promise; + on(type: 'tray-icon-clicked', listener: (data: TrayIconClickReply) => void): Promise; + on(type: 'removeListener', listener: (eventType: string) => void): Promise; + on(type: 'newListener', listener: (eventType: string) => void): Promise; +} diff --git a/types/openfin/v34/_v2/api/base.d.ts b/types/openfin/v34/_v2/api/base.d.ts new file mode 100644 index 0000000000..1f17e1f24f --- /dev/null +++ b/types/openfin/v34/_v2/api/base.d.ts @@ -0,0 +1,43 @@ +/// +import Transport, { Message } from '../transport/transport'; +import { Identity } from '../identity'; +import { EventEmitter } from 'events'; +export interface RuntimeEvent extends Identity { + topic: string; + type: string | symbol; +} +export declare class Base { + wire: Transport; + constructor(wire: Transport); + private _topic; + protected topic: string; + readonly me: Identity; + protected isNodeEnvironment: () => boolean; + protected isOpenFinEnvironment: () => boolean; + protected runtimeEventComparator: (listener: RuntimeEvent) => boolean; +} +export declare class EmitterBase extends Base { + protected identity: Identity; + protected emitter: EventEmitter; + listeners: (event: string | symbol) => Function[]; + listenerCount: (type: string | symbol) => number; + constructor(wire: Transport); + emit: (eventName: string | symbol, ...args: any[]) => void; + protected onmessage: (message: Message) => boolean; + protected registerEventListener: (listener: RuntimeEvent) => Promise>; + protected deregisterEventListener: (listener: RuntimeEvent) => Promise>; + on(eventType: string, listener: (...args: any[]) => void): Promise; + addListener: (eventType: string, listener: (...args: any[]) => void) => Promise; + once(eventType: string, listener: (...args: any[]) => void): Promise; + prependListener(eventType: string, listener: (...args: any[]) => void): Promise; + prependOnceListener(eventType: string, listener: (...args: any[]) => void): Promise; + removeListener(eventType: string, listener: (...args: any[]) => void): Promise; + protected deregisterAllListeners: (eventType: string | symbol) => Promise>; + removeAllListeners(eventType?: string): Promise; +} +export declare class Reply implements Identity { + topic: TOPIC; + type: TYPE; + uuid: string; + name?: string; +} diff --git a/types/openfin/v34/_v2/api/clipboard/clipboard.d.ts b/types/openfin/v34/_v2/api/clipboard/clipboard.d.ts new file mode 100644 index 0000000000..11b466dea0 --- /dev/null +++ b/types/openfin/v34/_v2/api/clipboard/clipboard.d.ts @@ -0,0 +1,70 @@ +import { Base } from '../base'; +import { WriteRequestType, WriteAnyRequestType } from './write-request'; +/** + * WriteRequestType interface + * @typedef { Object } WriteRequestType + * @property { string } name The name of the running application + * @property { string } uuid The uuid of the running application + */ +/** + * The Clipboard API allows reading and writing to the clipboard in multiple formats. + * @namespace +*/ +export default class Clipboard extends Base { + /** + * Writes data into the clipboard as plain text + * @param { WriteRequestType } writeObj This object is described in the WriteRequestType typeof + * @return {Promise.} + * @tutorial Clipboard.writeText + */ + writeText(writeObj: WriteRequestType): Promise; + /** + * Read the content of the clipboard as plain text + * @param { string } type Clipboard Type + * @return {Promise.} + * @tutorial Clipboard.readText + */ + readText(type?: string): Promise; + /** + * Writes data into the clipboard as Html + * @param { WriteRequestType } writeObj This object is described in the WriteRequestType typedef + * @return {Promise.} + * @tutorial Clipboard.writeHtml + */ + writeHtml(writeObj: WriteRequestType): Promise; + /** + * Read the content of the clipboard as Html + * @param { string } type Clipboard Type + * @return {Promise.} + * @tutorial Clipboard.readHtml + */ + readHtml(type?: string): Promise; + /** + * Writes data into the clipboard as Rtf + * @param { WriteRequestType } writeObj This object is described in the WriteRequestType typedef + * @return {Promise.} + * @tutorial Clipboard.writeRtf + */ + writeRtf(writeObj: WriteRequestType): Promise; + /** + * Read the content of the clipboard as Rtf + * @param { string } type Clipboard Type + * @return {Promise.} + * @tutorial Clipboard.readRtf + */ + readRtf(type?: string): Promise; + /** + * Writes data into the clipboard + * @param { WriteRequestType } writeObj This object is described in the WriteRequestType typedef + * @return {Promise.} + * @tutorial Clipboard.write + */ + write(writeObj: WriteAnyRequestType): Promise; + /** + * Reads available formats for the clipboard type + * @param { string } type Clipboard Type + * @return {Promise.Array.} + * @tutorial Clipboard.getAvailableFormats + */ + getAvailableFormats(type?: string): Promise>; +} diff --git a/types/openfin/v34/_v2/api/clipboard/write-request.d.ts b/types/openfin/v34/_v2/api/clipboard/write-request.d.ts new file mode 100644 index 0000000000..a2fc5c333e --- /dev/null +++ b/types/openfin/v34/_v2/api/clipboard/write-request.d.ts @@ -0,0 +1,12 @@ +export interface WriteRequestType { + data: string; + type?: string; +} +export interface WriteAnyRequestType { + data: { + text?: string; + html?: string; + rtf?: string; + }; + type?: string; +} diff --git a/types/openfin/v34/_v2/api/external-application/external-application.d.ts b/types/openfin/v34/_v2/api/external-application/external-application.d.ts new file mode 100644 index 0000000000..2d1f46e0f3 --- /dev/null +++ b/types/openfin/v34/_v2/api/external-application/external-application.d.ts @@ -0,0 +1,36 @@ +import { Base, EmitterBase, Reply } from '../base'; +import { Identity } from '../../identity'; +import Transport from '../../transport/transport'; +export interface ExternalApplicationInfo { + parent: Identity; +} +export default class ExternalApplicationModule extends Base { + /** + * Returns an External Application object that represents an existing external application. + * @param {string} uuid The UUID of the external application to be wrapped + * @return {Promise.} + */ + wrap(uuid: string): Promise; +} +/** + * @classdesc An ExternalApplication object representing an application. Allows + * the developer to create, execute, show and close an external application as + * well as listen to application events. + * @class + */ +export declare class ExternalApplication extends EmitterBase { + identity: Identity; + constructor(wire: Transport, identity: Identity); + /** + * Retrieves information about the external application. + * @return {Promise.} + * @tutorial ExternalApplication.getInfo + */ + getInfo(): Promise; +} +export interface ExternalApplication { + on(type: 'connected', listener: (data: Reply<'externalapplication', 'connected'>) => void): Promise; + on(type: 'disconnected', listener: (data: Reply<'externalapplication', 'disconnected'>) => void): Promise; + on(type: 'removeListener', listener: (eventType: string) => void): Promise; + on(type: 'newListener', listener: (eventType: string) => void): Promise; +} diff --git a/types/openfin/v34/_v2/api/fin.d.ts b/types/openfin/v34/_v2/api/fin.d.ts new file mode 100644 index 0000000000..1bec2ffb4f --- /dev/null +++ b/types/openfin/v34/_v2/api/fin.d.ts @@ -0,0 +1,27 @@ +/// +import Transport from '../transport/transport'; +import { EventEmitter } from 'events'; +import System from './system/system'; +import _WindowModule from './window/window'; +import Application from './application/application'; +import InterApplicationBus from './interappbus/interappbus'; +import _NotificationModule from './notification/notification'; +import Clipbpard from './clipboard/clipboard'; +import ExternalApplication from './external-application/external-application'; +import _FrameModule from './frame/frame'; +import GlobalHotkey from './global-hotkey'; +import { Identity } from '../identity'; +export default class Fin extends EventEmitter { + private wire; + System: System; + Window: _WindowModule; + Application: Application; + InterApplicationBus: InterApplicationBus; + Notification: _NotificationModule; + Clipboard: Clipbpard; + ExternalApplication: ExternalApplication; + Frame: _FrameModule; + GlobalHotkey: GlobalHotkey; + readonly me: Identity; + constructor(wire: Transport); +} diff --git a/types/openfin/v34/_v2/api/frame/frame.d.ts b/types/openfin/v34/_v2/api/frame/frame.d.ts new file mode 100644 index 0000000000..4a5ab971de --- /dev/null +++ b/types/openfin/v34/_v2/api/frame/frame.d.ts @@ -0,0 +1,51 @@ +import { Base, EmitterBase } from '../base'; +import { Identity } from '../../identity'; +import Transport from '../../transport/transport'; +export declare type EntityType = 'window' | 'iframe' | 'external connection' | 'unknown'; +export interface FrameInfo { + uuid: string; + name: string; + entityType: EntityType; + parent: Identity; +} +export default class _FrameModule extends Base { + /** + * Gets a reference to the specified frame. The frame does not have to exist + * @param {string} uuid - uuid of the frame you want to wrap + * @param {string} name - name of the frame you want to wrap + * @return {Promise.<_Frame>} + */ + wrap(uuid: string, name: string): Promise<_Frame>; + /** + * Get a reference to the current frame + * @return {Promise.<_Frame>} + */ + getCurrent(): Promise<_Frame>; +} +/** + * @classdesc Represents a way to interact with `iframes`. Facilitates discovery of current context + * (iframe or main window) as well as the ability to listen for frame-specific events. + * @class + * @alias Frame + */ +export declare class _Frame extends EmitterBase { + identity: Identity; + constructor(wire: Transport, identity: Identity); + /** + * Returns a frame info object for the represented frame + * @return {Promise.} + * @tutorial Frame.getInfo + */ + getInfo(): Promise; + /** + * Returns a frame info object representing the window that the referenced iframe is + * currently embedded in + * @return {Promise.} + * @tutorial Frame.getParentWindow + */ + getParentWindow(): Promise; +} +export interface _Frame { + on(type: 'connected', listener: (eventType: string) => void): Promise; + on(type: 'disconnected', listener: (eventType: string) => void): Promise; +} diff --git a/types/openfin/v34/_v2/api/global-hotkey/index.d.ts b/types/openfin/v34/_v2/api/global-hotkey/index.d.ts new file mode 100644 index 0000000000..148ddff7e9 --- /dev/null +++ b/types/openfin/v34/_v2/api/global-hotkey/index.d.ts @@ -0,0 +1,33 @@ +import { EmitterBase } from '../base'; +import Transport from '../../transport/transport'; +/** + * The GlobalHotkey module can register/unregister a global hotkeys. + * @namespace + */ +export default class GlobalHotkey extends EmitterBase { + constructor(wire: Transport); + /** + * Registers a global hotkey with the operating system. + * @return {Promise.} + * @tutorial GlobalHotkey.register + */ + register(hotkey: string, listener: (...args: any[]) => void): Promise; + /** + * Unregisters a global hotkey with the operating system. + * @return {Promise.} + * @tutorial GlobalHotkey.unregister + */ + unregister(hotkey: string): Promise; + /** + * Unregisters all global hotkeys for the current application. + * @return {Promise.} + * @tutorial GlobalHotkey.unregisterAll + */ + unregisterAll(): Promise; + /** + * Checks if a given hotkey has been registered + * @return {Promise.} + * @tutorial GlobalHotkey.isRegistered + */ + isRegistered(hotkey: string): Promise; +} diff --git a/types/openfin/v34/_v2/api/interappbus/channel/channel.d.ts b/types/openfin/v34/_v2/api/interappbus/channel/channel.d.ts new file mode 100644 index 0000000000..1c9a502e12 --- /dev/null +++ b/types/openfin/v34/_v2/api/interappbus/channel/channel.d.ts @@ -0,0 +1,31 @@ +import { Identity } from '../../../identity'; +import Transport, { Message } from '../../../transport/transport'; +export interface ProviderIdentity extends Identity { + channelId: string; + isExternal?: boolean; + channelName: string; +} +export declare type Action = (() => any) | ((payload: any) => any) | ((payload: any, id: ProviderIdentity) => any); +export declare type Middleware = (() => any) | ((action: string) => any) | ((action: string, payload: any) => any) | ((action: string, payload: any, id: ProviderIdentity) => any); +export interface ChannelMessagePayload extends Identity { + action: string; + payload: any; +} +export declare class ChannelBase { + protected subscriptions: any; + defaultAction: (action?: string, payload?: any, senderIdentity?: ProviderIdentity) => any; + private preAction; + private postAction; + private errorMiddleware; + private defaultSet; + protected send: (to: Identity, action: string, payload: any) => Promise>; + protected providerIdentity: ProviderIdentity; + constructor(providerIdentity: ProviderIdentity, send: Transport['sendAction']); + processAction(action: string, payload: any, senderIdentity: ProviderIdentity): Promise; + beforeAction(func: Action): void; + onError(func: (e: any, action: string, id: Identity) => any): void; + afterAction(func: Action): void; + remove(action: string): void; + setDefaultAction(func: (action?: string, payload?: any, senderIdentity?: ProviderIdentity) => any): void; + register(topic: string, listener: Action): boolean; +} diff --git a/types/openfin/v34/_v2/api/interappbus/channel/client.d.ts b/types/openfin/v34/_v2/api/interappbus/channel/client.d.ts new file mode 100644 index 0000000000..d1c128a349 --- /dev/null +++ b/types/openfin/v34/_v2/api/interappbus/channel/client.d.ts @@ -0,0 +1,6 @@ +import { ChannelBase, ProviderIdentity } from './channel'; +import Transport from '../../../transport/transport'; +export declare class ChannelClient extends ChannelBase { + constructor(providerIdentity: ProviderIdentity, send: Transport['sendAction']); + dispatch(action: string, payload?: any): Promise; +} diff --git a/types/openfin/v34/_v2/api/interappbus/channel/index.d.ts b/types/openfin/v34/_v2/api/interappbus/channel/index.d.ts new file mode 100644 index 0000000000..1297d2c5ea --- /dev/null +++ b/types/openfin/v34/_v2/api/interappbus/channel/index.d.ts @@ -0,0 +1,33 @@ +import { ChannelClient } from './client'; +import { Identity } from '../../../identity'; +import { ChannelProvider } from './provider'; +import { EmitterBase } from '../../base'; +import Transport, { Message, Payload } from '../../../transport/transport'; +import { ProviderIdentity } from './channel'; +export interface Options { + wait?: boolean; + uuid: string; + name?: string; + payload?: any; +} +export interface ChannelPayload { + payload: Payload; +} +export interface ChannelMessage { + senderIdentity: Identity; + ackToSender: any; + providerIdentity: Identity; + connectAction: boolean; +} +export declare class Channel extends EmitterBase { + private channelMap; + constructor(wire: Transport); + getAllChannels(): Promise; + onChannelConnect(listener: Function): Promise; + onChannelDisconnect(listener: Function): Promise; + connect(options: Options): Promise; + create(channelName?: string): Promise; + onmessage: (msg: Message) => boolean; + private processChannelMessage; + private processChannelConnection; +} diff --git a/types/openfin/v34/_v2/api/interappbus/channel/provider.d.ts b/types/openfin/v34/_v2/api/interappbus/channel/provider.d.ts new file mode 100644 index 0000000000..a869928ac2 --- /dev/null +++ b/types/openfin/v34/_v2/api/interappbus/channel/provider.d.ts @@ -0,0 +1,13 @@ +import { ChannelBase, ProviderIdentity } from './channel'; +import Transport from '../../../transport/transport'; +export declare type ConnectionListener = (adapterIdentity: ProviderIdentity, connectionMessage?: any) => any; +export declare class ChannelProvider extends ChannelBase { + private connectListener; + private disconnectListener; + connections: ProviderIdentity[]; + constructor(providerIdentity: ProviderIdentity, send: Transport['sendAction']); + dispatch(to: ProviderIdentity, action: string, payload: any): Promise; + processConnection(senderId: ProviderIdentity, payload: any): Promise; + publish(action: string, payload: any): Promise[]; + onConnection(listener: ConnectionListener): void; +} diff --git a/types/openfin/v34/_v2/api/interappbus/interappbus.d.ts b/types/openfin/v34/_v2/api/interappbus/interappbus.d.ts new file mode 100644 index 0000000000..48aaf7430c --- /dev/null +++ b/types/openfin/v34/_v2/api/interappbus/interappbus.d.ts @@ -0,0 +1,80 @@ +/// +import { Base } from '../base'; +import { Identity } from '../../identity'; +import Transport, { Message } from '../../transport/transport'; +import { EventEmitter } from 'events'; +import { Channel } from './channel/index'; +/** + * A messaging bus that allows for pub/sub messaging between different applications. + * @namespace +*/ +export default class InterApplicationBus extends Base { + Channel: Channel; + events: { + subscriberAdded: string; + subscriberRemoved: string; + }; + private refCounter; + protected emitter: EventEmitter; + on: any; + removeAllListeners: any; + constructor(wire: Transport); + /** + * Publishes a message to all applications running on OpenFin Runtime that + * are subscribed to the specified topic. + * @param { string } topic The topic on which the message is sent + * @param { any } message The message to be published. Can be either a primitive + * data type (string, number, or boolean) or composite data type (object, array) + * that is composed of other primitive or composite data types + * @return {Promise.} + * @tutorial InterApplicationBus.publish + */ + publish(topic: string, message: any): Promise; + /** + * Sends a message to a specific application on a specific topic. + * @param { object } destination The uuid of the application to which the message is sent + * @param { string } topic The topic on which the message is sent + * @param { any } message The message to be sent. Can be either a primitive data + * type (string, number, or boolean) or composite data type (object, array) that + * is composed of other primitive or composite data types + * @return {Promise.} + * @tutorial InterApplicationBus.send + */ + send(destination: Identity, topic: string, message: any): Promise; + /** + * Subscribes to messages from the specified application on the specified topic. + * If the subscription is for a uuid, [name], topic combination that has already + * been published to upon subscription you will receive the last 20 missed messages + * in the order they were published. + * @param { Identity } source This object is described in the Identity in the typedef + * @param { string } topic The topic on which the message is sent + * @param { function } listener A function that is called when a message has + * been received. It is passed the message, uuid and name of the sending application. + * The message can be either a primitive data type (string, number, or boolean) or + * composite data type (object, array) that is composed of other primitive or composite + * data types + * @return {Promise.} + * @tutorial InterApplicationBus.subcribe + */ + subscribe(source: Identity, topic: string, listener: any): Promise; + /** + * Unsubscribes to messages from the specified application on the specified topic. + * @param { Identity } source This object is described in the Identity in the typedef + * @param { string } topic The topic on which the message is sent + * @param { function } listener A callback previously registered with subscribe() + * @return {Promise.} + * @tutorial InterApplicationBus.unsubscribe + */ + unsubscribe(source: Identity, topic: string, listener: any): Promise; + private processMessage; + private emitSubscriverEvent; + protected createSubscriptionKey(uuid: string, name: string, topic: string): string; + protected onmessage(message: Message): boolean; +} +export declare class InterAppPayload { + sourceUuid: string; + sourceWindowName: string; + topic: string; + destinationUuid?: string; + message?: any; +} diff --git a/types/openfin/v34/_v2/api/notification/notification.d.ts b/types/openfin/v34/_v2/api/notification/notification.d.ts new file mode 100644 index 0000000000..8deec180ba --- /dev/null +++ b/types/openfin/v34/_v2/api/notification/notification.d.ts @@ -0,0 +1,71 @@ +import { Base, EmitterBase } from '../base'; +import { Identity } from '../../identity'; +import Transport from '../../transport/transport'; +export declare class NotificationOptions { + url: string; + message: string; + timeout: string | number; + notificationId: number; + uuidOfProxiedApp: string; + ignoreMouseOver: boolean; + constructor(options: any, identity: Identity, notificationId: number); +} +export interface NotificationCallback { + message?: any; +} +/** + * @classdesc A Notification object represents a window on OpenFin Runtime which + * is shown briefly to the user on the bottom-right corner of the primary monitor. + * A notification is typically used to alert the user of some important event which + * requires his or her attention. Notifications are a child or your application that + * are controlled by the runtime. + * @class + * @alias Notification + */ +export declare class _Notification extends EmitterBase { + private listenerList; + private unhookAllListeners; + private buildLocalPayload; + protected options: NotificationOptions; + protected generalListener: (msg: any) => void; + protected notificationId: number; + protected onmessage: (message: any) => boolean; + constructor(wire: Transport, options: NotificationOptions); + url: string; + timeout: number | string; + message: any; + /** + * Invoked when the notification is shown + * @return {Promise.} + * @tutorial Notification.show + */ + show(): Promise; + /** + * Sends a message to the notification. + * @param { any } message The message to be sent to the notification. + * Can be either a primitive data type (string, number, or boolean) + * or composite data type (object, array) that is composed of other + * primitive or composite data types + * @return {Promise.} + * @tutorial Notification.sendMessage + */ + sendMessage(message: any): Promise; + /** + * Closes the notification + * @return {Promise.} + * @tutorial Notification.close + */ + close(): Promise; +} +export default class _NotificationModule extends Base { + private nextNoteId; + private genNoteId; + events: { + show: string; + close: string; + error: string; + click: string; + message: string; + }; + create(options: any): _Notification; +} diff --git a/types/openfin/v34/_v2/api/system/application.d.ts b/types/openfin/v34/_v2/api/system/application.d.ts new file mode 100644 index 0000000000..9d7ea09b67 --- /dev/null +++ b/types/openfin/v34/_v2/api/system/application.d.ts @@ -0,0 +1,4 @@ +export interface ApplicationInfo { + isRunning: boolean; + uuid: string; +} diff --git a/types/openfin/v34/_v2/api/system/clearCacheOption.d.ts b/types/openfin/v34/_v2/api/system/clearCacheOption.d.ts new file mode 100644 index 0000000000..6bae8116b7 --- /dev/null +++ b/types/openfin/v34/_v2/api/system/clearCacheOption.d.ts @@ -0,0 +1,6 @@ +export interface ClearCacheOption { + appcache?: boolean; + cache?: boolean; + cookies?: boolean; + localStorage?: boolean; +} diff --git a/types/openfin/v34/_v2/api/system/cookie.d.ts b/types/openfin/v34/_v2/api/system/cookie.d.ts new file mode 100644 index 0000000000..1d229232c6 --- /dev/null +++ b/types/openfin/v34/_v2/api/system/cookie.d.ts @@ -0,0 +1,8 @@ +export interface CookieInfo { + name: string; + domain: string; + path: string; +} +export interface CookieOption { + name: string; +} diff --git a/types/openfin/v34/_v2/api/system/crashReporterOption.d.ts b/types/openfin/v34/_v2/api/system/crashReporterOption.d.ts new file mode 100644 index 0000000000..7d512fdd7b --- /dev/null +++ b/types/openfin/v34/_v2/api/system/crashReporterOption.d.ts @@ -0,0 +1,4 @@ +export interface CrashReporterOption { + diagnosticMode: boolean; + isRunning?: boolean; +} diff --git a/types/openfin/v34/_v2/api/system/download-asset.d.ts b/types/openfin/v34/_v2/api/system/download-asset.d.ts new file mode 100644 index 0000000000..be513f5f0e --- /dev/null +++ b/types/openfin/v34/_v2/api/system/download-asset.d.ts @@ -0,0 +1,18 @@ +export interface AppAssetInfo { + src: string; + alias: string; + version: string; + target?: string; + args?: string; + mandatory?: boolean; +} +export interface RuntimeDownloadOptions { + version: string; +} +export interface AppAssetRequest { + alias: string; +} +export interface RuntimeDownloadProgress { + downloadedBytes: number; + totalBytes: number; +} diff --git a/types/openfin/v34/_v2/api/system/download-preload.d.ts b/types/openfin/v34/_v2/api/system/download-preload.d.ts new file mode 100644 index 0000000000..a7e635bcb8 --- /dev/null +++ b/types/openfin/v34/_v2/api/system/download-preload.d.ts @@ -0,0 +1,8 @@ +export interface DownloadPreloadOption { + url: string; +} +export interface DownloadPreloadInfo { + success: boolean; + url?: string; + error: string; +} diff --git a/types/openfin/v34/_v2/api/system/entity.d.ts b/types/openfin/v34/_v2/api/system/entity.d.ts new file mode 100644 index 0000000000..50011a64f3 --- /dev/null +++ b/types/openfin/v34/_v2/api/system/entity.d.ts @@ -0,0 +1,11 @@ +import { Identity } from '../../identity'; +export interface Entity { + type: string; + uuid: string; +} +export interface EntityInfo { + name: string; + uuid: string; + parent: Identity; + entityType: string; +} diff --git a/types/openfin/v34/_v2/api/system/external-process.d.ts b/types/openfin/v34/_v2/api/system/external-process.d.ts new file mode 100644 index 0000000000..8a68f1eae3 --- /dev/null +++ b/types/openfin/v34/_v2/api/system/external-process.d.ts @@ -0,0 +1,22 @@ +export interface ExternalProcessRequestType { + path: string; + arguments: string; + listener: LaunchExternalProcessListener; +} +export interface ExitCode { + topic: string; + uuid: string; + exitCode: number; +} +export interface LaunchExternalProcessListener { + (code: ExitCode): void; +} +export interface TerminateExternalRequestType { + uuid: string; + timeout: number; + killTree: boolean; +} +export interface ExternalConnection { + token: string; + uuid: string; +} diff --git a/types/openfin/v34/_v2/api/system/host-specs.d.ts b/types/openfin/v34/_v2/api/system/host-specs.d.ts new file mode 100644 index 0000000000..2c5a134aea --- /dev/null +++ b/types/openfin/v34/_v2/api/system/host-specs.d.ts @@ -0,0 +1,22 @@ +export interface Time { + user: number; + nice: number; + sys: number; + idle: number; + irq: number; +} +export interface CpuInfo { + model: string; + speed: number; + times: Time; +} +export interface GpuInfo { + name: string; +} +export interface HostSpecs { + cpu: CpuInfo[]; + memory: number; + arch: string; + name: string; + gpu: GpuInfo; +} diff --git a/types/openfin/v34/_v2/api/system/log.d.ts b/types/openfin/v34/_v2/api/system/log.d.ts new file mode 100644 index 0000000000..9b03b28c57 --- /dev/null +++ b/types/openfin/v34/_v2/api/system/log.d.ts @@ -0,0 +1,11 @@ +export interface GetLogRequestType { + name: string; + endFile?: string; + sizeLimit?: number; +} +export interface LogInfo { + name: string; + size: number; + date: string; +} +export declare type LogLevel = 'verbose' | 'info' | 'warning' | 'error' | 'fatal'; diff --git a/types/openfin/v34/_v2/api/system/monitor.d.ts b/types/openfin/v34/_v2/api/system/monitor.d.ts new file mode 100644 index 0000000000..ea4aed799c --- /dev/null +++ b/types/openfin/v34/_v2/api/system/monitor.d.ts @@ -0,0 +1,39 @@ +import { Point } from './point'; +export interface MonitorInfo { + deviceScaleFactor: number; + dpi: Point; + nonPrimaryMonitors: Array; + primaryMonitor: MonitorDetails; + reason: string; + taskBar: TaskBar; + virtualScreen: DipRect; +} +export interface MonitorDetails { + available: DipScaleRects; + availableRect: Rect; + deviceId: string; + displayDeviceActive: boolean; + deviceScaleFactor: number; + monitorRect: Rect; + name: number; + dpi: Point; + monitor: DipScaleRects; +} +export interface Rect { + bottom: number; + left: number; + right: number; + top: number; +} +export interface DipRect extends Rect { + dipRect: Rect; + scaledRect: Rect; +} +export interface DipScaleRects { + dipRect: Rect; + scaledRect: Rect; +} +export interface TaskBar extends DipScaleRects { + edge: string; + rect: Rect; +} diff --git a/types/openfin/v34/_v2/api/system/point.d.ts b/types/openfin/v34/_v2/api/system/point.d.ts new file mode 100644 index 0000000000..b9830ce514 --- /dev/null +++ b/types/openfin/v34/_v2/api/system/point.d.ts @@ -0,0 +1,8 @@ +export interface Point { + x: number; + y: number; +} +export interface PointTopLeft { + top: number; + left: number; +} diff --git a/types/openfin/v34/_v2/api/system/process.d.ts b/types/openfin/v34/_v2/api/system/process.d.ts new file mode 100644 index 0000000000..8a513ceecd --- /dev/null +++ b/types/openfin/v34/_v2/api/system/process.d.ts @@ -0,0 +1,15 @@ +export interface ProcessInfo { + cpuUsage: number; + name: string; + nonPagedPoolUsage: number; + pageFaultCount: number; + pagedPoolUsage: number; + pagefileUsage: number; + peakNonPagedPoolUsage: number; + peakPagedPoolUsage: number; + peakPagefileUsage: number; + peakWorkingSetSize: number; + processId: number; + uuid: string; + workingSetSize: number; +} diff --git a/types/openfin/v34/_v2/api/system/proxy.d.ts b/types/openfin/v34/_v2/api/system/proxy.d.ts new file mode 100644 index 0000000000..597afa6548 --- /dev/null +++ b/types/openfin/v34/_v2/api/system/proxy.d.ts @@ -0,0 +1,14 @@ +export interface ProxyInfo { + config: ProxyConfig; + system: { + autoConfigUrl: string; + bypass: ''; + enabled: boolean; + proxy: string; + }; +} +export interface ProxyConfig { + proxyAddress: string; + proxyPort: number; + type: string; +} diff --git a/types/openfin/v34/_v2/api/system/registry-info.d.ts b/types/openfin/v34/_v2/api/system/registry-info.d.ts new file mode 100644 index 0000000000..a48ed34959 --- /dev/null +++ b/types/openfin/v34/_v2/api/system/registry-info.d.ts @@ -0,0 +1,7 @@ +export interface RegistryInfo { + data: any; + rootKey: string; + subkey: string; + type: string; + value: string; +} diff --git a/types/openfin/v34/_v2/api/system/runtime-info.d.ts b/types/openfin/v34/_v2/api/system/runtime-info.d.ts new file mode 100644 index 0000000000..1508f87ef3 --- /dev/null +++ b/types/openfin/v34/_v2/api/system/runtime-info.d.ts @@ -0,0 +1,7 @@ +export interface RuntimeInfo { + architecture: string; + manifestUrl: string; + port: number; + securityRealm?: string; + version: string; +} diff --git a/types/openfin/v34/_v2/api/system/rvm.d.ts b/types/openfin/v34/_v2/api/system/rvm.d.ts new file mode 100644 index 0000000000..42fc0b94db --- /dev/null +++ b/types/openfin/v34/_v2/api/system/rvm.d.ts @@ -0,0 +1,5 @@ +export interface RVMInfo { + action: string; + 'start-time': string; + version: string; +} diff --git a/types/openfin/v34/_v2/api/system/system.d.ts b/types/openfin/v34/_v2/api/system/system.d.ts new file mode 100644 index 0000000000..8c0bc7d3b6 --- /dev/null +++ b/types/openfin/v34/_v2/api/system/system.d.ts @@ -0,0 +1,475 @@ +import { EmitterBase } from '../base'; +import { ApplicationInfo } from './application'; +import { WindowInfo } from './window'; +import { Identity } from '../../identity'; +import { MonitorInfo } from './monitor'; +import { PointTopLeft } from './point'; +import { GetLogRequestType, LogInfo, LogLevel } from './log'; +import { ProxyInfo, ProxyConfig } from './proxy'; +import { ProcessInfo } from './process'; +import { AppAssetInfo, AppAssetRequest, RuntimeDownloadOptions, RuntimeDownloadProgress } from './download-asset'; +import { RVMInfo } from './rvm'; +import { RuntimeInfo } from './runtime-info'; +import { Entity, EntityInfo } from './entity'; +import { HostSpecs } from './host-specs'; +import { ExternalProcessRequestType, TerminateExternalRequestType, ExternalConnection } from './external-process'; +import Transport from '../../transport/transport'; +import { CookieInfo, CookieOption } from './cookie'; +import { RegistryInfo } from './registry-info'; +import { DownloadPreloadOption, DownloadPreloadInfo } from './download-preload'; +import { ClearCacheOption } from './clearCacheOption'; +import { CrashReporterOption } from './crashReporterOption'; +/** + * AppAssetInfo interface + * @typedef { Object } AppAssetInfo + * @property { string } src The URL to a zip file containing the package files (executables, dlls, etc…) + * @property { string } alias The name of the asset + * @property { string } version The version of the package + * @property { string } target Specify default executable to launch. This option can be overridden in launchExternalProcess + * @property { args } args The default command line arguments for the aforementioned target. + * @property { boolean } mandatory When set to true, the app will fail to load if the asset cannot be downloaded. + * When set to false, the app will continue to load if the asset cannot be downloaded. (Default: true) + */ +/** + * AppAssetRequest interface + * @typedef { Object } AppAssetRequest + * @property { string } alias The name of the asset + */ +/** + * CookieInfo interface + * @typedef { Object } CookieInfo + * @property { string } name The name of the cookie + * @property { string } domain The domain of the cookie + * @property { string } path The path of the cookie + */ +/** + * CookieOption interface + * @typedef { Object } CookieOption + * @property { string } name The name of the cookie + */ +/** + * ExternalConnection interface + * @typedef { Object } ExternalConnection + * @property { string } token The token to broker an external connection + * @property { string } uuid The uuid of the external connection + */ +/** +* ExternalProcessRequestType interface +* @typedef { Object } ExternalProcessRequestType +* @property { string } path The file path to where the running application resides +* @property { string } arguments The argument passed to the running application +* @property { Object } listener This is described in the {LaunchExternalProcessListner} type definition +*/ +/** + * Entity interface + * @typedef { Object } Entity + * @property { string } type The type of the entity + * @property { string } uuid The uuid of the entity + */ +/** + * EntityInfo interface + * @typedef { Object } EntityInfo + * @property { string } name The name of the entity + * @property { string } uuid The uuid of the entity + * @property { Identity } parent The parent of the entity + * @property { string } entityType The type of the entity + */ +/** +* GetLogRequestType interface +* @typedef { Object } GetLogRequestType +* @property { string } name The name of the running application +* @property { number } endFile The file length of the log file +* @property { number } sizeLimit The set size limit of the log file +*/ +/** + * Identity interface + * @typedef { Object } Identity + * @property { string } name The name of the application + * @property { string } uuid The uuid of the application + */ +/** + * @typedef { verbose | info | warning | error | fatal } LogLevel + * @summary Log verbosity levels. + * @desc Describes the minimum level (inclusive) above which logs will be written + * + * @property { string } verbose all logs written + * @property { string } info info and above + * @property { string } warning warning and above + * @property { string } error error and above + * @property { string } fatal fatal only, indicates a crash is imminent + */ +/** + * ProxyConfig interface + * @typedef { Object } ProxyConfig + * @property { numder } proxyPort The port number of the running application + * @property { string } proxyAddress The address of the running application + * @property { string } type + */ +/** + * RegistryInfo interface + * @typedef { Object } RegistryInfo + * @property { any } data The registry data + * @property { string } rootKey The registry root key + * @property { string } subkey The registry key + * @property { string } type The registry type + * @property { string } value The registry value name + */ +/** + * RuntimeDownloadOptions interface + * @typedef { Object } RuntimeDownloadOptions + * @desc These are the options object required by the downloadRuntime function. + * @property { string } version The given version to download + */ +/** + * TerminateExternalRequestType interface + * @typedef { Object } TerminateExternalRequestType + * @property { string } uuid The uuid of the running application + * @property { number } timeout Time out period before the running application terminates + * @property { boolean } killtree Value to terminate the running application + */ +/** + * DownloadPreloadOption interface + * @typedef { Object } DownloadPreloadOption + * @desc These are the options object required by the downloadPreloadScripts function + * @property { string } url url to the preload script + */ +/** + * DownloadPreloadInfo interface + * @typedef { Object } DownloadPreloadInfo + * @desc downloadPreloadScripts function return value + * @property { string } url url to the preload script + * @property { string } error error during preload script acquisition + * @property { boolean } succeess download operation success + */ +/** + * @typedef { Object } ClearCacheOption + * @summary Clear cache options. + * @desc These are the options required by the clearCache function. + * + * @property {boolean} appcache html5 application cache + * @property {boolean} cache browser data cache for html files and images + * @property {boolean} cookies browser cookies + * @property {boolean} localStorage browser data that can be used across sessions + */ +/** +* CrashReporterOption interface +* @typedef { Object } CrashReporterOption +* @property { boolean } diagnosticMode In diagnostic mode the crash reporter will send diagnostic logs to +* the OpenFin reporting service on runtime shutdown +* @property { boolean } isRunning check if it's running +*/ +/** + * An object representing the core of OpenFin Runtime. Allows the developer + * to perform system-level actions, such as accessing logs, viewing processes, + * clearing the cache and exiting the runtime. + * @namespace + */ +export default class System extends EmitterBase { + constructor(wire: Transport); + /** + * Returns the version of the runtime. The version contains the major, minor, + * build and revision numbers. + * @return {Promise.} + * @tutorial System.getVersion + */ + getVersion(): Promise; + /** + * Clears cached data containing application resource + * files (images, HTML, JavaScript files), cookies, and items stored in the + * Local Storage. + * @param { ClearCacheOption } options - See tutorial for more details. + * @return {Promise.} + * @tutorial System.clearCache + */ + clearCache(options: ClearCacheOption): Promise; + /** + * Clears all cached data when OpenFin Runtime exits. + * @return {Promise.} + * @tutorial System.deleteCacheOnExit + */ + deleteCacheOnExit(): Promise; + /** + * Exits the Runtime. + * @return {Promise.} + * @tutorial System.exit + */ + exit(): Promise; + /** + * Writes any unwritten cookies data to disk. + * @return {Promise.} + * @tutorial System.flushCookieStore + */ + flushCookieStore(): Promise; + /** + * Retrieves an array of data (name, ids, bounds) for all application windows. + * @return {Promise.Array.} + * @tutorial System.getAllWindows + */ + getAllWindows(): Promise>; + /** + * Retrieves an array of data for all applications. + * @return {Promise.Array.} + * @tutorial System.getAllApplications + */ + getAllApplications(): Promise>; + /** + * Retrieves the command line argument string that started OpenFin Runtime. + * @return {Promise.} + * @tutorial System.getCommandLineArguments + */ + getCommandLineArguments(): Promise; + /** + * Get the current state of the crash reporter. + * @return {Promise.} + * @tutorial System.getCrashReporterState + */ + getCrashReporterState(): Promise; + /** + * Returns a unique identifier (UUID) for the machine (SHA256 hash of the system's MAC address). + * This call will return the same value on subsequent calls on the same machine(host). + * The values will be different on different machines, and should be considered globally unique. + * @return {Promise.} + * @tutorial System.getDeviceId + */ + getDeviceId(): Promise; + /** + * Start the crash reporter for the browser process if not already running. + * You can optionally specify `diagnosticMode` to have the logs sent to + * OpenFin on runtime close + * + * @param { CrashReporterOption } options - configure crash reporter + * @return {Promise.} + * @tutorial System.startCrashReporter + */ + startCrashReporter(options: CrashReporterOption): Promise; + /** + * Returns a hex encoded hash of the mac address and the currently logged in user name + * @return {Promise.} + * @tutorial System.getDeviceUserId + */ + getDeviceUserId(): Promise; + /** + * Retrieves a frame info object for the uuid and name passed in + * @param { string } uuid - The UUID of the target. + * @param { string } name - The name of the target. + * @return {Promise.} + * @tutorial System.getEntityInfo + */ + getEntityInfo(uuid: string, name: string): Promise; + /** + * Gets the value of a given environment variable on the computer on which the runtime is installed + * @return {Promise.} + * @tutorial System.getEnvironmentVariable + */ + getEnvironmentVariable(envName: string): Promise; + /** + * Get current focused window. + * @return {Promise.} + * @tutorial System.getFocusedWindow + */ + getFocusedWindow(): Promise; + /** + * Retrieves the contents of the log with the specified filename. + * @param { GetLogRequestType } options A object that id defined by the GetLogRequestType interface + * @return {Promise.} + * @tutorial System.getLog + */ + getLog(options: GetLogRequestType): Promise; + /** + * Returns the minimum (inclusive) logging level that is currently being written to the log. + * @return {Promise.} + * @tutorial System.getMinLogLevel + */ + getMinLogLevel(): Promise; + /** + * Retrieves an array containing information for each log file. + * @return {Promise.Array} + * @tutorial System.getLogList + */ + getLogList(): Promise>; + /** + * Retrieves an object that contains data about the monitor setup of the + * computer that the runtime is running on. + * @return {Promise.} + * @tutorial System.getMonitorInfo + */ + getMonitorInfo(): Promise; + /** + * Returns the mouse in virtual screen coordinates (left, top). + * @return {Promise.} + * @tutorial System.getMousePosition + */ + getMousePosition(): Promise; + /** + * Retrieves an array of all of the runtime processes that are currently + * running. Each element in the array is an object containing the uuid + * and the name of the application to which the process belongs. + * @return {Promise.Array.} + * @tutorial System.getProcessList + */ + getProcessList(): Promise>; + /** + * Retrieves the Proxy settings. + * @return {Promise.} + * @tutorial System.getProxySettings + */ + getProxySettings(): Promise; + /** + * Returns information about the running Runtime in an object. + * @return {Promise.} + * @tutorial System.getRuntimeInfo + */ + getRuntimeInfo(): Promise; + /** + * Returns information about the running RVM in an object. + * @return {Promise.} + * @tutorial System.getRvmInfo + */ + getRvmInfo(): Promise; + /** + * Retrieves system information. + * @return {Promise.} + * @tutorial System.getHostSpecs + */ + getHostSpecs(): Promise; + /** + * Runs an executable or batch file. + * @param { ExternalProcessRequestType } options A object that is defined in the ExternalProcessRequestType interface + * @return {Promise.} + * @tutorial System.launchExternalProcess + */ + launchExternalProcess(options: ExternalProcessRequestType): Promise; + /** + * Monitors a running process. + * @param { number } pid See tutorial for more details + * @return {Promise.} + * @tutorial System.monitorExternalProcess + */ + monitorExternalProcess(pid: number): Promise; + /** + * Writes the passed message into both the log file and the console. + * @param { string } level The log level for the entry. Can be either "info", "warning" or "error" + * @param { string } message The log message text + * @return {Promise.} + * @tutorial System.log + */ + log(level: string, message: string): Promise; + /** + * Opens the passed URL in the default web browser. + * @param { string } url The URL to open + * @return {Promise.} + * @tutorial System.openUrlWithBrowser + */ + openUrlWithBrowser(url: string): Promise; + /** + * Removes the process entry for the passed UUID obtained from a prior call + * of fin.System.launchExternalProcess(). + * @param { string } uuid The UUID for a process obtained from a prior call to fin.desktop.System.launchExternalProcess() + * @return {Promise.} + * @tutorial System.releaseExternalProcess + */ + releaseExternalProcess(uuid: string): Promise; + /** + * Shows the Chromium Developer Tools for the specified window + * @param { Identity } identity This is a object that is defined by the Identity interface + * @return {Promise.} + * @tutorial System.showDeveloperTools + */ + showDeveloperTools(identity: Identity): Promise; + /** + * Attempt to close an external process. The process will be terminated if it + * has not closed after the elapsed timeout in milliseconds. + * @param { TerminateExternalRequestType } options A object defined in the TerminateExternalRequestType interface + * @return {Promise.} + * @tutorial System.terminateExternalProcess + */ + terminateExternalProcess(options: TerminateExternalRequestType): Promise; + /** + * Update the OpenFin Runtime Proxy settings. + * @param { ProxyConfig } options A config object defined in the ProxyConfig interface + * @return {Promise.} + * @tutorial System.updateProxySettings + */ + updateProxySettings(options: ProxyConfig): Promise; + /** + * Downloads the given application asset + * @param { AppAssetInfo } appAsset App asset object + * @return {Promise.} + * @tutorial System.downloadAsset + */ + downloadAsset(appAsset: AppAssetInfo, progressListener: (progress: RuntimeDownloadProgress) => void): Promise; + /** + * Downloads a version of the runtime. + * @param { RuntimeDownloadOptions } options - Download options. + * @param {Function} [progressListener] - called as the runtime is downloaded with progress information. + * @return {Promise.} + * @tutorial System.downloadRuntime + */ + downloadRuntime(options: RuntimeDownloadOptions, progressListener: (progress: RuntimeDownloadProgress) => void): Promise; + /** + * Download preload scripts from given URLs + * @param {DownloadPreloadOption[]} scripts - URLs of preload scripts. See tutorial for more details. + * @return {Promise.Array} + * @tutorial System.downloadPreloadScripts + */ + downloadPreloadScripts(scripts: Array): Promise>; + /** + * Retrieves an array of data (name, ids, bounds) for all application windows. + * @return {Promise.Array.} + * @tutorial System.getAllExternalApplications + */ + getAllExternalApplications(): Promise>; + /** + * Retrieves app asset information. + * @param { AppAssetRequest } options + * @return {Promise.} + * @tutorial System.getAppAssetInfo + */ + getAppAssetInfo(options: AppAssetRequest): Promise; + /** + * Get additional info of cookies. + * @param { CookieOption } options - See tutorial for more details. + * @return {Promise.Array.} + * @tutorial System.getCookies + */ + getCookies(options: CookieOption): Promise>; + /** + * Set the minimum log level above which logs will be written to the OpenFin log + * @param { LogLevel } The minimum level (inclusive) above which all calls to log will be written + * @return {Promise.} + * @tutorial System.setMinLogLevel + */ + setMinLogLevel(level: LogLevel): Promise; + /** + * Retrieves the UUID of the computer on which the runtime is installed + * @param { string } uuid The uuid of the running application + * @return {Promise.} + * @tutorial System.resolveUuid + */ + resolveUuid(uuid: string): Promise; + /** + * Retrieves an array of data for all external applications + * @param { Identity } requestingIdentity This object is described in the Identity typedef + * @param { any } data Any data type to pass to the method + * @return {Promise.} + * @ignore + */ + executeOnRemote(requestingIdentity: Identity, data: any): Promise; + /** + * Reads the specifed value from the registry. + * @param { string } rootKey - The registry root key. + * @param { string } subkey - The registry key. + * @param { string } value - The registry value name. + * @return {Promise.} + * @tutorial System.readRegistryValue + */ + readRegistryValue(rootKey: string, subkey: string, value: string): Promise; + /** + * This function call will register a unique id and produce a token. + * The token can be used to broker an external connection. + * @param { string } uuid - A UUID for the remote connection. + * @return {Promise.} + * @tutorial System.registerExternalConnection + */ + registerExternalConnection(uuid: string): Promise; +} diff --git a/types/openfin/v34/_v2/api/system/window.d.ts b/types/openfin/v34/_v2/api/system/window.d.ts new file mode 100644 index 0000000000..886084fad6 --- /dev/null +++ b/types/openfin/v34/_v2/api/system/window.d.ts @@ -0,0 +1,14 @@ +export interface WindowInfo { + uuid: string; + mainWindow: WindowDetail; + childWindows: Array; +} +export interface WindowDetail { + name: string; + top: number; + right: number; + bottom: number; + height: number; + width: number; + left: number; +} diff --git a/types/openfin/v34/_v2/api/window/bounds-changed.d.ts b/types/openfin/v34/_v2/api/window/bounds-changed.d.ts new file mode 100644 index 0000000000..f7801da3fc --- /dev/null +++ b/types/openfin/v34/_v2/api/window/bounds-changed.d.ts @@ -0,0 +1,14 @@ +import { Reply } from '../base'; +export default class BoundsChangedReply extends Reply<'window', 'bounds-changed'> { + changeType: BoundsChangeType; + deferred: boolean; + height: number; + width: number; + top: number; + left: number; +} +export declare const enum BoundsChangeType { + POSITION = 0, + SIZE = 1, + POSITION_AND_SIZE = 2 +} diff --git a/types/openfin/v34/_v2/api/window/bounds.d.ts b/types/openfin/v34/_v2/api/window/bounds.d.ts new file mode 100644 index 0000000000..40822c4aa3 --- /dev/null +++ b/types/openfin/v34/_v2/api/window/bounds.d.ts @@ -0,0 +1,9 @@ +interface Bounds { + height: number; + width: number; + top: number; + left: number; + right?: number; + bottom?: number; +} +export default Bounds; diff --git a/types/openfin/v34/_v2/api/window/transition.d.ts b/types/openfin/v34/_v2/api/window/transition.d.ts new file mode 100644 index 0000000000..c16440c80d --- /dev/null +++ b/types/openfin/v34/_v2/api/window/transition.d.ts @@ -0,0 +1,24 @@ +export interface TransitionBase { + duration: number; + relative?: boolean; +} +export interface Opacity extends TransitionBase { + opacity: number; +} +export interface Position extends TransitionBase { + left: number; + top: number; +} +export interface Size extends TransitionBase { + width: number; + height: number; +} +export interface TransitionOptions { + interrupt: boolean; + tween?: string; +} +export interface Transition { + opacity?: Opacity; + position?: Position; + size?: Size; +} diff --git a/types/openfin/v34/_v2/api/window/window.d.ts b/types/openfin/v34/_v2/api/window/window.d.ts new file mode 100644 index 0000000000..8d597a6446 --- /dev/null +++ b/types/openfin/v34/_v2/api/window/window.d.ts @@ -0,0 +1,759 @@ +import { Base, EmitterBase, RuntimeEvent } from '../base'; +import { Identity } from '../../identity'; +import Bounds from './bounds'; +import BoundsChangedReply from './bounds-changed'; +import { Transition, TransitionOptions } from './transition'; +import { Application } from '../application/application'; +import Transport from '../../transport/transport'; +export default class _WindowModule extends Base { + private instance; + /** + * Returns a Window object that represents an existing window. + * @param { Identity } indentity + * @return {Promise.<_Window>} + * @tutorial Window.wrap + */ + wrap(identity: Identity): Promise<_Window>; + /** + * Creates a new Window. + * @param { * } options - Window creation options + * @return {Promise.<_Window>} + * @tutorial Window.create + */ + create(options: any): Promise<_Window>; + /** + * Returns a Window object that represents the current window + * @return {Promise.} + * @tutorial window.getCurrent + */ + getCurrent(): Promise<_Window>; +} +export interface CloseEventShape { + name: string; + uuid: string; + type: string; + topic: string; +} +export interface WindowInfo { + canNavigateBack: boolean; + canNavigateForward: boolean; + preloadScripts: Array; + title: string; + url: string; +} +export interface FrameInfo { + name: string; + uuid: string; + entityType: string; + parent?: Identity; +} +/** + * @typedef {object} Transition + * @property {Opacity} opacity - The Opacity transition + * @property {Position} position - The Position transition + * @property {Size} size - The Size transition +*/ +/** + * @typedef {object} TransitionOptions + * @property {boolean} interrupt - This option interrupts the current animation. When false it pushes +this animation onto the end of the animation queue. + * @property {boolean} relative - Treat 'opacity' as absolute or as a delta. Defaults to false. + */ +/** + * @typedef {object} Size + * @property {number} duration - The total time in milliseconds this transition should take. + * @property {boolean} relative - Treat 'opacity' as absolute or as a delta. Defaults to false. + * @property {number} width - Optional if height is present. Defaults to the window's current width. + * @property {number} height - Optional if width is present. Defaults to the window's current height. + */ +/** + * @typedef {object} Position + * @property {number} duration - The total time in milliseconds this transition should take. + * @property {boolean} relative - Treat 'opacity' as absolute or as a delta. Defaults to false. + * @property {number} left - Defaults to the window's current left position in virtual screen coordinates. + * @property {number} top - Defaults to the window's current top position in virtual screen coordinates. + */ +/** + * @typedef {object} Opacity + * @property {number} duration - The total time in milliseconds this transition should take. + * @property {boolean} relative - Treat 'opacity' as absolute or as a delta. Defaults to false. + * @property {number} opacity - This value is clamped from 0.0 to 1.0. +*/ +/** + * Bounds is a interface that has the properties of height, + * width, left, top which are all numbers + * @typedef { Object } Bounds + * @property { number } height Get the application height bound + * @property { number } width Get the application width bound + * @property { number } top Get the application top bound + * @property { number } left Get the application left bound + * @property { number } right Get the application right bound + * @property { number } bottom Get the application bottom bound + */ +/** + * @classdesc A basic window that wraps a native HTML window. Provides more fine-grained + * control over the window state such as the ability to minimize, maximize, restore, etc. + * By default a window does not show upon instantiation; instead the window's show() method + * must be invoked manually. The new window appears in the same process as the parent window. + * @class + * @alias Window +*/ +export declare class _Window extends EmitterBase { + identity: Identity; + /** + * Raised when a window within this application requires credentials from the user. + * + * @event Window#auth-requested + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + * @property {object} authInfo + * @property {string} authInfo.host - Host server. + * @property {boolean} authInfo.isProxy - Indicates if the request involves a proxy. + * @property {number} authInfo.port - Port number. + * @property {string} authInfo.realm - Authentication request realm. + * @property {string} authInfo.scheme - Authentication scheme. + */ + /** + * Raised when a window loses focus. + * + * @event Window#blurred + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + */ + /** + * Raised after changes in a window's size and/or position. + * + * @event Window#bounds-changed + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + * @property {number} changeType - Describes what kind of change occurred. + 0 means a change in position. + 1 means a change in size. + 2 means a change in position and size. + * @property {string} deferred - Indicated whether pending changes have been applied. + * @property {number} height - New height of the window. + * @property {number} left - New left most coordinate of the window. + * @property {number} top - New top most coordinate of the window. + * @property {number} width - New width of the window. + */ + /** + * Raised when a window has been prevented from closing. A window will be prevented from closing by default, + either through the API or by a user when ‘close-requested’ has been subscribed to and the Window.close(force) flag is false. + * + * @event Window#close-requested + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + */ + /** + * Raised when a window has closed. + * + * @event Window#closed + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + */ + /** + * Raised when a window has crashed. + * + * @event Window#crashed + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + */ + /** + * Raised when the frame is disabled after all prevent user changes in window's size and/or position have completed. + * + * @event Window#disabled-frame-bounds-changed + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + * @property {number} changeType - Describes what kind of change occurred. + 0 means a change in position. + 1 means a change in size. + 2 means a change in position and size. + * @property {string} deferred - Indicated whether pending changes have been applied. + * @property {number} height - New height of the window. + * @property {number} left - New left most coordinate of the window. + * @property {number} top - New top most coordinate of the window. + * @property {number} width - New width of the window. + */ + /** + * Raised when the frame is disabled during prevented user changes to a window's size and/or position. + * + * @event Window#disabled-frame-bounds-changing + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + * @property {number} changeType - Describes what kind of change occurred. + 0 means a change in position. + 1 means a change in size. + 2 means a change in position and size. + * @property {string} deferred - Indicated whether pending changes have been applied. + * @property {number} height - New height of the window. + * @property {number} left - New left most coordinate of the window. + * @property {number} top - New top most coordinate of the window. + * @property {number} width - New width of the window. + */ + /** + * Raised when the window has been embedded. + * + * @event Window#embedded + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + */ + /** + * Raised when an external process has exited. + * + * @event Window#external-process-exited + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + * @property {string} processUuid - The process handle UUID. + * @property {number} exitCode - The process exit code + */ + /** + * Raised when an external process has started. + * + * @event Window#external-process-started + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + * @property {string} processUuid - The process handle UUID. + */ + /** + * Raised when a window's frame becomes disabled. + * + * @event Window#frame-disabled + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + */ + /** + * Raised when a window's frame becomes enabled. + * + * @event Window#frame-enabled + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + */ + /** + * Raised when a window joins/leaves a group and/or when the group a window is a member of changes. + * + * @event Window#group-changed + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + * @property {string} source - Which group array the window that the event listener was registered on is included in: + 'source' The window is included in sourceGroup. + 'target' The window is included in targetGroup. + 'nothing' The window is not included in sourceGroup nor targetGroup. + * @property {string} reason - The reason this event was triggered. + 'leave' A window has left the group due to a leave or merge with group. + 'join' A window has joined the group. + 'merge' Two groups have been merged together. + 'disband' There are no other windows in the group. + * @property {string} name - Name of the window. + * @property {legacyWindowIdentity[]} sourceGroup - All the windows in the group the sourceWindow originated from. + * @property {string} sourceWindowAppUuid - UUID of the application the sourceWindow belongs to the + source window is the window in which (merge/join/leave)group(s) was called. + * @property {string} sourceWindowName - Name of the sourcewindow. + The source window is the window in which (merge/join/leave)group(s) was called. + * @property {legacyWindowIdentity[]} targetGroup - All the windows in the group the targetWindow orginated from. + * @property {string} targetWindowAppUuid - UUID of the application the targetWindow belongs to. + The target window is the window that was passed into (merge/join)group(s). + * @property {string} targetWindowName - Name of the targetWindow. + The target window is the window that was passed into (merge/join)group(s). + */ + /** + * Raised when a window has been hidden. + * + * @event Window#hidden + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + * @property {string} reason - Action prompted the close The reasons are: + "hide" + "hide-on-close" + */ + /** + * Raised when a window is initialized. + * + * @event Window#initialized + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + */ + /** + * Raised when a window is maximized. + * + * @event Window#maximized + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + */ + /** + * Raised when a window is minimized. + * + * @event Window#minimized + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + */ + /** + * Raised when window navigation is rejected as per ContentNavigation whitelist/blacklist rules. + * + * @event Window#navigation-rejected + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + * @property {string} sourceName - source of navigation window name. + * @property {string} url - Blocked content url. + */ + /** + * Raised when a window is out of memory. + * + * @event Window#out-of-memory + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + */ + /** + * Raised after the execution of all of a window's preload scripts. Contains + information about all window's preload scripts' final states. + * + * @event Window#preload-scripts-state-changed + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + * @property {preloadScriptState[]} preloadState - An array of all final preload scripts' states + */ + /** + * Raised during the execution of a window's preload script. Contains information + about a single window's preload script's state, for which the event has been raised. + * + * @event Window#preload-scripts-state-changing + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + * @property {preloadScriptState[]} preloadState - An array of all final preload scripts' states + */ + /** + * Raised when an HTTP load was cancelled or failed. + * + * @event Window#resource-load-failed + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + * @property {number} errorCode - The Chromium error code. + * @property {string} errorDescription - The Chromium error description. + * @property {string} validatedURL - The url attempted. + * @property {boolean} isMainFrame - Was the attempt made from the main frame. + */ + /** + * Raised when an HTTP resource request has received response details. + * + * @event Window#resource-response-received + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + * @property {boolean} status - Status of the request. + * @property {string} newUrl - The URL of the responded resource. + * @property {string} originalUrl - The requested URL. + * @property {number} httpResponseCode - The HTTP Response code. + * @property {string} requestMethod - The HTTP request method. + * @property {string} referrer - The HTTP referrer. + * @property {object} headers - The HTTP headers. + * @property {string} resourceType - Resource type: + "mainFrame", "subFrame", + "styleSheet", "script", "image", + "object", "xhr", or "other" + */ + /** + * Raised when a window has reloaded. + * + * @event Window#reloaded + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + * @property {string} url - Url has has been reloaded. + */ + /** + * Raised when a window is displayed after having been minimized or + when a window leaves the maximize state without minimizing. + * + * @event Window#restored + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + */ + /** + * Raised when a window has been prevented from showing. + A window will be prevented from showing by default, either through the API or by a user when + ‘show-requested’ has been subscribed to on the window or 'window-show-requested' + on the parent application and the Window.show(force) flag is false. + * + * @event Window#show-requested + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + */ + /** + * Raised when a window been shown. + * + * @event Window#shown + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + */ + /** + * @typedef {object} legacyWindowIdentity + * @summary Object summary + * @desc Object description + * @property {string} appUuid - The UUID of the application this window entry belongs to. + * @property {string} windowName - The name of this window entry. + */ + /** + * @typedef {object} preloadScriptState + * @summary Object summary + * @desc Object description + * @property {string} url - The url of the preload script. + * @property {string} state - The preload script state: + "load-failed", "failed", "succeeded" + */ + private nativeWindow; + constructor(wire: Transport, identity: Identity); + createWindow(options: any): Promise<_Window>; + protected runtimeEventComparator: (listener: RuntimeEvent) => boolean; + private windowListFromNameList; + /** + * Retrieves an array of frame info objects representing the main frame and any + * iframes that are currently on the page. + * @return {Promise.>} + * @tutorial Window.getAllFrames + */ + getAllFrames(): Promise>; + /** + * Gets the current bounds (top, left, width, height) of the window. + * @return {Promise.} + * @tutorial Window.getBounds + */ + getBounds(): Promise; + /** + * Returns the native JavaScript "window" object for the window. + * @return {Promise.} + * @tutorial Window.getNativeWindow + */ + getNativeWindow(): Promise; + /** + * Gives focus to the window. + * @return {Promise.} + * @emits _Window#focused + * @tutorial Window.focus + */ + focus(): Promise; + /** + * Removes focus from the window. + * @return {Promise.} + * @tutorial Window.blur + */ + blur(): Promise; + /** + * Brings the window to the front of the window stack. + * @return {Promise.} + * @tutorial Window.bringToFront + */ + bringToFront(): Promise; + /** + * Performs the specified window transitions. + * @param {Transition} transitions - Describes the animations to perform. See the tutorial. + * @param {TransitionOptions} options - Options for the animation. See the tutorial. + * @return {Promise.} + * @tutorial Window.animate + */ + animate(transitions: Transition, options: TransitionOptions): Promise; + /** + * Hides the window. + * @return {Promise.} + * @tutorial Window.hide + */ + hide(): Promise; + /** + * closes the window application + * @param { boolean } [force = false] Close will be prevented from closing when force is false and + * ‘close-requested’ has been subscribed to for application’s main window. + * @return {Promise.} + * @tutorial Window.close + */ + close(force?: boolean): Promise; + /** + * Returns then running applications uuid + * @return {Promise.} + * @tutorial Window.getNativeId + */ + getNativeId(): Promise; + /** + * Prevents a user from changing a window's size/position when using the window's frame. + * @return {Promise.} + * @tutorial Window.disableFrame + */ + disableFrame(): Promise; + /** + * Re-enables user changes to a window's size/position when using the window's frame. + * @return {Promise.} + * @tutorial Window.enableFrame + */ + enableFrame(): Promise; + /** + * Executes Javascript on the window, restricted to windows you own or windows owned by + * applications you have created. + * @param { string } code JavaScript code to be executed on the window. + * @return {Promise.} + * @tutorial Window.executeJavaScript + */ + executeJavaScript(code: string): Promise; + /** + * Flashes the window’s frame and taskbar icon until stopFlashing is called. + * @return {Promise.} + * @tutorial Window.flash + */ + flash(): Promise; + /** + * Stops the taskbar icon from flashing. + * @return {Promise.} + * @tutorial Window.stopFlashing + */ + stopFlashing(): Promise; + /** + * Retrieves an array containing wrapped fin.desktop.Windows that are grouped with this + * window. If a window is not in a group an empty array is returned. Please note that + * calling window is included in the result array. + * @return {Promise.>} + * @tutorial Window.getGroup + */ + getGroup(): Promise>; + /** + * Gets an information object for the window. + * @return {Promise.} + * @tutorial Window.getInfo + */ + getInfo(): Promise; + /** + * Gets the current settings of the window. + * @return {Promise.} + * @tutorial Window.getOptions + */ + getOptions(): Promise; + /** + * Gets the parent application. + * @return {Promise.} + * @tutorial Window.getParentApplication + */ + getParentApplication(): Promise; + /** + * Gets the parent window. + * @return {Promise.<_Window>} + * @tutorial Window.getParentWindow + */ + getParentWindow(): Promise<_Window>; + /** + * Gets a base64 encoded PNG snapshot of the window. + * @return {Promise.} + * @tutorial Window.getSnapshot + */ + getSnapshot(): Promise; + /** + * Gets the current state ("minimized", "maximized", or "restored") of the window. + * @return {Promise.} + * @tutorial Window.getState + */ + getState(): Promise; + /** + * Determines if the window is currently showing. + * @return {Promise.} + * @tutorial Window.isShowing + */ + isShowing(): Promise; + /** + * Joins the same window group as the specified window. + * @param { class } target The window whose group is to be joined + * @return {Promise.} + * @tutorial Window.joinGroup + */ + joinGroup(target: _Window): Promise; + /** + * Reloads the window current page + * @return {Promise.} + * @tutorial Window.reload + */ + reload(ignoreCache?: boolean): Promise; + /** + * Leaves the current window group so that the window can be move independently of those in the group. + * @return {Promise.} + * @tutorial Window.leaveGroup + */ + leaveGroup(): Promise; + /** + * Maximizes the window + * @return {Promise.} + * @tutorial Window.maximize + */ + maximize(): Promise; + /** + * Merges the instance's window group with the same window group as the specified window + * @param { class } target The window whose group is to be merged with + * @return {Promise.} + * @tutorial Window.mergeGroups + */ + mergeGroups(target: _Window): Promise; + /** + * Minimizes the window. + * @return {Promise.} + * @tutorial Window.minimize + */ + minimize(): Promise; + /** + * Moves the window by a specified amount. + * @param { number } deltaLeft The change in the left position of the window + * @param { number } deltaTop The change in the top position of the window + * @return {Promise.} + * @tutorial Window.moveBy + */ + moveBy(deltaLeft: number, deltaTop: number): Promise; + /** + * Moves the window to a specified location. + * @param { number } left The left position of the window + * @param { number } top The top position of the window + * @return {Promise.} + * @tutorial Window.moveTo + */ + moveTo(left: number, top: number): Promise; + /** + * Resizes the window by a specified amount. + * @param { number } deltaWidth The change in the width of the window + * @param { number } deltaHeight The change in the height of the window + * @param { string } anchor Specifies a corner to remain fixed during the resize. + * Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right." + * If undefined, the default is "top-left" + * @return {Promise.} + * @tutorial Window.resizeBy + */ + resizeBy(deltaWidth: number, deltaHeight: number, anchor: string): Promise; + /** + * Resizes the window to the specified dimensions. + * @param { number } width The change in the width of the window + * @param { number } height The change in the height of the window + * @param { string } anchor Specifies a corner to remain fixed during the resize. + * Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right." + * If undefined, the default is "top-left" + * @return {Promise.} + * @tutorial Window.resizeTo + */ + resizeTo(width: number, height: number, anchor: string): Promise; + /** + * Restores the window to its normal state (i.e., unminimized, unmaximized). + * @return {Promise.} + * @tutorial Window.restore + */ + restore(): Promise; + /** + * Will bring the window to the front of the entire stack and give it focus. + * @return {Promise.} + * @tutorial Window.setAsForeground + */ + setAsForeground(): Promise; + /** + * Sets the window's size and position. + * @property { Bounds } bounds This is a * @type {string} name - name of the window.object that holds the propertys of + * @return {Promise.} + * @tutorial Window.setBounds + */ + setBounds(bounds: Bounds): Promise; + /** + * Shows the window if it is hidden. + * @param { boolean } [force = false] Show will be prevented from showing when force is false and + * ‘show-requested’ has been subscribed to for application’s main window. + * @return {Promise.} + * @tutorial Window.show + */ + show(force?: boolean): Promise; + /** + * Shows the window if it is hidden at the specified location. + * If the toggle parameter is set to true, the window will + * alternate between showing and hiding. + * @param { number } left The left position of the window + * @param { number } top The right position of the window + * @param { boolean } force Show will be prevented from closing when force is false and + * ‘show-requested’ has been subscribed to for application’s main window + * @return {Promise.} + * @tutorial Window.showAt + */ + showAt(left: number, top: number, force?: boolean): Promise; + /** + * Shows the Chromium Developer Tools + * @return {Promise.} + * @tutorial Window.showDeveloperTools + */ + showDeveloperTools(): Promise; + /** + * Updates the window using the passed options + * @param {*} options Changes a window's options that were defined upon creation. See tutorial + * @return {Promise.} + * @tutorial Window.updateOptions + */ + updateOptions(options: any): Promise; + /** + * Provides credentials to authentication requests + * @param { string } userName userName to provide to the authentication challange + * @param { string } password password to provide to the authentication challange + * @return {Promise.} + * @tutorial Window.authenticate + */ + authenticate(userName: string, password: string): Promise; + /** + * Returns the zoom level of the window. + * @return {Promise.} + * @tutorial Window.getZoomLevel + */ + getZoomLevel(): Promise; + /** + * Sets the zoom level of the window. + * @param { number } level The zoom level + * @return {Promise.} + * @tutorial Window.setZoomLevel + */ + setZoomLevel(level: number): Promise; + /** + * Navigates the window to a specified URL. + * @param {string} url - The URL to navigate the window to. + * @return {Promise.} + * @tutorial Window.navigate + */ + navigate(url: string): Promise; + /** + * Navigates the window back one page. + * @return {Promise.} + * @tutorial Window.navigateBack + */ + navigateBack(): Promise; + /** + * Stops any current navigation the window is performing. + * @return {Promise.} + * @tutorial Window.stopNavigation + */ + stopNavigation(): Promise; +} +export interface _Window { + on(type: 'focused', listener: Function): Promise; + on(type: 'initialized', listener: Function): Promise; + on(type: 'bounds-changed', listener: (data: BoundsChangedReply) => void): Promise; + on(type: 'hidden', listener: Function): Promise; + on(type: 'removeListener', listener: (eventType: string | symbol) => void): Promise; + on(type: 'newListener', listener: (eventType: string | symbol) => void): Promise; + on(type: 'closed', listener: (eventType: CloseEventShape) => void): Promise; + on(type: 'fire-constructor-callback', listener: Function): Promise; +} diff --git a/types/openfin/v34/_v2/environment/environment.d.ts b/types/openfin/v34/_v2/environment/environment.d.ts new file mode 100644 index 0000000000..0b0f1571f2 --- /dev/null +++ b/types/openfin/v34/_v2/environment/environment.d.ts @@ -0,0 +1,10 @@ +import { NewConnectConfig } from '../transport/wire'; +export interface Environment { + writeToken(path: string, token: string): Promise; + retrievePort(config: NewConnectConfig): Promise; + getNextMessageId(): any; + getRandomId(): string; + createChildWindow(options: any): Promise; + isWindowExists(uuid: string, name: string): boolean; +} +export declare const notImplementedEnvErrorMsg = "Not implemented in this environment"; diff --git a/types/openfin/v34/_v2/environment/node-env.d.ts b/types/openfin/v34/_v2/environment/node-env.d.ts new file mode 100644 index 0000000000..03e0faeede --- /dev/null +++ b/types/openfin/v34/_v2/environment/node-env.d.ts @@ -0,0 +1,11 @@ +import { Environment } from './environment'; +import { NewConnectConfig } from '../transport/wire'; +export default class NodeEnvironment implements Environment { + private messageCounter; + writeToken: (path: string, token: string) => Promise; + retrievePort: (config: NewConnectConfig) => Promise; + getNextMessageId: () => any; + createChildWindow: (options: any) => Promise; + getRandomId: () => string; + isWindowExists: (uuid: string, name: string) => boolean; +} diff --git a/types/openfin/v34/_v2/environment/openfin-env.d.ts b/types/openfin/v34/_v2/environment/openfin-env.d.ts new file mode 100644 index 0000000000..456e2f8caf --- /dev/null +++ b/types/openfin/v34/_v2/environment/openfin-env.d.ts @@ -0,0 +1,11 @@ +import { Environment } from './environment'; +import { NewConnectConfig } from '../transport/wire'; +export default class OpenFinEnvironment implements Environment { + writeToken: (path: string, token: string) => Promise; + retrievePort: (config: NewConnectConfig) => Promise; + getNextMessageId: () => any; + createChildWindow: (options: any) => Promise; + getRandomId: () => string; + private resolveUrl; + isWindowExists: (uuid: string, name: string) => boolean; +} diff --git a/types/openfin/v34/_v2/environment/openfin-renderer-api.d.ts b/types/openfin/v34/_v2/environment/openfin-renderer-api.d.ts new file mode 100644 index 0000000000..82822c3111 --- /dev/null +++ b/types/openfin/v34/_v2/environment/openfin-renderer-api.d.ts @@ -0,0 +1,6 @@ +export declare const ipc: any; +export declare const routingId: any; +export declare const CORE_MESSAGE_CHANNEL: any; +export declare const outboundTopic = "of-window-message"; +export declare const inboundTopic: string; +export declare const currentWindowIdentity: any; diff --git a/types/openfin/v34/_v2/identity.d.ts b/types/openfin/v34/_v2/identity.d.ts new file mode 100644 index 0000000000..f10f030248 --- /dev/null +++ b/types/openfin/v34/_v2/identity.d.ts @@ -0,0 +1,4 @@ +export interface Identity { + uuid: string; + name?: string; +} diff --git a/types/openfin/v34/_v2/launcher/launcher.d.ts b/types/openfin/v34/_v2/launcher/launcher.d.ts new file mode 100644 index 0000000000..d0ffc16989 --- /dev/null +++ b/types/openfin/v34/_v2/launcher/launcher.d.ts @@ -0,0 +1,15 @@ +/// +import { ChildProcess } from 'child_process'; +import { ConfigWithRuntime } from '../transport/wire'; +export default class Launcher { + private os; + OpenFin_Installer: string; + Installer_Work_Dir: string; + Security_Realm_Config_Key: string; + nixConfig?: any; + constructor(); + launch(config: ConfigWithRuntime, manifestLocation: string, namedPipeName: string): Promise; + static IS_SUPPORTED(): boolean; + private macLaunch; + private winLaunch; +} diff --git a/types/openfin/v34/_v2/launcher/nix-launch.d.ts b/types/openfin/v34/_v2/launcher/nix-launch.d.ts new file mode 100644 index 0000000000..02b0da4fbb --- /dev/null +++ b/types/openfin/v34/_v2/launcher/nix-launch.d.ts @@ -0,0 +1,14 @@ +/// +import { ChildProcess } from 'child_process'; +import { ConfigWithRuntime } from '../transport/wire'; +export declare function getUrl(version: string, urlPath: string): string; +export declare function download(version: string, folder: string, osConfig: OsConfig): Promise; +export declare function getRuntimePath(version: string): Promise; +export declare function install(versionOrChannel: string, osConfig: OsConfig): Promise; +export interface OsConfig { + manifestLocation: string; + namedPipeName: string; + urlPath: string; + executablePath: string; +} +export default function launch(config: ConfigWithRuntime, osConfig: OsConfig): Promise; diff --git a/types/openfin/v34/_v2/launcher/util.d.ts b/types/openfin/v34/_v2/launcher/util.d.ts new file mode 100644 index 0000000000..808ad015ea --- /dev/null +++ b/types/openfin/v34/_v2/launcher/util.d.ts @@ -0,0 +1,8 @@ +export declare function exists(path: string): Promise; +export declare function get(url: string): Promise; +export declare function unzip(file: string, dest: string): Promise; +export declare function rmDir(dirPath: string, removeSelf?: boolean): Promise; +export declare function downloadFile(url: string, writeLocation: string): Promise<{}>; +export declare function resolveRuntimeVersion(versionOrChannel: string): Promise; +export declare function first(arr: T[], func: (x: T, i: number, r: T[]) => boolean): T | null; +export declare function resolveDir(base: string, paths: string[]): Promise; diff --git a/types/openfin/v34/_v2/launcher/win-launch.d.ts b/types/openfin/v34/_v2/launcher/win-launch.d.ts new file mode 100644 index 0000000000..b08fac3f8a --- /dev/null +++ b/types/openfin/v34/_v2/launcher/win-launch.d.ts @@ -0,0 +1,4 @@ +/// +import { ChildProcess } from 'child_process'; +import { ConfigWithRuntime } from '../transport/wire'; +export default function launch(config: ConfigWithRuntime, manifestLocation: string, namedPipeName: string, Installer_Work_Dir: string): Promise; diff --git a/types/openfin/v34/_v2/main.d.ts b/types/openfin/v34/_v2/main.d.ts new file mode 100644 index 0000000000..2f4a3d8730 --- /dev/null +++ b/types/openfin/v34/_v2/main.d.ts @@ -0,0 +1,11 @@ +import Fin from './api/fin'; +import { Application } from './api/application/application'; +import { _Window as Window } from './api/window/window'; +import { _Frame as Frame } from './api/frame/frame'; +import { _Notification as Notification } from './api/notification/notification'; +import System from './api/system/system'; +import { ConnectConfig } from './transport/wire'; +export declare function connect(config: ConnectConfig): Promise; +export declare function launch(config: ConnectConfig): Promise; +export { Identity } from './identity'; +export { Fin, Application, Window, System, Frame, Notification }; diff --git a/types/openfin/v34/_v2/of-main.d.ts b/types/openfin/v34/_v2/of-main.d.ts new file mode 100644 index 0000000000..cb0ff5c3b5 --- /dev/null +++ b/types/openfin/v34/_v2/of-main.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/types/openfin/v34/_v2/transport/elipc.d.ts b/types/openfin/v34/_v2/transport/elipc.d.ts new file mode 100644 index 0000000000..94c398cba5 --- /dev/null +++ b/types/openfin/v34/_v2/transport/elipc.d.ts @@ -0,0 +1,13 @@ +/// +import { EventEmitter } from 'events'; +import { Wire, READY_STATE } from './wire'; +export default class ElIPCTransport extends EventEmitter implements Wire { + protected wire: any; + onmessage: (data: any) => void; + constructor(onmessage: (data: any) => void); + connectSync: () => any; + connect: (address: string) => Promise; + send(data: any, flags?: any): Promise; + shutdown(): Promise; + static READY_STATE: typeof READY_STATE; +} diff --git a/types/openfin/v34/_v2/transport/port-discovery.d.ts b/types/openfin/v34/_v2/transport/port-discovery.d.ts new file mode 100644 index 0000000000..d8ea25934d --- /dev/null +++ b/types/openfin/v34/_v2/transport/port-discovery.d.ts @@ -0,0 +1,17 @@ +import { PortDiscoveryConfig } from './wire'; +import { Environment } from '../environment/environment'; +export declare class PortDiscovery { + private savedConfig; + private namedPipeName; + private manifestLocation; + private namedPipeServer; + private pipeConnection; + private timeoutTimer; + private environment; + constructor(config: PortDiscoveryConfig, environment: Environment); + retrievePort(): Promise; + private createDiscoveryNamedPipe; + private listenDiscoveryMessage; + private createManifest; + private cleanup; +} diff --git a/types/openfin/v34/_v2/transport/transport-errors.d.ts b/types/openfin/v34/_v2/transport/transport-errors.d.ts new file mode 100644 index 0000000000..90f9d10f55 --- /dev/null +++ b/types/openfin/v34/_v2/transport/transport-errors.d.ts @@ -0,0 +1,17 @@ +export declare class DisconnectedError extends Error { + constructor(readyState: number); + readyState: number; +} +export declare class UnexpectedActionError extends Error { +} +export declare class DuplicateCorrelationError extends Error { +} +export declare class NoAckError extends Error { +} +export declare class NotImplementedError extends Error { +} +export declare class NotSupportedError extends Error { +} +export declare class RuntimeError extends Error { + constructor(data: any); +} diff --git a/types/openfin/v34/_v2/transport/transport.d.ts b/types/openfin/v34/_v2/transport/transport.d.ts new file mode 100644 index 0000000000..fb7b967240 --- /dev/null +++ b/types/openfin/v34/_v2/transport/transport.d.ts @@ -0,0 +1,48 @@ +/// +import { Wire, WireConstructor, READY_STATE, ExistingConnectConfig, ConnectConfig, InternalConnectConfig } from './wire'; +import { Identity } from '../identity'; +import { EventEmitter } from 'events'; +import { Environment } from '../environment/environment'; +export declare type MessageHandler = (data: any) => boolean; +declare class Transport extends EventEmitter { + protected wireListeners: Map; + protected uncorrelatedListener: Function; + protected messageHandlers: MessageHandler[]; + me: Identity; + protected wire: Wire; + environment: Environment; + topicRefMap: Map; + sendRaw: Wire['send']; + constructor(wireType: WireConstructor, environment: Environment); + connectSync: (config: ConnectConfig) => any; + connect(config: InternalConnectConfig): Promise; + connectByPort(config: ExistingConnectConfig): Promise; + READY_STATE: typeof READY_STATE; + ferryAction(data: any): Promise>; + registerMessageHandler(handler: MessageHandler): void; + protected addWireListener(id: number, resolve: Function, reject: Function, uncorrelated: boolean): void; + protected onmessage(data: Message): void; + protected handleMessage(data: Message): boolean; +} +export default Transport; +interface Transport { + sendAction(action: 'request-external-authorization', payload: {}, uncorrelated: true): Promise>; + sendAction(action: string, payload: {}, uncorrelated: boolean): Promise>; + topicRefMap: Map; +} +export declare class Message { + action: string; + payload: T; + correlationId?: number; +} +export declare class Payload { + success: boolean; + data: any; +} +export declare class AuthorizationPayload { + token: string; + file: string; +} diff --git a/types/openfin/v34/_v2/transport/websocket.d.ts b/types/openfin/v34/_v2/transport/websocket.d.ts new file mode 100644 index 0000000000..5617afa8e3 --- /dev/null +++ b/types/openfin/v34/_v2/transport/websocket.d.ts @@ -0,0 +1,14 @@ +/// +import { EventEmitter } from 'events'; +import * as WebSocket from 'ws'; +import { Wire, READY_STATE } from './wire'; +export default class WebSocketTransport extends EventEmitter implements Wire { + protected wire: WebSocket; + onmessage: (data: any) => void; + constructor(onmessage: (data: any) => void); + connect: (address: string) => Promise; + connectSync: () => any; + send(data: any, flags?: any): Promise; + shutdown(): Promise; + static READY_STATE: typeof READY_STATE; +} diff --git a/types/openfin/v34/_v2/transport/wire.d.ts b/types/openfin/v34/_v2/transport/wire.d.ts new file mode 100644 index 0000000000..227c6d4d72 --- /dev/null +++ b/types/openfin/v34/_v2/transport/wire.d.ts @@ -0,0 +1,71 @@ +/// +import { EventEmitter } from 'events'; +export interface Wire extends EventEmitter { + connect(address: string): Promise; + connectSync(): any; + send(data: any): Promise; + shutdown(): Promise; +} +export interface WireConstructor { + new (onmessage: (data: any) => void): Wire; +} +export interface RuntimeConfig { + version: string; + fallbackVersion?: string; + securityRealm?: string; + verboseLogging?: boolean; + arguments?: string; + rvmDir?: string; +} +export interface BaseConfig { + uuid?: string; + address?: string; + name?: string; + nonPersistent?: boolean; + runtimeClient?: boolean; + licenseKey?: string; + client?: any; + manifestUrl?: string; + startupApp?: any; + lrsUrl?: string; + assetsUrl?: string; + devToolsPort?: number; + installerUI?: boolean; + runtime?: RuntimeConfig; + appAssets?: [{ + src: string; + alias: string; + target: string; + version: string; + args: string; + }]; + customItems?: [any]; + timeout?: number; +} +export interface ConfigWithUuid extends BaseConfig { + uuid: string; +} +export interface ExistingConnectConfig extends ConfigWithUuid { + address: string; +} +export interface ConfigWithRuntime extends BaseConfig { + runtime: RuntimeConfig; +} +export interface ExternalConfig extends BaseConfig { + manifestUrl: string; +} +export declare type NewConnectConfig = ConfigWithUuid & ConfigWithRuntime; +export declare type PortDiscoveryConfig = (ExternalConfig & ConfigWithRuntime) | NewConnectConfig; +export declare type ConnectConfig = ExistingConnectConfig | NewConnectConfig | ExternalConfig; +export declare type InternalConnectConfig = ExistingConnectConfig | NewConnectConfig; +export declare function isExternalConfig(config: ConnectConfig): config is ExternalConfig; +export declare function isExistingConnectConfig(config: any): config is ExistingConnectConfig; +export declare function isNewConnectConfig(config: any): config is NewConnectConfig; +export declare function isPortDiscoveryConfig(config: any): config is PortDiscoveryConfig; +export declare function isInternalConnectConfig(config: any): config is InternalConnectConfig; +export declare enum READY_STATE { + CONNECTING = 0, + OPEN = 1, + CLOSING = 2, + CLOSED = 3 +} diff --git a/types/openfin/v34/_v2/util/normalize-config.d.ts b/types/openfin/v34/_v2/util/normalize-config.d.ts new file mode 100644 index 0000000000..ed322d30ec --- /dev/null +++ b/types/openfin/v34/_v2/util/normalize-config.d.ts @@ -0,0 +1,3 @@ +import { ConnectConfig, InternalConnectConfig, ExternalConfig } from '../transport/wire'; +export declare function normalizeConfig(config: ConnectConfig): Promise; +export declare function validateConfig(config: ConnectConfig): Promise; diff --git a/types/openfin/v34/_v2/util/promises.d.ts b/types/openfin/v34/_v2/util/promises.d.ts new file mode 100644 index 0000000000..8e7bf9efe9 --- /dev/null +++ b/types/openfin/v34/_v2/util/promises.d.ts @@ -0,0 +1,5 @@ +export declare function promisify(func: Function): (...args: any[]) => Promise; +export declare function promiseMap(arr: T[], asyncF: (x: T, i: number, r: T[]) => Promise): Promise; +export declare type asyncF = (...args: any[]) => Promise; +export declare function serial(arr: asyncF[]): Promise; +export declare function promiseMapSerial(arr: any[], func: asyncF): Promise; diff --git a/types/openfin/v34/_v2/util/ref-counter.d.ts b/types/openfin/v34/_v2/util/ref-counter.d.ts new file mode 100644 index 0000000000..8184e09079 --- /dev/null +++ b/types/openfin/v34/_v2/util/ref-counter.d.ts @@ -0,0 +1,7 @@ +export default class RefCoutner { + topicRefMap: Map; + incRefCount(key: string): number; + decRefCount(key: string): number; + actOnFirst(key: string, firstAction: () => any, nonFirstAction?: () => void): any; + actOnLast(key: string, lastAction: () => any, nonLastAction?: () => void): any; +} diff --git a/types/openfin/v34/index.d.ts b/types/openfin/v34/index.d.ts new file mode 100644 index 0000000000..fe34f0b630 --- /dev/null +++ b/types/openfin/v34/index.d.ts @@ -0,0 +1,1907 @@ +// Type definitions for OpenFin API 34.0 +// Project: https://openfin.co/ +// Definitions by: Chris Barker +// Ricardo de Pena +// Roma +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.9 + +// based on v9.61.34.22 +// see https://openfin.co/support/technical-faq/#what-do-the-numbers-in-the-runtime-version-mean + +/** + * JavaScript API + * The JavaScript API allows you to create an HTML/JavaScript application that has access to the native windowing environment, + * can communicate with other applications and has access to sandboxed system-level features. + * + * API Ready + * When using the OpenFin API, it is important to ensure that it has been fully loaded before making any API calls. To verify + * that the API is in fact ready, be sure to make any API calls either from within the fin.desktop.main() method or explicitly + * after it has returned. This avoids the situation of trying to access methods that are not yet fully injected. + * + * Overview + * When running within the OpenFin Runtime your web applications have access to the "fin" namespace and all the modules within the API + * without the need to include additional source files. You can treat the "fin" namespace as you would the "window", "navigator" or "documennt" objects. + */ +declare namespace fin { + var Application: import('./_v2/api/application/application').default + var Clipboard: import('./_v2/api/clipboard/clipboard').default + var ExternalApplication: import('./_v2/api/external-application/external-application').default + var Frame: import('./_v2/api/frame/frame').default + var GlobalHotkey: import('./_v2/api/global-hotkey/index').default + var InterApplicationBus: import('./_v2/api/interappbus/interappbus').default + var Notification: import('./_v2/api/notification/notification').default + var System: import('./_v2/api/system/system').default + var Window: import('./_v2/api/window/window').default + + const desktop: OpenFinDesktop; + + interface OpenFinDesktop { + main(f: () => any): void; + Application: OpenFinApplicationStatic; + ExternalApp: OpenFinExternalApplicationStatic; + InterApplicationBus: OpenFinInterApplicationBus; + Notification: OpenFinNotificationStatic; + System: OpenFinSystem; + Window: OpenFinWindowStatic; + Frame: OpenFinFrameStatic; + } + + interface OpenFinApplicationStatic { + /** + * Creates a new Application. + * An object representing an application. Allows the developer to create, execute, show/close an application as well as listen to application events. + */ + new ( + options: ApplicationOptions, + callback?: (successObj: { httpResponseCode: number }) => void, + errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): OpenFinApplication; + /** + * Launches the given Application manifest. + */ + createFromManifest(manifestUrl: string, callback?: (app: OpenFinApplication) => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Returns an Application object that represents an existing application. + */ + getCurrent(): OpenFinApplication; + /** + * Returns an Application object that represents an existing application. + */ + wrap(uuid: string): OpenFinApplication; + } + + /** + * Application + * An object representing an application.Allows the developer to create, execute, show / close an application as well as listen to application events. + */ + interface OpenFinApplication { + /** + * Returns an instance of the main Window of the application + */ + getWindow(): OpenFinWindow; + /** + * Registers an event listener on the specified event. + */ + addEventListener( + type: OpenFinApplicationEventType, + listener: (event: ApplicationBaseEvent + | TrayIconClickedEvent + | WindowEvent + | WindowAlertRequestedEvent + | WindowAuthRequested + | WindowNavigationRejectedEvent + | WindowEndLoadEvent) => void, + callback?: () => void, + errorCallback?: (reason: string) => void): void; + /** + * Closes the application and any child windows created by the application. + */ + close(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array of wrapped fin.desktop.Windows for each of the application's child windows. + */ + getChildWindows(callback?: (children: OpenFinWindow[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array of active window groups for all of the application's windows. Each group is represented as an array of wrapped fin.desktop.Windows. + */ + getGroups(callback?: (groups: OpenFinWindow[][]) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves the JSON manifest that was used to create the application. Invokes the error callback if the application was not created from a manifest. + */ + getManifest(callback?: (manifest: any) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves UUID of the application that launches this application. Invokes the error callback if the application was created from a manifest. + */ + getParentUuid(callback?: (uuid: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves current configuration of application's shortcuts. + */ + getShortcuts(callback?: (config: ShortCutConfig) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves information about the application. + */ + getInfo(callback?: (info: LaunchInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves information about the system tray. + */ + getTrayIconInfo(callback?: (trayInfo: TrayIconInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Determines if the application is currently running. + */ + isRunning(callback?: (running: boolean) => void, errorCallback?: (reason: string) => void): void; + /** + * Registers a username and an app name for licensing purposes. + */ + registerUser(userName: string, appName: string, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Removes a previously registered event listener from the specified event. + */ + removeEventListener( + type: OpenFinApplicationEventType, + previouslyRegisteredListener: (event: ApplicationBaseEvent + | TrayIconClickedEvent + | WindowEvent + | WindowAlertRequestedEvent + | WindowAuthRequested + | WindowNavigationRejectedEvent + | WindowEndLoadEvent) => any, + callback?: () => void, + errorCallback?: (reason: string) => void): void; + /** + * Removes the application's icon from the tray. + */ + removeTrayIcon(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Restarts the application. + */ + restart(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Runs the application. When the application is created, run must be called. + */ + run(callback?: (successObj: SuccessObj) => void, errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): void; + /** + * Tells the rvm to relaunch the main application once upon a complete shutdown + */ + scheduleRestart(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Sets new shortcut configuration for current application. + * Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest to + * be able to change shortcut states. + */ + setShortcuts(config: ShortCutConfig, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Adds a customizable icon in the system tray and notifies the application when clicked. + */ + setTrayIcon(iconUrl: string, listener: (clickInfo: TrayIconClickedEvent) => void, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Closes the application by terminating its process. + */ + terminate(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Waits for a hanging application. This method can be called in response to an application "not-responding" to allow the application + * to continue and to generate another "not-responding" message after a certain period of time. + */ + wait(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * The Application's uuid + */ + uuid: string; + } + + interface ShortCutConfig { + /** + * application has a shortcut on the desktop + */ + desktop?: boolean; + /** + * application has no shortcut in the start menu + */ + startMenu?: boolean; + /** + * application will be launched on system startup + */ + systemStartup?: boolean; + } + + interface SuccessObj { + httpResponseCode: number; + } + + interface NetworkErrorInfo extends ErrorInfo { + networkErrorCode: number; + } + + interface ErrorInfo { + stack: string; + message: string; + } + + interface ApplicationOptions { + /** + * The name of the application. + */ + name?: string; + /** + * The url to the application. + */ + url?: string; + /** + * The UUID of the application, unique within the set of all other applications running in the OpenFin Runtime. name and uuid must match. + */ + uuid?: string; + /** + * Enable Flash at the application level. Default: false. + */ + plugins?: boolean; + /** + * The options of the main window of the application. + */ + mainWindowOptions?: WindowOptions; + } + + interface WindowOptions { + /** + * Enable keyboard shortcuts for devtools and zoom. Default: false for both. + */ + accelerator?: { + devtools?: boolean, + zoom?: boolean, + reload?: boolean, + reloadIgnoreCache?: boolean, + }; + /** + * A flag to always position the window at the top of the window stack. Default: false. + * Updatable + */ + alwaysOnTop?: boolean; + /** + * A flag to automatically show the Window when it is created. Default: false. + */ + autoShow?: boolean; + /** + * A flag to show the context menu when right-clicking on a window. Gives access to the Developer Console for the Window. Default: true + * Updatable + */ + contextMenu?: boolean; + /** + * This defines and applies rounded corners for a frameless window. Default for both width and height: 0. + * Updatable + */ + cornerRounding?: { + width?: number; + height?: number; + }; + /** + * A field that the user can attach serializable data to to be ferried around with the window options. Default: ''. + */ + customData?: any; + /** + * Specifies that the window will be positioned in the center of the primary monitor when loaded for the first time on a machine. + * When the window corresponding to that id is loaded again, the position from before the window was closed is used. + * This option overrides defaultLeft and defaultTop. Default: false. + */ + defaultCentered?: boolean; + /** + * The default height of the window. Specifies the height of the window when loaded for the first time on a machine. + * When the window corresponding to that id is loaded again, the height is taken to be the last height of the window before it was closed. Default: 500. + */ + defaultHeight?: number; + /** + * The default left position of the window. Specifies the position of the left of the window when loaded for the first time on a machine. + * When the window corresponding to that id is loaded again, the value of left is taken to be the last value before the window was closed. Default: 100. + */ + defaultWidth?: number; + /** + * The default top position of the window. Specifies the position of the top of the window when loaded for the first time on a machine. + * When the window corresponding to that id is loaded again, the value of top is taken to be the last value before the window was closed. Default: 100. + */ + defaultTop?: number; + /** + * The default width of the window. Specifies the width of the window when loaded for the first time on a machine. + * When the window corresponding to that id is loaded again, the width is taken to be the last width of the window before it was closed. Default: 800. + */ + defaultLeft?: number; + /** + * A flag to show the frame. Default: true. + * Updatable + */ + frame?: boolean; + /** + * A flag to allow a window to be hidden when the close button is clicked.Default: false. + * Updatable + */ + hideOnClose?: boolean; + /** + * A URL for the icon to be shown in the window title bar and the taskbar.Default: The parent application's applicationIcon. + * Updatable + */ + icon?: string; + /** + * The maximum height of a window.Will default to the OS defined value if set to - 1. Default: -1. + * Updatable + */ + maxHeight?: number; + /** + * A flag that lets the window be maximized.Default: true. + * Updatable + */ + maximizable?: boolean; + /** + * The maximum width of a window.Will default to the OS defined value if set to - 1. Default: -1. + * Updatable + */ + maxWidth?: number; + /** + * The minimum height of a window.Default: 0. + * Updatable + */ + minHeight?: number; + /** + * A flag that lets the window be minimized.Default: true. + */ + minimizable?: boolean; + /** + * The minimum width of a window.Default: 0. + */ + minWidth?: number; + /** + * The name for the window which must be unique within the context of the invoking Application. + */ + name?: string; + /** + * A flag that specifies how transparent the window will be.This value is clamped between 0.0 and 1.0.Default: 1.0. + * Updatable + */ + opacity?: number; + /** + * A flag to drop to allow the user to resize the window.Default: true. + * Updatable + */ + resizable?: boolean; + /** + * Defines a region in pixels that will respond to user mouse interaction for resizing a frameless window. + * Updatable + */ + resizeRegion?: { + /** + * The size in pixels (Default: 2), + */ + size?: number; + /** + * The size in pixels of an additional + * square resizable region located at the + * bottom right corner of a + * frameless window. (Default: 4) + */ + bottomRightCorner?: number; + }; + /** + * A flag to show the Window's icon in the taskbar. Default: true. + */ + showTaskbarIcon?: boolean; + /** + * A flag to cache the location of the window or not. Default: true. + */ + saveWindowState?: boolean; + /** + * Specify a taskbar group for the window. Default: app's uuid. + */ + taskbarIconGroup?: string; + /** + * A string that sets the window to be "minimized", "maximized", or "normal" on creation. Default: "normal". + */ + state?: string; + /** + * The URL of the window. Default: "about:blank". + */ + url?: string; + /** + * When set to false, the window will render before the "load" event is fired on the content's window. + * Caution, when false you will see an initial empty white window. Default: true. + */ + waitForPageLoad?: boolean; + } + + /** + * Clipboard + * Clipboard API allows reading and writting to the clipboard in multiple formats. + */ + interface OpenFinClipboard { + /** + * Reads available formats for the clipboard type + */ + availableFormats(type: string | null, callback?: (formats: string[]) => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Reads available formats for the clipboard type + */ + readHtml(type: string | null, callback?: (html: string) => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Read the content of the clipboard as Rtf + */ + readRtf(type: string | null, callback?: (rtf: string) => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Read the content of the clipboard as plain text + */ + readText(type: string | null, callback?: (text: string) => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Writes data into the clipboard + */ + write(data: any, type: string | null, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Writes data into the clipboard as Html + */ + writeHtml(data: string, type: string | null, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Writes data into the clipboard as Rtf + */ + writeRtf(data: string, type: string | null, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Writes data into the clipboard as plain text + */ + writeText(data: string, type: string | null, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + } + + interface OpenFinExternalApplicationStatic { + /** + * Returns an External Application object that represents an existing external application. + */ + wrap(uuid: string): OpenFinExternalApplication; + } + /** + * ExternalApplication + * An object representing an application. Allows the developer to create, execute, show and close an application, as well as listen to application events. + */ + interface OpenFinExternalApplication { + /** + * Retrieves information about the application. + */ + getInfo(callback?: (info: ExternalApplicationInfo) => void, + errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Registers an event listener on the specified event. + */ + addEventListener( + type: OpenFinExternalApplicationEventType, + listener: () => void, + callback?: () => void, + errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Removes a previously registered event listener from the specified event. + */ + removeEventListener( + type: OpenFinExternalApplicationEventType, + listener: () => void, + callback?: () => void, + errorCallback?: (reason: string, error: ErrorInfo) => void): void; + } + + /** + * InterApplicationBus + * A messaging bus that allows for pub/sub messaging between different applications. + */ + interface OpenFinInterApplicationBus { + /** + * Adds a listener that gets called when applications subscribe to the current application's messages. + */ + addSubscribeListener(listener: (uuid: string, topic: string, name: string) => void): void; + /** + * Adds a listener that gets called when applications unsubscribe to the current application's messages. + */ + addUnsubscribeListener(listener: (uuid: string, topic: string, name: string) => void): void; + /** + * Removes a previously registered subscribe listener. + */ + removeSubscribeListener(listener: (uuid: string, topic: string, name: string) => void): void; + /** + * Removes a previously registered unsubscribe listener. + */ + removeUnsubscribeListener(listener: (uuid: string, topic: string, name: string) => void): void; + /** + * Publishes a message to all applications running on OpenFin Runtime that are subscribed to the specified topic. + */ + publish(topic: string, message: any, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Sends a message to a specific application on a specific topic. + */ + send(destinationUuid: string, name: string, topic: string, message: any, callback?: () => void, errorCallback?: (reason: string) => void): void; + send(destinationUuid: string, topic: string, message: any, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Subscribes to messages from the specified application on the specified topic. If the subscription is for a uuid, [name], + * topic combination that has already been published to upon subscription you will receive the last 20 missed messages in the order they were published. + */ + subscribe( + senderUuid: string, + name: string, + topic: string, + listener: (message: any, uuid: string, name: string) => void, + callback?: () => void, + errorCallback?: (reason: string) => void): void; + subscribe( + senderUuid: string, + topic: string, + listener: (message: any, uuid: string, name: string) => void, + callback?: () => void, + errorCallback?: (reason: string) => void): void; + /** + * Unsubscribes to messages from the specified application on the specified topic. + */ + unsubscribe( + senderUuid: string, + name: string, + topic: string, + listener: (message: any, uuid: string, name: string) => void, + callback?: () => void, + errorCallback?: (reason: string) => void): void; + unsubscribe( + senderUuid: string, + topic: string, + listener: (message: any, uuid: string, name: string) => void, + callback?: () => void, + errorCallback?: (reason: string) => void): void; + } + + interface OpenFinNotificationStatic { + /** + * ctor + */ + new (options: NotificationOptions, callback?: () => void, errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): OpenFinNotification; + /** + * Gets an instance of the current notification. For use within a notification window to close the window or send a message back to its parent application. + */ + getCurrent(): OpenFinNotification; + } + + /** + * Notification + * Notification represents a window on OpenFin Runtime which is shown briefly to the user on the bottom-right corner of the primary monitor. + * A notification is typically used to alert the user of some important event which requires his or her attention. + * Notifications are a child or your application that are controlled by the runtime. + */ + interface OpenFinNotification { + /** + * Closes the notification. + */ + close(callback?: () => void): void; + /** + * Sends a message to the notification. + */ + sendMessage(message: any, callback?: () => void): void; + /** + * Sends a message from the notification to the application that created the notification. The message is handled by the notification's onMessage callback. + */ + sendMessageToApplication(message: any, callback?: () => void): void; + } + + interface NotificationOptions { + /** + * A boolean that will force dismissal even if the mouse is hovering over the notification + */ + ignoreMouseOver?: boolean; + /** + * A message of any primitive or composite-primitive type to be passed to the notification upon creation. + */ + message?: any; + /** + * The timeout for displaying a notification.Can be in milliseconds or "never". + */ + duration?: number | "never"; + /** + * The url of the notification + */ + url?: string; + /** + * A function that is called when a notification is clicked. + */ + onClick?(callback: () => void): void; + /** + * Invoked when the notification is closed via .close() method on the created notification instance + * or the by the notification itself via fin.desktop.Notification.getCurrent().close(). + * NOTE: this is not invoked when the notification is dismissed via a swipe. For the swipe dismissal callback see onDismiss + */ + onClose?(callback: () => void): void; + /** + * Invoked when a the notification is dismissed by swiping it off the screen to the right. NOTE: this is no fired on a programmatic close. + */ + onDismiss?(callback: () => void): void; + /** + * A function that is called when an error occurs.The reason for the error is passed as an argument. + */ + onError?(errorCallback: (reason: string, errorObj: NetworkErrorInfo) => void): void; + /** + * The onMessage function will respond to messages sent from notification.sendMessageToApplication. + * The function is passed the message, which can be of any primitive or composite-primitive type. + */ + onMessage?(callback: (message: any) => void): void; + /** + * A function that is called when a notification is shown. + */ + onShow?(callback: (successObj: SuccessObj) => void): void; + } + + /** + * System + * An object representing the core of OpenFin Runtime. + * Allows the developer to perform system-level actions, such as accessing logs, viewing processes, clearing the cache and exiting the runtime. + */ + interface OpenFinSystem { + Clipboard: OpenFinClipboard; + /** + * Registers an event listener on the specified event. + */ + addEventListener( + type: OpenFinSystemEventType, + listener: (event: SystemBaseEvent | DesktopIconClickedEvent | IdleStateChangedEvent | MonitorInfoChangedEvent | SessionChangedEvent) => void, + callback?: () => void, + errorCallback?: (reason: string) => void): void; + /** + * Clears cached data containing window state/positions, + * application resource files (images, HTML, JavaScript files), cookies, and items stored in the Local Storage. + */ + clearCache(options: CacheOptions, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Clears all cached data when OpenFin Runtime exits. + */ + deleteCacheOnExit(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Downloads the given application asset + */ + downloadAsset( + assetObj: AppAssetInfo, + progressListener?: (progress: { downloadedBytes: number, totalBytes: number }) => void, + callback?: (successObj: { path: string }) => void, + errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): void; + + /** + * Download preload scripts from given URLs + */ + downloadPreloadScripts(scripts: DownloadPreloadOption[], callback?: (downloadInfo: DownloadPreloadInfo[]) => void, + errorCallback?: (reason: string) => void): void; + /** + * Downloads the given OpenFin Runtime. + */ + downloadRuntime(options: RuntimeDownloadOptions, onProgress?: (progress: RuntimeDownloadProgress) => void, onComplete?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Exits the Runtime. + */ + exit(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Writes any unwritten cookies data to disk. + */ + flushCookieStore(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array of data for all applications. + */ + getAllApplications(callback?: (applicationInfoList: ApplicationInfo[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array of data for all external applications. + */ + getAllExternalApplications(callback?: (applicationInfoList: ApplicationInfo[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array of data (name, ids, bounds) for all application windows. + */ + getAllWindows(callback?: (windowInfoList: WindowDetails[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Returns information about the app asset. + */ + getAppAssetInfo(options: AppAssetOptions, callback?: (appAssetInfo: AppAssetInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Get additional info of cookies. + */ + getCookies(option: CookieOption, callback?: (info: CookieInfo[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves the command line argument string that started OpenFin Runtime. + */ + getCommandLineArguments(callback?: (args: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves the configuration object that started the OpenFin Runtime. + */ + getDeviceId(callback?: (uuid: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Returns a hex encoded hash of the mac address and the currently logged in user name + */ + getDeviceUserId(callback?: (id: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Returns an Entity info object relating to the entity specified by the uuid and name passed in. The possible types are 'window', 'iframe', 'external connection' or 'unknown'. + */ + getEntityInfo(uuid: string, name: string, callback?: (info: EntityInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Gets the value of a given environment variable on the computer on which the runtime is installed. + */ + getEnvironmentVariable(envVar: string, callback?: (variable: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves currently focused window identity. + */ + getFocusedWindow(callback?: (focusedWindowIdentity: Identity) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves system information. + */ + getHostSpecs(callback?: (info: HostSpecInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves the contents of the log with the specified filename. + */ + getLog(logFileName: string, callback?: (variable: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array containing information for each log file. + */ + getLogList(callback?: (logInfoList: LogInfo[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves the minimum (inclusive) logging level that is currently being written to the logs. + */ + getMinLogLevel(callback?: (logLevel: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an object that contains data about the about the monitor setup of the computer that the runtime is running on. + */ + getMonitorInfo(callback?: (monitorInfo: MonitorInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Returns the mouse in virtual screen coordinates (left, top). + */ + getMousePosition(callback?: (mousePosition: VirtualScreenCoordinates) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array of all of the runtime processes that are currently running. + * Each element in the array is an object containing the uuid and the name of the application to which the process belongs. + */ + getProcessList(callback?: (processInfoList: ProcessInfo[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves the Proxy settings. + */ + getProxySettings(callback?: (proxy: ProxyInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Returns information about the running RVM in an object. + */ + getRvmInfo(callback?: (rvmInfo: RvmInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Returns the version of the runtime. The version contains the major, minor, build and revision numbers. + */ + getVersion(callback?: (version: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Runs an executable or batch file. + */ + launchExternalProcess(options: ExternalProcessLaunchInfo, callback?: (payload: { uuid: string }) => void, errorCallback?: (reason: string) => void): void; + /** + * Writes the passed message into both the log file and the console. + */ + log(level: "debug" | "info" | "warn" | "error", message: string, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Monitors a running process. + */ + monitorExternalProcess(options: ExternalProcessInfo, callback?: (payload: { uuid: string }) => void, errorCallback?: (reason: string) => void): void; + /** + * Opens the passed URL in the default web browser. + */ + openUrlWithBrowser(url: string, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Opens the passed URL in the default web browser. + */ + readRegistryValue(rootKey: string, subkey: string, value: string, callback?: (info: RegistryInfo) => void, + errorCallback?: (reason: string) => void): void; + /** + * This function call will register a unique id and produce a token. The token can be used to broker an external connection. + */ + registerExternalConnection( + uuid: string, + callback?: (detail: { + /** + * this will be unique each time + */ + token: string; + /** + * "remote-connection-uuid" + */ + uuid: string; + }) => void, + errorCallback?: (reason: string) => void): void; + /** + * Removes the process entry for the passed UUID obtained from a prior call of fin.desktop.System.launchExternalProcess(). + */ + releaseExternalProcess(processUuid: string, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Removes a previously registered event listener from the specified event. + */ + removeEventListener( + type: OpenFinSystemEventType, + listener: (event: SystemBaseEvent | DesktopIconClickedEvent | IdleStateChangedEvent | MonitorInfoChangedEvent | SessionChangedEvent) => void, + callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Set the minimum log level above which logs will be written to the OpenFin log + */ + setMinLogLevel(logLevel: string, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Shows the Chrome Developer Tools for the specified window. + */ + showDeveloperTools(uuid: string, name: string, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Attempt to close an external process. The process will be terminated if it has not closed after the elapsed timeout in milliseconds. + */ + terminateExternalProcess( + processUuid: string, + timeout: number, + killTree: boolean, + callback?: (info: { result: "clean" | "terminated" | "failed" }) => void, + errorCallback?: (reason: string) => void): void; + terminateExternalProcess( + processUuid: string, + timeout: number, + callback?: (info: { result: "clean" | "terminated" | "failed" }) => void, + errorCallback?: (reason: string) => void): void; + /** + * Update the OpenFin Runtime Proxy settings. + */ + updateProxySettings(type: string, address: string, port: number, callback?: () => void, errorCallback?: (reason: string) => void): void; + } + + interface CacheOptions { + cache?: boolean; + cookies?: boolean; + localStorage?: boolean; + appcache?: boolean; + userData?: boolean; + } + + interface AppAssetInfo { + src?: string; + alias?: string; + version?: string; + target?: string; + args?: string; + mandatory?: boolean; + } + + interface AppAssetOptions { + alias: string; + } + + interface ApplicationInfo { + /** + * true when the application is running. + */ + isRunning?: boolean; + /** + * uuid of the application. + */ + uuid?: string; + /** + * uuid of the application that launches this application. + */ + parentUuid?: string; + } + + interface Identity { + uuid: string; + name: string; + } + + interface EntityInfo { + name: string; + uuid: string; + parent: Identity; + entityType: string; + } + + interface DownloadPreloadOption { + url: string; + } + + interface DownloadPreloadInfo { + success: boolean; + url?: string; + error: string; + } + + interface CookieInfo { + name: string; + // expirationDate: Date; + domain: string; + path: string; + } + + interface CookieOption { + name: string; + } + + interface RegistryInfo { + data: any; + rootKey: string; + subkey: string; + type: string; + value: string; + } + + interface RuntimeDownloadOptions { + version: string; + } + + interface RuntimeDownloadProgress { + downloadedBytes: number; + totalBytes: number; + } + + interface WindowDetails { + uuid?: string; + mainWindow?: WindowInfo; + childWindows?: WindowInfo[]; + } + + interface WindowInfo { + /** + * name of the child window + */ + name?: string; + /** + * top-most coordinate of the child window + */ + top?: number; + /** + * right-most coordinate of the child window + */ + right?: number; + /** + * bottom-most coordinate of the child window + */ + bottom?: number; + /** + * left-most coordinate of the child window + */ + left?: number; + } + + interface HostSpecInfo { + /** + * "x86" for 32-bit or "x86_64" for 64-bit + */ + arch: string; + /** + * Same payload as Node's os.cpus() + */ + cpus: NodeCpuInfo[]; + gpu: { + /** + * Graphics card name + */ + name: string; + }; + /** + * Same payload as Node's os.totalmem() + */ + memory: number; + /** + * OS name and version/edition + */ + name: string; + } + + interface NodeCpuInfo { + model: string; + /** + * in MHz + */ + speed: number; + times: { + /** + * The number of milliseconds the CPU has spent in user mode. + */ + user: number; + /** + * The number of milliseconds the CPU has spent in nice mode. + */ + nice: number; + /** + * The number of milliseconds the CPU has spent in sys mode. + */ + sys: number; + /** + * The number of milliseconds the CPU has spent in idle mode. + */ + idle: number; + /** + * The number of milliseconds the CPU has spent in irq mode. + */ + irq: number; + }; + } + + interface LogInfo { + /** + * the filename of the log + */ + name?: string; + /** + * the size of the log in bytes + */ + size?: number; + /** + * the unix time at which the log was created "Thu Jan 08 2015 14:40:30 GMT-0500 (Eastern Standard Time)" + */ + date?: string; + } + + interface ProcessInfo { + /** + * the percentage of total CPU usage + */ + cpuUsage?: number; + /** + * the application name + */ + name?: string; + /** + * the current nonpaged pool usage in bytes + */ + nonPagedPoolUsage?: number; + /** + * the number of page faults + */ + pageFaultCount?: number; + /** + * the current paged pool usage in bytes + */ + pagedPoolUsage?: number; + /** + * the total amount of memory in bytes that the memory manager has committed + */ + pagefileUsage?: number; + /** + * the peak nonpaged pool usage in bytes + */ + peakNonPagedPoolUsage?: number; + /** + * the peak paged pool usage in bytes + */ + peakPagedPoolUsage?: number; + /** + * the peak value in bytes of pagefileUsage during the lifetime of this process + */ + peakPagefileUsage?: number; + /** + * the peak working set size in bytes + */ + peakWorkingSetSize?: number; + /** + * the native process identifier + */ + processId?: number; + /** + * the application UUID + */ + uuid?: string; + /** + * the current working set size (both shared and private data) in bytes + */ + workingSetSize?: number; + } + + interface ProxyInfo { + /** + * the configured Proxy Address + */ + proxyAddress?: string; + /** + * the configured Proxy port + */ + proxyPort?: number; + /** + * Proxy Type + */ + type?: string; + } + + interface RvmInfo { + version?: string; + "start-time"?: string; + } + + interface ExternalProcessLaunchInfo { + path?: string; + /** + * Additionally note that the executable found in the zip file specified in appAssets + * will default to the one mentioned by appAssets.target + * If the the path below refers to a specific path it will override this default + */ + alias?: string; + /** + * When using alias; if no arguments are passed then the arguments (if any) + * are taken from the 'app.json' file, from the 'args' parameter + * of the 'appAssets' Object with the relevant 'alias'. + * If 'arguments' is passed as a parameter it takes precedence + * over any 'args' set in the 'app.json'. + */ + arguments?: string; + listener?(result: { + /** + * "Exited" Or "released" on a call to releaseExternalProcess + */ + topic?: string; + /** + * The mapped UUID which identifies the launched process + */ + uuid?: string; + /* + * Process exit code + */ + exitCode?: number; + }): void; + certificate?: CertificationInfo; + } + + interface CertificationInfo { + /** + * A hex string with or without spaces + */ + serial?: string; + /** + * An internally tokenized and comma delimited string allowing partial or full checks of the subject fields + */ + subject?: string; + /** + * A hex string with or without spaces + */ + publickey?: string; + /** + * A hex string with or without spaces + */ + thumbprint?: string; + /** + * A boolean indicating that the certificate is trusted and not revoked + */ + trusted?: boolean; + } + + interface ExternalProcessInfo { + pid?: number; + listener?(result: { + /** + * "Exited" Or "released" on a call to releaseExternalProcess + */ + topic?: string; + /** + * The mapped UUID which identifies the launched process + */ + uuid?: string; + /* + * Process exit code + */ + exitCode?: number; + }): void; + } + + interface OpenFinWindowStatic { + /** + * Class: Window + * + * new Window(options, callbackopt, errorCallbackopt) + * + * Creates a new OpenFin Window + * + * A basic window that wraps a native HTML window. Provides more fine-grained control over the window state such as the ability to minimize, + * maximize, restore, etc. By default a window does not show upon instantiation; instead the window's show() method must be invoked manually. + * The new window appears in the same process as the parent window. + * @param options - The options of the window + * @param [callback] - Called if the window creation was successful + * @param [callback.successObj] - httpResponseCode + */ + new ( + options: WindowOptions, + callback?: (successObj: { httpResponseCode: number }) => void, + errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): OpenFinWindow; + /** + * Returns an instance of the current window. + * @returns Current window + */ + getCurrent(): OpenFinWindow; + /** + * Returns a Window object that wraps an existing window. + */ + wrap(appUuid: string, windowName: string): OpenFinWindow; + } + + /** + * Window + * A basic window that wraps a native HTML window. Provides more fine-grained control over the window state such as the ability to minimize, + * maximize, restore, etc. By default a window does not show upon instantiation; instead the window's show() method must be invoked manually. + * The new window appears in the same process as the parent window. + */ + interface OpenFinWindow { + /** + * uuid of the application that the window belongs to. + */ + uuid: string; + /** + * Name of window + */ + name: string; + /** + * Returns the native JavaScript "window" object for the window. This method can only be used by the parent application or the window itself, + * otherwise it will return undefined. The same Single-Origin-Policy (SOP) rules apply for child windows created by window.open(url) in that the + * contents of the window object are only accessible if the URL has the same origin as the invoking window. See example below. + * Also, will not work with fin.desktop.Window objects created with fin.desktop.Window.wrap(). + * @returns Native window + */ + getNativeWindow(): Window; + /** + * Gets the parent application. + * @returns Parent application + */ + getParentApplication(): OpenFinApplication; + /** + * Gets the parent window. + */ + getParentWindow(): OpenFinWindow; + /** + * Registers an event listener on the specified event. + */ + addEventListener( + type: OpenFinWindowEventType, + listener: (event: WindowBaseEvent + | WindowAuthRequestedEvent + | WindowBoundsEvent + | WindowExternalProcessStartedEvent + | WindowExternalProcessExited + | WindowGroupChangedEvent + | WindowHiddenEvent + | Window_NavigationRejectedEvent) => void, + callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Performs the specified window transitions + */ + animate(transitions: AnimationTransition, options: AnimationOptions, callback?: (event: any) => void, errorCallback?: (reason: string) => void): void; + /** + * Provides credentials to authentication requests + */ + authenticate(userName: string, password: string, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Removes focus from the window. + */ + blur(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Brings the window to the front of the OpenFin window stack. + */ + bringToFront(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Closes the window. + * @param Close will be prevented from closing when force is false and 'close-requested' has been subscribed to for application's main window. + */ + close(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Prevents a user from changing a window's size/position when using the window's frame. + * 'disabled-frame-bounds-changing' is generated at the start of and during a user move/size operation. + * 'disabled-frame-bounds-changed' is generated after a user move/size operation. + * The events provide the bounds that would have been applied if the frame was enabled. + * 'frame-disabled' is generated when an enabled frame becomes disabled. + */ + disableFrame(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Re-enables user changes to a window's size/position when using the window's frame. + * 'disabled-frame-bounds-changing' is generated at the start of and during a user move/size operation. + * 'disabled-frame-bounds-changed' is generated after a user move/size operation. + * The events provide the bounds that would have been applied if the frame was enabled. + * 'frame-enabled' is generated when a disabled frame has becomes enabled. + */ + enableFrame(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Flashes the window's frame and taskbar icon until the window is activated. + */ + flash(options?: any, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Gives focus to the window. + */ + focus(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Gets the current bounds (top, left, width, height) of the window. + */ + getBounds(callback?: (bounds: WindowBounds) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array containing wrapped fin.desktop.Windows that are grouped with this window. If a window is not in a group an empty array is returned. + * Please note that calling window is included in the result array. + */ + getGroup(callback?: (group: OpenFinWindow[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Gets the current settings of the window. + */ + getOptions(callback?: (options: WindowOptions) => void, errorCallback?: (reason: string) => void): void; + /** + * Gets a base64 encoded PNG snapshot of the window. + */ + getSnapshot(callback?: (base64Snapshot: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Gets the current state ("minimized", "maximized", or "restored") of the window. + */ + getState(callback?: (state: "minimized" | "maximized" | "restored") => void, errorCallback?: (reason: string) => void): void; + /** + * Returns the zoom level of the window. + */ + getZoomLevel(callback?: (level: number) => void, errorCallback?: (reason: string) => void): void; + /** + * Hides the window. + */ + hide(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Determines if the window is currently showing. + */ + isShowing(callback?: (showing: boolean) => void, errorCallback?: (reason: string) => void): void; + /** + * Joins the same window group as the specified window. + */ + joinGroup(target: OpenFinWindow, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Leaves the current window group so that the window can be move independently of those in the group. + */ + leaveGroup(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Maximizes the window. + */ + maximize(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Merges the instance's window group with the same window group as the specified window + */ + mergeGroups(target: OpenFinWindow, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Minimizes the window. + */ + minimize(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Moves the window by a specified amount. + */ + moveBy(deltaLeft: number, deltaTop: number, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Moves the window to a specified location. + */ + moveTo(left: number, top: number, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Removes a previously registered event listener from the specified event. + */ + removeEventListener( + type: OpenFinWindowEventType, + listener: (event: WindowBaseEvent + | WindowAuthRequestedEvent + | WindowBoundsEvent + | WindowExternalProcessStartedEvent + | WindowExternalProcessExited + | WindowGroupChangedEvent + | WindowHiddenEvent + | Window_NavigationRejectedEvent) => void, + callback?: () => void, + errorCallback?: (reason: string) => void): void; + /** + * Resizes the window by a specified amount. + */ + resizeBy(deltaWidth: number, deltaHeight: number, anchor: OpenFinAnchor, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Resizes the window by a specified amount. + */ + resizeTo(width: number, height: number, anchor: OpenFinAnchor, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Restores the window to its normal state (i.e., unminimized, unmaximized). + */ + restore(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Will bring the window to the front of the entire stack and give it focus. + */ + setAsForeground(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Sets the window's size and position + */ + setBounds(left: number, top: number, width: number, height: number, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Sets the zoom level of the window. + */ + setZoomLevel(level: number, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Shows the window if it is hidden. + * @param Show will be prevented from closing when force is false and 'show-requested' has been subscribed to for application's main window. + */ + show(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Shows the window if it is hidden at the specified location. If the toggle parameter is set to true, the window will alternate between showing and hiding. + */ + showAt(left: number, top: number, force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Stops the taskbar icon from flashing. + */ + stopFlashing(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Updates the window using the passed options + */ + updateOptions(options: WindowOptions, callback?: () => void, errorCallback?: (reason: string) => void): void; + } + + interface OpenFinFrameStatic { + wrap(uuid: string, name: string): OpenFinFrame; + + getCurrent(): OpenFinFrame; + } + + interface OpenFinFrame { + name: string; + uuid: string; + + addEventListener(type: string, listener: () => void, callback?: () => void, errorCallback?: (reason: string) => void): void; + + getParentWindow(callback?: (entityInfo: EntityInfo) => void, errorCallback?: (reason: string) => void): void; + + getInfo(callback?: (entityInfo: EntityInfo) => void, errorCallback?: (reason: string) => void): void; + + removeEventListener(type: string, listener: () => void, callback?: () => void, errorCallback?: (reason: string) => void): void; + } + + interface ApplicationBaseEvent { + topic: string; + type: OpenFinApplicationEventType; + uuid: string; + } + + interface TrayIconClickedEvent extends ApplicationBaseEvent { + button: number; // 0 for left, 1 for middle, 2 for right + monitorInfo: MonitorInfo; + x: number; // the cursor x coordinate + y: number; // the cursor y coordinate + } + + interface WindowEvent extends ApplicationBaseEvent { + name: string; + } + + interface WindowAlertRequestedEvent extends WindowEvent { + message: string; + url: string; + } + + interface WindowAuthRequested extends WindowEvent { + authInfo: { + host: string; + isProxy: boolean; + port: number; + realm: string; + scheme: string; + }; + } + + interface WindowNavigationRejectedEvent extends WindowEvent { + sourceName: string; + url: string; + } + + interface WindowEndLoadEvent extends WindowEvent { + documentName: string; + isMain: boolean; + } + + interface MonitorInfoChangedEvent extends MonitorInfo { + topic: "system"; + type: "monitor-info-changed"; + } + + interface MonitorInfo { + nonPrimaryMonitors: MonitorInfoDetail[]; + primaryMonitor: MonitorInfoDetail; + reason: string; + taskbar: { + edge: "left" | "right" | "top" | "bottom", + rect: MontiorCoordinates + }; + topic: "system"; + type: "monitor-info-changed"; + virtualScreen: MontiorCoordinates; + } + + interface TrayIconInfo { + x: number; + y: number; + bounds: { + x: number; + y: number; + width: number; + height: number; + }; + monitorInfo: MonitorInfo; + } + + interface MonitorInfoDetail { + availableRect: MontiorCoordinates; + deviceId: string; + displayDeviceActive: boolean; + monitorRect: MontiorCoordinates; + name: string; + } + + interface MontiorCoordinates { + bottom: number; + left: number; + right: number; + top: number; + } + + interface VirtualScreenCoordinates { + left: number; + top: number; + } + + interface SystemBaseEvent { + topic: string; + type: OpenFinSystemEventType; + uuid: string; + } + + interface DesktopIconClickedEvent { + mouse: { + /** + * the left virtual screen coordinate of the mouse + */ + left: number, + /** + * the top virtual screen coordinate of the mouse + */ + top: number + }; + /** + * the number of milliseconds that have elapsed since the system was started, + */ + tickCount: number; + topic: "system"; + type: "desktop-icon-clicked"; + } + + interface IdleStateChangedEvent { + /** + * How long in milliseconds since the user has been idle. + */ + elapsedTime: number; + /** + * true when the user is idle,false when the user has returned; + */ + isIdle: boolean; + topic: "system"; + type: "idle-state-changed"; + } + + interface WindowBaseEvent { + /** + * the name of the window + */ + name: string; + /** + * always window + */ + topic: "window"; + /** + * window event type + */ + type: OpenFinWindowEventType; + /** + * the UUID of the application the window belongs to + */ + uuid: string; + } + + interface WindowAuthRequestedEvent extends WindowBaseEvent { + authInfo: { + host: string; + isProxy: boolean; + port: number; + realm: string; + scheme: string; + }; + } + + interface WindowBoundsEvent extends WindowBaseEvent { + /** + * describes what kind of change occurred. + * 0 means a change in position. + * 1 means a change in size. + * 2 means a change in position and size. + */ + changeType: number; + /** + * true when pending changes have been applied to the window. + */ + deferred: boolean; + /** + * the new height of the window. + */ + height: number; + /** + * the left-most coordinate of the window. + */ + left: number; + /** + * the top-most coordinate of the window. + */ + top: number; + + type: "bounds-changed" | "bounds-changing" | "disabled-frame-bounds-changed" | "disabled-frame-bounds-changing"; + /** + * the new width of the window. + */ + width: number; + } + + interface WindowExternalProcessStartedEvent extends WindowBaseEvent { + /** + * the process handle uuid + */ + processUuid: string; + type: "external-process-started"; + } + + interface WindowExternalProcessExited extends WindowBaseEvent { + /** + * the process exit code + */ + exitCode: number; + /** + * the process handle uuid + */ + processUuid: string; + type: "external-process-exited"; + } + + interface WindowGroupChangedEvent extends WindowBaseEvent { + /** + * Which group array the window that the event listener was registered on is included in: + * 'source' The window is included in sourceGroup. + * 'target' The window is included in targetGroup. + * 'nothing' The window is not included in sourceGroup nor targetGroup. + */ + memberOf: "source" | "target" | "nothing"; + /** + * The reason this event was triggered. + * 'leave' A window has left the group due to a leave or merge with group. + * 'join' A window has joined the group. + * 'merge' Two groups have been merged together. + * 'disband' There are no other windows in the group. + */ + reason: "leave" | "join" | "merge" | "disband"; + /** + * All the windows in the group the sourceWindow originated from. + */ + sourceGroup: WindowOfGroupInfo[]; + /** + * The UUID of the application the sourceWindow belongs to The source window is the window in which (merge/join/leave)group(s) was called. + */ + sourceWindowAppUuid: string; + /** + * the name of the sourcewindow.The source window is the window in which(merge / join / leave) group(s) was called. + */ + sourceWindowName: string; + /** + * All the windows in the group the targetWindow orginated from + */ + targetGroup: WindowOfGroupInfo[]; + /** + * The UUID of the application the targetWindow belongs to. The target window is the window that was passed into (merge/join) group(s). + */ + targetWindowAppUuid: string; + /** + * The name of the targetWindow. The target window is the window that was passed into (merge/join) group(s). + */ + targetWindowName: string; + type: "group-changed"; + } + + interface WindowOfGroupInfo { + /** + * The UUID of the application this window entry belongs to. + */ + appUuid: string; + /** + * The name of this window entry. + */ + windowName: string; + } + + interface WindowHiddenEvent extends WindowBaseEvent { + /** + * What action prompted the close. + * The reasons are: "hide", "hide-on-close" + */ + reason: "hide" | "hide-on-close"; + type: "hidden"; + } + + interface Window_NavigationRejectedEvent { + name: string; + /** + * source of navigation window name + */ + sourceName: string; + topic: "navigation-rejected"; + /** + * Url that was not reached "http://blocked-content.url" + */ + url: string; + /** + * the UUID of the application the window belongs to. + */ + uuid: string; + } + + interface AnimationTransition { + opacity?: { + /** + * This value is clamped from 0.0 to 1.0 + */ + opacity?: number; + /** + * The total time in milliseconds this transition should take. + */ + duration?: number; + /** + * Treat 'opacity' as absolute or as a delta. Defaults to false. + */ + relative?: boolean; + }; + position?: { + /** + * Defaults to the window's current left position in virtual screen coordinates. + */ + left?: number; + /** + * Defaults to the window's current top position in virtual screen coordinates. + */ + top?: number; + /** + * The total time in milliseconds this transition should take. + */ + duration?: number; + /** + * Treat 'left' and 'top' as absolute or as deltas. Defaults to false. + */ + relative?: boolean; + }; + size?: { + /** + * Optional if height is present. Defaults to the window's current width. + */ + width?: number; + /** + * Optional if width is present. Defaults to the window's current height. + */ + height?: number; + /** + * The total time in milliseconds this transition should take. + */ + duration?: number; + /** + * Treat 'width' and 'height' as absolute or as deltas. Defaults to false. + */ + relative?: boolean; + }; + } + + interface AnimationOptions { + /** + * This option interrupts the current animation. When false it pushes this animation onto the end of the animation queue. + */ + interrupt?: boolean; + /** + * Transition effect. Defaults to 'ease-in-out'. + */ + tween?: OpenFinTweenType; + } + + interface WindowBounds { + /** + * the height of the window. + */ + height?: number; + /** + * left-most coordinate of the window. + */ + left?: number; + /** + * top-most coordinate of the window. + */ + top?: number; + /** + * the width of the window. + */ + width?: number; + } + + interface ExternalApplicationInfo { + parent: { + uuid: string; + name: string; + }; + } + + interface SessionChangedEvent { + /** + * the action that triggered this event: + */ + reason: "lock" + | "unlock" + | "remote-connect" + | "remote-disconnect" + | "unknown"; + topic: "system"; + type: "session-changed"; + } + + interface LaunchInfo { + launchMode: "fin-protocol" + | "fins-protocol" + | "shortcut" + | "command-line" + | "adapter" + | "other" + | string; + } + + type OpenFinTweenType = "linear" + | "ease-in" + | "ease-out" + | "ease-in-out" + | "ease-in-quad" + | "ease-out-quad" + | "ease-in-out-quad" + | "ease-in-cubic" + | "ease-out-cubic" + | "ease-in-out-cubic" + | "ease-out-bounce" + | "ease-in-back" + | "ease-out-back" + | "ease-in-out-back" + | "ease-in-elastic" + | "ease-out-elastic" + | "ease-in-out-elastic"; + + type OpenFinApplicationEventType = "closed" + | "connected" + | "crashed" + | "initialized" + | "manifest-changed" + | "not-responding" + | "out-of-memory" + | "responding" + | "run-requested" + | "started" + | "tray-icon-clicked" + | "window-alert-requested" + | "window-auth-requested" + | "window-closed" + | "window-created" + | "window-end-load" + | "window-navigation-rejected" + | "window-show-requested" + | "window-start-load"; + + type OpenFinExternalApplicationEventType = "connected" + | "disconnected"; + + type OpenFinSystemEventType = "application-closed" + | "application-crashed" + | "application-created" + | "application-started" + | "desktop-icon-clicked" + | "idle-state-changed" + | "monitor-info-changed" + | "session-changed"; + + type OpenFinWindowEventType = "auth-requested" + | "blurred" + | "bounds-changed" + | "bounds-changing" + | "close-requested" + | "closed" + | "disabled-frame-bounds-changed" + | "disabled-frame-bounds-changing" + | "embedded" + | "external-process-exited" + | "external-process-started" + | "focused" + | "frame-disabled" + | "frame-enabled" + | "group-changed" + | "hidden" + | "initialized" + | "maximized" + | "minimized" + | "navigation-rejected" + | "restored" + | "show-requested" + | "shown"; + + type OpenFinAnchor = "top-left" + | "top-right" + | "bottom-left" + | "bottom-right"; +} diff --git a/types/openfin/v34/openfin-tests.ts b/types/openfin/v34/openfin-tests.ts new file mode 100644 index 0000000000..6059f54de7 --- /dev/null +++ b/types/openfin/v34/openfin-tests.ts @@ -0,0 +1,800 @@ +function test_application() { + let application: fin.OpenFinApplication; + // constructor + application = new fin.desktop.Application({ + url: "application.html", + uuid: "74BED629-2D8E-4141-8582-73E364BDFA74", + name: "Application Name", + plugins: false, + mainWindowOptions: { + defaultHeight: 600, + defaultWidth: 800, + defaultTop: 300, + defaultLeft: 300, + autoShow: true + } + }, (successObj) => { + console.log("Application successfully created, HTTP response code:", successObj); + application.run(); + }, (error) => { + console.log("Error creating application:", error); + }); + // createFromManifest + fin.desktop.Application.createFromManifest("http://stuf.com/app.json", (app) => { + console.log(app.uuid); + }, err => console.log(err)); + // getCurrent + application = fin.desktop.Application.getCurrent(); + // wrap + application = fin.desktop.Application.wrap("454C7F31-A915-4EA2-83F2-CFA655453C52"); + // getWindow + application.getWindow(); + // addEventListener + application.addEventListener("closed", (event) => { + console.log("The application has closed"); + }, () => { + console.log("The registration was successful"); + }, reason => { + console.log("failure: " + reason); + }); + // close + application.close(); + // getChildWindows + application.getChildWindows(children => { + children.forEach(childWindow => { + console.log("Showing child: " + childWindow.name); + childWindow.show(); + }); + }); + // getGroups + application.getGroups(allGroups => { + console.log(`There are a total of ${allGroups.length} groups.`); + + let groupCounter = 1; + allGroups.forEach(windowGroup => { + console.log(`Group ${groupCounter} contains ${windowGroup.length} windows.`); + ++groupCounter; + }); + }); + // getManifest + application.getManifest(manifest => { + console.log("Application manifest:"); + console.log(manifest); + }); + // getParentUuid + application.getParentUuid(parentUuid => { + console.log("UUID of parent application:"); + console.log(parentUuid); + }); + // getShortcuts + application.getShortcuts(config => { + console.log("Desktop shortcut is enabled: ", config.desktop); + console.log("Start Menu shortcut is enabled: ", config.startMenu); + console.log("System Startup shortcut is enabled: ", config.systemStartup); + }); + // getInfo + application.getInfo(info => { + console.log(`Launch mode: ${info.launchMode}`); + }); + // getTrayIconInfo + application.getTrayIconInfo(info => { + console.log(info.x, info.y, info.bounds.x, info.bounds.y, info.bounds.height, info.bounds.width, + info.monitorInfo.type, info.monitorInfo.reason); + }); + // isRunning + application.isRunning(running => { + console.log("the application is", running ? "running" : "not running"); + }); + // registerCustomData + application.registerUser("a", "b", () => console.log("done"), err => console.log(err)); + // removeEventListener + application.removeEventListener("closed", (event: any) => { + console.log(event); + }, () => { + console.log("The unregistration was successful"); + }, err => { + console.log("failure:", err); + }); + // removeTrayIcon + application.removeTrayIcon(() => { + console.log("Removed the tray icon."); + }, err => { + console.log("failure:", err); + }); + // restart + application.restart(() => { + console.log("You will not read this."); + }, err => { + console.log("failure:", err); + }); + // schedule restart + application.scheduleRestart(() => { + console.log("You will not read this."); + }, err => { + console.log("failure:", err); + }); + // setShortcuts + application.setShortcuts({ + desktop: true, + startMenu: false, + systemStartup: true + }, () => { + console.log("Successfully set new shortcut states"); + }, error => { + console.log("Failed to set new shortcut states. Error: ", error); + }); + // setTrayIcon + application.setTrayIcon("https://developer.openf.in/download/openfin.png", clickInfo => { + console.log(`The mouse has clicked at (${clickInfo.x}, ${clickInfo.y})`); + }); + // terminate + application.terminate(); + // wait + application.addEventListener("not-responding", () => { + console.log("waiting for hung application"); + application.wait(); + }); + // uuid + const hasUuid = application.uuid; +} + +function test_external_application() { + let externalApp: fin.OpenFinExternalApplication; + // wrap + externalApp = fin.desktop.ExternalApp.wrap('my-uuid'); + // addEventListener + externalApp.addEventListener('connected', () => { + console.log('external app connected'); + }, () => { + console.log('The registration was successful'); + }, (reason, err) => { + console.log(`Error Message: ${err.message} Error Stack: ${err.stack}`); + }); + // removeEventListener + const previousCallback = () => { }; + externalApp.removeEventListener('connected', previousCallback, () => { + console.log('The unregistration was successful'); + }, (reason, err) => { + console.log(`Error Message: ${err.message} Error Stack: ${err.stack}`); + }); + + // getInfo + externalApp.getInfo(info => { + console.log(info.parent.uuid, info.parent.name); + }, err => console.log(err)); +} + +function test_inter_application_bus() { + // addSubscribeListener + fin.desktop.InterApplicationBus.addSubscribeListener((uuid, topic, name) => { + console.log(`The application ${uuid} has subscribed to ${topic}`); + }); + // addUnsubscribeListener + fin.desktop.InterApplicationBus.addUnsubscribeListener((uuid, topic, name) => { + console.log(`The application ${uuid} has unsubscribed to ${topic}`); + }); + // removeSubscribeListener + const aRegisteredListener = (uuid: string, topic: string, name: string) => { }; + fin.desktop.InterApplicationBus.removeSubscribeListener(aRegisteredListener); + // removeUnsubscribeListener + fin.desktop.InterApplicationBus.removeUnsubscribeListener(aRegisteredListener); + // publish + fin.desktop.InterApplicationBus.publish("a topic", { + field1: "value1", + field2: "value2" + }); + // send + fin.desktop.InterApplicationBus.send("an application's uuid", "a topic", { + field1: "value1", + field2: "value2" + }); + // subscribe + fin.desktop.InterApplicationBus.subscribe("*", "a topic", (message, uuid, name) => { + console.log(`The application ${uuid} sent this message: ${message}`); + }); + // unsubscribe + const aRegisteredMessageListener = (message: any, senderUuid: string) => { + console.log(message, senderUuid); + }; + fin.desktop.InterApplicationBus.unsubscribe("*", "a topic", aRegisteredMessageListener); +} + +function test_notification() { + let notification: fin.OpenFinNotification; + // getCurrent + notification = fin.desktop.Notification.getCurrent(); + // close + notification.close(); + // sendMessage + notification = new fin.desktop.Notification({ + duration: 10, + url: "http://localhost:5000/Account/Register", + message: "Hello", + onShow: () => { }, + // onClose: () => { }, + onDismiss: () => { }, + // onClick: () => { }, + onMessage: () => { }, + onError: () => { } + }); + // sendMessageToApplication + notification.sendMessageToApplication("some message"); +} + +function test_system() { + // addEventListener + fin.desktop.System.addEventListener('monitor-info-changed', event => { + console.log("The monitor information has changed to: ", event); + }, () => { + console.log("The registration was successful"); + }, err => { + console.log("failure: " + err); + }); + // clearCache + fin.desktop.System.clearCache({ + cache: true, + cookies: true, + localStorage: true, + appcache: true, + userData: true + }); + // deleteCacheOnExit + fin.desktop.System.deleteCacheOnExit(() => { + console.log("successful"); + }, err => { + console.log("failure: " + err); + }); + // downloadAsset + const dirAppAsset = { + src: 'http://local:8000/dir.zip', + alias: 'dirApp', + version: '1.23.24', + target: 'dir.bat', + args: '' + }; + fin.desktop.System.downloadAsset(dirAppAsset, progress => { + const downloadedPercent = Math.floor((progress.downloadedBytes / progress.totalBytes) * 100); + console.log(`Downloaded ${downloadedPercent}%`); + }, p => { + console.log(`Downlod complete, can be found on ${p.path}`); + // lets launch our application asset. + // launchDirApp(); + }, (reason, err) => { + console.log(reason, err); + }); + // downloadRuntime + fin.desktop.System.downloadRuntime({ version: '9.61.31.56' }, progress => { + console.log(progress.downloadedBytes, progress.downloadedBytes); + }, () => console.log('download complete'), err => console.error(err)); + // downloadPreloadScript + const preloadScripts = [ + { url: 'http://whatever.com/script.js' } + ]; + fin.desktop.System.downloadPreloadScripts(preloadScripts, info => { + const downloadInfo = info[0]; + console.log(downloadInfo.success, downloadInfo.url, downloadInfo.error); + }, err => { + console.log(err); + }); + // exit + fin.desktop.System.exit(() => { + console.log("successful"); + }, err => { + console.log("failure: " + err); + }); + // flushCookieStore + fin.desktop.System.flushCookieStore(() => { + console.log('successful'); + }, err => { + console.log('failure', err); + }); + // getAllApplications + fin.desktop.System.getAllApplications(applicationInfoList => { + applicationInfoList.forEach(applicationInfo => { + console.log("Showing information for application with uuid: " + + applicationInfo.uuid); + console.log("isRunning: ", applicationInfo.isRunning); + }); + }); + // getAllExternalApplications + fin.desktop.System.getAllExternalApplications(externalAppsInfoList => { + externalAppsInfoList.forEach(appInfo => { + console.log(`External app connected to the runtime with UUID ${appInfo.uuid}`); + }); + }); + // getAllWindows + fin.desktop.System.getAllWindows(windowInfoList => { + windowInfoList.forEach(windowInfo => { + console.log("Showing information for application with uuid: ", windowInfo.uuid); + console.log("Main window: ", windowInfo.mainWindow); + console.log("Child windows: ", windowInfo.childWindows); + }); + }); + // getAppAssetInfo + fin.desktop.System.getAppAssetInfo({ alias: 'myAppAsset' }, info => { + console.log(info.alias, info.args, info.mandatory, info.src, info.target, info.version); + }, err => console.log(err)); + // getCommandLineArguments + fin.desktop.System.getCommandLineArguments(args => { + console.log("The command line arguments are " + args); + }); + // getCookieInfo + fin.desktop.System.getCookies({ name: 'myCookie1'}, cookies => { + const cookie1 = cookies[0]; + console.log(cookie1.name, cookie1.domain, cookie1.path); + }, err => console.log(err)); + // getDeviceId + fin.desktop.System.getDeviceId(id => { + console.log("The id of the device is: " + id); + }); + // getDeviceUserId + fin.desktop.System.getDeviceUserId(id => console.log(id), err => console.error(err)); + // getEntityInfo + fin.desktop.System.getEntityInfo('uuid', 'name', info => { + console.log(info.entityType, info.name, info.uuid, info.parent.name, info.parent.uuid); + }, err => console.log(err)); + // getEnvironmentVariable + fin.desktop.System.getEnvironmentVariable("APPDATA", variable => { + console.log("this is the APPDATA value", variable); + }); + // getFocusedWindow + fin.desktop.System.getFocusedWindow(win => { + console.log(win.uuid, win.name); + }, err => console.log(err)); + // getHostSpecs + fin.desktop.System.getHostSpecs(info => { + console.log(info); + }, error => { + console.log('There was an error:', error); + }); + // getLog + fin.desktop.System.getLog('debug-2015-01-08-22-27-53.log', log => { + console.log(log); + }); + // getLogList + fin.desktop.System.getLogList(logList => { + logList.forEach(logInfo => { + console.log(`The filename of the log is ${logInfo.name}, the size is ${logInfo.size}, and the date of creation is ${logInfo.date}`); + }); + }); + // getMinLogLevel + fin.desktop.System.getMinLogLevel(level => console.log(level), err => console.log(err)); + // getMonitorInfo + fin.desktop.System.getMonitorInfo(monitorInfo => { + console.log("This object contains information about all monitors: ", monitorInfo); + }); + // getMousePosition + fin.desktop.System.getMousePosition(mousePosition => { + console.log(`The mouse is located at left: ${mousePosition.left}, top: ${mousePosition.top}`); + }); + // getProcessList + fin.desktop.System.getProcessList(list => { + list.forEach(process => { + console.log(`UUID: ${process.uuid}, Application Name: ${process.name}`); + }); + }); + // getProxySettings + fin.desktop.System.getProxySettings(proxy => { + console.log(proxy); + }); + // getRvmInfo + fin.desktop.System.getRvmInfo(rvmInfoObject => { + console.log("RVM version:", rvmInfoObject.version); + console.log("RVM has been running since:", rvmInfoObject["start-time"]); + }, err => { + console.log("Failed to get rvm info, error message:", err); + }); + // getVersion + fin.desktop.System.getVersion(version => { + console.log("The version is " + version); + }); + // launchExternalProcess + fin.desktop.System.launchExternalProcess({ + path: "notepad", + arguments: "", + listener(result) { + console.log('the exit code', result.exitCode); + } + }, payload => { + console.log('Success:', payload.uuid); + }, error => { + console.log('Error:', error); + }); + // launch external process with an alias + fin.desktop.System.launchExternalProcess({ + // Additionally note that the executable found in the zip file specified in appAssets + // will default to the one mentioned by appAssets.target + // If the the path below refers to a specific path it will override this default + alias: "myApp", + listener(result) { + console.log('the exit code', result.exitCode); + } + }, payload => { + console.log('Success:', payload.uuid); + }, error => { + console.log('Error:', error); + }); + // + fin.desktop.System.launchExternalProcess({ + alias: "myApp", + arguments: "e f g", + listener(result) { + console.log('the exit code', result.exitCode); + } + }, payload => { + console.log('Success:', payload.uuid); + }, error => { + console.log('Error:', error); + }); + // + fin.desktop.System.launchExternalProcess({ + path: "C:\Users\ExampleUser\AppData\Local\OpenFin\OpenFinRVM.exe", + arguments: "--version", + certificate: { + trusted: true, + subject: 'O=OpenFin INC., L=New York, S=NY, C=US', + thumbprint: '3c a5 28 19 83 05 fe 69 88 e6 8f 4b 3a af c5 c5 1b 07 80 5b' + }, + listener(result) { + console.log('the exit code', result.exitCode); + } + }, payload => { + console.log('Success:', payload.uuid); + }, error => { + console.log('Error:', error); + }); + // log + fin.desktop.System.log("info", "An example log message", () => { + console.log("message successfully logged"); + }, err => { + console.log(err); + }); + // monitorExternalProcess + fin.desktop.System.monitorExternalProcess({ + pid: 2508, + listener(result) { + console.log('the exit code', result.exitCode); + } + }, payload => { + console.log("The process is now being monitored: ", payload.uuid); + }, error => { + console.log("Error:", error); + }); + // openUrlWithBrowser + fin.desktop.System.openUrlWithBrowser("https://developer.openf.in/", () => { + console.log("successful"); + }, err => { + console.log("failure: " + err); + }); + // readRegistryValue + fin.desktop.System.readRegistryValue('HKEY_SOMETHING', 'HARDWARE\\SOMETHING', 'BootSomething', info => { + console.log(info.data, info.rootKey, info.subkey, info.type, info.value); + }, err => console.log(err)); + // registerExternalConnection + fin.desktop.System.registerExternalConnection("remote-connection-uuid", (...args: any[]) => { + console.log(args); + }); + // releaseExternalProcess + fin.desktop.System.launchExternalProcess({ + path: "notepad", + arguments: "", + listener(result) { + console.log("The exit code", result.exitCode); + } + }, result => { + console.log("Result UUID is " + result.uuid); + + // release it. + fin.desktop.System.releaseExternalProcess(result.uuid, () => { + console.log("Process has been unmapped!"); + }, reason => { + console.log("failure: " + reason); + }); + }); + // removeEventListener + fin.desktop.System.removeEventListener("monitor-info-changed", (event) => { + console.log(event); + }, () => { + console.log("successful"); + }, (err: any) => { + console.log("failure: " + err); + }); + // setMinLogLevel + fin.desktop.System.setMinLogLevel("log level", () => console.log('Success'), (err: any) => console.error(err)); + // showDeveloperTools + fin.desktop.System.showDeveloperTools("uuid", "name", () => { + console.log("successful"); + }, err => { + console.log("failure: " + err); + }); + // terminateExternalProcess + fin.desktop.System.launchExternalProcess({ + // notepad is in the system's PATH + path: "notepad", + arguments: "", + listener(result) { + console.log("The exit code", result.exitCode); + } + }, result => { + console.log("Result UUID is " + result.uuid); + + // Attempt to close the process. Terminate after 4 seconds if it + // has not done so. + fin.desktop.System.terminateExternalProcess(result.uuid, 4000, info => { + console.log("Termination result " + info.result); + }, reason => { + console.log("failure: " + reason); + }); + }); + // updateProxySettings + fin.desktop.System.updateProxySettings("type", "proxyAddress", 8080, () => { + console.log('success'); + }, err => { + console.log(err); + }); +} + +function test_system_clipboard() { + // availableFormats + fin.desktop.System.Clipboard.availableFormats(null, formats => { + formats.forEach(format => console.log(`The format ${format} is available to read`)); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); + // readHtml + fin.desktop.System.Clipboard.readHtml(null, html => { + console.log(`This is the html from the clipboard: ${html}`); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); + // readRtf + fin.desktop.System.Clipboard.readRtf(null, rtf => { + console.log(`This is the rtf from the clipboard: ${rtf}`); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); + // readText + fin.desktop.System.Clipboard.readText(null, text => { + console.log(`This is the text from the clipboard: ${text}`); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); + // write + fin.desktop.System.Clipboard.write({ + text: 'Hello Text!', + html: '

Hello Html

', + rtf: 'Hello Rtf' + }, null, () => { + console.log('Success!!'); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); + // writeHtml + fin.desktop.System.Clipboard.writeHtml('

Hello World

', null, () => { + console.log('Success!!'); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); + // writeRtf + fin.desktop.System.Clipboard.writeRtf('Hello World!', null, () => { + console.log('Success!!'); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); + // writeText + fin.desktop.System.Clipboard.writeText('Hello World', null, () => { + console.log('Success!!'); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); +} + +function test_window() { + let finWindow: fin.OpenFinWindow; + // constructor + finWindow = new fin.desktop.Window({ + name: "childWindow", + url: "child.html", + defaultWidth: 320, + defaultHeight: 320, + defaultTop: 10, + defaultLeft: 300, + frame: false, + resizable: false, + state: "normal" + }, () => { + const _win = finWindow.getNativeWindow(); + _win.addEventListener("DOMContentLoaded", () => { finWindow.show(); }); + }, error => { + console.log("Error creating window:", error); + }); + // getCurrent + finWindow = fin.desktop.Window.getCurrent(); + // getNativeWindow + let nativeWindow: Window; + nativeWindow = finWindow.getNativeWindow(); + // getParentApplication + let parentApp: fin.OpenFinApplication; + parentApp = finWindow.getParentApplication(); + // getParentWindow + let parentFinWindow: fin.OpenFinWindow; + parentFinWindow = finWindow.getParentWindow(); + // wrap + finWindow = fin.desktop.Window.wrap("uuid", "name"); + // addEventListener + finWindow.addEventListener("bounds-changed", event => { + console.log("The window has been moved or resized"); + }, () => { + console.log("The registration was successful"); + }, reason => { + console.log("failure:" + reason); + }); + // animate + finWindow.animate({ + opacity: { + opacity: 0.15, + duration: 1000 + }, + position: { + left: 10, + top: 10, + duration: 3000 + } + }, { + interrupt: false + }, evt => { + // Callback will only fire after both "opacity" and "position" have finished animating. + }); + // authenticate + finWindow.addEventListener('auth-requested', evt => { + finWindow.authenticate('userName', 'P@assw0rd', () => { }, (reason, err) => { + console.log("failure:", err); + }); + }); + // blur + finWindow.blur(); + // bringToFront + finWindow.bringToFront(); + // close + finWindow.close(); + // disableFrame + finWindow.disableFrame(); + // enableFrame + finWindow.enableFrame(); + // flash + finWindow.flash(); + // focus + finWindow.focus(); + // getBounds + finWindow.getBounds(bounds => { + console.log(`top: ${bounds.top} left: ${bounds.left} height: ${bounds.height} width: ${bounds.width}`); + }); + // getOptions + finWindow.getOptions(options => { + console.log(options); + }); + // getSnapshot + finWindow.getSnapshot(base64Snapshot => { + console.log("data:image/png;base64," + base64Snapshot); + }); + // getState + finWindow.getState(state => { + console.log("state: " + state); + }); + // getZoomLevel + finWindow.getZoomLevel(level => { + console.log("zoom level: " + level); + }, error => { + console.log('error:', error); + }); + // hide + finWindow.hide(); + // isShowing + finWindow.isShowing(showing => { + console.log("the window is " + (showing ? "showing" : "hidden")); + }); + // joinGroup + let secondWindow = new fin.desktop.Window({ + url: "http://www.openfin.co", + name: "secondWindow", + autoShow: true + }, () => { + // When mainWindow moves or is moved, secondWindow moves by the same amount + secondWindow.joinGroup(finWindow); + }); + // leaveGroup + secondWindow = new fin.desktop.Window({ + url: "http://www.openfin.co", + name: "secondWindow", + autoShow: true + }, () => { + // When finWindow moves or is moved, secondWindow moves by the same amount + secondWindow.joinGroup(finWindow, () => { + // once we are in the group, lets leave it. + secondWindow.leaveGroup(); + }); + }); + // maximize + finWindow.maximize(); + // mergeGroups + { + const finWindowOne = new fin.desktop.Window({ + url: "http://www.openfin.co", + name: "finWindowOne", + autoShow: true + }); + const finWindowTwo = new fin.desktop.Window({ + url: "http://www.openfin.co", + name: "finWindowTwo", + autoShow: true + }); + const finWindowThree = new fin.desktop.Window({ + url: "http://www.openfin.co", + name: "finWindowThree", + autoShow: true + }); + const finWindowFour = new fin.desktop.Window({ + url: "http://www.openfin.co", + name: "finWindowFour", + autoShow: true + }); + // When finWindowOne moves or is moved, finWindowTwo moves by the same amount + finWindowOne.joinGroup(finWindowTwo); + // When finWindowThree moves or is moved, finWindowFour moves by the same amount + finWindowThree.joinGroup(finWindowFour); + // finWindowOne, finWindowTwo, finWindowThree, and finWindowFour now move together in the same group + finWindowOne.mergeGroups(finWindowThree); + } + // minimize + finWindow.minimize(); + // moveBy + finWindow.moveBy(10, 10); + // moveTo + finWindow.moveTo(100, 200); + // removeEventListener + finWindow.removeEventListener("bounds-changed", event => { + console.log(event); + }); + // resizeBy + finWindow.resizeBy(10, 10, "top-right"); + // resizeTo + finWindow.resizeTo(10, 10, "top-right"); + // restore + finWindow.restore(); + // setAsForeground + finWindow.setAsForeground(); + // setBounds + finWindow.setBounds(100, 200, 400, 400); + // setZoomLevel + finWindow.setZoomLevel(10); + // show + finWindow.show(); + // showAt + finWindow.showAt(10, 10, false); + // stopFlashing + finWindow.stopFlashing(); + // updateOptions + finWindow.updateOptions({ + frame: false, + maxWidth: 500 + }); +} + +function test_frame() { + // wrap + const frame = fin.desktop.Frame.wrap('uuid', 'name'); + // getCurrent + const currentFrame = fin.desktop.Frame.getCurrent(); + // addEventlistener + frame.addEventListener('event', () => console.log('on event'), () => console.log('success'), err => console.error(err)); + // removeEventListener + frame.removeEventListener('event', () => console.log('on event'), () => console.log('success'), err => console.error(err)); + // getInfo + frame.getInfo(info => { + console.log(info.uuid, info.name, info.entityType, info.parent.uuid, info.parent.name); + }, err => console.error(err)); + // getParentWindow + frame.getParentWindow(parent => { + console.log(parent.uuid, parent.name, parent.entityType, parent.parent.uuid, parent.parent.name); + }, err => console.error(err)); +} diff --git a/types/openfin/v34/tsconfig.json b/types/openfin/v34/tsconfig.json new file mode 100644 index 0000000000..c446671530 --- /dev/null +++ b/types/openfin/v34/tsconfig.json @@ -0,0 +1,86 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "paths": { + "openfin": [ + "openfin/v34" + ] + }, + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "openfin-tests.ts", + "_v2/api/application/application.d.ts", + "_v2/api/base.d.ts", + "_v2/api/clipboard/clipboard.d.ts", + "_v2/api/clipboard/write-request.d.ts", + "_v2/api/external-application/external-application.d.ts", + "_v2/api/fin.d.ts", + "_v2/api/frame/frame.d.ts", + "_v2/api/global-hotkey/index.d.ts", + "_v2/api/interappbus/channel/channel.d.ts", + "_v2/api/interappbus/channel/client.d.ts", + "_v2/api/interappbus/channel/index.d.ts", + "_v2/api/interappbus/channel/provider.d.ts", + "_v2/api/interappbus/interappbus.d.ts", + "_v2/api/notification/notification.d.ts", + "_v2/api/system/application.d.ts", + "_v2/api/system/clearCacheOption.d.ts", + "_v2/api/system/cookie.d.ts", + "_v2/api/system/crashReporterOption.d.ts", + "_v2/api/system/download-asset.d.ts", + "_v2/api/system/download-preload.d.ts", + "_v2/api/system/entity.d.ts", + "_v2/api/system/external-process.d.ts", + "_v2/api/system/host-specs.d.ts", + "_v2/api/system/log.d.ts", + "_v2/api/system/monitor.d.ts", + "_v2/api/system/point.d.ts", + "_v2/api/system/process.d.ts", + "_v2/api/system/proxy.d.ts", + "_v2/api/system/registry-info.d.ts", + "_v2/api/system/runtime-info.d.ts", + "_v2/api/system/rvm.d.ts", + "_v2/api/system/system.d.ts", + "_v2/api/system/window.d.ts", + "_v2/api/window/bounds-changed.d.ts", + "_v2/api/window/bounds.d.ts", + "_v2/api/window/transition.d.ts", + "_v2/api/window/window.d.ts", + "_v2/environment/environment.d.ts", + "_v2/environment/node-env.d.ts", + "_v2/environment/openfin-env.d.ts", + "_v2/environment/openfin-renderer-api.d.ts", + "_v2/identity.d.ts", + "_v2/launcher/launcher.d.ts", + "_v2/launcher/nix-launch.d.ts", + "_v2/launcher/util.d.ts", + "_v2/launcher/win-launch.d.ts", + "_v2/main.d.ts", + "_v2/of-main.d.ts", + "_v2/transport/elipc.d.ts", + "_v2/transport/port-discovery.d.ts", + "_v2/transport/transport-errors.d.ts", + "_v2/transport/transport.d.ts", + "_v2/transport/websocket.d.ts", + "_v2/transport/wire.d.ts", + "_v2/util/normalize-config.d.ts", + "_v2/util/promises.d.ts", + "_v2/util/ref-counter.d.ts" + ] +} diff --git a/types/openfin/v34/tslint.json b/types/openfin/v34/tslint.json new file mode 100644 index 0000000000..f95a4974aa --- /dev/null +++ b/types/openfin/v34/tslint.json @@ -0,0 +1,18 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "max-line-length": false, + "no-redundant-jsdoc-2": false, + "jsdoc-format": false, + "no-var-keyword": false, + "whitespace": false, + "semicolon": false, + "strict-export-declare-modifiers": false, + "array-type": false, + "unified-signatures": false, + "void-return": false, + "ban-types": false, + "callable-types": false, + "no-const-enum": false + } +}